Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Map Event Sync (Includes MapEvents, recruitment, prisoners) #717

Draft
wants to merge 104 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
61d6293
Troop Purchase synced
EgardA Jul 5, 2023
3747ab0
Party recruitment synced
EgardA Jul 6, 2023
9c7694e
Merge branch 'development' into MainPartyTroopRecruitment
garrettluskey Jul 10, 2023
090c5c1
Updated as per comments
EgardA Jul 10, 2023
31b69cf
comment updates
EgardA Jul 11, 2023
b8fa9ed
Update MobilePartyRecruitmentHandler.cs
EgardA Jul 14, 2023
811c45b
Merge branch 'development' into MainPartyTroopRecruitment
EgardA Sep 26, 2023
0910c09
Merge branch 'development' into MainPartyTroopRecruitment
EgardA Dec 26, 2023
2758b9a
Merge branch 'development' into MainPartyTroopRecruitment
EgardA Dec 26, 2023
90a2cbd
Update ClientMobilePartyRecruitmentHandler.cs
EgardA Dec 26, 2023
8054e6d
Merge branch 'development' into MainPartyTroopRecruitment
EgardA Jan 2, 2024
8c5d681
TroopRecruitment works
EgardA Jan 6, 2024
8fd0057
Cleaned up
EgardA Jan 6, 2024
8ddcc04
Tests
EgardA Jan 8, 2024
ff93f55
Update .gitignore
EgardA Jan 14, 2024
26933ae
Merge branch 'development' into MainPartyTroopRecruitment
garrettluskey Jan 16, 2024
031018a
Merge branch 'development' into MainPartyTroopRecruitment
EgardA Jan 16, 2024
66bf0df
Revert "Update .gitignore"
EgardA Jan 16, 2024
0fbfa49
Updates
EgardA Jan 16, 2024
353a600
Merge branch 'development' into MainPartyTroopRecruitment
EgardA Jan 17, 2024
2128cec
Merge branch 'development' into MainPartyTroopRecruitment
EgardA Jan 17, 2024
cf9674b
Merge branch 'development' into MainPartyTroopRecruitment
EgardA Jan 22, 2024
04a96db
Updated
EgardA Jan 22, 2024
783232e
Fix
EgardA Jan 22, 2024
9f6962f
Issues remaining
EgardA Dec 27, 2023
ce66c83
Worked just before, not now
EgardA Dec 30, 2023
e06ddf5
Works now, kind of
EgardA Dec 30, 2023
841227f
Enable bandit conversations
EgardA Dec 30, 2023
753b122
some additional routing, end battle still not working
EgardA Dec 30, 2023
690501e
End functionality, some issues remain
EgardA Dec 30, 2023
77f3cbb
MapEvent End Fixes
EgardA Dec 30, 2023
1279e94
Disable Player-Player interaction
EgardA Dec 31, 2023
f668f77
Cleaned up
EgardA Jan 2, 2024
dfbb38e
Simplification
EgardA Jan 2, 2024
87ba6cd
Cleaned up
EgardA Jan 7, 2024
8eee187
Delete ComputeIsWaitingPatch - Copy - Copy.cs
EgardA Jan 7, 2024
d8cc4e2
Create MapEventTests.cs
EgardA Jan 8, 2024
ccd9c04
Updated according to comments
EgardA Jan 9, 2024
ec8094d
Create DisableSiegeMapEvent.cs
EgardA Jan 17, 2024
bebd6d1
Improved MapEvents
EgardA Jan 17, 2024
b445ec3
Revert "Merge branch 'MainPartyTroopRecruitment' into MapEventSync"
EgardA Jan 17, 2024
b8ca5e2
Fixed PrisonRoster updating crash
EgardA Jan 17, 2024
445ae99
Some updates
EgardA Jan 17, 2024
14ebc20
Updated tests
EgardA Jan 17, 2024
5f58e37
Revert "Merge branch 'MainPartyTroopRecruitment' into MapEventSync"
EgardA Jan 17, 2024
aa39fe3
Current
EgardA Jan 17, 2024
a6040e2
TroopRoster Import
EgardA Jan 17, 2024
f61b8ee
Reworked TroopRecruitment, not fully functional yet
EgardA Jan 18, 2024
9b33820
Works
EgardA Jan 19, 2024
1381e9e
DisabledXPGain
EgardA Jan 20, 2024
096517b
TakePrisoner
EgardA Jan 20, 2024
a8e1d14
Some stuff
EgardA Jan 20, 2024
fad44fc
Fixed some bad commits
EgardA Jan 20, 2024
9558338
Updated old Clan Patches
EgardA Jan 20, 2024
63a9211
updates
EgardA Jan 22, 2024
13f948e
Split Troop Recruitment into separate branch
EgardA Jan 22, 2024
78aceae
Revert "Split Troop Recruitment into separate branch"
EgardA Jan 22, 2024
6866af5
Update GameInterfaceModule.cs
EgardA Jan 22, 2024
d643abe
Update GameInterfaceModule.cs
EgardA Jan 22, 2024
193ca01
Update ObjectManager.cs
EgardA Jan 26, 2024
8f4cc32
Fixed shenanigans
EgardA Jan 26, 2024
b4d2a3d
Update PlayerEncounterPatches.cs
EgardA Jan 26, 2024
0d85e16
Update ItemRosterPatch.cs
EgardA Jan 26, 2024
ef10136
Revert "Update PlayerEncounterPatches.cs"
EgardA Jan 26, 2024
f4c6165
Back to functional
EgardA Jan 26, 2024
f446d72
Updates
EgardA Jan 30, 2024
d0f5d0c
Fixed and updated naming
EgardA Jan 31, 2024
3941960
SurrenderAlmostFunctional
EgardA Feb 4, 2024
ece72b2
Update SurrenderPatch.cs
EgardA Feb 4, 2024
7c4a821
Revert "Update SurrenderPatch.cs"
EgardA Feb 4, 2024
09da752
Revert "Revert "Update SurrenderPatch.cs""
EgardA Feb 4, 2024
597d1bc
Surrender functional (with bug)
EgardA Feb 5, 2024
c7a36a7
Create PlayerEscapeHandler.cs
EgardA Feb 5, 2024
db97860
Merge branch 'development' into MapEventSync
EgardA Feb 16, 2024
bdd90da
Fixed Patches for rebase
EgardA Feb 16, 2024
ed4e4b0
Merge branch 'development' into MapEventSync
EgardA Feb 22, 2024
9bb9669
fix all crash relate to mobile party
thomas-soutif Feb 24, 2024
f2a2582
Merge branch '766-report-mobile-party-sync-conflict-between-2-modules…
EgardA Mar 1, 2024
3a42d25
Merge branch 'development' into MapEventSync
EgardA Mar 5, 2024
b3b30a7
Merge branch 'development' into MapEventSync
EgardA Mar 6, 2024
5a9bd75
Merge branch 'development' into MapEventSync
EgardA Mar 6, 2024
bb39fb0
Merge branch 'development' into MapEventSync
EgardA Mar 6, 2024
4018f73
Merge branch 'development' into MapEventSync
EgardA Mar 6, 2024
8745073
Updated to follow development(?)
EgardA Mar 6, 2024
1de4a71
Merge branch 'development' into MapEventSync
EgardA Apr 2, 2024
c556433
Update ChangeOwnerOfSettlementPatch.cs
EgardA Apr 2, 2024
d469eae
disabled problematic patch
garrettluskey Apr 5, 2024
8a9042d
Updated to work with surrender (not completely)
EgardA Apr 7, 2024
04f8bd4
Merge branch 'development' into MapEventSync
EgardA Apr 13, 2024
27d7a13
removed old allowed instance
garrettluskey Apr 13, 2024
a888561
updated patches to be more robust
garrettluskey Apr 13, 2024
7eab576
Merge branch 'development' into MapEventSync
EgardA May 12, 2024
30ccf21
Merge branch 'development' into MapEventSync
EgardA May 13, 2024
da16e9d
Changes
EgardA May 23, 2024
85a89a2
Merge branch 'development' into MapEventSync
EgardA May 24, 2024
a4af735
Merge branch 'development' into MapEventSync
EgardA Jun 10, 2024
750481c
Functional tests, non functional game
EgardA Jun 10, 2024
8a6076e
Merge branch 'party-component-sync-fix' into MapEventSync
garrettluskey Jun 12, 2024
68966ff
Merge branch 'party-component-sync-fix' into MapEventSync
garrettluskey Jun 12, 2024
075462c
Merge branch 'party-component-sync-fix' into MapEventSync
garrettluskey Jun 13, 2024
984221e
Client was ticking
EgardA Jun 13, 2024
4d24806
Merge branch 'development' into MapEventSync
EgardA Jul 29, 2024
3d0b419
Delete ClanDestroyPatch.cs
EgardA Jul 29, 2024
87b7a7e
Update DisableBanditsCampaignBehavior.cs
EgardA Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Common.Tests.Utils
{
public class AllowedInstanceTests
public class AllowedThreadTests
{
[Fact]
public void AllowedInstance_DoesNotAllowChange()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Common.Messaging;
using Common.Network;
using Coop.Core.Client.Services.Heroes.Messages;
using Coop.Core.Server.Services.Heroes.Messages;
using GameInterface.Services.Heroes.Messages;

namespace Coop.Core.Client.Services.MobileParties.Handlers
{
public class ClientPlayerEscapeCaptivityHandler : IHandler
{
private readonly IMessageBroker messageBroker;
private readonly INetwork network;

public ClientPlayerEscapeCaptivityHandler(IMessageBroker messageBroker, INetwork network)
{
this.messageBroker = messageBroker;
this.network = network;

messageBroker.Subscribe<LocalPlayerEscaped>(Handle);
messageBroker.Subscribe<NetworkPlayerEscapeApproved>(Handle);
}

public void Dispose()
{
messageBroker.Unsubscribe<LocalPlayerEscaped>(Handle);
messageBroker.Unsubscribe<NetworkPlayerEscapeApproved>(Handle);
}

private void Handle(MessagePayload<LocalPlayerEscaped> obj)
{
var payload = obj.What;

network.SendAll(new NetworkPlayerEscapeRequest(payload.HeroId));
}
private void Handle(MessagePayload<NetworkPlayerEscapeApproved> obj)
{
var payload = obj.What;

messageBroker.Publish(this, new EscapePlayer(payload.HeroId));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Common.Messaging;
using Common.Network;
using Coop.Core.Client.Services.Heroes.Messages;
using Coop.Core.Server.Services.Heroes.Messages;
using GameInterface.Services.Heroes.Messages;

namespace Coop.Core.Client.Services.Heroes.Handler
{
/// <summary>
/// Handles all releases of prisoners on client
/// </summary>
public class ClientReleasePrisonerHandler : IHandler
{
private readonly IMessageBroker messageBroker;
private readonly INetwork network;

public ClientReleasePrisonerHandler(IMessageBroker messageBroker, INetwork network)
{
this.messageBroker = messageBroker;
this.network = network;

messageBroker.Subscribe<PrisonerReleased>(Handle);
messageBroker.Subscribe<NetworkReleasePrisonerApproved>(Handle);
}
public void Dispose()
{
messageBroker.Unsubscribe<PrisonerReleased>(Handle);
messageBroker.Unsubscribe<NetworkReleasePrisonerApproved>(Handle);
}

private void Handle(MessagePayload<PrisonerReleased> obj)
{
var payload = obj.What;

network.SendAll(new NetworkReleasePrisonerRequest(payload.HeroId, payload.EndCaptivityDetail, payload.FacilitatorId));
}

private void Handle(MessagePayload<NetworkReleasePrisonerApproved> obj)
{
var payload = obj.What;

messageBroker.Publish(this, new ReleasePrisoner(payload.HeroId, payload.EndCaptivityDetail, payload.FacilitatorId));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Common.Messaging;
using Common.Network;
using Coop.Core.Client.Services.Heroes.Messages;
using Coop.Core.Server.Services.Heroes.Messages;
using GameInterface.Services.Heroes.Messages;

namespace Coop.Core.Client.Services.Heroes.Handler
{
/// <summary>
/// Handles all captures of prisoners on client
/// </summary>
public class ClientTakePrisonerHandler : IHandler
{
private readonly IMessageBroker messageBroker;
private readonly INetwork network;

public ClientTakePrisonerHandler(IMessageBroker messageBroker, INetwork network)
{
this.messageBroker = messageBroker;
this.network = network;

messageBroker.Subscribe<PrisonerTaken>(Handle);
messageBroker.Subscribe<NetworkTakePrisonerApproved>(Handle);
}
public void Dispose()
{
messageBroker.Unsubscribe<PrisonerTaken>(Handle);
messageBroker.Unsubscribe<NetworkTakePrisonerApproved>(Handle);
}

private void Handle(MessagePayload<PrisonerTaken> obj)
{
var payload = obj.What;

network.SendAll(new NetworkTakePrisonerRequest(payload.PartyId, payload.CharacterId, payload.IsEventCalled));
}

private void Handle(MessagePayload<NetworkTakePrisonerApproved> obj)
{
var payload = obj.What;

messageBroker.Publish(this, new TakePrisoner(payload.PartyId, payload.CharacterId, payload.IsEventCalled));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Common.Messaging;
using ProtoBuf;

namespace Coop.Core.Client.Services.Heroes.Messages
{
/// <summary>
/// Request from client to server for player escape
/// </summary>
[ProtoContract(SkipConstructor = true)]
public record NetworkPlayerEscapeRequest : ICommand
{
[ProtoMember(1)]
public string HeroId { get; }

public NetworkPlayerEscapeRequest(string heroId)
{
HeroId = heroId;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Common.Messaging;
using ProtoBuf;
#nullable enable

namespace Coop.Core.Client.Services.Heroes.Messages
{
/// <summary>
/// Request from client to server to release prisoner
/// </summary>
[ProtoContract(SkipConstructor = true)]
public record NetworkReleasePrisonerRequest : ICommand
{
[ProtoMember(1)]
public string HeroId { get; }
[ProtoMember(2)]
public int EndCaptivityDetail { get; }
[ProtoMember(3)]
public string? FacilitatorId { get; }

public NetworkReleasePrisonerRequest(string heroId, int endCaptivityDetail, string? facilitatorId)
{
HeroId = heroId;
EndCaptivityDetail = endCaptivityDetail;
FacilitatorId = facilitatorId;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Common.Messaging;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.Text;

namespace Coop.Core.Client.Services.Heroes.Messages
{
/// <summary>
/// Request from client to server to take prisoner
/// </summary>
[ProtoContract(SkipConstructor = true)]
public record NetworkTakePrisonerRequest : ICommand
{
[ProtoMember(1)]
public string PartyId { get; }
[ProtoMember(2)]
public string CharacterId { get; }
[ProtoMember(3)]
public bool IsEventCalled { get; }

public NetworkTakePrisonerRequest(string partyId, string characterId, bool isEventCalled)
{
PartyId = partyId;
CharacterId = characterId;
IsEventCalled = isEventCalled;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Common.Logging;
using Common.Messaging;
using Common.Network;
using Coop.Core.Client.Services.MapEvent.Messages;
using Coop.Core.Server.Services.MapEvent.Messages;
using GameInterface.Services.MapEvents.Messages;
using Serilog;

namespace Coop.Core.Client.Services.MapEvent.Handlers
{
/// <summary>
/// Client handler for Ending Map Events
/// </summary>
public class ClientEndBattleHandler : IHandler
{
private readonly ILogger Logger = LogManager.GetLogger<ClientEndBattleHandler>();

private readonly IMessageBroker messageBroker;
private readonly INetwork network;

public ClientEndBattleHandler(IMessageBroker messageBroker, INetwork network)
{
this.messageBroker = messageBroker;
this.network = network;

messageBroker.Subscribe<BattleEnded>(Handle);
messageBroker.Subscribe<NetworkEndBattleApproved>(Handle);
}

public void Dispose()
{
messageBroker.Subscribe<BattleEnded>(Handle);
messageBroker.Unsubscribe<NetworkEndBattleApproved>(Handle);
}
private void Handle(MessagePayload<BattleEnded> obj)
{
var payload = obj.What;

network.SendAll(new NetworkBattleEndedRequest(payload.partyId));
}

private void Handle(MessagePayload<NetworkEndBattleApproved> obj)
{
var payload = obj.What;

messageBroker.Publish(this, new EndBattle(payload.partyId));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Common.Logging;
using Common.Messaging;
using Common.Network;
using Coop.Core.Client.Services.MapEvent.Messages;
using Coop.Core.Server.Services.MapEvent.Messages;
using GameInterface.Services.MapEvents.Messages;
using Serilog;

namespace Coop.Core.Client.Services.MapEvent.Handlers
{
/// <summary>
/// Client handler for Starting Map Events
/// </summary>
public class ClientStartBattleHandler : IHandler
{
private readonly ILogger Logger = LogManager.GetLogger<ClientStartBattleHandler>();

private readonly IMessageBroker messageBroker;
private readonly INetwork network;

public ClientStartBattleHandler(IMessageBroker messageBroker, INetwork network)
{
this.messageBroker = messageBroker;
this.network = network;

messageBroker.Subscribe<BattleStarted>(Handle);
messageBroker.Subscribe<NetworkStartBattleApproved>(Handle);
}

public void Dispose()
{
messageBroker.Unsubscribe<BattleStarted>(Handle);
messageBroker.Unsubscribe<NetworkStartBattleApproved>(Handle);
}
private void Handle(MessagePayload<BattleStarted> obj)
{
var payload = obj.What;

network.SendAll(new NetworkBattleStartedRequest(
payload.attackerPartyId,
payload.defenderPartyId));
}
private void Handle(MessagePayload<NetworkStartBattleApproved> obj)
{
var payload = obj.What;

messageBroker.Publish(this, new StartBattle(
payload.attackerPartyId,
payload.defenderPartyId));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Common.Messaging;
using Common.PacketHandlers;
using ProtoBuf;

namespace Coop.Core.Client.Services.MapEvent.Messages
{
/// <summary>
/// Request from client to server to end battle
/// </summary>
[ProtoContract(SkipConstructor = true)]
public record NetworkBattleEndedRequest : ICommand
{
[ProtoMember(1)]
public string partyId { get; }

public NetworkBattleEndedRequest(string partyId)
{
this.partyId = partyId;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Common.Messaging;
using Common.PacketHandlers;
using ProtoBuf;

namespace Coop.Core.Client.Services.MapEvent.Messages
{
/// <summary>
/// Request from client to server to start battle
/// </summary>
[ProtoContract(SkipConstructor = true)]
public record NetworkBattleStartedRequest : ICommand
{
[ProtoMember(1)]
public string attackerPartyId { get; }
[ProtoMember(2)]
public string defenderPartyId { get; }

public NetworkBattleStartedRequest(string attackerPartyId, string defenderPartyId)
{
this.attackerPartyId = attackerPartyId;
this.defenderPartyId = defenderPartyId;
}
}
}
Loading