Scripting/Misc: Some cleanup.

This commit is contained in:
Malcrom
2013-12-23 12:12:31 -03:30
parent 59eca906ef
commit ab3eced989
5 changed files with 59 additions and 62 deletions

View File

@@ -0,0 +1,12 @@
-- Add Missing gossip for Engineer "Spark" Overgrind
UPDATE `creature_template` SET `gossip_menu_id`=7426 WHERE `entry`=17243;
DELETE FROM `gossip_menu` WHERE (`entry`=7426 AND `text_id`=8978);
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (7426,8978);
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (7426);
INSERT INTO `gossip_menu_option` (menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, action_menu_id, action_poi_id, box_coded, box_money, box_text) VALUES
(7426,0,0, 'It''s over, Spark. The admiral knows it was you who betrayed the Alliance. Now you''re either going to cooperate with me and tell me everything that you know or we''re going to engage in some fisticuff.',1,1,0,0,0,0, '');
-- Add Conditions for Engineer "Spark" Overgrind gossip
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=7426;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15,7426,0,0,0,9,0,9537,0,0,0,0,0, '', 'Gossip Option - Show Option if Quest 9537 is taken');

View File

@@ -60,11 +60,7 @@ enum ProfessorPhizzlethorpe
class npc_professor_phizzlethorpe : public CreatureScript
{
public:
npc_professor_phizzlethorpe()
: CreatureScript("npc_professor_phizzlethorpe")
{
}
npc_professor_phizzlethorpe() : CreatureScript("npc_professor_phizzlethorpe") { }
struct npc_professor_phizzlethorpeAI : public npc_escortAI
{

View File

@@ -65,10 +65,7 @@ enum TorekMisc
class npc_torek : public CreatureScript
{
public:
npc_torek() : CreatureScript("npc_torek")
{
}
npc_torek() : CreatureScript("npc_torek") { }
struct npc_torekAI : public npc_escortAI
{
@@ -411,22 +408,22 @@ class npc_muglash : public CreatureScript
}
}
void UpdateAI(uint32 uiDiff) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
{
npc_escortAI::UpdateAI(uiDiff);
npc_escortAI::UpdateAI(diff);
if (!me->GetVictim())
{
if (HasEscortState(STATE_ESCORT_PAUSED) && IsBrazierExtinguished)
{
if (EventTimer < uiDiff)
if (EventTimer < diff)
{
++WaveId;
DoWaveSummon();
EventTimer = 10000;
}
else
EventTimer -= uiDiff;
EventTimer -= diff;
}
return;
}

View File

@@ -40,16 +40,22 @@ EndContentData */
## npc_spitelashes
######*/
enum Spitelashes
{
SPELL_POLYMORPH_RANK1 = 118,
SPELL_POLYMORPH_RANK2 = 12824,
SPELL_POLYMORPH_RANK3 = 12825,
SPELL_POLYMORPH_RANK4 = 12826,
SPELL_POLYMORPH = 29124,
SPELL_POLYMORPH_BACKFIRE = 28406,
SPELL_REMOVE_POLYMORPH = 6924
};
class npc_spitelashes : public CreatureScript
{
public:
npc_spitelashes() : CreatureScript("npc_spitelashes") { }
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_spitelashesAI(creature);
}
struct npc_spitelashesAI : public ScriptedAI
{
npc_spitelashesAI(Creature* creature) : ScriptedAI(creature) { }
@@ -72,15 +78,15 @@ public:
switch (spell->Id)
{
case 118:
case 12824:
case 12825:
case 12826:
case SPELL_POLYMORPH_RANK1:
case SPELL_POLYMORPH_RANK2:
case SPELL_POLYMORPH_RANK3:
case SPELL_POLYMORPH_RANK4:
if (Player* player = unit->ToPlayer())
if (player->GetQuestStatus(9364) == QUEST_STATUS_INCOMPLETE)
{
spellhit = true;
DoCast(me, 29124);
DoCast(me, SPELL_POLYMORPH);
}
break;
default:
@@ -102,18 +108,22 @@ public:
morphtimer+=diff;
if (morphtimer >= 5000)
{
DoCast(me, 28406); //summon copies
DoCast(me, 6924); //visual explosion
DoCast(me, SPELL_POLYMORPH_BACKFIRE); // summon copies
DoCast(me, SPELL_REMOVE_POLYMORPH); // visual explosion
}
}
if (!UpdateVictim())
return;
/// @todo add abilities for the different creatures
// @todo add abilities for the different creatures
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_spitelashesAI(creature);
}
};
/*######

View File

@@ -187,39 +187,11 @@ enum Overgrind
SPELL_DYNAMITE = 7978
};
#define GOSSIP_FIGHT "Traitor! You will be brought to justice!"
class npc_engineer_spark_overgrind : public CreatureScript
{
public:
npc_engineer_spark_overgrind() : CreatureScript("npc_engineer_spark_overgrind") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF)
{
player->CLOSE_GOSSIP_MENU();
creature->setFaction(FACTION_HOSTILE);
CAST_AI(npc_engineer_spark_overgrind::npc_engineer_spark_overgrindAI, creature->AI())->AttackStart(player);
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
{
if (player->GetQuestStatus(QUEST_GNOMERCY) == QUEST_STATUS_INCOMPLETE)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_engineer_spark_overgrindAI(creature);
}
struct npc_engineer_spark_overgrindAI : public ScriptedAI
{
npc_engineer_spark_overgrindAI(Creature* creature) : ScriptedAI(creature)
@@ -231,14 +203,6 @@ public:
IsTreeEvent = true;
}
uint32 NormFaction;
uint32 NpcFlags;
uint32 DynamiteTimer;
uint32 EmoteTimer;
bool IsTreeEvent;
void Reset() OVERRIDE
{
DynamiteTimer = 8000;
@@ -255,6 +219,13 @@ public:
Talk(ATTACK_YELL, who);
}
void sGossipSelect(Player* player, uint32 /*sender*/, uint32 /*action*/) OVERRIDE
{
player->CLOSE_GOSSIP_MENU();
me->setFaction(FACTION_HOSTILE);
me->Attack(player, true);
}
void UpdateAI(uint32 diff) OVERRIDE
{
if (!me->IsInCombat() && !IsTreeEvent)
@@ -280,8 +251,19 @@ public:
DoMeleeAttackIfReady();
}
private:
uint32 NormFaction;
uint32 NpcFlags;
uint32 DynamiteTimer;
uint32 EmoteTimer;
bool IsTreeEvent;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_engineer_spark_overgrindAI(creature);
}
};
/*######