Skip to content
Browse files

Scripts/Ulduar: Fixed crashes with Kologarn using Stone Grip

  • Loading branch information...
1 parent 6e6ed50 commit 3e32caa59362733052eec4a4e9fed7b8695b1e45 @Shauren Shauren committed Apr 7, 2013
View
2 src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2898,12 +2898,10 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 m
return;
Unit* target = aurApp->GetTarget();
-
if (!target->IsVehicle())
return;
Unit* caster = GetCaster();
-
if (!caster || caster == target)
return;
View
36 src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
@@ -166,7 +166,7 @@ class boss_kologarn : public CreatureScript
left = apply;
if (!apply && isEncounterInProgress)
{
- who->ToCreature()->DisappearAndDie();
+ who->ToCreature()->DespawnOrUnsummon();
Talk(SAY_LEFT_ARM_GONE);
events.ScheduleEvent(EVENT_RESPAWN_LEFT_ARM, 40000);
}
@@ -177,7 +177,7 @@ class boss_kologarn : public CreatureScript
right = apply;
if (!apply && isEncounterInProgress)
{
- who->ToCreature()->DisappearAndDie();
+ who->ToCreature()->DespawnOrUnsummon();
Talk(SAY_RIGHT_ARM_GONE);
events.ScheduleEvent(EVENT_RESPAWN_RIGHT_ARM, 40000);
}
@@ -529,7 +529,7 @@ class spell_ulduar_stone_grip_absorb : public SpellScriptLoader
//! What we do here is remove all harmful aura's related and teleport to safe spot.
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
return;
if (!GetOwner()->ToCreature())
@@ -568,22 +568,30 @@ class spell_ulduar_stone_grip : public SpellScriptLoader
owner->RemoveAurasDueToSpell(aurEff->GetAmount());
}
- void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode)
+ void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- if (!(mode & AURA_EFFECT_HANDLE_REAL))
- return;
-
- if (GetOwner()->GetTypeId() != TYPEID_UNIT)
+ PreventDefaultAction();
+ Unit* caster = GetCaster();
+ if (!caster)
return;
- Player* caster = GetCaster() ? GetCaster()->ToPlayer() : NULL;
- if (!caster || !caster->IsOnVehicle(GetOwner()->ToUnit()))
- return;
+ Position exitPosition;
+ exitPosition.m_positionX = 1750.0f;
+ exitPosition.m_positionY = -7.5f + frand(-3.0f, 3.0f);
+ exitPosition.m_positionZ = 457.9322f;
+ // Remove pending passengers before exiting vehicle - might cause an Uninstall
+ GetTarget()->GetVehicleKit()->RemovePendingEventsForPassenger(caster);
+ caster->_ExitVehicle(&exitPosition);
caster->RemoveAurasDueToSpell(GetId());
- caster->ExitVehicle();
- caster->GetMotionMaster()->MoveJump(1756.25f + irand(-3, 3), -8.3f + irand(-3, 3), 448.8f, 5.0f, 5.0f);
- PreventDefaultAction();
+
+ // Temporarily relocate player to vehicle exit dest serverside to send proper fall movement
+ // beats me why blizzard sends these 2 spline packets one after another instantly
+ Position oldPos;
+ caster->GetPosition(&oldPos);
+ caster->Relocate(exitPosition);
+ caster->GetMotionMaster()->MoveFall();
+ caster->Relocate(oldPos);
}
void Register()

0 comments on commit 3e32caa

Please sign in to comment.
Something went wrong with that request. Please try again.