fix(core): NPE in Cycles per second (#331)

- [X] Fixes an edge case where the cycle index goes negative and crashes
- [X] Fixes average CPS calculation
- [X] Fixes issue with logout delay
- [X] Bumps release version
This commit is contained in:
Kamron Batman 2020-11-30 23:12:16 -08:00 committed by GitHub
parent b71c754738
commit 75c1b32513
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
88 changed files with 216 additions and 188 deletions

View file

@ -10,6 +10,8 @@ jobs:
name: Create Release
if: "contains(github.event.head_commit.message, 'Release') || contains(github.event.head_commit.message, 'release')"
runs-on: ubuntu-latest
outputs:
skipped: ${{ steps.changelog.outputs.skipped }}
steps:
- uses: actions/checkout@v2
with:
@ -20,10 +22,20 @@ jobs:
dotnet-version: 5.0.100
- uses: dotnet/nbgv@master
id: nbgv
- name: Conventional Changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
output-file: false
skip-version-file: true
skip-commit: true
- name: Create Release
id: create_release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
body: ${{ steps.changelog.outputs.clean_changelog }}
tag_name: ${{ steps.nbgv.outputs.Version }}
release_name: ${{ steps.nbgv.outputs.Version }}
draft: false
@ -31,8 +43,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output Release URL File
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save Release URL file
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: actions/upload-artifact@v1
with:
name: release_url
@ -40,7 +54,7 @@ jobs:
publish:
name: Publish Release Asset
if: "contains(github.event.head_commit.message, 'Release')"
if: "(contains(github.event.head_commit.message, 'Release') || contains(github.event.head_commit.message, 'release')) && ${{ needs.release.outputs.skipped == 'false' }}"
needs: [release]
runs-on: ubuntu-latest
strategy:

View file

@ -40,8 +40,8 @@ namespace Server
private static TimeSpan m_ProfileTime;
private static bool? m_IsRunningFromXUnit;
private static int m_CycleIndex = 1;
private static readonly float[] m_CyclesPerSecond = new float[100];
private static long m_CycleIndex;
private static readonly float[] m_CyclesPerSecond = new float[127]; // Divisible by long.MaxValue
// private static readonly AutoResetEvent m_Signal = new AutoResetEvent(true);
@ -137,9 +137,23 @@ namespace Server
public static bool Closing => ClosingTokenSource.IsCancellationRequested;
public static float CyclesPerSecond => m_CyclesPerSecond[(m_CycleIndex - 1) % m_CyclesPerSecond.Length];
public static float CyclesPerSecond => m_CyclesPerSecond[m_CycleIndex % m_CyclesPerSecond.Length];
public static float AverageCPS => m_CyclesPerSecond.Take(m_CycleIndex).Average();
public static float AverageCPS
{
get
{
var total = 0.0f;
var count = Math.Min(m_CycleIndex + 1, m_CyclesPerSecond.Length);
for (int i = 0; i < count; i++)
{
total += m_CyclesPerSecond[i];
}
return total / count;
}
}
public static string Arguments
{
@ -452,7 +466,7 @@ namespace Server
{
try
{
long last = TickCount;
long now, last = TickCount;
const int sampleInterval = 100;
const float ticksPerSecond = 1000.0f * sampleInterval;
@ -481,8 +495,9 @@ namespace Server
continue;
}
var now = TickCount;
m_CyclesPerSecond[m_CycleIndex++ % m_CyclesPerSecond.Length] = ticksPerSecond / (now - last);
now = TickCount;
m_CyclesPerSecond[m_CycleIndex % m_CyclesPerSecond.Length] = ticksPerSecond / (now - last);
m_CycleIndex = Math.Max(unchecked(m_CycleIndex + 1), 0);
last = now;
}
}

View file

@ -432,7 +432,6 @@ namespace Server
private static readonly TimeSpan WarmodeSpamCatch = TimeSpan.FromSeconds(Core.SE ? 1.0 : 0.5);
private static readonly TimeSpan WarmodeSpamDelay = TimeSpan.FromSeconds(Core.SE ? 4.0 : 2.0);
private static readonly TimeSpan ExpireCombatantDelay = TimeSpan.FromMinutes(1.0);
private static readonly TimeSpan LogoutDelay = TimeSpan.FromDays(1.0);
private static readonly TimeSpan ExpireAggressorsDelay = TimeSpan.FromSeconds(5.0);
private static readonly Packet[][] m_MovingPacketCache =
@ -441,13 +440,13 @@ namespace Server
new Packet[8]
};
private static readonly List<IEntity> m_MoveList = new List<IEntity>();
private static readonly List<Mobile> m_MoveClientList = new List<Mobile>();
private static readonly List<IEntity> m_MoveList = new();
private static readonly List<Mobile> m_MoveClientList = new();
private static readonly object m_GhostMutateContext = new object();
private static readonly object m_GhostMutateContext = new();
private static readonly List<Mobile> m_Hears = new List<Mobile>();
private static readonly List<IEntity> m_OnSpeech = new List<IEntity>();
private static readonly List<Mobile> m_Hears = new();
private static readonly List<IEntity> m_OnSpeech = new();
private static readonly string[] m_AccessLevelNames =
{
@ -469,8 +468,8 @@ namespace Server
198
};
private static readonly Queue<Mobile> m_DeltaQueue = new Queue<Mobile>();
private static readonly Queue<Mobile> m_DeltaQueueR = new Queue<Mobile>();
private static readonly Queue<Mobile> m_DeltaQueue = new();
private static readonly Queue<Mobile> m_DeltaQueueR = new();
private static bool _processing;
@ -1496,15 +1495,14 @@ namespace Server
// Disconnected, start the logout timer
if (m_LogoutTimer == null)
{
m_LogoutTimer = Timer.DelayCall(LogoutDelay, Logout);
m_LogoutTimer = Timer.DelayCall(GetLogoutDelay(), Logout);
}
else
{
m_LogoutTimer.Stop();
m_LogoutTimer.Delay = GetLogoutDelay();
m_LogoutTimer.Start();
}
m_LogoutTimer.Delay = GetLogoutDelay();
m_LogoutTimer.Start();
}
else
{

View file

@ -9,6 +9,7 @@
<Product>ModernUO Server</Product>
<PublishDir>..\..\Distribution</PublishDir>
<OutDir>..\..\Distribution</OutDir>
<Version>0.0.0</Version>
</PropertyGroup>
<Target Name="CleanPub" AfterTargets="Clean">
<Message Text="Removing distribution files..." />

View file

@ -51,7 +51,7 @@ namespace Server.Factions
}
}
protected override List<SBInfo> SBInfos { get; } = new List<SBInfo>();
protected override List<SBInfo> SBInfos { get; } = new();
public void Register()
{

View file

@ -1952,7 +1952,7 @@ namespace Server.Engines.MLQuests.Definitions
public class Ryuichi : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Ryuichi()
@ -2200,7 +2200,7 @@ namespace Server.Engines.MLQuests.Definitions
public class Hamato : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Hamato()

View file

@ -24,7 +24,7 @@ namespace Server.Engines.Quests
public abstract class BaseQuester : BaseVendor
{
protected List<SBInfo> m_SBInfos = new List<SBInfo>();
protected List<SBInfo> m_SBInfos = new();
public BaseQuester(string title = null) : base(title)
{

View file

@ -205,7 +205,7 @@ namespace Server.Mobiles
{
public class IharaSoko : BaseVendor
{
protected List<SBInfo> m_SBInfos = new List<SBInfo>();
protected List<SBInfo> m_SBInfos = new();
[Constructible]
public IharaSoko() : base("the Imperial Minister of Trade")

View file

@ -234,40 +234,40 @@ namespace Server.Engines.Events
{
private static readonly Point3D[] Felucca_Locations =
{
new Point3D(4467, 1283, 5), // Moonglow
new Point3D(1336, 1997, 5), // Britain
new Point3D(1499, 3771, 5), // Jhelom
new Point3D(771, 752, 5), // Yew
new Point3D(2701, 692, 5), // Minoc
new Point3D(1828, 2948, -20), // Trinsic
new Point3D(643, 2067, 5), // Skara Brae
new Point3D(3563, 2139, Map.Trammel.GetAverageZ(3563, 2139)) // (New) Magincia
new(4467, 1283, 5), // Moonglow
new(1336, 1997, 5), // Britain
new(1499, 3771, 5), // Jhelom
new(771, 752, 5), // Yew
new(2701, 692, 5), // Minoc
new(1828, 2948, -20), // Trinsic
new(643, 2067, 5), // Skara Brae
new(3563, 2139, Map.Trammel.GetAverageZ(3563, 2139)) // (New) Magincia
};
private static readonly Point3D[] Malas_Locations =
{
new Point3D(1015, 527, -65), // Luna
new Point3D(1997, 1386, -85) // Umbra
new(1015, 527, -65), // Luna
new(1997, 1386, -85) // Umbra
};
private static readonly Point3D[] Ilshenar_Locations =
{
new Point3D(1215, 467, -13), // Compassion
new Point3D(722, 1366, -60), // Honesty
new Point3D(744, 724, -28), // Honor
new Point3D(281, 1016, 0), // Humility
new Point3D(987, 1011, -32), // Justice
new Point3D(1174, 1286, -30), // Sacrifice
new Point3D(1532, 1340, -3), // Spirituality
new Point3D(528, 216, -45), // Valor
new Point3D(1721, 218, 96) // Chaos
new(1215, 467, -13), // Compassion
new(722, 1366, -60), // Honesty
new(744, 724, -28), // Honor
new(281, 1016, 0), // Humility
new(987, 1011, -32), // Justice
new(1174, 1286, -30), // Sacrifice
new(1532, 1340, -3), // Spirituality
new(528, 216, -45), // Valor
new(1721, 218, 96) // Chaos
};
private static readonly Point3D[] Tokuno_Locations =
{
new Point3D(1169, 998, 41), // Isamu-Jima
new Point3D(802, 1204, 25), // Makoto-Jima
new Point3D(270, 628, 15) // Homare-Jima
new(1169, 998, 41), // Isamu-Jima
new(802, 1204, 25), // Makoto-Jima
new(270, 628, 15) // Homare-Jima
};
private readonly Mobile m_From;

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class Hiryu : BaseMount
{
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new();
[Constructible]
public Hiryu()

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class LesserHiryu : BaseMount
{
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new();
[Constructible]
public LesserHiryu()

View file

@ -57,7 +57,7 @@ namespace Server.Mobiles
{
}
protected override List<SBInfo> SBInfos { get; } = new List<SBInfo>();
protected override List<SBInfo> SBInfos { get; } = new();
public override bool IsActiveVendor => false;
public override bool IsInvulnerable => false;

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class KhaldunRevenant : BaseCreature
{
private static readonly HashSet<Mobile> m_Set = new HashSet<Mobile>();
private static readonly HashSet<Mobile> m_Set = new();
private readonly DateTime m_ExpireTime;
private readonly Mobile m_Target;

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class MeerMage : BaseCreature
{
private static readonly Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Table = new();
private DateTime m_NextAbilityTime;

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class LadyJennifyr : SkeletalKnight
{
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new();
[Constructible]
public LadyJennifyr()

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Satyr : BaseCreature
{
private static readonly Dictionary<Mobile, Timer> m_Suppressed = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Suppressed = new();
private DateTime m_NextPeace;

View file

@ -9,7 +9,7 @@ namespace Server.Mobiles
{
public class Ilhenir : BaseChampion
{
private static readonly HashSet<Mobile> m_Table = new HashSet<Mobile>();
private static readonly HashSet<Mobile> m_Table = new();
[Constructible]
public Ilhenir()

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Swoop : Eagle
{
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new();
[Constructible]
public Swoop()

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class BakeKitsune : BaseCreature
{
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new();
private Timer m_DisguiseTimer;

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class FanDancer : BaseCreature
{
private static readonly HashSet<Mobile> m_Table = new HashSet<Mobile>();
private static readonly HashSet<Mobile> m_Table = new();
[Constructible]
public FanDancer() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class Kappa : BaseCreature
{
private static readonly Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
private static readonly Dictionary<Mobile, InternalTimer> m_Table = new();
[Constructible]
public Kappa() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)

View file

@ -5,10 +5,10 @@ namespace Server.Mobiles
{
public class KazeKemono : BaseCreature
{
private static readonly Dictionary<Mobile, ExpireTimer> m_FlurryOfTwigsTable = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_FlurryOfTwigsTable = new();
private static readonly Dictionary<Mobile, ExpireTimer> m_ChlorophylBlastTable =
new Dictionary<Mobile, ExpireTimer>();
new();
[Constructible]
public KazeKemono()

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class LadyOfTheSnow : BaseCreature
{
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new();
[Constructible]
public LadyOfTheSnow()

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class RaiJu : BaseCreature
{
private static readonly HashSet<Mobile> m_Table = new HashSet<Mobile>();
private static readonly HashSet<Mobile> m_Table = new();
[Constructible]
public RaiJu() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class RuneBeetle : BaseCreature
{
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new();
[Constructible]
public RuneBeetle() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class TsukiWolf : BaseCreature
{
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new();
[Constructible]
public TsukiWolf()

View file

@ -99,47 +99,47 @@ namespace Server.Mobiles
private static readonly Point3D[] m_TrammelDeathDestinations =
{
new Point3D(1481, 1612, 20),
new Point3D(2708, 2153, 0),
new Point3D(2249, 1230, 0),
new Point3D(5197, 3994, 37),
new Point3D(1412, 3793, 0),
new Point3D(3688, 2232, 20),
new Point3D(2578, 604, 0),
new Point3D(4397, 1089, 0),
new Point3D(5741, 3218, -2),
new Point3D(2996, 3441, 15),
new Point3D(624, 2225, 0),
new Point3D(1916, 2814, 0),
new Point3D(2929, 854, 0),
new Point3D(545, 967, 0),
new Point3D(3665, 2587, 0)
new(1481, 1612, 20),
new(2708, 2153, 0),
new(2249, 1230, 0),
new(5197, 3994, 37),
new(1412, 3793, 0),
new(3688, 2232, 20),
new(2578, 604, 0),
new(4397, 1089, 0),
new(5741, 3218, -2),
new(2996, 3441, 15),
new(624, 2225, 0),
new(1916, 2814, 0),
new(2929, 854, 0),
new(545, 967, 0),
new(3665, 2587, 0)
};
private static readonly Point3D[] m_IlshenarDeathDestinations =
{
new Point3D(1216, 468, -13),
new Point3D(723, 1367, -60),
new Point3D(745, 725, -28),
new Point3D(281, 1017, 0),
new Point3D(986, 1011, -32),
new Point3D(1175, 1287, -30),
new Point3D(1533, 1341, -3),
new Point3D(529, 217, -44),
new Point3D(1722, 219, 96)
new(1216, 468, -13),
new(723, 1367, -60),
new(745, 725, -28),
new(281, 1017, 0),
new(986, 1011, -32),
new(1175, 1287, -30),
new(1533, 1341, -3),
new(529, 217, -44),
new(1722, 219, 96)
};
private static readonly Point3D[] m_MalasDeathDestinations =
{
new Point3D(2079, 1376, -70),
new Point3D(944, 519, -71)
new(2079, 1376, -70),
new(944, 519, -71)
};
private static readonly Point3D[] m_TokunoDeathDestinations =
{
new Point3D(1166, 801, 27),
new Point3D(782, 1228, 25),
new Point3D(268, 624, 15)
new(1166, 801, 27),
new(782, 1228, 25),
new(268, 624, 15)
};
private readonly Dictionary<Skill, Dictionary<object, CountAndTimeStamp>> m_AntiMacroTable;
@ -590,7 +590,7 @@ namespace Server.Mobiles
set => SetFlag(PlayerFlag.RefuseTrades, value);
}
public Dictionary<Type, int> RecoverableAmmo { get; } = new Dictionary<Type, int>();
public Dictionary<Type, int> RecoverableAmmo { get; } = new();
[CommandProperty(AccessLevel.GameMaster)]
public DateTime AcceleratedStart { get; set; }
@ -4895,7 +4895,7 @@ namespace Server.Mobiles
}
}
public ItemInsuranceMenuGump NewInstance() => new ItemInsuranceMenuGump(m_From, m_Items, m_Insure, m_Page);
public ItemInsuranceMenuGump NewInstance() => new(m_From, m_Items, m_Insure, m_Page);
public override void OnResponse(NetState sender, RelayInfo info)
{

View file

@ -10,21 +10,21 @@ namespace Server.Mobiles
{
private static readonly SpawnEntry[] m_Entries =
{
new SpawnEntry(new Point3D(5242, 945, -40), new Point3D(1176, 2638, 0)), // Destard
new SpawnEntry(new Point3D(5225, 798, 0), new Point3D(1176, 2638, 0)), // Destard
new SpawnEntry(new Point3D(5556, 886, 30), new Point3D(1298, 1080, 0)), // Despise
new SpawnEntry(new Point3D(5187, 615, 0), new Point3D(4111, 432, 5)), // Deceit
new SpawnEntry(new Point3D(5319, 583, 0), new Point3D(4111, 432, 5)), // Deceit
new SpawnEntry(new Point3D(5713, 1334, -1), new Point3D(2923, 3407, 8)), // Fire
new SpawnEntry(new Point3D(5860, 1460, -2), new Point3D(2923, 3407, 8)), // Fire
new SpawnEntry(new Point3D(5328, 1620, 0), new Point3D(5451, 3143, -60)), // Terathan Keep
new SpawnEntry(new Point3D(5690, 538, 0), new Point3D(2042, 224, 14)), // Wrong
new SpawnEntry(new Point3D(5609, 195, 0), new Point3D(514, 1561, 0)), // Shame
new SpawnEntry(new Point3D(5475, 187, 0), new Point3D(514, 1561, 0)), // Shame
new SpawnEntry(new Point3D(6085, 179, 0), new Point3D(4721, 3822, 0)), // Hythloth
new SpawnEntry(new Point3D(6084, 66, 0), new Point3D(4721, 3822, 0)), // Hythloth
new SpawnEntry(new Point3D(5499, 2003, 0), new Point3D(2499, 919, 0)), // Covetous
new SpawnEntry(new Point3D(5579, 1858, 0), new Point3D(2499, 919, 0)) // Covetous
new(new Point3D(5242, 945, -40), new Point3D(1176, 2638, 0)), // Destard
new(new Point3D(5225, 798, 0), new Point3D(1176, 2638, 0)), // Destard
new(new Point3D(5556, 886, 30), new Point3D(1298, 1080, 0)), // Despise
new(new Point3D(5187, 615, 0), new Point3D(4111, 432, 5)), // Deceit
new(new Point3D(5319, 583, 0), new Point3D(4111, 432, 5)), // Deceit
new(new Point3D(5713, 1334, -1), new Point3D(2923, 3407, 8)), // Fire
new(new Point3D(5860, 1460, -2), new Point3D(2923, 3407, 8)), // Fire
new(new Point3D(5328, 1620, 0), new Point3D(5451, 3143, -60)), // Terathan Keep
new(new Point3D(5690, 538, 0), new Point3D(2042, 224, 14)), // Wrong
new(new Point3D(5609, 195, 0), new Point3D(514, 1561, 0)), // Shame
new(new Point3D(5475, 187, 0), new Point3D(514, 1561, 0)), // Shame
new(new Point3D(6085, 179, 0), new Point3D(4721, 3822, 0)), // Hythloth
new(new Point3D(6084, 66, 0), new Point3D(4721, 3822, 0)), // Hythloth
new(new Point3D(5499, 2003, 0), new Point3D(2499, 919, 0)), // Covetous
new(new Point3D(5579, 1858, 0), new Point3D(2499, 919, 0)) // Covetous
};
private static readonly double[] m_Offsets =
@ -93,7 +93,7 @@ namespace Server.Mobiles
public Type[] SharedList => new[] { typeof(TheRobeOfBritanniaAri) };
public Type[] DecorativeList => new[] { typeof(EvilIdolSkull), typeof(SkullPole) };
public static List<Harrower> Instances { get; } = new List<Harrower>();
public static List<Harrower> Instances { get; } = new();
public static bool CanSpawn => Instances.Count == 0;

View file

@ -10,7 +10,7 @@ namespace Server.Mobiles
{
public class Banker : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Banker() : base("the banker")

View file

@ -127,7 +127,7 @@ namespace Server.Mobiles
}
}
public static Dictionary<Mobile, BaseEscortable> EscortTable { get; } = new Dictionary<Mobile, BaseEscortable>();
public static Dictionary<Mobile, BaseEscortable> EscortTable { get; } = new();
protected override List<MLQuest> ConstructQuestList()
{

View file

@ -379,7 +379,7 @@ namespace Server.Mobiles
Instances.Add(this);
}
public static List<TownCrier> Instances { get; } = new List<TownCrier>();
public static List<TownCrier> Instances { get; } = new();
public List<TownCrierEntry> Entries { get; private set; }

View file

@ -26,8 +26,8 @@ namespace Server.Mobiles
private static readonly TimeSpan InventoryDecayTime = TimeSpan.FromHours(1.0);
private readonly List<IBuyItemInfo> m_ArmorBuyInfo = new List<IBuyItemInfo>();
private readonly List<IShopSellInfo> m_ArmorSellInfo = new List<IShopSellInfo>();
private readonly List<IBuyItemInfo> m_ArmorBuyInfo = new();
private readonly List<IShopSellInfo> m_ArmorSellInfo = new();
public BaseVendor(string title = null)
: base(AIType.AI_Vendor, FightMode.None, 2, 1, 0.5, 2)

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Alchemist : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Alchemist() : base("the alchemist")

View file

@ -10,7 +10,7 @@ namespace Server.Mobiles
{
public class AnimalTrainer : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public AnimalTrainer() : base("the animal trainer")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Architect : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Architect() : base("the architect")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Armorer : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Armorer() : base("the armorer")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Baker : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Baker() : base("the baker")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Bard : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Bard() : base("the bard")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Barkeeper : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Barkeeper() : base("the barkeeper")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Beekeeper : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Beekeeper() : base("the beekeeper")

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class Blacksmith : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Blacksmith() : base("the blacksmith")

View file

@ -6,7 +6,7 @@ namespace Server.Mobiles
[TypeAlias("Server.Mobiles.Bower")]
public class Bowyer : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Bowyer() : base("the bowyer")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Butcher : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Butcher() : base("the butcher")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Carpenter : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Carpenter() : base("the carpenter")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Cobbler : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Cobbler() : base("the cobbler")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Cook : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Cook() : base("the cook")

View file

@ -15,7 +15,7 @@ namespace Server.Mobiles
private static readonly HairstylistBuyInfo[] m_SellList =
{
new HairstylistBuyInfo(
new(
1018357,
50000,
false,
@ -23,7 +23,7 @@ namespace Server.Mobiles
new[]
{ From, Vendor, Price, false, ChangeHairstyleEntry.HairEntries }
),
new HairstylistBuyInfo(
new(
1018358,
50000,
true,
@ -31,7 +31,7 @@ namespace Server.Mobiles
new[]
{ From, Vendor, Price, true, ChangeHairstyleEntry.BeardEntries }
),
new HairstylistBuyInfo(
new(
1018359,
50,
false,
@ -39,7 +39,7 @@ namespace Server.Mobiles
new[]
{ From, Vendor, Price, true, true, ChangeHairHueEntry.RegularEntries }
),
new HairstylistBuyInfo(
new(
1018360,
500000,
false,
@ -47,7 +47,7 @@ namespace Server.Mobiles
new[]
{ From, Vendor, Price, true, true, ChangeHairHueEntry.BrightEntries }
),
new HairstylistBuyInfo(
new(
1018361,
30000,
false,
@ -55,7 +55,7 @@ namespace Server.Mobiles
new[]
{ From, Vendor, Price, true, false, ChangeHairHueEntry.RegularEntries }
),
new HairstylistBuyInfo(
new(
1018362,
30000,
true,
@ -63,7 +63,7 @@ namespace Server.Mobiles
new[]
{ From, Vendor, Price, false, true, ChangeHairHueEntry.RegularEntries }
),
new HairstylistBuyInfo(
new(
1018363,
500000,
false,
@ -71,7 +71,7 @@ namespace Server.Mobiles
new[]
{ From, Vendor, Price, true, false, ChangeHairHueEntry.BrightEntries }
),
new HairstylistBuyInfo(
new(
1018364,
500000,
true,
@ -90,7 +90,7 @@ namespace Server.Mobiles
{
}
protected override List<SBInfo> SBInfos { get; } = new List<SBInfo>();
protected override List<SBInfo> SBInfos { get; } = new();
public override bool ClickTitle => false;

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Farmer : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Farmer() : base("the farmer")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Fisherman : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Fisherman() : base("the fisher")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Furtrader : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Furtrader() : base("the furtrader")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
[TypeAlias("Server.Mobiles.GargoyleAlchemist")]
public class Glassblower : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Glassblower() : base("the alchemist")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class GolemCrafter : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public GolemCrafter() : base("the golem crafter")

View file

@ -14,7 +14,7 @@ namespace Server.Mobiles
{
}
protected override List<SBInfo> SBInfos { get; } = new List<SBInfo>();
protected override List<SBInfo> SBInfos { get; } = new();
public override bool IsActiveVendor => false;

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class GypsyMaiden : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public GypsyMaiden() : base("the gypsy maiden")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class HairStylist : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public HairStylist() : base("the hair stylist")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Herbalist : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Herbalist() : base("the herbalist")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class HolyMage : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public HolyMage() : base("the Holy Mage")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class InnKeeper : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public InnKeeper() : base("the innkeeper")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class IronWorker : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public IronWorker() : base("the iron worker")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Jeweler : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Jeweler() : base("the jeweler")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class KeeperOfChivalry : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public KeeperOfChivalry() : base("the Keeper of Chivalry")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class LeatherWorker : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public LeatherWorker() : base("the leather worker")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Mage : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Mage() : base("the mage")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Mapmaker : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Mapmaker() : base("the mapmaker")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Miller : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Miller() : base("the miller")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Miner : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Miner() : base("the miner")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Monk : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Monk() : base("the Monk")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Provisioner : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Provisioner() : base("the provisioner")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Rancher : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Rancher() : base("the rancher")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Ranger : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Ranger() : base("the ranger")

View file

@ -8,7 +8,7 @@ namespace Server.Mobiles
{
public class RealEstateBroker : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
private DateTime m_NextCheckPack;
[Constructible]

View file

@ -8,7 +8,7 @@ namespace Server.Mobiles
public class Scribe : BaseVendor
{
public static readonly TimeSpan ShushDelay = TimeSpan.FromMinutes(1);
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
private DateTime m_NextShush;

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Shipwright : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Shipwright() : base("the shipwright")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
[TypeAlias("Server.Mobiles.GargoyleStonecrafter")]
public class StoneCrafter : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public StoneCrafter() : base("the stone crafter")

View file

@ -6,7 +6,7 @@ namespace Server.Mobiles
{
public class Tailor : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Tailor() : base("the tailor")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Tanner : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Tanner() : base("the tanner")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class TavernKeeper : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public TavernKeeper() : base("the tavern keeper")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Thief : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Thief() : base("the thief")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Tinker : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Tinker() : base("the tinker")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Vagabond : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Vagabond() : base("the vagabond")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class VarietyDealer : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public VarietyDealer() : base("the variety dealer")

View file

@ -4,7 +4,7 @@ namespace Server.Mobiles
{
public class Veterinarian : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Veterinarian() : base("the vet")

View file

@ -5,7 +5,7 @@ namespace Server.Mobiles
{
public class Waiter : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Waiter() : base("the waiter")

View file

@ -7,7 +7,7 @@ namespace Server.Mobiles
{
public class Weaponsmith : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Weaponsmith() : base("the weaponsmith")

View file

@ -6,7 +6,7 @@ namespace Server.Mobiles
{
public class Weaver : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
[Constructible]
public Weaver() : base("the weaver")

View file

@ -141,7 +141,7 @@ namespace Server.Mobiles
public class PlayerBarkeeper : BaseVendor
{
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new();
private BaseHouse m_House;
private Timer m_NewsTimer;

View file

@ -106,11 +106,11 @@ namespace Server.Spells.Mysticism
ResistanceMod[] mods =
{
new ResistanceMod(ResistanceType.Physical, offset),
new ResistanceMod(ResistanceType.Fire, offset),
new ResistanceMod(ResistanceType.Cold, offset),
new ResistanceMod(ResistanceType.Poison, offset),
new ResistanceMod(ResistanceType.Energy, offset)
new(ResistanceType.Physical, offset),
new(ResistanceType.Fire, offset),
new(ResistanceType.Cold, offset),
new(ResistanceType.Poison, offset),
new(ResistanceType.Energy, offset)
};
for (var i = 0; i < mods.Length; ++i)

View file

@ -71,10 +71,10 @@ namespace Server.Spells.Necromancy
ResistanceMod[] mods =
{
new ResistanceMod(ResistanceType.Fire, -15),
new ResistanceMod(ResistanceType.Poison, -15),
new ResistanceMod(ResistanceType.Cold, +10),
new ResistanceMod(ResistanceType.Physical, +10)
new(ResistanceType.Fire, -15),
new(ResistanceType.Poison, -15),
new(ResistanceType.Cold, +10),
new(ResistanceType.Physical, +10)
};
timer = new ExpireTimer(m, mods, duration);