AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
debug_commandscript Class Reference
Inheritance diagram for debug_commandscript:
CommandScript ScriptObject

Classes

class  CreatureCountWorker
 

Public Member Functions

 debug_commandscript ()
 
ChatCommandTable GetCommands () const override
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Static Public Member Functions

static bool HandleDebugPlayCinematicCommand (ChatHandler *handler, uint32 cinematicId)
 
static bool HandleDebugPlayMovieCommand (ChatHandler *handler, uint32 movieId)
 
static bool HandleDebugPlaySoundCommand (ChatHandler *handler, uint32 soundId)
 
static bool HandleDebugPlayMusicCommand (ChatHandler *handler, uint32 musicId)
 
static bool HandleDebugVisualCommand (ChatHandler *handler, uint32 visualId)
 
static bool HandleDebugSendSpellFailCommand (ChatHandler *handler, SpellCastResult result, Optional< uint32 > failArg1, Optional< uint32 > failArg2)
 
static bool HandleDebugSendEquipErrorCommand (ChatHandler *handler, InventoryResult error)
 
static bool HandleDebugSendSellErrorCommand (ChatHandler *handler, SellResult error)
 
static bool HandleDebugSendBuyErrorCommand (ChatHandler *handler, BuyResult error)
 
static bool HandleDebugSendOpcodeCommand (ChatHandler *handler)
 
static bool HandleDebugUpdateWorldStateCommand (ChatHandler *handler, uint32 variable, uint32 value)
 
static bool HandleDebugAreaTriggersCommand (ChatHandler *handler)
 
static bool HandleDebugSendChannelNotifyCommand (ChatHandler *handler, ChatNotify type)
 
static bool HandleDebugSendChatMsgCommand (ChatHandler *handler, ChatMsg type)
 
static bool HandleDebugSendQuestPartyMsgCommand (ChatHandler *handler, QuestShareMessages msg)
 
static bool HandleDebugGetLootRecipientCommand (ChatHandler *handler)
 
static bool HandleDebugSendQuestInvalidMsgCommand (ChatHandler *handler, QuestFailedReason msg)
 
static bool HandleDebugGetItemStateCommand (ChatHandler *handler, std::string itemState)
 
static bool HandleDebugDungeonFinderCommand (ChatHandler *)
 
static bool HandleDebugBattlegroundCommand (ChatHandler *)
 
static bool HandleDebugCooldownCommand (ChatHandler *handler, uint32 spell_id, uint32 end_time, Optional< uint32 > item_id)
 
static bool HandleDebugArenaCommand (ChatHandler *)
 
static bool HandleDebugThreatListCommand (ChatHandler *handler)
 
static bool HandleDebugThreatInfoCommand (ChatHandler *handler)
 
static bool HandleDebugCombatListCommand (ChatHandler *handler)
 
static bool HandleDebugHostileRefListCommand (ChatHandler *handler)
 
static bool HandleDebugSetVehicleIdCommand (ChatHandler *handler, uint32 id)
 
static bool HandleDebugEnterVehicleCommand (ChatHandler *handler, uint32 entry, Optional< int8 > seatId)
 
static bool HandleDebugSpawnVehicleCommand (ChatHandler *handler, uint32 entry, Optional< uint32 > id)
 
static bool HandleDebugSendLargePacketCommand (ChatHandler *handler)
 
static bool HandleDebugSendSetPhaseShiftCommand (ChatHandler *handler, uint32 phaseShift)
 
static bool HandleDebugGetItemValueCommand (ChatHandler *handler, ObjectGuid::LowType guid, uint32 index)
 
static bool HandleDebugSetItemValueCommand (ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
 
static bool HandleDebugItemExpireCommand (ChatHandler *handler, ObjectGuid::LowType guid)
 
static bool HandleDebugAnimCommand (ChatHandler *handler, Emote emote)
 
static bool HandleDebugLoSCommand (ChatHandler *handler)
 
static bool HandleDebugSetAuraStateCommand (ChatHandler *handler, Optional< AuraStateType > state, bool apply)
 
static bool HandleDebugSetValueCommand (ChatHandler *handler, uint32 index, Variant< uint32, float > value)
 
static bool HandleDebugGetValueCommand (ChatHandler *handler, uint32 index, bool isInt)
 
static bool HandleDebugMod32ValueCommand (ChatHandler *handler, uint32 index, uint32 value)
 
static bool HandleDebugUpdateCommand (ChatHandler *handler, uint32 index, Optional< uint32 > value)
 
static bool HandleDebugSet32BitCommand (ChatHandler *handler, uint32 index, uint8 bit)
 
static bool HandleDebugMoveflagsCommand (ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
 
static bool HandleDebugUnitStateCommand (ChatHandler *handler, uint32 unitState)
 
static bool HandleWPGPSCommand (ChatHandler *handler, Optional< std::string > type)
 
static bool HandleDebugObjectCountCommand (ChatHandler *handler, Optional< uint32 > mapId)
 
static void HandleDebugObjectCountMap (ChatHandler *handler, Map *map)
 
static bool HandleDebugDummyCommand (ChatHandler *handler)
 
static bool HandleDebugMapDataCommand (ChatHandler *handler)
 
static bool HandleDebugBoundaryCommand (ChatHandler *handler, Optional< uint32 > durationArg, Optional< EXACT_SEQUENCE("fill")> fill, Optional< EXACT_SEQUENCE("z")> checkZ)
 
static bool HandleDebugVisibilityDataCommand (ChatHandler *handler)
 
static bool HandleDebugZoneStatsCommand (ChatHandler *handler, Optional< PlayerIdentifier > playerTarget)
 
static std::string GetLootSourceName (std::string const &type, uint32 lootId)
 
static char const * GetItemQualityName (uint32 quality)
 
static void GenerateLoot (Loot &loot, LootTemplate const *tab, LootStore const &store, Player *player, std::string const &type, uint32 lootId)
 
static bool HandleDebugLootCommand (ChatHandler *handler, std::string type, uint32 lootId, Optional< uint32 > count)
 
static bool HandleDebugFactionChangeCommand (ChatHandler *handler, Optional< PlayerIdentifier > playerTarget)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ debug_commandscript()

debug_commandscript::debug_commandscript ( )
inline
54: CommandScript("debug_commandscript") { }
Definition CommandScript.h:25

Member Function Documentation

◆ GenerateLoot()

static void debug_commandscript::GenerateLoot ( Loot loot,
LootTemplate const *  tab,
LootStore const &  store,
Player player,
std::string const &  type,
uint32  lootId 
)
inlinestatic
1680 {
1681 loot.clear();
1682 loot.items.reserve(MAX_NR_LOOT_ITEMS);
1683 loot.quest_items.reserve(MAX_NR_QUEST_ITEMS);
1684 tab->Process(loot, store, LOOT_MODE_DEFAULT, player);
1685
1686 if (type == "creature")
1687 {
1688 if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(lootId))
1689 loot.generateMoneyLoot(ct->mingold, ct->maxgold);
1690 }
1691 else if (type == "gameobject")
1692 {
1693 if (GameObjectTemplateAddon const* addon = sObjectMgr->GetGameObjectTemplateAddon(lootId))
1694 loot.generateMoneyLoot(addon->mingold, addon->maxgold);
1695 }
1696 else if (type == "item")
1697 {
1698 if (ItemTemplate const* it = sObjectMgr->GetItemTemplate(lootId))
1699 loot.generateMoneyLoot(it->MinMoneyLoot, it->MaxMoneyLoot);
1700 }
1701 }
#define MAX_NR_QUEST_ITEMS
Definition LootMgr.h:53
#define MAX_NR_LOOT_ITEMS
Definition LootMgr.h:51
#define sObjectMgr
Definition ObjectMgr.h:1712
@ LOOT_MODE_DEFAULT
Definition SharedDefines.h:43
Definition CreatureData.h:187
Definition GameObjectData.h:667
Definition ItemTemplate.h:619
void clear()
Definition LootMgr.h:343
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition LootMgr.cpp:790
std::vector< LootItem > items
Definition LootMgr.h:320
std::vector< LootItem > quest_items
Definition LootMgr.h:321

References Loot::clear(), Loot::generateMoneyLoot(), Loot::items, LOOT_MODE_DEFAULT, MAX_NR_LOOT_ITEMS, MAX_NR_QUEST_ITEMS, LootTemplate::Process(), Loot::quest_items, and sObjectMgr.

Referenced by HandleDebugLootCommand().

◆ GetCommands()

ChatCommandTable debug_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

57 {
58 static ChatCommandTable debugPlayCommandTable =
59 {
60 { "cinematic", HandleDebugPlayCinematicCommand, SEC_ADMINISTRATOR, Console::No },
61 { "movie", HandleDebugPlayMovieCommand, SEC_ADMINISTRATOR, Console::No },
62 { "sound", HandleDebugPlaySoundCommand, SEC_ADMINISTRATOR, Console::No },
63 { "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No },
64 { "visual", HandleDebugVisualCommand, SEC_ADMINISTRATOR, Console::No }
65 };
66 static ChatCommandTable debugSendCommandTable =
67 {
68 { "buyerror", HandleDebugSendBuyErrorCommand, SEC_ADMINISTRATOR, Console::No },
69 { "channelnotify", HandleDebugSendChannelNotifyCommand, SEC_ADMINISTRATOR, Console::No },
70 { "chatmessage", HandleDebugSendChatMsgCommand, SEC_ADMINISTRATOR, Console::No },
71 { "equiperror", HandleDebugSendEquipErrorCommand, SEC_ADMINISTRATOR, Console::No },
72 { "largepacket", HandleDebugSendLargePacketCommand, SEC_ADMINISTRATOR, Console::No },
73 { "opcode", HandleDebugSendOpcodeCommand, SEC_ADMINISTRATOR, Console::No },
74 { "qpartymsg", HandleDebugSendQuestPartyMsgCommand, SEC_ADMINISTRATOR, Console::No },
75 { "qinvalidmsg", HandleDebugSendQuestInvalidMsgCommand, SEC_ADMINISTRATOR, Console::No },
76 { "sellerror", HandleDebugSendSellErrorCommand, SEC_ADMINISTRATOR, Console::No },
77 { "setphaseshift", HandleDebugSendSetPhaseShiftCommand, SEC_ADMINISTRATOR, Console::No },
78 { "spellfail", HandleDebugSendSpellFailCommand, SEC_ADMINISTRATOR, Console::No }
79 };
80 static ChatCommandTable debugCommandTable =
81 {
82 { "setbit", HandleDebugSet32BitCommand, SEC_ADMINISTRATOR, Console::No },
83 { "threat", HandleDebugThreatListCommand, SEC_ADMINISTRATOR, Console::No },
84 { "threatinfo", HandleDebugThreatInfoCommand, SEC_ADMINISTRATOR, Console::No },
85 { "combat", HandleDebugCombatListCommand, SEC_ADMINISTRATOR, Console::No },
86 { "hostile", HandleDebugHostileRefListCommand, SEC_ADMINISTRATOR, Console::No },
87 { "anim", HandleDebugAnimCommand, SEC_ADMINISTRATOR, Console::No },
88 { "arena", HandleDebugArenaCommand, SEC_ADMINISTRATOR, Console::No },
90 { "cooldown", HandleDebugCooldownCommand, SEC_ADMINISTRATOR, Console::No },
91 { "getitemstate", HandleDebugGetItemStateCommand, SEC_ADMINISTRATOR, Console::No },
92 { "lootrecipient", HandleDebugGetLootRecipientCommand, SEC_ADMINISTRATOR, Console::No },
93 { "getvalue", HandleDebugGetValueCommand, SEC_ADMINISTRATOR, Console::No },
94 { "getitemvalue", HandleDebugGetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
95 { "Mod32Value", HandleDebugMod32ValueCommand, SEC_ADMINISTRATOR, Console::No },
96 { "play", debugPlayCommandTable },
97 { "send", debugSendCommandTable },
98 { "setaurastate", HandleDebugSetAuraStateCommand, SEC_ADMINISTRATOR, Console::No },
99 { "setitemvalue", HandleDebugSetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
100 { "setvalue", HandleDebugSetValueCommand, SEC_ADMINISTRATOR, Console::No },
101 { "spawnvehicle", HandleDebugSpawnVehicleCommand, SEC_ADMINISTRATOR, Console::No },
102 { "setvid", HandleDebugSetVehicleIdCommand, SEC_ADMINISTRATOR, Console::No },
103 { "entervehicle", HandleDebugEnterVehicleCommand, SEC_ADMINISTRATOR, Console::No },
105 { "update", HandleDebugUpdateCommand, SEC_ADMINISTRATOR, Console::No },
106 { "itemexpire", HandleDebugItemExpireCommand, SEC_ADMINISTRATOR, Console::No },
107 { "areatriggers", HandleDebugAreaTriggersCommand, SEC_ADMINISTRATOR, Console::No },
108 { "lfg", HandleDebugDungeonFinderCommand, SEC_ADMINISTRATOR, Console::Yes},
109 { "loot", HandleDebugLootCommand, SEC_GAMEMASTER, Console::Yes},
110 { "los", HandleDebugLoSCommand, SEC_ADMINISTRATOR, Console::No },
111 { "moveflags", HandleDebugMoveflagsCommand, SEC_ADMINISTRATOR, Console::No },
112 { "unitstate", HandleDebugUnitStateCommand, SEC_ADMINISTRATOR, Console::No },
113 { "objectcount", HandleDebugObjectCountCommand, SEC_ADMINISTRATOR, Console::Yes},
114 { "dummy", HandleDebugDummyCommand, SEC_ADMINISTRATOR, Console::No },
115 { "mapdata", HandleDebugMapDataCommand, SEC_ADMINISTRATOR, Console::No },
116 { "boundary", HandleDebugBoundaryCommand, SEC_ADMINISTRATOR, Console::No },
117 { "visibilitydata", HandleDebugVisibilityDataCommand, SEC_ADMINISTRATOR, Console::No },
118 { "factionchange", HandleDebugFactionChangeCommand, SEC_ADMINISTRATOR, Console::Yes},
119 { "zonestats", HandleDebugZoneStatsCommand, SEC_MODERATOR, Console::Yes}
120 };
121 static ChatCommandTable commandTable =
122 {
123 { "debug", debugCommandTable },
124 { "wpgps", HandleWPGPSCommand, SEC_ADMINISTRATOR, Console::No }
125 };
126 return commandTable;
127 }
@ SEC_ADMINISTRATOR
Definition Common.h:60
@ SEC_GAMEMASTER
Definition Common.h:59
@ SEC_MODERATOR
Definition Common.h:58
static bool HandleDebugSet32BitCommand(ChatHandler *handler, uint32 index, uint8 bit)
Definition cs_debug.cpp:1358
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, uint32 phaseShift)
Definition cs_debug.cpp:1147
static bool HandleDebugThreatListCommand(ChatHandler *handler)
Definition cs_debug.cpp:832
static bool HandleDebugGetItemStateCommand(ChatHandler *handler, std::string itemState)
Definition cs_debug.cpp:522
static bool HandleDebugGetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index)
Definition cs_debug.cpp:1153
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler)
Definition cs_debug.cpp:1136
static bool HandleDebugSetValueCommand(ChatHandler *handler, uint32 index, Variant< uint32, float > value)
Definition cs_debug.cpp:1245
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
Definition cs_debug.cpp:1377
static bool HandleWPGPSCommand(ChatHandler *handler, Optional< std::string > type)
Definition cs_debug.cpp:1445
static bool HandleDebugSendChatMsgCommand(ChatHandler *handler, ChatMsg type)
Definition cs_debug.cpp:490
static bool HandleDebugAreaTriggersCommand(ChatHandler *handler)
Definition cs_debug.cpp:462
static bool HandleDebugSendSellErrorCommand(ChatHandler *handler, SellResult error)
Definition cs_debug.cpp:261
static bool HandleDebugGetValueCommand(ChatHandler *handler, uint32 index, bool isInt)
Definition cs_debug.cpp:1274
static bool HandleDebugUpdateCommand(ChatHandler *handler, uint32 index, Optional< uint32 > value)
Definition cs_debug.cpp:1323
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, uint32 id)
Definition cs_debug.cpp:1064
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler)
Definition cs_debug.cpp:504
static bool HandleDebugLoSCommand(ChatHandler *handler)
Definition cs_debug.cpp:1209
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, uint32 movieId)
Definition cs_debug.cpp:157
static bool HandleDebugUnitStateCommand(ChatHandler *handler, uint32 unitState)
Definition cs_debug.cpp:1433
static bool HandleDebugVisibilityDataCommand(ChatHandler *handler)
Definition cs_debug.cpp:1584
static bool HandleDebugMapDataCommand(ChatHandler *handler)
Definition cs_debug.cpp:1549
static bool HandleDebugPlaySoundCommand(ChatHandler *handler, uint32 soundId)
Definition cs_debug.cpp:170
static bool HandleDebugDungeonFinderCommand(ChatHandler *)
Definition cs_debug.cpp:787
static bool HandleDebugSendOpcodeCommand(ChatHandler *handler)
Definition cs_debug.cpp:273
static bool HandleDebugDummyCommand(ChatHandler *handler)
Definition cs_debug.cpp:1543
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, InventoryResult error)
Definition cs_debug.cpp:255
static bool HandleDebugHostileRefListCommand(ChatHandler *handler)
Definition cs_debug.cpp:1013
static bool HandleDebugThreatInfoCommand(ChatHandler *handler)
Definition cs_debug.cpp:918
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, uint32 entry, Optional< uint32 > id)
Definition cs_debug.cpp:1103
static bool HandleDebugCooldownCommand(ChatHandler *handler, uint32 spell_id, uint32 end_time, Optional< uint32 > item_id)
Definition cs_debug.cpp:799
static bool HandleDebugPlayMusicCommand(ChatHandler *handler, uint32 musicId)
Definition cs_debug.cpp:197
static bool HandleDebugBattlegroundCommand(ChatHandler *)
Definition cs_debug.cpp:793
static bool HandleDebugSendBuyErrorCommand(ChatHandler *handler, BuyResult error)
Definition cs_debug.cpp:267
static bool HandleDebugBoundaryCommand(ChatHandler *handler, Optional< uint32 > durationArg, Optional< EXACT_SEQUENCE("fill")> fill, Optional< EXACT_SEQUENCE("z")> checkZ)
Definition cs_debug.cpp:1563
static bool HandleDebugLootCommand(ChatHandler *handler, std::string type, uint32 lootId, Optional< uint32 > count)
Definition cs_debug.cpp:1703
static bool HandleDebugObjectCountCommand(ChatHandler *handler, Optional< uint32 > mapId)
Definition cs_debug.cpp:1465
static bool HandleDebugSendChannelNotifyCommand(ChatHandler *handler, ChatNotify type)
Definition cs_debug.cpp:479
static bool HandleDebugCombatListCommand(ChatHandler *handler)
Definition cs_debug.cpp:993
static bool HandleDebugEnterVehicleCommand(ChatHandler *handler, uint32 entry, Optional< int8 > seatId)
Definition cs_debug.cpp:1075
static bool HandleDebugZoneStatsCommand(ChatHandler *handler, Optional< PlayerIdentifier > playerTarget)
Definition cs_debug.cpp:1614
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
Definition cs_debug.cpp:1170
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, uint32 index, uint32 value)
Definition cs_debug.cpp:1305
static bool HandleDebugItemExpireCommand(ChatHandler *handler, ObjectGuid::LowType guid)
Definition cs_debug.cpp:1185
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler *handler, QuestFailedReason msg)
Definition cs_debug.cpp:516
static bool HandleDebugFactionChangeCommand(ChatHandler *handler, Optional< PlayerIdentifier > playerTarget)
Definition cs_debug.cpp:1868
static bool HandleDebugPlayCinematicCommand(ChatHandler *handler, uint32 cinematicId)
Definition cs_debug.cpp:130
static bool HandleDebugVisualCommand(ChatHandler *handler, uint32 visualId)
Definition cs_debug.cpp:213
static bool HandleDebugUpdateWorldStateCommand(ChatHandler *handler, uint32 variable, uint32 value)
Definition cs_debug.cpp:456
static bool HandleDebugArenaCommand(ChatHandler *)
Definition cs_debug.cpp:826
static bool HandleDebugAnimCommand(ChatHandler *handler, Emote emote)
Definition cs_debug.cpp:1199
static bool HandleDebugSendSpellFailCommand(ChatHandler *handler, SpellCastResult result, Optional< uint32 > failArg1, Optional< uint32 > failArg2)
Definition cs_debug.cpp:234
static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler *handler, QuestShareMessages msg)
Definition cs_debug.cpp:498
static bool HandleDebugSetAuraStateCommand(ChatHandler *handler, Optional< AuraStateType > state, bool apply)
Definition cs_debug.cpp:1224
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:46

References HandleDebugAnimCommand(), HandleDebugAreaTriggersCommand(), HandleDebugArenaCommand(), HandleDebugBattlegroundCommand(), HandleDebugBoundaryCommand(), HandleDebugCombatListCommand(), HandleDebugCooldownCommand(), HandleDebugDummyCommand(), HandleDebugDungeonFinderCommand(), HandleDebugEnterVehicleCommand(), HandleDebugFactionChangeCommand(), HandleDebugGetItemStateCommand(), HandleDebugGetItemValueCommand(), HandleDebugGetLootRecipientCommand(), HandleDebugGetValueCommand(), HandleDebugHostileRefListCommand(), HandleDebugItemExpireCommand(), HandleDebugLootCommand(), HandleDebugLoSCommand(), HandleDebugMapDataCommand(), HandleDebugMod32ValueCommand(), HandleDebugMoveflagsCommand(), HandleDebugObjectCountCommand(), HandleDebugPlayCinematicCommand(), HandleDebugPlayMovieCommand(), HandleDebugPlayMusicCommand(), HandleDebugPlaySoundCommand(), HandleDebugSendBuyErrorCommand(), HandleDebugSendChannelNotifyCommand(), HandleDebugSendChatMsgCommand(), HandleDebugSendEquipErrorCommand(), HandleDebugSendLargePacketCommand(), HandleDebugSendOpcodeCommand(), HandleDebugSendQuestInvalidMsgCommand(), HandleDebugSendQuestPartyMsgCommand(), HandleDebugSendSellErrorCommand(), HandleDebugSendSetPhaseShiftCommand(), HandleDebugSendSpellFailCommand(), HandleDebugSet32BitCommand(), HandleDebugSetAuraStateCommand(), HandleDebugSetItemValueCommand(), HandleDebugSetValueCommand(), HandleDebugSetVehicleIdCommand(), HandleDebugSpawnVehicleCommand(), HandleDebugThreatInfoCommand(), HandleDebugThreatListCommand(), HandleDebugUnitStateCommand(), HandleDebugUpdateCommand(), HandleDebugUpdateWorldStateCommand(), HandleDebugVisibilityDataCommand(), HandleDebugVisualCommand(), HandleDebugZoneStatsCommand(), HandleWPGPSCommand(), SEC_ADMINISTRATOR, SEC_GAMEMASTER, and SEC_MODERATOR.

◆ GetItemQualityName()

static char const * debug_commandscript::GetItemQualityName ( uint32  quality)
inlinestatic
1666 {
1667 static char const* const qualityNames[MAX_ITEM_QUALITY] =
1668 {
1669 "Poor", "Normal", "Uncommon", "Rare",
1670 "Epic", "Legendary", "Artifact", "Heirloom"
1671 };
1672
1673 if (quality < MAX_ITEM_QUALITY)
1674 return qualityNames[quality];
1675 return "Unknown";
1676 }
#define MAX_ITEM_QUALITY
Definition SharedDefines.h:327

References MAX_ITEM_QUALITY.

Referenced by HandleDebugLootCommand().

◆ GetLootSourceName()

static std::string debug_commandscript::GetLootSourceName ( std::string const &  type,
uint32  lootId 
)
inlinestatic
1640 {
1641 if (type == "creature" || type == "skinning" || type == "pickpocketing")
1642 {
1643 if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(lootId))
1644 return ct->Name;
1645 }
1646 else if (type == "gameobject")
1647 {
1648 if (GameObjectTemplate const* gt = sObjectMgr->GetGameObjectTemplate(lootId))
1649 return gt->name;
1650 }
1651 else if (type == "item" || type == "disenchant" || type == "prospecting" || type == "milling")
1652 {
1653 if (ItemTemplate const* it = sObjectMgr->GetItemTemplate(lootId))
1654 return it->Name1;
1655 }
1656 else if (type == "fishing")
1657 {
1658 if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(lootId))
1659 return area->area_name[LOCALE_enUS];
1660 }
1661
1662 return "";
1663 }
@ LOCALE_enUS
Definition Common.h:118
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
Definition DBCStructure.h:519
Definition GameObjectData.h:32

References LOCALE_enUS, sAreaTableStore, and sObjectMgr.

Referenced by HandleDebugLootCommand().

◆ HandleDebugAnimCommand()

static bool debug_commandscript::HandleDebugAnimCommand ( ChatHandler handler,
Emote  emote 
)
inlinestatic
1200 {
1201 if (Unit* unit = handler->getSelectedUnit())
1202 unit->HandleEmoteCommand(emote);
1203
1204 handler->PSendSysMessage("Playing emote {}", EnumUtils::ToConstant(emote));
1205
1206 return true;
1207 }
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:211
Unit * getSelectedUnit() const
Definition Chat.cpp:386
static char const * ToConstant(Enum value)
Definition SmartEnum.h:123
Definition Unit.h:664

References ChatHandler::getSelectedUnit(), ChatHandler::PSendSysMessage(), and EnumUtils::ToConstant().

Referenced by GetCommands().

◆ HandleDebugAreaTriggersCommand()

static bool debug_commandscript::HandleDebugAreaTriggersCommand ( ChatHandler handler)
inlinestatic
463 {
464 Player* player = handler->GetSession()->GetPlayer();
465 if (!player->isDebugAreaTriggers)
466 {
468 player->isDebugAreaTriggers = true;
469 }
470 else
471 {
473 player->isDebugAreaTriggers = false;
474 }
475
476 return true;
477 }
@ LANG_DEBUG_AREATRIGGER_ON
Definition Language.h:991
@ LANG_DEBUG_AREATRIGGER_OFF
Definition Language.h:992
WorldSession * GetSession()
Definition Chat.h:242
Definition Player.h:1084
bool isDebugAreaTriggers
Definition Player.h:2596
Player * GetPlayer() const
Definition WorldSession.h:444

References WorldSession::GetPlayer(), ChatHandler::GetSession(), Player::isDebugAreaTriggers, LANG_DEBUG_AREATRIGGER_OFF, LANG_DEBUG_AREATRIGGER_ON, and ChatHandler::PSendSysMessage().

Referenced by GetCommands().

◆ HandleDebugArenaCommand()

static bool debug_commandscript::HandleDebugArenaCommand ( ChatHandler )
inlinestatic
827 {
828 sBattlegroundMgr->ToggleArenaTesting();
829 return true;
830 }
#define sBattlegroundMgr
Definition BattlegroundMgr.h:187

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugBattlegroundCommand()

static bool debug_commandscript::HandleDebugBattlegroundCommand ( ChatHandler )
inlinestatic
794 {
795 sBattlegroundMgr->ToggleTesting();
796 return true;
797 }

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugBoundaryCommand()

