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

@ -1,5 +1,3 @@
/*
* Simply add this box with param true to create the entire valentine's 2007 package.
* Adding it with no params or false will create an empty box.
@ -7,58 +5,59 @@
namespace Server.Items
{
public class RedVelvetGiftBox : BaseContainer
{
public override int DefaultGumpID => 0x3f;
public override int LabelNumber => 1077596; // A Red Velvet Box
public class RedVelvetGiftBox : BaseContainer
{
[Constructible]
public RedVelvetGiftBox()
: this(false)
{
}
[Constructible]
public RedVelvetGiftBox()
: this( false )
{
}
[Constructible]
public RedVelvetGiftBox(bool fill)
: base(0xE7A)
{
Hue = 0x20;
[Constructible]
public RedVelvetGiftBox( bool fill )
: base( 0xE7A )
{
Hue = 0x20;
if (fill)
{
for (int i = 0; i < 5; i++)
{
AddToBox(new ValentinesCardSouth(), new Point3D(60 + i * 10, 47, 0));
AddToBox(new ValentinesCardEast(), new Point3D(20 + i * 10, 72, 0));
}
if (fill)
{
for (int i = 0; i < 5; i++)
{
AddToBox(new ValentinesCardSouth(), new Point3D(60 + (i * 10), 47, 0));
AddToBox(new ValentinesCardEast(), new Point3D(20 + (i * 10), 72, 0));
}
AddToBox(new Bacon(), new Point3D(90, 85, 0));
AddToBox(new RoseInAVase(), new Point3D(130, 55, 0));
}
}
AddToBox(new Bacon(), new Point3D(90, 85, 0));
AddToBox(new RoseInAVase(), new Point3D(130, 55, 0));
}
}
public virtual void AddToBox(Item item, Point3D loc)
{
DropItem(item);
item.Location = loc;
}
public RedVelvetGiftBox(Serial serial)
: base(serial)
{
}
public RedVelvetGiftBox( Serial serial )
: base( serial )
{
}
public override int DefaultGumpID => 0x3f;
public override int LabelNumber => 1077596; // A Red Velvet Box
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public virtual void AddToBox(Item item, Point3D loc)
{
DropItem(item);
item.Location = loc;
}
writer.Write( (int)0 ); // version
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
writer.Write(0); // version
}
int version = reader.ReadInt();
}
}
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View file

@ -1,34 +1,34 @@
namespace Server.Items
{
public class RoseInAVase : Item /* TODO: when dye tub changes are implemented, furny dyable this */
{
public override int LabelNumber => 1023760; // A Rose in a Vase 1023760
public class RoseInAVase : Item /* TODO: when dye tub changes are implemented, furny dyable this */
{
[Constructible]
public RoseInAVase()
: base(0x0EB0)
{
Hue = 0x20;
LootType = LootType.Blessed;
}
[Constructible]
public RoseInAVase( )
: base( 0x0EB0 )
{
Hue = 0x20;
LootType = LootType.Blessed;
}
public RoseInAVase(Serial serial)
: base(serial)
{
}
public RoseInAVase( Serial serial )
: base( serial )
{
}
public override int LabelNumber => 1023760; // A Rose in a Vase 1023760
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int)0 ); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
int version = reader.ReadInt();
}
}
}

View file

