Add DefaultName property to Mobiles & Items (#18)
This commit is contained in:
parent
b06f5bf60d
commit
8ee42c8ea2
713 changed files with 5112 additions and 4987 deletions
|
|
@ -7,20 +7,20 @@ using Server.Targeting;
|
|||
using Server.Engines.VeteranRewards;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
{
|
||||
public class Banner : Item, IAddon, IDyable, IRewardItem
|
||||
{
|
||||
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
|
||||
public Item Deed
|
||||
{
|
||||
{
|
||||
get
|
||||
{
|
||||
{
|
||||
BannerDeed deed = new BannerDeed();
|
||||
deed.IsRewardItem = m_IsRewardItem;
|
||||
|
||||
return deed;
|
||||
}
|
||||
return deed;
|
||||
}
|
||||
}
|
||||
|
||||
private bool m_IsRewardItem;
|
||||
|
|
@ -31,15 +31,15 @@ namespace Server.Items
|
|||
get{ return m_IsRewardItem; }
|
||||
set{ m_IsRewardItem = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
|
||||
public bool FacingSouth
|
||||
{
|
||||
get{ return ( ItemID & 0x1 ) == 0; }
|
||||
}
|
||||
|
||||
|
||||
[Constructible]
|
||||
public Banner( int itemID ) : base( itemID )
|
||||
{
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Movable = false;
|
||||
}
|
||||
|
|
@ -51,17 +51,17 @@ namespace Server.Items
|
|||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
|
||||
if ( Core.ML && m_IsRewardItem )
|
||||
list.Add( 1076218 ); // 2nd Year Veteran Reward
|
||||
}
|
||||
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( Location, 2 ) )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && house.IsOwner( from ) )
|
||||
{
|
||||
from.CloseGump( typeof( RewardDemolitionGump ) );
|
||||
|
|
@ -79,19 +79,19 @@ namespace Server.Items
|
|||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
|
||||
writer.Write( (bool) m_IsRewardItem );
|
||||
}
|
||||
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
}
|
||||
|
||||
|
||||
public bool Dye( Mobile from, DyeTub sender )
|
||||
{
|
||||
if ( Deleted )
|
||||
|
|
@ -101,19 +101,19 @@ namespace Server.Items
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool CouldFit( IPoint3D p, Map map )
|
||||
{
|
||||
{
|
||||
if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) )
|
||||
return false;
|
||||
|
||||
|
||||
if ( FacingSouth )
|
||||
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 class BannerDeed : Item, IRewardItem
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041007; } } // a banner deed
|
||||
|
|
@ -128,7 +128,7 @@ namespace Server.Items
|
|||
}
|
||||
[Constructible]
|
||||
public BannerDeed() : base( 0x14F0 )
|
||||
{
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
|
@ -136,20 +136,20 @@ namespace Server.Items
|
|||
public BannerDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
|
||||
if ( m_IsRewardItem )
|
||||
list.Add( 1076218 ); // 2nd Year Veteran Reward
|
||||
}
|
||||
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
{
|
||||
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
|
||||
return;
|
||||
|
||||
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
|
|
@ -163,7 +163,7 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
|
||||
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -171,41 +171,41 @@ namespace Server.Items
|
|||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
|
||||
writer.Write( (bool) m_IsRewardItem );
|
||||
}
|
||||
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
}
|
||||
|
||||
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
public const int Start = 0x15AE;
|
||||
public const int End = 0x15F4;
|
||||
|
||||
|
||||
private BannerDeed m_Banner;
|
||||
|
||||
|
||||
public InternalGump( BannerDeed banner ) : base( 100, 200 )
|
||||
{
|
||||
m_Banner = banner;
|
||||
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 25, 0, 520, 230, 0xA28 );
|
||||
AddBackground( 25, 0, 520, 230, 0xA28 );
|
||||
AddLabel( 70, 12, 0x3E3, "Choose a Banner:" );
|
||||
|
||||
|
||||
|
||||
int itemID = Start;
|
||||
|
||||
for ( int i = 1; i <= 4; i++ )
|
||||
|
|
@ -223,16 +223,16 @@ namespace Server.Items
|
|||
|
||||
if ( i < 4 )
|
||||
AddButton( 475, 198, 0x8B0, 0x8B0, 0, GumpButtonType.Page, i + 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Banner == null | m_Banner.Deleted )
|
||||
return;
|
||||
|
||||
Mobile m = sender.Mobile;
|
||||
|
||||
return;
|
||||
|
||||
Mobile m = sender.Mobile;
|
||||
|
||||
if ( info.ButtonID >= Start && info.ButtonID <= End )
|
||||
{
|
||||
if ( ( info.ButtonID & 0x1 ) == 0 )
|
||||
|
|
@ -243,23 +243,23 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private BannerDeed m_Banner;
|
||||
private int m_ItemID;
|
||||
|
||||
|
||||
public InternalTarget( BannerDeed banner, int itemID ) : base( -1, true, TargetFlags.None )
|
||||
{
|
||||
m_Banner = banner;
|
||||
m_ItemID = itemID;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Banner == null || m_Banner.Deleted )
|
||||
return;
|
||||
|
||||
|
||||
if ( m_Banner.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
|
|
@ -268,22 +268,22 @@ namespace Server.Items
|
|||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
Map map = from.Map;
|
||||
|
||||
|
||||
if ( p == null || map == null )
|
||||
return;
|
||||
|
||||
|
||||
Point3D p3d = new Point3D( p );
|
||||
ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ];
|
||||
|
||||
|
||||
if ( map.CanFit( p3d, id.Height ) )
|
||||
{
|
||||
house = BaseHouse.FindHouseAt( p3d, map, id.Height );
|
||||
|
||||
|
||||
if ( house != null && house.IsOwner( from ) )
|
||||
{
|
||||
bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map );
|
||||
bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map );
|
||||
|
||||
|
||||
if ( north && west )
|
||||
{
|
||||
from.CloseGump( typeof( FacingGump ) );
|
||||
|
|
@ -292,12 +292,12 @@ namespace Server.Items
|
|||
else if ( north || west )
|
||||
{
|
||||
Banner banner = null;
|
||||
|
||||
|
||||
if ( north )
|
||||
banner = new Banner( m_ItemID );
|
||||
else if ( west )
|
||||
banner = new Banner( m_ItemID + 1 );
|
||||
|
||||
|
||||
house.Addons.Add( banner );
|
||||
|
||||
banner.IsRewardItem = m_Banner.IsRewardItem;
|
||||
|
|
@ -306,42 +306,42 @@ namespace Server.Items
|
|||
m_Banner.Delete();
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1042039 ); // The banner must be placed next to a wall.
|
||||
from.SendLocalizedMessage( 1042039 ); // The banner must be placed next to a wall.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1042036 ); // That location is not in your house.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
|
||||
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
|
||||
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
|
||||
}
|
||||
|
||||
|
||||
private class FacingGump : Gump
|
||||
{
|
||||
private BannerDeed m_Banner;
|
||||
private int m_ItemID;
|
||||
private Point3D m_Location;
|
||||
private BaseHouse m_House;
|
||||
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
East,
|
||||
South
|
||||
}
|
||||
|
||||
|
||||
public FacingGump( BannerDeed banner, int itemID, Point3D location, BaseHouse house ) : base( 150, 50 )
|
||||
{
|
||||
m_Banner = banner;
|
||||
m_ItemID = itemID;
|
||||
m_Location = location;
|
||||
m_House = house;
|
||||
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
|
|
@ -357,19 +357,19 @@ namespace Server.Items
|
|||
AddButton( 50, 35, 0x868, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 );
|
||||
AddButton( 145, 35, 0x868, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Banner == null || m_Banner.Deleted || m_House == null )
|
||||
return;
|
||||
|
||||
Banner banner = null;
|
||||
|
||||
return;
|
||||
|
||||
Banner banner = null;
|
||||
|
||||
if ( info.ButtonID == (int) Buttons.East )
|
||||
banner = new Banner( m_ItemID + 1 );
|
||||
if ( info.ButtonID == (int) Buttons.South )
|
||||
banner = new Banner( m_ItemID );
|
||||
|
||||
|
||||
if ( banner != null )
|
||||
{
|
||||
m_House.Addons.Add( banner );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue