AzeorthCore 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
52: CommandScript("debug_commandscript") { }
Definition: ScriptMgr.h:849

Member Function Documentation

◆ GetCommands()

ChatCommandTable debug_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

55 {
56 static ChatCommandTable debugPlayCommandTable =
57 {
58 { "cinematic", HandleDebugPlayCinematicCommand, SEC_ADMINISTRATOR, Console::No },
59 { "movie", HandleDebugPlayMovieCommand, SEC_ADMINISTRATOR, Console::No },
60 { "sound", HandleDebugPlaySoundCommand, SEC_ADMINISTRATOR, Console::No },
61 { "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No },
62 { "visual", HandleDebugVisualCommand, SEC_ADMINISTRATOR, Console::No }
63 };
64 static ChatCommandTable debugSendCommandTable =
65 {
66 { "buyerror", HandleDebugSendBuyErrorCommand, SEC_ADMINISTRATOR, Console::No },
67 { "channelnotify", HandleDebugSendChannelNotifyCommand, SEC_ADMINISTRATOR, Console::No },
68 { "chatmmessage", HandleDebugSendChatMsgCommand, SEC_ADMINISTRATOR, Console::No },
69 { "equiperror", HandleDebugSendEquipErrorCommand, SEC_ADMINISTRATOR, Console::No },
70 { "largepacket", HandleDebugSendLargePacketCommand, SEC_ADMINISTRATOR, Console::No },
71 { "opcode", HandleDebugSendOpcodeCommand, SEC_ADMINISTRATOR, Console::No },
72 { "qpartymsg", HandleDebugSendQuestPartyMsgCommand, SEC_ADMINISTRATOR, Console::No },
73 { "qinvalidmsg", HandleDebugSendQuestInvalidMsgCommand, SEC_ADMINISTRATOR, Console::No },
74 { "sellerror", HandleDebugSendSellErrorCommand, SEC_ADMINISTRATOR, Console::No },
75 { "setphaseshift", HandleDebugSendSetPhaseShiftCommand, SEC_ADMINISTRATOR, Console::No },
76 { "spellfail", HandleDebugSendSpellFailCommand, SEC_ADMINISTRATOR, Console::No }
77 };
78 static ChatCommandTable debugCommandTable =
79 {
80 { "setbit", HandleDebugSet32BitCommand, SEC_ADMINISTRATOR, Console::No },
81 { "threat", HandleDebugThreatListCommand, SEC_ADMINISTRATOR, Console::No },
82 { "hostile", HandleDebugHostileRefListCommand, SEC_ADMINISTRATOR, Console::No },
83 { "anim", HandleDebugAnimCommand, SEC_ADMINISTRATOR, Console::No },
84 { "arena", HandleDebugArenaCommand, SEC_ADMINISTRATOR, Console::No },
86 { "getitemstate", HandleDebugGetItemStateCommand, SEC_ADMINISTRATOR, Console::No },
87 { "lootrecipient", HandleDebugGetLootRecipientCommand, SEC_ADMINISTRATOR, Console::No },
88 { "getvalue", HandleDebugGetValueCommand, SEC_ADMINISTRATOR, Console::No },
89 { "getitemvalue", HandleDebugGetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
90 { "Mod32Value", HandleDebugMod32ValueCommand, SEC_ADMINISTRATOR, Console::No },
91 { "play", debugPlayCommandTable },
92 { "send", debugSendCommandTable },
93 { "setaurastate", HandleDebugSetAuraStateCommand, SEC_ADMINISTRATOR, Console::No },
94 { "setitemvalue", HandleDebugSetItemValueCommand, SEC_ADMINISTRATOR, Console::No },
95 { "setvalue", HandleDebugSetValueCommand, SEC_ADMINISTRATOR, Console::No },
96 { "spawnvehicle", HandleDebugSpawnVehicleCommand, SEC_ADMINISTRATOR, Console::No },
97 { "setvid", HandleDebugSetVehicleIdCommand, SEC_ADMINISTRATOR, Console::No },
98 { "entervehicle", HandleDebugEnterVehicleCommand, SEC_ADMINISTRATOR, Console::No },
100 { "update", HandleDebugUpdateCommand, SEC_ADMINISTRATOR, Console::No },
101 { "itemexpire", HandleDebugItemExpireCommand, SEC_ADMINISTRATOR, Console::No },
102 { "areatriggers", HandleDebugAreaTriggersCommand, SEC_ADMINISTRATOR, Console::No },
103 { "lfg", HandleDebugDungeonFinderCommand, SEC_ADMINISTRATOR, Console::No },
104 { "los", HandleDebugLoSCommand, SEC_ADMINISTRATOR, Console::No },
105 { "moveflags", HandleDebugMoveflagsCommand, SEC_ADMINISTRATOR, Console::No },
106 { "unitstate", HandleDebugUnitStateCommand, SEC_ADMINISTRATOR, Console::No },
107 { "objectcount", HandleDebugObjectCountCommand, SEC_ADMINISTRATOR, Console::Yes},
108 { "dummy", HandleDebugDummyCommand, SEC_ADMINISTRATOR, Console::No }
109 };
110 static ChatCommandTable commandTable =
111 {
112 { "debug", debugCommandTable },
113 { "wpgps", HandleWPGPSCommand, SEC_ADMINISTRATOR, Console::No }
114 };
115 return commandTable;
116 }
@ SEC_ADMINISTRATOR
Definition: Common.h:69
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:50
static bool HandleDebugSet32BitCommand(ChatHandler *handler, uint32 index, uint8 bit)
Definition: cs_debug.cpp:1173
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, uint32 phaseShift)
Definition: cs_debug.cpp:958
static bool HandleDebugThreatListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:803
static bool HandleDebugGetItemStateCommand(ChatHandler *handler, std::string itemState)
Definition: cs_debug.cpp:520
static bool HandleDebugGetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index)
Definition: cs_debug.cpp:964
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler)
Definition: cs_debug.cpp:947
static bool HandleDebugSetValueCommand(ChatHandler *handler, uint32 index, Variant< uint32, float > value)
Definition: cs_debug.cpp:1057
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, Optional< uint32 > moveFlags, Optional< uint32 > moveFlagsExtra)
Definition: cs_debug.cpp:1193
static bool HandleDebugSendChatMsgCommand(ChatHandler *handler, ChatMsg type)
Definition: cs_debug.cpp:488
static bool HandleDebugAreaTriggersCommand(ChatHandler *handler)
Definition: cs_debug.cpp:460
static bool HandleDebugSendSellErrorCommand(ChatHandler *handler, SellResult error)
Definition: cs_debug.cpp:256
static bool HandleDebugGetValueCommand(ChatHandler *handler, uint32 index, bool isInt)
Definition: cs_debug.cpp:1087
static bool HandleDebugUpdateCommand(ChatHandler *handler, uint32 index, Optional< uint32 > value)
Definition: cs_debug.cpp:1137
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, uint32 id)
Definition: cs_debug.cpp:875
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler)
Definition: cs_debug.cpp:502
static bool HandleDebugLoSCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1020
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, uint32 movieId)
Definition: cs_debug.cpp:147
static bool HandleDebugUnitStateCommand(ChatHandler *handler, uint32 unitState)
Definition: cs_debug.cpp:1249
static bool HandleWPGPSCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1261
static bool HandleDebugPlaySoundCommand(ChatHandler *handler, uint32 soundId)
Definition: cs_debug.cpp:161
static bool HandleDebugDungeonFinderCommand(ChatHandler *)
Definition: cs_debug.cpp:785
static bool HandleDebugSendOpcodeCommand(ChatHandler *handler)
Definition: cs_debug.cpp:268
static bool HandleDebugDummyCommand(ChatHandler *handler)
Definition: cs_debug.cpp:1349
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, InventoryResult error)
Definition: cs_debug.cpp:250
static bool HandleDebugHostileRefListCommand(ChatHandler *handler)
Definition: cs_debug.cpp:845
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, uint32 entry, Optional< uint32 > id)
Definition: cs_debug.cpp:914
static bool HandleDebugPlayMusicCommand(ChatHandler *handler, uint32 musicId)
Definition: cs_debug.cpp:190
static bool HandleDebugBattlegroundCommand(ChatHandler *)
Definition: cs_debug.cpp:791
static bool HandleDebugSendBuyErrorCommand(ChatHandler *handler, BuyResult error)
Definition: cs_debug.cpp:262
static bool HandleDebugObjectCountCommand(ChatHandler *handler, Optional< uint32 > mapId)
Definition: cs_debug.cpp:1271
static bool HandleDebugSendChannelNotifyCommand(ChatHandler *handler, ChatNotify type)
Definition: cs_debug.cpp:477
static bool HandleDebugEnterVehicleCommand(ChatHandler *handler, uint32 entry, Optional< int8 > seatId)
Definition: cs_debug.cpp:886
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
Definition: cs_debug.cpp:981
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, uint32 index, uint32 value)
Definition: cs_debug.cpp:1119
static bool HandleDebugItemExpireCommand(ChatHandler *handler, ObjectGuid::LowType guid)
Definition: cs_debug.cpp:996
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler *handler, QuestFailedReason msg)
Definition: cs_debug.cpp:514
static bool HandleDebugPlayCinematicCommand(ChatHandler *handler, uint32 cinematicId)
Definition: cs_debug.cpp:119
static bool HandleDebugVisualCommand(ChatHandler *handler, uint32 visualId)
Definition: cs_debug.cpp:207
static bool HandleDebugUpdateWorldStateCommand(ChatHandler *handler, uint32 variable, uint32 value)
Definition: cs_debug.cpp:454
static bool HandleDebugArenaCommand(ChatHandler *)
Definition: cs_debug.cpp:797
static bool HandleDebugAnimCommand(ChatHandler *handler, Emote emote)
Definition: cs_debug.cpp:1010
static bool HandleDebugSendSpellFailCommand(ChatHandler *handler, SpellCastResult result, Optional< uint32 > failArg1, Optional< uint32 > failArg2)
Definition: cs_debug.cpp:229
static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler *handler, QuestShareMessages msg)
Definition: cs_debug.cpp:496
static bool HandleDebugSetAuraStateCommand(ChatHandler *handler, Optional< AuraStateType > state, bool apply)
Definition: cs_debug.cpp:1035

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
1011 {
1012 if (Unit* unit = handler->getSelectedUnit())
1013 unit->HandleEmoteCommand(emote);
1014
1015 handler->PSendSysMessage("Playing emote %s", EnumUtils::ToConstant(emote));
1016
1017 return true;
1018 }
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:313
Definition: Unit.h:1290

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

Referenced by GetCommands().

◆ HandleDebugAreaTriggersCommand()

static bool debug_commandscript::HandleDebugAreaTriggersCommand ( ChatHandler handler)
inlinestatic
461 {
462 Player* player = handler->GetSession()->GetPlayer();
463 if (!player->isDebugAreaTriggers)
464 {
466 player->isDebugAreaTriggers = true;
467 }
468 else
469 {
471 player->isDebugAreaTriggers = false;
472 }
473
474 return true;
475 }
@ LANG_DEBUG_AREATRIGGER_ON
Definition: Language.h:952
@ LANG_DEBUG_AREATRIGGER_OFF
Definition: Language.h:953
WorldSession * GetSession()
Definition: Chat.h:122
Definition: Player.h:1046
bool isDebugAreaTriggers
Definition: Player.h:2501
Player * GetPlayer() const
Definition: WorldSession.h:360

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
798 {
799 sBattlegroundMgr->ToggleArenaTesting();
800 return true;
801 }
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugBattlegroundCommand()

static bool debug_commandscript::HandleDebugBattlegroundCommand ( ChatHandler )
inlinestatic
792 {
793 sBattlegroundMgr->ToggleTesting();
794 return true;
795 }

References sBattlegroundMgr.

Referenced by GetCommands().

◆ HandleDebugDummyCommand()

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

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugDungeonFinderCommand()

static bool debug_commandscript::HandleDebugDungeonFinderCommand ( ChatHandler )
inlinestatic
786 {
787 sLFGMgr->ToggleTesting();
788 return true;
789 }
#define sLFGMgr
Definition: LFGMgr.h:638

References sLFGMgr.

Referenced by GetCommands().

◆ HandleDebugEnterVehicleCommand()

static bool debug_commandscript::HandleDebugEnterVehicleCommand ( ChatHandler handler,
uint32  entry,
Optional< int8 seatId 
)
inlinestatic
887 {
888 Unit* target = handler->getSelectedUnit();
889 if (!target || !target->IsVehicle())
890 return false;
891
892 if (!seatId)
893 seatId = -1;
894
895 if (!entry)
896 handler->GetPlayer()->EnterVehicle(target, *seatId);
897 else
898 {
899 Creature* passenger = nullptr;
900 Acore::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
901 Acore::CreatureSearcher<Acore::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
902 Cell::VisitAllObjects(handler->GetPlayer(), searcher, 30.0f);
903
904 if (!passenger || passenger == target)
905 return false;
906
907 passenger->EnterVehicle(target, *seatId);
908 }
909
910 handler->PSendSysMessage("Unit %u entered vehicle %hhd", entry, *seatId);
911 return true;
912 }
Player * GetPlayer() const
Definition: Chat.cpp:37
Definition: Creature.h:46
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition: Unit.cpp:20507
bool IsVehicle() const
Definition: Unit.h:1416
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:1460

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

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
965 {
966 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
967
968 if (!i)
969 return false;
970
971 if (index >= i->GetValuesCount())
972 return false;
973
974 uint32 value = i->GetUInt32Value(index);
975
976 handler->PSendSysMessage("Item %u: value at %u is %u", guid, index, value);
977
978 return true;
979 }
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:307
uint16 GetValuesCount() const
Definition: Object.h:181
Definition: ObjectGuid.h:120
Item * GetItemByGuid(ObjectGuid guid) const
Definition: PlayerStorage.cpp:440

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

Referenced by GetCommands().

◆ HandleDebugGetLootRecipientCommand()

static bool debug_commandscript::HandleDebugGetLootRecipientCommand ( ChatHandler handler)
inlinestatic
503 {
504 Creature* target = handler->getSelectedCreature();
505 if (!target)
506 return false;
507
508 handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, SpawnID %u) is %s",
509 target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetSpawnId(),
510 target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName().c_str() : "offline") : "no loot recipient");
511 return true;
512 }
Creature * getSelectedCreature() const
Definition: Chat.cpp:337
bool hasLootRecipient() const
Definition: Creature.h:222
Player * GetLootRecipient() const
Definition: Creature.cpp:1264
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:66
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
1088 {
1089 Unit* target = handler->getSelectedUnit();
1090 if (!target)
1091 {
1093 handler->SetSentErrorMessage(true);
1094 return false;
1095 }
1096
1097 ObjectGuid guid = target->GetGUID();
1098
1099 if (index >= target->GetValuesCount())
1100 {
1101 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, guid.GetCounter(), target->GetValuesCount());
1102 return false;
1103 }
1104
1105 if (isInt)
1106 {
1107 uint32 value = target->GetUInt32Value(index);
1108 handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.GetCounter(), index, value);
1109 }
1110 else
1111 {
1112 float value = target->GetFloatValue(index);
1113 handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.GetCounter(), index, value);
1114 }
1115
1116 return true;
1117 }
@ 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 SetSentErrorMessage(bool val)
Definition: Chat.h:118
float GetFloatValue(uint16 index) const
Definition: Object.cpp:319

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(), ChatHandler::SendSysMessage(), and ChatHandler::SetSentErrorMessage().

Referenced by GetCommands().

◆ HandleDebugHostileRefListCommand()

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

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
997 {
998 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
999
1000 if (!i)
1001 return false;
1002
1003 handler->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
1004 sScriptMgr->OnItemExpire(handler->GetPlayer(), i->GetTemplate());
1005
1006 return true;
1007 }
#define sScriptMgr
Definition: ScriptMgr.h:2690
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:546
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:3053

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
1021 {
1022 if (Unit* unit = handler->getSelectedUnit())
1023 {
1024 Player* player = handler->GetSession()->GetPlayer();
1025 handler->PSendSysMessage("Checking LoS %s -> %s:", player->GetName().c_str(), unit->GetName().c_str());
1026 handler->PSendSysMessage(" VMAP LoS: %s", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
1027 handler->PSendSysMessage(" GObj LoS: %s", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_ALL) ? "clear" : "obstructed");
1028 handler->PSendSysMessage("%s is %sin line of sight of %s.", unit->GetName().c_str(), (player->IsWithinLOSInMap(unit) ? "" : "not "), player->GetName().c_str());
1029 return true;
1030 }
1031
1032 return false;
1033 }
@ LINEOFSIGHT_CHECK_VMAP
Definition: Map.h:191
@ LINEOFSIGHT_CHECK_GOBJECT_ALL
Definition: Map.h:195
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }) const
Definition: Object.cpp:1349

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
1120 {
1121 if (index >= handler->GetPlayer()->GetValuesCount())
1122 {
1123 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().GetCounter(), handler->GetPlayer()->GetValuesCount());
1124 return false;
1125 }
1126
1127 uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
1128
1129 currentValue += value;
1130 handler->GetPlayer()->SetUInt32Value(index, currentValue);
1131
1132 handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
1133
1134 return true;
1135 }
@ LANG_CHANGE_32BIT_FIELD
Definition: Language.h:616
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:652

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

1194 {
1195 Unit* target = handler->getSelectedUnit();
1196 if (!target)
1197 target = handler->GetPlayer();
1198
1199 if (!moveFlags)
1200 {
1203 }
1204 else
1205 {
1206 static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
1209
1210 bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
1211
1212 target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
1213 target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
1214 target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
1215 target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
1216 target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
1217 target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
1218 target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
1219
1221 *moveFlags &= ~MOVEMENTFLAG_FALLING;
1222
1223 if (*moveFlags & MOVEMENTFLAG_ROOT)
1224 {
1225 target->SetControlled(true, UNIT_STATE_ROOT);
1226 *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
1227 }
1228
1230 target->StopMoving();
1231
1232 if (unhandledFlag)
1233 target->SetUnitMovementFlags(*moveFlags);
1234
1235 if (moveFlagsExtra)
1236 {
1237 target->SetExtraUnitMovementFlags(*moveFlagsExtra);
1238 }
1239
1240 if (moveFlagsExtra || unhandledFlag)
1241 target->SendMovementFlagUpdate();
1242
1244 }
1245
1246 return true;
1247 }
@ 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:905
@ LANG_MOVEFLAGS_SET
Definition: Language.h:906
uint32 GetUnitMovementFlags() const
Definition: Unit.h:2543
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:18927
void SetUnitMovementFlags(uint32 f)
Definition: Unit.h:2544
void SetExtraUnitMovementFlags(uint16 f)
Definition: Unit.h:2550
void StopMoving()
Definition: Unit.cpp:17592
virtual bool SetSwim(bool enable)
Definition: Unit.cpp:21530
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Definition: Unit.cpp:21549
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2542
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:21512
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:17646
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:21589
virtual bool SetWalk(bool enable)
Definition: Unit.cpp:21498
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:21611
uint16 GetExtraUnitMovementFlags() const
Definition: Unit.h:2549
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Definition: Unit.cpp:21567

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
1272 {
1273 if (mapId)
1274 {
1275 sMapMgr->DoForAllMapsWithMapId(mapId.value(),
1276 [handler](Map* map) -> void
1277 {
1278 HandleDebugObjectCountMap(handler, map);
1279 }
1280 );
1281 }
1282 else
1283 {
1284 sMapMgr->DoForAllMaps(
1285 [handler](Map* map) -> void
1286 {
1287 HandleDebugObjectCountMap(handler, map);
1288 }
1289 );
1290 }
1291
1292 return true;
1293 }
#define sMapMgr
Definition: MapMgr.h:212
Definition: Map.h:312
static void HandleDebugObjectCountMap(ChatHandler *handler, Map *map)
Definition: cs_debug.cpp:1331

References HandleDebugObjectCountMap(), and sMapMgr.

Referenced by GetCommands().

◆ HandleDebugObjectCountMap()

static void debug_commandscript::HandleDebugObjectCountMap ( ChatHandler handler,
Map map 
)
inlinestatic
1332 {
1333 handler->PSendSysMessage("Map Id: %u Name: '%s' Instance Id: %u Creatures: %u GameObjects: %u SetActive Objects: %u",
1334 map->GetId(), map->GetMapName(), map->GetInstanceId(),
1338
1339 CreatureCountWorker worker;
1341 visitor.Visit(map->GetObjectsStore());
1342
1343 handler->PSendSysMessage("Top Creatures count:");
1344
1345 for (auto&& p : worker.GetTopCreatureCount(5))
1346 handler->PSendSysMessage("Entry: %u Count: %u", p.first, p.second);
1347 }
std::uint64_t uint64
Definition: Define.h:107
std::size_t Size() const
Definition: TypeContainer.h:153
Definition: TypeContainerVisitor.h:85
Definition: GameObject.h:813
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:515
uint32 GetId() const
Definition: Map.h:378
const char * GetMapName() const
Definition: Map.cpp:2519
uint32 GetInstanceId() const
Definition: Map.h:418
size_t GetActiveNonPlayersCount() const
Definition: Map.h:648

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

Referenced by HandleDebugObjectCountCommand().

◆ HandleDebugPlayCinematicCommand()

static bool debug_commandscript::HandleDebugPlayCinematicCommand ( ChatHandler handler,
uint32  cinematicId 
)
inlinestatic
120 {
121 CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
122 if (!cineSeq)
123 {
124 handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
125 handler->SetSentErrorMessage(true);
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:257
@ LANG_CINEMATIC_NOT_EXIST
Definition: Language.h:950
Definition: M2Stores.h:26
void SendCinematicStart(uint32 CinematicSequenceId) const
Definition: Player.cpp:5585
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::SetSentErrorMessage().

Referenced by GetCommands().

◆ HandleDebugPlayMovieCommand()

static bool debug_commandscript::HandleDebugPlayMovieCommand ( ChatHandler handler,
uint32  movieId 
)
inlinestatic
148 {
149 if (!sMovieStore.LookupEntry(movieId))
150 {
151 handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, movieId);
152 handler->SetSentErrorMessage(true);
153 return false;
154 }
155
156 handler->GetPlayer()->SendMovieStart(movieId);
157 return true;
158 }
DBCStorage< MovieEntry > sMovieStore(MovieEntryfmt)
@ LANG_MOVIE_NOT_EXIST
Definition: Language.h:951
void SendMovieStart(uint32 MovieId)
Definition: Player.cpp:5596

References ChatHandler::GetPlayer(), LANG_MOVIE_NOT_EXIST, ChatHandler::PSendSysMessage(), Player::SendMovieStart(), ChatHandler::SetSentErrorMessage(), and sMovieStore.

Referenced by GetCommands().

◆ HandleDebugPlayMusicCommand()

static bool debug_commandscript::HandleDebugPlayMusicCommand ( ChatHandler handler,
uint32  musicId 
)
inlinestatic
191 {
192 if (!sSoundEntriesStore.LookupEntry(musicId))
193 {
194 handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, musicId);
195 handler->SetSentErrorMessage(true);
196 return false;
197 }
198
199 Player* player = handler->GetPlayer();
200
201 player->PlayDirectMusic(musicId, player);
202
203 handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, musicId);
204 return true;
205 }
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:2846

References ChatHandler::GetPlayer(), LANG_SOUND_NOT_EXIST, LANG_YOU_HEAR_SOUND, WorldObject::PlayDirectMusic(), ChatHandler::PSendSysMessage(), ChatHandler::SetSentErrorMessage(), and sSoundEntriesStore.

Referenced by GetCommands().

◆ HandleDebugPlaySoundCommand()

