chore: changed the access level of some functions

This commit is contained in:
Yui
2024-11-22 21:30:48 -03:00
parent db4003caa7
commit 7734090feb
6 changed files with 29 additions and 17 deletions

View File

@@ -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
}
}
}
}
}