Core/Creatures: Update Scaling to 7.3.5
This commit is contained in:
@@ -1105,20 +1105,22 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
CreatureTemplate cInfo = GetCreatureTemplate();
|
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())
|
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.ScalingLevelMin, cInfo.levelScaling.Value.MinLevel);
|
||||||
SetUInt32Value(UnitFields.ScalingLevelMax, cInfo.levelScaling.Value.MaxLevel);
|
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();
|
UpdateLevelDependantStats();
|
||||||
@@ -2368,7 +2370,7 @@ namespace Game.Entities
|
|||||||
// between UNIT_FIELD_SCALING_LEVEL_MIN and UNIT_FIELD_SCALING_LEVEL_MAX
|
// between UNIT_FIELD_SCALING_LEVEL_MIN and UNIT_FIELD_SCALING_LEVEL_MAX
|
||||||
if (HasScalableLevels())
|
if (HasScalableLevels())
|
||||||
{
|
{
|
||||||
uint targetLevelWithDelta = (uint)(unitTarget.getLevel() + GetCreatureTemplate().levelScaling.Value.DeltaLevel);
|
uint targetLevelWithDelta = (uint)(unitTarget.getLevel() + GetInt32Value(UnitFields.ScalingLevelDelta));
|
||||||
|
|
||||||
if (target.IsPlayer())
|
if (target.IsPlayer())
|
||||||
targetLevelWithDelta += target.GetUInt32Value(PlayerFields.ScalingLevelDelta);
|
targetLevelWithDelta += target.GetUInt32Value(PlayerFields.ScalingLevelDelta);
|
||||||
|
|||||||
@@ -397,6 +397,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
public ushort MinLevel;
|
public ushort MinLevel;
|
||||||
public ushort MaxLevel;
|
public ushort MaxLevel;
|
||||||
public short DeltaLevel;
|
public short DeltaLevelMin;
|
||||||
|
public short DeltaLevelMax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2307,8 +2307,8 @@ namespace Game
|
|||||||
{
|
{
|
||||||
uint oldMSTime = Time.GetMSTime();
|
uint oldMSTime = Time.GetMSTime();
|
||||||
|
|
||||||
// 0 1 2 3
|
// 0 1 2 3 4
|
||||||
SQLResult result = DB.World.Query("SELECT Entry, LevelScalingMin, LevelScalingMax, LevelScalingDelta FROM creature_template_scaling");
|
SQLResult result = DB.World.Query("SELECT Entry, LevelScalingMin, LevelScalingMax, LevelScalingDeltaMin, LevelScalingDeltaMax FROM creature_template_scaling");
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
{
|
{
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creature template scaling definitions. DB table `creature_template_scaling` is empty.");
|
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 creatureLevelScaling;
|
||||||
creatureLevelScaling.MinLevel = result.Read<ushort>(1);
|
creatureLevelScaling.MinLevel = result.Read<ushort>(1);
|
||||||
creatureLevelScaling.MaxLevel = result.Read<ushort>(2);
|
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);
|
template.levelScaling.Set(creatureLevelScaling);
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
|||||||
@@ -1168,7 +1168,7 @@ namespace Game.Network.Packets
|
|||||||
Class = (byte)creatureTemplate.UnitClass;
|
Class = (byte)creatureTemplate.UnitClass;
|
||||||
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
|
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
|
||||||
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
|
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
|
||||||
TargetScalingLevelDelta = (sbyte)creatureTemplate.levelScaling.Value.DeltaLevel;
|
TargetScalingLevelDelta = (sbyte)attacker.GetInt32Value(UnitFields.ScalingLevelDelta);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1184,13 +1184,14 @@ namespace Game.Network.Packets
|
|||||||
Class = (byte)creatureTemplate.UnitClass;
|
Class = (byte)creatureTemplate.UnitClass;
|
||||||
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
|
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
|
||||||
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
|
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
|
||||||
TargetScalingLevelDelta = (sbyte)creatureTemplate.levelScaling.Value.DeltaLevel;
|
TargetScalingLevelDelta = (sbyte)target.GetInt32Value(UnitFields.ScalingLevelDelta);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GenerateDataCreatureToCreature(Creature attacker, Creature target)
|
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;
|
Type = SandboxScalingDataType.CreatureToCreatureDamage;
|
||||||
PlayerLevelDelta = 0;
|
PlayerLevelDelta = 0;
|
||||||
@@ -1200,7 +1201,7 @@ namespace Game.Network.Packets
|
|||||||
Class = (byte)creatureTemplate.UnitClass;
|
Class = (byte)creatureTemplate.UnitClass;
|
||||||
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
|
TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel;
|
||||||
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
|
TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel;
|
||||||
TargetScalingLevelDelta = (sbyte)creatureTemplate.levelScaling.Value.DeltaLevel;
|
TargetScalingLevelDelta = (sbyte)accessor.GetInt32Value(UnitFields.ScalingLevelDelta);
|
||||||
return true;
|
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`;
|
||||||
Reference in New Issue
Block a user