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
 

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)
 
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)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ debug_commandscript()

debug_commandscript::debug_commandscript ( )
inline
53: CommandScript("debug_commandscript") { }
Definition: CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable debug_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

56 {
57 static ChatCommandTable debugPlayCommandTable =
58 {
59 { "cinematic", HandleDebugPlayCinematicCommand, SEC_ADMINISTRATOR, Console::No },
60 { "movie", HandleDebugPlayMovieCommand, SEC_ADMINISTRATOR, Console::No },
61 { "sound", HandleDebugPlaySoundCommand, SEC_ADMINISTRATOR, Console::No },
62 { "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No },
63 { "visual", HandleDebugVisualCommand, SEC_ADMINISTRATOR, Console::No }
64 };
65 static ChatCommandTable debugSendCommandTable =
66 {
67 { "buyerror", HandleDebugSendBuyErrorCommand, SEC_ADMINISTRATOR, Console::No },
68 { "channelnotify", HandleDebugSendChannelNotifyCommand, SEC_ADMINISTRATOR, Console::No },
69 { "chatmmessage", HandleDebugSendChatMsgCommand, SEC_ADMINISTRATOR, Console::No },
70 { "equiperror", HandleDebugSendEquipErrorCommand, SEC_ADMINISTRATOR, Console::No },
71 { "largepacket", HandleDebugSendLargePacketCommand, SEC_ADMINISTRATOR, Console::No },
72 { "opcode", HandleDebugSendOpcodeCommand, SEC_ADMINISTRATOR, Console::No },
73 { "qpartymsg", HandleDebugSendQuestPartyMsgCommand, SEC_ADMINISTRATOR, Console::No },
74 { "qinvalidmsg", HandleDebugSendQuestInvalidMsgCommand, SEC_ADMINISTRATOR, Console::No },
75 { "sellerror", HandleDebugSendSellErrorCommand, SEC_ADMINISTRATOR, Console::No },
76 { "setphaseshift", HandleDebugSendSetPhaseShiftCommand, SEC_ADMINISTRATOR, Console::No },
77 { "spellfail", HandleDebugSendSpellFailCommand, SEC_ADMINISTRATOR, Console::No }
78 };
79 static ChatCommandTable debugCommandTable =
80 {
81 { "setbit", HandleDebugSet32BitCommand, SEC_ADMINISTRATOR, Console::No },
82 { "threat", HandleDebugThreatListCommand, SEC_ADMINISTRATOR, Console::No },
83 { "hostile", HandleDebugHostileRefListCommand, SEC_ADMINISTRATOR, Console::No },
84 { "anim", HandleDebugAnimCommand, SEC_ADMINISTRATOR, Console::No },
85 { "arena", HandleDebugArenaCommand, SEC_ADMINISTRATOR, Console::No },
87 { "getitemstate", HandleDebugGetItemStateCommand, SEC_ADMINISTRATOR, Console::No },
88 { "lootrecipient", HandleDebugGetLootRecipientCommand, SEC_ADMINISTRATOR, Console::No },
89 { "getvalue", HandleDebugGetValueCommand, SEC_ADMINISTRATOR, Console::No },
90 { "getitemvalue", HandleDebugGetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
91 { "Mod32Value", HandleDebugMod32ValueCommand, SEC_ADMINISTRATOR, Console::No },
92 { "play", debugPlayCommandTable },
93 { "send", debugSendCommandTable },
94 { "setaurastate", HandleDebugSetAuraStateCommand, SEC_ADMINISTRATOR, Console::No },
95 { "setitemvalue", HandleDebugSetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
96 { "setvalue", HandleDebugSetValueCommand, SEC_ADMINISTRATOR, Console::No },
97 { "spawnvehicle", HandleDebugSpawnVehicleCommand, SEC_ADMINISTRATOR, Console::No },
98 { "setvid", HandleDebugSetVehicleIdCommand, SEC_ADMINISTRATOR, Console::No },
99 { "entervehicle", HandleDebugEnterVehicleCommand, SEC_ADMINISTRATOR, Console::No },
101 { "update", HandleDebugUpdateCommand, SEC_ADMINISTRATOR, Console::No },
102 { "itemexpire", HandleDebugItemExpireCommand, SEC_ADMINISTRATOR, Console::No },
103 { "areatriggers", HandleDebugAreaTriggersCommand, SEC_ADMINISTRATOR, Console::No },
104 { "lfg", HandleDebugDungeonFinderCommand, SEC_ADMINISTRATOR, Console::No },
105 { "los", HandleDebugLoSCommand, SEC_ADMINISTRATOR, Console::No },
106 { "moveflags", HandleDebugMoveflagsCommand, SEC_ADMINISTRATOR, Console::No },
107 { "unitstate", HandleDebugUnitStateCommand, SEC_ADMINISTRATOR, Console::No },
108 { "objectcount", HandleDebugObjectCountCommand, SEC_ADMINISTRATOR, Console::Yes},
109 { "dummy", HandleDebugDummyCommand, SEC_ADMINISTRATOR, Console::No }
110 };
111 static ChatCommandTable commandTable =
112 {
113 { "debug", debugCommandTable },
114 { "wpgps", HandleWPGPSCommand, SEC_ADMINISTRATOR, Console::No }
115 };
116 return commandTable;
117 }
@ SEC_ADMINISTRATOR
Definition: Common.h:62
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:49
static bool HandleDebugSet32BitCommand(ChatHandler *handler, uint32 index, uint8 bit)
Definition: cs_debug.cpp:1161
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, uint32 phaseShift)
Definition: cs_debug.cpp:950
static bool HandleDebugThreatListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:795
static bool HandleDebugGetItemStateCommand(ChatHandler *handler, std::string itemState)
Definition: cs_debug.cpp:512
static bool HandleDebugGetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index)
Definition: cs_debug.cpp:956
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler)
Definition: cs_debug.cpp:939
static bool HandleDebugSetValueCommand(ChatHandler *handler, uint32 index, Variant< uint32, float > value)
Definition: cs_debug.cpp:1048
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
Definition: cs_debug.cpp:1180
static bool HandleDebugSendChatMsgCommand(ChatHandler *handler, ChatMsg type)
Definition: cs_debug.cpp:480
static bool HandleDebugAreaTriggersCommand(ChatHandler *handler)
Definition: cs_debug.cpp:452
static bool HandleDebugSendSellErrorCommand(ChatHandler *handler, SellResult error)
Definition: cs_debug.cpp:251
static bool HandleDebugGetValueCommand(ChatHandler *handler, uint32 index, bool isInt)
Definition: cs_debug.cpp:1077
static bool HandleDebugUpdateCommand(ChatHandler *handler, uint32 index, Optional< uint32 > value)
Definition: cs_debug.cpp:1126
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, uint32 id)
Definition: cs_debug.cpp:867
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler)
Definition: cs_debug.cpp:494
static bool HandleDebugLoSCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1012
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, uint32 movieId)
Definition: cs_debug.cpp:147
static bool HandleDebugUnitStateCommand(ChatHandler *handler, uint32 unitState)
Definition: cs_debug.cpp:1236
static bool HandleWPGPSCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1248
static bool HandleDebugPlaySoundCommand(ChatHandler *handler, uint32 soundId)
Definition: cs_debug.cpp:160
static bool HandleDebugDungeonFinderCommand(ChatHandler *)
Definition: cs_debug.cpp:777
static bool HandleDebugSendOpcodeCommand(ChatHandler *handler)
Definition: cs_debug.cpp:263
static bool HandleDebugDummyCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1336
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, InventoryResult error)
Definition: cs_debug.cpp:245
static bool HandleDebugHostileRefListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:837
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, uint32 entry, Optional< uint32 > id)
Definition: cs_debug.cpp:906
static bool HandleDebugPlayMusicCommand(ChatHandler *handler, uint32 musicId)
Definition: cs_debug.cpp:187
static bool HandleDebugBattlegroundCommand(ChatHandler *)
Definition: cs_debug.cpp:783
static bool HandleDebugSendBuyErrorCommand(ChatHandler *handler, BuyResult error)
Definition: cs_debug.cpp:257
static bool HandleDebugObjectCountCommand(ChatHandler *handler, Optional< uint32 > mapId)
Definition: cs_debug.cpp:1258
static bool HandleDebugSendChannelNotifyCommand(ChatHandler *handler, ChatNotify type)
Definition: cs_debug.cpp:469
static bool HandleDebugEnterVehicleCommand(ChatHandler *handler, uint32 entry, Optional< int8 > seatId)
Definition: cs_debug.cpp:878
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
Definition: cs_debug.cpp:973
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, uint32 index, uint32 value)
Definition: cs_debug.cpp:1108
static bool HandleDebugItemExpireCommand(ChatHandler *handler, ObjectGuid::LowType guid)
Definition: cs_debug.cpp:988
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler *handler, QuestFailedReason msg)
Definition: cs_debug.cpp:506
static bool HandleDebugPlayCinematicCommand(ChatHandler *handler, uint32 cinematicId)
Definition: cs_debug.cpp:120
static bool HandleDebugVisualCommand(ChatHandler *handler, uint32 visualId)
Definition: cs_debug.cpp:203
static bool HandleDebugUpdateWorldStateCommand(ChatHandler *handler, uint32 variable, uint32 value)
Definition: cs_debug.cpp:446
static bool HandleDebugArenaCommand(ChatHandler *)
Definition: cs_debug.cpp:789
static bool HandleDebugAnimCommand(ChatHandler *handler, Emote emote)
Definition: cs_debug.cpp:1002
static bool HandleDebugSendSpellFailCommand(ChatHandler *handler, SpellCastResult result, Optional< uint32 > failArg1, Optional< uint32 > failArg2)
Definition: cs_debug.cpp:224
static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler *handler, QuestShareMessages msg)
Definition: cs_debug.cpp:488
static bool HandleDebugSetAuraStateCommand(ChatHandler *handler, Optional< AuraStateType > state, bool apply)
Definition: cs_debug.cpp:1027

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
1003 {
1004 if (Unit* unit = handler->getSelectedUnit())
1005 unit->HandleEmoteCommand(emote);
1006
1007 handler->PSendSysMessage("Playing emote %s", EnumUtils::ToConstant(emote));
1008
1009 return true;
1010 }
static char const * ToConstant(Enum value)
Definition: SmartEnum.h:124
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60
Unit * getSelectedUnit() const
Definition: Chat.cpp:322
Definition: Unit.h:1302

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

Referenced by GetCommands().

◆ HandleDebugAreaTriggersCommand()

static bool debug_commandscript::HandleDebugAreaTriggersCommand ( ChatHandler handler)
inlinestatic
453 {
454 Player* player = handler->GetSession()->GetPlayer();
455 if (!player->isDebugAreaTriggers)
456 {
458 player->isDebugAreaTriggers = true;
459 }
460 else
461 {
463 player->isDebugAreaTriggers = false;
464 }
465
466 return true;
467 }
@ LANG_DEBUG_AREATRIGGER_ON
Definition: Language.h:961
@ LANG_DEBUG_AREATRIGGER_OFF
Definition: Language.h:962
WorldSession * GetSession()
Definition: Chat.h:139
Definition: Player.h:1056
bool isDebugAreaTriggers
Definition: Player.h:2519
Player * GetPlayer() const
Definition: WorldSession.h:364

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
790 {
791 sBattlegroundMgr->ToggleArenaTesting();
792 return true;
793 }
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugBattlegroundCommand()

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

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugDummyCommand()

static bool debug_commandscript::HandleDebugDummyCommand ( ChatHandler handler)
inlinestatic
1337 {
1338 handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing.");
1339 return true;
1340 }
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:101

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugDungeonFinderCommand()

static bool debug_commandscript::HandleDebugDungeonFinderCommand ( ChatHandler )
inlinestatic
778 {
779 sLFGMgr->ToggleTesting();
780 return true;
781 }
#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
879 {
880 Unit* target = handler->getSelectedUnit();
881 if (!target || !target->IsVehicle())
882 return false;
883
884 if (!seatId)
885 seatId = -1;
886
887 if (!entry)
888 handler->GetPlayer()->EnterVehicle(target, *seatId);
889 else
890 {
891 Creature* passenger = nullptr;
892 Acore::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
893 Acore::CreatureSearcher<Acore::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
894 Cell::VisitAllObjects(handler->GetPlayer(), searcher, 30.0f);
895
896 if (!passenger || passenger == target)
897 return false;
898
899 passenger->EnterVehicle(target, *seatId);
900 }
901
902 handler->PSendSysMessage("Unit %u entered vehicle %hhd", entry, *seatId);
903 return true;
904 }
Player * GetPlayer() const
Definition: Chat.cpp:37
Definition: Creature.h:46
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition: Unit.cpp:19894
bool IsVehicle() const
Definition: Unit.h:1428
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:439
Definition: GridNotifiers.h:1457

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

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, Item::GetContainer(), ObjectGuid::GetCounter(), 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::StringFormatFmt(), Item::ToBag(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleDebugGetItemValueCommand()

static bool debug_commandscript::HandleDebugGetItemValueCommand ( ChatHandler handler,
ObjectGuid::LowType  guid,
uint32  index 
)
inlinestatic
957 {
958 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
959
960 if (!i)
961 return false;
962
963 if (index >= i->GetValuesCount())
964 return false;
965
966 uint32 value = i->GetUInt32Value(index);
967
968 handler->PSendSysMessage("Item %u: value at %u is %u", guid, index, value);
969
970 return true;
971 }
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
uint16 GetValuesCount() const
Definition: Object.h:181
Definition: ObjectGuid.h:120
Item * GetItemByGuid(ObjectGuid guid) const
Definition: PlayerStorage.cpp:435

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

Referenced by GetCommands().

◆ HandleDebugGetLootRecipientCommand()

static bool debug_commandscript::HandleDebugGetLootRecipientCommand ( ChatHandler handler)
inlinestatic
495 {
496 Creature* target = handler->getSelectedCreature();
497 if (!target)
498 return false;
499
500 handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, SpawnID %u) is %s",
501 target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetSpawnId(),
502 target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName().c_str() : "offline") : "no loot recipient");
503 return true;
504 }
Creature * getSelectedCreature() const
Definition: Chat.cpp:346
bool hasLootRecipient() const
Definition: Creature.h:225
Player * GetLootRecipient() const
Definition: Creature.cpp:1244
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:67
std::string const & GetName() const
Definition: Object.h:446

