Skip to content

Commit

Permalink
fix: Codegens spellbooks (#1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed Feb 25, 2023
1 parent 8e49fb4 commit 10b2674
Show file tree
Hide file tree
Showing 17 changed files with 1,185 additions and 1,308 deletions.
43 changes: 11 additions & 32 deletions Projects/UOContent/Items/Skill Items/Magical/BookOfBushido.cs
@@ -1,36 +1,15 @@
namespace Server.Items
{
public class BookOfBushido : Spellbook
{
[Constructible]
public BookOfBushido(ulong content = 0x3F) : base(content, 0x238C) =>
Layer = Core.ML ? Layer.OneHanded : Layer.Invalid;

public BookOfBushido(Serial serial) : base(serial)
{
}

public override SpellbookType SpellbookType => SpellbookType.Samurai;
public override int BookOffset => 400;
public override int BookCount => 6;
using ModernUO.Serialization;

public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
namespace Server.Items;

writer.Write(1); // version
}

public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);

var version = reader.ReadInt();
[SerializationGenerator(0, false)]
public partial class BookOfBushido : Spellbook
{
[Constructible]
public BookOfBushido(ulong content = 0x3F) : base(content, 0x238C) =>
Layer = Core.ML ? Layer.OneHanded : Layer.Invalid;

if (version == 0 && Core.ML)
{
Layer = Layer.OneHanded;
}
}
}
public override SpellbookType SpellbookType => SpellbookType.Samurai;
public override int BookOffset => 400;
public override int BookCount => 6;
}
43 changes: 11 additions & 32 deletions Projects/UOContent/Items/Skill Items/Magical/BookOfChivalry.cs
@@ -1,36 +1,15 @@
namespace Server.Items
{
public class BookOfChivalry : Spellbook
{
[Constructible]
public BookOfChivalry(ulong content = 0x3FF) : base(content, 0x2252) =>
Layer = Core.ML ? Layer.OneHanded : Layer.Invalid;

public BookOfChivalry(Serial serial) : base(serial)
{
}

public override SpellbookType SpellbookType => SpellbookType.Paladin;
public override int BookOffset => 200;
public override int BookCount => 10;
using ModernUO.Serialization;

public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
namespace Server.Items;

writer.Write(1); // version
}

public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);

var version = reader.ReadInt();
[SerializationGenerator(0, false)]
public partial class BookOfChivalry : Spellbook
{
[Constructible]
public BookOfChivalry(ulong content = 0x3FF) : base(content, 0x2252) =>
Layer = Core.ML ? Layer.OneHanded : Layer.Invalid;

if (version == 0 && Core.ML)
{
Layer = Layer.OneHanded;
}
}
}
public override SpellbookType SpellbookType => SpellbookType.Paladin;
public override int BookOffset => 200;
public override int BookCount => 10;
}
43 changes: 11 additions & 32 deletions Projects/UOContent/Items/Skill Items/Magical/BookOfNinjitsu.cs
@@ -1,36 +1,15 @@
namespace Server.Items
{
public class BookOfNinjitsu : Spellbook
{
[Constructible]
public BookOfNinjitsu(ulong content = 0xFF) : base(content, 0x23A0) =>
Layer = Core.ML ? Layer.OneHanded : Layer.Invalid;

public BookOfNinjitsu(Serial serial) : base(serial)
{
}

public override SpellbookType SpellbookType => SpellbookType.Ninja;
public override int BookOffset => 500;
public override int BookCount => 8;
using ModernUO.Serialization;

public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
namespace Server.Items;

writer.Write(1); // version
}

public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);

var version = reader.ReadInt();
[SerializationGenerator(0, false)]
public partial class BookOfNinjitsu : Spellbook
{
[Constructible]
public BookOfNinjitsu(ulong content = 0xFF) : base(content, 0x23A0) =>
Layer = Core.ML ? Layer.OneHanded : Layer.Invalid;

if (version == 0 && Core.ML)
{
Layer = Layer.OneHanded;
}
}
}
public override SpellbookType SpellbookType => SpellbookType.Ninja;
public override int BookOffset => 500;
public override int BookCount => 8;
}
40 changes: 10 additions & 30 deletions Projects/UOContent/Items/Skill Items/Magical/MysticSpellbook.cs
@@ -1,35 +1,15 @@
namespace Server.Items
{
public class MysticSpellbook : Spellbook
{
[Constructible]
public MysticSpellbook(ulong content = 0)
: base(content, 0x2D9D) =>
Layer = Layer.OneHanded;

public MysticSpellbook(Serial serial)
: base(serial)
{
}

public override SpellbookType SpellbookType => SpellbookType.Mystic;
using ModernUO.Serialization;

public override int BookOffset => 677;
public override int BookCount => 16;
namespace Server.Items;

public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);

writer.Write(0); // version
}
[SerializationGenerator(0, false)]
public partial class MysticSpellbook : Spellbook
{
[Constructible]
public MysticSpellbook(ulong content = 0) : base(content, 0x2D9D) => Layer = Layer.OneHanded;

public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
public override SpellbookType SpellbookType => SpellbookType.Mystic;

/*int version = */
reader.ReadInt();
}
}
public override int BookOffset => 677;
public override int BookCount => 16;
}
@@ -1,36 +1,15 @@
namespace Server.Items
{
public class NecromancerSpellbook : Spellbook
{
[Constructible]
public NecromancerSpellbook(ulong content = 0) : base(content, 0x2253) =>
Layer = Core.ML ? Layer.OneHanded : Layer.Invalid;

public NecromancerSpellbook(Serial serial) : base(serial)
{
}

public override SpellbookType SpellbookType => SpellbookType.Necromancer;
public override int BookOffset => 100;
public override int BookCount => Core.SE ? 17 : 16;
using ModernUO.Serialization;

public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
namespace Server.Items;

writer.Write(1); // version
}

public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);

var version = reader.ReadInt();
[SerializationGenerator(0, false)]
public partial class NecromancerSpellbook : Spellbook
{
[Constructible]
public NecromancerSpellbook(ulong content = 0) : base(content, 0x2253) =>
Layer = Core.ML ? Layer.OneHanded : Layer.Invalid;

if (version == 0 && Core.ML)
{
Layer = Layer.OneHanded;
}
}
}
public override SpellbookType SpellbookType => SpellbookType.Necromancer;
public override int BookOffset => 100;
public override int BookCount => Core.SE ? 17 : 16;
}

0 comments on commit 10b2674

Please sign in to comment.