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

Member Function Documentation

◆ GetCommands()

ChatCommandTable debug_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

53 {
54 static ChatCommandTable debugPlayCommandTable =
55 {
56 { "cinematic", HandleDebugPlayCinematicCommand, SEC_ADMINISTRATOR, Console::No },
57 { "movie", HandleDebugPlayMovieCommand, SEC_ADMINISTRATOR, Console::No },
58 { "sound", HandleDebugPlaySoundCommand, SEC_ADMINISTRATOR, Console::No },
59 { "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No },
60 { "visual", HandleDebugVisualCommand, SEC_ADMINISTRATOR, Console::No }
61 };
62 static ChatCommandTable debugSendCommandTable =
63 {
64 { "buyerror", HandleDebugSendBuyErrorCommand, SEC_ADMINISTRATOR, Console::No },
65 { "channelnotify", HandleDebugSendChannelNotifyCommand, SEC_ADMINISTRATOR, Console::No },
66 { "chatmessage", HandleDebugSendChatMsgCommand, SEC_ADMINISTRATOR, Console::No },
67 { "equiperror", HandleDebugSendEquipErrorCommand, SEC_ADMINISTRATOR, Console::No },
68 { "largepacket", HandleDebugSendLargePacketCommand, SEC_ADMINISTRATOR, Console::No },
69 { "opcode", HandleDebugSendOpcodeCommand, SEC_ADMINISTRATOR, Console::No },
70 { "qpartymsg", HandleDebugSendQuestPartyMsgCommand, SEC_ADMINISTRATOR, Console::No },
71 { "qinvalidmsg", HandleDebugSendQuestInvalidMsgCommand, SEC_ADMINISTRATOR, Console::No },
72 { "sellerror", HandleDebugSendSellErrorCommand, SEC_ADMINISTRATOR, Console::No },
73 { "setphaseshift", HandleDebugSendSetPhaseShiftCommand, SEC_ADMINISTRATOR, Console::No },
74 { "spellfail", HandleDebugSendSpellFailCommand, SEC_ADMINISTRATOR, Console::No }
75 };
76 static ChatCommandTable debugCommandTable =
77 {
78 { "setbit", HandleDebugSet32BitCommand, SEC_ADMINISTRATOR, Console::No },
79 { "threat", HandleDebugThreatListCommand, SEC_ADMINISTRATOR, Console::No },
80 { "hostile", HandleDebugHostileRefListCommand, SEC_ADMINISTRATOR, Console::No },
81 { "anim", HandleDebugAnimCommand, SEC_ADMINISTRATOR, Console::No },
82 { "arena", HandleDebugArenaCommand, SEC_ADMINISTRATOR, Console::No },
84 { "cooldown", HandleDebugCooldownCommand, SEC_ADMINISTRATOR, Console::No },
85 { "getitemstate", HandleDebugGetItemStateCommand, SEC_ADMINISTRATOR, Console::No },
86 { "lootrecipient", HandleDebugGetLootRecipientCommand, SEC_ADMINISTRATOR, Console::No },
87 { "getvalue", HandleDebugGetValueCommand, SEC_ADMINISTRATOR, Console::No },
88 { "getitemvalue", HandleDebugGetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
89 { "Mod32Value", HandleDebugMod32ValueCommand, SEC_ADMINISTRATOR, Console::No },
90 { "play", debugPlayCommandTable },
91 { "send", debugSendCommandTable },
92 { "setaurastate", HandleDebugSetAuraStateCommand, SEC_ADMINISTRATOR, Console::No },
93 { "setitemvalue", HandleDebugSetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
94 { "setvalue", HandleDebugSetValueCommand, SEC_ADMINISTRATOR, Console::No },
95 { "spawnvehicle", HandleDebugSpawnVehicleCommand, SEC_ADMINISTRATOR, Console::No },
96 { "setvid", HandleDebugSetVehicleIdCommand, SEC_ADMINISTRATOR, Console::No },
97 { "entervehicle", HandleDebugEnterVehicleCommand, SEC_ADMINISTRATOR, Console::No },
99 { "update", HandleDebugUpdateCommand, SEC_ADMINISTRATOR, Console::No },
100 { "itemexpire", HandleDebugItemExpireCommand, SEC_ADMINISTRATOR, Console::No },
101 { "areatriggers", HandleDebugAreaTriggersCommand, SEC_ADMINISTRATOR, Console::No },
102 { "lfg", HandleDebugDungeonFinderCommand, SEC_ADMINISTRATOR, Console::No },
103 { "los", HandleDebugLoSCommand, SEC_ADMINISTRATOR, Console::No },
104 { "moveflags", HandleDebugMoveflagsCommand, SEC_ADMINISTRATOR, Console::No },
105 { "unitstate", HandleDebugUnitStateCommand, SEC_ADMINISTRATOR, Console::No },
106 { "objectcount", HandleDebugObjectCountCommand, SEC_ADMINISTRATOR, Console::Yes},
107 { "dummy", HandleDebugDummyCommand, SEC_ADMINISTRATOR, Console::No }
108 };
109 static ChatCommandTable commandTable =
110 {
111 { "debug", debugCommandTable },
112 { "wpgps", HandleWPGPSCommand, SEC_ADMINISTRATOR, Console::No }
113 };
114 return commandTable;
115 }
@ SEC_ADMINISTRATOR
Definition: Common.h:60
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:46
static bool HandleDebugSet32BitCommand(ChatHandler *handler, uint32 index, uint8 bit)
Definition: cs_debug.cpp:1186
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, uint32 phaseShift)
Definition: cs_debug.cpp:975
static bool HandleDebugThreatListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:820
static bool HandleDebugGetItemStateCommand(ChatHandler *handler, std::string itemState)
Definition: cs_debug.cpp:510
static bool HandleDebugGetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index)
Definition: cs_debug.cpp:981
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler)
Definition: cs_debug.cpp:964
static bool HandleDebugSetValueCommand(ChatHandler *handler, uint32 index, Variant< uint32, float > value)
Definition: cs_debug.cpp:1073
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
Definition: cs_debug.cpp:1205
static bool HandleWPGPSCommand(ChatHandler *handler, Optional< std::string > type)
Definition: cs_debug.cpp:1273
static bool HandleDebugSendChatMsgCommand(ChatHandler *handler, ChatMsg type)
Definition: cs_debug.cpp:478
static bool HandleDebugAreaTriggersCommand(ChatHandler *handler)
Definition: cs_debug.cpp:450
static bool HandleDebugSendSellErrorCommand(ChatHandler *handler, SellResult error)
Definition: cs_debug.cpp:249
static bool HandleDebugGetValueCommand(ChatHandler *handler, uint32 index, bool isInt)
Definition: cs_debug.cpp:1102
static bool HandleDebugUpdateCommand(ChatHandler *handler, uint32 index, Optional< uint32 > value)
Definition: cs_debug.cpp:1151
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, uint32 id)
Definition: cs_debug.cpp:892
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler)
Definition: cs_debug.cpp:492
static bool HandleDebugLoSCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1037
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, uint32 movieId)
Definition: cs_debug.cpp:145
static bool HandleDebugUnitStateCommand(ChatHandler *handler, uint32 unitState)
Definition: cs_debug.cpp:1261
static bool HandleDebugPlaySoundCommand(ChatHandler *handler, uint32 soundId)
Definition: cs_debug.cpp:158
static bool HandleDebugDungeonFinderCommand(ChatHandler *)
Definition: cs_debug.cpp:775
static bool HandleDebugSendOpcodeCommand(ChatHandler *handler)
Definition: cs_debug.cpp:261
static bool HandleDebugDummyCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1371
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, InventoryResult error)
Definition: cs_debug.cpp:243
static bool HandleDebugHostileRefListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:862
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, uint32 entry, Optional< uint32 > id)
Definition: cs_debug.cpp:931
static bool HandleDebugCooldownCommand(ChatHandler *handler, uint32 spell_id, uint32 end_time, Optional< uint32 > item_id)
Definition: cs_debug.cpp:787
static bool HandleDebugPlayMusicCommand(ChatHandler *handler, uint32 musicId)
Definition: cs_debug.cpp:185
static bool HandleDebugBattlegroundCommand(ChatHandler *)
Definition: cs_debug.cpp:781
static bool HandleDebugSendBuyErrorCommand(ChatHandler *handler, BuyResult error)
Definition: cs_debug.cpp:255
static bool HandleDebugObjectCountCommand(ChatHandler *handler, Optional< uint32 > mapId)
Definition: cs_debug.cpp:1293
static bool HandleDebugSendChannelNotifyCommand(ChatHandler *handler, ChatNotify type)
Definition: cs_debug.cpp:467
static bool HandleDebugEnterVehicleCommand(ChatHandler *handler, uint32 entry, Optional< int8 > seatId)
Definition: cs_debug.cpp:903
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
Definition: cs_debug.cpp:998
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, uint32 index, uint32 value)
Definition: cs_debug.cpp:1133
static bool HandleDebugItemExpireCommand(ChatHandler *handler, ObjectGuid::LowType guid)
Definition: cs_debug.cpp:1013
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler *handler, QuestFailedReason msg)
Definition: cs_debug.cpp:504
static bool HandleDebugPlayCinematicCommand(ChatHandler *handler, uint32 cinematicId)
Definition: cs_debug.cpp:118
static bool HandleDebugVisualCommand(ChatHandler *handler, uint32 visualId)
Definition: cs_debug.cpp:201
static bool HandleDebugUpdateWorldStateCommand(ChatHandler *handler, uint32 variable, uint32 value)
Definition: cs_debug.cpp:444
static bool HandleDebugArenaCommand(ChatHandler *)
Definition: cs_debug.cpp:814
static bool HandleDebugAnimCommand(ChatHandler *handler, Emote emote)
Definition: cs_debug.cpp:1027
static bool HandleDebugSendSpellFailCommand(ChatHandler *handler, SpellCastResult result, Optional< uint32 > failArg1, Optional< uint32 > failArg2)
Definition: cs_debug.cpp:222
static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler *handler, QuestShareMessages msg)
Definition: cs_debug.cpp:486
static bool HandleDebugSetAuraStateCommand(ChatHandler *handler, Optional< AuraStateType > state, bool apply)
Definition: cs_debug.cpp:1052

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
1028 {
1029 if (Unit* unit = handler->getSelectedUnit())
1030 unit->HandleEmoteCommand(emote);
1031
1032 handler->PSendSysMessage("Playing emote {}", EnumUtils::ToConstant(emote));
1033
1034 return true;
1035 }
static char const * ToConstant(Enum value)
Definition: SmartEnum.h:123
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:210
Unit * getSelectedUnit() const
Definition: Chat.cpp:385
Definition: Unit.h:630

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

