From feeaeefa8c51e2dfc4dc2bf89a3121815355ca74 Mon Sep 17 00:00:00 2001 From: vladimir_mangos Date: Fri, 7 Sep 2007 03:14:26 +0000 Subject: [PATCH] [4434] * Fixed: restore build mangos at Windows. Some lost in prev. commit changes :( * [New sql update 4434_spell_proc_event.sql] Partly revert wrong warrior talent related part in [4432]. And rewrite in more correct way. * Fixed: update duration of auras in stack at adding new aura to stack. * Add check for `InhabitType` field in `creature_template` table at loading. Wrong values cause always in evade mode creatures, for example. --- sql/mangos.sql | 6 ++--- sql/updates/4434_spell_proc_event.sql | 5 ++++ src/game/ObjectMgr.cpp | 16 ++++++++++++ src/game/ObjectMgr.h | 1 + src/game/SpellAuras.cpp | 25 ++++++++++++++----- src/game/SpellAuras.h | 2 +- src/game/Unit.cpp | 47 +++++++++++++++++++++++++++-------- win/VC71/g3dlite.vcproj | 20 +++++++-------- win/VC71/game.vcproj | 32 ++++++++++++------------ win/VC80/g3dlite.vcproj | 20 +++++++-------- win/VC80/game.vcproj | 32 ++++++++++++------------ 11 files changed, 134 insertions(+), 72 deletions(-) create mode 100644 sql/updates/4434_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 2a158f9d..2b8e1b4c 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -13531,9 +13531,9 @@ INSERT INTO `spell_proc_event` VALUES (29635,0,0,0,0,0,524288,3), (29636,0,0,0,0,0,524288,3), (29637,0,0,0,0,0,524288,3), -(29801,0,0,0,0,0,0,0), -(30030,0,0,0,0,0,0,0), -(30033,0,0,0,0,0,0,0), +(29801,0,0,0,0,0,1,0), +(30030,0,0,0,0,0,1,0), +(30033,0,0,0,0,0,1,0), (30079,0,0,0,0,0,2,0), (30080,0,0,0,0,0,2,0), (30081,0,0,0,0,0,2,0), diff --git a/sql/updates/4434_spell_proc_event.sql b/sql/updates/4434_spell_proc_event.sql new file mode 100644 index 00000000..feeb31b3 --- /dev/null +++ b/sql/updates/4434_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (29801,30030,30033); +INSERT INTO `spell_proc_event` VALUES +(29801,0,0,0,0,0,1,0), +(30030,0,0,0,0,0,1,0), +(30033,0,0,0,0,0,1,0); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index ef50b51d..57789851 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -390,6 +390,22 @@ void ObjectMgr::LoadCreatureTemplates() sLog.outString( ">> Loaded %u creature definitions", sCreatureStorage.RecordCount ); sLog.outString(); + + // check data correctness + for(uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i) + { + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i); + if(!cInfo) + continue; + + if(cInfo->InhabitType <= 0 || cInfo->InhabitType > INHAVIT_ANYWHERE) + { + sLog.outErrorDb("Creature (Entry: %u) have wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly",cInfo->Entry,cInfo->InhabitType); + + // attempt fix loaded data to less problematic state + const_cast(cInfo)->InhabitType = INHAVIT_ANYWHERE; + } + } } void ObjectMgr::LoadCreatureAddons() diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index e5e5a1ab..38d401a3 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -348,6 +348,7 @@ class ObjectMgr return &itr->second; return NULL; } + void LoadGuilds(); void LoadArenaTeams(); void LoadGroups(); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index b475cc85..35694584 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -752,9 +752,14 @@ void Aura::_AddAura() m_target->SetUInt32Value((uint16)(UNIT_FIELD_AURAFLAGS + flagslot), value); } + SetAuraSlot( slot ); + UpdateAuraDuration(); } else - UpdateSlotCounter(slot,true); + { + SetAuraSlot( slot ); + UpdateSlotCounterAndDuration(true); + } // Update Seals information if( IsSealSpell(GetId()) ) @@ -763,9 +768,6 @@ void Aura::_AddAura() // Conflagrate aura state if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & 4)) m_target->ModifyAuraState(AURA_STATE_IMMOLATE,true); - - SetAuraSlot( slot ); - UpdateAuraDuration(); } } @@ -840,22 +842,31 @@ void Aura::_RemoveAura() SendCoolDownEvent(); } else // decrease count for spell - UpdateSlotCounter(slot,false); + UpdateSlotCounterAndDuration(false); } -void Aura::UpdateSlotCounter(uint8 slot, bool add) +void Aura::UpdateSlotCounterAndDuration(bool add) { + uint8 slot = GetAuraSlot(); if(slot >= MAX_AURAS) return; // calculate amount of similar auras by same effect index (similar different spells) int8 count = 0; + // calculate auras and update durations in case aura adding Unit::AuraList const& aura_list = m_target->GetAurasByType(GetModifier()->m_auraname); for(Unit::AuraList::const_iterator i = aura_list.begin();i != aura_list.end(); ++i) + { if((*i)->m_spellId==m_spellId && (*i)->m_effIndex==m_effIndex) + { ++count; + if(add) + (*i)->SetAuraDuration(GetAuraDuration()); + } + } + // at aura add aura not added yet, at aura remove aura already removed // in field stored (count-1) if(!add) @@ -871,6 +882,8 @@ void Aura::UpdateSlotCounter(uint8 slot, bool add) val = (val & ~byte_mask) | (count << byte_bitpos); m_target->SetUInt32Value(UNIT_FIELD_AURAAPPLICATIONS+index, val); + + UpdateAuraDuration(); } /*********************************************************/ diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index a9f9f341..e047b4a2 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -275,7 +275,7 @@ class Aura bool m_updated; bool m_removeOnDeath; private: - void UpdateSlotCounter(uint8 slot,bool add); + void UpdateSlotCounterAndDuration(bool add); float m_fearMoveAngle; }; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7539f925..d148ac14 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3014,10 +3014,6 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) if ((*i).second->GetSpellProto()->EffectTriggerSpell[j] == spellProto->Id) is_triggered_by_spell = true; if (is_triggered_by_spell) continue; - // prevent removing aura that triggered by aura at triggering aura add - for(int j = 0; j < 3; ++j) - if (spellProto->EffectTriggerSpell[j] == i_spellId) - is_triggered_by_spell = true; // prevent remove dummy triggered spells at next effect aura add for(int j = 0; j < 3; ++j) @@ -4116,11 +4112,31 @@ void Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return; } case 2006: - //Rampage - //Effects: 30029(Rank 1), 30031(Rank 2), 30032(Rank 3) - //Check EffectTriggerSpell[1] to determine correct effect id - //CastSpell(this, triggredByAura->GetSpellProto()->EffectTriggerSpell[1], true, NULL, triggredByAura); - return; + { + switch(auraSpellInfo->SpellFamilyName) + { + case SPELLFAMILY_WARRIOR: + { + //Rampage (overwrite non existing triggered spell call in spell.dbc + if(auraSpellInfo->SpellFamilyFlags==0x100000) + { + //all ranks have effect[0]==AURA (Proc Trigger Spell, non-existed) + //and effect[1]==TriggerSpell + + if(auraSpellInfo->Effect[1]!=SPELL_EFFECT_TRIGGER_SPELL) + { + sLog.outError("Unit::HandleProcTriggerSpell: Spell %u have wrong effect in RM",triggeredByAura->GetSpellProto()->Id); + return; + } + + CastSpell(this, auraSpellInfo->EffectTriggerSpell[1], true, NULL, triggeredByAura); + return; + } + break; + } + } + break; + } case 2013: { //Nature's Guardian @@ -4634,8 +4650,19 @@ void Unit::ModifyAuraState(uint32 flag, bool apply) Unit::AuraMap& tAuras = GetAuras(); for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();) { - if ((*itr).second->GetSpellProto()->CasterAuraState == flag) + SpellEntry const* spellProto = (*itr).second->GetSpellProto(); + if (spellProto->CasterAuraState == flag) + { + // exceptions (applied at state but not removed at state change) + if(spellProto->SpellIconID==2006 && spellProto->SpellFamilyName==SPELLFAMILY_WARRIOR && spellProto->SpellFamilyFlags==0x100000) + { + ++itr; + continue; + } + + RemoveAura(itr); + } else ++itr; } diff --git a/win/VC71/g3dlite.vcproj b/win/VC71/g3dlite.vcproj index b9812387..ef23ad8d 100644 --- a/win/VC71/g3dlite.vcproj +++ b/win/VC71/g3dlite.vcproj @@ -12,8 +12,8 @@ @@ -59,8 +59,8 @@ diff --git a/win/VC71/game.vcproj b/win/VC71/game.vcproj index 244c76e6..22c41a49 100644 --- a/win/VC71/game.vcproj +++ b/win/VC71/game.vcproj @@ -13,8 +13,8 @@ @@ -69,8 +69,8 @@ diff --git a/win/VC80/g3dlite.vcproj b/win/VC80/g3dlite.vcproj index 8bbc2b60..3b72cbf5 100644 --- a/win/VC80/g3dlite.vcproj +++ b/win/VC80/g3dlite.vcproj @@ -16,8 +16,8 @@