From 6f38fb1011373d5901769a4d54fcb63d93c3de8d Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 7 Sep 2012 02:21:38 +0200 Subject: Core: Fix some code style --- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 27a6dac95f7..ed4148cd033 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -913,7 +913,7 @@ class spell_gen_profession_research : public SpellScriptLoader uint32 spellId = GetSpellInfo()->Id; // learn random explicit discovery recipe (if any) - if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster->ToPlayer())) + if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster)) caster->learnSpell(discoveredSpellId, false); caster->UpdateCraftSkill(spellId); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index a88defad1ce..0508d95a60b 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -842,7 +842,7 @@ class spell_item_book_of_glyph_mastery : public SpellScriptLoader uint32 spellId = GetSpellInfo()->Id; // learn random explicit discovery recipe (if any) - if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster->ToPlayer())) + if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster)) caster->learnSpell(discoveredSpellId, false); } -- cgit v1.2.3 From 5eb22e5b646fbe1774100e6b3eb7b876591e1cf6 Mon Sep 17 00:00:00 2001 From: kaelima Date: Fri, 7 Sep 2012 03:16:43 +0200 Subject: Core/Vehicles: - Send proper triggering flag when casting spellclick spells on vehicles (should not be fully triggered) - Only compute non-transport positions when not finalized. (Fixes changing seat on vehicles, or changing vehicle from vehicle) --- src/server/game/Entities/Unit/Unit.cpp | 22 +++++++++++++++------- src/server/game/Entities/Unit/Unit.h | 11 ++++++----- src/server/game/Movement/Spline/MoveSplineInit.cpp | 4 ++-- .../IcecrownCitadel/boss_the_lich_king.cpp | 6 +++--- 4 files changed, 26 insertions(+), 17 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3043d0fa4cd..b9ce62e7f0d 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -405,6 +405,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff) pos.m_positionY = loc.y; pos.m_positionZ = loc.z; pos.m_orientation = loc.orientation; + if (Unit* vehicle = GetVehicleBase()) { loc.x += vehicle->GetPositionX(); @@ -861,17 +862,24 @@ void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1); if (bp2) values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2); - CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster); + CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); } void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) { CustomSpellValues values; values.AddSpellMod(mod, value); - CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster); + CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); +} + +void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +{ + CustomSpellValues values; + values.AddSpellMod(mod, value); + CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster); } -void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) @@ -882,7 +890,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* SpellCastTargets targets; targets.SetUnitTarget(victim); - CastSpell(targets, spellInfo, &value, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); + CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster); } void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) @@ -17011,7 +17019,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) } if (IsInMap(caster)) - caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, false, NULL, NULL, origCasterGUID); + caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_FULL_MASK, NULL, NULL, origCasterGUID); else // This can happen during Player::_LoadAuras { int32 bp0 = seatId; @@ -17021,7 +17029,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) else { if (IsInMap(caster)) - caster->CastSpell(target, spellEntry, false, NULL, NULL, origCasterGUID); + caster->CastSpell(target, spellEntry, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_FULL_MASK, NULL, NULL, origCasterGUID); else Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID); } @@ -17041,7 +17049,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) void Unit::EnterVehicle(Unit* base, int8 seatId) { - CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId+1, base, false); + CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId+1, base, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE); } void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 98d7bbcdcde..415d63a0c84 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1568,13 +1568,14 @@ class Unit : public WorldObject void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); Aura* AddAura(uint32 spellId, Unit* target); Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target); void SetAuraStack(uint32 spellId, Unit* target, uint32 stack); diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index c539dd3cc39..a47c25610b0 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -71,10 +71,10 @@ namespace Movement real_position.z = unit.GetTransOffsetZ(); real_position.orientation = unit.GetTransOffsetO(); } - // there is a big chance that current position is unknown if current state is not finalized, need compute it // this also allows calculate spline position and update map position in much greater intervals - if (!move_spline.Finalized()) + // Don't compute for transport movement. The unit could be in a motion between two transports, thus having transport moveflag but is resulting in regular positions + else if (!move_spline.Finalized()) real_position = move_spline.ComputePosition(); // should i do the things that user should do? - no. diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index a8657925131..ba1a0614cdf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -2112,7 +2112,7 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader CustomSpellValues values; //values.AddSpellMod(SPELLVALUE_AURA_STACK, 2); values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1); - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID()); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); if (Unit* caster = GetCaster()) caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); } @@ -2204,7 +2204,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader CustomSpellValues values; values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID()); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); if (Unit* caster = GetCaster()) caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); } @@ -2223,7 +2223,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader CustomSpellValues values; values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID()); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); if (Unit* caster = GetCaster()) caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); -- cgit v1.2.3 From 6970a28f24c120c558be71e2e447fb271c999183 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Fri, 7 Sep 2012 05:01:04 +0300 Subject: Scripts/Scarlet Monastery: Final boss kill credit closes #7341 When Scarlet Commander Mograine dies and High Inquisitor Whitemane appears, if she is downed very quickly, then she will not perform the ressurection on Mograine and will not stun anyone, thus Mograine wont give the achievement nor loot. She should be invincible till she has ressurected Mograine. --- .../ScarletMonastery/boss_mograine_and_whitemane.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/server/scripts') diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 46fb62eae7f..0aad2857a45 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -283,6 +283,12 @@ public: DoScriptText(SAY_WH_KILL, me); } + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (!_bCanResurrectCheck && damage >= me->GetHealth()) + damage = me->GetHealth() - 1; + } + void UpdateAI(const uint32 diff) { if (!UpdateVictim()) -- cgit v1.2.3 From 21d43781acf1c60a66e4aa139324bff8d24d24d6 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 7 Sep 2012 02:05:09 +0100 Subject: Tabs to spaces... --- src/server/game/AI/CoreAI/CombatAI.cpp | 2 +- src/server/game/Entities/Creature/Creature.cpp | 4 ++-- src/server/game/Entities/Pet/Pet.cpp | 2 +- .../Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index 946fe664798..5ab5f99310a 100755 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -111,7 +111,7 @@ void CombatAI::UpdateAI(const uint32 diff) DoMeleeAttackIfReady(); } -void CombatAI::SpellInterrupted(uint32 spellId, uint32 unTimeMs) +void CombatAI::SpellInterrupted(uint32 spellId, uint32 unTimeMs) { events.RescheduleEvent(spellId, unTimeMs); } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 0b9d0b40b4a..5cf81fb3847 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2231,7 +2231,7 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const return (itr != m_CreatureSpellCooldowns.end() && itr->second > time(NULL)) || HasCategoryCooldown(spell_id); } -void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) +void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) { time_t curTime = time(NULL); for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) @@ -2257,7 +2257,7 @@ void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetCreatureSpellCooldownDelay(unSpellId) < unTimeMs) { _AddCreatureSpellCooldown(unSpellId, curTime + unTimeMs/IN_MILLISECONDS); - if (UnitAI* ai = GetAI()) + if (UnitAI* ai = GetAI()) ai->SpellInterrupted(unSpellId, unTimeMs); } } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index b2cdb56a33e..ead018ac620 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -2034,7 +2034,7 @@ void Pet::SynchronizeLevelWithOwner() } } -void Pet::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) +void Pet::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) { WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+m_spells.size()*8); data << uint64(GetGUID()); diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index 156581e8cd2..233a8d82497 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -350,10 +350,10 @@ class instance_blood_furnace : public InstanceMapScript ++PrisonerCounter8; } else - return; + return; } else - return; + return; ResetPrisoner(creature); } -- cgit v1.2.3