fix: Codegens ToT and replaces persistence with config (#1524)

This commit is contained in:
Kamron Batman 2023-09-30 02:09:28 -07:00 • committed by GitHub
parent 5ea5fb43cc
commit 7d05e3b1cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 1502 additions and 1986 deletions

View file

@ -1,289 +1,231 @@
using System;
using ModernUO.Serialization;
using Server.Engines.Stealables;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public abstract partial class BasePigmentsOfTokuno : Item, IUsesRemaining
{
public abstract class BasePigmentsOfTokuno : Item, IUsesRemaining
private static readonly Type[] m_Glasses =
{
private static readonly Type[] m_Glasses =
typeof(MaritimeGlasses),
typeof(WizardsGlasses),
typeof(TradeGlasses),
typeof(LyricalGlasses),
typeof(NecromanticGlasses),
typeof(LightOfWayGlasses),
typeof(FoldedSteelGlasses),
typeof(PoisonedGlasses),
typeof(TreasureTrinketGlasses),
typeof(MaceShieldGlasses),
typeof(ArtsGlasses),
typeof(AnthropomorphistGlasses)
};
private static readonly Type[] m_Replicas =
{
typeof(ANecromancerShroud),
typeof(BraveKnightOfTheBritannia),
typeof(CaptainJohnsHat),
typeof(DetectiveBoots),
typeof(DjinnisRing),
typeof(EmbroideredOakLeafCloak),
typeof(GuantletsOfAnger),
typeof(LieutenantOfTheBritannianRoyalGuard),
typeof(OblivionsNeedle),
typeof(RoyalGuardSurvivalKnife),
typeof(SamaritanRobe),
typeof(TheMostKnowledgePerson),
typeof(TheRobeOfBritanniaAri),
typeof(AcidProofRobe),
typeof(Calm),
typeof(CrownOfTalKeesh),
typeof(FangOfRactus),
typeof(GladiatorsCollar),
typeof(OrcChieftainHelm),
typeof(Pacify),
typeof(Quell),
typeof(ShroudOfDeciet),
typeof(Subdue)
};
private static readonly Type[] m_DyableHeritageItems =
{
typeof(ChargerOfTheFallen),
typeof(SamuraiHelm),
typeof(HolySword),
typeof(LeggingsOfEmbers),
typeof(ShaminoCrossbow)
};
private TextDefinition m_Label;
[EncodedInt]
[InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _usesRemaining;
public BasePigmentsOfTokuno() : base(0xEFF)
{
Weight = 1.0;
_usesRemaining = 1;
}
public BasePigmentsOfTokuno(int uses) : base(0xEFF)
{
Weight = 1.0;
_usesRemaining = uses;
}
public BasePigmentsOfTokuno(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1070933; // Pigments of Tokuno
protected TextDefinition Label
{
get => m_Label;
set
{
typeof(MaritimeGlasses),
typeof(WizardsGlasses),
typeof(TradeGlasses),
typeof(LyricalGlasses),
typeof(NecromanticGlasses),
typeof(LightOfWayGlasses),
typeof(FoldedSteelGlasses),
typeof(PoisonedGlasses),
typeof(TreasureTrinketGlasses),
typeof(MaceShieldGlasses),
typeof(ArtsGlasses),
typeof(AnthropomorphistGlasses)
};
private static readonly Type[] m_Replicas =
{
typeof(ANecromancerShroud),
typeof(BraveKnightOfTheBritannia),
typeof(CaptainJohnsHat),
typeof(DetectiveBoots),
typeof(DjinnisRing),
typeof(EmbroideredOakLeafCloak),
typeof(GuantletsOfAnger),
typeof(LieutenantOfTheBritannianRoyalGuard),
typeof(OblivionsNeedle),
typeof(RoyalGuardSurvivalKnife),
typeof(SamaritanRobe),
typeof(TheMostKnowledgePerson),
typeof(TheRobeOfBritanniaAri),
typeof(AcidProofRobe),
typeof(Calm),
typeof(CrownOfTalKeesh),
typeof(FangOfRactus),
typeof(GladiatorsCollar),
typeof(OrcChieftainHelm),
typeof(Pacify),
typeof(Quell),
typeof(ShroudOfDeciet),
typeof(Subdue)
};
private static readonly Type[] m_DyableHeritageItems =
{
typeof(ChargerOfTheFallen),
typeof(SamuraiHelm),
typeof(HolySword),
typeof(LeggingsOfEmbers),
typeof(ShaminoCrossbow)
};
private TextDefinition m_Label;
private int m_UsesRemaining;
public BasePigmentsOfTokuno() : base(0xEFF)
{
Weight = 1.0;
m_UsesRemaining = 1;
}
public BasePigmentsOfTokuno(int uses) : base(0xEFF)
{
Weight = 1.0;
m_UsesRemaining = uses;
}
public BasePigmentsOfTokuno(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1070933; // Pigments of Tokuno
protected TextDefinition Label
{
get => m_Label;
set
{
m_Label = value;
InvalidateProperties();
}
}
/* DO NOT USE! Only used in serialization of pigments that originally derived from Item */
protected bool InheritsItem { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int UsesRemaining
{
get => m_UsesRemaining;
set
{
m_UsesRemaining = value;
InvalidateProperties();
}
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
m_Label.AddTo(list);
list.Add(1060584, m_UsesRemaining); // uses remaining: ~1_val~
}
public override void OnDoubleClick(Mobile from)
{
if (IsAccessibleTo(from) && from.InRange(GetWorldLocation(), 3))
{
from.SendLocalizedMessage(1070929); // Select the artifact or enhanced magic item to dye.
from.BeginTarget(3, false, TargetFlags.None, InternalCallback);
}
else
{
from.SendLocalizedMessage(502436); // That is not accessible.
}
}
private void InternalCallback(Mobile from, object targeted)
{
if (Deleted || UsesRemaining <= 0 || !from.InRange(GetWorldLocation(), 3) ||
!IsAccessibleTo(from))
{
return;
}
if (targeted is not Item i)
{
from.SendLocalizedMessage(1070931); // You can only dye artifacts and enhanced magic items with this tub.
}
else if (!from.InRange(i.GetWorldLocation(), 3) || !IsAccessibleTo(from))
{
from.SendLocalizedMessage(502436); // That is not accessible.
}
else if (from.Items.Contains(i))
{
from.SendLocalizedMessage(1070930); // Can't dye artifacts or enhanced magic items that are being worn.
}
else if (i.IsLockedDown)
{
from.SendLocalizedMessage(
1070932
); // You may not dye artifacts and enhanced magic items which are locked down.
}
else if (i.QuestItem)
{
from.SendLocalizedMessage(1151836); // You may not dye toggled quest items.
}
else if (i is MetalPigmentsOfTokuno)
{
from.SendLocalizedMessage(1042417); // You cannot dye that.
}
else if (i is LesserPigmentsOfTokuno)
{
from.SendLocalizedMessage(1042417); // You cannot dye that.
}
else if (i is PigmentsOfTokuno)
{
from.SendLocalizedMessage(1042417); // You cannot dye that.
}
else if (!IsValidItem(i))
{
from.SendLocalizedMessage(
1070931
); // You can only dye artifacts and enhanced magic items with this tub. //Yes, it says tub on OSI. Don't ask me why ;p
}
else
{
// Notes: on OSI there IS no hue check to see if it's already hued. and no messages on successful hue either
i.Hue = Hue;
if (--UsesRemaining <= 0)
{
Delete();
}
from.PlaySound(0x23E); // As per OSI TC1
}
}
public static bool IsValidItem(Item i)
{
if (i is BasePigmentsOfTokuno)
{
return false;
}
var t = i.GetType();
var resource = CraftResource.None;
if (i is BaseWeapon weapon)
{
resource = weapon.Resource;
}
else if (i is BaseArmor armor)
{
resource = armor.Resource;
}
else if (i is BaseClothing clothing)
{
resource = clothing.Resource;
}
if (!CraftResources.IsStandard(resource))
{
return true;
}
return t.InTypeList(TreasuresOfTokuno.TokunoDyable)
|| t.InTypeList(TreasuresOfTokuno.LesserArtifactsTotal)
|| t.InTypeList(TreasuresOfTokuno.GreaterArtifacts)
|| t.InTypeList(DemonKnight.ArtifactRarity10)
|| t.InTypeList(DemonKnight.ArtifactRarity11)
|| t.InTypeList(MondainsLegacy.Artifacts)
|| t.InTypeList(StealableArtifacts.TypesOfEntries)
|| t.InTypeList(Paragon.Artifacts)
|| t.InTypeList(Leviathan.Artifacts)
|| t.InTypeList(TreasureMapChest.Artifacts)
|| t.InTypeList(m_Replicas)
|| t.InTypeList(m_DyableHeritageItems)
|| t.InTypeList(m_Glasses);
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(1);
writer.WriteEncodedInt(m_UsesRemaining);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 1:
{
m_UsesRemaining = reader.ReadEncodedInt();
break;
}
case 0: // Old pigments that inherited from item
{
InheritsItem = true;
if (this is LesserPigmentsOfTokuno)
{
((LesserPigmentsOfTokuno)this).Type = (LesserPigmentType)reader.ReadEncodedInt();
}
else if (this is PigmentsOfTokuno)
{
((PigmentsOfTokuno)this).Type = (PigmentType)reader.ReadEncodedInt();
}
else if (this is MetalPigmentsOfTokuno)
{
reader.ReadEncodedInt();
}
m_UsesRemaining = reader.ReadEncodedInt();
break;
}
}
m_Label = value;
InvalidateProperties();
}
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
m_Label.AddTo(list);
list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~
}
public override void OnDoubleClick(Mobile from)
{
if (IsAccessibleTo(from) && from.InRange(GetWorldLocation(), 3))
{
from.SendLocalizedMessage(1070929); // Select the artifact or enhanced magic item to dye.
from.BeginTarget(3, false, TargetFlags.None, InternalCallback);
}
else
{
from.SendLocalizedMessage(502436); // That is not accessible.
}
}
private void InternalCallback(Mobile from, object targeted)
{
if (Deleted || UsesRemaining <= 0 || !from.InRange(GetWorldLocation(), 3) ||
!IsAccessibleTo(from))
{
return;
}
if (targeted is not Item i)
{
from.SendLocalizedMessage(1070931); // You can only dye artifacts and enhanced magic items with this tub.
}
else if (!from.InRange(i.GetWorldLocation(), 3) || !IsAccessibleTo(from))
{
from.SendLocalizedMessage(502436); // That is not accessible.
}
else if (from.Items.Contains(i))
{
from.SendLocalizedMessage(1070930); // Can't dye artifacts or enhanced magic items that are being worn.
}
else if (i.IsLockedDown)
{
// You may not dye artifacts and enhanced magic items which are locked down.
from.SendLocalizedMessage(1070932);
}
else if (i.QuestItem)
{
from.SendLocalizedMessage(1151836); // You may not dye toggled quest items.
}
else if (i is MetalPigmentsOfTokuno)
{
from.SendLocalizedMessage(1042417); // You cannot dye that.
}
else if (i is LesserPigmentsOfTokuno)
{
from.SendLocalizedMessage(1042417); // You cannot dye that.
}
else if (i is PigmentsOfTokuno)
{
from.SendLocalizedMessage(1042417); // You cannot dye that.
}
else if (!IsValidItem(i))
{
// You can only dye artifacts and enhanced magic items with this tub. //Yes, it says tub on OSI. Don't ask me why ;p
from.SendLocalizedMessage(1070931);
}
else
{
// Notes: on OSI there IS no hue check to see if it's already hued. and no messages on successful hue either
i.Hue = Hue;
if (--UsesRemaining <= 0)
{
Delete();
}
from.PlaySound(0x23E); // As per OSI TC1
}
}
public static bool IsValidItem(Item i)
{
if (i is BasePigmentsOfTokuno)
{
return false;
}
var t = i.GetType();
var resource = CraftResource.None;
if (i is BaseWeapon weapon)
{
resource = weapon.Resource;
}
else if (i is BaseArmor armor)
{
resource = armor.Resource;
}
else if (i is BaseClothing clothing)
{
resource = clothing.Resource;
}
if (!CraftResources.IsStandard(resource))
{
return true;
}
return t.InTypeList(TreasuresOfTokuno.TokunoDyable)
|| t.InTypeList(TreasuresOfTokuno.LesserArtifactsTotal)
|| t.InTypeList(TreasuresOfTokuno.GreaterArtifacts)
|| t.InTypeList(DemonKnight.ArtifactRarity10)
|| t.InTypeList(DemonKnight.ArtifactRarity11)
|| t.InTypeList(MondainsLegacy.Artifacts)
|| t.InTypeList(StealableArtifacts.TypesOfEntries)
|| t.InTypeList(Paragon.Artifacts)
|| t.InTypeList(Leviathan.Artifacts)
|| t.InTypeList(TreasureMapChest.Artifacts)
|| t.InTypeList(m_Replicas)
|| t.InTypeList(m_DyableHeritageItems)
|| t.InTypeList(m_Glasses);
}
}

View file

@ -1,567 +1,376 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class DarkenedSky : Kama
{
public class DarkenedSky : Kama
[Constructible]
public DarkenedSky()
{
[Constructible]
public DarkenedSky()
{
WeaponAttributes.HitLightning = 60;
Attributes.WeaponSpeed = 25;
Attributes.WeaponDamage = 50;
}
public DarkenedSky(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070966; // Darkened Sky
public override void GetDamageTypes(
Mobile wielder, out int phys, out int fire, out int cold, out int pois,
out int nrgy, out int chaos, out int direct
)
{
phys = fire = pois = chaos = direct = 0;
cold = nrgy = 50;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
WeaponAttributes.HitLightning = 60;
Attributes.WeaponSpeed = 25;
Attributes.WeaponDamage = 50;
}
public class KasaOfTheRajin : Kasa
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070966; // Darkened Sky
public override void GetDamageTypes(
Mobile wielder, out int phys, out int fire, out int cold, out int pois,
out int nrgy, out int chaos, out int direct
)
{
[Constructible]
public KasaOfTheRajin() => Attributes.SpellDamage = 12;
public KasaOfTheRajin(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1070969; // Kasa of the Raj-in
public override int BasePhysicalResistance => 12;
public override int BaseFireResistance => 17;
public override int BaseColdResistance => 21;
public override int BasePoisonResistance => 17;
public override int BaseEnergyResistance => 17;
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(2);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
if (version <= 1)
{
MaxHitPoints = 255;
HitPoints = 255;
}
if (version == 0)
{
LootType = LootType.Regular;
}
}
}
public class RuneBeetleCarapace : PlateDo
{
[Constructible]
public RuneBeetleCarapace()
{
Attributes.BonusMana = 10;
Attributes.RegenMana = 3;
Attributes.LowerManaCost = 15;
ArmorAttributes.LowerStatReq = 100;
ArmorAttributes.MageArmor = 1;
}
public RuneBeetleCarapace(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070968; // Rune Beetle Carapace
public override int BaseColdResistance => 14;
public override int BaseEnergyResistance => 14;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class Stormgrip : LeatherNinjaMitts
{
[Constructible]
public Stormgrip()
{
Attributes.BonusInt = 8;
Attributes.Luck = 125;
Attributes.WeaponDamage = 25;
}
public Stormgrip(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070970; // Stormgrip
public override int BasePhysicalResistance => 10;
public override int BaseColdResistance => 18;
public override int BaseEnergyResistance => 18;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class SwordOfTheStampede : NoDachi
{
[Constructible]
public SwordOfTheStampede()
{
WeaponAttributes.HitHarm = 100;
Attributes.AttackChance = 10;
Attributes.WeaponDamage = 60;
}
public SwordOfTheStampede(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070964; // Sword of the Stampede
public override void GetDamageTypes(
Mobile wielder, out int phys, out int fire, out int cold, out int pois,
out int nrgy, out int chaos, out int direct
)
{
phys = fire = pois = nrgy = chaos = direct = 0;
cold = 100;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class SwordsOfProsperity : Daisho
{
[Constructible]
public SwordsOfProsperity()
{
WeaponAttributes.MageWeapon = 30;
Attributes.SpellChanneling = 1;
Attributes.CastSpeed = 1;
Attributes.Luck = 200;
}
public SwordsOfProsperity(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070963; // Swords of Prosperity
public override void GetDamageTypes(
Mobile wielder, out int phys, out int fire, out int cold, out int pois,
out int nrgy, out int chaos, out int direct
)
{
phys = cold = pois = nrgy = chaos = direct = 0;
fire = 100;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class TheHorselord : Yumi
{
[Constructible]
public TheHorselord()
{
Attributes.BonusDex = 5;
Attributes.RegenMana = 1;
Attributes.Luck = 125;
Attributes.WeaponDamage = 50;
Slayer = SlayerName.ElementalBan;
Slayer2 = SlayerName.ReptilianDeath;
}
public TheHorselord(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070967; // The Horselord
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class TomeOfLostKnowledge : Spellbook
{
[Constructible]
public TomeOfLostKnowledge()
{
LootType = LootType.Regular;
Hue = 0x530;
SkillBonuses.SetValues(0, SkillName.Magery, 15.0);
Attributes.BonusInt = 8;
Attributes.LowerManaCost = 15;
Attributes.SpellDamage = 15;
}
public TomeOfLostKnowledge(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1070971; // Tome of Lost Knowledge
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class WindsEdge : Tessen
{
[Constructible]
public WindsEdge()
{
WeaponAttributes.HitLeechMana = 40;
Attributes.WeaponDamage = 50;
Attributes.WeaponSpeed = 50;
Attributes.DefendChance = 10;
}
public WindsEdge(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1070965; // Wind's Edge
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override void GetDamageTypes(
Mobile wielder, out int phys, out int fire, out int cold, out int pois,
out int nrgy, out int chaos, out int direct
)
{
phys = fire = cold = pois = chaos = direct = 0;
nrgy = 100;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public enum PigmentType
{
None,
ParagonGold,
VioletCouragePurple,
InvulnerabilityBlue,
LunaWhite,
DryadGreen,
ShadowDancerBlack,
BerserkerRed,
NoxGreen,
RumRed,
FireOrange,
FadedCoal,
Coal,
FadedGold,
StormBronze,
Rose,
MidnightCoal,
FadedBronze,
FadedRose,
DeepRose
}
public class PigmentsOfTokuno : BasePigmentsOfTokuno
{
private static readonly int[][] m_Table =
{
// Hue, Label
new[]
{
/*PigmentType.None,*/ 0, -1
},
new[]
{
/*PigmentType.ParagonGold,*/ 0x501, 1070987
},
new[]
{
/*PigmentType.VioletCouragePurple,*/ 0x486, 1070988
},
new[]
{
/*PigmentType.InvulnerabilityBlue,*/ 0x4F2, 1070989
},
new[]
{
/*PigmentType.LunaWhite,*/ 0x47E, 1070990
},
new[]
{
/*PigmentType.DryadGreen,*/ 0x48F, 1070991
},
new[]
{
/*PigmentType.ShadowDancerBlack,*/ 0x455, 1070992
},
new[]
{
/*PigmentType.BerserkerRed,*/ 0x21, 1070993
},
new[]
{
/*PigmentType.NoxGreen,*/ 0x58C, 1070994
},
new[]
{
/*PigmentType.RumRed,*/ 0x66C, 1070995
},
new[]
{
/*PigmentType.FireOrange,*/ 0x54F, 1070996
},
new[]
{
/*PigmentType.Fadedcoal,*/ 0x96A, 1079579
},
new[]
{
/*PigmentType.Coal,*/ 0x96B, 1079580
},
new[]
{
/*PigmentType.FadedGold,*/ 0x972, 1079581
},
new[]
{
/*PigmentType.StormBronze,*/ 0x977, 1079582
},
new[]
{
/*PigmentType.Rose,*/ 0x97C, 1079583
},
new[]
{
/*PigmentType.MidnightCoal,*/ 0x96C, 1079584
},
new[]
{
/*PigmentType.FadedBronze,*/ 0x975, 1079585
},
new[]
{
/*PigmentType.FadedRose,*/ 0x97B, 1079586
},
new[]
{
/*PigmentType.DeepRose,*/ 0x97E, 1079587
}
};
private PigmentType m_Type;
[Constructible]
public PigmentsOfTokuno(PigmentType type = PigmentType.None) : this(
type,
type is PigmentType.None or >= PigmentType.FadedCoal ? 10 : 50
)
{
}
[Constructible]
public PigmentsOfTokuno(PigmentType type, int uses) : base(uses)
{
Weight = 1.0;
Type = type;
}
public PigmentsOfTokuno(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public PigmentType Type
{
get => m_Type;
set
{
m_Type = value;
var v = (int)m_Type;
if (v >= 0 && v < m_Table.Length)
{
Hue = m_Table[v][0];
Label = m_Table[v][1];
}
else
{
Hue = 0;
Label = -1;
}
}
}
public override int LabelNumber => 1070933; // Pigments of Tokuno
public static int[] GetInfo(PigmentType type)
{
var v = (int)type;
if (v < 0 || v >= m_Table.Length)
{
v = 0;
}
return m_Table[v];
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(1);
writer.WriteEncodedInt((int)m_Type);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = InheritsItem ? 0 : reader.ReadInt(); // Required for BasePigmentsOfTokuno insertion
switch (version)
{
case 1:
Type = (PigmentType)reader.ReadEncodedInt();
break;
case 0: break;
}
}
phys = fire = pois = chaos = direct = 0;
cold = nrgy = 50;
}
}
[SerializationGenerator(0, false)]
public partial class KasaOfTheRajin : Kasa
{
[Constructible]
public KasaOfTheRajin() => Attributes.SpellDamage = 12;
public override int LabelNumber => 1070969; // Kasa of the Raj-in
public override int BasePhysicalResistance => 12;
public override int BaseFireResistance => 17;
public override int BaseColdResistance => 21;
public override int BasePoisonResistance => 17;
public override int BaseEnergyResistance => 17;
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
}
[SerializationGenerator(0, false)]
public partial class RuneBeetleCarapace : PlateDo
{
[Constructible]
public RuneBeetleCarapace()
{
Attributes.BonusMana = 10;
Attributes.RegenMana = 3;
Attributes.LowerManaCost = 15;
ArmorAttributes.LowerStatReq = 100;
ArmorAttributes.MageArmor = 1;
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070968; // Rune Beetle Carapace
public override int BaseColdResistance => 14;
public override int BaseEnergyResistance => 14;
}
[SerializationGenerator(0, false)]
public partial class Stormgrip : LeatherNinjaMitts
{
[Constructible]
public Stormgrip()
{
Attributes.BonusInt = 8;
Attributes.Luck = 125;
Attributes.WeaponDamage = 25;
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070970; // Stormgrip
public override int BasePhysicalResistance => 10;
public override int BaseColdResistance => 18;
public override int BaseEnergyResistance => 18;
}
[SerializationGenerator(0, false)]
public partial class SwordOfTheStampede : NoDachi
{
[Constructible]
public SwordOfTheStampede()
{
WeaponAttributes.HitHarm = 100;
Attributes.AttackChance = 10;
Attributes.WeaponDamage = 60;
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070964; // Sword of the Stampede
public override void GetDamageTypes(
Mobile wielder, out int phys, out int fire, out int cold, out int pois,
out int nrgy, out int chaos, out int direct
)
{
phys = fire = pois = nrgy = chaos = direct = 0;
cold = 100;
}
}
[SerializationGenerator(0, false)]
public partial class SwordsOfProsperity : Daisho
{
[Constructible]
public SwordsOfProsperity()
{
WeaponAttributes.MageWeapon = 30;
Attributes.SpellChanneling = 1;
Attributes.CastSpeed = 1;
Attributes.Luck = 200;
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070963; // Swords of Prosperity
public override void GetDamageTypes(
Mobile wielder, out int phys, out int fire, out int cold, out int pois,
out int nrgy, out int chaos, out int direct
)
{
phys = cold = pois = nrgy = chaos = direct = 0;
fire = 100;
}
}
[SerializationGenerator(0, false)]
public partial class TheHorselord : Yumi
{
[Constructible]
public TheHorselord()
{
Attributes.BonusDex = 5;
Attributes.RegenMana = 1;
Attributes.Luck = 125;
Attributes.WeaponDamage = 50;
Slayer = SlayerName.ElementalBan;
Slayer2 = SlayerName.ReptilianDeath;
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070967; // The Horselord
}
[SerializationGenerator(0, false)]
public partial class TomeOfLostKnowledge : Spellbook
{
[Constructible]
public TomeOfLostKnowledge()
{
LootType = LootType.Regular;
Hue = 0x530;
SkillBonuses.SetValues(0, SkillName.Magery, 15.0);
Attributes.BonusInt = 8;
Attributes.LowerManaCost = 15;
Attributes.SpellDamage = 15;
}
public override int LabelNumber => 1070971; // Tome of Lost Knowledge
}
[SerializationGenerator(0, false)]
public partial class WindsEdge : Tessen
{
[Constructible]
public WindsEdge()
{
WeaponAttributes.HitLeechMana = 40;
Attributes.WeaponDamage = 50;
Attributes.WeaponSpeed = 50;
Attributes.DefendChance = 10;
}
public override int LabelNumber => 1070965; // Wind's Edge
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override void GetDamageTypes(
Mobile wielder, out int phys, out int fire, out int cold, out int pois,
out int nrgy, out int chaos, out int direct
)
{
phys = fire = cold = pois = chaos = direct = 0;
nrgy = 100;
}
}
public enum PigmentType
{
None,
ParagonGold,
VioletCouragePurple,
InvulnerabilityBlue,
LunaWhite,
DryadGreen,
ShadowDancerBlack,
BerserkerRed,
NoxGreen,
RumRed,
FireOrange,
FadedCoal,
Coal,
FadedGold,
StormBronze,
Rose,
MidnightCoal,
FadedBronze,
FadedRose,
DeepRose
}
[SerializationGenerator(0, false)]
public partial class PigmentsOfTokuno : BasePigmentsOfTokuno
{
private static readonly int[][] _table =
{
// Hue, Label
new[]
{
/*PigmentType.None,*/ 0, -1
},
new[]
{
/*PigmentType.ParagonGold,*/ 0x501, 1070987
},
new[]
{
/*PigmentType.VioletCouragePurple,*/ 0x486, 1070988
},
new[]
{
/*PigmentType.InvulnerabilityBlue,*/ 0x4F2, 1070989
},
new[]
{
/*PigmentType.LunaWhite,*/ 0x47E, 1070990
},
new[]
{
/*PigmentType.DryadGreen,*/ 0x48F, 1070991
},
new[]
{
/*PigmentType.ShadowDancerBlack,*/ 0x455, 1070992
},
new[]
{
/*PigmentType.BerserkerRed,*/ 0x21, 1070993
},
new[]
{
/*PigmentType.NoxGreen,*/ 0x58C, 1070994
},
new[]
{
/*PigmentType.RumRed,*/ 0x66C, 1070995
},
new[]
{
/*PigmentType.FireOrange,*/ 0x54F, 1070996
},
new[]
{
/*PigmentType.Fadedcoal,*/ 0x96A, 1079579
},
new[]
{
/*PigmentType.Coal,*/ 0x96B, 1079580
},
new[]
{
/*PigmentType.FadedGold,*/ 0x972, 1079581
},
new[]
{
/*PigmentType.StormBronze,*/ 0x977, 1079582
},
new[]
{
/*PigmentType.Rose,*/ 0x97C, 1079583
},
new[]
{
/*PigmentType.MidnightCoal,*/ 0x96C, 1079584
},
new[]
{
/*PigmentType.FadedBronze,*/ 0x975, 1079585
},
new[]
{
/*PigmentType.FadedRose,*/ 0x97B, 1079586
},
new[]
{
/*PigmentType.DeepRose,*/ 0x97E, 1079587
}
};
[Constructible]
public PigmentsOfTokuno(PigmentType type = PigmentType.None) : this(
type,
type is PigmentType.None or >= PigmentType.FadedCoal ? 10 : 50
)
{
}
[Constructible]
public PigmentsOfTokuno(PigmentType type, int uses) : base(uses)
{
Weight = 1.0;
Type = type;
}
[SerializableProperty(0)]
[CommandProperty(AccessLevel.GameMaster)]
public PigmentType Type
{
get => _type;
set
{
_type = value;
var v = (int)_type;
if (v >= 0 && v < _table.Length)
{
Hue = _table[v][0];
Label = _table[v][1];
}
else
{
Hue = 0;
Label = -1;
}
}
}
public override int LabelNumber => 1070933; // Pigments of Tokuno
public static int[] GetInfo(PigmentType type)
{
var v = (int)type;
if (v < 0 || v >= _table.Length)
{
v = 0;
}
return _table[v];
}
}

View file

@ -1,8 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ModernUO.Serialization;
using Server.Gumps;
using Server.Items;
using Server.Json;
using Server.Misc;
using Server.Mobiles;
using Server.Multis;
@ -20,8 +23,15 @@ namespace Server.Misc
ToTThree
}
public class ToTConfig
{
public TreasuresOfTokunoEra DropEra { get; set; }
public TreasuresOfTokunoEra RewardEra { get; set; }
}
public static class TreasuresOfTokuno
{
public const string ToTConfigurationPath = "Configuration/tot.json";
public const int ItemsPerReward = 10;
private static readonly Type[][] m_LesserArtifacts =
@ -86,9 +96,45 @@ namespace Server.Misc
typeof(BaseFormTalisman), typeof(BaseWand), typeof(JesterHatofChuckles)
};
public static TreasuresOfTokunoEra DropEra { get; set; } = TreasuresOfTokunoEra.None;
public static void Configure()
{
var pathToTFile = Path.Combine(Core.BaseDirectory, ToTConfigurationPath);
_totConfig = File.Exists(pathToTFile)
? JsonConfig.Deserialize<ToTConfig>(pathToTFile)
: new ToTConfig
{
DropEra = TreasuresOfTokunoEra.None,
RewardEra = TreasuresOfTokunoEra.ToTOne,
};
}
public static TreasuresOfTokunoEra RewardEra { get; set; } = TreasuresOfTokunoEra.ToTOne;
private static ToTConfig _totConfig;
public static TreasuresOfTokunoEra DropEra
{
get => _totConfig.DropEra;
set
{
_totConfig.DropEra = value;
SaveConfiguration();
}
}
public static TreasuresOfTokunoEra RewardEra
{
get => _totConfig.RewardEra;
set
{
_totConfig.RewardEra = value;
SaveConfiguration();
}
}
private static void SaveConfiguration()
{
var pathToTFile = Path.Combine(Core.BaseDirectory, ToTConfigurationPath);
JsonConfig.Serialize(pathToTFile, _totConfig);
}
public static Type[] LesserArtifacts => m_LesserArtifacts[(int)RewardEra - 1];
@ -203,7 +249,8 @@ namespace Server.Misc
namespace Server.Mobiles
{
public class IharaSoko : BaseVendor
[SerializationGenerator(0, false)]
public partial class IharaSoko : BaseVendor
{
protected List<SBInfo> m_SBInfos = new();
@ -215,10 +262,6 @@ namespace Server.Mobiles
Hue = 0x8403;
}
public IharaSoko(Serial serial) : base(serial)
{
}
public override bool IsActiveVendor => false;
public override bool IsInvulnerable => true;
public override bool DisallowAllMoves => true;
@ -243,20 +286,6 @@ namespace Server.Mobiles
AddItem(item);
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
public override bool CanBeDamaged() => false;
public override void OnMovement(Mobile m, Point3D oldLocation)
@ -302,7 +331,7 @@ namespace Server.Mobiles
}
}
var leaveRange = 7;
const int leaveRange = 7;
if (!InRange(m, leaveRange) && InRange(oldLocation, leaveRange))
{

View file

@ -1,65 +0,0 @@
namespace Server.Misc
{
public class TreasuresOfTokunoPersistance : Item
{
public TreasuresOfTokunoPersistance() : base(1)
{
Movable = false;
if (Instance?.Deleted != false)
{
Instance = this;
}
else
{
base.Delete();
}
}
public TreasuresOfTokunoPersistance(Serial serial) : base(serial) => Instance = this;
public static TreasuresOfTokunoPersistance Instance { get; private set; }
public override string DefaultName => "TreasuresOfTokuno Persistance - Internal";
public static void Initialize()
{
if (Instance == null)
{
new TreasuresOfTokunoPersistance();
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.WriteEncodedInt((int)TreasuresOfTokuno.RewardEra);
writer.WriteEncodedInt((int)TreasuresOfTokuno.DropEra);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
TreasuresOfTokuno.RewardEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
TreasuresOfTokuno.DropEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
break;
}
}
}
public override void Delete()
{
}
}
}

View file

@ -0,0 +1,32 @@
using System;
namespace Server.Misc;
[ManualDirtyChecking]
[TypeAlias("Server.Misc.TreasuresOfTokunoPersistance")]
[Obsolete("Deprecated in favor of a configuration file. Only used for legacy deserialization")]
public class TreasuresOfTokunoPersistence : Item
{
public TreasuresOfTokunoPersistence() : base(1) => Movable = false;
public TreasuresOfTokunoPersistence(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
TreasuresOfTokuno.RewardEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
TreasuresOfTokuno.DropEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
Timer.DelayCall(Delete);
}
}

View file

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

View file

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

View file

@ -0,0 +1,14 @@
{
"version": 0,
"type": "Server.Items.AncientUrn",
"properties": [
{
"name": "UrnName",
"type": "string",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,14 @@
{
"version": 0,
"type": "Server.Items.HonorableSwords",
"properties": [
{
"name": "SwordsName",
"type": "string",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

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

View file

@ -0,0 +1,11 @@
{
"version": 0,
"type": "Server.Items.LesserPigmentsOfTokuno",
"properties": [
{
"name": "Type",
"type": "Server.Items.LesserPigmentType",
"rule": "EnumMigrationRule"
}
]
}

View file

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

View file

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

View file

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

View file

@ -0,0 +1,11 @@
{
"version": 0,
"type": "Server.Items.PigmentsOfTokuno",
"properties": [
{
"name": "Type",
"type": "Server.Items.PigmentType",
"rule": "EnumMigrationRule"
}
]
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Mobiles.IharaSoko"
}