From 71407fde1a6307bf98954389f5dd1fe18c09edd7 Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 14 Oct 2011 18:09:21 -0400 Subject: Make npc on transport world object. Try to fix the bug that npc are unloaded with grid and disappear. --- src/server/game/Entities/Transport/Transport.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 28d916fe0af..9a31846fa1f 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -673,6 +673,7 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, return 0; } + creature->m_isWorldObject = true; //so it will not be unloaded with grid map->AddToMap(creature); m_NPCPassengerSet.insert(creature); -- cgit v1.2.3 From 8fd083c073ab52655a56e8ccc09da8c9e783b138 Mon Sep 17 00:00:00 2001 From: Souler Date: Wed, 9 Nov 2011 16:47:51 +0100 Subject: Scripts/Gundrak: Add support for achievement "Snakes. Why'd It Have To Be Snakes?" --- .../scripts/Northrend/Gundrak/boss_slad_ran.cpp | 64 +++++++++++++++++++++- 1 file changed, 61 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 7e417a840f2..b3801c5cfa9 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -52,6 +52,7 @@ enum Creatures enum ConstrictorSpells { SPELL_GRIP_OF_SLAD_RAN = 55093, + SPELL_SNAKE_WRAP = 55126, SPELL_VENOMOUS_BITE = 54987, H_SPELL_VENOMOUS_BITE = 58996 }; @@ -65,6 +66,8 @@ static Position SpawnLoc[]= {1716.76f, 635.159f, 129.282f, 0.191986f} }; +#define DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES 1 + class boss_slad_ran : public CreatureScript { public: @@ -89,6 +92,8 @@ public: uint8 uiPhase; + bool snakesAchievement; + SummonList lSummons; InstanceScript* instance; @@ -100,6 +105,7 @@ public: uiVenomBoltTimer = 15*IN_MILLISECONDS; uiSpawnTimer = 5*IN_MILLISECONDS; uiPhase = 0; + snakesAchievement = true; lSummons.DespawnAll(); @@ -171,6 +177,7 @@ public: void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); + lSummons.DespawnAll(); if (instance) instance->SetData(DATA_SLAD_RAN_EVENT, DONE); @@ -186,6 +193,20 @@ public: summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); lSummons.Summon(summoned); } + + void SetData(uint32 type, uint32 /*data*/) + { + if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES) + snakesAchievement = false; + } + + uint32 GetData(uint32 type) + { + if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES) + return snakesAchievement ? 1 : 0; + + return 0; + } }; }; @@ -215,10 +236,26 @@ public: { if (!UpdateVictim()) return; + if (uiGripOfSladRanTimer <= diff) { - DoCast(me->getVictim(), SPELL_GRIP_OF_SLAD_RAN); - uiGripOfSladRanTimer = 5*IN_MILLISECONDS; + Unit* target = me->getVictim(); + + DoCast(target, SPELL_GRIP_OF_SLAD_RAN); + uiGripOfSladRanTimer = urand(3, 6)*IN_MILLISECONDS; + + Aura* grip = target->GetAura(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID()); + if (grip && grip->GetStackAmount() == 5) + { + target->RemoveAurasDueToSpell(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID()); + target->CastSpell(target, SPELL_SNAKE_WRAP, true); + + if (TempSummon* _me = me->ToTempSummon()) + if (Creature* sladran = _me->GetSummoner()->ToCreature()) + sladran->AI()->SetData(DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES, 0); + + me->DespawnOrUnsummon(); + } } else uiGripOfSladRanTimer -= diff; } @@ -265,9 +302,30 @@ public: }; +class achievement_snakes_whyd_it_have_to_be_snakes : public AchievementCriteriaScript +{ + public: + achievement_snakes_whyd_it_have_to_be_snakes() : AchievementCriteriaScript("achievement_snakes_whyd_it_have_to_be_snakes") + { + } + + bool OnCheck(Player* /*player*/, Unit* target) + { + if (!target) + return false; + + if (Creature* sladran = target->ToCreature()) + if (sladran->AI()->GetData(DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES)) + return true; + + return false; + } +}; + void AddSC_boss_slad_ran() { new boss_slad_ran(); new mob_slad_ran_constrictor(); new mob_slad_ran_viper(); -} + new achievement_snakes_whyd_it_have_to_be_snakes(); +} \ No newline at end of file -- cgit v1.2.3 From 9343645625eb8d4a5493c1f9d3db41deb542ff1d Mon Sep 17 00:00:00 2001 From: Souler Date: Wed, 9 Nov 2011 18:45:39 +0100 Subject: Scripts/Gundrak: Achievement "Snakes. Why'd It Have To Be Snakes?" should be individual for each player. Thanks to @Lopin for pointing it. --- .../scripts/Northrend/Gundrak/boss_slad_ran.cpp | 26 +++++++++------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index b3801c5cfa9..f2b9fb704d5 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -92,8 +92,7 @@ public: uint8 uiPhase; - bool snakesAchievement; - + std::set lWrappedPlayers; SummonList lSummons; InstanceScript* instance; @@ -105,7 +104,7 @@ public: uiVenomBoltTimer = 15*IN_MILLISECONDS; uiSpawnTimer = 5*IN_MILLISECONDS; uiPhase = 0; - snakesAchievement = true; + lWrappedPlayers.clear(); lSummons.DespawnAll(); @@ -194,18 +193,15 @@ public: lSummons.Summon(summoned); } - void SetData(uint32 type, uint32 /*data*/) + void SetGUID(uint64 guid, int32 type) { if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES) - snakesAchievement = false; + lWrappedPlayers.insert(guid); } - uint32 GetData(uint32 type) + bool WasWrapped(uint64 guid) { - if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES) - return snakesAchievement ? 1 : 0; - - return 0; + return lWrappedPlayers.count(guid); } }; @@ -252,7 +248,7 @@ public: if (TempSummon* _me = me->ToTempSummon()) if (Creature* sladran = _me->GetSummoner()->ToCreature()) - sladran->AI()->SetData(DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES, 0); + sladran->AI()->SetGUID(target->GetGUID() ,DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES); me->DespawnOrUnsummon(); } @@ -309,15 +305,13 @@ class achievement_snakes_whyd_it_have_to_be_snakes : public AchievementCriteriaS { } - bool OnCheck(Player* /*player*/, Unit* target) + bool OnCheck(Player* player, Unit* target) { if (!target) return false; - if (Creature* sladran = target->ToCreature()) - if (sladran->AI()->GetData(DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES)) - return true; - + if (boss_slad_ran::boss_slad_ranAI* sladRanAI = CAST_AI(boss_slad_ran::boss_slad_ranAI, target->GetAI())) + return !sladRanAI->WasWrapped(player->GetGUID()); return false; } }; -- cgit v1.2.3 From 53077d670fe3ef3c8cbd6274d3bc6b0a9f716e5e Mon Sep 17 00:00:00 2001 From: Giuseppe Montesanto Date: Wed, 23 Nov 2011 14:14:29 +0100 Subject: Fix Sapphiron flying phase start. --- .../scripts/Northrend/Naxxramas/boss_sapphiron.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index d620289a72f..ed1bbd1971a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -271,14 +271,18 @@ public: break; } case EVENT_FLIGHT: - phase = PHASE_FLIGHT; - events.SetPhase(PHASE_FLIGHT); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(1, x, y, z); - return; + if (HealthAbovePct(10)) + { + phase = PHASE_FLIGHT; + events.SetPhase(PHASE_FLIGHT); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(1, x, y, z); + return; + } + break; } } -- cgit v1.2.3 From 47b7e7514961af066f4839d0bb8250d180bf7e69 Mon Sep 17 00:00:00 2001 From: PKX Date: Thu, 10 Nov 2011 23:03:10 +0100 Subject: Core/Spells: Removed some obsolete code This removes some unused and obsolete code: - "Test of Faith" now doesn't increase crit anymore; - same goes for "Renewed Hope" (in addition that code isn't working); - "Ebon Plague" part was deleted from Unit::SpellDamageBonus but not from Unit::MeleeDamageBonus (in addition this code is not working anymore) - "Blessing of Sanctuary" was working only on melee damage, plus this is not the way it should be fixed Signed-off-by: PKX --- src/server/game/Entities/Unit/Unit.cpp | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b99ccd5f35f..0d7dbf92e50 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10901,12 +10901,6 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas if (victim->HasAura(6788)) crit_chance+=(*i)->GetAmount(); break; - case 21: // Test of Faith - case 6935: - case 6918: - if (victim->HealthBelowPct(50)) - crit_chance+=(*i)->GetAmount(); - break; default: break; } @@ -11131,11 +11125,6 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind DoneTotal += (*i)->GetAmount(); break; - case 7997: // Renewed Hope - case 7998: - if (victim->HasAura(6788)) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - break; case 21: // Test of Faith case 6935: case 6918: @@ -11760,23 +11749,6 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount()))); } break; - // Blessing of Sanctuary - // Greater Blessing of Sanctuary - case 19: - case 1804: - { - if ((*i)->GetSpellInfo()->SpellFamilyName != SPELLFAMILY_PALADIN) - continue; - - if ((*i)->GetMiscValue() & (spellProto ? spellProto->GetSchoolMask() : 0)) - AddPctN(TakenTotalMod, (*i)->GetAmount()); - break; - } - // Ebon Plague - case 1933: - if ((*i)->GetMiscValue() & (spellProto ? spellProto->GetSchoolMask() : 0)) - AddPctN(TakenTotalMod, (*i)->GetAmount()); - break; } } -- cgit v1.2.3 From 4d65c1e7299b04757c61b69115d3c747b8169100 Mon Sep 17 00:00:00 2001 From: Chaplain Date: Sat, 26 Nov 2011 21:05:27 +0200 Subject: Core/Mechanics: Armor penetration improvement. Revamp calculation of SPELL_AURA_MOD_TARGET_ARMOR_PCT --- src/server/game/Entities/Unit/Unit.cpp | 34 ++++++++++--------------- src/server/game/Spells/Auras/SpellAuraEffects.h | 1 + 2 files changed, 14 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5a9456be6c8..2e2f5591a5d 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1512,44 +1512,36 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo armor = floor(AddPctN(armor, -(*j)->GetAmount())); } + // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc. if (GetTypeId() == TYPEID_PLAYER) { - AuraEffectList const& ArPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); - for (AuraEffectList::const_iterator itr = ArPenAuras.begin(); itr != ArPenAuras.end(); ++itr) + float bonusPct = 0; + AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); + for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr) { - // item neutral spell if ((*itr)->GetSpellInfo()->EquippedItemClass == -1) { - armor = floor(AddPctN(armor, -(*itr)->GetAmount())); - continue; + if (!spellInfo || (*itr)->IsAffectedOnSpell(spellInfo) || (*itr)->GetMiscValue() & spellInfo->GetSchoolMask()) + bonusPct += (*itr)->GetAmount(); + else if (!(*itr)->GetMiscValue() && !(*itr)->HasSpellClassMask()) + bonusPct += (*itr)->GetAmount(); } - - // item dependent spell - check current weapons - for (int i = 0; i < MAX_ATTACK; ++i) + else { - Item* weapon = ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true); - - if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo())) - { - armor = floor(AddPctN(armor, -(*itr)->GetAmount())); - break; - } + if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo())) + bonusPct += (*itr)->GetAmount(); } } - } - // Apply Player CR_ARMOR_PENETRATION rating - if (GetTypeId() == TYPEID_PLAYER) - { float maxArmorPen = 0; - if (getLevel() < 60) + if (victim->getLevel() < 60) maxArmorPen = float(400 + 85 * victim->getLevel()); else maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59); // Cap armor penetration to this number maxArmorPen = std::min((armor + maxArmorPen) / 3, armor); // Figure out how much armor do we ignore - float armorPen = CalculatePctF(maxArmorPen, ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION)); + float armorPen = CalculatePctF(maxArmorPen, bonusPct + ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION)); // Got the value, apply it armor -= std::min(armorPen, maxArmorPen); } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index c34391471d7..7f754253719 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -80,6 +80,7 @@ class AuraEffect bool IsPeriodic() const { return m_isPeriodic; } void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; } bool IsAffectedOnSpell(SpellInfo const* spell) const; + bool HasSpellClassMask() const { return m_spellInfo->Effects[m_effIndex].SpellClassMask; } void SendTickImmune(Unit* target, Unit* caster) const; void PeriodicTick(AuraApplication * aurApp, Unit* caster) const; -- cgit v1.2.3 From 80f8791907f34706cb4e1471a3aba7395e4bd17e Mon Sep 17 00:00:00 2001 From: Shocker Date: Sat, 26 Nov 2011 21:42:40 +0200 Subject: Core/Misc: Small cleanup in SpellMgr --- src/server/game/Spells/SpellMgr.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index c382cb56a62..55a70066a8d 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2965,6 +2965,9 @@ void SpellMgr::LoadDbcDataCorrections() break; case 31447: // Mark of Kaz'rogal (needs target selection script) case 31298: // Sleep (needs target selection script) + case 51904: // Summon Ghouls On Scarlet Crusade (this should use conditions table, script for this spell needs to be fixed) + case 2895: // Wrath of Air Totem rank 1 (Aura) + case 68933: // Wrath of Air Totem rank 2 (Aura) spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; spellInfo->EffectImplicitTargetB[0] = 0; break; @@ -3007,8 +3010,12 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER_AREA_PARTY; spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_10_YARDS_2; break; - case 44978: case 45001: case 45002: // Wild Magic - case 45004: case 45006: case 45010: // Wild Magic + case 44978: // Wild Magic + case 45001: + case 45002: + case 45004: + case 45006: + case 45010: case 31347: // Doom case 41635: // Prayer of Mending case 44869: // Spectral Blast @@ -3065,7 +3072,8 @@ void SpellMgr::LoadDbcDataCorrections() case 50312: // Unholy Frenzy spellInfo->MaxAffectedTargets = 15; break; - case 38794: case 33711: //Murmur's Touch + case 33711: //Murmur's Touch + case 38794: spellInfo->MaxAffectedTargets = 1; spellInfo->EffectTriggerSpell[0] = 33760; break; @@ -3105,9 +3113,6 @@ void SpellMgr::LoadDbcDataCorrections() case 51852: // The Eye of Acherus (no spawn in phase 2 in db) spellInfo->EffectMiscValue[0] |= 1; break; - case 51904: // Summon Ghouls On Scarlet Crusade (this should use conditions table, script for this spell needs to be fixed) - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; - break; case 29809: // Desecration Arm - 36 instead of 37 - typo? :/ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_7_YARDS; break; @@ -3151,7 +3156,7 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectApplyAuraName[1] = SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN; break; case 41913: // Parasitic Shadowfiend Passive - spellInfo->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_DUMMY; // proc debuff, and summon infinite fiends break; case 27892: // To Anchor 1 case 27928: // To Anchor 1 @@ -3179,11 +3184,6 @@ void SpellMgr::LoadDbcDataCorrections() case 6474: // Earthbind Totem (instant pulse) spellInfo->AttributesEx5 |= SPELL_ATTR5_START_PERIODIC_AT_APPLY; break; - case 2895: // Wrath of Air Totem rank 1 (Aura) - case 68933: // Wrath of Air Totem rank 2 (Aura) - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; - spellInfo->EffectImplicitTargetB[0] = 0; - break; case 52109: // Flametongue Totem rank 1 (Aura) case 52110: // Flametongue Totem rank 2 (Aura) case 52111: // Flametongue Totem rank 3 (Aura) @@ -3202,7 +3202,7 @@ void SpellMgr::LoadDbcDataCorrections() case 53244: // Marked for Death (Rank 3) case 53245: // Marked for Death (Rank 4) case 53246: // Marked for Death (Rank 5) - spellInfo->EffectSpellClassMask[0] = flag96(423937, 276955137, 2049); + spellInfo->EffectSpellClassMask[0] = flag96(0x00067801, 0x10820001, 0x00000801); break; case 70728: // Exploit Weakness (needs target selection script) case 70840: // Devious Minds (needs target selection script) -- cgit v1.2.3