From 916756bf194dd4519204583e9bbfc703bbb9dfe1 Mon Sep 17 00:00:00 2001 From: CWX Date: Thu, 23 Jan 2025 11:23:48 +0000 Subject: [PATCH] work around to allow two different types of callbacks for the same one --- Libraries/Core/Helpers/InventoryHelper.cs | 2 +- Libraries/Core/Helpers/ItemHelper.cs | 2 +- Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Libraries/Core/Helpers/InventoryHelper.cs b/Libraries/Core/Helpers/InventoryHelper.cs index 04f40e0f..ab3cad3b 100644 --- a/Libraries/Core/Helpers/InventoryHelper.cs +++ b/Libraries/Core/Helpers/InventoryHelper.cs @@ -130,7 +130,7 @@ public class InventoryHelper( try { if (request.Callback is not null) - request.Callback(rootItemToAdd.Upd.StackObjectsCount.Value); + request.Callback(rootItemToAdd.Upd.StackObjectsCount.Value, null, null, null); } catch (Exception ex) { diff --git a/Libraries/Core/Helpers/ItemHelper.cs b/Libraries/Core/Helpers/ItemHelper.cs index 947987d1..57bb05d6 100644 --- a/Libraries/Core/Helpers/ItemHelper.cs +++ b/Libraries/Core/Helpers/ItemHelper.cs @@ -373,7 +373,7 @@ public class ItemHelper( // found in the handbook. If the price can't be found at all return 0 // @param List tpls item tpls to look up the price of // @returns Total price in roubles - public decimal GetItemAndChildrenPrice(List tpls) + public double GetItemAndChildrenPrice(List tpls) { // Run getItemPrice for each tpl in tpls array, return sum return tpls.Aggregate(0, (total, tpl) => total + (int)GetItemPrice(tpl)); diff --git a/Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs b/Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs index 2804d64d..572d42fc 100644 --- a/Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs +++ b/Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs @@ -1,5 +1,7 @@ using System.Text.Json.Serialization; +using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; +using Core.Models.Eft.Trade; namespace Core.Models.Eft.Inventory; @@ -15,7 +17,7 @@ public record AddItemDirectRequest public bool? FoundInRaid { get; set; } [JsonPropertyName("callback")] - public Action? Callback { get; set; } + public Action? Callback { get; set; } [JsonPropertyName("useSortingTable")] public bool? UseSortingTable { get; set; }