References ObjectGuid::GetCounter(), Object::GetGUID(), Creature::GetLootRecipient(), WorldObject::GetName(), ChatHandler::getSelectedCreature(), Creature::GetSpawnId(), Creature::hasLootRecipient(), and ChatHandler::PSendSysMessage().

Referenced by GetCommands().

◆ HandleDebugGetValueCommand()

static bool debug_commandscript::HandleDebugGetValueCommand ( ChatHandler handler,
uint32  index,
bool  isInt 
)
inlinestatic
1078 {
1079 Unit* target = handler->getSelectedUnit();
1080 if (!target)
1081 {
1083 return false;
1084 }
1085
1086 ObjectGuid guid = target->GetGUID();
1087
1088 if (index >= target->GetValuesCount())
1089 {
1090 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, guid.GetCounter(), target->GetValuesCount());
1091 return false;
1092 }
1093
1094 if (isInt)
1095 {
1096 uint32 value = target->GetUInt32Value(index);
1097 handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.GetCounter(), index, value);
1098 }
1099 else
1100 {
1101 float value = target->GetFloatValue(index);
1102 handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.GetCounter(), index, value);
1103 }
1104
1105 return true;
1106 }
@ LANG_TOO_BIG_INDEX
Definition: Language.h:604
@ LANG_SELECT_CHAR_OR_CREATURE
Definition: Language.h:31
@ LANG_GET_UINT_FIELD
Definition: Language.h:610
@ LANG_GET_FLOAT_FIELD
Definition: Language.h:612
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:152
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317

References ObjectGuid::GetCounter(), 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(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleDebugHostileRefListCommand()

static bool debug_commandscript::HandleDebugHostileRefListCommand ( ChatHandler handler)
inlinestatic
838 {
839 Unit* target = handler->getSelectedUnit();
840 if (!target)
841 target = handler->GetSession()->GetPlayer();
842
843 HostileReference* ref = target->getHostileRefMgr().getFirst();
844 uint32 count = 0;
845
846 handler->PSendSysMessage("Hostile reference list of %s (%s)", target->GetName().c_str(), target->GetGUID().ToString().c_str());
847
848 while (ref)
849 {
850 if (Unit* unit = ref->GetSource()->GetOwner())
851 {
852 handler->PSendSysMessage(" %u. %s %s (%s) - threat %f", ++count, (ref->IsOnline() ? "" : "[offline]"),
853 unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), ref->GetThreat());
854 }
855 else
856 {
857 handler->PSendSysMessage(" %u. No Owner - threat %f", ++count, ref->GetThreat());
858 }
859
860 ref = ref->next();
861 }
862
863 handler->SendSysMessage("End of hostile reference list.");
864 return true;
865 }
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:2163

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
989 {
990 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
991
992 if (!i)
993 return false;
994
995 handler->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
996 sScriptMgr->OnItemExpire(handler->GetPlayer(), i->GetTemplate());
997
998 return true;
999 }
#define sScriptMgr
Definition: ScriptMgr.h:698
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:3045

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
1013 {
1014 if (Unit* unit = handler->getSelectedUnit())
1015 {
1016 Player* player = handler->GetSession()->GetPlayer();
1017 handler->PSendSysMessage("Checking LoS %s -> %s:", player->GetName().c_str(), unit->GetName().c_str());
1018 handler->PSendSysMessage(" VMAP LoS: %s", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
1019 handler->PSendSysMessage(" GObj LoS: %s", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_ALL) ? "clear" : "obstructed");
1020 handler->PSendSysMessage("%s is %sin line of sight of %s.", unit->GetName().c_str(), (player->IsWithinLOSInMap(unit) ? "" : "not "), player->GetName().c_str());
1021 return true;
1022 }
1023
1024 return false;
1025 }
@ 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
1109 {
1110 if (index >= handler->GetPlayer()->GetValuesCount())
1111 {
1112 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().GetCounter(), handler->GetPlayer()->GetValuesCount());
1113 return false;
1114 }
1115
1116 uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
1117
1118 currentValue += value;
1119 handler->GetPlayer()->SetUInt32Value(index, currentValue);
1120
1121 handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
1122
1123 return true;
1124 }
@ LANG_CHANGE_32BIT_FIELD
Definition: Language.h:616
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650

References ObjectGuid::GetCounter(), Object::GetGUID(), ChatHandler::GetPlayer(), Object::GetUInt32Value(), Object::GetValuesCount(), LANG_CHANGE_32BIT_FIELD, LANG_TOO_BIG_INDEX, ChatHandler::PSendSysMessage(), and Object::SetUInt32Value().

Referenced by GetCommands().

◆ HandleDebugMoveflagsCommand()

static bool debug_commandscript::HandleDebugMoveflagsCommand ( ChatHandler handler,
Optional< uint32 moveFlags,
Optional< uint32 moveFlagsExtra 
)
inlinestatic

Display case

1181 {
1182 Unit* target = handler->getSelectedUnit();
1183 if (!target)
1184 target = handler->GetPlayer();
1185
1186 if (!moveFlags)
1187 {
1190 }
1191 else
1192 {
1193 static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
1196
1197 bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
1198
1199 target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
1200 target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
1201 target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
1202 target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
1203 target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
1204 target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
1205 target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
1206
1208 *moveFlags &= ~MOVEMENTFLAG_FALLING;
1209
1210 if (*moveFlags & MOVEMENTFLAG_ROOT)
1211 {
1212 target->SetControlled(true, UNIT_STATE_ROOT);
1213 *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
1214 }
1215
1217 target->StopMoving();
1218
1219 if (unhandledFlag)
1220 target->SetUnitMovementFlags(*moveFlags);
1221
1222 if (moveFlagsExtra)
1223 {
1224 target->SetExtraUnitMovementFlags(*moveFlagsExtra);
1225 }
1226
1227 if (moveFlagsExtra || unhandledFlag)
1228 target->SendMovementFlagUpdate();
1229
1231 }
1232
1233 return true;
1234 }
@ MOVEMENTFLAG_SPLINE_ENABLED
Definition: Unit.h:579
@ MOVEMENTFLAG_WATERWALKING
Definition: Unit.h:580
@ MOVEMENTFLAG_DISABLE_GRAVITY
Definition: Unit.h:562
@ MOVEMENTFLAG_FALLING_SLOW
Definition: Unit.h:581
@ MOVEMENTFLAG_CAN_FLY
Definition: Unit.h:576
@ MOVEMENTFLAG_ROOT
Definition: Unit.h:563
@ MOVEMENTFLAG_FALLING
Definition: Unit.h:564
@ MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE
Movement flags that have change status opcodes associated for players.
Definition: Unit.h:601
@ MOVEMENTFLAG_SWIMMING
Definition: Unit.h:573
@ MOVEMENTFLAG_HOVER
Definition: Unit.h:582
@ MOVEMENTFLAG_WALKING
Definition: Unit.h:560
@ UNIT_STATE_ROOT
Definition: Unit.h:335
@ LANG_MOVEFLAGS_GET
Definition: Language.h:914
@ LANG_MOVEFLAGS_SET
Definition: Language.h:915
uint32 GetUnitMovementFlags() const
Definition: Unit.h:2289
void SetUnitMovementFlags(uint32 f)
Definition: Unit.h:2290
void SetExtraUnitMovementFlags(uint16 f)
Definition: Unit.h:2296
void StopMoving()
Definition: Unit.cpp:16918
virtual bool SetSwim(bool enable)
Definition: Unit.cpp:20939
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18288
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20958
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2288
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20921
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16972
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20998
virtual bool SetWalk(bool enable)
Definition: Unit.cpp:20907
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:21020
uint16 GetExtraUnitMovementFlags() const
Definition: Unit.h:2295
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20976

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
1259 {
1260 if (mapId)
1261 {
1262 sMapMgr->DoForAllMapsWithMapId(mapId.value(),
1263 [handler](Map* map) -> void
1264 {
1265 HandleDebugObjectCountMap(handler, map);
1266 }
1267 );
1268 }
1269 else
1270 {
1271 sMapMgr->DoForAllMaps(
1272 [handler](Map* map) -> void
1273 {
1274 HandleDebugObjectCountMap(handler, map);
1275 }
1276 );
1277 }
1278
1279 return true;
1280 }
#define sMapMgr
Definition: MapMgr.h:221
Definition: Map.h:313
static void HandleDebugObjectCountMap(ChatHandler *handler, Map *map)
Definition: cs_debug.cpp:1318

References HandleDebugObjectCountMap(), and sMapMgr.

Referenced by GetCommands().

◆ HandleDebugObjectCountMap()

static void debug_commandscript::HandleDebugObjectCountMap ( ChatHandler handler,
Map map 
)
inlinestatic
1319 {
1320 handler->PSendSysMessage("Map Id: %u Name: '%s' Instance Id: %u Creatures: %u GameObjects: %u SetActive Objects: %u",
1321 map->GetId(), map->GetMapName(), map->GetInstanceId(),
1325
1326 CreatureCountWorker worker;
1328 visitor.Visit(map->GetObjectsStore());
1329
1330 handler->PSendSysMessage("Top Creatures count:");
1331
1332 for (auto&& p : worker.GetTopCreatureCount(5))
1333 handler->PSendSysMessage("Entry: %u Count: %u", p.first, p.second);
1334 }
std::uint64_t uint64
Definition: Define.h:107
std::size_t Size() const
Definition: TypeContainer.h:153
Definition: TypeContainerVisitor.h:85
Definition: GameObject.h:122
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:516
uint32 GetId() const
Definition: Map.h:379
const char * GetMapName() const
Definition: Map.cpp:2519
uint32 GetInstanceId() const
Definition: Map.h:419
size_t GetActiveNonPlayersCount() const
Definition: Map.h:653

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
121 {
122 CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
123 if (!cineSeq)
124 {
125 handler->SendErrorMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
126 return false;
127 }
128
129 // Dump camera locations
130 if (std::vector<FlyByCamera> const* flyByCameras = GetFlyByCameras(cineSeq->cinematicCamera))
131 {
132 handler->PSendSysMessage("Waypoints for sequence %u, camera %u", cinematicId, cineSeq->cinematicCamera);
133 uint32 count = 1;
134 for (FlyByCamera const& cam : *flyByCameras)
135 {
136 handler->PSendSysMessage("%02u - %7ums [%s (%f degrees)]", count, cam.timeStamp, cam.locations.ToString().c_str(), cam.locations.GetOrientation() * (180 / M_PI));
137 ++count;
138 }
139 handler->PSendSysMessage("%u waypoints dumped", flyByCameras->size());
140 }
141
142 handler->GetPlayer()->SendCinematicStart(cinematicId);
143 return true;
144 }
DBCStorage< CinematicSequencesEntry > sCinematicSequencesStore(CinematicSequencesEntryfmt)
std::vector< FlyByCamera > const * GetFlyByCameras(uint32 cinematicCameraId)
Definition: M2Stores.cpp:255
@ LANG_CINEMATIC_NOT_EXIST
Definition: Language.h:959
Definition: M2Stores.h:26
void SendCinematicStart(uint32 CinematicSequenceId) const
Definition: Player.cpp:5612
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
148 {
149 if (!sMovieStore.LookupEntry(movieId))
150 {
151 handler->SendErrorMessage(LANG_MOVIE_NOT_EXIST, movieId);
152 return false;
153 }
154
155 handler->GetPlayer()->SendMovieStart(movieId);
156 return true;
157 }
DBCStorage< MovieEntry > sMovieStore(MovieEntryfmt)
@ LANG_MOVIE_NOT_EXIST
Definition: Language.h:960
void SendMovieStart(uint32 MovieId)
Definition: Player.cpp:5623

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

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

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

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

Referenced by GetCommands().

◆ HandleDebugSendChannelNotifyCommand()

static bool debug_commandscript::HandleDebugSendChannelNotifyCommand ( ChatHandler handler,
ChatNotify  type 
)
inlinestatic
470 {
471 WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
472 data << type;
473 data << "test";
474 data << uint32(0);
475 data << uint32(0);
476 handler->GetSession()->SendPacket(&data);
477 return true;
478 }
@ 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:212

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

Referenced by GetCommands().

◆ HandleDebugSendChatMsgCommand()

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

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

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

Referenced by GetCommands().

◆ HandleDebugSendLargePacketCommand()

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

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugSendOpcodeCommand()

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

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(), Object::GetTypeId(), ByteBuffer::hexlike(), LANG_COMMAND_OBJNOTFOUND, LANG_COMMAND_OPCODESENT, LANG_DEBUG_OPCODE_FILE_MISSING, LOG_ERROR, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), WorldSession::SendPacket(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by GetCommands().

◆ HandleDebugSendQuestInvalidMsgCommand()

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

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

Referenced by GetCommands().

◆ HandleDebugSendQuestPartyMsgCommand()

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

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

Referenced by GetCommands().

◆ HandleDebugSendSellErrorCommand()

static bool debug_commandscript::HandleDebugSendSellErrorCommand ( ChatHandler handler,
SellResult  error 
)
inlinestatic
252 {
253 handler->GetPlayer()->SendSellError(SellResult(error), nullptr, ObjectGuid::Empty, 0);
254 return true;
255 }
SellResult
Definition: Item.h:148
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
void SendSellError(SellResult msg, Creature *creature, ObjectGuid guid, uint32 param)
Definition: PlayerStorage.cpp:4098

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

Referenced by GetCommands().

◆ HandleDebugSendSetPhaseShiftCommand()

static bool debug_commandscript::HandleDebugSendSetPhaseShiftCommand ( ChatHandler handler,
uint32  phaseShift 
)
inlinestatic
951 {
952 handler->GetSession()->SendSetPhaseShift(phaseShift);
953 return true;
954 }
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
225 {
227 data << uint8(0);
228 data << uint32(133); // Spell "Fireball"
229 data << uint8(result);
230
231 if (failArg1 || failArg2)
232 {
233 data << uint32(failArg1.value_or(0));
234 }
235
236 if (failArg2)
237 {
238 data << uint32(*failArg2);
239 }
240
241 handler->GetSession()->SendPacket(&data);
242 return true;
243 }
@ 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
1162 {
1163 WorldObject* target = handler->getSelectedObject();
1164 if (!target)
1165 {
1167 return false;
1168 }
1169
1170 if (bit > 32) // uint32 = 32 bits
1171 return false;
1172
1173 uint32 value = bit ? 1 << (bit - 1) : 0;
1174 target->SetUInt32Value(index, value);
1175
1176 handler->PSendSysMessage(LANG_SET_32BIT_FIELD, index, value);
1177 return true;
1178 }
@ LANG_SET_32BIT_FIELD
Definition: Language.h:614
WorldObject * getSelectedObject() const
Definition: Chat.cpp:333
Definition: Object.h:393

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
1028 {
1029 Unit* unit = handler->getSelectedUnit();
1030 if (!unit)
1031 {
1033 return false;
1034 }
1035
1036 if (!state)
1037 {
1038 // reset all states
1039 for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
1040 unit->ModifyAuraState(s, false);
1041 return true;
1042 }
1043
1044 unit->ModifyAuraState(*state, apply);
1045 return true;
1046 }
AuraStateType
Definition: SharedDefines.h:1288
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:10496

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
974 {
975 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
976
977 if (!i)
978 return false;
979
980 if (index >= i->GetValuesCount())
981 return false;
982
983 i->SetUInt32Value(index, value);
984
985 return true;
986 }

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
1049 {
1050 WorldObject* target = handler->getSelectedObject();
1051 if (!target)
1052 {
1054 return false;
1055 }
1056
1057 if (index >= target->GetValuesCount())
1058 {
1059 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, target->GetGUID().GetCounter(), target->GetValuesCount());
1060 return false;
1061 }
1062
1063 if (value.holds_alternative<uint32>())
1064 {
1065 target->SetUInt32Value(index, value.get<uint32>());
1066 handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().GetCounter(), uint32(index), uint32(value));
1067 }
1068 else if (value.holds_alternative<float>())
1069 {
1070 target->SetFloatValue(index, value.get<float>());
1071 handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().GetCounter(), static_cast<float>(index), uint32(value));
1072 }
1073
1074 return true;
1075 }
@ LANG_SET_UINT_FIELD
Definition: Language.h:606
@ LANG_SET_FLOAT_FIELD
Definition: Language.h:608
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(), ObjectGuid::GetCounter(), 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(), and Object::SetUInt32Value().

Referenced by GetCommands().

◆ HandleDebugSetVehicleIdCommand()

static bool debug_commandscript::HandleDebugSetVehicleIdCommand ( ChatHandler handler,
uint32  id 
)
inlinestatic
868 {
869 Unit* target = handler->getSelectedUnit();
870 if (!target || target->IsVehicle())
871 return false;
872
873 //target->SetVehicleId(id);
874 handler->PSendSysMessage("Vehicle id set to %u", id);
875 return true;
876 }

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
907 {
908 float x, y, z, o = handler->GetPlayer()->GetOrientation();
909 handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
910
911 if (!id)
912 return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
913
914 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
915
916 if (!ci)
917 return false;
918
919 VehicleEntry const* ve = sVehicleStore.LookupEntry(*id);
920
921 if (!ve)
922 return false;
923
924 Creature* v = new Creature();
925
926 Map* map = handler->GetPlayer()->GetMap();
927
928 if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, *id, x, y, z, o))
929 {
930 delete v;
931 return false;
932 }
933
934 map->AddToMap(v->ToCreature());
935
936 return true;
937 }
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
#define sObjectMgr
Definition: ObjectMgr.h:1640
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:1067
Definition: CreatureData.h:176
Creature * ToCreature()
Definition: Object.h:197
uint32 GetPhaseMask() const
Definition: Object.h:434
Map * GetMap() const
Definition: Object.h:517
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:2343
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:2687
float GetOrientation() const
Definition: Position.h:120
float GetCombatReach() const override
Definition: Unit.h:1359
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:637
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:555
Definition: DBCStructure.h:2028

References Map::AddToMap(), Creature::Create(), Map::GenerateLowGuid(), WorldObject::GetClosePoint(), Unit::GetCombatReach(), WorldObject::GetMap(), Position::GetOrientation(), WorldObject::GetPhaseMask(), ChatHandler::GetPlayer(), WorldSession::GetPlayer(), ChatHandler::GetSession(), sObjectMgr, WorldObject::SummonCreature(), sVehicleStore, and Object::ToCreature().

Referenced by GetCommands().

◆ HandleDebugThreatListCommand()

static bool debug_commandscript::HandleDebugThreatListCommand ( ChatHandler handler)
inlinestatic
796 {
797 Creature* target = handler->getSelectedCreature();
798 if (!target || target->IsTotem() || target->IsPet())
799 return false;
800
801 auto const& threatList = target->GetThreatMgr().GetThreatList();
802 ThreatContainer::StorageType::const_iterator itr;
803 uint32 count = 0;
804
805 handler->PSendSysMessage("Threat list of %s (%s)", target->GetName().c_str(), target->GetGUID().ToString().c_str());
806
807 for (itr = threatList.begin(); itr != threatList.end(); ++itr)
808 {
809 Unit* unit = (*itr)->getTarget();
810 if (!unit)
811 {
812 handler->PSendSysMessage(" %u. No Unit - threat %f", ++count, (*itr)->GetThreat());
813 continue;
814 }
815
816 handler->PSendSysMessage(" %u. %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->GetThreat());
817 }
818
819 auto const& threatList2 = target->GetThreatMgr().GetOfflineThreatList();
820 for (itr = threatList2.begin(); itr != threatList2.end(); ++itr)
821 {
822 Unit* unit = (*itr)->getTarget();
823 if (!unit)
824 {
825 handler->PSendSysMessage(" %u. [offline] No Unit - threat %f", ++count, (*itr)->GetThreat());
826 continue;
827 }
828
829 handler->PSendSysMessage(" %u. [offline] %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->GetThreat());
830 }
831
832 handler->SendSysMessage("End of threat list.");
833
834 return true;
835 }
ThreatContainer::StorageType const & GetOfflineThreatList() const
Definition: ThreatMgr.h:275
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:274
bool IsPet() const
Definition: Unit.h:1425
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2159
bool IsTotem() const
Definition: Unit.h:1427

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
1237 {
1238 Unit* target = handler->getSelectedUnit();
1239 if (!target)
1240 target = handler->GetSession()->GetPlayer();
1241
1242 target->ClearUnitState(target->GetUnitState());
1243 target->AddUnitState(unitState);
1244
1245 return true;
1246 }
void ClearUnitState(uint32 f)
Definition: Unit.h:1411
uint32 GetUnitState() const
Definition: Unit.h:1412
void AddUnitState(uint32 f)
Definition: Unit.h:1409

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
1127 {
1128 Unit* unit = handler->getSelectedUnit();
1129 if (!unit)
1130 {
1132 return false;
1133 }
1134
1135 if (!index)
1136 return true;
1137
1138 // check index
1139 if (unit->GetTypeId() == TYPEID_PLAYER)
1140 {
1141 if (index >= PLAYER_END)
1142 return true;
1143 }
1144 else if (index >= UNIT_END)
1145 return true;
1146
1147 if (!value)
1148 {
1149 value = unit->GetUInt32Value(index);
1150
1151 handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().GetCounter(), index, *value);
1152 return true;
1153 }
1154
1155 unit->SetUInt32Value(index, *value);
1156
1157 handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().GetCounter(), index, *value);
1158 return true;
1159 }
@ UNIT_END
Definition: UpdateFields.h:175
@ PLAYER_END
Definition: UpdateFields.h:392
@ LANG_UPDATE_CHANGE
Definition: Language.h:603
@ LANG_UPDATE
Definition: Language.h:602

References ObjectGuid::GetCounter(), Object::GetGUID(), ChatHandler::getSelectedUnit(), Object::GetTypeId(), Object::GetUInt32Value(), LANG_SELECT_CHAR_OR_CREATURE, LANG_UPDATE, LANG_UPDATE_CHANGE, PLAYER_END, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), Object::SetUInt32Value(), TYPEID_PLAYER, and UNIT_END.

Referenced by GetCommands().

◆ HandleDebugUpdateWorldStateCommand()

static bool debug_commandscript::HandleDebugUpdateWorldStateCommand ( ChatHandler handler,
uint32  variable,
uint32  value 
)
inlinestatic
447 {
448 handler->GetPlayer()->SendUpdateWorldState(variable, value);
449 return true;
450 }
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197

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

Referenced by GetCommands().

◆ HandleDebugVisualCommand()

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

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)
inlinestatic
1249 {
1250 Player* player = handler->GetSession()->GetPlayer();
1251
1252 LOG_INFO("sql.dev", "(@PATH, XX, {0:.3f}, {0:.3f}, {0:.5f}, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
1253
1254 handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
1255 return true;
1256 }
#define LOG_INFO(filterType__,...)
Definition: Log.h:165

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

Referenced by GetCommands().