Core/Items: PvP item levels basic implementation
This commit is contained in:
@@ -65,6 +65,7 @@ namespace Game.Entities
|
||||
uint m_ArenaTeamIdInvited;
|
||||
long m_lastHonorUpdateTime;
|
||||
uint m_contestedPvPTimer;
|
||||
bool _usePvpItemLevels;
|
||||
|
||||
//Groups/Raids
|
||||
GroupReference m_group = new GroupReference();
|
||||
|
||||
@@ -6713,5 +6713,23 @@ namespace Game.Entities
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//Misc
|
||||
void UpdateItemLevelAreaBasedScaling()
|
||||
{
|
||||
// @todo Activate pvp item levels during world pvp
|
||||
Map map = GetMap();
|
||||
bool pvpActivity = map.IsBattlegroundOrArena() || ((int)map.GetEntry().Flags[1]).HasAnyFlag(0x40) || HasPvpRulesEnabled();
|
||||
|
||||
if (_usePvpItemLevels != pvpActivity)
|
||||
{
|
||||
float healthPct = GetHealthPct();
|
||||
_RemoveAllItemMods();
|
||||
ActivatePvpItemLevels(pvpActivity);
|
||||
_ApplyAllItemMods();
|
||||
SetHealth(MathFunctions.CalculatePct(GetMaxHealth(), healthPct));
|
||||
}
|
||||
// @todo other types of power scaling such as timewalking
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,6 +334,9 @@ namespace Game.Entities
|
||||
public uint GetHonorLevel() { return GetUInt32Value(PlayerFields.HonorLevel); }
|
||||
public bool IsMaxHonorLevelAndPrestige() { return IsMaxPrestige() && GetHonorLevel() == PlayerConst.MaxHonorLevel; }
|
||||
|
||||
public void ActivatePvpItemLevels(bool activate) { _usePvpItemLevels = activate; }
|
||||
public bool IsUsingPvpItemLevels() { return _usePvpItemLevels; }
|
||||
|
||||
void ResetPvpTalents()
|
||||
{
|
||||
foreach (var talentInfo in CliDB.PvpTalentStorage.Values)
|
||||
@@ -489,6 +492,8 @@ namespace Game.Entities
|
||||
aura.SetDuration(-1);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateItemLevelAreaBasedScaling();
|
||||
}
|
||||
|
||||
void DisablePvpRules()
|
||||
@@ -498,7 +503,10 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
if (GetCombatTimer() == 0)
|
||||
{
|
||||
RemoveAurasDueToSpell(PlayerConst.SpellPvpRulesEnabled);
|
||||
UpdateItemLevelAreaBasedScaling();
|
||||
}
|
||||
else
|
||||
{
|
||||
Aura aura = GetAura(PlayerConst.SpellPvpRulesEnabled);
|
||||
|
||||
@@ -651,7 +651,7 @@ namespace Game.Entities
|
||||
if (pEnchant.ScalingClass != 0)
|
||||
{
|
||||
int scalingClass = pEnchant.ScalingClass;
|
||||
if ((GetUInt32Value(UnitFields.MinItemLevel) != 0 || GetUInt32Value(UnitFields.Maxitemlevel) != 0) && pEnchant.ScalingClassRestricted != 0)
|
||||
if ((GetUInt32Value(UnitFields.MinItemLevel) != 0 || GetUInt32Value(UnitFields.MaxItemlevel) != 0) && pEnchant.ScalingClassRestricted != 0)
|
||||
scalingClass = pEnchant.ScalingClassRestricted;
|
||||
|
||||
uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u;
|
||||
@@ -691,7 +691,7 @@ namespace Game.Entities
|
||||
if (pEnchant.ScalingClass != 0)
|
||||
{
|
||||
int scalingClass = pEnchant.ScalingClass;
|
||||
if ((GetUInt32Value(UnitFields.MinItemLevel) != 0 || GetUInt32Value(UnitFields.Maxitemlevel) != 0) && pEnchant.ScalingClassRestricted != 0)
|
||||
if ((GetUInt32Value(UnitFields.MinItemLevel) != 0 || GetUInt32Value(UnitFields.MaxItemlevel) != 0) && pEnchant.ScalingClassRestricted != 0)
|
||||
scalingClass = pEnchant.ScalingClassRestricted;
|
||||
|
||||
uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u;
|
||||
|
||||
@@ -5702,6 +5702,8 @@ namespace Game.Entities
|
||||
|
||||
if (_garrison != null)
|
||||
_garrison.SendRemoteInfo();
|
||||
|
||||
UpdateItemLevelAreaBasedScaling();
|
||||
}
|
||||
|
||||
public bool CanSpeak()
|
||||
|
||||
Reference in New Issue
Block a user