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,283 +1,294 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class HouseSign : Item
|
||||
{
|
||||
public HouseSign( BaseHouse owner ) : base( 0xBD2 )
|
||||
{
|
||||
Owner = owner;
|
||||
OriginalOwner = Owner.Owner;
|
||||
Movable = false;
|
||||
}
|
||||
public class HouseSign : Item
|
||||
{
|
||||
public HouseSign(BaseHouse owner) : base(0xBD2)
|
||||
{
|
||||
Owner = owner;
|
||||
OriginalOwner = Owner.Owner;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public HouseSign( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public HouseSign(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
if ( Name == null )
|
||||
return "An Unnamed House";
|
||||
public BaseHouse Owner{ get; private set; }
|
||||
|
||||
return Name;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RestrictDecay
|
||||
{
|
||||
get => Owner != null && Owner.RestrictDecay;
|
||||
set
|
||||
{
|
||||
if (Owner != null) Owner.RestrictDecay = value;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseHouse Owner { get; private set; }
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile OriginalOwner{ get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RestrictDecay
|
||||
{
|
||||
get => ( Owner != null && Owner.RestrictDecay );
|
||||
set{ if ( Owner != null ) Owner.RestrictDecay = value; }
|
||||
}
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile OriginalOwner { get; private set; }
|
||||
public bool GettingProperties{ get; private set; }
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
public string GetName()
|
||||
{
|
||||
if (Name == null)
|
||||
return "An Unnamed House";
|
||||
|
||||
if ( Owner != null && !Owner.Deleted )
|
||||
Owner.Delete();
|
||||
}
|
||||
return Name;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add( 1061638 ); // A House Sign
|
||||
}
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
if (Owner != null && !Owner.Deleted)
|
||||
Owner.Delete();
|
||||
}
|
||||
|
||||
public bool GettingProperties { get; private set; }
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1061638); // A House Sign
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add( 1061639, Utility.FixHtml( GetName() ) ); // Name: ~1_NAME~
|
||||
list.Add( 1061640, (Owner?.Owner == null) ? "nobody" : Owner.Owner.Name ); // Owner: ~1_OWNER~
|
||||
list.Add(1061639, Utility.FixHtml(GetName())); // Name: ~1_NAME~
|
||||
list.Add(1061640, Owner?.Owner == null ? "nobody" : Owner.Owner.Name); // Owner: ~1_OWNER~
|
||||
|
||||
if ( Owner != null )
|
||||
{
|
||||
list.Add( Owner.Public ? 1061641 : 1061642 ); // This House is Open to the Public : This is a Private Home
|
||||
if (Owner != null)
|
||||
{
|
||||
list.Add(Owner.Public ? 1061641 : 1061642); // This House is Open to the Public : This is a Private Home
|
||||
|
||||
GettingProperties = true;
|
||||
DecayLevel level = Owner.DecayLevel;
|
||||
GettingProperties = false;
|
||||
GettingProperties = true;
|
||||
DecayLevel level = Owner.DecayLevel;
|
||||
GettingProperties = false;
|
||||
|
||||
if ( level == DecayLevel.DemolitionPending )
|
||||
{
|
||||
list.Add( 1062497 ); // Demolition Pending
|
||||
}
|
||||
else if ( level != DecayLevel.Ageless )
|
||||
{
|
||||
if ( level == DecayLevel.Collapsed )
|
||||
level = DecayLevel.IDOC;
|
||||
if (level == DecayLevel.DemolitionPending)
|
||||
{
|
||||
list.Add(1062497); // Demolition Pending
|
||||
}
|
||||
else if (level != DecayLevel.Ageless)
|
||||
{
|
||||
if (level == DecayLevel.Collapsed)
|
||||
level = DecayLevel.IDOC;
|
||||
|
||||
list.Add( 1062028, $"#{1043009 + (int) level}"); // Condition: This structure is ...
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Add(1062028, $"#{1043009 + (int)level}"); // Condition: This structure is ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
if ( Owner != null && BaseHouse.DecayEnabled && Owner.DecayPeriod != TimeSpan.Zero )
|
||||
{
|
||||
string message;
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (Owner != null && BaseHouse.DecayEnabled && Owner.DecayPeriod != TimeSpan.Zero)
|
||||
{
|
||||
string message;
|
||||
|
||||
switch ( Owner.DecayLevel )
|
||||
{
|
||||
case DecayLevel.Ageless: message = "ageless"; break;
|
||||
case DecayLevel.Fairly: message = "fairly worn"; break;
|
||||
case DecayLevel.Greatly: message = "greatly worn"; break;
|
||||
case DecayLevel.LikeNew: message = "like new"; break;
|
||||
case DecayLevel.Slightly: message = "slightly worn"; break;
|
||||
case DecayLevel.Somewhat: message = "somewhat worn"; break;
|
||||
default: message = "in danger of collapsing"; break;
|
||||
}
|
||||
switch (Owner.DecayLevel)
|
||||
{
|
||||
case DecayLevel.Ageless:
|
||||
message = "ageless";
|
||||
break;
|
||||
case DecayLevel.Fairly:
|
||||
message = "fairly worn";
|
||||
break;
|
||||
case DecayLevel.Greatly:
|
||||
message = "greatly worn";
|
||||
break;
|
||||
case DecayLevel.LikeNew:
|
||||
message = "like new";
|
||||
break;
|
||||
case DecayLevel.Slightly:
|
||||
message = "slightly worn";
|
||||
break;
|
||||
case DecayLevel.Somewhat:
|
||||
message = "somewhat worn";
|
||||
break;
|
||||
default:
|
||||
message = "in danger of collapsing";
|
||||
break;
|
||||
}
|
||||
|
||||
LabelTo( from, "This house is {0}.", message );
|
||||
}
|
||||
LabelTo(from, "This house is {0}.", message);
|
||||
}
|
||||
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
|
||||
public void ShowSign( Mobile m )
|
||||
{
|
||||
if ( Owner != null )
|
||||
{
|
||||
if ( Owner.IsFriend( m ) && m.AccessLevel < AccessLevel.GameMaster )
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
if ( ( Core.ML && Owner.IsOwner( m ) ) || !Core.ML )
|
||||
Owner.RefreshDecay();
|
||||
#endregion
|
||||
if ( !Core.AOS )
|
||||
m.SendLocalizedMessage( 501293 ); // Welcome back to the house, friend!
|
||||
}
|
||||
public void ShowSign(Mobile m)
|
||||
{
|
||||
if (Owner != null)
|
||||
{
|
||||
if (Owner.IsFriend(m) && m.AccessLevel < AccessLevel.GameMaster)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if ( Owner.IsAosRules )
|
||||
m.SendGump( new HouseGumpAOS( HouseGumpPageAOS.Information, m, Owner ) );
|
||||
else
|
||||
m.SendGump( new HouseGump( m, Owner ) );
|
||||
}
|
||||
}
|
||||
if (Core.ML && Owner.IsOwner(m) || !Core.ML)
|
||||
Owner.RefreshDecay();
|
||||
|
||||
public void ClaimGump_Callback( Mobile from, bool okay, object state )
|
||||
{
|
||||
if ( okay && Owner != null && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending )
|
||||
{
|
||||
bool canClaim = false;
|
||||
#endregion
|
||||
|
||||
if ( Owner.CoOwners == null || Owner.CoOwners.Count == 0 )
|
||||
canClaim = Owner.IsFriend( from );
|
||||
else
|
||||
canClaim = Owner.IsCoOwner( from );
|
||||
if (!Core.AOS)
|
||||
m.SendLocalizedMessage(501293); // Welcome back to the house, friend!
|
||||
}
|
||||
|
||||
if ( canClaim && !BaseHouse.HasAccountHouse( from ) )
|
||||
{
|
||||
Owner.Owner = from;
|
||||
Owner.LastTraded = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
if (Owner.IsAosRules)
|
||||
m.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Information, m, Owner));
|
||||
else
|
||||
m.SendGump(new HouseGump(m, Owner));
|
||||
}
|
||||
}
|
||||
|
||||
ShowSign( from );
|
||||
}
|
||||
public void ClaimGump_Callback(Mobile from, bool okay, object state)
|
||||
{
|
||||
if (okay && Owner != null && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending)
|
||||
{
|
||||
bool canClaim = false;
|
||||
|
||||
public override void OnDoubleClick( Mobile m )
|
||||
{
|
||||
if ( Owner == null )
|
||||
return;
|
||||
if (Owner.CoOwners == null || Owner.CoOwners.Count == 0)
|
||||
canClaim = Owner.IsFriend(from);
|
||||
else
|
||||
canClaim = Owner.IsCoOwner(from);
|
||||
|
||||
if ( m.AccessLevel < AccessLevel.GameMaster && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending )
|
||||
{
|
||||
bool canClaim = false;
|
||||
if (canClaim && !BaseHouse.HasAccountHouse(from))
|
||||
{
|
||||
Owner.Owner = from;
|
||||
Owner.LastTraded = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Owner.CoOwners == null || Owner.CoOwners.Count == 0 )
|
||||
canClaim = Owner.IsFriend( m );
|
||||
else
|
||||
canClaim = Owner.IsCoOwner( m );
|
||||
ShowSign(from);
|
||||
}
|
||||
|
||||
if ( canClaim && !BaseHouse.HasAccountHouse( m ) )
|
||||
{
|
||||
/* You do not currently own any house on any shard with this account,
|
||||
* and this house currently does not have an owner. If you wish, you
|
||||
* may choose to claim this house and become its rightful owner. If
|
||||
* you do this, it will become your Primary house and automatically
|
||||
* refresh. If you claim this house, you will be unable to place
|
||||
* another house or have another house transferred to you for the
|
||||
* next 7 days. Do you wish to claim this house?
|
||||
*/
|
||||
m.SendGump( new WarningGump( 501036, 32512, 1049719, 32512, 420, 280, ClaimGump_Callback, null ) );
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (Owner == null)
|
||||
return;
|
||||
|
||||
ShowSign( m );
|
||||
}
|
||||
if (m.AccessLevel < AccessLevel.GameMaster && Owner.Owner == null &&
|
||||
Owner.DecayLevel != DecayLevel.DemolitionPending)
|
||||
{
|
||||
bool canClaim = false;
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
if (Owner.CoOwners == null || Owner.CoOwners.Count == 0)
|
||||
canClaim = Owner.IsFriend(m);
|
||||
else
|
||||
canClaim = Owner.IsCoOwner(m);
|
||||
|
||||
if ( BaseHouse.NewVendorSystem && from.Alive && Owner != null && Owner.IsAosRules )
|
||||
{
|
||||
if ( Owner.AreThereAvailableVendorsFor( from ) )
|
||||
list.Add( new VendorsEntry( this ) );
|
||||
if (canClaim && !BaseHouse.HasAccountHouse(m))
|
||||
m.SendGump(new WarningGump(501036, 32512, 1049719, 32512, 420, 280, ClaimGump_Callback, null));
|
||||
}
|
||||
|
||||
if ( Owner.VendorInventories.Count > 0 )
|
||||
list.Add( new ReclaimVendorInventoryEntry( this ) );
|
||||
}
|
||||
}
|
||||
ShowSign(m);
|
||||
}
|
||||
|
||||
private class VendorsEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
public VendorsEntry( HouseSign sign ) : base( 6211 )
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
if (BaseHouse.NewVendorSystem && from.Alive && Owner != null && Owner.IsAosRules)
|
||||
{
|
||||
if (Owner.AreThereAvailableVendorsFor(from))
|
||||
list.Add(new VendorsEntry(this));
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
if (Owner.VendorInventories.Count > 0)
|
||||
list.Add(new ReclaimVendorInventoryEntry(this));
|
||||
}
|
||||
}
|
||||
|
||||
if ( !from.CheckAlive() || m_Sign.Deleted || m_Sign.Owner == null || !m_Sign.Owner.AreThereAvailableVendorsFor( from ) )
|
||||
return;
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
if ( from.Map != m_Sign.Map || !from.InRange( m_Sign, 5 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062429 ); // You must be within five paces of the house sign to use this option.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new HouseGumpAOS( HouseGumpPageAOS.Vendors, from, m_Sign.Owner ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Write(0); // version
|
||||
|
||||
private class ReclaimVendorInventoryEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
writer.Write(Owner);
|
||||
writer.Write(OriginalOwner);
|
||||
}
|
||||
|
||||
public ReclaimVendorInventoryEntry( HouseSign sign ) : base( 6213 )
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( m_Sign.Deleted || m_Sign.Owner == null || m_Sign.Owner.VendorInventories.Count == 0 || !from.CheckAlive() )
|
||||
return;
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Owner = reader.ReadItem() as BaseHouse;
|
||||
OriginalOwner = reader.ReadMobile();
|
||||
|
||||
if ( from.Map != m_Sign.Map || !from.InRange( m_Sign, 5 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062429 ); // You must be within five paces of the house sign to use this option.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.CloseGump( typeof( VendorInventoryGump ) );
|
||||
from.SendGump( new VendorInventoryGump( m_Sign.Owner, from ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
if (Name == "a house sign")
|
||||
Name = null;
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
private class VendorsEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
|
||||
writer.Write( Owner );
|
||||
writer.Write( OriginalOwner );
|
||||
}
|
||||
public VendorsEntry(HouseSign sign) : base(6211)
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
if (!from.CheckAlive() || m_Sign.Deleted || m_Sign.Owner == null ||
|
||||
!m_Sign.Owner.AreThereAvailableVendorsFor(from))
|
||||
return;
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Owner = reader.ReadItem() as BaseHouse;
|
||||
OriginalOwner = reader.ReadMobile();
|
||||
if (from.Map != m_Sign.Map || !from.InRange(m_Sign, 5))
|
||||
from.SendLocalizedMessage(
|
||||
1062429); // You must be within five paces of the house sign to use this option.
|
||||
else
|
||||
from.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Vendors, from, m_Sign.Owner));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
private class ReclaimVendorInventoryEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
|
||||
if ( Name == "a house sign" )
|
||||
Name = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
public ReclaimVendorInventoryEntry(HouseSign sign) : base(6213)
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
|
||||
if (m_Sign.Deleted || m_Sign.Owner == null || m_Sign.Owner.VendorInventories.Count == 0 ||
|
||||
!from.CheckAlive())
|
||||
return;
|
||||
|
||||
if (from.Map != m_Sign.Map || !from.InRange(m_Sign, 5))
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1062429); // You must be within five paces of the house sign to use this option.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.CloseGump(typeof(VendorInventoryGump));
|
||||
from.SendGump(new VendorInventoryGump(m_Sign.Owner, from));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue