Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. // 130216 - Magni Bronzebeard
  2. enum MagniBronzebeard
  3. {
  4. CONVERSATION_A_THE_SPEAKERS_PERSPECTIVE = 6617,
  5. KILLMONSTERCREDIT_A_THE_SPEAKERS_PERSPECTIVE = 130216,
  6. QUEST_H_THE_SPEAKERS_PERSPECTIVE = 50055,
  7. QUEST_A_THE_SPEAKERS_PERSPECTIVE = 50049,
  8. QUEST_A_DYING_WORLD_A = 50364,
  9. QUEST_A_DYING_WORLD_H = 53028
  10. };
  11.  
  12. struct npc_magni_bronzebeard_silithus : public ScriptedAI
  13. {
  14. npc_magni_bronzebeard_silithus(Creature* creature) : ScriptedAI(creature) { }
  15.  
  16. void Initialize()
  17. {
  18. m_playerGUID = ObjectGuid::Empty;
  19. }
  20.  
  21. void AddPlayer()
  22. {
  23. if (!HasPlayer(m_playerGUID))
  24. pList.insert(m_playerGUID);
  25. }
  26.  
  27. bool HasPlayer(ObjectGuid guid)
  28. {
  29. return (pList.find(guid) != pList.end());
  30. }
  31.  
  32. void MoveInLineOfSight(Unit* unit) override
  33. {
  34. if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself())
  35. {
  36. if (!unit || !unit->IsInWorld())
  37. return;
  38.  
  39. if (!me->IsWithinDist(unit, 15.0f, false))
  40. return;
  41.  
  42. if (player->HasQuest(QUEST_A_THE_SPEAKERS_PERSPECTIVE) || player->HasQuest(QUEST_H_THE_SPEAKERS_PERSPECTIVE))
  43. {
  44. m_playerGUID = player->GetGUID();
  45. AddPlayer();
  46. player->KilledMonsterCredit(KILLMONSTERCREDIT_A_THE_SPEAKERS_PERSPECTIVE);
  47. Conversation::CreateConversation(CONVERSATION_A_THE_SPEAKERS_PERSPECTIVE, player, player->GetPosition(), { player->GetGUID() });
  48. m_playerGUID = ObjectGuid::Empty;
  49. }
  50. else if (player->HasQuest(QUEST_A_DYING_WORLD_A) || player->HasQuest(QUEST_A_DYING_WORLD_H))
  51. {
  52. player->GetDistance(me) < 20.0f)
  53. player->KilledMonsterCredit(me->GetEntry());
  54. }
  55. }
  56. }
  57.  
  58. private:
  59. std::set<ObjectGuid> pList;
  60. ObjectGuid m_playerGUID;
  61. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement