Adds BufferReader and BufferWriter. Updates UOP handling. (#101)
This commit is contained in:
parent
2c0d97cd36
commit
038c3be258
98 changed files with 2458 additions and 2185 deletions
52
Projects/Server/Events/AccountLoginEvent.cs
Normal file
52
Projects/Server/Events/AccountLoginEvent.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AccountLoginEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class AccountLoginEventArgs : EventArgs
|
||||
{
|
||||
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; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<AccountLoginEventArgs> AccountLogin;
|
||||
public static void InvokeAccountLogin(AccountLoginEventArgs e) => AccountLogin?.Invoke(e);
|
||||
}
|
||||
}
|
||||
75
Projects/Server/Events/AggressiveActionEvent.cs
Normal file
75
Projects/Server/Events/AggressiveActionEvent.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AggressiveActionEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class AggressiveActionEventArgs : EventArgs
|
||||
{
|
||||
private static Queue<AggressiveActionEventArgs> m_Pool = new Queue<AggressiveActionEventArgs>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<AggressiveActionEventArgs> AggressiveAction;
|
||||
public static void InvokeAggressiveAction(AggressiveActionEventArgs e) => AggressiveAction?.Invoke(e);
|
||||
}
|
||||
}
|
||||
110
Projects/Server/Events/CharacterCreatedEvent.cs
Normal file
110
Projects/Server/Events/CharacterCreatedEvent.cs
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: CharacterCreatedEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class CharacterCreatedEventArgs : EventArgs
|
||||
{
|
||||
public CharacterCreatedEventArgs(NetState state, IAccount a, string name, bool female, int hue, int str, int dex,
|
||||
int intel, 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;
|
||||
Str = str;
|
||||
Dex = dex;
|
||||
Int = intel;
|
||||
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 int Str{ get; }
|
||||
|
||||
public int Dex{ get; }
|
||||
|
||||
public int Int{ 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 struct SkillNameValue
|
||||
{
|
||||
public SkillName Name{ get; }
|
||||
|
||||
public int Value{ get; }
|
||||
|
||||
public SkillNameValue(SkillName name, int value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink {
|
||||
public static event Action<CharacterCreatedEventArgs> CharacterCreated;
|
||||
public static void InvokeCharacterCreated(CharacterCreatedEventArgs e) => CharacterCreated?.Invoke(e);
|
||||
}
|
||||
}
|
||||
41
Projects/Server/Events/CreateGuildEvent.cs
Normal file
41
Projects/Server/Events/CreateGuildEvent.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: CreateGuildEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using Server.Guilds;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class CreateGuildEventArgs : EventArgs
|
||||
{
|
||||
public CreateGuildEventArgs(uint id) => Id = id;
|
||||
|
||||
public uint Id{ get; set; }
|
||||
|
||||
public BaseGuild Guild{ get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<CreateGuildEventArgs> CreateGuild;
|
||||
public static void InvokeCreateGuild(CreateGuildEventArgs e) => CreateGuild?.Invoke(e);
|
||||
}
|
||||
}
|
||||
150
Projects/Server/Events/EventSink.cs
Normal file
150
Projects/Server/Events/EventSink.cs
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: EventSink.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
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> 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> ChatRequest;
|
||||
public static void InvokeChatRequest(Mobile m) => ChatRequest?.Invoke(m);
|
||||
|
||||
|
||||
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 WorldLoad;
|
||||
public static void InvokeWorldLoad() => WorldLoad?.Invoke();
|
||||
|
||||
public static event Action<bool> WorldSave;
|
||||
public static void InvokeWorldSave(bool sendMessage) => WorldSave?.Invoke(sendMessage);
|
||||
|
||||
public static event Action<Mobile, int> SetAbility;
|
||||
public static void InvokeSetAbility(Mobile mobile, int index) => SetAbility?.Invoke(mobile, 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)
|
||||
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);
|
||||
}
|
||||
}
|
||||
45
Projects/Server/Events/FastwalkEvent.cs
Normal file
45
Projects/Server/Events/FastwalkEvent.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: FastWalkEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class FastWalkEventArgs : EventArgs
|
||||
{
|
||||
public FastWalkEventArgs(NetState state)
|
||||
{
|
||||
NetState = state;
|
||||
Blocked = false;
|
||||
}
|
||||
|
||||
public NetState NetState{ get; }
|
||||
|
||||
public bool Blocked{ get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<FastWalkEventArgs> FastWalk;
|
||||
public static void InvokeFastWalk(FastWalkEventArgs e) => FastWalk?.Invoke(e);
|
||||
}
|
||||
}
|
||||
52
Projects/Server/Events/GameLoginEvent.cs
Normal file
52
Projects/Server/Events/GameLoginEvent.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: GameLoginEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class GameLoginEventArgs : EventArgs
|
||||
{
|
||||
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; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<GameLoginEventArgs> GameLogin;
|
||||
public static void InvokeGameLogin(GameLoginEventArgs e) => GameLogin?.Invoke(e);
|
||||
}
|
||||
}
|
||||
74
Projects/Server/Events/MovementEvent.cs
Normal file
74
Projects/Server/Events/MovementEvent.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: MovementEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class MovementEventArgs : EventArgs
|
||||
{
|
||||
private static Queue<MovementEventArgs> m_Pool = new Queue<MovementEventArgs>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<MovementEventArgs> Movement;
|
||||
public static void InvokeMovement(MovementEventArgs e) => Movement?.Invoke(e);
|
||||
}
|
||||
}
|
||||
40
Projects/Server/Events/ServerCrashedEvent.cs
Normal file
40
Projects/Server/Events/ServerCrashedEvent.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ServerCrashedEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class ServerCrashedEventArgs : EventArgs
|
||||
{
|
||||
public ServerCrashedEventArgs(Exception e) => Exception = e;
|
||||
|
||||
public Exception Exception{ get; }
|
||||
|
||||
public bool Close{ get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<ServerCrashedEventArgs> ServerCrashed;
|
||||
public static void InvokeServerCrashed(ServerCrashedEventArgs e) => ServerCrashed?.Invoke(e);
|
||||
}
|
||||
}
|
||||
63
Projects/Server/Events/ServerListEvent.cs
Normal file
63
Projects/Server/Events/ServerListEvent.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ServerListEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class ServerListEventArgs : EventArgs
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<ServerListEventArgs> ServerList;
|
||||
public static void InvokeServerList(ServerListEventArgs e) => ServerList?.Invoke(e);
|
||||
}
|
||||
}
|
||||
45
Projects/Server/Events/SocketConnectionEvent.cs
Normal file
45
Projects/Server/Events/SocketConnectionEvent.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: SocketConnectionEvent.cs *
|
||||
* Created: 2020/04/11 - Updated: 2020/04/11 *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Connections;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class SocketConnectEventArgs : EventArgs
|
||||
{
|
||||
public SocketConnectEventArgs(ConnectionContext c)
|
||||
{
|
||||
Context = c;
|
||||
AllowConnection = true;
|
||||
}
|
||||
|
||||
public ConnectionContext Context{ get; }
|
||||
|
||||
public bool AllowConnection{ get; set; }
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<SocketConnectEventArgs> SocketConnect;
|
||||
public static void InvokeSocketConnect(SocketConnectEventArgs e) => SocketConnect?.Invoke(e);
|
||||
}
|
||||
}
|
||||
46
Projects/Server/Events/SpeechEvent.cs
Normal file
46
Projects/Server/Events/SpeechEvent.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class SpeechEventArgs : EventArgs
|
||||
{
|
||||
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 (int 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;
|
||||
public static void InvokeSpeech(SpeechEventArgs e) => Speech?.Invoke(e);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue