diff options
| author | Shauren <none@none> | 2010-05-22 22:57:16 +0200 |
|---|---|---|
| committer | Shauren <none@none> | 2010-05-22 22:57:16 +0200 |
| commit | 6901e41a03b237bb8ab066f7b8fdee084e0df381 (patch) | |
| tree | ae828edf7ed28bb52b291c1f1131f37c69ae72fb /src/game/SpellEffects.cpp | |
| parent | eb1c55f13aec84fc138849a2165d9c7f7c98b271 (diff) | |
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
Diffstat (limited to 'src/game/SpellEffects.cpp')
| -rw-r--r-- | src/game/SpellEffects.cpp | 210 |
1 files changed, 186 insertions, 24 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 987e881d27f..205daffb8e3 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -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; |
