Skip to content

Commit

Permalink
Scripts/Icecrown: Fix quest The Flesh Giant Champion
Browse files Browse the repository at this point in the history
Closes #9040
Closes #10294
  • Loading branch information
DDuarte committed Jul 18, 2013
1 parent 7dd26ce commit c536ba5
Show file tree
Hide file tree
Showing 2 changed files with 239 additions and 0 deletions.
36 changes: 36 additions & 0 deletions sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql
@@ -0,0 +1,36 @@
-- TEXT INSERTS
DELETE FROM `creature_text` WHERE `entry`=31306, `groupid`=1, `id`=0;
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
(31306, 1, 0, "Knights of the Ebon Blade, prepare for battle!", 12, 0, 100, 1, 0, 0, '');

DELETE FROM `creature_text` WHERE `entry`=31301, 31428;
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
(31301, 1, 1, "You dare to think you have thwarted my will? That you have broken my plans?", 12, 0, 100, 0, 0, 0, "LK SAY 1"),
(31301, 2, 1, "You have accomplished nothing!", 12, 0, 100, 0, 0, 0, "LK SAY 2"),
(31301, 3, 1, "Your feeble resistance has only hastened your doom.", 12, 0, 100, 0, 0, 0, "LK SAY 3"),
(31301, 4, 1, "So spout your platitudes and flail until you are spent. In the end, you will be mine, and Morbidus will be the harbinger of your death!", 12, 0, 100, 0, 0, 0, "LK SAY 4"),
(31301, 5, 1, "Morbidus, show them what happens to those who defy the will of their king!", 12, 0, 100, 0, 0, 0, "LK SAY 5"),
(31428, 1, 0, "You will pay for what you've done! For the Argent Crusade!", 12, 0, 100, 0, 0, 0, "OLAKIN SAY 1");


-- ScriptName Updates
UPDATE creature_template SET `ScriptName`='npc_margrave_dhakar' WHERE entry=31306;
UPDATE creature_template SET `ScriptName`='npc_morbidus' WHERE `entry`=30698;

-- Template updates for creature 30698 (Morbidus)
UPDATE `creature_template` SET `faction_A`=2102,`faction_H`=2102,`exp`=2,`minlevel`=80,`maxlevel`=80,`unit_flags`=`unit_flags`|832,`speed_run`=0.99206,`VehicleId`=271 WHERE `entry`=30698; -- Morbidus
-- Model data 31176 (creature 30698 (Morbidus))
UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=7.5,`gender`=0 WHERE `modelid`=31176; -- Morbidus
-- Addon data for creature 30698 (Morbidus)
DELETE FROM `creature_template_addon` WHERE `entry`=30698;
INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
(30698,0,0,1,0, NULL); -- Morbidus
-- Template updates for creature 31306 (Margrave Dhakar)
UPDATE `creature_template` SET `faction_A`=1770,`faction_H`=1770,`npcflag`=`npcflag`|1,`equipment_id`=30954 WHERE `entry`=31306; -- Margrave Dhakar
-- Model data 27558 (creature 31306 (Margrave Dhakar))
UPDATE `creature_model_info` SET `bounding_radius`=0.3825,`combat_reach`=1.875,`gender`=0 WHERE `modelid`=27558; -- Margrave Dhakar
-- Addon data for creature 31306 (Margrave Dhakar)
DELETE FROM `creature_template_addon` WHERE `entry`=31306;
INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
(31306,0,0,1,0, NULL); -- Margrave Dhakar
UPDATE `creature_template` SET `gossip_menu_id`=10060 WHERE `entry`=31306; -- Margrave Dhakar
203 changes: 203 additions & 0 deletions src/server/scripts/Northrend/zone_icecrown.cpp
Expand Up @@ -966,6 +966,206 @@ class npc_frostbrood_skytalon : public CreatureScript
}
};

/*
Quest: The Flesh Giant Champion
*/
enum FleshGiant
{
QUEST_FLESH_GIANT_CHAMPION = 13235,
NPC_MORBIDUS = 30698,
NPC_LICH_KING = 31301,

// Factions
FACTION_HOSTILE = 14,
FACTION_BASIC = 2102,
// Events
EVENT_INTRO = 1,
EVENT_LK_SAY_1 = 2,
EVENT_LK_SAY_2 = 3,
EVENT_LK_SAY_3 = 4,
EVENT_LK_SAY_4 = 5,
EVENT_LK_SAY_5 = 6,

EVENT_OUTRO = 7,
EVENT_START = 8,

SPELL_SIMPLE_TELEPORT = 64195, // Visual stuff

// Dhakar
SAY_START = 1,
// Lich King
SAY_THING_1 = 1,
SAY_THING_2 = 2,
SAY_THING_3 = 3,
SAY_THING_4 = 4,
SAY_THING_5 = 5,
// Olakin
SAY_PAY = 1
};
class npc_margrave_dhakar : public CreatureScript
{
public:
npc_margrave_dhakar() : CreatureScript("npc_margrave_dhakar") { }

struct npc_margrave_dhakarAI : public ScriptedAI
{
npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , summons(me)
{
Reset();
}

uint64 LKGuid;
SummonList summons;
void Reset()
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
events.Reset();
summons.DespawnAll();
}
void sGossipSelect(Player* player, uint32 sender, uint32 action)
{
if (player->GetQuestStatus(QUEST_FLESH_GIANT_CHAMPION) == QUEST_STATUS_INCOMPLETE && !player->isInCombat())
{
if (me->GetCreatureTemplate()->GossipMenuId == sender && !action)
{
events.ScheduleEvent(EVENT_INTRO, 1000);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
}
}
void UpdateAI(uint32 diff)
{
events.Update(diff);

while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_INTRO:
Talk(SAY_START);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
if (Creature *morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true))
{
Creature *LK = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ());
LKGuid = LK->GetGUID();
LK->SetFacingTo(morbidus->GetOrientation());
LK->CastSpell(LK, SPELL_SIMPLE_TELEPORT, true);
}
events.ScheduleEvent(EVENT_LK_SAY_1, 5000);
events.CancelEvent(EVENT_INTRO);
break;
case EVENT_LK_SAY_1:
if (Creature *LK = Unit::GetCreature(*me, LKGuid))
{
LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT);
LK->AI()->Talk(SAY_THING_1);
}
events.ScheduleEvent(EVENT_LK_SAY_2, 5000);
events.CancelEvent(EVENT_LK_SAY_1);
break;
case EVENT_LK_SAY_2:
if (Creature *LK = Unit::GetCreature(*me, LKGuid))
{
LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT);
LK->AI()->Talk(SAY_THING_2);
}
events.ScheduleEvent(EVENT_LK_SAY_3, 5000);
events.CancelEvent(EVENT_LK_SAY_2);
break;

case EVENT_LK_SAY_3:
if (Creature *LK = Unit::GetCreature(*me, LKGuid))
{
LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT);
LK->AI()->Talk(SAY_THING_3);
}
events.ScheduleEvent(EVENT_LK_SAY_4, 5000);
events.CancelEvent(EVENT_LK_SAY_3);
break;

case EVENT_LK_SAY_4:
if (Creature *LK = Unit::GetCreature(*me, LKGuid))
{
LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT);
LK->AI()->Talk(SAY_THING_4);
}
events.ScheduleEvent(EVENT_OUTRO, 12000);
events.CancelEvent(EVENT_LK_SAY_4);
break;

case EVENT_LK_SAY_5:
if (Creature *LK = Unit::GetCreature(*me, LKGuid))
{
LK->AI()->Talk(SAY_THING_5);
LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT);
}
events.ScheduleEvent(EVENT_OUTRO, 8000);
events.CancelEvent(EVENT_LK_SAY_5);
break;
case EVENT_OUTRO:
if (Creature *olakin = me->FindNearestCreature(31428, 50.0f, true))
{
olakin->AI()->Talk(SAY_PAY);
}
if (Creature *LK = Unit::GetCreature(*me, LKGuid))
LK->DespawnOrUnsummon(0);
events.ScheduleEvent(EVENT_START, 5000);
events.CancelEvent(EVENT_OUTRO);
break;

case EVENT_START:
if (Creature *morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true))
{
morbidus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_DISABLE_MOVE);
morbidus->setFaction(FACTION_HOSTILE);
}
events.CancelEvent(EVENT_START);
break;
}
}
DoMeleeAttackIfReady();
}

private:
EventMap events;
};

CreatureAI* GetAI(Creature* creature) const
{
return new npc_margrave_dhakarAI(creature);
}
};
class npc_morbidus : public CreatureScript
{
public:
npc_morbidus() : CreatureScript("npc_morbidus") { }

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

void Reset()
{
if (Creature * dhakar = me->FindNearestCreature(31306, 50.0f, true))
dhakar->AI()->Reset();
// this will prevent the event to start without morbidus being alive
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
me->setFaction(FACTION_BASIC);
}
void UpdateAI(uint32 diff)
{
DoMeleeAttackIfReady();
}

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

void AddSC_icecrown()
{
new npc_arete;
Expand All @@ -976,4 +1176,7 @@ void AddSC_icecrown()
new npc_tournament_training_dummy;
new npc_blessed_banner();
new npc_frostbrood_skytalon();
new npc_margrave_dhakar();
new npc_morbidus();

}

8 comments on commit c536ba5

@DDuarte
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Credit is due to @Bluerak1, I forgot to set commit --author 😦

Code-style/SQL was fixed in ff01602

@Walkum
Copy link
Contributor

@Walkum Walkum commented on c536ba5 Jul 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing tab2spaces

@DDuarte
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a lot of stuff, read my comment above

@Walkum
Copy link
Contributor

@Walkum Walkum commented on c536ba5 Jul 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sorry ^^ thanks

@Bluerak1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the codestyle fixes!

@Nevadas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bluerak1: Miss you the sql Part for the Gossip_menu_option ??

@Wylath
Copy link

@Wylath Wylath commented on c536ba5 Aug 31, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `box_coded`, `box_money`, `box_text`) VALUES
(10060, 0, 0, 'Let''s kill this... thing... and get this over with.', 1, 1, ''); -- Margrave Dhakar

@Nephelion
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix SQL (bad import)

INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `box_text`) VALUES
(10060, 0, 0, 'Let''s kill this... thing... and get this over with.', 1, 1, ''); -- Margrave Dhakar```

Please sign in to comment.