fix: Codegens rest of special items (#1467)

This commit is contained in:
Kamron Batman 2023-08-23 20:02:46 -07:00 • committed by GitHub
parent 976680699c
commit f56cb31db6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 1540 additions and 1764 deletions

View file

@ -1,54 +1,37 @@
using Server.Gumps; using ModernUO.Serialization;
using Server.Gumps;
namespace Server.Items namespace Server.Items;
[SerializationGenerator(0)]
public partial class HeritageToken : Item
{ {
public class HeritageToken : Item [Constructible]
public HeritageToken() : base(0x367A)
{ {
[Constructible] LootType = LootType.Blessed;
public HeritageToken() : base(0x367A) Weight = 5.0;
}
public override int LabelNumber => 1076596; // A Heritage Token
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{ {
LootType = LootType.Blessed; from.CloseGump<HeritageTokenGump>();
Weight = 5.0; from.SendGump(new HeritageTokenGump(this));
} }
else
public HeritageToken(Serial serial) : base(serial)
{ {
} from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
public override int LabelNumber => 1076596; // A Heritage Token
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.CloseGump<HeritageTokenGump>();
from.SendGump(new HeritageTokenGump(this));
}
else
{
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
}
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.AddLocalized(1070998, 1076595); // Use this to redeem<br>Your Heritage Items
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
} }
} }
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.AddLocalized(1070998, 1076595); // Use this to redeem<br>Your Heritage Items
}
} }

View file