static bool debug_commandscript::HandleDebugBoundaryCommand ( ChatHandler handler,
Optional< uint32 durationArg,
Optional< EXACT_SEQUENCE("fill")>  fill,
Optional< EXACT_SEQUENCE("z")>  checkZ 
)
inlinestatic
1564 {
1565 Player* player = handler->GetPlayer();
1566 if (!player)
1567 return false;
1568
1569 Creature* target = handler->getSelectedCreature();
1570 if (!target || !target->IsAIEnabled)
1571 return false;
1572
1573 uint32 duration = durationArg.value_or(5 * IN_MILLISECONDS);
1574 if (duration > 180 * IN_MILLISECONDS) // arbitrary upper limit
1575 duration = 180 * IN_MILLISECONDS;
1576
1577 int32 errMsg = target->AI()->VisualizeBoundary(duration, player, fill.has_value(), checkZ.has_value());
1578 if (errMsg > 0)
1579 handler->PSendSysMessage(errMsg);
1580
1581 return true;
1582 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
Player * GetPlayer() const
Definition Chat.cpp:36
Creature * getSelectedCreature() const
Definition Chat.cpp:410
int32 VisualizeBoundary(uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
Definition CreatureAI.cpp:480
Definition Creature.h:47
CreatureAI * AI() const
Definition Creature.h:143
bool IsAIEnabled
Definition Unit.h:2097

References Creature::AI(), ChatHandler::GetPlayer(), ChatHandler::getSelectedCreature(), IN_MILLISECONDS, Unit::IsAIEnabled, ChatHandler::PSendSysMessage(), and CreatureAI::VisualizeBoundary().

Referenced by GetCommands().

◆ HandleDebugCombatListCommand()

static bool debug_commandscript::HandleDebugCombatListCommand ( ChatHandler handler)
inlinestatic
994 {
995 Unit* target = handler->getSelectedUnit();
996 if (!target)
997 target = handler->GetPlayer();
998
999 handler->PSendSysMessage("Combat refs: (Combat state: {} | Manager state: {})", target->IsInCombat(), target->GetCombatManager().HasCombat());
1000 for (auto const& ref : target->GetCombatManager().GetPvPCombatRefs())
1001 {
1002 Unit* unit = ref.second->GetOther(target);
1003 handler->PSendSysMessage("[PvP] {} (SpawnID {})", unit->GetName(), unit->IsCreature() ? unit->ToCreature()->GetSpawnId() : 0);
1004 }
1005 for (auto const& ref : target->GetCombatManager().GetPvECombatRefs())
1006 {
1007 Unit* unit = ref.second->GetOther(target);
1008 handler->PSendSysMessage("[PvE] {} (SpawnID {})", unit->GetName(), unit->IsCreature() ? unit->ToCreature()->GetSpawnId() : 0);
1009 }
1010 return true;
1011 }
bool HasCombat() const
Definition CombatManager.h:127
ObjectGuid::LowType GetSpawnId() const
Definition Creature.h:69
bool IsCreature() const
Definition Object.h:205
Creature * ToCreature()
Definition Object.h:206
CombatManager & GetCombatManager()
Definition Unit.h:953
bool IsInCombat() const
Definition Unit.h:935
std::string const & GetName() const
Definition Object.h:528

References Unit::GetCombatManager(), WorldObject::GetName(), ChatHandler::GetPlayer(), CombatManager::GetPvECombatRefs(), CombatManager::GetPvPCombatRefs(), ChatHandler::getSelectedUnit(), Creature::GetSpawnId(), CombatManager::HasCombat(), Object::IsCreature(), Unit::IsInCombat(), ChatHandler::PSendSysMessage(), and Object::ToCreature().

Referenced by GetCommands().

◆ HandleDebugCooldownCommand()

static bool debug_commandscript::HandleDebugCooldownCommand ( ChatHandler handler,
uint32  spell_id,
uint32  end_time,
Optional< uint32 item_id 
)
inlinestatic
800 {
801 Player* player = handler->GetPlayer();
802
803 if (!player || !spell_id || !end_time)
804 return false;
805
806 if (!sSpellMgr->GetSpellInfo(spell_id))
807 return false;
808
809 if (!item_id)
810 item_id = 0;
811 else if (!sItemStore.LookupEntry(*item_id))
812 return false;
813
814 if (end_time < player->GetSpellCooldownDelay(spell_id))
815 player->RemoveSpellCooldown(spell_id, true);
816
817 player->AddSpellCooldown(spell_id, *item_id, end_time, true, false);
818
819 WorldPacket data;
820 player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, end_time);
821 player->SendDirectMessage(&data);
822
823 return true;
824 }
DBCStorage< ItemEntry > sItemStore(Itemfmt)
#define sSpellMgr
Definition SpellMgr.h:836
@ SPELL_COOLDOWN_FLAG_NONE
Definition Unit.h:630
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5680
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11006
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3513
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition Unit.cpp:16992
Definition WorldPacket.h:26

References Player::AddSpellCooldown(), Unit::BuildCooldownPacket(), ChatHandler::GetPlayer(), Player::RemoveSpellCooldown(), Player::SendDirectMessage(), sItemStore, SPELL_COOLDOWN_FLAG_NONE, and sSpellMgr.

Referenced by GetCommands().

◆ HandleDebugDummyCommand()

static bool debug_commandscript::HandleDebugDummyCommand ( ChatHandler handler)
inlinestatic
1544 {
1545 handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing.");
1546 return true;
1547 }
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:160

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugDungeonFinderCommand()

static bool debug_commandscript::HandleDebugDungeonFinderCommand ( ChatHandler )
inlinestatic
788 {
789 sLFGMgr->ToggleTesting();
790 return true;
791 }
#define sLFGMgr
Definition LFGMgr.h:658

References sLFGMgr.

Referenced by GetCommands().

◆ HandleDebugEnterVehicleCommand()

static bool debug_commandscript::HandleDebugEnterVehicleCommand ( ChatHandler handler,
uint32  entry,
Optional< int8 seatId 
)
inlinestatic
1076 {
1077 Unit* target = handler->getSelectedUnit();
1078 if (!target || !target->IsVehicle())
1079 return false;
1080
1081 if (!seatId)
1082 seatId = -1;
1083
1084 if (!entry)
1085 handler->GetPlayer()->EnterVehicle(target, *seatId);
1086 else
1087 {
1088 Creature* passenger = nullptr;
1089 Acore::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
1090 Acore::CreatureSearcher<Acore::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
1091 Cell::VisitObjects(handler->GetPlayer(), searcher, 30.0f);
1092
1093 if (!passenger || passenger == target)
1094 return false;
1095
1096 passenger->EnterVehicle(target, *seatId);
1097 }
1098
1099 handler->PSendSysMessage("Unit {} entered vehicle {:d}", entry, *seatId);
1100 return true;
1101 }
Definition GridNotifiers.h:1473
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition Unit.cpp:15578
bool IsVehicle() const
Definition Unit.h:800
Definition GridNotifiers.h:433
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References Unit::EnterVehicle(), ChatHandler::GetPlayer(), ChatHandler::getSelectedUnit(), Unit::IsVehicle(), ChatHandler::PSendSysMessage(), and Cell::VisitObjects().

Referenced by GetCommands().

◆ HandleDebugFactionChangeCommand()

static bool debug_commandscript::HandleDebugFactionChangeCommand ( ChatHandler handler,
Optional< PlayerIdentifier playerTarget 
)
inlinestatic
1869 {
1870 if (!playerTarget)
1871 playerTarget = PlayerIdentifier::FromTarget(handler);
1872
1873 if (!playerTarget)
1874 {
1876 return false;
1877 }
1878
1879 ObjectGuid guid = playerTarget->GetGUID();
1880 std::string name = playerTarget->GetName();
1881
1882 CharacterCacheEntry const* playerData = sCharacterCache->GetCharacterCacheByGuid(guid);
1883 if (!playerData)
1884 {
1886 return false;
1887 }
1888
1889 // Query at_login flags and money from the database (synchronous)
1891 stmt->SetData(0, guid.GetCounter());
1892 PreparedQueryResult result = CharacterDatabase.Query(stmt);
1893
1894 if (!result)
1895 {
1897 return false;
1898 }
1899
1900 Field* fields = result->Fetch();
1901 uint32 atLoginFlags = fields[0].Get<uint16>();
1902 uint32 money = fields[2].Get<uint32>();
1903
1904 // Header
1906
1907 // AT_LOGIN flags
1908 bool hasFactionFlag = (atLoginFlags & AT_LOGIN_CHANGE_FACTION) != 0;
1909 bool hasRaceFlag = (atLoginFlags & AT_LOGIN_CHANGE_RACE) != 0;
1910
1911 if (hasFactionFlag)
1913 if (hasRaceFlag)
1915 if (!hasFactionFlag && !hasRaceFlag)
1917
1918 // Faction-change-only checks (guild, arena captain, mail, auctions)
1919 if (hasFactionFlag)
1920 {
1921 // Guild check
1922 if (playerData->GuildId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
1923 {
1924 std::string guildName = sGuildMgr->GetGuildNameById(playerData->GuildId);
1926 }
1927 else
1929
1930 // Arena team captain check
1931 if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
1933 else
1935
1936 // Mail check
1937 if (playerData->MailCount)
1939 else
1941
1942 // Auction check - mirrors CharacterHandler.cpp logic
1943 // AH faction IDs: 0 = neutral, 12 = alliance, 29 = horde
1944 bool hasAuctions = false;
1945 for (uint8 i = 0; i < 2; ++i)
1946 {
1947 AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(
1948 i == 0 ? 0 : (((1 << (playerData->Race - 1)) & sRaceMgr->GetAllianceRaceMask()) ? 12 : 29));
1949
1950 for (auto const& [auID, Aentry] : auctionHouse->GetAuctions())
1951 {
1952 if (Aentry && (Aentry->owner == guid || Aentry->bidder == guid))
1953 {
1954 hasAuctions = true;
1955 break;
1956 }
1957 }
1958
1959 if (hasAuctions)
1960 break;
1961 }
1962
1963 if (hasAuctions)
1965 else
1967 }
1968 else
1969 {
1971 }
1972
1973 // Gold limit check
1974 uint32 maxMoney = sWorld->getIntConfig(CONFIG_CHANGE_FACTION_MAX_MONEY);
1975 if (maxMoney && money > maxMoney)
1976 handler->PSendSysMessage(LANG_DEBUG_FACTIONCHANGE_GOLD_FAIL, money, maxMoney);
1977 else if (maxMoney)
1978 handler->PSendSysMessage(LANG_DEBUG_FACTIONCHANGE_GOLD_OK, money, maxMoney);
1979 else
1981
1982 return true;
1983 }
#define sArenaTeamMgr
Definition ArenaTeamMgr.h:69
#define sAuctionMgr
Definition AuctionHouseMgr.h:224
#define sCharacterCache
Definition CharacterCache.h:83
@ CHAR_SEL_CHAR_AT_LOGIN_TITLES_MONEY
Definition CharacterDatabase.h:348
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition DatabaseEnvFwd.h:45
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition DatabaseEnv.cpp:21
std::uint8_t uint8
Definition Define.h:109
std::uint16_t uint16
Definition Define.h:108
#define sGuildMgr
Definition GuildMgr.h:51
@ LANG_DEBUG_FACTIONCHANGE_AUCTION_FAIL
Definition Language.h:1443
@ LANG_DEBUG_FACTIONCHANGE_HEADER
Definition Language.h:1433
@ LANG_DEBUG_FACTIONCHANGE_NA
Definition Language.h:1448
@ LANG_DEBUG_FACTIONCHANGE_GOLD_FAIL
Definition Language.h:1445
@ LANG_DEBUG_FACTIONCHANGE_FLAG_RACE
Definition Language.h:1435
@ LANG_DEBUG_FACTIONCHANGE_MAIL_OK
Definition Language.h:1442
@ LANG_DEBUG_FACTIONCHANGE_ARENA_CAPTAIN_OK
Definition Language.h:1440
@ LANG_DEBUG_FACTIONCHANGE_ARENA_CAPTAIN_FAIL
Definition Language.h:1439
@ LANG_DEBUG_FACTIONCHANGE_GUILD_OK
Definition Language.h:1438
@ LANG_DEBUG_FACTIONCHANGE_FLAG_NONE
Definition Language.h:1436
@ LANG_DEBUG_FACTIONCHANGE_FLAG_FACTION
Definition Language.h:1434
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:545
@ LANG_DEBUG_FACTIONCHANGE_AUCTION_OK
Definition Language.h:1444
@ LANG_DEBUG_FACTIONCHANGE_MAIL_FAIL
Definition Language.h:1441
@ LANG_DEBUG_FACTIONCHANGE_GUILD_FAIL
Definition Language.h:1437
@ LANG_DEBUG_FACTIONCHANGE_GOLD_OK
Definition Language.h:1446
@ LANG_DEBUG_FACTIONCHANGE_GOLD_NOLIMIT
Definition Language.h:1447
@ AT_LOGIN_CHANGE_RACE
Definition Player.h:593
@ AT_LOGIN_CHANGE_FACTION
Definition Player.h:592
#define sRaceMgr
Definition RaceMgr.h:52
@ Race
Requires the player to be a specific race.
@ CONFIG_CHANGE_FACTION_MAX_MONEY
Definition WorldConfig.h:382
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD
Definition WorldConfig.h:35
Definition AuctionHouseMgr.h:127
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:216
Class used to access individual fields of database query result.
Definition Field.h:98
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:112
Definition ObjectGuid.h:118
LowType GetCounter() const
Definition ObjectGuid.h:145
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157
#define sWorld
Definition World.h:316
static Optional< PlayerIdentifier > FromTarget(ChatHandler *handler)
Definition ChatCommandTags.cpp:138
Definition CharacterCache.h:28
ObjectGuid::LowType GuildId
Definition CharacterCache.h:37
uint8 MailCount
Definition CharacterCache.h:36

References AT_LOGIN_CHANGE_FACTION, AT_LOGIN_CHANGE_RACE, CHAR_SEL_CHAR_AT_LOGIN_TITLES_MONEY, CharacterDatabase, CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD, CONFIG_CHANGE_FACTION_MAX_MONEY, Acore::ChatCommands::PlayerIdentifier::FromTarget(), Field::Get(), AuctionHouseObject::GetAuctions(), ObjectGuid::GetCounter(), CharacterCacheEntry::GuildId, LANG_DEBUG_FACTIONCHANGE_ARENA_CAPTAIN_FAIL, LANG_DEBUG_FACTIONCHANGE_ARENA_CAPTAIN_OK, LANG_DEBUG_FACTIONCHANGE_AUCTION_FAIL, LANG_DEBUG_FACTIONCHANGE_AUCTION_OK, LANG_DEBUG_FACTIONCHANGE_FLAG_FACTION, LANG_DEBUG_FACTIONCHANGE_FLAG_NONE, LANG_DEBUG_FACTIONCHANGE_FLAG_RACE, LANG_DEBUG_FACTIONCHANGE_GOLD_FAIL, LANG_DEBUG_FACTIONCHANGE_GOLD_NOLIMIT, LANG_DEBUG_FACTIONCHANGE_GOLD_OK, LANG_DEBUG_FACTIONCHANGE_GUILD_FAIL, LANG_DEBUG_FACTIONCHANGE_GUILD_OK, LANG_DEBUG_FACTIONCHANGE_HEADER, LANG_DEBUG_FACTIONCHANGE_MAIL_FAIL, LANG_DEBUG_FACTIONCHANGE_MAIL_OK, LANG_DEBUG_FACTIONCHANGE_NA, LANG_PLAYER_NOT_FOUND, CharacterCacheEntry::MailCount, ChatHandler::PSendSysMessage(), CharacterCacheEntry::Race, sArenaTeamMgr, sAuctionMgr, sCharacterCache, ChatHandler::SendErrorMessage(), PreparedStatementBase::SetData(), sGuildMgr, sRaceMgr, and sWorld.

Referenced by GetCommands().

◆ HandleDebugGetItemStateCommand()

static bool debug_commandscript::HandleDebugGetItemStateCommand ( ChatHandler handler,
std::string  itemState 
)
inlinestatic
523 {
525 bool listQueue = false;
526 bool checkAll = false;
527
528 if (itemState == "unchanged")
529 state = ITEM_UNCHANGED;
530 else if (itemState == "changed")
531 state = ITEM_CHANGED;
532 else if (itemState == "new")
533 state = ITEM_NEW;
534 else if (itemState == "removed")
535 state = ITEM_REMOVED;
536 else if (itemState == "queue")
537 listQueue = true;
538 else if (itemState == "check_all")
539 checkAll = true;
540 else
541 return false;
542
543 Player* player = handler->getSelectedPlayer();
544 if (!player)
545 player = handler->GetPlayer();
546
547 if (!listQueue && !checkAll)
548 {
549 itemState = "The player has the following " + itemState + " items: ";
550 handler->SendSysMessage(itemState.c_str());
551 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
552 {
553 if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
554 continue;
555
556 if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
557 {
558 if (Bag* bag = item->ToBag())
559 {
560 for (uint8 j = 0; j < bag->GetBagSize(); ++j)
561 if (Item* item2 = bag->GetItemByPos(j))
562 if (item2->GetState() == state)
563 handler->PSendSysMessage("bag: 255 slot: {} {} owner: {}", item2->GetSlot(), item2->GetGUID().ToString(), item2->GetOwnerGUID().ToString());
564 }
565 else if (item->GetState() == state)
566 handler->PSendSysMessage("bag: 255 slot: {} {} owner: {}", item->GetSlot(), item->GetGUID().ToString(), item->GetOwnerGUID().ToString());
567 }
568 }
569 }
570
571 if (listQueue)
572 {
573 auto const& updateQueue = player->GetItemUpdateQueue();
574
575 for (auto const& item : updateQueue)
576 {
577 Bag* container = item->GetContainer();
578 uint8 bagSlot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
579
580 std::string st;
581 switch (item->GetState())
582 {
583 case ITEM_UNCHANGED:
584 st = "unchanged";
585 break;
586 case ITEM_CHANGED:
587 st = "changed";
588 break;
589 case ITEM_NEW:
590 st = "new";
591 break;
592 case ITEM_REMOVED:
593 st = "removed";
594 break;
595 }
596
597 handler->PSendSysMessage("bag: {} slot: {} guid: {} - state: {}", bagSlot, item->GetSlot(), item->GetGUID().ToString(), st);
598 }
599
600 if (updateQueue.empty())
601 handler->PSendSysMessage("The player's updatequeue is empty");
602 }
603
604 if (checkAll)
605 {
606 bool error = false;
607 auto const& updateQueue = player->GetItemUpdateQueue();
608 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
609 {
610 if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
611 continue;
612
613 Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
614 if (!item)
615 continue;
616
617 if (item->GetSlot() != i)
618 {
619 handler->PSendSysMessage("Item with slot {} and guid {} has an incorrect slot value: {}", i, item->GetGUID().ToString(), item->GetSlot());
620 error = true;
621 continue;
622 }
623
624 if (item->GetOwnerGUID() != player->GetGUID())
625 {
626 handler->PSendSysMessage("The item with slot {} {} does have non-matching owner guid {} and {}!", item->GetSlot(), item->GetGUID().ToString(), item->GetOwnerGUID().ToString(), player->GetGUID().ToString());
627 error = true;
628 continue;
629 }
630
631 if (Bag* container = item->GetContainer())
632 {
633 handler->PSendSysMessage("The item with slot {} {} has a container (slot: {}, {}) but shouldn't!", item->GetSlot(), item->GetGUID().ToString(), container->GetSlot(), container->GetGUID().ToString());
634 error = true;
635 continue;
636 }
637
638 if (item->IsInUpdateQueue())
639 {
640 uint16 qp = item->GetQueuePos();
641 if (qp > updateQueue.size())
642 {
643 handler->PSendSysMessage("The item with slot {} and guid {} has its queuepos ({}) larger than the update queue size! ", item->GetSlot(), item->GetGUID().ToString(), qp);
644 error = true;
645 continue;
646 }
647
648 if (!updateQueue[qp])
649 {
650 handler->PSendSysMessage("The item with slot {} and guid {} has its queuepos ({}) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().ToString(), qp);
651 error = true;
652 continue;
653 }
654
655 if (updateQueue[qp] != item)
656 {
657 handler->PSendSysMessage("The item with slot {} and guid {} has a queuepos ({}) that points to another item in the queue (bag: {}, slot: {}, guid: {})", item->GetSlot(), item->GetGUID().ToString(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().ToString());
658 error = true;
659 continue;
660 }
661 }
662 else if (item->GetState() != ITEM_UNCHANGED)
663 {
664 handler->PSendSysMessage("The item with slot {} and guid {} is not in queue but should be (state: {})!", item->GetSlot(), item->GetGUID().ToString(), item->GetState());
665 error = true;
666 continue;
667 }
668
669 if (Bag* bag = item->ToBag())
670 {
671 for (uint8 j = 0; j < bag->GetBagSize(); ++j)
672 {
673 Item* item2 = bag->GetItemByPos(j);
674 if (!item2)
675 continue;
676
677 if (item2->GetSlot() != j)
678 {
679 handler->PSendSysMessage("The item in bag {} and slot {} (guid: {}) has an incorrect slot value: {}", bag->GetSlot(), j, item2->GetGUID().ToString(), item2->GetSlot());
680 error = true;
681 continue;
682 }
683
684 if (item2->GetOwnerGUID() != player->GetGUID())
685 {
686 handler->PSendSysMessage("The item in bag {} at slot {} and {}, the owner ({}) and the player ({}) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString(), item2->GetOwnerGUID().ToString(), player->GetGUID().ToString());
687 error = true;
688 continue;
689 }
690
691 Bag* container = item2->GetContainer();
692 if (!container)
693 {
694 handler->PSendSysMessage("The item in bag {} at slot {} {} has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString());
695 error = true;
696 continue;
697 }
698
699 if (container != bag)
700 {
701 handler->PSendSysMessage("The item in bag {} at slot {} {} has a different container(slot {} {})!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString(), container->GetSlot(), container->GetGUID().ToString());
702 error = true;
703 continue;
704 }
705
706 if (item2->IsInUpdateQueue())
707 {
708 uint16 qp = item2->GetQueuePos();
709 if (qp > updateQueue.size())
710 {
711 handler->PSendSysMessage("The item in bag {} at slot {} having guid {} has a queuepos ({}) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString(), qp);
712 error = true;
713 continue;
714 }
715
716 if (!updateQueue[qp])
717 {
718 handler->PSendSysMessage("The item in bag {} at slot {} having guid {} has a queuepos ({}) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString(), qp);
719 error = true;
720 continue;
721 }
722
723 if (updateQueue[qp] != item2)
724 {
725 handler->PSendSysMessage("The item in bag {} at slot {} having guid {} has a queuepos ({}) that points to another item in the queue (bag: {}, slot: {}, guid: {})", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().ToString());
726 error = true;
727 continue;
728 }
729 }
730 else if (item2->GetState() != ITEM_UNCHANGED)
731 {
732 handler->PSendSysMessage("The item in bag {} at slot {} having guid {} is not in queue but should be (state: {})!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString(), item2->GetState());
733 error = true;
734 continue;
735 }
736 }
737 }
738 }
739
740 uint32 index = 0;
741
742 for (auto const& item : updateQueue)
743 {
744 index++;
745
746 if (item->GetOwnerGUID() != player->GetGUID())
747 {
748 handler->SendSysMessage(Acore::StringFormat("queue({}): For the item {}, the owner ({}) and the player ({}) don't match!", index, item->GetGUID().ToString(), item->GetOwnerGUID().ToString(), player->GetGUID().ToString()));
749 error = true;
750 continue;
751 }
752
753 if (item->GetQueuePos() != index)
754 {
755 handler->SendSysMessage(Acore::StringFormat("queue({}): For the item {}, the queuepos doesn't match it's position in the queue!", index, item->GetGUID().ToString()));
756 error = true;
757 continue;
758 }
759
760 if (item->GetState() == ITEM_REMOVED)
761 continue;
762
763 Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
764
765 if (!test)
766 {
767 handler->SendSysMessage(Acore::StringFormat("queue({}): The bag({}) and slot({}) values for {} are incorrect, the player doesn't have any item at that position!", index, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString()));
768 error = true;
769 continue;
770 }
771
772 if (test != item)
773 {
774 handler->SendSysMessage(Acore::StringFormat("queue({}): The bag({}) and slot({}) values for the {} are incorrect, {} is there instead!", index, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString(), test->GetGUID().ToString()));
775 error = true;
776 continue;
777 }
778 }
779
780 if (!error)
781 handler->SendSysMessage("All OK!");
782 }
783
784 return true;
785 }
ItemUpdateState
Definition Item.h:208
@ ITEM_CHANGED
Definition Item.h:210
@ ITEM_REMOVED
Definition Item.h:212
@ ITEM_NEW
Definition Item.h:211
@ ITEM_UNCHANGED
Definition Item.h:209
@ BUYBACK_SLOT_END
Definition Player.h:711
@ BUYBACK_SLOT_START
Definition Player.h:710
#define INVENTORY_SLOT_BAG_0
Definition Player.h:656
@ PLAYER_SLOT_START
Definition Player.h:650
@ PLAYER_SLOT_END
Definition Player.h:652
Definition Bag.h:28
Player * getSelectedPlayer() const
Definition Chat.cpp:374
Definition Item.h:220
uint8 GetSlot() const
Definition Item.h:281
Bag * GetContainer()
Definition Item.h:282
Bag * ToBag()
Definition Item.h:250
ItemUpdateState GetState() const
Definition Item.h:324
ObjectGuid GetOwnerGUID() const
Definition Item.h:231
uint32 GetQueuePos() const
Definition Item.h:329
uint8 GetBagSlot() const
Definition Item.cpp:784
bool IsInUpdateQueue() const
Definition Item.h:328
std::string ToString() const
Definition ObjectGuid.cpp:47
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:114
Item * GetItemByPos(uint16 pos) const
Definition PlayerStorage.cpp:443
std::vector< Item * > & GetItemUpdateQueue()
Definition Player.h:1274
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default AC string format function.
Definition StringFormat.h:44

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, Item::GetContainer(), Object::GetGUID(), Player::GetItemByPos(), Player::GetItemUpdateQueue(), Item::GetOwnerGUID(), ChatHandler::GetPlayer(), Item::GetQueuePos(), ChatHandler::getSelectedPlayer(), Item::GetSlot(), Item::GetState(), INVENTORY_SLOT_BAG_0, Item::IsInUpdateQueue(), ITEM_CHANGED, ITEM_NEW, ITEM_REMOVED, ITEM_UNCHANGED, PLAYER_SLOT_END, PLAYER_SLOT_START, ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), Acore::StringFormat(), Item::ToBag(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugGetItemValueCommand()

static bool debug_commandscript::HandleDebugGetItemValueCommand ( ChatHandler handler,
ObjectGuid::LowType  guid,
uint32  index 
)
inlinestatic
1154 {
1155 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
1156
1157 if (!i)
1158 return false;
1159
1160 if (index >= i->GetValuesCount())
1161 return false;
1162
1163 uint32 value = i->GetUInt32Value(index);
1164
1165 handler->PSendSysMessage("Item {}: value at {} is {}", guid, index, value);
1166
1167 return true;
1168 }
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:294
uint16 GetValuesCount() const
Definition Object.h:188
Item * GetItemByGuid(ObjectGuid guid) const
Definition PlayerStorage.cpp:409

References Player::GetItemByGuid(), ChatHandler::GetPlayer(), Object::GetUInt32Value(), Object::GetValuesCount(), Item, and ChatHandler::PSendSysMessage().

Referenced by GetCommands().

◆ HandleDebugGetLootRecipientCommand()

static bool debug_commandscript::HandleDebugGetLootRecipientCommand ( ChatHandler handler)
inlinestatic
505 {
506 Creature* target = handler->getSelectedCreature();
507 if (!target)
508 return false;
509
510 handler->PSendSysMessage("Loot recipient for creature {} (GUID {}, SpawnID {}) is {}",
511 target->GetName(), target->GetGUID().ToString(), target->GetSpawnId(),
512 target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient");
513 return true;
514 }
bool hasLootRecipient() const
Definition Creature.h:234
Player * GetLootRecipient() const
Definition Creature.cpp:1268

References Object::GetGUID(), Creature::GetLootRecipient(), WorldObject::GetName(), ChatHandler::getSelectedCreature(), Creature::GetSpawnId(), Creature::hasLootRecipient(), ChatHandler::PSendSysMessage(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugGetValueCommand()

static bool debug_commandscript::HandleDebugGetValueCommand ( ChatHandler handler,
uint32  index,
bool  isInt 
)
inlinestatic
1275 {
1276 Unit* target = handler->getSelectedUnit();
1277 if (!target)
1278 {
1280 return false;
1281 }
1282
1283 ObjectGuid guid = target->GetGUID();
1284
1285 if (index >= target->GetValuesCount())
1286 {
1287 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, guid.ToString(), target->GetValuesCount());
1288 return false;
1289 }
1290
1291 if (isInt)
1292 {
1293 uint32 value = target->GetUInt32Value(index);
1294 handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.ToString(), index, value);
1295 }
1296 else
1297 {
1298 float value = target->GetFloatValue(index);
1299 handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.ToString(), index, value);
1300 }
1301
1302 return true;
1303 }
@ LANG_TOO_BIG_INDEX
Definition Language.h:627
@ LANG_SELECT_CHAR_OR_CREATURE
Definition Language.h:31
@ LANG_GET_UINT_FIELD
Definition Language.h:633
@ LANG_GET_FLOAT_FIELD
Definition Language.h:635
float GetFloatValue(uint16 index) const
Definition Object.cpp:306

References Object::GetFloatValue(), Object::GetGUID(), ChatHandler::getSelectedUnit(), Object::GetUInt32Value(), Object::GetValuesCount(), LANG_GET_FLOAT_FIELD, LANG_GET_UINT_FIELD, LANG_SELECT_CHAR_OR_CREATURE, LANG_TOO_BIG_INDEX, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugHostileRefListCommand()

static bool debug_commandscript::HandleDebugHostileRefListCommand ( ChatHandler handler)
inlinestatic
1014 {
1015 Unit* target = handler->getSelectedUnit();
1016 if (!target)
1017 target = handler->GetSession()->GetPlayer();
1018
1019 uint32 count = 0;
1020
1021 handler->PSendSysMessage("Threatened by me list of {} ({})", target->GetName(), target->GetGUID().ToString());
1022
1023 for (auto const& pair : target->GetThreatMgr().GetThreatenedByMeList())
1024 {
1025 ThreatReference const* ref = pair.second;
1026 Creature* owner = ref->GetOwner();
1027 if (owner)
1028 {
1029 std::string stateStr = "";
1030 if (ref->IsOffline())
1031 stateStr = "[offline] ";
1032 else if (ref->IsSuppressed())
1033 stateStr = "[suppressed] ";
1034
1035 handler->PSendSysMessage(" {}. {}{} ({}) - threat {}", ++count, stateStr,
1036 owner->GetName(), owner->GetGUID().ToString(), ref->GetThreat());
1037 }
1038 else
1039 {
1040 handler->PSendSysMessage(" {}. No Owner - threat {}", ++count, ref->GetThreat());
1041 }
1042 }
1043
1044 handler->SendSysMessage("End of threatened by me list.");
1045
1046 // Also show combat refs that may not appear in the threat list
1047 // (e.g. creatures without threat lists like triggers/environmental hazards)
1048 handler->PSendSysMessage("Combat refs (InCombat: {} | HasCombat: {})", target->IsInCombat(), target->GetCombatManager().HasCombat());
1049 for (auto const& ref : target->GetCombatManager().GetPvECombatRefs())
1050 {
1051 Unit* unit = ref.second->GetOther(target);
1052 handler->PSendSysMessage(" [PvE] {} ({}) Entry: {}", unit->GetName(), unit->GetGUID().ToString(),
1053 unit->IsCreature() ? unit->ToCreature()->GetEntry() : 0);
1054 }
1055 for (auto const& ref : target->GetCombatManager().GetPvPCombatRefs())
1056 {
1057 Unit* unit = ref.second->GetOther(target);
1058 handler->PSendSysMessage(" [PvP] {} ({})", unit->GetName(), unit->GetGUID().ToString());
1059 }
1060
1061 return true;
1062 }
uint32 GetEntry() const
Definition Object.h:117
Definition ThreatManager.h:267
bool IsSuppressed() const
Definition ThreatManager.h:278
Creature * GetOwner() const
Definition ThreatManager.h:272
bool IsOffline() const
Definition ThreatManager.h:279
float GetThreat() const
Definition ThreatManager.h:274

References Unit::GetCombatManager(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetName(), ThreatReference::GetOwner(), WorldSession::GetPlayer(), CombatManager::GetPvECombatRefs(), CombatManager::GetPvPCombatRefs(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), ThreatReference::GetThreat(), ThreatManager::GetThreatenedByMeList(), Unit::GetThreatMgr(), CombatManager::HasCombat(), Object::IsCreature(), Unit::IsInCombat(), ThreatReference::IsOffline(), ThreatReference::IsSuppressed(), ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), Object::ToCreature(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugItemExpireCommand()

static bool debug_commandscript::HandleDebugItemExpireCommand ( ChatHandler handler,
ObjectGuid::LowType  guid 
)
inlinestatic
1186 {
1187 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
1188
1189 if (!i)
1190 return false;
1191
1192 handler->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
1193 sScriptMgr->OnItemExpire(handler->GetPlayer(), i->GetTemplate());
1194
1195 return true;
1196 }
#define sScriptMgr
Definition ScriptMgr.h:734
ItemTemplate const * GetTemplate() const
Definition Item.cpp:544
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition PlayerStorage.cpp:3089

References Player::DestroyItem(), Item::GetBagSlot(), Player::GetItemByGuid(), ChatHandler::GetPlayer(), Item::GetSlot(), Item::GetTemplate(), Item, and sScriptMgr.

Referenced by GetCommands().

◆ HandleDebugLootCommand()

static bool debug_commandscript::HandleDebugLootCommand ( ChatHandler handler,
std::string  type,
uint32  lootId,
Optional< uint32 count 
)
inlinestatic
1704 {
1705 static std::unordered_map<std::string, LootStore*> const lootStoreMap =
1706 {
1707 { "creature", &LootTemplates_Creature },
1708 { "gameobject", &LootTemplates_Gameobject },
1709 { "fishing", &LootTemplates_Fishing },
1710 { "item", &LootTemplates_Item },
1711 { "pickpocketing", &LootTemplates_Pickpocketing },
1712 { "skinning", &LootTemplates_Skinning },
1713 { "disenchant", &LootTemplates_Disenchant },
1714 { "prospecting", &LootTemplates_Prospecting },
1715 { "milling", &LootTemplates_Milling },
1716 { "spell", &LootTemplates_Spell },
1717 { "reference", &LootTemplates_Reference },
1718 { "mail", &LootTemplates_Mail },
1719 { "player", &LootTemplates_Player }
1720 };
1721
1722 // Lowercase the type for case-insensitive matching
1723 std::transform(type.begin(), type.end(), type.begin(), ::tolower);
1724
1725 auto itr = lootStoreMap.find(type);
1726 if (itr == lootStoreMap.end())
1727 {
1729 return false;
1730 }
1731
1732 LootStore const* store = itr->second;
1733
1734 LootTemplate const* tab = store->GetLootFor(lootId);
1735 if (!tab)
1736 {
1737 handler->SendErrorMessage(LANG_DEBUG_LOOT_NO_TEMPLATE, type, lootId);
1738 return false;
1739 }
1740
1741 uint32 iterations = std::min(count.value_or(1), uint32(100));
1742 if (iterations == 0)
1743 iterations = 1;
1744
1745 Player* player = handler->GetPlayer();
1746 std::string sourceName = GetLootSourceName(type, lootId);
1747
1748 // Single iteration - original behavior
1749 if (iterations == 1)
1750 {
1751 Loot loot;
1752 GenerateLoot(loot, tab, *store, player, type, lootId);
1753
1754 handler->PSendSysMessage(LANG_DEBUG_LOOT_HEADER, type, sourceName, lootId);
1755
1756 if (loot.items.empty() && loot.quest_items.empty() && loot.gold == 0)
1757 {
1759 return true;
1760 }
1761
1762 for (LootItem const& li : loot.items)
1763 {
1764 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(li.itemid);
1765 std::string name = proto ? proto->Name1 : "Unknown";
1766 char const* qualityName = GetItemQualityName(proto ? proto->Quality : 0);
1768 li.itemid, uint32(li.count), name, qualityName,
1769 li.randomPropertyId, li.randomSuffix);
1770 }
1771
1772 for (LootItem const& li : loot.quest_items)
1773 {
1774 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(li.itemid);
1775 std::string name = proto ? proto->Name1 : "Unknown";
1776 char const* qualityName = GetItemQualityName(proto ? proto->Quality : 0);
1778 li.itemid, uint32(li.count), name, qualityName);
1779 }
1780
1781 if (loot.gold > 0)
1782 {
1783 uint32 gold = loot.gold / 10000;
1784 uint32 silver = (loot.gold % 10000) / 100;
1785 uint32 copper = loot.gold % 100;
1787 loot.gold, gold, silver, copper);
1788 }
1789
1790 return true;
1791 }
1792
1793 // Multi iteration - aggregate results
1794 struct ItemStats
1795 {
1796 uint32 totalCount = 0;
1797 uint32 timesDropped = 0;
1798 bool questItem = false;
1799 };
1800
1801 std::map<uint32, ItemStats> itemStats;
1802 uint64 totalGold = 0;
1803
1804 for (uint32 i = 0; i < iterations; ++i)
1805 {
1806 Loot loot;
1807 GenerateLoot(loot, tab, *store, player, type, lootId);
1808
1809 std::set<uint32> seenThisRun;
1810
1811 for (LootItem const& li : loot.items)
1812 {
1813 itemStats[li.itemid].totalCount += li.count;
1814 if (seenThisRun.insert(li.itemid).second)
1815 itemStats[li.itemid].timesDropped++;
1816 }
1817
1818 for (LootItem const& li : loot.quest_items)
1819 {
1820 itemStats[li.itemid].totalCount += li.count;
1821 itemStats[li.itemid].questItem = true;
1822 if (seenThisRun.insert(li.itemid).second)
1823 itemStats[li.itemid].timesDropped++;
1824 }
1825
1826 totalGold += loot.gold;
1827 }
1828
1830 type, sourceName, lootId, iterations);
1831
1832 if (itemStats.empty() && totalGold == 0)
1833 {
1835 return true;
1836 }
1837
1838 for (auto const& [itemId, stats] : itemStats)
1839 {
1840 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
1841 std::string name = proto ? proto->Name1 : "Unknown";
1842 char const* qualityName = GetItemQualityName(proto ? proto->Quality : 0);
1843 uint32 dropPct = (stats.timesDropped * 10000) / iterations;
1844
1845 if (stats.questItem)
1847 itemId, stats.totalCount, name, qualityName,
1848 stats.timesDropped, iterations, dropPct / 100, dropPct % 100);
1849 else
1851 itemId, stats.totalCount, name, qualityName,
1852 stats.timesDropped, iterations, dropPct / 100, dropPct % 100);
1853 }
1854
1855 if (totalGold > 0)
1856 {
1857 uint32 avgGold = static_cast<uint32>(totalGold / iterations);
1858 uint32 gold = avgGold / 10000;
1859 uint32 silver = (avgGold % 10000) / 100;
1860 uint32 copper = avgGold % 100;
1862 avgGold, gold, silver, copper, iterations);
1863 }
1864
1865 return true;
1866 }
std::uint64_t uint64
Definition Define.h:106
@ LANG_DEBUG_LOOT_HEADER
Definition Language.h:1420
@ LANG_DEBUG_LOOT_EMPTY
Definition Language.h:1424
@ LANG_DEBUG_LOOT_NO_TEMPLATE
Definition Language.h:1426
@ LANG_DEBUG_LOOT_GOLD_MULTI
Definition Language.h:1430
@ LANG_DEBUG_LOOT_GOLD
Definition Language.h:1423
@ LANG_DEBUG_LOOT_INVALID_TYPE
Definition Language.h:1425
@ LANG_DEBUG_LOOT_HEADER_MULTI
Definition Language.h:1427
@ LANG_DEBUG_LOOT_ITEM_QUEST
Definition Language.h:1422
@ LANG_DEBUG_LOOT_ITEM
Definition Language.h:1421
@ LANG_DEBUG_LOOT_ITEM_MULTI
Definition Language.h:1428
@ LANG_DEBUG_LOOT_ITEM_QUEST_MULTI
Definition Language.h:1429
LootStore LootTemplates_Spell("spell_loot_template", "spell id (random item creating)", false)
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)
LootStore LootTemplates_Item("item_loot_template", "item entry", true)
LootStore LootTemplates_Milling("milling_loot_template", "item entry (herb)", true)
LootStore LootTemplates_Reference("reference_loot_template", "reference id", false)
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)
LootStore LootTemplates_Prospecting("prospecting_loot_template", "item entry (ore)", true)
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true)
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template", "creature pickpocket lootid", true)
LootStore LootTemplates_Mail("mail_loot_template", "mail template id", false)
LootStore LootTemplates_Player("player_loot_template", "team id", true)
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true)
Definition LootMgr.h:207
LootTemplate const * GetLootFor(uint32 loot_id) const
Definition LootMgr.cpp:247
Definition LootMgr.h:245
static char const * GetItemQualityName(uint32 quality)
Definition cs_debug.cpp:1665
static void GenerateLoot(Loot &loot, LootTemplate const *tab, LootStore const &store, Player *player, std::string const &type, uint32 lootId)
Definition cs_debug.cpp:1678
static std::string GetLootSourceName(std::string const &type, uint32 lootId)
Definition cs_debug.cpp:1639
uint32 Quality
Definition ItemTemplate.h:626
std::string Name1
Definition ItemTemplate.h:624
Definition LootMgr.h:154
Definition LootMgr.h:313
uint32 gold
Definition LootMgr.h:322

References GenerateLoot(), GetItemQualityName(), LootStore::GetLootFor(), GetLootSourceName(), ChatHandler::GetPlayer(), Loot::gold, Loot::items, LANG_DEBUG_LOOT_EMPTY, LANG_DEBUG_LOOT_GOLD, LANG_DEBUG_LOOT_GOLD_MULTI, LANG_DEBUG_LOOT_HEADER, LANG_DEBUG_LOOT_HEADER_MULTI, LANG_DEBUG_LOOT_INVALID_TYPE, LANG_DEBUG_LOOT_ITEM, LANG_DEBUG_LOOT_ITEM_MULTI, LANG_DEBUG_LOOT_ITEM_QUEST, LANG_DEBUG_LOOT_ITEM_QUEST_MULTI, LANG_DEBUG_LOOT_NO_TEMPLATE, LootTemplates_Creature, LootTemplates_Disenchant, LootTemplates_Fishing, LootTemplates_Gameobject, LootTemplates_Item, LootTemplates_Mail, LootTemplates_Milling, LootTemplates_Pickpocketing, LootTemplates_Player, LootTemplates_Prospecting, LootTemplates_Reference, LootTemplates_Skinning, LootTemplates_Spell, ItemTemplate::Name1, ChatHandler::PSendSysMessage(), ItemTemplate::Quality, Loot::quest_items, ChatHandler::SendErrorMessage(), and sObjectMgr.

