From 7d2eb958d5963b2ef11f33832ef64fe692de1974 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 21 Mar 2009 23:29:18 -0600 Subject: *Do not set civilians as react state defensive as default. --HG-- branch : trunk --- src/game/Creature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 66ae42aec16..7d0db29b68c 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -365,8 +365,8 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) if(isTotem() || isTrigger() || GetCreatureType() == CREATURE_TYPE_CRITTER) SetReactState(REACT_PASSIVE); - else if(isCivilian()) - SetReactState(REACT_DEFENSIVE); + /*else if(isCivilian()) + SetReactState(REACT_DEFENSIVE);*/ else SetReactState(REACT_AGGRESSIVE); -- cgit v1.2.3 From 7303f9db8b601c7f816534132cb0b6d6665702a7 Mon Sep 17 00:00:00 2001 From: QAston Date: Sun, 22 Mar 2009 17:10:01 +0100 Subject: *Backport blood frenzy fix from TC2. --HG-- branch : trunk --- src/game/Spell.cpp | 24 +++++++++++++++++++++--- src/game/SpellAuras.h | 9 ++++++++- src/game/Unit.cpp | 31 +++++++++++++++++++++++++++++++ src/game/Unit.h | 2 ++ 4 files changed, 62 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index dbd0a74dc76..1e9a2a7d60e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1221,10 +1221,28 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled) ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); - for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i) + if (m_ChanceTriggerSpells.size()) { - if(roll_chance_i(i->second)) - m_caster->CastSpell(unit, i->first, true); + int _duration=0; + for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i) + { + if(roll_chance_i(i->second)) + { + m_caster->CastSpell(unit, i->first, true); + // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration + // set duration equal to triggering spell + if (GetSpellDuration(i->first)==-1) + { + // get duration from aura-only once + if (!_duration) + { + Aura * aur = unit->GetAuraByCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); + _duration = aur ? aur->GetAuraDuration() : -1; + } + unit->SetAurasDurationByCasterSpell(i->first->Id, m_caster->GetGUID(), _duration); + } + } + } } if(m_customAttr & SPELL_ATTR_CU_LINK_HIT) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index be95c5245b7..9d26d1b76dd 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -228,7 +228,14 @@ class TRINITY_DLL_SPEC Aura int32 GetAuraMaxDuration() const { return m_maxduration; } void SetAuraMaxDuration(int32 duration) { m_maxduration = duration; } int32 GetAuraDuration() const { return m_duration; } - void SetAuraDuration(int32 duration) { m_duration = duration; } + void SetAuraDuration(int32 duration) + { + m_duration = duration; + if (duration<0) + m_permanent=true; + else + m_permanent=false; + } time_t GetAuraApplyTime() { return m_applyTime; } void UpdateAuraDuration(); void SendAuraDurationForCaster(Player* caster); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 2c2d38f8f19..159ce634a2d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4497,6 +4497,37 @@ void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID) } } +void Unit::SetAurasDurationByCasterSpell(uint32 spellId, uint64 casterGUID, int32 duration) +{ + for(uint8 i = 0; i < 3; ++i) + { + spellEffectPair spair = spellEffectPair(spellId, i); + for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr) + { + if(itr->second->GetCasterGUID()==casterGUID) + { + itr->second->SetAuraDuration(duration); + break; + } + } + } +} + +Aura* Unit::GetAuraByCasterSpell(uint32 spellId, uint64 casterGUID) +{ + // Returns first found aura from spell-use only in cases where effindex of spell doesn't matter! + for(uint8 i = 0; i < 3; ++i) + { + spellEffectPair spair = spellEffectPair(spellId, i); + for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr) + { + if(itr->second->GetCasterGUID()==casterGUID) + return itr->second; + } + } + return NULL; +} + void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler) { for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) diff --git a/src/game/Unit.h b/src/game/Unit.h index f980692ef7b..a5c7c290506 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1128,6 +1128,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL); void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID); + void SetAurasDurationByCasterSpell(uint32 spellId, uint64 casterGUID, int32 duration); + Aura* GetAuraByCasterSpell(uint32 spellId, uint64 casterGUID); void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler); void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); void RemoveAurasDueToSpellByCancel(uint32 spellId); -- cgit v1.2.3 From bb1563eecec10a50cb717ae2649dce08ecf545cf Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 22 Mar 2009 11:02:15 -0600 Subject: *Restrict the size of updatepacket to see if this can fix freeze bug. --HG-- branch : trunk --- src/game/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Player.cpp b/src/game/Player.cpp index cdec0f53eca..912bc4ce693 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17825,7 +17825,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::setisVisibleForInState(this,false)) { -- cgit v1.2.3 From 93db1e021995648f77c66e2aeb4fd323d594a5a5 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 22 Mar 2009 11:06:21 -0600 Subject: *Fix a crash caused by boss_kelidan_the_breaker script. --HG-- branch : trunk --- .../zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp index 7959b9a60cd..cfa99c2db7d 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp @@ -175,7 +175,10 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); if(!channeler || channeler->isDead()) channeler = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000); - Channelers[i] = channeler->GetGUID(); + if(channeler) + Channelers[i] = channeler->GetGUID(); + else + Channelers[i] = 0; } } -- cgit v1.2.3 From 763c81de3cb3e144276f850ffa12265bf92d0d03 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 22 Mar 2009 11:32:29 -0600 Subject: *Remove possess aura when stop casting bindsight. --HG-- branch : trunk --- src/game/Player.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 912bc4ce693..c163026b08f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19129,10 +19129,14 @@ WorldObject* Player::GetFarsightTarget() const void Player::StopCastingBindSight() { - if (WorldObject* fTarget = GetFarsightTarget()) + if(WorldObject* target = GetFarsightTarget()) { - if (fTarget->isType(TYPEMASK_UNIT)) - ((Unit*)fTarget)->RemoveAuraTypeByCaster(SPELL_AURA_BIND_SIGHT, GetGUID()); + if(target->isType(TYPEMASK_UNIT)) + { + ((Unit*)target)->RemoveAuraTypeByCaster(SPELL_AURA_BIND_SIGHT, GetGUID()); + ((Unit*)target)->RemoveAuraTypeByCaster(SPELL_AURA_MOD_POSSESS, GetGUID()); + ((Unit*)target)->RemoveAuraTypeByCaster(SPELL_AURA_MOD_POSSESS_PET, GetGUID()); + } } } -- cgit v1.2.3