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
55: 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
1681 {
1682 loot.clear();
1683 loot.items.reserve(MAX_NR_LOOT_ITEMS);
1684 loot.quest_items.reserve(MAX_NR_QUEST_ITEMS);
1685 tab->Process(loot, store, LOOT_MODE_DEFAULT, player);
1686
1687 if (type == "creature")
1688 {
1689 if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(lootId))
1690 loot.generateMoneyLoot(ct->mingold, ct->maxgold);
1691 }
1692 else if (type == "gameobject")
1693 {
1694 if (GameObjectTemplateAddon const* addon = sObjectMgr->GetGameObjectTemplateAddon(lootId))
1695 loot.generateMoneyLoot(addon->mingold, addon->maxgold);
1696 }
1697 else if (type == "item")
1698 {
1699 if (ItemTemplate const* it = sObjectMgr->GetItemTemplate(lootId))
1700 loot.generateMoneyLoot(it->MinMoneyLoot, it->MaxMoneyLoot);
1701 }
1702 }
#define MAX_NR_QUEST_ITEMS
Definition LootMgr.h:53
#define MAX_NR_LOOT_ITEMS
Definition LootMgr.h:51
#define sObjectMgr
Definition ObjectMgr.h:1723
@ 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:808
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.

58 {
59 static ChatCommandTable debugPlayCommandTable =
60 {
66 };
67 static ChatCommandTable debugSendCommandTable =
68 {
71 { "chatmessage", HandleDebugSendChatMsgCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
80 };
81 static ChatCommandTable debugCommandTable =
82 {
85 { "threatinfo", HandleDebugThreatInfoCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
92 { "getitemstate", HandleDebugGetItemStateCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
95 { "getitemvalue", HandleDebugGetItemValueCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
96 { "Mod32Value", HandleDebugMod32ValueCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
97 { "play", debugPlayCommandTable },
98 { "send", debugSendCommandTable },
99 { "setaurastate", HandleDebugSetAuraStateCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
100 { "setitemvalue", HandleDebugSetItemValueCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
101 { "setvalue", HandleDebugSetValueCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
102 { "spawnvehicle", HandleDebugSpawnVehicleCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
104 { "entervehicle", HandleDebugEnterVehicleCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
107 { "itemexpire", HandleDebugItemExpireCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
108 { "areatriggers", HandleDebugAreaTriggersCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
112 { "moveflags", HandleDebugMoveflagsCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
113 { "unitstate", HandleDebugUnitStateCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
114 { "objectcount", HandleDebugObjectCountCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::Yes},
116 { "mapdata", HandleDebugMapDataCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
117 { "boundary", HandleDebugBoundaryCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
118 { "visibilitydata", HandleDebugVisibilityDataCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
119 { "factionchange", HandleDebugFactionChangeCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::Yes},
121 };
122 static ChatCommandTable commandTable =
123 {
124 { "debug", debugCommandTable },
125 { "wpgps", HandleWPGPSCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No }
126 };
127 return commandTable;
128 }
static bool HandleDebugSet32BitCommand(ChatHandler *handler, uint32 index, uint8 bit)
Definition cs_debug.cpp:1359
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, uint32 phaseShift)
Definition cs_debug.cpp:1148
static bool HandleDebugThreatListCommand(ChatHandler *handler)
Definition cs_debug.cpp:833
static bool HandleDebugGetItemStateCommand(ChatHandler *handler, std::string itemState)
Definition cs_debug.cpp:523
static bool HandleDebugGetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index)
Definition cs_debug.cpp:1154
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler)
Definition cs_debug.cpp:1137
static bool HandleDebugSetValueCommand(ChatHandler *handler, uint32 index, Variant< uint32, float > value)
Definition cs_debug.cpp:1246
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
Definition cs_debug.cpp:1378
static bool HandleWPGPSCommand(ChatHandler *handler, Optional< std::string > type)
Definition cs_debug.cpp:1446
static bool HandleDebugSendChatMsgCommand(ChatHandler *handler, ChatMsg type)
Definition cs_debug.cpp:491
static bool HandleDebugAreaTriggersCommand(ChatHandler *handler)
Definition cs_debug.cpp:463
static bool HandleDebugSendSellErrorCommand(ChatHandler *handler, SellResult error)
Definition cs_debug.cpp:262
static bool HandleDebugGetValueCommand(ChatHandler *handler, uint32 index, bool isInt)
Definition cs_debug.cpp:1275
static bool HandleDebugUpdateCommand(ChatHandler *handler, uint32 index, Optional< uint32 > value)
Definition cs_debug.cpp:1324
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, uint32 id)
Definition cs_debug.cpp:1065
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler)
Definition cs_debug.cpp:505
static bool HandleDebugLoSCommand(ChatHandler *handler)
Definition cs_debug.cpp:1210
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, uint32 movieId)
Definition cs_debug.cpp:158
static bool HandleDebugUnitStateCommand(ChatHandler *handler, uint32 unitState)
Definition cs_debug.cpp:1434
static bool HandleDebugVisibilityDataCommand(ChatHandler *handler)
Definition cs_debug.cpp:1585
static bool HandleDebugMapDataCommand(ChatHandler *handler)
Definition cs_debug.cpp:1550
static bool HandleDebugPlaySoundCommand(ChatHandler *handler, uint32 soundId)
Definition cs_debug.cpp:171
static bool HandleDebugDungeonFinderCommand(ChatHandler *)
Definition cs_debug.cpp:788
static bool HandleDebugSendOpcodeCommand(ChatHandler *handler)
Definition cs_debug.cpp:274
static bool HandleDebugDummyCommand(ChatHandler *handler)
Definition cs_debug.cpp:1544
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, InventoryResult error)
Definition cs_debug.cpp:256
static bool HandleDebugHostileRefListCommand(ChatHandler *handler)
Definition cs_debug.cpp:1014
static bool HandleDebugThreatInfoCommand(ChatHandler *handler)
Definition cs_debug.cpp:919
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, uint32 entry, Optional< uint32 > id)
Definition cs_debug.cpp:1104
static bool HandleDebugCooldownCommand(ChatHandler *handler, uint32 spell_id, uint32 end_time, Optional< uint32 > item_id)
Definition cs_debug.cpp:800
static bool HandleDebugPlayMusicCommand(ChatHandler *handler, uint32 musicId)
Definition cs_debug.cpp:198
static bool HandleDebugBattlegroundCommand(ChatHandler *)
Definition cs_debug.cpp:794
static bool HandleDebugSendBuyErrorCommand(ChatHandler *handler, BuyResult error)
Definition cs_debug.cpp:268
static bool HandleDebugBoundaryCommand(ChatHandler *handler, Optional< uint32 > durationArg, Optional< EXACT_SEQUENCE("fill")> fill, Optional< EXACT_SEQUENCE("z")> checkZ)
Definition cs_debug.cpp:1564
static bool HandleDebugLootCommand(ChatHandler *handler, std::string type, uint32 lootId, Optional< uint32 > count)
Definition cs_debug.cpp:1704
static bool HandleDebugObjectCountCommand(ChatHandler *handler, Optional< uint32 > mapId)
Definition cs_debug.cpp:1466
static bool HandleDebugSendChannelNotifyCommand(ChatHandler *handler, ChatNotify type)
Definition cs_debug.cpp:480
static bool HandleDebugCombatListCommand(ChatHandler *handler)
Definition cs_debug.cpp:994
static bool HandleDebugEnterVehicleCommand(ChatHandler *handler, uint32 entry, Optional< int8 > seatId)
Definition cs_debug.cpp:1076
static bool HandleDebugZoneStatsCommand(ChatHandler *handler, Optional< PlayerIdentifier > playerTarget)
Definition cs_debug.cpp:1615
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
Definition cs_debug.cpp:1171
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, uint32 index, uint32 value)
Definition cs_debug.cpp:1306
static bool HandleDebugItemExpireCommand(ChatHandler *handler, ObjectGuid::LowType guid)
Definition cs_debug.cpp:1186
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler *handler, QuestFailedReason msg)
Definition cs_debug.cpp:517
static bool HandleDebugFactionChangeCommand(ChatHandler *handler, Optional< PlayerIdentifier > playerTarget)
Definition cs_debug.cpp:1869
static bool HandleDebugPlayCinematicCommand(ChatHandler *handler, uint32 cinematicId)
Definition cs_debug.cpp:131
static bool HandleDebugVisualCommand(ChatHandler *handler, uint32 visualId)
Definition cs_debug.cpp:214
static bool HandleDebugUpdateWorldStateCommand(ChatHandler *handler, uint32 variable, uint32 value)
Definition cs_debug.cpp:457
static bool HandleDebugArenaCommand(ChatHandler *)
Definition cs_debug.cpp:827
static bool HandleDebugAnimCommand(ChatHandler *handler, Emote emote)
Definition cs_debug.cpp:1200
static bool HandleDebugSendSpellFailCommand(ChatHandler *handler, SpellCastResult result, Optional< uint32 > failArg1, Optional< uint32 > failArg2)
Definition cs_debug.cpp:235
static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler *handler, QuestShareMessages msg)
Definition cs_debug.cpp:499
static bool HandleDebugSetAuraStateCommand(ChatHandler *handler, Optional< AuraStateType > state, bool apply)
Definition cs_debug.cpp:1225
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:46
@ RBAC_PERM_COMMAND_DEBUG
Definition RBAC.h:193

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(), and rbac::RBAC_PERM_COMMAND_DEBUG.

◆ GetItemQualityName()

static char const * debug_commandscript::GetItemQualityName ( uint32  quality)
inlinestatic
1667 {
1668 static char const* const qualityNames[MAX_ITEM_QUALITY] =
1669 {
1670 "Poor", "Normal", "Uncommon", "Rare",
1671 "Epic", "Legendary", "Artifact", "Heirloom"
1672 };
1673
1674 if (quality < MAX_ITEM_QUALITY)
1675 return qualityNames[quality];
1676 return "Unknown";
1677 }
#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
1641 {
1642 if (type == "creature" || type == "skinning" || type == "pickpocketing")
1643 {
1644 if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(lootId))
1645 return ct->Name;
1646 }
1647 else if (type == "gameobject")
1648 {
1649 if (GameObjectTemplate const* gt = sObjectMgr->GetGameObjectTemplate(lootId))
1650 return gt->name;
1651 }
1652 else if (type == "item" || type == "disenchant" || type == "prospecting" || type == "milling")
1653 {
1654 if (ItemTemplate const* it = sObjectMgr->GetItemTemplate(lootId))
1655 return it->Name1;
1656 }
1657 else if (type == "fishing")
1658 {
1659 if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(lootId))
1660 return area->area_name[LOCALE_enUS];
1661 }
1662
1663 return "";
1664 }
@ 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
1201 {
1202 if (Unit* unit = handler->getSelectedUnit())
1203 unit->HandleEmoteCommand(emote);
1204
1205 handler->PSendSysMessage("Playing emote {}", EnumUtils::ToConstant(emote));
1206
1207 return true;
1208 }
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:219
Unit * getSelectedUnit() const
Definition Chat.cpp:394
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
464 {
465 Player* player = handler->GetSession()->GetPlayer();
466 if (!player->isDebugAreaTriggers)
467 {
469 player->isDebugAreaTriggers = true;
470 }
471 else
472 {
474 player->isDebugAreaTriggers = false;
475 }
476
477 return true;
478 }
@ LANG_DEBUG_AREATRIGGER_ON
Definition Language.h:994
@ LANG_DEBUG_AREATRIGGER_OFF
Definition Language.h:995
WorldSession * GetSession()
Definition Chat.h:242
Definition Player.h:1084
bool isDebugAreaTriggers
Definition Player.h:2598
Player * GetPlayer() const
Definition WorldSession.h:454

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
828 {
829 sBattlegroundMgr->ToggleArenaTesting();
830 return true;
831 }
#define sBattlegroundMgr
Definition BattlegroundMgr.h:187

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugBattlegroundCommand()

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

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
1565 {
1566 Player* player = handler->GetPlayer();
1567 if (!player)
1568 return false;
1569
1570 Creature* target = handler->getSelectedCreature();
1571 if (!target || !target->IsAIEnabled)
1572 return false;
1573
1574 uint32 duration = durationArg.value_or(5 * IN_MILLISECONDS);
1575 if (duration > 180 * IN_MILLISECONDS) // arbitrary upper limit
1576 duration = 180 * IN_MILLISECONDS;
1577
1578 int32 errMsg = target->AI()->VisualizeBoundary(duration, player, fill.has_value(), checkZ.has_value());
1579 if (errMsg > 0)
1580 handler->PSendSysMessage(errMsg);
1581
1582 return true;
1583 }
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:37
Creature * getSelectedCreature() const
Definition Chat.cpp:418
int32 VisualizeBoundary(uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
Definition CreatureAI.cpp:481
Definition Creature.h:47
CreatureAI * AI() const
Definition Creature.h:144
bool IsAIEnabled
Definition Unit.h:2098

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
995 {
996 Unit* target = handler->getSelectedUnit();
997 if (!target)
998 target = handler->GetPlayer();
999
1000 handler->PSendSysMessage("Combat refs: (Combat state: {} | Manager state: {})", target->IsInCombat(), target->GetCombatManager().HasCombat());
1001 for (auto const& ref : target->GetCombatManager().GetPvPCombatRefs())
1002 {
1003 Unit* unit = ref.second->GetOther(target);
1004 handler->PSendSysMessage("[PvP] {} (SpawnID {})", unit->GetName(), unit->IsCreature() ? unit->ToCreature()->GetSpawnId() : 0);
1005 }
1006 for (auto const& ref : target->GetCombatManager().GetPvECombatRefs())
1007 {
1008 Unit* unit = ref.second->GetOther(target);
1009 handler->PSendSysMessage("[PvE] {} (SpawnID {})", unit->GetName(), unit->IsCreature() ? unit->ToCreature()->GetSpawnId() : 0);
1010 }
1011 return true;
1012 }
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
801 {
802 Player* player = handler->GetPlayer();
803
804 if (!player || !spell_id || !end_time)
805 return false;
806
807 if (!sSpellMgr->GetSpellInfo(spell_id))
808 return false;
809
810 if (!item_id)
811 item_id = 0;
812 else if (!sItemStore.LookupEntry(*item_id))
813 return false;
814
815 if (end_time < player->GetSpellCooldownDelay(spell_id))
816 player->RemoveSpellCooldown(spell_id, true);
817
818 player->AddSpellCooldown(spell_id, *item_id, end_time, true, false);
819
820 WorldPacket data;
821 player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, end_time);
822 player->SendDirectMessage(&data);
823
824 return true;
825 }
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:5692
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11036
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3525
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition Unit.cpp:17027
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
1545 {
1546 handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing.");
1547 return true;
1548 }
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:168

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugDungeonFinderCommand()

static bool debug_commandscript::HandleDebugDungeonFinderCommand ( ChatHandler )
inlinestatic
789 {
790 sLFGMgr->ToggleTesting();
791 return true;
792 }
#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
1077 {
1078 Unit* target = handler->getSelectedUnit();
1079 if (!target || !target->IsVehicle())
1080 return false;
1081
1082 if (!seatId)
1083 seatId = -1;
1084
1085 if (!entry)
1086 handler->GetPlayer()->EnterVehicle(target, *seatId);
1087 else
1088 {
1089 Creature* passenger = nullptr;
1090 Acore::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
1091 Acore::CreatureSearcher<Acore::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
1092 Cell::VisitObjects(handler->GetPlayer(), searcher, 30.0f);
1093
1094 if (!passenger || passenger == target)
1095 return false;
1096
1097 passenger->EnterVehicle(target, *seatId);
1098 }
1099
1100 handler->PSendSysMessage("Unit {} entered vehicle {:d}", entry, *seatId);
1101 return true;
1102 }
Definition GridNotifiers.h:1473
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition Unit.cpp:15607
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
1870 {
1871 if (!playerTarget)
1872 playerTarget = PlayerIdentifier::FromTarget(handler);
1873
1874 if (!playerTarget)
1875 {
1877 return false;
1878 }
1879
1880 ObjectGuid guid = playerTarget->GetGUID();
1881 std::string name = playerTarget->GetName();
1882
1883 CharacterCacheEntry const* playerData = sCharacterCache->GetCharacterCacheByGuid(guid);
1884 if (!playerData)
1885 {
1887 return false;
1888 }
1889
1890 // Query at_login flags and money from the database (synchronous)
1892 stmt->SetData(0, guid.GetCounter());
1893 PreparedQueryResult result = CharacterDatabase.Query(stmt);
1894
1895 if (!result)
1896 {
1898 return false;
1899 }
1900
1901 Field* fields = result->Fetch();
1902 uint32 atLoginFlags = fields[0].Get<uint16>();
1903 uint32 money = fields[2].Get<uint32>();
1904
1905 // Header
1907
1908 // AT_LOGIN flags
1909 bool hasFactionFlag = (atLoginFlags & AT_LOGIN_CHANGE_FACTION) != 0;
1910 bool hasRaceFlag = (atLoginFlags & AT_LOGIN_CHANGE_RACE) != 0;
1911
1912 if (hasFactionFlag)
1914 if (hasRaceFlag)
1916 if (!hasFactionFlag && !hasRaceFlag)
1918
1919 // Faction-change-only checks (guild, arena captain, mail, auctions)
1920 if (hasFactionFlag)
1921 {
1922 // Guild check
1923 if (playerData->GuildId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
1924 {
1925 std::string guildName = sGuildMgr->GetGuildNameById(playerData->GuildId);
1927 }
1928 else
1930
1931 // Arena team captain check
1932 if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
1934 else
1936
1937 // Mail check
1938 if (playerData->MailCount)
1940 else
1942
1943 // Auction check - mirrors CharacterHandler.cpp logic
1944 // AH faction IDs: 0 = neutral, 12 = alliance, 29 = horde
1945 bool hasAuctions = false;
1946 for (uint8 i = 0; i < 2; ++i)
1947 {
1948 AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(
1949 i == 0 ? 0 : (((1 << (playerData->Race - 1)) & sRaceMgr->GetAllianceRaceMask()) ? 12 : 29));
1950
1951 for (auto const& [auID, Aentry] : auctionHouse->GetAuctions())
1952 {
1953 if (Aentry && (Aentry->owner == guid || Aentry->bidder == guid))
1954 {
1955 hasAuctions = true;
1956 break;
1957 }
1958 }
1959
1960 if (hasAuctions)
1961 break;
1962 }
1963
1964 if (hasAuctions)
1966 else
1968 }
1969 else
1970 {
1972 }
1973
1974 // Gold limit check
1975 uint32 maxMoney = sWorld->getIntConfig(CONFIG_CHANGE_FACTION_MAX_MONEY);
1976 if (maxMoney && money > maxMoney)
1977 handler->PSendSysMessage(LANG_DEBUG_FACTIONCHANGE_GOLD_FAIL, money, maxMoney);
1978 else if (maxMoney)
1979 handler->PSendSysMessage(LANG_DEBUG_FACTIONCHANGE_GOLD_OK, money, maxMoney);
1980 else
1982
1983 return true;
1984 }
#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:350
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:1446
@ LANG_DEBUG_FACTIONCHANGE_HEADER
Definition Language.h:1436
@ LANG_DEBUG_FACTIONCHANGE_NA
Definition Language.h:1451
@ LANG_DEBUG_FACTIONCHANGE_GOLD_FAIL
Definition Language.h:1448
@ LANG_DEBUG_FACTIONCHANGE_FLAG_RACE
Definition Language.h:1438
@ LANG_DEBUG_FACTIONCHANGE_MAIL_OK
Definition Language.h:1445
@ LANG_DEBUG_FACTIONCHANGE_ARENA_CAPTAIN_OK
Definition Language.h:1443
@ LANG_DEBUG_FACTIONCHANGE_ARENA_CAPTAIN_FAIL
Definition Language.h:1442
@ LANG_DEBUG_FACTIONCHANGE_GUILD_OK
Definition Language.h:1441
@ LANG_DEBUG_FACTIONCHANGE_FLAG_NONE
Definition Language.h:1439
@ LANG_DEBUG_FACTIONCHANGE_FLAG_FACTION
Definition Language.h:1437
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:548
@ LANG_DEBUG_FACTIONCHANGE_AUCTION_OK
Definition Language.h:1447
@ LANG_DEBUG_FACTIONCHANGE_MAIL_FAIL
Definition Language.h:1444
@ LANG_DEBUG_FACTIONCHANGE_GUILD_FAIL
Definition Language.h:1440
@ LANG_DEBUG_FACTIONCHANGE_GOLD_OK
Definition Language.h:1449
@ LANG_DEBUG_FACTIONCHANGE_GOLD_NOLIMIT
Definition Language.h:1450
@ 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:378
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD
Definition WorldConfig.h:35
Definition AuctionHouseMgr.h:127
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:224
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:317
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
524 {
526 bool listQueue = false;
527 bool checkAll = false;
528
529 if (itemState == "unchanged")
530 state = ITEM_UNCHANGED;
531 else if (itemState == "changed")
532 state = ITEM_CHANGED;
533 else if (itemState == "new")
534 state = ITEM_NEW;
535 else if (itemState == "removed")
536 state = ITEM_REMOVED;
537 else if (itemState == "queue")
538 listQueue = true;
539 else if (itemState == "check_all")
540 checkAll = true;
541 else
542 return false;
543
544 Player* player = handler->getSelectedPlayer();
545 if (!player)
546 player = handler->GetPlayer();
547
548 if (!listQueue && !checkAll)
549 {
550 itemState = "The player has the following " + itemState + " items: ";
551 handler->SendSysMessage(itemState.c_str());
552 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
553 {
554 if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
555 continue;
556
557 if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
558 {
559 if (Bag* bag = item->ToBag())
560 {
561 for (uint8 j = 0; j < bag->GetBagSize(); ++j)
562 if (Item* item2 = bag->GetItemByPos(j))
563 if (item2->GetState() == state)
564 handler->PSendSysMessage("bag: 255 slot: {} {} owner: {}", item2->GetSlot(), item2->GetGUID().ToString(), item2->GetOwnerGUID().ToString());
565 }
566 else if (item->GetState() == state)
567 handler->PSendSysMessage("bag: 255 slot: {} {} owner: {}", item->GetSlot(), item->GetGUID().ToString(), item->GetOwnerGUID().ToString());
568 }
569 }
570 }
571
572 if (listQueue)
573 {
574 auto const& updateQueue = player->GetItemUpdateQueue();
575
576 for (auto const& item : updateQueue)
577 {
578 Bag* container = item->GetContainer();
579 uint8 bagSlot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
580
581 std::string st;
582 switch (item->GetState())
583 {
584 case ITEM_UNCHANGED:
585 st = "unchanged";
586 break;
587 case ITEM_CHANGED:
588 st = "changed";
589 break;
590 case ITEM_NEW:
591 st = "new";
592 break;
593 case ITEM_REMOVED:
594 st = "removed";
595 break;
596 }
597
598 handler->PSendSysMessage("bag: {} slot: {} guid: {} - state: {}", bagSlot, item->GetSlot(), item->GetGUID().ToString(), st);
599 }
600
601 if (updateQueue.empty())
602 handler->PSendSysMessage("The player's updatequeue is empty");
603 }
604
605 if (checkAll)
606 {
607 bool error = false;
608 auto const& updateQueue = player->GetItemUpdateQueue();
609 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
610 {
611 if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
612 continue;
613
614 Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
615 if (!item)
616 continue;
617
618 if (item->GetSlot() != i)
619 {
620 handler->PSendSysMessage("Item with slot {} and guid {} has an incorrect slot value: {}", i, item->GetGUID().ToString(), item->GetSlot());
621 error = true;
622 continue;
623 }
624
625 if (item->GetOwnerGUID() != player->GetGUID())
626 {
627 handler->PSendSysMessage("The item with slot {} {} does have non-matching owner guid {} and {}!", item->GetSlot(), item->GetGUID().ToString(), item->GetOwnerGUID().ToString(), player->GetGUID().ToString());
628 error = true;
629 continue;
630 }
631
632 if (Bag* container = item->GetContainer())
633 {
634 handler->PSendSysMessage("The item with slot {} {} has a container (slot: {}, {}) but shouldn't!", item->GetSlot(), item->GetGUID().ToString(), container->GetSlot(), container->GetGUID().ToString());
635 error = true;
636 continue;
637 }
638
639 if (item->IsInUpdateQueue())
640 {
641 uint16 qp = item->GetQueuePos();
642 if (qp > updateQueue.size())
643 {
644 handler->PSendSysMessage("The item with slot {} and guid {} has its queuepos ({}) larger than the update queue size! ", item->GetSlot(), item->GetGUID().ToString(), qp);
645 error = true;
646 continue;
647 }
648
649 if (!updateQueue[qp])
650 {
651 handler->PSendSysMessage("The item with slot {} and guid {} has its queuepos ({}) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().ToString(), qp);
652 error = true;
653 continue;
654 }
655
656 if (updateQueue[qp] != item)
657 {
658 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());
659 error = true;
660 continue;
661 }
662 }
663 else if (item->GetState() != ITEM_UNCHANGED)
664 {
665 handler->PSendSysMessage("The item with slot {} and guid {} is not in queue but should be (state: {})!", item->GetSlot(), item->GetGUID().ToString(), item->GetState());
666 error = true;
667 continue;
668 }
669
670 if (Bag* bag = item->ToBag())
671 {
672 for (uint8 j = 0; j < bag->GetBagSize(); ++j)
673 {
674 Item* item2 = bag->GetItemByPos(j);
675 if (!item2)
676 continue;
677
678 if (item2->GetSlot() != j)
679 {
680 handler->PSendSysMessage("The item in bag {} and slot {} (guid: {}) has an incorrect slot value: {}", bag->GetSlot(), j, item2->GetGUID().ToString(), item2->GetSlot());
681 error = true;
682 continue;
683 }
684
685 if (item2->GetOwnerGUID() != player->GetGUID())
686 {
687 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());
688 error = true;
689 continue;
690 }
691
692 Bag* container = item2->GetContainer();
693 if (!container)
694 {
695 handler->PSendSysMessage("The item in bag {} at slot {} {} has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString());
696 error = true;
697 continue;
698 }
699
700 if (container != bag)
701 {
702 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());
703 error = true;
704 continue;
705 }
706
707 if (item2->IsInUpdateQueue())
708 {
709 uint16 qp = item2->GetQueuePos();
710 if (qp > updateQueue.size())
711 {
712 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);
713 error = true;
714 continue;
715 }
716
717 if (!updateQueue[qp])
718 {
719 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);
720 error = true;
721 continue;
722 }
723
724 if (updateQueue[qp] != item2)
725 {
726 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());
727 error = true;
728 continue;
729 }
730 }
731 else if (item2->GetState() != ITEM_UNCHANGED)
732 {
733 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());
734 error = true;
735 continue;
736 }
737 }
738 }
739 }
740
741 uint32 index = 0;
742
743 for (auto const& item : updateQueue)
744 {
745 index++;
746
747 if (item->GetOwnerGUID() != player->GetGUID())
748 {
749 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()));
750 error = true;
751 continue;
752 }
753
754 if (item->GetQueuePos() != index)
755 {
756 handler->SendSysMessage(Acore::StringFormat("queue({}): For the item {}, the queuepos doesn't match it's position in the queue!", index, item->GetGUID().ToString()));
757 error = true;
758 continue;
759 }
760
761 if (item->GetState() == ITEM_REMOVED)
762 continue;
763
764 Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
765
766 if (!test)
767 {
768 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()));
769 error = true;
770 continue;
771 }
772
773 if (test != item)
774 {
775 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()));
776 error = true;
777 continue;
778 }
779 }
780
781 if (!error)
782 handler->SendSysMessage("All OK!");
783 }
784
785 return true;
786 }
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:382
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:444
std::vector< Item * > & GetItemUpdateQueue()
Definition Player.h:1275
std::string StringFormat(FormatStringView 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
1155 {
1156 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
1157
1158 if (!i)
1159 return false;
1160
1161 if (index >= i->GetValuesCount())
1162 return false;
1163
1164 uint32 value = i->GetUInt32Value(index);
1165
1166 handler->PSendSysMessage("Item {}: value at {} is {}", guid, index, value);
1167
1168 return true;
1169 }
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:294
uint16 GetValuesCount() const
Definition Object.h:188
Item * GetItemByGuid(ObjectGuid guid) const
Definition PlayerStorage.cpp:410

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
506 {
507 Creature* target = handler->getSelectedCreature();
508 if (!target)
509 return false;
510
511 handler->PSendSysMessage("Loot recipient for creature {} (GUID {}, SpawnID {}) is {}",
512 target->GetName(), target->GetGUID().ToString(), target->GetSpawnId(),
513 target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient");
514 return true;
515 }
bool hasLootRecipient() const
Definition Creature.h:236
Player * GetLootRecipient() const
Definition Creature.cpp:1293

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
1276 {
1277 Unit* target = handler->getSelectedUnit();
1278 if (!target)
1279 {
1281 return false;
1282 }
1283
1284 ObjectGuid guid = target->GetGUID();
1285
1286 if (index >= target->GetValuesCount())
1287 {
1288 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, guid.ToString(), target->GetValuesCount());
1289 return false;
1290 }
1291
1292 if (isInt)
1293 {
1294 uint32 value = target->GetUInt32Value(index);
1295 handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.ToString(), index, value);
1296 }
1297 else
1298 {
1299 float value = target->GetFloatValue(index);
1300 handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.ToString(), index, value);
1301 }
1302
1303 return true;
1304 }
@ LANG_TOO_BIG_INDEX
Definition Language.h:630
@ LANG_SELECT_CHAR_OR_CREATURE
Definition Language.h:31
@ LANG_GET_UINT_FIELD
Definition Language.h:636
@ LANG_GET_FLOAT_FIELD
Definition Language.h:638
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
1015 {
1016 Unit* target = handler->getSelectedUnit();
1017 if (!target)
1018 target = handler->GetSession()->GetPlayer();
1019
1020 uint32 count = 0;
1021
1022 handler->PSendSysMessage("Threatened by me list of {} ({})", target->GetName(), target->GetGUID().ToString());
1023
1024 for (auto const& pair : target->GetThreatMgr().GetThreatenedByMeList())
1025 {
1026 ThreatReference const* ref = pair.second;
1027 Creature* owner = ref->GetOwner();
1028 if (owner)
1029 {
1030 std::string stateStr = "";
1031 if (ref->IsOffline())
1032 stateStr = "[offline] ";
1033 else if (ref->IsSuppressed())
1034 stateStr = "[suppressed] ";
1035
1036 handler->PSendSysMessage(" {}. {}{} ({}) - threat {}", ++count, stateStr,
1037 owner->GetName(), owner->GetGUID().ToString(), ref->GetThreat());
1038 }
1039 else
1040 {
1041 handler->PSendSysMessage(" {}. No Owner - threat {}", ++count, ref->GetThreat());
1042 }
1043 }
1044
1045 handler->SendSysMessage("End of threatened by me list.");
1046
1047 // Also show combat refs that may not appear in the threat list
1048 // (e.g. creatures without threat lists like triggers/environmental hazards)
1049 handler->PSendSysMessage("Combat refs (InCombat: {} | HasCombat: {})", target->IsInCombat(), target->GetCombatManager().HasCombat());
1050 for (auto const& ref : target->GetCombatManager().GetPvECombatRefs())
1051 {
1052 Unit* unit = ref.second->GetOther(target);
1053 handler->PSendSysMessage(" [PvE] {} ({}) Entry: {}", unit->GetName(), unit->GetGUID().ToString(),
1054 unit->IsCreature() ? unit->ToCreature()->GetEntry() : 0);
1055 }
1056 for (auto const& ref : target->GetCombatManager().GetPvPCombatRefs())
1057 {
1058 Unit* unit = ref.second->GetOther(target);
1059 handler->PSendSysMessage(" [PvP] {} ({})", unit->GetName(), unit->GetGUID().ToString());
1060 }
1061
1062 return true;
1063 }
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
1187 {
1188 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
1189
1190 if (!i)
1191 return false;
1192
1193 handler->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
1194 sScriptMgr->OnItemExpire(handler->GetPlayer(), i->GetTemplate());
1195
1196 return true;
1197 }
#define sScriptMgr
Definition ScriptMgr.h:737
ItemTemplate const * GetTemplate() const
Definition Item.cpp:544
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition PlayerStorage.cpp:3090

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
1705 {
1706 static std::unordered_map<std::string, LootStore*> const lootStoreMap =
1707 {
1708 { "creature", &LootTemplates_Creature },
1709 { "gameobject", &LootTemplates_Gameobject },
1710 { "fishing", &LootTemplates_Fishing },
1711 { "item", &LootTemplates_Item },
1712 { "pickpocketing", &LootTemplates_Pickpocketing },
1713 { "skinning", &LootTemplates_Skinning },
1714 { "disenchant", &LootTemplates_Disenchant },
1715 { "prospecting", &LootTemplates_Prospecting },
1716 { "milling", &LootTemplates_Milling },
1717 { "spell", &LootTemplates_Spell },
1718 { "reference", &LootTemplates_Reference },
1719 { "mail", &LootTemplates_Mail },
1720 { "player", &LootTemplates_Player }
1721 };
1722
1723 // Lowercase the type for case-insensitive matching
1724 std::transform(type.begin(), type.end(), type.begin(), ::tolower);
1725
1726 auto itr = lootStoreMap.find(type);
1727 if (itr == lootStoreMap.end())
1728 {
1730 return false;
1731 }
1732
1733 LootStore const* store = itr->second;
1734
1735 LootTemplate const* tab = store->GetLootFor(lootId);
1736 if (!tab)
1737 {
1738 handler->SendErrorMessage(LANG_DEBUG_LOOT_NO_TEMPLATE, type, lootId);
1739 return false;
1740 }
1741
1742 uint32 iterations = std::min(count.value_or(1), uint32(100));
1743 if (iterations == 0)
1744 iterations = 1;
1745
1746 Player* player = handler->GetPlayer();
1747 std::string sourceName = GetLootSourceName(type, lootId);
1748
1749 // Single iteration - original behavior
1750 if (iterations == 1)
1751 {
1752 Loot loot;
1753 GenerateLoot(loot, tab, *store, player, type, lootId);
1754
1755 handler->PSendSysMessage(LANG_DEBUG_LOOT_HEADER, type, sourceName, lootId);
1756
1757 if (loot.items.empty() && loot.quest_items.empty() && loot.gold == 0)
1758 {
1760 return true;
1761 }
1762
1763 for (LootItem const& li : loot.items)
1764 {
1765 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(li.itemid);
1766 std::string name = proto ? proto->Name1 : "Unknown";
1767 char const* qualityName = GetItemQualityName(proto ? proto->Quality : 0);
1769 li.itemid, uint32(li.count), name, qualityName,
1770 li.randomPropertyId, li.randomSuffix);
1771 }
1772
1773 for (LootItem const& li : loot.quest_items)
1774 {
1775 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(li.itemid);
1776 std::string name = proto ? proto->Name1 : "Unknown";
1777 char const* qualityName = GetItemQualityName(proto ? proto->Quality : 0);
1779 li.itemid, uint32(li.count), name, qualityName);
1780 }
1781
1782 if (loot.gold > 0)
1783 {
1784 uint32 gold = loot.gold / 10000;
1785 uint32 silver = (loot.gold % 10000) / 100;
1786 uint32 copper = loot.gold % 100;
1788 loot.gold, gold, silver, copper);
1789 }
1790
1791 return true;
1792 }
1793
1794 // Multi iteration - aggregate results
1795 struct ItemStats
1796 {
1797 uint32 totalCount = 0;
1798 uint32 timesDropped = 0;
1799 bool questItem = false;
1800 };
1801
1802 std::map<uint32, ItemStats> itemStats;
1803 uint64 totalGold = 0;
1804
1805 for (uint32 i = 0; i < iterations; ++i)
1806 {
1807 Loot loot;
1808 GenerateLoot(loot, tab, *store, player, type, lootId);
1809
1810 std::set<uint32> seenThisRun;
1811
1812 for (LootItem const& li : loot.items)
1813 {
1814 itemStats[li.itemid].totalCount += li.count;
1815 if (seenThisRun.insert(li.itemid).second)
1816 itemStats[li.itemid].timesDropped++;
1817 }
1818
1819 for (LootItem const& li : loot.quest_items)
1820 {
1821 itemStats[li.itemid].totalCount += li.count;
1822 itemStats[li.itemid].questItem = true;
1823 if (seenThisRun.insert(li.itemid).second)
1824 itemStats[li.itemid].timesDropped++;
1825 }
1826
1827 totalGold += loot.gold;
1828 }
1829
1831 type, sourceName, lootId, iterations);
1832
1833 if (itemStats.empty() && totalGold == 0)
1834 {
1836 return true;
1837 }
1838
1839 for (auto const& [itemId, stats] : itemStats)
1840 {
1841 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
1842 std::string name = proto ? proto->Name1 : "Unknown";
1843 char const* qualityName = GetItemQualityName(proto ? proto->Quality : 0);
1844 uint32 dropPct = (stats.timesDropped * 10000) / iterations;
1845
1846 if (stats.questItem)
1848 itemId, stats.totalCount, name, qualityName,
1849 stats.timesDropped, iterations, dropPct / 100, dropPct % 100);
1850 else
1852 itemId, stats.totalCount, name, qualityName,
1853 stats.timesDropped, iterations, dropPct / 100, dropPct % 100);
1854 }
1855
1856 if (totalGold > 0)
1857 {
1858 uint32 avgGold = static_cast<uint32>(totalGold / iterations);
1859 uint32 gold = avgGold / 10000;
1860 uint32 silver = (avgGold % 10000) / 100;
1861 uint32 copper = avgGold % 100;
1863 avgGold, gold, silver, copper, iterations);
1864 }
1865
1866 return true;
1867 }
std::uint64_t uint64
Definition Define.h:106
@ LANG_DEBUG_LOOT_HEADER
Definition Language.h:1423
@ LANG_DEBUG_LOOT_EMPTY
Definition Language.h:1427
@ LANG_DEBUG_LOOT_NO_TEMPLATE
Definition Language.h:1429
@ LANG_DEBUG_LOOT_GOLD_MULTI
Definition Language.h:1433
@ LANG_DEBUG_LOOT_GOLD
Definition Language.h:1426
@ LANG_DEBUG_LOOT_INVALID_TYPE
Definition Language.h:1428
@ LANG_DEBUG_LOOT_HEADER_MULTI
Definition Language.h:1430
@ LANG_DEBUG_LOOT_ITEM_QUEST
Definition Language.h:1425
@ LANG_DEBUG_LOOT_ITEM
Definition Language.h:1424
@ LANG_DEBUG_LOOT_ITEM_MULTI
Definition Language.h:1431
@ LANG_DEBUG_LOOT_ITEM_QUEST_MULTI
Definition Language.h:1432
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:1666
static void GenerateLoot(Loot &loot, LootTemplate const *tab, LootStore const &store, Player *player, std::string const &type, uint32 lootId)
Definition cs_debug.cpp:1679
static std::string GetLootSourceName(std::string const &type, uint32 lootId)
Definition cs_debug.cpp:1640
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
1211 {
1212 if (Unit* unit = handler->getSelectedUnit())
1213 {
1214 Player* player = handler->GetSession()->GetPlayer();
1215 handler->PSendSysMessage("Checking LoS {} -> {}:", player->GetName(), unit->GetName());
1216 handler->PSendSysMessage(" VMAP LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
1217 handler->PSendSysMessage(" GObj LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_ALL) ? "clear" : "obstructed");
1218 handler->PSendSysMessage("{} is {}in line of sight of {}.", unit->GetName(), (player->IsWithinLOSInMap(unit) ? "" : "not "), player->GetName());
1219 return true;
1220 }
1221
1222 return false;
1223 }
@ LINEOFSIGHT_CHECK_VMAP
Definition Map.h:107
@ LINEOFSIGHT_CHECK_GOBJECT_ALL
Definition Map.h:111
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
1551 {
1552 Cell cell(handler->GetPlayer()->GetPositionX(), handler->GetPlayer()->GetPositionY());
1553 Map* map = handler->GetPlayer()->GetMap();
1554
1555 handler->PSendSysMessage("GridX {} GridY {}", cell.GridX(), cell.GridY());
1556 handler->PSendSysMessage("CellX {} CellY {}", cell.CellX(), cell.CellY());
1557 handler->PSendSysMessage("Created Grids: {} / {}", map->GetCreatedGridsCount(), MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS);
1558 handler->PSendSysMessage("Loaded Grids: {} / {}", map->GetLoadedGridsCount(), MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS);
1559 handler->PSendSysMessage("Created Cells In Grid: {} / {}", map->GetCreatedCellsInGridCount(cell.GridX(), cell.GridY()), MAX_NUMBER_OF_CELLS * MAX_NUMBER_OF_CELLS);
1561 return true;
1562 }
#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:166
uint32 GetLoadedGridsCount()
Definition Map.cpp:3480
uint32 GetCreatedGridsCount()
Definition Map.cpp:3475
uint32 GetCreatedCellsInGridCount(uint16 const x, uint16 const y)
Definition Map.cpp:3485
uint32 GetCreatedCellsInMapCount()
Definition Map.cpp:3490
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
1307 {
1308 if (index >= handler->GetPlayer()->GetValuesCount())
1309 {
1310 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().ToString(), handler->GetPlayer()->GetValuesCount());
1311 return false;
1312 }
1313
1314 uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
1315
1316 currentValue += value;
1317 handler->GetPlayer()->SetUInt32Value(index, currentValue);
1318
1319 handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
1320
1321 return true;
1322 }
@ LANG_CHANGE_32BIT_FIELD
Definition Language.h:642
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:17358

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

1379 {
1380 Unit* target = handler->getSelectedUnit();
1381 if (!target)
1382 target = handler->GetPlayer();
1383
1384 if (!moveFlags)
1385 {
1388 }
1389 else
1390 {
1391 static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
1394
1395 bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
1396
1397 target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
1398 target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
1399 target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
1400 target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
1401 target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
1402 target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
1403 target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
1404
1406 *moveFlags &= ~MOVEMENTFLAG_FALLING;
1407
1408 if (*moveFlags & MOVEMENTFLAG_ROOT)
1409 {
1410 target->SetControlled(true, UNIT_STATE_ROOT);
1411 *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
1412 }
1413
1415 target->StopMoving();
1416
1417 if (unhandledFlag)
1418 target->SetUnitMovementFlags(*moveFlags);
1419
1420 if (moveFlagsExtra)
1421 {
1422 target->SetExtraUnitMovementFlags(*moveFlagsExtra);
1423 }
1424
1425 if (moveFlagsExtra || unhandledFlag)
1426 target->SendMovementFlagUpdate();
1427
1429 }
1430
1431 return true;
1432 }
@ LANG_MOVEFLAGS_GET
Definition Language.h:944
@ LANG_MOVEFLAGS_SET
Definition Language.h:945
@ 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:16593
void SetUnitMovementFlags(uint32 f)
Definition Unit.h:776
void SetExtraUnitMovementFlags(uint16 f)
Definition Unit.h:782
void SetHover(bool enable)
Definition Unit.cpp:16634
void StopMoving()
Definition Unit.cpp:13023
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:16557
virtual bool SetSwim(bool enable)
Definition Unit.cpp:16532
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:14294
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:774
void SendMovementFlagUpdate(bool self=false)
Definition Unit.cpp:13077
virtual bool SetWalk(bool enable)
Definition Unit.cpp:16483
uint16 GetExtraUnitMovementFlags() const
Definition Unit.h:781
void SetDisableGravity(bool disable)
Definition Unit.cpp:16497
void SetWaterWalking(bool enable)
Definition Unit.cpp:16687

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
1467 {
1468 if (mapId)
1469 {
1470 sMapMgr->DoForAllMapsWithMapId(mapId.value(),
1471 [handler](Map* map) -> void
1472 {
1473 HandleDebugObjectCountMap(handler, map);
1474 }
1475 );
1476 }
1477 else
1478 {
1479 sMapMgr->DoForAllMaps(
1480 [handler](Map* map) -> void
1481 {
1482 HandleDebugObjectCountMap(handler, map);
1483 }
1484 );
1485 }
1486
1487 return true;
1488 }
#define sMapMgr
Definition MapMgr.h:220
static void HandleDebugObjectCountMap(ChatHandler *handler, Map *map)
Definition cs_debug.cpp:1526

References HandleDebugObjectCountMap(), and sMapMgr.

Referenced by GetCommands().

◆ HandleDebugObjectCountMap()

static void debug_commandscript::HandleDebugObjectCountMap ( ChatHandler handler,
Map map 
)
inlinestatic
1527 {
1528 handler->PSendSysMessage("Map Id: {} Name: '{}' Instance Id: {} Creatures: {} GameObjects: {} Update Objects: {}",
1529 map->GetId(), map->GetMapName(), map->GetInstanceId(),
1533
1534 CreatureCountWorker worker;
1536 visitor.Visit(map->GetObjectsStore());
1537
1538 handler->PSendSysMessage("Top Creatures count:");
1539
1540 for (auto&& p : worker.GetTopCreatureCount(5))
1541 handler->PSendSysMessage("Entry: {} Count: {}", p.first, p.second);
1542 }
Definition GameObject.h:120
MapStoredObjectTypesContainer & GetObjectsStore()
Definition Map.h:352
size_t GetUpdatableObjectsCount() const
Definition Map.h:535
uint32 GetId() const
Definition Map.h:232
const char * GetMapName() const
Definition Map.cpp:1611
uint32 GetInstanceId() const
Definition Map.h:268
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
132 {
133 CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
134 if (!cineSeq)
135 {
136 handler->SendErrorMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
137 return false;
138 }
139
140 // Dump camera locations
141 if (std::vector<FlyByCamera> const* flyByCameras = GetFlyByCameras(cineSeq->cinematicCamera))
142 {
143 handler->PSendSysMessage("Waypoints for sequence {}, camera {}", cinematicId, cineSeq->cinematicCamera);
144 uint32 count = 1;
145 for (FlyByCamera const& cam : *flyByCameras)
146 {
147 handler->PSendSysMessage("{} - {}ms [{} ({} degrees)]", count, cam.timeStamp, cam.locations.ToString(), cam.locations.GetOrientation() * (180 / M_PI));
148 ++count;
149 }
150 handler->PSendSysMessage("{} waypoints dumped", flyByCameras->size());
151 }
152
153 handler->GetPlayer()->GetCinematicMgr().StartCinematic(cinematicId);
154 return true;
155 }
DBCStorage< CinematicSequencesEntry > sCinematicSequencesStore(CinematicSequencesEntryfmt)
@ LANG_CINEMATIC_NOT_EXIST
Definition Language.h:992
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:1397
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
159 {
160 if (!sMovieStore.LookupEntry(movieId))
161 {
162 handler->SendErrorMessage(LANG_MOVIE_NOT_EXIST, movieId);
163 return false;
164 }
165
166 handler->GetPlayer()->SendMovieStart(movieId);
167 return true;
168 }
DBCStorage< MovieEntry > sMovieStore(MovieEntryfmt)
@ LANG_MOVIE_NOT_EXIST
Definition Language.h:993
void SendMovieStart(uint32 MovieId)
Definition Player.cpp:5704

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
199 {
200 if (!sSoundEntriesStore.LookupEntry(musicId))
201 {
202 handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, musicId);
203 return false;
204 }
205
206 Player* player = handler->GetPlayer();
207
208 player->PlayDirectMusic(musicId, player);
209
210 handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, musicId);
211 return true;
212 }
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
@ LANG_YOU_HEAR_SOUND
Definition Language.h:200
@ LANG_SOUND_NOT_EXIST
Definition Language.h:214
void PlayDirectMusic(uint32 music_id, Player *target=nullptr)
Definition Object.cpp:2975

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
172 {
173 if (!sSoundEntriesStore.LookupEntry(soundId))
174 {
175 handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, soundId);
176 return false;
177 }
178
179 Player* player = handler->GetPlayer();
180
181 Unit* unit = handler->getSelectedUnit();
182 if (!unit)
183 {
185 return false;
186 }
187
188 if (player->GetTarget())
189 unit->PlayDistanceSound(soundId, player);
190 else
191 unit->PlayDirectSound(soundId, player);
192
193 handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId);
194 return true;
195 }
ObjectGuid GetTarget() const
Definition Unit.h:861
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2956
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2948

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
269 {
270 handler->GetPlayer()->SendBuyError(BuyResult(error), nullptr, 0, 0);
271 return true;
272 }
BuyResult
Definition Item.h:140
void SendBuyError(BuyResult msg, Creature *creature, uint32 item, uint32 param)
Definition PlayerStorage.cpp:4132

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

Referenced by GetCommands().

◆ HandleDebugSendChannelNotifyCommand()

static bool debug_commandscript::HandleDebugSendChannelNotifyCommand ( ChatHandler handler,
ChatNotify  type 
)
inlinestatic
481 {
482 WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
483 data << type;
484 data << "test";
485 data << uint32(0);
486 data << uint32(0);
487 handler->GetSession()->SendPacket(&data);
488 return true;
489 }
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:287
@ 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
492 {
493 WorldPacket data;
494 ChatHandler::BuildChatPacket(data, type, LANG_UNIVERSAL, handler->GetPlayer(), handler->GetPlayer(), "testtest", 0, "chan");
495 handler->GetSession()->SendPacket(&data);
496 return true;
497 }
@ 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:273

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
257 {
258 handler->GetPlayer()->SendEquipError(InventoryResult(error), nullptr, nullptr);
259 return true;
260 }
InventoryResult
Definition Item.h:46
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4089

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

Referenced by GetCommands().

◆ HandleDebugSendLargePacketCommand()

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

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugSendOpcodeCommand()

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

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

Referenced by GetCommands().

◆ HandleDebugSendQuestPartyMsgCommand()

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

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

Referenced by GetCommands().

◆ HandleDebugSendSellErrorCommand()

static bool debug_commandscript::HandleDebugSendSellErrorCommand ( ChatHandler handler,
SellResult  error 
)
inlinestatic
263 {
264 handler->GetPlayer()->SendSellError(SellResult(error), nullptr, ObjectGuid::Empty, 0);
265 return true;
266 }
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:4144

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

