OregonCore  revision 71a6c59-git
Your Favourite TBC server
Level1.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "Common.h"
19 #include "Database/DatabaseEnv.h"
20 #include "WorldPacket.h"
21 #include "WorldSession.h"
22 #include "World.h"
23 #include "ObjectMgr.h"
24 #include "Player.h"
25 #include "AccountMgr.h"
26 #include "Opcodes.h"
27 #include "Chat.h"
28 #include "Log.h"
29 #include "MapManager.h"
30 #include "ObjectAccessor.h"
31 #include "Language.h"
32 #include "CellImpl.h"
33 #include "InstanceSaveMgr.h"
34 #include "Utilities/Util.h"
35 #include "TicketMgr.h"
36 
37 #ifdef _DEBUG_VMAPS
38 #include "VMapFactory.h"
39 #endif
40 
41 bool ChatHandler::HandleNpcSayCommand(const char* args)
42 {
43  if (!*args)
44  return false;
45 
46  Creature* pCreature = getSelectedCreature();
47  if (!pCreature)
48  {
50  SetSentErrorMessage(true);
51  return false;
52  }
53 
54  pCreature->Say(args, LANG_UNIVERSAL, 0);
55 
56  // make some emotes
57  char lastchar = args[strlen(args) - 1];
58  switch (lastchar)
59  {
60  case '?':
62  break;
63  case '!':
65  break;
66  default:
68  break;
69  }
70 
71  return true;
72 }
73 
74 bool ChatHandler::HandleNpcYellCommand(const char* args)
75 {
76  if (!*args)
77  return false;
78 
79  Creature* pCreature = getSelectedCreature();
80  if (!pCreature)
81  {
83  SetSentErrorMessage(true);
84  return false;
85  }
86 
87  pCreature->Yell(args, LANG_UNIVERSAL, 0);
88 
89  // make an emote
91 
92  return true;
93 }
94 
95 //show text emote by creature in chat
97 {
98  if (!*args)
99  return false;
100 
101  Creature* pCreature = getSelectedCreature();
102 
103  if (!pCreature)
104  {
106  SetSentErrorMessage(true);
107  return false;
108  }
109 
110  pCreature->TextEmote(args, 0);
111 
112  return true;
113 }
114 
115 // make npc whisper to player
117 {
118  if (!*args)
119  return false;
120 
121  char* receiver_str = strtok((char*)args, " ");
122  char* text = strtok(NULL, "");
123 
124  uint64 guid = m_session->GetPlayer()->GetSelection();
125  Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(guid);
126 
127  if (!pCreature || !receiver_str || !text)
128  return false;
129 
130  uint64 receiver_guid = atol(receiver_str);
131 
132  pCreature->Whisper(text, receiver_guid);
133 
134  return true;
135 }
136 
138 {
139  WorldPacket data;
140  if (!*args)
141  return false;
142 
143  sWorld.SendWorldText(LANG_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args);
144  return true;
145 }
146 
148 {
149  WorldPacket data;
150  if (!*args)
151  return false;
152 
153  sWorld.SendGMText(LANG_GM_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args);
154  return true;
155 }
156 
157 // global announce
159 {
160  if (!*args)
161  return false;
162 
163  sWorld.SendWorldText(LANG_SYSTEMMESSAGE, args);
164  return true;
165 }
166 
167 // announce to logged in GMs
169 {
170  if (!*args)
171  return false;
172 
173  sWorld.SendGMText(LANG_GM_BROADCAST, args);
174  return true;
175 }
176 
177 //notification player at the screen
178 bool ChatHandler::HandleNotifyCommand(const char* args)
179 {
180  if (!*args)
181  return false;
182 
183  std::string str = GetOregonString(LANG_GLOBAL_NOTIFY);
184  str += args;
185 
186  WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
187  data << str;
188  sWorld.SendGlobalMessage(&data);
189 
190  return true;
191 }
192 
193 //notification GM at the screen
195 {
196  if (!*args)
197  return false;
198 
199  std::string str = GetOregonString(LANG_GM_NOTIFY);
200  str += args;
201 
202  WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
203  data << str;
204  sWorld.SendGlobalGMMessage(&data);
205 
206  return true;
207 }
208 
209 //Enable\Dissable GM Mode
210 bool ChatHandler::HandleGMmodeCommand(const char* args)
211 {
212  Player* _player = m_session->GetPlayer();
213 
214  if (!*args)
215  {
217  return true;
218  }
219 
220  std::string argstr = (char*)args;
221 
222  if (argstr == "on")
223  {
224  _player->SetGameMaster(true);
226  _player->UpdateTriggerVisibility();
227  #ifdef _DEBUG_VMAPS
229  vMapManager->processCommand("stoplog");
230  #endif
231  return true;
232  }
233 
234  if (argstr == "off")
235  {
236  _player->SetGameMaster(false);
238  _player->UpdateTriggerVisibility();
239  #ifdef _DEBUG_VMAPS
241  vMapManager->processCommand("startlog");
242  #endif
243  return true;
244  }
245 
247  SetSentErrorMessage(true);
248  return false;
249 }
250 
251 // Enables or disables hiding of the staff badge
252 bool ChatHandler::HandleGMChatCommand(const char* args)
253 {
254  if (!*args)
255  {
256  if (m_session->GetPlayer()->isGMChat())
258  else
260  return true;
261  }
262 
263  std::string argstr = (char*)args;
264 
265  if (argstr == "on")
266  {
267  m_session->GetPlayer()->SetGMChat(true);
269  return true;
270  }
271 
272  if (argstr == "off")
273  {
274  m_session->GetPlayer()->SetGMChat(false);
276  return true;
277  }
278 
280  SetSentErrorMessage(true);
281  return false;
282 }
283 
284 std::string ChatHandler::PGetParseString(int32 entry, ...)
285 {
286  const char* format = GetOregonString(entry);
287  va_list ap;
288  char str [1024];
289  va_start(ap, entry);
290  vsnprintf(str, 1024, format, ap);
291  va_end(ap);
292  return (std::string)str;
293 }
294 
295 bool ChatHandler::HandleGMTicketListCommand(const char* /*args*/)
296 {
298  for (GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr)
299  {
300  if ((*itr)->closed != 0)
301  continue;
302  std::string gmname;
303  std::stringstream ss;
304  ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid);
305  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str());
306  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str());
307  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str());
308  if (sObjectMgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
309  ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
310  SendSysMessage(ss.str().c_str());
311  }
312  return true;
313 }
314 
316 {
318  for (GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr)
319  {
320  if ((*itr)->closed != 0 || !sObjectMgr.GetPlayer((*itr)->playerGuid))
321  continue;
322 
323  std::string gmname;
324  std::stringstream ss;
325  ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid);
326  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str());
327  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str());
328  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str());
329  if (sObjectMgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
330  ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
331  SendSysMessage(ss.str().c_str());
332  }
333  return true;
334 }
335 
337 {
339  for (GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr)
340  {
341  if ((*itr)->closed == 0)
342  continue;
343 
344  std::string gmname;
345  std::stringstream ss;
346  ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid);
347  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str());
348  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str());
349  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str());
350  if (sObjectMgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
351  ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
352  SendSysMessage(ss.str().c_str());
353  }
354  return true;
355 }
356 
358 {
359  if (!*args)
360  return false;
361 
362  uint64 tguid = atoi(args);
363  GM_Ticket* ticket = ticketmgr.GetGMTicket(tguid);
364  if (!ticket)
365  {
367  return true;
368  }
369 
370  ticket->viewed = true;
371  Player* plr = sObjectMgr.GetPlayer(ticket->playerGuid);
372  if (plr && plr->IsInWorld())
373  {
374  // tell client to update display of ticket status
376  data << uint32(1);
377  plr->GetSession()->SendPacket(&data);
378  }
379  ticketmgr.SaveGMTicket(ticket); // update database
380 
381  std::string gmname;
382  std::stringstream ss;
384  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
385  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - ticket->createtime, true, false)).c_str());
386  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - ticket->timestamp, true, false)).c_str());
387  if (sObjectMgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
388  ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
390  if (ticket->comment != "")
392  SendSysMessage(ss.str().c_str());
393  return true;
394 }
395 
397 {
398  if (!*args)
399  return false;
400 
401  GM_Ticket* ticket = ticketmgr.GetGMTicketByName(args);
402  if (!ticket)
403  {
405  return true;
406  }
407 
408  ticket->viewed = true;
409  Player* plr = sObjectMgr.GetPlayer(ticket->playerGuid);
410  if (plr && plr->IsInWorld())
411  {
412  // tell client to update display of ticket status
414  data << uint32(1);
415  plr->GetSession()->SendPacket(&data);
416  }
417  ticketmgr.SaveGMTicket(ticket); // update database
418 
419  std::string gmname;
420  std::stringstream ss;
422  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
423  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - ticket->createtime, true, false)).c_str());
424  ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - ticket->timestamp, true, false)).c_str());
425  if (sObjectMgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
426  ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
428  if (ticket->comment != "")
430  SendSysMessage(ss.str().c_str());
431  return true;
432 }
433 
435 {
436  if (!*args)
437  return false;
438 
439  uint64 tguid = atoi(args);
440  GM_Ticket* ticket = ticketmgr.GetGMTicket(tguid);
441  if (!ticket || ticket->closed != 0)
442  {
444  return true;
445  }
446  if (ticket->assignedToGM != 0 && ticket->assignedToGM != m_session->GetPlayer()->GetGUID())
447  {
449  return true;
450  }
451  std::stringstream ss;
453  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
455  SendGlobalGMSysMessage(ss.str().c_str());
456  Player* plr = sObjectMgr.GetPlayer(ticket->playerGuid);
457  ticketmgr.RemoveGMTicket(ticket->guid, m_session->GetPlayer()->GetGUID());
458 
459  if (!plr || !plr->IsInWorld())
460  return true;
461 
462  if ((float)rand_chance() < sWorld.getConfig(CONFIG_CHANCE_OF_GM_SURVEY))
463  {
464  // send survey
466  data << uint32(3); // 3 displays survey
467  plr->GetSession()->SendPacket(&data);
468  }
469  else
470  {
471  // send abandon ticket
473  data << uint32(9);
474  plr->GetSession()->SendPacket(&data);
475  }
476 
477  return true;
478 }
479 
481 {
482  if (!*args)
483  return false;
484 
485  char* tguid = strtok((char*)args, " ");
486  uint64 ticketGuid = atoi(tguid);
487  char* targetgm = strtok(NULL, " ");
488 
489  if (!targetgm)
490  return false;
491 
492  std::string targm = targetgm;
493  if (!normalizePlayerName(targm))
494  return false;
495 
496  Player* cplr = m_session->GetPlayer();
497  GM_Ticket* ticket = ticketmgr.GetGMTicket(ticketGuid);
498 
499  if (!ticket || ticket->closed != 0)
500  {
502  return true;
503  }
504 
505  uint64 tarGUID = sObjectMgr.GetPlayerGUIDByName(targm.c_str());
506  uint64 accid = sObjectMgr.GetPlayerAccountIdByGUID(tarGUID);
507  uint32 gmlevel = sAccountMgr->GetSecurity(accid, realmID);
508 
509  if (!tarGUID || gmlevel == SEC_PLAYER)
510  {
512  return true;
513  }
514 
515  if (ticket->assignedToGM == tarGUID)
516  {
518  return true;
519  }
520 
521  std::string gmname;
522  sObjectMgr.GetPlayerNameByGUID(tarGUID, gmname);
523  if (ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID())
524  {
525  PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid, gmname.c_str());
526  return true;
527  }
528 
529  ticket->escalated = true;
530  Player* plr = sObjectMgr.GetPlayer(ticket->playerGuid);
531  if (plr && plr->IsInWorld())
532  {
533  // tell client to update display of ticket status
535  data << uint32(1);
536  plr->GetSession()->SendPacket(&data);
537  }
538 
539  ticket->assignedToGM = tarGUID;
540  ticketmgr.UpdateGMTicket(ticket);
541  std::stringstream ss;
543  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
544  ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
545  SendGlobalGMSysMessage(ss.str().c_str());
546  return true;
547 }
548 
550 {
551  if (!*args)
552  return false;
553 
554  uint64 ticketGuid = atoi(args);
555  Player* cplr = m_session->GetPlayer();
556  GM_Ticket* ticket = ticketmgr.GetGMTicket(ticketGuid);
557 
558  if (!ticket || ticket->closed != 0)
559  {
561  return true;
562  }
563  if (ticket->assignedToGM == 0)
564  {
566  return true;
567  }
568 
569  std::string gmname;
570  sObjectMgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname);
571  Player* plr = sObjectMgr.GetPlayer(ticket->assignedToGM);
572  if (plr && plr->IsInWorld() && plr->GetSession()->GetSecurity() > cplr->GetSession()->GetSecurity())
573  {
575  return true;
576  }
577 
578  std::stringstream ss;
580  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
581  ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
583  SendGlobalGMSysMessage(ss.str().c_str());
584 
585  ticket->escalated = false;
586  Player* player = sObjectMgr.GetPlayer(ticket->playerGuid);
587  if (player && player->IsInWorld())
588  {
589  // tell client to update display of ticket status
591  data << uint32(1);
592  player->GetSession()->SendPacket(&data);
593  }
594 
595  ticket->assignedToGM = 0;
596  ticketmgr.UpdateGMTicket(ticket);
597  return true;
598 }
599 
601 {
602  if (!*args)
603  return false;
604 
605  char* tguid = strtok((char*)args, " ");
606  uint64 ticketGuid = atoi(tguid);
607  char* comment = strtok(NULL, "\n");
608 
609  if (!comment)
610  return false;
611 
612  Player* cplr = m_session->GetPlayer();
613  GM_Ticket* ticket = ticketmgr.GetGMTicket(ticketGuid);
614 
615  if (!ticket || ticket->closed != 0)
616  {
618  return true;
619  }
620  if (ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID())
621  {
623  return true;
624  }
625 
626  std::string gmname;
627  sObjectMgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname);
628  ticket->comment = comment;
629  ticketmgr.UpdateGMTicket(ticket);
630  std::stringstream ss;
632  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
633  if (sObjectMgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
634  ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
635  ss << PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, cplr->GetName(), ticket->comment.c_str());
636  SendGlobalGMSysMessage(ss.str().c_str());
637  return true;
638 }
639 
641 {
642  if (!*args)
643  return false;
644  uint64 ticketGuid = atoi(args);
645  GM_Ticket* ticket = ticketmgr.GetGMTicket(ticketGuid);
646 
647  if (!ticket)
648  {
650  return true;
651  }
652  if (ticket->closed == 0)
653  {
655  return true;
656  }
657 
658  std::stringstream ss;
660  ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
662  SendGlobalGMSysMessage(ss.str().c_str());
663  Player* plr = sObjectMgr.GetPlayer(ticket->playerGuid);
664  ticketmgr.DeleteGMTicketPermanently(ticket->guid);
665  if (plr && plr->IsInWorld())
666  {
667  // Force abandon ticket
669  data << uint32(9);
670  plr->GetSession()->SendPacket(&data);
671  }
672 
673  ticket = NULL;
674  return true;
675 }
676 
678 {
679  ticketmgr.LoadGMTickets();
680  return true;
681 }
682 
683 //Enable\Disable Invisible mode
684 bool ChatHandler::HandleVisibleCommand(const char* args)
685 {
686  Player* _player = m_session->GetPlayer();
687 
688  if (!*args)
689  {
691  return true;
692  }
693 
694  std::string argstr = (char*)args;
695 
696  if (argstr == "on")
697  {
698  if (_player->HasAura(SPELL_INVISIBILITY, 0))
700 
701  _player->SetGMVisible(true);
702  _player->UpdateObjectVisibility();
704  return true;
705  }
706 
707  if (argstr == "off")
708  {
709  _player->AddAura(SPELL_INVISIBILITY, _player);
710  _player->SetGMVisible(false);
711  _player->UpdateObjectVisibility();
713  return true;
714  }
715 
717  SetSentErrorMessage(true);
718  return false;
719 }
720 
721 bool ChatHandler::HandleGPSCommand(const char* args)
722 {
723  WorldObject* obj = NULL;
724  if (*args)
725  {
726  std::string name = args;
727  if (normalizePlayerName(name))
728  obj = sObjectMgr.GetPlayer(name.c_str());
729 
730  if (!obj)
731  {
733  SetSentErrorMessage(true);
734  return false;
735  }
736  }
737  else
738  {
739  obj = getSelectedUnit();
740 
741  if (!obj)
742  {
744  SetSentErrorMessage(true);
745  return false;
746  }
747  }
748  CellCoord cell_val = Oregon::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
749  Cell cell(cell_val);
750 
751  uint32 zone_id = obj->GetZoneId();
752  uint32 area_id = obj->GetAreaId();
753 
754  MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId());
755  AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id);
756  AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id);
757 
758  float zone_x = obj->GetPositionX();
759  float zone_y = obj->GetPositionY();
760 
761  Map2ZoneCoordinates(zone_x, zone_y, zone_id);
762 
763  Map const* map = obj->GetMap();
764  float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT);
765  float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ());
766 
768 
769  int gx = 63 - p.x_coord;
770  int gy = 63 - p.y_coord;
771 
772  uint32 have_map = Map::ExistMap(obj->GetMapId(), gx, gy) ? 1 : 0;
773  uint32 have_vmap = Map::ExistVMap(obj->GetMapId(), gx, gy) ? 1 : 0;
774 
775  if (have_vmap)
776  {
777  if (map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()))
778  PSendSysMessage("You are outdoors");
779  else
780  PSendSysMessage("You are indoor");
781  }
782  else PSendSysMessage("no VMAP available for area info");
783 
785  obj->GetMapId(), (mapEntry ? mapEntry->name[m_session->GetSessionDbcLocale()] : "<unknown>"),
786  zone_id, (zoneEntry ? zoneEntry->area_name[m_session->GetSessionDbcLocale()] : "<unknown>"),
787  area_id, (areaEntry ? areaEntry->area_name[m_session->GetSessionDbcLocale()] : "<unknown>"),
788  obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),
789  cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),
790  zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);
791 
792  sLog.outDebug("Player %s GPS call for %s '%s' (%s: %u):",
793  GetName(),
794  (obj->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), obj->GetName(),
795  (obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow() : obj->GetEntry()));
797  obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld.GetDefaultDbcLocale()] : "<unknown>"),
798  zone_id, (zoneEntry ? zoneEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>"),
799  area_id, (areaEntry ? areaEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>"),
800  obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),
801  cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),
802  zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);
803 
804  LiquidData liquid_status;
805  ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status);
806  if (res)
807  PSendSysMessage(LANG_LIQUID_STATUS, liquid_status.level, liquid_status.depth_level, liquid_status.entry, liquid_status.type_flags, res);
808  return true;
809 }
810 
811 //Summon Player
812 bool ChatHandler::HandleSummonCommand(const char* args)
813 {
814  if (!*args)
815  return false;
816 
817  std::string name = args;
818 
819  if (!normalizePlayerName(name))
820  {
822  SetSentErrorMessage(true);
823  return false;
824  }
825 
826  Player* target = sObjectMgr.GetPlayer(name.c_str());
827  if (target)
828  {
829  if (target->IsBeingTeleported())
830  {
832  SetSentErrorMessage(true);
833  return false;
834  }
835 
836  Map* pMap = m_session->GetPlayer()->GetMap();
837 
838  if (pMap->IsBattlegroundOrArena())
839  {
840  // only allow if gm mode is on
841  if (!target->IsGameMaster())
842  {
844  SetSentErrorMessage(true);
845  return false;
846  }
847  // if both players are in different bgs
848  else if (target->GetBattlegroundId() && m_session->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
849  {
851  SetSentErrorMessage(true);
852  return false;
853  }
854  // all's well, set bg id
855  // when porting out from the bg, it will be reset to 0
857  // remember current position as entry point for return at bg end teleportation
858  if (!target->GetMap()->IsBattlegroundOrArena())
859  target->SetBattlegroundEntryPoint();
860  }
861  else if (pMap->IsDungeon())
862  {
863  Map* cMap = target->GetMap();
864  if (cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId())
865  {
866  // cannot summon from instance to instance
868  SetSentErrorMessage(true);
869  return false;
870  }
871 
872  // we are in instance, and can summon only player in our group with us as lead
873  if (!m_session->GetPlayer()->GetGroup() || !target->GetGroup() ||
874  (target->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
876  // the last check is a bit excessive, but let it be, just in case
877  {
879  SetSentErrorMessage(true);
880  return false;
881  }
882  }
883 
884  PSendSysMessage(LANG_SUMMONING, target->GetName(), "");
885  if (needReportToTarget(target))
886  ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, GetName());
887 
888  // stop flight if need
889  if (target->IsInFlight())
890  {
891  target->GetMotionMaster()->MovementExpired();
892  target->CleanupAfterTaxiFlight();
893  }
894  // save only in non-flight case
895  else
896  target->SaveRecallPosition();
897 
898  // before GM
899  float x, y, z;
900  m_session->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
901  target->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
902  target->SetPhaseMask(m_session->GetPlayer()->GetPhaseMask(), true);
903  }
904  else if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name))
905  {
907 
908  // in point where GM stay
915  guid);
916  }
917  else
918  {
920  SetSentErrorMessage(true);
921  }
922 
923  return true;
924 }
925 
926 //Teleport to Player
927 bool ChatHandler::HandleAppearCommand(const char* args)
928 {
929  if (!*args)
930  return false;
931 
932  Player* _player = m_session->GetPlayer();
933 
934  std::string name = args;
935 
936  if (!normalizePlayerName(name))
937  {
939  SetSentErrorMessage(true);
940  return false;
941  }
942 
943  Player* target = sObjectMgr.GetPlayer(name.c_str());
944  if (target)
945  {
946  Map* cMap = target->GetMap();
947  if (cMap->IsBattlegroundOrArena())
948  {
949  // only allow if gm mode is on
950  if (!_player->IsGameMaster())
951  {
953  SetSentErrorMessage(true);
954  return false;
955  }
956  // if both players are in different bgs
957  else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
958  _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
959 
960  // all's well, set bg id
961  // when porting out from the bg, it will be reset to 0
962  _player->SetBattlegroundId(target->GetBattlegroundId());
963  // remember current position as entry point for return at bg end teleportation
964  if (!_player->GetMap()->IsBattlegroundOrArena())
965  _player->SetBattlegroundEntryPoint();
966  }
967  else if (cMap->IsDungeon())
968  {
969  // we have to go to instance, and can go to player only if:
970  // 1) we are in his group (either as leader or as member)
971  // 2) we are not bound to any group and have GM mode on
972  if (_player->GetGroup())
973  {
974  // we are in group, we can go only if we are in the player group
975  if (_player->GetGroup() != target->GetGroup())
976  {
978  SetSentErrorMessage(true);
979  return false;
980  }
981  }
982  else
983  {
984  // we are not in group, let's verify our GM mode
985  if (!_player->IsGameMaster())
986  {
988  SetSentErrorMessage(true);
989  return false;
990  }
991  }
992 
993  // if the player or the player's group is bound to another instance
994  // the player will not be bound to another one
995  InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty());
996  if (!pBind)
997  {
998  Group *group = _player->GetGroup();
999  // if no bind exists, create a solo bind
1000  InstanceGroupBind *gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
1001  if (!gBind)
1002  if (InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(target->GetInstanceId()))
1003  _player->BindToInstance(save, !save->CanReset());
1004  }
1005 
1006  _player->SetDifficulty(target->GetDifficulty());
1007  }
1008 
1010 
1011  //if (_player->IsVisibleGloballyFor(target))
1012  // ChatHandler(target).PSendSysMessage(LANG_APPEARING_TO, _player->GetName());
1013 
1014  // stop flight if need
1015  if (_player->IsInFlight())
1016  {
1017  _player->GetMotionMaster()->MovementExpired();
1018  _player->CleanupAfterTaxiFlight();
1019  }
1020  // save only in non-flight case
1021  else
1022  _player->SaveRecallPosition();
1023 
1024  // to point to see at target with same orientation
1025  float x, y, z;
1026  target->GetPosition(x, y, z);
1027 
1028  if (_player->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) ||
1030  {
1031  WorldPacket data;
1033  data << _player->GetPackGUID();
1034  data << uint32(0); // unknown
1035  _player->SendMessageToSet(&data, true);
1036  }
1037 
1038  _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
1039  _player->SetPhaseMask(target->GetPhaseMask(), true);
1040 
1041  return true;
1042  }
1043 
1044  if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name))
1045  {
1046  PSendSysMessage(LANG_APPEARING_AT, name.c_str());
1047 
1048  // to point where player stay (if loaded)
1049  float x, y, z, o;
1050  uint32 map;
1051  bool in_flight;
1052  if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, guid))
1053  return false;
1054 
1055  // stop flight if need
1056  if (_player->IsInFlight())
1057  {
1058  _player->GetMotionMaster()->MovementExpired();
1059  _player->CleanupAfterTaxiFlight();
1060  }
1061  // save only in non-flight case
1062  else
1063  _player->SaveRecallPosition();
1064 
1065  _player->TeleportTo(map, x, y, z, _player->GetOrientation());
1066  return true;
1067  }
1068 
1070 
1071  SetSentErrorMessage(true);
1072  return false;
1073 }
1074 
1075 // Teleport player to last position
1076 bool ChatHandler::HandleRecallCommand(const char* args)
1077 {
1078  Player* target = NULL;
1079 
1080  if (!*args)
1081  {
1082  target = getSelectedPlayerOrSelf();
1083  }
1084  else
1085  {
1086  std::string name = args;
1087 
1088  if (!normalizePlayerName(name))
1089  {
1091  SetSentErrorMessage(true);
1092  return false;
1093  }
1094 
1095  target = sObjectMgr.GetPlayer(name.c_str());
1096 
1097  if (!target)
1098  {
1100  SetSentErrorMessage(true);
1101  return false;
1102  }
1103  }
1104 
1105  if (target->IsBeingTeleported())
1106  {
1108  SetSentErrorMessage(true);
1109  return false;
1110  }
1111 
1112  // stop flight if need
1113  if (target->IsInFlight())
1114  {
1115  target->GetMotionMaster()->MovementExpired();
1116  target->m_taxi.ClearTaxiDestinations();
1117  }
1118 
1119  target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
1120  return true;
1121 }
1122 
1123 //Edit Player HP
1125 {
1126  if (!*args)
1127  return false;
1128 
1129  int32 hp = atoi((char*)args);
1130  int32 hpm = atoi((char*)args);
1131 
1132  if (hp < 1 || hpm < 1 || hpm < hp)
1133  {
1135  SetSentErrorMessage(true);
1136  return false;
1137  }
1138 
1139  Player* target = getSelectedPlayerOrSelf();
1140  if (target == NULL)
1141  {
1143  SetSentErrorMessage(true);
1144  return false;
1145  }
1146 
1147  if (!target->IsAlive())
1148  {
1150  SetSentErrorMessage(true);
1151  return false;
1152  }
1153 
1154  PSendSysMessage(LANG_YOU_CHANGE_HP, target->GetName(), hp, hpm);
1155  if (needReportToTarget(target))
1156  ChatHandler(target).PSendSysMessage(LANG_YOURS_HP_CHANGED, GetName(), hp, hpm);
1157 
1158  target->SetMaxHealth(hpm);
1159  target->SetHealth(hp);
1160 
1161  return true;
1162 }
1163 
1164 //Edit Player Mana
1166 {
1167  if (!*args)
1168  return false;
1169 
1170  // char* pmana = strtok((char*)args, " ");
1171  // if (!pmana)
1172  // return false;
1173 
1174  // char* pmanaMax = strtok(NULL, " ");
1175  // if (!pmanaMax)
1176  // return false;
1177 
1178  // int32 manam = atoi(pmanaMax);
1179  // int32 mana = atoi(pmana);
1180  int32 mana = atoi((char*)args);
1181  int32 manam = atoi((char*)args);
1182 
1183  if (mana <= 0 || manam <= 0 || manam < mana)
1184  {
1186  SetSentErrorMessage(true);
1187  return false;
1188  }
1189 
1190  Player* target = getSelectedPlayerOrSelf();
1191  if (target == NULL)
1192  {
1194  SetSentErrorMessage(true);
1195  return false;
1196  }
1197 
1198  PSendSysMessage(LANG_YOU_CHANGE_MANA, target->GetName(), mana, manam);
1199  if (needReportToTarget(target))
1200  ChatHandler(target).PSendSysMessage(LANG_YOURS_MANA_CHANGED, GetName(), mana, manam);
1201 
1202  target->SetMaxPower(POWER_MANA, manam);
1203  target->SetPower(POWER_MANA, mana);
1204 
1205  return true;
1206 }
1207 
1208 //Edit Player Energy
1210 {
1211  if (!*args)
1212  return false;
1213 
1214  // char* pmana = strtok((char*)args, " ");
1215  // if (!pmana)
1216  // return false;
1217 
1218  // char* pmanaMax = strtok(NULL, " ");
1219  // if (!pmanaMax)
1220  // return false;
1221 
1222  // int32 manam = atoi(pmanaMax);
1223  // int32 mana = atoi(pmana);
1224 
1225  int32 energy = atoi((char*)args) * 10;
1226  int32 energym = atoi((char*)args) * 10;
1227 
1228  if (energy <= 0 || energym <= 0 || energym < energy)
1229  {
1231  SetSentErrorMessage(true);
1232  return false;
1233  }
1234 
1235  Player* target = getSelectedPlayerOrSelf();
1236  if (!target)
1237  {
1239  SetSentErrorMessage(true);
1240  return false;
1241  }
1242 
1243  PSendSysMessage(LANG_YOU_CHANGE_ENERGY, target->GetName(), energy / 10, energym / 10);
1244  if (needReportToTarget(target))
1245  ChatHandler(target).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, GetName(), energy / 10, energym / 10);
1246 
1247  target->SetMaxPower(POWER_ENERGY, energym);
1248  target->SetPower(POWER_ENERGY, energy);
1249 
1251 
1252  return true;
1253 }
1254 
1255 //Edit Player Rage
1257 {
1258  if (!*args)
1259  return false;
1260 
1261  // char* pmana = strtok((char*)args, " ");
1262  // if (!pmana)
1263  // return false;
1264 
1265  // char* pmanaMax = strtok(NULL, " ");
1266  // if (!pmanaMax)
1267  // return false;
1268 
1269  // int32 manam = atoi(pmanaMax);
1270  // int32 mana = atoi(pmana);
1271 
1272  int32 rage = atoi((char*)args) * 10;
1273  int32 ragem = atoi((char*)args) * 10;
1274 
1275  if (rage <= 0 || ragem <= 0 || ragem < rage)
1276  {
1278  SetSentErrorMessage(true);
1279  return false;
1280  }
1281 
1282  Player* target = getSelectedPlayerOrSelf();
1283  if (target == NULL)
1284  {
1286  SetSentErrorMessage(true);
1287  return false;
1288  }
1289 
1290  PSendSysMessage(LANG_YOU_CHANGE_RAGE, target->GetName(), rage / 10, ragem / 10);
1291  if (needReportToTarget(target))
1292  ChatHandler(target).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, GetName(), rage / 10, ragem / 10);
1293 
1294  target->SetMaxPower(POWER_RAGE, ragem);
1295  target->SetPower(POWER_RAGE, rage);
1296 
1297  return true;
1298 }
1299 
1300 //Edit Player Faction
1302 {
1303  if (!*args)
1304  return false;
1305 
1306  char* pfactionid = extractKeyFromLink((char*)args, "Hfaction");
1307 
1308  Creature* target = getSelectedCreature();
1309  if (!target)
1310  {
1312  SetSentErrorMessage(true);
1313  return false;
1314  }
1315 
1316  if (!pfactionid)
1317  {
1318  if (target)
1319  {
1320  uint32 factionid = target->GetFaction();
1321  uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
1322  uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
1323  uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
1324  PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
1325  }
1326  return true;
1327  }
1328 
1329  if (!target)
1330  {
1332  SetSentErrorMessage(true);
1333  return false;
1334  }
1335 
1336  uint32 factionid = atoi(pfactionid);
1337  uint32 flag;
1338 
1339  char* pflag = strtok(NULL, " ");
1340  if (!pflag)
1341  flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
1342  else
1343  flag = atoi(pflag);
1344 
1345  char* pnpcflag = strtok(NULL, " ");
1346 
1347  uint32 npcflag;
1348  if (!pnpcflag)
1349  npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
1350  else
1351  npcflag = atoi(pnpcflag);
1352 
1353  char* pdyflag = strtok(NULL, " ");
1354 
1355  uint32 dyflag;
1356  if (!pdyflag)
1357  dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
1358  else
1359  dyflag = atoi(pdyflag);
1360 
1361  if (!sFactionTemplateStore.LookupEntry(factionid))
1362  {
1363  PSendSysMessage(LANG_WRONG_FACTION, factionid);
1364  SetSentErrorMessage(true);
1365  return false;
1366  }
1367 
1368  PSendSysMessage(LANG_YOU_CHANGE_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
1369 
1370  target->SetFaction(factionid);
1371  target->SetUInt32Value(UNIT_FIELD_FLAGS, flag);
1372  target->SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
1373  target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, dyflag);
1374 
1375  return true;
1376 }
1377 
1378 //Edit Player Spell
1380 {
1381  if (!*args) return false;
1382  char* pspellflatid = strtok((char*)args, " ");
1383  if (!pspellflatid)
1384  return false;
1385 
1386  char* pop = strtok(NULL, " ");
1387  if (!pop)
1388  return false;
1389 
1390  char* pval = strtok(NULL, " ");
1391  if (!pval)
1392  return false;
1393 
1394  uint16 mark;
1395 
1396  char* pmark = strtok(NULL, " ");
1397 
1398  uint8 spellflatid = atoi(pspellflatid);
1399  uint8 op = atoi(pop);
1400  uint16 val = atoi(pval);
1401  if (!pmark)
1402  mark = 65535;
1403  else
1404  mark = atoi(pmark);
1405 
1406  Player* target = getSelectedPlayerOrSelf();
1407  if (target == NULL)
1408  {
1410  SetSentErrorMessage(true);
1411  return false;
1412  }
1413 
1414  PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, target->GetName());
1415  if (needReportToTarget(target))
1416  ChatHandler(target).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, GetName(), spellflatid, val, mark);
1417 
1418  WorldPacket data(SMSG_SET_FLAT_SPELL_MODIFIER, (1 + 1 + 2 + 2));
1419  data << uint8(spellflatid);
1420  data << uint8(op);
1421  data << uint16(val);
1422  data << uint16(mark);
1423  target->GetSession()->SendPacket(&data);
1424 
1425  return true;
1426 }
1427 
1428 //Edit Player TP
1430 {
1431  if (!*args)
1432  return false;
1433 
1434  int tp = atoi((char*)args);
1435  if (tp < 0)
1436  return false;
1437 
1438  Player* target = getSelectedPlayerOrSelf();
1439  if (!target)
1440  {
1442  SetSentErrorMessage(true);
1443  return false;
1444  }
1445 
1446  target->SetFreeTalentPoints(tp);
1447  return true;
1448 }
1449 
1450 //Enable On\OFF all taxi paths
1452 {
1453  if (!*args)
1454  {
1456  SetSentErrorMessage(true);
1457  return false;
1458  }
1459 
1460  std::string argstr = (char*)args;
1461 
1462  Player* target = getSelectedPlayerOrSelf();
1463 
1464  if (argstr == "on")
1465  {
1466  target->SetTaxiCheater(true);
1468  if (needReportToTarget(target))
1469  ChatHandler(target).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, GetName());
1470  return true;
1471  }
1472 
1473  if (argstr == "off")
1474  {
1475  target->SetTaxiCheater(false);
1477  if (needReportToTarget(target))
1478  ChatHandler(target).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, GetName());
1479 
1480  return true;
1481  }
1482 
1484  SetSentErrorMessage(true);
1485  return false;
1486 }
1487 
1488 //Edit Player Aspeed
1490 {
1491  if (!*args)
1492  return false;
1493 
1494  float modSpeed = (float)atof((char*)args);
1495 
1496 
1497  if (modSpeed > 10 || modSpeed < 0.1)
1498  {
1500  SetSentErrorMessage(true);
1501  return false;
1502  }
1503 
1504  Player* target = getSelectedPlayerOrSelf();
1505  if (target == NULL)
1506  {
1508  SetSentErrorMessage(true);
1509  return false;
1510  }
1511 
1512  if (target->IsInFlight())
1513  {
1515  SetSentErrorMessage(true);
1516  return false;
1517  }
1518 
1519  PSendSysMessage(LANG_YOU_CHANGE_ASPEED, modSpeed, target->GetName());
1520  if (needReportToTarget(target))
1521  ChatHandler(target).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, GetName(), modSpeed);
1522 
1523  target->SetSpeed(MOVE_WALK, modSpeed, true);
1524  target->SetSpeed(MOVE_RUN, modSpeed, true);
1525  target->SetSpeed(MOVE_SWIM, modSpeed, true);
1526  //target->SetSpeed(MOVE_TURN, modSpeed, true);
1527  target->SetSpeed(MOVE_FLIGHT, modSpeed, true);
1528  return true;
1529 }
1530 
1531 //Edit Player Speed
1533 {
1534  if (!*args)
1535  return false;
1536 
1537  float modSpeed = (float)atof((char*)args);
1538 
1539  if (modSpeed > 10 || modSpeed < 0.1)
1540  {
1542  SetSentErrorMessage(true);
1543  return false;
1544  }
1545 
1546  Player* target = getSelectedPlayerOrSelf();
1547  if (target == NULL)
1548  {
1550  SetSentErrorMessage(true);
1551  return false;
1552  }
1553 
1554  if (target->IsInFlight())
1555  {
1557  SetSentErrorMessage(true);
1558  return false;
1559  }
1560 
1561  PSendSysMessage(LANG_YOU_CHANGE_SPEED, modSpeed, target->GetName());
1562  if (needReportToTarget(target))
1563  ChatHandler(target).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, GetName(), modSpeed);
1564 
1565  target->SetSpeed(MOVE_RUN, modSpeed, true);
1566 
1567  return true;
1568 }
1569 
1570 //Edit Player Swim Speed
1572 {
1573  if (!*args)
1574  return false;
1575 
1576  float modSpeed = (float)atof((char*)args);
1577 
1578  if (modSpeed > 10.0f || modSpeed < 0.1f)
1579  {
1581  SetSentErrorMessage(true);
1582  return false;
1583  }
1584 
1585  Player* target = getSelectedPlayerOrSelf();
1586  if (target == NULL)
1587  {
1589  SetSentErrorMessage(true);
1590  return false;
1591  }
1592 
1593  if (target->IsInFlight())
1594  {
1596  SetSentErrorMessage(true);
1597  return false;
1598  }
1599 
1600  PSendSysMessage(LANG_YOU_CHANGE_SWIM_SPEED, modSpeed, target->GetName());
1601  if (needReportToTarget(target))
1602  ChatHandler(target).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, GetName(), modSpeed);
1603 
1604  target->SetSpeed(MOVE_SWIM, modSpeed, true);
1605 
1606  return true;
1607 }
1608 
1609 //Edit Player Walk Speed
1611 {
1612  if (!*args)
1613  return false;
1614 
1615  float modSpeed = (float)atof((char*)args);
1616 
1617  if (modSpeed > 10.0f || modSpeed < 0.1f)
1618  {
1620  SetSentErrorMessage(true);
1621  return false;
1622  }
1623 
1624  Player* target = getSelectedPlayerOrSelf();
1625  if (target == NULL)
1626  {
1628  SetSentErrorMessage(true);
1629  return false;
1630  }
1631 
1632  if (target->IsInFlight())
1633  {
1635  SetSentErrorMessage(true);
1636  return false;
1637  }
1638 
1639  PSendSysMessage(LANG_YOU_CHANGE_BACK_SPEED, modSpeed, target->GetName());
1640  if (needReportToTarget(target))
1641  ChatHandler(target).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, GetName(), modSpeed);
1642 
1643  target->SetSpeed(MOVE_RUN_BACK, modSpeed, true);
1644 
1645  return true;
1646 }
1647 
1648 //Edit Player Fly
1650 {
1651  if (!*args)
1652  return false;
1653 
1654  float modSpeed = (float)atof((char*)args);
1655 
1656  if (modSpeed > 50.0f || modSpeed < 0.1f)
1657  {
1659  SetSentErrorMessage(true);
1660  return false;
1661  }
1662 
1663  Player* target = getSelectedPlayerOrSelf();
1664  if (target == NULL)
1665  {
1667  SetSentErrorMessage(true);
1668  return false;
1669  }
1670 
1671  PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, modSpeed, target->GetName());
1672  if (needReportToTarget(target))
1673  ChatHandler(target).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetName(), modSpeed);
1674 
1675  target->SetSpeed(MOVE_FLIGHT, modSpeed, true);
1676 
1677  return true;
1678 }
1679 
1680 //Edit Player Scale
1682 {
1683  if (!*args)
1684  return false;
1685 
1686  float Scale = (float)atof((char*)args);
1687  if (Scale > 10.0f || Scale < 0.1f)
1688  {
1690  SetSentErrorMessage(true);
1691  return false;
1692  }
1693 
1694  Unit* target = getSelectedUnit();
1695  if (target == NULL)
1696  {
1698  SetSentErrorMessage(true);
1699  return false;
1700  }
1701 
1702  if (target->GetTypeId() == TYPEID_PLAYER)
1703  {
1704  PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, target->GetName());
1705  if (needReportToTarget(target->ToPlayer()))
1707  }
1708 
1709  target->SetObjectScale(Scale);
1710 
1711  return true;
1712 }
1713 
1714 //Enable Player mount
1716 {
1717  if (!*args)
1718  return false;
1719 
1720  uint16 mId = 1147;
1721  float speed = (float)15;
1722  uint32 num = 0;
1723 
1724  num = atoi((char*)args);
1725  switch (num)
1726  {
1727  case 1:
1728  mId = 14340;
1729  break;
1730  case 2:
1731  mId = 4806;
1732  break;
1733  case 3:
1734  mId = 6471;
1735  break;
1736  case 4:
1737  mId = 12345;
1738  break;
1739  case 5:
1740  mId = 6472;
1741  break;
1742  case 6:
1743  mId = 6473;
1744  break;
1745  case 7:
1746  mId = 10670;
1747  break;
1748  case 8:
1749  mId = 10719;
1750  break;
1751  case 9:
1752  mId = 10671;
1753  break;
1754  case 10:
1755  mId = 10672;
1756  break;
1757  case 11:
1758  mId = 10720;
1759  break;
1760  case 12:
1761  mId = 14349;
1762  break;
1763  case 13:
1764  mId = 11641;
1765  break;
1766  case 14:
1767  mId = 12244;
1768  break;
1769  case 15:
1770  mId = 12242;
1771  break;
1772  case 16:
1773  mId = 14578;
1774  break;
1775  case 17:
1776  mId = 14579;
1777  break;
1778  case 18:
1779  mId = 14349;
1780  break;
1781  case 19:
1782  mId = 12245;
1783  break;
1784  case 20:
1785  mId = 14335;
1786  break;
1787  case 21:
1788  mId = 207;
1789  break;
1790  case 22:
1791  mId = 2328;
1792  break;
1793  case 23:
1794  mId = 2327;
1795  break;
1796  case 24:
1797  mId = 2326;
1798  break;
1799  case 25:
1800  mId = 14573;
1801  break;
1802  case 26:
1803  mId = 14574;
1804  break;
1805  case 27:
1806  mId = 14575;
1807  break;
1808  case 28:
1809  mId = 604;
1810  break;
1811  case 29:
1812  mId = 1166;
1813  break;
1814  case 30:
1815  mId = 2402;
1816  break;
1817  case 31:
1818  mId = 2410;
1819  break;
1820  case 32:
1821  mId = 2409;
1822  break;
1823  case 33:
1824  mId = 2408;
1825  break;
1826  case 34:
1827  mId = 2405;
1828  break;
1829  case 35:
1830  mId = 14337;
1831  break;
1832  case 36:
1833  mId = 6569;
1834  break;
1835  case 37:
1836  mId = 10661;
1837  break;
1838  case 38:
1839  mId = 10666;
1840  break;
1841  case 39:
1842  mId = 9473;
1843  break;
1844  case 40:
1845  mId = 9476;
1846  break;
1847  case 41:
1848  mId = 9474;
1849  break;
1850  case 42:
1851  mId = 14374;
1852  break;
1853  case 43:
1854  mId = 14376;
1855  break;
1856  case 44:
1857  mId = 14377;
1858  break;
1859  case 45:
1860  mId = 2404;
1861  break;
1862  case 46:
1863  mId = 2784;
1864  break;
1865  case 47:
1866  mId = 2787;
1867  break;
1868  case 48:
1869  mId = 2785;
1870  break;
1871  case 49:
1872  mId = 2736;
1873  break;
1874  case 50:
1875  mId = 2786;
1876  break;
1877  case 51:
1878  mId = 14347;
1879  break;
1880  case 52:
1881  mId = 14346;
1882  break;
1883  case 53:
1884  mId = 14576;
1885  break;
1886  case 54:
1887  mId = 9695;
1888  break;
1889  case 55:
1890  mId = 9991;
1891  break;
1892  case 56:
1893  mId = 6448;
1894  break;
1895  case 57:
1896  mId = 6444;
1897  break;
1898  case 58:
1899  mId = 6080;
1900  break;
1901  case 59:
1902  mId = 6447;
1903  break;
1904  case 60:
1905  mId = 4805;
1906  break;
1907  case 61:
1908  mId = 9714;
1909  break;
1910  case 62:
1911  mId = 6448;
1912  break;
1913  case 63:
1914  mId = 6442;
1915  break;
1916  case 64:
1917  mId = 14632;
1918  break;
1919  case 65:
1920  mId = 14332;
1921  break;
1922  case 66:
1923  mId = 14331;
1924  break;
1925  case 67:
1926  mId = 8469;
1927  break;
1928  case 68:
1929  mId = 2830;
1930  break;
1931  case 69:
1932  mId = 2346;
1933  break;
1934  default:
1936  SetSentErrorMessage(true);
1937  return false;
1938  }
1939 
1940  Player* target = getSelectedPlayerOrSelf();
1941  if (target == NULL)
1942  {
1944  SetSentErrorMessage(true);
1945  return false;
1946  }
1947 
1949  if (needReportToTarget(target))
1950  ChatHandler(target).PSendSysMessage(LANG_MOUNT_GIVED, GetName());
1951 
1952  target->SetUInt32Value(UNIT_FIELD_FLAGS, 0x001000);
1953  target->Mount(mId);
1954 
1955  WorldPacket data(SMSG_FORCE_RUN_SPEED_CHANGE, (8 + 4 + 1 + 4));
1956  data << target->GetPackGUID();
1957  data << (uint32)0;
1958  data << (uint8)0; //new 2.1.0
1959  data << float(speed);
1960  target->SendMessageToSet(&data, true);
1961 
1962  data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, (8 + 4 + 4));
1963  data << target->GetPackGUID();
1964  data << (uint32)0;
1965  data << float(speed);
1966  target->SendMessageToSet(&data, true);
1967 
1968  return true;
1969 }
1970 
1971 //Edit Player money
1973 {
1974  if (!*args)
1975  return false;
1976 
1977  Player* target = getSelectedPlayerOrSelf();
1978  if (target == NULL)
1979  {
1981  SetSentErrorMessage(true);
1982  return false;
1983  }
1984 
1985  int32 addmoney = atoi((char*)args);
1986 
1987  uint32 moneyuser = target->GetMoney();
1988 
1989  if (addmoney < 0)
1990  {
1991  int32 newmoney = moneyuser + addmoney;
1992 
1993  sLog.outDetail(GetOregonString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
1994  if (newmoney <= 0)
1995  {
1997  if (needReportToTarget(target))
1998  ChatHandler(target).PSendSysMessage(LANG_YOURS_ALL_MONEY_GONE, GetName());
1999 
2000  target->SetMoney(0);
2001  }
2002  else
2003  {
2004  PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), target->GetName());
2005  if (needReportToTarget(target))
2006  ChatHandler(target).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetName(), abs(addmoney));
2007  target->SetMoney(newmoney);
2008  }
2009  }
2010  else
2011  {
2012  PSendSysMessage(LANG_YOU_GIVE_MONEY, addmoney, target->GetName());
2013  if (needReportToTarget(target))
2014  ChatHandler(target).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, GetName(), addmoney);
2015  target->ModifyMoney(addmoney);
2016  }
2017 
2018  sLog.outDetail(GetOregonString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney());
2019 
2020  return true;
2021 }
2022 
2023 //Edit Player field
2025 {
2026  if (!*args)
2027  return false;
2028 
2029  Player* target = getSelectedPlayerOrSelf();
2030  if (!target)
2031  {
2033  SetSentErrorMessage(true);
2034  return false;
2035  }
2036 
2037  char* pField = strtok((char*)args, " ");
2038  if (!pField)
2039  return false;
2040 
2041  char* pBit = strtok(NULL, " ");
2042  if (!pBit)
2043  return false;
2044 
2045  uint16 field = atoi(pField);
2046  uint32 bit = atoi(pBit);
2047 
2048  if (field < 1 || field >= PLAYER_END)
2049  {
2051  SetSentErrorMessage(true);
2052  return false;
2053  }
2054  if (bit < 1 || bit > 32)
2055  {
2057  SetSentErrorMessage(true);
2058  return false;
2059  }
2060 
2061  if (target->HasFlag(field, (1 << (bit - 1))))
2062  {
2063  target->RemoveFlag(field, (1 << (bit - 1)));
2064  PSendSysMessage(LANG_REMOVE_BIT, bit, field);
2065  }
2066  else
2067  {
2068  target->SetFlag(field, (1 << (bit - 1)));
2069  PSendSysMessage(LANG_SET_BIT, bit, field);
2070  }
2071  return true;
2072 }
2073 
2075 {
2076  if (!*args)
2077  return false;
2078 
2079  Player* target = getSelectedPlayerOrSelf();
2080  if (!target)
2081  {
2083  SetSentErrorMessage(true);
2084  return false;
2085  }
2086 
2087  int32 amount = (uint32)atoi(args);
2088 
2089  target->ModifyHonorPoints(amount);
2090 
2092 
2093  return true;
2094 }
2095 
2096 bool ChatHandler::HandleTeleCommand(const char* args)
2097 {
2098  if (!*args)
2099  return false;
2100 
2101  Player* _player = m_session->GetPlayer();
2102 
2103  // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
2104  GameTele const* tele = extractGameTeleFromLink((char*)args);
2105 
2106  if (!tele)
2107  {
2109  SetSentErrorMessage(true);
2110  return false;
2111  }
2112 
2113  MapEntry const* me = sMapStore.LookupEntry(tele->mapId);
2114  if (!me || me->IsBattlegroundOrArena())
2115  {
2117  SetSentErrorMessage(true);
2118  return false;
2119  }
2120 
2121  // stop flight if need
2122  if (_player->IsInFlight())
2123  {
2124  _player->GetMotionMaster()->MovementExpired();
2125  _player->CleanupAfterTaxiFlight();
2126  }
2127  // save only in non-flight case
2128  else
2129  _player->SaveRecallPosition();
2130 
2131  // let gm fly remain
2133  {
2134  WorldPacket data;
2136  data << _player->GetPackGUID();
2137  data << uint32(0); // unknown
2138  _player->SendMessageToSet(&data, true);
2139  }
2140 
2141  _player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
2142  return true;
2143 }
2144 
2146 {
2147  if (!*args)
2148  return false;
2149 
2150  std::string namepart = args;
2151  std::wstring wnamepart;
2152 
2153  if (!Utf8toWStr (namepart, wnamepart))
2154  return false;
2155 
2156  bool found = false;
2157  uint32 count = 0;
2158  uint32 maxResults = sWorld.getConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
2159 
2160  // converting string that we try to find to lower case
2161  wstrToLower (wnamepart);
2162 
2163  // Search in AreaTable.dbc
2164  for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag)
2165  {
2166  AreaTableEntry const* areaEntry = sAreaStore.LookupEntry (areaflag);
2167  if (areaEntry)
2168  {
2169  int loc = m_session ? int(m_session->GetSessionDbcLocale()) : sWorld.GetDefaultDbcLocale();
2170  std::string name = areaEntry->area_name[loc];
2171  if (name.empty())
2172  continue;
2173 
2174  if (!Utf8FitTo (name, wnamepart))
2175  {
2176  loc = 0;
2177  for (; loc < MAX_LOCALE; ++loc)
2178  {
2179  if (m_session && loc == m_session->GetSessionDbcLocale ())
2180  continue;
2181 
2182  name = areaEntry->area_name[loc];
2183  if (name.empty ())
2184  continue;
2185 
2186  if (Utf8FitTo (name, wnamepart))
2187  break;
2188  }
2189  }
2190 
2191  if (loc < MAX_LOCALE)
2192  {
2193  if (maxResults && count++ == maxResults)
2194  {
2196  return true;
2197  }
2198 
2199  // send area in "id - [name]" format
2200  std::ostringstream ss;
2201  if (m_session)
2202  ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r";
2203  else
2204  ss << areaEntry->ID << " - " << name << " " << localeNames[loc];
2205 
2206  SendSysMessage (ss.str ().c_str());
2207 
2208  if (!found)
2209  found = true;
2210  }
2211  }
2212  }
2213 
2214  if (!found)
2216 
2217  return true;
2218 }
2219 
2220 //Find tele in game_tele order by name
2222 {
2223  if (!*args)
2224  {
2226  SetSentErrorMessage(true);
2227  return false;
2228  }
2229 
2230  char const* str = strtok((char*)args, " ");
2231  if (!str)
2232  return false;
2233 
2234  std::string namepart = str;
2235  std::wstring wnamepart;
2236 
2237  if (!Utf8toWStr(namepart, wnamepart))
2238  return false;
2239 
2240  // converting string that we try to find to lower case
2241  wstrToLower(wnamepart);
2242 
2243  std::ostringstream reply;
2244  uint32 count = 0;
2245  uint32 maxResults = sWorld.getConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
2246  bool limitReached = false;
2247 
2248  GameTeleMap const& teleMap = sObjectMgr.GetGameTeleMap();
2249  for (GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
2250  {
2251  GameTele const* tele = &itr->second;
2252 
2253  if (tele->wnameLow.find(wnamepart) == std::wstring::npos)
2254  continue;
2255 
2256  if (maxResults && count++ == maxResults)
2257  {
2258  limitReached = true;
2259  break;
2260  }
2261 
2262  if (m_session)
2263  reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
2264  else
2265  reply << " " << itr->first << " " << tele->name << "\n";
2266  }
2267 
2268  if (reply.str().empty())
2270  else
2271  PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
2272 
2273  if (limitReached)
2275 
2276  return true;
2277 }
2278 
2279 //Enable\Dissable accept whispers (for GM)
2281 {
2282  if (!*args)
2283  {
2285  return true;
2286  }
2287 
2288  std::string argstr = (char*)args;
2289  // whisper on
2290  if (argstr == "on")
2291  {
2294  return true;
2295  }
2296 
2297  // whisper off
2298  if (argstr == "off")
2299  {
2302  return true;
2303  }
2304 
2306  SetSentErrorMessage(true);
2307  return false;
2308 }
2309 
2310 //Save all players in the world
2311 bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
2312 {
2315  return true;
2316 }
2317 
2318 //Send mail by command
2320 {
2321  if (!*args)
2322  return false;
2323 
2324  // format: name "subject text" "mail text"
2325 
2326  char* pName = strtok((char*)args, " ");
2327  if (!pName)
2328  return false;
2329 
2330  char* tail1 = strtok(NULL, "");
2331  if (!tail1)
2332  return false;
2333 
2334  char* msgSubject;
2335  if (*tail1 == '"')
2336  msgSubject = strtok(tail1 + 1, "\"");
2337  else
2338  {
2339  char* space = strtok(tail1, "\"");
2340  if (!space)
2341  return false;
2342  msgSubject = strtok(NULL, "\"");
2343  }
2344 
2345  if (!msgSubject)
2346  return false;
2347 
2348  char* tail2 = strtok(NULL, "");
2349  if (!tail2)
2350  return false;
2351 
2352  char* msgText;
2353  if (*tail2 == '"')
2354  msgText = strtok(tail2 + 1, "\"");
2355  else
2356  {
2357  char* space = strtok(tail2, "\"");
2358  if (!space)
2359  return false;
2360  msgText = strtok(NULL, "\"");
2361  }
2362 
2363  if (!msgText)
2364  return false;
2365 
2366  // pName, msgSubject, msgText isn't NUL after prev. check
2367  std::string name = pName;
2368  std::string subject = msgSubject;
2369  std::string text = msgText;
2370 
2371  if (!normalizePlayerName(name))
2372  {
2374  SetSentErrorMessage(true);
2375  return false;
2376  }
2377 
2378  uint64 receiver_guid = sObjectMgr.GetPlayerGUIDByName(name);
2379  if (!receiver_guid)
2380  {
2382  SetSentErrorMessage(true);
2383  return false;
2384  }
2385 
2386  sObjectMgr.GenerateMailID();
2387 
2388  // from console show not existed sender
2390 
2391  uint32 itemTextId = !text.empty() ? sObjectMgr.CreateItemText(text) : 0;
2392 
2393  Player* receiver = sObjectMgr.GetPlayer(receiver_guid);
2394 
2395  MailDraft(subject, itemTextId)
2396  .SendMailTo(MailReceiver(receiver, GUID_LOPART(receiver_guid)), sender);
2397 
2398  PSendSysMessage(LANG_MAIL_SENT, name.c_str());
2399  return true;
2400 }
2401 
2402 // teleport player to given game_tele.entry
2404 {
2405  if (!*args)
2406  return false;
2407 
2408  char* pName = strtok((char*)args, " ");
2409 
2410  if (!pName)
2411  return false;
2412 
2413  std::string name = pName;
2414 
2415  if (!normalizePlayerName(name))
2416  {
2418  SetSentErrorMessage(true);
2419  return false;
2420  }
2421 
2422  char* tail = strtok(NULL, "");
2423  if (!tail)
2424  return false;
2425 
2426  // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
2427  GameTele const* tele = extractGameTeleFromLink(tail);
2428  if (!tele)
2429  {
2431  SetSentErrorMessage(true);
2432  return false;
2433  }
2434 
2435  MapEntry const* me = sMapStore.LookupEntry(tele->mapId);
2436  if (!me || me->IsBattlegroundOrArena())
2437  {
2439  SetSentErrorMessage(true);
2440  return false;
2441  }
2442 
2443  Player* target = sObjectMgr.GetPlayer(name.c_str());
2444  if (target)
2445  {
2446  if (target->IsBeingTeleported())
2447  {
2449  SetSentErrorMessage(true);
2450  return false;
2451  }
2452 
2453  PSendSysMessage(LANG_TELEPORTING_TO, target->GetName(), "", tele->name.c_str());
2454  if (needReportToTarget(target))
2455  ChatHandler(target).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetName());
2456 
2457  // stop flight if need
2458  if (target->IsInFlight())
2459  {
2460  target->GetMotionMaster()->MovementExpired();
2461  target->m_taxi.ClearTaxiDestinations();
2462  }
2463  // save only in non-flight case
2464  else
2465  target->SaveRecallPosition();
2466 
2467  target->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
2468  }
2469  else if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name.c_str()))
2470  {
2471  PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetOregonString(LANG_OFFLINE), tele->name.c_str());
2472  Player::SavePositionInDB(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation,
2473  MapManager::Instance().GetZoneId(tele->mapId, tele->position_x, tele->position_y, tele->position_z), guid);
2474  }
2475  else
2476  PSendSysMessage(LANG_NO_PLAYER, name.c_str());
2477 
2478  return true;
2479 }
2480 
2481 //Teleport group to given game_tele.entry
2483 {
2484  if (!*args)
2485  return false;
2486 
2487  Player* player = getSelectedPlayer();
2488  if (!player)
2489  {
2491  SetSentErrorMessage(true);
2492  return false;
2493  }
2494 
2495  // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
2496  GameTele const* tele = extractGameTeleFromLink((char*)args);
2497  if (!tele)
2498  {
2500  SetSentErrorMessage(true);
2501  return false;
2502  }
2503 
2504  MapEntry const* me = sMapStore.LookupEntry(tele->mapId);
2505  if (!me || me->IsBattlegroundOrArena())
2506  {
2508  SetSentErrorMessage(true);
2509  return false;
2510  }
2511  Group* grp = player->GetGroup();
2512  if (!grp)
2513  {
2515  SetSentErrorMessage(true);
2516  return false;
2517  }
2518 
2519  for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
2520  {
2521  Player* pl = itr->GetSource();
2522 
2523  if (!pl || !pl->GetSession())
2524  continue;
2525 
2526  if (pl->IsBeingTeleported())
2527  {
2529  continue;
2530  }
2531 
2532  PSendSysMessage(LANG_TELEPORTING_TO, pl->GetName(), "", tele->name.c_str());
2533  if (needReportToTarget(pl))
2534  ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetName());
2535 
2536  // stop flight if need
2537  if (pl->IsInFlight())
2538  {
2541  }
2542  // save only in non-flight case
2543  else
2544  pl->SaveRecallPosition();
2545 
2546  pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
2547  }
2548 
2549  return true;
2550 }
2551 
2552 //Summon group of player
2554 {
2555  if (!*args)
2556  return false;
2557 
2558  std::string name = args;
2559 
2560  if (!normalizePlayerName(name))
2561  {
2563  SetSentErrorMessage(true);
2564  return false;
2565  }
2566 
2567  Player* player = sObjectMgr.GetPlayer(name.c_str());
2568  if (!player)
2569  {
2571  SetSentErrorMessage(true);
2572  return false;
2573  }
2574 
2575  Group* grp = player->GetGroup();
2576 
2577  if (!grp)
2578  {
2580  SetSentErrorMessage(true);
2581  return false;
2582  }
2583 
2584  Map* gmMap = m_session->GetPlayer()->GetMap();
2585  bool to_instance = gmMap->Instanceable();
2586 
2587  // we are in instance, and can summon only player in our group with us as lead
2588  if (to_instance && (
2589  !m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
2591  // the last check is a bit excessive, but let it be, just in case
2592  {
2594  SetSentErrorMessage(true);
2595  return false;
2596  }
2597 
2598  for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
2599  {
2600  Player* pl = itr->GetSource();
2601 
2602  if (!pl || pl == m_session->GetPlayer() || !pl->GetSession())
2603  continue;
2604 
2605  if (pl->IsBeingTeleported())
2606  {
2608  SetSentErrorMessage(true);
2609  return false;
2610  }
2611 
2612  if (to_instance)
2613  {
2614  Map* plMap = pl->GetMap();
2615 
2616  if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
2617  {
2618  // cannot summon from instance to instance
2620  SetSentErrorMessage(true);
2621  return false;
2622  }
2623  }
2624 
2626  if (needReportToTarget(pl))
2627  ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetName());
2628 
2629  // stop flight if need
2630  if (pl->IsInFlight())
2631  {
2634  }
2635  // save only in non-flight case
2636  else
2637  pl->SaveRecallPosition();
2638 
2639  // before GM
2640  float x, y, z;
2641  m_session->GetPlayer()->GetClosePoint(x, y, z, pl->GetObjectSize());
2642  pl->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, pl->GetOrientation());
2643  }
2644 
2645  return true;
2646 }
2647 
2648 //teleport at coordinates
2649 bool ChatHandler::HandleGoXYCommand(const char* args)
2650 {
2651  if (!*args)
2652  return false;
2653 
2654  Player* _player = m_session->GetPlayer();
2655 
2656  char* px = strtok((char*)args, " ");
2657  char* py = strtok(NULL, " ");
2658  char* pmapid = strtok(NULL, " ");
2659 
2660  if (!px || !py)
2661  return false;
2662 
2663  float x = (float)atof(px);
2664  float y = (float)atof(py);
2665  uint32 mapid;
2666  if (pmapid)
2667  mapid = (uint32)atoi(pmapid);
2668  else mapid = _player->GetMapId();
2669 
2670  if (!MapManager::IsValidMapCoord(mapid, x, y))
2671  {
2673  SetSentErrorMessage(true);
2674  return false;
2675  }
2676 
2677  // stop flight if need
2678  if (_player->IsInFlight())
2679  {
2680  _player->GetMotionMaster()->MovementExpired();
2681  _player->CleanupAfterTaxiFlight();
2682  }
2683  // save only in non-flight case
2684  else
2685  _player->SaveRecallPosition();
2686 
2687  Map const* map = MapManager::Instance().CreateBaseMap(mapid);
2688  float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
2689 
2690  _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
2691 
2692  return true;
2693 }
2694 
2695 //teleport at coordinates, including Z
2696 bool ChatHandler::HandleGoXYZCommand(const char* args)
2697 {
2698  if (!*args)
2699  return false;
2700 
2701  Player* _player = m_session->GetPlayer();
2702 
2703  char* px = strtok((char*)args, " ");
2704  char* py = strtok(NULL, " ");
2705  char* pz = strtok(NULL, " ");
2706  char* pmapid = strtok(NULL, " ");
2707 
2708  if (!px || !py || !pz)
2709  return false;
2710 
2711  float x = (float)atof(px);
2712  float y = (float)atof(py);
2713  float z = (float)atof(pz);
2714  uint32 mapid;
2715  if (pmapid)
2716  mapid = (uint32)atoi(pmapid);
2717  else
2718  mapid = _player->GetMapId();
2719 
2720  if (!MapManager::IsValidMapCoord(mapid, x, y, z))
2721  {
2723  SetSentErrorMessage(true);
2724  return false;
2725  }
2726 
2727  // stop flight if need
2728  if (_player->IsInFlight())
2729  {
2730  _player->GetMotionMaster()->MovementExpired();
2731  _player->CleanupAfterTaxiFlight();
2732  }
2733  // save only in non-flight case
2734  else
2735  _player->SaveRecallPosition();
2736 
2737  _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
2738 
2739  return true;
2740 }
2741 
2742 //teleport at coordinates
2744 {
2745  if (!*args)
2746  return false;
2747 
2748  Player* _player = m_session->GetPlayer();
2749 
2750  char* px = strtok((char*)args, " ");
2751  char* py = strtok(NULL, " ");
2752  char* tail = strtok(NULL, "");
2753 
2754  char* cAreaId = extractKeyFromLink(tail, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r
2755 
2756  if (!px || !py)
2757  return false;
2758 
2759  float x = (float)atof(px);
2760  float y = (float)atof(py);
2761  uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId();
2762 
2763  AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid);
2764 
2765  if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry)
2766  {
2768  SetSentErrorMessage(true);
2769  return false;
2770  }
2771 
2772  // update to parent zone if exist (client map show only zones without parents)
2773  AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
2774 
2775  Map const* map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid);
2776 
2777  if (map->Instanceable())
2778  {
2779  PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->area_name[m_session->GetSessionDbcLocale()], map->GetId(), map->GetMapName());
2780  SetSentErrorMessage(true);
2781  return false;
2782  }
2783 
2784  Zone2MapCoordinates(x, y, zoneEntry->ID);
2785 
2786  if (!MapManager::IsValidMapCoord(zoneEntry->mapid, x, y))
2787  {
2788  PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, zoneEntry->mapid);
2789  SetSentErrorMessage(true);
2790  return false;
2791  }
2792 
2793  // stop flight if need
2794  if (_player->IsInFlight())
2795  {
2796  _player->GetMotionMaster()->MovementExpired();
2797  _player->CleanupAfterTaxiFlight();
2798  }
2799  // save only in non-flight case
2800  else
2801  _player->SaveRecallPosition();
2802 
2803  float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
2804  _player->TeleportTo(zoneEntry->mapid, x, y, z, _player->GetOrientation());
2805 
2806  return true;
2807 }
2808 
2809 //teleport to grid
2810 bool ChatHandler::HandleGoGridCommand(const char* args)
2811 {
2812  if (!*args) return false;
2813  Player* _player = m_session->GetPlayer();
2814 
2815  char* px = strtok((char*)args, " ");
2816  char* py = strtok(NULL, " ");
2817  char* pmapid = strtok(NULL, " ");
2818 
2819  if (!px || !py)
2820  return false;
2821 
2822  float grid_x = (float)atof(px);
2823  float grid_y = (float)atof(py);
2824  uint32 mapid;
2825  if (pmapid)
2826  mapid = (uint32)atoi(pmapid);
2827  else mapid = _player->GetMapId();
2828 
2829  // center of grid
2830  float x = (grid_x - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS;
2831  float y = (grid_y - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS;
2832 
2833  if (!MapManager::IsValidMapCoord(mapid, x, y))
2834  {
2836  SetSentErrorMessage(true);
2837  return false;
2838  }
2839 
2840  // stop flight if need
2841  if (_player->IsInFlight())
2842  {
2843  _player->GetMotionMaster()->MovementExpired();
2844  _player->CleanupAfterTaxiFlight();
2845  }
2846  // save only in non-flight case
2847  else
2848  _player->SaveRecallPosition();
2849 
2850  Map const* map = MapManager::Instance().CreateBaseMap(mapid);
2851  float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
2852  _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
2853 
2854  return true;
2855 }
2856 
2857 bool ChatHandler::HandleDrunkCommand(const char* args)
2858 {
2859  if (!*args) return false;
2860 
2861  uint32 drunklevel = (uint32)atoi(args);
2862  if (drunklevel > 100)
2863  drunklevel = 100;
2864 
2865  uint16 drunkMod = drunklevel * 0xFFFF / 100;
2866 
2867  Player* target = getSelectedPlayer();
2868  if (!target)
2869  target = m_session->GetPlayer();
2870 
2871  if (target)
2872  target->SetDrunkValue(drunkMod);
2873 
2874  return true;
2875 }
2876 
void SetAcceptWhispers(bool on)
Definition: Player.h:1004
bool HandleNpcSayCommand(const char *args)
Definition: Level1.cpp:41
bool Utf8FitTo(const std::string &str, std::wstring search)
Definition: Util.cpp:419
AreaTableEntry const * GetAreaEntryByAreaID(uint32 area_id)
Definition: DBCStores.cpp:623
void SendNotification(const char *format,...) ATTR_PRINTF(2
float m_recallY
Definition: Player.h:2433
bool IsBattlegroundOrArena() const
Definition: Map.h:447
std::wstring wnameLow
Definition: ObjectMgr.h:71
Group * GetGroup()
Definition: Player.h:2577
void SetSentErrorMessage(bool val)
Definition: Chat.h:593
float m_recallX
Definition: Player.h:2432
bool HandleGMTicketListCommand(const char *args)
Definition: Level1.cpp:295
bool HandleModifySpellCommand(const char *args)
Definition: Level1.cpp:1379
const uint32 & GetUInt32Value(uint16 index) const
Definition: Object.h:234
std::string PGetParseString(int32 entry,...)
Definition: Level1.cpp:284
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:1903
void SendGlobalGMSysMessage(const char *str)
Definition: Chat.cpp:825
float depth_level
Definition: Map.h:152
std::string name
Definition: ObjectMgr.h:70
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
#define SIZE_OF_GRIDS
Definition: GridDefines.h:35
void Mount(uint32 mount, uint32 spellId=0)
Definition: Unit.cpp:9270
PlayerTaxi m_taxi
Definition: Player.h:990
static bool ExistVMap(uint32 mapid, int gx, int gy)
Definition: Map.cpp:84
Creature * getSelectedCreature()
Definition: Chat.cpp:1640
uint32 GetZoneId(uint32 mapid, float x, float y, float z)
Definition: MapManager.h:56
bool HandleGMTicketCommentCommand(const char *args)
Definition: Level1.cpp:600
Map * GetMap() const
Definition: Object.h:841
uint32 GetFaction() const
Definition: Unit.h:1116
bool HandleSummonCommand(const char *args)
Definition: Level1.cpp:812
void Yell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Creature.h:567
bool HandleGMChatCommand(const char *args)
Definition: Level1.cpp:252
bool HandleGMmodeCommand(const char *args)
Definition: Level1.cpp:210
Unit * getSelectedUnit()
Definition: Chat.cpp:1627
bool HandleModifyFactionCommand(const char *args)
Definition: Level1.cpp:1301
bool isGMVisible() const
Definition: Player.h:1032
void SetFreeTalentPoints(uint32 points)
Definition: Player.h:1661
#define CENTER_GRID_ID
Definition: GridDefines.h:36
void SetObjectScale(float scale)
Definition: Object.h:205
bool HandleNotifyCommand(const char *args)
Definition: Level1.cpp:178
bool viewed
Definition: TicketMgr.h:49
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid)
Definition: Player.cpp:16869
bool HandleGMTicketCloseByIdCommand(const char *args)
Definition: Level1.cpp:434
bool HandleModifySwimCommand(const char *args)
Definition: Level1.cpp:1571
MotionMaster * GetMotionMaster()
Definition: Unit.h:1890
bool HandleModifyRageCommand(const char *args)
Definition: Level1.cpp:1256
uint32 GetZoneId() const
Definition: Object.cpp:1179
bool HandleModifySpeedCommand(const char *args)
Definition: Level1.cpp:1532
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
void SetBattlegroundEntryPoint()
Definition: Player.cpp:18574
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:1591
float orientation
Definition: ObjectMgr.h:68
#define sLog
Log class singleton.
Definition: Log.h:187
float position_x
Definition: ObjectMgr.h:65
bool IsInFlight() const
Definition: Unit.h:1239
ZLiquidStatus
Definition: Map.h:126
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:779
ACE_INT32 int32
Definition: Define.h:67
void SaveRecallPosition()
Definition: Player.cpp:5697
bool HandleGPSCommand(const char *args)
Definition: Level1.cpp:721
bool HandleGMTicketDeleteByIdCommand(const char *args)
Definition: Level1.cpp:640
float m_recallZ
Definition: Player.h:2434
bool isAcceptWhispers() const
Definition: Player.h:1000
float m_recallO
Definition: Player.h:2435
bool IsDungeon() const
Definition: Map.h:427
Player * getSelectedPlayerOrSelf()
Definition: Chat.cpp:1609
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:37
bool HandleGoXYZCommand(const char *args)
Definition: Level1.cpp:2696
virtual void SendSysMessage(const char *str)
Definition: Chat.cpp:790
uint32 y_coord
Definition: GridDefines.h:142
bool HandleModifyMoneyCommand(const char *args)
Definition: Level1.cpp:1972
bool IsGameMaster() const
Definition: Player.h:1009
Player * GetPlayer() const
Definition: WorldSession.h:104
bool HandleDrunkCommand(const char *args)
Definition: Level1.cpp:2857
uint32 GetGUIDLow() const
Definition: Object.h:166
bool HandleGoXYCommand(const char *args)
Definition: Level1.cpp:2649
bool escalated
Definition: TicketMgr.h:48
uint32 x_coord
Definition: GridDefines.h:141
LocaleConstant GetSessionDbcLocale() const
Definition: WorldSession.h:233
bool HandleAnnounceCommand(const char *args)
Definition: Level1.cpp:158
void AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:13463
DungeonDifficulty GetDifficulty()
Definition: Player.h:1870
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:255
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:985
bool HandleNpcTextEmoteCommand(const char *args)
Definition: Level1.cpp:96
bool HandleGMTicketUnAssignCommand(const char *args)
Definition: Level1.cpp:549
WorldSession * m_session
Definition: Chat.h:596
#define sObjectMgr
Definition: ObjectMgr.h:1285
void wstrToLower(std::wstring &str)
Definition: Util.h:308
void SendPacket(WorldPacket const *packet)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
bool HandleGMTicketReloadCommand(const char *)
Definition: Level1.cpp:677
bool HandleTaxiCheatCommand(const char *args)
Definition: Level1.cpp:1451
bool HandleVisibleCommand(const char *args)
Definition: Level1.cpp:684
Player * ToPlayer()
Definition: Object.h:392
void ClearTaxiDestinations()
Definition: Player.h:857
Map const * CreateBaseMap(uint32 id) const
Definition: MapManager.h:41
bool HandleGMAnnounceCommand(const char *args)
Definition: Level1.cpp:168
bool HandleModifyHPCommand(const char *args)
Definition: Level1.cpp:1124
bool HandleGroupSummonCommand(const char *args)
Definition: Level1.cpp:2553
bool IsBeingTeleported() const
Definition: Player.h:2038
bool HandleGMNameAnnounceCommand(const char *args)
Definition: Level1.cpp:147
bool HandleGMTicketAssignToCommand(const char *args)
Definition: Level1.cpp:480
void RemoveAurasDueToSpell(uint32 spellId, Aura *except=NULL)
Definition: Unit.cpp:4371
uint32 GetId(void) const
Definition: Map.h:333
float position_z
Definition: ObjectMgr.h:67
uint8 GetTypeId() const
Definition: Object.h:210
char const * localeNames[MAX_LOCALE]
Definition: Common.cpp:20
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:225
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition: Player.cpp:1488
Creature * GetCreature(uint64 guid)
Definition: Map.cpp:2630
ACE_UINT8 uint8
Definition: Define.h:73
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1097
float GetOrientation() const
Definition: Position.h:100
bool HandleGMTicketGetByIdCommand(const char *args)
Definition: Level1.cpp:357
void Zone2MapCoordinates(float &x, float &y, uint32 zone)
Definition: DBCStores.cpp:722
uint64 assignedToGM
Definition: TicketMgr.h:46
const bool & IsInWorld() const
Definition: Object.h:135
uint64 timestamp
Definition: TicketMgr.h:44
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:13499
const uint8 MAX_LOCALE
Definition: Common.h:224
float GetWaterLevel(float x, float y) const
Definition: Map.cpp:1794
void LeaveBattleground(bool teleportToEntryPoint=true)
Definition: Player.cpp:18624
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition: Chat.cpp:858
uint32 GetPhaseMask() const
Definition: Object.h:694
bool HandleModifyScaleCommand(const char *args)
Definition: Level1.cpp:1681
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data=0) const
Definition: Map.cpp:1728
std::string name
Definition: TicketMgr.h:37
bool HandleNpcYellCommand(const char *args)
Definition: Level1.cpp:74
bool HandleGMTicketListOnlineCommand(const char *args)
Definition: Level1.cpp:315
bool HandleModifyMountCommand(const char *args)
Definition: Level1.cpp:1715
bool IsAlive() const
Definition: Unit.h:1336
bool HandleAppearCommand(const char *args)
Definition: Level1.cpp:927
float GetPositionY() const
Definition: Position.h:98
void SetDifficulty(DungeonDifficulty dungeon_difficulty)
Definition: Player.h:1866
std::string comment
Definition: TicketMgr.h:47
const char * GetMapName() const
Definition: Map.cpp:1890
void GetPosition(float &x, float &y) const
Definition: Position.h:102
float level
Definition: Map.h:151
bool HandleLookupTeleCommand(const char *args)
Definition: Level1.cpp:2221
uint32 GetInstanceId() const
Definition: Object.h:688
float GetPositionZ() const
Definition: Position.h:99
uint64 closed
Definition: TicketMgr.h:45
float GetAngle(Position const *pos) const
bool HandleModifyBWalkCommand(const char *args)
Definition: Level1.cpp:1610
const uint64 & GetSelection() const
Definition: Player.h:1553
void Say(const char *text, uint32 language, uint64 TargetGuid)
Definition: Creature.h:566
PackedGuid const & GetPackGUID() const
Definition: Object.h:178
uint64 playerGuid
Definition: TicketMgr.h:36
void UpdateObjectVisibility(bool forced=true) override
Definition: Player.cpp:18890
bool HandleGMNotifyCommand(const char *args)
Definition: Level1.cpp:194
InstancePlayerBind * GetBoundInstance(uint32 mapid, uint8 difficulty)
Definition: Player.cpp:15855
uint32 GetMapId() const
Definition: Object.h:591
uint32 type_flags
Definition: Map.h:149
bool HandleGMTicketGetByNameCommand(const char *args)
Definition: Level1.cpp:396
void SetMaxHealth(uint32 val)
Definition: Unit.cpp:10938
void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0)
Definition: Player.cpp:1013
GroupReference * GetFirstMember()
Definition: Group.h:304
void SendMailTo(MailReceiver const &receiver, MailSender const &sender, MailCheckMask checked=MAIL_CHECK_MASK_NONE, uint32 deliver_delay=0)
Definition: Mail.cpp:978
uint32 GetAreaId() const
Definition: Object.cpp:1184
bool HandleModifyEnergyCommand(const char *args)
Definition: Level1.cpp:1209
Definition: Map.h:266
#define sAccountMgr
Definition: AccountMgr.h:60
uint32 entry
Definition: Map.h:150
void CleanupAfterTaxiFlight()
Definition: Player.cpp:17910
GroupReference * next()
InstancePlayerBind * BindToInstance(InstanceSave *save, bool permanent, bool load=false)
Definition: Player.cpp:15896
void SetMoney(uint32 value)
Definition: Player.h:1525
#define sInstanceSaveMgr
bool HandleLookupAreaCommand(const char *args)
Definition: Level1.cpp:2145
bool HandleGoGridCommand(const char *args)
Definition: Level1.cpp:2810
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:167
float position_y
Definition: ObjectMgr.h:66
std::string secsToTimeString(uint32 timeInSecs, bool shortText, bool hoursOnly)
Definition: Util.cpp:109
void SetBattlegroundId(uint32 val)
Definition: Player.h:2241
const char * GetName() const
Definition: Object.h:704
ChatHandler()
Definition: Chat.h:90
Player * getSelectedPlayer()
Definition: Chat.cpp:1596
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1006
ACE_UINT64 uint64
Definition: Define.h:70
Definition: Cell.h:46
bool HandleGMTicketListClosedCommand(const char *args)
Definition: Level1.cpp:336
bool HandleNameAnnounceCommand(const char *args)
Definition: Level1.cpp:137
uint32 GetBattlegroundId() const
Definition: Player.h:2200
void SetGMChat(bool on)
Definition: Player.h:1018
bool HandleModifyASpeedCommand(const char *args)
Definition: Level1.cpp:1489
Definition: Unit.h:485
const uint64 & GetLeaderGUID() const
Definition: Group.h:222
bool isGMChat() const
Definition: Player.h:1014
void SetGameMaster(bool on)
Definition: Player.cpp:2240
virtual const char * GetOregonString(int32 entry) const
Definition: Chat.cpp:753
#define MAP_ALL_LIQUIDS
Definition: Map.h:142
uint64 guid
Definition: TicketMgr.h:35
bool IsBattlegroundOrArena() const
Definition: DBCStructure.h:570
void SetGMVisible(bool on)
Definition: Player.cpp:2301
uint32 GetMoney()
Definition: Player.h:1510
bool HandleSendMailCommand(const char *args)
Definition: Level1.cpp:2319
uint32 realmID
Id of the realm.
Definition: Main.cpp:57
double rand_chance()
Definition: Util.cpp:53
static bool IsValidMapCoord(uint32 mapid, float x, float y)
Definition: MapManager.h:87
uint32 mapId
Definition: ObjectMgr.h:69
void Map2ZoneCoordinates(float &x, float &y, uint32 zone)
Definition: DBCStores.cpp:735
void SetFaction(uint32 faction)
Definition: Unit.h:1117
UNORDERED_MAP< uint32, GameTele > GameTeleMap
Definition: ObjectMgr.h:74
bool HandleRecallCommand(const char *args)
Definition: Level1.cpp:1076
bool HandleTeleCommand(const char *args)
Definition: Level1.cpp:2096
bool HandleGoZoneXYCommand(const char *args)
Definition: Level1.cpp:2743
bool HandleNameTeleCommand(const char *args)
Definition: Level1.cpp:2403
bool HandleNpcWhisperCommand(const char *args)
Definition: Level1.cpp:116
void SetPower(Powers power, uint32 val)
Definition: Unit.cpp:10997
char * area_name[16]
Definition: DBCStructure.h:48
static IVMapManager * createOrGetVMapManager()
uint64 createtime
Definition: TicketMgr.h:43
void ModifyHonorPoints(int32 value)
Definition: Player.cpp:6152
void HandleEmoteCommand(uint32 anim_id)
Definition: Unit.cpp:1970
bool Instanceable() const
Definition: Map.h:422
bool HandleGroupTeleCommand(const char *args)
Definition: Level1.cpp:2482
static bool ExistMap(uint32 mapid, int gx, int gy)
Definition: Map.cpp:57
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:11030
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:10014
void SendMessageToSet(WorldPacket *data, bool self) override
Definition: Player.h:1984
void UpdateTriggerVisibility()
Definition: Player.cpp:18826
uint32 GetEntry() const
Definition: Object.h:192
bool IsOutdoors(float x, float y, float z) const
Definition: Map.cpp:1651
WorldSession * GetSession() const
Definition: Player.h:1944
#define sWorld
Definition: World.h:860
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:1591
void uint32 GetSecurity() const
Definition: WorldSession.h:96
void SetHealth(uint32 val)
Definition: Unit.cpp:10905
ACE_UINT16 uint16
Definition: Define.h:72
void Whisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Creature.h:569
bool HandleModifyHonorCommand(const char *args)
Definition: Level1.cpp:2074
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:305
void ModifyMoney(int32 d)
Definition: Player.h:1514
ACE_UINT32 uint32
Definition: Define.h:71
std::string message
Definition: TicketMgr.h:42
float GetPositionX() const
Definition: Position.h:97
#define MAX_HEIGHT
Definition: Map.h:258
bool HandleSaveAllCommand(const char *args)
Definition: Level1.cpp:2311
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:158
bool HandleModifyFlyCommand(const char *args)
Definition: Level1.cpp:1649
bool HandleModifyTalentCommand(const char *args)
Definition: Level1.cpp:1429
Definition: Unit.h:908
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
Definition: Chat.cpp:1648
float GetObjectSize() const
Definition: Object.h:669
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:1878
bool HandleWhispersCommand(const char *args)
Definition: Level1.cpp:2280
void TextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Creature.h:568
Definition: Player.h:922
#define ticketmgr
Definition: TicketMgr.h:94
uint32 GetInstanceId() const
Definition: Map.h:390
char * name[16]
Definition: DBCStructure.h:518
bool HandleModifyBitCommand(const char *args)
Definition: Level1.cpp:2024
uint32 GetHonorPoints()
Definition: Player.h:2096
#define vsnprintf
Definition: Common.h:131
bool HandleModifyManaCommand(const char *args)
Definition: Level1.cpp:1165
uint32 m_recallMap
Definition: Player.h:2431
void SetOpcode(uint16 opcode)
Definition: WorldPacket.h:48
virtual bool processCommand(char *pCommand)=0
Definition: Group.h:154
virtual char const * GetName() const
Definition: Chat.cpp:1873
#define atol(a)
Definition: Common.h:162
GameTele const * extractGameTeleFromLink(char *text)
Definition: Chat.cpp:1842
void SetTaxiCheater(bool on)
Definition: Player.h:1027
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
Definition: Object.h:646
const uint64 & GetGUID() const
Definition: Object.h:162
DBCStorage< AreaTableEntry > sAreaStore(AreaTableEntryfmt)
bool HasAura(uint32 spellId, uint8 effIndex=0) const
Definition: Unit.h:1262
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:162
static bool LoadPositionFromDB(uint32 &mapid, float &x, float &y, float &z, float &o, bool &in_flight, uint64 guid)
Definition: Player.cpp:14349