Core/Creatures: Update Scaling to 7.3.5

This commit is contained in:
hondacrx
2018-04-12 18:25:19 -04:00
parent 70fb5c6fd8
commit 7015f1efba
5 changed files with 29 additions and 19 deletions
+13 -11
View File
@@ -1105,20 +1105,22 @@ namespace Game.Entities
{
CreatureTemplate cInfo = GetCreatureTemplate();
// level
byte minlevel = (byte)Math.Min(cInfo.Maxlevel, cInfo.Minlevel);
byte maxlevel = (byte)Math.Max(cInfo.Maxlevel, cInfo.Minlevel);
byte level = (byte)(minlevel == maxlevel ? minlevel : RandomHelper.URand(minlevel, maxlevel));
SetLevel(level);
if (!HasScalableLevels())
{
// level
byte minlevel = (byte)Math.Min(cInfo.Maxlevel, cInfo.Minlevel);
byte maxlevel = (byte)Math.Max(cInfo.Maxlevel, cInfo.Minlevel);
byte level = (byte)(minlevel == maxlevel ? minlevel : RandomHelper.URand(minlevel, maxlevel));
SetLevel(level);
}
else
{
SetLevel(cInfo.levelScaling.Value.MaxLevel);
SetUInt32Value(UnitFields.ScalingLevelMin, cInfo.levelScaling.Value.MinLevel);
SetUInt32Value(UnitFields.ScalingLevelMax, cInfo.levelScaling.Value.MaxLevel);
SetUInt32Value(UnitFields.ScalingLevelDelta, (uint)cInfo.levelScaling.Value.DeltaLevel);
int mindelta = Math.Min(cInfo.levelScaling.Value.DeltaLevelMax, cInfo.levelScaling.Value.DeltaLevelMin);
int maxdelta = Math.Max(cInfo.levelScaling.Value.DeltaLevelMax, cInfo.levelScaling.Value.DeltaLevelMin);
int delta = mindelta == maxdelta ? mindelta : RandomHelper.IRand(mindelta, maxdelta);
SetInt32Value(UnitFields.ScalingLevelDelta, delta);
}
UpdateLevelDependantStats();
@@ -2368,7 +2370,7 @@ namespace Game.Entities
// between UNIT_FIELD_SCALING_LEVEL_MIN and UNIT_FIELD_SCALING_LEVEL_MAX
if (HasScalableLevels())
{
uint targetLevelWithDelta = (uint)(unitTarget.getLevel() + GetCreatureTemplate().levelScaling.Value.DeltaLevel);
uint targetLevelWithDelta = (uint)(unitTarget.getLevel() + GetInt32Value(UnitFields.ScalingLevelDelta));
if (target.IsPlayer())
targetLevelWithDelta += target.GetUInt32Value(PlayerFields.ScalingLevelDelta);
@@ -397,6 +397,7 @@ namespace Game.Entities
{
public ushort MinLevel;
public ushort MaxLevel;
public short DeltaLevel;
public short DeltaLevelMin;
public short DeltaLevelMax;
}
}
+4 -3
View File
@@ -2307,8 +2307,8 @@ namespace Game
{
uint oldMSTime = Time.GetMSTime();
// 0 1 2 3
SQLResult result = DB.World.Query("SELECT Entry, LevelScalingMin, LevelScalingMax, LevelScalingDelta FROM creature_template_scaling");
// 0 1 2 3 4
SQLResult result = DB.World.Query("SELECT Entry, LevelScalingMin, LevelScalingMax, LevelScalingDeltaMin, LevelScalingDeltaMax FROM creature_template_scaling");
if (result.IsEmpty())
{
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creature template scaling definitions. DB table `creature_template_scaling` is empty.");
@@ -2330,7 +2330,8 @@ namespace Game
CreatureLevelScaling creatureLevelScaling;
creatureLevelScaling.MinLevel = result.Read<ushort>(1);
creatureLevelScaling.MaxLevel = result.Read<ushort>(2);
creatureLevelScaling.DeltaLevel = result.Read<short>(3);
creatureLevelScaling.DeltaLevelMin = result.Read<short>(3);
creatureLevelScaling.DeltaLevelMax = result.Read<short>(3);
template.levelScaling.Set(creatureLevelScaling);
++count;
+5 -4
View File
@@ -1168,7 +1168,7 @@ namespace Game.Network.Packets
Class = (byte)creatureTemplate.UnitClass;
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
TargetScalingLevelDelta = (sbyte)creatureTemplate.levelScaling.Value.DeltaLevel;
TargetScalingLevelDelta = (sbyte)attacker.GetInt32Value(UnitFields.ScalingLevelDelta);
return true;
}
@@ -1184,13 +1184,14 @@ namespace Game.Network.Packets
Class = (byte)creatureTemplate.UnitClass;
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
TargetScalingLevelDelta = (sbyte)creatureTemplate.levelScaling.Value.DeltaLevel;
TargetScalingLevelDelta = (sbyte)target.GetInt32Value(UnitFields.ScalingLevelDelta);
return true;
}
bool GenerateDataCreatureToCreature(Creature attacker, Creature target)
{
CreatureTemplate creatureTemplate = target.HasScalableLevels() ? target.GetCreatureTemplate() : attacker.GetCreatureTemplate();
Creature accessor = target.HasScalableLevels() ? target : attacker;
CreatureTemplate creatureTemplate = accessor.GetCreatureTemplate();
Type = SandboxScalingDataType.CreatureToCreatureDamage;
PlayerLevelDelta = 0;
@@ -1200,7 +1201,7 @@ namespace Game.Network.Packets
Class = (byte)creatureTemplate.UnitClass;
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
TargetScalingLevelDelta = (sbyte)creatureTemplate.levelScaling.Value.DeltaLevel;
TargetScalingLevelDelta = (sbyte)accessor.GetInt32Value(UnitFields.ScalingLevelDelta);
return true;
}
@@ -0,0 +1,5 @@
ALTER TABLE `creature_template_scaling`
CHANGE `LevelScalingDelta` `LevelScalingDeltaMin` smallint(5) NOT NULL DEFAULT '0' AFTER `LevelScalingMax`,
ADD `LevelScalingDeltaMax` smallint(5) NOT NULL DEFAULT '0' AFTER `LevelScalingDeltaMin`;
UPDATE `creature_template_scaling` SET `LevelScalingDeltaMax`=`LevelScalingDeltaMin`;