Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*######
- ## npc_injured_rainspeaker_oracle
- ######*/
- #define GOSSIP_ITEM1 "I am ready to travel to your village now."
- enum eRainspeaker
- {
- SAY_START_IRO = -1571000,
- SAY_QUEST_ACCEPT_IRO = -1571001,
- SAY_END_IRO = -1571002,
- QUEST_FORTUNATE_MISUNDERSTANDINGS = 12570,
- FACTION_ESCORTEE_A = 774,
- FACTION_ESCORTEE_H = 775
- };
- class npc_injured_rainspeaker_oracle : public CreatureScript
- {
- public:
- npc_injured_rainspeaker_oracle() : CreatureScript("npc_injured_rainspeaker_oracle") { }
- struct npc_injured_rainspeaker_oracleAI : public npc_escortAI
- {
- npc_injured_rainspeaker_oracleAI(Creature* c) : npc_escortAI(c) { c_guid = c->GetGUID(); }
- uint64 c_guid;
- void Reset()
- {
- me->RestoreFaction();
- // if we will have other way to assign this to only one npc remove this part
- if (GUID_LOPART(me->GetGUID()) != 101030)
- {
- me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- }
- }
- void WaypointReached(uint32 i)
- {
- Player* pPlayer = GetPlayerForEscort();
- if (!pPlayer)
- return;
- switch(i)
- {
- case 1: SetRun(); break;
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
- me->RemoveUnitMovementFlag(MOVEMENTFLAG_JUMPING);
- me->SetSpeed(MOVE_SWIM, 0.85f, true);
- me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING);
- break;
- case 19:
- me->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING);
- break;
- case 28:
- if (Player* pPlayer = GetPlayerForEscort())
- pPlayer->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me);
- // me->RestoreFaction();
- DoScriptText(SAY_END_IRO,me);
- SetRun(false);
- break;
- }
- }
- void JustDied(Unit* /*killer*/)
- {
- if (!HasEscortState(STATE_ESCORT_ESCORTING))
- return;
- if (Player* pPlayer = GetPlayerForEscort())
- {
- if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE)
- pPlayer->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS);
- }
- }
- };
- bool OnGossipHello(Player* pPlayer, Creature* pCreature)
- {
- if (pCreature->isQuestGiver())
- pPlayer->PrepareQuestMenu(pCreature->GetGUID());
- if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) == QUEST_STATUS_INCOMPLETE)
- pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
- {
- pPlayer->PlayerTalkClass->ClearMenus();
- if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
- {
- CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID());
- CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(35.0f);
- pCreature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING);
- DoScriptText(SAY_START_IRO, pCreature);
- switch (pPlayer->GetTeam()){
- case ALLIANCE:
- pCreature->setFaction(FACTION_ESCORTEE_A);
- break;
- case HORDE:
- pCreature->setFaction(FACTION_ESCORTEE_H);
- break;
- }
- }
- return true;
- }
- bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, Quest const * /*_Quest*/)
- {
- DoScriptText(SAY_QUEST_ACCEPT_IRO, pCreature);
- return false;
- }
- CreatureAI *GetAI(Creature *creature) const
- {
- return new npc_injured_rainspeaker_oracleAI(creature);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement