Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -47,7 +47,7 @@ namespace Server.Items
|
|||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if (pack != null && pack.ConsumeTotal(typeof(Gold), 250))
|
||||
if (pack?.ConsumeTotal(typeof(Gold), 250) == true)
|
||||
{
|
||||
m_GamblePot += 150;
|
||||
InvalidateProperties();
|
||||
|
|
@ -74,7 +74,7 @@ namespace Server.Items
|
|||
else if (roll <= 20) // Chance for a regbag
|
||||
{
|
||||
from.SendMessage(0x35, "You win a bag of reagents!");
|
||||
from.AddToBackpack(new BagOfReagents(50));
|
||||
from.AddToBackpack(new BagOfReagents());
|
||||
}
|
||||
else if (roll <= 40) // Chance for gold
|
||||
{
|
||||
|
|
@ -123,4 +123,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
BagOfingots ingotBag = new BagOfingots(5000);
|
||||
BagOfingots ingotBag = new BagOfingots();
|
||||
|
||||
if (!from.AddToBackpack(ingotBag))
|
||||
ingotBag.Delete();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
BagOfReagents regBag = new BagOfReagents(50);
|
||||
BagOfReagents regBag = new BagOfReagents();
|
||||
|
||||
if (!from.AddToBackpack(regBag))
|
||||
regBag.Delete();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
SmithBag SmithBag = new SmithBag(5000);
|
||||
SmithBag SmithBag = new SmithBag();
|
||||
|
||||
if (!from.AddToBackpack(SmithBag))
|
||||
SmithBag.Delete();
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AlchemyBag : Bag
|
||||
{
|
||||
[Constructible]
|
||||
public AlchemyBag() : this(1)
|
||||
public AlchemyBag(int amount = 5000)
|
||||
{
|
||||
Movable = true;
|
||||
Hue = 0x250;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public AlchemyBag(int amount)
|
||||
{
|
||||
DropItem(new MortarPestle(5));
|
||||
DropItem(new MortarPestle(Math.Max(amount / 1000, 1)));
|
||||
DropItem(new BagOfReagents(5000));
|
||||
DropItem(new Bottle(5000));
|
||||
}
|
||||
|
|
@ -37,4 +33,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@ namespace Server.Items
|
|||
public class BagOfingots : Bag
|
||||
{
|
||||
[Constructible]
|
||||
public BagOfingots() : this(5000)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public BagOfingots(int amount)
|
||||
public BagOfingots(int amount = 5000)
|
||||
{
|
||||
DropItem(new DullCopperIngot(amount));
|
||||
DropItem(new ShadowIronIngot(amount));
|
||||
|
|
@ -31,7 +26,7 @@ namespace Server.Items
|
|||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
|
|
@ -41,4 +36,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,17 +3,11 @@ namespace Server.Items
|
|||
public class ScribeBag : Bag
|
||||
{
|
||||
[Constructible]
|
||||
public ScribeBag() : this(1)
|
||||
public ScribeBag(int amount = 5000)
|
||||
{
|
||||
Movable = true;
|
||||
Hue = 0x105;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ScribeBag(int amount)
|
||||
{
|
||||
DropItem(new BagOfReagents(5000));
|
||||
DropItem(new BlankScroll(500));
|
||||
DropItem(new BagOfReagents(amount));
|
||||
DropItem(new BlankScroll(amount));
|
||||
}
|
||||
|
||||
public ScribeBag(Serial serial) : base(serial)
|
||||
|
|
@ -36,4 +30,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@ namespace Server.Items
|
|||
public class SmithBag : Bag
|
||||
{
|
||||
[Constructible]
|
||||
public SmithBag() : this(5000)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SmithBag(int amount)
|
||||
public SmithBag(int amount = 5000)
|
||||
{
|
||||
DropItem(new DullCopperIngot(amount));
|
||||
DropItem(new ShadowIronIngot(amount));
|
||||
|
|
@ -31,7 +26,7 @@ namespace Server.Items
|
|||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
|
|
@ -41,4 +36,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,17 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TailorBag : Bag
|
||||
{
|
||||
[Constructible]
|
||||
public TailorBag() : this(1)
|
||||
public TailorBag(int amount = 500)
|
||||
{
|
||||
Movable = true;
|
||||
Hue = 0x315;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public TailorBag(int amount)
|
||||
{
|
||||
DropItem(new SewingKit(5));
|
||||
DropItem(new SewingKit(Math.Max(amount / 100, 1)));
|
||||
DropItem(new Scissors());
|
||||
DropItem(new Hides(500));
|
||||
DropItem(new BoltOfCloth(20));
|
||||
DropItem(new Hides(amount));
|
||||
DropItem(new BoltOfCloth(Math.Max(amount / 25, 1)));
|
||||
DropItem(new DyeTub());
|
||||
DropItem(new DyeTub());
|
||||
DropItem(new BlackDyeTub());
|
||||
|
|
@ -42,4 +38,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue