Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #837 from Raydeon/master
Browse files Browse the repository at this point in the history
Core/Script: Gilneas: Fully core scripted cinema played after saving krennan quest. Also...
  • Loading branch information
Raydeon committed Feb 16, 2013
2 parents 2cfc1a5 + 412c690 commit c624c4a
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
UPDATE creature_template SET AIName = "", scriptname = "npc_lord_godfrey_p4_8" WHERE entry = 35906;

UPDATE creature_template SET AIName = "", scriptname = "npc_commandeered_cannon" WHERE entry = 35914;

UPDATE creature_template SET AIName = "" WHERE entry =50420;

DELETE FROM smart_scripts WHERE entryorguid IN (5042000, 50420, 35096, 35914);

DELETE FROM creature WHERE guid = 69;
INSERT INTO creature VALUES (69, 35753, 638, 1, 4, 0, 0, -1674.45, 1349.29, 20.38, 6.15351, 15, 0, 0, 102, 0, 0, 0, 0, 0);

DELETE FROM creature_text WHERE entry = 35753;
INSERT INTO creature_text VALUES (35753, 0, 1, 'Help! Up here!', 14, 0, 100, 0, 0, 20921, 'Krennan Aranas In Tree');

DELETE FROM creature_template_addon WHERE entry = 3871227;
DELETE FROM creature_addon WHERE guid = 69;
INSERT INTO creature_addon VALUES (69, 0, 0, 0, 0, 473, "");

DELETE FROM creature_template WHERE entry = 3871227;
UPDATE creature_template SET inhabittype = 7 WHERE entry = 35753;

UPDATE creature_template SET unit_flags = 512 WHERE entry = 35509;
UPDATE creature_template SET unit_flags = 134 WHERE entry = 35914;

DELETE FROM script_texts WHERE entry IN (-1999971, -1999972);

DELETE FROM creature_text WHERE entry = 35907;

INSERT INTO creature_text VALUES (35907, 0, 0, "Thank you! I owe you my life.", 12, 0, 0, 1, 0, 20922, "Saved Krennan Aranas");

DELETE FROM conditions WHERE conditionvalue2 = 3871227 LIMIT 1;
161 changes: 133 additions & 28 deletions src/server/scripts/EasternKingdoms/Gilneas/gilneas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2271,34 +2271,42 @@ class npc_greymane_horse : public CreatureScript
public:
npc_greymane_horse() : CreatureScript("npc_greymane_horse") { }

CreatureAI* GetAI(Creature* creature) const
{
return new npc_greymane_horseAI (creature);
}

struct npc_greymane_horseAI : public npc_escortAI
{
npc_greymane_horseAI(Creature* creature) : npc_escortAI(creature) {}

uint32 krennansay;
bool AfterJump;
bool PlayerOn, KrennanOn;

void AttackStart(Unit* /*who*/) {}
void EnterCombat(Unit* /*who*/) {}
void EnterEvadeMode() {}

void Reset()
{
krennansay = 500;//Check every 500ms initially
AfterJump = false;
krennansay = 500;//Check every 500ms initially
PlayerOn = false;
KrennanOn = false;
}

void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply)
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
PlayerOn = true;
if (apply)
{
Start(false, true, who->GetGUID());
}
}
else if (who->GetTypeId() == TYPEID_UNIT)
{
KrennanOn = true;
SetEscortPaused(false);
}
}
Expand All @@ -2310,12 +2318,11 @@ class npc_greymane_horse : public CreatureScript
switch(i)
{
case 5:
me->GetMotionMaster()->MoveJump(-1679.089f,1348.42f,15.31f,25.0f, 15.0f);
AfterJump = true;
Talk(SAY_GREYMANE_HORSE, player->GetGUID());
me->GetMotionMaster()->MoveJump(-1679.089f, 1348.42f, 15.31f, 25.0f, 15.0f);
if (me->GetVehicleKit()->HasEmptySeat(1))
{
SetEscortPaused(true);
player->SetClientControl(me, 0);
break;
}
else
Expand All @@ -2342,28 +2349,27 @@ class npc_greymane_horse : public CreatureScript
npc_escortAI::UpdateAI(diff);
Player* player = GetPlayerForEscort();

if (AfterJump && (me->IsWithinDist3d(-1679.089f, 1348.42f, 15.31f, 1.0f)))
if (PlayerOn)
{
Talk(0,player->GetGUID());
AfterJump = false;
player->SetClientControl(me, 0);
PlayerOn = false;
}

if (KrennanOn) // Do Not yell for help after krennan is on
return;

if (krennansay <=diff)
{
if (Creature* krennan = me->FindNearestCreature(3871227, 30, true))
if (Creature* krennan = me->FindNearestCreature(NPC_KRENNAN_ARANAS_TREE, 70.0f, true))
{
krennan->AI()->Talk(SAY_NPC_KRENNAN_ARANAS_TREE, player->GetGUID());
krennansay = urand(4000,7000);//Repeat every 4 to 7 seconds
}
}
else
krennansay -= diff;
}
};

CreatureAI* GetAI(Creature* creature) const
{
return new npc_greymane_horseAI (creature);
}
};

/*######
Expand All @@ -2374,14 +2380,16 @@ class npc_krennan_aranas_c2 : public CreatureScript
public:
npc_krennan_aranas_c2() : CreatureScript("npc_krennan_aranas_c2") { }

CreatureAI* GetAI(Creature* creature) const
{
return new npc_krennan_aranas_c2AI(creature);
}

struct npc_krennan_aranas_c2AI : public ScriptedAI
{
npc_krennan_aranas_c2AI(Creature* creature) : ScriptedAI(creature) {}

bool Say;
bool Move;
bool Cast;
bool KrennanDead;
bool Say, Move, Cast, KrennanDead;
uint32 SayTimer;

void AttackStart(Unit* /*who*/) {}
Expand All @@ -2390,16 +2398,16 @@ class npc_krennan_aranas_c2 : public CreatureScript

void Reset()
{
Say = false;
Move = true;
Cast = true;
KrennanDead = false;
SayTimer = 500;
Say = false;
Move = true;
Cast = true;
KrennanDead = false;
SayTimer = 500;
}

void UpdateAI(const uint32 diff)
{
if (Creature* krennan = me->FindNearestCreature(3871227, 50))
if (Creature* krennan = me->FindNearestCreature(NPC_KRENNAN_ARANAS_TREE, 50.0f))
{
if (!KrennanDead)
{
Expand All @@ -2408,7 +2416,7 @@ class npc_krennan_aranas_c2 : public CreatureScript
}
}

if (Creature* horse = me->FindNearestCreature(35905, 20.0f))//Jump onto horse in seat 2
if (Creature* horse = me->FindNearestCreature(NPC_GREYMANE_HORSE_P4, 20.0f))//Jump onto horse in seat 2
{
if (Cast)
{
Expand All @@ -2431,18 +2439,113 @@ class npc_krennan_aranas_c2 : public CreatureScript

if (Say && SayTimer <= diff)
{
DoScriptText(SAY_KRENNAN_C2, me);
Talk(SAY_KRENNAN_C2);
me->ForcedDespawn(6000);
Say = false;
}
else
SayTimer -= diff;
}
};
};

/*######
## npc_commandeered_cannon
######*/

class npc_commandeered_cannon : public CreatureScript
{
public:
npc_commandeered_cannon() : CreatureScript("npc_commandeered_cannon") { }

CreatureAI* GetAI(Creature* creature) const
{
return new npc_krennan_aranas_c2AI(creature);
return new npc_commandeered_cannonAI (creature);
}

struct npc_commandeered_cannonAI : public ScriptedAI
{
npc_commandeered_cannonAI(Creature* creature) : ScriptedAI(creature) {}

uint32 tEvent;
uint8 Count, Phase;
bool EventStart;

void Reset()
{
tEvent = 1400;
Phase = 0;
Count = 0;
EventStart = false;
}

void UpdateAI(const uint32 diff)
{
if (!EventStart)
return;

if (Count > 2)
{
Reset();
return;
}

if (tEvent <= diff)
{
switch (Phase)
{
case (0):
for (int i = 0; i < 12; i++)
{
me->SummonCreature(NPC_BLOODFANG_WORGEN, -1757.65f + irand(-6, 6), 1384.01f + irand(-6, 6), 19.872f, urand(0, 6), TEMPSUMMON_TIMED_DESPAWN, 5000);
}
tEvent = 400;
Phase++;
break;

case (1):
if (Creature* Worgen = me->FindNearestCreature(NPC_BLOODFANG_WORGEN, 50.0f, true))
{
me->CastSpell(Worgen, SPELL_CANNON_FIRE, true);
tEvent = 1700;
Phase = 0;
Count++;
}
break;
}
} else tEvent -= diff;
}

void JustSummoned(Creature* summon)
{
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
}
};
};

