fix: Adds name support for all mods (#1128)

This commit is contained in:
Kamron Batman 2022-10-15 10:46:31 -07:00 • committed by GitHub
parent b1cf95f810
commit ffdc08259f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 404 additions and 343 deletions

View file

@ -24,7 +24,7 @@ public partial class DefaultSkillMod : SkillMod
{
}
public DefaultSkillMod(SkillName skill, bool relative, double value) : base(skill, relative, value)
public DefaultSkillMod(SkillName skill, string name, bool relative, double value) : base(skill, name, relative, value)
{
}

View file

@ -27,8 +27,8 @@ public partial class EquippedSkillMod : SkillMod
{
}
public EquippedSkillMod(SkillName skill, bool relative, double value, Item item, Mobile mobile)
: base(skill, relative, value, mobile) => _item = item;
public EquippedSkillMod(SkillName skill, string name, bool relative, double value, Item item, Mobile owner)
: base(skill, name, relative, value, owner) => _item = item;
public override bool CheckCondition() => !_item.Deleted && Owner?.Deleted == false && _item.Parent == Owner;
}

View file

@ -23,5 +23,14 @@ public partial class MobileMod
[DirtyTrackingEntity]
public Mobile Owner { get; set; }
[SerializableField(0)]
private string _name;
public MobileMod(Mobile owner) => Owner = owner;
public MobileMod(Mobile owner, string name)
{
Owner = owner;
Name = name;
}
}

View file

@ -24,7 +24,7 @@ public partial class ResistanceMod : MobileMod
{
}
public ResistanceMod(ResistanceType type, int offset, Mobile owner = null) : base(owner)
public ResistanceMod(ResistanceType type, string name, int offset, Mobile owner = null) : base(owner, name)
{
_type = type;
_offset = offset;

View file

@ -25,7 +25,7 @@ public abstract partial class SkillMod : MobileMod
{
}
public SkillMod(SkillName skill, bool relative, double value, Mobile owner = null) : base(owner)
public SkillMod(SkillName skill, string name, bool relative, double value, Mobile owner = null) : base(owner, name)
{
_skill = skill;
_relative = relative;

View file

@ -31,19 +31,15 @@ public partial class StatMod : MobileMod
private StatType _type;
[SerializableField(3, setter: "private")]
private string _name;
[SerializableField(4, setter: "private")]
private int _offset;
public StatMod(Mobile owner) : base(owner)
{
}
public StatMod(StatType type, string name, int offset, TimeSpan duration, Mobile owner = null) : base(owner)
public StatMod(StatType type, string name, int offset, TimeSpan duration, Mobile owner = null) : base(owner, name)
{
_type = type;
_name = name;
_offset = offset;
_duration = duration;
_added = Core.Now;

View file

@ -28,13 +28,13 @@ public partial class TimedSkillMod : SkillMod
{
}
public TimedSkillMod(SkillName skill, bool relative, double value, TimeSpan delay)
: this(skill, relative, value, Core.Now + delay)
public TimedSkillMod(SkillName skill, string name, bool relative, double value, TimeSpan delay)
: this(skill, name, relative, value, Core.Now + delay)
{
}
public TimedSkillMod(SkillName skill, bool relative, double value, DateTime expire)
: base(skill, relative, value) => _expire = expire;
public TimedSkillMod(SkillName skill, string name, bool relative, double value, DateTime expire)
: base(skill, name, relative, value) => _expire = expire;
public override bool CheckCondition() => Core.Now < _expire;
}