chore: changed the access level of some functions
This commit is contained in:
parent
db4003caa7
commit
7734090feb
|
@ -15,9 +15,15 @@ namespace LootValueEX.Extensions
|
|||
/// </summary>
|
||||
/// <param name="item">The item to check.</param>
|
||||
/// <returns>True if the item has been examined, false otherwise.</returns>
|
||||
internal static bool IsExamined(this Item? item) => item != null && ClientAppUtils.GetMainApp().GetClientBackEndSession().Profile.Examined(item);
|
||||
internal static bool IsStacked(this Item? item) => item != null && (item.StackObjectsCount > 1 || item.UnlimitedCount);
|
||||
internal static string PrehashTemplate(this Item? item) => string.Format("{0}|{1}|{2}", item?.TemplateId, item.GetDurability(), item.GetUses());
|
||||
internal static bool IsExamined(this Item? item) => item != null &&
|
||||
ClientAppUtils.GetMainApp().GetClientBackEndSession()
|
||||
.Profile.Examined(item);
|
||||
|
||||
internal static bool IsStacked(this Item? item) =>
|
||||
item != null && (item.StackObjectsCount > 1 || item.UnlimitedCount);
|
||||
|
||||
internal static string PrehashTemplate(this Item? item) =>
|
||||
string.Format("{0}|{1}|{2}", item?.TemplateId, item.GetDurability(), item.GetUses());
|
||||
|
||||
internal static Item? UnstackItem(this Item? item)
|
||||
{
|
||||
|
@ -31,7 +37,7 @@ namespace LootValueEX.Extensions
|
|||
itemClone.StackObjectsCount = 1;
|
||||
itemClone.UnlimitedCount = false;
|
||||
return itemClone;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the value of a specific attribute from an item.
|
||||
|
@ -73,10 +79,13 @@ namespace LootValueEX.Extensions
|
|||
MagazineTemplate magTemplate = (MagazineTemplate)item.Template;
|
||||
magTemplate.Cartridges.DoMap(s => s.Items.DoMap(i => prehashString.Append(i.PrehashTemplate())));
|
||||
}
|
||||
|
||||
prehashString.Append(item.PrehashTemplate());
|
||||
return await Task.Run(() => Utils.HashingUtils.ConvertToSha256(prehashString.ToString()));
|
||||
}
|
||||
internal static string GetCustomHash(this Item? item) => Task.Run(() => item?.GetCustomHashAsync()).Result ?? string.Empty;
|
||||
|
||||
internal static string GetCustomHash(this Item? item) =>
|
||||
Task.Run(() => item?.GetCustomHashAsync()).Result ?? string.Empty;
|
||||
#if DEBUG
|
||||
internal static string AttributesToString(this Item? item)
|
||||
{
|
||||
|
@ -87,7 +96,9 @@ namespace LootValueEX.Extensions
|
|||
return String.Empty;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
item.Attributes.ForEach(attr => sb.Append($"\n{attr.Id}\n\tName: {attr.Name}\n\tBase Value: {attr.Base()}\n\tString value: {attr.StringValue()}\n\tDisplay Type: {attr.DisplayType()}"));
|
||||
item.Attributes.ForEach(attr =>
|
||||
sb.Append(
|
||||
$"\n{attr.Id}\n\tName: {attr.Name}\n\tBase Value: {attr.Base()}\n\tString value: {attr.StringValue()}\n\tDisplay Type: {attr.DisplayType()}"));
|
||||
return sb.ToString();
|
||||
}
|
||||
#endif
|
||||
|
@ -110,7 +121,8 @@ namespace LootValueEX.Extensions
|
|||
{
|
||||
case ArmoredRigTemplate armoredRig:
|
||||
case ArmorTemplate armor:
|
||||
return Utils.ItemUtils.GetArmorDurability(item.GetItemComponentsInChildren<RepairableComponent>(true));
|
||||
return Utils.ItemUtils.GetArmorDurability(
|
||||
item.GetItemComponentsInChildren<RepairableComponent>(true));
|
||||
default:
|
||||
return item.GetItemAttribute(EItemAttributeId.Durability);
|
||||
}
|
||||
|
@ -124,7 +136,6 @@ namespace LootValueEX.Extensions
|
|||
/// </summary>
|
||||
/// <param name="item">The item to retrieve the number of uses for.</param>
|
||||
/// <returns>The number of uses remaining for the item, or -1f if the item is null.</returns>
|
||||
|
||||
internal static float GetUses(this Item? item)
|
||||
{
|
||||
if (item == null)
|
||||
|
@ -150,4 +161,4 @@ namespace LootValueEX.Extensions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ using EFT.HealthSystem;
|
|||
using EFT.UI;
|
||||
using LootValueEX.Extensions;
|
||||
using SPT.Reflection.Patching;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace LootValueEX.Patches.Screens
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace LootValueEX.Patches
|
|||
private static void GenerateSupplyData(ref TraderClass __instance)
|
||||
{
|
||||
Plugin.Log.LogDebug($"Generating Assortment Data for trader {__instance.Id}");
|
||||
__instance.RefreshAssortment(true, false);
|
||||
__instance.RefreshAssortment(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ using EFTCurrencyUtils = GClass2531;
|
|||
|
||||
namespace LootValueEX.Utils
|
||||
{
|
||||
internal class EconomyUtils
|
||||
internal static class EconomyUtils
|
||||
{
|
||||
|
||||
public static float ConvertToRuble(string id, float amount)
|
||||
internal static float ConvertToRuble(string id, float amount)
|
||||
{
|
||||
if (!EFTCurrencyUtils.TryGetCurrencyType(id, out ECurrencyType currencyType))
|
||||
return 0f;
|
||||
|
@ -22,7 +22,7 @@ namespace LootValueEX.Utils
|
|||
return amount * (float)Singleton<HandbookClass>.Instance.GetBasePrice(id);
|
||||
}
|
||||
|
||||
public static Structs.TradeOfferStruct GetTraderItemOffer(TraderClass trader, Item item)
|
||||
internal static Structs.TradeOfferStruct GetTraderItemOffer(TraderClass trader, Item item)
|
||||
{
|
||||
Plugin.Log.LogDebug($"GetTraderItemOffer: {item.LocalizedName()} - {trader.LocalizedName}");
|
||||
TraderClass.GStruct244? tradeOffer = trader.GetUserItemPrice(item);
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace LootValueEX.Utils
|
||||
{
|
||||
internal class HashingUtils
|
||||
internal static class HashingUtils
|
||||
{
|
||||
internal static string ConvertToSha256(string value)
|
||||
{
|
||||
|
|
|
@ -4,9 +4,9 @@ using SPT.Reflection.Utils;
|
|||
|
||||
namespace LootValueEX.Utils
|
||||
{
|
||||
internal class ItemUtils
|
||||
internal static class ItemUtils
|
||||
{
|
||||
public static float GetArmorDurability(IEnumerable<RepairableComponent> repairableComponents)
|
||||
internal static float GetArmorDurability(IEnumerable<RepairableComponent> repairableComponents)
|
||||
{
|
||||
float totalDurability = 0;
|
||||
foreach (RepairableComponent component in repairableComponents)
|
||||
|
@ -16,7 +16,7 @@ namespace LootValueEX.Utils
|
|||
return totalDurability;
|
||||
}
|
||||
|
||||
public static Task<Structs.TradeOfferStruct> GetBestTraderValueAsync(Item item)
|
||||
internal static Task<Structs.TradeOfferStruct> GetBestTraderValueAsync(Item item)
|
||||
{
|
||||
Structs.TradeOfferStruct bestOffer = new();
|
||||
item = item.UnstackItem();
|
||||
|
|
Loading…
Reference in New Issue
Block a user