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 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 { "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:49
static bool HandleDebugSet32BitCommand(ChatHandler *handler, uint32 index, uint8 bit)
Definition: cs_debug.cpp:1159
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, uint32 phaseShift)
Definition: cs_debug.cpp:948
static bool HandleDebugThreatListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:793
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:954
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler)
Definition: cs_debug.cpp:937
static bool HandleDebugSetValueCommand(ChatHandler *handler, uint32 index, Variant< uint32, float > value)
Definition: cs_debug.cpp:1046
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
Definition: cs_debug.cpp:1178
static bool HandleWPGPSCommand(ChatHandler *handler, Optional< std::string > type)
Definition: cs_debug.cpp:1246
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:1075
static bool HandleDebugUpdateCommand(ChatHandler *handler, uint32 index, Optional< uint32 > value)
Definition: cs_debug.cpp:1124
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, uint32 id)
Definition: cs_debug.cpp:865
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler)
Definition: cs_debug.cpp:492
static bool HandleDebugLoSCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1010
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, uint32 movieId)
Definition: cs_debug.cpp:145
static bool HandleDebugUnitStateCommand(ChatHandler *handler, uint32 unitState)
Definition: cs_debug.cpp:1234
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:1344
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, InventoryResult error)
Definition: cs_debug.cpp:243
static bool HandleDebugHostileRefListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:835
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, uint32 entry, Optional< uint32 > id)
Definition: cs_debug.cpp:904
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:1266
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:876
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
Definition: cs_debug.cpp:971
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, uint32 index, uint32 value)
Definition: cs_debug.cpp:1106
static bool HandleDebugItemExpireCommand(ChatHandler *handler, ObjectGuid::LowType guid)
Definition: cs_debug.cpp:986
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:787
static bool HandleDebugAnimCommand(ChatHandler *handler, Emote emote)
Definition: cs_debug.cpp:1000
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:1025

References HandleDebugAnimCommand(), HandleDebugAreaTriggersCommand(), HandleDebugArenaCommand(), HandleDebugBattlegroundCommand(), 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
1001 {
1002 if (Unit* unit = handler->getSelectedUnit())
1003 unit->HandleEmoteCommand(emote);
1004
1005 handler->PSendSysMessage("Playing emote {}", EnumUtils::ToConstant(emote));
1006
1007 return true;
1008 }
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
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:244
Definition: Player.h:1064
bool isDebugAreaTriggers
Definition: Player.h:2533
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
788 {
789 sBattlegroundMgr->ToggleArenaTesting();
790 return true;
791 }
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188

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

◆ HandleDebugDummyCommand()