static bool debug_commandscript::HandleDebugPlaySoundCommand ( ChatHandler handler,
uint32  soundId 
)
inlinestatic
162 {
163 if (!sSoundEntriesStore.LookupEntry(soundId))
164 {
165 handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
166 handler->SetSentErrorMessage(true);
167 return false;
168 }
169
170 Player* player = handler->GetPlayer();
171
172 Unit* unit = handler->getSelectedUnit();
173 if (!unit)
174 {
176 handler->SetSentErrorMessage(true);
177 return false;
178 }
179
180 if (player->GetTarget())
181 unit->PlayDistanceSound(soundId, player);
182 else
183 unit->PlayDirectSound(soundId, player);
184
185 handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId);
186 return true;
187 }
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition: Object.cpp:2838
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition: Object.cpp:2830
ObjectGuid GetTarget() const
Definition: Unit.h:2701

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::SendSysMessage(), ChatHandler::SetSentErrorMessage(), and sSoundEntriesStore.

Referenced by GetCommands().

◆ HandleDebugSendBuyErrorCommand()

static bool debug_commandscript::HandleDebugSendBuyErrorCommand ( ChatHandler handler,
BuyResult  error 
)
inlinestatic
263 {
264 handler->GetPlayer()->SendBuyError(BuyResult(error), nullptr, 0, 0);
265 return true;
266 }
BuyResult
Definition: Item.h:134
void SendBuyError(BuyResult msg, Creature *creature, uint32 item, uint32 param)
Definition: PlayerStorage.cpp:4097

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

Referenced by GetCommands().

◆ HandleDebugSendChannelNotifyCommand()

static bool debug_commandscript::HandleDebugSendChannelNotifyCommand ( ChatHandler handler,
ChatNotify  type 
)
inlinestatic
478 {
479 WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
480 data << type;
481 data << "test";
482 data << uint32(0);
483 data << uint32(0);
484 handler->GetSession()->SendPacket(&data);
485 return true;
486 }
@ 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:208

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

Referenced by GetCommands().

◆ HandleDebugSendChatMsgCommand()

static bool debug_commandscript::HandleDebugSendChatMsgCommand ( ChatHandler handler,
ChatMsg  type 
)
inlinestatic
489 {
490 WorldPacket data;
491 ChatHandler::BuildChatPacket(data, type, LANG_UNIVERSAL, handler->GetPlayer(), handler->GetPlayer(), "testtest", 0, "chan");
492 handler->GetSession()->SendPacket(&data);
493 return true;
494 }
@ LANG_UNIVERSAL
Definition: SharedDefines.h:707
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:192

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
251 {
252 handler->GetPlayer()->SendEquipError(InventoryResult(error), nullptr, nullptr);
253 return true;
254 }
InventoryResult
Definition: Item.h:40
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4054

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

Referenced by GetCommands().

◆ HandleDebugSendLargePacketCommand()

static bool debug_commandscript::HandleDebugSendLargePacketCommand ( ChatHandler handler)
inlinestatic
948 {
949 std::ostringstream ss;
950
951 while (ss.str().size() < 128000)
952 ss << "This is a dummy string to push the packet's size beyond 128000 bytes. ";
953
954 handler->SendSysMessage(ss.str().c_str());
955 return true;
956 }

References ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleDebugSendOpcodeCommand()

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

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(), WorldSession::SendPacket(), ChatHandler::SendSysMessage(), ChatHandler::SetSentErrorMessage(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by GetCommands().

◆ HandleDebugSendQuestInvalidMsgCommand()

static bool debug_commandscript::HandleDebugSendQuestInvalidMsgCommand ( ChatHandler handler,
QuestFailedReason  msg 
)
inlinestatic
515 {
516 handler->GetPlayer()->SendCanTakeQuestResponse(msg);
517 return true;
518 }
void SendCanTakeQuestResponse(uint32 msg) const
Definition: PlayerQuest.cpp:2382

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

Referenced by GetCommands().

◆ HandleDebugSendQuestPartyMsgCommand()

static bool debug_commandscript::HandleDebugSendQuestPartyMsgCommand ( ChatHandler handler,
QuestShareMessages  msg 
)
inlinestatic
497 {
498 handler->GetPlayer()->SendPushToPartyResponse(handler->GetPlayer(), msg);
499 return true;
500 }
void SendPushToPartyResponse(Player const *player, uint8 msg) const
Definition: PlayerQuest.cpp:2412

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

Referenced by GetCommands().

◆ HandleDebugSendSellErrorCommand()

static bool debug_commandscript::HandleDebugSendSellErrorCommand ( ChatHandler handler,
SellResult  error 
)
inlinestatic
257 {
258 handler->GetPlayer()->SendSellError(SellResult(error), nullptr, ObjectGuid::Empty, 0);
259 return true;
260 }
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:4109

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

Referenced by GetCommands().

◆ HandleDebugSendSetPhaseShiftCommand()

static bool debug_commandscript::HandleDebugSendSetPhaseShiftCommand ( ChatHandler handler,
uint32  phaseShift 
)
inlinestatic
959 {
960 handler->GetSession()->SendSetPhaseShift(phaseShift);
961 return true;
962 }
void void SendSetPhaseShift(uint32 phaseShift)
Definition: MiscHandler.cpp:1634

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
230 {
232 data << uint8(0);
233 data << uint32(133); // Spell "Fireball"
234 data << uint8(result);
235
236 if (failArg1 || failArg2)
237 {
238 data << uint32(failArg1.value_or(0));
239 }
240
241 if (failArg2)
242 {
243 data << uint32(*failArg2);
244 }
245
246 handler->GetSession()->SendPacket(&data);
247 return true;
248 }
@ 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
1174 {
1175 WorldObject* target = handler->getSelectedObject();
1176 if (!target)
1177 {
1179 handler->SetSentErrorMessage(true);
1180 return false;
1181 }
1182
1183 if (bit > 32) // uint32 = 32 bits
1184 return false;
1185
1186 uint32 value = bit ? 1 << (bit - 1) : 0;
1187 target->SetUInt32Value(index, value);
1188
1189 handler->PSendSysMessage(LANG_SET_32BIT_FIELD, index, value);
1190 return true;
1191 }
@ LANG_SET_32BIT_FIELD
Definition: Language.h:614
WorldObject * getSelectedObject() const
Definition: Chat.cpp:324
Definition: Object.h:393

References ChatHandler::getSelectedObject(), LANG_SELECT_CHAR_OR_CREATURE, LANG_SET_32BIT_FIELD, ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), ChatHandler::SetSentErrorMessage(), and Object::SetUInt32Value().

