mirror of
https://github.com/mangosfour/server.git
synced 2025-12-28 22:37:04 +00:00
Build error and warning fixes
Build error and warning fixes Spell class - Fix for inaccessible class data. Accessor functions created for protected member, m_selfContainer
This commit is contained in:
parent
952edfa46e
commit
52112d7657
8 changed files with 199 additions and 16 deletions
|
|
@ -89,7 +89,7 @@ struct LootStoreItem
|
|||
uint8 type; // 0 = item, 1 = currency
|
||||
float chance; // always positive, chance to drop for both quest and non-quest items, chance to be used for refs
|
||||
int32 mincountOrRef; // mincount for drop items (positive) or minus referenced TemplateleId (negative)
|
||||
uint32 maxcount; // max drop count for the item (mincountOrRef positive) or Ref multiplicator (mincountOrRef negative)
|
||||
uint8 maxcount; // max drop count for the item (mincountOrRef positive) or Ref multiplicator (mincountOrRef negative)
|
||||
uint8 group : 7;
|
||||
bool needs_quest : 1; // quest drop (negative ChanceOrQuestChance in DB)
|
||||
uint16 conditionId : 16; // additional loot condition Id
|
||||
|
|
|
|||
|
|
@ -120,18 +120,18 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32 castTime = 0;
|
||||
uint32 castTime = 0;
|
||||
SpellScalingEntry const* spellScalingEntry = spellInfo->GetSpellScaling();
|
||||
if (spell && spellScalingEntry && (spell->GetCaster()->GetTypeId() == TYPEID_PLAYER || spell->GetCaster()->GetObjectGuid().IsPet()))
|
||||
{
|
||||
uint32 level = spell->GetCaster()->getLevel();
|
||||
if (level == 1)
|
||||
castTime = int32(spellScalingEntry->castTimeMin);
|
||||
else if (level < spellScalingEntry->castScalingMaxLevel)
|
||||
castTime = int32(spellScalingEntry->castTimeMin + float(level - 1) *
|
||||
castTime = uint32(spellScalingEntry->castTimeMin);
|
||||
else if (level < uint32(spellScalingEntry->castScalingMaxLevel))
|
||||
castTime = uint32(spellScalingEntry->castTimeMin + float(level - 1) *
|
||||
(spellScalingEntry->castTimeMax - spellScalingEntry->castTimeMin) / (spellScalingEntry->castScalingMaxLevel - 1));
|
||||
else
|
||||
castTime = int32(spellScalingEntry->castTimeMax);
|
||||
castTime = uint32(spellScalingEntry->castTimeMax);
|
||||
}
|
||||
else if (SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex))
|
||||
{
|
||||
|
|
@ -146,13 +146,13 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
|
|||
}
|
||||
|
||||
// currently only profession spells have CastTimePerLevel data filled, always negative
|
||||
castTime = spellCastTimeEntry->CastTime + spellCastTimeEntry->CastTimePerLevel * level;
|
||||
castTime = uint32(spellCastTimeEntry->CastTime + spellCastTimeEntry->CastTimePerLevel * level);
|
||||
}
|
||||
else
|
||||
castTime = spellCastTimeEntry->CastTime;
|
||||
castTime = uint32(spellCastTimeEntry->CastTime);
|
||||
|
||||
if (castTime < spellCastTimeEntry->MinCastTime)
|
||||
castTime = spellCastTimeEntry->MinCastTime;
|
||||
if (castTime < uint32(spellCastTimeEntry->MinCastTime))
|
||||
castTime = uint32(spellCastTimeEntry->MinCastTime);
|
||||
}
|
||||
else
|
||||
// not all spells have cast time index and this is all is pasiive abilities
|
||||
|
|
@ -164,18 +164,18 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
|
|||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
|
||||
|
||||
if (!spellInfo->HasAttribute(SPELL_ATTR_UNK4) && !spellInfo->HasAttribute(SPELL_ATTR_TRADESPELL))
|
||||
castTime = int32(castTime * spell->GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED));
|
||||
castTime = uint32(castTime * spell->GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED));
|
||||
else
|
||||
{
|
||||
if (spell->IsRangedSpell() && !spell->IsAutoRepeat())
|
||||
castTime = int32(castTime * spell->GetCaster()->m_modAttackSpeedPct[RANGED_ATTACK]);
|
||||
castTime = uint32(castTime * spell->GetCaster()->m_modAttackSpeedPct[RANGED_ATTACK]);
|
||||
}
|
||||
}
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_RANGED) && (!spell || !spell->IsAutoRepeat()))
|
||||
castTime += 500;
|
||||
|
||||
return (castTime > 0) ? uint32(castTime) : 0;
|
||||
return (castTime > 0) ? castTime : 0;
|
||||
}
|
||||
|
||||
uint32 GetSpellCastTimeForBonus(SpellEntry const* spellProto, DamageEffectType damagetype)
|
||||
|
|
|
|||
|
|
@ -3887,7 +3887,10 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
|
|||
m_currentSpells[CSpellType] = pSpell;
|
||||
pSpell->SetReferencedFromCurrent(true);
|
||||
|
||||
pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
|
||||
pSpell->SetSelfContainer(&(m_currentSpells[pSpell->GetCurrentContainer()])); // this works, but is not safe - <looks at Cédric>
|
||||
|
||||
// original and faulty code - delete once the above has been proven to work
|
||||
// pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]); // m_selfContainer is not accessible, due to being a protected member
|
||||
}
|
||||
|
||||
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool sendAutoRepeatCancelToClient)
|
||||
|
|
@ -9526,9 +9529,9 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt
|
|||
if (gtScalingEntry)
|
||||
{
|
||||
float scale = gtScalingEntry->value;
|
||||
if (scalingEntry->castTimeMax > 0 && scalingEntry->castScalingMaxLevel > level)
|
||||
if (uint32(scalingEntry->castTimeMax) > 0 && uint32(scalingEntry->castScalingMaxLevel) > level)
|
||||
scale *= float(scalingEntry->castTimeMin + float(level - 1) * (scalingEntry->castTimeMax - scalingEntry->castTimeMin) / (scalingEntry->castScalingMaxLevel - 1)) / float(scalingEntry->castTimeMax);
|
||||
if (scalingEntry->coefLevelBase > level)
|
||||
if (uint32(scalingEntry->coefLevelBase) > level)
|
||||
scale *= (1.0f - scalingEntry->coefBase) * (level - 1) / (scalingEntry->coefLevelBase - 1) + scalingEntry->coefBase;
|
||||
|
||||
basePoints = int32(scalingEntry->coeff1[effect_index] * scale);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue