65 {
"auras", listAurasCommandTable },
73 {
"list", listCommandTable },
88 uint32 count = countArg.value_or(10);
96 result =
WorldDatabase.PQuery(
"SELECT COUNT(guid) FROM creature WHERE id='{}'", creatureId);
98 creatureCount = (*result)[0].GetUInt64();
103 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 {}",
107 result =
WorldDatabase.PQuery(
"SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '{}' LIMIT {}",
114 Field* fields = result->Fetch();
120 bool liveFound =
false;
123 Map* thisMap =
nullptr;
131 for (
auto& [spawnId, creature] : creBounds)
133 x, y, z, mapId, creature->GetGUID().ToString().c_str(), creature->IsAlive() ?
"*" :
" ");
134 liveFound = creBounds.begin() != creBounds.end();
145 while (result->NextRow());
155 uint32 itemId = item->Item->GetId();
156 uint32 count = countArg.value_or(10);
164 uint32 inventoryCount = 0;
171 inventoryCount = (*result)[0].GetUInt64();
182 Field* fields = result->Fetch();
183 ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt64());
186 ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt64());
188 std::string ownerName = fields[5].
GetString();
190 char const* itemPos =
nullptr;
192 itemPos =
"[equipped]";
194 itemPos =
"[in inventory]";
196 itemPos =
"[in reagent bank]";
198 itemPos =
"[in bank]";
204 while (result->NextRow());
208 if (count > resultCount)
209 count -= resultCount;
222 mailCount = (*result)[0].GetUInt64();
238 Field* fields = result->Fetch();
243 std::string itemSenderName = fields[4].
GetString();
245 std::string itemReceiverName = fields[6].
GetString();
247 char const* itemPos =
"[in mail]";
249 handler->
PSendSysMessage(
LANG_ITEMLIST_MAIL, std::to_string(itemGuid).c_str(), itemSenderName.c_str(), std::to_string(itemSender).c_str(), itemSenderAccountId, itemReceiverName.c_str(), std::to_string(itemReceiver).c_str(), itemReceiverAccount, itemPos);
251 while (result->NextRow());
255 if (count > resultCount)
256 count -= resultCount;
269 auctionCount = (*result)[0].GetUInt64();
285 Field* fields = result->Fetch();
286 ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt64());
287 ObjectGuid owner = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt64());
289 std::string ownerName = fields[3].
GetString();
291 char const* itemPos =
"[in auction]";
295 while (result->NextRow());
306 guildCount = (*result)[0].GetUInt64();
317 Field* fields = result->Fetch();
318 ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt64());
319 ObjectGuid guildGuid = ObjectGuid::Create<HighGuid::Guild>(fields[1].GetUInt64());
320 std::string guildName = fields[2].
GetString();
322 char const* itemPos =
"[in guild bank]";
326 while (result->NextRow());
330 if (count > resultCount)
331 count -= resultCount;
336 if (inventoryCount + mailCount + auctionCount + guildCount == 0)
358 uint32 count = countArg.value_or(10);
366 result =
WorldDatabase.PQuery(
"SELECT COUNT(guid) FROM gameobject WHERE id='{}'", gameObjectId);
368 objectCount = (*result)[0].GetUInt64();
373 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 {}",
377 result =
WorldDatabase.PQuery(
"SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '{}' LIMIT {}",
378 gameObjectId, count);
384 Field* fields = result->Fetch();
391 bool liveFound =
false;
394 Map* thisMap =
nullptr;
402 for (
auto& [spawnId, go] : goBounds)
404 go->GetGUID().ToString().c_str(), go->isSpawned() ?
"*" :
" ");
405 liveFound = goBounds.begin() != goBounds.end();
411 handler->
PSendSysMessage(
LANG_GO_LIST_CHAT, std::to_string(guid).c_str(), entry, std::to_string(guid).c_str(), gInfo->
name.c_str(), x, y, z, mapId,
"",
"");
416 while (result->NextRow());
456 for (
auto const& [aurId, aurApp] : auras)
459 Aura const* aura = aurApp->GetBase();
466 std::ostringstream ss_name;
467 ss_name <<
"|cffffffff|Hspell:" << aura->
GetId() <<
"|h[" << name <<
"]|h|r";
479 if (auraList.empty())
482 bool sizeLogged =
false;
505 return spellInfo->
Id == spellId;
507 if (!namePart.empty())
509 std::string name = (*spellInfo->
SpellName)[locale];
520 player = PlayerIdentifier::FromTargetOrSelf(handler);
525 stmt->
setUInt64(0, player->GetGUID().GetCounter());
529 Field* fields = queryResult->Fetch();
532 std::string nameLink = handler->
playerLink(player->GetName());
537 stmt->
setUInt64(0, player->GetGUID().GetCounter());
544 Field* queryFields = queryResult->Fetch();
547 std::string sender = queryFields[2].
GetString();
549 std::string receiver = queryFields[4].
GetString();
550 std::string subject = queryFields[5].
GetString();
551 time_t deliverTime = queryFields[6].
GetInt64();
552 time_t expireTime = queryFields[7].
GetInt64();
558 std::string receiverStr = handler->
playerLink(receiver);
559 std::string senderStr = handler->
playerLink(sender);
567 result2 =
CharacterDatabase.PQuery(
"SELECT item_guid FROM mail_items WHERE mail_id = '{}'", messageId);
572 uint32 item_guid = (*result2)[0].GetUInt32();
580 Field* fields3 = result3->Fetch();
590 std::ostringstream itemStr;
591 itemStr <<
"|c" << std::hex << color <<
"|Hitem:" << item_entry <<
":0:0:0:0:0:0:0:" << handler->
GetSession()->
GetPlayer()->
GetLevel()
598 while (result3->NextRow());
601 while (result2->NextRow());
606 while (queryResult->NextRow());
623 handler->
PSendSysMessage(
"Listing all spawn points in map %u (%s)%s:", mapId, map->
GetMapName(), showAll ?
"" :
" within 5000yd");
624 for (
auto const& pair :
sObjectMgr->GetAllCreatureData())
627 if (data.
mapId != mapId)
635 for (
auto const& pair :
sObjectMgr->GetAllGameObjectData())
638 if (data.
mapId != mapId)
652 return zoneEntry ? zoneEntry->
AreaName[locale] :
"<unknown zone>";
664 char const* zoneName =
GetZoneName(zoneId, locale);
673 std::vector<RespawnInfo const*> respawns;
687 if (!player->
IsInDist(edata->spawnPoint, *range))
692 if (zoneId != respawnZoneId)
699 handler->
PSendSysMessage(
UI64FMTD " | %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)");
723 for (
auto const& instanceByPackage : instanceByPackageMap)
@ 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
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
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_DEBUG_SCENE_OBJECT_LIST
@ LANG_LIST_MAIL_INFO_ITEM
@ LANG_CREATURE_LIST_CONSOLE
@ LANG_COMMAND_NOITEMFOUND
@ LANG_LIST_RESPAWNS_ZONE
@ LANG_LIST_RESPAWNS_OVERDUE
@ LANG_DEBUG_SCENE_OBJECT_DETAIL
@ 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.
std::map< uint32, std::unique_ptr< SceneTemplate > > SceneTemplateByInstance
uint32 constexpr ItemQualityColors[MAX_ITEM_QUALITY]
@ SPELL_ATTR0_CU_IS_TALENT
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
Player * getSelectedPlayer()
WorldSession * GetSession()
virtual LocaleConstant GetSessionDbcLocale() const
void PSendSysMessage(const char *fmt, Args &&... args)
void SetSentErrorMessage(bool val)
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
bool IsSpawnGroupActive(uint32 groupId) const
uint32 GetZoneId(PhaseShift const &phaseShift, float x, float y, float z)
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
char const * GetMapName() const
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
RespawnInfo * GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const
std::string ToString() const
static PhaseShift const & GetEmptyPhaseShift()
static bool IsEquipmentPos(uint16 pos)
static bool IsReagentBankPos(uint16 pos)
static bool IsInventoryPos(uint16 pos)
static bool IsBankPos(uint16 pos)
void setUInt32(const uint8 index, const uint32 value)
void setUInt64(const uint8 index, const uint64 value)
uint32 GetActiveSceneCount(uint32 sceneScriptPackageId=0) const
SceneTemplateByInstance const & GetSceneTemplateByInstanceMap() const
bool HasAttribute(SpellAttr0 attribute) const
LocalizedString const * SpellName
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
std::multimap< uint32, AuraApplication * > AuraApplicationMap
std::forward_list< AuraEffect * > AuraEffectList
AuraApplicationMap & GetAppliedAuras()
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 bool ShouldListAura(SpellInfo const *spellInfo, Optional< uint32 > spellId, std::wstring namePart, LocaleConstant locale)
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 HandleListScenesCommand(ChatHandler *handler)
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)
void AddSC_list_commandscript()
std::vector< ChatCommandBuilder > ChatCommandTable
auto MapEqualRange(M &map, typename M::key_type const &key)
@ 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_SCENES
@ RBAC_PERM_COMMAND_LIST_RESPAWNS
uint32 GetQuality() const
char const * GetName(LocaleConstant locale) const
std::array< char const *, TOTAL_LOCALES > Str
constexpr float GetPositionX() const
constexpr float GetPositionY() const
constexpr bool IsInDist2d(float x, float y, float dist) const
constexpr bool IsInDist(float x, float y, float z, float dist) const
constexpr float GetPositionZ() const