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]
public HeritageToken() : base(0x367A)
LootType = LootType.Blessed;
Weight = 5.0;
}
public override int LabelNumber => 1076596; // A Heritage Token
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
LootType = LootType.Blessed;
Weight = 5.0;
from.CloseGump<HeritageTokenGump>();
from.SendGump(new HeritageTokenGump(this));
}
public HeritageToken(Serial serial) : base(serial)
else
{
}
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();
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
}
}

View file

@ -1,263 +1,204 @@
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]
public MiniHouseAddon(MiniHouseType type = MiniHouseType.StoneAndPlaster)
Construct();
}
[CommandProperty(AccessLevel.GameMaster)]
[SerializableProperty(0)]
public MiniHouseType Type
{
get => _type;
set
{
m_Type = type;
_type = value;
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)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public MiniHouseType Type
{
get => m_Type;
set
for (var x = 0; x < size; ++x)
{
m_Type = value;
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
{
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;
[Constructible]
public MiniHouseDeed(MiniHouseType type = MiniHouseType.StoneAndPlaster)
{
m_Type = type;
Weight = 1.0;
LootType = LootType.Blessed;
}
public MiniHouseDeed(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public MiniHouseType Type
{
get => m_Type;
set
{
m_Type = value;
InvalidateProperties();
}
}
public override BaseAddon Addon => new MiniHouseAddon(m_Type);
public override int LabelNumber => 1062096; // a mini house deed
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(MiniHouseInfo.GetInfo(m_Type).LabelNumber);
}
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;
}
}
if (Weight == 0.0)
{
Weight = 1.0;
}
}
}
public enum MiniHouseType
{
StoneAndPlaster,
FieldStone,
SmallBrick,
Wooden,
WoodAndPlaster,
ThatchedRoof,
Brick,
TwoStoryWoodAndPlaster,
TwoStoryStoneAndPlaster,
Tower,
SmallStoneKeep,
Castle,
LargeHouseWithPatio,
MarbleHouseWithPatio,
SmallStoneTower,
TwoStoryLogCabin,
TwoStoryVilla,
SandstoneHouseWithPatio,
SmallStoneWorkshop,
SmallMarbleWorkshop,
MalasMountainPass, // Veteran reward house
ChurchAtNight // Veteran reward house
}
public class MiniHouseInfo
{
private static readonly MiniHouseInfo[] m_Info =
{
/* Stone and plaster house */ new(0x22C4, 1, 1011303),
/* Field stone house */ new(0x22DE, 1, 1011304),
/* Small brick house */ new(0x22DF, 1, 1011305),
/* Wooden house */ new(0x22C9, 1, 1011306),
/* Wood and plaster house */ new(0x22E0, 1, 1011307),
/* Thatched-roof cottage */ new(0x22E1, 1, 1011308),
/* Brick house */ new(1011309, 0x22CD, 0x22CB, 0x22CC, 0x22CA),
/* Two-story wood and plaster house */ new(1011310, 0x2301, 0x2302, 0x2304, 0x2303),
/* Two-story stone and plaster house */ new(1011311, 0x22FC, 0x22FD, 0x22FF, 0x22FE),
/* Tower */ new(1011312, 0x22F7, 0x22F8, 0x22FA, 0x22F9),
/* Small stone keep */ new(0x22E6, 9, 1011313),
/* Castle */
new(
1011314,
0x22CE,
0x22D0,
0x22D2,
0x22D7,
0x22CF,
0x22D1,
0x22D4,
0x22D9,
0x22D3,
0x22D5,
0x22D6,
0x22DB,
0x22D8,
0x22DA,
0x22DC,
0x22DD
),
/* Large house with patio */ new(0x22E2, 4, 1011315),
/* Marble house with patio */ new(0x22EF, 4, 1011316),
/* Small stone tower */ new(0x22F5, 1, 1011317),
/* Two-story log cabin */ new(0x22FB, 1, 1011318),
/* Two-story villa */ new(0x2300, 1, 1011319),
/* Sandstone house with patio */ new(0x22F3, 1, 1011320),
/* Small stone workshop */ new(0x22F6, 1, 1011321),
/* Small marble workshop */ new(0x22F4, 1, 1011322),
/* Malas Mountain Pass */ new(1062692, 0x2316, 0x2315, 0x2314, 0x2313),
/* Church At Night */ new(1072215, 0x2318, 0x2317, 0x2319, 0x1)
};
public MiniHouseInfo(int start, int count, int labelNumber)
{
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];
}
_type = (MiniHouseType)reader.ReadInt();
}
}
[SerializationGenerator(1, false)]
public partial class MiniHouseDeed : BaseAddonDeed
{
[InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private MiniHouseType _type;
[Constructible]
public MiniHouseDeed(MiniHouseType type = MiniHouseType.StoneAndPlaster)
{
_type = type;
Weight = 1.0;
LootType = LootType.Blessed;
}
public override BaseAddon Addon => new MiniHouseAddon(_type);
public override int LabelNumber => 1062096; // a mini house deed
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(MiniHouseInfo.GetInfo(_type).LabelNumber);
}
private void Deserialize(IGenericReader reader, int version)
{
_type = (MiniHouseType)reader.ReadInt();
}
}
public enum MiniHouseType
{
StoneAndPlaster,
FieldStone,
SmallBrick,
Wooden,
WoodAndPlaster,
ThatchedRoof,
Brick,
TwoStoryWoodAndPlaster,
TwoStoryStoneAndPlaster,
Tower,
SmallStoneKeep,
Castle,
LargeHouseWithPatio,
MarbleHouseWithPatio,
SmallStoneTower,
TwoStoryLogCabin,
TwoStoryVilla,
SandstoneHouseWithPatio,
SmallStoneWorkshop,
SmallMarbleWorkshop,
MalasMountainPass, // Veteran reward house
ChurchAtNight // Veteran reward house
}
public class MiniHouseInfo
{
private static readonly MiniHouseInfo[] m_Info =
{
/* Stone and plaster house */ new(0x22C4, 1, 1011303),
/* Field stone house */ new(0x22DE, 1, 1011304),
/* Small brick house */ new(0x22DF, 1, 1011305),
/* Wooden house */ new(0x22C9, 1, 1011306),
/* Wood and plaster house */ new(0x22E0, 1, 1011307),
/* Thatched-roof cottage */ new(0x22E1, 1, 1011308),
/* Brick house */ new(1011309, 0x22CD, 0x22CB, 0x22CC, 0x22CA),
/* Two-story wood and plaster house */ new(1011310, 0x2301, 0x2302, 0x2304, 0x2303),
/* Two-story stone and plaster house */ new(1011311, 0x22FC, 0x22FD, 0x22FF, 0x22FE),
/* Tower */ new(1011312, 0x22F7, 0x22F8, 0x22FA, 0x22F9),
/* Small stone keep */ new(0x22E6, 9, 1011313),
/* Castle */
new(
1011314,
0x22CE,
0x22D0,
0x22D2,
0x22D7,
0x22CF,
0x22D1,
0x22D4,
0x22D9,
0x22D3,
0x22D5,
0x22D6,
0x22DB,
0x22D8,
0x22DA,
0x22DC,
0x22DD
),
/* Large house with patio */ new(0x22E2, 4, 1011315),
/* Marble house with patio */ new(0x22EF, 4, 1011316),
/* Small stone tower */ new(0x22F5, 1, 1011317),
/* Two-story log cabin */ new(0x22FB, 1, 1011318),
/* Two-story villa */ new(0x2300, 1, 1011319),
/* Sandstone house with patio */ new(0x22F3, 1, 1011320),
/* Small stone workshop */ new(0x22F6, 1, 1011321),
/* Small marble workshop */ new(0x22F4, 1, 1011322),
/* Malas Mountain Pass */ new(1062692, 0x2316, 0x2315, 0x2314, 0x2313),
/* Church At Night */ new(1072215, 0x2318, 0x2317, 0x2319, 0x1)
};
public MiniHouseInfo(int start, int count, int labelNumber)
{
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 ModernUO.Serialization;
using Server.Engines.VeteranRewards;
using Server.Gumps;
using Server.Multis;
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,
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
/* Crocodile */ new(1041249, 0x20DA, 660),
/* Daemon */ new(1041250, 0x20D3, 357),
/* Dragon */ new(1041251, 0x20D6, 362),
/* EarthElemental */ new(1041252, 0x20D7, 268),
/* Ettin */ new(1041253, 0x20D8, 367),
/* Gargoyle */ new(1041254, 0x20D9, 372),
/* Gorilla */ new(1041255, 0x20F5, 158),
/* Lich */ new(1041256, 0x20F8, 1001),
/* Lizardman */ new(1041257, 0x20DE, 417),
/* Ogre */ new(1041258, 0x20DF, 427),
/* Orc */ new(1041259, 0x20E0, 1114),
/* Ratman */ new(1041260, 0x20E3, 437),
/* Skeleton */ new(1041261, 0x20E7, 1165),
/* Troll */ new(1041262, 0x20E9, 461),
/* Cow */ new(1041263, 0x2103, 120),
/* Zombie */ new(1041264, 0x20EC, 471),
/* Llama */ new(1041265, 0x20F6, 1011),
/* Ophidian */ new(1049742, 0x2133, 634),
/* Reaper */ new(1049743, 0x20FA, 442),
/* Mongbat */ new(1049744, 0x20F9, 422),
/* Gazer */ new(1049768, 0x20F4, 377),
/* FireElemental */ new(1049769, 0x20F3, 838),
/* Wolf */ new(1049770, 0x2122, 229),
/* Phillip's Steed */ new(1063488, 0x3FFE, 168),
/* Seahorse */ new(1070819, 0x25BA, 138),
/* Harrower */ new(1080520, 0x25BB, new[] { 0x289, 0x28A, 0x28B }),
/* Efreet */ new(1080521, 0x2590, 0x300),
/* Slime */ new(1015246, 0x20E8, 456),
/* PlagueBeast */ new(1029747, 0x2613, 0x1BF),
/* RedDeath */ new(1094932, 0x2617, Array.Empty<int>()),
/* Spider */ new(1029668, 0x25C4, 1170),
/* OphidianArchMage */ new(1029641, 0x25A9, 639),
/* OphidianWarrior */ new(1029645, 0x25AD, 634),
/* OphidianKnight */ new(1029642, 0x25aa, 634),
/* OphidianMage */ new(1029643, 0x25ab, 639),
/* DreadHorn */ new(1031651, 0x2D83, 0xA8),
/* Minotaur */ new(1031657, 0x2D89, 0x596),
/* Black Cat */ new(1096928, 0x4688, 0x69),
/* HalloweenGhoul */ new(1076782, 0x2109, 0x482),
/* 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),
/* Daemon */ new(1041250, 0x20D3, 357),
/* Dragon */ new(1041251, 0x20D6, 362),
/* EarthElemental */ new(1041252, 0x20D7, 268),
/* Ettin */ new(1041253, 0x20D8, 367),
/* Gargoyle */ new(1041254, 0x20D9, 372),
/* Gorilla */ new(1041255, 0x20F5, 158),
/* Lich */ new(1041256, 0x20F8, 1001),
/* Lizardman */ new(1041257, 0x20DE, 417),
/* Ogre */ new(1041258, 0x20DF, 427),
/* Orc */ new(1041259, 0x20E0, 1114),
/* Ratman */ new(1041260, 0x20E3, 437),
/* Skeleton */ new(1041261, 0x20E7, 1165),
/* Troll */ new(1041262, 0x20E9, 461),
/* Cow */ new(1041263, 0x2103, 120),
/* Zombie */ new(1041264, 0x20EC, 471),
/* Llama */ new(1041265, 0x20F6, 1011),
/* Ophidian */ new(1049742, 0x2133, 634),
/* Reaper */ new(1049743, 0x20FA, 442),
/* Mongbat */ new(1049744, 0x20F9, 422),
/* Gazer */ new(1049768, 0x20F4, 377),
/* FireElemental */ new(1049769, 0x20F3, 838),
/* Wolf */ new(1049770, 0x2122, 229),
/* Phillip's Steed */ new(1063488, 0x3FFE, 168),
/* Seahorse */ new(1070819, 0x25BA, 138),
/* Harrower */ new(1080520, 0x25BB, new[] { 0x289, 0x28A, 0x28B }),
/* Efreet */ new(1080521, 0x2590, 0x300),
/* Slime */ new(1015246, 0x20E8, 456),
/* PlagueBeast */ new(1029747, 0x2613, 0x1BF),
/* RedDeath */ new(1094932, 0x2617, Array.Empty<int>()),
/* Spider */ new(1029668, 0x25C4, 1170),
/* OphidianArchMage */ new(1029641, 0x25A9, 639),
/* OphidianWarrior */ new(1029645, 0x25AD, 634),
/* OphidianKnight */ new(1029642, 0x25aa, 634),
/* OphidianMage */ new(1029643, 0x25ab, 639),
/* DreadHorn */ new(1031651, 0x2D83, 0xA8),
/* Minotaur */ new(1031657, 0x2D89, 0x596),
/* Black Cat */ new(1096928, 0x4688, 0x69),
/* HalloweenGhoul */ new(1076782, 0x2109, 0x482),
/* Santa */ new(1097968, 0x4A98, 0x669)
v = 0;
}
return m_Table[v];
}
}
[SerializationGenerator(0, false)]
public partial class MonsterStatuette : Item, IRewardItem
{
[InvalidateProperties]
[SerializableField(1)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _turnedOn;
[InvalidateProperties]
[SerializableField(2)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _isRewardItem;
[Constructible]
public MonsterStatuette(MonsterStatuetteType type = MonsterStatuetteType.Crocodile) : base(
MonsterStatuetteInfo.GetInfo(type).ItemID
)
{
LootType = LootType.Blessed;
_type = type;
Hue = GetStatuetteHue(type);
}
public static int GetStatuetteHue(MonsterStatuetteType type, int fallback = 0) =>
type switch
{
MonsterStatuetteType.Slime => Utility.RandomSlimeHue(),
MonsterStatuetteType.RedDeath => 0x21,
MonsterStatuetteType.HalloweenGhoul => 0xF4,
_ => fallback
};
public MonsterStatuetteInfo(int labelNumber, int itemID, int baseSoundID)
[SerializableProperty(0)]
[CommandProperty(AccessLevel.GameMaster)]
public MonsterStatuetteType Type
{
get => _type;
set
{
LabelNumber = labelNumber;
ItemID = itemID;
Sounds = new[] { baseSoundID, baseSoundID + 1, baseSoundID + 2, baseSoundID + 3, baseSoundID + 4 };
}
_type = value;
ItemID = MonsterStatuetteInfo.GetInfo(_type).ItemID;
public MonsterStatuetteInfo(int labelNumber, int itemID, int[] sounds)
{
LabelNumber = labelNumber;
ItemID = itemID;
Sounds = sounds;
}
Hue = GetStatuetteHue(_type, Hue);
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)
{
v = 0;
}
return m_Table[v];
InvalidateProperties();
this.MarkDirty();
}
}
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;
private MonsterStatuetteType m_Type;
[Constructible]
public MonsterStatuette(MonsterStatuetteType type = MonsterStatuetteType.Crocodile) : base(
MonsterStatuetteInfo.GetInfo(type).ItemID
)
if (_turnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) &&
Utility.InRange(m.Location, Location, 2) && !Utility.InRange(oldLocation, Location, 2))
{
LootType = LootType.Blessed;
var sounds = MonsterStatuetteInfo.GetInfo(_type).Sounds;
m_Type = type;
if (m_Type == MonsterStatuetteType.Slime)
if (sounds.Length > 0)
{
Hue = Utility.RandomSlimeHue();
}
else if (m_Type == MonsterStatuetteType.RedDeath)
{
Hue = 0x21;
}
else if (m_Type == MonsterStatuetteType.HalloweenGhoul)
{
Hue = 0xF4;
Effects.PlaySound(Location, Map, sounds.RandomElement());
}
}
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)]
public bool TurnedOn
if (_turnedOn)
{
get => m_TurnedOn;
set
{
m_TurnedOn = value;
InvalidateProperties();
}
list.Add(502695); // turned on
}
else
{
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 MonsterStatuetteType Type
public override void OnResponse(NetState sender, RelayInfo info)
{
get => m_Type;
set
var from = sender.Mobile;
if (info.ButtonID == 1)
{
m_Type = value;
ItemID = MonsterStatuetteInfo.GetInfo(m_Type).ItemID;
var newValue = !m_Statuette.TurnedOn;
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
{
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.
}
}
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.
}
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]
public RewardCake() : base(0x9e9)
Stackable = false;
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;
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();
from.LocalOverheadMessage(MessageType.Regular, 906, 1019045); // I can't reach that.
}
}
}

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]
public BannerDeed() : base(0x14F0)
@ -104,28 +108,13 @@ public class BannerDeed : Item, IRewardItem
Weight = 1.0;
}
public BannerDeed(Serial serial) : base(serial)
{
}
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)
{
base.GetProperties(list);
if (m_IsRewardItem)
if (_isRewardItem)
{
list.Add(1076218); // 2nd Year Veteran Reward
}
@ -133,7 +122,7 @@ public class BannerDeed : Item, IRewardItem
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
if (_isRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
{
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
{
public const int Start = 0x15AE;
public const int End = 0x15F4;
private readonly BannerDeed m_Banner;
private readonly BannerDeed _banner;
public InternalGump(BannerDeed banner) : base(100, 200)
{
m_Banner = banner;
_banner = banner;
Closable = true;
Disposable = true;
@ -224,7 +195,7 @@ public class BannerDeed : Item, IRewardItem
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Banner?.Deleted != false)
if (_banner?.Deleted != false)
{
return;
}
@ -237,93 +208,89 @@ public class BannerDeed : Item, IRewardItem
}
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 readonly BannerDeed m_Banner;
private readonly int m_ItemID;
private readonly BannerDeed _banner;
private readonly int _itemID;
public InternalTarget(BannerDeed banner, int itemID) : base(-1, true, TargetFlags.None)
{
m_Banner = banner;
m_ItemID = itemID;
_banner = banner;
_itemID = itemID;
}
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Banner?.Deleted != false)
if (_banner?.Deleted != false)
{
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 p = targeted as IPoint3D;
var map = from.Map;
var house = BaseHouse.FindHouseAt(from);
if (p == null || map == null)
{
return;
}
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
return;
}
var p3d = new Point3D(p);
var id = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];
var p = targeted as IPoint3D;
var map = from.Map;
if (map.CanFit(p3d, id.Height))
{
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
if (p == null || map == null)
{
return;
}
if (house?.IsOwner(from) == true)
{
var north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
var west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
var p3d = new Point3D(p);
var id = TileData.ItemTable[_itemID & TileData.MaxItemValue];
if (north && west)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(m_Banner, m_ItemID, p3d, house));
}
else if (north || west)
{
var banner = new Banner(m_ItemID + (west ? 0 : 1));
if (!map.CanFit(p3d, id.Height))
{
from.SendLocalizedMessage(500269); // You cannot build that there.
return;
}
house.Addons.Add(banner);
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
banner.IsRewardItem = m_Banner.IsRewardItem;
banner.MoveToWorld(p3d, map);
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
return;
}
m_Banner.Delete();
}
else
{
from.SendLocalizedMessage(1042039); // The banner must be placed next to a wall.
}
}
else
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
}
}
else
{
from.SendLocalizedMessage(500269); // You cannot build that there.
}
}
else
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
}
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)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(_banner, _itemID, p3d, house));
}
else if (north || west)
{
var banner = new Banner(_itemID + (west ? 0 : 1));
house.Addons.Add(banner);
banner.IsRewardItem = _banner.IsRewardItem;
banner.MoveToWorld(p3d, map);
_banner.Delete();
}
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 =>
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"
]
}
]
}