Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -134,8 +134,6 @@ namespace Server
|
|||
totalDamage += totalDamage * quiver.DamageIncrease / 100;
|
||||
}
|
||||
|
||||
#region Dragon Barding
|
||||
|
||||
if (from?.Player != true && m.Player && m.Mount is SwampDragon pet)
|
||||
if (pet.HasBarding)
|
||||
{
|
||||
|
|
@ -154,8 +152,6 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
if (keepAlive && totalDamage > m.Hits)
|
||||
totalDamage = m.Hits;
|
||||
|
||||
|
|
@ -921,7 +917,6 @@ namespace Server
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double Skill_1_Value
|
||||
{
|
||||
|
|
@ -1006,7 +1001,7 @@ namespace Server
|
|||
SkillName.EvalInt => 1002070, // Evaluate Intelligence
|
||||
SkillName.Forensics => 1002078, // Forensic Evaluation
|
||||
SkillName.Lockpicking => 1002097, // Lockpicking
|
||||
_ => (1044060 + (int)skill)
|
||||
_ => 1044060 + (int)skill
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1254,7 +1249,7 @@ namespace Server
|
|||
[PropertyObject]
|
||||
public abstract class BaseAttributes
|
||||
{
|
||||
private static int[] m_Empty = new int[0];
|
||||
private static readonly int[] m_Empty = Array.Empty<int>();
|
||||
private uint m_Names;
|
||||
private int[] m_Values;
|
||||
|
||||
|
|
@ -1281,30 +1276,30 @@ namespace Server
|
|||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Names = reader.ReadUInt();
|
||||
m_Values = new int[reader.ReadEncodedInt()];
|
||||
{
|
||||
m_Names = reader.ReadUInt();
|
||||
m_Values = new int[reader.ReadEncodedInt()];
|
||||
|
||||
for (int i = 0; i < m_Values.Length; ++i)
|
||||
m_Values[i] = reader.ReadEncodedInt();
|
||||
for (int i = 0; i < m_Values.Length; ++i)
|
||||
m_Values[i] = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Names = reader.ReadUInt();
|
||||
m_Values = new int[reader.ReadInt()];
|
||||
{
|
||||
m_Names = reader.ReadUInt();
|
||||
m_Values = new int[reader.ReadInt()];
|
||||
|
||||
for (int i = 0; i < m_Values.Length; ++i)
|
||||
m_Values[i] = reader.ReadInt();
|
||||
for (int i = 0; i < m_Values.Length; ++i)
|
||||
m_Values[i] = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEmpty => m_Names == 0;
|
||||
public Item Owner{ get; }
|
||||
public Item Owner { get; }
|
||||
|
||||
public void Serialize(IGenericWriter writer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Server.Misc
|
|||
private const string AggressedFormat = "{0} is attacking you!";
|
||||
private const int Hue = 0x22;
|
||||
|
||||
private static TimeSpan Delay = TimeSpan.FromMinutes(1.0);
|
||||
private static readonly TimeSpan Delay = TimeSpan.FromMinutes(1.0);
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ namespace Server.Misc
|
|||
{
|
||||
public static bool Enabled; // is the script enabled?
|
||||
|
||||
private static TimeSpan RestartTime = TimeSpan.FromHours(2.0); // time of day at which to restart
|
||||
private static readonly TimeSpan RestartTime = TimeSpan.FromHours(2.0); // time of day at which to restart
|
||||
|
||||
private static TimeSpan
|
||||
private static readonly TimeSpan
|
||||
RestartDelay =
|
||||
TimeSpan.Zero; // how long the server should remain active before restart (period of 'server wars')
|
||||
|
||||
private static TimeSpan
|
||||
private static readonly TimeSpan
|
||||
WarningDelay = TimeSpan.FromMinutes(1.0); // at what interval should the shutdown message be displayed?
|
||||
|
||||
private static DateTime m_RestartTime;
|
||||
|
|
@ -27,7 +27,7 @@ namespace Server.Misc
|
|||
m_RestartTime += TimeSpan.FromDays(1.0);
|
||||
}
|
||||
|
||||
public static bool Restarting{ get; private set; }
|
||||
public static bool Restarting { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ namespace Server.Misc
|
|||
{
|
||||
public class AutoSave : Timer
|
||||
{
|
||||
private static TimeSpan m_Delay = TimeSpan.FromMinutes(5.0);
|
||||
private static TimeSpan m_Warning = TimeSpan.Zero;
|
||||
private static readonly TimeSpan m_Delay = TimeSpan.FromMinutes(5.0);
|
||||
private static readonly TimeSpan m_Warning = TimeSpan.Zero;
|
||||
|
||||
private static string[] m_Backups =
|
||||
private static readonly string[] m_Backups =
|
||||
{
|
||||
"Third Backup",
|
||||
"Second Backup",
|
||||
|
|
@ -17,8 +17,8 @@ namespace Server.Misc
|
|||
|
||||
public AutoSave() : base(m_Delay - m_Warning, m_Delay) => Priority = TimerPriority.OneMinute;
|
||||
|
||||
public static bool SavesEnabled{ get; set; } = true;
|
||||
//private static TimeSpan m_Warning = TimeSpan.FromSeconds( 15.0 );
|
||||
public static bool SavesEnabled { get; set; } = true;
|
||||
// private static TimeSpan m_Warning = TimeSpan.FromSeconds( 15.0 );
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,27 +20,21 @@ namespace Server
|
|||
Timer.DelayCall(TimeSpan.Zero, pm.ResendBuffs);
|
||||
}
|
||||
|
||||
#region Properties
|
||||
public BuffIcon ID { get; }
|
||||
|
||||
public BuffIcon ID{ get; }
|
||||
public int TitleCliloc { get; }
|
||||
|
||||
public int TitleCliloc{ get; }
|
||||
public int SecondaryCliloc { get; }
|
||||
|
||||
public int SecondaryCliloc{ get; }
|
||||
public TimeSpan TimeLength { get; }
|
||||
|
||||
public TimeSpan TimeLength{ get; }
|
||||
public DateTime TimeStart { get; }
|
||||
|
||||
public DateTime TimeStart{ get; }
|
||||
public Timer Timer { get; }
|
||||
|
||||
public Timer Timer{ get; }
|
||||
public bool RetainThroughDeath { get; }
|
||||
|
||||
public bool RetainThroughDeath{ get; }
|
||||
|
||||
public TextDefinition Args{ get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public TextDefinition Args { get; }
|
||||
|
||||
public BuffInfo(BuffIcon iconID, int titleCliloc)
|
||||
: this(iconID, titleCliloc, titleCliloc + 1)
|
||||
|
|
@ -59,14 +53,14 @@ namespace Server
|
|||
{
|
||||
}
|
||||
|
||||
//Only the timed one needs to Mobile to know when to automagically remove it.
|
||||
// Only the timed one needs to Mobile to know when to automagically remove it.
|
||||
public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m)
|
||||
: this(iconID, titleCliloc, secondaryCliloc)
|
||||
{
|
||||
TimeLength = length;
|
||||
TimeStart = DateTime.UtcNow;
|
||||
|
||||
Timer = Timer.DelayCall(length, delegate
|
||||
Timer = Timer.DelayCall(length, () =>
|
||||
{
|
||||
if (!(m is PlayerMobile pm))
|
||||
return;
|
||||
|
|
@ -75,7 +69,6 @@ namespace Server
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
public BuffInfo(BuffIcon iconID, int titleCliloc, TextDefinition args)
|
||||
: this(iconID, titleCliloc, titleCliloc + 1, args)
|
||||
{
|
||||
|
|
@ -127,10 +120,6 @@ namespace Server
|
|||
RetainThroughDeath = retainThroughDeath;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Convenience Methods
|
||||
|
||||
public static void AddBuff(Mobile m, BuffInfo b)
|
||||
{
|
||||
if (m is PlayerMobile pm)
|
||||
|
|
@ -148,8 +137,6 @@ namespace Server
|
|||
if (m is PlayerMobile pm)
|
||||
pm.RemoveBuff(b);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum BuffIcon : short
|
||||
|
|
@ -157,51 +144,51 @@ namespace Server
|
|||
DismountPrevention = 0x3E9,
|
||||
NoRearm = 0x3EA,
|
||||
|
||||
//Currently, no 0x3EB or 0x3EC
|
||||
NightSight = 0x3ED, //*
|
||||
// Currently, no 0x3EB or 0x3EC
|
||||
NightSight = 0x3ED, // *
|
||||
DeathStrike,
|
||||
EvilOmen,
|
||||
UnknownStandingSwirl, //Which is healing throttle & Stamina throttle?
|
||||
UnknownStandingSwirl, // Which is healing throttle & Stamina throttle?
|
||||
UnknownKneelingSword,
|
||||
DivineFury, //*
|
||||
EnemyOfOne, //*
|
||||
HidingAndOrStealth, //*
|
||||
ActiveMeditation, //*
|
||||
BloodOathCaster, //*
|
||||
BloodOathCurse, //*
|
||||
CorpseSkin, //*
|
||||
Mindrot, //*
|
||||
PainSpike, //*
|
||||
DivineFury, // *
|
||||
EnemyOfOne, // *
|
||||
HidingAndOrStealth, // *
|
||||
ActiveMeditation, // *
|
||||
BloodOathCaster, // *
|
||||
BloodOathCurse, // *
|
||||
CorpseSkin, // *
|
||||
Mindrot, // *
|
||||
PainSpike, // *
|
||||
Strangle,
|
||||
GiftOfRenewal, //*
|
||||
AttuneWeapon, //*
|
||||
Thunderstorm, //*
|
||||
EssenceOfWind, //*
|
||||
EtherealVoyage, //*
|
||||
GiftOfLife, //*
|
||||
ArcaneEmpowerment, //*
|
||||
GiftOfRenewal, // *
|
||||
AttuneWeapon, // *
|
||||
Thunderstorm, // *
|
||||
EssenceOfWind, // *
|
||||
EtherealVoyage, // *
|
||||
GiftOfLife, // *
|
||||
ArcaneEmpowerment, // *
|
||||
MortalStrike,
|
||||
ReactiveArmor, //*
|
||||
Protection, //*
|
||||
ReactiveArmor, // *
|
||||
Protection, // *
|
||||
ArchProtection,
|
||||
MagicReflection, //*
|
||||
Incognito, //*
|
||||
MagicReflection, // *
|
||||
Incognito, // *
|
||||
Disguised,
|
||||
AnimalForm,
|
||||
Polymorph,
|
||||
Invisibility, //*
|
||||
Paralyze, //*
|
||||
Invisibility, // *
|
||||
Paralyze, // *
|
||||
Poison,
|
||||
Bleed,
|
||||
Clumsy, //*
|
||||
FeebleMind, //*
|
||||
Weaken, //*
|
||||
Curse, //*
|
||||
Clumsy, // *
|
||||
FeebleMind, // *
|
||||
Weaken, // *
|
||||
Curse, // *
|
||||
MassCurse,
|
||||
Agility, //*
|
||||
Cunning, //*
|
||||
Strength, //*
|
||||
Bless, //*
|
||||
Agility, // *
|
||||
Cunning, // *
|
||||
Strength, // *
|
||||
Bless, // *
|
||||
Sleep,
|
||||
StoneForm,
|
||||
SpellPlague,
|
||||
|
|
@ -225,44 +212,43 @@ namespace Server
|
|||
bool hasArgs = args != null;
|
||||
|
||||
EnsureCapacity(hasArgs ? 48 + args.ToString().Length * 2 : 44);
|
||||
m_Stream.Write(mob.Serial);
|
||||
Stream.Write(mob.Serial);
|
||||
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x1); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
m_Stream.Write((short)iconID); //ID
|
||||
m_Stream.Write((short)0x1); //Type 0 for removal. 1 for add 2 for Data
|
||||
Stream.Fill(4);
|
||||
|
||||
m_Stream.Fill(4);
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x01); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
m_Stream.Write((short)iconID); //ID
|
||||
m_Stream.Write((short)0x01); //Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
m_Stream.Fill(4);
|
||||
Stream.Fill(4);
|
||||
|
||||
if (length < TimeSpan.Zero)
|
||||
length = TimeSpan.Zero;
|
||||
|
||||
m_Stream.Write((short)length.TotalSeconds); //Time in seconds
|
||||
Stream.Write((short)length.TotalSeconds); // Time in seconds
|
||||
|
||||
m_Stream.Fill(3);
|
||||
m_Stream.Write(titleCliloc);
|
||||
m_Stream.Write(secondaryCliloc);
|
||||
Stream.Fill(3);
|
||||
Stream.Write(titleCliloc);
|
||||
Stream.Write(secondaryCliloc);
|
||||
|
||||
if (!hasArgs)
|
||||
{
|
||||
//m_Stream.Fill( 2 );
|
||||
m_Stream.Fill(10);
|
||||
// m_Stream.Fill( 2 );
|
||||
Stream.Fill(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Stream.Fill(4);
|
||||
m_Stream.Write((short)0x1); //Unknown -> Possibly something saying 'hey, I have more data!'?
|
||||
m_Stream.Fill(2);
|
||||
Stream.Fill(4);
|
||||
Stream.Write((short)0x1); // Unknown -> Possibly something saying 'hey, I have more data!'?
|
||||
Stream.Fill(2);
|
||||
|
||||
//m_Stream.WriteLittleUniNull( "\t#1018280" );
|
||||
m_Stream.WriteLittleUniNull($"\t{args}");
|
||||
// m_Stream.WriteLittleUniNull( "\t#1018280" );
|
||||
Stream.WriteLittleUniNull($"\t{args}");
|
||||
|
||||
m_Stream.Write((short)0x1); //Even more Unknown -> Possibly something saying 'hey, I have more data!'?
|
||||
m_Stream.Fill(2);
|
||||
Stream.Write((short)0x1); // Even more Unknown -> Possibly something saying 'hey, I have more data!'?
|
||||
Stream.Fill(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -278,12 +264,12 @@ namespace Server
|
|||
: base(0xDF)
|
||||
{
|
||||
EnsureCapacity(13);
|
||||
m_Stream.Write(mob.Serial);
|
||||
Stream.Write(mob.Serial);
|
||||
|
||||
m_Stream.Write((short)iconID); //ID
|
||||
m_Stream.Write((short)0x0); //Type 0 for removal. 1 for add 2 for Data
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x0); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
m_Stream.Fill(4);
|
||||
Stream.Fill(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -44,8 +44,8 @@ namespace Server.Misc
|
|||
validItems.Add(item1);
|
||||
|
||||
foreach (VendorInventory inventory in house.VendorInventories)
|
||||
foreach (Item subItem in inventory.Items)
|
||||
validItems.Add(subItem);
|
||||
foreach (Item subItem in inventory.Items)
|
||||
validItems.Add(subItem);
|
||||
}
|
||||
else if (item is BankBox box)
|
||||
{
|
||||
|
|
@ -133,11 +133,7 @@ namespace Server.Misc
|
|||
|| item is TreasureMap || item is MessageInABottle
|
||||
|| item is BaseArmor || item is BaseWeapon
|
||||
|| item is BaseClothing
|
||||
|| item is BaseJewel && Core.AOS
|
||||
|
||||
#region Champion artifacts
|
||||
|
||||
|| item is SkullPole
|
||||
|| (item is BaseJewel && Core.AOS) || item is SkullPole
|
||||
|| item is EvilIdolSkull
|
||||
|| item is MonsterStatuette
|
||||
|| item is Pier
|
||||
|
|
@ -154,9 +150,6 @@ namespace Server.Misc
|
|||
|| item is WindSpirit
|
||||
|| item is DirtPatch
|
||||
|| item is Futon)
|
||||
|
||||
#endregion
|
||||
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -9,28 +9,28 @@ namespace Server.Misc
|
|||
{
|
||||
public class ClientVerification
|
||||
{
|
||||
private static bool m_DetectClientRequirement = true;
|
||||
private static OldClientResponse m_OldClientResponse = OldClientResponse.LenientKick;
|
||||
private static readonly bool m_DetectClientRequirement = true;
|
||||
private static readonly OldClientResponse m_OldClientResponse = OldClientResponse.LenientKick;
|
||||
|
||||
private static TimeSpan m_AgeLeniency = TimeSpan.FromDays(10);
|
||||
private static TimeSpan m_GameTimeLeniency = TimeSpan.FromHours(25);
|
||||
private static readonly TimeSpan m_AgeLeniency = TimeSpan.FromDays(10);
|
||||
private static readonly TimeSpan m_GameTimeLeniency = TimeSpan.FromHours(25);
|
||||
|
||||
public static ClientVersion Required{ get; set; }
|
||||
public static ClientVersion Required { get; set; }
|
||||
|
||||
public static bool AllowRegular{ get; set; } = true;
|
||||
public static bool AllowRegular { get; set; } = true;
|
||||
|
||||
public static bool AllowUOTD{ get; set; } = true;
|
||||
public static bool AllowUOTD { get; set; } = true;
|
||||
|
||||
public static bool AllowGod{ get; set; } = true;
|
||||
public static bool AllowGod { get; set; } = true;
|
||||
|
||||
public static TimeSpan KickDelay{ get; set; } = TimeSpan.FromSeconds(20.0);
|
||||
public static TimeSpan KickDelay { get; set; } = TimeSpan.FromSeconds(20.0);
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
EventSink.ClientVersionReceived += EventSink_ClientVersionReceived;
|
||||
|
||||
//ClientVersion.Required = null;
|
||||
//Required = new ClientVersion( "6.0.0.0" );
|
||||
// ClientVersion.Required = null;
|
||||
// Required = new ClientVersion( "6.0.0.0" );
|
||||
|
||||
if (m_DetectClientRequirement)
|
||||
{
|
||||
|
|
@ -64,10 +64,10 @@ namespace Server.Misc
|
|||
return;
|
||||
|
||||
if (Required != null && version < Required && (m_OldClientResponse == OldClientResponse.Kick ||
|
||||
m_OldClientResponse == OldClientResponse.LenientKick &&
|
||||
(m_OldClientResponse == OldClientResponse.LenientKick &&
|
||||
DateTime.UtcNow - state.Mobile.CreationTime > m_AgeLeniency &&
|
||||
state.Mobile is PlayerMobile mobile &&
|
||||
mobile.GameTime > m_GameTimeLeniency))
|
||||
mobile.GameTime > m_GameTimeLeniency)))
|
||||
{
|
||||
kickMessage = $"This server requires your client version be at least {Required}.";
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ namespace Server.Misc
|
|||
state.Mobile.SendMessage(0x22, kickMessage);
|
||||
state.Mobile.SendMessage(0x22, "You will be disconnected in {0} seconds.", KickDelay.TotalSeconds);
|
||||
|
||||
Timer.DelayCall(KickDelay, delegate
|
||||
Timer.DelayCall(KickDelay, () =>
|
||||
{
|
||||
if (state.Connection != null)
|
||||
{
|
||||
|
|
@ -118,18 +118,18 @@ namespace Server.Misc
|
|||
switch (m_OldClientResponse)
|
||||
{
|
||||
case OldClientResponse.Warn:
|
||||
{
|
||||
state.Mobile.SendMessage(0x22, "Your client is out of date. Please update your client.", Required);
|
||||
state.Mobile.SendMessage(0x22, "This server recommends that your client version be at least {0}.",
|
||||
Required);
|
||||
break;
|
||||
}
|
||||
{
|
||||
state.Mobile.SendMessage(0x22, "Your client is out of date. Please update your client.", Required);
|
||||
state.Mobile.SendMessage(0x22, "This server recommends that your client version be at least {0}.",
|
||||
Required);
|
||||
break;
|
||||
}
|
||||
case OldClientResponse.LenientKick:
|
||||
case OldClientResponse.Annoy:
|
||||
{
|
||||
SendAnnoyGump(state.Mobile);
|
||||
break;
|
||||
}
|
||||
{
|
||||
SendAnnoyGump(state.Mobile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ namespace Server.Misc
|
|||
if (SaveBackup)
|
||||
Backup();
|
||||
|
||||
|
||||
/*if ( Core.Service )
|
||||
/*if (Core.Service)
|
||||
e.Close = true;
|
||||
else */
|
||||
if (RestartServer)
|
||||
|
|
@ -44,7 +43,6 @@ namespace Server.Misc
|
|||
|
||||
if (Email.FROM_ADDRESS != null && Email.CRASH_ADDRESS != null)
|
||||
Email.SendCrashEmail(filePath);
|
||||
|
||||
}
|
||||
|
||||
private static string GetRoot()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Server.Accounting;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
|
|
@ -37,4 +38,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Server
|
|||
{
|
||||
public class DoorGenerator
|
||||
{
|
||||
private static Rectangle2D[] m_BritRegions =
|
||||
private static readonly Rectangle2D[] m_BritRegions =
|
||||
{
|
||||
new Rectangle2D(new Point2D(250, 750), new Point2D(775, 1330)),
|
||||
new Rectangle2D(new Point2D(525, 2095), new Point2D(925, 2430)),
|
||||
|
|
@ -25,17 +25,17 @@ namespace Server
|
|||
new Rectangle2D(new Point2D(5120, 2300), new Point2D(6143, 4095))
|
||||
};
|
||||
|
||||
private static Rectangle2D[] m_IlshRegions =
|
||||
private static readonly Rectangle2D[] m_IlshRegions =
|
||||
{
|
||||
new Rectangle2D(new Point2D(0, 0), new Point2D(288 * 8, 200 * 8))
|
||||
};
|
||||
|
||||
private static Rectangle2D[] m_MalasRegions =
|
||||
private static readonly Rectangle2D[] m_MalasRegions =
|
||||
{
|
||||
new Rectangle2D(new Point2D(0, 0), new Point2D(320 * 8, 256 * 8))
|
||||
};
|
||||
|
||||
private static int[] m_SouthFrames =
|
||||
private static readonly int[] m_SouthFrames =
|
||||
{
|
||||
0x0006,
|
||||
0x0008,
|
||||
|
|
@ -109,7 +109,7 @@ namespace Server
|
|||
0x020A
|
||||
};
|
||||
|
||||
private static int[] m_NorthFrames =
|
||||
private static readonly int[] m_NorthFrames =
|
||||
{
|
||||
0x0006,
|
||||
0x0008,
|
||||
|
|
@ -182,7 +182,7 @@ namespace Server
|
|||
0x020A
|
||||
};
|
||||
|
||||
private static int[] m_EastFrames =
|
||||
private static readonly int[] m_EastFrames =
|
||||
{
|
||||
0x0007,
|
||||
0x000A,
|
||||
|
|
@ -256,7 +256,7 @@ namespace Server
|
|||
0x0209
|
||||
};
|
||||
|
||||
private static int[] m_WestFrames =
|
||||
private static readonly int[] m_WestFrames =
|
||||
{
|
||||
0x0007,
|
||||
0x000C,
|
||||
|
|
@ -475,70 +475,70 @@ namespace Server
|
|||
public static void Generate(Rectangle2D region)
|
||||
{
|
||||
for (int rx = 0; rx < region.Width; ++rx)
|
||||
for (int ry = 0; ry < region.Height; ++ry)
|
||||
{
|
||||
int vx = rx + region.X;
|
||||
int vy = ry + region.Y;
|
||||
|
||||
StaticTile[] tiles = m_Map.Tiles.GetStaticTiles(vx, vy);
|
||||
|
||||
for (int i = 0; i < tiles.Length; ++i)
|
||||
for (int ry = 0; ry < region.Height; ++ry)
|
||||
{
|
||||
StaticTile tile = tiles[i];
|
||||
int vx = rx + region.X;
|
||||
int vy = ry + region.Y;
|
||||
|
||||
int id = tile.ID;
|
||||
int z = tile.Z;
|
||||
StaticTile[] tiles = m_Map.Tiles.GetStaticTiles(vx, vy);
|
||||
|
||||
if (IsWestFrame(id))
|
||||
for (int i = 0; i < tiles.Length; ++i)
|
||||
{
|
||||
if (IsEastFrame(vx + 2, vy, z))
|
||||
{
|
||||
AddDoor(vx + 1, vy, z, DoorFacing.WestCW);
|
||||
}
|
||||
else if (IsEastFrame(vx + 3, vy, z))
|
||||
{
|
||||
BaseDoor first = AddDoor(vx + 1, vy, z, DoorFacing.WestCW);
|
||||
BaseDoor second = AddDoor(vx + 2, vy, z, DoorFacing.EastCCW);
|
||||
StaticTile tile = tiles[i];
|
||||
|
||||
if (first != null && second != null)
|
||||
int id = tile.ID;
|
||||
int z = tile.Z;
|
||||
|
||||
if (IsWestFrame(id))
|
||||
{
|
||||
if (IsEastFrame(vx + 2, vy, z))
|
||||
{
|
||||
first.Link = second;
|
||||
second.Link = first;
|
||||
AddDoor(vx + 1, vy, z, DoorFacing.WestCW);
|
||||
}
|
||||
else
|
||||
else if (IsEastFrame(vx + 3, vy, z))
|
||||
{
|
||||
first?.Delete();
|
||||
BaseDoor first = AddDoor(vx + 1, vy, z, DoorFacing.WestCW);
|
||||
BaseDoor second = AddDoor(vx + 2, vy, z, DoorFacing.EastCCW);
|
||||
|
||||
second?.Delete();
|
||||
if (first != null && second != null)
|
||||
{
|
||||
first.Link = second;
|
||||
second.Link = first;
|
||||
}
|
||||
else
|
||||
{
|
||||
first?.Delete();
|
||||
|
||||
second?.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (IsNorthFrame(id))
|
||||
{
|
||||
if (IsSouthFrame(vx, vy + 2, z))
|
||||
else if (IsNorthFrame(id))
|
||||
{
|
||||
AddDoor(vx, vy + 1, z, DoorFacing.SouthCW);
|
||||
}
|
||||
else if (IsSouthFrame(vx, vy + 3, z))
|
||||
{
|
||||
BaseDoor first = AddDoor(vx, vy + 1, z, DoorFacing.NorthCCW);
|
||||
BaseDoor second = AddDoor(vx, vy + 2, z, DoorFacing.SouthCW);
|
||||
|
||||
if (first != null && second != null)
|
||||
if (IsSouthFrame(vx, vy + 2, z))
|
||||
{
|
||||
first.Link = second;
|
||||
second.Link = first;
|
||||
AddDoor(vx, vy + 1, z, DoorFacing.SouthCW);
|
||||
}
|
||||
else
|
||||
else if (IsSouthFrame(vx, vy + 3, z))
|
||||
{
|
||||
first?.Delete();
|
||||
BaseDoor first = AddDoor(vx, vy + 1, z, DoorFacing.NorthCCW);
|
||||
BaseDoor second = AddDoor(vx, vy + 2, z, DoorFacing.SouthCW);
|
||||
|
||||
second?.Delete();
|
||||
if (first != null && second != null)
|
||||
{
|
||||
first.Link = second;
|
||||
second.Link = first;
|
||||
}
|
||||
else
|
||||
{
|
||||
first?.Delete();
|
||||
|
||||
second?.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using MailKit.Net.Smtp;
|
||||
using MimeKit;
|
||||
using Server.Accounting;
|
||||
using Server.Engines.Help;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
|
|
@ -67,7 +67,6 @@ namespace Server.Misc
|
|||
TextBody = writer.ToString(),
|
||||
HtmlBody = null
|
||||
}.ToMessageBody();
|
||||
|
||||
}
|
||||
SendAsync(message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,24 +10,23 @@ namespace Server
|
|||
private string m_AssemblyName;
|
||||
|
||||
private AppDomain m_AppDomain;
|
||||
private AssemblyBuilder m_AssemblyBuilder;
|
||||
private ModuleBuilder m_ModuleBuilder;
|
||||
private readonly AssemblyBuilder m_AssemblyBuilder;
|
||||
private readonly ModuleBuilder m_ModuleBuilder;
|
||||
|
||||
public AssemblyEmitter( string assemblyName )
|
||||
public AssemblyEmitter(string assemblyName)
|
||||
{
|
||||
m_AssemblyName = assemblyName;
|
||||
|
||||
m_AppDomain = AppDomain.CurrentDomain;
|
||||
|
||||
m_AssemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(
|
||||
new AssemblyName( assemblyName ),
|
||||
AssemblyBuilderAccess.Run
|
||||
);
|
||||
new AssemblyName(assemblyName),
|
||||
AssemblyBuilderAccess.Run);
|
||||
|
||||
m_ModuleBuilder = m_AssemblyBuilder.DefineDynamicModule(assemblyName);
|
||||
}
|
||||
|
||||
public TypeBuilder DefineType( string typeName, TypeAttributes attrs, Type parentType ) => m_ModuleBuilder.DefineType( typeName, attrs, parentType );
|
||||
public TypeBuilder DefineType(string typeName, TypeAttributes attrs, Type parentType) => m_ModuleBuilder.DefineType(typeName, attrs, parentType);
|
||||
}
|
||||
|
||||
public class MethodEmitter
|
||||
|
|
@ -40,13 +39,13 @@ namespace Server
|
|||
|
||||
private class CallInfo
|
||||
{
|
||||
public Type type;
|
||||
public MethodInfo method;
|
||||
public readonly Type type;
|
||||
public readonly MethodInfo method;
|
||||
|
||||
public int index;
|
||||
public ParameterInfo[] parms;
|
||||
public readonly ParameterInfo[] parms;
|
||||
|
||||
public CallInfo( Type type, MethodInfo method )
|
||||
public CallInfo(Type type, MethodInfo method)
|
||||
{
|
||||
this.type = type;
|
||||
this.method = method;
|
||||
|
|
@ -55,14 +54,14 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
private Stack<Type> m_Stack;
|
||||
private Stack<CallInfo> m_Calls;
|
||||
private readonly Stack<Type> m_Stack;
|
||||
private readonly Stack<CallInfo> m_Calls;
|
||||
|
||||
private Dictionary<Type, Queue<LocalBuilder>> m_Temps;
|
||||
private readonly Dictionary<Type, Queue<LocalBuilder>> m_Temps;
|
||||
|
||||
public MethodBuilder Method { get; private set; }
|
||||
|
||||
public MethodEmitter( TypeBuilder typeBuilder )
|
||||
public MethodEmitter(TypeBuilder typeBuilder)
|
||||
{
|
||||
Type = typeBuilder;
|
||||
|
||||
|
|
@ -72,59 +71,59 @@ namespace Server
|
|||
m_Calls = new Stack<CallInfo>();
|
||||
}
|
||||
|
||||
public void Define( string name, MethodAttributes attr, Type returnType, Type[] parms )
|
||||
public void Define(string name, MethodAttributes attr, Type returnType, Type[] parms)
|
||||
{
|
||||
Method = Type.DefineMethod( name, attr, returnType, parms );
|
||||
Method = Type.DefineMethod(name, attr, returnType, parms);
|
||||
Generator = Method.GetILGenerator();
|
||||
|
||||
m_ArgumentTypes = parms;
|
||||
}
|
||||
|
||||
public LocalBuilder CreateLocal( Type localType ) => Generator.DeclareLocal( localType );
|
||||
public LocalBuilder CreateLocal(Type localType) => Generator.DeclareLocal(localType);
|
||||
|
||||
public LocalBuilder AcquireTemp( Type localType )
|
||||
public LocalBuilder AcquireTemp(Type localType)
|
||||
{
|
||||
if (!m_Temps.TryGetValue( localType, out Queue<LocalBuilder> list ))
|
||||
if (!m_Temps.TryGetValue(localType, out Queue<LocalBuilder> list))
|
||||
m_Temps[localType] = list = new Queue<LocalBuilder>();
|
||||
|
||||
return list.Count > 0 ? list.Dequeue() : CreateLocal( localType );
|
||||
return list.Count > 0 ? list.Dequeue() : CreateLocal(localType);
|
||||
}
|
||||
|
||||
public void ReleaseTemp( LocalBuilder local )
|
||||
public void ReleaseTemp(LocalBuilder local)
|
||||
{
|
||||
if (local.LocalType == null)
|
||||
return;
|
||||
|
||||
if (!m_Temps.TryGetValue( local.LocalType, out Queue<LocalBuilder> list ))
|
||||
if (!m_Temps.TryGetValue(local.LocalType, out Queue<LocalBuilder> list))
|
||||
m_Temps[local.LocalType] = list = new Queue<LocalBuilder>();
|
||||
|
||||
list.Enqueue( local );
|
||||
list.Enqueue(local);
|
||||
}
|
||||
|
||||
public void Branch( Label label )
|
||||
public void Branch(Label label)
|
||||
{
|
||||
Generator.Emit( OpCodes.Br, label );
|
||||
Generator.Emit(OpCodes.Br, label);
|
||||
}
|
||||
|
||||
public void BranchIfFalse( Label label )
|
||||
public void BranchIfFalse(Label label)
|
||||
{
|
||||
Pop( typeof( object ) );
|
||||
Pop(typeof(object));
|
||||
|
||||
Generator.Emit( OpCodes.Brfalse, label );
|
||||
Generator.Emit(OpCodes.Brfalse, label);
|
||||
}
|
||||
|
||||
public void BranchIfTrue( Label label )
|
||||
public void BranchIfTrue(Label label)
|
||||
{
|
||||
Pop( typeof( object ) );
|
||||
Pop(typeof(object));
|
||||
|
||||
Generator.Emit( OpCodes.Brtrue, label );
|
||||
Generator.Emit(OpCodes.Brtrue, label);
|
||||
}
|
||||
|
||||
public Label CreateLabel() => Generator.DefineLabel();
|
||||
|
||||
public void MarkLabel( Label label )
|
||||
public void MarkLabel(Label label)
|
||||
{
|
||||
Generator.MarkLabel( label );
|
||||
Generator.MarkLabel(label);
|
||||
}
|
||||
|
||||
public void Pop()
|
||||
|
|
@ -132,323 +131,323 @@ namespace Server
|
|||
m_Stack.Pop();
|
||||
}
|
||||
|
||||
public void Pop( Type expected )
|
||||
public void Pop(Type expected)
|
||||
{
|
||||
if ( expected == null )
|
||||
throw new InvalidOperationException( "Expected type cannot be null." );
|
||||
if (expected == null)
|
||||
throw new InvalidOperationException("Expected type cannot be null.");
|
||||
|
||||
Type onStack = m_Stack.Pop();
|
||||
|
||||
if ( expected == typeof( bool ) )
|
||||
expected = typeof( int );
|
||||
if (expected == typeof(bool))
|
||||
expected = typeof(int);
|
||||
|
||||
if ( onStack == typeof( bool ) )
|
||||
onStack = typeof( int );
|
||||
if (onStack == typeof(bool))
|
||||
onStack = typeof(int);
|
||||
|
||||
if ( !expected.IsAssignableFrom( onStack ) )
|
||||
throw new InvalidOperationException( "Unexpected stack state." );
|
||||
if (!expected.IsAssignableFrom(onStack))
|
||||
throw new InvalidOperationException("Unexpected stack state.");
|
||||
}
|
||||
|
||||
public void Push( Type type )
|
||||
public void Push(Type type)
|
||||
{
|
||||
m_Stack.Push( type );
|
||||
m_Stack.Push(type);
|
||||
}
|
||||
|
||||
public void Return()
|
||||
{
|
||||
if ( m_Stack.Count != ( Method.ReturnType == typeof( void ) ? 0 : 1 ) )
|
||||
throw new InvalidOperationException( "Stack return mismatch." );
|
||||
if (m_Stack.Count != (Method.ReturnType == typeof(void) ? 0 : 1))
|
||||
throw new InvalidOperationException("Stack return mismatch.");
|
||||
|
||||
Generator.Emit( OpCodes.Ret );
|
||||
Generator.Emit(OpCodes.Ret);
|
||||
}
|
||||
|
||||
public void LoadNull()
|
||||
{
|
||||
LoadNull( typeof( object ) );
|
||||
LoadNull(typeof(object));
|
||||
}
|
||||
|
||||
public void LoadNull( Type type )
|
||||
public void LoadNull(Type type)
|
||||
{
|
||||
Push( type );
|
||||
Push(type);
|
||||
|
||||
Generator.Emit( OpCodes.Ldnull );
|
||||
Generator.Emit(OpCodes.Ldnull);
|
||||
}
|
||||
|
||||
public void Load( string value )
|
||||
public void Load(string value)
|
||||
{
|
||||
Push( typeof( string ) );
|
||||
Push(typeof(string));
|
||||
|
||||
if ( value != null )
|
||||
Generator.Emit( OpCodes.Ldstr, value );
|
||||
if (value != null)
|
||||
Generator.Emit(OpCodes.Ldstr, value);
|
||||
else
|
||||
Generator.Emit( OpCodes.Ldnull );
|
||||
Generator.Emit(OpCodes.Ldnull);
|
||||
}
|
||||
|
||||
public void Load( Enum value )
|
||||
public void Load(Enum value)
|
||||
{
|
||||
int toLoad = ((IConvertible)value).ToInt32( null );
|
||||
Load( toLoad );
|
||||
int toLoad = ((IConvertible)value).ToInt32(null);
|
||||
Load(toLoad);
|
||||
|
||||
Pop();
|
||||
Push( value.GetType() );
|
||||
Push(value.GetType());
|
||||
}
|
||||
|
||||
public void Load( long value )
|
||||
public void Load(long value)
|
||||
{
|
||||
Push( typeof( long ) );
|
||||
Push(typeof(long));
|
||||
|
||||
Generator.Emit( OpCodes.Ldc_I8, value );
|
||||
Generator.Emit(OpCodes.Ldc_I8, value);
|
||||
}
|
||||
|
||||
public void Load( float value )
|
||||
public void Load(float value)
|
||||
{
|
||||
Push( typeof( float ) );
|
||||
Push(typeof(float));
|
||||
|
||||
Generator.Emit( OpCodes.Ldc_R4, value );
|
||||
Generator.Emit(OpCodes.Ldc_R4, value);
|
||||
}
|
||||
|
||||
public void Load( double value )
|
||||
public void Load(double value)
|
||||
{
|
||||
Push( typeof( double ) );
|
||||
Push(typeof(double));
|
||||
|
||||
Generator.Emit( OpCodes.Ldc_R8, value );
|
||||
Generator.Emit(OpCodes.Ldc_R8, value);
|
||||
}
|
||||
|
||||
public void Load( char value )
|
||||
public void Load(char value)
|
||||
{
|
||||
Load( (int) value );
|
||||
Load((int)value);
|
||||
|
||||
Pop();
|
||||
Push( typeof( char ) );
|
||||
Push(typeof(char));
|
||||
}
|
||||
|
||||
public void Load( bool value )
|
||||
public void Load(bool value)
|
||||
{
|
||||
Push( typeof( bool ) );
|
||||
Push(typeof(bool));
|
||||
|
||||
if ( value )
|
||||
Generator.Emit( OpCodes.Ldc_I4_1 );
|
||||
if (value)
|
||||
Generator.Emit(OpCodes.Ldc_I4_1);
|
||||
else
|
||||
Generator.Emit( OpCodes.Ldc_I4_0 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_0);
|
||||
}
|
||||
|
||||
public void Load( int value )
|
||||
public void Load(int value)
|
||||
{
|
||||
Push( typeof( int ) );
|
||||
Push(typeof(int));
|
||||
|
||||
switch ( value )
|
||||
switch (value)
|
||||
{
|
||||
case -1:
|
||||
Generator.Emit( OpCodes.Ldc_I4_M1 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_M1);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
Generator.Emit( OpCodes.Ldc_I4_0 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Generator.Emit( OpCodes.Ldc_I4_1 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Generator.Emit( OpCodes.Ldc_I4_2 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Generator.Emit( OpCodes.Ldc_I4_3 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_3);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Generator.Emit( OpCodes.Ldc_I4_4 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_4);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
Generator.Emit( OpCodes.Ldc_I4_5 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_5);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
Generator.Emit( OpCodes.Ldc_I4_6 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_6);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
Generator.Emit( OpCodes.Ldc_I4_7 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_7);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
Generator.Emit( OpCodes.Ldc_I4_8 );
|
||||
Generator.Emit(OpCodes.Ldc_I4_8);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( value >= sbyte.MinValue && value <= sbyte.MaxValue )
|
||||
Generator.Emit( OpCodes.Ldc_I4_S, (sbyte) value );
|
||||
if (value >= sbyte.MinValue && value <= sbyte.MaxValue)
|
||||
Generator.Emit(OpCodes.Ldc_I4_S, (sbyte)value);
|
||||
else
|
||||
Generator.Emit( OpCodes.Ldc_I4, value );
|
||||
Generator.Emit(OpCodes.Ldc_I4, value);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadField( FieldInfo field )
|
||||
public void LoadField(FieldInfo field)
|
||||
{
|
||||
Pop( field.DeclaringType );
|
||||
Pop(field.DeclaringType);
|
||||
|
||||
Push( field.FieldType );
|
||||
Push(field.FieldType);
|
||||
|
||||
Generator.Emit( OpCodes.Ldfld, field );
|
||||
Generator.Emit(OpCodes.Ldfld, field);
|
||||
}
|
||||
|
||||
public void LoadLocal( LocalBuilder local )
|
||||
public void LoadLocal(LocalBuilder local)
|
||||
{
|
||||
Push( local.LocalType );
|
||||
Push(local.LocalType);
|
||||
|
||||
int index = local.LocalIndex;
|
||||
|
||||
switch ( index )
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
Generator.Emit( OpCodes.Ldloc_0 );
|
||||
Generator.Emit(OpCodes.Ldloc_0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Generator.Emit( OpCodes.Ldloc_1 );
|
||||
Generator.Emit(OpCodes.Ldloc_1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Generator.Emit( OpCodes.Ldloc_2 );
|
||||
Generator.Emit(OpCodes.Ldloc_2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Generator.Emit( OpCodes.Ldloc_3 );
|
||||
Generator.Emit(OpCodes.Ldloc_3);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( index >= byte.MinValue && index <= byte.MinValue )
|
||||
Generator.Emit( OpCodes.Ldloc_S, (byte) index );
|
||||
if (index >= byte.MinValue && index <= byte.MinValue)
|
||||
Generator.Emit(OpCodes.Ldloc_S, (byte)index);
|
||||
else
|
||||
Generator.Emit( OpCodes.Ldloc, (short) index );
|
||||
Generator.Emit(OpCodes.Ldloc, (short)index);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreLocal( LocalBuilder local )
|
||||
public void StoreLocal(LocalBuilder local)
|
||||
{
|
||||
Pop( local.LocalType );
|
||||
Pop(local.LocalType);
|
||||
|
||||
Generator.Emit( OpCodes.Stloc, local );
|
||||
Generator.Emit(OpCodes.Stloc, local);
|
||||
}
|
||||
|
||||
public void LoadArgument( int index )
|
||||
public void LoadArgument(int index)
|
||||
{
|
||||
if ( index > 0 )
|
||||
Push( m_ArgumentTypes[index - 1] );
|
||||
if (index > 0)
|
||||
Push(m_ArgumentTypes[index - 1]);
|
||||
else
|
||||
Push( Type );
|
||||
Push(Type);
|
||||
|
||||
switch ( index )
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
Generator.Emit( OpCodes.Ldarg_0 );
|
||||
Generator.Emit(OpCodes.Ldarg_0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Generator.Emit( OpCodes.Ldarg_1 );
|
||||
Generator.Emit(OpCodes.Ldarg_1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Generator.Emit( OpCodes.Ldarg_2 );
|
||||
Generator.Emit(OpCodes.Ldarg_2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Generator.Emit( OpCodes.Ldarg_3 );
|
||||
Generator.Emit(OpCodes.Ldarg_3);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( index >= byte.MinValue && index <= byte.MaxValue )
|
||||
Generator.Emit( OpCodes.Ldarg_S, (byte) index );
|
||||
if (index >= byte.MinValue && index <= byte.MaxValue)
|
||||
Generator.Emit(OpCodes.Ldarg_S, (byte)index);
|
||||
else
|
||||
Generator.Emit( OpCodes.Ldarg, (short) index );
|
||||
Generator.Emit(OpCodes.Ldarg, (short)index);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void CastAs( Type type )
|
||||
public void CastAs(Type type)
|
||||
{
|
||||
Pop( typeof( object ) );
|
||||
Push( type );
|
||||
Pop(typeof(object));
|
||||
Push(type);
|
||||
|
||||
Generator.Emit( OpCodes.Isinst, type );
|
||||
Generator.Emit(OpCodes.Isinst, type);
|
||||
}
|
||||
|
||||
public void Neg()
|
||||
{
|
||||
Pop( typeof( int ) );
|
||||
Pop(typeof(int));
|
||||
|
||||
Push( typeof( int ) );
|
||||
Push(typeof(int));
|
||||
|
||||
Generator.Emit( OpCodes.Neg );
|
||||
Generator.Emit(OpCodes.Neg);
|
||||
}
|
||||
|
||||
public void Compare( OpCode opCode )
|
||||
public void Compare(OpCode opCode)
|
||||
{
|
||||
Pop();
|
||||
Pop();
|
||||
|
||||
Push( typeof( int ) );
|
||||
Push(typeof(int));
|
||||
|
||||
Generator.Emit( opCode );
|
||||
Generator.Emit(opCode);
|
||||
}
|
||||
|
||||
public void LogicalNot()
|
||||
{
|
||||
Pop( typeof( int ) );
|
||||
Pop(typeof(int));
|
||||
|
||||
Push( typeof( int ) );
|
||||
Push(typeof(int));
|
||||
|
||||
Generator.Emit( OpCodes.Ldc_I4_0 );
|
||||
Generator.Emit( OpCodes.Ceq );
|
||||
Generator.Emit(OpCodes.Ldc_I4_0);
|
||||
Generator.Emit(OpCodes.Ceq);
|
||||
}
|
||||
|
||||
public void Xor()
|
||||
{
|
||||
Pop( typeof( int ) );
|
||||
Pop( typeof( int ) );
|
||||
Pop(typeof(int));
|
||||
Pop(typeof(int));
|
||||
|
||||
Push( typeof( int ) );
|
||||
Push(typeof(int));
|
||||
|
||||
Generator.Emit( OpCodes.Xor );
|
||||
Generator.Emit(OpCodes.Xor);
|
||||
}
|
||||
|
||||
public Type Active => m_Stack.Peek();
|
||||
|
||||
public void Chain( Property prop )
|
||||
public void Chain(Property prop)
|
||||
{
|
||||
for ( int i = 0; i < prop.Chain.Length; ++i )
|
||||
Call( prop.Chain[i].GetGetMethod() );
|
||||
for (int i = 0; i < prop.Chain.Length; ++i)
|
||||
Call(prop.Chain[i].GetGetMethod());
|
||||
}
|
||||
|
||||
public void Call( MethodInfo method )
|
||||
public void Call(MethodInfo method)
|
||||
{
|
||||
BeginCall( method );
|
||||
BeginCall(method);
|
||||
|
||||
CallInfo call = m_Calls.Peek();
|
||||
|
||||
if ( call.parms.Length > 0 )
|
||||
throw new InvalidOperationException( "Method requires parameters." );
|
||||
if (call.parms.Length > 0)
|
||||
throw new InvalidOperationException("Method requires parameters.");
|
||||
|
||||
FinishCall();
|
||||
}
|
||||
|
||||
public delegate void Callback();
|
||||
|
||||
public bool CompareTo( int sign, Callback argGenerator )
|
||||
public bool CompareTo(int sign, Callback argGenerator)
|
||||
{
|
||||
Type active = Active;
|
||||
|
||||
MethodInfo compareTo = active.GetMethod( "CompareTo", new[] { active } );
|
||||
MethodInfo compareTo = active.GetMethod("CompareTo", new[] { active });
|
||||
|
||||
if ( compareTo == null )
|
||||
if (compareTo == null)
|
||||
{
|
||||
/* This gets a little tricky...
|
||||
*
|
||||
|
|
@ -475,25 +474,25 @@ namespace Server
|
|||
|
||||
Type[] ifaces = active.FindInterfaces((type, obj) => type.IsGenericType
|
||||
&& type.GetGenericTypeDefinition() == typeof(IComparable<>)
|
||||
&& type.GetGenericArguments()[0].IsAssignableFrom(active), null );
|
||||
&& type.GetGenericArguments()[0].IsAssignableFrom(active), null);
|
||||
|
||||
if ( ifaces.Length > 0 )
|
||||
if (ifaces.Length > 0)
|
||||
{
|
||||
compareTo = ifaces[0].GetMethod( "CompareTo", new[] { active } );
|
||||
compareTo = ifaces[0].GetMethod("CompareTo", new[] { active });
|
||||
}
|
||||
else
|
||||
{
|
||||
ifaces = active.FindInterfaces((type, obj) => type == typeof(IComparable), null );
|
||||
ifaces = active.FindInterfaces((type, obj) => type == typeof(IComparable), null);
|
||||
|
||||
if ( ifaces.Length > 0 )
|
||||
compareTo = ifaces[0].GetMethod( "CompareTo", new[] { active } );
|
||||
if (ifaces.Length > 0)
|
||||
compareTo = ifaces[0].GetMethod("CompareTo", new[] { active });
|
||||
}
|
||||
}
|
||||
|
||||
if ( compareTo == null )
|
||||
if (compareTo == null)
|
||||
return false;
|
||||
|
||||
if ( !active.IsValueType )
|
||||
if (!active.IsValueType)
|
||||
{
|
||||
/* This object is a reference type, so we have to make it behave
|
||||
*
|
||||
|
|
@ -503,23 +502,23 @@ namespace Server
|
|||
*
|
||||
*/
|
||||
|
||||
LocalBuilder aValue = AcquireTemp( active );
|
||||
LocalBuilder bValue = AcquireTemp( active );
|
||||
LocalBuilder aValue = AcquireTemp(active);
|
||||
LocalBuilder bValue = AcquireTemp(active);
|
||||
|
||||
StoreLocal( aValue );
|
||||
StoreLocal(aValue);
|
||||
|
||||
argGenerator();
|
||||
|
||||
StoreLocal( bValue );
|
||||
StoreLocal(bValue);
|
||||
|
||||
/* if ( aValue == null )
|
||||
/* if (aValue == null)
|
||||
* {
|
||||
* if ( bValue == null )
|
||||
* if (bValue == null)
|
||||
* v = 0;
|
||||
* else
|
||||
* v = +1;
|
||||
* }
|
||||
* else if ( bValue == null )
|
||||
* else if (bValue == null)
|
||||
* {
|
||||
* v = -1;
|
||||
* }
|
||||
|
|
@ -533,65 +532,65 @@ namespace Server
|
|||
|
||||
Label aNotNull = CreateLabel();
|
||||
|
||||
LoadLocal( aValue );
|
||||
BranchIfTrue( aNotNull );
|
||||
// if ( aValue == null )
|
||||
LoadLocal(aValue);
|
||||
BranchIfTrue(aNotNull);
|
||||
// if (aValue == null)
|
||||
{
|
||||
Label bNotNull = CreateLabel();
|
||||
|
||||
LoadLocal( bValue );
|
||||
BranchIfTrue( bNotNull );
|
||||
// if ( bValue == null )
|
||||
LoadLocal(bValue);
|
||||
BranchIfTrue(bNotNull);
|
||||
// if (bValue == null)
|
||||
{
|
||||
Load( 0 );
|
||||
Pop( typeof( int ) );
|
||||
Branch( store );
|
||||
Load(0);
|
||||
Pop(typeof(int));
|
||||
Branch(store);
|
||||
}
|
||||
MarkLabel( bNotNull );
|
||||
MarkLabel(bNotNull);
|
||||
// else
|
||||
{
|
||||
Load( sign );
|
||||
Pop( typeof( int ) );
|
||||
Branch( store );
|
||||
Load(sign);
|
||||
Pop(typeof(int));
|
||||
Branch(store);
|
||||
}
|
||||
}
|
||||
MarkLabel( aNotNull );
|
||||
MarkLabel(aNotNull);
|
||||
// else
|
||||
{
|
||||
Label bNotNull = CreateLabel();
|
||||
|
||||
LoadLocal( bValue );
|
||||
BranchIfTrue( bNotNull );
|
||||
LoadLocal(bValue);
|
||||
BranchIfTrue(bNotNull);
|
||||
// bValue == null
|
||||
{
|
||||
Load( -sign );
|
||||
Pop( typeof( int ) );
|
||||
Branch( store );
|
||||
Load(-sign);
|
||||
Pop(typeof(int));
|
||||
Branch(store);
|
||||
}
|
||||
MarkLabel( bNotNull );
|
||||
MarkLabel(bNotNull);
|
||||
// else
|
||||
{
|
||||
LoadLocal( aValue );
|
||||
BeginCall( compareTo );
|
||||
LoadLocal(aValue);
|
||||
BeginCall(compareTo);
|
||||
|
||||
LoadLocal( bValue );
|
||||
LoadLocal(bValue);
|
||||
ArgumentPushed();
|
||||
|
||||
FinishCall();
|
||||
|
||||
if ( sign == -1 )
|
||||
if (sign == -1)
|
||||
Neg();
|
||||
}
|
||||
}
|
||||
|
||||
MarkLabel( store );
|
||||
MarkLabel(store);
|
||||
|
||||
ReleaseTemp( aValue );
|
||||
ReleaseTemp( bValue );
|
||||
ReleaseTemp(aValue);
|
||||
ReleaseTemp(bValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
BeginCall( compareTo );
|
||||
BeginCall(compareTo);
|
||||
|
||||
argGenerator();
|
||||
|
||||
|
|
@ -599,32 +598,32 @@ namespace Server
|
|||
|
||||
FinishCall();
|
||||
|
||||
if ( sign == -1 )
|
||||
if (sign == -1)
|
||||
Neg();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void BeginCall( MethodInfo method )
|
||||
public void BeginCall(MethodInfo method)
|
||||
{
|
||||
Type type;
|
||||
|
||||
if ( ( method.CallingConvention & CallingConventions.HasThis ) != 0 )
|
||||
if ((method.CallingConvention & CallingConventions.HasThis) != 0)
|
||||
type = m_Stack.Peek();
|
||||
else
|
||||
type = method.DeclaringType;
|
||||
|
||||
m_Calls.Push( new CallInfo( type, method ) );
|
||||
m_Calls.Push(new CallInfo(type, method));
|
||||
|
||||
if ( type.IsValueType )
|
||||
if (type.IsValueType)
|
||||
{
|
||||
LocalBuilder temp = AcquireTemp( type );
|
||||
LocalBuilder temp = AcquireTemp(type);
|
||||
|
||||
Generator.Emit( OpCodes.Stloc, temp );
|
||||
Generator.Emit( OpCodes.Ldloca, temp );
|
||||
Generator.Emit(OpCodes.Stloc, temp);
|
||||
Generator.Emit(OpCodes.Ldloca, temp);
|
||||
|
||||
ReleaseTemp( temp );
|
||||
ReleaseTemp(temp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -632,22 +631,22 @@ namespace Server
|
|||
{
|
||||
CallInfo call = m_Calls.Pop();
|
||||
|
||||
if ( ( call.type.IsValueType || call.type.IsByRef ) && call.method.DeclaringType != call.type )
|
||||
Generator.Emit( OpCodes.Constrained, call.type );
|
||||
if ((call.type.IsValueType || call.type.IsByRef) && call.method.DeclaringType != call.type)
|
||||
Generator.Emit(OpCodes.Constrained, call.type);
|
||||
|
||||
if ( call.method.DeclaringType?.IsValueType == true || call.method.IsStatic )
|
||||
Generator.Emit( OpCodes.Call, call.method );
|
||||
if (call.method.DeclaringType?.IsValueType == true || call.method.IsStatic)
|
||||
Generator.Emit(OpCodes.Call, call.method);
|
||||
else
|
||||
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 );
|
||||
for (int i = call.parms.Length - 1; i >= 0; --i)
|
||||
Pop(call.parms[i].ParameterType);
|
||||
|
||||
if ( ( call.method.CallingConvention & CallingConventions.HasThis ) != 0 )
|
||||
Pop( call.method.DeclaringType );
|
||||
if ((call.method.CallingConvention & CallingConventions.HasThis) != 0)
|
||||
Pop(call.method.DeclaringType);
|
||||
|
||||
if ( call.method.ReturnType != typeof( void ) )
|
||||
Push( call.method.ReturnType );
|
||||
if (call.method.ReturnType != typeof(void))
|
||||
Push(call.method.ReturnType);
|
||||
}
|
||||
|
||||
public void ArgumentPushed()
|
||||
|
|
@ -658,11 +657,11 @@ namespace Server
|
|||
|
||||
Type argumentType = m_Stack.Peek();
|
||||
|
||||
if ( !parm.ParameterType.IsAssignableFrom( argumentType ) )
|
||||
throw new InvalidOperationException( "Parameter type mismatch." );
|
||||
if (!parm.ParameterType.IsAssignableFrom(argumentType))
|
||||
throw new InvalidOperationException("Parameter type mismatch.");
|
||||
|
||||
if ( argumentType.IsValueType && !parm.ParameterType.IsValueType )
|
||||
Generator.Emit( OpCodes.Box, argumentType );
|
||||
if (argumentType.IsValueType && !parm.ParameterType.IsValueType)
|
||||
Generator.Emit(OpCodes.Box, argumentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ namespace Server.Misc
|
|||
// As of B36 PlayerMobile implements movement packet throttling which more reliably controls movement speeds
|
||||
public static class Fastwalk
|
||||
{
|
||||
private static int MaxSteps = 4; // Maximum number of queued steps until fastwalk is detected
|
||||
private static bool Enabled = false; // Is fastwalk detection enabled?
|
||||
private static bool UOTDOverride = false; // Should UO:TD clients not be checked for fastwalk?
|
||||
private static readonly int MaxSteps = 4; // Maximum number of queued steps until fastwalk is detected
|
||||
private static readonly bool Enabled = false; // Is fastwalk detection enabled?
|
||||
private static readonly bool UOTDOverride = false; // Should UO:TD clients not be checked for fastwalk?
|
||||
|
||||
private static AccessLevel
|
||||
private static readonly AccessLevel
|
||||
AccessOverride = AccessLevel.GameMaster; // Anyone with this or higher access level is not checked for fastwalk
|
||||
|
||||
public static void Initialize()
|
||||
|
|
@ -26,7 +26,7 @@ namespace Server.Misc
|
|||
|
||||
public static void OnFastWalk(FastWalkEventArgs e)
|
||||
{
|
||||
e.Blocked = true; //disallow this fastwalk
|
||||
e.Blocked = true; // disallow this fastwalk
|
||||
Console.WriteLine("Client: {0}: Fast movement detected (name={1})", e.NetState, e.NetState.Mobile.Name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,11 +211,11 @@ namespace Server.Misc
|
|||
Quadrant = quadrant;
|
||||
}
|
||||
|
||||
public Point2D Point{ get; }
|
||||
public Point2D Point { get; }
|
||||
|
||||
public int Angle{ get; }
|
||||
public int Angle { get; }
|
||||
|
||||
public int Quadrant{ get; }
|
||||
public int Quadrant { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ namespace Server.Items
|
|||
[Flippable(0x236E, 0x2371)]
|
||||
public class LightOfTheWinterSolstice : Item
|
||||
{
|
||||
private static string[] m_StaffNames =
|
||||
private static readonly string[] m_StaffNames =
|
||||
{
|
||||
"Aenima",
|
||||
"Alkiser",
|
||||
|
|
@ -12,14 +12,14 @@ namespace Server.Items
|
|||
"Krrios",
|
||||
"Mark",
|
||||
"Merlin",
|
||||
"Merlix", //LordMerlix
|
||||
"Merlix", // LordMerlix
|
||||
"Phantom",
|
||||
"Phenos",
|
||||
"psz",
|
||||
"Ryan",
|
||||
"Quantos",
|
||||
"Outkast", //TheOutkastDev
|
||||
"V", //Admin_V
|
||||
"Outkast", // TheOutkastDev
|
||||
"V", // Admin_V
|
||||
"Zippy"
|
||||
};
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Dipper{ get; set; }
|
||||
public string Dipper { get; set; }
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
|
|
@ -75,15 +75,15 @@ namespace Server.Items
|
|||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Dipper = reader.ReadString();
|
||||
break;
|
||||
}
|
||||
{
|
||||
Dipper = reader.ReadString();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Dipper = m_StaffNames[Utility.Random(m_StaffNames.Length)];
|
||||
break;
|
||||
}
|
||||
{
|
||||
Dipper = m_StaffNames[Utility.Random(m_StaffNames.Length)];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Dipper != null)
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ namespace Server.Items
|
|||
|
||||
private class MistletoeAddonGump : Gump
|
||||
{
|
||||
private MistletoeAddon m_Addon;
|
||||
private Mobile m_From;
|
||||
private readonly MistletoeAddon m_Addon;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public MistletoeAddonGump(Mobile from, MistletoeAddon addon) : base(150, 50)
|
||||
{
|
||||
|
|
@ -282,9 +282,9 @@ namespace Server.Items
|
|||
|
||||
private class MistletoeDeedGump : Gump
|
||||
{
|
||||
private MistletoeDeed m_Deed;
|
||||
private Mobile m_From;
|
||||
private Point3D m_Loc;
|
||||
private readonly MistletoeDeed m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
private readonly Point3D m_Loc;
|
||||
|
||||
public MistletoeDeedGump(Mobile from, Point3D loc, MistletoeDeed deed) : base(150, 50)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage(1010097); // You cannot use this while mounted.
|
||||
}
|
||||
|
||||
else if (from.CanBeginAction<SnowPile>())
|
||||
{
|
||||
from.SendLocalizedMessage(1005575); // You carefully pack the snow into a ball...
|
||||
|
|
@ -78,7 +77,7 @@ namespace Server.Items
|
|||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(5.0)) => m_From = from;
|
||||
|
||||
|
|
@ -147,4 +146,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage(1010097); // You cannot use this while mounted.
|
||||
}
|
||||
|
||||
else if (from.CanBeginAction<SnowPile>())
|
||||
{
|
||||
from.SendLocalizedMessage(1005575); // You carefully pack the snow into a ball...
|
||||
|
|
@ -64,7 +63,7 @@ namespace Server.Items
|
|||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(5.0)) => m_From = from;
|
||||
|
||||
|
|
@ -133,4 +132,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
#region Ranks
|
||||
|
||||
[Flags]
|
||||
public enum RankFlags
|
||||
{
|
||||
|
|
@ -34,13 +32,13 @@ namespace Server.Guilds
|
|||
{
|
||||
public static RankDefinition[] Ranks =
|
||||
{
|
||||
new RankDefinition(1062963, 0, RankFlags.None), //Ronin
|
||||
new RankDefinition(1062962, 1, RankFlags.Member), //Member
|
||||
new RankDefinition(1062963, 0, RankFlags.None), // Ronin
|
||||
new RankDefinition(1062962, 1, RankFlags.Member), // Member
|
||||
new RankDefinition(1062961, 2,
|
||||
RankFlags.Member | RankFlags.RemovePlayers | RankFlags.CanInvitePlayer | RankFlags.CanSetGuildTitle |
|
||||
RankFlags.CanPromoteDemote), //Emmissary
|
||||
new RankDefinition(1062960, 3, RankFlags.Member | RankFlags.ControlWarStatus), //Warlord
|
||||
new RankDefinition(1062959, 4, RankFlags.All) //Leader
|
||||
RankFlags.CanPromoteDemote), // Emmissary
|
||||
new RankDefinition(1062960, 3, RankFlags.Member | RankFlags.ControlWarStatus), // Warlord
|
||||
new RankDefinition(1062959, 4, RankFlags.All) // Leader
|
||||
};
|
||||
|
||||
public RankDefinition(TextDefinition name, int rank, RankFlags flags)
|
||||
|
|
@ -54,11 +52,11 @@ namespace Server.Guilds
|
|||
public static RankDefinition Member => Ranks[1];
|
||||
public static RankDefinition Lowest => Ranks[0];
|
||||
|
||||
public TextDefinition Name{ get; }
|
||||
public TextDefinition Name { get; }
|
||||
|
||||
public int Rank{ get; }
|
||||
public int Rank { get; }
|
||||
|
||||
public RankFlags Flags{ get; private set; }
|
||||
public RankFlags Flags { get; private set; }
|
||||
|
||||
public bool GetFlag(RankFlags flag) => (Flags & flag) != 0;
|
||||
|
||||
|
|
@ -71,15 +69,11 @@ namespace Server.Guilds
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Alliances
|
||||
|
||||
public class AllianceInfo
|
||||
{
|
||||
private Guild m_Leader;
|
||||
private List<Guild> m_Members;
|
||||
private List<Guild> m_PendingMembers;
|
||||
private readonly List<Guild> m_Members;
|
||||
private readonly List<Guild> m_PendingMembers;
|
||||
|
||||
public AllianceInfo(Guild leader, string name, Guild partner)
|
||||
{
|
||||
|
|
@ -103,21 +97,21 @@ namespace Server.Guilds
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Name = reader.ReadString();
|
||||
m_Leader = reader.ReadGuild() as Guild;
|
||||
{
|
||||
Name = reader.ReadString();
|
||||
m_Leader = reader.ReadGuild() as Guild;
|
||||
|
||||
m_Members = reader.ReadStrongGuildList<Guild>();
|
||||
m_PendingMembers = reader.ReadStrongGuildList<Guild>();
|
||||
m_Members = reader.ReadStrongGuildList<Guild>();
|
||||
m_PendingMembers = reader.ReadStrongGuildList<Guild>();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<string, AllianceInfo> Alliances{ get; } = new Dictionary<string, AllianceInfo>();
|
||||
public static Dictionary<string, AllianceInfo> Alliances { get; } = new Dictionary<string, AllianceInfo>();
|
||||
|
||||
public string Name{ get; }
|
||||
public string Name { get; }
|
||||
|
||||
public Guild Leader
|
||||
{
|
||||
|
|
@ -172,7 +166,7 @@ namespace Server.Guilds
|
|||
|
||||
public void Serialize(IGenericWriter writer)
|
||||
{
|
||||
writer.Write(0); //Version
|
||||
writer.Write(0); // Version
|
||||
|
||||
writer.Write(Name);
|
||||
writer.Write(m_Leader);
|
||||
|
|
@ -209,7 +203,7 @@ namespace Server.Guilds
|
|||
{
|
||||
if (m_PendingMembers.Contains(g)) m_PendingMembers.Remove(g);
|
||||
|
||||
if (m_Members.Contains(g)) //Sanity, just incase someone with a custom script adds a character to BOTH arrays
|
||||
if (m_Members.Contains(g)) // Sanity, just incase someone with a custom script adds a character to BOTH arrays
|
||||
{
|
||||
m_Members.Remove(g);
|
||||
g.InvalidateMemberProperties();
|
||||
|
|
@ -218,9 +212,9 @@ namespace Server.Guilds
|
|||
AllianceMessage(1070764, g.Name); // A Guild has left your Alliance: ~1_GUILDNAME~
|
||||
}
|
||||
|
||||
//g.Alliance = null; //NO G.Alliance call here. Set the Guild's Alliance to null, if you JUST use RemoveGuild, it removes it from the alliance, but doesn't remove the link from the guild to the alliance. setting g.Alliance will call this method.
|
||||
//to check on OSI: have 3 guilds, make 2 of them a member, one pending. remove one of the memebers. alliance still exist?
|
||||
//ANSWER: NO
|
||||
// g.Alliance = null; //NO G.Alliance call here. Set the Guild's Alliance to null, if you JUST use RemoveGuild, it removes it from the alliance, but doesn't remove the link from the guild to the alliance. setting g.Alliance will call this method.
|
||||
// to check on OSI: have 3 guilds, make 2 of them a member, one pending. remove one of the memebers. alliance still exist?
|
||||
// ANSWER: NO
|
||||
|
||||
if (g == m_Leader) CalculateAllianceLeader();
|
||||
|
||||
|
|
@ -260,7 +254,7 @@ namespace Server.Guilds
|
|||
|
||||
public class AllianceRosterGump : GuildDiplomacyGump
|
||||
{
|
||||
private AllianceInfo m_Alliance;
|
||||
private readonly AllianceInfo m_Alliance;
|
||||
|
||||
public AllianceRosterGump(PlayerMobile pm, Guild g, AllianceInfo alliance) : base(pm, g, true, "", 0,
|
||||
alliance.m_Members, alliance.Name) =>
|
||||
|
|
@ -279,13 +273,11 @@ namespace Server.Guilds
|
|||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID != 8) //So that they can't get to the AdvancedSearch button
|
||||
if (info.ButtonID != 8) // So that they can't get to the AdvancedSearch button
|
||||
base.OnResponse(sender, info);
|
||||
}
|
||||
}
|
||||
|
||||
#region Alliance[Text]Message(...)
|
||||
|
||||
public void AllianceMessage(int num, bool append, string format, params object[] args)
|
||||
{
|
||||
AllianceMessage(num, append, string.Format(format, args));
|
||||
|
|
@ -361,14 +353,8 @@ namespace Server.Guilds
|
|||
|
||||
AllianceChat(from, pm?.AllianceMessageHue ?? 0x3B2, text);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Wars
|
||||
|
||||
public enum WarStatus
|
||||
{
|
||||
InProgress = -1,
|
||||
|
|
@ -396,36 +382,36 @@ namespace Server.Guilds
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Kills = reader.ReadInt();
|
||||
MaxKills = reader.ReadInt();
|
||||
{
|
||||
Kills = reader.ReadInt();
|
||||
MaxKills = reader.ReadInt();
|
||||
|
||||
WarLength = reader.ReadTimeSpan();
|
||||
WarBeginning = reader.ReadDateTime();
|
||||
WarLength = reader.ReadTimeSpan();
|
||||
WarBeginning = reader.ReadDateTime();
|
||||
|
||||
Guild = reader.ReadGuild() as Guild;
|
||||
Opponent = reader.ReadGuild() as Guild;
|
||||
Guild = reader.ReadGuild() as Guild;
|
||||
Opponent = reader.ReadGuild() as Guild;
|
||||
|
||||
WarRequester = reader.ReadBool();
|
||||
WarRequester = reader.ReadBool();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int Kills{ get; set; }
|
||||
public int Kills { get; set; }
|
||||
|
||||
public int MaxKills{ get; set; }
|
||||
public int MaxKills { get; set; }
|
||||
|
||||
public TimeSpan WarLength{ get; set; }
|
||||
public TimeSpan WarLength { get; set; }
|
||||
|
||||
public Guild Opponent{ get; }
|
||||
public Guild Opponent { get; }
|
||||
|
||||
public Guild Guild{ get; }
|
||||
public Guild Guild { get; }
|
||||
|
||||
public DateTime WarBeginning{ get; set; }
|
||||
public DateTime WarBeginning { get; set; }
|
||||
|
||||
public bool WarRequester{ get; set; }
|
||||
public bool WarRequester { get; set; }
|
||||
|
||||
public WarStatus Status
|
||||
{
|
||||
|
|
@ -467,7 +453,7 @@ namespace Server.Guilds
|
|||
|
||||
public void Serialize(IGenericWriter writer)
|
||||
{
|
||||
writer.Write(0); //version
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(Kills);
|
||||
writer.Write(MaxKills);
|
||||
|
|
@ -499,8 +485,6 @@ namespace Server.Guilds
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public class Guild : BaseGuild
|
||||
{
|
||||
public static readonly int RegistrationFee = 25000;
|
||||
|
|
@ -511,8 +495,6 @@ namespace Server.Guilds
|
|||
|
||||
public Guild(Mobile leader, string name, string abbreviation)
|
||||
{
|
||||
#region Ctor mumbo-jumbo
|
||||
|
||||
m_Leader = leader;
|
||||
|
||||
Members = new List<Mobile>();
|
||||
|
|
@ -539,11 +521,9 @@ namespace Server.Guilds
|
|||
|
||||
AcceptedWars = new List<WarDeclaration>();
|
||||
PendingWars = new List<WarDeclaration>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public Guild(uint id) : base(id) //serialization ctor
|
||||
public Guild(uint id) : base(id) // serialization ctor
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -563,7 +543,7 @@ namespace Server.Guilds
|
|||
set
|
||||
{
|
||||
if (value != null)
|
||||
AddMember(value); //Also removes from old guild.
|
||||
AddMember(value); // Also removes from old guild.
|
||||
|
||||
if (m_Leader is PlayerMobile leader && leader.Guild == this)
|
||||
leader.GuildRank = RankDefinition.Member;
|
||||
|
|
@ -575,7 +555,6 @@ namespace Server.Guilds
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public override bool Disbanded => m_Leader?.Deleted != false;
|
||||
|
||||
public static void Configure()
|
||||
|
|
@ -636,7 +615,7 @@ namespace Server.Guilds
|
|||
{
|
||||
m_Leader = null;
|
||||
|
||||
List.Remove(Id);
|
||||
List.Remove(Serial);
|
||||
|
||||
foreach (Mobile m in Members)
|
||||
{
|
||||
|
|
@ -668,8 +647,6 @@ namespace Server.Guilds
|
|||
Alliance = null;
|
||||
}
|
||||
|
||||
#region GuildProps
|
||||
|
||||
[Usage("GuildProps")]
|
||||
[Description(
|
||||
"Opens a menu where you can view and edit guild properties of a targeted player or guild stone. If the new Guild system is active, also brings up the guild gump.")]
|
||||
|
|
@ -742,10 +719,6 @@ namespace Server.Guilds
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventSinks
|
||||
|
||||
public static void EventSink_GuildGumpRequest(Mobile m)
|
||||
{
|
||||
if (!NewGuildSystem || !(m is PlayerMobile pm))
|
||||
|
|
@ -762,11 +735,6 @@ namespace Server.Guilds
|
|||
args.Guild = new Guild(args.Id);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region New Alliances
|
||||
|
||||
public AllianceInfo Alliance
|
||||
{
|
||||
get
|
||||
|
|
@ -824,14 +792,9 @@ namespace Server.Guilds
|
|||
return g;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region New Wars
|
||||
|
||||
public List<WarDeclaration> PendingWars{ get; private set; }
|
||||
|
||||
public List<WarDeclaration> AcceptedWars{ get; private set; }
|
||||
public List<WarDeclaration> PendingWars { get; private set; }
|
||||
|
||||
public List<WarDeclaration> AcceptedWars { get; private set; }
|
||||
|
||||
public WarDeclaration FindPendingWar(Guild g)
|
||||
{
|
||||
|
|
@ -919,7 +882,7 @@ namespace Server.Guilds
|
|||
|
||||
if (w.Status != WarStatus.Pending)
|
||||
{
|
||||
//All sanity in here
|
||||
// All sanity in here
|
||||
PendingWars.Remove(w);
|
||||
|
||||
g?.PendingWars.Remove(g.FindPendingWar(this));
|
||||
|
|
@ -953,10 +916,6 @@ namespace Server.Guilds
|
|||
victimGuild.CheckExpiredWars();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Var declarations
|
||||
|
||||
private Mobile m_Leader;
|
||||
|
||||
private string m_Name;
|
||||
|
|
@ -967,15 +926,11 @@ namespace Server.Guilds
|
|||
private AllianceInfo m_AllianceInfo;
|
||||
private Guild m_AllianceLeader;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Is<something>(...)
|
||||
|
||||
public bool IsMember(Mobile m) => Members.Contains(m);
|
||||
|
||||
public bool IsAlly(Guild g) => NewGuildSystem ? Alliance?.IsMember(this) == true && Alliance.IsMember(g) : Allies.Contains(g);
|
||||
|
||||
public bool IsEnemy(Guild g) => Type != GuildType.Regular && g.Type != GuildType.Regular && Type != g.Type || IsWar(g);
|
||||
public bool IsEnemy(Guild g) => (Type != GuildType.Regular && g.Type != GuildType.Regular && Type != g.Type) || IsWar(g);
|
||||
|
||||
public bool IsWar(Guild g)
|
||||
{
|
||||
|
|
@ -989,13 +944,8 @@ namespace Server.Guilds
|
|||
Guild otherGuild = GetAllianceLeader(g);
|
||||
|
||||
return guild.FindActiveWar(otherGuild) != null;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Serialization
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
if (LastFealty + TimeSpan.FromDays(1.0) < DateTime.UtcNow)
|
||||
|
|
@ -1005,9 +955,7 @@ namespace Server.Guilds
|
|||
|
||||
Alliance?.CheckLeader();
|
||||
|
||||
writer.Write(5); //version
|
||||
|
||||
#region War Serialization
|
||||
writer.Write(5); // version
|
||||
|
||||
writer.Write(PendingWars.Count);
|
||||
|
||||
|
|
@ -1017,10 +965,6 @@ namespace Server.Guilds
|
|||
|
||||
for (int i = 0; i < AcceptedWars.Count; i++) AcceptedWars[i].Serialize(writer);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Alliances
|
||||
|
||||
bool isAllianceLeader = m_AllianceLeader == null && m_AllianceInfo != null;
|
||||
writer.Write(isAllianceLeader);
|
||||
|
||||
|
|
@ -1029,8 +973,6 @@ namespace Server.Guilds
|
|||
else
|
||||
writer.Write(m_AllianceLeader);
|
||||
|
||||
#endregion
|
||||
|
||||
//
|
||||
|
||||
writer.WriteGuildList(AllyDeclarations, true);
|
||||
|
|
@ -1069,78 +1011,77 @@ namespace Server.Guilds
|
|||
switch (version)
|
||||
{
|
||||
case 5:
|
||||
{
|
||||
int count = reader.ReadInt();
|
||||
{
|
||||
int count = reader.ReadInt();
|
||||
|
||||
PendingWars = new List<WarDeclaration>();
|
||||
for (int i = 0; i < count; i++) PendingWars.Add(new WarDeclaration(reader));
|
||||
PendingWars = new List<WarDeclaration>();
|
||||
for (int i = 0; i < count; i++) PendingWars.Add(new WarDeclaration(reader));
|
||||
|
||||
count = reader.ReadInt();
|
||||
AcceptedWars = new List<WarDeclaration>();
|
||||
for (int i = 0; i < count; i++) AcceptedWars.Add(new WarDeclaration(reader));
|
||||
count = reader.ReadInt();
|
||||
AcceptedWars = new List<WarDeclaration>();
|
||||
for (int i = 0; i < count; i++) AcceptedWars.Add(new WarDeclaration(reader));
|
||||
|
||||
bool isAllianceLeader = reader.ReadBool();
|
||||
bool isAllianceLeader = reader.ReadBool();
|
||||
|
||||
if (isAllianceLeader)
|
||||
m_AllianceInfo = new AllianceInfo(reader);
|
||||
else
|
||||
m_AllianceLeader = reader.ReadGuild() as Guild;
|
||||
if (isAllianceLeader)
|
||||
m_AllianceInfo = new AllianceInfo(reader);
|
||||
else
|
||||
m_AllianceLeader = reader.ReadGuild() as Guild;
|
||||
|
||||
|
||||
goto case 4;
|
||||
}
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
AllyDeclarations = reader.ReadStrongGuildList<Guild>();
|
||||
AllyInvitations = reader.ReadStrongGuildList<Guild>();
|
||||
{
|
||||
AllyDeclarations = reader.ReadStrongGuildList<Guild>();
|
||||
AllyInvitations = reader.ReadStrongGuildList<Guild>();
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
goto case 3;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
TypeLastChange = reader.ReadDateTime();
|
||||
{
|
||||
TypeLastChange = reader.ReadDateTime();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
goto case 2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_Type = (GuildType)reader.ReadInt();
|
||||
{
|
||||
m_Type = (GuildType)reader.ReadInt();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
LastFealty = reader.ReadDateTime();
|
||||
{
|
||||
LastFealty = reader.ReadDateTime();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Leader = reader.ReadMobile();
|
||||
{
|
||||
m_Leader = reader.ReadMobile();
|
||||
|
||||
if (m_Leader is PlayerMobile mobile)
|
||||
mobile.GuildRank = RankDefinition.Leader;
|
||||
if (m_Leader is PlayerMobile mobile)
|
||||
mobile.GuildRank = RankDefinition.Leader;
|
||||
|
||||
m_Name = reader.ReadString();
|
||||
m_Abbreviation = reader.ReadString();
|
||||
m_Name = reader.ReadString();
|
||||
m_Abbreviation = reader.ReadString();
|
||||
|
||||
Allies = reader.ReadStrongGuildList<Guild>();
|
||||
Enemies = reader.ReadStrongGuildList<Guild>();
|
||||
WarDeclarations = reader.ReadStrongGuildList<Guild>();
|
||||
WarInvitations = reader.ReadStrongGuildList<Guild>();
|
||||
Allies = reader.ReadStrongGuildList<Guild>();
|
||||
Enemies = reader.ReadStrongGuildList<Guild>();
|
||||
WarDeclarations = reader.ReadStrongGuildList<Guild>();
|
||||
WarInvitations = reader.ReadStrongGuildList<Guild>();
|
||||
|
||||
Members = reader.ReadStrongMobileList();
|
||||
Candidates = reader.ReadStrongMobileList();
|
||||
Accepted = reader.ReadStrongMobileList();
|
||||
Members = reader.ReadStrongMobileList();
|
||||
Candidates = reader.ReadStrongMobileList();
|
||||
Accepted = reader.ReadStrongMobileList();
|
||||
|
||||
Guildstone = reader.ReadItem();
|
||||
Teleporter = reader.ReadItem();
|
||||
Guildstone = reader.ReadItem();
|
||||
Teleporter = reader.ReadItem();
|
||||
|
||||
Charter = reader.ReadString();
|
||||
Website = reader.ReadString();
|
||||
Charter = reader.ReadString();
|
||||
Website = reader.ReadString();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AllyDeclarations ??= new List<Guild>();
|
||||
|
|
@ -1153,7 +1094,7 @@ namespace Server.Guilds
|
|||
|
||||
private void VerifyGuild_Callback()
|
||||
{
|
||||
if (!NewGuildSystem && Guildstone == null || Members.Count == 0)
|
||||
if ((!NewGuildSystem && Guildstone == null) || Members.Count == 0)
|
||||
Disband();
|
||||
|
||||
CheckExpiredWars();
|
||||
|
|
@ -1162,17 +1103,12 @@ namespace Server.Guilds
|
|||
|
||||
alliance?.CheckLeader();
|
||||
|
||||
alliance = Alliance; //CheckLeader could possibly change the value of this.Alliance
|
||||
alliance = Alliance; // CheckLeader could possibly change the value of this.Alliance
|
||||
|
||||
if (alliance?.IsMember(this) == false && !alliance.IsPendingMember(this)
|
||||
) //This block is there to fix a bug in the code in an older version.
|
||||
Alliance = null; //Will call Alliance.RemoveGuild which will set it null & perform all the pertient checks as far as alliacne disbanding
|
||||
if (alliance?.IsMember(this) == false && !alliance.IsPendingMember(this)) // This block is there to fix a bug in the code in an older version.
|
||||
Alliance = null; // Will call Alliance.RemoveGuild which will set it null & perform all the pertient checks as far as alliacne disbanding
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Add/Remove Member/Old Ally/Old Enemy
|
||||
|
||||
public void AddMember(Mobile m)
|
||||
{
|
||||
if (!Members.Contains(m))
|
||||
|
|
@ -1265,10 +1201,6 @@ namespace Server.Guilds
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Guild[Text]Message(...)
|
||||
|
||||
public void GuildMessage(int num, bool append, string format, params object[] args)
|
||||
{
|
||||
GuildMessage(num, append, string.Format(format, args));
|
||||
|
|
@ -1338,15 +1270,11 @@ namespace Server.Guilds
|
|||
GuildChat(from, (from as PlayerMobile)?.GuildMessageHue ?? 0x3B2, text);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Voting
|
||||
|
||||
public bool CanVote(Mobile m) =>
|
||||
(!NewGuildSystem || m is PlayerMobile pm && pm.GuildRank.GetFlag(RankFlags.CanVote)) &&
|
||||
(!NewGuildSystem || (m is PlayerMobile pm && pm.GuildRank.GetFlag(RankFlags.CanVote))) &&
|
||||
m?.Deleted == false && m.Guild == this;
|
||||
|
||||
public bool CanBeVotedFor(Mobile m) => (!NewGuildSystem || m is PlayerMobile pm && pm.LastOnline + InactiveTime >= DateTime.UtcNow) && m?.Deleted == false && m.Guild == this;
|
||||
public bool CanBeVotedFor(Mobile m) => (!NewGuildSystem || (m is PlayerMobile pm && pm.LastOnline + InactiveTime >= DateTime.UtcNow)) && m?.Deleted == false && m.Guild == this;
|
||||
|
||||
public void CalculateGuildmaster()
|
||||
{
|
||||
|
|
@ -1404,15 +1332,11 @@ namespace Server.Guilds
|
|||
LastFealty = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Getters & Setters
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Item Guildstone { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Item Guildstone{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Item Teleporter{ get; set; }
|
||||
public Item Teleporter { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public override string Name
|
||||
|
|
@ -1429,7 +1353,7 @@ namespace Server.Guilds
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Website{ get; set; }
|
||||
public string Website { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public override string Abbreviation
|
||||
|
|
@ -1446,7 +1370,7 @@ namespace Server.Guilds
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Charter{ get; set; }
|
||||
public string Charter { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public override GuildType Type
|
||||
|
|
@ -1465,29 +1389,27 @@ namespace Server.Guilds
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime LastFealty{ get; set; }
|
||||
public DateTime LastFealty { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime TypeLastChange{ get; private set; }
|
||||
public DateTime TypeLastChange { get; private set; }
|
||||
|
||||
public List<Guild> Allies{ get; private set; }
|
||||
public List<Guild> Allies { get; private set; }
|
||||
|
||||
public List<Guild> Enemies{ get; private set; }
|
||||
public List<Guild> Enemies { get; private set; }
|
||||
|
||||
public List<Guild> AllyDeclarations{ get; private set; }
|
||||
public List<Guild> AllyDeclarations { get; private set; }
|
||||
|
||||
public List<Guild> AllyInvitations{ get; private set; }
|
||||
public List<Guild> AllyInvitations { get; private set; }
|
||||
|
||||
public List<Guild> WarDeclarations{ get; private set; }
|
||||
public List<Guild> WarDeclarations { get; private set; }
|
||||
|
||||
public List<Guild> WarInvitations{ get; private set; }
|
||||
public List<Guild> WarInvitations { get; private set; }
|
||||
|
||||
public List<Mobile> Candidates{ get; private set; }
|
||||
public List<Mobile> Candidates { get; private set; }
|
||||
|
||||
public List<Mobile> Accepted{ get; private set; }
|
||||
public List<Mobile> Accepted { get; private set; }
|
||||
|
||||
public List<Mobile> Members{ get; private set; }
|
||||
|
||||
#endregion
|
||||
public List<Mobile> Members { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,82 +10,82 @@ namespace Server
|
|||
public class HardwareInfo
|
||||
{
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CpuModel{ get; private set; }
|
||||
public int CpuModel { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CpuClockSpeed{ get; private set; }
|
||||
public int CpuClockSpeed { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CpuQuantity{ get; private set; }
|
||||
public int CpuQuantity { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int OSMajor{ get; private set; }
|
||||
public int OSMajor { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int OSMinor{ get; private set; }
|
||||
public int OSMinor { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int OSRevision{ get; private set; }
|
||||
public int OSRevision { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int InstanceID{ get; private set; }
|
||||
public int InstanceID { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ScreenWidth{ get; private set; }
|
||||
public int ScreenWidth { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ScreenHeight{ get; private set; }
|
||||
public int ScreenHeight { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ScreenDepth{ get; private set; }
|
||||
public int ScreenDepth { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int PhysicalMemory{ get; private set; }
|
||||
public int PhysicalMemory { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CpuManufacturer{ get; private set; }
|
||||
public int CpuManufacturer { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CpuFamily{ get; private set; }
|
||||
public int CpuFamily { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int VCVendorID{ get; private set; }
|
||||
public int VCVendorID { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int VCDeviceID{ get; private set; }
|
||||
public int VCDeviceID { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int VCMemory{ get; private set; }
|
||||
public int VCMemory { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int DXMajor{ get; private set; }
|
||||
public int DXMajor { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int DXMinor{ get; private set; }
|
||||
public int DXMinor { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string VCDescription{ get; private set; }
|
||||
public string VCDescription { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Language{ get; private set; }
|
||||
public string Language { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Distribution{ get; private set; }
|
||||
public int Distribution { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ClientsRunning{ get; private set; }
|
||||
public int ClientsRunning { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ClientsInstalled{ get; private set; }
|
||||
public int ClientsInstalled { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int PartialInstalled{ get; private set; }
|
||||
public int PartialInstalled { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Unknown{ get; private set; }
|
||||
public string Unknown { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime TimeReceived{ get; private set; }
|
||||
public DateTime TimeReceived { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ namespace Server.Misc
|
|||
[Flags]
|
||||
public enum IHSFlags
|
||||
{
|
||||
None = 0x00,
|
||||
OnDamaged = 0x01,
|
||||
OnDeath = 0x02,
|
||||
OnMovement = 0x04,
|
||||
OnSpeech = 0x08,
|
||||
All = OnDamaged | OnDeath | OnMovement
|
||||
None = 0x00,
|
||||
OnDamaged = 0x01,
|
||||
OnDeath = 0x02,
|
||||
OnMovement = 0x04,
|
||||
OnSpeech = 0x08,
|
||||
All = OnDamaged | OnDeath | OnMovement
|
||||
} // NOTE: To enable monster conversations, add " | OnSpeech" to the "All" line
|
||||
|
||||
public class InhumanSpeech
|
||||
|
|
@ -23,7 +23,7 @@ namespace Server.Misc
|
|||
{
|
||||
get
|
||||
{
|
||||
if ( m_RatmanSpeech == null )
|
||||
if (m_RatmanSpeech == null)
|
||||
{
|
||||
m_RatmanSpeech = new InhumanSpeech();
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ namespace Server.Misc
|
|||
{
|
||||
get
|
||||
{
|
||||
if ( m_OrcSpeech == null )
|
||||
if (m_OrcSpeech == null)
|
||||
{
|
||||
m_OrcSpeech = new InhumanSpeech();
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ namespace Server.Misc
|
|||
{
|
||||
get
|
||||
{
|
||||
if ( m_LizardmanSpeech == null )
|
||||
if (m_LizardmanSpeech == null)
|
||||
{
|
||||
m_LizardmanSpeech = new InhumanSpeech();
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ namespace Server.Misc
|
|||
{
|
||||
get
|
||||
{
|
||||
if ( m_WispSpeech == null )
|
||||
if (m_WispSpeech == null)
|
||||
{
|
||||
m_WispSpeech = new InhumanSpeech();
|
||||
|
||||
|
|
@ -286,8 +286,8 @@ namespace Server.Misc
|
|||
set
|
||||
{
|
||||
m_Keywords = value;
|
||||
m_KeywordHash = new Dictionary<string, string>( m_Keywords.Length, StringComparer.OrdinalIgnoreCase );
|
||||
for ( int i = 0; i < m_Keywords.Length; ++i )
|
||||
m_KeywordHash = new Dictionary<string, string>(m_Keywords.Length, StringComparer.OrdinalIgnoreCase);
|
||||
for (int i = 0; i < m_Keywords.Length; ++i)
|
||||
m_KeywordHash[m_Keywords[i]] = m_Keywords[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -300,174 +300,174 @@ namespace Server.Misc
|
|||
|
||||
public IHSFlags Flags { get; set; }
|
||||
|
||||
public string GetRandomSyllable() => Syllables[Utility.Random( Syllables.Length )];
|
||||
public string GetRandomSyllable() => Syllables[Utility.Random(Syllables.Length)];
|
||||
|
||||
public string ConstructWord( int syllableCount )
|
||||
public string ConstructWord(int syllableCount)
|
||||
{
|
||||
string[] syllables = new string[syllableCount];
|
||||
|
||||
for ( int i = 0; i < syllableCount; ++i )
|
||||
for (int i = 0; i < syllableCount; ++i)
|
||||
syllables[i] = GetRandomSyllable();
|
||||
|
||||
return string.Concat( syllables );
|
||||
return string.Concat(syllables);
|
||||
}
|
||||
|
||||
public string ConstructSentance( int wordCount )
|
||||
public string ConstructSentance(int wordCount)
|
||||
{
|
||||
StringBuilder sentance = new StringBuilder();
|
||||
|
||||
bool needUpperCase = true;
|
||||
|
||||
for ( int i = 0; i < wordCount; ++i )
|
||||
for (int i = 0; i < wordCount; ++i)
|
||||
{
|
||||
if ( i > 0 ) // not first word )
|
||||
if (i > 0) // not first word)
|
||||
{
|
||||
int random = Utility.RandomMinMax( 1, 15 );
|
||||
int random = Utility.RandomMinMax(1, 15);
|
||||
|
||||
if ( random < 11 )
|
||||
if (random < 11)
|
||||
{
|
||||
sentance.Append( ' ' );
|
||||
sentance.Append(' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
needUpperCase = true;
|
||||
|
||||
if ( random > 13 )
|
||||
sentance.Append( "! " );
|
||||
if (random > 13)
|
||||
sentance.Append("! ");
|
||||
else
|
||||
sentance.Append( ". " );
|
||||
sentance.Append(". ");
|
||||
}
|
||||
}
|
||||
|
||||
int syllableCount;
|
||||
|
||||
if ( 30 > Utility.Random( 100 ) )
|
||||
syllableCount = Utility.Random( 1, 5 );
|
||||
if (Utility.Random(100) < 30)
|
||||
syllableCount = Utility.Random(1, 5);
|
||||
else
|
||||
syllableCount = Utility.Random( 1, 3 );
|
||||
syllableCount = Utility.Random(1, 3);
|
||||
|
||||
string word = ConstructWord( syllableCount );
|
||||
string word = ConstructWord(syllableCount);
|
||||
|
||||
sentance.Append( word );
|
||||
sentance.Append(word);
|
||||
|
||||
if ( needUpperCase )
|
||||
sentance.Replace( word[0], char.ToUpper( word[0] ), sentance.Length - word.Length, 1 );
|
||||
if (needUpperCase)
|
||||
sentance.Replace(word[0], char.ToUpper(word[0]), sentance.Length - word.Length, 1);
|
||||
|
||||
needUpperCase = false;
|
||||
}
|
||||
|
||||
if ( Utility.RandomMinMax( 1, 5 ) == 1 )
|
||||
sentance.Append( '!' );
|
||||
if (Utility.RandomMinMax(1, 5) == 1)
|
||||
sentance.Append('!');
|
||||
else
|
||||
sentance.Append( '.' );
|
||||
sentance.Append('.');
|
||||
|
||||
return sentance.ToString();
|
||||
}
|
||||
|
||||
public void SayRandomTranslate( Mobile mob, params string[] sentancesInEnglish )
|
||||
public void SayRandomTranslate(Mobile mob, params string[] sentancesInEnglish)
|
||||
{
|
||||
SaySentance( mob, Utility.RandomMinMax( 2, 3 ) );
|
||||
mob.Say( sentancesInEnglish[Utility.Random( sentancesInEnglish.Length )] );
|
||||
SaySentance(mob, Utility.RandomMinMax(2, 3));
|
||||
mob.Say(sentancesInEnglish[Utility.Random(sentancesInEnglish.Length)]);
|
||||
}
|
||||
|
||||
private string GetRandomResponseWord( List<string> keywordsFound )
|
||||
private string GetRandomResponseWord(List<string> keywordsFound)
|
||||
{
|
||||
int random = Utility.Random( keywordsFound.Count + Responses.Length );
|
||||
int random = Utility.Random(keywordsFound.Count + Responses.Length);
|
||||
|
||||
if ( random < keywordsFound.Count )
|
||||
if (random < keywordsFound.Count)
|
||||
return keywordsFound[random];
|
||||
|
||||
return Responses[random - keywordsFound.Count];
|
||||
}
|
||||
|
||||
public bool OnSpeech( Mobile mob, Mobile speaker, string text )
|
||||
public bool OnSpeech(Mobile mob, Mobile speaker, string text)
|
||||
{
|
||||
if ( (Flags & IHSFlags.OnSpeech) == 0 || m_Keywords == null || 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 )
|
||||
if (!speaker.Alive)
|
||||
return false;
|
||||
|
||||
if ( !speaker.InRange( mob, 3 ) )
|
||||
if (!speaker.InRange(mob, 3))
|
||||
return false;
|
||||
|
||||
if ( (speaker.Direction & Direction.Mask) != speaker.GetDirectionTo( mob ) )
|
||||
if ((speaker.Direction & Direction.Mask) != speaker.GetDirectionTo(mob))
|
||||
return false;
|
||||
|
||||
if ( (mob.Direction & Direction.Mask) != mob.GetDirectionTo( speaker ) )
|
||||
if ((mob.Direction & Direction.Mask) != mob.GetDirectionTo(speaker))
|
||||
return false;
|
||||
|
||||
string[] split = text.Split( ' ' );
|
||||
string[] split = text.Split(' ');
|
||||
List<string> keywordsFound = new List<string>();
|
||||
|
||||
for ( int i = 0; i < split.Length; ++i )
|
||||
if (m_KeywordHash.TryGetValue( split[i], out string keyword ))
|
||||
keywordsFound.Add( keyword );
|
||||
for (int i = 0; i < split.Length; ++i)
|
||||
if (m_KeywordHash.TryGetValue(split[i], out string keyword))
|
||||
keywordsFound.Add(keyword);
|
||||
|
||||
if ( keywordsFound.Count > 0 )
|
||||
if (keywordsFound.Count > 0)
|
||||
{
|
||||
string responseWord;
|
||||
|
||||
if ( Utility.RandomBool() )
|
||||
responseWord = GetRandomResponseWord( keywordsFound );
|
||||
if (Utility.RandomBool())
|
||||
responseWord = GetRandomResponseWord(keywordsFound);
|
||||
else
|
||||
responseWord = keywordsFound[Utility.Random( keywordsFound.Count )];
|
||||
responseWord = keywordsFound[Utility.Random(keywordsFound.Count)];
|
||||
|
||||
string secondResponseWord = GetRandomResponseWord( keywordsFound );
|
||||
string secondResponseWord = GetRandomResponseWord(keywordsFound);
|
||||
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
||||
switch ( Utility.Random( 6 ) )
|
||||
switch (Utility.Random(6))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
{
|
||||
response.Append( "Me " ).Append( responseWord ).Append( '?' );
|
||||
break;
|
||||
}
|
||||
{
|
||||
response.Append("Me ").Append(responseWord).Append('?');
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
response.Append( responseWord ).Append( " thee!" );
|
||||
response.Replace( responseWord[0], char.ToUpper( responseWord[0] ), 0, 1 );
|
||||
break;
|
||||
}
|
||||
{
|
||||
response.Append(responseWord).Append(" thee!");
|
||||
response.Replace(responseWord[0], char.ToUpper(responseWord[0]), 0, 1);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
response.Append( responseWord ).Append( '?' );
|
||||
response.Replace( responseWord[0], char.ToUpper( responseWord[0] ), 0, 1 );
|
||||
break;
|
||||
}
|
||||
{
|
||||
response.Append(responseWord).Append('?');
|
||||
response.Replace(responseWord[0], char.ToUpper(responseWord[0]), 0, 1);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
response.Append( responseWord ).Append( "! " ).Append( secondResponseWord ).Append( '.' );
|
||||
response.Replace( responseWord[0], char.ToUpper( responseWord[0] ), 0, 1 );
|
||||
response.Replace( secondResponseWord[0], char.ToUpper( secondResponseWord[0] ), responseWord.Length + 2, 1 );
|
||||
break;
|
||||
}
|
||||
{
|
||||
response.Append(responseWord).Append("! ").Append(secondResponseWord).Append('.');
|
||||
response.Replace(responseWord[0], char.ToUpper(responseWord[0]), 0, 1);
|
||||
response.Replace(secondResponseWord[0], char.ToUpper(secondResponseWord[0]), responseWord.Length + 2, 1);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
response.Append( responseWord ).Append( '.' );
|
||||
response.Replace( responseWord[0], char.ToUpper( responseWord[0] ), 0, 1 );
|
||||
break;
|
||||
}
|
||||
{
|
||||
response.Append(responseWord).Append('.');
|
||||
response.Replace(responseWord[0], char.ToUpper(responseWord[0]), 0, 1);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
response.Append( responseWord ).Append( "? " ).Append( secondResponseWord ).Append( '.' );
|
||||
response.Replace( responseWord[0], char.ToUpper( responseWord[0] ), 0, 1 );
|
||||
response.Replace( secondResponseWord[0], char.ToUpper( secondResponseWord[0] ), responseWord.Length + 2, 1 );
|
||||
break;
|
||||
}
|
||||
{
|
||||
response.Append(responseWord).Append("? ").Append(secondResponseWord).Append('.');
|
||||
response.Replace(responseWord[0], char.ToUpper(responseWord[0]), 0, 1);
|
||||
response.Replace(secondResponseWord[0], char.ToUpper(secondResponseWord[0]), responseWord.Length + 2, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int maxWords = split.Length / 2 + 1;
|
||||
|
||||
if ( maxWords < 2 )
|
||||
if (maxWords < 2)
|
||||
maxWords = 2;
|
||||
else if ( maxWords > 6 )
|
||||
else if (maxWords > 6)
|
||||
maxWords = 6;
|
||||
|
||||
SaySentance( mob, Utility.RandomMinMax( 2, maxWords ) );
|
||||
mob.Say( response.ToString() );
|
||||
SaySentance(mob, Utility.RandomMinMax(2, maxWords));
|
||||
mob.Say(response.ToString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -475,15 +475,15 @@ namespace Server.Misc
|
|||
return false;
|
||||
}
|
||||
|
||||
public void OnDeath( Mobile mob )
|
||||
public void OnDeath(Mobile mob)
|
||||
{
|
||||
if ( (Flags & IHSFlags.OnDeath) == 0 )
|
||||
if ((Flags & IHSFlags.OnDeath) == 0)
|
||||
return; // not enabled
|
||||
|
||||
if ( 90 > Utility.Random( 100 ) )
|
||||
if (Utility.Random(100) < 90)
|
||||
return; // 90% chance to do nothing; 10% chance to talk
|
||||
|
||||
SayRandomTranslate( mob,
|
||||
SayRandomTranslate(mob,
|
||||
"Revenge!",
|
||||
"NOOooo!",
|
||||
"I... I...",
|
||||
|
|
@ -491,61 +491,61 @@ namespace Server.Misc
|
|||
"Me die!",
|
||||
"Must... not die...",
|
||||
"Oooh, me hurt...",
|
||||
"Me dying?" );
|
||||
"Me dying?");
|
||||
}
|
||||
|
||||
public void OnMovement( Mobile mob, Mobile mover, Point3D oldLocation )
|
||||
public void OnMovement(Mobile mob, Mobile mover, Point3D oldLocation)
|
||||
{
|
||||
if ( (Flags & IHSFlags.OnMovement) == 0 )
|
||||
if ((Flags & IHSFlags.OnMovement) == 0)
|
||||
return; // not enabled
|
||||
|
||||
if ( !mover.Player || mover.Hidden && mover.AccessLevel > AccessLevel.Player )
|
||||
if (!mover.Player || (mover.Hidden && mover.AccessLevel > AccessLevel.Player))
|
||||
return;
|
||||
|
||||
if ( !mob.InRange( mover, 5 ) || mob.InRange( oldLocation, 5 ) )
|
||||
if (!mob.InRange(mover, 5) || mob.InRange(oldLocation, 5))
|
||||
return; // only talk when they enter 5 tile range
|
||||
|
||||
if ( 90 > Utility.Random( 100 ) )
|
||||
if (Utility.Random(100) < 90)
|
||||
return; // 90% chance to do nothing; 10% chance to talk
|
||||
|
||||
SaySentance( mob, 6 );
|
||||
SaySentance(mob, 6);
|
||||
}
|
||||
|
||||
public void OnDamage( Mobile mob, int amount )
|
||||
public void OnDamage(Mobile mob, int amount)
|
||||
{
|
||||
if ( (Flags & IHSFlags.OnDamaged) == 0 )
|
||||
if ((Flags & IHSFlags.OnDamaged) == 0)
|
||||
return; // not enabled
|
||||
|
||||
if ( 90 > Utility.Random( 100 ) )
|
||||
if (Utility.Random(100) < 90)
|
||||
return; // 90% chance to do nothing; 10% chance to talk
|
||||
|
||||
if ( amount < 5 )
|
||||
SayRandomTranslate( mob,
|
||||
if (amount < 5)
|
||||
SayRandomTranslate(mob,
|
||||
"Ouch!",
|
||||
"Me not hurt bad!",
|
||||
"Thou fight bad.",
|
||||
"Thy blows soft!",
|
||||
"You bad with weapon!" );
|
||||
"You bad with weapon!");
|
||||
else
|
||||
SayRandomTranslate( mob,
|
||||
SayRandomTranslate(mob,
|
||||
"Ouch! Me hurt!",
|
||||
"No, kill me not!",
|
||||
"Me hurt!",
|
||||
"Away with thee!",
|
||||
"Oof! That hurt!",
|
||||
"Aaah! That hurt...",
|
||||
"Good blow!" );
|
||||
"Good blow!");
|
||||
}
|
||||
|
||||
public void OnConstruct( Mobile mob )
|
||||
public void OnConstruct(Mobile mob)
|
||||
{
|
||||
mob.SpeechHue = Hue;
|
||||
}
|
||||
|
||||
public void SaySentance( Mobile mob, int wordCount )
|
||||
public void SaySentance(Mobile mob, int wordCount)
|
||||
{
|
||||
mob.Say( ConstructSentance( wordCount ) );
|
||||
mob.PlaySound( Sound );
|
||||
mob.Say(ConstructSentance(wordCount));
|
||||
mob.PlaySound(Sound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,33 +21,33 @@ namespace Server.Misc
|
|||
switch (keywords[i])
|
||||
{
|
||||
case 0x002A: // *i resign from my guild*
|
||||
{
|
||||
((Guild)from.Guild)?.RemoveMember(from);
|
||||
{
|
||||
((Guild)from.Guild)?.RemoveMember(from);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x0032: // *i must consider my sins*
|
||||
{
|
||||
if (!Core.SE)
|
||||
{
|
||||
from.SendMessage("Short Term Murders : {0}", from.ShortTermMurders);
|
||||
from.SendMessage("Long Term Murders : {0}", from.Kills);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage(0x3B2, "Short Term Murders: {0} Long Term Murders: {1}", from.ShortTermMurders,
|
||||
from.Kills);
|
||||
}
|
||||
if (!Core.SE)
|
||||
{
|
||||
from.SendMessage("Short Term Murders : {0}", from.ShortTermMurders);
|
||||
from.SendMessage("Long Term Murders : {0}", from.Kills);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage(0x3B2, "Short Term Murders: {0} Long Term Murders: {1}", from.ShortTermMurders,
|
||||
from.Kills);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x0035: // i renounce my young player status*
|
||||
{
|
||||
if (from is PlayerMobile mobile && mobile.Young && !mobile.HasGump<RenounceYoungGump>())
|
||||
mobile.SendGump(new RenounceYoungGump());
|
||||
{
|
||||
if (from is PlayerMobile mobile && mobile.Young && !mobile.HasGump<RenounceYoungGump>())
|
||||
mobile.SendGump(new RenounceYoungGump());
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,9 @@ namespace Server.Misc
|
|||
* If you do not see the above chars, please
|
||||
* enable showing of unicode control chars
|
||||
**/
|
||||
|
||||
public class LanguageStatistics
|
||||
{
|
||||
private static InternationalCode[] InternationalCodes =
|
||||
private static readonly InternationalCode[] InternationalCodes =
|
||||
{
|
||||
new InternationalCode("ARA", "Arabic", "Saudi Arabia", "العربية", "السعودية"),
|
||||
new InternationalCode("ARI", "Arabic", "Iraq", "العربية", "العراق"),
|
||||
|
|
@ -161,9 +160,9 @@ namespace Server.Misc
|
|||
new InternationalCode("KOK", "Konkani", "India", "कोंकणी", "भारत")
|
||||
};
|
||||
|
||||
private static bool DefaultLocalNames = false;
|
||||
private static bool ShowAlternatives = true;
|
||||
private static bool CountAccounts = true; // will consider only first character's valid language
|
||||
private static readonly bool DefaultLocalNames = false;
|
||||
private static readonly bool ShowAlternatives = true;
|
||||
private static readonly bool CountAccounts = true; // will consider only first character's valid language
|
||||
|
||||
private static string GetFormattedInfo(string code)
|
||||
{
|
||||
|
|
@ -244,17 +243,17 @@ namespace Server.Misc
|
|||
|
||||
private struct InternationalCode
|
||||
{
|
||||
private bool m_HasLocalInfo;
|
||||
private readonly bool m_HasLocalInfo;
|
||||
|
||||
public string Code{ get; }
|
||||
public string Code { get; }
|
||||
|
||||
public string Language{ get; }
|
||||
public string Language { get; }
|
||||
|
||||
public string Country{ get; }
|
||||
public string Country { get; }
|
||||
|
||||
public string Language_LocalName{ get; }
|
||||
public string Language_LocalName { get; }
|
||||
|
||||
public string Country_LocalName{ get; }
|
||||
public string Country_LocalName { get; }
|
||||
|
||||
public InternationalCode(string code, string language, string country) : this(code, language, country, null,
|
||||
null) =>
|
||||
|
|
@ -301,9 +300,9 @@ namespace Server.Misc
|
|||
Count = 1;
|
||||
}
|
||||
|
||||
public string Code{ get; }
|
||||
public string Code { get; }
|
||||
|
||||
public int Count{ get; private set; }
|
||||
public int Count { get; private set; }
|
||||
|
||||
public void Increase()
|
||||
{
|
||||
|
|
@ -325,7 +324,6 @@ namespace Server.Misc
|
|||
b = y.Code;
|
||||
cb = y.Count;
|
||||
|
||||
|
||||
if (ca > cb)
|
||||
return -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace Server
|
|||
|
||||
public class NightSightTimer : Timer
|
||||
{
|
||||
private Mobile m_Owner;
|
||||
private readonly Mobile m_Owner;
|
||||
|
||||
public NightSightTimer(Mobile owner) : base(TimeSpan.FromMinutes(Utility.Random(15, 25)))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@ namespace Server
|
|||
{
|
||||
public class Loot
|
||||
{
|
||||
#region List definitions
|
||||
|
||||
#region Mondain's Legacy
|
||||
|
||||
public static Type[] MLWeaponTypes{ get; } =
|
||||
public static Type[] MLWeaponTypes { get; } =
|
||||
{
|
||||
typeof(AssassinSpike), typeof(DiamondMace), typeof(ElvenMachete),
|
||||
typeof(ElvenSpellblade), typeof(Leafblade), typeof(OrnateAxe),
|
||||
|
|
@ -18,12 +14,12 @@ namespace Server
|
|||
typeof(WildStaff)
|
||||
};
|
||||
|
||||
public static Type[] MLRangedWeaponTypes{ get; } =
|
||||
public static Type[] MLRangedWeaponTypes { get; } =
|
||||
{
|
||||
typeof(ElvenCompositeLongbow), typeof(MagicalShortbow)
|
||||
};
|
||||
|
||||
public static Type[] MLArmorTypes{ get; } =
|
||||
public static Type[] MLArmorTypes { get; } =
|
||||
{
|
||||
typeof(Circlet), typeof(GemmedCirclet), typeof(LeafTonlet),
|
||||
typeof(RavenHelm), typeof(RoyalCirclet), typeof(VultureHelm),
|
||||
|
|
@ -35,16 +31,14 @@ namespace Server
|
|||
typeof(HidePauldrons)
|
||||
};
|
||||
|
||||
public static Type[] MLClothingTypes{ get; } =
|
||||
public static Type[] MLClothingTypes { get; } =
|
||||
{
|
||||
typeof(MaleElvenRobe), typeof(FemaleElvenRobe), typeof(ElvenPants),
|
||||
typeof(ElvenShirt), typeof(ElvenDarkShirt), typeof(ElvenBoots),
|
||||
typeof(VultureHelm), typeof(WoodlandBelt)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
public static Type[] SEWeaponTypes{ get; } =
|
||||
public static Type[] SEWeaponTypes { get; } =
|
||||
{
|
||||
typeof(Bokuto), typeof(Daisho), typeof(Kama),
|
||||
typeof(Lajatang), typeof(NoDachi), typeof(Nunchaku),
|
||||
|
|
@ -52,14 +46,14 @@ namespace Server
|
|||
typeof(Tetsubo), typeof(Wakizashi)
|
||||
};
|
||||
|
||||
public static Type[] AosWeaponTypes{ get; } =
|
||||
public static Type[] AosWeaponTypes { get; } =
|
||||
{
|
||||
typeof(Scythe), typeof(BoneHarvester), typeof(Scepter),
|
||||
typeof(BladedStaff), typeof(Pike), typeof(DoubleBladedStaff),
|
||||
typeof(Lance), typeof(CrescentBlade)
|
||||
};
|
||||
|
||||
public static Type[] WeaponTypes{ get; } =
|
||||
public static Type[] WeaponTypes { get; } =
|
||||
{
|
||||
typeof(Axe), typeof(BattleAxe), typeof(DoubleAxe),
|
||||
typeof(ExecutionersAxe), typeof(Hatchet), typeof(LargeBattleAxe),
|
||||
|
|
@ -75,22 +69,22 @@ namespace Server
|
|||
typeof(Dagger), typeof(SkinningKnife), typeof(ShepherdsCrook)
|
||||
};
|
||||
|
||||
public static Type[] SERangedWeaponTypes{ get; } =
|
||||
public static Type[] SERangedWeaponTypes { get; } =
|
||||
{
|
||||
typeof(Yumi)
|
||||
};
|
||||
|
||||
public static Type[] AosRangedWeaponTypes{ get; } =
|
||||
public static Type[] AosRangedWeaponTypes { get; } =
|
||||
{
|
||||
typeof(CompositeBow), typeof(RepeatingCrossbow)
|
||||
};
|
||||
|
||||
public static Type[] RangedWeaponTypes{ get; } =
|
||||
public static Type[] RangedWeaponTypes { get; } =
|
||||
{
|
||||
typeof(Bow), typeof(Crossbow), typeof(HeavyCrossbow)
|
||||
};
|
||||
|
||||
public static Type[] SEArmorTypes{ get; } =
|
||||
public static Type[] SEArmorTypes { get; } =
|
||||
{
|
||||
typeof(ChainHatsuburi), typeof(LeatherDo), typeof(LeatherHaidate),
|
||||
typeof(LeatherHiroSode), typeof(LeatherJingasa), typeof(LeatherMempo),
|
||||
|
|
@ -104,7 +98,7 @@ namespace Server
|
|||
typeof(StuddedSuneate)
|
||||
};
|
||||
|
||||
public static Type[] ArmorTypes{ get; } =
|
||||
public static Type[] ArmorTypes { get; } =
|
||||
{
|
||||
typeof(BoneArms), typeof(BoneChest), typeof(BoneGloves),
|
||||
typeof(BoneLegs), typeof(BoneHelm), typeof(ChainChest),
|
||||
|
|
@ -122,73 +116,69 @@ namespace Server
|
|||
typeof(StuddedGorget), typeof(StuddedLegs)
|
||||
};
|
||||
|
||||
public static Type[] AosShieldTypes{ get; } =
|
||||
public static Type[] AosShieldTypes { get; } =
|
||||
{
|
||||
typeof(ChaosShield), typeof(OrderShield)
|
||||
};
|
||||
|
||||
public static Type[] ShieldTypes{ get; } =
|
||||
public static Type[] ShieldTypes { get; } =
|
||||
{
|
||||
typeof(BronzeShield), typeof(Buckler), typeof(HeaterShield),
|
||||
typeof(MetalShield), typeof(MetalKiteShield), typeof(WoodenKiteShield),
|
||||
typeof(WoodenShield)
|
||||
};
|
||||
|
||||
public static Type[] GemTypes{ get; } =
|
||||
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[] JewelryTypes{ get; } =
|
||||
public static Type[] JewelryTypes { get; } =
|
||||
{
|
||||
typeof(GoldRing), typeof(GoldBracelet),
|
||||
typeof(SilverRing), typeof(SilverBracelet)
|
||||
};
|
||||
|
||||
public static Type[] RegTypes{ get; } =
|
||||
public static Type[] RegTypes { get; } =
|
||||
{
|
||||
typeof(BlackPearl), typeof(Bloodmoss), typeof(Garlic),
|
||||
typeof(Ginseng), typeof(MandrakeRoot), typeof(Nightshade),
|
||||
typeof(SulfurousAsh), typeof(SpidersSilk)
|
||||
};
|
||||
|
||||
public static Type[] NecroRegTypes{ get; } =
|
||||
public static Type[] NecroRegTypes { get; } =
|
||||
{
|
||||
typeof(BatWing), typeof(GraveDust), typeof(DaemonBlood),
|
||||
typeof(NoxCrystal), typeof(PigIron)
|
||||
};
|
||||
|
||||
public static Type[] PotionTypes{ get; } =
|
||||
public static Type[] PotionTypes { get; } =
|
||||
{
|
||||
typeof(AgilityPotion), typeof(StrengthPotion), typeof(RefreshPotion),
|
||||
typeof(LesserCurePotion), typeof(LesserHealPotion), typeof(LesserPoisonPotion)
|
||||
};
|
||||
|
||||
public static Type[] SEInstrumentTypes{ get; } =
|
||||
public static Type[] SEInstrumentTypes { get; } =
|
||||
{
|
||||
typeof(BambooFlute)
|
||||
};
|
||||
|
||||
public static Type[] InstrumentTypes{ get; } =
|
||||
public static Type[] InstrumentTypes { get; } =
|
||||
{
|
||||
typeof(Drums), typeof(Harp), typeof(LapHarp),
|
||||
typeof(Lute), typeof(Tambourine), typeof(TambourineTassel)
|
||||
};
|
||||
|
||||
public static Type[] StatueTypes{ get; } =
|
||||
public static Type[] StatueTypes { get; } =
|
||||
{
|
||||
typeof(StatueSouth), typeof(StatueSouth2), typeof(StatueNorth),
|
||||
typeof(StatueWest), typeof(StatueEast), typeof(StatueEast2),
|
||||
typeof(StatueSouthEast), typeof(BustSouth), typeof(BustEast)
|
||||
};
|
||||
|
||||
#region Mondain's Legacy
|
||||
|
||||
#endregion
|
||||
|
||||
public static Type[] RegularScrollTypes{ get; } =
|
||||
public static Type[] RegularScrollTypes { get; } =
|
||||
{
|
||||
typeof(ReactiveArmorScroll), typeof(ClumsyScroll), typeof(CreateFoodScroll), typeof(FeeblemindScroll),
|
||||
typeof(HealScroll), typeof(MagicArrowScroll), typeof(NightSightScroll), typeof(WeakenScroll),
|
||||
|
|
@ -210,7 +200,7 @@ namespace Server
|
|||
typeof(SummonWaterElementalScroll)
|
||||
};
|
||||
|
||||
public static Type[] NecromancyScrollTypes{ get; } =
|
||||
public static Type[] NecromancyScrollTypes { get; } =
|
||||
{
|
||||
typeof(AnimateDeadScroll), typeof(BloodOathScroll), typeof(CorpseSkinScroll), typeof(CurseWeaponScroll),
|
||||
typeof(EvilOmenScroll), typeof(HorrificBeastScroll), typeof(LichFormScroll), typeof(MindRotScroll),
|
||||
|
|
@ -218,7 +208,7 @@ namespace Server
|
|||
typeof(VampiricEmbraceScroll), typeof(VengefulSpiritScroll), typeof(WitherScroll), typeof(WraithFormScroll)
|
||||
};
|
||||
|
||||
public static Type[] SENecromancyScrollTypes{ get; } =
|
||||
public static Type[] SENecromancyScrollTypes { get; } =
|
||||
{
|
||||
typeof(AnimateDeadScroll), typeof(BloodOathScroll), typeof(CorpseSkinScroll), typeof(CurseWeaponScroll),
|
||||
typeof(EvilOmenScroll), typeof(HorrificBeastScroll), typeof(LichFormScroll), typeof(MindRotScroll),
|
||||
|
|
@ -227,37 +217,33 @@ namespace Server
|
|||
typeof(ExorcismScroll)
|
||||
};
|
||||
|
||||
public static Type[] PaladinScrollTypes{ get; } = new Type[0];
|
||||
public static Type[] PaladinScrollTypes { get; } = Array.Empty<Type>();
|
||||
|
||||
#region Mondain's Legacy
|
||||
|
||||
public static Type[] ArcanistScrollTypes{ get; } =
|
||||
public static Type[] ArcanistScrollTypes { get; } =
|
||||
{
|
||||
typeof(ArcaneCircleScroll), typeof(GiftOfRenewalScroll), typeof(ImmolatingWeaponScroll),
|
||||
typeof(AttuneWeaponScroll),
|
||||
typeof(ThunderstormScroll),
|
||||
typeof(NatureFuryScroll), /*typeof( SummonFeyScroll ), typeof( SummonFiendScroll ),*/
|
||||
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[] GrimmochJournalTypes{ get; } =
|
||||
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[] LysanderNotebookTypes{ get; } =
|
||||
public static Type[] LysanderNotebookTypes { get; } =
|
||||
{
|
||||
typeof(LysanderNotebook1), typeof(LysanderNotebook2), typeof(LysanderNotebook3),
|
||||
typeof(LysanderNotebook7), typeof(LysanderNotebook8), typeof(LysanderNotebook11)
|
||||
};
|
||||
|
||||
public static Type[] TavarasJournalTypes{ get; } =
|
||||
public static Type[] TavarasJournalTypes { get; } =
|
||||
{
|
||||
typeof(TavarasJournal1), typeof(TavarasJournal2), typeof(TavarasJournal3),
|
||||
typeof(TavarasJournal6), typeof(TavarasJournal7), typeof(TavarasJournal8),
|
||||
|
|
@ -266,25 +252,24 @@ namespace Server
|
|||
typeof(TavarasJournal19)
|
||||
};
|
||||
|
||||
|
||||
public static Type[] NewWandTypes{ get; } =
|
||||
public static Type[] NewWandTypes { get; } =
|
||||
{
|
||||
typeof(FireballWand), typeof(LightningWand), typeof(MagicArrowWand),
|
||||
typeof(GreaterHealWand), typeof(HarmWand), typeof(HealWand)
|
||||
};
|
||||
|
||||
public static Type[] WandTypes{ get; } =
|
||||
public static Type[] WandTypes { get; } =
|
||||
{
|
||||
typeof(ClumsyWand), typeof(FeebleWand),
|
||||
typeof(ManaDrainWand), typeof(WeaknessWand)
|
||||
};
|
||||
|
||||
public static Type[] OldWandTypes{ get; } =
|
||||
public static Type[] OldWandTypes { get; } =
|
||||
{
|
||||
typeof(IDWand)
|
||||
};
|
||||
|
||||
public static Type[] SEClothingTypes{ get; } =
|
||||
public static Type[] SEClothingTypes { get; } =
|
||||
{
|
||||
typeof(ClothNinjaJacket), typeof(FemaleKimono), typeof(Hakama),
|
||||
typeof(HakamaShita), typeof(JinBaori), typeof(Kamishimo),
|
||||
|
|
@ -292,13 +277,13 @@ namespace Server
|
|||
typeof(SamuraiTabi), typeof(TattsukeHakama), typeof(Waraji)
|
||||
};
|
||||
|
||||
public static Type[] AosClothingTypes{ get; } =
|
||||
public static Type[] AosClothingTypes { get; } =
|
||||
{
|
||||
typeof(FurSarong), typeof(FurCape), typeof(FlowerGarland),
|
||||
typeof(GildedDress), typeof(FurBoots), typeof(FormalShirt)
|
||||
};
|
||||
|
||||
public static Type[] ClothingTypes{ get; } =
|
||||
public static Type[] ClothingTypes { get; } =
|
||||
{
|
||||
typeof(Cloak),
|
||||
typeof(Bonnet), typeof(Cap), typeof(FeatheredHat),
|
||||
|
|
@ -314,18 +299,18 @@ namespace Server
|
|||
typeof(HalfApron)
|
||||
};
|
||||
|
||||
public static Type[] SEHatTypes{ get; } =
|
||||
public static Type[] SEHatTypes { get; } =
|
||||
{
|
||||
typeof(ClothNinjaHood), typeof(Kasa)
|
||||
};
|
||||
|
||||
public static Type[] AosHatTypes{ get; } =
|
||||
public static Type[] AosHatTypes { get; } =
|
||||
{
|
||||
typeof(FlowerGarland), typeof(BearMask),
|
||||
typeof(DeerMask) //Are Bear& Deer mask inside the Pre-AoS loottables too?
|
||||
typeof(DeerMask) // Are Bear& Deer mask inside the Pre-AoS loottables too?
|
||||
};
|
||||
|
||||
public static Type[] HatTypes{ get; } =
|
||||
public static Type[] HatTypes { get; } =
|
||||
{
|
||||
typeof(SkullCap), typeof(Bandana), typeof(FloppyHat),
|
||||
typeof(Cap), typeof(WideBrimHat), typeof(StrawHat),
|
||||
|
|
@ -333,7 +318,7 @@ namespace Server
|
|||
typeof(FeatheredHat), typeof(TricorneHat), typeof(JesterHat)
|
||||
};
|
||||
|
||||
public static Type[] LibraryBookTypes{ get; } =
|
||||
public static Type[] LibraryBookTypes { get; } =
|
||||
{
|
||||
typeof(GrammarOfOrcish), typeof(CallToAnarchy), typeof(ArmsAndWeaponsPrimer),
|
||||
typeof(SongOfSamlethe), typeof(TaleOfThreeTribes), typeof(GuideToGuilds),
|
||||
|
|
@ -347,10 +332,6 @@ namespace Server
|
|||
typeof(VirtueBook)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
|
||||
public static BaseWand RandomWand()
|
||||
{
|
||||
if (Core.ML)
|
||||
|
|
@ -364,13 +345,9 @@ namespace Server
|
|||
|
||||
public static BaseClothing RandomClothing(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLClothingTypes, AosClothingTypes, ClothingTypes) as BaseClothing;
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEClothingTypes, AosClothingTypes, ClothingTypes) as BaseClothing;
|
||||
|
||||
|
|
@ -384,13 +361,9 @@ namespace Server
|
|||
|
||||
public static BaseWeapon RandomRangedWeapon(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLRangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes) as BaseWeapon;
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SERangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes) as BaseWeapon;
|
||||
|
||||
|
|
@ -404,13 +377,9 @@ namespace Server
|
|||
|
||||
public static BaseWeapon RandomWeapon(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLWeaponTypes, AosWeaponTypes, WeaponTypes) as BaseWeapon;
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEWeaponTypes, AosWeaponTypes, WeaponTypes) as BaseWeapon;
|
||||
|
||||
|
|
@ -424,13 +393,9 @@ namespace Server
|
|||
|
||||
public static Item RandomWeaponOrJewelry(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLWeaponTypes, AosWeaponTypes, WeaponTypes, JewelryTypes);
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEWeaponTypes, AosWeaponTypes, WeaponTypes, JewelryTypes);
|
||||
|
||||
|
|
@ -446,13 +411,9 @@ namespace Server
|
|||
|
||||
public static BaseArmor RandomArmor(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLArmorTypes, ArmorTypes) as BaseArmor;
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEArmorTypes, ArmorTypes) as BaseArmor;
|
||||
|
||||
|
|
@ -476,13 +437,9 @@ namespace Server
|
|||
|
||||
public static Item RandomArmorOrHat(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes);
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes);
|
||||
|
||||
|
|
@ -504,13 +461,9 @@ namespace Server
|
|||
|
||||
public static BaseArmor RandomArmorOrShield(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLArmorTypes, ArmorTypes, AosShieldTypes, ShieldTypes) as BaseArmor;
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEArmorTypes, ArmorTypes, AosShieldTypes, ShieldTypes) as BaseArmor;
|
||||
|
||||
|
|
@ -524,13 +477,9 @@ namespace Server
|
|||
|
||||
public static Item RandomArmorOrShieldOrJewelry(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes);
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes,
|
||||
JewelryTypes);
|
||||
|
|
@ -545,14 +494,10 @@ namespace Server
|
|||
|
||||
public static Item RandomArmorOrShieldOrWeapon(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLWeaponTypes, AosWeaponTypes, WeaponTypes, MLRangedWeaponTypes, AosRangedWeaponTypes,
|
||||
RangedWeaponTypes, MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes);
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEWeaponTypes, AosWeaponTypes, WeaponTypes, SERangedWeaponTypes, AosRangedWeaponTypes,
|
||||
RangedWeaponTypes, SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes,
|
||||
|
|
@ -569,15 +514,11 @@ namespace Server
|
|||
|
||||
public static Item RandomArmorOrShieldOrWeaponOrJewelry(bool inTokuno, bool isMondain)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (Core.ML && isMondain)
|
||||
return Construct(MLWeaponTypes, AosWeaponTypes, WeaponTypes, MLRangedWeaponTypes, AosRangedWeaponTypes,
|
||||
RangedWeaponTypes, MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes,
|
||||
JewelryTypes);
|
||||
|
||||
#endregion
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
return Construct(SEWeaponTypes, AosWeaponTypes, WeaponTypes, SERangedWeaponTypes, AosRangedWeaponTypes,
|
||||
RangedWeaponTypes, SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes,
|
||||
|
|
@ -590,12 +531,8 @@ namespace Server
|
|||
return Construct(WeaponTypes, RangedWeaponTypes, ArmorTypes, HatTypes, ShieldTypes, JewelryTypes);
|
||||
}
|
||||
|
||||
#region Chest of Heirlooms
|
||||
|
||||
public static Item ChestOfHeirloomsContains() => Construct(SEArmorTypes, SEHatTypes, SEWeaponTypes, SERangedWeaponTypes, JewelryTypes);
|
||||
|
||||
#endregion
|
||||
|
||||
public static Item RandomGem() => Construct(GemTypes);
|
||||
|
||||
public static Item RandomReagent() => Construct(RegTypes);
|
||||
|
|
@ -627,7 +564,7 @@ namespace Server
|
|||
var types = type switch
|
||||
{
|
||||
SpellbookType.Regular => RegularScrollTypes,
|
||||
SpellbookType.Necromancer => (Core.SE ? SENecromancyScrollTypes : NecromancyScrollTypes),
|
||||
SpellbookType.Necromancer => Core.SE ? SENecromancyScrollTypes : NecromancyScrollTypes,
|
||||
SpellbookType.Paladin => PaladinScrollTypes,
|
||||
SpellbookType.Arcanist => ArcanistScrollTypes,
|
||||
_ => RegularScrollTypes
|
||||
|
|
@ -682,10 +619,6 @@ namespace Server
|
|||
return talisman;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Construction methods
|
||||
|
||||
public static Item Construct(Type type)
|
||||
{
|
||||
try
|
||||
|
|
@ -736,7 +669,5 @@ namespace Server
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ namespace Server
|
|||
new LootPackItem(typeof(BaseInstrument), 1)
|
||||
};
|
||||
|
||||
|
||||
public static readonly LootPackItem[] LowScrollItems =
|
||||
{
|
||||
new LootPackItem(typeof(ClumsyScroll), 1)
|
||||
|
|
@ -49,8 +48,6 @@ namespace Server
|
|||
new LootPackItem(typeof(LesserPoisonPotion), 1)
|
||||
};
|
||||
|
||||
#region Old Magic Items
|
||||
|
||||
public static readonly LootPackItem[] OldMagicItems =
|
||||
{
|
||||
new LootPackItem(typeof(BaseJewel), 1),
|
||||
|
|
@ -60,8 +57,6 @@ namespace Server
|
|||
new LootPackItem(typeof(BaseShield), 1)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
public static readonly LootPack LowScrolls = new LootPack(new[]
|
||||
{
|
||||
new LootPackEntry(false, LowScrollItems, 100.00, 1)
|
||||
|
|
@ -87,7 +82,7 @@ namespace Server
|
|||
new LootPackEntry(false, PotionItems, 100.00, 1)
|
||||
});
|
||||
|
||||
private LootPackEntry[] m_Entries;
|
||||
private readonly LootPackEntry[] m_Entries;
|
||||
|
||||
public LootPack(LootPackEntry[] entries) => m_Entries = entries;
|
||||
|
||||
|
|
@ -165,8 +160,6 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
#region ML definitions
|
||||
|
||||
public static readonly LootPackItem[] AosMagicItemsRichType1 =
|
||||
{
|
||||
new LootPackItem(typeof(BaseWeapon), 211),
|
||||
|
|
@ -185,10 +178,6 @@ namespace Server
|
|||
new LootPackEntry(false, Instruments, 1.00, 1)
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region AOS Magic Items
|
||||
|
||||
public static readonly LootPackItem[] AosMagicItemsPoor =
|
||||
{
|
||||
new LootPackItem(typeof(BaseWeapon), 3),
|
||||
|
|
@ -234,7 +223,6 @@ namespace Server
|
|||
new LootPackItem(typeof(BaseJewel), 40)
|
||||
};
|
||||
|
||||
|
||||
public static readonly LootPackItem[] AosMagicItemsRichType2 =
|
||||
{
|
||||
new LootPackItem(typeof(BaseWeapon), 170),
|
||||
|
|
@ -271,10 +259,6 @@ namespace Server
|
|||
new LootPackItem(typeof(BaseJewel), 207)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region SE definitions
|
||||
|
||||
public static readonly LootPack SePoor = new LootPack(new[]
|
||||
{
|
||||
new LootPackEntry(true, Gold, 100.00, "2d10+20"),
|
||||
|
|
@ -345,10 +329,6 @@ namespace Server
|
|||
new LootPackEntry(false, Instruments, 2.00, 1)
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region AOS definitions
|
||||
|
||||
public static readonly LootPack AosPoor = new LootPack(new[]
|
||||
{
|
||||
new LootPackEntry(true, Gold, 100.00, "1d10+10"),
|
||||
|
|
@ -420,10 +400,6 @@ namespace Server
|
|||
new LootPackEntry(false, Instruments, 2.00, 1)
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pre-AOS definitions
|
||||
|
||||
public static readonly LootPack OldPoor = new LootPack(new[]
|
||||
{
|
||||
new LootPackEntry(true, Gold, 100.00, "1d25"),
|
||||
|
|
@ -494,10 +470,6 @@ namespace Server
|
|||
new LootPackEntry(false, OldMagicItems, 100.00, 1, 1, 70, 100)
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region Generic accessors
|
||||
|
||||
public static LootPack Poor => Core.SE ? SePoor : Core.AOS ? AosPoor : OldPoor;
|
||||
public static LootPack Meager => Core.SE ? SeMeager : Core.AOS ? AosMeager : OldMeager;
|
||||
public static LootPack Average => Core.SE ? SeAverage : Core.AOS ? AosAverage : OldAverage;
|
||||
|
|
@ -506,11 +478,8 @@ namespace Server
|
|||
public static LootPack UltraRich => Core.SE ? SeUltraRich : Core.AOS ? AosUltraRich : OldUltraRich;
|
||||
public static LootPack SuperBoss => Core.SE ? SeSuperBoss : Core.AOS ? AosSuperBoss : OldSuperBoss;
|
||||
|
||||
#endregion
|
||||
|
||||
/*
|
||||
// TODO: Uncomment once added
|
||||
#region Mondain's Legacy
|
||||
// TODO: Uncomment once added Legacy
|
||||
public static readonly LootPackItem[] ParrotItem = new LootPackItem[]
|
||||
{
|
||||
new LootPackItem( typeof( ParrotItem ), 1 )
|
||||
|
|
@ -520,13 +489,12 @@ namespace Server
|
|||
{
|
||||
new LootPackEntry( false, ParrotItem, 10.00, 1 )
|
||||
} );
|
||||
#endregion
|
||||
*/
|
||||
}
|
||||
|
||||
public class LootPackEntry
|
||||
{
|
||||
private bool m_AtSpawnTime;
|
||||
private readonly bool m_AtSpawnTime;
|
||||
|
||||
public LootPackEntry(bool atSpawnTime, LootPackItem[] items, double chance, string quantity) : this(atSpawnTime,
|
||||
items, chance, new LootPackDice(quantity))
|
||||
|
|
@ -562,17 +530,17 @@ namespace Server
|
|||
MaxIntensity = maxIntensity;
|
||||
}
|
||||
|
||||
public int Chance{ get; set; }
|
||||
public int Chance { get; set; }
|
||||
|
||||
public LootPackDice Quantity{ get; set; }
|
||||
public LootPackDice Quantity { get; set; }
|
||||
|
||||
public int MaxProps{ get; set; }
|
||||
public int MaxProps { get; set; }
|
||||
|
||||
public int MinIntensity{ get; set; }
|
||||
public int MinIntensity { get; set; }
|
||||
|
||||
public int MaxIntensity{ get; set; }
|
||||
public int MaxIntensity { get; set; }
|
||||
|
||||
public LootPackItem[] Items{ get; set; }
|
||||
public LootPackItem[] Items { get; set; }
|
||||
|
||||
private static bool IsInTokuno(Mobile m)
|
||||
{
|
||||
|
|
@ -585,12 +553,8 @@ namespace Server
|
|||
return m.Map == Map.Tokuno;
|
||||
}
|
||||
|
||||
#region Mondain's Legacy
|
||||
|
||||
private static bool IsMondain(Mobile m) => MondainsLegacy.IsMLRegion(m.Region);
|
||||
|
||||
#endregion
|
||||
|
||||
public Item Construct(Mobile from, int luckChance, bool spawning)
|
||||
{
|
||||
if (m_AtSpawnTime != spawning)
|
||||
|
|
@ -620,19 +584,19 @@ namespace Server
|
|||
{
|
||||
int rnd = Utility.RandomMinMax(MinIntensity, MaxIntensity);
|
||||
|
||||
if (50 > rnd)
|
||||
if (rnd < 50)
|
||||
return 1;
|
||||
rnd -= 50;
|
||||
|
||||
if (25 > rnd)
|
||||
if (rnd < 25)
|
||||
return 2;
|
||||
rnd -= 25;
|
||||
|
||||
if (14 > rnd)
|
||||
if (rnd < 14)
|
||||
return 3;
|
||||
rnd -= 14;
|
||||
|
||||
if (8 > rnd)
|
||||
if (rnd < 8)
|
||||
return 4;
|
||||
|
||||
return 5;
|
||||
|
|
@ -642,7 +606,7 @@ namespace Server
|
|||
{
|
||||
if (item != null)
|
||||
{
|
||||
if (item is BaseWeapon && 1 > Utility.Random(100))
|
||||
if (item is BaseWeapon && Utility.Random(100) < 1)
|
||||
{
|
||||
item.Delete();
|
||||
item = new FireHorn();
|
||||
|
|
@ -680,28 +644,28 @@ namespace Server
|
|||
{
|
||||
if (item is BaseWeapon weapon)
|
||||
{
|
||||
if (80 > Utility.Random(100))
|
||||
if (Utility.Random(100) < 80)
|
||||
weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
|
||||
|
||||
if (60 > Utility.Random(100))
|
||||
if (Utility.Random(100) < 60)
|
||||
weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus();
|
||||
|
||||
if (40 > Utility.Random(100))
|
||||
if (Utility.Random(100) < 40)
|
||||
weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
|
||||
|
||||
if (5 > Utility.Random(100))
|
||||
if (Utility.Random(100) < 5)
|
||||
weapon.Slayer = SlayerName.Silver;
|
||||
|
||||
if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 &&
|
||||
weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100))
|
||||
weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && Utility.Random(100) < 5)
|
||||
weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType());
|
||||
}
|
||||
else if (item is BaseArmor armor)
|
||||
{
|
||||
if (80 > Utility.Random(100))
|
||||
if (Utility.Random(100) < 80)
|
||||
armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
|
||||
|
||||
if (40 > Utility.Random(100))
|
||||
if (Utility.Random(100) < 40)
|
||||
armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
|
||||
}
|
||||
}
|
||||
|
|
@ -798,9 +762,9 @@ namespace Server
|
|||
|
||||
public class LootPackItem
|
||||
{
|
||||
private static Type[] m_BlankTypes = { typeof(BlankScroll) };
|
||||
private static readonly Type[] m_BlankTypes = { typeof(BlankScroll) };
|
||||
|
||||
private static Type[][] m_NecroTypes =
|
||||
private static readonly Type[][] m_NecroTypes =
|
||||
{
|
||||
new[] // low
|
||||
{
|
||||
|
|
@ -830,9 +794,9 @@ namespace Server
|
|||
Chance = chance;
|
||||
}
|
||||
|
||||
public Type Type{ get; set; }
|
||||
public Type Type { get; set; }
|
||||
|
||||
public int Chance{ get; set; }
|
||||
public int Chance { get; set; }
|
||||
|
||||
public static Item RandomScroll(int index, int minCircle, int maxCircle)
|
||||
{
|
||||
|
|
@ -944,11 +908,11 @@ namespace Server
|
|||
Bonus = bonus;
|
||||
}
|
||||
|
||||
public int Count{ get; set; }
|
||||
public int Count { get; set; }
|
||||
|
||||
public int Sides{ get; set; }
|
||||
public int Sides { get; set; }
|
||||
|
||||
public int Bonus{ get; set; }
|
||||
public int Bonus { get; set; }
|
||||
|
||||
public int Roll()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Server.Misc
|
|||
public static void Configure()
|
||||
{
|
||||
/* Here we configure all maps. Some notes:
|
||||
*
|
||||
*
|
||||
* 1) The first 32 maps are reserved for core use.
|
||||
* 2) Map 0x7F is reserved for core use.
|
||||
* 3) Map 0xFF is reserved for core use.
|
||||
|
|
@ -23,7 +23,7 @@ namespace Server.Misc
|
|||
|
||||
/* Example of registering a custom map:
|
||||
* RegisterMap( 32, 0, 0, 6144, 4096, 3, "Iceland", MapRules.FeluccaRules );
|
||||
*
|
||||
*
|
||||
* Defined:
|
||||
* RegisterMap( <index>, <mapID>, <fileIndex>, <width>, <height>, <season>, <name>, <rules> );
|
||||
* - <index> : An unreserved unique index for this map
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Server.Misc
|
|||
{
|
||||
Packets.PartyTrack packet = new Packets.PartyTrack(from, party);
|
||||
|
||||
if (packet.UnderlyingStream.Length > 8)
|
||||
if (packet.Stream.Length > 8)
|
||||
state.Send(packet);
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ namespace Server.Misc
|
|||
|
||||
Packets.GuildTrack packet = new Packets.GuildTrack(from, guild, locations);
|
||||
|
||||
if (packet.UnderlyingStream.Length > (locations ? 9 : 5))
|
||||
if (packet.Stream.Length > (locations ? 9 : 5))
|
||||
state.Send(packet);
|
||||
}
|
||||
else
|
||||
|
|
@ -74,13 +74,13 @@ namespace Server.Misc
|
|||
if (Utility.InUpdateRange(from, mob) && from.CanSee(mob))
|
||||
continue;
|
||||
|
||||
m_Stream.Write(mob.Serial);
|
||||
m_Stream.Write((short)mob.X);
|
||||
m_Stream.Write((short)mob.Y);
|
||||
m_Stream.Write((byte)(mob.Map?.MapID ?? 0));
|
||||
Stream.Write(mob.Serial);
|
||||
Stream.Write((short)mob.X);
|
||||
Stream.Write((short)mob.Y);
|
||||
Stream.Write((byte)(mob.Map?.MapID ?? 0));
|
||||
}
|
||||
|
||||
m_Stream.Write(0);
|
||||
Stream.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,14 +88,14 @@ namespace Server.Misc
|
|||
{
|
||||
public GuildTrack() : base(0x02, 5)
|
||||
{
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write(0);
|
||||
Stream.Write((byte)0);
|
||||
Stream.Write(0);
|
||||
}
|
||||
|
||||
public GuildTrack(Mobile from, Guild guild, bool locations) : base(0x02,
|
||||
(guild.Members.Count - 1) * (locations ? 10 : 4) + 5)
|
||||
{
|
||||
m_Stream.Write((byte)(locations ? 1 : 0));
|
||||
Stream.Write((byte)(locations ? 1 : 0));
|
||||
|
||||
for (int i = 0; i < guild.Members.Count; ++i)
|
||||
{
|
||||
|
|
@ -107,22 +107,22 @@ namespace Server.Misc
|
|||
if (locations && Utility.InUpdateRange(from, mob) && from.CanSee(mob))
|
||||
continue;
|
||||
|
||||
m_Stream.Write(mob.Serial);
|
||||
Stream.Write(mob.Serial);
|
||||
|
||||
if (locations)
|
||||
{
|
||||
m_Stream.Write((short)mob.X);
|
||||
m_Stream.Write((short)mob.Y);
|
||||
m_Stream.Write((byte)(mob.Map?.MapID ?? 0));
|
||||
Stream.Write((short)mob.X);
|
||||
Stream.Write((short)mob.Y);
|
||||
Stream.Write((byte)(mob.Map?.MapID ?? 0));
|
||||
|
||||
if (Settings.GuildHitsPercent && mob.Alive)
|
||||
m_Stream.Write((byte)(mob.Hits / Math.Max(mob.HitsMax, 1.0) * 100));
|
||||
Stream.Write((byte)(mob.Hits / Math.Max(mob.HitsMax, 1.0) * 100));
|
||||
else
|
||||
m_Stream.Write((byte)0);
|
||||
Stream.Write((byte)0);
|
||||
}
|
||||
}
|
||||
|
||||
m_Stream.Write(0);
|
||||
Stream.Write(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace Server
|
|||
{
|
||||
public static class MondainsLegacy
|
||||
{
|
||||
public static Type[] Artifacts{ get; } =
|
||||
public static Type[] Artifacts { get; } =
|
||||
{
|
||||
typeof(AegisOfGrace), typeof(BladeDance), typeof(BloodwoodSpirit), typeof(Bonesmasher),
|
||||
typeof(Boomstick), typeof(BrightsightLenses), typeof(FeyLeggings), typeof(FleshRipper),
|
||||
|
|
|
|||
|
|
@ -11,79 +11,79 @@ namespace Server
|
|||
|
||||
public string[] List { get; }
|
||||
|
||||
public bool ContainsName( string name )
|
||||
public bool ContainsName(string name)
|
||||
{
|
||||
for ( int i = 0; i < List.Length; i++ )
|
||||
if ( name == List[i] )
|
||||
for (int i = 0; i < List.Length; i++)
|
||||
if (name == List[i])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public NameList( string type, XmlElement xml )
|
||||
public NameList(string type, XmlElement xml)
|
||||
{
|
||||
Type = type;
|
||||
List = xml.InnerText.Split( ',' );
|
||||
List = xml.InnerText.Split(',');
|
||||
|
||||
for ( int i = 0; i < List.Length; ++i )
|
||||
List[i] = Utility.Intern( List[i].Trim() );
|
||||
for (int i = 0; i < List.Length; ++i)
|
||||
List[i] = Utility.Intern(List[i].Trim());
|
||||
}
|
||||
|
||||
public string GetRandomName()
|
||||
{
|
||||
if ( List.Length > 0 )
|
||||
return List[Utility.Random( List.Length )];
|
||||
if (List.Length > 0)
|
||||
return List[Utility.Random(List.Length)];
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static NameList GetNameList( string type )
|
||||
public static NameList GetNameList(string type)
|
||||
{
|
||||
m_Table.TryGetValue( type, out NameList n );
|
||||
m_Table.TryGetValue(type, out NameList n);
|
||||
return n;
|
||||
}
|
||||
|
||||
public static string RandomName( string type ) => GetNameList( type )?.GetRandomName() ?? "";
|
||||
public static string RandomName(string type) => GetNameList(type)?.GetRandomName() ?? "";
|
||||
|
||||
private static Dictionary<string, NameList> m_Table;
|
||||
private static readonly Dictionary<string, NameList> m_Table;
|
||||
|
||||
static NameList()
|
||||
{
|
||||
m_Table = new Dictionary<string, NameList>( StringComparer.OrdinalIgnoreCase );
|
||||
m_Table = new Dictionary<string, NameList>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
string filePath = Path.Combine( Core.BaseDirectory, "Data/names.xml" );
|
||||
string filePath = Path.Combine(Core.BaseDirectory, "Data/names.xml");
|
||||
|
||||
if ( !File.Exists( filePath ) )
|
||||
if (!File.Exists(filePath))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Load( filePath );
|
||||
Load(filePath);
|
||||
}
|
||||
catch ( Exception e )
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine( "Warning: Exception caught loading name lists:" );
|
||||
Console.WriteLine( e );
|
||||
Console.WriteLine("Warning: Exception caught loading name lists:");
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Load( string filePath )
|
||||
private static void Load(string filePath)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load( filePath );
|
||||
doc.Load(filePath);
|
||||
|
||||
XmlElement root = doc["names"];
|
||||
|
||||
foreach ( XmlElement element in root.GetElementsByTagName( "namelist" ) )
|
||||
foreach (XmlElement element in root.GetElementsByTagName("namelist"))
|
||||
{
|
||||
string type = element.GetAttribute( "type" );
|
||||
string type = element.GetAttribute("type");
|
||||
|
||||
if ( string.IsNullOrEmpty( type ) )
|
||||
if (string.IsNullOrEmpty(type))
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
NameList list = new NameList( type, element );
|
||||
NameList list = new NameList(type, element);
|
||||
|
||||
m_Table[type] = list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ namespace Server.Misc
|
|||
' ', '-', '.', '\''
|
||||
};
|
||||
|
||||
public static readonly char[] Empty = new char[0];
|
||||
public static readonly char[] Empty = System.Array.Empty<char>();
|
||||
|
||||
public static string[] StartDisallowed{ get; } =
|
||||
public static string[] StartDisallowed { get; } =
|
||||
{
|
||||
"seer",
|
||||
"counselor",
|
||||
|
|
@ -19,7 +19,7 @@ namespace Server.Misc
|
|||
"lord"
|
||||
};
|
||||
|
||||
public static string[] Disallowed{ get; } =
|
||||
public static string[] Disallowed { get; } =
|
||||
{
|
||||
"jigaboo",
|
||||
"chigaboo",
|
||||
|
|
@ -129,7 +129,7 @@ namespace Server.Misc
|
|||
name = name.ToLower();
|
||||
|
||||
if (!allowLetters || !allowDigits ||
|
||||
exceptions.Length > 0 && (noExceptionsAtStart || maxExceptions < int.MaxValue))
|
||||
(exceptions.Length > 0 && (noExceptionsAtStart || maxExceptions < int.MaxValue)))
|
||||
for (int i = 0; i < name.Length; ++i)
|
||||
{
|
||||
char c = name[i];
|
||||
|
|
@ -156,7 +156,7 @@ namespace Server.Misc
|
|||
if (c == exceptions[j])
|
||||
except = true;
|
||||
|
||||
if (!except || i == 0 && noExceptionsAtStart)
|
||||
if (!except || (i == 0 && noExceptionsAtStart))
|
||||
return false;
|
||||
|
||||
if (exceptCount++ == maxExceptions)
|
||||
|
|
@ -195,4 +195,4 @@ namespace Server.Misc
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace Server.Misc
|
|||
|
||||
/*private static bool CheckHarmfulStatus( GuildStatus from, GuildStatus target )
|
||||
{
|
||||
if ( from == GuildStatus.Waring && target == GuildStatus.Waring )
|
||||
if (from == GuildStatus.Waring && target == GuildStatus.Waring)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -62,8 +62,6 @@ namespace Server.Misc
|
|||
target.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
#region Dueling
|
||||
|
||||
PlayerMobile pmFrom = from as PlayerMobile;
|
||||
PlayerMobile pmTarg = target as PlayerMobile;
|
||||
|
||||
|
|
@ -80,7 +78,7 @@ namespace Server.Misc
|
|||
return false;
|
||||
|
||||
if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext &&
|
||||
(pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started || pmFrom.DuelContext.Tied ||
|
||||
((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied ||
|
||||
pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated))
|
||||
return false;
|
||||
|
||||
|
|
@ -103,21 +101,14 @@ namespace Server.Misc
|
|||
if (from.Region.IsPartOf<SafeZone>() || target.Region.IsPartOf<SafeZone>())
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
#region Factions
|
||||
|
||||
Faction targetFaction = Faction.Find(target, true);
|
||||
|
||||
if ((!Core.ML || map == Faction.Facet) && targetFaction != null)
|
||||
if (Faction.Find(from, true) != targetFaction)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
if ((map?.Rules & MapRules.BeneficialRestrictions) == 0)
|
||||
return true; // In felucca, anything goes
|
||||
|
||||
|
|
@ -143,8 +134,6 @@ namespace Server.Misc
|
|||
target.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
#region Dueling
|
||||
|
||||
PlayerMobile pmFrom = from as PlayerMobile;
|
||||
PlayerMobile pmTarg = target as PlayerMobile;
|
||||
BaseCreature bcTarg = target as BaseCreature;
|
||||
|
|
@ -162,7 +151,7 @@ namespace Server.Misc
|
|||
return false;
|
||||
|
||||
if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext &&
|
||||
(pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started || pmFrom.DuelContext.Tied ||
|
||||
((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied ||
|
||||
pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated))
|
||||
return false;
|
||||
|
||||
|
|
@ -172,7 +161,7 @@ namespace Server.Misc
|
|||
pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant)
|
||||
return false;
|
||||
|
||||
if ( pmFrom.DuelContext?.Started == true && pmFrom.DuelContext == pmTarg.DuelContext)
|
||||
if (pmFrom.DuelContext?.Started == true && pmFrom.DuelContext == pmTarg.DuelContext)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -182,8 +171,6 @@ namespace Server.Misc
|
|||
if (from.Region.IsPartOf<SafeZone>() || target.Region.IsPartOf<SafeZone>())
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
if ((map?.Rules & MapRules.HarmfulRestrictions) == 0)
|
||||
|
|
@ -206,7 +193,7 @@ namespace Server.Misc
|
|||
(fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild)))
|
||||
return true; // Guild allies or enemies can be harmful
|
||||
|
||||
if (bcTarg?.Controlled == true || bcTarg?.Summoned == true && bcTarg?.SummonMaster != from)
|
||||
if (bcTarg?.Controlled == true || (bcTarg?.Summoned == true && bcTarg?.SummonMaster != from))
|
||||
return false; // Cannot harm other controlled mobiles
|
||||
|
||||
if (target.Player)
|
||||
|
|
@ -265,7 +252,7 @@ namespace Server.Misc
|
|||
|
||||
int actual = Notoriety.CanBeAttacked;
|
||||
|
||||
if (target.Kills >= 5 || body.IsMonster && IsSummoned(creature) || creature.AlwaysMurderer ||
|
||||
if (target.Kills >= 5 || (body.IsMonster && IsSummoned(creature)) || creature.AlwaysMurderer ||
|
||||
creature.IsAnimatedDead)
|
||||
actual = Notoriety.Murderer;
|
||||
|
||||
|
|
@ -275,7 +262,7 @@ namespace Server.Misc
|
|||
Party sourceParty = Party.Get(source);
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
if (list[i] == source || sourceParty != null && Party.Get(list[i]) == sourceParty)
|
||||
if (list[i] == source || (sourceParty != null && Party.Get(list[i]) == sourceParty))
|
||||
return actual;
|
||||
|
||||
return Notoriety.Innocent;
|
||||
|
|
@ -317,14 +304,10 @@ namespace Server.Misc
|
|||
PlayerMobile pmFrom = source as PlayerMobile;
|
||||
PlayerMobile pmTarg = target as PlayerMobile;
|
||||
|
||||
#region Dueling
|
||||
|
||||
if (pmFrom != null && pmTarg != null)
|
||||
if (pmFrom.DuelContext?.StartedBeginCountdown == true && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext)
|
||||
return pmFrom.DuelContext.IsAlly(pmFrom, pmTarg) ? Notoriety.Ally : Notoriety.Enemy;
|
||||
|
||||
#endregion
|
||||
|
||||
if (target.AccessLevel > AccessLevel.Player)
|
||||
return Notoriety.CanBeAttacked;
|
||||
|
||||
|
|
@ -339,7 +322,7 @@ namespace Server.Misc
|
|||
|
||||
if (Core.ML && master != null)
|
||||
{
|
||||
if (source == master && CheckAggressor(bcTarg.Aggressors, source) ||
|
||||
if ((source == master && CheckAggressor(bcTarg.Aggressors, source)) ||
|
||||
CheckAggressor(source.Aggressors, bcTarg))
|
||||
return Notoriety.CanBeAttacked;
|
||||
|
||||
|
|
@ -351,8 +334,8 @@ namespace Server.Misc
|
|||
}
|
||||
|
||||
if (target.Kills >= 5 ||
|
||||
target.Body.IsMonster && IsSummoned(bcTarg) && !(target is BaseFamiliar) && !(target is ArcaneFey) &&
|
||||
!(target is Golem) || bcTarg?.AlwaysMurderer == true || bcTarg?.IsAnimatedDead == true)
|
||||
(target.Body.IsMonster && IsSummoned(bcTarg) && !(target is BaseFamiliar) && !(target is ArcaneFey) &&
|
||||
!(target is Golem)) || bcTarg?.AlwaysMurderer == true || bcTarg?.IsAnimatedDead == true)
|
||||
return Notoriety.Murderer;
|
||||
|
||||
if (target.Criminal)
|
||||
|
|
@ -385,8 +368,8 @@ namespace Server.Misc
|
|||
return Notoriety.CanBeAttacked;
|
||||
|
||||
if (bcTarg?.InitialInnocent != true)
|
||||
if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(bcTarg) && pmTarg == null ||
|
||||
!Core.ML && !target.CanBeginAction<PolymorphSpell>())
|
||||
if ((!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(bcTarg) && pmTarg == null) ||
|
||||
(!Core.ML && !target.CanBeginAction<PolymorphSpell>()))
|
||||
return Notoriety.CanBeAttacked;
|
||||
|
||||
if (CheckAggressor(source.Aggressors, target))
|
||||
|
|
|
|||
|
|
@ -10,17 +10,19 @@ namespace Server
|
|||
{
|
||||
public class PoisonImpl : Poison
|
||||
{
|
||||
private int m_Count, m_MessageInterval;
|
||||
private readonly int m_Count;
|
||||
private readonly int m_MessageInterval;
|
||||
|
||||
// Timers
|
||||
private TimeSpan m_Delay;
|
||||
private TimeSpan m_Interval;
|
||||
private readonly TimeSpan m_Delay;
|
||||
private readonly TimeSpan m_Interval;
|
||||
|
||||
// Info
|
||||
|
||||
// Damage
|
||||
private int m_Minimum, m_Maximum;
|
||||
private double m_Scalar;
|
||||
private readonly int m_Minimum;
|
||||
private readonly int m_Maximum;
|
||||
private readonly double m_Scalar;
|
||||
|
||||
public PoisonImpl(string name, int level, int min, int max, double percent, double delay, double interval, int count,
|
||||
int messageInterval)
|
||||
|
|
@ -36,9 +38,9 @@ namespace Server
|
|||
m_MessageInterval = messageInterval;
|
||||
}
|
||||
|
||||
public override string Name{ get; }
|
||||
public override string Name { get; }
|
||||
|
||||
public override int Level{ get; }
|
||||
public override int Level { get; }
|
||||
|
||||
[CallPriority(10)]
|
||||
public static void Configure()
|
||||
|
|
@ -74,8 +76,8 @@ namespace Server
|
|||
{
|
||||
private int m_Index;
|
||||
private int m_LastDamage;
|
||||
private Mobile m_Mobile;
|
||||
private PoisonImpl m_Poison;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly PoisonImpl m_Poison;
|
||||
|
||||
public PoisonTimer(Mobile m, PoisonImpl p) : base(p.m_Delay, p.m_Interval)
|
||||
{
|
||||
|
|
@ -84,13 +86,13 @@ namespace Server
|
|||
m_Poison = p;
|
||||
}
|
||||
|
||||
public Mobile From{ get; set; }
|
||||
public Mobile From { get; set; }
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (Core.AOS && m_Poison.Level < 4 &&
|
||||
TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell)) ||
|
||||
m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile) ||
|
||||
if ((Core.AOS && m_Poison.Level < 4 &&
|
||||
TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
|
||||
(m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
|
||||
AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
|
||||
if (m_Mobile.CurePoison(m_Mobile))
|
||||
{
|
||||
|
|
@ -138,8 +140,7 @@ namespace Server
|
|||
|
||||
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
|
||||
if (Utility.RandomDouble() >= 0.60) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
|
||||
m_Mobile.RevealingAction();
|
||||
|
||||
if (m_Index % m_Poison.m_MessageInterval == 0)
|
||||
|
|
|
|||
|
|
@ -12,20 +12,21 @@ namespace Server.Misc
|
|||
|
||||
public static class ProfanityProtection
|
||||
{
|
||||
private static bool Enabled = false;
|
||||
// TODO: Move this to configuration
|
||||
private static readonly bool Enabled = false;
|
||||
|
||||
private static ProfanityAction
|
||||
private static readonly ProfanityAction
|
||||
Action = ProfanityAction.Disallow; // change here what to do when profanity is detected
|
||||
|
||||
public static char[] Exceptions{ get; } =
|
||||
public static char[] Exceptions { get; } =
|
||||
{
|
||||
' ', '-', '.', '\'', '"', ',', '_', '+', '=', '~', '`', '!', '^', '*', '\\', '/', ';', ':', '<', '>', '[', ']',
|
||||
'{', '}', '?', '|', '(', ')', '%', '$', '&', '#', '@'
|
||||
};
|
||||
|
||||
public static string[] StartDisallowed{ get; } = { };
|
||||
public static string[] StartDisallowed { get; } = { };
|
||||
|
||||
public static string[] Disallowed{ get; } =
|
||||
public static string[] Disallowed { get; } =
|
||||
{
|
||||
"jigaboo",
|
||||
"chigaboo",
|
||||
|
|
@ -93,16 +94,16 @@ namespace Server.Misc
|
|||
from.CriminalAction(false);
|
||||
return true;
|
||||
case ProfanityAction.Disconnect:
|
||||
{
|
||||
from.NetState?.Dispose();
|
||||
{
|
||||
from.NetState?.Dispose();
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
case ProfanityAction.Other: // TODO: Provide custom implementation if this is chosen
|
||||
{
|
||||
return true;
|
||||
}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Server.Misc
|
|||
{
|
||||
public class ProtocolExtensions
|
||||
{
|
||||
private static PacketHandler[] m_Handlers = new PacketHandler[0x100];
|
||||
private static readonly PacketHandler[] m_Handlers = new PacketHandler[0x100];
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -58,7 +58,7 @@ namespace Server.Misc
|
|||
{
|
||||
EnsureCapacity(4 + capacity);
|
||||
|
||||
m_Stream.Write((byte)packetID);
|
||||
Stream.Write((byte)packetID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -35,8 +35,8 @@ namespace Server.Misc
|
|||
if (itemID == 0)
|
||||
return true;
|
||||
|
||||
if (female && itemID == 0x2048 || !female && itemID == 0x2046)
|
||||
return false; //Buns & Receding Hair
|
||||
if ((female && itemID == 0x2048) || (!female && itemID == 0x2046))
|
||||
return false; // Buns & Receding Hair
|
||||
|
||||
if (itemID >= 0x203B && itemID <= 0x203D)
|
||||
return true;
|
||||
|
|
@ -47,19 +47,19 @@ namespace Server.Misc
|
|||
return false;
|
||||
}
|
||||
|
||||
public override int RandomHair(bool female) //Random hair doesn't include baldness
|
||||
public override int RandomHair(bool female) // Random hair doesn't include baldness
|
||||
{
|
||||
return Utility.Random(9) switch
|
||||
{
|
||||
0 => 0x203B, //Short
|
||||
1 => 0x203C, //Long
|
||||
2 => 0x203D, //Pony Tail
|
||||
3 => 0x2044, //Mohawk
|
||||
4 => 0x2045, //Pageboy
|
||||
5 => 0x2047, //Afro
|
||||
6 => 0x2049, //Pig tails
|
||||
7 => 0x204A, //Krisna
|
||||
_ => (female ? 0x2046 : 0x2048)
|
||||
0 => 0x203B, // Short
|
||||
1 => 0x203C, // Long
|
||||
2 => 0x203D, // Pony Tail
|
||||
3 => 0x2044, // Mohawk
|
||||
4 => 0x2045, // Pageboy
|
||||
5 => 0x2047, // Afro
|
||||
6 => 0x2049, // Pig tails
|
||||
7 => 0x204A, // Krisna
|
||||
_ => female ? 0x2046 : 0x2048
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ namespace Server.Misc
|
|||
|
||||
private class Elf : Race
|
||||
{
|
||||
private static int[] m_SkinHues =
|
||||
private static readonly int[] m_SkinHues =
|
||||
{
|
||||
0x0BF, 0x24D, 0x24E, 0x24F, 0x353, 0x361, 0x367, 0x374,
|
||||
0x375, 0x376, 0x381, 0x382, 0x383, 0x384, 0x385, 0x389,
|
||||
|
|
@ -123,7 +123,7 @@ namespace Server.Misc
|
|||
0x51D, 0x53F, 0x579, 0x76B, 0x76C, 0x76D, 0x835, 0x903
|
||||
};
|
||||
|
||||
private static int[] m_HairHues =
|
||||
private static readonly int[] m_HairHues =
|
||||
{
|
||||
0x034, 0x035, 0x036, 0x037, 0x038, 0x039, 0x058, 0x08E,
|
||||
0x08F, 0x090, 0x091, 0x092, 0x101, 0x159, 0x15A, 0x15B,
|
||||
|
|
@ -144,7 +144,7 @@ namespace Server.Misc
|
|||
if (itemID == 0)
|
||||
return true;
|
||||
|
||||
if (female && (itemID == 0x2FCD || itemID == 0x2FBF) || !female && (itemID == 0x2FCC || itemID == 0x2FD0))
|
||||
if ((female && (itemID == 0x2FCD || itemID == 0x2FBF)) || (!female && (itemID == 0x2FCC || itemID == 0x2FD0)))
|
||||
return false;
|
||||
|
||||
if (itemID >= 0x2FBF && itemID <= 0x2FC2)
|
||||
|
|
@ -156,18 +156,18 @@ namespace Server.Misc
|
|||
return false;
|
||||
}
|
||||
|
||||
public override int RandomHair(bool female) //Random hair doesn't include baldness
|
||||
public override int RandomHair(bool female) // Random hair doesn't include baldness
|
||||
{
|
||||
return Utility.Random(8) switch
|
||||
{
|
||||
0 => 0x2FC0, //Long Feather
|
||||
1 => 0x2FC1, //Short
|
||||
2 => 0x2FC2, //Mullet
|
||||
3 => 0x2FCE, //Knob
|
||||
4 => 0x2FCF, //Braided
|
||||
5 => 0x2FD1, //Spiked
|
||||
6 => (female ? 0x2FCC : 0x2FBF), //Flower or Mid-long
|
||||
_ => (female ? 0x2FD0 : 0x2FCD)
|
||||
0 => 0x2FC0, // Long Feather
|
||||
1 => 0x2FC1, // Short
|
||||
2 => 0x2FC2, // Mullet
|
||||
3 => 0x2FCE, // Knob
|
||||
4 => 0x2FCF, // Braided
|
||||
5 => 0x2FD1, // Spiked
|
||||
6 => female ? 0x2FCC : 0x2FBF, // Flower or Mid-long
|
||||
_ => female ? 0x2FD0 : 0x2FCD
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -198,8 +198,6 @@ namespace Server.Misc
|
|||
public override int RandomHairHue() => m_HairHues[Utility.Random(m_HairHues.Length)];
|
||||
}
|
||||
|
||||
#region SA
|
||||
|
||||
private class Gargoyle : Race
|
||||
{
|
||||
// Todo Finish body hues
|
||||
|
|
@ -229,7 +227,7 @@ namespace Server.Misc
|
|||
{
|
||||
if (female == false) return itemID >= 0x4258 && itemID <= 0x425F;
|
||||
|
||||
return itemID == 0x4261 || itemID == 0x4262 || itemID >= 0x4273 && itemID <= 0x4275 || itemID == 0x42B0 ||
|
||||
return itemID == 0x4261 || itemID == 0x4262 || (itemID >= 0x4273 && itemID <= 0x4275) || itemID == 0x42B0 ||
|
||||
itemID == 0x42B1 || itemID == 0x42AA || itemID == 0x42AB;
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +271,5 @@ namespace Server.Misc
|
|||
|
||||
public override int RandomHairHue() => m_HornHues[Utility.Random(m_HornHues.Length)];
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,13 +55,13 @@ namespace Server.Misc
|
|||
if (bc?.IsParagon == true || from is Leviathan)
|
||||
points += 40;
|
||||
|
||||
if (Core.ML && from.Race == Race.Human) //Is this affected by the cap?
|
||||
if (Core.ML && from.Race == Race.Human) // Is this affected by the cap?
|
||||
points += 2;
|
||||
|
||||
if (points < 0)
|
||||
points = 0;
|
||||
|
||||
if (Core.ML && from is PlayerMobile) //does racial bonus go before/after?
|
||||
if (Core.ML && from is PlayerMobile) // does racial bonus go before/after?
|
||||
points = Math.Min(points, 18);
|
||||
|
||||
if (CheckTransform(from, typeof(HorrificBeastSpell)))
|
||||
|
|
@ -82,7 +82,7 @@ namespace Server.Misc
|
|||
|
||||
int points = (int)(from.Skills.Focus.Value * 0.1);
|
||||
|
||||
if (from is BaseCreature creature && creature.IsParagon || from is Leviathan)
|
||||
if ((from is BaseCreature creature && creature.IsParagon) || from is Leviathan)
|
||||
points += 40;
|
||||
|
||||
int cappedPoints = AosAttributes.GetValue(from, AosAttribute.RegenStam);
|
||||
|
|
@ -130,7 +130,7 @@ namespace Server.Misc
|
|||
|
||||
double totalPoints = focusPoints + medPoints + (from.Meditating ? medPoints > 13.0 ? 13.0 : medPoints : 0.0);
|
||||
|
||||
if (from is BaseCreature creature && creature.IsParagon || from is Leviathan)
|
||||
if ((from is BaseCreature creature && creature.IsParagon) || from is Leviathan)
|
||||
totalPoints += 40;
|
||||
|
||||
int cappedPoints = AosAttributes.GetValue(from, AosAttribute.RegenMana);
|
||||
|
|
@ -205,7 +205,7 @@ namespace Server.Misc
|
|||
return ar.MeditationAllowance switch
|
||||
{
|
||||
ArmorMeditationAllowance.None => ar.BaseArmorRatingScaled,
|
||||
ArmorMeditationAllowance.Half => (ar.BaseArmorRatingScaled / 2.0),
|
||||
ArmorMeditationAllowance.Half => ar.BaseArmorRatingScaled / 2.0,
|
||||
ArmorMeditationAllowance.All => 0.0,
|
||||
_ => ar.BaseArmorRatingScaled
|
||||
};
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ namespace Server.Items
|
|||
dullCopper.WeaponLowerRequirements = 50;
|
||||
dullCopper.RunicMinAttributes = 1;
|
||||
dullCopper.RunicMaxAttributes = 2;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
dullCopper.RunicMinIntensity = 40;
|
||||
dullCopper.RunicMaxIntensity = 100;
|
||||
|
|
@ -134,7 +134,7 @@ namespace Server.Items
|
|||
shadowIron.WeaponDurability = 50;
|
||||
shadowIron.RunicMinAttributes = 2;
|
||||
shadowIron.RunicMaxAttributes = 2;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
shadowIron.RunicMinIntensity = 45;
|
||||
shadowIron.RunicMaxIntensity = 100;
|
||||
|
|
@ -155,7 +155,7 @@ namespace Server.Items
|
|||
copper.WeaponEnergyDamage = 20;
|
||||
copper.RunicMinAttributes = 2;
|
||||
copper.RunicMaxAttributes = 3;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
copper.RunicMinIntensity = 50;
|
||||
copper.RunicMaxIntensity = 100;
|
||||
|
|
@ -175,7 +175,7 @@ namespace Server.Items
|
|||
bronze.WeaponFireDamage = 40;
|
||||
bronze.RunicMinAttributes = 3;
|
||||
bronze.RunicMaxAttributes = 3;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
bronze.RunicMinIntensity = 55;
|
||||
bronze.RunicMaxIntensity = 100;
|
||||
|
|
@ -198,7 +198,7 @@ namespace Server.Items
|
|||
golden.WeaponLowerRequirements = 50;
|
||||
golden.RunicMinAttributes = 3;
|
||||
golden.RunicMaxAttributes = 4;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
golden.RunicMinIntensity = 60;
|
||||
golden.RunicMaxIntensity = 100;
|
||||
|
|
@ -220,7 +220,7 @@ namespace Server.Items
|
|||
agapite.WeaponEnergyDamage = 20;
|
||||
agapite.RunicMinAttributes = 4;
|
||||
agapite.RunicMaxAttributes = 4;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
agapite.RunicMinIntensity = 65;
|
||||
agapite.RunicMaxIntensity = 100;
|
||||
|
|
@ -242,7 +242,7 @@ namespace Server.Items
|
|||
verite.WeaponEnergyDamage = 20;
|
||||
verite.RunicMinAttributes = 4;
|
||||
verite.RunicMaxAttributes = 5;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
verite.RunicMinIntensity = 70;
|
||||
verite.RunicMaxIntensity = 100;
|
||||
|
|
@ -266,7 +266,7 @@ namespace Server.Items
|
|||
valorite.WeaponEnergyDamage = 20;
|
||||
valorite.RunicMinAttributes = 5;
|
||||
valorite.RunicMaxAttributes = 5;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
valorite.RunicMinIntensity = 85;
|
||||
valorite.RunicMaxIntensity = 100;
|
||||
|
|
@ -283,7 +283,7 @@ namespace Server.Items
|
|||
spined.ArmorLuck = 40;
|
||||
spined.RunicMinAttributes = 1;
|
||||
spined.RunicMaxAttributes = 3;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
spined.RunicMinIntensity = 40;
|
||||
spined.RunicMaxIntensity = 100;
|
||||
|
|
@ -303,7 +303,7 @@ namespace Server.Items
|
|||
horned.ArmorEnergyResist = 2;
|
||||
horned.RunicMinAttributes = 3;
|
||||
horned.RunicMaxAttributes = 4;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
horned.RunicMinIntensity = 45;
|
||||
horned.RunicMaxIntensity = 100;
|
||||
|
|
@ -323,7 +323,7 @@ namespace Server.Items
|
|||
barbed.ArmorEnergyResist = 4;
|
||||
barbed.RunicMinAttributes = 4;
|
||||
barbed.RunicMaxAttributes = 5;
|
||||
if ( Core.ML )
|
||||
if (Core.ML)
|
||||
{
|
||||
barbed.RunicMinIntensity = 50;
|
||||
barbed.RunicMaxIntensity = 100;
|
||||
|
|
@ -364,7 +364,7 @@ namespace Server.Items
|
|||
blue.ArmorPoisonResist = -3;
|
||||
blue.ArmorEnergyResist = 10;
|
||||
|
||||
//public static readonly CraftAttributeInfo OakWood, AshWood, YewWood, Heartwood, Bloodwood, Frostwood;
|
||||
// public static readonly CraftAttributeInfo OakWood, AshWood, YewWood, Heartwood, Bloodwood, Frostwood;
|
||||
|
||||
CraftAttributeInfo oak = OakWood = new CraftAttributeInfo();
|
||||
|
||||
|
|
@ -394,7 +394,7 @@ namespace Server.Items
|
|||
|
||||
public Type[] ResourceTypes { get; }
|
||||
|
||||
public CraftResourceInfo( int hue, int number, string name, CraftAttributeInfo attributeInfo, CraftResource resource, params Type[] resourceTypes )
|
||||
public CraftResourceInfo(int hue, int number, string name, CraftAttributeInfo attributeInfo, CraftResource resource, params Type[] resourceTypes)
|
||||
{
|
||||
Hue = hue;
|
||||
Number = number;
|
||||
|
|
@ -403,71 +403,71 @@ namespace Server.Items
|
|||
Resource = resource;
|
||||
ResourceTypes = resourceTypes;
|
||||
|
||||
for ( int i = 0; i < resourceTypes.Length; ++i )
|
||||
CraftResources.RegisterType( resourceTypes[i], resource );
|
||||
for (int i = 0; i < resourceTypes.Length; ++i)
|
||||
CraftResources.RegisterType(resourceTypes[i], resource);
|
||||
}
|
||||
}
|
||||
|
||||
public class CraftResources
|
||||
public static class CraftResources
|
||||
{
|
||||
private static CraftResourceInfo[] m_MetalInfo = {
|
||||
new CraftResourceInfo( 0x000, 1053109, "Iron", CraftAttributeInfo.Blank, CraftResource.Iron, typeof( IronIngot ), typeof( IronOre ), typeof( Granite ) ),
|
||||
new CraftResourceInfo( 0x973, 1053108, "Dull Copper", CraftAttributeInfo.DullCopper, CraftResource.DullCopper, typeof( DullCopperIngot ), typeof( DullCopperOre ), typeof( DullCopperGranite ) ),
|
||||
new CraftResourceInfo( 0x966, 1053107, "Shadow Iron", CraftAttributeInfo.ShadowIron, CraftResource.ShadowIron, typeof( ShadowIronIngot ), typeof( ShadowIronOre ), typeof( ShadowIronGranite ) ),
|
||||
new CraftResourceInfo( 0x96D, 1053106, "Copper", CraftAttributeInfo.Copper, CraftResource.Copper, typeof( CopperIngot ), typeof( CopperOre ), typeof( CopperGranite ) ),
|
||||
new CraftResourceInfo( 0x972, 1053105, "Bronze", CraftAttributeInfo.Bronze, CraftResource.Bronze, typeof( BronzeIngot ), typeof( BronzeOre ), typeof( BronzeGranite ) ),
|
||||
new CraftResourceInfo( 0x8A5, 1053104, "Gold", CraftAttributeInfo.Golden, CraftResource.Gold, typeof( GoldIngot ), typeof( GoldOre ), typeof( GoldGranite ) ),
|
||||
new CraftResourceInfo( 0x979, 1053103, "Agapite", CraftAttributeInfo.Agapite, CraftResource.Agapite, typeof( AgapiteIngot ), typeof( AgapiteOre ), typeof( AgapiteGranite ) ),
|
||||
new CraftResourceInfo( 0x89F, 1053102, "Verite", CraftAttributeInfo.Verite, CraftResource.Verite, typeof( VeriteIngot ), typeof( VeriteOre ), typeof( VeriteGranite ) ),
|
||||
new CraftResourceInfo( 0x8AB, 1053101, "Valorite", CraftAttributeInfo.Valorite, CraftResource.Valorite, typeof( ValoriteIngot ), typeof( ValoriteOre ), typeof( ValoriteGranite ) )
|
||||
private static readonly CraftResourceInfo[] m_MetalInfo = {
|
||||
new CraftResourceInfo(0x000, 1053109, "Iron", CraftAttributeInfo.Blank, CraftResource.Iron, typeof(IronIngot), typeof(IronOre), typeof(Granite)),
|
||||
new CraftResourceInfo(0x973, 1053108, "Dull Copper", CraftAttributeInfo.DullCopper, CraftResource.DullCopper, typeof(DullCopperIngot), typeof(DullCopperOre), typeof(DullCopperGranite)),
|
||||
new CraftResourceInfo(0x966, 1053107, "Shadow Iron", CraftAttributeInfo.ShadowIron, CraftResource.ShadowIron, typeof(ShadowIronIngot), typeof(ShadowIronOre), typeof(ShadowIronGranite)),
|
||||
new CraftResourceInfo(0x96D, 1053106, "Copper", CraftAttributeInfo.Copper, CraftResource.Copper, typeof(CopperIngot), typeof(CopperOre), typeof(CopperGranite)),
|
||||
new CraftResourceInfo(0x972, 1053105, "Bronze", CraftAttributeInfo.Bronze, CraftResource.Bronze, typeof(BronzeIngot), typeof(BronzeOre), typeof(BronzeGranite)),
|
||||
new CraftResourceInfo(0x8A5, 1053104, "Gold", CraftAttributeInfo.Golden, CraftResource.Gold, typeof(GoldIngot), typeof(GoldOre), typeof(GoldGranite)),
|
||||
new CraftResourceInfo(0x979, 1053103, "Agapite", CraftAttributeInfo.Agapite, CraftResource.Agapite, typeof(AgapiteIngot), typeof(AgapiteOre), typeof(AgapiteGranite)),
|
||||
new CraftResourceInfo(0x89F, 1053102, "Verite", CraftAttributeInfo.Verite, CraftResource.Verite, typeof(VeriteIngot), typeof(VeriteOre), typeof(VeriteGranite)),
|
||||
new CraftResourceInfo(0x8AB, 1053101, "Valorite", CraftAttributeInfo.Valorite, CraftResource.Valorite, typeof(ValoriteIngot), typeof(ValoriteOre), typeof(ValoriteGranite))
|
||||
};
|
||||
|
||||
private static CraftResourceInfo[] m_ScaleInfo = {
|
||||
new CraftResourceInfo( 0x66D, 1053129, "Red Scales", CraftAttributeInfo.RedScales, CraftResource.RedScales, typeof( RedScales ) ),
|
||||
new CraftResourceInfo( 0x8A8, 1053130, "Yellow Scales", CraftAttributeInfo.YellowScales, CraftResource.YellowScales, typeof( YellowScales ) ),
|
||||
new CraftResourceInfo( 0x455, 1053131, "Black Scales", CraftAttributeInfo.BlackScales, CraftResource.BlackScales, typeof( BlackScales ) ),
|
||||
new CraftResourceInfo( 0x851, 1053132, "Green Scales", CraftAttributeInfo.GreenScales, CraftResource.GreenScales, typeof( GreenScales ) ),
|
||||
new CraftResourceInfo( 0x8FD, 1053133, "White Scales", CraftAttributeInfo.WhiteScales, CraftResource.WhiteScales, typeof( WhiteScales ) ),
|
||||
new CraftResourceInfo( 0x8B0, 1053134, "Blue Scales", CraftAttributeInfo.BlueScales, CraftResource.BlueScales, typeof( BlueScales ) )
|
||||
private static readonly CraftResourceInfo[] m_ScaleInfo = {
|
||||
new CraftResourceInfo(0x66D, 1053129, "Red Scales", CraftAttributeInfo.RedScales, CraftResource.RedScales, typeof(RedScales)),
|
||||
new CraftResourceInfo(0x8A8, 1053130, "Yellow Scales", CraftAttributeInfo.YellowScales, CraftResource.YellowScales, typeof(YellowScales)),
|
||||
new CraftResourceInfo(0x455, 1053131, "Black Scales", CraftAttributeInfo.BlackScales, CraftResource.BlackScales, typeof(BlackScales)),
|
||||
new CraftResourceInfo(0x851, 1053132, "Green Scales", CraftAttributeInfo.GreenScales, CraftResource.GreenScales, typeof(GreenScales)),
|
||||
new CraftResourceInfo(0x8FD, 1053133, "White Scales", CraftAttributeInfo.WhiteScales, CraftResource.WhiteScales, typeof(WhiteScales)),
|
||||
new CraftResourceInfo(0x8B0, 1053134, "Blue Scales", CraftAttributeInfo.BlueScales, CraftResource.BlueScales, typeof(BlueScales))
|
||||
};
|
||||
|
||||
private static CraftResourceInfo[] m_LeatherInfo = {
|
||||
new CraftResourceInfo( 0x000, 1049353, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularLeather, typeof( Leather ), typeof( Hides ) ),
|
||||
new CraftResourceInfo( 0x283, 1049354, "Spined", CraftAttributeInfo.Spined, CraftResource.SpinedLeather, typeof( SpinedLeather ), typeof( SpinedHides ) ),
|
||||
new CraftResourceInfo( 0x227, 1049355, "Horned", CraftAttributeInfo.Horned, CraftResource.HornedLeather, typeof( HornedLeather ), typeof( HornedHides ) ),
|
||||
new CraftResourceInfo( 0x1C1, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather, typeof( BarbedLeather ), typeof( BarbedHides ) )
|
||||
private static readonly CraftResourceInfo[] m_LeatherInfo = {
|
||||
new CraftResourceInfo(0x000, 1049353, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularLeather, typeof(Leather), typeof(Hides)),
|
||||
new CraftResourceInfo(0x283, 1049354, "Spined", CraftAttributeInfo.Spined, CraftResource.SpinedLeather, typeof(SpinedLeather), typeof(SpinedHides)),
|
||||
new CraftResourceInfo(0x227, 1049355, "Horned", CraftAttributeInfo.Horned, CraftResource.HornedLeather, typeof(HornedLeather), typeof(HornedHides)),
|
||||
new CraftResourceInfo(0x1C1, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather, typeof(BarbedLeather), typeof(BarbedHides))
|
||||
};
|
||||
|
||||
private static CraftResourceInfo[] m_AOSLeatherInfo = {
|
||||
new CraftResourceInfo( 0x000, 1049353, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularLeather, typeof( Leather ), typeof( Hides ) ),
|
||||
new CraftResourceInfo( 0x8AC, 1049354, "Spined", CraftAttributeInfo.Spined, CraftResource.SpinedLeather, typeof( SpinedLeather ), typeof( SpinedHides ) ),
|
||||
new CraftResourceInfo( 0x845, 1049355, "Horned", CraftAttributeInfo.Horned, CraftResource.HornedLeather, typeof( HornedLeather ), typeof( HornedHides ) ),
|
||||
new CraftResourceInfo( 0x851, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather, typeof( BarbedLeather ), typeof( BarbedHides ) )
|
||||
private static readonly CraftResourceInfo[] m_AOSLeatherInfo = {
|
||||
new CraftResourceInfo(0x000, 1049353, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularLeather, typeof(Leather), typeof(Hides)),
|
||||
new CraftResourceInfo(0x8AC, 1049354, "Spined", CraftAttributeInfo.Spined, CraftResource.SpinedLeather, typeof(SpinedLeather), typeof(SpinedHides)),
|
||||
new CraftResourceInfo(0x845, 1049355, "Horned", CraftAttributeInfo.Horned, CraftResource.HornedLeather, typeof(HornedLeather), typeof(HornedHides)),
|
||||
new CraftResourceInfo(0x851, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather, typeof(BarbedLeather), typeof(BarbedHides))
|
||||
};
|
||||
|
||||
private static CraftResourceInfo[] m_WoodInfo = {
|
||||
new CraftResourceInfo( 0x000, 1011542, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularWood, typeof( Log ), typeof( Board ) ),
|
||||
new CraftResourceInfo( 0x7DA, 1072533, "Oak", CraftAttributeInfo.OakWood, CraftResource.OakWood, typeof( OakLog ), typeof( OakBoard ) ),
|
||||
new CraftResourceInfo( 0x4A7, 1072534, "Ash", CraftAttributeInfo.AshWood, CraftResource.AshWood, typeof( AshLog ), typeof( AshBoard ) ),
|
||||
new CraftResourceInfo( 0x4A8, 1072535, "Yew", CraftAttributeInfo.YewWood, CraftResource.YewWood, typeof( YewLog ), typeof( YewBoard ) ),
|
||||
new CraftResourceInfo( 0x4A9, 1072536, "Heartwood", CraftAttributeInfo.Heartwood, CraftResource.Heartwood, typeof( HeartwoodLog ), typeof( HeartwoodBoard ) ),
|
||||
new CraftResourceInfo( 0x4AA, 1072538, "Bloodwood", CraftAttributeInfo.Bloodwood, CraftResource.Bloodwood, typeof( BloodwoodLog ), typeof( BloodwoodBoard ) ),
|
||||
new CraftResourceInfo( 0x47F, 1072539, "Frostwood", CraftAttributeInfo.Frostwood, CraftResource.Frostwood, typeof( FrostwoodLog ), typeof( FrostwoodBoard ) )
|
||||
private static readonly CraftResourceInfo[] m_WoodInfo = {
|
||||
new CraftResourceInfo(0x000, 1011542, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularWood, typeof(Log), typeof(Board)),
|
||||
new CraftResourceInfo(0x7DA, 1072533, "Oak", CraftAttributeInfo.OakWood, CraftResource.OakWood, typeof(OakLog), typeof(OakBoard)),
|
||||
new CraftResourceInfo(0x4A7, 1072534, "Ash", CraftAttributeInfo.AshWood, CraftResource.AshWood, typeof(AshLog), typeof(AshBoard)),
|
||||
new CraftResourceInfo(0x4A8, 1072535, "Yew", CraftAttributeInfo.YewWood, CraftResource.YewWood, typeof(YewLog), typeof(YewBoard)),
|
||||
new CraftResourceInfo(0x4A9, 1072536, "Heartwood", CraftAttributeInfo.Heartwood, CraftResource.Heartwood, typeof(HeartwoodLog), typeof(HeartwoodBoard)),
|
||||
new CraftResourceInfo(0x4AA, 1072538, "Bloodwood", CraftAttributeInfo.Bloodwood, CraftResource.Bloodwood, typeof(BloodwoodLog), typeof(BloodwoodBoard)),
|
||||
new CraftResourceInfo(0x47F, 1072539, "Frostwood", CraftAttributeInfo.Frostwood, CraftResource.Frostwood, typeof(FrostwoodLog), typeof(FrostwoodBoard))
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if '<paramref name="resource"/>' is None, Iron, RegularLeather or RegularWood. False if otherwise.
|
||||
/// </summary>
|
||||
public static bool IsStandard( CraftResource resource ) => resource == CraftResource.None || resource == CraftResource.Iron || resource == CraftResource.RegularLeather || resource == CraftResource.RegularWood;
|
||||
public static bool IsStandard(CraftResource resource) => resource == CraftResource.None || resource == CraftResource.Iron || resource == CraftResource.RegularLeather || resource == CraftResource.RegularWood;
|
||||
|
||||
private static Dictionary<Type, CraftResource> m_TypeTable;
|
||||
|
||||
/// <summary>
|
||||
/// Registers that '<paramref name="resourceType"/>' uses '<paramref name="resource"/>' so that it can later be queried by <see cref="CraftResources.GetFromType"/>
|
||||
/// </summary>
|
||||
public static void RegisterType( Type resourceType, CraftResource resource )
|
||||
public static void RegisterType(Type resourceType, CraftResource resource)
|
||||
{
|
||||
if ( m_TypeTable == null )
|
||||
if (m_TypeTable == null)
|
||||
m_TypeTable = new Dictionary<Type, CraftResource>();
|
||||
|
||||
m_TypeTable[resourceType] = resource;
|
||||
|
|
@ -476,9 +476,9 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns the <see cref="CraftResource"/> value for which '<paramref name="resourceType"/>' uses -or- CraftResource.None if an unregistered type was specified.
|
||||
/// </summary>
|
||||
public static CraftResource GetFromType( Type resourceType )
|
||||
public static CraftResource GetFromType(Type resourceType)
|
||||
{
|
||||
if ( m_TypeTable == null )
|
||||
if (m_TypeTable == null)
|
||||
return CraftResource.None;
|
||||
|
||||
return m_TypeTable.TryGetValue(resourceType, out CraftResource res) ? res : CraftResource.None;
|
||||
|
|
@ -487,22 +487,22 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns a <see cref="CraftResourceInfo"/> instance describing '<paramref name="resource"/>' -or- null if an invalid resource was specified.
|
||||
/// </summary>
|
||||
public static CraftResourceInfo GetInfo( CraftResource resource )
|
||||
public static CraftResourceInfo GetInfo(CraftResource resource)
|
||||
{
|
||||
var list = GetType(resource) switch
|
||||
{
|
||||
CraftResourceType.Metal => m_MetalInfo,
|
||||
CraftResourceType.Leather => (Core.AOS ? m_AOSLeatherInfo : m_LeatherInfo),
|
||||
CraftResourceType.Leather => Core.AOS ? m_AOSLeatherInfo : m_LeatherInfo,
|
||||
CraftResourceType.Scales => m_ScaleInfo,
|
||||
CraftResourceType.Wood => m_WoodInfo,
|
||||
_ => null
|
||||
};
|
||||
|
||||
if ( list != null )
|
||||
if (list != null)
|
||||
{
|
||||
int index = GetIndex( resource );
|
||||
int index = GetIndex(resource);
|
||||
|
||||
if ( index >= 0 && index < list.Length )
|
||||
if (index >= 0 && index < list.Length)
|
||||
return list[index];
|
||||
}
|
||||
|
||||
|
|
@ -512,18 +512,18 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns a <see cref="CraftResourceType"/> value indiciating the type of '<paramref name="resource"/>'.
|
||||
/// </summary>
|
||||
public static CraftResourceType GetType( CraftResource resource )
|
||||
public static CraftResourceType GetType(CraftResource resource)
|
||||
{
|
||||
if ( resource >= CraftResource.Iron && resource <= CraftResource.Valorite )
|
||||
if (resource >= CraftResource.Iron && resource <= CraftResource.Valorite)
|
||||
return CraftResourceType.Metal;
|
||||
|
||||
if ( resource >= CraftResource.RegularLeather && resource <= CraftResource.BarbedLeather )
|
||||
if (resource >= CraftResource.RegularLeather && resource <= CraftResource.BarbedLeather)
|
||||
return CraftResourceType.Leather;
|
||||
|
||||
if ( resource >= CraftResource.RedScales && resource <= CraftResource.BlueScales )
|
||||
if (resource >= CraftResource.RedScales && resource <= CraftResource.BlueScales)
|
||||
return CraftResourceType.Scales;
|
||||
|
||||
if ( resource >= CraftResource.RegularWood && resource <= CraftResource.Frostwood )
|
||||
if (resource >= CraftResource.RegularWood && resource <= CraftResource.Frostwood)
|
||||
return CraftResourceType.Wood;
|
||||
|
||||
return CraftResourceType.None;
|
||||
|
|
@ -532,7 +532,7 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns the first <see cref="CraftResource"/> in the series of resources for which '<paramref name="resource"/>' belongs.
|
||||
/// </summary>
|
||||
public static CraftResource GetStart( CraftResource resource )
|
||||
public static CraftResource GetStart(CraftResource resource)
|
||||
{
|
||||
return GetType(resource) switch
|
||||
{
|
||||
|
|
@ -547,11 +547,11 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns the index of '<paramref name="resource"/>' in the seriest of resources for which it belongs.
|
||||
/// </summary>
|
||||
public static int GetIndex( CraftResource resource )
|
||||
public static int GetIndex(CraftResource resource)
|
||||
{
|
||||
CraftResource start = GetStart( resource );
|
||||
CraftResource start = GetStart(resource);
|
||||
|
||||
if ( start == CraftResource.None )
|
||||
if (start == CraftResource.None)
|
||||
return 0;
|
||||
|
||||
return resource - start;
|
||||
|
|
@ -560,9 +560,9 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns the <see cref="CraftResourceInfo.Number"/> property of '<paramref name="resource"/>' -or- 0 if an invalid resource was specified.
|
||||
/// </summary>
|
||||
public static int GetLocalizationNumber( CraftResource resource )
|
||||
public static int GetLocalizationNumber(CraftResource resource)
|
||||
{
|
||||
CraftResourceInfo info = GetInfo( resource );
|
||||
CraftResourceInfo info = GetInfo(resource);
|
||||
|
||||
return info?.Number ?? 0;
|
||||
}
|
||||
|
|
@ -570,9 +570,9 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns the <see cref="CraftResourceInfo.Hue"/> property of '<paramref name="resource"/>' -or- 0 if an invalid resource was specified.
|
||||
/// </summary>
|
||||
public static int GetHue( CraftResource resource )
|
||||
public static int GetHue(CraftResource resource)
|
||||
{
|
||||
CraftResourceInfo info = GetInfo( resource );
|
||||
CraftResourceInfo info = GetInfo(resource);
|
||||
|
||||
return info?.Hue ?? 0;
|
||||
}
|
||||
|
|
@ -580,9 +580,9 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns the <see cref="CraftResourceInfo.Name"/> property of '<paramref name="resource"/>' -or- an empty string if the resource specified was invalid.
|
||||
/// </summary>
|
||||
public static string GetName( CraftResource resource )
|
||||
public static string GetName(CraftResource resource)
|
||||
{
|
||||
CraftResourceInfo info = GetInfo( resource );
|
||||
CraftResourceInfo info = GetInfo(resource);
|
||||
|
||||
return info == null ? string.Empty : info.Name;
|
||||
}
|
||||
|
|
@ -590,34 +590,34 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns the <see cref="CraftResource"/> value which represents '<paramref name="info"/>' -or- CraftResource.None if unable to convert.
|
||||
/// </summary>
|
||||
public static CraftResource GetFromOreInfo( OreInfo info )
|
||||
public static CraftResource GetFromOreInfo(OreInfo info)
|
||||
{
|
||||
if ( info.Name.IndexOf( "Spined" ) >= 0 )
|
||||
if (info.Name.IndexOf("Spined") >= 0)
|
||||
return CraftResource.SpinedLeather;
|
||||
if ( info.Name.IndexOf( "Horned" ) >= 0 )
|
||||
if (info.Name.IndexOf("Horned") >= 0)
|
||||
return CraftResource.HornedLeather;
|
||||
if ( info.Name.IndexOf( "Barbed" ) >= 0 )
|
||||
if (info.Name.IndexOf("Barbed") >= 0)
|
||||
return CraftResource.BarbedLeather;
|
||||
if ( info.Name.IndexOf( "Leather" ) >= 0 )
|
||||
if (info.Name.IndexOf("Leather") >= 0)
|
||||
return CraftResource.RegularLeather;
|
||||
|
||||
if ( info.Level == 0 )
|
||||
if (info.Level == 0)
|
||||
return CraftResource.Iron;
|
||||
if ( info.Level == 1 )
|
||||
if (info.Level == 1)
|
||||
return CraftResource.DullCopper;
|
||||
if ( info.Level == 2 )
|
||||
if (info.Level == 2)
|
||||
return CraftResource.ShadowIron;
|
||||
if ( info.Level == 3 )
|
||||
if (info.Level == 3)
|
||||
return CraftResource.Copper;
|
||||
if ( info.Level == 4 )
|
||||
if (info.Level == 4)
|
||||
return CraftResource.Bronze;
|
||||
if ( info.Level == 5 )
|
||||
if (info.Level == 5)
|
||||
return CraftResource.Gold;
|
||||
if ( info.Level == 6 )
|
||||
if (info.Level == 6)
|
||||
return CraftResource.Agapite;
|
||||
if ( info.Level == 7 )
|
||||
if (info.Level == 7)
|
||||
return CraftResource.Verite;
|
||||
if ( info.Level == 8 )
|
||||
if (info.Level == 8)
|
||||
return CraftResource.Valorite;
|
||||
|
||||
return CraftResource.None;
|
||||
|
|
@ -626,24 +626,24 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns the <see cref="CraftResource"/> value which represents '<paramref name="info"/>', using '<paramref name="material"/>' to help resolve leather OreInfo instances.
|
||||
/// </summary>
|
||||
public static CraftResource GetFromOreInfo( OreInfo info, ArmorMaterialType material )
|
||||
public static CraftResource GetFromOreInfo(OreInfo info, ArmorMaterialType material)
|
||||
{
|
||||
if ( material == ArmorMaterialType.Studded || material == ArmorMaterialType.Leather || material == ArmorMaterialType.Spined ||
|
||||
material == ArmorMaterialType.Horned || material == ArmorMaterialType.Barbed )
|
||||
if (material == ArmorMaterialType.Studded || material == ArmorMaterialType.Leather || material == ArmorMaterialType.Spined ||
|
||||
material == ArmorMaterialType.Horned || material == ArmorMaterialType.Barbed)
|
||||
{
|
||||
if ( info.Level == 0 )
|
||||
if (info.Level == 0)
|
||||
return CraftResource.RegularLeather;
|
||||
if ( info.Level == 1 )
|
||||
if (info.Level == 1)
|
||||
return CraftResource.SpinedLeather;
|
||||
if ( info.Level == 2 )
|
||||
if (info.Level == 2)
|
||||
return CraftResource.HornedLeather;
|
||||
if ( info.Level == 3 )
|
||||
if (info.Level == 3)
|
||||
return CraftResource.BarbedLeather;
|
||||
|
||||
return CraftResource.None;
|
||||
}
|
||||
|
||||
return GetFromOreInfo( info );
|
||||
return GetFromOreInfo(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -651,17 +651,17 @@ namespace Server.Items
|
|||
// No changes to it should be required for custom resources.
|
||||
public class OreInfo
|
||||
{
|
||||
public static readonly OreInfo Iron = new OreInfo( 0, 0x000, "Iron" );
|
||||
public static readonly OreInfo DullCopper = new OreInfo( 1, 0x973, "Dull Copper" );
|
||||
public static readonly OreInfo ShadowIron = new OreInfo( 2, 0x966, "Shadow Iron" );
|
||||
public static readonly OreInfo Copper = new OreInfo( 3, 0x96D, "Copper" );
|
||||
public static readonly OreInfo Bronze = new OreInfo( 4, 0x972, "Bronze" );
|
||||
public static readonly OreInfo Gold = new OreInfo( 5, 0x8A5, "Gold" );
|
||||
public static readonly OreInfo Agapite = new OreInfo( 6, 0x979, "Agapite" );
|
||||
public static readonly OreInfo Verite = new OreInfo( 7, 0x89F, "Verite" );
|
||||
public static readonly OreInfo Valorite = new OreInfo( 8, 0x8AB, "Valorite" );
|
||||
public static readonly OreInfo Iron = new OreInfo(0, 0x000, "Iron");
|
||||
public static readonly OreInfo DullCopper = new OreInfo(1, 0x973, "Dull Copper");
|
||||
public static readonly OreInfo ShadowIron = new OreInfo(2, 0x966, "Shadow Iron");
|
||||
public static readonly OreInfo Copper = new OreInfo(3, 0x96D, "Copper");
|
||||
public static readonly OreInfo Bronze = new OreInfo(4, 0x972, "Bronze");
|
||||
public static readonly OreInfo Gold = new OreInfo(5, 0x8A5, "Gold");
|
||||
public static readonly OreInfo Agapite = new OreInfo(6, 0x979, "Agapite");
|
||||
public static readonly OreInfo Verite = new OreInfo(7, 0x89F, "Verite");
|
||||
public static readonly OreInfo Valorite = new OreInfo(8, 0x8AB, "Valorite");
|
||||
|
||||
public OreInfo( int level, int hue, string name )
|
||||
public OreInfo(int level, int hue, string name)
|
||||
{
|
||||
Level = level;
|
||||
Hue = hue;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Server.Misc
|
|||
{
|
||||
public class ShardPoller : Item
|
||||
{
|
||||
private static List<ShardPoller> m_ActivePollers = new List<ShardPoller>();
|
||||
private static readonly List<ShardPoller> m_ActivePollers = new List<ShardPoller>();
|
||||
|
||||
private bool m_Active;
|
||||
private string m_Title;
|
||||
|
|
@ -19,8 +19,8 @@ namespace Server.Misc
|
|||
public ShardPoller() : base(0x1047)
|
||||
{
|
||||
Duration = TimeSpan.FromHours(24.0);
|
||||
Options = new ShardPollOption[0];
|
||||
Addresses = new IPAddress[0];
|
||||
Options = Array.Empty<ShardPollOption>();
|
||||
Addresses = Array.Empty<IPAddress>();
|
||||
|
||||
Movable = false;
|
||||
}
|
||||
|
|
@ -29,9 +29,9 @@ namespace Server.Misc
|
|||
{
|
||||
}
|
||||
|
||||
public ShardPollOption[] Options{ get; set; }
|
||||
public ShardPollOption[] Options { get; set; }
|
||||
|
||||
public IPAddress[] Addresses{ get; set; }
|
||||
public IPAddress[] Addresses { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
public string Title
|
||||
|
|
@ -41,10 +41,10 @@ namespace Server.Misc
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
public TimeSpan Duration{ get; set; }
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
public DateTime StartTime{ get; set; }
|
||||
public DateTime StartTime { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
public TimeSpan TimeRemaining
|
||||
|
|
@ -220,22 +220,22 @@ namespace Server.Misc
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Title = reader.ReadString();
|
||||
Duration = reader.ReadTimeSpan();
|
||||
StartTime = reader.ReadDateTime();
|
||||
m_Active = reader.ReadBool();
|
||||
{
|
||||
m_Title = reader.ReadString();
|
||||
Duration = reader.ReadTimeSpan();
|
||||
StartTime = reader.ReadDateTime();
|
||||
m_Active = reader.ReadBool();
|
||||
|
||||
Options = new ShardPollOption[reader.ReadInt()];
|
||||
Options = new ShardPollOption[reader.ReadInt()];
|
||||
|
||||
for (int i = 0; i < Options.Length; ++i)
|
||||
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);
|
||||
if (m_Active)
|
||||
m_ActivePollers.Add(this);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ namespace Server.Misc
|
|||
{
|
||||
m_Title = title;
|
||||
LineBreaks = GetBreaks(m_Title);
|
||||
Voters = new IPAddress[0];
|
||||
Voters = Array.Empty<IPAddress>();
|
||||
}
|
||||
|
||||
public ShardPollOption(IGenericReader reader)
|
||||
|
|
@ -265,17 +265,17 @@ namespace Server.Misc
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Title = reader.ReadString();
|
||||
LineBreaks = GetBreaks(m_Title);
|
||||
{
|
||||
m_Title = reader.ReadString();
|
||||
LineBreaks = GetBreaks(m_Title);
|
||||
|
||||
Voters = new IPAddress[reader.ReadInt()];
|
||||
Voters = new IPAddress[reader.ReadInt()];
|
||||
|
||||
for (int i = 0; i < Voters.Length; ++i)
|
||||
Voters[i] = Utility.Intern(reader.ReadIPAddress());
|
||||
for (int i = 0; i < Voters.Length; ++i)
|
||||
Voters[i] = Utility.Intern(reader.ReadIPAddress());
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -289,10 +289,10 @@ namespace Server.Misc
|
|||
}
|
||||
}
|
||||
|
||||
public int LineBreaks{ get; private set; }
|
||||
public int LineBreaks { get; private set; }
|
||||
|
||||
public int Votes => Voters.Length;
|
||||
public IPAddress[] Voters{ get; set; }
|
||||
public IPAddress[] Voters { get; set; }
|
||||
|
||||
public bool HasAlreadyVoted(NetState ns)
|
||||
{
|
||||
|
|
@ -365,8 +365,8 @@ namespace Server.Misc
|
|||
public class ShardPollGump : Gump
|
||||
{
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private Mobile m_From;
|
||||
private ShardPoller m_Poller;
|
||||
private readonly Mobile m_From;
|
||||
private readonly ShardPoller m_Poller;
|
||||
private Queue<ShardPoller> m_Polls;
|
||||
|
||||
public ShardPollGump(Mobile from, ShardPoller poller, bool editing, Queue<ShardPoller> polls) : base(50, 50)
|
||||
|
|
@ -461,7 +461,7 @@ namespace Server.Misc
|
|||
AddButton(314, height - 47, 242, 241, 0);
|
||||
}
|
||||
|
||||
public bool Editing{ get; }
|
||||
public bool Editing { get; }
|
||||
|
||||
public void QueuePoll(ShardPoller poller)
|
||||
{
|
||||
|
|
@ -539,11 +539,11 @@ namespace Server.Misc
|
|||
|
||||
public class ShardPollPrompt : Prompt
|
||||
{
|
||||
private static Regex m_UrlRegex =
|
||||
private static readonly Regex m_UrlRegex =
|
||||
new Regex(@"\[url(?:=(.*?))?\](.*?)\[/url\]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private ShardPollOption m_Option;
|
||||
private ShardPoller m_Poller;
|
||||
private readonly ShardPollOption m_Option;
|
||||
private readonly ShardPoller m_Poller;
|
||||
|
||||
public ShardPollPrompt(ShardPoller poller, ShardPollOption opt)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server
|
|||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
m_Table = new int[0];
|
||||
m_Table = System.Array.Empty<int>();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -72,4 +72,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@ namespace Server.Misc
|
|||
Int
|
||||
}
|
||||
|
||||
public const int Allowance = 3; //How many times may we use the same location/target for gain
|
||||
public const int Allowance = 3; // How many times may we use the same location/target for gain
|
||||
|
||||
private const int
|
||||
LocationSize = 5; //The size of eeach location, make this smaller so players dont have to move as far
|
||||
LocationSize = 5; // The size of eeach location, make this smaller so players dont have to move as far
|
||||
|
||||
private static readonly bool AntiMacroCode = !Core.ML; //Change this to false to disable anti-macro code
|
||||
private static readonly bool AntiMacroCode = !Core.ML; // Change this to false to disable anti-macro code
|
||||
|
||||
public static TimeSpan AntiMacroExpire = TimeSpan.FromMinutes(5.0); //How long do we remember targets/locations?
|
||||
public static TimeSpan AntiMacroExpire = TimeSpan.FromMinutes(5.0); // How long do we remember targets/locations?
|
||||
|
||||
private static bool[] UseAntiMacro =
|
||||
private static readonly bool[] UseAntiMacro =
|
||||
{
|
||||
// true if this skill uses the anti-macro code, false if it does not
|
||||
false, // Alchemy = 0,
|
||||
|
|
@ -79,12 +79,12 @@ namespace Server.Misc
|
|||
false, // Focus = 50,
|
||||
true, // Chivalry = 51
|
||||
true, // Bushido = 52
|
||||
true, //Ninjitsu = 53
|
||||
true, // Ninjitsu = 53
|
||||
true // Spellweaving
|
||||
};
|
||||
|
||||
private static TimeSpan m_StatGainDelay = TimeSpan.FromMinutes(Core.ML ? 0.05 : 15);
|
||||
private static TimeSpan m_PetStatGainDelay = TimeSpan.FromMinutes(5.0);
|
||||
private static readonly TimeSpan m_StatGainDelay = TimeSpan.FromMinutes(Core.ML ? 0.05 : 15);
|
||||
private static readonly TimeSpan m_PetStatGainDelay = TimeSpan.FromMinutes(5.0);
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -152,7 +152,7 @@ namespace Server.Misc
|
|||
if (from is BaseCreature creature && creature.Controlled)
|
||||
gc *= 2;
|
||||
|
||||
if (from.Alive && (gc >= Utility.RandomDouble() && AllowGain(from, skill, amObj) || skill.Base < 10.0))
|
||||
if (from.Alive && ((gc >= Utility.RandomDouble() && AllowGain(from, skill, amObj)) || skill.Base < 10.0))
|
||||
Gain(from, skill);
|
||||
|
||||
return success;
|
||||
|
|
@ -195,7 +195,7 @@ namespace Server.Misc
|
|||
|
||||
private static bool AllowGain(Mobile from, Skill skill, object obj)
|
||||
{
|
||||
if (Core.AOS && Faction.InSkillLoss(from)) //Changed some time between the introduction of AoS and SE.
|
||||
if (Core.AOS && Faction.InSkillLoss(from)) // Changed some time between the introduction of AoS and SE.
|
||||
return false;
|
||||
|
||||
if (AntiMacroCode && from is PlayerMobile mobile && UseAntiMacro[skill.Info.SkillID])
|
||||
|
|
@ -224,7 +224,7 @@ namespace Server.Misc
|
|||
|
||||
Skills skills = from.Skills;
|
||||
|
||||
if (from.Player && skills.Total / skills.Cap >= Utility.RandomDouble()) //( skills.Total >= skills.Cap )
|
||||
if (from.Player && skills.Total / skills.Cap >= Utility.RandomDouble())
|
||||
for (int i = 0; i < skills.Length; ++i)
|
||||
{
|
||||
Skill toLower = skills[i];
|
||||
|
|
@ -236,14 +236,10 @@ namespace Server.Misc
|
|||
}
|
||||
}
|
||||
|
||||
#region Scroll of Alacrity
|
||||
|
||||
if (from is PlayerMobile pm && skill.SkillName == pm.AcceleratedSkill &&
|
||||
pm.AcceleratedStart > DateTime.UtcNow)
|
||||
toGain *= Utility.RandomMinMax(2, 5);
|
||||
|
||||
#endregion
|
||||
|
||||
if (!from.Player || skills.Total + toGain <= skills.Cap) skill.BaseFixedPoint += toGain;
|
||||
}
|
||||
|
||||
|
|
@ -264,9 +260,9 @@ namespace Server.Misc
|
|||
{
|
||||
return stat switch
|
||||
{
|
||||
Stat.Str => (from.StrLock == StatLockType.Down && from.RawStr > 10),
|
||||
Stat.Dex => (from.DexLock == StatLockType.Down && from.RawDex > 10),
|
||||
Stat.Int => (from.IntLock == StatLockType.Down && from.RawInt > 10),
|
||||
Stat.Str => from.StrLock == StatLockType.Down && from.RawStr > 10,
|
||||
Stat.Dex => from.DexLock == StatLockType.Down && from.RawDex > 10,
|
||||
Stat.Int => from.IntLock == StatLockType.Down && from.RawInt > 10,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
|
@ -279,9 +275,9 @@ namespace Server.Misc
|
|||
|
||||
return stat switch
|
||||
{
|
||||
Stat.Str => (from.StrLock == StatLockType.Up && from.RawStr < 125),
|
||||
Stat.Dex => (from.DexLock == StatLockType.Up && from.RawDex < 125),
|
||||
Stat.Int => (from.IntLock == StatLockType.Up && from.RawInt < 125),
|
||||
Stat.Str => from.StrLock == StatLockType.Up && from.RawStr < 125,
|
||||
Stat.Dex => from.DexLock == StatLockType.Up && from.RawDex < 125,
|
||||
Stat.Int => from.IntLock == StatLockType.Up && from.RawInt < 125,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
|
@ -293,50 +289,50 @@ namespace Server.Misc
|
|||
switch (stat)
|
||||
{
|
||||
case Stat.Str:
|
||||
{
|
||||
if (atrophy)
|
||||
{
|
||||
if (CanLower(from, Stat.Dex) && (from.RawDex < from.RawInt || !CanLower(from, Stat.Int)))
|
||||
--from.RawDex;
|
||||
else if (CanLower(from, Stat.Int))
|
||||
--from.RawInt;
|
||||
if (atrophy)
|
||||
{
|
||||
if (CanLower(from, Stat.Dex) && (from.RawDex < from.RawInt || !CanLower(from, Stat.Int)))
|
||||
--from.RawDex;
|
||||
else if (CanLower(from, Stat.Int))
|
||||
--from.RawInt;
|
||||
}
|
||||
|
||||
if (CanRaise(from, Stat.Str))
|
||||
++from.RawStr;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (CanRaise(from, Stat.Str))
|
||||
++from.RawStr;
|
||||
|
||||
break;
|
||||
}
|
||||
case Stat.Dex:
|
||||
{
|
||||
if (atrophy)
|
||||
{
|
||||
if (CanLower(from, Stat.Str) && (from.RawStr < from.RawInt || !CanLower(from, Stat.Int)))
|
||||
--from.RawStr;
|
||||
else if (CanLower(from, Stat.Int))
|
||||
--from.RawInt;
|
||||
if (atrophy)
|
||||
{
|
||||
if (CanLower(from, Stat.Str) && (from.RawStr < from.RawInt || !CanLower(from, Stat.Int)))
|
||||
--from.RawStr;
|
||||
else if (CanLower(from, Stat.Int))
|
||||
--from.RawInt;
|
||||
}
|
||||
|
||||
if (CanRaise(from, Stat.Dex))
|
||||
++from.RawDex;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (CanRaise(from, Stat.Dex))
|
||||
++from.RawDex;
|
||||
|
||||
break;
|
||||
}
|
||||
case Stat.Int:
|
||||
{
|
||||
if (atrophy)
|
||||
{
|
||||
if (CanLower(from, Stat.Str) && (from.RawStr < from.RawDex || !CanLower(from, Stat.Dex)))
|
||||
--from.RawStr;
|
||||
else if (CanLower(from, Stat.Dex))
|
||||
--from.RawDex;
|
||||
if (atrophy)
|
||||
{
|
||||
if (CanLower(from, Stat.Str) && (from.RawStr < from.RawDex || !CanLower(from, Stat.Dex)))
|
||||
--from.RawStr;
|
||||
else if (CanLower(from, Stat.Dex))
|
||||
--from.RawDex;
|
||||
}
|
||||
|
||||
if (CanRaise(from, Stat.Int))
|
||||
++from.RawInt;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (CanRaise(from, Stat.Int))
|
||||
++from.RawInt;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -345,51 +341,50 @@ namespace Server.Misc
|
|||
switch (stat)
|
||||
{
|
||||
case Stat.Str:
|
||||
{
|
||||
if (from is BaseCreature creature && creature.Controlled)
|
||||
{
|
||||
if (creature.LastStrGain + m_PetStatGainDelay >= DateTime.UtcNow)
|
||||
if (from is BaseCreature creature && creature.Controlled)
|
||||
{
|
||||
if (creature.LastStrGain + m_PetStatGainDelay >= DateTime.UtcNow)
|
||||
return;
|
||||
}
|
||||
else if (from.LastStrGain + m_StatGainDelay >= DateTime.UtcNow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (from.LastStrGain + m_StatGainDelay >= DateTime.UtcNow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.LastStrGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
from.LastStrGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
case Stat.Dex:
|
||||
{
|
||||
if (from is BaseCreature creature && creature.Controlled)
|
||||
{
|
||||
if (creature.LastDexGain + m_PetStatGainDelay >= DateTime.UtcNow)
|
||||
if (from is BaseCreature creature && creature.Controlled)
|
||||
{
|
||||
if (creature.LastDexGain + m_PetStatGainDelay >= DateTime.UtcNow)
|
||||
return;
|
||||
}
|
||||
else if (from.LastDexGain + m_StatGainDelay >= DateTime.UtcNow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (from.LastDexGain + m_StatGainDelay >= DateTime.UtcNow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.LastDexGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
from.LastDexGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
case Stat.Int:
|
||||
{
|
||||
if (from is BaseCreature creature && creature.Controlled)
|
||||
{
|
||||
if (creature.LastIntGain + m_PetStatGainDelay >= DateTime.UtcNow)
|
||||
if (from is BaseCreature creature && creature.Controlled)
|
||||
{
|
||||
if (creature.LastIntGain + m_PetStatGainDelay >= DateTime.UtcNow)
|
||||
return;
|
||||
}
|
||||
else if (from.LastIntGain + m_StatGainDelay >= DateTime.UtcNow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
else if (from.LastIntGain + m_StatGainDelay >= DateTime.UtcNow)
|
||||
{
|
||||
return;
|
||||
from.LastIntGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
|
||||
from.LastIntGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool atrophy = from.RawStatTotal / (double)from.StatCap >= Utility.RandomDouble();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Server
|
|||
{
|
||||
public class SocketOptions
|
||||
{
|
||||
private static IPEndPoint[] m_ListenerEndPoints =
|
||||
private static readonly IPEndPoint[] m_ListenerEndPoints =
|
||||
{
|
||||
new IPEndPoint(IPAddress.Any, 2593) // Default: Listen on port 2593 on all IP addresses
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ namespace Server
|
|||
String = text;
|
||||
}
|
||||
|
||||
public int Number{ get; }
|
||||
public int Number { get; }
|
||||
|
||||
public string String{ get; }
|
||||
public string String { get; }
|
||||
|
||||
public bool IsEmpty => Number <= 0 && String == null;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Server.Misc
|
|||
"Nullifier"
|
||||
};
|
||||
|
||||
private static string[,] m_Levels =
|
||||
private static readonly string[,] m_Levels =
|
||||
{
|
||||
{ "Neophyte", "Neophyte", "Neophyte" },
|
||||
{ "Novice", "Novice", "Novice" },
|
||||
|
|
@ -33,7 +33,7 @@ namespace Server.Misc
|
|||
{ "Legendary", "Kengo", "Ka-ge" }
|
||||
};
|
||||
|
||||
private static FameEntry[] m_FameEntries =
|
||||
private static readonly FameEntry[] m_FameEntries =
|
||||
{
|
||||
new FameEntry(1249, new[]
|
||||
{
|
||||
|
|
@ -232,7 +232,7 @@ namespace Server.Misc
|
|||
|
||||
bool showSkillTitle = beheld.ShowFameTitle && (beholder == beheld || fame >= 5000);
|
||||
|
||||
/*if ( beheld.Kills >= 5 )
|
||||
/*if (beheld.Kills >= 5)
|
||||
{
|
||||
title.AppendFormat( beheld.Fame >= 10000 ? "The Murderer {1} {0}" : "The Murderer {0}", beheld.Name, beheld.Female ? "Lady" : "Lord" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int InactiveItemID{ get; set; }
|
||||
public int InactiveItemID { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ActiveItemID{ get; set; }
|
||||
public int ActiveItemID { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool PlayersCanToggle{ get; set; }
|
||||
public bool PlayersCanToggle { get; set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace Server
|
|||
{
|
||||
public class VendorGenerator
|
||||
{
|
||||
private static Rectangle2D[] m_BritRegions =
|
||||
private static readonly Rectangle2D[] m_BritRegions =
|
||||
{
|
||||
new Rectangle2D(new Point2D(250, 750), new Point2D(775, 1330)),
|
||||
new Rectangle2D(new Point2D(525, 2095), new Point2D(925, 2430)),
|
||||
|
|
@ -27,7 +27,7 @@ namespace Server
|
|||
new Rectangle2D(new Point2D(5120, 2300), new Point2D(6143, 4095))
|
||||
};
|
||||
|
||||
private static Rectangle2D[] m_IlshRegions =
|
||||
private static readonly Rectangle2D[] m_IlshRegions =
|
||||
{
|
||||
new Rectangle2D(new Point2D(0, 0), new Point2D(288 * 8, 200 * 8))
|
||||
};
|
||||
|
|
@ -106,13 +106,13 @@ namespace Server
|
|||
}
|
||||
|
||||
private static bool IsStaticFloor(int itemID) =>
|
||||
itemID >= 0x495 && itemID <= 0x514
|
||||
|| itemID >= 0x519 && itemID <= 0x53A;
|
||||
(itemID >= 0x495 && itemID <= 0x514)
|
||||
|| (itemID >= 0x519 && itemID <= 0x53A);
|
||||
|
||||
private static bool IsDisplayCase(int itemID) =>
|
||||
itemID >= 0xB00 && itemID <= 0xB02
|
||||
|| itemID >= 0xB06 && itemID <= 0xB0A
|
||||
|| itemID >= 0xB0D && itemID <= 0xB17;
|
||||
(itemID >= 0xB00 && itemID <= 0xB02)
|
||||
|| (itemID >= 0xB06 && itemID <= 0xB0A)
|
||||
|| (itemID >= 0xB0D && itemID <= 0xB17);
|
||||
|
||||
private static void Process(Map map, Rectangle2D[] regions)
|
||||
{
|
||||
|
|
@ -122,9 +122,9 @@ namespace Server
|
|||
World.Broadcast(0x35, true, "Generating vendor spawns for {0}, please wait.", map);
|
||||
|
||||
for (int i = 0; i < regions.Length; ++i)
|
||||
for (int x = 0; x < map.Width; ++x)
|
||||
for (int y = 0; y < map.Height; ++y)
|
||||
CheckPoint(map, regions[i].X + x, regions[i].Y + y);
|
||||
for (int x = 0; x < map.Width; ++x)
|
||||
for (int y = 0; y < map.Height; ++y)
|
||||
CheckPoint(map, regions[i].X + x, regions[i].Y + y);
|
||||
|
||||
for (int i = 0; i < m_ShopList.Count; ++i)
|
||||
{
|
||||
|
|
@ -254,22 +254,22 @@ namespace Server
|
|||
}
|
||||
|
||||
private static bool IsClothes(int itemID) =>
|
||||
itemID >= 0x1515 && itemID <= 0x1518 || itemID >= 0x152E && itemID <= 0x1531 || itemID >= 0x1537
|
||||
&& itemID <= 0x154C || itemID >= 0x1EFD && itemID <= 0x1F04 || itemID >= 0x170B && itemID <= 0x171C;
|
||||
(itemID >= 0x1515 && itemID <= 0x1518) || (itemID >= 0x152E && itemID <= 0x1531) || (itemID >= 0x1537
|
||||
&& itemID <= 0x154C) || (itemID >= 0x1EFD && itemID <= 0x1F04) || (itemID >= 0x170B && itemID <= 0x171C);
|
||||
|
||||
private static bool IsArmor(int itemID) =>
|
||||
itemID >= 0x13BB && itemID <= 0x13E2 || itemID >= 0x13E5 && itemID <= 0x13F2 ||
|
||||
itemID >= 0x1408 && itemID <= 0x141A || itemID >= 0x144E && itemID <= 0x1457;
|
||||
(itemID >= 0x13BB && itemID <= 0x13E2) || (itemID >= 0x13E5 && itemID <= 0x13F2) ||
|
||||
(itemID >= 0x1408 && itemID <= 0x141A) || (itemID >= 0x144E && itemID <= 0x1457);
|
||||
|
||||
private static bool IsMetalWeapon(int itemID) =>
|
||||
itemID >= 0xF43 && itemID <= 0xF4E || itemID >= 0xF51 && itemID <= 0xF52 ||
|
||||
itemID >= 0xF5C && itemID <= 0xF63 || itemID >= 0x13AF && itemID <= 0x13B0 ||
|
||||
itemID >= 0x13B5 && itemID <= 0x13BA || itemID >= 0x13FA && itemID <= 0x13FB ||
|
||||
itemID >= 0x13FE && itemID <= 0x1407 || itemID >= 0x1438 && itemID <= 0x1443;
|
||||
(itemID >= 0xF43 && itemID <= 0xF4E) || (itemID >= 0xF51 && itemID <= 0xF52) ||
|
||||
(itemID >= 0xF5C && itemID <= 0xF63) || (itemID >= 0x13AF && itemID <= 0x13B0) ||
|
||||
(itemID >= 0x13B5 && itemID <= 0x13BA) || (itemID >= 0x13FA && itemID <= 0x13FB) ||
|
||||
(itemID >= 0x13FE && itemID <= 0x1407) || (itemID >= 0x1438 && itemID <= 0x1443);
|
||||
|
||||
private static bool IsArcheryWeapon(int itemID) =>
|
||||
itemID >= 0xF4F && itemID <= 0xF50 || itemID >= 0x13B1 && itemID <= 0x13B2 ||
|
||||
itemID >= 0x13FC && itemID <= 0x13FD;
|
||||
(itemID >= 0xF4F && itemID <= 0xF50) || (itemID >= 0x13B1 && itemID <= 0x13B2) ||
|
||||
(itemID >= 0x13FC && itemID <= 0x13FD);
|
||||
|
||||
private static ShopFlags ProcessDisplayedItem(int itemID)
|
||||
{
|
||||
|
|
@ -304,8 +304,8 @@ namespace Server
|
|||
if (itemID >= 0xF78 && itemID <= 0xF91)
|
||||
res |= ShopFlags.Reagent;
|
||||
|
||||
if (itemID >= 0xE35 && itemID <= 0xE3A || itemID >= 0xEF4 && itemID <= 0xEF9 ||
|
||||
itemID >= 0x1F2D && itemID <= 0x1F72)
|
||||
if ((itemID >= 0xE35 && itemID <= 0xE3A) || (itemID >= 0xEF4 && itemID <= 0xEF9) ||
|
||||
(itemID >= 0x1F2D && itemID <= 0x1F72))
|
||||
res |= ShopFlags.Scroll;
|
||||
|
||||
if (itemID == 0xE38 || itemID == 0xEFA)
|
||||
|
|
@ -410,9 +410,9 @@ namespace Server
|
|||
floor.Add(p);
|
||||
|
||||
for (int xo = -1; xo <= 1; ++xo)
|
||||
for (int yo = -1; yo <= 1; ++yo)
|
||||
if ((xo != 0 || yo != 0) && IsFloor(map, x + xo, y + yo, false))
|
||||
RecurseFindFloor(map, x + xo, y + yo, floor);
|
||||
for (int yo = -1; yo <= 1; ++yo)
|
||||
if ((xo != 0 || yo != 0) && IsFloor(map, x + xo, y + yo, false))
|
||||
RecurseFindFloor(map, x + xo, y + yo, floor);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ namespace Server.Misc
|
|||
public class Weather
|
||||
{
|
||||
private static Map[] m_Facets;
|
||||
private static Dictionary<Map, List<Weather>> m_WeatherByFacet = new Dictionary<Map, List<Weather>>();
|
||||
private static readonly Dictionary<Map, List<Weather>> m_WeatherByFacet = new Dictionary<Map, List<Weather>>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
m_Facets = new[]{ Map.Felucca, Map.Trammel };
|
||||
m_Facets = new[] { Map.Felucca, Map.Trammel };
|
||||
|
||||
/* Static weather:
|
||||
*
|
||||
|
|
@ -21,14 +21,13 @@ namespace Server.Misc
|
|||
*/
|
||||
|
||||
// ice island
|
||||
AddWeather( -15, 100, 5, new Rectangle2D( 3850, 160, 390, 320 ), new Rectangle2D( 3900, 480, 380, 180 ), new Rectangle2D( 4160, 660, 150, 110 ) );
|
||||
AddWeather(-15, 100, 5, new Rectangle2D(3850, 160, 390, 320), new Rectangle2D(3900, 480, 380, 180), new Rectangle2D(4160, 660, 150, 110));
|
||||
|
||||
// covetous entrance, around vesper and minoc
|
||||
AddWeather( +15, 50, 5, new Rectangle2D( 2425, 725, 250, 250 ) );
|
||||
AddWeather(+15, 50, 5, new Rectangle2D(2425, 725, 250, 250));
|
||||
|
||||
// despise entrance, north of britain
|
||||
AddWeather( +15, 50, 5, new Rectangle2D( 1245, 1045, 250, 250 ) );
|
||||
|
||||
AddWeather(+15, 50, 5, new Rectangle2D(1245, 1045, 250, 250));
|
||||
|
||||
/* Dynamic weather:
|
||||
*
|
||||
|
|
@ -36,65 +35,66 @@ namespace Server.Misc
|
|||
* AddDynamicWeather( temperature, chanceOfPercipitation, chanceOfExtremeTemperature, moveSpeed, width, height, bounds );
|
||||
*/
|
||||
|
||||
for ( int i = 0; i < 15; ++i )
|
||||
AddDynamicWeather( +15, 100, 5, 8, 400, 400, new Rectangle2D( 0, 0, 5120, 4096 ) );
|
||||
for (int i = 0; i < 15; ++i)
|
||||
AddDynamicWeather(+15, 100, 5, 8, 400, 400, new Rectangle2D(0, 0, 5120, 4096));
|
||||
}
|
||||
|
||||
public static List<Weather> GetWeatherList( Map facet )
|
||||
public static List<Weather> GetWeatherList(Map facet)
|
||||
{
|
||||
if ( facet == null )
|
||||
if (facet == null)
|
||||
return null;
|
||||
|
||||
if (!m_WeatherByFacet.TryGetValue( facet, out List<Weather> list ))
|
||||
if (!m_WeatherByFacet.TryGetValue(facet, out List<Weather> list))
|
||||
m_WeatherByFacet[facet] = list = new List<Weather>();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void AddDynamicWeather( int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, int moveSpeed, int width, int height, Rectangle2D bounds )
|
||||
public static void AddDynamicWeather(int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, int moveSpeed, int width, int height, Rectangle2D bounds)
|
||||
{
|
||||
for ( int i = 0; i < m_Facets.Length; ++i )
|
||||
for (int i = 0; i < m_Facets.Length; ++i)
|
||||
{
|
||||
Rectangle2D area = new Rectangle2D();
|
||||
bool isValid = false;
|
||||
|
||||
for ( int j = 0; j < 10; ++j )
|
||||
for (int j = 0; j < 10; ++j)
|
||||
{
|
||||
area = new Rectangle2D( bounds.X + Utility.Random( bounds.Width - width ), bounds.Y + Utility.Random( 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_Facets[i], null, area ) )
|
||||
if (!CheckWeatherConflict(m_Facets[i], null, area))
|
||||
isValid = true;
|
||||
|
||||
if ( isValid )
|
||||
if (isValid)
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !isValid )
|
||||
if (!isValid)
|
||||
continue;
|
||||
|
||||
new Weather(m_Facets[i], new[] { area }, temperature, chanceOfPercipitation, chanceOfExtremeTemperature,
|
||||
TimeSpan.FromSeconds(30.0)) { Bounds = bounds, MoveSpeed = moveSpeed };
|
||||
TimeSpan.FromSeconds(30.0))
|
||||
{ Bounds = bounds, MoveSpeed = moveSpeed };
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddWeather( int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, params Rectangle2D[] area )
|
||||
public static void AddWeather(int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, params Rectangle2D[] area)
|
||||
{
|
||||
for ( int i = 0; i < m_Facets.Length; ++i )
|
||||
new Weather( m_Facets[i], area, temperature, chanceOfPercipitation, chanceOfExtremeTemperature, TimeSpan.FromSeconds( 30.0 ) );
|
||||
for (int i = 0; i < m_Facets.Length; ++i)
|
||||
new Weather(m_Facets[i], area, temperature, chanceOfPercipitation, chanceOfExtremeTemperature, TimeSpan.FromSeconds(30.0));
|
||||
}
|
||||
|
||||
public static bool CheckWeatherConflict( Map facet, Weather exclude, Rectangle2D area )
|
||||
public static bool CheckWeatherConflict(Map facet, Weather exclude, Rectangle2D area)
|
||||
{
|
||||
List<Weather> list = GetWeatherList( facet );
|
||||
List<Weather> list = GetWeatherList(facet);
|
||||
|
||||
if ( list == null )
|
||||
if (list == null)
|
||||
return false;
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Weather w = list[i];
|
||||
|
||||
if ( w != exclude && w.IntersectsWith( area ) )
|
||||
if (w != exclude && w.IntersectsWith(area))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -121,22 +121,22 @@ namespace Server.Misc
|
|||
|
||||
public int MoveAngleY { get; set; }
|
||||
|
||||
public static bool CheckIntersection( Rectangle2D r1, Rectangle2D r2 ) => r1.X < r2.X + r2.Width && r2.X < r1.X + r1.Width && r1.Y < r2.Y + r2.Height && r2.Y < r1.Y + r1.Height;
|
||||
public static bool CheckIntersection(Rectangle2D r1, Rectangle2D r2) => r1.X < r2.X + r2.Width && r2.X < r1.X + r1.Width && r1.Y < r2.Y + r2.Height && r2.Y < r1.Y + r1.Height;
|
||||
|
||||
public static bool CheckContains( Rectangle2D big, Rectangle2D small ) =>
|
||||
public static bool CheckContains(Rectangle2D big, Rectangle2D small) =>
|
||||
small.X >= big.X && small.Y >= big.Y && small.X + small.Width <= big.X + big.Width
|
||||
&& small.Y + small.Height <= big.Y + big.Height;
|
||||
|
||||
public virtual bool IntersectsWith( Rectangle2D area )
|
||||
public virtual bool IntersectsWith(Rectangle2D area)
|
||||
{
|
||||
for ( int i = 0; i < Area.Length; ++i )
|
||||
if ( CheckIntersection( area, Area[i] ) )
|
||||
for (int i = 0; i < Area.Length; ++i)
|
||||
if (CheckIntersection(area, Area[i]))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Weather( Map facet, Rectangle2D[] area, int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, TimeSpan interval )
|
||||
public Weather(Map facet, Rectangle2D[] area, int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, TimeSpan interval)
|
||||
{
|
||||
Facet = facet;
|
||||
Area = area;
|
||||
|
|
@ -144,16 +144,16 @@ namespace Server.Misc
|
|||
ChanceOfPercipitation = chanceOfPercipitation;
|
||||
ChanceOfExtremeTemperature = chanceOfExtremeTemperature;
|
||||
|
||||
List<Weather> list = GetWeatherList( facet );
|
||||
List<Weather> list = GetWeatherList(facet);
|
||||
|
||||
list?.Add( this );
|
||||
list?.Add(this);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( (0.2+Utility.RandomDouble()*0.8) * interval.TotalSeconds ), interval, OnTick );
|
||||
Timer.DelayCall(TimeSpan.FromSeconds((0.2 + Utility.RandomDouble() * 0.8) * interval.TotalSeconds), interval, OnTick);
|
||||
}
|
||||
|
||||
public virtual void Reposition()
|
||||
{
|
||||
if ( Area.Length == 0 )
|
||||
if (Area.Length == 0)
|
||||
return;
|
||||
|
||||
int width = Area[0].Width;
|
||||
|
|
@ -162,18 +162,18 @@ namespace Server.Misc
|
|||
Rectangle2D area = new Rectangle2D();
|
||||
bool isValid = false;
|
||||
|
||||
for ( int j = 0; j < 10; ++j )
|
||||
for (int j = 0; j < 10; ++j)
|
||||
{
|
||||
area = new Rectangle2D( Bounds.X + Utility.Random( Bounds.Width - width ), Bounds.Y + Utility.Random( 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( Facet, this, area ) )
|
||||
if (!CheckWeatherConflict(Facet, this, area))
|
||||
isValid = true;
|
||||
|
||||
if ( isValid )
|
||||
if (isValid)
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !isValid )
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
Area[0] = area;
|
||||
|
|
@ -183,8 +183,8 @@ namespace Server.Misc
|
|||
{
|
||||
double angle = Utility.RandomDouble() * Math.PI * 2.0;
|
||||
|
||||
double cos = Math.Cos( angle );
|
||||
double sin = Math.Sin( angle );
|
||||
double cos = Math.Cos(angle);
|
||||
double sin = Math.Sin(angle);
|
||||
|
||||
MoveAngleX = (int)(100 * cos);
|
||||
MoveAngleY = (int)(100 * sin);
|
||||
|
|
@ -192,18 +192,18 @@ namespace Server.Misc
|
|||
|
||||
public virtual void MoveForward()
|
||||
{
|
||||
if ( Area.Length == 0 )
|
||||
if (Area.Length == 0)
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < 5; ++i ) // try 5 times to find a valid spot
|
||||
for (int i = 0; i < 5; ++i) // try 5 times to find a valid spot
|
||||
{
|
||||
int xOffset = MoveSpeed * MoveAngleX / 100;
|
||||
int yOffset = MoveSpeed * MoveAngleY / 100;
|
||||
|
||||
Rectangle2D oldArea = Area[0];
|
||||
Rectangle2D newArea = new Rectangle2D( oldArea.X + xOffset, oldArea.Y + yOffset, oldArea.Width, oldArea.Height );
|
||||
Rectangle2D newArea = new Rectangle2D(oldArea.X + xOffset, oldArea.Y + yOffset, oldArea.Width, oldArea.Height);
|
||||
|
||||
if ( !CheckWeatherConflict( Facet, this, newArea ) && CheckContains( Bounds, newArea ) )
|
||||
if (!CheckWeatherConflict(Facet, this, newArea) && CheckContains(Bounds, newArea))
|
||||
{
|
||||
Area[0] = newArea;
|
||||
break;
|
||||
|
|
@ -219,30 +219,30 @@ namespace Server.Misc
|
|||
|
||||
public virtual void OnTick()
|
||||
{
|
||||
if ( m_Stage == 0 )
|
||||
if (m_Stage == 0)
|
||||
{
|
||||
m_Active = ChanceOfPercipitation > Utility.Random( 100 );
|
||||
m_ExtremeTemperature = ChanceOfExtremeTemperature > Utility.Random( 100 );
|
||||
m_Active = ChanceOfPercipitation > Utility.Random(100);
|
||||
m_ExtremeTemperature = ChanceOfExtremeTemperature > Utility.Random(100);
|
||||
|
||||
if ( MoveSpeed > 0 )
|
||||
if (MoveSpeed > 0)
|
||||
{
|
||||
Reposition();
|
||||
RecalculateMovementAngle();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Active )
|
||||
if (m_Active)
|
||||
{
|
||||
if ( m_Stage > 0 && MoveSpeed > 0 )
|
||||
if (m_Stage > 0 && MoveSpeed > 0)
|
||||
MoveForward();
|
||||
|
||||
int type, density;
|
||||
int temperature = Temperature;
|
||||
|
||||
if ( m_ExtremeTemperature )
|
||||
if (m_ExtremeTemperature)
|
||||
temperature *= -1;
|
||||
|
||||
if ( m_Stage < 15 )
|
||||
if (m_Stage < 15)
|
||||
{
|
||||
density = m_Stage * 5;
|
||||
}
|
||||
|
|
@ -250,15 +250,15 @@ namespace Server.Misc
|
|||
{
|
||||
density = 150 - m_Stage * 5;
|
||||
|
||||
if ( density < 10 )
|
||||
if (density < 10)
|
||||
density = 10;
|
||||
else if ( density > 70 )
|
||||
else if (density > 70)
|
||||
density = 70;
|
||||
}
|
||||
|
||||
if ( density == 0 )
|
||||
if (density == 0)
|
||||
type = 0xFE;
|
||||
else if ( temperature > 0 )
|
||||
else if (temperature > 0)
|
||||
type = 0;
|
||||
else
|
||||
type = 2;
|
||||
|
|
@ -267,29 +267,29 @@ namespace Server.Misc
|
|||
|
||||
Packet weatherPacket = null;
|
||||
|
||||
for ( int i = 0; i < states.Count; ++i )
|
||||
for (int i = 0; i < states.Count; ++i)
|
||||
{
|
||||
NetState ns = states[i];
|
||||
Mobile mob = ns.Mobile;
|
||||
|
||||
if ( mob == null || mob.Map != Facet )
|
||||
if (mob == null || mob.Map != Facet)
|
||||
continue;
|
||||
|
||||
bool contains = Area.Length == 0;
|
||||
|
||||
for ( int j = 0; !contains && j < Area.Length; ++j )
|
||||
contains = Area[j].Contains( mob.Location );
|
||||
for (int j = 0; !contains && j < Area.Length; ++j)
|
||||
contains = Area[j].Contains(mob.Location);
|
||||
|
||||
if ( !contains )
|
||||
if (!contains)
|
||||
continue;
|
||||
|
||||
if ( weatherPacket == null )
|
||||
weatherPacket = Packet.Acquire( new Server.Network.Weather( type, density, temperature ) );
|
||||
if (weatherPacket == null)
|
||||
weatherPacket = Packet.Acquire(new Server.Network.Weather(type, density, temperature));
|
||||
|
||||
ns.Send( weatherPacket );
|
||||
ns.Send(weatherPacket);
|
||||
}
|
||||
|
||||
Packet.Release( weatherPacket );
|
||||
Packet.Release(weatherPacket);
|
||||
}
|
||||
|
||||
m_Stage++;
|
||||
|
|
@ -304,45 +304,45 @@ namespace Server.Misc
|
|||
[Constructible]
|
||||
public WeatherMap()
|
||||
{
|
||||
SetDisplay( 0, 0, 5119, 4095, 400, 400 );
|
||||
SetDisplay(0, 0, 5119, 4095, 400, 400);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
Map facet = from.Map;
|
||||
|
||||
if ( facet == null )
|
||||
if (facet == null)
|
||||
return;
|
||||
|
||||
List<Weather> list = Weather.GetWeatherList( facet );
|
||||
List<Weather> list = Weather.GetWeatherList(facet);
|
||||
|
||||
ClearPins();
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Weather w = list[i];
|
||||
|
||||
for ( int j = 0; j < w.Area.Length; ++j )
|
||||
AddWorldPin( w.Area[j].X + w.Area[j].Width/2, w.Area[j].Y + w.Area[j].Height/2 );
|
||||
for (int j = 0; j < w.Area.Length; ++j)
|
||||
AddWorldPin(w.Area[j].X + w.Area[j].Width / 2, w.Area[j].Y + w.Area[j].Height / 2);
|
||||
}
|
||||
|
||||
base.OnDoubleClick( from );
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public WeatherMap( Serial serial ) : base( serial )
|
||||
public WeatherMap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer )
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize( writer );
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( 0 );
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize( IGenericReader reader )
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#region References
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -8,8 +6,6 @@ using System.Text;
|
|||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public class StatusPage : Timer
|
||||
|
|
@ -19,7 +15,7 @@ namespace Server.Misc
|
|||
private static HttpListener _Listener;
|
||||
|
||||
private static string _StatusPage = string.Empty;
|
||||
private static byte[] _StatusBuffer = new byte[0];
|
||||
private static byte[] _StatusBuffer = Array.Empty<byte>();
|
||||
|
||||
private static readonly object _StatusLock = new object();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Server.Misc
|
|||
{
|
||||
public const int OverloadAllowance = 4; // We can be four stones overweight without getting fatigued
|
||||
|
||||
public static DFAlgorithm DFA{ get; set; }
|
||||
public static DFAlgorithm DFA { get; set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -28,15 +28,15 @@ namespace Server.Misc
|
|||
switch (DFA)
|
||||
{
|
||||
case DFAlgorithm.Standard:
|
||||
{
|
||||
fatigue = damage * (100.0 / m.Hits) * ((double)m.Stam / 100) - 5.0;
|
||||
break;
|
||||
}
|
||||
{
|
||||
fatigue = damage * (100.0 / m.Hits) * ((double)m.Stam / 100) - 5.0;
|
||||
break;
|
||||
}
|
||||
case DFAlgorithm.PainSpike:
|
||||
{
|
||||
fatigue = damage * (100.0 / m.Hits + (50.0 + m.Stam) / 100 - 1.0) - 5.0;
|
||||
break;
|
||||
}
|
||||
{
|
||||
fatigue = damage * (100.0 / m.Hits + (50.0 + m.Stam) / 100 - 1.0) - 5.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fatigue > 0)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace Server.Misc
|
|||
/// </summary>
|
||||
public class WelcomeTimer : Timer
|
||||
{
|
||||
private static string[] m_Messages = TestCenter.Enabled
|
||||
private static readonly string[] m_Messages = TestCenter.Enabled
|
||||
? new[]
|
||||
{
|
||||
"Welcome to this test shard. You are able to customize your character's stats and skills at anytime to anything you wish. To see the commands to do this just say 'help'.",
|
||||
|
|
@ -23,13 +23,14 @@ namespace Server.Misc
|
|||
}
|
||||
: new[]
|
||||
{
|
||||
//Yes, this message is a pathetic message, It's suggested that you change it.
|
||||
// Yes, this message is a pathetic message, It's suggested that you change it.
|
||||
"Welcome to this shard.",
|
||||
"Please enjoy your stay."
|
||||
};
|
||||
|
||||
private Mobile m_Mobile;
|
||||
private int m_State, m_Count;
|
||||
private readonly Mobile m_Mobile;
|
||||
private int m_State;
|
||||
private readonly int m_Count;
|
||||
|
||||
public WelcomeTimer(Mobile m) : this(m, m_Messages.Length)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Server
|
|||
{
|
||||
public class UOAMVendorGenerator
|
||||
{
|
||||
//configuration
|
||||
// configuration
|
||||
private const int
|
||||
NPCCount = 2; // 2 npcs per type (so a mage spawner will spawn 2 npcs, a alchemist and herbalist spawner will spawn 4 npcs total)
|
||||
|
||||
|
|
@ -17,8 +17,8 @@ namespace Server
|
|||
private const bool TotalRespawn = true; // Should we spawn them up right away?
|
||||
private const int Team = 0; // "team" the npcs are on
|
||||
private static int m_Count;
|
||||
private static TimeSpan MinTime = TimeSpan.FromMinutes(2.5); //min spawn time
|
||||
private static TimeSpan MaxTime = TimeSpan.FromMinutes(10.0); //max spawn time
|
||||
private static readonly TimeSpan MinTime = TimeSpan.FromMinutes(2.5); // min spawn time
|
||||
private static readonly TimeSpan MaxTime = TimeSpan.FromMinutes(10.0); // max spawn time
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -164,7 +164,6 @@ namespace Server
|
|||
PlaceNPC(split[1], split[2], split[3], "Beekeeper");
|
||||
break;
|
||||
|
||||
|
||||
// Guilds & Misc
|
||||
case "-tinkers guild:":
|
||||
PlaceNPC(split[1], split[2], split[3], "TinkerGuildmaster");
|
||||
|
|
@ -231,9 +230,9 @@ namespace Server
|
|||
case "+Island:":
|
||||
case "+town:":
|
||||
break;
|
||||
/*default:
|
||||
Console.WriteLine(split[0]);
|
||||
break;*/
|
||||
/*default:
|
||||
Console.WriteLine(split[0]);
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -252,11 +251,11 @@ namespace Server
|
|||
|
||||
switch (map)
|
||||
{
|
||||
case 0: //Trammel and Felucca
|
||||
case 0: // Trammel and Felucca
|
||||
MakeSpawner(types, x, y, Map.Felucca);
|
||||
MakeSpawner(types, x, y, Map.Trammel);
|
||||
break;
|
||||
case 1: //Felucca
|
||||
case 1: // Felucca
|
||||
MakeSpawner(types, x, y, Map.Felucca);
|
||||
break;
|
||||
case 2:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue