fix: Codegens mutation core (#1370)

This commit is contained in:
Kamron Batman 2023-03-11 17:33:31 -08:00 • committed by GitHub
parent f8ab7cfdf8
commit 3514651c3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 1022 additions and 1224 deletions

View file

@ -1,49 +1,32 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public abstract partial class BaseImprisonedMobile : Item
{
public abstract class BaseImprisonedMobile : Item
[Constructible]
public BaseImprisonedMobile(int itemID) : base(itemID)
{
[Constructible]
public BaseImprisonedMobile(int itemID) : base(itemID)
}
public abstract BaseCreature Summon { get; }
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.SendGump(new ConfirmBreakCrystalGump(this));
}
public BaseImprisonedMobile(Serial serial) : base(serial)
{
}
public abstract BaseCreature Summon { get; }
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.SendGump(new ConfirmBreakCrystalGump(this));
}
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
public virtual void Release(Mobile from, BaseCreature summon)
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public virtual void Release(Mobile from, BaseCreature summon)
{
}
}

View file

@ -1,64 +1,14 @@
using ModernUO.Serialization;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class GrizzledMareStatuette : BaseImprisonedMobile
{
public class GrizzledMareStatuette : BaseImprisonedMobile
{
[Constructible]
public GrizzledMareStatuette() : base(0x2617) => Weight = 1.0;
[Constructible]
public GrizzledMareStatuette() : base(0x2617) => Weight = 1.0;
public GrizzledMareStatuette(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1074475; // Grizzled Mare Statuette
public override BaseCreature Summon => new GrizzledMare();
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
}
namespace Server.Mobiles
{
public class GrizzledMare : HellSteed
{
public override string DefaultName => "a grizzled mare";
[Constructible]
public GrizzledMare()
{
}
public GrizzledMare(Serial serial) : base(serial)
{
}
public override bool DeleteOnRelease => true;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public override int LabelNumber => 1074475; // Grizzled Mare Statuette
public override BaseCreature Summon => new GrizzledMare();
}

View file

@ -1,28 +1,12 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class MinotaurHedge : Item
{
public class MinotaurHedge : Item
{
[Constructible]
public MinotaurHedge() : base(Utility.Random(3215, 4)) => Weight = 1.0;
[Constructible]
public MinotaurHedge() : base(Utility.Random(3215, 4)) => Weight = 1.0;
public MinotaurHedge(Serial serial) : base(serial)
{
}
public override string DefaultName => "minotaur hedge";
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public override string DefaultName => "minotaur hedge";
}

View file

@ -1,28 +1,10 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class TormentedChains : Item
{
public class TormentedChains : Item
{
[Constructible]
public TormentedChains() : base(Utility.Random(6663, 2)) => Weight = 1.0;
public TormentedChains(Serial serial) : base(serial)
{
}
public override string DefaultName => "chains of the tormented";
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
[Constructible]
public TormentedChains() : base(Utility.Random(6663, 2)) => Weight = 1.0;
}

View file

@ -1,182 +1,166 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0)]
public partial class PlagueBeastBackpack : BaseContainer
{
public class PlagueBeastBackpack : BaseContainer
private static readonly Point3D[][] _positions =
{
private static readonly int[,,] m_Positions =
new []
{
{ { 275, 85 }, { 360, 111 }, { 375, 184 }, { 332, 228 }, { 141, 105 }, { 189, 75 } },
{ { 274, 34 }, { 327, 89 }, { 354, 168 }, { 304, 225 }, { 113, 86 }, { 189, 75 } },
{ { 276, 79 }, { 369, 117 }, { 372, 192 }, { 336, 230 }, { 141, 116 }, { 189, 75 } }
};
private static readonly int[] m_BrainHues =
new Point3D(275, 85, 0), new Point3D(360, 111, 0), new Point3D(375, 184, 0),
new Point3D(332, 228, 0), new Point3D(141, 105, 0), new Point3D(189, 75, 0)
},
new []
{
0x2B, 0x42, 0x54, 0x60
};
public PlagueBeastBackpack() : base(0x261B) => Layer = Layer.Backpack;
public PlagueBeastBackpack(Serial serial) : base(serial)
new Point3D(274, 34, 0), new Point3D(327, 89, 0), new Point3D(354, 168, 0),
new Point3D(304, 225, 0), new Point3D(113, 86, 0), new Point3D(189, 75, 0)
},
new []
{
new Point3D(276, 79, 0), new Point3D(369, 117, 0), new Point3D(372, 192, 0),
new Point3D(336, 230, 0), new Point3D(141, 116, 0), new Point3D( 189, 75, 0)
}
};
public override int DefaultMaxWeight => 0;
public override int DefaultMaxItems => 0;
public override int DefaultGumpID => 0x2A63;
public override int DefaultDropSound => 0x23F;
private static readonly int[] _brainHues = { 0x2B, 0x42, 0x54, 0x60 };
public void Initialize()
public PlagueBeastBackpack() : base(0x261B) => Layer = Layer.Backpack;
public override int DefaultMaxWeight => 0;
public override int DefaultMaxItems => 0;
public override int DefaultGumpID => 0x2A63;
public override int DefaultDropSound => 0x23F;
public void Initialize()
{
AddInnard(0x1CF6, 0x0, 227, 128);
AddInnard(0x1D10, 0x0, 251, 128);
AddInnard(0x1FBE, 0x21, 240, 83);
AddInnard(new PlagueBeastHeart(), 229, 104);
AddInnard(0x1D06, 0x0, 283, 91);
AddInnard(0x1FAF, 0x21, 315, 107);
AddInnard(0x1FB9, 0x21, 289, 87);
AddInnard(0x9E7, 0x21, 304, 96);
AddInnard(0x1B1A, 0x66D, 335, 102);
AddInnard(0x1D10, 0x0, 338, 146);
AddInnard(0x1FB3, 0x21, 358, 167);
AddInnard(0x1D0B, 0x0, 357, 155);
AddInnard(0x9E7, 0x21, 339, 184);
AddInnard(0x1B1A, 0x66D, 157, 172);
AddInnard(0x1D11, 0x0, 147, 157);
AddInnard(0x1FB9, 0x21, 121, 131);
AddInnard(0x9E7, 0x21, 166, 176);
AddInnard(0x1D0B, 0x0, 122, 138);
AddInnard(0x1D0D, 0x0, 118, 150);
AddInnard(0x1FB3, 0x21, 97, 123);
AddInnard(0x1D08, 0x0, 115, 113);
AddInnard(0x9E7, 0x21, 109, 109);
AddInnard(0x9E7, 0x21, 91, 122);
AddInnard(0x9E7, 0x21, 94, 160);
AddInnard(0x1B19, 0x66D, 170, 121);
AddInnard(0x1FAF, 0x21, 161, 111);
AddInnard(0x1D0B, 0x0, 158, 112);
AddInnard(0x9E7, 0x21, 159, 101);
AddInnard(0x1D10, 0x0, 132, 177);
AddInnard(0x1D0E, 0x0, 110, 178);
AddInnard(0x1FB3, 0x21, 95, 194);
AddInnard(0x1FAF, 0x21, 154, 203);
AddInnard(0x1B1A, 0x66D, 110, 237);
AddInnard(0x9E7, 0x21, 111, 171);
AddInnard(0x9E7, 0x21, 90, 197);
AddInnard(0x9E7, 0x21, 166, 205);
AddInnard(0x9E7, 0x21, 96, 242);
AddInnard(0x1D10, 0x0, 334, 196);
AddInnard(0x1D0B, 0x0, 322, 270);
var organs = new List<PlagueBeastOrgan>();
PlagueBeastOrgan organ;
for (var i = 0; i < 6; i++)
{
AddInnard(0x1CF6, 0x0, 227, 128);
AddInnard(0x1D10, 0x0, 251, 128);
AddInnard(0x1FBE, 0x21, 240, 83);
var random = i == 5 ? 0 : Utility.Random(3);
AddInnard(new PlagueBeastHeart(), 229, 104);
AddInnard(0x1D06, 0x0, 283, 91);
AddInnard(0x1FAF, 0x21, 315, 107);
AddInnard(0x1FB9, 0x21, 289, 87);
AddInnard(0x9E7, 0x21, 304, 96);
AddInnard(0x1B1A, 0x66D, 335, 102);
AddInnard(0x1D10, 0x0, 338, 146);
AddInnard(0x1FB3, 0x21, 358, 167);
AddInnard(0x1D0B, 0x0, 357, 155);
AddInnard(0x9E7, 0x21, 339, 184);
AddInnard(0x1B1A, 0x66D, 157, 172);
AddInnard(0x1D11, 0x0, 147, 157);
AddInnard(0x1FB9, 0x21, 121, 131);
AddInnard(0x9E7, 0x21, 166, 176);
AddInnard(0x1D0B, 0x0, 122, 138);
AddInnard(0x1D0D, 0x0, 118, 150);
AddInnard(0x1FB3, 0x21, 97, 123);
AddInnard(0x1D08, 0x0, 115, 113);
AddInnard(0x9E7, 0x21, 109, 109);
AddInnard(0x9E7, 0x21, 91, 122);
AddInnard(0x9E7, 0x21, 94, 160);
AddInnard(0x1B19, 0x66D, 170, 121);
AddInnard(0x1FAF, 0x21, 161, 111);
AddInnard(0x1D0B, 0x0, 158, 112);
AddInnard(0x9E7, 0x21, 159, 101);
AddInnard(0x1D10, 0x0, 132, 177);
AddInnard(0x1D0E, 0x0, 110, 178);
AddInnard(0x1FB3, 0x21, 95, 194);
AddInnard(0x1FAF, 0x21, 154, 203);
AddInnard(0x1B1A, 0x66D, 110, 237);
AddInnard(0x9E7, 0x21, 111, 171);
AddInnard(0x9E7, 0x21, 90, 197);
AddInnard(0x9E7, 0x21, 166, 205);
AddInnard(0x9E7, 0x21, 96, 242);
AddInnard(0x1D10, 0x0, 334, 196);
AddInnard(0x1D0B, 0x0, 322, 270);
var organs = new List<PlagueBeastOrgan>();
PlagueBeastOrgan organ;
for (var i = 0; i < 6; i++)
organ = random switch
{
var random = Utility.Random(3);
0 => new PlagueBeastRockOrgan(),
1 => new PlagueBeastMaidenOrgan(),
2 => new PlagueBeastRubbleOrgan(),
_ => new PlagueBeastRockOrgan()
};
if (i == 5)
{
random = 0;
}
organ = random switch
{
0 => new PlagueBeastRockOrgan(),
1 => new PlagueBeastMaidenOrgan(),
2 => new PlagueBeastRubbleOrgan(),
_ => new PlagueBeastRockOrgan()
};
organs.Add(organ);
AddInnard(organ, m_Positions[random, i, 0], m_Positions[random, i, 1]);
}
organ = new PlagueBeastBackupOrgan();
organs.Add(organ);
AddInnard(organ, 129, 214);
for (var i = 0; i < m_BrainHues.Length; i++)
{
organ = organs.RandomElement();
organ.BrainHue = m_BrainHues[i];
organs.Remove(organ);
}
organs.Clear();
AddInnard(new PlagueBeastMainOrgan(), 240, 161);
var pos = _positions[random][i];
AddInnard(organ, pos);
}
public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
{
if (dropped is PlagueBeastInnard or PlagueBeastGland)
{
return base.TryDropItem(from, dropped, sendFullMessage);
}
organ = new PlagueBeastBackupOrgan();
organs.Add(organ);
AddInnard(organ, 129, 214);
for (var i = 0; i < _brainHues.Length; i++)
{
organ = organs.RandomElement();
organ.BrainHue = _brainHues[i];
organs.Remove(organ);
}
organs.Clear();
AddInnard(new PlagueBeastMainOrgan(), 240, 161);
}
public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage) =>
dropped is PlagueBeastInnard or PlagueBeastGland && base.TryDropItem(from, dropped, sendFullMessage);
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (!IsAccessibleTo(from) || item is not (PlagueBeastInnard or PlagueBeastGland))
{
return false;
}
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (IsAccessibleTo(from) && item is PlagueBeastInnard or PlagueBeastGland)
{
var ir = ItemBounds.Table[item.ItemID];
int x, y;
var cx = p.X + ir.X + ir.Width / 2;
var cy = p.Y + ir.Y + ir.Height / 2;
var ir = ItemBounds.Table[item.ItemID];
int x, y;
var cx = p.X + ir.X + ir.Width / 2;
var cy = p.Y + ir.Y + ir.Height / 2;
for (var i = Items.Count - 1; i >= 0; i--)
for (var i = Items.Count - 1; i >= 0; i--)
{
if (Items[i] is PlagueBeastComponent innard)
{
var r = ItemBounds.Table[innard.ItemID];
x = innard.X + r.X;
y = innard.Y + r.Y;
if (cx >= x && cx <= x + r.Width && cy >= y && cy <= y + r.Height)
{
if (Items[i] is PlagueBeastComponent innard)
{
var r = ItemBounds.Table[innard.ItemID];
x = innard.X + r.X;
y = innard.Y + r.Y;
if (cx >= x && cx <= x + r.Width && cy >= y && cy <= y + r.Height)
{
innard.OnDragDrop(from, item);
break;
}
}
innard.OnDragDrop(from, item);
break;
}
return base.OnDragDropInto(from, item, p);
}
return false;
}
public void AddInnard(int itemID, int hue, int x, int y)
{
AddInnard(new PlagueBeastInnard(itemID, hue), x, y);
}
return base.OnDragDropInto(from, item, p);
}
public void AddInnard(PlagueBeastInnard innard, int x, int y)
{
AddItem(innard);
innard.Location = new Point3D(x, y, 0);
innard.Map = Map;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddInnard(int itemID, int hue, int x, int y) =>
AddInnard(new PlagueBeastInnard(itemID, hue), x, y);
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddInnard(PlagueBeastInnard innard, int x, int y) => AddInnard(innard, new Point3D(x, y, 0));
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
}
public void AddInnard(PlagueBeastInnard innard, Point3D pos)
{
AddItem(innard);
innard.Location = pos;
innard.Map = Map;
}
}

