OregonCore  revision 3611e8a-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 "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::HandleNamegoCommand(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  }
903  else if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name))
904  {
906 
907  // in point where GM stay
914  guid);
915  }
916  else
917  {
919  SetSentErrorMessage(true);
920  }
921 
922  return true;
923 }
924 
925 //Teleport to Player
926 bool ChatHandler::HandleGonameCommand(const char* args)
927 {
928  if (!*args)
929  return false;
930 
931  Player* _player = m_session->GetPlayer();
932 
933  std::string name = args;
934 
935  if (!normalizePlayerName(name))
936  {
938  SetSentErrorMessage(true);
939  return false;
940  }
941 
942  Player* target = sObjectMgr.GetPlayer(name.c_str());
943  if (target)
944  {
945  Map* cMap = target->GetMap();
946  if (cMap->IsBattlegroundOrArena())
947  {
948  // only allow if gm mode is on
949  if (!_player->IsGameMaster())
950  {
952  SetSentErrorMessage(true);
953  return false;
954  }
955  // if both players are in different bgs
956  else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
957  _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
958 
959  // all's well, set bg id
960  // when porting out from the bg, it will be reset to 0
961  _player->SetBattlegroundId(target->GetBattlegroundId());
962  // remember current position as entry point for return at bg end teleportation
963  if (!_player->GetMap()->IsBattlegroundOrArena())
964  _player->SetBattlegroundEntryPoint();
965  }
966  else if (cMap->IsDungeon())
967  {
968  // we have to go to instance, and can go to player only if:
969  // 1) we are in his group (either as leader or as member)
970  // 2) we are not bound to any group and have GM mode on
971  if (_player->GetGroup())
972  {
973  // we are in group, we can go only if we are in the player group
974  if (_player->GetGroup() != target->GetGroup())
975  {
977  SetSentErrorMessage(true);
978  return false;
979  }
980  }
981  else
982  {
983  // we are not in group, let's verify our GM mode
984  if (!_player->IsGameMaster())
985  {
987  SetSentErrorMessage(true);
988  return false;
989  }
990  }
991 
992  // if the player or the player's group is bound to another instance
993  // the player will not be bound to another one
994  InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty());
995  if (!pBind)
996  {
997  Group *group = _player->GetGroup();
998  // if no bind exists, create a solo bind
999  InstanceGroupBind *gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
1000  if (!gBind)
1001  if (InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(target->GetInstanceId()))
1002  _player->BindToInstance(save, !save->CanReset());
1003  }
1004 
1005  _player->SetDifficulty(target->GetDifficulty());
1006  }
1007 
1009 
1010  //if (_player->IsVisibleGloballyFor(target))
1011  // ChatHandler(target).PSendSysMessage(LANG_APPEARING_TO, _player->GetName());
1012 
1013  // stop flight if need
1014  if (_player->isInFlight())
1015  {
1016  _player->GetMotionMaster()->MovementExpired();
1017  _player->CleanupAfterTaxiFlight();
1018  }
1019  // save only in non-flight case
1020  else
1021  _player->SaveRecallPosition();
1022 
1023  // to point to see at target with same orientation
1024  float x, y, z;
1025  target->GetPosition(x, y, z);
1026 
1027  if (_player->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) ||
1029  {
1030  WorldPacket data;
1032  data << _player->GetPackGUID();
1033  data << uint32(0); // unknown
1034  _player->SendMessageToSet(&data, true);
1035  }
1036 
1037  _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
1038 
1039  return true;
1040  }
1041 
1042  if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name))
1043  {
1044  PSendSysMessage(LANG_APPEARING_AT, name.c_str());
1045 
1046  // to point where player stay (if loaded)
1047  float x, y, z, o;
1048  uint32 map;
1049  bool in_flight;
1050  if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, guid))
1051  return false;
1052 
1053  // stop flight if need
1054  if (_player->isInFlight())
1055  {
1056  _player->GetMotionMaster()->MovementExpired();
1057  _player->CleanupAfterTaxiFlight();
1058  }
1059  // save only in non-flight case
1060  else
1061  _player->SaveRecallPosition();
1062 
1063  _player->TeleportTo(map, x, y, z, _player->GetOrientation());
1064  return true;
1065  }
1066 
1068 
1069  SetSentErrorMessage(true);
1070  return false;
1071 }
1072 
1073 // Teleport player to last position
1074 bool ChatHandler::HandleRecallCommand(const char* args)
1075 {
1076  Player* target = NULL;
1077 
1078  if (!*args)
1079  {
1080  target = getSelectedPlayerOrSelf();
1081  }
1082  else
1083  {
1084  std::string name = args;
1085 
1086  if (!normalizePlayerName(name))
1087  {
1089  SetSentErrorMessage(true);
1090  return false;
1091  }
1092 
1093  target = sObjectMgr.GetPlayer(name.c_str());
1094 
1095  if (!target)
1096  {
1098  SetSentErrorMessage(true);
1099  return false;
1100  }
1101  }
1102 
1103  if (target->IsBeingTeleported())
1104  {
1106  SetSentErrorMessage(true);
1107  return false;
1108  }
1109 
1110  // stop flight if need
1111  if (target->isInFlight())
1112  {
1113  target->GetMotionMaster()->MovementExpired();
1114  target->m_taxi.ClearTaxiDestinations();
1115  }
1116 
1117  target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
1118  return true;
1119 }
1120 
1121 //Edit Player HP
1123 {
1124  if (!*args)
1125  return false;
1126 
1127  int32 hp = atoi((char*)args);
1128  int32 hpm = atoi((char*)args);
1129 
1130  if (hp < 1 || hpm < 1 || hpm < hp)
1131  {
1133  SetSentErrorMessage(true);
1134  return false;
1135  }
1136 
1137  Player* target = getSelectedPlayerOrSelf();
1138  if (target == NULL)
1139  {
1141  SetSentErrorMessage(true);
1142  return false;
1143  }
1144 
1145  if (!target->IsAlive())
1146  {
1148  SetSentErrorMessage(true);
1149  return false;
1150  }
1151 
1152  PSendSysMessage(LANG_YOU_CHANGE_HP, target->GetName(), hp, hpm);
1153  if (needReportToTarget(target))
1154  ChatHandler(target).PSendSysMessage(LANG_YOURS_HP_CHANGED, GetName(), hp, hpm);
1155 
1156  target->SetMaxHealth(hpm);
1157  target->SetHealth(hp);
1158 
1159  return true;
1160 }
1161 
1162 //Edit Player Mana
1164 {
1165  if (!*args)
1166  return false;
1167 
1168  // char* pmana = strtok((char*)args, " ");
1169  // if (!pmana)
1170  // return false;
1171 
1172  // char* pmanaMax = strtok(NULL, " ");
1173  // if (!pmanaMax)
1174  // return false;
1175 
1176  // int32 manam = atoi(pmanaMax);
1177  // int32 mana = atoi(pmana);
1178  int32 mana = atoi((char*)args);
1179  int32 manam = atoi((char*)args);
1180 
1181  if (mana <= 0 || manam <= 0 || manam < mana)
1182  {
1184  SetSentErrorMessage(true);
1185  return false;
1186  }
1187 
1188  Player* target = getSelectedPlayerOrSelf();
1189  if (target == NULL)
1190  {
1192  SetSentErrorMessage(true);
1193  return false;
1194  }
1195 
1196  PSendSysMessage(LANG_YOU_CHANGE_MANA, target->GetName(), mana, manam);
1197  if (needReportToTarget(target))
1198  ChatHandler(target).PSendSysMessage(LANG_YOURS_MANA_CHANGED, GetName(), mana, manam);
1199 
1200  target->SetMaxPower(POWER_MANA, manam);
1201  target->SetPower(POWER_MANA, mana);
1202 
1203  return true;
1204 }
1205 
1206 //Edit Player Energy
1208 {
1209  if (!*args)
1210  return false;
1211 
1212  // char* pmana = strtok((char*)args, " ");
1213  // if (!pmana)
1214  // return false;
1215 
1216  // char* pmanaMax = strtok(NULL, " ");
1217  // if (!pmanaMax)
1218  // return false;
1219 
1220  // int32 manam = atoi(pmanaMax);
1221  // int32 mana = atoi(pmana);
1222 
1223  int32 energy = atoi((char*)args) * 10;
1224  int32 energym = atoi((char*)args) * 10;
1225 
1226  if (energy <= 0 || energym <= 0 || energym < energy)
1227  {
1229  SetSentErrorMessage(true);
1230  return false;
1231  }
1232 
1233  Player* target = getSelectedPlayerOrSelf();
1234  if (!target)
1235  {
1237  SetSentErrorMessage(true);
1238  return false;
1239  }
1240 
1241  PSendSysMessage(LANG_YOU_CHANGE_ENERGY, target->GetName(), energy / 10, energym / 10);
1242  if (needReportToTarget(target))
1243  ChatHandler(target).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, GetName(), energy / 10, energym / 10);
1244 
1245  target->SetMaxPower(POWER_ENERGY, energym);
1246  target->SetPower(POWER_ENERGY, energy);
1247 
1249 
1250  return true;
1251 }
1252 
1253 //Edit Player Rage
1255 {
1256  if (!*args)
1257  return false;
1258 
1259  // char* pmana = strtok((char*)args, " ");
1260  // if (!pmana)
1261  // return false;
1262 
1263  // char* pmanaMax = strtok(NULL, " ");
1264  // if (!pmanaMax)
1265  // return false;
1266 
1267  // int32 manam = atoi(pmanaMax);
1268  // int32 mana = atoi(pmana);
1269 
1270  int32 rage = atoi((char*)args) * 10;
1271  int32 ragem = atoi((char*)args) * 10;
1272 
1273  if (rage <= 0 || ragem <= 0 || ragem < rage)
1274  {
1276  SetSentErrorMessage(true);
1277  return false;
1278  }
1279 
1280  Player* target = getSelectedPlayerOrSelf();
1281  if (target == NULL)
1282  {
1284  SetSentErrorMessage(true);
1285  return false;
1286  }
1287 
1288  PSendSysMessage(LANG_YOU_CHANGE_RAGE, target->GetName(), rage / 10, ragem / 10);
1289  if (needReportToTarget(target))
1290  ChatHandler(target).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, GetName(), rage / 10, ragem / 10);
1291 
1292  target->SetMaxPower(POWER_RAGE, ragem);
1293  target->SetPower(POWER_RAGE, rage);
1294 
1295  return true;
1296 }
1297 
1298 //Edit Player Faction
1300 {
1301  if (!*args)
1302  return false;
1303 
1304  char* pfactionid = extractKeyFromLink((char*)args, "Hfaction");
1305 
1306  Creature* target = getSelectedCreature();
1307  if (!target)
1308  {
1310  SetSentErrorMessage(true);
1311  return false;
1312  }
1313 
1314  if (!pfactionid)
1315  {
1316  if (target)
1317  {
1318  uint32 factionid = target->getFaction();
1319  uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
1320  uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
1321  uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
1322  PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
1323  }
1324  return true;
1325  }
1326 
1327  if (!target)
1328  {
1330  SetSentErrorMessage(true);
1331  return false;
1332  }
1333 
1334  uint32 factionid = atoi(pfactionid);
1335  uint32 flag;
1336 
1337  char* pflag = strtok(NULL, " ");
1338  if (!pflag)
1339  flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
1340  else
1341  flag = atoi(pflag);
1342 
1343  char* pnpcflag = strtok(NULL, " ");
1344 
1345  uint32 npcflag;
1346  if (!pnpcflag)
1347  npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
1348  else
1349  npcflag = atoi(pnpcflag);
1350 
1351  char* pdyflag = strtok(NULL, " ");
1352 
1353  uint32 dyflag;
1354  if (!pdyflag)
1355  dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
1356  else
1357  dyflag = atoi(pdyflag);
1358 
1359  if (!sFactionTemplateStore.LookupEntry(factionid))
1360  {
1361  PSendSysMessage(LANG_WRONG_FACTION, factionid);
1362  SetSentErrorMessage(true);
1363  return false;
1364  }
1365 
1366  PSendSysMessage(LANG_YOU_CHANGE_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
1367 
1368  target->setFaction(factionid);
1369  target->SetUInt32Value(UNIT_FIELD_FLAGS, flag);
1370  target->SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
1371  target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, dyflag);
1372 
1373  return true;
1374 }
1375 
1376 //Edit Player Spell
1378 {
1379  if (!*args) return false;
1380  char* pspellflatid = strtok((char*)args, " ");
1381  if (!pspellflatid)
1382  return false;
1383 
1384  char* pop = strtok(NULL, " ");
1385  if (!pop)
1386  return false;
1387 
1388  char* pval = strtok(NULL, " ");
1389  if (!pval)
1390  return false;
1391 
1392  uint16 mark;
1393 
1394  char* pmark = strtok(NULL, " ");
1395 
1396  uint8 spellflatid = atoi(pspellflatid);
1397  uint8 op = atoi(pop);
1398  uint16 val = atoi(pval);
1399  if (!pmark)
1400  mark = 65535;
1401  else
1402  mark = atoi(pmark);
1403 
1404  Player* target = getSelectedPlayerOrSelf();
1405  if (target == NULL)
1406  {
1408  SetSentErrorMessage(true);
1409  return false;
1410  }
1411 
1412  PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, target->GetName());
1413  if (needReportToTarget(target))
1414  ChatHandler(target).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, GetName(), spellflatid, val, mark);
1415 
1416  WorldPacket data(SMSG_SET_FLAT_SPELL_MODIFIER, (1 + 1 + 2 + 2));
1417  data << uint8(spellflatid);
1418  data << uint8(op);
1419  data << uint16(val);
1420  data << uint16(mark);
1421  target->GetSession()->SendPacket(&data);
1422 
1423  return true;
1424 }
1425 
1426 //Edit Player TP
1428 {
1429  if (!*args)
1430  return false;
1431 
1432  int tp = atoi((char*)args);
1433  if (tp < 0)
1434  return false;
1435 
1436  Player* target = getSelectedPlayerOrSelf();
1437  if (!target)
1438  {
1440  SetSentErrorMessage(true);
1441  return false;
1442  }
1443 
1444  target->SetFreeTalentPoints(tp);
1445  return true;
1446 }
1447 
1448 //Enable On\OFF all taxi paths
1450 {
1451  if (!*args)
1452  {
1454  SetSentErrorMessage(true);
1455  return false;
1456  }
1457 
1458  std::string argstr = (char*)args;
1459 
1460  Player* target = getSelectedPlayerOrSelf();
1461 
1462  if (argstr == "on")
1463  {
1464  target->SetTaxiCheater(true);
1466  if (needReportToTarget(target))
1467  ChatHandler(target).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, GetName());
1468  return true;
1469  }
1470 
1471  if (argstr == "off")
1472  {
1473  target->SetTaxiCheater(false);
1475  if (needReportToTarget(target))
1476  ChatHandler(target).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, GetName());
1477 
1478  return true;
1479  }
1480 
1482  SetSentErrorMessage(true);
1483  return false;
1484 }
1485 
1486 //Edit Player Aspeed
1488 {
1489  if (!*args)
1490  return false;
1491 
1492  float modSpeed = (float)atof((char*)args);
1493 
1494 
1495  if (modSpeed > 10 || modSpeed < 0.1)
1496  {
1498  SetSentErrorMessage(true);
1499  return false;
1500  }
1501 
1502  Player* target = getSelectedPlayerOrSelf();
1503  if (target == NULL)
1504  {
1506  SetSentErrorMessage(true);
1507  return false;
1508  }
1509 
1510  if (target->isInFlight())
1511  {
1513  SetSentErrorMessage(true);
1514  return false;
1515  }
1516 
1517  PSendSysMessage(LANG_YOU_CHANGE_ASPEED, modSpeed, target->GetName());
1518  if (needReportToTarget(target))
1519  ChatHandler(target).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, GetName(), modSpeed);
1520 
1521  target->SetSpeed(MOVE_WALK, modSpeed, true);
1522  target->SetSpeed(MOVE_RUN, modSpeed, true);
1523  target->SetSpeed(MOVE_SWIM, modSpeed, true);
1524  //target->SetSpeed(MOVE_TURN, modSpeed, true);
1525  target->SetSpeed(MOVE_FLIGHT, modSpeed, true);
1526  return true;
1527 }
1528 
1529 //Edit Player Speed
1531 {
1532  if (!*args)
1533  return false;
1534 
1535  float modSpeed = (float)atof((char*)args);
1536 
1537  if (modSpeed > 10 || modSpeed < 0.1)
1538  {
1540  SetSentErrorMessage(true);
1541  return false;
1542  }
1543 
1544  Player* target = getSelectedPlayerOrSelf();
1545  if (target == NULL)
1546  {
1548  SetSentErrorMessage(true);
1549  return false;
1550  }
1551 
1552  if (target->isInFlight())
1553  {
1555  SetSentErrorMessage(true);
1556  return false;
1557  }
1558 
1559  PSendSysMessage(LANG_YOU_CHANGE_SPEED, modSpeed, target->GetName());
1560  if (needReportToTarget(target))
1561  ChatHandler(target).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, GetName(), modSpeed);
1562 
1563  target->SetSpeed(MOVE_RUN, modSpeed, true);
1564 
1565  return true;
1566 }
1567 
1568 //Edit Player Swim Speed
1570 {
1571  if (!*args)
1572  return false;
1573 
1574  float modSpeed = (float)atof((char*)args);
1575 
1576  if (modSpeed > 10.0f || modSpeed < 0.1f)
1577  {
1579  SetSentErrorMessage(true);
1580  return false;
1581  }
1582 
1583  Player* target = getSelectedPlayerOrSelf();
1584  if (target == NULL)
1585  {
1587  SetSentErrorMessage(true);
1588  return false;
1589  }
1590 
1591  if (target->isInFlight())
1592  {
1594  SetSentErrorMessage(true);
1595  return false;
1596  }
1597 
1598  PSendSysMessage(LANG_YOU_CHANGE_SWIM_SPEED, modSpeed, target->GetName());
1599  if (needReportToTarget(target))
1600  ChatHandler(target).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, GetName(), modSpeed);
1601 
1602  target->SetSpeed(MOVE_SWIM, modSpeed, true);
1603 
1604  return true;
1605 }
1606 
1607 //Edit Player Walk Speed
1609 {
1610  if (!*args)
1611  return false;
1612 
1613  float modSpeed = (float)atof((char*)args);
1614 
1615  if (modSpeed > 10.0f || modSpeed < 0.1f)
1616  {
1618  SetSentErrorMessage(true);
1619  return false;
1620  }
1621 
1622  Player* target = getSelectedPlayerOrSelf();
1623  if (target == NULL)
1624  {
1626  SetSentErrorMessage(true);
1627  return false;
1628  }
1629 
1630  if (target->isInFlight())
1631  {
1633  SetSentErrorMessage(true);
1634  return false;
1635  }
1636 
1637  PSendSysMessage(LANG_YOU_CHANGE_BACK_SPEED, modSpeed, target->GetName());
1638  if (needReportToTarget(target))
1639  ChatHandler(target).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, GetName(), modSpeed);
1640 
1641  target->SetSpeed(MOVE_RUN_BACK, modSpeed, true);
1642 
1643  return true;
1644 }
1645 
1646 //Edit Player Fly
1648 {
1649  if (!*args)
1650  return false;
1651 
1652  float modSpeed = (float)atof((char*)args);
1653 
1654  if (modSpeed > 50.0f || modSpeed < 0.1f)
1655  {
1657  SetSentErrorMessage(true);
1658  return false;
1659  }
1660 
1661  Player* target = getSelectedPlayerOrSelf();
1662  if (target == NULL)
1663  {
1665  SetSentErrorMessage(true);
1666  return false;
1667  }
1668 
1669  PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, modSpeed, target->GetName());
1670  if (needReportToTarget(target))
1671  ChatHandler(target).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetName(), modSpeed);
1672 
1673  target->SetSpeed(MOVE_FLIGHT, modSpeed, true);
1674 
1675  return true;
1676 }
1677 
1678 //Edit Player Scale
1680 {
1681  if (!*args)
1682  return false;
1683 
1684  float Scale = (float)atof((char*)args);
1685  if (Scale > 10.0f || Scale < 0.1f)
1686  {
1688  SetSentErrorMessage(true);
1689  return false;
1690  }
1691 
1692  Unit* target = getSelectedUnit();
1693  if (target == NULL)
1694  {
1696  SetSentErrorMessage(true);
1697  return false;
1698  }
1699 
1700  if (target->GetTypeId() == TYPEID_PLAYER)
1701  {
1702  PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, target->GetName());
1703  if (needReportToTarget(target->ToPlayer()))
1705  }
1706 
1707  target->SetObjectScale(Scale);
1708 
1709  return true;
1710 }
1711 
1712 //Enable Player mount
1714 {
1715  if (!*args)
1716  return false;
1717 
1718  uint16 mId = 1147;
1719  float speed = (float)15;
1720  uint32 num = 0;
1721 
1722  num = atoi((char*)args);
1723  switch (num)
1724  {
1725  case 1:
1726  mId = 14340;
1727  break;
1728  case 2:
1729  mId = 4806;
1730  break;
1731  case 3:
1732  mId = 6471;
1733  break;
1734  case 4:
1735  mId = 12345;
1736  break;
1737  case 5:
1738  mId = 6472;
1739  break;
1740  case 6:
1741  mId = 6473;
1742  break;
1743  case 7:
1744  mId = 10670;
1745  break;
1746  case 8:
1747  mId = 10719;
1748  break;
1749  case 9:
1750  mId = 10671;
1751  break;
1752  case 10:
1753  mId = 10672;
1754  break;
1755  case 11:
1756  mId = 10720;
1757  break;
1758  case 12:
1759  mId = 14349;
1760  break;
1761  case 13:
1762  mId = 11641;
1763  break;
1764  case 14:
1765  mId = 12244;
1766  break;
1767  case 15:
1768  mId = 12242;
1769  break;
1770  case 16:
1771  mId = 14578;
1772  break;
1773  case 17:
1774  mId = 14579;
1775  break;
1776  case 18:
1777  mId = 14349;
1778  break;
1779  case 19:
1780  mId = 12245;
1781  break;
1782  case 20:
1783  mId = 14335;
1784  break;
1785  case 21:
1786  mId = 207;
1787  break;
1788  case 22:
1789  mId = 2328;
1790  break;
1791  case 23:
1792  mId = 2327;
1793  break;
1794  case 24:
1795  mId = 2326;
1796  break;
1797  case 25:
1798  mId = 14573;
1799  break;
1800  case 26:
1801  mId = 14574;
1802  break;
1803  case 27:
1804  mId = 14575;
1805  break;
1806  case 28:
1807  mId = 604;
1808  break;
1809  case 29:
1810  mId = 1166;
1811  break;
1812  case 30:
1813  mId = 2402;
1814  break;
1815  case 31:
1816  mId = 2410;
1817  break;
1818  case 32:
1819  mId = 2409;
1820  break;
1821  case 33:
1822  mId = 2408;
1823  break;
1824  case 34:
1825  mId = 2405;
1826  break;
1827  case 35:
1828  mId = 14337;
1829  break;
1830  case 36:
1831  mId = 6569;
1832  break;
1833  case 37:
1834  mId = 10661;
1835  break;
1836  case 38:
1837  mId = 10666;
1838  break;
1839  case 39:
1840  mId = 9473;
1841  break;
1842  case 40:
1843  mId = 9476;
1844  break;
1845  case 41:
1846  mId = 9474;
1847  break;
1848  case 42:
1849  mId = 14374;
1850  break;
1851  case 43:
1852  mId = 14376;
1853  break;
1854  case 44:
1855  mId = 14377;
1856  break;
1857  case 45:
1858  mId = 2404;
1859  break;
1860  case 46:
1861  mId = 2784;
1862  break;
1863  case 47:
1864  mId = 2787;
1865  break;
1866  case 48:
1867  mId = 2785;
1868  break;
1869  case 49:
1870  mId = 2736;
1871  break;
1872  case 50:
1873  mId = 2786;
1874  break;
1875  case 51:
1876  mId = 14347;
1877  break;
1878  case 52:
1879  mId = 14346;
1880  break;
1881  case 53:
1882  mId = 14576;
1883  break;
1884  case 54:
1885  mId = 9695;
1886  break;
1887  case 55:
1888  mId = 9991;
1889  break;
1890  case 56:
1891  mId = 6448;
1892  break;
1893  case 57:
1894  mId = 6444;
1895  break;
1896  case 58:
1897  mId = 6080;
1898  break;
1899  case 59:
1900  mId = 6447;
1901  break;
1902  case 60:
1903  mId = 4805;
1904  break;
1905  case 61:
1906  mId = 9714;
1907  break;
1908  case 62:
1909  mId = 6448;
1910  break;
1911  case 63:
1912  mId = 6442;
1913  break;
1914  case 64:
1915  mId = 14632;
1916  break;
1917  case 65:
1918  mId = 14332;
1919  break;
1920  case 66:
1921  mId = 14331;
1922  break;
1923  case 67:
1924  mId = 8469;
1925  break;
1926  case 68:
1927  mId = 2830;
1928  break;
1929  case 69:
1930  mId = 2346;
1931  break;
1932  default:
1934  SetSentErrorMessage(true);
1935  return false;
1936  }
1937 
1938  Player* target = getSelectedPlayerOrSelf();
1939  if (target == NULL)
1940  {
1942  SetSentErrorMessage(true);
1943  return false;
1944  }
1945 
1947  if (needReportToTarget(target))
1948  ChatHandler(target).PSendSysMessage(LANG_MOUNT_GIVED, GetName());
1949 
1950  target->SetUInt32Value(UNIT_FIELD_FLAGS, 0x001000);
1951  target->Mount(mId);
1952 
1953  WorldPacket data(SMSG_FORCE_RUN_SPEED_CHANGE, (8 + 4 + 1 + 4));
1954  data << target->GetPackGUID();
1955  data << (uint32)0;
1956  data << (uint8)0; //new 2.1.0
1957  data << float(speed);
1958  target->SendMessageToSet(&data, true);
1959 
1960  data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, (8 + 4 + 4));
1961  data << target->GetPackGUID();
1962  data << (uint32)0;
1963  data << float(speed);
1964  target->SendMessageToSet(&data, true);
1965 
1966  return true;
1967 }
1968 
1969 //Edit Player money
1971 {
1972  if (!*args)
1973  return false;
1974 
1975  Player* target = getSelectedPlayerOrSelf();
1976  if (target == NULL)
1977  {
1979  SetSentErrorMessage(true);
1980  return false;
1981  }
1982 
1983  int32 addmoney = atoi((char*)args);
1984 
1985  uint32 moneyuser = target->GetMoney();
1986 
1987  if (addmoney < 0)
1988  {
1989  int32 newmoney = moneyuser + addmoney;
1990 
1991  sLog.outDetail(GetOregonString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
1992  if (newmoney <= 0)
1993  {
1995  if (needReportToTarget(target))
1996  ChatHandler(target).PSendSysMessage(LANG_YOURS_ALL_MONEY_GONE, GetName());
1997 
1998  target->SetMoney(0);
1999  }
2000  else
2001  {
2002  PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), target->GetName());
2003  if (needReportToTarget(target))
2004  ChatHandler(target).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetName(), abs(addmoney));
2005  target->SetMoney(newmoney);
2006  }
2007  }
2008  else
2009  {
2010  PSendSysMessage(LANG_YOU_GIVE_MONEY, addmoney, target->GetName());
2011  if (needReportToTarget(target))
2012  ChatHandler(target).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, GetName(), addmoney);
2013  target->ModifyMoney(addmoney);
2014  }
2015 
2016  sLog.outDetail(GetOregonString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney());
2017 
2018  return true;
2019 }
2020 
2021 //Edit Player field
2023 {
2024  if (!*args)
2025  return false;
2026 
2027  Player* target = getSelectedPlayerOrSelf();
2028  if (!target)
2029  {
2031  SetSentErrorMessage(true);
2032  return false;
2033  }
2034 
2035  char* pField = strtok((char*)args, " ");
2036  if (!pField)
2037  return false;
2038 
2039  char* pBit = strtok(NULL, " ");
2040  if (!pBit)
2041  return false;
2042 
2043  uint16 field = atoi(pField);
2044  uint32 bit = atoi(pBit);
2045 
2046  if (field < 1 || field >= PLAYER_END)
2047  {
2049  SetSentErrorMessage(true);
2050  return false;
2051  }
2052  if (bit < 1 || bit > 32)
2053  {
2055  SetSentErrorMessage(true);
2056  return false;
2057  }
2058 
2059  if (target->HasFlag(field, (1 << (bit - 1))))
2060  {
2061  target->RemoveFlag(field, (1 << (bit - 1)));
2062  PSendSysMessage(LANG_REMOVE_BIT, bit, field);
2063  }
2064  else
2065  {
2066  target->SetFlag(field, (1 << (bit - 1)));
2067  PSendSysMessage(LANG_SET_BIT, bit, field);
2068  }
2069  return true;
2070 }
2071 
2073 {
2074  if (!*args)
2075  return false;
2076 
2077  Player* target = getSelectedPlayerOrSelf();
2078  if (!target)
2079  {
2081  SetSentErrorMessage(true);
2082  return false;
2083  }
2084 
2085  int32 amount = (uint32)atoi(args);
2086 
2087  target->ModifyHonorPoints(amount);
2088 
2090 
2091  return true;
2092 }
2093 
2094 bool ChatHandler::HandleTeleCommand(const char* args)
2095 {
2096  if (!*args)
2097  return false;
2098 
2099  Player* _player = m_session->GetPlayer();
2100 
2101  // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
2102  GameTele const* tele = extractGameTeleFromLink((char*)args);
2103 
2104  if (!tele)
2105  {
2107  SetSentErrorMessage(true);
2108  return false;
2109  }
2110 
2111  MapEntry const* me = sMapStore.LookupEntry(tele->mapId);
2112  if (!me || me->IsBattlegroundOrArena())
2113  {
2115  SetSentErrorMessage(true);
2116  return false;
2117  }
2118 
2119  // stop flight if need
2120  if (_player->isInFlight())
2121  {
2122  _player->GetMotionMaster()->MovementExpired();
2123  _player->CleanupAfterTaxiFlight();
2124  }
2125  // save only in non-flight case
2126  else
2127  _player->SaveRecallPosition();
2128 
2129  // let gm fly remain
2131  {
2132  WorldPacket data;
2134  data << _player->GetPackGUID();
2135  data << uint32(0); // unknown
2136  _player->SendMessageToSet(&data, true);
2137  }
2138 
2139  _player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
2140  return true;
2141 }
2142 
2144 {
2145  if (!*args)
2146  return false;
2147 
2148  std::string namepart = args;
2149  std::wstring wnamepart;
2150 
2151  if (!Utf8toWStr (namepart, wnamepart))
2152  return false;
2153 
2154  bool found = false;
2155  uint32 count = 0;
2156  uint32 maxResults = sWorld.getConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
2157 
2158  // converting string that we try to find to lower case
2159  wstrToLower (wnamepart);
2160 
2161  // Search in AreaTable.dbc
2162  for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag)
2163  {
2164  AreaTableEntry const* areaEntry = sAreaStore.LookupEntry (areaflag);
2165  if (areaEntry)
2166  {
2167  int loc = m_session ? int(m_session->GetSessionDbcLocale()) : sWorld.GetDefaultDbcLocale();
2168  std::string name = areaEntry->area_name[loc];
2169  if (name.empty())
2170  continue;
2171 
2172  if (!Utf8FitTo (name, wnamepart))
2173  {
2174  loc = 0;
2175  for (; loc < MAX_LOCALE; ++loc)
2176  {
2177  if (m_session && loc == m_session->GetSessionDbcLocale ())
2178  continue;
2179 
2180  name = areaEntry->area_name[loc];
2181  if (name.empty ())
2182  continue;
2183 
2184  if (Utf8FitTo (name, wnamepart))
2185  break;
2186  }
2187  }
2188 
2189  if (loc < MAX_LOCALE)
2190  {
2191  if (maxResults && count++ == maxResults)
2192  {
2194  return true;
2195  }
2196 
2197  // send area in "id - [name]" format
2198  std::ostringstream ss;
2199  if (m_session)
2200  ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r";
2201  else
2202  ss << areaEntry->ID << " - " << name << " " << localeNames[loc];
2203 
2204  SendSysMessage (ss.str ().c_str());
2205 
2206  if (!found)
2207  found = true;
2208  }
2209  }
2210  }
2211 
2212  if (!found)
2214 
2215  return true;
2216 }
2217 
2218 //Find tele in game_tele order by name
2220 {
2221  if (!*args)
2222  {
2224  SetSentErrorMessage(true);
2225  return false;
2226  }
2227 
2228  char const* str = strtok((char*)args, " ");
2229  if (!str)
2230  return false;
2231 
2232  std::string namepart = str;
2233  std::wstring wnamepart;
2234 
2235  if (!Utf8toWStr(namepart, wnamepart))
2236  return false;
2237 
2238  // converting string that we try to find to lower case
2239  wstrToLower(wnamepart);
2240 
2241  std::ostringstream reply;
2242  uint32 count = 0;
2243  uint32 maxResults = sWorld.getConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
2244  bool limitReached = false;
2245 
2246  GameTeleMap const& teleMap = sObjectMgr.GetGameTeleMap();
2247  for (GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
2248  {
2249  GameTele const* tele = &itr->second;
2250 
2251  if (tele->wnameLow.find(wnamepart) == std::wstring::npos)
2252  continue;
2253 
2254  if (maxResults && count++ == maxResults)
2255  {
2256  limitReached = true;
2257  break;
2258  }
2259 
2260  if (m_session)
2261  reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
2262  else
2263  reply << " " << itr->first << " " << tele->name << "\n";
2264  }
2265 
2266  if (reply.str().empty())
2268  else
2269  PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
2270 
2271  if (limitReached)
2273 
2274  return true;
2275 }
2276 
2277 //Enable\Dissable accept whispers (for GM)
2279 {
2280  if (!*args)
2281  {
2283  return true;
2284  }
2285 
2286  std::string argstr = (char*)args;
2287  // whisper on
2288  if (argstr == "on")
2289  {
2292  return true;
2293  }
2294 
2295  // whisper off
2296  if (argstr == "off")
2297  {
2300  return true;
2301  }
2302 
2304  SetSentErrorMessage(true);
2305  return false;
2306 }
2307 
2308 //Save all players in the world
2309 bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
2310 {
2313  return true;
2314 }
2315 
2316 //Send mail by command
2318 {
2319  if (!*args)
2320  return false;
2321 
2322  // format: name "subject text" "mail text"
2323 
2324  char* pName = strtok((char*)args, " ");
2325  if (!pName)
2326  return false;
2327 
2328  char* tail1 = strtok(NULL, "");
2329  if (!tail1)
2330  return false;
2331 
2332  char* msgSubject;
2333  if (*tail1 == '"')
2334  msgSubject = strtok(tail1 + 1, "\"");
2335  else
2336  {
2337  char* space = strtok(tail1, "\"");
2338  if (!space)
2339  return false;
2340  msgSubject = strtok(NULL, "\"");
2341  }
2342 
2343  if (!msgSubject)
2344  return false;
2345 
2346  char* tail2 = strtok(NULL, "");
2347  if (!tail2)
2348  return false;
2349 
2350  char* msgText;
2351  if (*tail2 == '"')
2352  msgText = strtok(tail2 + 1, "\"");
2353  else
2354  {
2355  char* space = strtok(tail2, "\"");
2356  if (!space)
2357  return false;
2358  msgText = strtok(NULL, "\"");
2359  }
2360 
2361  if (!msgText)
2362  return false;
2363 
2364  // pName, msgSubject, msgText isn't NUL after prev. check
2365  std::string name = pName;
2366  std::string subject = msgSubject;
2367  std::string text = msgText;
2368 
2369  if (!normalizePlayerName(name))
2370  {
2372  SetSentErrorMessage(true);
2373  return false;
2374  }
2375 
2376  uint64 receiver_guid = sObjectMgr.GetPlayerGUIDByName(name);
2377  if (!receiver_guid)
2378  {
2380  SetSentErrorMessage(true);
2381  return false;
2382  }
2383 
2384  sObjectMgr.GenerateMailID();
2385 
2386  // from console show not existed sender
2388 
2389  uint32 itemTextId = !text.empty() ? sObjectMgr.CreateItemText(text) : 0;
2390 
2391  Player* receiver = sObjectMgr.GetPlayer(receiver_guid);
2392 
2393  MailDraft(subject, itemTextId)
2394  .SendMailTo(MailReceiver(receiver, GUID_LOPART(receiver_guid)), sender);
2395 
2396  PSendSysMessage(LANG_MAIL_SENT, name.c_str());
2397  return true;
2398 }
2399 
2400 // teleport player to given game_tele.entry
2402 {
2403  if (!*args)
2404  return false;
2405 
2406  char* pName = strtok((char*)args, " ");
2407 
2408  if (!pName)
2409  return false;
2410 
2411  std::string name = pName;
2412 
2413  if (!normalizePlayerName(name))
2414  {
2416  SetSentErrorMessage(true);
2417  return false;
2418  }
2419 
2420  char* tail = strtok(NULL, "");
2421  if (!tail)
2422  return false;
2423 
2424  // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
2425  GameTele const* tele = extractGameTeleFromLink(tail);
2426  if (!tele)
2427  {
2429  SetSentErrorMessage(true);
2430  return false;
2431  }
2432 
2433  MapEntry const* me = sMapStore.LookupEntry(tele->mapId);
2434  if (!me || me->IsBattlegroundOrArena())
2435  {
2437  SetSentErrorMessage(true);
2438  return false;
2439  }
2440 
2441  Player* target = sObjectMgr.GetPlayer(name.c_str());
2442  if (target)
2443  {
2444  if (target->IsBeingTeleported())
2445  {
2447  SetSentErrorMessage(true);
2448  return false;
2449  }
2450 
2451  PSendSysMessage(LANG_TELEPORTING_TO, target->GetName(), "", tele->name.c_str());
2452  if (needReportToTarget(target))
2453  ChatHandler(target).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetName());
2454 
2455  // stop flight if need
2456  if (target->isInFlight())
2457  {
2458  target->GetMotionMaster()->MovementExpired();
2459  target->m_taxi.ClearTaxiDestinations();
2460  }
2461  // save only in non-flight case
2462  else
2463  target->SaveRecallPosition();
2464 
2465  target->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
2466  }
2467  else if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name.c_str()))
2468  {
2469  PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetOregonString(LANG_OFFLINE), tele->name.c_str());
2470  Player::SavePositionInDB(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation,
2471  MapManager::Instance().GetZoneId(tele->mapId, tele->position_x, tele->position_y, tele->position_z), guid);
2472  }
2473  else
2474  PSendSysMessage(LANG_NO_PLAYER, name.c_str());
2475 
2476  return true;
2477 }
2478 
2479 //Teleport group to given game_tele.entry
2481 {
2482  if (!*args)
2483  return false;
2484 
2485  Player* player = getSelectedPlayer();
2486  if (!player)
2487  {
2489  SetSentErrorMessage(true);
2490  return false;
2491  }
2492 
2493  // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
2494  GameTele const* tele = extractGameTeleFromLink((char*)args);
2495  if (!tele)
2496  {
2498  SetSentErrorMessage(true);
2499  return false;
2500  }
2501 
2502  MapEntry const* me = sMapStore.LookupEntry(tele->mapId);
2503  if (!me || me->IsBattlegroundOrArena())
2504  {
2506  SetSentErrorMessage(true);
2507  return false;
2508  }
2509  Group* grp = player->GetGroup();
2510  if (!grp)
2511  {
2513  SetSentErrorMessage(true);
2514  return false;
2515  }
2516 
2517  for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
2518  {
2519  Player* pl = itr->GetSource();
2520 
2521  if (!pl || !pl->GetSession())
2522  continue;
2523 
2524  if (pl->IsBeingTeleported())
2525  {
2527  continue;
2528  }
2529 
2530  PSendSysMessage(LANG_TELEPORTING_TO, pl->GetName(), "", tele->name.c_str());
2531  if (needReportToTarget(pl))
2532  ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetName());
2533 
2534  // stop flight if need
2535  if (pl->isInFlight())
2536  {
2539  }
2540  // save only in non-flight case
2541  else
2542  pl->SaveRecallPosition();
2543 
2544  pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
2545  }
2546 
2547  return true;
2548 }
2549 
2550 //Summon group of player
2552 {
2553  if (!*args)
2554  return false;
2555 
2556  std::string name = args;
2557 
2558  if (!normalizePlayerName(name))
2559  {
2561  SetSentErrorMessage(true);
2562  return false;
2563  }
2564 
2565  Player* player = sObjectMgr.GetPlayer(name.c_str());
2566  if (!player)
2567  {
2569  SetSentErrorMessage(true);
2570  return false;
2571  }
2572 
2573  Group* grp = player->GetGroup();
2574 
2575  if (!grp)
2576  {
2578  SetSentErrorMessage(true);
2579  return false;
2580  }
2581 
2582  Map* gmMap = m_session->GetPlayer()->GetMap();
2583  bool to_instance = gmMap->Instanceable();
2584 
2585  // we are in instance, and can summon only player in our group with us as lead
2586  if (to_instance && (
2587  !m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
2589  // the last check is a bit excessive, but let it be, just in case
2590  {
2592  SetSentErrorMessage(true);
2593  return false;
2594  }
2595 
2596  for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
2597  {
2598  Player* pl = itr->GetSource();
2599 
2600  if (!pl || pl == m_session->GetPlayer() || !pl->GetSession())
2601  continue;
2602 
2603  if (pl->IsBeingTeleported())
2604  {
2606  SetSentErrorMessage(true);
2607  return false;
2608  }
2609 
2610  if (to_instance)
2611  {
2612  Map* plMap = pl->GetMap();
2613 
2614  if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
2615  {
2616  // cannot summon from instance to instance
2618  SetSentErrorMessage(true);
2619  return false;
2620  }
2621  }
2622 
2624  if (needReportToTarget(pl))
2625  ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetName());
2626 
2627  // stop flight if need
2628  if (pl->isInFlight())
2629  {
2632  }
2633  // save only in non-flight case
2634  else
2635  pl->SaveRecallPosition();
2636 
2637  // before GM
2638  float x, y, z;
2639  m_session->GetPlayer()->GetClosePoint(x, y, z, pl->GetObjectSize());
2640  pl->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, pl->GetOrientation());
2641  }
2642 
2643  return true;
2644 }
2645 
2646 //teleport at coordinates
2647 bool ChatHandler::HandleGoXYCommand(const char* args)
2648 {
2649  if (!*args)
2650  return false;
2651 
2652  Player* _player = m_session->GetPlayer();
2653 
2654  char* px = strtok((char*)args, " ");
2655  char* py = strtok(NULL, " ");
2656  char* pmapid = strtok(NULL, " ");
2657 
2658  if (!px || !py)
2659  return false;
2660 
2661  float x = (float)atof(px);
2662  float y = (float)atof(py);
2663  uint32 mapid;
2664  if (pmapid)
2665  mapid = (uint32)atoi(pmapid);
2666  else mapid = _player->GetMapId();
2667 
2668  if (!MapManager::IsValidMapCoord(mapid, x, y))
2669  {
2671  SetSentErrorMessage(true);
2672  return false;
2673  }
2674 
2675  // stop flight if need
2676  if (_player->isInFlight())
2677  {
2678  _player->GetMotionMaster()->MovementExpired();
2679  _player->CleanupAfterTaxiFlight();
2680  }
2681  // save only in non-flight case
2682  else
2683  _player->SaveRecallPosition();
2684 
2685  Map const* map = MapManager::Instance().CreateBaseMap(mapid);
2686  float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
2687 
2688  _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
2689 
2690  return true;
2691 }
2692 
2693 //teleport at coordinates, including Z
2694 bool ChatHandler::HandleGoXYZCommand(const char* args)
2695 {
2696  if (!*args)
2697  return false;
2698 
2699  Player* _player = m_session->GetPlayer();
2700 
2701  char* px = strtok((char*)args, " ");
2702  char* py = strtok(NULL, " ");
2703  char* pz = strtok(NULL, " ");
2704  char* pmapid = strtok(NULL, " ");
2705 
2706  if (!px || !py || !pz)
2707  return false;
2708 
2709  float x = (float)atof(px);
2710  float y = (float)atof(py);
2711  float z = (float)atof(pz);
2712  uint32 mapid;
2713  if (pmapid)
2714  mapid = (uint32)atoi(pmapid);
2715  else
2716  mapid = _player->GetMapId();
2717 
2718  if (!MapManager::IsValidMapCoord(mapid, x, y, z))
2719  {
2721  SetSentErrorMessage(true);
2722  return false;
2723  }
2724 
2725  // stop flight if need
2726  if (_player->isInFlight())
2727  {
2728  _player->GetMotionMaster()->MovementExpired();
2729  _player->CleanupAfterTaxiFlight();
2730  }
2731  // save only in non-flight case
2732  else
2733  _player->SaveRecallPosition();
2734 
2735  _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
2736 
2737  return true;
2738 }
2739 
2740 //teleport at coordinates
2742 {
2743  if (!*args)
2744  return false;
2745 
2746  Player* _player = m_session->GetPlayer();
2747 
2748  char* px = strtok((char*)args, " ");
2749  char* py = strtok(NULL, " ");
2750  char* tail = strtok(NULL, "");
2751 
2752  char* cAreaId = extractKeyFromLink(tail, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r
2753 
2754  if (!px || !py)
2755  return false;
2756 
2757  float x = (float)atof(px);
2758  float y = (float)atof(py);
2759  uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId();
2760 
2761  AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid);
2762 
2763  if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry)
2764  {
2766  SetSentErrorMessage(true);
2767  return false;
2768  }
2769 
2770  // update to parent zone if exist (client map show only zones without parents)
2771  AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
2772 
2773  Map const* map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid);
2774 
2775  if (map->Instanceable())
2776  {
2777  PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->area_name[m_session->GetSessionDbcLocale()], map->GetId(), map->GetMapName());
2778  SetSentErrorMessage(true);
2779  return false;
2780  }
2781 
2782  Zone2MapCoordinates(x, y, zoneEntry->ID);
2783 
2784  if (!MapManager::IsValidMapCoord(zoneEntry->mapid, x, y))
2785  {
2786  PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, zoneEntry->mapid);
2787  SetSentErrorMessage(true);
2788  return false;
2789  }
2790 
2791  // stop flight if need
2792  if (_player->isInFlight())
2793  {
2794  _player->GetMotionMaster()->MovementExpired();
2795  _player->CleanupAfterTaxiFlight();
2796  }
2797  // save only in non-flight case
2798  else
2799  _player->SaveRecallPosition();
2800 
2801  float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
2802  _player->TeleportTo(zoneEntry->mapid, x, y, z, _player->GetOrientation());
2803 
2804  return true;
2805 }
2806 
2807 //teleport to grid
2808 bool ChatHandler::HandleGoGridCommand(const char* args)
2809 {
2810  if (!*args) return false;
2811  Player* _player = m_session->GetPlayer();
2812 
2813  char* px = strtok((char*)args, " ");
2814  char* py = strtok(NULL, " ");
2815  char* pmapid = strtok(NULL, " ");
2816 
2817  if (!px || !py)
2818  return false;
2819 
2820  float grid_x = (float)atof(px);
2821  float grid_y = (float)atof(py);
2822  uint32 mapid;
2823  if (pmapid)
2824  mapid = (uint32)atoi(pmapid);
2825  else mapid = _player->GetMapId();
2826 
2827  // center of grid
2828  float x = (grid_x - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS;
2829  float y = (grid_y - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS;
2830 
2831  if (!MapManager::IsValidMapCoord(mapid, x, y))
2832  {
2834  SetSentErrorMessage(true);
2835  return false;
2836  }
2837 
2838  // stop flight if need
2839  if (_player->isInFlight())
2840  {
2841  _player->GetMotionMaster()->MovementExpired();
2842  _player->CleanupAfterTaxiFlight();
2843  }
2844  // save only in non-flight case
2845  else
2846  _player->SaveRecallPosition();
2847 
2848  Map const* map = MapManager::Instance().CreateBaseMap(mapid);
2849  float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
2850  _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
2851 
2852  return true;
2853 }
2854 
2855 bool ChatHandler::HandleDrunkCommand(const char* args)
2856 {
2857  if (!*args) return false;
2858 
2859  uint32 drunklevel = (uint32)atoi(args);
2860  if (drunklevel > 100)
2861  drunklevel = 100;
2862 
2863  uint16 drunkMod = drunklevel * 0xFFFF / 100;
2864 
2865  Player* target = getSelectedPlayer();
2866  if (!target)
2867  target = m_session->GetPlayer();
2868 
2869  if (target)
2870  target->SetDrunkValue(drunkMod);
2871 
2872  return true;
2873 }
2874 
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:458
AreaTableEntry const * GetAreaEntryByAreaID(uint32 area_id)
Definition: DBCStores.cpp:623
void SendNotification(const char *format,...) ATTR_PRINTF(2
float m_recallY
Definition: Player.h:2445
bool IsBattlegroundOrArena() const
Definition: Map.h:447
std::wstring wnameLow
Definition: ObjectMgr.h:71
Group * GetGroup()
Definition: Player.h:2589
bool HandleGonameCommand(const char *args)
Definition: Level1.cpp:926
void SetSentErrorMessage(bool val)
Definition: Chat.h:590
float m_recallX
Definition: Player.h:2444
bool HandleGMTicketListCommand(const char *args)
Definition: Level1.cpp:295
bool HandleModifySpellCommand(const char *args)
Definition: Level1.cpp:1377
const uint32 & GetUInt32Value(uint16 index) const
Definition: Object.h:228
std::string PGetParseString(int32 entry,...)
Definition: Level1.cpp:284
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2014
void SendGlobalGMSysMessage(const char *str)
Definition: Chat.cpp:822
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:9194
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:1637
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:829
void Yell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Creature.h:620
bool HandleGMChatCommand(const char *args)
Definition: Level1.cpp:252
bool HandleGMmodeCommand(const char *args)
Definition: Level1.cpp:210
Unit * getSelectedUnit()
Definition: Chat.cpp:1624
uint32 getFaction() const
Definition: Unit.h:1111
bool HandleModifyFactionCommand(const char *args)
Definition: Level1.cpp:1299
bool isGMVisible() const
Definition: Player.h:1032
void SetFreeTalentPoints(uint32 points)
Definition: Player.h:1675
#define CENTER_GRID_ID
Definition: GridDefines.h:36
void SetObjectScale(float scale)
Definition: Object.h:199
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:16852
bool HandleGMTicketCloseByIdCommand(const char *args)
Definition: Level1.cpp:434
bool HandleModifySwimCommand(const char *args)
Definition: Level1.cpp:1569
MotionMaster * GetMotionMaster()
Definition: Unit.h:2001
bool HandleModifyRageCommand(const char *args)
Definition: Level1.cpp:1254
uint32 GetZoneId() const
Definition: Object.cpp:1176
bool HandleModifySpeedCommand(const char *args)
Definition: Level1.cpp:1530
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
void SetBattlegroundEntryPoint()
Definition: Player.cpp:18557
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:1590
float orientation
Definition: ObjectMgr.h:68
#define sLog
Log class singleton.
Definition: Log.h:187
float position_x
Definition: ObjectMgr.h:65
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:5755
bool HandleGPSCommand(const char *args)
Definition: Level1.cpp:721
bool HandleGMTicketDeleteByIdCommand(const char *args)
Definition: Level1.cpp:640
float m_recallZ
Definition: Player.h:2446
bool isAcceptWhispers() const
Definition: Player.h:1000
float m_recallO
Definition: Player.h:2447
bool IsDungeon() const
Definition: Map.h:427
Player * getSelectedPlayerOrSelf()
Definition: Chat.cpp:1606
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:37
bool HandleGoXYZCommand(const char *args)
Definition: Level1.cpp:2694
virtual void SendSysMessage(const char *str)
Definition: Chat.cpp:787
uint32 y_coord
Definition: GridDefines.h:142
bool HandleModifyMoneyCommand(const char *args)
Definition: Level1.cpp:1970
bool IsGameMaster() const
Definition: Player.h:1009
Player * GetPlayer() const
Definition: WorldSession.h:104
bool HandleDrunkCommand(const char *args)
Definition: Level1.cpp:2855
uint32 GetGUIDLow() const
Definition: Object.h:160
bool HandleGoXYCommand(const char *args)
Definition: Level1.cpp:2647
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:13382
DungeonDifficulty GetDifficulty()
Definition: Player.h:1884
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:294
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:593
#define sObjectMgr
Definition: ObjectMgr.h:1285
void wstrToLower(std::wstring &str)
Definition: Util.h:314
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:1449
bool HandleVisibleCommand(const char *args)
Definition: Level1.cpp:684
Player * ToPlayer()
Definition: Object.h:386
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:1122
bool IsBeingTeleported() const
Definition: Player.h:2050
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:4316
void setFaction(uint32 faction)
Definition: Unit.h:1115
uint32 GetId(void) const
Definition: Map.h:333
float position_z
Definition: ObjectMgr.h:67
uint8 GetTypeId() const
Definition: Object.h:204
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:1556
Creature * GetCreature(uint64 guid)
Definition: Map.cpp:2632
ACE_UINT8 uint8
Definition: Define.h:73
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1080
float GetOrientation() const
Definition: Position.h:100
double rand_chance(void)
Definition: Util.cpp:91
bool HandleGroupgoCommand(const char *args)
Definition: Level1.cpp:2551
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:129
uint64 timestamp
Definition: TicketMgr.h:44
const uint8 MAX_LOCALE
Definition: Common.h:224
float GetWaterLevel(float x, float y) const
Definition: Map.cpp:1796
void LeaveBattleground(bool teleportToEntryPoint=true)
Definition: Player.cpp:18607
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition: Chat.cpp:855
bool HandleModifyScaleCommand(const char *args)
Definition: Level1.cpp:1679
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data=0) const
Definition: Map.cpp:1727
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:1713
bool IsAlive() const
Definition: Unit.h:1433
float GetPositionY() const
Definition: Position.h:98
void SetDifficulty(DungeonDifficulty dungeon_difficulty)
Definition: Player.h:1880
std::string comment
Definition: TicketMgr.h:47
const char * GetMapName() const
Definition: Map.cpp:1892
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:2219
uint32 GetInstanceId() const
Definition: Object.h:682
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:1608
const uint64 & GetSelection() const
Definition: Player.h:1567
void Say(const char *text, uint32 language, uint64 TargetGuid)
Definition: Creature.h:616
PackedGuid const & GetPackGUID() const
Definition: Object.h:172
uint64 playerGuid
Definition: TicketMgr.h:36
void UpdateObjectVisibility(bool forced=true) override
Definition: Player.cpp:18873
bool HandleGMNotifyCommand(const char *args)
Definition: Level1.cpp:194
InstancePlayerBind * GetBoundInstance(uint32 mapid, uint8 difficulty)
Definition: Player.cpp:15838
uint32 GetMapId() const
Definition: Object.h:585
uint32 type_flags
Definition: Map.h:149
bool HandleGMTicketGetByNameCommand(const char *args)
Definition: Level1.cpp:396
void SetMaxHealth(uint32 val)
Definition: Unit.cpp:10859
void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0)
Definition: Player.cpp:1014
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:1181
bool HandleModifyEnergyCommand(const char *args)
Definition: Level1.cpp:1207
Definition: Map.h:266
#define sAccountMgr
Definition: AccountMgr.h:60
uint32 entry
Definition: Map.h:150
void CleanupAfterTaxiFlight()
Definition: Player.cpp:17893
GroupReference * next()
InstancePlayerBind * BindToInstance(InstanceSave *save, bool permanent, bool load=false)
Definition: Player.cpp:15879
void SetMoney(uint32 value)
Definition: Player.h:1539
#define sInstanceSaveMgr
bool HandleLookupAreaCommand(const char *args)
Definition: Level1.cpp:2143
bool HandleGoGridCommand(const char *args)
Definition: Level1.cpp:2808
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:148
void SetBattlegroundId(uint32 val)
Definition: Player.h:2253
const char * GetName() const
Definition: Object.h:692
ChatHandler()
Definition: Chat.h:90
Player * getSelectedPlayer()
Definition: Chat.cpp:1593
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 HandleNamegoCommand(const char *args)
Definition: Level1.cpp:812
bool HandleNameAnnounceCommand(const char *args)
Definition: Level1.cpp:137
uint32 GetBattlegroundId() const
Definition: Player.h:2212
void SetGMChat(bool on)
Definition: Player.h:1018
bool HandleModifyASpeedCommand(const char *args)
Definition: Level1.cpp:1487
Definition: Unit.h:461
const uint64 & GetLeaderGUID() const
Definition: Group.h:222
bool isGMChat() const
Definition: Player.h:1014
void SetGameMaster(bool on)
Definition: Player.cpp:2312
virtual const char * GetOregonString(int32 entry) const
Definition: Chat.cpp:750
#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:2359
uint32 GetMoney()
Definition: Player.h:1524
bool HandleSendMailCommand(const char *args)
Definition: Level1.cpp:2317
uint32 realmID
Id of the realm.
Definition: Main.cpp:57
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
UNORDERED_MAP< uint32, GameTele > GameTeleMap
Definition: ObjectMgr.h:74
bool HandleRecallCommand(const char *args)
Definition: Level1.cpp:1074
bool HandleTeleCommand(const char *args)
Definition: Level1.cpp:2094
bool HandleGoZoneXYCommand(const char *args)
Definition: Level1.cpp:2741
bool HandleNameTeleCommand(const char *args)
Definition: Level1.cpp:2401
bool HandleNpcWhisperCommand(const char *args)
Definition: Level1.cpp:116
void SetPower(Powers power, uint32 val)
Definition: Unit.cpp:10918
char * area_name[16]
Definition: DBCStructure.h:48
static IVMapManager * createOrGetVMapManager()
uint64 createtime
Definition: TicketMgr.h:43
void ModifyHonorPoints(int32 value)
Definition: Player.cpp:6211
void HandleEmoteCommand(uint32 anim_id)
Definition: Unit.cpp:1921
bool Instanceable() const
Definition: Map.h:422
bool HandleGroupTeleCommand(const char *args)
Definition: Level1.cpp:2480
static bool ExistMap(uint32 mapid, int gx, int gy)
Definition: Map.cpp:57
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:10951
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:9935
void SendMessageToSet(WorldPacket *data, bool self) override
Definition: Player.h:1996
void UpdateTriggerVisibility()
Definition: Player.cpp:18809
uint32 GetEntry() const
Definition: Object.h:186
bool IsOutdoors(float x, float y, float z) const
Definition: Map.cpp:1650
WorldSession * GetSession() const
Definition: Player.h:1959
#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:10826
ACE_UINT16 uint16
Definition: Define.h:72
bool isInFlight() const
Definition: Unit.h:1308
void Whisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Creature.h:628
bool HandleModifyHonorCommand(const char *args)
Definition: Level1.cpp:2072
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:299
void ModifyMoney(int32 d)
Definition: Player.h:1528
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:2309
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:158
bool HandleModifyFlyCommand(const char *args)
Definition: Level1.cpp:1647
bool HandleModifyTalentCommand(const char *args)
Definition: Level1.cpp:1427
Definition: Unit.h:884
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
Definition: Chat.cpp:1645
float GetObjectSize() const
Definition: Object.h:663
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:1875
bool HandleWhispersCommand(const char *args)
Definition: Level1.cpp:2278
void TextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Creature.h:624
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:2022
uint32 GetHonorPoints()
Definition: Player.h:2108
#define vsnprintf
Definition: Common.h:131
bool HandleModifyManaCommand(const char *args)
Definition: Level1.cpp:1163
uint32 m_recallMap
Definition: Player.h:2443
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:1870
#define atol(a)
Definition: Common.h:162
GameTele const * extractGameTeleFromLink(char *text)
Definition: Chat.cpp:1839
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:640
const uint64 & GetGUID() const
Definition: Object.h:156
DBCStorage< AreaTableEntry > sAreaStore(AreaTableEntryfmt)
bool HasAura(uint32 spellId, uint8 effIndex=0) const
Definition: Unit.h:1342
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:14356