static bool debug_commandscript::HandleDebugDummyCommand ( ChatHandler handler)
inlinestatic
1345 {
1346 handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing.");
1347 return true;
1348 }
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
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
877 {
878 Unit* target = handler->getSelectedUnit();
879 if (!target || !target->IsVehicle())
880 return false;
881
882 if (!seatId)
883 seatId = -1;
884
885 if (!entry)
886 handler->GetPlayer()->EnterVehicle(target, *seatId);
887 else
888 {
889 Creature* passenger = nullptr;
890 Acore::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
891 Acore::CreatureSearcher<Acore::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
892 Cell::VisitAllObjects(handler->GetPlayer(), searcher, 30.0f);
893
894 if (!passenger || passenger == target)
895 return false;
896
897 passenger->EnterVehicle(target, *seatId);
898 }
899
900 handler->PSendSysMessage("Unit {} entered vehicle %hhd", entry, *seatId);
901 return true;
902 }
Player * GetPlayer() const
Definition: Chat.cpp:38
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
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: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
955 {
956 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
957
958 if (!i)
959 return false;
960
961 if (index >= i->GetValuesCount())
962 return false;
963
964 uint32 value = i->GetUInt32Value(index);
965
966 handler->PSendSysMessage("Item {}: value at {} is {}", guid, index, value);
967
968 return true;
969 }
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
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: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
1076 {
1077 Unit* target = handler->getSelectedUnit();
1078 if (!target)
1079 {
1081 return false;
1082 }
1083
1084 ObjectGuid guid = target->GetGUID();
1085
1086 if (index >= target->GetValuesCount())
1087 {
1088 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, guid.ToString(), target->GetValuesCount());
1089 return false;
1090 }
1091
1092 if (isInt)
1093 {
1094 uint32 value = target->GetUInt32Value(index);
1095 handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.ToString(), index, value);
1096 }
1097 else
1098 {
1099 float value = target->GetFloatValue(index);
1100 handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.ToString(), index, value);
1101 }
1102
1103 return true;
1104 }
@ 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
836 {
837 Unit* target = handler->getSelectedUnit();
838 if (!target)
839 target = handler->GetSession()->GetPlayer();
840
841 HostileReference* ref = target->getHostileRefMgr().getFirst();
842 uint32 count = 0;
843
844 handler->PSendSysMessage("Hostile reference list of {} ({})", target->GetName(), target->GetGUID().ToString());
845
846 while (ref)
847 {
848 if (Unit* unit = ref->GetSource()->GetOwner())
849 {
850 handler->PSendSysMessage(" {}. {} {} ({}) - threat {}", ++count, (ref->IsOnline() ? "" : "[offline]"),
851 unit->GetName(), unit->GetGUID().ToString(), ref->GetThreat());
852 }
853 else
854 {
855 handler->PSendSysMessage(" {}. No Owner - threat {}", ++count, ref->GetThreat());
856 }
857
858 ref = ref->next();
859 }
860
861 handler->SendSysMessage("End of hostile reference list.");
862 return true;
863 }
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
987 {
988 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
989
990 if (!i)
991 return false;
992
993 handler->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
994 sScriptMgr->OnItemExpire(handler->GetPlayer(), i->GetTemplate());
995
996 return true;
997 }
#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
1011 {
1012 if (Unit* unit = handler->getSelectedUnit())
1013 {
1014 Player* player = handler->GetSession()->GetPlayer();
1015 handler->PSendSysMessage("Checking LoS {} -> {}:", player->GetName(), unit->GetName());
1016 handler->PSendSysMessage(" VMAP LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
1017 handler->PSendSysMessage(" GObj LoS: {}", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_ALL) ? "clear" : "obstructed");
1018 handler->PSendSysMessage("{} is {}in line of sight of {}.", unit->GetName(), (player->IsWithinLOSInMap(unit) ? "" : "not "), player->GetName());
1019 return true;
1020 }
1021
1022 return false;
1023 }
@ 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
1107 {
1108 if (index >= handler->GetPlayer()->GetValuesCount())
1109 {
1110 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().ToString(), handler->GetPlayer()->GetValuesCount());
1111 return false;
1112 }
1113
1114 uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
1115
1116 currentValue += value;
1117 handler->GetPlayer()->SetUInt32Value(index, currentValue);
1118
1119 handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
1120
1121 return true;
1122 }
@ LANG_CHANGE_32BIT_FIELD
Definition: Language.h:633
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21242

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

1179 {
1180 Unit* target = handler->getSelectedUnit();
1181 if (!target)
1182 target = handler->GetPlayer();
1183
1184 if (!moveFlags)
1185 {
1188 }
1189 else
1190 {
1191 static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
1194
1195 bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
1196
1197 target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
1198 target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
1199 target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
1200 target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
1201 target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
1202 target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
1203 target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
1204
1206 *moveFlags &= ~MOVEMENTFLAG_FALLING;
1207
1208 if (*moveFlags & MOVEMENTFLAG_ROOT)
1209 {
1210 target->SetControlled(true, UNIT_STATE_ROOT);
1211 *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
1212 }
1213
1215 target->StopMoving();
1216
1217 if (unhandledFlag)
1218 target->SetUnitMovementFlags(*moveFlags);
1219
1220 if (moveFlagsExtra)
1221 {
1222 target->SetExtraUnitMovementFlags(*moveFlagsExtra);
1223 }
1224
1225 if (moveFlagsExtra || unhandledFlag)
1226 target->SendMovementFlagUpdate();
1227
1229 }
1230
1231 return true;
1232 }
@ 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:20524
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:20549
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:1613
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20506
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16660
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20593
virtual bool SetWalk(bool enable)
Definition: Unit.cpp:20492
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20615
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:20571

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
1267 {
1268 if (mapId)
1269 {
1270 sMapMgr->DoForAllMapsWithMapId(mapId.value(),
1271 [handler](Map* map) -> void
1272 {
1273 HandleDebugObjectCountMap(handler, map);
1274 }
1275 );
1276 }
1277 else
1278 {
1279 sMapMgr->DoForAllMaps(
1280 [handler](Map* map) -> void
1281 {
1282 HandleDebugObjectCountMap(handler, map);
1283 }
1284 );
1285 }
1286
1287 return true;
1288 }
#define sMapMgr
Definition: MapMgr.h:221
Definition: Map.h:313
static void HandleDebugObjectCountMap(ChatHandler *handler, Map *map)
Definition: cs_debug.cpp:1326

References HandleDebugObjectCountMap(), and sMapMgr.

Referenced by GetCommands().

◆ HandleDebugObjectCountMap()

static void debug_commandscript::HandleDebugObjectCountMap ( ChatHandler handler,
Map map 
)
inlinestatic
1327 {
1328 handler->PSendSysMessage("Map Id: {} Name: '{}' Instance Id: {} Creatures: {} GameObjects: {} SetActive Objects: {}",
1329 map->GetId(), map->GetMapName(), map->GetInstanceId(),
1333
1334 CreatureCountWorker worker;
1336 visitor.Visit(map->GetObjectsStore());
1337
1338 handler->PSendSysMessage("Top Creatures count:");
1339
1340 for (auto&& p : worker.GetTopCreatureCount(5))
1341 handler->PSendSysMessage("Entry: {} Count: {}", p.first, p.second);
1342 }
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
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:255
Definition: M2Stores.h:26
void SendCinematicStart(uint32 CinematicSequenceId) const
Definition: Player.cpp:5654
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
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:5665

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:2911

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:2887
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition: Object.cpp:2879
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
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:4070

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
Definition: WorldPacket.h:27
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: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
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:4027

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

Referenced by GetCommands().

◆ HandleDebugSendLargePacketCommand()

static bool debug_commandscript::HandleDebugSendLargePacketCommand ( ChatHandler handler)
inlinestatic
938 {
939 std::ostringstream ss;
940
941 while (ss.str().size() < 128000)
942 ss << "This is a dummy string to push the packet's size beyond 128000 bytes. ";
943
944 handler->SendSysMessage(ss.str().c_str());
945 return true;
946 }

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: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:1975

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:2399

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:2429

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:4082

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

Referenced by GetCommands().

◆ HandleDebugSendSetPhaseShiftCommand()

static bool debug_commandscript::HandleDebugSendSetPhaseShiftCommand ( ChatHandler handler,
uint32  phaseShift 
)
inlinestatic
949 {
950 handler->GetSession()->SendSetPhaseShift(phaseShift);
951 return true;
952 }
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
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
1160 {
1161 WorldObject* target = handler->getSelectedObject();
1162 if (!target)
1163 {
1165 return false;
1166 }
1167
1168 if (bit > 32) // uint32 = 32 bits
1169 return false;
1170
1171 uint32 value = bit ? 1 << (bit - 1) : 0;
1172 target->SetUInt32Value(index, value);
1173
1174 handler->PSendSysMessage(LANG_SET_32BIT_FIELD, index, value);
1175 return true;
1176 }
@ 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
1026 {
1027 Unit* unit = handler->getSelectedUnit();
1028 if (!unit)
1029 {
1031 return false;
1032 }
1033
1034 if (!state)
1035 {
1036 // reset all states
1037 for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
1038 unit->ModifyAuraState(s, false);
1039 return true;
1040 }
1041
1042 unit->ModifyAuraState(*state, apply);
1043 return true;
1044 }
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
972 {
973 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
974
975 if (!i)
976 return false;
977
978 if (index >= i->GetValuesCount())
979 return false;
980
981 i->SetUInt32Value(index, value);
982
983 return true;
984 }

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
1047 {
1048 WorldObject* target = handler->getSelectedObject();
1049 if (!target)
1050 {
1052 return false;
1053 }
1054
1055 if (index >= target->GetValuesCount())
1056 {
1057 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, target->GetGUID().ToString(), target->GetValuesCount());
1058 return false;
1059 }
1060
1061 if (value.holds_alternative<uint32>())
1062 {
1063 target->SetUInt32Value(index, value.get<uint32>());
1064 handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().ToString(), uint32(index), uint32(value));
1065 }
1066 else if (value.holds_alternative<float>())
1067 {
1068 target->SetFloatValue(index, value.get<float>());
1069 handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().ToString(), static_cast<float>(index), uint32(value));
1070 }
1071
1072 return true;
1073 }
@ 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
866 {
867 Unit* target = handler->getSelectedUnit();
868 if (!target || target->IsVehicle())
869 return false;
870
871 //target->SetVehicleId(id);
872 handler->PSendSysMessage("Vehicle id set to {}", id);
873 return true;
874 }

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
905 {
906 float x, y, z, o = handler->GetPlayer()->GetOrientation();
907 handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
908
909 if (!id)
910 return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
911
912 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
913
914 if (!ci)
915 return false;
916
917 VehicleEntry const* ve = sVehicleStore.LookupEntry(*id);
918
919 if (!ve)
920 return false;
921
922 Creature* v = new Creature();
923
924 Map* map = handler->GetPlayer()->GetMap();
925
926 if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, *id, x, y, z, o))
927 {
928 delete v;
929 return false;
930 }
931
932 map->AddToMap(v->ToCreature());
933
934 return true;
935 }
#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:2352
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:2696
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
794 {
795 Creature* target = handler->getSelectedCreature();
796 if (!target || target->IsTotem() || target->IsPet())
797 return false;
798
799 auto const& threatList = target->GetThreatMgr().GetThreatList();
800 ThreatContainer::StorageType::const_iterator itr;
801 uint32 count = 0;
802
803 handler->PSendSysMessage("Threat list of {} ({})", target->GetName(), target->GetGUID().ToString());
804
805 for (itr = threatList.begin(); itr != threatList.end(); ++itr)
806 {
807 Unit* unit = (*itr)->getTarget();
808 if (!unit)
809 {
810 handler->PSendSysMessage(" {}. No Unit - threat {}", ++count, (*itr)->GetThreat());
811 continue;
812 }
813
814 handler->PSendSysMessage(" {}. {} ({}) - threat {}", ++count, unit->GetName(), unit->GetGUID().ToString(), (*itr)->GetThreat());
815 }
816
817 auto const& threatList2 = target->GetThreatMgr().GetOfflineThreatList();
818 for (itr = threatList2.begin(); itr != threatList2.end(); ++itr)
819 {
820 Unit* unit = (*itr)->getTarget();
821 if (!unit)
822 {
823 handler->PSendSysMessage(" {}. [offline] No Unit - threat {}", ++count, (*itr)->GetThreat());
824 continue;
825 }
826
827 handler->PSendSysMessage(" {}. [offline] {} ({}) - threat {}", ++count, unit->GetName(), unit->GetGUID().ToString(), (*itr)->GetThreat());
828 }
829
830 handler->SendSysMessage("End of threat list.");
831
832 return true;
833 }
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
1235 {
1236 Unit* target = handler->getSelectedUnit();
1237 if (!target)
1238 target = handler->GetSession()->GetPlayer();
1239
1240 target->ClearUnitState(target->GetUnitState());
1241 target->AddUnitState(unitState);
1242
1243 return true;
1244 }
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
1125 {
1126 Unit* unit = handler->getSelectedUnit();
1127 if (!unit)
1128 {
1130 return false;
1131 }
1132
1133 if (!index)
1134 return true;
1135
1136 // check index
1137 if (unit->IsPlayer())
1138 {
1139 if (index >= PLAYER_END)
1140 return true;
1141 }
1142 else if (index >= UNIT_END)
1143 return true;
1144
1145 if (!value)
1146 {
1147 value = unit->GetUInt32Value(index);
1148
1149 handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().ToString(), index, *value);
1150 return true;
1151 }
1152
1153 unit->SetUInt32Value(index, *value);
1154
1155 handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().ToString(), index, *value);
1156 return true;
1157 }
@ 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:2193

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: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
1247 {
1248 Player* player = handler->GetSession()->GetPlayer();
1249
1250 if (!type)
1251 {
1252 // waypoint_data - id, point, X, Y, Z, O, delay, move_type, action, action_chance, wpguid
1253 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1254 }
1255
1256 if (type == "sai")
1257 {
1258 // waypoint (SAI) - entry, pointid, X, Y, Z, O, delay
1259 LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
1260 }
1261
1262 handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
1263 return true;
1264 }
#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().