Scripts/Icecrown: Fix code style and use "best practices" on previous commit (c536ba510)

This commit is contained in:
Nay committed 2013-07-19 00:42:59 +01:00
1 parent c536ba510d
commit ff01602906
3 files changed
+172 -211

No files matched your search

@@ -0,0 +1,26 @@
-- TEXT INSERTS
DELETE FROM `creature_text` WHERE `entry` IN (31301, 31428, 31306);
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
(31301, 0, 0, "You dare to think you have thwarted my will? That you have broken my plans?", 12, 0, 100, 25, 0, 0, "LK SAY 1"),
(31301, 1, 0, "You have accomplished nothing!", 12, 0, 100, 22, 0, 0, "LK SAY 2"),
(31301, 2, 0, "Your feeble resistance has only hastened your doom.", 12, 0, 100, 25, 0, 0, "LK SAY 3"),
(31301, 3, 0, "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, 22, 0, 0, "LK SAY 4"),
(31301, 4, 0, "Morbidus, show them what happens to those who defy the will of their king!", 12, 0, 100, 25, 0, 0, "LK SAY 5"),
(31428, 0, 0, "You will pay for what you've done! For the Argent Crusade!", 12, 0, 100, 0, 0, 0, "OLAKIN SAY 1"),
(31306, 0, 0, "Knights of the Ebon Blade, prepare for battle!", 12, 0, 100, 1, 0, 0, 'DHAKAR 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
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
UPDATE `creature_template` SET `faction_A`=1770, `faction_H`=1770, `npcflag`=`npcflag`|1, `equipment_id`=30954, `gossip_menu_id`=10060 WHERE `entry`=31306; -- Margrave Dhakar
UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=7.5,`gender`=0 WHERE `modelid`=31176; -- Morbidus
UPDATE `creature_model_info` SET `bounding_radius`=0.3825,`combat_reach`=1.875,`gender`=0 WHERE `modelid`=27558; -- Margrave Dhakar
DELETE FROM `creature_template_addon` WHERE `entry` IN (30698, 31306);
INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
(30698,0,0,1,0, NULL), -- Morbidus
(31306,0,0,1,0, NULL); -- Margrave Dhakar
@@ -1,36 +0,0 @@
-- 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
+146 -175
View File
@@ -16,17 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Icecrown
SD%Complete: 100
SDComment: Quest support: 12807
SDCategory: Icecrown
EndScriptData */
/* ContentData
npc_arete
EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
@@ -966,42 +955,41 @@ class npc_frostbrood_skytalon : public CreatureScript
}
};
/*
Quest: The Flesh Giant Champion
*/
/*######
## The Flesh Giant Champion - Id: 13235
######*/
enum FleshGiant
{
QUEST_FLESH_GIANT_CHAMPION = 13235,
NPC_MORBIDUS = 30698,
NPC_LICH_KING = 31301,
QUEST_FLESH_GIANT_CHAMPION = 13235,
// 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,
NPC_MORBIDUS = 30698,
NPC_LICH_KING = 31301,
NPC_OLAKIN = 31428,
NPC_DHAKAR = 31306,
EVENT_OUTRO = 7,
EVENT_START = 8,
FACTION_HOSTILE = 14,
FACTION_BASIC = 2102,
SPELL_SIMPLE_TELEPORT = 64195, // Visual stuff
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,
// 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
SPELL_SIMPLE_TELEPORT = 64195,
SAY_DHAKAR_START = 0,
SAY_LK_1 = 0,
SAY_LK_2 = 1,
SAY_LK_3 = 2,
SAY_LK_4 = 3,
SAY_LK_5 = 4,
SAY_OLAKIN_PAY = 0
};
class npc_margrave_dhakar : public CreatureScript
{
public:
@@ -1009,133 +997,120 @@ class npc_margrave_dhakar : public CreatureScript
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);
npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me), _lichKing(NULL) { }
while (uint32 eventId = events.ExecuteEvent())
void Reset() OVERRIDE
{
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) OVERRIDE
{
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) OVERRIDE
{
_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_INTRO:
{
Talk(SAY_DHAKAR_START);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
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;
if (Creature* morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true))
{
_lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ());
_lichKing->SetFacingTo(morbidus->GetOrientation());
_lichKing->CastSpell(_lichKing, SPELL_SIMPLE_TELEPORT, true);
}
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;
_events.ScheduleEvent(EVENT_LK_SAY_1, 5000);
break;
}
case EVENT_LK_SAY_1:
{
_lichKing->AI()->Talk(SAY_LK_1);
_events.ScheduleEvent(EVENT_LK_SAY_2, 5000);
break;
}
case EVENT_LK_SAY_2:
{
_lichKing->AI()->Talk(SAY_LK_2);
_events.ScheduleEvent(EVENT_LK_SAY_3, 5000);
break;
}
case EVENT_LK_SAY_3:
{
_lichKing->AI()->Talk(SAY_LK_3);
_events.ScheduleEvent(EVENT_LK_SAY_4, 5000);
break;
}
case EVENT_LK_SAY_4:
{
_lichKing->AI()->Talk(SAY_LK_4);
_events.ScheduleEvent(EVENT_OUTRO, 12000);
break;
}
case EVENT_LK_SAY_5:
{
_lichKing->AI()->Talk(SAY_LK_5);
_events.ScheduleEvent(EVENT_OUTRO, 8000);
break;
}
case EVENT_OUTRO:
{
if (Creature* olakin = me->FindNearestCreature(NPC_OLAKIN, 50.0f, true))
olakin->AI()->Talk(SAY_OLAKIN_PAY);
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;
_lichKing->DespawnOrUnsummon(0);
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();
}
_events.ScheduleEvent(EVENT_START, 5000);
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);
}
private:
EventMap events;
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_margrave_dhakarAI(creature);
}
break;
}
}
}
DoMeleeAttackIfReady();
}
private:
EventMap _events;
Creature* _lichKing;
SummonList _summons;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_margrave_dhakarAI(creature);
}
};
class npc_morbidus : public CreatureScript
{
public:
@@ -1145,22 +1120,19 @@ class npc_morbidus : public CreatureScript
{
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();
}
void Reset() OVERRIDE
{
if (Creature* dhakar = me->FindNearestCreature(NPC_DHAKAR, 50.0f, true))
dhakar->AI()->Reset();
};
CreatureAI* GetAI(Creature* creature) const
// 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);
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_morbidusAI(creature);
}
@@ -1176,7 +1148,6 @@ void AddSC_icecrown()
new npc_tournament_training_dummy;
new npc_blessed_banner();
new npc_frostbrood_skytalon();
new npc_margrave_dhakar();
new npc_morbidus();
new npc_margrave_dhakar();
new npc_morbidus();
}