@ -1,263 +1,204 @@
using System; using System;
using ModernUO.Serialization;
namespace Server.Items namespace Server.Items;
[SerializationGenerator(1, false)]
public partial class MiniHouseAddon : BaseAddon
{ {
public class MiniHouseAddon : BaseAddon [Constructible]
public MiniHouseAddon(MiniHouseType type = MiniHouseType.StoneAndPlaster)
{ {
private MiniHouseType m_Type; _type = type;
[Constructible] Construct();
public MiniHouseAddon(MiniHouseType type = MiniHouseType.StoneAndPlaster) }
[CommandProperty(AccessLevel.GameMaster)]
[SerializableProperty(0)]
public MiniHouseType Type
{
get => _type;
set
{ {
m_Type = type; _type = value;
Construct(); Construct();
this.MarkDirty();
}
}
public override BaseAddonDeed Deed => new MiniHouseDeed(_type);
public void Construct()
{
foreach (var c in Components)
{
c.Addon = null;
c.Delete();
} }
public MiniHouseAddon(Serial serial) : base(serial) this.Clear(Components);
var info = MiniHouseInfo.GetInfo(_type);
var size = (int)Math.Sqrt(info.Graphics.Length);
var num = 0;
for (var y = 0; y < size; ++y)
{ {
} for (var x = 0; x < size; ++x)
[CommandProperty(AccessLevel.GameMaster)]
public MiniHouseType Type
{
get => m_Type;
set
{ {
m_Type = value; if (info.Graphics[num] != 0x1) // Veteran Rewards Mod
Construct();
}
}
public override BaseAddonDeed Deed => new MiniHouseDeed(m_Type);
public void Construct()
{
foreach (var c in Components)
{
c.Addon = null;
c.Delete();
}
this.Clear(Components);
var info = MiniHouseInfo.GetInfo(m_Type);
var size = (int)Math.Sqrt(info.Graphics.Length);
var num = 0;
for (var y = 0; y < size; ++y)
{
for (var x = 0; x < size; ++x)
{ {
if (info.Graphics[num] != 0x1) // Veteran Rewards Mod AddComponent(new AddonComponent(info.Graphics[num++]), size - x - 1, size - y - 1, 0);
{
AddComponent(new AddonComponent(info.Graphics[num++]), size - x - 1, size - y - 1, 0);
}
} }
} }
} }
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write((int)m_Type);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Type = (MiniHouseType)reader.ReadInt();
break;
}
}
}
} }
public class MiniHouseDeed : BaseAddonDeed private void Deserialize(IGenericReader reader, int version)
{ {
private MiniHouseType m_Type; _type = (MiniHouseType)reader.ReadInt();
}
[Constructible] }
public MiniHouseDeed(MiniHouseType type = MiniHouseType.StoneAndPlaster)
{ [SerializationGenerator(1, false)]
m_Type = type; public partial class MiniHouseDeed : BaseAddonDeed
{
Weight = 1.0; [InvalidateProperties]
LootType = LootType.Blessed; [SerializableField(0)]
} [SerializedCommandProperty(AccessLevel.GameMaster)]
private MiniHouseType _type;
public MiniHouseDeed(Serial serial) : base(serial)
{ [Constructible]
} public MiniHouseDeed(MiniHouseType type = MiniHouseType.StoneAndPlaster)
{
[CommandProperty(AccessLevel.GameMaster)] _type = type;
public MiniHouseType Type
{ Weight = 1.0;
get => m_Type; LootType = LootType.Blessed;
set }
{
m_Type = value; public override BaseAddon Addon => new MiniHouseAddon(_type);
InvalidateProperties(); public override int LabelNumber => 1062096; // a mini house deed
}
} public override void GetProperties(IPropertyList list)
{
public override BaseAddon Addon => new MiniHouseAddon(m_Type); base.GetProperties(list);
public override int LabelNumber => 1062096; // a mini house deed
list.Add(MiniHouseInfo.GetInfo(_type).LabelNumber);
public override void GetProperties(IPropertyList list) }
{
base.GetProperties(list); private void Deserialize(IGenericReader reader, int version)
{
list.Add(MiniHouseInfo.GetInfo(m_Type).LabelNumber); _type = (MiniHouseType)reader.ReadInt();
} }
}
public override void Serialize(IGenericWriter writer)
{ public enum MiniHouseType
base.Serialize(writer); {
StoneAndPlaster,
writer.Write(0); // version FieldStone,
SmallBrick,
writer.Write((int)m_Type); Wooden,
} WoodAndPlaster,
ThatchedRoof,
public override void Deserialize(IGenericReader reader) Brick,
{ TwoStoryWoodAndPlaster,
base.Deserialize(reader); TwoStoryStoneAndPlaster,
Tower,
var version = reader.ReadInt(); SmallStoneKeep,
Castle,
switch (version) LargeHouseWithPatio,
{ MarbleHouseWithPatio,
case 0: SmallStoneTower,
{ TwoStoryLogCabin,
m_Type = (MiniHouseType)reader.ReadInt(); TwoStoryVilla,
break; SandstoneHouseWithPatio,
} SmallStoneWorkshop,
} SmallMarbleWorkshop,
MalasMountainPass, // Veteran reward house
if (Weight == 0.0) ChurchAtNight // Veteran reward house
{ }
Weight = 1.0;
} public class MiniHouseInfo
} {
} private static readonly MiniHouseInfo[] m_Info =
{
public enum MiniHouseType /* Stone and plaster house */ new(0x22C4, 1, 1011303),
{ /* Field stone house */ new(0x22DE, 1, 1011304),
StoneAndPlaster, /* Small brick house */ new(0x22DF, 1, 1011305),
FieldStone, /* Wooden house */ new(0x22C9, 1, 1011306),
SmallBrick, /* Wood and plaster house */ new(0x22E0, 1, 1011307),
Wooden, /* Thatched-roof cottage */ new(0x22E1, 1, 1011308),
WoodAndPlaster, /* Brick house */ new(1011309, 0x22CD, 0x22CB, 0x22CC, 0x22CA),
ThatchedRoof, /* Two-story wood and plaster house */ new(1011310, 0x2301, 0x2302, 0x2304, 0x2303),
Brick, /* Two-story stone and plaster house */ new(1011311, 0x22FC, 0x22FD, 0x22FF, 0x22FE),
TwoStoryWoodAndPlaster, /* Tower */ new(1011312, 0x22F7, 0x22F8, 0x22FA, 0x22F9),
TwoStoryStoneAndPlaster, /* Small stone keep */ new(0x22E6, 9, 1011313),
Tower, /* Castle */
SmallStoneKeep, new(
Castle, 1011314,
LargeHouseWithPatio, 0x22CE,
MarbleHouseWithPatio, 0x22D0,
SmallStoneTower, 0x22D2,
TwoStoryLogCabin, 0x22D7,
TwoStoryVilla, 0x22CF,
SandstoneHouseWithPatio, 0x22D1,
SmallStoneWorkshop, 0x22D4,
SmallMarbleWorkshop, 0x22D9,
MalasMountainPass, // Veteran reward house 0x22D3,
ChurchAtNight // Veteran reward house 0x22D5,
} 0x22D6,
0x22DB,
public class MiniHouseInfo 0x22D8,
{ 0x22DA,
private static readonly MiniHouseInfo[] m_Info = 0x22DC,
{ 0x22DD
/* Stone and plaster house */ new(0x22C4, 1, 1011303), ),
/* Field stone house */ new(0x22DE, 1, 1011304), /* Large house with patio */ new(0x22E2, 4, 1011315),
/* Small brick house */ new(0x22DF, 1, 1011305), /* Marble house with patio */ new(0x22EF, 4, 1011316),
/* Wooden house */ new(0x22C9, 1, 1011306), /* Small stone tower */ new(0x22F5, 1, 1011317),
/* Wood and plaster house */ new(0x22E0, 1, 1011307), /* Two-story log cabin */ new(0x22FB, 1, 1011318),
/* Thatched-roof cottage */ new(0x22E1, 1, 1011308), /* Two-story villa */ new(0x2300, 1, 1011319),
/* Brick house */ new(1011309, 0x22CD, 0x22CB, 0x22CC, 0x22CA), /* Sandstone house with patio */ new(0x22F3, 1, 1011320),
/* Two-story wood and plaster house */ new(1011310, 0x2301, 0x2302, 0x2304, 0x2303), /* Small stone workshop */ new(0x22F6, 1, 1011321),
/* Two-story stone and plaster house */ new(1011311, 0x22FC, 0x22FD, 0x22FF, 0x22FE), /* Small marble workshop */ new(0x22F4, 1, 1011322),
/* Tower */ new(1011312, 0x22F7, 0x22F8, 0x22FA, 0x22F9), /* Malas Mountain Pass */ new(1062692, 0x2316, 0x2315, 0x2314, 0x2313),
/* Small stone keep */ new(0x22E6, 9, 1011313), /* Church At Night */ new(1072215, 0x2318, 0x2317, 0x2319, 0x1)
/* Castle */ };
new(
1011314, public MiniHouseInfo(int start, int count, int labelNumber)
0x22CE, {
0x22D0, Graphics = new int[count];
0x22D2,
0x22D7, for (var i = 0; i < count; ++i)
0x22CF, {
0x22D1, Graphics[i] = start + i;
0x22D4, }
0x22D9,
0x22D3, LabelNumber = labelNumber;
0x22D5, }
0x22D6,
0x22DB, public MiniHouseInfo(int labelNumber, params int[] graphics)
0x22D8, {
0x22DA, LabelNumber = labelNumber;
0x22DC, Graphics = graphics;
0x22DD }
),
/* Large house with patio */ new(0x22E2, 4, 1011315), public int[] Graphics { get; }
/* Marble house with patio */ new(0x22EF, 4, 1011316),
/* Small stone tower */ new(0x22F5, 1, 1011317), public int LabelNumber { get; }
/* Two-story log cabin */ new(0x22FB, 1, 1011318),
/* Two-story villa */ new(0x2300, 1, 1011319), public static MiniHouseInfo GetInfo(MiniHouseType type)
/* Sandstone house with patio */ new(0x22F3, 1, 1011320), {
/* Small stone workshop */ new(0x22F6, 1, 1011321), var v = (int)type;
/* Small marble workshop */ new(0x22F4, 1, 1011322),
/* Malas Mountain Pass */ new(1062692, 0x2316, 0x2315, 0x2314, 0x2313), if (v < 0 || v >= m_Info.Length)
/* Church At Night */ new(1072215, 0x2318, 0x2317, 0x2319, 0x1) {
}; v = 0;
}
public MiniHouseInfo(int start, int count, int labelNumber)
{ return m_Info[v];
Graphics = new int[count];
for (var i = 0; i < count; ++i)
{
Graphics[i] = start + i;
}
LabelNumber = labelNumber;
}
public MiniHouseInfo(int labelNumber, params int[] graphics)
{
LabelNumber = labelNumber;
Graphics = graphics;
}
public int[] Graphics { get; }
public int LabelNumber { get; }
public static MiniHouseInfo GetInfo(MiniHouseType type)
{
var v = (int)type;
if (v < 0 || v >= m_Info.Length)
{
v = 0;
}
return m_Info[v];
}
} }
} }

View file

@ -1,332 +1,278 @@
using System; using System;
using ModernUO.Serialization;
using Server.Engines.VeteranRewards; using Server.Engines.VeteranRewards;
using Server.Gumps; using Server.Gumps;
using Server.Multis; using Server.Multis;
using Server.Network; using Server.Network;
namespace Server.Items namespace Server.Items;
public enum MonsterStatuetteType
{ {
public enum MonsterStatuetteType Crocodile,
Daemon,
Dragon,
EarthElemental,
Ettin,
Gargoyle,
Gorilla,
Lich,
Lizardman,
Ogre,
Orc,
Ratman,
Skeleton,
Troll,
Cow,
Zombie,
Llama,
Ophidian,
Reaper,
Mongbat,
Gazer,
FireElemental,
Wolf,
PhillipsWoodenSteed,
Seahorse,
Harrower,
Efreet,
Slime,
PlagueBeast,
RedDeath,
Spider,
OphidianArchMage,
OphidianWarrior,
OphidianKnight,
OphidianMage,
DreadHorn,
Minotaur,
BlackCat,
HalloweenGhoul,
Santa
}
public class MonsterStatuetteInfo
{
private static readonly MonsterStatuetteInfo[] m_Table =
{ {
Crocodile, /* Crocodile */ new(1041249, 0x20DA, 660),
Daemon, /* Daemon */ new(1041250, 0x20D3, 357),
Dragon, /* Dragon */ new(1041251, 0x20D6, 362),
EarthElemental, /* EarthElemental */ new(1041252, 0x20D7, 268),
Ettin, /* Ettin */ new(1041253, 0x20D8, 367),
Gargoyle, /* Gargoyle */ new(1041254, 0x20D9, 372),
Gorilla, /* Gorilla */ new(1041255, 0x20F5, 158),
Lich, /* Lich */ new(1041256, 0x20F8, 1001),
Lizardman, /* Lizardman */ new(1041257, 0x20DE, 417),
Ogre, /* Ogre */ new(1041258, 0x20DF, 427),
Orc, /* Orc */ new(1041259, 0x20E0, 1114),
Ratman, /* Ratman */ new(1041260, 0x20E3, 437),
Skeleton, /* Skeleton */ new(1041261, 0x20E7, 1165),
Troll, /* Troll */ new(1041262, 0x20E9, 461),
Cow, /* Cow */ new(1041263, 0x2103, 120),
Zombie, /* Zombie */ new(1041264, 0x20EC, 471),
Llama, /* Llama */ new(1041265, 0x20F6, 1011),
Ophidian, /* Ophidian */ new(1049742, 0x2133, 634),
Reaper, /* Reaper */ new(1049743, 0x20FA, 442),
Mongbat, /* Mongbat */ new(1049744, 0x20F9, 422),
Gazer, /* Gazer */ new(1049768, 0x20F4, 377),
FireElemental, /* FireElemental */ new(1049769, 0x20F3, 838),
Wolf, /* Wolf */ new(1049770, 0x2122, 229),
PhillipsWoodenSteed, /* Phillip's Steed */ new(1063488, 0x3FFE, 168),
Seahorse, /* Seahorse */ new(1070819, 0x25BA, 138),
Harrower, /* Harrower */ new(1080520, 0x25BB, new[] { 0x289, 0x28A, 0x28B }),
Efreet, /* Efreet */ new(1080521, 0x2590, 0x300),
Slime, /* Slime */ new(1015246, 0x20E8, 456),
PlagueBeast, /* PlagueBeast */ new(1029747, 0x2613, 0x1BF),
RedDeath, /* RedDeath */ new(1094932, 0x2617, Array.Empty<int>()),
Spider, /* Spider */ new(1029668, 0x25C4, 1170),
OphidianArchMage, /* OphidianArchMage */ new(1029641, 0x25A9, 639),
OphidianWarrior, /* OphidianWarrior */ new(1029645, 0x25AD, 634),
OphidianKnight, /* OphidianKnight */ new(1029642, 0x25aa, 634),
OphidianMage, /* OphidianMage */ new(1029643, 0x25ab, 639),
DreadHorn, /* DreadHorn */ new(1031651, 0x2D83, 0xA8),
Minotaur, /* Minotaur */ new(1031657, 0x2D89, 0x596),
BlackCat, /* Black Cat */ new(1096928, 0x4688, 0x69),
HalloweenGhoul, /* HalloweenGhoul */ new(1076782, 0x2109, 0x482),
Santa /* Santa */ new(1097968, 0x4A98, 0x669)
};
public MonsterStatuetteInfo(int labelNumber, int itemID, int baseSoundID)
{
LabelNumber = labelNumber;
ItemID = itemID;
Sounds = new[] { baseSoundID, baseSoundID + 1, baseSoundID + 2, baseSoundID + 3, baseSoundID + 4 };
} }
public class MonsterStatuetteInfo public MonsterStatuetteInfo(int labelNumber, int itemID, int[] sounds)
{ {
private static readonly MonsterStatuetteInfo[] m_Table = LabelNumber = labelNumber;
ItemID = itemID;
Sounds = sounds;
}
public int LabelNumber { get; }
public int ItemID { get; }
public int[] Sounds { get; }
public static MonsterStatuetteInfo GetInfo(MonsterStatuetteType type)
{
var v = (int)type;
if (v < 0 || v >= m_Table.Length)
{ {
/* Crocodile */ new(1041249, 0x20DA, 660), v = 0;
/* Daemon */ new(1041250, 0x20D3, 357), }
/* Dragon */ new(1041251, 0x20D6, 362),
/* EarthElemental */ new(1041252, 0x20D7, 268), return m_Table[v];
/* Ettin */ new(1041253, 0x20D8, 367), }
/* Gargoyle */ new(1041254, 0x20D9, 372), }
/* Gorilla */ new(1041255, 0x20F5, 158),
/* Lich */ new(1041256, 0x20F8, 1001), [SerializationGenerator(0, false)]
/* Lizardman */ new(1041257, 0x20DE, 417), public partial class MonsterStatuette : Item, IRewardItem
/* Ogre */ new(1041258, 0x20DF, 427), {
/* Orc */ new(1041259, 0x20E0, 1114), [InvalidateProperties]
/* Ratman */ new(1041260, 0x20E3, 437), [SerializableField(1)]
/* Skeleton */ new(1041261, 0x20E7, 1165), [SerializedCommandProperty(AccessLevel.GameMaster)]
/* Troll */ new(1041262, 0x20E9, 461), private bool _turnedOn;
/* Cow */ new(1041263, 0x2103, 120),
/* Zombie */ new(1041264, 0x20EC, 471), [InvalidateProperties]
/* Llama */ new(1041265, 0x20F6, 1011), [SerializableField(2)]
/* Ophidian */ new(1049742, 0x2133, 634), [SerializedCommandProperty(AccessLevel.GameMaster)]
/* Reaper */ new(1049743, 0x20FA, 442), private bool _isRewardItem;
/* Mongbat */ new(1049744, 0x20F9, 422),
/* Gazer */ new(1049768, 0x20F4, 377), [Constructible]
/* FireElemental */ new(1049769, 0x20F3, 838), public MonsterStatuette(MonsterStatuetteType type = MonsterStatuetteType.Crocodile) : base(
/* Wolf */ new(1049770, 0x2122, 229), MonsterStatuetteInfo.GetInfo(type).ItemID
/* Phillip's Steed */ new(1063488, 0x3FFE, 168), )
/* Seahorse */ new(1070819, 0x25BA, 138), {
/* Harrower */ new(1080520, 0x25BB, new[] { 0x289, 0x28A, 0x28B }), LootType = LootType.Blessed;
/* Efreet */ new(1080521, 0x2590, 0x300),
/* Slime */ new(1015246, 0x20E8, 456), _type = type;
/* PlagueBeast */ new(1029747, 0x2613, 0x1BF),
/* RedDeath */ new(1094932, 0x2617, Array.Empty<int>()), Hue = GetStatuetteHue(type);
/* Spider */ new(1029668, 0x25C4, 1170), }
/* OphidianArchMage */ new(1029641, 0x25A9, 639),
/* OphidianWarrior */ new(1029645, 0x25AD, 634), public static int GetStatuetteHue(MonsterStatuetteType type, int fallback = 0) =>
/* OphidianKnight */ new(1029642, 0x25aa, 634), type switch
/* OphidianMage */ new(1029643, 0x25ab, 639), {
/* DreadHorn */ new(1031651, 0x2D83, 0xA8), MonsterStatuetteType.Slime => Utility.RandomSlimeHue(),
/* Minotaur */ new(1031657, 0x2D89, 0x596), MonsterStatuetteType.RedDeath => 0x21,
/* Black Cat */ new(1096928, 0x4688, 0x69), MonsterStatuetteType.HalloweenGhoul => 0xF4,
/* HalloweenGhoul */ new(1076782, 0x2109, 0x482), _ => fallback
/* Santa */ new(1097968, 0x4A98, 0x669)
}; };
public MonsterStatuetteInfo(int labelNumber, int itemID, int baseSoundID) [SerializableProperty(0)]
[CommandProperty(AccessLevel.GameMaster)]
public MonsterStatuetteType Type
{
get => _type;
set
{ {
LabelNumber = labelNumber; _type = value;
ItemID = itemID; ItemID = MonsterStatuetteInfo.GetInfo(_type).ItemID;
Sounds = new[] { baseSoundID, baseSoundID + 1, baseSoundID + 2, baseSoundID + 3, baseSoundID + 4 };
}
public MonsterStatuetteInfo(int labelNumber, int itemID, int[] sounds) Hue = GetStatuetteHue(_type, Hue);
{
LabelNumber = labelNumber;
ItemID = itemID;
Sounds = sounds;
}
public int LabelNumber { get; } InvalidateProperties();
this.MarkDirty();
public int ItemID { get; }
public int[] Sounds { get; }
public static MonsterStatuetteInfo GetInfo(MonsterStatuetteType type)
{
var v = (int)type;
if (v < 0 || v >= m_Table.Length)
{
v = 0;
}
return m_Table[v];
} }
} }
public class MonsterStatuette : Item, IRewardItem public override int LabelNumber => MonsterStatuetteInfo.GetInfo(_type).LabelNumber;
public override double DefaultWeight => 1.0;
public override bool HandlesOnMovement => _turnedOn && IsLockedDown;
public override void OnMovement(Mobile m, Point3D oldLocation)
{ {
private bool m_TurnedOn; if (_turnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) &&
private MonsterStatuetteType m_Type; Utility.InRange(m.Location, Location, 2) && !Utility.InRange(oldLocation, Location, 2))
[Constructible]
public MonsterStatuette(MonsterStatuetteType type = MonsterStatuetteType.Crocodile) : base(
MonsterStatuetteInfo.GetInfo(type).ItemID
)
{ {
LootType = LootType.Blessed; var sounds = MonsterStatuetteInfo.GetInfo(_type).Sounds;
m_Type = type; if (sounds.Length > 0)
if (m_Type == MonsterStatuetteType.Slime)
{ {
Hue = Utility.RandomSlimeHue(); Effects.PlaySound(Location, Map, sounds.RandomElement());
}
else if (m_Type == MonsterStatuetteType.RedDeath)
{
Hue = 0x21;
}
else if (m_Type == MonsterStatuetteType.HalloweenGhoul)
{
Hue = 0xF4;
} }
} }
public MonsterStatuette(Serial serial) : base(serial) base.OnMovement(m, oldLocation);
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (Core.ML && IsRewardItem)
{ {
list.Add(RewardSystem.GetRewardYearLabel(this, new object[] { _type })); // X Year Veteran Reward
} }
[CommandProperty(AccessLevel.GameMaster)] if (_turnedOn)
public bool TurnedOn
{ {
get => m_TurnedOn; list.Add(502695); // turned on
set }
{ else
m_TurnedOn = value; {
InvalidateProperties(); list.Add(502696); // turned off
} }
}
public bool IsOwner(Mobile mob) => BaseHouse.FindHouseAt(this)?.IsOwner(mob) == true;
public override void OnDoubleClick(Mobile from)
{
if (IsOwner(from))
{
var onOffGump = new OnOffGump(this);
from.SendGump(onOffGump);
}
else
{
from.SendLocalizedMessage(502691); // You must be the owner to use this.
}
}
private class OnOffGump : Gump
{
private readonly MonsterStatuette m_Statuette;
public OnOffGump(MonsterStatuette statuette) : base(150, 200)
{
m_Statuette = statuette;
AddBackground(0, 0, 300, 150, 0xA28);
AddHtmlLocalized(45, 20, 300, 35, statuette.TurnedOn ? 1011035 : 1011034); // [De]Activate this item
AddButton(40, 53, 0xFA5, 0xFA7, 1);
AddHtmlLocalized(80, 55, 65, 35, 1011036); // OKAY
AddButton(150, 53, 0xFA5, 0xFA7, 0);
AddHtmlLocalized(190, 55, 100, 35, 1011012); // CANCEL
} }
[CommandProperty(AccessLevel.GameMaster)] public override void OnResponse(NetState sender, RelayInfo info)
public MonsterStatuetteType Type
{ {
get => m_Type; var from = sender.Mobile;
set
if (info.ButtonID == 1)
{ {
m_Type = value; var newValue = !m_Statuette.TurnedOn;
ItemID = MonsterStatuetteInfo.GetInfo(m_Type).ItemID; m_Statuette.TurnedOn = newValue;
if (m_Type == MonsterStatuetteType.Slime) if (newValue && !m_Statuette.IsLockedDown)
{ {
Hue = Utility.RandomSlimeHue(); from.SendLocalizedMessage(502693); // Remember, this only works when locked down.
} }
else if (m_Type == MonsterStatuetteType.RedDeath)
{
Hue = 0x21;
}
else if (m_Type == MonsterStatuetteType.HalloweenGhoul)
{
Hue = 0xF4;
}
else
{
Hue = 0;
}
InvalidateProperties();
}
}
public override int LabelNumber => MonsterStatuetteInfo.GetInfo(m_Type).LabelNumber;
public override double DefaultWeight => 1.0;
public override bool HandlesOnMovement => m_TurnedOn && IsLockedDown;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem { get; set; }
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (m_TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) &&
Utility.InRange(m.Location, Location, 2) && !Utility.InRange(oldLocation, Location, 2))
{
var sounds = MonsterStatuetteInfo.GetInfo(m_Type).Sounds;
if (sounds.Length > 0)
{
Effects.PlaySound(Location, Map, sounds.RandomElement());
}
}
base.OnMovement(m, oldLocation);
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (Core.ML && IsRewardItem)
{
list.Add(RewardSystem.GetRewardYearLabel(this, new object[] { m_Type })); // X Year Veteran Reward
}
if (m_TurnedOn)
{
list.Add(502695); // turned on
} }
else else
{ {
list.Add(502696); // turned off from.SendLocalizedMessage(502694); // Cancelled action.
}
}
public bool IsOwner(Mobile mob) => BaseHouse.FindHouseAt(this)?.IsOwner(mob) == true;
public override void OnDoubleClick(Mobile from)
{
if (IsOwner(from))
{
var onOffGump = new OnOffGump(this);
from.SendGump(onOffGump);
}
else
{
from.SendLocalizedMessage(502691); // You must be the owner to use this.
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.WriteEncodedInt((int)m_Type);
writer.Write(m_TurnedOn);
writer.Write(IsRewardItem);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Type = (MonsterStatuetteType)reader.ReadEncodedInt();
m_TurnedOn = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}
}
private class OnOffGump : Gump
{
private readonly MonsterStatuette m_Statuette;
public OnOffGump(MonsterStatuette statuette) : base(150, 200)
{
m_Statuette = statuette;
AddBackground(0, 0, 300, 150, 0xA28);
AddHtmlLocalized(45, 20, 300, 35, statuette.TurnedOn ? 1011035 : 1011034); // [De]Activate this item
AddButton(40, 53, 0xFA5, 0xFA7, 1);
AddHtmlLocalized(80, 55, 65, 35, 1011036); // OKAY
AddButton(150, 53, 0xFA5, 0xFA7, 0);
AddHtmlLocalized(190, 55, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
{
var from = sender.Mobile;
if (info.ButtonID == 1)
{
var newValue = !m_Statuette.TurnedOn;
m_Statuette.TurnedOn = newValue;
if (newValue && !m_Statuette.IsLockedDown)
{
from.SendLocalizedMessage(502693); // Remember, this only works when locked down.
}
}
else
{
from.SendLocalizedMessage(502694); // Cancelled action.
}
} }
} }
} }

View file

@ -1,62 +1,45 @@
namespace Server.Items using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class RewardCake : Item
{ {
public class RewardCake : Item [Constructible]
public RewardCake() : base(0x9e9)
{ {
[Constructible] Stackable = false;
public RewardCake() : base(0x9e9) Weight = 1.0;
Hue = Utility.RandomList(
0x135,
0xcd,
0x38,
0x3b,
0x42,
0x4f,
0x11e,
0x60,
0x317,
0x10,
0x136,
0x1f9,
0x1a,
0xeb,
0x86,
0x2e
);
LootType = LootType.Blessed;
}
public override int LabelNumber => 1049786; // Happy Birthday! ...
public override bool DisplayLootType => false;
public override void OnDoubleClick(Mobile from)
{
if (!from.InRange(GetWorldLocation(), 1))
{ {
Stackable = false; from.LocalOverheadMessage(MessageType.Regular, 906, 1019045); // I can't reach that.
Weight = 1.0;
Hue = Utility.RandomList(
0x135,
0xcd,
0x38,
0x3b,
0x42,
0x4f,
0x11e,
0x60,
0x317,
0x10,
0x136,
0x1f9,
0x1a,
0xeb,
0x86,
0x2e
);
LootType = LootType.Blessed;
}
public RewardCake(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1049786; // Happy Birthday! ...
public override bool DisplayLootType => false;
public override void OnDoubleClick(Mobile from)
{
if (!from.InRange(GetWorldLocation(), 1))
{
from.LocalOverheadMessage(MessageType.Regular, 906, 1019045); // I can't reach that.
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
LootType = LootType.Blessed;
var version = reader.ReadInt();
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -93,9 +93,13 @@ public partial class Banner : Item, IAddon, IDyable, IRewardItem
} }
} }
public class BannerDeed : Item, IRewardItem [SerializationGenerator(0)]
public partial class BannerDeed : Item, IRewardItem
{ {
private bool m_IsRewardItem; [InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _isRewardItem;
[Constructible] [Constructible]
public BannerDeed() : base(0x14F0) public BannerDeed() : base(0x14F0)
@ -104,28 +108,13 @@ public class BannerDeed : Item, IRewardItem
Weight = 1.0; Weight = 1.0;
} }
public BannerDeed(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1041007; // a banner deed public override int LabelNumber => 1041007; // a banner deed
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem
{
get => m_IsRewardItem;
set
{
m_IsRewardItem = value;
InvalidateProperties();
}
}
public override void GetProperties(IPropertyList list) public override void GetProperties(IPropertyList list)
{ {
base.GetProperties(list); base.GetProperties(list);
if (m_IsRewardItem) if (_isRewardItem)
{ {
list.Add(1076218); // 2nd Year Veteran Reward list.Add(1076218); // 2nd Year Veteran Reward
} }
@ -133,7 +122,7 @@ public class BannerDeed : Item, IRewardItem
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this)) if (_isRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
{ {
return; return;
} }
@ -158,34 +147,16 @@ public class BannerDeed : Item, IRewardItem
} }
} }
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write(m_IsRewardItem);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
private class InternalGump : Gump private class InternalGump : Gump
{ {
public const int Start = 0x15AE; public const int Start = 0x15AE;
public const int End = 0x15F4; public const int End = 0x15F4;
private readonly BannerDeed m_Banner; private readonly BannerDeed _banner;
public InternalGump(BannerDeed banner) : base(100, 200) public InternalGump(BannerDeed banner) : base(100, 200)
{ {
m_Banner = banner; _banner = banner;
Closable = true; Closable = true;
Disposable = true; Disposable = true;
@ -224,7 +195,7 @@ public class BannerDeed : Item, IRewardItem
public override void OnResponse(NetState sender, RelayInfo info) public override void OnResponse(NetState sender, RelayInfo info)
{ {
if (m_Banner?.Deleted != false) if (_banner?.Deleted != false)
{ {
return; return;
} }
@ -237,93 +208,89 @@ public class BannerDeed : Item, IRewardItem
} }
m.SendLocalizedMessage(1042037); // Where would you like to place this banner? m.SendLocalizedMessage(1042037); // Where would you like to place this banner?
m.Target = new InternalTarget(m_Banner, info.ButtonID); m.Target = new InternalTarget(_banner, info.ButtonID);
} }
} }
private class InternalTarget : Target private class InternalTarget : Target
{ {
private readonly BannerDeed m_Banner; private readonly BannerDeed _banner;
private readonly int m_ItemID; private readonly int _itemID;
public InternalTarget(BannerDeed banner, int itemID) : base(-1, true, TargetFlags.None) public InternalTarget(BannerDeed banner, int itemID) : base(-1, true, TargetFlags.None)
{ {
m_Banner = banner; _banner = banner;
m_ItemID = itemID; _itemID = itemID;
} }
protected override void OnTarget(Mobile from, object targeted) protected override void OnTarget(Mobile from, object targeted)
{ {
if (m_Banner?.Deleted != false) if (_banner?.Deleted != false)
{ {
return; return;
} }
if (m_Banner.IsChildOf(from.Backpack)) if (!_banner.IsChildOf(from.Backpack))
{ {
var house = BaseHouse.FindHouseAt(from); from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
return;
}
if (house?.IsOwner(from) == true) var house = BaseHouse.FindHouseAt(from);
{
var p = targeted as IPoint3D;
var map = from.Map;
if (p == null || map == null) if (house?.IsOwner(from) != true)
{ {
return; from.SendLocalizedMessage(502092); // You must be in your house to do this.
} return;
}
var p3d = new Point3D(p); var p = targeted as IPoint3D;
var id = TileData.ItemTable[m_ItemID & TileData.MaxItemValue]; var map = from.Map;
if (map.CanFit(p3d, id.Height)) if (p == null || map == null)
{ {
house = BaseHouse.FindHouseAt(p3d, map, id.Height); return;
}
if (house?.IsOwner(from) == true) var p3d = new Point3D(p);
{ var id = TileData.ItemTable[_itemID & TileData.MaxItemValue];
var north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
var west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
if (north && west) if (!map.CanFit(p3d, id.Height))
{ {
from.CloseGump<FacingGump>(); from.SendLocalizedMessage(500269); // You cannot build that there.
from.SendGump(new FacingGump(m_Banner, m_ItemID, p3d, house)); return;
} }
else if (north || west)
{
var banner = new Banner(m_ItemID + (west ? 0 : 1));
house.Addons.Add(banner); house = BaseHouse.FindHouseAt(p3d, map, id.Height);
banner.IsRewardItem = m_Banner.IsRewardItem; if (house?.IsOwner(from) != true)
banner.MoveToWorld(p3d, map); {
from.SendLocalizedMessage(1042036); // That location is not in your house.
return;
}
m_Banner.Delete(); var north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
} var west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
else
{ if (north && west)
from.SendLocalizedMessage(1042039); // The banner must be placed next to a wall. {
} from.CloseGump<FacingGump>();
} from.SendGump(new FacingGump(_banner, _itemID, p3d, house));
else }
{ else if (north || west)
from.SendLocalizedMessage(1042036); // That location is not in your house. {
} var banner = new Banner(_itemID + (west ? 0 : 1));
}
else house.Addons.Add(banner);
{
from.SendLocalizedMessage(500269); // You cannot build that there. banner.IsRewardItem = _banner.IsRewardItem;
} banner.MoveToWorld(p3d, map);
}
else _banner.Delete();
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
}
} }
else else
{ {
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it. from.SendLocalizedMessage(1042039); // The banner must be placed next to a wall.
} }
} }

View file

@ -47,10 +47,6 @@ public partial class StoneAnkh : BaseAddon, IRewardItem
} }
} }
public StoneAnkh(Serial serial) : base(serial)
{
}
public override BaseAddonDeed Deed => public override BaseAddonDeed Deed =>
new StoneAnkhDeed new StoneAnkhDeed
{ {

View file

@ -0,0 +1,14 @@
{
"version": 0,
"type": "Server.Items.BannerDeed",
"properties": [
{
"name": "IsRewardItem",
"type": "bool",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,27 @@
{
"version": 0,
"type": "Server.Items.MonsterStatuette",
"properties": [
{
"name": "Type",
"type": "Server.Items.MonsterStatuetteType",
"rule": "EnumMigrationRule"
},
{
"name": "TurnedOn",
"type": "bool",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "IsRewardItem",
"type": "bool",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

@ -0,0 +1,14 @@
{
"version": 0,
"type": "Server.Items.RedSoulstone",
"properties": [
{
"name": "IsRewardItem",
"type": "bool",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

@ -0,0 +1,56 @@
{
"version": 4,
"type": "Server.Items.SoulStone",
"properties": [
{
"name": "LastUserName",
"type": "string",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Level",
"type": "Server.Multis.SecureLevel",
"rule": "EnumMigrationRule"
},
{
"name": "ActiveItemID",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "InactiveItemID",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Account",
"type": "string",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Skill",
"type": "Server.SkillName",
"rule": "EnumMigrationRule"
},
{
"name": "SkillValue",
"type": "double",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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