TrinityCore
cs_misc.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "AccountMgr.h"
20#include "ArenaTeamMgr.h"
21#include "CellImpl.h"
22#include "CharacterCache.h"
23#include "Chat.h"
24#include "ChatCommand.h"
25#include "DatabaseEnv.h"
26#include "DB2Stores.h"
27#include "DisableMgr.h"
28#include "GridNotifiers.h"
29#include "Group.h"
30#include "IpAddress.h"
31#include "IPLocation.h"
32#include "Item.h"
33#include "ItemBonusMgr.h"
34#include "Language.h"
35#include "MiscPackets.h"
36#include "MMapFactory.h"
37#include "MotionMaster.h"
38#include "MovementDefines.h"
39#include "ObjectAccessor.h"
40#include "ObjectMgr.h"
41#include "PhasingHandler.h"
42#include "Player.h"
43#include "Realm.h"
44#include "SpellAuras.h"
45#include "SpellHistory.h"
46#include "SpellMgr.h"
47#include "TerrainMgr.h"
48#include "Transport.h"
49#include "Weather.h"
50#include "World.h"
51#include "WorldSession.h"
52
53// temporary hack until includes are sorted out (don't want to pull in Windows.h)
54#ifdef GetClassName
55#undef GetClassName
56#endif
57
58#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
59#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
60#endif
61
62using namespace Trinity::ChatCommands;
63
65{
66public:
67 misc_commandscript() : CommandScript("misc_commandscript") { }
68
70 {
71 static ChatCommandTable commandTable =
72 {
73 { "additem", HandleAddItemCommand, rbac::RBAC_PERM_COMMAND_ADDITEM, Console::No },
74 { "additem to", HandleAddItemToCommand, rbac::RBAC_PERM_COMMAND_ADDITEM, Console::No },
75 { "additem set", HandleAddItemSetCommand, rbac::RBAC_PERM_COMMAND_ADDITEMSET, Console::No },
76 { "appear", HandleAppearCommand, rbac::RBAC_PERM_COMMAND_APPEAR, Console::No },
77 { "aura", HandleAuraCommand, rbac::RBAC_PERM_COMMAND_AURA, Console::No },
78 { "bank", HandleBankCommand, rbac::RBAC_PERM_COMMAND_BANK, Console::No },
79 { "bindsight", HandleBindSightCommand, rbac::RBAC_PERM_COMMAND_BINDSIGHT, Console::No },
80 { "combatstop", HandleCombatStopCommand, rbac::RBAC_PERM_COMMAND_COMBATSTOP, Console::Yes },
81 { "cometome", HandleComeToMeCommand, rbac::RBAC_PERM_COMMAND_COMETOME, Console::No },
82 { "commands", HandleCommandsCommand, rbac::RBAC_PERM_COMMAND_COMMANDS, Console::Yes },
83 { "cooldown", HandleCooldownCommand, rbac::RBAC_PERM_COMMAND_COOLDOWN, Console::No },
84 { "damage", HandleDamageCommand, rbac::RBAC_PERM_COMMAND_DAMAGE, Console::No },
85 { "damage go", HandleDamageGoCommand, rbac::RBAC_PERM_COMMAND_DAMAGE, Console::No },
86 { "dev", HandleDevCommand, rbac::RBAC_PERM_COMMAND_DEV, Console::No },
87 { "die", HandleDieCommand, rbac::RBAC_PERM_COMMAND_DIE, Console::No },
88 { "dismount", HandleDismountCommand, rbac::RBAC_PERM_COMMAND_DISMOUNT, Console::No },
90 { "freeze", HandleFreezeCommand, rbac::RBAC_PERM_COMMAND_FREEZE, Console::No },
91 { "gps", HandleGPSCommand, rbac::RBAC_PERM_COMMAND_GPS, Console::No },
92 { "guid", HandleGUIDCommand, rbac::RBAC_PERM_COMMAND_GUID, Console::No },
93 { "help", HandleHelpCommand, rbac::RBAC_PERM_COMMAND_HELP, Console::Yes },
94 { "hidearea", HandleHideAreaCommand, rbac::RBAC_PERM_COMMAND_HIDEAREA, Console::No },
95 { "itemmove", HandleItemMoveCommand, rbac::RBAC_PERM_COMMAND_ITEMMOVE, Console::No },
97 { "linkgrave", HandleLinkGraveCommand, rbac::RBAC_PERM_COMMAND_LINKGRAVE, Console::No },
98 { "listfreeze", HandleListFreezeCommand, rbac::RBAC_PERM_COMMAND_LISTFREEZE, Console::No },
99 { "movegens", HandleMovegensCommand, rbac::RBAC_PERM_COMMAND_MOVEGENS, Console::No },
100 { "mute", HandleMuteCommand, rbac::RBAC_PERM_COMMAND_MUTE, Console::Yes },
101 { "mutehistory", HandleMuteHistoryCommand, rbac::RBAC_PERM_COMMAND_MUTEHISTORY, Console::Yes },
102 { "neargrave", HandleNearGraveCommand, rbac::RBAC_PERM_COMMAND_NEARGRAVE, Console::No },
103 { "pinfo", HandlePInfoCommand, rbac::RBAC_PERM_COMMAND_PINFO, Console::Yes },
104 { "playall", HandlePlayAllCommand, rbac::RBAC_PERM_COMMAND_PLAYALL, Console::No },
105 { "possess", HandlePossessCommand, rbac::RBAC_PERM_COMMAND_POSSESS, Console::No },
106 { "pvpstats", HandlePvPstatsCommand, rbac::RBAC_PERM_COMMAND_PVPSTATS, Console::Yes },
107 { "recall", HandleRecallCommand, rbac::RBAC_PERM_COMMAND_RECALL, Console::No },
108 { "repairitems", HandleRepairitemsCommand, rbac::RBAC_PERM_COMMAND_REPAIRITEMS, Console::Yes },
109 { "respawn", HandleRespawnCommand, rbac::RBAC_PERM_COMMAND_RESPAWN, Console::No },
110 { "revive", HandleReviveCommand, rbac::RBAC_PERM_COMMAND_REVIVE, Console::Yes },
111 { "saveall", HandleSaveAllCommand, rbac::RBAC_PERM_COMMAND_SAVEALL, Console::Yes },
112 { "save", HandleSaveCommand, rbac::RBAC_PERM_COMMAND_SAVE, Console::No },
113 { "setskill", HandleSetSkillCommand, rbac::RBAC_PERM_COMMAND_SETSKILL, Console::No },
114 { "showarea", HandleShowAreaCommand, rbac::RBAC_PERM_COMMAND_SHOWAREA, Console::No },
115 { "summon", HandleSummonCommand, rbac::RBAC_PERM_COMMAND_SUMMON, Console::No },
116 { "unaura", HandleUnAuraCommand, rbac::RBAC_PERM_COMMAND_UNAURA, Console::No },
117 { "unbindsight", HandleUnbindSightCommand, rbac::RBAC_PERM_COMMAND_UNBINDSIGHT, Console::No },
118 { "unfreeze", HandleUnFreezeCommand, rbac::RBAC_PERM_COMMAND_UNFREEZE, Console::No },
119 { "unmute", HandleUnmuteCommand, rbac::RBAC_PERM_COMMAND_UNMUTE, Console::Yes },
120 { "unpossess", HandleUnPossessCommand, rbac::RBAC_PERM_COMMAND_UNPOSSESS, Console::No },
121 { "unstuck", HandleUnstuckCommand, rbac::RBAC_PERM_COMMAND_UNSTUCK, Console::Yes },
122 { "wchange", HandleChangeWeather, rbac::RBAC_PERM_COMMAND_WCHANGE, Console::No },
123 { "mailbox", HandleMailBoxCommand, rbac::RBAC_PERM_COMMAND_MAILBOX, Console::No },
124 };
125 return commandTable;
126 }
127
128 static bool HandlePvPstatsCommand(ChatHandler* handler)
129 {
131 {
133 PreparedQueryResult result = CharacterDatabase.Query(stmt);
134
135 if (result)
136 {
137 Field* fields = result->Fetch();
138 uint32 horde_victories = fields[1].GetUInt32();
139
140 if (!(result->NextRow()))
141 return false;
142
143 fields = result->Fetch();
144 uint32 alliance_victories = fields[1].GetUInt32();
145
146 handler->PSendSysMessage(LANG_PVPSTATS, alliance_victories, horde_victories);
147 }
148 else
149 return false;
150 }
151 else
153
154 return true;
155 }
156
157 static bool HandleDevCommand(ChatHandler* handler, Optional<bool> enableArg)
158 {
159 Player* player = handler->GetSession()->GetPlayer();
160
161 if (!enableArg)
162 {
164 return true;
165 }
166
167 if (*enableArg)
168 {
169 player->SetDeveloper(true);
171 }
172 else
173 {
174 player->SetDeveloper(false);
176 }
177
178 return true;
179 }
180
181 static bool HandleGPSCommand(ChatHandler* handler, char const* args)
182 {
183 WorldObject* object = nullptr;
184 if (*args)
185 {
186 HighGuid guidHigh;
187 ObjectGuid::LowType guidLow = handler->extractLowGuidFromLink((char*)args, guidHigh);
188 if (!guidLow)
189 return false;
190 switch (guidHigh)
191 {
192 case HighGuid::Player:
193 {
194 object = ObjectAccessor::FindConnectedPlayer(ObjectGuid::Create<HighGuid::Player>(guidLow));
195 if (!object)
196 {
198 handler->SetSentErrorMessage(true);
199 }
200 break;
201 }
203 {
204 object = handler->GetCreatureFromPlayerMapByDbGuid(guidLow);
205 if (!object)
206 {
208 handler->SetSentErrorMessage(true);
209 }
210 break;
211 }
213 {
214 object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
215 if (!object)
216 {
218 handler->SetSentErrorMessage(true);
219 }
220 break;
221 }
222 default:
223 return false;
224 }
225 if (!object)
226 return false;
227 }
228 else
229 {
230 object = handler->getSelectedUnit();
231
232 if (!object)
233 {
235 handler->SetSentErrorMessage(true);
236 return false;
237 }
238 }
239
240 CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
241 Cell cell(cellCoord);
242
243 uint32 zoneId, areaId;
244 object->GetZoneAndAreaId(zoneId, areaId);
245 uint32 mapId = object->GetMapId();
246
247 MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
248 AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
249 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
250
251 float zoneX = object->GetPositionX();
252 float zoneY = object->GetPositionY();
253
254 sDB2Manager.Map2ZoneCoordinates(zoneId, zoneX, zoneY);
255
256 Map* map = object->GetMap();
257 float groundZ = object->GetMapHeight(object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
258 float floorZ = object->GetMapHeight(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
259
260 GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
261
262 int gridX = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord;
263 int gridY = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord;
264
265 uint32 haveMap = TerrainInfo::ExistMap(mapId, gridX, gridY) ? 1 : 0;
266 uint32 haveVMap = TerrainInfo::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
268
269 if (haveVMap)
270 {
271 if (object->IsOutdoors())
273 else
275 }
276 else
278
279 char const* unknown = handler->GetTrinityString(LANG_UNKNOWN);
280
282 mapId, (mapEntry ? mapEntry->MapName[handler->GetSessionDbcLocale()] : unknown),
283 zoneId, (zoneEntry ? zoneEntry->AreaName[handler->GetSessionDbcLocale()] : unknown),
284 areaId, (areaEntry ? areaEntry->AreaName[handler->GetSessionDbcLocale()] : unknown),
285 object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation());
286 if (Transport* transport = dynamic_cast<Transport*>(object->GetTransport()))
288 transport->GetGOInfo()->moTransport.SpawnMap, object->GetTransOffsetX(), object->GetTransOffsetY(), object->GetTransOffsetZ(), object->GetTransOffsetO(),
289 transport->GetEntry(), transport->GetName().c_str());
291 cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
292 zoneX, zoneY, groundZ, floorZ, map->GetMinHeight(object->GetPhaseShift(), object->GetPositionX(), object->GetPositionY()), haveMap, haveVMap, haveMMap);
293
294 LiquidData liquidStatus;
295 ZLiquidStatus status = map->GetLiquidStatus(object->GetPhaseShift(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), {}, &liquidStatus);
296 if (status)
297 handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, uint32(liquidStatus.type_flags.AsUnderlyingType()), status);
298
299 PhasingHandler::PrintToChat(handler, object);
300
301 return true;
302 }
303
304 static bool HandleAuraCommand(ChatHandler* handler, SpellInfo const* spell)
305 {
306 Unit* target = handler->getSelectedUnit();
307 if (!target)
308 {
310 handler->SetSentErrorMessage(true);
311 return false;
312 }
313
314 if(!spell)
315 return false;
316
317 ObjectGuid castId = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, target->GetMapId(), spell->Id, target->GetMap()->GenerateLowGuid<HighGuid::Cast>());
318 AuraCreateInfo createInfo(castId, spell, target->GetMap()->GetDifficultyID(), MAX_EFFECT_MASK, target);
319 createInfo.SetCaster(target);
320
322
323 return true;
324 }
325
326 static bool HandleUnAuraCommand(ChatHandler* handler, Variant<SpellInfo const*, EXACT_SEQUENCE("all")> spellArg)
327 {
328 Unit* target = handler->getSelectedUnit();
329 if (!target)
330 {
332 handler->SetSentErrorMessage(true);
333 return false;
334 }
335
336 if (spellArg.holds_alternative<EXACT_SEQUENCE("all")>())
337 {
338 target->RemoveAllAuras();
339 return true;
340 }
341
342 if (SpellInfo const* spellInfo = spellArg.get<SpellInfo const*>())
343 {
344 target->RemoveAurasDueToSpell(spellInfo->Id);
345 return true;
346 }
347
348 return false;
349 }
350
351 // Teleport to Player
352 static bool HandleAppearCommand(ChatHandler* handler, char const* args)
353 {
354 Player* target;
355 ObjectGuid targetGuid;
356 std::string targetName;
357 if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
358 return false;
359
360 Player* _player = handler->GetSession()->GetPlayer();
361 if (target == _player || targetGuid == _player->GetGUID())
362 {
364 handler->SetSentErrorMessage(true);
365 return false;
366 }
367
368 if (target)
369 {
370 // check online security
371 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
372 return false;
373
374 std::string chrNameLink = handler->playerLink(targetName);
375
376 Map* map = target->GetMap();
377 if (map->IsBattlegroundOrArena())
378 {
379 // only allow if gm mode is on
380 if (!_player->IsGameMaster())
381 {
382 handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
383 handler->SetSentErrorMessage(true);
384 return false;
385 }
386 // if both players are in different bgs
387 else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
388 _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
389
390 // all's well, set bg id
391 // when porting out from the bg, it will be reset to 0
393 // remember current position as entry point for return at bg end teleportation
394 if (!_player->GetMap()->IsBattlegroundOrArena())
395 _player->SetBattlegroundEntryPoint();
396 }
397 else if (map->IsDungeon())
398 {
399 // we have to go to instance, and can go to player only if:
400 // 1) we are in his group (either as leader or as member)
401 // 2) we are not bound to any group and have GM mode on
402 if (_player->GetGroup())
403 {
404 // we are in group, we can go only if we are in the player group
405 if (_player->GetGroup() != target->GetGroup())
406 {
407 handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
408 handler->SetSentErrorMessage(true);
409 return false;
410 }
411 }
412 else
413 {
414 // we are not in group, let's verify our GM mode
415 if (!_player->IsGameMaster())
416 {
417 handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
418 handler->SetSentErrorMessage(true);
419 return false;
420 }
421 }
422
423 if (map->IsRaid())
424 {
425 _player->SetRaidDifficultyID(target->GetRaidDifficultyID());
427 }
428 else
430 }
431
432 handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
433
434 // stop flight if need
435 if (_player->IsInFlight())
436 _player->FinishTaxiFlight();
437 else
438 _player->SaveRecallPosition(); // save only in non-flight case
439
440 // to point to see at target with same orientation
441 float x, y, z;
442 target->GetClosePoint(x, y, z, _player->GetCombatReach(), 1.0f);
443
444 _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAbsoluteAngle(target), TELE_TO_GM_MODE, target->GetInstanceId());
445 PhasingHandler::InheritPhaseShift(_player, target);
446 _player->UpdateObjectVisibility();
447 }
448 else
449 {
450 // check offline security
451 if (handler->HasLowerSecurity(nullptr, targetGuid))
452 return false;
453
454 std::string nameLink = handler->playerLink(targetName);
455
456 handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
457
458 // to point where player stay (if loaded)
459 float x, y, z, o;
460 uint32 map;
461 bool in_flight;
462 if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))
463 return false;
464
465 // stop flight if need
466 if (_player->IsInFlight())
467 _player->FinishTaxiFlight();
468 else
469 _player->SaveRecallPosition(); // save only in non-flight case
470
471 _player->TeleportTo(map, x, y, z, _player->GetOrientation());
472 }
473
474 return true;
475 }
476
477 // Summon Player
478 static bool HandleSummonCommand(ChatHandler* handler, char const* args)
479 {
480 Player* target;
481 ObjectGuid targetGuid;
482 std::string targetName;
483 if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
484 return false;
485
486 Player* _player = handler->GetSession()->GetPlayer();
487 if (target == _player || targetGuid == _player->GetGUID())
488 {
490 handler->SetSentErrorMessage(true);
491 return false;
492 }
493
494 if (target)
495 {
496 std::string nameLink = handler->playerLink(targetName);
497 // check online security
498 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
499 return false;
500
501 if (target->IsBeingTeleported())
502 {
503 handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
504 handler->SetSentErrorMessage(true);
505 return false;
506 }
507
508 Map* map = _player->GetMap();
509
510 if (map->IsBattlegroundOrArena())
511 {
512 // only allow if gm mode is on
513 if (!_player->IsGameMaster())
514 {
515 handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
516 handler->SetSentErrorMessage(true);
517 return false;
518 }
519 // if both players are in different bgs
520 else if (target->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
521 target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
522
523 // all's well, set bg id
524 // when porting out from the bg, it will be reset to 0
525 target->SetBattlegroundId(_player->GetBattlegroundId(), _player->GetBattlegroundTypeId(), BATTLEGROUND_QUEUE_NONE); // unsure about this
526 // remember current position as entry point for return at bg end teleportation
527 if (!target->GetMap()->IsBattlegroundOrArena())
529 }
530 else if (map->IsDungeon())
531 {
532 Map* targetMap = target->GetMap();
533 Player* targetGroupLeader = nullptr;
534 if (Group* targetGroup = target->GetGroup())
535 targetGroupLeader = ObjectAccessor::GetPlayer(map, targetGroup->GetLeaderGUID());
536
537 // check if far teleport is allowed
538 if (!targetGroupLeader || (targetGroupLeader->GetMapId() != map->GetId()) || (targetGroupLeader->GetInstanceId() != map->GetInstanceId()))
539 if ((targetMap->GetId() != map->GetId()) || (targetMap->GetInstanceId() != map->GetInstanceId()))
540 {
542 handler->SetSentErrorMessage(true);
543 return false;
544 }
545
546 // check if we're already in a different instance of the same map
547 if ((targetMap->GetId() == map->GetId()) && (targetMap->GetInstanceId() != map->GetInstanceId()))
548 {
549 handler->PSendSysMessage(LANG_CANNOT_SUMMON_INST_INST, nameLink.c_str());
550 handler->SetSentErrorMessage(true);
551 return false;
552 }
553 }
554
555 handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
556 if (handler->needReportToTarget(target))
557 ChatHandler(target->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str());
558
559 // stop flight if need
560 if (_player->IsInFlight())
561 _player->FinishTaxiFlight();
562 else
563 _player->SaveRecallPosition(); // save only in non-flight case
564
565 // before GM
566 float x, y, z;
567 _player->GetClosePoint(x, y, z, target->GetCombatReach());
568 target->TeleportTo(_player->GetMapId(), x, y, z, target->GetOrientation(), TELE_TO_NONE, map->GetInstanceId());
569 PhasingHandler::InheritPhaseShift(target, _player);
570 target->UpdateObjectVisibility();
571 }
572 else
573 {
574 // check offline security
575 if (handler->HasLowerSecurity(nullptr, targetGuid))
576 return false;
577
578 std::string nameLink = handler->playerLink(targetName);
579
580 handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE));
581
582 // in point where GM stay
584 _player->GetPositionX(),
585 _player->GetPositionY(),
586 _player->GetPositionZ(),
587 _player->GetOrientation()),
588 _player->GetZoneId(),
589 targetGuid, nullptr);
590 }
591
592 return true;
593 }
594
595 static bool HandleCommandsCommand(ChatHandler* handler)
596 {
598 return true;
599 }
600
601 static bool HandleDieCommand(ChatHandler* handler)
602 {
603 Unit* target = handler->getSelectedUnit();
604
605 if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
606 {
608 handler->SetSentErrorMessage(true);
609 return false;
610 }
611
612 if (Player* player = target->ToPlayer())
613 if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false))
614 return false;
615
616 if (target->IsAlive())
617 {
618 if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
619 Unit::Kill(handler->GetSession()->GetPlayer(), target);
620 else
621 Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
622 }
623
624 return true;
625 }
626
627 static bool HandleReviveCommand(ChatHandler* handler, char const* args)
628 {
629 Player* target;
630 ObjectGuid targetGuid;
631 if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
632 return false;
633
634 if (target)
635 {
637 target->SpawnCorpseBones();
638 target->SaveToDB();
639 }
640 else
641 {
642 CharacterDatabaseTransaction trans(nullptr);
643 Player::OfflineResurrect(targetGuid, trans);
644 }
645
646 return true;
647 }
648
649 static bool HandleDismountCommand(ChatHandler* handler)
650 {
651 Player* player = handler->getSelectedPlayerOrSelf();
652
653 // If player is not mounted, so go out :)
654 if (!player->IsMounted())
655 {
657 handler->SetSentErrorMessage(true);
658 return false;
659 }
660
661 if (player->IsInFlight())
662 {
664 handler->SetSentErrorMessage(true);
665 return false;
666 }
667
668 player->Dismount();
670 return true;
671 }
672
673 static bool HandleGUIDCommand(ChatHandler* handler)
674 {
675 ObjectGuid guid = handler->GetSession()->GetPlayer()->GetTarget();
676
677 if (guid.IsEmpty())
678 {
680 handler->SetSentErrorMessage(true);
681 return false;
682 }
683
684 handler->PSendSysMessage(LANG_OBJECT_GUID, guid.ToString().c_str());
685 return true;
686 }
687
688 static bool HandleHelpCommand(ChatHandler* handler, Tail cmd)
689 {
691 if (cmd.empty())
693 return true;
694 }
695
696 // move item to other slot
697 static bool HandleItemMoveCommand(ChatHandler* handler, uint8 srcSlot, uint8 dstSlot)
698 {
699 if (srcSlot == dstSlot)
700 return true;
701
702 if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
703 return false;
704
705 if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
706 return false;
707
708 uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
709 uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
710
711 handler->GetSession()->GetPlayer()->SwapItem(src, dst);
712
713 return true;
714 }
715
717 {
718 Unit* target = handler->getSelectedUnit();
719 if (!target)
720 {
722 handler->SetSentErrorMessage(true);
723 return false;
724 }
725
727 if (!owner)
728 {
729 owner = handler->GetSession()->GetPlayer();
730 target = owner;
731 }
732
733 std::string nameLink = handler->GetNameLink(owner);
734
735 if (!spellArg)
736 {
738 target->GetSpellHistory()->ResetAllCharges();
739 handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
740 }
741 else
742 {
743 if (!*spellArg)
744 {
745 handler->PSendSysMessage(LANG_UNKNOWN_SPELL, owner == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
746 handler->SetSentErrorMessage(true);
747 return false;
748 }
749
750 target->GetSpellHistory()->ResetCooldown((*spellArg)->Id, true);
751 target->GetSpellHistory()->ResetCharges((*spellArg)->ChargeCategoryId);
752 handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, (*spellArg)->Id, owner == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
753 }
754 return true;
755 }
756
757 static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args)
758 {
759 WorldObject* object = nullptr;
760 if (*args)
761 {
762 HighGuid guidHigh;
763 ObjectGuid::LowType guidLow = handler->extractLowGuidFromLink((char*)args, guidHigh);
764 if (!guidLow)
765 return false;
766 switch (guidHigh)
767 {
768 case HighGuid::Player:
769 {
770 object = ObjectAccessor::GetPlayer(*handler->GetSession()->GetPlayer(), ObjectGuid::Create<HighGuid::Player>(guidLow));
771 if (!object)
772 {
774 handler->SetSentErrorMessage(true);
775 }
776 break;
777 }
779 {
780 object = handler->GetCreatureFromPlayerMapByDbGuid(guidLow);
781 if (!object)
782 {
784 handler->SetSentErrorMessage(true);
785 }
786 break;
787 }
789 {
790 object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
791 if (!object)
792 {
794 handler->SetSentErrorMessage(true);
795 }
796 break;
797 }
798 default:
799 return false;
800 }
801 if (!object)
802 return false;
803 }
804 else
805 {
806 object = handler->getSelectedUnit();
807 if (!object)
808 {
810 handler->SetSentErrorMessage(true);
811 return false;
812 }
813 }
814
815 handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(object), handler->GetSession()->GetPlayer()->GetDistance2d(object), handler->GetSession()->GetPlayer()->GetExactDist(object), handler->GetSession()->GetPlayer()->GetExactDist2d(object));
816 return true;
817 }
818
819 // Teleport player to last position
820 static bool HandleRecallCommand(ChatHandler* handler, char const* args)
821 {
822 Player* target;
823 if (!handler->extractPlayerTarget((char*)args, &target))
824 return false;
825
826 // check online security
827 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
828 return false;
829
830 if (target->IsBeingTeleported())
831 {
832 handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str());
833 handler->SetSentErrorMessage(true);
834 return false;
835 }
836
837 target->FinishTaxiFlight();
838
839 target->Recall();
840 return true;
841 }
842
843 static bool HandleSaveCommand(ChatHandler* handler)
844 {
845 Player* player = handler->GetSession()->GetPlayer();
846
847 // save GM account without delay and output message
849 {
850 if (Player* target = handler->getSelectedPlayer())
851 target->SaveToDB();
852 else
853 player->SaveToDB();
855 return true;
856 }
857
858 // save if the player has last been saved over 20 seconds ago
859 uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
860 if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
861 player->SaveToDB();
862
863 return true;
864 }
865
866 // Save all players in the world
867 static bool HandleSaveAllCommand(ChatHandler* handler)
868 {
871 return true;
872 }
873
874 // kick player
875 static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)
876 {
877 Player* target = nullptr;
878 std::string playerName;
879 if (!handler->extractPlayerTarget((char*)args, &target, nullptr, &playerName))
880 return false;
881
882 if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
883 {
885 handler->SetSentErrorMessage(true);
886 return false;
887 }
888
889 // check online security
890 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
891 return false;
892
893 std::string kickReasonStr = handler->GetTrinityString(LANG_NO_REASON);
894 if (*args != '\0')
895 {
896 char const* kickReason = strtok(nullptr, "\r");
897 if (kickReason != nullptr)
898 kickReasonStr = kickReason;
899 }
900
901 if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
902 sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), playerName.c_str(), kickReasonStr.c_str());
903 else
904 handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
905
906 target->GetSession()->KickPlayer("HandleKickPlayerCommand GM Command");
907
908 return true;
909 }
910
911 static bool HandleUnstuckCommand(ChatHandler* handler, char const* args)
912 {
913#define SPELL_UNSTUCK_ID 7355
914#define SPELL_UNSTUCK_VISUAL 2683
915
916 // No args required for players
918 {
919 // 7355: "Stuck"
920 if (Player* player = handler->GetSession()->GetPlayer())
921 player->CastSpell(player, SPELL_UNSTUCK_ID, false);
922 return true;
923 }
924
925 if (!*args)
926 return false;
927
928 char* player_str = strtok((char*)args, " ");
929 if (!player_str)
930 return false;
931
932 std::string location_str = "inn";
933 if (char const* loc = strtok(nullptr, " "))
934 location_str = loc;
935
936 Player* player = nullptr;
937 ObjectGuid targetGUID;
938 if (!handler->extractPlayerTarget(player_str, &player, &targetGUID))
939 return false;
940
941 if (!player)
942 {
944 stmt->setUInt64(0, targetGUID.GetCounter());
945 PreparedQueryResult result = CharacterDatabase.Query(stmt);
946 if (result)
947 {
948 Field* fields = result->Fetch();
949
951 Player::SavePositionInDB(WorldLocation(fields[0].GetUInt16(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat(), 0.0f), fields[1].GetUInt16(), targetGUID, dummy);
952 return true;
953 }
954
955 return false;
956 }
957
958 if (player->IsInFlight() || player->IsInCombat())
959 {
960 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_UNSTUCK_ID, DIFFICULTY_NONE);
961 if (!spellInfo)
962 return false;
963
964 if (Player* caster = handler->GetSession()->GetPlayer())
965 {
966 ObjectGuid castId = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, player->GetMapId(), SPELL_UNSTUCK_ID, player->GetMap()->GenerateLowGuid<HighGuid::Cast>());
968 }
969
970 return false;
971 }
972
973 if (location_str == "inn")
974 {
975 player->TeleportTo(player->m_homebind);
976 return true;
977 }
978
979 if (location_str == "graveyard")
980 {
981 player->RepopAtGraveyard();
982 return true;
983 }
984
985 //Not a supported argument
986 return false;
987
988 }
989
990 static bool HandleLinkGraveCommand(ChatHandler* handler, uint32 graveyardId, Optional<std::string> teamArg)
991 {
992 uint32 team;
993
994 if (!teamArg)
995 team = 0;
996 else if (StringEqualI(*teamArg, "horde"))
997 team = HORDE;
998 else if (StringEqualI(*teamArg, "alliance"))
999 team = ALLIANCE;
1000 else
1001 return false;
1002
1003 WorldSafeLocsEntry const* graveyard = sObjectMgr->GetWorldSafeLoc(graveyardId);
1004
1005 if (!graveyard)
1006 {
1007 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
1008 handler->SetSentErrorMessage(true);
1009 return false;
1010 }
1011
1012 Player* player = handler->GetSession()->GetPlayer();
1013
1014 uint32 zoneId = player->GetZoneId();
1015
1016 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId);
1017 if (!areaEntry || areaEntry->GetFlags().HasFlag(AreaFlags::IsSubzone))
1018 {
1019 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
1020 handler->SetSentErrorMessage(true);
1021 return false;
1022 }
1023
1024 if (sObjectMgr->AddGraveyardLink(graveyardId, zoneId, team, true))
1025 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
1026 else
1027 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
1028
1029 return true;
1030 }
1031
1033 {
1034 uint32 team;
1035
1036 if (!teamArg)
1037 team = 0;
1038 else if (StringEqualI(*teamArg, "horde"))
1039 team = HORDE;
1040 else if (StringEqualI(*teamArg, "alliance"))
1041 team = ALLIANCE;
1042 else
1043 return false;
1044
1045 Player* player = handler->GetSession()->GetPlayer();
1046 uint32 zone_id = player->GetZoneId();
1047
1048 WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveyard(*player, team, nullptr);
1049 if (graveyard)
1050 {
1051 uint32 graveyardId = graveyard->ID;
1052
1053 GraveyardData const* data = sObjectMgr->FindGraveyardData(graveyardId, zone_id);
1054 if (!data)
1055 {
1056 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
1057 handler->SetSentErrorMessage(true);
1058 return false;
1059 }
1060
1061 std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
1062
1063 if (team == 0)
1064 team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
1065 else if (team == HORDE)
1066 team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
1067 else if (team == ALLIANCE)
1069
1070 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
1071 }
1072 else
1073 {
1074 std::string team_name;
1075
1076 if (team == HORDE)
1077 team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
1078 else if (team == ALLIANCE)
1080
1081 if (!team)
1083 else
1084 handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
1085 }
1086
1087 return true;
1088 }
1089
1090 static bool HandleShowAreaCommand(ChatHandler* handler, uint32 areaId)
1091 {
1092 Player* playerTarget = handler->getSelectedPlayer();
1093 if (!playerTarget)
1094 {
1096 handler->SetSentErrorMessage(true);
1097 return false;
1098 }
1099
1100 AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
1101 if (!area)
1102 {
1104 handler->SetSentErrorMessage(true);
1105 return false;
1106 }
1107
1108 if (area->AreaBit < 0)
1109 {
1111 handler->SetSentErrorMessage(true);
1112 return false;
1113 }
1114
1115 uint32 offset = area->AreaBit / PLAYER_EXPLORED_ZONES_BITS;
1116 uint64 val = UI64LIT(1) << (area->AreaBit % PLAYER_EXPLORED_ZONES_BITS);
1117 playerTarget->AddExploredZones(offset, val);
1118
1120 return true;
1121 }
1122
1123 static bool HandleHideAreaCommand(ChatHandler* handler, uint32 areaId)
1124 {
1125 Player* playerTarget = handler->getSelectedPlayer();
1126 if (!playerTarget)
1127 {
1129 handler->SetSentErrorMessage(true);
1130 return false;
1131 }
1132
1133 AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
1134 if (!area)
1135 {
1137 handler->SetSentErrorMessage(true);
1138 return false;
1139 }
1140
1141 if (area->AreaBit < 0)
1142 {
1144 handler->SetSentErrorMessage(true);
1145 return false;
1146 }
1147
1148 uint32 offset = area->AreaBit / PLAYER_EXPLORED_ZONES_BITS;
1149 uint64 val = UI64LIT(1) << (area->AreaBit % PLAYER_EXPLORED_ZONES_BITS);
1150 playerTarget->RemoveExploredZones(offset, val);
1151
1153 return true;
1154 }
1155
1156 static bool HandleAddItemCommand(ChatHandler* handler, char const* args)
1157 {
1158 if (!*args)
1159 return false;
1160
1161 uint32 itemId = 0;
1162
1163 if (args[0] == '[') // [name] manual form
1164 {
1165 char const* itemNameStr = strtok((char*)args, "]");
1166
1167 if (itemNameStr && itemNameStr[0])
1168 {
1169 std::string itemName = itemNameStr+1;
1170 auto itr = std::find_if(sItemSparseStore.begin(), sItemSparseStore.end(), [&itemName](ItemSparseEntry const* sparse)
1171 {
1172 for (LocaleConstant i = LOCALE_enUS; i < TOTAL_LOCALES; i = LocaleConstant(i + 1))
1173 if (itemName == sparse->Display[i])
1174 return true;
1175 return false;
1176 });
1177
1178 if (itr == sItemSparseStore.end())
1179 {
1180 handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
1181 handler->SetSentErrorMessage(true);
1182 return false;
1183 }
1184
1185 itemId = itr->ID;
1186 }
1187 else
1188 return false;
1189 }
1190 else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
1191 {
1192 char const* id = handler->extractKeyFromLink((char*)args, "Hitem");
1193 if (!id)
1194 return false;
1195
1196 itemId = Trinity::StringTo<uint32>(id).value_or(0);
1197 }
1198
1199 char const* ccount = strtok(nullptr, " ");
1200
1201 int32 count = 1;
1202
1203 if (ccount)
1204 count = strtol(ccount, nullptr, 10);
1205
1206 if (count == 0)
1207 count = 1;
1208
1209 std::vector<int32> bonusListIDs;
1210 char const* bonuses = strtok(nullptr, " ");
1211
1212 char const* context = strtok(nullptr, " ");
1213
1214 // semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
1215 if (bonuses)
1216 for (std::string_view token : Trinity::Tokenize(bonuses, ';', false))
1217 if (Optional<int32> bonusListId = Trinity::StringTo<int32>(token); bonusListId && *bonusListId)
1218 bonusListIDs.push_back(*bonusListId);
1219
1220 ItemContext itemContext = ItemContext::NONE;
1221 if (context)
1222 {
1223 itemContext = ItemContext(Trinity::StringTo<uint8>(context).value_or(0));
1224 if (itemContext < ItemContext::Max)
1225 {
1226 std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemId, itemContext);
1227 bonusListIDs.insert(bonusListIDs.begin(), contextBonuses.begin(), contextBonuses.end());
1228 }
1229 }
1230
1231 Player* player = handler->GetSession()->GetPlayer();
1232 Player* playerTarget = handler->getSelectedPlayer();
1233 if (!playerTarget)
1234 playerTarget = player;
1235
1236 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
1237 if (!itemTemplate)
1238 {
1240 handler->SetSentErrorMessage(true);
1241 return false;
1242 }
1243
1244 // Subtract
1245 if (count < 0)
1246 {
1247 uint32 destroyedItemCount = playerTarget->DestroyItemCount(itemId, -count, true, false);
1248
1249 if (destroyedItemCount > 0)
1250 {
1251 // output the amount of items successfully destroyed
1252 handler->PSendSysMessage(LANG_REMOVEITEM, itemId, destroyedItemCount, handler->GetNameLink(playerTarget).c_str());
1253
1254 // check to see if we were unable to destroy all of the amount requested.
1255 uint32 unableToDestroyItemCount = -count - destroyedItemCount;
1256 if (unableToDestroyItemCount > 0)
1257 {
1258 // output message for the amount of items we couldn't destroy
1259 handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, itemId, unableToDestroyItemCount, handler->GetNameLink(playerTarget).c_str());
1260 }
1261 }
1262 else
1263 {
1264 // failed to destroy items of the amount requested
1265 handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, itemId, -count, handler->GetNameLink(playerTarget).c_str());
1266 }
1267
1268 return true;
1269 }
1270
1271 // Adding items
1272 uint32 noSpaceForCount = 0;
1273
1274 // check space and find places
1275 ItemPosCountVec dest;
1276 InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
1277 if (msg != EQUIP_ERR_OK) // convert to possible store amount
1278 count -= noSpaceForCount;
1279
1280 if (count == 0 || dest.empty()) // can't add any
1281 {
1282 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1283 handler->SetSentErrorMessage(true);
1284 return false;
1285 }
1286
1287 Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId), GuidSet(), itemContext,
1288 bonusListIDs.empty() ? nullptr : &bonusListIDs);
1289
1290 // remove binding (let GM give it to another player later)
1291 if (player == playerTarget)
1292 for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
1293 if (Item* item1 = player->GetItemByPos(itr->pos))
1294 item1->SetBinding(false);
1295
1296 if (count > 0 && item)
1297 {
1298 player->SendNewItem(item, count, false, true);
1299 handler->PSendSysMessage(LANG_ADDITEM, itemId, count, handler->GetNameLink(playerTarget).c_str());
1300 if (player != playerTarget)
1301 playerTarget->SendNewItem(item, count, true, false);
1302 }
1303
1304 if (noSpaceForCount > 0)
1305 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1306
1307 return true;
1308 }
1309
1310 static bool HandleAddItemToCommand(ChatHandler* handler, char const* args)
1311 {
1312 if (!*args)
1313 return false;
1314
1315 Player* player = handler->GetSession()->GetPlayer();
1316 Player* playerTarget = nullptr;
1317 if (!handler->extractPlayerTarget((char*)args, &playerTarget))
1318 {
1319 handler->SetSentErrorMessage(true);
1320 return false;
1321 }
1322
1323 char* tailArgs = strtok(nullptr, "");
1324 if (!tailArgs)
1325 return false;
1326
1327 uint32 itemId = 0;
1328
1329 if (tailArgs[0] == '[') // [name] manual form
1330 {
1331 char const* itemNameStr = strtok(tailArgs, "]");
1332
1333 if (itemNameStr && itemNameStr[0])
1334 {
1335 std::string itemName = itemNameStr+1;
1336 auto itr = std::find_if(sItemSparseStore.begin(), sItemSparseStore.end(), [&itemName](ItemSparseEntry const* sparse)
1337 {
1338 for (LocaleConstant i = LOCALE_enUS; i < TOTAL_LOCALES; i = LocaleConstant(i + 1))
1339 if (itemName == sparse->Display[i])
1340 return true;
1341 return false;
1342 });
1343
1344 if (itr == sItemSparseStore.end())
1345 {
1346 handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
1347 handler->SetSentErrorMessage(true);
1348 return false;
1349 }
1350
1351 itemId = itr->ID;
1352 }
1353 else
1354 return false;
1355 }
1356 else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
1357 {
1358 char const* id = handler->extractKeyFromLink(tailArgs, "Hitem");
1359 if (!id)
1360 return false;
1361
1362 itemId = Trinity::StringTo<uint32>(id).value_or(0);
1363 }
1364
1365 char const* ccount = strtok(nullptr, " ");
1366
1367 int32 count = 1;
1368
1369 if (ccount)
1370 count = strtol(ccount, nullptr, 10);
1371
1372 if (count == 0)
1373 count = 1;
1374
1375 std::vector<int32> bonusListIDs;
1376 char const* bonuses = strtok(nullptr, " ");
1377
1378 char const* context = strtok(nullptr, " ");
1379
1380 // semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
1381 if (bonuses)
1382 for (std::string_view token : Trinity::Tokenize(bonuses, ';', false))
1383 if (Optional<int32> bonusListId = Trinity::StringTo<int32>(token); bonusListId && *bonusListId)
1384 bonusListIDs.push_back(*bonusListId);
1385
1386 ItemContext itemContext = ItemContext::NONE;
1387 if (context)
1388 {
1389 itemContext = ItemContext(Trinity::StringTo<uint8>(context).value_or(0));
1390 if (itemContext < ItemContext::Max)
1391 {
1392 std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemId, itemContext);
1393 bonusListIDs.insert(bonusListIDs.begin(), contextBonuses.begin(), contextBonuses.end());
1394 }
1395 }
1396
1397 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
1398 if (!itemTemplate)
1399 {
1401 handler->SetSentErrorMessage(true);
1402 return false;
1403 }
1404
1405 // Subtract
1406 if (count < 0)
1407 {
1408 uint32 destroyedItemCount = playerTarget->DestroyItemCount(itemId, -count, true, false);
1409
1410 if (destroyedItemCount > 0)
1411 {
1412 // output the amount of items successfully destroyed
1413 handler->PSendSysMessage(LANG_REMOVEITEM, itemId, destroyedItemCount, handler->GetNameLink(playerTarget).c_str());
1414
1415 // check to see if we were unable to destroy all of the amount requested.
1416 uint32 unableToDestroyItemCount = -count - destroyedItemCount;
1417 if (unableToDestroyItemCount > 0)
1418 {
1419 // output message for the amount of items we couldn't destroy
1420 handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, itemId, unableToDestroyItemCount, handler->GetNameLink(playerTarget).c_str());
1421 }
1422 }
1423 else
1424 {
1425 // failed to destroy items of the amount requested
1426 handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, itemId, -count, handler->GetNameLink(playerTarget).c_str());
1427 }
1428
1429 return true;
1430 }
1431
1432 // Adding items
1433 uint32 noSpaceForCount = 0;
1434
1435 // check space and find places
1436 ItemPosCountVec dest;
1437 InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
1438 if (msg != EQUIP_ERR_OK) // convert to possible store amount
1439 count -= noSpaceForCount;
1440
1441 if (count == 0 || dest.empty()) // can't add any
1442 {
1443 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1444 handler->SetSentErrorMessage(true);
1445 return false;
1446 }
1447
1448 Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId), GuidSet(), itemContext,
1449 bonusListIDs.empty() ? nullptr : &bonusListIDs);
1450
1451 // remove binding (let GM give it to another player later)
1452 if (player == playerTarget)
1453 for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
1454 if (Item* item1 = player->GetItemByPos(itr->pos))
1455 item1->SetBinding(false);
1456
1457 if (count > 0 && item)
1458 {
1459 player->SendNewItem(item, count, false, true);
1460 if (player != playerTarget)
1461 playerTarget->SendNewItem(item, count, true, false);
1462 }
1463
1464 if (noSpaceForCount > 0)
1465 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1466
1467 return true;
1468 }
1469
1471 {
1472 // prevent generation all items with itemset field value '0'
1473 if (*itemSetId == 0)
1474 {
1476 handler->SetSentErrorMessage(true);
1477 return false;
1478 }
1479
1480 std::vector<int32> bonusListIDs;
1481
1482 // semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
1483 if (bonuses)
1484 for (std::string_view token : Trinity::Tokenize(*bonuses, ';', false))
1485 if (Optional<int32> bonusListId = Trinity::StringTo<int32>(token); bonusListId && *bonusListId)
1486 bonusListIDs.push_back(*bonusListId);
1487
1488 ItemContext itemContext = ItemContext::NONE;
1489 if (context)
1490 itemContext = ItemContext(*context);
1491
1492 Player* player = handler->GetSession()->GetPlayer();
1493 Player* playerTarget = handler->getSelectedPlayer();
1494 if (!playerTarget)
1495 playerTarget = player;
1496
1497 bool found = false;
1498 ItemTemplateContainer const& its = sObjectMgr->GetItemTemplateStore();
1499 for (auto const& itemTemplatePair : its)
1500 {
1501 if (itemTemplatePair.second.GetItemSet() != *itemSetId)
1502 continue;
1503
1504 found = true;
1505 ItemPosCountVec dest;
1506 InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemTemplatePair.first, 1);
1507 if (msg == EQUIP_ERR_OK)
1508 {
1509 std::vector<int32> bonusListIDsForItem = bonusListIDs; // copy, bonuses for each depending on context might be different for each item
1510 if (itemContext < ItemContext::Max)
1511 {
1512 std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemTemplatePair.first, itemContext);
1513 bonusListIDsForItem.insert(bonusListIDsForItem.begin(), contextBonuses.begin(), contextBonuses.end());
1514 }
1515
1516 Item* item = playerTarget->StoreNewItem(dest, itemTemplatePair.first, true, {}, GuidSet(), itemContext,
1517 bonusListIDsForItem.empty() ? nullptr : &bonusListIDsForItem);
1518 if (!item)
1519 continue;
1520
1521 // remove binding (let GM give it to another player later)
1522 if (player == playerTarget)
1523 item->SetBinding(false);
1524
1525 player->SendNewItem(item, 1, false, true);
1526 if (player != playerTarget)
1527 playerTarget->SendNewItem(item, 1, true, false);
1528 }
1529 else
1530 {
1531 player->SendEquipError(msg, nullptr, nullptr, itemTemplatePair.first);
1532 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemTemplatePair.first, 1);
1533 }
1534 }
1535
1536 if (!found)
1537 {
1539 handler->SetSentErrorMessage(true);
1540 return false;
1541 }
1542
1543 return true;
1544 }
1545
1546 static bool HandleBankCommand(ChatHandler* handler)
1547 {
1548 handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
1549 return true;
1550 }
1551
1552 static bool HandleChangeWeather(ChatHandler* handler, WeatherType type, float intensity)
1553 {
1554 // Weather is OFF
1555 if (!sWorld->getBoolConfig(CONFIG_WEATHER))
1556 {
1558 handler->SetSentErrorMessage(true);
1559 return false;
1560 }
1561
1562 Player* player = handler->GetSession()->GetPlayer();
1563 uint32 zoneid = player->GetZoneId();
1564
1565 Weather* weather = player->GetMap()->GetOrGenerateZoneDefaultWeather(zoneid);
1566 if (!weather)
1567 {
1569 handler->SetSentErrorMessage(true);
1570 return false;
1571 }
1572
1573 weather->SetWeather(type, intensity);
1574
1575 return true;
1576 }
1577
1578 static bool HandleSetSkillCommand(ChatHandler* handler, Variant<Hyperlink<skill>, uint32> skillId, uint32 level, Optional<uint32> maxSkillArg)
1579 {
1580 Player* target = handler->getSelectedPlayerOrSelf();
1581 if (!target)
1582 {
1584 handler->SetSentErrorMessage(true);
1585 return false;
1586 }
1587
1588 SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillId);
1589 if (!skillLine)
1590 {
1591 handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skillId);
1592 handler->SetSentErrorMessage(true);
1593 return false;
1594 }
1595
1596 bool targetHasSkill = target->GetSkillValue(skillId) != 0;
1597
1598 // If our target does not yet have the skill they are trying to add to them, the chosen level also becomes
1599 // the max level of the new profession.
1600 uint16 max = maxSkillArg.value_or(targetHasSkill ? target->GetPureMaxSkillValue(skillId) : level);
1601
1602 if (level == 0 || level > max)
1603 return false;
1604
1605 // If the player has the skill, we get the current skill step. If they don't have the skill, we
1606 // add the skill to the player's book with step 1 (which is the first rank, in most cases something
1607 // like 'Apprentice <skill>'.
1608 target->SetSkill(skillId, targetHasSkill ? target->GetSkillStep(skillId) : 1, level, max);
1609 handler->PSendSysMessage(LANG_SET_SKILL, skillId, skillLine->DisplayName[handler->GetSessionDbcLocale()], handler->GetNameLink(target).c_str(), level, max);
1610 return true;
1611 }
1612
1631 {
1632 if (!arg)
1633 arg = PlayerIdentifier::FromTargetOrSelf(handler);
1634
1635 if (!arg)
1636 return false;
1637
1638 // Define ALL the player variables!
1639 Player* target = arg->GetConnectedPlayer();
1640 ObjectGuid targetGuid = arg->GetGUID();
1641 std::string targetName = arg->GetName();
1642 CharacterDatabasePreparedStatement* stmt = nullptr;
1643
1644 /* The variables we extract for the command. They are
1645 * default as "does not exist" to prevent problems
1646 * The output is printed in the follow manner:
1647 *
1648 * Player %s %s (guid: %u) - I. LANG_PINFO_PLAYER
1649 * ** GM Mode active, Phase: -1 - II. LANG_PINFO_GM_ACTIVE (if GM)
1650 * ** Banned: (Type, Reason, Time, By) - III. LANG_PINFO_BANNED (if banned)
1651 * ** Muted: (Reason, Time, By) - IV. LANG_PINFO_MUTED (if muted)
1652 * * Account: %s (id: %u), GM Level: %u - V. LANG_PINFO_ACC_ACCOUNT
1653 * * Last Login: %u (Failed Logins: %u) - VI. LANG_PINFO_ACC_LASTLOGIN
1654 * * Uses OS: %s - Latency: %u ms - VII. LANG_PINFO_ACC_OS
1655 * * Registration Email: %s - Email: %s - VIII. LANG_PINFO_ACC_REGMAILS
1656 * * Last IP: %u (Locked: %s) - IX. LANG_PINFO_ACC_IP
1657 * * Level: %u (%u/%u XP (%u XP left) - X. LANG_PINFO_CHR_LEVEL
1658 * * Race: %s %s, Class %s - XI. LANG_PINFO_CHR_RACE
1659 * * Alive ?: %s - XII. LANG_PINFO_CHR_ALIVE
1660 * * Phases: %s - XIII. LANG_PINFO_CHR_PHASE (if not GM)
1661 * * Money: %ug%us%uc - XIV. LANG_PINFO_CHR_MONEY
1662 * * Map: %s, Area: %s - XV. LANG_PINFO_CHR_MAP
1663 * * Guild: %s (Id: %s) - XVI. LANG_PINFO_CHR_GUILD (if in guild)
1664 * ** Rank: %s, ID: %u - XVII. LANG_PINFO_CHR_GUILD_RANK (if in guild)
1665 * ** Note: %s - XVIII.LANG_PINFO_CHR_GUILD_NOTE (if in guild and has note)
1666 * ** O. Note: %s - XVIX. LANG_PINFO_CHR_GUILD_ONOTE (if in guild and has officer note)
1667 * * Played time: %s - XX. LANG_PINFO_CHR_PLAYEDTIME
1668 * * Mails: %u Read/%u Total - XXI. LANG_PINFO_CHR_MAILS (if has mails)
1669 *
1670 * Not all of them can be moved to the top. These should
1671 * place the most important ones to the head, though.
1672 *
1673 * For a cleaner overview, I segment each output in Roman numerals
1674 */
1675
1676 // Account data print variables
1677 std::string userName = handler->GetTrinityString(LANG_ERROR);
1678 uint32 accId = 0;
1679 ObjectGuid::LowType lowguid = targetGuid.GetCounter();
1680 std::string eMail = handler->GetTrinityString(LANG_ERROR);
1681 std::string regMail = handler->GetTrinityString(LANG_ERROR);
1682 uint32 security = 0;
1683 std::string lastIp = handler->GetTrinityString(LANG_ERROR);
1684 uint8 locked = 0;
1685 std::string lastLogin = handler->GetTrinityString(LANG_ERROR);
1686 uint32 failedLogins = 0;
1687 uint32 latency = 0;
1688 std::string OS = handler->GetTrinityString(LANG_UNKNOWN);
1689
1690 // Mute data print variables
1691 int64 muteTime = -1;
1692 std::string muteReason = handler->GetTrinityString(LANG_NO_REASON);
1693 std::string muteBy = handler->GetTrinityString(LANG_UNKNOWN);
1694
1695 // Ban data print variables
1696 int64 banTime = -1;
1697 std::string banType = handler->GetTrinityString(LANG_UNKNOWN);
1698 std::string banReason = handler->GetTrinityString(LANG_NO_REASON);
1699 std::string bannedBy = handler->GetTrinityString(LANG_UNKNOWN);
1700
1701 // Character data print variables
1702 uint8 raceid, classid = 0; //RACE_NONE, CLASS_NONE
1703 std::string raceStr, classStr = handler->GetTrinityString(LANG_UNKNOWN);
1704 uint8 gender = 0;
1705 LocaleConstant locale = handler->GetSessionDbcLocale();
1706 uint32 totalPlayerTime = 0;
1707 uint8 level = 0;
1708 std::string alive = handler->GetTrinityString(LANG_ERROR);
1709 uint64 money = 0;
1710 uint32 xp = 0;
1711 uint32 xptotal = 0;
1712
1713 // Position data print
1714 uint32 mapId;
1715 uint32 areaId;
1716 char const* areaName = nullptr;
1717 char const* zoneName = nullptr;
1718
1719 // Guild data print variables defined so that they exist, but are not necessarily used
1720 ObjectGuid::LowType guildId = UI64LIT(0);
1721 uint8 guildRankId = 0;
1722 std::string guildName;
1723 std::string guildRank;
1724 std::string note;
1725 std::string officeNote;
1726
1727 // Mail data print is only defined if you have a mail
1728
1729 if (target)
1730 {
1731 // check online security
1732 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
1733 return false;
1734
1735 accId = target->GetSession()->GetAccountId();
1736 money = target->GetMoney();
1737 totalPlayerTime = target->GetTotalPlayedTime();
1738 level = target->GetLevel();
1739 latency = target->GetSession()->GetLatency();
1740 raceid = target->GetRace();
1741 classid = target->GetClass();
1742 muteTime = target->GetSession()->m_muteTime;
1743 mapId = target->GetMapId();
1744 areaId = target->GetAreaId();
1745 alive = target->IsAlive() ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO);
1746 gender = target->GetNativeGender();
1747 }
1748 // get additional information from DB
1749 else
1750 {
1751 // check offline security
1752 if (handler->HasLowerSecurity(nullptr, targetGuid))
1753 return false;
1754
1755 // Query informations from the DB
1756 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
1757 stmt->setUInt64(0, lowguid);
1758 PreparedQueryResult result = CharacterDatabase.Query(stmt);
1759
1760 if (!result)
1761 return false;
1762
1763 Field* fields = result->Fetch();
1764 totalPlayerTime = fields[0].GetUInt32();
1765 level = fields[1].GetUInt8();
1766 money = fields[2].GetUInt64();
1767 accId = fields[3].GetUInt32();
1768 raceid = fields[4].GetUInt8();
1769 classid = fields[5].GetUInt8();
1770 mapId = fields[6].GetUInt16();
1771 areaId = fields[7].GetUInt16();
1772 gender = fields[8].GetUInt8();
1773 uint32 health = fields[9].GetUInt32();
1774 uint32 playerFlags = fields[10].GetUInt32();
1775
1776 if (!health || playerFlags & PLAYER_FLAGS_GHOST)
1777 alive = handler->GetTrinityString(LANG_NO);
1778 else
1779 alive = handler->GetTrinityString(LANG_YES);
1780 }
1781
1782 // Query the prepared statement for login data
1783 LoginDatabasePreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
1784 stmt2->setInt32(0, int32(realm.Id.Realm));
1785 stmt2->setUInt32(1, accId);
1786 PreparedQueryResult result = LoginDatabase.Query(stmt2);
1787
1788 if (result)
1789 {
1790 Field* fields = result->Fetch();
1791 userName = fields[0].GetString();
1792 security = fields[1].GetUInt8();
1793
1794 // Only fetch these fields if commander has sufficient rights)
1795 if (handler->HasPermission(rbac::RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA) && // RBAC Perm. 48, Role 39
1796 (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)))
1797 {
1798 eMail = fields[2].GetString();
1799 regMail = fields[3].GetString();
1800 lastIp = fields[4].GetString();
1801 lastLogin = fields[5].GetString();
1802
1803 if (IpLocationRecord const* location = sIPLocation->GetLocationRecord(lastIp))
1804 {
1805 lastIp.append(" (");
1806 lastIp.append(location->CountryName);
1807 lastIp.append(")");
1808 }
1809 }
1810 else
1811 {
1812 eMail = handler->GetTrinityString(LANG_UNAUTHORIZED);
1813 regMail = handler->GetTrinityString(LANG_UNAUTHORIZED);
1814 lastIp = handler->GetTrinityString(LANG_UNAUTHORIZED);
1815 lastLogin = handler->GetTrinityString(LANG_UNAUTHORIZED);
1816 }
1817 muteTime = fields[6].GetUInt64();
1818 muteReason = fields[7].GetString();
1819 muteBy = fields[8].GetString();
1820 failedLogins = fields[9].GetUInt32();
1821 locked = fields[10].GetUInt8();
1822 OS = fields[11].GetString();
1823 }
1824
1825 // Creates a chat link to the character. Returns nameLink
1826 std::string nameLink = handler->playerLink(targetName);
1827
1828 // Returns banType, banTime, bannedBy, banreason
1829 stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
1830 stmt2->setUInt32(0, accId);
1831 PreparedQueryResult result2 = LoginDatabase.Query(stmt2);
1832 if (!result2)
1833 {
1834 banType = handler->GetTrinityString(LANG_CHARACTER);
1835 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
1836 stmt->setUInt64(0, lowguid);
1837 result2 = CharacterDatabase.Query(stmt);
1838 }
1839 else
1840 banType = handler->GetTrinityString(LANG_ACCOUNT);
1841
1842 if (result2)
1843 {
1844 Field* fields = result2->Fetch();
1845 bool permanent = fields[1].GetUInt64() != 0;
1846 banTime = !permanent ? int64(fields[0].GetUInt32()) : 0;
1847 bannedBy = fields[2].GetString();
1848 banReason = fields[3].GetString();
1849 }
1850
1851 // Can be used to query data from Characters database
1852 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
1853 stmt->setUInt64(0, lowguid);
1854 PreparedQueryResult result4 = CharacterDatabase.Query(stmt);
1855
1856 if (result4)
1857 {
1858 Field* fields = result4->Fetch();
1859 xp = fields[0].GetUInt32(); // Used for "current xp" output and "%u XP Left" calculation
1860 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
1861 xptotal = sObjectMgr->GetXPForLevel(level);
1862
1863 if (gguid)
1864 {
1865 // Guild Data - an own query, because it may not happen.
1866 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
1867 stmt->setUInt64(0, lowguid);
1868 PreparedQueryResult result5 = CharacterDatabase.Query(stmt);
1869 if (result5)
1870 {
1871 Field* fields5 = result5->Fetch();
1872 guildId = fields5[0].GetUInt64();
1873 guildName = fields5[1].GetString();
1874 guildRank = fields5[2].GetString();
1875 guildRankId = fields5[3].GetUInt8();
1876 note = fields5[4].GetString();
1877 officeNote = fields5[5].GetString();
1878 }
1879 }
1880 }
1881
1882 // Initiate output
1883 // Output I. LANG_PINFO_PLAYER
1884 handler->PSendSysMessage(LANG_PINFO_PLAYER, target ? "" : handler->GetTrinityString(LANG_OFFLINE), nameLink.c_str(), targetGuid.ToString().c_str());
1885
1886 // Output II. LANG_PINFO_GM_ACTIVE if character is gamemaster
1887 if (target && target->IsGameMaster())
1889
1890 // Output III. LANG_PINFO_BANNED if ban exists and is applied
1891 if (banTime >= 0)
1892 handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - GameTime::GetGameTime(), TimeFormat::ShortText).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
1893
1894 // Output IV. LANG_PINFO_MUTED if mute is applied
1895 if (muteTime > 0)
1896 handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - GameTime::GetGameTime(), TimeFormat::ShortText).c_str(), muteBy.c_str());
1897
1898 // Output V. LANG_PINFO_ACC_ACCOUNT
1899 handler->PSendSysMessage(LANG_PINFO_ACC_ACCOUNT, userName.c_str(), accId, security);
1900
1901 // Output VI. LANG_PINFO_ACC_LASTLOGIN
1902 handler->PSendSysMessage(LANG_PINFO_ACC_LASTLOGIN, lastLogin.c_str(), failedLogins);
1903
1904 // Output VII. LANG_PINFO_ACC_OS
1905 handler->PSendSysMessage(LANG_PINFO_ACC_OS, OS.c_str(), latency);
1906
1907 // Output VIII. LANG_PINFO_ACC_REGMAILS
1908 handler->PSendSysMessage(LANG_PINFO_ACC_REGMAILS, regMail.c_str(), eMail.c_str());
1909
1910 // Output IX. LANG_PINFO_ACC_IP
1911 handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO));
1912
1913 // Output X. LANG_PINFO_CHR_LEVEL
1914 if (level != sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
1915 handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_LOW, level, xp, xptotal, (xptotal - xp));
1916 else
1918
1919 // Output XI. LANG_PINFO_CHR_RACE
1920 raceStr = DB2Manager::GetChrRaceName(raceid, locale);
1921 classStr = DB2Manager::GetClassName(classid, locale);
1922 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());
1923
1924 // Output XII. LANG_PINFO_CHR_ALIVE
1925 handler->PSendSysMessage(LANG_PINFO_CHR_ALIVE, alive.c_str());
1926
1927 // Output XIII. phases
1928 if (target)
1929 PhasingHandler::PrintToChat(handler, target);
1930
1931 // Output XIV. LANG_PINFO_CHR_MONEY
1932 uint32 gold = money / GOLD;
1933 uint32 silv = (money % GOLD) / SILVER;
1934 uint32 copp = (money % GOLD) % SILVER;
1935 handler->PSendSysMessage(LANG_PINFO_CHR_MONEY, gold, silv, copp);
1936
1937 // Position data
1938 MapEntry const* map = sMapStore.LookupEntry(mapId);
1939 AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
1940 if (area)
1941 {
1942 zoneName = area->AreaName[locale];
1943
1944 if (area->GetFlags().HasFlag(AreaFlags::IsSubzone))
1945 {
1946 AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID);
1947 if (zone)
1948 {
1949 areaName = zoneName;
1950 zoneName = zone->AreaName[locale];
1951 }
1952 }
1953 }
1954
1955 if (!zoneName)
1956 zoneName = handler->GetTrinityString(LANG_UNKNOWN);
1957
1958 if (areaName)
1959 handler->PSendSysMessage(LANG_PINFO_CHR_MAP_WITH_AREA, map->MapName[locale], zoneName, areaName);
1960 else
1961 handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->MapName[locale], zoneName);
1962
1963 // Output XVII. - XVIX. if they are not empty
1964 if (!guildName.empty())
1965 {
1966 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), std::to_string(guildId).c_str());
1967 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank.c_str(), uint32(guildRankId));
1968 if (!note.empty())
1969 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_NOTE, note.c_str());
1970 if (!officeNote.empty())
1971 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str());
1972 }
1973
1974 // Output XX. LANG_PINFO_CHR_PLAYEDTIME
1975 handler->PSendSysMessage(LANG_PINFO_CHR_PLAYEDTIME, (secsToTimeString(totalPlayerTime, TimeFormat::ShortText, true)).c_str());
1976
1977 // Mail Data - an own query, because it may or may not be useful.
1978 // SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
1979 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
1980 stmt->setUInt64(0, lowguid);
1981 PreparedQueryResult result6 = CharacterDatabase.Query(stmt);
1982 if (result6)
1983 {
1984 Field* fields = result6->Fetch();
1985 uint32 readmail = uint32(fields[0].GetDouble());
1986 uint32 totalmail = uint32(fields[1].GetUInt64());
1987
1988 // Output XXI. LANG_INFO_CHR_MAILS if at least one mail is given
1989 if (totalmail >= 1)
1990 handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, readmail, totalmail);
1991 }
1992
1993 return true;
1994 }
1995
1996 static bool HandleRespawnCommand(ChatHandler* handler)
1997 {
1998 Player* player = handler->GetSession()->GetPlayer();
1999
2000 // accept only explicitly selected target (not implicitly self targeting case)
2001 Creature* target = !player->GetTarget().IsEmpty() ? handler->getSelectedCreature() : nullptr;
2002 if (target)
2003 {
2004 if (target->IsPet())
2005 {
2007 handler->SetSentErrorMessage(true);
2008 return false;
2009 }
2010
2011 if (target->isDead())
2012 target->Respawn();
2013 return true;
2014 }
2015
2016 // First handle any creatures that still have a corpse around
2017 Trinity::RespawnDo u_do;
2019 Cell::VisitGridObjects(player, worker, player->GetGridActivationRange());
2020
2021 // Now handle any that had despawned, but had respawn time logged.
2022 std::vector<RespawnInfo const*> data;
2023 player->GetMap()->GetRespawnInfo(data, SPAWN_TYPEMASK_ALL);
2024 if (!data.empty())
2025 {
2026 uint32 const gridId = Trinity::ComputeGridCoord(player->GetPositionX(), player->GetPositionY()).GetId();
2027 for (RespawnInfo const* info : data)
2028 if (info->gridId == gridId)
2029 player->GetMap()->Respawn(info->type, info->spawnId);
2030 }
2031
2032 return true;
2033 }
2034
2035 // mute player for the specified duration
2036 static bool HandleMuteCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, uint32 muteTime, Tail muteReason)
2037 {
2038 std::string muteReasonStr{ muteReason };
2039 if (muteReason.empty())
2040 muteReasonStr = handler->GetTrinityString(LANG_NO_REASON);
2041
2042 if (!player)
2043 player = PlayerIdentifier::FromTarget(handler);
2044 if (!player)
2045 {
2047 handler->SetSentErrorMessage(true);
2048 return false;
2049 }
2050
2051 Player* target = player->GetConnectedPlayer();
2052 uint32 accountId = target ? target->GetSession()->GetAccountId() : sCharacterCache->GetCharacterAccountIdByGuid(*player);
2053
2054 // find only player from same account if any
2055 if (!target)
2056 if (WorldSession* session = sWorld->FindSession(accountId))
2057 target = session->GetPlayer();
2058
2059 // must have strong lesser security level
2060 if (handler->HasLowerSecurity(target, player->GetGUID(), true))
2061 return false;
2062
2064 std::string muteBy = "";
2065 if (Player* gmPlayer = handler->GetPlayer())
2066 muteBy = gmPlayer->GetName();
2067 else
2068 muteBy = handler->GetTrinityString(LANG_CONSOLE);
2069
2070 if (target)
2071 {
2072 // Target is online, mute will be in effect right away.
2073 int64 mutedUntil = GameTime::GetGameTime() + static_cast<int64>(muteTime) * MINUTE;
2074 target->GetSession()->m_muteTime = mutedUntil;
2075 stmt->setInt64(0, mutedUntil);
2076 }
2077 else
2078 {
2079 // Target is offline, mute will be in effect starting from the next login.
2080 stmt->setInt64(0, -static_cast<int64>(muteTime) * MINUTE);
2081 }
2082
2083 stmt->setString(1, muteReasonStr);
2084 stmt->setString(2, muteBy);
2085 stmt->setUInt32(3, accountId);
2086 LoginDatabase.Execute(stmt);
2087 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_MUTE);
2088 stmt->setUInt32(0, accountId);
2089 stmt->setUInt32(1, muteTime);
2090 stmt->setString(2, muteBy);
2091 stmt->setString(3, muteReasonStr);
2092 LoginDatabase.Execute(stmt);
2093
2094 std::string nameLink = handler->playerLink(*player);
2095 if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
2096 sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), muteTime, muteReasonStr.c_str());
2097 if (target)
2098 {
2099 ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, muteTime, muteBy.c_str(), muteReasonStr.c_str());
2100 handler->PSendSysMessage(LANG_YOU_DISABLE_CHAT, nameLink.c_str(), muteTime, muteReasonStr.c_str());
2101 }
2102 else
2103 {
2104 handler->PSendSysMessage(LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), muteTime, muteReasonStr.c_str());
2105 }
2106
2107 return true;
2108 }
2109
2110 // unmute player
2111 static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
2112 {
2113 Player* target;
2114 ObjectGuid targetGuid;
2115 std::string targetName;
2116 if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
2117 return false;
2118
2119 uint32 accountId = target ? target->GetSession()->GetAccountId() : sCharacterCache->GetCharacterAccountIdByGuid(targetGuid);
2120
2121 // find only player from same account if any
2122 if (!target)
2123 if (WorldSession* session = sWorld->FindSession(accountId))
2124 target = session->GetPlayer();
2125
2126 // must have strong lesser security level
2127 if (handler->HasLowerSecurity (target, targetGuid, true))
2128 return false;
2129
2130 if (target)
2131 {
2132 if (target->GetSession()->CanSpeak())
2133 {
2135 handler->SetSentErrorMessage(true);
2136 return false;
2137 }
2138
2139 target->GetSession()->m_muteTime = 0;
2140 }
2141
2143 stmt->setInt64(0, 0);
2144 stmt->setString(1, "");
2145 stmt->setString(2, "");
2146 stmt->setUInt32(3, accountId);
2147 LoginDatabase.Execute(stmt);
2148
2149 if (target)
2151
2152 std::string nameLink = handler->playerLink(targetName);
2153
2154 handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
2155
2156 return true;
2157 }
2158
2159 // mutehistory command
2160 static bool HandleMuteHistoryCommand(ChatHandler* handler, std::string accountName)
2161 {
2162 if (!Utf8ToUpperOnlyLatin(accountName))
2163 {
2164 handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
2165 handler->SetSentErrorMessage(true);
2166 return false;
2167 }
2168
2169 uint32 accountId = AccountMgr::GetId(accountName);
2170 if (!accountId)
2171 {
2172 handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
2173 return false;
2174 }
2175
2176 return HandleMuteHistoryHelper(accountId, accountName.c_str(), handler);
2177 }
2178
2179 // helper for mutehistory
2180 static bool HandleMuteHistoryHelper(uint32 accountId, char const* accountName, ChatHandler *handler)
2181 {
2183 stmt->setUInt32(0, accountId);
2184 PreparedQueryResult result = LoginDatabase.Query(stmt);
2185
2186 if (!result)
2187 {
2188 handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY_EMPTY, accountName);
2189 return true;
2190 }
2191
2192 handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY, accountName);
2193 do
2194 {
2195 Field* fields = result->Fetch();
2196
2197 // we have to manually set the string for mutedate
2198 time_t sqlTime = fields[0].GetUInt32();
2199 tm timeinfo;
2200 char buffer[80];
2201
2202 // set it to string
2203 localtime_r(&sqlTime, &timeinfo);
2204 strftime(buffer, sizeof(buffer),"%Y-%m-%d %I:%M%p", &timeinfo);
2205
2206 handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY_OUTPUT, buffer, fields[1].GetUInt32(), fields[2].GetCString(), fields[3].GetCString());
2207 } while (result->NextRow());
2208 return true;
2209 }
2210
2212 {
2213 Unit* unit = handler->getSelectedUnit();
2214 if (!unit)
2215 {
2217 handler->SetSentErrorMessage(true);
2218 return false;
2219 }
2220
2221 handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().ToString().c_str());
2222
2223 if (unit->GetMotionMaster()->Empty())
2224 {
2225 handler->SendSysMessage("Empty");
2226 return true;
2227 }
2228
2229 float x, y, z;
2230 unit->GetMotionMaster()->GetDestination(x, y, z);
2231
2232 std::vector<MovementGeneratorInformation> const list = unit->GetMotionMaster()->GetMovementGeneratorsInformation();
2233 for (MovementGeneratorInformation const& info : list)
2234 {
2235 switch (info.Type)
2236 {
2237 case IDLE_MOTION_TYPE:
2239 break;
2240 case RANDOM_MOTION_TYPE:
2242 break;
2245 break;
2248 break;
2249 case CHASE_MOTION_TYPE:
2250 if (info.TargetGUID.IsEmpty())
2252 else if (info.TargetGUID.IsPlayer())
2253 handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, info.TargetName.c_str(), info.TargetGUID.ToString().c_str());
2254 else
2255 handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, info.TargetName.c_str(), info.TargetGUID.ToString().c_str());
2256 break;
2257 case FOLLOW_MOTION_TYPE:
2258 if (info.TargetGUID.IsEmpty())
2260 else if (info.TargetGUID.IsPlayer())
2261 handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, info.TargetName.c_str(), info.TargetGUID.ToString().c_str());
2262 else
2263 handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, info.TargetName.c_str(), info.TargetGUID.ToString().c_str());
2264 break;
2265 case HOME_MOTION_TYPE:
2266 if (unit->GetTypeId() == TYPEID_UNIT)
2268 else
2270 break;
2271 case FLIGHT_MOTION_TYPE:
2273 break;
2274 case POINT_MOTION_TYPE:
2275 handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
2276 break;
2279 break;
2282 break;
2283 case EFFECT_MOTION_TYPE:
2285 break;
2286 default:
2287 handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, info.Type);
2288 break;
2289 }
2290 }
2291 return true;
2292 }
2293
2295 {
2296 Creature* caster = handler->getSelectedCreature();
2297 if (!caster)
2298 {
2300 handler->SetSentErrorMessage(true);
2301 return false;
2302 }
2303
2304 Player* player = handler->GetSession()->GetPlayer();
2305
2306 caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
2307
2308 return true;
2309 }
2310
2312 {
2313 Unit* target = handler->getSelectedUnit();
2314 if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
2315 {
2317 handler->SetSentErrorMessage(true);
2318 return false;
2319 }
2320
2321 if (Player* player = target->ToPlayer())
2322 if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false))
2323 return false;
2324
2325 if (!target->IsAlive())
2326 return true;
2327
2328 // flat melee damage without resistence/etc reduction
2329 if (!school)
2330 {
2331 Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
2332 if (target != handler->GetSession()->GetPlayer())
2334 return true;
2335 }
2336
2337 SpellSchoolMask schoolmask = SpellSchoolMask(1 << *school);
2338
2339 if (Unit::IsDamageReducedByArmor(schoolmask))
2340 damage = Unit::CalcArmorReducedDamage(handler->GetSession()->GetPlayer(), target, damage, nullptr, BASE_ATTACK);
2341
2342 Player* attacker = handler->GetSession()->GetPlayer();
2343
2344 // melee damage by specific school
2345 if (!spellInfo)
2346 {
2347 DamageInfo dmgInfo(attacker, target, damage, nullptr, schoolmask, SPELL_DIRECT_DAMAGE, BASE_ATTACK);
2348 Unit::CalcAbsorbResist(dmgInfo);
2349
2350 if (!dmgInfo.GetDamage())
2351 return true;
2352
2353 damage = dmgInfo.GetDamage();
2354
2355 uint32 absorb = dmgInfo.GetAbsorb();
2356 uint32 resist = dmgInfo.GetResist();
2357 Unit::DealDamageMods(attacker, target, damage, &absorb);
2358 Unit::DealDamage(attacker, target, damage, nullptr, DIRECT_DAMAGE, schoolmask, nullptr, false);
2359 attacker->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 0, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
2360 return true;
2361 }
2362
2363 // non-melee damage
2364
2365 SpellNonMeleeDamage damageInfo(attacker, target, *spellInfo, { (*spellInfo)->GetSpellXSpellVisualId(handler->GetSession()->GetPlayer()), 0 }, (*spellInfo)->SchoolMask);
2366 damageInfo.damage = damage;
2367 Unit::DealDamageMods(damageInfo.attacker, damageInfo.target, damageInfo.damage, &damageInfo.absorb);
2368 target->DealSpellDamage(&damageInfo, true);
2369 target->SendSpellNonMeleeDamageLog(&damageInfo);
2370 return true;
2371 }
2372
2374 {
2375 GameObject* go = handler->GetObjectFromPlayerMapByDbGuid(*spawnId);
2376 if (!go)
2377 {
2378 handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, std::to_string(*spawnId).c_str());
2379 handler->SetSentErrorMessage(true);
2380 return false;
2381 }
2382
2383 if (!go->IsDestructibleBuilding())
2384 {
2386 handler->SetSentErrorMessage(true);
2387 return false;
2388 }
2389
2390 go->ModifyHealth(-damage, handler->GetSession()->GetPlayer());
2391 handler->PSendSysMessage(LANG_GAMEOBJECT_DAMAGED, go->GetName().c_str(), std::to_string(*spawnId).c_str(), -damage, go->GetGOValue()->Building.Health);
2392 return true;
2393 }
2394
2395 static bool HandleCombatStopCommand(ChatHandler* handler, char const* args)
2396 {
2397 Player* target = nullptr;
2398
2399 if (args && args[0] != '\0')
2400 {
2401 target = ObjectAccessor::FindPlayerByName(args);
2402 if (!target)
2403 {
2405 handler->SetSentErrorMessage(true);
2406 return false;
2407 }
2408 }
2409
2410 if (!target)
2411 {
2412 if (!handler->extractPlayerTarget((char*)args, &target))
2413 return false;
2414 }
2415
2416 // check online security
2417 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
2418 return false;
2419
2420 target->CombatStop();
2421 return true;
2422 }
2423
2424 static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args)
2425 {
2426 Player* target;
2427 if (!handler->extractPlayerTarget((char*)args, &target))
2428 return false;
2429
2430 // check online security
2431 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
2432 return false;
2433
2434 // Repair items
2435 target->DurabilityRepairAll(false, 0, false);
2436
2437 handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str());
2438 if (handler->needReportToTarget(target))
2440
2441 return true;
2442 }
2443
2444 static bool HandleFreezeCommand(ChatHandler* handler, char const* args)
2445 {
2446 Player* player = handler->getSelectedPlayer(); // Selected player, if any. Might be null.
2447 uint32 freezeDuration = 0; // Freeze Duration (in seconds)
2448 bool canApplyFreeze = false; // Determines if every possible argument is set so Freeze can be applied
2449 bool getDurationFromConfig = false; // If there's no given duration, we'll retrieve the world cfg value later
2450
2451 /*
2452 Possible Freeze Command Scenarios:
2453 case 1 - .freeze (without args and a selected player)
2454 case 2 - .freeze duration (with a selected player)
2455 case 3 - .freeze player duration
2456 case 4 - .freeze player (without specifying duration)
2457 */
2458
2459 // case 1: .freeze
2460 if (!*args)
2461 {
2462 // Might have a selected player. We'll check it later
2463 // Get the duration from world cfg
2464 getDurationFromConfig = true;
2465 }
2466 else
2467 {
2468 // Get the args that we might have (up to 2)
2469 char const* arg1 = strtok((char*)args, " ");
2470 char const* arg2 = strtok(nullptr, " ");
2471
2472 // Analyze them to see if we got either a playerName or duration or both
2473 if (arg1)
2474 {
2475 if (isNumeric(arg1))
2476 {
2477 // case 2: .freeze duration
2478 // We have a selected player. We'll check him later
2479 freezeDuration = uint32(atoi(arg1));
2480 canApplyFreeze = true;
2481 }
2482 else
2483 {
2484 // case 3 or 4: .freeze player duration | .freeze player
2485 // find the player
2486 std::string name = arg1;
2487 normalizePlayerName(name);
2488 player = ObjectAccessor::FindPlayerByName(name);
2489 // Check if we have duration set
2490 if (arg2 && isNumeric(arg2))
2491 {
2492 freezeDuration = uint32(atoi(arg2));
2493 canApplyFreeze = true;
2494 }
2495 else
2496 getDurationFromConfig = true;
2497 }
2498 }
2499 }
2500
2501 // Check if duration needs to be retrieved from config
2502 if (getDurationFromConfig)
2503 {
2504 freezeDuration = sWorld->getIntConfig(CONFIG_GM_FREEZE_DURATION);
2505 canApplyFreeze = true;
2506 }
2507
2508 // Player and duration retrieval is over
2509 if (canApplyFreeze)
2510 {
2511 if (!player) // can be null if some previous selection failed
2512 {
2514 return true;
2515 }
2516 else if (player == handler->GetSession()->GetPlayer())
2517 {
2518 // Can't freeze himself
2520 return true;
2521 }
2522 else // Apply the effect
2523 {
2524 // Add the freeze aura and set the proper duration
2525 // Player combat status and flags are now handled
2526 // in Freeze Spell AuraScript (OnApply)
2527 Aura* freeze = player->AddAura(9454, player);
2528 if (freeze)
2529 {
2530 if (freezeDuration)
2531 freeze->SetDuration(freezeDuration * IN_MILLISECONDS);
2532 handler->PSendSysMessage(LANG_COMMAND_FREEZE, player->GetName().c_str());
2533 // save player
2534 player->SaveToDB();
2535 return true;
2536 }
2537 }
2538 }
2539 return false;
2540 }
2541
2542 static bool HandleUnFreezeCommand(ChatHandler* handler, Optional<std::string> targetNameArg)
2543 {
2544 std::string name;
2545 Player* player;
2546
2547 if (targetNameArg)
2548 {
2549 name = *targetNameArg;
2550 normalizePlayerName(name);
2551 player = ObjectAccessor::FindPlayerByName(name);
2552 }
2553 else // If no name was entered - use target
2554 {
2555 player = handler->getSelectedPlayer();
2556 if (player)
2557 name = player->GetName();
2558 }
2559
2560 if (player)
2561 {
2562 handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
2563
2564 // Remove Freeze spell (allowing movement and spells)
2565 // Player Flags + Neutral faction removal is now
2566 // handled on the Freeze Spell AuraScript (OnRemove)
2567 player->RemoveAurasDueToSpell(9454);
2568 }
2569 else
2570 {
2571 if (targetNameArg)
2572 {
2573 // Check for offline players
2574 ObjectGuid guid = sCharacterCache->GetCharacterGuidByName(name);
2575 if (guid.IsEmpty())
2576 {
2578 return true;
2579 }
2580
2581 // If player found: delete his freeze aura
2583 stmt->setUInt64(0, guid.GetCounter());
2584 CharacterDatabase.Execute(stmt);
2585
2586 handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
2587 return true;
2588 }
2589 else
2590 {
2592 return true;
2593 }
2594 }
2595
2596 return true;
2597 }
2598
2600 {
2601 // Get names from DB
2603 PreparedQueryResult result = CharacterDatabase.Query(stmt);
2604 if (!result)
2605 {
2607 return true;
2608 }
2609
2610 // Header of the names
2612
2613 // Output of the results
2614 do
2615 {
2616 Field* fields = result->Fetch();
2617 std::string player = fields[0].GetString();
2618 int32 remaintime = fields[1].GetInt32();
2619 // Save the frozen player to update remaining time in case of future .listfreeze uses
2620 // before the frozen state expires
2621 if (Player* frozen = ObjectAccessor::FindPlayerByName(player))
2622 frozen->SaveToDB();
2623 // Notify the freeze duration
2624 if (remaintime == -1) // Permanent duration
2625 handler->PSendSysMessage(LANG_COMMAND_PERMA_FROZEN_PLAYER, player.c_str());
2626 else
2627 // show time left (seconds)
2628 handler->PSendSysMessage(LANG_COMMAND_TEMP_FROZEN_PLAYER, player.c_str(), remaintime / IN_MILLISECONDS);
2629 }
2630 while (result->NextRow());
2631
2632 return true;
2633 }
2634
2635 static bool HandlePlayAllCommand(ChatHandler* handler, uint32 soundId, Optional<int32> broadcastTextId)
2636 {
2637 if (!sSoundKitStore.LookupEntry(soundId))
2638 {
2639 handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
2640 handler->SetSentErrorMessage(true);
2641 return false;
2642 }
2643
2644 sWorld->SendGlobalMessage(WorldPackets::Misc::PlaySound(handler->GetSession()->GetPlayer()->GetGUID(), soundId, broadcastTextId.value_or(0)).Write());
2645
2647 return true;
2648 }
2649
2650 static bool HandlePossessCommand(ChatHandler* handler)
2651 {
2652 Unit* unit = handler->getSelectedUnit();
2653 if (!unit)
2654 return false;
2655
2656 handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true);
2657 return true;
2658 }
2659
2661 {
2662 Unit* unit = handler->getSelectedUnit();
2663 if (!unit)
2664 unit = handler->GetSession()->GetPlayer();
2665
2666 unit->RemoveCharmAuras();
2667
2668 return true;
2669 }
2670
2672 {
2673 Unit* unit = handler->getSelectedUnit();
2674 if (!unit)
2675 return false;
2676
2677 handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
2678 return true;
2679 }
2680
2682 {
2683 Player* player = handler->GetSession()->GetPlayer();
2684
2685 if (player->isPossessing())
2686 return false;
2687
2688 player->StopCastingBindSight();
2689 return true;
2690 }
2691
2692 static bool HandleMailBoxCommand(ChatHandler* handler)
2693 {
2694 Player* player = handler->GetSession()->GetPlayer();
2695
2696 handler->GetSession()->SendShowMailBox(player->GetGUID());
2697 return true;
2698 }
2699};
2700
2702{
2703 new misc_commandscript();
2704}
#define sCharacterCache
@ CHAR_SEL_PINFO_XP
@ CHAR_SEL_PVPSTATS_FACTIONS_OVERALL
@ CHAR_SEL_CHAR_HOMEBIND
@ CHAR_DEL_CHAR_AURA_FROZEN
@ CHAR_SEL_CHARACTER_AURA_FROZEN
@ CHAR_SEL_GUILD_MEMBER_EXTENDED
@ CHAR_SEL_CHAR_PINFO
@ CHAR_SEL_PINFO_MAILS
@ CHAR_SEL_PINFO_BANS
#define EXACT_SEQUENCE(str)
LocaleConstant
Definition: Common.h:48
@ IN_MILLISECONDS
Definition: Common.h:35
@ MINUTE
Definition: Common.h:29
AccountTypes
Definition: Common.h:39
DB2Storage< SkillLineEntry > sSkillLineStore("SkillLine.db2", &SkillLineLoadInfo::Instance)
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
DB2Storage< ItemSparseEntry > sItemSparseStore("ItemSparse.db2", &ItemSparseLoadInfo::Instance)
DB2Storage< SoundKitEntry > sSoundKitStore("SoundKit.db2", &SoundKitLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
#define sDB2Manager
Definition: DB2Stores.h:538
@ DIFFICULTY_NONE
Definition: DBCEnums.h:874
#define MAX_EFFECT_MASK
Definition: DBCEnums.h:1954
ItemContext
Definition: DBCEnums.h:1063
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint8_t uint8
Definition: Define.h:144
int64_t int64
Definition: Define.h:137
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
#define UI64LIT(N)
Definition: Define.h:127
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
#define MAX_NUMBER_OF_GRIDS
Definition: GridDefines.h:38
#define MAX_HEIGHT
Definition: GridDefines.h:60
#define sIPLocation
Definition: IPLocation.h:51
InventoryResult
Definition: ItemDefines.h:25
@ EQUIP_ERR_OK
Definition: ItemDefines.h:26
ItemRandomBonusListId GenerateItemRandomBonusListId(uint32 item_id)
@ LANG_COMMAND_KICKSELF
Definition: Language.h:333
@ LANG_COMMAND_KICKMESSAGE_WORLD
Definition: Language.h:1218
@ LANG_YES
Definition: Language.h:479
@ LANG_MOVEGENS_FOLLOW_PLAYER
Definition: Language.h:912
@ LANG_CHARACTER_GENDER_FEMALE
Definition: Language.h:801
@ LANG_DEV_ON
Definition: Language.h:910
@ LANG_COMMAND_GRAVEYARDALRLINKED
Definition: Language.h:510
@ LANG_MOVEGENS_EFFECT
Definition: Language.h:915
@ LANG_SELECT_CREATURE
Definition: Language.h:32
@ LANG_PINFO_CHR_GUILD_NOTE
Definition: Language.h:793
@ LANG_PINFO_CHR_ALIVE
Definition: Language.h:787
@ LANG_SUMMONING
Definition: Language.h:142
@ LANG_NO_REASON
Definition: Language.h:1091
@ LANG_PINFO_ACC_LASTLOGIN
Definition: Language.h:781
@ LANG_CHARACTER
Definition: Language.h:1096
@ LANG_UNKNOWN
Definition: Language.h:77
@ LANG_COMMAND_GRAVEYARD_ALLIANCE
Definition: Language.h:517
@ LANG_COMMAND_OBJNOTFOUND
Definition: Language.h:325
@ LANG_MOVEGENS_UNKNOWN
Definition: Language.h:612
@ LANG_ERROR
Definition: Language.h:78
@ LANG_PERMANENTLY
Definition: Language.h:1097
@ LANG_COMMAND_ZONENOGRAFACTION
Definition: Language.h:521
@ LANG_NO_WEATHER
Definition: Language.h:460
@ LANG_DEV_OFF
Definition: Language.h:911
@ LANG_OFFLINE
Definition: Language.h:69
@ LANG_PLAYERS_SAVED
Definition: Language.h:47
@ LANG_PINFO_CHR_LEVEL_LOW
Definition: Language.h:785
@ LANG_CANNOT_GO_TO_INST_PARTY
Definition: Language.h:138
@ LANG_PINFO_CHR_PLAYEDTIME
Definition: Language.h:795
@ LANG_UNAUTHORIZED
Definition: Language.h:1086
@ LANG_COMMAND_PLAYED_TO_ALL
Definition: Language.h:1064
@ LANG_GPS_POSITION_INDOORS
Definition: Language.h:1099
@ LANG_COMMAND_DISABLE_CHAT_DELAYED
Definition: Language.h:335
@ LANG_IS_TELEPORTED
Definition: Language.h:136
@ LANG_LIQUID_STATUS
Definition: Language.h:217
@ LANG_COMMAND_COULDNOTFIND
Definition: Language.h:494
@ LANG_COMMAND_FREEZE_ERROR
Definition: Language.h:1056
@ LANG_COMMAND_NOCREATUREFOUND
Definition: Language.h:507
@ LANG_PINFO_CHR_RACE
Definition: Language.h:786
@ LANG_PINFO_CHR_MAP_WITH_AREA
Definition: Language.h:798
@ LANG_ITEM_CANNOT_CREATE
Definition: Language.h:565
@ LANG_MOVEGENS_CHASE_PLAYER
Definition: Language.h:606
@ LANG_COMMAND_GRAVEYARDNOEXIST
Definition: Language.h:509
@ LANG_CANT_TELEPORT_SELF
Definition: Language.h:213
@ LANG_PVPSTATS
Definition: Language.h:112
@ LANG_APPEARING_AT
Definition: Language.h:147
@ LANG_MOVEGENS_IDLE
Definition: Language.h:601
@ LANG_YOU
Definition: Language.h:76
@ LANG_MOVEGENS_CONFUSED
Definition: Language.h:605
@ LANG_PINFO_PLAYER
Definition: Language.h:776
@ LANG_COMMAND_LIST_FREEZE
Definition: Language.h:1060
@ LANG_MOVEGENS_FOLLOW_CREATURE
Definition: Language.h:913
@ LANG_MOVEGENS_FOLLOW_NULL
Definition: Language.h:914
@ LANG_PLAYER_SAVED
Definition: Language.h:46
@ LANG_PINFO_ACC_OS
Definition: Language.h:782
@ LANG_UNEXPLORE_AREA
Definition: Language.h:642
@ LANG_CHARACTER_GENDER_MALE
Definition: Language.h:800
@ LANG_MOVEGENS_DISTRACT
Definition: Language.h:677
@ LANG_YOUR_CHAT_DISABLED
Definition: Language.h:355
@ LANG_COMMAND_GRAVEYARDWRONGZONE
Definition: Language.h:512
@ LANG_COMMAND_NO_FROZEN_PLAYERS
Definition: Language.h:1059
@ LANG_CHAT_ALREADY_ENABLED
Definition: Language.h:357
@ LANG_COMMAND_GRAVEYARDNEAREST
Definition: Language.h:519
@ LANG_WEATHER_DISABLED
Definition: Language.h:461
@ LANG_GAMEOBJECT_DAMAGED
Definition: Language.h:219
@ LANG_COMMAND_UNFREEZE
Definition: Language.h:1058
@ LANG_NO_ITEMS_FROM_ITEMSET_FOUND
Definition: Language.h:570
@ LANG_PINFO_CHR_MONEY
Definition: Language.h:789
@ LANG_REMOVE_COOLDOWN
Definition: Language.h:560
@ LANG_INVALID_SKILL_ID
Definition: Language.h:553
@ LANG_YOU_REPAIR_ITEMS
Definition: Language.h:392
@ LANG_YOU_ENABLE_CHAT
Definition: Language.h:359
@ LANG_YOUR_CHAT_ENABLED
Definition: Language.h:358
@ LANG_COMMAND_TEMP_FROZEN_PLAYER
Definition: Language.h:1075
@ LANG_CANNOT_SUMMON_INST_INST
Definition: Language.h:141
@ LANG_PINFO_CHR_LEVEL_HIGH
Definition: Language.h:797
@ LANG_NO
Definition: Language.h:480
@ LANG_COMMAND_MUTEMESSAGE_WORLD
Definition: Language.h:1221
@ LANG_CANNOT_SUMMON_TO_INST
Definition: Language.h:137
@ LANG_UNKNOWN_SPELL
Definition: Language.h:557
@ LANG_YOUR_ITEMS_REPAIRED
Definition: Language.h:393
@ LANG_YOU_DISABLE_CHAT
Definition: Language.h:356
@ LANG_COMMAND_GRAVEYARDLINKED
Definition: Language.h:511
@ LANG_PINFO_CHR_MAP
Definition: Language.h:790
@ LANG_CHAR_NON_MOUNTED
Definition: Language.h:54
@ LANG_NO_CHAR_SELECTED
Definition: Language.h:150
@ LANG_OBJECT_GUID
Definition: Language.h:245
@ LANG_TRANSPORT_POSITION
Definition: Language.h:230
@ LANG_MOVEGENS_CHASE_CREATURE
Definition: Language.h:607
@ LANG_PINFO_ACC_IP
Definition: Language.h:784
@ LANG_CONSOLE
Definition: Language.h:1095
@ LANG_COMMAND_ZONENOGRAVEYARDS
Definition: Language.h:520
@ LANG_INVALID_GAMEOBJECT_TYPE
Definition: Language.h:218
@ LANG_SELECT_CHAR_OR_CREATURE
Definition: Language.h:31
@ LANG_COMMAND_NOGAMEOBJECTFOUND
Definition: Language.h:508
@ LANG_MOVEGENS_RANDOM
Definition: Language.h:602
@ LANG_REMOVEITEM_FAILURE
Definition: Language.h:688
@ LANG_PINFO_BANNED
Definition: Language.h:778
@ LANG_PLAYER_NOT_FOUND
Definition: Language.h:567
@ LANG_COMMAND_MUTEHISTORY_OUTPUT
Definition: Language.h:1121
@ LANG_COMMAND_MUTEHISTORY_EMPTY
Definition: Language.h:1120
@ LANG_SOUND_NOT_EXIST
Definition: Language.h:212
@ LANG_SUMMONED_BY
Definition: Language.h:143
@ LANG_MOVEGENS_WAYPOINT
Definition: Language.h:603
@ LANG_MOVEGENS_POINT
Definition: Language.h:675
@ LANG_PINFO_CHR_GUILD_RANK
Definition: Language.h:792
@ LANG_CANNOT_GO_TO_INST_GM
Definition: Language.h:139
@ LANG_PINFO_ACC_ACCOUNT
Definition: Language.h:780
@ LANG_EXPLORE_AREA
Definition: Language.h:641
@ LANG_COMMAND_GRAVEYARD_NOTEAM
Definition: Language.h:515
@ LANG_ACCOUNT
Definition: Language.h:829
@ LANG_PINFO_ACC_REGMAILS
Definition: Language.h:783
@ LANG_BAD_VALUE
Definition: Language.h:149
@ LANG_ADDITEM
Definition: Language.h:562
@ LANG_COMMAND_MUTEHISTORY
Definition: Language.h:1119
@ LANG_PVPSTATS_DISABLED
Definition: Language.h:113
@ LANG_PINFO_GM_ACTIVE
Definition: Language.h:777
@ LANG_CANNOT_GO_TO_BG_GM
Definition: Language.h:725
@ LANG_COMMAND_FREEZE
Definition: Language.h:1055
@ LANG_PINFO_CHR_MAILS
Definition: Language.h:796
@ LANG_COMMAND_PERMA_FROZEN_PLAYER
Definition: Language.h:1061
@ LANG_MOVEGENS_CHASE_NULL
Definition: Language.h:608
@ LANG_GPS_POSITION_OUTDOORS
Definition: Language.h:1098
@ LANG_MOVEGENS_FLIGHT
Definition: Language.h:611
@ LANG_ACCOUNT_NOT_EXIST
Definition: Language.h:470
@ LANG_COMMAND_KICKMESSAGE
Definition: Language.h:334
@ LANG_PINFO_CHR_GUILD
Definition: Language.h:791
@ LANG_CHAR_IN_FLIGHT
Definition: Language.h:53
@ LANG_COMMAND_GRAVEYARDERROR
Definition: Language.h:514
@ LANG_COMMAND_FREEZE_WRONG
Definition: Language.h:1057
@ LANG_PINFO_CHR_GUILD_ONOTE
Definition: Language.h:794
@ LANG_MAP_POSITION
Definition: Language.h:135
@ LANG_MOVEGENS_HOME_CREATURE
Definition: Language.h:609
@ LANG_GRID_POSITION
Definition: Language.h:220
@ LANG_SET_SKILL
Definition: Language.h:550
@ LANG_NO_SELECTION
Definition: Language.h:244
@ LANG_MOVEGENS_HOME_PLAYER
Definition: Language.h:610
@ LANG_MOVEGENS_LIST
Definition: Language.h:600
@ LANG_GPS_NO_VMAP
Definition: Language.h:1100
@ LANG_DISTANCE
Definition: Language.h:572
@ LANG_COMMAND_GRAVEYARD_HORDE
Definition: Language.h:518
@ LANG_COMMAND_GRAVEYARD_ANY
Definition: Language.h:516
@ LANG_MOVEGENS_FEAR
Definition: Language.h:676
@ LANG_REMOVEITEM
Definition: Language.h:564
@ LANG_PINFO_MUTED
Definition: Language.h:779
@ LANG_REMOVEALL_COOLDOWN
Definition: Language.h:559
@ LANG_COMMAND_ITEMIDINVALID
Definition: Language.h:495
@ LOGIN_SEL_PINFO
Definition: LoginDatabase.h:82
@ LOGIN_SEL_ACCOUNT_MUTE_INFO
@ LOGIN_UPD_MUTE_TIME
Definition: LoginDatabase.h:67
@ LOGIN_SEL_PINFO_BANS
Definition: LoginDatabase.h:83
@ LOGIN_INS_ACCOUNT_MUTE
ZLiquidStatus
Definition: MapDefines.h:125
@ DISTRACT_MOTION_TYPE
@ IDLE_MOTION_TYPE
@ CHASE_MOTION_TYPE
@ WAYPOINT_MOTION_TYPE
@ FLEEING_MOTION_TYPE
@ CONFUSED_MOTION_TYPE
@ HOME_MOTION_TYPE
@ POINT_MOTION_TYPE
@ FLIGHT_MOTION_TYPE
@ FOLLOW_MOTION_TYPE
@ RANDOM_MOTION_TYPE
@ EFFECT_MOTION_TYPE
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:393
HighGuid
Definition: ObjectGuid.h:75
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:154
std::unordered_map< uint32, ItemTemplate > ItemTemplateContainer
Definition: ObjectMgr.h:518
#define sObjectMgr
Definition: ObjectMgr.h:1946
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:750
@ TELE_TO_GM_MODE
Definition: Player.h:802
@ TELE_TO_NONE
Definition: Player.h:801
@ PLAYER_FLAGS_GHOST
Definition: Player.h:432
@ PLAYER_EXPLORED_ZONES_BITS
Definition: Player.h:148
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:625
SpellSchoolMask
@ SPELL_SCHOOL_MASK_NORMAL
constexpr BattlegroundQueueTypeId BATTLEGROUND_QUEUE_NONE
@ BASE_ATTACK
@ ALLIANCE
@ HORDE
@ SILVER
@ GOLD
WeatherType
@ SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW
@ SPAWN_TYPEMASK_ALL
Definition: SpawnData.h:48
@ SPELL_AURA_MOUNTED
#define sSpellMgr
Definition: SpellMgr.h:849
@ SPELL_CAST_SOURCE_NORMAL
Definition: Spell.h:146
@ HITINFO_AFFECTS_VICTIM
Definition: UnitDefines.h:450
@ DIRECT_DAMAGE
Definition: UnitDefines.h:132
@ SPELL_DIRECT_DAMAGE
Definition: UnitDefines.h:133
@ VICTIMSTATE_HIT
Definition: Unit.h:49
@ NULL_BAG
Definition: Unit.h:62
@ NULL_SLOT
Definition: Unit.h:63
bool StringEqualI(std::string_view a, std::string_view b)
Definition: Util.cpp:891
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
Definition: Util.cpp:795
std::string secsToTimeString(uint64 timeInSecs, TimeFormat timeFormat, bool hoursOnly)
Definition: Util.cpp:115
bool isNumeric(wchar_t wchar)
Definition: Util.h:189
static uint32 GetId(std::string_view username)
Definition: AccountMgr.cpp:289
static Aura * TryRefreshStackOrCreate(AuraCreateInfo &createInfo, bool updateEffectMask=true)
Definition: SpellAuras.cpp:337
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:892
char * extractKeyFromLink(char *text, char const *linkType, char **something1=nullptr)
Definition: Chat.cpp:262
Player * getSelectedPlayerOrSelf()
Definition: Chat.cpp:244
virtual bool HasPermission(uint32 permission) const
Definition: Chat.cpp:53
std::string playerLink(std::string const &name) const
Definition: Chat.cpp:602
Unit * getSelectedUnit()
Definition: Chat.cpp:212
Player * getSelectedPlayer()
Definition: Chat.cpp:200
WorldSession * GetSession()
Definition: Chat.h:42
virtual LocaleConstant GetSessionDbcLocale() const
Definition: Chat.cpp:592
virtual std::string GetNameLink() const
Definition: Chat.cpp:58
Creature * GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
Definition: Chat.cpp:397
void PSendSysMessage(const char *fmt, Args &&... args)
Definition: Chat.h:57
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:63
Creature * getSelectedCreature()
Definition: Chat.cpp:236
GameObject * GetObjectFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
Definition: Chat.cpp:387
void SetSentErrorMessage(bool val)
Definition: Chat.h:114
Player * GetPlayer() const
Definition: Chat.cpp:39
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:113
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:586
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=nullptr, std::string *player_name=nullptr)
Definition: Chat.cpp:489
ObjectGuid::LowType extractLowGuidFromLink(char *text, HighGuid &guidHigh)
Definition: Chat.cpp:428
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:48
void Respawn(bool force=false)
Definition: Creature.cpp:2303
static char const * GetChrRaceName(uint8 race, LocaleConstant locale=DEFAULT_LOCALE)
Definition: DB2Stores.cpp:2077
static char const * GetClassName(uint8 class_, LocaleConstant locale=DEFAULT_LOCALE)
Definition: DB2Stores.cpp:2035
uint32 GetResist() const
Definition: Unit.h:449
uint32 GetDamage() const
Definition: Unit.h:446
uint32 GetAbsorb() const
Definition: Unit.h:448
constexpr std::underlying_type_t< T > AsUnderlyingType() const
Definition: EnumFlag.h:122
Class used to access individual fields of database query result.
Definition: Field.h:90
uint8 GetUInt8() const
Definition: Field.cpp:30
std::string GetString() const
Definition: Field.cpp:118
uint64 GetUInt64() const
Definition: Field.cpp:78
uint16 GetUInt16() const
Definition: Field.cpp:46
uint32 GetUInt32() const
Definition: Field.cpp:62
int32 GetInt32() const
Definition: Field.cpp:70
GameObjectValue const * GetGOValue() const
Definition: GameObject.h:206
void ModifyHealth(int32 change, WorldObject *attackerOrHealer=nullptr, uint32 spellId=0)
bool IsDestructibleBuilding() const
Definition: Group.h:197
Definition: Item.h:170
void SetBinding(bool val)
Definition: Item.h:201
static MMapManager * createOrGetMMapManager()
Definition: MMapFactory.cpp:26
dtNavMesh const * GetNavMesh(uint32 mapId)
Definition: Map.h:189
bool IsDungeon() const
Definition: Map.cpp:3238
ZLiquidStatus GetLiquidStatus(PhaseShift const &phaseShift, float x, float y, float z, Optional< map_liquidHeaderTypeFlags > ReqLiquidType={}, LiquidData *data=nullptr, float collisionHeight=2.03128f)
Definition: Map.cpp:1726
bool IsBattlegroundOrArena() const
Definition: Map.cpp:3340
Weather * GetOrGenerateZoneDefaultWeather(uint32 zoneId)
Definition: Map.cpp:3930
bool IsRaid() const
Definition: Map.cpp:3248
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:519
float GetMinHeight(PhaseShift const &phaseShift, float x, float y)
Definition: Map.cpp:1747
Difficulty GetDifficultyID() const
Definition: Map.h:324
uint32 GetId() const
Definition: Map.cpp:3228
RespawnInfo * GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const
Definition: Map.cpp:2140
uint32 GetInstanceId() const
Definition: Map.h:314
void Respawn(RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
Definition: Map.cpp:2058
std::vector< MovementGeneratorInformation > GetMovementGeneratorsInformation() const
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
bool GetDestination(float &x, float &y, float &z)
bool Empty() const
LowType GetCounter() const
Definition: ObjectGuid.h:293
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
bool IsEmpty() const
Definition: ObjectGuid.h:319
std::string ToString() const
Definition: ObjectGuid.cpp:554
uint64 LowType
Definition: ObjectGuid.h:278
TypeID GetTypeId() const
Definition: Object.h:173
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static Player * ToPlayer(Object *o)
Definition: Object.h:213
static void PrintToChat(ChatHandler *chat, WorldObject const *target)
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
void StopCastingBindSight() const
Definition: Player.cpp:26129
bool IsValidPos(uint16 pos, bool explicit_pos) const
Definition: Player.h:1374
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition: Player.cpp:13254
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId=0, GuidSet const &allowedLooters=GuidSet(), ItemContext context=ItemContext::NONE, std::vector< int32 > const *bonusListIDs=nullptr, bool addToCollection=true)
Definition: Player.cpp:11537
uint32 GetSaveTimer() const
Definition: Player.h:2488
BattlegroundTypeId GetBattlegroundTypeId() const
Definition: Player.h:2397
uint32 GetTotalPlayedTime() const
Definition: Player.h:1214
void SetBattlegroundId(uint32 val, BattlegroundTypeId bgTypeId, BattlegroundQueueTypeId queueId)
Definition: Player.cpp:25030
Gender GetNativeGender() const override
Definition: Player.h:1217
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:6052
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={})
Definition: Player.cpp:1250
static void OfflineResurrect(ObjectGuid const &guid, CharacterDatabaseTransaction trans)
Definition: Player.cpp:4529
void SetBattlegroundEntryPoint()
Definition: Player.cpp:23560
void SetDeveloper(bool on)
Definition: Player.h:1175
void SpawnCorpseBones(bool triggerSave=true)
Definition: Player.cpp:4598
void SetRaidDifficultyID(Difficulty raid_difficulty)
Definition: Player.h:2016
void LeaveBattleground(bool teleportToEntryPoint=true)
Definition: Player.cpp:23614
void DurabilityRepairAll(bool takeCost, float discountMod, bool guildBank)
Definition: Player.cpp:4718
static void SavePositionInDB(WorldLocation const &loc, uint16 zoneId, ObjectGuid guid, CharacterDatabaseTransaction trans)
Definition: Player.cpp:21279
void SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal)
Definition: Player.cpp:5786
WorldLocation m_homebind
Definition: Player.h:2503
void SwapItem(uint16 src, uint16 dst)
Definition: Player.cpp:12763
WorldSession * GetSession() const
Definition: Player.h:2101
Item * GetItemByPos(uint16 pos) const
Definition: Player.cpp:9582
void SaveRecallPosition()
Definition: Player.h:2491
void RepopAtGraveyard()
Definition: Player.cpp:4832
Difficulty GetDungeonDifficultyID() const
Definition: Player.h:2012
void SetLegacyRaidDifficultyID(Difficulty raid_difficulty)
Definition: Player.h:2017
uint16 GetPureMaxSkillValue(uint32 skill) const
Definition: Player.cpp:6082
uint32 DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition: Player.cpp:12281
void AddExploredZones(uint32 pos, uint64 mask)
Definition: Player.cpp:6421
void FinishTaxiFlight()
Definition: Player.cpp:22706
void Recall()
Definition: Player.h:2496
uint16 GetSkillStep(uint32 skill) const
Definition: Player.cpp:6040
bool IsGameMaster() const
Definition: Player.h:1178
static bool LoadPositionFromDB(uint32 &mapid, float &x, float &y, float &z, float &o, bool &in_flight, ObjectGuid guid)
Definition: Player.cpp:17560
void SetDungeonDifficultyID(Difficulty dungeon_difficulty)
Definition: Player.h:2015
void RemoveExploredZones(uint32 pos, uint64 mask)
Definition: Player.cpp:6429
Difficulty GetRaidDifficultyID() const
Definition: Player.h:2013
void SaveToDB(bool create=false)
Definition: Player.cpp:19978
uint32 GetBattlegroundId() const
Definition: Player.h:2396
uint64 GetMoney() const
Definition: Player.h:1738
bool IsDeveloper() const
Definition: Player.h:1174
Group * GetGroup(Optional< uint8 > partyIndex)
Definition: Player.h:2606
void UpdateObjectVisibility(bool forced=true) override
Definition: Player.cpp:24070
Difficulty GetLegacyRaidDifficultyID() const
Definition: Player.h:2014
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition: Player.cpp:10032
bool IsBeingTeleported() const
Definition: Player.h:2219
void SendNewItem(Item *item, uint32 quantity, bool received, bool created, bool broadcast=false, uint32 dungeonEncounterId=0)
Definition: Player.cpp:13990
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition: Player.cpp:4408
void setInt32(const uint8 index, const int32 value)
void setInt64(const uint8 index, const int64 value)
void setUInt32(const uint8 index, const uint32 value)
void setString(const uint8 index, const std::string &value)
void setUInt64(const uint8 index, const uint64 value)
void ResetAllCharges()
void ResetCooldown(uint32 spellId, bool update=false)
void ResetAllCooldowns()
void ResetCharges(uint32 chargeCategoryId)
uint32 const Id
Definition: SpellInfo.h:325
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, SpellCastVisual spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, int32 *param1=nullptr, int32 *param2=nullptr)
Definition: Spell.cpp:4643
static bool ExistVMap(uint32 mapid, int32 gx, int32 gy)
Definition: TerrainMgr.cpp:110
static bool ExistMap(uint32 mapid, int32 gx, int32 gy, bool log=true)
Definition: TerrainMgr.cpp:77
Definition: Unit.h:627
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true)
Definition: Unit.cpp:769
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3812
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition: Unit.cpp:5827
uint8 GetClass() const
Definition: Unit.h:752
static void DealDamageMods(Unit const *attacker, Unit const *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:748
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition: Unit.cpp:5488
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1248
static void CalcAbsorbResist(DamageInfo &damageInfo, Spell *spell=nullptr)
Definition: Unit.cpp:1797
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool IsPet() const
Definition: Unit.h:740
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit *victim, uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK, uint8 attackerLevel=0)
Definition: Unit.cpp:1625
void Dismount()
Definition: Unit.cpp:7920
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
bool IsAlive() const
Definition: Unit.h:1164
float GetCombatReach() const override
Definition: Unit.h:694
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:5378
bool IsInFlight() const
Definition: Unit.h:1012
bool isPossessing() const
Definition: Unit.cpp:6465
uint64 GetHealth() const
Definition: Unit.h:776
bool IsMounted() const
Definition: Unit.h:898
void RemoveAllAuras()
Definition: Unit.cpp:4242
SpellHistory * GetSpellHistory()
Definition: Unit.h:1457
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr)
Definition: Unit.cpp:1616
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.cpp:10591
ObjectGuid GetTarget() const
Definition: Unit.h:1759
uint8 GetLevel() const
Definition: Unit.h:746
uint8 GetRace() const
Definition: Unit.h:749
void RemoveCharmAuras()
Definition: Unit.cpp:6551
bool IsInCombat() const
Definition: Unit.h:1043
bool isDead() const
Definition: Unit.h:1166
Weather for one zone.
Definition: Weather.h:66
constexpr uint32 GetMapId() const
Definition: Position.h:201
Map * GetMap() const
Definition: Object.h:624
float GetGridActivationRange() const
Definition: Object.cpp:1431
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
Definition: Object.cpp:3403
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
PhaseShift & GetPhaseShift()
Definition: Object.h:523
TransportBase * GetTransport() const
Definition: Object.h:750
uint32 GetInstanceId() const
Definition: Object.h:521
bool IsOutdoors() const
Definition: Object.h:549
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1096
std::string const & GetName() const
Definition: Object.h:555
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Object.cpp:2252
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1078
uint32 GetAreaId() const
Definition: Object.h:546
uint32 GetZoneId() const
Definition: Object.h:545
WorldPacket const * Write() override
Player session in the World.
Definition: WorldSession.h:963
void SendNotification(char const *format,...) ATTR_PRINTF(2
AccountTypes GetSecurity() const
Definition: WorldSession.h:999
void KickPlayer(std::string const &reason)
Kick a player out of the World.
Player * GetPlayer() const
bool CanSpeak() const
bool HasPermission(uint32 permissionId)
uint32 GetAccountId() const
void SendShowMailBox(ObjectGuid guid)
Definition: NPCHandler.cpp:88
void SendShowBank(ObjectGuid guid)
uint32 GetLatency() const
std::string const & GetPlayerName() const
time_t m_muteTime
static bool HandleDevCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition: cs_misc.cpp:157
static bool HandleGetDistanceCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:757
static bool HandleAddItemSetCommand(ChatHandler *handler, Variant< Hyperlink< itemset >, uint32 > itemSetId, Optional< std::string_view > bonuses, Optional< uint8 > context)
Definition: cs_misc.cpp:1470
static bool HandleMuteHistoryHelper(uint32 accountId, char const *accountName, ChatHandler *handler)
Definition: cs_misc.cpp:2180
static bool HandleDamageCommand(ChatHandler *handler, uint32 damage, Optional< SpellSchools > school, Optional< SpellInfo const * > spellInfo)
Definition: cs_misc.cpp:2311
static bool HandleSaveCommand(ChatHandler *handler)
Definition: cs_misc.cpp:843
static bool HandleAuraCommand(ChatHandler *handler, SpellInfo const *spell)
Definition: cs_misc.cpp:304
static bool HandleUnbindSightCommand(ChatHandler *handler)
Definition: cs_misc.cpp:2681
static bool HandleCooldownCommand(ChatHandler *handler, Optional< SpellInfo const * > spellArg)
Definition: cs_misc.cpp:716
static bool HandleSummonCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:478
static bool HandleMuteCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, uint32 muteTime, Tail muteReason)
Definition: cs_misc.cpp:2036
static bool HandleBankCommand(ChatHandler *handler)
Definition: cs_misc.cpp:1546
static bool HandleListFreezeCommand(ChatHandler *handler)
Definition: cs_misc.cpp:2599
static bool HandleReviveCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:627
static bool HandleUnAuraCommand(ChatHandler *handler, Variant< SpellInfo const *, EXACT_SEQUENCE("all")> spellArg)
Definition: cs_misc.cpp:326
static bool HandleShowAreaCommand(ChatHandler *handler, uint32 areaId)
Definition: cs_misc.cpp:1090
ChatCommandTable GetCommands() const override
Definition: cs_misc.cpp:69
static bool HandleCommandsCommand(ChatHandler *handler)
Definition: cs_misc.cpp:595
static bool HandleMailBoxCommand(ChatHandler *handler)
Definition: cs_misc.cpp:2692
static bool HandleDieCommand(ChatHandler *handler)
Definition: cs_misc.cpp:601
static bool HandlePInfoCommand(ChatHandler *handler, Optional< PlayerIdentifier > arg)
Definition: cs_misc.cpp:1630
static bool HandleKickPlayerCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:875
static bool HandleChangeWeather(ChatHandler *handler, WeatherType type, float intensity)
Definition: cs_misc.cpp:1552
static bool HandleHelpCommand(ChatHandler *handler, Tail cmd)
Definition: cs_misc.cpp:688
static bool HandleRespawnCommand(ChatHandler *handler)
Definition: cs_misc.cpp:1996
static bool HandleAddItemToCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1310
static bool HandleMovegensCommand(ChatHandler *handler)
Definition: cs_misc.cpp:2211
static bool HandleGUIDCommand(ChatHandler *handler)
Definition: cs_misc.cpp:673
static bool HandlePlayAllCommand(ChatHandler *handler, uint32 soundId, Optional< int32 > broadcastTextId)
Definition: cs_misc.cpp:2635
static bool HandleGPSCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:181
static bool HandleSaveAllCommand(ChatHandler *handler)
Definition: cs_misc.cpp:867
static bool HandleUnFreezeCommand(ChatHandler *handler, Optional< std::string > targetNameArg)
Definition: cs_misc.cpp:2542
static bool HandleDamageGoCommand(ChatHandler *handler, Variant< Hyperlink< gameobject >, ObjectGuid::LowType > spawnId, int32 damage)
Definition: cs_misc.cpp:2373
static bool HandleBindSightCommand(ChatHandler *handler)
Definition: cs_misc.cpp:2671
static bool HandleComeToMeCommand(ChatHandler *handler)
Definition: cs_misc.cpp:2294
static bool HandleAddItemCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:1156
static bool HandleUnPossessCommand(ChatHandler *handler)
Definition: cs_misc.cpp:2660
static bool HandleNearGraveCommand(ChatHandler *handler, Optional< std::string > teamArg)
Definition: cs_misc.cpp:1032
static bool HandleUnmuteCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2111
static bool HandleDismountCommand(ChatHandler *handler)
Definition: cs_misc.cpp:649
static bool HandleRecallCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:820
static bool HandleCombatStopCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2395
static bool HandleHideAreaCommand(ChatHandler *handler, uint32 areaId)
Definition: cs_misc.cpp:1123
static bool HandlePvPstatsCommand(ChatHandler *handler)
Definition: cs_misc.cpp:128
static bool HandleMuteHistoryCommand(ChatHandler *handler, std::string accountName)
Definition: cs_misc.cpp:2160
static bool HandleLinkGraveCommand(ChatHandler *handler, uint32 graveyardId, Optional< std::string > teamArg)
Definition: cs_misc.cpp:990
static bool HandleRepairitemsCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2424
static bool HandleFreezeCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:2444
static bool HandleSetSkillCommand(ChatHandler *handler, Variant< Hyperlink< skill >, uint32 > skillId, uint32 level, Optional< uint32 > maxSkillArg)
Definition: cs_misc.cpp:1578
static bool HandleItemMoveCommand(ChatHandler *handler, uint8 srcSlot, uint8 dstSlot)
Definition: cs_misc.cpp:697
static bool HandlePossessCommand(ChatHandler *handler)
Definition: cs_misc.cpp:2650
static bool HandleUnstuckCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:911
static bool HandleAppearCommand(ChatHandler *handler, char const *args)
Definition: cs_misc.cpp:352
#define SPELL_UNSTUCK_VISUAL
#define SPELL_UNSTUCK_ID
void AddSC_misc_commandscript()
Definition: cs_misc.cpp:2701
#define sWorld
Definition: World.h:931
Realm realm
Definition: World.cpp:3966
void SetWeather(WeatherType type, float intensity)
Set the weather.
Definition: Weather.cpp:274
@ CONFIG_MAX_PLAYER_LEVEL
Definition: World.h:259
@ CONFIG_GM_FREEZE_DURATION
Definition: World.h:290
@ CONFIG_INTERVAL_SAVE
Definition: World.h:234
@ CONFIG_SHOW_KICK_IN_WORLD
Definition: World.h:151
@ CONFIG_WEATHER
Definition: World.h:124
@ CONFIG_SHOW_MUTE_IN_WORLD
Definition: World.h:152
@ CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE
Definition: World.h:139
@ CONFIG_DIE_COMMAND_MODE
Definition: World.h:134
bool IsPathfindingEnabled(uint32 mapId)
Definition: DisableMgr.cpp:401
time_t GetGameTime()
Definition: GameTime.cpp:44
std::vector< int32 > GetBonusListsForItem(uint32 itemId, ItemBonusGenerationParams const &params)
TC_GAME_API Player * FindPlayerByName(std::string_view name)
TC_GAME_API void SaveAllPlayers()
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
TC_GAME_API void SendCommandHelpFor(ChatHandler &handler, std::string_view cmd)
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:49
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition: Util.cpp:56
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:194
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:206
@ RBAC_PERM_COMMAND_COMMANDS
Definition: RBAC.h:368
@ RBAC_PERM_COMMAND_DISMOUNT
Definition: RBAC.h:373
@ RBAC_PERM_COMMAND_POSSESS
Definition: RBAC.h:391
@ RBAC_PERM_COMMAND_NEARGRAVE
Definition: RBAC.h:388
@ RBAC_PERM_COMMAND_PLAYALL
Definition: RBAC.h:390
@ RBAC_PERM_COMMAND_UNFREEZE
Definition: RBAC.h:403
@ RBAC_PERM_COMMAND_MUTE
Definition: RBAC.h:387
@ RBAC_PERM_COMMAND_HIDEAREA
Definition: RBAC.h:380
@ RBAC_PERM_COMMAND_SHOWAREA
Definition: RBAC.h:399
@ RBAC_PERM_COMMAND_REPAIRITEMS
Definition: RBAC.h:393
@ RBAC_PERM_COMMAND_BINDSIGHT
Definition: RBAC.h:365
@ RBAC_PERM_COMMAND_ADDITEM
Definition: RBAC.h:360
@ RBAC_PERM_COMMAND_DEV
Definition: RBAC.h:371
@ RBAC_PERM_COMMAND_RESPAWN
Definition: RBAC.h:394
@ RBAC_PERM_COMMAND_PVPSTATS
Definition: RBAC.h:669
@ RBAC_PERM_COMMAND_UNMUTE
Definition: RBAC.h:404
@ RBAC_PERM_COMMAND_HELP
Definition: RBAC.h:379
@ RBAC_PERM_COMMAND_COOLDOWN
Definition: RBAC.h:369
@ RBAC_PERM_COMMAND_COMETOME
Definition: RBAC.h:367
@ RBAC_PERM_COMMAND_COMBATSTOP
Definition: RBAC.h:366
@ RBAC_PERM_COMMAND_SETSKILL
Definition: RBAC.h:398
@ RBAC_PERM_COMMAND_ADDITEMSET
Definition: RBAC.h:361
@ RBAC_PERM_COMMAND_AURA
Definition: RBAC.h:363
@ RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY
Definition: RBAC.h:83
@ RBAC_PERM_COMMAND_MOVEGENS
Definition: RBAC.h:386
@ RBAC_PERM_COMMAND_UNSTUCK
Definition: RBAC.h:406
@ RBAC_PERM_COMMAND_REVIVE
Definition: RBAC.h:395
@ RBAC_PERM_COMMAND_APPEAR
Definition: RBAC.h:362
@ RBAC_PERM_COMMAND_FREEZE
Definition: RBAC.h:376
@ RBAC_PERM_COMMAND_BANK
Definition: RBAC.h:364
@ RBAC_PERM_COMMAND_GPS
Definition: RBAC.h:377
@ RBAC_PERM_COMMAND_UNPOSSESS
Definition: RBAC.h:405
@ RBAC_PERM_COMMAND_SUMMON
Definition: RBAC.h:400
@ RBAC_PERM_COMMAND_RECALL
Definition: RBAC.h:392
@ RBAC_PERM_COMMAND_DIE
Definition: RBAC.h:372
@ RBAC_PERM_COMMAND_ITEMMOVE
Definition: RBAC.h:381
@ RBAC_PERM_COMMAND_MAILBOX
Definition: RBAC.h:649
@ RBAC_PERM_COMMAND_SAVE
Definition: RBAC.h:397
@ RBAC_PERM_COMMAND_LISTFREEZE
Definition: RBAC.h:384
@ RBAC_PERM_COMMAND_UNBINDSIGHT
Definition: RBAC.h:402
@ RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS
Definition: RBAC.h:84
@ RBAC_PERM_COMMAND_DAMAGE
Definition: RBAC.h:370
@ RBAC_PERM_RESURRECT_WITH_FULL_HPS
Definition: RBAC.h:91
@ RBAC_PERM_COMMAND_UNAURA
Definition: RBAC.h:401
@ RBAC_PERM_COMMAND_KICK
Definition: RBAC.h:382
@ RBAC_PERM_COMMAND_WCHANGE
Definition: RBAC.h:407
@ RBAC_PERM_COMMAND_LINKGRAVE
Definition: RBAC.h:383
@ RBAC_PERM_COMMAND_SAVEALL
Definition: RBAC.h:396
@ RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA
Definition: RBAC.h:101
@ RBAC_PERM_COMMAND_PINFO
Definition: RBAC.h:389
@ RBAC_PERM_COMMAND_MUTEHISTORY
Definition: RBAC.h:504
@ RBAC_PERM_COMMAND_GUID
Definition: RBAC.h:378
@ RBAC_PERM_COMMAND_DISTANCE
Definition: RBAC.h:374
uint16 ParentAreaID
Definition: DB2Structure.h:131
EnumFlag< AreaFlags > GetFlags() const
Definition: DB2Structure.h:153
LocalizedString AreaName
Definition: DB2Structure.h:129
AuraCreateInfo & SetCaster(Unit *caster)
Definition: Cell.h:47
uint32 GridX() const
Definition: Cell.h:73
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
uint32 GridY() const
Definition: Cell.h:74
uint32 CellX() const
Definition: Cell.h:71
uint32 CellY() const
Definition: Cell.h:72
uint32 x_coord
Definition: GridDefines.h:173
uint32 y_coord
Definition: GridDefines.h:174
uint32 GetId() const
Definition: GridDefines.h:166
uint32 entry
Definition: MapDefines.h:140
EnumFlag< map_liquidHeaderTypeFlags > type_flags
Definition: MapDefines.h:139
float depth_level
Definition: MapDefines.h:142
float level
Definition: MapDefines.h:141
LocalizedString MapName
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
float GetExactDist2d(const float x, const float y) const
Definition: Position.h:106
float GetExactDist(float x, float y, float z) const
Definition: Position.h:118
float GetAbsoluteAngle(float x, float y) const
Definition: Position.h:125
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
Battlenet::RealmHandle Id
Definition: Realm.h:82
LocalizedString DisplayName
uint32 damage
Definition: Unit.h:556
struct GameObjectValue::@211 Building