View file

@ -1,116 +1,103 @@
using System;
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0)]
public partial class PlagueBeastBlood : PlagueBeastComponent
{
public class PlagueBeastBlood : PlagueBeastComponent
public PlagueBeastBlood() : base(0x122C, 0)
{
public PlagueBeastBlood() : base(0x122C, 0)
Timer.StartTimer(
TimeSpan.FromSeconds(1.5),
TimeSpan.FromSeconds(1.5),
3,
Hemorrhage
);
}
public bool Patched => ItemID == 0x1765;
public bool Starting => ItemID == 0x122C;
public override bool OnBandage(Mobile from)
{
if (!IsAccessibleTo(from) || Patched)
{
Timer.StartTimer(
TimeSpan.FromSeconds(1.5),
TimeSpan.FromSeconds(1.5),
3,
Hemorrhage
);
return false;
}
public PlagueBeastBlood(Serial serial) : base(serial)
if (Starting)
{
}
X += 2;
Y -= 9;
public bool Patched => ItemID == 0x1765;
public bool Starting => ItemID == 0x122C;
public override bool OnBandage(Mobile from)
{
if (!IsAccessibleTo(from) || Patched)
switch (Organ)
{
return false;
}
if (Starting)
{
X += 2;
Y -= 9;
switch (Organ)
{
case PlagueBeastRubbleOrgan:
case PlagueBeastRubbleOrgan:
{
Y -= 5;
break;
case PlagueBeastBackupOrgan:
}
case PlagueBeastBackupOrgan:
{
X += 7;
break;
}
}
else
{
X -= 4;
Y -= 2;
}
ItemID = 0x1765;
var pack = Owner?.Backpack;
if (pack != null)
{
for (var i = 0; i < pack.Items.Count; i++)
{
if (pack.Items[i] is PlagueBeastMainOrgan main && main.Complete)
{
main.FinishOpening(from);
}
}
}
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071916); // * You patch up the wound with a bandage *
return true;
}
else
{
X -= 4;
Y -= 2;
}
private void Hemorrhage()
ItemID = 0x1765;
var pack = Owner?.Backpack;
if (pack != null)
{
if (Deleted || Patched)
for (var i = 0; i < pack.Items.Count; i++)
{
return;
}
Owner?.PlaySound(0x25);
if (ItemID == 0x122A)
{
if (Owner != null)
if (pack.Items[i] is PlagueBeastMainOrgan main && main.Complete)
{
Owner.Unfreeze();
Owner.Kill();
main.FinishOpening(from);
}
}
else
}
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071916); // * You patch up the wound with a bandage *
return true;
}
private void Hemorrhage()
{
if (Deleted || Patched)
{
return;
}
Owner?.PlaySound(0x25);
if (ItemID == 0x122A)
{
if (Owner != null)
{
if (Starting)
{
X += 8;
Y -= 10;
}
ItemID--;
Owner.Unfreeze();
Owner.Kill();
}
}
public override void Serialize(IGenericWriter writer)
else
{
base.Serialize(writer);
if (Starting)
{
X += 8;
Y -= 10;
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
ItemID--;
}
}
}

View file

@ -1,32 +1,16 @@
namespace Server.Items
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0)]
public partial class PlagueBeastGland : Item
{
public class PlagueBeastGland : Item
[Constructible]
public PlagueBeastGland() : base(0x1CEF)
{
[Constructible]
public PlagueBeastGland() : base(0x1CEF)
{
Weight = 1.0;
Hue = 0x6;
}
public PlagueBeastGland(Serial serial) : base(serial)
{
}
public override string DefaultName => "a healthy gland";
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();
}
Weight = 1.0;
Hue = 0x6;
}
public override int LabelNumber => 1153759; // a healthy gland
}

View file

@ -1,78 +1,65 @@
using System;
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0)]
public partial class PlagueBeastHeart : PlagueBeastInnard
{
public class PlagueBeastHeart : PlagueBeastInnard
private Timer _timer;
public PlagueBeastHeart() : base(0x1363, 0x21)
{
private Timer m_Timer;
_timer = new InternalTimer(this);
_timer.Start();
}
public PlagueBeastHeart() : base(0x1363, 0x21)
public override void OnAfterDelete()
{
if (_timer?.Running == true)
{
m_Timer = new InternalTimer(this);
m_Timer.Start();
_timer.Stop();
}
}
public PlagueBeastHeart(Serial serial) : base(serial)
{
}
[AfterDeserialization]
private void AfterDeserialization()
{
_timer = new InternalTimer(this);
_timer.Start();
}
public override void OnAfterDelete()
private class InternalTimer : Timer
{
private readonly PlagueBeastHeart _heart;
private bool _delay;
public InternalTimer(PlagueBeastHeart heart) : base(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5)) =>
_heart = heart;
protected override void OnTick()
{
if (m_Timer?.Running == true)
if (_heart?.Deleted != false || _heart.Owner?.Alive != true)
{
m_Timer.Stop();
Stop();
return;
}
}
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();
m_Timer = new InternalTimer(this);
m_Timer.Start();
}
private class InternalTimer : Timer
{
private readonly PlagueBeastHeart m_Heart;
private bool m_Delay;
public InternalTimer(PlagueBeastHeart heart) : base(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5)) =>
m_Heart = heart;
protected override void OnTick()
if (_heart.ItemID == 0x1363)
{
if (m_Heart?.Deleted != false || m_Heart.Owner?.Alive != true)
if (_delay)
{
Stop();
return;
_heart.ItemID = 0x1367;
_heart.Owner.PlaySound(0x11F);
}
if (m_Heart.ItemID == 0x1363)
{
if (m_Delay)
{
m_Heart.ItemID = 0x1367;
m_Heart.Owner.PlaySound(0x11F);
}
m_Delay = !m_Delay;
}
else
{
m_Heart.ItemID = 0x1363;
m_Heart.Owner.PlaySound(0x120);
m_Delay = false;
}
_delay = !_delay;
}
else
{
_heart.ItemID = 0x1363;
_heart.Owner.PlaySound(0x120);
_delay = false;
}
}
}

View file

@ -1,162 +1,123 @@
using ModernUO.Serialization;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0)]
public partial class PlagueBeastInnard : Item, IScissorable, ICarvable
{
public class PlagueBeastInnard : Item, IScissorable, ICarvable
public PlagueBeastInnard(int itemID, int hue) : base(itemID)
{
public PlagueBeastInnard(int itemID, int hue) : base(itemID)
Hue = hue;
Movable = false;
Weight = 1.0;
}
public PlagueBeastLord Owner => RootParent as PlagueBeastLord;
public override string DefaultName => "plague beast innards";
public virtual void Carve(Mobile from, Item with)
{
}
public virtual bool Scissor(Mobile from, Scissors scissors) => false;
public virtual bool OnBandage(Mobile from) => false;
public override bool IsAccessibleTo(Mobile check)
{
if ((int)check.AccessLevel >= (int)AccessLevel.GameMaster)
{
Hue = hue;
Movable = false;
Weight = 1.0;
return true;
}
public PlagueBeastInnard(Serial serial) : base(serial)
var owner = Owner;
if (owner == null)
{
}
public PlagueBeastLord Owner => RootParent as PlagueBeastLord;
public override string DefaultName => "plague beast innards";
public virtual void Carve(Mobile from, Item with)
{
}
public virtual bool Scissor(Mobile from, Scissors scissors) => false;
public virtual bool OnBandage(Mobile from) => false;
public override bool IsAccessibleTo(Mobile check)
{
if ((int)check.AccessLevel >= (int)AccessLevel.GameMaster)
{
return true;
}
var owner = Owner;
if (owner == null)
{
return false;
}
if (!owner.InRange(check, 2))
{
owner.PrivateOverheadMessage(MessageType.Label, 0x3B2, 500446, check.NetState); // That is too far away.
}
else if (owner.OpenedBy != null && owner.OpenedBy != check) // TODO check
{
owner.PrivateOverheadMessage(
MessageType.Label,
0x3B2,
500365,
check.NetState
); // That is being used by someone else
}
else if (owner.Frozen)
{
return true;
}
return false;
}
public override void Serialize(IGenericWriter writer)
if (!owner.InRange(check, 2))
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
owner.PrivateOverheadMessage(MessageType.Label, 0x3B2, 500446, check.NetState); // That is too far away.
}
else if (owner.OpenedBy != null && owner.OpenedBy != check) // TODO check
{
// That is being used by someone else
owner.PrivateOverheadMessage(MessageType.Label, 0x3B2, 500365, check.NetState);
}
else if (owner.Frozen)
{
return true;
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
var owner = Owner;
if (owner?.Alive != true)
{
Delete();
}
}
return false;
}
public class PlagueBeastComponent : PlagueBeastInnard
[AfterDeserialization(false)]
private void AfterDeserialization()
{
public PlagueBeastComponent(int itemID, int hue, bool movable = false) : base(itemID, hue) => Movable = movable;
var owner = Owner;
public PlagueBeastComponent(Serial serial) : base(serial)
if (owner?.Alive != true)
{
Delete();
}
}
}
[SerializationGenerator(0)]
public partial class PlagueBeastComponent : PlagueBeastInnard
{
[SerializableField(0)]
private PlagueBeastOrgan _organ;
public PlagueBeastComponent(int itemID, int hue, bool movable = false) : base(itemID, hue) => Movable = movable;
public bool IsBrain => ItemID == 0x1CF0;
public bool IsGland => ItemID == 0x1CEF;
public bool IsReceptacle => ItemID == 0x9DF;
public override bool DropToItem(Mobile from, Item target, Point3D p) =>
target is PlagueBeastBackpack && base.DropToItem(from, target, p);
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted) => false;
public override bool DropToMobile(Mobile from, Mobile target, Point3D p) => false;
public override bool DropToWorld(Mobile from, Point3D p) => false;
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (_organ?.OnDropped(from, dropped, this) == true && dropped is PlagueBeastComponent component)
{
_organ.Add(_organ.Components, component);
}
public PlagueBeastOrgan Organ { get; set; }
return true;
}
public bool IsBrain => ItemID == 0x1CF0;
public bool IsGland => ItemID == 0x1CEF;
public bool IsReceptacle => ItemID == 0x9DF;
public override bool DropToItem(Mobile from, Item target, Point3D p) =>
target is PlagueBeastBackpack && base.DropToItem(from, target, p);
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted) => false;
public override bool DropToMobile(Mobile from, Mobile target, Point3D p) => false;
public override bool DropToWorld(Mobile from, Point3D p) => false;
public override bool OnDragDrop(Mobile from, Item dropped)
public override bool OnDragLift(Mobile from)
{
if (IsAccessibleTo(from))
{
if (Organ?.OnDropped(from, dropped, this) == true && dropped is PlagueBeastComponent component)
if (Organ?.OnLifted(from, this) == true)
{
Organ.Components.Add(component);
// * You rip the organ out of the plague beast's flesh *
from.SendLocalizedMessage(IsGland ? 1071895 : 1071914, null);
_organ.Remove(_organ.Components, this);
Organ = null;
from.PlaySound(0x1CA);
}
return true;
}
public override bool OnDragLift(Mobile from)
{
if (IsAccessibleTo(from))
{
if (Organ?.OnLifted(from, this) == true)
{
from.SendLocalizedMessage(
IsGland ? 1071895 : 1071914,
null
); // * You rip the organ out of the plague beast's flesh *
Organ.Remove(Organ.Components, this);
Organ = null;
from.PlaySound(0x1CA);
}
return true;
}
return false;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write(Organ);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
Organ = reader.ReadEntity<PlagueBeastOrgan>();
}
return false;
}
}

View file

@ -1,76 +1,54 @@
using System;
using ModernUO.Serialization;
using Server.Mobiles;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0)]
public partial class PlagueBeastMutationCore : Item, IScissorable
{
public class PlagueBeastMutationCore : Item, IScissorable
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _cut;
[Constructible]
public PlagueBeastMutationCore() : base(0x1CF0)
{
[Constructible]
public PlagueBeastMutationCore() : base(0x1CF0)
_cut = true;
Weight = 1.0;
Hue = 0x480;
}
public override int LabelNumber => 1153760; // a plague beast mutation core
public virtual bool Scissor(Mobile from, Scissors scissors)
{
if (!_cut)
{
var owner = RootParent as PlagueBeastLord;
Cut = true;
Weight = 1.0;
Hue = 0x480;
}
Movable = true;
public PlagueBeastMutationCore(Serial serial) : base(serial)
{
}
from.AddToBackpack(this);
[CommandProperty(AccessLevel.GameMaster)]
public bool Cut { get; set; }
// * You remove the plague mutation core from the plague beast, causing it to dissolve into a pile of goo *
from.LocalOverheadMessage(MessageType.Regular, 0x34, 1071906);
public override string DefaultName => "a plague beast mutation core";
public virtual bool Scissor(Mobile from, Scissors scissors)
{
if (!Cut)
if (owner != null)
{
var owner = RootParent as PlagueBeastLord;
Cut = true;
Movable = true;
from.AddToBackpack(this);
from.LocalOverheadMessage(
MessageType.Regular,
0x34,
1071906
); // * You remove the plague mutation core from the plague beast, causing it to dissolve into a pile of goo *
if (owner != null)
{
Timer.StartTimer(TimeSpan.FromSeconds(1),
() =>
{
owner.Unfreeze();
owner.Kill();
}
);
}
return true;
Timer.StartTimer(TimeSpan.FromSeconds(1),
() =>
{
owner.Unfreeze();
owner.Kill();
}
);
}
return false;
return true;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write(Cut);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
Cut = reader.ReadBool();
}
return false;
}
}

View file

@ -1,596 +1,463 @@
using System;
using System.Collections.Generic;
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0)]
public partial class PlagueBeastOrgan : PlagueBeastInnard
{
public class PlagueBeastOrgan : PlagueBeastInnard
private bool _opening;
[SerializableField(0, setter: "private")]
private List<PlagueBeastComponent> _components;
[SerializableField(1)]
private int _brainHue;
[SerializableField(2)]
private bool _opened;
public PlagueBeastOrgan(int itemID = 1, int hue = 0) : base(itemID, hue)
{
private bool _opening;
Components = new List<PlagueBeastComponent>();
Opened = false;
Movable = false;
Visible = itemID <= 1;
public PlagueBeastOrgan(int itemID = 1, int hue = 0) : base(itemID, hue)
Timer.StartTimer(Initialize);
}
public virtual bool IsCuttable => false;
public virtual void Initialize()
{
}
public void AddComponent(PlagueBeastComponent c, int x, int y)
{
if (Parent is Container pack)
{
Components = new List<PlagueBeastComponent>();
Opened = false;
Movable = false;
Visible = itemID <= 1;
Timer.StartTimer(Initialize);
pack.DropItem(c);
}
public PlagueBeastOrgan(Serial serial) : base(serial)
c.Organ = this;
c.Location = new Point3D(X + x, Y + y, Z);
c.Map = Map;
this.Add(Components, c);
}
public override bool Scissor(Mobile from, Scissors scissors)
{
if (IsCuttable && IsAccessibleTo(from))
{
}
public virtual bool IsCuttable => false;
public List<PlagueBeastComponent> Components { get; private set; }
public int BrainHue { get; set; }
public bool Opened { get; set; }
public virtual void Initialize()
{
}
public void AddComponent(PlagueBeastComponent c, int x, int y)
{
if (Parent is Container pack)
if (!Opened && !_opening)
{
pack.DropItem(c);
}
c.Organ = this;
c.Location = new Point3D(X + x, Y + y, Z);
c.Map = Map;
Components.Add(c);
}
public override bool Scissor(Mobile from, Scissors scissors)
{
if (IsCuttable && IsAccessibleTo(from))
{
if (!Opened && !_opening)
_opening = true;
void Open()
{
_opening = true;
void Open()
_opening = false;
if (!Deleted)
{
_opening = false;
if (!Deleted)
{
FinishOpening(from);
}
FinishOpening(from);
}
Timer.StartTimer(TimeSpan.FromSeconds(3), Open);
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071897); // You carefully cut into the organ.
return true;
}
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071898); // You have already cut this organ open.
Timer.StartTimer(TimeSpan.FromSeconds(3), Open);
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071897); // You carefully cut into the organ.
return true;
}
return false;
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071898); // You have already cut this organ open.
}
public virtual bool OnLifted(Mobile from, PlagueBeastComponent c) => c.IsGland || c.IsBrain;
return false;
}
public virtual bool OnDropped(Mobile from, Item item, PlagueBeastComponent to) => false;
public virtual bool OnLifted(Mobile from, PlagueBeastComponent c) => c.IsGland || c.IsBrain;
public virtual void FinishOpening(Mobile from)
public virtual bool OnDropped(Mobile from, Item item, PlagueBeastComponent to) => false;
public virtual void FinishOpening(Mobile from)
{
Opened = true;
Owner?.PlaySound(0x50);
}
}
[SerializationGenerator(0)]
public partial class PlagueBeastMaidenOrgan : PlagueBeastOrgan
{
public PlagueBeastMaidenOrgan() : base(0x124D)
{
}
public override void OnDoubleClick(Mobile from)
{
if (!Opened)
{
Opened = true;
Owner?.PlaySound(0x50);
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write(Components);
writer.Write(BrainHue);
writer.Write(Opened);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
Components = reader.ReadEntityList<PlagueBeastComponent>();
BrainHue = reader.ReadInt();
Opened = reader.ReadBool();
FinishOpening(from);
}
}
public class PlagueBeastMaidenOrgan : PlagueBeastOrgan
public override void FinishOpening(Mobile from)
{
public PlagueBeastMaidenOrgan() : base(0x124D)
ItemID = 0x1249;
Owner?.PlaySound(0x187);
AddComponent(new PlagueBeastComponent(0x1D0D, 0x0), 22, 3);
AddComponent(new PlagueBeastComponent(0x1D12, 0x0), 15, 18);
AddComponent(new PlagueBeastComponent(0x1DA3, 0x21), 26, 46);
if (BrainHue > 0)
{
AddComponent(new PlagueBeastComponent(0x1CF0, BrainHue, true), 22, 29);
}
public PlagueBeastMaidenOrgan(Serial serial) : base(serial)
Opened = true;
}
}
[SerializationGenerator(0)]
public partial class PlagueBeastRockOrgan : PlagueBeastOrgan
{
public PlagueBeastRockOrgan() : base(0x177A, 0x60)
{
}
public override bool IsCuttable => true;
public override void Carve(Mobile from, Item with)
{
if (IsAccessibleTo(from))
{
// This is too crude an implement for such a procedure.
with.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071896);
}
}
public override bool OnLifted(Mobile from, PlagueBeastComponent c)
{
base.OnLifted(from, c);
if (c.IsBrain)
{
AddComponent(new PlagueBeastBlood(), -7, 24);
return true;
}
public override void OnDoubleClick(Mobile from)
return false;
}
public override void FinishOpening(Mobile from)
{
base.FinishOpening(from);
AddComponent(new PlagueBeastComponent(0x1775, 0x60), 3, 5);
AddComponent(new PlagueBeastComponent(0x1777, 0x1), 10, 14);
if (BrainHue > 0)
{
if (!Opened)
AddComponent(new PlagueBeastComponent(0x1CF0, BrainHue, true), 1, 24); // 22, 29
}
else
{
AddComponent(new PlagueBeastBlood(), -7, 24);
}
}
}
[SerializationGenerator(0)]
public partial class PlagueBeastRubbleOrgan : PlagueBeastOrgan
{
private static readonly int[] _hues = { 0xD, 0x17, 0x2B, 0x42, 0x54, 0x5D };
[SerializableField(0, getter: "private", setter: "private")]
private int _veins;
public PlagueBeastRubbleOrgan() => _veins = 3;
public override void Initialize()
{
Hue = _hues.RandomElement();
AddComponent(new PlagueBeastComponent(0x3BB, Hue), 0, 0);
AddComponent(new PlagueBeastComponent(0x3BA, Hue), 4, 6);
AddComponent(new PlagueBeastComponent(0x3BA, Hue), -6, 17);
var v = Utility.Random(4);
AddComponent(new PlagueBeastVein(0x1B1B, v == 0 ? Hue : RandomHue(Hue)), -23, -3);
AddComponent(new PlagueBeastVein(0x1B1C, v == 1 ? Hue : RandomHue(Hue)), 19, 4);
AddComponent(new PlagueBeastVein(0x1B1B, v == 2 ? Hue : RandomHue(Hue)), 21, 27);
AddComponent(new PlagueBeastVein(0x1B1B, v == 3 ? Hue : RandomHue(Hue)), 10, 40);
}
public override bool OnLifted(Mobile from, PlagueBeastComponent c)
{
if (c.IsBrain)
{
AddComponent(new PlagueBeastBlood(), -13, 25);
return true;
}
return false;
}
public override void FinishOpening(Mobile from)
{
AddComponent(new PlagueBeastComponent(0x1777, 0x1), 5, 14);
if (BrainHue > 0)
{
AddComponent(new PlagueBeastComponent(0x1CF0, BrainHue, true), -5, 22);
}
else
{
AddComponent(new PlagueBeastBlood(), -13, 25);
}
Opened = true;
}
private static int RandomHue(int exclude)
{
for (var i = 0; i < 20; i++)
{
var hue = _hues.RandomElement();
if (hue != exclude)
{
return hue;
}
}
return _hues[0];
}
public virtual void OnVeinCut(Mobile from, PlagueBeastVein vein)
{
if (vein.Hue != Hue)
{
if (!Opened && _veins > 0 && --_veins == 0)
{
FinishOpening(from);
}
}
public override void FinishOpening(Mobile from)
else
{
ItemID = 0x1249;
// * As you cut the vein, a cloud of poison is expelled from the plague beast's organ, and the plague beast dissolves into a puddle of goo *
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1071901);
from.ApplyPoison(from, Poison.Greater);
from.PlaySound(0x22F);
Owner?.PlaySound(0x187);
AddComponent(new PlagueBeastComponent(0x1D0D, 0x0), 22, 3);
AddComponent(new PlagueBeastComponent(0x1D12, 0x0), 15, 18);
AddComponent(new PlagueBeastComponent(0x1DA3, 0x21), 26, 46);
if (BrainHue > 0)
if (Owner != null)
{
AddComponent(new PlagueBeastComponent(0x1CF0, BrainHue, true), 22, 29);
Owner.Unfreeze();
Owner.Kill();
}
Opened = true;
}
}
}
public override void Serialize(IGenericWriter writer)
[SerializationGenerator(0)]
public partial class PlagueBeastBackupOrgan : PlagueBeastOrgan
{
[SerializableField(0, getter: "private", setter: "private")]
private Item _gland;
public PlagueBeastBackupOrgan() : base(0x1362, 0x6)
{
}
public override bool IsCuttable => true;
public override void Initialize()
{
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), 16, 39);
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), 39, 49);
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), 39, 48);
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), 44, 42);
AddComponent(new PlagueBeastComponent(0x1CF2, 0x42), 20, 34);
AddComponent(new PlagueBeastComponent(0x135F, 0x42), 47, 58);
AddComponent(new PlagueBeastComponent(0x1360, 0x42), 70, 68);
}
public override void Carve(Mobile from, Item with)
{
if (IsAccessibleTo(from))
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
// This is too crude an implement for such a procedure.
with.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071896);
}
}
public class PlagueBeastRockOrgan : PlagueBeastOrgan
public override bool OnLifted(Mobile from, PlagueBeastComponent c)
{
public PlagueBeastRockOrgan() : base(0x177A, 0x60)
if (c.IsBrain)
{
AddComponent(new PlagueBeastBlood(), 47, 72);
return true;
}
public PlagueBeastRockOrgan(Serial serial) : base(serial)
if (c.IsGland)
{
_gland = null;
return true;
}
public override bool IsCuttable => true;
public override void Carve(Mobile from, Item with)
{
if (IsAccessibleTo(from))
{
with.PublicOverheadMessage(
MessageType.Regular,
0x3B2,
1071896 // This is too crude an implement for such a procedure.
);
}
}
public override bool OnLifted(Mobile from, PlagueBeastComponent c)
{
base.OnLifted(from, c);
if (c.IsBrain)
{
AddComponent(new PlagueBeastBlood(), -7, 24);
return true;
}
return false;
}
public override void FinishOpening(Mobile from)
{
base.FinishOpening(from);
AddComponent(new PlagueBeastComponent(0x1775, 0x60), 3, 5);
AddComponent(new PlagueBeastComponent(0x1777, 0x1), 10, 14);
if (BrainHue > 0)
{
AddComponent(new PlagueBeastComponent(0x1CF0, BrainHue, true), 1, 24); // 22, 29
}
else
{
AddComponent(new PlagueBeastBlood(), -7, 24);
}
}
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();
}
return c.IsGland;
}
public class PlagueBeastRubbleOrgan : PlagueBeastOrgan
public override bool OnDropped(Mobile from, Item item, PlagueBeastComponent to)
{
private static readonly int[] m_Hues =
if (to.Hue == 0x1 && _gland == null && item is PlagueBeastGland)
{
0xD, 0x17, 0x2B, 0x42, 0x54, 0x5D
};
Gland = item;
Timer.StartTimer(TimeSpan.FromSeconds(3), FinishHealing);
from.SendAsciiMessage(0x3B2, "* You place the healthy gland inside the organ sac *");
item.Movable = false;
private int m_Veins;
Owner?.PlaySound(0x20);
public PlagueBeastRubbleOrgan() => m_Veins = 3;
public PlagueBeastRubbleOrgan(Serial serial) : base(serial)
{
return true;
}
public override void Initialize()
return false;
}
public override void FinishOpening(Mobile from)
{
base.FinishOpening(from);
AddComponent(new PlagueBeastComponent(0x1363, 0xF), -3, 3);
AddComponent(new PlagueBeastComponent(0x1365, 0x1), -3, 10);
Gland = new PlagueBeastComponent(0x1CEF, 0x3F, true);
AddComponent((PlagueBeastComponent)_gland, -4, 16);
}
public void FinishHealing()
{
for (var i = 0; i < 7 && i < Components.Count; i++)
{
Hue = m_Hues.RandomElement();
AddComponent(new PlagueBeastComponent(0x3BB, Hue), 0, 0);
AddComponent(new PlagueBeastComponent(0x3BA, Hue), 4, 6);
AddComponent(new PlagueBeastComponent(0x3BA, Hue), -6, 17);
var v = Utility.Random(4);
AddComponent(new PlagueBeastVein(0x1B1B, v == 0 ? Hue : RandomHue(Hue)), -23, -3);
AddComponent(new PlagueBeastVein(0x1B1C, v == 1 ? Hue : RandomHue(Hue)), 19, 4);
AddComponent(new PlagueBeastVein(0x1B1B, v == 2 ? Hue : RandomHue(Hue)), 21, 27);
AddComponent(new PlagueBeastVein(0x1B1B, v == 3 ? Hue : RandomHue(Hue)), 10, 40);
Components[i].Hue = 0x6;
}
public override bool OnLifted(Mobile from, PlagueBeastComponent c)
{
if (c.IsBrain)
{
AddComponent(new PlagueBeastBlood(), -13, 25);
return true;
}
Timer.StartTimer(TimeSpan.FromSeconds(2), OpenOrgan);
}
return false;
public void OpenOrgan()
{
AddComponent(new PlagueBeastComponent(0x1367, 0xF), 55, 61);
AddComponent(new PlagueBeastComponent(0x1366, 0x1), 57, 66);
if (BrainHue > 0)
{
AddComponent(new PlagueBeastComponent(0x1CF0, BrainHue, true), 55, 69);
}
}
}
[SerializationGenerator(0)]
public partial class PlagueBeastMainOrgan : PlagueBeastOrgan
{
[SerializableField(0, getter: "private", setter: "private")]
private int _brains;
public PlagueBeastMainOrgan() => _brains = 0;
public bool Complete => _brains >= 4;
public override void Initialize()
{
// receptacles
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), -36, -2);
AddComponent(new PlagueBeastComponent(0x1FB3, 0x42), -42, 0);
AddComponent(new PlagueBeastComponent(0x9DF, 0x42), -53, -7);
AddComponent(new PlagueBeastComponent(0x1B1C, 0x54), 29, 9);
AddComponent(new PlagueBeastComponent(0x1D06, 0x54), 18, -2);
AddComponent(new PlagueBeastComponent(0x9DF, 0x54), 36, -1);
AddComponent(new PlagueBeastComponent(0x1D10, 0x2B), -36, 47);
AddComponent(new PlagueBeastComponent(0x1B1C, 0x2B), -24, 62);
AddComponent(new PlagueBeastComponent(0x9DF, 0x2B), -41, 74);
AddComponent(new PlagueBeastComponent(0x1B1B, 0x60), 39, 56);
AddComponent(new PlagueBeastComponent(0x1FB4, 0x60), 34, 52);
AddComponent(new PlagueBeastComponent(0x9DF, 0x60), 45, 71);
// main part
AddComponent(new PlagueBeastComponent(0x1351, 0x15), 23, 0);
AddComponent(new PlagueBeastComponent(0x134F, 0x15), -22, 0);
AddComponent(new PlagueBeastComponent(0x1350, 0x15), 0, 0);
}
public override bool OnLifted(Mobile from, PlagueBeastComponent c)
{
if (c.IsBrain)
{
Brains--;
}
public override void FinishOpening(Mobile from)
return true;
}
public override bool OnDropped(Mobile from, Item item, PlagueBeastComponent to)
{
if (!Opened && to.IsReceptacle && item.Hue == to.Hue)
{
AddComponent(new PlagueBeastComponent(0x1777, 0x1), 5, 14);
to.Organ = this;
Brains++;
if (BrainHue > 0)
// You place the organ in the fleshy receptacle near the core.
from.LocalOverheadMessage(MessageType.Regular, 0x34, 1071913);
if (Owner != null)
{
AddComponent(new PlagueBeastComponent(0x1CF0, BrainHue, true), -5, 22);
}
else
{
AddComponent(new PlagueBeastBlood(), -13, 25);
}
Owner.PlaySound(0x1BA);
Opened = true;
}
private static int RandomHue(int exclude)
{
for (var i = 0; i < 20; i++)
{
var hue = m_Hues.RandomElement();
if (hue != exclude)
if (Owner.IsBleeding)
{
return hue;
// The plague beast is still bleeding from open wounds. You must seal any bleeding wounds before the core will open!
from.LocalOverheadMessage(MessageType.Regular, 0x34, 1071922);
return true;
}
}
return 0xD;
}
public virtual void OnVeinCut(Mobile from, PlagueBeastVein vein)
{
if (vein.Hue != Hue)
if (_brains == 4)
{
if (!Opened && m_Veins > 0 && --m_Veins == 0)
{
FinishOpening(from);
}
}
else
{
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1071901 // * As you cut the vein, a cloud of poison is expelled from the plague beast's organ, and the plague beast dissolves into a puddle of goo *
);
from.ApplyPoison(from, Poison.Greater);
from.PlaySound(0x22F);
if (Owner != null)
{
Owner.Unfreeze();
Owner.Kill();
}
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write(m_Veins);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
m_Veins = reader.ReadInt();
}
}
public class PlagueBeastBackupOrgan : PlagueBeastOrgan
{
private Item m_Gland;
public PlagueBeastBackupOrgan() : base(0x1362, 0x6)
{
}
public PlagueBeastBackupOrgan(Serial serial) : base(serial)
{
}
public override bool IsCuttable => true;
public override void Initialize()
{
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), 16, 39);
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), 39, 49);
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), 39, 48);
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), 44, 42);
AddComponent(new PlagueBeastComponent(0x1CF2, 0x42), 20, 34);
AddComponent(new PlagueBeastComponent(0x135F, 0x42), 47, 58);
AddComponent(new PlagueBeastComponent(0x1360, 0x42), 70, 68);
}
public override void Carve(Mobile from, Item with)
{
if (IsAccessibleTo(from))
{
with.PublicOverheadMessage(
MessageType.Regular,
0x3B2,
1071896 // This is too crude an implement for such a procedure.
);
}
}
public override bool OnLifted(Mobile from, PlagueBeastComponent c)
{
if (c.IsBrain)
{
AddComponent(new PlagueBeastBlood(), 47, 72);
return true;
}
if (c.IsGland)
{
m_Gland = null;
return true;
}
return c.IsGland;
}
public override bool OnDropped(Mobile from, Item item, PlagueBeastComponent to)
{
if (to.Hue == 0x1 && m_Gland == null && item is PlagueBeastGland)
{
m_Gland = item;
Timer.StartTimer(TimeSpan.FromSeconds(3), FinishHealing);
from.SendAsciiMessage(0x3B2, "* You place the healthy gland inside the organ sac *");
item.Movable = false;
Owner?.PlaySound(0x20);
return true;
}
return false;
}
public override void FinishOpening(Mobile from)
{
base.FinishOpening(from);
AddComponent(new PlagueBeastComponent(0x1363, 0xF), -3, 3);
AddComponent(new PlagueBeastComponent(0x1365, 0x1), -3, 10);
m_Gland = new PlagueBeastComponent(0x1CEF, 0x3F, true);
AddComponent((PlagueBeastComponent)m_Gland, -4, 16);
}
public void FinishHealing()
{
for (var i = 0; i < 7 && i < Components.Count; i++)
{
Components[i].Hue = 0x6;
}
Timer.StartTimer(TimeSpan.FromSeconds(2), OpenOrgan);
}
public void OpenOrgan()
{
AddComponent(new PlagueBeastComponent(0x1367, 0xF), 55, 61);
AddComponent(new PlagueBeastComponent(0x1366, 0x1), 57, 66);
if (BrainHue > 0)
{
AddComponent(new PlagueBeastComponent(0x1CF0, BrainHue, true), 55, 69);
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write(m_Gland);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
m_Gland = reader.ReadEntity<Item>();
}
}
public class PlagueBeastMainOrgan : PlagueBeastOrgan
{
private int m_Brains;
public PlagueBeastMainOrgan() => m_Brains = 0;
public PlagueBeastMainOrgan(Serial serial) : base(serial)
{
}
public bool Complete => m_Brains >= 4;
public override void Initialize()
{
// receptacles
AddComponent(new PlagueBeastComponent(0x1B1B, 0x42), -36, -2);
AddComponent(new PlagueBeastComponent(0x1FB3, 0x42), -42, 0);
AddComponent(new PlagueBeastComponent(0x9DF, 0x42), -53, -7);
AddComponent(new PlagueBeastComponent(0x1B1C, 0x54), 29, 9);
AddComponent(new PlagueBeastComponent(0x1D06, 0x54), 18, -2);
AddComponent(new PlagueBeastComponent(0x9DF, 0x54), 36, -1);
AddComponent(new PlagueBeastComponent(0x1D10, 0x2B), -36, 47);
AddComponent(new PlagueBeastComponent(0x1B1C, 0x2B), -24, 62);
AddComponent(new PlagueBeastComponent(0x9DF, 0x2B), -41, 74);
AddComponent(new PlagueBeastComponent(0x1B1B, 0x60), 39, 56);
AddComponent(new PlagueBeastComponent(0x1FB4, 0x60), 34, 52);
AddComponent(new PlagueBeastComponent(0x9DF, 0x60), 45, 71);
// main part
AddComponent(new PlagueBeastComponent(0x1351, 0x15), 23, 0);
AddComponent(new PlagueBeastComponent(0x134F, 0x15), -22, 0);
AddComponent(new PlagueBeastComponent(0x1350, 0x15), 0, 0);
}
public override bool OnLifted(Mobile from, PlagueBeastComponent c)
{
if (c.IsBrain)
{
m_Brains--;
FinishOpening(from);
}
return true;
}
public override bool OnDropped(Mobile from, Item item, PlagueBeastComponent to)
return false;
}
public override void FinishOpening(Mobile from)
{
AddComponent(new PlagueBeastComponent(0x1363, 0x1), 0, 22);
AddComponent(new PlagueBeastComponent(0x1D04, 0xD), 0, 22);
if (Owner?.Backpack != null)
{
if (!Opened && to.IsReceptacle && item.Hue == to.Hue)
{
to.Organ = this;
m_Brains++;
from.LocalOverheadMessage(
MessageType.Regular,
0x34,
1071913 // You place the organ in the fleshy receptacle near the core.
);
var core = new PlagueBeastMutationCore();
Owner.Backpack.AddItem(core);
core.Movable = false;
core.Cut = false;
core.X = X;
core.Y = Y + 34;
if (Owner != null)
{
Owner.PlaySound(0x1BA);
if (Owner.IsBleeding)
{
from.LocalOverheadMessage(
MessageType.Regular,
0x34,
1071922 // The plague beast is still bleeding from open wounds. You must seal any bleeding wounds before the core will open!
);
return true;
}
}
if (m_Brains == 4)
{
FinishOpening(from);
}
return true;
}
return false;
Owner.PlaySound(0x21);
Owner.PlaySound(0x166);
}
public override void FinishOpening(Mobile from)
{
AddComponent(new PlagueBeastComponent(0x1363, 0x1), 0, 22);
AddComponent(new PlagueBeastComponent(0x1D04, 0xD), 0, 22);
if (Owner?.Backpack != null)
{
var core = new PlagueBeastMutationCore();
Owner.Backpack.AddItem(core);
core.Movable = false;
core.Cut = false;
core.X = X;
core.Y = Y + 34;
Owner.PlaySound(0x21);
Owner.PlaySound(0x166);
}
Opened = true;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write(m_Brains);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
m_Brains = reader.ReadInt();
}
Opened = true;
}
}

View file

@ -1,72 +1,50 @@
using System;
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0)]
public partial class PlagueBeastVein : PlagueBeastComponent
{
public class PlagueBeastVein : PlagueBeastComponent
private bool _cutting;
[SerializableField(0, setter: "private")]
private bool _cut;
public PlagueBeastVein(int itemID, int hue) : base(itemID, hue) => _cut = false;
public override bool Scissor(Mobile from, Scissors scissors)
{
private bool _cutting;
public PlagueBeastVein(int itemID, int hue) : base(itemID, hue) => Cut = false;
public PlagueBeastVein(Serial serial) : base(serial)
if (IsAccessibleTo(from))
{
}
public bool Cut { get; private set; }
public override bool Scissor(Mobile from, Scissors scissors)
{
if (IsAccessibleTo(from))
if (!_cut && !_cutting)
{
if (!Cut && !_cutting)
{
_cutting = true;
Timer.StartTimer(TimeSpan.FromSeconds(3), () => CuttingDone(from));
scissors.PublicOverheadMessage(
MessageType.Regular,
0x3B2,
1071899 // You begin cutting through the vein.
);
return true;
}
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071900); // // This vein has already been cut.
_cutting = true;
Timer.StartTimer(TimeSpan.FromSeconds(3), () => CuttingDone(from));
// You begin cutting through the vein.
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071899);
return true;
}
return false;
// This vein has already been cut.
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071900);
}
private void CuttingDone(Mobile from)
return false;
}
private void CuttingDone(Mobile from)
{
_cutting = false;
Cut = true;
ItemID = ItemID == 0x1B1C ? 0x1B1B : 0x1B1C;
Owner?.PlaySound(0x199);
if (Organ is PlagueBeastRubbleOrgan organ)
{
_cutting = false;
Cut = true;
ItemID = ItemID == 0x1B1C ? 0x1B1B : 0x1B1C;
Owner?.PlaySound(0x199);
if (Organ is PlagueBeastRubbleOrgan organ)
{
organ.OnVeinCut(from, this);
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write(Cut);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadEncodedInt();
Cut = reader.ReadBool();
organ.OnVeinCut(from, this);
}
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,11 @@
{
"version": 0,
"type": "Server.Items.PlagueBeastBackupOrgan",
"properties": [
{
"name": "Gland",
"type": "Server.Item",
"rule": "SerializableInterfaceMigrationRule"
}
]
}

View file

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

View file

@ -0,0 +1,11 @@
{
"version": 0,
"type": "Server.Items.PlagueBeastComponent",
"properties": [
{
"name": "Organ",
"type": "Server.Items.PlagueBeastOrgan",
"rule": "SerializableInterfaceMigrationRule"
}
]
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,31 @@
{
"version": 0,
"type": "Server.Items.PlagueBeastOrgan",
"properties": [
{
"name": "Components",
"type": "System.Collections.Generic.List\u003CServer.Items.PlagueBeastComponent\u003E",
"rule": "ListMigrationRule",
"ruleArguments": [
"Server.Items.PlagueBeastComponent",
"SerializableInterfaceMigrationRule"
]
},
{
"name": "BrainHue",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Opened",
"type": "bool",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,16 @@
using ModernUO.Serialization;
namespace Server.Mobiles;
[SerializationGenerator(0, false)]
public partial class GrizzledMare : HellSteed
{
public override string DefaultName => "a grizzled mare";
[Constructible]
public GrizzledMare()
{
}
public override bool DeleteOnRelease => true;
}