Updated all spell scripts

This commit is contained in:
Hondacrx
2025-10-13 13:23:31 -04:00
parent 3c4602e4a1
commit 3e028633ba
46 changed files with 33364 additions and 26554 deletions
@@ -637,7 +637,7 @@ namespace Game.Entities
var conditions = Global.ConditionMgr.GetConditionsForAreaTrigger(GetTemplate().Id.Id, GetTemplate().Id.IsCustom);
targetList.RemoveAll(target =>
{
if (GetCasterGuid() == target.GetGUID())
if (GetCasterGUID() == target.GetGUID())
{
if (HasActionSetFlag(AreaTriggerActionSetFlag.NotTriggeredbyCaster))
return true;
@@ -921,7 +921,7 @@ namespace Game.Entities
public Unit GetCaster()
{
return Global.ObjAccessor.GetUnit(this, GetCasterGuid());
return Global.ObjAccessor.GetUnit(this, GetCasterGUID());
}
Unit GetTarget()
@@ -1015,7 +1015,7 @@ namespace Game.Entities
}
}
float GetMaxSearchRadius()
public float GetMaxSearchRadius()
{
return m_areaTriggerData.BoundsRadius2D * CalcCurrentScale();
}
@@ -1161,7 +1161,7 @@ namespace Game.Entities
case AreaTriggerActionTypes.Cast:
goto case AreaTriggerActionTypes.AddAura;
case AreaTriggerActionTypes.AddAura:
unit.RemoveAurasDueToSpell(action.Param, GetCasterGuid());
unit.RemoveAurasDueToSpell(action.Param, GetCasterGUID());
break;
case AreaTriggerActionTypes.Tavern:
Player player = unit.ToPlayer();
@@ -1574,9 +1574,9 @@ namespace Game.Entities
public AreaTriggerCreateProperties GetCreateProperties() { return _areaTriggerCreateProperties; }
public override ObjectGuid GetCreatorGUID() { return GetCasterGuid(); }
public override ObjectGuid GetOwnerGUID() { return GetCasterGuid(); }
public ObjectGuid GetCasterGuid() { return m_areaTriggerData.Caster; }
public override ObjectGuid GetCreatorGUID() { return GetCasterGUID(); }
public override ObjectGuid GetOwnerGUID() { return GetCasterGUID(); }
public ObjectGuid GetCasterGUID() { return m_areaTriggerData.Caster; }
public bool HasSplines() { return _spline != null && !_spline.Empty(); }
public Spline<float> GetSpline() { return _spline; }
+13 -1
View File
@@ -3902,6 +3902,18 @@ namespace Game.Entities
command.Execute(m_goTypeImpl);
}
public int GetControllingTeam()
{
if (GetGoType() != GameObjectTypes.ControlZone)
return BattleGroundTeamId.Neutral;
var controlZone = (ControlZone)m_goTypeImpl;
if (controlZone == null)
return BattleGroundTeamId.Neutral;
return controlZone.GetControllingTeam();
}
public void CreateModel()
{
m_model = GameObjectModel.Create(new GameObjectModelOwnerImpl(this));
@@ -4600,7 +4612,7 @@ namespace Game.Entities
}
}
int GetControllingTeam()
public int GetControllingTeam()
{
if (_value < GetMaxHordeValue())
return BattleGroundTeamId.Horde;
+2 -2
View File
@@ -2454,7 +2454,7 @@ namespace Game.Entities
return spell.Prepare(targets.Targets, args.TriggeringAura);
}
void SendPlayOrphanSpellVisual(Position sourceLocation, ObjectGuid target, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
public void SendPlayOrphanSpellVisual(Position sourceLocation, ObjectGuid target, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
{
PlayOrphanSpellVisual playOrphanSpellVisual = new();
playOrphanSpellVisual.SourceLocation = sourceLocation;
@@ -2479,7 +2479,7 @@ namespace Game.Entities
SendMessageToSet(playOrphanSpellVisual, true);
}
void SendPlayOrphanSpellVisual(Position sourceLocation, Position targetLocation, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
public void SendPlayOrphanSpellVisual(Position sourceLocation, Position targetLocation, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
{
PlayOrphanSpellVisual playOrphanSpellVisual = new();
playOrphanSpellVisual.SourceLocation = sourceLocation;
+1 -1
View File
@@ -1325,7 +1325,7 @@ namespace Game.Entities
{
case Class.Warlock:
return GetCreatureTemplate().CreatureType == CreatureType.Demon;
case Class.Deathknight:
case Class.DeathKnight:
return GetCreatureTemplate().CreatureType == CreatureType.Undead;
case Class.Mage:
return GetCreatureTemplate().CreatureType == CreatureType.Elemental;
+1 -1
View File
@@ -472,7 +472,7 @@ namespace Game.Entities
opponent.UpdateCriteria(CriteriaType.WinDuel, 1);
// Credit for quest Death's Challenge
if (GetClass() == Class.Deathknight && opponent.GetQuestStatus(12733) == QuestStatus.Incomplete)
if (GetClass() == Class.DeathKnight && opponent.GetQuestStatus(12733) == QuestStatus.Incomplete)
opponent.CastSpell(duel.Opponent, 52994, true);
// Honor points after duel (the winner) - ImpConfig
+1 -1
View File
@@ -4276,7 +4276,7 @@ namespace Game.Entities
// Define the required variables
uint charDeleteMinLvl;
if (characterInfo.ClassId == Class.Deathknight)
if (characterInfo.ClassId == Class.DeathKnight)
charDeleteMinLvl = WorldConfig.GetUIntValue(WorldCfg.ChardeleteDeathKnightMinLevel);
else if (characterInfo.ClassId == Class.DemonHunter)
charDeleteMinLvl = WorldConfig.GetUIntValue(WorldCfg.ChardeleteDemonHunterMinLevel);
+4 -4
View File
@@ -2088,7 +2088,7 @@ namespace Game.Entities
ushort maxValue = GetMaxSkillValueForLevel();
if (rcInfo.HasFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillValue = maxValue;
else if (GetClass() == Class.Deathknight)
else if (GetClass() == Class.DeathKnight)
skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue);
SetSkill(skillId, 0, skillValue, maxValue);
@@ -2104,7 +2104,7 @@ namespace Game.Entities
ushort skillValue = 1;
if (rcInfo.HasFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillValue = maxValue;
else if (GetClass() == Class.Deathknight)
else if (GetClass() == Class.DeathKnight)
skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue);
SetSkill(skillId, 1, skillValue, maxValue);
@@ -3394,7 +3394,7 @@ namespace Game.Entities
public void InitRunes()
{
if (GetClass() != Class.Deathknight)
if (GetClass() != Class.DeathKnight)
return;
uint runeIndex = GetPowerIndex(PowerType.Runes);
@@ -3414,7 +3414,7 @@ namespace Game.Entities
public void UpdateAllRunesRegen()
{
if (GetClass() != Class.Deathknight)
if (GetClass() != Class.DeathKnight)
return;
uint runeIndex = GetPowerIndex(PowerType.Runes);
+4 -4
View File
@@ -2072,7 +2072,7 @@ namespace Game.Entities
}
else
{
if (GetClass() == Class.Deathknight && GetMapId() == 609 && !IsGameMaster() && !HasSpell(50977))
if (GetClass() == Class.DeathKnight && GetMapId() == 609 && !IsGameMaster() && !HasSpell(50977))
{
SendTransferAborted(teleportLocation.Location.GetMapId(), TransferAbortReason.UniqueMessage, 1);
return false;
@@ -2230,7 +2230,7 @@ namespace Game.Entities
if (CliDB.ChrRacesStorage.LookupByKey(race).HasFlag(ChrRacesFlag.IsAlliedRace))
startLevel = WorldConfig.GetUIntValue(WorldCfg.StartAlliedRaceLevel);
if (playerClass == Class.Deathknight)
if (playerClass == Class.DeathKnight)
{
if (race == Race.PandarenAlliance || race == Race.PandarenHorde)
startLevel = Math.Max(WorldConfig.GetUIntValue(WorldCfg.StartAlliedRaceLevel), startLevel);
@@ -3587,7 +3587,7 @@ namespace Game.Entities
Regenerate(power);
// Runes act as cooldowns, and they don't need to send any data
if (GetClass() == Class.Deathknight)
if (GetClass() == Class.DeathKnight)
{
uint regeneratedRunes = 0;
int regenIndex = 0;
@@ -7393,7 +7393,7 @@ namespace Game.Entities
if (node.HasFlag(TaxiNodeFlags.UsePlayerFavoriteMount) && preferredMountDisplay != 0)
mount_display_id = preferredMountDisplay;
else
mount_display_id = ObjectMgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == null || (sourcenode == 315 && GetClass() == Class.Deathknight));
mount_display_id = ObjectMgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == null || (sourcenode == 315 && GetClass() == Class.DeathKnight));
// in spell case allow 0 model
if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Game.Entities
m_taximask = new byte[((CliDB.TaxiNodesStorage.GetNumRows() - 1) / (1 * 64) + 1) * 8];
// class specific initial known nodes
if (chrClass == Class.Deathknight)
if (chrClass == Class.DeathKnight)
{
var factionMask = Player.TeamForRace(race) == Team.Horde ? DB2Manager.HordeTaxiNodesMask : DB2Manager.AllianceTaxiNodesMask;
m_taximask = new byte[factionMask.Length];
+2 -2
View File
@@ -917,7 +917,7 @@ namespace Game.Entities
return Math.Max(missChance, 0f);
}
float GetUnitCriticalChanceDone(WeaponAttackType attackType)
public float GetUnitCriticalChanceDone(WeaponAttackType attackType)
{
float chance = 0.0f;
Player thisPlayer = ToPlayer();
@@ -1585,7 +1585,7 @@ namespace Game.Entities
ApplyAttackTimePercentMod(WeaponAttackType.OffAttack, oldVal, false);
ApplyAttackTimePercentMod(WeaponAttackType.BaseAttack, newVal, true);
ApplyAttackTimePercentMod(WeaponAttackType.OffAttack, newVal, true);
if (GetClass() == Class.Deathknight)
if (GetClass() == Class.DeathKnight)
UpdateAllRunesRegen();
break;
case CombatRating.HasteRanged:
+1 -1
View File
@@ -623,7 +623,7 @@ namespace Game.Entities
{
if (GetOwner().GetClass() == Class.Warlock
|| GetOwner().GetClass() == Class.Shaman // Fire Elemental
|| GetOwner().GetClass() == Class.Deathknight) // Risen Ghoul
|| GetOwner().GetClass() == Class.DeathKnight) // Risen Ghoul
{
petType = PetType.Summon;
}
+25 -2
View File
@@ -312,11 +312,23 @@ namespace Game.Entities
m_hitMask |= ProcFlagsHit.Absorb;
}
public void ModifyDamage(ref int amount)
{
amount = Math.Max(amount, -((int)GetDamage()));
m_damage += (uint)amount;
}
public void ModifyDamage(int amount)
{
amount = Math.Max(amount, -((int)GetDamage()));
m_damage += (uint)amount;
}
public void AbsorbDamage(ref uint amount)
{
amount = Math.Min(amount, GetDamage());
m_absorb += amount;
m_damage -= amount;
m_hitMask |= ProcFlagsHit.Absorb;
}
public void AbsorbDamage(uint amount)
{
amount = Math.Min(amount, GetDamage());
@@ -324,7 +336,7 @@ namespace Game.Entities
m_damage -= amount;
m_hitMask |= ProcFlagsHit.Absorb;
}
public void ResistDamage(uint amount)
public void ResistDamage(ref uint amount)
{
amount = Math.Min(amount, GetDamage());
m_resist += amount;
@@ -335,7 +347,18 @@ namespace Game.Entities
m_hitMask &= ~(ProcFlagsHit.Normal | ProcFlagsHit.Critical);
}
}
void BlockDamage(uint amount)
public void ResistDamage(uint amount)
{
amount = Math.Min(amount, GetDamage());
m_resist += amount;
m_damage -= amount;
if (m_damage == 0)
{
m_hitMask |= ProcFlagsHit.FullResist;
m_hitMask &= ~(ProcFlagsHit.Normal | ProcFlagsHit.Critical);
}
}
public void BlockDamage(ref uint amount)
{
amount = Math.Min(amount, GetDamage());
m_block += amount;
+5 -2
View File
@@ -528,14 +528,17 @@ namespace Game.Entities
}
}
public void GetAllMinionsByEntry(List<TempSummon> Minions, uint entry)
public List<TempSummon> GetAllMinionsByEntry(uint entry)
{
List<TempSummon> minions = new();
for (var i = 0; i < m_Controlled.Count; ++i)
{
Unit unit = m_Controlled[i];
if (unit.GetEntry() == entry && unit.IsSummon()) // minion, actually
Minions.Add(unit.ToTempSummon());
minions.Add(unit.ToTempSummon());
}
return minions;
}
public void RemoveAllMinionsByEntry(uint entry)
+5
View File
@@ -2685,6 +2685,11 @@ namespace Game.Entities
return m_appliedAuras.KeyValueList;
}
public List<AuraApplication> GetAppliedAuras(uint key)
{
return m_appliedAuras.LookupByKey(key);
}
public Aura AddAura(uint spellId, Unit target)
{
if (target == null)
+5 -4
View File
@@ -3568,7 +3568,7 @@ namespace Game.Entities
if (spell != null)
spell.CallScriptOnResistAbsorbCalculateHandlers(damageInfo, ref resistedDamage, ref absorbIgnoringDamage);
damageInfo.ResistDamage(resistedDamage);
damageInfo.ResistDamage(ref resistedDamage);
// We're going to call functions which can modify content of the list during iteration over it's elements
// Let's copy the list so we can prevent iterator invalidation
@@ -3608,9 +3608,10 @@ namespace Game.Entities
// absorb must be smaller than the damage itself
currentAbsorb = MathFunctions.RoundToInterval(ref currentAbsorb, 0, damageInfo.GetDamage());
damageInfo.AbsorbDamage((uint)currentAbsorb);
uint temp = (uint)currentAbsorb;
damageInfo.AbsorbDamage(ref temp);
tempAbsorb = temp;
tempAbsorb = (uint)currentAbsorb;
absorbAurEff.GetBase().CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb);
// Check if our aura is using amount to count heal
@@ -3625,7 +3626,7 @@ namespace Game.Entities
}
if (!absorbAurEff.GetSpellInfo().HasAttribute(SpellAttr6.AbsorbCannotBeIgnore))
damageInfo.ModifyDamage(absorbIgnoringDamage);
damageInfo.ModifyDamage(ref absorbIgnoringDamage);
if (currentAbsorb != 0)
{