From 8cf7d9185725b14b31f35c73f167a665edce543f Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Sun, 22 Apr 2012 13:58:22 +0300 Subject: Core/DB: Quest The Emissary. Fix condition in item spell(usable only when npc is above 95% hp). Added correct faction,unit_flags and emote to Leviroth. --- src/server/scripts/Spells/spell_item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 666477e68e7..80520f44c3e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1535,7 +1535,7 @@ class spell_item_impale_leviroth : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { if (Unit* target = GetHitCreature()) - if (target->GetEntry() == NPC_LEVIROTH && target->HealthBelowPct(95)) + if (target->GetEntry() == NPC_LEVIROTH && !target->HealthBelowPct(95)) target->CastSpell(target, SPELL_LEVIROTH_SELF_IMPALE, true); } -- cgit v1.2.3 From 7a8f6b84c99929dc158fcecbfa55546bcc0020af Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Tue, 1 May 2012 02:11:44 +0200 Subject: Scripts/the_barrens: Fix quest "The Affray" and some cleanup. Closes: #4764 Also Closes: #6354 --- src/server/scripts/Kalimdor/the_barrens.cpp | 38 +++++++---------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index c56991e2553..933ad4de3eb 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -408,42 +408,26 @@ public: return; if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { - EventInProgress = false; DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); pWarrior->FailQuest(1719); - for (uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) // unsummon challengers { if (AffrayChallenger[i]) { Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]); - if (creature) { - if (creature->isAlive()) - { - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - creature->setDeathState(JUST_DIED); - } - } + if (creature && creature->isAlive()) + creature->DisappearAndDie(); } - AffrayChallenger[i] = 0; - Challenger_down[i] = false; } - if (BigWill) + if (BigWill) // unsummon bigWill { Creature* creature = Unit::GetCreature((*me), BigWill); - if (creature) - { - if (creature->isAlive()) - { - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - creature->setDeathState(JUST_DIED); - } - } + if (creature && creature->isAlive()) + creature->DisappearAndDie(); } - BigWill = 0; + Reset(); } if (!EventGrate && EventInProgress) @@ -453,7 +437,7 @@ public: if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { pWarrior->AreaExploredOrEventHappens(1719); - DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me); + DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me, pWarrior); for (uint8 i = 0; i < 6; ++i) { @@ -525,11 +509,7 @@ public: if (!creature || !creature->isAlive()) { DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me); - EventInProgress = false; - EventBigWill = false; - EventGrate = false; - PlayerGUID = 0; - Wave = 0; + Reset(); } } } else Wave_Timer -= diff; -- cgit v1.2.3 From 0ecd9e72d0745ed0e79f8730f808153139a795a1 Mon Sep 17 00:00:00 2001 From: Discover- Date: Thu, 10 May 2012 13:43:40 +0200 Subject: Scripts/Quests: Script quest Leave Nothing to Chance. Closes #1863 Closes #3087 Closes #2061 --- sql/updates/world/2012_05_10_01_world_misc.sql | 37 ++++++++++++++++ src/server/scripts/Spells/spell_quest.cpp | 58 ++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 sql/updates/world/2012_05_10_01_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_10_01_world_misc.sql b/sql/updates/world/2012_05_10_01_world_misc.sql new file mode 100644 index 00000000000..a7a30d518a2 --- /dev/null +++ b/sql/updates/world/2012_05_10_01_world_misc.sql @@ -0,0 +1,37 @@ +-- [Q] Leave Nothing to Chance + +-- Lower Wintergarde Mine Shaft and Upper Wintergarde Mine Shaft +UPDATE `creature_template` SET `MovementType`=0,`flags_extra`=`flags_extra`|128 WHERE `entry`IN (27437,27436); +UPDATE `creature` SET `MovementType`=0,`spawndist`=0 WHERE `id` IN (27437,27436); + +-- Wintergarde Mine Bomb SAI +SET @ENTRY := 27435; +SET @SPELL_EXPLOSION := 48742; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,1,1,0,100,1,14000,14000,0,0,11,@SPELL_EXPLOSION,2,0,0,0,0,1,0,0,0,0,0,0,0,"Wintergarde Mine Bomb - Out of Combat - Cast Wintergarde Mine Explosion"), +(@ENTRY,0,1,0,61,0,100,0,0,0,0,0,41,3000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wintergarde Mine Bomb - On Wintergarde Mine Explosion Cast - Forced Despawn"); + +-- Spawn missing spell focus object for upper mine +DELETE FROM `gameobject` WHERE `id`=188711 AND `guid`=370; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(370,188711,571,1,1,3898.18,-881.748,119.533,0.421023,0,0,0.20896,0.977924,300,0,1); + +-- Spawn missing Upper Wintergarde Mine Shaft +DELETE FROM `creature` WHERE `id`=27436 AND `guid`=42576; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES +(42576,27436,571,1,1,0,0,3899.86,-883.613,119.536,0.0636665,300,0,0,42,0,0,0,0,0); + +-- Spellscriptname +DELETE FROM `spell_script_names` WHERE `spell_id`=@SPELL_EXPLOSION; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(@SPELL_EXPLOSION,'spell_q12277_wintergarde_mine_explosion'); + +-- The conditions will make it works exactly like it should. Thanks a lot Josh. +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=@SPELL_EXPLOSION; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,@SPELL_EXPLOSION,0,31,3,27437,0,0,'',"Wintergarde Mine Explosion - Lower Wintergarde Mine Shaft"), -- Effect 0 - SPELL_EFFECT_DUMMY +(13,1,@SPELL_EXPLOSION,1,31,3,27436,0,0,'',"Wintergarde Mine Explosion - Upper Wintergarde Mine Shaft"), -- Effect 0 - SPELL_EFFECT_DUMMY +(13,2,@SPELL_EXPLOSION,0,31,4,0,0,0,'',"Wintergarde Mine Explosion - Targets Players"), -- Effect 1 - SPELL_EFFECT_KNOCK_BACK +(13,4,@SPELL_EXPLOSION,0,31,5,188712,0,0,'',"Wintergarde Mine Explosion - Wintergarde Mine Cave In (2)"); -- Effect 2 - SPELL_EFFECT_ACTIVATE_OBJECT diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 9d042da0789..87db81d2518 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1105,6 +1105,63 @@ public: } }; +enum LeaveNothingToChance +{ + NPC_UPPER_MINE_SHAFT = 27436, + NPC_LOWER_MINE_SHAFT = 27437, + + SPELL_UPPER_MINE_SHAFT_CREDIT = 48744, + SPELL_LOWER_MINE_SHAFT_CREDIT = 48745, +}; + +class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader +{ + public: + spell_q12277_wintergarde_mine_explosion() : SpellScriptLoader("spell_q12277_wintergarde_mine_explosion") { } + + class spell_q12277_wintergarde_mine_explosion_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12277_wintergarde_mine_explosion_SpellScript) + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* unitTarget = GetHitCreature()) + { + if (Unit* caster = GetCaster()) + { + if (caster->GetTypeId() == TYPEID_UNIT) + { + if (Unit* owner = caster->GetOwner()) + { + switch (unitTarget->GetEntry()) + { + case NPC_UPPER_MINE_SHAFT: + caster->CastSpell(owner, SPELL_UPPER_MINE_SHAFT_CREDIT, true); + break; + case NPC_LOWER_MINE_SHAFT: + caster->CastSpell(owner, SPELL_LOWER_MINE_SHAFT_CREDIT, true); + break; + default: + break; + } + } + } + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12277_wintergarde_mine_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12277_wintergarde_mine_explosion_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -1131,4 +1188,5 @@ void AddSC_quest_spell_scripts() new spell_q14112_14145_chum_the_water(); new spell_q9452_cast_net(); new spell_q12987_read_pronouncement(); + new spell_q12277_wintergarde_mine_explosion(); } -- cgit v1.2.3 From 70739ec9deb967cd64bc96791278018c0e7b97ea Mon Sep 17 00:00:00 2001 From: Discover- Date: Thu, 10 May 2012 13:50:22 +0200 Subject: Scripts/Commands: Fix compile under Linux (d6d45633c8ca34176d066755ba8be182b1ed7ac7). Credits go to @PuniCZ --- src/server/scripts/Commands/cs_npc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 2c5136ed428..832f7958fc8 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -555,7 +555,7 @@ public: creature->AI()->SetData(data_1, data_2); std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set"); - handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript); + handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript.c_str()); return true; } -- cgit v1.2.3 From 5057a8156dc0b2f8664ca952d1da2954f385b2f2 Mon Sep 17 00:00:00 2001 From: Discover- Date: Thu, 10 May 2012 13:52:22 +0200 Subject: Scripts/Quests: Fix compile from 0ecd9e72d0745ed0e79f8730f808153139a795a1 - sorry guys. Thanks @Vincent-Michael. --- src/server/scripts/Spells/spell_quest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 87db81d2518..810cc20e04b 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1118,11 +1118,11 @@ class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader { public: spell_q12277_wintergarde_mine_explosion() : SpellScriptLoader("spell_q12277_wintergarde_mine_explosion") { } - + class spell_q12277_wintergarde_mine_explosion_SpellScript : public SpellScript { - PrepareSpellScript(spell_q12277_wintergarde_mine_explosion_SpellScript) - + PrepareSpellScript(spell_q12277_wintergarde_mine_explosion_SpellScript); + void HandleDummy(SpellEffIndex /*effIndex*/) { if (Creature* unitTarget = GetHitCreature()) @@ -1149,13 +1149,13 @@ class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader } } } - + void Register() { OnEffectHitTarget += SpellEffectFn(spell_q12277_wintergarde_mine_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - + SpellScript* GetSpellScript() const { return new spell_q12277_wintergarde_mine_explosion_SpellScript(); -- cgit v1.2.3 From 469ba0b0e797c64040d0b4a3fbe371d8d5baa0b6 Mon Sep 17 00:00:00 2001 From: Chaplain Date: Thu, 10 May 2012 19:39:29 +0300 Subject: Clean up for 58f63509cd4 *restore const methods in spellauraeffects *fix typo in Unit::CalculateMeleeDamage thx bytewarrior *minor speed up in SpellInfo::GetMaxTicks() thx Warpten *deleted duble ';;' thx bytewarrior *speed up in SpellInfo::GetMaxTicks() thx goes to Vincent-Michael --- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 2 +- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 10 ++++----- src/server/game/Spells/Auras/SpellAuraEffects.h | 8 ++++---- src/server/game/Spells/SpellEffects.cpp | 2 +- src/server/game/Spells/SpellInfo.cpp | 24 ++++++++++------------ 6 files changed, 23 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 688d48b41ad..2243734f642 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -383,7 +383,7 @@ void npc_escortAI::FillPointMovementListForCreature() if (movePoints.empty()) return; - ScriptPointVector::const_iterator itrEnd = movePoints.end();; + ScriptPointVector::const_iterator itrEnd = movePoints.end(); for (ScriptPointVector::const_iterator itr = movePoints.begin(); itr != itrEnd; ++itr) { Escort_Waypoint point(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a04e2ac0e48..f4f41ff6b5f 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1151,7 +1151,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damage += CalculateDamage(damageInfo->attackType, false, true); // Add melee damage bonus damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType); - damage = MeleeDamageBonusTaken(damage, damageInfo->attackType); + damage = damageInfo->target->MeleeDamageBonusTaken(damage, damageInfo->attackType); // Calculate armor reduction if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask))) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index e3d220d744f..c14e79dfe78 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -584,7 +584,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellFamilyFlags[0] & 0x8000 && m_spellInfo->SpellFamilyFlags[2] & 0x8) { // +80.53% from +spd bonus - DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8053f;; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8053f; } break; case SPELL_AURA_DUMMY: @@ -1263,7 +1263,7 @@ void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const caster->SendSpellDamageImmune(target, m_spellInfo->Id); } -void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) +void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const { bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp); if (prevented) @@ -6146,7 +6146,7 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* sLog->outDebug(LOG_FILTER_SPELLS_AURAS,"AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); } -void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) +void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const { if (!caster || !target->isAlive()) return; @@ -6288,7 +6288,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); } -void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) +void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const { if (!caster || !target->isAlive()) return; @@ -6388,7 +6388,7 @@ void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) caster->HealBySpell(target, GetSpellInfo(), damage); } -void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) +void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const { if (!caster || !target->isAlive()) return; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 77742e17e51..64079918638 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -83,7 +83,7 @@ class AuraEffect bool HasSpellClassMask() const { return m_spellInfo->Effects[m_effIndex].SpellClassMask; } void SendTickImmune(Unit* target, Unit* caster) const; - void PeriodicTick(AuraApplication * aurApp, Unit* caster); + void PeriodicTick(AuraApplication * aurApp, Unit* caster) const; void HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo); @@ -285,10 +285,10 @@ class AuraEffect void HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const; - void HandlePeriodicDamageAurasTick(Unit* target, Unit* caster); - void HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster); + void HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const; + void HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) const; - void HandlePeriodicHealAurasTick(Unit* target, Unit* caster); + void HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const; void HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) const; void HandleObsModPowerAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) const; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 06493dd070a..ba3e54075a1 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1652,7 +1652,7 @@ void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/) uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, uint32(damage), HEAL); - m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL);; + m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); } void Spell::EffectHealthLeech(SpellEffIndex effIndex) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 7732908ac47..e9e1b0eee8d 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1982,22 +1982,20 @@ uint32 SpellInfo::GetMaxTicks() const if (DotDuration > 30000) DotDuration = 30000; - uint8 x = 0; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + for (uint8 x = 0; x < MAX_SPELL_EFFECTS; x++) { - if (Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && ( - Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || - Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_HEAL || - Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - x = j; - break; - } + if (Effects[x].Effect == SPELL_EFFECT_APPLY_AURA) + switch (Effects[x].ApplyAuraName) + { + case SPELL_AURA_PERIODIC_DAMAGE: + case SPELL_AURA_PERIODIC_HEAL: + case SPELL_AURA_PERIODIC_LEECH: + if (Effects[x].Amplitude != 0) + return DotDuration / Effects[x].Amplitude; + break; + } } - if (Effects[x].Amplitude != 0) - return DotDuration / Effects[x].Amplitude; - return 6; } -- cgit v1.2.3 From d8a1a0e05ada916705388af91a7f533350df8d9c Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 11 May 2012 13:12:09 +0200 Subject: Scripts/Pit of Saron: Unlock passage to Tyrannus after first 2 bosses are down. --- .../PitOfSaron/instance_pit_of_saron.cpp | 27 ++++++++++++++++++++++ .../FrozenHalls/PitOfSaron/pit_of_saron.h | 1 + 2 files changed, 28 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 24529801564..02782a22452 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -23,6 +23,12 @@ Position const SlaveLeaderPos = {689.7158f, -104.8736f, 513.7360f, 0.0f}; // position for Jaina and Sylvanas Position const EventLeaderPos2 = {1054.368f, 107.14620f, 628.4467f, 0.0f}; +DoorData const Doors[] = +{ + {GO_ICE_WALL, DATA_GARFROST, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_ICE_WALL, DATA_ICK, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, +}; + class instance_pit_of_saron : public InstanceMapScript { public: @@ -33,6 +39,7 @@ class instance_pit_of_saron : public InstanceMapScript instance_pit_of_saron_InstanceScript(Map* map) : InstanceScript(map) { SetBossNumber(MAX_ENCOUNTER); + LoadDoorData(Doors); _garfrostGUID = 0; _krickGUID = 0; _ickGUID = 0; @@ -154,6 +161,26 @@ class instance_pit_of_saron : public InstanceMapScript } } + void OnGameObjectCreate(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_ICE_WALL: + AddDoor(go, true); + break; + } + } + + void OnGameObjectRemove(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_ICE_WALL: + AddDoor(go, false); + break; + } + } + bool SetBossState(uint32 type, EncounterState state) { if (!InstanceScript::SetBossState(type, state)) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h index 728e0ccd955..4252f4f59a8 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h @@ -90,6 +90,7 @@ enum CreatureIds enum GameObjectIds { GO_SARONITE_ROCK = 196485, + GO_ICE_WALL = 201885, }; #endif -- cgit v1.2.3 From 4e354d6ca90b8aead894e95c8a55151f9b90027b Mon Sep 17 00:00:00 2001 From: joschiwald Date: Fri, 11 May 2012 22:43:06 +0200 Subject: Core/Spells: fix damage mods from caster on target --- src/server/game/Entities/Unit/Unit.cpp | 32 +++++++++++------------ src/server/game/Entities/Unit/Unit.h | 6 ++--- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 14 +++++----- src/server/game/Spells/Auras/SpellAuras.cpp | 4 +-- src/server/game/Spells/SpellEffects.cpp | 26 +++++++++--------- src/server/scripts/Spells/spell_hunter.cpp | 2 +- src/server/scripts/Spells/spell_shaman.cpp | 2 +- src/server/scripts/Spells/spell_warrior.cpp | 2 +- 8 files changed, 44 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f4f41ff6b5f..1783db9b14e 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -954,7 +954,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID); SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask); damage = SpellDamageBonusDone(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE); - damage = victim->SpellDamageBonusTaken(spellInfo, damage, SPELL_DIRECT_DAMAGE); + damage = victim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE); CalculateSpellDamageTaken(&damageInfo, damage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); @@ -1151,7 +1151,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damage += CalculateDamage(damageInfo->attackType, false, true); // Add melee damage bonus damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType); - damage = damageInfo->target->MeleeDamageBonusTaken(damage, damageInfo->attackType); + damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType); // Calculate armor reduction if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask))) @@ -1405,7 +1405,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) if (Unit* caster = (*dmgShieldItr)->GetCaster()) { damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE); - damage = this->SpellDamageBonusTaken(i_spellProto, damage, SPELL_DIRECT_DAMAGE); + damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE); } // No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that @@ -3660,7 +3660,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId if (Unit* caster = aura->GetCaster()) { healAmount = caster->SpellHealingBonusDone(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); - healAmount = this->SpellHealingBonusTaken(aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); + healAmount = this->SpellHealingBonusTaken(caster, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); } CastCustomSpell(this, 33778, &healAmount, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); @@ -10806,7 +10806,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin return uint32(std::max(tmpDamage, 0.0f)); } -uint32 Unit::SpellDamageBonusTaken(SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) { if (!spellProto || damagetype == DIRECT_DAMAGE) return pdamage; @@ -10840,7 +10840,7 @@ uint32 Unit::SpellDamageBonusTaken(SpellInfo const* spellProto, uint32 pdamage, // From caster spells AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) + if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) AddPctN(TakenTotalMod, (*i)->GetAmount()); // Mod damage from spell mechanic @@ -11351,7 +11351,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui return uint32(std::max(heal, 0.0f)); } -uint32 Unit::SpellHealingBonusTaken(SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) { float TakenTotalMod = 1.0f; @@ -11425,7 +11425,7 @@ uint32 Unit::SpellHealingBonusTaken(SpellInfo const *spellProto, uint32 healamou AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) - if (GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) + if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) AddPctN(TakenTotalMod, (*i)->GetAmount()); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) @@ -11808,7 +11808,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType return uint32(std::max(tmpDamage, 0.0f)); } -uint32 Unit::MeleeDamageBonusTaken(uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto) +uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto) { if (pdamage == 0) return 0; @@ -11832,15 +11832,15 @@ uint32 Unit::MeleeDamageBonusTaken(uint32 pdamage, WeaponAttackType attType, Spe // ..taken TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask()); - // From caster spells - AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); - for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) - AddPctN(TakenTotalMod, (*i)->GetAmount()); - // .. taken pct (special attacks) if (spellProto) { + // From caster spells + AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); + for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) + if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) + AddPctN(TakenTotalMod, (*i)->GetAmount()); + // Mod damage from spell mechanic uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask(); @@ -14483,7 +14483,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); SpellNonMeleeDamage damageInfo(this, target, spellInfo->Id, spellInfo->SchoolMask); uint32 newDamage = SpellDamageBonusDone(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE); - newDamage = target->SpellDamageBonusTaken(spellInfo, newDamage, SPELL_DIRECT_DAMAGE); + newDamage = target->SpellDamageBonusTaken(this, spellInfo, newDamage, SPELL_DIRECT_DAMAGE); CalculateSpellDamageTaken(&damageInfo, newDamage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); SendSpellNonMeleeDamageLog(&damageInfo); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index e7ea70dc290..c3cfc415c41 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2038,14 +2038,14 @@ class Unit : public WorldObject int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask); int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask); uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); - uint32 SpellDamageBonusTaken(SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask); int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask); uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); - uint32 SpellHealingBonusTaken(SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL); - uint32 MeleeDamageBonusTaken(uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = NULL); + uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = NULL); bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index c14e79dfe78..bdbc5cb79d1 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -594,7 +594,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[1] & 0x400) { amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); - amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); + amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); } break; case SPELL_AURA_PERIODIC_DAMAGE: @@ -4968,7 +4968,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (caster) { heal = caster->SpellHealingBonusDone(target, GetSpellInfo(), heal, HEAL, stack); - heal = target->SpellHealingBonusTaken(GetSpellInfo(), heal, HEAL, stack); + heal = target->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, HEAL, stack); } target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID()); @@ -6198,7 +6198,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) { damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); - damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex())) @@ -6310,7 +6310,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c uint32 damage = std::max(GetAmount(), 0); damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); - damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); bool crit = IsPeriodicTickCrit(target, caster); if (crit) @@ -6353,7 +6353,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster); uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount())); - heal = uint32(caster->SpellHealingBonusTaken(GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount())); + heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount())); int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal); caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); @@ -6458,7 +6458,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const } damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); - damage = target->SpellHealingBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); } bool crit = IsPeriodicTickCrit(target, caster); @@ -6749,7 +6749,7 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv Unit* triggerTarget = eventInfo.GetProcTarget(); SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask); uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE); - damage = triggerTarget->SpellDamageBonusTaken(GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo()); target->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); target->SendSpellNonMeleeDamageLog(&damageInfo); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index b3169ce6fcc..4dda1c731a7 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1213,7 +1213,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1)) { uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT); - damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT); int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; int32 heal = int32(CalculatePctN(basepoints0, 15)); @@ -1228,7 +1228,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1)) { uint32 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL); - damage = target->SpellHealingBonusTaken(GetSpellInfo(), damage, HEAL); + damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, HEAL); int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index ba3e54075a1..b1a3cd687df 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -468,7 +468,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) { uint32 pdamage = uint32(std::max(aura->GetAmount(), 0)); pdamage = m_caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); - pdamage = unitTarget->SpellDamageBonusTaken(aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); + pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1)); uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude); damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir)); @@ -507,7 +507,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (m_spellInfo->SpellFamilyFlags[1] & 0x2) { int32 back_damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); - back_damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, (uint32)back_damage, SPELL_DIRECT_DAMAGE); + back_damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, (uint32)back_damage, SPELL_DIRECT_DAMAGE); // Pain and Suffering reduces damage if (AuraEffect* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0)) AddPctN(back_damage, -aurEff->GetAmount()); @@ -716,7 +716,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (m_originalCaster && damage > 0 && apply_direct_bonus) { damage = m_originalCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); - damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_originalCaster, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); } m_damage += damage; @@ -1397,7 +1397,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex) // add spell damage bonus damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); - damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) int32 power = damage; @@ -1562,7 +1562,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) if (Unit* auraCaster = targetAura->GetCaster()) { tickheal = auraCaster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); - tickheal = unitTarget->SpellHealingBonusTaken(targetAura->GetSpellInfo(), tickheal, DOT); + tickheal = unitTarget->SpellHealingBonusTaken(auraCaster, targetAura->GetSpellInfo(), tickheal, DOT); } //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included @@ -1588,7 +1588,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x2000000) { addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - addhealth = unitTarget->SpellHealingBonusTaken(m_spellInfo, addhealth, HEAL); + addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0)) { @@ -1606,7 +1606,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) else addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - addhealth = unitTarget->SpellHealingBonusTaken(m_spellInfo, addhealth, HEAL); + addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); // Remove Grievious bite if fully healed if (unitTarget->HasAura(48920) && (unitTarget->GetHealth() + addhealth >= unitTarget->GetMaxHealth())) @@ -1633,7 +1633,7 @@ void Spell::EffectHealPct(SpellEffIndex /*effIndex*/) return; uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL); - heal = unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); + heal = unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); m_healing += heal; } @@ -1652,7 +1652,7 @@ void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/) uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, uint32(damage), HEAL); - m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); + m_healing += unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); } void Spell::EffectHealthLeech(SpellEffIndex effIndex) @@ -1664,7 +1664,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) return; damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); - damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage); @@ -1677,7 +1677,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) if (m_caster->isAlive()) { healthGain = m_caster->SpellHealingBonusDone(m_caster, m_spellInfo, healthGain, HEAL); - healthGain = m_caster->SpellHealingBonusTaken(m_spellInfo, healthGain, HEAL); + healthGain = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, healthGain, HEAL); m_caster->HealBySpell(m_caster, m_spellInfo, uint32(healthGain)); } @@ -3543,7 +3543,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Add melee damage bonuses (also check for negative) uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo); - m_damage += unitTarget->MeleeDamageBonusTaken(damage, m_attackType, m_spellInfo); + m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damage, m_attackType, m_spellInfo); } void Spell::EffectThreat(SpellEffIndex /*effIndex*/) @@ -3588,7 +3588,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) if (m_originalCaster) { uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); + m_healing += unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); } } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 53a78e42c3c..896ed331bde 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -139,7 +139,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); ApplyPctN(basePoint, TickCount * 40); - basePoint = unitTarget->SpellDamageBonusTaken(aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); + basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. else if (familyFlag[1] & 0x00000080) diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 7e2756f28a5..f50dbb7773d 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -498,7 +498,7 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0)) AddPctN(damage, aurEff->GetAmount()); - damage = int32(target->SpellHealingBonusTaken(triggeringSpell, damage, HEAL)); + damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL)); } caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index bb271139b6a..194753d6e90 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -194,7 +194,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = damage / ticks; - damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); } -- cgit v1.2.3 From d770c125e97cf4313d2c32adbb6d9ceab308d477 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 12 May 2012 12:19:41 -0230 Subject: Core/Scripts: Fix Halls of Reflection Portcullis door in Pit of Saron. Now requires Tyrannus boss kill to open. --- sql/updates/world/2012_05_12_00_world_gameobject_template.sql | 2 ++ .../Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp | 7 +++++++ src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h | 1 + 3 files changed, 10 insertions(+) create mode 100644 sql/updates/world/2012_05_12_00_world_gameobject_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_12_00_world_gameobject_template.sql b/sql/updates/world/2012_05_12_00_world_gameobject_template.sql new file mode 100644 index 00000000000..ffa932c8640 --- /dev/null +++ b/sql/updates/world/2012_05_12_00_world_gameobject_template.sql @@ -0,0 +1,2 @@ +-- Lock Halls of Reflection Portcullis +UPDATE `gameobject_template` SET `flags`=18 WHERE `entry`=201848; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 02782a22452..c75bdb8095f 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -27,6 +27,7 @@ DoorData const Doors[] = { {GO_ICE_WALL, DATA_GARFROST, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, {GO_ICE_WALL, DATA_ICK, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_HALLS_OF_REFLECTION_PORTCULLIS, DATA_TYRANNUS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, }; class instance_pit_of_saron : public InstanceMapScript @@ -168,6 +169,9 @@ class instance_pit_of_saron : public InstanceMapScript case GO_ICE_WALL: AddDoor(go, true); break; + case GO_HALLS_OF_REFLECTION_PORTCULLIS: + AddDoor(go, true); + break; } } @@ -178,6 +182,9 @@ class instance_pit_of_saron : public InstanceMapScript case GO_ICE_WALL: AddDoor(go, false); break; + case GO_HALLS_OF_REFLECTION_PORTCULLIS: + AddDoor(go, true); + break; } } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h index 4252f4f59a8..768c3ba40ec 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h @@ -91,6 +91,7 @@ enum GameObjectIds { GO_SARONITE_ROCK = 196485, GO_ICE_WALL = 201885, + GO_HALLS_OF_REFLECTION_PORTCULLIS = 201848, }; #endif -- cgit v1.2.3 From 8a1417ae750765e1013f428545c8a49da6aa4e92 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 12 May 2012 12:23:21 -0230 Subject: Core/Scripts: Fix for previous --- .../scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index c75bdb8095f..fa7b027961c 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -183,7 +183,7 @@ class instance_pit_of_saron : public InstanceMapScript AddDoor(go, false); break; case GO_HALLS_OF_REFLECTION_PORTCULLIS: - AddDoor(go, true); + AddDoor(go, false); break; } } -- cgit v1.2.3 From fa3ee22849e5f1634caedd75c7d28f031839a1a3 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 12 May 2012 12:49:36 -0230 Subject: Core/Script: Optimize code for previous commit for Pit of Saron. --- .../Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index fa7b027961c..1301acf4c99 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -167,8 +167,6 @@ class instance_pit_of_saron : public InstanceMapScript switch (go->GetEntry()) { case GO_ICE_WALL: - AddDoor(go, true); - break; case GO_HALLS_OF_REFLECTION_PORTCULLIS: AddDoor(go, true); break; @@ -180,8 +178,6 @@ class instance_pit_of_saron : public InstanceMapScript switch (go->GetEntry()) { case GO_ICE_WALL: - AddDoor(go, false); - break; case GO_HALLS_OF_REFLECTION_PORTCULLIS: AddDoor(go, false); break; -- cgit v1.2.3 From 024a39af9f4c78dadadb5bfbde46ca1eaaf97f89 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 12 May 2012 21:11:41 +0200 Subject: Core: Tweaked ASSERT macro a bit - removed library assert as on Windows platforms it calls abort() and does not generaty crash dump files. --- src/server/shared/Debugging/Errors.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h index 6927fdb483f..48a8bda32ed 100755 --- a/src/server/shared/Debugging/Errors.h +++ b/src/server/shared/Debugging/Errors.h @@ -24,10 +24,10 @@ #include #include -#define WPAssert( assertion ) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError( "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); assert( #assertion &&0 ); ((void(*)())NULL)();} } -#define WPError( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); } -#define WPWarning( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); } -#define WPFatal( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); ACE_OS::sleep(10); assert( #assertion &&0 ); abort(); } +#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError("\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } } +#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError("%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } } +#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } } +#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } } #define ASSERT WPAssert #endif -- cgit v1.2.3 From 5709929d2b575e83f427c7f48cd6bd0d7ed1b29d Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 11:33:42 -0230 Subject: Core/Threat: Fix by faq. Turning gm on, now drops threat. Dead mobs no longer holds threat on player. Also fixed some Engrish. --- src/server/game/Combat/ThreatManager.cpp | 4 ++++ src/server/game/Entities/Creature/Creature.cpp | 10 +++++----- src/server/game/Entities/Unit/Unit.cpp | 9 ++++++--- src/server/game/Entities/Unit/Unit.h | 2 +- .../scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index e604eaf9024..104d2d3d52b 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -535,6 +535,10 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat setCurrentVictim(NULL); setDirty(true); } + if (getOwner() && getOwner()->IsInWorld()) + if (Unit* target = ObjectAccessor::GetUnit(*getOwner(), hostilRef->getUnitGuid())) + if (getOwner()->IsInMap(target)) + getOwner()->SendRemoveFromThreatListOpcode(hostilRef); iThreatContainer.remove(hostilRef); iThreatOfflineContainer.addReference(hostilRef); } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index acdf2b16f2a..d120713636d 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -468,9 +468,9 @@ void Creature::Update(uint32 diff) switch (m_deathState) { - case JUST_ALIVED: - // Must not be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. - sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)", GetGUIDLow(), GetEntry()); + case JUST_RESPAWNED: + // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting. + sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry()); break; case JUST_DIED: // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. @@ -1555,7 +1555,7 @@ void Creature::setDeathState(DeathState s) Unit::setDeathState(CORPSE); } - else if (s == JUST_ALIVED) + else if (s == JUST_RESPAWNED) { //if (isPet()) // setActive(true); @@ -1611,7 +1611,7 @@ void Creature::Respawn(bool force) CreatureTemplate const* cinfo = GetCreatureTemplate(); SelectLevel(cinfo); - setDeathState(JUST_ALIVED); + setDeathState(JUST_RESPAWNED); uint32 displayID = GetNativeDisplayId(); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1783db9b14e..18b4b79a502 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12823,9 +12823,8 @@ void Unit::setDeathState(DeathState s) { // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that // it can be used to check creation of death items (such as soul shards). - m_deathState = s; - if (s != ALIVE && s != JUST_ALIVED) + if (s != ALIVE && s != JUST_RESPAWNED) { CombatStop(); DeleteThreatList(); @@ -12868,8 +12867,12 @@ void Unit::setDeathState(DeathState s) if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript()) zoneScript->OnUnitDeath(this); } - else if (s == JUST_ALIVED) + else if (s == JUST_RESPAWNED) + { RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) + } + + m_deathState = s; } /*######################################## diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index c3cfc415c41..2d6c5b1a86e 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -465,7 +465,7 @@ enum DeathState JUST_DIED = 1, CORPSE = 2, DEAD = 3, - JUST_ALIVED = 4, + JUST_RESPAWNED = 4, }; enum UnitState diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 5b208768b0c..fab9a5f0740 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1290,7 +1290,7 @@ struct npc_argent_captainAI : public ScriptedAI if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead) { IsUndead = true; - me->setDeathState(JUST_ALIVED); + me->setDeathState(JUST_RESPAWNED); uint32 newEntry = 0; switch (me->GetEntry()) { diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index eb2d3187636..045ae5a6f9a 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1095,7 +1095,7 @@ class spell_item_shimmering_vessel : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { if (Creature* target = GetHitCreature()) - target->setDeathState(JUST_ALIVED); + target->setDeathState(JUST_RESPAWNED); } void Register() -- cgit v1.2.3 From 79a735fb01c3dc2c812f12a4c09612a1b2db942e Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 12 May 2012 13:21:05 +0200 Subject: Core/Spell: * Fix Spells with DmgClass SPELL_DAMAGE_CLASS_NONE * Fix SPELL_AURA_PERIODIC_HEAL calculation * Fix Swiftmend heal calculation * Fix some codestyle --- src/server/game/Entities/Unit/Unit.cpp | 50 ++++++++++++++--------- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Spells/SpellEffects.cpp | 3 -- 3 files changed, 32 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1783db9b14e..5f2f3bc2873 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11201,12 +11201,12 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui if (Unit* owner = GetOwner()) return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, stack); - // no bonus for heal potions/bandages + // No bonus healing for potion spells if (spellProto->SpellFamilyName == SPELLFAMILY_POTION) return healamount; - float DoneTotalMod = 1.0f; - int32 DoneTotal = 0; + float DoneTotalMod = 1.0f; + int32 DoneTotal = 0; // Healing done percent AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); @@ -11270,7 +11270,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui } // Done fixed damage bonus auras - int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask()); + int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask()); // Check for table values SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); @@ -11283,16 +11283,22 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui coeff = bonus->dot_damage; if (bonus->ap_dot_bonus > 0) DoneTotal += int32(bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue( - (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); + (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK)); } else { coeff = bonus->direct_damage; if (bonus->ap_bonus > 0) DoneTotal += int32(bonus->ap_bonus * stack * GetTotalAttackPowerValue( - (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); + (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK)); } } + else + { + // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default + if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + return healamount < 0 ? 0 : healamount; + } // Default calculation if (DoneAdvertisedBenefit) @@ -11320,11 +11326,11 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui } else { - // Earthliving - 0.45% of normal hot coeff - if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) - factorMod *= 0.45f; + // Earthliving - 0.45% of normal hot coeff + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) + factorMod *= 0.45f; - DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); + DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); } } @@ -11339,7 +11345,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui break; } if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) - DoneTotal = 0; + DoneTotal = 0; } // use float as more appropriate for negative values and percent applying @@ -11351,16 +11357,16 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui return uint32(std::max(heal, 0.0f)); } -uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) { - float TakenTotalMod = 1.0f; + float TakenTotalMod = 1.0f; // Healing taken percent - float minval = (float)GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); if (minval) AddPctF(TakenTotalMod, minval); - float maxval = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); if (maxval) AddPctF(TakenTotalMod, maxval); @@ -11369,7 +11375,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, u AddPctN(TakenTotalMod, Tenacity->GetAmount()); // Healing Done - int32 TakenTotal = 0; + int32 TakenTotal = 0; // Taken fixed damage bonus auras int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(spellProto->GetSchoolMask()); @@ -11386,11 +11392,11 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, u if (damagetype == DOT) { // Healing over time taken percent - float minval_hot = (float)GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT)); if (minval_hot) AddPctF(TakenTotalMod, minval_hot); - float maxval_hot = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT)); if (maxval_hot) AddPctF(TakenTotalMod, maxval_hot); } @@ -11401,6 +11407,12 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, u float factorMod = 1.0f; if (bonus) coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; + else + { + // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default + if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + return healamount < 0 ? 0 : healamount; + } // Default calculation if (TakenAdvertisedBenefit) @@ -11439,7 +11451,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, u break; } if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) - TakenTotal = 0; + TakenTotal = 0; } float heal = (int32(healamount) + TakenTotal) * TakenTotalMod; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index bdbc5cb79d1..7d245539c97 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -6457,7 +6457,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const damage += addition; } - damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index b1a3cd687df..352b91c635c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1560,10 +1560,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) int32 tickheal = targetAura->GetAmount(); if (Unit* auraCaster = targetAura->GetCaster()) - { tickheal = auraCaster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); - tickheal = unitTarget->SpellHealingBonusTaken(auraCaster, targetAura->GetSpellInfo(), tickheal, DOT); - } //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included -- cgit v1.2.3 From a1ff27a1c64d87717d0b0f65905ffff064329fb7 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 13 May 2012 17:47:12 +0200 Subject: Core/Threat: Some corrections to 5709929d2b575e83f427c7f48cd6bd0d7ed1b29d Fixes HandleChannelDeathItem (spells such as Drain Soul), which got broken by moving m_deathState = s, thanks Shauren --- src/server/game/Combat/ThreatManager.cpp | 5 +- src/server/game/Entities/Unit/Unit.cpp | 7 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 91 +++++++++++------------ 3 files changed, 46 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 104d2d3d52b..9737d4584ea 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -535,10 +535,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat setCurrentVictim(NULL); setDirty(true); } - if (getOwner() && getOwner()->IsInWorld()) - if (Unit* target = ObjectAccessor::GetUnit(*getOwner(), hostilRef->getUnitGuid())) - if (getOwner()->IsInMap(target)) - getOwner()->SendRemoveFromThreatListOpcode(hostilRef); + iOwner->SendRemoveFromThreatListOpcode(hostilRef); iThreatContainer.remove(hostilRef); iThreatOfflineContainer.addReference(hostilRef); } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e78c18ea3de..b1fcdf888c2 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12833,9 +12833,6 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) void Unit::setDeathState(DeathState s) { - // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that - // it can be used to check creation of death items (such as soul shards). - if (s != ALIVE && s != JUST_RESPAWNED) { CombatStop(); @@ -12880,9 +12877,7 @@ void Unit::setDeathState(DeathState s) zoneScript->OnUnitDeath(this); } else if (s == JUST_RESPAWNED) - { - RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) - } + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) m_deathState = s; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 7d245539c97..d28ba9e1e19 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5272,66 +5272,63 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod if (!(mode & AURA_EFFECT_HANDLE_REAL)) return; - if (!apply) - { - Unit* caster = GetCaster(); + if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH) + return; - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return; + Unit* caster = GetCaster(); + + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) + return; - Player* plCaster = caster->ToPlayer(); - Unit* target = aurApp->GetTarget(); + Player* plCaster = caster->ToPlayer(); + Unit* target = aurApp->GetTarget(); - if (target->getDeathState() != JUST_DIED) - return; + // Item amount + if (GetAmount() <= 0) + return; - // Item amount - if (GetAmount() <= 0) - return; + if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0) + return; - if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0) + // Soul Shard + if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265) + { + // Soul Shard only from units that grant XP or honor + if (!plCaster->isHonorOrXPTarget(target) || + (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster))) return; - // Soul Shard - if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265) + // If this is Drain Soul, check for Glyph of Drain Soul + if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) { - // Soul Shard only from units that grant XP or honor - if (!plCaster->isHonorOrXPTarget(target) || - (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster))) - return; - - // If this is Drain Soul, check for Glyph of Drain Soul - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) - { - // Glyph of Drain Soul - chance to create an additional Soul Shard - if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) - if (roll_chance_i(aur->GetMiscValue())) - caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) - } + // Glyph of Drain Soul - chance to create an additional Soul Shard + if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) + if (roll_chance_i(aur->GetMiscValue())) + caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) } + } - //Adding items - uint32 noSpaceForCount = 0; - uint32 count = m_amount; - - ItemPosCountVec dest; - InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount); - if (msg != EQUIP_ERR_OK) - { - count-=noSpaceForCount; - plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); - if (count == 0) - return; - } + //Adding items + uint32 noSpaceForCount = 0; + uint32 count = m_amount; - Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); - if (!newitem) - { - plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + ItemPosCountVec dest; + InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) + { + count-=noSpaceForCount; + plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); + if (count == 0) return; - } - plCaster->SendNewItem(newitem, count, true, true); } + + Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); + if (!newitem) + { + plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + return; + } + plCaster->SendNewItem(newitem, count, true, true); } void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const -- cgit v1.2.3 From e122f9fd30680433cb246d98f2666d1ddcdd0c02 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 13 May 2012 18:08:57 +0200 Subject: Core/Spell: * Fix Nourish heal calculation * Fix some codestyle --- src/server/game/Entities/Unit/Unit.cpp | 18 +++++++++--------- src/server/game/Spells/SpellEffects.cpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b1fcdf888c2..f79adb2b232 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10600,7 +10600,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin break; } } - break; + break; case SPELLFAMILY_PRIEST: // Mind Flay if (spellProto->SpellFamilyFlags[0] & 0x800000) @@ -10633,7 +10633,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) AddPctN(DoneTotalMod, aurEff->GetAmount()); } - break; + break; case SPELLFAMILY_PALADIN: // Judgement of Vengeance/Judgement of Corruption if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292) @@ -10651,7 +10651,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (stacks) AddPctU(DoneTotalMod, 10 * stacks); } - break; + break; case SPELLFAMILY_DRUID: // Thorns if (spellProto->SpellFamilyFlags[0] & 0x100) @@ -10660,7 +10660,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0)) AddPctN(DoneTotalMod, aurEff->GetAmount()); } - break; + break; case SPELLFAMILY_WARLOCK: // Fire and Brimstone if (spellProto->SpellFamilyFlags[1] & 0x00020040) @@ -10682,14 +10682,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (spellProto->SpellFamilyFlags[1] & 0x00400000 && isPet()) if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID())) AddPctN(DoneTotalMod, 15 * count); - break; + break; case SPELLFAMILY_HUNTER: // Steady Shot if (spellProto->SpellFamilyFlags[1] & 0x1) if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID())) AddPctN(DoneTotalMod, aurEff->GetAmount()); - break; + break; case SPELLFAMILY_DEATHKNIGHT: // Improved Icy Touch if (spellProto->SpellFamilyFlags[0] & 0x2) @@ -10730,7 +10730,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin } } } - break; + break; } // Done fixed damage bonus auras @@ -10751,7 +10751,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (bonus->ap_dot_bonus > 0) { WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK; - float APbonus = (float) victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS); + float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS)); APbonus += GetTotalAttackPowerValue(attType); DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus); } @@ -10762,7 +10762,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (bonus->ap_bonus > 0) { WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK; - float APbonus = (float) victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS); + float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS)); APbonus += GetTotalAttackPowerValue(attType); DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 352b91c635c..c306da9d43b 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1581,12 +1581,12 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) //addhealth += tickheal * tickcount; //addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth, HEAL, unitTarget); } - // Glyph of Nourish + // Nourish else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x2000000) { addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); + // Glyph of Nourish if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0)) { Unit::AuraEffectList const& Periodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL); -- cgit v1.2.3 From 42b0dfc94f9e9960a38024624f0a0f9886c5ccbd Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 14:36:24 -0230 Subject: Core/Scripts: Update text for Garfrost to creature_text. Added some missing text & added call for help to aggro. --- .../world/2012_05_13_00_world_creature_text.sql | 13 +++++++++ .../PitOfSaron/boss_forgemaster_garfrost.cpp | 33 ++++++++++++++-------- 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 sql/updates/world/2012_05_13_00_world_creature_text.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_13_00_world_creature_text.sql b/sql/updates/world/2012_05_13_00_world_creature_text.sql new file mode 100644 index 00000000000..8d083156fb0 --- /dev/null +++ b/sql/updates/world/2012_05_13_00_world_creature_text.sql @@ -0,0 +1,13 @@ +-- NPC talk text insert from sniff +DELETE FROM `creature_text` WHERE `entry`=36494; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(36494,0,0, 'Tiny creatures under feet, you bring Garfrost something good to eat!',14,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,1,0, 'Axe too weak. Garfrost make better and CRUSH YOU.',14,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,2,0, 'Garfrost tired of puny mortals. Now your bones will freeze!',14,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,3,0, 'Garfrost hope giant underpants clean. Save boss great shame. For later.',14,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,4,0, 'Will save for snack. For later.',12,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,4,1, 'That one maybe not so good to eat now. Stupid Garfrost! BAD! BAD!',12,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,5,0, '%s hurls a massive saronite boulder at you!',16,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,6,0, '%s casts |cFF00AACCDeep Freeze|r at $n.',41,0,100,0,0,0, 'Forgemaster Garfrost'); +-- Remove old script text +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1658006 AND -1658001; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 64609efd7ff..a3b8c5df4e7 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -20,14 +20,15 @@ enum Yells { - SAY_AGGRO = -1658001, - SAY_SLAY_1 = -1658002, - SAY_SLAY_2 = -1658003, - SAY_DEATH = -1658004, - SAY_PHASE2 = -1658005, - SAY_PHASE3 = -1658006, - - SAY_TYRANNUS_DEATH = -1658007, + SAY_AGGRO = 0, + SAY_PHASE2 = 1, + SAY_PHASE3 = 2, + SAY_DEATH = 3, + SAY_SLAY = 4, + SAY_THROW_SARONITE = 5, + SAY_CAST_DEEP_FREEZE = 6, + + SAY_TYRANNUS_DEATH = -1658007, // todo }; enum Spells @@ -107,8 +108,9 @@ class boss_garfrost : public CreatureScript void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); DoCast(me, SPELL_PERMAFROST); + me->CallForHelp(70.0f); events.ScheduleEvent(EVENT_THROW_SARONITE, 7000); instance->SetBossState(DATA_GARFROST, IN_PROGRESS); @@ -117,12 +119,13 @@ class boss_garfrost : public CreatureScript void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER) - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); + if (Creature* tyrannus = me->GetCreature(*me, instance->GetData64(DATA_TYRANNUS))) DoScriptText(SAY_TYRANNUS_DEATH, tyrannus); @@ -134,6 +137,7 @@ class boss_garfrost : public CreatureScript if (events.GetPhaseMask() & PHASE_ONE_MASK && !HealthAbovePct(66)) { events.SetPhase(PHASE_TWO); + Talk(SAY_PHASE2); events.DelayEvents(8000); DoCast(me, SPELL_THUNDERING_STOMP); events.ScheduleEvent(EVENT_JUMP, 1500); @@ -143,6 +147,7 @@ class boss_garfrost : public CreatureScript if (events.GetPhaseMask() & PHASE_TWO_MASK && !HealthAbovePct(33)) { events.SetPhase(PHASE_THREE); + Talk(SAY_PHASE3); events.DelayEvents(8000); DoCast(me, SPELL_THUNDERING_STOMP); events.ScheduleEvent(EVENT_JUMP, 1500); @@ -199,7 +204,10 @@ class boss_garfrost : public CreatureScript { case EVENT_THROW_SARONITE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + Talk(SAY_THROW_SARONITE); DoCast(target, SPELL_THROW_SARONITE); + } events.ScheduleEvent(EVENT_THROW_SARONITE, urand(12500, 20000)); break; case EVENT_CHILLING_WAVE: @@ -208,7 +216,10 @@ class boss_garfrost : public CreatureScript break; case EVENT_DEEP_FREEZE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + Talk(SAY_CAST_DEEP_FREEZE); DoCast(target, SPELL_DEEP_FREEZE); + } events.ScheduleEvent(EVENT_DEEP_FREEZE, 35000, 0, PHASE_THREE); break; case EVENT_JUMP: -- cgit v1.2.3 From fa7e9d3c0d492cbf5e4563d8292674145dfef5a0 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 15:14:32 -0230 Subject: Core/Scripts: And some Gameobject enums for future scripting of Blackrock Spire. --- .../BlackrockSpire/blackrock_spire.h | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h index e51c6b9130d..cef08375c13 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h @@ -61,7 +61,34 @@ enum AdditionalData enum GameObjects { - GO_WHELP_SPAWNER = 175622, //trap spawned by go id 175124 + GO_WHELP_SPAWNER = 175622, // trap spawned by go id 175124 + + // Doors + GO_EMBERSEER_IN = 175244, // First door to Pyroguard Emberseer + GO_DOORS = 175705, // Second door to Pyroguard Emberseer + GO_EMBERSEER_OUT = 175153, // Door after Pyroguard Emberseer event + GO_GYTH_ENTRY_DOOR = 164726, + GO_GYTH_COMBAT_DOOR = 175185, + GO_GYTH_EXIT_DOOR = 175186, + GO_DRAKKISATH_DOOR_1 = 175946, + GO_DRAKKISATH_DOOR_2 = 175947, + + // Runes + GO_ROOM_1_RUNE = 175197, + GO_ROOM_2_RUNE = 175199, + GO_ROOM_3_RUNE = 175195, + GO_ROOM_4_RUNE = 175200, + GO_ROOM_5_RUNE = 175198, + GO_ROOM_6_RUNE = 175196, + GO_ROOM_7_RUNE = 175194, + + GO_EMBERSEER_RUNE_1 = 175266, + GO_EMBERSEER_RUNE_2 = 175267, + GO_EMBERSEER_RUNE_3 = 175268, + GO_EMBERSEER_RUNE_4 = 175269, + GO_EMBERSEER_RUNE_5 = 175270, + GO_EMBERSEER_RUNE_6 = 175271, + GO_EMBERSEER_RUNE_7 = 175272, }; #endif -- cgit v1.2.3 From ede623b473199426e736fc12829c283a9f181587 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 13 May 2012 21:07:59 +0200 Subject: Core/Spell: * Fix SPELL_DAMAGE_CLASS_NONE calculation for SpellHealingBonusTaken * Fix some codestyles --- src/server/game/Entities/Unit/Unit.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f79adb2b232..5b0a3820b0e 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10814,11 +10814,11 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui int32 TakenTotal = 0; float TakenTotalMod = 1.0f; - //from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN - //multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) + // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN + // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask()); - //.. taken pct: dummy auras + //.. taken pct: dummy auras AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY); for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { @@ -11411,7 +11411,10 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u { // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + { + healamount = int32(healamount * TakenTotalMod); return healamount < 0 ? 0 : healamount; + } } // Default calculation @@ -11820,7 +11823,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType return uint32(std::max(tmpDamage, 0.0f)); } -uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto) +uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto) { if (pdamage == 0) return 0; -- cgit v1.2.3 From e144b8e3bef87a55791188f6578e176e28e9bdd7 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 20:30:11 -0230 Subject: DB/creature_text: Added creature text for Boss Sara. --- sql/updates/world/2012_05_13_01_world_creature_text.sql | 14 ++++++++++++++ .../scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp | 14 ++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 sql/updates/world/2012_05_13_01_world_creature_text.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_13_01_world_creature_text.sql b/sql/updates/world/2012_05_13_01_world_creature_text.sql new file mode 100644 index 00000000000..8e983fd9a73 --- /dev/null +++ b/sql/updates/world/2012_05_13_01_world_creature_text.sql @@ -0,0 +1,14 @@ +-- NPC talk text insert for Sara +DELETE FROM `creature_text` WHERE `entry`=33134; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(33134,0,0, 'Help me! Please get them off me!',14,0,100,0,0,15771, 'Sara YELL_PREFIGHT'), +(33134,0,1, 'What do you want from me? Leave me alone!',14,0,100,0,0,15772, 'Sara YELL_PREFIGHT'), +(33134,1,0, 'Yes! YES! Show them no mercy! Give no pause to your attacks!',14,0,100,0,0,15773, 'Sara YELL_COMBAT_PHASE_1'), +(33134,1,1, 'Let hatred and rage guide your blows!',14,0,100,0,0,15774, 'Sara YELL_COMBAT_PHASE_1'), +(33134,1,2, 'The time to strike at the head of the beast will soon be upon us! Focus your anger and hatred on his minions!',14,0,100,457,0,15775, 'Sara YELL_COMBAT_PHASE_1'), +(33134,2,0, 'Suffocate upon your own hate!',14,0,100,0,0,15776, 'Sara YELL_COMBAT_PHASE_2'), +(33134,2,1, 'Tremble, mortals, before the coming of the end!',14,0,100,0,0,15777, 'Sara YELL_COMBAT_PHASE_2'), +(33134,3,0, 'Powerless to act...',14,0,100,0,0,15778, 'Sara YELL_SLAY'), +(33134,3,1, 'Could they have been saved?',14,0,100,0,0,15779, 'YELL SAY_SLAY'); +-- remove script text +DELETE FROM script_texts WHERE entry BETWEEN -1603319 AND -1603310; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index 3f01f21b189..585967ebdcc 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -20,16 +20,10 @@ enum Sara_Yells { - SAY_SARA_PREFIGHT_1 = -1603310, - SAY_SARA_PREFIGHT_2 = -1603311, - SAY_SARA_AGGRO_1 = -1603312, - SAY_SARA_AGGRO_2 = -1603313, - SAY_SARA_AGGRO_3 = -1603314, - SAY_SARA_SLAY_1 = -1603315, - SAY_SARA_SLAY_2 = -1603316, - WHISP_SARA_INSANITY = -1603317, - SAY_SARA_PHASE2_1 = -1603318, - SAY_SARA_PHASE2_2 = -1603319, + YELL_SARA_PREFIGHT = 0, + YELL_COMBAT_PHASE_1 = 1, + YELL_COMBAT_PHASE_2 = 2, + YELL_SLAY = 3, }; enum YoggSaron_Yells -- cgit v1.2.3 From 72d00c476ca6b6e2d48f5fdfaae48bf383e44ef0 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 21:43:37 -0230 Subject: Core/scripts: Add spell enums for boss sara. --- .../scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index 585967ebdcc..948ca58e446 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -18,12 +18,27 @@ #include "ScriptMgr.h" #include "ulduar.h" -enum Sara_Yells +enum Sara { + // text YELL_SARA_PREFIGHT = 0, YELL_COMBAT_PHASE_1 = 1, YELL_COMBAT_PHASE_2 = 2, YELL_SLAY = 3, + + // Phase 1 spells + SPELL_SARAS_BLESSING = 63745, // Target Self + SPELL_SARAS_ANGER = 63147, // Target Entry 33136 + SPELL_SARAS_ANGER = 63744, // Target Entry 33136 + SPELL_SARAS_FEVOR = 63138, // Target Player + SPELL_SARAS_FEVOR = 63747, // Target Player + SPELL_SARAS_BLESSING = 63134, // Target Player + + // Phase 2 spells + SPELL_PHYCHOSIS = 63795, // Target Self + SPELL_MALADY_OF_THE_MIND = 63830, // Target Self + SPELL_DEATH_RAY = 63891, // Target Self + SPELL_BRAIN_LINK = 63802, // Target Self }; enum YoggSaron_Yells -- cgit v1.2.3 From 1a06e197fd7d908ff62b801176cc3797306b07cd Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 13 May 2012 19:39:06 -0500 Subject: Core/Spells: Proc the spells that have DEST target when there is no other target info Closes #6443 Closes #6277 Closes #6331 Signed-off-by: Subv --- src/server/game/Spells/Spell.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 28b089f91cd..48aa40a0e51 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3427,6 +3427,20 @@ void Spell::_handle_immediate_phase() // process items for (std::list::iterator ihit= m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) DoAllEffectOnTarget(&(*ihit)); + + if (!m_originalCaster) + return; + // Handle procs on cast + // TODO: finish new proc system:P + if (m_UniqueTargetInfo.empty() && m_targets.HasDst()) + { + uint32 procAttacker = m_procAttacker; + if (!procAttacker) + procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; + + // Proc the spells that have DEST target + m_originalCaster->ProcDamageAndSpell(NULL, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell); + } } void Spell::_handle_finish_phase() -- cgit v1.2.3 From 25f1c5a51da26f30fe251e326e68168985102b6f Mon Sep 17 00:00:00 2001 From: Xanvial Date: Mon, 14 May 2012 12:15:57 +0700 Subject: Core/Spell : Glyph of Totem of Wrath Spell bonus granted by glyph should calculated based from summoned totem, not from player's aura --- src/server/game/Entities/Unit/Unit.cpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f79adb2b232..90c8ffaae63 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7366,30 +7366,16 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (procSpell->SpellIconID != 2019) return false; - AuraEffect* aurEffA = NULL; - AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE); - for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + if (Creature* totem = GetMap()->GetCreature(m_SummonSlot[1])) // Fire totem summon slot { - SpellInfo const* spell = (*i)->GetSpellInfo(); - if (spell->SpellFamilyName == uint32(SPELLFAMILY_SHAMAN) && spell->SpellFamilyFlags.HasFlag(0, 0x02000000, 0)) + if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0])) { - if ((*i)->GetCasterGUID() != GetGUID()) - continue; - if (spell->Id == 63283) - continue; - aurEffA = (*i); - break; + int32 bp0 = CalculatePctN(totemSpell->Effects[EFFECT_0].CalcValue(), triggerAmount); + int32 bp1 = CalculatePctN(totemSpell->Effects[EFFECT_1].CalcValue(), triggerAmount); + CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true); + return true; } } - if (aurEffA) - { - int32 bp0 = 0, bp1 = 0; - bp0 = CalculatePctN(triggerAmount, aurEffA->GetAmount()); - if (AuraEffect* aurEffB = aurEffA->GetBase()->GetEffect(EFFECT_1)) - bp1 = CalculatePctN(triggerAmount, aurEffB->GetAmount()); - CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true, NULL, triggeredByAura); - return true; - } return false; } break; -- cgit v1.2.3 From 06c4917568a43cd85a40b07eb82f273af2053050 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Mon, 14 May 2012 07:18:06 -0230 Subject: Cote/Scripts: Fix build for boss_yoggsaron --- .../scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index 948ca58e446..58ba125b994 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -27,12 +27,12 @@ enum Sara YELL_SLAY = 3, // Phase 1 spells - SPELL_SARAS_BLESSING = 63745, // Target Self - SPELL_SARAS_ANGER = 63147, // Target Entry 33136 - SPELL_SARAS_ANGER = 63744, // Target Entry 33136 - SPELL_SARAS_FEVOR = 63138, // Target Player - SPELL_SARAS_FEVOR = 63747, // Target Player - SPELL_SARAS_BLESSING = 63134, // Target Player + SPELL_SARAS_ANGER_1 = 63147, // Target Entry 33136 + SPELL_SARAS_ANGER_2 = 63744, // Target Entry 33136 + SPELL_SARAS_FEVOR_1 = 63138, // Target Player + SPELL_SARAS_FEVOR_2 = 63747, // Target Player + SPELL_SARAS_BLESSING_1 = 63134, // Target Player + SPELL_SARAS_BLESSING_2 = 63745, // Target Self // Phase 2 spells SPELL_PHYCHOSIS = 63795, // Target Self -- cgit v1.2.3 From 548ac10879701b5eda9d8d369e9fbd470418ce8d Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 14 May 2012 14:11:02 -0400 Subject: Core/Entities: fix calculations for damage taken/done with negative values (should go into effect) and correctly implement SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS. small cleanup --- src/server/game/Entities/Unit/Unit.cpp | 74 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5b0a3820b0e..359e2145112 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10407,20 +10407,24 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet()) DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + // Some spells don't benefit from pct done mods + if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) { - if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) - continue; - - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if ((*i)->GetSpellInfo()->EquippedItemClass == -1) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) - AddPctN(DoneTotalMod, (*i)->GetAmount()); + if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) + continue; + + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + { + if ((*i)->GetSpellInfo()->EquippedItemClass == -1) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + } } } @@ -10792,12 +10796,6 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotalMod = 1.0f; } - // Some spells don't benefit from pct done mods - // maybe should be implemented like SPELL_ATTR3_NO_DONE_BONUS, - // but then it may break spell power coeffs work on spell 31117 - if (spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) - DoneTotalMod = 1.0f; - float tmpDamage = (int32(pdamage) + DoneTotal) * DoneTotalMod; // apply spellmod to Done damage (flat and pct) if (Player* modOwner = GetSpellModOwner()) @@ -10918,7 +10916,7 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) DoneAdvertisedBenefit += int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount())); } - return DoneAdvertisedBenefit > 0 ? DoneAdvertisedBenefit : 0; + return DoneAdvertisedBenefit; } int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) @@ -10930,7 +10928,7 @@ int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) if (((*i)->GetMiscValue() & schoolMask) != 0) TakenAdvertisedBenefit += (*i)->GetAmount(); - return TakenAdvertisedBenefit > 0 ? TakenAdvertisedBenefit : 0; + return TakenAdvertisedBenefit; } bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const @@ -11197,7 +11195,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damag uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) { // For totems get healing bonus from owner (statue isn't totem in fact) - if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem()) + if (GetTypeId() == TYPEID_UNIT && isTotem()) if (Unit* owner = GetOwner()) return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, stack); @@ -11297,7 +11295,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui { // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) - return healamount < 0 ? 0 : healamount; + return healamount; } // Default calculation @@ -11413,7 +11411,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) { healamount = int32(healamount * TakenTotalMod); - return healamount < 0 ? 0 : healamount; + return healamount; } } @@ -11648,10 +11646,7 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto) { - if (!victim) - return 0; - - if (pdamage == 0) + if (!victim || pdamage == 0) return 0; uint32 creatureTypeMask = victim->GetCreatureTypeMask(); @@ -11708,20 +11703,23 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType // Done total percent damage auras float DoneTotalMod = 1.0f; - // ..done - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + // Some spells don't benefit from pct done mods + if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) { - if (spellProto) + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) + if (spellProto) { - if ((*i)->GetSpellInfo()->EquippedItemClass == -1) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) - AddPctN(DoneTotalMod, (*i)->GetAmount()); + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) + { + if ((*i)->GetSpellInfo()->EquippedItemClass == -1) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + } } } } -- cgit v1.2.3 From 06e019b72225e824711fc41b6f4d0443b715b8cc Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 14 May 2012 14:23:21 -0400 Subject: Core/Entities: move spellproto check to the outside of the forloop to not has crashes --- src/server/game/Entities/Unit/Unit.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 359e2145112..3c10243e6b1 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11704,12 +11704,11 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType float DoneTotalMod = 1.0f; // Some spells don't benefit from pct done mods - if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) - { - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + if (spellProto) + if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) { - if (spellProto) + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) { @@ -11722,7 +11721,6 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType } } } - } AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i) -- cgit v1.2.3 From cd06bb93773b9e788067e1a73bbd75ad01937c64 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 14 May 2012 15:14:40 -0400 Subject: Core/Spells: fix possible crash from not having any effect and trying to check if immune. fixes non effect spell mechanic checking for spells with both spell mechanics and effect mechanics --- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3c10243e6b1..bf4911223b8 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11569,7 +11569,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) } // Spells that don't have effectMechanics. - if (!spellInfo->HasAnyEffectMechanic() && spellInfo->Mechanic) + if (spellInfo->Mechanic) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) @@ -11609,7 +11609,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - if (!spellInfo) + if (!spellInfo || !spellInfo->Effects[index]) return false; // If m_immuneToEffect type contain this effect type, IMMUNE effect. uint32 effect = spellInfo->Effects[index].Effect; -- cgit v1.2.3 From 124c65ad80af46c73541dcad9066e3314155f1a8 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 14 May 2012 15:28:31 -0400 Subject: fix compile warnings from 548ac10 --- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bf4911223b8..5f448567b16 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10408,7 +10408,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); // Some spells don't benefit from pct done mods - if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) @@ -11705,7 +11705,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType // Some spells don't benefit from pct done mods if (spellProto) - if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) -- cgit v1.2.3 From b72c690905d6dc650b6322c0054cd3faa85c80ea Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 15 May 2012 00:03:18 +0200 Subject: Fixed compile --- src/server/game/Entities/Unit/Unit.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5f448567b16..f80175b74d2 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11528,7 +11528,7 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) return false; uint32 shoolMask = spellInfo->GetSchoolMask(); - if (spellInfo->Id != 42292 && spellInfo->Id !=59752) + if (spellInfo->Id != 42292 && spellInfo->Id != 59752) { // If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; @@ -11588,10 +11588,11 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) break; } } + if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects. return true; - if (spellInfo->Id != 42292 && spellInfo->Id !=59752) + if (spellInfo->Id != 42292 && spellInfo->Id != 59752) { SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) @@ -11609,8 +11610,9 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - if (!spellInfo || !spellInfo->Effects[index]) + if (!spellInfo || !spellInfo->Effects[index].IsEffect()) return false; + // If m_immuneToEffect type contain this effect type, IMMUNE effect. uint32 effect = spellInfo->Effects[index].Effect; SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT]; -- cgit v1.2.3 From 648321e1212c3e2a002df0b4509f2b097a330153 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 15 May 2012 13:26:15 -0400 Subject: Core/Spelld: fix target selection for ground based aoe spells. use the center of the cast (dynamic object) instead of the caster for checking los --- src/server/game/Entities/Unit/Unit.cpp | 6 +++--- src/server/game/Entities/Unit/Unit.h | 2 +- src/server/game/Grids/Notifiers/GridNotifiers.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f80175b74d2..14184b1606d 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12254,7 +12254,7 @@ bool Unit::IsValidAttackTarget(Unit const* target) const } // function based on function Unit::CanAttack from 13850 client -bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const +bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj) const { ASSERT(target); @@ -12272,8 +12272,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target)) return false; - // can't attack invisible (ignore stealth for aoe spells) - if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea())) + // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit. + if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))) return false; // can't attack dead diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 2d6c5b1a86e..f246f595dec 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1573,7 +1573,7 @@ class Unit : public WorldObject bool isTargetableForAttack(bool checkFakeDeath = true) const; bool IsValidAttackTarget(Unit const* target) const; - bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const; + bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = NULL) const; bool IsValidAssistTarget(Unit const* target) const; bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 6ca31b22e37..7bb4492f99c 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -943,7 +943,7 @@ namespace Trinity if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem()) return false; - if (i_funit->_IsValidAttackTarget(u, _spellInfo) && i_obj->IsWithinDistInMap(u, i_range)) + if (i_funit->_IsValidAttackTarget(u, _spellInfo,i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range)) return true; return false; -- cgit v1.2.3 From c05c16a8dee97a485e0d6a4e73c750e1d140f227 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 15 May 2012 15:07:53 -0400 Subject: Core/Spells: more immunities fixes! mechanics are supposed to be checked for finding out if immune to the entire spell. --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 14184b1606d..f1e5f05bd35 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11582,7 +11582,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) { // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately - if (spellInfo->Effects[i].Mechanic || !IsImmunedToSpellEffect(spellInfo, i)) + if (!IsImmunedToSpellEffect(spellInfo, i)) { immuneToAllEffects = false; break; -- cgit v1.2.3 From b90cb5878de2afc621c0b9ebc86066c2b827f428 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 15 May 2012 23:14:47 +0200 Subject: Core/Spell: Fix SpellDamageBonusTaken calculation for negative value --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f1e5f05bd35..aaba0102f55 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10875,7 +10875,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod); } - float tmpDamage = (pdamage + TakenTotal) * TakenTotalMod; + float tmpDamage = (int32(pdamage) + TakenTotal) * TakenTotalMod; return uint32(std::max(tmpDamage, 0.0f)); } -- cgit v1.2.3 From c70792df02858a93c156ac00b4a1fdd366c994ec Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 16 May 2012 08:47:43 -0400 Subject: Core/Scripting: add the ability to access loot/go state changed events for gameobjects from cpp scripting. (malcrom's idea) --- src/server/game/Entities/GameObject/GameObject.cpp | 2 ++ src/server/game/Scripting/ScriptMgr.cpp | 16 ++++++++++++++++ src/server/game/Scripting/ScriptMgr.h | 8 ++++++++ 3 files changed, 26 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index e871f99b38c..10136c5fbd7 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1910,6 +1910,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) { m_lootState = state; AI()->OnStateChanged(state, unit); + sScriptMgr->OnGameObjectLootStateChanged(this, state, unit); if (m_model) { // startOpen determines whether we are going to add or remove the LoS on activation @@ -1929,6 +1930,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) void GameObject::SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); + sScriptMgr->OnGameObjectStateChanged(this, state); if (m_model) { if (!IsInWorld()) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 01d56cf8060..23d18e12097 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -937,6 +937,22 @@ void ScriptMgr::OnGameObjectDamaged(GameObject* go, Player* player) tmpscript->OnDamaged(go, player); } +void ScriptMgr::OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit) +{ + ASSERT(go); + + GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript); + tmpscript->OnLootStateChanged(go, state, unit); +} + +void ScriptMgr::OnGameObjectStateChanged(GameObject* go, uint32 state) +{ + ASSERT(go); + + GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript); + tmpscript->OnGameObjectStateChanged(go, state); +} + void ScriptMgr::OnGameObjectUpdate(GameObject* go, uint32 diff) { ASSERT(go); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 6fe058d336a..b3d445af0c6 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -473,6 +473,12 @@ class GameObjectScript : public ScriptObject, public UpdatableScript // Called when the game object is damaged (destructible buildings only). virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { } + // Called when the game object loot state is changed. + virtual void OnLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { } + + // Called when the game object state is changed. + virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { } + // Called when a GameObjectAI object is needed for the gameobject. virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return NULL; } }; @@ -914,6 +920,8 @@ class ScriptMgr uint32 GetDialogStatus(Player* player, GameObject* go); void OnGameObjectDestroyed(GameObject* go, Player* player); void OnGameObjectDamaged(GameObject* go, Player* player); + void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit); + void OnGameObjectStateChanged(GameObject* go, uint32 state); void OnGameObjectUpdate(GameObject* go, uint32 diff); GameObjectAI* GetGameObjectAI(GameObject* go); -- cgit v1.2.3 From ac844f99537dc9867242269f63c3cd58be96e1b2 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Wed, 16 May 2012 12:30:37 -0230 Subject: Core/Scripts: Scripting of Dragonspire Hall Runes "UBRS" Additional work to do. --- sql/updates/world/2012_05_16_00_world_scripts.sql | 2 ++ .../BlackrockSpire/blackrock_spire.h | 1 + .../BlackrockSpire/instance_blackrock_spire.cpp | 23 ++++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 sql/updates/world/2012_05_16_00_world_scripts.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_16_00_world_scripts.sql b/sql/updates/world/2012_05_16_00_world_scripts.sql new file mode 100644 index 00000000000..9997c09bd8d --- /dev/null +++ b/sql/updates/world/2012_05_16_00_world_scripts.sql @@ -0,0 +1,2 @@ +-- Add script to Dragonspire Hall Runes "UBRS" +UPDATE `gameobject_template` SET `ScriptName`= 'go_dragonspire_hall_rune' WHERE `entry` BETWEEN 175194 AND 175200; diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h index cef08375c13..beef71ea857 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h @@ -57,6 +57,7 @@ enum AdditionalData { SPELL_SUMMON_ROOKERY_WHELP = 15745, MAX_ENCOUNTER = 14, + MAX_DRAGONSPIRE_HALL_RUNES = 7, }; enum GameObjects diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp index ff97984fa09..b5b1b34a593 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp @@ -247,7 +247,30 @@ public: }; +uint8 ActivatedRunes = 0; + +class go_dragonspire_hall_rune : public GameObjectScript +{ +public: + go_dragonspire_hall_rune() : GameObjectScript("go_dragonspire_hall_rune") { } + + void OnGameObjectStateChanged(GameObject* go, uint32 state) + { + if (state == GO_STATE_READY) + { + if (++ActivatedRunes == MAX_DRAGONSPIRE_HALL_RUNES) + { + if (GameObject* door1 = GetClosestGameObjectWithEntry(go, GO_EMBERSEER_IN, 150.0f)) + door1->SetGoState(GO_STATE_ACTIVE); + if (GameObject* door2 = GetClosestGameObjectWithEntry(go, GO_DOORS, 150.0f)) + door2->SetGoState(GO_STATE_ACTIVE); + } + } + } +}; + void AddSC_instance_blackrock_spire() { new instance_blackrock_spire(); + new go_dragonspire_hall_rune; } -- cgit v1.2.3 From ea4815b52806aa41ad015b314c8caff9ff2e2a6f Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 16 May 2012 11:05:11 -0400 Subject: Core/Spells: change spell bonus damage taken pdamage to float to match melee damage bonus taken --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index aaba0102f55..9438d9f7860 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10875,7 +10875,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod); } - float tmpDamage = (int32(pdamage) + TakenTotal) * TakenTotalMod; + float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod; return uint32(std::max(tmpDamage, 0.0f)); } -- cgit v1.2.3 From 619fdd185b2b59d886697d1cdbf71ac843982f66 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 17 May 2012 09:40:44 -0400 Subject: Core/Spells: fix deep wounds damage. thanks warpten. --- src/server/scripts/Spells/spell_warrior.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 194753d6e90..3d348a41e76 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -180,9 +180,6 @@ class spell_warr_deep_wounds : public SpellScriptLoader if (Unit* target = GetHitUnit()) if (Unit* caster = GetCaster()) { - // apply percent damage mods - damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); @@ -194,8 +191,6 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = damage / ticks; - damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); } } -- cgit v1.2.3 From c6aa41cc1050bf637669c633024cd82270bd64a7 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 17 May 2012 10:29:36 -0400 Subject: Core/Spells: Revert previous commit. add exception for deep wounds in pct done aura modifiers. clean up heal bonus code to use the correct numerical types. --- src/server/game/Entities/Unit/Unit.cpp | 10 +++++----- src/server/scripts/Spells/spell_warrior.cpp | 27 ++++++++++++++++----------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 9438d9f7860..6622e3b1e31 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10408,7 +10408,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); // Some spells don't benefit from pct done mods - if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162))) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) @@ -11347,7 +11347,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui } // use float as more appropriate for negative values and percent applying - float heal = (int32(healamount) + DoneTotal) * DoneTotalMod; + float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod; // apply spellmod to Done amount if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal); @@ -11410,7 +11410,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) { - healamount = int32(healamount * TakenTotalMod); + healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f)); return healamount; } } @@ -11455,7 +11455,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u TakenTotal = 0; } - float heal = (int32(healamount) + TakenTotal) * TakenTotalMod; + float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod; return uint32(std::max(heal, 0.0f)); } @@ -11707,7 +11707,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType // Some spells don't benefit from pct done mods if (spellProto) - if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162))) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 3d348a41e76..08583f51c21 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -177,22 +177,27 @@ class spell_warr_deep_wounds : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { int32 damage = GetEffectValue(); + Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) - if (Unit* caster = GetCaster()) - { - ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); + { + // apply percent damage mods + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); - uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; + ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); - // Add remaining ticks to damage done - if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID())) - damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); + uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; - damage = damage / ticks; + // Add remaining ticks to damage done + if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID())) + damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); - caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); - } + damage = damage / ticks; + + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + + caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); + } } void Register() -- cgit v1.2.3 From 63010fe77b4eea4461c01ffd8a3f2a0841bdd220 Mon Sep 17 00:00:00 2001 From: kandera Date: Thu, 17 May 2012 14:04:57 -0300 Subject: Core/Spells: calculate damagebonustaken for target before adding the damage left from the previous aura. thx @zwerg --- src/server/scripts/Spells/spell_warrior.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 08583f51c21..0ba5c866d63 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -184,7 +184,9 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); - + + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; @@ -194,8 +196,6 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = damage / ticks; - damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); } } -- cgit v1.2.3 From 9e6a5593bdab8ab9d301ec5373cd639025f4a790 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 10:25:14 -0400 Subject: Core/Spells: if doneadvertisedbenefit is 0 gift of the naaru will never get the ap bonus. moved outside the check to fix. --- src/server/game/Entities/Unit/Unit.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6622e3b1e31..a4d02ee5ea1 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11313,23 +11313,21 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui coeff /= 100.0f; } - // Gift of the Naaru - if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329) - { - int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK))); - if (apBonus > DoneAdvertisedBenefit) - DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick - else - DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick - } - else - { - // Earthliving - 0.45% of normal hot coeff - if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) - factorMod *= 0.45f; + // Earthliving - 0.45% of normal hot coeff + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) + factorMod *= 0.45f; - DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); - } + DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); + } + + // Gift of the Naaru + if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329) + { + int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK))); + if (apBonus > DoneAdvertisedBenefit) + DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick + else + DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick } for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) -- cgit v1.2.3 From 7688c7609f6686c2a045860c10d9502b3af5f055 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 11:44:38 -0400 Subject: Core/Spells: remove holy shock and death coil (dk) from checkcast and add them to the checkcast of the spell script. also check if unit is in front for damage spell of death coil (dk) Closes #6027 --- src/server/game/Spells/Spell.cpp | 17 ++--------------- src/server/scripts/Spells/spell_dk.cpp | 17 +++++++++++++++++ src/server/scripts/Spells/spell_paladin.cpp | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 48aa40a0e51..aef0a8ad3b3 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3427,7 +3427,7 @@ void Spell::_handle_immediate_phase() // process items for (std::list::iterator ihit= m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) DoAllEffectOnTarget(&(*ihit)); - + if (!m_originalCaster) return; // Handle procs on cast @@ -3437,7 +3437,7 @@ void Spell::_handle_immediate_phase() uint32 procAttacker = m_procAttacker; if (!procAttacker) procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; - + // Proc the spells that have DEST target m_originalCaster->ProcDamageAndSpell(NULL, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell); } @@ -4991,19 +4991,6 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; } - else if (m_spellInfo->SpellIconID == 156) // Holy Shock - { - // spell different for friends and enemies - // hurt version required facing - if (m_targets.GetUnitTarget() && !m_caster->IsFriendlyTo(m_targets.GetUnitTarget()) && !m_caster->HasInArc(static_cast(M_PI), m_targets.GetUnitTarget())) - return SPELL_FAILED_UNIT_NOT_INFRONT; - } - else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] == 0x2000) // Death Coil (DeathKnight) - { - Unit* target = m_targets.GetUnitTarget(); - if (!target || (target->IsFriendlyTo(m_caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)) - return SPELL_FAILED_BAD_TARGETS; - } else if (m_spellInfo->Id == 19938) // Awaken Peon { Unit* unit = m_targets.GetUnitTarget(); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 13190ed013f..8f0ef118e71 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -750,6 +750,23 @@ class spell_dk_death_coil : public SpellScriptLoader } } + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + { + if (!caster->IsFriendlyTo(target) && !caster->isInFront(target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + + if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD) + return SPELL_FAILED_BAD_TARGETS; + } + else + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; + } + void Register() { OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index cf8cae68c58..4baa1eb3735 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -289,8 +289,18 @@ class spell_pal_holy_shock : public SpellScriptLoader { Player* caster = GetCaster()->ToPlayer(); if (Unit* target = GetExplTargetUnit()) - if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) - return SPELL_FAILED_BAD_TARGETS; + { + if (!caster->IsFriendlyTo(target)) + { + if (!caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; + + if (!caster->isInFront(target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + } + } + else + return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } -- cgit v1.2.3 From edf1de6d936b531b05d3384f156b8cc15448313f Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 11:56:23 -0400 Subject: Core/Spells: move rocket boots spell cast check to spell script. add event for checkcast for deathcoil (dk) heh i forgot it >.< --- src/server/game/Spells/Spell.cpp | 7 +------ src/server/scripts/Spells/spell_dk.cpp | 1 + src/server/scripts/Spells/spell_item.cpp | 8 ++++++++ 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index aef0a8ad3b3..b27326fce59 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4986,12 +4986,7 @@ SpellCastResult Spell::CheckCast(bool strict) { case SPELL_EFFECT_DUMMY: { - if (m_spellInfo->Id == 51582) // Rocket Boots Engaged - { - if (m_caster->IsInWater()) - return SPELL_FAILED_ONLY_ABOVEWATER; - } - else if (m_spellInfo->Id == 19938) // Awaken Peon + if (m_spellInfo->Id == 19938) // Awaken Peon { Unit* unit = m_targets.GetUnitTarget(); if (!unit || !unit->HasAura(17743)) diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 8f0ef118e71..36dcb53ad00 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -769,6 +769,7 @@ class spell_dk_death_coil : public SpellScriptLoader void Register() { + OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 045ae5a6f9a..33e266e1326 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1748,8 +1748,16 @@ class spell_item_rocket_boots : public SpellScriptLoader caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL); } + SpellCastResult CheckCast() + { + if (GetCaster()->IsInWater()) + return SPELL_FAILED_ONLY_ABOVEWATER; + return SPELL_CAST_OK; + } + void Register() { + OnCheckCast += SpellCheckCastFn(spell_item_rocket_boots_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_item_rocket_boots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; -- cgit v1.2.3 From 01b2bf80575d1a115f88928bf7c4e17ba573c890 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 12:09:35 -0400 Subject: Core/Spells, DB/Conditions: convert checkcast cpp to conditions for spell 52264 (deliver stolen horse) --- sql/updates/world/2012_05_18_00_world_conditions.sql | 3 +++ src/server/game/Spells/Spell.cpp | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) create mode 100644 sql/updates/world/2012_05_18_00_world_conditions.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_18_00_world_conditions.sql b/sql/updates/world/2012_05_18_00_world_conditions.sql new file mode 100644 index 00000000000..a1de19ced35 --- /dev/null +++ b/sql/updates/world/2012_05_18_00_world_conditions.sql @@ -0,0 +1,3 @@ +DELETE FROM `conditions` WHERE `SourceEntry` = 52264; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,52264,0,0,29,0,28653,5,0,0,97,NULL,"Creature conditions for spell 52264 (Deliver stolen horse)"); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index b27326fce59..ae9f68f594c 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4992,11 +4992,6 @@ SpellCastResult Spell::CheckCast(bool strict) if (!unit || !unit->HasAura(17743)) return SPELL_FAILED_BAD_TARGETS; } - else if (m_spellInfo->Id == 52264) // Deliver Stolen Horse - { - if (!m_caster->FindNearestCreature(28653, 5)) - return SPELL_FAILED_OUT_OF_RANGE; - } else if (m_spellInfo->Id == 31789) // Righteous Defense { if (m_caster->GetTypeId() != TYPEID_PLAYER) -- cgit v1.2.3 From e897bb59f74178c60ce24153e35d1ad4eb230ad9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 12:25:13 -0400 Subject: Core/SpellEffects: successful dispel effects on hostile targets should put you in combat. Closes #656 Closes #678 --- src/server/game/Spells/SpellEffects.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c306da9d43b..51f37ec5920 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2610,6 +2610,9 @@ void Spell::EffectDispel(SpellEffIndex effIndex) } m_caster->SendMessageToSet(&dataSuccess, true); + if (m_caster->IsValidAttackTarget(unitTarget) && !m_caster->isInCombat()) + m_caster->CombatStart(unitTarget); + // On success dispel // Devour Magic if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == SPELLCATEGORY_DEVOUR_MAGIC) @@ -3539,7 +3542,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Add melee damage bonuses (also check for negative) uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo); - + m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damage, m_attackType, m_spellInfo); } -- cgit v1.2.3 From 1037f96e4f9a788cc450fd429ce5f2b0fcc29790 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 12:31:13 -0400 Subject: Core/Spells: Damage should be dealt AFTER m_damage has been set. possibly fixes scourge strike damage calculations. --- src/server/game/Spells/Spell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ae9f68f594c..758769b36a4 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2475,15 +2475,16 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); } - caster->DealSpellDamage(&damageInfo, true); - // Haunt if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1)) { AuraEffect* aurEff = m_spellAura->GetEffect(1); aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage)); } + m_damage = damageInfo.damage; + + caster->DealSpellDamage(&damageInfo, true); } // Passive spell hits/misses or active spells only misses (only triggers) else -- cgit v1.2.3 From d1e0dc3fe0c95f78ef261d19c956faf8d3f70a35 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 13:49:59 -0400 Subject: Core/Spells: fix dispel aggro in a less hacky way! --- src/server/game/Spells/Spell.cpp | 2 +- src/server/game/Spells/SpellEffects.cpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 758769b36a4..de432229e2c 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2505,7 +2505,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) } } - if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && !m_spellInfo->IsPositive()) + if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) { m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO)); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 51f37ec5920..07bea5f980c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2610,9 +2610,6 @@ void Spell::EffectDispel(SpellEffIndex effIndex) } m_caster->SendMessageToSet(&dataSuccess, true); - if (m_caster->IsValidAttackTarget(unitTarget) && !m_caster->isInCombat()) - m_caster->CombatStart(unitTarget); - // On success dispel // Devour Magic if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == SPELLCATEGORY_DEVOUR_MAGIC) -- cgit v1.2.3 From 881138553b1a85fda62cc131dc6487195e49a2d1 Mon Sep 17 00:00:00 2001 From: Elron103 Date: Fri, 18 May 2012 21:23:07 +0200 Subject: Core/Spells: Fix immunity checking for creatures (i.e. Mind Control) --- src/server/game/Entities/Creature/Creature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index d120713636d..6506a113ae1 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1668,8 +1668,8 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) if (!spellInfo) return false; - // Spells that don't have effectMechanics. - if (!spellInfo->HasAnyEffectMechanic() && GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1))) + // Creature is immune to main mechanic of the spell + if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1))) return true; // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break -- cgit v1.2.3 From fc0950dbf33e6a4a9797be46bfe2e7dd2366d9e1 Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 19 May 2012 11:48:41 +0100 Subject: SQLS: Correct comments for 2012_02_16_00_world_conditions.sql (Core/Opcs: Use Handle_NULL for an unused opcode) Closes #6517 (pr) --- sql/updates/world/2012_02_16_00_world_conditions.sql | 10 +++++----- src/server/game/Server/Protocol/Opcodes.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/sql/updates/world/2012_02_16_00_world_conditions.sql b/sql/updates/world/2012_02_16_00_world_conditions.sql index a01792ef838..5bef38fc485 100644 --- a/sql/updates/world/2012_02_16_00_world_conditions.sql +++ b/sql/updates/world/2012_02_16_00_world_conditions.sql @@ -4,8 +4,8 @@ CREATE TABLE `temp_convert_spells` PRIMARY KEY (`id`) ); -# spells with EffectImplicitTarget In (6,21, 25) + spells having Targets & 1115534 -# those spells are the ones which require explicit unit target to cast +-- spells with EffectImplicitTarget In (6,21, 25) + spells having Targets & 1115534 +-- those spells are the ones which require explicit unit target to cast INSERT INTO `temp_convert_spells` VALUES (5), (11), @@ -12783,13 +12783,13 @@ INSERT IGNORE INTO `temp_item_spell` SELECT `entry`, `spellid_5` FROM `item_temp INSERT INTO `temp_cond_vals` (`spellId`, `entry`, `dead`, `errorTextId`, `comment`) SELECT DISTINCT (SELECT `spellId` FROM `temp_item_spell` WHERE `itemId` = `SourceEntry`), `ConditionValue2`, (`ConditionValue1` - 1), `ErrorTextId`, `Comment` FROM `conditions` WHERE `SourceTypeOrReferenceId` = 18; -#use CONDITION_OBJECT_ENTRY instead of CONDITION_ITEM_TARGET +-- use CONDITION_OBJECT_ENTRY instead of CONDITION_ITEM_TARGET INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `Comment`) SELECT DISTINCT 17, 0, `spellId`, 0, `elseGroup` - 1, 31, 1, 3, `entry`, 0, 0, `errorTextId`, `comment` FROM `temp_cond_vals`; -#for CONDITION_ITEM_TARGET with ConditionValue1 = DEAD we're adding !CONDITION_ALIVE as a second requirement +-- for CONDITION_ITEM_TARGET with ConditionValue1 = DEAD we're adding !CONDITION_ALIVE as a second requirement INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `Comment`) SELECT DISTINCT 17, 0, `spellId`, 0, `elseGroup` - 1, 36, 1, 0, 0, 0, 1, `errorTextId`, `comment` FROM `temp_cond_vals` WHERE `dead`; -#remove entries which could be converted by this sql +-- remove entries which could be converted by this sql DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 18 AND `SourceEntry` IN (SELECT `itemId` FROM `temp_item_spell`); DROP TABLE `temp_convert_spells`; DROP TABLE `temp_cond_vals`; diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index aa6013fae3d..63ee2369ce3 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -491,7 +491,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x1CE*/ { "CMSG_QUERY_TIME", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQueryTimeOpcode }, /*0x1CF*/ { "SMSG_QUERY_TIME_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x1D0*/ { "SMSG_LOG_XPGAIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x1D2*/ { "CMSG_RECLAIM_CORPSE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReclaimCorpseOpcode }, /*0x1D3*/ { "CMSG_WRAP_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleWrapItemOpcode }, /*0x1D4*/ { "SMSG_LEVELUP_INFO", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, -- cgit v1.2.3 From c3287fee0636e9beee460bdb9d3ddbaa34631504 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sat, 19 May 2012 13:04:58 +0200 Subject: Core/SmartAI: - Improve an error msg in ProcessAction - Allow dist/angle to be 0.0f and set default if negative when using SMART_ACTION_FOLLOW - Some minor cleanup in Opcodes.cpp, all smsg's should have Handle_ServerSide --- src/server/game/AI/SmartScripts/SmartAI.cpp | 6 +++--- src/server/game/AI/SmartScripts/SmartScript.cpp | 2 +- src/server/game/Server/Protocol/Opcodes.cpp | 10 +++++----- src/server/game/Server/WorldSession.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 2a412bffb22..08f1b18ffad 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -804,12 +804,12 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui return; SetRun(mRun); mFollowGuid = target->GetGUID(); - mFollowDist = dist ? dist : PET_FOLLOW_DIST; - mFollowAngle = angle ? angle : me->GetFollowAngle(); + mFollowDist = dist >= 0.0f ? dist : PET_FOLLOW_DIST; + mFollowAngle = angle >= 0.0f ? angle : me->GetFollowAngle(); mFollowArrivedTimer = 1000; mFollowCredit = credit; mFollowArrivedEntry = end; - me->GetMotionMaster()->MoveFollow(target, dist, angle); + me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle); mFollowCreditType = creditType; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 893c8f4580e..85b117ccd8c 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1925,7 +1925,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; } default: - sLog->outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType()); + sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; } diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 63ee2369ce3..517935acbd2 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -270,8 +270,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x0F1*/ { "MSG_MOVE_KNOCK_BACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x0F2*/ { "SMSG_MOVE_FEATHER_FALL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x0F3*/ { "SMSG_MOVE_NORMAL_FALL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x0F4*/ { "SMSG_MOVE_SET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, - /*0x0F5*/ { "SMSG_MOVE_UNSET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x0F4*/ { "SMSG_MOVE_SET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x0F5*/ { "SMSG_MOVE_UNSET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x0F6*/ { "CMSG_MOVE_HOVER_ACK", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleMoveHoverAck }, /*0x0F7*/ { "MSG_MOVE_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x0F8*/ { "CMSG_TRIGGER_CINEMATIC_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, @@ -491,7 +491,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x1CE*/ { "CMSG_QUERY_TIME", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQueryTimeOpcode }, /*0x1CF*/ { "SMSG_QUERY_TIME_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x1D0*/ { "SMSG_LOG_XPGAIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x1D2*/ { "CMSG_RECLAIM_CORPSE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReclaimCorpseOpcode }, /*0x1D3*/ { "CMSG_WRAP_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleWrapItemOpcode }, /*0x1D4*/ { "SMSG_LEVELUP_INFO", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, @@ -970,7 +970,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3AD*/ { "MSG_MOVE_UPDATE_CAN_FLY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x3AE*/ { "MSG_RAID_READY_CHECK_CONFIRM", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x3AF*/ { "CMSG_VOICE_SESSION_ENABLE", STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleVoiceSessionEnableOpcode }, - /*0x3B0*/ { "SMSG_VOICE_SESSION_ENABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x3B0*/ { "SMSG_VOICE_SESSION_ENABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3B1*/ { "SMSG_VOICE_PARENTAL_CONTROLS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3B2*/ { "CMSG_GM_WHISPER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x3B3*/ { "SMSG_GM_MESSAGECHAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, @@ -1023,7 +1023,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3E2*/ { "SMSG_COMSAT_CONNECT_FAIL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3E3*/ { "SMSG_VOICE_CHAT_STATUS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3E4*/ { "CMSG_REPORT_PVP_AFK", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReportPvPAFK }, - /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3E6*/ { "CMSG_GUILD_BANKER_ACTIVATE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildBankerActivate }, /*0x3E7*/ { "CMSG_GUILD_BANK_QUERY_TAB", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildBankQueryTab }, /*0x3E8*/ { "SMSG_GUILD_BANK_LIST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 0fce0a372ff..bb54a0ae19e 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -395,7 +395,7 @@ class WorldSession public: // opcodes handlers void Handle_NULL(WorldPacket& recvPacket); // not used - void Handle_EarlyProccess(WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead + void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client void Handle_Deprecated(WorldPacket& recvPacket); // never used anymore by client -- cgit v1.2.3 From 524e30e57b4a743f1ebd964f06657487d437d0f4 Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Sat, 19 May 2012 15:09:23 +0100 Subject: Scripts/kalimdor: Use proper headers to optimize compile, code style and general cleanup. Closes #6419 (pr) --- src/server/scripts/EasternKingdoms/undercity.cpp | 6 +- src/server/scripts/Kalimdor/ashenvale.cpp | 196 +++++++------ src/server/scripts/Kalimdor/azshara.cpp | 225 ++++++++------- src/server/scripts/Kalimdor/azuremyst_isle.cpp | 186 ++++++------- src/server/scripts/Kalimdor/bloodmyst_isle.cpp | 16 +- src/server/scripts/Kalimdor/boss_azuregos.cpp | 119 ++++---- src/server/scripts/Kalimdor/darkshore.cpp | 135 ++++----- src/server/scripts/Kalimdor/desolace.cpp | 27 +- src/server/scripts/Kalimdor/durotar.cpp | 20 +- src/server/scripts/Kalimdor/dustwallow_marsh.cpp | 61 ++-- src/server/scripts/Kalimdor/felwood.cpp | 25 +- src/server/scripts/Kalimdor/feralas.cpp | 6 +- src/server/scripts/Kalimdor/moonglade.cpp | 212 +++++++------- src/server/scripts/Kalimdor/mulgore.cpp | 171 ++++++------ src/server/scripts/Kalimdor/orgrimmar.cpp | 53 ++-- src/server/scripts/Kalimdor/silithus.cpp | 32 +-- .../scripts/Kalimdor/stonetalon_mountains.cpp | 6 +- src/server/scripts/Kalimdor/tanaris.cpp | 306 +++++++++++---------- src/server/scripts/Kalimdor/teldrassil.cpp | 17 +- src/server/scripts/Kalimdor/the_barrens.cpp | 100 +++---- src/server/scripts/Kalimdor/thousand_needles.cpp | 85 +++--- src/server/scripts/Kalimdor/thunder_bluff.cpp | 67 ++--- src/server/scripts/Kalimdor/ungoro_crater.cpp | 117 ++++---- src/server/scripts/Kalimdor/winterspring.cpp | 4 +- .../Ulduar/Ulduar/boss_algalon_the_observer.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 2 +- src/server/scripts/Spells/spell_shaman.cpp | 2 +- 27 files changed, 1116 insertions(+), 1082 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index d5896812007..a9b627ded34 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -184,7 +184,7 @@ public: { if (Unit* victim = me->getVictim()) { - DoCast(me->getVictim(), SPELL_BLACK_ARROW); + DoCast(victim, SPELL_BLACK_ARROW); BlackArrowTimer = 15000 + rand()%5000; } } else BlackArrowTimer -= diff; @@ -193,7 +193,7 @@ public: { if (Unit* victim = me->getVictim()) { - DoCast(me->getVictim(), SPELL_SHOT); + DoCast(victim, SPELL_SHOT); ShotTimer = 8000 + rand()%2000; } } else ShotTimer -= diff; @@ -202,7 +202,7 @@ public: { if (Unit* victim = me->getVictim()) { - DoCast(me->getVictim(), SPELL_MULTI_SHOT); + DoCast(victim, SPELL_MULTI_SHOT); MultiShotTimer = 10000 + rand()%3000; } } else MultiShotTimer -= diff; diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp index cec5e42aee5..e28665c038e 100644 --- a/src/server/scripts/Kalimdor/ashenvale.cpp +++ b/src/server/scripts/Kalimdor/ashenvale.cpp @@ -28,7 +28,8 @@ npc_torek npc_ruul_snowhoof EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*#### @@ -78,32 +79,31 @@ class npc_torek : public CreatureScript void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 1: - Talk(SAY_MOVE, player->GetGUID()); - break; - case 8: - Talk(SAY_PREPARE, player->GetGUID()); - break; - case 19: - //TODO: verify location and creatures amount. - me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 20: - DoScriptText(SAY_WIN, me, player); - Completed = true; - player->GroupEventHappens(QUEST_TOREK_ASSULT, me); - break; - case 21: - Talk(SAY_END, player->GetGUID()); - break; + switch (waypointId) + { + case 1: + Talk(SAY_MOVE, player->GetGUID()); + break; + case 8: + Talk(SAY_PREPARE, player->GetGUID()); + break; + case 19: + //TODO: verify location and creatures amount. + me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 20: + DoScriptText(SAY_WIN, me, player); + Completed = true; + player->GroupEventHappens(QUEST_TOREK_ASSULT, me); + break; + case 21: + Talk(SAY_END, player->GetGUID()); + break; + } } } @@ -169,8 +169,26 @@ class npc_torek : public CreatureScript # npc_ruul_snowhoof ####*/ -#define QUEST_FREEDOM_TO_RUUL 6482 -#define GO_CAGE 178147 +enum RuulSnowhoof +{ + NPC_THISTLEFUR_URSA = 3921, + NPC_THISTLEFUR_TOTEMIC = 3922, + NPC_THISTLEFUR_PATHFINDER = 3926, + + QUEST_FREEDOM_TO_RUUL = 6482, + + GO_CAGE = 178147 +}; + +Position const RuulSnowhoofSummonsCoord[6] = +{ + {3449.218018f, -587.825073f, 174.978867f, 4.714445f}, + {3446.384521f, -587.830872f, 175.186279f, 4.714445f}, + {3444.218994f, -587.835327f, 175.380600f, 4.714445f}, + {3508.344482f, -492.024261f, 186.929031f, 4.145029f}, + {3506.265625f, -490.531006f, 186.740128f, 4.239277f}, + {3503.682373f, -489.393799f, 186.629684f, 4.349232f} +}; class npc_ruul_snowhoof : public CreatureScript { @@ -195,14 +213,14 @@ class npc_ruul_snowhoof : public CreatureScript Cage->SetGoState(GO_STATE_ACTIVE); break; case 13: - me->SummonCreature(3922, 3449.218018f, -587.825073f, 174.978867f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3921, 3446.384521f, -587.830872f, 175.186279f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3926, 3444.218994f, -587.835327f, 175.380600f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[0], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[1], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[2], TEMPSUMMON_DEAD_DESPAWN, 60000); break; case 19: - me->SummonCreature(3922, 3508.344482f, -492.024261f, 186.929031f, 4.145029f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3921, 3506.265625f, -490.531006f, 186.740128f, 4.239277f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3926, 3503.682373f, -489.393799f, 186.629684f, 4.349232f, TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[3], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[4], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[5], TEMPSUMMON_DEAD_DESPAWN, 60000); break; case 21: player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me); @@ -214,8 +232,7 @@ class npc_ruul_snowhoof : public CreatureScript void Reset() { - GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20); - if (Cage) + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) Cage->SetGoState(GO_STATE_READY); } @@ -249,7 +266,7 @@ class npc_ruul_snowhoof : public CreatureScript } }; -enum eEnums +enum Muglash { SAY_MUG_START1 = -1800054, SAY_MUG_START2 = -1800055, @@ -278,21 +295,21 @@ enum eEnums NPC_MUGLASH = 12717 }; -static float m_afFirstNagaCoord[3][3]= +Position const FirstNagaCoord[3] = { - {3603.504150f, 1122.631104f, 1.635f}, // rider - {3589.293945f, 1148.664063f, 5.565f}, // sorceress - {3609.925537f, 1168.759521f, -1.168f} // razortail + {3603.504150f, 1122.631104f, 1.635f, 0.0f}, // rider + {3589.293945f, 1148.664063f, 5.565f, 0.0f}, // sorceress + {3609.925537f, 1168.759521f, -1.168f, 0.0f} // razortail }; -static float m_afSecondNagaCoord[3][3]= +Position const SecondNagaCoord[3] = { - {3609.925537f, 1168.759521f, -1.168f}, // witch - {3645.652100f, 1139.425415f, 1.322f}, // priest - {3583.602051f, 1128.405762f, 2.347f} // myrmidon + {3609.925537f, 1168.759521f, -1.168f, 0.0f}, // witch + {3645.652100f, 1139.425415f, 1.322f, 0.0f}, // priest + {3583.602051f, 1128.405762f, 2.347f, 0.0f} // myrmidon }; -static float m_fVorshaCoord[]={3633.056885f, 1172.924072f, -5.388f}; +Position const VorshaCoord = {3633.056885f, 1172.924072f, -5.388f, 0.0f}; class npc_muglash : public CreatureScript { @@ -303,9 +320,9 @@ class npc_muglash : public CreatureScript { npc_muglashAI(Creature* creature) : npc_escortAI(creature) { } - uint32 m_uiWaveId; - uint32 m_uiEventTimer; - bool m_bIsBrazierExtinguished; + uint8 WaveId; + uint32 EventTimer; + bool IsBrazierExtinguished; void JustSummoned(Creature* summoned) { @@ -314,34 +331,33 @@ class npc_muglash : public CreatureScript void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 0: - if (player) + switch (waypointId) + { + case 0: DoScriptText(SAY_MUG_START2, me, player); - break; - case 24: - if (player) + break; + case 24: DoScriptText(SAY_MUG_BRAZIER, me, player); - if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2)) - { - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - SetEscortPaused(true); - } - break; - case 25: - DoScriptText(SAY_MUG_GRATITUDE, me); - player->GroupEventHappens(QUEST_VORSHA, me); - break; - case 26: - DoScriptText(SAY_MUG_PATROL, me); - break; - case 27: - DoScriptText(SAY_MUG_RETURN, me); - break; + if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2)) + { + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + SetEscortPaused(true); + } + break; + case 25: + DoScriptText(SAY_MUG_GRATITUDE, me); + player->GroupEventHappens(QUEST_VORSHA, me); + break; + case 26: + DoScriptText(SAY_MUG_PATROL, me); + break; + case 27: + DoScriptText(SAY_MUG_RETURN, me); + break; + } } } @@ -358,9 +374,9 @@ class npc_muglash : public CreatureScript void Reset() { - m_uiEventTimer = 10000; - m_uiWaveId = 0; - m_bIsBrazierExtinguished = false; + EventTimer = 10000; + WaveId = 0; + IsBrazierExtinguished = false; } void JustDied(Unit* /*killer*/) @@ -372,20 +388,20 @@ class npc_muglash : public CreatureScript void DoWaveSummon() { - switch (m_uiWaveId) + switch (WaveId) { case 1: - me->SummonCreature(NPC_WRATH_RIDER, m_afFirstNagaCoord[0][0], m_afFirstNagaCoord[0][1], m_afFirstNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_SORCERESS, m_afFirstNagaCoord[1][0], m_afFirstNagaCoord[1][1], m_afFirstNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_RAZORTAIL, m_afFirstNagaCoord[2][0], m_afFirstNagaCoord[2][1], m_afFirstNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_RIDER, FirstNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_SORCERESS, FirstNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_RAZORTAIL, FirstNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 2: - me->SummonCreature(NPC_WRATH_PRIESTESS, m_afSecondNagaCoord[0][0], m_afSecondNagaCoord[0][1], m_afSecondNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_MYRMIDON, m_afSecondNagaCoord[1][0], m_afSecondNagaCoord[1][1], m_afSecondNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_SEAWITCH, m_afSecondNagaCoord[2][0], m_afSecondNagaCoord[2][1], m_afSecondNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_PRIESTESS, SecondNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_MYRMIDON, SecondNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_SEAWITCH, SecondNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 3: - me->SummonCreature(NPC_VORSHA, m_fVorshaCoord[0], m_fVorshaCoord[1], m_fVorshaCoord[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_VORSHA, VorshaCoord, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 4: SetEscortPaused(false); @@ -400,16 +416,16 @@ class npc_muglash : public CreatureScript if (!me->getVictim()) { - if (HasEscortState(STATE_ESCORT_PAUSED) && m_bIsBrazierExtinguished) + if (HasEscortState(STATE_ESCORT_PAUSED) && IsBrazierExtinguished) { - if (m_uiEventTimer < uiDiff) + if (EventTimer < uiDiff) { - ++m_uiWaveId; + ++WaveId; DoWaveSummon(); - m_uiEventTimer = 10000; + EventTimer = 10000; } else - m_uiEventTimer -= uiDiff; + EventTimer -= uiDiff; } return; } @@ -451,7 +467,7 @@ class go_naga_brazier : public GameObjectScript { DoScriptText(SAY_MUG_BRAZIER_WAIT, creature); - pEscortAI->m_bIsBrazierExtinguished = true; + pEscortAI->IsBrazierExtinguished = true; return false; } } diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp index 2e7b0a684c1..eae5baa8db2 100644 --- a/src/server/scripts/Kalimdor/azshara.cpp +++ b/src/server/scripts/Kalimdor/azshara.cpp @@ -30,9 +30,9 @@ mob_rizzle_sprysprocket mob_depth_charge EndContentData */ -#include "ScriptPCH.h" -#include "World.h" -#include "WorldPacket.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## mobs_spitelashes @@ -179,9 +179,12 @@ public: # mob_rizzle_sprysprocket ####*/ -enum eRizzleSprysprocketData +enum RizzleSprysprocketData { + QUEST_CHASING_THE_MOONSTONE = 10994, + MOB_DEPTH_CHARGE = 23025, + SPELL_RIZZLE_BLACKJACK = 39865, SPELL_RIZZLE_ESCAPE = 39871, SPELL_RIZZLE_FROST_GRENADE = 40525, @@ -199,67 +202,66 @@ enum eRizzleSprysprocketData #define GOSSIP_GET_MOONSTONE "Hand over the Southfury moonstone and I'll let you go." -float WPs[58][4] = +Position const WPs[58] = { -//pos_x pos_y pos_z orien -{3691.97f, -3962.41f, 35.9118f, 3.67f}, -{3675.02f, -3960.49f, 35.9118f, 3.67f}, -{3653.19f, -3958.33f, 33.9118f, 3.59f}, -{3621.12f, -3958.51f, 29.9118f, 3.48f}, -{3604.86f, -3963, 29.9118f, 3.48f}, -{3569.94f, -3970.25f, 29.9118f, 3.44f}, -{3541.03f, -3975.64f, 29.9118f, 3.41f}, -{3510.84f, -3978.71f, 29.9118f, 3.41f}, -{3472.7f, -3997.07f, 29.9118f, 3.35f}, -{3439.15f, -4014.55f, 29.9118f, 3.29f}, -{3412.8f, -4025.87f, 29.9118f, 3.25f}, -{3384.95f, -4038.04f, 29.9118f, 3.24f}, -{3346.77f, -4052.93f, 29.9118f, 3.22f}, -{3299.56f, -4071.59f, 29.9118f, 3.20f}, -{3261.22f, -4080.38f, 30.9118f, 3.19f}, -{3220.68f, -4083.09f, 31.9118f, 3.18f}, -{3187.11f, -4070.45f, 33.9118f, 3.16f}, -{3162.78f, -4062.75f, 33.9118f, 3.15f}, -{3136.09f, -4050.32f, 33.9118f, 3.07f}, -{3119.47f, -4044.51f, 36.0363f, 3.07f}, -{3098.95f, -4019.8f, 33.9118f, 3.07f}, -{3073.07f, -4011.42f, 33.9118f, 3.07f}, -{3051.71f, -3993.37f, 33.9118f, 3.02f}, -{3027.52f, -3978.6f, 33.9118f, 3.00f}, -{3003.78f, -3960.14f, 33.9118f, 2.98f}, -{2977.99f, -3941.98f, 31.9118f, 2.96f}, -{2964.57f, -3932.07f, 30.9118f, 2.96f}, -{2947.9f, -3921.31f, 29.9118f, 2.96f}, -{2924.91f, -3910.8f, 29.9118f, 2.94f}, -{2903.04f, -3896.42f, 29.9118f, 2.93f}, -{2884.75f, -3874.03f, 29.9118f, 2.90f}, -{2868.19f, -3851.48f, 29.9118f, 2.82f}, -{2854.62f, -3819.72f, 29.9118f, 2.80f}, -{2825.53f, -3790.4f, 29.9118f, 2.744f}, -{2804.31f, -3773.05f, 29.9118f, 2.71f}, -{2769.78f, -3763.57f, 29.9118f, 2.70f}, -{2727.23f, -3745.92f, 30.9118f, 2.69f}, -{2680.12f, -3737.49f, 30.9118f, 2.67f}, -{2647.62f, -3739.94f, 30.9118f, 2.66f}, -{2616.6f, -3745.75f, 30.9118f, 2.64f}, -{2589.38f, -3731.97f, 30.9118f, 2.61f}, -{2562.94f, -3722.35f, 31.9118f, 2.56f}, -{2521.05f, -3716.6f, 31.9118f, 2.55f}, -{2485.26f, -3706.67f, 31.9118f, 2.51f}, -{2458.93f, -3696.67f, 31.9118f, 2.51f}, -{2432, -3692.03f, 31.9118f, 2.46f}, -{2399.59f, -3681.97f, 31.9118f, 2.45f}, -{2357.75f, -3666.6f, 31.9118f, 2.44f}, -{2311.99f, -3656.88f, 31.9118f, 2.94f}, -{2263.41f, -3649.55f, 31.9118f, 3.02f}, -{2209.05f, -3641.76f, 31.9118f, 2.99f}, -{2164.83f, -3637.64f, 31.9118f, 3.15f}, -{2122.42f, -3639, 31.9118f, 3.21f}, -{2075.73f, -3643.59f, 31.9118f, 3.22f}, -{2033.59f, -3649.52f, 31.9118f, 3.42f}, -{1985.22f, -3662.99f, 31.9118f, 3.42f}, -{1927.09f, -3679.56f, 33.9118f, 3.42f}, -{1873.57f, -3695.32f, 33.9118f, 3.44f} + {3691.97f, -3962.41f, 35.9118f, 3.67f}, + {3675.02f, -3960.49f, 35.9118f, 3.67f}, + {3653.19f, -3958.33f, 33.9118f, 3.59f}, + {3621.12f, -3958.51f, 29.9118f, 3.48f}, + {3604.86f, -3963, 29.9118f, 3.48f}, + {3569.94f, -3970.25f, 29.9118f, 3.44f}, + {3541.03f, -3975.64f, 29.9118f, 3.41f}, + {3510.84f, -3978.71f, 29.9118f, 3.41f}, + {3472.7f, -3997.07f, 29.9118f, 3.35f}, + {3439.15f, -4014.55f, 29.9118f, 3.29f}, + {3412.8f, -4025.87f, 29.9118f, 3.25f}, + {3384.95f, -4038.04f, 29.9118f, 3.24f}, + {3346.77f, -4052.93f, 29.9118f, 3.22f}, + {3299.56f, -4071.59f, 29.9118f, 3.20f}, + {3261.22f, -4080.38f, 30.9118f, 3.19f}, + {3220.68f, -4083.09f, 31.9118f, 3.18f}, + {3187.11f, -4070.45f, 33.9118f, 3.16f}, + {3162.78f, -4062.75f, 33.9118f, 3.15f}, + {3136.09f, -4050.32f, 33.9118f, 3.07f}, + {3119.47f, -4044.51f, 36.0363f, 3.07f}, + {3098.95f, -4019.8f, 33.9118f, 3.07f}, + {3073.07f, -4011.42f, 33.9118f, 3.07f}, + {3051.71f, -3993.37f, 33.9118f, 3.02f}, + {3027.52f, -3978.6f, 33.9118f, 3.00f}, + {3003.78f, -3960.14f, 33.9118f, 2.98f}, + {2977.99f, -3941.98f, 31.9118f, 2.96f}, + {2964.57f, -3932.07f, 30.9118f, 2.96f}, + {2947.9f, -3921.31f, 29.9118f, 2.96f}, + {2924.91f, -3910.8f, 29.9118f, 2.94f}, + {2903.04f, -3896.42f, 29.9118f, 2.93f}, + {2884.75f, -3874.03f, 29.9118f, 2.90f}, + {2868.19f, -3851.48f, 29.9118f, 2.82f}, + {2854.62f, -3819.72f, 29.9118f, 2.80f}, + {2825.53f, -3790.4f, 29.9118f, 2.744f}, + {2804.31f, -3773.05f, 29.9118f, 2.71f}, + {2769.78f, -3763.57f, 29.9118f, 2.70f}, + {2727.23f, -3745.92f, 30.9118f, 2.69f}, + {2680.12f, -3737.49f, 30.9118f, 2.67f}, + {2647.62f, -3739.94f, 30.9118f, 2.66f}, + {2616.6f, -3745.75f, 30.9118f, 2.64f}, + {2589.38f, -3731.97f, 30.9118f, 2.61f}, + {2562.94f, -3722.35f, 31.9118f, 2.56f}, + {2521.05f, -3716.6f, 31.9118f, 2.55f}, + {2485.26f, -3706.67f, 31.9118f, 2.51f}, + {2458.93f, -3696.67f, 31.9118f, 2.51f}, + {2432, -3692.03f, 31.9118f, 2.46f}, + {2399.59f, -3681.97f, 31.9118f, 2.45f}, + {2357.75f, -3666.6f, 31.9118f, 2.44f}, + {2311.99f, -3656.88f, 31.9118f, 2.94f}, + {2263.41f, -3649.55f, 31.9118f, 3.02f}, + {2209.05f, -3641.76f, 31.9118f, 2.99f}, + {2164.83f, -3637.64f, 31.9118f, 3.15f}, + {2122.42f, -3639, 31.9118f, 3.21f}, + {2075.73f, -3643.59f, 31.9118f, 3.22f}, + {2033.59f, -3649.52f, 31.9118f, 3.42f}, + {1985.22f, -3662.99f, 31.9118f, 3.42f}, + {1927.09f, -3679.56f, 33.9118f, 3.42f}, + {1873.57f, -3695.32f, 33.9118f, 3.44f} }; class mob_rizzle_sprysprocket : public CreatureScript @@ -270,19 +272,19 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF + 1 && player->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + if (action == GOSSIP_ACTION_INFO_DEF + 1 && player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, SPELL_GIVE_SOUTHFURY_MOONSTONE, true); - CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->Must_Die_Timer = 3000; - CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->Must_Die = true; + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->MustDieTimer = 3000; + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->MustDie = true; } return true; } bool OnGossipHello(Player* player, Creature* creature) { - if (player->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) != QUEST_STATUS_INCOMPLETE) return true; player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(10811, creature->GetGUID()); @@ -298,32 +300,32 @@ public: { mob_rizzle_sprysprocketAI(Creature* creature) : ScriptedAI(creature) {} - uint32 spellEscape_Timer; - uint32 Teleport_Timer; - uint32 Check_Timer; - uint32 Grenade_Timer; - uint32 Must_Die_Timer; + uint32 SpellEscapeTimer; + uint32 TeleportTimer; + uint32 CheckTimer; + uint32 GrenadeTimer; + uint32 MustDieTimer; uint32 CurrWP; uint64 PlayerGUID; - bool Must_Die; + bool MustDie; bool Escape; bool ContinueWP; bool Reached; void Reset() { - spellEscape_Timer = 1300; - Teleport_Timer = 3500; - Check_Timer = 10000; - Grenade_Timer = 30000; - Must_Die_Timer = 3000; + SpellEscapeTimer = 1300; + TeleportTimer = 3500; + CheckTimer = 10000; + GrenadeTimer = 30000; + MustDieTimer = 3000; CurrWP = 0; PlayerGUID = 0; - Must_Die = false; + MustDie = false; Escape = false; ContinueWP = false; Reached = false; @@ -331,13 +333,13 @@ public: void UpdateAI(const uint32 diff) { - if (Must_Die) + if (MustDie) { - if (Must_Die_Timer <= diff) + if (MustDieTimer <= diff) { me->DespawnOrUnsummon(); return; - } else Must_Die_Timer -= diff; + } else MustDieTimer -= diff; } if (!Escape) @@ -345,17 +347,16 @@ public: if (!PlayerGUID) return; - if (spellEscape_Timer <= diff) + if (SpellEscapeTimer <= diff) { DoCast(me, SPELL_RIZZLE_ESCAPE, false); - spellEscape_Timer = 10000; - } else spellEscape_Timer -= diff; + SpellEscapeTimer = 10000; + } else SpellEscapeTimer -= diff; - if (Teleport_Timer <= diff) + if (TeleportTimer <= diff) { //temp solution - unit can't be teleported by core using spelleffect 5, only players - Map* map = me->GetMap(); - if (map) + if (me->GetMap()) { me->SetPosition(3706.39f, -3969.15f, 35.9118f, 0); me->AI_SendMoveToPacket(3706.39f, -3969.15f, 35.9118f, 0, 0, 0); @@ -367,20 +368,20 @@ public: me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); me->SetSpeed(MOVE_RUN, 0.85f, true); me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]); Escape = true; - } else Teleport_Timer -= diff; + } else TeleportTimer -= diff; return; } if (ContinueWP) { - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]); ContinueWP = false; } - if (Grenade_Timer <= diff) + if (GrenadeTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player) @@ -388,10 +389,10 @@ public: DoScriptText(SAY_RIZZLE_GRENADE, me, player); DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true); } - Grenade_Timer = 30000; - } else Grenade_Timer -= diff; + GrenadeTimer = 30000; + } else GrenadeTimer -= diff; - if (Check_Timer <= diff) + if (CheckTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (!player) @@ -410,8 +411,8 @@ public: Reached = true; } - Check_Timer = 1000; - } else Check_Timer -= diff; + CheckTimer = 1000; + } else CheckTimer -= diff; } @@ -427,7 +428,7 @@ public: if (!who || PlayerGUID) return; - if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE) { PlayerGUID = who->GetGUID(); DoScriptText(SAY_RIZZLE_START, me); @@ -472,25 +473,25 @@ public: { mob_depth_chargeAI(Creature* creature) : ScriptedAI(creature) {} - bool we_must_die; - uint32 must_die_timer; + bool WeMustDie; + uint32 WeMustDieTimer; void Reset() { me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - we_must_die = false; - must_die_timer = 1000; + WeMustDie = false; + WeMustDieTimer = 1000; } void UpdateAI(const uint32 diff) { - if (we_must_die) + if (WeMustDie) { - if (must_die_timer <= diff) - { + if (WeMustDieTimer <= diff) me->DespawnOrUnsummon(); - } else must_die_timer -= diff; + else + WeMustDieTimer -= diff; } return; } @@ -503,18 +504,14 @@ public: if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5)) { DoCast(who, SPELL_DEPTH_CHARGE_TRAP); - we_must_die = true; + WeMustDie = true; return; } } - void AttackStart(Unit* /*who*/) - { - } + void AttackStart(Unit* /*who*/) {} - void EnterCombat(Unit* /*who*/) - { - } + void EnterCombat(Unit* /*who*/) {} }; }; diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index dfb1f3b0bdf..608117ca9af 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -33,15 +33,19 @@ go_ravager_cage npc_death_ravager EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" -#include +#include "ScriptedGossip.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" /*###### ## npc_draenei_survivor ######*/ -enum eEnums +enum draeneiSurvivor { SAY_HEAL1 = -1000176, SAY_HEAL2 = -1000177, @@ -175,7 +179,7 @@ public: ## npc_engineer_spark_overgrind ######*/ -enum eOvergrind +enum Overgrind { SAY_TEXT = -1000184, SAY_EMOTE = -1000185, @@ -235,15 +239,15 @@ public: uint32 NormFaction; uint32 NpcFlags; - uint32 Dynamite_Timer; - uint32 Emote_Timer; + uint32 DynamiteTimer; + uint32 EmoteTimer; bool IsTreeEvent; void Reset() { - Dynamite_Timer = 8000; - Emote_Timer = urand(120000, 150000); + DynamiteTimer = 8000; + EmoteTimer = urand(120000, 150000); me->setFaction(NormFaction); me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); @@ -260,12 +264,12 @@ public: { if (!me->isInCombat() && !IsTreeEvent) { - if (Emote_Timer <= diff) + if (EmoteTimer <= diff) { DoScriptText(SAY_TEXT, me); DoScriptText(SAY_EMOTE, me); - Emote_Timer = urand(120000, 150000); - } else Emote_Timer -= diff; + EmoteTimer = urand(120000, 150000); + } else EmoteTimer -= diff; } else if (IsTreeEvent) return; @@ -273,11 +277,11 @@ public: if (!UpdateVictim()) return; - if (Dynamite_Timer <= diff) + if (DynamiteTimer <= diff) { DoCast(me->getVictim(), SPELL_DYNAMITE); - Dynamite_Timer = 8000; - } else Dynamite_Timer -= diff; + DynamiteTimer = 8000; + } else DynamiteTimer -= diff; DoMeleeAttackIfReady(); } @@ -307,7 +311,7 @@ public: { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); me->SetHealth(me->CountPctFromMaxHealth(15)); - switch (rand()%2) + switch (urand(0, 1)) { case 0: me->SetStandState(UNIT_STAND_STATE_SIT); @@ -321,14 +325,9 @@ public: void EnterCombat(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) - { - } - - void UpdateAI(const uint32 /*diff*/) - { - } + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} }; }; @@ -337,7 +336,7 @@ public: ## npc_magwin ######*/ -enum eMagwin +enum Magwin { SAY_START = -1000111, SAY_AGGRO = -1000112, @@ -376,26 +375,25 @@ public: void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 0: - DoScriptText(SAY_START, me, player); - break; - case 17: - DoScriptText(SAY_PROGRESS, me, player); - break; - case 28: - DoScriptText(SAY_END1, me, player); - break; - case 29: - DoScriptText(EMOTE_HUG, me, player); - DoScriptText(SAY_END2, me, player); - player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me); - break; + switch (waypointId) + { + case 0: + DoScriptText(SAY_START, me, player); + break; + case 17: + DoScriptText(SAY_PROGRESS, me, player); + break; + case 28: + DoScriptText(SAY_END1, me, player); + break; + case 29: + DoScriptText(EMOTE_HUG, me, player); + DoScriptText(SAY_END2, me, player); + player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me); + break; + } } } @@ -404,7 +402,7 @@ public: DoScriptText(SAY_AGGRO, me, who); } - void Reset() { } + void Reset() {} }; }; @@ -413,7 +411,7 @@ public: ## npc_geezle ######*/ -enum eGeezle +enum Geezle { QUEST_TREES_COMPANY = 9531, @@ -433,7 +431,7 @@ enum eGeezle GO_NAGA_FLAG = 181694 }; -static float SparkPos[3] = {-5029.91f, -11291.79f, 8.096f}; +Position const SparkPos = {-5029.91f, -11291.79f, 8.096f, 0.0f}; class npc_geezle : public CreatureScript { @@ -451,7 +449,7 @@ public: uint64 SparkGUID; - uint32 Step; + uint8 Step; uint32 SayTimer; bool EventStarted; @@ -469,8 +467,7 @@ public: { Step = 0; EventStarted = true; - Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - if (Spark) + if (Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) { SparkGUID = Spark->GetGUID(); Spark->setActive(true); @@ -479,47 +476,47 @@ public: SayTimer = 8000; } - uint32 NextStep(uint32 Step) + uint32 NextStep(uint8 Step) { Creature* Spark = Unit::GetCreature(*me, SparkGUID); switch (Step) { - case 0: - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f); - me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f); - return 9000; // NPCs are walking up to fire - case 1: - DespawnNagaFlag(true); - DoScriptText(EMOTE_SPARK, Spark); - return 1000; - case 2: - DoScriptText(GEEZLE_SAY_1, me, Spark); - if (Spark) - { - Spark->SetInFront(me); - me->SetInFront(Spark); - } - return 5000; - case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; - case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; - case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; - case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; - case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; - case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; - case 9: - me->GetMotionMaster()->MoveTargetedHome(); - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, SparkPos[0], SparkPos[1], SparkPos[2]); - CompleteQuest(); - return 9000; - case 10: - if (Spark) - Spark->DisappearAndDie(); - DespawnNagaFlag(false); - me->DisappearAndDie(); - default: return 99999999; + case 0: + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f); + me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f); + return 9000; // NPCs are walking up to fire + case 1: + DespawnNagaFlag(true); + DoScriptText(EMOTE_SPARK, Spark); + return 1000; + case 2: + DoScriptText(GEEZLE_SAY_1, me, Spark); + if (Spark) + { + Spark->SetInFront(me); + me->SetInFront(Spark); + } + return 5000; + case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; + case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; + case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; + case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; + case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; + case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; + case 9: + me->GetMotionMaster()->MoveTargetedHome(); + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, SparkPos); + CompleteQuest(); + return 9000; + case 10: + if (Spark) + Spark->DisappearAndDie(); + DespawnNagaFlag(false); + me->DisappearAndDie(); + default: return 99999999; } } @@ -533,13 +530,8 @@ public: me->VisitNearbyWorldObject(radius, searcher); for (std::list::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE - &&(*itr)->HasAura(SPELL_TREE_DISGUISE)) - { + if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE && (*itr)->HasAura(SPELL_TREE_DISGUISE)) (*itr)->KilledMonsterCredit(MOB_SPARK, 0); - } - } } void DespawnNagaFlag(bool despawn) @@ -552,13 +544,13 @@ public: for (std::list::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) { if (despawn) - { (*itr)->SetLootState(GO_JUST_DEACTIVATED); - } else (*itr)->Respawn(); } - } else sLog->outError("SD2 ERROR: FlagList is empty!"); + } + else + sLog->outError("SD2 ERROR: FlagList is empty!"); } void UpdateAI(const uint32 diff) @@ -566,16 +558,16 @@ public: if (SayTimer <= diff) { if (EventStarted) - { SayTimer = NextStep(Step++); - } - } else SayTimer -= diff; + } + else + SayTimer -= diff; } }; }; -enum eRavegerCage +enum RavegerCage { NPC_DEATH_RAVAGER = 17556, diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp index 6c692a6738b..3883b740d02 100644 --- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp @@ -28,14 +28,16 @@ mob_webbed_creature npc_captured_sunhawk_agent EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## mob_webbed_creature ######*/ //possible creatures to be spawned -const uint32 possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; +uint32 const possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; class mob_webbed_creature : public CreatureScript { @@ -51,13 +53,9 @@ public: { mob_webbed_creatureAI(Creature* creature) : ScriptedAI(creature) {} - void Reset() - { - } + void Reset() {} - void EnterCombat(Unit* /*who*/) - { - } + void EnterCombat(Unit* /*who*/) {} void JustDied(Unit* killer) { @@ -153,7 +151,7 @@ public: ## Quest 9667: Saving Princess Stillpine ######*/ -enum eStillpine +enum Stillpine { QUEST_SAVING_PRINCESS_STILLPINE = 9667, NPC_PRINCESS_STILLPINE = 17682, diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp index c344de8cb51..ec098951c03 100644 --- a/src/server/scripts/Kalimdor/boss_azuregos.cpp +++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp @@ -23,17 +23,24 @@ SDComment: Teleport not included, spell reflect not effecting dots (Core problem SDCategory: Azshara EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" -#define SAY_TELEPORT -1000100 +enum Say +{ + SAY_TELEPORT = -1000100 +}; -#define SPELL_MARKOFFROST 23182 -#define SPELL_MANASTORM 21097 -#define SPELL_CHILL 21098 -#define SPELL_FROSTBREATH 21099 -#define SPELL_REFLECT 22067 -#define SPELL_CLEAVE 8255 //Perhaps not right ID -#define SPELL_ENRAGE 23537 +enum Spells +{ + SPELL_MARKOFFROST = 23182, + SPELL_MANASTORM = 21097, + SPELL_CHILL = 21098, + SPELL_FROSTBREATH = 21099, + SPELL_REFLECT = 22067, + SPELL_CLEAVE = 8255, //Perhaps not right ID + SPELL_ENRAGE = 23537 +}; class boss_azuregos : public CreatureScript { @@ -49,26 +56,26 @@ public: { boss_azuregosAI(Creature* creature) : ScriptedAI(creature) {} - uint32 MarkOfFrost_Timer; - uint32 ManaStorm_Timer; - uint32 Chill_Timer; - uint32 Breath_Timer; - uint32 Teleport_Timer; - uint32 Reflect_Timer; - uint32 Cleave_Timer; - uint32 Enrage_Timer; + uint32 MarkOfFrostTimer; + uint32 ManaStormTimer; + uint32 ChillTimer; + uint32 BreathTimer; + uint32 TeleportTimer; + uint32 ReflectTimer; + uint32 CleaveTimer; + uint32 EnrageTimer; bool Enraged; void Reset() { - MarkOfFrost_Timer = 35000; - ManaStorm_Timer = urand(5000, 17000); - Chill_Timer = urand(10000, 30000); - Breath_Timer = urand(2000, 8000); - Teleport_Timer = 30000; - Reflect_Timer = urand(15000, 30000); - Cleave_Timer = 7000; - Enrage_Timer = 0; + MarkOfFrostTimer = 35000; + ManaStormTimer = urand(5000, 17000); + ChillTimer = urand(10000, 30000); + BreathTimer = urand(2000, 8000); + TeleportTimer = 30000; + ReflectTimer = urand(15000, 30000); + CleaveTimer = 7000; + EnrageTimer = 0; Enraged = false; } @@ -80,12 +87,12 @@ public: if (!UpdateVictim()) return; - if (Teleport_Timer <= diff) + if (TeleportTimer <= diff) { DoScriptText(SAY_TELEPORT, me); - std::list& m_threatlist = me->getThreatManager().getThreatList(); - std::list::const_iterator i = m_threatlist.begin(); - for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) + std::list& threatlist = me->getThreatManager().getThreatList(); + std::list::const_iterator i = threatlist.begin(); + for (i = threatlist.begin(); i!= threatlist.end(); ++i) { Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) @@ -95,53 +102,53 @@ public: } DoResetThreat(); - Teleport_Timer = 30000; - } else Teleport_Timer -= diff; + TeleportTimer = 30000; + } else TeleportTimer -= diff; - // //MarkOfFrost_Timer - // if (MarkOfFrost_Timer <= diff) + // //MarkOfFrostTimer + // if (MarkOfFrostTimer <= diff) // { // DoCast(me->getVictim(), SPELL_MARKOFFROST); - // MarkOfFrost_Timer = 25000; - // } else MarkOfFrost_Timer -= diff; + // MarkOfFrostTimer = 25000; + // } else MarkOfFrostTimer -= diff; - //Chill_Timer - if (Chill_Timer <= diff) + //ChillTimer + if (ChillTimer <= diff) { DoCast(me->getVictim(), SPELL_CHILL); - Chill_Timer = urand(13000, 25000); - } else Chill_Timer -= diff; + ChillTimer = urand(13000, 25000); + } else ChillTimer -= diff; - //Breath_Timer - if (Breath_Timer <= diff) + //BreathTimer + if (BreathTimer <= diff) { DoCast(me->getVictim(), SPELL_FROSTBREATH); - Breath_Timer = urand(10000, 15000); - } else Breath_Timer -= diff; + BreathTimer = urand(10000, 15000); + } else BreathTimer -= diff; - //ManaStorm_Timer - if (ManaStorm_Timer <= diff) + //ManaStormTimer + if (ManaStormTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_MANASTORM); - ManaStorm_Timer = urand(7500, 12500); - } else ManaStorm_Timer -= diff; + ManaStormTimer = urand(7500, 12500); + } else ManaStormTimer -= diff; - //Reflect_Timer - if (Reflect_Timer <= diff) + //ReflectTimer + if (ReflectTimer <= diff) { DoCast(me, SPELL_REFLECT); - Reflect_Timer = urand(20000, 35000); - } else Reflect_Timer -= diff; + ReflectTimer = urand(20000, 35000); + } else ReflectTimer -= diff; - //Cleave_Timer - if (Cleave_Timer <= diff) + //CleaveTimer + if (CleaveTimer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + CleaveTimer = 7000; + } else CleaveTimer -= diff; - //Enrage_Timer + //EnrageTimer if (HealthBelowPct(26) && !Enraged) { DoCast(me, SPELL_ENRAGE); diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp index 1de04db61c4..0e02a77169e 100644 --- a/src/server/scripts/Kalimdor/darkshore.cpp +++ b/src/server/scripts/Kalimdor/darkshore.cpp @@ -29,7 +29,9 @@ npc_prospector_remtravel npc_threshwackonator EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" @@ -37,7 +39,7 @@ EndContentData */ # npc_kerlonian ####*/ -enum eKerlonian +enum Kerlonian { SAY_KER_START = -1000434, @@ -94,11 +96,11 @@ public: { npc_kerlonianAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiFallAsleepTimer; + uint32 FallAsleepTimer; void Reset() { - m_uiFallAsleepTimer = urand(10000, 45000); + FallAsleepTimer = urand(10000, 45000); } void MoveInLineOfSight(Unit* who) @@ -150,7 +152,7 @@ public: SetFollowPaused(false); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { @@ -159,13 +161,13 @@ public: if (!HasFollowState(STATE_FOLLOW_PAUSED)) { - if (m_uiFallAsleepTimer <= uiDiff) + if (FallAsleepTimer <= Diff) { SetSleeping(); - m_uiFallAsleepTimer = urand(25000, 90000); + FallAsleepTimer = urand(25000, 90000); } else - m_uiFallAsleepTimer -= uiDiff; + FallAsleepTimer -= Diff; } return; @@ -181,7 +183,7 @@ public: # npc_prospector_remtravel ####*/ -enum eRemtravel +enum Remtravel { SAY_REM_START = -1000327, SAY_REM_AGGRO = -1000328, @@ -233,63 +235,62 @@ public: void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 0: - DoScriptText(SAY_REM_START, me, player); - break; - case 5: - DoScriptText(SAY_REM_RAMP1_1, me, player); - break; - case 6: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 9: - DoScriptText(SAY_REM_RAMP1_2, me, player); - break; - case 14: - //depend quest rewarded? - DoScriptText(SAY_REM_BOOK, me, player); - break; - case 15: - DoScriptText(SAY_REM_TENT1_1, me, player); - break; - case 16: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 17: - DoScriptText(SAY_REM_TENT1_2, me, player); - break; - case 26: - DoScriptText(SAY_REM_MOSS, me, player); - break; - case 27: - DoScriptText(EMOTE_REM_MOSS, me, player); - break; - case 28: - DoScriptText(SAY_REM_MOSS_PROGRESS, me, player); - break; - case 29: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 31: - DoScriptText(SAY_REM_PROGRESS, me, player); - break; - case 41: - DoScriptText(SAY_REM_REMEMBER, me, player); - break; - case 42: - DoScriptText(EMOTE_REM_END, me, player); - player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); - break; + switch (waypointId) + { + case 0: + DoScriptText(SAY_REM_START, me, player); + break; + case 5: + DoScriptText(SAY_REM_RAMP1_1, me, player); + break; + case 6: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 9: + DoScriptText(SAY_REM_RAMP1_2, me, player); + break; + case 14: + //depend quest rewarded? + DoScriptText(SAY_REM_BOOK, me, player); + break; + case 15: + DoScriptText(SAY_REM_TENT1_1, me, player); + break; + case 16: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 17: + DoScriptText(SAY_REM_TENT1_2, me, player); + break; + case 26: + DoScriptText(SAY_REM_MOSS, me, player); + break; + case 27: + DoScriptText(EMOTE_REM_MOSS, me, player); + break; + case 28: + DoScriptText(SAY_REM_MOSS_PROGRESS, me, player); + break; + case 29: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 31: + DoScriptText(SAY_REM_PROGRESS, me, player); + break; + case 41: + DoScriptText(SAY_REM_REMEMBER, me, player); + break; + case 42: + DoScriptText(EMOTE_REM_END, me, player); + player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); + break; + } } } @@ -297,7 +298,7 @@ public: void EnterCombat(Unit* who) { - if (rand()%2) + if (urand(0, 1)) DoScriptText(SAY_REM_AGGRO, me, who); } @@ -314,7 +315,7 @@ public: # npc_threshwackonator ####*/ -enum eThreshwackonator +enum Threshwackonator { EMOTE_START = -1000325, //signed for 4966 SAY_AT_CLOSE = -1000326, //signed for 4966 diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp index f295d7626ac..e196c71f681 100644 --- a/src/server/scripts/Kalimdor/desolace.cpp +++ b/src/server/scripts/Kalimdor/desolace.cpp @@ -30,10 +30,12 @@ npc_dalinda_malem go_demon_portal EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" -enum eDyingKodo +enum DyingKodo { // signed for 9999 SAY_SMEED_HOME_1 = -1000348, @@ -114,11 +116,11 @@ public: { npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) { Reset(); } - uint32 m_uiDespawnTimer; + uint32 DespawnTimer; void Reset() { - m_uiDespawnTimer = 0; + DespawnTimer = 0; } void MoveInLineOfSight(Unit* who) @@ -143,14 +145,14 @@ public: if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) { me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - m_uiDespawnTimer = 60000; + DespawnTimer = 60000; } } void UpdateAI(const uint32 diff) { //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. - if (m_uiDespawnTimer && m_uiDespawnTimer <= diff) + if (DespawnTimer && DespawnTimer <= diff) { if (!me->getVictim() && me->isAlive()) { @@ -159,7 +161,7 @@ public: me->Respawn(); return; } - } else m_uiDespawnTimer -= diff; + } else DespawnTimer -= diff; if (!UpdateVictim()) return; @@ -175,7 +177,7 @@ public: ## Hand of Iruxos ######*/ -enum +enum Iruxos { QUEST_HAND_IRUXOS = 5381, NPC_DEMON_SPIRIT = 11876, @@ -199,7 +201,10 @@ class go_iruxos : public GameObjectScript ## npc_dalinda_malem. Quest 1440 ######*/ -#define QUEST_RETURN_TO_VAHLARRIEL 1440 +enum Dalinda +{ + QUEST_RETURN_TO_VAHLARRIEL = 1440 +}; class npc_dalinda : public CreatureScript { @@ -255,9 +260,9 @@ public: return; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { - npc_escortAI::UpdateAI(uiDiff); + npc_escortAI::UpdateAI(Diff); if (!UpdateVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index fe5bedf4c98..ec06a542b6f 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -15,8 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "Vehicle.h" +#include "SpellScript.h" /*###### ##Quest 5441: Lazy Peons @@ -50,15 +52,15 @@ public: { npc_lazy_peonAI(Creature* creature) : ScriptedAI(creature) {} - uint64 uiPlayerGUID; + uint64 PlayerGUID; - uint32 m_uiRebuffTimer; + uint32 RebuffTimer; bool work; void Reset() { - uiPlayerGUID = 0; - m_uiRebuffTimer = 0; + PlayerGUID = 0; + RebuffTimer = 0; work = false; } @@ -81,17 +83,17 @@ public: } } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (work == true) me->HandleEmoteCommand(EMOTE_ONESHOT_WORK_CHOPWOOD); - if (m_uiRebuffTimer <= uiDiff) + if (RebuffTimer <= Diff) { DoCast(me, SPELL_BUFF_SLEEP); - m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes + RebuffTimer = 300000; //Rebuff agian in 5 minutes } else - m_uiRebuffTimer -= uiDiff; + RebuffTimer -= Diff; if (!UpdateVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index e4ed3793385..45e1c1808c1 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -32,8 +32,11 @@ npc_private_hendel npc_cassa_crimsonwing - handled by npc_taxi EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" +#include "SpellScript.h" /*###### ## mobs_risen_husk_spirit @@ -132,7 +135,7 @@ class mobs_risen_husk_spirit : public CreatureScript ## npc_deserter_agitator ######*/ -enum eDeserter +enum Deserter { QUEST_TRAITORS_AMONG_US = 11126, NPC_THERAMORE_DESERTER = 23602, @@ -203,12 +206,12 @@ public: me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - void MovementInform(uint32 uiType, uint32 uiId) + void MovementInform(uint32 Type, uint32 Id) { - if (uiType != POINT_MOTION_TYPE) + if (Type != POINT_MOTION_TYPE) return; - if (uiId == 1) + if (Id == 1) me->DisappearAndDie(); } }; @@ -218,7 +221,7 @@ public: ## npc_deserter_agitator ######*/ -enum eTheramoreGuard +enum TheramoreGuard { SAY_QUEST1 = -1000641, SAY_QUEST2 = -1000642, @@ -266,7 +269,7 @@ public: DoScriptText(SAY_QUEST1, creature); creature->CastSpell(creature, SPELL_DOCTORED_LEAFLET, false); creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->uiYellTimer = 4000; + CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->YellTimer = 4000; CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->bYellTimer = true; } @@ -282,40 +285,40 @@ public: { npc_theramore_guardAI(Creature* creature) : ScriptedAI(creature) { } - uint32 uiYellTimer; - uint32 uiStep; + uint32 YellTimer; + uint32 Step; bool bYellTimer; void Reset() { bYellTimer = false; - uiStep = 0; + Step = 0; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (!me->HasAura(SPELL_PROPAGANDIZED)) me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if (bYellTimer && uiYellTimer <= uiDiff) + if (bYellTimer && YellTimer <= Diff) { - switch (uiStep) + switch (Step) { case 0: DoScriptText(RAND(SAY_QUEST2, SAY_QUEST3, SAY_QUEST4, SAY_QUEST5, SAY_QUEST6), me); - uiYellTimer = 3000; - ++uiStep; + YellTimer = 3000; + ++Step; break; case 1: DoScriptText(RAND(SAY_QUEST7, SAY_QUEST8, SAY_QUEST9), me); me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - uiStep = 0; + Step = 0; bYellTimer = false; break; } } else - uiYellTimer -= uiDiff; + YellTimer -= Diff; } }; }; @@ -324,7 +327,7 @@ public: ## npc_lady_jaina_proudmoore ######*/ -enum eLadyJaina +enum LadyJaina { QUEST_JAINAS_AUTOGRAPH = 558, SPELL_JAINAS_AUTOGRAPH = 23122 @@ -367,7 +370,7 @@ public: ## npc_nat_pagle ######*/ -enum eNatPagle +enum NatPagle { QUEST_NATS_MEASURING_TAPE = 8227 }; @@ -408,7 +411,7 @@ public: ## npc_private_hendel ######*/ -enum eHendel +enum Hendel { // looks like all this text ids are wrong. SAY_PROGRESS_1_TER = -1000411, // signed for 3568 @@ -464,11 +467,11 @@ public: AttackStart(pAttacker); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + void DamageTaken(Unit* pDoneBy, uint32 &Damage) { - if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(20, uiDamage)) + if (Damage > me->GetHealth() || me->HealthBelowPctDamaged(20, Damage)) { - uiDamage = 0; + Damage = 0; if (Player* player = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) player->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); @@ -485,9 +488,9 @@ public: ## npc_zelfrax ######*/ -const Position MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f}; +Position const MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f}; -enum eZelfrax +enum Zelfrax { SAY_ZELFRAX = -1000472, SAY_ZELFRAX_2 = -1000473 @@ -525,9 +528,9 @@ public: } } - void MovementInform(uint32 uiType, uint32 /*uiId*/) + void MovementInform(uint32 Type, uint32 /*Id*/) { - if (uiType != POINT_MOTION_TYPE) + if (Type != POINT_MOTION_TYPE) return; me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); @@ -547,7 +550,7 @@ public: DoScriptText(SAY_ZELFRAX_2, me); } - void UpdateAI(uint32 const /*uiDiff*/) + void UpdateAI(uint32 const /*Diff*/) { if (!UpdateVictim()) return; @@ -562,7 +565,7 @@ public: ## npc_stinky ######*/ -enum eStinky +enum Stinky { QUEST_STINKYS_ESCAPE_H = 1270, QUEST_STINKYS_ESCAPE_A = 1222, diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp index e1f59ec26be..9243ea0017e 100644 --- a/src/server/scripts/Kalimdor/felwood.cpp +++ b/src/server/scripts/Kalimdor/felwood.cpp @@ -27,7 +27,9 @@ EndScriptData */ npcs_riverbreeze_and_silversky EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npcs_riverbreeze_and_silversky @@ -35,6 +37,17 @@ EndContentData */ #define GOSSIP_ITEM_BEACON "Please make me a Cenarion Beacon" +enum RiverbreezeAndSilversky +{ + SPELL_CENARION_BEACON = 15120, + + NPC_ARATHANDRIS_SILVERSKY = 9528, + NPC_MAYBESS_RIVERBREEZE = 9529, + + QUEST_CLEASING_FELWOOD_A = 4101, + QUEST_CLEASING_FELWOOD_H = 4102 +}; + class npcs_riverbreeze_and_silversky : public CreatureScript { public: @@ -46,7 +59,7 @@ public: if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); - creature->CastSpell(player, 15120, false); + creature->CastSpell(player, SPELL_CENARION_BEACON, false); } return true; } @@ -58,9 +71,9 @@ public: uint32 creatureId = creature->GetEntry(); - if (creatureId == 9528) + if (creatureId == NPC_ARATHANDRIS_SILVERSKY) { - if (player->GetQuestRewardStatus(4101)) + if (player->GetQuestRewardStatus(QUEST_CLEASING_FELWOOD_A)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(2848, creature->GetGUID()); @@ -70,9 +83,9 @@ public: player->SEND_GOSSIP_MENU(2844, creature->GetGUID()); } - if (creatureId == 9529) + if (creatureId == NPC_MAYBESS_RIVERBREEZE) { - if (player->GetQuestRewardStatus(4102)) + if (player->GetQuestRewardStatus(QUEST_CLEASING_FELWOOD_H)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(2849, creature->GetGUID()); diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp index 480b94d6767..4fcd20951c9 100644 --- a/src/server/scripts/Kalimdor/feralas.cpp +++ b/src/server/scripts/Kalimdor/feralas.cpp @@ -23,8 +23,10 @@ SDComment: Quest support: 3520, 2767, Special vendor Gregan Brewspewer SDCategory: Feralas EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" /*###### ## npc_gregan_brewspewer @@ -68,7 +70,7 @@ public: ## npc_oox22fe ######*/ -enum eOOX +enum OOX { //signed for 7806 SAY_OOX_START = -1000287, diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 08f5b2aa592..9df208d2578 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -31,14 +31,16 @@ npc_clintar_spirit npc_clintar_dreamwalker EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" /*###### ## npc_bunthen_plainswind ######*/ -enum eBunthen +enum Bunthen { QUEST_SEA_LION_HORDE = 30, QUEST_SEA_LION_ALLY = 272, @@ -218,70 +220,68 @@ public: ## npc_clintar_spirit ######*/ -float Clintar_spirit_WP[41][5] = +float const Clintar_spirit_WP[41][5] = { - //pos_x pos_y pos_z orien waitTime -{7465.28f, -3115.46f, 439.327f, 0.83f, 4000}, -{7476.49f, -3101, 443.457f, 0.89f, 0}, -{7486.57f, -3085.59f, 439.478f, 1.07f, 0}, -{7472.19f, -3085.06f, 443.142f, 3.07f, 0}, -{7456.92f, -3085.91f, 438.862f, 3.24f, 0}, -{7446.68f, -3083.43f, 438.245f, 2.40f, 0}, -{7446.17f, -3080.21f, 439.826f, 1.10f, 6000}, -{7452.41f, -3085.8f, 438.984f, 5.78f, 0}, -{7469.11f, -3084.94f, 443.048f, 6.25f, 0}, -{7483.79f, -3085.44f, 439.607f, 6.25f, 0}, -{7491.14f, -3090.96f, 439.983f, 5.44f, 0}, -{7497.62f, -3098.22f, 436.854f, 5.44f, 0}, -{7498.72f, -3113.41f, 434.596f, 4.84f, 0}, -{7500.06f, -3122.51f, 434.749f, 5.17f, 0}, -{7504.96f, -3131.53f, 434.475f, 4.74f, 0}, -{7504.31f, -3133.53f, 435.693f, 3.84f, 6000}, -{7504.55f, -3133.27f, 435.476f, 0.68f, 15000}, -{7501.99f, -3126.01f, 434.93f, 1.83f, 0}, -{7490.76f, -3114.97f, 434.431f, 2.51f, 0}, -{7479.64f, -3105.51f, 431.123f, 1.83f, 0}, -{7474.63f, -3086.59f, 428.994f, 1.83f, 2000}, -{7472.96f, -3074.18f, 427.566f, 1.57f, 0}, -{7472.25f, -3063, 428.268f, 1.55f, 0}, -{7473.46f, -3054.22f, 427.588f, 0.36f, 0}, -{7475.08f, -3053.6f, 428.653f, 0.36f, 6000}, -{7474.66f, -3053.56f, 428.433f, 3.19f, 4000}, -{7471.81f, -3058.84f, 427.073f, 4.29f, 0}, -{7472.16f, -3064.91f, 427.772f, 4.95f, 0}, -{7471.56f, -3085.36f, 428.924f, 4.72f, 0}, -{7473.56f, -3093.48f, 429.294f, 5.04f, 0}, -{7478.94f, -3104.29f, 430.638f, 5.23f, 0}, -{7484.46f, -3109.61f, 432.769f, 5.79f, 0}, -{7490.23f, -3111.08f, 434.431f, 0.02f, 0}, -{7496.29f, -3108, 434.783f, 1.15f, 0}, -{7497.46f, -3100.66f, 436.191f, 1.50f, 0}, -{7495.64f, -3093.39f, 438.349f, 2.10f, 0}, -{7492.44f, -3086.01f, 440.267f, 1.38f, 0}, -{7498.26f, -3076.44f, 440.808f, 0.71f, 0}, -{7506.4f, -3067.35f, 443.64f, 0.77f, 0}, -{7518.37f, -3057.42f, 445.584f, 0.74f, 0}, -{7517.51f, -3056.3f, 444.568f, 2.49f, 4500} + //pos_x pos_y pos_z orien waitTime + {7465.28f, -3115.46f, 439.327f, 0.83f, 4000}, + {7476.49f, -3101, 443.457f, 0.89f, 0}, + {7486.57f, -3085.59f, 439.478f, 1.07f, 0}, + {7472.19f, -3085.06f, 443.142f, 3.07f, 0}, + {7456.92f, -3085.91f, 438.862f, 3.24f, 0}, + {7446.68f, -3083.43f, 438.245f, 2.40f, 0}, + {7446.17f, -3080.21f, 439.826f, 1.10f, 6000}, + {7452.41f, -3085.8f, 438.984f, 5.78f, 0}, + {7469.11f, -3084.94f, 443.048f, 6.25f, 0}, + {7483.79f, -3085.44f, 439.607f, 6.25f, 0}, + {7491.14f, -3090.96f, 439.983f, 5.44f, 0}, + {7497.62f, -3098.22f, 436.854f, 5.44f, 0}, + {7498.72f, -3113.41f, 434.596f, 4.84f, 0}, + {7500.06f, -3122.51f, 434.749f, 5.17f, 0}, + {7504.96f, -3131.53f, 434.475f, 4.74f, 0}, + {7504.31f, -3133.53f, 435.693f, 3.84f, 6000}, + {7504.55f, -3133.27f, 435.476f, 0.68f, 15000}, + {7501.99f, -3126.01f, 434.93f, 1.83f, 0}, + {7490.76f, -3114.97f, 434.431f, 2.51f, 0}, + {7479.64f, -3105.51f, 431.123f, 1.83f, 0}, + {7474.63f, -3086.59f, 428.994f, 1.83f, 2000}, + {7472.96f, -3074.18f, 427.566f, 1.57f, 0}, + {7472.25f, -3063, 428.268f, 1.55f, 0}, + {7473.46f, -3054.22f, 427.588f, 0.36f, 0}, + {7475.08f, -3053.6f, 428.653f, 0.36f, 6000}, + {7474.66f, -3053.56f, 428.433f, 3.19f, 4000}, + {7471.81f, -3058.84f, 427.073f, 4.29f, 0}, + {7472.16f, -3064.91f, 427.772f, 4.95f, 0}, + {7471.56f, -3085.36f, 428.924f, 4.72f, 0}, + {7473.56f, -3093.48f, 429.294f, 5.04f, 0}, + {7478.94f, -3104.29f, 430.638f, 5.23f, 0}, + {7484.46f, -3109.61f, 432.769f, 5.79f, 0}, + {7490.23f, -3111.08f, 434.431f, 0.02f, 0}, + {7496.29f, -3108, 434.783f, 1.15f, 0}, + {7497.46f, -3100.66f, 436.191f, 1.50f, 0}, + {7495.64f, -3093.39f, 438.349f, 2.10f, 0}, + {7492.44f, -3086.01f, 440.267f, 1.38f, 0}, + {7498.26f, -3076.44f, 440.808f, 0.71f, 0}, + {7506.4f, -3067.35f, 443.64f, 0.77f, 0}, + {7518.37f, -3057.42f, 445.584f, 0.74f, 0}, + {7517.51f, -3056.3f, 444.568f, 2.49f, 4500} }; -#define ASPECT_RAVEN 22915 - -#define ASPECT_RAVEN_SUMMON_X 7472.96f -#define ASPECT_RAVEN_SUMMON_Y -3074.18f -#define ASPECT_RAVEN_SUMMON_Z 427.566f -#define CLINTAR_SPIRIT_SUMMON_X 7459.2275f -#define CLINTAR_SPIRIT_SUMMON_Y -3122.5632f -#define CLINTAR_SPIRIT_SUMMON_Z 438.9842f -#define CLINTAR_SPIRIT_SUMMON_O 0.8594f - -//from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong. -#define CLINTAR_SPIRIT_SAY_START -1000286 -#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 -1000287 -#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 -1000288 -#define CLINTAR_SPIRIT_SAY_GET_ONE -1000289 -#define CLINTAR_SPIRIT_SAY_GET_TWO -1000290 -#define CLINTAR_SPIRIT_SAY_GET_THREE -1000291 -#define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292 +Position const AspectRavenSummon = {7472.96f, -3074.18f, 427.566f, 0.0f}; +Position const ClintarSpiritSummon = {7459.2275f, -3122.5632f, 438.9842f, 0.8594f}; + +enum ClintarSpirit +{ + ASPECT_RAVEN = 22915, + + //from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong. + CLINTAR_SPIRIT_SAY_START = -1000286, + CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 = -1000287, + CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 = -1000288, + CLINTAR_SPIRIT_SAY_GET_ONE = -1000289, + CLINTAR_SPIRIT_SAY_GET_TWO = -1000290, + CLINTAR_SPIRIT_SAY_GET_THREE = -1000291, + CLINTAR_SPIRIT_SAY_GET_FINAL = -1000292 +}; class npc_clintar_spirit : public CreatureScript { @@ -298,14 +298,14 @@ public: public: npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {} - uint32 Step; + uint8 Step; uint32 CurrWP; - uint32 Event_Timer; - uint32 checkPlayer_Timer; + uint32 EventTimer; + uint32 checkPlayerTimer; uint64 PlayerGUID; - bool Event_onWait; + bool EventOnWait; void Reset() { @@ -313,10 +313,10 @@ public: { Step = 0; CurrWP = 0; - Event_Timer = 0; + EventTimer = 0; PlayerGUID = 0; - checkPlayer_Timer = 1000; - Event_onWait = false; + checkPlayerTimer = 1000; + EventOnWait = false; } } @@ -347,8 +347,7 @@ public: void EnterCombat(Unit* who) { - uint32 rnd = rand()%2; - switch (rnd) + switch (urand(0, 1)) { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break; case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break; @@ -357,9 +356,7 @@ public: void StartEvent(Player* player) { - if (!player) - return; - if (player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { for (uint8 i = 0; i < 41; ++i) { @@ -381,18 +378,18 @@ public: return; } - if (!me->isInCombat() && !Event_onWait) + if (!me->isInCombat() && !EventOnWait) { - if (checkPlayer_Timer <= diff) + if (checkPlayerTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player && player->isInCombat() && player->getAttackerForHelper()) AttackStart(player->getAttackerForHelper()); - checkPlayer_Timer = 1000; - } else checkPlayer_Timer -= diff; + checkPlayerTimer = 1000; + } else checkPlayerTimer -= diff; } - if (Event_onWait && Event_Timer <= diff) + if (EventOnWait && EventTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); @@ -409,11 +406,11 @@ public: { case 0: me->Say(CLINTAR_SPIRIT_SAY_START, 0, PlayerGUID); - Event_Timer = 8000; + EventTimer = 8000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -422,13 +419,13 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, player); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -437,12 +434,12 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -451,11 +448,11 @@ public: { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, player); - Event_Timer = 15000; + EventTimer = 15000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -463,19 +460,16 @@ public: switch (Step) { case 0: - { - Creature* mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); - if (mob) + if (Creature* mob = me->SummonCreature(ASPECT_RAVEN, AspectRavenSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) { mob->AddThreat(me, 10000.0f); mob->AI()->AttackStart(me); } - Event_Timer = 2000; + EventTimer = 2000; Step = 1; break; - } case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -484,12 +478,12 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -498,11 +492,11 @@ public: { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, player); - Event_Timer = 4000; + EventTimer = 4000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -513,12 +507,12 @@ public: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, player); player->CompleteQuest(10965); - Event_Timer = 1500; + EventTimer = 1500; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_Timer = 3000; + EventTimer = 3000; Step = 2; break; case 2: @@ -530,19 +524,19 @@ public: } break; default: - Event_onWait = false; + EventOnWait = false; break; } - } else if (Event_onWait) Event_Timer -= diff; + } else if (EventOnWait) EventTimer -= diff; } void WaypointReached(uint32 waypointId) { CurrWP = waypointId; - Event_Timer = 0; + EventTimer = 0; Step = 0; - Event_onWait = true; + EventOnWait = true; } }; @@ -552,7 +546,10 @@ public: # npc_clintar_dreamwalker ####*/ -#define CLINTAR_SPIRIT 22916 +enum Clintar +{ + CLINTAR_SPIRIT = 22916 +}; class npc_clintar_dreamwalker : public CreatureScript { @@ -562,11 +559,8 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == 10965) - { - Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000); - if (clintar_spirit) + if (Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, ClintarSpiritSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000)) CAST_AI(npc_clintar_spirit::npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(player); - } return true; } diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp index bd4cf55b7b2..5b35688c2b8 100644 --- a/src/server/scripts/Kalimdor/mulgore.cpp +++ b/src/server/scripts/Kalimdor/mulgore.cpp @@ -29,8 +29,9 @@ npc_kyle_frenzied npc_plains_vision EndContentData */ -#include "ScriptPCH.h" -#include "ScriptedEscortAI.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### # npc_skorn_whitecloud @@ -71,7 +72,7 @@ public: # npc_kyle_frenzied ######*/ -enum eKyleFrenzied +enum KyleFrenzied { //emote signed for 7780 but propably thats wrong id. EMOTE_SEE_LUNCH = -1000340, @@ -98,30 +99,30 @@ public: { npc_kyle_frenziedAI(Creature* creature) : ScriptedAI(creature) {} - bool bEvent; - bool m_bIsMovingToLunch; - uint64 uiPlayerGUID; - uint32 uiEventTimer; - uint8 uiEventPhase; + bool EventActive; + bool IsMovingToLunch; + uint64 PlayerGUID; + uint32 EventTimer; + uint8 EventPhase; void Reset() { - bEvent = false; - m_bIsMovingToLunch = false; - uiPlayerGUID = 0; - uiEventTimer = 5000; - uiEventPhase = 0; + EventActive = false; + IsMovingToLunch = false; + PlayerGUID = 0; + EventTimer = 5000; + EventPhase = 0; if (me->GetEntry() == NPC_KYLE_FRIENDLY) me->UpdateEntry(NPC_KYLE_FRENZIED); } - void SpellHit(Unit* pCaster, SpellInfo const* pSpell) + void SpellHit(Unit* Caster, SpellInfo const* Spell) { - if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) + if (!me->getVictim() && !EventActive && Spell->Id == SPELL_LUNCH) { - if (pCaster->GetTypeId() == TYPEID_PLAYER) - uiPlayerGUID = pCaster->GetGUID(); + if (Caster->GetTypeId() == TYPEID_PLAYER) + PlayerGUID = Caster->GetGUID(); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) { @@ -130,41 +131,41 @@ public: me->StopMoving(); } - bEvent = true; + EventActive = true; DoScriptText(EMOTE_SEE_LUNCH, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL); } } - void MovementInform(uint32 uiType, uint32 uiPointId) + void MovementInform(uint32 Type, uint32 PointId) { - if (uiType != POINT_MOTION_TYPE || !bEvent) + if (Type != POINT_MOTION_TYPE || !EventActive) return; - if (uiPointId == POINT_ID) - m_bIsMovingToLunch = false; + if (PointId == POINT_ID) + IsMovingToLunch = false; } void UpdateAI(const uint32 diff) { - if (bEvent) + if (EventActive) { - if (m_bIsMovingToLunch) + if (IsMovingToLunch) return; - if (uiEventTimer <= diff) + if (EventTimer <= diff) { - uiEventTimer = 5000; - ++uiEventPhase; + EventTimer = 5000; + ++EventPhase; - switch (uiEventPhase) + switch (EventPhase) { case 1: - if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID)) + if (Unit* unit = Unit::GetUnit(*me, PlayerGUID)) { if (GameObject* go = unit->GetGameObject(SPELL_LUNCH)) { - m_bIsMovingToLunch = true; + IsMovingToLunch = true; me->GetMotionMaster()->MovePoint(POINT_ID, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()); } } @@ -174,13 +175,13 @@ public: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); break; case 3: - if (Player* unit = Unit::GetPlayer(*me, uiPlayerGUID)) + if (Player* unit = Unit::GetPlayer(*me, PlayerGUID)) unit->TalkedToCreature(me->GetEntry(), me->GetGUID()); me->UpdateEntry(NPC_KYLE_FRIENDLY); break; case 4: - uiEventTimer = 30000; + EventTimer = 30000; DoScriptText(EMOTE_DANCE, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL); break; @@ -192,7 +193,7 @@ public: } } else - uiEventTimer -= diff; + EventTimer -= diff; } } }; @@ -203,58 +204,58 @@ public: # npc_plains_vision ######*/ -float wp_plain_vision[50][3] = +Position const wpPlainVision[50] = { - {-2226.32f, -408.095f, -9.36235f}, - {-2203.04f, -437.212f, -5.72498f}, - {-2163.91f, -457.851f, -7.09049f}, - {-2123.87f, -448.137f, -9.29591f}, - {-2104.66f, -427.166f, -6.49513f}, - {-2101.48f, -422.826f, -5.3567f}, - {-2097.56f, -417.083f, -7.16716f}, - {-2084.87f, -398.626f, -9.88973f}, - {-2072.71f, -382.324f, -10.2488f}, - {-2054.05f, -356.728f, -6.22468f}, - {-2051.8f, -353.645f, -5.35791f}, - {-2049.08f, -349.912f, -6.15723f}, - {-2030.6f, -310.724f, -9.59302f}, - {-2002.15f, -249.308f, -10.8124f}, - {-1972.85f, -195.811f, -10.6316f}, - {-1940.93f, -147.652f, -11.7055f}, - {-1888.06f, -81.943f, -11.4404f}, - {-1837.05f, -34.0109f, -12.258f}, - {-1796.12f, -14.6462f, -10.3581f}, - {-1732.61f, -4.27746f, -10.0213f}, - {-1688.94f, -0.829945f, -11.7103f}, - {-1681.32f, 13.0313f, -9.48056f}, - {-1677.04f, 36.8349f, -7.10318f}, - {-1675.2f, 68.559f, -8.95384f}, - {-1676.57f, 89.023f, -9.65104f}, - {-1678.16f, 110.939f, -10.1782f}, - {-1677.86f, 128.681f, -5.73869f}, - {-1675.27f, 144.324f, -3.47916f}, - {-1671.7f, 163.169f, -1.23098f}, - {-1666.61f, 181.584f, 5.26145f}, - {-1661.51f, 196.154f, 8.95252f}, - {-1655.47f, 210.811f, 8.38727f}, - {-1647.07f, 226.947f, 5.27755f}, - {-1621.65f, 232.91f, 2.69579f}, - {-1600.23f, 237.641f, 2.98539f}, - {-1576.07f, 242.546f, 4.66541f}, - {-1554.57f, 248.494f, 6.60377f}, - {-1547.53f, 259.302f, 10.6741f}, - {-1541.7f, 269.847f, 16.4418f}, - {-1539.83f, 278.989f, 21.0597f}, - {-1540.16f, 290.219f, 27.8247f}, - {-1538.99f, 298.983f, 34.0032f}, - {-1540.38f, 307.337f, 41.3557f}, - {-1536.61f, 314.884f, 48.0179f}, - {-1532.42f, 323.277f, 55.6667f}, - {-1528.77f, 329.774f, 61.1525f}, - {-1525.65f, 333.18f, 63.2161f}, - {-1517.01f, 350.713f, 62.4286f}, - {-1511.39f, 362.537f, 62.4539f}, - {-1508.68f, 366.822f, 62.733f} + {-2226.32f, -408.095f, -9.36235f, 0.0f}, + {-2203.04f, -437.212f, -5.72498f, 0.0f}, + {-2163.91f, -457.851f, -7.09049f, 0.0f}, + {-2123.87f, -448.137f, -9.29591f, 0.0f}, + {-2104.66f, -427.166f, -6.49513f, 0.0f}, + {-2101.48f, -422.826f, -5.3567f, 0.0f}, + {-2097.56f, -417.083f, -7.16716f, 0.0f}, + {-2084.87f, -398.626f, -9.88973f, 0.0f}, + {-2072.71f, -382.324f, -10.2488f, 0.0f}, + {-2054.05f, -356.728f, -6.22468f, 0.0f}, + {-2051.8f, -353.645f, -5.35791f, 0.0f}, + {-2049.08f, -349.912f, -6.15723f, 0.0f}, + {-2030.6f, -310.724f, -9.59302f, 0.0f}, + {-2002.15f, -249.308f, -10.8124f, 0.0f}, + {-1972.85f, -195.811f, -10.6316f, 0.0f}, + {-1940.93f, -147.652f, -11.7055f, 0.0f}, + {-1888.06f, -81.943f, -11.4404f, 0.0f}, + {-1837.05f, -34.0109f, -12.258f, 0.0f}, + {-1796.12f, -14.6462f, -10.3581f, 0.0f}, + {-1732.61f, -4.27746f, -10.0213f, 0.0f}, + {-1688.94f, -0.829945f, -11.7103f, 0.0f}, + {-1681.32f, 13.0313f, -9.48056f, 0.0f}, + {-1677.04f, 36.8349f, -7.10318f, 0.0f}, + {-1675.2f, 68.559f, -8.95384f, 0.0f}, + {-1676.57f, 89.023f, -9.65104f, 0.0f}, + {-1678.16f, 110.939f, -10.1782f, 0.0f}, + {-1677.86f, 128.681f, -5.73869f, 0.0f}, + {-1675.27f, 144.324f, -3.47916f, 0.0f}, + {-1671.7f, 163.169f, -1.23098f, 0.0f}, + {-1666.61f, 181.584f, 5.26145f, 0.0f}, + {-1661.51f, 196.154f, 8.95252f, 0.0f}, + {-1655.47f, 210.811f, 8.38727f, 0.0f}, + {-1647.07f, 226.947f, 5.27755f, 0.0f}, + {-1621.65f, 232.91f, 2.69579f, 0.0f}, + {-1600.23f, 237.641f, 2.98539f, 0.0f}, + {-1576.07f, 242.546f, 4.66541f, 0.0f}, + {-1554.57f, 248.494f, 6.60377f, 0.0f}, + {-1547.53f, 259.302f, 10.6741f, 0.0f}, + {-1541.7f, 269.847f, 16.4418f, 0.0f}, + {-1539.83f, 278.989f, 21.0597f, 0.0f}, + {-1540.16f, 290.219f, 27.8247f, 0.0f}, + {-1538.99f, 298.983f, 34.0032f, 0.0f}, + {-1540.38f, 307.337f, 41.3557f, 0.0f}, + {-1536.61f, 314.884f, 48.0179f, 0.0f}, + {-1532.42f, 323.277f, 55.6667f, 0.0f}, + {-1528.77f, 329.774f, 61.1525f, 0.0f}, + {-1525.65f, 333.18f, 63.2161f, 0.0f}, + {-1517.01f, 350.713f, 62.4286f, 0.0f}, + {-1511.39f, 362.537f, 62.4539f, 0.0f}, + {-1508.68f, 366.822f, 62.733f, 0.0f} }; class npc_plains_vision : public CreatureScript @@ -305,7 +306,7 @@ public: { if (newWaypoint) { - me->GetMotionMaster()->MovePoint(WayPointId, wp_plain_vision[WayPointId][0], wp_plain_vision[WayPointId][1], wp_plain_vision[WayPointId][2]); + me->GetMotionMaster()->MovePoint(WayPointId, wpPlainVision[WayPointId]); newWaypoint = false; } } diff --git a/src/server/scripts/Kalimdor/orgrimmar.cpp b/src/server/scripts/Kalimdor/orgrimmar.cpp index 2ff2d28768a..fca8d0f5fc5 100644 --- a/src/server/scripts/Kalimdor/orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/orgrimmar.cpp @@ -28,13 +28,15 @@ npc_shenthul npc_thrall_warchief EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_shenthul ######*/ -enum eShenthul +enum Shenthul { QUEST_SHATTERED_SALUTE = 2460 }; @@ -65,16 +67,16 @@ public: bool CanTalk; bool CanEmote; - uint32 Salute_Timer; - uint32 Reset_Timer; + uint32 SaluteTimer; + uint32 ResetTimer; uint64 PlayerGUID; void Reset() { CanTalk = false; CanEmote = false; - Salute_Timer = 6000; - Reset_Timer = 0; + SaluteTimer = 6000; + ResetTimer = 0; PlayerGUID = 0; } @@ -84,7 +86,7 @@ public: { if (CanEmote) { - if (Reset_Timer <= diff) + if (ResetTimer <= diff) { if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) { @@ -92,17 +94,17 @@ public: player->FailQuest(QUEST_SHATTERED_SALUTE); } Reset(); - } else Reset_Timer -= diff; + } else ResetTimer -= diff; } if (CanTalk && !CanEmote) { - if (Salute_Timer <= diff) + if (SaluteTimer <= diff) { me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); CanEmote = true; - Reset_Timer = 60000; - } else Salute_Timer -= diff; + ResetTimer = 60000; + } else SaluteTimer -= diff; } if (!UpdateVictim()) @@ -130,10 +132,13 @@ public: ## npc_thrall_warchief ######*/ -#define QUEST_6566 6566 +enum ThrallWarchief +{ + QUEST_6566 = 6566, -#define SPELL_CHAIN_LIGHTNING 16033 -#define SPELL_SHOCK 16034 + SPELL_CHAIN_LIGHTNING = 16033, + SPELL_SHOCK = 16034 +}; #define GOSSIP_HTW "Please share your wisdom with me, Warchief." #define GOSSIP_STW1 "What discoveries?" @@ -207,13 +212,13 @@ public: { npc_thrall_warchiefAI(Creature* creature) : ScriptedAI(creature) {} - uint32 ChainLightning_Timer; - uint32 Shock_Timer; + uint32 ChainLightningTimer; + uint32 ShockTimer; void Reset() { - ChainLightning_Timer = 2000; - Shock_Timer = 8000; + ChainLightningTimer = 2000; + ShockTimer = 8000; } void EnterCombat(Unit* /*who*/) {} @@ -223,17 +228,17 @@ public: if (!UpdateVictim()) return; - if (ChainLightning_Timer <= diff) + if (ChainLightningTimer <= diff) { DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - ChainLightning_Timer = 9000; - } else ChainLightning_Timer -= diff; + ChainLightningTimer = 9000; + } else ChainLightningTimer -= diff; - if (Shock_Timer <= diff) + if (ShockTimer <= diff) { DoCast(me->getVictim(), SPELL_SHOCK); - Shock_Timer = 15000; - } else Shock_Timer -= diff; + ShockTimer = 15000; + } else ShockTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index 2d91f32fe9d..639de3dc3b2 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -29,7 +29,9 @@ npcs_rutgar_and_frankal quest_a_pawn_on_the_eternal_pawn EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "Group.h" /*### @@ -125,9 +127,11 @@ public: #define GOSSIP_ITEM14 "I should ask the monkey about this" #define GOSSIP_ITEM15 "Then what..." -//trigger creatures to kill -#define TRIGGER_RUTGAR 15222 -#define TRIGGER_FRANKAL 15221 +enum RutgarAndFrankal //trigger creatures to kill +{ + TRIGGER_FRANKAL = 15221, + TRIGGER_RUTGAR = 15222 +}; class npcs_rutgar_and_frankal : public CreatureScript { @@ -223,7 +227,7 @@ public: /*#### # quest_a_pawn_on_the_eternal_board (Defines) ####*/ -enum eEternalBoard +enum EternalBoard { QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519, @@ -290,7 +294,6 @@ TO DO: get correct spell IDs and timings for spells cast upon dragon transformat TO DO: Dragons should use the HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF) after transformation, but for some unknown reason it doesnt work. EndContentData */ -#define QUEST_A_PAWN_ON_THE_ETERNAL_BOARD 8519 #define EVENT_AREA_RADIUS 65 //65yds #define EVENT_COOLDOWN 500000 //in ms. appear after event completed or failed (should be = Adds despawn time) @@ -373,13 +376,8 @@ static QuestCinematic EventAnim[]= {0, 0, 0} }; -struct Location -{ - float x, y, z, o; -}; - //Cordinates for Spawns -static Location SpawnLocation[]= +Position const SpawnLocation[] = { {-8085.0f, 1528.0f, 2.61f, 3.141592f}, //Kaldorei Infantry {-8080.0f, 1526.0f, 2.61f, 3.141592f}, //Kaldorei Infantry @@ -460,7 +458,7 @@ struct WaveData int32 WaveTextId; }; -static WaveData WavesInfo[] = +static WaveData WavesInfo[5] = { {30, 0, 15423, 0, 0, 24000, 0}, // Kaldorei Soldier { 3, 35, 15424, 0, 0, 24000, 0}, // Anubisath Conqueror @@ -475,7 +473,7 @@ struct SpawnSpells uint32 Timer1, Timer2, SpellId; }; -static SpawnSpells SpawnCast[]=// +static SpawnSpells SpawnCast[4] = { {100000, 2000, 33652}, // Stop Time {38500, 300000, 28528}, // Poison Cloud @@ -977,13 +975,9 @@ public: for (uint8 i = locIndex; i <= count; ++i) { - float x = SpawnLocation[i].x; - float y = SpawnLocation[i].y; - float z = SpawnLocation[i].z; - float o = SpawnLocation[i].o; uint32 desptimer = WavesInfo[WaveCount].DespTimer; - if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer)) + if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, SpawnLocation[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer)) { if (spawn->GetEntry() == 15423) spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15427+rand()%4); diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp index 635bb50509e..d38395c7b37 100644 --- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp @@ -28,7 +28,9 @@ npc_braug_dimspirit npc_kaya_flathoof EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### @@ -90,7 +92,7 @@ public: ## npc_kaya_flathoof ######*/ -enum eKaya +enum Kaya { FACTION_ESCORTEE_H = 775, diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp index da0e0e738cf..9b742b495bb 100644 --- a/src/server/scripts/Kalimdor/tanaris.cpp +++ b/src/server/scripts/Kalimdor/tanaris.cpp @@ -33,7 +33,9 @@ npc_OOX17 npc_tooga EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" @@ -41,10 +43,13 @@ EndContentData */ ## mob_aquementas ######*/ -#define AGGRO_YELL_AQUE -1000350 +enum Aquementas +{ + AGGRO_YELL_AQUE = -1000350, -#define SPELL_AQUA_JET 13586 -#define SPELL_FROST_SHOCK 15089 + SPELL_AQUA_JET = 13586, + SPELL_FROST_SHOCK = 15089 +}; class mob_aquementas : public CreatureScript { @@ -60,22 +65,22 @@ public: { mob_aquementasAI(Creature* creature) : ScriptedAI(creature) {} - uint32 SendItem_Timer; - uint32 SwitchFaction_Timer; + uint32 SendItemTimer; + uint32 SwitchFactionTimer; bool isFriendly; - uint32 FrostShock_Timer; - uint32 AquaJet_Timer; + uint32 FrostShockTimer; + uint32 AquaJetTimer; void Reset() { - SendItem_Timer = 0; - SwitchFaction_Timer = 10000; + SendItemTimer = 0; + SwitchFactionTimer = 10000; me->setFaction(35); isFriendly = true; - AquaJet_Timer = 5000; - FrostShock_Timer = 1000; + AquaJetTimer = 5000; + FrostShockTimer = 1000; } void SendItem(Unit* receiver) @@ -101,11 +106,11 @@ public: { if (isFriendly) { - if (SwitchFaction_Timer <= diff) + if (SwitchFactionTimer <= diff) { me->setFaction(91); isFriendly = false; - } else SwitchFaction_Timer -= diff; + } else SwitchFactionTimer -= diff; } if (!UpdateVictim()) @@ -113,25 +118,25 @@ public: if (!isFriendly) { - if (SendItem_Timer <= diff) + if (SendItemTimer <= diff) { if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) SendItem(me->getVictim()); - SendItem_Timer = 5000; - } else SendItem_Timer -= diff; + SendItemTimer = 5000; + } else SendItemTimer -= diff; } - if (FrostShock_Timer <= diff) + if (FrostShockTimer <= diff) { DoCast(me->getVictim(), SPELL_FROST_SHOCK); - FrostShock_Timer = 15000; - } else FrostShock_Timer -= diff; + FrostShockTimer = 15000; + } else FrostShockTimer -= diff; - if (AquaJet_Timer <= diff) + if (AquaJetTimer <= diff) { DoCast(me, SPELL_AQUA_JET); - AquaJet_Timer = 15000; - } else AquaJet_Timer -= diff; + AquaJetTimer = 15000; + } else AquaJetTimer -= diff; DoMeleeAttackIfReady(); } @@ -143,20 +148,23 @@ public: ## npc_custodian_of_time ######*/ -#define WHISPER_CUSTODIAN_1 -1000217 -#define WHISPER_CUSTODIAN_2 -1000218 -#define WHISPER_CUSTODIAN_3 -1000219 -#define WHISPER_CUSTODIAN_4 -1000220 -#define WHISPER_CUSTODIAN_5 -1000221 -#define WHISPER_CUSTODIAN_6 -1000222 -#define WHISPER_CUSTODIAN_7 -1000223 -#define WHISPER_CUSTODIAN_8 -1000224 -#define WHISPER_CUSTODIAN_9 -1000225 -#define WHISPER_CUSTODIAN_10 -1000226 -#define WHISPER_CUSTODIAN_11 -1000227 -#define WHISPER_CUSTODIAN_12 -1000228 -#define WHISPER_CUSTODIAN_13 -1000229 -#define WHISPER_CUSTODIAN_14 -1000230 +enum CustodianOfTime +{ + WHISPER_CUSTODIAN_1 = -1000217, + WHISPER_CUSTODIAN_2 = -1000218, + WHISPER_CUSTODIAN_3 = -1000219, + WHISPER_CUSTODIAN_4 = -1000220, + WHISPER_CUSTODIAN_5 = -1000221, + WHISPER_CUSTODIAN_6 = -1000222, + WHISPER_CUSTODIAN_7 = -1000223, + WHISPER_CUSTODIAN_8 = -1000224, + WHISPER_CUSTODIAN_9 = -1000225, + WHISPER_CUSTODIAN_10 = -1000226, + WHISPER_CUSTODIAN_11 = -1000227, + WHISPER_CUSTODIAN_12 = -1000228, + WHISPER_CUSTODIAN_13 = -1000229, + WHISPER_CUSTODIAN_14 = -1000230 +}; class npc_custodian_of_time : public CreatureScript { @@ -174,69 +182,68 @@ public: void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 0: - DoScriptText(WHISPER_CUSTODIAN_1, me, player); - break; - case 1: - DoScriptText(WHISPER_CUSTODIAN_2, me, player); - break; - case 2: - DoScriptText(WHISPER_CUSTODIAN_3, me, player); - break; - case 3: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 5: - DoScriptText(WHISPER_CUSTODIAN_5, me, player); - break; - case 6: - DoScriptText(WHISPER_CUSTODIAN_6, me, player); - break; - case 7: - DoScriptText(WHISPER_CUSTODIAN_7, me, player); - break; - case 8: - DoScriptText(WHISPER_CUSTODIAN_8, me, player); - break; - case 9: - DoScriptText(WHISPER_CUSTODIAN_9, me, player); - break; - case 10: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 13: - DoScriptText(WHISPER_CUSTODIAN_10, me, player); - break; - case 14: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 16: - DoScriptText(WHISPER_CUSTODIAN_11, me, player); - break; - case 17: - DoScriptText(WHISPER_CUSTODIAN_12, me, player); - break; - case 18: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 22: - DoScriptText(WHISPER_CUSTODIAN_13, me, player); - break; - case 23: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 24: - DoScriptText(WHISPER_CUSTODIAN_14, me, player); - DoCast(player, 34883); - // below here is temporary workaround, to be removed when spell works properly - player->AreaExploredOrEventHappens(10277); - break; + switch (waypointId) + { + case 0: + DoScriptText(WHISPER_CUSTODIAN_1, me, player); + break; + case 1: + DoScriptText(WHISPER_CUSTODIAN_2, me, player); + break; + case 2: + DoScriptText(WHISPER_CUSTODIAN_3, me, player); + break; + case 3: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 5: + DoScriptText(WHISPER_CUSTODIAN_5, me, player); + break; + case 6: + DoScriptText(WHISPER_CUSTODIAN_6, me, player); + break; + case 7: + DoScriptText(WHISPER_CUSTODIAN_7, me, player); + break; + case 8: + DoScriptText(WHISPER_CUSTODIAN_8, me, player); + break; + case 9: + DoScriptText(WHISPER_CUSTODIAN_9, me, player); + break; + case 10: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 13: + DoScriptText(WHISPER_CUSTODIAN_10, me, player); + break; + case 14: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 16: + DoScriptText(WHISPER_CUSTODIAN_11, me, player); + break; + case 17: + DoScriptText(WHISPER_CUSTODIAN_12, me, player); + break; + case 18: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 22: + DoScriptText(WHISPER_CUSTODIAN_13, me, player); + break; + case 23: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 24: + DoScriptText(WHISPER_CUSTODIAN_14, me, player); + DoCast(player, 34883); + // below here is temporary workaround, to be removed when spell works properly + player->AreaExploredOrEventHappens(10277); + break; + } } } @@ -259,7 +266,7 @@ public: } void EnterCombat(Unit* /*who*/) {} - void Reset() { } + void Reset() {} void UpdateAI(const uint32 diff) { @@ -416,7 +423,7 @@ public: ## npc_OOX17 ######*/ -enum e00X17 +enum Npc00X17 { //texts are signed for 7806 SAY_OOX_START = -1000287, @@ -464,30 +471,29 @@ public: void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 23: - me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - break; - case 56: - me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) - DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); - break; - case 86: - DoScriptText(SAY_OOX_END, me); - player->GroupEventHappens(Q_OOX17, me); - break; + switch (waypointId) + { + case 23: + me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 56: + me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) + DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); + break; + case 86: + DoScriptText(SAY_OOX_END, me); + player->GroupEventHappens(Q_OOX17, me); + break; + } } } @@ -509,7 +515,7 @@ public: # npc_tooga ####*/ -enum eTooga +enum Tooga { SAY_TOOG_THIRST = -1000391, SAY_TOOG_WORRIED = -1000392, @@ -527,7 +533,7 @@ enum eTooga FACTION_TOOG_ESCORTEE = 113 }; -const float m_afToWaterLoc[] = {-7032.664551f, -4906.199219f, -1.606446f}; +Position const ToWaterLoc = {-7032.664551f, -4906.199219f, -1.606446f, 0.0f}; class npc_tooga : public CreatureScript { @@ -554,17 +560,17 @@ public: { npc_toogaAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiCheckSpeechTimer; - uint32 m_uiPostEventTimer; - uint32 m_uiPhasePostEvent; + uint32 CheckSpeechTimer; + uint32 PostEventTimer; + uint32 PhasePostEvent; uint64 TortaGUID; void Reset() { - m_uiCheckSpeechTimer = 2500; - m_uiPostEventTimer = 1000; - m_uiPhasePostEvent = 0; + CheckSpeechTimer = 2500; + PostEventTimer = 1000; + PhasePostEvent = 0; TortaGUID = 0; } @@ -577,11 +583,9 @@ public: { if (me->IsWithinDistInMap(who, INTERACTION_DISTANCE)) { - if (Player* player = GetLeaderForFollower()) - { - if (player->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) - player->GroupEventHappens(QUEST_TOOGA, me); - } + Player* player = GetLeaderForFollower(); + if (player && player->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + player->GroupEventHappens(QUEST_TOOGA, me); TortaGUID = who->GetGUID(); SetFollowComplete(true); @@ -589,27 +593,27 @@ public: } } - void MovementInform(uint32 uiMotionType, uint32 uiPointId) + void MovementInform(uint32 MotionType, uint32 PointId) { - FollowerAI::MovementInform(uiMotionType, uiPointId); + FollowerAI::MovementInform(MotionType, PointId); - if (uiMotionType != POINT_MOTION_TYPE) + if (MotionType != POINT_MOTION_TYPE) return; - if (uiPointId == POINT_ID_TO_WATER) + if (PointId == POINT_ID_TO_WATER) SetFollowComplete(); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { //we are doing the post-event, or... if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { - if (m_uiPostEventTimer <= uiDiff) + if (PostEventTimer <= Diff) { - m_uiPostEventTimer = 5000; + PostEventTimer = 5000; Unit* pTorta = Unit::GetUnit(*me, TortaGUID); if (!pTorta || !pTorta->isAlive()) @@ -619,7 +623,7 @@ public: return; } - switch (m_uiPhasePostEvent) + switch (PhasePostEvent) { case 1: DoScriptText(SAY_TOOG_POST_1, me); @@ -638,27 +642,27 @@ public: break; case 6: DoScriptText(SAY_TORT_POST_6, pTorta); - me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); + me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, ToWaterLoc); break; } - ++m_uiPhasePostEvent; + ++PhasePostEvent; } else - m_uiPostEventTimer -= uiDiff; + PostEventTimer -= Diff; } //...we are doing regular speech check else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - if (m_uiCheckSpeechTimer <= uiDiff) + if (CheckSpeechTimer <= Diff) { - m_uiCheckSpeechTimer = 5000; + CheckSpeechTimer = 5000; if (urand(0, 9) > 8) DoScriptText(RAND(SAY_TOOG_THIRST, SAY_TOOG_WORRIED), me); } else - m_uiCheckSpeechTimer -= uiDiff; + CheckSpeechTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/teldrassil.cpp b/src/server/scripts/Kalimdor/teldrassil.cpp index d7cac99c374..7f2b2fc7f05 100644 --- a/src/server/scripts/Kalimdor/teldrassil.cpp +++ b/src/server/scripts/Kalimdor/teldrassil.cpp @@ -27,14 +27,15 @@ EndScriptData */ npc_mist EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedFollowerAI.h" /*#### # npc_mist ####*/ -enum eMist +enum Mist { SAY_AT_HOME = -1000323, EMOTE_AT_HOME = -1000324, @@ -51,10 +52,8 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_MIST) - { if (npc_mistAI* pMistAI = CAST_AI(npc_mist::npc_mistAI, creature->AI())) pMistAI->StartFollow(player, FACTION_DARNASSUS, quest); - } return true; } @@ -88,18 +87,16 @@ public: { DoScriptText(EMOTE_AT_HOME, me); - if (Player* player = GetLeaderForFollower()) - { - if (player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) - player->GroupEventHappens(QUEST_MIST, me); - } + Player* player = GetLeaderForFollower(); + if (player && player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) + player->GroupEventHappens(QUEST_MIST, me); //The follow is over (and for later development, run off to the woods before really end) SetFollowComplete(); } //call not needed here, no known abilities - /*void UpdateFollowerAI(const uint32 uiDiff) + /*void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) return; diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index 933ad4de3eb..f4983558b67 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -32,7 +32,9 @@ npc_twiggy_flathead npc_wizzlecrank_shredder EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### @@ -41,7 +43,7 @@ EndContentData */ #define GOSSIP_CORPSE "Examine corpse in detail..." -enum eQuests +enum BeatenCorpse { QUEST_LOST_IN_BATTLE = 4921 }; @@ -77,7 +79,7 @@ public: # npc_gilthares ######*/ -enum eGilthares +enum Gilthares { SAY_GIL_START = -1000370, SAY_GIL_AT_LAST = -1000371, @@ -214,7 +216,7 @@ public: ## npc_taskmaster_fizzule ######*/ -enum eEnums +enum TaskmasterFizzule { FACTION_FRIENDLY_F = 35, SPELL_FLARE = 10113, @@ -240,13 +242,13 @@ public: uint32 factionNorm; bool IsFriend; - uint32 Reset_Timer; + uint32 ResetTimer; uint8 FlareCount; void Reset() { IsFriend = false; - Reset_Timer = 120000; + ResetTimer = 120000; FlareCount = 0; me->setFaction(factionNorm); } @@ -281,11 +283,11 @@ public: { if (IsFriend) { - if (Reset_Timer <= diff) + if (ResetTimer <= diff) { EnterEvadeMode(); return; - } else Reset_Timer -= diff; + } else ResetTimer -= diff; } if (!UpdateVictim()) @@ -315,7 +317,7 @@ public: ## npc_twiggy_flathead #####*/ -enum eTwiggyFlathead +enum TwiggyFlathead { NPC_BIG_WILL = 6238, NPC_AFFRAY_CHALLENGER = 6240, @@ -327,7 +329,7 @@ enum eTwiggyFlathead SAY_TWIGGY_FLATHEAD_OVER = -1000127, }; -float AffrayChallengerLoc[6][4]= +Position const AffrayChallengerLoc[6] = { {-1683.0f, -4326.0f, 2.79f, 0.0f}, {-1682.0f, -4329.0f, 2.79f, 0.0f}, @@ -354,10 +356,10 @@ public: bool EventInProgress; bool EventGrate; bool EventBigWill; - bool Challenger_down[6]; - uint32 Wave; - uint32 Wave_Timer; - uint32 Challenger_checker; + bool ChallengerDown[6]; + uint8 Wave; + uint32 WaveTimer; + uint32 ChallengerChecker; uint64 PlayerGUID; uint64 AffrayChallenger[6]; uint64 BigWill; @@ -367,15 +369,15 @@ public: EventInProgress = false; EventGrate = false; EventBigWill = false; - Wave_Timer = 600000; - Challenger_checker = 0; + WaveTimer = 600000; + ChallengerChecker = 0; Wave = 0; PlayerGUID = 0; for (uint8 i = 0; i < 6; ++i) { AffrayChallenger[i] = 0; - Challenger_down[i] = false; + ChallengerDown[i] = false; } BigWill = 0; } @@ -441,7 +443,7 @@ public: for (uint8 i = 0; i < 6; ++i) { - Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); if (!creature) continue; creature->setFaction(35); @@ -450,31 +452,31 @@ public: creature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); AffrayChallenger[i] = creature->GetGUID(); } - Wave_Timer = 5000; - Challenger_checker = 1000; + WaveTimer = 5000; + ChallengerChecker = 1000; EventGrate = true; } } else if (EventInProgress) { - if (Challenger_checker <= diff) + if (ChallengerChecker <= diff) { for (uint8 i = 0; i < 6; ++i) { if (AffrayChallenger[i]) { Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]); - if ((!creature || (!creature->isAlive())) && !Challenger_down[i]) + if ((!creature || (!creature->isAlive())) && !ChallengerDown[i]) { DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); - Challenger_down[i] = true; + ChallengerDown[i] = true; } } } - Challenger_checker = 1000; - } else Challenger_checker -= diff; + ChallengerChecker = 1000; + } else ChallengerChecker -= diff; - if (Wave_Timer <= diff) + if (WaveTimer <= diff) { if (Wave < 6 && AffrayChallenger[Wave] && !EventBigWill) { @@ -488,7 +490,7 @@ public: creature->setFaction(14); creature->AI()->AttackStart(pWarrior); ++Wave; - Wave_Timer = 20000; + WaveTimer = 20000; } } else if (Wave >= 6 && !EventBigWill) { @@ -500,7 +502,7 @@ public: creature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79f); creature->HandleEmoteCommand(EMOTE_STATE_READY_UNARMED); EventBigWill = true; - Wave_Timer = 1000; + WaveTimer = 1000; } } else if (Wave >= 6 && EventBigWill && BigWill) @@ -512,7 +514,7 @@ public: Reset(); } } - } else Wave_Timer -= diff; + } else WaveTimer -= diff; } } } @@ -524,7 +526,7 @@ public: ## npc_wizzlecrank_shredder #####*/ -enum eEnums_Wizzlecrank +enum Wizzlecrank { SAY_START = -1000298, SAY_STARTUP1 = -1000299, @@ -550,14 +552,14 @@ public: { npc_wizzlecrank_shredderAI(Creature* creature) : npc_escortAI(creature) { - m_bIsPostEvent = false; - m_uiPostEventTimer = 1000; - m_uiPostEventCount = 0; + IsPostEvent = false; + PostEventTimer = 1000; + PostEventCount = 0; } - bool m_bIsPostEvent; - uint32 m_uiPostEventTimer; - uint32 m_uiPostEventCount; + bool IsPostEvent; + uint32 PostEventTimer; + uint32 PostEventCount; void Reset() { @@ -566,9 +568,9 @@ public: if (me->getStandState() == UNIT_STAND_STATE_DEAD) me->SetStandState(UNIT_STAND_STATE_STAND); - m_bIsPostEvent = false; - m_uiPostEventTimer = 1000; - m_uiPostEventCount = 0; + IsPostEvent = false; + PostEventTimer = 1000; + PostEventCount = 0; } } @@ -590,19 +592,19 @@ public: } break; case 24: - m_bIsPostEvent = true; + IsPostEvent = true; break; } } - void WaypointStart(uint32 uiPointId) + void WaypointStart(uint32 PointId) { Player* player = GetPlayerForEscort(); if (!player) return; - switch (uiPointId) + switch (PointId) { case 9: DoScriptText(SAY_STARTUP2, me, player); @@ -623,15 +625,15 @@ public: summoned->AI()->AttackStart(me); } - void UpdateEscortAI(const uint32 uiDiff) + void UpdateEscortAI(const uint32 Diff) { if (!UpdateVictim()) { - if (m_bIsPostEvent) + if (IsPostEvent) { - if (m_uiPostEventTimer <= uiDiff) + if (PostEventTimer <= Diff) { - switch (m_uiPostEventCount) + switch (PostEventCount) { case 0: DoScriptText(SAY_PROGRESS_2, me); @@ -651,11 +653,11 @@ public: break; } - ++m_uiPostEventCount; - m_uiPostEventTimer = 5000; + ++PostEventCount; + PostEventTimer = 5000; } else - m_uiPostEventTimer -= uiDiff; + PostEventTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp index 5b77b8dc2c0..b9ae356ddf1 100644 --- a/src/server/scripts/Kalimdor/thousand_needles.cpp +++ b/src/server/scripts/Kalimdor/thousand_needles.cpp @@ -32,14 +32,16 @@ npc_enraged_panther go_panther_cage EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*##### # npc_kanati ######*/ -enum eKanati +enum Kanati { SAY_KAN_START = -1000410, @@ -47,7 +49,7 @@ enum eKanati NPC_GALAK_ASS = 10720 }; -const float m_afGalakLoc[]= {-4867.387695f, -1357.353760f, -48.226f }; +Position const GalakLoc = {-4867.387695f, -1357.353760f, -48.226f, 0.0f}; class npc_kanati : public CreatureScript { @@ -57,10 +59,9 @@ public: bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) { if (quest->GetQuestId() == QUEST_PROTECT_KANATI) - { if (npc_kanatiAI* pEscortAI = CAST_AI(npc_kanati::npc_kanatiAI, creature->AI())) pEscortAI->Start(false, false, player->GetGUID(), quest, true); - } + return true; } @@ -73,7 +74,7 @@ public: { npc_kanatiAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} void WaypointReached(uint32 waypointId) { @@ -93,9 +94,7 @@ public: void DoSpawnGalak() { for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_GALAK_ASS, - m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f, - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_GALAK_ASS, GalakLoc, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); } void JustSummoned(Creature* summoned) @@ -110,7 +109,7 @@ public: # npc_lakota_windsong ######*/ -enum eLakota +enum Lakota { SAY_LAKO_START = -1000365, SAY_LAKO_LOOK_OUT = -1000366, @@ -127,14 +126,14 @@ enum eLakota ID_AMBUSH_3 = 4 }; -float m_afBanditLoc[6][6]= +Position const BanditLoc[6] = { - {-4905.479492f, -2062.732666f, 84.352f}, - {-4915.201172f, -2073.528320f, 84.733f}, - {-4878.883301f, -1986.947876f, 91.966f}, - {-4877.503906f, -1966.113403f, 91.859f}, - {-4767.985352f, -1873.169189f, 90.192f}, - {-4788.861328f, -1888.007813f, 89.888f} + {-4905.479492f, -2062.732666f, 84.352f, 0.0f}, + {-4915.201172f, -2073.528320f, 84.733f, 0.0f}, + {-4878.883301f, -1986.947876f, 91.966f, 0.0f}, + {-4877.503906f, -1966.113403f, 91.859f, 0.0f}, + {-4767.985352f, -1873.169189f, 90.192f, 0.0f}, + {-4788.861328f, -1888.007813f, 89.888f, 0.0f} }; class npc_lakota_windsong : public CreatureScript @@ -164,7 +163,7 @@ public: { npc_lakota_windsongAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} void WaypointReached(uint32 waypointId) { @@ -189,12 +188,10 @@ public: } } - void DoSpawnBandits(int uiAmbushId) + void DoSpawnBandits(int AmbushId) { for (int i = 0; i < 2; ++i) - me->SummonCreature(NPC_GRIM_BANDIT, - m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_GRIM_BANDIT, BanditLoc[i+AmbushId], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } }; @@ -204,7 +201,7 @@ public: # npc_paoka_swiftmountain ######*/ -enum ePacka +enum Packa { SAY_START = -1000362, SAY_WYVERN = -1000363, @@ -215,11 +212,11 @@ enum ePacka FACTION_ESCORTEE = 232 //guessed }; -float m_afWyvernLoc[3][3]= +Position const WyvernLoc[3] = { - {-4990.606f, -906.057f, -5.343f}, - {-4970.241f, -927.378f, -4.951f}, - {-4985.364f, -952.528f, -5.199f} + {-4990.606f, -906.057f, -5.343f, 0.0f}, + {-4970.241f, -927.378f, -4.951f, 0.0f}, + {-4985.364f, -952.528f, -5.199f, 0.0f} }; class npc_paoka_swiftmountain : public CreatureScript @@ -249,7 +246,7 @@ public: { npc_paoka_swiftmountainAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} void WaypointReached(uint32 waypointId) { @@ -272,9 +269,7 @@ public: void DoSpawnWyvern() { for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_WYVERN, - m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_WYVERN, WyvernLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } }; }; @@ -285,7 +280,7 @@ public: #define GOSSIP_P "Please tell me the Phrase.." -enum ePlucky +enum Plucky { FACTION_FRIENDLY = 35, QUEST_SCOOP = 1950, @@ -328,17 +323,17 @@ public: struct npc_pluckyAI : public ScriptedAI { - npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { m_uiNormFaction = creature->getFaction(); } + npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { NormFaction = creature->getFaction(); } - uint32 m_uiNormFaction; - uint32 m_uiResetTimer; + uint32 NormFaction; + uint32 ResetTimer; void Reset() { - m_uiResetTimer = 120000; + ResetTimer = 120000; - if (me->getFaction() != m_uiNormFaction) - me->setFaction(m_uiNormFaction); + if (me->getFaction() != NormFaction) + me->setFaction(NormFaction); if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -346,11 +341,11 @@ public: DoCast(me, SPELL_PLUCKY_CHICKEN, false); } - void ReceiveEmote(Player* player, uint32 uiTextEmote) + void ReceiveEmote(Player* player, uint32 TextEmote) { if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) { - if (uiTextEmote == TEXT_EMOTE_BECKON) + if (TextEmote == TEXT_EMOTE_BECKON) { me->setFaction(FACTION_FRIENDLY); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -358,7 +353,7 @@ public: } } - if (uiTextEmote == TEXT_EMOTE_CHICKEN) + if (TextEmote == TEXT_EMOTE_CHICKEN) { if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) return; @@ -372,11 +367,11 @@ public: } } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) { - if (m_uiResetTimer <= uiDiff) + if (ResetTimer <= Diff) { if (!me->getVictim()) EnterEvadeMode(); @@ -386,7 +381,7 @@ public: return; } else - m_uiResetTimer -= uiDiff; + ResetTimer -= Diff; } if (!UpdateVictim()) @@ -398,7 +393,7 @@ public: }; -enum ePantherCage +enum PantherCage { ENRAGED_PANTHER = 10992 }; diff --git a/src/server/scripts/Kalimdor/thunder_bluff.cpp b/src/server/scripts/Kalimdor/thunder_bluff.cpp index 5aa55ddea66..b8b05b9692f 100644 --- a/src/server/scripts/Kalimdor/thunder_bluff.cpp +++ b/src/server/scripts/Kalimdor/thunder_bluff.cpp @@ -23,17 +23,22 @@ SDComment: Quest support: 925 SDCategory: Thunder Bluff EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*##### # npc_cairne_bloodhoof ######*/ -#define SPELL_BERSERKER_CHARGE 16636 -#define SPELL_CLEAVE 16044 -#define SPELL_MORTAL_STRIKE 16856 -#define SPELL_THUNDERCLAP 23931 -#define SPELL_UPPERCUT 22916 +enum CairneBloodhoof +{ + SPELL_BERSERKER_CHARGE = 16636, + SPELL_CLEAVE = 16044, + SPELL_MORTAL_STRIKE = 16856, + SPELL_THUNDERCLAP = 23931, + SPELL_UPPERCUT = 22916 +}; #define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint." //TODO: verify abilities/timers @@ -75,19 +80,19 @@ public: { npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) {} - uint32 BerserkerCharge_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - uint32 Thunderclap_Timer; - uint32 Uppercut_Timer; + uint32 BerserkerChargeTimer; + uint32 CleaveTimer; + uint32 MortalStrikeTimer; + uint32 ThunderclapTimer; + uint32 UppercutTimer; void Reset() { - BerserkerCharge_Timer = 30000; - Cleave_Timer = 5000; - MortalStrike_Timer = 10000; - Thunderclap_Timer = 15000; - Uppercut_Timer = 10000; + BerserkerChargeTimer = 30000; + CleaveTimer = 5000; + MortalStrikeTimer = 10000; + ThunderclapTimer = 15000; + UppercutTimer = 10000; } void EnterCombat(Unit* /*who*/) {} @@ -97,37 +102,37 @@ public: if (!UpdateVictim()) return; - if (BerserkerCharge_Timer <= diff) + if (BerserkerChargeTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_BERSERKER_CHARGE); - BerserkerCharge_Timer = 25000; - } else BerserkerCharge_Timer -= diff; + BerserkerChargeTimer = 25000; + } else BerserkerChargeTimer -= diff; - if (Uppercut_Timer <= diff) + if (UppercutTimer <= diff) { DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 20000; - } else Uppercut_Timer -= diff; + UppercutTimer = 20000; + } else UppercutTimer -= diff; - if (Thunderclap_Timer <= diff) + if (ThunderclapTimer <= diff) { DoCast(me->getVictim(), SPELL_THUNDERCLAP); - Thunderclap_Timer = 15000; - } else Thunderclap_Timer -= diff; + ThunderclapTimer = 15000; + } else ThunderclapTimer -= diff; - if (MortalStrike_Timer <= diff) + if (MortalStrikeTimer <= diff) { DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; + MortalStrikeTimer = 15000; + } else MortalStrikeTimer -= diff; - if (Cleave_Timer <= diff) + if (CleaveTimer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + CleaveTimer = 7000; + } else CleaveTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp index 232dba404e0..786d2fc0cd3 100644 --- a/src/server/scripts/Kalimdor/ungoro_crater.cpp +++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp @@ -28,11 +28,12 @@ npc_a-me npc_ringo EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" -enum eAMeData +enum AmeData { SAY_READY = -1000517, SAY_AGGRO1 = -1000518, @@ -76,41 +77,40 @@ public: { npc_ameAI(Creature* creature) : npc_escortAI(creature) {} - uint32 DEMORALIZINGSHOUT_Timer; + uint32 DemoralizingShoutTimer; void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 19: - me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO1, me, player); - break; - case 28: - DoScriptText(SAY_SEARCH, me, player); - break; - case 38: - me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO2, me, player); - break; - case 49: - me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO3, me, player); - break; - case 55: - DoScriptText(SAY_FINISH, me, player); - player->GroupEventHappens(QUEST_CHASING_AME, me); - break; + switch (waypointId) + { + case 19: + me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO1, me, player); + break; + case 28: + DoScriptText(SAY_SEARCH, me, player); + break; + case 38: + me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO2, me, player); + break; + case 49: + me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO3, me, player); + break; + case 55: + DoScriptText(SAY_FINISH, me, player); + player->GroupEventHappens(QUEST_CHASING_AME, me); + break; + } } } void Reset() { - DEMORALIZINGSHOUT_Timer = 5000; + DemoralizingShoutTimer = 5000; } void JustSummoned(Creature* summoned) @@ -130,11 +130,11 @@ public: if (!UpdateVictim()) return; - if (DEMORALIZINGSHOUT_Timer <= diff) + if (DemoralizingShoutTimer <= diff) { DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); - DEMORALIZINGSHOUT_Timer = 70000; - } else DEMORALIZINGSHOUT_Timer -= diff; + DemoralizingShoutTimer = 70000; + } else DemoralizingShoutTimer -= diff; } }; }; @@ -143,7 +143,7 @@ public: # npc_ringo ####*/ -enum eRingo +enum Ringo { SAY_RIN_START_1 = -1000416, SAY_RIN_START_2 = -1000417, @@ -201,17 +201,17 @@ public: { npc_ringoAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiFaintTimer; - uint32 m_uiEndEventProgress; - uint32 m_uiEndEventTimer; + uint32 FaintTimer; + uint32 EndEventProgress; + uint32 EndEventTimer; uint64 SpraggleGUID; void Reset() { - m_uiFaintTimer = urand(30000, 60000); - m_uiEndEventProgress = 0; - m_uiEndEventTimer = 1000; + FaintTimer = urand(30000, 60000); + EndEventProgress = 0; + EndEventTimer = 1000; SpraggleGUID = 0; } @@ -266,13 +266,13 @@ public: SetFollowPaused(false); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { - if (m_uiEndEventTimer <= uiDiff) + if (EndEventTimer <= Diff) { Unit* pSpraggle = Unit::GetUnit(*me, SpraggleGUID); if (!pSpraggle || !pSpraggle->isAlive()) @@ -281,64 +281,61 @@ public: return; } - switch (m_uiEndEventProgress) + switch (EndEventProgress) { case 1: DoScriptText(SAY_RIN_END_1, me); - m_uiEndEventTimer = 3000; + EndEventTimer = 3000; break; case 2: DoScriptText(SAY_SPR_END_2, pSpraggle); - m_uiEndEventTimer = 5000; + EndEventTimer = 5000; break; case 3: DoScriptText(SAY_RIN_END_3, me); - m_uiEndEventTimer = 1000; + EndEventTimer = 1000; break; case 4: DoScriptText(EMOTE_RIN_END_4, me); SetFaint(); - m_uiEndEventTimer = 9000; + EndEventTimer = 9000; break; case 5: DoScriptText(EMOTE_RIN_END_5, me); ClearFaint(); - m_uiEndEventTimer = 1000; + EndEventTimer = 1000; break; case 6: DoScriptText(SAY_RIN_END_6, me); - m_uiEndEventTimer = 3000; + EndEventTimer = 3000; break; case 7: DoScriptText(SAY_SPR_END_7, pSpraggle); - m_uiEndEventTimer = 10000; + EndEventTimer = 10000; break; case 8: DoScriptText(EMOTE_RIN_END_8, me); - m_uiEndEventTimer = 5000; + EndEventTimer = 5000; break; case 9: SetFollowComplete(); break; } - ++m_uiEndEventProgress; + ++EndEventProgress; } else - m_uiEndEventTimer -= uiDiff; + EndEventTimer -= Diff; } - else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) + else if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !HasFollowState(STATE_FOLLOW_PAUSED)) { - if (!HasFollowState(STATE_FOLLOW_PAUSED)) + if (FaintTimer <= Diff) { - if (m_uiFaintTimer <= uiDiff) - { - SetFaint(); - m_uiFaintTimer = urand(60000, 120000); - } - else - m_uiFaintTimer -= uiDiff; + SetFaint(); + FaintTimer = urand(60000, 120000); } + else + FaintTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index ab5e4c4023a..a02156ee110 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -29,7 +29,9 @@ npc_rivern_frostwind npc_witch_doctor_mauari EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_lorax diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 661b3530bb8..2af73389ecb 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -1044,7 +1044,7 @@ class spell_algalon_phase_punch : public SpellScriptLoader { PrepareAuraScript(spell_algalon_phase_punch_AuraScript); - void HandlePeriodic(AuraEffect const* aurEff) + void HandlePeriodic(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); if (GetStackAmount() != 1) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 33e266e1326..09ff5935b6e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -2044,7 +2044,7 @@ public: void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetHitUnit()) + if (GetHitUnit()) GetCaster()->CastSpell(GetCaster(),SPELL_FORCE_CAST_SUMMON_GNOME_SOUL); } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index f50dbb7773d..c9c036d5329 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -213,7 +213,7 @@ class spell_sha_earthbind_totem : public SpellScriptLoader return true; } - void HandleEffectPeriodic(AuraEffect const* aurEff) + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { if (!GetCaster()) return; -- cgit v1.2.3 From 512b0945a8107ac43a2a50f1af39dee0011f49d4 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 15:37:13 +0100 Subject: Core/BG: Add map to start zone teleport possible exploit log --- src/server/game/Battlegrounds/Battleground.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 44192a74123..9d5858e1ca4 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -550,7 +550,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) if (dist >= maxDist) { - sLog->outError("BATTLEGROUND: Sending %s back to start location (possible exploit)", plr->GetName()); + sLog->outError("BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", plr->GetName(), GetMapId()); plr->TeleportTo(GetMapId(), x, y, z, o); } } -- cgit v1.2.3 From 7661858ac0a0010e8b9070352218fd534becf774 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 16:13:52 +0100 Subject: Core/SAI: Few changes to db data validation for actions and event flags --- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 7 ++++++- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index b0f1fcb8ede..a7149f37480 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -324,7 +324,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType()); return false; } - if (e.action.type >= SMART_ACTION_END) + if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END) { sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType()); return false; @@ -334,6 +334,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask); return false; } + if (e.event.event_flags > SMART_EVENT_FLAGS_ALL) + { + sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags); + return false; + } if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST) { e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script! diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 8d3686a265d..6bb309c46c2 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1176,6 +1176,7 @@ enum SmartEventFlags SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset() SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3) + SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET) }; enum SmartCastFlags -- cgit v1.2.3 From 66ce5a1148d11cd57f953be04de2b756c6754909 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 16:36:44 +0100 Subject: And I forgot to Ctrl+S, yay me. --- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 6bb309c46c2..bde7768f036 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1175,7 +1175,7 @@ enum SmartEventFlags SMART_EVENT_FLAG_DEBUG_ONLY = 0x080, //Event only occurs in debug build SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset() - SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3) + SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3), SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET) }; -- cgit v1.2.3 From e56b2cdd59c5c7673da1aaac5fe8a99d4891e260 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 17:58:35 +0100 Subject: Core: Fix a few compile warnings --- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 6 +++--- src/server/game/Maps/Map.cpp | 2 +- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/tools/map_extractor/System.cpp | 18 +++++++++--------- src/tools/map_extractor/adt.cpp | 12 ++++++------ src/tools/map_extractor/loadlib.cpp | 2 +- src/tools/map_extractor/mpq_libmpq04.h | 4 ++-- src/tools/map_extractor/wdt.cpp | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 96f454fd3e2..4176d9f605b 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -190,7 +190,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } case CONDITION_OBJECT_ENTRY: { - if (object->GetTypeId() == ConditionValue1) + if (uint32(object->GetTypeId()) == ConditionValue1) condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); break; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d38489ef5a9..f5f336a2402 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12019,7 +12019,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje Map const* map = lootedObject->GetMap(); if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) lootedObjectInDungeon = true; if (!lootedObjectInDungeon) @@ -17658,7 +17658,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) } else if (IsBagPos(item->GetPos())) - if (Bag* pBag = item->ToBag()) + if (item->IsBag()) invalidBagMap[item->GetGUIDLow()] = item; } else @@ -17811,7 +17811,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList(); for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr) { - if (events[*itr].holiday_id == proto->HolidayId) + if (uint32(events[*itr].holiday_id) == proto->HolidayId) { remove = false; break; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index a1b3d913c99..162dd12d121 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2470,7 +2470,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) - if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) + if (uint32(dungeon->map) == GetId() && dungeon->difficulty == uint32(GetDifficulty()) && randomDungeon->type == uint32(LFG_TYPE_RANDOM)) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 501c7c47676..0c879cfb029 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1513,7 +1513,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader if (group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) return; // in correct dungeon diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index cf2f2188a70..3deb9f44dd7 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -221,7 +221,7 @@ uint32 ReadMapDBC() map_ids[x].id = dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc.getRecord(x).getString(1)); } - printf("Done! (%u maps loaded)\n", map_count); + printf("Done! (%d maps loaded)\n", map_count); return map_count; } @@ -246,7 +246,7 @@ void ReadAreaTableDBC() maxAreaId = dbc.getMaxId(); - printf("Done! (%u areas loaded)\n", area_count); + printf("Done! (%d areas loaded)\n", area_count); } void ReadLiquidTypeTableDBC() @@ -259,15 +259,15 @@ void ReadLiquidTypeTableDBC() exit(1); } - size_t LiqType_count = dbc.getRecordCount(); - size_t LiqType_maxid = dbc.getMaxId(); - LiqType = new uint16[LiqType_maxid + 1]; - memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); + size_t liqTypeCount = dbc.getRecordCount(); + size_t liqTypeMaxId = dbc.getMaxId(); + LiqType = new uint16[liqTypeMaxId + 1]; + memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16)); - for(uint32 x = 0; x < LiqType_count; ++x) + for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); - printf("Done! (%u LiqTypes loaded)\n", LiqType_count); + printf("Done! (%d LiqTypes loaded)\n", liqTypeCount); } // @@ -364,7 +364,7 @@ uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE]; float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]; -bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 build) +bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, /*int cell_x*/, uint32 build) { ADT_file adt; diff --git a/src/tools/map_extractor/adt.cpp b/src/tools/map_extractor/adt.cpp index fde70681113..66134180cb0 100644 --- a/src/tools/map_extractor/adt.cpp +++ b/src/tools/map_extractor/adt.cpp @@ -53,7 +53,7 @@ bool ADT_file::prepareLoadedData() bool adt_MHDR::prepareLoadedData() { - if (fcc != 'MHDR') + if (fcc != "MHDR") return false; if (size!=sizeof(adt_MHDR)-8) @@ -72,7 +72,7 @@ bool adt_MHDR::prepareLoadedData() bool adt_MCIN::prepareLoadedData() { - if (fcc != 'MCIN') + if (fcc != "MCIN") return false; // Check cells data @@ -86,7 +86,7 @@ bool adt_MCIN::prepareLoadedData() bool adt_MH2O::prepareLoadedData() { - if (fcc != 'MH2O') + if (fcc != "MH2O") return false; // Check liquid data @@ -98,7 +98,7 @@ bool adt_MH2O::prepareLoadedData() bool adt_MCNK::prepareLoadedData() { - if (fcc != 'MCNK') + if (fcc != "MCNK") return false; // Check height map @@ -113,7 +113,7 @@ bool adt_MCNK::prepareLoadedData() bool adt_MCVT::prepareLoadedData() { - if (fcc != 'MCVT') + if (fcc != "MCVT") return false; if (size != sizeof(adt_MCVT)-8) @@ -124,7 +124,7 @@ bool adt_MCVT::prepareLoadedData() bool adt_MCLQ::prepareLoadedData() { - if (fcc != 'MCLQ') + if (fcc != "MCLQ") return false; return true; diff --git a/src/tools/map_extractor/loadlib.cpp b/src/tools/map_extractor/loadlib.cpp index 465eb04083f..77dca04d4c8 100644 --- a/src/tools/map_extractor/loadlib.cpp +++ b/src/tools/map_extractor/loadlib.cpp @@ -49,7 +49,7 @@ bool FileLoader::prepareLoadedData() { // Check version version = (file_MVER *) data; - if (version->fcc != 'MVER') + if (version->fcc != "MVER") return false; if (version->ver != FILE_FORMAT_VERSION) return false; diff --git a/src/tools/map_extractor/mpq_libmpq04.h b/src/tools/map_extractor/mpq_libmpq04.h index 1f3b259bbfc..89f715e9e87 100644 --- a/src/tools/map_extractor/mpq_libmpq04.h +++ b/src/tools/map_extractor/mpq_libmpq04.h @@ -60,8 +60,8 @@ class MPQFile libmpq__off_t pointer,size; // disable copying - MPQFile(const MPQFile &f) {} - void operator=(const MPQFile &f) {} + MPQFile(const MPQFile& /*f*/) {} + void operator=(const MPQFile& /*f*/) {} public: MPQFile(const char* filename); // filenames are not case sensitive diff --git a/src/tools/map_extractor/wdt.cpp b/src/tools/map_extractor/wdt.cpp index dedefbb64e5..d9ad0f4c7d3 100644 --- a/src/tools/map_extractor/wdt.cpp +++ b/src/tools/map_extractor/wdt.cpp @@ -4,21 +4,21 @@ bool wdt_MWMO::prepareLoadedData() { - if (fcc != 'MWMO') + if (fcc != "MWMO") return false; return true; } bool wdt_MPHD::prepareLoadedData() { - if (fcc != 'MPHD') + if (fcc != "MPHD") return false; return true; } bool wdt_MAIN::prepareLoadedData() { - if (fcc != 'MAIN') + if (fcc != "MAIN") return false; return true; } -- cgit v1.2.3 From 23be8c4fd719bb67e6a2dc9bc4114766bd62507f Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 18:22:34 +0100 Subject: Scripts/VH: Add an 1 minute pause after each boss fight (instead of 5 seconds) Revert one of the warning fixes (non standard C++) --- src/server/game/Spells/SpellInfo.cpp | 2 +- .../scripts/Northrend/VioletHold/instance_violet_hold.cpp | 3 ++- src/tools/map_extractor/adt.cpp | 12 ++++++------ src/tools/map_extractor/loadlib.cpp | 2 +- src/tools/map_extractor/wdt.cpp | 6 +++--- 5 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index e9e1b0eee8d..a931f759163 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -351,7 +351,7 @@ bool SpellEffectInfo::IsEffect() const bool SpellEffectInfo::IsEffect(SpellEffects effectName) const { - return Effect == effectName; + return Effect == uint32(effectName); } bool SpellEffectInfo::IsAura() const diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 79c54880430..37a13388b5f 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -690,7 +690,8 @@ public: { AddWave(); bActive = false; - uiActivationTimer = 5000; + // 1 minute waiting time after each boss fight + uiActivationTimer = (uiWaveCount == 6 || uiWaveCount == 12) ? 60000 : 5000; } else uiActivationTimer -= diff; } diff --git a/src/tools/map_extractor/adt.cpp b/src/tools/map_extractor/adt.cpp index 66134180cb0..fde70681113 100644 --- a/src/tools/map_extractor/adt.cpp +++ b/src/tools/map_extractor/adt.cpp @@ -53,7 +53,7 @@ bool ADT_file::prepareLoadedData() bool adt_MHDR::prepareLoadedData() { - if (fcc != "MHDR") + if (fcc != 'MHDR') return false; if (size!=sizeof(adt_MHDR)-8) @@ -72,7 +72,7 @@ bool adt_MHDR::prepareLoadedData() bool adt_MCIN::prepareLoadedData() { - if (fcc != "MCIN") + if (fcc != 'MCIN') return false; // Check cells data @@ -86,7 +86,7 @@ bool adt_MCIN::prepareLoadedData() bool adt_MH2O::prepareLoadedData() { - if (fcc != "MH2O") + if (fcc != 'MH2O') return false; // Check liquid data @@ -98,7 +98,7 @@ bool adt_MH2O::prepareLoadedData() bool adt_MCNK::prepareLoadedData() { - if (fcc != "MCNK") + if (fcc != 'MCNK') return false; // Check height map @@ -113,7 +113,7 @@ bool adt_MCNK::prepareLoadedData() bool adt_MCVT::prepareLoadedData() { - if (fcc != "MCVT") + if (fcc != 'MCVT') return false; if (size != sizeof(adt_MCVT)-8) @@ -124,7 +124,7 @@ bool adt_MCVT::prepareLoadedData() bool adt_MCLQ::prepareLoadedData() { - if (fcc != "MCLQ") + if (fcc != 'MCLQ') return false; return true; diff --git a/src/tools/map_extractor/loadlib.cpp b/src/tools/map_extractor/loadlib.cpp index 77dca04d4c8..465eb04083f 100644 --- a/src/tools/map_extractor/loadlib.cpp +++ b/src/tools/map_extractor/loadlib.cpp @@ -49,7 +49,7 @@ bool FileLoader::prepareLoadedData() { // Check version version = (file_MVER *) data; - if (version->fcc != "MVER") + if (version->fcc != 'MVER') return false; if (version->ver != FILE_FORMAT_VERSION) return false; diff --git a/src/tools/map_extractor/wdt.cpp b/src/tools/map_extractor/wdt.cpp index d9ad0f4c7d3..dedefbb64e5 100644 --- a/src/tools/map_extractor/wdt.cpp +++ b/src/tools/map_extractor/wdt.cpp @@ -4,21 +4,21 @@ bool wdt_MWMO::prepareLoadedData() { - if (fcc != "MWMO") + if (fcc != 'MWMO') return false; return true; } bool wdt_MPHD::prepareLoadedData() { - if (fcc != "MPHD") + if (fcc != 'MPHD') return false; return true; } bool wdt_MAIN::prepareLoadedData() { - if (fcc != "MAIN") + if (fcc != 'MAIN') return false; return true; } -- cgit v1.2.3 From 36ea485f9a62bedf7b1114f0536322f241fed2e1 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 18:37:10 +0100 Subject: Tools: Fix a typo and printf formats (there's no standard format for size_t) --- src/tools/map_extractor/System.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 3deb9f44dd7..1505f2c2cee 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -221,7 +221,7 @@ uint32 ReadMapDBC() map_ids[x].id = dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc.getRecord(x).getString(1)); } - printf("Done! (%d maps loaded)\n", map_count); + printf("Done! (%u maps loaded)\n", map_count); return map_count; } @@ -246,7 +246,7 @@ void ReadAreaTableDBC() maxAreaId = dbc.getMaxId(); - printf("Done! (%d areas loaded)\n", area_count); + printf("Done! (%u areas loaded)\n", area_count); } void ReadLiquidTypeTableDBC() @@ -267,7 +267,7 @@ void ReadLiquidTypeTableDBC() for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); - printf("Done! (%d LiqTypes loaded)\n", liqTypeCount); + printf("Done! (%u LiqTypes loaded)\n", liqTypeCount); } // @@ -364,7 +364,7 @@ uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE]; float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]; -bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, /*int cell_x*/, uint32 build) +bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/, uint32 build) { ADT_file adt; -- cgit v1.2.3 From 868e38ebcbac5b94b6d2810730114b64b3cbea27 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 20:33:49 +0100 Subject: Core/BG: Move the log "ArenaTeam x does not have any members or ..." from DB error to debug level --- src/server/game/Battlegrounds/ArenaTeam.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 73e24e5a3c3..89151b6395c 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -267,7 +267,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (Empty() || !captainPresentInTeam) { // Arena team is empty or captain is not in team, delete from db - sLog->outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); return false; } -- cgit v1.2.3 From 388250961f24cbe2ba955da6d7446965d058f97d Mon Sep 17 00:00:00 2001 From: Mik43l Date: Sun, 20 May 2012 22:09:12 +0200 Subject: [Core/Spell]: Fix Blessing of Ancient Kings (Val'anyr, Hammer of Ancient Kings) closes #6521 --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a4d02ee5ea1..ba481176d23 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5870,7 +5870,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID())) { // The shield can grow to a maximum size of 20, 000 damage absorbtion - aurEff->SetAmount(std::max(aurEff->GetAmount() + basepoints0, 20000)); + aurEff->SetAmount(std::min(aurEff->GetAmount() + basepoints0, 20000)); // Refresh and return to prevent replacing the aura aurEff->GetBase()->RefreshDuration(); -- cgit v1.2.3 From 6b8d4ce123a40d66968a8fcb56e14364355fdb5d Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 21 May 2012 00:03:43 +0200 Subject: Core/Spell: Fix spell effect SPELL_EFFECT_HEAL_MAX_HEALTH calculation --- src/server/game/Spells/SpellEffects.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 07bea5f980c..17e79501d16 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3565,7 +3565,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) if (!unitTarget || !unitTarget->isAlive()) return; - int32 addhealth; + int32 addhealth = 0; if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands { if (m_caster->GetGUID() == unitTarget->GetGUID()) @@ -3582,11 +3582,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) else addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth(); - if (m_originalCaster) - { - uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - m_healing += unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); - } + m_healing += addhealth; } void Spell::EffectInterruptCast(SpellEffIndex effIndex) -- cgit v1.2.3 From 5a154ac27249b6584cba15063698584b165f2038 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 21 May 2012 00:22:58 +0200 Subject: Core/Spell: DK T10 Melee 4P is SPELL_AURA_PROC_TRIGGER_SPELL proc --- src/server/game/Entities/Unit/Unit.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ba481176d23..9689a0c6402 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7786,17 +7786,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } } } - // Item - Death Knight T10 Melee 4P Bonus - if (dummySpell->Id == 70656) - { - Player* player = ToPlayer(); - if (!player) - return false; - - for (uint32 i = 0; i < MAX_RUNES; ++i) - if (player->GetRuneCooldown(i) == 0) - return false; - } break; } case SPELLFAMILY_POTION: @@ -8724,6 +8713,16 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 50475; basepoints0 = CalculatePctN(int32(damage), triggerAmount); } + // Item - Death Knight T10 Melee 4P Bonus + else if (auraSpellInfo->Id == 70656) + { + if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT) + return false; + + for (uint8 i = 0; i < MAX_RUNES; ++i) + if (ToPlayer()->GetRuneCooldown(i) == 0) + return false; + } break; } case SPELLFAMILY_ROGUE: -- cgit v1.2.3 From 99040237c7d9f5e1ffcca0416b6b7fef8ea8cd1a Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 22 May 2012 12:32:53 -0400 Subject: Core/Items: correctly cast spells on item store. Closes #4208 --- src/server/game/Entities/Player/Player.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f5f336a2402..3a5bfa6c8c1 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12180,11 +12180,6 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update pItem->SetItemRandomProperties(randomPropertyId); pItem = StoreItem(dest, pItem, update); - const ItemTemplate* proto = pItem->GetTemplate(); - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger - CastSpell(this, proto->Spells[i].SpellId, true, pItem); - if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound()) { pItem->SetSoulboundTradeable(allowedLooters); @@ -12290,6 +12285,14 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool AddEnchantmentDurations(pItem); AddItemDurations(pItem); + + const ItemTemplate* proto = pItem->GetTemplate(); + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger + if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) + if (HasAura(proto->Spells[i].SpellId)) + CastSpell(this, proto->Spells[i].SpellId, true, pItem); + return pItem; } else @@ -12326,6 +12329,13 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool pItem2->SetState(ITEM_CHANGED, this); + const ItemTemplate* proto = pItem2->GetTemplate(); + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger + if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) + if (HasAura(proto->Spells[i].SpellId)) + CastSpell(this, proto->Spells[i].SpellId, true, pItem2); + return pItem2; } } -- cgit v1.2.3 From df9791f1aa09b33e061133047b679951ba656357 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 22 May 2012 14:05:53 -0400 Subject: Core/Items: fix typo from previous commit (thx vincentmichael) --- src/server/game/Entities/Player/Player.cpp | 6 +++--- src/server/game/Entities/Unit/Unit.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3a5bfa6c8c1..2448f4a3199 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12290,7 +12290,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) - if (HasAura(proto->Spells[i].SpellId)) + if (!HasAura(proto->Spells[i].SpellId)) CastSpell(this, proto->Spells[i].SpellId, true, pItem); return pItem; @@ -12333,7 +12333,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) - if (HasAura(proto->Spells[i].SpellId)) + if (!HasAura(proto->Spells[i].SpellId)) CastSpell(this, proto->Spells[i].SpellId, true, pItem2); return pItem2; @@ -16385,7 +16385,7 @@ void Player::ReputationChanged2(FactionEntry const* factionEntry) } } -bool Player::HasQuestForItem(uint32 itemid) const + bool Player::HasQuestForItem(uint32 itemid) const { for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e45f1214f4f..bc4a824d1d7 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8039,7 +8039,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp *handled = true; if (victim && victim->HasAura(53601)) { - int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2]. CalcValue()); + int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2].CalcValue()); // Item - Paladin T9 Holy 4P Bonus if (AuraEffect const* aurEff = GetAuraEffect(67191, 0)) AddPctN(bp0, aurEff->GetAmount()); -- cgit v1.2.3 From 66d42b4f296fa455bfc96ed6a09e64ed5cc62a9d Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 14:24:28 +0200 Subject: Core/Protocol: Process CMSG_UPDATE_MISSILE_TRAJECTORY packets --- src/server/game/Handlers/MiscHandler.cpp | 45 +++++++++++++++++++++++++++++ src/server/game/Server/Protocol/Opcodes.cpp | 2 +- src/server/game/Server/WorldSession.h | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 35872f8c63f..9abd39f90ec 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -51,6 +51,7 @@ #include "GameObjectAI.h" #include "Group.h" #include "AccountMgr.h" +#include "Spell.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { @@ -1714,3 +1715,47 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) _player->SetPendingBind(0, 0); } + +void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); + + uint64 guid; + uint32 spellId; + float elevation, speed; + float curX, curY, curZ; + float targetX, targetY, targetZ; + uint8 moveStop; + + recvPacket >> guid >> spellId >> elevation >> speed; + recvPacket >> curX >> curY >> curZ; + recvPacket >> targetX >> targetY >> targetZ; + recvPacket >> moveStop; + + Unit* caster = ObjectAccessor::GetUnit(*_player, guid); + Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL; + if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst()) + { + recvPacket.rfinish(); + return; + } + + Position pos = *spell->m_targets.GetSrcPos(); + pos.Relocate(curX, curY, curZ); + spell->m_targets.ModSrc(pos); + + pos = *spell->m_targets.GetDstPos(); + pos.Relocate(targetX, targetY, targetZ); + spell->m_targets.ModDst(pos); + + spell->m_targets.SetElevation(elevation); + spell->m_targets.SetSpeed(speed); + + if (moveStop) + { + uint32 opcode; + recvPacket >> opcode; + recvPacket.SetOpcode(opcode); + HandleMovementOpcodes(recvPacket); + } +} diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 517935acbd2..bd9c75c251d 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1148,7 +1148,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x45F*/ { "CMSG_CALENDAR_EVENT_INVITE_NOTES", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x460*/ { "SMSG_CALENDAR_EVENT_INVITE_NOTES", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x461*/ { "SMSG_CALENDAR_EVENT_INVITE_NOTES_ALERT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x462*/ { "CMSG_UPDATE_MISSILE_TRAJECTORY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x462*/ { "CMSG_UPDATE_MISSILE_TRAJECTORY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleUpdateMissileTrajectory }, /*0x463*/ { "SMSG_UPDATE_ACCOUNT_DATA_COMPLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x464*/ { "SMSG_TRIGGER_MOVIE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x465*/ { "CMSG_COMPLETE_MOVIE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index bb54a0ae19e..6d8a9e3ff38 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -785,6 +785,7 @@ class WorldSession void HandleResetInstancesOpcode(WorldPacket& recv_data); void HandleHearthAndResurrect(WorldPacket& recv_data); void HandleInstanceLockResponse(WorldPacket& recvPacket); + void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); // Looking for Dungeon/Raid void HandleLfgSetCommentOpcode(WorldPacket& recv_data); -- cgit v1.2.3 From f424052f82c8fc0172e78170bd70722ec76c1368 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 14:28:38 +0200 Subject: Core/Spells: Make spellclick spells non triggered --- src/server/game/Entities/Unit/Unit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bc4a824d1d7..71977bf469c 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10191,7 +10191,7 @@ Unit* Unit::GetFirstControlled() const // Sequence: charmed, pet, other guardians Unit* unit = GetCharm(); if (!unit) - if (uint64 guid = GetUInt64Value(UNIT_FIELD_SUMMON)) + if (uint64 guid = GetMinionGUID()) unit = ObjectAccessor::GetUnit(*this, guid); return unit; @@ -17018,7 +17018,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) } if (IsInMap(caster)) - caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, true, NULL, NULL, origCasterGUID); + caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, false, NULL, NULL, origCasterGUID); else // This can happen during Player::_LoadAuras { int32 bp0 = seatId; @@ -17028,7 +17028,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) else { if (IsInMap(caster)) - caster->CastSpell(target, spellEntry, true, NULL, NULL, origCasterGUID); + caster->CastSpell(target, spellEntry, false, NULL, NULL, origCasterGUID); else Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID); } -- cgit v1.2.3 From 037f37ac653f1c2aa26068f6a03b4e01e7a544c3 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 14:56:08 +0200 Subject: Core/Protocol: correct SMSG_CALENDAR_RAID_LOCKOUT_UPDATED struct (and SMSG_CALENDAR_SEND_CALENDAR if no invite was found) --- src/server/game/Handlers/CalendarHandler.cpp | 56 ++++++++++++++++------------ 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index d1277d154cc..298c742fc3a 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -20,7 +20,7 @@ ----- Opcodes Not Used yet ----- SMSG_CALENDAR_CLEAR_PENDING_ACTION SendCalendarClearPendingAction() -SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save) <--- Structure unknown, using LOCKOUT_ADDED +SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save) ----- Opcodes without Sniffs ----- SMSG_CALENDAR_FILTER_GUILD [ for (... uint32(count) { packguid(???), uint8(???) } ] @@ -74,7 +74,11 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) else { sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it); - data << uint64(0) << uint64(0) << uint8(0) << uint8(0); + data << uint64(0); + data << uint64(0); + data << uint8(0); + data << uint8(0); + data << uint8(0); data.appendPackGUID(0); } } @@ -96,8 +100,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) else { sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it); - data << uint64(0) << uint8(0) << uint32(0) - << uint32(0) << uint32(0) << uint32(0); + data << uint64(0); + data << uint8(0); + data << uint32(0); + data << uint32(0); + data << uint32(0); + data << uint32(0); data.appendPackGUID(0); } } @@ -835,26 +843,6 @@ void WorldSession::SendCalendarClearPendingAction() SendPacket(&data); } -void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save) -{ - if (!save) - return; - - uint64 guid = _player->GetGUID(); - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD - "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty()); - - time_t cur_time = time_t(time(NULL)); - - WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8); - data << secsToTimeBitFields(cur_time); - data << uint32(save->GetMapId()); - data << uint32(save->GetDifficulty()); - data << uint32(save->GetResetTime() - cur_time); - data << uint64(save->GetInstanceId()); - SendPacket(&data); -} - void WorldSession::SendCalendarCommandResult(CalendarError err, char const* param /*= NULL*/) { uint64 guid = _player->GetGUID(); @@ -898,3 +886,23 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add) data << uint64(save->GetInstanceId()); SendPacket(&data); } + +void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save) +{ + if (!save) + return; + + uint64 guid = _player->GetGUID(); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD + "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty()); + + time_t cur_time = time_t(time(NULL)); + + WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8); + data << secsToTimeBitFields(cur_time); + data << uint32(save->GetMapId()); + data << uint32(save->GetDifficulty()); + data << uint32(0); // Amount of seconds that has changed to the reset time + data << uint32(save->GetResetTime() - cur_time); + SendPacket(&data); +} -- cgit v1.2.3 From 419d537bc833fb83aac947c3fa3ba0823e5b8c81 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 15:02:54 +0200 Subject: Core/Global: Cleanup in MovementHandler and some assertions --- .../game/Battlegrounds/Zones/BattlegroundAB.cpp | 2 +- .../game/Battlegrounds/Zones/BattlegroundSA.cpp | 11 ++- src/server/game/Globals/ObjectMgr.cpp | 78 ++++++++-------------- src/server/game/Handlers/MovementHandler.cpp | 68 +++++++++---------- 4 files changed, 70 insertions(+), 89 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 52d2cdefd65..d28f5ddfe6a 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -290,7 +290,7 @@ int32 BattlegroundAB::_GetNodeNameId(uint8 node) case BG_AB_NODE_LUMBER_MILL:return LANG_BG_AB_NODE_LUMBER_MILL; case BG_AB_NODE_GOLD_MINE: return LANG_BG_AB_NODE_GOLD_MINE; default: - ASSERT(0); + ASSERT(false); } return 0; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 977897b8d48..133a0aec560 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -720,8 +720,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) DelCreature(BG_SA_MAXNPC + i); GraveyardStatus[i] = Source->GetTeamId(); - WorldSafeLocsEntry const* sg = NULL; - sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + if (!sg) + { + sLog->outError("BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]); + return; + } + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE)); uint32 npc = 0; uint32 flag = 0; @@ -781,7 +786,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) SendWarningToAll(LANG_BG_SA_H_GY_SOUTH); break; default: - ASSERT(0); + ASSERT(false); break; }; } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 9dea557f650..1e36b4c732b 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6247,74 +6247,54 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) switch (guidhigh) { case HIGHGUID_ITEM: - if (_hiItemGuid >= 0xFFFFFFFE) - { - sLog->outError("Item guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!"); return _hiItemGuid++; + } case HIGHGUID_UNIT: - if (_hiCreatureGuid >= 0x00FFFFFE) - { - sLog->outError("Creature guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!"); return _hiCreatureGuid++; + } case HIGHGUID_PET: - if (_hiPetGuid >= 0x00FFFFFE) - { - sLog->outError("Pet guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!"); return _hiPetGuid++; + } case HIGHGUID_VEHICLE: - if (_hiVehicleGuid >= 0x00FFFFFF) - { - sLog->outError("Vehicle guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!"); return _hiVehicleGuid++; + } case HIGHGUID_PLAYER: - if (_hiCharGuid >= 0xFFFFFFFE) - { - sLog->outError("Players guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCharGuid < 0xFFFFFFFE && "Player guid overflow!"); return _hiCharGuid++; + } case HIGHGUID_GAMEOBJECT: - if (_hiGoGuid >= 0x00FFFFFE) - { - sLog->outError("Gameobject guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!"); return _hiGoGuid++; + } case HIGHGUID_CORPSE: - if (_hiCorpseGuid >= 0xFFFFFFFE) - { - sLog->outError("Corpse guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!"); return _hiCorpseGuid++; + } case HIGHGUID_DYNAMICOBJECT: - if (_hiDoGuid >= 0xFFFFFFFE) - { - sLog->outError("DynamicObject guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!"); return _hiDoGuid++; + } case HIGHGUID_MO_TRANSPORT: - if (_hiMoTransGuid >= 0xFFFFFFFE) - { - sLog->outError("MO Transport guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!"); return _hiMoTransGuid++; + } default: - ASSERT(0); + ASSERT(false && "ObjectMgr::GenerateLowGuid - Unknown HIGHGUID type"); + return 0; } - - ASSERT(0); - return 0; } void ObjectMgr::LoadGameObjectLocales() diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index b3d663e1850..c271a43462a 100755 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -64,10 +64,9 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->m_InstanceValid = true; Map* oldMap = GetPlayer()->GetMap(); - ASSERT(oldMap); if (GetPlayer()->IsInWorld()) { - sLog->outCrash("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId()); + sLog->outError("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } @@ -200,8 +199,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) sLog->outStaticDebug("Guid " UI64FMTD, guid); sLog->outStaticDebug("Flags %u, time %u", flags, time/IN_MILLISECONDS); - Unit* mover = _player->m_mover; - Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; + Player* plMover = _player->m_mover->ToPlayer(); if (!plMover || !plMover->IsBeingTeleportedNear()) return; @@ -240,33 +238,33 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) GetPlayer()->ProcessDelayedOperations(); } -void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) +void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) { - uint16 opcode = recv_data.GetOpcode(); + uint16 opcode = recvData.GetOpcode(); Unit* mover = _player->m_mover; - ASSERT(mover != NULL); // there must always be a mover + ASSERT(mover != NULL); // there must always be a mover - Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; + Player* plrMover = mover->ToPlayer(); // ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck - if (plMover && plMover->IsBeingTeleported()) + if (plrMover && plrMover->IsBeingTeleported()) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } /* extract packet */ uint64 guid; - recv_data.readPackGUID(guid); + recvData.readPackGUID(guid); MovementInfo movementInfo; movementInfo.guid = guid; - ReadMovementInfo(recv_data, &movementInfo); + ReadMovementInfo(recvData, &movementInfo); - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam // prevent tampered movement data if (guid != mover->GetGUID()) @@ -274,7 +272,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) if (!movementInfo.pos.IsPositionValid()) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } @@ -285,27 +283,27 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) // (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped) if (movementInfo.t_pos.GetPositionX() > 50 || movementInfo.t_pos.GetPositionY() > 50 || movementInfo.t_pos.GetPositionZ() > 50) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(), movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation())) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } // if we boarded a transport, add us to it - if (plMover && !plMover->GetTransport()) + if (plrMover && !plrMover->GetTransport()) { // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter) { if ((*iter)->GetGUID() == movementInfo.t_guid) { - plMover->m_transport = (*iter); - (*iter)->AddPassenger(plMover); + plrMover->m_transport = (*iter); + (*iter)->AddPassenger(plrMover); break; } } @@ -318,29 +316,29 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; } } - else if (plMover && plMover->GetTransport()) // if we were on a transport, leave + else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave { - plMover->m_transport->RemovePassenger(plMover); - plMover->m_transport = NULL; + plrMover->m_transport->RemovePassenger(plrMover); + plrMover->m_transport = NULL; movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); movementInfo.t_time = 0; movementInfo.t_seat = -1; } // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map). - if (opcode == MSG_MOVE_FALL_LAND && plMover && !plMover->isInFlight()) - plMover->HandleFall(movementInfo); + if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->isInFlight()) + plrMover->HandleFall(movementInfo); - if (plMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plMover->IsInWater()) + if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater()) { // now client not include swimming flag in case jumping under water - plMover->SetInWater(!plMover->IsInWater() || plMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ())); + plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ())); } /*----------------------*/ /* process position-change */ - WorldPacket data(opcode, recv_data.size()); + WorldPacket data(opcode, recvData.size()); movementInfo.time = getMSTime(); movementInfo.guid = mover->GetGUID(); WriteMovementInfo(&data, &movementInfo); @@ -357,27 +355,25 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) mover->UpdatePosition(movementInfo.pos); - if (plMover) // nothing is charmed, or player charmed + if (plrMover) // nothing is charmed, or player charmed { - plMover->UpdateFallInformationIfNeed(movementInfo, opcode); + plrMover->UpdateFallInformationIfNeed(movementInfo, opcode); if (movementInfo.pos.GetPositionZ() < -500.0f) { - if (!(plMover->InBattleground() - && plMover->GetBattleground() - && plMover->GetBattleground()->HandlePlayerUnderMap(_player))) + if (!(plrMover->GetBattleground() && plrMover->GetBattleground()->HandlePlayerUnderMap(_player))) { // NOTE: this is actually called many times while falling // even after the player has been teleported away // TODO: discard movement packets after the player is rooted - if (plMover->isAlive()) + if (plrMover->isAlive()) { - plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); + plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); // player can be alive if GM/etc // change the death state to CORPSE to prevent the death timer from // starting in the next player update - if (!plMover->isAlive()) - plMover->KillPlayer(); + if (!plrMover->isAlive()) + plrMover->KillPlayer(); } } } -- cgit v1.2.3 From dbe8034ec277c660d1eeacbd9ac39b6783ad37dd Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 16:37:22 +0200 Subject: Core/Calendar: Fix crash when deleting an event on the calendar. Should also stop the error message from appearing. Thanks elecyb Closes #6570 - Corrected some code from 66d42b4f296fa455bfc96ed6a09e64ed5cc62a9d --- src/server/game/Calendar/CalendarMgr.cpp | 24 +++++++++++------------- src/server/game/Handlers/MiscHandler.cpp | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index cef68891890..62bc0ab3205 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -95,9 +95,9 @@ CalendarEventIdList const& CalendarMgr::GetPlayerEvents(uint64 guid) CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) { - CalendarInviteMap::iterator it = _invites.find(inviteId); - if (it != _invites.end()) - return &(it->second); + CalendarInviteMap::iterator itr = _invites.find(inviteId); + if (itr != _invites.end()) + return &(itr->second); sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId); return NULL; @@ -105,9 +105,9 @@ CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) CalendarEvent* CalendarMgr::GetEvent(uint64 eventId) { - CalendarEventMap::iterator it = _events.find(eventId); - if (it != _events.end()) - return &(it->second); + CalendarEventMap::iterator itr = _events.find(eventId); + if (itr != _events.end()) + return &(itr->second); sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId); return NULL; @@ -316,11 +316,6 @@ void CalendarMgr::AddAction(CalendarAction const& action) if (!calendarEvent) return; - CalendarInviteIdList const& inviteIds = calendarEvent->GetInviteIdList(); - for (CalendarInviteIdList::const_iterator it = inviteIds.begin(); it != inviteIds.end(); ++it) - if (uint64 invitee = RemoveInvite(*it)) - SendCalendarEventRemovedAlert(invitee, *calendarEvent); - RemoveEvent(eventId); break; } @@ -464,8 +459,6 @@ bool CalendarMgr::RemoveEvent(uint64 eventId) return false; } - _events.erase(itr); - bool val = true; CalendarInviteIdList const& invites = itr->second.GetInviteIdList(); @@ -474,8 +467,13 @@ bool CalendarMgr::RemoveEvent(uint64 eventId) CalendarInvite* invite = GetInvite(*itrInvites); if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId)) val = false; + + if (uint64 invitee = RemoveInvite(*itrInvites)) + SendCalendarEventRemovedAlert(invitee, itr->second); } + _events.erase(itr); + return val; } diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 9abd39f90ec..a280bc30b7c 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -1733,8 +1733,8 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) recvPacket >> moveStop; Unit* caster = ObjectAccessor::GetUnit(*_player, guid); - Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL; - if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst()) + Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : NULL; + if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc()) { recvPacket.rfinish(); return; -- cgit v1.2.3 From 2ae0cfc8b6c0c5c41550f81a8fdb768714456b00 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 16:40:44 +0200 Subject: Core/GuardAI: General cleanup and removed some unnecessary code. --- src/server/game/AI/CoreAI/GuardAI.cpp | 87 +++-------------------------------- src/server/game/AI/CoreAI/GuardAI.h | 23 ++------- 2 files changed, 11 insertions(+), 99 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 252bcbabca5..6e2326ca9d5 100755 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -23,7 +23,7 @@ #include "World.h" #include "CreatureAIImpl.h" -int GuardAI::Permissible(const Creature* creature) +int GuardAI::Permissible(Creature const* creature) { if (creature->isGuard()) return PERMIT_BASE_SPECIAL; @@ -31,7 +31,7 @@ int GuardAI::Permissible(const Creature* creature) return PERMIT_BASE_NO; } -GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature), i_victimGuid(0), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK) +GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature) { } @@ -40,108 +40,35 @@ bool GuardAI::CanSeeAlways(WorldObject const* obj) if (!obj->isType(TYPEMASK_UNIT)) return false; - std::list t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - if (unit == obj) - return true; - } + std::list threatList = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + if ((*itr)->getUnitGuid() == obj->GetGUID()) + return true; return false; } -void GuardAI::MoveInLineOfSight(Unit* unit) -{ - // Ignore Z for flying creatures - if (!me->CanFly() && me->GetDistanceZ(unit) > CREATURE_Z_ATTACK_RANGE) - return; - - if (!me->getVictim() && me->IsValidAttackTarget(unit) && - (unit->IsHostileToPlayers() || me->IsHostileTo(unit)) && - unit->isInAccessiblePlaceFor(me)) - { - float attackRadius = me->GetAttackDistance(unit); - if (me->IsWithinDistInMap(unit, attackRadius)) - { - //Need add code to let guard support player - AttackStart(unit); - //u->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); - } - } -} - void GuardAI::EnterEvadeMode() { if (!me->isAlive()) { - sLog->outStaticDebug("Creature stopped attacking because he is dead [guid=%u]", me->GetGUIDLow()); me->GetMotionMaster()->MoveIdle(); - - i_state = STATE_NORMAL; - - i_victimGuid = 0; me->CombatStop(true); me->DeleteThreatList(); return; } - Unit* victim = ObjectAccessor::GetUnit(*me, i_victimGuid); - - if (!victim) - { - sLog->outStaticDebug("Creature stopped attacking because victim does not exist [guid=%u]", me->GetGUIDLow()); - } - else if (!victim->isAlive()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is dead [guid=%u]", me->GetGUIDLow()); - } - else if (victim->HasStealthAura()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is using stealth [guid=%u]", me->GetGUIDLow()); - } - else if (victim->isInFlight()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is flying away [guid=%u]", me->GetGUIDLow()); - } - else - { - sLog->outStaticDebug("Creature stopped attacking because victim outran him [guid=%u]", me->GetGUIDLow()); - } + sLog->outDebug(LOG_FILTER_UNITS, "Guard entry: %u enters evade mode.", me->GetEntry()); me->RemoveAllAuras(); me->DeleteThreatList(); - i_victimGuid = 0; me->CombatStop(true); - i_state = STATE_NORMAL; // Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) me->GetMotionMaster()->MoveTargetedHome(); } -void GuardAI::UpdateAI(const uint32 /*diff*/) -{ - // update i_victimGuid if me->getVictim() !=0 and changed - if (!UpdateVictim()) - return; - - Unit* const victim = me->getVictim(); - if (!victim) - return; - - i_victimGuid = victim->GetGUID(); - - if (me->isAttackReady()) - { - if (me->IsWithinMeleeRange(victim)) - { - me->AttackerStateUpdate(victim); - me->resetAttackTimer(); - } - } -} - void GuardAI::JustDied(Unit* killer) { if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h index c80c5a6c343..c8dd9d54921 100755 --- a/src/server/game/AI/CoreAI/GuardAI.h +++ b/src/server/game/AI/CoreAI/GuardAI.h @@ -20,34 +20,19 @@ #define TRINITY_GUARDAI_H #include "ScriptedCreature.h" -#include "Timer.h" class Creature; class GuardAI : public ScriptedAI { - enum GuardState - { - STATE_NORMAL = 1, - STATE_LOOK_AT_VICTIM = 2 - }; - public: + explicit GuardAI(Creature* creature); - explicit GuardAI(Creature* c); - - void MoveInLineOfSight(Unit*); - void EnterEvadeMode(); - void JustDied(Unit*); + static int Permissible(Creature const* creature); bool CanSeeAlways(WorldObject const* obj); - void UpdateAI(const uint32); - static int Permissible(const Creature*); - - private: - uint64 i_victimGuid; - GuardState i_state; - TimeTracker i_tracker; + void EnterEvadeMode(); + void JustDied(Unit* killer); }; #endif -- cgit v1.2.3 From b1179d8f49d0dcab4b99365309e3eaadd5dbe218 Mon Sep 17 00:00:00 2001 From: Nay Date: Wed, 23 May 2012 21:25:50 +0100 Subject: Core/Bags: Do not allow multiple unique bags in bank bag slots Existing multiple bags will be removed and items mailed Kudos to micha Closes #2786 --- src/server/game/Entities/Player/Player.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2448f4a3199..371662921f5 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -10157,7 +10157,8 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const if (inBankAlso) { - for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + // checking every item from 39 to 74 (including bank bags) + for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetEntry() == item) count += pItem->GetCount(); -- cgit v1.2.3 From 3ea75c50d019f1b29145bc974ae51039544beb16 Mon Sep 17 00:00:00 2001 From: MrSmite Date: Mon, 7 May 2012 17:41:58 -0400 Subject: Fixes broken autocast spells such as Furious Howl and Leap to cast when on autocast and "attack" is clicked. Fixes wrong check for spell cooldown and removes check for duration (some spells with duration such as poison are stackable) --- src/server/game/AI/CoreAI/PetAI.cpp | 58 +++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index bcec8d273b9..14306c8861f 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -153,40 +153,60 @@ void PetAI::UpdateAI(const uint32 diff) if (spellInfo->IsPositive()) { - // non combat spells allowed - // only pet spells have IsNonCombatSpell and not fit this reqs: - // Consume Shadows, Lesser Invisibility, so ignore checks for its if (spellInfo->CanBeUsedInCombat()) { - // allow only spell without spell cost or with spell cost but not duration limit - int32 duration = spellInfo->GetDuration(); - if ((spellInfo->ManaCost || spellInfo->ManaCostPercentage || spellInfo->ManaPerSecond) && duration > 0) + // check spell cooldown + if (me->HasSpellCooldown(spellInfo->Id)) continue; - // allow only spell without cooldown > duration - int32 cooldown = spellInfo->GetRecoveryTime(); - if (cooldown >= 0 && duration >= 0 && cooldown > duration) + // Check if we're in combat or commanded to attack + if (!me->isInCombat() && !me->GetCharmInfo()->IsCommandAttack()) continue; } Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0); - bool spellUsed = false; - for (std::set::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) - { - Unit* target = ObjectAccessor::GetUnit(*me, *tar); - //only buff targets that are in combat, unless the spell can only be cast while out of combat - if (!target) - continue; - - if (spell->CanAutoCast(target)) + // Some spells can target enemy or friendly (DK Ghoul's Leap) + // Check for enemy first (pet then owner) + if (Unit* target = me->getAttackerForHelper()) + { + if (CanAttack(target) && spell->CanAutoCast(target)) + { + targetSpellStore.push_back(std::make_pair(target, spell)); + spellUsed = true; + } + } + else if (Unit* target = me->GetCharmerOrOwner()->getAttackerForHelper()) + { + if (CanAttack(target) && spell->CanAutoCast(target)) { targetSpellStore.push_back(std::make_pair(target, spell)); spellUsed = true; - break; } } + + // No enemy, check friendly + if (!spellUsed) + { + for (std::set::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) + { + Unit* target = ObjectAccessor::GetUnit(*me, *tar); + + //only buff targets that are in combat, unless the spell can only be cast while out of combat + if (!target) + continue; + + if (spell->CanAutoCast(target)) + { + targetSpellStore.push_back(std::make_pair(target, spell)); + spellUsed = true; + break; + } + } + } + + // No valid targets at all if (!spellUsed) delete spell; } -- cgit v1.2.3 From 4bdc5573822fd8c2d4ed0422abb2bd29e772e6de Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 09:51:57 -0400 Subject: Core/Bags: cleanup random tab. check for item in bag slots for getitembyguid and getitemcountwithlimitcategory --- src/server/game/Entities/Player/Player.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 371662921f5..41c95ac3d04 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -10198,7 +10198,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte if (Bag* pBag = GetBagByPos(i)) count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem); - for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem) if (ItemTemplate const* pProto = pItem->GetTemplate()) @@ -10224,7 +10224,7 @@ Item* Player::GetItemByGuid(uint64 guid) const if (pItem->GetGUID() == guid) return pItem; - for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetGUID() == guid) return pItem; @@ -16386,7 +16386,7 @@ void Player::ReputationChanged2(FactionEntry const* factionEntry) } } - bool Player::HasQuestForItem(uint32 itemid) const +bool Player::HasQuestForItem(uint32 itemid) const { for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { -- cgit v1.2.3 From 84b420160dacd5b9a9c6cf77ecc9e5cfc1b4afae Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 24 May 2012 16:29:43 +0200 Subject: Core/Pets: Some minor corrections to 3ea75c50d019f1b29145bc974ae51039544beb16 --- src/server/game/AI/CoreAI/PetAI.cpp | 22 +++++++++------------- src/server/game/DataStores/DBCEnums.h | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 14306c8861f..160b406a6ea 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -169,15 +169,11 @@ void PetAI::UpdateAI(const uint32 diff) // Some spells can target enemy or friendly (DK Ghoul's Leap) // Check for enemy first (pet then owner) - if (Unit* target = me->getAttackerForHelper()) - { - if (CanAttack(target) && spell->CanAutoCast(target)) - { - targetSpellStore.push_back(std::make_pair(target, spell)); - spellUsed = true; - } - } - else if (Unit* target = me->GetCharmerOrOwner()->getAttackerForHelper()) + Unit* target = me->getAttackerForHelper(); + if (!target && owner) + target = owner->getAttackerForHelper(); + + if (target) { if (CanAttack(target) && spell->CanAutoCast(target)) { @@ -191,15 +187,15 @@ void PetAI::UpdateAI(const uint32 diff) { for (std::set::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) { - Unit* target = ObjectAccessor::GetUnit(*me, *tar); + Unit* ally = ObjectAccessor::GetUnit(*me, *tar); //only buff targets that are in combat, unless the spell can only be cast while out of combat - if (!target) + if (!ally) continue; - if (spell->CanAutoCast(target)) + if (spell->CanAutoCast(ally)) { - targetSpellStore.push_back(std::make_pair(target, spell)); + targetSpellStore.push_back(std::make_pair(ally, spell)); spellUsed = true; break; } diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index 80949effa0c..23578a55816 100755 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -245,7 +245,7 @@ enum AreaFlags AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?) AREA_FLAG_OUTLAND = 0x00000400, // expansion zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled) - AREA_FLAG_NEED_FLY = 0x00001000, // Unknown + AREA_FLAG_NEED_FLY = 0x00001000, // Respawn alive at the graveyard without corpse AREA_FLAG_UNUSED1 = 0x00002000, // Unused in 3.3.5a AREA_FLAG_OUTLAND2 = 0x00004000, // expansion zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) AREA_FLAG_OUTDOOR_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area) @@ -260,7 +260,7 @@ enum AreaFlags AREA_FLAG_WINTERGRASP = 0x01000000, // Wintergrasp and it's subzones AREA_FLAG_INSIDE = 0x02000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors AREA_FLAG_OUTSIDE = 0x04000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors - AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Same as AREA_FLAG_WINTERGRASP except for The Sunken Ring and Western Bridge. + AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Can Hearth And Resurrect From Area AREA_FLAG_NO_FLY_ZONE = 0x20000000 // Marks zones where you cannot fly }; -- cgit v1.2.3 From d54d536f6fb996c2fb729c3f2ee5bf7c44945096 Mon Sep 17 00:00:00 2001 From: Nay Date: Thu, 24 May 2012 17:06:06 +0100 Subject: Core/Arena: Fix Hotter Streak achiev, thanks to Horn Ref #6590 Closes #6335 --- src/server/game/Battlegrounds/Battleground.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 9d5858e1ca4..c589edcee7a 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -850,9 +850,12 @@ void Battleground::EndBattleground(uint32 winner) if (team == winner) { // update achievement BEFORE personal rating update - ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID()); - if (member) - player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, 1); + if (ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID())) + { + uint32 rating = player->GetArenaPersonalRating(winner_arena_team->GetSlot()); + player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, + rating ? rating : 1); + } winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change); } -- cgit v1.2.3 From 2849f21d20d53461813c0a2f66a5401f71adcbc9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 15:33:08 -0400 Subject: Core/Spells: correctly calculate Replenishment aura. x * 20 / 10000 != x * .2 --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index d28ba9e1e19..38ad27b0ad2 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -662,10 +662,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster) case SPELL_AURA_PERIODIC_ENERGIZE: if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) { - // Replenishment (0.25% from max) + // Replenishment (0.2% from max) // Infinite Replenishment if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 25 / 10000; + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.2f; } // Innervate else if (m_spellInfo->Id == 29166) -- cgit v1.2.3 From aa341353954b77e55bbca420f1eb757433e2db9e Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 15:55:55 -0400 Subject: Core/Spells: fix issue with previous commit. i cant do math. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 38ad27b0ad2..b49cad74244 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -665,7 +665,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) // Replenishment (0.2% from max) // Infinite Replenishment if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.2f; + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; } // Innervate else if (m_spellInfo->Id == 29166) -- cgit v1.2.3 From b7573a1bc70eede743bfb7cdeb2f29b45758347a Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 16:58:09 -0400 Subject: Core/Auras: change from if to switch and fix calculation for inifinite replenishment. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index b49cad74244..0d0931e481b 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -660,19 +660,25 @@ int32 AuraEffect::CalculateAmount(Unit* caster) } break; case SPELL_AURA_PERIODIC_ENERGIZE: - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) + switch (m_spellInfo->Id) { - // Replenishment (0.2% from max) - // Infinite Replenishment + case 57669: // Replenishment (0.2% from max) if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; - } - // Innervate - else if (m_spellInfo->Id == 29166) + break; + case 61782: // Infinite Replenishment + if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; + break; + case 29166: // Innervate ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks()); - // Owlkin Frenzy - else if (m_spellInfo->Id == 48391) + break; + case 48391: // Owlkin Frenzy ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)); + break; + default: + break; + } break; case SPELL_AURA_PERIODIC_HEAL: if (!caster) -- cgit v1.2.3 From 51388c49345158fa39bcd3259544a6279477038d Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 17:10:12 -0400 Subject: Core/Auras: one more for good measure. thanks vincent-michael --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 0d0931e481b..5a29e6b325d 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -663,12 +663,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster) switch (m_spellInfo->Id) { case 57669: // Replenishment (0.2% from max) - if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; break; case 61782: // Infinite Replenishment - if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; break; case 29166: // Innervate ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks()); -- cgit v1.2.3 From d98f36194bc271c3bd3adc6532e84bd3645127c8 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 17:34:51 -0400 Subject: Core/Spells: attempt to correct issue with triggered spells happening before the spell actually hits the target. reply with any bugs that this causes please! --- src/server/game/Spells/SpellEffects.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 07bea5f980c..9470d6edef9 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -849,15 +849,15 @@ void Spell::EffectDummy(SpellEffIndex effIndex) void Spell::EffectTriggerSpell(SpellEffIndex effIndex) { - if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET - && effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) + if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET + && effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; // todo: move those to spell scripts if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL - && effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) + && effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) { // special cases switch (triggered_spell_id) @@ -970,13 +970,13 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } SpellCastTargets targets; - if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) + if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) { if (!spellInfo->NeedsToBeTriggeredByCaster()) return; targets.SetUnitTarget(unitTarget); } - else //if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH) + else //if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT) { if (spellInfo->NeedsToBeTriggeredByCaster() && (m_spellInfo->Effects[effIndex].GetProvidedTargetMask() & TARGET_FLAG_UNIT_MASK)) return; -- cgit v1.2.3 From 929e7c0f0c8f008519b5d168af4fda165c62547e Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 25 May 2012 08:56:02 -0400 Subject: Core/Spells: revert previous commit to find a better solution. --- src/server/game/Spells/SpellEffects.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 9470d6edef9..07bea5f980c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -849,15 +849,15 @@ void Spell::EffectDummy(SpellEffIndex effIndex) void Spell::EffectTriggerSpell(SpellEffIndex effIndex) { - if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET - && effectHandleMode != SPELL_EFFECT_HANDLE_HIT) + if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET + && effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) return; uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; // todo: move those to spell scripts if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL - && effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) + && effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) { // special cases switch (triggered_spell_id) @@ -970,13 +970,13 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } SpellCastTargets targets; - if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) + if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) { if (!spellInfo->NeedsToBeTriggeredByCaster()) return; targets.SetUnitTarget(unitTarget); } - else //if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT) + else //if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH) { if (spellInfo->NeedsToBeTriggeredByCaster() && (m_spellInfo->Effects[effIndex].GetProvidedTargetMask() & TARGET_FLAG_UNIT_MASK)) return; -- cgit v1.2.3 From c40d86f05f5857b73015f09eb68b7dfdd7224a1f Mon Sep 17 00:00:00 2001 From: kaelima Date: Fri, 25 May 2012 16:44:34 +0200 Subject: Core/Protocol: Fix struct and make use of CMSG_UPDATE_PROJECTILE_POSITION. --- src/server/game/Handlers/SpellHandler.cpp | 11 ++++++++++- src/server/game/Server/Protocol/Opcodes.h | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index b2d52c85467..1affdf0aff7 100755 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -650,13 +650,22 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) uint8 castCount; float x, y, z; // Position of missile hit - recvPacket.readPackGUID(casterGuid); + recvPacket >> casterGuid; recvPacket >> spellId; recvPacket >> castCount; recvPacket >> x; recvPacket >> y; recvPacket >> z; + Unit* caster = ObjectAccessor::GetUnit(*_player, casterGuid); + Spell* spell = caster ? caster->FindCurrentSpellBySpellId(spellId) : NULL; + if (spell && spell->m_targets.HasDst()) + { + Position pos = *spell->m_targets.GetDstPos(); + pos.Relocate(x, y, z); + spell->m_targets.ModDst(pos); + } + WorldPacket data(SMSG_SET_PROJECTILE_POSITION, 21); data << uint64(casterGuid); data << uint8(castCount); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 3c77ced6741..d76a0ab8dd4 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -1248,8 +1248,8 @@ enum Opcodes SMSG_CALENDAR_CLEAR_PENDING_ACTION = 0x4BB, SMSG_EQUIPMENT_SET_LIST = 0x4BC, // equipment manager list? CMSG_EQUIPMENT_SET_SAVE = 0x4BD, - CMSG_UPDATE_PROJECTILE_POSITION = 0x4BE, // uint64 caster, uint32 spellId, uint8 castId, vector3 position - SMSG_SET_PROJECTILE_POSITION = 0x4BF, // uint64 caster, uint8 castId, vector3 position + CMSG_UPDATE_PROJECTILE_POSITION = 0x4BE, + SMSG_SET_PROJECTILE_POSITION = 0x4BF, SMSG_TALENTS_INFO = 0x4C0, CMSG_LEARN_PREVIEW_TALENTS = 0x4C1, CMSG_LEARN_PREVIEW_TALENTS_PET = 0x4C2, -- cgit v1.2.3 From 39a609ce5c3c926384273c7c1676d3f72a672d09 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Fri, 25 May 2012 23:53:33 -0230 Subject: Core/DB: Some updates for UBRS from sniff --- sql/updates/world/2012_05_25_03_world_template.sql | 8 ++ .../BlackrockSpire/blackrock_spire.h | 9 +- .../BlackrockSpire/boss_pyroguard_emberseer.cpp | 40 ++++++++- .../BlackrockSpire/instance_blackrock_spire.cpp | 100 ++++++++++++++++----- 4 files changed, 129 insertions(+), 28 deletions(-) create mode 100644 sql/updates/world/2012_05_25_03_world_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_25_03_world_template.sql b/sql/updates/world/2012_05_25_03_world_template.sql new file mode 100644 index 00000000000..6ef112f342f --- /dev/null +++ b/sql/updates/world/2012_05_25_03_world_template.sql @@ -0,0 +1,8 @@ +-- Fix unit flags for Blackhand Incarcerator +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|768 WHERE `entry`=10316; +-- Fix unit flags for Pyroguard Emberseer +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|33554688 WHERE `entry`=9816; +-- Remove hack event script +DELETE FROM `event_scripts` WHERE `id`=4884; +-- Remove script to Dragonspire Hall Runes "UBRS" +UPDATE `gameobject_template` SET `ScriptName`= '' WHERE `entry` BETWEEN 175194 AND 175200; diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h index beef71ea857..0af2af948d3 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h @@ -33,7 +33,8 @@ enum Data DATA_WARCHIEF_REND_BLACKHAND, DATA_GYTH, DATA_THE_BEAST, - DATA_GENERAL_DRAKKISATH + DATA_GENERAL_DRAKKISATH, + DATA_DRAGONSPIRE_ROOM, }; enum Npc { @@ -51,6 +52,9 @@ enum Npc NPC_GYTH = 10339, NPC_THE_BEAST = 10430, NPC_GENERAL_DRAKKISATH = 10363, + NPC_BLACKHAND_DREADWEAVER = 9817, + NPC_BLACKHAND_SUMMONER = 9818, + NPC_BLACKHAND_VETERAN = 9819, }; enum AdditionalData @@ -58,6 +62,9 @@ enum AdditionalData SPELL_SUMMON_ROOKERY_WHELP = 15745, MAX_ENCOUNTER = 14, MAX_DRAGONSPIRE_HALL_RUNES = 7, + EVENT_PYROGUARD_EMBERSEER = 4884, + AREATRIGGER_ENTER_UBRS = 2046, + AREATRIGGER_STADIUM = 2026, }; enum GameObjects diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 411b800cd03..f84fcefd40b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -20,11 +20,24 @@ #include "ScriptedCreature.h" #include "blackrock_spire.h" +enum Text +{ + EMOTE_ONE_STACK = 0, + EMOTE_TEN_STACK = 1, + EMOTE_FREE_OF_BONDS = 2, + YELL_FREE_OF_BONDS = 3, +}; + enum Spells { - SPELL_FIRENOVA = 23462, - SPELL_FLAMEBUFFET = 23341, - SPELL_PYROBLAST = 17274, + SPELL_ENCAGED_EMBERSEER = 15282, // Self on spawn + SPELL_FIRE_SHIELD_TRIGGER = 13377, // Self on spawn missing from 335 dbc + SPELL_FREEZE_ANIM = 16245, // Self on event start + SPELL_EMBERSEER_GROWING = 16048, // Self on event start + SPELL_EMBERSEER_FULL_STRENGTH = 16047, // Emberseer Full Strength + SPELL_FIRENOVA = 23462, // Combat + SPELL_FLAMEBUFFET = 23341, // Combat + SPELL_PYROBLAST = 17274, // Combat }; enum Events @@ -51,12 +64,19 @@ public: void Reset() { + if(instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) + OpenDoors(FALSE); + instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED); + // respawn any dead Blackhand Incarcerators + DoCast(me, SPELL_ENCAGED_EMBERSEER); + //DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); _Reset(); } void EnterCombat(Unit* /*who*/) { _EnterCombat(); + // activate all runes in room events.ScheduleEvent(EVENT_FIRENOVA, 6 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_FLAMEBUFFET, 3 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_PYROBLAST, 14 * IN_MILLISECONDS); @@ -64,12 +84,26 @@ public: void JustDied(Unit* /*killer*/) { + instance->SetBossState(DATA_PYROGAURD_EMBERSEER,DONE); + OpenDoors(TRUE); _JustDied(); } + void OpenDoors(bool Boss_Killed) + { + if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN))) + door1->SetGoState(GO_STATE_ACTIVE); + if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS))) + door2->SetGoState(GO_STATE_ACTIVE); + if (Boss_Killed) + if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_OUT))) + door3->SetGoState(GO_STATE_ACTIVE); + } + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) + return; events.Update(diff); diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp index b5b1b34a593..fdb73fe1196 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp @@ -49,6 +49,12 @@ public: uint64 Gyth; uint64 TheBeast; uint64 GeneralDrakkisath; + uint64 go_emberseerin; + uint64 go_doors; + uint64 go_emberseerout; + uint64 go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES]; + uint8 Runemaxprotectors[MAX_DRAGONSPIRE_HALL_RUNES]; + uint8 Runeprotectorsdead[MAX_DRAGONSPIRE_HALL_RUNES]; void Initialize() { @@ -67,6 +73,9 @@ public: Gyth = 0; TheBeast = 0; GeneralDrakkisath = 0; + go_emberseerin = 0; + go_doors = 0; + go_emberseerout = 0; } bool IsEncounterInProgress() const @@ -125,7 +134,11 @@ public: case NPC_GENERAL_DRAKKISATH: GeneralDrakkisath = creature->GetGUID(); break; - } + case NPC_BLACKHAND_DREADWEAVER: + case NPC_BLACKHAND_SUMMONER: + case NPC_BLACKHAND_VETERAN: + break; + } } void OnGameObjectCreate(GameObject* go) @@ -135,6 +148,36 @@ public: case GO_WHELP_SPAWNER: go->CastSpell(NULL, SPELL_SUMMON_ROOKERY_WHELP); break; + case GO_EMBERSEER_IN: + go_emberseerin = go->GetGUID(); + break; + case GO_DOORS: + go_doors = go->GetGUID(); + break; + case GO_EMBERSEER_OUT: + go_emberseerout = go->GetGUID(); + break; + case GO_ROOM_1_RUNE: + go_roomrunes[0] = go->GetGUID(); + break; + case GO_ROOM_2_RUNE: + go_roomrunes[1] = go->GetGUID(); + break; + case GO_ROOM_3_RUNE: + go_roomrunes[2] = go->GetGUID(); + break; + case GO_ROOM_4_RUNE: + go_roomrunes[3] = go->GetGUID(); + break; + case GO_ROOM_5_RUNE: + go_roomrunes[4] = go->GetGUID(); + break; + case GO_ROOM_6_RUNE: + go_roomrunes[5] = go->GetGUID(); + break; + case GO_ROOM_7_RUNE: + go_roomrunes[6] = go->GetGUID(); + break; } } @@ -167,6 +210,18 @@ public: return true; } + void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId) + { + switch (eventId) + { + case EVENT_PYROGUARD_EMBERSEER: + SetBossState(DATA_PYROGAURD_EMBERSEER,IN_PROGRESS); + break; + default: + break; + } + } + uint64 GetData64(uint32 type) { switch (type) @@ -199,6 +254,26 @@ public: return TheBeast; case DATA_GENERAL_DRAKKISATH: return GeneralDrakkisath; + case GO_EMBERSEER_IN: + return go_emberseerin; + case GO_DOORS: + return go_doors; + case GO_EMBERSEER_OUT: + return go_emberseerout; + case GO_ROOM_1_RUNE: + return go_roomrunes[0]; + case GO_ROOM_2_RUNE: + return go_roomrunes[1]; + case GO_ROOM_3_RUNE: + return go_roomrunes[2]; + case GO_ROOM_4_RUNE: + return go_roomrunes[3]; + case GO_ROOM_5_RUNE: + return go_roomrunes[4]; + case GO_ROOM_6_RUNE: + return go_roomrunes[5]; + case GO_ROOM_7_RUNE: + return go_roomrunes[6]; } return 0; @@ -247,30 +322,7 @@ public: }; -uint8 ActivatedRunes = 0; - -class go_dragonspire_hall_rune : public GameObjectScript -{ -public: - go_dragonspire_hall_rune() : GameObjectScript("go_dragonspire_hall_rune") { } - - void OnGameObjectStateChanged(GameObject* go, uint32 state) - { - if (state == GO_STATE_READY) - { - if (++ActivatedRunes == MAX_DRAGONSPIRE_HALL_RUNES) - { - if (GameObject* door1 = GetClosestGameObjectWithEntry(go, GO_EMBERSEER_IN, 150.0f)) - door1->SetGoState(GO_STATE_ACTIVE); - if (GameObject* door2 = GetClosestGameObjectWithEntry(go, GO_DOORS, 150.0f)) - door2->SetGoState(GO_STATE_ACTIVE); - } - } - } -}; - void AddSC_instance_blackrock_spire() { new instance_blackrock_spire(); - new go_dragonspire_hall_rune; } -- cgit v1.2.3 From 83f74263a200f8c63a24939c12db9f580252b358 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 26 May 2012 00:27:10 -0230 Subject: core: fix ubrs script --- .../scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index f84fcefd40b..97069fbef74 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -65,7 +65,7 @@ public: void Reset() { if(instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) - OpenDoors(FALSE); + OpenDoors(false); instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED); // respawn any dead Blackhand Incarcerators DoCast(me, SPELL_ENCAGED_EMBERSEER); -- cgit v1.2.3 From 74da8dc41004adcea6167a4587bded4efa025387 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 26 May 2012 00:38:53 -0230 Subject: Core: another update cause case matters! --- .../EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 97069fbef74..0279f3e2834 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -76,7 +76,6 @@ public: void EnterCombat(Unit* /*who*/) { _EnterCombat(); - // activate all runes in room events.ScheduleEvent(EVENT_FIRENOVA, 6 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_FLAMEBUFFET, 3 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_PYROBLAST, 14 * IN_MILLISECONDS); @@ -85,7 +84,7 @@ public: void JustDied(Unit* /*killer*/) { instance->SetBossState(DATA_PYROGAURD_EMBERSEER,DONE); - OpenDoors(TRUE); + OpenDoors(true); _JustDied(); } -- cgit v1.2.3 From 624aab7d77c9f0a395611012d17e5c5114992f79 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sat, 26 May 2012 18:14:50 +0200 Subject: Core/Session: Fixed error "received unexpected opcode CMSG_CANCEL_TRADE" when a player is logging out. --- src/server/game/Handlers/TradeHandler.cpp | 2 +- src/server/game/Server/Protocol/Opcodes.h | 2 +- src/server/game/Server/WorldSession.cpp | 29 +++++++++++++---------------- src/server/game/Server/WorldSession.h | 1 + 4 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index dc26aaa42ca..9d7fa7da396 100755 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -531,7 +531,7 @@ void WorldSession::HandleBeginTradeOpcode(WorldPacket& /*recvPacket*/) void WorldSession::SendCancelTrade() { - if (m_playerRecentlyLogout) + if (PlayerRecentlyLoggedOut() || PlayerLogout()) return; SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index d76a0ab8dd4..65e7b3597ce 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -1354,7 +1354,7 @@ enum SessionStatus STATUS_AUTHED = 0, // Player authenticated (_player == NULL, m_playerRecentlyLogout = false or will be reset before handler call, m_GUID have garbage) STATUS_LOGGEDIN, // Player in game (_player != NULL, m_GUID == _player->GetGUID(), inWorld()) STATUS_TRANSFER, // Player transferring to another map (_player != NULL, m_GUID == _player->GetGUID(), !inWorld()) - STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, // _player!= NULL or _player == NULL && m_playerRecentlyLogout, m_GUID store last _player guid) + STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, // _player != NULL or _player == NULL && m_playerRecentlyLogout && m_playerLogout, m_GUID store last _player guid) STATUS_NEVER, // Opcode not accepted from client (deprecated or server side only) STATUS_UNHANDLED, // Opcode not handled yet }; diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 88248b7bc55..98bb0123896 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -290,7 +290,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) // lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer break; case STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT: - if (!_player && !m_playerRecentlyLogout) + if (!_player && !m_playerRecentlyLogout && !m_playerLogout) // There's a short delay between _player = null and m_playerRecentlyLogout = true during logout LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT", "the player has not logged in yet and not recently logout"); else @@ -404,7 +404,7 @@ void WorldSession::LogoutPlayer(bool Save) if (_player) { - if (uint64 lguid = GetPlayer()->GetLootGUID()) + if (uint64 lguid = _player->GetLootGUID()) DoLootRelease(lguid); ///- If the player just died before logging out, make him appear as a ghost @@ -518,21 +518,21 @@ void WorldSession::LogoutPlayer(bool Save) if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket) _player->RemoveFromGroup(); - ///- Send update to group and reset stored max enchanting level + //! Send update to group and reset stored max enchanting level if (_player->GetGroup()) { _player->GetGroup()->SendUpdate(); _player->GetGroup()->ResetMaxEnchantingLevel(); } - ///- Broadcast a logout message to the player's friends + //! Broadcast a logout message to the player's friends sSocialMgr->SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true); sSocialMgr->RemovePlayerSocial(_player->GetGUIDLow()); - // Call script hook before deletion - sScriptMgr->OnPlayerLogout(GetPlayer()); + //! Call script hook before deletion + sScriptMgr->OnPlayerLogout(_player); - ///- Remove the player from the world + //! Remove the player from the world // the player may not be in the world when logging out // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes @@ -540,22 +540,19 @@ void WorldSession::LogoutPlayer(bool Save) sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); - SetPlayer(NULL); // deleted in Remove call - ///- Send the 'logout complete' packet to the client + SetPlayer(NULL); //! Pointer already deleted during RemovePlayerFromMap + + //! Send the 'logout complete' packet to the client + //! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle WorldPacket data(SMSG_LOGOUT_COMPLETE, 0); SendPacket(&data); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); - ///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline - //No SQL injection as AccountId is uint32 - + //! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE); - stmt->setUInt32(0, GetAccountId()); - CharacterDatabase.Execute(stmt); - - sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); } m_playerLogout = false; diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 6d8a9e3ff38..00d5a8b5a86 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -221,6 +221,7 @@ class WorldSession bool PlayerLoading() const { return m_playerLoading; } bool PlayerLogout() const { return m_playerLogout; } bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; } + bool PlayerRecentlyLoggedOut() const { return m_playerRecentlyLogout; } void SizeError(WorldPacket const& packet, uint32 size) const; -- cgit v1.2.3 From f1e6601032ba4077e1d1c6070c4cb20812289f7a Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 27 May 2012 19:57:31 +0200 Subject: Core/Protocol: - Allow CMSG_LOGOUT_CANCEL to be recieved during serverside logout process (ignore it however, it's too late to abort) - Fix STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes because of m_playerRecentlyLogout being set false too early in some cases --- src/server/game/Handlers/MiscHandler.cpp | 4 ++++ src/server/game/Server/Protocol/Opcodes.cpp | 4 ++-- src/server/game/Server/WorldSession.cpp | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index a280bc30b7c..8484ac52d27 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -430,6 +430,10 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_CANCEL Message"); + // Player have already logged out serverside, too late to cancel + if (!GetPlayer()) + return; + LogoutRequest(0); WorldPacket data(SMSG_LOGOUT_CANCEL_ACK, 0); diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index bd9c75c251d..8fb8ea0298b 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -104,7 +104,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x04B*/ { "CMSG_LOGOUT_REQUEST", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutRequestOpcode }, /*0x04C*/ { "SMSG_LOGOUT_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x04D*/ { "SMSG_LOGOUT_COMPLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x04E*/ { "CMSG_LOGOUT_CANCEL", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutCancelOpcode }, + /*0x04E*/ { "CMSG_LOGOUT_CANCEL", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutCancelOpcode }, /*0x04F*/ { "SMSG_LOGOUT_CANCEL_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x050*/ { "CMSG_NAME_QUERY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleNameQueryOpcode }, /*0x051*/ { "SMSG_NAME_QUERY_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, @@ -310,7 +310,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x119*/ { "CMSG_IGNORE_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleIgnoreTradeOpcode }, /*0x11A*/ { "CMSG_ACCEPT_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAcceptTradeOpcode }, /*0x11B*/ { "CMSG_UNACCEPT_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleUnacceptTradeOpcode }, - /*0x11C*/ { "CMSG_CANCEL_TRADE", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelTradeOpcode}, + /*0x11C*/ { "CMSG_CANCEL_TRADE", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelTradeOpcode }, /*0x11D*/ { "CMSG_SET_TRADE_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetTradeItemOpcode }, /*0x11E*/ { "CMSG_CLEAR_TRADE_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleClearTradeItemOpcode }, /*0x11F*/ { "CMSG_SET_TRADE_GOLD", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetTradeGoldOpcode }, diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 98bb0123896..7756e686388 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -323,9 +323,9 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) break; } - // single from authed time opcodes send in to after logout time - // and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes. - if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL) + // some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes + // however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process. + if (packet->GetOpcode() == CMSG_CHAR_ENUM) m_playerRecentlyLogout = false; sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet)); -- cgit v1.2.3 From b549cd2543c57908ee870be3a4085fdf579021b4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 27 May 2012 22:26:49 +0200 Subject: Scripts/Icecrown Citadel: Remove encounter specific auras when Blood-Queen Lana'thel fight ends (prevents exploits with Essence of the Blood Queen Closes #6610 --- .../IcecrownCitadel/boss_blood_queen_lana_thel.cpp | 27 ++++++++++++++-------- .../IcecrownCitadel/boss_deathbringer_saurfang.cpp | 8 ++----- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index f086e8dc9cf..ee966256e2b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -149,7 +149,7 @@ class boss_blood_queen_lana_thel : public CreatureScript events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 30500, EVENT_GROUP_NORMAL); events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, urand(20000, 25000), EVENT_GROUP_NORMAL); events.ScheduleEvent(EVENT_AIR_PHASE, 124000 + uint32(Is25ManRaid() ? 3000 : 0)); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); + CleanAuras(); me->SetSpeed(MOVE_FLIGHT, 0.642857f, true); _offtank = NULL; _vampires.clear(); @@ -170,6 +170,7 @@ class boss_blood_queen_lana_thel : public CreatureScript DoZoneInCombat(); Talk(SAY_AGGRO); instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, IN_PROGRESS); + CleanAuras(); DoCast(me, SPELL_SHROUD_OF_SORROW, true); DoCast(me, SPELL_FRENZIED_BLOODTHIRST_VISUAL, true); @@ -180,15 +181,7 @@ class boss_blood_queen_lana_thel : public CreatureScript { _JustDied(); Talk(SAY_DEATH); - instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN); - instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR); - instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); - instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + CleanAuras(); // Blah, credit the quest if (_creditBloodQuickening) { @@ -207,6 +200,19 @@ class boss_blood_queen_lana_thel : public CreatureScript } } + void CleanAuras() + { + instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN); + instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR); + instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); + instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + } + void DoAction(int32 const action) { if (action != ACTION_KILL_MINCHAR) @@ -227,6 +233,7 @@ class boss_blood_queen_lana_thel : public CreatureScript void EnterEvadeMode() { _EnterEvadeMode(); + CleanAuras(); if (_killMinchar) { _killMinchar = false; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index afc7c503bee..494be259baa 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -631,9 +631,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_HORDE_4, 24000); // cast _events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 30000); // move me->SetDisableGravity(false); - me->SendMovementFlagUpdate(); - me->Relocate(me->GetPositionX(), me->GetPositionY(), 539.2917f); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 0.0f); + me->GetMotionMaster()->MoveFall(); for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) (*itr)->AI()->DoAction(ACTION_DESPAWN); break; @@ -838,9 +836,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY); Talk(SAY_OUTRO_ALLIANCE_1); me->SetDisableGravity(false); - me->SendMovementFlagUpdate(); - me->Relocate(me->GetPositionX(), me->GetPositionY(), 539.2917f); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 0.0f); + me->GetMotionMaster()->MoveFall(); for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) (*itr)->AI()->DoAction(ACTION_DESPAWN); -- cgit v1.2.3