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

Public Member Functions

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

Static Public Member Functions

static bool HandlePvPstatsCommand (ChatHandler *handler, char const *)
 
static bool HandleDevCommand (ChatHandler *handler, char const *args)
 
static bool HandleGPSCommand (ChatHandler *handler, char const *args)
 
static bool HandleAuraCommand (ChatHandler *handler, char const *args)
 
static bool HandleUnAuraCommand (ChatHandler *handler, char const *args)
 
static bool HandleAppearCommand (ChatHandler *handler, char const *args)
 
static bool HandleSummonCommand (ChatHandler *handler, char const *args)
 
static bool HandleCommandsCommand (ChatHandler *handler, char const *)
 
static bool HandleDieCommand (ChatHandler *handler, char const *)
 
static bool HandleReviveCommand (ChatHandler *handler, char const *args)
 
static bool HandleDismountCommand (ChatHandler *handler, char const *)
 
static bool HandleGUIDCommand (ChatHandler *handler, char const *)
 
static bool HandleHelpCommand (ChatHandler *handler, char const *args)
 
static bool HandleItemMoveCommand (ChatHandler *handler, char const *args)
 
static bool HandleCooldownCommand (ChatHandler *handler, char const *args)
 
static bool HandleGetDistanceCommand (ChatHandler *handler, char const *args)
 
static bool HandleRecallCommand (ChatHandler *handler, char const *args)
 
static bool HandleSaveCommand (ChatHandler *handler, char const *)
 
static bool HandleSaveAllCommand (ChatHandler *handler, char const *)
 
static bool HandleKickPlayerCommand (ChatHandler *handler, char const *args)
 
static bool HandleUnstuckCommand (ChatHandler *handler, char const *args)
 
static bool HandleLinkGraveCommand (ChatHandler *handler, char const *args)
 
static bool HandleNearGraveCommand (ChatHandler *handler, char const *args)
 
static bool HandleShowAreaCommand (ChatHandler *handler, char const *args)
 
static bool HandleHideAreaCommand (ChatHandler *handler, char const *args)
 
static bool HandleAddItemCommand (ChatHandler *handler, char const *args)
 
static bool HandleAddItemSetCommand (ChatHandler *handler, char const *args)
 
static bool HandleBankCommand (ChatHandler *handler, char const *)
 
static bool HandleChangeWeather (ChatHandler *handler, char const *args)
 
static bool HandleMaxSkillCommand (ChatHandler *handler, char const *)
 
static bool HandleSetSkillCommand (ChatHandler *handler, char const *args)
 
Player command: .pinfo

Prints information about a character and it's linked account to the commander

Date
05/19/2013

Non-applying information, e.g. a character that is not in gm mode right now or that is not banned/muted, is not printed

This can be done either by giving a name or by targeting someone, else, it'll use the commander

Parameters
argsname Prints information according to the given name to the commander target Prints information on the target to the commander none No given args results in printing information on the commander
Returns
Several pieces of information about the character and the account
static bool HandlePInfoCommand (ChatHandler *handler, char const *args)
 
static bool HandleRespawnCommand (ChatHandler *handler, char const *)
 
static bool HandleMuteCommand (ChatHandler *handler, char const *args)
 
static bool HandleUnmuteCommand (ChatHandler *handler, char const *args)
 
static bool HandleMuteInfoCommand (ChatHandler *handler, char const *args)
 
static bool HandleMuteInfoHelper (uint32 accountId, char const *accountName, ChatHandler *handler)
 
static bool HandleMovegensCommand (ChatHandler *handler, char const *)
 
static bool HandleComeToMeCommand (ChatHandler *handler, char const *args)
 
static bool HandleDamageCommand (ChatHandler *handler, char const *args)
 
static bool HandleCombatStopCommand (ChatHandler *handler, char const *args)
 
static bool HandleRepairitemsCommand (ChatHandler *handler, char const *args)
 
static bool HandleFreezeCommand (ChatHandler *handler, char const *args)
 
static bool HandleUnFreezeCommand (ChatHandler *handler, char const *args)
 
static bool HandleListFreezeCommand (ChatHandler *handler, char const *)
 
static bool HandlePlayAllCommand (ChatHandler *handler, char const *args)
 
static bool HandlePossessCommand (ChatHandler *handler, char const *)
 
static bool HandleUnPossessCommand (ChatHandler *handler, char const *)
 
static bool HandleBindSightCommand (ChatHandler *handler, char const *)
 
static bool HandleUnbindSightCommand (ChatHandler *handler, char const *)
 
static bool HandleMailBoxCommand (ChatHandler *handler, char const *)
 
static bool HandleAurasCommand (ChatHandler *handler, char const *)
 

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

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

Member Function Documentation

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

Implements CommandScript.

