fix: Codegens special systems (#1537)

This commit is contained in:
Kamron Batman 2023-10-09 22:06:09 -07:00 committed by GitHub
parent e1f22d9694
commit 0086d674e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 366 additions and 537 deletions

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.AlchemyBag"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.AlchemyStone"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.BagOfingots"
}

View file

@ -0,0 +1,14 @@
{
"version": 0,
"type": "Server.Items.GamblingStone",
"properties": [
{
"name": "GamblePot",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.IngotStone"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.RegStone"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.ResGate"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.ScribeBag"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.ScribeStone"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.SmithBag"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.SmithStone"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.TailorBag"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.TailorStone"
}

View file

@ -1,53 +1,36 @@
using ModernUO.Serialization;
using Server.Gumps;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class ResGate : Item
{
public class ResGate : Item
[Constructible]
public ResGate() : base(0xF6C)
{
[Constructible]
public ResGate() : base(0xF6C)
Movable = false;
Hue = 0x2D1;
Light = LightType.Circle300;
}
public override string DefaultName => "a resurrection gate";
public override bool OnMoveOver(Mobile m)
{
if (!m.Alive && m.Map?.CanFit(m.Location, 16, false, false) == true)
{
Movable = false;
Hue = 0x2D1;
Light = LightType.Circle300;
m.PlaySound(0x214);
m.FixedEffect(0x376A, 10, 16);
m.CloseGump<ResurrectGump>();
m.SendGump(new ResurrectGump(m));
}
else
{
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}
public ResGate(Serial serial) : base(serial)
{
}
public override string DefaultName => "a resurrection gate";
public override bool OnMoveOver(Mobile m)
{
if (!m.Alive && m.Map?.CanFit(m.Location, 16, false, false) == true)
{
m.PlaySound(0x214);
m.FixedEffect(0x376A, 10, 16);
m.CloseGump<ResurrectGump>();
m.SendGump(new ResurrectGump(m));
}
else
{
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}
return false;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
return false;
}
}

View file

@ -1,42 +1,26 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class AlchemyStone : Item
{
public class AlchemyStone : Item
[Constructible]
public AlchemyStone() : base(0xED4)
{
[Constructible]
public AlchemyStone() : base(0xED4)
Movable = false;
Hue = 0x250;
}
public override string DefaultName => "an Alchemist Supply Stone";
public override void OnDoubleClick(Mobile from)
{
var alcBag = new AlchemyBag();
if (!from.AddToBackpack(alcBag))
{
Movable = false;
Hue = 0x250;
}
public AlchemyStone(Serial serial) : base(serial)
{
}
public override string DefaultName => "an Alchemist Supply Stone";
public override void OnDoubleClick(Mobile from)
{
var alcBag = new AlchemyBag();
if (!from.AddToBackpack(alcBag))
{
alcBag.Delete();
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
alcBag.Delete();
}
}
}

View file

@ -1,126 +1,88 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class GamblingStone : Item
{
public class GamblingStone : Item
[InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _gamblePot = 2500;
[Constructible]
public GamblingStone() : base(0xED4)
{
private int m_GamblePot = 2500;
Movable = false;
Hue = 0x56;
}
[Constructible]
public GamblingStone()
: base(0xED4)
{
Movable = false;
Hue = 0x56;
}
public override string DefaultName => "a gambling stone";
public GamblingStone(Serial serial)
: base(serial)
{
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
[CommandProperty(AccessLevel.GameMaster)]
public int GamblePot
list.Add($"Jackpot: {_gamblePot}gp");
}
public override void OnSingleClick(Mobile from)
{
base.OnSingleClick(from);
LabelTo(from, $"Jackpot: {_gamblePot}gp");
}
public override void OnDoubleClick(Mobile from)
{
var pack = from.Backpack;
if (pack?.ConsumeTotal(typeof(Gold), 250) == true)
{
get => m_GamblePot;
set
_gamblePot += 150;
InvalidateProperties();
var roll = Utility.Random(1200);
if (roll == 0) // Jackpot
{
m_GamblePot = value;
InvalidateProperties();
const int maxCheck = 1000000;
from.SendMessage(0x35, $"You win the {_gamblePot}gp jackpot!");
while (_gamblePot > maxCheck)
{
from.AddToBackpack(new BankCheck(maxCheck));
_gamblePot -= maxCheck;
}
from.AddToBackpack(new BankCheck(_gamblePot));
_gamblePot = 2500;
}
else if (roll <= 20) // Chance for a regbag
{
from.SendMessage(0x35, "You win a bag of reagents!");
from.AddToBackpack(new BagOfReagents());
}
else if (roll <= 40) // Chance for gold
{
from.SendMessage(0x35, "You win 1500gp!");
from.AddToBackpack(new BankCheck(1500));
}
else if (roll <= 100) // Another chance for gold
{
from.SendMessage(0x35, "You win 1000gp!");
from.AddToBackpack(new BankCheck(1000));
}
else // Loser!
{
from.SendMessage(0x22, "You lose!");
}
}
public override string DefaultName => "a gambling stone";
public override void GetProperties(IPropertyList list)
else
{
base.GetProperties(list);
list.Add($"Jackpot: {m_GamblePot}gp");
}
public override void OnSingleClick(Mobile from)
{
base.OnSingleClick(from);
LabelTo(from, $"Jackpot: {m_GamblePot}gp");
}
public override void OnDoubleClick(Mobile from)
{
var pack = from.Backpack;
if (pack?.ConsumeTotal(typeof(Gold), 250) == true)
{
m_GamblePot += 150;
InvalidateProperties();
var roll = Utility.Random(1200);
if (roll == 0) // Jackpot
{
var maxCheck = 1000000;
from.SendMessage(0x35, $"You win the {m_GamblePot}gp jackpot!");
while (m_GamblePot > maxCheck)
{
from.AddToBackpack(new BankCheck(maxCheck));
m_GamblePot -= maxCheck;
}
from.AddToBackpack(new BankCheck(m_GamblePot));
m_GamblePot = 2500;
}
else if (roll <= 20) // Chance for a regbag
{
from.SendMessage(0x35, "You win a bag of reagents!");
from.AddToBackpack(new BagOfReagents());
}
else if (roll <= 40) // Chance for gold
{
from.SendMessage(0x35, "You win 1500gp!");
from.AddToBackpack(new BankCheck(1500));
}
else if (roll <= 100) // Another chance for gold
{
from.SendMessage(0x35, "You win 1000gp!");
from.AddToBackpack(new BankCheck(1000));
}
else // Loser!
{
from.SendMessage(0x22, "You lose!");
}
}
else
{
from.SendMessage(0x22, "You need at least 250gp in your backpack to use this.");
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_GamblePot);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_GamblePot = reader.ReadInt();
break;
}
}
from.SendMessage(0x22, $"You need at least 250gp in your backpack to use this.");
}
}
}

View file

@ -1,42 +1,26 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class IngotStone : Item
{
public class IngotStone : Item
[Constructible]
public IngotStone() : base(0xED4)
{
[Constructible]
public IngotStone() : base(0xED4)
Movable = false;
Hue = 0x480;
}
public override string DefaultName => "an Ingot stone";
public override void OnDoubleClick(Mobile from)
{
var ingotBag = new BagOfingots();
if (!from.AddToBackpack(ingotBag))
{
Movable = false;
Hue = 0x480;
}
public IngotStone(Serial serial) : base(serial)
{
}
public override string DefaultName => "an Ingot stone";
public override void OnDoubleClick(Mobile from)
{
var ingotBag = new BagOfingots();
if (!from.AddToBackpack(ingotBag))
{
ingotBag.Delete();
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
ingotBag.Delete();
}
}
}

View file

@ -1,42 +1,26 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class RegStone : Item
{
public class RegStone : Item
[Constructible]
public RegStone() : base(0xED4)
{
[Constructible]
public RegStone() : base(0xED4)
Movable = false;
Hue = 0x2D1;
}
public override string DefaultName => "a reagent stone";
public override void OnDoubleClick(Mobile from)
{
var regBag = new BagOfReagents();
if (!from.AddToBackpack(regBag))
{
Movable = false;
Hue = 0x2D1;
}
public RegStone(Serial serial) : base(serial)
{
}
public override string DefaultName => "a reagent stone";
public override void OnDoubleClick(Mobile from)
{
var regBag = new BagOfReagents();
if (!from.AddToBackpack(regBag))
{
regBag.Delete();
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
regBag.Delete();
}
}
}

View file

@ -1,42 +1,26 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class ScribeStone : Item
{
public class ScribeStone : Item
[Constructible]
public ScribeStone() : base(0xED4)
{
[Constructible]
public ScribeStone() : base(0xED4)
Movable = false;
Hue = 0x105;
}
public override string DefaultName => "a Scribe Supply Stone";
public override void OnDoubleClick(Mobile from)
{
var scribeBag = new ScribeBag();
if (!from.AddToBackpack(scribeBag))
{
Movable = false;
Hue = 0x105;
}
public ScribeStone(Serial serial) : base(serial)
{
}
public override string DefaultName => "a Scribe Supply Stone";
public override void OnDoubleClick(Mobile from)
{
var scribeBag = new ScribeBag();
if (!from.AddToBackpack(scribeBag))
{
scribeBag.Delete();
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
scribeBag.Delete();
}
}
}

View file

@ -1,42 +1,26 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class SmithStone : Item
{
public class SmithStone : Item
[Constructible]
public SmithStone() : base(0xED4)
{
[Constructible]
public SmithStone() : base(0xED4)
Movable = false;
Hue = 0x476;
}
public override string DefaultName => "a Blacksmith Supply Stone";
public override void OnDoubleClick(Mobile from)
{
var SmithBag = new SmithBag();
if (!from.AddToBackpack(SmithBag))
{
Movable = false;
Hue = 0x476;
}
public SmithStone(Serial serial) : base(serial)
{
}
public override string DefaultName => "a Blacksmith Supply Stone";
public override void OnDoubleClick(Mobile from)
{
var SmithBag = new SmithBag();
if (!from.AddToBackpack(SmithBag))
{
SmithBag.Delete();
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
SmithBag.Delete();
}
}
}

View file

@ -1,42 +1,26 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class TailorStone : Item
{
public class TailorStone : Item
[Constructible]
public TailorStone() : base(0xED4)
{
[Constructible]
public TailorStone() : base(0xED4)
Movable = false;
Hue = 0x315;
}
public override string DefaultName => "a Tailor Supply Stone";
public override void OnDoubleClick(Mobile from)
{
var tailorBag = new TailorBag();
if (!from.AddToBackpack(tailorBag))
{
Movable = false;
Hue = 0x315;
}
public TailorStone(Serial serial) : base(serial)
{
}
public override string DefaultName => "a Tailor Supply Stone";
public override void OnDoubleClick(Mobile from)
{
var tailorBag = new TailorBag();
if (!from.AddToBackpack(tailorBag))
{
tailorBag.Delete();
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
tailorBag.Delete();
}
}
}

View file

@ -1,36 +1,19 @@
using System;
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class AlchemyBag : Bag
{
public class AlchemyBag : Bag
[Constructible]
public AlchemyBag(int amount = 5000)
{
[Constructible]
public AlchemyBag(int amount = 5000)
{
Hue = 0x250;
DropItem(new MortarPestle(Math.Max(amount / 1000, 1)));
DropItem(new BagOfReagents(5000));
DropItem(new Bottle(5000));
}
public AlchemyBag(Serial serial) : base(serial)
{
}
public override string DefaultName => "an Alchemy Kit";
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
Hue = 0x250;
DropItem(new MortarPestle(Math.Max(amount / 1000, 1)));
DropItem(new BagOfReagents(5000));
DropItem(new Bottle(5000));
}
public override string DefaultName => "an Alchemy Kit";
}

View file

@ -1,39 +1,23 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class BagOfingots : Bag
{
public class BagOfingots : Bag
[Constructible]
public BagOfingots(int amount = 5000)
{
[Constructible]
public BagOfingots(int amount = 5000)
{
DropItem(new DullCopperIngot(amount));
DropItem(new ShadowIronIngot(amount));
DropItem(new CopperIngot(amount));
DropItem(new BronzeIngot(amount));
DropItem(new GoldIngot(amount));
DropItem(new AgapiteIngot(amount));
DropItem(new VeriteIngot(amount));
DropItem(new ValoriteIngot(amount));
DropItem(new IronIngot(amount));
DropItem(new Tongs());
DropItem(new TinkerTools());
}
public BagOfingots(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
DropItem(new DullCopperIngot(amount));
DropItem(new ShadowIronIngot(amount));
DropItem(new CopperIngot(amount));
DropItem(new BronzeIngot(amount));
DropItem(new GoldIngot(amount));
DropItem(new AgapiteIngot(amount));
DropItem(new VeriteIngot(amount));
DropItem(new ValoriteIngot(amount));
DropItem(new IronIngot(amount));
DropItem(new Tongs());
DropItem(new TinkerTools());
}
}

View file

@ -1,33 +1,17 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class ScribeBag : Bag
{
public class ScribeBag : Bag
[Constructible]
public ScribeBag(int amount = 5000)
{
[Constructible]
public ScribeBag(int amount = 5000)
{
Hue = 0x105;
DropItem(new BagOfReagents(amount));
DropItem(new BlankScroll(amount));
}
public ScribeBag(Serial serial) : base(serial)
{
}
public override string DefaultName => "a Scribe Kit";
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
Hue = 0x105;
DropItem(new BagOfReagents(amount));
DropItem(new BlankScroll(amount));
}
public override string DefaultName => "a Scribe Kit";
}

View file

@ -1,39 +1,23 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class SmithBag : Bag
{
public class SmithBag : Bag
[Constructible]
public SmithBag(int amount = 5000)
{
[Constructible]
public SmithBag(int amount = 5000)
{
DropItem(new DullCopperIngot(amount));
DropItem(new ShadowIronIngot(amount));
DropItem(new CopperIngot(amount));
DropItem(new BronzeIngot(amount));
DropItem(new GoldIngot(amount));
DropItem(new AgapiteIngot(amount));
DropItem(new VeriteIngot(amount));
DropItem(new ValoriteIngot(amount));
DropItem(new IronIngot(amount));
DropItem(new Tongs(amount));
DropItem(new TinkerTools(amount));
}
public SmithBag(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
DropItem(new DullCopperIngot(amount));
DropItem(new ShadowIronIngot(amount));
DropItem(new CopperIngot(amount));
DropItem(new BronzeIngot(amount));
DropItem(new GoldIngot(amount));
DropItem(new AgapiteIngot(amount));
DropItem(new VeriteIngot(amount));
DropItem(new ValoriteIngot(amount));
DropItem(new IronIngot(amount));
DropItem(new Tongs(amount));
DropItem(new TinkerTools(amount));
}
}

View file

@ -1,41 +1,24 @@
using System;
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class TailorBag : Bag
{
public class TailorBag : Bag
[Constructible]
public TailorBag(int amount = 500)
{
[Constructible]
public TailorBag(int amount = 500)
{
Hue = 0x315;
DropItem(new SewingKit(Math.Max(amount / 100, 1)));
DropItem(new Scissors());
DropItem(new Hides(amount));
DropItem(new BoltOfCloth(Math.Max(amount / 25, 1)));
DropItem(new DyeTub());
DropItem(new DyeTub());
DropItem(new BlackDyeTub());
DropItem(new Dyes());
}
public TailorBag(Serial serial) : base(serial)
{
}
public override string DefaultName => "a Tailoring Kit";
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
Hue = 0x315;
DropItem(new SewingKit(Math.Max(amount / 100, 1)));
DropItem(new Scissors());
DropItem(new Hides(amount));
DropItem(new BoltOfCloth(Math.Max(amount / 25, 1)));
DropItem(new DyeTub());
DropItem(new DyeTub());
DropItem(new BlackDyeTub());
DropItem(new Dyes());
}
public override string DefaultName => "a Tailoring Kit";
}