Referenced by GetCommands().

◆ HandleDebugSendSetPhaseShiftCommand()

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

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
236 {
238 data << uint8(0);
239 data << uint32(133); // Spell "Fireball"
240 data << uint8(result);
241
242 if (failArg1 || failArg2)
243 {
244 data << uint32(failArg1.value_or(0));
245 }
246
247 if (failArg2)
248 {
249 data << uint32(*failArg2);
250 }
251
252 handler->GetSession()->SendPacket(&data);
253 return true;
254 }
@ 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
1360 {
1361 WorldObject* target = handler->getSelectedObject();
1362 if (!target)
1363 {
1365 return false;
1366 }
1367
1368 if (bit > 32) // uint32 = 32 bits
1369 return false;
1370
1371 uint32 value = bit ? 1 << (bit - 1) : 0;
1372 target->SetUInt32Value(index, value);
1373
1374 handler->PSendSysMessage(LANG_SET_32BIT_FIELD, index, value);
1375 return true;
1376 }
@ LANG_SET_32BIT_FIELD
Definition Language.h:640
WorldObject * getSelectedObject() const
Definition Chat.cpp:405
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
1226 {
1227 Unit* unit = handler->getSelectedUnit();
1228 if (!unit)
1229 {
1231 return false;
1232 }
1233
1234 if (!state)
1235 {
1236 // reset all states
1237 for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
1238 unit->ModifyAuraState(s, false);
1239 return true;
1240 }
1241
1242 unit->ModifyAuraState(*state, apply);
1243 return true;
1244 }
AuraStateType
Definition SharedDefines.h:1276
Definition SmartEnum.h:47
void ModifyAuraState(AuraStateType flag, bool apply)
Definition Unit.cpp:7596

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
1172 {
1173 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
1174
1175 if (!i)
1176 return false;
1177
1178 if (index >= i->GetValuesCount())
1179 return false;
1180
1181 i->SetUInt32Value(index, value);
1182
1183 return true;
1184 }

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
1247 {
1248 WorldObject* target = handler->getSelectedObject();
1249 if (!target)
1250 {
1252 return false;
1253 }
1254
1255 if (index >= target->GetValuesCount())
1256 {
1257 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, target->GetGUID().ToString(), target->GetValuesCount());
1258 return false;
1259 }
1260
1261 if (value.holds_alternative<uint32>())
1262 {
1263 target->SetUInt32Value(index, value.get<uint32>());
1264 handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().ToString(), uint32(index), uint32(value));
1265 }
1266 else if (value.holds_alternative<float>())
1267 {
1268 target->SetFloatValue(index, value.get<float>());
1269 handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().ToString(), static_cast<float>(index), uint32(value));
1270 }
1271
1272 return true;
1273 }
@ LANG_SET_UINT_FIELD
Definition Language.h:632
@ LANG_SET_FLOAT_FIELD
Definition Language.h:634
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:726
constexpr decltype(auto) get()
Definition ChatCommandTags.h:289
constexpr bool holds_alternative() const
Definition ChatCommandTags.h:303

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
1066 {
1067 Unit* target = handler->getSelectedUnit();
1068 if (!target || target->IsVehicle())
1069 return false;
1070
1071 //target->SetVehicleId(id);
1072 handler->PSendSysMessage("Vehicle id set to {}", id);
1073 return true;
1074 }

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
1105 {
1106 float x, y, z, o = handler->GetPlayer()->GetOrientation();
1107 handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
1108
1109 if (!id)
1110 return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
1111
1112 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
1113
1114 if (!ci)
1115 return false;
1116
1117 VehicleEntry const* ve = sVehicleStore.LookupEntry(*id);
1118
1119 if (!ve)
1120 return false;
1121
1122 Creature* v = new Creature();
1123
1124 Map* map = handler->GetPlayer()->GetMap();
1125
1126 if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, *id, x, y, z, o))
1127 {
1128 delete v;
1129 return false;
1130 }
1131
1132 map->AddToMap(v->ToCreature());
1133
1134 return true;
1135 }
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:1151
ObjectGuid::LowType GenerateLowGuid()
Definition Map.h:519
bool AddToMap(T *, bool checkTransport=false)
Definition Map.cpp:304
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:2393
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:2765
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
920 {
921 Unit* target = handler->getSelectedUnit();
922 if (!target)
923 {
925 handler->SetSentErrorMessage(true);
926 return false;
927 }
928
929 handler->PSendSysMessage("Threat info for {} ({}):", target->GetName(), target->GetGUID().ToString());
930
931 ThreatManager const& mgr = target->GetThreatMgr();
932
933 // _singleSchoolModifiers
934 {
935 auto& mods = mgr._singleSchoolModifiers;
936 handler->SendSysMessage(" - Single-school threat modifiers:");
937 handler->PSendSysMessage(" |-- Physical: {:.2f}%", mods[SPELL_SCHOOL_NORMAL] * 100.0f);
938 handler->PSendSysMessage(" |-- Holy : {:.2f}%", mods[SPELL_SCHOOL_HOLY] * 100.0f);
939 handler->PSendSysMessage(" |-- Fire : {:.2f}%", mods[SPELL_SCHOOL_FIRE] * 100.0f);
940 handler->PSendSysMessage(" |-- Nature : {:.2f}%", mods[SPELL_SCHOOL_NATURE] * 100.0f);
941 handler->PSendSysMessage(" |-- Frost : {:.2f}%", mods[SPELL_SCHOOL_FROST] * 100.0f);
942 handler->PSendSysMessage(" |-- Shadow : {:.2f}%", mods[SPELL_SCHOOL_SHADOW] * 100.0f);
943 handler->PSendSysMessage(" |-- Arcane : {:.2f}%", mods[SPELL_SCHOOL_ARCANE] * 100.0f);
944 }
945
946 // _multiSchoolModifiers
947 {
948 auto& mods = mgr._multiSchoolModifiers;
949 handler->PSendSysMessage(" - Multi-school threat modifiers ({} entries):", mods.size());
950 for (auto const& pair : mods)
951 handler->PSendSysMessage(" |-- Mask 0x{:x}: {:.2f}%", uint32(pair.first), pair.second * 100.0f);
952 }
953
954 // _redirectInfo
955 {
956 auto const& redirectInfo = mgr._redirectInfo;
957 if (redirectInfo.empty())
958 handler->SendSysMessage(" - No redirects being applied");
959 else
960 {
961 handler->PSendSysMessage(" - {:02} redirects being applied:", redirectInfo.size());
962 for (auto const& pair : redirectInfo)
963 {
964 Unit* unit = ObjectAccessor::GetUnit(*target, pair.first);
965 handler->PSendSysMessage(" |-- {:02}% to {}", pair.second, unit ? unit->GetName() : pair.first.ToString());
966 }
967 }
968 }
969
970 // _redirectRegistry
971 {
972 auto const& redirectRegistry = mgr._redirectRegistry;
973 if (redirectRegistry.empty())
974 handler->SendSysMessage(" - No redirects are registered");
975 else
976 {
977 handler->PSendSysMessage(" - {:02} spells may have redirects registered", redirectRegistry.size());
978 for (auto const& outerPair : redirectRegistry)
979 {
980 SpellInfo const* const spell = sSpellMgr->GetSpellInfo(outerPair.first);
981 handler->PSendSysMessage(" |-- #{:06} {} ({} entries):", outerPair.first, spell ? spell->SpellName[0] : "<unknown>", outerPair.second.size());
982 for (auto const& innerPair : outerPair.second)
983 {
984 Unit* unit = ObjectAccessor::GetUnit(*target, innerPair.first);
985 handler->PSendSysMessage(" |-- {:02}% to {}", innerPair.second, unit ? unit->GetName() : innerPair.first.ToString());
986 }
987 }
988 }
989 }
990
991 return true;
992 }
@ 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
834 {
835 Unit* target = handler->getSelectedUnit();
836 if (!target)
837 target = handler->GetPlayer();
838
839 ThreatManager& mgr = target->GetThreatMgr();
840 if (!target->IsAlive())
841 {
842 handler->PSendSysMessage("{} ({}) is not alive.{}", target->GetName(), target->GetGUID().ToString(), target->IsEngaged() ? " (It is, however, engaged. Huh?)" : "");
843 return true;
844 }
845
846 uint32 count = 0;
847 auto const& threatenedByMe = target->GetThreatMgr().GetThreatenedByMeList();
848 if (threatenedByMe.empty())
849 handler->PSendSysMessage("{} ({}) does not threaten any units.", target->GetName(), target->GetGUID().ToString());
850 else
851 {
852 handler->PSendSysMessage("List of units threatened by {} ({})", target->GetName(), target->GetGUID().ToString());
853 for (auto const& pair : threatenedByMe)
854 {
855 Unit* unit = pair.second->GetOwner();
856 handler->PSendSysMessage(" {}. {} ({}, SpawnID {}) - threat {}", ++count, unit->GetName(), unit->GetGUID().ToString(), unit->IsCreature() ? unit->ToCreature()->GetSpawnId() : 0, pair.second->GetThreat());
857 }
858 handler->SendSysMessage("End of threatened-by-me list.");
859 }
860
861 if (mgr.CanHaveThreatList())
862 {
863 if (!mgr.IsThreatListEmpty(true))
864 {
865 if (target->IsEngaged())
866 handler->PSendSysMessage("Threat list of {} ({}, SpawnID {}):", target->GetName(), target->GetGUID().ToString(), target->IsCreature() ? target->ToCreature()->GetSpawnId() : 0);
867 else
868 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);
869
870 count = 0;
871 Unit* fixateVictim = mgr.GetFixateTarget();
872 for (ThreatReference const* ref : mgr.GetSortedThreatList())
873 {
874 Unit* unit = ref->GetVictim();
875 char const* onlineStr;
876 switch (ref->GetOnlineState())
877 {
879 onlineStr = " [SUPPRESSED]";
880 break;
882 onlineStr = " [OFFLINE]";
883 break;
884 default:
885 onlineStr = "";
886 }
887 char const* tauntStr;
888 if (unit == fixateVictim)
889 tauntStr = " [FIXATE]";
890 else
891 switch (ref->GetTauntState())
892 {
894 tauntStr = " [TAUNT]";
895 break;
897 tauntStr = " [DETAUNT]";
898 break;
899 default:
900 tauntStr = "";
901 }
902 handler->PSendSysMessage(" {}. {} ({}) - threat {}{}{}", ++count, unit->GetName(), unit->GetGUID().ToString(), ref->GetThreat(), tauntStr, onlineStr);
903 }
904 handler->SendSysMessage("End of threat list.");
905 }
906 else if (!target->IsEngaged())
907 handler->PSendSysMessage("{} ({}, SpawnID {}) is not currently engaged.", target->GetName(), target->GetGUID().ToString(), target->IsCreature() ? target->ToCreature()->GetSpawnId() : 0);
908 else
909 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);
910 }
911 else if (target->IsEngaged())
912 handler->PSendSysMessage("{} ({}) is currently engaged. (This unit cannot have a threat list.)", target->GetName(), target->GetGUID().ToString());
913 else
914 handler->PSendSysMessage("{} ({}) is not currently engaged. (This unit cannot have a threat list.)", target->GetName(), target->GetGUID().ToString());
915
916 return true;
917 }
auto const & GetThreatenedByMeList() const
Definition ThreatManager.h:141
bool IsThreatListEmpty(bool includeOffline=false) const
Definition ThreatManager.cpp:271
static bool CanHaveThreatList(Unit const *who)
Definition ThreatManager.cpp:189
Unit * GetFixateTarget() const
Definition ThreatManager.cpp:600
@ 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:7699
bool IsAlive() const
Definition Unit.h:1794
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
1435 {
1436 Unit* target = handler->getSelectedUnit();
1437 if (!target)
1438 target = handler->GetSession()->GetPlayer();
1439
1440 target->ClearUnitState(target->GetUnitState());
1441 target->AddUnitState(unitState);
1442
1443 return true;
1444 }
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
1325 {
1326 Unit* unit = handler->getSelectedUnit();
1327 if (!unit)
1328 {
1330 return false;
1331 }
1332
1333 if (!index)
1334 return true;
1335
1336 // check index
1337 if (unit->IsPlayer())
1338 {
1339 if (index >= PLAYER_END)
1340 return true;
1341 }
1342 else if (index >= UNIT_END)
1343 return true;
1344
1345 if (!value)
1346 {
1347 value = unit->GetUInt32Value(index);
1348
1349 handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().ToString(), index, *value);
1350 return true;
1351 }
1352
1353 unit->SetUInt32Value(index, *value);
1354
1355 handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().ToString(), index, *value);
1356 return true;
1357 }
@ LANG_UPDATE_CHANGE
Definition Language.h:629
@ LANG_UPDATE
Definition Language.h:628
@ 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
458 {
459 handler->GetPlayer()->SendUpdateWorldState(variable, value);
460 return true;
461 }
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
1586 {
1587 Player* player = handler->GetPlayer();
1588 if (!player)
1589 return false;
1590
1591 std::array<uint32, NUM_CLIENT_OBJECT_TYPES> objectByTypeCount = {};
1592
1593 ObjectVisibilityContainer const& objectVisibilityContainer = player->GetObjectVisibilityContainer();
1594 for (auto const& kvPair : *objectVisibilityContainer.GetVisibleWorldObjectsMap())
1595 {
1596 WorldObject const* obj = kvPair.second;
1597 ++objectByTypeCount[obj->GetTypeId()];
1598 }
1599
1600 uint32 zoneWideVisibleObjectsInZone = 0;
1601 if (ZoneWideVisibleWorldObjectsSet const* farVisibleSet = player->GetMap()->GetZoneWideVisibleWorldObjectsForZone(player->GetZoneId()))
1602 zoneWideVisibleObjectsInZone = farVisibleSet->size();
1603
1604 handler->PSendSysMessage("Visibility Range: {}", player->GetVisibilityRange());
1605 handler->PSendSysMessage("Visible Creatures: {}", objectByTypeCount[TYPEID_UNIT]);
1606 handler->PSendSysMessage("Visible Players: {}", objectByTypeCount[TYPEID_PLAYER]);
1607 handler->PSendSysMessage("Visible GameObjects: {}", objectByTypeCount[TYPEID_GAMEOBJECT]);
1608 handler->PSendSysMessage("Visible DynamicObjects: {}", objectByTypeCount[TYPEID_DYNAMICOBJECT]);
1609 handler->PSendSysMessage("Visible Corpses: {}", objectByTypeCount[TYPEID_CORPSE]);
1610 handler->PSendSysMessage("Players we are visible to: {}", objectVisibilityContainer.GetVisiblePlayersMap().size());
1611 handler->PSendSysMessage("Zone wide visible objects in zone: {}", zoneWideVisibleObjectsInZone);
1612 return true;
1613 }
std::unordered_set< WorldObject * > ZoneWideVisibleWorldObjectsSet
Definition Map.h:156
@ 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:681
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:3111

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
215 {
216 if (!visualId)
217 {
219 return false;
220 }
221
222 Player* player = handler->GetPlayer();
223 Unit* target = handler->getSelectedUnit();
224
225 if (!target)
226 {
227 player->SendPlaySpellVisual(visualId);
228 return true;
229 }
230
231 player->SendPlaySpellImpact(target->GetGUID(), visualId);
232 return true;
233 }
@ LANG_BAD_VALUE
Definition Language.h:151
void SendPlaySpellVisual(uint32 id)
Definition Unit.cpp:15165
void SendPlaySpellImpact(ObjectGuid guid, uint32 id)
Definition Unit.cpp:15173

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
1616 {
1617 if (!playerTarget)
1618 playerTarget = PlayerIdentifier::FromTargetOrSelf(handler);
1619
1620 if (!playerTarget)
1621 {
1623 return false;
1624 }
1625
1626 Player* player = playerTarget->GetConnectedPlayer();
1627
1628 if (!player)
1629 {
1631 return false;
1632 }
1633
1634 uint32 zoneId = player->GetZoneId();
1635 AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
1636 handler->PSendSysMessage("Player count in zone {} ({}): {}.", zoneId, (zoneEntry ? zoneEntry->area_name[LOCALE_enUS] : "<unknown>"), player->GetMap()->GetPlayerCountInZone(zoneId));
1637 return true;
1638 }
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition ChatCommandTags.h:189
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
1447 {
1448 Player* player = handler->GetSession()->GetPlayer();
1449
1450 if (!type)
1451 {
1452 // waypoint_data - id, point, X, Y, Z, O, delay, move_type, action, action_chance, wpguid
1453 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1454 }
1455
1456 if (type == "sai")
1457 {
1458 // waypoint (SAI) - entry, pointid, X, Y, Z, O, delay
1459 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1460 }
1461
1462 handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
1463 return true;
1464 }
#define LOG_INFO(filterType__,...)
Definition Log.h:153

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: