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 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)
 

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
43: CommandScript("debug_commandscript") { }
Definition CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable debug_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

46 {
47 static ChatCommandTable debugPlayCommandTable =
48 {
49 { "cinematic", HandleDebugPlayCinematicCommand, SEC_ADMINISTRATOR, Console::No },
50 { "movie", HandleDebugPlayMovieCommand, SEC_ADMINISTRATOR, Console::No },
51 { "sound", HandleDebugPlaySoundCommand, SEC_ADMINISTRATOR, Console::No },
52 { "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No },
53 { "visual", HandleDebugVisualCommand, SEC_ADMINISTRATOR, Console::No }
54 };
55 static ChatCommandTable debugSendCommandTable =
56 {
57 { "buyerror", HandleDebugSendBuyErrorCommand, SEC_ADMINISTRATOR, Console::No },
58 { "channelnotify", HandleDebugSendChannelNotifyCommand, SEC_ADMINISTRATOR, Console::No },
59 { "chatmessage", HandleDebugSendChatMsgCommand, SEC_ADMINISTRATOR, Console::No },
60 { "equiperror", HandleDebugSendEquipErrorCommand, SEC_ADMINISTRATOR, Console::No },
61 { "largepacket", HandleDebugSendLargePacketCommand, SEC_ADMINISTRATOR, Console::No },
62 { "opcode", HandleDebugSendOpcodeCommand, SEC_ADMINISTRATOR, Console::No },
63 { "qpartymsg", HandleDebugSendQuestPartyMsgCommand, SEC_ADMINISTRATOR, Console::No },
64 { "qinvalidmsg", HandleDebugSendQuestInvalidMsgCommand, SEC_ADMINISTRATOR, Console::No },
65 { "sellerror", HandleDebugSendSellErrorCommand, SEC_ADMINISTRATOR, Console::No },
66 { "setphaseshift", HandleDebugSendSetPhaseShiftCommand, SEC_ADMINISTRATOR, Console::No },
67 { "spellfail", HandleDebugSendSpellFailCommand, SEC_ADMINISTRATOR, Console::No }
68 };
69 static ChatCommandTable debugCommandTable =
70 {
71 { "setbit", HandleDebugSet32BitCommand, SEC_ADMINISTRATOR, Console::No },
72 { "threat", HandleDebugThreatListCommand, SEC_ADMINISTRATOR, Console::No },
73 { "hostile", HandleDebugHostileRefListCommand, SEC_ADMINISTRATOR, Console::No },
74 { "anim", HandleDebugAnimCommand, SEC_ADMINISTRATOR, Console::No },
75 { "arena", HandleDebugArenaCommand, SEC_ADMINISTRATOR, Console::No },
77 { "cooldown", HandleDebugCooldownCommand, SEC_ADMINISTRATOR, Console::No },
78 { "getitemstate", HandleDebugGetItemStateCommand, SEC_ADMINISTRATOR, Console::No },
79 { "lootrecipient", HandleDebugGetLootRecipientCommand, SEC_ADMINISTRATOR, Console::No },
80 { "getvalue", HandleDebugGetValueCommand, SEC_ADMINISTRATOR, Console::No },
81 { "getitemvalue", HandleDebugGetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
82 { "Mod32Value", HandleDebugMod32ValueCommand, SEC_ADMINISTRATOR, Console::No },
83 { "play", debugPlayCommandTable },
84 { "send", debugSendCommandTable },
85 { "setaurastate", HandleDebugSetAuraStateCommand, SEC_ADMINISTRATOR, Console::No },
86 { "setitemvalue", HandleDebugSetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
87 { "setvalue", HandleDebugSetValueCommand, SEC_ADMINISTRATOR, Console::No },
88 { "spawnvehicle", HandleDebugSpawnVehicleCommand, SEC_ADMINISTRATOR, Console::No },
89 { "setvid", HandleDebugSetVehicleIdCommand, SEC_ADMINISTRATOR, Console::No },
90 { "entervehicle", HandleDebugEnterVehicleCommand, SEC_ADMINISTRATOR, Console::No },
92 { "update", HandleDebugUpdateCommand, SEC_ADMINISTRATOR, Console::No },
93 { "itemexpire", HandleDebugItemExpireCommand, SEC_ADMINISTRATOR, Console::No },
94 { "areatriggers", HandleDebugAreaTriggersCommand, SEC_ADMINISTRATOR, Console::No },
96 { "los", HandleDebugLoSCommand, SEC_ADMINISTRATOR, Console::No },
97 { "moveflags", HandleDebugMoveflagsCommand, SEC_ADMINISTRATOR, Console::No },
98 { "unitstate", HandleDebugUnitStateCommand, SEC_ADMINISTRATOR, Console::No },
99 { "objectcount", HandleDebugObjectCountCommand, SEC_ADMINISTRATOR, Console::Yes},
100 { "dummy", HandleDebugDummyCommand, SEC_ADMINISTRATOR, Console::No },
101 { "mapdata", HandleDebugMapDataCommand, SEC_ADMINISTRATOR, Console::No },
102 { "boundary", HandleDebugBoundaryCommand, SEC_ADMINISTRATOR, Console::No },
103 { "visibilitydata", HandleDebugVisibilityDataCommand, SEC_ADMINISTRATOR, Console::No },
104 { "zonestats", HandleDebugZoneStatsCommand, SEC_MODERATOR, Console::Yes}
105 };
106 static ChatCommandTable commandTable =
107 {
108 { "debug", debugCommandTable },
109 { "wpgps", HandleWPGPSCommand, SEC_ADMINISTRATOR, Console::No }
110 };
111 return commandTable;
112 }
@ SEC_ADMINISTRATOR
Definition Common.h:60
@ SEC_MODERATOR
Definition Common.h:58
static bool HandleDebugSet32BitCommand(ChatHandler *handler, uint32 index, uint8 bit)
Definition cs_debug.cpp:1183
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, uint32 phaseShift)
Definition cs_debug.cpp:972
static bool HandleDebugThreatListCommand(ChatHandler *handler)
Definition cs_debug.cpp:817
static bool HandleDebugGetItemStateCommand(ChatHandler *handler, std::string itemState)
Definition cs_debug.cpp:507
static bool HandleDebugGetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index)
Definition cs_debug.cpp:978
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler)
Definition cs_debug.cpp:961
static bool HandleDebugSetValueCommand(ChatHandler *handler, uint32 index, Variant< uint32, float > value)
Definition cs_debug.cpp:1070
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
Definition cs_debug.cpp:1202
static bool HandleWPGPSCommand(ChatHandler *handler, Optional< std::string > type)
Definition cs_debug.cpp:1270
static bool HandleDebugSendChatMsgCommand(ChatHandler *handler, ChatMsg type)
Definition cs_debug.cpp:475
static bool HandleDebugAreaTriggersCommand(ChatHandler *handler)
Definition cs_debug.cpp:447
static bool HandleDebugSendSellErrorCommand(ChatHandler *handler, SellResult error)
Definition cs_debug.cpp:246
static bool HandleDebugGetValueCommand(ChatHandler *handler, uint32 index, bool isInt)
Definition cs_debug.cpp:1099
static bool HandleDebugUpdateCommand(ChatHandler *handler, uint32 index, Optional< uint32 > value)
Definition cs_debug.cpp:1148
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, uint32 id)
Definition cs_debug.cpp:889
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler)
Definition cs_debug.cpp:489
static bool HandleDebugLoSCommand(ChatHandler *handler)
Definition cs_debug.cpp:1034
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, uint32 movieId)
Definition cs_debug.cpp:142
static bool HandleDebugUnitStateCommand(ChatHandler *handler, uint32 unitState)
Definition cs_debug.cpp:1258
static bool HandleDebugVisibilityDataCommand(ChatHandler *handler)
Definition cs_debug.cpp:1409
static bool HandleDebugMapDataCommand(ChatHandler *handler)
Definition cs_debug.cpp:1374
static bool HandleDebugPlaySoundCommand(ChatHandler *handler, uint32 soundId)
Definition cs_debug.cpp:155
static bool HandleDebugDungeonFinderCommand(ChatHandler *)
Definition cs_debug.cpp:772
static bool HandleDebugSendOpcodeCommand(ChatHandler *handler)
Definition cs_debug.cpp:258
static bool HandleDebugDummyCommand(ChatHandler *handler)
Definition cs_debug.cpp:1368
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, InventoryResult error)
Definition cs_debug.cpp:240
static bool HandleDebugHostileRefListCommand(ChatHandler *handler)
Definition cs_debug.cpp:859
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, uint32 entry, Optional< uint32 > id)
Definition cs_debug.cpp:928
static bool HandleDebugCooldownCommand(ChatHandler *handler, uint32 spell_id, uint32 end_time, Optional< uint32 > item_id)
Definition cs_debug.cpp:784
static bool HandleDebugPlayMusicCommand(ChatHandler *handler, uint32 musicId)
Definition cs_debug.cpp:182
static bool HandleDebugBattlegroundCommand(ChatHandler *)
Definition cs_debug.cpp:778
static bool HandleDebugSendBuyErrorCommand(ChatHandler *handler, BuyResult error)
Definition cs_debug.cpp:252
static bool HandleDebugBoundaryCommand(ChatHandler *handler, Optional< uint32 > durationArg, Optional< EXACT_SEQUENCE("fill")> fill, Optional< EXACT_SEQUENCE("z")> checkZ)
Definition cs_debug.cpp:1388
static bool HandleDebugObjectCountCommand(ChatHandler *handler, Optional< uint32 > mapId)
Definition cs_debug.cpp:1290
static bool HandleDebugSendChannelNotifyCommand(ChatHandler *handler, ChatNotify type)
Definition cs_debug.cpp:464
static bool HandleDebugEnterVehicleCommand(ChatHandler *handler, uint32 entry, Optional< int8 > seatId)
Definition cs_debug.cpp:900
static bool HandleDebugZoneStatsCommand(ChatHandler *handler, Optional< PlayerIdentifier > playerTarget)
Definition cs_debug.cpp:1439
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
Definition cs_debug.cpp:995
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, uint32 index, uint32 value)
Definition cs_debug.cpp:1130
static bool HandleDebugItemExpireCommand(ChatHandler *handler, ObjectGuid::LowType guid)
Definition cs_debug.cpp:1010
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler *handler, QuestFailedReason msg)
Definition cs_debug.cpp:501
static bool HandleDebugPlayCinematicCommand(ChatHandler *handler, uint32 cinematicId)
Definition cs_debug.cpp:115
static bool HandleDebugVisualCommand(ChatHandler *handler, uint32 visualId)
Definition cs_debug.cpp:198
static bool HandleDebugUpdateWorldStateCommand(ChatHandler *handler, uint32 variable, uint32 value)
Definition cs_debug.cpp:441
static bool HandleDebugArenaCommand(ChatHandler *)
Definition cs_debug.cpp:811
static bool HandleDebugAnimCommand(ChatHandler *handler, Emote emote)
Definition cs_debug.cpp:1024
static bool HandleDebugSendSpellFailCommand(ChatHandler *handler, SpellCastResult result, Optional< uint32 > failArg1, Optional< uint32 > failArg2)
Definition cs_debug.cpp:219
static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler *handler, QuestShareMessages msg)
Definition cs_debug.cpp:483
static bool HandleDebugSetAuraStateCommand(ChatHandler *handler, Optional< AuraStateType > state, bool apply)
Definition cs_debug.cpp:1049
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:46

References HandleDebugAnimCommand(), HandleDebugAreaTriggersCommand(), HandleDebugArenaCommand(), HandleDebugBattlegroundCommand(), HandleDebugBoundaryCommand(), HandleDebugCooldownCommand(), HandleDebugDummyCommand(), HandleDebugDungeonFinderCommand(), HandleDebugEnterVehicleCommand(), HandleDebugGetItemStateCommand(), HandleDebugGetItemValueCommand(), HandleDebugGetLootRecipientCommand(), HandleDebugGetValueCommand(), HandleDebugHostileRefListCommand(), HandleDebugItemExpireCommand(), 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(), HandleDebugThreatListCommand(), HandleDebugUnitStateCommand(), HandleDebugUpdateCommand(), HandleDebugUpdateWorldStateCommand(), HandleDebugVisibilityDataCommand(), HandleDebugVisualCommand(), HandleDebugZoneStatsCommand(), HandleWPGPSCommand(), SEC_ADMINISTRATOR, and SEC_MODERATOR.

◆ HandleDebugAnimCommand()

static bool debug_commandscript::HandleDebugAnimCommand ( ChatHandler handler,
Emote  emote 
)
inlinestatic
1025 {
1026 if (Unit* unit = handler->getSelectedUnit())
1027 unit->HandleEmoteCommand(emote);
1028
1029 handler->PSendSysMessage("Playing emote {}", EnumUtils::ToConstant(emote));
1030
1031 return true;
1032 }
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:211
Unit * getSelectedUnit() const
Definition Chat.cpp:386
static char const * ToConstant(Enum value)
Definition SmartEnum.h:123
Definition Unit.h:650

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

Referenced by GetCommands().

◆ HandleDebugAreaTriggersCommand()

static bool debug_commandscript::HandleDebugAreaTriggersCommand ( ChatHandler handler)
inlinestatic
448 {
449 Player* player = handler->GetSession()->GetPlayer();
450 if (!player->isDebugAreaTriggers)
451 {
453 player->isDebugAreaTriggers = true;
454 }
455 else
456 {
458 player->isDebugAreaTriggers = false;
459 }
460
461 return true;
462 }
@ LANG_DEBUG_AREATRIGGER_ON
Definition Language.h:988
@ LANG_DEBUG_AREATRIGGER_OFF
Definition Language.h:989
WorldSession * GetSession()
Definition Chat.h:242
Definition Player.h:1071
bool isDebugAreaTriggers
Definition Player.h:2560
Player * GetPlayer() const
Definition WorldSession.h:424

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
812 {
813 sBattlegroundMgr->ToggleArenaTesting();
814 return true;
815 }
#define sBattlegroundMgr
Definition BattlegroundMgr.h:187

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugBattlegroundCommand()

static bool debug_commandscript::HandleDebugBattlegroundCommand ( ChatHandler )
inlinestatic
779 {
780 sBattlegroundMgr->ToggleTesting();
781 return true;
782 }

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
1389 {
1390 Player* player = handler->GetPlayer();
1391 if (!player)
1392 return false;
1393
1394 Creature* target = handler->getSelectedCreature();
1395 if (!target || !target->IsAIEnabled)
1396 return false;
1397
1398 uint32 duration = durationArg.value_or(5 * IN_MILLISECONDS);
1399 if (duration > 180 * IN_MILLISECONDS) // arbitrary upper limit
1400 duration = 180 * IN_MILLISECONDS;
1401
1402 int32 errMsg = target->AI()->VisualizeBoundary(duration, player, fill.has_value(), checkZ.has_value());
1403 if (errMsg > 0)
1404 handler->PSendSysMessage(errMsg);
1405
1406 return true;
1407 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
Player * GetPlayer() const
Definition Chat.cpp:36
Creature * getSelectedCreature() const
Definition Chat.cpp:410
int32 VisualizeBoundary(uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
Definition CreatureAI.cpp:403
Definition Creature.h:47
CreatureAI * AI() const
Definition Creature.h:145
bool IsAIEnabled
Definition Unit.h:2054

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

Referenced by GetCommands().

◆ HandleDebugCooldownCommand()

static bool debug_commandscript::HandleDebugCooldownCommand ( ChatHandler handler,
uint32  spell_id,
uint32  end_time,
Optional< uint32 item_id 
)
inlinestatic
785 {
786 Player* player = handler->GetPlayer();
787
788 if (!player || !spell_id || !end_time)
789 return false;
790
791 if (!sSpellMgr->GetSpellInfo(spell_id))
792 return false;
793
794 if (!item_id)
795 item_id = 0;
796 else if (!sItemStore.LookupEntry(*item_id))
797 return false;
798
799 if (end_time < player->GetSpellCooldownDelay(spell_id))
800 player->RemoveSpellCooldown(spell_id, true);
801
802 player->AddSpellCooldown(spell_id, *item_id, end_time, true, false);
803
804 WorldPacket data;
805 player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, end_time);
806 player->SendDirectMessage(&data);
807
808 return true;
809 }
DBCStorage< ItemEntry > sItemStore(Itemfmt)
#define sSpellMgr
Definition SpellMgr.h:825
@ SPELL_COOLDOWN_FLAG_NONE
Definition Unit.h:614
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5687
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11067
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3535
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition Unit.cpp:20862
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
1369 {
1370 handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing.");
1371 return true;
1372 }
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:160

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugDungeonFinderCommand()

static bool debug_commandscript::HandleDebugDungeonFinderCommand ( ChatHandler )
inlinestatic
773 {
774 sLFGMgr->ToggleTesting();
775 return true;
776 }
#define sLFGMgr
Definition LFGMgr.h:641

References sLFGMgr.

Referenced by GetCommands().

◆ HandleDebugEnterVehicleCommand()

static bool debug_commandscript::HandleDebugEnterVehicleCommand ( ChatHandler handler,
uint32  entry,
Optional< int8 seatId 
)
inlinestatic
901 {
902 Unit* target = handler->getSelectedUnit();
903 if (!target || !target->IsVehicle())
904 return false;
905
906 if (!seatId)
907 seatId = -1;
908
909 if (!entry)
910 handler->GetPlayer()->EnterVehicle(target, *seatId);
911 else
912 {
913 Creature* passenger = nullptr;
914 Acore::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
915 Acore::CreatureSearcher<Acore::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
916 Cell::VisitObjects(handler->GetPlayer(), searcher, 30.0f);
917
918 if (!passenger || passenger == target)
919 return false;
920
921 passenger->EnterVehicle(target, *seatId);
922 }
923
924 handler->PSendSysMessage("Unit {} entered vehicle {:d}", entry, *seatId);
925 return true;
926 }
Definition GridNotifiers.h:1473
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition Unit.cpp:19402
bool IsVehicle() const
Definition Unit.h:783
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().

◆ HandleDebugGetItemStateCommand()

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

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
979 {
980 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
981
982 if (!i)
983 return false;
984
985 if (index >= i->GetValuesCount())
986 return false;
987
988 uint32 value = i->GetUInt32Value(index);
989
990 handler->PSendSysMessage("Item {}: value at {} is {}", guid, index, value);
991
992 return true;
993 }
Definition ObjectGuid.h:118
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:294
uint16 GetValuesCount() const
Definition Object.h:188
Item * GetItemByGuid(ObjectGuid guid) const
Definition PlayerStorage.cpp:408

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
490 {
491 Creature* target = handler->getSelectedCreature();
492 if (!target)
493 return false;
494
495 handler->PSendSysMessage("Loot recipient for creature {} (GUID {}, SpawnID {}) is {}",
496 target->GetName(), target->GetGUID().ToString(), target->GetSpawnId(),
497 target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient");
498 return true;
499 }
bool hasLootRecipient() const
Definition Creature.h:234
Player * GetLootRecipient() const
Definition Creature.cpp:1319
ObjectGuid::LowType GetSpawnId() const
Definition Creature.h:69
std::string const & GetName() const
Definition Object.h:525

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
1100 {
1101 Unit* target = handler->getSelectedUnit();
1102 if (!target)
1103 {
1105 return false;
1106 }
1107
1108 ObjectGuid guid = target->GetGUID();
1109
1110 if (index >= target->GetValuesCount())
1111 {
1112 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, guid.ToString(), target->GetValuesCount());
1113 return false;
1114 }
1115
1116 if (isInt)
1117 {
1118 uint32 value = target->GetUInt32Value(index);
1119 handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.ToString(), index, value);
1120 }
1121 else
1122 {
1123 float value = target->GetFloatValue(index);
1124 handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.ToString(), index, value);
1125 }
1126
1127 return true;
1128 }
@ LANG_TOO_BIG_INDEX
Definition Language.h:627
@ LANG_SELECT_CHAR_OR_CREATURE
Definition Language.h:31
@ LANG_GET_UINT_FIELD
Definition Language.h:633
@ LANG_GET_FLOAT_FIELD
Definition Language.h:635
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:216
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
860 {
861 Unit* target = handler->getSelectedUnit();
862 if (!target)
863 target = handler->GetSession()->GetPlayer();
864
865 HostileReference* ref = target->getHostileRefMgr().getFirst();
866 uint32 count = 0;
867
868 handler->PSendSysMessage("Hostile reference list of {} ({})", target->GetName(), target->GetGUID().ToString());
869
870 while (ref)
871 {
872 if (Unit* unit = ref->GetSource()->GetOwner())
873 {
874 handler->PSendSysMessage(" {}. {} {} ({}) - threat {}", ++count, (ref->IsOnline() ? "" : "[offline]"),
875 unit->GetName(), unit->GetGUID().ToString(), ref->GetThreat());
876 }
877 else
878 {
879 handler->PSendSysMessage(" {}. No Owner - threat {}", ++count, ref->GetThreat());
880 }
881
882 ref = ref->next();
883 }
884
885 handler->SendSysMessage("End of hostile reference list.");
886 return true;
887 }
HostileReference * getFirst()
Definition HostileRefMgr.h:59
Definition ThreatMgr.h:48
float GetThreat() const
Definition ThreatMgr.h:62
bool IsOnline() const
Definition ThreatMgr.h:66
HostileReference * next()
Definition ThreatMgr.h:115
FROM * GetSource() const
Definition Reference.h:97
const std::string & GetName() const
Definition ScriptObject.h:53
Unit * GetOwner() const
Definition ThreatMgr.h:236
HostileRefMgr & getHostileRefMgr()
Definition Unit.h:940
std::string ToString(Type &&val, Params &&... params)
Definition StringConvert.h:250

References HostileRefMgr::getFirst(), Object::GetGUID(), Unit::getHostileRefMgr(), WorldObject::GetName(), ThreatMgr::GetOwner(), WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), Reference< TO, FROM >::GetSource(), HostileReference::GetThreat(), HostileReference::IsOnline(), HostileReference::next(), ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugItemExpireCommand()

static bool debug_commandscript::HandleDebugItemExpireCommand ( ChatHandler handler,
ObjectGuid::LowType  guid 
)
inlinestatic
1011 {
1012 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
1013
1014 if (!i)
1015 return false;
1016
1017 handler->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
1018 sScriptMgr->OnItemExpire(handler->GetPlayer(), i->GetTemplate());
1019
1020 return true;
1021 }
#define sScriptMgr
Definition ScriptMgr.h:723
ItemTemplate const * GetTemplate() const
Definition Item.cpp:544
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition PlayerStorage.cpp:3024

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

Referenced by GetCommands().

◆ HandleDebugLoSCommand()

static bool debug_commandscript::HandleDebugLoSCommand ( ChatHandler handler)
inlinestatic
1035 {
1036 if (Unit* unit = handler->getSelectedUnit())
1037 {
1038 Player* player = handler->GetSession()->GetPlayer();
1039 handler->PSendSysMessage("Checking LoS {} -> {}:", player->GetName(), unit->GetName());
1040 handler->PSendSysMessage(" VMAP LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
1041 handler->PSendSysMessage(" GObj LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_ALL) ? "clear" : "obstructed");
1042 handler->PSendSysMessage("{} is {}in line of sight of {}.", unit->GetName(), (player->IsWithinLOSInMap(unit) ? "" : "not "), player->GetName());
1043 return true;
1044 }
1045
1046 return false;
1047 }
@ LINEOFSIGHT_CHECK_VMAP
Definition Map.h:104
@ LINEOFSIGHT_CHECK_GOBJECT_ALL
Definition Map.h:108
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:1380

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
1375 {
1376 Cell cell(handler->GetPlayer()->GetPositionX(), handler->GetPlayer()->GetPositionY());
1377 Map* map = handler->GetPlayer()->GetMap();
1378
1379 handler->PSendSysMessage("GridX {} GridY {}", cell.GridX(), cell.GridY());
1380 handler->PSendSysMessage("CellX {} CellY {}", cell.CellX(), cell.CellY());
1381 handler->PSendSysMessage("Created Grids: {} / {}", map->GetCreatedGridsCount(), MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS);
1382 handler->PSendSysMessage("Loaded Grids: {} / {}", map->GetLoadedGridsCount(), MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS);
1383 handler->PSendSysMessage("Created Cells In Grid: {} / {}", map->GetCreatedCellsInGridCount(cell.GridX(), cell.GridY()), MAX_NUMBER_OF_CELLS * MAX_NUMBER_OF_CELLS);
1385 return true;
1386 }
#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:163
uint32 GetLoadedGridsCount()
Definition Map.cpp:3161
uint32 GetCreatedGridsCount()
Definition Map.cpp:3156
uint32 GetCreatedCellsInGridCount(uint16 const x, uint16 const y)
Definition Map.cpp:3166
uint32 GetCreatedCellsInMapCount()
Definition Map.cpp:3171
Map * GetMap() const
Definition Object.h:621
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
1131 {
1132 if (index >= handler->GetPlayer()->GetValuesCount())
1133 {
1134 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().ToString(), handler->GetPlayer()->GetValuesCount());
1135 return false;
1136 }
1137
1138 uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
1139
1140 currentValue += value;
1141 handler->GetPlayer()->SetUInt32Value(index, currentValue);
1142
1143 handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
1144
1145 return true;
1146 }
@ LANG_CHANGE_32BIT_FIELD
Definition Language.h:639
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:21199

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

1203 {
1204 Unit* target = handler->getSelectedUnit();
1205 if (!target)
1206 target = handler->GetPlayer();
1207
1208 if (!moveFlags)
1209 {
1212 }
1213 else
1214 {
1215 static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
1218
1219 bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
1220
1221 target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
1222 target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
1223 target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
1224 target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
1225 target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
1226 target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
1227 target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
1228
1230 *moveFlags &= ~MOVEMENTFLAG_FALLING;
1231
1232 if (*moveFlags & MOVEMENTFLAG_ROOT)
1233 {
1234 target->SetControlled(true, UNIT_STATE_ROOT);
1235 *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
1236 }
1237
1239 target->StopMoving();
1240
1241 if (unhandledFlag)
1242 target->SetUnitMovementFlags(*moveFlags);
1243
1244 if (moveFlagsExtra)
1245 {
1246 target->SetExtraUnitMovementFlags(*moveFlagsExtra);
1247 }
1248
1249 if (moveFlagsExtra || unhandledFlag)
1250 target->SendMovementFlagUpdate();
1251
1253 }
1254
1255 return true;
1256 }
@ LANG_MOVEFLAGS_GET
Definition Language.h:938
@ LANG_MOVEFLAGS_SET
Definition Language.h:939
@ MOVEMENTFLAG_SPLINE_ENABLED
Definition UnitDefines.h:396
@ MOVEMENTFLAG_WATERWALKING
Definition UnitDefines.h:397
@ MOVEMENTFLAG_DISABLE_GRAVITY
Definition UnitDefines.h:379
@ MOVEMENTFLAG_FALLING_SLOW
Definition UnitDefines.h:398
@ MOVEMENTFLAG_CAN_FLY
Definition UnitDefines.h:393
@ MOVEMENTFLAG_ROOT
Definition UnitDefines.h:380
@ MOVEMENTFLAG_FALLING
Definition UnitDefines.h:381
@ MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE
Movement flags that have change status opcodes associated for players.
Definition UnitDefines.h:420
@ MOVEMENTFLAG_SWIMMING
Definition UnitDefines.h:390
@ MOVEMENTFLAG_HOVER
Definition UnitDefines.h:399
@ MOVEMENTFLAG_WALKING
Definition UnitDefines.h:377
@ UNIT_STATE_ROOT
Definition UnitDefines.h:180
uint32 GetUnitMovementFlags() const
Definition Unit.h:760
void SetFeatherFall(bool enable)
Definition Unit.cpp:20428
void SetUnitMovementFlags(uint32 f)
Definition Unit.h:761
void SetExtraUnitMovementFlags(uint16 f)
Definition Unit.h:767
void SetHover(bool enable)
Definition Unit.cpp:20469
void StopMoving()
Definition Unit.cpp:16661
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:20392
virtual bool SetSwim(bool enable)
Definition Unit.cpp:20367
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:18075
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:759
void SendMovementFlagUpdate(bool self=false)
Definition Unit.cpp:16715
virtual bool SetWalk(bool enable)
Definition Unit.cpp:20318
uint16 GetExtraUnitMovementFlags() const
Definition Unit.h:766
void SetDisableGravity(bool disable)
Definition Unit.cpp:20332
void SetWaterWalking(bool enable)
Definition Unit.cpp:20522

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
1291 {
1292 if (mapId)
1293 {
1294 sMapMgr->DoForAllMapsWithMapId(mapId.value(),
1295 [handler](Map* map) -> void
1296 {
1297 HandleDebugObjectCountMap(handler, map);
1298 }
1299 );
1300 }
1301 else
1302 {
1303 sMapMgr->DoForAllMaps(
1304 [handler](Map* map) -> void
1305 {
1306 HandleDebugObjectCountMap(handler, map);
1307 }
1308 );
1309 }
1310
1311 return true;
1312 }
#define sMapMgr
Definition MapMgr.h:220
static void HandleDebugObjectCountMap(ChatHandler *handler, Map *map)
Definition cs_debug.cpp:1350

References HandleDebugObjectCountMap(), and sMapMgr.

Referenced by GetCommands().

◆ HandleDebugObjectCountMap()

static void debug_commandscript::HandleDebugObjectCountMap ( ChatHandler handler,
Map map 
)
inlinestatic
1351 {
1352 handler->PSendSysMessage("Map Id: {} Name: '{}' Instance Id: {} Creatures: {} GameObjects: {} Update Objects: {}",
1353 map->GetId(), map->GetMapName(), map->GetInstanceId(),
1357
1358 CreatureCountWorker worker;
1360 visitor.Visit(map->GetObjectsStore());
1361
1362 handler->PSendSysMessage("Top Creatures count:");
1363
1364 for (auto&& p : worker.GetTopCreatureCount(5))
1365 handler->PSendSysMessage("Entry: {} Count: {}", p.first, p.second);
1366 }
std::uint64_t uint64
Definition Define.h:106
Definition GameObject.h:120
MapStoredObjectTypesContainer & GetObjectsStore()
Definition Map.h:348
size_t GetUpdatableObjectsCount() const
Definition Map.h:496
uint32 GetId() const
Definition Map.h:229
const char * GetMapName() const
Definition Map.cpp:1620
uint32 GetInstanceId() const
Definition Map.h:266
Definition TypeContainerVisitor.h:105
std::size_t Size() const
Definition TypeContainer.h:195

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

Referenced by HandleDebugObjectCountCommand().

◆ HandleDebugPlayCinematicCommand()

static bool debug_commandscript::HandleDebugPlayCinematicCommand ( ChatHandler handler,
uint32  cinematicId 
)
inlinestatic
116 {
117 CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
118 if (!cineSeq)
119 {
120 handler->SendErrorMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
121 return false;
122 }
123
124 // Dump camera locations
125 if (std::vector<FlyByCamera> const* flyByCameras = GetFlyByCameras(cineSeq->cinematicCamera))
126 {
127 handler->PSendSysMessage("Waypoints for sequence {}, camera {}", cinematicId, cineSeq->cinematicCamera);
128 uint32 count = 1;
129 for (FlyByCamera const& cam : *flyByCameras)
130 {
131 handler->PSendSysMessage("{} - {}ms [{} ({} degrees)]", count, cam.timeStamp, cam.locations.ToString(), cam.locations.GetOrientation() * (180 / M_PI));
132 ++count;
133 }
134 handler->PSendSysMessage("{} waypoints dumped", flyByCameras->size());
135 }
136
137 handler->GetPlayer()->SendCinematicStart(cinematicId);
138 return true;
139 }
DBCStorage< CinematicSequencesEntry > sCinematicSequencesStore(CinematicSequencesEntryfmt)
@ LANG_CINEMATIC_NOT_EXIST
Definition Language.h:986
std::vector< FlyByCamera > const * GetFlyByCameras(uint32 cinematicCameraId)
Definition M2Stores.cpp:254
void SendCinematicStart(uint32 CinematicSequenceId) const
Definition Player.cpp:5692
Definition DBCStructure.h:713
uint32 cinematicCamera
Definition DBCStructure.h:716
Definition M2Stores.h:26

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

Referenced by GetCommands().

◆ HandleDebugPlayMovieCommand()

static bool debug_commandscript::HandleDebugPlayMovieCommand ( ChatHandler handler,
uint32  movieId 
)
inlinestatic
143 {
144 if (!sMovieStore.LookupEntry(movieId))
145 {
146 handler->SendErrorMessage(LANG_MOVIE_NOT_EXIST, movieId);
147 return false;
148 }
149
150 handler->GetPlayer()->SendMovieStart(movieId);
151 return true;
152 }
DBCStorage< MovieEntry > sMovieStore(MovieEntryfmt)
@ LANG_MOVIE_NOT_EXIST
Definition Language.h:987
void SendMovieStart(uint32 MovieId)
Definition Player.cpp:5703

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
183 {
184 if (!sSoundEntriesStore.LookupEntry(musicId))
185 {
186 handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, musicId);
187 return false;
188 }
189
190 Player* player = handler->GetPlayer();
191
192 player->PlayDirectMusic(musicId, player);
193
194 handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, musicId);
195 return true;
196 }
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
@ LANG_YOU_HEAR_SOUND
Definition Language.h:197
@ LANG_SOUND_NOT_EXIST
Definition Language.h:211
void PlayDirectMusic(uint32 music_id, Player *target=nullptr)
Definition Object.cpp:2927

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
156 {
157 if (!sSoundEntriesStore.LookupEntry(soundId))
158 {
159 handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, soundId);
160 return false;
161 }
162
163 Player* player = handler->GetPlayer();
164
165 Unit* unit = handler->getSelectedUnit();
166 if (!unit)
167 {
169 return false;
170 }
171
172 if (player->GetTarget())
173 unit->PlayDistanceSound(soundId, player);
174 else
175 unit->PlayDirectSound(soundId, player);
176
177 handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId);
178 return true;
179 }
ObjectGuid GetTarget() const
Definition Unit.h:844
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2908
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2900

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
253 {
254 handler->GetPlayer()->SendBuyError(BuyResult(error), nullptr, 0, 0);
255 return true;
256 }
BuyResult
Definition Item.h:140
void SendBuyError(BuyResult msg, Creature *creature, uint32 item, uint32 param)
Definition PlayerStorage.cpp:4063

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