49  {
50  static std::vector<ChatCommand> commandTable =
51  {
52  { "additem", rbac::RBAC_PERM_COMMAND_ADDITEM, false, &HandleAddItemCommand, "" },
53  { "additemset", rbac::RBAC_PERM_COMMAND_ADDITEMSET, false, &HandleAddItemSetCommand, "" },
54  { "appear", rbac::RBAC_PERM_COMMAND_APPEAR, false, &HandleAppearCommand, "" },
55  { "aura", rbac::RBAC_PERM_COMMAND_AURA, false, &HandleAuraCommand, "" },
56  { "bank", rbac::RBAC_PERM_COMMAND_BANK, false, &HandleBankCommand, "" },
57  { "bindsight", rbac::RBAC_PERM_COMMAND_BINDSIGHT, false, &HandleBindSightCommand, "" },
58  { "combatstop", rbac::RBAC_PERM_COMMAND_COMBATSTOP, true, &HandleCombatStopCommand, "" },
59  { "cometome", rbac::RBAC_PERM_COMMAND_COMETOME, false, &HandleComeToMeCommand, "" },
60  { "commands", rbac::RBAC_PERM_COMMAND_COMMANDS, true, &HandleCommandsCommand, "" },
61  { "cooldown", rbac::RBAC_PERM_COMMAND_COOLDOWN, false, &HandleCooldownCommand, "" },
62  { "damage", rbac::RBAC_PERM_COMMAND_DAMAGE, false, &HandleDamageCommand, "" },
63  { "dev", rbac::RBAC_PERM_COMMAND_DEV, false, &HandleDevCommand, "" },
64  { "die", rbac::RBAC_PERM_COMMAND_DIE, false, &HandleDieCommand, "" },
65  { "dismount", rbac::RBAC_PERM_COMMAND_DISMOUNT, false, &HandleDismountCommand, "" },
67  { "freeze", rbac::RBAC_PERM_COMMAND_FREEZE, false, &HandleFreezeCommand, "" },
68  { "gps", rbac::RBAC_PERM_COMMAND_GPS, false, &HandleGPSCommand, "" },
69  { "guid", rbac::RBAC_PERM_COMMAND_GUID, false, &HandleGUIDCommand, "" },
70  { "help", rbac::RBAC_PERM_COMMAND_HELP, true, &HandleHelpCommand, "" },
71  { "hidearea", rbac::RBAC_PERM_COMMAND_HIDEAREA, false, &HandleHideAreaCommand, "" },
72  { "itemmove", rbac::RBAC_PERM_COMMAND_ITEMMOVE, false, &HandleItemMoveCommand, "" },
74  { "linkgrave", rbac::RBAC_PERM_COMMAND_LINKGRAVE, false, &HandleLinkGraveCommand, "" },
75  { "listfreeze", rbac::RBAC_PERM_COMMAND_LISTFREEZE, false, &HandleListFreezeCommand, "" },
76  { "maxskill", rbac::RBAC_PERM_COMMAND_MAXSKILL, false, &HandleMaxSkillCommand, "" },
77  { "movegens", rbac::RBAC_PERM_COMMAND_MOVEGENS, false, &HandleMovegensCommand, "" },
78  { "mute", rbac::RBAC_PERM_COMMAND_MUTE, true, &HandleMuteCommand, "" },
79  { "mutehistory", rbac::RBAC_PERM_COMMAND_MUTEHISTORY, true, &HandleMuteInfoCommand, "" },
80  { "neargrave", rbac::RBAC_PERM_COMMAND_NEARGRAVE, false, &HandleNearGraveCommand, "" },
81  { "pinfo", rbac::RBAC_PERM_COMMAND_PINFO, true, &HandlePInfoCommand, "" },
82  { "playall", rbac::RBAC_PERM_COMMAND_PLAYALL, false, &HandlePlayAllCommand, "" },
83  { "possess", rbac::RBAC_PERM_COMMAND_POSSESS, false, &HandlePossessCommand, "" },
84  { "pvpstats", rbac::RBAC_PERM_COMMAND_PVPSTATS, true, &HandlePvPstatsCommand, "" },
85  { "recall", rbac::RBAC_PERM_COMMAND_RECALL, false, &HandleRecallCommand, "" },
87  { "respawn", rbac::RBAC_PERM_COMMAND_RESPAWN, false, &HandleRespawnCommand, "" },
88  { "revive", rbac::RBAC_PERM_COMMAND_REVIVE, true, &HandleReviveCommand, "" },
89  { "saveall", rbac::RBAC_PERM_COMMAND_SAVEALL, true, &HandleSaveAllCommand, "" },
90  { "save", rbac::RBAC_PERM_COMMAND_SAVE, false, &HandleSaveCommand, "" },
91  { "setskill", rbac::RBAC_PERM_COMMAND_SETSKILL, false, &HandleSetSkillCommand, "" },
92  { "showarea", rbac::RBAC_PERM_COMMAND_SHOWAREA, false, &HandleShowAreaCommand, "" },
93  { "summon", rbac::RBAC_PERM_COMMAND_SUMMON, false, &HandleSummonCommand, "" },
94  { "unaura", rbac::RBAC_PERM_COMMAND_UNAURA, false, &HandleUnAuraCommand, "" },
96  { "unfreeze", rbac::RBAC_PERM_COMMAND_UNFREEZE, false, &HandleUnFreezeCommand, "" },
97  { "unmute", rbac::RBAC_PERM_COMMAND_UNMUTE, true, &HandleUnmuteCommand, "" },
98  { "unpossess", rbac::RBAC_PERM_COMMAND_UNPOSSESS, false, &HandleUnPossessCommand, "" },
99  { "unstuck", rbac::RBAC_PERM_COMMAND_UNSTUCK, true, &HandleUnstuckCommand, "" },
100  { "wchange", rbac::RBAC_PERM_COMMAND_WCHANGE, false, &HandleChangeWeather, "" },
101  { "mailbox", rbac::RBAC_PERM_COMMAND_MAILBOX, false, &HandleMailBoxCommand, "" },
102  { "auras ", rbac::RBAC_PERM_COMMAND_LIST_AURAS, false, &HandleAurasCommand, "" },
103  };
104  return commandTable;
105  }
static bool HandleCommandsCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:581
static bool HandleMailBoxCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:2666
Definition: RBAC.h:398
static bool HandleHideAreaCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1113
static bool HandleReviveCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:613
Definition: RBAC.h:416
static bool HandleRespawnCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:1864
Definition: RBAC.h:432
static bool HandleUnPossessCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:2634
Definition: RBAC.h:404
Definition: RBAC.h:409
static bool HandleSummonCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:466
static bool HandleGetDistanceCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:764
static bool HandleKickPlayerCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:857
Definition: RBAC.h:408
static bool HandleAddItemCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1157
Definition: RBAC.h:424
Definition: RBAC.h:400
Definition: RBAC.h:691
Definition: RBAC.h:421
static bool HandleComeToMeCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2191
static bool HandleUnmuteCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1972
static bool HandleUnbindSightCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:2655
Definition: RBAC.h:425
Definition: RBAC.h:441
static bool HandleNearGraveCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1007
Definition: RBAC.h:438
static bool HandleChangeWeather(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1362
static bool HandleDamageCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2212
Definition: RBAC.h:427
static bool HandleCombatStopCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2362
Definition: RBAC.h:439
static bool HandlePlayAllCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2604
static bool HandleDieCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:587
static bool HandleBindSightCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:2645
static bool HandleUnstuckCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:893
Definition: RBAC.h:403
Definition: RBAC.h:395
static bool HandleGPSCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:168
static bool HandleBankCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:1356
static bool HandlePvPstatsCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:107
Definition: RBAC.h:434
Definition: RBAC.h:442
static bool HandleUnFreezeCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2510
Definition: RBAC.h:413
static bool HandleHelpCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:674
static bool HandleAurasCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:2674
Definition: RBAC.h:405
static bool HandleSaveCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:825
static bool HandlePInfoCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1494
Definition: RBAC.h:402
Definition: RBAC.h:411
Definition: RBAC.h:415
static bool HandleShowAreaCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1069
static bool HandleDevCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:136
Definition: RBAC.h:412
static bool HandleRepairitemsCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2392
Definition: RBAC.h:433
static bool HandleAuraCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:275
Definition: RBAC.h:418
Definition: RBAC.h:423
static bool HandleMuteInfoCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2021
static bool HandleItemMoveCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:691
Definition: RBAC.h:397
static bool HandleAppearCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:321
Definition: RBAC.h:436
static bool HandleMuteCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1892
Definition: RBAC.h:435
Definition: RBAC.h:430
static bool HandleMaxSkillCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:1405
Definition: RBAC.h:420
static bool HandleFreezeCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2412
static bool HandleCooldownCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:724
Definition: RBAC.h:414
Definition: RBAC.h:429
static bool HandlePossessCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:2624
static bool HandleSetSkillCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1420
static bool HandleRecallCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:797
static bool HandleSaveAllCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:849
Definition: RBAC.h:671
static bool HandleUnAuraCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:294
static bool HandleDismountCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:635
Definition: RBAC.h:399
Definition: RBAC.h:406
static bool HandleLinkGraveCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:954
static bool HandleGUIDCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:659
Definition: RBAC.h:422
Definition: RBAC.h:426
static bool HandleMovegensCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:2080
static bool HandleListFreezeCommand(ChatHandler *handler, char const *)
Definition: cs_misc.cpp:2568
static bool HandleAddItemSetCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1280
Definition: RBAC.h:407
Definition: RBAC.h:431
Definition: RBAC.h:440
Definition: RBAC.h:417
static bool misc_commandscript::HandleAddItemCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1158  {
1159  if (!*args)
1160  return false;
1161 
1162  uint32 itemId = 0;
1163 
1164  if (args[0] == '[') // [name] manual form
1165  {
1166  char const* itemNameStr = strtok((char*)args, "]");
1167 
1168  if (itemNameStr && itemNameStr[0])
1169  {
1170  std::string itemName = itemNameStr+1;
1171  auto itr = std::find_if(sItemSparseStore.begin(), sItemSparseStore.end(), [&itemName](ItemSparseEntry const* itemSparse)
1172  {
1173  for (uint32 i = 0; i < MAX_LOCALES; ++i)
1174  if (itemName == itemSparse->Name->Str[i])
1175  return true;
1176  return false;
1177  });
1178 
1179  if (itr == sItemSparseStore.end())
1180  {
1181  handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
1182  handler->SetSentErrorMessage(true);
1183  return false;
1184  }
1185 
1186  itemId = itr->ID;
1187  }
1188  else
1189  return false;
1190  }
1191  else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
1192  {
1193  char const* id = handler->extractKeyFromLink((char*)args, "Hitem");
1194  if (!id)
1195  return false;
1196  itemId = atoul(id);
1197  }
1198 
1199  char const* ccount = strtok(NULL, " ");
1200 
1201  int32 count = 1;
1202 
1203  if (ccount)
1204  count = strtol(ccount, NULL, 10);
1205 
1206  if (count == 0)
1207  count = 1;
1208 
1209  std::vector<int32> bonusListIDs;
1210  char const* bonuses = strtok(NULL, " ");
1211 
1212  // semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
1213  if (bonuses)
1214  {
1215  Tokenizer tokens(bonuses, ';');
1216  for (char const* token : tokens)
1217  bonusListIDs.push_back(atoul(token));
1218  }
1219 
1220  Player* player = handler->GetSession()->GetPlayer();
1221  Player* playerTarget = handler->getSelectedPlayer();
1222  if (!playerTarget)
1223  playerTarget = player;
1224 
1225  TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_ADDITEM), itemId, count);
1226 
1227  ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
1228  if (!itemTemplate)
1229  {
1230  handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
1231  handler->SetSentErrorMessage(true);
1232  return false;
1233  }
1234 
1235  // Subtract
1236  if (count < 0)
1237  {
1238  playerTarget->DestroyItemCount(itemId, -count, true, false);
1239  handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
1240  return true;
1241  }
1242 
1243  // Adding items
1244  uint32 noSpaceForCount = 0;
1245 
1246  // check space and find places
1247  ItemPosCountVec dest;
1248  InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
1249  if (msg != EQUIP_ERR_OK) // convert to possible store amount
1250  count -= noSpaceForCount;
1251 
1252  if (count == 0 || dest.empty()) // can't add any
1253  {
1254  handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1255  handler->SetSentErrorMessage(true);
1256  return false;
1257  }
1258 
1259  Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId), GuidSet(), bonusListIDs);
1260 
1261  // remove binding (let GM give it to another player later)
1262  if (player == playerTarget)
1263  for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
1264  if (Item* item1 = player->GetItemByPos(itr->pos))
1265  item1->SetBinding(false);
1266 
1267  if (count > 0 && item)
1268  {
1269  player->SendNewItem(item, count, false, true);
1270  if (player != playerTarget)
1271  playerTarget->SendNewItem(item, count, true, false);
1272  }
1273 
1274  if (noSpaceForCount > 0)
1275  handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1276 
1277  return true;
1278  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
void SetBinding(bool val)
Definition: Item.h:276
Definition: Unit.h:379
Definition: DB2Structure.h:792
Definition: Util.h:45
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:436
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: Item.h:48
Definition: Unit.h:378
#define MAX_LOCALES
Definition: Common.h:136
static int32 GenerateItemRandomPropertyId(uint32 item_id)
Definition: Item.cpp:594
unsigned long atoul(char const *str)
Definition: Common.h:90
virtual std::string GetNameLink() const
Definition: Chat.h:101
Definition: Item.h:259
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
DB2Storage< ItemSparseEntry > sItemSparseStore("Item-sparse.db2", ItemSparseFormat, HOTFIX_SEL_ITEM_SPARSE)
Player * getSelectedPlayer()
Definition: Chat.cpp:579
Definition: Language.h:504
Definition: ItemTemplate.h:647
Definition: Language.h:437
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:332
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
WorldSession * GetSession()
Definition: Chat.h:59
Definition: Language.h:506
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: Language.h:507
InventoryResult
Definition: Item.h:46
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
Definition: Chat.cpp:641

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleAddItemSetCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1281  {
1282  if (!*args)
1283  return false;
1284 
1285  char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
1286  if (!id)
1287  return false;
1288 
1289  uint32 itemSetId = atoul(id);
1290 
1291  // prevent generation all items with itemset field value '0'
1292  if (itemSetId == 0)
1293  {
1295  handler->SetSentErrorMessage(true);
1296  return false;
1297  }
1298 
1299  std::vector<int32> bonusListIDs;
1300  char const* bonuses = strtok(NULL, " ");
1301 
1302  // semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
1303  if (bonuses)
1304  {
1305  Tokenizer tokens(bonuses, ';');
1306  for (char const* token : tokens)
1307  bonusListIDs.push_back(atoul(token));
1308  }
1309 
1310  Player* player = handler->GetSession()->GetPlayer();
1311  Player* playerTarget = handler->getSelectedPlayer();
1312  if (!playerTarget)
1313  playerTarget = player;
1314 
1315  TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_ADDITEMSET), itemSetId);
1316 
1317  bool found = false;
1318  ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
1319  for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
1320  {
1321  if (itr->second.GetItemSet() == itemSetId)
1322  {
1323  found = true;
1324  ItemPosCountVec dest;
1325  InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.GetId(), 1);
1326  if (msg == EQUIP_ERR_OK)
1327  {
1328  Item* item = playerTarget->StoreNewItem(dest, itr->second.GetId(), true, 0, GuidSet(), bonusListIDs);
1329 
1330  // remove binding (let GM give it to another player later)
1331  if (player == playerTarget)
1332  item->SetBinding(false);
1333 
1334  player->SendNewItem(item, 1, false, true);
1335  if (player != playerTarget)
1336  playerTarget->SendNewItem(item, 1, true, false);
1337  }
1338  else
1339  {
1340  player->SendEquipError(msg, NULL, NULL, itr->second.GetId());
1341  handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.GetId(), 1);
1342  }
1343  }
1344  }
1345 
1346  if (!found)
1347  {
1349  handler->SetSentErrorMessage(true);
1350  return false;
1351  }
1352 
1353  return true;
1354  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
void SetBinding(bool val)
Definition: Item.h:276
Definition: Language.h:512
Definition: Unit.h:379
Definition: Util.h:45
Definition: Language.h:505
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: Item.h:48
Definition: Unit.h:378
unsigned long atoul(char const *str)
Definition: Common.h:90
Definition: Item.h:259
uint32_t uint32
Definition: Define.h:150
Player * getSelectedPlayer()
Definition: Chat.cpp:579
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:332
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: Language.h:507
InventoryResult
Definition: Item.h:46
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
Definition: Chat.cpp:641
std::unordered_map< uint32, ItemTemplate > ItemTemplateContainer
Definition: ItemTemplate.h:769

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleAppearCommand ( ChatHandler handler,
char const args 
)
inlinestatic
322  {
323  Player* target;
324  ObjectGuid targetGuid;
325  std::string targetName;
326  if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
327  return false;
328 
329  Player* _player = handler->GetSession()->GetPlayer();
330  if (target == _player || targetGuid == _player->GetGUID())
331  {
333  handler->SetSentErrorMessage(true);
334  return false;
335  }
336 
337  if (target)
338  {
339  // check online security
340  if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
341  return false;
342 
343  std::string chrNameLink = handler->playerLink(targetName);
344 
345  Map* map = target->GetMap();
346  if (map->IsBattlegroundOrArena())
347  {
348  // only allow if gm mode is on
349  if (!_player->IsGameMaster())
350  {
351  handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
352  handler->SetSentErrorMessage(true);
353  return false;
354  }
355  // if both players are in different bgs
356  else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
357  _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
358 
359  // all's well, set bg id
360  // when porting out from the bg, it will be reset to 0
361  _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
362  // remember current position as entry point for return at bg end teleportation
363  if (!_player->GetMap()->IsBattlegroundOrArena())
364  _player->SetBattlegroundEntryPoint();
365  }
366  else if (map->IsDungeon())
367  {
368  // we have to go to instance, and can go to player only if:
369  // 1) we are in his group (either as leader or as member)
370  // 2) we are not bound to any group and have GM mode on
371  if (_player->GetGroup())
372  {
373  // we are in group, we can go only if we are in the player group
374  if (_player->GetGroup() != target->GetGroup())
375  {
376  handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
377  handler->SetSentErrorMessage(true);
378  return false;
379  }
380  }
381  else
382  {
383  // we are not in group, let's verify our GM mode
384  if (!_player->IsGameMaster())
385  {
386  handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
387  handler->SetSentErrorMessage(true);
388  return false;
389  }
390  }
391 
392  // if the player or the player's group is bound to another instance
393  // the player will not be bound to another one
394  InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficultyID(map->GetEntry()));
395  if (!bind)
396  {
397  Group* group = _player->GetGroup();
398  // if no bind exists, create a solo bind
399  InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
400  if (!gBind)
401  if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
402  _player->BindToInstance(save, !save->CanReset());
403  }
404 
405  if (map->IsRaid())
406  {
407  _player->SetRaidDifficultyID(target->GetRaidDifficultyID());
408  _player->SetLegacyRaidDifficultyID(target->GetLegacyRaidDifficultyID());
409  }
410  else
411  _player->SetDungeonDifficultyID(target->GetDungeonDifficultyID());
412  }
413 
414  handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
415 
416  // stop flight if need
417  if (_player->IsInFlight())
418  {
419  _player->GetMotionMaster()->MovementExpired();
420  _player->CleanupAfterTaxiFlight();
421  }
422  // save only in non-flight case
423  else
424  _player->SaveRecallPosition();
425 
426  // to point to see at target with same orientation
427  float x, y, z;
428  target->GetContactPoint(_player, x, y, z);
429 
430  _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
431  _player->CopyPhaseFrom(target, true);
432  }
433  else
434  {
435  // check offline security
436  if (handler->HasLowerSecurity(NULL, targetGuid))
437  return false;
438 
439  std::string nameLink = handler->playerLink(targetName);
440 
441  handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
442 
443  // to point where player stay (if loaded)
444  float x, y, z, o;
445  uint32 map;
446  bool in_flight;
447  if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))
448  return false;
449 
450  // stop flight if need
451  if (_player->IsInFlight())
452  {
453  _player->GetMotionMaster()->MovementExpired();
454  _player->CleanupAfterTaxiFlight();
455  }
456  // save only in non-flight case
457  else
458  _player->SaveRecallPosition();
459 
460  _player->TeleportTo(map, x, y, z, _player->GetOrientation());
461  }
462 
463  return true;
464  }
Definition: Language.h:128
bool IsBattlegroundOrArena() const
Definition: Map.h:403
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: Group.h:168
bool IsRaid() const
Definition: Map.h:397
Definition: Language.h:203
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsDungeon() const
Definition: Map.h:395
Definition: Language.h:129
Player * GetPlayer() const
Definition: WorldSession.h:927
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
G3D::int16 z
Definition: Vector3int16.h:46
uint32_t uint32
Definition: Define.h:150
MapEntry const * GetEntry() const
Definition: Map.h:266
G3D::int16 y
Definition: Vector2int16.h:38
Definition: Language.h:137
Definition: Map.h:259
Definition: InstanceSaveMgr.h:44
#define sInstanceSaveMgr
Definition: InstanceSaveMgr.h:243
Definition: Language.h:739
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: ObjectGuid.h:189
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2191
G3D::int16 x
Definition: Vector2int16.h:37
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
std::string playerLink(std::string const &name) const
Definition: Chat.h:132
Definition: Group.h:191

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleAuraCommand ( ChatHandler handler,
char const args 
)
inlinestatic
276  {
277  Unit* target = handler->getSelectedUnit();
278  if (!target)
279  {
281  handler->SetSentErrorMessage(true);
282  return false;
283  }
284 
285  // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
286  uint32 spellId = handler->extractSpellIdFromLink((char*)args);
287 
288  if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
289  Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
290 
291  return true;
292  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: SpellInfo.h:326
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
uint32 extractSpellIdFromLink(char *text)
Definition: Chat.cpp:806
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint32 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=NULL, Item *castItem=NULL, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=NULL, int32 castItemLevel=-1)
Definition: SpellAuras.cpp:282
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305
#define MAX_EFFECT_MASK
Definition: DBCStructure.h:1027

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleAurasCommand ( ChatHandler handler,
char const  
)
inlinestatic
2675  {
2676  Unit* target = handler->GetSession()->GetPlayer()->GetSelectedUnit();
2677 
2678  if (!target)
2679  {
2681  handler->SetSentErrorMessage(true);
2682  return false;
2683  }
2684 
2685  Unit::AuraApplicationMap const& uAuras = target->GetAppliedAuras();
2686  handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size());
2687  for (Unit::AuraApplicationMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr)
2688  {
2689  AuraApplication const* aurApp = itr->second;
2690  Aura const* aura = aurApp->GetBase();
2691  char const* name = aura->GetSpellInfo()->SpellName;
2692 
2693  bool self = target->GetGUID() == aura->GetCasterGUID();
2694  if (self)
2695  handler->PSendSysMessage("%u: %s (self)", aura->GetId(), name);
2696  else
2697  {
2698  if (Unit* u = aura->GetCaster())
2699  {
2700  if (u->GetTypeId() == TYPEID_PLAYER)
2701  handler->PSendSysMessage("%u: %s (player: %s)", aura->GetId(), name, u->GetName().c_str());
2702  else if (u->GetTypeId() == TYPEID_UNIT)
2703  handler->PSendSysMessage("%u: %s (creature: %s)", aura->GetId(), name, u->GetName().c_str());
2704  }
2705  else
2706  handler->PSendSysMessage("%u: %s)", aura->GetId(), name);
2707  }
2708  }
2709  return true;
2710  }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
Definition: Language.h:32
Definition: Language.h:469
Aura * GetBase() const
Definition: SpellAuras.h:75
Definition: SpellAuras.h:50
Definition: ObjectGuid.h:32
Player * GetPlayer() const
Definition: WorldSession.h:927
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1789
char * SpellName
Definition: SpellInfo.h:392
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
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1315
Definition: SpellAuras.h:116
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135
Definition: Unit.h:1305
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleBankCommand ( ChatHandler handler,
char const  
)
inlinestatic
1357  {
1358  handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
1359  return true;
1360  }
void SendShowBank(ObjectGuid guid)
Definition: BankHandler.cpp:165
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 misc_commandscript::HandleBindSightCommand ( ChatHandler handler,
char const  
)
inlinestatic
2646  {
2647  Unit* unit = handler->getSelectedUnit();
2648  if (!unit)
2649  return false;
2650 
2651  handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
2652  return true;
2653  }
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleChangeWeather ( ChatHandler handler,
char const args 
)
inlinestatic
1363  {
1364  if (!*args)
1365  return false;
1366 
1367  // Weather is OFF
1368  if (!sWorld->getBoolConfig(CONFIG_WEATHER))
1369  {
1371  handler->SetSentErrorMessage(true);
1372  return false;
1373  }
1374 
1375  // *Change the weather of a cell
1376  char const* px = strtok((char*)args, " ");
1377  char const* py = strtok(NULL, " ");
1378 
1379  if (!px || !py)
1380  return false;
1381 
1382  uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
1383  float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather
1384 
1385  Player* player = handler->GetSession()->GetPlayer();
1386  uint32 zoneid = player->GetZoneId();
1387 
1388  Weather* weather = WeatherMgr::FindWeather(zoneid);
1389 
1390  if (!weather)
1391  weather = WeatherMgr::AddWeather(zoneid);
1392  if (!weather)
1393  {
1394  handler->SendSysMessage(LANG_NO_WEATHER);
1395  handler->SetSentErrorMessage(true);
1396  return false;
1397  }
1398 
1399  weather->SetWeather(WeatherType(type), grade);
1400 
1401  return true;
1402  }
Definition: World.h:122
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:402
arena_t NULL
Definition: jemalloc_internal.h:624
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sWorld
Definition: World.h:887
Definition: Language.h:403
void SetWeather(WeatherType type, float grade)
Set the weather.
Definition: Weather.cpp:269
Weather * FindWeather(uint32 id)
Find a Weather object by the given zoneid.
Definition: WeatherMgr.cpp:50
uint32_t uint32
Definition: Define.h:150
Weather * AddWeather(uint32 zone_id)
Add a Weather object to the list.
Definition: WeatherMgr.cpp:67
WorldSession * GetSession()
Definition: Chat.h:59
WeatherType
Definition: SharedDefines.h:4216
uint32_t uint32
Definition: g3dmath.h:168
Weather for one zone.
Definition: Weather.h:65
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 misc_commandscript::HandleCombatStopCommand ( ChatHandler handler,
char const args 
)
inlinestatic
2363  {
2364  Player* target = NULL;
2365 
2366  if (args && args[0] != '\0')
2367  {
2368  target = ObjectAccessor::FindPlayerByName(args);
2369  if (!target)
2370  {
2372  handler->SetSentErrorMessage(true);
2373  return false;
2374  }
2375  }
2376 
2377  if (!target)
2378  {
2379  if (!handler->extractPlayerTarget((char*)args, &target))
2380  return false;
2381  }
2382 
2383  // check online security
2384  if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
2385  return false;
2386 
2387  target->CombatStop();
2388  target->getHostileRefManager().deleteReferences();
2389  return true;
2390  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
arena_t NULL
Definition: jemalloc_internal.h:624
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
TC_GAME_API Player * FindPlayerByName(std::string const &name)
Definition: ObjectAccessor.cpp:220
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:509

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleComeToMeCommand ( ChatHandler handler,
char const args 
)
inlinestatic
2192  {
2193  char const* newFlagStr = strtok((char*)args, " ");
2194  if (!newFlagStr)
2195  return false;
2196 
2197  Creature* caster = handler->getSelectedCreature();
2198  if (!caster)
2199  {
2201  handler->SetSentErrorMessage(true);
2202  return false;
2203  }
2204 
2205  Player* player = handler->GetSession()->GetPlayer();
2206 
2207  caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
2208 
2209  return true;
2210  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Creature * getSelectedCreature()
Definition: Chat.cpp:615
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: Creature.h:467
Player * GetPlayer() const
Definition: WorldSession.h:927
void MovePoint(uint32 id, Position const &pos, bool generatePath=true)
Definition: MotionMaster.h:172
Definition: Language.h:33
WorldSession * GetSession()
Definition: Chat.h:59
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 misc_commandscript::HandleCommandsCommand ( ChatHandler handler,
char const  
)
inlinestatic
582  {
583  handler->ShowHelpForCommand(handler->getCommandTable(), "");
584  return true;
585  }
bool ShowHelpForCommand(std::vector< ChatCommand > const &table, const char *cmd)
Definition: Chat.cpp:522
static std::vector< ChatCommand > const & getCommandTable()
Definition: Chat.cpp:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleCooldownCommand ( ChatHandler handler,
char const args 
)
inlinestatic
725  {
726  Player* target = handler->getSelectedPlayerOrSelf();
727  if (!target)
728  {
730  handler->SetSentErrorMessage(true);
731  return false;
732  }
733 
734  std::string nameLink = handler->GetNameLink(target);
735 
736  if (!*args)
737  {
738  target->GetSpellHistory()->ResetAllCooldowns();
739  target->GetSpellHistory()->ResetAllCharges();
740  handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
741  }
742  else
743  {
744  // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
745  uint32 spellIid = handler->extractSpellIdFromLink((char*)args);
746  if (!spellIid)
747  return false;
748 
749  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellIid);
750  if (!spellInfo)
751  {
752  handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
753  handler->SetSentErrorMessage(true);
754  return false;
755  }
756 
757  target->GetSpellHistory()->ResetCooldown(spellIid, true);
758  target->GetSpellHistory()->ResetCharges(spellInfo->ChargeCategoryEntry);
759  handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
760  }
761  return true;
762  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:77
Definition: SpellInfo.h:326
SpellCategoryEntry const * ChargeCategoryEntry
Definition: SpellInfo.h:402
Player * getSelectedPlayerOrSelf()
Definition: Chat.cpp:623
Definition: Language.h:501
Player * GetPlayer() const
Definition: WorldSession.h:927
virtual std::string GetNameLink() const
Definition: Chat.h:101
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
uint32 extractSpellIdFromLink(char *text)
Definition: Chat.cpp:806
Definition: Language.h:502
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
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
Definition: Language.h:499
Definition: Language.h:509

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleDamageCommand ( ChatHandler handler,
char const args 
)
inlinestatic
2213  {
2214  if (!*args)
2215  return false;
2216 
2217  char* str = strtok((char*)args, " ");
2218 
2219  if (strcmp(str, "go") == 0)
2220  {
2221  char* guidStr = strtok(NULL, " ");
2222  if (!guidStr)
2223  {
2224  handler->SendSysMessage(LANG_BAD_VALUE);
2225  handler->SetSentErrorMessage(true);
2226  return false;
2227  }
2228 
2229  ObjectGuid::LowType guid = strtoull(guidStr, nullptr, 10);
2230  if (!guid)
2231  {
2232  handler->SendSysMessage(LANG_BAD_VALUE);
2233  handler->SetSentErrorMessage(true);
2234  return false;
2235  }
2236 
2237  char* damageStr = strtok(NULL, " ");
2238  if (!damageStr)
2239  {
2240  handler->SendSysMessage(LANG_BAD_VALUE);
2241  handler->SetSentErrorMessage(true);
2242  return false;
2243  }
2244 
2245  int32 damage = atoi(damageStr);
2246  if (!damage)
2247  {
2248  handler->SendSysMessage(LANG_BAD_VALUE);
2249  handler->SetSentErrorMessage(true);
2250  return false;
2251  }
2252 
2253  if (Player* player = handler->GetSession()->GetPlayer())
2254  {
2255  GameObject* go = NULL;
2256 
2257  if (GameObjectData const* goData = sObjectMgr->GetGOData(guid))
2258  go = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guid, goData->id);
2259 
2260  if (!go)
2261  {
2262  handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guid);
2263  handler->SetSentErrorMessage(true);
2264  return false;
2265  }
2266 
2267  if (!go->IsDestructibleBuilding())
2268  {
2270  handler->SetSentErrorMessage(true);
2271  return false;
2272  }
2273 
2274  go->ModifyHealth(-damage, player);
2275  handler->PSendSysMessage(LANG_GAMEOBJECT_DAMAGED, go->GetName().c_str(), guid, -damage, go->GetGOValue()->Building.Health);
2276  }
2277 
2278  return true;
2279  }
2280 
2281  Unit* target = handler->getSelectedUnit();
2282  if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
2283  {
2285  handler->SetSentErrorMessage(true);
2286  return false;
2287  }
2288 
2289  if (Player* player = target->ToPlayer())
2290  if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false))
2291  return false;
2292 
2293  if (!target->IsAlive())
2294  return true;
2295 
2296  char* damageStr = strtok((char*)args, " ");
2297  if (!damageStr)
2298  return false;
2299 
2300  int32 damage_int = atoi((char*)damageStr);
2301  if (damage_int <= 0)
2302  return true;
2303 
2304  uint32 damage = damage_int;
2305 
2306  char* schoolStr = strtok((char*)NULL, " ");
2307 
2308  // flat melee damage without resistence/etc reduction
2309  if (!schoolStr)
2310  {
2311  handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
2312  if (target != handler->GetSession()->GetPlayer())
2313  handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
2314  return true;
2315  }
2316 
2317  uint32 school = atoi((char*)schoolStr);
2318  if (school >= MAX_SPELL_SCHOOL)
2319  return false;
2320 
2321  SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
2322 
2323  if (handler->GetSession()->GetPlayer()->IsDamageReducedByArmor(schoolmask))
2324  damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
2325 
2326  char* spellStr = strtok((char*)NULL, " ");
2327 
2328  // melee damage by specific school
2329  if (!spellStr)
2330  {
2331  uint32 absorb = 0;
2332  uint32 resist = 0;
2333 
2334  handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
2335 
2336  if (damage <= absorb + resist)
2337  return true;
2338 
2339  damage -= absorb + resist;
2340 
2341  handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb);
2342  handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
2343  handler->GetSession()->GetPlayer()->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
2344  return true;
2345  }
2346 
2347  // non-melee damage
2348 
2349  // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
2350  uint32 spellid = handler->extractSpellIdFromLink((char*)args);
2351  if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
2352  return false;
2353 
2354  SpellNonMeleeDamage damageInfo(handler->GetSession()->GetPlayer(), target, spellid, sSpellMgr->GetSpellInfo(spellid)->SchoolMask);
2355  damageInfo.damage = damage;
2356  handler->GetSession()->GetPlayer()->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
2357  target->DealSpellDamage(&damageInfo, true);
2358  target->SendSpellNonMeleeDamageLog(&damageInfo);
2359  return true;
2360  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
SpellSchoolMask
Definition: SharedDefines.h:285
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
std::string const & GetName() const
Definition: Object.h:479
GameObject * GetObjectGlobalyWithGuidOrNearWithDbGuid(ObjectGuid::LowType lowguid, uint32 entry)
Definition: Chat.cpp:766
arena_t NULL
Definition: jemalloc_internal.h:624
struct GameObjectValue::@276 Building
Player * GetPlayer() const
Definition: WorldSession.h:927
uint64 LowType
Definition: ObjectGuid.h:199
#define sObjectMgr
Definition: ObjectMgr.h:1567
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
Player * ToPlayer()
Definition: Object.h:191
Definition: Unit.h:1042
Definition: SharedDefines.h:288
Definition: Unit.h:336
bool IsAlive() const
Definition: Unit.h:1692
#define sSpellMgr
Definition: SpellMgr.h:756
bool IsDestructibleBuilding() const
Definition: GameObject.cpp:1000
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: GameObject.h:880
uint32 extractSpellIdFromLink(char *text)
Definition: Chat.cpp:806
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1094
Definition: Language.h:139
Definition: GameObject.h:833
uint32 damage
Definition: Unit.h:1049
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:4839
void ModifyHealth(int32 change, Unit *attackerOrHealer=NULL, uint32 spellId=0)
Definition: GameObject.cpp:1973
Definition: Unit.h:350
uint32 Health
Definition: GameObject.h:798
Definition: Language.h:208
WorldSession * GetSession()
Definition: Chat.h:59
Definition: Unit.h:662
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
GameObjectValue const * GetGOValue() const
Definition: GameObject.h:896
Definition: Unit.h:663
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Unit.h:1305
Definition: Language.h:209
Definition: Language.h:305
Definition: Unit.h:617

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleDevCommand ( ChatHandler handler,
char const args 
)
inlinestatic
137  {
138  if (!*args)
139  {
140  if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
142  else
144  return true;
145  }
146 
147  std::string argstr = (char*)args;
148 
149  if (argstr == "on")
150  {
151  handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
153  return true;
154  }
155 
156  if (argstr == "off")
157  {
158  handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
160  return true;
161  }
162 
163  handler->SendSysMessage(LANG_USE_BOL);
164  handler->SetSentErrorMessage(true);
165  return false;
166  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:941
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:940
void SendNotification(char const *format,...) ATTR_PRINTF(2
Definition: WorldSession.cpp:658
Definition: Language.h:290
Definition: Player.h:532
WorldSession * GetSession()
Definition: Chat.h:59
Definition: UpdateFields.h:191
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 misc_commandscript::HandleDieCommand ( ChatHandler handler,
char const  
)
inlinestatic
588  {
589  Unit* target = handler->getSelectedUnit();
590 
591  if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
592  {
594  handler->SetSentErrorMessage(true);
595  return false;
596  }
597 
598  if (Player* player = target->ToPlayer())
599  if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false))
600  return false;
601 
602  if (target->IsAlive())
603  {
604  if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
605  handler->GetSession()->GetPlayer()->Kill(target);
606  else
607  handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
608  }
609 
610  return true;
611  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sWorld
Definition: World.h:887
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
Player * ToPlayer()
Definition: Object.h:191
Definition: SharedDefines.h:288
bool IsAlive() const
Definition: Unit.h:1692
Definition: World.h:132
WorldSession * GetSession()
Definition: Chat.h:59
Definition: Unit.h:662
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleDismountCommand ( ChatHandler handler,
char const  
)
inlinestatic
636  {
637  Player* player = handler->GetSession()->GetPlayer();
638 
639  // If player is not mounted, so go out :)
640  if (!player->IsMounted())
641  {
643  handler->SetSentErrorMessage(true);
644  return false;
645  }
646 
647  if (player->IsInFlight())
648  {
650  handler->SetSentErrorMessage(true);
651  return false;
652  }
653 
654  player->Dismount();
655  player->RemoveAurasByType(SPELL_AURA_MOUNTED);
656  return true;
657  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:51
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:55
WorldSession * GetSession()
Definition: Chat.h:59
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: SpellAuraDefines.h:138

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleFreezeCommand ( ChatHandler handler,
char const args 
)
inlinestatic
2413  {
2414  Player* player = handler->getSelectedPlayer(); // Selected player, if any. Might be null.
2415  uint32 freezeDuration = 0; // Freeze Duration (in seconds)
2416  bool canApplyFreeze = false; // Determines if every possible argument is set so Freeze can be applied
2417  bool getDurationFromConfig = false; // If there's no given duration, we'll retrieve the world cfg value later
2418 
2419  /*
2420  Possible Freeze Command Scenarios:
2421  case 1 - .freeze (without args and a selected player)
2422  case 2 - .freeze duration (with a selected player)
2423  case 3 - .freeze player duration
2424  case 4 - .freeze player (without specifying duration)
2425  */
2426 
2427  // case 1: .freeze
2428  if (!*args)
2429  {
2430  // Might have a selected player. We'll check it later
2431  // Get the duration from world cfg
2432  getDurationFromConfig = true;
2433  }
2434  else
2435  {
2436  // Get the args that we might have (up to 2)
2437  char const* arg1 = strtok((char*)args, " ");
2438  char const* arg2 = strtok(NULL, " ");
2439 
2440  // Analyze them to see if we got either a playerName or duration or both
2441  if (arg1)
2442  {
2443  if (isNumeric(arg1))
2444  {
2445  // case 2: .freeze duration
2446  // We have a selected player. We'll check him later
2447  freezeDuration = uint32(atoi(arg1));
2448  canApplyFreeze = true;
2449  }
2450  else
2451  {
2452  // case 3 or 4: .freeze player duration | .freeze player
2453  // find the player
2454  std::string name = arg1;
2455  normalizePlayerName(name);
2456  player = ObjectAccessor::FindPlayerByName(name);
2457  // Check if we have duration set
2458  if (arg2 && isNumeric(arg2))
2459  {
2460  freezeDuration = uint32(atoi(arg2));
2461  canApplyFreeze = true;
2462  }
2463  else
2464  getDurationFromConfig = true;
2465  }
2466  }
2467  }
2468 
2469  // Check if duration needs to be retrieved from config
2470  if (getDurationFromConfig)
2471  {
2472  freezeDuration = sWorld->getIntConfig(CONFIG_GM_FREEZE_DURATION);
2473  canApplyFreeze = true;
2474  }
2475 
2476  // Player and duration retrieval is over
2477  if (canApplyFreeze)
2478  {
2479  if (!player) // can be null if some previous selection failed
2480  {
2482  return true;
2483  }
2484  else if (player == handler->GetSession()->GetPlayer())
2485  {
2486  // Can't freeze himself
2488  return true;
2489  }
2490  else // Apply the effect
2491  {
2492  // Add the freeze aura and set the proper duration
2493  // Player combat status and flags are now handled
2494  // in Freeze Spell AuraScript (OnApply)
2495  Aura* freeze = player->AddAura(9454, player);
2496  if (freeze)
2497  {
2498  if (freezeDuration)
2499  freeze->SetDuration(freezeDuration * IN_MILLISECONDS);
2500  handler->PSendSysMessage(LANG_COMMAND_FREEZE, player->GetName().c_str());
2501  // save player
2502  player->SaveToDB();
2503  return true;
2504  }
2505  }
2506  }
2507  return false;
2508  }
arena_t NULL
Definition: jemalloc_internal.h:624
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sWorld
Definition: World.h:887
Definition: World.h:262
Definition: Language.h:1067
Definition: Language.h:1065
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:133
uint32_t uint32
Definition: Define.h:150
TC_GAME_API Player * FindPlayerByName(std::string const &name)
Definition: ObjectAccessor.cpp:220
Player * getSelectedPlayer()
Definition: Chat.cpp:579
bool isNumeric(wchar_t wchar)
Definition: Util.h:194
Definition: Common.h:103
WorldSession * GetSession()
Definition: Chat.h:59
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:806
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
uint32_t uint32
Definition: g3dmath.h:168
Definition: SpellAuras.h:116
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:1066

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleGetDistanceCommand ( ChatHandler handler,
char const args 
)
inlinestatic
765  {
766  WorldObject* obj = NULL;
767 
768  if (*args)
769  {
770  ObjectGuid guid = handler->extractGuidFromLink((char*)args);
771  if (!guid.IsEmpty())
773 
774  if (!obj)
775  {
777  handler->SetSentErrorMessage(true);
778  return false;
779  }
780  }
781  else
782  {
783  obj = handler->getSelectedUnit();
784 
785  if (!obj)
786  {
788  handler->SetSentErrorMessage(true);
789  return false;
790  }
791  }
792 
793  handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj));
794  return true;
795  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Object.h:423
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:514
Definition: ObjectGuid.h:49
Definition: ObjectGuid.h:51
WorldSession * GetSession()
Definition: Chat.h:59
ObjectGuid extractGuidFromLink(char *text)
Definition: Chat.cpp:883
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
TC_GAME_API Object * GetObjectByTypeMask(WorldObject const &, ObjectGuid const &, uint32 typemask)
Definition: ObjectAccessor.cpp:96
Definition: ObjectGuid.h:189
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:509
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleGPSCommand ( ChatHandler handler,
char const args 
)
inlinestatic
169  {
170  WorldObject* object = NULL;
171  if (*args)
172  {
173  ObjectGuid guid = handler->extractGuidFromLink((char*)args);
174  if (!guid.IsEmpty())
176 
177  if (!object)
178  {
180  handler->SetSentErrorMessage(true);
181  return false;
182  }
183  }
184  else
185  {
186  object = handler->getSelectedUnit();
187 
188  if (!object)
189  {
191  handler->SetSentErrorMessage(true);
192  return false;
193  }
194  }
195 
196  CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
197  Cell cell(cellCoord);
198 
199  uint32 zoneId, areaId;
200  object->GetZoneAndAreaId(zoneId, areaId);
201  uint32 mapId = object->GetMapId();
202 
203  MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
204  AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
205  AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
206 
207  float zoneX = object->GetPositionX();
208  float zoneY = object->GetPositionY();
209 
210  Map2ZoneCoordinates(zoneX, zoneY, zoneId);
211 
212  Map const* map = object->GetMap();
213  float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
214  float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
215 
216  GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
217 
218  int gridX = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord;
219  int gridY = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord;
220 
221  uint32 haveMap = Map::ExistMap(mapId, gridX, gridY) ? 1 : 0;
222  uint32 haveVMap = Map::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
223  uint32 haveMMap = (DisableMgr::IsPathfindingEnabled(mapId) && MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId(), handler->GetSession()->GetPlayer()->GetTerrainSwaps())) ? 1 : 0;
224 
225  if (haveVMap)
226  {
227  if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
229  else
231  }
232  else
234 
235  char const* unknown = handler->GetTrinityString(LANG_UNKNOWN);
236 
238  mapId, (mapEntry ? mapEntry->MapName_lang : unknown),
239  zoneId, (zoneEntry ? zoneEntry->AreaName_lang : unknown),
240  areaId, (areaEntry ? areaEntry->AreaName_lang : unknown),
241  object->GetPhaseMask(),
242  object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation());
243  if (Transport* transport = object->GetTransport())
245  transport->GetGOInfo()->moTransport.mapID, object->GetTransOffsetX(), object->GetTransOffsetY(), object->GetTransOffsetZ(), object->GetTransOffsetO(),
246  transport->GetEntry(), transport->GetName().c_str());
248  cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
249  zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap, haveMMap);
250 
251  LiquidData liquidStatus;
252  ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
253 
254  if (status)
255  handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
256 
257  if (!object->GetTerrainSwaps().empty())
258  {
259  std::stringstream ss;
260  for (uint32 swap : object->GetTerrainSwaps())
261  ss << swap << " ";
262  handler->PSendSysMessage("Target's active terrain swaps: %s", ss.str().c_str());
263  }
264  if (!object->GetWorldMapAreaSwaps().empty())
265  {
266  std::stringstream ss;
267  for (uint32 swap : object->GetWorldMapAreaSwaps())
268  ss << swap << " ";
269  handler->PSendSysMessage("Target's active world map area swaps: %s", ss.str().c_str());
270  }
271 
272  return true;
273  }
Definition: DBCStructure.h:37
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
float depth_level
Definition: Map.h:156
static bool ExistVMap(uint32 mapid, int gx, int gy)
Definition: Map.cpp:107
bool IsPathfindingEnabled(uint32 mapId)
Definition: DisableMgr.cpp:380
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
Definition: Map.h:151
Definition: Language.h:125
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:188
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2314
std::set< uint32 > const & GetTerrainSwaps() const
Definition: Object.h:466
Definition: DBCStructure.h:830
#define MAX_NUMBER_OF_GRIDS
Definition: GridDefines.h:37
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Transport.h:28
Definition: Object.h:423
uint32 y_coord
Definition: GridDefines.h:156
Player * GetPlayer() const
Definition: WorldSession.h:927
uint32 x_coord
Definition: GridDefines.h:155
Definition: Language.h:220
dtNavMesh const * GetNavMesh(uint32 mapId, TerrainSet swaps)
Definition: MMapManager.cpp:399
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTablefmt)
Definition: ObjectGuid.h:49
Definition: Language.h:1110
Definition: ObjectGuid.h:51
void Map2ZoneCoordinates(float &x, float &y, uint32 worldMapAreaId)
Definition: DBCStores.cpp:681
uint32 GetPhaseMask() const
Definition: Object.h:461
Definition: Language.h:207
Definition: Language.h:1109
#define MAP_ALL_LIQUIDS
Definition: Map.h:146
std::set< uint32 > const & GetWorldMapAreaSwaps() const
Definition: Object.h:467
float level
Definition: Map.h:155
uint32_t uint32
Definition: Define.h:150
ZLiquidStatus
Definition: Map.h:131
uint32 type_flags
Definition: Map.h:153
char * AreaName_lang
Definition: DBCStructure.h:51
Definition: Map.h:259
uint32 entry
Definition: Map.h:154
Definition: Cell.h:49
Definition: Language.h:1108
Transport * GetTransport() const
Definition: Object.h:602
DBCStorage< MapEntry > sMapStore(Mapfmt)
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
WorldSession * GetSession()
Definition: Chat.h:59
static bool ExistMap(uint32 mapid, int gx, int gy)
Definition: Map.cpp:79
ObjectGuid extractGuidFromLink(char *text)
Definition: Chat.cpp:883
static MMapManager * createOrGetMMapManager()
Definition: MMapFactory.cpp:28
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
TC_GAME_API Object * GetObjectByTypeMask(WorldObject const &, ObjectGuid const &, uint32 typemask)
Definition: ObjectAccessor.cpp:96
bool IsOutdoors(float x, float y, float z) const
Definition: Map.cpp:2388
char * MapName_lang
Definition: DBCStructure.h:838
Definition: ObjectGuid.h:189
float GetPositionX() const
Definition: Position.h:104
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
#define MAX_HEIGHT
Definition: Map.h:247
Definition: Language.h:219
Definition: Language.h:509
Definition: Language.h:78
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data=nullptr) const
Definition: Map.cpp:2497
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleGUIDCommand ( ChatHandler handler,
char const  
)
inlinestatic
660  {
661  ObjectGuid guid = handler->GetSession()->GetPlayer()->GetTarget();
662 
663  if (guid.IsEmpty())
664  {
666  handler->SetSentErrorMessage(true);
667  return false;
668  }
669 
670  handler->PSendSysMessage(LANG_OBJECT_GUID, guid.ToString().c_str());
671  return true;
672  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:225
Definition: Language.h:224
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: ObjectGuid.h:189
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
std::string ToString() const
Definition: ObjectGuid.cpp:99
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleHelpCommand ( ChatHandler handler,
char const args 
)
inlinestatic
675  {
676  char const* cmd = strtok((char*)args, " ");
677  if (!cmd)
678  {
679  handler->ShowHelpForCommand(handler->getCommandTable(), "help");
680  handler->ShowHelpForCommand(handler->getCommandTable(), "");
681  }
682  else
683  {
684  if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd))
686  }
687 
688  return true;
689  }
bool ShowHelpForCommand(std::vector< ChatCommand > const &table, const char *cmd)
Definition: Chat.cpp:522
static std::vector< ChatCommand > const & getCommandTable()
Definition: Chat.cpp:38
Definition: Language.h:38
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 misc_commandscript::HandleHideAreaCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1114  {
1115  if (!*args)
1116  return false;
1117 
1118  Player* playerTarget = handler->getSelectedPlayer();
1119  if (!playerTarget)
1120  {
1122  handler->SetSentErrorMessage(true);
1123  return false;
1124  }
1125 
1126  AreaTableEntry const* area = sAreaTableStore.LookupEntry(atoi(args));
1127  if (!area)
1128  {
1129  handler->SendSysMessage(LANG_BAD_VALUE);
1130  handler->SetSentErrorMessage(true);
1131  return false;
1132  }
1133 
1134  if (area->AreaBit < 0)
1135  {
1136  handler->SendSysMessage(LANG_BAD_VALUE);
1137  handler->SetSentErrorMessage(true);
1138  return false;
1139  }
1140 
1141  int32 offset = area->AreaBit / 32;
1142  if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
1143  {
1144  handler->SendSysMessage(LANG_BAD_VALUE);
1145  handler->SetSentErrorMessage(true);
1146  return false;
1147  }
1148 
1149  uint32 val = uint32((1 << (area->AreaBit % 32)));
1150  uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
1151  playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
1152 
1154  return true;
1155  }
Definition: DBCStructure.h:37
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:584
Definition: Language.h:140
#define PLAYER_EXPLORED_ZONES_SIZE
Definition: Player.h:72
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTablefmt)
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Player * getSelectedPlayer()
Definition: Chat.cpp:579
Definition: Language.h:139
int32 AreaBit
Definition: DBCStructure.h:42
uint32_t uint32
Definition: g3dmath.h:168
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: UpdateFields.h:249

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleItemMoveCommand ( ChatHandler handler,
char const args 
)
inlinestatic
692  {
693  if (!*args)
694  return false;
695 
696  char const* param1 = strtok((char*)args, " ");
697  if (!param1)
698  return false;
699 
700  char const* param2 = strtok(NULL, " ");
701  if (!param2)
702  return false;
703 
704  uint8 srcSlot = uint8(atoi(param1));
705  uint8 dstSlot = uint8(atoi(param2));
706 
707  if (srcSlot == dstSlot)
708  return true;
709 
710  if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
711  return false;
712 
713  if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
714  return false;
715 
716  uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
717  uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
718 
719  handler->GetSession()->GetPlayer()->SwapItem(src, dst);
720 
721  return true;
722  }
#define INVENTORY_SLOT_BAG_0
arena_t NULL
Definition: jemalloc_internal.h:624
Player * GetPlayer() const
Definition: WorldSession.h:927
uint16_t uint16
Definition: Define.h:151
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 misc_commandscript::HandleKickPlayerCommand ( ChatHandler handler,
char const args 
)
inlinestatic
858  {
859  Player* target = NULL;
860  std::string playerName;
861  if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
862  return false;
863 
864  if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
865  {
867  handler->SetSentErrorMessage(true);
868  return false;
869  }
870 
871  // check online security
872  if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
873  return false;
874 
875  std::string kickReasonStr = handler->GetTrinityString(LANG_NO_REASON);
876  if (*args != '\0')
877  {
878  char const* kickReason = strtok(NULL, "\r");
879  if (kickReason != NULL)
880  kickReasonStr = kickReason;
881  }
882 
883  if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
884  sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), playerName.c_str(), kickReasonStr.c_str());
885  else
886  handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
887 
888  target->GetSession()->KickPlayer();
889 
890  return true;
891  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
std::string const & GetPlayerName() const
Definition: WorldSession.cpp:190
Definition: Language.h:314
arena_t NULL
Definition: jemalloc_internal.h:624
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:1203
#define sWorld
Definition: World.h:887
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
Definition: World.h:150
Definition: Language.h:313
Definition: Language.h:1101
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
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 misc_commandscript::HandleLinkGraveCommand ( ChatHandler handler,
char const args 
)
inlinestatic
955  {
956  if (!*args)
957  return false;
958 
959  char* px = strtok((char*)args, " ");
960  if (!px)
961  return false;
962 
963  uint32 graveyardId = uint32(atoi(px));
964 
965  uint32 team;
966 
967  char* px2 = strtok(NULL, " ");
968 
969  if (!px2)
970  team = 0;
971  else if (strncmp(px2, "horde", 6) == 0)
972  team = HORDE;
973  else if (strncmp(px2, "alliance", 9) == 0)
974  team = ALLIANCE;
975  else
976  return false;
977 
978  WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
979 
980  if (!graveyard)
981  {
982  handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
983  handler->SetSentErrorMessage(true);
984  return false;
985  }
986 
987  Player* player = handler->GetSession()->GetPlayer();
988 
989  uint32 zoneId = player->GetZoneId();
990 
991  AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId);
992  if (!areaEntry || areaEntry->ParentAreaID !=0)
993  {
994  handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
995  handler->SetSentErrorMessage(true);
996  return false;
997  }
998 
999  if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team))
1000  handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
1001  else
1002  handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
1003 
1004  return true;
1005  }
Definition: DBCStructure.h:37
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
Definition: DBCStructure.h:1434
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Language.h:452
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sObjectMgr
Definition: ObjectMgr.h:1567
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTablefmt)
Definition: SharedDefines.h:1000
Definition: Language.h:451
uint32_t uint32
Definition: Define.h:150
uint32 ParentAreaID
Definition: DBCStructure.h:41
Definition: SharedDefines.h:999
Definition: Language.h:453
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
uint32_t uint32
Definition: g3dmath.h:168
Definition: Language.h:454

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleListFreezeCommand ( ChatHandler handler,
char const  
)
inlinestatic
2569  {
2570  // Get names from DB
2573  if (!result)
2574  {
2576  return true;
2577  }
2578 
2579  // Header of the names
2581 
2582  // Output of the results
2583  do
2584  {
2585  Field* fields = result->Fetch();
2586  std::string player = fields[0].GetString();
2587  int32 remaintime = fields[1].GetInt32();
2588  // Save the frozen player to update remaining time in case of future .listfreeze uses
2589  // before the frozen state expires
2590  if (Player* frozen = ObjectAccessor::FindPlayerByName(player))
2591  frozen->SaveToDB();
2592  // Notify the freeze duration
2593  if (remaintime == -1) // Permanent duration
2594  handler->PSendSysMessage(LANG_COMMAND_PERMA_FROZEN_PLAYER, player.c_str());
2595  else
2596  // show time left (seconds)
2597  handler->PSendSysMessage(LANG_COMMAND_TEMP_FROZEN_PLAYER, player.c_str(), remaintime / IN_MILLISECONDS);
2598  }
2599  while (result->NextRow());
2600 
2601  return true;
2602  }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Class used to access individual fields of database query result.
Definition: Field.h:56
Definition: PreparedStatement.h:74
Definition: Language.h:1069
Definition: Language.h:1070
Definition: Language.h:1071
int32_t int32
Definition: Define.h:146
Definition: Language.h:1085
TC_GAME_API Player * FindPlayerByName(std::string const &name)
Definition: ObjectAccessor.cpp:220
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: CharacterDatabase.h:374
int32 GetInt32() const
Definition: Field.h:165
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: Common.h:103
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleMailBoxCommand ( ChatHandler handler,
char const  
)
inlinestatic
2667  {
2668  Player* player = handler->GetSession()->GetPlayer();
2669 
2670  handler->GetSession()->SendShowMailBox(player->GetGUID());
2671  return true;
2672  }
Player * GetPlayer() const
Definition: WorldSession.h:927
void SendShowMailBox(ObjectGuid guid)
Definition: NPCHandler.cpp:79
WorldSession * GetSession()
Definition: Chat.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleMaxSkillCommand ( ChatHandler handler,
char const  
)
inlinestatic
1406  {
1407  Player* player = handler->getSelectedPlayerOrSelf();
1408  if (!player)
1409  {
1411  handler->SetSentErrorMessage(true);
1412  return false;
1413  }
1414 
1415  // each skills that have max skill value dependent from level seted to current level max skill value
1416  player->UpdateSkillsToMaxSkillsForLevel();
1417  return true;
1418  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Player * getSelectedPlayerOrSelf()
Definition: Chat.cpp:623
Definition: Language.h:140
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 misc_commandscript::HandleMovegensCommand ( ChatHandler handler,
char const  
)
inlinestatic
2081  {
2082  Unit* unit = handler->getSelectedUnit();
2083  if (!unit)
2084  {
2086  handler->SetSentErrorMessage(true);
2087  return false;
2088  }
2089 
2090  handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().ToString().c_str());
2091 
2092  MotionMaster* motionMaster = unit->GetMotionMaster();
2093  float x, y, z;
2094  motionMaster->GetDestination(x, y, z);
2095 
2096  for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
2097  {
2098  MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i);
2099  if (!movementGenerator)
2100  {
2101  handler->SendSysMessage("Empty");
2102  continue;
2103  }
2104 
2105  switch (movementGenerator->GetMovementGeneratorType())
2106  {
2107  case IDLE_MOTION_TYPE:
2109  break;
2110  case RANDOM_MOTION_TYPE:
2112  break;
2113  case WAYPOINT_MOTION_TYPE:
2115  break;
2118  break;
2119  case CONFUSED_MOTION_TYPE:
2121  break;
2122  case CHASE_MOTION_TYPE:
2123  {
2124  Unit* target = NULL;
2125  if (unit->GetTypeId() == TYPEID_PLAYER)
2126  target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
2127  else
2128  target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
2129 
2130  if (!target)
2132  else if (target->GetTypeId() == TYPEID_PLAYER)
2133  handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName().c_str(), target->GetGUID().ToString().c_str());
2134  else
2135  handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName().c_str(), target->GetGUID().ToString().c_str());
2136  break;
2137  }
2138  case FOLLOW_MOTION_TYPE:
2139  {
2140  Unit* target = NULL;
2141  if (unit->GetTypeId() == TYPEID_PLAYER)
2142  target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
2143  else
2144  target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
2145 
2146  if (!target)
2148  else if (target->GetTypeId() == TYPEID_PLAYER)
2149  handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName().c_str(), target->GetGUID().ToString().c_str());
2150  else
2151  handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName().c_str(), target->GetGUID().ToString().c_str());
2152  break;
2153  }
2154  case HOME_MOTION_TYPE:
2155  {
2156  if (unit->GetTypeId() == TYPEID_UNIT)
2157  handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
2158  else
2160  break;
2161  }
2162  case FLIGHT_MOTION_TYPE:
2164  break;
2165  case POINT_MOTION_TYPE:
2166  {
2167  handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
2168  break;
2169  }
2170  case FLEEING_MOTION_TYPE:
2172  break;
2173  case DISTRACT_MOTION_TYPE:
2175  break;
2176  case EFFECT_MOTION_TYPE:
2178  break;
2179  default:
2180  handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType());
2181  break;
2182  }
2183  }
2184  return true;
2185  }
Definition: Language.h:944
Definition: MotionMaster.h:37
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:548
Definition: Language.h:945
Definition: Language.h:618
Definition: MotionMaster.h:44
Definition: Language.h:617
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Definition: Language.h:32
Definition: Language.h:547
Definition: TargetedMovementGenerator.h:67
std::string const & GetName() const
Definition: Object.h:479
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: MotionMaster.h:45
Definition: ObjectGuid.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: MotionMaster.h:38
virtual MovementGeneratorType GetMovementGeneratorType() const =0
Definition: Language.h:553
Definition: MotionMaster.h:47
Definition: Language.h:619
Definition: MotionMaster.h:48
Definition: Language.h:546
_Ty GetMotionSlot(int slot) const
Definition: MotionMaster.h:128
Definition: Language.h:554
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Language.h:942
Definition: MotionMaster.h:82
G3D::int16 z
Definition: Vector3int16.h:46
Definition: Language.h:545
Definition: MotionMaster.h:54
G3D::int16 y
Definition: Vector2int16.h:38
Definition: Language.h:943
Definition: MotionMaster.h:63
Definition: Language.h:551
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: TargetedMovementGenerator.h:91
Definition: ObjectGuid.h:33
uint8_t uint8
Definition: Define.h:152
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: Language.h:542
Definition: Language.h:549
Definition: MotionMaster.h:41
#define const
Definition: zconf.h:217
G3D::int16 x
Definition: Vector2int16.h:37
Definition: MotionMaster.h:42
Definition: MotionMaster.h:43
Definition: MovementGenerator.h:30
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:543
Definition: Unit.h:1305
Definition: MotionMaster.h:39
Definition: Language.h:550
Definition: MotionMaster.h:46
Definition: Language.h:552
std::string ToString() const
Definition: ObjectGuid.cpp:99
bool GetDestination(float &x, float &y, float &z)
Definition: MotionMaster.cpp:703
Definition: Language.h:544
Definition: MotionMaster.h:52

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleMuteCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1893  {
1894  char* nameStr;
1895  char* delayStr;
1896  handler->extractOptFirstArg((char*)args, &nameStr, &delayStr);
1897  if (!delayStr)
1898  return false;
1899 
1900  char const* muteReason = strtok(NULL, "\r");
1901  std::string muteReasonStr = handler->GetTrinityString(LANG_NO_REASON);
1902  if (muteReason != NULL)
1903  muteReasonStr = muteReason;
1904 
1905  Player* target;
1906  ObjectGuid targetGuid;
1907  std::string targetName;
1908  if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
1909  return false;
1910 
1911  uint32 accountId = target ? target->GetSession()->GetAccountId() : ObjectMgr::GetPlayerAccountIdByGUID(targetGuid);
1912 
1913  // find only player from same account if any
1914  if (!target)
1915  if (WorldSession* session = sWorld->FindSession(accountId))
1916  target = session->GetPlayer();
1917 
1918  uint32 notSpeakTime = uint32(atoi(delayStr));
1919 
1920  // must have strong lesser security level
1921  if (handler->HasLowerSecurity (target, targetGuid, true))
1922  return false;
1923 
1925  std::string muteBy = "";
1926  if (handler->GetSession())
1927  muteBy = handler->GetSession()->GetPlayerName();
1928  else
1929  muteBy = handler->GetTrinityString(LANG_CONSOLE);
1930 
1931  if (target)
1932  {
1933  // Target is online, mute will be in effect right away.
1934  int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
1935  target->GetSession()->m_muteTime = muteTime;
1936  stmt->setInt64(0, muteTime);
1937  std::string nameLink = handler->playerLink(targetName);
1938 
1939  if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
1940  sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
1941 
1942  ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
1943  }
1944  else
1945  {
1946  // Target is offline, mute will be in effect starting from the next login.
1947  int32 muteTime = -int32(notSpeakTime * MINUTE);
1948  stmt->setInt64(0, muteTime);
1949  }
1950 
1951  stmt->setString(1, muteReasonStr.c_str());
1952  stmt->setString(2, muteBy.c_str());
1953  stmt->setUInt32(3, accountId);
1954  LoginDatabase.Execute(stmt);
1956  stmt->setUInt32(0, accountId);
1957  stmt->setUInt32(1, notSpeakTime);
1958  stmt->setString(2, muteBy.c_str());
1959  stmt->setString(3, muteReasonStr.c_str());
1960  LoginDatabase.Execute(stmt);
1961  std::string nameLink = handler->playerLink(targetName);
1962 
1963  if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD) && !target)
1964  sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
1965  else
1966  handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
1967 
1968  return true;
1969  }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
std::string const & GetPlayerName() const
Definition: WorldSession.cpp:190
int64_t int64
Definition: Define.h:145
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Language.h:327
Definition: Language.h:315
Definition: Language.h:1206
#define sWorld
Definition: World.h:887
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945
Definition: PreparedStatement.h:74
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
Definition: Common.h:97
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
Definition: LoginDatabase.h:70
Definition: Language.h:1105
Definition: World.h:151
Definition: Language.h:1101
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
void setInt64(const uint8 index, const int64 value)
Definition: PreparedStatement.cpp:160
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: Chat.h:56
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
Definition: LoginDatabase.h:110
int32_t int32
Definition: g3dmath.h:167
WorldSession * GetSession()
Definition: Chat.h:59
Definition: Language.h:328
static uint32 GetPlayerAccountIdByGUID(ObjectGuid const &guid)
Definition: ObjectMgr.cpp:2302
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
void extractOptFirstArg(char *args, char **arg1, char **arg2)
Definition: Chat.cpp:998
Player session in the World.
Definition: WorldSession.h:882
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
std::string playerLink(std::string const &name) const
Definition: Chat.h:132

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleMuteInfoCommand ( ChatHandler handler,
char const args 
)
inlinestatic
2022  {
2023  if (!*args)
2024  return false;
2025 
2026  char *nameStr = strtok((char*)args, "");
2027  if (!nameStr)
2028  return false;
2029 
2030  std::string accountName = nameStr;
2031  if (!Utf8ToUpperOnlyLatin(accountName))
2032  {
2033  handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
2034  handler->SetSentErrorMessage(true);
2035  return false;
2036  }
2037 
2038  uint32 accountId = AccountMgr::GetId(accountName);
2039  if (!accountId)
2040  {
2041  handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
2042  return false;
2043  }
2044 
2045  return HandleMuteInfoHelper(accountId, accountName.c_str(), handler);
2046  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static bool HandleMuteInfoHelper(uint32 accountId, char const *accountName, ChatHandler *handler)
Definition: cs_misc.cpp:2049
static uint32 GetId(std::string const &username)
Definition: AccountMgr.cpp:275
uint32_t uint32
Definition: Define.h:150
Definition: Language.h:412
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
Definition: Util.cpp:498

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleMuteInfoHelper ( uint32  accountId,
char const accountName,
ChatHandler handler 
)
inlinestatic
2050  {
2052  stmt->setUInt32(0, accountId);
2053  PreparedQueryResult result = LoginDatabase.Query(stmt);
2054 
2055  if (!result)
2056  {
2057  handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY_EMPTY, accountName);
2058  return true;
2059  }
2060 
2061  handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY, accountName);
2062  do
2063  {
2064  Field* fields = result->Fetch();
2065 
2066  // we have to manually set the string for mutedate
2067  time_t sqlTime = fields[0].GetUInt32();
2068  tm timeinfo;
2069  char buffer[80];
2070 
2071  // set it to string
2072  localtime_r(&sqlTime, &timeinfo);
2073  strftime(buffer, sizeof(buffer),"%Y-%m-%d %I:%M%p", &timeinfo);
2074 
2075  handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY_OUTPUT, buffer, fields[1].GetUInt32(), fields[2].GetCString(), fields[3].GetCString());
2076  } while (result->NextRow());
2077  return true;
2078  }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Class used to access individual fields of database query result.
Definition: Field.h:56
Definition: Language.h:1131
Definition: PreparedStatement.h:74
Definition: Language.h:1130
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
Definition: Language.h:1129
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: LoginDatabase.h:111

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandleNearGraveCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1008  {
1009  uint32 team;
1010 
1011  size_t argStr = strlen(args);
1012 
1013  if (!*args)
1014  team = 0;
1015  else if (strncmp((char*)args, "horde", argStr) == 0)
1016  team = HORDE;
1017  else if (strncmp((char*)args, "alliance", argStr) == 0)
1018  team = ALLIANCE;
1019  else
1020  return false;
1021 
1022  Player* player = handler->GetSession()->GetPlayer();
1023  uint32 zone_id = player->GetZoneId();
1024 
1025  WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
1026  if (graveyard)
1027  {
1028  uint32 graveyardId = graveyard->ID;
1029 
1030  GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id);
1031  if (!data)
1032  {
1033  handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
1034  handler->SetSentErrorMessage(true);
1035  return false;
1036  }
1037 
1038  team = data->team;
1039 
1040  std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
1041 
1042  if (team == 0)
1043  team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
1044  else if (team == HORDE)
1045  team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
1046  else if (team == ALLIANCE)
1047  team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
1048 
1049  handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
1050  }
1051  else
1052  {
1053  std::string team_name;
1054 
1055  if (team == HORDE)
1056  team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
1057  else if (team == ALLIANCE)
1058  team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
1059 
1060  if (!team)
1062  else
1063  handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
1064  }
1065 
1066  return true;
1067  }
Definition: Language.h:456
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:458
Definition: Language.h:463
uint32 team
Definition: ObjectMgr.h:592
Definition: Language.h:460
Definition: DBCStructure.h:1434
Definition: Language.h:457
Definition: Language.h:461
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: Language.h:459
uint32 ID
Definition: DBCStructure.h:1436
Definition: SharedDefines.h:1000
Definition: ObjectMgr.h:589
uint32_t uint32
Definition: Define.h:150
Definition: Language.h:462
Definition: SharedDefines.h:999
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
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 misc_commandscript::HandlePInfoCommand ( ChatHandler handler,
char const args 
)
inlinestatic
1495  {
1496  // Define ALL the player variables!
1497  Player* target;
1498  ObjectGuid targetGuid;
1499  std::string targetName;
1500  PreparedStatement* stmt = NULL;
1501 
1502  // To make sure we get a target, we convert our guid to an omniversal...
1503  ObjectGuid parseGUID = ObjectGuid::Create<HighGuid::Player>(strtoull(args, nullptr, 10));
1504 
1505  // ... and make sure we get a target, somehow.
1506  if (ObjectMgr::GetPlayerNameByGUID(parseGUID, targetName))
1507  {
1508  target = ObjectAccessor::FindPlayer(parseGUID);
1509  targetGuid = parseGUID;
1510  }
1511  // if not, then return false. Which shouldn't happen, now should it ?
1512  else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
1513  return false;
1514 
1515  /* The variables we extract for the command. They are
1516  * default as "does not exist" to prevent problems
1517  * The output is printed in the follow manner:
1518  *
1519  * Player %s %s (guid: %u) - I. LANG_PINFO_PLAYER
1520  * ** GM Mode active, Phase: -1 - II. LANG_PINFO_GM_ACTIVE (if GM)
1521  * ** Banned: (Type, Reason, Time, By) - III. LANG_PINFO_BANNED (if banned)
1522  * ** Muted: (Reason, Time, By) - IV. LANG_PINFO_MUTED (if muted)
1523  * * Account: %s (id: %u), GM Level: %u - V. LANG_PINFO_ACC_ACCOUNT
1524  * * Last Login: %u (Failed Logins: %u) - VI. LANG_PINFO_ACC_LASTLOGIN
1525  * * Uses OS: %s - Latency: %u ms - VII. LANG_PINFO_ACC_OS
1526  * * Registration Email: %s - Email: %s - VIII. LANG_PINFO_ACC_REGMAILS
1527  * * Last IP: %u (Locked: %s) - IX. LANG_PINFO_ACC_IP
1528  * * Level: %u (%u/%u XP (%u XP left) - X. LANG_PINFO_CHR_LEVEL
1529  * * Race: %s %s, Class %s - XI. LANG_PINFO_CHR_RACE
1530  * * Alive ?: %s - XII. LANG_PINFO_CHR_ALIVE
1531  * * Phase: %s - XIII. LANG_PINFO_CHR_PHASE (if not GM)
1532  * * Money: %ug%us%uc - XIV. LANG_PINFO_CHR_MONEY
1533  * * Map: %s, Area: %s - XV. LANG_PINFO_CHR_MAP
1534  * * Guild: %s (Id: %u) - XVI. LANG_PINFO_CHR_GUILD (if in guild)
1535  * ** Rank: %s - XVII. LANG_PINFO_CHR_GUILD_RANK (if in guild)
1536  * ** Note: %s - XVIII.LANG_PINFO_CHR_GUILD_NOTE (if in guild and has note)
1537  * ** O. Note: %s - XVIX. LANG_PINFO_CHR_GUILD_ONOTE (if in guild and has officer note)
1538  * * Played time: %s - XX. LANG_PINFO_CHR_PLAYEDTIME
1539  * * Mails: %u Read/%u Total - XXI. LANG_PINFO_CHR_MAILS (if has mails)
1540  *
1541  * Not all of them can be moved to the top. These should
1542  * place the most important ones to the head, though.
1543  *
1544  * For a cleaner overview, I segment each output in Roman numerals
1545  */
1546 
1547  // Account data print variables
1548  std::string userName = handler->GetTrinityString(LANG_ERROR);
1549  uint32 accId = 0;
1550  ObjectGuid::LowType lowguid = targetGuid.GetCounter();
1551  std::string eMail = handler->GetTrinityString(LANG_ERROR);
1552  std::string regMail = handler->GetTrinityString(LANG_ERROR);
1553  uint32 security = 0;
1554  std::string lastIp = handler->GetTrinityString(LANG_ERROR);
1555  uint8 locked = 0;
1556  std::string lastLogin = handler->GetTrinityString(LANG_ERROR);
1557  uint32 failedLogins = 0;
1558  uint32 latency = 0;
1559  std::string OS = handler->GetTrinityString(LANG_UNKNOWN);
1560 
1561  // Mute data print variables
1562  int64 muteTime = -1;
1563  std::string muteReason = handler->GetTrinityString(LANG_NO_REASON);
1564  std::string muteBy = handler->GetTrinityString(LANG_UNKNOWN);
1565 
1566  // Ban data print variables
1567  int64 banTime = -1;
1568  std::string banType = handler->GetTrinityString(LANG_UNKNOWN);
1569  std::string banReason = handler->GetTrinityString(LANG_NO_REASON);
1570  std::string bannedBy = handler->GetTrinityString(LANG_UNKNOWN);
1571 
1572  // Character data print variables
1573  uint8 raceid, classid = 0; //RACE_NONE, CLASS_NONE
1574  std::string raceStr, classStr = handler->GetTrinityString(LANG_UNKNOWN);
1575  uint8 gender = 0;
1576  int8 locale = handler->GetSessionDbcLocale();
1577  uint32 totalPlayerTime = 0;
1578  uint8 level = 0;
1579  std::string alive = handler->GetTrinityString(LANG_ERROR);
1580  uint32 money = 0;
1581  uint32 xp = 0;
1582  uint32 xptotal = 0;
1583 
1584  // Position data print
1585  uint32 mapId;
1586  uint32 areaId;
1587  uint32 phase = 0;
1588  std::string areaName = handler->GetTrinityString(LANG_UNKNOWN);
1589  std::string zoneName = handler->GetTrinityString(LANG_UNKNOWN);
1590 
1591  // Guild data print variables defined so that they exist, but are not necessarily used
1592  ObjectGuid::LowType guildId = UI64LIT(0);
1593  uint8 guildRankId = 0;
1594  std::string guildName;
1595  std::string guildRank;
1596  std::string note;
1597  std::string officeNote;
1598 
1599  // Mail data print is only defined if you have a mail
1600 
1601  if (target)
1602  {
1603  // check online security
1604  if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
1605  return false;
1606 
1607  accId = target->GetSession()->GetAccountId();
1608  money = target->GetMoney();
1609  totalPlayerTime = target->GetTotalPlayedTime();
1610  level = target->getLevel();
1611  latency = target->GetSession()->GetLatency();
1612  raceid = target->getRace();
1613  classid = target->getClass();
1614  muteTime = target->GetSession()->m_muteTime;
1615  mapId = target->GetMapId();
1616  areaId = target->GetAreaId();
1617  alive = target->IsAlive() ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO);
1618  gender = target->GetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_GENDER);
1619  phase = target->GetPhaseMask();
1620  }
1621  // get additional information from DB
1622  else
1623  {
1624  // check offline security
1625  if (handler->HasLowerSecurity(NULL, targetGuid))
1626  return false;
1627 
1628  // Query informations from the DB
1630  stmt->setUInt64(0, lowguid);
1632 
1633  if (!result)
1634  return false;
1635 
1636  Field* fields = result->Fetch();
1637  totalPlayerTime = fields[0].GetUInt32();
1638  level = fields[1].GetUInt8();
1639  money = fields[2].GetUInt32();
1640  accId = fields[3].GetUInt32();
1641  raceid = fields[4].GetUInt8();
1642  classid = fields[5].GetUInt8();
1643  mapId = fields[6].GetUInt16();
1644  areaId = fields[7].GetUInt16();
1645  gender = fields[8].GetUInt8();
1646  uint32 health = fields[9].GetUInt32();
1647  uint32 playerFlags = fields[10].GetUInt32();
1648 
1649  if (!health || playerFlags & PLAYER_FLAGS_GHOST)
1650  alive = handler->GetTrinityString(LANG_NO);
1651  else
1652  alive = handler->GetTrinityString(LANG_YES);
1653  }
1654 
1655  // Query the prepared statement for login data
1657  stmt->setInt32(0, int32(realm.Id.Realm));
1658  stmt->setUInt32(1, accId);
1659  PreparedQueryResult result = LoginDatabase.Query(stmt);
1660 
1661  if (result)
1662  {
1663  Field* fields = result->Fetch();
1664  userName = fields[0].GetString();
1665  security = fields[1].GetUInt8();
1666 
1667  // Only fetch these fields if commander has sufficient rights)
1668  if (handler->HasPermission(rbac::RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA) && // RBAC Perm. 48, Role 39
1669  (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)))
1670  {
1671  eMail = fields[2].GetString();
1672  regMail = fields[3].GetString();
1673  lastIp = fields[4].GetString();
1674  lastLogin = fields[5].GetString();
1675 
1676  uint32 ip = inet_addr(lastIp.c_str());
1678 
1679  // If ip2nation table is populated, it displays the country
1681  stmt->setUInt32(0, ip);
1682  if (PreparedQueryResult result2 = LoginDatabase.Query(stmt))
1683  {
1684  Field* fields2 = result2->Fetch();
1685  lastIp.append(" (");
1686  lastIp.append(fields2[0].GetString());
1687  lastIp.append(")");
1688  }
1689  }
1690  else
1691  {
1692  eMail = handler->GetTrinityString(LANG_UNAUTHORIZED);
1693  regMail = handler->GetTrinityString(LANG_UNAUTHORIZED);
1694  lastIp = handler->GetTrinityString(LANG_UNAUTHORIZED);
1695  lastLogin = handler->GetTrinityString(LANG_UNAUTHORIZED);
1696  }
1697  muteTime = fields[6].GetUInt64();
1698  muteReason = fields[7].GetString();
1699  muteBy = fields[8].GetString();
1700  failedLogins = fields[9].GetUInt32();
1701  locked = fields[10].GetUInt8();
1702  OS = fields[11].GetString();
1703  }
1704 
1705  // Creates a chat link to the character. Returns nameLink
1706  std::string nameLink = handler->playerLink(targetName);
1707 
1708  // Returns banType, banTime, bannedBy, banreason
1710  stmt2->setUInt32(0, accId);
1711  PreparedQueryResult result2 = LoginDatabase.Query(stmt2);
1712  if (!result2)
1713  {
1714  banType = handler->GetTrinityString(LANG_CHARACTER);
1716  stmt->setUInt64(0, lowguid);
1717  result2 = CharacterDatabase.Query(stmt);
1718  }
1719 
1720  if (result2)
1721  {
1722  Field* fields = result2->Fetch();
1723  banTime = int64(fields[1].GetUInt64() ? 0 : fields[0].GetUInt32());
1724  bannedBy = fields[2].GetString();
1725  banReason = fields[3].GetString();
1726  }
1727 
1728  // Can be used to query data from Characters database
1730  stmt2->setUInt64(0, lowguid);
1731  PreparedQueryResult result4 = CharacterDatabase.Query(stmt2);
1732 
1733  if (result4)
1734  {
1735  Field* fields = result4->Fetch();
1736  xp = fields[0].GetUInt32(); // Used for "current xp" output and "%u XP Left" calculation
1737  ObjectGuid::LowType gguid = fields[1].GetUInt64(); // We check if have a guild for the person, so we might not require to query it at all
1738  xptotal = sObjectMgr->GetXPForLevel(level);
1739 
1740  if (gguid)
1741  {
1742  // Guild Data - an own query, because it may not happen.
1744  stmt3->setUInt64(0, lowguid);
1745  PreparedQueryResult result5 = CharacterDatabase.Query(stmt3);
1746  if (result5)
1747  {
1748  Field* fields5 = result5->Fetch();
1749  guildId = fields5[0].GetUInt64();
1750  guildName = fields5[1].GetString();
1751  guildRank = fields5[2].GetString();
1752  guildRankId = fields5[3].GetUInt8();
1753  note = fields5[4].GetString();
1754  officeNote = fields5[5].GetString();
1755  }
1756  }
1757  }
1758 
1759  // Initiate output
1760  // Output I. LANG_PINFO_PLAYER
1761  handler->PSendSysMessage(LANG_PINFO_PLAYER, target ? "" : handler->GetTrinityString(LANG_OFFLINE), nameLink.c_str(), targetGuid.ToString().c_str());
1762 
1763  // Output II. LANG_PINFO_GM_ACTIVE if character is gamemaster
1764  if (target && target->IsGameMaster())
1766 
1767  // Output III. LANG_PINFO_BANNED if ban exists and is applied
1768  if (banTime >= 0)
1769  handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
1770 
1771  // Output IV. LANG_PINFO_MUTED if mute is applied
1772  if (muteTime > 0)
1773  handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - time(nullptr), true).c_str(), muteBy.c_str());
1774 
1775  // Output V. LANG_PINFO_ACC_ACCOUNT
1776  handler->PSendSysMessage(LANG_PINFO_ACC_ACCOUNT, userName.c_str(), accId, security);
1777 
1778  // Output VI. LANG_PINFO_ACC_LASTLOGIN
1779  handler->PSendSysMessage(LANG_PINFO_ACC_LASTLOGIN, lastLogin.c_str(), failedLogins);
1780 
1781  // Output VII. LANG_PINFO_ACC_OS
1782  handler->PSendSysMessage(LANG_PINFO_ACC_OS, OS.c_str(), latency);
1783 
1784  // Output VIII. LANG_PINFO_ACC_REGMAILS
1785  handler->PSendSysMessage(LANG_PINFO_ACC_REGMAILS, regMail.c_str(), eMail.c_str());
1786 
1787  // Output IX. LANG_PINFO_ACC_IP
1788  handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO));
1789 
1790  // Output X. LANG_PINFO_CHR_LEVEL
1791  if (level != sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
1792  handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_LOW, level, xp, xptotal, (xptotal - xp));
1793  else
1794  handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_HIGH, level);
1795 
1796  // Output XI. LANG_PINFO_CHR_RACE
1797  raceStr = GetRaceName(raceid, locale);
1798  classStr = GetClassName(classid, locale);
1799  handler->PSendSysMessage(LANG_PINFO_CHR_RACE, (gender == 0 ? handler->GetTrinityString(LANG_CHARACTER_GENDER_MALE) : handler->GetTrinityString(LANG_CHARACTER_GENDER_FEMALE)), raceStr.c_str(), classStr.c_str());
1800 
1801  // Output XII. LANG_PINFO_CHR_ALIVE
1802  handler->PSendSysMessage(LANG_PINFO_CHR_ALIVE, alive.c_str());
1803 
1804  // Output XIII. LANG_PINFO_CHR_PHASE if player is not in GM mode (GM is in every phase)
1805  if (target && !target->IsGameMaster()) // IsInWorld() returns false on loadingscreen, so it's more
1806  handler->PSendSysMessage(LANG_PINFO_CHR_PHASE, phase); // precise than just target (safer ?).
1807  // However, as we usually just require a target here, we use target instead.
1808  // Output XIV. LANG_PINFO_CHR_MONEY
1809  uint32 gold = money / GOLD;
1810  uint32 silv = (money % GOLD) / SILVER;
1811  uint32 copp = (money % GOLD) % SILVER;
1812  handler->PSendSysMessage(LANG_PINFO_CHR_MONEY, gold, silv, copp);
1813 
1814  // Position data
1815  MapEntry const* map = sMapStore.LookupEntry(mapId);
1816  AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
1817  if (area)
1818  {
1819  areaName = area->AreaName_lang;
1820 
1821  AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID);
1822  if (zone)
1823  zoneName = zone->AreaName_lang;
1824  }
1825 
1826  if (target)
1828  (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)),
1829  (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
1830 
1831  // Output XVII. - XVIX. if they are not empty
1832  if (!guildName.empty())
1833  {
1834  handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), guildId);
1835  handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank.c_str(), uint32(guildRankId));
1836  if (!note.empty())
1837  handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_NOTE, note.c_str());
1838  if (!officeNote.empty())
1839  handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str());
1840  }
1841 
1842  // Output XX. LANG_PINFO_CHR_PLAYEDTIME
1843  handler->PSendSysMessage(LANG_PINFO_CHR_PLAYEDTIME, (secsToTimeString(totalPlayerTime, true, true)).c_str());
1844 
1845  // Mail Data - an own query, because it may or may not be useful.
1846  // SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
1848  stmt4->setUInt64(0, lowguid);
1849  PreparedQueryResult result6 = CharacterDatabase.Query(stmt4);
1850  if (result6)
1851  {
1852  Field* fields = result6->Fetch();
1853  uint32 readmail = uint32(fields[0].GetDouble());
1854  uint32 totalmail = uint32(fields[1].GetUInt64());
1855 
1856  // Output XXI. LANG_INFO_CHR_MAILS if at least one mail is given
1857  if (totalmail >= 1)
1858  handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, readmail, totalmail);
1859  }
1860 
1861  return true;
1862  }
Definition: DBCStructure.h:37
Definition: Player.h:587
Definition: SharedDefines.h:231
Definition: Language.h:828
uint32 Realm
Definition: Realm.h:53
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
int8_t int8
Definition: Define.h:148
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
uint64 GetUInt64() const
Definition: Field.h:184
Definition: CharacterDatabase.h:382
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
Definition: Util.cpp:109
Definition: Language.h:827
AccountTypes GetSecurity() const
Definition: WorldSession.h:921
Definition: Player.h:521
int64_t int64
Definition: Define.h:145
Realm realm
Definition: World.cpp:3485
Definition: Language.h:1107
Class used to access individual fields of database query result.
Definition: Field.h:56
Definition: LoginDatabase.h:95
Definition: Language.h:832
#define UI64LIT(N)
Definition: Define.h:138
Definition: DBCStructure.h:830
Definition: LoginDatabase.h:86
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: inflate.h:24
Definition: Language.h:820
#define sWorld
Definition: World.h:887
char const * GetRaceName(uint8 race, uint8)
Definition: DBCStores.cpp:587
uint64 LowType
Definition: ObjectGuid.h:199
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: Language.h:831
Definition: PreparedStatement.h:74
char const * GetClassName(uint8 class_, uint8)
Definition: DBCStores.cpp:593
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
Definition: Language.h:833
Definition: Language.h:819
Definition: Language.h:826
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTablefmt)
Definition: Language.h:836
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
Definition: UpdateFields.h:198
uint8 GetUInt8() const
Definition: Field.h:70
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: Language.h:821
Definition: Language.h:815
void EndianConvertReverse(T &)
Definition: ByteConverter.h:49
Definition: Language.h:79
Battlenet::RealmHandle Id
Definition: Realm.h:86
Definition: Language.h:70
Definition: CharacterDatabase.h:383
Definition: Language.h:1101
Definition: Language.h:838
uint32_t uint32
Definition: Define.h:150
AccountTypes
Definition: Common.h:106
Definition: Language.h:823
Definition: LoginDatabase.h:87
Definition: Language.h:817
char * AreaName_lang
Definition: DBCStructure.h:51
uint16 GetUInt16() const
Definition: Field.h:108
Definition: Language.h:1106
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: SharedDefines.h:232
Definition: Language.h:1096
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint32 ParentAreaID
Definition: DBCStructure.h:41
Definition: Language.h:824
int64_t int64
Definition: g3dmath.h:169
Definition: Language.h:822
Definition: Language.h:816
static bool GetPlayerNameByGUID(ObjectGuid const &guid, std::string &name)
Definition: ObjectMgr.cpp:2258
Definition: Language.h:835
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
Definition: Language.h:818
Definition: Language.h:422
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:67
uint32 GetUInt32() const
Definition: Field.h:146
int32_t int32
Definition: g3dmath.h:167
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
WorldSession * GetSession()
Definition: Chat.h:59
uint8_t uint8
Definition: Define.h:152
Definition: Language.h:829
Definition: Language.h:834
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
char * MapName_lang
Definition: DBCStructure.h:838
virtual LocaleConstant GetSessionDbcLocale() const
Definition: Chat.cpp:1062
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
Definition: CharacterDatabase.h:385
Definition: Language.h:421
Definition: Language.h:830
Definition: CharacterDatabase.h:107
std::string GetString() const
Definition: Field.h:276
Definition: Language.h:78
Definition: World.h:235
virtual bool HasPermission(uint32 permission) const
Definition: Chat.h:100
std::string ToString() const
Definition: ObjectGuid.cpp:99
std::string playerLink(std::string const &name) const
Definition: Chat.h:132
Definition: CharacterDatabase.h:384
Definition: Language.h:839
LowType GetCounter() const
Definition: ObjectGuid.h:221
Definition: Language.h:825

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool misc_commandscript::HandlePlayAllCommand ( ChatHandler handler,
char const args 
)
inlinestatic
2605  {
2606  if (!*args)
2607  return false;
2608 
2609  uint32 soundId = atoi((char*)args);
2610 
2611  if (!sSoundEntriesStore.LookupEntry(soundId))
2612  {
2613  handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
2614  handler->SetSentErrorMessage(true);
2615  return false;
2616  }
2617 
2618  sWorld->SendGlobalMessage(WorldPackets::Misc::PlaySound(handler->GetSession()->GetPlayer()->GetGUID(), soundId).Write());
2619 
2620  handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
2621  return true;
2622  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sWorld
Definition: World.h:887
uint32_t uint32
Definition: Define.h:150
Definition: Language.h:1074
Definition: MiscPackets.h:601
Definition: Language.h:202
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
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 misc_commandscript::HandlePossessCommand ( ChatHandler handler,
char const  
)
inlinestatic
2625  {
2626