Skip to content

Commit

Permalink
Release v0.1.0.0. Split ClassLimiter handler from behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
Byak0 committed Apr 5, 2024
1 parent 97f755d commit f95a7c4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Alliance.Client/_Module/SubModule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Module>
<Id value="Alliance" />
<Name value="Alliance" />
<Version value="v0.0.9.9" />
<Version value="v0.1.0.0" />
<ModuleCategory value="Multiplayer" />
<DependedModules>
<DependedModule Id="Native" />
Expand Down
2 changes: 1 addition & 1 deletion Alliance.Common/CommonProps.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<AllianceVersion>0.0.9.9</AllianceVersion>
<AllianceVersion>0.1.0.0</AllianceVersion>
</PropertyGroup>
</Project>
2 changes: 2 additions & 0 deletions Alliance.Common/Extensions/IHandlerRegister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ namespace Alliance.Common.Extensions
{
/// <summary>
/// Implement this interface in your extension if you need to register network messages handlers.
/// Your class will be instantiated automatically and the Register method will be called.
/// /!\ Do not use directly on a MissionBehavior as it will cause unwanted instantiation.
/// </summary>
public interface IHandlerRegister
{
Expand Down
2 changes: 1 addition & 1 deletion Alliance.Editor/_Module/SubModule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Module>
<Id value="Alliance.Editor" />
<Name value="Alliance.Editor" />
<Version value="v0.0.9.9" />
<Version value="v0.1.0.0" />
<ModuleCategory value="Singleplayer" />
<DependedModules>
<DependedModule Id="Native" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Alliance.Server.Extensions.ClassLimiter.Behaviors
{
public class ClassLimiterBehavior : MissionNetwork, IHandlerRegister
public class ClassLimiterBehavior : MissionNetwork
{
private MultiplayerRoundController _roundController;

Expand Down Expand Up @@ -51,20 +51,5 @@ private void OnRoundStart()
// Refresh class limits on every round
ClassLimiterModel.Instance.Init();
}

public void Register(GameNetwork.NetworkMessageHandlerRegisterer reg)
{
reg.Register<RequestCharacterUsage>(HandleRequestUsage);
}

public bool HandleRequestUsage(NetworkCommunicator peer, RequestCharacterUsage message)
{
// DEBUG test
//foreach (BasicCharacterObject character in MBObjectManager.Instance.GetObjectTypeList<BasicCharacterObject>())
//{
// ClassLimiterModel.Instance.TryReserveCharacterSlot(character);
//}
return ClassLimiterModel.Instance.HandleRequestUsage(peer, message);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Alliance.Common.Extensions;
using Alliance.Common.Extensions.ClassLimiter.Models;
using Alliance.Common.Extensions.ClassLimiter.NetworkMessages.FromClient;
using TaleWorlds.MountAndBlade;

namespace Alliance.Server.Extensions.ClassLimiter.Handlers
{
public class ClassLimiterHandler : IHandlerRegister
{
public void Register(GameNetwork.NetworkMessageHandlerRegisterer reg)
{
reg.Register<RequestCharacterUsage>(ClassLimiterModel.Instance.HandleRequestUsage);
}
}
}
2 changes: 1 addition & 1 deletion Alliance.Server/_Module/SubModule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Module>
<Id value="Alliance" />
<Name value="Alliance" />
<Version value="v0.0.9.9" />
<Version value="v0.1.0.0" />
<ModuleCategory value="Multiplayer" />
<DependedModules>
<DependedModule Id="Native" />
Expand Down

0 comments on commit f95a7c4

Please sign in to comment.