Some refactoring of code. and some cleanups

This commit is contained in:
hondacrx
2019-09-21 12:11:16 -04:00
parent 7c405230cc
commit 35c06c09fd
214 changed files with 1235 additions and 1341 deletions
-1
View File
@@ -19,7 +19,6 @@ using Framework.Constants;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System.Collections.Generic;
namespace Scripts.Spells.DemonHunter
{
+1 -1
View File
@@ -732,7 +732,7 @@ namespace Scripts.Spells.Druid
if (player.IsInWater()) // Aquatic form
triggeredSpellId = SpellIds.FormAquatic;
else if (player.GetSkillValue(SkillType.Riding) >= 225 && CheckLocationForForm(SpellIds.FormFlight) == SpellCastResult.SpellCastOk) // Flight form
triggeredSpellId = player.getLevel() >= 71 ? SpellIds.FormSwiftFlight : SpellIds.FormFlight;
triggeredSpellId = player.GetLevel() >= 71 ? SpellIds.FormSwiftFlight : SpellIds.FormFlight;
else // Stag form (riding skill already checked in CheckCast)
triggeredSpellId = SpellIds.FormStag;
+3 -3
View File
@@ -2067,8 +2067,8 @@ namespace Scripts.Spells.Generic
if (newPet.LoadPetFromDB(player, 0, player.GetLastPetNumber(), true))
{
// revive the pet if it is dead
if (newPet.getDeathState() == DeathState.Dead)
newPet.setDeathState(DeathState.Alive);
if (newPet.GetDeathState() == DeathState.Dead)
newPet.SetDeathState(DeathState.Alive);
newPet.SetFullHealth();
newPet.SetFullPower(newPet.GetPowerType());
@@ -2897,7 +2897,7 @@ namespace Scripts.Spells.Generic
if (player)
{
// Reset player faction + allow combat + allow duels
player.setFactionForRace(player.GetRace());
player.SetFactionForRace(player.GetRace());
player.RemoveUnitFlag(UnitFlags.NonAttackable);
// save player
player.SaveToDB();
+2 -2
View File
@@ -569,7 +569,7 @@ namespace Scripts.Spells.Hunter
if (playerTarget)
{
int baseAmount = aurEff.GetBaseAmount();
int amount = playerTarget.isMoving() ?
int amount = playerTarget.IsMoving() ?
playerTarget.CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff.GetEffIndex(), baseAmount) :
aurEff.GetAmount() - 1;
aurEff.SetAmount(amount);
@@ -624,7 +624,7 @@ namespace Scripts.Spells.Hunter
Creature target = GetExplTargetUnit().ToCreature();
if (target)
{
if (target.getLevel() > caster.getLevel())
if (target.GetLevel() > caster.GetLevel())
return SpellCastResult.Highlevel;
// use SMSG_PET_TAME_FAILURE?
+4 -4
View File
@@ -626,7 +626,7 @@ namespace Scripts.Spells.Items
{
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
{
int diff = (int)GetUnitOwner().getLevel() - 60;
int diff = (int)GetUnitOwner().GetLevel() - 60;
if (diff > 0)
amount += 2 * diff;
}
@@ -1619,7 +1619,7 @@ namespace Scripts.Spells.Items
break;
}
if (caster.getLevel() > maxSafeLevel)
if (caster.GetLevel() > maxSafeLevel)
{
caster.CastSpell(caster, SpellIds.Lost, true);
@@ -1840,7 +1840,7 @@ namespace Scripts.Spells.Items
{
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
{
int diff = (int)GetUnitOwner().getLevel() - 60;
int diff = (int)GetUnitOwner().GetLevel() - 60;
if (diff > 0)
amount += diff;
}
@@ -2165,7 +2165,7 @@ namespace Scripts.Spells.Items
{
Creature target = GetHitCreature();
if (target)
target.setDeathState(DeathState.JustRespawned);
target.SetDeathState(DeathState.JustRespawned);
}
public override void Register()
+2 -2
View File
@@ -496,7 +496,7 @@ namespace Scripts.Spells.Paladin
if (!caster.IsValidAttackTarget(target))
return SpellCastResult.BadTargets;
if (!caster.isInFront(target))
if (!caster.IsInFront(target))
return SpellCastResult.NotInfront;
}
}
@@ -715,7 +715,7 @@ namespace Scripts.Spells.Paladin
Unit target = GetExplTargetUnit();
if (target)
{
if (!target.IsFriendlyTo(caster) || target.getAttackers().Empty())
if (!target.IsFriendlyTo(caster) || target.GetAttackers().Empty())
return SpellCastResult.BadTargets;
}
else
+3 -3
View File
@@ -350,7 +350,7 @@ namespace Scripts.Spells.Priest
if (aegis != null)
absorb += aegis.GetAmount();
absorb = (int)Math.Min(absorb, eventInfo.GetProcTarget().getLevel() * 125);
absorb = (int)Math.Min(absorb, eventInfo.GetProcTarget().GetLevel() * 125);
GetTarget().CastCustomSpell(SpellIds.DivineAegis, SpellValueMod.BasePoint0, absorb, eventInfo.GetProcTarget(), true, null, aurEff);
}
@@ -748,7 +748,7 @@ namespace Scripts.Spells.Priest
if (!caster.IsValidAttackTarget(target))
return SpellCastResult.BadTargets;
if (!caster.isInFront(target))
if (!caster.IsInFront(target))
return SpellCastResult.NotInfront;
}
else
@@ -757,7 +757,7 @@ namespace Scripts.Spells.Priest
if (!caster.HasAura(SpellIds.ThePenitentAura))
return SpellCastResult.BadTargets;
if (!caster.isInFront(target))
if (!caster.IsInFront(target))
return SpellCastResult.UnitNotInfront;
}
}
+1 -1
View File
@@ -195,7 +195,7 @@ namespace Scripts.Spells.Warlock
if (removeMode != AuraRemoveMode.Death || !IsExpired())
return;
if (GetCaster().ToPlayer().isHonorOrXPTarget(GetTarget()))
if (GetCaster().ToPlayer().IsHonorOrXPTarget(GetTarget()))
GetCaster().CastSpell(GetTarget(), SpellIds.BaneOfDoomEffect, true, null, aurEff);
}
+2 -2
View File
@@ -135,7 +135,7 @@ namespace Scripts.Spells.Warrior
for (uint i = 0; i < 5; ++i)
{
int timeOffset = (int)(6 * i * aurEff.GetPeriod() / 25);
Vector4 loc = GetTarget().moveSpline.ComputePosition(timeOffset);
Vector4 loc = GetTarget().MoveSpline.ComputePosition(timeOffset);
GetTarget().SendPlaySpellVisual(new Vector3(loc.X, loc.Y, loc.Z), 0.0f, Misc.SpellVisualBlazingCharge, 0, 0, 1.0f, true);
}
}
@@ -550,7 +550,7 @@ namespace Scripts.Spells.Warrior
bool CheckProc(ProcEventInfo eventInfo)
{
// check attack comes not from behind and warrior is not stunned
return GetTarget().isInFront(eventInfo.GetProcTarget(), MathFunctions.PI) && !GetTarget().HasUnitState(UnitState.Stunned);
return GetTarget().IsInFront(eventInfo.GetProcTarget(), MathFunctions.PI) && !GetTarget().HasUnitState(UnitState.Stunned);
}
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)