fix: Cleans up core code (#1187)
**Only one functional change** * Fixes a bug in LogFactory where `Warning` is being logged as `Information` Non-functional changes: * Updates/Fixes copyright headers * Removes namespace scopes for core files. View with [whitespace off](https://github.com/modernuo/ModernUO/pull/1187/files?w=1).
This commit is contained in:
parent
0138d40bda
commit
f268d5d4e2
262 changed files with 28527 additions and 28646 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AccountLoginEvent.cs *
|
||||
* *
|
||||
|
|
@ -17,33 +17,32 @@ using System;
|
|||
using System.Runtime.CompilerServices;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class AccountLoginEventArgs
|
||||
{
|
||||
public class AccountLoginEventArgs
|
||||
public AccountLoginEventArgs(NetState state, string username, string password)
|
||||
{
|
||||
public AccountLoginEventArgs(NetState state, string username, string password)
|
||||
{
|
||||
State = state;
|
||||
Username = username;
|
||||
Password = password;
|
||||
}
|
||||
|
||||
public NetState State { get; }
|
||||
|
||||
public string Username { get; }
|
||||
|
||||
public string Password { get; }
|
||||
|
||||
public bool Accepted { get; set; }
|
||||
|
||||
public ALRReason RejectReason { get; set; }
|
||||
State = state;
|
||||
Username = username;
|
||||
Password = password;
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<AccountLoginEventArgs> AccountLogin;
|
||||
public NetState State { get; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeAccountLogin(AccountLoginEventArgs e) => AccountLogin?.Invoke(e);
|
||||
}
|
||||
public string Username { get; }
|
||||
|
||||
public string Password { get; }
|
||||
|
||||
public bool Accepted { get; set; }
|
||||
|
||||
public ALRReason RejectReason { get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<AccountLoginEventArgs> AccountLogin;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeAccountLogin(AccountLoginEventArgs e) => AccountLogin?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AggressiveActionEvent.cs *
|
||||
* *
|
||||
|
|
@ -17,56 +17,55 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class AggressiveActionEventArgs : EventArgs
|
||||
{
|
||||
public class AggressiveActionEventArgs : EventArgs
|
||||
private static readonly Queue<AggressiveActionEventArgs> m_Pool = new();
|
||||
|
||||
private AggressiveActionEventArgs(Mobile aggressed, Mobile aggressor, bool criminal)
|
||||
{
|
||||
private static readonly Queue<AggressiveActionEventArgs> m_Pool = new();
|
||||
|
||||
private AggressiveActionEventArgs(Mobile aggressed, Mobile aggressor, bool criminal)
|
||||
{
|
||||
Aggressed = aggressed;
|
||||
Aggressor = aggressor;
|
||||
Criminal = criminal;
|
||||
}
|
||||
|
||||
public Mobile Aggressed { get; private set; }
|
||||
|
||||
public Mobile Aggressor { get; private set; }
|
||||
|
||||
public bool Criminal { get; private set; }
|
||||
|
||||
public static AggressiveActionEventArgs Create(Mobile aggressed, Mobile aggressor, bool criminal)
|
||||
{
|
||||
AggressiveActionEventArgs args;
|
||||
|
||||
if (m_Pool.Count > 0)
|
||||
{
|
||||
args = m_Pool.Dequeue();
|
||||
|
||||
args.Aggressed = aggressed;
|
||||
args.Aggressor = aggressor;
|
||||
args.Criminal = criminal;
|
||||
}
|
||||
else
|
||||
{
|
||||
args = new AggressiveActionEventArgs(aggressed, aggressor, criminal);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
public void Free()
|
||||
{
|
||||
m_Pool.Enqueue(this);
|
||||
}
|
||||
Aggressed = aggressed;
|
||||
Aggressor = aggressor;
|
||||
Criminal = criminal;
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<AggressiveActionEventArgs> AggressiveAction;
|
||||
public Mobile Aggressed { get; private set; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeAggressiveAction(AggressiveActionEventArgs e) => AggressiveAction?.Invoke(e);
|
||||
public Mobile Aggressor { get; private set; }
|
||||
|
||||
public bool Criminal { get; private set; }
|
||||
|
||||
public static AggressiveActionEventArgs Create(Mobile aggressed, Mobile aggressor, bool criminal)
|
||||
{
|
||||
AggressiveActionEventArgs args;
|
||||
|
||||
if (m_Pool.Count > 0)
|
||||
{
|
||||
args = m_Pool.Dequeue();
|
||||
|
||||
args.Aggressed = aggressed;
|
||||
args.Aggressor = aggressor;
|
||||
args.Criminal = criminal;
|
||||
}
|
||||
else
|
||||
{
|
||||
args = new AggressiveActionEventArgs(aggressed, aggressor, criminal);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
public void Free()
|
||||
{
|
||||
m_Pool.Enqueue(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<AggressiveActionEventArgs> AggressiveAction;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeAggressiveAction(AggressiveActionEventArgs e) => AggressiveAction?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: CharacterCreatedEvent.cs *
|
||||
* *
|
||||
|
|
@ -18,77 +18,76 @@ using System.Runtime.CompilerServices;
|
|||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class CharacterCreatedEventArgs
|
||||
{
|
||||
public class CharacterCreatedEventArgs
|
||||
public CharacterCreatedEventArgs(
|
||||
NetState state, IAccount a, string name, bool female, int hue, StatNameValue[] stats, CityInfo city,
|
||||
SkillNameValue[] skills, int shirtHue, int pantsHue, int hairID, int hairHue, int beardID, int beardHue,
|
||||
int profession, Race race
|
||||
)
|
||||
{
|
||||
public CharacterCreatedEventArgs(
|
||||
NetState state, IAccount a, string name, bool female, int hue, StatNameValue[] stats, CityInfo city,
|
||||
SkillNameValue[] skills, int shirtHue, int pantsHue, int hairID, int hairHue, int beardID, int beardHue,
|
||||
int profession, Race race
|
||||
)
|
||||
{
|
||||
State = state;
|
||||
Account = a;
|
||||
Name = name;
|
||||
Female = female;
|
||||
Hue = hue;
|
||||
Stats = stats;
|
||||
City = city;
|
||||
Skills = skills;
|
||||
ShirtHue = shirtHue;
|
||||
PantsHue = pantsHue;
|
||||
HairID = hairID;
|
||||
HairHue = hairHue;
|
||||
BeardID = beardID;
|
||||
BeardHue = beardHue;
|
||||
Profession = profession;
|
||||
Race = race;
|
||||
}
|
||||
|
||||
public NetState State { get; }
|
||||
|
||||
public IAccount Account { get; }
|
||||
|
||||
public Mobile Mobile { get; set; }
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public bool Female { get; }
|
||||
|
||||
public int Hue { get; }
|
||||
|
||||
public StatNameValue[] Stats { get; }
|
||||
|
||||
public CityInfo City { get; }
|
||||
|
||||
public SkillNameValue[] Skills { get; }
|
||||
|
||||
public int ShirtHue { get; }
|
||||
|
||||
public int PantsHue { get; }
|
||||
|
||||
public int HairID { get; }
|
||||
|
||||
public int HairHue { get; }
|
||||
|
||||
public int BeardID { get; }
|
||||
|
||||
public int BeardHue { get; }
|
||||
|
||||
public int Profession { get; set; }
|
||||
|
||||
public Race Race { get; }
|
||||
State = state;
|
||||
Account = a;
|
||||
Name = name;
|
||||
Female = female;
|
||||
Hue = hue;
|
||||
Stats = stats;
|
||||
City = city;
|
||||
Skills = skills;
|
||||
ShirtHue = shirtHue;
|
||||
PantsHue = pantsHue;
|
||||
HairID = hairID;
|
||||
HairHue = hairHue;
|
||||
BeardID = beardID;
|
||||
BeardHue = beardHue;
|
||||
Profession = profession;
|
||||
Race = race;
|
||||
}
|
||||
|
||||
public readonly record struct SkillNameValue(SkillName Name, int Value);
|
||||
public readonly record struct StatNameValue(StatType Name, int Value);
|
||||
public NetState State { get; }
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<CharacterCreatedEventArgs> CharacterCreated;
|
||||
public IAccount Account { get; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeCharacterCreated(CharacterCreatedEventArgs e) => CharacterCreated?.Invoke(e);
|
||||
}
|
||||
public Mobile Mobile { get; set; }
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public bool Female { get; }
|
||||
|
||||
public int Hue { get; }
|
||||
|
||||
public StatNameValue[] Stats { get; }
|
||||
|
||||
public CityInfo City { get; }
|
||||
|
||||
public SkillNameValue[] Skills { get; }
|
||||
|
||||
public int ShirtHue { get; }
|
||||
|
||||
public int PantsHue { get; }
|
||||
|
||||
public int HairID { get; }
|
||||
|
||||
public int HairHue { get; }
|
||||
|
||||
public int BeardID { get; }
|
||||
|
||||
public int BeardHue { get; }
|
||||
|
||||
public int Profession { get; set; }
|
||||
|
||||
public Race Race { get; }
|
||||
}
|
||||
|
||||
public readonly record struct SkillNameValue(SkillName Name, int Value);
|
||||
public readonly record struct StatNameValue(StatType Name, int Value);
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<CharacterCreatedEventArgs> CharacterCreated;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeCharacterCreated(CharacterCreatedEventArgs e) => CharacterCreated?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: EventSink.cs *
|
||||
* *
|
||||
|
|
@ -17,145 +17,144 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static partial class EventSink
|
||||
public static event Action<Mobile> OpenDoorMacroUsed;
|
||||
public static void InvokeOpenDoorMacroUsed(Mobile m) => OpenDoorMacroUsed?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> Login;
|
||||
public static void InvokeLogin(Mobile m) => Login?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile, int> HungerChanged;
|
||||
public static void InvokeHungerChanged(Mobile mobile, int oldValue) => HungerChanged?.Invoke(mobile, oldValue);
|
||||
|
||||
public static event Action Shutdown;
|
||||
public static void InvokeShutdown() => Shutdown?.Invoke();
|
||||
|
||||
public static event Action<Mobile> HelpRequest;
|
||||
public static void InvokeHelpRequest(Mobile m) => HelpRequest?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> DisarmRequest;
|
||||
public static void InvokeDisarmRequest(Mobile m) => DisarmRequest?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> StunRequest;
|
||||
public static void InvokeStunRequest(Mobile m) => StunRequest?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile, int> OpenSpellbookRequest;
|
||||
public static void InvokeOpenSpellbookRequest(Mobile m, int type) => OpenSpellbookRequest?.Invoke(m, type);
|
||||
|
||||
public static event Action<Mobile, int, Item> CastSpellRequest;
|
||||
|
||||
public static void InvokeCastSpellRequest(Mobile m, int spellID, Item book) =>
|
||||
CastSpellRequest?.Invoke(m, spellID, book);
|
||||
|
||||
public static event Action<Mobile, Item, Mobile> BandageTargetRequest;
|
||||
|
||||
public static void InvokeBandageTargetRequest(Mobile m, Item bandage, Mobile target) =>
|
||||
BandageTargetRequest?.Invoke(m, bandage, target);
|
||||
|
||||
public static event Action<Mobile, string> AnimateRequest;
|
||||
public static void InvokeAnimateRequest(Mobile m, string action) => AnimateRequest?.Invoke(m, action);
|
||||
|
||||
public static event Action<Mobile> Logout;
|
||||
public static void InvokeLogout(Mobile m) => Logout?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> Connected;
|
||||
public static void InvokeConnected(Mobile m) => Connected?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> BeforeDisconnected;
|
||||
public static void InvokeBeforeDisconnected(Mobile m) => BeforeDisconnected?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> Disconnected;
|
||||
public static void InvokeDisconnected(Mobile m) => Disconnected?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile, Mobile, string> RenameRequest;
|
||||
|
||||
public static void InvokeRenameRequest(Mobile from, Mobile target, string name) =>
|
||||
RenameRequest?.Invoke(from, target, name);
|
||||
|
||||
public static event Action<Mobile> PlayerDeath;
|
||||
public static void InvokePlayerDeath(Mobile m) => PlayerDeath?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile, Mobile> VirtueGumpRequest;
|
||||
|
||||
public static void InvokeVirtueGumpRequest(Mobile beholder, Mobile beheld) =>
|
||||
VirtueGumpRequest?.Invoke(beholder, beheld);
|
||||
|
||||
public static event Action<Mobile, Mobile, int> VirtueItemRequest;
|
||||
|
||||
public static void InvokeVirtueItemRequest(Mobile beholder, Mobile beheld, int gumpID) =>
|
||||
VirtueItemRequest?.Invoke(beholder, beheld, gumpID);
|
||||
|
||||
public static event Action<Mobile, int> VirtueMacroRequest;
|
||||
|
||||
public static void InvokeVirtueMacroRequest(Mobile mobile, int virtueID) =>
|
||||
VirtueMacroRequest?.Invoke(mobile, virtueID);
|
||||
|
||||
public static event Action<Mobile, Mobile> PaperdollRequest;
|
||||
|
||||
public static void InvokePaperdollRequest(Mobile beholder, Mobile beheld) =>
|
||||
PaperdollRequest?.Invoke(beholder, beheld);
|
||||
|
||||
public static event Action<Mobile, Mobile> ProfileRequest;
|
||||
public static void InvokeProfileRequest(Mobile beholder, Mobile beheld) => ProfileRequest?.Invoke(beholder, beheld);
|
||||
|
||||
public static event Action<Mobile, Mobile, string> ChangeProfileRequest;
|
||||
|
||||
public static void InvokeChangeProfileRequest(Mobile beholder, Mobile beheld, string text) =>
|
||||
ChangeProfileRequest?.Invoke(beholder, beheld, text);
|
||||
|
||||
public static event Action<NetState, int> DeleteRequest;
|
||||
public static void InvokeDeleteRequest(NetState state, int index) => DeleteRequest?.Invoke(state, index);
|
||||
|
||||
public static event Action ServerStarted;
|
||||
public static void InvokeServerStarted() => ServerStarted?.Invoke();
|
||||
|
||||
public static event Action<Mobile> GuildGumpRequest;
|
||||
public static void InvokeGuildGumpRequest(Mobile m) => GuildGumpRequest?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> QuestGumpRequest;
|
||||
public static void InvokeQuestGumpRequest(Mobile m) => QuestGumpRequest?.Invoke(m);
|
||||
|
||||
public static event Action<NetState, ClientVersion> ClientVersionReceived;
|
||||
|
||||
public static void InvokeClientVersionReceived(NetState state, ClientVersion cv) =>
|
||||
ClientVersionReceived?.Invoke(state, cv);
|
||||
|
||||
public static event Action<Mobile, List<Serial>> EquipMacro;
|
||||
|
||||
public static void InvokeEquipMacro(Mobile m, List<Serial> list)
|
||||
{
|
||||
public static event Action<Mobile> OpenDoorMacroUsed;
|
||||
public static void InvokeOpenDoorMacroUsed(Mobile m) => OpenDoorMacroUsed?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> Login;
|
||||
public static void InvokeLogin(Mobile m) => Login?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile, int> HungerChanged;
|
||||
public static void InvokeHungerChanged(Mobile mobile, int oldValue) => HungerChanged?.Invoke(mobile, oldValue);
|
||||
|
||||
public static event Action Shutdown;
|
||||
public static void InvokeShutdown() => Shutdown?.Invoke();
|
||||
|
||||
public static event Action<Mobile> HelpRequest;
|
||||
public static void InvokeHelpRequest(Mobile m) => HelpRequest?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> DisarmRequest;
|
||||
public static void InvokeDisarmRequest(Mobile m) => DisarmRequest?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> StunRequest;
|
||||
public static void InvokeStunRequest(Mobile m) => StunRequest?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile, int> OpenSpellbookRequest;
|
||||
public static void InvokeOpenSpellbookRequest(Mobile m, int type) => OpenSpellbookRequest?.Invoke(m, type);
|
||||
|
||||
public static event Action<Mobile, int, Item> CastSpellRequest;
|
||||
|
||||
public static void InvokeCastSpellRequest(Mobile m, int spellID, Item book) =>
|
||||
CastSpellRequest?.Invoke(m, spellID, book);
|
||||
|
||||
public static event Action<Mobile, Item, Mobile> BandageTargetRequest;
|
||||
|
||||
public static void InvokeBandageTargetRequest(Mobile m, Item bandage, Mobile target) =>
|
||||
BandageTargetRequest?.Invoke(m, bandage, target);
|
||||
|
||||
public static event Action<Mobile, string> AnimateRequest;
|
||||
public static void InvokeAnimateRequest(Mobile m, string action) => AnimateRequest?.Invoke(m, action);
|
||||
|
||||
public static event Action<Mobile> Logout;
|
||||
public static void InvokeLogout(Mobile m) => Logout?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> Connected;
|
||||
public static void InvokeConnected(Mobile m) => Connected?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> BeforeDisconnected;
|
||||
public static void InvokeBeforeDisconnected(Mobile m) => BeforeDisconnected?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> Disconnected;
|
||||
public static void InvokeDisconnected(Mobile m) => Disconnected?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile, Mobile, string> RenameRequest;
|
||||
|
||||
public static void InvokeRenameRequest(Mobile from, Mobile target, string name) =>
|
||||
RenameRequest?.Invoke(from, target, name);
|
||||
|
||||
public static event Action<Mobile> PlayerDeath;
|
||||
public static void InvokePlayerDeath(Mobile m) => PlayerDeath?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile, Mobile> VirtueGumpRequest;
|
||||
|
||||
public static void InvokeVirtueGumpRequest(Mobile beholder, Mobile beheld) =>
|
||||
VirtueGumpRequest?.Invoke(beholder, beheld);
|
||||
|
||||
public static event Action<Mobile, Mobile, int> VirtueItemRequest;
|
||||
|
||||
public static void InvokeVirtueItemRequest(Mobile beholder, Mobile beheld, int gumpID) =>
|
||||
VirtueItemRequest?.Invoke(beholder, beheld, gumpID);
|
||||
|
||||
public static event Action<Mobile, int> VirtueMacroRequest;
|
||||
|
||||
public static void InvokeVirtueMacroRequest(Mobile mobile, int virtueID) =>
|
||||
VirtueMacroRequest?.Invoke(mobile, virtueID);
|
||||
|
||||
public static event Action<Mobile, Mobile> PaperdollRequest;
|
||||
|
||||
public static void InvokePaperdollRequest(Mobile beholder, Mobile beheld) =>
|
||||
PaperdollRequest?.Invoke(beholder, beheld);
|
||||
|
||||
public static event Action<Mobile, Mobile> ProfileRequest;
|
||||
public static void InvokeProfileRequest(Mobile beholder, Mobile beheld) => ProfileRequest?.Invoke(beholder, beheld);
|
||||
|
||||
public static event Action<Mobile, Mobile, string> ChangeProfileRequest;
|
||||
|
||||
public static void InvokeChangeProfileRequest(Mobile beholder, Mobile beheld, string text) =>
|
||||
ChangeProfileRequest?.Invoke(beholder, beheld, text);
|
||||
|
||||
public static event Action<NetState, int> DeleteRequest;
|
||||
public static void InvokeDeleteRequest(NetState state, int index) => DeleteRequest?.Invoke(state, index);
|
||||
|
||||
public static event Action ServerStarted;
|
||||
public static void InvokeServerStarted() => ServerStarted?.Invoke();
|
||||
|
||||
public static event Action<Mobile> GuildGumpRequest;
|
||||
public static void InvokeGuildGumpRequest(Mobile m) => GuildGumpRequest?.Invoke(m);
|
||||
|
||||
public static event Action<Mobile> QuestGumpRequest;
|
||||
public static void InvokeQuestGumpRequest(Mobile m) => QuestGumpRequest?.Invoke(m);
|
||||
|
||||
public static event Action<NetState, ClientVersion> ClientVersionReceived;
|
||||
|
||||
public static void InvokeClientVersionReceived(NetState state, ClientVersion cv) =>
|
||||
ClientVersionReceived?.Invoke(state, cv);
|
||||
|
||||
public static event Action<Mobile, List<Serial>> EquipMacro;
|
||||
|
||||
public static void InvokeEquipMacro(Mobile m, List<Serial> list)
|
||||
if (list?.Count > 0)
|
||||
{
|
||||
if (list?.Count > 0)
|
||||
{
|
||||
EquipMacro?.Invoke(m, list);
|
||||
}
|
||||
EquipMacro?.Invoke(m, list);
|
||||
}
|
||||
|
||||
public static event Action<Mobile, List<Layer>> UnequipMacro;
|
||||
|
||||
public static void InvokeUnequipMacro(Mobile m, List<Layer> layers)
|
||||
{
|
||||
if (layers?.Count > 0)
|
||||
{
|
||||
UnequipMacro?.Invoke(m, layers);
|
||||
}
|
||||
}
|
||||
|
||||
public static event Action<Mobile, IEntity, int> TargetedSpell;
|
||||
|
||||
public static void InvokeTargetedSpell(Mobile m, IEntity target, int spellId) =>
|
||||
TargetedSpell?.Invoke(m, target, spellId);
|
||||
|
||||
public static event Action<Mobile, IEntity, int> TargetedSkillUse;
|
||||
|
||||
public static void InvokeTargetedSkillUse(Mobile m, IEntity target, int skillId) =>
|
||||
TargetedSkillUse?.Invoke(m, target, skillId);
|
||||
|
||||
public static event Action<Mobile, Item, short> TargetByResourceMacro;
|
||||
|
||||
public static void InvokeTargetByResourceMacro(Mobile m, Item item, short resourceType) =>
|
||||
TargetByResourceMacro?.Invoke(m, item, resourceType);
|
||||
}
|
||||
|
||||
public static event Action<Mobile, List<Layer>> UnequipMacro;
|
||||
|
||||
public static void InvokeUnequipMacro(Mobile m, List<Layer> layers)
|
||||
{
|
||||
if (layers?.Count > 0)
|
||||
{
|
||||
UnequipMacro?.Invoke(m, layers);
|
||||
}
|
||||
}
|
||||
|
||||
public static event Action<Mobile, IEntity, int> TargetedSpell;
|
||||
|
||||
public static void InvokeTargetedSpell(Mobile m, IEntity target, int spellId) =>
|
||||
TargetedSpell?.Invoke(m, target, spellId);
|
||||
|
||||
public static event Action<Mobile, IEntity, int> TargetedSkillUse;
|
||||
|
||||
public static void InvokeTargetedSkillUse(Mobile m, IEntity target, int skillId) =>
|
||||
TargetedSkillUse?.Invoke(m, target, skillId);
|
||||
|
||||
public static event Action<Mobile, Item, short> TargetByResourceMacro;
|
||||
|
||||
public static void InvokeTargetByResourceMacro(Mobile m, Item item, short resourceType) =>
|
||||
TargetByResourceMacro?.Invoke(m, item, resourceType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: FastwalkEvent.cs *
|
||||
* *
|
||||
|
|
@ -17,22 +17,21 @@ using System;
|
|||
using System.Runtime.CompilerServices;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class FastWalkEventArgs
|
||||
{
|
||||
public class FastWalkEventArgs
|
||||
{
|
||||
public FastWalkEventArgs(NetState state) => NetState = state;
|
||||
public FastWalkEventArgs(NetState state) => NetState = state;
|
||||
|
||||
public NetState NetState { get; }
|
||||
public NetState NetState { get; }
|
||||
|
||||
public bool Blocked { get; set; } = true;
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<FastWalkEventArgs> FastWalk;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeFastWalk(FastWalkEventArgs e) => FastWalk?.Invoke(e);
|
||||
}
|
||||
public bool Blocked { get; set; } = true;
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<FastWalkEventArgs> FastWalk;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeFastWalk(FastWalkEventArgs e) => FastWalk?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: GameLoginEvent.cs *
|
||||
* *
|
||||
|
|
@ -17,33 +17,32 @@ using System;
|
|||
using System.Runtime.CompilerServices;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class GameLoginEventArgs
|
||||
{
|
||||
public class GameLoginEventArgs
|
||||
public GameLoginEventArgs(NetState state, string un, string pw)
|
||||
{
|
||||
public GameLoginEventArgs(NetState state, string un, string pw)
|
||||
{
|
||||
State = state;
|
||||
Username = un;
|
||||
Password = pw;
|
||||
}
|
||||
|
||||
public NetState State { get; }
|
||||
|
||||
public string Username { get; }
|
||||
|
||||
public string Password { get; }
|
||||
|
||||
public bool Accepted { get; set; }
|
||||
|
||||
public CityInfo[] CityInfo { get; set; }
|
||||
State = state;
|
||||
Username = un;
|
||||
Password = pw;
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<GameLoginEventArgs> GameLogin;
|
||||
public NetState State { get; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeGameLogin(GameLoginEventArgs e) => GameLogin?.Invoke(e);
|
||||
}
|
||||
public string Username { get; }
|
||||
|
||||
public string Password { get; }
|
||||
|
||||
public bool Accepted { get; set; }
|
||||
|
||||
public CityInfo[] CityInfo { get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<GameLoginEventArgs> GameLogin;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeGameLogin(GameLoginEventArgs e) => GameLogin?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: MovementEvent.cs *
|
||||
* *
|
||||
|
|
@ -17,55 +17,54 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class MovementEventArgs : EventArgs
|
||||
{
|
||||
public class MovementEventArgs : EventArgs
|
||||
private static readonly Queue<MovementEventArgs> m_Pool = new();
|
||||
|
||||
public MovementEventArgs(Mobile mobile, Direction dir)
|
||||
{
|
||||
private static readonly Queue<MovementEventArgs> m_Pool = new();
|
||||
|
||||
public MovementEventArgs(Mobile mobile, Direction dir)
|
||||
{
|
||||
Mobile = mobile;
|
||||
Direction = dir;
|
||||
}
|
||||
|
||||
public Mobile Mobile { get; private set; }
|
||||
|
||||
public Direction Direction { get; private set; }
|
||||
|
||||
public bool Blocked { get; set; }
|
||||
|
||||
public static MovementEventArgs Create(Mobile mobile, Direction dir)
|
||||
{
|
||||
MovementEventArgs args;
|
||||
|
||||
if (m_Pool.Count > 0)
|
||||
{
|
||||
args = m_Pool.Dequeue();
|
||||
|
||||
args.Mobile = mobile;
|
||||
args.Direction = dir;
|
||||
args.Blocked = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
args = new MovementEventArgs(mobile, dir);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
public void Free()
|
||||
{
|
||||
m_Pool.Enqueue(this);
|
||||
}
|
||||
Mobile = mobile;
|
||||
Direction = dir;
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<MovementEventArgs> Movement;
|
||||
public Mobile Mobile { get; private set; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeMovement(MovementEventArgs e) => Movement?.Invoke(e);
|
||||
public Direction Direction { get; private set; }
|
||||
|
||||
public bool Blocked { get; set; }
|
||||
|
||||
public static MovementEventArgs Create(Mobile mobile, Direction dir)
|
||||
{
|
||||
MovementEventArgs args;
|
||||
|
||||
if (m_Pool.Count > 0)
|
||||
{
|
||||
args = m_Pool.Dequeue();
|
||||
|
||||
args.Mobile = mobile;
|
||||
args.Direction = dir;
|
||||
args.Blocked = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
args = new MovementEventArgs(mobile, dir);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
public void Free()
|
||||
{
|
||||
m_Pool.Enqueue(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<MovementEventArgs> Movement;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeMovement(MovementEventArgs e) => Movement?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ServerCrashedEvent.cs *
|
||||
* *
|
||||
|
|
@ -16,22 +16,21 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class ServerCrashedEventArgs
|
||||
{
|
||||
public class ServerCrashedEventArgs
|
||||
{
|
||||
public ServerCrashedEventArgs(Exception e) => Exception = e;
|
||||
public ServerCrashedEventArgs(Exception e) => Exception = e;
|
||||
|
||||
public Exception Exception { get; }
|
||||
public Exception Exception { get; }
|
||||
|
||||
public bool Close { get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<ServerCrashedEventArgs> ServerCrashed;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeServerCrashed(ServerCrashedEventArgs e) => ServerCrashed?.Invoke(e);
|
||||
}
|
||||
public bool Close { get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<ServerCrashedEventArgs> ServerCrashed;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeServerCrashed(ServerCrashedEventArgs e) => ServerCrashed?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ServerListEvent.cs *
|
||||
* *
|
||||
|
|
@ -20,41 +20,40 @@ using System.Runtime.CompilerServices;
|
|||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class ServerListEventArgs
|
||||
{
|
||||
public class ServerListEventArgs
|
||||
public ServerListEventArgs(NetState state, IAccount account)
|
||||
{
|
||||
public ServerListEventArgs(NetState state, IAccount account)
|
||||
{
|
||||
State = state;
|
||||
Account = account;
|
||||
Servers = new List<ServerInfo>();
|
||||
}
|
||||
|
||||
public NetState State { get; }
|
||||
|
||||
public IAccount Account { get; }
|
||||
|
||||
public bool Rejected { get; set; }
|
||||
|
||||
public List<ServerInfo> Servers { get; }
|
||||
|
||||
public void AddServer(string name, IPEndPoint address)
|
||||
{
|
||||
AddServer(name, 0, TimeZoneInfo.Local, address);
|
||||
}
|
||||
|
||||
public void AddServer(string name, int fullPercent, TimeZoneInfo tz, IPEndPoint address)
|
||||
{
|
||||
Servers.Add(new ServerInfo(name, fullPercent, tz, address));
|
||||
}
|
||||
State = state;
|
||||
Account = account;
|
||||
Servers = new List<ServerInfo>();
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<ServerListEventArgs> ServerList;
|
||||
public NetState State { get; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeServerList(ServerListEventArgs e) => ServerList?.Invoke(e);
|
||||
public IAccount Account { get; }
|
||||
|
||||
public bool Rejected { get; set; }
|
||||
|
||||
public List<ServerInfo> Servers { get; }
|
||||
|
||||
public void AddServer(string name, IPEndPoint address)
|
||||
{
|
||||
AddServer(name, 0, TimeZoneInfo.Local, address);
|
||||
}
|
||||
|
||||
public void AddServer(string name, int fullPercent, TimeZoneInfo tz, IPEndPoint address)
|
||||
{
|
||||
Servers.Add(new ServerInfo(name, fullPercent, tz, address));
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<ServerListEventArgs> ServerList;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeServerList(ServerListEventArgs e) => ServerList?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: SocketConnectionEvent.cs *
|
||||
* *
|
||||
|
|
@ -17,26 +17,25 @@ using System;
|
|||
using System.Net.Sockets;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class SocketConnectEventArgs
|
||||
{
|
||||
public class SocketConnectEventArgs
|
||||
public SocketConnectEventArgs(Socket c)
|
||||
{
|
||||
public SocketConnectEventArgs(Socket c)
|
||||
{
|
||||
Connection = c;
|
||||
AllowConnection = true;
|
||||
}
|
||||
|
||||
public Socket Connection { get; }
|
||||
|
||||
public bool AllowConnection { get; set; }
|
||||
Connection = c;
|
||||
AllowConnection = true;
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<SocketConnectEventArgs> SocketConnect;
|
||||
public Socket Connection { get; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeSocketConnect(SocketConnectEventArgs e) => SocketConnect?.Invoke(e);
|
||||
}
|
||||
public bool AllowConnection { get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<SocketConnectEventArgs> SocketConnect;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeSocketConnect(SocketConnectEventArgs e) => SocketConnect?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: SpeechEvent.cs *
|
||||
* *
|
||||
|
|
@ -17,52 +17,51 @@ using System;
|
|||
using System.Runtime.CompilerServices;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class SpeechEventArgs
|
||||
{
|
||||
public class SpeechEventArgs
|
||||
public SpeechEventArgs(Mobile mobile, string speech, MessageType type, int hue, int[] keywords)
|
||||
{
|
||||
public SpeechEventArgs(Mobile mobile, string speech, MessageType type, int hue, int[] keywords)
|
||||
{
|
||||
Mobile = mobile;
|
||||
Speech = speech;
|
||||
Type = type;
|
||||
Hue = hue;
|
||||
Keywords = keywords;
|
||||
}
|
||||
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public string Speech { get; set; }
|
||||
|
||||
public MessageType Type { get; }
|
||||
|
||||
public int Hue { get; }
|
||||
|
||||
public int[] Keywords { get; }
|
||||
|
||||
public bool Handled { get; set; }
|
||||
|
||||
public bool Blocked { get; set; }
|
||||
|
||||
public bool HasKeyword(int keyword)
|
||||
{
|
||||
for (var i = 0; i < Keywords.Length; ++i)
|
||||
{
|
||||
if (Keywords[i] == keyword)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
Mobile = mobile;
|
||||
Speech = speech;
|
||||
Type = type;
|
||||
Hue = hue;
|
||||
Keywords = keywords;
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<SpeechEventArgs> Speech;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeSpeech(SpeechEventArgs e) => Speech?.Invoke(e);
|
||||
public string Speech { get; set; }
|
||||
|
||||
public MessageType Type { get; }
|
||||
|
||||
public int Hue { get; }
|
||||
|
||||
public int[] Keywords { get; }
|
||||
|
||||
public bool Handled { get; set; }
|
||||
|
||||
public bool Blocked { get; set; }
|
||||
|
||||
public bool HasKeyword(int keyword)
|
||||
{
|
||||
for (var i = 0; i < Keywords.Length; ++i)
|
||||
{
|
||||
if (Keywords[i] == keyword)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<SpeechEventArgs> Speech;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeSpeech(SpeechEventArgs e) => Speech?.Invoke(e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue