TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
debug_commandscript Class Reference

Public Member Functions

 debug_commandscript ()
 
std::vector< ChatCommandGetCommands () const override
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Static Public Member Functions

static bool HandleDebugPlayCinematicCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugPlayMovieCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugPlaySoundCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSendSpellFailCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSendEquipErrorCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSendSellErrorCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSendBuyErrorCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSendOpcodeCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugUpdateWorldStateCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugAreaTriggersCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugSendChannelNotifyCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSendChatMsgCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSendQuestPartyMsgCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugGetLootRecipientCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugSendQuestInvalidMsgCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugGetItemStateCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugBattlegroundCommand (ChatHandler *, char const *)
 
static bool HandleDebugArenaCommand (ChatHandler *, char const *)
 
static bool HandleDebugThreatListCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugHostileRefListCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugSetVehicleIdCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugEnterVehicleCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSpawnVehicleCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSendLargePacketCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugSendSetPhaseShiftCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugGetItemValueCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSetItemValueCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugItemExpireCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugAnimCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugLoSCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugSetAuraStateCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSetValueCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugGetValueCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugMod32ValueCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugUpdateCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugSet32BitCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugMoveflagsCommand (ChatHandler *handler, char const *args)
 
static bool HandleWPGPSCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugTransportCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugLoadCellsCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugBoundaryCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugPhaseCommand (ChatHandler *handler, char const *)
 
static bool HandleDebugSendPlaySceneCommand (ChatHandler *handler, char const *args)
 
static bool HandleDebugRaidResetCommand (ChatHandler *, char const *args)
 

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

Constructor & Destructor Documentation

debug_commandscript::debug_commandscript ( )
inline
46 : CommandScript("debug_commandscript") { }
CommandScript(const char *name)
Definition: ScriptMgr.cpp:1616

Member Function Documentation

std::vector<ChatCommand> debug_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

49  {
50  static std::vector<ChatCommand> debugPlayCommandTable =
51  {
55  };
56  static std::vector<ChatCommand> debugSendCommandTable =
57  {
70  };
71  static std::vector<ChatCommand> debugCommandTable =
72  {
84  { "play", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY, false, NULL, "", debugPlayCommandTable },
85  { "send", rbac::RBAC_PERM_COMMAND_DEBUG_SEND, false, NULL, "", debugSendCommandTable },
103  };
104  static std::vector<ChatCommand> commandTable =
105  {
106  { "debug", rbac::RBAC_PERM_COMMAND_DEBUG, true, NULL, "", debugCommandTable },
107  { "wpgps", rbac::RBAC_PERM_COMMAND_WPGPS, false, &HandleWPGPSCommand, "" },
108  };
109  return commandTable;
110  }
static bool HandleWPGPSCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:1364
static bool HandleDebugSendOpcodeCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:258
static bool HandleDebugEnterVehicleCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:862
static bool HandleDebugGetItemValueCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:986
static bool HandleDebugSetItemValueCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1015
static bool HandleDebugUpdateWorldStateCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:429
static bool HandleDebugArenaCommand(ChatHandler *, char const *)
Definition: cs_debug.cpp:794
static bool HandleDebugSendSellErrorCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:238
static bool HandleDebugUpdateCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1239
static bool HandleDebugPlayCinematicCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:112
static bool HandleDebugAnimCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1067
static bool HandleDebugSendChatMsgCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:478
arena_t NULL
Definition: jemalloc_internal.h:624
static bool HandleDebugMoveflagsCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1319
Definition: RBAC.h:219
static bool HandleDebugLoadCellsCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1400
static bool HandleDebugThreatListCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:800
static bool HandleDebugSendSpellFailCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:198
Definition: RBAC.h:207
Definition: RBAC.h:247
static bool HandleDebugSet32BitCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1288
static bool HandleDebugSendChannelNotifyCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:460
static bool HandleDebugPlaySoundCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:161
static bool HandleDebugTransportCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1374
static bool HandleDebugBoundaryCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1424
static bool HandleDebugSendBuyErrorCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:248
static bool HandleDebugPhaseCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:1451
static bool HandleDebugRaidResetCommand(ChatHandler *, char const *args)
Definition: cs_debug.cpp:1527
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:510
static bool HandleDebugGetItemStateCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:517
static bool HandleDebugSendEquipErrorCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:228
static bool HandleDebugSetAuraStateCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1084
static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:955
Definition: RBAC.h:246
static bool HandleDebugMod32ValueCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1209
static bool HandleDebugAreaTriggersCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:443
static bool HandleDebugSendPlaySceneCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1484
static bool HandleDebugItemExpireCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1044
Definition: RBAC.h:211
static bool HandleDebugSetVehicleIdCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:843
static bool HandleDebugSpawnVehicleCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:897
static bool HandleDebugSetValueCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1114
static bool HandleDebugGetValueCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:1163
static bool HandleDebugGetLootRecipientCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:498
static bool HandleDebugSendLargePacketCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:945
static bool HandleDebugPlayMovieCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:136
static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler *handler, char const *args)
Definition: cs_debug.cpp:491
static bool HandleDebugHostileRefListCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:822
static bool HandleDebugBattlegroundCommand(ChatHandler *, char const *)
Definition: cs_debug.cpp:788
static bool HandleDebugLoSCommand(ChatHandler *handler, char const *)
Definition: cs_debug.cpp:1077

+ Here is the call graph for this function:

