Code cleanup (#195)
This commit is contained in:
parent
b476bcfd24
commit
0926b5abaa
86 changed files with 740 additions and 1635 deletions
|
|
@ -606,12 +606,7 @@ namespace Server.Items
|
|||
get => m_Quantity;
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
value = 0;
|
||||
else if (value > MaxQuantity)
|
||||
value = MaxQuantity;
|
||||
|
||||
m_Quantity = value;
|
||||
m_Quantity = Math.Clamp(value, 0, MaxQuantity);
|
||||
|
||||
InvalidateProperties();
|
||||
|
||||
|
|
@ -854,10 +849,7 @@ namespace Server.Items
|
|||
_ => 0
|
||||
};
|
||||
|
||||
from.BAC += bac;
|
||||
|
||||
if (from.BAC > 60)
|
||||
from.BAC = 60;
|
||||
from.BAC = Math.Min(from.BAC + bac, 60);
|
||||
|
||||
CheckHeaveTimer(from);
|
||||
}
|
||||
|
|
@ -1053,7 +1045,6 @@ namespace Server.Items
|
|||
|
||||
public static void CheckHeaveTimer(Mobile from)
|
||||
{
|
||||
Timer t;
|
||||
if (from.BAC > 0 && from.Map != Map.Internal && !from.Deleted)
|
||||
{
|
||||
if (m_Table.ContainsKey(from))
|
||||
|
|
@ -1062,12 +1053,12 @@ namespace Server.Items
|
|||
if (from.BAC > 60)
|
||||
from.BAC = 60;
|
||||
|
||||
t = new HeaveTimer(from);
|
||||
Timer t = new HeaveTimer(from);
|
||||
t.Start();
|
||||
|
||||
m_Table[from] = t;
|
||||
}
|
||||
else if (m_Table.TryGetValue(from, out t))
|
||||
else if (m_Table.TryGetValue(from, out var t))
|
||||
{
|
||||
t.Stop();
|
||||
m_Table.Remove(from);
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ namespace Server.Items
|
|||
{
|
||||
Delete();
|
||||
|
||||
var i = Utility.Random(from.BAC >= 5 ? 6 : 5) switch
|
||||
Item i = Utility.Random(from.BAC >= 5 ? 6 : 5) switch
|
||||
{
|
||||
0 => (Item)new OrigamiButterfly(),
|
||||
0 => new OrigamiButterfly(),
|
||||
1 => new OrigamiSwan(),
|
||||
2 => new OrigamiFrog(),
|
||||
3 => new OrigamiShape(),
|
||||
|
|
|
|||
|
|
@ -565,10 +565,7 @@ namespace Server.Items
|
|||
AddHtml(255, 180, 150, 20, message.Time.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
Mobile poster = message.Poster;
|
||||
string name = poster?.Name;
|
||||
|
||||
if (name == null || (name = name.Trim()).Length == 0)
|
||||
name = "Someone";
|
||||
string name = poster?.Name?.Trim().IsNullOrDefault("Someone");
|
||||
|
||||
AddHtml(255, 200, 150, 20, name);
|
||||
|
||||
|
|
|
|||
|
|
@ -168,13 +168,7 @@ namespace Server.Items
|
|||
{
|
||||
HouseSign sign = m_House.Sign;
|
||||
|
||||
if (sign != null)
|
||||
m_Description = sign.Name;
|
||||
else
|
||||
m_Description = null;
|
||||
|
||||
if (m_Description == null || (m_Description = m_Description.Trim()).Length == 0)
|
||||
m_Description = "an unnamed house";
|
||||
m_Description = sign?.Name?.Trim().IsNullOrDefault("an unnamed house");
|
||||
|
||||
setDesc = true;
|
||||
|
||||
|
|
@ -233,10 +227,7 @@ namespace Server.Items
|
|||
{
|
||||
if (m_Marked)
|
||||
{
|
||||
string desc;
|
||||
|
||||
if ((desc = m_Description) == null || (desc = desc.Trim()).Length == 0)
|
||||
desc = "an unknown location";
|
||||
string desc = m_Description?.Trim().IsNullOrDefault("an unknown location");
|
||||
|
||||
if (m_TargetMap == Map.Tokuno)
|
||||
LabelTo(from, House != null ? 1063260 : 1063259,
|
||||
|
|
|
|||
|
|
@ -23,13 +23,7 @@ namespace Server.Items
|
|||
public int Fruits
|
||||
{
|
||||
get => m_Fruits;
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
m_Fruits = 0;
|
||||
else
|
||||
m_Fruits = value;
|
||||
}
|
||||
set => m_Fruits = Math.Max(value, 0);
|
||||
}
|
||||
|
||||
public override void OnComponentUsed(AddonComponent c, Mobile from)
|
||||
|
|
@ -209,4 +203,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue