156 {
158 uint32 count = countArg.value_or(10);
159
161 {
163 }
164 else
165 {
167 }
168
169 if (!count || !itemId)
170 return false;
171
173
174
175 uint32 inventoryCount = 0;
176
180
181 if (result)
182 inventoryCount = (*result)[0].Get<
uint64>();
183
185 stmt->SetData(0, itemId);
186 stmt->SetData(1, count);
188
189 if (result)
190 {
191 do
192 {
193 Field* fields = result->Fetch();
199 std::string ownerName = fields[5].
Get<std::string>();
200
201 char const* itemPos = nullptr;
203 itemPos = "[equipped]";
205 itemPos = "[in inventory]";
207 itemPos = "[in bank]";
208 else
209 itemPos = "";
210
212 }
213 while (result->NextRow());
214
216
217 if (count > resultCount)
218 count -= resultCount;
219 else
220 count = 0;
221 }
222
223
225
227 stmt->SetData(0, itemId);
229
230 if (result)
231 mailCount = (*result)[0].Get<
uint64>();
232
233 if (count > 0)
234 {
236 stmt->SetData(0, itemId);
237 stmt->SetData(1, count);
239 }
240 else
242
243 if (result)
244 {
245 do
246 {
247 Field* fields = result->Fetch();
252 std::string itemSenderName = fields[4].
Get<std::string>();
254 std::string itemReceiverName = fields[6].
Get<std::string>();
255
256 char const* itemPos = "[in mail]";
257
258 handler->
PSendSysMessage(
LANG_ITEMLIST_MAIL, itemGuid, itemSenderName.c_str(), itemSender, itemSenderAccountId, itemReceiverName.c_str(), itemReceiver, itemReceiverAccount, itemPos);
259 }
260 while (result->NextRow());
261
263
264 if (count > resultCount)
265 count -= resultCount;
266 else
267 count = 0;
268 }
269
270
272
274 stmt->SetData(0, itemId);
276
277 if (result)
278 auctionCount = (*result)[0].Get<
uint64>();
279
280 if (count > 0)
281 {
283 stmt->SetData(0, itemId);
284 stmt->SetData(1, count);
286 }
287 else
289
290 if (result)
291 {
292 do
293 {
294 Field* fields = result->Fetch();
298 std::string ownerName = fields[3].
Get<std::string>();
299
300 char const* itemPos = "[in auction]";
301
303 }
304 while (result->NextRow());
305 }
306
307
309
311 stmt->SetData(0, itemId);
313
314 if (result)
315 guildCount = (*result)[0].Get<
uint64>();
316
318 stmt->SetData(0, itemId);
319 stmt->SetData(1, count);
321
322 if (result)
323 {
324 do
325 {
326 Field* fields = result->Fetch();
329 std::string guildName = fields[2].
Get<std::string>();
330
331 char const* itemPos = "[in guild bank]";
332
334 }
335 while (result->NextRow());
336
338
339 if (count > resultCount)
340 count -= resultCount;
341 else
342 count = 0;
343 }
344
345 if (inventoryCount + mailCount + auctionCount + guildCount == 0)
346 {
349 return false;
350 }
351
353
354 return true;
355 }
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:880
@ 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
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:103
Definition: ChatCommandTags.h:205
constexpr decltype(auto) get()
Definition: ChatCommandTags.h:289
constexpr bool holds_alternative() const
Definition: ChatCommandTags.h:303
static bool IsEquipmentPos(uint16 pos)
Definition: Player.h:1232
static bool IsInventoryPos(uint16 pos)
Definition: Player.h:1230
static bool IsBankPos(uint16 pos)
Definition: Player.h:1235