@ -1,193 +1,197 @@
using System;
using Server.Mobiles;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
public class ValentinesCard : Item
{
public override string DefaultName => "a Valentine's card";
public class ValentinesCard : Item
{
private static string Unsigned = "___";
private string m_From;
[CommandProperty(AccessLevel.GameMaster)]
public virtual string From { get => m_From;
set => m_From = value;
}
private int m_LabelNumber;
private string m_To;
[CommandProperty(AccessLevel.GameMaster)]
public virtual string To { get => m_To;
set => m_To = value;
}
[Constructible]
public ValentinesCard(int itemid)
: base(itemid)
{
LootType = LootType.Blessed;
Hue = Utility.RandomDouble() < .001 ? 0x47E : 0xE8;
m_LabelNumber = Utility.Random(1077589, 5);
}
private static string Unsigned = "___";
public ValentinesCard(Serial serial)
: base(serial)
{
}
private int m_LabelNumber;
private string m_From;
private string m_To;
public override string DefaultName => "a Valentine's card";
[Constructible]
public ValentinesCard( int itemid )
: base(itemid)
{
LootType = LootType.Blessed;
Hue = Utility.RandomDouble() < .001 ? 0x47E : 0xE8;
m_LabelNumber = Utility.Random(1077589, 5);
}
[CommandProperty(AccessLevel.GameMaster)]
public virtual string From
{
get => m_From;
set => m_From = value;
}
/*
* Five possible messages to be signed:
*
* To my one true love, ~1_target_player~. Signed: ~2_player~ 1077589
* You’ve pwnd my heart, ~1_target_player~. Signed: ~2_player~ 1077590
* Happy Valentine’s Day, ~1_target_player~. Signed: ~2_player~ 1077591
* Blackrock has driven me crazy... for ~1_target_player~! Signed: ~2_player~ 1077592
* You light my Candle of Love, ~1_target_player~! Signed: ~2_player~ 1077593
*
*/
[CommandProperty(AccessLevel.GameMaster)]
public virtual string To
{
get => m_To;
set => m_To = value;
}
public override void AddNameProperty(ObjectPropertyList list)
{
list.Add(m_LabelNumber, $"{m_To ?? Unsigned}\t{m_From ?? Unsigned}");
}
/*
* Five possible messages to be signed:
*
* To my one true love, ~1_target_player~. Signed: ~2_player~ 1077589
* You’ve pwnd my heart, ~1_target_player~. Signed: ~2_player~ 1077590
* Happy Valentine’s Day, ~1_target_player~. Signed: ~2_player~ 1077591
* Blackrock has driven me crazy... for ~1_target_player~! Signed: ~2_player~ 1077592
* You light my Candle of Love, ~1_target_player~! Signed: ~2_player~ 1077593
*
*/
public override void OnSingleClick( Mobile from )
{
base.OnSingleClick( from );
public override void AddNameProperty(ObjectPropertyList list)
{
list.Add(m_LabelNumber, $"{m_To ?? Unsigned}\t{m_From ?? Unsigned}");
}
LabelTo( from, m_LabelNumber,
$"{m_To ?? Unsigned}\t{m_From ?? Unsigned}");
}
public override void OnSingleClick(Mobile from)
{
base.OnSingleClick(from);
public override void OnDoubleClick(Mobile from)
{
if (m_To == null)
{
if (IsChildOf(from))
{
from.BeginTarget(10, false, TargetFlags.None, OnTarget);
LabelTo(from, m_LabelNumber,
$"{m_To ?? Unsigned}\t{m_From ?? Unsigned}");
}
from.SendLocalizedMessage(1077497); //To whom do you wish to give this card?
}
else
{
from.SendLocalizedMessage(1080063); // This must be in your backpack to use it.
}
}
}
public override void OnDoubleClick(Mobile from)
{
if (m_To == null)
{
if (IsChildOf(from))
{
from.BeginTarget(10, false, TargetFlags.None, OnTarget);
public virtual void OnTarget(Mobile from, object targeted)
{
if (!Deleted)
{
if (targeted != null && targeted is Mobile to)
{
if (to is PlayerMobile)
{
if (to != from)
{
m_From = from.Name;
m_To = to.Name;
from.SendLocalizedMessage(1077498); //You fill out the card. Hopefully the other person actually likes you...
InvalidateProperties();
}
else
{
from.SendLocalizedMessage(1077495); //You can't give yourself a card, silly!
}
}
else
{
from.SendLocalizedMessage(1077496); //You can't possibly be THAT lonely!
}
}
else
{
from.SendLocalizedMessage(1077488); //That's not another player!
}
}
}
from.SendLocalizedMessage(1077497); //To whom do you wish to give this card?
}
else
{
from.SendLocalizedMessage(1080063); // This must be in your backpack to use it.
}
}
}
public ValentinesCard(Serial serial)
: base( serial )
{
}
public virtual void OnTarget(Mobile from, object targeted)
{
if (!Deleted)
{
if (targeted != null && targeted is Mobile to)
{
if (to is PlayerMobile)
{
if (to != from)
{
m_From = from.Name;
m_To = to.Name;
from.SendLocalizedMessage(
1077498); //You fill out the card. Hopefully the other person actually likes you...
InvalidateProperties();
}
else
{
from.SendLocalizedMessage(1077495); //You can't give yourself a card, silly!
}
}
else
{
from.SendLocalizedMessage(1077496); //You can't possibly be THAT lonely!
}
}
else
{
from.SendLocalizedMessage(1077488); //That's not another player!
}
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int)0 ); // version
writer.Write((int)m_LabelNumber);
writer.Write((string)m_From);
writer.Write((string)m_To);
}
writer.Write(0); // version
writer.Write(m_LabelNumber);
writer.Write(m_From);
writer.Write(m_To);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_LabelNumber = reader.ReadInt();
m_From = reader.ReadString();
m_To = reader.ReadString();
int version = reader.ReadInt();
m_LabelNumber = reader.ReadInt();
m_From = reader.ReadString();
m_To = reader.ReadString();
Utility.Intern(ref m_From);
Utility.Intern(ref m_To);
}
}
Utility.Intern(ref m_From);
Utility.Intern(ref m_To);
}
}
public class ValentinesCardSouth : ValentinesCard
{
[Constructible]
public ValentinesCardSouth()
: base(0x0EBD)
{
}
public class ValentinesCardSouth : ValentinesCard
{
[Constructible]
public ValentinesCardSouth()
: base(0x0EBD)
{
}
public ValentinesCardSouth(Serial serial)
: base(serial)
{
}
public ValentinesCardSouth(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
int version = reader.ReadInt();
}
}
public class ValentinesCardEast : ValentinesCard
{
[Constructible]
public ValentinesCardEast()
: base(0x0EBE)
{
}
public class ValentinesCardEast : ValentinesCard
{
[Constructible]
public ValentinesCardEast()
: base(0x0EBE)
{
}
public ValentinesCardEast(Serial serial)
: base(serial)
{
}
public ValentinesCardEast(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
int version = reader.ReadInt();
}
}
}