Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*######
- ## npc_ogron
- ######*/
- enum
- {
- SAY_OGR_START = 0,
- SAY_OGR_SPOT = 1,
- SAY_OGR_RET_WHAT = 2,
- SAY_OGR_RET_SWEAR = 3,
- SAY_OGR_REPLY_RET = 4,
- SAY_OGR_RET_TAKEN = 5,
- SAY_OGR_TELL_FIRE = 6,
- SAY_OGR_RET_NOCLOSER = 7,
- SAY_OGR_RET_NOFIRE = 8,
- SAY_OGR_RET_HEAR = 9,
- SAY_OGR_CAL_FOUND = 10,
- SAY_OGR_CAL_MERCY = 11,
- SAY_OGR_HALL_GLAD = 12,
- EMOTE_OGR_RET_ARROW = 13,
- SAY_OGR_RET_ARROW = 14,
- SAY_OGR_CAL_CLEANUP = 15,
- SAY_OGR_NODIE = 16,
- SAY_OGR_SURVIVE = 17,
- SAY_OGR_RET_LUCKY = 18,
- SAY_OGR_THANKS = 19,
- QUEST_QUESTIONING = 1273,
- FACTION_GENERIC_FRIENDLY = 35,
- FACTION_THER_HOSTILE = 151,
- NPC_REETHE = 4980,
- NPC_CALDWELL = 5046,
- NPC_HALLAN = 5045,
- NPC_SKIRMISHER = 5044,
- SPELL_FAKE_SHOT = 7105,
- PHASE_INTRO = 0,
- PHASE_GUESTS = 1,
- PHASE_FIGHT = 2,
- PHASE_COMPLETE = 3
- };
- static float afSpawn[] = { -3383.501953f, -3203.383301f, 36.149f};
- static float afMoveTo[] = { -3371.414795f, -3212.179932f, 34.210f};
- class npc_ogron : public CreatureScript
- {
- public:
- npc_ogron() : CreatureScript("npc_ogron") { }
- struct npc_ogronAI : public npc_escortAI
- {
- npc_ogronAI(Creature* creature) : npc_escortAI(creature)
- {
- lCreatureList.clear();
- Reset();
- m_uiPhase = 0;
- m_uiPhaseCounter = 0;
- }
- std::list<Creature*> lCreatureList;
- uint32 m_uiPhase;
- uint32 m_uiPhaseCounter;
- uint32 m_uiGlobalTimer;
- void Reset()
- {
- m_uiGlobalTimer = 5*IN_MILLISECONDS;
- if (!HasEscortState(STATE_ESCORT_ESCORTING))
- {
- lCreatureList.clear();
- m_uiPhase = 0;
- m_uiPhaseCounter = 0;
- }
- }
- void MoveInLineOfSight(Unit* who)
- {
- if (HasEscortState(STATE_ESCORT_ESCORTING) && who->GetEntry() == NPC_REETHE && lCreatureList.empty())
- lCreatureList.push_back((Creature*)who);
- npc_escortAI::MoveInLineOfSight(who);
- }
- Creature* GetCreature(uint32 CreatureEntry)
- {
- if (!lCreatureList.empty())
- {
- for (std::list<Creature*>::iterator itr = lCreatureList.begin(); itr != lCreatureList.end(); ++itr)
- {
- if ((*itr)->GetEntry() == CreatureEntry && (*itr)->IsAlive())
- return (*itr);
- }
- }
- return NULL;
- }
- void WaypointReached(uint32 PointId)
- {
- switch (PointId)
- {
- case 9:
- Talk(SAY_OGR_SPOT);
- break;
- case 10:
- if (Creature* reethe = GetCreature(NPC_REETHE))
- reethe->AI()->Talk(SAY_OGR_RET_WHAT);
- break;
- case 11:
- SetEscortPaused(true);
- break;
- }
- }
- void JustSummoned(Creature* summoned)
- {
- lCreatureList.push_back(summoned);
- summoned->setFaction(35);
- if (summoned->GetEntry() == NPC_CALDWELL)
- summoned->GetMotionMaster()->MovePoint(0, afMoveTo[0], afMoveTo[1], afMoveTo[2]);
- else
- {
- if (Creature* caldwell = GetCreature(NPC_CALDWELL))
- {
- size_t iSize = lCreatureList.size();
- summoned->GetMotionMaster()->MoveFollow(caldwell, 0.5f, (M_PI / 2) * (int)iSize);
- }
- }
- }
- void DoStartAttackMe()
- {
- if (!lCreatureList.empty())
- {
- for (std::list<Creature*>::iterator itr = lCreatureList.begin(); itr != lCreatureList.end(); ++itr)
- {
- if ((*itr)->GetEntry() == NPC_REETHE)
- continue;
- if ((*itr)->IsAlive())
- {
- (*itr)->setFaction(FACTION_THER_HOSTILE);
- (*itr)->AI()->AttackStart(me);
- }
- }
- }
- }
- void UpdateAI(uint32 diff)
- {
- npc_escortAI::UpdateAI(diff);
- if (!me->GetVictim())
- {
- if (HasEscortState(STATE_ESCORT_PAUSED))
- {
- if (m_uiGlobalTimer < diff)
- {
- m_uiGlobalTimer = 5000;
- switch (m_uiPhase)
- {
- case PHASE_INTRO:
- {
- switch (m_uiPhaseCounter)
- {
- case 0:
- if (Creature* reethe = GetCreature(NPC_REETHE))
- reethe->AI()->Talk(SAY_OGR_RET_SWEAR);
- break;
- case 1:
- Talk(SAY_OGR_REPLY_RET);
- break;
- case 2:
- if (Creature* reethe = GetCreature(NPC_REETHE))
- reethe->AI()->Talk(SAY_OGR_RET_TAKEN);
- break;
- case 3:
- DoScriptText(SAY_OGR_TELL_FIRE, me);
- if (Creature* reethe = GetCreature(NPC_REETHE))
- reethe->AI()->Talk(SAY_OGR_RET_NOCLOSER);
- break;
- case 4:
- if (Creature* reethe = GetCreature(NPC_REETHE))
- reethe->AI()->Talk(SAY_OGR_RET_NOFIRE);
- break;
- case 5:
- if (Creature* reethe = GetCreature(NPC_REETHE))
- reethe->AI()->Talk(SAY_OGR_RET_HEAR);
- me->SummonCreature(NPC_CALDWELL, afSpawn[0], afSpawn[1], afSpawn[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000);
- me->SummonCreature(NPC_HALLAN, afSpawn[0], afSpawn[1], afSpawn[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000);
- me->SummonCreature(NPC_SKIRMISHER, afSpawn[0], afSpawn[1], afSpawn[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000);
- me->SummonCreature(NPC_SKIRMISHER, afSpawn[0], afSpawn[1], afSpawn[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000);
- m_uiPhase = PHASE_GUESTS;
- break;
- }
- break;
- }
- case PHASE_GUESTS:
- {
- switch (m_uiPhaseCounter)
- {
- case 6:
- if (Creature* caldwell = GetCreature(NPC_CALDWELL))
- caldwell->AI()->Talk(SAY_OGR_CAL_FOUND);
- break;
- case 7:
- if (Creature* caldwell = GetCreature(NPC_CALDWELL))
- caldwell->AI()->Talk(SAY_OGR_CAL_MERCY);
- break;
- case 8:
- if (Creature* hallan = GetCreature(NPC_HALLAN))
- {
- hallan->AI()->Talk(SAY_OGR_HALL_GLAD);
- if (Creature* reethe = GetCreature(NPC_REETHE))
- hallan->CastSpell(reethe, SPELL_FAKE_SHOT, false);
- }
- break;
- case 9:
- if (Creature* reethe = GetCreature(NPC_REETHE))
- {
- reethe->AI()->Talk(EMOTE_OGR_RET_ARROW);
- reethe->AI()->Talk(SAY_OGR_RET_ARROW);
- }
- break;
- case 10:
- if (Creature* caldwell = GetCreature(NPC_CALDWELL))
- caldwell->AI()->Talk(SAY_OGR_CAL_CLEANUP);
- Talk(SAY_OGR_NODIE);
- break;
- case 11:
- DoStartAttackMe();
- m_uiPhase = PHASE_FIGHT;
- break;
- }
- break;
- }
- case PHASE_COMPLETE:
- {
- switch (m_uiPhaseCounter)
- {
- case 12:
- if (Player* player = GetPlayerForEscort())
- player->GroupEventHappens(QUEST_QUESTIONING, me);
- Talk(SAY_OGR_SURVIVE);
- break;
- case 13:
- if (Creature* reethe = GetCreature(NPC_REETHE))
- reethe->AI()->Talk(SAY_OGR_RET_LUCKY);
- break;
- case 14:
- Talk(SAY_OGR_THANKS);
- SetRun();
- SetEscortPaused(false);
- break;
- }
- break;
- }
- }
- if (m_uiPhase != PHASE_FIGHT)
- ++m_uiPhaseCounter;
- }
- else
- m_uiGlobalTimer -= diff;
- }
- return;
- }
- DoMeleeAttackIfReady();
- }
- };
- bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
- {
- if (quest->GetQuestId() == QUEST_QUESTIONING)
- {
- if (npc_escortAI* pEscortAI = CAST_AI(npc_ogron::npc_ogronAI, creature->AI()))
- pEscortAI->Start(true, false, player->GetGUID());
- creature->setFaction(290);
- creature->AI()->Talk(SAY_OGR_START);
- }
- return true;
- }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_ogronAI(creature);
- }
- };
- UPDATE `creature_template` SET `AIName`='', `ScriptName`='npc_ogron' WHERE `entry`=4983;
- UPDATE `creature_template` SET `AIName`='' WHERE `entry` IN (4980, 5046, 5045, 5044);
- DELETE FROM `script_waypoint` WHERE `entry`=4983;
- INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES
- (4983, 0, -3322.65, -3124.63, 33.842, 0, ''),
- (4983, 1, -3326.34, -3126.83, 34.426, 0, ''),
- (4983, 2, -3336.98, -3129.61, 30.692, 0, ''),
- (4983, 3, -3342.6, -3132.15, 30.422, 0, ''),
- (4983, 4, -3355.83, -3140.95, 29.534, 0, ''),
- (4983, 5, -3365.83, -3144.28, 35.176, 0, ''),
- (4983, 6, -3368.9, -3147.27, 36.091, 0, ''),
- (4983, 7, -3369.36, -3169.83, 36.325, 0, ''),
- (4983, 8, -3371.44, -3183.91, 33.454, 0, ''),
- (4983, 9, -3373.82, -3190.86, 34.717, 5000, 'SAY_OGR_SPOT'),
- (4983, 10, -3368.53, -3198.21, 34.926, 0, 'SAY_OGR_RET_WHAT'),
- (4983, 11, -3366.27, -3210.87, 33.733, 5000, 'pause'),
- (4983, 12, -3368.53, -3198.21, 34.926, 0, ''),
- (4983, 13, -3373.82, -3190.86, 34.717, 0, ''),
- (4983, 14, -3371.44, -3183.91, 33.454, 0, ''),
- (4983, 15, -3369.36, -3169.83, 36.325, 0, ''),
- (4983, 16, -3368.9, -3147.27, 36.091, 0, ''),
- (4983, 17, -3365.83, -3144.28, 35.176, 0, ''),
- (4983, 18, -3355.83, -3140.95, 29.534, 0, ''),
- (4983, 19, -3342.6, -3132.15, 30.422, 0, ''),
- (4983, 20, -3336.98, -3129.61, 30.692, 0, ''),
- (4983, 21, -3326.34, -3126.83, 34.426, 0, ''),
- (4983, 22, -3322.65, -3124.63, 33.842, 0, '');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement