fix: Localizes specialized books, codegens instruments (#1352)

This commit is contained in:
Kamron Batman 2023-02-25 10:56:05 -08:00 committed by GitHub
parent ac7c3522f4
commit f2fdc0321c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 1527 additions and 1866 deletions

View file

@ -1,31 +1,10 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class BambooFlute : BaseInstrument
{
public class BambooFlute : BaseInstrument
{
[Constructible]
public BambooFlute() : base(0x2805, 0x504, 0x503) => Weight = 2.0;
public BambooFlute(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();
if (Weight == 3.0)
{
Weight = 2.0;
}
}
}
[Constructible]
public BambooFlute() : base(0x2805, 0x504, 0x503) => Weight = 2.0;
}

View file

@ -1,31 +1,10 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class Drums : BaseInstrument
{
public class Drums : BaseInstrument
{
[Constructible]
public Drums() : base(0xE9C, 0x38, 0x39) => Weight = 4.0;
public Drums(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();
if (Weight == 3.0)
{
Weight = 4.0;
}
}
}
[Constructible]
public Drums() : base(0xE9C, 0x38, 0x39) => Weight = 4.0;
}

View file

@ -1,31 +1,10 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class Harp : BaseInstrument
{
public class Harp : BaseInstrument
{
[Constructible]
public Harp() : base(0xEB1, 0x43, 0x44) => Weight = 35.0;
public Harp(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();
if (Weight == 3.0)
{
Weight = 35.0;
}
}
}
[Constructible]
public Harp() : base(0xEB1, 0x43, 0x44) => Weight = 35.0;
}

View file

@ -1,31 +1,10 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class LapHarp : BaseInstrument
{
public class LapHarp : BaseInstrument
{
[Constructible]
public LapHarp() : base(0xEB2, 0x45, 0x46) => Weight = 10.0;
public LapHarp(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();
if (Weight == 3.0)
{
Weight = 10.0;
}
}
}
[Constructible]
public LapHarp() : base(0xEB2, 0x45, 0x46) => Weight = 10.0;
}

View file

@ -1,31 +1,10 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class Lute : BaseInstrument
{
public class Lute : BaseInstrument
{
[Constructible]
public Lute() : base(0xEB3, 0x4C, 0x4D) => Weight = 5.0;
public Lute(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();
if (Weight == 3.0)
{
Weight = 5.0;
}
}
}
[Constructible]
public Lute() : base(0xEB3, 0x4C, 0x4D) => Weight = 5.0;
}

View file

@ -1,31 +1,10 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class Tambourine : BaseInstrument
{
public class Tambourine : BaseInstrument
{
[Constructible]
public Tambourine() : base(0xE9D, 0x52, 0x53) => Weight = 1.0;
public Tambourine(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();
if (Weight == 2.0)
{
Weight = 1.0;
}
}
}
[Constructible]
public Tambourine() : base(0xE9D, 0x52, 0x53) => Weight = 1.0;
}

View file

@ -1,31 +1,10 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class TambourineTassel : BaseInstrument
{
public class TambourineTassel : BaseInstrument
{
[Constructible]
public TambourineTassel() : base(0xE9E, 0x52, 0x53) => Weight = 1.0;
public TambourineTassel(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();
if (Weight == 2.0)
{
Weight = 1.0;
}
}
}
[Constructible]
public TambourineTassel() : base(0xE9E, 0x52, 0x53) => Weight = 1.0;
}

View file

@ -1,80 +1,58 @@
using ModernUO.Serialization;
using Server.SkillHandlers;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class EggBomb : Item
{
public class EggBomb : Item
[Constructible]
public EggBomb() : base(0x2808)
{
[Constructible]
public EggBomb() : base(0x2808)
// Item ID should be 0x2809 - Temporary solution for clients 7.0.0.0 and up
Stackable = Core.ML;
Weight = 1.0;
}
public override int LabelNumber => 1030249;
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from.Backpack))
{
// Item ID should be 0x2809 - Temporary solution for clients 7.0.0.0 and up
Stackable = Core.ML;
Weight = 1.0;
// The item must be in your backpack to use it.
from.SendLocalizedMessage(1060640);
}
public EggBomb(Serial serial) : base(serial)
else if (from.Skills.Ninjitsu.Value < 50.0)
{
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
from.SendLocalizedMessage(1063013, "50\tNinjitsu");
}
public override int LabelNumber => 1030249;
public override void OnDoubleClick(Mobile from)
else if (Core.TickCount - from.NextSkillTime < 0)
{
if (!IsChildOf(from.Backpack))
{
// The item must be in your backpack to use it.
from.SendLocalizedMessage(1060640);
}
else if (from.Skills.Ninjitsu.Value < 50.0)
{
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
from.SendLocalizedMessage(1063013, "50\tNinjitsu");
}
else if (Core.TickCount - from.NextSkillTime < 0)
{
// You must wait a few seconds before you can use that item.
from.SendLocalizedMessage(1070772);
}
else if (from.Mana < 10)
{
// You don't have enough mana to do that.
from.SendLocalizedMessage(1049456);
}
else
{
Hiding.CombatOverride = true;
if (from.UseSkill(SkillName.Hiding))
{
from.Mana -= 10;
from.FixedParticles(0x3709, 1, 30, 9904, 1108, 6, EffectLayer.RightFoot);
from.PlaySound(0x22F);
Consume();
}
Hiding.CombatOverride = false;
}
// You must wait a few seconds before you can use that item.
from.SendLocalizedMessage(1070772);
}
public override void Serialize(IGenericWriter writer)
else if (from.Mana < 10)
{
base.Serialize(writer);
writer.Write(0);
// You don't have enough mana to do that.
from.SendLocalizedMessage(1049456);
}
public override void Deserialize(IGenericReader reader)
else
{
base.Deserialize(reader);
Hiding.CombatOverride = true;
var version = reader.ReadInt();
if (ItemID == 0x2809) // Temporary solution for clients 7.0.0.0 and up
if (from.UseSkill(SkillName.Hiding))
{
ItemID = 0x2808;
from.Mana -= 10;
from.FixedParticles(0x3709, 1, 30, 9904, 1108, 6, EffectLayer.RightFoot);
from.PlaySound(0x22F);
Consume();
}
Hiding.CombatOverride = false;
}
}
}

View file

@ -1,150 +1,92 @@
using System;
using System.Collections.Generic;
using ModernUO.Serialization;
using Server.ContextMenus;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[Flippable(0x27AA, 0x27F5)]
[SerializationGenerator(0, false)]
public partial class Fukiya : Item, INinjaWeapon
{
[Flippable(0x27AA, 0x27F5)]
public class Fukiya : Item, INinjaWeapon
[InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _usesRemaining;
[InvalidateProperties]
[SerializableField(1)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Poison _poison;
[InvalidateProperties]
[SerializableField(2)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _poisonCharges;
[Constructible]
public Fukiya() : base(0x27AA)
{
private Poison m_Poison;
private int m_PoisonCharges;
Weight = 4.0;
Layer = Layer.OneHanded;
}
private int m_UsesRemaining;
public virtual int WrongAmmoMessage => 1063329; // You can only load fukiya darts
public virtual int NoFreeHandMessage => 1063327; // You must have a free hand to use a fukiya.
public virtual int EmptyWeaponMessage => 1063325; // You have no fukiya darts!
public virtual int RecentlyUsedMessage => 1063326; // You are already using that fukiya.
public virtual int FullWeaponMessage => 1063330; // You can only load fukiya darts
[Constructible]
public Fukiya() : base(0x27AA)
public virtual int WeaponMinRange => 0;
public virtual int WeaponMaxRange => 6;
public virtual int WeaponDamage => Utility.RandomMinMax(4, 6);
public Type AmmoType => typeof(FukiyaDarts);
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public void AttackAnimation(Mobile from, Mobile to)
{
if (from.Body.IsHuman && !from.Mounted)
{
Weight = 4.0;
Layer = Layer.OneHanded;
from.Animate(33, 2, 1, true, true, 0);
}
public Fukiya(Serial serial) : base(serial)
from.PlaySound(0x223);
from.MovingEffect(to, 0x2804, 5, 0, false, false);
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~
if (_poison != null && _poisonCharges > 0)
{
list.Add(1062412 + _poison.Level, _poisonCharges);
}
}
public virtual int WrongAmmoMessage => 1063329; // You can only load fukiya darts
public virtual int NoFreeHandMessage => 1063327; // You must have a free hand to use a fukiya.
public virtual int EmptyWeaponMessage => 1063325; // You have no fukiya darts!
public virtual int RecentlyUsedMessage => 1063326; // You are already using that fukiya.
public virtual int FullWeaponMessage => 1063330; // You can only load fukiya darts
public override void OnDoubleClick(Mobile from)
{
NinjaWeapon.AttemptShoot((PlayerMobile)from, this);
}
public virtual int WeaponMinRange => 0;
public virtual int WeaponMaxRange => 6;
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
public virtual int WeaponDamage => Utility.RandomMinMax(4, 6);
public Type AmmoType => typeof(FukiyaDarts);
[CommandProperty(AccessLevel.GameMaster)]
public int UsesRemaining
if (IsChildOf(from))
{
get => m_UsesRemaining;
set
{
m_UsesRemaining = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Poison Poison
{
get => m_Poison;
set
{
m_Poison = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int PoisonCharges
{
get => m_PoisonCharges;
set
{
m_PoisonCharges = value;
InvalidateProperties();
}
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public void AttackAnimation(Mobile from, Mobile to)
{
if (from.Body.IsHuman && !from.Mounted)
{
from.Animate(33, 2, 1, true, true, 0);
}
from.PlaySound(0x223);
from.MovingEffect(to, 0x2804, 5, 0, false, false);
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, m_UsesRemaining); // uses remaining: ~1_val~
if (m_Poison != null && m_PoisonCharges > 0)
{
list.Add(1062412 + m_Poison.Level, m_PoisonCharges);
}
}
public override void OnDoubleClick(Mobile from)
{
NinjaWeapon.AttemptShoot((PlayerMobile)from, this);
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
if (IsChildOf(from))
{
list.Add(new NinjaWeapon.LoadEntry(this, 6224));
list.Add(new NinjaWeapon.UnloadEntry(this, 6225));
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(m_UsesRemaining);
writer.Write(m_Poison);
writer.Write(m_PoisonCharges);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
m_Poison = reader.ReadPoison();
m_PoisonCharges = reader.ReadInt();
break;
}
}
list.Add(new NinjaWeapon.LoadEntry(this, 6224));
list.Add(new NinjaWeapon.UnloadEntry(this, 6225));
}
}
}

View file

@ -1,120 +1,66 @@
using System;
using ModernUO.Serialization;
using Server.Engines.Craft;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class FukiyaDarts : Item, ICraftable, INinjaAmmo
{
public class FukiyaDarts : Item, ICraftable, INinjaAmmo
[InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _usesRemaining;
[InvalidateProperties]
[SerializableField(1)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Poison _poison;
[InvalidateProperties]
[SerializableField(2)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _poisonCharges;
[Constructible]
public FukiyaDarts(int amount = 1) : base(0x2806)
{
private Poison m_Poison;
private int m_PoisonCharges;
private int m_UsesRemaining;
Weight = 1.0;
_usesRemaining = amount;
}
[Constructible]
public FukiyaDarts(int amount = 1) : base(0x2806)
public FukiyaDarts(Serial serial) : base(serial)
{
}
public int OnCraft(
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue
)
{
if (quality == 2)
{
Weight = 1.0;
m_UsesRemaining = amount;
UsesRemaining *= 2;
}
public FukiyaDarts(Serial serial) : base(serial)
return quality;
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~
if (_poison != null && _poisonCharges > 0)
{
}
public int OnCraft(
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue
)
{
if (quality == 2)
{
UsesRemaining *= 2;
}
return quality;
}
[CommandProperty(AccessLevel.GameMaster)]
public int UsesRemaining
{
get => m_UsesRemaining;
set
{
m_UsesRemaining = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Poison Poison
{
get => m_Poison;
set
{
m_Poison = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int PoisonCharges
{
get => m_PoisonCharges;
set
{
m_PoisonCharges = value;
InvalidateProperties();
}
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, m_UsesRemaining); // uses remaining: ~1_val~
if (m_Poison != null && m_PoisonCharges > 0)
{
list.Add(1062412 + m_Poison.Level, m_PoisonCharges);
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_UsesRemaining);
writer.Write(m_Poison);
writer.Write(m_PoisonCharges);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
m_Poison = reader.ReadPoison();
m_PoisonCharges = reader.ReadInt();
break;
}
}
list.Add(1062412 + _poison.Level, _poisonCharges);
}
}
}

View file

@ -1,163 +1,105 @@
using System;
using System.Collections.Generic;
using ModernUO.Serialization;
using Server.ContextMenus;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[Flippable(0x2790, 0x27DB)]
[SerializationGenerator(0, false)]
public partial class LeatherNinjaBelt : BaseWaist, INinjaWeapon
{
[Flippable(0x2790, 0x27DB)]
public class LeatherNinjaBelt : BaseWaist, INinjaWeapon
[InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _usesRemaining;
[InvalidateProperties]
[SerializableField(1)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Poison _poison;
[InvalidateProperties]
[SerializableField(2)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _poisonCharges;
[Constructible]
public LeatherNinjaBelt() : base(0x2790)
{
private Poison m_Poison;
private int m_PoisonCharges;
Weight = 1.0;
Layer = Layer.Waist;
}
private int m_UsesRemaining;
public override CraftResource DefaultResource => CraftResource.RegularLeather;
[Constructible]
public LeatherNinjaBelt() : base(0x2790)
public virtual int WrongAmmoMessage => 1063301; // You can only place shuriken in a ninja belt.
public virtual int NoFreeHandMessage => 1063299; // You must have a free hand to throw shuriken.
public virtual int EmptyWeaponMessage => 1063297; // You have no shuriken in your ninja belt!
public virtual int RecentlyUsedMessage => 1063298; // You cannot throw another shuriken yet.
public virtual int FullWeaponMessage => 1063302; // You cannot add any more shuriken.
public virtual int WeaponMinRange => 2;
public virtual int WeaponMaxRange => 10;
public virtual int WeaponDamage => Utility.RandomMinMax(3, 5);
public virtual Type AmmoType => typeof(Shuriken);
public bool ShowUsesRemaining
{
get => true;
set { }
}
public void AttackAnimation(Mobile from, Mobile to)
{
if (from.Body.IsHuman)
{
Weight = 1.0;
Layer = Layer.Waist;
from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
}
public LeatherNinjaBelt(Serial serial) : base(serial)
from.PlaySound(0x23A);
from.MovingEffect(to, 0x27AC, 1, 0, false, false);
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~
if (_poison != null && _poisonCharges > 0)
{
list.Add(1062412 + _poison.Level, _poisonCharges);
}
}
public override bool OnEquip(Mobile from)
{
if (base.OnEquip(from))
{
from.SendLocalizedMessage(1070785); // Double click this item each time you wish to throw a shuriken.
return true;
}
public override CraftResource DefaultResource => CraftResource.RegularLeather;
return false;
}
public virtual int WrongAmmoMessage => 1063301; // You can only place shuriken in a ninja belt.
public virtual int NoFreeHandMessage => 1063299; // You must have a free hand to throw shuriken.
public virtual int EmptyWeaponMessage => 1063297; // You have no shuriken in your ninja belt!
public virtual int RecentlyUsedMessage => 1063298; // You cannot throw another shuriken yet.
public virtual int FullWeaponMessage => 1063302; // You cannot add any more shuriken.
public override void OnDoubleClick(Mobile from)
{
NinjaWeapon.AttemptShoot((PlayerMobile)from, this);
}
public virtual int WeaponMinRange => 2;
public virtual int WeaponMaxRange => 10;
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
public virtual int WeaponDamage => Utility.RandomMinMax(3, 5);
public virtual Type AmmoType => typeof(Shuriken);
[CommandProperty(AccessLevel.GameMaster)]
public int UsesRemaining
if (IsChildOf(from))
{
get => m_UsesRemaining;
set
{
m_UsesRemaining = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Poison Poison
{
get => m_Poison;
set
{
m_Poison = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int PoisonCharges
{
get => m_PoisonCharges;
set
{
m_PoisonCharges = value;
InvalidateProperties();
}
}
public bool ShowUsesRemaining
{
get => true;
set { }
}
public void AttackAnimation(Mobile from, Mobile to)
{
if (from.Body.IsHuman)
{
from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
}
from.PlaySound(0x23A);
from.MovingEffect(to, 0x27AC, 1, 0, false, false);
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, m_UsesRemaining); // uses remaining: ~1_val~
if (m_Poison != null && m_PoisonCharges > 0)
{
list.Add(1062412 + m_Poison.Level, m_PoisonCharges);
}
}
public override bool OnEquip(Mobile from)
{
if (base.OnEquip(from))
{
from.SendLocalizedMessage(1070785); // Double click this item each time you wish to throw a shuriken.
return true;
}
return false;
}
public override void OnDoubleClick(Mobile from)
{
NinjaWeapon.AttemptShoot((PlayerMobile)from, this);
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
if (IsChildOf(from))
{
list.Add(new NinjaWeapon.LoadEntry(this, 6222));
list.Add(new NinjaWeapon.UnloadEntry(this, 6223));
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(m_UsesRemaining);
writer.Write(m_Poison);
writer.Write(m_PoisonCharges);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
m_Poison = reader.ReadPoison();
m_PoisonCharges = reader.ReadInt();
break;
}
}
list.Add(new NinjaWeapon.LoadEntry(this, 6222));
list.Add(new NinjaWeapon.UnloadEntry(this, 6223));
}
}
}

View file

@ -14,356 +14,355 @@ using Server.Utilities;
* own serialization, due to the way these weapons were originaly coded.
*/
namespace Server.Items
namespace Server.Items;
public interface INinjaAmmo : IUsesRemaining
{
public interface INinjaAmmo : IUsesRemaining
int PoisonCharges { get; set; }
Poison Poison { get; set; }
}
public interface INinjaWeapon : IUsesRemaining
{
int NoFreeHandMessage { get; }
int EmptyWeaponMessage { get; }
int RecentlyUsedMessage { get; }
int FullWeaponMessage { get; }
int WrongAmmoMessage { get; }
Type AmmoType { get; }
int PoisonCharges { get; set; }
Poison Poison { get; set; }
int WeaponDamage { get; }
int WeaponMinRange { get; }
int WeaponMaxRange { get; }
void AttackAnimation(Mobile from, Mobile to);
}
public static class NinjaWeapon
{
private const int MaxUses = 10;
public static void AttemptShoot(PlayerMobile from, INinjaWeapon weapon)
{
int PoisonCharges { get; set; }
Poison Poison { get; set; }
if (CanUseWeapon(from, weapon))
{
from.BeginTarget(weapon.WeaponMaxRange, false, TargetFlags.Harmful, OnTarget, weapon);
}
}
public interface INinjaWeapon : IUsesRemaining
private static void Shoot(PlayerMobile from, Mobile target, INinjaWeapon weapon)
{
int NoFreeHandMessage { get; }
int EmptyWeaponMessage { get; }
int RecentlyUsedMessage { get; }
int FullWeaponMessage { get; }
int WrongAmmoMessage { get; }
Type AmmoType { get; }
int PoisonCharges { get; set; }
Poison Poison { get; set; }
int WeaponDamage { get; }
int WeaponMinRange { get; }
int WeaponMaxRange { get; }
if (from == target || !CanUseWeapon(from, weapon) || !from.CanBeHarmful(target))
{
return;
}
void AttackAnimation(Mobile from, Mobile to);
if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
{
from.NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo(target);
from.RevealingAction();
weapon.AttackAnimation(from, target);
ConsumeUse(weapon);
if (CombatCheck(from, target))
{
Timer.StartTimer(TimeSpan.FromSeconds(1.0), () => OnHit(from, target, weapon));
}
Timer.StartTimer(TimeSpan.FromSeconds(2.5), () => from.NinjaWepCooldown = false);
}
else
{
from.SendLocalizedMessage(1063303); // Your target is too close!
}
}
public static class NinjaWeapon
private static void Unload(Mobile from, INinjaWeapon weapon)
{
private const int MaxUses = 10;
public static void AttemptShoot(PlayerMobile from, INinjaWeapon weapon)
if (weapon.UsesRemaining > 0)
{
if (CanUseWeapon(from, weapon))
var ammo = weapon.AmmoType.CreateInstance<Item>(weapon.UsesRemaining);
if (ammo is INinjaAmmo ninaAmmo)
{
from.BeginTarget(weapon.WeaponMaxRange, false, TargetFlags.Harmful, OnTarget, weapon);
ninaAmmo.Poison = weapon.Poison;
ninaAmmo.PoisonCharges = weapon.PoisonCharges;
}
from.AddToBackpack(ammo);
weapon.UsesRemaining = 0;
weapon.PoisonCharges = 0;
weapon.Poison = null;
}
}
private static void Shoot(PlayerMobile from, Mobile target, INinjaWeapon weapon)
private static void Reload(PlayerMobile from, INinjaWeapon weapon, INinjaAmmo ammo)
{
if (weapon.UsesRemaining < MaxUses)
{
if (from == target || !CanUseWeapon(from, weapon) || !from.CanBeHarmful(target))
var need = Math.Min(MaxUses - weapon.UsesRemaining, ammo.UsesRemaining);
if (need > 0)
{
return;
}
if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
{
from.NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo(target);
from.RevealingAction();
weapon.AttackAnimation(from, target);
ConsumeUse(weapon);
if (CombatCheck(from, target))
if (weapon.Poison != null && (ammo.Poison == null || weapon.Poison.Level > ammo.Poison.Level))
{
Timer.StartTimer(TimeSpan.FromSeconds(1.0), () => OnHit(from, target, weapon));
from.SendLocalizedMessage(1070767); // Loaded projectile is stronger, unload it first
}
else
{
if (weapon.UsesRemaining > 0)
{
if (weapon.Poison == null && ammo.Poison != null
|| weapon.Poison != null && ammo.Poison != null && weapon.Poison.Level != ammo.Poison.Level)
{
Unload(from, weapon);
need = Math.Min(MaxUses, ammo.UsesRemaining);
}
}
Timer.StartTimer(TimeSpan.FromSeconds(2.5), () => from.NinjaWepCooldown = false);
}
else
{
from.SendLocalizedMessage(1063303); // Your target is too close!
}
var poisonneeded = Math.Min(MaxUses - weapon.PoisonCharges, ammo.PoisonCharges);
weapon.UsesRemaining += need;
weapon.PoisonCharges += poisonneeded;
if (weapon.PoisonCharges > 0)
{
weapon.Poison = ammo.Poison;
}
ammo.PoisonCharges -= poisonneeded;
ammo.UsesRemaining -= need;
if (ammo.UsesRemaining < 1)
{
((Item)ammo).Delete();
}
else if (ammo.PoisonCharges < 1)
{
ammo.Poison = null;
}
}
} // "else" here would mean they targeted "ammo" with 0 uses. undefined behavior.
}
private static void Unload(Mobile from, INinjaWeapon weapon)
else
{
if (weapon.UsesRemaining > 0)
from.SendLocalizedMessage(weapon.FullWeaponMessage);
}
}
private static void ConsumeUse(INinjaWeapon weapon)
{
if (weapon.UsesRemaining > 0)
{
weapon.UsesRemaining--;
if (weapon.UsesRemaining < 1)
{
var ammo = weapon.AmmoType.CreateInstance<Item>(weapon.UsesRemaining);
if (ammo is INinjaAmmo ninaAmmo)
{
ninaAmmo.Poison = weapon.Poison;
ninaAmmo.PoisonCharges = weapon.PoisonCharges;
}
from.AddToBackpack(ammo);
weapon.UsesRemaining = 0;
weapon.PoisonCharges = 0;
weapon.Poison = null;
}
}
}
private static void Reload(PlayerMobile from, INinjaWeapon weapon, INinjaAmmo ammo)
{
if (weapon.UsesRemaining < MaxUses)
{
var need = Math.Min(MaxUses - weapon.UsesRemaining, ammo.UsesRemaining);
if (need > 0)
{
if (weapon.Poison != null && (ammo.Poison == null || weapon.Poison.Level > ammo.Poison.Level))
{
from.SendLocalizedMessage(1070767); // Loaded projectile is stronger, unload it first
}
else
{
if (weapon.UsesRemaining > 0)
{
if (weapon.Poison == null && ammo.Poison != null
|| weapon.Poison != null && ammo.Poison != null && weapon.Poison.Level != ammo.Poison.Level)
{
Unload(from, weapon);
need = Math.Min(MaxUses, ammo.UsesRemaining);
}
}
var poisonneeded = Math.Min(MaxUses - weapon.PoisonCharges, ammo.PoisonCharges);
weapon.UsesRemaining += need;
weapon.PoisonCharges += poisonneeded;
if (weapon.PoisonCharges > 0)
{
weapon.Poison = ammo.Poison;
}
ammo.PoisonCharges -= poisonneeded;
ammo.UsesRemaining -= need;
if (ammo.UsesRemaining < 1)
{
((Item)ammo).Delete();
}
else if (ammo.PoisonCharges < 1)
{
ammo.Poison = null;
}
}
} // "else" here would mean they targeted "ammo" with 0 uses. undefined behavior.
}
else
{
from.SendLocalizedMessage(weapon.FullWeaponMessage);
}
}
private static void ConsumeUse(INinjaWeapon weapon)
private static bool CanUseWeapon(PlayerMobile from, INinjaWeapon weapon)
{
if (WeaponIsValid(weapon, from))
{
if (weapon.UsesRemaining > 0)
{
weapon.UsesRemaining--;
if (weapon.UsesRemaining < 1)
if (!from.NinjaWepCooldown)
{
weapon.PoisonCharges = 0;
weapon.Poison = null;
}
}
}
private static bool CanUseWeapon(PlayerMobile from, INinjaWeapon weapon)
{
if (WeaponIsValid(weapon, from))
{
if (weapon.UsesRemaining > 0)
{
if (!from.NinjaWepCooldown)
if (BasePotion.HasFreeHand(from))
{
if (BasePotion.HasFreeHand(from))
{
return true;
}
from.SendLocalizedMessage(weapon.NoFreeHandMessage);
}
else
{
from.SendLocalizedMessage(weapon.RecentlyUsedMessage);
return true;
}
from.SendLocalizedMessage(weapon.NoFreeHandMessage);
}
else
{
from.SendLocalizedMessage(weapon.EmptyWeaponMessage);
from.SendLocalizedMessage(weapon.RecentlyUsedMessage);
}
}
return false;
}
private static bool CombatCheck(Mobile attacker, Mobile defender) /* mod'd from baseweapon */
{
var defWeapon = defender.Weapon as BaseWeapon;
var atkSkill = defender.Skills.Ninjitsu;
// Skill defSkill = defender.Skills[defWeapon.Skill];
var atSkillValue = attacker.Skills.Ninjitsu.Value;
var defSkillValue = defWeapon?.GetDefendSkillValue(attacker, defender) ?? 0.0;
if (defSkillValue <= -20.0)
else
{
defSkillValue = -19.9;
}
double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance);
attackValue += DivineFurySpell.GetAttackBonus(attacker);
if (AnimalForm.UnderTransformation(attacker, typeof(GreyWolf)) ||
AnimalForm.UnderTransformation(attacker, typeof(BakeKitsune)))
{
attackValue += 20;
}
if (HitLower.IsUnderAttackEffect(attacker))
{
attackValue -= 25;
}
if (attackValue > 45)
{
attackValue = 45;
}
attackValue = (atSkillValue + 20.0) * (100 + attackValue);
double defenseValue = AosAttributes.GetValue(defender, AosAttribute.DefendChance);
defenseValue -= DivineFurySpell.GetDefendMalus(defender);
if (HitLower.IsUnderDefenseEffect(defender))
{
defenseValue -= 25;
}
var refBonus = 0;
if (Block.GetBonus(defender, ref refBonus))
{
defenseValue += refBonus;
}
if (Discordance.GetEffect(attacker, ref refBonus))
{
defenseValue -= refBonus;
}
if (defenseValue > 45)
{
defenseValue = 45;
}
defenseValue = (defSkillValue + 20.0) * (100 + defenseValue);
var chance = attackValue / (defenseValue * 2.0);
if (chance < 0.02)
{
chance = 0.02;
}
return attacker.CheckSkill(atkSkill.SkillName, chance);
}
private static void OnHit(Mobile from, Mobile target, INinjaWeapon weapon)
{
if (!from.CanBeHarmful(target))
{
return;
}
from.DoHarmful(target);
AOS.Damage(target, from, weapon.WeaponDamage, 100, 0, 0, 0, 0);
if (weapon.Poison != null && weapon.PoisonCharges > 0)
{
if (EvilOmenSpell.EndEffect(target))
{
target.ApplyPoison(from, Poison.GetPoison(weapon.Poison.Level + 1));
}
else
{
target.ApplyPoison(from, weapon.Poison);
}
weapon.PoisonCharges--;
if (weapon.PoisonCharges < 1)
{
weapon.Poison = null;
}
from.SendLocalizedMessage(weapon.EmptyWeaponMessage);
}
}
private static void OnTarget(Mobile from, object targeted, INinjaWeapon weapon)
return false;
}
private static bool CombatCheck(Mobile attacker, Mobile defender) /* mod'd from baseweapon */
{
var defWeapon = defender.Weapon as BaseWeapon;
var atkSkill = defender.Skills.Ninjitsu;
// Skill defSkill = defender.Skills[defWeapon.Skill];
var atSkillValue = attacker.Skills.Ninjitsu.Value;
var defSkillValue = defWeapon?.GetDefendSkillValue(attacker, defender) ?? 0.0;
if (defSkillValue <= -20.0)
{
if (from is PlayerMobile player && WeaponIsValid(weapon, from))
{
if (targeted is Mobile mobile)
{
Shoot(player, mobile, weapon);
}
else if (targeted.GetType() == weapon.AmmoType)
{
Reload(player, weapon, (INinjaAmmo)targeted);
}
else
{
player.SendLocalizedMessage(weapon.WrongAmmoMessage);
}
}
defSkillValue = -19.9;
}
private static bool WeaponIsValid(INinjaWeapon weapon, Mobile from) =>
weapon is Item item && !item.Deleted && item.RootParent == from;
double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance);
public class LoadEntry : ContextMenuEntry
attackValue += DivineFurySpell.GetAttackBonus(attacker);
if (AnimalForm.UnderTransformation(attacker, typeof(GreyWolf)) ||
AnimalForm.UnderTransformation(attacker, typeof(BakeKitsune)))
{
private readonly INinjaWeapon weapon;
public LoadEntry(INinjaWeapon wep, int entry)
: base(entry, 0) =>
weapon = wep;
public override void OnClick()
{
if (WeaponIsValid(weapon, Owner.From))
{
Owner.From.BeginTarget(10, false, TargetFlags.Harmful, OnTarget, weapon);
}
}
attackValue += 20;
}
public class UnloadEntry : ContextMenuEntry
if (HitLower.IsUnderAttackEffect(attacker))
{
private readonly INinjaWeapon weapon;
attackValue -= 25;
}
public UnloadEntry(INinjaWeapon wep, int entry)
: base(entry, 0)
if (attackValue > 45)
{
attackValue = 45;
}
attackValue = (atSkillValue + 20.0) * (100 + attackValue);
double defenseValue = AosAttributes.GetValue(defender, AosAttribute.DefendChance);
defenseValue -= DivineFurySpell.GetDefendMalus(defender);
if (HitLower.IsUnderDefenseEffect(defender))
{
defenseValue -= 25;
}
var refBonus = 0;
if (Block.GetBonus(defender, ref refBonus))
{
defenseValue += refBonus;
}
if (Discordance.GetEffect(attacker, ref refBonus))
{
defenseValue -= refBonus;
}
if (defenseValue > 45)
{
defenseValue = 45;
}
defenseValue = (defSkillValue + 20.0) * (100 + defenseValue);
var chance = attackValue / (defenseValue * 2.0);
if (chance < 0.02)
{
chance = 0.02;
}
return attacker.CheckSkill(atkSkill.SkillName, chance);
}
private static void OnHit(Mobile from, Mobile target, INinjaWeapon weapon)
{
if (!from.CanBeHarmful(target))
{
return;
}
from.DoHarmful(target);
AOS.Damage(target, from, weapon.WeaponDamage, 100, 0, 0, 0, 0);
if (weapon.Poison != null && weapon.PoisonCharges > 0)
{
if (EvilOmenSpell.EndEffect(target))
{
weapon = wep;
Enabled = weapon.UsesRemaining > 0;
target.ApplyPoison(from, Poison.GetPoison(weapon.Poison.Level + 1));
}
else
{
target.ApplyPoison(from, weapon.Poison);
}
public override void OnClick()
weapon.PoisonCharges--;
if (weapon.PoisonCharges < 1)
{
if (WeaponIsValid(weapon, Owner.From))
{
Unload(Owner.From, weapon);
}
weapon.Poison = null;
}
}
}
}
private static void OnTarget(Mobile from, object targeted, INinjaWeapon weapon)
{
if (from is PlayerMobile player && WeaponIsValid(weapon, from))
{
if (targeted is Mobile mobile)
{
Shoot(player, mobile, weapon);
}
else if (targeted.GetType() == weapon.AmmoType)
{
Reload(player, weapon, (INinjaAmmo)targeted);
}
else
{
player.SendLocalizedMessage(weapon.WrongAmmoMessage);
}
}
}
private static bool WeaponIsValid(INinjaWeapon weapon, Mobile from) =>
weapon is Item item && !item.Deleted && item.RootParent == from;
public class LoadEntry : ContextMenuEntry
{
private readonly INinjaWeapon weapon;
public LoadEntry(INinjaWeapon wep, int entry)
: base(entry, 0) =>
weapon = wep;
public override void OnClick()
{
if (WeaponIsValid(weapon, Owner.From))
{
Owner.From.BeginTarget(10, false, TargetFlags.Harmful, OnTarget, weapon);
}
}
}
public class UnloadEntry : ContextMenuEntry
{
private readonly INinjaWeapon weapon;
public UnloadEntry(INinjaWeapon wep, int entry)
: base(entry, 0)
{
weapon = wep;
Enabled = weapon.UsesRemaining > 0;
}
public override void OnClick()
{
if (WeaponIsValid(weapon, Owner.From))
{
Unload(Owner.From, weapon);
}
}
}
}

View file

@ -1,121 +1,63 @@
using System;
using ModernUO.Serialization;
using Server.Engines.Craft;
namespace Server.Items
namespace Server.Items;
[Flippable(0x27AC, 0x27F7)]
[SerializationGenerator(0, false)]
public partial class Shuriken : Item, ICraftable, INinjaAmmo
{
[Flippable(0x27AC, 0x27F7)]
public class Shuriken : Item, ICraftable, INinjaAmmo
[InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _usesRemaining;
[InvalidateProperties]
[SerializableField(1)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Poison _poison;
[InvalidateProperties]
[SerializableField(2)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _poisonCharges;
[Constructible]
public Shuriken(int amount = 1) : base(0x27AC)
{
private Poison m_Poison;
private int m_PoisonCharges;
private int m_UsesRemaining;
Weight = 1.0;
_usesRemaining = amount;
}
[Constructible]
public Shuriken(int amount = 1) : base(0x27AC)
public int OnCraft(
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue
)
{
if (quality == 2)
{
Weight = 1.0;
m_UsesRemaining = amount;
UsesRemaining *= 2;
}
public Shuriken(Serial serial) : base(serial)
return quality;
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~
if (_poison != null && _poisonCharges > 0)
{
}
public int OnCraft(
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue
)
{
if (quality == 2)
{
UsesRemaining *= 2;
}
return quality;
}
[CommandProperty(AccessLevel.GameMaster)]
public int UsesRemaining
{
get => m_UsesRemaining;
set
{
m_UsesRemaining = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Poison Poison
{
get => m_Poison;
set
{
m_Poison = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int PoisonCharges
{
get => m_PoisonCharges;
set
{
m_PoisonCharges = value;
InvalidateProperties();
}
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, m_UsesRemaining); // uses remaining: ~1_val~
if (m_Poison != null && m_PoisonCharges > 0)
{
list.Add(1062412 + m_Poison.Level, m_PoisonCharges);
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_UsesRemaining);
writer.Write(m_Poison);
writer.Write(m_PoisonCharges);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
m_Poison = reader.ReadPoison();
m_PoisonCharges = reader.ReadInt();
break;
}
}
list.Add(1062412 + _poison.Level, _poisonCharges);
}
}
}

View file

@ -1,72 +1,55 @@
using ModernUO.Serialization;
using Server.SkillHandlers;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class SmokeBomb : Item
{
public class SmokeBomb : Item
[Constructible]
public SmokeBomb() : base(0x2808)
{
[Constructible]
public SmokeBomb() : base(0x2808)
Stackable = Core.ML;
Weight = 1.0;
}
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from.Backpack))
{
Stackable = Core.ML;
Weight = 1.0;
// The item must be in your backpack to use it.
from.SendLocalizedMessage(1060640);
}
public SmokeBomb(Serial serial) : base(serial)
else if (from.Skills.Ninjitsu.Value < 50.0)
{
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
from.SendLocalizedMessage(1063013, "50\tNinjitsu");
}
public override void OnDoubleClick(Mobile from)
else if (Core.TickCount - from.NextSkillTime < 0)
{
if (!IsChildOf(from.Backpack))
{
// The item must be in your backpack to use it.
from.SendLocalizedMessage(1060640);
}
else if (from.Skills.Ninjitsu.Value < 50.0)
{
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
from.SendLocalizedMessage(1063013, "50\tNinjitsu");
}
else if (Core.TickCount - from.NextSkillTime < 0)
{
// You must wait a few seconds before you can use that item.
from.SendLocalizedMessage(1070772);
}
else if (from.Mana < 10)
{
// You don't have enough mana to do that.
from.SendLocalizedMessage(1049456);
}
else
{
Hiding.CombatOverride = true;
if (from.UseSkill(SkillName.Hiding))
{
from.Mana -= 10;
from.FixedParticles(0x3709, 1, 30, 9904, 1108, 6, EffectLayer.RightFoot);
from.PlaySound(0x22F);
Consume();
}
Hiding.CombatOverride = false;
}
// You must wait a few seconds before you can use that item.
from.SendLocalizedMessage(1070772);
}
public override void Serialize(IGenericWriter writer)
else if (from.Mana < 10)
{
base.Serialize(writer);
writer.Write(0);
// You don't have enough mana to do that.
from.SendLocalizedMessage(1049456);
}
public override void Deserialize(IGenericReader reader)
else
{
base.Deserialize(reader);
Hiding.CombatOverride = true;
var version = reader.ReadInt();
if (from.UseSkill(SkillName.Hiding))
{
from.Mana -= 10;
from.FixedParticles(0x3709, 1, 30, 9904, 1108, 6, EffectLayer.RightFoot);
from.PlaySound(0x22F);
Consume();
}
Hiding.CombatOverride = false;
}
}
}

View file

@ -1,54 +1,36 @@
using ModernUO.Serialization;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class GlassblowingBook : Item
{
public class GlassblowingBook : Item
[Constructible]
public GlassblowingBook() : base(0xFF4) => Weight = 1.0;
public override int LabelNumber => 1153528; // Crafting glass with Glassblowing
public override void OnDoubleClick(Mobile from)
{
[Constructible]
public GlassblowingBook() : base(0xFF4) => Weight = 1.0;
public GlassblowingBook(Serial serial) : base(serial)
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
public override string DefaultName => "Crafting Glass With Glassblowing";
public override void Serialize(IGenericWriter writer)
else if (from is not PlayerMobile pm || from.Skills.Alchemy.Base < 100.0)
{
base.Serialize(writer);
writer.Write(0); // version
from.SendLocalizedMessage(1080042); // Only a Grandmaster Alchemist can learn from this book.
}
public override void Deserialize(IGenericReader reader)
else if (pm.Glassblowing)
{
base.Deserialize(reader);
var version = reader.ReadInt();
from.SendLocalizedMessage(1080066); // You have already learned this information.
}
public override void OnDoubleClick(Mobile from)
else
{
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else if (from is not PlayerMobile pm || from.Skills.Alchemy.Base < 100.0)
{
from.SendMessage("Only a Grandmaster Alchemist can learn from this book.");
}
else if (pm.Glassblowing)
{
from.SendMessage("You have already learned this information.");
}
else
{
pm.Glassblowing = true;
from.SendMessage(
"You have learned to make items from glass. You will need to find miners to mine find sand for you to make these items."
);
Delete();
}
pm.Glassblowing = true;
// You have learned to make items from glass. You will need to find miners to mine fine sand for you to make these items.
from.SendLocalizedMessage(1111702);
Delete();
}
}
}

View file

@ -1,54 +1,36 @@
using ModernUO.Serialization;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class MasonryBook : Item
{
public class MasonryBook : Item
[Constructible]
public MasonryBook() : base(0xFBE) => Weight = 1.0;
public override int LabelNumber => 1153527; // Making valuables with Stonecrafting
public override void OnDoubleClick(Mobile from)
{
[Constructible]
public MasonryBook() : base(0xFBE) => Weight = 1.0;
public MasonryBook(Serial serial) : base(serial)
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
public override string DefaultName => "Making Valuables With Stonecrafting";
public override void Serialize(IGenericWriter writer)
else if (from is not PlayerMobile pm || from.Skills.Carpentry.Base < 100.0)
{
base.Serialize(writer);
writer.Write(0); // version
from.SendLocalizedMessage(1080043); // Only a Grandmaster Carpenter can learn from this book.
}
public override void Deserialize(IGenericReader reader)
else if (pm.Masonry)
{
base.Deserialize(reader);
var version = reader.ReadInt();
from.SendLocalizedMessage(1080066); // You have already learned this information.
}
public override void OnDoubleClick(Mobile from)
else
{
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else if (from is not PlayerMobile pm || from.Skills.Carpentry.Base < 100.0)
{
from.SendMessage("Only a Grandmaster Carpenter can learn from this book.");
}
else if (pm.Masonry)
{
from.SendMessage("You have already learned this information.");
}
else
{
pm.Masonry = true;
from.SendMessage(
"You have learned to make items from stone. You will need miners to gather stones for you to make these items."
);
Delete();
}
pm.Masonry = true;
// You have learned to make items from stone. You will need miners to gather stones for you to make these items.
from.SendLocalizedMessage(1080044);
Delete();
}
}
}

View file

@ -1,40 +1,19 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[Flippable(0x11EA, 0x11EB)]
[SerializationGenerator(0, false)]
public partial class Sand : Item, ICommodity
{
[Flippable(0x11EA, 0x11EB)]
public class Sand : Item, ICommodity
[Constructible]
public Sand(int amount = 1) : base(0x11EA)
{
[Constructible]
public Sand(int amount = 1) : base(0x11EA)
{
Stackable = Core.ML;
Weight = 1.0;
}
public Sand(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1044626; // sand
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(1); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
if (version == 0 && Name == "sand")
{
Name = null;
}
}
Stackable = Core.ML;
Weight = 1.0;
}
public override int LabelNumber => 1044626; // sand
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
}

View file

@ -1,54 +1,36 @@
using ModernUO.Serialization;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class SandMiningBook : Item
{
public class SandMiningBook : Item
[Constructible]
public SandMiningBook() : base(0xFF4) => Weight = 1.0;
public override int LabelNumber => 1153531; // Find Glass-Quality Sand
public override void OnDoubleClick(Mobile from)
{
[Constructible]
public SandMiningBook() : base(0xFF4) => Weight = 1.0;
public SandMiningBook(Serial serial) : base(serial)
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
public override string DefaultName => "Find Glass-Quality Sand";
public override void Serialize(IGenericWriter writer)
else if (from is not PlayerMobile pm || from.Skills.Mining.Base < 100.0)
{
base.Serialize(writer);
writer.Write(0); // version
// Only a Grandmaster Miner can learn from this book.
from.SendLocalizedMessage(1080041);
}
public override void Deserialize(IGenericReader reader)
else if (pm.SandMining)
{
base.Deserialize(reader);
var version = reader.ReadInt();
from.SendLocalizedMessage(1080066); // You have already learned this information.
}
public override void OnDoubleClick(Mobile from)
else
{
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else if (from is not PlayerMobile pm || from.Skills.Mining.Base < 100.0)
{
from.SendMessage("Only a Grandmaster Miner can learn from this book.");
}
else if (pm.SandMining)
{
from.SendMessage("You have already learned this information.");
}
else
{
pm.SandMining = true;
from.SendMessage(
"You have learned how to mine fine sand. Target sand areas when mining to look for fine sand."
);
Delete();
}
pm.SandMining = true;
// You have learned to make items from glass. You will need to find miners to mine fine sand for you to make these items.
from.SendLocalizedMessage(1080065);
Delete();
}
}
}

View file

@ -1,54 +1,38 @@
using ModernUO.Serialization;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class StoneMiningBook : Item
{
public class StoneMiningBook : Item
[Constructible]
public StoneMiningBook() : base(0xFBE) => Weight = 1.0;
public override int LabelNumber => 1153530; // Mining For Quality Stone
public override void OnDoubleClick(Mobile from)
{
[Constructible]
public StoneMiningBook() : base(0xFBE) => Weight = 1.0;
var pm = from as PlayerMobile;
public StoneMiningBook(Serial serial) : base(serial)
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
public override string DefaultName => "Mining For Quality Stone";
public override void Serialize(IGenericWriter writer)
else if (pm == null || from.Skills.Mining.Base < 100.0)
{
base.Serialize(writer);
writer.Write(0); // version
from.SendLocalizedMessage(1080041); // Only a Grandmaster Miner can learn from this book.
}
public override void Deserialize(IGenericReader reader)
else if (pm.StoneMining)
{
base.Deserialize(reader);
var version = reader.ReadInt();
from.SendLocalizedMessage(1080066); // You have already learned this information.
}
public override void OnDoubleClick(Mobile from)
else
{
var pm = from as PlayerMobile;
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else if (pm == null || from.Skills.Mining.Base < 100.0)
{
from.SendMessage("Only a Grandmaster Miner can learn from this book.");
}
else if (pm.StoneMining)
{
pm.SendMessage("You have already learned this knowledge.");
}
else
{
pm.StoneMining = true;
pm.SendMessage("You have learned to mine for stones. Target mountains when mining to find stones.");
Delete();
}
pm.StoneMining = true;
// You have learned to mine for stones. Target mountains when mining to find stones.
pm.SendLocalizedMessage(1080045);
Delete();
}
}
}

View file

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

View file

@ -0,0 +1,69 @@
{
"version": 4,
"type": "Server.Items.BaseInstrument",
"properties": [
{
"name": "ReplenishesCharges",
"type": "bool",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "LastReplenished",
"type": "System.DateTime",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Crafter",
"type": "string",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Quality",
"type": "Server.Items.InstrumentQuality",
"rule": "EnumMigrationRule"
},
{
"name": "Slayer",
"type": "Server.Items.SlayerName",
"rule": "EnumMigrationRule"
},
{
"name": "Slayer2",
"type": "Server.Items.SlayerName",
"rule": "EnumMigrationRule"
},
{
"name": "UsesRemaining",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "SuccessSound",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "FailureSound",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

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

View file

@ -0,0 +1,30 @@
{
"version": 0,
"type": "Server.Items.Fukiya",
"properties": [
{
"name": "UsesRemaining",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Poison",
"type": "Server.Poison",
"rule": "PrimitiveUOTypeMigrationRule",
"ruleArguments": [
"Poison"
]
},
{
"name": "PoisonCharges",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

@ -0,0 +1,30 @@
{
"version": 0,
"type": "Server.Items.FukiyaDarts",
"properties": [
{
"name": "UsesRemaining",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Poison",
"type": "Server.Poison",
"rule": "PrimitiveUOTypeMigrationRule",
"ruleArguments": [
"Poison"
]
},
{
"name": "PoisonCharges",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

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

View file

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

View file

@ -0,0 +1,30 @@
{
"version": 0,
"type": "Server.Items.LeatherNinjaBelt",
"properties": [
{
"name": "UsesRemaining",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Poison",
"type": "Server.Poison",
"rule": "PrimitiveUOTypeMigrationRule",
"ruleArguments": [
"Poison"
]
},
{
"name": "PoisonCharges",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,30 @@
{
"version": 0,
"type": "Server.Items.Shuriken",
"properties": [
{
"name": "UsesRemaining",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Poison",
"type": "Server.Poison",
"rule": "PrimitiveUOTypeMigrationRule",
"ruleArguments": [
"Poison"
]
},
{
"name": "PoisonCharges",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

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

View file

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

View file

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