Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
|
|
@ -0,0 +1,31 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
[Flippable(0x49CC, 0x49D0)]
|
||||
public class AnimatedHeartShapedBox : HeartShapedBox
|
||||
{
|
||||
[Constructible]
|
||||
public AnimatedHeartShapedBox()
|
||||
{
|
||||
ItemID = 0x49CC;
|
||||
}
|
||||
|
||||
public AnimatedHeartShapedBox(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,292 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class StValentinesBear : Item
|
||||
{
|
||||
private string m_Line1;
|
||||
private string m_Line2;
|
||||
private string m_Line3;
|
||||
|
||||
private string m_Owner;
|
||||
|
||||
public StValentinesBear(int itemid, string name)
|
||||
: base(itemid)
|
||||
{
|
||||
m_Owner = name;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public StValentinesBear(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Owner != null)
|
||||
return $"{m_Owner}'s St. Valentine Bear";
|
||||
return "St. Valentine Bear";
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Owner
|
||||
{
|
||||
get => m_Owner;
|
||||
set
|
||||
{
|
||||
m_Owner = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Line1
|
||||
{
|
||||
get => m_Line1;
|
||||
set
|
||||
{
|
||||
m_Line1 = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Line2
|
||||
{
|
||||
get => m_Line2;
|
||||
set
|
||||
{
|
||||
m_Line2 = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Line3
|
||||
{
|
||||
get => m_Line3;
|
||||
set
|
||||
{
|
||||
m_Line3 = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime EditLimit{ get; set; }
|
||||
|
||||
public bool IsSigned => m_Line1 != null || m_Line2 != null || m_Line3 != null;
|
||||
|
||||
public bool CanSign => !IsSigned || DateTime.UtcNow <= EditLimit;
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
if (m_Owner != null)
|
||||
list.Add(1150295, m_Owner); // ~1_NAME~'s St. Valentine Bear
|
||||
else
|
||||
list.Add(1150294); // St. Valentine Bear
|
||||
|
||||
AddLine(list, 1150301, m_Line1); // [ ~1_LINE0~ ]
|
||||
AddLine(list, 1150302, m_Line2); // [ ~1_LINE1~ ]
|
||||
AddLine(list, 1150303, m_Line3); // [ ~1_LINE2~ ]
|
||||
}
|
||||
|
||||
private static void AddLine(ObjectPropertyList list, int cliloc, string line)
|
||||
{
|
||||
if (line != null)
|
||||
list.Add(cliloc, line);
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
ShowLine(from, 1150301, m_Line1); // [ ~1_LINE0~ ]
|
||||
ShowLine(from, 1150302, m_Line2); // [ ~1_LINE1~ ]
|
||||
ShowLine(from, 1150303, m_Line3); // [ ~1_LINE2~ ]
|
||||
}
|
||||
|
||||
private void ShowLine(Mobile from, int cliloc, string line)
|
||||
{
|
||||
if (line != null)
|
||||
LabelTo(from, cliloc, line);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!CupidsArrow.CheckSeason(from) || !CanSign)
|
||||
return;
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1080063); // This must be in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendGump(new InternalGump(this));
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(m_Owner);
|
||||
writer.Write(m_Line1);
|
||||
writer.Write(m_Line2);
|
||||
writer.Write(m_Line3);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Owner = Utility.Intern(reader.ReadString());
|
||||
m_Line1 = Utility.Intern(reader.ReadString());
|
||||
m_Line2 = Utility.Intern(reader.ReadString());
|
||||
m_Line3 = Utility.Intern(reader.ReadString());
|
||||
}
|
||||
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
private StValentinesBear m_Bear;
|
||||
|
||||
public InternalGump(StValentinesBear bear)
|
||||
: base(50, 50)
|
||||
{
|
||||
m_Bear = bear;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 420, 320, 9300);
|
||||
AddHtml(10, 10, 400, 21, "<CENTER>St. Valentine Bear</CENTER>");
|
||||
AddHtmlLocalized(10, 40, 400, 75, 1150293, 0); // Enter up to three lines of personalized greeting for your St. Valentine Bear. You many enter up to 25 characters per line. Once you enter text, you will only be able to correct mistakes for 10 minutes.
|
||||
|
||||
AddHtmlLocalized(10, 129, 400, 21, 1150296, 0); // Line 1:
|
||||
AddBackground(10, 150, 400, 24, 9350);
|
||||
AddTextEntry(15, 152, 390, 20, 0, 0, "", 25);
|
||||
|
||||
AddHtmlLocalized(10, 179, 400, 21, 1150297, 0); // Line 2:
|
||||
AddBackground(10, 200, 400, 24, 9350);
|
||||
AddTextEntry(15, 202, 390, 20, 0, 1, "", 25);
|
||||
|
||||
AddHtmlLocalized(10, 229, 400, 21, 1150298, 0); // Line 3:
|
||||
AddBackground(10, 250, 400, 24, 9350);
|
||||
AddTextEntry(15, 252, 390, 20, 0, 2, "", 25);
|
||||
|
||||
AddButton(15, 285, 242, 241, 0);
|
||||
AddButton(335, 285, 247, 248, 1);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if (m_Bear.Deleted || !m_Bear.IsChildOf(from.Backpack) || !m_Bear.CanSign || info.ButtonID != 1)
|
||||
return;
|
||||
|
||||
string line1 = GetLine(info, 0);
|
||||
string line2 = GetLine(info, 1);
|
||||
string line3 = GetLine(info, 2);
|
||||
|
||||
if (string.IsNullOrEmpty(line1)
|
||||
|| string.IsNullOrEmpty(line2)
|
||||
|| string.IsNullOrEmpty(line3))
|
||||
{
|
||||
from.SendMessage("Lines cannot be left blank.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (line1.Length > 25
|
||||
|| line2.Length > 25
|
||||
|| line3.Length > 25)
|
||||
{
|
||||
from.SendMessage("Lines may not exceed 25 characters.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_Bear.IsSigned)
|
||||
m_Bear.EditLimit = DateTime.UtcNow + TimeSpan.FromMinutes(10);
|
||||
|
||||
m_Bear.Line1 = Utility.FixHtml(line1);
|
||||
m_Bear.Line2 = Utility.FixHtml(line2);
|
||||
m_Bear.Line3 = Utility.FixHtml(line3);
|
||||
|
||||
from.SendMessage("You add the personalized greeting to your St. Valentine Bear.");
|
||||
}
|
||||
|
||||
private static string GetLine(RelayInfo info, int idx)
|
||||
{
|
||||
TextRelay tr = info.GetTextEntry(idx);
|
||||
|
||||
return tr?.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Flippable(0x48E0, 0x48E1)]
|
||||
public class StValentinesPanda : StValentinesBear
|
||||
{
|
||||
[Constructible]
|
||||
public StValentinesPanda(string name = null)
|
||||
: base(0x48E0, name)
|
||||
{
|
||||
}
|
||||
|
||||
public StValentinesPanda(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
[Flippable(0x48E2, 0x48E3)]
|
||||
public class StValentinesPolarBear : StValentinesBear
|
||||
{
|
||||
[Constructible]
|
||||
public StValentinesPolarBear(string name = null)
|
||||
: base(0x48E2, name)
|
||||
{
|
||||
}
|
||||
|
||||
public StValentinesPolarBear(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
[Flippable(0x4F7C, 0x4F7D)]
|
||||
public class CupidStatue : Item
|
||||
{
|
||||
[Constructible]
|
||||
public CupidStatue()
|
||||
: base(0x4F7D)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public CupidStatue(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1099220; // cupid statue
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CupidsArrow : Item
|
||||
{
|
||||
// TODO: Check messages
|
||||
|
||||
public override int LabelNumber => 1152270; // Cupid's Arrow 2012
|
||||
|
||||
private string m_From;
|
||||
private string m_To;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string From
|
||||
{
|
||||
get => m_From;
|
||||
set { m_From = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string To
|
||||
{
|
||||
get => m_To;
|
||||
set { m_To = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public bool IsSigned => ( m_From != null && m_To != null );
|
||||
|
||||
[Constructible]
|
||||
public CupidsArrow()
|
||||
: base( 0x4F7F )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public override void AddNameProperty( ObjectPropertyList list )
|
||||
{
|
||||
base.AddNameProperty( list );
|
||||
|
||||
if ( IsSigned )
|
||||
list.Add( 1152273, $"{m_From}\t{m_To}"); // ~1_val~ is madly in love with ~2_val~
|
||||
}
|
||||
|
||||
public static bool CheckSeason( Mobile from )
|
||||
{
|
||||
if ( DateTime.UtcNow.Month == 2 )
|
||||
return true;
|
||||
|
||||
from.SendLocalizedMessage( 1152318 ); // You may not use this item out of season.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( IsSigned )
|
||||
LabelTo( from, 1152273, $"{m_From}\t{m_To}"); // ~1_val~ is madly in love with ~2_val~
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsSigned || !CheckSeason( from ) )
|
||||
return;
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1080063 ); // This must be in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
from.BeginTarget( 10, false, TargetFlags.None, OnTarget );
|
||||
from.SendMessage( "Who do you wish to use this on?" );
|
||||
}
|
||||
|
||||
private void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( IsSigned || !IsChildOf( from.Backpack ) )
|
||||
return;
|
||||
|
||||
if ( targeted is Mobile m )
|
||||
{
|
||||
if ( !m.Alive )
|
||||
{
|
||||
from.SendLocalizedMessage( 1152269 ); // That target is dead and even Cupid's arrow won't make them love you.
|
||||
return;
|
||||
}
|
||||
|
||||
m_From = from.Name;
|
||||
m_To = m.Name;
|
||||
|
||||
InvalidateProperties();
|
||||
|
||||
from.SendMessage( "You inscribe the arrow." );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "That is not a person." );
|
||||
}
|
||||
}
|
||||
|
||||
public CupidsArrow( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( 0 );
|
||||
|
||||
writer.Write( m_From );
|
||||
writer.Write( m_To );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_From = Utility.Intern( reader.ReadString() );
|
||||
m_To = Utility.Intern( reader.ReadString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
[Flippable(0x49CA, 0x49CB)]
|
||||
public class HeartShapedBox : BaseContainer
|
||||
{
|
||||
private static int m_DropSound;
|
||||
|
||||
[Constructible]
|
||||
public HeartShapedBox()
|
||||
: base(0x49CA)
|
||||
{
|
||||
}
|
||||
|
||||
public HeartShapedBox(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int DefaultDropSound => m_DropSound;
|
||||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
PrepareSound(from);
|
||||
return base.OnDragDropInto(from, item, p);
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
PrepareSound(from);
|
||||
return base.OnDragDrop(from, dropped);
|
||||
}
|
||||
|
||||
private static void PrepareSound(Mobile from)
|
||||
{
|
||||
m_DropSound = from.Female ? 0x430 : 0x320;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue