Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
cs_misc.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "AccountMgr.h"
7#include "ArenaTeamMgr.h"
8#include "CellImpl.h"
9#include "Chat.h"
10#include "GridNotifiers.h"
11#include "Group.h"
12#include "GroupMgr.h"
13#include "InstanceSaveMgr.h"
14#include "Language.h"
15#include "LFG.h"
16#include "MMapFactory.h"
17#include "MovementGenerator.h"
18#include "NetworkAddress.h"
19#include "ObjectAccessor.h"
20#include "Opcodes.h"
21#include "Pet.h"
22#include "Player.h"
23#include "ScriptMgr.h"
24#include "SpellAuras.h"
26#include "WeatherMgr.h"
27
29{
30public:
31 misc_commandscript() : CommandScript("misc_commandscript") { }
32
33 std::vector<ChatCommand> GetCommands() const OVERRIDE
34 {
35 static std::vector<ChatCommand> commandTable =
36 {
37 { "additem", rbac::RBAC_PERM_COMMAND_ADDITEM, false, &HandleAddItemCommand, "", },
38 { "additemset", rbac::RBAC_PERM_COMMAND_ADDITEMSET, false, &HandleAddItemSetCommand, "", },
39 { "appear", rbac::RBAC_PERM_COMMAND_APPEAR, false, &HandleAppearCommand, "", },
40 { "aura", rbac::RBAC_PERM_COMMAND_AURA, false, &HandleAuraCommand, "", },
41 { "bank", rbac::RBAC_PERM_COMMAND_BANK, false, &HandleBankCommand, "", },
42 { "bindsight", rbac::RBAC_PERM_COMMAND_BINDSIGHT, false, &HandleBindSightCommand, "", },
44 { "cometome", rbac::RBAC_PERM_COMMAND_COMETOME, false, &HandleComeToMeCommand, "", },
46 { "cooldown", rbac::RBAC_PERM_COMMAND_COOLDOWN, false, &HandleCooldownCommand, "", },
47 { "damage", rbac::RBAC_PERM_COMMAND_DAMAGE, false, &HandleDamageCommand, "", },
48 { "dev", rbac::RBAC_PERM_COMMAND_DEV, false, &HandleDevCommand, "", },
49 { "die", rbac::RBAC_PERM_COMMAND_DIE, false, &HandleDieCommand, "", },
50 { "dismount", rbac::RBAC_PERM_COMMAND_DISMOUNT, false, &HandleDismountCommand, "", },
52 { "freeze", rbac::RBAC_PERM_COMMAND_FREEZE, false, &HandleFreezeCommand, "", },
53 { "gps", rbac::RBAC_PERM_COMMAND_GPS, false, &HandleGPSCommand, "", },
54 { "guid", rbac::RBAC_PERM_COMMAND_GUID, false, &HandleGUIDCommand, "", },
55 { "help", rbac::RBAC_PERM_COMMAND_HELP, true, &HandleHelpCommand, "", },
56 { "hidearea", rbac::RBAC_PERM_COMMAND_HIDEAREA, false, &HandleHideAreaCommand, "", },
57 { "itemmove", rbac::RBAC_PERM_COMMAND_ITEMMOVE, false, &HandleItemMoveCommand, "", },
59 { "linkgrave", rbac::RBAC_PERM_COMMAND_LINKGRAVE, false, &HandleLinkGraveCommand, "", },
60 { "listfreeze", rbac::RBAC_PERM_COMMAND_LISTFREEZE, false, &HandleListFreezeCommand, "", },
61 { "maxskill", rbac::RBAC_PERM_COMMAND_MAXSKILL, false, &HandleMaxSkillCommand, "", },
62 { "movegens", rbac::RBAC_PERM_COMMAND_MOVEGENS, false, &HandleMovegensCommand, "", },
63 { "mute", rbac::RBAC_PERM_COMMAND_MUTE, true, &HandleMuteCommand, "", },
64 { "neargrave", rbac::RBAC_PERM_COMMAND_NEARGRAVE, false, &HandleNearGraveCommand, "", },
65 { "pinfo", rbac::RBAC_PERM_COMMAND_PINFO, true, &HandlePInfoCommand, "", },
66 { "playall", rbac::RBAC_PERM_COMMAND_PLAYALL, false, &HandlePlayAllCommand, "", },
67 { "possess", rbac::RBAC_PERM_COMMAND_POSSESS, false, &HandlePossessCommand, "", },
68 { "recall", rbac::RBAC_PERM_COMMAND_RECALL, false, &HandleRecallCommand, "", },
70 { "respawn", rbac::RBAC_PERM_COMMAND_RESPAWN, false, &HandleRespawnCommand, "", },
71 { "revive", rbac::RBAC_PERM_COMMAND_REVIVE, true, &HandleReviveCommand, "", },
72 { "saveall", rbac::RBAC_PERM_COMMAND_SAVEALL, true, &HandleSaveAllCommand, "", },
73 { "save", rbac::RBAC_PERM_COMMAND_SAVE, false, &HandleSaveCommand, "", },
74 { "setskill", rbac::RBAC_PERM_COMMAND_SETSKILL, false, &HandleSetSkillCommand, "", },
75 { "showarea", rbac::RBAC_PERM_COMMAND_SHOWAREA, false, &HandleShowAreaCommand, "", },
76 { "summon", rbac::RBAC_PERM_COMMAND_SUMMON, false, &HandleSummonCommand, "", },
77 { "unaura", rbac::RBAC_PERM_COMMAND_UNAURA, false, &HandleUnAuraCommand, "", },
79 { "unfreeze", rbac::RBAC_PERM_COMMAND_UNFREEZE, false, &HandleUnFreezeCommand, "", },
80 { "unmute", rbac::RBAC_PERM_COMMAND_UNMUTE, true, &HandleUnmuteCommand, "", },
81 { "unpossess", rbac::RBAC_PERM_COMMAND_UNPOSSESS, false, &HandleUnPossessCommand, "", },
82 { "unstuck", rbac::RBAC_PERM_COMMAND_UNSTUCK, true, &HandleUnstuckCommand, "", },
83 { "wchange", rbac::RBAC_PERM_COMMAND_WCHANGE, false, &HandleChangeWeather, "", },
84 };
85 return commandTable;
86 }
87
88 static bool HandleDevCommand(ChatHandler* handler, char const* args)
89 {
90 if (!*args)
91 {
94 else
96 return true;
97 }
98
99 std::string argstr = (char*)args;
100
101 if (argstr == "on")
102 {
105 return true;
106 }
107
108 if (argstr == "off")
109 {
112 return true;
113 }
114
116 handler->SetSentErrorMessage(true);
117 return false;
118 }
119
120 static bool HandleGPSCommand(ChatHandler* handler, char const* args)
121 {
122 WorldObject* object = NULL;
123 if (*args)
124 {
125 uint64 guid = handler->extractGuidFromLink((char*)args);
126 if (guid)
128
129 if (!object)
130 {
132 handler->SetSentErrorMessage(true);
133 return false;
134 }
135 }
136 else
137 {
138 object = handler->getSelectedUnit();
139
140 if (!object)
141 {
143 handler->SetSentErrorMessage(true);
144 return false;
145 }
146 }
147
148 CellCoord cellCoord = Skyfire::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
149 Cell cell(cellCoord);
150
151 uint32 zoneId, areaId;
152 object->GetZoneAndAreaId(zoneId, areaId);
153 uint32 mapId = object->GetMapId();
154
155 MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
156 AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
157 AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
158
159 float zoneX = object->GetPositionX();
160 float zoneY = object->GetPositionY();
161
162 Map2ZoneCoordinates(zoneX, zoneY, zoneId);
163
164 Map const* map = object->GetMap();
165 float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
166 float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
167
168 GridCoord gridCoord = Skyfire::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
169
170 // 63? WHY?
171 int gridX = 63 - gridCoord.x_coord;
172 int gridY = 63 - gridCoord.y_coord;
173
174 uint32 haveMap = Map::ExistMap(mapId, gridX, gridY) ? 1 : 0;
175 uint32 haveVMap = Map::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
177
178 if (haveVMap)
179 {
180 if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
181 handler->PSendSysMessage("You are outdoors");
182 else
183 handler->PSendSysMessage("You are indoors");
184 }
185 else
186 handler->PSendSysMessage("no VMAP available for area info");
187
189 mapId, (mapEntry ? mapEntry->name : "<unknown>"),
190 zoneId, (zoneEntry ? zoneEntry->m_AreaName : "<unknown>"),
191 areaId, (areaEntry ? areaEntry->m_AreaName : "<unknown>"),
192 object->GetPhaseMask(),
193 object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
194 cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
195 zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap, haveMMap);
196
197 LiquidData liquidStatus;
198 ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
199
200 if (status)
201 handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
202
203 if (!object->GetPhases().empty())
204 {
205 std::stringstream ss;
206 for (uint32 swap : object->GetPhases())
207 ss << swap << " ";
208 handler->PSendSysMessage("Target's active phase swaps: %s", ss.str().c_str());
209 }
210 if (!object->GetTerrainSwaps().empty())
211 {
212 std::stringstream ss;
213 for (uint32 swap : object->GetTerrainSwaps())
214 ss << swap << " ";
215 handler->PSendSysMessage("Target's active terrain swaps: %s", ss.str().c_str());
216 }
217 if (!object->GetWorldMapSwaps().empty())
218 {
219 std::stringstream ss;
220 for (uint32 swap : object->GetWorldMapSwaps())
221 ss << swap << " ";
222 handler->PSendSysMessage("Target's active world map area swaps: %s", ss.str().c_str());
223 }
224
225 return true;
226 }
227
228 static bool HandleAuraCommand(ChatHandler* handler, char const* args)
229 {
230 Unit* target = handler->getSelectedUnit();
231 if (!target)
232 {
234 handler->SetSentErrorMessage(true);
235 return false;
236 }
237
238 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
239 uint32 spellId = handler->extractSpellIdFromLink((char*)args);
240
241 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
242 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
243
244 return true;
245 }
246
247 static bool HandleUnAuraCommand(ChatHandler* handler, char const* args)
248 {
249 Unit* target = handler->getSelectedUnit();
250 if (!target)
251 {
253 handler->SetSentErrorMessage(true);
254 return false;
255 }
256
257 std::string argstr = args;
258 if (argstr == "all")
259 {
260 target->RemoveAllAuras();
261 return true;
262 }
263
264 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
265 uint32 spellId = handler->extractSpellIdFromLink((char*)args);
266 if (!spellId)
267 return false;
268
269 target->RemoveAurasDueToSpell(spellId);
270
271 return true;
272 }
273 // Teleport to Player
274 static bool HandleAppearCommand(ChatHandler* handler, char const* args)
275 {
276 Player* target;
277 uint64 targetGuid;
278 std::string targetName;
279 if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
280 return false;
281
282 Player* _player = handler->GetSession()->GetPlayer();
283 if (target == _player || targetGuid == _player->GetGUID())
284 {
286 handler->SetSentErrorMessage(true);
287 return false;
288 }
289
290 if (target)
291 {
292 // check online security
293 if (handler->HasLowerSecurity(target, 0))
294 return false;
295
296 std::string chrNameLink = handler->playerLink(targetName);
297
298 Map* map = target->GetMap();
299 if (map->IsBattlegroundOrArena())
300 {
301 // only allow if gm mode is on
302 if (!_player->IsGameMaster())
303 {
304 handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
305 handler->SetSentErrorMessage(true);
306 return false;
307 }
308 // if both players are in different bgs
309 else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
310 _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
311
312 // all's well, set bg id
313 // when porting out from the bg, it will be reset to 0
314 _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
315 // remember current position as entry point for return at bg end teleportation
316 if (!_player->GetMap()->IsBattlegroundOrArena())
317 _player->SetBattlegroundEntryPoint();
318 }
319 else if (map->IsInstance())
320 {
321 // we have to go to instance, and can go to player only if:
322 // 1) we are in his group (either as leader or as member)
323 // 2) we are not bound to any group and have GM mode on
324 if (_player->GetGroup())
325 {
326 // we are in group, we can go only if we are in the player group
327 if (_player->GetGroup() != target->GetGroup())
328 {
329 handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
330 handler->SetSentErrorMessage(true);
331 return false;
332 }
333 }
334 else
335 {
336 // we are not in group, let's verify our GM mode
337 if (!_player->IsGameMaster())
338 {
339 handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
340 handler->SetSentErrorMessage(true);
341 return false;
342 }
343 }
344
345 // if the player or the player's group is bound to another instance
346 // the player will not be bound to another one
347 InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->GetEntry()));
348 if (!bind)
349 {
350 Group* group = _player->GetGroup();
351 // if no bind exists, create a solo bind
352 InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
353 if (!gBind)
354 if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
355 _player->BindToInstance(save, !save->CanReset());
356 }
357
358 if (map->IsRaid())
359 _player->SetRaidDifficulty(target->GetRaidDifficulty());
360 else
361 _player->SetDungeonDifficulty(target->GetDungeonDifficulty());
362 }
363
364 handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
365
366 // stop flight if need
367 if (_player->IsInFlight())
368 {
369 _player->GetMotionMaster()->MovementExpired();
370 _player->CleanupAfterTaxiFlight();
371 }
372 // save only in non-flight case
373 else
374 _player->SaveRecallPosition();
375
376 // to point to see at target with same orientation
377 float x, y, z;
378 target->GetContactPoint(_player, x, y, z);
379
380 _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
381 _player->SetPhaseMask(target->GetPhaseMask(), true);
382 }
383 else
384 {
385 // check offline security
386 if (handler->HasLowerSecurity(NULL, targetGuid))
387 return false;
388
389 std::string nameLink = handler->playerLink(targetName);
390
391 handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
392
393 // to point where player stay (if loaded)
394 float x, y, z, o;
395 uint32 map;
396 bool in_flight;
397 if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))
398 return false;
399
400 // stop flight if need
401 if (_player->IsInFlight())
402 {
403 _player->GetMotionMaster()->MovementExpired();
404 _player->CleanupAfterTaxiFlight();
405 }
406 // save only in non-flight case
407 else
408 _player->SaveRecallPosition();
409
410 _player->TeleportTo(map, x, y, z, _player->GetOrientation());
411 }
412
413 return true;
414 }
415 // Summon Player
416 static bool HandleSummonCommand(ChatHandler* handler, char const* args)
417 {
418 Player* target;
419 uint64 targetGuid;
420 std::string targetName;
421 if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
422 return false;
423
424 Player* _player = handler->GetSession()->GetPlayer();
425 if (target == _player || targetGuid == _player->GetGUID())
426 {
428 handler->SetSentErrorMessage(true);
429 return false;
430 }
431
432 if (target)
433 {
434 std::string nameLink = handler->playerLink(targetName);
435 // check online security
436 if (handler->HasLowerSecurity(target, 0))
437 return false;
438
439 if (target->IsBeingTeleported())
440 {
441 handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
442 handler->SetSentErrorMessage(true);
443 return false;
444 }
445
446 Map* map = handler->GetSession()->GetPlayer()->GetMap();
447
448 if (map->IsBattlegroundOrArena())
449 {
450 // only allow if gm mode is on
451 if (!_player->IsGameMaster())
452 {
453 handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
454 handler->SetSentErrorMessage(true);
455 return false;
456 }
457 // if both players are in different bgs
458 else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
459 target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
460
461 // all's well, set bg id
462 // when porting out from the bg, it will be reset to 0
464 // remember current position as entry point for return at bg end teleportation
465 if (!target->GetMap()->IsBattlegroundOrArena())
467 }
468 else if (map->IsInstance())
469 {
470 Map* destMap = target->GetMap();
471
472 if (destMap->Instanceable() && destMap->GetInstanceId() != map->GetInstanceId())
473 target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
474
475 // we are in an instance, and can only summon players in our group with us as leader
476 if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() ||
477 (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
478 (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
479 // the last check is a bit excessive, but let it be, just in case
480 {
481 handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
482 handler->SetSentErrorMessage(true);
483 return false;
484 }
485 }
486
487 handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
488 if (handler->needReportToTarget(target))
489 ChatHandler(target->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str());
490
491 // stop flight if need
492 if (target->IsInFlight())
493 {
494 target->GetMotionMaster()->MovementExpired();
495 target->CleanupAfterTaxiFlight();
496 }
497 // save only in non-flight case
498 else
499 target->SaveRecallPosition();
500
501 // before GM
502 float x, y, z;
503 handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
504 target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
505 target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true);
506 }
507 else
508 {
509 // check offline security
510 if (handler->HasLowerSecurity(NULL, targetGuid))
511 return false;
512
513 std::string nameLink = handler->playerLink(targetName);
514
515 handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetSkyFireString(LANG_OFFLINE));
516
517 // in point where GM stay
519 handler->GetSession()->GetPlayer()->GetPositionX(),
520 handler->GetSession()->GetPlayer()->GetPositionY(),
521 handler->GetSession()->GetPlayer()->GetPositionZ(),
522 handler->GetSession()->GetPlayer()->GetOrientation(),
523 handler->GetSession()->GetPlayer()->GetZoneId(),
524 targetGuid);
525 }
526
527 return true;
528 }
529
530 static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/)
531 {
532 handler->ShowHelpForCommand(handler->getCommandTable(), "");
533 return true;
534 }
535
536 static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/)
537 {
538 Unit* target = handler->getSelectedUnit();
539
540 if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
541 {
543 handler->SetSentErrorMessage(true);
544 return false;
545 }
546
547 if (Player* player = target->ToPlayer())
548 if (handler->HasLowerSecurity(player, 0, false))
549 return false;
550
551 if (target->IsAlive())
552 {
554 handler->GetSession()->GetPlayer()->Kill(target);
555 else
556 handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
557 }
558
559 return true;
560 }
561
562 static bool HandleReviveCommand(ChatHandler* handler, char const* args)
563 {
564 Player* target;
565 uint64 targetGuid;
566 if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
567 return false;
568
569 if (target)
570 {
572 target->SpawnCorpseBones();
573 target->SaveToDB();
574 }
575 else
576 // will resurrected at login without corpse
577 sObjectAccessor->ConvertCorpseForPlayer(targetGuid);
578
579 return true;
580 }
581
582 static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/)
583 {
584 Player* player = handler->GetSession()->GetPlayer();
585
586 // If player is not mounted, so go out :)
587 if (!player->IsMounted())
588 {
590 handler->SetSentErrorMessage(true);
591 return false;
592 }
593
594 if (player->IsInFlight())
595 {
597 handler->SetSentErrorMessage(true);
598 return false;
599 }
600
601 player->Dismount();
603 return true;
604 }
605
606 static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
607 {
608 uint64 guid = handler->GetSession()->GetPlayer()->GetTarget();
609
610 if (guid == 0)
611 {
613 handler->SetSentErrorMessage(true);
614 return false;
615 }
616
618 return true;
619 }
620
621 static bool HandleHelpCommand(ChatHandler* handler, char const* args)
622 {
623 char const* cmd = strtok((char*)args, " ");
624 if (!cmd)
625 {
626 handler->ShowHelpForCommand(handler->getCommandTable(), "help");
627 handler->ShowHelpForCommand(handler->getCommandTable(), "");
628 }
629 else
630 {
631 if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd))
633 }
634
635 return true;
636 }
637 // move item to other slot
638 static bool HandleItemMoveCommand(ChatHandler* handler, char const* args)
639 {
640 if (!*args)
641 return false;
642
643 char const* param1 = strtok((char*)args, " ");
644 if (!param1)
645 return false;
646
647 char const* param2 = strtok(NULL, " ");
648 if (!param2)
649 return false;
650
651 uint8 srcSlot = uint8(atoi(param1));
652 uint8 dstSlot = uint8(atoi(param2));
653
654 if (srcSlot == dstSlot)
655 return true;
656
657 if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
658 return false;
659
660 if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
661 return false;
662
663 uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
664 uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
665
666 handler->GetSession()->GetPlayer()->SwapItem(src, dst);
667
668 return true;
669 }
670
671 static bool HandleCooldownCommand(ChatHandler* handler, char const* args)
672 {
673 Player* target = handler->getSelectedPlayer();
674 if (!target)
675 {
677 handler->SetSentErrorMessage(true);
678 return false;
679 }
680
681 std::string nameLink = handler->GetNameLink(target);
682
683 if (!*args)
684 {
685 target->RemoveAllSpellCooldown();
686 handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
687 }
688 else
689 {
690 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
691 uint32 spellIid = handler->extractSpellIdFromLink((char*)args);
692 if (!spellIid)
693 return false;
694
695 if (!sSpellMgr->GetSpellInfo(spellIid))
696 {
697 handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetSkyFireString(LANG_YOU) : nameLink.c_str());
698 handler->SetSentErrorMessage(true);
699 return false;
700 }
701
702 target->RemoveSpellCooldown(spellIid, true);
703 handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetSkyFireString(LANG_YOU) : nameLink.c_str());
704 }
705 return true;
706 }
707
708 static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args)
709 {
710 WorldObject* obj = NULL;
711
712 if (*args)
713 {
714 uint64 guid = handler->extractGuidFromLink((char*)args);
715 if (guid)
717
718 if (!obj)
719 {
721 handler->SetSentErrorMessage(true);
722 return false;
723 }
724 }
725 else
726 {
727 obj = handler->getSelectedUnit();
728
729 if (!obj)
730 {
732 handler->SetSentErrorMessage(true);
733 return false;
734 }
735 }
736
737 handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj));
738 return true;
739 }
740 // Teleport player to last position
741 static bool HandleRecallCommand(ChatHandler* handler, char const* args)
742 {
743 Player* target;
744 if (!handler->extractPlayerTarget((char*)args, &target))
745 return false;
746
747 // check online security
748 if (handler->HasLowerSecurity(target, 0))
749 return false;
750
751 if (target->IsBeingTeleported())
752 {
753 handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str());
754 handler->SetSentErrorMessage(true);
755 return false;
756 }
757
758 // stop flight if need
759 if (target->IsInFlight())
760 {
761 target->GetMotionMaster()->MovementExpired();
762 target->CleanupAfterTaxiFlight();
763 }
764
765 target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
766 return true;
767 }
768
769 static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/)
770 {
771 Player* player = handler->GetSession()->GetPlayer();
772
773 // save GM account without delay and output message
775 {
776 if (Player* target = handler->getSelectedPlayer())
777 target->SaveToDB();
778 else
779 player->SaveToDB();
781 return true;
782 }
783
784 // save if the player has last been saved over 20 seconds ago
785 uint32 saveInterval = sWorld->getIntConfig(WorldIntConfigs::CONFIG_INTERVAL_SAVE);
786 if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
787 player->SaveToDB();
788
789 return true;
790 }
791
792 // Save all players in the world
793 static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/)
794 {
795 sObjectAccessor->SaveAllPlayers();
797 return true;
798 }
799
800 // kick player
801 static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)
802 {
803 Player* target = NULL;
804 std::string playerName;
805 if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
806 return false;
807
808 if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
809 {
811 handler->SetSentErrorMessage(true);
812 return false;
813 }
814
815 // check online security
816 if (handler->HasLowerSecurity(target, 0))
817 return false;
818
820 sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
821 else
822 handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
823
824 target->GetSession()->KickPlayer();
825
826 return true;
827 }
828
829 static bool HandleUnstuckCommand(ChatHandler* handler, char const* args)
830 {
831 // No args required for players
833 {
834 // 7355: "Stuck"
835 if (Player* player = handler->GetSession()->GetPlayer())
836 player->CastSpell(player, 7355, false);
837 return true;
838 }
839
840 if (!*args)
841 return false;
842
843 char* player_str = strtok((char*)args, " ");
844 if (!player_str)
845 return false;
846
847 std::string location_str = "inn";
848 if (char const* loc = strtok(NULL, " "))
849 location_str = loc;
850
851 Player* player = NULL;
852 if (!handler->extractPlayerTarget(player_str, &player))
853 return false;
854
855 if (player->IsInFlight() || player->IsInCombat())
856 {
857 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(7355);
858 if (!spellInfo)
859 return false;
860
861 if (Player* caster = handler->GetSession()->GetPlayer())
863
864 return false;
865 }
866
867 if (location_str == "inn")
868 {
869 player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
870 return true;
871 }
872
873 if (location_str == "graveyard")
874 {
875 player->RepopAtGraveyard();
876 return true;
877 }
878
879 if (location_str == "startzone")
880 {
881 player->TeleportTo(player->GetStartPosition());
882 return true;
883 }
884
885 //Not a supported argument
886 return false;
887 }
888
889 static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args)
890 {
891 if (!*args)
892 return false;
893
894 char* px = strtok((char*)args, " ");
895 if (!px)
896 return false;
897
898 uint32 graveyardId = uint32(atoi(px));
899
900 uint32 team;
901
902 char* px2 = strtok(NULL, " ");
903
904 if (!px2)
905 team = 0;
906 else if (strncmp(px2, "horde", 6) == 0)
907 team = HORDE;
908 else if (strncmp(px2, "alliance", 9) == 0)
909 team = ALLIANCE;
910 else
911 return false;
912
913 WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
914
915 if (!graveyard)
916 {
917 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
918 handler->SetSentErrorMessage(true);
919 return false;
920 }
921
922 Player* player = handler->GetSession()->GetPlayer();
923
924 uint32 zoneId = player->GetZoneId();
925
926 AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
927 if (!areaEntry)
928 {
929 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
930 handler->SetSentErrorMessage(true);
931 return false;
932 }
933
934 if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team))
935 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
936 else
937 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
938
939 return true;
940 }
941
942 static bool HandleNearGraveCommand(ChatHandler* handler, char const* args)
943 {
944 uint32 team;
945
946 size_t argStr = strlen(args);
947
948 if (!*args)
949 team = 0;
950 else if (strncmp((char*)args, "horde", argStr) == 0)
951 team = HORDE;
952 else if (strncmp((char*)args, "alliance", argStr) == 0)
953 team = ALLIANCE;
954 else
955 return false;
956
957 Player* player = handler->GetSession()->GetPlayer();
958 uint32 zone_id = player->GetZoneId();
959
960 WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
961 if (graveyard)
962 {
963 uint32 graveyardId = graveyard->ID;
964
965 GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id);
966 if (!data)
967 {
968 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
969 handler->SetSentErrorMessage(true);
970 return false;
971 }
972
973 team = data->team;
974
975 std::string team_name = handler->GetSkyFireString(LANG_COMMAND_GRAVEYARD_NOTEAM);
976
977 if (team == 0)
978 team_name = handler->GetSkyFireString(LANG_COMMAND_GRAVEYARD_ANY);
979 else if (team == HORDE)
981 else if (team == ALLIANCE)
983
984 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
985 }
986 else
987 {
988 std::string team_name;
989
990 if (team == HORDE)
992 else if (team == ALLIANCE)
994
995 if (!team)
997 else
998 handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
999 }
1000
1001 return true;
1002 }
1003
1004 static bool HandleShowAreaCommand(ChatHandler* handler, char const* args)
1005 {
1006 if (!*args)
1007 return false;
1008
1009 Player* playerTarget = handler->getSelectedPlayer();
1010 if (!playerTarget)
1011 {
1013 handler->SetSentErrorMessage(true);
1014 return false;
1015 }
1016
1017 int32 area = GetAreaFlagByAreaID(atoi((char*)args));
1018 int32 offset = area / 32;
1019 uint32 val = uint32((1 << (area % 32)));
1020
1021 if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
1022 {
1024 handler->SetSentErrorMessage(true);
1025 return false;
1026 }
1027
1028 uint32 currFields = playerTarget->GetUInt32Value(PLAYER_FIELD_EXPLORED_ZONES + offset);
1029 playerTarget->SetUInt32Value(PLAYER_FIELD_EXPLORED_ZONES + offset, uint32((currFields | val)));
1030
1032 return true;
1033 }
1034
1035 static bool HandleHideAreaCommand(ChatHandler* handler, char const* args)
1036 {
1037 if (!*args)
1038 return false;
1039
1040 Player* playerTarget = handler->getSelectedPlayer();
1041 if (!playerTarget)
1042 {
1044 handler->SetSentErrorMessage(true);
1045 return false;
1046 }
1047
1048 int32 area = GetAreaFlagByAreaID(atoi((char*)args));
1049 int32 offset = area / 32;
1050 uint32 val = uint32((1 << (area % 32)));
1051
1052 if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
1053 {
1055 handler->SetSentErrorMessage(true);
1056 return false;
1057 }
1058
1059 uint32 currFields = playerTarget->GetUInt32Value(PLAYER_FIELD_EXPLORED_ZONES + offset);
1060 playerTarget->SetUInt32Value(PLAYER_FIELD_EXPLORED_ZONES + offset, uint32((currFields ^ val)));
1061
1063 return true;
1064 }
1065
1066 static bool HandleAddItemCommand(ChatHandler* handler, char const* args)
1067 {
1068 if (!*args)
1069 return false;
1070
1071 uint32 itemId = 0;
1072
1073 if (args[0] == '[') // [name] manual form
1074 {
1075 char const* itemNameStr = strtok((char*)args, "]");
1076
1077 if (itemNameStr && itemNameStr[0])
1078 {
1079 std::string itemName = itemNameStr + 1;
1080 WorldDatabase.EscapeString(itemName);
1081
1083 stmt->setString(0, itemName);
1084 PreparedQueryResult result = WorldDatabase.Query(stmt);
1085
1086 if (!result)
1087 {
1088 handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr + 1);
1089 handler->SetSentErrorMessage(true);
1090 return false;
1091 }
1092 itemId = result->Fetch()->GetUInt32();
1093 }
1094 else
1095 return false;
1096 }
1097 else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
1098 {
1099 char const* id = handler->extractKeyFromLink((char*)args, "Hitem");
1100 if (!id)
1101 return false;
1102 itemId = uint32(atol(id));
1103 }
1104
1105 char const* ccount = strtok(NULL, " ");
1106
1107 int32 count = 1;
1108
1109 if (ccount)
1110 count = strtol(ccount, NULL, 10);
1111
1112 if (count == 0)
1113 count = 1;
1114
1115 Player* player = handler->GetSession()->GetPlayer();
1116 Player* playerTarget = handler->getSelectedPlayer();
1117 if (!playerTarget)
1118 playerTarget = player;
1119
1120 SF_LOG_DEBUG("misc", handler->GetSkyFireString(LANG_ADDITEM), itemId, count);
1121
1122 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
1123 if (!itemTemplate)
1124 {
1126 handler->SetSentErrorMessage(true);
1127 return false;
1128 }
1129
1130 // Subtract
1131 if (count < 0)
1132 {
1133 playerTarget->DestroyItemCount(itemId, -count, true, false);
1134 handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
1135 return true;
1136 }
1137
1138 // Adding items
1139 uint32 noSpaceForCount = 0;
1140
1141 // check space and find places
1142 ItemPosCountVec dest;
1143 InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
1144 if (msg != EQUIP_ERR_OK) // convert to possible store amount
1145 count -= noSpaceForCount;
1146
1147 if (count == 0 || dest.empty()) // can't add any
1148 {
1149 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1150 handler->SetSentErrorMessage(true);
1151 return false;
1152 }
1153
1154 Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
1155
1156 // remove binding (let GM give it to another player later)
1157 if (player == playerTarget)
1158 for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
1159 if (Item* item1 = player->GetItemByPos(itr->pos))
1160 item1->SetBinding(false);
1161
1162 if (count > 0 && item)
1163 {
1164 player->SendNewItem(item, count, false, true);
1165 if (player != playerTarget)
1166 playerTarget->SendNewItem(item, count, true, false);
1167 }
1168
1169 if (noSpaceForCount > 0)
1170 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1171
1172 return true;
1173 }
1174
1175 static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args)
1176 {
1177 if (!*args)
1178 return false;
1179
1180 char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
1181 if (!id)
1182 return false;
1183
1184 uint32 itemSetId = atol(id);
1185
1186 // prevent generation all items with itemset field value '0'
1187 if (itemSetId == 0)
1188 {
1190 handler->SetSentErrorMessage(true);
1191 return false;
1192 }
1193
1194 Player* player = handler->GetSession()->GetPlayer();
1195 Player* playerTarget = handler->getSelectedPlayer();
1196 if (!playerTarget)
1197 playerTarget = player;
1198
1199 SF_LOG_DEBUG("misc", handler->GetSkyFireString(LANG_ADDITEMSET), itemSetId);
1200
1201 bool found = false;
1202 ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
1203 for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
1204 {
1205 if (itr->second.ItemSet == itemSetId)
1206 {
1207 found = true;
1208 ItemPosCountVec dest;
1209 InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
1210 if (msg == EQUIP_ERR_OK)
1211 {
1212 Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
1213
1214 // remove binding (let GM give it to another player later)
1215 if (player == playerTarget)
1216 item->SetBinding(false);
1217
1218 player->SendNewItem(item, 1, false, true);
1219 if (player != playerTarget)
1220 playerTarget->SendNewItem(item, 1, true, false);
1221 }
1222 else
1223 {
1224 player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
1225 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
1226 }
1227 }
1228 }
1229
1230 if (!found)
1231 {
1233 handler->SetSentErrorMessage(true);
1234 return false;
1235 }
1236
1237 return true;
1238 }
1239
1240 static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/)
1241 {
1242 handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
1243 return true;
1244 }
1245
1246 static bool HandleChangeWeather(ChatHandler* handler, char const* args)
1247 {
1248 if (!*args)
1249 return false;
1250
1251 // Weather is OFF
1252 if (!sWorld->GetBoolConfig(WorldBoolConfigs::CONFIG_WEATHER))
1253 {
1255 handler->SetSentErrorMessage(true);
1256 return false;
1257 }
1258
1259 // *Change the weather of a cell
1260 char const* px = strtok((char*)args, " ");
1261 char const* py = strtok(NULL, " ");
1262
1263 if (!px || !py)
1264 return false;
1265
1266 uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
1267 float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather
1268
1269 Player* player = handler->GetSession()->GetPlayer();
1270 uint32 zoneid = player->GetZoneId();
1271
1272 Weather* weather = WeatherMgr::FindWeather(zoneid);
1273
1274 if (!weather)
1275 weather = WeatherMgr::AddWeather(zoneid);
1276 if (!weather)
1277 {
1279 handler->SetSentErrorMessage(true);
1280 return false;
1281 }
1282
1283 weather->SetWeather(WeatherType(type), grade);
1284
1285 return true;
1286 }
1287
1288
1289 static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/)
1290 {
1291 Player* SelectedPlayer = handler->getSelectedPlayer();
1292 if (!SelectedPlayer)
1293 {
1295 handler->SetSentErrorMessage(true);
1296 return false;
1297 }
1298
1299 // each skills that have max skill value dependent from level seted to current level max skill value
1300 SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
1301 return true;
1302 }
1303
1304 static bool HandleSetSkillCommand(ChatHandler* handler, char const* args)
1305 {
1306 // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
1307 char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill");
1308 if (!skillStr)
1309 return false;
1310
1311 char const* levelStr = strtok(NULL, " ");
1312 if (!levelStr)
1313 return false;
1314
1315 char const* maxPureSkill = strtok(NULL, " ");
1316
1317 int32 skill = atoi(skillStr);
1318 if (skill <= 0)
1319 {
1320 handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
1321 handler->SetSentErrorMessage(true);
1322 return false;
1323 }
1324
1325 int32 level = uint32(atol(levelStr));
1326
1327 Player* target = handler->getSelectedPlayer();
1328 if (!target)
1329 {
1331 handler->SetSentErrorMessage(true);
1332 return false;
1333 }
1334
1335 SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill);
1336 if (!skillLine)
1337 {
1338 handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
1339 handler->SetSentErrorMessage(true);
1340 return false;
1341 }
1342
1343 std::string tNameLink = handler->GetNameLink(target);
1344
1345 uint16 max = maxPureSkill ? atol(maxPureSkill) : target->GetPureMaxSkillValue(skill);
1346 if (!max)
1347 max = target->GetMaxSkillValueForLevel();
1348
1349 if (level <= 0 || level > max || max <= 0)
1350 return false;
1351
1352 target->SetSkill(skill, target->GetSkillStep(skill), level, max);
1353 handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name, tNameLink.c_str(), level, max);
1354
1355 return true;
1356 }
1357
1375
1376 static bool HandlePInfoCommand(ChatHandler* handler, char const* args)
1377 {
1378 // Define ALL the player variables!
1379 Player* target;
1380 uint64 targetGuid;
1381 std::string targetName;
1382
1383 // To make sure we get a target, we convert our guid to an omniversal...
1384 uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
1385
1386 // ... and make sure we get a target, somehow.
1387 if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
1388 {
1389 target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
1390 targetGuid = parseGUID;
1391 }
1392 // if not, then return false. Which shouldn't happen, now should it ?
1393 else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
1394 return false;
1395
1396 /* The variables we extract for the command. They are
1397 * default as "does not exist" to prevent problems
1398 * The output is printed in the follow manner:
1399 *
1400 * Player %s %s (guid: %u) - I. LANG_PINFO_PLAYER
1401 * ** GM Mode active, Phase: -1 - II. LANG_PINFO_GM_ACTIVE (if GM)
1402 * ** Banned: (Type, Reason, Time, By) - III. LANG_PINFO_BANNED (if banned)
1403 * ** Muted: (Time, Reason, By) - IV. LANG_PINFO_MUTED (if muted)
1404 * * Account: %s (id: %u), GM Level: %u - V. LANG_PINFO_ACC_ACCOUNT
1405 * * Last Login: %u (Failed Logins: %u) - VI. LANG_PINFO_ACC_LASTLOGIN
1406 * * Uses OS: %s - Latency: %u ms - VII. LANG_PINFO_ACC_OS
1407 * * Registration Email: %s - Email: %s - VIII. LANG_PINFO_ACC_REGMAILS
1408 * * Last IP: %u (Locked: %s) - IX. LANG_PINFO_ACC_IP
1409 * * Level: %u (%u/%u XP (%u XP left) - X. LANG_PINFO_CHR_LEVEL
1410 * * Race: %s %s, Class %s - XI. LANG_PINFO_CHR_RACE
1411 * * Alive ?: %s - XII. LANG_PINFO_CHR_ALIVE
1412 * * Phase: %s - XIII. LANG_PINFO_CHR_PHASE (if not GM)
1413 * * Money: %ug%us%uc - XIV. LANG_PINFO_CHR_MONEY
1414 * * Map: %s, Area: %s - XV. LANG_PINFO_CHR_MAP
1415 * * Guild: %s (Id: %u) - XVI. LANG_PINFO_CHR_GUILD (if in guild)
1416 * ** Rank: %s - XVII. LANG_PINFO_CHR_GUILD_RANK (if in guild)
1417 * ** Note: %s - XVIII.LANG_PINFO_CHR_GUILD_NOTE (if in guild and has note)
1418 * ** O. Note: %s - XVIX. LANG_PINFO_CHR_GUILD_ONOTE (if in guild and has officer note)
1419 * * Played time: %s - XX. LANG_PINFO_CHR_PLAYEDTIME
1420 * * Mails: %u Read/%u Total - XXI. LANG_PINFO_CHR_MAILS (if has mails)
1421 *
1422 * Not all of them can be moved to the top. These should
1423 * place the most important ones to the head, though.
1424 *
1425 * For a cleaner overview, I segment each output in Roman numerals
1426 */
1427
1428 // Account data print variables
1429 std::string userName = handler->GetSkyFireString(LANG_ERROR);
1430 uint32 accId = 0;
1431 uint32 lowguid = GUID_LOPART(targetGuid);
1432 std::string eMail = handler->GetSkyFireString(LANG_ERROR);
1433 std::string regMail = handler->GetSkyFireString(LANG_ERROR);
1434 uint32 security = 0;
1435 std::string lastIp = handler->GetSkyFireString(LANG_ERROR);
1436 uint8 locked = 0;
1437 std::string lastLogin = handler->GetSkyFireString(LANG_ERROR);
1438 uint32 failedLogins = 0;
1439 uint32 latency = 0;
1440 std::string OS = "None";
1441
1442 // Mute data print variables
1443 int64 muteTime = -1;
1444 std::string muteReason = "unknown";
1445 std::string muteBy = "unknown";
1446
1447 // Ban data print variables
1448 int64 banTime = -1;
1449 std::string banType = "None";
1450 std::string banReason = "Unknown";
1451 std::string bannedBy = "Unknown";
1452
1453 // Character data print variables
1454 uint8 raceid, classid = 0; //RACE_NONE, CLASS_NONE
1455 std::string raceStr, classStr = "None";
1456 uint8 gender = 0;
1457 int8 locale = handler->GetSessionDbcLocale();
1458 std::string genderStr = handler->GetSkyFireString(LANG_ERROR);
1459 uint32 totalPlayerTime = 0;
1460 uint8 level = 0;
1461 std::string alive = handler->GetSkyFireString(LANG_ERROR);
1462 uint32 money = 0;
1463 uint32 xp = 0;
1464 uint32 xptotal = 0;
1465
1466 // Position data print
1467 uint32 mapId;
1468 uint32 areaId;
1469 uint32 phase = 0;
1470 std::string areaName = "<unknown>";
1471 std::string zoneName = "<unknown>";
1472
1473 // Guild data print variables defined so that they exist, but are not necessarily used
1474 uint32 guildId = 0;
1475 uint8 guildRankId = 0;
1476 std::string guildName;
1477 std::string guildRank;
1478 std::string note;
1479 std::string officeNote;
1480
1481 // Mail data print is only defined if you have a mail
1482
1483 if (target)
1484 {
1485 // check online security
1486 if (handler->HasLowerSecurity(target, 0))
1487 return false;
1488
1489 accId = target->GetSession()->GetAccountId();
1490 money = target->GetMoney();
1491 totalPlayerTime = target->GetTotalPlayedTime();
1492 level = target->getLevel();
1493 latency = target->GetSession()->GetLatency();
1494 raceid = target->getRace();
1495 classid = target->getClass();
1496 muteTime = target->GetSession()->m_muteTime;
1497 mapId = target->GetMapId();
1498 areaId = target->GetAreaId();
1499 alive = target->IsAlive() ? "Yes" : "No";
1500 gender = target->getGender();
1501 phase = target->GetPhaseMask();
1502 }
1503 // get additional information from DB
1504 else
1505 {
1506 // check offline security
1507 if (handler->HasLowerSecurity(NULL, targetGuid))
1508 return false;
1509
1510 // Query informations from the DB
1511 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
1512 stmt->setUInt32(0, lowguid);
1513 PreparedQueryResult result = CharacterDatabase.Query(stmt);
1514
1515 if (!result)
1516 return false;
1517
1518 Field* fields = result->Fetch();
1519 totalPlayerTime = fields[0].GetUInt32();
1520 level = fields[1].GetUInt8();
1521 money = fields[2].GetUInt32();
1522 accId = fields[3].GetUInt32();
1523 raceid = fields[4].GetUInt8();
1524 classid = fields[5].GetUInt8();
1525 mapId = fields[6].GetUInt16();
1526 areaId = fields[7].GetUInt16();
1527 gender = fields[8].GetUInt8();
1528 uint32 health = fields[9].GetUInt32();
1529 uint32 playerFlags = fields[10].GetUInt32();
1530
1531 if (!health || playerFlags & PLAYER_FLAGS_GHOST)
1532 alive = "No";
1533 else
1534 alive = "Yes";
1535 }
1536
1537 // Query the prepared statement for login data
1538 PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
1539 stmt->setInt32(0, int32(realmID));
1540 stmt->setUInt32(1, accId);
1541 PreparedQueryResult result = LoginDatabase.Query(stmt);
1542
1543 if (result)
1544 {
1545 Field* fields = result->Fetch();
1546 userName = fields[0].GetString();
1547 security = fields[1].GetUInt8();
1548
1549 // Only fetch these fields if commander has sufficient rights)
1550 if (handler->HasPermission(rbac::RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA) && // RBAC Perm. 48, Role 39
1551 (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)))
1552 {
1553 eMail = fields[2].GetString();
1554 regMail = fields[3].GetString();
1555 lastIp = fields[4].GetString();
1556 lastLogin = fields[5].GetString();
1557
1560
1561 // If ip2nation table is populated, it displays the country
1562 PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP2NATION_COUNTRY);
1563 stmt->setUInt32(0, ip);
1564 if (PreparedQueryResult result2 = LoginDatabase.Query(stmt))
1565 {
1566 Field* fields2 = result2->Fetch();
1567 lastIp.append(" (");
1568 lastIp.append(fields2[0].GetString());
1569 lastIp.append(")");
1570 }
1571 }
1572 else
1573 {
1574 eMail = "Unauthorized";
1575 lastIp = "Unauthorized";
1576 lastLogin = "Unauthorized";
1577 }
1578 muteTime = fields[6].GetUInt64();
1579 muteReason = fields[7].GetString();
1580 muteBy = fields[8].GetString();
1581 failedLogins = fields[9].GetUInt32();
1582 locked = fields[10].GetUInt8();
1583 OS = fields[11].GetString();
1584 }
1585
1586 // Creates a chat link to the character. Returns nameLink
1587 std::string nameLink = handler->playerLink(targetName);
1588
1589 // Returns banType, banTime, bannedBy, banreason
1590 PreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
1591 stmt2->setUInt32(0, accId);
1592 PreparedQueryResult result2 = LoginDatabase.Query(stmt2);
1593 if (!result2)
1594 {
1595 banType = "Character";
1596 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
1597 stmt->setUInt32(0, lowguid);
1598 result2 = CharacterDatabase.Query(stmt);
1599 }
1600
1601 if (result2)
1602 {
1603 Field* fields = result2->Fetch();
1604 banTime = int64(fields[1].GetUInt64() ? 0 : fields[0].GetUInt32());
1605 bannedBy = fields[2].GetString();
1606 banReason = fields[3].GetString();
1607 }
1608
1609 // Can be used to query data from World database
1610 stmt2 = WorldDatabase.GetPreparedStatement(WORLD_SEL_REQ_XP);
1611 stmt2->setUInt8(0, level);
1612 PreparedQueryResult result3 = WorldDatabase.Query(stmt2);
1613
1614 if (result3)
1615 {
1616 Field* fields = result3->Fetch();
1617 xptotal = fields[0].GetUInt32();
1618 }
1619
1620 // Can be used to query data from Characters database
1621 stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
1622 stmt2->setUInt32(0, lowguid);
1623 PreparedQueryResult result4 = CharacterDatabase.Query(stmt2);
1624
1625 if (result4)
1626 {
1627 Field* fields = result4->Fetch();
1628 xp = fields[0].GetUInt32(); // Used for "current xp" output and "%u XP Left" calculation
1629 uint32 gguid = fields[1].GetUInt32(); // We check if have a guild for the person, so we might not require to query it at all
1630
1631 if (gguid != 0)
1632 {
1633 // Guild Data - an own query, because it may not happen.
1635 stmt3->setUInt32(0, lowguid);
1636 PreparedQueryResult result5 = CharacterDatabase.Query(stmt3);
1637 if (result5)
1638 {
1639 Field* fields = result5->Fetch();
1640 guildId = fields[0].GetUInt32();
1641 guildName = fields[1].GetString();
1642 guildRank = fields[2].GetString();
1643 guildRankId = fields[3].GetUInt8();
1644 note = fields[4].GetString();
1645 officeNote = fields[5].GetString();
1646 }
1647 }
1648 }
1649
1650 // Initiate output
1651 // Output I. LANG_PINFO_PLAYER
1652 handler->PSendSysMessage(LANG_PINFO_PLAYER, target ? "" : handler->GetSkyFireString(LANG_OFFLINE), nameLink.c_str(), lowguid);
1653
1654 // Output II. LANG_PINFO_GM_ACTIVE if character is gamemaster
1655 if (target && target->IsGameMaster())
1657
1658 // Output III. LANG_PINFO_BANNED if ban exists and is applied
1659 if (banTime >= 0)
1660 handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedBy.c_str());
1661
1662 // Output IV. LANG_PINFO_MUTED if mute is applied
1663 if (muteTime > 0)
1664 handler->PSendSysMessage(LANG_PINFO_MUTED, secsToTimeString(muteTime - time(NULL), true).c_str(), muteReason.c_str(), muteBy.c_str());
1665
1666 // Output V. LANG_PINFO_ACC_ACCOUNT
1667 handler->PSendSysMessage(LANG_PINFO_ACC_ACCOUNT, userName.c_str(), accId, security);
1668
1669 // Output VI. LANG_PINFO_ACC_LASTLOGIN
1670 handler->PSendSysMessage(LANG_PINFO_ACC_LASTLOGIN, lastLogin.c_str(), failedLogins);
1671
1672 // Output VII. LANG_PINFO_ACC_OS
1673 handler->PSendSysMessage(LANG_PINFO_ACC_OS, OS.c_str(), latency);
1674
1675 // Output VIII. LANG_PINFO_ACC_REGMAILS
1676 handler->PSendSysMessage(LANG_PINFO_ACC_REGMAILS, regMail.c_str(), eMail.c_str());
1677
1678 // Output IX. LANG_PINFO_ACC_IP
1679 handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked ? "Yes" : "No");
1680
1681 // Output X. LANG_PINFO_CHR_LEVEL
1682 if (level != sWorld->getIntConfig(WorldIntConfigs::CONFIG_MAX_PLAYER_LEVEL))
1683 handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_LOW, level, xp, xptotal, (xptotal - xp));
1684 else
1686
1687 // Output XI. LANG_PINFO_CHR_RACE
1688 raceStr = GetRaceName(raceid, locale);
1689 classStr = GetClassName(classid, locale);
1690 handler->PSendSysMessage(LANG_PINFO_CHR_RACE, (gender == 0 ? handler->GetSkyFireString(LANG_CHARACTER_GENDER_MALE) : handler->GetSkyFireString(LANG_CHARACTER_GENDER_FEMALE)), raceStr.c_str(), classStr.c_str());
1691
1692 // Output XII. LANG_PINFO_CHR_ALIVE
1693 handler->PSendSysMessage(LANG_PINFO_CHR_ALIVE, alive.c_str());
1694
1695 // Output XIII. LANG_PINFO_CHR_PHASE if player is not in GM mode (GM is in every phase)
1696 if (target && !target->IsGameMaster()) // IsInWorld() returns false on loadingscreen, so it's more
1697 handler->PSendSysMessage(LANG_PINFO_CHR_PHASE, phase); // precise than just target (safer ?).
1698 // However, as we usually just require a target here, we use target instead.
1699// Output XIV. LANG_PINFO_CHR_MONEY
1700 uint32 gold = money / GOLD;
1701 uint32 silv = (money % GOLD) / SILVER;
1702 uint32 copp = (money % GOLD) % SILVER;
1703 handler->PSendSysMessage(LANG_PINFO_CHR_MONEY, gold, silv, copp);
1704
1705 // Position data
1706 MapEntry const* map = sMapStore.LookupEntry(mapId);
1707 AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
1708 if (area)
1709 {
1710 areaName = area->m_AreaName;
1711
1713 if (zone)
1714 zoneName = zone->m_AreaName;
1715 }
1716
1717 if (target)
1718 handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name, (!zoneName.empty() ? zoneName.c_str() : "<Unknown>"), (!areaName.empty() ? areaName.c_str() : "<Unknown>"));
1719
1720 // Output XVII. - XVIX. if they are not empty
1721 if (!guildName.empty())
1722 {
1723 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), guildId);
1724 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank.c_str(), uint32(guildRankId));
1725 if (!note.empty())
1726 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_NOTE, note.c_str());
1727 if (!officeNote.empty())
1728 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str());
1729 }
1730
1731 // Output XX. LANG_PINFO_CHR_PLAYEDTIME
1732 handler->PSendSysMessage(LANG_PINFO_CHR_PLAYEDTIME, (secsToTimeString(totalPlayerTime, true, true)).c_str());
1733
1734 // Mail Data - an own query, because it may or may not be useful.
1735 // SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
1736 PreparedStatement* stmt4 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
1737 stmt4->setUInt32(0, lowguid);
1738 PreparedQueryResult result6 = CharacterDatabase.Query(stmt4);
1739 if (result6)
1740 {
1741 // Define the variables, so the compiler knows they exist
1742 uint32 rmailint = 0;
1743
1744 // Fetch the fields - readmail is a SUM(x) and given out as char! Thus...
1745 // ... while totalmail is a COUNT(x), which is given out as INt64, which we just convert on fetch...
1746 Field* fields = result6->Fetch();
1747 std::string readmail = fields[0].GetString();
1748 uint32 totalmail = uint32(fields[1].GetUInt64());
1749
1750 // ... we have to convert it from Char to int. We can use totalmail as it is
1751 rmailint = atol(readmail.c_str());
1752
1753 // Output XXI. LANG_INFO_CHR_MAILS if at least one mail is given
1754 if (totalmail >= 1)
1755 handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, rmailint, totalmail);
1756 }
1757
1758 return true;
1759 }
1760
1761 static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/)
1762 {
1763 Player* player = handler->GetSession()->GetPlayer();
1764
1765 // accept only explicitly selected target (not implicitly self targeting case)
1766 Unit* target = handler->getSelectedUnit();
1767 if (player->GetTarget() && target)
1768 {
1769 if (target->GetTypeId() != TypeID::TYPEID_UNIT || target->IsPet())
1770 {
1772 handler->SetSentErrorMessage(true);
1773 return false;
1774 }
1775
1776 if (target->isDead())
1777 target->ToCreature()->Respawn();
1778 return true;
1779 }
1780
1782 Cell cell(p);
1783 cell.SetNoCreate();
1784
1785 Skyfire::RespawnDo u_do;
1787
1789 cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
1790
1791 return true;
1792 }
1793
1794 // mute player for some times
1795 static bool HandleMuteCommand(ChatHandler* handler, char const* args)
1796 {
1797 char* nameStr;
1798 char* delayStr;
1799 handler->extractOptFirstArg((char*)args, &nameStr, &delayStr);
1800 if (!delayStr)
1801 return false;
1802
1803 char const* muteReason = strtok(NULL, "\r");
1804 std::string muteReasonStr = "No reason";
1805 if (muteReason != NULL)
1806 muteReasonStr = muteReason;
1807
1808 Player* target;
1809 uint64 targetGuid;
1810 std::string targetName;
1811 if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
1812 return false;
1813
1814 uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
1815
1816 // find only player from same account if any
1817 if (!target)
1818 if (WorldSession* session = sWorld->FindSession(accountId))
1819 target = session->GetPlayer();
1820
1821 uint32 notSpeakTime = uint32(atoi(delayStr));
1822
1823 // must have strong lesser security level
1824 if (handler->HasLowerSecurity(target, targetGuid, true))
1825 return false;
1826
1827 PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
1828 std::string muteBy = "";
1829 if (handler->GetSession())
1830 muteBy = handler->GetSession()->GetPlayerName();
1831 else
1832 muteBy = "Console";
1833
1834 if (target)
1835 {
1836 // Target is online, mute will be in effect right away.
1837 int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
1838 target->GetSession()->m_muteTime = muteTime;
1839 stmt->setInt64(0, muteTime);
1840 ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
1841 }
1842 else
1843 {
1844 // Target is offline, mute will be in effect starting from the next login.
1845 int32 muteTime = -int32(notSpeakTime * MINUTE);
1846 stmt->setInt64(0, muteTime);
1847 }
1848
1849 stmt->setString(1, muteReasonStr.c_str());
1850 stmt->setString(2, muteBy.c_str());
1851 stmt->setUInt32(3, accountId);
1852 LoginDatabase.Execute(stmt);
1853 std::string nameLink = handler->playerLink(targetName);
1854
1855 handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
1856
1857 return true;
1858 }
1859
1860 // unmute player
1861 static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
1862 {
1863 Player* target;
1864 uint64 targetGuid;
1865 std::string targetName;
1866 if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
1867 return false;
1868
1869 uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
1870
1871 // find only player from same account if any
1872 if (!target)
1873 if (WorldSession* session = sWorld->FindSession(accountId))
1874 target = session->GetPlayer();
1875
1876 // must have strong lesser security level
1877 if (handler->HasLowerSecurity(target, targetGuid, true))
1878 return false;
1879
1880 if (target)
1881 {
1882 if (target->CanSpeak())
1883 {
1885 handler->SetSentErrorMessage(true);
1886 return false;
1887 }
1888
1889 target->GetSession()->m_muteTime = 0;
1890 }
1891
1892 PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
1893 stmt->setInt64(0, 0);
1894 stmt->setString(1, "");
1895 stmt->setString(2, "");
1896 stmt->setUInt32(3, accountId);
1897 LoginDatabase.Execute(stmt);
1898
1899 if (target)
1901
1902 std::string nameLink = handler->playerLink(targetName);
1903
1904 handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
1905
1906 return true;
1907 }
1908
1909
1910 static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/)
1911 {
1912 Unit* unit = handler->getSelectedUnit();
1913 if (!unit)
1914 {
1916 handler->SetSentErrorMessage(true);
1917 return false;
1918 }
1919
1920 handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TypeID::TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
1921
1922 MotionMaster* motionMaster = unit->GetMotionMaster();
1923 float x, y, z;
1924 motionMaster->GetDestination(x, y, z);
1925
1926 for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
1927 {
1928 MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i);
1929 if (!movementGenerator)
1930 {
1931 handler->SendSysMessage("Empty");
1932 continue;
1933 }
1934
1935 switch (movementGenerator->GetMovementGeneratorType())
1936 {
1937 case IDLE_MOTION_TYPE:
1939 break;
1940 case RANDOM_MOTION_TYPE:
1942 break;
1945 break;
1948 break;
1951 break;
1952 case CHASE_MOTION_TYPE:
1953 {
1954 Unit* target = NULL;
1955 if (unit->GetTypeId() == TypeID::TYPEID_PLAYER)
1956 target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
1957 else
1958 target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
1959
1960 if (!target)
1962 else if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
1963 handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName().c_str(), target->GetGUIDLow());
1964 else
1965 handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName().c_str(), target->GetGUIDLow());
1966 break;
1967 }
1968 case FOLLOW_MOTION_TYPE:
1969 {
1970 Unit* target = NULL;
1971 if (unit->GetTypeId() == TypeID::TYPEID_PLAYER)
1972 target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
1973 else
1974 target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
1975
1976 if (!target)
1978 else if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
1979 handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName().c_str(), target->GetGUIDLow());
1980 else
1981 handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName().c_str(), target->GetGUIDLow());
1982 break;
1983 }
1984 case HOME_MOTION_TYPE:
1985 {
1986 if (unit->GetTypeId() == TypeID::TYPEID_UNIT)
1988 else
1990 break;
1991 }
1992 case FLIGHT_MOTION_TYPE:
1994 break;
1995 case POINT_MOTION_TYPE:
1996 {
1997 handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
1998 break;
1999 }
2002 break;
2005 break;
2006 case EFFECT_MOTION_TYPE:
2008 break;
2009 default:
2010 handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType());
2011 break;
2012 }
2013 }
2014 return true;
2015 }
2016 /*
2017 ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
2018 Without this function 3rd party scripting library will get linking errors (unresolved external)
2019 when attempting to use the PointMovementGenerator
2020 */
2021 static bool HandleComeToMeCommand(ChatHandler* handler, char const* args)
2022 {
2023 char const* newFlagStr = strtok((char*)args, " ");
2024 if (!newFlagStr)
2025 return false;
2026
2027 Creature* caster = handler->getSelectedCreature();
2028 if (!caster)
2029 {
2031 handler->SetSentErrorMessage(true);
2032 return false;
2033 }
2034
2035 Player* player = handler->GetSession()->GetPlayer();
2036
2037 caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
2038
2039 return true;
2040 }
2041
2042 static bool HandleDamageCommand(ChatHandler* handler, char const* args)
2043 {
2044 if (!*args)
2045 return false;
2046
2047 char* str = strtok((char*)args, " ");
2048
2049 if (strcmp(str, "go") == 0)
2050 {
2051 char* guidStr = strtok(NULL, " ");
2052 if (!guidStr)
2053 {
2055 handler->SetSentErrorMessage(true);
2056 return false;
2057 }
2058
2059 int32 guid = atoi(guidStr);
2060 if (!guid)
2061 {
2063 handler->SetSentErrorMessage(true);
2064 return false;
2065 }
2066
2067 char* damageStr = strtok(NULL, " ");
2068 if (!damageStr)
2069 {
2071 handler->SetSentErrorMessage(true);
2072 return false;
2073 }
2074
2075 int32 damage = atoi(damageStr);
2076 if (!damage)
2077 {
2079 handler->SetSentErrorMessage(true);
2080 return false;
2081 }
2082
2083 if (Player* player = handler->GetSession()->GetPlayer())
2084 {
2085 GameObject* go = NULL;
2086
2087 if (GameObjectData const* goData = sObjectMgr->GetGOData(guid))
2088 go = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guid, goData->id);
2089
2090 if (!go)
2091 {
2093 handler->SetSentErrorMessage(true);
2094 return false;
2095 }
2096
2097 if (!go->IsDestructibleBuilding())
2098 {
2100 handler->SetSentErrorMessage(true);
2101 return false;
2102 }
2103
2104 go->ModifyHealth(-damage, player);
2105 handler->PSendSysMessage(LANG_GAMEOBJECT_DAMAGED, go->GetName().c_str(), guid, -damage, go->GetGOValue()->Building.Health);
2106 }
2107
2108 return true;
2109 }
2110
2111 Unit* target = handler->getSelectedUnit();
2112 if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
2113 {
2115 handler->SetSentErrorMessage(true);
2116 return false;
2117 }
2118
2119 if (Player* player = target->ToPlayer())
2120 if (handler->HasLowerSecurity(player, 0, false))
2121 return false;
2122
2123 if (!target->IsAlive())
2124 return true;
2125
2126 char* damageStr = strtok((char*)args, " ");
2127 if (!damageStr)
2128 return false;
2129
2130 int32 damage_int = atoi((char*)damageStr);
2131 if (damage_int <= 0)
2132 return true;
2133
2134 uint32 damage = damage_int;
2135
2136 char* schoolStr = strtok((char*)NULL, " ");
2137
2138 // flat melee damage without resistence/etc reduction
2139 if (!schoolStr)
2140 {
2141 handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
2142 if (target != handler->GetSession()->GetPlayer())
2144 return true;
2145 }
2146
2147 uint32 school = atoi((char*)schoolStr);
2148 if (school >= MAX_SPELL_SCHOOL)
2149 return false;
2150
2151 SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
2152
2153 if (Unit::IsDamageReducedByArmor(schoolmask))
2154 damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, WeaponAttackType::BASE_ATTACK);
2155
2156 char* spellStr = strtok((char*)NULL, " ");
2157
2158 // melee damage by specific school
2159 if (!spellStr)
2160 {
2161 uint32 absorb = 0;
2162 uint32 resist = 0;
2163
2164 handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
2165
2166 if (damage <= absorb + resist)
2167 return true;
2168
2169 damage -= absorb + resist;
2170
2171 handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb);
2172 handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
2173 handler->GetSession()->GetPlayer()->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VictimState::VICTIMSTATE_WOUND, 0);
2174 return true;
2175 }
2176
2177 // non-melee damage
2178
2179 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
2180 uint32 spellid = handler->extractSpellIdFromLink((char*)args);
2181 if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
2182 return false;
2183
2184 handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
2185 return true;
2186 }
2187
2188 static bool HandleCombatStopCommand(ChatHandler* handler, char const* args)
2189 {
2190 Player* target = NULL;
2191
2192 if (args && strlen(args) > 0)
2193 {
2194 target = sObjectAccessor->FindPlayerByName(args);
2195 if (!target)
2196 {
2198 handler->SetSentErrorMessage(true);
2199 return false;
2200 }
2201 }
2202
2203 if (!target)
2204 {
2205 if (!handler->extractPlayerTarget((char*)args, &target))
2206 return false;
2207 }
2208
2209 // check online security
2210 if (handler->HasLowerSecurity(target, 0))
2211 return false;
2212
2213 target->CombatStop();
2215 return true;
2216 }
2217
2218 static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args)
2219 {
2220 Player* target;
2221 if (!handler->extractPlayerTarget((char*)args, &target))
2222 return false;
2223
2224 // check online security
2225 if (handler->HasLowerSecurity(target, 0))
2226 return false;
2227
2228 // Repair items
2229 target->DurabilityRepairAll(false, 0, false);
2230
2231 handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str());
2232 if (handler->needReportToTarget(target))
2234
2235 return true;
2236 }
2237
2238 static bool HandleFreezeCommand(ChatHandler* handler, char const* args)
2239 {
2240 std::string name;
2241 Player* player;
2242 char const* TargetName = strtok((char*)args, " "); // get entered name
2243 if (!TargetName) // if no name entered use target
2244 {
2245 player = handler->getSelectedPlayer();
2246 if (player) //prevent crash with creature as target
2247 {
2248 name = player->GetName();
2249 if (!normalizePlayerName(name))
2250 {
2252 handler->SetSentErrorMessage(true);
2253 return false;
2254 }
2255 }
2256 }
2257 else // if name entered
2258 {
2259 name = TargetName;
2260 if (!normalizePlayerName(name))
2261 {
2263 handler->SetSentErrorMessage(true);
2264 return false;
2265 }
2266 player = sObjectAccessor->FindPlayerByName(name);
2267 }
2268
2269 if (!player)
2270 {
2272 return true;
2273 }
2274
2275 if (player == handler->GetSession()->GetPlayer())
2276 {
2278 return true;
2279 }
2280
2281 // effect
2282 if (player && (player != handler->GetSession()->GetPlayer()))
2283 {
2284 handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str());
2285
2286 // stop combat + make player unattackable + duel stop + stop some spells
2287 player->setFaction(35);
2288 player->CombatStop();
2289 if (player->IsNonMeleeSpellCasted(true))
2290 player->InterruptNonMeleeSpells(true);
2292
2293 // if player class = hunter || warlock remove pet if alive
2294 if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK))
2295 {
2296 if (Pet* pet = player->GetPet())
2297 {
2298 pet->SavePetToDB(PET_SAVE_AS_CURRENT);
2299 // not let dismiss dead pet
2300 if (pet->IsAlive())
2301 player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
2302 }
2303 }
2304
2305 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454))
2306 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
2307
2308 // save player
2309 player->SaveToDB();
2310 }
2311
2312 return true;
2313 }
2314
2315 static bool HandleUnFreezeCommand(ChatHandler* handler, char const* args)
2316 {
2317 std::string name;
2318 Player* player;
2319 char* targetName = strtok((char*)args, " "); // Get entered name
2320
2321 if (targetName)
2322 {
2323 name = targetName;
2324 if (!normalizePlayerName(name))
2325 {
2327 handler->SetSentErrorMessage(true);
2328 return false;
2329 }
2330 player = sObjectAccessor->FindPlayerByName(name);
2331 }
2332 else // If no name was entered - use target
2333 {
2334 player = handler->getSelectedPlayer();
2335 if (player)
2336 name = player->GetName();
2337 }
2338
2339 if (player)
2340 {
2341 handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
2342
2343 // Reset player faction + allow combat + allow duels
2344 player->setFactionForRace(player->getRace());
2346
2347 // Remove Freeze spell (allowing movement and spells)
2348 player->RemoveAurasDueToSpell(9454);
2349
2350 // Save player
2351 player->SaveToDB();
2352 }
2353 else
2354 {
2355 if (targetName)
2356 {
2357 // Check for offline players
2359 stmt->setString(0, name);
2360 PreparedQueryResult result = CharacterDatabase.Query(stmt);
2361
2362 if (!result)
2363 {
2365 return true;
2366 }
2367
2368 // If player found: delete his freeze aura
2369 Field* fields = result->Fetch();
2370 uint32 lowGuid = fields[0].GetUInt32();
2371
2372 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
2373 stmt->setUInt32(0, lowGuid);
2374 CharacterDatabase.Execute(stmt);
2375
2376 handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
2377 return true;
2378 }
2379 else
2380 {
2382 return true;
2383 }
2384 }
2385
2386 return true;
2387 }
2388
2389 static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/)
2390 {
2391 // Get names from DB
2393 PreparedQueryResult result = CharacterDatabase.Query(stmt);
2394 if (!result)
2395 {
2397 return true;
2398 }
2399
2400 // Header of the names
2402
2403 // Output of the results
2404 do
2405 {
2406 Field* fields = result->Fetch();
2407 std::string player = fields[0].GetString();
2408 handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
2409 } while (result->NextRow());
2410
2411 return true;
2412 }
2413
2414 static bool HandlePlayAllCommand(ChatHandler* handler, char const* args)
2415 {
2416 if (!*args)
2417 return false;
2418
2419 uint32 soundId = atoi((char*)args);
2420
2421 if (!sSoundEntriesStore.LookupEntry(soundId))
2422 {
2423 handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
2424 handler->SetSentErrorMessage(true);
2425 return false;
2426 }
2427
2428 ObjectGuid guid = handler->GetSession()->GetPlayer()->GetGUID();
2429
2430 WorldPacket data(SMSG_PLAY_SOUND, 4 + 9);
2431 data.WriteBit(guid[2]);
2432 data.WriteBit(guid[3]);
2433 data.WriteBit(guid[7]);
2434 data.WriteBit(guid[6]);
2435 data.WriteBit(guid[0]);
2436 data.WriteBit(guid[5]);
2437 data.WriteBit(guid[4]);
2438 data.WriteBit(guid[1]);
2439 data << uint32(soundId);
2440 data.WriteByteSeq(guid[3]);
2441 data.WriteByteSeq(guid[2]);
2442 data.WriteByteSeq(guid[4]);
2443 data.WriteByteSeq(guid[7]);
2444 data.WriteByteSeq(guid[5]);
2445 data.WriteByteSeq(guid[0]);
2446 data.WriteByteSeq(guid[6]);
2447 data.WriteByteSeq(guid[1]);
2448 sWorld->SendGlobalMessage(&data);
2449
2451 return true;
2452 }
2453
2454 static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/)
2455 {
2456 Unit* unit = handler->getSelectedUnit();
2457 if (!unit)
2458 return false;
2459
2460 handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true);
2461 return true;
2462 }
2463
2464 static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/)
2465 {
2466 Unit* unit = handler->getSelectedUnit();
2467 if (!unit)
2468 unit = handler->GetSession()->GetPlayer();
2469
2470 unit->RemoveCharmAuras();
2471
2472 return true;
2473 }
2474
2475 static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/)
2476 {
2477 Unit* unit = handler->getSelectedUnit();
2478 if (!unit)
2479 return false;
2480
2481 handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
2482 return true;
2483 }
2484
2485 static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/)
2486 {
2487 Player* player = handler->GetSession()->GetPlayer();
2488
2489 if (player->isPossessing())
2490 return false;
2491
2492 player->StopCastingBindSight();
2493 return true;
2494 }
2495};
2496
2498{
2499 new misc_commandscript();
2500}
void EndianConvertReverse(T &val)
@ CHAR_SEL_PINFO_XP
@ CHAR_DEL_CHAR_AURA_FROZEN
@ CHAR_SEL_CHARACTER_AURA_FROZEN
@ CHAR_SEL_GUILD_MEMBER_EXTENDED
@ CHAR_SEL_CHAR_PINFO
@ CHAR_SEL_CHAR_GUID_BY_NAME
@ CHAR_SEL_PINFO_MAILS
@ CHAR_SEL_PINFO_BANS
@ IN_MILLISECONDS
Definition Common.h:125
@ MINUTE
Definition Common.h:119
AccountTypes
Definition Common.h:129
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
void Map2ZoneCoordinates(float &x, float &y, uint32 zone)
int32 GetAreaFlagByAreaID(uint32 area_id)
char const * GetClassName(uint8 class_, uint8)
char const * GetRaceName(uint8 race, uint8)
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
AreaTableEntry const * GetAreaEntryByAreaID(uint32 area_id)
#define MAX_EFFECT_MASK
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::int8_t int8
Definition Define.h:75
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
std::int64_t int64
Definition Define.h:72
std::uint16_t uint16
Definition Define.h:78
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
TypeMapContainer< AllGridObjectTypes > GridTypeMapContainer
Definition GridDefines.h:71
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
#define sInstanceSaveMgr
InventoryResult
Definition Item.h:27
@ EQUIP_ERR_OK
Definition Item.h:28
UNORDERED_MAP< uint32, ItemTemplate > ItemTemplateContainer
@ LANG_COMMAND_KICKSELF
Definition Language.h:288
@ LANG_MOVEGENS_FOLLOW_PLAYER
Definition Language.h:929
@ LANG_CHARACTER_GENDER_FEMALE
Definition Language.h:823
@ LANG_ADDITEMSET
Definition Language.h:483
@ LANG_DEV_ON
Definition Language.h:927
@ LANG_COMMAND_GRAVEYARDALRLINKED
Definition Language.h:430
@ LANG_MOVEGENS_EFFECT
Definition Language.h:932
@ LANG_SELECT_CREATURE
Definition Language.h:13
@ LANG_PINFO_CHR_GUILD_NOTE
Definition Language.h:816
@ LANG_PINFO_CHR_ALIVE
Definition Language.h:810
@ LANG_SUMMONING
Definition Language.h:110
@ LANG_PINFO_ACC_LASTLOGIN
Definition Language.h:804
@ LANG_COMMAND_GRAVEYARD_ALLIANCE
Definition Language.h:437
@ LANG_PINFO_CHR_PHASE
Definition Language.h:811
@ LANG_COMMAND_OBJNOTFOUND
Definition Language.h:280
@ LANG_MOVEGENS_UNKNOWN
Definition Language.h:532
@ LANG_ERROR
Definition Language.h:59
@ LANG_COMMAND_ZONENOGRAFACTION
Definition Language.h:441
@ LANG_NO_WEATHER
Definition Language.h:380
@ LANG_DEV_OFF
Definition Language.h:928
@ LANG_OFFLINE
Definition Language.h:50
@ LANG_PLAYERS_SAVED
Definition Language.h:28
@ LANG_PINFO_CHR_LEVEL_LOW
Definition Language.h:808
@ LANG_CANNOT_GO_TO_INST_PARTY
Definition Language.h:106
@ LANG_PINFO_CHR_PLAYEDTIME
Definition Language.h:818
@ LANG_COMMAND_PLAYED_TO_ALL
Definition Language.h:1076
@ LANG_COMMAND_DISABLE_CHAT_DELAYED
Definition Language.h:290
@ LANG_IS_TELEPORTED
Definition Language.h:104
@ LANG_LIQUID_STATUS
Definition Language.h:185
@ LANG_COMMAND_COULDNOTFIND
Definition Language.h:414
@ LANG_COMMAND_FREEZE_ERROR
Definition Language.h:1068
@ LANG_PINFO_CHR_RACE
Definition Language.h:809
@ LANG_ITEM_CANNOT_CREATE
Definition Language.h:485
@ LANG_MOVEGENS_CHASE_PLAYER
Definition Language.h:526
@ LANG_COMMAND_GRAVEYARDNOEXIST
Definition Language.h:429
@ LANG_CANT_TELEPORT_SELF
Definition Language.h:181
@ LANG_APPEARING_AT
Definition Language.h:115
@ LANG_MOVEGENS_IDLE
Definition Language.h:521
@ LANG_USE_BOL
Definition Language.h:265
@ LANG_YOU
Definition Language.h:57
@ LANG_MOVEGENS_CONFUSED
Definition Language.h:525
@ LANG_PINFO_PLAYER
Definition Language.h:799
@ LANG_COMMAND_LIST_FREEZE
Definition Language.h:1072
@ LANG_MOVEGENS_FOLLOW_CREATURE
Definition Language.h:930
@ LANG_MOVEGENS_FOLLOW_NULL
Definition Language.h:931
@ LANG_PLAYER_SAVED
Definition Language.h:27
@ LANG_PINFO_ACC_OS
Definition Language.h:805
@ LANG_UNEXPLORE_AREA
Definition Language.h:562
@ LANG_CHARACTER_GENDER_MALE
Definition Language.h:822
@ LANG_MOVEGENS_DISTRACT
Definition Language.h:597
@ LANG_YOUR_CHAT_DISABLED
Definition Language.h:306
@ LANG_COMMAND_GRAVEYARDWRONGZONE
Definition Language.h:432
@ LANG_COMMAND_NO_FROZEN_PLAYERS
Definition Language.h:1071
@ LANG_CHAT_ALREADY_ENABLED
Definition Language.h:308
@ LANG_COMMAND_GRAVEYARDNEAREST
Definition Language.h:439
@ LANG_WEATHER_DISABLED
Definition Language.h:381
@ LANG_GAMEOBJECT_DAMAGED
Definition Language.h:187
@ LANG_COMMAND_UNFREEZE
Definition Language.h:1070
@ LANG_NO_ITEMS_FROM_ITEMSET_FOUND
Definition Language.h:490
@ LANG_PINFO_CHR_MONEY
Definition Language.h:812
@ LANG_REMOVE_COOLDOWN
Definition Language.h:480
@ LANG_INVALID_SKILL_ID
Definition Language.h:473
@ LANG_YOU_REPAIR_ITEMS
Definition Language.h:343
@ LANG_YOU_ENABLE_CHAT
Definition Language.h:310
@ LANG_YOUR_CHAT_ENABLED
Definition Language.h:309
@ LANG_PINFO_CHR_LEVEL_HIGH
Definition Language.h:820
@ LANG_CANNOT_SUMMON_TO_INST
Definition Language.h:105
@ LANG_UNKNOWN_SPELL
Definition Language.h:477
@ LANG_YOUR_ITEMS_REPAIRED
Definition Language.h:344
@ LANG_YOU_DISABLE_CHAT
Definition Language.h:307
@ LANG_COMMAND_GRAVEYARDLINKED
Definition Language.h:431
@ LANG_PINFO_CHR_MAP
Definition Language.h:813
@ LANG_COMMAND_FROZEN_PLAYERS
Definition Language.h:1073
@ LANG_CHAR_NON_MOUNTED
Definition Language.h:35
@ LANG_NO_CHAR_SELECTED
Definition Language.h:118
@ LANG_OBJECT_GUID
Definition Language.h:200
@ LANG_MOVEGENS_CHASE_CREATURE
Definition Language.h:527
@ LANG_PINFO_ACC_IP
Definition Language.h:807
@ LANG_COMMAND_ZONENOGRAVEYARDS
Definition Language.h:440
@ LANG_INVALID_GAMEOBJECT_TYPE
Definition Language.h:186
@ LANG_SELECT_CHAR_OR_CREATURE
Definition Language.h:12
@ LANG_YOU_IN_FLIGHT
Definition Language.h:31
@ LANG_MOVEGENS_RANDOM
Definition Language.h:522
@ LANG_PINFO_BANNED
Definition Language.h:801
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:487
@ LANG_SOUND_NOT_EXIST
Definition Language.h:180
@ LANG_SUMMONED_BY
Definition Language.h:111
@ LANG_MOVEGENS_WAYPOINT
Definition Language.h:523
@ LANG_MOVEGENS_POINT
Definition Language.h:595
@ LANG_PINFO_CHR_GUILD_RANK
Definition Language.h:815
@ LANG_CANNOT_GO_TO_INST_GM
Definition Language.h:107
@ LANG_PINFO_ACC_ACCOUNT
Definition Language.h:803
@ LANG_EXPLORE_AREA
Definition Language.h:561
@ LANG_COMMAND_GRAVEYARD_NOTEAM
Definition Language.h:435
@ LANG_PINFO_ACC_REGMAILS
Definition Language.h:806
@ LANG_BAD_VALUE
Definition Language.h:117
@ LANG_MOVEGENS_ANIMAL_RANDOM
Definition Language.h:524
@ LANG_ADDITEM
Definition Language.h:482
@ LANG_PINFO_GM_ACTIVE
Definition Language.h:800
@ LANG_CANNOT_GO_TO_BG_GM
Definition Language.h:717
@ LANG_COMMAND_FREEZE
Definition Language.h:1067
@ LANG_PINFO_CHR_MAILS
Definition Language.h:819
@ LANG_MOVEGENS_CHASE_NULL
Definition Language.h:528
@ LANG_MOVEGENS_FLIGHT
Definition Language.h:531
@ LANG_COMMAND_KICKMESSAGE
Definition Language.h:289
@ LANG_PINFO_CHR_GUILD
Definition Language.h:814
@ LANG_COMMAND_GRAVEYARDERROR
Definition Language.h:434
@ LANG_COMMAND_FREEZE_WRONG
Definition Language.h:1069
@ LANG_PINFO_CHR_GUILD_ONOTE
Definition Language.h:817
@ LANG_NO_HELP_CMD
Definition Language.h:18
@ LANG_MAP_POSITION
Definition Language.h:103
@ LANG_MOVEGENS_HOME_CREATURE
Definition Language.h:529
@ LANG_SET_SKILL
Definition Language.h:470
@ LANG_NO_SELECTION
Definition Language.h:199
@ LANG_MOVEGENS_HOME_PLAYER
Definition Language.h:530
@ LANG_MOVEGENS_LIST
Definition Language.h:520
@ LANG_DISTANCE
Definition Language.h:492
@ LANG_COMMAND_GRAVEYARD_HORDE
Definition Language.h:438
@ LANG_COMMAND_GRAVEYARD_ANY
Definition Language.h:436
@ LANG_MOVEGENS_FEAR
Definition Language.h:596
@ LANG_REMOVEITEM
Definition Language.h:484
@ LANG_PINFO_MUTED
Definition Language.h:802
@ LANG_REMOVEALL_COOLDOWN
Definition Language.h:479
@ LANG_COMMAND_ITEMIDINVALID
Definition Language.h:415
#define SF_LOG_DEBUG(filterType__,...)
Definition Log.h:134
@ LOGIN_SEL_IP2NATION_COUNTRY
@ LOGIN_SEL_PINFO
@ LOGIN_UPD_MUTE_TIME
@ LOGIN_SEL_PINFO_BANS
ZLiquidStatus
Definition Map.h:114
#define MAX_HEIGHT
Definition Map.h:141
#define MAP_ALL_LIQUIDS
Definition Map.h:128
@ MAX_MOTION_SLOT
@ 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
@ ANIMAL_RANDOM_MOTION_TYPE
@ RANDOM_MOTION_TYPE
@ EFFECT_MOTION_TYPE
@ TYPEID_PLAYER
Definition Object.h:55
@ TYPEID_UNIT
Definition Object.h:54
@ TYPEMASK_UNIT
Definition Object.h:40
@ TYPEMASK_GAMEOBJECT
Definition Object.h:42
#define sObjectAccessor
uint32 GUID_LOPART(uint64 x)
@ HIGHGUID_PLAYER
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
uint32 GUID_HIPART(uint64 guid)
bool normalizePlayerName(std::string &name)
#define sObjectMgr
Definition ObjectMgr.h:1617
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:25
@ PET_SAVE_AS_CURRENT
Definition PetDefines.h:22
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:777
@ TELE_TO_GM_MODE
Definition Player.h:829
@ PLAYER_FLAGS_GHOST
Definition Player.h:541
@ PLAYER_FLAGS_DEVELOPER
Definition Player.h:552
#define INVENTORY_SLOT_BAG_0
Definition Player.h:684
#define PLAYER_EXPLORED_ZONES_SIZE
Definition Player.h:55
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Definition QueryResult.h:94
@ CLASS_HUNTER
@ CLASS_WARLOCK
@ ALLIANCE
@ HORDE
@ SILVER
@ GOLD
WeatherType
#define MAX_SPELL_SCHOOL
SpellSchoolMask
@ SPELL_SCHOOL_MASK_NORMAL
@ SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW
@ SPELL_AURA_MOUNTED
#define sSpellMgr
Definition SpellMgr.h:744
@ VICTIMSTATE_WOUND
Definition Unit.h:291
@ HITINFO_AFFECTS_VICTIM
Definition Unit.h:305
@ NULL_BAG
Definition Unit.h:336
@ NULL_SLOT
Definition Unit.h:337
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ DIRECT_DAMAGE
Definition Unit.h:614
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:615
@ UNIT_FIELD_FLAGS
@ PLAYER_FIELD_EXPLORED_ZONES
@ PLAYER_FIELD_PLAYER_FLAGS
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
Definition Util.cpp:127
@ WORLD_SEL_REQ_XP
@ WORLD_SEL_ITEM_TEMPLATE_BY_NAME
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint32 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=NULL, Item *castItem=NULL, uint64 casterGUID=0, bool *refresh=NULL)
bool WriteBit(uint32 bit)
Definition ByteBuffer.h:164
void WriteByteSeq(uint8 b)
Definition ByteBuffer.h:227
virtual std::string GetNameLink() const
Definition Chat.h:79
bool HasLowerSecurity(Player *target, uint64 guid, bool strong=false)
Definition Chat.cpp:78
void extractOptFirstArg(char *args, char **arg1, char **arg2)
Definition Chat.cpp:1237
GameObject * GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry)
Definition Chat.cpp:998
std::string playerLink(std::string const &name) const
Definition Chat.h:108
Unit * getSelectedUnit()
Definition Chat.cpp:841
Player * getSelectedPlayer()
Definition Chat.cpp:829
WorldSession * GetSession()
Definition Chat.h:43
virtual LocaleConstant GetSessionDbcLocale() const
Definition Chat.cpp:1277
virtual bool HasPermission(uint32 permission) const
Definition Chat.h:78
Creature * getSelectedCreature()
Definition Chat.cpp:865
uint32 extractSpellIdFromLink(char *text)
Definition Chat.cpp:1042
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
Definition Chat.cpp:873
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition Chat.cpp:221
void SetSentErrorMessage(bool val)
Definition Chat.h:114
uint64 extractGuidFromLink(char *text)
Definition Chat.cpp:1119
bool extractPlayerTarget(char *args, Player **player, uint64 *player_guid=NULL, std::string *player_name=NULL)
Definition Chat.cpp:1184
virtual bool needReportToTarget(Player *chr) const
Definition Chat.cpp:1271
virtual void SendSysMessage(const char *str)
Definition Chat.cpp:153
virtual const char * GetSkyFireString(int32 entry) const
Definition Chat.cpp:68
bool ShowHelpForCommand(std::vector< ChatCommand > const &table, const char *cmd)
Definition Chat.cpp:523
static std::vector< ChatCommand > const & getCommandTable()
Definition Chat.cpp:29
CommandScript(const char *name)
void Respawn(bool force=false)
Definition Field.h:16
uint8 GetUInt8() const
Definition Field.h:26
std::string GetString() const
Definition Field.h:228
uint64 GetUInt64() const
Definition Field.h:141
uint16 GetUInt16() const
Definition Field.h:69
uint32 GetUInt32() const
Definition Field.h:105
GameObjectValue const * GetGOValue() const
Definition GameObject.h:645
bool IsDestructibleBuilding() const
void ModifyHealth(int32 change, Unit *attackerOrHealer=NULL, uint32 spellId=0)
Definition Group.h:147
InstanceGroupBind * GetBoundInstance(Player *player)
Definition Group.cpp:2393
uint64 GetLeaderGUID() const
Definition Group.cpp:2568
Definition Item.h:202
void SetBinding(bool val)
Definition Item.h:217
static int32 GenerateItemRandomPropertyId(uint32 item_id)
Definition Item.cpp:575
static MMapManager * createOrGetMMapManager()
static bool IsPathfindingEnabled(uint32 mapId)
dtNavMesh const * GetNavMesh(uint32 mapId, TerrainSet swaps)
Definition Map.h:238
bool IsBattlegroundOrArena() const
Definition Map.h:378
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition Map.cpp:1959
bool IsRaid() const
Definition Map.h:372
bool Instanceable() const
Definition Map.h:367
MapEntry const * GetEntry() const
Definition Map.h:244
bool IsOutdoors(float x, float y, float z) const
Definition Map.cpp:2025
uint32 GetInstanceId() const
Definition Map.h:357
static bool ExistVMap(uint32 mapid, int gx, int gy)
Definition Map.cpp:104
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data=0) const
Definition Map.cpp:2110
static bool ExistMap(uint32 mapid, int gx, int gy)
Definition Map.cpp:75
bool IsInstance() const
Definition Map.h:368
_Ty GetMotionSlot(int slot) const
void MovementExpired(bool reset=true)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true)
bool GetDestination(float &x, float &y, float &z)
virtual MovementGeneratorType GetMovementGeneratorType()=0
static Object * GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask)
uint64 GetGUID() const
Definition Object.h:119
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:325
Player * ToPlayer()
Definition Object.h:204
uint32 GetGUIDLow() const
Definition Object.h:120
TypeID GetTypeId() const
Definition Object.h:131
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:1261
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:1280
Creature * ToCreature()
Definition Object.h:207
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:1309
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:1038
Definition Pet.h:28
void setFactionForRace(uint8 race)
Definition Player.cpp:7090
bool CanSpeak() const
Definition Player.cpp:15397
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=NULL, uint32 itemid=0)
void UnbindInstance(uint32 mapid, DifficultyID difficulty, bool unload=false)
Definition Player.cpp:13904
InstancePlayerBind * GetBoundInstance(uint32 mapid, DifficultyID difficulty)
Definition Player.cpp:13877
uint32 GetSaveTimer() const
Definition Player.h:2827
float m_homebindZ
Definition Player.h:2851
BattlegroundTypeId GetBattlegroundTypeId() const
Definition Player.h:2701
uint32 GetTotalPlayedTime() const
Definition Player.h:1424
uint32 m_homebindMapId
Definition Player.h:2847
void UpdateSkillsToMaxSkillsForLevel()
Definition Player.cpp:6346
void SetDungeonDifficulty(DifficultyID dungeon_difficulty)
Definition Player.h:2317
float m_recallX
Definition Player.h:2838
float m_recallO
Definition Player.h:2841
void SetBattlegroundEntryPoint()
Definition Player.cpp:17930
void LeaveBattleground(bool teleportToEntryPoint=true)
Definition Player.cpp:17984
Pet * GetPet() const
Definition Player.cpp:15640
void SwapItem(uint16 src, uint16 dst)
DifficultyID GetDifficulty(MapEntry const *mapEntry) const
Definition Player.cpp:20762
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid)
Definition Player.cpp:15406
WorldSession * GetSession() const
Definition Player.h:2417
Item * GetItemByPos(uint16 pos) const
static bool LoadPositionFromDB(uint32 &mapid, float &x, float &y, float &z, float &o, bool &in_flight, uint64 guid)
Definition Player.cpp:12120
void SaveRecallPosition()
Definition Player.cpp:6866
DifficultyID GetRaidDifficulty() const
Definition Player.h:2316
void RepopAtGraveyard()
Definition Player.cpp:5585
uint16 GetSkillStep(uint16 skill) const
Definition Player.cpp:6551
float m_recallZ
Definition Player.h:2840
uint16 GetPureMaxSkillValue(uint32 skill) const
Definition Player.cpp:6599
uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank)
Definition Player.cpp:5489
void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal)
Definition Player.cpp:6377
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:15663
float m_homebindY
Definition Player.h:2850
Group * GetGroup()
Definition Player.h:2972
void SpawnCorpseBones()
Definition Player.cpp:5378
bool IsGameMaster() const
Definition Player.h:1369
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=NULL) const
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition Player.cpp:2090
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
void SaveToDB(bool create=false)
Definition Player.cpp:14300
uint32 m_recallMap
Definition Player.h:2837
void StopCastingBindSight()
Definition Player.cpp:20262
uint32 GetBattlegroundId() const
Definition Player.h:2697
uint64 GetMoney() const
Definition Player.h:1945
float m_recallY
Definition Player.h:2839
void SetRaidDifficulty(DifficultyID raid_difficulty)
Definition Player.h:2318
void RemoveAllSpellCooldown()
Definition Player.cpp:4350
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0, AllowedLooterSet const &allowedLooters=AllowedLooterSet())
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:4284
DifficultyID GetDungeonDifficulty() const
Definition Player.h:2315
void SetBattlegroundId(uint32 val, BattlegroundTypeId bgTypeId)
Definition Player.cpp:19254
WorldLocation GetStartPosition() const
Definition Player.cpp:18057
void CleanupAfterTaxiFlight()
Definition Player.cpp:16748
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false)
Definition Player.cpp:11604
bool IsBeingTeleported() const
Definition Player.h:2493
float m_homebindX
Definition Player.h:2849
bool IsValidPos(uint16 pos, bool explicit_pos)
Definition Player.h:1547
InstancePlayerBind * BindToInstance(InstanceSave *save, bool permanent, bool load=false)
Definition Player.cpp:13932
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:5203
void setString(const uint8 index, const std::string &value)
void setInt64(const uint8 index, const int64 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt8(const uint8 index, const uint8 value)
void setInt32(const uint8 index, const int32 value)
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, Opcodes opcode=SMSG_CAST_FAILED)
Definition Spell.cpp:3874
Definition Unit.h:1367
uint8 getGender() const
Definition Unit.h:1551
void setFaction(uint32 faction)
Definition Unit.h:1699
void Kill(Unit *victim, bool durabilityLoss=true)
Definition Unit.cpp:6342
void CombatStop(bool includingCast=false)
bool IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:1402
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID=0, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
void DealDamageMods(Unit *victim, uint32 &damage, uint32 *absorb)
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition Unit.cpp:1985
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:1433
MotionMaster * GetMotionMaster()
Definition Unit.h:2605
bool IsPet() const
Definition Unit.h:1511
void Dismount()
Definition Unit.cpp:3685
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=NULL, uint8 effIndex=MAX_SPELL_EFFECTS)
uint32 CalcArmorReducedDamage(Unit *victim, const uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=WeaponAttackType::MAX_ATTACK)
uint8 getClass() const
Definition Unit.h:1543
uint64 GetTarget() const
Definition Unit.h:2830
bool IsAlive() const
Definition Unit.h:2032
uint16 GetMaxSkillValueForLevel(Unit const *target=NULL) const
Definition Unit.h:1757
void CalcAbsorbResist(Unit *victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32 *absorb, uint32 *resist, SpellInfo const *spellInfo=NULL)
bool IsInFlight() const
Definition Unit.h:1891
uint32 DealDamage(Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=NULL, bool durabilityLoss=true)
bool isPossessing() const
Definition Unit.cpp:2818
uint32 GetHealth() const
Definition Unit.h:1600
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:7454
bool IsMounted() const
Definition Unit.h:1742
HostileRefManager & getHostileRefManager()
Definition Unit.h:2466
void RemoveAurasByType(AuraType auraType, uint64 casterGUID=0, Aura *except=NULL, bool negative=true, bool positive=true)
void RemoveAllAuras()
uint8 getLevel() const
Definition Unit.h:1528
uint32 SpellNonMeleeDamageLog(Unit *victim, uint32 spellID, uint32 damage)
static Player * GetPlayer(WorldObject &object, uint64 guid)
Definition Unit.cpp:4900
void RemoveCharmAuras()
Definition Unit.cpp:2904
bool IsInCombat() const
Definition Unit.h:1896
uint8 getRace() const
Definition Unit.h:1535
bool isDead() const
Definition Unit.h:2040
Weather for one zone.
Definition Weather.h:53
uint32 GetMapId() const
Definition Object.h:546
uint32 GetPhaseMask() const
Definition Object.h:643
Map * GetMap() const
Definition Object.h:740
std::set< uint32 > const & GetTerrainSwaps() const
Definition Object.h:649
float GetGridActivationRange() const
Definition Object.cpp:2054
std::set< uint32 > const & GetPhases() const
Definition Object.h:647
uint32 GetInstanceId() const
Definition Object.h:638
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1684
std::string const & GetName() const
Definition Object.h:664
std::set< uint32 > const & GetWorldMapSwaps() const
Definition Object.h:650
void GetContactPoint(WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
Definition Object.cpp:3094
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
Definition Object.cpp:3070
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1666
uint32 GetAreaId() const
Definition Object.cpp:1602
uint32 GetZoneId() const
Definition Object.cpp:1597
float GetObjectSize() const
Definition Object.cpp:3100
Player session in the World.
void KickPlayer()
Kick a player out of the World.
void SendNotification(const char *format,...) ATTR_PRINTF(2
AccountTypes GetSecurity() const
Player * GetPlayer() const
bool HasPermission(uint32 permissionId)
uint32 GetAccountId() const
void SendShowBank(ObjectGuid guid)
uint32 GetLatency() const
std::string const & GetPlayerName() const
time_t m_muteTime
static bool HandleLinkGraveCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:889
static bool HandleGetDistanceCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:708
static bool HandleUnAuraCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:247
static bool HandleComeToMeCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:2021
static bool HandleDamageCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:2042
static bool HandleHideAreaCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1035
static bool HandleMaxSkillCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:1289
static bool HandleGUIDCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:606
static bool HandleSummonCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:416
static bool HandleSetSkillCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1304
static bool HandleReviveCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:562
static bool HandleUnFreezeCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:2315
static bool HandleItemMoveCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:638
static bool HandleListFreezeCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:2389
static bool HandleUnbindSightCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:2485
static bool HandleRespawnCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:1761
static bool HandleCommandsCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:530
static bool HandleKickPlayerCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:801
static bool HandleDevCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:88
static bool HandleDieCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:536
static bool HandleAuraCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:228
static bool HandleHelpCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:621
static bool HandleAddItemSetCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1175
static bool HandleGPSCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:120
static bool HandleShowAreaCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1004
static bool HandlePInfoCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1376
static bool HandleChangeWeather(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1246
std::vector< ChatCommand > GetCommands() const OVERRIDE
Definition cs_misc.cpp:33
static bool HandleAddItemCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1066
static bool HandleBindSightCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:2475
static bool HandleSaveCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:769
static bool HandleUnPossessCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:2464
static bool HandleUnmuteCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1861
static bool HandleNearGraveCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:942
static bool HandleSaveAllCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:793
static bool HandlePossessCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:2454
static bool HandleRecallCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:741
static bool HandleCombatStopCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:2188
static bool HandlePlayAllCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:2414
static bool HandleCooldownCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:671
static bool HandleRepairitemsCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:2218
static bool HandleFreezeCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:2238
static bool HandleMuteCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:1795
static bool HandleBankCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:1240
static bool HandleDismountCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:582
static bool HandleUnstuckCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:829
static bool HandleAppearCommand(ChatHandler *handler, char const *args)
Definition cs_misc.cpp:274
static bool HandleMovegensCommand(ChatHandler *handler, char const *)
Definition cs_misc.cpp:1910
void AddSC_misc_commandscript()
Definition cs_misc.cpp:2497
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition Main.cpp:41
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition Main.cpp:40
@ SMSG_PLAY_SOUND
Definition Opcodes.h:883
#define sWorld
Definition World.h:910
Weather * AddWeather(uint32 zone_id)
Add a Weather object to the list.
void SetWeather(WeatherType type, float grade)
Set the weather.
Definition Weather.cpp:267
uint32 realmID
Id of the realm.
Definition Main.cpp:73
Weather * FindWeather(uint32 id)
Find a Weather object by the given zoneid.
@ CONFIG_MAX_PLAYER_LEVEL
Definition World.h:224
@ CONFIG_INTERVAL_SAVE
Definition World.h:200
@ CONFIG_DIE_COMMAND_MODE
Definition World.h:123
@ CONFIG_SHOW_KICK_IN_WORLD
Definition World.h:141
uint32 ToIPv4NetworkOrder(std::string const &host)
CellCoord ComputeCellCoord(float x, float y)
GridCoord ComputeGridCoord(float x, float y)
@ RBAC_PERM_COMMAND_COMMANDS
Definition RBAC.h:384
@ RBAC_PERM_COMMAND_DISMOUNT
Definition RBAC.h:389
@ RBAC_PERM_COMMAND_POSSESS
Definition RBAC.h:407
@ RBAC_PERM_COMMAND_NEARGRAVE
Definition RBAC.h:404
@ RBAC_PERM_COMMAND_PLAYALL
Definition RBAC.h:406
@ RBAC_PERM_COMMAND_UNFREEZE
Definition RBAC.h:419
@ RBAC_PERM_COMMAND_MUTE
Definition RBAC.h:403
@ RBAC_PERM_COMMAND_HIDEAREA
Definition RBAC.h:396
@ RBAC_PERM_COMMAND_SHOWAREA
Definition RBAC.h:415
@ RBAC_PERM_COMMAND_REPAIRITEMS
Definition RBAC.h:409
@ RBAC_PERM_COMMAND_BINDSIGHT
Definition RBAC.h:381
@ RBAC_PERM_COMMAND_ADDITEM
Definition RBAC.h:376
@ RBAC_PERM_COMMAND_DEV
Definition RBAC.h:387
@ RBAC_PERM_COMMAND_RESPAWN
Definition RBAC.h:410
@ RBAC_PERM_COMMAND_UNMUTE
Definition RBAC.h:420
@ RBAC_PERM_COMMAND_HELP
Definition RBAC.h:395
@ RBAC_PERM_COMMAND_COOLDOWN
Definition RBAC.h:385
@ RBAC_PERM_COMMAND_COMETOME
Definition RBAC.h:383
@ RBAC_PERM_COMMAND_COMBATSTOP
Definition RBAC.h:382
@ RBAC_PERM_COMMAND_SETSKILL
Definition RBAC.h:414
@ RBAC_PERM_COMMAND_ADDITEMSET
Definition RBAC.h:377
@ RBAC_PERM_COMMAND_AURA
Definition RBAC.h:379
@ RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY
Definition RBAC.h:70
@ RBAC_PERM_COMMAND_MOVEGENS
Definition RBAC.h:402
@ RBAC_PERM_COMMAND_UNSTUCK
Definition RBAC.h:422
@ RBAC_PERM_COMMAND_REVIVE
Definition RBAC.h:411
@ RBAC_PERM_COMMAND_APPEAR
Definition RBAC.h:378
@ RBAC_PERM_COMMAND_FREEZE
Definition RBAC.h:392
@ RBAC_PERM_COMMAND_BANK
Definition RBAC.h:380
@ RBAC_PERM_COMMAND_GPS
Definition RBAC.h:393
@ RBAC_PERM_COMMAND_UNPOSSESS
Definition RBAC.h:421
@ RBAC_PERM_COMMAND_MAXSKILL
Definition RBAC.h:401
@ RBAC_PERM_COMMAND_SUMMON
Definition RBAC.h:416
@ RBAC_PERM_COMMAND_RECALL
Definition RBAC.h:408
@ RBAC_PERM_COMMAND_DIE
Definition RBAC.h:388
@ RBAC_PERM_COMMAND_ITEMMOVE
Definition RBAC.h:397
@ RBAC_PERM_COMMAND_SAVE
Definition RBAC.h:412
@ RBAC_PERM_COMMAND_LISTFREEZE
Definition RBAC.h:400
@ RBAC_PERM_COMMAND_UNBINDSIGHT
Definition RBAC.h:418
@ RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS
Definition RBAC.h:71
@ RBAC_PERM_COMMAND_DAMAGE
Definition RBAC.h:386
@ RBAC_PERM_RESURRECT_WITH_FULL_HPS
Definition RBAC.h:78
@ RBAC_PERM_COMMAND_UNAURA
Definition RBAC.h:417
@ RBAC_PERM_COMMAND_KICK
Definition RBAC.h:398
@ RBAC_PERM_COMMAND_WCHANGE
Definition RBAC.h:423
@ RBAC_PERM_COMMAND_LINKGRAVE
Definition RBAC.h:399
@ RBAC_PERM_COMMAND_SAVEALL
Definition RBAC.h:413
@ RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA
Definition RBAC.h:88
@ RBAC_PERM_COMMAND_PINFO
Definition RBAC.h:405
@ RBAC_PERM_COMMAND_GUID
Definition RBAC.h:394
@ RBAC_PERM_COMMAND_DISTANCE
Definition RBAC.h:390
LoginDatabaseWorkerPool LoginDatabase
Definition Main.cpp:54
char * m_AreaName
uint32 m_ParentAreaID
Definition Cell.h:37
uint32 GridX() const
Definition Cell.h:63
void SetNoCreate()
Definition Cell.h:66
uint32 GridY() const
Definition Cell.h:64
void Visit(CellCoord const &, TypeContainerVisitor< T, CONTAINER > &visitor, Map &, WorldObject const &, float) const
Definition CellImpl.h:109
uint32 CellX() const
Definition Cell.h:61
uint32 CellY() const
Definition Cell.h:62
uint32 x_coord
uint32 y_coord
uint32 entry
Definition Map.h:136
float depth_level
Definition Map.h:138
uint32 type_flags
Definition Map.h:135
float level
Definition Map.h:137
char * name
float GetAngle(Position const *pos) const
Definition Object.cpp:1860
float GetExactDist2d(const float x, const float y) const
Definition Object.h:366
float GetExactDist(float x, float y, float z) const
Definition Object.h:382
float GetPositionZ() const
Definition Object.h:330
float GetOrientation() const
Definition Object.h:331
float GetPositionX() const
Definition Object.h:328
float GetPositionY() const
Definition Object.h:329
char * name
uint32 ID
struct GameObjectValue::@066256034265023241167237377333252073230363372212 Building