Referenced by GetCommands().

◆ HandleDebugSendChannelNotifyCommand()

static bool debug_commandscript::HandleDebugSendChannelNotifyCommand ( ChatHandler handler,
ChatNotify  type 
)
inlinestatic
465 {
466 WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
467 data << type;
468 data << "test";
469 data << uint32(0);
470 data << uint32(0);
471 handler->GetSession()->SendPacket(&data);
472 return true;
473 }
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:252
@ 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
476 {
477 WorldPacket data;
478 ChatHandler::BuildChatPacket(data, type, LANG_UNIVERSAL, handler->GetPlayer(), handler->GetPlayer(), "testtest", 0, "chan");
479 handler->GetSession()->SendPacket(&data);
480 return true;
481 }
@ LANG_UNIVERSAL
Definition SharedDefines.h:746
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition Chat.cpp:265

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

Referenced by GetCommands().

◆ HandleDebugSendEquipErrorCommand()

static bool debug_commandscript::HandleDebugSendEquipErrorCommand ( ChatHandler handler,
InventoryResult  error 
)
inlinestatic
241 {
242 handler->GetPlayer()->SendEquipError(InventoryResult(error), nullptr, nullptr);
243 return true;
244 }
InventoryResult
Definition Item.h:46
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4020

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

Referenced by GetCommands().

◆ HandleDebugSendLargePacketCommand()

static bool debug_commandscript::HandleDebugSendLargePacketCommand ( ChatHandler handler)
inlinestatic
962 {
963 std::ostringstream ss;
964
965 while (ss.str().size() < 128000)
966 ss << "This is a dummy string to push the packet's size beyond 128000 bytes. ";
967
968 handler->SendSysMessage(ss.str().c_str());
969 return true;
970 }

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugSendOpcodeCommand()

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

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

Referenced by GetCommands().

◆ HandleDebugSendQuestPartyMsgCommand()

static bool debug_commandscript::HandleDebugSendQuestPartyMsgCommand ( ChatHandler handler,
QuestShareMessages  msg 
)
inlinestatic
484 {
485 handler->GetPlayer()->SendPushToPartyResponse(handler->GetPlayer(), msg);
486 return true;
487 }
void SendPushToPartyResponse(Player const *player, uint8 msg) const
Definition PlayerQuest.cpp:2435

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

Referenced by GetCommands().

◆ HandleDebugSendSellErrorCommand()

static bool debug_commandscript::HandleDebugSendSellErrorCommand ( ChatHandler handler,
SellResult  error 
)
inlinestatic
247 {
248 handler->GetPlayer()->SendSellError(SellResult(error), nullptr, ObjectGuid::Empty, 0);
249 return true;
250 }
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:4075

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

Referenced by GetCommands().

◆ HandleDebugSendSetPhaseShiftCommand()

static bool debug_commandscript::HandleDebugSendSetPhaseShiftCommand ( ChatHandler handler,
uint32  phaseShift 
)
inlinestatic
973 {
974 handler->GetSession()->SendSetPhaseShift(phaseShift);
975 return true;
976 }
void SendSetPhaseShift(uint32 phaseShift)
Definition MiscHandler.cpp:1618

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
220 {
222 data << uint8(0);
223 data << uint32(133); // Spell "Fireball"
224 data << uint8(result);
225
226 if (failArg1 || failArg2)
227 {
228 data << uint32(failArg1.value_or(0));
229 }
230
231 if (failArg2)
232 {
233 data << uint32(*failArg2);
234 }
235
236 handler->GetSession()->SendPacket(&data);
237 return true;
238 }
@ 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
1184 {
1185 WorldObject* target = handler->getSelectedObject();
1186 if (!target)
1187 {
1189 return false;
1190 }
1191
1192 if (bit > 32) // uint32 = 32 bits
1193 return false;
1194
1195 uint32 value = bit ? 1 << (bit - 1) : 0;
1196 target->SetUInt32Value(index, value);
1197
1198 handler->PSendSysMessage(LANG_SET_32BIT_FIELD, index, value);
1199 return true;
1200 }
@ LANG_SET_32BIT_FIELD
Definition Language.h:637
WorldObject * getSelectedObject() const
Definition Chat.cpp:397
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:639
Definition Object.h:472

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
1050 {
1051 Unit* unit = handler->getSelectedUnit();
1052 if (!unit)
1053 {
1055 return false;
1056 }
1057
1058 if (!state)
1059 {
1060 // reset all states
1061 for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
1062 unit->ModifyAuraState(s, false);
1063 return true;
1064 }
1065
1066 unit->ModifyAuraState(*state, apply);
1067 return true;
1068 }
AuraStateType
Definition SharedDefines.h:1299
Definition SmartEnum.h:47
void ModifyAuraState(AuraStateType flag, bool apply)
Definition Unit.cpp:10574

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
996 {
997 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
998
999 if (!i)
1000 return false;
1001
1002 if (index >= i->GetValuesCount())
1003 return false;
1004
1005 i->SetUInt32Value(index, value);
1006
1007 return true;
1008 }

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
1071 {
1072 WorldObject* target = handler->getSelectedObject();
1073 if (!target)
1074 {
1076 return false;
1077 }
1078
1079 if (index >= target->GetValuesCount())
1080 {
1081 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, target->GetGUID().ToString(), target->GetValuesCount());
1082 return false;
1083 }
1084
1085 if (value.holds_alternative<uint32>())
1086 {
1087 target->SetUInt32Value(index, value.get<uint32>());
1088 handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().ToString(), uint32(index), uint32(value));
1089 }
1090 else if (value.holds_alternative<float>())
1091 {
1092 target->SetFloatValue(index, value.get<float>());
1093 handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().ToString(), static_cast<float>(index), uint32(value));
1094 }
1095
1096 return true;
1097 }
@ LANG_SET_UINT_FIELD
Definition Language.h:629
@ LANG_SET_FLOAT_FIELD
Definition Language.h:631
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:726
constexpr decltype(auto) get()
Definition ChatCommandTags.h:284
constexpr bool holds_alternative() const
Definition ChatCommandTags.h:298

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

Referenced by GetCommands().

◆ HandleDebugSetVehicleIdCommand()

static bool debug_commandscript::HandleDebugSetVehicleIdCommand ( ChatHandler handler,
uint32  id 
)
inlinestatic
890 {
891 Unit* target = handler->getSelectedUnit();
892 if (!target || target->IsVehicle())
893 return false;
894
895 //target->SetVehicleId(id);
896 handler->PSendSysMessage("Vehicle id set to {}", id);
897 return true;
898 }

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
929 {
930 float x, y, z, o = handler->GetPlayer()->GetOrientation();
931 handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
932
933 if (!id)
934 return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
935
936 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
937
938 if (!ci)
939 return false;
940
941 VehicleEntry const* ve = sVehicleStore.LookupEntry(*id);
942
943 if (!ve)
944 return false;
945
946 Creature* v = new Creature();
947
948 Map* map = handler->GetPlayer()->GetMap();
949
950 if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, *id, x, y, z, o))
951 {
952 delete v;
953 return false;
954 }
955
956 map->AddToMap(v->ToCreature());
957
958 return true;
959 }
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
#define sObjectMgr
Definition ObjectMgr.h:1650
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:1138
ObjectGuid::LowType GenerateLowGuid()
Definition Map.h:480
bool AddToMap(T *, bool checkTransport=false)
Definition Map.cpp:305
Creature * ToCreature()
Definition Object.h:206
float GetCombatReach() const override
Definition Unit.h:860
uint32 GetPhaseMask() const
Definition Object.h:513
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:2359
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:2717
Definition CreatureData.h:186
float GetOrientation() const
Definition Position.h:124
Definition DBCStructure.h:2028

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().

◆ HandleDebugThreatListCommand()

static bool debug_commandscript::HandleDebugThreatListCommand ( ChatHandler handler)
inlinestatic
818 {
819 Creature* target = handler->getSelectedCreature();
820 if (!target || target->IsTotem() || target->IsPet())
821 return false;
822
823 auto const& threatList = target->GetThreatMgr().GetThreatList();
824 ThreatContainer::StorageType::const_iterator itr;
825 uint32 count = 0;
826
827 handler->PSendSysMessage("Threat list of {} ({})", target->GetName(), target->GetGUID().ToString());
828
829 for (itr = threatList.begin(); itr != threatList.end(); ++itr)
830 {
831 Unit* unit = (*itr)->getTarget();
832 if (!unit)
833 {
834 handler->PSendSysMessage(" {}. No Unit - threat {}", ++count, (*itr)->GetThreat());
835 continue;
836 }
837
838 handler->PSendSysMessage(" {}. {} ({}) - threat {}", ++count, unit->GetName(), unit->GetGUID().ToString(), (*itr)->GetThreat());
839 }
840
841 auto const& threatList2 = target->GetThreatMgr().GetOfflineThreatList();
842 for (itr = threatList2.begin(); itr != threatList2.end(); ++itr)
843 {
844 Unit* unit = (*itr)->getTarget();
845 if (!unit)
846 {
847 handler->PSendSysMessage(" {}. [offline] No Unit - threat {}", ++count, (*itr)->GetThreat());
848 continue;
849 }
850
851 handler->PSendSysMessage(" {}. [offline] {} ({}) - threat {}", ++count, unit->GetName(), unit->GetGUID().ToString(), (*itr)->GetThreat());
852 }
853
854 handler->SendSysMessage("End of threat list.");
855
856 return true;
857 }
ThreatContainer::StorageType const & GetOfflineThreatList() const
Definition ThreatMgr.h:274
ThreatContainer::StorageType const & GetThreatList() const
Definition ThreatMgr.h:273
bool IsPet() const
Definition Unit.h:780
ThreatMgr & GetThreatMgr()
Definition Unit.h:936
bool IsTotem() const
Definition Unit.h:782

References Object::GetGUID(), WorldObject::GetName(), ThreatMgr::GetOfflineThreatList(), ChatHandler::getSelectedCreature(), ThreatMgr::GetThreatList(), Unit::GetThreatMgr(), Unit::IsPet(), Unit::IsTotem(), ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugUnitStateCommand()

static bool debug_commandscript::HandleDebugUnitStateCommand ( ChatHandler handler,
uint32  unitState 
)
inlinestatic
1259 {
1260 Unit* target = handler->getSelectedUnit();
1261 if (!target)
1262 target = handler->GetSession()->GetPlayer();
1263
1264 target->ClearUnitState(target->GetUnitState());
1265 target->AddUnitState(unitState);
1266
1267 return true;
1268 }
void ClearUnitState(uint32 f)
Definition Unit.h:722
uint32 GetUnitState() const
Definition Unit.h:723
void AddUnitState(uint32 f)
Definition Unit.h:720

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
1149 {
1150 Unit* unit = handler->getSelectedUnit();
1151 if (!unit)
1152 {
1154 return false;
1155 }
1156
1157 if (!index)
1158 return true;
1159
1160 // check index
1161 if (unit->IsPlayer())
1162 {
1163 if (index >= PLAYER_END)
1164 return true;
1165 }
1166 else if (index >= UNIT_END)
1167 return true;
1168
1169 if (!value)
1170 {
1171 value = unit->GetUInt32Value(index);
1172
1173 handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().ToString(), index, *value);
1174 return true;
1175 }
1176
1177 unit->SetUInt32Value(index, *value);
1178
1179 handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().ToString(), index, *value);
1180 return true;
1181 }
@ LANG_UPDATE_CHANGE
Definition Language.h:626
@ LANG_UPDATE
Definition Language.h:625
@ UNIT_END
Definition UpdateFields.h:175
@ PLAYER_END
Definition UpdateFields.h:392

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

Referenced by GetCommands().

◆ HandleDebugUpdateWorldStateCommand()

static bool debug_commandscript::HandleDebugUpdateWorldStateCommand ( ChatHandler handler,
uint32  variable,
uint32  value 
)
inlinestatic
442 {
443 handler->GetPlayer()->SendUpdateWorldState(variable, value);
444 return true;
445 }
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition PlayerUpdates.cpp:2226

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

Referenced by GetCommands().

◆ HandleDebugVisibilityDataCommand()

static bool debug_commandscript::HandleDebugVisibilityDataCommand ( ChatHandler handler)
inlinestatic
1410 {
1411 Player* player = handler->GetPlayer();
1412 if (!player)
1413 return false;
1414
1415 std::array<uint32, NUM_CLIENT_OBJECT_TYPES> objectByTypeCount = {};
1416
1417 ObjectVisibilityContainer const& objectVisibilityContainer = player->GetObjectVisibilityContainer();
1418 for (auto const& kvPair : *objectVisibilityContainer.GetVisibleWorldObjectsMap())
1419 {
1420 WorldObject const* obj = kvPair.second;
1421 ++objectByTypeCount[obj->GetTypeId()];
1422 }
1423
1424 uint32 zoneWideVisibleObjectsInZone = 0;
1425 if (ZoneWideVisibleWorldObjectsSet const* farVisibleSet = player->GetMap()->GetZoneWideVisibleWorldObjectsForZone(player->GetZoneId()))
1426 zoneWideVisibleObjectsInZone = farVisibleSet->size();
1427
1428 handler->PSendSysMessage("Visibility Range: {}", player->GetVisibilityRange());
1429 handler->PSendSysMessage("Visible Creatures: {}", objectByTypeCount[TYPEID_UNIT]);
1430 handler->PSendSysMessage("Visible Players: {}", objectByTypeCount[TYPEID_PLAYER]);
1431 handler->PSendSysMessage("Visible GameObjects: {}", objectByTypeCount[TYPEID_GAMEOBJECT]);
1432 handler->PSendSysMessage("Visible DynamicObjects: {}", objectByTypeCount[TYPEID_DYNAMICOBJECT]);
1433 handler->PSendSysMessage("Visible Corpses: {}", objectByTypeCount[TYPEID_CORPSE]);
1434 handler->PSendSysMessage("Players we are visible to: {}", objectVisibilityContainer.GetVisiblePlayersMap().size());
1435 handler->PSendSysMessage("Zone wide visible objects in zone: {}", zoneWideVisibleObjectsInZone);
1436 return true;
1437 }
std::unordered_set< WorldObject * > ZoneWideVisibleWorldObjectsSet
Definition Map.h:153
@ 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:671
Definition ObjectVisibilityContainer.h:34
VisiblePlayersMap & GetVisiblePlayersMap()
Definition ObjectVisibilityContainer.h:54
TypeID GetTypeId() const
Definition Object.h:128
float GetVisibilityRange() const
Definition Object.cpp:1678
ObjectVisibilityContainer & GetObjectVisibilityContainer()
Definition Object.h:726
uint32 GetZoneId() const
Definition Object.cpp:3063

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
199 {
200 if (!visualId)
201 {
203 return false;
204 }
205
206 Player* player = handler->GetPlayer();
207 Unit* target = handler->getSelectedUnit();
208
209 if (!target)
210 {
211 player->SendPlaySpellVisual(visualId);
212 return true;
213 }
214
215 player->SendPlaySpellImpact(target->GetGUID(), visualId);
216 return true;
217 }
@ LANG_BAD_VALUE
Definition Language.h:148
void SendPlaySpellVisual(uint32 id)
Definition Unit.cpp:18943
void SendPlaySpellImpact(ObjectGuid guid, uint32 id)
Definition Unit.cpp:18951

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
1440 {
1441 if (!playerTarget)
1442 playerTarget = PlayerIdentifier::FromTargetOrSelf(handler);
1443
1444 if (!playerTarget)
1445 {
1447 return false;
1448 }
1449
1450 Player* player = playerTarget->GetConnectedPlayer();
1451
1452 if (!player)
1453 {
1455 return false;
1456 }
1457
1458 uint32 zoneId = player->GetZoneId();
1459 AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
1460 handler->PSendSysMessage("Player count in zone {} ({}): {}.", zoneId, (zoneEntry ? zoneEntry->area_name[LOCALE_enUS] : "<unknown>"), player->GetMap()->GetPlayerCountInZone(zoneId));
1461 return true;
1462 }
@ LOCALE_enUS
Definition Common.h:118
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:545
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition ChatCommandTags.h:184
Definition DBCStructure.h:519
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
1271 {
1272 Player* player = handler->GetSession()->GetPlayer();
1273
1274 if (!type)
1275 {
1276 // waypoint_data - id, point, X, Y, Z, O, delay, move_type, action, action_chance, wpguid
1277 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1278 }
1279
1280 if (type == "sai")
1281 {
1282 // waypoint (SAI) - entry, pointid, X, Y, Z, O, delay
1283 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1284 }
1285
1286 handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
1287 return true;
1288 }
#define LOG_INFO(filterType__,...)
Definition Log.h:166

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

Referenced by GetCommands().


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