50 std::span<ChatCommandBuilder const>
GetCommands()
const override
64 {
"auras", listAurasCommandTable },
72 {
"list", listCommandTable },
87 uint32 count = countArg.value_or(10);
95 result =
WorldDatabase.PQuery(
"SELECT COUNT(guid) FROM creature WHERE id='{}'", *creatureId);
97 creatureCount = (*result)[0].GetUInt64();
102 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 {}",
106 result =
WorldDatabase.PQuery(
"SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '{}' LIMIT {}",
113 Field* fields = result->Fetch();
119 bool liveFound =
false;
122 Map* thisMap =
nullptr;
130 for (
auto& [spawnId, creature] : creBounds)
132 x, y, z, mapId, creature->GetGUID().ToString().c_str(), creature->IsAlive() ?
"*" :
" ");
133 liveFound = creBounds.begin() != creBounds.end();
144 while (result->NextRow());
154 uint32 itemId = item->Item->GetId();
155 uint32 count = countArg.value_or(10);
163 uint32 inventoryCount = 0;
170 inventoryCount = (*result)[0].GetUInt64();
181 Field* fields = result->Fetch();
182 ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt64());
185 ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt64());
187 std::string ownerName = fields[5].
GetString();
189 char const* itemPos =
nullptr;
191 itemPos =
"[equipped]";
193 itemPos =
"[in inventory]";
195 itemPos =
"[in bank]";
201 while (result->NextRow());
205 if (count > resultCount)
206 count -= resultCount;
219 mailCount = (*result)[0].GetUInt64();
235 Field* fields = result->Fetch();
240 std::string itemSenderName = fields[4].
GetString();
242 std::string itemReceiverName = fields[6].
GetString();
244 char const* itemPos =
"[in mail]";
246 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);
248 while (result->NextRow());
252 if (count > resultCount)
253 count -= resultCount;
266 auctionCount = (*result)[0].GetUInt64();
282 Field* fields = result->Fetch();
283 ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt64());
284 ObjectGuid owner = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt64());
286 std::string ownerName = fields[3].
GetString();
288 char const* itemPos =
"[in auction]";
292 while (result->NextRow());
303 guildCount = (*result)[0].GetUInt64();
314 Field* fields = result->Fetch();
315 ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt64());
316 ObjectGuid guildGuid = ObjectGuid::Create<HighGuid::Guild>(fields[1].GetUInt64());
317 std::string guildName = fields[2].
GetString();
319 char const* itemPos =
"[in guild bank]";
323 while (result->NextRow());
327 if (count > resultCount)
328 count -= resultCount;
333 if (inventoryCount + mailCount + auctionCount + guildCount == 0)
355 uint32 count = countArg.value_or(10);
363 result =
WorldDatabase.PQuery(
"SELECT COUNT(guid) FROM gameobject WHERE id='{}'", *gameObjectId);
365 objectCount = (*result)[0].GetUInt64();
370 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 {}",
374 result =
WorldDatabase.PQuery(
"SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '{}' LIMIT {}",
375 *gameObjectId, count);
381 Field* fields = result->Fetch();
388 bool liveFound =
false;
391 Map* thisMap =
nullptr;
399 for (
auto& [spawnId, go] : goBounds)
401 go->GetGUID().ToString().c_str(), go->isSpawned() ?
"*" :
" ");
402 liveFound = goBounds.begin() != goBounds.end();
408 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,
"",
"");
413 while (result->NextRow());
453 for (
auto const& [aurId, aurApp] : auras)
456 Aura const* aura = aurApp->GetBase();
475 if (auraList.empty())
478 bool sizeLogged =
false;
501 return spellInfo->
Id == spellId;
503 if (!namePart.empty())
505 std::string name = (*spellInfo->
SpellName)[locale];
521 stmt->
setUInt64(0, player->GetGUID().GetCounter());
525 Field* fields = queryResult->Fetch();
528 std::string nameLink = handler->
playerLink(player->GetName());
533 stmt->
setUInt64(0, player->GetGUID().GetCounter());
540 Field* queryFields = queryResult->Fetch();
543 std::string sender = queryFields[2].
GetString();
545 std::string receiver = queryFields[4].
GetString();
546 std::string subject = queryFields[5].
GetString();
547 time_t deliverTime = queryFields[6].
GetInt64();
548 time_t expireTime = queryFields[7].
GetInt64();
554 std::string receiverStr = handler->
playerLink(receiver);
555 std::string senderStr = handler->
playerLink(sender);
563 result2 =
CharacterDatabase.PQuery(
"SELECT item_guid FROM mail_items WHERE mail_id = '{}'", messageId);
568 uint32 item_guid = (*result2)[0].GetUInt32();
576 Field* fields3 = result3->Fetch();
593 while (result3->NextRow());
596 while (result2->NextRow());
601 while (queryResult->NextRow());
618 handler->
PSendSysMessage(
"Listing all spawn points in map %u (%s)%s:", mapId, map->
GetMapName(), showAll ?
"" :
" within 5000yd");
619 for (
auto const& pair :
sObjectMgr->GetAllCreatureData())
622 if (data.
mapId != mapId)
630 for (
auto const& pair :
sObjectMgr->GetAllGameObjectData())
633 if (data.
mapId != mapId)
647 return zoneEntry ? zoneEntry->
AreaName[locale] :
"<unknown zone>";
659 char const* zoneName =
GetZoneName(zoneId, locale);
668 std::vector<RespawnInfo const*> respawns;
682 if (!player->
IsInDist(edata->spawnPoint, *range))
687 if (zoneId != respawnZoneId)
694 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)");
718 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 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.
float GetFloat() const noexcept
uint64 GetUInt64() const noexcept
uint32 GetUInt32() const noexcept
uint16 GetUInt16() const noexcept
uint8 GetUInt8() const noexcept
std::string GetString() const noexcept
int64 GetInt64() const noexcept
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 IsInventoryPos(uint16 pos)
static bool IsBankPos(uint16 pos)
void setUInt32(uint8 index, uint32 value)
void setUInt64(uint8 index, 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 HandleListRespawnsCommand(ChatHandler *handler, Optional< uint32 > range)
static bool HandleListAurasByNameCommand(ChatHandler *handler, WTail namePart)
static bool HandleListAllAurasCommand(ChatHandler *handler)
static bool HandleListScenesCommand(ChatHandler *handler)
static bool ListAurasCommand(ChatHandler *handler, Optional< uint32 > spellId, std::wstring namePart)
static bool HandleListSpawnPointsCommand(ChatHandler *handler)
std::span< ChatCommandBuilder const > GetCommands() const override
static bool HandleListObjectCommand(ChatHandler *handler, Variant< Hyperlink< gameobject_entry >, uint32 > gameObjectId, Optional< uint32 > countArg)
static bool HandleListItemCommand(ChatHandler *handler, Hyperlink< item > const &item, Optional< uint32 > countArg)
void AddSC_list_commandscript()
ChatCommandBuilder const [] ChatCommandTable
auto MapEqualRange(M &map, typename M::key_type const &key)
std::string StringFormat(FormatString< Args... > fmt, Args &&... args) noexcept
Default TC string format function.
@ 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
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)