OregonCore  revision be9e804-git
Your Favourite TBC server
QuestHandler.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 <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Common.h"
19 #include "Log.h"
20 #include "WorldPacket.h"
21 #include "WorldSession.h"
22 #include "Opcodes.h"
23 #include "World.h"
24 #include "ObjectMgr.h"
25 #include "Player.h"
26 #include "GossipDef.h"
27 #include "QuestDef.h"
28 #include "ObjectAccessor.h"
29 #include "Group.h"
30 #include "Battleground.h"
31 #include "BattlegroundAV.h"
32 #include "ScriptMgr.h"
33 #include "CreatureAI.h"
34 #include "GameObjectAI.h"
35 #include "ConditionMgr.h"
36 
38 {
39  uint64 guid;
40  recv_data >> guid;
41  uint8 questStatus = DIALOG_STATUS_NONE;
42  uint8 defstatus = DIALOG_STATUS_NONE;
43 
45  if (!questgiver)
46  {
47  sLog.outDetail("Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
48  return;
49  }
50 
51  switch (questgiver->GetTypeId())
52  {
53  case TYPEID_UNIT:
54  {
55  DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid)));
56  Creature* cr_questgiver = questgiver->ToCreature();
57  if (!cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies
58  {
59  questStatus = sScriptMgr.NPCDialogStatus(_player, cr_questgiver);
60  if (questStatus > 6)
61  questStatus = getDialogStatus(_player, cr_questgiver, defstatus);
62  }
63  break;
64  }
65  case TYPEID_GAMEOBJECT:
66  {
67  DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid)));
68  GameObject* go_questgiver = (GameObject*)questgiver;
69  questStatus = sScriptMgr.GODialogStatus(_player, go_questgiver);
70  if (questStatus > 6)
71  questStatus = getDialogStatus(_player, go_questgiver, defstatus);
72  break;
73  }
74  default:
75  sLog.outError("QuestGiver called for unexpected type %u", questgiver->GetTypeId());
76  break;
77  }
78 
79  //inform client about status of quest
80  _player->PlayerTalkClass->SendQuestGiverStatus(questStatus, guid);
81 }
82 
84 {
85  uint64 guid;
86  recv_data >> guid;
87 
88  sLog.outDebug ("WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
89 
91  if (!pCreature)
92  {
93  sLog.outDebug ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guid));
94  return;
95  }
96 
97  // remove fake death
98  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
100  // Stop the npc if moving
101  if (!pCreature->IsStopped())
102  pCreature->StopMoving();
103 
104  if (sScriptMgr.GossipHello(_player, pCreature))
105  return;
106 
107  _player->PrepareGossipMenu(pCreature, pCreature->GetCreatureTemplate()->GossipMenuId, true);
108  _player->SendPreparedGossip(pCreature);
109 
110  pCreature->AI()->sGossipHello(_player);
111 }
112 
114 {
115  uint64 guid;
116  uint32 questId;
117  recv_data >> guid >> questId;
118 
119  DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
120 
122 
123 #define CLOSE_GOSSIP_CLEAR_SHARING_INFO() \
124  do { \
125  _player->PlayerTalkClass->SendCloseGossip(); \
126  _player->ClearQuestSharingInfo(); \
127  } while (0)
128 
129  // no or incorrect quest giver
130  if (!object)
131  {
133  return;
134  }
135 
136  if (Player* playerQuestObject = object->ToPlayer())
137  {
138  if ((_player->GetPlayerSharingQuest() && _player->GetPlayerSharingQuest() != (ObjectGuid)guid) || !playerQuestObject->CanShareQuest(questId))
139  {
141  return;
142  }
143  if (!_player->IsInSameRaidWith(playerQuestObject))
144  {
146  return;
147  }
148  }
149  else
150  {
151  if (!object->hasQuest(questId))
152  {
154  return;
155  }
156  }
157 
158  // some kind of WPE protection
159  if (!_player->CanInteractWithQuestGiver(object))
160  {
162  return;
163  }
164 
165  if (Quest const* quest = sObjectMgr.GetQuestTemplate(questId))
166  {
167  // prevent cheating
168  if (!GetPlayer()->CanTakeQuest(quest, true))
169  {
171  return;
172  }
173 
175  {
177  if (player)
178  {
181  }
182  }
183 
184  if (_player->CanAddQuest(quest, true))
185  {
186  _player->AddQuestAndCheckCompletion(quest, object);
187 
188  if (quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
189  {
190  if (Group* group = _player->GetGroup())
191  {
192  for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
193  {
194  Player* player = itr->GetSource();
195 
196  if (!player || player == _player) // not self
197  continue;
198 
199  if (player->CanTakeQuest(quest, true))
200  {
201  player->SetQuestSharingInfo(_player->GetGUID(), questId);
202 
203  // need confirmation that any gossip window will close
204  player->PlayerTalkClass->SendCloseGossip();
205 
206  _player->SendQuestConfirmAccept(quest, player);
207  }
208  }
209  }
210  }
211 
213 
214  if (quest->GetSrcSpell() > 0)
215  _player->CastSpell(_player, quest->GetSrcSpell(), true);
216 
217  return;
218  }
219  }
220 
222 
223 #undef CLOSE_GOSSIP_CLEAR_SHARING_INFO
224 }
225 
227 {
228  uint64 guid;
229  uint32 quest;
230  recv_data >> guid >> quest;
231  DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
232 
233  // Verify that the guid is valid and is a questgiver or involved in the requested quest
235  if (!pObject || (!pObject->hasQuest(quest) && !pObject->hasInvolvedQuest(quest)))
236  {
238  return;
239  }
240 
241  Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest);
242  if (pQuest)
243  _player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, pObject->GetGUID(), true);
244 }
245 
247 {
248  if (!_player)
249  return;
250 
251  uint32 quest;
252  recv_data >> quest;
253  DEBUG_LOG("WORLD: Received CMSG_QUEST_QUERY quest = %u", quest);
254 
255  Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest);
256  if (pQuest)
258 }
259 
261 {
262  uint32 quest, reward;
263  uint64 guid;
264  recv_data >> guid >> quest >> reward;
265 
266  if (reward >= QUEST_REWARD_CHOICES_COUNT)
267  {
268  sLog.outError("Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName(), _player->GetGUIDLow(), reward);
269  return;
270  }
271 
272  if (!GetPlayer()->IsAlive())
273  return;
274 
275  sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), quest, reward);
276 
278  if (!pObject)
279  return;
280 
281  if (!pObject->hasInvolvedQuest(quest))
282  return;
283 
284  if (Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest))
285  {
286  if ((!_player->CanSeeStartQuest(pQuest) && _player->GetQuestStatus(quest) == QUEST_STATUS_NONE) ||
287  (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE && !pQuest->IsAutoComplete()))
288  {
289  sLog.outError("HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!",
290  _player->GetName(), _player->GetGUIDLow(), quest);
291  return;
292  }
293  if (_player->CanRewardQuest(pQuest, reward, true))
294  {
295  _player->RewardQuest(pQuest, reward, pObject);
296 
297  switch (pObject->GetTypeId())
298  {
299  case TYPEID_UNIT:
300  {
301  Creature* questgiver = pObject->ToCreature();
302  if (!(sScriptMgr.ChooseReward(_player, pObject->ToCreature(), pQuest, reward)))
303  {
304  // Send next quest
305  if (Quest const* nextquest = _player->GetNextQuest(guid, pQuest))
306  _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest, guid, true);
307 
308  questgiver->AI()->sQuestReward(_player, pQuest, reward);
309  }
310  break;
311  }
312  case TYPEID_GAMEOBJECT:
313  {
314  GameObject* questGiver = pObject->ToGameObject();
315  if (!sScriptMgr.GOChooseReward(_player, ((GameObject*)pObject), pQuest, reward))
316  {
317  // Send next quest
318  if (Quest const* nextquest = _player->GetNextQuest(guid, pQuest))
319  _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest, guid, true);
320 
321  questGiver->AI()->QuestReward(_player, pQuest, reward);
322  }
323  break;
324  }
325  default:
326  break;
327  }
328  }
329  else
330  _player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
331  }
332 }
333 
335 {
336  uint32 quest;
337  uint64 guid;
338  recv_data >> guid >> quest;
339 
340  if (!GetPlayer()->IsAlive())
341  return;
342 
343  sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
344 
346  if (!pObject || !pObject->hasInvolvedQuest(quest))
347  return;
348 
349  if (_player->CanCompleteQuest(quest))
350  _player->CompleteQuest(quest);
351 
353  return;
354 
355  if (Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest))
356  _player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
357 }
358 
360 {
361  sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_CANCEL");
362 
364 }
365 
367 {
368  uint8 slot1, slot2;
369  recv_data >> slot1 >> slot2;
370 
371  if (slot1 == slot2 || slot1 >= MAX_QUEST_LOG_SIZE || slot2 >= MAX_QUEST_LOG_SIZE)
372  return;
373 
374  sLog.outDebug("WORLD: Received CMSG_QUESTLOG_SWAP_QUEST slot 1 = %u, slot 2 = %u", slot1, slot2);
375 
376  GetPlayer()->SwapQuestSlot(slot1, slot2);
377 }
378 
380 {
381  uint8 slot;
382  recv_data >> slot;
383 
384  sLog.outDebug("WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u", slot);
385 
386  if (slot < MAX_QUEST_LOG_SIZE)
387  {
388  if (uint32 quest = _player->GetQuestSlotQuestId(slot))
389  {
390  if (!_player->TakeQuestSourceItem(quest, true))
391  return; // can't un-equip some items, reject quest cancel
392 
393  if (const Quest* pQuest = sObjectMgr.GetQuestTemplate(quest))
394  {
395  if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
396  _player->RemoveTimedQuest(quest);
397  }
398 
399  _player->AbandonQuest(quest);
401  }
402 
403  _player->SetQuestSlot(slot, 0);
404  }
405 }
406 
408 {
409  uint32 questId;
410  recv_data >> questId;
411 
412  sLog.outDebug("WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", questId);
413 
414  if (Quest const* quest = sObjectMgr.GetQuestTemplate(questId))
415  {
416  if (!quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
417  return;
418 
420  if (!originalPlayer)
421  return;
422 
423  if (!_player->IsInSameRaidWith(originalPlayer))
424  return;
425 
426  if (!_player->CanTakeQuest(quest, true))
427  return;
428 
429  if (_player->CanAddQuest(quest, true))
430  _player->AddQuest(quest, NULL); // NULL, this prevent DB script from duplicate running
431 
433  }
434 }
435 
437 {
438  uint32 quest;
439  uint64 guid;
440  recv_data >> guid >> quest;
441 
442  if (!_player->IsAlive())
443  return;
444 
445  sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
446 
447  if (Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest))
448  {
450  {
451  sLog.outError("Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
452  _player->GetName(), _player->GetGUIDLow(), quest);
453  return;
454  }
455  // @todo need a virtual function
456  if (_player->InBattleground())
457  if (Battleground* bg = _player->GetBattleground())
458  if (bg->GetTypeID() == BATTLEGROUND_AV)
460 
462  {
463  if (pQuest->IsRepeatable())
465  else
466  _player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest, false), false);
467  }
468  else
469  _player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest, false), false);
470  }
471 }
472 
474 {
475  sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH");
476 }
477 
479 {
480  uint32 questId;
481  recvPacket >> questId;
482 
483  sLog.outDebug("WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId);
484 
485  if (Quest const* pQuest = sObjectMgr.GetQuestTemplate(questId))
486  {
487  if (Group* pGroup = _player->GetGroup())
488  {
489  for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
490  {
491  Player* pPlayer = itr->GetSource();
492 
493  if (!pPlayer || pPlayer == _player) // skip self
494  continue;
495 
497 
498  // 2.4.3: can only share quests within 10 yards
499  if (_player->GetDistance(pPlayer) > 10)
500  {
502  continue;
503  }
504 
505  //player already has quest
506  if (!pPlayer->SatisfyQuestStatus(pQuest, false))
507  {
509  continue;
510  }
511 
512  //player already completed quest
513  if (pPlayer->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE)
514  {
516  continue;
517  }
518 
519  //player is ineligible for the quest
520  if (!pPlayer->CanTakeQuest(pQuest, false))
521  {
523  continue;
524  }
525 
526  //player has full quest log
527  if (!pPlayer->SatisfyQuestLog(false))
528  {
530  continue;
531  }
532 
533  if (pPlayer->GetPlayerSharingQuest())
534  {
536  continue;
537  }
538 
539  pPlayer->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true);
540  pPlayer->SetQuestSharingInfo(_player->GetGUID(), questId);
541  }
542  }
543  }
544 }
545 
547 {
548  uint64 guid;
549  uint8 msg;
550  recvPacket >> guid >> msg;
551 
552  sLog.outDebug("WORLD: Received MSG_QUEST_PUSH_RESULT");
553 
555  {
557  if (pPlayer)
558  {
559  WorldPacket data(MSG_QUEST_PUSH_RESULT, (8 + 1));
560  data << uint64(guid);
561  data << uint8(msg); // valid values: 0-8
562  pPlayer->GetSession()->SendPacket(&data);
564  }
565  }
566 }
567 
568 uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus)
569 {
570  uint32 result = defstatus;
571 
572  QuestRelations const* qir;
573  QuestRelations const* qr;
574 
575  switch (questgiver->GetTypeId())
576  {
577  case TYPEID_GAMEOBJECT:
578  {
579  qir = &sObjectMgr.mGOQuestInvolvedRelations;
580  qr = &sObjectMgr.mGOQuestRelations;
581  break;
582  }
583  case TYPEID_UNIT:
584  {
585  qir = &sObjectMgr.mCreatureQuestInvolvedRelations;
586  qr = &sObjectMgr.mCreatureQuestRelations;
587  break;
588  }
589  default:
590  //its imposible, but check ^)
591  sLog.outError("Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId());
592  return DIALOG_STATUS_NONE;
593  }
594 
595  for (QuestRelations::const_iterator i = qir->lower_bound(questgiver->GetEntry()); i != qir->upper_bound(questgiver->GetEntry()); ++i)
596  {
597  uint32 result2 = 0;
598  uint32 quest_id = i->second;
599  Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
600  if (!pQuest) continue;
601 
602  ConditionList conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
603  if (!sConditionMgr.IsObjectMeetToConditions(pPlayer, conditions))
604  continue;
605 
606  QuestStatus status = pPlayer->GetQuestStatus(quest_id);
607  if ((status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) ||
608  (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)))
609  {
610  if (pQuest->IsAutoComplete() && pQuest->IsRepeatable())
611  result2 = DIALOG_STATUS_REWARD_REP;
612  else
613  result2 = DIALOG_STATUS_REWARD;
614  }
615  else if (status == QUEST_STATUS_INCOMPLETE)
616  result2 = DIALOG_STATUS_INCOMPLETE;
617 
618  if (result2 > result)
619  result = result2;
620  }
621 
622  for (QuestRelations::const_iterator i = qr->lower_bound(questgiver->GetEntry()); i != qr->upper_bound(questgiver->GetEntry()); ++i)
623  {
624  uint32 result2 = 0;
625  uint32 quest_id = i->second;
626  Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
627  if (!pQuest)
628  continue;
629 
630  ConditionList conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
631  if (!sConditionMgr.IsObjectMeetToConditions(pPlayer, conditions))
632  continue;
633 
634  QuestStatus status = pPlayer->GetQuestStatus(quest_id);
635  if (status == QUEST_STATUS_NONE)
636  {
637  if (pPlayer->CanSeeStartQuest(pQuest))
638  {
639  if (pPlayer->SatisfyQuestLevel(pQuest, false))
640  {
641  auto questStatusItr = pPlayer->getQuestStatusMap().find(quest_id);
642  bool rewarded = (questStatusItr != pPlayer->getQuestStatusMap().end()) ? questStatusItr->second.m_rewarded : false;
643 
644  if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && rewarded))
645  {
646  result2 = DIALOG_STATUS_REWARD_REP;
647  }
648  else if (pPlayer->getLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + sWorld.getConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))
649  {
650  if (pQuest->HasFlag(QUEST_FLAGS_DAILY))
651  result2 = DIALOG_STATUS_AVAILABLE_REP;
652  else
653  result2 = DIALOG_STATUS_AVAILABLE;
654  }
655  else
656  result2 = DIALOG_STATUS_CHAT;
657  }
658  else
659  result2 = DIALOG_STATUS_UNAVAILABLE;
660  }
661  }
662 
663  if (result2 > result)
664  result = result2;
665  }
666 
667  return result;
668 }
669 
671 {
672  DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY");
673 
674  uint32 count = 0;
675 
677  data << uint32(count); // placeholder
678 
679  for (Player::ClientGUIDs::iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
680  {
681  uint8 questStatus = DIALOG_STATUS_NONE;
682  uint8 defstatus = DIALOG_STATUS_NONE;
683 
684  if (IS_CREATURE_GUID(*itr))
685  {
686  Creature* questgiver = GetPlayer()->GetMap()->GetCreature(*itr);
687  if (!questgiver || questgiver->IsHostileTo(_player))
688  continue;
690  continue;
691  questStatus = sScriptMgr.NPCDialogStatus(_player, questgiver);
692  if (questStatus > 6)
693  questStatus = getDialogStatus(_player, questgiver, defstatus);
694 
695  data << uint64(questgiver->GetGUID());
696  data << uint8(questStatus);
697  ++count;
698  }
699  else if (IS_GAMEOBJECT_GUID(*itr))
700  {
701  GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr);
702  if (!questgiver)
703  continue;
704  if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
705  continue;
706  questStatus = sScriptMgr.GODialogStatus(_player, questgiver);
707  if (questStatus > 6)
708  questStatus = getDialogStatus(_player, questgiver, defstatus);
709 
710  data << uint64(questgiver->GetGUID());
711  data << uint8(questStatus);
712  ++count;
713  }
714  }
715 
716  data.put<uint32>(0, count); // write real count
717  SendPacket(&data);
718 }
719 
Definition: Object.h:145
virtual void sQuestReward(Player *, Quest const *, uint32)
Definition: UnitAI.h:117
void HandleQuestgiverQuestQueryOpcode(WorldPacket &recvPacket)
bool SatisfyQuestLog(bool msg)
Definition: Player.cpp:13230
bool IsAutoComplete() const
Definition: QuestDef.h:370
ClientGUIDs m_clientGUIDs
Definition: Player.h:2459
Group * GetGroup()
Definition: Player.h:2577
void ClearQuestSharingInfo()
Definition: Player.h:1453
GameObjectAI * AI() const
Definition: GameObject.h:857
bool CanRewardQuest(Quest const *pQuest, bool msg)
Definition: Player.cpp:12845
#define CLOSE_GOSSIP_CLEAR_SHARING_INFO()
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: Player.cpp:13635
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
Battleground * GetBattleground() const
Definition: Player.cpp:19415
PlayerMenu * PlayerTalkClass
Definition: Player.h:2182
Map * GetMap() const
Definition: Object.h:817
#define MAX_QUEST_LOG_SIZE
Definition: QuestDef.h:31
void SetQuestSharingInfo(ObjectGuid guid, uint32 id)
Definition: Player.h:1452
static Object * GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask)
bool CanCompleteQuest(uint32 quest_id)
Definition: Player.cpp:12705
void SendQuestConfirmAccept(Quest const *pQuest, Player *pReceiver)
Definition: Player.cpp:14201
void HandleQuestgiverStatusQueryOpcode(WorldPacket &recvPacket)
void RewardQuest(Quest const *pQuest, uint32 reward, Object *questGiver, bool announce=true)
Definition: Player.cpp:13039
uint32 getDialogStatus(Player *pPlayer, Object *questgiver, uint32 defstatus)
std::list< Condition * > ConditionList
Definition: ConditionMgr.h:223
void HandleQuestgiverAcceptQuestOpcode(WorldPacket &recvPacket)
void RemoveSpellsCausingAura(AuraType auraType)
Definition: Unit.cpp:732
bool CanSeeStartQuest(Quest const *pQuest)
Definition: Player.cpp:12657
bool CanInteractWithQuestGiver(Object *questGiver)
Definition: Player.cpp:2101
QuestStatus
Definition: QuestDef.h:89
void RemoveTimedQuest(uint32 questId)
Definition: Player.h:1459
#define sLog
Log class singleton.
Definition: Log.h:187
void AbandonQuest(uint32 questId)
Definition: Player.cpp:13023
void AddQuestAndCheckCompletion(Quest const *quest, Object *questGiver)
Definition: Player.cpp:12796
Quest const * GetNextQuest(uint64 guid, Quest const *pQuest)
Definition: Player.cpp:12620
void HandleQuestgiverRequestRewardOpcode(WorldPacket &recvPacket)
void HandleQuestConfirmAccept(WorldPacket &recv_data)
bool SatisfyQuestStatus(Quest const *qInfo, bool msg)
Definition: Player.cpp:13403
void HandleQuestPushResult(WorldPacket &recvPacket)
#define GUID_HIPART(x)
Definition: ObjectGuid.h:82
Player * GetPlayer() const
Definition: WorldSession.h:104
uint32 GetGUIDLow() const
Definition: Object.h:178
#define sObjectMgr
Definition: ObjectMgr.h:1317
void SendPacket(WorldPacket const *packet)
GameObject * ToGameObject()
Definition: Object.h:377
void HandleQuestComplete(WorldPacket &recv_data)
Player * ToPlayer()
Definition: Object.h:368
uint8 getLevel() const
Definition: Unit.h:1057
uint64 GetGUID() const
Definition: Object.h:177
void SendQuestGiverQuestDetails(Quest const *quest, uint64 npcGUID, bool activateAccept) const
Definition: GossipDef.cpp:316
void PrepareGossipMenu(WorldObject *source, uint32 menuId=0, bool showQuests=false)
Definition: Player.cpp:12111
uint8 GetTypeId() const
Definition: Object.h:192
bool IsRepeatable() const
Definition: QuestDef.h:368
Creature * GetCreature(uint64 guid)
Definition: Map.cpp:2630
ACE_UINT8 uint8
Definition: Define.h:73
uint32 GetQuestSlotQuestId(uint16 slot) const
Definition: Player.h:1370
uint32 GetQuestLevelForPlayer(Quest const *pQuest) const
Definition: Player.h:1322
std::multimap< uint32, uint32 > QuestRelations
Definition: ObjectMgr.h:391
virtual bool QuestReward(Player *, Quest const *, uint32)
Definition: GameObjectAI.h:48
uint32 GuidHigh2TypeId(uint32 guid_hi)
Definition: Object.cpp:43
#define IS_CREATURE_GUID(Guid)
Definition: ObjectGuid.h:66
bool IsStopped() const
Definition: Unit.h:1898
void SendQuestGiverRequestItems(Quest const *quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const
Definition: GossipDef.cpp:603
void SendPreparedGossip(WorldObject *source)
Definition: Player.cpp:12264
uint32 GossipMenuId
Definition: Creature.h:141
uint32 GetQuestId() const
Definition: QuestDef.h:186
void HandleQuestgiverCancel(WorldPacket &recv_data)
bool IsAlive() const
Definition: Unit.h:1336
float GetDistance(const WorldObject *obj) const
Definition: Object.h:694
void HandleQuestgiverHelloOpcode(WorldPacket &recvPacket)
void put(size_t pos, T value)
Definition: ByteBuffer.h:79
void AddQuest(Quest const *pQuest, Object *questGiver)
Definition: Player.cpp:12932
void CastSpell(Unit *Victim, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
Definition: Unit.cpp:1260
CreatureAI * AI() const
Definition: Creature.h:525
bool TakeQuestSourceItem(uint32 quest_id, bool msg)
Definition: Player.cpp:13591
static Player * FindPlayer(uint64, bool force=false)
void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const
Definition: GossipDef.cpp:306
#define DEBUG_LOG(...)
Definition: Log.h:194
void SendCloseGossip() const
Definition: GossipDef.cpp:174
#define sConditionMgr
Definition: ConditionMgr.h:312
void HandleQuestLogSwapQuest(WorldPacket &recv_data)
bool SatisfyQuestLevel(Quest const *qInfo, bool msg)
Definition: Player.cpp:13219
#define IS_GAMEOBJECT_GUID(Guid)
Definition: ObjectGuid.h:73
GroupReference * next()
ObjectGuid GetPlayerSharingQuest() const
Definition: Player.h:1451
bool CanAddQuest(Quest const *pQuest, bool msg)
Definition: Player.cpp:12681
const char * GetName() const
Definition: Object.h:680
ACE_UINT64 uint64
Definition: Define.h:70
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1805
void HandleQuestLogRemoveQuest(WorldPacket &recv_data)
bool CanTakeQuest(Quest const *pQuest, bool msg)
Definition: Player.cpp:12669
void HandleQuestAutoLaunch(WorldPacket &recvPacket)
void SendPushToPartyResponse(Player *pPlayer, uint32 msg)
Definition: Player.cpp:14228
bool InBattleground() const
Definition: Player.h:2195
void SwapQuestSlot(uint16 slot1, uint16 slot2)
Definition: Player.h:1413
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:565
GameobjectTypes GetGoType() const
Definition: GameObject.h:737
void HandleQuestQueryOpcode(WorldPacket &recvPacket)
Player * _player
Definition: WorldSession.h:731
void HandleQuestgiverChooseRewardOpcode(WorldPacket &recvPacket)
#define QUEST_REWARD_CHOICES_COUNT
Definition: QuestDef.h:35
Creature * ToCreature()
Definition: Object.h:371
bool HasFlag(uint32 flag) const
Definition: QuestDef.h:179
void HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket &recvPacket)
void SendQuestGiverOfferReward(Quest const *quest, uint64 npcGUID, bool enableNext) const
Definition: GossipDef.cpp:525
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7369
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2119
void CompleteQuest(uint32 quest_id)
Definition: Player.cpp:12995
void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer=0)
Definition: Player.h:1390
#define sScriptMgr
Definition: Group.h:526
uint32 GetEntry() const
Definition: Object.h:186
WorldSession * GetSession() const
Definition: Player.h:1947
#define sWorld
Definition: World.h:860
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:281
ACE_UINT32 uint32
Definition: Define.h:71
GameObject * GetGameObject(uint64 guid)
Definition: Map.cpp:2636
virtual bool hasQuest(uint32) const
Definition: Object.h:354
void StopMoving()
Definition: Unit.cpp:11952
Definition: Player.h:923
void SendQuestQueryResponse(Quest const *quest) const
Definition: GossipDef.cpp:410
virtual bool hasInvolvedQuest(uint32) const
Definition: Object.h:358
QuestStatusMap & getQuestStatusMap()
Definition: Player.h:1550
bool GetQuestRewardStatus(uint32 quest_id) const
Definition: Player.cpp:13619
bool IsEmpty() const
Definition: ObjectGuid.h:173
void HandleQuestPushToParty(WorldPacket &recvPacket)
Definition: Group.h:154
bool CanCompleteRepeatableQuest(Quest const *pQuest)
Definition: Player.cpp:12777
virtual void sGossipHello(Player *)
Definition: UnitAI.h:112
void SetQuestStatus(uint32 quest_id, QuestStatus status)
Definition: Player.cpp:13667