153 {
155 uint32 count = countArg.value_or(10);
156
158 {
160 }
161 else
162 {
164 }
165
166 if (!count || !itemId)
167 return false;
168
170
171
172 uint32 inventoryCount = 0;
173
177
178 if (result)
179 inventoryCount = (*result)[0].Get<
uint64>();
180
182 stmt->SetData(0, itemId);
183 stmt->SetData(1, count);
185
186 if (result)
187 {
188 do
189 {
190 Field* fields = result->Fetch();
196 std::string ownerName = fields[5].
Get<std::string>();
197
198 char const* itemPos = nullptr;
200 itemPos = "[equipped]";
202 itemPos = "[in inventory]";
204 itemPos = "[in bank]";
205 else
206 itemPos = "";
207
209 }
210 while (result->NextRow());
211
213
214 if (count > resultCount)
215 count -= resultCount;
216 else
217 count = 0;
218 }
219
220
222
224 stmt->SetData(0, itemId);
226
227 if (result)
228 mailCount = (*result)[0].Get<
uint64>();
229
230 if (count > 0)
231 {
233 stmt->SetData(0, itemId);
234 stmt->SetData(1, count);
236 }
237 else
239
240 if (result)
241 {
242 do
243 {
244 Field* fields = result->Fetch();
249 std::string itemSenderName = fields[4].
Get<std::string>();
251 std::string itemReceiverName = fields[6].
Get<std::string>();
252
253 char const* itemPos = "[in mail]";
254
255 handler->
PSendSysMessage(
LANG_ITEMLIST_MAIL, itemGuid, itemSenderName, itemSender, itemSenderAccountId, itemReceiverName, itemReceiver, itemReceiverAccount, itemPos);
256 }
257 while (result->NextRow());
258
260
261 if (count > resultCount)
262 count -= resultCount;
263 else
264 count = 0;
265 }
266
267
269
271 stmt->SetData(0, itemId);
273
274 if (result)
275 auctionCount = (*result)[0].Get<
uint64>();
276
277 if (count > 0)
278 {
280 stmt->SetData(0, itemId);
281 stmt->SetData(1, count);
283 }
284 else
286
287 if (result)
288 {
289 do
290 {
291 Field* fields = result->Fetch();
295 std::string ownerName = fields[3].
Get<std::string>();
296
297 char const* itemPos = "[in auction]";
298
300 }
301 while (result->NextRow());
302 }
303
304
306
308 stmt->SetData(0, itemId);
310
311 if (result)
312 guildCount = (*result)[0].Get<
uint64>();
313
315 stmt->SetData(0, itemId);
316 stmt->SetData(1, count);
318
319 if (result)
320 {
321 do
322 {
323 Field* fields = result->Fetch();
326 std::string guildName = fields[2].
Get<std::string>();
327
328 char const* itemPos = "[in guild bank]";
329
331 }
332 while (result->NextRow());
333
335
336 if (count > resultCount)
337 count -= resultCount;
338 else
339 count = 0;
340 }
341
342 if (inventoryCount + mailCount + auctionCount + guildCount == 0)
343 {
345 return false;
346 }
347
349
350 return true;
351 }
std::uint8_t uint8
Definition: Define.h:109
@ LANG_ITEMLIST_GUILD
Definition: Language.h:907
@ LANG_ITEMLIST_MAIL
Definition: Language.h:551
@ LANG_COMMAND_NOITEMFOUND
Definition: Language.h:468
@ LANG_ITEMLIST_AUCTION
Definition: Language.h:552
@ LANG_ITEMLIST_SLOT
Definition: Language.h:550
@ LANG_COMMAND_LISTITEMMESSAGE
Definition: Language.h:470
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:46
@ CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY
Definition: CharacterDatabase.h:358
@ CHAR_SEL_MAIL_COUNT_ITEM
Definition: CharacterDatabase.h:355
@ CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM
Definition: CharacterDatabase.h:356
@ CHAR_SEL_GUILD_BANK_COUNT_ITEM
Definition: CharacterDatabase.h:357
@ CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY
Definition: CharacterDatabase.h:361
@ CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY
Definition: CharacterDatabase.h:362
@ CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM
Definition: CharacterDatabase.h:354
@ CHAR_SEL_MAIL_ITEMS_BY_ENTRY
Definition: CharacterDatabase.h:360
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
Definition: ChatCommandTags.h:204
constexpr decltype(auto) get()
Definition: ChatCommandTags.h:288
constexpr bool holds_alternative() const
Definition: ChatCommandTags.h:302
static bool IsEquipmentPos(uint16 pos)
Definition: Player.h:1256
static bool IsInventoryPos(uint16 pos)
Definition: Player.h:1254
static bool IsBankPos(uint16 pos)
Definition: Player.h:1259