Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,266 +1,281 @@
|
|||
using Server.Multis;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Engines.VeteranRewards;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class StoneAnkhComponent : AddonComponent
|
||||
{
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
public class StoneAnkhComponent : AddonComponent
|
||||
{
|
||||
public StoneAnkhComponent(int itemID) : base(itemID)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public StoneAnkhComponent( int itemID ) : base( itemID )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
public StoneAnkhComponent(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public StoneAnkhComponent( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if ( Addon is StoneAnkh ankh && ankh.IsRewardItem )
|
||||
list.Add( 1076221 ); // 5th Year Veteran Reward
|
||||
}
|
||||
if (Addon is StoneAnkh ankh && ankh.IsRewardItem)
|
||||
list.Add(1076221); // 5th Year Veteran Reward
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class StoneAnkh : BaseAddon, IRewardItem
|
||||
{
|
||||
public override BaseAddonDeed Deed
|
||||
{
|
||||
get
|
||||
{
|
||||
StoneAnkhDeed deed = new StoneAnkhDeed();
|
||||
deed.IsRewardItem = m_IsRewardItem;
|
||||
public class StoneAnkh : BaseAddon, IRewardItem
|
||||
{
|
||||
private bool m_IsRewardItem;
|
||||
|
||||
return deed;
|
||||
}
|
||||
}
|
||||
[Constructible]
|
||||
public StoneAnkh() : this(true)
|
||||
{
|
||||
}
|
||||
|
||||
private bool m_IsRewardItem;
|
||||
[Constructible]
|
||||
public StoneAnkh(bool east)
|
||||
{
|
||||
if (east)
|
||||
{
|
||||
AddComponent(new StoneAnkhComponent(0x2), 0, 0, 0);
|
||||
AddComponent(new StoneAnkhComponent(0x3), 0, -1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddComponent(new StoneAnkhComponent(0x5), 0, 0, 0);
|
||||
AddComponent(new StoneAnkhComponent(0x4), -1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsRewardItem
|
||||
{
|
||||
get => m_IsRewardItem;
|
||||
set{ m_IsRewardItem = value; InvalidateProperties(); }
|
||||
}
|
||||
public StoneAnkh(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StoneAnkh() : this( true )
|
||||
{
|
||||
}
|
||||
public override BaseAddonDeed Deed
|
||||
{
|
||||
get
|
||||
{
|
||||
StoneAnkhDeed deed = new StoneAnkhDeed();
|
||||
deed.IsRewardItem = m_IsRewardItem;
|
||||
|
||||
[Constructible]
|
||||
public StoneAnkh( bool east )
|
||||
{
|
||||
if ( east )
|
||||
{
|
||||
AddComponent( new StoneAnkhComponent( 0x2 ), 0, 0, 0 );
|
||||
AddComponent( new StoneAnkhComponent( 0x3 ), 0, -1, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddComponent( new StoneAnkhComponent( 0x5 ), 0, 0, 0 );
|
||||
AddComponent( new StoneAnkhComponent( 0x4 ), -1, 0, 0 );
|
||||
}
|
||||
}
|
||||
return deed;
|
||||
}
|
||||
}
|
||||
|
||||
public StoneAnkh( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsRewardItem
|
||||
{
|
||||
get => m_IsRewardItem;
|
||||
set
|
||||
{
|
||||
m_IsRewardItem = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnChop( Mobile from )
|
||||
{
|
||||
from.SendLocalizedMessage( 500489 ); // You can't use an axe on that.
|
||||
}
|
||||
public override void OnChop(Mobile from)
|
||||
{
|
||||
from.SendLocalizedMessage(500489); // You can't use an axe on that.
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if ( Core.ML && m_IsRewardItem )
|
||||
list.Add( 1076221 ); // 5th Year Veteran Reward
|
||||
}
|
||||
if (Core.ML && m_IsRewardItem)
|
||||
list.Add(1076221); // 5th Year Veteran Reward
|
||||
}
|
||||
|
||||
public override void OnComponentUsed( AddonComponent c, Mobile from )
|
||||
{
|
||||
if ( from.InRange( Location, 2 ) )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
public override void OnComponentUsed(AddonComponent c, Mobile from)
|
||||
{
|
||||
if (from.InRange(Location, 2))
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
if ( house != null && house.IsOwner( from ) )
|
||||
{
|
||||
from.CloseGump( typeof( RewardDemolitionGump ) );
|
||||
from.SendGump( new RewardDemolitionGump( this, 1049783 ) ); // Do you wish to re-deed this decoration?
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
|
||||
}
|
||||
else
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
}
|
||||
if (house != null && house.IsOwner(from))
|
||||
{
|
||||
from.CloseGump(typeof(RewardDemolitionGump));
|
||||
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1049784); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write( (bool) m_IsRewardItem );
|
||||
}
|
||||
writer.Write(m_IsRewardItem);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
}
|
||||
}
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
}
|
||||
}
|
||||
|
||||
public class StoneAnkhDeed : BaseAddonDeed, IRewardItem
|
||||
{
|
||||
public override int LabelNumber => 1049773; // deed for a stone ankh
|
||||
public class StoneAnkhDeed : BaseAddonDeed, IRewardItem
|
||||
{
|
||||
private bool m_East;
|
||||
private bool m_IsRewardItem;
|
||||
|
||||
private bool m_East;
|
||||
private bool m_IsRewardItem;
|
||||
[Constructible]
|
||||
public StoneAnkhDeed()
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsRewardItem
|
||||
{
|
||||
get => m_IsRewardItem;
|
||||
set{ m_IsRewardItem = value; InvalidateProperties(); }
|
||||
}
|
||||
public StoneAnkhDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseAddon Addon
|
||||
{
|
||||
get
|
||||
{
|
||||
StoneAnkh addon = new StoneAnkh( m_East );
|
||||
addon.IsRewardItem = m_IsRewardItem;
|
||||
public override int LabelNumber => 1049773; // deed for a stone ankh
|
||||
|
||||
return addon;
|
||||
}
|
||||
}
|
||||
public override BaseAddon Addon
|
||||
{
|
||||
get
|
||||
{
|
||||
StoneAnkh addon = new StoneAnkh(m_East);
|
||||
addon.IsRewardItem = m_IsRewardItem;
|
||||
|
||||
[Constructible]
|
||||
public StoneAnkhDeed()
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
return addon;
|
||||
}
|
||||
}
|
||||
|
||||
public StoneAnkhDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsRewardItem
|
||||
{
|
||||
get => m_IsRewardItem;
|
||||
set
|
||||
{
|
||||
m_IsRewardItem = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
|
||||
return;
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
|
||||
return;
|
||||
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.CloseGump( typeof( InternalGump ) );
|
||||
from.SendGump( new InternalGump( this ) );
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
|
||||
}
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
from.CloseGump(typeof(InternalGump));
|
||||
from.SendGump(new InternalGump(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
|
||||
}
|
||||
}
|
||||
|
||||
private void SendTarget( Mobile m )
|
||||
{
|
||||
base.OnDoubleClick( m );
|
||||
}
|
||||
private void SendTarget(Mobile m)
|
||||
{
|
||||
base.OnDoubleClick(m);
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if ( m_IsRewardItem )
|
||||
list.Add( 1076221 ); // 5th Year Veteran Reward
|
||||
}
|
||||
if (m_IsRewardItem)
|
||||
list.Add(1076221); // 5th Year Veteran Reward
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write( (bool) m_IsRewardItem );
|
||||
}
|
||||
writer.Write(m_IsRewardItem);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
}
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
}
|
||||
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
private StoneAnkhDeed m_Deed;
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
private StoneAnkhDeed m_Deed;
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
South,
|
||||
East
|
||||
}
|
||||
public InternalGump(StoneAnkhDeed deed) : base(150, 50)
|
||||
{
|
||||
m_Deed = deed;
|
||||
|
||||
public InternalGump( StoneAnkhDeed deed ) : base( 150, 50 )
|
||||
{
|
||||
m_Deed = deed;
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
AddPage(0);
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground(0, 0, 300, 150, 0xA28);
|
||||
|
||||
AddBackground( 0, 0, 300, 150, 0xA28 );
|
||||
AddItem(90, 30, 0x4);
|
||||
AddItem(112, 30, 0x5);
|
||||
AddButton(50, 35, 0x867, 0x869, (int)Buttons.South, GumpButtonType.Reply, 0); // South
|
||||
|
||||
AddItem( 90, 30, 0x4 );
|
||||
AddItem( 112, 30, 0x5 );
|
||||
AddButton( 50, 35, 0x867, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 ); // South
|
||||
AddItem(170, 30, 0x2);
|
||||
AddItem(192, 30, 0x3);
|
||||
AddButton(145, 35, 0x867, 0x869, (int)Buttons.East, GumpButtonType.Reply, 0); // East
|
||||
}
|
||||
|
||||
AddItem( 170, 30, 0x2 );
|
||||
AddItem( 192, 30, 0x3 );
|
||||
AddButton( 145, 35, 0x867, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 ); // East
|
||||
}
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Deed == null || m_Deed.Deleted)
|
||||
return;
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Deed == null || m_Deed.Deleted )
|
||||
return;
|
||||
if (info.ButtonID != (int)Buttons.Cancel)
|
||||
{
|
||||
m_Deed.m_East = info.ButtonID == (int)Buttons.East;
|
||||
m_Deed.SendTarget(sender.Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
if ( info.ButtonID != (int) Buttons.Cancel )
|
||||
{
|
||||
m_Deed.m_East = ( info.ButtonID == (int) Buttons.East );
|
||||
m_Deed.SendTarget( sender.Mobile );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
South,
|
||||
East
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue