- Fixed HalloweenPumpkin still appearing in the cursor after being deleted.

- Added sounds and messages to HalloweenPumpkin lighting.
- Corrected PlayerBones base class.
- Fixed old JackOLantern component names.
- Fixed core re-sending deleted items on lift rejection.
This commit is contained in:
eos 2012-11-03 02:11:41 +00:00
parent e7c392b34f
commit 3c10fd8e32
4 changed files with 55 additions and 35 deletions

View file

@ -6,7 +6,7 @@ namespace Server.Items
{
public class HalloweenPumpkin : Item
{
private readonly string[] staff =
private static readonly string[] m_Staff =
{
"Ryan", "Mark", "Eos", "Athena", "Xavier", "Krrios", "Zippy"
};
@ -16,51 +16,50 @@ namespace Server.Items
: base()
{
Weight = Utility.RandomMinMax( 3, 20 );
ItemID = ( Utility.RandomDouble() <= .02 ) ? 0x4694 + Utility.Random( 2 ) : Utility.RandomList( 0xc6a, 0xc6b, 0xc6c );
ItemID = ( Utility.RandomDouble() <= .02 ) ? Utility.RandomList( 0x4694, 0x4698 ) : Utility.RandomList( 0xc6a, 0xc6b, 0xc6c );
}
public override void OnDoubleClick( Mobile from )
{
this.ItemID = GetItemID( ItemID );
if ( !from.InRange( this.GetWorldLocation(), 2 ) )
return;
base.OnDoubleClick( from );
}
bool douse = false;
private int GetItemID( int itemid )
{
switch( ItemID )
switch ( ItemID )
{
case 0x4694: itemid = 0x4691; break;
case 0x4691: itemid = 0x4694; break;
case 0x4698: itemid = 0x4695; break;
case 0x4695: itemid = 0x4698; break;
case 0x4694: ItemID = 0x4691; break;
case 0x4691: ItemID = 0x4694; douse = true; break;
case 0x4698: ItemID = 0x4695; break;
case 0x4695: ItemID = 0x4698; douse = true; break;
default: return;
}
return itemid;
from.SendLocalizedMessage( douse ? 1113988 : 1113987 ); // You extinguish/light the Jack-O-Lantern
Effects.PlaySound( GetWorldLocation(), Map, douse ? 0x3be : 0x47 );
}
public override void OnItemLifted( Mobile from, Item item )
private void AssignRandomName()
{
base.OnItemLifted( from, item );
Name = String.Format( "{0}'s Jack-O-Lantern", m_Staff[ Utility.Random( m_Staff.Length ) ] );
}
if( item != null && !item.Deleted && item == this && Name == null )
public override bool OnDragLift( Mobile from )
{
if ( Name == null && ( ItemID == 0x4694 || ItemID == 0x4691 || ItemID == 0x4698 || ItemID == 0x4695 ) )
{
if( ItemID == 0x4694 || ItemID == 0x4691 || ItemID == 0x4695 || ItemID == 0x4698 )
if ( Utility.RandomBool() )
{
if( Utility.RandomBool() )
{
BaseCreature pumpkinhead = new PumpkinHead();
new PumpkinHead().MoveToWorld( GetWorldLocation(), Map );
pumpkinhead.MoveToWorld( Location, from.Map );
Delete();
}
else
{
Name = String.Format( "{0}'s Jack-O-Lantern", staff[ Utility.Random( staff.Length ) ] );
}
Delete();
return false;
}
AssignRandomName();
}
return true;
}
public HalloweenPumpkin( Serial serial )
@ -72,7 +71,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( ( int )0 ); // version
writer.Write( (int)1 ); // version
}
public override void Deserialize( GenericReader reader )
@ -80,6 +79,9 @@ namespace Server.Items
base.Deserialize( reader );
int version = reader.ReadInt();
if ( version == 0 && Name == null && ItemID == 0x4698 )
AssignRandomName();
}
}
}

View file

@ -144,12 +144,13 @@ namespace Server.Engines.Events
}
}
public class PlayerBones : Container
public class PlayerBones : BaseContainer
{
[Constructable]
public PlayerBones( String name )
: base( Utility.RandomMinMax( 0x0ECA, 0x0ED2 ) )
{
Name = String.Format( "{0}\'s bones", name );
Name = String.Format( "{0}'s bones", name );
switch( Utility.Random( 10 ) )
{
@ -195,7 +196,7 @@ namespace Server.Engines.Events
{
m_DeadPlayer = player;
Name = ( player != null ) ? String.Format( "{0}\'s {1}", player.Name, m_Name ) : m_Name;
Name = ( player != null ) ? String.Format( "{0}'s {1}", player.Name, m_Name ) : m_Name;
Body = 0x93;
BaseSoundID = 0x1c3;

View file

@ -19,7 +19,7 @@ namespace Server.Items
AddonComponent ac = new AddonComponent( itemID );
ac.Hue = hue;
ac.Name = "jack-o-latern";
ac.Name = "jack-o-lantern";
return ac;
}
@ -61,7 +61,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (byte) 1 ); // version
writer.Write( (byte) 2 ); // version
}
public override void Deserialize( GenericReader reader )
@ -83,6 +83,20 @@ namespace Server.Items
}
} );
}
if ( version <= 1 )
{
Timer.DelayCall( TimeSpan.Zero, delegate()
{
for ( int i = 0; i < Components.Count; ++i )
{
AddonComponent ac = Components[i] as AddonComponent;
if ( ac != null )
ac.Name = "jack-o-lantern";
}
} );
}
}
}
}
}

View file

@ -4417,6 +4417,9 @@ namespace Server
{
state.Send( new LiftRej( reject ) );
if( item.Deleted )
return;
if( item.Parent is Item ) {
if ( state.ContainerGridLines )
state.Send( new ContainerContentUpdate6017( item ) );