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
 
virtual std::vector< Acore::ChatCommands::ChatCommandBuilderGetCommands () const =0
 
- 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)
 

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

Member Function Documentation

◆ GetCommands()

ChatCommandTable debug_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

54 {
55 static ChatCommandTable debugPlayCommandTable =
56 {
57 { "cinematic", HandleDebugPlayCinematicCommand, SEC_ADMINISTRATOR, Console::No },
58 { "movie", HandleDebugPlayMovieCommand, SEC_ADMINISTRATOR, Console::No },
59 { "sound", HandleDebugPlaySoundCommand, SEC_ADMINISTRATOR, Console::No },
60 { "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No },
61 { "visual", HandleDebugVisualCommand, SEC_ADMINISTRATOR, Console::No }
62 };
63 static ChatCommandTable debugSendCommandTable =
64 {
65 { "buyerror", HandleDebugSendBuyErrorCommand, SEC_ADMINISTRATOR, Console::No },
66 { "channelnotify", HandleDebugSendChannelNotifyCommand, SEC_ADMINISTRATOR, Console::No },
67 { "chatmessage", HandleDebugSendChatMsgCommand, SEC_ADMINISTRATOR, Console::No },
68 { "equiperror", HandleDebugSendEquipErrorCommand, SEC_ADMINISTRATOR, Console::No },
69 { "largepacket", HandleDebugSendLargePacketCommand, SEC_ADMINISTRATOR, Console::No },
70 { "opcode", HandleDebugSendOpcodeCommand, SEC_ADMINISTRATOR, Console::No },
71 { "qpartymsg", HandleDebugSendQuestPartyMsgCommand, SEC_ADMINISTRATOR, Console::No },
72 { "qinvalidmsg", HandleDebugSendQuestInvalidMsgCommand, SEC_ADMINISTRATOR, Console::No },
73 { "sellerror", HandleDebugSendSellErrorCommand, SEC_ADMINISTRATOR, Console::No },
74 { "setphaseshift", HandleDebugSendSetPhaseShiftCommand, SEC_ADMINISTRATOR, Console::No },
75 { "spellfail", HandleDebugSendSpellFailCommand, SEC_ADMINISTRATOR, Console::No }
76 };
77 static ChatCommandTable debugCommandTable =
78 {
79 { "setbit", HandleDebugSet32BitCommand, SEC_ADMINISTRATOR, Console::No },
80 { "threat", HandleDebugThreatListCommand, SEC_ADMINISTRATOR, Console::No },
81 { "hostile", HandleDebugHostileRefListCommand, SEC_ADMINISTRATOR, Console::No },
82 { "anim", HandleDebugAnimCommand, SEC_ADMINISTRATOR, Console::No },
83 { "arena", HandleDebugArenaCommand, SEC_ADMINISTRATOR, Console::No },
85 { "cooldown", HandleDebugCooldownCommand, SEC_ADMINISTRATOR, Console::No },
86 { "getitemstate", HandleDebugGetItemStateCommand, SEC_ADMINISTRATOR, Console::No },
87 { "lootrecipient", HandleDebugGetLootRecipientCommand, SEC_ADMINISTRATOR, Console::No },
88 { "getvalue", HandleDebugGetValueCommand, SEC_ADMINISTRATOR, Console::No },
89 { "getitemvalue", HandleDebugGetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
90 { "Mod32Value", HandleDebugMod32ValueCommand, SEC_ADMINISTRATOR, Console::No },
91 { "play", debugPlayCommandTable },
92 { "send", debugSendCommandTable },
93 { "setaurastate", HandleDebugSetAuraStateCommand, SEC_ADMINISTRATOR, Console::No },
94 { "setitemvalue", HandleDebugSetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
95 { "setvalue", HandleDebugSetValueCommand, SEC_ADMINISTRATOR, Console::No },
96 { "spawnvehicle", HandleDebugSpawnVehicleCommand, SEC_ADMINISTRATOR, Console::No },
97 { "setvid", HandleDebugSetVehicleIdCommand, SEC_ADMINISTRATOR, Console::No },
98 { "entervehicle", HandleDebugEnterVehicleCommand, SEC_ADMINISTRATOR, Console::No },
100 { "update", HandleDebugUpdateCommand, SEC_ADMINISTRATOR, Console::No },
101 { "itemexpire", HandleDebugItemExpireCommand, SEC_ADMINISTRATOR, Console::No },
102 { "areatriggers", HandleDebugAreaTriggersCommand, SEC_ADMINISTRATOR, Console::No },
103 { "lfg", HandleDebugDungeonFinderCommand, SEC_ADMINISTRATOR, Console::No },
104 { "los", HandleDebugLoSCommand, SEC_ADMINISTRATOR, Console::No },
105 { "moveflags", HandleDebugMoveflagsCommand, SEC_ADMINISTRATOR, Console::No },
106 { "unitstate", HandleDebugUnitStateCommand, SEC_ADMINISTRATOR, Console::No },
107 { "objectcount", HandleDebugObjectCountCommand, SEC_ADMINISTRATOR, Console::Yes},
108 { "dummy", HandleDebugDummyCommand, SEC_ADMINISTRATOR, Console::No }
109 };
110 static ChatCommandTable commandTable =
111 {
112 { "debug", debugCommandTable },
113 { "wpgps", HandleWPGPSCommand, SEC_ADMINISTRATOR, Console::No }
114 };
115 return commandTable;
116 }
@ SEC_ADMINISTRATOR
Definition: Common.h:60
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:49
static bool HandleDebugSet32BitCommand(ChatHandler *handler, uint32 index, uint8 bit)
Definition: cs_debug.cpp:1187
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, uint32 phaseShift)
Definition: cs_debug.cpp:976
static bool HandleDebugThreatListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:821
static bool HandleDebugGetItemStateCommand(ChatHandler *handler, std::string itemState)
Definition: cs_debug.cpp:511
static bool HandleDebugGetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index)
Definition: cs_debug.cpp:982
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler)
Definition: cs_debug.cpp:965
static bool HandleDebugSetValueCommand(ChatHandler *handler, uint32 index, Variant< uint32, float > value)
Definition: cs_debug.cpp:1074
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
Definition: cs_debug.cpp:1206
static bool HandleWPGPSCommand(ChatHandler *handler, Optional< std::string > type)
Definition: cs_debug.cpp:1274
static bool HandleDebugSendChatMsgCommand(ChatHandler *handler, ChatMsg type)
Definition: cs_debug.cpp:479
static bool HandleDebugAreaTriggersCommand(ChatHandler *handler)
Definition: cs_debug.cpp:451
static bool HandleDebugSendSellErrorCommand(ChatHandler *handler, SellResult error)
Definition: cs_debug.cpp:250
static bool HandleDebugGetValueCommand(ChatHandler *handler, uint32 index, bool isInt)
Definition: cs_debug.cpp:1103
static bool HandleDebugUpdateCommand(ChatHandler *handler, uint32 index, Optional< uint32 > value)
Definition: cs_debug.cpp:1152
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, uint32 id)
Definition: cs_debug.cpp:893
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler)
Definition: cs_debug.cpp:493
static bool HandleDebugLoSCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1038
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, uint32 movieId)
Definition: cs_debug.cpp:146
static bool HandleDebugUnitStateCommand(ChatHandler *handler, uint32 unitState)
Definition: cs_debug.cpp:1262
static bool HandleDebugPlaySoundCommand(ChatHandler *handler, uint32 soundId)
Definition: cs_debug.cpp:159
static bool HandleDebugDungeonFinderCommand(ChatHandler *)
Definition: cs_debug.cpp:776
static bool HandleDebugSendOpcodeCommand(ChatHandler *handler)
Definition: cs_debug.cpp:262
static bool HandleDebugDummyCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1372
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, InventoryResult error)
Definition: cs_debug.cpp:244
static bool HandleDebugHostileRefListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:863
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, uint32 entry, Optional< uint32 > id)
Definition: cs_debug.cpp:932
static bool HandleDebugCooldownCommand(ChatHandler *handler, uint32 spell_id, uint32 end_time, Optional< uint32 > item_id)
Definition: cs_debug.cpp:788
static bool HandleDebugPlayMusicCommand(ChatHandler *handler, uint32 musicId)
Definition: cs_debug.cpp:186
static bool HandleDebugBattlegroundCommand(ChatHandler *)
Definition: cs_debug.cpp:782
static bool HandleDebugSendBuyErrorCommand(ChatHandler *handler, BuyResult error)
Definition: cs_debug.cpp:256
static bool HandleDebugObjectCountCommand(ChatHandler *handler, Optional< uint32 > mapId)
Definition: cs_debug.cpp:1294
static bool HandleDebugSendChannelNotifyCommand(ChatHandler *handler, ChatNotify type)
Definition: cs_debug.cpp:468
static bool HandleDebugEnterVehicleCommand(ChatHandler *handler, uint32 entry, Optional< int8 > seatId)
Definition: cs_debug.cpp:904
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
Definition: cs_debug.cpp:999
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, uint32 index, uint32 value)
Definition: cs_debug.cpp:1134
static bool HandleDebugItemExpireCommand(ChatHandler *handler, ObjectGuid::LowType guid)
Definition: cs_debug.cpp:1014
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler *handler, QuestFailedReason msg)
Definition: cs_debug.cpp:505
static bool HandleDebugPlayCinematicCommand(ChatHandler *handler, uint32 cinematicId)
Definition: cs_debug.cpp:119
static bool HandleDebugVisualCommand(ChatHandler *handler, uint32 visualId)
Definition: cs_debug.cpp:202
static bool HandleDebugUpdateWorldStateCommand(ChatHandler *handler, uint32 variable, uint32 value)
Definition: cs_debug.cpp:445
static bool HandleDebugArenaCommand(ChatHandler *)
Definition: cs_debug.cpp:815
static bool HandleDebugAnimCommand(ChatHandler *handler, Emote emote)
Definition: cs_debug.cpp:1028
static bool HandleDebugSendSpellFailCommand(ChatHandler *handler, SpellCastResult result, Optional< uint32 > failArg1, Optional< uint32 > failArg2)
Definition: cs_debug.cpp:223
static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler *handler, QuestShareMessages msg)
Definition: cs_debug.cpp:487
static bool HandleDebugSetAuraStateCommand(ChatHandler *handler, Optional< AuraStateType > state, bool apply)
Definition: cs_debug.cpp:1053

References HandleDebugAnimCommand(), HandleDebugAreaTriggersCommand(), HandleDebugArenaCommand(), HandleDebugBattlegroundCommand(), HandleDebugCooldownCommand(), HandleDebugDummyCommand(), HandleDebugDungeonFinderCommand(), HandleDebugEnterVehicleCommand(), HandleDebugGetItemStateCommand(), HandleDebugGetItemValueCommand(), HandleDebugGetLootRecipientCommand(), HandleDebugGetValueCommand(), HandleDebugHostileRefListCommand(), HandleDebugItemExpireCommand(), HandleDebugLoSCommand(), 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(), HandleDebugVisualCommand(), HandleWPGPSCommand(), and SEC_ADMINISTRATOR.

◆ HandleDebugAnimCommand()

static bool debug_commandscript::HandleDebugAnimCommand ( ChatHandler handler,
Emote  emote 
)
inlinestatic
1029 {
1030 if (Unit* unit = handler->getSelectedUnit())
1031 unit->HandleEmoteCommand(emote);
1032
1033 handler->PSendSysMessage("Playing emote {}", EnumUtils::ToConstant(emote));
1034
1035 return true;
1036 }
static char const * ToConstant(Enum value)
Definition: SmartEnum.h:124
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:213
Unit * getSelectedUnit() const
Definition: Chat.cpp:388
Definition: Unit.h:630

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

Referenced by GetCommands().

◆ HandleDebugAreaTriggersCommand()

static bool debug_commandscript::HandleDebugAreaTriggersCommand ( ChatHandler handler)
inlinestatic
452 {
453 Player* player = handler->GetSession()->GetPlayer();
454 if (!player->isDebugAreaTriggers)
455 {
457 player->isDebugAreaTriggers = true;
458 }
459 else
460 {
462 player->isDebugAreaTriggers = false;
463 }
464
465 return true;
466 }
@ LANG_DEBUG_AREATRIGGER_ON
Definition: Language.h:979
@ LANG_DEBUG_AREATRIGGER_OFF
Definition: Language.h:980
WorldSession * GetSession()
Definition: Chat.h:244
Definition: Player.h:1064
bool isDebugAreaTriggers
Definition: Player.h:2536
Player * GetPlayer() const
Definition: WorldSession.h:362

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
816 {
817 sBattlegroundMgr->ToggleArenaTesting();
818 return true;
819 }
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugBattlegroundCommand()

static bool debug_commandscript::HandleDebugBattlegroundCommand ( ChatHandler )
inlinestatic
783 {
784 sBattlegroundMgr->ToggleTesting();
785 return true;
786 }

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugCooldownCommand()

static bool debug_commandscript::HandleDebugCooldownCommand ( ChatHandler handler,
uint32  spell_id,
uint32  end_time,
Optional< uint32 item_id 
)
inlinestatic
789 {
790 Player* player = handler->GetPlayer();
791
792 if (!player || !spell_id || !end_time)
793 return false;
794
795 if (!sSpellMgr->GetSpellInfo(spell_id))
796 return false;
797
798 if (!item_id)
799 item_id = 0;
800 else if (!sItemStore.LookupEntry(*item_id))
801 return false;
802
803 if (end_time < player->GetSpellCooldownDelay(spell_id))
804 player->RemoveSpellCooldown(spell_id, true);
805
806 player->AddSpellCooldown(spell_id, *item_id, end_time, true, false);
807
808 WorldPacket data;
809 player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, end_time);
810 player->SendDirectMessage(&data);
811
812 return true;
813 }
DBCStorage< ItemEntry > sItemStore(Itemfmt)
@ SPELL_COOLDOWN_FLAG_NONE
Definition: Unit.h:616
#define sSpellMgr
Definition: SpellMgr.h:825
Player * GetPlayer() const
Definition: Chat.cpp:38
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:11085
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition: Player.cpp:3503
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition: Unit.cpp:20941
Definition: WorldPacket.h:27

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
1373 {
1374 handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing.");
1375 return true;
1376 }
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:162

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugDungeonFinderCommand()

static bool debug_commandscript::HandleDebugDungeonFinderCommand ( ChatHandler )
inlinestatic
777 {
778 sLFGMgr->ToggleTesting();
779 return true;
780 }
#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
905 {
906 Unit* target = handler->getSelectedUnit();
907 if (!target || !target->IsVehicle())
908 return false;
909
910 if (!seatId)
911 seatId = -1;
912
913 if (!entry)
914 handler->GetPlayer()->EnterVehicle(target, *seatId);
915 else
916 {
917 Creature* passenger = nullptr;
918 Acore::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
919 Acore::CreatureSearcher<Acore::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
920 Cell::VisitAllObjects(handler->GetPlayer(), searcher, 30.0f);
921
922 if (!passenger || passenger == target)
923 return false;
924
925 passenger->EnterVehicle(target, *seatId);
926 }
927
928 handler->PSendSysMessage("Unit {} entered vehicle %hhd", entry, *seatId);
929 return true;
930 }
Definition: Creature.h:46
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition: Unit.cpp:19585
bool IsVehicle() const
Definition: Unit.h:713
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:442
Definition: GridNotifiers.h:1461

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

Referenced by GetCommands().

◆ HandleDebugGetItemStateCommand()

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

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

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

Referenced by GetCommands().

◆ HandleDebugGetLootRecipientCommand()

static bool debug_commandscript::HandleDebugGetLootRecipientCommand ( ChatHandler handler)
inlinestatic
494 {
495 Creature* target = handler->getSelectedCreature();
496 if (!target)
497 return false;
498
499 handler->PSendSysMessage("Loot recipient for creature {} (GUID {}, SpawnID {}) is {}",
500 target->GetName(), target->GetGUID().ToString(), target->GetSpawnId(),
501 target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient");
502 return true;
503 }
Creature * getSelectedCreature() const
Definition: Chat.cpp:412
bool hasLootRecipient() const
Definition: Creature.h:232
Player * GetLootRecipient() const
Definition: Creature.cpp:1301
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:68
std::string const & GetName() const
Definition: Object.h:458

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
1104 {
1105 Unit* target = handler->getSelectedUnit();
1106 if (!target)
1107 {
1109 return false;
1110 }
1111
1112 ObjectGuid guid = target->GetGUID();
1113
1114 if (index >= target->GetValuesCount())
1115 {
1116 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, guid.ToString(), target->GetValuesCount());
1117 return false;
1118 }
1119
1120 if (isInt)
1121 {
1122 uint32 value = target->GetUInt32Value(index);
1123 handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.ToString(), index, value);
1124 }
1125 else
1126 {
1127 float value = target->GetFloatValue(index);
1128 handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.ToString(), index, value);
1129 }
1130
1131 return true;
1132 }
@ LANG_TOO_BIG_INDEX
Definition: Language.h:621
@ LANG_SELECT_CHAR_OR_CREATURE
Definition: Language.h:31
@ LANG_GET_UINT_FIELD
Definition: Language.h:627
@ LANG_GET_FLOAT_FIELD
Definition: Language.h:629
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:218
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317

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
864 {
865 Unit* target = handler->getSelectedUnit();
866 if (!target)
867 target = handler->GetSession()->GetPlayer();
868
869 HostileReference* ref = target->getHostileRefMgr().getFirst();
870 uint32 count = 0;
871
872 handler->PSendSysMessage("Hostile reference list of {} ({})", target->GetName(), target->GetGUID().ToString());
873
874 while (ref)
875 {
876 if (Unit* unit = ref->GetSource()->GetOwner())
877 {
878 handler->PSendSysMessage(" {}. {} {} ({}) - threat {}", ++count, (ref->IsOnline() ? "" : "[offline]"),
879 unit->GetName(), unit->GetGUID().ToString(), ref->GetThreat());
880 }
881 else
882 {
883 handler->PSendSysMessage(" {}. No Owner - threat {}", ++count, ref->GetThreat());
884 }
885
886 ref = ref->next();
887 }
888
889 handler->SendSysMessage("End of hostile reference list.");
890 return true;
891 }
FROM * GetSource() const
Definition: Reference.h:97
HostileReference * getFirst()
Definition: HostileRefMgr.h:60
Definition: ThreatMgr.h:49
float GetThreat() const
Definition: ThreatMgr.h:63
bool IsOnline() const
Definition: ThreatMgr.h:67
HostileReference * next()
Definition: ThreatMgr.h:116
Unit * GetOwner() const
Definition: ThreatMgr.h:237
HostileRefMgr & getHostileRefMgr()
Definition: Unit.h:843

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
1015 {
1016 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
1017
1018 if (!i)
1019 return false;
1020
1021 handler->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
1022 sScriptMgr->OnItemExpire(handler->GetPlayer(), i->GetTemplate());
1023
1024 return true;
1025 }
#define sScriptMgr
Definition: ScriptMgr.h:708
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:3029

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

Referenced by GetCommands().

◆ HandleDebugLoSCommand()

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

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

◆ HandleDebugMod32ValueCommand()

static bool debug_commandscript::HandleDebugMod32ValueCommand ( ChatHandler handler,
uint32  index,
uint32  value 
)
inlinestatic
1135 {
1136 if (index >= handler->GetPlayer()->GetValuesCount())
1137 {
1138 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().ToString(), handler->GetPlayer()->GetValuesCount());
1139 return false;
1140 }
1141
1142 uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
1143
1144 currentValue += value;
1145 handler->GetPlayer()->SetUInt32Value(index, currentValue);
1146
1147 handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
1148
1149 return true;
1150 }
@ LANG_CHANGE_32BIT_FIELD
Definition: Language.h:633
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21256

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

1207 {
1208 Unit* target = handler->getSelectedUnit();
1209 if (!target)
1210 target = handler->GetPlayer();
1211
1212 if (!moveFlags)
1213 {
1216 }
1217 else
1218 {
1219 static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
1222
1223 bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
1224
1225 target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
1226 target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
1227 target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
1228 target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
1229 target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
1230 target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
1231 target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
1232
1234 *moveFlags &= ~MOVEMENTFLAG_FALLING;
1235
1236 if (*moveFlags & MOVEMENTFLAG_ROOT)
1237 {
1238 target->SetControlled(true, UNIT_STATE_ROOT);
1239 *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
1240 }
1241
1243 target->StopMoving();
1244
1245 if (unhandledFlag)
1246 target->SetUnitMovementFlags(*moveFlags);
1247
1248 if (moveFlagsExtra)
1249 {
1250 target->SetExtraUnitMovementFlags(*moveFlagsExtra);
1251 }
1252
1253 if (moveFlagsExtra || unhandledFlag)
1254 target->SendMovementFlagUpdate();
1255
1257 }
1258
1259 return true;
1260 }
@ LANG_MOVEFLAGS_GET
Definition: Language.h:932
@ LANG_MOVEFLAGS_SET
Definition: Language.h:933
@ MOVEMENTFLAG_SPLINE_ENABLED
Definition: UnitDefines.h:371
@ MOVEMENTFLAG_WATERWALKING
Definition: UnitDefines.h:372
@ MOVEMENTFLAG_DISABLE_GRAVITY
Definition: UnitDefines.h:354
@ MOVEMENTFLAG_FALLING_SLOW
Definition: UnitDefines.h:373
@ MOVEMENTFLAG_CAN_FLY
Definition: UnitDefines.h:368
@ MOVEMENTFLAG_ROOT
Definition: UnitDefines.h:355
@ MOVEMENTFLAG_FALLING
Definition: UnitDefines.h:356
@ MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE
Movement flags that have change status opcodes associated for players.
Definition: UnitDefines.h:393
@ MOVEMENTFLAG_SWIMMING
Definition: UnitDefines.h:365
@ MOVEMENTFLAG_HOVER
Definition: UnitDefines.h:374
@ MOVEMENTFLAG_WALKING
Definition: UnitDefines.h:352
@ UNIT_STATE_ROOT
Definition: UnitDefines.h:159
uint32 GetUnitMovementFlags() const
Definition: Unit.h:1614
void SetUnitMovementFlags(uint32 f)
Definition: Unit.h:1615
void SetExtraUnitMovementFlags(uint16 f)
Definition: Unit.h:1621
void StopMoving()
Definition: Unit.cpp:16606
virtual bool SetSwim(bool enable)
Definition: Unit.cpp:20538
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:17990
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition: Unit.cpp:20563
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:1613
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20520
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16660
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20607
virtual bool SetWalk(bool enable)
Definition: Unit.cpp:20506
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20629
uint16 GetExtraUnitMovementFlags() const
Definition: Unit.h:1620
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for...
Definition: Unit.cpp:20585

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

References HandleDebugObjectCountMap(), and sMapMgr.

Referenced by GetCommands().

◆ HandleDebugObjectCountMap()

static void debug_commandscript::HandleDebugObjectCountMap ( ChatHandler handler,
Map map 
)
inlinestatic
1355 {
1356 handler->PSendSysMessage("Map Id: {} Name: '{}' Instance Id: {} Creatures: {} GameObjects: {} SetActive Objects: {}",
1357 map->GetId(), map->GetMapName(), map->GetInstanceId(),
1361
1362 CreatureCountWorker worker;
1364 visitor.Visit(map->GetObjectsStore());
1365
1366 handler->PSendSysMessage("Top Creatures count:");
1367
1368 for (auto&& p : worker.GetTopCreatureCount(5))
1369 handler->PSendSysMessage("Entry: {} Count: {}", p.first, p.second);
1370 }
std::uint64_t uint64
Definition: Define.h:106
std::size_t Size() const
Definition: TypeContainer.h:151
Definition: TypeContainerVisitor.h:84
Definition: GameObject.h:121
std::size_t GetActiveNonPlayersCount() const
Definition: Map.h:654
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:517
uint32 GetId() const
Definition: Map.h:379
const char * GetMapName() const
Definition: Map.cpp:2524
uint32 GetInstanceId() const
Definition: Map.h:419

References Map::GetActiveNonPlayersCount(), Map::GetId(), Map::GetInstanceId(), Map::GetMapName(), Map::GetObjectsStore(), debug_commandscript::CreatureCountWorker::GetTopCreatureCount(), 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
120 {
121 CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
122 if (!cineSeq)
123 {
124 handler->SendErrorMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
125 return false;
126 }
127
128 // Dump camera locations
129 if (std::vector<FlyByCamera> const* flyByCameras = GetFlyByCameras(cineSeq->cinematicCamera))
130 {
131 handler->PSendSysMessage("Waypoints for sequence {}, camera {}", cinematicId, cineSeq->cinematicCamera);
132 uint32 count = 1;
133 for (FlyByCamera const& cam : *flyByCameras)
134 {
135 handler->PSendSysMessage("{} - {}ms [{} ({} degrees)]", count, cam.timeStamp, cam.locations.ToString(), cam.locations.GetOrientation() * (180 / M_PI));
136 ++count;
137 }
138 handler->PSendSysMessage("{} waypoints dumped", flyByCameras->size());
139 }
140
141 handler->GetPlayer()->SendCinematicStart(cinematicId);
142 return true;
143 }
std::vector< FlyByCamera > const * GetFlyByCameras(uint32 cinematicCameraId)
Definition: M2Stores.cpp:255
DBCStorage< CinematicSequencesEntry > sCinematicSequencesStore(CinematicSequencesEntryfmt)
@ LANG_CINEMATIC_NOT_EXIST
Definition: Language.h:977
Definition: M2Stores.h:26
void SendCinematicStart(uint32 CinematicSequenceId) const
Definition: Player.cpp:5697
Definition: DBCStructure.h:713
uint32 cinematicCamera
Definition: DBCStructure.h:716

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
147 {
148 if (!sMovieStore.LookupEntry(movieId))
149 {
150 handler->SendErrorMessage(LANG_MOVIE_NOT_EXIST, movieId);
151 return false;
152 }
153
154 handler->GetPlayer()->SendMovieStart(movieId);
155 return true;
156 }
DBCStorage< MovieEntry > sMovieStore(MovieEntryfmt)
@ LANG_MOVIE_NOT_EXIST
Definition: Language.h:978
void SendMovieStart(uint32 MovieId)
Definition: Player.cpp:5708

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

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

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
257 {
258 handler->GetPlayer()->SendBuyError(BuyResult(error), nullptr, 0, 0);
259 return true;
260 }
BuyResult
Definition: Item.h:140
void SendBuyError(BuyResult msg, Creature *creature, uint32 item, uint32 param)
Definition: PlayerStorage.cpp:4070

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

Referenced by GetCommands().

◆ HandleDebugSendChannelNotifyCommand()

static bool debug_commandscript::HandleDebugSendChannelNotifyCommand ( ChatHandler handler,
ChatNotify  type 
)
inlinestatic
469 {
470 WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
471 data << type;
472 data << "test";
473 data << uint32(0);
474 data << uint32(0);
475 handler->GetSession()->SendPacket(&data);
476 return true;
477 }
@ SMSG_CHANNEL_NOTIFY
Definition: Opcodes.h:183
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:214

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

Referenced by GetCommands().

◆ HandleDebugSendChatMsgCommand()

static bool debug_commandscript::HandleDebugSendChatMsgCommand ( ChatHandler handler,
ChatMsg  type 
)
inlinestatic
480 {
481 WorldPacket data;
482 ChatHandler::BuildChatPacket(data, type, LANG_UNIVERSAL, handler->GetPlayer(), handler->GetPlayer(), "testtest", 0, "chan");
483 handler->GetSession()->SendPacket(&data);
484 return true;
485 }
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
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:267

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
245 {
246 handler->GetPlayer()->SendEquipError(InventoryResult(error), nullptr, nullptr);
247 return true;
248 }
InventoryResult
Definition: Item.h:46
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4027

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

Referenced by GetCommands().

◆ HandleDebugSendLargePacketCommand()

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

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugSendOpcodeCommand()

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

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

Referenced by GetCommands().

◆ HandleDebugSendQuestInvalidMsgCommand()

static bool debug_commandscript::HandleDebugSendQuestInvalidMsgCommand ( ChatHandler handler,
QuestFailedReason  msg 
)
inlinestatic
506 {
507 handler->GetPlayer()->SendCanTakeQuestResponse(msg);
508 return true;
509 }
void SendCanTakeQuestResponse(uint32 msg) const
Definition: PlayerQuest.cpp:2399

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

Referenced by GetCommands().

◆ HandleDebugSendQuestPartyMsgCommand()

static bool debug_commandscript::HandleDebugSendQuestPartyMsgCommand ( ChatHandler handler,
QuestShareMessages  msg 
)
inlinestatic
488 {
489 handler->GetPlayer()->SendPushToPartyResponse(handler->GetPlayer(), msg);
490 return true;
491 }
void SendPushToPartyResponse(Player const *player, uint8 msg) const
Definition: PlayerQuest.cpp:2429

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

Referenced by GetCommands().

◆ HandleDebugSendSellErrorCommand()

static bool debug_commandscript::HandleDebugSendSellErrorCommand ( ChatHandler handler,
SellResult  error 
)
inlinestatic
251 {
252 handler->GetPlayer()->SendSellError(SellResult(error), nullptr, ObjectGuid::Empty, 0);
253 return true;
254 }
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:4082

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

Referenced by GetCommands().

◆ HandleDebugSendSetPhaseShiftCommand()

static bool debug_commandscript::HandleDebugSendSetPhaseShiftCommand ( ChatHandler handler,
uint32  phaseShift 
)
inlinestatic
977 {
978 handler->GetSession()->SendSetPhaseShift(phaseShift);
979 return true;
980 }
void SendSetPhaseShift(uint32 phaseShift)
Definition: MiscHandler.cpp:1651

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
224 {
226 data << uint8(0);
227 data << uint32(133); // Spell "Fireball"
228 data << uint8(result);
229
230 if (failArg1 || failArg2)
231 {
232 data << uint32(failArg1.value_or(0));
233 }
234
235 if (failArg2)
236 {
237 data << uint32(*failArg2);
238 }
239
240 handler->GetSession()->SendPacket(&data);
241 return true;
242 }
@ 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
1188 {
1189 WorldObject* target = handler->getSelectedObject();
1190 if (!target)
1191 {
1193 return false;
1194 }
1195
1196 if (bit > 32) // uint32 = 32 bits
1197 return false;
1198
1199 uint32 value = bit ? 1 << (bit - 1) : 0;
1200 target->SetUInt32Value(index, value);
1201
1202 handler->PSendSysMessage(LANG_SET_32BIT_FIELD, index, value);
1203 return true;
1204 }
@ LANG_SET_32BIT_FIELD
Definition: Language.h:631
WorldObject * getSelectedObject() const
Definition: Chat.cpp:399
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
Definition: Object.h:405

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
1054 {
1055 Unit* unit = handler->getSelectedUnit();
1056 if (!unit)
1057 {
1059 return false;
1060 }
1061
1062 if (!state)
1063 {
1064 // reset all states
1065 for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
1066 unit->ModifyAuraState(s, false);
1067 return true;
1068 }
1069
1070 unit->ModifyAuraState(*state, apply);
1071 return true;
1072 }
AuraStateType
Definition: SharedDefines.h:1288
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:10459

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

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

Referenced by GetCommands().

◆ HandleDebugSetValueCommand()

static bool debug_commandscript::HandleDebugSetValueCommand ( ChatHandler handler,
uint32  index,
Variant< uint32, float >  value 
)
inlinestatic
1075 {
1076 WorldObject* target = handler->getSelectedObject();
1077 if (!target)
1078 {
1080 return false;
1081 }
1082
1083 if (index >= target->GetValuesCount())
1084 {
1085 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, target->GetGUID().ToString(), target->GetValuesCount());
1086 return false;
1087 }
1088
1089 if (value.holds_alternative<uint32>())
1090 {
1091 target->SetUInt32Value(index, value.get<uint32>());
1092 handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().ToString(), uint32(index), uint32(value));
1093 }
1094 else if (value.holds_alternative<float>())
1095 {
1096 target->SetFloatValue(index, value.get<float>());
1097 handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().ToString(), static_cast<float>(index), uint32(value));
1098 }
1099
1100 return true;
1101 }
@ LANG_SET_UINT_FIELD
Definition: Language.h:623
@ LANG_SET_FLOAT_FIELD
Definition: Language.h:625
constexpr decltype(auto) get()
Definition: ChatCommandTags.h:288
constexpr bool holds_alternative() const
Definition: ChatCommandTags.h:302
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:737

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
894 {
895 Unit* target = handler->getSelectedUnit();
896 if (!target || target->IsVehicle())
897 return false;
898
899 //target->SetVehicleId(id);
900 handler->PSendSysMessage("Vehicle id set to {}", id);
901 return true;
902 }

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
933 {
934 float x, y, z, o = handler->GetPlayer()->GetOrientation();
935 handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
936
937 if (!id)
938 return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
939
940 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
941
942 if (!ci)
943 return false;
944
945 VehicleEntry const* ve = sVehicleStore.LookupEntry(*id);
946
947 if (!ve)
948 return false;
949
950 Creature* v = new Creature();
951
952 Map* map = handler->GetPlayer()->GetMap();
953
954 if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, *id, x, y, z, o))
955 {
956 delete v;
957 return false;
958 }
959
960 map->AddToMap(v->ToCreature());
961
962 return true;
963 }
#define sObjectMgr
Definition: ObjectMgr.h:1623
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:1123
Definition: CreatureData.h:189
Creature * ToCreature()
Definition: Object.h:202
uint32 GetPhaseMask() const
Definition: Object.h:446
Map * GetMap() const
Definition: Object.h:531
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:2355
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:2699
float GetOrientation() const
Definition: Position.h:120
float GetCombatReach() const override
Definition: Unit.h:770
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:638
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:555
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, and Object::ToCreature().

