From cc85d9e1c45e4346ba2a28639da708093db27b81 Mon Sep 17 00:00:00 2001 From: krz Date: Sun, 17 May 2009 12:03:54 +0200 Subject: [PATCH 1/5] Properly check if triggering spell can stack with player's aura. That should fix e.g. water shield. --HG-- branch : trunk --- src/game/Unit.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7d8ae44e7ce..ceade1af235 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -6894,19 +6894,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL; - // check if triggering spell can stack with current target's auras (if not - don't proc) - AuraMap::iterator i,next; - for (i = m_Auras.begin(); i != m_Auras.end(); i = next) - { - next = i; - ++next; - if (!(*i).second) continue; - if ( (*i).second->GetSpellProto()->Id == trigger_spell_id) continue; - if (spellmgr.IsNoStackSpellDueToSpell(trigger_spell_id, (*i).second->GetSpellProto()->Id, (pVictim == this))) - return false; - } - - // Try handle uncnown trigger spells + // Try handle unknown trigger spells if (sSpellStore.LookupEntry(trigger_spell_id)==NULL) switch (auraSpellInfo->SpellFamilyName) { @@ -7404,6 +7392,24 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; } + // check if triggering spell can stack with current target's auras (if not - don't proc) + // don't check if + // aura is passive (talent's aura) + // trigger_spell_id's aura is already active (allow to refresh triggered auras) + // trigger_spell_id's triggeredByAura is already active (for example shaman's shields) + AuraMap::iterator i,next; + uint32 aura_id = 0; + for (i = m_Auras.begin(); i != m_Auras.end(); i = next) + { + next = i; + ++next; + if (!(*i).second) continue; + aura_id = (*i).second->GetSpellProto()->Id; + if ( IsPassiveSpell(aura_id) || aura_id == trigger_spell_id || aura_id == triggeredByAura->GetSpellProto()->Id ) continue; + if (spellmgr.IsNoStackSpellDueToSpell(trigger_spell_id, (*i).second->GetSpellProto()->Id, ((*i).second->GetCasterGUID() == GetGUID()))) + return false; + } + // not allow proc extra attack spell at extra attack if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) return false; From b0c727abf7d1debf0fc878c85ad255e5326927bd Mon Sep 17 00:00:00 2001 From: raczman Date: Sun, 17 May 2009 21:10:51 +0200 Subject: [PATCH 2/5] Check wether NPC is friendly to player before interacting, to prevent exploiting with cheating tool. --HG-- branch : trunk --- src/game/ObjectAccessor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 2182af0b751..5be6258b1fd 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -97,6 +97,9 @@ ObjectAccessor::GetNPCIfCanInteractWith(Player const &player, uint64 guid, uint3 if(!player.CanInteractWithNPCs(!unit->isSpiritService())) return NULL; + if(!player.IsFriendlyTo(unit)) + return NULL; + // appropriate npc type if(npcflagmask && !unit->HasFlag( UNIT_NPC_FLAGS, npcflagmask )) return NULL; From 769fb318f7fe9d52c2826ca275848bb4377fc836 Mon Sep 17 00:00:00 2001 From: Naicisum Date: Mon, 18 May 2009 12:05:44 +0200 Subject: [PATCH 3/5] Fix scaling size of pet. --HG-- branch : trunk --- src/game/Pet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 75664032ce3..029142ea92f 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1028,7 +1028,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel) else if (getLevel() <= cFamily->minScaleLevel) scale = cFamily->minScale; else - scale = cFamily->minScale + (getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale); + scale = cFamily->minScale + (float)(getLevel() - cFamily->minScaleLevel) / (float)cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale); SetFloatValue(OBJECT_FIELD_SCALE_X, scale); } From 34aca735f490cfedddc3d615815ea5a2400ed111 Mon Sep 17 00:00:00 2001 From: Anubisss Date: Mon, 18 May 2009 15:22:50 +0200 Subject: [PATCH 4/5] *Add SWP to world_scripts_full.sql from TrinityCore2. *Rename kalocegos_teleporter to kalecgos_teleporter by Thraxx. Thank you. *Rename boss_kalecgosKj to boss_kalecgos_kj. --HG-- branch : trunk --- sql/world_scripts_full.sql | 36 ++++++++++++++----- .../zone/sunwell_plateau/boss_kalecgos.cpp | 6 ++-- .../zone/sunwell_plateau/boss_kiljaeden.cpp | 18 +++++----- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/sql/world_scripts_full.sql b/sql/world_scripts_full.sql index 9facb578021..fb416caea22 100644 --- a/sql/world_scripts_full.sql +++ b/sql/world_scripts_full.sql @@ -819,14 +819,34 @@ UPDATE `creature_template` SET `ScriptName`='mob_freed_soul' WHERE `entry`=11136 /* SUNKEN TEMPLE */ /* SUNWELL PLATEAU */ -update `instance_template` set `script` = 'instance_sunwell_plateau' where map = 580; -UPDATE `creature_template` SET `ScriptName` = 'boss_brutallus' WHERE entry = 24882; -UPDATE `creature_template` SET `ScriptName` = 'boss_felmyst' WHERE `entry` = 25038; -UPDATE `creature_template` SET `ScriptName` = 'mob_felmyst_vapor' WHERE `entry` = 25265; -UPDATE `creature_template` SET `ScriptName` = 'mob_felmyst_trail' WHERE `entry` = 25267; -update `creature_template` set `ScriptName` = 'boss_sacrolash' where entry = 25165; -update `creature_template` set `ScriptName` = 'boss_alythess' where entry = 25166; -update `creature_template` set `ScriptName` = 'mob_shadow_image' where entry = 25214; +UPDATE `instance_template` SET `script`='instance_sunwell_plateau' WHERE `map`=580; +UPDATE `creature_template` SET `ScriptName`='boss_brutallus' WHERE `entry`=24882; +UPDATE `creature_template` SET `ScriptName`='boss_felmyst' WHERE `entry`=25038; +UPDATE `creature_template` SET `ScriptName`='mob_felmyst_vapor' WHERE `entry`=25265; +UPDATE `creature_template` SET `ScriptName`='mob_felmyst_trail' WHERE `entry`=25267; +UPDATE `creature_template` SET `ScriptName`='boss_sacrolash' WHERE `entry`=25165; +UPDATE `creature_template` SET `ScriptName`='boss_alythess' WHERE `entry`=25166; +UPDATE `creature_template` SET `ScriptName`='mob_shadow_image' WHERE `entry`=25214; +UPDATE `creature_template` SET `ScriptName`='boss_kiljaeden' WHERE `entry`=25315; +UPDATE `creature_template` SET `ScriptName`='boss_kalecgos_kj' WHERE `entry`=25319; +UPDATE `creature_template` SET `ScriptName`='mob_kiljaeden_controller' WHERE `entry`=25608; +UPDATE `creature_template` SET `ScriptName`='mob_hand_of_the_deceiver' WHERE `entry`=25588; +UPDATE `creature_template` SET `ScriptName`='mob_felfire_portal' WHERE `entry`=25603; +UPDATE `creature_template` SET `ScriptName`='mob_volatile_felfire_fiend' WHERE `entry`=25598; +UPDATE `creature_template` SET `ScriptName`='mob_armageddon' WHERE `entry`=25735; +UPDATE `creature_template` SET `ScriptName`='mob_shield_orb' WHERE `entry`=25502; +UPDATE `creature_template` SET `ScriptName`='mob_sinster_reflection' WHERE `entry`=25708; +UPDATE `gameobject_template` SET `ScriptName`='go_orb_of_the_blue_flight' WHERE `entry`=188415; +UPDATE `creature_template` SET `ScriptName`='npc_void_sentinel' WHERE `entry`=25772; +UPDATE `creature_template` SET `ScriptName`='npc_dark_fiend' WHERE `entry`=25744; +UPDATE `creature_template` SET `ScriptName`='boss_muru' WHERE `entry`=25741; +UPDATE `creature_template` SET `ScriptName`='boss_entropius' WHERE `entry`=25840; +UPDATE `creature_template` SET `ScriptName`='npc_muru_portal' WHERE `entry`=25770; +UPDATE `creature_template` SET `ScriptName`='boss_kalecgos' WHERE `entry`=24850; +UPDATE `creature_template` SET `ScriptName`='boss_sathrovarr' WHERE `entry`=24892; +UPDATE `creature_template` SET `ScriptName`='boss_kalec' WHERE `entry`=24891; +UPDATE gameobject_template SET scriptname = 'kalecgos_teleporter' WHERE entry = 187055; +UPDATE `creature_template` SET `ScriptName`='npc_blackhole' WHERE `entry`=25855; /* SWAMP OF SORROWS */ diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp index fca9b0c19e3..56d389b30ef 100644 --- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp @@ -644,7 +644,7 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff) } } -bool GOkalocegos_teleporter(Player *player, GameObject* _GO) +bool GOkalecgos_teleporter(Player *player, GameObject* _GO) { if(player->HasAura(AURA_SPECTRAL_EXHAUSTION, 0)) player->GetSession()->SendNotification(GO_FAILED); @@ -687,7 +687,7 @@ void AddSC_boss_kalecgos() newscript->RegisterSelf(); newscript = new Script; - newscript->Name="kalocegos_teleporter"; - newscript->pGOHello = &GOkalocegos_teleporter; + newscript->Name="kalecgos_teleporter"; + newscript->pGOHello = &GOkalecgos_teleporter; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp index 29248b5e786..746aece5fd5 100644 --- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp @@ -293,9 +293,9 @@ bool GOHello_go_orb_of_the_blue_flight(Player *plr, GameObject* go) } //AI for Kalecgos -struct TRINITY_DLL_DECL boss_kalecgosKJAI : public ScriptedAI +struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI { - boss_kalecgosKJAI(Creature* c) : ScriptedAI(c){ + boss_kalecgos_kjAI(Creature* c) : ScriptedAI(c){ pInstance = ((ScriptedInstance*)c->GetInstanceData()); } @@ -402,9 +402,9 @@ struct TRINITY_DLL_DECL boss_kalecgosKJAI : public ScriptedAI } }; -CreatureAI* GetAI_boss_kalecgosKJ(Creature *_Creature) +CreatureAI* GetAI_boss_kalecgos_kj(Creature *_Creature) { - return new boss_kalecgosKJAI (_Creature); + return new boss_kalecgos_kjAI (_Creature); } //AI for Kil'jaeden @@ -649,8 +649,8 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI break; case TIMER_ORBS_EMPOWER: //Phase 3 if(Phase == PHASE_SACRIFICE){ - if(Kalec)((boss_kalecgosKJAI*)Kalec->AI())->EmpowerOrb(true); - }else if(Kalec)((boss_kalecgosKJAI*)Kalec->AI())->EmpowerOrb(false); + if(Kalec)((boss_kalecgos_kjAI*)Kalec->AI())->EmpowerOrb(true); + }else if(Kalec)((boss_kalecgos_kjAI*)Kalec->AI())->EmpowerOrb(false); Timer[TIMER_ORBS_EMPOWER]= (Phase == PHASE_SACRIFICE) ? 45000 : 35000; OrbActivated = true; TimerIsDeactiveted[TIMER_ORBS_EMPOWER] = true; @@ -749,7 +749,7 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA void Reset(){ Phase = PHASE_DECEIVERS; - if(KalecKJ)((boss_kalecgosKJAI*)KalecKJ->AI())->ResetOrbs(); + if(KalecKJ)((boss_kalecgos_kjAI*)KalecKJ->AI())->ResetOrbs(); DeceiverDeathCount = 0; SummonedDeceivers = false; KiljaedenDeath = false; @@ -1270,8 +1270,8 @@ void AddSC_boss_kiljaeden() newscript->RegisterSelf(); newscript = new Script; - newscript->GetAI = &GetAI_boss_kalecgosKJ; - newscript->Name = "boss_kalecgosKJ"; + newscript->GetAI = &GetAI_boss_kalecgos_kj; + newscript->Name = "boss_kalecgos_kj"; newscript->RegisterSelf(); newscript = new Script; From 883cd02304924f04e36306497cf0d36ab373d957 Mon Sep 17 00:00:00 2001 From: Anubisss Date: Mon, 18 May 2009 15:28:15 +0200 Subject: [PATCH 5/5] *Add the missing sql from r1508. --HG-- branch : trunk --- sql/updates/TC1_1509_world_scripts.sql | 2 ++ sql/world_scripts_full.sql | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 sql/updates/TC1_1509_world_scripts.sql diff --git a/sql/updates/TC1_1509_world_scripts.sql b/sql/updates/TC1_1509_world_scripts.sql new file mode 100644 index 00000000000..d2adb3fb644 --- /dev/null +++ b/sql/updates/TC1_1509_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'kalecgos_teleporter' WHERE `entry` = 187055; +UPDATE `creature_template` SET `ScriptName` = 'boss_kalecgos_kj' WHERE `entry` = 25319; diff --git a/sql/world_scripts_full.sql b/sql/world_scripts_full.sql index fb416caea22..d074a524da4 100644 --- a/sql/world_scripts_full.sql +++ b/sql/world_scripts_full.sql @@ -845,7 +845,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_muru_portal' WHERE `entry`=2577 UPDATE `creature_template` SET `ScriptName`='boss_kalecgos' WHERE `entry`=24850; UPDATE `creature_template` SET `ScriptName`='boss_sathrovarr' WHERE `entry`=24892; UPDATE `creature_template` SET `ScriptName`='boss_kalec' WHERE `entry`=24891; -UPDATE gameobject_template SET scriptname = 'kalecgos_teleporter' WHERE entry = 187055; +UPDATE `gameobject_template` SET `ScriptName`='kalecgos_teleporter' WHERE `entry`=187055; UPDATE `creature_template` SET `ScriptName`='npc_blackhole' WHERE `entry`=25855; /* SWAMP OF SORROWS */