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

@@ -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);
}
};
/*######