diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Pet.cpp | 2 | ||||
| -rw-r--r-- | src/game/Player.cpp | 6 | ||||
| -rw-r--r-- | src/game/SpellAuras.cpp | 46 | ||||
| -rw-r--r-- | src/game/SpellAuras.h | 27 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 85 | ||||
| -rw-r--r-- | src/shared/revision_nr.h | 2 | 
6 files changed, 103 insertions, 65 deletions
| diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index dc2ea0820b1..e889d365096 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1251,7 +1251,7 @@ void Pet::_SaveAuras()                      {                          CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) "                              "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%u', '%d', '%d', '%d', '%d')", -                            m_charmInfo->GetPetNumber(), itr2->second->GetCasterGUID(),(uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->m_procCharges)); +                            m_charmInfo->GetPetNumber(), itr2->second->GetCasterGUID(),(uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges()));                      }                  }              } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 86cc93e78a0..10554c9e978 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14801,7 +14801,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)                      remaincharges = spellproto->procCharges;              }              else -                remaincharges = -1; +                remaincharges = 0;              //do not load single target auras (unless they were cast by the player)              if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto)) @@ -15912,7 +15912,7 @@ void Player::_SaveAuras()                      {                          CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) "                              "VALUES ('%u', '" I64FMTD "' ,'%u', '%u', '%u', '%d', '%d', '%d', '%d')", -                            GetGUIDLow(), itr2->second->GetCasterGUID(), (uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->m_procCharges)); +                            GetGUIDLow(), itr2->second->GetCasterGUID(), (uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges()));                      }                  }              } @@ -18634,7 +18634,7 @@ void Player::SendAurasForTarget(Unit *target)                      // level                      data << uint8(aura->GetAuraLevel());                      // charges -                    data << uint8(aura->m_procCharges >= 0 ? aura->m_procCharges : 0 ); +                    data << uint8(aura->GetAuraCharges());                      if(!(auraFlags & AFLAG_NOT_CASTER))                      { diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 8ae85c89ff0..0e59d854d6f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -431,15 +431,9 @@ m_periodicTimer(0), m_PeriodicEventId(0), m_AuraDRGroup(DIMINISHING_NONE)      m_isDeathPersist = IsDeathPersistentSpell(m_spellProto); -    if(m_spellProto->procCharges) -    { -        m_procCharges = m_spellProto->procCharges; - -        if(modOwner) -            modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges); -    } -    else -        m_procCharges = -1; +    m_procCharges = m_spellProto->procCharges; +    if(modOwner) +        modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges);      m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() && m_spellProto->Stances &&                              !(m_spellProto->AttributesEx2 & 0x80000) && !(m_spellProto->Attributes & 0x10000)); @@ -877,17 +871,16 @@ void Aura::_AddAura()              SetAuraSlot( slot );              // Not update fields for not first spell's aura, all data already in fields -            if(slot < MAX_AURAS)                        // slot found -            { -                SetAura(false); -                SetAuraFlags((1 << GetEffIndex()) | AFLAG_NOT_CASTER | ((GetAuraMaxDuration() > 0) ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE)); -                SetAuraLevel(caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)); -                UpdateAuraCharges(); -                SendAuraUpdate(false); - -                // update for out of range group members -                m_target->UpdateAuraForGroup(slot); -            } +                if(slot < MAX_AURAS)                        // slot found +                { +                    SetAura(false); +                    SetAuraFlags((1 << GetEffIndex()) | AFLAG_NOT_CASTER | ((GetAuraMaxDuration() > 0) ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE)); +                    SetAuraLevel(caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)); +                    SendAuraUpdate(false); + +                    // update for out of range group members +                    m_target->UpdateAuraForGroup(slot); +                }          }          else                                                // use found slot          { @@ -1027,7 +1020,7 @@ void Aura::SendAuraUpdate(bool remove)      uint8 auraFlags = GetAuraFlags();      data << uint8(auraFlags);      data << uint8(GetAuraLevel()); -    data << uint8(m_procCharges >= 0 ? m_procCharges : 0); +    data << uint8(GetAuraCharges());      if(!(auraFlags & AFLAG_NOT_CASTER))      { @@ -1097,7 +1090,7 @@ void Aura::HandleAddModifier(bool apply, bool Real)              case 34754:    // Clearcasting              case 34936:    // Backlash              case 48108:    // Hot Streak -                m_procCharges = 1; +                SetAuraCharges(1);                  break;          } @@ -1125,11 +1118,7 @@ void Aura::HandleAddModifier(bool apply, bool Real)          mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32;          mod->mask2= (uint64)ptr[2]; - -        if (m_procCharges > 0) -            mod->charges = m_procCharges; -        else -            mod->charges = 0; +        mod->charges = m_procCharges;          m_spellmod = mod;      } @@ -3859,8 +3848,7 @@ void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real)          switch (GetId())          {              case 28200:                                     // Ascendance (Talisman of Ascendance trinket) -                m_procCharges = 6; -                UpdateAuraCharges(); +                SetAuraCharges(6);                  break;              default: break;          } diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 99c170d1139..9b1ac66c795 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -264,16 +264,25 @@ class TRINITY_DLL_SPEC Aura          uint8 GetAuraLevel() const { return m_auraLevel; }          void SetAuraLevel(uint8 level) { m_auraLevel = level; }          uint8 GetAuraCharges() const { return m_procCharges; } -        void SetAuraCharges(uint8 charges) { m_procCharges = charges; } -        void SetAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); } -        void SendAuraUpdate(bool remove); -        void UpdateAuraCharges() +        void SetAuraCharges(uint8 charges)           { -            // only aura in slot with charges and without stack limitation -            if (m_auraSlot < MAX_AURAS && m_procCharges >= 1 && GetSpellProto()->StackAmount==0) -                SendAuraUpdate(false); +            if (m_procCharges == charges) +                return; +            m_procCharges = charges; +            SendAuraUpdate(false); +        } +        bool DropAuraCharge() // return true if last charge dropped +        {  +            if (m_procCharges == 0) +                return false; +            m_procCharges--; +            SendAuraUpdate(false); +            return m_procCharges == 0;          } +        void SetAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); } +        void SendAuraUpdate(bool remove); +          bool IsPositive() { return m_positive; }          void SetNegative() { m_positive = false; }          void SetPositive() { m_positive = true; } @@ -300,9 +309,6 @@ class TRINITY_DLL_SPEC Aura          void SetUpdated(bool val) { m_updated = val; }          void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; } -        int32 m_procCharges; -        void SetAuraProcCharges(int32 charges) { m_procCharges = charges; } -          Unit* GetTriggerTarget() const;          // add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras @@ -341,6 +347,7 @@ class TRINITY_DLL_SPEC Aura          uint8 m_auraSlot;          uint8 m_auraFlags;          uint8 m_auraLevel; +        int8  m_procCharges;          bool m_positive:1;          bool m_permanent:1; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c5aeeb2e081..e5a87fa6efa 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4567,7 +4567,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu                  case 33493:                  {                      // Cast finish spell at last charge -                    if (triggeredByAura->m_procCharges > 1) +                    if (triggeredByAura->GetAuraCharges() > 1)                          return false;                      target = this; @@ -4799,6 +4799,29 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu                  triggered_spell_id = 29077;                  break;              } +            // Hot Streak +            if (dummySpell->SpellIconID == 2999) +            { +                if (triggeredByAura->GetEffIndex()!=0) +                    return true; +                Aura *counter = GetAura(triggeredByAura->GetId(), 1); +                if (!counter) +                    return true; + +                // Count spell criticals in a row in second aura +                Modifier *mod = counter->GetModifier(); +                if (procEx & PROC_EX_CRITICAL_HIT) +                { +                    mod->m_amount *=2; +                    if (mod->m_amount < 100) // not enough +                        return true; +                    // Crititcal counted -> roll chance +                    if (roll_chance_i(triggeredByAura->GetModifier()->m_amount)) +                       CastSpell(this, 48108, true, castItem, triggeredByAura); +                } +                mod->m_amount = 25; +                return true; +            }              // Incanter's Regalia set (add trigger chance to Mana Shield)              if (dummySpell->SpellFamilyFlags & 0x0000000000008000LL)              { @@ -4837,7 +4860,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu                  case 11129:                  {                      //last charge and crit -                    if (triggeredByAura->m_procCharges <= 1 && (procEx & PROC_EX_CRITICAL_HIT) ) +                    if (triggeredByAura->GetAuraCharges() <= 1 && (procEx & PROC_EX_CRITICAL_HIT) )                      {                          RemoveAurasDueToSpell(28682);       //-> remove Combustion auras                          return true;                        // charge counting (will removed) @@ -5156,11 +5179,6 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu                  if(!procSpell)                      return false; -                // only rogue's finishing moves (maybe need additional checks) -                if( procSpell->SpellFamilyName!=SPELLFAMILY_ROGUE || -                    (procSpell->SpellFamilyFlags & SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE) == 0) -                    return false; -                  // energy cost save                  basepoints0 = procSpell->manaCost * triggeredByAura->GetModifier()->m_amount/100;                  if(basepoints0 <= 0) @@ -5342,6 +5360,33 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu                      break;                  } +                // Glyph of Divinity +                case 54939: +                { +                    // Lookup base amount mana restore +                    for (int i=0; i<3;i++) +                        if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE) +                        { +                            int32 mana = procSpell->EffectBasePoints[i]; +                            CastCustomSpell(this, 54986, 0, &mana, 0, true, castItem, triggeredByAura); +                            break; +                        } +                    return true; +                } +                // Glyph of Flash of Light +                case 54936: +                { +                    triggered_spell_id = 54957; +                    basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; +                    break; +                } +                // Glyph of Holy Light +                case 54937: +                { +                    triggered_spell_id = 54968; +                    basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; +                    break; +                }              }              break;          } @@ -10039,6 +10084,11 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag          procTriggered.push_back( ProcTriggeredData(spellProcEvent, itr->second) );      } + +    // Nothing found +    if (procTriggered.empty()) +        return; +      // Handle effects proceed this time      for(ProcTriggeredList::iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)      { @@ -10073,7 +10123,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag          Modifier *auraModifier = triggeredByAura->GetModifier();          SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();          uint32 effIndex = triggeredByAura->GetEffIndex(); -        bool useCharges = triggeredByAura->m_procCharges > 0; +        bool useCharges = triggeredByAura->GetAuraCharges() > 0;          // For players set spell cooldown if need          uint32 cooldown = 0;          if (GetTypeId() == TYPEID_PLAYER && spellProcEvent && spellProcEvent->cooldown) @@ -10137,11 +10187,6 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag                      continue;                  break;              } -            case SPELL_AURA_MOD_STUN: -                // Remove by default, but if charge exist drop it -                if (triggeredByAura->m_procCharges == 0) -                   removedSpells.push_back(triggeredByAura->GetId()); -                break;              case SPELL_AURA_MOD_CASTING_SPEED:                  // Skip melee hits or instant cast spells                  if (procSpell == NULL || GetSpellCastTime(procSpell) == 0) @@ -10182,18 +10227,16 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag              AuraMap::const_iterator upper = GetAuras().upper_bound(i->triggeredByAura_SpellPair);              for(AuraMap::const_iterator itr = lower; itr!= upper; ++itr)              { -                if(itr->second == i->triggeredByAura) +                // If last charge dropped add spell to remove list +                if(itr->second == i->triggeredByAura && triggeredByAura->DropAuraCharge())                  { -                     triggeredByAura->m_procCharges -=1; -                     triggeredByAura->UpdateAuraCharges(); -                     if (triggeredByAura->m_procCharges <= 0) -                          removedSpells.push_back(triggeredByAura->GetId()); +                    removedSpells.push_back(triggeredByAura->GetId());                      break;                  }              }          }      } -    if (removedSpells.size()) +    if (!removedSpells.empty())      {          // Sort spells and remove dublicates          removedSpells.sort(); @@ -10905,10 +10948,10 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura )      uint64 caster_guid = triggeredByAura->GetCasterGUID();      // jumps -    int32 jumps = triggeredByAura->m_procCharges-1; +    int32 jumps = triggeredByAura->GetAuraCharges()-1;      // current aura expire -    triggeredByAura->m_procCharges = 1;             // will removed at next charges decrease +    triggeredByAura->SetAuraCharges(1);             // will removed at next charges decrease      // next target selection      if(jumps > 0 && GetTypeId()==TYPEID_PLAYER && IS_PLAYER_GUID(caster_guid)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 213a86ca7f9..6b46afe7672 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@  #ifndef __REVISION_NR_H__  #define __REVISION_NR_H__ - #define REVISION_NR "7028" + #define REVISION_NR "7031"  #endif // __REVISION_NR_H__ | 