Referenced by GetCommands().

◆ HandleDebugSetAuraStateCommand()

static bool debug_commandscript::HandleDebugSetAuraStateCommand ( ChatHandler handler,
Optional< AuraStateType state,
bool  apply 
)
inlinestatic
1036 {
1037 Unit* unit = handler->getSelectedUnit();
1038 if (!unit)
1039 {
1041 handler->SetSentErrorMessage(true);
1042 return false;
1043 }
1044
1045 if (!state)
1046 {
1047 // reset all states
1048 for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
1049 unit->ModifyAuraState(s, false);
1050 return true;
1051 }
1052
1053 unit->ModifyAuraState(*state, apply);
1054 return true;
1055 }
AuraStateType
Definition: SharedDefines.h:1260
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:11301

References ChatHandler::getSelectedUnit(), LANG_SELECT_CHAR_OR_CREATURE, Unit::ModifyAuraState(), ChatHandler::SendSysMessage(), and ChatHandler::SetSentErrorMessage().

Referenced by GetCommands().

◆ HandleDebugSetItemValueCommand()

static bool debug_commandscript::HandleDebugSetItemValueCommand ( ChatHandler handler,
ObjectGuid::LowType  guid,
uint32  index,
uint32  value 
)
inlinestatic
982 {
983 Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
984
985 if (!i)
986 return false;
987
988 if (index >= i->GetValuesCount())
989 return false;
990
991 i->SetUInt32Value(index, value);
992
993 return true;
994 }

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
1058 {
1059 WorldObject* target = handler->getSelectedObject();
1060 if (!target)
1061 {
1063 handler->SetSentErrorMessage(true);
1064 return false;
1065 }
1066
1067 if (index >= target->GetValuesCount())
1068 {
1069 handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, target->GetGUID().GetCounter(), target->GetValuesCount());
1070 return false;
1071 }
1072
1073 if (value.holds_alternative<uint32>())
1074 {
1075 target->SetUInt32Value(index, value.get<uint32>());
1076 handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().GetCounter(), uint32(index), uint32(value));
1077 }
1078 else if (value.holds_alternative<float>())
1079 {
1080 target->SetFloatValue(index, value.get<float>());
1081 handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().GetCounter(), static_cast<float>(index), uint32(value));
1082 }
1083
1084 return true;
1085 }
@ LANG_SET_UINT_FIELD
Definition: Language.h:606
@ LANG_SET_FLOAT_FIELD
Definition: Language.h:608
constexpr decltype(auto) get()
Definition: ChatCommandTags.h:289
constexpr bool holds_alternative() const
Definition: ChatCommandTags.h:303
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:739

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::SendSysMessage(), Object::SetFloatValue(), ChatHandler::SetSentErrorMessage(), and Object::SetUInt32Value().

Referenced by GetCommands().

◆ HandleDebugSetVehicleIdCommand()

static bool debug_commandscript::HandleDebugSetVehicleIdCommand ( ChatHandler handler,
uint32  id 
)
inlinestatic
876 {
877 Unit* target = handler->getSelectedUnit();
878 if (!target || target->IsVehicle())
879 return false;
880
881 //target->SetVehicleId(id);
882 handler->PSendSysMessage("Vehicle id set to %u", id);
883 return true;
884 }

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
915 {
916 float x, y, z, o = handler->GetPlayer()->GetOrientation();
917 handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
918
919 if (!id)
920 return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
921
922 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
923
924 if (!ci)
925 return false;
926
927 VehicleEntry const* ve = sVehicleStore.LookupEntry(*id);
928
929 if (!ve)
930 return false;
931
932 Creature* v = new Creature();
933
934 Map* map = handler->GetPlayer()->GetMap();
935
936 if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, *id, x, y, z, o))
937 {
938 delete v;
939 return false;
940 }
941
942 map->AddToMap(v->ToCreature());
943
944 return true;
945 }
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
#define sObjectMgr
Definition: ObjectMgr.h:1612
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:1087
Definition: CreatureData.h:176
Creature * ToCreature()
Definition: Object.h:197
uint32 GetPhaseMask() const
Definition: Object.h:434
Map * GetMap() const
Definition: Object.h:517
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:2647
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr) const
Definition: Object.cpp:2303
float GetOrientation() const
Definition: Position.h:120
float GetCombatReach() const override
Definition: Unit.h:1347
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:632
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:557
Definition: DBCStructure.h:1989

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
804 {
805 Creature* target = handler->getSelectedCreature();
806 if (!target || target->IsTotem() || target->IsPet())
807 return false;
808
809 auto const& threatList = target->GetThreatMgr().GetThreatList();
810 ThreatContainer::StorageType::const_iterator itr;
811 uint32 count = 0;
812
813 handler->PSendSysMessage("Threat list of %s (%s)", target->GetName().c_str(), target->GetGUID().ToString().c_str());
814
815 for (itr = threatList.begin(); itr != threatList.end(); ++itr)
816 {
817 Unit* unit = (*itr)->getTarget();
818 if (!unit)
819 {
820 handler->PSendSysMessage(" %u. No Unit - threat %f", ++count, (*itr)->GetThreat());
821 continue;
822 }
823
824 handler->PSendSysMessage(" %u. %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->GetThreat());
825 }
826
827 auto const& threatList2 = target->GetThreatMgr().GetOfflineThreatList();
828 for (itr = threatList2.begin(); itr != threatList2.end(); ++itr)
829 {
830 Unit* unit = (*itr)->getTarget();
831 if (!unit)
832 {
833 handler->PSendSysMessage(" %u. [offline] No Unit - threat %f", ++count, (*itr)->GetThreat());
834 continue;
835 }
836
837 handler->PSendSysMessage(" %u. [offline] %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->GetThreat());
838 }
839
840 handler->SendSysMessage("End of threat list.");
841
842 return true;
843 }
ThreatContainer::StorageType const & GetOfflineThreatList() const
Definition: ThreatMgr.h:272
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:271
bool IsPet() const
Definition: Unit.h:1413
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2404
bool IsTotem() const
Definition: Unit.h:1415

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
1250 {
1251 Unit* target = handler->getSelectedUnit();
1252 if (!target)
1253 target = handler->GetSession()->GetPlayer();
1254
1255 target->ClearUnitState(target->GetUnitState());
1256 target->AddUnitState(unitState);
1257
1258 return true;
1259 }
void ClearUnitState(uint32 f)
Definition: Unit.h:1399
uint32 GetUnitState() const
Definition: Unit.h:1400
void AddUnitState(uint32 f)
Definition: Unit.h:1397

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
1138 {
1139 Unit* unit = handler->getSelectedUnit();
1140 if (!unit)
1141 {
1143 handler->SetSentErrorMessage(true);
1144 return false;
1145 }
1146
1147 if (!index)
1148 return true;
1149
1150 // check index
1151 if (unit->GetTypeId() == TYPEID_PLAYER)
1152 {
1153 if (index >= PLAYER_END)
1154 return true;
1155 }
1156 else if (index >= UNIT_END)
1157 return true;
1158
1159 if (!value)
1160 {
1161 value = unit->GetUInt32Value(index);
1162
1163 handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().GetCounter(), index, *value);
1164 return true;
1165 }
1166
1167 unit->SetUInt32Value(index, *value);
1168
1169 handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().GetCounter(), index, *value);
1170 return true;
1171 }
@ 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::SendSysMessage(), ChatHandler::SetSentErrorMessage(), Object::SetUInt32Value(), TYPEID_PLAYER, and UNIT_END.

Referenced by GetCommands().

◆ HandleDebugUpdateWorldStateCommand()

static bool debug_commandscript::HandleDebugUpdateWorldStateCommand ( ChatHandler handler,
uint32  variable,
uint32  value 
)
inlinestatic
455 {
456 handler->GetPlayer()->SendUpdateWorldState(variable, value);
457 return true;
458 }
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2191

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

Referenced by GetCommands().

◆ HandleDebugVisualCommand()

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

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

Referenced by GetCommands().

◆ HandleWPGPSCommand()

static bool debug_commandscript::HandleWPGPSCommand ( ChatHandler handler)
inlinestatic
1262 {
1263 Player* player = handler->GetSession()->GetPlayer();
1264
1265 LOG_INFO("sql.dev", "(@PATH, XX, {0:.3f}, {0:.3f}, {0:.5f}, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
1266
1267 handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
1268 return true;
1269 }
#define LOG_INFO(filterType__,...)
Definition: Log.h:167

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

Referenced by GetCommands().