Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -19,17 +19,11 @@ namespace Server.Accounting
|
|||
|
||||
public static readonly TimeSpan EmptyInactiveDuration = TimeSpan.FromDays(30.0);
|
||||
|
||||
private string m_Username, m_Email, m_PlainPassword, m_CryptPassword, m_NewCryptPassword;
|
||||
private AccessLevel m_AccessLevel;
|
||||
private int m_Flags;
|
||||
private DateTime m_Created, m_LastLogin;
|
||||
private TimeSpan m_TotalGameTime;
|
||||
private List<AccountComment> m_Comments;
|
||||
private List<AccountTag> m_Tags;
|
||||
private Mobile[] m_Mobiles;
|
||||
private string[] m_IPRestrictions;
|
||||
private IPAddress[] m_LoginIPs;
|
||||
private HardwareInfo m_HardwareInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the account, all characters of the account, and all houses of those characters
|
||||
|
|
@ -54,38 +48,26 @@ namespace Server.Accounting
|
|||
m_Mobiles[i] = null;
|
||||
}
|
||||
|
||||
if ( m_LoginIPs.Length != 0 && AccountHandler.IPTable.ContainsKey( m_LoginIPs[0] ) )
|
||||
--AccountHandler.IPTable[m_LoginIPs[0]];
|
||||
if ( LoginIPs.Length != 0 && AccountHandler.IPTable.ContainsKey( LoginIPs[0] ) )
|
||||
--AccountHandler.IPTable[LoginIPs[0]];
|
||||
|
||||
Accounts.Remove( m_Username );
|
||||
Accounts.Remove( Username );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Object detailing information about the hardware of the last person to log into this account
|
||||
/// </summary>
|
||||
public HardwareInfo HardwareInfo
|
||||
{
|
||||
get => m_HardwareInfo;
|
||||
set => m_HardwareInfo = value;
|
||||
}
|
||||
public HardwareInfo HardwareInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of IP addresses for restricted access. '*' wildcard supported. If the array contains zero entries, all IP addresses are allowed.
|
||||
/// </summary>
|
||||
public string[] IPRestrictions
|
||||
{
|
||||
get => m_IPRestrictions;
|
||||
set => m_IPRestrictions = value;
|
||||
}
|
||||
public string[] IPRestrictions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of IP addresses which have successfully logged into this account.
|
||||
/// </summary>
|
||||
public IPAddress[] LoginIPs
|
||||
{
|
||||
get => m_LoginIPs;
|
||||
set => m_LoginIPs = value;
|
||||
}
|
||||
public IPAddress[] LoginIPs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of account comments. Type of contained objects is AccountComment.
|
||||
|
|
@ -106,47 +88,27 @@ namespace Server.Accounting
|
|||
/// <summary>
|
||||
/// Account username. Case insensitive validation.
|
||||
/// </summary>
|
||||
public string Username
|
||||
{
|
||||
get => m_Username;
|
||||
set => m_Username = value;
|
||||
}
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Account email address.
|
||||
/// </summary>
|
||||
public string Email
|
||||
{
|
||||
get => m_Email;
|
||||
set => m_Email = value;
|
||||
}
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Account password. Plain text. Case sensitive validation. May be null.
|
||||
/// </summary>
|
||||
public string PlainPassword
|
||||
{
|
||||
get => m_PlainPassword;
|
||||
set => m_PlainPassword = value;
|
||||
}
|
||||
public string PlainPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Account password. Hashed with MD5. May be null.
|
||||
/// </summary>
|
||||
public string CryptPassword
|
||||
{
|
||||
get => m_CryptPassword;
|
||||
set => m_CryptPassword = value;
|
||||
}
|
||||
public string CryptPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Account username and password hashed with SHA1. May be null.
|
||||
/// </summary>
|
||||
public string NewCryptPassword
|
||||
{
|
||||
get => m_NewCryptPassword;
|
||||
set => m_NewCryptPassword = value;
|
||||
}
|
||||
public string NewCryptPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initial AccessLevel for new characters created on this account.
|
||||
|
|
@ -160,11 +122,7 @@ namespace Server.Accounting
|
|||
/// <summary>
|
||||
/// Internal bitfield of account flags. Consider using direct access properties (Banned, Young), or GetFlag/SetFlag methods
|
||||
/// </summary>
|
||||
public int Flags
|
||||
{
|
||||
get => m_Flags;
|
||||
set => m_Flags = value;
|
||||
}
|
||||
public int Flags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a flag indicating if this account is banned.
|
||||
|
|
@ -217,16 +175,12 @@ namespace Server.Accounting
|
|||
/// <summary>
|
||||
/// The date and time of when this account was created.
|
||||
/// </summary>
|
||||
public DateTime Created => m_Created;
|
||||
public DateTime Created { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time when this account was last accessed.
|
||||
/// </summary>
|
||||
public DateTime LastLogin
|
||||
{
|
||||
get => m_LastLogin;
|
||||
set => m_LastLogin = value;
|
||||
}
|
||||
public DateTime LastLogin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An account is considered inactive based upon LastLogin and InactiveDuration. If the account is empty, it is based upon EmptyInactiveDuration
|
||||
|
|
@ -238,7 +192,7 @@ namespace Server.Accounting
|
|||
if ( AccessLevel != AccessLevel.Player )
|
||||
return false;
|
||||
|
||||
TimeSpan inactiveLength = DateTime.UtcNow - m_LastLogin;
|
||||
TimeSpan inactiveLength = DateTime.UtcNow - LastLogin;
|
||||
|
||||
return (inactiveLength > ((Count == 0) ? EmptyInactiveDuration : InactiveDuration));
|
||||
}
|
||||
|
|
@ -268,7 +222,7 @@ namespace Server.Accounting
|
|||
/// <param name="index">The zero-based flag index.</param>
|
||||
public bool GetFlag( int index )
|
||||
{
|
||||
return ( m_Flags & ( 1 << index ) ) != 0;
|
||||
return ( Flags & ( 1 << index ) ) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -279,9 +233,9 @@ namespace Server.Accounting
|
|||
public void SetFlag( int index, bool value )
|
||||
{
|
||||
if ( value )
|
||||
m_Flags |= ( 1 << index );
|
||||
Flags |= ( 1 << index );
|
||||
else
|
||||
m_Flags &= ~( 1 << index );
|
||||
Flags &= ~( 1 << index );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -437,25 +391,25 @@ namespace Server.Accounting
|
|||
{
|
||||
case PasswordProtection.None:
|
||||
{
|
||||
m_PlainPassword = plainPassword;
|
||||
m_CryptPassword = null;
|
||||
m_NewCryptPassword = null;
|
||||
PlainPassword = plainPassword;
|
||||
CryptPassword = null;
|
||||
NewCryptPassword = null;
|
||||
|
||||
break;
|
||||
}
|
||||
case PasswordProtection.Crypt:
|
||||
{
|
||||
m_PlainPassword = null;
|
||||
m_CryptPassword = HashMD5( plainPassword );
|
||||
m_NewCryptPassword = null;
|
||||
PlainPassword = null;
|
||||
CryptPassword = HashMD5( plainPassword );
|
||||
NewCryptPassword = null;
|
||||
|
||||
break;
|
||||
}
|
||||
default: // PasswordProtection.NewCrypt
|
||||
{
|
||||
m_PlainPassword = null;
|
||||
m_CryptPassword = null;
|
||||
m_NewCryptPassword = HashSHA1( m_Username + plainPassword );
|
||||
PlainPassword = null;
|
||||
CryptPassword = null;
|
||||
NewCryptPassword = HashSHA1( Username + plainPassword );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -467,19 +421,19 @@ namespace Server.Accounting
|
|||
bool ok;
|
||||
PasswordProtection curProt;
|
||||
|
||||
if ( m_PlainPassword != null )
|
||||
if ( PlainPassword != null )
|
||||
{
|
||||
ok = ( m_PlainPassword == plainPassword );
|
||||
ok = ( PlainPassword == plainPassword );
|
||||
curProt = PasswordProtection.None;
|
||||
}
|
||||
else if ( m_CryptPassword != null )
|
||||
else if ( CryptPassword != null )
|
||||
{
|
||||
ok = ( m_CryptPassword == HashMD5( plainPassword ) );
|
||||
ok = ( CryptPassword == HashMD5( plainPassword ) );
|
||||
curProt = PasswordProtection.Crypt;
|
||||
}
|
||||
else
|
||||
{
|
||||
ok = ( m_NewCryptPassword == HashSHA1( m_Username + plainPassword ) );
|
||||
ok = ( NewCryptPassword == HashSHA1( Username + plainPassword ) );
|
||||
curProt = PasswordProtection.NewCrypt;
|
||||
}
|
||||
|
||||
|
|
@ -591,26 +545,26 @@ namespace Server.Accounting
|
|||
|
||||
public Account( string username, string password )
|
||||
{
|
||||
m_Username = username;
|
||||
Username = username;
|
||||
|
||||
SetPassword( password );
|
||||
|
||||
m_AccessLevel = AccessLevel.Player;
|
||||
|
||||
m_Created = m_LastLogin = DateTime.UtcNow;
|
||||
Created = LastLogin = DateTime.UtcNow;
|
||||
m_TotalGameTime = TimeSpan.Zero;
|
||||
|
||||
m_Mobiles = new Mobile[7];
|
||||
|
||||
m_IPRestrictions = new string[0];
|
||||
m_LoginIPs = new IPAddress[0];
|
||||
IPRestrictions = new string[0];
|
||||
LoginIPs = new IPAddress[0];
|
||||
|
||||
Accounts.Add( this );
|
||||
}
|
||||
|
||||
public Account( XmlElement node )
|
||||
{
|
||||
m_Username = Utility.GetText( node["username"], "empty" );
|
||||
Username = Utility.GetText( node["username"], "empty" );
|
||||
|
||||
string plainPassword = Utility.GetText( node["password"], null );
|
||||
string cryptPassword = Utility.GetText( node["cryptPassword"], null );
|
||||
|
|
@ -623,9 +577,9 @@ namespace Server.Accounting
|
|||
if ( plainPassword != null )
|
||||
SetPassword( plainPassword );
|
||||
else if ( newCryptPassword != null )
|
||||
m_NewCryptPassword = newCryptPassword;
|
||||
NewCryptPassword = newCryptPassword;
|
||||
else if ( cryptPassword != null )
|
||||
m_CryptPassword = cryptPassword;
|
||||
CryptPassword = cryptPassword;
|
||||
else
|
||||
SetPassword( "empty" );
|
||||
|
||||
|
|
@ -634,11 +588,11 @@ namespace Server.Accounting
|
|||
case PasswordProtection.Crypt:
|
||||
{
|
||||
if ( cryptPassword != null )
|
||||
m_CryptPassword = cryptPassword;
|
||||
CryptPassword = cryptPassword;
|
||||
else if ( plainPassword != null )
|
||||
SetPassword( plainPassword );
|
||||
else if ( newCryptPassword != null )
|
||||
m_NewCryptPassword = newCryptPassword;
|
||||
NewCryptPassword = newCryptPassword;
|
||||
else
|
||||
SetPassword( "empty" );
|
||||
|
||||
|
|
@ -647,11 +601,11 @@ namespace Server.Accounting
|
|||
default: // PasswordProtection.NewCrypt
|
||||
{
|
||||
if ( newCryptPassword != null )
|
||||
m_NewCryptPassword = newCryptPassword;
|
||||
NewCryptPassword = newCryptPassword;
|
||||
else if ( plainPassword != null )
|
||||
SetPassword( plainPassword );
|
||||
else if ( cryptPassword != null )
|
||||
m_CryptPassword = cryptPassword;
|
||||
CryptPassword = cryptPassword;
|
||||
else
|
||||
SetPassword( "empty" );
|
||||
|
||||
|
|
@ -660,9 +614,9 @@ namespace Server.Accounting
|
|||
}
|
||||
|
||||
Enum.TryParse( Utility.GetText( node["accessLevel"], "Player" ), true, out m_AccessLevel );
|
||||
m_Flags = Utility.GetXMLInt32( Utility.GetText( node["flags"], "0" ), 0 );
|
||||
m_Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.UtcNow );
|
||||
m_LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.UtcNow );
|
||||
Flags = Utility.GetXMLInt32( Utility.GetText( node["flags"], "0" ), 0 );
|
||||
Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.UtcNow );
|
||||
LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.UtcNow );
|
||||
|
||||
TotalGold = Utility.GetXMLInt32( Utility.GetText(node["totalGold"], "0" ), 0 );
|
||||
TotalPlat = Utility.GetXMLInt32(Utility.GetText(node["totalPlat"], "0"), 0);
|
||||
|
|
@ -670,8 +624,8 @@ namespace Server.Accounting
|
|||
m_Mobiles = LoadMobiles( node );
|
||||
m_Comments = LoadComments( node );
|
||||
m_Tags = LoadTags( node );
|
||||
m_LoginIPs = LoadAddressList( node );
|
||||
m_IPRestrictions = LoadAccessCheck( node );
|
||||
LoginIPs = LoadAddressList( node );
|
||||
IPRestrictions = LoadAccessCheck( node );
|
||||
|
||||
for ( int i = 0; i < m_Mobiles.Length; ++i )
|
||||
{
|
||||
|
|
@ -896,10 +850,10 @@ namespace Server.Accounting
|
|||
return false;
|
||||
}
|
||||
|
||||
bool accessAllowed = ( m_IPRestrictions.Length == 0 || IPLimiter.IsExempt( ipAddress ) );
|
||||
bool accessAllowed = ( IPRestrictions.Length == 0 || IPLimiter.IsExempt( ipAddress ) );
|
||||
|
||||
for ( int i = 0; !accessAllowed && i < m_IPRestrictions.Length; ++i )
|
||||
accessAllowed = Utility.IPMatch( m_IPRestrictions[i], ipAddress );
|
||||
for ( int i = 0; !accessAllowed && i < IPRestrictions.Length; ++i )
|
||||
accessAllowed = Utility.IPMatch( IPRestrictions[i], ipAddress );
|
||||
|
||||
return accessAllowed;
|
||||
}
|
||||
|
|
@ -919,7 +873,7 @@ namespace Server.Accounting
|
|||
if ( IPLimiter.IsExempt( ipAddress ) )
|
||||
return;
|
||||
|
||||
if ( m_LoginIPs.Length == 0 ) {
|
||||
if ( LoginIPs.Length == 0 ) {
|
||||
if ( AccountHandler.IPTable.ContainsKey( ipAddress ) )
|
||||
AccountHandler.IPTable[ipAddress]++;
|
||||
else
|
||||
|
|
@ -928,19 +882,19 @@ namespace Server.Accounting
|
|||
|
||||
bool contains = false;
|
||||
|
||||
for ( int i = 0; !contains && i < m_LoginIPs.Length; ++i )
|
||||
contains = m_LoginIPs[i].Equals( ipAddress );
|
||||
for ( int i = 0; !contains && i < LoginIPs.Length; ++i )
|
||||
contains = LoginIPs[i].Equals( ipAddress );
|
||||
|
||||
if ( contains )
|
||||
return;
|
||||
|
||||
IPAddress[] old = m_LoginIPs;
|
||||
m_LoginIPs = new IPAddress[old.Length + 1];
|
||||
IPAddress[] old = LoginIPs;
|
||||
LoginIPs = new IPAddress[old.Length + 1];
|
||||
|
||||
for ( int i = 0; i < old.Length; ++i )
|
||||
m_LoginIPs[i] = old[i];
|
||||
LoginIPs[i] = old[i];
|
||||
|
||||
m_LoginIPs[old.Length] = ipAddress;
|
||||
LoginIPs[old.Length] = ipAddress;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -972,27 +926,27 @@ namespace Server.Accounting
|
|||
xml.WriteStartElement( "account" );
|
||||
|
||||
xml.WriteStartElement( "username" );
|
||||
xml.WriteString( m_Username );
|
||||
xml.WriteString( Username );
|
||||
xml.WriteEndElement();
|
||||
|
||||
if ( m_PlainPassword != null )
|
||||
if ( PlainPassword != null )
|
||||
{
|
||||
xml.WriteStartElement( "password" );
|
||||
xml.WriteString( m_PlainPassword );
|
||||
xml.WriteString( PlainPassword );
|
||||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
if ( m_CryptPassword != null )
|
||||
if ( CryptPassword != null )
|
||||
{
|
||||
xml.WriteStartElement( "cryptPassword" );
|
||||
xml.WriteString( m_CryptPassword );
|
||||
xml.WriteString( CryptPassword );
|
||||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
if ( m_NewCryptPassword != null )
|
||||
if ( NewCryptPassword != null )
|
||||
{
|
||||
xml.WriteStartElement( "newCryptPassword" );
|
||||
xml.WriteString( m_NewCryptPassword );
|
||||
xml.WriteString( NewCryptPassword );
|
||||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
|
|
@ -1003,19 +957,19 @@ namespace Server.Accounting
|
|||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
if ( m_Flags != 0 )
|
||||
if ( Flags != 0 )
|
||||
{
|
||||
xml.WriteStartElement( "flags" );
|
||||
xml.WriteString( XmlConvert.ToString( m_Flags ) );
|
||||
xml.WriteString( XmlConvert.ToString( Flags ) );
|
||||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
xml.WriteStartElement( "created" );
|
||||
xml.WriteString( XmlConvert.ToString( m_Created, XmlDateTimeSerializationMode.Utc ) );
|
||||
xml.WriteString( XmlConvert.ToString( Created, XmlDateTimeSerializationMode.Utc ) );
|
||||
xml.WriteEndElement();
|
||||
|
||||
xml.WriteStartElement( "lastLogin" );
|
||||
xml.WriteString( XmlConvert.ToString( m_LastLogin, XmlDateTimeSerializationMode.Utc ) );
|
||||
xml.WriteString( XmlConvert.ToString( LastLogin, XmlDateTimeSerializationMode.Utc ) );
|
||||
xml.WriteEndElement();
|
||||
|
||||
xml.WriteStartElement( "totalGameTime" );
|
||||
|
|
@ -1061,30 +1015,30 @@ namespace Server.Accounting
|
|||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
if ( m_LoginIPs.Length > 0 )
|
||||
if ( LoginIPs.Length > 0 )
|
||||
{
|
||||
xml.WriteStartElement( "addressList" );
|
||||
|
||||
xml.WriteAttributeString( "count", m_LoginIPs.Length.ToString() );
|
||||
xml.WriteAttributeString( "count", LoginIPs.Length.ToString() );
|
||||
|
||||
for ( int i = 0; i < m_LoginIPs.Length; ++i )
|
||||
for ( int i = 0; i < LoginIPs.Length; ++i )
|
||||
{
|
||||
xml.WriteStartElement( "ip" );
|
||||
xml.WriteString( m_LoginIPs[i].ToString() );
|
||||
xml.WriteString( LoginIPs[i].ToString() );
|
||||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
if ( m_IPRestrictions.Length > 0 )
|
||||
if ( IPRestrictions.Length > 0 )
|
||||
{
|
||||
xml.WriteStartElement( "accessCheck" );
|
||||
|
||||
for ( int i = 0; i < m_IPRestrictions.Length; ++i )
|
||||
for ( int i = 0; i < IPRestrictions.Length; ++i )
|
||||
{
|
||||
xml.WriteStartElement( "ip" );
|
||||
xml.WriteString( m_IPRestrictions[i] );
|
||||
xml.WriteString( IPRestrictions[i] );
|
||||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
|
|
@ -1170,7 +1124,7 @@ namespace Server.Accounting
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return m_Username;
|
||||
return Username;
|
||||
}
|
||||
|
||||
public int CompareTo( Account other )
|
||||
|
|
@ -1178,7 +1132,7 @@ namespace Server.Accounting
|
|||
if ( other == null )
|
||||
return 1;
|
||||
|
||||
return m_Username.CompareTo( other.m_Username );
|
||||
return Username.CompareTo( other.Username );
|
||||
}
|
||||
|
||||
public int CompareTo( IAccount other )
|
||||
|
|
@ -1186,7 +1140,7 @@ namespace Server.Accounting
|
|||
if ( other == null )
|
||||
return 1;
|
||||
|
||||
return m_Username.CompareTo( other.Username );
|
||||
return Username.CompareTo( other.Username );
|
||||
}
|
||||
|
||||
public int CompareTo( object obj )
|
||||
|
|
|
|||
|
|
@ -104,38 +104,22 @@ namespace Server.Accounting
|
|||
|
||||
public class InvalidAccountAccessLog
|
||||
{
|
||||
private IPAddress m_Address;
|
||||
private DateTime m_LastAccessTime;
|
||||
private int m_Counts;
|
||||
public IPAddress Address { get; set; }
|
||||
|
||||
public IPAddress Address
|
||||
{
|
||||
get => m_Address;
|
||||
set => m_Address = value;
|
||||
}
|
||||
public DateTime LastAccessTime { get; set; }
|
||||
|
||||
public DateTime LastAccessTime
|
||||
{
|
||||
get => m_LastAccessTime;
|
||||
set => m_LastAccessTime = value;
|
||||
}
|
||||
public bool HasExpired => ( DateTime.UtcNow >= ( LastAccessTime + TimeSpan.FromHours( 1.0 ) ) );
|
||||
|
||||
public bool HasExpired => ( DateTime.UtcNow >= ( m_LastAccessTime + TimeSpan.FromHours( 1.0 ) ) );
|
||||
|
||||
public int Counts
|
||||
{
|
||||
get => m_Counts;
|
||||
set => m_Counts = value;
|
||||
}
|
||||
public int Counts { get; set; }
|
||||
|
||||
public void RefreshAccessTime()
|
||||
{
|
||||
m_LastAccessTime = DateTime.UtcNow;
|
||||
LastAccessTime = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public InvalidAccountAccessLog( IPAddress address )
|
||||
{
|
||||
m_Address = address;
|
||||
Address = address;
|
||||
RefreshAccessTime();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,12 @@ namespace Server.Accounting
|
|||
{
|
||||
public class AccountComment
|
||||
{
|
||||
private string m_AddedBy;
|
||||
private string m_Content;
|
||||
private DateTime m_LastModified;
|
||||
|
||||
/// <summary>
|
||||
/// A string representing who added this comment.
|
||||
/// </summary>
|
||||
public string AddedBy => m_AddedBy;
|
||||
public string AddedBy { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the body of this comment. Setting this value will reset LastModified.
|
||||
|
|
@ -20,13 +18,13 @@ namespace Server.Accounting
|
|||
public string Content
|
||||
{
|
||||
get => m_Content;
|
||||
set{ m_Content = value; m_LastModified = DateTime.UtcNow; }
|
||||
set{ m_Content = value; LastModified = DateTime.UtcNow; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The date and time when this account was last modified -or- the comment creation time, if never modified.
|
||||
/// </summary>
|
||||
public DateTime LastModified => m_LastModified;
|
||||
public DateTime LastModified { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new AccountComment instance.
|
||||
|
|
@ -35,9 +33,9 @@ namespace Server.Accounting
|
|||
/// <param name="content">Initial Content value.</param>
|
||||
public AccountComment( string addedBy, string content )
|
||||
{
|
||||
m_AddedBy = addedBy;
|
||||
AddedBy = addedBy;
|
||||
m_Content = content;
|
||||
m_LastModified = DateTime.UtcNow;
|
||||
LastModified = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -46,8 +44,8 @@ namespace Server.Accounting
|
|||
/// <param name="node">The XmlElement instance from which to deserialize.</param>
|
||||
public AccountComment( XmlElement node )
|
||||
{
|
||||
m_AddedBy = Utility.GetAttribute( node, "addedBy", "empty" );
|
||||
m_LastModified = Utility.GetXMLDateTime( Utility.GetAttribute( node, "lastModified" ), DateTime.UtcNow );
|
||||
AddedBy = Utility.GetAttribute( node, "addedBy", "empty" );
|
||||
LastModified = Utility.GetXMLDateTime( Utility.GetAttribute( node, "lastModified" ), DateTime.UtcNow );
|
||||
m_Content = Utility.GetText( node, "" );
|
||||
}
|
||||
|
||||
|
|
@ -59,9 +57,9 @@ namespace Server.Accounting
|
|||
{
|
||||
xml.WriteStartElement( "comment" );
|
||||
|
||||
xml.WriteAttributeString( "addedBy", m_AddedBy );
|
||||
xml.WriteAttributeString( "addedBy", AddedBy );
|
||||
|
||||
xml.WriteAttributeString( "lastModified", XmlConvert.ToString( m_LastModified, XmlDateTimeSerializationMode.Utc ) );
|
||||
xml.WriteAttributeString( "lastModified", XmlConvert.ToString( LastModified, XmlDateTimeSerializationMode.Utc ) );
|
||||
|
||||
xml.WriteString( m_Content );
|
||||
|
||||
|
|
|
|||
|
|
@ -26,13 +26,7 @@ namespace Server.Misc
|
|||
|
||||
public static PasswordProtection ProtectPasswords = PasswordProtection.NewCrypt;
|
||||
|
||||
private static AccessLevel m_LockdownLevel;
|
||||
|
||||
public static AccessLevel LockdownLevel
|
||||
{
|
||||
get => m_LockdownLevel;
|
||||
set => m_LockdownLevel = value;
|
||||
}
|
||||
public static AccessLevel LockdownLevel { get; set; }
|
||||
|
||||
private static CityInfo[] StartingCities = {
|
||||
new CityInfo( "New Haven", "New Haven Bank", 1150168, 3667, 2625, 0 ),
|
||||
|
|
@ -330,7 +324,7 @@ namespace Server.Misc
|
|||
else if ( !acct.HasAccess( e.State ) )
|
||||
{
|
||||
Console.WriteLine( "Login: {0}: Access denied for '{1}'", e.State, un );
|
||||
e.RejectReason = ( m_LockdownLevel > AccessLevel.Player ? ALRReason.BadComm : ALRReason.BadPass );
|
||||
e.RejectReason = ( LockdownLevel > AccessLevel.Player ? ALRReason.BadComm : ALRReason.BadPass );
|
||||
}
|
||||
else if ( !acct.CheckPassword( pw ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,25 +4,15 @@ namespace Server.Accounting
|
|||
{
|
||||
public class AccountTag
|
||||
{
|
||||
private string m_Name, m_Value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of this tag.
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of this tag.
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get => m_Value;
|
||||
set => m_Value = value;
|
||||
}
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new AccountTag instance with a specific name and value.
|
||||
|
|
@ -31,8 +21,8 @@ namespace Server.Accounting
|
|||
/// <param name="value">Initial value.</param>
|
||||
public AccountTag( string name, string value )
|
||||
{
|
||||
m_Name = name;
|
||||
m_Value = value;
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -41,8 +31,8 @@ namespace Server.Accounting
|
|||
/// <param name="node">The XmlElement instance from which to deserialize.</param>
|
||||
public AccountTag( XmlElement node )
|
||||
{
|
||||
m_Name = Utility.GetAttribute( node, "name", "empty" );
|
||||
m_Value = Utility.GetText( node, "" );
|
||||
Name = Utility.GetAttribute( node, "name", "empty" );
|
||||
Value = Utility.GetText( node, "" );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -52,8 +42,8 @@ namespace Server.Accounting
|
|||
public void Save( XmlTextWriter xml )
|
||||
{
|
||||
xml.WriteStartElement( "tag" );
|
||||
xml.WriteAttributeString( "name", m_Name );
|
||||
xml.WriteString( m_Value );
|
||||
xml.WriteAttributeString( "name", Name );
|
||||
xml.WriteString( Value );
|
||||
xml.WriteEndElement();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,11 +145,9 @@ namespace Server
|
|||
}
|
||||
#endregion
|
||||
|
||||
private static List<IFirewallEntry> m_Blocked;
|
||||
|
||||
static Firewall()
|
||||
{
|
||||
m_Blocked = new List<IFirewallEntry>();
|
||||
List = new List<IFirewallEntry>();
|
||||
|
||||
string path = "firewall.cfg";
|
||||
|
||||
|
|
@ -166,7 +164,7 @@ namespace Server
|
|||
if ( line.Length == 0 )
|
||||
continue;
|
||||
|
||||
m_Blocked.Add( ToFirewallEntry( line ) );
|
||||
List.Add( ToFirewallEntry( line ) );
|
||||
|
||||
/*
|
||||
object toAdd;
|
||||
|
|
@ -184,7 +182,7 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
public static List<IFirewallEntry> List => m_Blocked;
|
||||
public static List<IFirewallEntry> List { get; }
|
||||
|
||||
public static IFirewallEntry ToFirewallEntry( object entry )
|
||||
{
|
||||
|
|
@ -220,7 +218,7 @@ namespace Server
|
|||
|
||||
public static void RemoveAt( int index )
|
||||
{
|
||||
m_Blocked.RemoveAt( index );
|
||||
List.RemoveAt( index );
|
||||
Save();
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +228,7 @@ namespace Server
|
|||
|
||||
if ( entry != null )
|
||||
{
|
||||
m_Blocked.Remove( entry );
|
||||
List.Remove( entry );
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
|
@ -247,8 +245,8 @@ namespace Server
|
|||
|
||||
public static void Add( IFirewallEntry entry )
|
||||
{
|
||||
if ( !m_Blocked.Contains( entry ) )
|
||||
m_Blocked.Add( entry );
|
||||
if ( !List.Contains( entry ) )
|
||||
List.Add( entry );
|
||||
|
||||
Save();
|
||||
}
|
||||
|
|
@ -257,8 +255,8 @@ namespace Server
|
|||
{
|
||||
IFirewallEntry entry = ToFirewallEntry( pattern );
|
||||
|
||||
if ( !m_Blocked.Contains( entry ) )
|
||||
m_Blocked.Add( entry );
|
||||
if ( !List.Contains( entry ) )
|
||||
List.Add( entry );
|
||||
|
||||
Save();
|
||||
}
|
||||
|
|
@ -267,8 +265,8 @@ namespace Server
|
|||
{
|
||||
IFirewallEntry entry = new IPFirewallEntry( ip );
|
||||
|
||||
if ( !m_Blocked.Contains( entry ) )
|
||||
m_Blocked.Add( entry );
|
||||
if ( !List.Contains( entry ) )
|
||||
List.Add( entry );
|
||||
|
||||
Save();
|
||||
}
|
||||
|
|
@ -279,16 +277,16 @@ namespace Server
|
|||
|
||||
using ( StreamWriter op = new StreamWriter( path ) )
|
||||
{
|
||||
for ( int i = 0; i < m_Blocked.Count; ++i )
|
||||
op.WriteLine( m_Blocked[i] );
|
||||
for ( int i = 0; i < List.Count; ++i )
|
||||
op.WriteLine( List[i] );
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsBlocked( IPAddress ip )
|
||||
{
|
||||
for( int i = 0; i < m_Blocked.Count; i++ )
|
||||
for( int i = 0; i < List.Count; i++ )
|
||||
{
|
||||
if ( m_Blocked[i].IsBlocked( ip ) )
|
||||
if ( List[i].IsBlocked( ip ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,37 +4,31 @@ namespace Server
|
|||
{
|
||||
public class UsageAttribute : Attribute
|
||||
{
|
||||
private string m_Usage;
|
||||
|
||||
public string Usage => m_Usage;
|
||||
public string Usage { get; }
|
||||
|
||||
public UsageAttribute( string usage )
|
||||
{
|
||||
m_Usage = usage;
|
||||
Usage = usage;
|
||||
}
|
||||
}
|
||||
|
||||
public class DescriptionAttribute : Attribute
|
||||
{
|
||||
private string m_Description;
|
||||
|
||||
public string Description => m_Description;
|
||||
public string Description { get; }
|
||||
|
||||
public DescriptionAttribute( string description )
|
||||
{
|
||||
m_Description = description;
|
||||
Description = description;
|
||||
}
|
||||
}
|
||||
|
||||
public class AliasesAttribute : Attribute
|
||||
{
|
||||
private string[] m_Aliases;
|
||||
|
||||
public string[] Aliases => m_Aliases;
|
||||
public string[] Aliases { get; }
|
||||
|
||||
public AliasesAttribute( params string[] aliases )
|
||||
{
|
||||
m_Aliases = aliases;
|
||||
Aliases = aliases;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,31 +9,19 @@ namespace Server.Commands
|
|||
{
|
||||
public class Batch : BaseCommand
|
||||
{
|
||||
private BaseCommandImplementor m_Scope;
|
||||
private string m_Condition;
|
||||
private ArrayList m_BatchCommands;
|
||||
public BaseCommandImplementor Scope { get; set; }
|
||||
|
||||
public BaseCommandImplementor Scope
|
||||
{
|
||||
get => m_Scope;
|
||||
set => m_Scope = value;
|
||||
}
|
||||
public string Condition { get; set; }
|
||||
|
||||
public string Condition
|
||||
{
|
||||
get => m_Condition;
|
||||
set => m_Condition = value;
|
||||
}
|
||||
|
||||
public ArrayList BatchCommands => m_BatchCommands;
|
||||
public ArrayList BatchCommands { get; }
|
||||
|
||||
public Batch()
|
||||
{
|
||||
Commands = new[]{ "Batch" };
|
||||
ListOptimized = true;
|
||||
|
||||
m_BatchCommands = new ArrayList();
|
||||
m_Condition = "";
|
||||
BatchCommands = new ArrayList();
|
||||
Condition = "";
|
||||
}
|
||||
|
||||
public override void ExecuteList( CommandEventArgs e, ArrayList list )
|
||||
|
|
@ -46,19 +34,19 @@ namespace Server.Commands
|
|||
|
||||
try
|
||||
{
|
||||
BaseCommand[] commands = new BaseCommand[m_BatchCommands.Count];
|
||||
CommandEventArgs[] eventArgs = new CommandEventArgs[m_BatchCommands.Count];
|
||||
BaseCommand[] commands = new BaseCommand[BatchCommands.Count];
|
||||
CommandEventArgs[] eventArgs = new CommandEventArgs[BatchCommands.Count];
|
||||
|
||||
for ( int i = 0; i < m_BatchCommands.Count; ++i )
|
||||
for ( int i = 0; i < BatchCommands.Count; ++i )
|
||||
{
|
||||
BatchCommand bc = (BatchCommand)m_BatchCommands[i];
|
||||
BatchCommand bc = (BatchCommand)BatchCommands[i];
|
||||
|
||||
string commandString, argString;
|
||||
string[] args;
|
||||
|
||||
bc.GetDetails( out commandString, out argString, out args );
|
||||
|
||||
BaseCommand command = m_Scope.Commands[commandString];
|
||||
BaseCommand command = Scope.Commands[commandString];
|
||||
|
||||
commands[i] = command;
|
||||
eventArgs[i] = new CommandEventArgs( e.Mobile, commandString, argString, args );
|
||||
|
|
@ -74,7 +62,7 @@ namespace Server.Commands
|
|||
e.Mobile.SendMessage( "You do not have access to that command: {0}.", commandString );
|
||||
return;
|
||||
}
|
||||
if ( !command.ValidateArgs( m_Scope, eventArgs[i] ) )
|
||||
if ( !command.ValidateArgs( Scope, eventArgs[i] ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -83,7 +71,7 @@ namespace Server.Commands
|
|||
for ( int i = 0; i < commands.Length; ++i )
|
||||
{
|
||||
BaseCommand command = commands[i];
|
||||
BatchCommand bc = (BatchCommand)m_BatchCommands[i];
|
||||
BatchCommand bc = (BatchCommand)BatchCommands[i];
|
||||
|
||||
if ( list.Count > 20 )
|
||||
CommandLogging.Enabled = false;
|
||||
|
|
@ -153,26 +141,26 @@ namespace Server.Commands
|
|||
|
||||
public bool Run( Mobile from )
|
||||
{
|
||||
if ( m_Scope == null )
|
||||
if ( Scope == null )
|
||||
{
|
||||
from.SendMessage( "You must select the batch command scope." );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_Condition.Length > 0 && !m_Scope.SupportsConditionals )
|
||||
if ( Condition.Length > 0 && !Scope.SupportsConditionals )
|
||||
{
|
||||
from.SendMessage( "This command scope does not support conditionals." );
|
||||
return false;
|
||||
}
|
||||
if ( m_Condition.Length > 0 && !Utility.InsensitiveStartsWith( m_Condition, "where" ) )
|
||||
if ( Condition.Length > 0 && !Utility.InsensitiveStartsWith( Condition, "where" ) )
|
||||
{
|
||||
from.SendMessage( "The condition field must start with \"where\"." );
|
||||
return false;
|
||||
}
|
||||
|
||||
string[] args = CommandSystem.Split( m_Condition );
|
||||
string[] args = CommandSystem.Split( Condition );
|
||||
|
||||
m_Scope.Process( from, this, args );
|
||||
Scope.Process( from, this, args );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -194,44 +182,33 @@ namespace Server.Commands
|
|||
|
||||
public class BatchCommand
|
||||
{
|
||||
private string m_Command;
|
||||
private string m_Object;
|
||||
public string Command { get; set; }
|
||||
|
||||
public string Command
|
||||
{
|
||||
get => m_Command;
|
||||
set => m_Command = value;
|
||||
}
|
||||
|
||||
public string Object
|
||||
{
|
||||
get => m_Object;
|
||||
set => m_Object = value;
|
||||
}
|
||||
public string Object { get; set; }
|
||||
|
||||
public void GetDetails( out string command, out string argString, out string[] args )
|
||||
{
|
||||
int indexOf = m_Command.IndexOf( ' ' );
|
||||
int indexOf = Command.IndexOf( ' ' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
{
|
||||
argString = m_Command.Substring( indexOf + 1 );
|
||||
argString = Command.Substring( indexOf + 1 );
|
||||
|
||||
command = m_Command.Substring( 0, indexOf );
|
||||
command = Command.Substring( 0, indexOf );
|
||||
args = CommandSystem.Split( argString );
|
||||
}
|
||||
else
|
||||
{
|
||||
argString = "";
|
||||
command = m_Command.ToLower();
|
||||
command = Command.ToLower();
|
||||
args = new string[0];
|
||||
}
|
||||
}
|
||||
|
||||
public BatchCommand( string command, string obj )
|
||||
{
|
||||
m_Command = command;
|
||||
m_Object = obj;
|
||||
Command = command;
|
||||
Object = obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1105,11 +1105,9 @@ namespace Server.Commands
|
|||
|
||||
public class DecorationEntry
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private string m_Extra;
|
||||
public Point3D Location { get; }
|
||||
|
||||
public Point3D Location => m_Location;
|
||||
public string Extra => m_Extra;
|
||||
public string Extra { get; }
|
||||
|
||||
public DecorationEntry( string line )
|
||||
{
|
||||
|
|
@ -1119,8 +1117,8 @@ namespace Server.Commands
|
|||
Pop( out y, ref line );
|
||||
Pop( out z, ref line );
|
||||
|
||||
m_Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) );
|
||||
m_Extra = line;
|
||||
Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) );
|
||||
Extra = line;
|
||||
}
|
||||
|
||||
public void Pop( out string v, ref string line )
|
||||
|
|
|
|||
|
|
@ -1102,11 +1102,9 @@ namespace Server.Commands
|
|||
|
||||
public class DecorationEntryMag
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private string m_Extra;
|
||||
public Point3D Location { get; }
|
||||
|
||||
public Point3D Location => m_Location;
|
||||
public string Extra => m_Extra;
|
||||
public string Extra { get; }
|
||||
|
||||
public DecorationEntryMag( string line )
|
||||
{
|
||||
|
|
@ -1116,8 +1114,8 @@ namespace Server.Commands
|
|||
Pop( out y, ref line );
|
||||
Pop( out z, ref line );
|
||||
|
||||
m_Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) );
|
||||
m_Extra = line;
|
||||
Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) );
|
||||
Extra = line;
|
||||
}
|
||||
|
||||
public void Pop( out string v, ref string line )
|
||||
|
|
|
|||
|
|
@ -1402,16 +1402,14 @@ namespace Server.Commands
|
|||
|
||||
private class SpeechEntry
|
||||
{
|
||||
private int m_Index;
|
||||
private List<string> m_Strings;
|
||||
public int Index { get; }
|
||||
|
||||
public int Index => m_Index;
|
||||
public List<string> Strings => m_Strings;
|
||||
public List<string> Strings { get; }
|
||||
|
||||
public SpeechEntry( int index )
|
||||
{
|
||||
m_Index = index;
|
||||
m_Strings = new List<string>();
|
||||
Index = index;
|
||||
Strings = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1475,25 +1473,23 @@ namespace Server.Commands
|
|||
|
||||
public class DocCommandEntry
|
||||
{
|
||||
private AccessLevel m_AccessLevel;
|
||||
private string m_Name;
|
||||
private string[] m_Aliases;
|
||||
private string m_Usage;
|
||||
private string m_Description;
|
||||
public AccessLevel AccessLevel { get; }
|
||||
|
||||
public AccessLevel AccessLevel => m_AccessLevel;
|
||||
public string Name => m_Name;
|
||||
public string[] Aliases => m_Aliases;
|
||||
public string Usage => m_Usage;
|
||||
public string Description => m_Description;
|
||||
public string Name { get; }
|
||||
|
||||
public string[] Aliases { get; }
|
||||
|
||||
public string Usage { get; }
|
||||
|
||||
public string Description { get; }
|
||||
|
||||
public DocCommandEntry( AccessLevel accessLevel, string name, string[] aliases, string usage, string description )
|
||||
{
|
||||
m_AccessLevel = accessLevel;
|
||||
m_Name = name;
|
||||
m_Aliases = aliases;
|
||||
m_Usage = usage;
|
||||
m_Description = description;
|
||||
AccessLevel = accessLevel;
|
||||
Name = name;
|
||||
Aliases = aliases;
|
||||
Usage = usage;
|
||||
Description = description;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2530,31 +2526,29 @@ namespace Server.Commands
|
|||
|
||||
public class BodyEntry
|
||||
{
|
||||
private Body m_Body;
|
||||
private ModelBodyType m_BodyType;
|
||||
private string m_Name;
|
||||
public Body Body { get; }
|
||||
|
||||
public Body Body => m_Body;
|
||||
public ModelBodyType BodyType => m_BodyType;
|
||||
public string Name => m_Name;
|
||||
public ModelBodyType BodyType { get; }
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public BodyEntry( Body body, ModelBodyType bodyType, string name )
|
||||
{
|
||||
m_Body = body;
|
||||
m_BodyType = bodyType;
|
||||
m_Name = name;
|
||||
Body = body;
|
||||
BodyType = bodyType;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public override bool Equals( object obj )
|
||||
{
|
||||
BodyEntry e = (BodyEntry)obj;
|
||||
|
||||
return (m_Body == e.m_Body && m_BodyType == e.m_BodyType && m_Name == e.m_Name);
|
||||
return (Body == e.Body && BodyType == e.BodyType && Name == e.Name);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return m_Body.BodyID ^ (int)m_BodyType ^ m_Name.GetHashCode();
|
||||
return Body.BodyID ^ (int)BodyType ^ Name.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -269,63 +269,59 @@ namespace Server.Commands
|
|||
|
||||
public class CategoryTypeEntry
|
||||
{
|
||||
private Type m_Type;
|
||||
private object m_Object;
|
||||
public Type Type { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public object Object => m_Object;
|
||||
public object Object { get; }
|
||||
|
||||
public CategoryTypeEntry( Type type )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Object = Activator.CreateInstance( type );
|
||||
Type = type;
|
||||
Object = Activator.CreateInstance( type );
|
||||
}
|
||||
}
|
||||
|
||||
public class CategoryEntry
|
||||
{
|
||||
private string m_Title;
|
||||
private Type[] m_Matches;
|
||||
private CategoryEntry[] m_SubCategories;
|
||||
private CategoryEntry m_Parent;
|
||||
private ArrayList m_Matched;
|
||||
public string Title { get; }
|
||||
|
||||
public string Title => m_Title;
|
||||
public Type[] Matches => m_Matches;
|
||||
public CategoryEntry Parent => m_Parent;
|
||||
public CategoryEntry[] SubCategories => m_SubCategories;
|
||||
public ArrayList Matched => m_Matched;
|
||||
public Type[] Matches { get; }
|
||||
|
||||
public CategoryEntry Parent { get; }
|
||||
|
||||
public CategoryEntry[] SubCategories { get; }
|
||||
|
||||
public ArrayList Matched { get; }
|
||||
|
||||
public CategoryEntry()
|
||||
{
|
||||
m_Title = "(empty)";
|
||||
m_Matches = new Type[0];
|
||||
m_SubCategories = new CategoryEntry[0];
|
||||
m_Matched = new ArrayList();
|
||||
Title = "(empty)";
|
||||
Matches = new Type[0];
|
||||
SubCategories = new CategoryEntry[0];
|
||||
Matched = new ArrayList();
|
||||
}
|
||||
|
||||
public CategoryEntry( CategoryEntry parent, string title, CategoryEntry[] subCats )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_Title = title;
|
||||
m_SubCategories = subCats;
|
||||
m_Matches = new Type[0];
|
||||
m_Matched = new ArrayList();
|
||||
Parent = parent;
|
||||
Title = title;
|
||||
SubCategories = subCats;
|
||||
Matches = new Type[0];
|
||||
Matched = new ArrayList();
|
||||
}
|
||||
|
||||
public bool IsMatch( Type type )
|
||||
{
|
||||
bool isMatch = false;
|
||||
|
||||
for ( int i = 0; !isMatch && i < m_Matches.Length; ++i )
|
||||
isMatch = ( type == m_Matches[i] || type.IsSubclassOf( m_Matches[i] ) );
|
||||
for ( int i = 0; !isMatch && i < Matches.Length; ++i )
|
||||
isMatch = ( type == Matches[i] || type.IsSubclassOf( Matches[i] ) );
|
||||
|
||||
return isMatch;
|
||||
}
|
||||
|
||||
public CategoryEntry( CategoryEntry parent, CategoryLine[] lines, ref int index )
|
||||
{
|
||||
m_Parent = parent;
|
||||
Parent = parent;
|
||||
|
||||
string text = lines[index].Text;
|
||||
|
||||
|
|
@ -334,7 +330,7 @@ namespace Server.Commands
|
|||
if ( start < 0 )
|
||||
throw new FormatException($"Input string not correctly formatted ('{text}')");
|
||||
|
||||
m_Title = text.Substring( 0, start ).Trim();
|
||||
Title = text.Substring( 0, start ).Trim();
|
||||
|
||||
int end = text.IndexOf( ')', ++start );
|
||||
|
||||
|
|
@ -356,7 +352,7 @@ namespace Server.Commands
|
|||
list.Add( type );
|
||||
}
|
||||
|
||||
m_Matches = (Type[])list.ToArray( typeof( Type ) );
|
||||
Matches = (Type[])list.ToArray( typeof( Type ) );
|
||||
list.Clear();
|
||||
|
||||
int ourIndentation = lines[index].Indentation;
|
||||
|
|
@ -366,20 +362,18 @@ namespace Server.Commands
|
|||
while ( index < lines.Length && lines[index].Indentation > ourIndentation )
|
||||
list.Add( new CategoryEntry( this, lines, ref index ) );
|
||||
|
||||
m_SubCategories = (CategoryEntry[])list.ToArray( typeof( CategoryEntry ) );
|
||||
SubCategories = (CategoryEntry[])list.ToArray( typeof( CategoryEntry ) );
|
||||
list.Clear();
|
||||
|
||||
m_Matched = list;
|
||||
Matched = list;
|
||||
}
|
||||
}
|
||||
|
||||
public class CategoryLine
|
||||
{
|
||||
private int m_Indentation;
|
||||
private string m_Text;
|
||||
public int Indentation { get; }
|
||||
|
||||
public int Indentation => m_Indentation;
|
||||
public string Text => m_Text;
|
||||
public string Text { get; }
|
||||
|
||||
public CategoryLine( string input )
|
||||
{
|
||||
|
|
@ -394,8 +388,8 @@ namespace Server.Commands
|
|||
if ( index >= input.Length )
|
||||
throw new FormatException($"Input string not correctly formatted ('{input}')");
|
||||
|
||||
m_Indentation = index;
|
||||
m_Text = input.Substring( index );
|
||||
Indentation = index;
|
||||
Text = input.Substring( index );
|
||||
}
|
||||
|
||||
public static CategoryLine[] Load( string path )
|
||||
|
|
|
|||
|
|
@ -14,55 +14,19 @@ namespace Server.Commands.Generic
|
|||
|
||||
public abstract class BaseCommand
|
||||
{
|
||||
private string[] m_Commands;
|
||||
private AccessLevel m_AccessLevel;
|
||||
private CommandSupport m_Implementors;
|
||||
private ObjectTypes m_ObjectTypes;
|
||||
private bool m_ListOptimized;
|
||||
private string m_Usage;
|
||||
private string m_Description;
|
||||
public bool ListOptimized { get; set; }
|
||||
|
||||
public bool ListOptimized
|
||||
{
|
||||
get => m_ListOptimized;
|
||||
set => m_ListOptimized = value;
|
||||
}
|
||||
public string[] Commands { get; set; }
|
||||
|
||||
public string[] Commands
|
||||
{
|
||||
get => m_Commands;
|
||||
set => m_Commands = value;
|
||||
}
|
||||
public string Usage { get; set; }
|
||||
|
||||
public string Usage
|
||||
{
|
||||
get => m_Usage;
|
||||
set => m_Usage = value;
|
||||
}
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Description
|
||||
{
|
||||
get => m_Description;
|
||||
set => m_Description = value;
|
||||
}
|
||||
public AccessLevel AccessLevel { get; set; }
|
||||
|
||||
public AccessLevel AccessLevel
|
||||
{
|
||||
get => m_AccessLevel;
|
||||
set => m_AccessLevel = value;
|
||||
}
|
||||
public ObjectTypes ObjectTypes { get; set; }
|
||||
|
||||
public ObjectTypes ObjectTypes
|
||||
{
|
||||
get => m_ObjectTypes;
|
||||
set => m_ObjectTypes = value;
|
||||
}
|
||||
|
||||
public CommandSupport Supports
|
||||
{
|
||||
get => m_Implementors;
|
||||
set => m_Implementors = value;
|
||||
}
|
||||
public CommandSupport Supports { get; set; }
|
||||
|
||||
public BaseCommand()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,13 +58,11 @@ namespace Server.Commands.Generic
|
|||
Register( new TraceLockdownCommand() );
|
||||
}
|
||||
|
||||
private static List<BaseCommand> m_AllCommands = new List<BaseCommand>();
|
||||
|
||||
public static List<BaseCommand> AllCommands => m_AllCommands;
|
||||
public static List<BaseCommand> AllCommands { get; } = new List<BaseCommand>();
|
||||
|
||||
public static void Register( BaseCommand command )
|
||||
{
|
||||
m_AllCommands.Add( command );
|
||||
AllCommands.Add( command );
|
||||
|
||||
List<BaseCommandImplementor> impls = BaseCommandImplementor.Implementors;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,40 +8,31 @@ namespace Server.Commands.Generic
|
|||
|
||||
public sealed class ExtensionInfo
|
||||
{
|
||||
private static Dictionary<string, ExtensionInfo> m_Table = new Dictionary<string, ExtensionInfo>( StringComparer.InvariantCultureIgnoreCase );
|
||||
|
||||
public static Dictionary<string, ExtensionInfo> Table => m_Table;
|
||||
public static Dictionary<string, ExtensionInfo> Table { get; } = new Dictionary<string, ExtensionInfo>( StringComparer.InvariantCultureIgnoreCase );
|
||||
|
||||
public static void Register( ExtensionInfo ext )
|
||||
{
|
||||
m_Table[ext.m_Name] = ext;
|
||||
Table[ext.Name] = ext;
|
||||
}
|
||||
|
||||
private int m_Order;
|
||||
public int Order { get; }
|
||||
|
||||
private string m_Name;
|
||||
private int m_Size;
|
||||
public string Name { get; }
|
||||
|
||||
private ExtensionConstructor m_Constructor;
|
||||
public int Size { get; }
|
||||
|
||||
public int Order => m_Order;
|
||||
public bool IsFixedSize => ( Size >= 0 );
|
||||
|
||||
public string Name => m_Name;
|
||||
|
||||
public int Size => m_Size;
|
||||
|
||||
public bool IsFixedSize => ( m_Size >= 0 );
|
||||
|
||||
public ExtensionConstructor Constructor => m_Constructor;
|
||||
public ExtensionConstructor Constructor { get; }
|
||||
|
||||
public ExtensionInfo( int order, string name, int size, ExtensionConstructor constructor )
|
||||
{
|
||||
m_Name = name;
|
||||
m_Size = size;
|
||||
Name = name;
|
||||
Size = size;
|
||||
|
||||
m_Order = order;
|
||||
Order = order;
|
||||
|
||||
m_Constructor = constructor;
|
||||
Constructor = constructor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,52 +40,48 @@ namespace Server.Commands.Generic
|
|||
|
||||
public sealed class PropertyValue
|
||||
{
|
||||
private Type m_Type;
|
||||
private object m_Value;
|
||||
private FieldInfo m_Field;
|
||||
public Type Type { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public object Value { get; private set; }
|
||||
|
||||
public object Value => m_Value;
|
||||
public FieldInfo Field { get; private set; }
|
||||
|
||||
public FieldInfo Field => m_Field;
|
||||
|
||||
public bool HasField => ( m_Field != null );
|
||||
public bool HasField => ( Field != null );
|
||||
|
||||
public PropertyValue( Type type, object value )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Value = value;
|
||||
Type = type;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public void Load( MethodEmitter method )
|
||||
{
|
||||
if ( m_Field != null )
|
||||
if ( Field != null )
|
||||
{
|
||||
method.LoadArgument( 0 );
|
||||
method.LoadField( m_Field );
|
||||
method.LoadField( Field );
|
||||
}
|
||||
else if ( m_Value == null )
|
||||
else if ( Value == null )
|
||||
{
|
||||
method.LoadNull( m_Type );
|
||||
method.LoadNull( Type );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Value is int i )
|
||||
if ( Value is int i )
|
||||
method.Load( i );
|
||||
else if ( m_Value is long l )
|
||||
else if ( Value is long l )
|
||||
method.Load( l );
|
||||
else if ( m_Value is float f )
|
||||
else if ( Value is float f )
|
||||
method.Load( f );
|
||||
else if ( m_Value is double d )
|
||||
else if ( Value is double d )
|
||||
method.Load( d );
|
||||
else if ( m_Value is char c )
|
||||
else if ( Value is char c )
|
||||
method.Load( c );
|
||||
else if ( m_Value is bool b )
|
||||
else if ( Value is bool b )
|
||||
method.Load( b );
|
||||
else if ( m_Value is string s )
|
||||
else if ( Value is string s )
|
||||
method.Load( s );
|
||||
else if ( m_Value is Enum e )
|
||||
else if ( Value is Enum e )
|
||||
method.Load( e );
|
||||
else
|
||||
throw new InvalidOperationException( "Unrecognized comparison value." );
|
||||
|
|
@ -94,29 +90,29 @@ namespace Server.Commands.Generic
|
|||
|
||||
public void Acquire( TypeBuilder typeBuilder, ILGenerator il, string fieldName )
|
||||
{
|
||||
if ( m_Value is string toParse )
|
||||
if ( Value is string toParse )
|
||||
{
|
||||
if ( !m_Type.IsValueType && toParse == "null" )
|
||||
if ( !Type.IsValueType && toParse == "null" )
|
||||
{
|
||||
m_Value = null;
|
||||
Value = null;
|
||||
}
|
||||
else if ( m_Type == typeof( string ) )
|
||||
else if ( Type == typeof( string ) )
|
||||
{
|
||||
if ( toParse == @"@""null""" )
|
||||
toParse = "null";
|
||||
|
||||
m_Value = toParse;
|
||||
Value = toParse;
|
||||
}
|
||||
else if ( m_Type.IsEnum )
|
||||
else if ( Type.IsEnum )
|
||||
{
|
||||
m_Value = Enum.Parse( m_Type, toParse, true );
|
||||
Value = Enum.Parse( Type, toParse, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo parseMethod = null;
|
||||
object[] parseArgs = null;
|
||||
|
||||
MethodInfo parseNumber = m_Type.GetMethod(
|
||||
MethodInfo parseNumber = Type.GetMethod(
|
||||
"Parse",
|
||||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
|
|
@ -139,7 +135,7 @@ namespace Server.Commands.Generic
|
|||
}
|
||||
else
|
||||
{
|
||||
MethodInfo parseGeneral = m_Type.GetMethod(
|
||||
MethodInfo parseGeneral = Type.GetMethod(
|
||||
"Parse",
|
||||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
|
|
@ -153,13 +149,13 @@ namespace Server.Commands.Generic
|
|||
|
||||
if ( parseMethod != null )
|
||||
{
|
||||
m_Value = parseMethod.Invoke( null, parseArgs );
|
||||
Value = parseMethod.Invoke( null, parseArgs );
|
||||
|
||||
if ( !m_Type.IsPrimitive )
|
||||
if ( !Type.IsPrimitive )
|
||||
{
|
||||
m_Field = typeBuilder.DefineField(
|
||||
Field = typeBuilder.DefineField(
|
||||
fieldName,
|
||||
m_Type,
|
||||
Type,
|
||||
FieldAttributes.Private | FieldAttributes.InitOnly
|
||||
);
|
||||
|
||||
|
|
@ -171,13 +167,13 @@ namespace Server.Commands.Generic
|
|||
il.Emit( OpCodes.Ldc_I4, (int) parseArgs[1] );
|
||||
|
||||
il.Emit( OpCodes.Call, parseMethod );
|
||||
il.Emit( OpCodes.Stfld, m_Field );
|
||||
il.Emit( OpCodes.Stfld, Field );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Unable to convert string \"{m_Value}\" into type '{m_Type}'."
|
||||
$"Unable to convert string \"{Value}\" into type '{Type}'."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,9 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public sealed class OrderInfo
|
||||
{
|
||||
private Property m_Property;
|
||||
private int m_Order;
|
||||
|
||||
public Property Property
|
||||
{
|
||||
get => m_Property;
|
||||
set => m_Property = value;
|
||||
}
|
||||
public Property Property { get; set; }
|
||||
|
||||
public bool IsAscending
|
||||
{
|
||||
|
|
@ -42,7 +37,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public OrderInfo( Property property, bool isAscending )
|
||||
{
|
||||
m_Property = property;
|
||||
Property = property;
|
||||
|
||||
IsAscending = isAscending;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public override ExtensionInfo Info => ExtInfo;
|
||||
|
||||
private int m_Limit;
|
||||
|
||||
public int Limit => m_Limit;
|
||||
public int Limit { get; private set; }
|
||||
|
||||
public LimitExtension()
|
||||
{
|
||||
|
|
@ -24,16 +22,16 @@ namespace Server.Commands.Generic
|
|||
|
||||
public override void Parse( Mobile from, string[] arguments, int offset, int size )
|
||||
{
|
||||
m_Limit = Utility.ToInt32( arguments[offset] );
|
||||
Limit = Utility.ToInt32( arguments[offset] );
|
||||
|
||||
if ( m_Limit < 0 )
|
||||
if ( Limit < 0 )
|
||||
throw new Exception( "Limit cannot be less than zero." );
|
||||
}
|
||||
|
||||
public override void Filter( ArrayList list )
|
||||
{
|
||||
if ( list.Count > m_Limit )
|
||||
list.RemoveRange( m_Limit, list.Count - m_Limit );
|
||||
if ( list.Count > Limit )
|
||||
list.RemoveRange( Limit, list.Count - Limit );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public override ExtensionInfo Info => ExtInfo;
|
||||
|
||||
private ObjectConditional m_Conditional;
|
||||
|
||||
public ObjectConditional Conditional => m_Conditional;
|
||||
public ObjectConditional Conditional { get; private set; }
|
||||
|
||||
public WhereExtension()
|
||||
{
|
||||
|
|
@ -26,7 +24,7 @@ namespace Server.Commands.Generic
|
|||
if ( baseType == null )
|
||||
throw new InvalidOperationException( "Insanity." );
|
||||
|
||||
m_Conditional.Compile( ref assembly );
|
||||
Conditional.Compile( ref assembly );
|
||||
}
|
||||
|
||||
public override void Parse( Mobile from, string[] arguments, int offset, int size )
|
||||
|
|
@ -34,12 +32,12 @@ namespace Server.Commands.Generic
|
|||
if ( size < 1 )
|
||||
throw new Exception( "Invalid condition syntax." );
|
||||
|
||||
m_Conditional = ObjectConditional.ParseDirect( from, arguments, offset, size );
|
||||
Conditional = ObjectConditional.ParseDirect( from, arguments, offset, size );
|
||||
}
|
||||
|
||||
public override bool IsValid( object obj )
|
||||
{
|
||||
return m_Conditional.CheckCondition( obj );
|
||||
return Conditional.CheckCondition( obj );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public class AreaCommandImplementor : BaseCommandImplementor
|
||||
{
|
||||
private static AreaCommandImplementor m_Instance;
|
||||
|
||||
public static AreaCommandImplementor Instance => m_Instance;
|
||||
public static AreaCommandImplementor Instance { get; private set; }
|
||||
|
||||
public AreaCommandImplementor()
|
||||
{
|
||||
|
|
@ -18,7 +16,7 @@ namespace Server.Commands.Generic
|
|||
Usage = "Area <command> [condition]";
|
||||
Description = "Invokes the command on all appropriate objects in a targeted area. Optional condition arguments can further restrict the set of objects.";
|
||||
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public override void Process( Mobile from, BaseCommand command, string[] args )
|
||||
|
|
|
|||
|
|
@ -47,55 +47,23 @@ namespace Server.Commands.Generic
|
|||
Register( new FacetCommandImplementor() );
|
||||
}
|
||||
|
||||
private string[] m_Accessors;
|
||||
private AccessLevel m_AccessLevel;
|
||||
private CommandSupport m_SupportRequirement;
|
||||
private Dictionary<string, BaseCommand> m_Commands;
|
||||
private string m_Usage;
|
||||
private string m_Description;
|
||||
private bool m_SupportsConditionals;
|
||||
public bool SupportsConditionals { get; set; }
|
||||
|
||||
public bool SupportsConditionals
|
||||
{
|
||||
get => m_SupportsConditionals;
|
||||
set => m_SupportsConditionals = value;
|
||||
}
|
||||
public string[] Accessors { get; set; }
|
||||
|
||||
public string[] Accessors
|
||||
{
|
||||
get => m_Accessors;
|
||||
set => m_Accessors = value;
|
||||
}
|
||||
public string Usage { get; set; }
|
||||
|
||||
public string Usage
|
||||
{
|
||||
get => m_Usage;
|
||||
set => m_Usage = value;
|
||||
}
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Description
|
||||
{
|
||||
get => m_Description;
|
||||
set => m_Description = value;
|
||||
}
|
||||
public AccessLevel AccessLevel { get; set; }
|
||||
|
||||
public AccessLevel AccessLevel
|
||||
{
|
||||
get => m_AccessLevel;
|
||||
set => m_AccessLevel = value;
|
||||
}
|
||||
public CommandSupport SupportRequirement { get; set; }
|
||||
|
||||
public CommandSupport SupportRequirement
|
||||
{
|
||||
get => m_SupportRequirement;
|
||||
set => m_SupportRequirement = value;
|
||||
}
|
||||
|
||||
public Dictionary<string, BaseCommand> Commands => m_Commands;
|
||||
public Dictionary<string, BaseCommand> Commands { get; }
|
||||
|
||||
public BaseCommandImplementor()
|
||||
{
|
||||
m_Commands = new Dictionary<string, BaseCommand>( StringComparer.OrdinalIgnoreCase );
|
||||
Commands = new Dictionary<string, BaseCommand>( StringComparer.OrdinalIgnoreCase );
|
||||
}
|
||||
|
||||
public virtual void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
|
||||
|
|
@ -106,7 +74,7 @@ namespace Server.Commands.Generic
|
|||
public virtual void Register( BaseCommand command )
|
||||
{
|
||||
for ( int i = 0; i < command.Commands.Length; ++i )
|
||||
m_Commands[command.Commands[i]] = command;
|
||||
Commands[command.Commands[i]] = command;
|
||||
}
|
||||
|
||||
public bool CheckObjectTypes( Mobile from, BaseCommand command, Extensions ext, out bool items, out bool mobiles )
|
||||
|
|
@ -274,7 +242,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
if ( e.Length >= 1 )
|
||||
{
|
||||
m_Commands.TryGetValue( e.GetString( 0 ), out BaseCommand command );
|
||||
Commands.TryGetValue( e.GetString( 0 ), out BaseCommand command );
|
||||
|
||||
if ( command == null )
|
||||
{
|
||||
|
|
@ -303,11 +271,11 @@ namespace Server.Commands.Generic
|
|||
|
||||
public void Register()
|
||||
{
|
||||
if ( m_Accessors == null )
|
||||
if ( Accessors == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Accessors.Length; ++i )
|
||||
CommandSystem.Register( m_Accessors[i], m_AccessLevel, Execute );
|
||||
for ( int i = 0; i < Accessors.Length; ++i )
|
||||
CommandSystem.Register( Accessors[i], AccessLevel, Execute );
|
||||
}
|
||||
|
||||
public static void Register( BaseCommandImplementor impl )
|
||||
|
|
|
|||
|
|
@ -9,17 +9,15 @@ namespace Server.Commands.Generic
|
|||
private static readonly Type typeofItem = typeof( Item );
|
||||
private static readonly Type typeofMobile = typeof( Mobile );
|
||||
|
||||
private Type m_ObjectType;
|
||||
|
||||
private ICondition[][] m_Conditions;
|
||||
|
||||
private IConditional[] m_Conditionals;
|
||||
|
||||
public Type Type => m_ObjectType;
|
||||
public Type Type { get; }
|
||||
|
||||
public bool IsItem => ( m_ObjectType == null || m_ObjectType == typeofItem || m_ObjectType.IsSubclassOf( typeofItem ) );
|
||||
public bool IsItem => ( Type == null || Type == typeofItem || Type.IsSubclassOf( typeofItem ) );
|
||||
|
||||
public bool IsMobile => ( m_ObjectType == null || m_ObjectType == typeofMobile || m_ObjectType.IsSubclassOf( typeofMobile ) );
|
||||
public bool IsMobile => ( Type == null || Type == typeofMobile || Type.IsSubclassOf( typeofMobile ) );
|
||||
|
||||
public static readonly ObjectConditional Empty = new ObjectConditional( null, null );
|
||||
|
||||
|
|
@ -33,12 +31,12 @@ namespace Server.Commands.Generic
|
|||
m_Conditionals = new IConditional[m_Conditions.Length];
|
||||
|
||||
for ( int i = 0; i < m_Conditionals.Length; ++i )
|
||||
m_Conditionals[i] = ConditionalCompiler.Compile( emitter, m_ObjectType, m_Conditions[i], i );
|
||||
m_Conditionals[i] = ConditionalCompiler.Compile( emitter, Type, m_Conditions[i], i );
|
||||
}
|
||||
|
||||
public bool CheckCondition( object obj )
|
||||
{
|
||||
if ( m_ObjectType == null )
|
||||
if ( Type == null )
|
||||
return true; // null type means no condition
|
||||
|
||||
if ( !HasCompiled )
|
||||
|
|
@ -243,7 +241,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public ObjectConditional( Type objectType, ICondition[][] conditions )
|
||||
{
|
||||
m_ObjectType = objectType;
|
||||
Type = objectType;
|
||||
m_Conditions = conditions;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public class RangeCommandImplementor : BaseCommandImplementor
|
||||
{
|
||||
private static RangeCommandImplementor m_Instance;
|
||||
|
||||
public static RangeCommandImplementor Instance => m_Instance;
|
||||
public static RangeCommandImplementor Instance { get; private set; }
|
||||
|
||||
public RangeCommandImplementor()
|
||||
{
|
||||
|
|
@ -15,7 +13,7 @@ namespace Server.Commands.Generic
|
|||
Usage = "Range <range> <command> [condition]";
|
||||
Description = "Invokes the command on all appropriate objects within a specified range of you. Optional condition arguments can further restrict the set of objects.";
|
||||
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public override void Execute( CommandEventArgs e )
|
||||
|
|
|
|||
|
|
@ -12,12 +12,9 @@ namespace Server.Commands
|
|||
{
|
||||
public class HelpInfo
|
||||
{
|
||||
public static Dictionary<string, CommandInfo> HelpInfos { get; } = new Dictionary<string, CommandInfo>();
|
||||
|
||||
private static Dictionary<string, CommandInfo> m_HelpInfos = new Dictionary<string, CommandInfo>();
|
||||
private static List<CommandInfo> m_SortedHelpInfo = new List<CommandInfo>(); //No need for SortedList cause it's only sorted once at creation...
|
||||
|
||||
public static Dictionary<string, CommandInfo> HelpInfos => m_HelpInfos;
|
||||
public static List<CommandInfo> SortedHelpInfo => m_SortedHelpInfo;
|
||||
public static List<CommandInfo> SortedHelpInfo { get; private set; } = new List<CommandInfo>();
|
||||
|
||||
[CallPriority( 100 )]
|
||||
public static void Initialize()
|
||||
|
|
@ -34,7 +31,7 @@ namespace Server.Commands
|
|||
if ( e.Length > 0 )
|
||||
{
|
||||
string arg = e.GetString( 0 ).ToLower();
|
||||
if (m_HelpInfos.TryGetValue( arg, out CommandInfo c ))
|
||||
if (HelpInfos.TryGetValue( arg, out CommandInfo c ))
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
|
||||
|
|
@ -213,12 +210,12 @@ namespace Server.Commands
|
|||
|
||||
list.Sort( new CommandInfoSorter() );
|
||||
|
||||
m_SortedHelpInfo = list;
|
||||
SortedHelpInfo = list;
|
||||
|
||||
foreach( CommandInfo c in m_SortedHelpInfo )
|
||||
foreach( CommandInfo c in SortedHelpInfo )
|
||||
{
|
||||
if ( !m_HelpInfos.ContainsKey( c.Name.ToLower() ) )
|
||||
m_HelpInfos.Add( c.Name.ToLower(), c );
|
||||
if ( !HelpInfos.ContainsKey( c.Name.ToLower() ) )
|
||||
HelpInfos.Add( c.Name.ToLower(), c );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +235,7 @@ namespace Server.Commands
|
|||
{
|
||||
m_List = new List<CommandInfo>();
|
||||
|
||||
foreach( CommandInfo c in m_SortedHelpInfo )
|
||||
foreach( CommandInfo c in SortedHelpInfo )
|
||||
{
|
||||
if ( from.AccessLevel >= c.AccessLevel )
|
||||
m_List.Add( c );
|
||||
|
|
@ -311,7 +308,7 @@ namespace Server.Commands
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
if ( (m_Page + 1) * EntriesPerPage < m_SortedHelpInfo.Count )
|
||||
if ( (m_Page + 1) * EntriesPerPage < SortedHelpInfo.Count )
|
||||
m.SendGump( new CommandListGump( m_Page + 1, m, m_List ) );
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,9 @@ namespace Server.Commands
|
|||
{
|
||||
public class CommandLogging
|
||||
{
|
||||
private static StreamWriter m_Output;
|
||||
private static bool m_Enabled = true;
|
||||
public static bool Enabled { get; set; } = true;
|
||||
|
||||
public static bool Enabled{ get => m_Enabled;
|
||||
set => m_Enabled = value;
|
||||
}
|
||||
|
||||
public static StreamWriter Output => m_Output;
|
||||
public static StreamWriter Output { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -29,13 +24,13 @@ namespace Server.Commands
|
|||
|
||||
try
|
||||
{
|
||||
m_Output = new StreamWriter( Path.Combine( directory, $"{DateTime.UtcNow.ToLongDateString()}.log"), true );
|
||||
Output = new StreamWriter( Path.Combine( directory, $"{DateTime.UtcNow.ToLongDateString()}.log"), true );
|
||||
|
||||
m_Output.AutoFlush = true;
|
||||
Output.AutoFlush = true;
|
||||
|
||||
m_Output.WriteLine( "##############################" );
|
||||
m_Output.WriteLine( "Log started on {0}", DateTime.UtcNow );
|
||||
m_Output.WriteLine();
|
||||
Output.WriteLine( "##############################" );
|
||||
Output.WriteLine( "Log started on {0}", DateTime.UtcNow );
|
||||
Output.WriteLine();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -61,7 +56,7 @@ namespace Server.Commands
|
|||
|
||||
public static void WriteLine( Mobile from, string format, params object[] args )
|
||||
{
|
||||
if ( !m_Enabled )
|
||||
if ( !Enabled )
|
||||
return;
|
||||
|
||||
WriteLine( from, string.Format( format, args ) );
|
||||
|
|
@ -69,12 +64,12 @@ namespace Server.Commands
|
|||
|
||||
public static void WriteLine( Mobile from, string text )
|
||||
{
|
||||
if ( !m_Enabled )
|
||||
if ( !Enabled )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
m_Output.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text );
|
||||
Output.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text );
|
||||
|
||||
string path = Core.BaseDirectory;
|
||||
|
||||
|
|
|
|||
|
|
@ -686,16 +686,13 @@ namespace Server
|
|||
|
||||
public sealed class Property
|
||||
{
|
||||
private string m_Binding;
|
||||
|
||||
private PropertyInfo[] m_Chain;
|
||||
private PropertyAccess m_Access;
|
||||
|
||||
public string Binding => m_Binding;
|
||||
public string Binding { get; }
|
||||
|
||||
public bool IsBound => ( m_Chain != null );
|
||||
|
||||
public PropertyAccess Access => m_Access;
|
||||
public PropertyAccess Access { get; private set; }
|
||||
|
||||
public PropertyInfo[] Chain
|
||||
{
|
||||
|
|
@ -730,7 +727,7 @@ namespace Server
|
|||
|
||||
bool isFinal = ( i == ( m_Chain.Length - 1 ) );
|
||||
|
||||
PropertyAccess access = m_Access;
|
||||
PropertyAccess access = Access;
|
||||
|
||||
if ( !isFinal )
|
||||
access |= PropertyAccess.Read;
|
||||
|
|
@ -755,7 +752,7 @@ namespace Server
|
|||
if ( IsBound )
|
||||
throw new AlreadyBoundException( this );
|
||||
|
||||
string[] split = m_Binding.Split( '.' );
|
||||
string[] split = Binding.Split( '.' );
|
||||
|
||||
PropertyInfo[] chain = new PropertyInfo[split.Length];
|
||||
|
||||
|
|
@ -782,13 +779,13 @@ namespace Server
|
|||
throw new ReadOnlyException( this );
|
||||
}
|
||||
|
||||
m_Access = desiredAccess;
|
||||
Access = desiredAccess;
|
||||
m_Chain = chain;
|
||||
}
|
||||
|
||||
public Property( string binding )
|
||||
{
|
||||
m_Binding = binding;
|
||||
Binding = binding;
|
||||
}
|
||||
|
||||
public Property( PropertyInfo[] chain )
|
||||
|
|
@ -799,7 +796,7 @@ namespace Server
|
|||
public override string ToString()
|
||||
{
|
||||
if ( !IsBound )
|
||||
return m_Binding;
|
||||
return Binding;
|
||||
|
||||
string[] toJoin = new string[m_Chain.Length];
|
||||
|
||||
|
|
|
|||
|
|
@ -2,44 +2,23 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BOBFilter
|
||||
{
|
||||
private int m_Type;
|
||||
private int m_Quality;
|
||||
private int m_Material;
|
||||
private int m_Quantity;
|
||||
|
||||
public bool IsDefault => ( m_Type == 0 && m_Quality == 0 && m_Material == 0 && m_Quantity == 0 );
|
||||
public bool IsDefault => ( Type == 0 && Quality == 0 && Material == 0 && Quantity == 0 );
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_Type = 0;
|
||||
m_Quality = 0;
|
||||
m_Material = 0;
|
||||
m_Quantity = 0;
|
||||
Type = 0;
|
||||
Quality = 0;
|
||||
Material = 0;
|
||||
Quantity = 0;
|
||||
}
|
||||
|
||||
public int Type
|
||||
{
|
||||
get => m_Type;
|
||||
set => m_Type = value;
|
||||
}
|
||||
public int Type { get; set; }
|
||||
|
||||
public int Quality
|
||||
{
|
||||
get => m_Quality;
|
||||
set => m_Quality = value;
|
||||
}
|
||||
public int Quality { get; set; }
|
||||
|
||||
public int Material
|
||||
{
|
||||
get => m_Material;
|
||||
set => m_Material = value;
|
||||
}
|
||||
public int Material { get; set; }
|
||||
|
||||
public int Quantity
|
||||
{
|
||||
get => m_Quantity;
|
||||
set => m_Quantity = value;
|
||||
}
|
||||
public int Quantity { get; set; }
|
||||
|
||||
public BOBFilter()
|
||||
{
|
||||
|
|
@ -53,10 +32,10 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Type = reader.ReadEncodedInt();
|
||||
m_Quality = reader.ReadEncodedInt();
|
||||
m_Material = reader.ReadEncodedInt();
|
||||
m_Quantity = reader.ReadEncodedInt();
|
||||
Type = reader.ReadEncodedInt();
|
||||
Quality = reader.ReadEncodedInt();
|
||||
Material = reader.ReadEncodedInt();
|
||||
Quantity = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -73,10 +52,10 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt( 1 ); // version
|
||||
|
||||
writer.WriteEncodedInt( m_Type );
|
||||
writer.WriteEncodedInt( m_Quality );
|
||||
writer.WriteEncodedInt( m_Material );
|
||||
writer.WriteEncodedInt( m_Quantity );
|
||||
writer.WriteEncodedInt( Type );
|
||||
writer.WriteEncodedInt( Quality );
|
||||
writer.WriteEncodedInt( Material );
|
||||
writer.WriteEncodedInt( Quantity );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,30 +2,26 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BOBLargeEntry
|
||||
{
|
||||
private bool m_RequireExceptional;
|
||||
private BODType m_DeedType;
|
||||
private BulkMaterialType m_Material;
|
||||
private int m_AmountMax;
|
||||
private int m_Price;
|
||||
private BOBLargeSubEntry[] m_Entries;
|
||||
public bool RequireExceptional { get; }
|
||||
|
||||
public bool RequireExceptional => m_RequireExceptional;
|
||||
public BODType DeedType => m_DeedType;
|
||||
public BulkMaterialType Material => m_Material;
|
||||
public int AmountMax => m_AmountMax;
|
||||
public int Price{ get => m_Price;
|
||||
set => m_Price = value;
|
||||
}
|
||||
public BOBLargeSubEntry[] Entries => m_Entries;
|
||||
public BODType DeedType { get; }
|
||||
|
||||
public BulkMaterialType Material { get; }
|
||||
|
||||
public int AmountMax { get; }
|
||||
|
||||
public int Price { get; set; }
|
||||
|
||||
public BOBLargeSubEntry[] Entries { get; }
|
||||
|
||||
public Item Reconstruct()
|
||||
{
|
||||
LargeBOD bod = null;
|
||||
|
||||
if ( m_DeedType == BODType.Smith )
|
||||
bod = new LargeSmithBOD( m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries() );
|
||||
else if ( m_DeedType == BODType.Tailor )
|
||||
bod = new LargeTailorBOD( m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries() );
|
||||
if ( DeedType == BODType.Smith )
|
||||
bod = new LargeSmithBOD( AmountMax, RequireExceptional, Material, ReconstructEntries() );
|
||||
else if ( DeedType == BODType.Tailor )
|
||||
bod = new LargeTailorBOD( AmountMax, RequireExceptional, Material, ReconstructEntries() );
|
||||
|
||||
for ( int i = 0; bod != null && i < bod.Entries.Length; ++i )
|
||||
bod.Entries[i].Owner = bod;
|
||||
|
|
@ -35,12 +31,12 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
private LargeBulkEntry[] ReconstructEntries()
|
||||
{
|
||||
LargeBulkEntry[] entries = new LargeBulkEntry[m_Entries.Length];
|
||||
LargeBulkEntry[] entries = new LargeBulkEntry[Entries.Length];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
for ( int i = 0; i < Entries.Length; ++i )
|
||||
{
|
||||
entries[i] = new LargeBulkEntry( null, new SmallBulkEntry( m_Entries[i].ItemType, m_Entries[i].Number, m_Entries[i].Graphic ) );
|
||||
entries[i].Amount = m_Entries[i].AmountCur;
|
||||
entries[i] = new LargeBulkEntry( null, new SmallBulkEntry( Entries[i].ItemType, Entries[i].Number, Entries[i].Graphic ) );
|
||||
entries[i].Amount = Entries[i].AmountCur;
|
||||
}
|
||||
|
||||
return entries;
|
||||
|
|
@ -48,20 +44,20 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public BOBLargeEntry( LargeBOD bod )
|
||||
{
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
if ( bod is LargeTailorBOD )
|
||||
m_DeedType = BODType.Tailor;
|
||||
DeedType = BODType.Tailor;
|
||||
else if ( bod is LargeSmithBOD )
|
||||
m_DeedType = BODType.Smith;
|
||||
DeedType = BODType.Smith;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
Material = bod.Material;
|
||||
AmountMax = bod.AmountMax;
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
||||
Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i] = new BOBLargeSubEntry( bod.Entries[i] );
|
||||
for ( int i = 0; i < Entries.Length; ++i )
|
||||
Entries[i] = new BOBLargeSubEntry( bod.Entries[i] );
|
||||
}
|
||||
|
||||
public BOBLargeEntry( GenericReader reader )
|
||||
|
|
@ -72,18 +68,18 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
AmountMax = reader.ReadEncodedInt();
|
||||
Price = reader.ReadEncodedInt();
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i] = new BOBLargeSubEntry( reader );
|
||||
for ( int i = 0; i < Entries.Length; ++i )
|
||||
Entries[i] = new BOBLargeSubEntry( reader );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -94,17 +90,17 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( (bool) m_RequireExceptional );
|
||||
writer.Write( (bool) RequireExceptional );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_DeedType );
|
||||
writer.WriteEncodedInt( (int) m_Material );
|
||||
writer.WriteEncodedInt( (int) m_AmountMax );
|
||||
writer.WriteEncodedInt( (int) m_Price );
|
||||
writer.WriteEncodedInt( (int) DeedType );
|
||||
writer.WriteEncodedInt( (int) Material );
|
||||
writer.WriteEncodedInt( (int) AmountMax );
|
||||
writer.WriteEncodedInt( (int) Price );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Length );
|
||||
writer.WriteEncodedInt( (int) Entries.Length );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i].Serialize( writer );
|
||||
for ( int i = 0; i < Entries.Length; ++i )
|
||||
Entries[i].Serialize( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,22 +4,20 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BOBLargeSubEntry
|
||||
{
|
||||
private Type m_ItemType;
|
||||
private int m_AmountCur;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
public Type ItemType { get; }
|
||||
|
||||
public Type ItemType => m_ItemType;
|
||||
public int AmountCur => m_AmountCur;
|
||||
public int Number => m_Number;
|
||||
public int Graphic => m_Graphic;
|
||||
public int AmountCur { get; }
|
||||
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic { get; }
|
||||
|
||||
public BOBLargeSubEntry( LargeBulkEntry lbe )
|
||||
{
|
||||
m_ItemType = lbe.Details.Type;
|
||||
m_AmountCur = lbe.Amount;
|
||||
m_Number = lbe.Details.Number;
|
||||
m_Graphic = lbe.Details.Graphic;
|
||||
ItemType = lbe.Details.Type;
|
||||
AmountCur = lbe.Amount;
|
||||
Number = lbe.Details.Number;
|
||||
Graphic = lbe.Details.Graphic;
|
||||
}
|
||||
|
||||
public BOBLargeSubEntry( GenericReader reader )
|
||||
|
|
@ -33,11 +31,11 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
Graphic = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -48,11 +46,11 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_ItemType == null ? null : m_ItemType.FullName );
|
||||
writer.Write( ItemType == null ? null : ItemType.FullName );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_AmountCur );
|
||||
writer.WriteEncodedInt( (int) m_Number );
|
||||
writer.WriteEncodedInt( (int) m_Graphic );
|
||||
writer.WriteEncodedInt( (int) AmountCur );
|
||||
writer.WriteEncodedInt( (int) Number );
|
||||
writer.WriteEncodedInt( (int) Graphic );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,54 +4,51 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BOBSmallEntry
|
||||
{
|
||||
private Type m_ItemType;
|
||||
private bool m_RequireExceptional;
|
||||
private BODType m_DeedType;
|
||||
private BulkMaterialType m_Material;
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private int m_Price;
|
||||
public Type ItemType { get; }
|
||||
|
||||
public Type ItemType => m_ItemType;
|
||||
public bool RequireExceptional => m_RequireExceptional;
|
||||
public BODType DeedType => m_DeedType;
|
||||
public BulkMaterialType Material => m_Material;
|
||||
public int AmountCur => m_AmountCur;
|
||||
public int AmountMax => m_AmountMax;
|
||||
public int Number => m_Number;
|
||||
public int Graphic => m_Graphic;
|
||||
public int Price{ get => m_Price;
|
||||
set => m_Price = value;
|
||||
}
|
||||
public bool RequireExceptional { get; }
|
||||
|
||||
public BODType DeedType { get; }
|
||||
|
||||
public BulkMaterialType Material { get; }
|
||||
|
||||
public int AmountCur { get; }
|
||||
|
||||
public int AmountMax { get; }
|
||||
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic { get; }
|
||||
|
||||
public int Price { get; set; }
|
||||
|
||||
public Item Reconstruct()
|
||||
{
|
||||
SmallBOD bod = null;
|
||||
|
||||
if ( m_DeedType == BODType.Smith )
|
||||
bod = new SmallSmithBOD( m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material );
|
||||
else if ( m_DeedType == BODType.Tailor )
|
||||
bod = new SmallTailorBOD( m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material );
|
||||
if ( DeedType == BODType.Smith )
|
||||
bod = new SmallSmithBOD( AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material );
|
||||
else if ( DeedType == BODType.Tailor )
|
||||
bod = new SmallTailorBOD( AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material );
|
||||
|
||||
return bod;
|
||||
}
|
||||
|
||||
public BOBSmallEntry( SmallBOD bod )
|
||||
{
|
||||
m_ItemType = bod.Type;
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
ItemType = bod.Type;
|
||||
RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
if ( bod is SmallTailorBOD )
|
||||
m_DeedType = BODType.Tailor;
|
||||
DeedType = BODType.Tailor;
|
||||
else if ( bod is SmallSmithBOD )
|
||||
m_DeedType = BODType.Smith;
|
||||
DeedType = BODType.Smith;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountCur = bod.AmountCur;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
m_Number = bod.Number;
|
||||
m_Graphic = bod.Graphic;
|
||||
Material = bod.Material;
|
||||
AmountCur = bod.AmountCur;
|
||||
AmountMax = bod.AmountMax;
|
||||
Number = bod.Number;
|
||||
Graphic = bod.Graphic;
|
||||
}
|
||||
|
||||
public BOBSmallEntry( GenericReader reader )
|
||||
|
|
@ -65,18 +62,18 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
AmountMax = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
Graphic = reader.ReadEncodedInt();
|
||||
Price = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -87,17 +84,17 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_ItemType == null ? null : m_ItemType.FullName );
|
||||
writer.Write( ItemType == null ? null : ItemType.FullName );
|
||||
|
||||
writer.Write( (bool) m_RequireExceptional );
|
||||
writer.Write( (bool) RequireExceptional );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_DeedType );
|
||||
writer.WriteEncodedInt( (int) m_Material );
|
||||
writer.WriteEncodedInt( (int) m_AmountCur );
|
||||
writer.WriteEncodedInt( (int) m_AmountMax );
|
||||
writer.WriteEncodedInt( (int) m_Number );
|
||||
writer.WriteEncodedInt( (int) m_Graphic );
|
||||
writer.WriteEncodedInt( (int) m_Price );
|
||||
writer.WriteEncodedInt( (int) DeedType );
|
||||
writer.WriteEncodedInt( (int) Material );
|
||||
writer.WriteEncodedInt( (int) AmountCur );
|
||||
writer.WriteEncodedInt( (int) AmountMax );
|
||||
writer.WriteEncodedInt( (int) Number );
|
||||
writer.WriteEncodedInt( (int) Graphic );
|
||||
writer.WriteEncodedInt( (int) Price );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,11 +12,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BulkOrderBook : Item, ISecurable
|
||||
{
|
||||
private ArrayList m_Entries;
|
||||
private BOBFilter m_Filter;
|
||||
private string m_BookName;
|
||||
private SecureLevel m_Level;
|
||||
private int m_ItemCount;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string BookName
|
||||
|
|
@ -26,21 +22,13 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get => m_Level;
|
||||
set => m_Level = value;
|
||||
}
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
public ArrayList Entries => m_Entries;
|
||||
public ArrayList Entries { get; private set; }
|
||||
|
||||
public BOBFilter Filter => m_Filter;
|
||||
public BOBFilter Filter { get; private set; }
|
||||
|
||||
public int ItemCount
|
||||
{
|
||||
get => m_ItemCount;
|
||||
set => m_ItemCount = value;
|
||||
}
|
||||
public int ItemCount { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public BulkOrderBook() : base( 0x2259 )
|
||||
|
|
@ -48,17 +36,17 @@ namespace Server.Engines.BulkOrders
|
|||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_Entries = new ArrayList();
|
||||
m_Filter = new BOBFilter();
|
||||
Entries = new ArrayList();
|
||||
Filter = new BOBFilter();
|
||||
|
||||
m_Level = SecureLevel.CoOwners;
|
||||
Level = SecureLevel.CoOwners;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else if ( m_Entries.Count == 0 )
|
||||
else if ( Entries.Count == 0 )
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
else if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, this ) );
|
||||
|
|
@ -70,7 +58,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
else if ( m_Entries.Count == 0 )
|
||||
else if ( Entries.Count == 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
}
|
||||
|
|
@ -103,18 +91,18 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
|
||||
return false;
|
||||
if ( m_Entries.Count < 500 )
|
||||
if ( Entries.Count < 500 )
|
||||
{
|
||||
if ( dropped is LargeBOD bod )
|
||||
m_Entries.Add( new BOBLargeEntry( bod ) );
|
||||
Entries.Add( new BOBLargeEntry( bod ) );
|
||||
else
|
||||
m_Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
|
||||
InvalidateProperties();
|
||||
|
||||
if ( m_Entries.Count / 5 > m_ItemCount )
|
||||
if ( Entries.Count / 5 > ItemCount )
|
||||
{
|
||||
m_ItemCount++;
|
||||
ItemCount++;
|
||||
InvalidateItems();
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +130,7 @@ namespace Server.Engines.BulkOrders
|
|||
int total = base.GetTotal( type );
|
||||
|
||||
if ( type == TotalType.Items )
|
||||
total = m_ItemCount;
|
||||
total = ItemCount;
|
||||
|
||||
return total;
|
||||
}
|
||||
|
|
@ -175,19 +163,19 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( (int) m_ItemCount );
|
||||
writer.Write( (int) ItemCount );
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
writer.Write( (int) Level );
|
||||
|
||||
writer.Write( m_BookName );
|
||||
|
||||
m_Filter.Serialize( writer );
|
||||
Filter.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Count );
|
||||
writer.WriteEncodedInt( (int) Entries.Count );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
{
|
||||
object obj = m_Entries[i];
|
||||
object obj = Entries[i];
|
||||
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
{
|
||||
|
|
@ -212,23 +200,23 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_ItemCount = reader.ReadInt();
|
||||
ItemCount = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Level = (SecureLevel)reader.ReadInt();
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_BookName = reader.ReadString();
|
||||
|
||||
m_Filter = new BOBFilter( reader );
|
||||
Filter = new BOBFilter( reader );
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Entries = new ArrayList( count );
|
||||
Entries = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
|
|
@ -236,8 +224,8 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
switch ( v )
|
||||
{
|
||||
case 0: m_Entries.Add( new BOBLargeEntry( reader ) ); break;
|
||||
case 1: m_Entries.Add( new BOBSmallEntry( reader ) ); break;
|
||||
case 0: Entries.Add( new BOBLargeEntry( reader ) ); break;
|
||||
case 1: Entries.Add( new BOBSmallEntry( reader ) ); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +238,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1062344, m_Entries.Count.ToString() ); // Deeds in book: ~1_val~
|
||||
list.Add( 1062344, Entries.Count.ToString() ); // Deeds in book: ~1_val~
|
||||
|
||||
if ( m_BookName != null && m_BookName.Length > 0 )
|
||||
list.Add( 1062481, m_BookName ); // Book Name: ~1_val~
|
||||
|
|
@ -260,7 +248,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
LabelTo(from, 1062344, m_Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
|
||||
if (!string.IsNullOrEmpty(m_BookName))
|
||||
LabelTo(from, 1062481, m_BookName);
|
||||
|
|
|
|||
|
|
@ -5,18 +5,15 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class LargeBulkEntry
|
||||
{
|
||||
private LargeBOD m_Owner;
|
||||
private int m_Amount;
|
||||
private SmallBulkEntry m_Details;
|
||||
|
||||
public LargeBOD Owner{ get => m_Owner;
|
||||
set => m_Owner = value;
|
||||
}
|
||||
public LargeBOD Owner { get; set; }
|
||||
|
||||
public int Amount{ get => m_Amount;
|
||||
set{ m_Amount = value;
|
||||
m_Owner?.InvalidateProperties();
|
||||
Owner?.InvalidateProperties();
|
||||
} }
|
||||
public SmallBulkEntry Details => m_Details;
|
||||
public SmallBulkEntry Details { get; }
|
||||
|
||||
public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" );
|
||||
|
||||
|
|
@ -92,13 +89,13 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details )
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Details = details;
|
||||
Owner = owner;
|
||||
Details = details;
|
||||
}
|
||||
|
||||
public LargeBulkEntry( LargeBOD owner, GenericReader reader )
|
||||
{
|
||||
m_Owner = owner;
|
||||
Owner = owner;
|
||||
m_Amount = reader.ReadInt();
|
||||
|
||||
Type realType = null;
|
||||
|
|
@ -108,15 +105,15 @@ namespace Server.Engines.BulkOrders
|
|||
if ( type != null )
|
||||
realType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( m_Details.Type == null ? null : m_Details.Type.FullName );
|
||||
writer.Write( m_Details.Number );
|
||||
writer.Write( m_Details.Graphic );
|
||||
writer.Write( Details.Type == null ? null : Details.Type.FullName );
|
||||
writer.Write( Details.Number );
|
||||
writer.Write( Details.Graphic );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,23 +7,21 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public sealed class RewardType
|
||||
{
|
||||
private int m_Points;
|
||||
private Type[] m_Types;
|
||||
public int Points { get; }
|
||||
|
||||
public int Points => m_Points;
|
||||
public Type[] Types => m_Types;
|
||||
public Type[] Types { get; }
|
||||
|
||||
public RewardType( int points, params Type[] types )
|
||||
{
|
||||
m_Points = points;
|
||||
m_Types = types;
|
||||
Points = points;
|
||||
Types = types;
|
||||
}
|
||||
|
||||
public bool Contains( Type type )
|
||||
{
|
||||
for ( int i = 0; i < m_Types.Length; ++i )
|
||||
for ( int i = 0; i < Types.Length; ++i )
|
||||
{
|
||||
if ( m_Types[i] == type )
|
||||
if ( Types[i] == type )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -33,13 +31,11 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public sealed class RewardItem
|
||||
{
|
||||
private int m_Weight;
|
||||
private ConstructCallback m_Constructor;
|
||||
private int m_Type;
|
||||
public int Weight { get; }
|
||||
|
||||
public int Weight => m_Weight;
|
||||
public ConstructCallback Constructor => m_Constructor;
|
||||
public int Type => m_Type;
|
||||
public ConstructCallback Constructor { get; }
|
||||
|
||||
public int Type { get; }
|
||||
|
||||
public RewardItem( int weight, ConstructCallback constructor ) : this( weight, constructor, 0 )
|
||||
{
|
||||
|
|
@ -47,49 +43,47 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public RewardItem( int weight, ConstructCallback constructor, int type )
|
||||
{
|
||||
m_Weight = weight;
|
||||
m_Constructor = constructor;
|
||||
m_Type = type;
|
||||
Weight = weight;
|
||||
Constructor = constructor;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public Item Construct()
|
||||
{
|
||||
try{ return m_Constructor( m_Type ); }
|
||||
try{ return Constructor( Type ); }
|
||||
catch{ return null; }
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RewardGroup
|
||||
{
|
||||
private int m_Points;
|
||||
private RewardItem[] m_Items;
|
||||
public int Points { get; }
|
||||
|
||||
public int Points => m_Points;
|
||||
public RewardItem[] Items => m_Items;
|
||||
public RewardItem[] Items { get; }
|
||||
|
||||
public RewardGroup( int points, params RewardItem[] items )
|
||||
{
|
||||
m_Points = points;
|
||||
m_Items = items;
|
||||
Points = points;
|
||||
Items = items;
|
||||
}
|
||||
|
||||
public RewardItem AcquireItem()
|
||||
{
|
||||
if ( m_Items.Length == 0 )
|
||||
if ( Items.Length == 0 )
|
||||
return null;
|
||||
if ( m_Items.Length == 1 )
|
||||
return m_Items[0];
|
||||
if ( Items.Length == 1 )
|
||||
return Items[0];
|
||||
|
||||
int totalWeight = 0;
|
||||
|
||||
for ( int i = 0; i < m_Items.Length; ++i )
|
||||
totalWeight += m_Items[i].Weight;
|
||||
for ( int i = 0; i < Items.Length; ++i )
|
||||
totalWeight += Items[i].Weight;
|
||||
|
||||
int randomWeight = Utility.Random( totalWeight );
|
||||
|
||||
for ( int i = 0; i < m_Items.Length; ++i )
|
||||
for ( int i = 0; i < Items.Length; ++i )
|
||||
{
|
||||
RewardItem item = m_Items[i];
|
||||
RewardItem item = Items[i];
|
||||
|
||||
if ( randomWeight < item.Weight )
|
||||
return item;
|
||||
|
|
@ -103,11 +97,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public abstract class RewardCalculator
|
||||
{
|
||||
private RewardGroup[] m_Groups;
|
||||
|
||||
public RewardGroup[] Groups{ get => m_Groups;
|
||||
set => m_Groups = value;
|
||||
}
|
||||
public RewardGroup[] Groups { get; set; }
|
||||
|
||||
public abstract int ComputePoints( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type );
|
||||
public abstract int ComputeGold( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type );
|
||||
|
|
@ -148,15 +138,15 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public virtual RewardGroup LookupRewards( int points )
|
||||
{
|
||||
for ( int i = m_Groups.Length - 1; i >= 1; --i )
|
||||
for ( int i = Groups.Length - 1; i >= 1; --i )
|
||||
{
|
||||
RewardGroup group = m_Groups[i];
|
||||
RewardGroup group = Groups[i];
|
||||
|
||||
if ( points >= group.Points )
|
||||
return group;
|
||||
}
|
||||
|
||||
return m_Groups[0];
|
||||
return Groups[0];
|
||||
}
|
||||
|
||||
public virtual int LookupTypePoints( RewardType[] types, Type type )
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ namespace Server.Engines.BulkOrders
|
|||
public abstract class SmallBOD : Item
|
||||
{
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
|
||||
|
|
@ -24,18 +22,14 @@ namespace Server.Engines.BulkOrders
|
|||
set{ m_AmountMax = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Type Type{ get => m_Type;
|
||||
set => m_Type = value;
|
||||
}
|
||||
public Type Type { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Number{ get => m_Number;
|
||||
set{ m_Number = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Graphic{ get => m_Graphic;
|
||||
set => m_Graphic = value;
|
||||
}
|
||||
public int Graphic { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RequireExceptional{ get => m_RequireExceptional;
|
||||
|
|
@ -58,9 +52,9 @@ namespace Server.Engines.BulkOrders
|
|||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_Type = type;
|
||||
Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
Graphic = graphic;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
}
|
||||
|
|
@ -182,7 +176,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) )
|
||||
else if ( Type == null || (objectType != Type && !objectType.IsSubclassOf( Type )) || (!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045169 ); // The item is not in the request.
|
||||
}
|
||||
|
|
@ -249,9 +243,9 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
writer.Write( m_AmountCur );
|
||||
writer.Write( m_AmountMax );
|
||||
writer.Write( m_Type == null ? null : m_Type.FullName );
|
||||
writer.Write( Type == null ? null : Type.FullName );
|
||||
writer.Write( m_Number );
|
||||
writer.Write( m_Graphic );
|
||||
writer.Write( Graphic );
|
||||
writer.Write( m_RequireExceptional );
|
||||
writer.Write( (int) m_Material );
|
||||
}
|
||||
|
|
@ -272,10 +266,10 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_Type = ScriptCompiler.FindTypeByFullName( type );
|
||||
Type = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_Number = reader.ReadInt();
|
||||
m_Graphic = reader.ReadInt();
|
||||
Graphic = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,19 +6,17 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class SmallBulkEntry
|
||||
{
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
public Type Type { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public int Number => m_Number;
|
||||
public int Graphic => m_Graphic;
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic { get; }
|
||||
|
||||
public SmallBulkEntry( Type type, int number, int graphic )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" );
|
||||
|
|
|
|||
|
|
@ -6,12 +6,11 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
public class ChampionSkullBrazier : AddonComponent
|
||||
{
|
||||
private ChampionSkullPlatform m_Platform;
|
||||
private ChampionSkullType m_Type;
|
||||
private Item m_Skull;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ChampionSkullPlatform Platform => m_Platform;
|
||||
public ChampionSkullPlatform Platform { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ChampionSkullType Type{ get => m_Type;
|
||||
|
|
@ -20,7 +19,7 @@ namespace Server.Engines.CannedEvil
|
|||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Skull{ get => m_Skull;
|
||||
set{ m_Skull = value;
|
||||
m_Platform?.Validate();
|
||||
Platform?.Validate();
|
||||
} }
|
||||
|
||||
public override int LabelNumber => 1049489 + (int)m_Type;
|
||||
|
|
@ -30,7 +29,7 @@ namespace Server.Engines.CannedEvil
|
|||
Hue = 0x455;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
m_Platform = platform;
|
||||
Platform = platform;
|
||||
m_Type = type;
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
m_Platform?.Validate();
|
||||
Platform?.Validate();
|
||||
|
||||
BeginSacrifice( from );
|
||||
}
|
||||
|
|
@ -138,7 +137,7 @@ namespace Server.Engines.CannedEvil
|
|||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (int) m_Type );
|
||||
writer.Write( m_Platform );
|
||||
writer.Write( Platform );
|
||||
writer.Write( m_Skull );
|
||||
}
|
||||
|
||||
|
|
@ -153,10 +152,10 @@ namespace Server.Engines.CannedEvil
|
|||
case 0:
|
||||
{
|
||||
m_Type = (ChampionSkullType)reader.ReadInt();
|
||||
m_Platform = reader.ReadItem() as ChampionSkullPlatform;
|
||||
Platform = reader.ReadItem() as ChampionSkullPlatform;
|
||||
m_Skull = reader.ReadItem();
|
||||
|
||||
if ( m_Platform == null )
|
||||
if ( Platform == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ namespace Server.Engines.CannedEvil
|
|||
private int m_SPawnSzMod;
|
||||
|
||||
private bool m_Active;
|
||||
private bool m_RandomizeType;
|
||||
private ChampionSpawnType m_Type;
|
||||
private List<Mobile> m_Creatures;
|
||||
private List<Item> m_RedSkulls;
|
||||
|
|
@ -26,40 +25,22 @@ namespace Server.Engines.CannedEvil
|
|||
private ChampionPlatform m_Platform;
|
||||
private ChampionAltar m_Altar;
|
||||
private int m_Kills;
|
||||
private Mobile m_Champion;
|
||||
|
||||
//private int m_SpawnRange;
|
||||
private Rectangle2D m_SpawnArea;
|
||||
private ChampionSpawnRegion m_Region;
|
||||
|
||||
private TimeSpan m_ExpireDelay;
|
||||
private DateTime m_ExpireTime;
|
||||
|
||||
private TimeSpan m_RestartDelay;
|
||||
private DateTime m_RestartTime;
|
||||
|
||||
private Timer m_Timer, m_RestartTimer;
|
||||
|
||||
private IdolOfTheChampion m_Idol;
|
||||
|
||||
private bool m_HasBeenAdvanced;
|
||||
private bool m_ConfinedRoaming;
|
||||
|
||||
private Dictionary<Mobile, int> m_DamageEntries;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool ConfinedRoaming
|
||||
{
|
||||
get => m_ConfinedRoaming;
|
||||
set => m_ConfinedRoaming = value;
|
||||
}
|
||||
public bool ConfinedRoaming { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool HasBeenAdvanced
|
||||
{
|
||||
get => m_HasBeenAdvanced;
|
||||
set => m_HasBeenAdvanced = value;
|
||||
}
|
||||
public bool HasBeenAdvanced { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public ChampionSpawn() : base( 0xBD2 )
|
||||
|
|
@ -75,8 +56,8 @@ namespace Server.Engines.CannedEvil
|
|||
m_Altar = new ChampionAltar( this );
|
||||
m_Idol = new IdolOfTheChampion( this );
|
||||
|
||||
m_ExpireDelay = TimeSpan.FromMinutes( 10.0 );
|
||||
m_RestartDelay = TimeSpan.FromMinutes( 10.0 );
|
||||
ExpireDelay = TimeSpan.FromMinutes( 10.0 );
|
||||
RestartDelay = TimeSpan.FromMinutes( 10.0 );
|
||||
|
||||
m_DamageEntries = new Dictionary<Mobile, int>();
|
||||
|
||||
|
|
@ -114,11 +95,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RandomizeType
|
||||
{
|
||||
get => m_RandomizeType;
|
||||
set => m_RandomizeType = value;
|
||||
}
|
||||
public bool RandomizeType { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Kills
|
||||
|
|
@ -144,28 +121,16 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan RestartDelay
|
||||
{
|
||||
get => m_RestartDelay;
|
||||
set => m_RestartDelay = value;
|
||||
}
|
||||
public TimeSpan RestartDelay { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime RestartTime => m_RestartTime;
|
||||
public DateTime RestartTime { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan ExpireDelay
|
||||
{
|
||||
get => m_ExpireDelay;
|
||||
set => m_ExpireDelay = value;
|
||||
}
|
||||
public TimeSpan ExpireDelay { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime ExpireTime
|
||||
{
|
||||
get => m_ExpireTime;
|
||||
set => m_ExpireTime = value;
|
||||
}
|
||||
public DateTime ExpireTime { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ChampionSpawnType Type
|
||||
|
|
@ -194,11 +159,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Champion
|
||||
{
|
||||
get => m_Champion;
|
||||
set => m_Champion = value;
|
||||
}
|
||||
public Mobile Champion { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Level
|
||||
|
|
@ -266,7 +227,7 @@ namespace Server.Engines.CannedEvil
|
|||
return;
|
||||
|
||||
m_Active = true;
|
||||
m_HasBeenAdvanced = false;
|
||||
HasBeenAdvanced = false;
|
||||
|
||||
m_Timer?.Stop();
|
||||
|
||||
|
|
@ -279,7 +240,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
if ( m_Altar != null )
|
||||
{
|
||||
if ( m_Champion != null )
|
||||
if ( Champion != null )
|
||||
m_Altar.Hue = 0x26;
|
||||
else
|
||||
m_Altar.Hue = 0;
|
||||
|
|
@ -295,7 +256,7 @@ namespace Server.Engines.CannedEvil
|
|||
return;
|
||||
|
||||
m_Active = false;
|
||||
m_HasBeenAdvanced = false;
|
||||
HasBeenAdvanced = false;
|
||||
|
||||
m_Timer?.Stop();
|
||||
|
||||
|
|
@ -316,7 +277,7 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
m_RestartTimer?.Stop();
|
||||
|
||||
m_RestartTime = DateTime.UtcNow + ts;
|
||||
RestartTime = DateTime.UtcNow + ts;
|
||||
|
||||
m_RestartTimer = new RestartTimer( this, ts );
|
||||
m_RestartTimer.Start();
|
||||
|
|
@ -336,7 +297,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
}
|
||||
|
||||
m_HasBeenAdvanced = false;
|
||||
HasBeenAdvanced = false;
|
||||
|
||||
Start();
|
||||
}
|
||||
|
|
@ -414,13 +375,13 @@ namespace Server.Engines.CannedEvil
|
|||
if ( !m_Active || Deleted )
|
||||
return;
|
||||
|
||||
if ( m_Champion != null )
|
||||
if ( Champion != null )
|
||||
{
|
||||
if ( m_Champion.Deleted )
|
||||
if ( Champion.Deleted )
|
||||
{
|
||||
RegisterDamageTo( m_Champion );
|
||||
RegisterDamageTo( Champion );
|
||||
|
||||
if ( m_Champion is BaseChampion champion )
|
||||
if ( Champion is BaseChampion champion )
|
||||
AwardArtifact( champion.GetArtifact() );
|
||||
|
||||
m_DamageEntries.Clear();
|
||||
|
|
@ -438,10 +399,10 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
}
|
||||
|
||||
m_Champion = null;
|
||||
Champion = null;
|
||||
Stop();
|
||||
|
||||
BeginRestart( m_RestartDelay );
|
||||
BeginRestart( RestartDelay );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -543,7 +504,7 @@ namespace Server.Engines.CannedEvil
|
|||
else if ( p > 0 )
|
||||
SetWhiteSkullCount( p / 20 );
|
||||
|
||||
if ( DateTime.UtcNow >= m_ExpireTime )
|
||||
if ( DateTime.UtcNow >= ExpireTime )
|
||||
Expire();
|
||||
|
||||
Respawn();
|
||||
|
|
@ -552,7 +513,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public void AdvanceLevel()
|
||||
{
|
||||
m_ExpireTime = DateTime.UtcNow + m_ExpireDelay;
|
||||
ExpireTime = DateTime.UtcNow + ExpireDelay;
|
||||
|
||||
if ( Level < 16 )
|
||||
{
|
||||
|
|
@ -588,16 +549,16 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
try
|
||||
{
|
||||
m_Champion = Activator.CreateInstance( ChampionSpawnInfo.GetInfo( m_Type ).Champion ) as Mobile;
|
||||
Champion = Activator.CreateInstance( ChampionSpawnInfo.GetInfo( m_Type ).Champion ) as Mobile;
|
||||
}
|
||||
catch { }
|
||||
|
||||
m_Champion?.MoveToWorld( new Point3D( X, Y, Z - 15 ), Map );
|
||||
Champion?.MoveToWorld( new Point3D( X, Y, Z - 15 ), Map );
|
||||
}
|
||||
|
||||
public void Respawn()
|
||||
{
|
||||
if ( !m_Active || Deleted || m_Champion != null )
|
||||
if ( !m_Active || Deleted || Champion != null )
|
||||
return;
|
||||
|
||||
while( m_Creatures.Count < ( ( m_SPawnSzMod * ( 200 / 12 ) ) ) - ( GetSubLevel() * ( m_SPawnSzMod * ( 40 / 12 ) ) ) )
|
||||
|
|
@ -619,7 +580,7 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
bc.Tamable = false;
|
||||
|
||||
if ( !m_ConfinedRoaming )
|
||||
if ( !ConfinedRoaming )
|
||||
{
|
||||
bc.Home = Location;
|
||||
bc.RangeHome = (int)(Math.Sqrt( m_SpawnArea.Width * m_SpawnArea.Width + m_SpawnArea.Height * m_SpawnArea.Height )/2);
|
||||
|
|
@ -752,7 +713,7 @@ namespace Server.Engines.CannedEvil
|
|||
SetWhiteSkullCount( 0 );
|
||||
}
|
||||
|
||||
m_ExpireTime = DateTime.UtcNow + m_ExpireDelay;
|
||||
ExpireTime = DateTime.UtcNow + ExpireDelay;
|
||||
}
|
||||
|
||||
public Point3D GetRedSkullLocation( int index )
|
||||
|
|
@ -935,8 +896,8 @@ namespace Server.Engines.CannedEvil
|
|||
m_Creatures.Clear();
|
||||
}
|
||||
|
||||
if ( m_Champion != null && !m_Champion.Player )
|
||||
m_Champion.Delete();
|
||||
if ( Champion != null && !Champion.Player )
|
||||
Champion.Delete();
|
||||
|
||||
Stop();
|
||||
|
||||
|
|
@ -1047,12 +1008,12 @@ namespace Server.Engines.CannedEvil
|
|||
writer.Write( kvp.Value );
|
||||
}
|
||||
|
||||
writer.Write( m_ConfinedRoaming );
|
||||
writer.Write( ConfinedRoaming );
|
||||
writer.WriteItem<IdolOfTheChampion>( m_Idol );
|
||||
writer.Write( m_HasBeenAdvanced );
|
||||
writer.Write( HasBeenAdvanced );
|
||||
writer.Write( m_SpawnArea );
|
||||
|
||||
writer.Write( m_RandomizeType );
|
||||
writer.Write( RandomizeType );
|
||||
|
||||
// writer.Write( m_SpawnRange );
|
||||
writer.Write( m_Kills );
|
||||
|
|
@ -1064,15 +1025,15 @@ namespace Server.Engines.CannedEvil
|
|||
writer.Write( m_WhiteSkulls, true );
|
||||
writer.WriteItem<ChampionPlatform>( m_Platform );
|
||||
writer.WriteItem<ChampionAltar>( m_Altar );
|
||||
writer.Write( m_ExpireDelay );
|
||||
writer.WriteDeltaTime( m_ExpireTime );
|
||||
writer.Write( m_Champion );
|
||||
writer.Write( m_RestartDelay );
|
||||
writer.Write( ExpireDelay );
|
||||
writer.WriteDeltaTime( ExpireTime );
|
||||
writer.Write( Champion );
|
||||
writer.Write( RestartDelay );
|
||||
|
||||
writer.Write( m_RestartTimer != null );
|
||||
|
||||
if ( m_RestartTimer != null )
|
||||
writer.WriteDeltaTime( m_RestartTime );
|
||||
writer.WriteDeltaTime( RestartTime );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -1110,9 +1071,9 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
case 4:
|
||||
{
|
||||
m_ConfinedRoaming = reader.ReadBool();
|
||||
ConfinedRoaming = reader.ReadBool();
|
||||
m_Idol = reader.ReadItem<IdolOfTheChampion>();
|
||||
m_HasBeenAdvanced = reader.ReadBool();
|
||||
HasBeenAdvanced = reader.ReadBool();
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
|
|
@ -1124,7 +1085,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
m_RandomizeType = reader.ReadBool();
|
||||
RandomizeType = reader.ReadBool();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
|
|
@ -1153,15 +1114,15 @@ namespace Server.Engines.CannedEvil
|
|||
m_WhiteSkulls = reader.ReadStrongItemList();
|
||||
m_Platform = reader.ReadItem<ChampionPlatform>();
|
||||
m_Altar = reader.ReadItem<ChampionAltar>();
|
||||
m_ExpireDelay = reader.ReadTimeSpan();
|
||||
m_ExpireTime = reader.ReadDeltaTime();
|
||||
m_Champion = reader.ReadMobile();
|
||||
m_RestartDelay = reader.ReadTimeSpan();
|
||||
ExpireDelay = reader.ReadTimeSpan();
|
||||
ExpireTime = reader.ReadDeltaTime();
|
||||
Champion = reader.ReadMobile();
|
||||
RestartDelay = reader.ReadTimeSpan();
|
||||
|
||||
if ( reader.ReadBool() )
|
||||
{
|
||||
m_RestartTime = reader.ReadDeltaTime();
|
||||
BeginRestart( m_RestartTime - DateTime.UtcNow );
|
||||
RestartTime = reader.ReadDeltaTime();
|
||||
BeginRestart( RestartTime - DateTime.UtcNow );
|
||||
}
|
||||
|
||||
if ( version < 4 )
|
||||
|
|
@ -1187,13 +1148,11 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
public override bool YoungProtected => false;
|
||||
|
||||
private ChampionSpawn m_Spawn;
|
||||
|
||||
public ChampionSpawn ChampionSpawn => m_Spawn;
|
||||
public ChampionSpawn ChampionSpawn { get; }
|
||||
|
||||
public ChampionSpawnRegion( ChampionSpawn spawn ) : base( null, spawn.Map, Find( spawn.Location, spawn.Map ), spawn.SpawnArea )
|
||||
{
|
||||
m_Spawn = spawn;
|
||||
ChampionSpawn = spawn;
|
||||
}
|
||||
|
||||
public override bool AllowHousing( Mobile from, Point3D p )
|
||||
|
|
@ -1204,22 +1163,20 @@ namespace Server.Engines.CannedEvil
|
|||
public override void AlterLightLevel( Mobile m, ref int global, ref int personal )
|
||||
{
|
||||
base.AlterLightLevel( m, ref global, ref personal );
|
||||
global = Math.Max( global, 1 + m_Spawn.Level ); //This is a guesstimate. TODO: Verify & get exact values // OSI testing: at 2 red skulls, light = 0x3 ; 1 red = 0x3.; 3 = 8; 9 = 0xD 8 = 0xD 12 = 0x12 10 = 0xD
|
||||
global = Math.Max( global, 1 + ChampionSpawn.Level ); //This is a guesstimate. TODO: Verify & get exact values // OSI testing: at 2 red skulls, light = 0x3 ; 1 red = 0x3.; 3 = 8; 9 = 0xD 8 = 0xD 12 = 0x12 10 = 0xD
|
||||
}
|
||||
}
|
||||
|
||||
public class IdolOfTheChampion : Item
|
||||
{
|
||||
private ChampionSpawn m_Spawn;
|
||||
|
||||
public ChampionSpawn Spawn => m_Spawn;
|
||||
public ChampionSpawn Spawn { get; private set; }
|
||||
|
||||
public override string DefaultName => "Idol of the Champion";
|
||||
|
||||
|
||||
public IdolOfTheChampion( ChampionSpawn spawn ): base( 0x1F18 )
|
||||
{
|
||||
m_Spawn = spawn;
|
||||
Spawn = spawn;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
|
|
@ -1227,7 +1184,7 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
m_Spawn?.Delete();
|
||||
Spawn?.Delete();
|
||||
}
|
||||
|
||||
public IdolOfTheChampion( Serial serial ) : base( serial )
|
||||
|
|
@ -1240,7 +1197,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Spawn );
|
||||
writer.Write( Spawn );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -1253,9 +1210,9 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Spawn = reader.ReadItem() as ChampionSpawn;
|
||||
Spawn = reader.ReadItem() as ChampionSpawn;
|
||||
|
||||
if ( m_Spawn == null )
|
||||
if ( Spawn == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,103 +18,100 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public class ChampionSpawnInfo
|
||||
{
|
||||
private string m_Name;
|
||||
private Type m_Champion;
|
||||
private Type[][] m_SpawnTypes;
|
||||
private string[] m_LevelNames;
|
||||
public string Name { get; }
|
||||
|
||||
public string Name => m_Name;
|
||||
public Type Champion => m_Champion;
|
||||
public Type[][] SpawnTypes => m_SpawnTypes;
|
||||
public string[] LevelNames => m_LevelNames;
|
||||
public Type Champion { get; }
|
||||
|
||||
public Type[][] SpawnTypes { get; }
|
||||
|
||||
public string[] LevelNames { get; }
|
||||
|
||||
public ChampionSpawnInfo( string name, Type champion, string[] levelNames, Type[][] spawnTypes )
|
||||
{
|
||||
m_Name = name;
|
||||
m_Champion = champion;
|
||||
m_LevelNames = levelNames;
|
||||
m_SpawnTypes = spawnTypes;
|
||||
Name = name;
|
||||
Champion = champion;
|
||||
LevelNames = levelNames;
|
||||
SpawnTypes = spawnTypes;
|
||||
}
|
||||
|
||||
public static ChampionSpawnInfo[] Table => m_Table;
|
||||
|
||||
private static readonly ChampionSpawnInfo[] m_Table = {
|
||||
new ChampionSpawnInfo( "Abyss", typeof( Semidar ), new[]{ "Foe", "Assassin", "Conqueror" }, new[] // Abyss
|
||||
{ // Abyss
|
||||
new[]{ typeof( GreaterMongbat ), typeof( Imp ) }, // Level 1
|
||||
new[]{ typeof( Gargoyle ), typeof( Harpy ) }, // Level 2
|
||||
new[]{ typeof( FireGargoyle ), typeof( StoneGargoyle ) }, // Level 3
|
||||
new[]{ typeof( Daemon ), typeof( Succubus ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Arachnid", typeof( Mephitis ), new[]{ "Bane", "Killer", "Vanquisher" }, new[] // Arachnid
|
||||
{ // Arachnid
|
||||
new[]{ typeof( Scorpion ), typeof( GiantSpider ) }, // Level 1
|
||||
new[]{ typeof( TerathanDrone ), typeof( TerathanWarrior ) }, // Level 2
|
||||
new[]{ typeof( DreadSpider ), typeof( TerathanMatriarch ) }, // Level 3
|
||||
new[]{ typeof( PoisonElemental ), typeof( TerathanAvenger ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Cold Blood", typeof( Rikktor ), new[]{ "Blight", "Slayer", "Destroyer" }, new[] // Cold Blood
|
||||
{ // Cold Blood
|
||||
new[]{ typeof( Lizardman ), typeof( Snake ) }, // Level 1
|
||||
new[]{ typeof( LavaLizard ), typeof( OphidianWarrior ) }, // Level 2
|
||||
new[]{ typeof( Drake ), typeof( OphidianArchmage ) }, // Level 3
|
||||
new[]{ typeof( Dragon ), typeof( OphidianKnight ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Forest Lord", typeof( LordOaks ), new[]{ "Enemy", "Curse", "Slaughterer" }, new[] // Forest Lord
|
||||
{ // Forest Lord
|
||||
new[]{ typeof( Pixie ), typeof( ShadowWisp ) }, // Level 1
|
||||
new[]{ typeof( Kirin ), typeof( Wisp ) }, // Level 2
|
||||
new[]{ typeof( Centaur ), typeof( Unicorn ) }, // Level 3
|
||||
new[]{ typeof( EtherealWarrior ), typeof( SerpentineDragon ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Vermin Horde", typeof( Barracoon ), new[]{ "Adversary", "Subjugator", "Eradicator" }, new[] // Vermin Horde
|
||||
{ // Vermin Horde
|
||||
new[]{ typeof( GiantRat ), typeof( Slime ) }, // Level 1
|
||||
new[]{ typeof( DireWolf ), typeof( Ratman ) }, // Level 2
|
||||
new[]{ typeof( HellHound ), typeof( RatmanMage ) }, // Level 3
|
||||
new[]{ typeof( RatmanArcher ), typeof( SilverSerpent ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Unholy Terror", typeof( Neira ), new[]{ "Scourge", "Punisher", "Nemesis" }, new[] // Unholy Terror
|
||||
{ // Unholy Terror
|
||||
(Core.AOS ?
|
||||
public static ChampionSpawnInfo[] Table { get; } =
|
||||
{
|
||||
new ChampionSpawnInfo( "Abyss", typeof( Semidar ), new[]{ "Foe", "Assassin", "Conqueror" }, new[] // Abyss
|
||||
{ // Abyss
|
||||
new[]{ typeof( GreaterMongbat ), typeof( Imp ) }, // Level 1
|
||||
new[]{ typeof( Gargoyle ), typeof( Harpy ) }, // Level 2
|
||||
new[]{ typeof( FireGargoyle ), typeof( StoneGargoyle ) }, // Level 3
|
||||
new[]{ typeof( Daemon ), typeof( Succubus ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Arachnid", typeof( Mephitis ), new[]{ "Bane", "Killer", "Vanquisher" }, new[] // Arachnid
|
||||
{ // Arachnid
|
||||
new[]{ typeof( Scorpion ), typeof( GiantSpider ) }, // Level 1
|
||||
new[]{ typeof( TerathanDrone ), typeof( TerathanWarrior ) }, // Level 2
|
||||
new[]{ typeof( DreadSpider ), typeof( TerathanMatriarch ) }, // Level 3
|
||||
new[]{ typeof( PoisonElemental ), typeof( TerathanAvenger ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Cold Blood", typeof( Rikktor ), new[]{ "Blight", "Slayer", "Destroyer" }, new[] // Cold Blood
|
||||
{ // Cold Blood
|
||||
new[]{ typeof( Lizardman ), typeof( Snake ) }, // Level 1
|
||||
new[]{ typeof( LavaLizard ), typeof( OphidianWarrior ) }, // Level 2
|
||||
new[]{ typeof( Drake ), typeof( OphidianArchmage ) }, // Level 3
|
||||
new[]{ typeof( Dragon ), typeof( OphidianKnight ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Forest Lord", typeof( LordOaks ), new[]{ "Enemy", "Curse", "Slaughterer" }, new[] // Forest Lord
|
||||
{ // Forest Lord
|
||||
new[]{ typeof( Pixie ), typeof( ShadowWisp ) }, // Level 1
|
||||
new[]{ typeof( Kirin ), typeof( Wisp ) }, // Level 2
|
||||
new[]{ typeof( Centaur ), typeof( Unicorn ) }, // Level 3
|
||||
new[]{ typeof( EtherealWarrior ), typeof( SerpentineDragon ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Vermin Horde", typeof( Barracoon ), new[]{ "Adversary", "Subjugator", "Eradicator" }, new[] // Vermin Horde
|
||||
{ // Vermin Horde
|
||||
new[]{ typeof( GiantRat ), typeof( Slime ) }, // Level 1
|
||||
new[]{ typeof( DireWolf ), typeof( Ratman ) }, // Level 2
|
||||
new[]{ typeof( HellHound ), typeof( RatmanMage ) }, // Level 3
|
||||
new[]{ typeof( RatmanArcher ), typeof( SilverSerpent ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Unholy Terror", typeof( Neira ), new[]{ "Scourge", "Punisher", "Nemesis" }, new[] // Unholy Terror
|
||||
{ // Unholy Terror
|
||||
(Core.AOS ?
|
||||
new[]{ typeof( Bogle ), typeof( Ghoul ), typeof( Shade ), typeof( Spectre ), typeof( Wraith ) } // Level 1 (Pre-AoS)
|
||||
: new[]{ typeof( Ghoul ), typeof( Shade ), typeof( Spectre ), typeof( Wraith ) } ), // Level 1
|
||||
|
||||
new[]{ typeof( BoneMagi ), typeof( Mummy ), typeof( SkeletalMage ) }, // Level 2
|
||||
new[]{ typeof( BoneKnight ), typeof( Lich ), typeof( SkeletalKnight ) }, // Level 3
|
||||
new[]{ typeof( LichLord ), typeof( RottingCorpse ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Sleeping Dragon", typeof( Serado ), new[]{ "Rival", "Challenger", "Antagonist" } , new[]
|
||||
{ // Unholy Terror
|
||||
new[]{ typeof( DeathwatchBeetleHatchling ), typeof( Lizardman ) },
|
||||
new[]{ typeof( DeathwatchBeetle ), typeof( Kappa ) },
|
||||
new[]{ typeof( LesserHiryu ), typeof( RevenantLion ) },
|
||||
new[]{ typeof( Hiryu ), typeof( Oni ) }
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Glade", typeof( Twaulo ), new[]{ "Banisher", "Enforcer", "Eradicator" } , new[]
|
||||
{ // Glade
|
||||
new[]{ typeof( Pixie ), typeof( ShadowWisp ) },
|
||||
new[]{ typeof( Centaur ), typeof( MLDryad ) },
|
||||
new[]{ typeof( Satyr ), typeof( CuSidhe ) },
|
||||
new[]{ typeof( FeralTreefellow ), typeof( RagingGrizzlyBear ) }
|
||||
} ),
|
||||
new ChampionSpawnInfo( "The Corrupt", typeof( Ilhenir ), new[]{ "Cleanser", "Expunger", "Depurator" } , new[]
|
||||
{ // Unholy Terror
|
||||
new[]{ typeof( PlagueSpawn ), typeof( Bogling ) },
|
||||
new[]{ typeof( PlagueBeast ), typeof( BogThing ) },
|
||||
new[]{ typeof( PlagueBeastLord ), typeof( InterredGrizzle ) },
|
||||
new[]{ typeof( FetidEssence ), typeof( PestilentBandage ) }
|
||||
} )
|
||||
};
|
||||
new[]{ typeof( BoneMagi ), typeof( Mummy ), typeof( SkeletalMage ) }, // Level 2
|
||||
new[]{ typeof( BoneKnight ), typeof( Lich ), typeof( SkeletalKnight ) }, // Level 3
|
||||
new[]{ typeof( LichLord ), typeof( RottingCorpse ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Sleeping Dragon", typeof( Serado ), new[]{ "Rival", "Challenger", "Antagonist" } , new[]
|
||||
{ // Unholy Terror
|
||||
new[]{ typeof( DeathwatchBeetleHatchling ), typeof( Lizardman ) },
|
||||
new[]{ typeof( DeathwatchBeetle ), typeof( Kappa ) },
|
||||
new[]{ typeof( LesserHiryu ), typeof( RevenantLion ) },
|
||||
new[]{ typeof( Hiryu ), typeof( Oni ) }
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Glade", typeof( Twaulo ), new[]{ "Banisher", "Enforcer", "Eradicator" } , new[]
|
||||
{ // Glade
|
||||
new[]{ typeof( Pixie ), typeof( ShadowWisp ) },
|
||||
new[]{ typeof( Centaur ), typeof( MLDryad ) },
|
||||
new[]{ typeof( Satyr ), typeof( CuSidhe ) },
|
||||
new[]{ typeof( FeralTreefellow ), typeof( RagingGrizzlyBear ) }
|
||||
} ),
|
||||
new ChampionSpawnInfo( "The Corrupt", typeof( Ilhenir ), new[]{ "Cleanser", "Expunger", "Depurator" } , new[]
|
||||
{ // Unholy Terror
|
||||
new[]{ typeof( PlagueSpawn ), typeof( Bogling ) },
|
||||
new[]{ typeof( PlagueBeast ), typeof( BogThing ) },
|
||||
new[]{ typeof( PlagueBeastLord ), typeof( InterredGrizzle ) },
|
||||
new[]{ typeof( FetidEssence ), typeof( PestilentBandage ) }
|
||||
} )
|
||||
};
|
||||
|
||||
public static ChampionSpawnInfo GetInfo( ChampionSpawnType type )
|
||||
{
|
||||
int v = (int)type;
|
||||
|
||||
if ( v < 0 || v >= m_Table.Length )
|
||||
if ( v < 0 || v >= Table.Length )
|
||||
v = 0;
|
||||
|
||||
return m_Table[v];
|
||||
return Table[v];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ namespace Server.Engines.Chat
|
|||
private string m_Password;
|
||||
private List<ChatUser> m_Users, m_Banned, m_Moderators, m_Voices;
|
||||
private bool m_VoiceRestricted;
|
||||
private bool m_AlwaysAvailable;
|
||||
|
||||
public Channel( string name )
|
||||
{
|
||||
|
|
@ -141,7 +140,7 @@ namespace Server.Engines.Chat
|
|||
m_Users.Add( user );
|
||||
user.CurrentChannel = this;
|
||||
|
||||
if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!m_AlwaysAvailable && m_Users.Count == 1) )
|
||||
if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!AlwaysAvailable && m_Users.Count == 1) )
|
||||
AddModerator( user );
|
||||
|
||||
SendUsersTo( user );
|
||||
|
|
@ -165,7 +164,7 @@ namespace Server.Engines.Chat
|
|||
SendCommand( ChatCommand.RemoveUserFromChannel, user, user.Username );
|
||||
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.LeaveChannel );
|
||||
|
||||
if ( m_Users.Count == 0 && !m_AlwaysAvailable )
|
||||
if ( m_Users.Count == 0 && !AlwaysAvailable )
|
||||
RemoveChannel( this );
|
||||
}
|
||||
}
|
||||
|
|
@ -241,11 +240,7 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public bool AlwaysAvailable
|
||||
{
|
||||
get => m_AlwaysAvailable;
|
||||
set => m_AlwaysAvailable = value;
|
||||
}
|
||||
public bool AlwaysAvailable { get; set; }
|
||||
|
||||
public void AddVoiced( ChatUser user )
|
||||
{
|
||||
|
|
@ -441,15 +436,13 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
private static List<Channel> m_Channels = new List<Channel>();
|
||||
|
||||
public static List<Channel> Channels => m_Channels;
|
||||
public static List<Channel> Channels { get; } = new List<Channel>();
|
||||
|
||||
public static void SendChannelsTo( ChatUser user )
|
||||
{
|
||||
for ( int i = 0; i < m_Channels.Count; ++i )
|
||||
for ( int i = 0; i < Channels.Count; ++i )
|
||||
{
|
||||
Channel channel = m_Channels[i];
|
||||
Channel channel = Channels[i];
|
||||
|
||||
if ( !channel.IsBanned( user ) )
|
||||
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.AddChannel, channel.Name, "0" );
|
||||
|
|
@ -468,7 +461,7 @@ namespace Server.Engines.Chat
|
|||
if ( channel == null )
|
||||
{
|
||||
channel = new Channel( name, password );
|
||||
m_Channels.Add( channel );
|
||||
Channels.Add( channel );
|
||||
}
|
||||
|
||||
ChatUser.GlobalSendCommand( ChatCommand.AddChannel, name, "0" ) ;
|
||||
|
|
@ -486,22 +479,22 @@ namespace Server.Engines.Chat
|
|||
if ( channel == null )
|
||||
return;
|
||||
|
||||
if ( m_Channels.Contains( channel ) && channel.m_Users.Count == 0 )
|
||||
if ( Channels.Contains( channel ) && channel.m_Users.Count == 0 )
|
||||
{
|
||||
ChatUser.GlobalSendCommand( ChatCommand.RemoveChannel, channel.Name ) ;
|
||||
|
||||
channel.m_Moderators.Clear();
|
||||
channel.m_Voices.Clear();
|
||||
|
||||
m_Channels.Remove( channel );
|
||||
Channels.Remove( channel );
|
||||
}
|
||||
}
|
||||
|
||||
public static Channel FindChannelByName( string name )
|
||||
{
|
||||
for ( int i = 0; i < m_Channels.Count; ++i )
|
||||
for ( int i = 0; i < Channels.Count; ++i )
|
||||
{
|
||||
Channel channel = m_Channels[i];
|
||||
Channel channel = Channels[i];
|
||||
|
||||
if ( channel.m_Name == name )
|
||||
return channel;
|
||||
|
|
|
|||
|
|
@ -7,13 +7,7 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
public class ChatSystem
|
||||
{
|
||||
private static bool m_Enabled = true;
|
||||
|
||||
public static bool Enabled
|
||||
{
|
||||
get => m_Enabled;
|
||||
set => m_Enabled = value;
|
||||
}
|
||||
public static bool Enabled { get; set; } = true;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -40,7 +34,7 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if ( !m_Enabled )
|
||||
if ( !Enabled )
|
||||
{
|
||||
from.SendMessage( "The chat system has been disabled." );
|
||||
return;
|
||||
|
|
@ -120,7 +114,7 @@ namespace Server.Engines.Chat
|
|||
|
||||
public static void ChatAction( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
if ( !m_Enabled )
|
||||
if ( !Enabled )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
|
|||
|
|
@ -4,19 +4,17 @@ namespace Server.Engines.Chat
|
|||
|
||||
public class ChatActionHandler
|
||||
{
|
||||
private bool m_RequireModerator;
|
||||
private bool m_RequireConference;
|
||||
private OnChatAction m_Callback;
|
||||
public bool RequireModerator { get; }
|
||||
|
||||
public bool RequireModerator => m_RequireModerator;
|
||||
public bool RequireConference => m_RequireConference;
|
||||
public OnChatAction Callback => m_Callback;
|
||||
public bool RequireConference { get; }
|
||||
|
||||
public OnChatAction Callback { get; }
|
||||
|
||||
public ChatActionHandler( bool requireModerator, bool requireConference, OnChatAction callback )
|
||||
{
|
||||
m_RequireModerator = requireModerator;
|
||||
m_RequireConference = requireConference;
|
||||
m_Callback = callback;
|
||||
RequireModerator = requireModerator;
|
||||
RequireConference = requireConference;
|
||||
Callback = callback;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,60 +5,42 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
public class ChatUser
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Channel m_Channel;
|
||||
private bool m_Anonymous;
|
||||
private bool m_IgnorePrivateMessage;
|
||||
private List<ChatUser> m_Ignored, m_Ignoring;
|
||||
|
||||
public ChatUser( Mobile m )
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Ignored = new List<ChatUser>();
|
||||
m_Ignoring = new List<ChatUser>();
|
||||
Mobile = m;
|
||||
Ignored = new List<ChatUser>();
|
||||
Ignoring = new List<ChatUser>();
|
||||
}
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public List<ChatUser> Ignored => m_Ignored;
|
||||
public List<ChatUser> Ignored { get; }
|
||||
|
||||
public List<ChatUser> Ignoring => m_Ignoring;
|
||||
public List<ChatUser> Ignoring { get; }
|
||||
|
||||
public string Username
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Mobile.Account is Account acct )
|
||||
if ( Mobile.Account is Account acct )
|
||||
return acct.GetTag( "ChatName" );
|
||||
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( m_Mobile.Account is Account acct )
|
||||
if ( Mobile.Account is Account acct )
|
||||
acct.SetTag( "ChatName", value );
|
||||
}
|
||||
}
|
||||
|
||||
public Channel CurrentChannel
|
||||
{
|
||||
get => m_Channel;
|
||||
set => m_Channel = value;
|
||||
}
|
||||
public Channel CurrentChannel { get; set; }
|
||||
|
||||
public bool IsOnline => ( m_Mobile.NetState != null );
|
||||
public bool IsOnline => ( Mobile.NetState != null );
|
||||
|
||||
public bool Anonymous
|
||||
{
|
||||
get => m_Anonymous;
|
||||
set => m_Anonymous = value;
|
||||
}
|
||||
public bool Anonymous { get; set; }
|
||||
|
||||
public bool IgnorePrivateMessage
|
||||
{
|
||||
get => m_IgnorePrivateMessage;
|
||||
set => m_IgnorePrivateMessage = value;
|
||||
}
|
||||
public bool IgnorePrivateMessage { get; set; }
|
||||
|
||||
public const char NormalColorCharacter = '0';
|
||||
public const char ModeratorColorCharacter = '1';
|
||||
|
|
@ -66,10 +48,10 @@ namespace Server.Engines.Chat
|
|||
|
||||
public char GetColorCharacter()
|
||||
{
|
||||
if ( m_Channel != null && m_Channel.IsModerator( this ) )
|
||||
if ( CurrentChannel != null && CurrentChannel.IsModerator( this ) )
|
||||
return ModeratorColorCharacter;
|
||||
|
||||
if ( m_Channel != null && m_Channel.IsVoiced( this ) )
|
||||
if ( CurrentChannel != null && CurrentChannel.IsVoiced( this ) )
|
||||
return VoicedColorCharacter;
|
||||
|
||||
return NormalColorCharacter;
|
||||
|
|
@ -96,22 +78,22 @@ namespace Server.Engines.Chat
|
|||
|
||||
public void SendMessage( int number, string param1, string param2 )
|
||||
{
|
||||
if ( m_Mobile.NetState != null )
|
||||
m_Mobile.Send( new ChatMessagePacket( m_Mobile, number, param1, param2 ) );
|
||||
if ( Mobile.NetState != null )
|
||||
Mobile.Send( new ChatMessagePacket( Mobile, number, param1, param2 ) );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, Mobile from, string param1, string param2 )
|
||||
{
|
||||
if ( m_Mobile.NetState != null )
|
||||
m_Mobile.Send( new ChatMessagePacket( from, number, param1, param2 ) );
|
||||
if ( Mobile.NetState != null )
|
||||
Mobile.Send( new ChatMessagePacket( from, number, param1, param2 ) );
|
||||
}
|
||||
|
||||
public bool IsIgnored( ChatUser check )
|
||||
{
|
||||
return m_Ignored.Contains( check );
|
||||
return Ignored.Contains( check );
|
||||
}
|
||||
|
||||
public bool IsModerator => ( m_Channel != null && m_Channel.IsModerator( this ) );
|
||||
public bool IsModerator => ( CurrentChannel != null && CurrentChannel.IsModerator( this ) );
|
||||
|
||||
public void AddIgnored( ChatUser user )
|
||||
{
|
||||
|
|
@ -121,8 +103,8 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
else
|
||||
{
|
||||
m_Ignored.Add( user );
|
||||
user.m_Ignoring.Add( this );
|
||||
Ignored.Add( user );
|
||||
user.Ignoring.Add( this );
|
||||
|
||||
SendMessage( 23, user.Username ); // You are now ignoring %1.
|
||||
}
|
||||
|
|
@ -132,12 +114,12 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
if ( IsIgnored( user ) )
|
||||
{
|
||||
m_Ignored.Remove( user );
|
||||
user.m_Ignoring.Remove( this );
|
||||
Ignored.Remove( user );
|
||||
user.Ignoring.Remove( this );
|
||||
|
||||
SendMessage( 24, user.Username ); // You are no longer ignoring %1.
|
||||
|
||||
if ( m_Ignored.Count == 0 )
|
||||
if ( Ignored.Count == 0 )
|
||||
SendMessage( 26 ); // You are no longer ignoring anyone.
|
||||
}
|
||||
else
|
||||
|
|
@ -183,17 +165,17 @@ namespace Server.Engines.Chat
|
|||
if ( user == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < user.m_Ignoring.Count; ++i )
|
||||
user.m_Ignoring[i].RemoveIgnored( user );
|
||||
for ( int i = 0; i < user.Ignoring.Count; ++i )
|
||||
user.Ignoring[i].RemoveIgnored( user );
|
||||
|
||||
if ( m_Users.Contains( user ) )
|
||||
{
|
||||
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.CloseChatWindow );
|
||||
|
||||
user.m_Channel?.RemoveUser( user );
|
||||
user.CurrentChannel?.RemoveUser( user );
|
||||
|
||||
m_Users.Remove( user );
|
||||
m_Table.Remove( user.m_Mobile );
|
||||
m_Table.Remove( user.Mobile );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +240,7 @@ namespace Server.Engines.Chat
|
|||
continue;
|
||||
|
||||
if ( user.CheckOnline() )
|
||||
ChatSystem.SendCommandTo( user.m_Mobile, command, param1, param2 );
|
||||
ChatSystem.SendCommandTo( user.Mobile, command, param1, param2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,16 +7,13 @@ namespace Server.Engines.ConPVP
|
|||
public class ArenaController : Item
|
||||
{
|
||||
private Arena m_Arena;
|
||||
private bool m_IsPrivate;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Arena Arena{ get => m_Arena;
|
||||
set{} }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsPrivate{ get => m_IsPrivate;
|
||||
set => m_IsPrivate = value;
|
||||
}
|
||||
public bool IsPrivate { get; set; }
|
||||
|
||||
public override string DefaultName => "arena controller";
|
||||
|
||||
|
|
@ -28,14 +25,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_Arena = new Arena();
|
||||
|
||||
m_Instances.Add( this );
|
||||
Instances.Add( this );
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
m_Instances.Remove( this );
|
||||
Instances.Remove( this );
|
||||
m_Arena.Delete();
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +52,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (bool) m_IsPrivate );
|
||||
writer.Write( (bool) IsPrivate );
|
||||
|
||||
m_Arena.Serialize( writer );
|
||||
}
|
||||
|
|
@ -70,7 +67,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_IsPrivate = reader.ReadBool();
|
||||
IsPrivate = reader.ReadBool();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
|
@ -81,61 +78,55 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Instances.Add( this );
|
||||
Instances.Add( this );
|
||||
}
|
||||
|
||||
private static List<ArenaController> m_Instances = new List<ArenaController>();
|
||||
|
||||
public static List<ArenaController> Instances{ get => m_Instances;
|
||||
set => m_Instances = value;
|
||||
}
|
||||
public static List<ArenaController> Instances { get; set; } = new List<ArenaController>();
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class ArenaStartPoints
|
||||
{
|
||||
private Point3D[] m_Points;
|
||||
|
||||
public Point3D[] Points => m_Points;
|
||||
public Point3D[] Points { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeWest{ get => m_Points[0];
|
||||
set => m_Points[0] = value;
|
||||
public Point3D EdgeWest{ get => Points[0];
|
||||
set => Points[0] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeEast{ get => m_Points[1];
|
||||
set => m_Points[1] = value;
|
||||
public Point3D EdgeEast{ get => Points[1];
|
||||
set => Points[1] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeNorth{ get => m_Points[2];
|
||||
set => m_Points[2] = value;
|
||||
public Point3D EdgeNorth{ get => Points[2];
|
||||
set => Points[2] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeSouth{ get => m_Points[3];
|
||||
set => m_Points[3] = value;
|
||||
public Point3D EdgeSouth{ get => Points[3];
|
||||
set => Points[3] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerNW{ get => m_Points[4];
|
||||
set => m_Points[4] = value;
|
||||
public Point3D CornerNW{ get => Points[4];
|
||||
set => Points[4] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerSE{ get => m_Points[5];
|
||||
set => m_Points[5] = value;
|
||||
public Point3D CornerSE{ get => Points[5];
|
||||
set => Points[5] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerSW{ get => m_Points[6];
|
||||
set => m_Points[6] = value;
|
||||
public Point3D CornerSW{ get => Points[6];
|
||||
set => Points[6] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerNE{ get => m_Points[7];
|
||||
set => m_Points[7] = value;
|
||||
public Point3D CornerNE{ get => Points[7];
|
||||
set => Points[7] = value;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
@ -149,23 +140,23 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public ArenaStartPoints( Point3D[] points )
|
||||
{
|
||||
m_Points = points;
|
||||
Points = points;
|
||||
}
|
||||
|
||||
public ArenaStartPoints( GenericReader reader )
|
||||
{
|
||||
m_Points = new Point3D[reader.ReadEncodedInt()];
|
||||
Points = new Point3D[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_Points.Length; ++i )
|
||||
m_Points[i] = reader.ReadPoint3D();
|
||||
for ( int i = 0; i < Points.Length; ++i )
|
||||
Points[i] = reader.ReadPoint3D();
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) m_Points.Length );
|
||||
writer.WriteEncodedInt( (int) Points.Length );
|
||||
|
||||
for ( int i = 0; i < m_Points.Length; ++i )
|
||||
writer.Write( (Point3D) m_Points[i] );
|
||||
for ( int i = 0; i < Points.Length; ++i )
|
||||
writer.Write( (Point3D) Points[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,9 +166,6 @@ namespace Server.Engines.ConPVP
|
|||
private Map m_Facet;
|
||||
private Rectangle2D m_Bounds;
|
||||
private Rectangle2D m_Zone;
|
||||
private Point3D m_Outside;
|
||||
private Point3D m_Wall;
|
||||
private Point3D m_GateIn;
|
||||
private Point3D m_GateOut;
|
||||
private ArenaStartPoints m_Points;
|
||||
private bool m_Active;
|
||||
|
|
@ -185,21 +173,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private bool m_IsGuarded;
|
||||
|
||||
private Item m_Teleporter;
|
||||
|
||||
private List<Mobile> m_Players;
|
||||
|
||||
private TournamentController m_Tournament;
|
||||
private Mobile m_Announcer;
|
||||
|
||||
private LadderController m_Ladder;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public LadderController Ladder
|
||||
{
|
||||
get => m_Ladder;
|
||||
set => m_Ladder = value;
|
||||
}
|
||||
public LadderController Ladder { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsGuarded
|
||||
|
|
@ -216,8 +193,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public Ladder AcquireLadder()
|
||||
{
|
||||
if ( m_Ladder != null )
|
||||
return m_Ladder.Ladder;
|
||||
if ( Ladder != null )
|
||||
return Ladder.Ladder;
|
||||
|
||||
return Server.Engines.ConPVP.Ladder.Instance;
|
||||
}
|
||||
|
|
@ -237,17 +214,13 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Announcer
|
||||
{
|
||||
get => m_Announcer;
|
||||
set => m_Announcer = value;
|
||||
}
|
||||
public Mobile Announcer { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Name
|
||||
{
|
||||
get => m_Name;
|
||||
set{ m_Name = value; if ( m_Active ) m_Arenas.Sort(); }
|
||||
set{ m_Name = value; if ( m_Active ) Arenas.Sort(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
|
|
@ -258,13 +231,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Facet = value;
|
||||
|
||||
if ( m_Teleporter != null )
|
||||
m_Teleporter.Map = value;
|
||||
if ( Teleporter != null )
|
||||
Teleporter.Map = value;
|
||||
|
||||
m_Region?.Unregister();
|
||||
|
||||
if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null )
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded );
|
||||
else
|
||||
m_Region = null;
|
||||
}
|
||||
|
|
@ -284,7 +257,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Region == null )
|
||||
return 0;
|
||||
|
||||
int specs = m_Region.GetPlayerCount() - m_Players.Count;
|
||||
int specs = m_Region.GetPlayerCount() - Players.Count;
|
||||
|
||||
if ( specs < 0 )
|
||||
specs = 0;
|
||||
|
|
@ -305,7 +278,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Region?.Unregister();
|
||||
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -317,36 +290,28 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Outside{ get => m_Outside;
|
||||
set => m_Outside = value;
|
||||
}
|
||||
public Point3D Outside { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D GateIn{ get => m_GateIn;
|
||||
set => m_GateIn = value;
|
||||
}
|
||||
public Point3D GateIn { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D GateOut{ get => m_GateOut;
|
||||
set{ m_GateOut = value; if ( m_Teleporter != null ) m_Teleporter.Location = m_GateOut; } }
|
||||
set{ m_GateOut = value; if ( Teleporter != null ) Teleporter.Location = m_GateOut; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Wall{ get => m_Wall;
|
||||
set => m_Wall = value;
|
||||
}
|
||||
public Point3D Wall { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsOccupied => ( m_Players.Count > 0 );
|
||||
public bool IsOccupied => ( Players.Count > 0 );
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ArenaStartPoints Points{ get => m_Points;
|
||||
set{} }
|
||||
|
||||
public Item Teleporter{ get => m_Teleporter;
|
||||
set => m_Teleporter = value;
|
||||
}
|
||||
public Item Teleporter { get; set; }
|
||||
|
||||
public List<Mobile> Players => m_Players;
|
||||
public List<Mobile> Players { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active
|
||||
|
|
@ -361,12 +326,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( m_Active )
|
||||
{
|
||||
m_Arenas.Add( this );
|
||||
m_Arenas.Sort();
|
||||
Arenas.Add( this );
|
||||
Arenas.Sort();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Arenas.Remove( this );
|
||||
Arenas.Remove( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -482,16 +447,16 @@ namespace Server.Engines.ConPVP
|
|||
p.Y = (p.X * matrix[1, 0]) + (p.Y * matrix[1, 1]);
|
||||
|
||||
mob.MoveToWorld( new Point3D( start.X + p.X, start.Y + p.Y, start.Z ), m_Facet );
|
||||
mob.Direction = mob.GetDirectionTo( m_Wall );
|
||||
mob.Direction = mob.GetDirectionTo( Wall );
|
||||
|
||||
m_Players.Add( mob );
|
||||
Players.Add( mob );
|
||||
}
|
||||
}
|
||||
|
||||
public Arena()
|
||||
{
|
||||
m_Points = new ArenaStartPoints();
|
||||
m_Players = new List<Mobile>();
|
||||
Players = new List<Mobile>();
|
||||
}
|
||||
|
||||
public Arena( GenericReader reader )
|
||||
|
|
@ -508,14 +473,14 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case 6:
|
||||
{
|
||||
m_Ladder = reader.ReadItem() as LadderController;
|
||||
Ladder = reader.ReadItem() as LadderController;
|
||||
|
||||
goto case 5;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
m_Tournament = reader.ReadItem() as TournamentController;
|
||||
m_Announcer = reader.ReadMobile();
|
||||
Announcer = reader.ReadMobile();
|
||||
|
||||
goto case 4;
|
||||
}
|
||||
|
|
@ -533,15 +498,15 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
m_GateIn = reader.ReadPoint3D();
|
||||
GateIn = reader.ReadPoint3D();
|
||||
m_GateOut = reader.ReadPoint3D();
|
||||
m_Teleporter = reader.ReadItem();
|
||||
Teleporter = reader.ReadItem();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Players = reader.ReadStrongMobileList();
|
||||
Players = reader.ReadStrongMobileList();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
|
@ -549,13 +514,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Facet = reader.ReadMap();
|
||||
m_Bounds = reader.ReadRect2D();
|
||||
m_Outside = reader.ReadPoint3D();
|
||||
m_Wall = reader.ReadPoint3D();
|
||||
Outside = reader.ReadPoint3D();
|
||||
Wall = reader.ReadPoint3D();
|
||||
|
||||
if ( version == 0 )
|
||||
{
|
||||
reader.ReadBool();
|
||||
m_Players = new List<Mobile>();
|
||||
Players = new List<Mobile>();
|
||||
}
|
||||
|
||||
m_Active = reader.ReadBool();
|
||||
|
|
@ -563,8 +528,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( m_Active )
|
||||
{
|
||||
m_Arenas.Add( this );
|
||||
m_Arenas.Sort();
|
||||
Arenas.Add( this );
|
||||
Arenas.Sort();
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -572,7 +537,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null )
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded );
|
||||
|
||||
if ( IsOccupied )
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), Evict );
|
||||
|
|
@ -602,15 +567,15 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
loc = m_Outside;
|
||||
loc = Outside;
|
||||
facet = m_Facet;
|
||||
}
|
||||
|
||||
bool hasBounds = ( m_Bounds.Start != Point2D.Zero && m_Bounds.End != Point2D.Zero );
|
||||
|
||||
for ( int i = 0; i < m_Players.Count; ++i )
|
||||
for ( int i = 0; i < Players.Count; ++i )
|
||||
{
|
||||
Mobile mob = m_Players[i];
|
||||
Mobile mob = Players[i];
|
||||
|
||||
if ( mob == null )
|
||||
continue;
|
||||
|
|
@ -635,7 +600,7 @@ namespace Server.Engines.ConPVP
|
|||
List<Mobile> pets = new List<Mobile>();
|
||||
|
||||
foreach ( Mobile mob in facet.GetMobilesInBounds( m_Bounds ) ) {
|
||||
if ( mob is BaseCreature pet && pet.Controlled && pet.ControlMaster != null && m_Players.Contains( pet.ControlMaster ) ) {
|
||||
if ( mob is BaseCreature pet && pet.Controlled && pet.ControlMaster != null && Players.Contains( pet.ControlMaster ) ) {
|
||||
pets.Add( pet );
|
||||
}
|
||||
}
|
||||
|
|
@ -648,7 +613,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
|
|
@ -657,33 +622,31 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (bool) m_IsGuarded );
|
||||
|
||||
writer.Write( (Item) m_Ladder );
|
||||
writer.Write( (Item) Ladder );
|
||||
|
||||
writer.Write( (Item) m_Tournament );
|
||||
writer.Write( (Mobile) m_Announcer );
|
||||
writer.Write( (Mobile) Announcer );
|
||||
|
||||
writer.Write( (string) m_Name );
|
||||
|
||||
writer.Write( (Rectangle2D) m_Zone );
|
||||
|
||||
writer.Write( (Point3D) m_GateIn );
|
||||
writer.Write( (Point3D) GateIn );
|
||||
writer.Write( (Point3D) m_GateOut );
|
||||
writer.Write( (Item) m_Teleporter );
|
||||
writer.Write( (Item) Teleporter );
|
||||
|
||||
writer.Write( m_Players );
|
||||
writer.Write( Players );
|
||||
|
||||
writer.Write( (Map) m_Facet );
|
||||
writer.Write( (Rectangle2D) m_Bounds );
|
||||
writer.Write( (Point3D) m_Outside );
|
||||
writer.Write( (Point3D) m_Wall );
|
||||
writer.Write( (Point3D) Outside );
|
||||
writer.Write( (Point3D) Wall );
|
||||
writer.Write( (bool) m_Active );
|
||||
|
||||
m_Points.Serialize( writer );
|
||||
}
|
||||
|
||||
private static List<Arena> m_Arenas = new List<Arena>();
|
||||
|
||||
public static List<Arena> Arenas => m_Arenas;
|
||||
public static List<Arena> Arenas { get; } = new List<Arena>();
|
||||
|
||||
public static Arena FindArena( List<Mobile> players )
|
||||
{
|
||||
|
|
@ -692,7 +655,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( prefs == null )
|
||||
return FindArena();
|
||||
|
||||
if ( m_Arenas.Count == 0 )
|
||||
if ( Arenas.Count == 0 )
|
||||
return null;
|
||||
|
||||
if ( players.Count > 0 )
|
||||
|
|
@ -735,16 +698,16 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
List<ArenaEntry> arenas = new List<ArenaEntry>();
|
||||
|
||||
for ( int i = 0; i < m_Arenas.Count; ++i )
|
||||
for ( int i = 0; i < Arenas.Count; ++i )
|
||||
{
|
||||
Arena arena = m_Arenas[i];
|
||||
Arena arena = Arenas[i];
|
||||
|
||||
if ( !arena.IsOccupied )
|
||||
arenas.Add( new ArenaEntry( arena ) );
|
||||
}
|
||||
|
||||
if ( arenas.Count == 0 )
|
||||
return m_Arenas[0];
|
||||
return Arenas[0];
|
||||
|
||||
int tc = 0;
|
||||
|
||||
|
|
@ -796,20 +759,20 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static Arena FindArena()
|
||||
{
|
||||
if ( m_Arenas.Count == 0 )
|
||||
if ( Arenas.Count == 0 )
|
||||
return null;
|
||||
|
||||
int offset = Utility.Random( m_Arenas.Count );
|
||||
int offset = Utility.Random( Arenas.Count );
|
||||
|
||||
for ( int i = 0; i < m_Arenas.Count; ++i )
|
||||
for ( int i = 0; i < Arenas.Count; ++i )
|
||||
{
|
||||
Arena arena = m_Arenas[(i + offset) % m_Arenas.Count];
|
||||
Arena arena = Arenas[(i + offset) % Arenas.Count];
|
||||
|
||||
if ( !arena.IsOccupied )
|
||||
return arena;
|
||||
}
|
||||
|
||||
return m_Arenas[offset];
|
||||
return Arenas[offset];
|
||||
}
|
||||
|
||||
public int CompareTo(object obj)
|
||||
|
|
|
|||
|
|
@ -22,31 +22,25 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public class DuelContext
|
||||
{
|
||||
private Mobile m_Initiator;
|
||||
private ArrayList m_Participants;
|
||||
private Ruleset m_Ruleset;
|
||||
private Arena m_Arena;
|
||||
private bool m_Registered = true;
|
||||
private bool m_Finished, m_Started;
|
||||
public bool Rematch { get; private set; }
|
||||
|
||||
private bool m_ReadyWait;
|
||||
private int m_ReadyCount;
|
||||
public bool ReadyWait { get; private set; }
|
||||
|
||||
private bool m_Rematch;
|
||||
public int ReadyCount { get; private set; }
|
||||
|
||||
public bool Rematch => m_Rematch;
|
||||
public bool Registered { get; private set; } = true;
|
||||
|
||||
public bool ReadyWait => m_ReadyWait;
|
||||
public int ReadyCount => m_ReadyCount;
|
||||
public bool Finished { get; private set; }
|
||||
|
||||
public bool Registered => m_Registered;
|
||||
public bool Finished => m_Finished;
|
||||
public bool Started => m_Started;
|
||||
public bool Started { get; private set; }
|
||||
|
||||
public Mobile Initiator => m_Initiator;
|
||||
public ArrayList Participants => m_Participants;
|
||||
public Ruleset Ruleset => m_Ruleset;
|
||||
public Arena Arena => m_Arena;
|
||||
public Mobile Initiator { get; }
|
||||
|
||||
public ArrayList Participants { get; }
|
||||
|
||||
public Ruleset Ruleset { get; private set; }
|
||||
|
||||
public Arena Arena { get; private set; }
|
||||
|
||||
private bool CantDoAnything( Mobile mob )
|
||||
{
|
||||
|
|
@ -83,7 +77,7 @@ namespace Server.Engines.ConPVP
|
|||
public bool InstAllowSpecialMove( Mobile from, string name, SpecialMove move )
|
||||
{
|
||||
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -102,7 +96,7 @@ namespace Server.Engines.ConPVP
|
|||
title = "Ninjitsu";
|
||||
|
||||
|
||||
if ( title == null || name == null || m_Ruleset.GetOption( title, name ) )
|
||||
if ( title == null || name == null || Ruleset.GetOption( title, name ) )
|
||||
return true;
|
||||
|
||||
from.SendMessage( "The dueling ruleset prevents you from using this move." );
|
||||
|
|
@ -111,7 +105,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool AllowSpellCast( Mobile from, Spell spell )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -174,7 +168,7 @@ namespace Server.Engines.ConPVP
|
|||
option = spell.Name;
|
||||
}
|
||||
|
||||
if ( title == null || option == null || m_Ruleset.GetOption( title, option ) )
|
||||
if ( title == null || option == null || Ruleset.GetOption( title, option ) )
|
||||
return true;
|
||||
|
||||
from.SendMessage( "The dueling ruleset prevents you from casting this spell." );
|
||||
|
|
@ -183,7 +177,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool AllowItemEquip( Mobile from, Item item )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -211,7 +205,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool InstAllowSpecialAbility( Mobile from, string name, bool message )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -222,7 +216,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( CantDoAnything( from ) )
|
||||
return false;
|
||||
|
||||
if ( m_Ruleset.GetOption( "Combat Abilities", name ) )
|
||||
if ( Ruleset.GetOption( "Combat Abilities", name ) )
|
||||
return true;
|
||||
|
||||
if ( message )
|
||||
|
|
@ -235,38 +229,38 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if ( item is Fists )
|
||||
{
|
||||
if ( !m_Ruleset.GetOption( "Weapons", "Wrestling" ) )
|
||||
if ( !Ruleset.GetOption( "Weapons", "Wrestling" ) )
|
||||
return false;
|
||||
}
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
if ( armor.ProtectionLevel > ArmorProtectionLevel.Regular && !m_Ruleset.GetOption( "Armor", "Magical" ) )
|
||||
if ( armor.ProtectionLevel > ArmorProtectionLevel.Regular && !Ruleset.GetOption( "Armor", "Magical" ) )
|
||||
return false;
|
||||
|
||||
if ( !Core.AOS && armor.Resource != armor.DefaultResource && !m_Ruleset.GetOption( "Armor", "Colored" ) )
|
||||
if ( !Core.AOS && armor.Resource != armor.DefaultResource && !Ruleset.GetOption( "Armor", "Colored" ) )
|
||||
return false;
|
||||
|
||||
if ( armor is BaseShield && !m_Ruleset.GetOption( "Armor", "Shields" ) )
|
||||
if ( armor is BaseShield && !Ruleset.GetOption( "Armor", "Shields" ) )
|
||||
return false;
|
||||
}
|
||||
else if ( item is BaseWeapon weapon )
|
||||
{
|
||||
if ( (weapon.DamageLevel > WeaponDamageLevel.Regular || weapon.AccuracyLevel > WeaponAccuracyLevel.Regular) && !m_Ruleset.GetOption( "Weapons", "Magical" ) )
|
||||
if ( (weapon.DamageLevel > WeaponDamageLevel.Regular || weapon.AccuracyLevel > WeaponAccuracyLevel.Regular) && !Ruleset.GetOption( "Weapons", "Magical" ) )
|
||||
return false;
|
||||
|
||||
if ( !Core.AOS && weapon.Resource != CraftResource.Iron && weapon.Resource != CraftResource.None && !m_Ruleset.GetOption( "Weapons", "Runics" ) )
|
||||
if ( !Core.AOS && weapon.Resource != CraftResource.Iron && weapon.Resource != CraftResource.None && !Ruleset.GetOption( "Weapons", "Runics" ) )
|
||||
return false;
|
||||
|
||||
if ( weapon is BaseRanged && !m_Ruleset.GetOption( "Weapons", "Ranged" ) )
|
||||
if ( weapon is BaseRanged && !Ruleset.GetOption( "Weapons", "Ranged" ) )
|
||||
return false;
|
||||
|
||||
if ( !(weapon is BaseRanged) && !m_Ruleset.GetOption( "Weapons", "Melee" ) )
|
||||
if ( !(weapon is BaseRanged) && !Ruleset.GetOption( "Weapons", "Melee" ) )
|
||||
return false;
|
||||
|
||||
if ( weapon.PoisonCharges > 0 && weapon.Poison != null && !m_Ruleset.GetOption( "Weapons", "Poisoned" ) )
|
||||
if ( weapon.PoisonCharges > 0 && weapon.Poison != null && !Ruleset.GetOption( "Weapons", "Poisoned" ) )
|
||||
return false;
|
||||
|
||||
if ( weapon is BaseWand && !m_Ruleset.GetOption( "Items", "Wands" ) )
|
||||
if ( weapon is BaseWand && !Ruleset.GetOption( "Items", "Wands" ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +269,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool AllowSkillUse( Mobile from, SkillName skill )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -290,7 +284,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( id >= 0 && id < SkillInfo.Table.Length )
|
||||
{
|
||||
if ( m_Ruleset.GetOption( "Skills", SkillInfo.Table[id].Name ) )
|
||||
if ( Ruleset.GetOption( "Skills", SkillInfo.Table[id].Name ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +294,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool AllowItemUse( Mobile from, Item item )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -386,7 +380,7 @@ namespace Server.Engines.ConPVP
|
|||
option = "Wands";
|
||||
}
|
||||
|
||||
if ( title != null && option != null && m_StartedBeginCountdown && !m_Started )
|
||||
if ( title != null && option != null && StartedBeginCountdown && !Started )
|
||||
{
|
||||
from.SendMessage( "You may not use this item before the duel begins." );
|
||||
return false;
|
||||
|
|
@ -402,7 +396,7 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( title == null || option == null || m_Ruleset.GetOption( title, option ) )
|
||||
if ( title == null || option == null || Ruleset.GetOption( title, option ) )
|
||||
return true;
|
||||
|
||||
from.SendMessage( "The dueling ruleset prevents you from using this item." );
|
||||
|
|
@ -430,10 +424,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void OnLocationChanged( Mobile mob )
|
||||
{
|
||||
if ( !m_Registered || !m_StartedBeginCountdown || m_Finished )
|
||||
if ( !Registered || !StartedBeginCountdown || Finished )
|
||||
return;
|
||||
|
||||
Arena arena = m_Arena;
|
||||
Arena arena = Arena;
|
||||
|
||||
if ( arena == null )
|
||||
return;
|
||||
|
|
@ -472,7 +466,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void OnDeath( Mobile mob, Container corpse )
|
||||
{
|
||||
if ( !m_Registered || !m_Started )
|
||||
if ( !Registered || !Started )
|
||||
return;
|
||||
|
||||
DuelPlayer pl = Find( mob );
|
||||
|
|
@ -506,9 +500,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool CheckFull()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
if ( p.HasOpenSlot )
|
||||
return false;
|
||||
|
|
@ -596,11 +590,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void SendOutside( Mobile mob )
|
||||
{
|
||||
if ( m_Arena == null )
|
||||
if ( Arena == null )
|
||||
return;
|
||||
|
||||
mob.Combatant = null;
|
||||
mob.MoveToWorld( m_Arena.Outside, m_Arena.Facet );
|
||||
mob.MoveToWorld( Arena.Outside, Arena.Facet );
|
||||
}
|
||||
|
||||
private Point3D m_GatePoint;
|
||||
|
|
@ -608,13 +602,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Finish( Participant winner )
|
||||
{
|
||||
if ( m_Finished )
|
||||
if ( Finished )
|
||||
return;
|
||||
|
||||
EndAutoTie();
|
||||
StopSDTimers();
|
||||
|
||||
m_Finished = true;
|
||||
Finished = true;
|
||||
|
||||
for ( int i = 0; i < winner.Players.Length; ++i )
|
||||
{
|
||||
|
|
@ -630,12 +624,12 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Match.Winner = winner.TournyPart;
|
||||
winner.TournyPart.WonMatch( m_Match );
|
||||
m_Tournament.HandleWon( m_Arena, m_Match, winner.TournyPart );
|
||||
m_Tournament.HandleWon( Arena, m_Match, winner.TournyPart );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant loser = (Participant)m_Participants[i];
|
||||
Participant loser = (Participant)Participants[i];
|
||||
|
||||
if ( loser != winner )
|
||||
{
|
||||
|
|
@ -661,8 +655,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( IsOneVsOne )
|
||||
{
|
||||
DuelPlayer dp1 = ((Participant)m_Participants[0]).Players[0];
|
||||
DuelPlayer dp2 = ((Participant)m_Participants[1]).Players[0];
|
||||
DuelPlayer dp1 = ((Participant)Participants[0]).Players[0];
|
||||
DuelPlayer dp2 = ((Participant)Participants[1]).Players[0];
|
||||
|
||||
if ( dp1 != null && dp2 != null )
|
||||
{
|
||||
|
|
@ -678,7 +672,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Award( Mobile us, Mobile them, bool won )
|
||||
{
|
||||
Ladder ladder = ( m_Arena == null ? Ladder.Instance : m_Arena.AcquireLadder() );
|
||||
Ladder ladder = ( Arena == null ? Ladder.Instance : Arena.AcquireLadder() );
|
||||
|
||||
if ( ladder == null )
|
||||
return;
|
||||
|
|
@ -733,20 +727,20 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DestroyWall();
|
||||
|
||||
if ( !m_Registered )
|
||||
if ( !Registered )
|
||||
return;
|
||||
|
||||
m_Registered = false;
|
||||
Registered = false;
|
||||
|
||||
m_Arena?.Evict();
|
||||
Arena?.Evict();
|
||||
|
||||
StopSDTimers();
|
||||
|
||||
Type[] types = { typeof( BeginGump ), typeof( DuelContextGump ), typeof( ParticipantGump ), typeof( PickRulesetGump ), typeof( ReadyGump ), typeof( ReadyUpGump ), typeof( RulesetGump ) };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -769,16 +763,16 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void QueryRematch()
|
||||
{
|
||||
DuelContext dc = new DuelContext( m_Initiator, m_Ruleset.Layout, false );
|
||||
DuelContext dc = new DuelContext( Initiator, Ruleset.Layout, false );
|
||||
|
||||
dc.m_Ruleset = m_Ruleset;
|
||||
dc.m_Rematch = true;
|
||||
dc.Ruleset = Ruleset;
|
||||
dc.Rematch = true;
|
||||
|
||||
dc.m_Participants.Clear();
|
||||
dc.Participants.Clear();
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant oldPart = (Participant)m_Participants[i];
|
||||
Participant oldPart = (Participant)Participants[i];
|
||||
Participant newPart = new Participant( dc, oldPart.Players.Length );
|
||||
|
||||
for ( int j = 0; j < oldPart.Players.Length; ++j )
|
||||
|
|
@ -789,7 +783,7 @@ namespace Server.Engines.ConPVP
|
|||
newPart.Players[j] = new DuelPlayer( oldPlayer.Mobile, newPart );
|
||||
}
|
||||
|
||||
dc.m_Participants.Add( newPart );
|
||||
dc.Participants.Add( newPart );
|
||||
}
|
||||
|
||||
dc.CloseAllGumps();
|
||||
|
|
@ -806,9 +800,9 @@ namespace Server.Engines.ConPVP
|
|||
return null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
DuelPlayer pl = p.Find( mob );
|
||||
|
||||
if ( pl != null )
|
||||
|
|
@ -833,15 +827,15 @@ namespace Server.Engines.ConPVP
|
|||
bool hasWinner = false;
|
||||
int eliminated = 0;
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
if ( p.Eliminated )
|
||||
{
|
||||
++eliminated;
|
||||
|
||||
if ( eliminated == (m_Participants.Count - 1) )
|
||||
if ( eliminated == (Participants.Count - 1) )
|
||||
hasWinner = true;
|
||||
}
|
||||
else
|
||||
|
|
@ -851,7 +845,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
if ( hasWinner )
|
||||
return winner ?? (Participant) m_Participants[0];
|
||||
return winner ?? (Participant) Participants[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -891,15 +885,10 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
private Timer m_AutoTieTimer;
|
||||
private bool m_Tied;
|
||||
|
||||
public bool Tied => m_Tied;
|
||||
public bool Tied { get; private set; }
|
||||
|
||||
private bool m_IsSuddenDeath;
|
||||
|
||||
public bool IsSuddenDeath{ get => m_IsSuddenDeath;
|
||||
set => m_IsSuddenDeath = value;
|
||||
}
|
||||
public bool IsSuddenDeath { get; set; }
|
||||
|
||||
private Timer m_SDWarnTimer, m_SDActivateTimer;
|
||||
|
||||
|
|
@ -927,9 +916,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void WarnSuddenDeath()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -944,7 +933,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Tournament?.Alert( m_Arena, "Sudden death will be active soon!" );
|
||||
m_Tournament?.Alert( Arena, "Sudden death will be active soon!" );
|
||||
|
||||
m_SDWarnTimer?.Stop();
|
||||
|
||||
|
|
@ -958,9 +947,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void ActivateSuddenDeath()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -975,9 +964,9 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Tournament?.Alert( m_Arena, "Sudden death has been activated!" );
|
||||
m_Tournament?.Alert( Arena, "Sudden death has been activated!" );
|
||||
|
||||
m_IsSuddenDeath = true;
|
||||
IsSuddenDeath = true;
|
||||
|
||||
m_SDActivateTimer?.Stop();
|
||||
|
||||
|
|
@ -1006,19 +995,19 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_AutoTieTimer = null;
|
||||
|
||||
if ( !m_Started || m_Finished )
|
||||
if ( !Started || Finished )
|
||||
return;
|
||||
|
||||
m_Tied = true;
|
||||
m_Finished = true;
|
||||
Tied = true;
|
||||
Finished = true;
|
||||
|
||||
StopSDTimers();
|
||||
|
||||
ArrayList remaining = new ArrayList();
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
if ( p.Eliminated )
|
||||
{
|
||||
|
|
@ -1052,7 +1041,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Tournament?.HandleTie( m_Arena, m_Match, remaining );
|
||||
m_Tournament?.HandleTie( Arena, m_Match, remaining );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), Unregister );
|
||||
}
|
||||
|
|
@ -1061,13 +1050,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
if ( m_Participants.Count != 2 )
|
||||
if ( Participants.Count != 2 )
|
||||
return false;
|
||||
|
||||
if ( ((Participant)m_Participants[0]).Players.Length != 1 )
|
||||
if ( ((Participant)Participants[0]).Players.Length != 1 )
|
||||
return false;
|
||||
|
||||
if ( ((Participant)m_Participants[1]).Players.Length != 1 )
|
||||
if ( ((Participant)Participants[1]).Players.Length != 1 )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -1140,7 +1129,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( dc.ReadyWait && pm.DuelPlayer.Ready && !dc.Started && !dc.StartedBeginCountdown && !dc.Finished )
|
||||
{
|
||||
if ( dc.m_Tournament == null )
|
||||
pm.SendGump( new ReadyGump( pm, dc, dc.m_ReadyCount ) );
|
||||
pm.SendGump( new ReadyGump( pm, dc, dc.ReadyCount ) );
|
||||
}
|
||||
else if ( dc.ReadyWait && !dc.StartedBeginCountdown && !dc.Started && !dc.Finished )
|
||||
{
|
||||
|
|
@ -1362,7 +1351,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
dc.Unregister();
|
||||
}
|
||||
else if ( dc.m_Registered )
|
||||
else if ( dc.Registered )
|
||||
{
|
||||
p.Nullify( pl );
|
||||
pm.DuelPlayer=null;
|
||||
|
|
@ -1400,7 +1389,7 @@ namespace Server.Engines.ConPVP
|
|||
pm.DuelContext.m_Countdown?.Stop();
|
||||
pm.DuelContext.m_Countdown = null;
|
||||
|
||||
pm.DuelContext.m_StartedReadyCountdown=false;
|
||||
pm.DuelContext.StartedReadyCountdown=false;
|
||||
p.Broadcast( 0x22, null, "{0} has yielded.", "You have yielded." );
|
||||
|
||||
dc.m_Yielding=true;
|
||||
|
|
@ -1411,7 +1400,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
dc.Unregister();
|
||||
}
|
||||
else if ( dc.m_Registered )
|
||||
else if ( dc.Registered )
|
||||
{
|
||||
p.Nullify( pl );
|
||||
pm.DuelPlayer=null;
|
||||
|
|
@ -1500,17 +1489,17 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DuelContext( Mobile initiator, RulesetLayout layout, bool addNew )
|
||||
{
|
||||
m_Initiator = initiator;
|
||||
m_Participants = new ArrayList();
|
||||
m_Ruleset = new Ruleset( layout );
|
||||
m_Ruleset.ApplyDefault( layout.Defaults[0] );
|
||||
Initiator = initiator;
|
||||
Participants = new ArrayList();
|
||||
Ruleset = new Ruleset( layout );
|
||||
Ruleset.ApplyDefault( layout.Defaults[0] );
|
||||
|
||||
if ( addNew )
|
||||
{
|
||||
m_Participants.Add( new Participant( this, 1 ) );
|
||||
m_Participants.Add( new Participant( this, 1 ) );
|
||||
Participants.Add( new Participant( this, 1 ) );
|
||||
Participants.Add( new Participant( this, 1 ) );
|
||||
|
||||
((Participant)m_Participants[0]).Add( initiator );
|
||||
((Participant)Participants[0]).Add( initiator );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1519,9 +1508,9 @@ namespace Server.Engines.ConPVP
|
|||
Type[] types = { typeof( DuelContextGump ), typeof( ParticipantGump ), typeof( RulesetGump ) };
|
||||
int[] defs = { -1, -1, -1 };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1541,15 +1530,15 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void RejectReady( Mobile rejector, string page )
|
||||
{
|
||||
if ( m_StartedReadyCountdown )
|
||||
if ( StartedReadyCountdown )
|
||||
return; // sanity
|
||||
|
||||
Type[] types = { typeof( DuelContextGump ), typeof( ReadyUpGump ), typeof( ReadyGump ) };
|
||||
int[] defs = { -1, -1, -1 };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1570,9 +1559,9 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
{
|
||||
if ( mob == rejector )
|
||||
mob.SendMessage( 0x22, "You have rejected the {0}.", m_Rematch ? "rematch" : page );
|
||||
mob.SendMessage( 0x22, "You have rejected the {0}.", Rematch ? "rematch" : page );
|
||||
else
|
||||
mob.SendMessage( 0x22, "{0} has rejected the {1}.", rejector.Name, m_Rematch ? "rematch" : page );
|
||||
mob.SendMessage( 0x22, "{0} has rejected the {1}.", rejector.Name, Rematch ? "rematch" : page );
|
||||
}
|
||||
|
||||
for ( int k = 0; k < types.Length; ++k )
|
||||
|
|
@ -1581,13 +1570,13 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Rematch )
|
||||
if ( Rematch )
|
||||
Unregister();
|
||||
else if ( !m_Yielding )
|
||||
m_Initiator.SendGump( new DuelContextGump( m_Initiator, this ) );
|
||||
Initiator.SendGump( new DuelContextGump( Initiator, this ) );
|
||||
|
||||
m_ReadyWait = false;
|
||||
m_ReadyCount = 0;
|
||||
ReadyWait = false;
|
||||
ReadyCount = 0;
|
||||
}
|
||||
|
||||
public void SendReadyGump()
|
||||
|
|
@ -1651,11 +1640,9 @@ namespace Server.Engines.ConPVP
|
|||
Targeting.Target.Cancel( mob );
|
||||
}
|
||||
|
||||
private bool m_StartedBeginCountdown;
|
||||
private bool m_StartedReadyCountdown;
|
||||
public bool StartedBeginCountdown { get; private set; }
|
||||
|
||||
public bool StartedBeginCountdown => m_StartedBeginCountdown;
|
||||
public bool StartedReadyCountdown => m_StartedReadyCountdown;
|
||||
public bool StartedReadyCountdown { get; private set; }
|
||||
|
||||
private class InternalWall : Item
|
||||
{
|
||||
|
|
@ -1704,11 +1691,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void CreateWall()
|
||||
{
|
||||
if ( m_Arena == null )
|
||||
if ( Arena == null )
|
||||
return;
|
||||
|
||||
Point3D start = m_Arena.Points.EdgeWest;
|
||||
Point3D wall = m_Arena.Wall;
|
||||
Point3D start = Arena.Points.EdgeWest;
|
||||
Point3D wall = Arena.Wall;
|
||||
|
||||
int dx = start.X - wall.X;
|
||||
int dy = start.Y - wall.Y;
|
||||
|
|
@ -1726,7 +1713,7 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
eastToWest = false;
|
||||
|
||||
Effects.PlaySound( wall, m_Arena.Facet, 0x1F6 );
|
||||
Effects.PlaySound( wall, Arena.Facet, 0x1F6 );
|
||||
|
||||
for ( int i = -1; i <= 1; ++i )
|
||||
{
|
||||
|
|
@ -1734,7 +1721,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
InternalWall created = new InternalWall();
|
||||
|
||||
created.Appear( loc, m_Arena.Facet );
|
||||
created.Appear( loc, Arena.Facet );
|
||||
|
||||
m_Walls.Add( created );
|
||||
}
|
||||
|
|
@ -1742,9 +1729,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void BuildParties()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
if ( p.Players.Length > 1 )
|
||||
{
|
||||
|
|
@ -1810,9 +1797,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void ClearIllegalItems()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1877,11 +1864,11 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
private void MessageRuleset( Mobile mob ) {
|
||||
if ( m_Ruleset == null ) {
|
||||
if ( Ruleset == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ruleset ruleset = m_Ruleset;
|
||||
Ruleset ruleset = Ruleset;
|
||||
Ruleset basedef = ruleset.Base;
|
||||
|
||||
mob.SendMessage( "Ruleset: {0}", basedef.Title );
|
||||
|
|
@ -1928,7 +1915,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void SendBeginGump( int count )
|
||||
{
|
||||
if ( !m_Registered || m_Finished )
|
||||
if ( !Registered || Finished )
|
||||
return;
|
||||
|
||||
if ( count == 10 )
|
||||
|
|
@ -1942,19 +1929,19 @@ namespace Server.Engines.ConPVP
|
|||
DestroyWall();
|
||||
}
|
||||
|
||||
m_StartedBeginCountdown = true;
|
||||
StartedBeginCountdown = true;
|
||||
|
||||
if ( count == 0 )
|
||||
{
|
||||
m_Started = true;
|
||||
Started = true;
|
||||
BeginAutoTie();
|
||||
}
|
||||
|
||||
Type[] types = { typeof( ReadyGump ), typeof( ReadyUpGump ), typeof( BeginGump ) };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1985,44 +1972,43 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private class ReturnEntry
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Point3D m_Location;
|
||||
private Map m_Facet;
|
||||
private DateTime m_Expire;
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public Point3D Location => m_Location;
|
||||
public Map Facet => m_Facet;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public Point3D Location { get; private set; }
|
||||
|
||||
public Map Facet { get; private set; }
|
||||
|
||||
public void Return()
|
||||
{
|
||||
if ( m_Facet == Map.Internal || m_Facet == null )
|
||||
if ( Facet == Map.Internal || Facet == null )
|
||||
return;
|
||||
|
||||
if ( m_Mobile.Map == Map.Internal )
|
||||
if ( Mobile.Map == Map.Internal )
|
||||
{
|
||||
m_Mobile.LogoutLocation = m_Location;
|
||||
m_Mobile.LogoutMap = m_Facet;
|
||||
Mobile.LogoutLocation = Location;
|
||||
Mobile.LogoutMap = Facet;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.Location = m_Location;
|
||||
m_Mobile.Map = m_Facet;
|
||||
Mobile.Location = Location;
|
||||
Mobile.Map = Facet;
|
||||
}
|
||||
}
|
||||
|
||||
public ReturnEntry( Mobile mob )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
Mobile = mob;
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
public ReturnEntry( Mobile mob, Point3D loc, Map facet )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Location = loc;
|
||||
m_Facet = facet;
|
||||
Mobile = mob;
|
||||
Location = loc;
|
||||
Facet = facet;
|
||||
m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 );
|
||||
}
|
||||
|
||||
|
|
@ -2032,15 +2018,15 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 );
|
||||
|
||||
if ( m_Mobile.Map == Map.Internal )
|
||||
if ( Mobile.Map == Map.Internal )
|
||||
{
|
||||
m_Facet = m_Mobile.LogoutMap;
|
||||
m_Location = m_Mobile.LogoutLocation;
|
||||
Facet = Mobile.LogoutMap;
|
||||
Location = Mobile.LogoutLocation;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Facet = m_Mobile.Map;
|
||||
m_Location = m_Mobile.Location;
|
||||
Facet = Mobile.Map;
|
||||
Location = Mobile.Location;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2243,9 +2229,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void RemoveAggressions( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2264,17 +2250,17 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void SendReadyUpGump()
|
||||
{
|
||||
if ( !m_Registered )
|
||||
if ( !Registered )
|
||||
return;
|
||||
|
||||
m_ReadyWait = true;
|
||||
m_ReadyCount = -1;
|
||||
ReadyWait = true;
|
||||
ReadyCount = -1;
|
||||
|
||||
Type[] types = { typeof( ReadyUpGump ) };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2296,9 +2282,9 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Tournament == null && TournamentController.IsActive )
|
||||
return "a tournament is active";
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2347,13 +2333,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void SendReadyGump( int count )
|
||||
{
|
||||
if ( !m_Registered )
|
||||
if ( !Registered )
|
||||
return;
|
||||
|
||||
if ( count != -1 )
|
||||
m_StartedReadyCountdown = true;
|
||||
StartedReadyCountdown = true;
|
||||
|
||||
m_ReadyCount = count;
|
||||
ReadyCount = count;
|
||||
|
||||
if ( count == 0 )
|
||||
{
|
||||
|
|
@ -2361,9 +2347,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( error != null )
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2378,13 +2364,13 @@ namespace Server.Engines.ConPVP
|
|||
return;
|
||||
}
|
||||
|
||||
m_ReadyWait = false;
|
||||
ReadyWait = false;
|
||||
|
||||
List<Mobile> players = new List<Mobile>();
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2402,9 +2388,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( arena == null )
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2420,17 +2406,17 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( !arena.IsOccupied )
|
||||
{
|
||||
m_Arena = arena;
|
||||
Arena = arena;
|
||||
|
||||
if ( m_Initiator.Map == Map.Internal )
|
||||
if ( Initiator.Map == Map.Internal )
|
||||
{
|
||||
m_GatePoint = m_Initiator.LogoutLocation;
|
||||
m_GateFacet = m_Initiator.LogoutMap;
|
||||
m_GatePoint = Initiator.LogoutLocation;
|
||||
m_GateFacet = Initiator.LogoutMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_GatePoint = m_Initiator.Location;
|
||||
m_GateFacet = m_Initiator.Map;
|
||||
m_GatePoint = Initiator.Location;
|
||||
m_GateFacet = Initiator.Map;
|
||||
}
|
||||
|
||||
if ( !(arena.Teleporter is ExitTeleporter tp) )
|
||||
|
|
@ -2441,11 +2427,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
ArenaMoongate mg = new ArenaMoongate( arena.GateIn == Point3D.Zero ? arena.Outside : arena.GateIn, arena.Facet, tp );
|
||||
|
||||
m_StartedBeginCountdown = true;
|
||||
StartedBeginCountdown = true;
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2476,9 +2462,9 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2494,15 +2480,15 @@ namespace Server.Engines.ConPVP
|
|||
return;
|
||||
}
|
||||
|
||||
m_ReadyWait = true;
|
||||
ReadyWait = true;
|
||||
|
||||
bool isAllReady = true;
|
||||
|
||||
Type[] types = { typeof( ReadyGump ) };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class DuelContextGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
public Mobile From { get; }
|
||||
|
||||
public Mobile From => m_From;
|
||||
public DuelContext Context => m_Context;
|
||||
public DuelContext Context { get; }
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
|
|
@ -31,8 +29,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DuelContextGump( Mobile from, DuelContext context ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
From = from;
|
||||
Context = context;
|
||||
|
||||
from.CloseGump( typeof( RulesetGump ) );
|
||||
from.CloseGump( typeof( DuelContextGump ) );
|
||||
|
|
@ -71,7 +69,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_Context.Registered )
|
||||
if ( !Context.Registered )
|
||||
return;
|
||||
|
||||
int index = info.ButtonID;
|
||||
|
|
@ -84,39 +82,39 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case 0: // closed
|
||||
{
|
||||
m_Context.Unregister();
|
||||
Context.Unregister();
|
||||
break;
|
||||
}
|
||||
case 1: // Rules
|
||||
{
|
||||
//m_From.SendGump( new RulesetGump( m_From, m_Context.Ruleset, m_Context.Ruleset.Layout, m_Context ) );
|
||||
m_From.SendGump( new PickRulesetGump( m_From, m_Context, m_Context.Ruleset ) );
|
||||
From.SendGump( new PickRulesetGump( From, Context, Context.Ruleset ) );
|
||||
break;
|
||||
}
|
||||
case 2: // Start
|
||||
{
|
||||
if ( m_Context.CheckFull() )
|
||||
if ( Context.CheckFull() )
|
||||
{
|
||||
m_Context.CloseAllGumps();
|
||||
m_Context.SendReadyUpGump();
|
||||
Context.CloseAllGumps();
|
||||
Context.SendReadyUpGump();
|
||||
//m_Context.SendReadyGump();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage( "You cannot start the duel before all participating players have been assigned." );
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
From.SendMessage( "You cannot start the duel before all participating players have been assigned." );
|
||||
From.SendGump( new DuelContextGump( From, Context ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // New Participant
|
||||
{
|
||||
if ( m_Context.Participants.Count < 10 )
|
||||
m_Context.Participants.Add( new Participant( m_Context, 1 ) );
|
||||
if ( Context.Participants.Count < 10 )
|
||||
Context.Participants.Add( new Participant( Context, 1 ) );
|
||||
else
|
||||
m_From.SendMessage( "The number of participating parties may not be increased further." );
|
||||
From.SendMessage( "The number of participating parties may not be increased further." );
|
||||
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
From.SendGump( new DuelContextGump( From, Context ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -124,8 +122,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
index -= 4;
|
||||
|
||||
if ( index >= 0 && index < m_Context.Participants.Count )
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, (Participant)m_Context.Participants[index] ) );
|
||||
if ( index >= 0 && index < Context.Participants.Count )
|
||||
From.SendGump( new ParticipantGump( From, Context, (Participant)Context.Participants[index] ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Server.Engines.ConPVP
|
|||
public override string DefaultName => "da bomb";
|
||||
|
||||
private BRGame m_Game;
|
||||
private Mobile m_Thrower;
|
||||
private EffectTimer m_Timer;
|
||||
private bool m_Flying;
|
||||
|
||||
|
|
@ -287,7 +286,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_Flying = true;
|
||||
Visible = false;
|
||||
m_Thrower = from;
|
||||
Thrower = from;
|
||||
MoveToWorld( GetWorldLocation(), from.Map );
|
||||
|
||||
BeginFlight( pt );
|
||||
|
|
@ -348,7 +347,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string verb = "caught";
|
||||
|
||||
if ( m_Thrower != null && m_Game.GetTeamInfo( m_Thrower ) != useTeam )
|
||||
if ( Thrower != null && m_Game.GetTeamInfo( Thrower ) != useTeam )
|
||||
verb = "intercepted";
|
||||
|
||||
if ( !TakeBomb( m, useTeam, verb ) )
|
||||
|
|
@ -607,7 +606,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( i is BRGoal goal )
|
||||
{
|
||||
Point3D oldLoc = new Point3D( GetWorldLocation() );
|
||||
if ( CheckScore( goal, m_Thrower, 3 ) )
|
||||
if ( CheckScore( goal, Thrower, 3 ) )
|
||||
DoAnim( oldLoc, point, Map );
|
||||
else
|
||||
HitObject( point, loc.Z, height );
|
||||
|
|
@ -626,7 +625,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Mobile m = ns.Mobile;
|
||||
|
||||
if ( m == null || m == m_Thrower )
|
||||
if ( m == null || m == Thrower )
|
||||
continue;
|
||||
|
||||
Point3D point;
|
||||
|
|
@ -705,7 +704,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
public Mobile Thrower => m_Thrower;
|
||||
public Mobile Thrower { get; private set; }
|
||||
|
||||
public bool CheckScore( BRGoal goal, Mobile m, int points )
|
||||
{
|
||||
|
|
@ -1165,14 +1164,12 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
private BRTeamInfo m_TeamInfo;
|
||||
|
||||
private Mobile m_Player;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
public Mobile Player => m_Player;
|
||||
public Mobile Player { get; }
|
||||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
|
|
@ -1188,7 +1185,7 @@ namespace Server.Engines.ConPVP
|
|||
return res;
|
||||
}
|
||||
|
||||
public string Name => m_Player.Name;
|
||||
public string Name => Player.Name;
|
||||
|
||||
public int Kills
|
||||
{
|
||||
|
|
@ -1226,29 +1223,15 @@ namespace Server.Engines.ConPVP
|
|||
public BRPlayerInfo( BRTeamInfo teamInfo, Mobile player )
|
||||
{
|
||||
m_TeamInfo = teamInfo;
|
||||
m_Player = player;
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public sealed class BRTeamInfo : IRankedCTF, IComparable
|
||||
{
|
||||
private BRGame m_Game;
|
||||
private int m_TeamID;
|
||||
|
||||
private int m_Color;
|
||||
private string m_Name;
|
||||
|
||||
private BRBoard m_Board;
|
||||
private BRGoal m_Goal;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
private Hashtable m_Players;
|
||||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
BRTeamInfo ti = (BRTeamInfo)obj;
|
||||
|
|
@ -1263,40 +1246,24 @@ namespace Server.Engines.ConPVP
|
|||
return res;
|
||||
}
|
||||
|
||||
public string Name => $"{m_Name} Team";
|
||||
public string Name => $"{TeamName} Team";
|
||||
|
||||
public BRGame Game { get => m_Game;
|
||||
set => m_Game = value;
|
||||
}
|
||||
public int TeamID => m_TeamID;
|
||||
public BRGame Game { get; set; }
|
||||
|
||||
public int Kills { get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Captures { get => m_Captures;
|
||||
set => m_Captures = value;
|
||||
}
|
||||
public int TeamID { get; }
|
||||
|
||||
public int Score { get => m_Score;
|
||||
set => m_Score = value;
|
||||
}
|
||||
public int Kills { get; set; }
|
||||
|
||||
private BRPlayerInfo m_Leader;
|
||||
public int Captures { get; set; }
|
||||
|
||||
public BRPlayerInfo Leader
|
||||
{
|
||||
get => m_Leader;
|
||||
set => m_Leader = value;
|
||||
}
|
||||
public int Score { get; set; }
|
||||
|
||||
public BRPlayerInfo Leader { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRBoard Board
|
||||
{
|
||||
get => m_Board;
|
||||
set => m_Board = value;
|
||||
}
|
||||
public BRBoard Board { get; set; }
|
||||
|
||||
public Hashtable Players => m_Players;
|
||||
public Hashtable Players { get; }
|
||||
|
||||
public BRPlayerInfo this[Mobile mob]
|
||||
{
|
||||
|
|
@ -1305,26 +1272,18 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
if ( !(m_Players[mob] is BRPlayerInfo val) )
|
||||
m_Players[mob] = val = new BRPlayerInfo( this, mob );
|
||||
if ( !(Players[mob] is BRPlayerInfo val) )
|
||||
Players[mob] = val = new BRPlayerInfo( this, mob );
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Color
|
||||
{
|
||||
get => m_Color;
|
||||
set => m_Color = value;
|
||||
}
|
||||
public int Color { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TeamName
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
public string TeamName { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRGoal Goal
|
||||
|
|
@ -1340,30 +1299,30 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public BRTeamInfo( int teamID )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Hashtable();
|
||||
TeamID = teamID;
|
||||
Players = new Hashtable();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Kills = 0;
|
||||
m_Captures = 0;
|
||||
m_Score = 0;
|
||||
Kills = 0;
|
||||
Captures = 0;
|
||||
Score = 0;
|
||||
|
||||
m_Leader = null;
|
||||
Leader = null;
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
|
||||
if ( m_Board != null )
|
||||
m_Board.m_TeamInfo = this;
|
||||
if ( Board != null )
|
||||
Board.m_TeamInfo = this;
|
||||
if ( m_Goal != null )
|
||||
m_Goal.Team = this;
|
||||
}
|
||||
|
||||
public BRTeamInfo( int teamID, GenericReader ip )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Hashtable();
|
||||
TeamID = teamID;
|
||||
Players = new Hashtable();
|
||||
|
||||
int version = ip.ReadEncodedInt();
|
||||
|
||||
|
|
@ -1371,9 +1330,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Board = ip.ReadItem() as BRBoard;
|
||||
m_Name = ip.ReadString();
|
||||
m_Color = ip.ReadEncodedInt();
|
||||
Board = ip.ReadItem() as BRBoard;
|
||||
TeamName = ip.ReadString();
|
||||
Color = ip.ReadEncodedInt();
|
||||
m_Goal = ip.ReadItem() as BRGoal;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1384,18 +1343,18 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
op.WriteEncodedInt( 0 ); // version
|
||||
|
||||
op.Write( m_Board );
|
||||
op.Write( Board );
|
||||
|
||||
op.Write( m_Name );
|
||||
op.Write( TeamName );
|
||||
|
||||
op.WriteEncodedInt( m_Color );
|
||||
op.WriteEncodedInt( Color );
|
||||
|
||||
op.Write( m_Goal );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if ( m_Name != null )
|
||||
if ( TeamName != null )
|
||||
return $"({Name}) ...";
|
||||
return "...";
|
||||
}
|
||||
|
|
@ -1403,48 +1362,36 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class BRController : EventController
|
||||
{
|
||||
private BRTeamInfo[] m_TeamInfo;
|
||||
private TimeSpan m_Duration;
|
||||
private Point3D m_BombHome;
|
||||
|
||||
public BRTeamInfo[] TeamInfo => m_TeamInfo;
|
||||
public BRTeamInfo[] TeamInfo { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRTeamInfo Team1 { get => m_TeamInfo[0];
|
||||
public BRTeamInfo Team1 { get => TeamInfo[0];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRTeamInfo Team2 { get => m_TeamInfo[1];
|
||||
public BRTeamInfo Team2 { get => TeamInfo[1];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRTeamInfo Team3 { get => m_TeamInfo[2];
|
||||
public BRTeamInfo Team3 { get => TeamInfo[2];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRTeamInfo Team4 { get => m_TeamInfo[3];
|
||||
public BRTeamInfo Team4 { get => TeamInfo[3];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D BombHome
|
||||
{
|
||||
get => m_BombHome;
|
||||
set => m_BombHome = value;
|
||||
}
|
||||
public Point3D BombHome { get; set; }
|
||||
|
||||
public override string Title => "Bombing Run";
|
||||
public override string DefaultName => "Bombing Run Controller";
|
||||
|
||||
public override string GetTeamName( int teamID )
|
||||
{
|
||||
return m_TeamInfo[teamID % m_TeamInfo.Length].Name;
|
||||
return TeamInfo[teamID % TeamInfo.Length].Name;
|
||||
}
|
||||
|
||||
public override EventGame Construct( DuelContext context )
|
||||
|
|
@ -1458,14 +1405,14 @@ namespace Server.Engines.ConPVP
|
|||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
|
||||
m_BombHome = Point3D.Zero;
|
||||
BombHome = Point3D.Zero;
|
||||
|
||||
m_TeamInfo = new BRTeamInfo[4];
|
||||
TeamInfo = new BRTeamInfo[4];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new BRTeamInfo( i );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new BRTeamInfo( i );
|
||||
}
|
||||
|
||||
public BRController( Serial serial )
|
||||
|
|
@ -1479,14 +1426,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( m_BombHome );
|
||||
writer.Write( BombHome );
|
||||
|
||||
writer.Write( m_Duration );
|
||||
writer.Write( Duration );
|
||||
|
||||
writer.WriteEncodedInt( m_TeamInfo.Length );
|
||||
writer.WriteEncodedInt( TeamInfo.Length );
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i].Serialize( writer );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -1499,14 +1446,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_BombHome = reader.ReadPoint3D();
|
||||
BombHome = reader.ReadPoint3D();
|
||||
|
||||
m_Duration = reader.ReadTimeSpan();
|
||||
Duration = reader.ReadTimeSpan();
|
||||
|
||||
m_TeamInfo = new BRTeamInfo[reader.ReadEncodedInt()];
|
||||
TeamInfo = new BRTeamInfo[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new BRTeamInfo( i, reader );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new BRTeamInfo( i, reader );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1535,12 +1482,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void ReturnBomb()
|
||||
{
|
||||
if ( m_Bomb != null && m_Controller != null )
|
||||
if ( m_Bomb != null && Controller != null )
|
||||
{
|
||||
if ( m_UnhideCallback == null )
|
||||
m_UnhideCallback = UnhideBomb;
|
||||
m_Bomb.Visible = false;
|
||||
m_Bomb.MoveToWorld( m_Controller.BombHome, m_Controller.Map );
|
||||
m_Bomb.MoveToWorld( Controller.BombHome, Controller.Map );
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 15 ) ), m_UnhideCallback );
|
||||
}
|
||||
}
|
||||
|
|
@ -1554,9 +1501,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
private BRController m_Controller;
|
||||
|
||||
public BRController Controller => m_Controller;
|
||||
public BRController Controller { get; }
|
||||
|
||||
public void Alert( string text )
|
||||
{
|
||||
|
|
@ -1581,7 +1526,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public BRGame( BRController controller, DuelContext context ) : base( context )
|
||||
{
|
||||
m_Controller = controller;
|
||||
Controller = controller;
|
||||
}
|
||||
|
||||
public Map Facet
|
||||
|
|
@ -1591,7 +1536,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Context.Arena != null )
|
||||
return m_Context.Arena.Facet;
|
||||
|
||||
return m_Controller.Map;
|
||||
return Controller.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1600,7 +1545,7 @@ namespace Server.Engines.ConPVP
|
|||
int teamID = GetTeamID( mob );
|
||||
|
||||
if ( teamID >= 0 )
|
||||
return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length];
|
||||
return Controller.TeamInfo[teamID % Controller.TeamInfo.Length];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1718,23 +1663,23 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStart()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
BRTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
BRTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
teamInfo.Game = this;
|
||||
teamInfo.Reset();
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color );
|
||||
ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color );
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
|
||||
m_Bomb = new BRBomb( this );
|
||||
ReturnBomb();
|
||||
|
||||
m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback );
|
||||
m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback );
|
||||
}
|
||||
|
||||
private void Finish_Callback()
|
||||
|
|
@ -1743,7 +1688,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
{
|
||||
BRTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length];
|
||||
BRTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length];
|
||||
|
||||
if ( teamInfo == null )
|
||||
continue;
|
||||
|
|
@ -1787,8 +1732,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Controller != null )
|
||||
sb.Append( ' ' ).Append( m_Controller.Title );
|
||||
if ( Controller != null )
|
||||
sb.Append( ' ' ).Append( Controller.Title );
|
||||
|
||||
string title = sb.ToString();
|
||||
|
||||
|
|
@ -1899,9 +1844,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStop()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
BRTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
BRTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
if ( teamInfo.Board != null )
|
||||
teamInfo.Board.m_TeamInfo = null;
|
||||
|
|
|
|||
|
|
@ -528,16 +528,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
private CTFTeamInfo m_TeamInfo;
|
||||
|
||||
private Mobile m_Player;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
public Mobile Player => m_Player;
|
||||
public Mobile Player { get; }
|
||||
|
||||
string IRankedCTF.Name => m_Player.Name;
|
||||
string IRankedCTF.Name => Player.Name;
|
||||
|
||||
public int Kills
|
||||
{
|
||||
|
|
@ -575,65 +573,31 @@ namespace Server.Engines.ConPVP
|
|||
public CTFPlayerInfo( CTFTeamInfo teamInfo, Mobile player )
|
||||
{
|
||||
m_TeamInfo = teamInfo;
|
||||
m_Player = player;
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public sealed class CTFTeamInfo : IRankedCTF
|
||||
{
|
||||
private CTFGame m_Game;
|
||||
private int m_TeamID;
|
||||
string IRankedCTF.Name => $"{Name} Team";
|
||||
|
||||
private int m_Color;
|
||||
private string m_Name;
|
||||
public CTFGame Game { get; set; }
|
||||
|
||||
private CTFBoard m_Board;
|
||||
public int TeamID { get; }
|
||||
|
||||
private CTFFlag m_Flag;
|
||||
private Point3D m_Origin;
|
||||
public int Kills { get; set; }
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
public int Captures { get; set; }
|
||||
|
||||
private int m_Score;
|
||||
public int Score { get; set; }
|
||||
|
||||
private Dictionary<Mobile, CTFPlayerInfo> m_Players;
|
||||
|
||||
string IRankedCTF.Name => $"{m_Name} Team";
|
||||
|
||||
public CTFGame Game { get => m_Game;
|
||||
set => m_Game = value;
|
||||
}
|
||||
public int TeamID => m_TeamID;
|
||||
|
||||
public int Kills { get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Captures { get => m_Captures;
|
||||
set => m_Captures = value;
|
||||
}
|
||||
|
||||
public int Score { get => m_Score;
|
||||
set => m_Score = value;
|
||||
}
|
||||
|
||||
private CTFPlayerInfo m_Leader;
|
||||
|
||||
public CTFPlayerInfo Leader
|
||||
{
|
||||
get => m_Leader;
|
||||
set => m_Leader = value;
|
||||
}
|
||||
public CTFPlayerInfo Leader { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFBoard Board
|
||||
{
|
||||
get => m_Board;
|
||||
set => m_Board = value;
|
||||
}
|
||||
public CTFBoard Board { get; set; }
|
||||
|
||||
public Dictionary<Mobile, CTFPlayerInfo> Players => m_Players;
|
||||
public Dictionary<Mobile, CTFPlayerInfo> Players { get; }
|
||||
|
||||
public CTFPlayerInfo this[Mobile mob]
|
||||
{
|
||||
|
|
@ -642,73 +606,57 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
if (!m_Players.TryGetValue( mob, out CTFPlayerInfo val ))
|
||||
m_Players[mob] = val = new CTFPlayerInfo( this, mob );
|
||||
if (!Players.TryGetValue( mob, out CTFPlayerInfo val ))
|
||||
Players[mob] = val = new CTFPlayerInfo( this, mob );
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Color
|
||||
{
|
||||
get => m_Color;
|
||||
set => m_Color = value;
|
||||
}
|
||||
public int Color { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Name
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
public string Name { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFFlag Flag
|
||||
{
|
||||
get => m_Flag;
|
||||
set => m_Flag = value;
|
||||
}
|
||||
public CTFFlag Flag { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Origin
|
||||
{
|
||||
get => m_Origin;
|
||||
set => m_Origin = value;
|
||||
}
|
||||
public Point3D Origin { get; set; }
|
||||
|
||||
public CTFTeamInfo( int teamID )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Dictionary<Mobile, CTFPlayerInfo>();
|
||||
TeamID = teamID;
|
||||
Players = new Dictionary<Mobile, CTFPlayerInfo>();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Kills = 0;
|
||||
m_Captures = 0;
|
||||
Kills = 0;
|
||||
Captures = 0;
|
||||
|
||||
m_Score = 0;
|
||||
Score = 0;
|
||||
|
||||
m_Leader = null;
|
||||
Leader = null;
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
|
||||
if ( m_Flag != null )
|
||||
if ( Flag != null )
|
||||
{
|
||||
m_Flag.m_TeamInfo = this;
|
||||
m_Flag.Hue = m_Color;
|
||||
m_Flag.SendHome();
|
||||
Flag.m_TeamInfo = this;
|
||||
Flag.Hue = Color;
|
||||
Flag.SendHome();
|
||||
}
|
||||
|
||||
if ( m_Board != null )
|
||||
m_Board.m_TeamInfo = this;
|
||||
if ( Board != null )
|
||||
Board.m_TeamInfo = this;
|
||||
}
|
||||
|
||||
public CTFTeamInfo( int teamID, GenericReader ip )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Dictionary<Mobile, CTFPlayerInfo>();
|
||||
TeamID = teamID;
|
||||
Players = new Dictionary<Mobile, CTFPlayerInfo>();
|
||||
|
||||
int version = ip.ReadEncodedInt();
|
||||
|
||||
|
|
@ -716,22 +664,22 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_Board = ip.ReadItem() as CTFBoard;
|
||||
Board = ip.ReadItem() as CTFBoard;
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Name = ip.ReadString();
|
||||
Name = ip.ReadString();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Color = ip.ReadEncodedInt();
|
||||
Color = ip.ReadEncodedInt();
|
||||
|
||||
m_Flag = ip.ReadItem() as CTFFlag;
|
||||
m_Origin = ip.ReadPoint3D();
|
||||
Flag = ip.ReadItem() as CTFFlag;
|
||||
Origin = ip.ReadPoint3D();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -741,14 +689,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
op.WriteEncodedInt( 2 ); // version
|
||||
|
||||
op.Write( m_Board );
|
||||
op.Write( Board );
|
||||
|
||||
op.Write( m_Name );
|
||||
op.Write( Name );
|
||||
|
||||
op.WriteEncodedInt( m_Color );
|
||||
op.WriteEncodedInt( Color );
|
||||
|
||||
op.Write( m_Flag );
|
||||
op.Write( m_Origin );
|
||||
op.Write( Flag );
|
||||
op.Write( Origin );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
@ -759,56 +707,48 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class CTFController : EventController
|
||||
{
|
||||
private CTFTeamInfo[] m_TeamInfo;
|
||||
|
||||
private TimeSpan m_Duration;
|
||||
|
||||
public CTFTeamInfo[] TeamInfo => m_TeamInfo;
|
||||
public CTFTeamInfo[] TeamInfo { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team1 { get => m_TeamInfo[0];
|
||||
public CTFTeamInfo Team1 { get => TeamInfo[0];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team2 { get => m_TeamInfo[1];
|
||||
public CTFTeamInfo Team2 { get => TeamInfo[1];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team3 { get => m_TeamInfo[2];
|
||||
public CTFTeamInfo Team3 { get => TeamInfo[2];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team4 { get => m_TeamInfo[3];
|
||||
public CTFTeamInfo Team4 { get => TeamInfo[3];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team5 { get => m_TeamInfo[4];
|
||||
public CTFTeamInfo Team5 { get => TeamInfo[4];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team6 { get => m_TeamInfo[5];
|
||||
public CTFTeamInfo Team6 { get => TeamInfo[5];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team7 { get => m_TeamInfo[6];
|
||||
public CTFTeamInfo Team7 { get => TeamInfo[6];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team8 { get => m_TeamInfo[7];
|
||||
public CTFTeamInfo Team8 { get => TeamInfo[7];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
public override string Title => "CTF";
|
||||
|
||||
public override string GetTeamName( int teamID )
|
||||
{
|
||||
return m_TeamInfo[teamID % m_TeamInfo.Length].Name;
|
||||
return TeamInfo[teamID % TeamInfo.Length].Name;
|
||||
}
|
||||
|
||||
public override EventGame Construct( DuelContext context )
|
||||
|
|
@ -822,12 +762,12 @@ namespace Server.Engines.ConPVP
|
|||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
|
||||
m_TeamInfo = new CTFTeamInfo[8];
|
||||
TeamInfo = new CTFTeamInfo[8];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new CTFTeamInfo( i );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new CTFTeamInfo( i );
|
||||
}
|
||||
|
||||
public CTFController( Serial serial )
|
||||
|
|
@ -841,12 +781,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int) 2 );
|
||||
|
||||
writer.Write( m_Duration );
|
||||
writer.Write( Duration );
|
||||
|
||||
writer.WriteEncodedInt( m_TeamInfo.Length );
|
||||
writer.WriteEncodedInt( TeamInfo.Length );
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i].Serialize( writer );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -859,32 +799,32 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_Duration = reader.ReadTimeSpan();
|
||||
Duration = reader.ReadTimeSpan();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_TeamInfo = new CTFTeamInfo[reader.ReadEncodedInt()];
|
||||
TeamInfo = new CTFTeamInfo[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new CTFTeamInfo( i, reader );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new CTFTeamInfo( i, reader );
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_TeamInfo = new CTFTeamInfo[8];
|
||||
TeamInfo = new CTFTeamInfo[8];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new CTFTeamInfo( i );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new CTFTeamInfo( i );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version < 2 )
|
||||
m_Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -896,9 +836,7 @@ namespace Server.Engines.ConPVP
|
|||
TileData.ItemTable[i].Flags |= TileFlag.NoShoot;
|
||||
}
|
||||
|
||||
private CTFController m_Controller;
|
||||
|
||||
public CTFController Controller => m_Controller;
|
||||
public CTFController Controller { get; }
|
||||
|
||||
public void Alert( string text )
|
||||
{
|
||||
|
|
@ -923,7 +861,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public CTFGame( CTFController controller, DuelContext context ) : base( context )
|
||||
{
|
||||
m_Controller = controller;
|
||||
Controller = controller;
|
||||
}
|
||||
|
||||
public Map Facet
|
||||
|
|
@ -933,7 +871,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Context.Arena != null )
|
||||
return m_Context.Arena.Facet;
|
||||
|
||||
return m_Controller.Map;
|
||||
return Controller.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -942,7 +880,7 @@ namespace Server.Engines.ConPVP
|
|||
int teamID = GetTeamID( mob );
|
||||
|
||||
if ( teamID >= 0 )
|
||||
return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length];
|
||||
return Controller.TeamInfo[teamID % Controller.TeamInfo.Length];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1052,15 +990,15 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob.InRange( teamInfo.Origin, 24 ) && mob.Map == Facet )
|
||||
playerInfo.Score += 1; // fragged in base -- guarding
|
||||
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
if ( m_Controller.TeamInfo[i] == teamInfo )
|
||||
if ( Controller.TeamInfo[i] == teamInfo )
|
||||
continue;
|
||||
|
||||
Mobile ourFlagCarrier = null;
|
||||
|
||||
if ( m_Controller.TeamInfo[i].Flag != null )
|
||||
ourFlagCarrier = m_Controller.TeamInfo[i].Flag.RootParent as Mobile;
|
||||
if ( Controller.TeamInfo[i].Flag != null )
|
||||
ourFlagCarrier = Controller.TeamInfo[i].Flag.RootParent as Mobile;
|
||||
|
||||
if ( ourFlagCarrier != null && GetTeamInfo( ourFlagCarrier ) == teamInfo )
|
||||
{
|
||||
|
|
@ -1094,20 +1032,20 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStart()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
CTFTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
CTFTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
teamInfo.Game = this;
|
||||
teamInfo.Reset();
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % 8].Color );
|
||||
ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % 8].Color );
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
|
||||
m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback );
|
||||
m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback );
|
||||
}
|
||||
|
||||
private void Finish_Callback()
|
||||
|
|
@ -1116,7 +1054,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
{
|
||||
CTFTeamInfo teamInfo = m_Controller.TeamInfo[i % 8];
|
||||
CTFTeamInfo teamInfo = Controller.TeamInfo[i % 8];
|
||||
|
||||
if ( teamInfo?.Flag == null )
|
||||
continue;
|
||||
|
|
@ -1163,8 +1101,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Controller != null )
|
||||
sb.Append( ' ' ).Append( m_Controller.Title );
|
||||
if ( Controller != null )
|
||||
sb.Append( ' ' ).Append( Controller.Title );
|
||||
|
||||
string title = sb.ToString();
|
||||
|
||||
|
|
@ -1277,9 +1215,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStop()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
CTFTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
CTFTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
if ( teamInfo.Flag != null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -223,16 +223,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
private DDTeamInfo m_TeamInfo;
|
||||
|
||||
private Mobile m_Player;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
public Mobile Player => m_Player;
|
||||
public Mobile Player { get; }
|
||||
|
||||
public string Name => m_Player.Name;
|
||||
public string Name => Player.Name;
|
||||
|
||||
public int Kills
|
||||
{
|
||||
|
|
@ -270,64 +268,31 @@ namespace Server.Engines.ConPVP
|
|||
public DDPlayerInfo( DDTeamInfo teamInfo, Mobile player )
|
||||
{
|
||||
m_TeamInfo = teamInfo;
|
||||
m_Player = player;
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public sealed class DDTeamInfo : IRankedCTF
|
||||
{
|
||||
private DDGame m_Game;
|
||||
private int m_TeamID;
|
||||
public string Name => $"{TeamName} Team";
|
||||
|
||||
private int m_Color;
|
||||
private string m_Name;
|
||||
public DDGame Game { get; set; }
|
||||
|
||||
private DDBoard m_Board;
|
||||
public int TeamID { get; }
|
||||
|
||||
private Point3D m_Origin;
|
||||
public int Kills { get; set; }
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
public int Captures { get; set; }
|
||||
|
||||
private int m_Score;
|
||||
public int Score { get; set; }
|
||||
|
||||
private Dictionary<Mobile, DDPlayerInfo> m_Players;
|
||||
|
||||
public string Name => $"{m_Name} Team";
|
||||
|
||||
public DDGame Game { get => m_Game;
|
||||
set => m_Game = value;
|
||||
}
|
||||
public int TeamID => m_TeamID;
|
||||
|
||||
public int Kills { get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Captures { get => m_Captures;
|
||||
set => m_Captures = value;
|
||||
}
|
||||
|
||||
public int Score { get => m_Score;
|
||||
set => m_Score = value;
|
||||
}
|
||||
|
||||
private DDPlayerInfo m_Leader;
|
||||
|
||||
public DDPlayerInfo Leader
|
||||
{
|
||||
get => m_Leader;
|
||||
set => m_Leader = value;
|
||||
}
|
||||
public DDPlayerInfo Leader { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDBoard Board
|
||||
{
|
||||
get => m_Board;
|
||||
set => m_Board = value;
|
||||
}
|
||||
public DDBoard Board { get; set; }
|
||||
|
||||
public Dictionary<Mobile, DDPlayerInfo> Players => m_Players;
|
||||
public Dictionary<Mobile, DDPlayerInfo> Players { get; }
|
||||
|
||||
public DDPlayerInfo this[Mobile mob]
|
||||
{
|
||||
|
|
@ -336,59 +301,47 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
if (!m_Players.TryGetValue( mob, out DDPlayerInfo val ))
|
||||
m_Players[mob] = val = new DDPlayerInfo( this, mob );
|
||||
if (!Players.TryGetValue( mob, out DDPlayerInfo val ))
|
||||
Players[mob] = val = new DDPlayerInfo( this, mob );
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Color
|
||||
{
|
||||
get => m_Color;
|
||||
set => m_Color = value;
|
||||
}
|
||||
public int Color { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TeamName
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
public string TeamName { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Origin
|
||||
{
|
||||
get => m_Origin;
|
||||
set => m_Origin = value;
|
||||
}
|
||||
public Point3D Origin { get; set; }
|
||||
|
||||
public DDTeamInfo( int teamID )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Dictionary<Mobile, DDPlayerInfo>();
|
||||
TeamID = teamID;
|
||||
Players = new Dictionary<Mobile, DDPlayerInfo>();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Kills = 0;
|
||||
m_Captures = 0;
|
||||
Kills = 0;
|
||||
Captures = 0;
|
||||
|
||||
m_Score = 0;
|
||||
Score = 0;
|
||||
|
||||
m_Leader = null;
|
||||
Leader = null;
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
|
||||
if ( m_Board != null )
|
||||
m_Board.m_TeamInfo = this;
|
||||
if ( Board != null )
|
||||
Board.m_TeamInfo = this;
|
||||
}
|
||||
|
||||
public DDTeamInfo( int teamID, GenericReader ip )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Dictionary<Mobile, DDPlayerInfo>();
|
||||
TeamID = teamID;
|
||||
Players = new Dictionary<Mobile, DDPlayerInfo>();
|
||||
|
||||
int version = ip.ReadEncodedInt();
|
||||
|
||||
|
|
@ -396,10 +349,10 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Board = ip.ReadItem() as DDBoard;
|
||||
m_Name = ip.ReadString();
|
||||
m_Color = ip.ReadEncodedInt();
|
||||
m_Origin = ip.ReadPoint3D();
|
||||
Board = ip.ReadItem() as DDBoard;
|
||||
TeamName = ip.ReadString();
|
||||
Color = ip.ReadEncodedInt();
|
||||
Origin = ip.ReadPoint3D();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -409,10 +362,10 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
op.WriteEncodedInt( 0 ); // version
|
||||
|
||||
op.Write( m_Board );
|
||||
op.Write( m_Name );
|
||||
op.WriteEncodedInt( m_Color );
|
||||
op.Write( m_Origin );
|
||||
op.Write( Board );
|
||||
op.Write( TeamName );
|
||||
op.WriteEncodedInt( Color );
|
||||
op.Write( Origin );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
@ -423,44 +376,30 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class DDController : EventController
|
||||
{
|
||||
private DDTeamInfo[] m_TeamInfo;
|
||||
|
||||
private TimeSpan m_Duration;
|
||||
|
||||
public DDTeamInfo[] TeamInfo => m_TeamInfo;
|
||||
public DDTeamInfo[] TeamInfo { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDTeamInfo Team1 { get => m_TeamInfo[0];
|
||||
public DDTeamInfo Team1 { get => TeamInfo[0];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDTeamInfo Team2 { get => m_TeamInfo[1];
|
||||
public DDTeamInfo Team2 { get => TeamInfo[1];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDWayPoint PointA { get => m_PointA;
|
||||
set => m_PointA = value;
|
||||
}
|
||||
public DDWayPoint PointA { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDWayPoint PointB { get => m_PointB;
|
||||
set => m_PointB = value;
|
||||
}
|
||||
|
||||
private DDWayPoint m_PointA, m_PointB;
|
||||
public DDWayPoint PointB { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
public override string Title => "DoubleDom";
|
||||
|
||||
public override string GetTeamName( int teamID )
|
||||
{
|
||||
return m_TeamInfo[teamID % m_TeamInfo.Length].Name;
|
||||
return TeamInfo[teamID % TeamInfo.Length].Name;
|
||||
}
|
||||
|
||||
public override EventGame Construct( DuelContext context )
|
||||
|
|
@ -476,12 +415,12 @@ namespace Server.Engines.ConPVP
|
|||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
|
||||
m_TeamInfo = new DDTeamInfo[2];
|
||||
TeamInfo = new DDTeamInfo[2];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new DDTeamInfo( i );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new DDTeamInfo( i );
|
||||
}
|
||||
|
||||
public DDController( Serial serial )
|
||||
|
|
@ -495,15 +434,15 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int)0 );
|
||||
|
||||
writer.Write( m_Duration );
|
||||
writer.Write( Duration );
|
||||
|
||||
writer.WriteEncodedInt( m_TeamInfo.Length );
|
||||
writer.WriteEncodedInt( TeamInfo.Length );
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i].Serialize( writer );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i].Serialize( writer );
|
||||
|
||||
writer.Write( m_PointA );
|
||||
writer.Write( m_PointB );
|
||||
writer.Write( PointA );
|
||||
writer.Write( PointB );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -516,14 +455,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Duration = reader.ReadTimeSpan();
|
||||
m_TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()];
|
||||
Duration = reader.ReadTimeSpan();
|
||||
TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new DDTeamInfo( i, reader );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new DDTeamInfo( i, reader );
|
||||
|
||||
m_PointA = reader.ReadItem() as DDWayPoint;
|
||||
m_PointB = reader.ReadItem() as DDWayPoint;
|
||||
PointA = reader.ReadItem() as DDWayPoint;
|
||||
PointB = reader.ReadItem() as DDWayPoint;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -533,9 +472,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class DDGame : EventGame
|
||||
{
|
||||
private DDController m_Controller;
|
||||
|
||||
public DDController Controller => m_Controller;
|
||||
public DDController Controller { get; }
|
||||
|
||||
public void Alert( string text )
|
||||
{
|
||||
|
|
@ -560,7 +497,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DDGame( DDController controller, DuelContext context ) : base( context )
|
||||
{
|
||||
m_Controller = controller;
|
||||
Controller = controller;
|
||||
}
|
||||
|
||||
public Map Facet
|
||||
|
|
@ -570,7 +507,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Context.Arena != null )
|
||||
return m_Context.Arena.Facet;
|
||||
|
||||
return m_Controller.Map;
|
||||
return Controller.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -579,7 +516,7 @@ namespace Server.Engines.ConPVP
|
|||
int teamID = GetTeamID( mob );
|
||||
|
||||
if ( teamID >= 0 )
|
||||
return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length];
|
||||
return Controller.TeamInfo[teamID % Controller.TeamInfo.Length];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -706,25 +643,25 @@ namespace Server.Engines.ConPVP
|
|||
m_UncaptureTimer = null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
DDTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
DDTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
teamInfo.Game = this;
|
||||
teamInfo.Reset();
|
||||
}
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
m_Controller.PointA.Game = this;
|
||||
if ( Controller.PointA != null )
|
||||
Controller.PointA.Game = this;
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
m_Controller.PointB.Game = this;
|
||||
if ( Controller.PointB != null )
|
||||
Controller.PointB.Game = this;
|
||||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color );
|
||||
ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color );
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback );
|
||||
m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback );
|
||||
}
|
||||
|
||||
private void Finish_Callback()
|
||||
|
|
@ -733,7 +670,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
{
|
||||
DDTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length];
|
||||
DDTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length];
|
||||
|
||||
if ( teamInfo != null )
|
||||
teams.Add( teamInfo );
|
||||
|
|
@ -775,8 +712,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Controller != null )
|
||||
sb.Append( ' ' ).Append( m_Controller.Title );
|
||||
if ( Controller != null )
|
||||
sb.Append( ' ' ).Append( Controller.Title );
|
||||
|
||||
string title = sb.ToString();
|
||||
|
||||
|
|
@ -889,9 +826,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStop()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
DDTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
DDTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
if ( teamInfo.Board != null )
|
||||
teamInfo.Board.m_TeamInfo = null;
|
||||
|
|
@ -899,11 +836,11 @@ namespace Server.Engines.ConPVP
|
|||
teamInfo.Game = null;
|
||||
}
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
m_Controller.PointA.Game = null;
|
||||
if ( Controller.PointA != null )
|
||||
Controller.PointA.Game = null;
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
m_Controller.PointB.Game = null;
|
||||
if ( Controller.PointB != null )
|
||||
Controller.PointB.Game = null;
|
||||
|
||||
m_Capturable = false;
|
||||
|
||||
|
|
@ -936,21 +873,21 @@ namespace Server.Engines.ConPVP
|
|||
if ( point == null || from == null || team == null || !m_Capturable )
|
||||
return;
|
||||
|
||||
bool wasDom = ( m_Controller.PointA != null && m_Controller.PointB != null &&
|
||||
m_Controller.PointA.TeamOwner == m_Controller.PointB.TeamOwner && m_Controller.PointA.TeamOwner != null );
|
||||
bool wasDom = ( Controller.PointA != null && Controller.PointB != null &&
|
||||
Controller.PointA.TeamOwner == Controller.PointB.TeamOwner && Controller.PointA.TeamOwner != null );
|
||||
|
||||
point.TeamOwner = team;
|
||||
Alert( "{0} has captured {1}!", team.Name, point.Name );
|
||||
|
||||
bool isDom = ( m_Controller.PointA != null && m_Controller.PointB != null &&
|
||||
m_Controller.PointA.TeamOwner == m_Controller.PointB.TeamOwner && m_Controller.PointA.TeamOwner != null );
|
||||
bool isDom = ( Controller.PointA != null && Controller.PointB != null &&
|
||||
Controller.PointA.TeamOwner == Controller.PointB.TeamOwner && Controller.PointA.TeamOwner != null );
|
||||
|
||||
if ( wasDom && !isDom )
|
||||
{
|
||||
Alert( "Domination averted!" );
|
||||
|
||||
m_Controller.PointA?.SetNonCaptureHue();
|
||||
m_Controller.PointB?.SetNonCaptureHue();
|
||||
Controller.PointA?.SetNonCaptureHue();
|
||||
Controller.PointB?.SetNonCaptureHue();
|
||||
m_CaptureTimer?.Stop();
|
||||
m_CaptureTimer = null;
|
||||
}
|
||||
|
|
@ -967,10 +904,10 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DDTeamInfo team = null;
|
||||
|
||||
if ( m_Controller.PointA?.TeamOwner != null )
|
||||
team = m_Controller.PointA.TeamOwner;
|
||||
else if ( m_Controller.PointB?.TeamOwner != null )
|
||||
team = m_Controller.PointB.TeamOwner;
|
||||
if ( Controller.PointA?.TeamOwner != null )
|
||||
team = Controller.PointA.TeamOwner;
|
||||
else if ( Controller.PointB?.TeamOwner != null )
|
||||
team = Controller.PointB.TeamOwner;
|
||||
|
||||
if ( team == null )
|
||||
{
|
||||
|
|
@ -984,8 +921,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Alert( "{0} is dominating... {1}", team.Name, 10 - m_CapStage );
|
||||
|
||||
m_Controller.PointA?.SetCaptureHue( m_CapStage );
|
||||
m_Controller.PointB?.SetCaptureHue( m_CapStage );
|
||||
Controller.PointA?.SetCaptureHue( m_CapStage );
|
||||
Controller.PointB?.SetCaptureHue( m_CapStage );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -999,16 +936,16 @@ namespace Server.Engines.ConPVP
|
|||
m_CaptureTimer.Stop();
|
||||
m_CaptureTimer = null;
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
if ( Controller.PointA != null )
|
||||
{
|
||||
m_Controller.PointA.TeamOwner = null;
|
||||
m_Controller.PointA.SetUncapturableHue();
|
||||
Controller.PointA.TeamOwner = null;
|
||||
Controller.PointA.SetUncapturableHue();
|
||||
}
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
if ( Controller.PointB != null )
|
||||
{
|
||||
m_Controller.PointB.TeamOwner = null;
|
||||
m_Controller.PointB.SetUncapturableHue();
|
||||
Controller.PointB.TeamOwner = null;
|
||||
Controller.PointB.SetUncapturableHue();
|
||||
}
|
||||
|
||||
m_UncaptureTimer = Timer.DelayCall( TimeSpan.FromSeconds( 30.0 ), UncaptureTick );
|
||||
|
|
@ -1032,16 +969,16 @@ namespace Server.Engines.ConPVP
|
|||
m_UncaptureTimer = null;
|
||||
}
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
if ( Controller.PointA != null )
|
||||
{
|
||||
m_Controller.PointA.TeamOwner = null;
|
||||
m_Controller.PointA.SetNonCaptureHue();
|
||||
Controller.PointA.TeamOwner = null;
|
||||
Controller.PointA.SetNonCaptureHue();
|
||||
}
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
if ( Controller.PointB != null )
|
||||
{
|
||||
m_Controller.PointB.TeamOwner = null;
|
||||
m_Controller.PointB.SetNonCaptureHue();
|
||||
Controller.PointB.TeamOwner = null;
|
||||
Controller.PointB.SetNonCaptureHue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,18 +11,16 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class HillOfTheKing : Item
|
||||
{
|
||||
private int m_ScoreInterval;
|
||||
private KHGame m_Game;
|
||||
private Mobile m_King;
|
||||
private KingTimer m_KingTimer;
|
||||
private KHGame m_Game;
|
||||
private KingTimer m_KingTimer;
|
||||
|
||||
[Constructible]
|
||||
public HillOfTheKing()
|
||||
: base(0x520)
|
||||
{
|
||||
m_ScoreInterval = 10;
|
||||
ScoreInterval = 10;
|
||||
m_Game = null;
|
||||
m_King = null;
|
||||
King = null;
|
||||
Movable = false;
|
||||
|
||||
Name = "the hill";
|
||||
|
|
@ -43,7 +41,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_ScoreInterval = reader.ReadEncodedInt();
|
||||
ScoreInterval = reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -55,10 +53,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.WriteEncodedInt(m_ScoreInterval);
|
||||
writer.WriteEncodedInt(ScoreInterval);
|
||||
}
|
||||
|
||||
public Mobile King => m_King;
|
||||
public Mobile King { get; private set; }
|
||||
|
||||
public KHGame Game
|
||||
{
|
||||
|
|
@ -69,17 +67,15 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_KingTimer?.Stop();
|
||||
m_Game = value;
|
||||
m_King = null;
|
||||
King = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ScoreInterval { get => m_ScoreInterval;
|
||||
set => m_ScoreInterval = value;
|
||||
}
|
||||
public int ScoreInterval { get; set; }
|
||||
|
||||
public int CapturesSoFar
|
||||
public int CapturesSoFar
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -100,7 +96,7 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
|
||||
// Not current king (or they are the current king)
|
||||
if (m_King != null && m_King != m)
|
||||
if (King != null && King != m)
|
||||
return false;
|
||||
|
||||
// They are on a team
|
||||
|
|
@ -137,7 +133,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (base.OnMoveOff(m))
|
||||
{
|
||||
if (m_King == m)
|
||||
if (King == m)
|
||||
DeKingify();
|
||||
|
||||
return true;
|
||||
|
|
@ -169,7 +165,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_KingTimer?.Stop();
|
||||
|
||||
m_King = null;
|
||||
King = null;
|
||||
}
|
||||
|
||||
private void ReKingify(Mobile m)
|
||||
|
|
@ -182,30 +178,29 @@ namespace Server.Engines.ConPVP
|
|||
if (ti == null)
|
||||
return;
|
||||
|
||||
m_King = m;
|
||||
King = m;
|
||||
|
||||
if (m_KingTimer == null)
|
||||
m_KingTimer = new KingTimer(this);
|
||||
m_KingTimer.Stop();
|
||||
m_KingTimer.StartHillTicker();
|
||||
|
||||
if (m_King.Name != null)
|
||||
PublicOverheadMessage(MessageType.Regular, 0x0481, false, $"Taken by {m_King.Name}!");
|
||||
if (King.Name != null)
|
||||
PublicOverheadMessage(MessageType.Regular, 0x0481, false, $"Taken by {King.Name}!");
|
||||
}
|
||||
|
||||
private class KingTimer : Timer
|
||||
{
|
||||
private HillOfTheKing m_Hill;
|
||||
private int m_Total;
|
||||
private int m_Counter;
|
||||
private int m_Counter;
|
||||
|
||||
public int Captures => m_Total;
|
||||
public int Captures { get; private set; }
|
||||
|
||||
public KingTimer(HillOfTheKing hill)
|
||||
public KingTimer(HillOfTheKing hill)
|
||||
: base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Hill = hill;
|
||||
m_Total = 0;
|
||||
Captures = 0;
|
||||
m_Counter = 0;
|
||||
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
|
|
@ -213,7 +208,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void StartHillTicker()
|
||||
{
|
||||
m_Total = 0;
|
||||
Captures = 0;
|
||||
m_Counter = 0;
|
||||
|
||||
Start();
|
||||
|
|
@ -268,7 +263,7 @@ namespace Server.Engines.ConPVP
|
|||
m_Hill.PublicOverheadMessage(MessageType.Regular, 0x0481, false, "Capture!");
|
||||
|
||||
pi.Captures++;
|
||||
m_Total++;
|
||||
Captures++;
|
||||
|
||||
pi.Score += m_Counter;
|
||||
|
||||
|
|
@ -512,21 +507,19 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
private KHTeamInfo m_TeamInfo;
|
||||
|
||||
private Mobile m_Player;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
private int m_Score;
|
||||
|
||||
public KHPlayerInfo(KHTeamInfo teamInfo, Mobile player)
|
||||
{
|
||||
m_TeamInfo = teamInfo;
|
||||
m_Player = player;
|
||||
Player = player;
|
||||
}
|
||||
|
||||
public Mobile Player => m_Player;
|
||||
public Mobile Player { get; }
|
||||
|
||||
public int CompareTo(object obj)
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
KHPlayerInfo pi = (KHPlayerInfo)obj;
|
||||
int res = pi.Score.CompareTo(Score);
|
||||
|
|
@ -544,9 +537,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
if (m_Player?.Name == null)
|
||||
if (Player?.Name == null)
|
||||
return "";
|
||||
return m_Player.Name;
|
||||
return Player.Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -587,20 +580,7 @@ namespace Server.Engines.ConPVP
|
|||
[PropertyObject]
|
||||
public sealed class KHTeamInfo : IRankedCTF, IComparable
|
||||
{
|
||||
private KHGame m_Game;
|
||||
private int m_TeamID;
|
||||
|
||||
private int m_Color;
|
||||
private string m_Name;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
private Hashtable m_Players;
|
||||
|
||||
public int CompareTo(object obj)
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
KHTeamInfo ti = (KHTeamInfo)obj;
|
||||
int res = ti.Score.CompareTo(Score);
|
||||
|
|
@ -618,36 +598,25 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
if (m_Name == null)
|
||||
if (TeamName == null)
|
||||
return "(null) Team";
|
||||
return $"{m_Name} Team";
|
||||
return $"{TeamName} Team";
|
||||
}
|
||||
}
|
||||
|
||||
public KHGame Game { get => m_Game;
|
||||
set => m_Game = value;
|
||||
}
|
||||
public int TeamID => m_TeamID;
|
||||
public KHGame Game { get; set; }
|
||||
|
||||
public int Kills { get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Captures { get => m_Captures;
|
||||
set => m_Captures = value;
|
||||
}
|
||||
public int Score { get => m_Score;
|
||||
set => m_Score = value;
|
||||
}
|
||||
public int TeamID { get; }
|
||||
|
||||
private KHPlayerInfo m_Leader;
|
||||
public int Kills { get; set; }
|
||||
|
||||
public KHPlayerInfo Leader
|
||||
{
|
||||
get => m_Leader;
|
||||
set => m_Leader = value;
|
||||
}
|
||||
public int Captures { get; set; }
|
||||
|
||||
public Hashtable Players => m_Players;
|
||||
public int Score { get; set; }
|
||||
|
||||
public KHPlayerInfo Leader { get; set; }
|
||||
|
||||
public Hashtable Players { get; }
|
||||
|
||||
public KHPlayerInfo this[Mobile mob]
|
||||
{
|
||||
|
|
@ -656,48 +625,40 @@ namespace Server.Engines.ConPVP
|
|||
if (mob == null)
|
||||
return null;
|
||||
|
||||
if (!(m_Players[mob] is KHPlayerInfo val))
|
||||
m_Players[mob] = val = new KHPlayerInfo(this, mob);
|
||||
if (!(Players[mob] is KHPlayerInfo val))
|
||||
Players[mob] = val = new KHPlayerInfo(this, mob);
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Color
|
||||
{
|
||||
get => m_Color;
|
||||
set => m_Color = value;
|
||||
}
|
||||
public int Color { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string TeamName
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string TeamName { get; set; }
|
||||
|
||||
public KHTeamInfo(int teamID)
|
||||
public KHTeamInfo(int teamID)
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Hashtable();
|
||||
TeamID = teamID;
|
||||
Players = new Hashtable();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Kills = 0;
|
||||
m_Captures = 0;
|
||||
m_Score = 0;
|
||||
Kills = 0;
|
||||
Captures = 0;
|
||||
Score = 0;
|
||||
|
||||
m_Leader = null;
|
||||
Leader = null;
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
}
|
||||
|
||||
public KHTeamInfo(int teamID, GenericReader ip)
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Hashtable();
|
||||
TeamID = teamID;
|
||||
Players = new Hashtable();
|
||||
|
||||
int version = ip.ReadEncodedInt();
|
||||
|
||||
|
|
@ -705,8 +666,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Name = ip.ReadString();
|
||||
m_Color = ip.ReadEncodedInt();
|
||||
TeamName = ip.ReadString();
|
||||
Color = ip.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -716,13 +677,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
op.WriteEncodedInt(0); // version
|
||||
|
||||
op.Write(m_Name);
|
||||
op.WriteEncodedInt(m_Color);
|
||||
op.Write(TeamName);
|
||||
op.WriteEncodedInt(Color);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (m_Name != null)
|
||||
if (TeamName != null)
|
||||
return $"({Name}) ...";
|
||||
return "...";
|
||||
}
|
||||
|
|
@ -730,82 +691,74 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class KHController : EventController
|
||||
{
|
||||
private KHTeamInfo[] m_TeamInfo;
|
||||
private HillOfTheKing[] m_Hills;
|
||||
private ArrayList m_Boards;
|
||||
private TimeSpan m_Duration;
|
||||
private int m_ScoreInterval;
|
||||
private int m_ScoreInterval;
|
||||
|
||||
public KHTeamInfo[] TeamInfo => m_TeamInfo;
|
||||
public KHTeamInfo[] TeamInfo { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team1_W { get => m_TeamInfo[0];
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team1_W { get => TeamInfo[0];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team2_E { get => m_TeamInfo[1];
|
||||
public KHTeamInfo Team2_E { get => TeamInfo[1];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team3_N { get => m_TeamInfo[2];
|
||||
public KHTeamInfo Team3_N { get => TeamInfo[2];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team4_S { get => m_TeamInfo[3];
|
||||
public KHTeamInfo Team4_S { get => TeamInfo[3];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team5_NW { get => m_TeamInfo[4];
|
||||
public KHTeamInfo Team5_NW { get => TeamInfo[4];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team6_SE { get => m_TeamInfo[5];
|
||||
public KHTeamInfo Team6_SE { get => TeamInfo[5];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team7_SW { get => m_TeamInfo[6];
|
||||
public KHTeamInfo Team7_SW { get => TeamInfo[6];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team8_NE { get => m_TeamInfo[7];
|
||||
public KHTeamInfo Team8_NE { get => TeamInfo[7];
|
||||
set { } }
|
||||
|
||||
public HillOfTheKing[] Hills => m_Hills;
|
||||
public HillOfTheKing[] Hills { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill1 { get => m_Hills[0];
|
||||
set => m_Hills[0] = value;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill1 { get => Hills[0];
|
||||
set => Hills[0] = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill2 { get => m_Hills[1];
|
||||
set => m_Hills[1] = value;
|
||||
public HillOfTheKing Hill2 { get => Hills[1];
|
||||
set => Hills[1] = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill3 { get => m_Hills[2];
|
||||
set => m_Hills[2] = value;
|
||||
public HillOfTheKing Hill3 { get => Hills[2];
|
||||
set => Hills[2] = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill4 { get => m_Hills[3];
|
||||
set => m_Hills[3] = value;
|
||||
public HillOfTheKing Hill4 { get => Hills[3];
|
||||
set => Hills[3] = value;
|
||||
}
|
||||
|
||||
public ArrayList Boards => m_Boards;
|
||||
public ArrayList Boards { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
public override string Title => "King of the Hill";
|
||||
public override string Title => "King of the Hill";
|
||||
|
||||
public override string GetTeamName(int teamID)
|
||||
{
|
||||
return m_TeamInfo[teamID % m_TeamInfo.Length].Name;
|
||||
return TeamInfo[teamID % TeamInfo.Length].Name;
|
||||
}
|
||||
|
||||
public override EventGame Construct(DuelContext context)
|
||||
|
|
@ -817,7 +770,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (b != null)
|
||||
{
|
||||
m_Boards.Remove(b);
|
||||
Boards.Remove(b);
|
||||
b.m_Game = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -825,7 +778,7 @@ namespace Server.Engines.ConPVP
|
|||
public void AddBoard(KHBoard b)
|
||||
{
|
||||
if (b != null)
|
||||
m_Boards.Add(b);
|
||||
Boards.Add(b);
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
|
|
@ -836,13 +789,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
Name = "King of the Hill Controller";
|
||||
|
||||
m_Duration = TimeSpan.FromMinutes(30.0);
|
||||
m_Boards = new ArrayList();
|
||||
m_Hills = new HillOfTheKing[4];
|
||||
m_TeamInfo = new KHTeamInfo[8];
|
||||
Duration = TimeSpan.FromMinutes(30.0);
|
||||
Boards = new ArrayList();
|
||||
Hills = new HillOfTheKing[4];
|
||||
TeamInfo = new KHTeamInfo[8];
|
||||
|
||||
for (int i = 0; i < m_TeamInfo.Length; ++i)
|
||||
m_TeamInfo[i] = new KHTeamInfo(i);
|
||||
for (int i = 0; i < TeamInfo.Length; ++i)
|
||||
TeamInfo[i] = new KHTeamInfo(i);
|
||||
}
|
||||
|
||||
public KHController(Serial serial)
|
||||
|
|
@ -857,17 +810,17 @@ namespace Server.Engines.ConPVP
|
|||
writer.Write((int)0);
|
||||
|
||||
writer.WriteEncodedInt(m_ScoreInterval);
|
||||
writer.Write(m_Duration);
|
||||
writer.Write(Duration);
|
||||
|
||||
writer.WriteItemList(m_Boards, true);
|
||||
writer.WriteItemList(Boards, true);
|
||||
|
||||
writer.WriteEncodedInt(m_Hills.Length);
|
||||
for (int i = 0; i < m_Hills.Length; ++i)
|
||||
writer.Write(m_Hills[i]);
|
||||
writer.WriteEncodedInt(Hills.Length);
|
||||
for (int i = 0; i < Hills.Length; ++i)
|
||||
writer.Write(Hills[i]);
|
||||
|
||||
writer.WriteEncodedInt(m_TeamInfo.Length);
|
||||
for (int i = 0; i < m_TeamInfo.Length; ++i)
|
||||
m_TeamInfo[i].Serialize(writer);
|
||||
writer.WriteEncodedInt(TeamInfo.Length);
|
||||
for (int i = 0; i < TeamInfo.Length; ++i)
|
||||
TeamInfo[i].Serialize(writer);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
|
|
@ -882,17 +835,17 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_ScoreInterval = reader.ReadEncodedInt();
|
||||
|
||||
m_Duration = reader.ReadTimeSpan();
|
||||
Duration = reader.ReadTimeSpan();
|
||||
|
||||
m_Boards = reader.ReadItemList();
|
||||
Boards = reader.ReadItemList();
|
||||
|
||||
m_Hills = new HillOfTheKing[reader.ReadEncodedInt()];
|
||||
for (int i = 0; i < m_Hills.Length; ++i)
|
||||
m_Hills[i] = reader.ReadItem() as HillOfTheKing;
|
||||
Hills = new HillOfTheKing[reader.ReadEncodedInt()];
|
||||
for (int i = 0; i < Hills.Length; ++i)
|
||||
Hills[i] = reader.ReadItem() as HillOfTheKing;
|
||||
|
||||
m_TeamInfo = new KHTeamInfo[reader.ReadEncodedInt()];
|
||||
for (int i = 0; i < m_TeamInfo.Length; ++i)
|
||||
m_TeamInfo[i] = new KHTeamInfo(i, reader);
|
||||
TeamInfo = new KHTeamInfo[reader.ReadEncodedInt()];
|
||||
for (int i = 0; i < TeamInfo.Length; ++i)
|
||||
TeamInfo[i] = new KHTeamInfo(i, reader);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -902,17 +855,15 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class KHGame : EventGame
|
||||
{
|
||||
private KHController m_Controller;
|
||||
public KHController Controller { get; }
|
||||
|
||||
public KHController Controller => m_Controller;
|
||||
|
||||
public override bool CantDoAnything(Mobile mob)
|
||||
public override bool CantDoAnything(Mobile mob)
|
||||
{
|
||||
if (mob != null && GetTeamInfo(mob) != null && m_Controller != null)
|
||||
if (mob != null && GetTeamInfo(mob) != null && Controller != null)
|
||||
{
|
||||
for (int i = 0; i < m_Controller.Hills.Length; i++)
|
||||
for (int i = 0; i < Controller.Hills.Length; i++)
|
||||
{
|
||||
if (m_Controller.Hills[i] != null && m_Controller.Hills[i].King == mob)
|
||||
if (Controller.Hills[i] != null && Controller.Hills[i].King == mob)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -944,7 +895,7 @@ namespace Server.Engines.ConPVP
|
|||
public KHGame(KHController controller, DuelContext context)
|
||||
: base(context)
|
||||
{
|
||||
m_Controller = controller;
|
||||
Controller = controller;
|
||||
}
|
||||
|
||||
public Map Facet
|
||||
|
|
@ -954,7 +905,7 @@ namespace Server.Engines.ConPVP
|
|||
if (m_Context?.Arena != null)
|
||||
return m_Context.Arena.Facet;
|
||||
|
||||
return m_Controller.Map;
|
||||
return Controller.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -963,7 +914,7 @@ namespace Server.Engines.ConPVP
|
|||
int teamID = GetTeamID(mob);
|
||||
|
||||
if (teamID >= 0)
|
||||
return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length];
|
||||
return Controller.TeamInfo[teamID % Controller.TeamInfo.Length];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1038,18 +989,18 @@ namespace Server.Engines.ConPVP
|
|||
if (killer != null && killer.Player)
|
||||
teamInfo = GetTeamInfo(killer);
|
||||
|
||||
for (int i = 0; i < m_Controller.Hills.Length; i++)
|
||||
for (int i = 0; i < Controller.Hills.Length; i++)
|
||||
{
|
||||
if (m_Controller.Hills[i] == null)
|
||||
if (Controller.Hills[i] == null)
|
||||
continue;
|
||||
|
||||
if (m_Controller.Hills[i].King == mob)
|
||||
if (Controller.Hills[i].King == mob)
|
||||
{
|
||||
bonus += m_Controller.Hills[i].CapturesSoFar;
|
||||
m_Controller.Hills[i].OnKingDied(mob, victInfo, killer, teamInfo);
|
||||
bonus += Controller.Hills[i].CapturesSoFar;
|
||||
Controller.Hills[i].OnKingDied(mob, victInfo, killer, teamInfo);
|
||||
}
|
||||
|
||||
if (m_Controller.Hills[i].King == killer)
|
||||
if (Controller.Hills[i].King == killer)
|
||||
bonus += 2;
|
||||
}
|
||||
|
||||
|
|
@ -1077,32 +1028,32 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStart()
|
||||
{
|
||||
for (int i = 0; i < m_Controller.TeamInfo.Length; ++i)
|
||||
for (int i = 0; i < Controller.TeamInfo.Length; ++i)
|
||||
{
|
||||
KHTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
KHTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
teamInfo.Game = this;
|
||||
teamInfo.Reset();
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
ApplyHues(m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color);
|
||||
ApplyHues(m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color);
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
|
||||
for (int i = 0; i < m_Controller.Hills.Length; i++)
|
||||
for (int i = 0; i < Controller.Hills.Length; i++)
|
||||
{
|
||||
if (m_Controller.Hills[i] != null)
|
||||
m_Controller.Hills[i].Game = this;
|
||||
if (Controller.Hills[i] != null)
|
||||
Controller.Hills[i].Game = this;
|
||||
}
|
||||
|
||||
foreach (KHBoard board in m_Controller.Boards)
|
||||
foreach (KHBoard board in Controller.Boards)
|
||||
{
|
||||
if (board != null && !board.Deleted)
|
||||
board.m_Game = this;
|
||||
}
|
||||
|
||||
m_FinishTimer = Timer.DelayCall(m_Controller.Duration, Finish_Callback);
|
||||
m_FinishTimer = Timer.DelayCall(Controller.Duration, Finish_Callback);
|
||||
}
|
||||
|
||||
private void Finish_Callback()
|
||||
|
|
@ -1111,7 +1062,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
{
|
||||
KHTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length];
|
||||
KHTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length];
|
||||
|
||||
if (teamInfo == null)
|
||||
continue;
|
||||
|
|
@ -1150,8 +1101,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if (m_Controller != null)
|
||||
sb.Append(' ').Append(m_Controller.Title);
|
||||
if (Controller != null)
|
||||
sb.Append(' ').Append(Controller.Title);
|
||||
|
||||
string title = sb.ToString();
|
||||
|
||||
|
|
@ -1263,16 +1214,16 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStop()
|
||||
{
|
||||
for (int i = 0; i < m_Controller.TeamInfo.Length; ++i)
|
||||
m_Controller.TeamInfo[i].Game = null;
|
||||
for (int i = 0; i < Controller.TeamInfo.Length; ++i)
|
||||
Controller.TeamInfo[i].Game = null;
|
||||
|
||||
for (int i = 0; i < m_Controller.Hills.Length; ++i)
|
||||
for (int i = 0; i < Controller.Hills.Length; ++i)
|
||||
{
|
||||
if (m_Controller.Hills[i] != null)
|
||||
m_Controller.Hills[i].Game = null;
|
||||
if (Controller.Hills[i] != null)
|
||||
Controller.Hills[i].Game = null;
|
||||
}
|
||||
|
||||
foreach (KHBoard board in m_Controller.Boards)
|
||||
foreach (KHBoard board in Controller.Boards)
|
||||
{
|
||||
if (board != null)
|
||||
board.m_Game = null;
|
||||
|
|
|
|||
|
|
@ -243,11 +243,7 @@ namespace Server.Engines.ConPVP
|
|||
return m_Table[mob] as LadderEntry;
|
||||
}
|
||||
|
||||
private static Ladder m_Instance;
|
||||
|
||||
public static Ladder Instance{ get => m_Instance;
|
||||
set => m_Instance = value;
|
||||
}
|
||||
public static Ladder Instance { get; set; }
|
||||
|
||||
public Ladder()
|
||||
{
|
||||
|
|
@ -311,40 +307,30 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public class LadderEntry : IComparable
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private int m_Experience;
|
||||
private int m_Wins;
|
||||
private int m_Losses;
|
||||
private int m_Index;
|
||||
private Ladder m_Ladder;
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Experience{ get => m_Experience;
|
||||
set{ m_Experience = value; m_Ladder.UpdateEntry(this); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Wins{ get => m_Wins;
|
||||
set => m_Wins = value;
|
||||
}
|
||||
public int Wins { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Losses{ get => m_Losses;
|
||||
set => m_Losses = value;
|
||||
}
|
||||
public int Losses { get; set; }
|
||||
|
||||
public int Index{ get => m_Index;
|
||||
set => m_Index = value;
|
||||
}
|
||||
public int Index { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Rank => m_Index;
|
||||
public int Rank => Index;
|
||||
|
||||
public LadderEntry( Mobile mob, Ladder ladder )
|
||||
{
|
||||
m_Ladder = ladder;
|
||||
m_Mobile = mob;
|
||||
Mobile = mob;
|
||||
}
|
||||
|
||||
public LadderEntry( GenericReader reader, Ladder ladder, int version )
|
||||
|
|
@ -356,10 +342,10 @@ namespace Server.Engines.ConPVP
|
|||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
m_Experience = reader.ReadEncodedInt();
|
||||
m_Wins = reader.ReadEncodedInt();
|
||||
m_Losses = reader.ReadEncodedInt();
|
||||
Wins = reader.ReadEncodedInt();
|
||||
Losses = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -368,10 +354,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.Write( (Mobile) Mobile );
|
||||
writer.WriteEncodedInt( (int) m_Experience );
|
||||
writer.WriteEncodedInt( (int) m_Wins );
|
||||
writer.WriteEncodedInt( (int) m_Losses );
|
||||
writer.WriteEncodedInt( (int) Wins );
|
||||
writer.WriteEncodedInt( (int) Losses );
|
||||
}
|
||||
|
||||
public int CompareTo( object obj )
|
||||
|
|
|
|||
|
|
@ -7,14 +7,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class LadderItem : Item
|
||||
{
|
||||
private LadderController m_Ladder;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public LadderController Ladder
|
||||
{
|
||||
get => m_Ladder;
|
||||
set => m_Ladder = value;
|
||||
}
|
||||
public LadderController Ladder { get; set; }
|
||||
|
||||
public override string DefaultName => "1v1 leaderboard";
|
||||
|
||||
|
|
@ -34,7 +28,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (Item) m_Ladder );
|
||||
writer.Write( (Item) Ladder );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -47,7 +41,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Ladder = reader.ReadItem() as LadderController;
|
||||
Ladder = reader.ReadItem() as LadderController;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -59,8 +53,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Ladder ladder = Server.Engines.ConPVP.Ladder.Instance;
|
||||
|
||||
if ( m_Ladder != null )
|
||||
ladder = m_Ladder.Ladder;
|
||||
if ( Ladder != null )
|
||||
ladder = Ladder.Ladder;
|
||||
|
||||
if ( ladder != null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,31 +6,27 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class Participant
|
||||
{
|
||||
private DuelContext m_Context;
|
||||
private DuelPlayer[] m_Players;
|
||||
private TournyParticipant m_TournyPart;
|
||||
public int Count => Players.Length;
|
||||
public DuelPlayer[] Players { get; private set; }
|
||||
|
||||
public int Count => m_Players.Length;
|
||||
public DuelPlayer[] Players => m_Players;
|
||||
public DuelContext Context => m_Context;
|
||||
public TournyParticipant TournyPart{ get => m_TournyPart;
|
||||
set => m_TournyPart = value;
|
||||
}
|
||||
public DuelContext Context { get; }
|
||||
|
||||
public TournyParticipant TournyPart { get; set; }
|
||||
|
||||
public DuelPlayer Find( Mobile mob )
|
||||
{
|
||||
if ( mob is PlayerMobile pm )
|
||||
{
|
||||
if ( pm.DuelContext == m_Context && pm.DuelPlayer.Participant == this )
|
||||
if ( pm.DuelContext == Context && pm.DuelPlayer.Participant == this )
|
||||
return pm.DuelPlayer;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null && m_Players[i].Mobile == mob )
|
||||
return m_Players[i];
|
||||
if ( Players[i] != null && Players[i].Mobile == mob )
|
||||
return Players[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -43,18 +39,18 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Broadcast( int hue, string message, string nonLocalOverhead, string localOverhead )
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null )
|
||||
if ( Players[i] != null )
|
||||
{
|
||||
if ( message != null )
|
||||
m_Players[i].Mobile.SendMessage( hue, message );
|
||||
Players[i].Mobile.SendMessage( hue, message );
|
||||
|
||||
if ( nonLocalOverhead != null )
|
||||
m_Players[i].Mobile.NonlocalOverheadMessage( Network.MessageType.Regular, hue, false, string.Format( nonLocalOverhead, m_Players[i].Mobile.Name, m_Players[i].Mobile.Female ? "her" : "his" ) );
|
||||
Players[i].Mobile.NonlocalOverheadMessage( Network.MessageType.Regular, hue, false, string.Format( nonLocalOverhead, Players[i].Mobile.Name, Players[i].Mobile.Female ? "her" : "his" ) );
|
||||
|
||||
if ( localOverhead != null )
|
||||
m_Players[i].Mobile.LocalOverheadMessage( Network.MessageType.Regular, hue, false, localOverhead );
|
||||
Players[i].Mobile.LocalOverheadMessage( Network.MessageType.Regular, hue, false, localOverhead );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,9 +61,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
int count = 0;
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null )
|
||||
if ( Players[i] != null )
|
||||
++count;
|
||||
}
|
||||
|
||||
|
|
@ -79,9 +75,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
if ( Players[i] == null )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -93,9 +89,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null && !m_Players[i].Eliminated )
|
||||
if ( Players[i] != null && !Players[i].Eliminated )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -109,12 +105,12 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
if ( Players[i] == null )
|
||||
continue;
|
||||
|
||||
Mobile mob = m_Players[i].Mobile;
|
||||
Mobile mob = Players[i].Mobile;
|
||||
|
||||
if ( sb.Length > 0 )
|
||||
sb.Append( ", " );
|
||||
|
|
@ -134,12 +130,12 @@ namespace Server.Engines.ConPVP
|
|||
if ( player == null )
|
||||
return;
|
||||
|
||||
int index = Array.IndexOf( m_Players, player );
|
||||
int index = Array.IndexOf( Players, player );
|
||||
|
||||
if ( index == -1 )
|
||||
return;
|
||||
|
||||
m_Players[index] = null;
|
||||
Players[index] = null;
|
||||
}
|
||||
|
||||
public void Remove( DuelPlayer player )
|
||||
|
|
@ -147,19 +143,19 @@ namespace Server.Engines.ConPVP
|
|||
if ( player == null )
|
||||
return;
|
||||
|
||||
int index = Array.IndexOf( m_Players, player );
|
||||
int index = Array.IndexOf( Players, player );
|
||||
|
||||
if ( index == -1 )
|
||||
return;
|
||||
|
||||
DuelPlayer[] old = m_Players;
|
||||
m_Players = new DuelPlayer[old.Length - 1];
|
||||
DuelPlayer[] old = Players;
|
||||
Players = new DuelPlayer[old.Length - 1];
|
||||
|
||||
for ( int i = 0; i < index; ++i )
|
||||
m_Players[i] = old[i];
|
||||
Players[i] = old[i];
|
||||
|
||||
for ( int i = index + 1; i < old.Length; ++i )
|
||||
m_Players[i - 1] = old[i];
|
||||
Players[i - 1] = old[i];
|
||||
}
|
||||
|
||||
public void Remove( Mobile player )
|
||||
|
|
@ -172,23 +168,23 @@ namespace Server.Engines.ConPVP
|
|||
if ( Contains( player ) )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
if ( Players[i] == null )
|
||||
{
|
||||
m_Players[i] = new DuelPlayer( player, this );
|
||||
Players[i] = new DuelPlayer( player, this );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Resize( m_Players.Length + 1 );
|
||||
m_Players[m_Players.Length - 1] = new DuelPlayer( player, this );
|
||||
Resize( Players.Length + 1 );
|
||||
Players[Players.Length - 1] = new DuelPlayer( player, this );
|
||||
}
|
||||
|
||||
public void Resize( int count )
|
||||
{
|
||||
DuelPlayer[] old = m_Players;
|
||||
m_Players = new DuelPlayer[count];
|
||||
DuelPlayer[] old = Players;
|
||||
Players = new DuelPlayer[count];
|
||||
|
||||
if ( old != null )
|
||||
{
|
||||
|
|
@ -197,14 +193,14 @@ namespace Server.Engines.ConPVP
|
|||
for ( int i = 0; i < old.Length; ++i )
|
||||
{
|
||||
if ( old[i] != null && ct < count )
|
||||
m_Players[ct++] = old[i];
|
||||
Players[ct++] = old[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Participant( DuelContext context, int count )
|
||||
{
|
||||
m_Context = context;
|
||||
Context = context;
|
||||
//m_Stakes = new StakesContainer( context, this );
|
||||
Resize( count );
|
||||
}
|
||||
|
|
@ -212,25 +208,20 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public class DuelPlayer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private bool m_Eliminated;
|
||||
private bool m_Ready;
|
||||
private Participant m_Participant;
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public bool Ready{ get => m_Ready;
|
||||
set => m_Ready = value;
|
||||
}
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public bool Ready { get; set; }
|
||||
|
||||
public bool Eliminated{ get => m_Eliminated;
|
||||
set{ m_Eliminated = value; if ( m_Participant.Context.m_Tournament != null && m_Eliminated ){ m_Participant.Context.m_Tournament.OnEliminated( this ); m_Mobile.SendEverything(); } } }
|
||||
public Participant Participant{ get => m_Participant;
|
||||
set => m_Participant = value;
|
||||
}
|
||||
set{ m_Eliminated = value; if ( Participant.Context.m_Tournament != null && m_Eliminated ){ Participant.Context.m_Tournament.OnEliminated( this ); Mobile.SendEverything(); } } }
|
||||
public Participant Participant { get; set; }
|
||||
|
||||
public DuelPlayer( Mobile mob, Participant p )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Participant = p;
|
||||
Mobile = mob;
|
||||
Participant = p;
|
||||
|
||||
if ( mob is PlayerMobile mobile )
|
||||
mobile.DuelPlayer = this;
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class ParticipantGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
private Participant m_Participant;
|
||||
public Mobile From { get; }
|
||||
|
||||
public Mobile From => m_From;
|
||||
public DuelContext Context => m_Context;
|
||||
public Participant Participant => m_Participant;
|
||||
public DuelContext Context { get; }
|
||||
|
||||
public Participant Participant { get; }
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
|
|
@ -35,9 +33,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public ParticipantGump( Mobile from, DuelContext context, Participant p ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
m_Participant = p;
|
||||
From = from;
|
||||
Context = context;
|
||||
Participant = p;
|
||||
|
||||
from.CloseGump( typeof( RulesetGump ) );
|
||||
from.CloseGump( typeof( DuelContextGump ) );
|
||||
|
|
@ -81,54 +79,54 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_Context.Registered )
|
||||
if ( !Context.Registered )
|
||||
return;
|
||||
|
||||
int bid = info.ButtonID;
|
||||
|
||||
if ( bid == 0 )
|
||||
{
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
From.SendGump( new DuelContextGump( From, Context ) );
|
||||
}
|
||||
else if ( bid == 1 )
|
||||
{
|
||||
if ( m_Participant.Count < 8 )
|
||||
m_Participant.Resize( m_Participant.Count + 1 );
|
||||
if ( Participant.Count < 8 )
|
||||
Participant.Resize( Participant.Count + 1 );
|
||||
else
|
||||
m_From.SendMessage( "You may not raise the team size any further." );
|
||||
From.SendMessage( "You may not raise the team size any further." );
|
||||
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
else if ( bid == 2 )
|
||||
{
|
||||
if ( m_Participant.Count > 1 && m_Participant.Count > m_Participant.FilledSlots )
|
||||
m_Participant.Resize( m_Participant.Count - 1 );
|
||||
if ( Participant.Count > 1 && Participant.Count > Participant.FilledSlots )
|
||||
Participant.Resize( Participant.Count - 1 );
|
||||
else
|
||||
m_From.SendMessage( "You may not lower the team size any further." );
|
||||
From.SendMessage( "You may not lower the team size any further." );
|
||||
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
else if ( bid == 3 )
|
||||
{
|
||||
if ( m_Participant.FilledSlots > 0 )
|
||||
if ( Participant.FilledSlots > 0 )
|
||||
{
|
||||
m_From.SendMessage( "There is at least one currently active player. You must remove them first." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
From.SendMessage( "There is at least one currently active player. You must remove them first." );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
else if ( m_Context.Participants.Count > 2 )
|
||||
else if ( Context.Participants.Count > 2 )
|
||||
{
|
||||
/*Container cont = m_Participant.Stakes;
|
||||
|
||||
if ( cont != null )
|
||||
cont.Delete();*/
|
||||
|
||||
m_Context.Participants.Remove( m_Participant );
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
Context.Participants.Remove( Participant );
|
||||
From.SendGump( new DuelContextGump( From, Context ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage( "Duels must have at least two participating parties." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
From.SendMessage( "Duels must have at least two participating parties." );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
}
|
||||
/*else if ( bid == 4 )
|
||||
|
|
@ -155,23 +153,23 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
bid -= 5;
|
||||
|
||||
if ( bid >= 0 && bid < m_Participant.Players.Length )
|
||||
if ( bid >= 0 && bid < Participant.Players.Length )
|
||||
{
|
||||
if ( m_Participant.Players[bid] == null )
|
||||
if ( Participant.Players[bid] == null )
|
||||
{
|
||||
m_From.Target = new ParticipantTarget( m_Context, m_Participant, bid );
|
||||
m_From.SendMessage( "Target a player." );
|
||||
From.Target = new ParticipantTarget( Context, Participant, bid );
|
||||
From.SendMessage( "Target a player." );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Participant.Players[bid].Mobile.SendMessage( "You have been removed from the duel." );
|
||||
Participant.Players[bid].Mobile.SendMessage( "You have been removed from the duel." );
|
||||
|
||||
if ( m_Participant.Players[bid].Mobile is PlayerMobile )
|
||||
((PlayerMobile)(m_Participant.Players[bid].Mobile)).DuelPlayer = null;
|
||||
if ( Participant.Players[bid].Mobile is PlayerMobile )
|
||||
((PlayerMobile)(Participant.Players[bid].Mobile)).DuelPlayer = null;
|
||||
|
||||
m_Participant.Players[bid] = null;
|
||||
m_From.SendMessage( "They have been removed from the duel." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
Participant.Players[bid] = null;
|
||||
From.SendMessage( "They have been removed from the duel." );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public class Preferences
|
||||
{
|
||||
private ArrayList m_Entries;
|
||||
private Hashtable m_Table;
|
||||
|
||||
public ArrayList Entries => m_Entries;
|
||||
public ArrayList Entries { get; }
|
||||
|
||||
public PreferencesEntry Find( Mobile mob )
|
||||
{
|
||||
|
|
@ -81,22 +80,18 @@ namespace Server.Engines.ConPVP
|
|||
if ( entry == null )
|
||||
{
|
||||
m_Table[mob] = entry = new PreferencesEntry( mob, this );
|
||||
m_Entries.Add( entry );
|
||||
Entries.Add( entry );
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
private static Preferences m_Instance;
|
||||
|
||||
public static Preferences Instance{ get => m_Instance;
|
||||
set => m_Instance = value;
|
||||
}
|
||||
public static Preferences Instance { get; set; }
|
||||
|
||||
public Preferences()
|
||||
{
|
||||
m_Table = new Hashtable();
|
||||
m_Entries = new ArrayList();
|
||||
Entries = new ArrayList();
|
||||
}
|
||||
|
||||
public Preferences( GenericReader reader )
|
||||
|
|
@ -110,7 +105,7 @@ namespace Server.Engines.ConPVP
|
|||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Table = new Hashtable( count );
|
||||
m_Entries = new ArrayList( count );
|
||||
Entries = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
|
|
@ -119,7 +114,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( entry.Mobile != null )
|
||||
{
|
||||
m_Table[entry.Mobile] = entry;
|
||||
m_Entries.Add( entry );
|
||||
Entries.Add( entry );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,27 +127,26 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version;
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Count );
|
||||
writer.WriteEncodedInt( (int) Entries.Count );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
((PreferencesEntry)m_Entries[i]).Serialize( writer );
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
((PreferencesEntry)Entries[i]).Serialize( writer );
|
||||
}
|
||||
}
|
||||
|
||||
public class PreferencesEntry
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private ArrayList m_Disliked;
|
||||
private Preferences m_Preferences;
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public ArrayList Disliked => m_Disliked;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public ArrayList Disliked { get; }
|
||||
|
||||
public PreferencesEntry( Mobile mob, Preferences prefs )
|
||||
{
|
||||
m_Preferences = prefs;
|
||||
m_Mobile = mob;
|
||||
m_Disliked = new ArrayList();
|
||||
Mobile = mob;
|
||||
Disliked = new ArrayList();
|
||||
}
|
||||
|
||||
public PreferencesEntry( GenericReader reader, Preferences prefs, int version )
|
||||
|
|
@ -163,14 +157,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Disliked = new ArrayList( count );
|
||||
Disliked = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
m_Disliked.Add( reader.ReadString() );
|
||||
Disliked.Add( reader.ReadString() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -179,12 +173,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.Write( (Mobile) Mobile );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Disliked.Count );
|
||||
writer.WriteEncodedInt( (int) Disliked.Count );
|
||||
|
||||
for ( int i = 0; i < m_Disliked.Count; ++i )
|
||||
writer.Write( (string) m_Disliked[i] );
|
||||
for ( int i = 0; i < Disliked.Count; ++i )
|
||||
writer.Write( (string) Disliked[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,106 +4,98 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class Ruleset
|
||||
{
|
||||
private RulesetLayout m_Layout;
|
||||
private BitArray m_Options;
|
||||
private string m_Title;
|
||||
public RulesetLayout Layout { get; }
|
||||
|
||||
private Ruleset m_Base;
|
||||
private ArrayList m_Flavors = new ArrayList();
|
||||
private bool m_Changed;
|
||||
public BitArray Options { get; private set; }
|
||||
|
||||
public RulesetLayout Layout => m_Layout;
|
||||
public BitArray Options => m_Options;
|
||||
public string Title{ get => m_Title;
|
||||
set => m_Title = value;
|
||||
}
|
||||
public string Title { get; set; }
|
||||
|
||||
public Ruleset Base => m_Base;
|
||||
public ArrayList Flavors => m_Flavors;
|
||||
public bool Changed{ get => m_Changed;
|
||||
set => m_Changed = value;
|
||||
}
|
||||
public Ruleset Base { get; private set; }
|
||||
|
||||
public ArrayList Flavors { get; } = new ArrayList();
|
||||
|
||||
public bool Changed { get; set; }
|
||||
|
||||
public void ApplyDefault( Ruleset newDefault )
|
||||
{
|
||||
m_Base = newDefault;
|
||||
m_Changed = false;
|
||||
Base = newDefault;
|
||||
Changed = false;
|
||||
|
||||
m_Options = new BitArray( newDefault.m_Options );
|
||||
Options = new BitArray( newDefault.Options );
|
||||
|
||||
ApplyFlavorsTo( this );
|
||||
}
|
||||
|
||||
public void ApplyFlavorsTo( Ruleset ruleset )
|
||||
{
|
||||
for ( int i = 0; i < m_Flavors.Count; ++i )
|
||||
for ( int i = 0; i < Flavors.Count; ++i )
|
||||
{
|
||||
Ruleset flavor = (Ruleset)m_Flavors[i];
|
||||
Ruleset flavor = (Ruleset)Flavors[i];
|
||||
|
||||
m_Options.Or( flavor.m_Options );
|
||||
Options.Or( flavor.Options );
|
||||
}
|
||||
}
|
||||
|
||||
public void AddFlavor( Ruleset flavor )
|
||||
{
|
||||
if ( m_Flavors.Contains( flavor ) )
|
||||
if ( Flavors.Contains( flavor ) )
|
||||
return;
|
||||
|
||||
m_Flavors.Add( flavor );
|
||||
m_Options.Or( flavor.m_Options );
|
||||
Flavors.Add( flavor );
|
||||
Options.Or( flavor.Options );
|
||||
}
|
||||
|
||||
public void RemoveFlavor( Ruleset flavor )
|
||||
{
|
||||
if ( !m_Flavors.Contains( flavor ) )
|
||||
if ( !Flavors.Contains( flavor ) )
|
||||
return;
|
||||
|
||||
m_Flavors.Remove( flavor );
|
||||
m_Options.And( flavor.m_Options.Not() );
|
||||
flavor.m_Options.Not();
|
||||
Flavors.Remove( flavor );
|
||||
Options.And( flavor.Options.Not() );
|
||||
flavor.Options.Not();
|
||||
}
|
||||
|
||||
public void SetOptionRange( string title, bool value )
|
||||
{
|
||||
RulesetLayout layout = m_Layout.FindByTitle( title );
|
||||
RulesetLayout layout = Layout.FindByTitle( title );
|
||||
|
||||
if ( layout == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < layout.TotalLength; ++i )
|
||||
m_Options[i + layout.Offset] = value;
|
||||
Options[i + layout.Offset] = value;
|
||||
|
||||
m_Changed = true;
|
||||
Changed = true;
|
||||
}
|
||||
|
||||
public bool GetOption( string title, string option )
|
||||
{
|
||||
int index = 0;
|
||||
RulesetLayout layout = m_Layout.FindByOption( title, option, ref index );
|
||||
RulesetLayout layout = Layout.FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout == null )
|
||||
return true;
|
||||
|
||||
return m_Options[layout.Offset + index];
|
||||
return Options[layout.Offset + index];
|
||||
}
|
||||
|
||||
public void SetOption( string title, string option, bool value )
|
||||
{
|
||||
int index = 0;
|
||||
RulesetLayout layout = m_Layout.FindByOption( title, option, ref index );
|
||||
RulesetLayout layout = Layout.FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout == null )
|
||||
return;
|
||||
|
||||
m_Options[layout.Offset + index] = value;
|
||||
Options[layout.Offset + index] = value;
|
||||
|
||||
m_Changed = true;
|
||||
Changed = true;
|
||||
}
|
||||
|
||||
public Ruleset( RulesetLayout layout )
|
||||
{
|
||||
m_Layout = layout;
|
||||
m_Options = new BitArray( layout.TotalLength );
|
||||
Layout = layout;
|
||||
Options = new BitArray( layout.TotalLength );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -649,42 +649,32 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
private string m_Title, m_Description;
|
||||
private string[] m_Options;
|
||||
public string Title { get; }
|
||||
|
||||
private int m_Offset, m_TotalLength;
|
||||
public string Description { get; }
|
||||
|
||||
private Ruleset[] m_Defaults;
|
||||
private Ruleset[] m_Flavors;
|
||||
public string[] Options { get; }
|
||||
|
||||
private RulesetLayout m_Parent;
|
||||
private RulesetLayout[] m_Children;
|
||||
public int Offset { get; private set; }
|
||||
|
||||
public string Title => m_Title;
|
||||
public string Description => m_Description;
|
||||
public string[] Options => m_Options;
|
||||
public int TotalLength { get; private set; }
|
||||
|
||||
public int Offset => m_Offset;
|
||||
public int TotalLength => m_TotalLength;
|
||||
public RulesetLayout Parent { get; private set; }
|
||||
|
||||
public RulesetLayout Parent => m_Parent;
|
||||
public RulesetLayout[] Children => m_Children;
|
||||
public RulesetLayout[] Children { get; }
|
||||
|
||||
public Ruleset[] Defaults{ get => m_Defaults;
|
||||
set => m_Defaults = value;
|
||||
}
|
||||
public Ruleset[] Flavors{ get => m_Flavors;
|
||||
set => m_Flavors = value;
|
||||
}
|
||||
public Ruleset[] Defaults { get; set; }
|
||||
|
||||
public Ruleset[] Flavors { get; set; }
|
||||
|
||||
public RulesetLayout FindByTitle( string title )
|
||||
{
|
||||
if ( m_Title == title )
|
||||
if ( Title == title )
|
||||
return this;
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
for ( int i = 0; i < Children.Length; ++i )
|
||||
{
|
||||
RulesetLayout layout = m_Children[i].FindByTitle( title );
|
||||
RulesetLayout layout = Children[i].FindByTitle( title );
|
||||
|
||||
if ( layout != null )
|
||||
return layout;
|
||||
|
|
@ -695,12 +685,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public string FindByIndex( int index )
|
||||
{
|
||||
if ( index >= m_Offset && index < (m_Offset + m_Options.Length) )
|
||||
return m_Description + ": " + m_Options[index - m_Offset];
|
||||
if ( index >= Offset && index < (Offset + Options.Length) )
|
||||
return Description + ": " + Options[index - Offset];
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
for ( int i = 0; i < Children.Length; ++i )
|
||||
{
|
||||
string opt = m_Children[i].FindByIndex( index );
|
||||
string opt = Children[i].FindByIndex( index );
|
||||
|
||||
if ( opt != null )
|
||||
return opt;
|
||||
|
|
@ -711,7 +701,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public RulesetLayout FindByOption( string title, string option, ref int index )
|
||||
{
|
||||
if ( title == null || m_Title == title )
|
||||
if ( title == null || Title == title )
|
||||
{
|
||||
index = GetOptionIndex( option );
|
||||
|
||||
|
|
@ -721,9 +711,9 @@ namespace Server.Engines.ConPVP
|
|||
title = null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
for ( int i = 0; i < Children.Length; ++i )
|
||||
{
|
||||
RulesetLayout layout = m_Children[i].FindByOption( title, option, ref index );
|
||||
RulesetLayout layout = Children[i].FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout != null )
|
||||
return layout;
|
||||
|
|
@ -734,7 +724,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetOptionIndex( string option )
|
||||
{
|
||||
return Array.IndexOf( m_Options, option );
|
||||
return Array.IndexOf( Options, option );
|
||||
}
|
||||
|
||||
public void ComputeOffsets()
|
||||
|
|
@ -746,15 +736,15 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private int RecurseComputeOffsets( ref int offset )
|
||||
{
|
||||
m_Offset = offset;
|
||||
Offset = offset;
|
||||
|
||||
offset += m_Options.Length;
|
||||
m_TotalLength += m_Options.Length;
|
||||
offset += Options.Length;
|
||||
TotalLength += Options.Length;
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
m_TotalLength += m_Children[i].RecurseComputeOffsets( ref offset );
|
||||
for ( int i = 0; i < Children.Length; ++i )
|
||||
TotalLength += Children[i].RecurseComputeOffsets( ref offset );
|
||||
|
||||
return m_TotalLength;
|
||||
return TotalLength;
|
||||
}
|
||||
|
||||
public RulesetLayout( string title, string[] options ) : this( title, title, new RulesetLayout[0], options )
|
||||
|
|
@ -779,13 +769,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public RulesetLayout( string title, string description, RulesetLayout[] children, string[] options )
|
||||
{
|
||||
m_Title = title;
|
||||
m_Description = description;
|
||||
m_Children = children;
|
||||
m_Options = options;
|
||||
Title = title;
|
||||
Description = description;
|
||||
Children = children;
|
||||
Options = options;
|
||||
|
||||
for ( int i = 0; i < children.Length; ++i )
|
||||
children[i].m_Parent = this;
|
||||
children[i].Parent = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -12,34 +12,27 @@ namespace Server.Items
|
|||
[Flippable( 5020, 4647 )]
|
||||
public class Trophy : Item
|
||||
{
|
||||
private string m_Title;
|
||||
private TrophyRank m_Rank;
|
||||
private Mobile m_Owner;
|
||||
private DateTime m_Date;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Title{ get => m_Title;
|
||||
set => m_Title = value;
|
||||
}
|
||||
public string Title { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TrophyRank Rank{ get => m_Rank;
|
||||
set{ m_Rank = value; UpdateStyle(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Owner{ get => m_Owner;
|
||||
set => m_Owner = value;
|
||||
}
|
||||
public Mobile Owner { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime Date => m_Date;
|
||||
public DateTime Date { get; private set; }
|
||||
|
||||
[Constructible]
|
||||
public Trophy( string title, TrophyRank rank ) : base( 5020 )
|
||||
{
|
||||
m_Title = title;
|
||||
Title = title;
|
||||
m_Rank = rank;
|
||||
m_Date = DateTime.UtcNow;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
|
|
@ -56,10 +49,10 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (string) m_Title );
|
||||
writer.Write( (string) Title );
|
||||
writer.Write( (int) m_Rank );
|
||||
writer.Write( (Mobile) m_Owner );
|
||||
writer.Write( (DateTime) m_Date );
|
||||
writer.Write( (Mobile) Owner );
|
||||
writer.Write( (DateTime) Date );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -68,10 +61,10 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Title = reader.ReadString();
|
||||
Title = reader.ReadString();
|
||||
m_Rank = (TrophyRank) reader.ReadInt();
|
||||
m_Owner = reader.ReadMobile();
|
||||
m_Date = reader.ReadDateTime();
|
||||
Owner = reader.ReadMobile();
|
||||
Date = reader.ReadDateTime();
|
||||
|
||||
if ( version == 0 )
|
||||
LootType = LootType.Blessed;
|
||||
|
|
@ -81,21 +74,21 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( m_Owner == null )
|
||||
m_Owner = RootParent as Mobile;
|
||||
if ( Owner == null )
|
||||
Owner = RootParent as Mobile;
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( m_Owner != null )
|
||||
LabelTo( from, "{0} -- {1}", m_Title, m_Owner.RawName );
|
||||
else if ( m_Title != null )
|
||||
LabelTo( from, m_Title );
|
||||
if ( Owner != null )
|
||||
LabelTo( from, "{0} -- {1}", Title, Owner.RawName );
|
||||
else if ( Title != null )
|
||||
LabelTo( from, Title );
|
||||
|
||||
if ( m_Date != DateTime.MinValue )
|
||||
LabelTo( from, m_Date.ToString( "d" ) );
|
||||
if ( Date != DateTime.MinValue )
|
||||
LabelTo( from, Date.ToString( "d" ) );
|
||||
}
|
||||
|
||||
public void UpdateStyle()
|
||||
|
|
|
|||
|
|
@ -11,44 +11,32 @@ namespace Server.Engines.Craft
|
|||
|
||||
public class CraftContext
|
||||
{
|
||||
private List<CraftItem> m_Items;
|
||||
private int m_LastResourceIndex;
|
||||
private int m_LastResourceIndex2;
|
||||
private int m_LastGroupIndex;
|
||||
private bool m_DoNotColor;
|
||||
private CraftMarkOption m_MarkOption;
|
||||
public List<CraftItem> Items { get; }
|
||||
|
||||
public List<CraftItem> Items => m_Items;
|
||||
public int LastResourceIndex{ get => m_LastResourceIndex;
|
||||
set => m_LastResourceIndex = value;
|
||||
}
|
||||
public int LastResourceIndex2{ get => m_LastResourceIndex2;
|
||||
set => m_LastResourceIndex2 = value;
|
||||
}
|
||||
public int LastGroupIndex{ get => m_LastGroupIndex;
|
||||
set => m_LastGroupIndex = value;
|
||||
}
|
||||
public bool DoNotColor{ get => m_DoNotColor;
|
||||
set => m_DoNotColor = value;
|
||||
}
|
||||
public CraftMarkOption MarkOption{ get => m_MarkOption;
|
||||
set => m_MarkOption = value;
|
||||
}
|
||||
public int LastResourceIndex { get; set; }
|
||||
|
||||
public int LastResourceIndex2 { get; set; }
|
||||
|
||||
public int LastGroupIndex { get; set; }
|
||||
|
||||
public bool DoNotColor { get; set; }
|
||||
|
||||
public CraftMarkOption MarkOption { get; set; }
|
||||
|
||||
public CraftContext()
|
||||
{
|
||||
m_Items = new List<CraftItem>();
|
||||
m_LastResourceIndex = -1;
|
||||
m_LastResourceIndex2 = -1;
|
||||
m_LastGroupIndex = -1;
|
||||
Items = new List<CraftItem>();
|
||||
LastResourceIndex = -1;
|
||||
LastResourceIndex2 = -1;
|
||||
LastGroupIndex = -1;
|
||||
}
|
||||
|
||||
public CraftItem LastMade
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Items.Count > 0 )
|
||||
return m_Items[0];
|
||||
if ( Items.Count > 0 )
|
||||
return Items[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -56,12 +44,12 @@ namespace Server.Engines.Craft
|
|||
|
||||
public void OnMade( CraftItem item )
|
||||
{
|
||||
m_Items.Remove( item );
|
||||
Items.Remove( item );
|
||||
|
||||
if ( m_Items.Count == 10 )
|
||||
m_Items.RemoveAt( 9 );
|
||||
if ( Items.Count == 10 )
|
||||
Items.RemoveAt( 9 );
|
||||
|
||||
m_Items.Insert( 0, item );
|
||||
Items.Insert( 0, item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,27 +2,22 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public class CraftGroup
|
||||
{
|
||||
private CraftItemCol m_arCraftItem;
|
||||
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
|
||||
public CraftGroup( TextDefinition groupName )
|
||||
{
|
||||
m_NameNumber = groupName;
|
||||
m_NameString = groupName;
|
||||
m_arCraftItem = new CraftItemCol();
|
||||
NameNumber = groupName;
|
||||
NameString = groupName;
|
||||
CraftItems = new CraftItemCol();
|
||||
}
|
||||
|
||||
public void AddCraftItem( CraftItem craftItem )
|
||||
{
|
||||
m_arCraftItem.Add( craftItem );
|
||||
CraftItems.Add( craftItem );
|
||||
}
|
||||
|
||||
public CraftItemCol CraftItems => m_arCraftItem;
|
||||
public CraftItemCol CraftItems { get; }
|
||||
|
||||
public string NameString => m_NameString;
|
||||
public string NameString { get; }
|
||||
|
||||
public int NameNumber => m_NameNumber;
|
||||
public int NameNumber { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -19,61 +19,21 @@ namespace Server.Engines.Craft
|
|||
|
||||
public class CraftItem
|
||||
{
|
||||
private CraftResCol m_arCraftRes;
|
||||
private CraftSkillCol m_arCraftSkill;
|
||||
private Type m_Type;
|
||||
public bool ForceNonExceptional { get; set; }
|
||||
|
||||
private string m_GroupNameString;
|
||||
private int m_GroupNameNumber;
|
||||
public Expansion RequiredExpansion { get; set; }
|
||||
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
|
||||
private int m_ItemHue;
|
||||
|
||||
private int m_Mana;
|
||||
private int m_Hits;
|
||||
private int m_Stam;
|
||||
|
||||
private BeverageType m_RequiredBeverage;
|
||||
|
||||
private bool m_UseAllRes;
|
||||
|
||||
private bool m_NeedHeat;
|
||||
private bool m_NeedOven;
|
||||
private bool m_NeedMill;
|
||||
|
||||
private bool m_UseSubRes2;
|
||||
|
||||
private bool m_ForceNonExceptional;
|
||||
|
||||
public bool ForceNonExceptional
|
||||
{
|
||||
get => m_ForceNonExceptional;
|
||||
set => m_ForceNonExceptional = value;
|
||||
}
|
||||
|
||||
private Expansion m_RequiredExpansion;
|
||||
|
||||
public Expansion RequiredExpansion
|
||||
{
|
||||
get => m_RequiredExpansion;
|
||||
set => m_RequiredExpansion = value;
|
||||
}
|
||||
|
||||
private Recipe m_Recipe;
|
||||
|
||||
public Recipe Recipe => m_Recipe;
|
||||
public Recipe Recipe { get; private set; }
|
||||
|
||||
public void AddRecipe( int id, CraftSystem system )
|
||||
{
|
||||
if ( m_Recipe != null )
|
||||
if ( Recipe != null )
|
||||
{
|
||||
Console.WriteLine( "Warning: Attempted add of recipe #{0} to the crafting of {1} in CraftSystem {2}.", id, m_Type.Name, system );
|
||||
Console.WriteLine( "Warning: Attempted add of recipe #{0} to the crafting of {1} in CraftSystem {2}.", id, ItemType.Name, system );
|
||||
return;
|
||||
}
|
||||
|
||||
m_Recipe = new Recipe( id, system, this );
|
||||
Recipe = new Recipe( id, system, this );
|
||||
}
|
||||
|
||||
public static int LabelNumber( Type type ) {
|
||||
|
|
@ -129,25 +89,21 @@ namespace Server.Engines.Craft
|
|||
|
||||
public CraftItem( Type type, TextDefinition groupName, TextDefinition name )
|
||||
{
|
||||
m_arCraftRes = new CraftResCol();
|
||||
m_arCraftSkill = new CraftSkillCol();
|
||||
Resources = new CraftResCol();
|
||||
Skills = new CraftSkillCol();
|
||||
|
||||
m_Type = type;
|
||||
ItemType = type;
|
||||
|
||||
m_GroupNameString = groupName;
|
||||
m_NameString = name;
|
||||
GroupNameString = groupName;
|
||||
NameString = name;
|
||||
|
||||
m_GroupNameNumber = groupName;
|
||||
m_NameNumber = name;
|
||||
GroupNameNumber = groupName;
|
||||
NameNumber = name;
|
||||
|
||||
m_RequiredBeverage = BeverageType.Water;
|
||||
RequiredBeverage = BeverageType.Water;
|
||||
}
|
||||
|
||||
public BeverageType RequiredBeverage
|
||||
{
|
||||
get => m_RequiredBeverage;
|
||||
set => m_RequiredBeverage = value;
|
||||
}
|
||||
public BeverageType RequiredBeverage { get; set; }
|
||||
|
||||
public void AddRes( Type type, TextDefinition name, int amount )
|
||||
{
|
||||
|
|
@ -157,83 +113,47 @@ namespace Server.Engines.Craft
|
|||
public void AddRes( Type type, TextDefinition name, int amount, TextDefinition message )
|
||||
{
|
||||
CraftRes craftRes = new CraftRes( type, name, amount, message );
|
||||
m_arCraftRes.Add( craftRes );
|
||||
Resources.Add( craftRes );
|
||||
}
|
||||
|
||||
|
||||
public void AddSkill( SkillName skillToMake, double minSkill, double maxSkill )
|
||||
{
|
||||
CraftSkill craftSkill = new CraftSkill( skillToMake, minSkill, maxSkill );
|
||||
m_arCraftSkill.Add( craftSkill );
|
||||
Skills.Add( craftSkill );
|
||||
}
|
||||
|
||||
public int Mana
|
||||
{
|
||||
get => m_Mana;
|
||||
set => m_Mana = value;
|
||||
}
|
||||
public int Mana { get; set; }
|
||||
|
||||
public int Hits
|
||||
{
|
||||
get => m_Hits;
|
||||
set => m_Hits = value;
|
||||
}
|
||||
public int Hits { get; set; }
|
||||
|
||||
public int Stam
|
||||
{
|
||||
get => m_Stam;
|
||||
set => m_Stam = value;
|
||||
}
|
||||
public int Stam { get; set; }
|
||||
|
||||
public bool UseSubRes2
|
||||
{
|
||||
get => m_UseSubRes2;
|
||||
set => m_UseSubRes2 = value;
|
||||
}
|
||||
public bool UseSubRes2 { get; set; }
|
||||
|
||||
public bool UseAllRes
|
||||
{
|
||||
get => m_UseAllRes;
|
||||
set => m_UseAllRes = value;
|
||||
}
|
||||
public bool UseAllRes { get; set; }
|
||||
|
||||
public bool NeedHeat
|
||||
{
|
||||
get => m_NeedHeat;
|
||||
set => m_NeedHeat = value;
|
||||
}
|
||||
public bool NeedHeat { get; set; }
|
||||
|
||||
public bool NeedOven
|
||||
{
|
||||
get => m_NeedOven;
|
||||
set => m_NeedOven = value;
|
||||
}
|
||||
public bool NeedOven { get; set; }
|
||||
|
||||
public bool NeedMill
|
||||
{
|
||||
get => m_NeedMill;
|
||||
set => m_NeedMill = value;
|
||||
}
|
||||
public bool NeedMill { get; set; }
|
||||
|
||||
public Type ItemType => m_Type;
|
||||
public Type ItemType { get; }
|
||||
|
||||
public int ItemHue
|
||||
{
|
||||
get => m_ItemHue;
|
||||
set => m_ItemHue = value;
|
||||
}
|
||||
public int ItemHue { get; set; }
|
||||
|
||||
public string GroupNameString => m_GroupNameString;
|
||||
public string GroupNameString { get; }
|
||||
|
||||
public int GroupNameNumber => m_GroupNameNumber;
|
||||
public int GroupNameNumber { get; }
|
||||
|
||||
public string NameString => m_NameString;
|
||||
public string NameString { get; }
|
||||
|
||||
public int NameNumber => m_NameNumber;
|
||||
public int NameNumber { get; }
|
||||
|
||||
public CraftResCol Resources => m_arCraftRes;
|
||||
public CraftResCol Resources { get; }
|
||||
|
||||
public CraftSkillCol Skills => m_arCraftSkill;
|
||||
public CraftSkillCol Skills { get; }
|
||||
|
||||
public bool ConsumeAttributes( Mobile from, ref object message, bool consume )
|
||||
{
|
||||
|
|
@ -355,7 +275,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public bool IsMarkable( Type type )
|
||||
{
|
||||
if ( m_ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional.
|
||||
if ( ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional.
|
||||
return false;
|
||||
|
||||
for ( int i = 0; i < m_MarkableTable.Length; ++i )
|
||||
|
|
@ -390,7 +310,7 @@ namespace Server.Engines.Craft
|
|||
if ( system.RetainsColorFrom( this, type ) )
|
||||
return true;
|
||||
|
||||
bool inItemTable = RetainsColor( m_Type );
|
||||
bool inItemTable = RetainsColor( ItemType );
|
||||
|
||||
if ( !inItemTable )
|
||||
return false;
|
||||
|
|
@ -492,7 +412,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage )
|
||||
if ( hq is BaseBeverage beverage && beverage.Content != RequiredBeverage )
|
||||
continue;
|
||||
|
||||
totals[i] += hq.Quantity;
|
||||
|
|
@ -528,7 +448,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage )
|
||||
if ( hq is BaseBeverage beverage && beverage.Content != RequiredBeverage )
|
||||
continue;
|
||||
|
||||
int theirAmount = hq.Quantity;
|
||||
|
|
@ -564,7 +484,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage )
|
||||
if ( hq is BaseBeverage beverage && beverage.Content != RequiredBeverage )
|
||||
continue;
|
||||
|
||||
amount += hq.Quantity;
|
||||
|
|
@ -586,34 +506,34 @@ namespace Server.Engines.Craft
|
|||
if ( ourPack == null )
|
||||
return false;
|
||||
|
||||
if ( m_NeedHeat && !Find( from, m_HeatSources ) )
|
||||
if ( NeedHeat && !Find( from, m_HeatSources ) )
|
||||
{
|
||||
message = 1044487; // You must be near a fire source to cook.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_NeedOven && !Find( from, m_Ovens ) )
|
||||
if ( NeedOven && !Find( from, m_Ovens ) )
|
||||
{
|
||||
message = 1044493; // You must be near an oven to bake that.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_NeedMill && !Find( from, m_Mills ) )
|
||||
if ( NeedMill && !Find( from, m_Mills ) )
|
||||
{
|
||||
message = 1044491; // You must be near a flour mill to do that.
|
||||
return false;
|
||||
}
|
||||
|
||||
Type[][] types = new Type[m_arCraftRes.Count][];
|
||||
int[] amounts = new int[m_arCraftRes.Count];
|
||||
Type[][] types = new Type[Resources.Count][];
|
||||
int[] amounts = new int[Resources.Count];
|
||||
|
||||
maxAmount = int.MaxValue;
|
||||
|
||||
CraftSubResCol resCol = ( m_UseSubRes2 ? craftSystem.CraftSubRes2 : craftSystem.CraftSubRes );
|
||||
CraftSubResCol resCol = ( UseSubRes2 ? craftSystem.CraftSubRes2 : craftSystem.CraftSubRes );
|
||||
|
||||
for ( int i = 0; i < types.Length; ++i )
|
||||
{
|
||||
CraftRes craftRes = m_arCraftRes.GetAt( i );
|
||||
CraftRes craftRes = Resources.GetAt( i );
|
||||
Type baseType = craftRes.ItemType;
|
||||
|
||||
// Resource Mutation
|
||||
|
|
@ -653,7 +573,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if ( maxAmount == 0 )
|
||||
{
|
||||
CraftRes res = m_arCraftRes.GetAt( i );
|
||||
CraftRes res = Resources.GetAt( i );
|
||||
|
||||
if ( res.MessageNumber > 0 )
|
||||
message = res.MessageNumber;
|
||||
|
|
@ -683,7 +603,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
Item consumeExtra = null;
|
||||
|
||||
if ( m_NameNumber == 1041267 )
|
||||
if ( NameNumber == 1041267 )
|
||||
{
|
||||
// Runebooks are a special case, they need a blank recall rune
|
||||
|
||||
|
|
@ -782,7 +702,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
|
||||
{
|
||||
CraftRes res = m_arCraftRes.GetAt( index );
|
||||
CraftRes res = Resources.GetAt( index );
|
||||
|
||||
if ( res.MessageNumber > 0 )
|
||||
message = res.MessageNumber;
|
||||
|
|
@ -818,7 +738,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public double GetExceptionalChance( CraftSystem system, double chance, Mobile from )
|
||||
{
|
||||
if ( m_ForceNonExceptional )
|
||||
if ( ForceNonExceptional )
|
||||
return 0.0;
|
||||
|
||||
double bonus = 0.0;
|
||||
|
|
@ -876,9 +796,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
allRequiredSkills = true;
|
||||
|
||||
for ( int i = 0; i < m_arCraftSkill.Count; i++)
|
||||
for ( int i = 0; i < Skills.Count; i++)
|
||||
{
|
||||
CraftSkill craftSkill = m_arCraftSkill.GetAt(i);
|
||||
CraftSkill craftSkill = Skills.GetAt(i);
|
||||
|
||||
double minSkill = craftSkill.MinSkill;
|
||||
double maxSkill = craftSkill.MaxSkill;
|
||||
|
|
@ -927,7 +847,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
if ( Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe( Recipe ) )
|
||||
{
|
||||
int badCraft = craftSystem.CanCraft( from, tool, m_Type );
|
||||
int badCraft = craftSystem.CanCraft( from, tool, ItemType );
|
||||
|
||||
if ( badCraft <= 0 )
|
||||
{
|
||||
|
|
@ -1009,7 +929,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public void CompleteCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft )
|
||||
{
|
||||
int badCraft = craftSystem.CanCraft( from, tool, m_Type );
|
||||
int badCraft = craftSystem.CanCraft( from, tool, ItemType );
|
||||
|
||||
if ( badCraft > 0 )
|
||||
{
|
||||
|
|
@ -1251,7 +1171,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
m_From.EndAction( typeof( CraftSystem ) );
|
||||
|
||||
int badCraft = m_CraftSystem.CanCraft( m_From, m_Tool, m_CraftItem.m_Type );
|
||||
int badCraft = m_CraftSystem.CanCraft( m_From, m_Tool, m_CraftItem.ItemType );
|
||||
|
||||
if ( badCraft > 0 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ namespace Server.Engines.Craft
|
|||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class CraftItemIDAttribute : Attribute
|
||||
{
|
||||
private int m_ItemID;
|
||||
|
||||
public int ItemID => m_ItemID;
|
||||
public int ItemID { get; }
|
||||
|
||||
public CraftItemIDAttribute( int itemID )
|
||||
{
|
||||
m_ItemID = itemID;
|
||||
ItemID = itemID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,50 +4,41 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public class CraftRes
|
||||
{
|
||||
private Type m_Type;
|
||||
private int m_Amount;
|
||||
|
||||
private string m_MessageString;
|
||||
private int m_MessageNumber;
|
||||
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
|
||||
public CraftRes( Type type, int amount )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Amount = amount;
|
||||
ItemType = type;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public CraftRes( Type type, TextDefinition name, int amount, TextDefinition message ): this ( type, amount )
|
||||
{
|
||||
m_NameNumber = name;
|
||||
m_MessageNumber = message;
|
||||
NameNumber = name;
|
||||
MessageNumber = message;
|
||||
|
||||
m_NameString = name;
|
||||
m_MessageString = message;
|
||||
NameString = name;
|
||||
MessageString = message;
|
||||
}
|
||||
|
||||
public void SendMessage( Mobile from )
|
||||
{
|
||||
if ( m_MessageNumber > 0 )
|
||||
from.SendLocalizedMessage( m_MessageNumber );
|
||||
else if ( !string.IsNullOrEmpty( m_MessageString ) )
|
||||
from.SendMessage( m_MessageString );
|
||||
if ( MessageNumber > 0 )
|
||||
from.SendLocalizedMessage( MessageNumber );
|
||||
else if ( !string.IsNullOrEmpty( MessageString ) )
|
||||
from.SendMessage( MessageString );
|
||||
else
|
||||
from.SendLocalizedMessage( 502925 ); // You don't have the resources required to make that item.
|
||||
}
|
||||
|
||||
public Type ItemType => m_Type;
|
||||
public Type ItemType { get; }
|
||||
|
||||
public string MessageString => m_MessageString;
|
||||
public string MessageString { get; }
|
||||
|
||||
public int MessageNumber => m_MessageNumber;
|
||||
public int MessageNumber { get; }
|
||||
|
||||
public string NameString => m_NameString;
|
||||
public string NameString { get; }
|
||||
|
||||
public int NameNumber => m_NameNumber;
|
||||
public int NameNumber { get; }
|
||||
|
||||
public int Amount => m_Amount;
|
||||
public int Amount { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,21 +2,17 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public class CraftSkill
|
||||
{
|
||||
private SkillName m_SkillToMake;
|
||||
private double m_MinSkill;
|
||||
private double m_MaxSkill;
|
||||
|
||||
public CraftSkill( SkillName skillToMake, double minSkill, double maxSkill )
|
||||
{
|
||||
m_SkillToMake = skillToMake;
|
||||
m_MinSkill = minSkill;
|
||||
m_MaxSkill = maxSkill;
|
||||
SkillToMake = skillToMake;
|
||||
MinSkill = minSkill;
|
||||
MaxSkill = maxSkill;
|
||||
}
|
||||
|
||||
public SkillName SkillToMake => m_SkillToMake;
|
||||
public SkillName SkillToMake { get; }
|
||||
|
||||
public double MinSkill => m_MinSkill;
|
||||
public double MinSkill { get; }
|
||||
|
||||
public double MaxSkill => m_MaxSkill;
|
||||
public double MaxSkill { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -4,37 +4,30 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public class CraftSubRes
|
||||
{
|
||||
private Type m_Type;
|
||||
private double m_ReqSkill;
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
private int m_GenericNameNumber;
|
||||
private object m_Message;
|
||||
|
||||
public CraftSubRes( Type type, TextDefinition name, double reqSkill, object message ) : this( type, name, reqSkill, 0, message )
|
||||
{
|
||||
}
|
||||
|
||||
public CraftSubRes( Type type, TextDefinition name, double reqSkill, int genericNameNumber, object message )
|
||||
{
|
||||
m_Type = type;
|
||||
m_NameNumber = name;
|
||||
m_NameString = name;
|
||||
m_ReqSkill = reqSkill;
|
||||
m_GenericNameNumber = genericNameNumber;
|
||||
m_Message = message;
|
||||
ItemType = type;
|
||||
NameNumber = name;
|
||||
NameString = name;
|
||||
RequiredSkill = reqSkill;
|
||||
GenericNameNumber = genericNameNumber;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public Type ItemType => m_Type;
|
||||
public Type ItemType { get; }
|
||||
|
||||
public string NameString => m_NameString;
|
||||
public string NameString { get; }
|
||||
|
||||
public int NameNumber => m_NameNumber;
|
||||
public int NameNumber { get; }
|
||||
|
||||
public int GenericNameNumber => m_GenericNameNumber;
|
||||
public int GenericNameNumber { get; }
|
||||
|
||||
public object Message => m_Message;
|
||||
public object Message { get; }
|
||||
|
||||
public double RequiredSkill => m_ReqSkill;
|
||||
public double RequiredSkill { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -4,38 +4,17 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public class CraftSubResCol : System.Collections.CollectionBase
|
||||
{
|
||||
private Type m_Type;
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
private bool m_Init;
|
||||
public bool Init { get; set; }
|
||||
|
||||
public bool Init
|
||||
{
|
||||
get => m_Init;
|
||||
set => m_Init = value;
|
||||
}
|
||||
|
||||
public Type ResType
|
||||
{
|
||||
get => m_Type;
|
||||
set => m_Type = value;
|
||||
}
|
||||
public Type ResType { get; set; }
|
||||
|
||||
public string NameString
|
||||
{
|
||||
get => m_NameString;
|
||||
set => m_NameString = value;
|
||||
}
|
||||
public string NameString { get; set; }
|
||||
|
||||
public int NameNumber
|
||||
{
|
||||
get => m_NameNumber;
|
||||
set => m_NameNumber = value;
|
||||
}
|
||||
public int NameNumber { get; set; }
|
||||
|
||||
public CraftSubResCol()
|
||||
{
|
||||
m_Init = false;
|
||||
Init = false;
|
||||
}
|
||||
|
||||
public void Add( CraftSubRes craftSubRes )
|
||||
|
|
|
|||
|
|
@ -13,30 +13,22 @@ namespace Server.Engines.Craft
|
|||
|
||||
public abstract class CraftSystem
|
||||
{
|
||||
private int m_MinCraftEffect;
|
||||
private int m_MaxCraftEffect;
|
||||
private double m_Delay;
|
||||
private bool m_Resmelt;
|
||||
private bool m_Repair;
|
||||
private bool m_MarkOption;
|
||||
private bool m_CanEnhance;
|
||||
|
||||
private CraftItemCol m_CraftItems;
|
||||
private CraftGroupCol m_CraftGroups;
|
||||
private CraftSubResCol m_CraftSubRes;
|
||||
private CraftSubResCol m_CraftSubRes2;
|
||||
|
||||
private List<int> m_Recipes;
|
||||
private List<int> m_RareRecipes;
|
||||
|
||||
public int MinCraftEffect => m_MinCraftEffect;
|
||||
public int MaxCraftEffect => m_MaxCraftEffect;
|
||||
public double Delay => m_Delay;
|
||||
public int MinCraftEffect { get; }
|
||||
|
||||
public CraftItemCol CraftItems => m_CraftItems;
|
||||
public CraftGroupCol CraftGroups => m_CraftGroups;
|
||||
public CraftSubResCol CraftSubRes => m_CraftSubRes;
|
||||
public CraftSubResCol CraftSubRes2 => m_CraftSubRes2;
|
||||
public int MaxCraftEffect { get; }
|
||||
|
||||
public double Delay { get; }
|
||||
|
||||
public CraftItemCol CraftItems { get; }
|
||||
|
||||
public CraftGroupCol CraftGroups { get; }
|
||||
|
||||
public CraftSubResCol CraftSubRes { get; }
|
||||
|
||||
public CraftSubResCol CraftSubRes2 { get; }
|
||||
|
||||
public abstract SkillName MainSkill{ get; }
|
||||
|
||||
|
|
@ -80,40 +72,24 @@ namespace Server.Engines.Craft
|
|||
c?.OnMade( item );
|
||||
}
|
||||
|
||||
public bool Resmelt
|
||||
{
|
||||
get => m_Resmelt;
|
||||
set => m_Resmelt = value;
|
||||
}
|
||||
public bool Resmelt { get; set; }
|
||||
|
||||
public bool Repair
|
||||
{
|
||||
get => m_Repair;
|
||||
set => m_Repair = value;
|
||||
}
|
||||
public bool Repair { get; set; }
|
||||
|
||||
public bool MarkOption
|
||||
{
|
||||
get => m_MarkOption;
|
||||
set => m_MarkOption = value;
|
||||
}
|
||||
public bool MarkOption { get; set; }
|
||||
|
||||
public bool CanEnhance
|
||||
{
|
||||
get => m_CanEnhance;
|
||||
set => m_CanEnhance = value;
|
||||
}
|
||||
public bool CanEnhance { get; set; }
|
||||
|
||||
public CraftSystem( int minCraftEffect, int maxCraftEffect, double delay )
|
||||
{
|
||||
m_MinCraftEffect = minCraftEffect;
|
||||
m_MaxCraftEffect = maxCraftEffect;
|
||||
m_Delay = delay;
|
||||
MinCraftEffect = minCraftEffect;
|
||||
MaxCraftEffect = maxCraftEffect;
|
||||
Delay = delay;
|
||||
|
||||
m_CraftItems = new CraftItemCol();
|
||||
m_CraftGroups = new CraftGroupCol();
|
||||
m_CraftSubRes = new CraftSubResCol();
|
||||
m_CraftSubRes2 = new CraftSubResCol();
|
||||
CraftItems = new CraftItemCol();
|
||||
CraftGroups = new CraftGroupCol();
|
||||
CraftSubRes = new CraftSubResCol();
|
||||
CraftSubRes2 = new CraftSubResCol();
|
||||
|
||||
m_Recipes = new List<int>();
|
||||
m_RareRecipes = new List<int>();
|
||||
|
|
@ -129,7 +105,7 @@ namespace Server.Engines.Craft
|
|||
public void CreateItem( Mobile from, Type type, Type typeRes, BaseTool tool, CraftItem realCraftItem )
|
||||
{
|
||||
// Verify if the type is in the list of the craftable item
|
||||
CraftItem craftItem = m_CraftItems.SearchFor( type );
|
||||
CraftItem craftItem = CraftItems.SearchFor( type );
|
||||
if ( craftItem != null )
|
||||
{
|
||||
// The item is in the list, try to create it
|
||||
|
|
@ -178,84 +154,84 @@ namespace Server.Engines.Craft
|
|||
craftItem.AddSkill( skillToMake, minSkill, maxSkill );
|
||||
|
||||
DoGroup( group, craftItem );
|
||||
return m_CraftItems.Add( craftItem );
|
||||
return CraftItems.Add( craftItem );
|
||||
}
|
||||
|
||||
|
||||
private void DoGroup( TextDefinition groupName, CraftItem craftItem )
|
||||
{
|
||||
int index = m_CraftGroups.SearchFor( groupName );
|
||||
int index = CraftGroups.SearchFor( groupName );
|
||||
|
||||
if ( index == -1)
|
||||
{
|
||||
CraftGroup craftGroup = new CraftGroup( groupName );
|
||||
craftGroup.AddCraftItem( craftItem );
|
||||
m_CraftGroups.Add( craftGroup );
|
||||
CraftGroups.Add( craftGroup );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CraftGroups.GetAt( index ).AddCraftItem( craftItem );
|
||||
CraftGroups.GetAt( index ).AddCraftItem( craftItem );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetItemHue( int index, int hue )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.ItemHue = hue;
|
||||
}
|
||||
|
||||
public void SetManaReq( int index, int mana )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.Mana = mana;
|
||||
}
|
||||
|
||||
public void SetStamReq( int index, int stam )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.Stam = stam;
|
||||
}
|
||||
|
||||
public void SetHitsReq( int index, int hits )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.Hits = hits;
|
||||
}
|
||||
|
||||
public void SetUseAllRes( int index, bool useAll )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.UseAllRes = useAll;
|
||||
}
|
||||
|
||||
public void SetNeedHeat( int index, bool needHeat )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.NeedHeat = needHeat;
|
||||
}
|
||||
|
||||
public void SetNeedOven( int index, bool needOven )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.NeedOven = needOven;
|
||||
}
|
||||
|
||||
public void SetBeverageType( int index, BeverageType requiredBeverage )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.RequiredBeverage = requiredBeverage;
|
||||
}
|
||||
|
||||
public void SetNeedMill( int index, bool needMill )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.NeedMill = needMill;
|
||||
}
|
||||
|
||||
public void SetNeededExpansion( int index, Expansion expansion )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.RequiredExpansion = expansion;
|
||||
}
|
||||
|
||||
|
|
@ -266,25 +242,25 @@ namespace Server.Engines.Craft
|
|||
|
||||
public void AddRes( int index, Type type, TextDefinition name, int amount, TextDefinition message )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.AddRes( type, name, amount, message );
|
||||
}
|
||||
|
||||
public void AddSkill( int index, SkillName skillToMake, double minSkill, double maxSkill )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt(index);
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.AddSkill(skillToMake, minSkill, maxSkill);
|
||||
}
|
||||
|
||||
public void SetUseSubRes2( int index, bool val )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt(index);
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.UseSubRes2 = val;
|
||||
}
|
||||
|
||||
private void AddRecipeBase( int index, int id )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.AddRecipe( id, this );
|
||||
}
|
||||
|
||||
|
|
@ -307,74 +283,74 @@ namespace Server.Engines.Craft
|
|||
|
||||
public void ForceNonExceptional( int index )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
CraftItem craftItem = CraftItems.GetAt( index );
|
||||
craftItem.ForceNonExceptional = true;
|
||||
}
|
||||
|
||||
|
||||
public void SetSubRes( Type type, string name )
|
||||
{
|
||||
m_CraftSubRes.ResType = type;
|
||||
m_CraftSubRes.NameString = name;
|
||||
m_CraftSubRes.Init = true;
|
||||
CraftSubRes.ResType = type;
|
||||
CraftSubRes.NameString = name;
|
||||
CraftSubRes.Init = true;
|
||||
}
|
||||
|
||||
public void SetSubRes( Type type, int name )
|
||||
{
|
||||
m_CraftSubRes.ResType = type;
|
||||
m_CraftSubRes.NameNumber = name;
|
||||
m_CraftSubRes.Init = true;
|
||||
CraftSubRes.ResType = type;
|
||||
CraftSubRes.NameNumber = name;
|
||||
CraftSubRes.Init = true;
|
||||
}
|
||||
|
||||
public void AddSubRes( Type type, int name, double reqSkill, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message );
|
||||
m_CraftSubRes.Add( craftSubRes );
|
||||
CraftSubRes.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void AddSubRes( Type type, int name, double reqSkill, int genericName, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, genericName, message );
|
||||
m_CraftSubRes.Add( craftSubRes );
|
||||
CraftSubRes.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void AddSubRes( Type type, string name, double reqSkill, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message );
|
||||
m_CraftSubRes.Add( craftSubRes );
|
||||
CraftSubRes.Add( craftSubRes );
|
||||
}
|
||||
|
||||
|
||||
public void SetSubRes2( Type type, string name )
|
||||
{
|
||||
m_CraftSubRes2.ResType = type;
|
||||
m_CraftSubRes2.NameString = name;
|
||||
m_CraftSubRes2.Init = true;
|
||||
CraftSubRes2.ResType = type;
|
||||
CraftSubRes2.NameString = name;
|
||||
CraftSubRes2.Init = true;
|
||||
}
|
||||
|
||||
public void SetSubRes2( Type type, int name )
|
||||
{
|
||||
m_CraftSubRes2.ResType = type;
|
||||
m_CraftSubRes2.NameNumber = name;
|
||||
m_CraftSubRes2.Init = true;
|
||||
CraftSubRes2.ResType = type;
|
||||
CraftSubRes2.NameNumber = name;
|
||||
CraftSubRes2.Init = true;
|
||||
}
|
||||
|
||||
public void AddSubRes2( Type type, int name, double reqSkill, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message );
|
||||
m_CraftSubRes2.Add( craftSubRes );
|
||||
CraftSubRes2.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void AddSubRes2( Type type, int name, double reqSkill, int genericName, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, genericName, message );
|
||||
m_CraftSubRes2.Add( craftSubRes );
|
||||
CraftSubRes2.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void AddSubRes2( Type type, string name, double reqSkill, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message );
|
||||
m_CraftSubRes2.Add( craftSubRes );
|
||||
CraftSubRes2.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public abstract void InitCraftList();
|
||||
|
|
|
|||
|
|
@ -5,28 +5,26 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public abstract class CustomCraft
|
||||
{
|
||||
private Mobile m_From;
|
||||
private CraftItem m_CraftItem;
|
||||
private CraftSystem m_CraftSystem;
|
||||
private Type m_TypeRes;
|
||||
private BaseTool m_Tool;
|
||||
private int m_Quality;
|
||||
public Mobile From { get; }
|
||||
|
||||
public Mobile From => m_From;
|
||||
public CraftItem CraftItem => m_CraftItem;
|
||||
public CraftSystem CraftSystem => m_CraftSystem;
|
||||
public Type TypeRes => m_TypeRes;
|
||||
public BaseTool Tool => m_Tool;
|
||||
public int Quality => m_Quality;
|
||||
public CraftItem CraftItem { get; }
|
||||
|
||||
public CraftSystem CraftSystem { get; }
|
||||
|
||||
public Type TypeRes { get; }
|
||||
|
||||
public BaseTool Tool { get; }
|
||||
|
||||
public int Quality { get; }
|
||||
|
||||
public CustomCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality )
|
||||
{
|
||||
m_From = from;
|
||||
m_CraftItem = craftItem;
|
||||
m_CraftSystem = craftSystem;
|
||||
m_TypeRes = typeRes;
|
||||
m_Tool = tool;
|
||||
m_Quality = quality;
|
||||
From = from;
|
||||
CraftItem = craftItem;
|
||||
CraftSystem = craftSystem;
|
||||
TypeRes = typeRes;
|
||||
Tool = tool;
|
||||
Quality = quality;
|
||||
}
|
||||
|
||||
public abstract void EndCraftAction();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
if ( targeted is PlayerMobile mobile )
|
||||
{
|
||||
foreach( KeyValuePair<int, Recipe> kvp in m_Recipes )
|
||||
foreach( KeyValuePair<int, Recipe> kvp in Recipes )
|
||||
mobile.AcquireRecipe( kvp.Key );
|
||||
|
||||
m.SendMessage( "You teach them all of the recipies." );
|
||||
|
|
@ -59,32 +59,15 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
|
||||
|
||||
private static Dictionary<int, Recipe> m_Recipes = new Dictionary<int, Recipe>();
|
||||
public static Dictionary<int, Recipe> Recipes { get; } = new Dictionary<int, Recipe>();
|
||||
|
||||
public static Dictionary<int, Recipe> Recipes => m_Recipes;
|
||||
public static int LargestRecipeID { get; private set; }
|
||||
|
||||
private static int m_LargestRecipeID;
|
||||
public static int LargestRecipeID => m_LargestRecipeID;
|
||||
public CraftSystem CraftSystem { get; set; }
|
||||
|
||||
private CraftSystem m_System;
|
||||
public CraftItem CraftItem { get; set; }
|
||||
|
||||
public CraftSystem CraftSystem
|
||||
{
|
||||
get => m_System;
|
||||
set => m_System = value;
|
||||
}
|
||||
|
||||
private CraftItem m_CraftItem;
|
||||
|
||||
public CraftItem CraftItem
|
||||
{
|
||||
get => m_CraftItem;
|
||||
set => m_CraftItem = value;
|
||||
}
|
||||
|
||||
private int m_ID;
|
||||
|
||||
public int ID => m_ID;
|
||||
public int ID { get; }
|
||||
|
||||
private TextDefinition m_TD;
|
||||
public TextDefinition TextDefinition
|
||||
|
|
@ -92,7 +75,7 @@ namespace Server.Engines.Craft
|
|||
get
|
||||
{
|
||||
if ( m_TD == null )
|
||||
m_TD = new TextDefinition( m_CraftItem.NameNumber, m_CraftItem.NameString );
|
||||
m_TD = new TextDefinition( CraftItem.NameNumber, CraftItem.NameString );
|
||||
|
||||
return m_TD;
|
||||
}
|
||||
|
|
@ -100,15 +83,15 @@ namespace Server.Engines.Craft
|
|||
|
||||
public Recipe( int id, CraftSystem system, CraftItem item )
|
||||
{
|
||||
m_ID = id;
|
||||
m_System = system;
|
||||
m_CraftItem = item;
|
||||
ID = id;
|
||||
CraftSystem = system;
|
||||
CraftItem = item;
|
||||
|
||||
if ( m_Recipes.ContainsKey( id ) )
|
||||
if ( Recipes.ContainsKey( id ) )
|
||||
throw new Exception( "Attempting to create recipe with preexisting ID." );
|
||||
|
||||
m_Recipes.Add( id, this );
|
||||
m_LargestRecipeID = Math.Max( id, m_LargestRecipeID );
|
||||
Recipes.Add( id, this );
|
||||
LargestRecipeID = Math.Max( id, LargestRecipeID );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -375,9 +375,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public abstract class TrapCraft : CustomCraft
|
||||
{
|
||||
private LockableContainer m_Container;
|
||||
|
||||
public LockableContainer Container => m_Container;
|
||||
public LockableContainer Container { get; private set; }
|
||||
|
||||
public abstract TrapType TrapType{ get; }
|
||||
|
||||
|
|
@ -414,7 +412,7 @@ namespace Server.Engines.Craft
|
|||
return false;
|
||||
}
|
||||
|
||||
m_Container = container;
|
||||
Container = container;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,56 +24,29 @@ namespace Server.Engines.Doom
|
|||
|
||||
private GauntletSpawnerState m_State;
|
||||
|
||||
private string m_TypeName;
|
||||
private BaseDoor m_Door;
|
||||
private BaseAddon m_Addon;
|
||||
private GauntletSpawner m_Sequence;
|
||||
private List<Mobile> m_Creatures;
|
||||
|
||||
private Rectangle2D m_RegionBounds;
|
||||
private List<BaseTrap> m_Traps;
|
||||
|
||||
private Region m_Region;
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TypeName { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TypeName
|
||||
{
|
||||
get => m_TypeName;
|
||||
set => m_TypeName = value;
|
||||
}
|
||||
public BaseDoor Door { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BaseDoor Door
|
||||
{
|
||||
get => m_Door;
|
||||
set => m_Door = value;
|
||||
}
|
||||
public BaseAddon Addon { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BaseAddon Addon
|
||||
{
|
||||
get => m_Addon;
|
||||
set => m_Addon = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public GauntletSpawner Sequence
|
||||
{
|
||||
get => m_Sequence;
|
||||
set => m_Sequence = value;
|
||||
}
|
||||
public GauntletSpawner Sequence { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool HasCompleted
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Creatures.Count == 0 )
|
||||
if ( Creatures.Count == 0 )
|
||||
return false;
|
||||
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
for ( int i = 0; i < Creatures.Count; ++i )
|
||||
{
|
||||
Mobile mob = m_Creatures[i];
|
||||
Mobile mob = Creatures[i];
|
||||
|
||||
if ( !mob.Deleted )
|
||||
return false;
|
||||
|
|
@ -84,11 +57,7 @@ namespace Server.Engines.Doom
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Rectangle2D RegionBounds
|
||||
{
|
||||
get => m_RegionBounds;
|
||||
set => m_RegionBounds = value;
|
||||
}
|
||||
public Rectangle2D RegionBounds { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public GauntletSpawnerState State
|
||||
|
|
@ -111,32 +80,32 @@ namespace Server.Engines.Doom
|
|||
case GauntletSpawnerState.Completed: hue = CompletedItemHue; break;
|
||||
}
|
||||
|
||||
if ( m_Door != null )
|
||||
if ( Door != null )
|
||||
{
|
||||
m_Door.Hue = hue;
|
||||
m_Door.Locked = lockDoors;
|
||||
Door.Hue = hue;
|
||||
Door.Locked = lockDoors;
|
||||
|
||||
if ( lockDoors )
|
||||
{
|
||||
m_Door.KeyValue = Key.RandomValue();
|
||||
m_Door.Open = false;
|
||||
Door.KeyValue = Key.RandomValue();
|
||||
Door.Open = false;
|
||||
}
|
||||
|
||||
if ( m_Door.Link != null )
|
||||
if ( Door.Link != null )
|
||||
{
|
||||
m_Door.Link.Hue = hue;
|
||||
m_Door.Link.Locked = lockDoors;
|
||||
Door.Link.Hue = hue;
|
||||
Door.Link.Locked = lockDoors;
|
||||
|
||||
if ( lockDoors )
|
||||
{
|
||||
m_Door.Link.KeyValue = Key.RandomValue();
|
||||
m_Door.Open = false;
|
||||
Door.Link.KeyValue = Key.RandomValue();
|
||||
Door.Open = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Addon != null )
|
||||
m_Addon.Hue = hue;
|
||||
if ( Addon != null )
|
||||
Addon.Hue = hue;
|
||||
|
||||
if ( m_State == GauntletSpawnerState.InProgress )
|
||||
{
|
||||
|
|
@ -160,27 +129,15 @@ namespace Server.Engines.Doom
|
|||
|
||||
private Timer m_Timer;
|
||||
|
||||
public List<Mobile> Creatures
|
||||
{
|
||||
get => m_Creatures;
|
||||
set => m_Creatures = value;
|
||||
}
|
||||
public List<Mobile> Creatures { get; set; }
|
||||
|
||||
public List<BaseTrap> Traps
|
||||
{
|
||||
get => m_Traps;
|
||||
set => m_Traps = value;
|
||||
}
|
||||
public List<BaseTrap> Traps { get; set; }
|
||||
|
||||
public Region Region
|
||||
{
|
||||
get => m_Region;
|
||||
set => m_Region = value;
|
||||
}
|
||||
public Region Region { get; set; }
|
||||
|
||||
public virtual void CreateRegion()
|
||||
{
|
||||
if ( m_Region != null )
|
||||
if ( Region != null )
|
||||
return;
|
||||
|
||||
Map map = Map;
|
||||
|
|
@ -188,29 +145,29 @@ namespace Server.Engines.Doom
|
|||
if ( map == null || map == Map.Internal )
|
||||
return;
|
||||
|
||||
m_Region = new GauntletRegion( this, map );
|
||||
Region = new GauntletRegion( this, map );
|
||||
}
|
||||
|
||||
public virtual void DestroyRegion()
|
||||
{
|
||||
m_Region?.Unregister();
|
||||
Region?.Unregister();
|
||||
|
||||
m_Region = null;
|
||||
Region = null;
|
||||
}
|
||||
|
||||
public virtual int ComputeTrapCount()
|
||||
{
|
||||
int area = m_RegionBounds.Width * m_RegionBounds.Height;
|
||||
int area = RegionBounds.Width * RegionBounds.Height;
|
||||
|
||||
return area / 100;
|
||||
}
|
||||
|
||||
public virtual void ClearTraps()
|
||||
{
|
||||
for ( int i = 0; i < m_Traps.Count; ++i )
|
||||
m_Traps[i].Delete();
|
||||
for ( int i = 0; i < Traps.Count; ++i )
|
||||
Traps[i].Delete();
|
||||
|
||||
m_Traps.Clear();
|
||||
Traps.Clear();
|
||||
}
|
||||
|
||||
public virtual void SpawnTrap()
|
||||
|
|
@ -244,8 +201,8 @@ namespace Server.Engines.Doom
|
|||
// try 10 times to find a valid location
|
||||
for ( int i = 0; i < 10; ++i )
|
||||
{
|
||||
int x = Utility.Random( m_RegionBounds.X, m_RegionBounds.Width );
|
||||
int y = Utility.Random( m_RegionBounds.Y, m_RegionBounds.Height );
|
||||
int x = Utility.Random( RegionBounds.X, RegionBounds.Width );
|
||||
int y = Utility.Random( RegionBounds.Y, RegionBounds.Height );
|
||||
int z = Z;
|
||||
|
||||
if ( !map.CanFit( x, y, z, 16, false, false ) )
|
||||
|
|
@ -255,7 +212,7 @@ namespace Server.Engines.Doom
|
|||
continue;
|
||||
|
||||
trap.MoveToWorld( new Point3D( x, y, z ), map );
|
||||
m_Traps.Add( trap );
|
||||
Traps.Add( trap );
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -279,8 +236,8 @@ namespace Server.Engines.Doom
|
|||
playerCount = reg.GetPlayerCount();
|
||||
}
|
||||
|
||||
if ( playerCount == 0 && m_Region != null )
|
||||
playerCount = m_Region.GetPlayerCount();
|
||||
if ( playerCount == 0 && Region != null )
|
||||
playerCount = Region.GetPlayerCount();
|
||||
|
||||
int count = (playerCount + PlayersPerSpawn - 1) / PlayersPerSpawn;
|
||||
|
||||
|
|
@ -292,10 +249,10 @@ namespace Server.Engines.Doom
|
|||
|
||||
public virtual void ClearCreatures()
|
||||
{
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
m_Creatures[i].Delete();
|
||||
for ( int i = 0; i < Creatures.Count; ++i )
|
||||
Creatures[i].Delete();
|
||||
|
||||
m_Creatures.Clear();
|
||||
Creatures.Clear();
|
||||
}
|
||||
|
||||
public virtual void FullSpawn()
|
||||
|
|
@ -319,10 +276,10 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
try
|
||||
{
|
||||
if ( m_TypeName == null )
|
||||
if ( TypeName == null )
|
||||
return;
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName( m_TypeName, true );
|
||||
Type type = ScriptCompiler.FindTypeByName( TypeName, true );
|
||||
|
||||
if ( type == null )
|
||||
return;
|
||||
|
|
@ -335,7 +292,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
mob.MoveToWorld( GetWorldLocation(), Map );
|
||||
|
||||
m_Creatures.Add( mob );
|
||||
Creatures.Add( mob );
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
@ -349,8 +306,8 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
State = GauntletSpawnerState.InSequence;
|
||||
|
||||
if ( m_Sequence != null && !m_Sequence.Deleted )
|
||||
m_Sequence.RecurseReset();
|
||||
if ( Sequence != null && !Sequence.Deleted )
|
||||
Sequence.RecurseReset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -361,19 +318,19 @@ namespace Server.Engines.Doom
|
|||
|
||||
int count = ComputeSpawnCount();
|
||||
|
||||
for ( int i = m_Creatures.Count; i < count; ++i )
|
||||
for ( int i = Creatures.Count; i < count; ++i )
|
||||
Spawn();
|
||||
|
||||
if ( HasCompleted )
|
||||
{
|
||||
State = GauntletSpawnerState.Completed;
|
||||
|
||||
if ( m_Sequence != null && !m_Sequence.Deleted )
|
||||
if ( Sequence != null && !Sequence.Deleted )
|
||||
{
|
||||
if ( m_Sequence.State == GauntletSpawnerState.Completed )
|
||||
if ( Sequence.State == GauntletSpawnerState.Completed )
|
||||
RecurseReset();
|
||||
|
||||
m_Sequence.State = GauntletSpawnerState.InProgress;
|
||||
Sequence.State = GauntletSpawnerState.InProgress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -391,9 +348,9 @@ namespace Server.Engines.Doom
|
|||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_TypeName = typeName;
|
||||
m_Creatures = new List<Mobile>();
|
||||
m_Traps = new List<BaseTrap>();
|
||||
TypeName = typeName;
|
||||
Creatures = new List<Mobile>();
|
||||
Traps = new List<BaseTrap>();
|
||||
}
|
||||
|
||||
public GauntletSpawner( Serial serial ) : base( serial )
|
||||
|
|
@ -406,16 +363,16 @@ namespace Server.Engines.Doom
|
|||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_RegionBounds );
|
||||
writer.Write( RegionBounds );
|
||||
|
||||
writer.WriteItemList<BaseTrap>( m_Traps, false );
|
||||
writer.WriteItemList<BaseTrap>( Traps, false );
|
||||
|
||||
writer.Write( m_Creatures, false );
|
||||
writer.Write( Creatures, false );
|
||||
|
||||
writer.Write( m_TypeName );
|
||||
writer.WriteItem<BaseDoor>( m_Door );
|
||||
writer.WriteItem<BaseAddon>( m_Addon );
|
||||
writer.WriteItem<GauntletSpawner>( m_Sequence );
|
||||
writer.Write( TypeName );
|
||||
writer.WriteItem<BaseDoor>( Door );
|
||||
writer.WriteItem<BaseAddon>( Addon );
|
||||
writer.WriteItem<GauntletSpawner>( Sequence );
|
||||
|
||||
writer.Write( (int) m_State );
|
||||
}
|
||||
|
|
@ -430,8 +387,8 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_RegionBounds = reader.ReadRect2D();
|
||||
m_Traps = reader.ReadStrongItemList<BaseTrap>();
|
||||
RegionBounds = reader.ReadRect2D();
|
||||
Traps = reader.ReadStrongItemList<BaseTrap>();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
|
@ -439,16 +396,16 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
if ( version < 1 )
|
||||
{
|
||||
m_Traps = new List<BaseTrap>();
|
||||
m_RegionBounds = new Rectangle2D( X - 40, Y - 40, 80, 80 );
|
||||
Traps = new List<BaseTrap>();
|
||||
RegionBounds = new Rectangle2D( X - 40, Y - 40, 80, 80 );
|
||||
}
|
||||
|
||||
m_Creatures = reader.ReadStrongMobileList();
|
||||
Creatures = reader.ReadStrongMobileList();
|
||||
|
||||
m_TypeName = reader.ReadString();
|
||||
m_Door = reader.ReadItem<BaseDoor>(); ;
|
||||
m_Addon = reader.ReadItem<BaseAddon>(); ;
|
||||
m_Sequence = reader.ReadItem<GauntletSpawner>();
|
||||
TypeName = reader.ReadString();
|
||||
Door = reader.ReadItem<BaseDoor>(); ;
|
||||
Addon = reader.ReadItem<BaseAddon>(); ;
|
||||
Sequence = reader.ReadItem<GauntletSpawner>();
|
||||
|
||||
State = (GauntletSpawnerState)reader.ReadInt();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,12 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
public class LeverPuzzleController : Item
|
||||
{
|
||||
private bool m_Enabled;
|
||||
private static bool installed;
|
||||
|
||||
private ushort m_MyKey;
|
||||
private ushort m_TheirKey;
|
||||
|
||||
private List<Item> m_Levers;
|
||||
private List<Item> m_Teles;
|
||||
private List<Item> m_Statues;
|
||||
private List<LeverPuzzleRegion> m_Tiles;
|
||||
private Mobile m_Successful;
|
||||
private LampRoomBox m_Box;
|
||||
private Region m_LampRoom;
|
||||
|
||||
|
|
@ -58,21 +53,15 @@ namespace Server.Engines.Doom
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ushort MyKey { get => m_MyKey;
|
||||
set => m_MyKey = value;
|
||||
}
|
||||
public ushort MyKey { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ushort TheirKey { get => m_TheirKey;
|
||||
set => m_TheirKey = value;
|
||||
}
|
||||
public ushort TheirKey { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Enabled { get => m_Enabled;
|
||||
set => m_Enabled = value;
|
||||
}
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public Mobile Successful => m_Successful;
|
||||
public Mobile Successful { get; private set; }
|
||||
|
||||
public bool CircleComplete
|
||||
{
|
||||
|
|
@ -253,7 +242,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
public virtual void RemoveSuccessful()
|
||||
{
|
||||
m_Successful=null;
|
||||
Successful=null;
|
||||
}
|
||||
|
||||
public virtual void LeverPulled( ushort code )
|
||||
|
|
@ -280,7 +269,7 @@ namespace Server.Engines.Doom
|
|||
if ( TheirKey == MyKey )
|
||||
{
|
||||
GenKey();
|
||||
if (( m_Successful = ( m_Player=GetOccupant( 0 ))) != null )
|
||||
if (( Successful = ( m_Player=GetOccupant( 0 ))) != null )
|
||||
{
|
||||
SendLocationEffect( lp_Center, 0x1153, 0, 60, 1 );
|
||||
PlaySounds( lp_Center, cs1 );
|
||||
|
|
@ -290,7 +279,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
m_Timer = new LampRoomTimer( this );
|
||||
m_Timer.Start();
|
||||
m_Enabled = false;
|
||||
Enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -715,9 +704,9 @@ namespace Server.Engines.Doom
|
|||
m_Tiles.Add( new LeverPuzzleRegion( this, TA[i] ));
|
||||
|
||||
m_LampRoom = new LampRoomRegion( this );
|
||||
m_Enabled = true;
|
||||
m_TheirKey = 0;
|
||||
m_MyKey = 0;
|
||||
Enabled = true;
|
||||
TheirKey = 0;
|
||||
MyKey = 0;
|
||||
GenKey();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,16 +95,15 @@ namespace Server.Engines.Doom
|
|||
|
||||
public class LeverPuzzleLever : Item
|
||||
{
|
||||
private ushort m_Code;
|
||||
private LeverPuzzleController m_Controller;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ushort Code => m_Code;
|
||||
public ushort Code { get; private set; }
|
||||
|
||||
public LeverPuzzleLever( ushort code, LeverPuzzleController controller ) : base( 0x108E )
|
||||
{
|
||||
m_Controller=controller;
|
||||
m_Code = code;
|
||||
Code = code;
|
||||
Hue = 0x66D;
|
||||
Movable = false;
|
||||
}
|
||||
|
|
@ -115,7 +114,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
ItemID^=2;
|
||||
Effects.PlaySound( Location, Map, 0x3E8 );
|
||||
m_Controller.LeverPulled( m_Code );
|
||||
m_Controller.LeverPulled( Code );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -136,14 +135,14 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write( (ushort) m_Code );
|
||||
writer.Write( (ushort) Code );
|
||||
writer.Write( m_Controller );
|
||||
}
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
m_Code = reader.ReadUShort();
|
||||
Code = reader.ReadUShort();
|
||||
m_Controller = reader.ReadItem() as LeverPuzzleController;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ namespace Server.Ethics
|
|||
{
|
||||
public class EthicsPersistance : Item
|
||||
{
|
||||
private static EthicsPersistance m_Instance;
|
||||
|
||||
public static EthicsPersistance Instance => m_Instance;
|
||||
public static EthicsPersistance Instance { get; private set; }
|
||||
|
||||
public override string DefaultName => "Ethics Persistance - Internal";
|
||||
|
||||
|
|
@ -14,8 +12,8 @@ namespace Server.Ethics
|
|||
{
|
||||
Movable = false;
|
||||
|
||||
if ( m_Instance == null || m_Instance.Deleted )
|
||||
m_Instance = this;
|
||||
if ( Instance == null || Instance.Deleted )
|
||||
Instance = this;
|
||||
else
|
||||
base.Delete();
|
||||
}
|
||||
|
|
@ -23,7 +21,7 @@ namespace Server.Ethics
|
|||
public EthicsPersistance( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
|
|||
|
|
@ -41,39 +41,23 @@ namespace Server.Ethics
|
|||
return pl;
|
||||
}
|
||||
|
||||
private Ethic m_Ethic;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
private int m_Power;
|
||||
private int m_History;
|
||||
|
||||
private Mobile m_Steed;
|
||||
private Mobile m_Familiar;
|
||||
|
||||
private DateTime m_Shield;
|
||||
|
||||
public Ethic Ethic => m_Ethic;
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public Ethic Ethic { get; }
|
||||
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Power { get => m_Power;
|
||||
set => m_Power = value;
|
||||
}
|
||||
public int Power { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int History { get => m_History;
|
||||
set => m_History = value;
|
||||
}
|
||||
public int History { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public Mobile Steed { get => m_Steed;
|
||||
set => m_Steed = value;
|
||||
}
|
||||
public Mobile Steed { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public Mobile Familiar { get => m_Familiar;
|
||||
set => m_Familiar = value;
|
||||
}
|
||||
public Mobile Familiar { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsShielded
|
||||
|
|
@ -103,38 +87,38 @@ namespace Server.Ethics
|
|||
|
||||
public Player( Ethic ethic, Mobile mobile )
|
||||
{
|
||||
m_Ethic = ethic;
|
||||
m_Mobile = mobile;
|
||||
Ethic = ethic;
|
||||
Mobile = mobile;
|
||||
|
||||
m_Power = 5;
|
||||
m_History = 5;
|
||||
Power = 5;
|
||||
History = 5;
|
||||
}
|
||||
|
||||
public void CheckAttach()
|
||||
{
|
||||
if ( m_Ethic.IsEligible( m_Mobile ) )
|
||||
if ( Ethic.IsEligible( Mobile ) )
|
||||
Attach();
|
||||
}
|
||||
|
||||
public void Attach()
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile mobile )
|
||||
if ( Mobile is PlayerMobile mobile )
|
||||
mobile.EthicPlayer = this;
|
||||
|
||||
m_Ethic.Players.Add( this );
|
||||
Ethic.Players.Add( this );
|
||||
}
|
||||
|
||||
public void Detach()
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile mobile )
|
||||
if ( Mobile is PlayerMobile mobile )
|
||||
mobile.EthicPlayer = null;
|
||||
|
||||
m_Ethic.Players.Remove( this );
|
||||
Ethic.Players.Remove( this );
|
||||
}
|
||||
|
||||
public Player( Ethic ethic, GenericReader reader )
|
||||
{
|
||||
m_Ethic = ethic;
|
||||
Ethic = ethic;
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -142,13 +126,13 @@ namespace Server.Ethics
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
m_Power = reader.ReadEncodedInt();
|
||||
m_History = reader.ReadEncodedInt();
|
||||
Power = reader.ReadEncodedInt();
|
||||
History = reader.ReadEncodedInt();
|
||||
|
||||
m_Steed = reader.ReadMobile();
|
||||
m_Familiar = reader.ReadMobile();
|
||||
Steed = reader.ReadMobile();
|
||||
Familiar = reader.ReadMobile();
|
||||
|
||||
m_Shield = reader.ReadDeltaTime();
|
||||
|
||||
|
|
@ -161,13 +145,13 @@ namespace Server.Ethics
|
|||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_Mobile );
|
||||
writer.Write( Mobile );
|
||||
|
||||
writer.WriteEncodedInt( m_Power );
|
||||
writer.WriteEncodedInt( m_History );
|
||||
writer.WriteEncodedInt( Power );
|
||||
writer.WriteEncodedInt( History );
|
||||
|
||||
writer.Write( m_Steed );
|
||||
writer.Write( m_Familiar );
|
||||
writer.Write( Steed );
|
||||
writer.Write( Familiar );
|
||||
|
||||
writer.WriteDeltaTime( m_Shield );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,34 +2,26 @@ namespace Server.Ethics
|
|||
{
|
||||
public class EthicDefinition
|
||||
{
|
||||
private int m_PrimaryHue;
|
||||
public int PrimaryHue { get; }
|
||||
|
||||
private TextDefinition m_Title;
|
||||
private TextDefinition m_Adjunct;
|
||||
public TextDefinition Title { get; }
|
||||
|
||||
private TextDefinition m_JoinPhrase;
|
||||
public TextDefinition Adjunct { get; }
|
||||
|
||||
private Power[] m_Powers;
|
||||
public TextDefinition JoinPhrase { get; }
|
||||
|
||||
public int PrimaryHue => m_PrimaryHue;
|
||||
|
||||
public TextDefinition Title => m_Title;
|
||||
public TextDefinition Adjunct => m_Adjunct;
|
||||
|
||||
public TextDefinition JoinPhrase => m_JoinPhrase;
|
||||
|
||||
public Power[] Powers => m_Powers;
|
||||
public Power[] Powers { get; }
|
||||
|
||||
public EthicDefinition( int primaryHue, TextDefinition title, TextDefinition adjunct, TextDefinition joinPhrase, Power[] powers )
|
||||
{
|
||||
m_PrimaryHue = primaryHue;
|
||||
PrimaryHue = primaryHue;
|
||||
|
||||
m_Title = title;
|
||||
m_Adjunct = adjunct;
|
||||
Title = title;
|
||||
Adjunct = adjunct;
|
||||
|
||||
m_JoinPhrase = joinPhrase;
|
||||
JoinPhrase = joinPhrase;
|
||||
|
||||
m_Powers = powers;
|
||||
Powers = powers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,25 +2,21 @@ namespace Server.Ethics
|
|||
{
|
||||
public class PowerDefinition
|
||||
{
|
||||
private int m_Power;
|
||||
public int Power { get; }
|
||||
|
||||
private TextDefinition m_Name;
|
||||
private TextDefinition m_Phrase;
|
||||
private TextDefinition m_Description;
|
||||
public TextDefinition Name { get; }
|
||||
|
||||
public int Power => m_Power;
|
||||
public TextDefinition Phrase { get; }
|
||||
|
||||
public TextDefinition Name => m_Name;
|
||||
public TextDefinition Phrase => m_Phrase;
|
||||
public TextDefinition Description => m_Description;
|
||||
public TextDefinition Description { get; }
|
||||
|
||||
public PowerDefinition( int power, TextDefinition name, TextDefinition phrase, TextDefinition description )
|
||||
{
|
||||
m_Power = power;
|
||||
Power = power;
|
||||
|
||||
m_Name = name;
|
||||
m_Phrase = phrase;
|
||||
m_Description = description;
|
||||
Name = name;
|
||||
Phrase = phrase;
|
||||
Description = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,22 +14,16 @@ namespace Server.Factions
|
|||
public const int MaxCandidates = 10;
|
||||
public const int CandidateRank = 5;
|
||||
|
||||
private Faction m_Faction;
|
||||
private List<Candidate> m_Candidates;
|
||||
public Faction Faction { get; }
|
||||
|
||||
private ElectionState m_State;
|
||||
private DateTime m_LastStateTime;
|
||||
public List<Candidate> Candidates { get; }
|
||||
|
||||
public Faction Faction => m_Faction;
|
||||
|
||||
public List<Candidate> Candidates => m_Candidates;
|
||||
|
||||
public ElectionState State{ get => m_State;
|
||||
set{ m_State = value; m_LastStateTime = DateTime.UtcNow; } }
|
||||
public DateTime LastStateTime => m_LastStateTime;
|
||||
public ElectionState State{ get => CurrentState;
|
||||
set{ CurrentState = value; LastStateTime = DateTime.UtcNow; } }
|
||||
public DateTime LastStateTime { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ElectionState CurrentState => m_State;
|
||||
public ElectionState CurrentState { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public TimeSpan NextStateTime
|
||||
|
|
@ -38,7 +32,7 @@ namespace Server.Factions
|
|||
{
|
||||
TimeSpan period;
|
||||
|
||||
switch ( m_State )
|
||||
switch ( CurrentState )
|
||||
{
|
||||
default:
|
||||
case ElectionState.Pending: period = PendingPeriod; break;
|
||||
|
|
@ -46,7 +40,7 @@ namespace Server.Factions
|
|||
case ElectionState.Campaign: period = CampaignPeriod; break;
|
||||
}
|
||||
|
||||
TimeSpan until = (m_LastStateTime + period) - DateTime.UtcNow;
|
||||
TimeSpan until = (LastStateTime + period) - DateTime.UtcNow;
|
||||
|
||||
if ( until < TimeSpan.Zero )
|
||||
until = TimeSpan.Zero;
|
||||
|
|
@ -57,7 +51,7 @@ namespace Server.Factions
|
|||
{
|
||||
TimeSpan period;
|
||||
|
||||
switch ( m_State )
|
||||
switch ( CurrentState )
|
||||
{
|
||||
default:
|
||||
case ElectionState.Pending: period = PendingPeriod; break;
|
||||
|
|
@ -65,7 +59,7 @@ namespace Server.Factions
|
|||
case ElectionState.Campaign: period = CampaignPeriod; break;
|
||||
}
|
||||
|
||||
m_LastStateTime = DateTime.UtcNow - period + value;
|
||||
LastStateTime = DateTime.UtcNow - period + value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,8 +72,8 @@ namespace Server.Factions
|
|||
|
||||
public Election( Faction faction )
|
||||
{
|
||||
m_Faction = faction;
|
||||
m_Candidates = new List<Candidate>();
|
||||
Faction = faction;
|
||||
Candidates = new List<Candidate>();
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
|
|
@ -92,12 +86,12 @@ namespace Server.Factions
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Faction = Faction.ReadReference( reader );
|
||||
Faction = Faction.ReadReference( reader );
|
||||
|
||||
m_LastStateTime = reader.ReadDateTime();
|
||||
m_State = (ElectionState)reader.ReadEncodedInt();
|
||||
LastStateTime = reader.ReadDateTime();
|
||||
CurrentState = (ElectionState)reader.ReadEncodedInt();
|
||||
|
||||
m_Candidates = new List<Candidate>();
|
||||
Candidates = new List<Candidate>();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -106,7 +100,7 @@ namespace Server.Factions
|
|||
Candidate cd = new Candidate( reader );
|
||||
|
||||
if ( cd.Mobile != null )
|
||||
m_Candidates.Add( cd );
|
||||
Candidates.Add( cd );
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -120,15 +114,15 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
Faction.WriteReference( writer, Faction );
|
||||
|
||||
writer.Write( (DateTime) m_LastStateTime );
|
||||
writer.WriteEncodedInt( (int) m_State );
|
||||
writer.Write( (DateTime) LastStateTime );
|
||||
writer.WriteEncodedInt( (int) CurrentState );
|
||||
|
||||
writer.WriteEncodedInt( m_Candidates.Count );
|
||||
writer.WriteEncodedInt( Candidates.Count );
|
||||
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
m_Candidates[i].Serialize( writer );
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
Candidates[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public void AddCandidate( Mobile mob )
|
||||
|
|
@ -136,17 +130,17 @@ namespace Server.Factions
|
|||
if ( IsCandidate( mob ) )
|
||||
return;
|
||||
|
||||
m_Candidates.Add( new Candidate( mob ) );
|
||||
Candidates.Add( new Candidate( mob ) );
|
||||
mob.SendLocalizedMessage( 1010117 ); // You are now running for office.
|
||||
}
|
||||
|
||||
public void RemoveVoter( Mobile mob )
|
||||
{
|
||||
if ( m_State == ElectionState.Election )
|
||||
if ( CurrentState == ElectionState.Election )
|
||||
{
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
{
|
||||
List<Voter> voters = m_Candidates[i].Voters;
|
||||
List<Voter> voters = Candidates[i].Voters;
|
||||
|
||||
for ( int j = 0; j < voters.Count; ++j )
|
||||
{
|
||||
|
|
@ -166,38 +160,38 @@ namespace Server.Factions
|
|||
if ( cd == null )
|
||||
return;
|
||||
|
||||
m_Candidates.Remove( cd );
|
||||
Candidates.Remove( cd );
|
||||
mob.SendLocalizedMessage( 1038031 );
|
||||
|
||||
if ( m_State == ElectionState.Election )
|
||||
if ( CurrentState == ElectionState.Election )
|
||||
{
|
||||
if ( m_Candidates.Count == 1 )
|
||||
if ( Candidates.Count == 1 )
|
||||
{
|
||||
m_Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election.
|
||||
Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election.
|
||||
|
||||
Candidate winner = m_Candidates[0];
|
||||
Candidate winner = Candidates[0];
|
||||
|
||||
Mobile winMob = winner.Mobile;
|
||||
PlayerState pl = PlayerState.Find( winMob );
|
||||
|
||||
if ( pl == null || pl.Faction != m_Faction || winMob == m_Faction.Commander )
|
||||
if ( pl == null || pl.Faction != Faction || winMob == Faction.Commander )
|
||||
{
|
||||
m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
m_Faction.Commander = winMob;
|
||||
Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
Faction.Commander = winMob;
|
||||
}
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else if ( m_Candidates.Count == 0 ) // well, I guess this'll never happen
|
||||
else if ( Candidates.Count == 0 ) // well, I guess this'll never happen
|
||||
{
|
||||
m_Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election.
|
||||
Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election.
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
}
|
||||
|
|
@ -210,7 +204,7 @@ namespace Server.Factions
|
|||
|
||||
public bool CanVote( Mobile mob )
|
||||
{
|
||||
return ( m_State == ElectionState.Election && !HasVoted( mob ) );
|
||||
return ( CurrentState == ElectionState.Election && !HasVoted( mob ) );
|
||||
}
|
||||
|
||||
public bool HasVoted( Mobile mob )
|
||||
|
|
@ -220,10 +214,10 @@ namespace Server.Factions
|
|||
|
||||
public Candidate FindCandidate( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
{
|
||||
if ( m_Candidates[i].Mobile == mob )
|
||||
return m_Candidates[i];
|
||||
if ( Candidates[i].Mobile == mob )
|
||||
return Candidates[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -231,16 +225,16 @@ namespace Server.Factions
|
|||
|
||||
public Candidate FindVoter( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
{
|
||||
List<Voter> voters = m_Candidates[i].Voters;
|
||||
List<Voter> voters = Candidates[i].Voters;
|
||||
|
||||
for ( int j = 0; j < voters.Count; ++j )
|
||||
{
|
||||
Voter voter = voters[j];
|
||||
|
||||
if ( voter.From == mob )
|
||||
return m_Candidates[i];
|
||||
return Candidates[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -252,20 +246,20 @@ namespace Server.Factions
|
|||
if ( IsCandidate( mob ) )
|
||||
return false;
|
||||
|
||||
if ( m_Candidates.Count >= MaxCandidates )
|
||||
if ( Candidates.Count >= MaxCandidates )
|
||||
return false;
|
||||
|
||||
if ( m_State != ElectionState.Campaign )
|
||||
if ( CurrentState != ElectionState.Campaign )
|
||||
return false; // sanity..
|
||||
|
||||
PlayerState pl = PlayerState.Find( mob );
|
||||
|
||||
return ( pl != null && pl.Faction == m_Faction && pl.Rank.Rank >= CandidateRank );
|
||||
return ( pl != null && pl.Faction == Faction && pl.Rank.Rank >= CandidateRank );
|
||||
}
|
||||
|
||||
public void Slice()
|
||||
{
|
||||
if ( m_Faction.Election != this )
|
||||
if ( Faction.Election != this )
|
||||
{
|
||||
m_Timer?.Stop();
|
||||
|
||||
|
|
@ -274,55 +268,55 @@ namespace Server.Factions
|
|||
return;
|
||||
}
|
||||
|
||||
switch ( m_State )
|
||||
switch ( CurrentState )
|
||||
{
|
||||
case ElectionState.Pending:
|
||||
{
|
||||
if ( (m_LastStateTime + PendingPeriod) > DateTime.UtcNow )
|
||||
if ( (LastStateTime + PendingPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
m_Faction.Broadcast( 1038023 ); // Campaigning for the Faction Commander election has begun.
|
||||
Faction.Broadcast( 1038023 ); // Campaigning for the Faction Commander election has begun.
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Campaign;
|
||||
|
||||
break;
|
||||
}
|
||||
case ElectionState.Campaign:
|
||||
{
|
||||
if ( (m_LastStateTime + CampaignPeriod) > DateTime.UtcNow )
|
||||
if ( (LastStateTime + CampaignPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
if ( m_Candidates.Count == 0 )
|
||||
if ( Candidates.Count == 0 )
|
||||
{
|
||||
m_Faction.Broadcast( 1038025 ); // Nobody ran for office.
|
||||
Faction.Broadcast( 1038025 ); // Nobody ran for office.
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else if ( m_Candidates.Count == 1 )
|
||||
else if ( Candidates.Count == 1 )
|
||||
{
|
||||
m_Faction.Broadcast( 1038029 ); // Only one member ran for office.
|
||||
Faction.Broadcast( 1038029 ); // Only one member ran for office.
|
||||
|
||||
Candidate winner = m_Candidates[0];
|
||||
Candidate winner = Candidates[0];
|
||||
|
||||
Mobile mob = winner.Mobile;
|
||||
PlayerState pl = PlayerState.Find( mob );
|
||||
|
||||
if ( pl == null || pl.Faction != m_Faction || mob == m_Faction.Commander )
|
||||
if ( pl == null || pl.Faction != Faction || mob == Faction.Commander )
|
||||
{
|
||||
m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
m_Faction.Commander = mob;
|
||||
Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
Faction.Commander = mob;
|
||||
}
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Faction.Broadcast( 1038030 );
|
||||
Faction.Broadcast( 1038030 );
|
||||
State = ElectionState.Election;
|
||||
}
|
||||
|
||||
|
|
@ -330,20 +324,20 @@ namespace Server.Factions
|
|||
}
|
||||
case ElectionState.Election:
|
||||
{
|
||||
if ( (m_LastStateTime + VotingPeriod) > DateTime.UtcNow )
|
||||
if ( (LastStateTime + VotingPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
m_Faction.Broadcast( 1038024 ); // The results for the Faction Commander election are in
|
||||
Faction.Broadcast( 1038024 ); // The results for the Faction Commander election are in
|
||||
|
||||
Candidate winner = null;
|
||||
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
{
|
||||
Candidate cd = m_Candidates[i];
|
||||
Candidate cd = Candidates[i];
|
||||
|
||||
PlayerState pl = PlayerState.Find( cd.Mobile );
|
||||
|
||||
if ( pl == null || pl.Faction != m_Faction )
|
||||
if ( pl == null || pl.Faction != Faction )
|
||||
continue;
|
||||
|
||||
//cd.CleanMuleVotes();
|
||||
|
|
@ -354,19 +348,19 @@ namespace Server.Factions
|
|||
|
||||
if ( winner == null )
|
||||
{
|
||||
m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
}
|
||||
else if ( winner.Mobile == m_Faction.Commander )
|
||||
else if ( winner.Mobile == Faction.Commander )
|
||||
{
|
||||
m_Faction.Broadcast( 1038027 ); // The incumbent won the election.
|
||||
Faction.Broadcast( 1038027 ); // The incumbent won the election.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
m_Faction.Commander = winner.Mobile;
|
||||
Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
Faction.Commander = winner.Mobile;
|
||||
}
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
|
||||
break;
|
||||
|
|
@ -377,35 +371,29 @@ namespace Server.Factions
|
|||
|
||||
public class Voter
|
||||
{
|
||||
private Mobile m_From;
|
||||
private Mobile m_Candidate;
|
||||
public Mobile From { get; }
|
||||
|
||||
private IPAddress m_Address;
|
||||
private DateTime m_Time;
|
||||
public Mobile Candidate { get; }
|
||||
|
||||
public Mobile From => m_From;
|
||||
public IPAddress Address { get; }
|
||||
|
||||
public Mobile Candidate => m_Candidate;
|
||||
|
||||
public IPAddress Address => m_Address;
|
||||
|
||||
public DateTime Time => m_Time;
|
||||
public DateTime Time { get; }
|
||||
|
||||
public object[] AcquireFields()
|
||||
{
|
||||
TimeSpan gameTime = TimeSpan.Zero;
|
||||
|
||||
if ( m_From is PlayerMobile mobile )
|
||||
if ( From is PlayerMobile mobile )
|
||||
gameTime = mobile.GameTime;
|
||||
|
||||
int kp = 0;
|
||||
|
||||
PlayerState pl = PlayerState.Find( m_From );
|
||||
PlayerState pl = PlayerState.Find( From );
|
||||
|
||||
if ( pl != null )
|
||||
kp = pl.KillPoints;
|
||||
|
||||
int sk = m_From.Skills.Total;
|
||||
int sk = From.Skills.Total;
|
||||
|
||||
int factorSkills = 50 + ( (sk * 100 ) / 10000 );
|
||||
int factorKillPts = 100 + (kp*2);
|
||||
|
|
@ -418,25 +406,25 @@ namespace Server.Factions
|
|||
else if ( totalFactor < 0 )
|
||||
totalFactor = 0;
|
||||
|
||||
return new object[]{ m_From, m_Address, m_Time, totalFactor };
|
||||
return new object[]{ From, Address, Time, totalFactor };
|
||||
}
|
||||
|
||||
public Voter( Mobile from, Mobile candidate )
|
||||
{
|
||||
m_From = from;
|
||||
m_Candidate = candidate;
|
||||
From = from;
|
||||
Candidate = candidate;
|
||||
|
||||
if ( m_From.NetState != null )
|
||||
m_Address = m_From.NetState.Address;
|
||||
if ( From.NetState != null )
|
||||
Address = From.NetState.Address;
|
||||
else
|
||||
m_Address = IPAddress.None;
|
||||
Address = IPAddress.None;
|
||||
|
||||
m_Time = DateTime.UtcNow;
|
||||
Time = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public Voter( GenericReader reader, Mobile candidate )
|
||||
{
|
||||
m_Candidate = candidate;
|
||||
Candidate = candidate;
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -444,9 +432,9 @@ namespace Server.Factions
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_From = reader.ReadMobile();
|
||||
m_Address = Utility.Intern( reader.ReadIPAddress() );
|
||||
m_Time = reader.ReadDateTime();
|
||||
From = reader.ReadMobile();
|
||||
Address = Utility.Intern( reader.ReadIPAddress() );
|
||||
Time = reader.ReadDateTime();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -457,37 +445,35 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 );
|
||||
|
||||
writer.Write( (Mobile) m_From );
|
||||
writer.Write( (IPAddress) m_Address );
|
||||
writer.Write( (DateTime) m_Time );
|
||||
writer.Write( (Mobile) From );
|
||||
writer.Write( (IPAddress) Address );
|
||||
writer.Write( (DateTime) Time );
|
||||
}
|
||||
}
|
||||
|
||||
public class Candidate
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private List<Voter> m_Voters;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public List<Voter> Voters => m_Voters;
|
||||
public List<Voter> Voters { get; }
|
||||
|
||||
public int Votes => m_Voters.Count;
|
||||
public int Votes => Voters.Count;
|
||||
|
||||
public void CleanMuleVotes()
|
||||
{
|
||||
for ( int i = 0; i < m_Voters.Count; ++i )
|
||||
for ( int i = 0; i < Voters.Count; ++i )
|
||||
{
|
||||
Voter voter = (Voter)m_Voters[i];
|
||||
Voter voter = (Voter)Voters[i];
|
||||
|
||||
if ( (int)voter.AcquireFields()[3] < 90 )
|
||||
m_Voters.RemoveAt( i-- );
|
||||
Voters.RemoveAt( i-- );
|
||||
}
|
||||
}
|
||||
|
||||
public Candidate( Mobile mob )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Voters = new List<Voter>();
|
||||
Mobile = mob;
|
||||
Voters = new List<Voter>();
|
||||
}
|
||||
|
||||
public Candidate( GenericReader reader )
|
||||
|
|
@ -498,30 +484,30 @@ namespace Server.Factions
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
m_Voters = new List<Voter>( count );
|
||||
Voters = new List<Voter>( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
Voter voter = new Voter( reader, m_Mobile );
|
||||
Voter voter = new Voter( reader, Mobile );
|
||||
|
||||
if ( voter.From != null )
|
||||
m_Voters.Add( voter );
|
||||
Voters.Add( voter );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
List<Mobile> mobs = reader.ReadStrongMobileList();
|
||||
m_Voters = new List<Voter>( mobs.Count );
|
||||
Voters = new List<Voter>( mobs.Count );
|
||||
|
||||
for ( int i = 0; i < mobs.Count; ++i )
|
||||
m_Voters.Add( new Voter( mobs[i], m_Mobile ) );
|
||||
Voters.Add( new Voter( mobs[i], Mobile ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -532,12 +518,12 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.Write( (Mobile) Mobile );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Voters.Count );
|
||||
writer.WriteEncodedInt( (int) Voters.Count );
|
||||
|
||||
for ( int i = 0; i < m_Voters.Count; ++i )
|
||||
((Voter)m_Voters[i]).Serialize( writer );
|
||||
for ( int i = 0; i < Voters.Count; ++i )
|
||||
((Voter)Voters[i]).Serialize( writer );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,14 +18,8 @@ namespace Server.Factions
|
|||
public int ZeroRankOffset;
|
||||
|
||||
private FactionDefinition m_Definition;
|
||||
private FactionState m_State;
|
||||
private StrongholdRegion m_StrongholdRegion;
|
||||
|
||||
public StrongholdRegion StrongholdRegion
|
||||
{
|
||||
get => m_StrongholdRegion;
|
||||
set => m_StrongholdRegion = value;
|
||||
}
|
||||
public StrongholdRegion StrongholdRegion { get; set; }
|
||||
|
||||
public FactionDefinition Definition
|
||||
{
|
||||
|
|
@ -33,49 +27,45 @@ namespace Server.Factions
|
|||
set
|
||||
{
|
||||
m_Definition = value;
|
||||
m_StrongholdRegion = new StrongholdRegion( this );
|
||||
StrongholdRegion = new StrongholdRegion( this );
|
||||
}
|
||||
}
|
||||
|
||||
public FactionState State
|
||||
{
|
||||
get => m_State;
|
||||
set => m_State = value;
|
||||
}
|
||||
public FactionState State { get; set; }
|
||||
|
||||
public Election Election
|
||||
{
|
||||
get => m_State.Election;
|
||||
set => m_State.Election = value;
|
||||
get => State.Election;
|
||||
set => State.Election = value;
|
||||
}
|
||||
|
||||
public Mobile Commander
|
||||
{
|
||||
get => m_State.Commander;
|
||||
set => m_State.Commander = value;
|
||||
get => State.Commander;
|
||||
set => State.Commander = value;
|
||||
}
|
||||
|
||||
public int Tithe
|
||||
{
|
||||
get => m_State.Tithe;
|
||||
set => m_State.Tithe = value;
|
||||
get => State.Tithe;
|
||||
set => State.Tithe = value;
|
||||
}
|
||||
|
||||
public int Silver
|
||||
{
|
||||
get => m_State.Silver;
|
||||
set => m_State.Silver = value;
|
||||
get => State.Silver;
|
||||
set => State.Silver = value;
|
||||
}
|
||||
|
||||
public List<PlayerState> Members
|
||||
{
|
||||
get => m_State.Members;
|
||||
set => m_State.Members = value;
|
||||
get => State.Members;
|
||||
set => State.Members = value;
|
||||
}
|
||||
|
||||
public static readonly TimeSpan LeavePeriod = TimeSpan.FromDays( 3.0 );
|
||||
|
||||
public bool FactionMessageReady => m_State.FactionMessageReady;
|
||||
public bool FactionMessageReady => State.FactionMessageReady;
|
||||
|
||||
public void Broadcast( string text )
|
||||
{
|
||||
|
|
@ -117,7 +107,7 @@ namespace Server.Factions
|
|||
public void EndBroadcast( Mobile from, string text )
|
||||
{
|
||||
if ( from.AccessLevel == AccessLevel.Player )
|
||||
m_State.RegisterBroadcast();
|
||||
State.RegisterBroadcast();
|
||||
|
||||
Broadcast( Definition.HueBroadcast, "{0} [Commander] {1} : {2}", from.Name, Definition.FriendlyName, text );
|
||||
}
|
||||
|
|
@ -514,7 +504,7 @@ namespace Server.Factions
|
|||
|
||||
public Faction()
|
||||
{
|
||||
m_State = new FactionState( this );
|
||||
State = new FactionState( this );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
@ -949,8 +939,8 @@ namespace Server.Factions
|
|||
|
||||
public List<BaseFactionTrap> Traps
|
||||
{
|
||||
get => m_State.Traps;
|
||||
set => m_State.Traps = value;
|
||||
get => State.Traps;
|
||||
set => State.Traps = value;
|
||||
}
|
||||
|
||||
public const int StabilityFactor = 300; // 300% greater (3 times) than smallest faction
|
||||
|
|
|
|||
|
|
@ -11,28 +11,26 @@ namespace Server.Factions
|
|||
{
|
||||
public static readonly TimeSpan ExpirationPeriod = TimeSpan.FromDays( 21.0 );
|
||||
|
||||
private Item m_Item;
|
||||
private Faction m_Faction;
|
||||
private DateTime m_Expiration;
|
||||
public Item Item { get; }
|
||||
|
||||
public Item Item => m_Item;
|
||||
public Faction Faction => m_Faction;
|
||||
public DateTime Expiration => m_Expiration;
|
||||
public Faction Faction { get; }
|
||||
|
||||
public DateTime Expiration { get; private set; }
|
||||
|
||||
public bool HasExpired
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Item == null || m_Item.Deleted )
|
||||
if ( Item == null || Item.Deleted )
|
||||
return true;
|
||||
|
||||
return ( m_Expiration != DateTime.MinValue && DateTime.UtcNow >= m_Expiration );
|
||||
return ( Expiration != DateTime.MinValue && DateTime.UtcNow >= Expiration );
|
||||
}
|
||||
}
|
||||
|
||||
public void StartExpiration()
|
||||
{
|
||||
m_Expiration = DateTime.UtcNow + ExpirationPeriod;
|
||||
Expiration = DateTime.UtcNow + ExpirationPeriod;
|
||||
}
|
||||
|
||||
public void CheckAttach()
|
||||
|
|
@ -45,25 +43,25 @@ namespace Server.Factions
|
|||
|
||||
public void Attach()
|
||||
{
|
||||
if ( m_Item is IFactionItem item )
|
||||
if ( Item is IFactionItem item )
|
||||
item.FactionItemState = this;
|
||||
|
||||
m_Faction?.State.FactionItems.Add( this );
|
||||
Faction?.State.FactionItems.Add( this );
|
||||
}
|
||||
|
||||
public void Detach()
|
||||
{
|
||||
if ( m_Item is IFactionItem item )
|
||||
if ( Item is IFactionItem item )
|
||||
item.FactionItemState = null;
|
||||
|
||||
if ( m_Faction != null && m_Faction.State.FactionItems.Contains( this ) )
|
||||
m_Faction.State.FactionItems.Remove( this );
|
||||
if ( Faction != null && Faction.State.FactionItems.Contains( this ) )
|
||||
Faction.State.FactionItems.Remove( this );
|
||||
}
|
||||
|
||||
public FactionItem( Item item, Faction faction )
|
||||
{
|
||||
m_Item = item;
|
||||
m_Faction = faction;
|
||||
Item = item;
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public FactionItem( GenericReader reader, Faction faction )
|
||||
|
|
@ -74,21 +72,21 @@ namespace Server.Factions
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Item = reader.ReadItem();
|
||||
m_Expiration = reader.ReadDateTime();
|
||||
Item = reader.ReadItem();
|
||||
Expiration = reader.ReadDateTime();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_Faction = faction;
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 0 );
|
||||
|
||||
writer.Write( (Item) m_Item );
|
||||
writer.Write( (DateTime) m_Expiration );
|
||||
writer.Write( (Item) Item );
|
||||
writer.Write( (DateTime) Expiration );
|
||||
}
|
||||
|
||||
public static int GetMaxWearables( Mobile mob )
|
||||
|
|
|
|||
|
|
@ -7,22 +7,13 @@ namespace Server.Factions
|
|||
{
|
||||
private Faction m_Faction;
|
||||
private Mobile m_Commander;
|
||||
private int m_Tithe;
|
||||
private int m_Silver;
|
||||
private List<PlayerState> m_Members;
|
||||
private Election m_Election;
|
||||
private List<FactionItem> m_FactionItems;
|
||||
private List<BaseFactionTrap> m_FactionTraps;
|
||||
private DateTime m_LastAtrophy;
|
||||
|
||||
private const int BroadcastsPerPeriod = 2;
|
||||
private static readonly TimeSpan BroadcastPeriod = TimeSpan.FromHours( 1.0 );
|
||||
|
||||
private DateTime[] m_LastBroadcasts = new DateTime[BroadcastsPerPeriod];
|
||||
|
||||
public DateTime LastAtrophy{ get => m_LastAtrophy;
|
||||
set => m_LastAtrophy = value;
|
||||
}
|
||||
public DateTime LastAtrophy { get; set; }
|
||||
|
||||
public bool FactionMessageReady
|
||||
{
|
||||
|
|
@ -38,17 +29,17 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsAtrophyReady => DateTime.UtcNow >= (m_LastAtrophy + TimeSpan.FromHours( 47.0 ));
|
||||
public bool IsAtrophyReady => DateTime.UtcNow >= (LastAtrophy + TimeSpan.FromHours( 47.0 ));
|
||||
|
||||
public int CheckAtrophy()
|
||||
{
|
||||
if ( DateTime.UtcNow < (m_LastAtrophy + TimeSpan.FromHours( 47.0 )) )
|
||||
if ( DateTime.UtcNow < (LastAtrophy + TimeSpan.FromHours( 47.0 )) )
|
||||
return 0;
|
||||
|
||||
int distrib = 0;
|
||||
m_LastAtrophy = DateTime.UtcNow;
|
||||
LastAtrophy = DateTime.UtcNow;
|
||||
|
||||
List<PlayerState> members = new List<PlayerState>( m_Members );
|
||||
List<PlayerState> members = new List<PlayerState>( Members );
|
||||
|
||||
for ( int i = 0; i < members.Count; ++i )
|
||||
{
|
||||
|
|
@ -83,23 +74,11 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public List<FactionItem> FactionItems
|
||||
{
|
||||
get => m_FactionItems;
|
||||
set => m_FactionItems = value;
|
||||
}
|
||||
public List<FactionItem> FactionItems { get; set; }
|
||||
|
||||
public List<BaseFactionTrap> Traps
|
||||
{
|
||||
get => m_FactionTraps;
|
||||
set => m_FactionTraps = value;
|
||||
}
|
||||
public List<BaseFactionTrap> Traps { get; set; }
|
||||
|
||||
public Election Election
|
||||
{
|
||||
get => m_Election;
|
||||
set => m_Election = value;
|
||||
}
|
||||
public Election Election { get; set; }
|
||||
|
||||
public Mobile Commander
|
||||
{
|
||||
|
|
@ -127,32 +106,20 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public int Tithe
|
||||
{
|
||||
get => m_Tithe;
|
||||
set => m_Tithe = value;
|
||||
}
|
||||
public int Tithe { get; set; }
|
||||
|
||||
public int Silver
|
||||
{
|
||||
get => m_Silver;
|
||||
set => m_Silver = value;
|
||||
}
|
||||
public int Silver { get; set; }
|
||||
|
||||
public List<PlayerState> Members
|
||||
{
|
||||
get => m_Members;
|
||||
set => m_Members = value;
|
||||
}
|
||||
public List<PlayerState> Members { get; set; }
|
||||
|
||||
public FactionState( Faction faction )
|
||||
{
|
||||
m_Faction = faction;
|
||||
m_Tithe = 50;
|
||||
m_Members = new List<PlayerState>();
|
||||
m_Election = new Election( faction );
|
||||
m_FactionItems = new List<FactionItem>();
|
||||
m_FactionTraps = new List<BaseFactionTrap>();
|
||||
Tithe = 50;
|
||||
Members = new List<PlayerState>();
|
||||
Election = new Election( faction );
|
||||
FactionItems = new List<FactionItem>();
|
||||
Traps = new List<BaseFactionTrap>();
|
||||
}
|
||||
|
||||
public FactionState( GenericReader reader )
|
||||
|
|
@ -163,7 +130,7 @@ namespace Server.Factions
|
|||
{
|
||||
case 5:
|
||||
{
|
||||
m_LastAtrophy = reader.ReadDateTime();
|
||||
LastAtrophy = reader.ReadDateTime();
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
|
|
@ -184,7 +151,7 @@ namespace Server.Factions
|
|||
case 2:
|
||||
case 1:
|
||||
{
|
||||
m_Election = new Election( reader );
|
||||
Election = new Election( reader );
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
|
@ -195,7 +162,7 @@ namespace Server.Factions
|
|||
m_Commander = reader.ReadMobile();
|
||||
|
||||
if ( version < 5 )
|
||||
m_LastAtrophy = DateTime.UtcNow;
|
||||
LastAtrophy = DateTime.UtcNow;
|
||||
|
||||
if ( version < 4 )
|
||||
{
|
||||
|
|
@ -205,28 +172,28 @@ namespace Server.Factions
|
|||
m_LastBroadcasts[0] = time;
|
||||
}
|
||||
|
||||
m_Tithe = reader.ReadEncodedInt();
|
||||
m_Silver = reader.ReadEncodedInt();
|
||||
Tithe = reader.ReadEncodedInt();
|
||||
Silver = reader.ReadEncodedInt();
|
||||
|
||||
int memberCount = reader.ReadEncodedInt();
|
||||
|
||||
m_Members = new List<PlayerState>();
|
||||
Members = new List<PlayerState>();
|
||||
|
||||
for ( int i = 0; i < memberCount; ++i )
|
||||
{
|
||||
PlayerState pl = new PlayerState( reader, m_Faction, m_Members );
|
||||
PlayerState pl = new PlayerState( reader, m_Faction, Members );
|
||||
|
||||
if ( pl.Mobile != null )
|
||||
m_Members.Add( pl );
|
||||
Members.Add( pl );
|
||||
}
|
||||
|
||||
m_Faction.State = this;
|
||||
|
||||
m_Faction.ZeroRankOffset = m_Members.Count;
|
||||
m_Members.Sort();
|
||||
m_Faction.ZeroRankOffset = Members.Count;
|
||||
Members.Sort();
|
||||
|
||||
for ( int i = m_Members.Count - 1; i >= 0; i-- ) {
|
||||
PlayerState player = m_Members[i];
|
||||
for ( int i = Members.Count - 1; i >= 0; i-- ) {
|
||||
PlayerState player = Members[i];
|
||||
|
||||
if ( player.KillPoints <= 0 )
|
||||
m_Faction.ZeroRankOffset = i;
|
||||
|
|
@ -234,7 +201,7 @@ namespace Server.Factions
|
|||
player.RankIndex = i;
|
||||
}
|
||||
|
||||
m_FactionItems = new List<FactionItem>();
|
||||
FactionItems = new List<FactionItem>();
|
||||
|
||||
if ( version >= 2 )
|
||||
{
|
||||
|
|
@ -248,7 +215,7 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
m_FactionTraps = new List<BaseFactionTrap>();
|
||||
Traps = new List<BaseFactionTrap>();
|
||||
|
||||
if ( version >= 3 )
|
||||
{
|
||||
|
|
@ -257,7 +224,7 @@ namespace Server.Factions
|
|||
for ( int i = 0; i < factionTrapCount; ++i )
|
||||
{
|
||||
if ( reader.ReadItem() is BaseFactionTrap trap && !trap.CheckDecay() )
|
||||
m_FactionTraps.Add( trap );
|
||||
Traps.Add( trap );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -266,47 +233,47 @@ namespace Server.Factions
|
|||
}
|
||||
|
||||
if ( version < 1 )
|
||||
m_Election = new Election( m_Faction );
|
||||
Election = new Election( m_Faction );
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 5 ); // version
|
||||
|
||||
writer.Write( m_LastAtrophy );
|
||||
writer.Write( LastAtrophy );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_LastBroadcasts.Length );
|
||||
|
||||
for ( int i = 0; i < m_LastBroadcasts.Length; ++i )
|
||||
writer.Write( (DateTime) m_LastBroadcasts[i] );
|
||||
|
||||
m_Election.Serialize( writer );
|
||||
Election.Serialize( writer );
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
|
||||
writer.Write( (Mobile) m_Commander );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Tithe );
|
||||
writer.WriteEncodedInt( (int) m_Silver );
|
||||
writer.WriteEncodedInt( (int) Tithe );
|
||||
writer.WriteEncodedInt( (int) Silver );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Members.Count );
|
||||
writer.WriteEncodedInt( (int) Members.Count );
|
||||
|
||||
for ( int i = 0; i < m_Members.Count; ++i )
|
||||
for ( int i = 0; i < Members.Count; ++i )
|
||||
{
|
||||
PlayerState pl = (PlayerState) m_Members[i];
|
||||
PlayerState pl = (PlayerState) Members[i];
|
||||
|
||||
pl.Serialize( writer );
|
||||
}
|
||||
|
||||
writer.WriteEncodedInt( (int) m_FactionItems.Count );
|
||||
writer.WriteEncodedInt( (int) FactionItems.Count );
|
||||
|
||||
for ( int i = 0; i < m_FactionItems.Count; ++i )
|
||||
m_FactionItems[i].Serialize( writer );
|
||||
for ( int i = 0; i < FactionItems.Count; ++i )
|
||||
FactionItems[i].Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_FactionTraps.Count );
|
||||
writer.WriteEncodedInt( (int) Traps.Count );
|
||||
|
||||
for ( int i = 0; i < m_FactionTraps.Count; ++i )
|
||||
writer.Write( (Item) m_FactionTraps[i] );
|
||||
for ( int i = 0; i < Traps.Count; ++i )
|
||||
writer.Write( (Item) Traps[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,22 +5,20 @@ namespace Server.Factions
|
|||
{
|
||||
public class GuardList
|
||||
{
|
||||
private GuardDefinition m_Definition;
|
||||
private List<BaseFactionGuard> m_Guards;
|
||||
public GuardDefinition Definition { get; }
|
||||
|
||||
public GuardDefinition Definition => m_Definition;
|
||||
public List<BaseFactionGuard> Guards => m_Guards;
|
||||
public List<BaseFactionGuard> Guards { get; }
|
||||
|
||||
public BaseFactionGuard Construct()
|
||||
{
|
||||
try{ return Activator.CreateInstance( m_Definition.Type ) as BaseFactionGuard; }
|
||||
try{ return Activator.CreateInstance( Definition.Type ) as BaseFactionGuard; }
|
||||
catch{ return null; }
|
||||
}
|
||||
|
||||
public GuardList( GuardDefinition definition )
|
||||
{
|
||||
m_Definition = definition;
|
||||
m_Guards = new List<BaseFactionGuard>();
|
||||
Definition = definition;
|
||||
Guards = new List<BaseFactionGuard>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,56 +12,53 @@ namespace Server.Factions
|
|||
|
||||
public class MerchantTitleInfo
|
||||
{
|
||||
private SkillName m_Skill;
|
||||
private double m_Requirement;
|
||||
private TextDefinition m_Title;
|
||||
private TextDefinition m_Label;
|
||||
private TextDefinition m_Assigned;
|
||||
public SkillName Skill { get; }
|
||||
|
||||
public SkillName Skill => m_Skill;
|
||||
public double Requirement => m_Requirement;
|
||||
public TextDefinition Title => m_Title;
|
||||
public TextDefinition Label => m_Label;
|
||||
public TextDefinition Assigned => m_Assigned;
|
||||
public double Requirement { get; }
|
||||
|
||||
public TextDefinition Title { get; }
|
||||
|
||||
public TextDefinition Label { get; }
|
||||
|
||||
public TextDefinition Assigned { get; }
|
||||
|
||||
public MerchantTitleInfo( SkillName skill, double requirement, TextDefinition title, TextDefinition label, TextDefinition assigned )
|
||||
{
|
||||
m_Skill = skill;
|
||||
m_Requirement = requirement;
|
||||
m_Title = title;
|
||||
m_Label = label;
|
||||
m_Assigned = assigned;
|
||||
Skill = skill;
|
||||
Requirement = requirement;
|
||||
Title = title;
|
||||
Label = label;
|
||||
Assigned = assigned;
|
||||
}
|
||||
}
|
||||
|
||||
public class MerchantTitles
|
||||
{
|
||||
private static MerchantTitleInfo[] m_Info = {
|
||||
new MerchantTitleInfo( SkillName.Inscribe, 90.0, new TextDefinition( 1060773, "Scribe" ), new TextDefinition( 1011468, "SCRIBE" ), new TextDefinition( 1010121, "You now have the faction title of scribe" ) ),
|
||||
new MerchantTitleInfo( SkillName.Carpentry, 90.0, new TextDefinition( 1060774, "Carpenter" ), new TextDefinition( 1011469, "CARPENTER" ), new TextDefinition( 1010122, "You now have the faction title of carpenter" ) ),
|
||||
new MerchantTitleInfo( SkillName.Tinkering, 90.0, new TextDefinition( 1022984, "Tinker" ), new TextDefinition( 1011470, "TINKER" ), new TextDefinition( 1010123, "You now have the faction title of tinker" ) ),
|
||||
new MerchantTitleInfo( SkillName.Blacksmith, 90.0, new TextDefinition( 1023016, "Blacksmith" ), new TextDefinition( 1011471, "BLACKSMITH" ), new TextDefinition( 1010124, "You now have the faction title of blacksmith" ) ),
|
||||
new MerchantTitleInfo( SkillName.Fletching, 90.0, new TextDefinition( 1023022, "Bowyer" ), new TextDefinition( 1011472, "BOWYER" ), new TextDefinition( 1010125, "You now have the faction title of Bowyer" ) ),
|
||||
new MerchantTitleInfo( SkillName.Tailoring, 90.0, new TextDefinition( 1022982, "Tailor" ), new TextDefinition( 1018300, "TAILOR" ), new TextDefinition( 1042162, "You now have the faction title of Tailor" ) ),
|
||||
};
|
||||
|
||||
public static MerchantTitleInfo[] Info => m_Info;
|
||||
public static MerchantTitleInfo[] Info { get; } =
|
||||
{
|
||||
new MerchantTitleInfo( SkillName.Inscribe, 90.0, new TextDefinition( 1060773, "Scribe" ), new TextDefinition( 1011468, "SCRIBE" ), new TextDefinition( 1010121, "You now have the faction title of scribe" ) ),
|
||||
new MerchantTitleInfo( SkillName.Carpentry, 90.0, new TextDefinition( 1060774, "Carpenter" ), new TextDefinition( 1011469, "CARPENTER" ), new TextDefinition( 1010122, "You now have the faction title of carpenter" ) ),
|
||||
new MerchantTitleInfo( SkillName.Tinkering, 90.0, new TextDefinition( 1022984, "Tinker" ), new TextDefinition( 1011470, "TINKER" ), new TextDefinition( 1010123, "You now have the faction title of tinker" ) ),
|
||||
new MerchantTitleInfo( SkillName.Blacksmith, 90.0, new TextDefinition( 1023016, "Blacksmith" ), new TextDefinition( 1011471, "BLACKSMITH" ), new TextDefinition( 1010124, "You now have the faction title of blacksmith" ) ),
|
||||
new MerchantTitleInfo( SkillName.Fletching, 90.0, new TextDefinition( 1023022, "Bowyer" ), new TextDefinition( 1011472, "BOWYER" ), new TextDefinition( 1010125, "You now have the faction title of Bowyer" ) ),
|
||||
new MerchantTitleInfo( SkillName.Tailoring, 90.0, new TextDefinition( 1022982, "Tailor" ), new TextDefinition( 1018300, "TAILOR" ), new TextDefinition( 1042162, "You now have the faction title of Tailor" ) ),
|
||||
};
|
||||
|
||||
public static MerchantTitleInfo GetInfo( MerchantTitle title )
|
||||
{
|
||||
int idx = (int)title - 1;
|
||||
|
||||
if ( idx >= 0 && idx < m_Info.Length )
|
||||
return m_Info[idx];
|
||||
if ( idx >= 0 && idx < Info.Length )
|
||||
return Info[idx];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool HasMerchantQualifications( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Info.Length; ++i )
|
||||
for ( int i = 0; i < Info.Length; ++i )
|
||||
{
|
||||
if ( IsQualified( mob, m_Info[i] ) )
|
||||
if ( IsQualified( mob, Info[i] ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionPersistance : Item
|
||||
{
|
||||
private static FactionPersistance m_Instance;
|
||||
|
||||
public static FactionPersistance Instance => m_Instance;
|
||||
public static FactionPersistance Instance { get; private set; }
|
||||
|
||||
public override string DefaultName => "Faction Persistance - Internal";
|
||||
|
||||
|
|
@ -14,8 +12,8 @@ namespace Server.Factions
|
|||
{
|
||||
Movable = false;
|
||||
|
||||
if ( m_Instance == null || m_Instance.Deleted )
|
||||
m_Instance = this;
|
||||
if ( Instance == null || Instance.Deleted )
|
||||
Instance = this;
|
||||
else
|
||||
base.Delete();
|
||||
}
|
||||
|
|
@ -29,7 +27,7 @@ namespace Server.Factions
|
|||
|
||||
public FactionPersistance( Serial serial ) : base( serial )
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
|
|||
|
|
@ -6,31 +6,26 @@ namespace Server.Factions
|
|||
{
|
||||
public class PlayerState : IComparable
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Faction m_Faction;
|
||||
private List<PlayerState> m_Owner;
|
||||
private int m_KillPoints;
|
||||
private DateTime m_Leaving;
|
||||
private MerchantTitle m_MerchantTitle;
|
||||
private RankDefinition m_Rank;
|
||||
private List<SilverGivenEntry> m_SilverGiven;
|
||||
private bool m_IsActive;
|
||||
|
||||
private Town m_Sheriff;
|
||||
private Town m_Finance;
|
||||
|
||||
private DateTime m_LastHonorTime;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public Faction Faction { get; }
|
||||
|
||||
public List<PlayerState> Owner { get; }
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public Faction Faction => m_Faction;
|
||||
public List<PlayerState> Owner => m_Owner;
|
||||
public MerchantTitle MerchantTitle{ get => m_MerchantTitle;
|
||||
set{ m_MerchantTitle = value; Invalidate(); } }
|
||||
public Town Sheriff{ get => m_Sheriff;
|
||||
set{ m_Sheriff = value; Invalidate(); } }
|
||||
public Town Finance{ get => m_Finance;
|
||||
set{ m_Finance = value; Invalidate(); } }
|
||||
public List<SilverGivenEntry> SilverGiven => m_SilverGiven;
|
||||
public List<SilverGivenEntry> SilverGiven { get; private set; }
|
||||
|
||||
public int KillPoints {
|
||||
get => m_KillPoints;
|
||||
|
|
@ -44,17 +39,17 @@ namespace Server.Factions
|
|||
return;
|
||||
}
|
||||
|
||||
m_Owner.Remove( this );
|
||||
m_Owner.Insert( m_Faction.ZeroRankOffset, this );
|
||||
Owner.Remove( this );
|
||||
Owner.Insert( Faction.ZeroRankOffset, this );
|
||||
|
||||
m_RankIndex = m_Faction.ZeroRankOffset;
|
||||
m_Faction.ZeroRankOffset++;
|
||||
m_RankIndex = Faction.ZeroRankOffset;
|
||||
Faction.ZeroRankOffset++;
|
||||
}
|
||||
while ( ( m_RankIndex - 1 ) >= 0 ) {
|
||||
PlayerState p = m_Owner[m_RankIndex-1] as PlayerState;
|
||||
PlayerState p = Owner[m_RankIndex-1] as PlayerState;
|
||||
if ( value > p.KillPoints ) {
|
||||
m_Owner[m_RankIndex] = p;
|
||||
m_Owner[m_RankIndex-1] = this;
|
||||
Owner[m_RankIndex] = p;
|
||||
Owner[m_RankIndex-1] = this;
|
||||
RankIndex--;
|
||||
p.RankIndex++;
|
||||
}
|
||||
|
|
@ -70,23 +65,23 @@ namespace Server.Factions
|
|||
return;
|
||||
}
|
||||
|
||||
while ( ( m_RankIndex + 1 ) < m_Faction.ZeroRankOffset ) {
|
||||
PlayerState p = m_Owner[m_RankIndex+1] as PlayerState;
|
||||
m_Owner[m_RankIndex+1] = this;
|
||||
m_Owner[m_RankIndex] = p;
|
||||
while ( ( m_RankIndex + 1 ) < Faction.ZeroRankOffset ) {
|
||||
PlayerState p = Owner[m_RankIndex+1] as PlayerState;
|
||||
Owner[m_RankIndex+1] = this;
|
||||
Owner[m_RankIndex] = p;
|
||||
RankIndex++;
|
||||
p.RankIndex--;
|
||||
}
|
||||
|
||||
m_RankIndex = -1;
|
||||
m_Faction.ZeroRankOffset--;
|
||||
Faction.ZeroRankOffset--;
|
||||
}
|
||||
else {
|
||||
while ( ( m_RankIndex + 1 ) < m_Faction.ZeroRankOffset ) {
|
||||
PlayerState p = m_Owner[m_RankIndex+1] as PlayerState;
|
||||
while ( ( m_RankIndex + 1 ) < Faction.ZeroRankOffset ) {
|
||||
PlayerState p = Owner[m_RankIndex+1] as PlayerState;
|
||||
if ( value < p.KillPoints ) {
|
||||
m_Owner[m_RankIndex+1] = this;
|
||||
m_Owner[m_RankIndex] = p;
|
||||
Owner[m_RankIndex+1] = this;
|
||||
Owner[m_RankIndex] = p;
|
||||
RankIndex++;
|
||||
p.RankIndex--;
|
||||
}
|
||||
|
|
@ -111,15 +106,15 @@ namespace Server.Factions
|
|||
public RankDefinition Rank {
|
||||
get {
|
||||
if ( m_InvalidateRank ) {
|
||||
RankDefinition[] ranks = m_Faction.Definition.Ranks;
|
||||
RankDefinition[] ranks = Faction.Definition.Ranks;
|
||||
int percent;
|
||||
|
||||
if ( m_Owner.Count == 1 )
|
||||
if ( Owner.Count == 1 )
|
||||
percent = 1000;
|
||||
else if ( m_RankIndex == -1 )
|
||||
percent = 0;
|
||||
else
|
||||
percent = ( ( m_Faction.ZeroRankOffset - m_RankIndex ) * 1000 ) / m_Faction.ZeroRankOffset;
|
||||
percent = ( ( Faction.ZeroRankOffset - m_RankIndex ) * 1000 ) / Faction.ZeroRankOffset;
|
||||
|
||||
for ( int i = 0; i < ranks.Length; i++ ) {
|
||||
RankDefinition check = ranks[i];
|
||||
|
|
@ -138,29 +133,25 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public DateTime LastHonorTime{ get => m_LastHonorTime;
|
||||
set => m_LastHonorTime = value;
|
||||
}
|
||||
public DateTime Leaving{ get => m_Leaving;
|
||||
set => m_Leaving = value;
|
||||
}
|
||||
public bool IsLeaving => ( m_Leaving > DateTime.MinValue );
|
||||
public DateTime LastHonorTime { get; set; }
|
||||
|
||||
public bool IsActive{ get => m_IsActive;
|
||||
set => m_IsActive = value;
|
||||
}
|
||||
public DateTime Leaving { get; set; }
|
||||
|
||||
public bool IsLeaving => ( Leaving > DateTime.MinValue );
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public bool CanGiveSilverTo( Mobile mob )
|
||||
{
|
||||
if ( m_SilverGiven == null )
|
||||
if ( SilverGiven == null )
|
||||
return true;
|
||||
|
||||
for ( int i = 0; i < m_SilverGiven.Count; ++i )
|
||||
for ( int i = 0; i < SilverGiven.Count; ++i )
|
||||
{
|
||||
SilverGivenEntry sge = m_SilverGiven[i];
|
||||
SilverGivenEntry sge = SilverGiven[i];
|
||||
|
||||
if ( sge.IsExpired )
|
||||
m_SilverGiven.RemoveAt( i-- );
|
||||
SilverGiven.RemoveAt( i-- );
|
||||
else if ( sge.GivenTo == mob )
|
||||
return false;
|
||||
}
|
||||
|
|
@ -170,15 +161,15 @@ namespace Server.Factions
|
|||
|
||||
public void OnGivenSilverTo( Mobile mob )
|
||||
{
|
||||
if ( m_SilverGiven == null )
|
||||
m_SilverGiven = new List<SilverGivenEntry>();
|
||||
if ( SilverGiven == null )
|
||||
SilverGiven = new List<SilverGivenEntry>();
|
||||
|
||||
m_SilverGiven.Add( new SilverGivenEntry( mob ) );
|
||||
SilverGiven.Add( new SilverGivenEntry( mob ) );
|
||||
}
|
||||
|
||||
public void Invalidate()
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile pm )
|
||||
if ( Mobile is PlayerMobile pm )
|
||||
{
|
||||
pm.InvalidateProperties();
|
||||
pm.InvalidateMyRunUO();
|
||||
|
|
@ -187,15 +178,15 @@ namespace Server.Factions
|
|||
|
||||
public void Attach()
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile mobile )
|
||||
if ( Mobile is PlayerMobile mobile )
|
||||
mobile.FactionPlayerState = this;
|
||||
}
|
||||
|
||||
public PlayerState( Mobile mob, Faction faction, List<PlayerState> owner )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Faction = faction;
|
||||
m_Owner = owner;
|
||||
Mobile = mob;
|
||||
Faction = faction;
|
||||
Owner = owner;
|
||||
|
||||
Attach();
|
||||
Invalidate();
|
||||
|
|
@ -203,8 +194,8 @@ namespace Server.Factions
|
|||
|
||||
public PlayerState( GenericReader reader, Faction faction, List<PlayerState> owner )
|
||||
{
|
||||
m_Faction = faction;
|
||||
m_Owner = owner;
|
||||
Faction = faction;
|
||||
Owner = owner;
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -212,18 +203,18 @@ namespace Server.Factions
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_IsActive = reader.ReadBool();
|
||||
m_LastHonorTime = reader.ReadDateTime();
|
||||
IsActive = reader.ReadBool();
|
||||
LastHonorTime = reader.ReadDateTime();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
m_KillPoints = reader.ReadEncodedInt();
|
||||
m_MerchantTitle = (MerchantTitle)reader.ReadEncodedInt();
|
||||
|
||||
m_Leaving = reader.ReadDateTime();
|
||||
Leaving = reader.ReadDateTime();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -236,15 +227,15 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_IsActive );
|
||||
writer.Write( m_LastHonorTime );
|
||||
writer.Write( IsActive );
|
||||
writer.Write( LastHonorTime );
|
||||
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.Write( (Mobile) Mobile );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_KillPoints );
|
||||
writer.WriteEncodedInt( (int) m_MerchantTitle );
|
||||
|
||||
writer.Write( (DateTime) m_Leaving );
|
||||
writer.Write( (DateTime) Leaving );
|
||||
}
|
||||
|
||||
public static PlayerState Find( Mobile mob )
|
||||
|
|
|
|||
|
|
@ -6,18 +6,16 @@ namespace Server.Factions
|
|||
{
|
||||
public static readonly TimeSpan ExpirePeriod = TimeSpan.FromHours( 3.0 );
|
||||
|
||||
private Mobile m_GivenTo;
|
||||
private DateTime m_TimeOfGift;
|
||||
public Mobile GivenTo { get; }
|
||||
|
||||
public Mobile GivenTo => m_GivenTo;
|
||||
public DateTime TimeOfGift => m_TimeOfGift;
|
||||
public DateTime TimeOfGift { get; }
|
||||
|
||||
public bool IsExpired => ( m_TimeOfGift + ExpirePeriod ) < DateTime.UtcNow;
|
||||
public bool IsExpired => ( TimeOfGift + ExpirePeriod ) < DateTime.UtcNow;
|
||||
|
||||
public SilverGivenEntry( Mobile givenTo )
|
||||
{
|
||||
m_GivenTo = givenTo;
|
||||
m_TimeOfGift = DateTime.UtcNow;
|
||||
GivenTo = givenTo;
|
||||
TimeOfGift = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,17 +5,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class StrongholdRegion : BaseRegion
|
||||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set => m_Faction = value;
|
||||
}
|
||||
public Faction Faction { get; set; }
|
||||
|
||||
public StrongholdRegion( Faction faction ) : base( faction.Definition.FriendlyName, Faction.Facet, DefaultPriority, faction.Definition.Stronghold.Area )
|
||||
{
|
||||
m_Faction = faction;
|
||||
Faction = faction;
|
||||
|
||||
Register();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,14 +9,9 @@ namespace Server.Factions
|
|||
[CustomEnum( new[]{ "Britain", "Magincia", "Minoc", "Moonglow", "Skara Brae", "Trinsic", "Vesper", "Yew" } )]
|
||||
public abstract class Town : IComparable
|
||||
{
|
||||
private TownDefinition m_Definition;
|
||||
private TownState m_State;
|
||||
|
||||
public TownDefinition Definition
|
||||
{
|
||||
get => m_Definition;
|
||||
set => m_Definition = value;
|
||||
}
|
||||
public TownDefinition Definition { get; set; }
|
||||
|
||||
public TownState State
|
||||
{
|
||||
|
|
@ -244,29 +239,18 @@ namespace Server.Factions
|
|||
return list;
|
||||
}
|
||||
|
||||
private List<VendorList> m_VendorLists;
|
||||
private List<GuardList> m_GuardLists;
|
||||
public List<VendorList> VendorLists { get; set; }
|
||||
|
||||
public List<VendorList> VendorLists
|
||||
{
|
||||
get => m_VendorLists;
|
||||
set => m_VendorLists = value;
|
||||
}
|
||||
|
||||
public List<GuardList> GuardLists
|
||||
{
|
||||
get => m_GuardLists;
|
||||
set => m_GuardLists = value;
|
||||
}
|
||||
public List<GuardList> GuardLists { get; set; }
|
||||
|
||||
public void ConstructGuardLists()
|
||||
{
|
||||
GuardDefinition[] defs = ( Owner == null ? new GuardDefinition[0] : Owner.Definition.Guards );
|
||||
|
||||
m_GuardLists = new List<GuardList>();
|
||||
GuardLists = new List<GuardList>();
|
||||
|
||||
for ( int i = 0; i < defs.Length; ++i )
|
||||
m_GuardLists.Add( new GuardList( defs[i] ) );
|
||||
GuardLists.Add( new GuardList( defs[i] ) );
|
||||
}
|
||||
|
||||
public GuardList FindGuardList( Type type )
|
||||
|
|
@ -288,10 +272,10 @@ namespace Server.Factions
|
|||
{
|
||||
VendorDefinition[] defs = VendorDefinition.Definitions;
|
||||
|
||||
m_VendorLists = new List<VendorList>();
|
||||
VendorLists = new List<VendorList>();
|
||||
|
||||
for ( int i = 0; i < defs.Length; ++i )
|
||||
m_VendorLists.Add( new VendorList( defs[i] ) );
|
||||
VendorLists.Add( new VendorList( defs[i] ) );
|
||||
}
|
||||
|
||||
public VendorList FindVendorList( Type type )
|
||||
|
|
@ -468,12 +452,12 @@ namespace Server.Factions
|
|||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
return m_Definition.Sort - ((Town)obj).m_Definition.Sort;
|
||||
return Definition.Sort - ((Town)obj).Definition.Sort;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return m_Definition.FriendlyName;
|
||||
return Definition.FriendlyName;
|
||||
}
|
||||
|
||||
public static void WriteReference( GenericWriter writer, Town town )
|
||||
|
|
|
|||
|
|
@ -4,29 +4,12 @@ namespace Server.Factions
|
|||
{
|
||||
public class TownState
|
||||
{
|
||||
private Town m_Town;
|
||||
private Faction m_Owner;
|
||||
|
||||
private Mobile m_Sheriff;
|
||||
private Mobile m_Finance;
|
||||
|
||||
private int m_Silver;
|
||||
private int m_Tax;
|
||||
public Town Town { get; set; }
|
||||
|
||||
private DateTime m_LastTaxChange;
|
||||
private DateTime m_LastIncome;
|
||||
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set => m_Town = value;
|
||||
}
|
||||
|
||||
public Faction Owner
|
||||
{
|
||||
get => m_Owner;
|
||||
set => m_Owner = value;
|
||||
}
|
||||
public Faction Owner { get; set; }
|
||||
|
||||
public Mobile Sheriff
|
||||
{
|
||||
|
|
@ -48,7 +31,7 @@ namespace Server.Factions
|
|||
PlayerState pl = PlayerState.Find( m_Sheriff );
|
||||
|
||||
if ( pl != null )
|
||||
pl.Sheriff = m_Town;
|
||||
pl.Sheriff = Town;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,38 +56,22 @@ namespace Server.Factions
|
|||
PlayerState pl = PlayerState.Find( m_Finance );
|
||||
|
||||
if ( pl != null )
|
||||
pl.Finance = m_Town;
|
||||
pl.Finance = Town;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int Silver
|
||||
{
|
||||
get => m_Silver;
|
||||
set => m_Silver = value;
|
||||
}
|
||||
public int Silver { get; set; }
|
||||
|
||||
public int Tax
|
||||
{
|
||||
get => m_Tax;
|
||||
set => m_Tax = value;
|
||||
}
|
||||
public int Tax { get; set; }
|
||||
|
||||
public DateTime LastTaxChange
|
||||
{
|
||||
get => m_LastTaxChange;
|
||||
set => m_LastTaxChange = value;
|
||||
}
|
||||
public DateTime LastTaxChange { get; set; }
|
||||
|
||||
public DateTime LastIncome
|
||||
{
|
||||
get => m_LastIncome;
|
||||
set => m_LastIncome = value;
|
||||
}
|
||||
public DateTime LastIncome { get; set; }
|
||||
|
||||
public TownState( Town town )
|
||||
{
|
||||
m_Town = town;
|
||||
Town = town;
|
||||
}
|
||||
|
||||
public TownState( GenericReader reader )
|
||||
|
|
@ -115,32 +82,32 @@ namespace Server.Factions
|
|||
{
|
||||
case 3:
|
||||
{
|
||||
m_LastIncome = reader.ReadDateTime();
|
||||
LastIncome = reader.ReadDateTime();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_Tax = reader.ReadEncodedInt();
|
||||
m_LastTaxChange = reader.ReadDateTime();
|
||||
Tax = reader.ReadEncodedInt();
|
||||
LastTaxChange = reader.ReadDateTime();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Silver = reader.ReadEncodedInt();
|
||||
Silver = reader.ReadEncodedInt();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Town = Town.ReadReference( reader );
|
||||
m_Owner = Faction.ReadReference( reader );
|
||||
Town = Town.ReadReference( reader );
|
||||
Owner = Faction.ReadReference( reader );
|
||||
|
||||
m_Sheriff = reader.ReadMobile();
|
||||
m_Finance = reader.ReadMobile();
|
||||
|
||||
m_Town.State = this;
|
||||
Town.State = this;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -151,15 +118,15 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 3 ); // version
|
||||
|
||||
writer.Write( (DateTime) m_LastIncome );
|
||||
writer.Write( (DateTime) LastIncome );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Tax );
|
||||
writer.Write( (DateTime) m_LastTaxChange );
|
||||
writer.WriteEncodedInt( (int) Tax );
|
||||
writer.Write( (DateTime) LastTaxChange );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Silver );
|
||||
writer.WriteEncodedInt( (int) Silver );
|
||||
|
||||
Town.WriteReference( writer, m_Town );
|
||||
Faction.WriteReference( writer, m_Owner );
|
||||
Town.WriteReference( writer, Town );
|
||||
Faction.WriteReference( writer, Owner );
|
||||
|
||||
writer.Write( (Mobile) m_Sheriff );
|
||||
writer.Write( (Mobile) m_Finance );
|
||||
|
|
|
|||
|
|
@ -5,22 +5,20 @@ namespace Server.Factions
|
|||
{
|
||||
public class VendorList
|
||||
{
|
||||
private VendorDefinition m_Definition;
|
||||
private List<BaseFactionVendor> m_Vendors;
|
||||
public VendorDefinition Definition { get; }
|
||||
|
||||
public VendorDefinition Definition => m_Definition;
|
||||
public List<BaseFactionVendor> Vendors => m_Vendors;
|
||||
public List<BaseFactionVendor> Vendors { get; }
|
||||
|
||||
public BaseFactionVendor Construct( Town town, Faction faction )
|
||||
{
|
||||
try{ return Activator.CreateInstance( m_Definition.Type, new object[]{ town, faction } ) as BaseFactionVendor; }
|
||||
try{ return Activator.CreateInstance( Definition.Type, new object[]{ town, faction } ) as BaseFactionVendor; }
|
||||
catch{ return null; }
|
||||
}
|
||||
|
||||
public VendorList( VendorDefinition definition )
|
||||
{
|
||||
m_Definition = definition;
|
||||
m_Vendors = new List<BaseFactionVendor>();
|
||||
Definition = definition;
|
||||
Vendors = new List<BaseFactionVendor>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,97 +2,83 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionDefinition
|
||||
{
|
||||
private int m_Sort;
|
||||
public int Sort { get; }
|
||||
|
||||
private int m_HuePrimary;
|
||||
private int m_HueSecondary;
|
||||
private int m_HueJoin;
|
||||
private int m_HueBroadcast;
|
||||
public int HuePrimary { get; }
|
||||
|
||||
private int m_WarHorseBody;
|
||||
private int m_WarHorseItem;
|
||||
public int HueSecondary { get; }
|
||||
|
||||
private string m_FriendlyName;
|
||||
private string m_Keyword;
|
||||
private string m_Abbreviation;
|
||||
public int HueJoin { get; }
|
||||
|
||||
private TextDefinition m_Name;
|
||||
private TextDefinition m_PropName;
|
||||
private TextDefinition m_Header;
|
||||
private TextDefinition m_About;
|
||||
private TextDefinition m_CityControl;
|
||||
private TextDefinition m_SigilControl;
|
||||
private TextDefinition m_SignupName;
|
||||
private TextDefinition m_FactionStoneName;
|
||||
private TextDefinition m_OwnerLabel;
|
||||
public int HueBroadcast { get; }
|
||||
|
||||
private TextDefinition m_GuardIgnore, m_GuardWarn, m_GuardAttack;
|
||||
public int WarHorseBody { get; }
|
||||
|
||||
private StrongholdDefinition m_Stronghold;
|
||||
public int WarHorseItem { get; }
|
||||
|
||||
private RankDefinition[] m_Ranks;
|
||||
private GuardDefinition[] m_Guards;
|
||||
public string FriendlyName { get; }
|
||||
|
||||
public int Sort => m_Sort;
|
||||
public string Keyword { get; }
|
||||
|
||||
public int HuePrimary => m_HuePrimary;
|
||||
public int HueSecondary => m_HueSecondary;
|
||||
public int HueJoin => m_HueJoin;
|
||||
public int HueBroadcast => m_HueBroadcast;
|
||||
public string Abbreviation { get; }
|
||||
|
||||
public int WarHorseBody => m_WarHorseBody;
|
||||
public int WarHorseItem => m_WarHorseItem;
|
||||
public TextDefinition Name { get; }
|
||||
|
||||
public string FriendlyName => m_FriendlyName;
|
||||
public string Keyword => m_Keyword;
|
||||
public string Abbreviation => m_Abbreviation;
|
||||
public TextDefinition PropName { get; }
|
||||
|
||||
public TextDefinition Name => m_Name;
|
||||
public TextDefinition PropName => m_PropName;
|
||||
public TextDefinition Header => m_Header;
|
||||
public TextDefinition About => m_About;
|
||||
public TextDefinition CityControl => m_CityControl;
|
||||
public TextDefinition SigilControl => m_SigilControl;
|
||||
public TextDefinition SignupName => m_SignupName;
|
||||
public TextDefinition FactionStoneName => m_FactionStoneName;
|
||||
public TextDefinition OwnerLabel => m_OwnerLabel;
|
||||
public TextDefinition Header { get; }
|
||||
|
||||
public TextDefinition GuardIgnore => m_GuardIgnore;
|
||||
public TextDefinition GuardWarn => m_GuardWarn;
|
||||
public TextDefinition GuardAttack => m_GuardAttack;
|
||||
public TextDefinition About { get; }
|
||||
|
||||
public StrongholdDefinition Stronghold => m_Stronghold;
|
||||
public TextDefinition CityControl { get; }
|
||||
|
||||
public RankDefinition[] Ranks => m_Ranks;
|
||||
public GuardDefinition[] Guards => m_Guards;
|
||||
public TextDefinition SigilControl { get; }
|
||||
|
||||
public TextDefinition SignupName { get; }
|
||||
|
||||
public TextDefinition FactionStoneName { get; }
|
||||
|
||||
public TextDefinition OwnerLabel { get; }
|
||||
|
||||
public TextDefinition GuardIgnore { get; }
|
||||
|
||||
public TextDefinition GuardWarn { get; }
|
||||
|
||||
public TextDefinition GuardAttack { get; }
|
||||
|
||||
public StrongholdDefinition Stronghold { get; }
|
||||
|
||||
public RankDefinition[] Ranks { get; }
|
||||
|
||||
public GuardDefinition[] Guards { get; }
|
||||
|
||||
public FactionDefinition( int sort, int huePrimary, int hueSecondary, int hueJoin, int hueBroadcast, int warHorseBody, int warHorseItem, string friendlyName, string keyword, string abbreviation, TextDefinition name, TextDefinition propName, TextDefinition header, TextDefinition about, TextDefinition cityControl, TextDefinition sigilControl, TextDefinition signupName, TextDefinition factionStoneName, TextDefinition ownerLabel, TextDefinition guardIgnore, TextDefinition guardWarn, TextDefinition guardAttack, StrongholdDefinition stronghold, RankDefinition[] ranks, GuardDefinition[] guards )
|
||||
{
|
||||
m_Sort = sort;
|
||||
m_HuePrimary = huePrimary;
|
||||
m_HueSecondary = hueSecondary;
|
||||
m_HueJoin = hueJoin;
|
||||
m_HueBroadcast = hueBroadcast;
|
||||
m_WarHorseBody = warHorseBody;
|
||||
m_WarHorseItem = warHorseItem;
|
||||
m_FriendlyName = friendlyName;
|
||||
m_Keyword = keyword;
|
||||
m_Abbreviation = abbreviation;
|
||||
m_Name = name;
|
||||
m_PropName = propName;
|
||||
m_Header = header;
|
||||
m_About = about;
|
||||
m_CityControl = cityControl;
|
||||
m_SigilControl = sigilControl;
|
||||
m_SignupName = signupName;
|
||||
m_FactionStoneName = factionStoneName;
|
||||
m_OwnerLabel = ownerLabel;
|
||||
m_GuardIgnore = guardIgnore;
|
||||
m_GuardWarn = guardWarn;
|
||||
m_GuardAttack = guardAttack;
|
||||
m_Stronghold = stronghold;
|
||||
m_Ranks = ranks;
|
||||
m_Guards = guards;
|
||||
Sort = sort;
|
||||
HuePrimary = huePrimary;
|
||||
HueSecondary = hueSecondary;
|
||||
HueJoin = hueJoin;
|
||||
HueBroadcast = hueBroadcast;
|
||||
WarHorseBody = warHorseBody;
|
||||
WarHorseItem = warHorseItem;
|
||||
FriendlyName = friendlyName;
|
||||
Keyword = keyword;
|
||||
Abbreviation = abbreviation;
|
||||
Name = name;
|
||||
PropName = propName;
|
||||
Header = header;
|
||||
About = about;
|
||||
CityControl = cityControl;
|
||||
SigilControl = sigilControl;
|
||||
SignupName = signupName;
|
||||
FactionStoneName = factionStoneName;
|
||||
OwnerLabel = ownerLabel;
|
||||
GuardIgnore = guardIgnore;
|
||||
GuardWarn = guardWarn;
|
||||
GuardAttack = guardAttack;
|
||||
Stronghold = stronghold;
|
||||
Ranks = ranks;
|
||||
Guards = guards;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,16 +6,14 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionItemDefinition
|
||||
{
|
||||
private int m_SilverCost;
|
||||
private Type m_VendorType;
|
||||
public int SilverCost { get; }
|
||||
|
||||
public int SilverCost => m_SilverCost;
|
||||
public Type VendorType => m_VendorType;
|
||||
public Type VendorType { get; }
|
||||
|
||||
public FactionItemDefinition( int silverCost, Type vendorType )
|
||||
{
|
||||
m_SilverCost = silverCost;
|
||||
m_VendorType = vendorType;
|
||||
SilverCost = silverCost;
|
||||
VendorType = vendorType;
|
||||
}
|
||||
|
||||
private static FactionItemDefinition m_MetalArmor = new FactionItemDefinition( 1000, typeof( Blacksmith ) );
|
||||
|
|
|
|||
|
|
@ -4,38 +4,31 @@ namespace Server.Factions
|
|||
{
|
||||
public class GuardDefinition
|
||||
{
|
||||
private Type m_Type;
|
||||
public Type Type { get; }
|
||||
|
||||
private int m_Price;
|
||||
private int m_Upkeep;
|
||||
private int m_Maximum;
|
||||
public int Price { get; }
|
||||
|
||||
private int m_ItemID;
|
||||
public int Upkeep { get; }
|
||||
|
||||
private TextDefinition m_Header;
|
||||
private TextDefinition m_Label;
|
||||
public int Maximum { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public int ItemID { get; }
|
||||
|
||||
public int Price => m_Price;
|
||||
public int Upkeep => m_Upkeep;
|
||||
public int Maximum => m_Maximum;
|
||||
public int ItemID => m_ItemID;
|
||||
public TextDefinition Header { get; }
|
||||
|
||||
public TextDefinition Header => m_Header;
|
||||
public TextDefinition Label => m_Label;
|
||||
public TextDefinition Label { get; }
|
||||
|
||||
public GuardDefinition( Type type, int itemID, int price, int upkeep, int maximum, TextDefinition header, TextDefinition label )
|
||||
{
|
||||
m_Type = type;
|
||||
Type = type;
|
||||
|
||||
m_Price = price;
|
||||
m_Upkeep = upkeep;
|
||||
m_Maximum = maximum;
|
||||
m_ItemID = itemID;
|
||||
Price = price;
|
||||
Upkeep = upkeep;
|
||||
Maximum = maximum;
|
||||
ItemID = itemID;
|
||||
|
||||
m_Header = header;
|
||||
m_Label = label;
|
||||
Header = header;
|
||||
Label = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,22 +2,20 @@ namespace Server.Factions
|
|||
{
|
||||
public class RankDefinition
|
||||
{
|
||||
private int m_Rank;
|
||||
private int m_Required;
|
||||
private int m_MaxWearables;
|
||||
private TextDefinition m_Title;
|
||||
public int Rank { get; }
|
||||
|
||||
public int Rank => m_Rank;
|
||||
public int Required => m_Required;
|
||||
public int MaxWearables => m_MaxWearables;
|
||||
public TextDefinition Title => m_Title;
|
||||
public int Required { get; }
|
||||
|
||||
public int MaxWearables { get; }
|
||||
|
||||
public TextDefinition Title { get; }
|
||||
|
||||
public RankDefinition( int rank, int required, int maxWearables, TextDefinition title )
|
||||
{
|
||||
m_Rank = rank;
|
||||
m_Required = required;
|
||||
m_Title = title;
|
||||
m_MaxWearables = maxWearables;
|
||||
Rank = rank;
|
||||
Required = required;
|
||||
Title = title;
|
||||
MaxWearables = maxWearables;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,24 +2,20 @@ namespace Server.Factions
|
|||
{
|
||||
public class StrongholdDefinition
|
||||
{
|
||||
private Rectangle2D[] m_Area;
|
||||
private Point3D m_JoinStone;
|
||||
private Point3D m_FactionStone;
|
||||
private Point3D[] m_Monoliths;
|
||||
public Rectangle2D[] Area { get; }
|
||||
|
||||
public Rectangle2D[] Area => m_Area;
|
||||
public Point3D JoinStone { get; }
|
||||
|
||||
public Point3D JoinStone => m_JoinStone;
|
||||
public Point3D FactionStone => m_FactionStone;
|
||||
public Point3D FactionStone { get; }
|
||||
|
||||
public Point3D[] Monoliths => m_Monoliths;
|
||||
public Point3D[] Monoliths { get; }
|
||||
|
||||
public StrongholdDefinition( Rectangle2D[] area, Point3D joinStone, Point3D factionStone, Point3D[] monoliths )
|
||||
{
|
||||
m_Area = area;
|
||||
m_JoinStone = joinStone;
|
||||
m_FactionStone = factionStone;
|
||||
m_Monoliths = monoliths;
|
||||
Area = area;
|
||||
JoinStone = joinStone;
|
||||
FactionStone = factionStone;
|
||||
Monoliths = monoliths;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,56 +2,47 @@ namespace Server.Factions
|
|||
{
|
||||
public class TownDefinition
|
||||
{
|
||||
private int m_Sort;
|
||||
private int m_SigilID;
|
||||
public int Sort { get; }
|
||||
|
||||
private string m_Region;
|
||||
public int SigilID { get; }
|
||||
|
||||
private string m_FriendlyName;
|
||||
public string Region { get; }
|
||||
|
||||
private TextDefinition m_TownName;
|
||||
private TextDefinition m_TownStoneHeader;
|
||||
private TextDefinition m_StrongholdMonolithName;
|
||||
private TextDefinition m_TownMonolithName;
|
||||
private TextDefinition m_TownStoneName;
|
||||
private TextDefinition m_SigilName;
|
||||
private TextDefinition m_CorruptedSigilName;
|
||||
public string FriendlyName { get; }
|
||||
|
||||
private Point3D m_Monolith;
|
||||
private Point3D m_TownStone;
|
||||
public TextDefinition TownName { get; }
|
||||
|
||||
public int Sort => m_Sort;
|
||||
public int SigilID => m_SigilID;
|
||||
public TextDefinition TownStoneHeader { get; }
|
||||
|
||||
public string Region => m_Region;
|
||||
public string FriendlyName => m_FriendlyName;
|
||||
public TextDefinition StrongholdMonolithName { get; }
|
||||
|
||||
public TextDefinition TownName => m_TownName;
|
||||
public TextDefinition TownStoneHeader => m_TownStoneHeader;
|
||||
public TextDefinition StrongholdMonolithName => m_StrongholdMonolithName;
|
||||
public TextDefinition TownMonolithName => m_TownMonolithName;
|
||||
public TextDefinition TownStoneName => m_TownStoneName;
|
||||
public TextDefinition SigilName => m_SigilName;
|
||||
public TextDefinition CorruptedSigilName => m_CorruptedSigilName;
|
||||
public TextDefinition TownMonolithName { get; }
|
||||
|
||||
public Point3D Monolith => m_Monolith;
|
||||
public Point3D TownStone => m_TownStone;
|
||||
public TextDefinition TownStoneName { get; }
|
||||
|
||||
public TextDefinition SigilName { get; }
|
||||
|
||||
public TextDefinition CorruptedSigilName { get; }
|
||||
|
||||
public Point3D Monolith { get; }
|
||||
|
||||
public Point3D TownStone { get; }
|
||||
|
||||
public TownDefinition( int sort, int sigilID, string region, string friendlyName, TextDefinition townName, TextDefinition townStoneHeader, TextDefinition strongholdMonolithName, TextDefinition townMonolithName, TextDefinition townStoneName, TextDefinition sigilName, TextDefinition corruptedSigilName, Point3D monolith, Point3D townStone )
|
||||
{
|
||||
m_Sort = sort;
|
||||
m_SigilID = sigilID;
|
||||
m_Region = region;
|
||||
m_FriendlyName = friendlyName;
|
||||
m_TownName = townName;
|
||||
m_TownStoneHeader = townStoneHeader;
|
||||
m_StrongholdMonolithName = strongholdMonolithName;
|
||||
m_TownMonolithName = townMonolithName;
|
||||
m_TownStoneName = townStoneName;
|
||||
m_SigilName = sigilName;
|
||||
m_CorruptedSigilName = corruptedSigilName;
|
||||
m_Monolith = monolith;
|
||||
m_TownStone = townStone;
|
||||
Sort = sort;
|
||||
SigilID = sigilID;
|
||||
Region = region;
|
||||
FriendlyName = friendlyName;
|
||||
TownName = townName;
|
||||
TownStoneHeader = townStoneHeader;
|
||||
StrongholdMonolithName = strongholdMonolithName;
|
||||
TownMonolithName = townMonolithName;
|
||||
TownStoneName = townStoneName;
|
||||
SigilName = sigilName;
|
||||
CorruptedSigilName = corruptedSigilName;
|
||||
Monolith = monolith;
|
||||
TownStone = townStone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,78 +4,70 @@ namespace Server.Factions
|
|||
{
|
||||
public class VendorDefinition
|
||||
{
|
||||
private Type m_Type;
|
||||
public Type Type { get; }
|
||||
|
||||
private int m_Price;
|
||||
private int m_Upkeep;
|
||||
private int m_Maximum;
|
||||
public int Price { get; }
|
||||
|
||||
private int m_ItemID;
|
||||
public int Upkeep { get; }
|
||||
|
||||
private TextDefinition m_Header;
|
||||
private TextDefinition m_Label;
|
||||
public int Maximum { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public int ItemID { get; }
|
||||
|
||||
public int Price => m_Price;
|
||||
public int Upkeep => m_Upkeep;
|
||||
public int Maximum => m_Maximum;
|
||||
public int ItemID => m_ItemID;
|
||||
public TextDefinition Header { get; }
|
||||
|
||||
public TextDefinition Header => m_Header;
|
||||
public TextDefinition Label => m_Label;
|
||||
public TextDefinition Label { get; }
|
||||
|
||||
public VendorDefinition( Type type, int itemID, int price, int upkeep, int maximum, TextDefinition header, TextDefinition label )
|
||||
{
|
||||
m_Type = type;
|
||||
Type = type;
|
||||
|
||||
m_Price = price;
|
||||
m_Upkeep = upkeep;
|
||||
m_Maximum = maximum;
|
||||
m_ItemID = itemID;
|
||||
Price = price;
|
||||
Upkeep = upkeep;
|
||||
Maximum = maximum;
|
||||
ItemID = itemID;
|
||||
|
||||
m_Header = header;
|
||||
m_Label = label;
|
||||
Header = header;
|
||||
Label = label;
|
||||
}
|
||||
|
||||
private static VendorDefinition[] m_Definitions = {
|
||||
new VendorDefinition( typeof( FactionBottleVendor ), 0xF0E,
|
||||
5000,
|
||||
1000,
|
||||
10,
|
||||
new TextDefinition( 1011549, "POTION BOTTLE VENDOR" ),
|
||||
new TextDefinition( 1011544, "Buy Potion Bottle Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionBoardVendor ), 0x1BD7,
|
||||
3000,
|
||||
500,
|
||||
10,
|
||||
new TextDefinition( 1011552, "WOOD VENDOR" ),
|
||||
new TextDefinition( 1011545, "Buy Wooden Board Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionOreVendor ), 0x19B8,
|
||||
3000,
|
||||
500,
|
||||
10,
|
||||
new TextDefinition( 1011553, "IRON ORE VENDOR" ),
|
||||
new TextDefinition( 1011546, "Buy Iron Ore Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionReagentVendor ), 0xF86,
|
||||
5000,
|
||||
1000,
|
||||
10,
|
||||
new TextDefinition( 1011554, "REAGENT VENDOR" ),
|
||||
new TextDefinition( 1011547, "Buy Reagent Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionHorseVendor ), 0x20DD,
|
||||
5000,
|
||||
1000,
|
||||
1,
|
||||
new TextDefinition( 1011556, "HORSE BREEDER" ),
|
||||
new TextDefinition( 1011555, "Buy Horse Breeder" )
|
||||
)
|
||||
};
|
||||
|
||||
public static VendorDefinition[] Definitions => m_Definitions;
|
||||
public static VendorDefinition[] Definitions { get; } =
|
||||
{
|
||||
new VendorDefinition( typeof( FactionBottleVendor ), 0xF0E,
|
||||
5000,
|
||||
1000,
|
||||
10,
|
||||
new TextDefinition( 1011549, "POTION BOTTLE VENDOR" ),
|
||||
new TextDefinition( 1011544, "Buy Potion Bottle Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionBoardVendor ), 0x1BD7,
|
||||
3000,
|
||||
500,
|
||||
10,
|
||||
new TextDefinition( 1011552, "WOOD VENDOR" ),
|
||||
new TextDefinition( 1011545, "Buy Wooden Board Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionOreVendor ), 0x19B8,
|
||||
3000,
|
||||
500,
|
||||
10,
|
||||
new TextDefinition( 1011553, "IRON ORE VENDOR" ),
|
||||
new TextDefinition( 1011546, "Buy Iron Ore Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionReagentVendor ), 0xF86,
|
||||
5000,
|
||||
1000,
|
||||
10,
|
||||
new TextDefinition( 1011554, "REAGENT VENDOR" ),
|
||||
new TextDefinition( 1011547, "Buy Reagent Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionHorseVendor ), 0x20DD,
|
||||
5000,
|
||||
1000,
|
||||
1,
|
||||
new TextDefinition( 1011556, "HORSE BREEDER" ),
|
||||
new TextDefinition( 1011555, "Buy Horse Breeder" )
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -2,13 +2,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class CouncilOfMages : Faction
|
||||
{
|
||||
private static Faction m_Instance;
|
||||
|
||||
public static Faction Instance => m_Instance;
|
||||
public static Faction Instance { get; private set; }
|
||||
|
||||
public CouncilOfMages()
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
|
||||
Definition =
|
||||
new FactionDefinition(
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class Minax : Faction
|
||||
{
|
||||
private static Faction m_Instance;
|
||||
|
||||
public static Faction Instance => m_Instance;
|
||||
public static Faction Instance { get; private set; }
|
||||
|
||||
public Minax()
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
|
||||
Definition =
|
||||
new FactionDefinition(
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class Shadowlords : Faction
|
||||
{
|
||||
private static Faction m_Instance;
|
||||
|
||||
public static Faction Instance => m_Instance;
|
||||
public static Faction Instance { get; private set; }
|
||||
|
||||
public Shadowlords()
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
|
||||
Definition =
|
||||
new FactionDefinition(
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue