Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -2,179 +2,185 @@ using System.Collections.Generic;
namespace Server.Items
{
public class PlagueBeastBackpack : BaseContainer
{
public override int DefaultMaxWeight => 0;
public override int DefaultMaxItems => 0;
public override int DefaultGumpID => 0x2A63;
public override int DefaultDropSound => 0x23F;
public class PlagueBeastBackpack : BaseContainer
{
private static int[,,] m_Positions =
{
{ { 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 int[,,] m_Positions = {
{ { 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 int[] m_BrainHues =
{
0x2B, 0x42, 0x54, 0x60
};
private static int[] m_BrainHues = {
0x2B, 0x42, 0x54, 0x60
};
public PlagueBeastBackpack() : base(0x261B)
{
Layer = Layer.Backpack;
}
public PlagueBeastBackpack() : base( 0x261B )
{
Layer = Layer.Backpack;
}
public PlagueBeastBackpack(Serial serial) : base(serial)
{
}
public void Initialize()
{
AddInnard( 0x1CF6, 0x0, 227, 128 );
AddInnard( 0x1D10, 0x0, 251, 128 );
AddInnard( 0x1FBE, 0x21, 240, 83 );
public override int DefaultMaxWeight => 0;
public override int DefaultMaxItems => 0;
public override int DefaultGumpID => 0x2A63;
public override int DefaultDropSound => 0x23F;
AddInnard( new PlagueBeastHeart(), 229, 104 );
public void Initialize()
{
AddInnard(0x1CF6, 0x0, 227, 128);
AddInnard(0x1D10, 0x0, 251, 128);
AddInnard(0x1FBE, 0x21, 240, 83);
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 );
AddInnard(new PlagueBeastHeart(), 229, 104);
List<PlagueBeastOrgan> organs = new List<PlagueBeastOrgan>();
PlagueBeastOrgan organ;
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);
for ( int i = 0; i < 6; i++ )
{
int random = Utility.Random( 3 );
List<PlagueBeastOrgan> organs = new List<PlagueBeastOrgan>();
PlagueBeastOrgan organ;
if ( i == 5 )
random = 0;
for (int i = 0; i < 6; i++)
{
int random = Utility.Random(3);
switch ( random )
{
default:
case 0: organ = new PlagueBeastRockOrgan(); break;
case 1: organ = new PlagueBeastMaidenOrgan(); break;
case 2: organ = new PlagueBeastRubbleOrgan(); break;
}
if (i == 5)
random = 0;
organs.Add( organ );
AddInnard( organ, m_Positions[ random, i, 0 ], m_Positions[ random, i, 1 ] );
}
switch (random)
{
default:
case 0:
organ = new PlagueBeastRockOrgan();
break;
case 1:
organ = new PlagueBeastMaidenOrgan();
break;
case 2:
organ = new PlagueBeastRubbleOrgan();
break;
}
organ = new PlagueBeastBackupOrgan();
organs.Add( organ );
AddInnard( organ, 129, 214 );
organs.Add(organ);
AddInnard(organ, m_Positions[random, i, 0], m_Positions[random, i, 1]);
}
for ( int i = 0; i < m_BrainHues.Length; i++ )
{
int random = Utility.Random( organs.Count );
organ = organs[ random ];
organ.BrainHue = m_BrainHues[ i ];
organs.RemoveAt( random );
}
organ = new PlagueBeastBackupOrgan();
organs.Add(organ);
AddInnard(organ, 129, 214);
organs.Clear();
for (int i = 0; i < m_BrainHues.Length; i++)
{
int random = Utility.Random(organs.Count);
organ = organs[random];
organ.BrainHue = m_BrainHues[i];
organs.RemoveAt(random);
}
AddInnard( new PlagueBeastMainOrgan(), 240, 161 );
}
organs.Clear();
public override bool TryDropItem( Mobile from, Item dropped, bool sendFullMessage )
{
if ( dropped is PlagueBeastInnard || dropped is PlagueBeastGland )
return base.TryDropItem( from, dropped, sendFullMessage );
AddInnard(new PlagueBeastMainOrgan(), 240, 161);
}
return false;
}
public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
{
if (dropped is PlagueBeastInnard || dropped is PlagueBeastGland)
return base.TryDropItem(from, dropped, sendFullMessage);
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
{
if ( IsAccessibleTo( from ) && ( item is PlagueBeastInnard || item is PlagueBeastGland ) )
{
Rectangle2D ir = ItemBounds.Table[ item.ItemID ];
int x, y;
int cx = p.X + ir.X + ir.Width / 2;
int cy = p.Y + ir.Y + ir.Height / 2;
return false;
}
for ( int i = Items.Count - 1; i >= 0; i-- )
{
if ( Items[ i ] is PlagueBeastComponent innard )
{
Rectangle2D r = ItemBounds.Table[ innard.ItemID ];
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (IsAccessibleTo(from) && (item is PlagueBeastInnard || item is PlagueBeastGland))
{
Rectangle2D ir = ItemBounds.Table[item.ItemID];
int x, y;
int cx = p.X + ir.X + ir.Width / 2;
int cy = p.Y + ir.Y + ir.Height / 2;
x = innard.X + r.X;
y = innard.Y + r.Y;
for (int i = Items.Count - 1; i >= 0; i--)
if (Items[i] is PlagueBeastComponent innard)
{
Rectangle2D r = ItemBounds.Table[innard.ItemID];
if ( cx >= x && cx <= x + r.Width && cy >= y && cy <= y + r.Height )
{
innard.OnDragDrop( from, item );
break;
}
}
}
x = innard.X + r.X;
y = innard.Y + r.Y;
return base.OnDragDropInto( from, item, p );
}
if (cx >= x && cx <= x + r.Width && cy >= y && cy <= y + r.Height)
{
innard.OnDragDrop(from, item);
break;
}
}
return false;
}
return base.OnDragDropInto(from, item, p);
}
public void AddInnard( int itemID, int hue, int x, int y )
{
AddInnard( new PlagueBeastInnard( itemID, hue ), x, y );
}
return false;
}
public void AddInnard( PlagueBeastInnard innard, int x, int y )
{
AddItem( innard );
innard.Location = new Point3D( x, y, 0 );
innard.Map = Map;
}
public void AddInnard(int itemID, int hue, int x, int y)
{
AddInnard(new PlagueBeastInnard(itemID, hue), x, y);
}
public PlagueBeastBackpack( Serial serial ) : base( serial )
{
}
public void AddInnard(PlagueBeastInnard innard, int x, int y)
{
AddItem(innard);
innard.Location = new Point3D(x, y, 0);
innard.Map = Map;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -3,112 +3,108 @@ using Server.Network;
namespace Server.Items
{
public class PlagueBeastBlood : PlagueBeastComponent
{
public bool Patched => ItemID == 0x1765;
public class PlagueBeastBlood : PlagueBeastComponent
{
private Timer m_Timer;
public bool Starting => ItemID == 0x122C;
public PlagueBeastBlood() : base(0x122C, 0)
{
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.5), TimeSpan.FromSeconds(1.5), 3, Hemorrhage);
}
private Timer m_Timer;
public PlagueBeastBlood(Serial serial) : base(serial)
{
}
public PlagueBeastBlood() : base( 0x122C, 0 )
{
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), TimeSpan.FromSeconds( 1.5 ), 3, Hemorrhage );
}
public bool Patched => ItemID == 0x1765;
public override void OnAfterDelete()
{
if ( m_Timer != null && m_Timer.Running )
m_Timer.Stop();
}
public bool Starting => ItemID == 0x122C;
public override bool OnBandage( Mobile from )
{
if ( IsAccessibleTo( from ) && !Patched )
{
if ( m_Timer != null && m_Timer.Running )
m_Timer.Stop();
public override void OnAfterDelete()
{
if (m_Timer != null && m_Timer.Running)
m_Timer.Stop();
}
if ( Starting )
{
X += 2;
Y -= 9;
public override bool OnBandage(Mobile from)
{
if (IsAccessibleTo(from) && !Patched)
{
if (m_Timer != null && m_Timer.Running)
m_Timer.Stop();
if ( Organ is PlagueBeastRubbleOrgan )
Y -= 5;
else if ( Organ is PlagueBeastBackupOrgan )
X += 7;
}
else
{
X -= 4;
Y -= 2;
}
if (Starting)
{
X += 2;
Y -= 9;
ItemID = 0x1765;
if (Organ is PlagueBeastRubbleOrgan)
Y -= 5;
else if (Organ is PlagueBeastBackupOrgan)
X += 7;
}
else
{
X -= 4;
Y -= 2;
}
Container pack = Owner?.Backpack;
ItemID = 0x1765;
if ( pack != null )
{
for ( int i = 0; i < pack.Items.Count; i++ )
{
if ( pack.Items[ i ] is PlagueBeastMainOrgan main && main.Complete )
main.FinishOpening( from );
}
}
Container pack = Owner?.Backpack;
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071916 ); // * You patch up the wound with a bandage *
if (pack != null)
for (int i = 0; i < pack.Items.Count; i++)
if (pack.Items[i] is PlagueBeastMainOrgan main && main.Complete)
main.FinishOpening(from);
return true;
}
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071916); // * You patch up the wound with a bandage *
return false;
}
return true;
}
private void Hemorrhage()
{
if ( Patched )
return;
return false;
}
Owner?.PlaySound( 0x25 );
private void Hemorrhage()
{
if (Patched)
return;
if ( ItemID == 0x122A )
{
if ( Owner != null )
{
Owner.Unfreeze();
Owner.Kill();
}
}
else
{
if ( Starting )
{
X += 8;
Y -= 10;
}
Owner?.PlaySound(0x25);
ItemID--;
}
}
if (ItemID == 0x122A)
{
if (Owner != null)
{
Owner.Unfreeze();
Owner.Kill();
}
}
else
{
if (Starting)
{
X += 8;
Y -= 10;
}
public PlagueBeastBlood( Serial serial ) : base( serial )
{
}
ItemID--;
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -1,32 +1,32 @@
namespace Server.Items
{
public class PlagueBeastGland : Item
{
public override string DefaultName => "a healthy gland";
public class PlagueBeastGland : Item
{
[Constructible]
public PlagueBeastGland() : base(0x1CEF)
{
Weight = 1.0;
Hue = 0x6;
}
[Constructible]
public PlagueBeastGland() : base( 0x1CEF )
{
Weight = 1.0;
Hue = 0x6;
}
public PlagueBeastGland(Serial serial) : base(serial)
{
}
public PlagueBeastGland( Serial serial ) : base( serial )
{
}
public override string DefaultName => "a healthy gland";
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -2,78 +2,78 @@ using System;
namespace Server.Items
{
public class PlagueBeastHeart : PlagueBeastInnard
{
private Timer m_Timer;
public class PlagueBeastHeart : PlagueBeastInnard
{
private Timer m_Timer;
public PlagueBeastHeart() : base( 0x1363, 0x21 )
{
m_Timer = new InternalTimer( this );
m_Timer.Start();
}
public PlagueBeastHeart() : base(0x1363, 0x21)
{
m_Timer = new InternalTimer(this);
m_Timer.Start();
}
public override void OnAfterDelete()
{
if ( m_Timer != null && m_Timer.Running )
m_Timer.Stop();
}
public PlagueBeastHeart(Serial serial) : base(serial)
{
}
public PlagueBeastHeart( Serial serial ) : base( serial )
{
}
public override void OnAfterDelete()
{
if (m_Timer != null && m_Timer.Running)
m_Timer.Stop();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
m_Timer = new InternalTimer( this );
m_Timer.Start();
}
int version = reader.ReadEncodedInt();
private class InternalTimer : Timer
{
private PlagueBeastHeart m_Heart;
private bool m_Delay;
m_Timer = new InternalTimer(this);
m_Timer.Start();
}
public InternalTimer( PlagueBeastHeart heart ) : base( TimeSpan.FromSeconds( 0.5 ), TimeSpan.FromSeconds( 0.5 ) )
{
m_Heart = heart;
}
private class InternalTimer : Timer
{
private bool m_Delay;
private PlagueBeastHeart m_Heart;
protected override void OnTick()
{
if ( m_Heart == null || m_Heart.Deleted || m_Heart.Owner == null || !m_Heart.Owner.Alive )
{
Stop();
return;
}
public InternalTimer(PlagueBeastHeart heart) : base(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5))
{
m_Heart = heart;
}
if ( m_Heart.ItemID == 0x1363 )
{
if ( m_Delay )
{
m_Heart.ItemID = 0x1367;
m_Heart.Owner.PlaySound( 0x11F );
}
protected override void OnTick()
{
if (m_Heart == null || m_Heart.Deleted || m_Heart.Owner == null || !m_Heart.Owner.Alive)
{
Stop();
return;
}
m_Delay = !m_Delay;
}
else
{
m_Heart.ItemID = 0x1363;
m_Heart.Owner.PlaySound( 0x120 );
m_Delay = false;
}
}
}
}
}
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;
}
}
}
}
}

View file

@ -3,170 +3,170 @@ using Server.Network;
namespace Server.Items
{
public class PlagueBeastInnard : Item, IScissorable, ICarvable
{
public PlagueBeastLord Owner => RootParent as PlagueBeastLord;
public override string DefaultName => "plague beast innards";
public class PlagueBeastInnard : Item, IScissorable, ICarvable
{
public PlagueBeastInnard(int itemID, int hue) : base(itemID)
{
Hue = hue;
Movable = false;
Weight = 1.0;
}
public PlagueBeastInnard( int itemID, int hue ) : base( itemID )
{
Hue = hue;
Movable = false;
Weight = 1.0;
}
public PlagueBeastInnard(Serial serial) : base(serial)
{
}
public virtual bool Scissor( Mobile from, Scissors scissors )
{
return false;
}
public PlagueBeastLord Owner => RootParent as PlagueBeastLord;
public override string DefaultName => "plague beast innards";
public virtual void Carve( Mobile from, Item with )
{
}
public virtual void Carve(Mobile from, Item with)
{
}
public virtual bool OnBandage( Mobile from )
{
return false;
}
public virtual bool Scissor(Mobile from, Scissors scissors)
{
return false;
}
public override bool IsAccessibleTo( Mobile check )
{
if ( (int) check.AccessLevel >= (int) AccessLevel.GameMaster )
return true;
public virtual bool OnBandage(Mobile from)
{
return false;
}
PlagueBeastLord owner = Owner;
public override bool IsAccessibleTo(Mobile check)
{
if ((int)check.AccessLevel >= (int)AccessLevel.GameMaster)
return true;
if ( owner == null )
return false;
PlagueBeastLord owner = Owner;
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;
if (owner == null)
return false;
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;
public PlagueBeastInnard( Serial serial ) : base( serial )
{
}
return false;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
PlagueBeastLord owner = Owner;
PlagueBeastLord owner = Owner;
if ( owner == null || !owner.Alive )
Delete();
}
}
if (owner == null || !owner.Alive)
Delete();
}
}
public class PlagueBeastComponent : PlagueBeastInnard
{
public PlagueBeastOrgan Organ { get; set; }
public class PlagueBeastComponent : PlagueBeastInnard
{
public PlagueBeastComponent(int itemID, int hue) : this(itemID, hue, false)
{
}
public bool IsBrain => ItemID == 0x1CF0;
public PlagueBeastComponent(int itemID, int hue, bool movable) : base(itemID, hue)
{
Movable = movable;
}
public bool IsGland => ItemID == 0x1CEF;
public PlagueBeastComponent(Serial serial) : base(serial)
{
}
public bool IsReceptacle => ItemID == 0x9DF;
public PlagueBeastOrgan Organ{ get; set; }
public PlagueBeastComponent( int itemID, int hue ) : this( itemID, hue, false )
{
}
public bool IsBrain => ItemID == 0x1CF0;
public PlagueBeastComponent( int itemID, int hue, bool movable ) : base( itemID, hue )
{
Movable = movable;
}
public bool IsGland => ItemID == 0x1CEF;
public override bool DropToItem( Mobile from, Item target, Point3D p )
{
if ( target is PlagueBeastBackpack )
return base.DropToItem( from, target, p );
public bool IsReceptacle => ItemID == 0x9DF;
return false;
}
public override bool DropToItem(Mobile from, Item target, Point3D p)
{
if (target is PlagueBeastBackpack)
return base.DropToItem(from, target, p);
public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
{
return false;
}
return false;
}
public override bool DropToMobile( Mobile from, Mobile target, Point3D p )
{
return false;
}
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
{
return false;
}
public override bool DropToWorld( Mobile from, Point3D p )
{
return false;
}
public override bool DropToMobile(Mobile from, Mobile target, Point3D p)
{
return false;
}
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( Organ != null && Organ.OnDropped( from, dropped, this ) )
{
if ( dropped is PlagueBeastComponent component )
Organ.Components.Add( component );
}
public override bool DropToWorld(Mobile from, Point3D p)
{
return false;
}
return true;
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (Organ != null && Organ.OnDropped(from, dropped, this))
if (dropped is PlagueBeastComponent component)
Organ.Components.Add(component);
public override bool OnDragLift( Mobile from )
{
if ( IsAccessibleTo( from ) )
{
if ( Organ != null && Organ.OnLifted( from, this ) )
{
from.SendLocalizedMessage( IsGland ? 1071895 : 1071914, null, 0x3B2 ); // * You rip the organ out of the plague beast's flesh *
return true;
}
if ( Organ.Components.Contains( this ) )
Organ.Components.Remove( this );
public override bool OnDragLift(Mobile from)
{
if (IsAccessibleTo(from))
{
if (Organ != null && Organ.OnLifted(from, this))
{
from.SendLocalizedMessage(IsGland ? 1071895 : 1071914, null,
0x3B2); // * You rip the organ out of the plague beast's flesh *
Organ = null;
from.PlaySound( 0x1CA );
}
if (Organ.Components.Contains(this))
Organ.Components.Remove(this);
return true;
}
Organ = null;
from.PlaySound(0x1CA);
}
return false;
}
return true;
}
public PlagueBeastComponent( Serial serial ) : base( serial )
{
}
return false;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
writer.WriteEncodedInt(0); // version
writer.WriteItem<PlagueBeastOrgan>( Organ );
}
writer.WriteItem(Organ);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
Organ = reader.ReadItem<PlagueBeastOrgan>();
}
}
}
Organ = reader.ReadItem<PlagueBeastOrgan>();
}
}
}

View file

@ -4,68 +4,69 @@ using Server.Network;
namespace Server.Items
{
public class PlagueBeastMutationCore : Item, IScissorable
{
[CommandProperty( AccessLevel.GameMaster )]
public bool Cut { get; set; }
public class PlagueBeastMutationCore : Item, IScissorable
{
[Constructible]
public PlagueBeastMutationCore() : base(0x1CF0)
{
Cut = true;
Weight = 1.0;
Hue = 0x480;
}
public override string DefaultName => "a plague beast mutation core";
public PlagueBeastMutationCore(Serial serial) : base(serial)
{
}
[Constructible]
public PlagueBeastMutationCore() : base( 0x1CF0 )
{
Cut = true;
Weight = 1.0;
Hue = 0x480;
}
[CommandProperty(AccessLevel.GameMaster)]
public bool Cut{ get; set; }
public virtual bool Scissor( Mobile from, Scissors scissors )
{
if ( !Cut )
{
PlagueBeastLord owner = RootParent as PlagueBeastLord;
public override string DefaultName => "a plague beast mutation core";
Cut = true;
Movable = true;
public virtual bool Scissor(Mobile from, Scissors scissors)
{
if (!Cut)
{
PlagueBeastLord owner = RootParent as PlagueBeastLord;
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 *
Cut = true;
Movable = true;
if ( owner != null )
Timer.DelayCall<PlagueBeastLord>( TimeSpan.FromSeconds( 1 ), KillParent, owner );
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 *
return true;
}
if (owner != null)
Timer.DelayCall(TimeSpan.FromSeconds(1), KillParent, owner);
return false;
}
return true;
}
private void KillParent( PlagueBeastLord parent )
{
parent.Unfreeze();
parent.Kill();
}
return false;
}
public PlagueBeastMutationCore( Serial serial ) : base( serial )
{
}
private void KillParent(PlagueBeastLord parent)
{
parent.Unfreeze();
parent.Kill();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
writer.WriteEncodedInt(0); // version
writer.Write( (bool) Cut );
}
writer.Write(Cut);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
Cut = reader.ReadBool();
}
}
}
Cut = reader.ReadBool();
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -3,75 +3,76 @@ using Server.Network;
namespace Server.Items
{
public class PlagueBeastVein : PlagueBeastComponent
{
public bool Cut { get; private set; }
public class PlagueBeastVein : PlagueBeastComponent
{
private Timer m_Timer;
private Timer m_Timer;
public PlagueBeastVein(int itemID, int hue) : base(itemID, hue)
{
Cut = false;
}
public PlagueBeastVein( int itemID, int hue ) : base( itemID, hue )
{
Cut = false;
}
public PlagueBeastVein(Serial serial) : base(serial)
{
}
public override bool Scissor( Mobile from, Scissors scissors )
{
if ( IsAccessibleTo( from ) )
{
if ( !Cut && m_Timer == null )
{
m_Timer = Timer.DelayCall<Mobile>( TimeSpan.FromSeconds( 3 ), CuttingDone, from );
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071899 ); // You begin cutting through the vein.
return true;
}
public bool Cut{ get; private set; }
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071900 ); // // This vein has already been cut.
}
public override bool Scissor(Mobile from, Scissors scissors)
{
if (IsAccessibleTo(from))
{
if (!Cut && m_Timer == null)
{
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(3), CuttingDone, from);
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2,
1071899); // You begin cutting through the vein.
return true;
}
return false;
}
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071900); // // This vein has already been cut.
}
public override void OnAfterDelete()
{
if ( m_Timer != null && m_Timer.Running )
m_Timer.Stop();
}
return false;
}
private void CuttingDone( Mobile from )
{
Cut = true;
public override void OnAfterDelete()
{
if (m_Timer != null && m_Timer.Running)
m_Timer.Stop();
}
if ( ItemID == 0x1B1C )
ItemID = 0x1B1B;
else
ItemID = 0x1B1C;
private void CuttingDone(Mobile from)
{
Cut = true;
Owner?.PlaySound( 0x199 );
if (ItemID == 0x1B1C)
ItemID = 0x1B1B;
else
ItemID = 0x1B1C;
if ( Organ is PlagueBeastRubbleOrgan organ )
organ.OnVeinCut( from, this );
}
Owner?.PlaySound(0x199);
public PlagueBeastVein( Serial serial ) : base( serial )
{
}
if (Organ is PlagueBeastRubbleOrgan organ)
organ.OnVeinCut(from, this);
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
writer.WriteEncodedInt(0); // version
writer.Write( (bool) Cut );
}
writer.Write(Cut);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
Cut = reader.ReadBool();
}
}
}
Cut = reader.ReadBool();
}
}
}