Added new area flag to enum which marks areas you cannot fly in

Fixed: Headless Horseman's Mount client crashes, Magic Broom client crashes, Big Love Rocket now works, Invincible now works, Blazing Hippogryph now works

Fixes issue 2081. Fixes issue 1808. Fixes issue 2150. Fixes issue 2020.

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-05-22 22:57:16 +02:00
parent eb1c55f13a
commit 6901e41a03
2 changed files with 188 additions and 25 deletions

View File

@@ -252,7 +252,8 @@ enum AreaFlags
AREA_FLAG_OUTDOOR_PVP = 0x01000000, // Wintergrasp and it's subzones
AREA_FLAG_UNK9 = 0x02000000, // unknown
AREA_FLAG_UNK10 = 0x04000000, // unknown
AREA_FLAG_OUTDOOR_PVP2 = 0x08000000 // Wintergrasp and it's subzones
AREA_FLAG_OUTDOOR_PVP2 = 0x08000000, // Wintergrasp and it's subzones
AREA_FLAG_NO_FLY_ZONE = 0x20000000 // Marks zones where you cannot fly
};
enum Difficulty

View File

@@ -5190,40 +5190,93 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
case 48025: // Headless Horseman's Mount
{
if (!unitTarget)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(762))
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
case 75: unitTarget->CastSpell(unitTarget, 51621, true); break;;
case 150: unitTarget->CastSpell(unitTarget, 48024, true); break;
case 225:
if (unitTarget->ToPlayer()->GetMapId() == 571 || unitTarget->ToPlayer()->GetMapId() == 530)
case 75: unitTarget->CastSpell(unitTarget, 51621, true); break;
case 150: unitTarget->CastSpell(unitTarget, 48024, true); break;
case 225:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 51617, true);
break;
case 300:
if (unitTarget->ToPlayer()->GetMapId() == 571 || unitTarget->ToPlayer()->GetMapId() == 530)
else
unitTarget->CastSpell(unitTarget, 48024, true);
}break;
case 300:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 48023, true);
break;
default: break;
else
unitTarget->CastSpell(unitTarget, 48024, true);
}break;
}
break;
return;
}
case 47977: // Magic Broom
{
if (!unitTarget)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
if (unitTarget)
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
switch(unitTarget->ToPlayer()->GetBaseSkillValue(762))
case 75: unitTarget->CastSpell(unitTarget, 42680, true); break;
case 150: unitTarget->CastSpell(unitTarget, 42683, true); break;
case 225:
{
case 75: unitTarget->CastSpell(unitTarget, 42680, true); break;;
case 150: case 225: case 300: unitTarget->CastSpell(unitTarget, 42683, true); break;
default: break;
}
if (canFly)
unitTarget->CastSpell(unitTarget, 42667, true);
else
unitTarget->CastSpell(unitTarget, 42683, true);
}break;
case 300:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 42668, true);
else
unitTarget->CastSpell(unitTarget, 42683, true);
}break;
}
break;
return;
}
// Mug Transformation
case 41931:
@@ -5462,10 +5515,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent of riding skill
// Triggered spell id dependent on riding skill
if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
{
if (skillval >= 300)
@@ -5553,10 +5606,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent of riding skill
// Triggered spell id dependent on riding skill
if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
{
if (skillval >= 150)
@@ -5566,6 +5619,115 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
return;
}
case 71342: // Big Love Rocket
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
case 0: unitTarget->CastSpell(unitTarget, 71343, true); break;
case 75: unitTarget->CastSpell(unitTarget, 71344, true); break;
case 150: unitTarget->CastSpell(unitTarget, 71345, true); break;
case 225:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 71346, true);
else
unitTarget->CastSpell(unitTarget, 71345, true);
}break;
case 300:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 71347, true);
else
unitTarget->CastSpell(unitTarget, 71345, true);
}break;
}
return;
}
case 72286: // Invincible
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
case 75: unitTarget->CastSpell(unitTarget, 72281, true); break;
case 150: unitTarget->CastSpell(unitTarget, 72282, true); break;
case 225:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 72283, true);
else
unitTarget->CastSpell(unitTarget, 72282, true);
}break;
case 300:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 72284, true);
else
unitTarget->CastSpell(unitTarget, 72282, true);
}break;
}
return;
}
case 74856: // Blazing Hippogryph
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill
if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
{
if (skillval >= 300)
unitTarget->CastSpell(unitTarget, 74855, true);
else
unitTarget->CastSpell(unitTarget, 74854, true);
}
return;
}
case 59317: // Teleporting
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;