/*######
## npc_lord_godfrey_p4_8
######*/
class npc_lord_godfrey_p4_8 : public CreatureScript
{
public:
npc_lord_godfrey_p4_8() : CreatureScript("npc_lord_godfrey_p4_8") { }

bool OnQuestReward(Player* player, Creature* godfrey, Quest const* quest, uint32 opt)
{
if (quest->GetQuestId() == QUEST_SAVE_KRENNAN_ARANAS)
{
godfrey->AI()->Talk(SAY_LORD_GODFREY_P4);
player->RemoveAurasDueToSpell(SPELL_WORGEN_BITE);
godfrey->AddAura(SPELL_INFECTED_BITE, player);
player->CastSpell(player, SPELL_GILNEAS_CANNON_CAMERA);
player->SaveToDB();
if (Creature* cannon = GetClosestCreatureWithEntry(godfrey, NPC_COMMANDEERED_CANNON, 50.0f))
{
CAST_AI(npc_commandeered_cannon::npc_commandeered_cannonAI, cannon->AI())->EventStart = true; // Start Event
}
}
return true;
}
};

Expand Down Expand Up @@ -2834,6 +2937,8 @@ void AddSC_gilneas()
new spell_keg_placed();
new npc_greymane_horse();
new npc_krennan_aranas_c2();
new npc_lord_godfrey_p4_8();
new npc_commandeered_cannon();
new npc_bloodfang_stalker_c1();
new npc_gilnean_crow();
}
17 changes: 12 additions & 5 deletions src/server/scripts/EasternKingdoms/Gilneas/gilneas.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ enum CreatureIds
NPC_BLOODFANG_RIPPER_P4 = 35505, // General AI spawns
NPC_GILNEAN_MASTIFF = 35631,
NPC_GILNEAS_CITY_GUARD_P8 = 50474,
NPC_AFFLICTED_GILNEAN_P8 = 50471
NPC_AFFLICTED_GILNEAN_P8 = 50471,
NPC_COMMANDEERED_CANNON = 35914,
NPC_KRENNAN_ARANAS_TREE = 35753,
NPC_GREYMANE_HORSE_P4 = 35905
};

enum GameObjectIds
Expand Down Expand Up @@ -92,6 +95,9 @@ enum SpellIds
SPELL_BY_THE_SKIN_ON_HIS_TEETH = 66914,
SPELL_SHOOT = 6660,
SPELL_WORGEN_BITE = 72870,
SPELL_INFECTED_BITE = 72872,
SPELL_CANNON_FIRE = 68235,
SPELL_GILNEAS_CANNON_CAMERA = 93555,
SPELL_SUMMON_JOSIAH_AVERY = 67350,
SPELL_GET_SHOT = 67349,
SPELL_SUMMON_JOSIAH = 67350,
Expand Down Expand Up @@ -141,17 +147,18 @@ enum NpcTextIds
SAY_CITIZEN_4b = -1638014,
SAY_CITIZEN_5b = -1638015,

YELL_KRENNAN_C1 = -1999973,
SAY_KRENNAN_C2 = -1999972,
SAY_GREYMANE_HORSE = -1999971,
SAY_KRENNAN_C2 = 0,
SAY_GREYMANE_HORSE = 0,
SAY_CROWLEY_HORSE_1 = 0, // Let''s round up as many of them as we can. Every worgen chasing us is one less worgen chasing the survivors!
SAY_CROWLEY_HORSE_2 = 1, // You'll never catch us, you blasted mongrels! || Come and get us, you motherless beasts! || Over here, you flea bags!
SAY_JOSIAH_AVERY_P2 = 1,
SAY_JOSAIH_AVERY_P4 = 1,
SAY_JOSAIH_AVERY_TRIGGER = 1,
SAY_LORNA_CROWLEY_P4 = 0,
SAY_KING_GENN_GREYMANE_P4 = 1,
SAY_GILNEAS_CITY_GUARD_P8 = 1
SAY_GILNEAS_CITY_GUARD_P8 = 1,
SAY_LORD_GODFREY_P4 = 0,
SAY_NPC_KRENNAN_ARANAS_TREE = 0
};

enum SoundIds
Expand Down

0 comments on commit c624c4a

Please sign in to comment.