diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/item/item_scripts.cpp | 22 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp | 115 | ||||
-rw-r--r-- | src/game/Unit.cpp | 2 |
3 files changed, 138 insertions, 1 deletions
diff --git a/src/bindings/scripts/scripts/item/item_scripts.cpp b/src/bindings/scripts/scripts/item/item_scripts.cpp index f577d0fed9c..d30efdae89f 100644 --- a/src/bindings/scripts/scripts/item/item_scripts.cpp +++ b/src/bindings/scripts/scripts/item/item_scripts.cpp @@ -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(); } diff --git a/src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp b/src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp index 94c93c8e449..c45ef53a81a 100644 --- a/src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp +++ b/src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp @@ -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(); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 308d510e5ae..882a599466e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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; |