Referenced by GetCommands().

◆ HandleDebugAreaTriggersCommand()

static bool debug_commandscript::HandleDebugAreaTriggersCommand ( ChatHandler handler)
inlinestatic
451 {
452 Player* player = handler->GetSession()->GetPlayer();
453 if (!player->isDebugAreaTriggers)
454 {
456 player->isDebugAreaTriggers = true;
457 }
458 else
459 {
461 player->isDebugAreaTriggers = false;
462 }
463
464 return true;
465 }
@ LANG_DEBUG_AREATRIGGER_ON
Definition: Language.h:979
@ LANG_DEBUG_AREATRIGGER_OFF
Definition: Language.h:980
WorldSession * GetSession()
Definition: Chat.h:242
Definition: Player.h:1064
bool isDebugAreaTriggers
Definition: Player.h:2539
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
815 {
816 sBattlegroundMgr->ToggleArenaTesting();
817 return true;
818 }
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:186

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugBattlegroundCommand()

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

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugCooldownCommand()

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

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugDungeonFinderCommand()

static bool debug_commandscript::HandleDebugDungeonFinderCommand ( ChatHandler )
inlinestatic
776 {
777 sLFGMgr->ToggleTesting();
778 return true;
779 }
#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
904 {
905 Unit* target = handler->getSelectedUnit();
906 if (!target || !target->IsVehicle())
907 return false;
908
909 if (!seatId)
910 seatId = -1;
911
912 if (!entry)
913 handler->GetPlayer()->EnterVehicle(target, *seatId);
914 else
915 {
916 Creature* passenger = nullptr;
917 Acore::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
918 Acore::CreatureSearcher<Acore::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
919 Cell::VisitAllObjects(handler->GetPlayer(), searcher, 30.0f);
920
921 if (!passenger || passenger == target)
922 return false;
923
924 passenger->EnterVehicle(target, *seatId);
925 }
926
927 handler->PSendSysMessage("Unit {} entered vehicle %hhd", entry, *seatId);
928 return true;
929 }
Definition: Creature.h:43
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition: Unit.cpp:19640
bool IsVehicle() const
Definition: Unit.h:757
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:206
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
511 {
513 bool listQueue = false;
514 bool checkAll = false;
515
516 if (itemState == "unchanged")
517 state = ITEM_UNCHANGED;
518 else if (itemState == "changed")
519 state = ITEM_CHANGED;
520 else if (itemState == "new")
521 state = ITEM_NEW;
522 else if (itemState == "removed")
523 state = ITEM_REMOVED;
524 else if (itemState == "queue")
525 listQueue = true;
526 else if (itemState == "check_all")
527 checkAll = true;
528 else
529 return false;
530
531 Player* player = handler->getSelectedPlayer();
532 if (!player)
533 player = handler->GetPlayer();
534
535 if (!listQueue && !checkAll)
536 {
537 itemState = "The player has the following " + itemState + " items: ";
538 handler->SendSysMessage(itemState.c_str());
539 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
540 {
541 if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
542 continue;
543
544 if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
545 {
546 if (Bag* bag = item->ToBag())
547 {
548 for (uint8 j = 0; j < bag->GetBagSize(); ++j)
549 if (Item* item2 = bag->GetItemByPos(j))
550 if (item2->GetState() == state)
551 handler->PSendSysMessage("bag: 255 slot: {} {} owner: {}", item2->GetSlot(), item2->GetGUID().ToString(), item2->GetOwnerGUID().ToString());
552 }
553 else if (item->GetState() == state)
554 handler->PSendSysMessage("bag: 255 slot: {} {} owner: {}", item->GetSlot(), item->GetGUID().ToString(), item->GetOwnerGUID().ToString());
555 }
556 }
557 }
558
559 if (listQueue)
560 {
561 auto const& updateQueue = player->GetItemUpdateQueue();
562
563 for (auto const& item : updateQueue)
564 {
565 Bag* container = item->GetContainer();
566 uint8 bagSlot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
567
568 std::string st;
569 switch (item->GetState())
570 {
571 case ITEM_UNCHANGED:
572 st = "unchanged";
573 break;
574 case ITEM_CHANGED:
575 st = "changed";
576 break;
577 case ITEM_NEW:
578 st = "new";
579 break;
580 case ITEM_REMOVED:
581 st = "removed";
582 break;
583 }
584
585 handler->PSendSysMessage("bag: {} slot: {} guid: {} - state: {}", bagSlot, item->GetSlot(), item->GetGUID().ToString(), st);
586 }
587
588 if (updateQueue.empty())
589 handler->PSendSysMessage("The player's updatequeue is empty");
590 }
591
592 if (checkAll)
593 {
594 bool error = false;
595 auto const& updateQueue = player->GetItemUpdateQueue();
596 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
597 {
598 if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
599 continue;
600
601 Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
602 if (!item)
603 continue;
604
605 if (item->GetSlot() != i)
606 {
607 handler->PSendSysMessage("Item with slot {} and guid {} has an incorrect slot value: {}", i, item->GetGUID().ToString(), item->GetSlot());
608 error = true;
609 continue;
610 }
611
612 if (item->GetOwnerGUID() != player->GetGUID())
613 {
614 handler->PSendSysMessage("The item with slot {} {} does have non-matching owner guid {} and {}!", item->GetSlot(), item->GetGUID().ToString(), item->GetOwnerGUID().ToString(), player->GetGUID().ToString());
615 error = true;
616 continue;
617 }
618
619 if (Bag* container = item->GetContainer())
620 {
621 handler->PSendSysMessage("The item with slot {} {} has a container (slot: {}, {}) but shouldn't!", item->GetSlot(), item->GetGUID().ToString(), container->GetSlot(), container->GetGUID().ToString());
622 error = true;
623 continue;
624 }
625
626 if (item->IsInUpdateQueue())
627 {
628 uint16 qp = item->GetQueuePos();
629 if (qp > updateQueue.size())
630 {
631 handler->PSendSysMessage("The item with slot {} and guid {} has its queuepos ({}) larger than the update queue size! ", item->GetSlot(), item->GetGUID().ToString(), qp);
632 error = true;
633 continue;
634 }
635
636 if (!updateQueue[qp])
637 {
638 handler->PSendSysMessage("The item with slot {} and guid {} has its queuepos ({}) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().ToString(), qp);
639 error = true;
640 continue;
641 }
642
643 if (updateQueue[qp] != item)
644 {
645 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());
646 error = true;
647 continue;
648 }
649 }
650 else if (item->GetState() != ITEM_UNCHANGED)
651 {
652 handler->PSendSysMessage("The item with slot {} and guid {} is not in queue but should be (state: {})!", item->GetSlot(), item->GetGUID().ToString(), item->GetState());
653 error = true;
654 continue;
655 }
656
657 if (Bag* bag = item->ToBag())
658 {
659 for (uint8 j = 0; j < bag->GetBagSize(); ++j)
660 {
661 Item* item2 = bag->GetItemByPos(j);
662 if (!item2)
663 continue;
664
665 if (item2->GetSlot() != j)
666 {
667 handler->PSendSysMessage("The item in bag {} and slot {} (guid: {}) has an incorrect slot value: {}", bag->GetSlot(), j, item2->GetGUID().ToString(), item2->GetSlot());
668 error = true;
669 continue;
670 }
671
672 if (item2->GetOwnerGUID() != player->GetGUID())
673 {
674 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());
675 error = true;
676 continue;
677 }
678
679 Bag* container = item2->GetContainer();
680 if (!container)
681 {
682 handler->PSendSysMessage("The item in bag {} at slot {} {} has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString());
683 error = true;
684 continue;
685 }
686
687 if (container != bag)
688 {
689 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());
690 error = true;
691 continue;
692 }
693
694 if (item2->IsInUpdateQueue())
695 {
696 uint16 qp = item2->GetQueuePos();
697 if (qp > updateQueue.size())
698 {
699 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);
700 error = true;
701 continue;
702 }
703
704 if (!updateQueue[qp])
705 {
706 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);
707 error = true;
708 continue;
709 }
710
711 if (updateQueue[qp] != item2)
712 {
713 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());
714 error = true;
715 continue;
716 }
717 }
718 else if (item2->GetState() != ITEM_UNCHANGED)
719 {
720 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());
721 error = true;
722 continue;
723 }
724 }
725 }
726 }
727
728 uint32 index = 0;
729
730 for (auto const& item : updateQueue)
731 {
732 index++;
733
734 if (item->GetOwnerGUID() != player->GetGUID())
735 {
736 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()));
737 error = true;
738 continue;
739 }
740
741 if (item->GetQueuePos() != index)
742 {
743 handler->SendSysMessage(Acore::StringFormat("queue({}): For the item {}, the queuepos doesn't match it's position in the queue!", index, item->GetGUID().ToString()));
744 error = true;
745 continue;
746 }
747
748 if (item->GetState() == ITEM_REMOVED)
749 continue;
750
751 Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
752
753 if (!test)
754 {
755 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()));
756 error = true;
757 continue;
758 }
759
760 if (test != item)
761 {
762 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()));
763 error = true;
764 continue;
765 }
766 }
767
768 if (!error)
769 handler->SendSysMessage("All OK!");
770 }
771
772 return true;
773 }
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:373
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:784
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:441
std::vector< Item * > & GetItemUpdateQueue()
Definition: Player.h:1255

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
982 {
983 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
984
985 if (!i)
986 return false;
987
988 if (index >= i->GetValuesCount())
989 return false;
990
991 uint32 value = i->GetUInt32Value(index);
992
993 handler->PSendSysMessage("Item {}: value at {} is {}", guid, index, value);
994
995 return true;
996 }
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:407

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

Referenced by GetCommands().

◆ HandleDebugGetLootRecipientCommand()

static bool debug_commandscript::HandleDebugGetLootRecipientCommand ( ChatHandler handler)
inlinestatic
493 {
494 Creature* target = handler->getSelectedCreature();
495 if (!target)
496 return false;
497
498 handler->PSendSysMessage("Loot recipient for creature {} (GUID {}, SpawnID {}) is {}",
499 target->GetName(), target->GetGUID().ToString(), target->GetSpawnId(),
500 target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient");
501 return true;
502 }
Creature * getSelectedCreature() const
Definition: Chat.cpp:409
bool hasLootRecipient() const
Definition: Creature.h:231
Player * GetLootRecipient() const
Definition: Creature.cpp:1306
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:65
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
1103 {
1104 Unit* target = handler->getSelectedUnit();
1105 if (!target)
1106 {
1108 return false;
1109 }
1110
1111 ObjectGuid guid = target->GetGUID();
1112
1113 if (index >= target->GetValuesCount())
1114 {
1115 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, guid.ToString(), target->GetValuesCount());
1116 return false;
1117 }
1118
1119 if (isInt)
1120 {
1121 uint32 value = target->GetUInt32Value(index);
1122 handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.ToString(), index, value);
1123 }
1124 else
1125 {
1126 float value = target->GetFloatValue(index);
1127 handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.ToString(), index, value);
1128 }
1129
1130 return true;
1131 }
@ 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:215
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
863 {
864 Unit* target = handler->getSelectedUnit();
865 if (!target)
866 target = handler->GetSession()->GetPlayer();
867
868 HostileReference* ref = target->getHostileRefMgr().getFirst();
869 uint32 count = 0;
870
871 handler->PSendSysMessage("Hostile reference list of {} ({})", target->GetName(), target->GetGUID().ToString());
872
873 while (ref)
874 {
875 if (Unit* unit = ref->GetSource()->GetOwner())
876 {
877 handler->PSendSysMessage(" {}. {} {} ({}) - threat {}", ++count, (ref->IsOnline() ? "" : "[offline]"),
878 unit->GetName(), unit->GetGUID().ToString(), ref->GetThreat());
879 }
880 else
881 {
882 handler->PSendSysMessage(" {}. No Owner - threat {}", ++count, ref->GetThreat());
883 }
884
885 ref = ref->next();
886 }
887
888 handler->SendSysMessage("End of hostile reference list.");
889 return true;
890 }
FROM * GetSource() const
Definition: Reference.h:97
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
Unit * GetOwner() const
Definition: ThreatMgr.h:236
HostileRefMgr & getHostileRefMgr()
Definition: Unit.h:907

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

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
1038 {
1039 if (Unit* unit = handler->getSelectedUnit())
1040 {
1041 Player* player = handler->GetSession()->GetPlayer();
1042 handler->PSendSysMessage("Checking LoS {} -> {}:", player->GetName(), unit->GetName());
1043 handler->PSendSysMessage(" VMAP LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
1044 handler->PSendSysMessage(" GObj LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_ALL) ? "clear" : "obstructed");
1045 handler->PSendSysMessage("{} is {}in line of sight of {}.", unit->GetName(), (player->IsWithinLOSInMap(unit) ? "" : "not "), player->GetName());
1046 return true;
1047 }
1048
1049 return false;
1050 }
@ LINEOFSIGHT_CHECK_VMAP
Definition: Map.h:190
@ LINEOFSIGHT_CHECK_GOBJECT_ALL
Definition: Map.h:194
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
1134 {
1135 if (index >= handler->GetPlayer()->GetValuesCount())
1136 {
1137 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().ToString(), handler->GetPlayer()->GetValuesCount());
1138 return false;
1139 }
1140
1141 uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
1142
1143 currentValue += value;
1144 handler->GetPlayer()->SetUInt32Value(index, currentValue);
1145
1146 handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
1147
1148 return true;
1149 }
@ LANG_CHANGE_32BIT_FIELD
Definition: Language.h:633
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21317

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

1206 {
1207 Unit* target = handler->getSelectedUnit();
1208 if (!target)
1209 target = handler->GetPlayer();
1210
1211 if (!moveFlags)
1212 {
1215 }
1216 else
1217 {
1218 static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
1221
1222 bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
1223
1224 target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
1225 target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
1226 target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
1227 target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
1228 target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
1229 target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
1230 target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
1231
1233 *moveFlags &= ~MOVEMENTFLAG_FALLING;
1234
1235 if (*moveFlags & MOVEMENTFLAG_ROOT)
1236 {
1237 target->SetControlled(true, UNIT_STATE_ROOT);
1238 *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
1239 }
1240
1242 target->StopMoving();
1243
1244 if (unhandledFlag)
1245 target->SetUnitMovementFlags(*moveFlags);
1246
1247 if (moveFlagsExtra)
1248 {
1249 target->SetExtraUnitMovementFlags(*moveFlagsExtra);
1250 }
1251
1252 if (moveFlagsExtra || unhandledFlag)
1253 target->SendMovementFlagUpdate();
1254
1256 }
1257
1258 return true;
1259 }
@ 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:737
void SetUnitMovementFlags(uint32 f)
Definition: Unit.h:738
void SetExtraUnitMovementFlags(uint16 f)
Definition: Unit.h:744
void StopMoving()
Definition: Unit.cpp:16651
virtual bool SetSwim(bool enable)
Definition: Unit.cpp:20583
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18035
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:20608
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:736
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20565
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16705
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20652
virtual bool SetWalk(bool enable)
Definition: Unit.cpp:20551
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20674
uint16 GetExtraUnitMovementFlags() const
Definition: Unit.h:743
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:20630

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

References HandleDebugObjectCountMap(), and sMapMgr.

Referenced by GetCommands().

◆ HandleDebugObjectCountMap()

static void debug_commandscript::HandleDebugObjectCountMap ( ChatHandler handler,
Map map 
)
inlinestatic
1354 {
1355 handler->PSendSysMessage("Map Id: {} Name: '{}' Instance Id: {} Creatures: {} GameObjects: {} SetActive Objects: {}",
1356 map->GetId(), map->GetMapName(), map->GetInstanceId(),
1360
1361 CreatureCountWorker worker;
1363 visitor.Visit(map->GetObjectsStore());
1364
1365 handler->PSendSysMessage("Top Creatures count:");
1366
1367 for (auto&& p : worker.GetTopCreatureCount(5))
1368 handler->PSendSysMessage("Entry: {} Count: {}", p.first, p.second);
1369 }
std::uint64_t uint64
Definition: Define.h:106
std::size_t Size() const
Definition: TypeContainer.h:150
Definition: TypeContainerVisitor.h:84
Definition: GameObject.h:120
std::size_t GetActiveNonPlayersCount() const
Definition: Map.h:652
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:515
uint32 GetId() const
Definition: Map.h:377
const char * GetMapName() const
Definition: Map.cpp:2527
uint32 GetInstanceId() const
Definition: Map.h:417

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

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

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

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

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

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

Referenced by GetCommands().

◆ HandleDebugSendChannelNotifyCommand()

static bool debug_commandscript::HandleDebugSendChannelNotifyCommand ( ChatHandler handler,
ChatNotify  type 
)
inlinestatic
468 {
469 WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
470 data << type;
471 data << "test";
472 data << uint32(0);
473 data << uint32(0);
474 handler->GetSession()->SendPacket(&data);
475 return true;
476 }
@ 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
479 {
480 WorldPacket data;
481 ChatHandler::BuildChatPacket(data, type, LANG_UNIVERSAL, handler->GetPlayer(), handler->GetPlayer(), "testtest", 0, "chan");
482 handler->GetSession()->SendPacket(&data);
483 return true;
484 }
@ 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:264

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

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

Referenced by GetCommands().

◆ HandleDebugSendLargePacketCommand()

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

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugSendOpcodeCommand()

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

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
505 {
506 handler->GetPlayer()->SendCanTakeQuestResponse(msg);
507 return true;
508 }
void SendCanTakeQuestResponse(uint32 msg) const
Definition: PlayerQuest.cpp:2404

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

Referenced by GetCommands().

◆ HandleDebugSendQuestPartyMsgCommand()

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

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

Referenced by GetCommands().

◆ HandleDebugSendSellErrorCommand()

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

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

Referenced by GetCommands().

◆ HandleDebugSendSetPhaseShiftCommand()

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

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
223 {
225 data << uint8(0);
226 data << uint32(133); // Spell "Fireball"
227 data << uint8(result);
228
229 if (failArg1 || failArg2)
230 {
231 data << uint32(failArg1.value_or(0));
232 }
233
234 if (failArg2)
235 {
236 data << uint32(*failArg2);
237 }
238
239 handler->GetSession()->SendPacket(&data);
240 return true;
241 }
@ 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
1187 {
1188 WorldObject* target = handler->getSelectedObject();
1189 if (!target)
1190 {
1192 return false;
1193 }
1194
1195 if (bit > 32) // uint32 = 32 bits
1196 return false;
1197
1198 uint32 value = bit ? 1 << (bit - 1) : 0;
1199 target->SetUInt32Value(index, value);
1200
1201 handler->PSendSysMessage(LANG_SET_32BIT_FIELD, index, value);
1202 return true;
1203 }
@ LANG_SET_32BIT_FIELD
Definition: Language.h:631
WorldObject * getSelectedObject() const
Definition: Chat.cpp:396
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
1053 {
1054 Unit* unit = handler->getSelectedUnit();
1055 if (!unit)
1056 {
1058 return false;
1059 }
1060
1061 if (!state)
1062 {
1063 // reset all states
1064 for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
1065 unit->ModifyAuraState(s, false);
1066 return true;
1067 }
1068
1069 unit->ModifyAuraState(*state, apply);
1070 return true;
1071 }
AuraStateType
Definition: SharedDefines.h:1288
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:10497

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

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
1074 {
1075 WorldObject* target = handler->getSelectedObject();
1076 if (!target)
1077 {
1079 return false;
1080 }
1081
1082 if (index >= target->GetValuesCount())
1083 {
1084 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, target->GetGUID().ToString(), target->GetValuesCount());
1085 return false;
1086 }
1087
1088 if (value.holds_alternative<uint32>())
1089 {
1090 target->SetUInt32Value(index, value.get<uint32>());
1091 handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().ToString(), uint32(index), uint32(value));
1092 }
1093 else if (value.holds_alternative<float>())
1094 {
1095 target->SetFloatValue(index, value.get<float>());
1096 handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().ToString(), static_cast<float>(index), uint32(value));
1097 }
1098
1099 return true;
1100 }
@ LANG_SET_UINT_FIELD
Definition: Language.h:623
@ LANG_SET_FLOAT_FIELD
Definition: Language.h:625
constexpr decltype(auto) get()
Definition: ChatCommandTags.h:284
constexpr bool holds_alternative() const
Definition: ChatCommandTags.h:298
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
893 {
894 Unit* target = handler->getSelectedUnit();
895 if (!target || target->IsVehicle())
896 return false;
897
898 //target->SetVehicleId(id);
899 handler->PSendSysMessage("Vehicle id set to {}", id);
900 return true;
901 }

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
932 {
933 float x, y, z, o = handler->GetPlayer()->GetOrientation();
934 handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
935
936 if (!id)
937 return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
938
939 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
940
941 if (!ci)
942 return false;
943
944 VehicleEntry const* ve = sVehicleStore.LookupEntry(*id);
945
946 if (!ve)
947 return false;
948
949 Creature* v = new Creature();
950
951 Map* map = handler->GetPlayer()->GetMap();
952
953 if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, *id, x, y, z, o))
954 {
955 delete v;
956 return false;
957 }
958
959 map->AddToMap(v->ToCreature());
960
961 return true;
962 }
#define sObjectMgr
Definition: ObjectMgr.h:1635
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData *data=nullptr)
Definition: Creature.cpp:1126
Definition: CreatureData.h:186
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:119
float GetCombatReach() const override
Definition: Unit.h:828
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:636
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:558
Definition: DBCStructure.h:2026

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

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

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

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

Referenced by GetCommands().

◆ HandleDebugVisualCommand()

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

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

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

Referenced by GetCommands().