64 {
"auras", listAurasCommandTable },
71 {
"list", listCommandTable },
86 uint32 count = countArg.value_or(10);
94 result =
WorldDatabase.PQuery(
"SELECT COUNT(guid) FROM creature WHERE id='{}'", creatureId);
96 creatureCount = (*result)[0].GetUInt64();
101 result =
WorldDatabase.PQuery(
"SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '{}', 2) + POW(position_y - '{}', 2) + POW(position_z - '{}', 2)) AS order_ FROM creature WHERE id = '{}' ORDER BY order_ ASC LIMIT {}",
105 result =
WorldDatabase.PQuery(
"SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '{}' LIMIT {}",
112 Field* fields = result->Fetch();
118 bool liveFound =
false;
125 thisMap =
sMapMgr->FindBaseNonInstanceMap(mapId);
131 if (creBounds.first != creBounds.second)
133 for (std::unordered_multimap<uint32, Creature*>::const_iterator itr = creBounds.first; itr != creBounds.second;)
153 while (result->NextRow());
163 uint32 itemId = item->Item->ItemId;
164 uint32 count = countArg.value_or(10);
172 uint32 inventoryCount = 0;
179 inventoryCount = (*result)[0].GetUInt64();
190 Field* fields = result->Fetch();
191 ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt32());
194 ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt32());
196 std::string ownerName = fields[5].
GetString();
198 char const* itemPos =
nullptr;
200 itemPos =
"[equipped]";
202 itemPos =
"[in inventory]";
204 itemPos =
"[in bank]";
210 while (result->NextRow());
214 if (count > resultCount)
215 count -= resultCount;
228 mailCount = (*result)[0].GetUInt64();
244 Field* fields = result->Fetch();
249 std::string itemSenderName = fields[4].
GetString();
251 std::string itemReceiverName = fields[6].
GetString();
253 char const* itemPos =
"[in mail]";
255 handler->
PSendSysMessage(
LANG_ITEMLIST_MAIL, itemGuid, itemSenderName.c_str(), itemSender, itemSenderAccountId, itemReceiverName.c_str(), itemReceiver, itemReceiverAccount, itemPos);
257 while (result->NextRow());
261 if (count > resultCount)
262 count -= resultCount;
275 auctionCount = (*result)[0].GetUInt64();
291 Field* fields = result->Fetch();
295 std::string ownerName = fields[3].
GetString();
297 char const* itemPos =
"[in auction]";
301 while (result->NextRow());
312 guildCount = (*result)[0].GetUInt64();
323 Field* fields = result->Fetch();
326 std::string guildName = fields[2].
GetString();
328 char const* itemPos =
"[in guild bank]";
332 while (result->NextRow());
336 if (count > resultCount)
337 count -= resultCount;
342 if (inventoryCount + mailCount + auctionCount + guildCount == 0)
364 uint32 count = countArg.value_or(10);
372 result =
WorldDatabase.PQuery(
"SELECT COUNT(guid) FROM gameobject WHERE id='{}'", gameObjectId);
374 objectCount = (*result)[0].GetUInt64();
379 result =
WorldDatabase.PQuery(
"SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '{}', 2) + POW(position_y - '{}', 2) + POW(position_z - '{}', 2)) AS order_ FROM gameobject WHERE id = '{}' ORDER BY order_ ASC LIMIT {}",
383 result =
WorldDatabase.PQuery(
"SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '{}' LIMIT {}",
384 gameObjectId, count);
390 Field* fields = result->Fetch();
397 bool liveFound =
false;
404 thisMap =
sMapMgr->FindBaseNonInstanceMap(mapId);
410 if (goBounds.first != goBounds.second)
412 for (std::unordered_multimap<uint32, GameObject*>::const_iterator itr = goBounds.first; itr != goBounds.second;)
415 handler->
PSendSysMessage(
LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->
name.c_str(), x, y, z, mapId, itr->second->GetGUID().ToString().c_str(), itr->second->isSpawned() ?
"*" :
" ");
427 handler->
PSendSysMessage(
LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->
name.c_str(), x, y, z, mapId,
"",
"");
432 while (result->NextRow());
472 for (
auto const& [aurId, aurApp] : auras)
476 Aura const* aura = aurApp->GetBase();
482 std::ostringstream ss_name;
483 ss_name <<
"|cffffffff|Hspell:" << aura->
GetId() <<
"|h[" << name <<
"]|h|r";
495 if (auraList.empty())
498 bool sizeLogged =
false;
521 return spellInfo->
Id == spellId;
523 if (!namePart.empty())
525 std::string name = spellInfo->
SpellName[locale];
541 stmt->
setUInt32(0, player->GetGUID().GetCounter());
545 Field* fields = queryResult->Fetch();
548 std::string nameLink = handler->
playerLink(player->GetName());
553 stmt->
setUInt32(0, player->GetGUID().GetCounter());
560 Field* queryFields = queryResult->Fetch();
563 std::string sender = queryFields[2].
GetString();
565 std::string receiver = queryFields[4].
GetString();
566 std::string subject = queryFields[5].
GetString();
574 std::string receiverStr = handler->
playerLink(receiver);
575 std::string senderStr = handler->
playerLink(sender);
583 result2 =
CharacterDatabase.PQuery(
"SELECT item_guid FROM mail_items WHERE mail_id = '{}'", messageId);
596 Field* fields3 = result3->Fetch();
600 result4 =
WorldDatabase.PQuery(
"SELECT name, quality FROM item_template WHERE entry = '{}'", item_entry);
601 Field* fields1 = result4->Fetch();
602 std::string item_name = fields1[0].
GetString();
603 int item_quality = fields1[1].
GetUInt8();
607 std::ostringstream itemStr;
608 itemStr <<
"|c" << std::hex << color <<
"|Hitem:" << item_entry <<
":0:0:0:0:0:0:0:0:0|h[" << item_name <<
"]|h|r";
614 while (result3->NextRow());
617 while (result2->NextRow());
622 while (queryResult->NextRow());
639 handler->
PSendSysMessage(
"Listing all spawn points in map %u (%s)%s:", mapId, map->
GetMapName(), showAll ?
"" :
" within 5000yd");
640 for (
auto const& pair :
sObjectMgr->GetAllCreatureData())
643 if (data.
mapId != mapId)
651 for (
auto const& pair :
sObjectMgr->GetAllGameObjectData())
654 if (data.
mapId != mapId)
668 return zoneEntry ? zoneEntry->
AreaName[locale] :
"<unknown zone>";
680 char const* zoneName =
GetZoneName(zoneId, locale);
689 std::vector<RespawnInfo const*> respawns;
700 respawnZoneId = map->
GetZoneId(edata->phaseMask, edata->spawnPoint);
703 if (!player->
IsInDist(edata->spawnPoint, *range))
708 if (zoneId != respawnZoneId)
715 handler->
PSendSysMessage(
"%u | %u | [%02u,%02u] | %s (%u) | %s%s", ri->spawnId, ri->entry, gridX, gridY,
GetZoneName(respawnZoneId, locale), respawnZoneId, respawnTime.c_str(), map->
IsSpawnGroupActive(data->
spawnGroupData->
groupId) ?
"" :
" (inactive)");
@ CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY
@ CHAR_SEL_MAIL_LIST_COUNT
@ CHAR_SEL_MAIL_LIST_ITEMS
@ CHAR_SEL_MAIL_LIST_INFO
@ CHAR_SEL_MAIL_COUNT_ITEM
@ CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM
@ CHAR_SEL_GUILD_BANK_COUNT_ITEM
@ CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY
@ CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY
@ CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM
@ CHAR_SEL_MAIL_ITEMS_BY_ENTRY
uint32 GetTalentSpellCost(uint32 spellId)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
std::shared_ptr< ResultSet > QueryResult
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
#define MAX_NUMBER_OF_GRIDS
@ LANG_COMMAND_TARGET_LISTAURAS
@ LANG_LIST_RESPAWNS_RANGE
@ LANG_LIST_MAIL_INFO_ITEM
@ LANG_CREATURE_LIST_CONSOLE
@ LANG_COMMAND_NOITEMFOUND
@ LANG_LIST_RESPAWNS_ZONE
@ LANG_LIST_RESPAWNS_OVERDUE
@ LANG_LIST_MAIL_NOT_FOUND
@ LANG_COMMAND_LISTOBJMESSAGE
@ LANG_COMMAND_TARGET_AURADETAIL
@ LANG_SELECT_CHAR_OR_CREATURE
@ LANG_COMMAND_INVALIDCREATUREID
@ LANG_COMMAND_LISTCREATUREMESSAGE
@ LANG_CREATURE_LIST_CHAT
@ LANG_COMMAND_TARGET_AURASIMPLE
@ LANG_LIST_RESPAWNS_LISTHEADER
@ LANG_COMMAND_LISTITEMMESSAGE
@ LANG_COMMAND_TARGET_LISTAURATYPE
@ LANG_COMMAND_LISTOBJINVALIDID
std::optional< T > Optional
Optional helper class to wrap optional values within.
Role Based Access Control related classes definition.
uint32 constexpr ItemQualityColors[MAX_ITEM_QUALITY]
void wstrToLower(std::wstring &str)
std::string TimeToTimestampStr(time_t t)
bool Utf8FitTo(std::string_view str, std::wstring_view search)
std::string secsToTimeString(uint64 timeInSecs, TimeFormat timeFormat, bool hoursOnly)
int32 GetMaxDuration() const
ObjectGuid GetCasterGUID() const
int32 GetDuration() const
uint8 GetStackAmount() const
SpellInfo const * GetSpellInfo() const
std::string playerLink(std::string const &name) const
WorldSession * GetSession()
virtual LocaleConstant GetSessionDbcLocale() const
void SetSentErrorMessage(bool val)
void PSendSysMessage(char const *fmt, Args &&... args)
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
virtual char const * GetTrinityString(uint32 entry) const
static char const * ToTitle(Enum value)
Class used to access individual fields of database query result.
std::string GetString() const
bool IsBattlegroundOrArena() const
uint32 GetZoneId(uint32 phaseMask, float x, float y, float z) const
bool IsSpawnGroupActive(uint32 groupId) const
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
char const * GetMapName() const
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
RespawnInfo * GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const
std::string ToString() const
static bool IsEquipmentPos(uint16 pos)
static bool IsInventoryPos(uint16 pos)
static bool IsBankPos(uint16 pos)
void setUInt32(uint8 index, uint32 value)
std::array< char const *, 16 > SpellName
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
std::multimap< uint32, AuraApplication * > AuraApplicationMap
AuraApplicationMap & GetAppliedAuras()
std::list< AuraEffect * > AuraEffectList
LocaleConstant GetSessionDbcLocale() const
Player * GetPlayer() const
static bool HandleListMailCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
static bool HandleListAurasByIdCommand(ChatHandler *handler, uint32 spellId)
static bool HandleListCreatureCommand(ChatHandler *handler, Variant< Hyperlink< creature_entry >, uint32 > creatureId, Optional< uint32 > countArg)
static char const * GetZoneName(uint32 zoneId, LocaleConstant locale)
static bool HandleListItemCommand(ChatHandler *handler, Hyperlink< item > item, Optional< uint32 > countArg)
static bool HandleListRespawnsCommand(ChatHandler *handler, Optional< uint32 > range)
static bool HandleListAurasByNameCommand(ChatHandler *handler, WTail namePart)
static bool HandleListAllAurasCommand(ChatHandler *handler)
ChatCommandTable GetCommands() const override
static bool ListAurasCommand(ChatHandler *handler, Optional< uint32 > spellId, std::wstring namePart)
static bool HandleListSpawnPointsCommand(ChatHandler *handler)
static bool HandleListObjectCommand(ChatHandler *handler, Variant< Hyperlink< gameobject_entry >, uint32 > gameObjectId, Optional< uint32 > countArg)
static bool ShouldListAura(SpellInfo const *spellInfo, Optional< uint32 > spellId, std::wstring namePart, uint8 locale)
void AddSC_list_commandscript()
std::vector< ChatCommandBuilder > ChatCommandTable
@ RBAC_PERM_COMMAND_LIST_SPAWNPOINTS
@ RBAC_PERM_COMMAND_LIST_MAIL
@ RBAC_PERM_COMMAND_LIST_ITEM
@ RBAC_PERM_COMMAND_LIST_CREATURE
@ RBAC_PERM_COMMAND_LIST_OBJECT
@ RBAC_PERM_COMMAND_LIST_AURAS
@ RBAC_PERM_COMMAND_LIST_RESPAWNS
char const * AreaName[16]
float GetPositionZ() const
bool IsInDist2d(float x, float y, float dist) const
bool IsInDist(float x, float y, float z, float dist) const
float GetPositionX() const
float GetPositionY() const
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)