static bool debug_commandscript::HandleDebugAnimCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1068  {
1069  if (!*args)
1070  return false;
1071 
1072  uint32 animId = atoi((char*)args);
1073  handler->GetSession()->GetPlayer()->HandleEmoteCommand(animId);
1074  return true;
1075  }
Player * GetPlayer() const
Definition: WorldSession.h:927
uint32_t uint32
Definition: Define.h:150
WorldSession * GetSession()
Definition: Chat.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugAreaTriggersCommand ( ChatHandler handler,
char const  
)
inlinestatic
444  {
445  Player* player = handler->GetSession()->GetPlayer();
446  if (!player->isDebugAreaTriggers)
447  {
449  player->isDebugAreaTriggers = true;
450  }
451  else
452  {
454  player->isDebugAreaTriggers = false;
455  }
456  return true;
457  }
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:1001
Definition: Language.h:1000
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugArenaCommand ( ChatHandler ,
char const  
)
inlinestatic
795  {
796  sBattlegroundMgr->ToggleArenaTesting();
797  return true;
798  }
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:181

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugBattlegroundCommand ( ChatHandler ,
char const  
)
inlinestatic
789  {
790  sBattlegroundMgr->ToggleTesting();
791  return true;
792  }
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:181

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugBoundaryCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1425  {
1426  Player* player = handler->GetSession()->GetPlayer();
1427  if (!player)
1428  return false;
1429  Creature* target = handler->getSelectedCreature();
1430  if (!target || !target->IsAIEnabled || !target->AI())
1431  {
1432  return false;
1433  }
1434 
1435  char* fill_str = args ? strtok((char*)args, " ") : nullptr;
1436  char* duration_str = args ? strtok(nullptr, " ") : nullptr;
1437 
1438  int duration = duration_str ? atoi(duration_str) : -1;
1439  if (duration <= 0 || duration >= 30 * MINUTE) // arbitary upper limit
1440  duration = 3 * MINUTE;
1441 
1442  bool doFill = fill_str ? (stricmp(fill_str, "FILL") == 0) : false;
1443 
1444  int32 errMsg = target->AI()->VisualizeBoundary(duration, player, doFill);
1445  if (errMsg > 0)
1446  handler->PSendSysMessage(errMsg);
1447 
1448  return true;
1449  }
Creature * getSelectedCreature()
Definition: Chat.cpp:615
Definition: Creature.h:467
Player * GetPlayer() const
Definition: WorldSession.h:927
bool IsAIEnabled
Definition: Unit.h:2161
Definition: Common.h:97
CreatureAI * AI() const
Definition: Creature.h:525
int32_t int32
Definition: Define.h:146
int32 VisualizeBoundary(uint32 duration, Unit *owner=nullptr, bool fill=false) const
Definition: CreatureAI.cpp:283
#define stricmp
Definition: FileSystem.cpp:39
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugEnterVehicleCommand ( ChatHandler handler,
char const args 
)
inlinestatic
863  {
864  Unit* target = handler->getSelectedUnit();
865  if (!target || !target->IsVehicle())
866  return false;
867 
868  if (!args)
869  return false;
870 
871  char* i = strtok((char*)args, " ");
872  if (!i)
873  return false;
874 
875  char* j = strtok(NULL, " ");
876 
877  uint32 entry = (uint32)atoi(i);
878  int8 seatId = j ? (int8)atoi(j) : -1;
879 
880  if (!entry)
881  handler->GetSession()->GetPlayer()->EnterVehicle(target, seatId);
882  else
883  {
884  Creature* passenger = NULL;
885  Trinity::AllCreaturesOfEntryInRange check(handler->GetSession()->GetPlayer(), entry, 20.0f);
887  handler->GetSession()->GetPlayer()->VisitNearbyObject(30.0f, searcher);
888  if (!passenger || passenger == target)
889  return false;
890  passenger->EnterVehicle(target, seatId);
891  }
892 
893  handler->PSendSysMessage("Unit %u entered vehicle %d", entry, (int32)seatId);
894  return true;
895  }
int8_t int8
Definition: Define.h:148
bool IsVehicle() const
Definition: Unit.h:1406
Unit * getSelectedUnit()
Definition: Chat.cpp:591
int8_t int8
Definition: g3dmath.h:163
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
Player * GetPlayer() const
Definition: WorldSession.h:927
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: GridNotifiers.h:1265
Definition: GridNotifiers.h:428
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
uint32_t uint32
Definition: g3dmath.h:168
T check(T value)
Definition: format.h:305
Definition: Unit.h:1305
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition: Unit.cpp:15249

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugGetItemValueCommand ( ChatHandler handler,
char const args 
)
inlinestatic
987  {
988  if (!*args)
989  return false;
990 
991  char* e = strtok((char*)args, " ");
992  char* f = strtok(NULL, " ");
993 
994  if (!e || !f)
995  return false;
996 
997  ObjectGuid::LowType guid = strtoull(e, nullptr, 10);
998  uint32 index = (uint32)atoi(f);
999 
1000  Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid::Create<HighGuid::Item>(guid));
1001 
1002  if (!i)
1003  return false;
1004 
1005  if (index >= i->GetValuesCount())
1006  return false;
1007 
1008  uint32 value = i->GetUInt32Value(index);
1009 
1010  handler->PSendSysMessage("Item " UI64FMTD ": value at %u is %u", guid, index, value);
1011 
1012  return true;
1013  }
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
arena_t NULL
Definition: jemalloc_internal.h:624
Player * GetPlayer() const
Definition: WorldSession.h:927
uint64 LowType
Definition: ObjectGuid.h:199
Definition: Item.h:259
#define UI64FMTD
Definition: Define.h:137
uint32_t uint32
Definition: Define.h:150
uint16 GetValuesCount() const
Definition: Object.h:178
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugGetLootRecipientCommand ( ChatHandler handler,
char const  
)
inlinestatic
499  {
500  Creature* target = handler->getSelectedCreature();
501  if (!target)
502  return false;
503 
504  handler->PSendSysMessage("Loot recipient for creature %s (%s, DB GUID " UI64FMTD ") is %s",
505  target->GetName().c_str(), target->GetGUID().ToString().c_str(), target->GetSpawnId(),
506  target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName().c_str() : "offline") : "no loot recipient");
507  return true;
508  }
Creature * getSelectedCreature()
Definition: Chat.cpp:615
std::string const & GetName() const
Definition: Object.h:479
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:487
Definition: Creature.h:467
#define UI64FMTD
Definition: Define.h:137
Player * GetLootRecipient() const
Definition: Creature.cpp:977
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool hasLootRecipient() const
Definition: Creature.h:586
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugGetValueCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1164  {
1165  if (!*args)
1166  return false;
1167 
1168  char* x = strtok((char*)args, " ");
1169  char* z = strtok(NULL, " ");
1170 
1171  if (!x)
1172  return false;
1173 
1174  Unit* target = handler->getSelectedUnit();
1175  if (!target)
1176  {
1178  handler->SetSentErrorMessage(true);
1179  return false;
1180  }
1181 
1182  ObjectGuid guid = target->GetGUID();
1183 
1184  uint32 opcode = (uint32)atoi(x);
1185  if (opcode >= target->GetValuesCount())
1186  {
1187  handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, guid.ToString().c_str(), target->GetValuesCount());
1188  return false;
1189  }
1190 
1191  bool isInt32 = true;
1192  if (z)
1193  isInt32 = atoi(z) != 0;
1194 
1195  if (isInt32)
1196  {
1197  uint32 value = target->GetUInt32Value(opcode);
1198  handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.ToString().c_str(), opcode, value);
1199  }
1200  else
1201  {
1202  float value = target->GetFloatValue(opcode);
1203  handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.ToString().c_str(), opcode, value);
1204  }
1205 
1206  return true;
1207  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Language.h:588
Definition: Language.h:594
Definition: Language.h:596
G3D::int16 z
Definition: Vector3int16.h:46
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
uint32_t uint32
Definition: Define.h:150
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint16 GetValuesCount() const
Definition: Object.h:178
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugHostileRefListCommand ( ChatHandler handler,
char const  
)
inlinestatic
823  {
824  Unit* target = handler->getSelectedUnit();
825  if (!target)
826  target = handler->GetSession()->GetPlayer();
828  uint32 count = 0;
829  handler->PSendSysMessage("Hostil reference list of %s (%s)", target->GetName().c_str(), target->GetGUID().ToString().c_str());
830  while (ref)
831  {
832  if (Unit* unit = ref->GetSource()->GetOwner())
833  {
834  ++count;
835  handler->PSendSysMessage(" %u. %s (%s) - threat %f", count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), ref->getThreat());
836  }
837  ref = ref->next();
838  }
839  handler->SendSysMessage("End of hostil reference list.");
840  return true;
841  }
Unit * getSelectedUnit()
Definition: Chat.cpp:591
std::string const & GetName() const
Definition: Object.h:479
float getThreat() const
Definition: ThreatManager.h:61
Player * GetPlayer() const
Definition: WorldSession.h:927
HostileRefManager & getHostileRefManager()
Definition: Unit.h:2001
HostileReference * next()
Definition: ThreatManager.h:116
Definition: ThreatManager.h:49
uint32_t uint32
Definition: Define.h:150
ObjectGuid const & GetGUID() const
Definition: Object.h:105
HostileReference * getFirst()
Definition: HostileRefManager.h:58
FROM * GetSource() const
Definition: Reference.h:96
WorldSession * GetSession()
Definition: Chat.h:59
Unit * GetOwner() const
Definition: ThreatManager.h:228
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugItemExpireCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1045  {
1046  if (!*args)
1047  return false;
1048 
1049  char* e = strtok((char*)args, " ");
1050  if (!e)
1051  return false;
1052 
1053  ObjectGuid::LowType guid = strtoull(e, nullptr, 10);
1054 
1055  Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid::Create<HighGuid::Item>(guid));
1056 
1057  if (!i)
1058  return false;
1059 
1060  handler->GetSession()->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
1061  sScriptMgr->OnItemExpire(handler->GetSession()->GetPlayer(), i->GetTemplate());
1062 
1063  return true;
1064  }
Player * GetPlayer() const
Definition: WorldSession.h:927
uint64 LowType
Definition: ObjectGuid.h:199
Definition: Item.h:259
uint8 GetSlot() const
Definition: Item.h:329
WorldSession * GetSession()
Definition: Chat.h:59
#define sScriptMgr
Definition: ScriptMgr.h:837
uint8 GetBagSlot() const
Definition: Item.cpp:759
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugLoadCellsCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1401  {
1402  Player* player = handler->GetSession()->GetPlayer();
1403  if (!player)
1404  return false;
1405 
1406  Map* map = nullptr;
1407 
1408  if (*args)
1409  {
1410  int32 mapId = atoi(args);
1411  map = sMapMgr->FindBaseNonInstanceMap(mapId);
1412  }
1413  if (!map)
1414  map = player->GetMap();
1415 
1416  for (uint32 cellX = 0; cellX < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellX++)
1417  for (uint32 cellY = 0; cellY < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellY++)
1418  map->LoadGrid((cellX + 0.5f - CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL, (cellY + 0.5f - CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL);
1419 
1420  handler->PSendSysMessage("Cells loaded (mapId: %u)", map->GetId());
1421  return true;
1422  }
#define CENTER_GRID_CELL_ID
Definition: GridDefines.h:49
#define SIZE_OF_GRID_CELL
Definition: GridDefines.h:47
void LoadGrid(float x, float y)
Definition: Map.cpp:508
Player * GetPlayer() const
Definition: WorldSession.h:927
#define TOTAL_NUMBER_OF_CELLS_PER_MAP
Definition: GridDefines.h:52
uint32 GetId(void) const
Definition: Map.h:325
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: Map.h:259
#define sMapMgr
Definition: MapManager.h:194
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugLoSCommand ( ChatHandler handler,
char const  
)
inlinestatic
1078  {
1079  if (Unit* unit = handler->getSelectedUnit())
1080  handler->PSendSysMessage("Unit %s (%s) is %sin LoS", unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not ");
1081  return true;
1082  }
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugMod32ValueCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1210  {
1211  if (!*args)
1212  return false;
1213 
1214  char* x = strtok((char*)args, " ");
1215  char* y = strtok(NULL, " ");
1216 
1217  if (!x || !y)
1218  return false;
1219 
1220  uint32 opcode = (uint32)atoi(x);
1221  int value = atoi(y);
1222 
1223  if (opcode >= handler->GetSession()->GetPlayer()->GetValuesCount())
1224  {
1225  handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str(), handler->GetSession()->GetPlayer()->GetValuesCount());
1226  return false;
1227  }
1228 
1229  int currentValue = (int)handler->GetSession()->GetPlayer()->GetUInt32Value(opcode);
1230 
1231  currentValue += value;
1232  handler->GetSession()->GetPlayer()->SetUInt32Value(opcode, (uint32)currentValue);
1233 
1234  handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, opcode, currentValue);
1235 
1236  return true;
1237  }
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Language.h:588
Player * GetPlayer() const
Definition: WorldSession.h:927
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
Definition: Language.h:600
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugMoveflagsCommand ( ChatHandler handler,
char const args 
)
inlinestatic

Display case

: port master's HandleDebugMoveflagsCommand; flags need different handling

1320  {
1321  Unit* target = handler->getSelectedUnit();
1322  if (!target)
1323  target = handler->GetSession()->GetPlayer();
1324 
1325  if (!*args)
1326  {
1329  }
1330  else
1331  {
1332  char* mask1 = strtok((char*)args, " ");
1333  if (!mask1)
1334  return false;
1335 
1336  char* mask2 = strtok(NULL, " \n");
1337 
1338  uint32 moveFlags = (uint32)atoi(mask1);
1339  target->SetUnitMovementFlags(moveFlags);
1340 
1342 
1343  if (mask2)
1344  {
1345  uint32 moveFlagsExtra = uint32(atoi(mask2));
1346  target->SetExtraUnitMovementFlags(moveFlagsExtra);
1347  }
1348 
1349  if (target->GetTypeId() != TYPEID_PLAYER)
1350  target->DestroyForNearbyPlayers(); // Force new SMSG_UPDATE_OBJECT:CreateObject
1351  else
1352  {
1354  moveUpdate.movementInfo = &target->m_movementInfo;
1355  target->SendMessageToSet(moveUpdate.Write(), true);
1356  }
1357 
1359  }
1360 
1361  return true;
1362  }
MovementInfo * movementInfo
Definition: MovementPackets.h:52
uint32 GetUnitMovementFlags() const
Definition: Unit.h:2110
Unit * getSelectedUnit()
Definition: Chat.cpp:591
MovementInfo m_movementInfo
Definition: Object.h:612
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Language.h:947
Player * GetPlayer() const
Definition: WorldSession.h:927
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Language.h:946
uint32_t uint32
Definition: Define.h:150
WorldPacket const * Write() override
Definition: MovementPackets.cpp:470
void SetUnitMovementFlags(uint32 f)
Definition: Unit.h:2111
Definition: MovementPackets.h:45
Definition: ObjectGuid.h:33
WorldSession * GetSession()
Definition: Chat.h:59
void SetExtraUnitMovementFlags(uint16 f)
Definition: Unit.h:2117
void DestroyForNearbyPlayers()
Definition: Object.cpp:2974
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
uint32_t uint32
Definition: g3dmath.h:168
virtual void SendMessageToSet(WorldPacket const *data, bool self)
Definition: Object.cpp:2144
Definition: Unit.h:1305
uint16 GetExtraUnitMovementFlags() const
Definition: Unit.h:2116

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugPhaseCommand ( ChatHandler handler,
char const  
)
inlinestatic
1452  {
1453  Unit* target = handler->getSelectedUnit();
1454 
1455  if (!target)
1456  {
1458  handler->SetSentErrorMessage(true);
1459  return false;
1460  }
1461 
1462  if (target->GetTypeId() == TYPEID_UNIT)
1463  {
1464  if (target->ToCreature()->GetDBPhase() > 0)
1465  handler->PSendSysMessage("Target creature's PhaseId in DB: %d", target->ToCreature()->GetDBPhase());
1466  else if (target->ToCreature()->GetDBPhase() < 0)
1467  handler->PSendSysMessage("Target creature's PhaseGroup in DB: %d", abs(target->ToCreature()->GetDBPhase()));
1468  }
1469 
1470  std::stringstream phases;
1471 
1472  for (uint32 phase : target->GetPhases())
1473  {
1474  phases << phase << " ";
1475  }
1476 
1477  if (!phases.str().empty())
1478  handler->PSendSysMessage("Target's current phases: %s", phases.str().c_str());
1479  else
1480  handler->SendSysMessage("Target is not phased");
1481  return true;
1482  }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: ObjectGuid.h:32
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Language.h:33
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > const & GetPhases() const
Definition: Object.h:465
int32 GetDBPhase() const
Definition: Object.h:468
Creature * ToCreature()
Definition: Object.h:194
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugPlayCinematicCommand ( ChatHandler handler,
char const args 
)
inlinestatic
113  {
114  // USAGE: .debug play cinematic #cinematicid
115  // #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
116  if (!*args)
117  {
118  handler->SendSysMessage(LANG_BAD_VALUE);
119  handler->SetSentErrorMessage(true);
120  return false;
121  }
122 
123  uint32 id = atoi((char*)args);
124 
125  if (!sCinematicSequencesStore.LookupEntry(id))
126  {
128  handler->SetSentErrorMessage(true);
129  return false;
130  }
131 
132  handler->GetSession()->GetPlayer()->SendCinematicStart(id);
133  return true;
134  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Player * GetPlayer() const
Definition: WorldSession.h:927
uint32_t uint32
Definition: Define.h:150
DB2Storage< CinematicSequencesEntry > sCinematicSequencesStore("CinematicSequences.db2", CinematicSequencesFormat, HOTFIX_SEL_CINEMATIC_SEQUENCES)
Definition: Language.h:139
Definition: Language.h:998
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugPlayMovieCommand ( ChatHandler handler,
char const args 
)
inlinestatic
137  {
138  // USAGE: .debug play movie #movieid
139  // #movieid - ID decimal number from Movie.dbc (1st column)
140  if (!*args)
141  {
142  handler->SendSysMessage(LANG_BAD_VALUE);
143  handler->SetSentErrorMessage(true);
144  return false;
145  }
146 
147  uint32 id = atoi((char*)args);
148 
149  if (!sMovieStore.LookupEntry(id))
150  {
152  handler->SetSentErrorMessage(true);
153  return false;
154  }
155 
156  handler->GetSession()->GetPlayer()->SendMovieStart(id);
157  return true;
158  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Player * GetPlayer() const
Definition: WorldSession.h:927
DBCStorage< MovieEntry > sMovieStore(Moviefmt)
uint32_t uint32
Definition: Define.h:150
Definition: Language.h:139
Definition: Language.h:999
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugPlaySoundCommand ( ChatHandler handler,
char const args 
)
inlinestatic
162  {
163  // USAGE: .debug playsound #soundid
164  // #soundid - ID decimal number from SoundEntries.dbc (1st column)
165  if (!*args)
166  {
167  handler->SendSysMessage(LANG_BAD_VALUE);
168  handler->SetSentErrorMessage(true);
169  return false;
170  }
171 
172  uint32 soundId = atoi((char*)args);
173 
174  if (!sSoundEntriesStore.LookupEntry(soundId))
175  {
176  handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
177  handler->SetSentErrorMessage(true);
178  return false;
179  }
180 
181  Unit* unit = handler->getSelectedUnit();
182  if (!unit)
183  {
185  handler->SetSentErrorMessage(true);
186  return false;
187  }
188 
189  if (!handler->GetSession()->GetPlayer()->GetTarget().IsEmpty())
190  unit->PlayDistanceSound(soundId, handler->GetSession()->GetPlayer());
191  else
192  unit->PlayDirectSound(soundId, handler->GetSession()->GetPlayer());
193 
194  handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId);
195  return true;
196  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
void PlayDirectSound(uint32 sound_id, Player *target=NULL)
Definition: Object.cpp:2966
Definition: Language.h:188
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
Player * GetPlayer() const
Definition: WorldSession.h:927
uint32_t uint32
Definition: Define.h:150
Definition: Language.h:139
Definition: Language.h:202
WorldSession * GetSession()
Definition: Chat.h:59
void PlayDistanceSound(uint32 sound_id, Player *target=NULL)
Definition: Object.cpp:2955
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305
DB2Storage< SoundEntriesEntry > sSoundEntriesStore("SoundEntries.db2", SoundEntriesFormat, HOTFIX_SEL_SOUND_ENTRIES)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugRaidResetCommand ( ChatHandler ,
char const args 
)
inlinestatic
1528  {
1529  char* map_str = args ? strtok((char*)args, " ") : nullptr;
1530  char* difficulty_str = args ? strtok(nullptr, " ") : nullptr;
1531 
1532  int32 map = map_str ? atoi(map_str) : -1;
1533  if (map <= 0)
1534  return false;
1535  MapEntry const* mEntry = sMapStore.LookupEntry(map);
1536  if (!mEntry || !mEntry->IsRaid())
1537  return false;
1538  int32 difficulty = difficulty_str ? atoi(difficulty_str) : -1;
1539  if (difficulty >= MAX_DIFFICULTY || difficulty < -1)
1540  return false;
1541 
1542  if (difficulty == -1)
1543  for (uint8 diff = 0; diff < MAX_DIFFICULTY; ++diff)
1544  {
1545  if (GetMapDifficultyData(mEntry->ID, Difficulty(diff)))
1546  sInstanceSaveMgr->ForceGlobalReset(mEntry->ID, Difficulty(diff));
1547  }
1548  else
1549  sInstanceSaveMgr->ForceGlobalReset(mEntry->ID, Difficulty(difficulty));
1550  return true;
1551  }
Difficulty
Definition: DBCEnums.h:402
MapDifficultyEntry const * GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
Definition: DBCStores.cpp:724
Definition: DBCEnums.h:426
Definition: DBCStructure.h:830
int32_t int32
Definition: Define.h:146
uint32 ID
Definition: DBCStructure.h:832
bool IsRaid() const
Definition: DBCStructure.h:860
#define sInstanceSaveMgr
Definition: InstanceSaveMgr.h:243
DBCStorage< MapEntry > sMapStore(Mapfmt)
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendBuyErrorCommand ( ChatHandler handler,
char const args 
)
inlinestatic
249  {
250  if (!*args)
251  return false;
252 
253  BuyResult msg = BuyResult(atoi(args));
254  handler->GetSession()->GetPlayer()->SendBuyError(msg, nullptr, 0, 0);
255  return true;
256  }
BuyResult
Definition: Item.h:148
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendChannelNotifyCommand ( ChatHandler handler,
char const args 
)
inlinestatic
461  {
462  if (!*args)
463  return false;
464 
465  char const* name = "test";
466  uint8 code = atoi(args);
467 
468  WorldPacket data(SMSG_CHANNEL_NOTIFY, (1+10));
469  data << code; // notify type
470  data << name; // channel name
471  data << uint32(0);
472  data << uint32(0);
473  handler->GetSession()->SendPacket(&data);
474  return true;
475  }
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
Definition: inftrees.h:24
WorldSession * GetSession()
Definition: Chat.h:59
Definition: Opcodes.h:884
uint8_t uint8
Definition: Define.h:152
uint32_t uint32
Definition: g3dmath.h:168
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendChatMsgCommand ( ChatHandler handler,
char const args 
)
inlinestatic
479  {
480  if (!*args)
481  return false;
482 
483  char const* msg = "testtest";
484  uint8 type = atoi(args);
486  packet.Initialize(ChatMsg(type), LANG_UNIVERSAL, handler->GetSession()->GetPlayer(), handler->GetSession()->GetPlayer(), msg, 0, "chan");
487  handler->GetSession()->SendPacket(packet.Write());
488  return true;
489  }
Definition: SharedDefines.h:961
Definition: ChatPackets.h:150
ChatMsg
Definition: SharedDefines.h:4228
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldPacket const * Write() override
Definition: ChatPackets.cpp:162
void Initialize(ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string message, uint32 achievementId=0, std::string channelName="", LocaleConstant locale=DEFAULT_LOCALE, std::string addonPrefix="")
Definition: ChatPackets.cpp:104
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
WorldSession * GetSession()
Definition: Chat.h:59
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendEquipErrorCommand ( ChatHandler handler,
char const args 
)
inlinestatic
229  {
230  if (!*args)
231  return false;
232 
233  InventoryResult msg = InventoryResult(atoi(args));
234  handler->GetSession()->GetPlayer()->SendEquipError(msg, NULL, NULL);
235  return true;
236  }
arena_t NULL
Definition: jemalloc_internal.h:624
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
InventoryResult
Definition: Item.h:46

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendLargePacketCommand ( ChatHandler handler,
char const  
)
inlinestatic
946  {
947  const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. ";
948  std::ostringstream ss;
949  while (ss.str().size() < 128000)
950  ss << stuffingString;
951  handler->SendSysMessage(ss.str().c_str());
952  return true;
953  }
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendOpcodeCommand ( ChatHandler handler,
char const  
)
inlinestatic
259  {
260  Unit* unit = handler->getSelectedUnit();
261  Player* player = NULL;
262  if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
263  player = handler->GetSession()->GetPlayer();
264  else
265  player = unit->ToPlayer();
266 
267  if (!unit)
268  unit = player;
269 
270  std::ifstream ifs("opcode.txt");
271  if (ifs.fail())
272  return false;
273 
274  // remove comments from file
275  std::stringstream parsedStream;
276  while (!ifs.eof())
277  {
278  char commentToken[2];
279  ifs.get(commentToken[0]);
280  if (commentToken[0] == '/' && !ifs.eof())
281  {
282  ifs.get(commentToken[1]);
283  // /* comment
284  if (commentToken[1] == '*')
285  {
286  while (!ifs.eof())
287  {
288  ifs.get(commentToken[0]);
289  if (commentToken[0] == '*' && !ifs.eof())
290  {
291  ifs.get(commentToken[1]);
292  if (commentToken[1] == '/')
293  break;
294  else
295  ifs.putback(commentToken[1]);
296  }
297  }
298  continue;
299  }
300  // line comment
301  else if (commentToken[1] == '/')
302  {
303  std::string str;
304  std::getline(ifs, str);
305  continue;
306  }
307  // regular data
308  else
309  ifs.putback(commentToken[1]);
310  }
311  parsedStream.put(commentToken[0]);
312  }
313  ifs.close();
314 
315  uint32 opcode;
316  parsedStream >> opcode;
317 
318  WorldPacket data(OpcodeServer(opcode), 0);
319 
320  while (!parsedStream.eof())
321  {
322  std::string type;
323  parsedStream >> type;
324 
325  if (type.empty())
326  break;
327 
328  if (type == "uint8")
329  {
330  uint16 val1;
331  parsedStream >> val1;
332  data << uint8(val1);
333  }
334  else if (type == "uint16")
335  {
336  uint16 val2;
337  parsedStream >> val2;
338  data << val2;
339  }
340  else if (type == "uint32")
341  {
342  uint32 val3;
343  parsedStream >> val3;
344  data << val3;
345  }
346  else if (type == "uint64")
347  {
348  uint64 val4;
349  parsedStream >> val4;
350  data << val4;
351  }
352  else if (type == "float")
353  {
354  float val5;
355  parsedStream >> val5;
356  data << val5;
357  }
358  else if (type == "string")
359  {
360  std::string val6;
361  parsedStream >> val6;
362  data << val6;
363  }
364  else if (type == "appitsguid")
365  {
366  data << unit->GetPackGUID();
367  }
368  else if (type == "appmyguid")
369  {
370  data << player->GetPackGUID();
371  }
372  else if (type == "appgoguid")
373  {
374  GameObject* obj = handler->GetNearbyGameObject();
375  if (!obj)
376  {
378  handler->SetSentErrorMessage(true);
379  ifs.close();
380  return false;
381  }
382  data << obj->GetPackGUID();
383  }
384  else if (type == "goguid")
385  {
386  GameObject* obj = handler->GetNearbyGameObject();
387  if (!obj)
388  {
390  handler->SetSentErrorMessage(true);
391  ifs.close();
392  return false;
393  }
394  data << obj->GetGUID();
395  }
396  else if (type == "myguid")
397  {
398  data << player->GetGUID();
399  }
400  else if (type == "itsguid")
401  {
402  data << unit->GetGUID();
403  }
404  else if (type == "itspos")
405  {
406  data << unit->GetPositionX();
407  data << unit->GetPositionY();
408  data << unit->GetPositionZ();
409  }
410  else if (type == "mypos")
411  {
412  data << player->GetPositionX();
413  data << player->GetPositionY();
414  data << player->GetPositionZ();
415  }
416  else
417  {
418  TC_LOG_ERROR("misc", "Sending opcode that has unknown type '%s'", type.c_str());
419  break;
420  }
421  }
422  TC_LOG_DEBUG("network", "Sending opcode %u", data.GetOpcode());
423  data.hexlike();
424  player->GetSession()->SendPacket(&data, true);
425  handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName().c_str());
426  return true;
427  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Unit * getSelectedUnit()
Definition: Chat.cpp:591
std::string const & GetName() const
Definition: Object.h:479
#define UI64LIT(N)
Definition: Define.h:138
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
OpcodeServer
Definition: Opcodes.h:725
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
uint16_t uint16
Definition: Define.h:151
PackedGuid const & GetPackGUID() const
Definition: Object.h:106
Definition: GameObject.h:880
Definition: Language.h:483
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
float GetPositionX() const
Definition: Position.h:104
GameObject * GetNearbyGameObject()
Definition: Chat.cpp:753
Definition: Unit.h:1305
Definition: WorldPacket.h:26
Definition: Language.h:305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendPlaySceneCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1485  {
1486  if (!*args)
1487  return false;
1488 
1489  int32 sceneID = 0;
1490  int32 playbackFlags = 0;
1491  int32 sceneInstanceID = 0;
1492  int32 sceneScriptPackageID = 0;
1493 
1494  char* a = strtok((char*)args, " ");
1495  char* b = strtok(NULL, " ");
1496  char* c = strtok(NULL, " ");
1497  char* d = strtok(NULL, " ");
1498 
1499  if (!a || !b || !c || !d)
1500  return false;
1501 
1502  if (a)
1503  sceneID = atoi(a);
1504  if (b)
1505  playbackFlags = atoi(b);
1506  if (c)
1507  sceneInstanceID = atoi(c);
1508  if (d)
1509  sceneScriptPackageID = atoi(d);
1510 
1511  Player* me = handler->GetSession()->GetPlayer();
1512 
1514  packet.SceneID = sceneID;
1515  packet.PlaybackFlags = playbackFlags;
1516  packet.SceneInstanceID = sceneInstanceID;
1517  packet.SceneScriptPackageID = sceneScriptPackageID;
1518  packet.TransportGUID = me->GetTransGUID();
1519  packet.Location = me->GetPosition();
1520  handler->GetSession()->SendPacket(packet.Write(), true);
1521 
1522  TC_LOG_DEBUG("network", "Sent SMSG_PLAY_SCENE to %s, SceneID: %d, PlaybackFlags: %d, SceneInstanceID: %d, SceneScriptPackageID: %d", me->GetName().c_str(), sceneID, playbackFlags, sceneInstanceID, sceneScriptPackageID);
1523 
1524  return true;
1525  }
int32 SceneInstanceID
Definition: ScenePackets.h:37
int32 SceneScriptPackageID
Definition: ScenePackets.h:38
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
int32 SceneID
Definition: ScenePackets.h:35
void GetPosition(float &x, float &y) const
Definition: Position.h:109
int32_t int32
Definition: Define.h:146
WorldPacket const * Write() override
Definition: ScenePackets.cpp:20
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
Position Location
Definition: ScenePackets.h:40
Definition: ScenePackets.h:28
WorldSession * GetSession()
Definition: Chat.h:59
int32 PlaybackFlags
Definition: ScenePackets.h:36
ObjectGuid TransportGUID
Definition: ScenePackets.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendQuestInvalidMsgCommand ( ChatHandler handler,
char const args 
)
inlinestatic
511  {
512  QuestFailedReason msg = static_cast<QuestFailedReason>(atoul(args));
513  handler->GetSession()->GetPlayer()->SendCanTakeQuestResponse(msg);
514  return true;
515  }
Player * GetPlayer() const
Definition: WorldSession.h:927
QuestFailedReason
Definition: QuestDef.h:53
unsigned long atoul(char const *str)
Definition: Common.h:90
WorldSession * GetSession()
Definition: Chat.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendQuestPartyMsgCommand ( ChatHandler handler,
char const args 
)
inlinestatic
492  {
493  uint32 msg = atoul(args);
494  handler->GetSession()->GetPlayer()->SendPushToPartyResponse(handler->GetSession()->GetPlayer(), static_cast<QuestPushReason>(msg));
495  return true;
496  }
Player * GetPlayer() const
Definition: WorldSession.h:927
unsigned long atoul(char const *str)
Definition: Common.h:90
uint32_t uint32
Definition: Define.h:150
QuestPushReason
Definition: QuestDef.h:71
WorldSession * GetSession()
Definition: Chat.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendSellErrorCommand ( ChatHandler handler,
char const args 
)
inlinestatic
239  {
240  if (!*args)
241  return false;
242 
243  SellResult msg = SellResult(atoi(args));
244  handler->GetSession()->GetPlayer()->SendSellError(msg, nullptr, ObjectGuid::Empty);
245  return true;
246  }
SellResult
Definition: Item.h:161
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendSetPhaseShiftCommand ( ChatHandler handler,
char const args 
)
inlinestatic
956  {
957  if (!*args)
958  return false;
959 
960  char* t = strtok((char*)args, " ");
961  char* p = strtok(NULL, " ");
962  char* m = strtok(NULL, " ");
963 
964  if (!t)
965  return false;
966 
967  std::set<uint32> terrainswap;
968  std::set<uint32> phaseId;
969  std::set<uint32> worldMapSwap;
970 
971  if (uint32 ut = (uint32)atoi(t))
972  terrainswap.insert(ut);
973 
974  if (p)
975  if (uint32 up = (uint32)atoi(p))
976  phaseId.insert(up);
977 
978  if (m)
979  if (uint32 um = (uint32)atoi(m))
980  worldMapSwap.insert(um);
981 
982  handler->GetSession()->SendSetPhaseShift(phaseId, terrainswap, worldMapSwap);
983  return true;
984  }
void SendSetPhaseShift(std::set< uint32 > const &phaseIds, std::set< uint32 > const &terrainswaps, std::set< uint32 > const &worldMapAreaSwaps)
Definition: MiscHandler.cpp:1030
arena_t NULL
Definition: jemalloc_internal.h:624
uint32_t uint32
Definition: Define.h:150
WorldSession * GetSession()
Definition: Chat.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSendSpellFailCommand ( ChatHandler handler,
char const args 
)
inlinestatic
199  {
200  if (!*args)
201  return false;
202 
203  char* result = strtok((char*)args, " ");
204  if (!result)
205  return false;
206 
207  uint8 failNum = (uint8)atoi(result);
208  if (failNum == 0 && *result != '0')
209  return false;
210 
211  char* fail1 = strtok(NULL, " ");
212  uint8 failArg1 = fail1 ? (uint8)atoi(fail1) : 0;
213 
214  char* fail2 = strtok(NULL, " ");
215  uint8 failArg2 = fail2 ? (uint8)atoi(fail2) : 0;
216 
218  castFailed.CastID = 0;
219  castFailed.SpellID = 133;
220  castFailed.Reason = failNum;
221  castFailed.FailedArg1 = failArg1;
222  castFailed.FailedArg2 = failArg2;
223  handler->GetSession()->SendPacket(castFailed.Write());
224 
225  return true;
226  }
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Opcodes.h:872
Definition: SpellPackets.h:422
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
uint8_t uint8
Definition: g3dmath.h:164
WorldSession * GetSession()
Definition: Chat.h:59
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSet32BitCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1289  {
1290  if (!*args)
1291  return false;
1292 
1293  WorldObject* target = handler->getSelectedObject();
1294  if (!target)
1295  {
1297  handler->SetSentErrorMessage(true);
1298  return false;
1299  }
1300 
1301  char* x = strtok((char*)args, " ");
1302  char* y = strtok(NULL, " ");
1303 
1304  if (!x || !y)
1305  return false;
1306 
1307  uint32 opcode = (uint32)atoi(x);
1308  uint32 val = (uint32)atoi(y);
1309  if (val > 32) //uint32 = 32 bits
1310  return false;
1311 
1312  uint32 value = val ? 1 << (val - 1) : 0;
1313  target->SetUInt32Value(opcode, value);
1314 
1315  handler->PSendSysMessage(LANG_SET_32BIT_FIELD, opcode, value);
1316  return true;
1317  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:32
Definition: Language.h:598
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: Object.h:423
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
WorldObject * getSelectedObject()
Definition: Chat.cpp:602
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSetAuraStateCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1085  {
1086  if (!*args)
1087  {
1088  handler->SendSysMessage(LANG_BAD_VALUE);
1089  handler->SetSentErrorMessage(true);
1090  return false;
1091  }
1092 
1093  Unit* unit = handler->getSelectedUnit();
1094  if (!unit)
1095  {
1097  handler->SetSentErrorMessage(true);
1098  return false;
1099  }
1100 
1101  int32 state = atoi((char*)args);
1102  if (!state)
1103  {
1104  // reset all states
1105  for (int i = 1; i <= 32; ++i)
1106  unit->ModifyAuraState(AuraStateType(i), false);
1107  return true;
1108  }
1109 
1110  unit->ModifyAuraState(AuraStateType(abs(state)), state > 0);
1111  return true;
1112  }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:7422
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
AuraStateType
Definition: SharedDefines.h:1754
int32_t int32
Definition: Define.h:146
Definition: Language.h:139
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSetItemValueCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1016  {
1017  if (!*args)
1018  return false;
1019 
1020  char* e = strtok((char*)args, " ");
1021  char* f = strtok(NULL, " ");
1022  char* g = strtok(NULL, " ");
1023 
1024  if (!e || !f || !g)
1025  return false;
1026 
1027  ObjectGuid::LowType guid = strtoull(e, nullptr, 10);
1028  uint32 index = (uint32)atoi(f);
1029  uint32 value = (uint32)atoi(g);
1030 
1031  Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid::Create<HighGuid::Item>(guid));
1032 
1033  if (!i)
1034  return false;
1035 
1036  if (index >= i->GetValuesCount())
1037  return false;
1038 
1039  i->SetUInt32Value(index, value);
1040 
1041  return true;
1042  }
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Player * GetPlayer() const
Definition: WorldSession.h:927
uint64 LowType
Definition: ObjectGuid.h:199
Definition: Item.h:259
uint32_t uint32
Definition: Define.h:150
uint16 GetValuesCount() const
Definition: Object.h:178
WorldSession * GetSession()
Definition: Chat.h:59
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSetValueCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1115  {
1116  if (!*args)
1117  return false;
1118 
1119  char* x = strtok((char*)args, " ");
1120  char* y = strtok(NULL, " ");
1121  char* z = strtok(NULL, " ");
1122 
1123  if (!x || !y)
1124  return false;
1125 
1126  WorldObject* target = handler->getSelectedObject();
1127  if (!target)
1128  {
1130  handler->SetSentErrorMessage(true);
1131  return false;
1132  }
1133 
1134  ObjectGuid guid = target->GetGUID();
1135 
1136  uint32 field = (uint32)atoi(x);
1137  if (field >= target->GetValuesCount())
1138  {
1139  handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.ToString().c_str(), target->GetValuesCount());
1140  return false;
1141  }
1142 
1143  bool isInt32 = true;
1144  if (z)
1145  isInt32 = atoi(z) != 0;
1146 
1147  if (isInt32)
1148  {
1149  uint32 value = (uint32)atoi(y);
1150  target->SetUInt32Value(field, value);
1151  handler->PSendSysMessage(LANG_SET_UINT_FIELD, guid.ToString().c_str(), field, value);
1152  }
1153  else
1154  {
1155  float value = (float)atof(y);
1156  target->SetFloatValue(field, value);
1157  handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, guid.ToString().c_str(), field, value);
1158  }
1159 
1160  return true;
1161  }
Definition: Language.h:592
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: Language.h:588
Definition: Object.h:423
Definition: Language.h:590
G3D::int16 z
Definition: Vector3int16.h:46
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint16 GetValuesCount() const
Definition: Object.h:178
WorldObject * getSelectedObject()
Definition: Chat.cpp:602
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSetVehicleIdCommand ( ChatHandler handler,
char const args 
)
inlinestatic
844  {
845  Unit* target = handler->getSelectedUnit();
846  if (!target || target->IsVehicle())
847  return false;
848 
849  if (!args)
850  return false;
851 
852  char* i = strtok((char*)args, " ");
853  if (!i)
854  return false;
855 
856  uint32 id = (uint32)atoi(i);
857  //target->SetVehicleId(id);
858  handler->PSendSysMessage("Vehicle id set to %u", id);
859  return true;
860  }
bool IsVehicle() const
Definition: Unit.h:1406
Unit * getSelectedUnit()
Definition: Chat.cpp:591
uint32_t uint32
Definition: Define.h:150
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
uint32_t uint32
Definition: g3dmath.h:168
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugSpawnVehicleCommand ( ChatHandler handler,
char const args 
)
inlinestatic
898  {
899  if (!*args)
900  return false;
901 
902  char* e = strtok((char*)args, " ");
903  char* i = strtok(NULL, " ");
904 
905  if (!e)
906  return false;
907 
908  uint32 entry = (uint32)atoi(e);
909 
910  float x, y, z, o = handler->GetSession()->GetPlayer()->GetOrientation();
911  handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, handler->GetSession()->GetPlayer()->GetObjectSize());
912 
913  if (!i)
914  return handler->GetSession()->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
915 
916  uint32 id = (uint32)atoi(i);
917 
918  CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
919 
920  if (!ci)
921  return false;
922 
923  VehicleEntry const* ve = sVehicleStore.LookupEntry(id);
924 
925  if (!ve)
926  return false;
927 
928  Creature* v = new Creature();
929 
930  Map* map = handler->GetSession()->GetPlayer()->GetMap();
931 
932  if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, x, y, z, o, nullptr, id))
933  {
934  delete v;
935  return false;
936  }
937 
938  v->CopyPhaseFrom(handler->GetSession()->GetPlayer());
939 
940  map->AddToMap(v->ToCreature());
941 
942  return true;
943  }
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const *data=nullptr, uint32 vehId=0)
Definition: Creature.cpp:834
arena_t NULL
Definition: jemalloc_internal.h:624
void CopyPhaseFrom(WorldObject *obj, bool update=false)
Definition: Object.cpp:2915
Definition: Creature.h:467
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: DBCStructure.h:1271
G3D::int16 z
Definition: Vector3int16.h:46
bool AddToMap(T *)
Definition: Map.cpp:566
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
Definition: Map.h:259
DBCStorage< VehicleEntry > sVehicleStore(Vehiclefmt)
Creature * ToCreature()
Definition: Object.h:194
WorldSession * GetSession()
Definition: Chat.h:59
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:561
Definition: Creature.h:79

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugThreatListCommand ( ChatHandler handler,
char const  
)
inlinestatic
801  {
802  Creature* target = handler->getSelectedCreature();
803  if (!target || target->IsTotem() || target->IsPet())
804  return false;
805 
806  ThreatContainer::StorageType const &threatList = target->getThreatManager().getThreatList();
807  ThreatContainer::StorageType::const_iterator itr;
808  uint32 count = 0;
809  handler->PSendSysMessage("Threat list of %s (%s)", target->GetName().c_str(), target->GetGUID().ToString().c_str());
810  for (itr = threatList.begin(); itr != threatList.end(); ++itr)
811  {
812  Unit* unit = (*itr)->getTarget();
813  if (!unit)
814  continue;
815  ++count;
816  handler->PSendSysMessage(" %u. %s (%s) - threat %f", count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->getThreat());
817  }
818  handler->SendSysMessage("End of threat list.");
819  return true;
820  }
Creature * getSelectedCreature()
Definition: Chat.cpp:615
std::string const & GetName() const
Definition: Object.h:479
ThreatContainer::StorageType const & getThreatList() const
Definition: ThreatManager.h:263
Definition: Creature.h:467
uint32_t uint32
Definition: Define.h:150
bool IsPet() const
Definition: Unit.h:1403
ObjectGuid const & GetGUID() const
Definition: Object.h:105
std::list< HostileReference * > StorageType
Definition: ThreatManager.h:149
bool IsTotem() const
Definition: Unit.h:1405
ThreatManager & getThreatManager()
Definition: Unit.h:1998
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugTransportCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1375  {
1376  Transport* transport = handler->GetSession()->GetPlayer()->GetTransport();
1377  if (!transport)
1378  return false;
1379 
1380  bool start = false;
1381  if (!stricmp(args, "stop"))
1382  transport->EnableMovement(false);
1383  else if (!stricmp(args, "start"))
1384  {
1385  transport->EnableMovement(true);
1386  start = true;
1387  }
1388  else
1389  {
1390  Position pos = transport->GetPosition();
1391  handler->PSendSysMessage("Transport %s is %s", transport->GetName().c_str(), transport->GetGoState() == GO_STATE_READY ? "stopped" : "moving");
1392  handler->PSendSysMessage("Transport position: %s", pos.ToString().c_str());
1393  return true;
1394  }
1395 
1396  handler->PSendSysMessage("Transport %s %s", transport->GetName().c_str(), start ? "started" : "stopped");
1397  return true;
1398  }
GOState GetGoState() const
Definition: GameObject.h:966
std::string const & GetName() const
Definition: Object.h:479
Definition: Transport.h:28
Player * GetPlayer() const
Definition: WorldSession.h:927
void EnableMovement(bool enabled)
Definition: Transport.cpp:557
std::string ToString() const
Definition: Position.cpp:160
void GetPosition(float &x, float &y) const
Definition: Position.h:109
Definition: GameObject.h:823
#define stricmp
Definition: FileSystem.cpp:39
WorldSession * GetSession()
Definition: Chat.h:59
Definition: Position.h:27
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugUpdateCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1240  {
1241  if (!*args)
1242  return false;
1243 
1244  uint32 updateIndex;
1245  uint32 value;
1246 
1247  char* index = strtok((char*)args, " ");
1248 
1249  Unit* unit = handler->getSelectedUnit();
1250  if (!unit)
1251  {
1253  handler->SetSentErrorMessage(true);
1254  return false;
1255  }
1256 
1257  if (!index)
1258  return true;
1259 
1260  updateIndex = atoi(index);
1261  //check updateIndex
1262  if (unit->GetTypeId() == TYPEID_PLAYER)
1263  {
1264  if (updateIndex >= PLAYER_END)
1265  return true;
1266  }
1267  else if (updateIndex >= UNIT_END)
1268  return true;
1269 
1270  char* val = strtok(NULL, " ");
1271  if (!val)
1272  {
1273  value = unit->GetUInt32Value(updateIndex);
1274 
1275  handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().ToString().c_str(), updateIndex, value);
1276  return true;
1277  }
1278 
1279  value = atoi(val);
1280 
1281  handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().ToString().c_str(), updateIndex, value);
1282 
1283  unit->SetUInt32Value(updateIndex, value);
1284 
1285  return true;
1286  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:587
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: UpdateFields.h:300
Definition: Language.h:586
TypeID GetTypeId() const
Definition: Object.h:113
Definition: UpdateFields.h:176
uint32_t uint32
Definition: Define.h:150
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
const FieldDescriptor value
Definition: descriptor.h:1522
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleDebugUpdateWorldStateCommand ( ChatHandler handler,
char const args 
)
inlinestatic
430  {
431  char* w = strtok((char*)args, " ");
432  char* s = strtok(NULL, " ");
433 
434  if (!w || !s)
435  return false;
436 
437  uint32 world = (uint32)atoi(w);
438  uint32 state = (uint32)atoi(s);
439  handler->GetSession()->GetPlayer()->SendUpdateWorldState(world, state);
440  return true;
441  }
arena_t NULL
Definition: jemalloc_internal.h:624
Player * GetPlayer() const
Definition: WorldSession.h:927
uint32_t uint32
Definition: Define.h:150
WorldSession * GetSession()
Definition: Chat.h:59
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool debug_commandscript::HandleWPGPSCommand ( ChatHandler handler,
char const  
)
inlinestatic
1365  {
1366  Player* player = handler->GetSession()->GetPlayer();
1367 
1368  TC_LOG_INFO("sql.dev", "(@PATH, XX, %.3f, %.3f, %.5f, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
1369 
1370  handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
1371  return true;
1372  }
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: