Skip to content

Commit

Permalink
feat: Moves network related events to UOContent using code generation (
Browse files Browse the repository at this point in the history
…#1945)

### Summary
- Moves `CharacterCreated` event to UOContent using code generated event _CharacterCreatedEvent_.
- Moves `TargetByResourceMacro` event to UOContent using code generated event _TargetByResourceMacro_.
- Moves `GameLogin` event to UOContent using code generated event _GameLoginEvent_.
- Moves `ServerList` event to UOContent using code generated event _ServerListEvent_.
- Streamlines ProfessionInfo


> [!IMPORTANT]
> **Developer Note**
> Custom scripts that use any of these event sinks will need to be updated to use the new code generated events.
  • Loading branch information
kamronbatman authored Sep 6, 2024
1 parent 4110556 commit 47e16a0
Show file tree
Hide file tree
Showing 14 changed files with 208 additions and 310 deletions.
93 changes: 0 additions & 93 deletions Projects/Server/Events/CharacterCreatedEvent.cs

This file was deleted.

5 changes: 0 additions & 5 deletions Projects/Server/Events/EventSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,4 @@ public static void InvokePaperdollRequest(Mobile beholder, Mobile beheld) =>

public static event Action ServerStarted;
public static void InvokeServerStarted() => ServerStarted?.Invoke();

public static event Action<Mobile, Item, short> TargetByResourceMacro;

public static void InvokeTargetByResourceMacro(Mobile m, Item item, short resourceType) =>
TargetByResourceMacro?.Invoke(m, item, resourceType);
}
48 changes: 0 additions & 48 deletions Projects/Server/Events/GameLoginEvent.cs

This file was deleted.

59 changes: 0 additions & 59 deletions Projects/Server/Events/ServerListEvent.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Projects/Server/Mobiles/Mobile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class DamageEntry
}

[Flags]
public enum StatType
public enum StatType : byte
{
Str = 1,
Dex = 2,
Expand Down
6 changes: 4 additions & 2 deletions Projects/UOContent/Accounting/AccountHandler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Net;
using ModernUO.CodeGeneratedEvents;
using Server.Accounting;
using Server.Engines.CharacterCreation;
using Server.Engines.Help;
using Server.Logging;
using Server.Network;
Expand Down Expand Up @@ -65,7 +67,6 @@ public static void Configure()
public static void Initialize()
{
EventSink.AccountLogin += EventSink_AccountLogin;
EventSink.GameLogin += EventSink_GameLogin;
}

[Usage("Password <newPassword> <repeatPassword>")]
Expand Down Expand Up @@ -348,7 +349,8 @@ public static void EventSink_AccountLogin(AccountLoginEventArgs e)
}
}

public static void EventSink_GameLogin(GameLoginEventArgs e)
[OnEvent(nameof(GameServer.GameServerLoginEvent))]
public static void OnGameServerLogin(GameServer.GameLoginEventArgs e)
{
var un = e.Username;
var pw = e.Password;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Server.Accounting;
using Server.Network;

namespace Server.Engines.CharacterCreation;

Check notice on line 4 in Projects/UOContent/Engines/Character Creation/CharacterCreatedEvent.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Namespace does not correspond to file location

Namespace does not correspond to file location, must be: 'Server.Engines.Character_Creation'

public class CharacterCreatedEventArgs(
NetState state, IAccount a, string name, bool female,
int hue, byte[] stats, CityInfo city, (SkillName, byte)[] skills,
int shirtHue, int pantsHue, int hairId, int hairHue,
int beardId, int beardHue, int profession, Race race
)
{
public NetState State { get; } = state;

public IAccount Account { get; } = a;

public Mobile Mobile { get; set; }

public string Name { get; } = name;

public bool Female { get; } = female;

public int Hue { get; } = hue;

public byte[] Stats { get; } = stats;

public CityInfo City { get; } = city;

public (SkillName, byte)[] Skills { get; } = skills;

public int ShirtHue { get; } = shirtHue;

public int PantsHue { get; } = pantsHue;

public int HairID { get; } = hairId;

public int HairHue { get; } = hairHue;

public int BeardID { get; } = beardId;

public int BeardHue { get; } = beardHue;

public int Profession { get; set; } = profession;

public Race Race { get; } = race;
}
Loading

0 comments on commit 47e16a0

Please sign in to comment.