OregonCore  revision fb2a440-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 <http://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);
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 
400  }
401 
402  _player->SetQuestSlot(slot, 0);
403  }
404 }
405 
407 {
408  uint32 questId;
409  recv_data >> questId;
410 
411  sLog.outDebug("WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", questId);
412 
413  if (Quest const* quest = sObjectMgr.GetQuestTemplate(questId))
414  {
415  if (!quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
416  return;
417 
419  if (!originalPlayer)
420  return;
421 
422  if (!_player->IsInSameRaidWith(originalPlayer))
423  return;
424 
425  if (!_player->CanTakeQuest(quest, true))
426  return;
427 
428  if (_player->CanAddQuest(quest, true))
429  _player->AddQuest(quest, NULL); // NULL, this prevent DB script from duplicate running
430 
432  }
433 }
434 
436 {
437  uint32 quest;
438  uint64 guid;
439  recv_data >> guid >> quest;
440 
441  if (!_player->IsAlive())
442  return;
443 
444  sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
445 
446  if (Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest))
447  {
449  {
450  sLog.outError("Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
451  _player->GetName(), _player->GetGUIDLow(), quest);
452  return;
453  }
454  // @todo need a virtual function
455  if (_player->InBattleground())
456  if (Battleground* bg = _player->GetBattleground())
457  if (bg->GetTypeID() == BATTLEGROUND_AV)
459 
461  {
462  if (pQuest->IsRepeatable())
464  else
465  _player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest, false), false);
466  }
467  else
468  _player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest, false), false);
469  }
470 }
471 
473 {
474  sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH");
475 }
476 
478 {
479  uint32 questId;
480  recvPacket >> questId;
481 
482  sLog.outDebug("WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId);
483 
484  if (Quest const* pQuest = sObjectMgr.GetQuestTemplate(questId))
485  {
486  if (Group* pGroup = _player->GetGroup())
487  {
488  for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
489  {
490  Player* pPlayer = itr->GetSource();
491 
492  if (!pPlayer || pPlayer == _player) // skip self
493  continue;
494 
496 
497  // 2.4.3: can only share quests within 10 yards
498  if (_player->GetDistance(pPlayer) > 10)
499  {
501  continue;
502  }
503 
504  //player already has quest
505  if (!pPlayer->SatisfyQuestStatus(pQuest, false))
506  {
508  continue;
509  }
510 
511  //player already completed quest
512  if (pPlayer->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE)
513  {
515  continue;
516  }
517 
518  //player is ineligible for the quest
519  if (!pPlayer->CanTakeQuest(pQuest, false))
520  {
522  continue;
523  }
524 
525  //player has full quest log
526  if (!pPlayer->SatisfyQuestLog(false))
527  {
529  continue;
530  }
531 
532  if (pPlayer->GetPlayerSharingQuest())
533  {
535  continue;
536  }
537 
538  pPlayer->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true);
539  pPlayer->SetQuestSharingInfo(_player->GetGUID(), questId);
540  }
541  }
542  }
543 }
544 
546 {
547  uint64 guid;
548  uint8 msg;
549  recvPacket >> guid >> msg;
550 
551  sLog.outDebug("WORLD: Received MSG_QUEST_PUSH_RESULT");
552 
554  {
556  if (pPlayer)
557  {
558  WorldPacket data(MSG_QUEST_PUSH_RESULT, (8 + 1));
559  data << uint64(guid);
560  data << uint8(msg); // valid values: 0-8
561  pPlayer->GetSession()->SendPacket(&data);
563  }
564  }
565 }
566 
567 uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus)
568 {
569  uint32 result = defstatus;
570 
571  QuestRelations const* qir;
572  QuestRelations const* qr;
573 
574  switch (questgiver->GetTypeId())
575  {
576  case TYPEID_GAMEOBJECT:
577  {
578  qir = &sObjectMgr.mGOQuestInvolvedRelations;
579  qr = &sObjectMgr.mGOQuestRelations;
580  break;
581  }
582  case TYPEID_UNIT:
583  {
584  qir = &sObjectMgr.mCreatureQuestInvolvedRelations;
585  qr = &sObjectMgr.mCreatureQuestRelations;
586  break;
587  }
588  default:
589  //its imposible, but check ^)
590  sLog.outError("Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId());
591  return DIALOG_STATUS_NONE;
592  }
593 
594  for (QuestRelations::const_iterator i = qir->lower_bound(questgiver->GetEntry()); i != qir->upper_bound(questgiver->GetEntry()); ++i)
595  {
596  uint32 result2 = 0;
597  uint32 quest_id = i->second;
598  Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
599  if (!pQuest) continue;
600 
601  ConditionList conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
602  if (!sConditionMgr.IsObjectMeetToConditions(pPlayer, conditions))
603  continue;
604 
605  QuestStatus status = pPlayer->GetQuestStatus(quest_id);
606  if ((status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) ||
607  (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)))
608  {
609  if (pQuest->IsAutoComplete() && pQuest->IsRepeatable())
610  result2 = DIALOG_STATUS_REWARD_REP;
611  else
612  result2 = DIALOG_STATUS_REWARD;
613  }
614  else if (status == QUEST_STATUS_INCOMPLETE)
615  result2 = DIALOG_STATUS_INCOMPLETE;
616 
617  if (result2 > result)
618  result = result2;
619  }
620 
621  for (QuestRelations::const_iterator i = qr->lower_bound(questgiver->GetEntry()); i != qr->upper_bound(questgiver->GetEntry()); ++i)
622  {
623  uint32 result2 = 0;
624  uint32 quest_id = i->second;
625  Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
626  if (!pQuest)
627  continue;
628 
629  ConditionList conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
630  if (!sConditionMgr.IsObjectMeetToConditions(pPlayer, conditions))
631  continue;
632 
633  QuestStatus status = pPlayer->GetQuestStatus(quest_id);
634  if (status == QUEST_STATUS_NONE)
635  {
636  if (pPlayer->CanSeeStartQuest(pQuest))
637  {
638  if (pPlayer->SatisfyQuestLevel(pQuest, false))
639  {
640  auto questStatusItr = pPlayer->getQuestStatusMap().find(quest_id);
641  bool rewarded = (questStatusItr != pPlayer->getQuestStatusMap().end()) ? questStatusItr->second.m_rewarded : false;
642 
643  if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && rewarded))
644  {
645  result2 = DIALOG_STATUS_REWARD_REP;
646  }
647  else if (pPlayer->getLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + sWorld.getConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))
648  {
649  if (pQuest->HasFlag(QUEST_FLAGS_DAILY))
650  result2 = DIALOG_STATUS_AVAILABLE_REP;
651  else
652  result2 = DIALOG_STATUS_AVAILABLE;
653  }
654  else
655  result2 = DIALOG_STATUS_CHAT;
656  }
657  else
658  result2 = DIALOG_STATUS_UNAVAILABLE;
659  }
660  }
661 
662  if (result2 > result)
663  result = result2;
664  }
665 
666  return result;
667 }
668 
670 {
671  DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY");
672 
673  uint32 count = 0;
674 
676  data << uint32(count); // placeholder
677 
678  for (Player::ClientGUIDs::iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
679  {
680  uint8 questStatus = DIALOG_STATUS_NONE;
681  uint8 defstatus = DIALOG_STATUS_NONE;
682 
683  if (IS_CREATURE_GUID(*itr))
684  {
685  Creature* questgiver = GetPlayer()->GetMap()->GetCreature(*itr);
686  if (!questgiver || questgiver->IsHostileTo(_player))
687  continue;
689  continue;
690  questStatus = sScriptMgr.NPCDialogStatus(_player, questgiver);
691  if (questStatus > 6)
692  questStatus = getDialogStatus(_player, questgiver, defstatus);
693 
694  data << uint64(questgiver->GetGUID());
695  data << uint8(questStatus);
696  ++count;
697  }
698  else if (IS_GAMEOBJECT_GUID(*itr))
699  {
700  GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr);
701  if (!questgiver)
702  continue;
703  if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
704  continue;
705  questStatus = sScriptMgr.GODialogStatus(_player, questgiver);
706  if (questStatus > 6)
707  questStatus = getDialogStatus(_player, questgiver, defstatus);
708 
709  data << uint64(questgiver->GetGUID());
710  data << uint8(questStatus);
711  ++count;
712  }
713  }
714 
715  data.put<uint32>(0, count); // write real count
716  SendPacket(&data);
717 }
718 
Definition: Object.h:130
virtual void sQuestReward(Player *, Quest const *, uint32)
Definition: UnitAI.h:117
void HandleQuestgiverQuestQueryOpcode(WorldPacket &recvPacket)
bool SatisfyQuestLog(bool msg)
Definition: Player.cpp:13229
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:1450
GameObjectAI * AI() const
Definition: GameObject.h:840
bool CanRewardQuest(Quest const *pQuest, bool msg)
Definition: Player.cpp:12860
#define CLOSE_GOSSIP_CLEAR_SHARING_INFO()
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: Player.cpp:13634
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
void SendQuestQueryResponse(Quest const *pQuest)
Definition: GossipDef.cpp:500
Battleground * GetBattleground() const
Definition: Player.cpp:19413
PlayerMenu * PlayerTalkClass
Definition: Player.h:2182
Map * GetMap() const
Definition: Object.h:841
#define MAX_QUEST_LOG_SIZE
Definition: QuestDef.h:31
void SetQuestSharingInfo(ObjectGuid guid, uint32 id)
Definition: Player.h:1449
static Object * GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask)
bool CanCompleteQuest(uint32 quest_id)
Definition: Player.cpp:12720
void SendQuestConfirmAccept(Quest const *pQuest, Player *pReceiver)
Definition: Player.cpp:14200
void HandleQuestgiverStatusQueryOpcode(WorldPacket &recvPacket)
void RewardQuest(Quest const *pQuest, uint32 reward, Object *questGiver, bool announce=true)
Definition: Player.cpp:13038
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:697
bool CanSeeStartQuest(Quest const *pQuest)
Definition: Player.cpp:12672
bool CanInteractWithQuestGiver(Object *questGiver)
Definition: Player.cpp:2112
QuestStatus
Definition: QuestDef.h:89
void RemoveTimedQuest(uint32 questId)
Definition: Player.h:1456
#define sLog
Log class singleton.
Definition: Log.h:187
void SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID, bool ActivateAccept)
Definition: GossipDef.cpp:401
void AddQuestAndCheckCompletion(Quest const *quest, Object *questGiver)
Definition: Player.cpp:12811
Quest const * GetNextQuest(uint64 guid, Quest const *pQuest)
Definition: Player.cpp:12635
void HandleQuestgiverRequestRewardOpcode(WorldPacket &recvPacket)
void HandleQuestConfirmAccept(WorldPacket &recv_data)
bool SatisfyQuestStatus(Quest const *qInfo, bool msg)
Definition: Player.cpp:13402
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:166
#define sObjectMgr
Definition: ObjectMgr.h:1285
void SendPacket(WorldPacket const *packet)
GameObject * ToGameObject()
Definition: Object.h:401
void HandleQuestComplete(WorldPacket &recv_data)
Player * ToPlayer()
Definition: Object.h:392
void PrepareGossipMenu(WorldObject *pSource, uint32 menuId=0)
Definition: Player.cpp:12118
uint8 getLevel() const
Definition: Unit.h:1057
uint8 GetTypeId() const
Definition: Object.h:210
bool IsRepeatable() const
Definition: QuestDef.h:368
void SendPreparedGossip(WorldObject *pSource)
Definition: Player.cpp:12276
Creature * GetCreature(uint64 guid)
Definition: Map.cpp:2630
ACE_UINT8 uint8
Definition: Define.h:73
uint32 GetQuestSlotQuestId(uint16 slot) const
Definition: Player.h:1367
uint32 GetQuestLevelForPlayer(Quest const *pQuest) const
Definition: Player.h:1320
std::multimap< uint32, uint32 > QuestRelations
Definition: ObjectMgr.h:390
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:1895
void SendCloseGossip()
Definition: GossipDef.cpp:187
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:718
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:12947
void CastSpell(Unit *Victim, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
Definition: Unit.cpp:1223
CreatureAI * AI() const
Definition: Creature.h:517
void SendQuestGiverOfferReward(Quest const *pQuest, uint64 npcGUID, bool EnbleNext)
Definition: GossipDef.cpp:618
bool TakeQuestSourceItem(uint32 quest_id, bool msg)
Definition: Player.cpp:13590
static Player * FindPlayer(uint64, bool force=false)
void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID)
Definition: GossipDef.cpp:391
#define DEBUG_LOG(...)
Definition: Log.h:194
#define sConditionMgr
Definition: ConditionMgr.h:312
void HandleQuestLogSwapQuest(WorldPacket &recv_data)
bool SatisfyQuestLevel(Quest const *qInfo, bool msg)
Definition: Player.cpp:13218
void SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel)
Definition: GossipDef.cpp:701
#define IS_GAMEOBJECT_GUID(Guid)
Definition: ObjectGuid.h:73
GroupReference * next()
ObjectGuid GetPlayerSharingQuest() const
Definition: Player.h:1448
bool CanAddQuest(Quest const *pQuest, bool msg)
Definition: Player.cpp:12696
const char * GetName() const
Definition: Object.h:704
ACE_UINT64 uint64
Definition: Define.h:70
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1802
void HandleQuestLogRemoveQuest(WorldPacket &recv_data)
bool CanTakeQuest(Quest const *pQuest, bool msg)
Definition: Player.cpp:12684
void HandleQuestAutoLaunch(WorldPacket &recvPacket)
void SendPushToPartyResponse(Player *pPlayer, uint32 msg)
Definition: Player.cpp:14227
bool InBattleground() const
Definition: Player.h:2195
void SwapQuestSlot(uint16 slot1, uint16 slot2)
Definition: Player.h:1410
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
GameobjectTypes GetGoType() const
Definition: GameObject.h:720
void HandleQuestQueryOpcode(WorldPacket &recvPacket)
Player * _player
Definition: WorldSession.h:730
void HandleQuestgiverChooseRewardOpcode(WorldPacket &recvPacket)
#define QUEST_REWARD_CHOICES_COUNT
Definition: QuestDef.h:35
Creature * ToCreature()
Definition: Object.h:395
bool HasFlag(uint32 flag) const
Definition: QuestDef.h:179
void HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket &recvPacket)
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7334
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2130
void CompleteQuest(uint32 quest_id)
Definition: Player.cpp:13010
void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer=0)
Definition: Player.h:1387
#define sScriptMgr
Definition: Group.h:526
uint32 GetEntry() const
Definition: Object.h:192
WorldSession * GetSession() const
Definition: Player.h:1944
#define sWorld
Definition: World.h:860
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:305
ACE_UINT32 uint32
Definition: Define.h:71
GameObject * GetGameObject(uint64 guid)
Definition: Map.cpp:2636
virtual bool hasQuest(uint32) const
Definition: Object.h:378
void StopMoving()
Definition: Unit.cpp:11917
Definition: Player.h:922
virtual bool hasInvolvedQuest(uint32) const
Definition: Object.h:382
QuestStatusMap & getQuestStatusMap()
Definition: Player.h:1547
bool GetQuestRewardStatus(uint32 quest_id) const
Definition: Player.cpp:13618
bool IsEmpty() const
Definition: ObjectGuid.h:173
void HandleQuestPushToParty(WorldPacket &recvPacket)
Definition: Group.h:154
const uint64 & GetGUID() const
Definition: Object.h:162
bool CanCompleteRepeatableQuest(Quest const *pQuest)
Definition: Player.cpp:12792
virtual void sGossipHello(Player *)
Definition: UnitAI.h:112
void SetQuestStatus(uint32 quest_id, QuestStatus status)
Definition: Player.cpp:13666