This commit is contained in:
commit
47711d616e
2644 changed files with 479454 additions and 0 deletions
281
Scripts/Items/Special/Holiday/Christmas/HolidayTree.cs
Normal file
281
Scripts/Items/Special/Holiday/Christmas/HolidayTree.cs
Normal file
|
|
@ -0,0 +1,281 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Network;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum HolidayTreeType
|
||||
{
|
||||
Classic,
|
||||
Modern
|
||||
}
|
||||
|
||||
public class HolidayTree : Item
|
||||
{
|
||||
private ArrayList m_Components;
|
||||
private Mobile m_Placer;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Placer
|
||||
{
|
||||
get{ return m_Placer; }
|
||||
set{ m_Placer = value; }
|
||||
}
|
||||
|
||||
private class Ornament : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041118; } } // a tree ornament
|
||||
|
||||
public Ornament( int itemID ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public Ornament( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
private class TreeTrunk : Item
|
||||
{
|
||||
private HolidayTree m_Tree;
|
||||
|
||||
public override int LabelNumber{ get{ return 1041117; } } // a tree for the holidays
|
||||
|
||||
public TreeTrunk( HolidayTree tree, int itemID ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
MoveToWorld( tree.Location, tree.Map );
|
||||
|
||||
m_Tree = tree;
|
||||
}
|
||||
|
||||
public TreeTrunk( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_Tree != null && !m_Tree.Deleted )
|
||||
m_Tree.OnDoubleClick( from );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Tree );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Tree = reader.ReadItem() as HolidayTree;
|
||||
|
||||
if ( m_Tree == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041117; } } // a tree for the holidays
|
||||
|
||||
public HolidayTree( Mobile from, HolidayTreeType type, Point3D loc ) : base( 1 )
|
||||
{
|
||||
Movable = false;
|
||||
MoveToWorld( loc, from.Map );
|
||||
|
||||
m_Placer = from;
|
||||
m_Components = new ArrayList();
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case HolidayTreeType.Classic:
|
||||
{
|
||||
ItemID = 0xCD7;
|
||||
|
||||
AddItem( 0, 0, 0, new TreeTrunk( this, 0xCD6 ) );
|
||||
|
||||
AddOrnament( 0, 0, 2, 0xF22 );
|
||||
AddOrnament( 0, 0, 9, 0xF18 );
|
||||
AddOrnament( 0, 0, 15, 0xF20 );
|
||||
AddOrnament( 0, 0, 19, 0xF17 );
|
||||
AddOrnament( 0, 0, 20, 0xF24 );
|
||||
AddOrnament( 0, 0, 20, 0xF1F );
|
||||
AddOrnament( 0, 0, 20, 0xF19 );
|
||||
AddOrnament( 0, 0, 21, 0xF1B );
|
||||
AddOrnament( 0, 0, 28, 0xF2F );
|
||||
AddOrnament( 0, 0, 30, 0xF23 );
|
||||
AddOrnament( 0, 0, 32, 0xF2A );
|
||||
AddOrnament( 0, 0, 33, 0xF30 );
|
||||
AddOrnament( 0, 0, 34, 0xF29 );
|
||||
AddOrnament( 0, 1, 7, 0xF16 );
|
||||
AddOrnament( 0, 1, 7, 0xF1E );
|
||||
AddOrnament( 0, 1, 12, 0xF0F );
|
||||
AddOrnament( 0, 1, 13, 0xF13 );
|
||||
AddOrnament( 0, 1, 18, 0xF12 );
|
||||
AddOrnament( 0, 1, 19, 0xF15 );
|
||||
AddOrnament( 0, 1, 25, 0xF28 );
|
||||
AddOrnament( 0, 1, 29, 0xF1A );
|
||||
AddOrnament( 0, 1, 37, 0xF2B );
|
||||
AddOrnament( 1, 0, 13, 0xF10 );
|
||||
AddOrnament( 1, 0, 14, 0xF1C );
|
||||
AddOrnament( 1, 0, 16, 0xF14 );
|
||||
AddOrnament( 1, 0, 17, 0xF26 );
|
||||
AddOrnament( 1, 0, 22, 0xF27 );
|
||||
|
||||
break;
|
||||
}
|
||||
case HolidayTreeType.Modern:
|
||||
{
|
||||
ItemID = 0x1B7E;
|
||||
|
||||
AddOrnament( 0, 0, 2, 0xF2F );
|
||||
AddOrnament( 0, 0, 2, 0xF20 );
|
||||
AddOrnament( 0, 0, 2, 0xF22 );
|
||||
AddOrnament( 0, 0, 5, 0xF30 );
|
||||
AddOrnament( 0, 0, 5, 0xF15 );
|
||||
AddOrnament( 0, 0, 5, 0xF1F );
|
||||
AddOrnament( 0, 0, 5, 0xF2B );
|
||||
AddOrnament( 0, 0, 6, 0xF0F );
|
||||
AddOrnament( 0, 0, 7, 0xF1E );
|
||||
AddOrnament( 0, 0, 7, 0xF24 );
|
||||
AddOrnament( 0, 0, 8, 0xF29 );
|
||||
AddOrnament( 0, 0, 9, 0xF18 );
|
||||
AddOrnament( 0, 0, 14, 0xF1C );
|
||||
AddOrnament( 0, 0, 15, 0xF13 );
|
||||
AddOrnament( 0, 0, 15, 0xF20 );
|
||||
AddOrnament( 0, 0, 16, 0xF26 );
|
||||
AddOrnament( 0, 0, 17, 0xF12 );
|
||||
AddOrnament( 0, 0, 18, 0xF17 );
|
||||
AddOrnament( 0, 0, 20, 0xF1B );
|
||||
AddOrnament( 0, 0, 23, 0xF28 );
|
||||
AddOrnament( 0, 0, 25, 0xF18 );
|
||||
AddOrnament( 0, 0, 25, 0xF2A );
|
||||
AddOrnament( 0, 1, 7, 0xF16 );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
for ( int i = 0; i < m_Components.Count; ++i )
|
||||
((Item)m_Components[i]).Delete();
|
||||
}
|
||||
|
||||
private void AddOrnament( int x, int y, int z, int itemID )
|
||||
{
|
||||
AddItem( x + 1, y + 1, z + 11, new Ornament( itemID ) );
|
||||
}
|
||||
|
||||
private void AddItem( int x, int y, int z, Item item )
|
||||
{
|
||||
item.MoveToWorld( new Point3D( this.Location.X + x, this.Location.Y + y, this.Location.Z + z ), this.Map );
|
||||
|
||||
m_Components.Add( item );
|
||||
}
|
||||
|
||||
public HolidayTree( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_Placer );
|
||||
|
||||
writer.Write( (int) m_Components.Count );
|
||||
|
||||
for ( int i = 0; i < m_Components.Count; ++i )
|
||||
writer.Write( (Item)m_Components[i] );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Placer = reader.ReadMobile();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
int count = reader.ReadInt();
|
||||
|
||||
m_Components = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
Item item = reader.ReadItem();
|
||||
|
||||
if ( item != null )
|
||||
m_Components.Add( item );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( this.GetWorldLocation(), 1 ) )
|
||||
{
|
||||
if ( m_Placer == null || from == m_Placer || from.AccessLevel >= AccessLevel.GameMaster )
|
||||
{
|
||||
from.AddToBackpack( new HolidayTreeDeed() );
|
||||
|
||||
this.Delete();
|
||||
|
||||
from.SendLocalizedMessage( 503393 ); // A deed for the tree has been placed in your backpack.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 503396 ); // You cannot take this tree down.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Scripts/Items/Special/Holiday/GiftBox.cs
Normal file
41
Scripts/Items/Special/Holiday/GiftBox.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Furniture]
|
||||
[Flipable( 0x232A, 0x232B )]
|
||||
public class GiftBox : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public GiftBox() : this( Utility.RandomDyedHue() )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GiftBox( int hue ) : base( Utility.Random( 0x232A, 2 ) )
|
||||
{
|
||||
Weight = 2.0;
|
||||
Hue = hue;
|
||||
}
|
||||
|
||||
public GiftBox( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
62
Scripts/Items/Special/Holiday/Poinsettias.cs
Normal file
62
Scripts/Items/Special/Holiday/Poinsettias.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class RedPoinsettia : Item
|
||||
{
|
||||
[Constructable]
|
||||
public RedPoinsettia() : base( 0x2330 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public RedPoinsettia( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class WhitePoinsettia : Item
|
||||
{
|
||||
[Constructable]
|
||||
public WhitePoinsettia() : base( 0x2331 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public WhitePoinsettia( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
62
Scripts/Items/Special/Holiday/Snowflakes.cs
Normal file
62
Scripts/Items/Special/Holiday/Snowflakes.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BlueSnowflake : Item
|
||||
{
|
||||
[Constructable]
|
||||
public BlueSnowflake() : base( 0x232E )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public BlueSnowflake( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class WhiteSnowflake : Item
|
||||
{
|
||||
[Constructable]
|
||||
public WhiteSnowflake() : base( 0x232F )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public WhiteSnowflake( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
159
Scripts/Items/Special/Holiday/Snowman.cs
Normal file
159
Scripts/Items/Special/Holiday/Snowman.cs
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable( 0x2328, 0x2329 )]
|
||||
public class Snowman : Item, IDyable
|
||||
{
|
||||
public static string GetRandomTitle()
|
||||
{
|
||||
// All hail OSI staff
|
||||
string[] titles = new string[]
|
||||
{
|
||||
/* 1 */ "Backflash",
|
||||
/* 2 */ "Carbon",
|
||||
/* 3 */ "Colbalistic",
|
||||
/* 4 */ "Comforl",
|
||||
/* 5 */ "Coppacchia",
|
||||
/* 6 */ "Cyrus",
|
||||
/* 7 */ "DannyB",
|
||||
/* 8 */ "DJSoul",
|
||||
/* 9 */ "DraconisRex",
|
||||
/* 10 */ "Earia",
|
||||
/* 11 */ "Foster",
|
||||
/* 12 */ "Gonzo",
|
||||
/* 13 */ "Haan",
|
||||
/* 14 */ "Halona",
|
||||
/* 15 */ "Hugo",
|
||||
/* 16 */ "Hyacinth",
|
||||
/* 17 */ "Imirian",
|
||||
/* 18 */ "Jinsol",
|
||||
/* 19 */ "Liciatia",
|
||||
/* 20 */ "Loewen",
|
||||
/* 21 */ "Loke",
|
||||
/* 22 */ "Magnus",
|
||||
/* 23 */ "Maleki",
|
||||
/* 24 */ "Morpheus",
|
||||
/* 25 */ "Obberron",
|
||||
/* 26 */ "Odee",
|
||||
/* 27 */ "Orbeus",
|
||||
/* 28 */ "Pax",
|
||||
/* 29 */ "Phields",
|
||||
/* 30 */ "Pigpen",
|
||||
/* 31 */ "Platinum",
|
||||
/* 32 */ "Polpol",
|
||||
/* 33 */ "Prume",
|
||||
/* 34 */ "Quinnly",
|
||||
/* 35 */ "Ragnarok",
|
||||
/* 36 */ "Rend",
|
||||
/* 37 */ "Roland",
|
||||
/* 38 */ "RyanM",
|
||||
/* 39 */ "Screach",
|
||||
/* 40 */ "Seraph",
|
||||
/* 41 */ "Silvani",
|
||||
/* 42 */ "Sherbear",
|
||||
/* 43 */ "SkyWalker",
|
||||
/* 44 */ "Snark",
|
||||
/* 45 */ "Sowl",
|
||||
/* 46 */ "Spada",
|
||||
/* 47 */ "Starblade",
|
||||
/* 48 */ "Tenacious",
|
||||
/* 49 */ "Tnez",
|
||||
/* 50 */ "Wasia",
|
||||
/* 51 */ "Zilo",
|
||||
/* 52 */ "Zippy",
|
||||
/* 53 */ "Zoer"
|
||||
};
|
||||
|
||||
if ( titles.Length > 0 )
|
||||
return titles[Utility.Random( titles.Length )];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string m_Title;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Title
|
||||
{
|
||||
get{ return m_Title; }
|
||||
set{ m_Title = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Snowman() : this( Utility.RandomDyedHue(), GetRandomTitle() )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Snowman( int hue ) : this( hue, GetRandomTitle() )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Snowman( string title ) : this( Utility.RandomDyedHue(), title )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Snowman( int hue, string title ) : base( Utility.Random( 0x2328, 2 ) )
|
||||
{
|
||||
Weight = 10.0;
|
||||
Hue = hue;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_Title = title;
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( m_Title != null )
|
||||
list.Add( 1062841, m_Title ); // ~1_NAME~ the Snowman
|
||||
}
|
||||
|
||||
public bool Dye( Mobile from, DyeTub sender )
|
||||
{
|
||||
if ( Deleted )
|
||||
return false;
|
||||
|
||||
Hue = sender.DyedHue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Snowman( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (string) m_Title );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Title = reader.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Utility.Intern( ref m_Title );
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Scripts/Items/Special/Holiday/WinterGiftPackage2003.cs
Normal file
37
Scripts/Items/Special/Holiday/WinterGiftPackage2003.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable( 0x232A, 0x232B )]
|
||||
public class WinterGiftPackage2003 : GiftBox
|
||||
{
|
||||
[Constructable]
|
||||
public WinterGiftPackage2003()
|
||||
{
|
||||
DropItem( new Snowman() );
|
||||
DropItem( new WreathDeed() );
|
||||
DropItem( new BlueSnowflake() );
|
||||
DropItem( new RedPoinsettia() );
|
||||
}
|
||||
|
||||
public WinterGiftPackage2003( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
328
Scripts/Items/Special/Holiday/Wreath.cs
Normal file
328
Scripts/Items/Special/Holiday/Wreath.cs
Normal file
|
|
@ -0,0 +1,328 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class WreathAddon : Item, IDyable, IAddon
|
||||
{
|
||||
[Constructable]
|
||||
public WreathAddon() : this( Utility.RandomDyedHue() )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public WreathAddon( int hue ) : base( 0x232C )
|
||||
{
|
||||
Hue = hue;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public WreathAddon( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public bool CouldFit( IPoint3D p, Map map )
|
||||
{
|
||||
if ( !map.CanFit( p.X, p.Y, p.Z, this.ItemData.Height ) )
|
||||
return false;
|
||||
|
||||
if ( this.ItemID == 0x232C )
|
||||
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // North wall
|
||||
else
|
||||
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // West wall
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( FixMovingCrate ) );
|
||||
}
|
||||
|
||||
private void FixMovingCrate()
|
||||
{
|
||||
if ( this.Deleted )
|
||||
return;
|
||||
|
||||
if ( this.Movable || this.IsLockedDown )
|
||||
{
|
||||
Item deed = this.Deed;
|
||||
|
||||
if ( this.Parent is Item )
|
||||
{
|
||||
((Item)this.Parent).AddItem( deed );
|
||||
deed.Location = this.Location;
|
||||
}
|
||||
else
|
||||
{
|
||||
deed.MoveToWorld( this.Location, this.Map );
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public Item Deed
|
||||
{
|
||||
get{ return new WreathDeed( this.Hue ); }
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && house.IsCoOwner( from ) )
|
||||
{
|
||||
if ( from.InRange( this.GetWorldLocation(), 3 ) )
|
||||
{
|
||||
from.CloseGump( typeof( WreathAddonGump ) );
|
||||
from.SendGump( new WreathAddonGump( from, this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Dye( Mobile from, DyeTub sender )
|
||||
{
|
||||
if ( Deleted )
|
||||
return false;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && house.IsCoOwner( from ) )
|
||||
{
|
||||
if ( from.InRange( GetWorldLocation(), 1 ) )
|
||||
{
|
||||
Hue = sender.DyedHue;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private class WreathAddonGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private WreathAddon m_Addon;
|
||||
|
||||
public WreathAddonGump( Mobile from, WreathAddon addon ) : base( 150, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Addon = addon;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 220, 170, 0x13BE );
|
||||
AddBackground( 10, 10, 200, 150, 0xBB8 );
|
||||
AddHtmlLocalized( 20, 30, 180, 60, 1062839, false, false ); // Do you wish to re-deed this decoration?
|
||||
AddHtmlLocalized( 55, 100, 160, 25, 1011011, false, false ); // CONTINUE
|
||||
AddButton( 20, 100, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 125, 160, 25, 1011012, false, false ); // CANCEL
|
||||
AddButton( 20, 125, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Addon.Deleted )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
if ( m_From.InRange( m_Addon.GetWorldLocation(), 3 ) )
|
||||
{
|
||||
m_From.AddToBackpack( m_Addon.Deed );
|
||||
m_Addon.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage( 500295 ); // You are too far away to do that.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Flipable( 0x14F0, 0x14EF )]
|
||||
public class WreathDeed : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1062837; } } // holiday wreath deed
|
||||
|
||||
[Constructable]
|
||||
public WreathDeed() : this( Utility.RandomDyedHue() )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public WreathDeed( int hue ) : base( 0x14F0 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public WreathDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
|
||||
if ( house != null && house.IsCoOwner( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062838 ); // Where would you like to place this decoration?
|
||||
from.BeginTarget( -1, true, TargetFlags.None, new TargetStateCallback( Placement_OnTarget ), null );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public void Placement_OnTarget( Mobile from, object targeted, object state )
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p == null )
|
||||
return;
|
||||
|
||||
Point3D loc = new Point3D( p );
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( loc, from.Map, 16 );
|
||||
|
||||
if ( house != null && house.IsCoOwner( from ) )
|
||||
{
|
||||
bool northWall = BaseAddon.IsWall( loc.X, loc.Y - 1, loc.Z, from.Map );
|
||||
bool westWall = BaseAddon.IsWall( loc.X - 1, loc.Y, loc.Z, from.Map );
|
||||
|
||||
if ( northWall && westWall )
|
||||
from.SendGump( new WreathDeedGump( from, loc, this ) );
|
||||
else
|
||||
PlaceAddon( from, loc, northWall, westWall );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042036 ); // That location is not in your house.
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaceAddon( Mobile from, Point3D loc, bool northWall, bool westWall )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( loc, from.Map, 16 );
|
||||
|
||||
if ( house == null || !house.IsCoOwner( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042036 ); // That location is not in your house.
|
||||
return;
|
||||
}
|
||||
|
||||
int itemID = 0;
|
||||
|
||||
if ( northWall )
|
||||
itemID = 0x232C;
|
||||
else if ( westWall )
|
||||
itemID = 0x232D;
|
||||
else
|
||||
from.SendLocalizedMessage( 1062840 ); // The decoration must be placed next to a wall.
|
||||
|
||||
if ( itemID > 0 )
|
||||
{
|
||||
Item addon = new WreathAddon( this.Hue );
|
||||
|
||||
addon.ItemID = itemID;
|
||||
addon.MoveToWorld( loc, from.Map );
|
||||
|
||||
house.Addons.Add( addon );
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
private class WreathDeedGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private Point3D m_Loc;
|
||||
private WreathDeed m_Deed;
|
||||
|
||||
public WreathDeedGump( Mobile from, Point3D loc, WreathDeed deed ) : base( 150, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Loc = loc;
|
||||
m_Deed = deed;
|
||||
|
||||
AddBackground( 0, 0, 300, 150, 0xA28 );
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddItem( 90, 30, 0x232D );
|
||||
AddItem( 180, 30, 0x232C );
|
||||
AddButton( 50, 35, 0x868, 0x869, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 145, 35, 0x868, 0x869, 2, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Deed.Deleted )
|
||||
return;
|
||||
|
||||
switch( info.ButtonID )
|
||||
{
|
||||
case 1:
|
||||
m_Deed.PlaceAddon( m_From, m_Loc, false, true );
|
||||
break;
|
||||
case 2:
|
||||
m_Deed.PlaceAddon( m_From, m_Loc, true, false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue