Changes properties to use automatic property initializers

This commit is contained in:
Kamron Batman 2018-09-14 15:23:29 -07:00
parent f0a48ad431
commit 06fa31a7bf
623 changed files with 13072 additions and 19304 deletions

View file

@ -1146,24 +1146,23 @@ namespace Server
[PropertyObject]
public abstract class BaseAttributes
{
private Item m_Owner;
private uint m_Names;
private int[] m_Values;
private static int[] m_Empty = new int[0];
public bool IsEmpty => (m_Names == 0);
public Item Owner => m_Owner;
public Item Owner { get; }
public BaseAttributes( Item owner )
{
m_Owner = owner;
Owner = owner;
m_Values = m_Empty;
}
public BaseAttributes( Item owner, BaseAttributes other )
{
m_Owner = owner;
Owner = owner;
m_Values = new int[other.m_Values.Length];
other.m_Values.CopyTo( m_Values, 0 );
m_Names = other.m_Names;
@ -1171,7 +1170,7 @@ namespace Server
public BaseAttributes( Item owner, GenericReader reader )
{
m_Owner = owner;
Owner = owner;
int version = reader.ReadByte();
@ -1233,14 +1232,14 @@ namespace Server
{
if ( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) )
{
if ( m_Owner is BaseWeapon weapon )
if ( Owner is BaseWeapon weapon )
weapon.UnscaleDurability();
}
else if ( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) )
{
if ( m_Owner is BaseArmor armor )
if ( Owner is BaseArmor armor )
armor.UnscaleDurability();
else if ( m_Owner is BaseClothing clothing )
else if ( Owner is BaseClothing clothing )
clothing.UnscaleDurability();
}
@ -1304,18 +1303,18 @@ namespace Server
if ( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) )
{
if ( m_Owner is BaseWeapon weapon )
if ( Owner is BaseWeapon weapon )
weapon.ScaleDurability();
}
else if ( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) )
{
if ( m_Owner is BaseArmor armor )
if ( Owner is BaseArmor armor )
armor.ScaleDurability();
else if ( m_Owner is BaseClothing clothing )
else if ( Owner is BaseClothing clothing )
clothing.ScaleDurability();
}
if ( m_Owner.Parent is Mobile m )
if ( Owner.Parent is Mobile m )
{
m.CheckStatTimers();
m.UpdateResistances();
@ -1328,7 +1327,7 @@ namespace Server
}
}
m_Owner.InvalidateProperties();
Owner.InvalidateProperties();
}
private int GetIndex( uint mask )

View file

@ -60,8 +60,6 @@ namespace Server.Misc
All = ulong.MaxValue
}
private static Features m_DisallowedFeatures = Features.None;
public static void DisallowFeature(Features feature)
{
SetDisallowed(feature, true);
@ -75,12 +73,12 @@ namespace Server.Misc
public static void SetDisallowed(Features feature, bool value)
{
if (value)
m_DisallowedFeatures |= feature;
DisallowedFeatures |= feature;
else
m_DisallowedFeatures &= ~feature;
DisallowedFeatures &= ~feature;
}
public static Features DisallowedFeatures => m_DisallowedFeatures;
public static Features DisallowedFeatures { get; private set; } = Features.None;
}
private static class Negotiator

View file

@ -12,10 +12,9 @@ namespace Server.Misc
private static TimeSpan WarningDelay = TimeSpan.FromMinutes( 1.0 ); // at what interval should the shutdown message be displayed?
private static bool m_Restarting;
private static DateTime m_RestartTime;
public static bool Restarting => m_Restarting;
public static bool Restarting { get; private set; }
public static void Initialize()
{
@ -25,7 +24,7 @@ namespace Server.Misc
public static void Restart_OnCommand( CommandEventArgs e )
{
if ( m_Restarting )
if ( Restarting )
{
e.Mobile.SendMessage( "The server is already restarting." );
}
@ -59,7 +58,7 @@ namespace Server.Misc
protected override void OnTick()
{
if ( m_Restarting || !Enabled )
if ( Restarting || !Enabled )
return;
if ( DateTime.UtcNow < m_RestartTime )
@ -73,7 +72,7 @@ namespace Server.Misc
AutoSave.Save();
m_Restarting = true;
Restarting = true;
DelayCall( RestartDelay, Restart_Callback );
}

View file

@ -16,13 +16,7 @@ namespace Server.Misc
CommandSystem.Register( "SetSaves", AccessLevel.Administrator, SetSaves_OnCommand );
}
private static bool m_SavesEnabled = true;
public static bool SavesEnabled
{
get => m_SavesEnabled;
set => m_SavesEnabled = value;
}
public static bool SavesEnabled { get; set; } = true;
[Usage( "SetSaves <true | false>" )]
[Description( "Enables or disables automatic shard saving." )]
@ -30,8 +24,8 @@ namespace Server.Misc
{
if ( e.Length == 1 )
{
m_SavesEnabled = e.GetBoolean( 0 );
e.Mobile.SendMessage( "Saves have been {0}.", m_SavesEnabled ? "enabled" : "disabled" );
SavesEnabled = e.GetBoolean( 0 );
e.Mobile.SendMessage( "Saves have been {0}.", SavesEnabled ? "enabled" : "disabled" );
}
else
{
@ -46,7 +40,7 @@ namespace Server.Misc
protected override void OnTick()
{
if ( !m_SavesEnabled || AutoRestart.Restarting )
if ( !SavesEnabled || AutoRestart.Restarting )
return;
if ( m_Warning == TimeSpan.Zero )

View file

@ -21,29 +21,22 @@ namespace Server
}
#region Properties
private BuffIcon m_ID;
public BuffIcon ID => m_ID;
private int m_TitleCliloc;
public int TitleCliloc => m_TitleCliloc;
public BuffIcon ID { get; }
private int m_SecondaryCliloc;
public int SecondaryCliloc => m_SecondaryCliloc;
public int TitleCliloc { get; }
private TimeSpan m_TimeLength;
public TimeSpan TimeLength => m_TimeLength;
public int SecondaryCliloc { get; }
private DateTime m_TimeStart;
public DateTime TimeStart => m_TimeStart;
public TimeSpan TimeLength { get; }
private Timer m_Timer;
public Timer Timer => m_Timer;
public DateTime TimeStart { get; }
private bool m_RetainThroughDeath;
public bool RetainThroughDeath => m_RetainThroughDeath;
public Timer Timer { get; }
private TextDefinition m_Args;
public TextDefinition Args => m_Args;
public bool RetainThroughDeath { get; }
public TextDefinition Args { get; }
#endregion
@ -55,9 +48,9 @@ namespace Server
public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc )
{
m_ID = iconID;
m_TitleCliloc = titleCliloc;
m_SecondaryCliloc = secondaryCliloc;
ID = iconID;
TitleCliloc = titleCliloc;
SecondaryCliloc = secondaryCliloc;
}
public BuffInfo( BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m )
@ -69,10 +62,10 @@ namespace Server
public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m )
: this( iconID, titleCliloc, secondaryCliloc )
{
m_TimeLength = length;
m_TimeStart = DateTime.UtcNow;
TimeLength = length;
TimeStart = DateTime.UtcNow;
m_Timer = Timer.DelayCall( length, delegate
Timer = Timer.DelayCall( length, delegate
{
if ( !(m is PlayerMobile pm) )
return;
@ -90,7 +83,7 @@ namespace Server
public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args )
: this( iconID, titleCliloc, secondaryCliloc )
{
m_Args = args;
Args = args;
}
public BuffInfo( BuffIcon iconID, int titleCliloc, bool retainThroughDeath )
@ -101,7 +94,7 @@ namespace Server
public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, bool retainThroughDeath )
: this( iconID, titleCliloc, secondaryCliloc )
{
m_RetainThroughDeath = retainThroughDeath;
RetainThroughDeath = retainThroughDeath;
}
public BuffInfo( BuffIcon iconID, int titleCliloc, TextDefinition args, bool retainThroughDeath )
@ -112,7 +105,7 @@ namespace Server
public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args, bool retainThroughDeath )
: this( iconID, titleCliloc, secondaryCliloc, args )
{
m_RetainThroughDeath = retainThroughDeath;
RetainThroughDeath = retainThroughDeath;
}
public BuffInfo( BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m, TextDefinition args )
@ -123,7 +116,7 @@ namespace Server
public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m, TextDefinition args )
: this( iconID, titleCliloc, secondaryCliloc, length, m )
{
m_Args = args;
Args = args;
}
public BuffInfo( BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m, TextDefinition args, bool retainThroughDeath )
@ -134,8 +127,8 @@ namespace Server
public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m, TextDefinition args, bool retainThroughDeath )
: this( iconID, titleCliloc, secondaryCliloc, length, m )
{
m_Args = args;
m_RetainThroughDeath = retainThroughDeath;
Args = args;
RetainThroughDeath = retainThroughDeath;
}
#endregion

View file

@ -21,43 +21,18 @@ namespace Server.Misc
private static bool m_DetectClientRequirement = true;
private static OldClientResponse m_OldClientResponse = OldClientResponse.LenientKick;
private static ClientVersion m_Required;
private static bool m_AllowRegular = true, m_AllowUOTD = true, m_AllowGod = true;
private static TimeSpan m_AgeLeniency = TimeSpan.FromDays( 10 );
private static TimeSpan m_GameTimeLeniency = TimeSpan.FromHours( 25 );
private static TimeSpan m_KickDelay = TimeSpan.FromSeconds( 20.0 );
public static ClientVersion Required { get; set; }
public static ClientVersion Required
{
get => m_Required;
set => m_Required = value;
}
public static bool AllowRegular { get; set; } = true;
public static bool AllowRegular
{
get => m_AllowRegular;
set => m_AllowRegular = value;
}
public static bool AllowUOTD { get; set; } = true;
public static bool AllowUOTD
{
get => m_AllowUOTD;
set => m_AllowUOTD = value;
}
public static bool AllowGod { get; set; } = true;
public static bool AllowGod
{
get => m_AllowGod;
set => m_AllowGod = value;
}
public static TimeSpan KickDelay
{
get => m_KickDelay;
set => m_KickDelay = value;
}
public static TimeSpan KickDelay { get; set; } = TimeSpan.FromSeconds( 20.0 );
public static void Initialize()
{

View file

@ -56,16 +56,11 @@ namespace Server
public class MethodEmitter
{
private TypeBuilder m_TypeBuilder;
private MethodBuilder m_Builder;
private ILGenerator m_Generator;
private Type[] m_ArgumentTypes;
public TypeBuilder Type => m_TypeBuilder;
public TypeBuilder Type { get; }
public ILGenerator Generator => m_Generator;
public ILGenerator Generator { get; private set; }
private class CallInfo
{
@ -89,11 +84,11 @@ namespace Server
private Dictionary<Type, Queue<LocalBuilder>> m_Temps;
public MethodBuilder Method => m_Builder;
public MethodBuilder Method { get; private set; }
public MethodEmitter( TypeBuilder typeBuilder )
{
m_TypeBuilder = typeBuilder;
Type = typeBuilder;
m_Temps = new Dictionary<Type, Queue<LocalBuilder>>();
@ -103,15 +98,15 @@ namespace Server
public void Define( string name, MethodAttributes attr, Type returnType, Type[] parms )
{
m_Builder = m_TypeBuilder.DefineMethod( name, attr, returnType, parms );
m_Generator = m_Builder.GetILGenerator();
Method = Type.DefineMethod( name, attr, returnType, parms );
Generator = Method.GetILGenerator();
m_ArgumentTypes = parms;
}
public LocalBuilder CreateLocal( Type localType )
{
return m_Generator.DeclareLocal( localType );
return Generator.DeclareLocal( localType );
}
public LocalBuilder AcquireTemp( Type localType )
@ -135,31 +130,31 @@ namespace Server
public void Branch( Label label )
{
m_Generator.Emit( OpCodes.Br, label );
Generator.Emit( OpCodes.Br, label );
}
public void BranchIfFalse( Label label )
{
Pop( typeof( object ) );
m_Generator.Emit( OpCodes.Brfalse, label );
Generator.Emit( OpCodes.Brfalse, label );
}
public void BranchIfTrue( Label label )
{
Pop( typeof( object ) );
m_Generator.Emit( OpCodes.Brtrue, label );
Generator.Emit( OpCodes.Brtrue, label );
}
public Label CreateLabel()
{
return m_Generator.DefineLabel();
return Generator.DefineLabel();
}
public void MarkLabel( Label label )
{
m_Generator.MarkLabel( label );
Generator.MarkLabel( label );
}
public void Pop()
@ -191,10 +186,10 @@ namespace Server
public void Return()
{
if ( m_Stack.Count != ( m_Builder.ReturnType == typeof( void ) ? 0 : 1 ) )
if ( m_Stack.Count != ( Method.ReturnType == typeof( void ) ? 0 : 1 ) )
throw new InvalidOperationException( "Stack return mismatch." );
m_Generator.Emit( OpCodes.Ret );
Generator.Emit( OpCodes.Ret );
}
public void LoadNull()
@ -206,7 +201,7 @@ namespace Server
{
Push( type );
m_Generator.Emit( OpCodes.Ldnull );
Generator.Emit( OpCodes.Ldnull );
}
public void Load( string value )
@ -214,9 +209,9 @@ namespace Server
Push( typeof( string ) );
if ( value != null )
m_Generator.Emit( OpCodes.Ldstr, value );
Generator.Emit( OpCodes.Ldstr, value );
else
m_Generator.Emit( OpCodes.Ldnull );
Generator.Emit( OpCodes.Ldnull );
}
public void Load( Enum value )
@ -232,21 +227,21 @@ namespace Server
{
Push( typeof( long ) );
m_Generator.Emit( OpCodes.Ldc_I8, value );
Generator.Emit( OpCodes.Ldc_I8, value );
}
public void Load( float value )
{
Push( typeof( float ) );
m_Generator.Emit( OpCodes.Ldc_R4, value );
Generator.Emit( OpCodes.Ldc_R4, value );
}
public void Load( double value )
{
Push( typeof( double ) );
m_Generator.Emit( OpCodes.Ldc_R8, value );
Generator.Emit( OpCodes.Ldc_R8, value );
}
public void Load( char value )
@ -262,9 +257,9 @@ namespace Server
Push( typeof( bool ) );
if ( value )
m_Generator.Emit( OpCodes.Ldc_I4_1 );
Generator.Emit( OpCodes.Ldc_I4_1 );
else
m_Generator.Emit( OpCodes.Ldc_I4_0 );
Generator.Emit( OpCodes.Ldc_I4_0 );
}
public void Load( int value )
@ -274,50 +269,50 @@ namespace Server
switch ( value )
{
case -1:
m_Generator.Emit( OpCodes.Ldc_I4_M1 );
Generator.Emit( OpCodes.Ldc_I4_M1 );
break;
case 0:
m_Generator.Emit( OpCodes.Ldc_I4_0 );
Generator.Emit( OpCodes.Ldc_I4_0 );
break;
case 1:
m_Generator.Emit( OpCodes.Ldc_I4_1 );
Generator.Emit( OpCodes.Ldc_I4_1 );
break;
case 2:
m_Generator.Emit( OpCodes.Ldc_I4_2 );
Generator.Emit( OpCodes.Ldc_I4_2 );
break;
case 3:
m_Generator.Emit( OpCodes.Ldc_I4_3 );
Generator.Emit( OpCodes.Ldc_I4_3 );
break;
case 4:
m_Generator.Emit( OpCodes.Ldc_I4_4 );
Generator.Emit( OpCodes.Ldc_I4_4 );
break;
case 5:
m_Generator.Emit( OpCodes.Ldc_I4_5 );
Generator.Emit( OpCodes.Ldc_I4_5 );
break;
case 6:
m_Generator.Emit( OpCodes.Ldc_I4_6 );
Generator.Emit( OpCodes.Ldc_I4_6 );
break;
case 7:
m_Generator.Emit( OpCodes.Ldc_I4_7 );
Generator.Emit( OpCodes.Ldc_I4_7 );
break;
case 8:
m_Generator.Emit( OpCodes.Ldc_I4_8 );
Generator.Emit( OpCodes.Ldc_I4_8 );
break;
default:
if ( value >= sbyte.MinValue && value <= sbyte.MaxValue )
m_Generator.Emit( OpCodes.Ldc_I4_S, (sbyte) value );
Generator.Emit( OpCodes.Ldc_I4_S, (sbyte) value );
else
m_Generator.Emit( OpCodes.Ldc_I4, value );
Generator.Emit( OpCodes.Ldc_I4, value );
break;
}
@ -329,7 +324,7 @@ namespace Server
Push( field.FieldType );
m_Generator.Emit( OpCodes.Ldfld, field );
Generator.Emit( OpCodes.Ldfld, field );
}
public void LoadLocal( LocalBuilder local )
@ -341,26 +336,26 @@ namespace Server
switch ( index )
{
case 0:
m_Generator.Emit( OpCodes.Ldloc_0 );
Generator.Emit( OpCodes.Ldloc_0 );
break;
case 1:
m_Generator.Emit( OpCodes.Ldloc_1 );
Generator.Emit( OpCodes.Ldloc_1 );
break;
case 2:
m_Generator.Emit( OpCodes.Ldloc_2 );
Generator.Emit( OpCodes.Ldloc_2 );
break;
case 3:
m_Generator.Emit( OpCodes.Ldloc_3 );
Generator.Emit( OpCodes.Ldloc_3 );
break;
default:
if ( index >= byte.MinValue && index <= byte.MinValue )
m_Generator.Emit( OpCodes.Ldloc_S, (byte) index );
Generator.Emit( OpCodes.Ldloc_S, (byte) index );
else
m_Generator.Emit( OpCodes.Ldloc, (short) index );
Generator.Emit( OpCodes.Ldloc, (short) index );
break;
}
@ -370,7 +365,7 @@ namespace Server
{
Pop( local.LocalType );
m_Generator.Emit( OpCodes.Stloc, local );
Generator.Emit( OpCodes.Stloc, local );
}
public void LoadArgument( int index )
@ -378,31 +373,31 @@ namespace Server
if ( index > 0 )
Push( m_ArgumentTypes[index - 1] );
else
Push( m_TypeBuilder );
Push( Type );
switch ( index )
{
case 0:
m_Generator.Emit( OpCodes.Ldarg_0 );
Generator.Emit( OpCodes.Ldarg_0 );
break;
case 1:
m_Generator.Emit( OpCodes.Ldarg_1 );
Generator.Emit( OpCodes.Ldarg_1 );
break;
case 2:
m_Generator.Emit( OpCodes.Ldarg_2 );
Generator.Emit( OpCodes.Ldarg_2 );
break;
case 3:
m_Generator.Emit( OpCodes.Ldarg_3 );
Generator.Emit( OpCodes.Ldarg_3 );
break;
default:
if ( index >= byte.MinValue && index <= byte.MaxValue )
m_Generator.Emit( OpCodes.Ldarg_S, (byte) index );
Generator.Emit( OpCodes.Ldarg_S, (byte) index );
else
m_Generator.Emit( OpCodes.Ldarg, (short) index );
Generator.Emit( OpCodes.Ldarg, (short) index );
break;
}
@ -413,7 +408,7 @@ namespace Server
Pop( typeof( object ) );
Push( type );
m_Generator.Emit( OpCodes.Isinst, type );
Generator.Emit( OpCodes.Isinst, type );
}
public void Neg()
@ -422,7 +417,7 @@ namespace Server
Push( typeof( int ) );
m_Generator.Emit( OpCodes.Neg );
Generator.Emit( OpCodes.Neg );
}
public void Compare( OpCode opCode )
@ -432,7 +427,7 @@ namespace Server
Push( typeof( int ) );
m_Generator.Emit( opCode );
Generator.Emit( opCode );
}
public void LogicalNot()
@ -441,8 +436,8 @@ namespace Server
Push( typeof( int ) );
m_Generator.Emit( OpCodes.Ldc_I4_0 );
m_Generator.Emit( OpCodes.Ceq );
Generator.Emit( OpCodes.Ldc_I4_0 );
Generator.Emit( OpCodes.Ceq );
}
public void Xor()
@ -452,7 +447,7 @@ namespace Server
Push( typeof( int ) );
m_Generator.Emit( OpCodes.Xor );
Generator.Emit( OpCodes.Xor );
}
public Type Active => m_Stack.Peek();
@ -662,8 +657,8 @@ namespace Server
{
LocalBuilder temp = AcquireTemp( type );
m_Generator.Emit( OpCodes.Stloc, temp );
m_Generator.Emit( OpCodes.Ldloca, temp );
Generator.Emit( OpCodes.Stloc, temp );
Generator.Emit( OpCodes.Ldloca, temp );
ReleaseTemp( temp );
}
@ -674,12 +669,12 @@ namespace Server
CallInfo call = m_Calls.Pop();
if ( ( call.type.IsValueType || call.type.IsByRef ) && call.method.DeclaringType != call.type )
m_Generator.Emit( OpCodes.Constrained, call.type );
Generator.Emit( OpCodes.Constrained, call.type );
if ( call.method.DeclaringType.IsValueType || call.method.IsStatic )
m_Generator.Emit( OpCodes.Call, call.method );
Generator.Emit( OpCodes.Call, call.method );
else
m_Generator.Emit( OpCodes.Callvirt, call.method );
Generator.Emit( OpCodes.Callvirt, call.method );
for ( int i = call.parms.Length - 1; i >= 0; --i )
Pop( call.parms[i].ParameterType );
@ -703,7 +698,7 @@ namespace Server
throw new InvalidOperationException( "Parameter type mismatch." );
if ( argumentType.IsValueType && !parm.ParameterType.IsValueType )
m_Generator.Emit( OpCodes.Box, argumentType );
Generator.Emit( OpCodes.Box, argumentType );
}
}
}

View file

@ -25,19 +25,17 @@ namespace Server.Misc
public class CirclePoint
{
private Point2D point;
private int angle;
private int quadrant;
public Point2D Point => point;
public int Angle => angle;
public int Quadrant => quadrant;
public Point2D Point { get; }
public int Angle { get; }
public int Quadrant { get; }
public CirclePoint( Point2D point, int angle, int quadrant )
{
this.point = point;
this.angle = angle;
this.quadrant = quadrant;
this.Point = point;
this.Angle = angle;
this.Quadrant = quadrant;
}
}

View file

@ -24,12 +24,8 @@ namespace Server.Items
"Zippy"
};
private string m_Dipper;
[CommandProperty( AccessLevel.GameMaster )]
public string Dipper{ get => m_Dipper;
set => m_Dipper = value;
}
public string Dipper { get; set; }
[Constructible]
public LightOfTheWinterSolstice() : this( m_StaffNames[Utility.Random( m_StaffNames.Length )] )
@ -39,7 +35,7 @@ namespace Server.Items
[Constructible]
public LightOfTheWinterSolstice( string dipper ) : base( 0x236E )
{
m_Dipper = dipper;
Dipper = dipper;
Weight = 1.0;
LootType = LootType.Blessed;
@ -55,7 +51,7 @@ namespace Server.Items
{
base.OnSingleClick( from );
LabelTo( from, 1070881, m_Dipper ); // Hand Dipped by ~1_name~
LabelTo( from, 1070881, Dipper ); // Hand Dipped by ~1_name~
LabelTo( from, 1070880 ); // Winter 2004
}
@ -63,7 +59,7 @@ namespace Server.Items
{
base.GetProperties( list );
list.Add( 1070881, m_Dipper ); // Hand Dipped by ~1_name~
list.Add( 1070881, Dipper ); // Hand Dipped by ~1_name~
list.Add( 1070880 ); // Winter 2004
}
@ -73,7 +69,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (string) m_Dipper );
writer.Write( (string) Dipper );
}
public override void Deserialize( GenericReader reader )
@ -86,18 +82,18 @@ namespace Server.Items
{
case 1:
{
m_Dipper = reader.ReadString();
Dipper = reader.ReadString();
break;
}
case 0:
{
m_Dipper = m_StaffNames[Utility.Random( m_StaffNames.Length )];
Dipper = m_StaffNames[Utility.Random( m_StaffNames.Length )];
break;
}
}
if ( m_Dipper != null )
m_Dipper = string.Intern( m_Dipper );
if ( Dipper != null )
Dipper = string.Intern( Dipper );
}
}
}

View file

@ -42,32 +42,30 @@ namespace Server.Guilds
public static RankDefinition Member => Ranks[1];
public static RankDefinition Lowest => Ranks[0];
private TextDefinition m_Name;
private int m_Rank;
private RankFlags m_Flags;
public TextDefinition Name { get; }
public TextDefinition Name => m_Name;
public int Rank => m_Rank;
public RankFlags Flags => m_Flags;
public int Rank { get; }
public RankFlags Flags { get; private set; }
public RankDefinition( TextDefinition name, int rank, RankFlags flags )
{
m_Name = name;
m_Rank = rank;
m_Flags = flags;
Name = name;
Rank = rank;
Flags = flags;
}
public bool GetFlag( RankFlags flag )
{
return ( (m_Flags & flag) != 0 );
return ( (Flags & flag) != 0 );
}
public void SetFlag( RankFlags flag, bool value )
{
if ( value )
m_Flags |= flag;
Flags |= flag;
else
m_Flags &= ~flag;
Flags &= ~flag;
}
}
@ -76,16 +74,13 @@ namespace Server.Guilds
#region Alliances
public class AllianceInfo
{
private static Dictionary<string, AllianceInfo> m_Alliances = new Dictionary<string, AllianceInfo>();
public static Dictionary<string, AllianceInfo> Alliances { get; } = new Dictionary<string, AllianceInfo>();
public static Dictionary<string, AllianceInfo> Alliances => m_Alliances;
private string m_Name;
private Guild m_Leader;
private List<Guild> m_Members;
private List<Guild> m_PendingMembers;
public string Name => m_Name;
public string Name { get; }
public void CalculateAllianceLeader()
{
@ -141,7 +136,7 @@ namespace Server.Guilds
public AllianceInfo( Guild leader, string name, Guild partner )
{
m_Leader = leader;
m_Name = name;
Name = name;
m_Members = new List<Guild>();
m_PendingMembers = new List<Guild>();
@ -149,22 +144,22 @@ namespace Server.Guilds
leader.Alliance = this;
partner.Alliance = this;
if ( !m_Alliances.ContainsKey( m_Name.ToLower() ) )
m_Alliances.Add( m_Name.ToLower(), this );
if ( !Alliances.ContainsKey( Name.ToLower() ) )
Alliances.Add( Name.ToLower(), this );
}
public void Serialize( GenericWriter writer )
{
writer.Write( (int)0 ); //Version
writer.Write( m_Name );
writer.Write( Name );
writer.Write( m_Leader );
writer.WriteGuildList( m_Members, true );
writer.WriteGuildList( m_PendingMembers, true );
if ( !m_Alliances.ContainsKey( m_Name.ToLower() ) )
m_Alliances.Add( m_Name.ToLower(), this );
if ( !Alliances.ContainsKey( Name.ToLower() ) )
Alliances.Add( Name.ToLower(), this );
}
public AllianceInfo( GenericReader reader )
@ -175,7 +170,7 @@ namespace Server.Guilds
{
case 0:
{
m_Name = reader.ReadString();
Name = reader.ReadString();
m_Leader = reader.ReadGuild() as Guild;
m_Members = reader.ReadStrongGuildList<Guild>();
@ -253,10 +248,10 @@ namespace Server.Guilds
for( int i = 0; i < m_Members.Count; i++ )
m_Members[i].Alliance = null;
m_Alliances.TryGetValue( m_Name.ToLower(), out AllianceInfo aInfo );
Alliances.TryGetValue( Name.ToLower(), out AllianceInfo aInfo );
if ( aInfo == this )
m_Alliances.Remove( m_Name.ToLower() );
Alliances.Remove( Name.ToLower() );
}
public void InvalidateMemberProperties()
@ -407,54 +402,27 @@ namespace Server.Guilds
public class WarDeclaration
{
private int m_Kills;
private int m_MaxKills;
public int Kills { get; set; }
private TimeSpan m_WarLength;
private DateTime m_WarBeginning;
public int MaxKills { get; set; }
private Guild m_Guild;
private Guild m_Opponent;
public TimeSpan WarLength { get; set; }
private bool m_WarRequester;
public Guild Opponent { get; }
public int Kills
{
get => m_Kills;
set => m_Kills = value;
}
public int MaxKills
{
get => m_MaxKills;
set => m_MaxKills = value;
}
public TimeSpan WarLength
{
get => m_WarLength;
set => m_WarLength = value;
}
public Guild Opponent => m_Opponent;
public Guild Guild { get; }
public Guild Guild => m_Guild;
public DateTime WarBeginning { get; set; }
public DateTime WarBeginning
{
get => m_WarBeginning;
set => m_WarBeginning = value;
}
public bool WarRequester
{
get => m_WarRequester;
set => m_WarRequester = value;
}
public bool WarRequester { get; set; }
public WarDeclaration( Guild g, Guild opponent, int maxKills, TimeSpan warLength, bool warRequester )
{
m_Guild = g;
m_MaxKills = maxKills;
m_Opponent = opponent;
m_WarLength = warLength;
m_WarRequester = warRequester;
Guild = g;
MaxKills = maxKills;
Opponent = opponent;
WarLength = warLength;
WarRequester = warRequester;
}
public WarDeclaration( GenericReader reader )
@ -465,16 +433,16 @@ namespace Server.Guilds
{
case 0:
{
m_Kills = reader.ReadInt();
m_MaxKills = reader.ReadInt();
Kills = reader.ReadInt();
MaxKills = reader.ReadInt();
m_WarLength = reader.ReadTimeSpan();
m_WarBeginning = reader.ReadDateTime();
WarLength = reader.ReadTimeSpan();
WarBeginning = reader.ReadDateTime();
m_Guild = reader.ReadGuild() as Guild;
m_Opponent = reader.ReadGuild() as Guild;
Guild = reader.ReadGuild() as Guild;
Opponent = reader.ReadGuild() as Guild;
m_WarRequester = reader.ReadBool();
WarRequester = reader.ReadBool();
break;
}
@ -485,50 +453,50 @@ namespace Server.Guilds
{
writer.Write( (int)0 ); //version
writer.Write( m_Kills );
writer.Write( m_MaxKills );
writer.Write( Kills );
writer.Write( MaxKills );
writer.Write( m_WarLength );
writer.Write( m_WarBeginning );
writer.Write( WarLength );
writer.Write( WarBeginning );
writer.Write( m_Guild );
writer.Write( m_Opponent );
writer.Write( Guild );
writer.Write( Opponent );
writer.Write( m_WarRequester );
writer.Write( WarRequester );
}
public WarStatus Status
{
get
{
if ( m_Opponent == null || m_Opponent.Disbanded )
if ( Opponent == null || Opponent.Disbanded )
return WarStatus.Win;
if ( m_Guild == null || m_Guild.Disbanded )
if ( Guild == null || Guild.Disbanded )
return WarStatus.Lose;
WarDeclaration w = m_Opponent.FindActiveWar( m_Guild );
WarDeclaration w = Opponent.FindActiveWar( Guild );
if ( m_Opponent.FindPendingWar( m_Guild ) != null && m_Guild.FindPendingWar( m_Opponent ) != null )
if ( Opponent.FindPendingWar( Guild ) != null && Guild.FindPendingWar( Opponent ) != null )
return WarStatus.Pending;
if ( w == null )
return WarStatus.Win;
if ( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.UtcNow )
if ( WarLength != TimeSpan.Zero && (WarBeginning + WarLength) < DateTime.UtcNow )
{
if ( m_Kills > w.m_Kills )
if ( Kills > w.Kills )
return WarStatus.Win;
if ( m_Kills < w.m_Kills )
if ( Kills < w.Kills )
return WarStatus.Lose;
return WarStatus.Draw;
}
if ( m_MaxKills > 0 )
if ( MaxKills > 0 )
{
if ( m_Kills >= m_MaxKills )
if ( Kills >= MaxKills )
return WarStatus.Win;
if ( w.m_Kills >= w.MaxKills )
if ( w.Kills >= w.MaxKills )
return WarStatus.Lose;
}
@ -735,9 +703,9 @@ namespace Server.Guilds
#region New Wars
public List<WarDeclaration> PendingWars => m_PendingWars;
public List<WarDeclaration> PendingWars { get; private set; }
public List<WarDeclaration> AcceptedWars => m_AcceptedWars;
public List<WarDeclaration> AcceptedWars { get; private set; }
public WarDeclaration FindPendingWar( Guild g )
@ -871,28 +839,7 @@ namespace Server.Guilds
private string m_Name;
private string m_Abbreviation;
private List<Guild> m_Allies;
private List<Guild> m_Enemies;
private List<Mobile> m_Members;
private Item m_Guildstone;
private Item m_Teleporter;
private string m_Charter;
private string m_Website;
private DateTime m_LastFealty;
private GuildType m_Type;
private DateTime m_TypeLastChange;
private List<Guild> m_AllyDeclarations, m_AllyInvitations;
private List<Guild> m_WarDeclarations, m_WarInvitations;
private List<Mobile> m_Candidates, m_Accepted;
private List<WarDeclaration> m_PendingWars, m_AcceptedWars;
private AllianceInfo m_AllianceInfo;
private Guild m_AllianceLeader;
@ -903,30 +850,30 @@ namespace Server.Guilds
#region Ctor mumbo-jumbo
m_Leader = leader;
m_Members = new List<Mobile>();
m_Allies = new List<Guild>();
m_Enemies = new List<Guild>();
m_WarDeclarations = new List<Guild>();
m_WarInvitations = new List<Guild>();
m_AllyDeclarations = new List<Guild>();
m_AllyInvitations = new List<Guild>();
m_Candidates = new List<Mobile>();
m_Accepted = new List<Mobile>();
Members = new List<Mobile>();
Allies = new List<Guild>();
Enemies = new List<Guild>();
WarDeclarations = new List<Guild>();
WarInvitations = new List<Guild>();
AllyDeclarations = new List<Guild>();
AllyInvitations = new List<Guild>();
Candidates = new List<Mobile>();
Accepted = new List<Mobile>();
m_LastFealty = DateTime.UtcNow;
LastFealty = DateTime.UtcNow;
m_Name = name;
m_Abbreviation = abbreviation;
m_TypeLastChange = DateTime.MinValue;
TypeLastChange = DateTime.MinValue;
AddMember( m_Leader );
if ( m_Leader is PlayerMobile mobile )
mobile.GuildRank = RankDefinition.Leader;
m_AcceptedWars = new List<WarDeclaration>();
m_PendingWars = new List<WarDeclaration>();
AcceptedWars = new List<WarDeclaration>();
PendingWars = new List<WarDeclaration>();
#endregion
}
@ -936,11 +883,11 @@ namespace Server.Guilds
public void InvalidateMemberProperties( bool onlyOPL = false)
{
if ( m_Members != null )
if ( Members != null )
{
for ( int i = 0; i < m_Members.Count; i++ )
for ( int i = 0; i < Members.Count; i++ )
{
Mobile m = m_Members[i];
Mobile m = Members[i];
m.InvalidateProperties();
if ( !onlyOPL )
@ -951,10 +898,10 @@ namespace Server.Guilds
public void InvalidateMemberNotoriety()
{
if ( m_Members != null )
if ( Members != null )
{
for (int i=0; i < m_Members.Count; i++)
m_Members[i].Delta( MobileDelta.Noto );
for (int i=0; i < Members.Count; i++)
Members[i].Delta( MobileDelta.Noto );
}
}
@ -1021,7 +968,7 @@ namespace Server.Guilds
List.Remove( Id );
foreach ( Mobile m in m_Members )
foreach ( Mobile m in Members )
{
m.SendLocalizedMessage( 502131 ); // Your guild has disbanded.
@ -1031,20 +978,20 @@ namespace Server.Guilds
m.Guild = null;
}
m_Members.Clear();
Members.Clear();
for ( int i = m_Allies.Count - 1; i >= 0; --i )
if ( i < m_Allies.Count )
RemoveAlly( m_Allies[i] );
for ( int i = Allies.Count - 1; i >= 0; --i )
if ( i < Allies.Count )
RemoveAlly( Allies[i] );
for ( int i = m_Enemies.Count - 1; i >= 0; --i )
if ( i < m_Enemies.Count )
RemoveEnemy( m_Enemies[i] );
for ( int i = Enemies.Count - 1; i >= 0; --i )
if ( i < Enemies.Count )
RemoveEnemy( Enemies[i] );
if ( !NewGuildSystem )
m_Guildstone?.Delete();
Guildstone?.Delete();
m_Guildstone = null;
Guildstone = null;
CheckExpiredWars();
@ -1054,7 +1001,7 @@ namespace Server.Guilds
#region Is<something>(...)
public bool IsMember( Mobile m )
{
return m_Members.Contains( m );
return Members.Contains( m );
}
public bool IsAlly( Guild g )
@ -1064,7 +1011,7 @@ namespace Server.Guilds
return (Alliance != null && Alliance.IsMember( this ) && Alliance.IsMember( g ));
}
return m_Allies.Contains( g );
return Allies.Contains( g );
}
public bool IsEnemy( Guild g )
@ -1091,7 +1038,7 @@ namespace Server.Guilds
return false;
}
return m_Enemies.Contains( g );
return Enemies.Contains( g );
}
#endregion
@ -1108,18 +1055,18 @@ namespace Server.Guilds
writer.Write( (int) 5 );//version
#region War Serialization
writer.Write( m_PendingWars.Count );
writer.Write( PendingWars.Count );
for( int i = 0; i < m_PendingWars.Count; i++ )
for( int i = 0; i < PendingWars.Count; i++ )
{
m_PendingWars[i].Serialize( writer );
PendingWars[i].Serialize( writer );
}
writer.Write( m_AcceptedWars.Count );
writer.Write( AcceptedWars.Count );
for( int i = 0; i < m_AcceptedWars.Count; i++ )
for( int i = 0; i < AcceptedWars.Count; i++ )
{
m_AcceptedWars[i].Serialize( writer );
AcceptedWars[i].Serialize( writer );
}
#endregion
@ -1137,33 +1084,33 @@ namespace Server.Guilds
//
writer.WriteGuildList( m_AllyDeclarations, true );
writer.WriteGuildList( m_AllyInvitations, true );
writer.WriteGuildList( AllyDeclarations, true );
writer.WriteGuildList( AllyInvitations, true );
writer.Write( m_TypeLastChange );
writer.Write( TypeLastChange );
writer.Write( (int)m_Type );
writer.Write( m_LastFealty );
writer.Write( LastFealty );
writer.Write( m_Leader );
writer.Write( m_Name );
writer.Write( m_Abbreviation );
writer.WriteGuildList<Guild>( m_Allies, true );
writer.WriteGuildList<Guild>( m_Enemies, true );
writer.WriteGuildList( m_WarDeclarations, true );
writer.WriteGuildList( m_WarInvitations, true );
writer.WriteGuildList<Guild>( Allies, true );
writer.WriteGuildList<Guild>( Enemies, true );
writer.WriteGuildList( WarDeclarations, true );
writer.WriteGuildList( WarInvitations, true );
writer.Write( m_Members, true );
writer.Write( m_Candidates, true );
writer.Write( m_Accepted, true );
writer.Write( Members, true );
writer.Write( Candidates, true );
writer.Write( Accepted, true );
writer.Write( m_Guildstone );
writer.Write( m_Teleporter );
writer.Write( Guildstone );
writer.Write( Teleporter );
writer.Write( m_Charter );
writer.Write( m_Website );
writer.Write( Charter );
writer.Write( Website );
}
public override void Deserialize( GenericReader reader )
@ -1176,17 +1123,17 @@ namespace Server.Guilds
{
int count = reader.ReadInt();
m_PendingWars = new List<WarDeclaration>();
PendingWars = new List<WarDeclaration>();
for( int i = 0; i < count; i++ )
{
m_PendingWars.Add( new WarDeclaration( reader ) );
PendingWars.Add( new WarDeclaration( reader ) );
}
count = reader.ReadInt();
m_AcceptedWars = new List<WarDeclaration>();
AcceptedWars = new List<WarDeclaration>();
for( int i = 0; i < count; i++ )
{
m_AcceptedWars.Add( new WarDeclaration( reader ) );
AcceptedWars.Add( new WarDeclaration( reader ) );
}
bool isAllianceLeader = reader.ReadBool();
@ -1201,14 +1148,14 @@ namespace Server.Guilds
}
case 4:
{
m_AllyDeclarations = reader.ReadStrongGuildList<Guild>();
m_AllyInvitations = reader.ReadStrongGuildList<Guild>();
AllyDeclarations = reader.ReadStrongGuildList<Guild>();
AllyInvitations = reader.ReadStrongGuildList<Guild>();
goto case 3;
}
case 3:
{
m_TypeLastChange = reader.ReadDateTime();
TypeLastChange = reader.ReadDateTime();
goto case 2;
}
@ -1220,7 +1167,7 @@ namespace Server.Guilds
}
case 1:
{
m_LastFealty = reader.ReadDateTime();
LastFealty = reader.ReadDateTime();
goto case 0;
}
@ -1234,37 +1181,37 @@ namespace Server.Guilds
m_Name = reader.ReadString();
m_Abbreviation = reader.ReadString();
m_Allies = reader.ReadStrongGuildList<Guild>();
m_Enemies = reader.ReadStrongGuildList<Guild>();
m_WarDeclarations = reader.ReadStrongGuildList<Guild>();
m_WarInvitations = reader.ReadStrongGuildList<Guild>();
Allies = reader.ReadStrongGuildList<Guild>();
Enemies = reader.ReadStrongGuildList<Guild>();
WarDeclarations = reader.ReadStrongGuildList<Guild>();
WarInvitations = reader.ReadStrongGuildList<Guild>();
m_Members = reader.ReadStrongMobileList();
m_Candidates = reader.ReadStrongMobileList();
m_Accepted = reader.ReadStrongMobileList();
Members = reader.ReadStrongMobileList();
Candidates = reader.ReadStrongMobileList();
Accepted = reader.ReadStrongMobileList();
m_Guildstone = reader.ReadItem();
m_Teleporter = reader.ReadItem();
Guildstone = reader.ReadItem();
Teleporter = reader.ReadItem();
m_Charter = reader.ReadString();
m_Website = reader.ReadString();
Charter = reader.ReadString();
Website = reader.ReadString();
break;
}
}
if ( m_AllyDeclarations == null )
m_AllyDeclarations = new List<Guild>();
if ( AllyDeclarations == null )
AllyDeclarations = new List<Guild>();
if ( m_AllyInvitations == null )
m_AllyInvitations = new List<Guild>();
if ( AllyInvitations == null )
AllyInvitations = new List<Guild>();
if ( m_AcceptedWars == null )
m_AcceptedWars = new List<WarDeclaration>();
if ( AcceptedWars == null )
AcceptedWars = new List<WarDeclaration>();
if ( m_PendingWars == null )
m_PendingWars = new List<WarDeclaration>();
if ( PendingWars == null )
PendingWars = new List<WarDeclaration>();
/*
@ -1277,7 +1224,7 @@ namespace Server.Guilds
private void VerifyGuild_Callback()
{
if ( (!NewGuildSystem && m_Guildstone == null) || m_Members.Count == 0 )
if ( (!NewGuildSystem && Guildstone == null) || Members.Count == 0 )
Disband();
CheckExpiredWars();
@ -1298,12 +1245,12 @@ namespace Server.Guilds
#region Add/Remove Member/Old Ally/Old Enemy
public void AddMember( Mobile m )
{
if ( !m_Members.Contains( m ) )
if ( !Members.Contains( m ) )
{
if ( m.Guild != null && m.Guild != this )
((Guild)m.Guild).RemoveMember( m );
m_Members.Add( m );
Members.Add( m );
m.Guild = this;
if ( !NewGuildSystem )
@ -1324,9 +1271,9 @@ namespace Server.Guilds
}
public void RemoveMember( Mobile m, int message )
{
if ( m_Members.Contains( m ) )
if ( Members.Contains( m ) )
{
m_Members.Remove( m );
Members.Remove( m );
Guild guild = m.Guild as Guild;
@ -1346,7 +1293,7 @@ namespace Server.Guilds
Disband();
}
if ( m_Members.Count == 0 )
if ( Members.Count == 0 )
Disband();
guild?.InvalidateWarNotoriety();
@ -1357,9 +1304,9 @@ namespace Server.Guilds
public void AddAlly( Guild g )
{
if ( !m_Allies.Contains( g ) )
if ( !Allies.Contains( g ) )
{
m_Allies.Add( g );
Allies.Add( g );
g.AddAlly( this );
}
@ -1367,9 +1314,9 @@ namespace Server.Guilds
public void RemoveAlly( Guild g )
{
if ( m_Allies.Contains( g ) )
if ( Allies.Contains( g ) )
{
m_Allies.Remove( g );
Allies.Remove( g );
g.RemoveAlly( this );
}
@ -1377,9 +1324,9 @@ namespace Server.Guilds
public void AddEnemy( Guild g )
{
if ( !m_Enemies.Contains( g ) )
if ( !Enemies.Contains( g ) )
{
m_Enemies.Add( g );
Enemies.Add( g );
g.AddEnemy( this );
}
@ -1387,9 +1334,9 @@ namespace Server.Guilds
public void RemoveEnemy( Guild g )
{
if ( m_Enemies != null && m_Enemies.Contains( g ) )
if ( Enemies != null && Enemies.Contains( g ) )
{
m_Enemies.Remove( g );
Enemies.Remove( g );
g.RemoveEnemy( this );
}
@ -1404,20 +1351,20 @@ namespace Server.Guilds
}
public void GuildMessage( int number )
{
for ( int i = 0; i < m_Members.Count; ++i )
m_Members[i].SendLocalizedMessage( number );
for ( int i = 0; i < Members.Count; ++i )
Members[i].SendLocalizedMessage( number );
}
public void GuildMessage( int number, string args, int hue = 0x3B2)
{
for ( int i = 0; i < m_Members.Count; ++i )
m_Members[i].SendLocalizedMessage( number, args, hue );
for ( int i = 0; i < Members.Count; ++i )
Members[i].SendLocalizedMessage( number, args, hue );
}
public void GuildMessage( int number, bool append, string affix, string args = "", int hue = 0x3B2)
{
for ( int i = 0; i < m_Members.Count; ++i )
m_Members[i].SendLocalizedMessage( number, append, affix, args, hue );
for ( int i = 0; i < Members.Count; ++i )
Members[i].SendLocalizedMessage( number, append, affix, args, hue );
}
public void GuildTextMessage( string text )
@ -1430,8 +1377,8 @@ namespace Server.Guilds
}
public void GuildTextMessage( int hue, string text )
{
for( int i = 0; i < m_Members.Count; ++i )
m_Members[i].SendMessage( hue, text );
for( int i = 0; i < Members.Count; ++i )
Members[i].SendMessage( hue, text );
}
public void GuildTextMessage( int hue, string format, params object[] args )
{
@ -1441,9 +1388,9 @@ namespace Server.Guilds
public void GuildChat( Mobile from, int hue, string text )
{
Packet p = null;
for ( int i = 0; i < m_Members.Count; i++ )
for ( int i = 0; i < Members.Count; i++ )
{
Mobile m = m_Members[i];
Mobile m = Members[i];
NetState state = m.NetState;
@ -1495,9 +1442,9 @@ namespace Server.Guilds
int votingMembers = 0;
for ( int i = 0; m_Members != null && i < m_Members.Count; ++i )
for ( int i = 0; Members != null && i < Members.Count; ++i )
{
Mobile memb = m_Members[i];
Mobile memb = Members[i];
if ( !CanVote( memb ) )
continue;
@ -1545,25 +1492,17 @@ namespace Server.Guilds
GuildMessage( 1018015, true, winner.Name ); // Guild Message: Guildmaster changed to:
Leader = winner;
m_LastFealty = DateTime.UtcNow;
LastFealty = DateTime.UtcNow;
}
#endregion
#region Getters & Setters
[CommandProperty( AccessLevel.GameMaster )]
public Item Guildstone
{
get => m_Guildstone;
set => m_Guildstone = value;
}
public Item Guildstone { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Item Teleporter
{
get => m_Teleporter;
set => m_Teleporter = value;
}
public Item Teleporter { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public override string Name
@ -1575,16 +1514,12 @@ namespace Server.Guilds
InvalidateMemberProperties( true );
m_Guildstone?.InvalidateProperties();
Guildstone?.InvalidateProperties();
}
}
[CommandProperty( AccessLevel.GameMaster )]
public string Website
{
get => m_Website;
set => m_Website = value;
}
public string Website { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public override string Abbreviation
@ -1596,16 +1531,12 @@ namespace Server.Guilds
InvalidateMemberProperties( true );
m_Guildstone?.InvalidateProperties();
Guildstone?.InvalidateProperties();
}
}
[CommandProperty( AccessLevel.GameMaster )]
public string Charter
{
get => m_Charter;
set => m_Charter = value;
}
public string Charter { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public override GuildType Type
@ -1616,7 +1547,7 @@ namespace Server.Guilds
if ( m_Type != value )
{
m_Type = value;
m_TypeLastChange = DateTime.UtcNow;
TypeLastChange = DateTime.UtcNow;
InvalidateMemberProperties();
}
@ -1624,32 +1555,28 @@ namespace Server.Guilds
}
[CommandProperty( AccessLevel.GameMaster )]
public DateTime LastFealty
{
get => m_LastFealty;
set => m_LastFealty = value;
}
public DateTime LastFealty { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public DateTime TypeLastChange => m_TypeLastChange;
public DateTime TypeLastChange { get; private set; }
public List<Guild> Allies => m_Allies;
public List<Guild> Allies { get; private set; }
public List<Guild> Enemies => m_Enemies;
public List<Guild> Enemies { get; private set; }
public List<Guild> AllyDeclarations => m_AllyDeclarations;
public List<Guild> AllyDeclarations { get; private set; }
public List<Guild> AllyInvitations => m_AllyInvitations;
public List<Guild> AllyInvitations { get; private set; }
public List<Guild> WarDeclarations => m_WarDeclarations;
public List<Guild> WarDeclarations { get; private set; }
public List<Guild> WarInvitations => m_WarInvitations;
public List<Guild> WarInvitations { get; private set; }
public List<Mobile> Candidates => m_Candidates;
public List<Mobile> Candidates { get; private set; }
public List<Mobile> Accepted => m_Accepted;
public List<Mobile> Accepted { get; private set; }
public List<Mobile> Members => m_Members;
public List<Mobile> Members { get; private set; }
#endregion
}

View file

@ -8,96 +8,83 @@ namespace Server
{
public class HardwareInfo
{
private int m_InstanceID;
private int m_OSMajor, m_OSMinor, m_OSRevision;
private int m_CpuManufacturer, m_CpuFamily, m_CpuModel, m_CpuClockSpeed, m_CpuQuantity;
private int m_PhysicalMemory;
private int m_ScreenWidth, m_ScreenHeight, m_ScreenDepth;
private int m_DXMajor, m_DXMinor;
private int m_VCVendorID, m_VCDeviceID, m_VCMemory;
private int m_Distribution, m_ClientsRunning, m_ClientsInstalled, m_PartialInstalled;
private string m_VCDescription;
private string m_Language;
private string m_Unknown;
private DateTime m_TimeReceived;
[CommandProperty( AccessLevel.GameMaster )]
public int CpuModel { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int CpuModel => m_CpuModel;
public int CpuClockSpeed { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int CpuClockSpeed => m_CpuClockSpeed;
public int CpuQuantity { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int CpuQuantity => m_CpuQuantity;
public int OSMajor { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int OSMajor => m_OSMajor;
public int OSMinor { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int OSMinor => m_OSMinor;
public int OSRevision { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int OSRevision => m_OSRevision;
public int InstanceID { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int InstanceID => m_InstanceID;
public int ScreenWidth { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ScreenWidth => m_ScreenWidth;
public int ScreenHeight { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ScreenHeight => m_ScreenHeight;
public int ScreenDepth { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ScreenDepth => m_ScreenDepth;
public int PhysicalMemory { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int PhysicalMemory => m_PhysicalMemory;
public int CpuManufacturer { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int CpuManufacturer => m_CpuManufacturer;
public int CpuFamily { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int CpuFamily => m_CpuFamily;
public int VCVendorID { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int VCVendorID => m_VCVendorID;
public int VCDeviceID { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int VCDeviceID => m_VCDeviceID;
public int VCMemory { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int VCMemory => m_VCMemory;
public int DXMajor { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int DXMajor => m_DXMajor;
public int DXMinor { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int DXMinor => m_DXMinor;
public string VCDescription { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public string VCDescription => m_VCDescription;
public string Language { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public string Language => m_Language;
public int Distribution { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Distribution => m_Distribution;
public int ClientsRunning { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ClientsRunning => m_ClientsRunning;
public int ClientsInstalled { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ClientsInstalled => m_ClientsInstalled;
public int PartialInstalled { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int PartialInstalled => m_PartialInstalled;
public string Unknown { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public string Unknown => m_Unknown;
[CommandProperty( AccessLevel.GameMaster )]
public DateTime TimeReceived => m_TimeReceived;
public DateTime TimeReceived { get; private set; }
public static void Initialize()
{
@ -148,33 +135,33 @@ namespace Server
HardwareInfo info = new HardwareInfo();
info.m_InstanceID = pvSrc.ReadInt32();
info.m_OSMajor = pvSrc.ReadInt32();
info.m_OSMinor = pvSrc.ReadInt32();
info.m_OSRevision = pvSrc.ReadInt32();
info.m_CpuManufacturer = pvSrc.ReadByte();
info.m_CpuFamily = pvSrc.ReadInt32();
info.m_CpuModel = pvSrc.ReadInt32();
info.m_CpuClockSpeed = pvSrc.ReadInt32();
info.m_CpuQuantity = pvSrc.ReadByte();
info.m_PhysicalMemory = pvSrc.ReadInt32();
info.m_ScreenWidth = pvSrc.ReadInt32();
info.m_ScreenHeight = pvSrc.ReadInt32();
info.m_ScreenDepth = pvSrc.ReadInt32();
info.m_DXMajor = pvSrc.ReadInt16();
info.m_DXMinor = pvSrc.ReadInt16();
info.m_VCDescription = pvSrc.ReadUnicodeStringLESafe( 64 );
info.m_VCVendorID = pvSrc.ReadInt32();
info.m_VCDeviceID = pvSrc.ReadInt32();
info.m_VCMemory = pvSrc.ReadInt32();
info.m_Distribution = pvSrc.ReadByte();
info.m_ClientsRunning = pvSrc.ReadByte();
info.m_ClientsInstalled = pvSrc.ReadByte();
info.m_PartialInstalled = pvSrc.ReadByte();
info.m_Language = pvSrc.ReadUnicodeStringLESafe( 4 );
info.m_Unknown = pvSrc.ReadStringSafe( 64 );
info.InstanceID = pvSrc.ReadInt32();
info.OSMajor = pvSrc.ReadInt32();
info.OSMinor = pvSrc.ReadInt32();
info.OSRevision = pvSrc.ReadInt32();
info.CpuManufacturer = pvSrc.ReadByte();
info.CpuFamily = pvSrc.ReadInt32();
info.CpuModel = pvSrc.ReadInt32();
info.CpuClockSpeed = pvSrc.ReadInt32();
info.CpuQuantity = pvSrc.ReadByte();
info.PhysicalMemory = pvSrc.ReadInt32();
info.ScreenWidth = pvSrc.ReadInt32();
info.ScreenHeight = pvSrc.ReadInt32();
info.ScreenDepth = pvSrc.ReadInt32();
info.DXMajor = pvSrc.ReadInt16();
info.DXMinor = pvSrc.ReadInt16();
info.VCDescription = pvSrc.ReadUnicodeStringLESafe( 64 );
info.VCVendorID = pvSrc.ReadInt32();
info.VCDeviceID = pvSrc.ReadInt32();
info.VCMemory = pvSrc.ReadInt32();
info.Distribution = pvSrc.ReadByte();
info.ClientsRunning = pvSrc.ReadByte();
info.ClientsInstalled = pvSrc.ReadByte();
info.PartialInstalled = pvSrc.ReadByte();
info.Language = pvSrc.ReadUnicodeStringLESafe( 4 );
info.Unknown = pvSrc.ReadStringSafe( 64 );
info.m_TimeReceived = DateTime.UtcNow;
info.TimeReceived = DateTime.UtcNow;
if ( state.Account is Account acct )
acct.HardwareInfo = info;

View file

@ -274,22 +274,11 @@ namespace Server.Misc
}
}
private string[] m_Syllables;
private string[] m_Keywords;
private string[] m_Responses;
private Dictionary<string, string> m_KeywordHash;
private int m_Hue;
private int m_Sound;
private IHSFlags m_Flags;
public string[] Syllables
{
get => m_Syllables;
set => m_Syllables = value;
}
public string[] Syllables { get; set; }
public string[] Keywords
{
@ -303,33 +292,17 @@ namespace Server.Misc
}
}
public string[] Responses
{
get => m_Responses;
set => m_Responses = value;
}
public string[] Responses { get; set; }
public int Hue
{
get => m_Hue;
set => m_Hue = value;
}
public int Hue { get; set; }
public int Sound
{
get => m_Sound;
set => m_Sound = value;
}
public int Sound { get; set; }
public IHSFlags Flags
{
get => m_Flags;
set => m_Flags = value;
}
public IHSFlags Flags { get; set; }
public string GetRandomSyllable()
{
return m_Syllables[Utility.Random( m_Syllables.Length )];
return Syllables[Utility.Random( Syllables.Length )];
}
public string ConstructWord( int syllableCount )
@ -402,17 +375,17 @@ namespace Server.Misc
private string GetRandomResponseWord( List<string> keywordsFound )
{
int random = Utility.Random( keywordsFound.Count + m_Responses.Length );
int random = Utility.Random( keywordsFound.Count + Responses.Length );
if ( random < keywordsFound.Count )
return keywordsFound[random];
return m_Responses[random - keywordsFound.Count];
return Responses[random - keywordsFound.Count];
}
public bool OnSpeech( Mobile mob, Mobile speaker, string text )
{
if ( (m_Flags & IHSFlags.OnSpeech) == 0 || m_Keywords == null || m_Responses == null || m_KeywordHash == null )
if ( (Flags & IHSFlags.OnSpeech) == 0 || m_Keywords == null || Responses == null || m_KeywordHash == null )
return false; // not enabled
if ( !speaker.Alive )
@ -511,7 +484,7 @@ namespace Server.Misc
public void OnDeath( Mobile mob )
{
if ( (m_Flags & IHSFlags.OnDeath) == 0 )
if ( (Flags & IHSFlags.OnDeath) == 0 )
return; // not enabled
if ( 90 > Utility.Random( 100 ) )
@ -530,7 +503,7 @@ namespace Server.Misc
public void OnMovement( Mobile mob, Mobile mover, Point3D oldLocation )
{
if ( (m_Flags & IHSFlags.OnMovement) == 0 )
if ( (Flags & IHSFlags.OnMovement) == 0 )
return; // not enabled
if ( !mover.Player || (mover.Hidden && mover.AccessLevel > AccessLevel.Player) )
@ -547,7 +520,7 @@ namespace Server.Misc
public void OnDamage( Mobile mob, int amount )
{
if ( (m_Flags & IHSFlags.OnDamaged) == 0 )
if ( (Flags & IHSFlags.OnDamaged) == 0 )
return; // not enabled
if ( 90 > Utility.Random( 100 ) )
@ -577,13 +550,13 @@ namespace Server.Misc
public void OnConstruct( Mobile mob )
{
mob.SpeechHue = m_Hue;
mob.SpeechHue = Hue;
}
public void SaySentance( Mobile mob, int wordCount )
{
mob.Say( ConstructSentance( wordCount ) );
mob.PlaySound( m_Sound );
mob.PlaySound( Sound );
}
public InhumanSpeech()

View file

@ -26,18 +26,17 @@ namespace Server.Misc
{
struct InternationalCode
{
string m_Code;
string m_Language;
string m_Country;
string m_Language_LocalName;
string m_Country_LocalName;
bool m_HasLocalInfo;
public string Code => m_Code;
public string Language => m_Language;
public string Country => m_Country;
public string Language_LocalName => m_Language_LocalName;
public string Country_LocalName => m_Country_LocalName;
public string Code { get; }
public string Language { get; }
public string Country { get; }
public string Language_LocalName { get; }
public string Country_LocalName { get; }
public InternationalCode( string code, string language, string country ) : this( code, language, country, null, null )
{
@ -46,11 +45,11 @@ namespace Server.Misc
public InternationalCode( string code, string language, string country, string language_localname, string country_localname )
{
m_Code = code;
m_Language = language;
m_Country = country;
m_Language_LocalName = language_localname;
m_Country_LocalName = country_localname;
Code = code;
Language = language;
Country = country;
Language_LocalName = language_localname;
Country_LocalName = country_localname;
m_HasLocalInfo = true;
}
@ -61,15 +60,15 @@ namespace Server.Misc
if ( m_HasLocalInfo )
{
s =
$"{(DefaultLocalNames ? m_Language_LocalName : m_Language)} - {(DefaultLocalNames ? m_Country_LocalName : m_Country)}";
$"{(DefaultLocalNames ? Language_LocalName : Language)} - {(DefaultLocalNames ? Country_LocalName : Country)}";
if ( ShowAlternatives )
s +=
$" 【{(DefaultLocalNames ? m_Language : m_Language_LocalName)} - {(DefaultLocalNames ? m_Country : m_Country_LocalName)}‎】";
$" 【{(DefaultLocalNames ? Language : Language_LocalName)} - {(DefaultLocalNames ? Country : Country_LocalName)}‎】";
}
else
{
s = $"{m_Language} - {m_Country}";
s = $"{Language} - {Country}";
}
return s;
@ -313,21 +312,19 @@ namespace Server.Misc
private class InternationalCodeCounter
{
private string m_Code;
private int m_Count;
public string Code { get; }
public string Code => m_Code;
public int Count => m_Count;
public int Count { get; private set; }
public InternationalCodeCounter( string code )
{
m_Code = code;
m_Count = 1;
Code = code;
Count = 1;
}
public void Increase()
{
m_Count++;
Count++;
}
}

View file

@ -8,229 +8,215 @@ namespace Server
#region List definitions
#region Mondain's Legacy
private static Type[] m_MLWeaponTypes = {
typeof( AssassinSpike ), typeof( DiamondMace ), typeof( ElvenMachete ),
typeof( ElvenSpellblade ), typeof( Leafblade ), typeof( OrnateAxe ),
typeof( RadiantScimitar ), typeof( RuneBlade ), typeof( WarCleaver ),
typeof( WildStaff )
};
public static Type[] MLWeaponTypes => m_MLWeaponTypes;
public static Type[] MLWeaponTypes { get; } =
{
typeof( AssassinSpike ), typeof( DiamondMace ), typeof( ElvenMachete ),
typeof( ElvenSpellblade ), typeof( Leafblade ), typeof( OrnateAxe ),
typeof( RadiantScimitar ), typeof( RuneBlade ), typeof( WarCleaver ),
typeof( WildStaff )
};
private static Type[] m_MLRangedWeaponTypes = {
typeof( ElvenCompositeLongbow ), typeof( MagicalShortbow )
};
public static Type[] MLRangedWeaponTypes { get; } =
{
typeof( ElvenCompositeLongbow ), typeof( MagicalShortbow )
};
public static Type[] MLRangedWeaponTypes => m_MLRangedWeaponTypes;
public static Type[] MLArmorTypes { get; } =
{
typeof( Circlet ), typeof( GemmedCirclet ), typeof( LeafTonlet ),
typeof( RavenHelm ), typeof( RoyalCirclet ), typeof( VultureHelm ),
typeof( WingedHelm ), typeof( LeafArms ), typeof( LeafChest ),
typeof( LeafGloves ), typeof( LeafGorget ), typeof( LeafLegs ),
typeof( WoodlandArms ), typeof( WoodlandChest ), typeof( WoodlandGloves ),
typeof( WoodlandGorget ), typeof( WoodlandLegs ), typeof( HideChest ),
typeof( HideGloves ), typeof( HideGorget ), typeof( HidePants ),
typeof( HidePauldrons )
};
private static Type[] m_MLArmorTypes = {
typeof( Circlet ), typeof( GemmedCirclet ), typeof( LeafTonlet ),
typeof( RavenHelm ), typeof( RoyalCirclet ), typeof( VultureHelm ),
typeof( WingedHelm ), typeof( LeafArms ), typeof( LeafChest ),
typeof( LeafGloves ), typeof( LeafGorget ), typeof( LeafLegs ),
typeof( WoodlandArms ), typeof( WoodlandChest ), typeof( WoodlandGloves ),
typeof( WoodlandGorget ), typeof( WoodlandLegs ), typeof( HideChest ),
typeof( HideGloves ), typeof( HideGorget ), typeof( HidePants ),
typeof( HidePauldrons )
};
public static Type[] MLArmorTypes => m_MLArmorTypes;
private static Type[] m_MLClothingTypes = {
typeof( MaleElvenRobe ), typeof( FemaleElvenRobe ), typeof( ElvenPants ),
typeof( ElvenShirt ), typeof( ElvenDarkShirt ), typeof( ElvenBoots ),
typeof( VultureHelm ), typeof( WoodlandBelt )
};
public static Type[] MLClothingTypes => m_MLClothingTypes;
public static Type[] MLClothingTypes { get; } =
{
typeof( MaleElvenRobe ), typeof( FemaleElvenRobe ), typeof( ElvenPants ),
typeof( ElvenShirt ), typeof( ElvenDarkShirt ), typeof( ElvenBoots ),
typeof( VultureHelm ), typeof( WoodlandBelt )
};
#endregion
private static Type[] m_SEWeaponTypes = {
typeof( Bokuto ), typeof( Daisho ), typeof( Kama ),
typeof( Lajatang ), typeof( NoDachi ), typeof( Nunchaku ),
typeof( Sai ), typeof( Tekagi ), typeof( Tessen ),
typeof( Tetsubo ), typeof( Wakizashi )
};
public static Type[] SEWeaponTypes { get; } =
{
typeof( Bokuto ), typeof( Daisho ), typeof( Kama ),
typeof( Lajatang ), typeof( NoDachi ), typeof( Nunchaku ),
typeof( Sai ), typeof( Tekagi ), typeof( Tessen ),
typeof( Tetsubo ), typeof( Wakizashi )
};
public static Type[] SEWeaponTypes => m_SEWeaponTypes;
public static Type[] AosWeaponTypes { get; } =
{
typeof( Scythe ), typeof( BoneHarvester ), typeof( Scepter ),
typeof( BladedStaff ), typeof( Pike ), typeof( DoubleBladedStaff ),
typeof( Lance ), typeof( CrescentBlade )
};
private static Type[] m_AosWeaponTypes = {
typeof( Scythe ), typeof( BoneHarvester ), typeof( Scepter ),
typeof( BladedStaff ), typeof( Pike ), typeof( DoubleBladedStaff ),
typeof( Lance ), typeof( CrescentBlade )
};
public static Type[] WeaponTypes { get; } =
{
typeof( Axe ), typeof( BattleAxe ), typeof( DoubleAxe ),
typeof( ExecutionersAxe ), typeof( Hatchet ), typeof( LargeBattleAxe ),
typeof( TwoHandedAxe ), typeof( WarAxe ), typeof( Club ),
typeof( Mace ), typeof( Maul ), typeof( WarHammer ),
typeof( WarMace ), typeof( Bardiche ), typeof( Halberd ),
typeof( Spear ), typeof( ShortSpear ), typeof( Pitchfork ),
typeof( WarFork ), typeof( BlackStaff ), typeof( GnarledStaff ),
typeof( QuarterStaff ), typeof( Broadsword ), typeof( Cutlass ),
typeof( Katana ), typeof( Kryss ), typeof( Longsword ),
typeof( Scimitar ), typeof( VikingSword ), typeof( Pickaxe ),
typeof( HammerPick ), typeof( ButcherKnife ), typeof( Cleaver ),
typeof( Dagger ), typeof( SkinningKnife ), typeof( ShepherdsCrook )
};
public static Type[] AosWeaponTypes => m_AosWeaponTypes;
public static Type[] SERangedWeaponTypes { get; } =
{
typeof( Yumi )
};
private static Type[] m_WeaponTypes = {
typeof( Axe ), typeof( BattleAxe ), typeof( DoubleAxe ),
typeof( ExecutionersAxe ), typeof( Hatchet ), typeof( LargeBattleAxe ),
typeof( TwoHandedAxe ), typeof( WarAxe ), typeof( Club ),
typeof( Mace ), typeof( Maul ), typeof( WarHammer ),
typeof( WarMace ), typeof( Bardiche ), typeof( Halberd ),
typeof( Spear ), typeof( ShortSpear ), typeof( Pitchfork ),
typeof( WarFork ), typeof( BlackStaff ), typeof( GnarledStaff ),
typeof( QuarterStaff ), typeof( Broadsword ), typeof( Cutlass ),
typeof( Katana ), typeof( Kryss ), typeof( Longsword ),
typeof( Scimitar ), typeof( VikingSword ), typeof( Pickaxe ),
typeof( HammerPick ), typeof( ButcherKnife ), typeof( Cleaver ),
typeof( Dagger ), typeof( SkinningKnife ), typeof( ShepherdsCrook )
};
public static Type[] AosRangedWeaponTypes { get; } =
{
typeof( CompositeBow ), typeof( RepeatingCrossbow )
};
public static Type[] WeaponTypes => m_WeaponTypes;
public static Type[] RangedWeaponTypes { get; } =
{
typeof( Bow ), typeof( Crossbow ), typeof( HeavyCrossbow )
};
private static Type[] m_SERangedWeaponTypes = {
typeof( Yumi )
};
public static Type[] SEArmorTypes { get; } =
{
typeof( ChainHatsuburi ), typeof( LeatherDo ), typeof( LeatherHaidate ),
typeof( LeatherHiroSode ), typeof( LeatherJingasa ), typeof( LeatherMempo ),
typeof( LeatherNinjaHood ), typeof( LeatherNinjaJacket ), typeof( LeatherNinjaMitts ),
typeof( LeatherNinjaPants ), typeof( LeatherSuneate ), typeof( DecorativePlateKabuto ),
typeof( HeavyPlateJingasa ), typeof( LightPlateJingasa ), typeof( PlateBattleKabuto ),
typeof( PlateDo ), typeof( PlateHaidate ), typeof( PlateHatsuburi ),
typeof( PlateHiroSode ), typeof( PlateMempo ), typeof( PlateSuneate ),
typeof( SmallPlateJingasa ), typeof( StandardPlateKabuto ), typeof( StuddedDo ),
typeof( StuddedHaidate ), typeof( StuddedHiroSode ), typeof( StuddedMempo ),
typeof( StuddedSuneate )
};
public static Type[] SERangedWeaponTypes => m_SERangedWeaponTypes;
public static Type[] ArmorTypes { get; } =
{
typeof( BoneArms ), typeof( BoneChest ), typeof( BoneGloves ),
typeof( BoneLegs ), typeof( BoneHelm ), typeof( ChainChest ),
typeof( ChainLegs ), typeof( ChainCoif ), typeof( Bascinet ),
typeof( CloseHelm ), typeof( Helmet ), typeof( NorseHelm ),
typeof( OrcHelm ), typeof( FemaleLeatherChest ), typeof( LeatherArms ),
typeof( LeatherBustierArms ), typeof( LeatherChest ), typeof( LeatherGloves ),
typeof( LeatherGorget ), typeof( LeatherLegs ), typeof( LeatherShorts ),
typeof( LeatherSkirt ), typeof( LeatherCap ), typeof( FemalePlateChest ),
typeof( PlateArms ), typeof( PlateChest ), typeof( PlateGloves ),
typeof( PlateGorget ), typeof( PlateHelm ), typeof( PlateLegs ),
typeof( RingmailArms ), typeof( RingmailChest ), typeof( RingmailGloves ),
typeof( RingmailLegs ), typeof( FemaleStuddedChest ), typeof( StuddedArms ),
typeof( StuddedBustierArms ), typeof( StuddedChest ), typeof( StuddedGloves ),
typeof( StuddedGorget ), typeof( StuddedLegs )
};
private static Type[] m_AosRangedWeaponTypes = {
typeof( CompositeBow ), typeof( RepeatingCrossbow )
};
public static Type[] AosShieldTypes { get; } =
{
typeof( ChaosShield ), typeof( OrderShield )
};
public static Type[] AosRangedWeaponTypes => m_AosRangedWeaponTypes;
public static Type[] ShieldTypes { get; } =
{
typeof( BronzeShield ), typeof( Buckler ), typeof( HeaterShield ),
typeof( MetalShield ), typeof( MetalKiteShield ), typeof( WoodenKiteShield ),
typeof( WoodenShield )
};
private static Type[] m_RangedWeaponTypes = {
typeof( Bow ), typeof( Crossbow ), typeof( HeavyCrossbow )
};
public static Type[] GemTypes { get; } =
{
typeof( Amber ), typeof( Amethyst ), typeof( Citrine ),
typeof( Diamond ), typeof( Emerald ), typeof( Ruby ),
typeof( Sapphire ), typeof( StarSapphire ), typeof( Tourmaline )
};
public static Type[] RangedWeaponTypes => m_RangedWeaponTypes;
public static Type[] JewelryTypes { get; } =
{
typeof( GoldRing ), typeof( GoldBracelet ),
typeof( SilverRing ), typeof( SilverBracelet )
};
private static Type[] m_SEArmorTypes = {
typeof( ChainHatsuburi ), typeof( LeatherDo ), typeof( LeatherHaidate ),
typeof( LeatherHiroSode ), typeof( LeatherJingasa ), typeof( LeatherMempo ),
typeof( LeatherNinjaHood ), typeof( LeatherNinjaJacket ), typeof( LeatherNinjaMitts ),
typeof( LeatherNinjaPants ), typeof( LeatherSuneate ), typeof( DecorativePlateKabuto ),
typeof( HeavyPlateJingasa ), typeof( LightPlateJingasa ), typeof( PlateBattleKabuto ),
typeof( PlateDo ), typeof( PlateHaidate ), typeof( PlateHatsuburi ),
typeof( PlateHiroSode ), typeof( PlateMempo ), typeof( PlateSuneate ),
typeof( SmallPlateJingasa ), typeof( StandardPlateKabuto ), typeof( StuddedDo ),
typeof( StuddedHaidate ), typeof( StuddedHiroSode ), typeof( StuddedMempo ),
typeof( StuddedSuneate )
};
public static Type[] RegTypes { get; } =
{
typeof( BlackPearl ), typeof( Bloodmoss ), typeof( Garlic ),
typeof( Ginseng ), typeof( MandrakeRoot ), typeof( Nightshade ),
typeof( SulfurousAsh ), typeof( SpidersSilk )
};
public static Type[] SEArmorTypes => m_SEArmorTypes;
public static Type[] NecroRegTypes { get; } =
{
typeof( BatWing ), typeof( GraveDust ), typeof( DaemonBlood ),
typeof( NoxCrystal ), typeof( PigIron )
};
private static Type[] m_ArmorTypes = {
typeof( BoneArms ), typeof( BoneChest ), typeof( BoneGloves ),
typeof( BoneLegs ), typeof( BoneHelm ), typeof( ChainChest ),
typeof( ChainLegs ), typeof( ChainCoif ), typeof( Bascinet ),
typeof( CloseHelm ), typeof( Helmet ), typeof( NorseHelm ),
typeof( OrcHelm ), typeof( FemaleLeatherChest ), typeof( LeatherArms ),
typeof( LeatherBustierArms ), typeof( LeatherChest ), typeof( LeatherGloves ),
typeof( LeatherGorget ), typeof( LeatherLegs ), typeof( LeatherShorts ),
typeof( LeatherSkirt ), typeof( LeatherCap ), typeof( FemalePlateChest ),
typeof( PlateArms ), typeof( PlateChest ), typeof( PlateGloves ),
typeof( PlateGorget ), typeof( PlateHelm ), typeof( PlateLegs ),
typeof( RingmailArms ), typeof( RingmailChest ), typeof( RingmailGloves ),
typeof( RingmailLegs ), typeof( FemaleStuddedChest ), typeof( StuddedArms ),
typeof( StuddedBustierArms ), typeof( StuddedChest ), typeof( StuddedGloves ),
typeof( StuddedGorget ), typeof( StuddedLegs )
};
public static Type[] PotionTypes { get; } =
{
typeof( AgilityPotion ), typeof( StrengthPotion ), typeof( RefreshPotion ),
typeof( LesserCurePotion ), typeof( LesserHealPotion ), typeof( LesserPoisonPotion )
};
public static Type[] ArmorTypes => m_ArmorTypes;
public static Type[] SEInstrumentTypes { get; } =
{
typeof( BambooFlute )
};
private static Type[] m_AosShieldTypes = {
typeof( ChaosShield ), typeof( OrderShield )
};
public static Type[] InstrumentTypes { get; } =
{
typeof( Drums ), typeof( Harp ), typeof( LapHarp ),
typeof( Lute ), typeof( Tambourine ), typeof( TambourineTassel )
};
public static Type[] AosShieldTypes => m_AosShieldTypes;
private static Type[] m_ShieldTypes = {
typeof( BronzeShield ), typeof( Buckler ), typeof( HeaterShield ),
typeof( MetalShield ), typeof( MetalKiteShield ), typeof( WoodenKiteShield ),
typeof( WoodenShield )
};
public static Type[] ShieldTypes => m_ShieldTypes;
private static Type[] m_GemTypes = {
typeof( Amber ), typeof( Amethyst ), typeof( Citrine ),
typeof( Diamond ), typeof( Emerald ), typeof( Ruby ),
typeof( Sapphire ), typeof( StarSapphire ), typeof( Tourmaline )
};
public static Type[] GemTypes => m_GemTypes;
private static Type[] m_JewelryTypes = {
typeof( GoldRing ), typeof( GoldBracelet ),
typeof( SilverRing ), typeof( SilverBracelet )
};
public static Type[] JewelryTypes => m_JewelryTypes;
private static Type[] m_RegTypes = {
typeof( BlackPearl ), typeof( Bloodmoss ), typeof( Garlic ),
typeof( Ginseng ), typeof( MandrakeRoot ), typeof( Nightshade ),
typeof( SulfurousAsh ), typeof( SpidersSilk )
};
public static Type[] RegTypes => m_RegTypes;
private static Type[] m_NecroRegTypes = {
typeof( BatWing ), typeof( GraveDust ), typeof( DaemonBlood ),
typeof( NoxCrystal ), typeof( PigIron )
};
public static Type[] NecroRegTypes => m_NecroRegTypes;
private static Type[] m_PotionTypes = {
typeof( AgilityPotion ), typeof( StrengthPotion ), typeof( RefreshPotion ),
typeof( LesserCurePotion ), typeof( LesserHealPotion ), typeof( LesserPoisonPotion )
};
public static Type[] PotionTypes => m_PotionTypes;
private static Type[] m_SEInstrumentTypes = {
typeof( BambooFlute )
};
public static Type[] SEInstrumentTypes => m_SEInstrumentTypes;
private static Type[] m_InstrumentTypes = {
typeof( Drums ), typeof( Harp ), typeof( LapHarp ),
typeof( Lute ), typeof( Tambourine ), typeof( TambourineTassel )
};
public static Type[] InstrumentTypes => m_InstrumentTypes;
private static Type[] m_StatueTypes = {
public static Type[] StatueTypes { get; } =
{
typeof( StatueSouth ), typeof( StatueSouth2 ), typeof( StatueNorth ),
typeof( StatueWest ), typeof( StatueEast ), typeof( StatueEast2 ),
typeof( StatueSouthEast ), typeof( BustSouth ), typeof( BustEast )
};
public static Type[] StatueTypes => m_StatueTypes;
#region Mondain's Legacy
private static Type[] m_RegularScrollTypes = {
typeof( ReactiveArmorScroll ), typeof( ClumsyScroll ), typeof( CreateFoodScroll ), typeof( FeeblemindScroll ),
typeof( HealScroll ), typeof( MagicArrowScroll ), typeof( NightSightScroll ), typeof( WeakenScroll ),
typeof( AgilityScroll ), typeof( CunningScroll ), typeof( CureScroll ), typeof( HarmScroll ),
typeof( MagicTrapScroll ), typeof( MagicUnTrapScroll ), typeof( ProtectionScroll ), typeof( StrengthScroll ),
typeof( BlessScroll ), typeof( FireballScroll ), typeof( MagicLockScroll ), typeof( PoisonScroll ),
typeof( TelekinisisScroll ), typeof( TeleportScroll ), typeof( UnlockScroll ), typeof( WallOfStoneScroll ),
typeof( ArchCureScroll ), typeof( ArchProtectionScroll ), typeof( CurseScroll ), typeof( FireFieldScroll ),
typeof( GreaterHealScroll ), typeof( LightningScroll ), typeof( ManaDrainScroll ), typeof( RecallScroll ),
typeof( BladeSpiritsScroll ), typeof( DispelFieldScroll ), typeof( IncognitoScroll ), typeof( MagicReflectScroll ),
typeof( MindBlastScroll ), typeof( ParalyzeScroll ), typeof( PoisonFieldScroll ), typeof( SummonCreatureScroll ),
typeof( DispelScroll ), typeof( EnergyBoltScroll ), typeof( ExplosionScroll ), typeof( InvisibilityScroll ),
typeof( MarkScroll ), typeof( MassCurseScroll ), typeof( ParalyzeFieldScroll ), typeof( RevealScroll ),
typeof( ChainLightningScroll ), typeof( EnergyFieldScroll ), typeof( FlamestrikeScroll ), typeof( GateTravelScroll ),
typeof( ManaVampireScroll ), typeof( MassDispelScroll ), typeof( MeteorSwarmScroll ), typeof( PolymorphScroll ),
typeof( EarthquakeScroll ), typeof( EnergyVortexScroll ), typeof( ResurrectionScroll ), typeof( SummonAirElementalScroll ),
typeof( SummonDaemonScroll ), typeof( SummonEarthElementalScroll ), typeof( SummonFireElementalScroll ), typeof( SummonWaterElementalScroll )
};
#endregion
private static Type[] m_NecromancyScrollTypes = {
typeof( AnimateDeadScroll ), typeof( BloodOathScroll ), typeof( CorpseSkinScroll ), typeof( CurseWeaponScroll ),
typeof( EvilOmenScroll ), typeof( HorrificBeastScroll ), typeof( LichFormScroll ), typeof( MindRotScroll ),
typeof( PainSpikeScroll ), typeof( PoisonStrikeScroll ), typeof( StrangleScroll ), typeof( SummonFamiliarScroll ),
typeof( VampiricEmbraceScroll ), typeof( VengefulSpiritScroll ), typeof( WitherScroll ), typeof( WraithFormScroll )
};
private static Type[] m_SENecromancyScrollTypes = {
public static Type[] RegularScrollTypes { get; } =
{
typeof( ReactiveArmorScroll ), typeof( ClumsyScroll ), typeof( CreateFoodScroll ), typeof( FeeblemindScroll ),
typeof( HealScroll ), typeof( MagicArrowScroll ), typeof( NightSightScroll ), typeof( WeakenScroll ),
typeof( AgilityScroll ), typeof( CunningScroll ), typeof( CureScroll ), typeof( HarmScroll ),
typeof( MagicTrapScroll ), typeof( MagicUnTrapScroll ), typeof( ProtectionScroll ), typeof( StrengthScroll ),
typeof( BlessScroll ), typeof( FireballScroll ), typeof( MagicLockScroll ), typeof( PoisonScroll ),
typeof( TelekinisisScroll ), typeof( TeleportScroll ), typeof( UnlockScroll ), typeof( WallOfStoneScroll ),
typeof( ArchCureScroll ), typeof( ArchProtectionScroll ), typeof( CurseScroll ), typeof( FireFieldScroll ),
typeof( GreaterHealScroll ), typeof( LightningScroll ), typeof( ManaDrainScroll ), typeof( RecallScroll ),
typeof( BladeSpiritsScroll ), typeof( DispelFieldScroll ), typeof( IncognitoScroll ), typeof( MagicReflectScroll ),
typeof( MindBlastScroll ), typeof( ParalyzeScroll ), typeof( PoisonFieldScroll ), typeof( SummonCreatureScroll ),
typeof( DispelScroll ), typeof( EnergyBoltScroll ), typeof( ExplosionScroll ), typeof( InvisibilityScroll ),
typeof( MarkScroll ), typeof( MassCurseScroll ), typeof( ParalyzeFieldScroll ), typeof( RevealScroll ),
typeof( ChainLightningScroll ), typeof( EnergyFieldScroll ), typeof( FlamestrikeScroll ), typeof( GateTravelScroll ),
typeof( ManaVampireScroll ), typeof( MassDispelScroll ), typeof( MeteorSwarmScroll ), typeof( PolymorphScroll ),
typeof( EarthquakeScroll ), typeof( EnergyVortexScroll ), typeof( ResurrectionScroll ), typeof( SummonAirElementalScroll ),
typeof( SummonDaemonScroll ), typeof( SummonEarthElementalScroll ), typeof( SummonFireElementalScroll ), typeof( SummonWaterElementalScroll )
};
public static Type[] NecromancyScrollTypes { get; } =
{
typeof( AnimateDeadScroll ), typeof( BloodOathScroll ), typeof( CorpseSkinScroll ), typeof( CurseWeaponScroll ),
typeof( EvilOmenScroll ), typeof( HorrificBeastScroll ), typeof( LichFormScroll ), typeof( MindRotScroll ),
typeof( PainSpikeScroll ), typeof( PoisonStrikeScroll ), typeof( StrangleScroll ), typeof( SummonFamiliarScroll ),
typeof( VampiricEmbraceScroll ), typeof( VengefulSpiritScroll ), typeof( WitherScroll ), typeof( WraithFormScroll )
};
public static Type[] SENecromancyScrollTypes { get; } =
{
typeof( AnimateDeadScroll ), typeof( BloodOathScroll ), typeof( CorpseSkinScroll ), typeof( CurseWeaponScroll ),
typeof( EvilOmenScroll ), typeof( HorrificBeastScroll ), typeof( LichFormScroll ), typeof( MindRotScroll ),
typeof( PainSpikeScroll ), typeof( PoisonStrikeScroll ), typeof( StrangleScroll ), typeof( SummonFamiliarScroll ),
@ -238,43 +224,34 @@ namespace Server
typeof( ExorcismScroll )
};
private static Type[] m_PaladinScrollTypes = new Type[0];
public static Type[] PaladinScrollTypes { get; } = new Type[0];
#region Mondain's Legacy
private static Type[] m_ArcanistScrollTypes = {
public static Type[] ArcanistScrollTypes { get; } =
{
typeof( ArcaneCircleScroll ), typeof( GiftOfRenewalScroll ), typeof( ImmolatingWeaponScroll ), typeof( AttuneWeaponScroll ),
typeof( ThunderstormScroll ), typeof( NatureFuryScroll ), /*typeof( SummonFeyScroll ), typeof( SummonFiendScroll ),*/
typeof( ReaperFormScroll ), typeof( WildfireScroll ), typeof( EssenceOfWindScroll ), typeof( DryadAllureScroll ),
typeof( EtherealVoyageScroll ), typeof( WordOfDeathScroll ), typeof( GiftOfLifeScroll ), typeof( ArcaneEmpowermentScroll )
};
#endregion
public static Type[] RegularScrollTypes => m_RegularScrollTypes;
public static Type[] NecromancyScrollTypes => m_NecromancyScrollTypes;
public static Type[] SENecromancyScrollTypes => m_SENecromancyScrollTypes;
public static Type[] PaladinScrollTypes => m_PaladinScrollTypes;
#region Mondain's Legacy
public static Type[] ArcanistScrollTypes => m_ArcanistScrollTypes;
#endregion
private static Type[] m_GrimmochJournalTypes = {
public static Type[] GrimmochJournalTypes { get; } =
{
typeof( GrimmochJournal1 ), typeof( GrimmochJournal2 ), typeof( GrimmochJournal3 ),
typeof( GrimmochJournal6 ), typeof( GrimmochJournal7 ), typeof( GrimmochJournal11 ),
typeof( GrimmochJournal14 ), typeof( GrimmochJournal17 ), typeof( GrimmochJournal23 )
};
public static Type[] GrimmochJournalTypes => m_GrimmochJournalTypes;
private static Type[] m_LysanderNotebookTypes = {
public static Type[] LysanderNotebookTypes { get; } =
{
typeof( LysanderNotebook1 ), typeof( LysanderNotebook2 ), typeof( LysanderNotebook3 ),
typeof( LysanderNotebook7 ), typeof( LysanderNotebook8 ), typeof( LysanderNotebook11 )
};
public static Type[] LysanderNotebookTypes => m_LysanderNotebookTypes;
private static Type[] m_TavarasJournalTypes = {
public static Type[] TavarasJournalTypes { get; } =
{
typeof( TavarasJournal1 ), typeof( TavarasJournal2 ), typeof( TavarasJournal3 ),
typeof( TavarasJournal6 ), typeof( TavarasJournal7 ), typeof( TavarasJournal8 ),
typeof( TavarasJournal9 ), typeof( TavarasJournal11 ), typeof( TavarasJournal14 ),
@ -282,93 +259,85 @@ namespace Server
typeof( TavarasJournal19 )
};
public static Type[] TavarasJournalTypes => m_TavarasJournalTypes;
private static Type[] m_NewWandTypes = {
typeof( FireballWand ), typeof( LightningWand ), typeof( MagicArrowWand ),
typeof( GreaterHealWand ), typeof( HarmWand ), typeof( HealWand )
};
public static Type[] NewWandTypes => m_NewWandTypes;
private static Type[] m_WandTypes = {
typeof( ClumsyWand ), typeof( FeebleWand ),
typeof( ManaDrainWand ), typeof( WeaknessWand )
};
public static Type[] WandTypes => m_WandTypes;
private static Type[] m_OldWandTypes = {
typeof( IDWand )
};
public static Type[] OldWandTypes => m_OldWandTypes;
private static Type[] m_SEClothingTypes = {
typeof( ClothNinjaJacket ), typeof( FemaleKimono ), typeof( Hakama ),
typeof( HakamaShita ), typeof( JinBaori ), typeof( Kamishimo ),
typeof( MaleKimono ), typeof( NinjaTabi ), typeof( Obi ),
typeof( SamuraiTabi ), typeof( TattsukeHakama ), typeof( Waraji )
};
public static Type[] SEClothingTypes => m_SEClothingTypes;
private static Type[] m_AosClothingTypes = {
typeof( FurSarong ), typeof( FurCape ), typeof( FlowerGarland ),
typeof( GildedDress ), typeof( FurBoots ), typeof( FormalShirt ),
public static Type[] NewWandTypes { get; } =
{
typeof( FireballWand ), typeof( LightningWand ), typeof( MagicArrowWand ),
typeof( GreaterHealWand ), typeof( HarmWand ), typeof( HealWand )
};
public static Type[] AosClothingTypes => m_AosClothingTypes;
public static Type[] WandTypes { get; } =
{
typeof( ClumsyWand ), typeof( FeebleWand ),
typeof( ManaDrainWand ), typeof( WeaknessWand )
};
private static Type[] m_ClothingTypes = {
typeof( Cloak ),
typeof( Bonnet ), typeof( Cap ), typeof( FeatheredHat ),
typeof( FloppyHat ), typeof( JesterHat ), typeof( Surcoat ),
typeof( SkullCap ), typeof( StrawHat ), typeof( TallStrawHat ),
typeof( TricorneHat ), typeof( WideBrimHat ), typeof( WizardsHat ),
typeof( BodySash ), typeof( Doublet ), typeof( Boots ),
typeof( FullApron ), typeof( JesterSuit ), typeof( Sandals ),
typeof( Tunic ), typeof( Shoes ), typeof( Shirt ),
typeof( Kilt ), typeof( Skirt ), typeof( FancyShirt ),
typeof( FancyDress ), typeof( ThighBoots ), typeof( LongPants ),
typeof( PlainDress ), typeof( Robe ), typeof( ShortPants ),
typeof( HalfApron )
};
public static Type[] ClothingTypes => m_ClothingTypes;
public static Type[] OldWandTypes { get; } =
{
typeof( IDWand )
};
private static Type[] m_SEHatTypes = {
typeof( ClothNinjaHood ), typeof( Kasa )
};
public static Type[] SEClothingTypes { get; } =
{
typeof( ClothNinjaJacket ), typeof( FemaleKimono ), typeof( Hakama ),
typeof( HakamaShita ), typeof( JinBaori ), typeof( Kamishimo ),
typeof( MaleKimono ), typeof( NinjaTabi ), typeof( Obi ),
typeof( SamuraiTabi ), typeof( TattsukeHakama ), typeof( Waraji )
};
public static Type[] SEHatTypes => m_SEHatTypes;
public static Type[] AosClothingTypes { get; } =
{
typeof( FurSarong ), typeof( FurCape ), typeof( FlowerGarland ),
typeof( GildedDress ), typeof( FurBoots ), typeof( FormalShirt ),
};
private static Type[] m_AosHatTypes = {
typeof( FlowerGarland ), typeof( BearMask ), typeof( DeerMask ) //Are Bear& Deer mask inside the Pre-AoS loottables too?
};
public static Type[] ClothingTypes { get; } =
{
typeof( Cloak ),
typeof( Bonnet ), typeof( Cap ), typeof( FeatheredHat ),
typeof( FloppyHat ), typeof( JesterHat ), typeof( Surcoat ),
typeof( SkullCap ), typeof( StrawHat ), typeof( TallStrawHat ),
typeof( TricorneHat ), typeof( WideBrimHat ), typeof( WizardsHat ),
typeof( BodySash ), typeof( Doublet ), typeof( Boots ),
typeof( FullApron ), typeof( JesterSuit ), typeof( Sandals ),
typeof( Tunic ), typeof( Shoes ), typeof( Shirt ),
typeof( Kilt ), typeof( Skirt ), typeof( FancyShirt ),
typeof( FancyDress ), typeof( ThighBoots ), typeof( LongPants ),
typeof( PlainDress ), typeof( Robe ), typeof( ShortPants ),
typeof( HalfApron )
};
public static Type[] AosHatTypes => m_AosHatTypes;
public static Type[] SEHatTypes { get; } =
{
typeof( ClothNinjaHood ), typeof( Kasa )
};
private static Type[] m_HatTypes = {
typeof( SkullCap ), typeof( Bandana ), typeof( FloppyHat ),
typeof( Cap ), typeof( WideBrimHat ), typeof( StrawHat ),
typeof( TallStrawHat ), typeof( WizardsHat ), typeof( Bonnet ),
typeof( FeatheredHat ), typeof( TricorneHat ), typeof( JesterHat )
};
public static Type[] AosHatTypes { get; } =
{
typeof( FlowerGarland ), typeof( BearMask ), typeof( DeerMask ) //Are Bear& Deer mask inside the Pre-AoS loottables too?
};
public static Type[] HatTypes => m_HatTypes;
public static Type[] HatTypes { get; } =
{
typeof( SkullCap ), typeof( Bandana ), typeof( FloppyHat ),
typeof( Cap ), typeof( WideBrimHat ), typeof( StrawHat ),
typeof( TallStrawHat ), typeof( WizardsHat ), typeof( Bonnet ),
typeof( FeatheredHat ), typeof( TricorneHat ), typeof( JesterHat )
};
private static Type[] m_LibraryBookTypes = {
typeof( GrammarOfOrcish ), typeof( CallToAnarchy ), typeof( ArmsAndWeaponsPrimer ),
typeof( SongOfSamlethe ), typeof( TaleOfThreeTribes ), typeof( GuideToGuilds ),
typeof( BirdsOfBritannia ), typeof( BritannianFlora ), typeof( ChildrenTalesVol2 ),
typeof( TalesOfVesperVol1 ), typeof( DeceitDungeonOfHorror ), typeof( DimensionalTravel ),
typeof( EthicalHedonism ), typeof( MyStory ), typeof( DiversityOfOurLand ),
typeof( QuestOfVirtues ), typeof( RegardingLlamas ), typeof( TalkingToWisps ),
typeof( TamingDragons ), typeof( BoldStranger ), typeof( BurningOfTrinsic ),
typeof( TheFight ), typeof( LifeOfATravellingMinstrel ), typeof( MajorTradeAssociation ),
typeof( RankingsOfTrades ), typeof( WildGirlOfTheForest ), typeof( TreatiseOnAlchemy ),
typeof( VirtueBook )
};
public static Type[] LibraryBookTypes => m_LibraryBookTypes;
public static Type[] LibraryBookTypes { get; } =
{
typeof( GrammarOfOrcish ), typeof( CallToAnarchy ), typeof( ArmsAndWeaponsPrimer ),
typeof( SongOfSamlethe ), typeof( TaleOfThreeTribes ), typeof( GuideToGuilds ),
typeof( BirdsOfBritannia ), typeof( BritannianFlora ), typeof( ChildrenTalesVol2 ),
typeof( TalesOfVesperVol1 ), typeof( DeceitDungeonOfHorror ), typeof( DimensionalTravel ),
typeof( EthicalHedonism ), typeof( MyStory ), typeof( DiversityOfOurLand ),
typeof( QuestOfVirtues ), typeof( RegardingLlamas ), typeof( TalkingToWisps ),
typeof( TamingDragons ), typeof( BoldStranger ), typeof( BurningOfTrinsic ),
typeof( TheFight ), typeof( LifeOfATravellingMinstrel ), typeof( MajorTradeAssociation ),
typeof( RankingsOfTrades ), typeof( WildGirlOfTheForest ), typeof( TreatiseOnAlchemy ),
typeof( VirtueBook )
};
#endregion
@ -377,10 +346,10 @@ namespace Server
public static BaseWand RandomWand()
{
if ( Core.ML )
return Construct( m_NewWandTypes ) as BaseWand;
return Construct( NewWandTypes ) as BaseWand;
if ( Core.AOS )
return Construct( m_WandTypes, m_NewWandTypes ) as BaseWand;
return Construct( m_OldWandTypes, m_WandTypes, m_NewWandTypes ) as BaseWand;
return Construct( WandTypes, NewWandTypes ) as BaseWand;
return Construct( OldWandTypes, WandTypes, NewWandTypes ) as BaseWand;
}
public static BaseClothing RandomClothing()
@ -392,16 +361,16 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLClothingTypes, m_AosClothingTypes, m_ClothingTypes ) as BaseClothing;
return Construct( MLClothingTypes, AosClothingTypes, ClothingTypes ) as BaseClothing;
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEClothingTypes, m_AosClothingTypes, m_ClothingTypes ) as BaseClothing;
return Construct( SEClothingTypes, AosClothingTypes, ClothingTypes ) as BaseClothing;
if ( Core.AOS )
return Construct( m_AosClothingTypes, m_ClothingTypes ) as BaseClothing;
return Construct( AosClothingTypes, ClothingTypes ) as BaseClothing;
return Construct( m_ClothingTypes ) as BaseClothing;
return Construct( ClothingTypes ) as BaseClothing;
}
public static BaseWeapon RandomRangedWeapon()
@ -413,16 +382,16 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLRangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes ) as BaseWeapon;
return Construct( MLRangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes ) as BaseWeapon;
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SERangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes ) as BaseWeapon;
return Construct( SERangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes ) as BaseWeapon;
if ( Core.AOS )
return Construct( m_AosRangedWeaponTypes, m_RangedWeaponTypes ) as BaseWeapon;
return Construct( AosRangedWeaponTypes, RangedWeaponTypes ) as BaseWeapon;
return Construct( m_RangedWeaponTypes ) as BaseWeapon;
return Construct( RangedWeaponTypes ) as BaseWeapon;
}
public static BaseWeapon RandomWeapon()
@ -434,16 +403,16 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLWeaponTypes, m_AosWeaponTypes, m_WeaponTypes ) as BaseWeapon;
return Construct( MLWeaponTypes, AosWeaponTypes, WeaponTypes ) as BaseWeapon;
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEWeaponTypes, m_AosWeaponTypes, m_WeaponTypes ) as BaseWeapon;
return Construct( SEWeaponTypes, AosWeaponTypes, WeaponTypes ) as BaseWeapon;
if ( Core.AOS )
return Construct( m_AosWeaponTypes, m_WeaponTypes ) as BaseWeapon;
return Construct( AosWeaponTypes, WeaponTypes ) as BaseWeapon;
return Construct( m_WeaponTypes ) as BaseWeapon;
return Construct( WeaponTypes ) as BaseWeapon;
}
public static Item RandomWeaponOrJewelry()
@ -455,21 +424,21 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_JewelryTypes );
return Construct( MLWeaponTypes, AosWeaponTypes, WeaponTypes, JewelryTypes );
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_JewelryTypes );
return Construct( SEWeaponTypes, AosWeaponTypes, WeaponTypes, JewelryTypes );
if ( Core.AOS )
return Construct( m_AosWeaponTypes, m_WeaponTypes, m_JewelryTypes );
return Construct( AosWeaponTypes, WeaponTypes, JewelryTypes );
return Construct( m_WeaponTypes, m_JewelryTypes );
return Construct( WeaponTypes, JewelryTypes );
}
public static BaseJewel RandomJewelry()
{
return Construct( m_JewelryTypes ) as BaseJewel;
return Construct( JewelryTypes ) as BaseJewel;
}
public static BaseArmor RandomArmor()
@ -481,13 +450,13 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLArmorTypes, m_ArmorTypes ) as BaseArmor;
return Construct( MLArmorTypes, ArmorTypes ) as BaseArmor;
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEArmorTypes, m_ArmorTypes ) as BaseArmor;
return Construct( SEArmorTypes, ArmorTypes ) as BaseArmor;
return Construct( m_ArmorTypes ) as BaseArmor;
return Construct( ArmorTypes ) as BaseArmor;
}
public static BaseHat RandomHat()
@ -498,12 +467,12 @@ namespace Server
public static BaseHat RandomHat( bool inTokuno )
{
if ( Core.SE && inTokuno )
return Construct( m_SEHatTypes, m_AosHatTypes, m_HatTypes ) as BaseHat;
return Construct( SEHatTypes, AosHatTypes, HatTypes ) as BaseHat;
if ( Core.AOS )
return Construct( m_AosHatTypes, m_HatTypes ) as BaseHat;
return Construct( AosHatTypes, HatTypes ) as BaseHat;
return Construct( m_HatTypes ) as BaseHat;
return Construct( HatTypes ) as BaseHat;
}
public static Item RandomArmorOrHat()
@ -515,24 +484,24 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLArmorTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes );
return Construct( MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes );
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEArmorTypes, m_ArmorTypes, m_SEHatTypes, m_AosHatTypes, m_HatTypes );
return Construct( SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes );
if ( Core.AOS )
return Construct( m_ArmorTypes, m_AosHatTypes, m_HatTypes );
return Construct( ArmorTypes, AosHatTypes, HatTypes );
return Construct( m_ArmorTypes, m_HatTypes );
return Construct( ArmorTypes, HatTypes );
}
public static BaseShield RandomShield()
{
if ( Core.AOS )
return Construct( m_AosShieldTypes, m_ShieldTypes ) as BaseShield;
return Construct( AosShieldTypes, ShieldTypes ) as BaseShield;
return Construct( m_ShieldTypes ) as BaseShield;
return Construct( ShieldTypes ) as BaseShield;
}
public static BaseArmor RandomArmorOrShield()
@ -544,16 +513,16 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLArmorTypes, m_ArmorTypes, m_AosShieldTypes, m_ShieldTypes ) as BaseArmor;
return Construct( MLArmorTypes, ArmorTypes, AosShieldTypes, ShieldTypes ) as BaseArmor;
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEArmorTypes, m_ArmorTypes, m_AosShieldTypes, m_ShieldTypes ) as BaseArmor;
return Construct( SEArmorTypes, ArmorTypes, AosShieldTypes, ShieldTypes ) as BaseArmor;
if ( Core.AOS )
return Construct( m_ArmorTypes, m_AosShieldTypes, m_ShieldTypes ) as BaseArmor;
return Construct( ArmorTypes, AosShieldTypes, ShieldTypes ) as BaseArmor;
return Construct( m_ArmorTypes, m_ShieldTypes ) as BaseArmor;
return Construct( ArmorTypes, ShieldTypes ) as BaseArmor;
}
public static Item RandomArmorOrShieldOrJewelry()
@ -565,16 +534,16 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLArmorTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes );
return Construct( MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes );
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEArmorTypes, m_ArmorTypes, m_SEHatTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes );
return Construct( SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes );
if ( Core.AOS )
return Construct( m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes );
return Construct( ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes );
return Construct( m_ArmorTypes, m_HatTypes, m_ShieldTypes, m_JewelryTypes );
return Construct( ArmorTypes, HatTypes, ShieldTypes, JewelryTypes );
}
public static Item RandomArmorOrShieldOrWeapon()
@ -586,16 +555,16 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_MLRangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_MLArmorTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes );
return Construct( MLWeaponTypes, AosWeaponTypes, WeaponTypes, MLRangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes );
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_SERangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_SEArmorTypes, m_ArmorTypes, m_SEHatTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes );
return Construct( SEWeaponTypes, AosWeaponTypes, WeaponTypes, SERangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes );
if ( Core.AOS )
return Construct( m_AosWeaponTypes, m_WeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes );
return Construct( AosWeaponTypes, WeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes );
return Construct( m_WeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_HatTypes, m_ShieldTypes );
return Construct( WeaponTypes, RangedWeaponTypes, ArmorTypes, HatTypes, ShieldTypes );
}
public static Item RandomArmorOrShieldOrWeaponOrJewelry()
@ -607,64 +576,64 @@ namespace Server
{
#region Mondain's Legacy
if ( Core.ML && isMondain )
return Construct( m_MLWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_MLRangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_MLArmorTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes );
return Construct( MLWeaponTypes, AosWeaponTypes, WeaponTypes, MLRangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes );
#endregion
if ( Core.SE && inTokuno )
return Construct( m_SEWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_SERangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_SEArmorTypes, m_ArmorTypes, m_SEHatTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes );
return Construct( SEWeaponTypes, AosWeaponTypes, WeaponTypes, SERangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes );
if ( Core.AOS )
return Construct( m_AosWeaponTypes, m_WeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes );
return Construct( AosWeaponTypes, WeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes );
return Construct( m_WeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_HatTypes, m_ShieldTypes, m_JewelryTypes );
return Construct( WeaponTypes, RangedWeaponTypes, ArmorTypes, HatTypes, ShieldTypes, JewelryTypes );
}
#region Chest of Heirlooms
public static Item ChestOfHeirloomsContains()
{
return Construct( m_SEArmorTypes, m_SEHatTypes, m_SEWeaponTypes, m_SERangedWeaponTypes, m_JewelryTypes );
return Construct( SEArmorTypes, SEHatTypes, SEWeaponTypes, SERangedWeaponTypes, JewelryTypes );
}
#endregion
public static Item RandomGem()
{
return Construct( m_GemTypes );
return Construct( GemTypes );
}
public static Item RandomReagent()
{
return Construct( m_RegTypes );
return Construct( RegTypes );
}
public static Item RandomNecromancyReagent()
{
return Construct( m_NecroRegTypes );
return Construct( NecroRegTypes );
}
public static Item RandomPossibleReagent()
{
if ( Core.AOS )
return Construct( m_RegTypes, m_NecroRegTypes );
return Construct( RegTypes, NecroRegTypes );
return Construct( m_RegTypes );
return Construct( RegTypes );
}
public static Item RandomPotion()
{
return Construct( m_PotionTypes );
return Construct( PotionTypes );
}
public static BaseInstrument RandomInstrument()
{
if ( Core.SE )
return Construct( m_InstrumentTypes, m_SEInstrumentTypes ) as BaseInstrument;
return Construct( InstrumentTypes, SEInstrumentTypes ) as BaseInstrument;
return Construct( m_InstrumentTypes ) as BaseInstrument;
return Construct( InstrumentTypes ) as BaseInstrument;
}
public static Item RandomStatue()
{
return Construct( m_StatueTypes );
return Construct( StatueTypes );
}
public static SpellScroll RandomScroll( int minIndex, int maxIndex, SpellbookType type )
@ -674,10 +643,10 @@ namespace Server
switch ( type )
{
default:
case SpellbookType.Regular: types = m_RegularScrollTypes; break;
case SpellbookType.Necromancer: types = (Core.SE ? m_SENecromancyScrollTypes : m_NecromancyScrollTypes ); break;
case SpellbookType.Paladin: types = m_PaladinScrollTypes; break;
case SpellbookType.Arcanist: types = m_ArcanistScrollTypes; break;
case SpellbookType.Regular: types = RegularScrollTypes; break;
case SpellbookType.Necromancer: types = (Core.SE ? SENecromancyScrollTypes : NecromancyScrollTypes ); break;
case SpellbookType.Paladin: types = PaladinScrollTypes; break;
case SpellbookType.Arcanist: types = ArcanistScrollTypes; break;
}
return Construct( types, Utility.RandomMinMax( minIndex, maxIndex ) ) as SpellScroll;
@ -685,22 +654,22 @@ namespace Server
public static BaseBook RandomGrimmochJournal()
{
return Construct( m_GrimmochJournalTypes ) as BaseBook;
return Construct( GrimmochJournalTypes ) as BaseBook;
}
public static BaseBook RandomLysanderNotebook()
{
return Construct( m_LysanderNotebookTypes ) as BaseBook;
return Construct( LysanderNotebookTypes ) as BaseBook;
}
public static BaseBook RandomTavarasJournal()
{
return Construct( m_TavarasJournalTypes ) as BaseBook;
return Construct( TavarasJournalTypes ) as BaseBook;
}
public static BaseBook RandomLibraryBook()
{
return Construct( m_LibraryBookTypes ) as BaseBook;
return Construct( LibraryBookTypes ) as BaseBook;
}
public static BaseTalisman RandomTalisman()

View file

@ -500,50 +500,19 @@ namespace Server
public class LootPackEntry
{
private int m_Chance;
private LootPackDice m_Quantity;
private int m_MaxProps, m_MinIntensity, m_MaxIntensity;
private bool m_AtSpawnTime;
private LootPackItem[] m_Items;
public int Chance { get; set; }
public int Chance
{
get => m_Chance;
set => m_Chance = value;
}
public LootPackDice Quantity { get; set; }
public LootPackDice Quantity
{
get => m_Quantity;
set => m_Quantity = value;
}
public int MaxProps { get; set; }
public int MaxProps
{
get => m_MaxProps;
set => m_MaxProps = value;
}
public int MinIntensity { get; set; }
public int MinIntensity
{
get => m_MinIntensity;
set => m_MinIntensity = value;
}
public int MaxIntensity { get; set; }
public int MaxIntensity
{
get => m_MaxIntensity;
set => m_MaxIntensity = value;
}
public LootPackItem[] Items
{
get => m_Items;
set => m_Items = value;
}
public LootPackItem[] Items { get; set; }
private static bool IsInTokuno( Mobile m )
{
@ -570,14 +539,14 @@ namespace Server
int totalChance = 0;
for ( int i = 0; i < m_Items.Length; ++i )
totalChance += m_Items[i].Chance;
for ( int i = 0; i < Items.Length; ++i )
totalChance += Items[i].Chance;
int rnd = Utility.Random( totalChance );
for ( int i = 0; i < m_Items.Length; ++i )
for ( int i = 0; i < Items.Length; ++i )
{
LootPackItem item = m_Items[i];
LootPackItem item = Items[i];
if ( rnd < item.Chance )
return Mutate( from, luckChance, item.Construct( IsInTokuno( from ), IsMondain( from ) ) );
@ -590,7 +559,7 @@ namespace Server
private int GetRandomOldBonus()
{
int rnd = Utility.RandomMinMax( m_MinIntensity, m_MaxIntensity );
int rnd = Utility.RandomMinMax( MinIntensity, MaxIntensity );
if ( 50 > rnd )
return 1;
@ -626,26 +595,26 @@ namespace Server
if ( Core.AOS )
{
int bonusProps = GetBonusProperties();
int min = m_MinIntensity;
int max = m_MaxIntensity;
int min = MinIntensity;
int max = MaxIntensity;
if ( bonusProps < m_MaxProps && LootPack.CheckLuck( luckChance ) )
if ( bonusProps < MaxProps && LootPack.CheckLuck( luckChance ) )
++bonusProps;
int props = 1 + bonusProps;
// Make sure we're not spawning items with 6 properties.
if ( props > m_MaxProps )
props = m_MaxProps;
if ( props > MaxProps )
props = MaxProps;
if ( item is BaseWeapon weapon )
BaseRunicTool.ApplyAttributesTo( weapon, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
BaseRunicTool.ApplyAttributesTo( weapon, false, luckChance, props, MinIntensity, MaxIntensity );
else if ( item is BaseArmor armor )
BaseRunicTool.ApplyAttributesTo( armor, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
BaseRunicTool.ApplyAttributesTo( armor, false, luckChance, props, MinIntensity, MaxIntensity );
else if ( item is BaseJewel jewel )
BaseRunicTool.ApplyAttributesTo( jewel, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
BaseRunicTool.ApplyAttributesTo( jewel, false, luckChance, props, MinIntensity, MaxIntensity );
else
BaseRunicTool.ApplyAttributesTo( (BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
BaseRunicTool.ApplyAttributesTo( (BaseHat)item, false, luckChance, props, MinIntensity, MaxIntensity );
}
else // not aos
{
@ -696,7 +665,7 @@ namespace Server
}
if ( item.Stackable )
item.Amount = m_Quantity.Roll();
item.Amount = Quantity.Roll();
}
return item;
@ -721,19 +690,19 @@ namespace Server
public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, LootPackDice quantity, int maxProps, int minIntensity, int maxIntensity )
{
m_AtSpawnTime = atSpawnTime;
m_Items = items;
m_Chance = (int)(100 * chance);
m_Quantity = quantity;
m_MaxProps = maxProps;
m_MinIntensity = minIntensity;
m_MaxIntensity = maxIntensity;
Items = items;
Chance = (int)(100 * chance);
Quantity = quantity;
MaxProps = maxProps;
MinIntensity = minIntensity;
MaxIntensity = maxIntensity;
}
public int GetBonusProperties()
{
int p0=0, p1=0, p2=0, p3=0, p4=0, p5=0;
switch ( m_MaxProps )
switch ( MaxProps )
{
case 1: p0= 3; p1= 1; break;
case 2: p0= 6; p1= 3; p2= 1; break;
@ -770,20 +739,9 @@ namespace Server
public class LootPackItem
{
private Type m_Type;
private int m_Chance;
public Type Type { get; set; }
public Type Type
{
get => m_Type;
set => m_Type = value;
}
public int Chance
{
get => m_Chance;
set => m_Chance = value;
}
public int Chance { get; set; }
private static Type[] m_BlankTypes = { typeof( BlankScroll ) };
private static Type[][] m_NecroTypes = {
@ -841,28 +799,28 @@ namespace Server
{
Item item;
if ( m_Type == typeof( BaseRanged ) )
if ( Type == typeof( BaseRanged ) )
item = Loot.RandomRangedWeapon( inTokuno, isMondain );
else if ( m_Type == typeof( BaseWeapon ) )
else if ( Type == typeof( BaseWeapon ) )
item = Loot.RandomWeapon( inTokuno, isMondain );
else if ( m_Type == typeof( BaseArmor ) )
else if ( Type == typeof( BaseArmor ) )
item = Loot.RandomArmorOrHat( inTokuno, isMondain );
else if ( m_Type == typeof( BaseShield ) )
else if ( Type == typeof( BaseShield ) )
item = Loot.RandomShield();
else if ( m_Type == typeof( BaseJewel ) )
else if ( Type == typeof( BaseJewel ) )
item = Core.AOS ? Loot.RandomJewelry() : Loot.RandomArmorOrShieldOrWeapon();
else if ( m_Type == typeof( BaseInstrument ) )
else if ( Type == typeof( BaseInstrument ) )
item = Loot.RandomInstrument();
else if ( m_Type == typeof( Amber ) ) // gem
else if ( Type == typeof( Amber ) ) // gem
item = Loot.RandomGem();
else if ( m_Type == typeof( ClumsyScroll ) ) // low scroll
else if ( Type == typeof( ClumsyScroll ) ) // low scroll
item = RandomScroll( 0, 1, 3 );
else if ( m_Type == typeof( ArchCureScroll ) ) // med scroll
else if ( Type == typeof( ArchCureScroll ) ) // med scroll
item = RandomScroll( 1, 4, 7 );
else if ( m_Type == typeof( SummonAirElementalScroll ) ) // high scroll
else if ( Type == typeof( SummonAirElementalScroll ) ) // high scroll
item = RandomScroll( 2, 8, 8 );
else
item = Activator.CreateInstance( m_Type ) as Item;
item = Activator.CreateInstance( Type ) as Item;
return item;
}
@ -875,39 +833,25 @@ namespace Server
public LootPackItem( Type type, int chance )
{
m_Type = type;
m_Chance = chance;
Type = type;
Chance = chance;
}
}
public class LootPackDice
{
private int m_Count, m_Sides, m_Bonus;
public int Count { get; set; }
public int Count
{
get => m_Count;
set => m_Count = value;
}
public int Sides { get; set; }
public int Sides
{
get => m_Sides;
set => m_Sides = value;
}
public int Bonus
{
get => m_Bonus;
set => m_Bonus = value;
}
public int Bonus { get; set; }
public int Roll()
{
int v = m_Bonus;
int v = Bonus;
for ( int i = 0; i < m_Count; ++i )
v += Utility.Random( 1, m_Sides );
for ( int i = 0; i < Count; ++i )
v += Utility.Random( 1, Sides );
return v;
}
@ -920,7 +864,7 @@ namespace Server
if ( index < start )
return;
m_Count = Utility.ToInt32( str.Substring( start, index-start ) );
Count = Utility.ToInt32( str.Substring( start, index-start ) );
start = index + 1;
index = str.IndexOf( '+', start );
@ -933,7 +877,7 @@ namespace Server
if ( index < start )
index = str.Length;
m_Sides = Utility.ToInt32( str.Substring( start, index-start ) );
Sides = Utility.ToInt32( str.Substring( start, index-start ) );
if ( index == str.Length )
return;
@ -941,17 +885,17 @@ namespace Server
start = index + 1;
index = str.Length;
m_Bonus = Utility.ToInt32( str.Substring( start, index-start ) );
Bonus = Utility.ToInt32( str.Substring( start, index-start ) );
if ( negative )
m_Bonus *= -1;
Bonus *= -1;
}
public LootPackDice( int count, int sides, int bonus )
{
m_Count = count;
m_Sides = sides;
m_Bonus = bonus;
Count = count;
Sides = sides;
Bonus = bonus;
}
}
}

View file

@ -6,9 +6,8 @@ namespace Server
{
public static class MondainsLegacy
{
public static Type[] Artifacts => m_Artifacts;
private static Type[] m_Artifacts = {
public static Type[] Artifacts { get; } =
{
typeof( AegisOfGrace ), typeof( BladeDance ), typeof( BloodwoodSpirit ), typeof( Bonesmasher ),
typeof( Boomstick ), typeof( BrightsightLenses ), typeof( FeyLeggings ), typeof( FleshRipper ),
typeof( HelmOfSwiftness ), typeof( PadsOfTheCuSidhe ), typeof( QuiverOfRage ), typeof( QuiverOfElements ),
@ -27,7 +26,7 @@ namespace Server
public static void GiveArtifactTo( Mobile m )
{
if ( !(Activator.CreateInstance( m_Artifacts[Utility.Random( m_Artifacts.Length )] ) is Item item) )
if ( !(Activator.CreateInstance( Artifacts[Utility.Random( Artifacts.Length )] ) is Item item) )
return;
if ( m.AddToBackpack( item ) )

View file

@ -7,16 +7,14 @@ namespace Server
{
public class NameList
{
private string m_Type;
private string[] m_List;
public string Type { get; }
public string Type => m_Type;
public string[] List => m_List;
public string[] List { get; }
public bool ContainsName( string name )
{
for ( int i = 0; i < m_List.Length; i++ )
if ( name == m_List[i] )
for ( int i = 0; i < List.Length; i++ )
if ( name == List[i] )
return true;
return false;
@ -24,17 +22,17 @@ namespace Server
public NameList( string type, XmlElement xml )
{
m_Type = type;
m_List = xml.InnerText.Split( ',' );
Type = type;
List = xml.InnerText.Split( ',' );
for ( int i = 0; i < m_List.Length; ++i )
m_List[i] = Utility.Intern( m_List[i].Trim() );
for ( int i = 0; i < List.Length; ++i )
List[i] = Utility.Intern( List[i].Trim() );
}
public string GetRandomName()
{
if ( m_List.Length > 0 )
return m_List[Utility.Random( m_List.Length )];
if ( List.Length > 0 )
return List[Utility.Random( List.Length )];
return "";
}

View file

@ -27,7 +27,7 @@ namespace Server.Misc
public static bool Validate( string name, int minLength, int maxLength, bool allowLetters, bool allowDigits, bool noExceptionsAtStart, int maxExceptions, char[] exceptions )
{
return Validate( name, minLength, maxLength, allowLetters, allowDigits, noExceptionsAtStart, maxExceptions, exceptions, m_Disallowed, m_StartDisallowed );
return Validate( name, minLength, maxLength, allowLetters, allowDigits, noExceptionsAtStart, maxExceptions, exceptions, Disallowed, StartDisallowed );
}
public static bool Validate( string name, int minLength, int maxLength, bool allowLetters, bool allowDigits, bool noExceptionsAtStart, int maxExceptions, char[] exceptions, string[] disallowed, string[] startDisallowed )
@ -109,94 +109,93 @@ namespace Server.Misc
return true;
}
public static string[] StartDisallowed => m_StartDisallowed;
public static string[] Disallowed => m_Disallowed;
public static string[] StartDisallowed { get; } =
{
"seer",
"counselor",
"gm",
"admin",
"lady",
"lord"
};
private static string[] m_StartDisallowed = {
"seer",
"counselor",
"gm",
"admin",
"lady",
"lord"
};
private static string[] m_Disallowed = {
"jigaboo",
"chigaboo",
"wop",
"kyke",
"kike",
"tit",
"spic",
"prick",
"piss",
"lezbo",
"lesbo",
"felatio",
"dyke",
"dildo",
"chinc",
"chink",
"cunnilingus",
"cum",
"cocksucker",
"cock",
"clitoris",
"clit",
"ass",
"hitler",
"penis",
"nigga",
"nigger",
"klit",
"kunt",
"jiz",
"jism",
"jerkoff",
"jackoff",
"goddamn",
"fag",
"blowjob",
"bitch",
"asshole",
"dick",
"pussy",
"snatch",
"cunt",
"twat",
"shit",
"fuck",
"tailor",
"smith",
"scholar",
"rogue",
"novice",
"neophyte",
"merchant",
"medium",
"master",
"mage",
"lb",
"journeyman",
"grandmaster",
"fisherman",
"expert",
"chef",
"carpenter",
"british",
"blackthorne",
"blackthorn",
"beggar",
"archer",
"apprentice",
"adept",
"gamemaster",
"frozen",
"squelched",
"invulnerable",
"osi",
"origin"
};
public static string[] Disallowed { get; } =
{
"jigaboo",
"chigaboo",
"wop",
"kyke",
"kike",
"tit",
"spic",
"prick",
"piss",
"lezbo",
"lesbo",
"felatio",
"dyke",
"dildo",
"chinc",
"chink",
"cunnilingus",
"cum",
"cocksucker",
"cock",
"clitoris",
"clit",
"ass",
"hitler",
"penis",
"nigga",
"nigger",
"klit",
"kunt",
"jiz",
"jism",
"jerkoff",
"jackoff",
"goddamn",
"fag",
"blowjob",
"bitch",
"asshole",
"dick",
"pussy",
"snatch",
"cunt",
"twat",
"shit",
"fuck",
"tailor",
"smith",
"scholar",
"rogue",
"novice",
"neophyte",
"merchant",
"medium",
"master",
"mage",
"lb",
"journeyman",
"grandmaster",
"fisherman",
"expert",
"chef",
"carpenter",
"british",
"blackthorne",
"blackthorn",
"beggar",
"archer",
"apprentice",
"adept",
"gamemaster",
"frozen",
"squelched",
"invulnerable",
"osi",
"origin"
};
}
}

View file

@ -39,8 +39,6 @@ namespace Server
}
// Info
private string m_Name;
private int m_Level;
// Damage
private int m_Minimum, m_Maximum;
@ -53,8 +51,8 @@ namespace Server
public PoisonImpl( string name, int level, int min, int max, double percent, double delay, double interval, int count, int messageInterval )
{
m_Name = name;
m_Level = level;
Name = name;
Level = level;
m_Minimum = min;
m_Maximum = max;
m_Scalar = percent * 0.01;
@ -64,24 +62,22 @@ namespace Server
m_MessageInterval = messageInterval;
}
public override string Name => m_Name;
public override int Level => m_Level;
public override string Name { get; }
public override int Level { get; }
public class PoisonTimer : Timer
{
private PoisonImpl m_Poison;
private Mobile m_Mobile;
private Mobile m_From;
private int m_LastDamage;
private int m_Index;
public Mobile From{ get => m_From;
set => m_From = value;
}
public Mobile From { get; set; }
public PoisonTimer( Mobile m, PoisonImpl p ) : base( p.m_Delay, p.m_Interval )
{
m_From = m;
From = m;
m_Mobile = m;
m_Poison = p;
}
@ -132,18 +128,18 @@ namespace Server
m_LastDamage = damage;
}
m_From?.DoHarmful( m_Mobile, true );
From?.DoHarmful( m_Mobile, true );
if ( m_Mobile is IHonorTarget honorTarget )
honorTarget.ReceivedHonorContext?.OnTargetPoisoned();
AOS.Damage( m_Mobile, m_From, damage, 0, 0, 0, 100, 0 );
AOS.Damage( m_Mobile, From, damage, 0, 0, 0, 100, 0 );
if ( 0.60 <= Utility.RandomDouble() ) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
m_Mobile.RevealingAction();
if ( (m_Index % m_Poison.m_MessageInterval) == 0 )
m_Mobile.OnPoisoned( m_From, m_Poison, m_Poison );
m_Mobile.OnPoisoned( From, m_Poison, m_Poison );
}
}

View file

@ -54,66 +54,64 @@ namespace Server.Misc
if ( from.AccessLevel > AccessLevel.Player )
return;
if ( !NameVerification.Validate( e.Speech, 0, int.MaxValue, true, true, false, int.MaxValue, m_Exceptions, m_Disallowed, m_StartDisallowed ) )
if ( !NameVerification.Validate( e.Speech, 0, int.MaxValue, true, true, false, int.MaxValue, Exceptions, Disallowed, StartDisallowed ) )
e.Blocked = !OnProfanityDetected( from, e.Speech );
}
public static char[] Exceptions => m_Exceptions;
public static string[] StartDisallowed => m_StartDisallowed;
public static string[] Disallowed => m_Disallowed;
public static char[] Exceptions { get; } =
{
' ', '-', '.', '\'', '"', ',', '_', '+', '=', '~', '`', '!', '^', '*', '\\', '/', ';', ':', '<', '>', '[', ']', '{', '}', '?', '|', '(', ')', '%', '$', '&', '#', '@'
};
private static char[] m_Exceptions = {
' ', '-', '.', '\'', '"', ',', '_', '+', '=', '~', '`', '!', '^', '*', '\\', '/', ';', ':', '<', '>', '[', ']', '{', '}', '?', '|', '(', ')', '%', '$', '&', '#', '@'
};
public static string[] StartDisallowed { get; } = {};
private static string[] m_StartDisallowed = {};
private static string[] m_Disallowed = {
"jigaboo",
"chigaboo",
"wop",
"kyke",
"kike",
"tit",
"spic",
"prick",
"piss",
"lezbo",
"lesbo",
"felatio",
"dyke",
"dildo",
"chinc",
"chink",
"cunnilingus",
"cum",
"cocksucker",
"cock",
"clitoris",
"clit",
"ass",
"hitler",
"penis",
"nigga",
"nigger",
"klit",
"kunt",
"jiz",
"jism",
"jerkoff",
"jackoff",
"goddamn",
"fag",
"blowjob",
"bitch",
"asshole",
"dick",
"pussy",
"snatch",
"cunt",
"twat",
"shit",
"fuck"
};
public static string[] Disallowed { get; } =
{
"jigaboo",
"chigaboo",
"wop",
"kyke",
"kike",
"tit",
"spic",
"prick",
"piss",
"lezbo",
"lesbo",
"felatio",
"dyke",
"dildo",
"chinc",
"chink",
"cunnilingus",
"cum",
"cocksucker",
"cock",
"clitoris",
"clit",
"ass",
"hitler",
"penis",
"nigga",
"nigger",
"klit",
"kunt",
"jiz",
"jism",
"jerkoff",
"jackoff",
"goddamn",
"fag",
"blowjob",
"bitch",
"asshole",
"dick",
"pussy",
"snatch",
"cunt",
"twat",
"shit",
"fuck"
};
}
}

View file

@ -48,103 +48,51 @@ namespace Server.Items
public class CraftAttributeInfo
{
private int m_WeaponFireDamage;
private int m_WeaponColdDamage;
private int m_WeaponPoisonDamage;
private int m_WeaponEnergyDamage;
private int m_WeaponChaosDamage;
private int m_WeaponDirectDamage;
private int m_WeaponDurability;
private int m_WeaponLuck;
private int m_WeaponGoldIncrease;
private int m_WeaponLowerRequirements;
public int WeaponFireDamage { get; set; }
private int m_ArmorPhysicalResist;
private int m_ArmorFireResist;
private int m_ArmorColdResist;
private int m_ArmorPoisonResist;
private int m_ArmorEnergyResist;
private int m_ArmorDurability;
private int m_ArmorLuck;
private int m_ArmorGoldIncrease;
private int m_ArmorLowerRequirements;
public int WeaponColdDamage { get; set; }
private int m_RunicMinAttributes;
private int m_RunicMaxAttributes;
private int m_RunicMinIntensity;
private int m_RunicMaxIntensity;
public int WeaponPoisonDamage { get; set; }
public int WeaponFireDamage{ get => m_WeaponFireDamage;
set => m_WeaponFireDamage = value;
}
public int WeaponColdDamage{ get => m_WeaponColdDamage;
set => m_WeaponColdDamage = value;
}
public int WeaponPoisonDamage{ get => m_WeaponPoisonDamage;
set => m_WeaponPoisonDamage = value;
}
public int WeaponEnergyDamage{ get => m_WeaponEnergyDamage;
set => m_WeaponEnergyDamage = value;
}
public int WeaponChaosDamage{ get => m_WeaponChaosDamage;
set => m_WeaponChaosDamage = value;
}
public int WeaponDirectDamage{ get => m_WeaponDirectDamage;
set => m_WeaponDirectDamage = value;
}
public int WeaponDurability{ get => m_WeaponDurability;
set => m_WeaponDurability = value;
}
public int WeaponLuck{ get => m_WeaponLuck;
set => m_WeaponLuck = value;
}
public int WeaponGoldIncrease{ get => m_WeaponGoldIncrease;
set => m_WeaponGoldIncrease = value;
}
public int WeaponLowerRequirements{ get => m_WeaponLowerRequirements;
set => m_WeaponLowerRequirements = value;
}
public int WeaponEnergyDamage { get; set; }
public int ArmorPhysicalResist{ get => m_ArmorPhysicalResist;
set => m_ArmorPhysicalResist = value;
}
public int ArmorFireResist{ get => m_ArmorFireResist;
set => m_ArmorFireResist = value;
}
public int ArmorColdResist{ get => m_ArmorColdResist;
set => m_ArmorColdResist = value;
}
public int ArmorPoisonResist{ get => m_ArmorPoisonResist;
set => m_ArmorPoisonResist = value;
}
public int ArmorEnergyResist{ get => m_ArmorEnergyResist;
set => m_ArmorEnergyResist = value;
}
public int ArmorDurability{ get => m_ArmorDurability;
set => m_ArmorDurability = value;
}
public int ArmorLuck{ get => m_ArmorLuck;
set => m_ArmorLuck = value;
}
public int ArmorGoldIncrease{ get => m_ArmorGoldIncrease;
set => m_ArmorGoldIncrease = value;
}
public int ArmorLowerRequirements{ get => m_ArmorLowerRequirements;
set => m_ArmorLowerRequirements = value;
}
public int WeaponChaosDamage { get; set; }
public int RunicMinAttributes{ get => m_RunicMinAttributes;
set => m_RunicMinAttributes = value;
}
public int RunicMaxAttributes{ get => m_RunicMaxAttributes;
set => m_RunicMaxAttributes = value;
}
public int RunicMinIntensity{ get => m_RunicMinIntensity;
set => m_RunicMinIntensity = value;
}
public int RunicMaxIntensity{ get => m_RunicMaxIntensity;
set => m_RunicMaxIntensity = value;
}
public int WeaponDirectDamage { get; set; }
public int WeaponDurability { get; set; }
public int WeaponLuck { get; set; }
public int WeaponGoldIncrease { get; set; }
public int WeaponLowerRequirements { get; set; }
public int ArmorPhysicalResist { get; set; }
public int ArmorFireResist { get; set; }
public int ArmorColdResist { get; set; }
public int ArmorPoisonResist { get; set; }
public int ArmorEnergyResist { get; set; }
public int ArmorDurability { get; set; }
public int ArmorLuck { get; set; }
public int ArmorGoldIncrease { get; set; }
public int ArmorLowerRequirements { get; set; }
public int RunicMinAttributes { get; set; }
public int RunicMaxAttributes { get; set; }
public int RunicMinIntensity { get; set; }
public int RunicMaxIntensity { get; set; }
public CraftAttributeInfo()
{
@ -438,28 +386,26 @@ namespace Server.Items
public class CraftResourceInfo
{
private int m_Hue;
private int m_Number;
private string m_Name;
private CraftAttributeInfo m_AttributeInfo;
private CraftResource m_Resource;
private Type[] m_ResourceTypes;
public int Hue { get; }
public int Hue => m_Hue;
public int Number => m_Number;
public string Name => m_Name;
public CraftAttributeInfo AttributeInfo => m_AttributeInfo;
public CraftResource Resource => m_Resource;
public Type[] ResourceTypes => m_ResourceTypes;
public int Number { get; }
public string Name { get; }
public CraftAttributeInfo AttributeInfo { get; }
public CraftResource Resource { get; }
public Type[] ResourceTypes { get; }
public CraftResourceInfo( int hue, int number, string name, CraftAttributeInfo attributeInfo, CraftResource resource, params Type[] resourceTypes )
{
m_Hue = hue;
m_Number = number;
m_Name = name;
m_AttributeInfo = attributeInfo;
m_Resource = resource;
m_ResourceTypes = resourceTypes;
Hue = hue;
Number = number;
Name = name;
AttributeInfo = attributeInfo;
Resource = resource;
ResourceTypes = resourceTypes;
for ( int i = 0; i < resourceTypes.Length; ++i )
CraftResources.RegisterType( resourceTypes[i], resource );
@ -727,21 +673,17 @@ namespace Server.Items
public static readonly OreInfo Verite = new OreInfo( 7, 0x89F, "Verite" );
public static readonly OreInfo Valorite = new OreInfo( 8, 0x8AB, "Valorite" );
private int m_Level;
private int m_Hue;
private string m_Name;
public OreInfo( int level, int hue, string name )
{
m_Level = level;
m_Hue = hue;
m_Name = name;
Level = level;
Hue = hue;
Name = name;
}
public int Level => m_Level;
public int Level { get; }
public int Hue => m_Hue;
public int Hue { get; }
public string Name => m_Name;
public string Name { get; }
}
}

View file

@ -12,25 +12,11 @@ namespace Server.Misc
{
private string m_Title;
private ShardPollOption[] m_Options;
private IPAddress[] m_Addresses;
private TimeSpan m_Duration;
private DateTime m_StartTime;
private bool m_Active;
public ShardPollOption[] Options
{
get => m_Options;
set => m_Options = value;
}
public ShardPollOption[] Options { get; set; }
public IPAddress[] Addresses
{
get => m_Addresses;
set => m_Addresses = value;
}
public IPAddress[] Addresses { get; set; }
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public string Title
@ -40,30 +26,22 @@ namespace Server.Misc
}
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public TimeSpan Duration
{
get => m_Duration;
set => m_Duration = value;
}
public TimeSpan Duration { get; set; }
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public DateTime StartTime
{
get => m_StartTime;
set => m_StartTime = value;
}
public DateTime StartTime { get; set; }
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public TimeSpan TimeRemaining
{
get
{
if ( m_StartTime == DateTime.MinValue || !m_Active )
if ( StartTime == DateTime.MinValue || !m_Active )
return TimeSpan.Zero;
try
{
TimeSpan ts = (m_StartTime + m_Duration) - DateTime.UtcNow;
TimeSpan ts = (StartTime + Duration) - DateTime.UtcNow;
if ( ts < TimeSpan.Zero )
return TimeSpan.Zero;
@ -90,7 +68,7 @@ namespace Server.Misc
if ( m_Active )
{
m_StartTime = DateTime.UtcNow;
StartTime = DateTime.UtcNow;
m_ActivePollers.Add( this );
}
else
@ -102,9 +80,9 @@ namespace Server.Misc
public bool HasAlreadyVoted( NetState ns )
{
for ( int i = 0; i < m_Options.Length; ++i )
for ( int i = 0; i < Options.Length; ++i )
{
if ( m_Options[i].HasAlreadyVoted( ns ) )
if ( Options[i].HasAlreadyVoted( ns ) )
return true;
}
@ -118,30 +96,30 @@ namespace Server.Misc
public void RemoveOption( ShardPollOption option )
{
int index = Array.IndexOf( m_Options, option );
int index = Array.IndexOf( Options, option );
if ( index < 0 )
return;
ShardPollOption[] old = m_Options;
m_Options = new ShardPollOption[old.Length - 1];
ShardPollOption[] old = Options;
Options = new ShardPollOption[old.Length - 1];
for ( int i = 0; i < index; ++i )
m_Options[i] = old[i];
Options[i] = old[i];
for ( int i = index; i < m_Options.Length; ++i )
m_Options[i] = old[i + 1];
for ( int i = index; i < Options.Length; ++i )
Options[i] = old[i + 1];
}
public void AddOption( ShardPollOption option )
{
ShardPollOption[] old = m_Options;
m_Options = new ShardPollOption[old.Length + 1];
ShardPollOption[] old = Options;
Options = new ShardPollOption[old.Length + 1];
for ( int i = 0; i < old.Length; ++i )
m_Options[i] = old[i];
Options[i] = old[i];
m_Options[old.Length] = option;
Options[old.Length] = option;
}
public override string DefaultName => "shard poller";
@ -149,9 +127,9 @@ namespace Server.Misc
[Constructible( AccessLevel.Administrator )]
public ShardPoller() : base( 0x1047 )
{
m_Duration = TimeSpan.FromHours( 24.0 );
m_Options = new ShardPollOption[0];
m_Addresses = new IPAddress[0];
Duration = TimeSpan.FromHours( 24.0 );
Options = new ShardPollOption[0];
Addresses = new IPAddress[0];
Movable = false;
}
@ -236,14 +214,14 @@ namespace Server.Misc
writer.Write( (int) 0 ); // version
writer.Write( m_Title );
writer.Write( m_Duration );
writer.Write( m_StartTime );
writer.Write( Duration );
writer.Write( StartTime );
writer.Write( m_Active );
writer.Write( m_Options.Length );
writer.Write( Options.Length );
for ( int i = 0; i < m_Options.Length; ++i )
m_Options[i].Serialize( writer );
for ( int i = 0; i < Options.Length; ++i )
Options[i].Serialize( writer );
}
public override void Deserialize( GenericReader reader )
@ -257,14 +235,14 @@ namespace Server.Misc
case 0:
{
m_Title = reader.ReadString();
m_Duration = reader.ReadTimeSpan();
m_StartTime = reader.ReadDateTime();
Duration = reader.ReadTimeSpan();
StartTime = reader.ReadDateTime();
m_Active = reader.ReadBool();
m_Options = new ShardPollOption[reader.ReadInt()];
Options = new ShardPollOption[reader.ReadInt()];
for ( int i = 0; i < m_Options.Length; ++i )
m_Options[i] = new ShardPollOption( reader );
for ( int i = 0; i < Options.Length; ++i )
Options[i] = new ShardPollOption( reader );
if ( m_Active )
m_ActivePollers.Add( this );
@ -285,23 +263,19 @@ namespace Server.Misc
public class ShardPollOption
{
private string m_Title;
private int m_LineBreaks;
private IPAddress[] m_Voters;
public string Title{ get => m_Title;
set{ m_Title = value; m_LineBreaks = GetBreaks( m_Title ); } }
public int LineBreaks => m_LineBreaks;
set{ m_Title = value; LineBreaks = GetBreaks( m_Title ); } }
public int LineBreaks { get; private set; }
public int Votes => m_Voters.Length;
public IPAddress[] Voters{ get => m_Voters;
set => m_Voters = value;
}
public int Votes => Voters.Length;
public IPAddress[] Voters { get; set; }
public ShardPollOption( string title )
{
m_Title = title;
m_LineBreaks = GetBreaks( m_Title );
m_Voters = new IPAddress[0];
LineBreaks = GetBreaks( m_Title );
Voters = new IPAddress[0];
}
public bool HasAlreadyVoted( NetState ns )
@ -311,9 +285,9 @@ namespace Server.Misc
IPAddress ipAddress = ns.Address;
for ( int i = 0; i < m_Voters.Length; ++i )
for ( int i = 0; i < Voters.Length; ++i )
{
if ( Utility.IPMatchClassC( m_Voters[i], ipAddress ) )
if ( Utility.IPMatchClassC( Voters[i], ipAddress ) )
return true;
}
@ -325,18 +299,18 @@ namespace Server.Misc
if ( ns == null )
return;
IPAddress[] old = m_Voters;
m_Voters = new IPAddress[old.Length + 1];
IPAddress[] old = Voters;
Voters = new IPAddress[old.Length + 1];
for ( int i = 0; i < old.Length; ++i )
m_Voters[i] = old[i];
Voters[i] = old[i];
m_Voters[old.Length] = ns.Address;
Voters[old.Length] = ns.Address;
}
public int ComputeHeight()
{
int height = m_LineBreaks * 18;
int height = LineBreaks * 18;
if ( height > 30 )
return height;
@ -370,12 +344,12 @@ namespace Server.Misc
case 0:
{
m_Title = reader.ReadString();
m_LineBreaks = GetBreaks( m_Title );
LineBreaks = GetBreaks( m_Title );
m_Voters = new IPAddress[reader.ReadInt()];
Voters = new IPAddress[reader.ReadInt()];
for ( int i = 0; i < m_Voters.Length; ++i )
m_Voters[i] = Utility.Intern( reader.ReadIPAddress() );
for ( int i = 0; i < Voters.Length; ++i )
Voters[i] = Utility.Intern( reader.ReadIPAddress() );
break;
}
@ -388,10 +362,10 @@ namespace Server.Misc
writer.Write( m_Title );
writer.Write( m_Voters.Length );
writer.Write( Voters.Length );
for ( int i = 0; i < m_Voters.Length; ++i )
writer.Write( m_Voters[i] );
for ( int i = 0; i < Voters.Length; ++i )
writer.Write( Voters[i] );
}
}
@ -399,10 +373,9 @@ namespace Server.Misc
{
private Mobile m_From;
private ShardPoller m_Poller;
private bool m_Editing;
private Queue<ShardPoller> m_Polls;
public bool Editing => m_Editing;
public bool Editing { get; }
public void QueuePoll( ShardPoller poller )
{
@ -428,7 +401,7 @@ namespace Server.Misc
{
m_From = from;
m_Poller = poller;
m_Editing = editing;
Editing = editing;
m_Polls = polls;
Closable = false;
@ -539,10 +512,10 @@ namespace Server.Misc
if ( switched >= 0 && switched < m_Poller.Options.Length )
opt = m_Poller.Options[switched];
if ( opt == null && !m_Editing )
if ( opt == null && !Editing )
return;
if ( m_Editing )
if ( Editing )
{
if ( !m_Poller.Active )
{
@ -552,7 +525,7 @@ namespace Server.Misc
else
{
m_From.SendMessage( "You may not edit an active poll. Deactivate it first." );
m_From.SendGump( new ShardPollGump( m_From, m_Poller, m_Editing, m_Polls ) );
m_From.SendGump( new ShardPollGump( m_From, m_Poller, Editing, m_Polls ) );
}
}
else
@ -565,9 +538,9 @@ namespace Server.Misc
m_Poller.AddVote( sender, opt );
}
}
else if ( info.ButtonID == 2 && m_Editing )
else if ( info.ButtonID == 2 && Editing )
{
m_From.SendGump( new ShardPollGump( m_From, m_Poller, m_Editing, m_Polls ) );
m_From.SendGump( new ShardPollGump( m_From, m_Poller, Editing, m_Polls ) );
m_From.SendGump( new PropertiesGump( m_From, m_Poller ) );
}
}

View file

@ -8,13 +8,11 @@ namespace Server
[Parsable]
public class TextDefinition
{
private int m_Number;
private string m_String;
public int Number { get; }
public int Number => m_Number;
public string String => m_String;
public string String { get; }
public bool IsEmpty => ( m_Number <= 0 && m_String == null );
public bool IsEmpty => ( Number <= 0 && String == null );
public TextDefinition() : this( 0, null )
{
@ -30,36 +28,36 @@ namespace Server
public TextDefinition( int number, string text )
{
m_Number = number;
m_String = text;
Number = number;
String = text;
}
public override string ToString()
{
if ( m_Number > 0 )
return string.Concat( "#", m_Number.ToString() );
if ( m_String != null )
return m_String;
if ( Number > 0 )
return string.Concat( "#", Number.ToString() );
if ( String != null )
return String;
return "";
}
public string Format( bool propsGump )
{
if ( m_Number > 0 )
return string.Format( "{0} (0x{0:X})", m_Number );
if ( m_String != null )
return $"\"{m_String}\"";
if ( Number > 0 )
return string.Format( "{0} (0x{0:X})", Number );
if ( String != null )
return $"\"{String}\"";
return propsGump ? "-empty-" : "empty";
}
public string GetValue()
{
if ( m_Number > 0 )
return m_Number.ToString();
if ( m_String != null )
return m_String;
if ( Number > 0 )
return Number.ToString();
if ( String != null )
return String;
return "";
}
@ -70,15 +68,15 @@ namespace Server
{
writer.WriteEncodedInt( 3 );
}
else if ( def.m_Number > 0 )
else if ( def.Number > 0 )
{
writer.WriteEncodedInt( 1 );
writer.WriteEncodedInt( def.m_Number );
writer.WriteEncodedInt( def.Number );
}
else if ( def.m_String != null )
else if ( def.String != null )
{
writer.WriteEncodedInt( 2 );
writer.Write( def.m_String );
writer.Write( def.String );
}
else
{
@ -105,10 +103,10 @@ namespace Server
if ( def == null )
return;
if ( def.m_Number > 0 )
list.Add( def.m_Number );
else if ( def.m_String != null )
list.Add( def.m_String );
if ( def.Number > 0 )
list.Add( def.Number );
else if ( def.String != null )
list.Add( def.String );
}
public static implicit operator TextDefinition( int v )
@ -126,12 +124,12 @@ namespace Server
if ( m == null )
return 0;
return m.m_Number;
return m.Number;
}
public static implicit operator string( TextDefinition m )
{
return m?.m_String;
return m?.String;
}
public static void AddHtmlText( Gump g, int x, int y, int width, int height, TextDefinition def, bool back, bool scroll, int numberColor, int stringColor )
@ -139,19 +137,19 @@ namespace Server
if ( def == null )
return;
if ( def.m_Number > 0 )
if ( def.Number > 0 )
{
if ( numberColor >= 0 ) // 5 bits per RGB component (15 bit RGB)
g.AddHtmlLocalized( x, y, width, height, def.m_Number, numberColor, back, scroll );
g.AddHtmlLocalized( x, y, width, height, def.Number, numberColor, back, scroll );
else
g.AddHtmlLocalized( x, y, width, height, def.m_Number, back, scroll );
g.AddHtmlLocalized( x, y, width, height, def.Number, back, scroll );
}
else if ( def.m_String != null )
else if ( def.String != null )
{
if ( stringColor >= 0 ) // 8 bits per RGB component (24 bit RGB)
g.AddHtml( x, y, width, height, $"<BASEFONT COLOR=#{stringColor:X6}>{def.m_String}</BASEFONT>", back, scroll );
g.AddHtml( x, y, width, height, $"<BASEFONT COLOR=#{stringColor:X6}>{def.String}</BASEFONT>", back, scroll );
else
g.AddHtml( x, y, width, height, def.m_String, back, scroll );
g.AddHtml( x, y, width, height, def.String, back, scroll );
}
}
@ -165,10 +163,10 @@ namespace Server
if ( def == null )
return;
if ( def.m_Number > 0 )
m.SendLocalizedMessage( def.m_Number );
else if ( def.m_String != null )
m.SendMessage( def.m_String );
if ( def.Number > 0 )
m.SendLocalizedMessage( def.Number );
else if ( def.String != null )
m.SendMessage( def.String );
}
public static void SendMessageTo( Mobile m, TextDefinition def, int hue )
@ -176,10 +174,10 @@ namespace Server
if ( def == null )
return;
if ( def.m_Number > 0 )
m.SendLocalizedMessage( def.m_Number, "", hue );
else if ( def.m_String != null )
m.SendMessage( hue, def.m_String );
if ( def.Number > 0 )
m.SendLocalizedMessage( def.Number, "", hue );
else if ( def.String != null )
m.SendMessage( hue, def.String );
}
public static void PublicOverheadMessage( Mobile m, MessageType messageType, int hue, TextDefinition def )
@ -187,10 +185,10 @@ namespace Server
if ( def == null )
return;
if ( def.m_Number > 0 )
m.PublicOverheadMessage( messageType, hue, def.m_Number );
else if ( def.m_String != null )
m.PublicOverheadMessage( messageType, hue, false, def.m_String );
if ( def.Number > 0 )
m.PublicOverheadMessage( messageType, hue, def.Number );
else if ( def.String != null )
m.PublicOverheadMessage( messageType, hue, false, def.String );
}
public static TextDefinition Parse( string value )

View file

@ -36,30 +36,14 @@ namespace Server.Items
TargetCommands.Register( new ToggleCommand() );
}
private int m_InactiveItemID;
private int m_ActiveItemID;
private bool m_PlayersCanToggle;
[CommandProperty( AccessLevel.GameMaster )]
public int InactiveItemID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int InactiveItemID
{
get => m_InactiveItemID;
set => m_InactiveItemID = value;
}
public int ActiveItemID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ActiveItemID
{
get => m_ActiveItemID;
set => m_ActiveItemID = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public bool PlayersCanToggle
{
get => m_PlayersCanToggle;
set => m_PlayersCanToggle = value;
}
public bool PlayersCanToggle { get; set; }
[Constructible]
public ToggleItem( int inactiveItemID, int activeItemID, bool playersCanToggle = false)
@ -67,9 +51,9 @@ namespace Server.Items
{
Movable = false;
m_InactiveItemID = inactiveItemID;
m_ActiveItemID = activeItemID;
m_PlayersCanToggle = playersCanToggle;
InactiveItemID = inactiveItemID;
ActiveItemID = activeItemID;
PlayersCanToggle = playersCanToggle;
}
public override void OnDoubleClick( Mobile from )
@ -78,7 +62,7 @@ namespace Server.Items
{
Toggle();
}
else if ( m_PlayersCanToggle )
else if ( PlayersCanToggle )
{
if ( from.InRange( GetWorldLocation(), 1 ) )
Toggle();
@ -89,7 +73,7 @@ namespace Server.Items
public void Toggle()
{
ItemID = ( ItemID == m_ActiveItemID ) ? m_InactiveItemID : m_ActiveItemID;
ItemID = ( ItemID == ActiveItemID ) ? InactiveItemID : ActiveItemID;
Visible = ( ItemID != 0x1 );
}
@ -104,9 +88,9 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( m_InactiveItemID );
writer.Write( m_ActiveItemID );
writer.Write( m_PlayersCanToggle );
writer.Write( InactiveItemID );
writer.Write( ActiveItemID );
writer.Write( PlayersCanToggle );
}
public override void Deserialize( GenericReader reader )
@ -115,9 +99,9 @@ namespace Server.Items
int version = reader.ReadInt();
m_InactiveItemID = reader.ReadInt();
m_ActiveItemID = reader.ReadInt();
m_PlayersCanToggle = reader.ReadBool();
InactiveItemID = reader.ReadInt();
ActiveItemID = reader.ReadInt();
PlayersCanToggle = reader.ReadBool();
}
}
}

View file

@ -76,8 +76,8 @@ namespace Server.Misc
Weather w = new Weather( m_Facets[i], new[]{ area }, temperature, chanceOfPercipitation, chanceOfExtremeTemperature, TimeSpan.FromSeconds( 30.0 ) );
w.m_Bounds = bounds;
w.m_MoveSpeed = moveSpeed;
w.Bounds = bounds;
w.MoveSpeed = moveSpeed;
}
}
@ -105,43 +105,25 @@ namespace Server.Misc
return false;
}
private Map m_Facet;
private Rectangle2D[] m_Area;
private int m_Temperature;
private int m_ChanceOfPercipitation;
private int m_ChanceOfExtremeTemperature;
public Map Facet { get; }
public Map Facet => m_Facet;
public Rectangle2D[] Area{ get => m_Area;
set => m_Area = value;
}
public int Temperature{ get => m_Temperature;
set => m_Temperature = value;
}
public int ChanceOfPercipitation{ get => m_ChanceOfPercipitation;
set => m_ChanceOfPercipitation = value;
}
public int ChanceOfExtremeTemperature{ get => m_ChanceOfExtremeTemperature;
set => m_ChanceOfExtremeTemperature = value;
}
public Rectangle2D[] Area { get; set; }
public int Temperature { get; set; }
public int ChanceOfPercipitation { get; set; }
public int ChanceOfExtremeTemperature { get; set; }
// For dynamic weather:
private Rectangle2D m_Bounds;
private int m_MoveSpeed;
private int m_MoveAngleX, m_MoveAngleY;
public Rectangle2D Bounds{ get => m_Bounds;
set => m_Bounds = value;
}
public int MoveSpeed{ get => m_MoveSpeed;
set => m_MoveSpeed = value;
}
public int MoveAngleX{ get => m_MoveAngleX;
set => m_MoveAngleX = value;
}
public int MoveAngleY{ get => m_MoveAngleY;
set => m_MoveAngleY = value;
}
public Rectangle2D Bounds { get; set; }
public int MoveSpeed { get; set; }
public int MoveAngleX { get; set; }
public int MoveAngleY { get; set; }
public static bool CheckIntersection( Rectangle2D r1, Rectangle2D r2 )
{
@ -179,9 +161,9 @@ namespace Server.Misc
public virtual bool IntersectsWith( Rectangle2D area )
{
for ( int i = 0; i < m_Area.Length; ++i )
for ( int i = 0; i < Area.Length; ++i )
{
if ( CheckIntersection( area, m_Area[i] ) )
if ( CheckIntersection( area, Area[i] ) )
return true;
}
@ -190,11 +172,11 @@ namespace Server.Misc
public Weather( Map facet, Rectangle2D[] area, int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, TimeSpan interval )
{
m_Facet = facet;
m_Area = area;
m_Temperature = temperature;
m_ChanceOfPercipitation = chanceOfPercipitation;
m_ChanceOfExtremeTemperature = chanceOfExtremeTemperature;
Facet = facet;
Area = area;
Temperature = temperature;
ChanceOfPercipitation = chanceOfPercipitation;
ChanceOfExtremeTemperature = chanceOfExtremeTemperature;
List<Weather> list = GetWeatherList( facet );
@ -205,20 +187,20 @@ namespace Server.Misc
public virtual void Reposition()
{
if ( m_Area.Length == 0 )
if ( Area.Length == 0 )
return;
int width = m_Area[0].Width;
int height = m_Area[0].Height;
int width = Area[0].Width;
int height = Area[0].Height;
Rectangle2D area = new Rectangle2D();
bool isValid = false;
for ( int j = 0; j < 10; ++j )
{
area = new Rectangle2D( m_Bounds.X + Utility.Random( m_Bounds.Width - width ), m_Bounds.Y + Utility.Random( m_Bounds.Height - height ), width, height );
area = new Rectangle2D( Bounds.X + Utility.Random( Bounds.Width - width ), Bounds.Y + Utility.Random( Bounds.Height - height ), width, height );
if ( !CheckWeatherConflict( m_Facet, this, area ) )
if ( !CheckWeatherConflict( Facet, this, area ) )
isValid = true;
if ( isValid )
@ -228,7 +210,7 @@ namespace Server.Misc
if ( !isValid )
return;
m_Area[0] = area;
Area[0] = area;
}
public virtual void RecalculateMovementAngle()
@ -238,26 +220,26 @@ namespace Server.Misc
double cos = Math.Cos( angle );
double sin = Math.Sin( angle );
m_MoveAngleX = (int)(100 * cos);
m_MoveAngleY = (int)(100 * sin);
MoveAngleX = (int)(100 * cos);
MoveAngleY = (int)(100 * sin);
}
public virtual void MoveForward()
{
if ( m_Area.Length == 0 )
if ( Area.Length == 0 )
return;
for ( int i = 0; i < 5; ++i ) // try 5 times to find a valid spot
{
int xOffset = (m_MoveSpeed * m_MoveAngleX) / 100;
int yOffset = (m_MoveSpeed * m_MoveAngleY) / 100;
int xOffset = (MoveSpeed * MoveAngleX) / 100;
int yOffset = (MoveSpeed * MoveAngleY) / 100;
Rectangle2D oldArea = m_Area[0];
Rectangle2D oldArea = Area[0];
Rectangle2D newArea = new Rectangle2D( oldArea.X + xOffset, oldArea.Y + yOffset, oldArea.Width, oldArea.Height );
if ( !CheckWeatherConflict( m_Facet, this, newArea ) && CheckContains( m_Bounds, newArea ) )
if ( !CheckWeatherConflict( Facet, this, newArea ) && CheckContains( Bounds, newArea ) )
{
m_Area[0] = newArea;
Area[0] = newArea;
break;
}
@ -273,10 +255,10 @@ namespace Server.Misc
{
if ( m_Stage == 0 )
{
m_Active = ( m_ChanceOfPercipitation > Utility.Random( 100 ) );
m_ExtremeTemperature = ( m_ChanceOfExtremeTemperature > Utility.Random( 100 ) );
m_Active = ( ChanceOfPercipitation > Utility.Random( 100 ) );
m_ExtremeTemperature = ( ChanceOfExtremeTemperature > Utility.Random( 100 ) );
if ( m_MoveSpeed > 0 )
if ( MoveSpeed > 0 )
{
Reposition();
RecalculateMovementAngle();
@ -285,12 +267,12 @@ namespace Server.Misc
if ( m_Active )
{
if ( m_Stage > 0 && m_MoveSpeed > 0 )
if ( m_Stage > 0 && MoveSpeed > 0 )
MoveForward();
int type, density, temperature;
temperature = m_Temperature;
temperature = Temperature;
if ( m_ExtremeTemperature )
temperature *= -1;
@ -325,13 +307,13 @@ namespace Server.Misc
NetState ns = states[i];
Mobile mob = ns.Mobile;
if ( mob == null || mob.Map != m_Facet )
if ( mob == null || mob.Map != Facet )
continue;
bool contains = ( m_Area.Length == 0 );
bool contains = ( Area.Length == 0 );
for ( int j = 0; !contains && j < m_Area.Length; ++j )
contains = m_Area[j].Contains( mob.Location );
for ( int j = 0; !contains && j < Area.Length; ++j )
contains = Area[j].Contains( mob.Location );
if ( !contains )
continue;

View file

@ -16,19 +16,13 @@ namespace Server.Misc
EventSink.Movement += EventSink_Movement;
}
private static DFAlgorithm m_DFA;
public static DFAlgorithm DFA
{
get => m_DFA;
set => m_DFA = value;
}
public static DFAlgorithm DFA { get; set; }
public static void FatigueOnDamage( Mobile m, int damage )
{
double fatigue = 0.0;
switch ( m_DFA )
switch ( DFA )
{
case DFAlgorithm.Standard:
{