Skip to content

Commit 3432adc

Browse files
authored
Merge pull request #329 from project-fika/1.2.6-dev
1.2.6 dev > main
2 parents 2ee0af4 + a9fc51e commit 3432adc

File tree

129 files changed

+1077
-563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1077
-563
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using Comfort.Common;
2+
using EFT;
3+
using EFT.InventoryLogic;
4+
using EFT.Quests;
5+
using Fika.Core.Coop.Players;
6+
using Fika.Core.Networking.Packets.Backend;
7+
using System.Collections.Generic;
8+
using System.Threading.Tasks;
9+
10+
namespace Fika.Core.Coop.ClientClasses
11+
{
12+
public class CoopClientQuestController(Profile profile, InventoryController inventoryController, IPlayerSearchController searchController, IQuestActions session, CoopPlayer player)
13+
: GClass3702(profile, inventoryController, searchController, session)
14+
{
15+
protected readonly CoopPlayer player = player;
16+
17+
public override async Task<GStruct455<GStruct397<QuestClass>>> FinishQuest(QuestClass quest, bool runNetworkTransaction)
18+
{
19+
List<GClass1319[]> items = [];
20+
bool hasRewards = false;
21+
if (quest.Rewards.TryGetValue(EQuestStatus.Success, out IReadOnlyList<GClass3743> list))
22+
{
23+
hasRewards = true;
24+
foreach (GClass3743 item in list)
25+
{
26+
if (item.type != ERewardType.Item)
27+
{
28+
continue;
29+
}
30+
items.Add(item.items);
31+
}
32+
}
33+
GStruct455<GStruct397<QuestClass>> finishResult = await base.FinishQuest(quest, runNetworkTransaction);
34+
if (finishResult.Succeeded && hasRewards)
35+
{
36+
InraidQuestPacket packet = new()
37+
{
38+
NetId = player.NetId,
39+
Type = InraidQuestPacket.InraidQuestType.Finish,
40+
Items = items
41+
};
42+
43+
player.PacketSender.SendPacket(ref packet);
44+
}
45+
return finishResult;
46+
}
47+
48+
public override async Task<IResult> HandoverItem(QuestClass quest, ConditionItem condition, Item[] items, bool runNetworkTransaction)
49+
{
50+
List<string> itemIds = [];
51+
bool hasNonQuestItem = false;
52+
foreach (Item item in items)
53+
{
54+
if (!item.QuestItem)
55+
{
56+
hasNonQuestItem = true;
57+
break;
58+
}
59+
}
60+
61+
if (hasNonQuestItem)
62+
{
63+
foreach (Item item in items)
64+
{
65+
if (item.QuestItem)
66+
{
67+
continue;
68+
}
69+
70+
itemIds.Add(item.Id);
71+
}
72+
}
73+
74+
IResult handoverResult = await base.HandoverItem(quest, condition, items, runNetworkTransaction);
75+
if (handoverResult.Succeed && hasNonQuestItem)
76+
{
77+
78+
InraidQuestPacket packet = new()
79+
{
80+
NetId = player.NetId,
81+
Type = InraidQuestPacket.InraidQuestType.Handover,
82+
ItemIdsToRemove = itemIds
83+
};
84+
85+
player.PacketSender.SendPacket(ref packet);
86+
}
87+
return handoverResult;
88+
}
89+
}
90+
}

Fika.Core/Coop/ClientClasses/CoopClientSharedQuestController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
namespace Fika.Core.Coop.ClientClasses
1414
{
1515
public sealed class CoopClientSharedQuestController(Profile profile, InventoryController inventoryController,
16-
IPlayerSearchController searchController, IQuestActions session, CoopPlayer player) : GClass3702(profile, inventoryController, searchController, session)
16+
IPlayerSearchController searchController, IQuestActions session, CoopPlayer player) : CoopClientQuestController(profile, inventoryController, searchController, session, player)
1717
{
18-
private readonly CoopPlayer player = player;
1918
private readonly List<string> lastFromNetwork = [];
2019
private readonly HashSet<string> acceptedTypes = [];
2120
private readonly HashSet<string> lootedTemplateIds = [];

Fika.Core/Coop/Components/BotStateManager.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using Fika.Core.Coop.GameMode;
22
using Fika.Core.Coop.Players;
3-
using Fika.Core.Jobs;
43
using Fika.Core.Networking;
54
using System.Collections.Generic;
6-
using Unity.Jobs;
75
using UnityEngine;
86

97
namespace Fika.Core.Coop.Components

Fika.Core/Coop/FreeCamera/Patches/DeathFade_Patch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using SPT.Reflection.Patching;
1+
using Fika.Core.Patching;
22
using System;
33
using System.Reflection;
44
using UnityEngine;
55

66
namespace Fika.Core.Coop.FreeCamera.Patches
77
{
8-
public class DeathFade_Patch : ModulePatch
8+
public class DeathFade_Patch : FikaPatch
99
{
1010
protected override MethodBase GetTargetMethod()
1111
{

Fika.Core/Coop/FreeCamera/Patches/FadeBlackScreen_Patch.cs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
using EFT.UI;
2-
using SPT.Reflection.Patching;
2+
using Fika.Core.Patching;
33
using System;
44
using System.Reflection;
55
using UnityEngine;
66
using UnityEngine.UI;
77

88
namespace Fika.Core.Coop.FreeCamera.Patches
99
{
10-
internal class FadeBlackScreen_Patch : ModulePatch
10+
[IgnoreAutoPatch]
11+
internal class FadeBlackScreen_Patch : FikaPatch
1112
{
12-
protected override MethodBase GetTargetMethod() => typeof(PreloaderUI).GetMethod(nameof(PreloaderUI.FadeBlackScreen));
13+
protected override MethodBase GetTargetMethod()
14+
{
15+
return typeof(PreloaderUI).GetMethod(nameof(PreloaderUI.FadeBlackScreen));
16+
}
1317

1418
[PatchPrefix]
1519
public static bool Prefix()
@@ -18,9 +22,13 @@ public static bool Prefix()
1822
}
1923
}
2024

21-
internal class StartBlackScreenShow_Patch : ModulePatch
25+
[IgnoreAutoPatch]
26+
internal class StartBlackScreenShow_Patch : FikaPatch
2227
{
23-
protected override MethodBase GetTargetMethod() => typeof(PreloaderUI).GetMethod(nameof(PreloaderUI.StartBlackScreenShow));
28+
protected override MethodBase GetTargetMethod()
29+
{
30+
return typeof(PreloaderUI).GetMethod(nameof(PreloaderUI.StartBlackScreenShow));
31+
}
2432

2533
[PatchPrefix]
2634
public static bool Prefix()
@@ -35,9 +43,13 @@ public static void Postfix(Action callback)
3543
}
3644
}
3745

38-
internal class SetBlackImageAlpha_Patch : ModulePatch
46+
[IgnoreAutoPatch]
47+
internal class SetBlackImageAlpha_Patch : FikaPatch
3948
{
40-
protected override MethodBase GetTargetMethod() => typeof(PreloaderUI).GetMethod(nameof(PreloaderUI.SetBlackImageAlpha));
49+
protected override MethodBase GetTargetMethod()
50+
{
51+
return typeof(PreloaderUI).GetMethod(nameof(PreloaderUI.SetBlackImageAlpha));
52+
}
4153

4254
[PatchPrefix]
4355
public static bool Prefix()

Fika.Core/Coop/FreeCamera/Patches/PlayEndGameSound_Patch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using EFT.UI;
22
using Fika.Core.Coop.Utils;
3-
using SPT.Reflection.Patching;
3+
using Fika.Core.Patching;
44
using System.Reflection;
55

66
namespace Fika.Core.Coop.FreeCamera.Patches
77
{
8-
public class PlayEndGameSound_Patch : ModulePatch
8+
public class PlayEndGameSound_Patch : FikaPatch
99
{
1010
protected override MethodBase GetTargetMethod()
1111
{

Fika.Core/Coop/FreeCamera/Patches/PlayUISound_Patch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using EFT.UI;
22
using Fika.Core.Coop.Utils;
3-
using SPT.Reflection.Patching;
3+
using Fika.Core.Patching;
44
using System.Reflection;
55

66
namespace Fika.Core.Coop.FreeCamera.Patches
77
{
8-
public class PlayUISound_Patch : ModulePatch
8+
public class PlayUISound_Patch : FikaPatch
99
{
1010
protected override MethodBase GetTargetMethod()
1111
{

Fika.Core/Coop/GameMode/CoopGame.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
using Fika.Core.Coop.FreeCamera;
3030
using Fika.Core.Coop.HostClasses;
3131
using Fika.Core.Coop.ObservedClasses;
32-
using Fika.Core.Coop.ObservedClasses.Snapshotting;
33-
using Fika.Core.Coop.PacketHandlers;
3432
using Fika.Core.Coop.Patches;
3533
using Fika.Core.Coop.Players;
3634
using Fika.Core.Coop.Utils;
@@ -639,7 +637,7 @@ public override IEnumerator vmethod_2()
639637

640638
server.SendDataToAll(ref packet, DeliveryMethod.ReliableOrdered);
641639
HostLootItems = null;
642-
}
640+
}
643641

644642
DateTime dateTime = EFTDateTimeClass.Now.AddSeconds(timeBeforeDeployLocal);
645643
new MatchmakerFinalCountdown.FinalCountdownScreenClass(Profile_0, dateTime).ShowScreen(EScreenState.Root);
@@ -728,7 +726,7 @@ private async Task CreateStashes()
728726
Logger.LogError("Could not find CoopHandler when trying to initialize player stashes for TransferItemsController!");
729727
}
730728

731-
729+
732730
}
733731

734732
private void SyncTransitControllers()
@@ -1208,16 +1206,16 @@ public async Task InitPlayer(BotControllerSettings botsSettings, string backendU
12081206
}
12091207
else
12101208
{
1211-
BackendConfigSettingsClass.GClass1506 runddansSettings = instance.runddansSettings;
1209+
BackendConfigSettingsClass.GClass1510 runddansSettings = instance.runddansSettings;
12121210
runddansActive = runddansSettings != null && runddansSettings.active;
12131211
}
12141212
if (runddansActive)
12151213
{
1216-
gameWorld.RunddansController = new GClass2046(instance.runddansSettings, Location_0);
1214+
gameWorld.RunddansController = new GClass2052 (instance.runddansSettings, Location_0);
12171215
}
12181216
else
12191217
{
1220-
GClass2045.ToggleEventEnvironment(false);
1218+
GClass2050.ToggleEventEnvironment(false);
12211219
}*/
12221220

12231221
GClass2050.ToggleEventEnvironment(false);
@@ -1249,7 +1247,7 @@ public async Task InitPlayer(BotControllerSettings botsSettings, string backendU
12491247
throw;
12501248
}
12511249

1252-
await WaitForHostToStart();
1250+
await WaitForHostToStart();
12531251

12541252
LocationSettingsClass.Location location = localRaidSettings_0.selectedLocation;
12551253
if (isServer)

Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ public void HandleShotInfoPacket(ref ShotInfoPacket packet, InventoryController
385385
{
386386
if (packet.ShotType == EShotType.DryFire)
387387
{
388+
if (IsRevolver)
389+
{
390+
Weapon.CylinderHammerClosed = Weapon.FireMode.FireMode == Weapon.EFireMode.doubleaction;
391+
}
388392
FirearmsAnimator.SetFire(true);
389393
DryShot();
390394
hasFired = true;
@@ -657,11 +661,11 @@ private void HandleObservedShot(ref ShotInfoPacket packet, InventoryController i
657661
FirearmsAnimator.SetCamoraIndex(cylinderMagazine.CurrentCamoraIndex);
658662
FirearmsAnimator.SetDoubleAction(Convert.ToSingle(Weapon.CylinderHammerClosed));
659663
FirearmsAnimator.SetHammerArmed(!Weapon.CylinderHammerClosed);
660-
weaponManager.MoveAmmoFromChamberToShellPort(cylinderAmmo.IsUsed, firstIndex);
664+
weaponManager.MoveAmmoFromChamberToShellPort(true, firstIndex);
661665

662666
FirearmsAnimator.SetAmmoOnMag(cylinderMagazine.Count);
663667

664-
if (cylinderMagazine.Cartridges.Count > 0)
668+
if (cylinderMagazine.Count > 0)
665669
{
666670
Weapon.CylinderHammerClosed = Weapon.FireMode.FireMode == Weapon.EFireMode.doubleaction;
667671
}

0 commit comments

Comments
 (0)