Code cleanup (#195)

This commit is contained in:
Kamron Batman 2020-08-16 21:46:54 -07:00 • committed by GitHub
parent b476bcfd24
commit 0926b5abaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 740 additions and 1635 deletions

View file

@ -606,12 +606,7 @@ namespace Server.Multis
return;
}
newName = newName.Trim();
if (newName.Length == 0)
newName = null;
Rename(newName);
Rename(newName.Trim().IsNullOrDefault(null));
}
public DryDockResult CheckDryDock(Mobile from)
@ -723,14 +718,7 @@ namespace Server.Multis
}
if (e.Speech.Length > 8)
{
string newName = e.Speech.Substring(8).Trim();
if (newName.Length == 0)
newName = null;
Rename(newName);
}
Rename(e.Speech.Substring(8).Trim().IsNullOrDefault(null));
}
public void Rename(string newName)
@ -1234,8 +1222,8 @@ namespace Server.Multis
int x = item.X - p.X + newComponents.Min.X;
int y = item.Y - p.Y + newComponents.Min.Y;
return (x >= 0 && x < newComponents.Width && y >= 0 && y < newComponents.Height &&
newComponents.Tiles[x][y].Length == 0) || Contains(item);
return x >= 0 && x < newComponents.Width && y >= 0 && y < newComponents.Height &&
newComponents.Tiles[x][y].Length == 0 || Contains(item);
});
eable.Free();

View file

@ -22,9 +22,6 @@ namespace Server.Multis
public override void AddComponents()
{
BaseCreature bc;
// BaseEscortable be;
Visible = false;
DecayDelay = TimeSpan.FromMinutes(5.0);
@ -55,18 +52,15 @@ namespace Server.Multis
for (int i = 0; i < 4; i++) AddMobile(Brigands, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
m_Prisoner = Utility.Random(2) switch
BaseCreature bc = Utility.Random(2) switch
{
0 => (Mobile)new Noble(),
0 => new Noble(),
_ => new SeekerOfAdventure()
};
// be = (BaseEscortable)m_Prisoner;
// be.m_Captive = true;
bc = (BaseCreature)m_Prisoner;
bc.IsPrisoner = true;
bc.CantWalk = true;
m_Prisoner = bc;
m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);
AddMobile(m_Prisoner, 2, Utility.RandomMinMax(-2, 2), Utility.RandomMinMax(-2, 2), 0);
@ -74,9 +68,9 @@ namespace Server.Multis
private void AddCampChests()
{
var chest = Utility.Random(3) switch
LockableContainer chest = Utility.Random(3) switch
{
0 => (LockableContainer)new MetalChest(),
0 => new MetalChest(),
1 => new MetalGoldenChest(),
_ => new WoodenChest()
};
@ -87,9 +81,9 @@ namespace Server.Multis
AddItem(chest, -2, -2, 0);
var crates = Utility.Random(4) switch
LockableContainer crates = Utility.Random(4) switch
{
0 => (LockableContainer)new SmallCrate(),
0 => new SmallCrate(),
1 => new MediumCrate(),
2 => new LargeCrate(),
_ => new LockableBarrel()
@ -110,22 +104,16 @@ namespace Server.Multis
crates.LiftOverride = true;
if (Utility.RandomDouble() < 0.8)
switch (Utility.Random(4))
crates.DropItem(
Utility.Random(5) switch
{
case 0:
crates.DropItem(new LesserCurePotion());
break;
case 1:
crates.DropItem(new LesserExplosionPotion());
break;
case 2:
crates.DropItem(new LesserHealPotion());
break;
default:
crates.DropItem(new LesserPoisonPotion());
break;
0 => new LesserCurePotion(),
1 => new LesserExplosionPotion(),
2 => new LesserHealPotion(),
3 => new LesserPoisonPotion(),
_ => null // 4
}
);
AddItem(crates, 2, 2, 0);
}
@ -189,4 +177,4 @@ namespace Server.Multis
}
}
}
}
}

View file

@ -90,7 +90,7 @@ namespace Server.Items
{
Target = reader.ReadItem();
if (version < 0)
if (version < 1)
Level = SecureLevel.Anyone;
break;