Referenced by GetCommands().

◆ HandleDebugThreatListCommand()

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

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
1263 {
1264 Unit* target = handler->getSelectedUnit();
1265 if (!target)
1266 target = handler->GetSession()->GetPlayer();
1267
1268 target->ClearUnitState(target->GetUnitState());
1269 target->AddUnitState(unitState);
1270
1271 return true;
1272 }
void ClearUnitState(uint32 f)
Definition: Unit.h:674
uint32 GetUnitState() const
Definition: Unit.h:675
void AddUnitState(uint32 f)
Definition: Unit.h:672

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
1153 {
1154 Unit* unit = handler->getSelectedUnit();
1155 if (!unit)
1156 {
1158 return false;
1159 }
1160
1161 if (!index)
1162 return true;
1163
1164 // check index
1165 if (unit->IsPlayer())
1166 {
1167 if (index >= PLAYER_END)
1168 return true;
1169 }
1170 else if (index >= UNIT_END)
1171 return true;
1172
1173 if (!value)
1174 {
1175 value = unit->GetUInt32Value(index);
1176
1177 handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().ToString(), index, *value);
1178 return true;
1179 }
1180
1181 unit->SetUInt32Value(index, *value);
1182
1183 handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().ToString(), index, *value);
1184 return true;
1185 }
@ LANG_UPDATE_CHANGE
Definition: Language.h:620
@ LANG_UPDATE
Definition: Language.h:619
@ 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
446 {
447 handler->GetPlayer()->SendUpdateWorldState(variable, value);
448 return true;
449 }
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2193

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

Referenced by GetCommands().

◆ HandleDebugVisualCommand()

static bool debug_commandscript::HandleDebugVisualCommand ( ChatHandler handler,
uint32  visualId 
)
inlinestatic
203 {
204 if (!visualId)
205 {
207 return false;
208 }
209
210 Player* player = handler->GetPlayer();
211 Unit* target = handler->getSelectedUnit();
212
213 if (!target)
214 {
215 player->SendPlaySpellVisual(visualId);
216 return true;
217 }
218
219 player->SendPlaySpellImpact(target->GetGUID(), visualId);
220 return true;
221 }
@ LANG_BAD_VALUE
Definition: Language.h:147
void SendPlaySpellVisual(uint32 id)
Definition: Unit.cpp:18867
void SendPlaySpellImpact(ObjectGuid guid, uint32 id)
Definition: Unit.cpp:18875

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

Referenced by GetCommands().

◆ HandleWPGPSCommand()

static bool debug_commandscript::HandleWPGPSCommand ( ChatHandler handler,
Optional< std::string >  type 
)
inlinestatic
1275 {
1276 Player* player = handler->GetSession()->GetPlayer();
1277
1278 if (!type)
1279 {
1280 // waypoint_data - id, point, X, Y, Z, O, delay, move_type, action, action_chance, wpguid
1281 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1282 }
1283
1284 if (type == "sai")
1285 {
1286 // waypoint (SAI) - entry, pointid, X, Y, Z, O, delay
1287 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1288 }
1289
1290 handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
1291 return true;
1292 }
#define LOG_INFO(filterType__,...)
Definition: Log.h:164

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

Referenced by GetCommands().