Skip to content

Commit

Permalink
Further WIP to shared quest progression
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jun 13, 2024
1 parent ab7cb2d commit 510bb1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Fika.Core/Coop/ClientClasses/CoopSharedQuestController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public sealed class CoopSharedQuestController(Profile profile, InventoryControll
{
private readonly CoopPlayer player = player;
private readonly List<string> lastFromNetwork = [];
private readonly List<string> acceptedTypes = ["Kill", "Hit", "InZone", "Location"];

public override void OnConditionValueChanged(IConditionCounter conditional, EQuestStatus status, Condition condition, bool notify = true)
{
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit 510bb1b

Please sign in to comment.