*Script for Plug the Sinkholes - by Drethek.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-07-23 15:13:17 +02:00
parent 4a0d187cd6
commit 1eef9f86f6
6 changed files with 145 additions and 2 deletions
@@ -489,6 +489,23 @@ bool ItemUse_item_zezzak_shard(Player *player, Item* _Item, SpellCastTargets con
return true;
}
/*#####
# item_incendiary_explosives
#####*/
bool ItemUse_item_incendiary_explosives(Player *player, Item* _Item, SpellCastTargets const& targets)
{
if ( player->FindNearestCreature(26248,15) || player->FindNearestCreature(26249,15) )
{
return false;
}
else
{
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE,_Item,NULL);
return true;
}
}
void AddSC_item_scripts()
{
Script *newscript;
@@ -592,5 +609,10 @@ void AddSC_item_scripts()
newscript->Name="item_zezzaks_shard";
newscript->pItemUse = &ItemUse_item_zezzak_shard;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="item_incendiary_explosives";
newscript->pItemUse = &ItemUse_item_incendiary_explosives;
newscript->RegisterSelf();
}
@@ -87,6 +87,116 @@ bool GossipSelect_npc_surristrasz(Player *player, Creature *_Creature, uint32 se
return true;
}
/*######
## npc_sinkhole_kill_credit
######*/
enum
{
SPELL_SET_CART = 46797,
SPELL_EXPLODE_CART = 46799,
SPELL_SUMMON_CART = 46798,
SPELL_SUMMON_WORM = 46800,
};
struct TRINITY_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI
{
npc_sinkhole_kill_creditAI(Creature* c) : ScriptedAI(c){}
uint32 Phase_Timer;
uint8 Phase;
Unit* Caster;
void Reset()
{
Phase_Timer = 500;
Phase = 0;
Caster = NULL;
}
void SpellHit(Unit *caster, const SpellEntry *spell)
{
if (Phase)
return;
if (spell->Id == SPELL_SET_CART && CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE)
{
Phase = 1;
Caster = caster;
}
}
void EnterCombat(Unit* who) { }
void UpdateAI(const uint32 diff)
{
if (!Phase)
return;
if (Phase_Timer < diff)
{
switch (Phase)
{
case 1:
DoCast(m_creature, SPELL_EXPLODE_CART, true);
DoCast(m_creature, SPELL_SUMMON_CART, true);
if (GameObject* cart = m_creature->FindNearestGameObject(188160,3))
cart->SetUInt32Value(GAMEOBJECT_FACTION, 14);
Phase_Timer = 3000;
Phase = 2;
break;
case 2:
if (GameObject* cart = m_creature->FindNearestGameObject(188160,3))
cart->UseDoorOrButton();
DoCast(m_creature, SPELL_EXPLODE_CART, true);
Phase_Timer = 3000;
Phase = 3;
break;
case 3:
DoCast(m_creature, SPELL_EXPLODE_CART, true);
Phase_Timer = 2000;
Phase = 4;
case 5:
DoCast(m_creature, SPELL_SUMMON_WORM, true);
if (Unit* worm = m_creature->FindNearestCreature(26250, 3))
{
worm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
worm->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
}
Phase_Timer = 1000;
Phase = 6;
break;
case 6:
DoCast(m_creature, SPELL_EXPLODE_CART, true);
if (Unit* worm = m_creature->FindNearestCreature(26250, 3))
{
m_creature->DealDamage(worm, worm->GetHealth());
worm->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
Phase_Timer = 2000;
Phase = 7;
break;
case 7:
DoCast(m_creature, SPELL_EXPLODE_CART, true);
CAST_PLR(Caster)->KilledMonster(m_creature->GetCreatureInfo(),m_creature->GetGUID());
Phase_Timer = 5000;
Phase = 8;
break;
case 8:
EnterEvadeMode();
break;
}
} else Phase_Timer -= diff;
}
};
CreatureAI* GetAI_npc_sinkhole_kill_credit(Creature* pCreature)
{
return new npc_sinkhole_kill_creditAI(pCreature);
}
void AddSC_borean_tundra()
{
Script *newscript;
@@ -102,4 +212,9 @@ void AddSC_borean_tundra()
newscript->pGossipHello = &GossipHello_npc_surristrasz;
newscript->pGossipSelect = &GossipSelect_npc_surristrasz;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="npc_sinkhole_kill_credit";
newscript->GetAI = &GetAI_npc_sinkhole_kill_credit;
newscript->RegisterSelf();
}
+1 -1
View File
@@ -1412,7 +1412,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
damageInfo->procEx = PROC_EX_NONE;
damageInfo->hitOutCome = MELEE_HIT_EVADE;
if(!this || !pVictim)
if(!pVictim)
return;
if(!this->isAlive() || !pVictim->isAlive())
return;