154 {
156 uint32 count = countArg.value_or(10);
157
159 {
161 }
162 else
163 {
165 }
166
167 if (!count || !itemId)
168 return false;
169
171
172
173 uint32 inventoryCount = 0;
174
178
179 if (result)
180 inventoryCount = (*result)[0].Get<
uint64>();
181
183 stmt->SetData(0, itemId);
184 stmt->SetData(1, count);
186
187 if (result)
188 {
189 do
190 {
191 Field* fields = result->Fetch();
197 std::string ownerName = fields[5].
Get<std::string>();
198
199 char const* itemPos = nullptr;
201 itemPos = "[equipped]";
203 itemPos = "[in inventory]";
205 itemPos = "[in bank]";
206 else
207 itemPos = "";
208
210 }
211 while (result->NextRow());
212
214
215 if (count > resultCount)
216 count -= resultCount;
217 else
218 count = 0;
219 }
220
221
223
225 stmt->SetData(0, itemId);
227
228 if (result)
229 mailCount = (*result)[0].Get<
uint64>();
230
231 if (count > 0)
232 {
234 stmt->SetData(0, itemId);
235 stmt->SetData(1, count);
237 }
238 else
240
241 if (result)
242 {
243 do
244 {
245 Field* fields = result->Fetch();
250 std::string itemSenderName = fields[4].
Get<std::string>();
252 std::string itemReceiverName = fields[6].
Get<std::string>();
253
254 char const* itemPos = "[in mail]";
255
256 handler->
PSendSysMessage(
LANG_ITEMLIST_MAIL, itemGuid, itemSenderName.c_str(), itemSender, itemSenderAccountId, itemReceiverName.c_str(), itemReceiver, itemReceiverAccount, itemPos);
257 }
258 while (result->NextRow());
259
261
262 if (count > resultCount)
263 count -= resultCount;
264 else
265 count = 0;
266 }
267
268
270
272 stmt->SetData(0, itemId);
274
275 if (result)
276 auctionCount = (*result)[0].Get<
uint64>();
277
278 if (count > 0)
279 {
281 stmt->SetData(0, itemId);
282 stmt->SetData(1, count);
284 }
285 else
287
288 if (result)
289 {
290 do
291 {
292 Field* fields = result->Fetch();
296 std::string ownerName = fields[3].
Get<std::string>();
297
298 char const* itemPos = "[in auction]";
299
301 }
302 while (result->NextRow());
303 }
304
305
307
309 stmt->SetData(0, itemId);
311
312 if (result)
313 guildCount = (*result)[0].Get<
uint64>();
314
316 stmt->SetData(0, itemId);
317 stmt->SetData(1, count);
319
320 if (result)
321 {
322 do
323 {
324 Field* fields = result->Fetch();
327 std::string guildName = fields[2].
Get<std::string>();
328
329 char const* itemPos = "[in guild bank]";
330
332 }
333 while (result->NextRow());
334
336
337 if (count > resultCount)
338 count -= resultCount;
339 else
340 count = 0;
341 }
342
343 if (inventoryCount + mailCount + auctionCount + guildCount == 0)
344 {
346 return false;
347 }
348
350
351 return true;
352 }
std::uint8_t uint8
Definition: Define.h:110
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
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
@ LANG_ITEMLIST_GUILD
Definition: Language.h:889
@ LANG_ITEMLIST_MAIL
Definition: Language.h:534
@ LANG_COMMAND_NOITEMFOUND
Definition: Language.h:451
@ LANG_ITEMLIST_AUCTION
Definition: Language.h:535
@ LANG_ITEMLIST_SLOT
Definition: Language.h:533
@ LANG_COMMAND_LISTITEMMESSAGE
Definition: Language.h:453
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:1244
static bool IsInventoryPos(uint16 pos)
Definition: Player.h:1242
static bool IsBankPos(uint16 pos)
Definition: Player.h:1247