From 510bb1b4cc44bfb0f0e604720af52f92111ddd2b Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:03:46 +0200 Subject: [PATCH] Further WIP to shared quest progression --- Fika.Core/Coop/ClientClasses/CoopSharedQuestController.cs | 6 ++++++ .../Packets/Communication/QuestConditionPacket.cs | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/Fika.Core/Coop/ClientClasses/CoopSharedQuestController.cs b/Fika.Core/Coop/ClientClasses/CoopSharedQuestController.cs index 63d74f54..f2e035d6 100644 --- a/Fika.Core/Coop/ClientClasses/CoopSharedQuestController.cs +++ b/Fika.Core/Coop/ClientClasses/CoopSharedQuestController.cs @@ -11,6 +11,7 @@ public sealed class CoopSharedQuestController(Profile profile, InventoryControll { private readonly CoopPlayer player = player; private readonly List lastFromNetwork = []; + private readonly List acceptedTypes = ["Kill", "Hit", "InZone", "Location"]; public override void OnConditionValueChanged(IConditionCounter conditional, EQuestStatus status, Condition condition, bool notify = true) { @@ -54,6 +55,11 @@ internal void ReceiveQuestPacket(ref QuestConditionPacket packet) GClass3242 counter = quest.ConditionCountersManager.GetCounter(packet.Id); if (counter != null) { + if (!acceptedTypes.Contains(counter.Type)) + { + return; + } + counter.Value++; NotificationManagerClass.DisplayMessageNotification($"Received shared quest progression from {packet.Nickname}", iconType: EFT.Communications.ENotificationIconType.Quest); diff --git a/Fika.Core/Networking/Packets/Communication/QuestConditionPacket.cs b/Fika.Core/Networking/Packets/Communication/QuestConditionPacket.cs index 24e1309e..c1a9ded0 100644 --- a/Fika.Core/Networking/Packets/Communication/QuestConditionPacket.cs +++ b/Fika.Core/Networking/Packets/Communication/QuestConditionPacket.cs @@ -7,17 +7,22 @@ public struct QuestConditionPacket(string nickname, string id, string sourceId) public string Nickname = nickname; public string Id = id; public string SourceId = sourceId; + public string ItemId; public void Deserialize(NetDataReader reader) { + Nickname = reader.GetString(); Id = reader.GetString(); SourceId = reader.GetString(); + ItemId = reader.GetString(); } public void Serialize(NetDataWriter writer) { + writer.Put(Nickname); writer.Put(Id); writer.Put(SourceId); + writer.Put(ItemId); } } }