Referenced by GetCommands().

◆ HandleDebugLoSCommand()

static bool debug_commandscript::HandleDebugLoSCommand ( ChatHandler handler)
inlinestatic
1210 {
1211 if (Unit* unit = handler->getSelectedUnit())
1212 {
1213 Player* player = handler->GetSession()->GetPlayer();
1214 handler->PSendSysMessage("Checking LoS {} -> {}:", player->GetName(), unit->GetName());
1215 handler->PSendSysMessage(" VMAP LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
1216 handler->PSendSysMessage(" GObj LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_ALL) ? "clear" : "obstructed");
1217 handler->PSendSysMessage("{} is {}in line of sight of {}.", unit->GetName(), (player->IsWithinLOSInMap(unit) ? "" : "not "), player->GetName());
1218 return true;
1219 }
1220
1221 return false;
1222 }
@ LINEOFSIGHT_CHECK_VMAP
Definition Map.h:105
@ LINEOFSIGHT_CHECK_GOBJECT_ALL
Definition Map.h:109
const std::string & GetName() const
Definition ScriptObject.h:53
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition Object.cpp:1403

References WorldObject::GetName(), WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), WorldObject::IsWithinLOSInMap(), LINEOFSIGHT_CHECK_GOBJECT_ALL, LINEOFSIGHT_CHECK_VMAP, VMAP::Nothing, and ChatHandler::PSendSysMessage().

Referenced by GetCommands().

◆ HandleDebugMapDataCommand()

static bool debug_commandscript::HandleDebugMapDataCommand ( ChatHandler handler)
inlinestatic
1550 {
1551 Cell cell(handler->GetPlayer()->GetPositionX(), handler->GetPlayer()->GetPositionY());
1552 Map* map = handler->GetPlayer()->GetMap();
1553
1554 handler->PSendSysMessage("GridX {} GridY {}", cell.GridX(), cell.GridY());
1555 handler->PSendSysMessage("CellX {} CellY {}", cell.CellX(), cell.CellY());
1556 handler->PSendSysMessage("Created Grids: {} / {}", map->GetCreatedGridsCount(), MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS);
1557 handler->PSendSysMessage("Loaded Grids: {} / {}", map->GetLoadedGridsCount(), MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS);
1558 handler->PSendSysMessage("Created Cells In Grid: {} / {}", map->GetCreatedCellsInGridCount(cell.GridX(), cell.GridY()), MAX_NUMBER_OF_CELLS * MAX_NUMBER_OF_CELLS);
1560 return true;
1561 }
#define TOTAL_NUMBER_OF_CELLS_PER_MAP
Definition GridDefines.h:47
#define MAX_NUMBER_OF_CELLS
Definition MapDefines.h:25
#define MAX_NUMBER_OF_GRIDS
Definition MapDefines.h:24
Definition Map.h:164
uint32 GetLoadedGridsCount()
Definition Map.cpp:3139
uint32 GetCreatedGridsCount()
Definition Map.cpp:3134
uint32 GetCreatedCellsInGridCount(uint16 const x, uint16 const y)
Definition Map.cpp:3144
uint32 GetCreatedCellsInMapCount()
Definition Map.cpp:3149
Map * GetMap() const
Definition Object.h:625
Definition Cell.h:45
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References Cell::CellX(), Cell::CellY(), Map::GetCreatedCellsInGridCount(), Map::GetCreatedCellsInMapCount(), Map::GetCreatedGridsCount(), Map::GetLoadedGridsCount(), WorldObject::GetMap(), ChatHandler::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Cell::GridX(), Cell::GridY(), MAX_NUMBER_OF_CELLS, MAX_NUMBER_OF_GRIDS, ChatHandler::PSendSysMessage(), and TOTAL_NUMBER_OF_CELLS_PER_MAP.

Referenced by GetCommands().

◆ HandleDebugMod32ValueCommand()

static bool debug_commandscript::HandleDebugMod32ValueCommand ( ChatHandler handler,
uint32  index,
uint32  value 
)
inlinestatic
1306 {
1307 if (index >= handler->GetPlayer()->GetValuesCount())
1308 {
1309 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().ToString(), handler->GetPlayer()->GetValuesCount());
1310 return false;
1311 }
1312
1313 uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
1314
1315 currentValue += value;
1316 handler->GetPlayer()->SetUInt32Value(index, currentValue);
1317
1318 handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
1319
1320 return true;
1321 }
@ LANG_CHANGE_32BIT_FIELD
Definition Language.h:639
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:17323

References Object::GetGUID(), ChatHandler::GetPlayer(), Object::GetUInt32Value(), Object::GetValuesCount(), LANG_CHANGE_32BIT_FIELD, LANG_TOO_BIG_INDEX, ChatHandler::PSendSysMessage(), Unit::SetUInt32Value(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugMoveflagsCommand()

static bool debug_commandscript::HandleDebugMoveflagsCommand ( ChatHandler handler,
Optional< uint32 moveFlags,
Optional< uint32 moveFlagsExtra 
)
inlinestatic

Display case

1378 {
1379 Unit* target = handler->getSelectedUnit();
1380 if (!target)
1381 target = handler->GetPlayer();
1382
1383 if (!moveFlags)
1384 {
1387 }
1388 else
1389 {
1390 static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
1393
1394 bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
1395
1396 target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
1397 target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
1398 target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
1399 target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
1400 target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
1401 target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
1402 target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
1403
1405 *moveFlags &= ~MOVEMENTFLAG_FALLING;
1406
1407 if (*moveFlags & MOVEMENTFLAG_ROOT)
1408 {
1409 target->SetControlled(true, UNIT_STATE_ROOT);
1410 *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
1411 }
1412
1414 target->StopMoving();
1415
1416 if (unhandledFlag)
1417 target->SetUnitMovementFlags(*moveFlags);
1418
1419 if (moveFlagsExtra)
1420 {
1421 target->SetExtraUnitMovementFlags(*moveFlagsExtra);
1422 }
1423
1424 if (moveFlagsExtra || unhandledFlag)
1425 target->SendMovementFlagUpdate();
1426
1428 }
1429
1430 return true;
1431 }
@ LANG_MOVEFLAGS_GET
Definition Language.h:941
@ LANG_MOVEFLAGS_SET
Definition Language.h:942
@ MOVEMENTFLAG_SPLINE_ENABLED
Definition UnitDefines.h:399
@ MOVEMENTFLAG_WATERWALKING
Definition UnitDefines.h:400
@ MOVEMENTFLAG_DISABLE_GRAVITY
Definition UnitDefines.h:382
@ MOVEMENTFLAG_FALLING_SLOW
Definition UnitDefines.h:401
@ MOVEMENTFLAG_CAN_FLY
Definition UnitDefines.h:396
@ MOVEMENTFLAG_ROOT
Definition UnitDefines.h:383
@ MOVEMENTFLAG_FALLING
Definition UnitDefines.h:384
@ MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE
Movement flags that have change status opcodes associated for players.
Definition UnitDefines.h:423
@ MOVEMENTFLAG_SWIMMING
Definition UnitDefines.h:393
@ MOVEMENTFLAG_HOVER
Definition UnitDefines.h:402
@ MOVEMENTFLAG_WALKING
Definition UnitDefines.h:380
@ UNIT_STATE_ROOT
Definition UnitDefines.h:183
uint32 GetUnitMovementFlags() const
Definition Unit.h:775
void SetFeatherFall(bool enable)
Definition Unit.cpp:16558
void SetUnitMovementFlags(uint32 f)
Definition Unit.h:776
void SetExtraUnitMovementFlags(uint16 f)
Definition Unit.h:782
void SetHover(bool enable)
Definition Unit.cpp:16599
void StopMoving()
Definition Unit.cpp:12997
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:16522
virtual bool SetSwim(bool enable)
Definition Unit.cpp:16497
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:14268
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:774
void SendMovementFlagUpdate(bool self=false)
Definition Unit.cpp:13051
virtual bool SetWalk(bool enable)
Definition Unit.cpp:16448
uint16 GetExtraUnitMovementFlags() const
Definition Unit.h:781
void SetDisableGravity(bool disable)
Definition Unit.cpp:16462
void SetWaterWalking(bool enable)
Definition Unit.cpp:16652

References Unit::GetExtraUnitMovementFlags(), ChatHandler::GetPlayer(), ChatHandler::getSelectedUnit(), Unit::GetUnitMovementFlags(), Unit::HasUnitMovementFlag(), LANG_MOVEFLAGS_GET, LANG_MOVEFLAGS_SET, MOVEMENTFLAG_CAN_FLY, MOVEMENTFLAG_DISABLE_GRAVITY, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_FALLING_SLOW, MOVEMENTFLAG_HOVER, MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE, MOVEMENTFLAG_ROOT, MOVEMENTFLAG_SPLINE_ENABLED, MOVEMENTFLAG_SWIMMING, MOVEMENTFLAG_WALKING, MOVEMENTFLAG_WATERWALKING, ChatHandler::PSendSysMessage(), Unit::SendMovementFlagUpdate(), Unit::SetCanFly(), Unit::SetControlled(), Unit::SetDisableGravity(), Unit::SetExtraUnitMovementFlags(), Unit::SetFeatherFall(), Unit::SetHover(), Unit::SetSwim(), Unit::SetUnitMovementFlags(), Unit::SetWalk(), Unit::SetWaterWalking(), Unit::StopMoving(), and UNIT_STATE_ROOT.

Referenced by GetCommands().

◆ HandleDebugObjectCountCommand()

static bool debug_commandscript::HandleDebugObjectCountCommand ( ChatHandler handler,
Optional< uint32 mapId 
)
inlinestatic
1466 {
1467 if (mapId)
1468 {
1469 sMapMgr->DoForAllMapsWithMapId(mapId.value(),
1470 [handler](Map* map) -> void
1471 {
1472 HandleDebugObjectCountMap(handler, map);
1473 }
1474 );
1475 }
1476 else
1477 {
1478 sMapMgr->DoForAllMaps(
1479 [handler](Map* map) -> void
1480 {
1481 HandleDebugObjectCountMap(handler, map);
1482 }
1483 );
1484 }
1485
1486 return true;
1487 }
#define sMapMgr
Definition MapMgr.h:220
static void HandleDebugObjectCountMap(ChatHandler *handler, Map *map)
Definition cs_debug.cpp:1525

References HandleDebugObjectCountMap(), and sMapMgr.

Referenced by GetCommands().

◆ HandleDebugObjectCountMap()

static void debug_commandscript::HandleDebugObjectCountMap ( ChatHandler handler,
Map map 
)
inlinestatic
1526 {
1527 handler->PSendSysMessage("Map Id: {} Name: '{}' Instance Id: {} Creatures: {} GameObjects: {} Update Objects: {}",
1528 map->GetId(), map->GetMapName(), map->GetInstanceId(),
1532
1533 CreatureCountWorker worker;
1535 visitor.Visit(map->GetObjectsStore());
1536
1537 handler->PSendSysMessage("Top Creatures count:");
1538
1539 for (auto&& p : worker.GetTopCreatureCount(5))
1540 handler->PSendSysMessage("Entry: {} Count: {}", p.first, p.second);
1541 }
Definition GameObject.h:120
MapStoredObjectTypesContainer & GetObjectsStore()
Definition Map.h:349
size_t GetUpdatableObjectsCount() const
Definition Map.h:496
uint32 GetId() const
Definition Map.h:230
const char * GetMapName() const
Definition Map.cpp:1599
uint32 GetInstanceId() const
Definition Map.h:266
Definition TypeContainerVisitor.h:105
std::size_t Size() const
Definition TypeContainer.h:195

References Map::GetId(), Map::GetInstanceId(), Map::GetMapName(), Map::GetObjectsStore(), debug_commandscript::CreatureCountWorker::GetTopCreatureCount(), Map::GetUpdatableObjectsCount(), ChatHandler::PSendSysMessage(), TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Size(), and TypeContainerVisitor< VISITOR, TYPE_CONTAINER >::Visit().

Referenced by HandleDebugObjectCountCommand().

◆ HandleDebugPlayCinematicCommand()

static bool debug_commandscript::HandleDebugPlayCinematicCommand ( ChatHandler handler,
uint32  cinematicId 
)
inlinestatic
131 {
132 CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
133 if (!cineSeq)
134 {
135 handler->SendErrorMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
136 return false;
137 }
138
139 // Dump camera locations
140 if (std::vector<FlyByCamera> const* flyByCameras = GetFlyByCameras(cineSeq->cinematicCamera))
141 {
142 handler->PSendSysMessage("Waypoints for sequence {}, camera {}", cinematicId, cineSeq->cinematicCamera);
143 uint32 count = 1;
144 for (FlyByCamera const& cam : *flyByCameras)
145 {
146 handler->PSendSysMessage("{} - {}ms [{} ({} degrees)]", count, cam.timeStamp, cam.locations.ToString(), cam.locations.GetOrientation() * (180 / M_PI));
147 ++count;
148 }
149 handler->PSendSysMessage("{} waypoints dumped", flyByCameras->size());
150 }
151
152 handler->GetPlayer()->GetCinematicMgr().StartCinematic(cinematicId);
153 return true;
154 }
DBCStorage< CinematicSequencesEntry > sCinematicSequencesStore(CinematicSequencesEntryfmt)
@ LANG_CINEMATIC_NOT_EXIST
Definition Language.h:989
std::vector< FlyByCamera > const * GetFlyByCameras(uint32 cinematicCameraId)
Definition M2Stores.cpp:254
void StartCinematic(uint32 const cinematicSequenceId)
Definition CinematicMgr.cpp:31
CinematicMgr & GetCinematicMgr()
Definition Player.h:1396
Definition DBCStructure.h:713
uint32 cinematicCamera
Definition DBCStructure.h:716
Definition M2Stores.h:26

References CinematicSequencesEntry::cinematicCamera, Player::GetCinematicMgr(), GetFlyByCameras(), ChatHandler::GetPlayer(), LANG_CINEMATIC_NOT_EXIST, ChatHandler::PSendSysMessage(), sCinematicSequencesStore, ChatHandler::SendErrorMessage(), and CinematicMgr::StartCinematic().

Referenced by GetCommands().

◆ HandleDebugPlayMovieCommand()

static bool debug_commandscript::HandleDebugPlayMovieCommand ( ChatHandler handler,
uint32  movieId 
)
inlinestatic
158 {
159 if (!sMovieStore.LookupEntry(movieId))
160 {
161 handler->SendErrorMessage(LANG_MOVIE_NOT_EXIST, movieId);
162 return false;
163 }
164
165 handler->GetPlayer()->SendMovieStart(movieId);
166 return true;
167 }
DBCStorage< MovieEntry > sMovieStore(MovieEntryfmt)
@ LANG_MOVIE_NOT_EXIST
Definition Language.h:990
void SendMovieStart(uint32 MovieId)
Definition Player.cpp:5692

References ChatHandler::GetPlayer(), LANG_MOVIE_NOT_EXIST, ChatHandler::SendErrorMessage(), Player::SendMovieStart(), and sMovieStore.

Referenced by GetCommands().

◆ HandleDebugPlayMusicCommand()

static bool debug_commandscript::HandleDebugPlayMusicCommand ( ChatHandler handler,
uint32  musicId 
)
inlinestatic
198 {
199 if (!sSoundEntriesStore.LookupEntry(musicId))
200 {
201 handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, musicId);
202 return false;
203 }
204
205 Player* player = handler->GetPlayer();
206
207 player->PlayDirectMusic(musicId, player);
208
209 handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, musicId);
210 return true;
211 }
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
@ LANG_YOU_HEAR_SOUND
Definition Language.h:197
@ LANG_SOUND_NOT_EXIST
Definition Language.h:211
void PlayDirectMusic(uint32 music_id, Player *target=nullptr)
Definition Object.cpp:2976

References ChatHandler::GetPlayer(), LANG_SOUND_NOT_EXIST, LANG_YOU_HEAR_SOUND, WorldObject::PlayDirectMusic(), ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and sSoundEntriesStore.

Referenced by GetCommands().

◆ HandleDebugPlaySoundCommand()

static bool debug_commandscript::HandleDebugPlaySoundCommand ( ChatHandler handler,
uint32  soundId 
)
inlinestatic
171 {
172 if (!sSoundEntriesStore.LookupEntry(soundId))
173 {
174 handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, soundId);
175 return false;
176 }
177
178 Player* player = handler->GetPlayer();
179
180 Unit* unit = handler->getSelectedUnit();
181 if (!unit)
182 {
184 return false;
185 }
186
187 if (player->GetTarget())
188 unit->PlayDistanceSound(soundId, player);
189 else
190 unit->PlayDirectSound(soundId, player);
191
192 handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId);
193 return true;
194 }
ObjectGuid GetTarget() const
Definition Unit.h:861
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2957
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2949

References ChatHandler::GetPlayer(), ChatHandler::getSelectedUnit(), Unit::GetTarget(), LANG_SELECT_CHAR_OR_CREATURE, LANG_SOUND_NOT_EXIST, LANG_YOU_HEAR_SOUND, WorldObject::PlayDirectSound(), WorldObject::PlayDistanceSound(), ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and sSoundEntriesStore.

Referenced by GetCommands().

◆ HandleDebugSendBuyErrorCommand()

static bool debug_commandscript::HandleDebugSendBuyErrorCommand ( ChatHandler handler,
BuyResult  error 
)
inlinestatic
268 {
269 handler->GetPlayer()->SendBuyError(BuyResult(error), nullptr, 0, 0);
270 return true;
271 }
BuyResult
Definition Item.h:140
void SendBuyError(BuyResult msg, Creature *creature, uint32 item, uint32 param)
Definition PlayerStorage.cpp:4131

References ChatHandler::GetPlayer(), and Player::SendBuyError().

Referenced by GetCommands().

◆ HandleDebugSendChannelNotifyCommand()

static bool debug_commandscript::HandleDebugSendChannelNotifyCommand ( ChatHandler handler,
ChatNotify  type 
)
inlinestatic
480 {
481 WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
482 data << type;
483 data << "test";
484 data << uint32(0);
485 data << uint32(0);
486 handler->GetSession()->SendPacket(&data);
487 return true;
488 }
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:283
@ SMSG_CHANNEL_NOTIFY
Definition Opcodes.h:183

References ChatHandler::GetSession(), WorldSession::SendPacket(), and SMSG_CHANNEL_NOTIFY.

Referenced by GetCommands().

◆ HandleDebugSendChatMsgCommand()

static bool debug_commandscript::HandleDebugSendChatMsgCommand ( ChatHandler handler,
ChatMsg  type 
)
inlinestatic
491 {
492 WorldPacket data;
493 ChatHandler::BuildChatPacket(data, type, LANG_UNIVERSAL, handler->GetPlayer(), handler->GetPlayer(), "testtest", 0, "chan");
494 handler->GetSession()->SendPacket(&data);
495 return true;
496 }
@ LANG_UNIVERSAL
Definition SharedDefines.h:723
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition Chat.cpp:265

References ChatHandler::BuildChatPacket(), ChatHandler::GetPlayer(), ChatHandler::GetSession(), LANG_UNIVERSAL, and WorldSession::SendPacket().

Referenced by GetCommands().

◆ HandleDebugSendEquipErrorCommand()

static bool debug_commandscript::HandleDebugSendEquipErrorCommand ( ChatHandler handler,
InventoryResult  error 
)
inlinestatic
256 {
257 handler->GetPlayer()->SendEquipError(InventoryResult(error), nullptr, nullptr);
258 return true;
259 }
InventoryResult
Definition Item.h:46
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4088

References ChatHandler::GetPlayer(), and Player::SendEquipError().

Referenced by GetCommands().

◆ HandleDebugSendLargePacketCommand()

static bool debug_commandscript::HandleDebugSendLargePacketCommand ( ChatHandler handler)
inlinestatic
1137 {
1138 std::ostringstream ss;
1139
1140 while (ss.str().size() < 128000)
1141 ss << "This is a dummy string to push the packet's size beyond 128000 bytes. ";
1142
1143 handler->SendSysMessage(ss.str().c_str());
1144 return true;
1145 }

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugSendOpcodeCommand()

static bool debug_commandscript::HandleDebugSendOpcodeCommand ( ChatHandler handler)
inlinestatic
274 {
275 Unit* unit = handler->getSelectedUnit();
276 Player* player = nullptr;
277
278 if (!unit || (!unit->IsPlayer()))
279 {
280 player = handler->GetSession()->GetPlayer();
281 }
282 else
283 {
284 player = unit->ToPlayer();
285 }
286
287 if (!unit)
288 {
289 unit = player;
290 }
291
292 std::ifstream ifs("opcode.txt");
293 if (!ifs.is_open())
294 {
296 return false;
297 }
298
299 // remove comments from file
300 std::stringstream parsedStream;
301 while (!ifs.eof())
302 {
303 char commentToken[2];
304 ifs.get(commentToken[0]);
305 if (commentToken[0] == '/' && !ifs.eof())
306 {
307 ifs.get(commentToken[1]);
308 // /* comment
309 if (commentToken[1] == '*')
310 {
311 while (!ifs.eof())
312 {
313 ifs.get(commentToken[0]);
314 if (commentToken[0] == '*' && !ifs.eof())
315 {
316 ifs.get(commentToken[1]);
317 if (commentToken[1] == '/')
318 break;
319 else
320 ifs.putback(commentToken[1]);
321 }
322 }
323 continue;
324 }
325 // line comment
326 else if (commentToken[1] == '/')
327 {
328 std::string str;
329 getline(ifs, str);
330 continue;
331 }
332 // regular data
333 else
334 {
335 ifs.putback(commentToken[1]);
336 }
337 }
338
339 parsedStream.put(commentToken[0]);
340 }
341
342 ifs.close();
343
344 uint32 opcode;
345 parsedStream >> opcode;
346
347 WorldPacket data(opcode, 0);
348
349 while (!parsedStream.eof())
350 {
351 std::string type;
352 parsedStream >> type;
353
354 if (type.empty())
355 break;
356
357 if (type == "uint8")
358 {
359 uint16 val1;
360 parsedStream >> val1;
361 data << uint8(val1);
362 }
363 else if (type == "uint16")
364 {
365 uint16 val2;
366 parsedStream >> val2;
367 data << val2;
368 }
369 else if (type == "uint32")
370 {
371 uint32 val3;
372 parsedStream >> val3;
373 data << val3;
374 }
375 else if (type == "uint64")
376 {
377 uint64 val4;
378 parsedStream >> val4;
379 data << val4;
380 }
381 else if (type == "float")
382 {
383 float val5;
384 parsedStream >> val5;
385 data << val5;
386 }
387 else if (type == "string")
388 {
389 std::string val6;
390 parsedStream >> val6;
391 data << val6;
392 }
393 else if (type == "appitsguid")
394 {
395 data << unit->GetPackGUID();
396 }
397 else if (type == "appmyguid")
398 {
399 data << player->GetPackGUID();
400 }
401 else if (type == "appgoguid")
402 {
403 GameObject* obj = handler->GetNearbyGameObject();
404 if (!obj)
405 {
407 ifs.close();
408 return false;
409 }
410 data << obj->GetPackGUID();
411 }
412 else if (type == "goguid")
413 {
414 GameObject* obj = handler->GetNearbyGameObject();
415 if (!obj)
416 {
418 ifs.close();
419 return false;
420 }
421 data << obj->GetGUID();
422 }
423 else if (type == "myguid")
424 {
425 data << player->GetGUID();
426 }
427 else if (type == "itsguid")
428 {
429 data << unit->GetGUID();
430 }
431 else if (type == "itspos")
432 {
433 data << unit->GetPositionX();
434 data << unit->GetPositionY();
435 data << unit->GetPositionZ();
436 }
437 else if (type == "mypos")
438 {
439 data << player->GetPositionX();
440 data << player->GetPositionY();
441 data << player->GetPositionZ();
442 }
443 else
444 {
445 LOG_ERROR("network.opcode", "Sending opcode that has unknown type '{}'", type);
446 break;
447 }
448 }
449
450 data.hexlike();
451 player->SendDirectMessage(&data);
452 handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName());
453 return true;
454 }
@ LANG_COMMAND_OBJNOTFOUND
Definition Language.h:323
@ LANG_COMMAND_OPCODESENT
Definition Language.h:519
@ LANG_DEBUG_OPCODE_FILE_MISSING
Definition Language.h:1402
#define LOG_ERROR(filterType__,...)
Definition Log.h:158
GameObject * GetNearbyGameObject() const
Definition Chat.cpp:565
bool IsPlayer() const
Definition Object.h:201
PackedGuid const & GetPackGUID() const
Definition Object.h:116
Player * ToPlayer()
Definition Object.h:202
float GetPositionZ() const
Definition Position.h:123

References Object::GetGUID(), WorldObject::GetName(), ChatHandler::GetNearbyGameObject(), WorldPacket::GetOpcode(), Object::GetPackGUID(), WorldSession::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), ByteBuffer::hexlike(), Object::IsPlayer(), LANG_COMMAND_OBJNOTFOUND, LANG_COMMAND_OPCODESENT, LANG_DEBUG_OPCODE_FILE_MISSING, LOG_ERROR, ChatHandler::PSendSysMessage(), Player::SendDirectMessage(), ChatHandler::SendErrorMessage(), and Object::ToPlayer().

Referenced by GetCommands().

◆ HandleDebugSendQuestInvalidMsgCommand()

static bool debug_commandscript::HandleDebugSendQuestInvalidMsgCommand ( ChatHandler handler,
QuestFailedReason  msg 
)
inlinestatic
517 {
518 handler->GetPlayer()->SendCanTakeQuestResponse(msg);
519 return true;
520 }
void SendCanTakeQuestResponse(uint32 msg) const
Definition PlayerQuest.cpp:2437

References ChatHandler::GetPlayer(), and Player::SendCanTakeQuestResponse().

Referenced by GetCommands().

◆ HandleDebugSendQuestPartyMsgCommand()

static bool debug_commandscript::HandleDebugSendQuestPartyMsgCommand ( ChatHandler handler,
QuestShareMessages  msg 
)
inlinestatic
499 {
500 handler->GetPlayer()->SendPushToPartyResponse(handler->GetPlayer(), msg);
501 return true;
502 }
void SendPushToPartyResponse(Player const *player, uint8 msg) const
Definition PlayerQuest.cpp:2467

References ChatHandler::GetPlayer(), and Player::SendPushToPartyResponse().

Referenced by GetCommands().

◆ HandleDebugSendSellErrorCommand()

static bool debug_commandscript::HandleDebugSendSellErrorCommand ( ChatHandler handler,
SellResult  error 
)
inlinestatic
262 {
263 handler->GetPlayer()->SendSellError(SellResult(error), nullptr, ObjectGuid::Empty, 0);
264 return true;
265 }
SellResult
Definition Item.h:154
static ObjectGuid const Empty
Definition ObjectGuid.h:120
void SendSellError(SellResult msg, Creature *creature, ObjectGuid guid, uint32 param)
Definition PlayerStorage.cpp:4143

References ObjectGuid::Empty, ChatHandler::GetPlayer(), and Player::SendSellError().

Referenced by GetCommands().

◆ HandleDebugSendSetPhaseShiftCommand()

static bool debug_commandscript::HandleDebugSendSetPhaseShiftCommand ( ChatHandler handler,
uint32  phaseShift 
)
inlinestatic
1148 {
1149 handler->GetSession()->SendSetPhaseShift(phaseShift);
1150 return true;
1151 }
void SendSetPhaseShift(uint32 phaseShift)
Definition MiscHandler.cpp:1628

References ChatHandler::GetSession(), and WorldSession::SendSetPhaseShift().

Referenced by GetCommands().

◆ HandleDebugSendSpellFailCommand()

static bool debug_commandscript::HandleDebugSendSpellFailCommand ( ChatHandler handler,
SpellCastResult  result,
Optional< uint32 failArg1,
Optional< uint32 failArg2 
)
inlinestatic
235 {
237 data << uint8(0);
238 data << uint32(133); // Spell "Fireball"
239 data << uint8(result);
240
241 if (failArg1 || failArg2)
242 {
243 data << uint32(failArg1.value_or(0));
244 }
245
246 if (failArg2)
247 {
248 data << uint32(*failArg2);
249 }
250
251 handler->GetSession()->SendPacket(&data);
252 return true;
253 }
@ SMSG_CAST_FAILED
Definition Opcodes.h:334

References ChatHandler::GetSession(), WorldSession::SendPacket(), and SMSG_CAST_FAILED.

Referenced by GetCommands().

◆ HandleDebugSet32BitCommand()

static bool debug_commandscript::HandleDebugSet32BitCommand ( ChatHandler handler,
uint32  index,
uint8  bit 
)
inlinestatic
1359 {
1360 WorldObject* target = handler->getSelectedObject();
1361 if (!target)
1362 {
1364 return false;
1365 }
1366
1367 if (bit > 32) // uint32 = 32 bits
1368 return false;
1369
1370 uint32 value = bit ? 1 << (bit - 1) : 0;
1371 target->SetUInt32Value(index, value);
1372
1373 handler->PSendSysMessage(LANG_SET_32BIT_FIELD, index, value);
1374 return true;
1375 }
@ LANG_SET_32BIT_FIELD
Definition Language.h:637
WorldObject * getSelectedObject() const
Definition Chat.cpp:397
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:639
Definition Object.h:475

References ChatHandler::getSelectedObject(), LANG_SELECT_CHAR_OR_CREATURE, LANG_SET_32BIT_FIELD, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and Object::SetUInt32Value().

Referenced by GetCommands().

◆ HandleDebugSetAuraStateCommand()

static bool debug_commandscript::HandleDebugSetAuraStateCommand ( ChatHandler handler,
Optional< AuraStateType state,
bool  apply 
)
inlinestatic
1225 {
1226 Unit* unit = handler->getSelectedUnit();
1227 if (!unit)
1228 {
1230 return false;
1231 }
1232
1233 if (!state)
1234 {
1235 // reset all states
1236 for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
1237 unit->ModifyAuraState(s, false);
1238 return true;
1239 }
1240
1241 unit->ModifyAuraState(*state, apply);
1242 return true;
1243 }
AuraStateType
Definition SharedDefines.h:1276
Definition SmartEnum.h:47
void ModifyAuraState(AuraStateType flag, bool apply)
Definition Unit.cpp:7579

References ChatHandler::getSelectedUnit(), LANG_SELECT_CHAR_OR_CREATURE, Unit::ModifyAuraState(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleDebugSetItemValueCommand()

static bool debug_commandscript::HandleDebugSetItemValueCommand ( ChatHandler handler,
ObjectGuid::LowType  guid,
uint32  index,
uint32  value 
)
inlinestatic
1171 {
1172 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
1173
1174 if (!i)
1175 return false;
1176
1177 if (index >= i->GetValuesCount())
1178 return false;
1179
1180 i->SetUInt32Value(index, value);
1181
1182 return true;
1183 }

References Player::GetItemByGuid(), ChatHandler::GetPlayer(), Object::GetValuesCount(), Item, and Object::SetUInt32Value().

Referenced by GetCommands().

◆ HandleDebugSetValueCommand()

static bool debug_commandscript::HandleDebugSetValueCommand ( ChatHandler handler,
uint32  index,
Variant< uint32, float >  value 
)
inlinestatic
1246 {
1247 WorldObject* target = handler->getSelectedObject();
1248 if (!target)
1249 {
1251 return false;
1252 }
1253
1254 if (index >= target->GetValuesCount())
1255 {
1256 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, target->GetGUID().ToString(), target->GetValuesCount());
1257 return false;
1258 }
1259
1260 if (value.holds_alternative<uint32>())
1261 {
1262 target->SetUInt32Value(index, value.get<uint32>());
1263 handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().ToString(), uint32(index), uint32(value));
1264 }
1265 else if (value.holds_alternative<float>())
1266 {
1267 target->SetFloatValue(index, value.get<float>());
1268 handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().ToString(), static_cast<float>(index), uint32(value));
1269 }
1270
1271 return true;
1272 }
@ LANG_SET_UINT_FIELD
Definition Language.h:629
@ LANG_SET_FLOAT_FIELD
Definition Language.h:631
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:726
constexpr decltype(auto) get()
Definition ChatCommandTags.h:284
constexpr bool holds_alternative() const
Definition ChatCommandTags.h:298

References Acore::ChatCommands::Variant< T1, Ts >::get(), Object::GetGUID(), ChatHandler::getSelectedObject(), Object::GetValuesCount(), Acore::ChatCommands::Variant< T1, Ts >::holds_alternative(), LANG_SELECT_CHAR_OR_CREATURE, LANG_SET_FLOAT_FIELD, LANG_SET_UINT_FIELD, LANG_TOO_BIG_INDEX, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), Object::SetFloatValue(), Object::SetUInt32Value(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugSetVehicleIdCommand()

static bool debug_commandscript::HandleDebugSetVehicleIdCommand ( ChatHandler handler,
uint32  id 
)
inlinestatic
1065 {
1066 Unit* target = handler->getSelectedUnit();
1067 if (!target || target->IsVehicle())
1068 return false;
1069
1070 //target->SetVehicleId(id);
1071 handler->PSendSysMessage("Vehicle id set to {}", id);
1072 return true;
1073 }

References ChatHandler::getSelectedUnit(), Unit::IsVehicle(), and ChatHandler::PSendSysMessage().

Referenced by GetCommands().

◆ HandleDebugSpawnVehicleCommand()

static bool debug_commandscript::HandleDebugSpawnVehicleCommand ( ChatHandler handler,
uint32  entry,
Optional< uint32 id 
)
inlinestatic
1104 {
1105 float x, y, z, o = handler->GetPlayer()->GetOrientation();
1106 handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
1107
1108 if (!id)
1109 return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
1110
1111 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
1112
1113 if (!ci)
1114 return false;
1115
1116 VehicleEntry const* ve = sVehicleStore.LookupEntry(*id);
1117
1118 if (!ve)
1119 return false;
1120
1121 Creature* v = new Creature();
1122
1123 Map* map = handler->GetPlayer()->GetMap();
1124
1125 if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, *id, x, y, z, o))
1126 {
1127 delete v;
1128 return false;
1129 }
1130
1131 map->AddToMap(v->ToCreature());
1132
1133 return true;
1134 }
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData *data=nullptr)
Definition Creature.cpp:1126
ObjectGuid::LowType GenerateLowGuid()
Definition Map.h:480
bool AddToMap(T *, bool checkTransport=false)
Definition Map.cpp:303
float GetCombatReach() const override
Definition Unit.h:877
uint32 GetPhaseMask() const
Definition Object.h:516
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition Object.cpp:2394
bool GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
Definition Object.cpp:2766
float GetOrientation() const
Definition Position.h:124
Definition DBCStructure.h:2027

References Map::AddToMap(), Creature::Create(), Map::GenerateLowGuid(), WorldObject::GetClosePoint(), Unit::GetCombatReach(), WorldObject::GetMap(), Position::GetOrientation(), WorldObject::GetPhaseMask(), ChatHandler::GetPlayer(), WorldSession::GetPlayer(), ChatHandler::GetSession(), sObjectMgr, WorldObject::SummonCreature(), sVehicleStore, Object::ToCreature(), and Vehicle.

Referenced by GetCommands().

◆ HandleDebugThreatInfoCommand()

static bool debug_commandscript::HandleDebugThreatInfoCommand ( ChatHandler handler)
inlinestatic
919 {
920 Unit* target = handler->getSelectedUnit();
921 if (!target)
922 {
924 handler->SetSentErrorMessage(true);
925 return false;
926 }
927
928 handler->PSendSysMessage("Threat info for {} ({}):", target->GetName(), target->GetGUID().ToString());
929
930 ThreatManager const& mgr = target->GetThreatMgr();
931
932 // _singleSchoolModifiers
933 {
934 auto& mods = mgr._singleSchoolModifiers;
935 handler->SendSysMessage(" - Single-school threat modifiers:");
936 handler->PSendSysMessage(" |-- Physical: {:.2f}%", mods[SPELL_SCHOOL_NORMAL] * 100.0f);
937 handler->PSendSysMessage(" |-- Holy : {:.2f}%", mods[SPELL_SCHOOL_HOLY] * 100.0f);
938 handler->PSendSysMessage(" |-- Fire : {:.2f}%", mods[SPELL_SCHOOL_FIRE] * 100.0f);
939 handler->PSendSysMessage(" |-- Nature : {:.2f}%", mods[SPELL_SCHOOL_NATURE] * 100.0f);
940 handler->PSendSysMessage(" |-- Frost : {:.2f}%", mods[SPELL_SCHOOL_FROST] * 100.0f);
941 handler->PSendSysMessage(" |-- Shadow : {:.2f}%", mods[SPELL_SCHOOL_SHADOW] * 100.0f);
942 handler->PSendSysMessage(" |-- Arcane : {:.2f}%", mods[SPELL_SCHOOL_ARCANE] * 100.0f);
943 }
944
945 // _multiSchoolModifiers
946 {
947 auto& mods = mgr._multiSchoolModifiers;
948 handler->PSendSysMessage(" - Multi-school threat modifiers ({} entries):", mods.size());
949 for (auto const& pair : mods)
950 handler->PSendSysMessage(" |-- Mask 0x{:x}: {:.2f}%", uint32(pair.first), pair.second * 100.0f);
951 }
952
953 // _redirectInfo
954 {
955 auto const& redirectInfo = mgr._redirectInfo;
956 if (redirectInfo.empty())
957 handler->SendSysMessage(" - No redirects being applied");
958 else
959 {
960 handler->PSendSysMessage(" - {:02} redirects being applied:", redirectInfo.size());
961 for (auto const& pair : redirectInfo)
962 {
963 Unit* unit = ObjectAccessor::GetUnit(*target, pair.first);
964 handler->PSendSysMessage(" |-- {:02}% to {}", pair.second, unit ? unit->GetName() : pair.first.ToString());
965 }
966 }
967 }
968
969 // _redirectRegistry
970 {
971 auto const& redirectRegistry = mgr._redirectRegistry;
972 if (redirectRegistry.empty())
973 handler->SendSysMessage(" - No redirects are registered");
974 else
975 {
976 handler->PSendSysMessage(" - {:02} spells may have redirects registered", redirectRegistry.size());
977 for (auto const& outerPair : redirectRegistry)
978 {
979 SpellInfo const* const spell = sSpellMgr->GetSpellInfo(outerPair.first);
980 handler->PSendSysMessage(" |-- #{:06} {} ({} entries):", outerPair.first, spell ? spell->SpellName[0] : "<unknown>", outerPair.second.size());
981 for (auto const& innerPair : outerPair.second)
982 {
983 Unit* unit = ObjectAccessor::GetUnit(*target, innerPair.first);
984 handler->PSendSysMessage(" |-- {:02}% to {}", innerPair.second, unit ? unit->GetName() : innerPair.first.ToString());
985 }
986 }
987 }
988 }
989
990 return true;
991 }
@ SPELL_SCHOOL_SHADOW
Definition SharedDefines.h:276
@ SPELL_SCHOOL_NORMAL
Definition SharedDefines.h:271
@ SPELL_SCHOOL_NATURE
Definition SharedDefines.h:274
@ SPELL_SCHOOL_FROST
Definition SharedDefines.h:275
@ SPELL_SCHOOL_ARCANE
Definition SharedDefines.h:277
@ SPELL_SCHOOL_FIRE
Definition SharedDefines.h:273
@ SPELL_SCHOOL_HOLY
Definition SharedDefines.h:272
void SetSentErrorMessage(bool val)
Definition Chat.h:238
Definition SpellInfo.h:340
std::array< char const *, 16 > SpellName
Definition SpellInfo.h:407
Definition ThreatManager.h:90
std::vector< std::pair< ObjectGuid, uint32 > > _redirectInfo
Definition ThreatManager.h:233
std::array< float, MAX_SPELL_SCHOOL > _singleSchoolModifiers
Definition ThreatManager.h:229
std::unordered_map< uint32, std::unordered_map< ObjectGuid, uint32 > > _redirectRegistry
Definition ThreatManager.h:234
std::unordered_map< std::underlying_type< SpellSchoolMask >::type, float > _multiSchoolModifiers
Definition ThreatManager.h:230
ThreatManager & GetThreatMgr()
Definition Unit.h:951
std::string ToString(Type &&val, Params &&... params)
Definition StringConvert.h:250
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:199

References ThreatManager::_multiSchoolModifiers, ThreatManager::_redirectInfo, ThreatManager::_redirectRegistry, ThreatManager::_singleSchoolModifiers, Object::GetGUID(), WorldObject::GetName(), ChatHandler::getSelectedUnit(), Unit::GetThreatMgr(), ObjectAccessor::GetUnit(), LANG_SELECT_CHAR_OR_CREATURE, ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), ChatHandler::SetSentErrorMessage(), SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, SpellInfo::SpellName, sSpellMgr, and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugThreatListCommand()

static bool debug_commandscript::HandleDebugThreatListCommand ( ChatHandler handler)
inlinestatic
833 {
834 Unit* target = handler->getSelectedUnit();
835 if (!target)
836 target = handler->GetPlayer();
837
838 ThreatManager& mgr = target->GetThreatMgr();
839 if (!target->IsAlive())
840 {
841 handler->PSendSysMessage("{} ({}) is not alive.{}", target->GetName(), target->GetGUID().ToString(), target->IsEngaged() ? " (It is, however, engaged. Huh?)" : "");
842 return true;
843 }
844
845 uint32 count = 0;
846 auto const& threatenedByMe = target->GetThreatMgr().GetThreatenedByMeList();
847 if (threatenedByMe.empty())
848 handler->PSendSysMessage("{} ({}) does not threaten any units.", target->GetName(), target->GetGUID().ToString());
849 else
850 {
851 handler->PSendSysMessage("List of units threatened by {} ({})", target->GetName(), target->GetGUID().ToString());
852 for (auto const& pair : threatenedByMe)
853 {
854 Unit* unit = pair.second->GetOwner();
855 handler->PSendSysMessage(" {}. {} ({}, SpawnID {}) - threat {}", ++count, unit->GetName(), unit->GetGUID().ToString(), unit->IsCreature() ? unit->ToCreature()->GetSpawnId() : 0, pair.second->GetThreat());
856 }
857 handler->SendSysMessage("End of threatened-by-me list.");
858 }
859
860 if (mgr.CanHaveThreatList())
861 {
862 if (!mgr.IsThreatListEmpty(true))
863 {
864 if (target->IsEngaged())
865 handler->PSendSysMessage("Threat list of {} ({}, SpawnID {}):", target->GetName(), target->GetGUID().ToString(), target->IsCreature() ? target->ToCreature()->GetSpawnId() : 0);
866 else
867 handler->PSendSysMessage("{} ({}, SpawnID {}) is not engaged, but still has a threat list? Well, here it is:", target->GetName(), target->GetGUID().ToString(), target->IsCreature() ? target->ToCreature()->GetSpawnId() : 0);
868
869 count = 0;
870 Unit* fixateVictim = mgr.GetFixateTarget();
871 for (ThreatReference const* ref : mgr.GetSortedThreatList())
872 {
873 Unit* unit = ref->GetVictim();
874 char const* onlineStr;
875 switch (ref->GetOnlineState())
876 {
878 onlineStr = " [SUPPRESSED]";
879 break;
881 onlineStr = " [OFFLINE]";
882 break;
883 default:
884 onlineStr = "";
885 }
886 char const* tauntStr;
887 if (unit == fixateVictim)
888 tauntStr = " [FIXATE]";
889 else
890 switch (ref->GetTauntState())
891 {
893 tauntStr = " [TAUNT]";
894 break;
896 tauntStr = " [DETAUNT]";
897 break;
898 default:
899 tauntStr = "";
900 }
901 handler->PSendSysMessage(" {}. {} ({}) - threat {}{}{}", ++count, unit->GetName(), unit->GetGUID().ToString(), ref->GetThreat(), tauntStr, onlineStr);
902 }
903 handler->SendSysMessage("End of threat list.");
904 }
905 else if (!target->IsEngaged())
906 handler->PSendSysMessage("{} ({}, SpawnID {}) is not currently engaged.", target->GetName(), target->GetGUID().ToString(), target->IsCreature() ? target->ToCreature()->GetSpawnId() : 0);
907 else
908 handler->PSendSysMessage("{} ({}, SpawnID {}) seems to be engaged, but does not have a threat list??", target->GetName(), target->GetGUID().ToString(), target->IsCreature() ? target->ToCreature()->GetSpawnId() : 0);
909 }
910 else if (target->IsEngaged())
911 handler->PSendSysMessage("{} ({}) is currently engaged. (This unit cannot have a threat list.)", target->GetName(), target->GetGUID().ToString());
912 else
913 handler->PSendSysMessage("{} ({}) is not currently engaged. (This unit cannot have a threat list.)", target->GetName(), target->GetGUID().ToString());
914
915 return true;
916 }
auto const & GetThreatenedByMeList() const
Definition ThreatManager.h:141
bool IsThreatListEmpty(bool includeOffline=false) const
Definition ThreatManager.cpp:267
static bool CanHaveThreatList(Unit const *who)
Definition ThreatManager.cpp:189
Unit * GetFixateTarget() const
Definition ThreatManager.cpp:605
@ ONLINE_STATE_OFFLINE
Definition ThreatManager.h:270
@ ONLINE_STATE_SUPPRESSED
Definition ThreatManager.h:270
@ TAUNT_STATE_DETAUNT
Definition ThreatManager.h:269
@ TAUNT_STATE_TAUNT
Definition ThreatManager.h:269
Unit * GetOwner() const
Definition Unit.cpp:7682
bool IsAlive() const
Definition Unit.h:1793
Unit * GetVictim() const
Definition Unit.h:903
virtual bool IsEngaged() const
Definition Unit.h:931

References ThreatManager::CanHaveThreatList(), ThreatManager::GetFixateTarget(), Object::GetGUID(), WorldObject::GetName(), Unit::GetOwner(), ChatHandler::GetPlayer(), ChatHandler::getSelectedUnit(), ThreatManager::GetSortedThreatList(), Creature::GetSpawnId(), ThreatManager::GetThreatenedByMeList(), Unit::GetThreatMgr(), Unit::GetVictim(), Unit::IsAlive(), Object::IsCreature(), Unit::IsEngaged(), ThreatManager::IsThreatListEmpty(), ThreatReference::ONLINE_STATE_OFFLINE, ThreatReference::ONLINE_STATE_SUPPRESSED, ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), ThreatReference::TAUNT_STATE_DETAUNT, ThreatReference::TAUNT_STATE_TAUNT, Object::ToCreature(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugUnitStateCommand()

static bool debug_commandscript::HandleDebugUnitStateCommand ( ChatHandler handler,
uint32  unitState 
)
inlinestatic
1434 {
1435 Unit* target = handler->getSelectedUnit();
1436 if (!target)
1437 target = handler->GetSession()->GetPlayer();
1438
1439 target->ClearUnitState(target->GetUnitState());
1440 target->AddUnitState(unitState);
1441
1442 return true;
1443 }
void ClearUnitState(uint32 f)
Definition Unit.h:737
uint32 GetUnitState() const
Definition Unit.h:738
void AddUnitState(uint32 f)
Definition Unit.h:735

References Unit::AddUnitState(), Unit::ClearUnitState(), WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), and Unit::GetUnitState().

Referenced by GetCommands().

◆ HandleDebugUpdateCommand()

static bool debug_commandscript::HandleDebugUpdateCommand ( ChatHandler handler,
uint32  index,
Optional< uint32 value 
)
inlinestatic
1324 {
1325 Unit* unit = handler->getSelectedUnit();
1326 if (!unit)
1327 {
1329 return false;
1330 }
1331
1332 if (!index)
1333 return true;
1334
1335 // check index
1336 if (unit->IsPlayer())
1337 {
1338 if (index >= PLAYER_END)
1339 return true;
1340 }
1341 else if (index >= UNIT_END)
1342 return true;
1343
1344 if (!value)
1345 {
1346 value = unit->GetUInt32Value(index);
1347
1348 handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().ToString(), index, *value);
1349 return true;
1350 }
1351
1352 unit->SetUInt32Value(index, *value);
1353
1354 handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().ToString(), index, *value);
1355 return true;
1356 }
@ LANG_UPDATE_CHANGE
Definition Language.h:626
@ LANG_UPDATE
Definition Language.h:625
@ UNIT_END
Definition UpdateFields.h:175
@ PLAYER_END
Definition UpdateFields.h:392

References Object::GetGUID(), ChatHandler::getSelectedUnit(), Object::GetUInt32Value(), Object::IsPlayer(), LANG_SELECT_CHAR_OR_CREATURE, LANG_UPDATE, LANG_UPDATE_CHANGE, PLAYER_END, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), Unit::SetUInt32Value(), ObjectGuid::ToString(), and UNIT_END.

Referenced by GetCommands().

◆ HandleDebugUpdateWorldStateCommand()

static bool debug_commandscript::HandleDebugUpdateWorldStateCommand ( ChatHandler handler,
uint32  variable,
uint32  value 
)
inlinestatic
457 {
458 handler->GetPlayer()->SendUpdateWorldState(variable, value);
459 return true;
460 }
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition PlayerUpdates.cpp:2235

References ChatHandler::GetPlayer(), and Player::SendUpdateWorldState().

Referenced by GetCommands().

◆ HandleDebugVisibilityDataCommand()

static bool debug_commandscript::HandleDebugVisibilityDataCommand ( ChatHandler handler)
inlinestatic
1585 {
1586 Player* player = handler->GetPlayer();
1587 if (!player)
1588 return false;
1589
1590 std::array<uint32, NUM_CLIENT_OBJECT_TYPES> objectByTypeCount = {};
1591
1592 ObjectVisibilityContainer const& objectVisibilityContainer = player->GetObjectVisibilityContainer();
1593 for (auto const& kvPair : *objectVisibilityContainer.GetVisibleWorldObjectsMap())
1594 {
1595 WorldObject const* obj = kvPair.second;
1596 ++objectByTypeCount[obj->GetTypeId()];
1597 }
1598
1599 uint32 zoneWideVisibleObjectsInZone = 0;
1600 if (ZoneWideVisibleWorldObjectsSet const* farVisibleSet = player->GetMap()->GetZoneWideVisibleWorldObjectsForZone(player->GetZoneId()))
1601 zoneWideVisibleObjectsInZone = farVisibleSet->size();
1602
1603 handler->PSendSysMessage("Visibility Range: {}", player->GetVisibilityRange());
1604 handler->PSendSysMessage("Visible Creatures: {}", objectByTypeCount[TYPEID_UNIT]);
1605 handler->PSendSysMessage("Visible Players: {}", objectByTypeCount[TYPEID_PLAYER]);
1606 handler->PSendSysMessage("Visible GameObjects: {}", objectByTypeCount[TYPEID_GAMEOBJECT]);
1607 handler->PSendSysMessage("Visible DynamicObjects: {}", objectByTypeCount[TYPEID_DYNAMICOBJECT]);
1608 handler->PSendSysMessage("Visible Corpses: {}", objectByTypeCount[TYPEID_CORPSE]);
1609 handler->PSendSysMessage("Players we are visible to: {}", objectVisibilityContainer.GetVisiblePlayersMap().size());
1610 handler->PSendSysMessage("Zone wide visible objects in zone: {}", zoneWideVisibleObjectsInZone);
1611 return true;
1612 }
std::unordered_set< WorldObject * > ZoneWideVisibleWorldObjectsSet
Definition Map.h:154
@ TYPEID_DYNAMICOBJECT
Definition ObjectGuid.h:38
@ TYPEID_GAMEOBJECT
Definition ObjectGuid.h:37
@ TYPEID_UNIT
Definition ObjectGuid.h:35
@ TYPEID_CORPSE
Definition ObjectGuid.h:39
@ TYPEID_PLAYER
Definition ObjectGuid.h:36
ZoneWideVisibleWorldObjectsSet const * GetZoneWideVisibleWorldObjectsForZone(uint32 zoneId) const
Definition Map.cpp:669
Definition ObjectVisibilityContainer.h:34
VisiblePlayersMap & GetVisiblePlayersMap()
Definition ObjectVisibilityContainer.h:54
TypeID GetTypeId() const
Definition Object.h:129
float GetVisibilityRange() const
Definition Object.cpp:1701
ObjectVisibilityContainer & GetObjectVisibilityContainer()
Definition Object.h:731
uint32 GetZoneId() const
Definition Object.cpp:3112

References WorldObject::GetMap(), WorldObject::GetObjectVisibilityContainer(), ChatHandler::GetPlayer(), Object::GetTypeId(), WorldObject::GetVisibilityRange(), ObjectVisibilityContainer::GetVisiblePlayersMap(), ObjectVisibilityContainer::GetVisibleWorldObjectsMap(), WorldObject::GetZoneId(), Map::GetZoneWideVisibleWorldObjectsForZone(), ChatHandler::PSendSysMessage(), TYPEID_CORPSE, TYPEID_DYNAMICOBJECT, TYPEID_GAMEOBJECT, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by GetCommands().

◆ HandleDebugVisualCommand()

static bool debug_commandscript::HandleDebugVisualCommand ( ChatHandler handler,
uint32  visualId 
)
inlinestatic
214 {
215 if (!visualId)
216 {
218 return false;
219 }
220
221 Player* player = handler->GetPlayer();
222 Unit* target = handler->getSelectedUnit();
223
224 if (!target)
225 {
226 player->SendPlaySpellVisual(visualId);
227 return true;
228 }
229
230 player->SendPlaySpellImpact(target->GetGUID(), visualId);
231 return true;
232 }
@ LANG_BAD_VALUE
Definition Language.h:148
void SendPlaySpellVisual(uint32 id)
Definition Unit.cpp:15136
void SendPlaySpellImpact(ObjectGuid guid, uint32 id)
Definition Unit.cpp:15144

References Object::GetGUID(), ChatHandler::GetPlayer(), ChatHandler::getSelectedUnit(), LANG_BAD_VALUE, ChatHandler::SendErrorMessage(), Unit::SendPlaySpellImpact(), and Unit::SendPlaySpellVisual().

Referenced by GetCommands().

◆ HandleDebugZoneStatsCommand()

static bool debug_commandscript::HandleDebugZoneStatsCommand ( ChatHandler handler,
Optional< PlayerIdentifier playerTarget 
)
inlinestatic
1615 {
1616 if (!playerTarget)
1617 playerTarget = PlayerIdentifier::FromTargetOrSelf(handler);
1618
1619 if (!playerTarget)
1620 {
1622 return false;
1623 }
1624
1625 Player* player = playerTarget->GetConnectedPlayer();
1626
1627 if (!player)
1628 {
1630 return false;
1631 }
1632
1633 uint32 zoneId = player->GetZoneId();
1634 AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
1635 handler->PSendSysMessage("Player count in zone {} ({}): {}.", zoneId, (zoneEntry ? zoneEntry->area_name[LOCALE_enUS] : "<unknown>"), player->GetMap()->GetPlayerCountInZone(zoneId));
1636 return true;
1637 }
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition ChatCommandTags.h:184
char const * area_name[16]
Definition DBCStructure.h:527

References AreaTableEntry::area_name, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), WorldObject::GetMap(), Map::GetPlayerCountInZone(), WorldObject::GetZoneId(), LANG_PLAYER_NOT_FOUND, LOCALE_enUS, ChatHandler::PSendSysMessage(), sAreaTableStore, and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleWPGPSCommand()

static bool debug_commandscript::HandleWPGPSCommand ( ChatHandler handler,
Optional< std::string >  type 
)
inlinestatic
1446 {
1447 Player* player = handler->GetSession()->GetPlayer();
1448
1449 if (!type)
1450 {
1451 // waypoint_data - id, point, X, Y, Z, O, delay, move_type, action, action_chance, wpguid
1452 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1453 }
1454
1455 if (type == "sai")
1456 {
1457 // waypoint (SAI) - entry, pointid, X, Y, Z, O, delay
1458 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1459 }
1460
1461 handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
1462 return true;
1463 }
#define LOG_INFO(filterType__,...)
Definition Log.h:166

References Position::GetOrientation(), WorldSession::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), ChatHandler::GetSession(), LOG_INFO, and ChatHandler::PSendSysMessage().

Referenced by GetCommands().


The documentation for this class was generated from the following file: