Core/Spells: rework part 5: GameObject casting

Port From (https://github.com/TrinityCore/TrinityCore/commit/962f6d7988b9003e550f6745be7cff812e9d8efa)
This commit is contained in:
hondacrx
2021-08-29 18:27:08 -04:00
parent e97ffa304d
commit 949d4806c5
39 changed files with 5236 additions and 4781 deletions
@@ -66,10 +66,10 @@ namespace Game.Entities
m_questObjectiveCriteriaMgr.ResetCriteria(failEvent, failAsset, evenIfCriteriaComplete);
}
public void UpdateCriteria(CriteriaTypes type, ulong miscValue1 = 0, ulong miscValue2 = 0, ulong miscValue3 = 0, Unit unit = null)
public void UpdateCriteria(CriteriaTypes type, ulong miscValue1 = 0, ulong miscValue2 = 0, ulong miscValue3 = 0, WorldObject refe = null)
{
m_achievementSys.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, unit, this);
m_questObjectiveCriteriaMgr.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, unit, this);
m_achievementSys.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
m_questObjectiveCriteriaMgr.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
// Update only individual achievement criteria here, otherwise we may get multiple updates
// from a single boss kill
@@ -78,11 +78,11 @@ namespace Game.Entities
Scenario scenario = GetScenario();
if (scenario != null)
scenario.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, unit, this);
scenario.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
Guild guild = Global.GuildMgr.GetGuildById(GetGuildId());
if (guild)
guild.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, unit, this);
guild.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
}
public void CompletedAchievement(AchievementRecord entry)
+2 -42
View File
@@ -3482,7 +3482,7 @@ namespace Game.Entities
SetFaction(rEntry != null ? (uint)rEntry.FactionID : 0);
}
public void SetResurrectRequestData(Unit caster, uint health, uint mana, uint appliedAura)
public void SetResurrectRequestData(WorldObject caster, uint health, uint mana, uint appliedAura)
{
Cypher.Assert(!IsResurrectRequested());
_resurrectionData = new ResurrectionData();
@@ -3633,7 +3633,7 @@ namespace Game.Entities
return false;
}
public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, Unit caster)
public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, WorldObject caster)
{
SpellEffectInfo effect = spellInfo.GetEffect(index);
if (effect == null || !effect.IsEffect())
@@ -6637,46 +6637,6 @@ namespace Game.Entities
return m_auraBaseFlatMod[(int)modGroup] * m_auraBasePctMod[(int)modGroup];
}
public void AddComboPoints(sbyte count, Spell spell = null)
{
if (count == 0)
return;
sbyte comboPoints = spell != null ? spell.m_comboPointGain : (sbyte)GetPower(PowerType.ComboPoints);
comboPoints += count;
if (comboPoints > 5)
comboPoints = 5;
else if (comboPoints < 0)
comboPoints = 0;
if (spell == null)
SetPower(PowerType.ComboPoints, comboPoints);
else
spell.m_comboPointGain = comboPoints;
}
public void GainSpellComboPoints(sbyte count)
{
if (count == 0)
return;
sbyte cp = (sbyte)GetPower(PowerType.ComboPoints);
cp += count;
if (cp > 5)
cp = 5;
else if (cp < 0)
cp = 0;
SetPower(PowerType.ComboPoints, cp);
}
public void ClearComboPoints()
{
SetPower(PowerType.ComboPoints, 0);
}
public byte GetComboPoints() { return (byte)GetPower(PowerType.ComboPoints); }
public byte GetDrunkValue() { return m_playerData.Inebriation; }
public void SetDrunkValue(byte newDrunkValue, uint itemId = 0)
{