updated to work with 3.1.1 and client 19078

This commit is contained in:
CWX 2022-07-26 20:41:04 +01:00
parent bf3d11e3c6
commit 6a61389987
2 changed files with 15 additions and 15 deletions

View File

@ -55,15 +55,15 @@ namespace itemValueMod
editedPrice = jsonClass.price; editedPrice = jsonClass.price;
editedMulti = jsonClass.multiplier; editedMulti = jsonClass.multiplier;
originalMax = jsonClass.originalMax; originalMax = jsonClass.originalMax;
Debug.LogError($" editedPrice: {editedPrice}"); //Debug.LogError($" editedPrice: {editedPrice}");
Debug.LogError($" editedMulti: {editedMulti}"); //Debug.LogError($" editedMulti: {editedMulti}");
Debug.LogError($" originalMax: {originalMax}"); //Debug.LogError($" originalMax: {originalMax}");
var medKit = item.GetItemComponent<MedKitComponent>(); var medKit = item.GetItemComponent<MedKitComponent>();
if (medKit != null && medKit.HpResource != 0 && medKit.MaxHpResource != 0) if (medKit != null && medKit.HpResource != 0 && medKit.MaxHpResource != 0)
{ {
editedPrice *= medKit.HpResource / medKit.MaxHpResource; editedPrice *= medKit.HpResource / medKit.MaxHpResource;
Debug.LogError($" MedKitComponent: {editedPrice}"); //Debug.LogError($" MedKitComponent: {editedPrice}");
} }
var repair = item.GetItemComponent<RepairableComponent>(); var repair = item.GetItemComponent<RepairableComponent>();
@ -72,7 +72,7 @@ namespace itemValueMod
if (repair.Durability > 0) if (repair.Durability > 0)
{ {
editedPrice *= repair.Durability / originalMax; editedPrice *= repair.Durability / originalMax;
Debug.LogError($" RepairableComponent: {editedPrice}"); //Debug.LogError($" RepairableComponent: {editedPrice}");
} }
else else
{ {
@ -84,7 +84,7 @@ namespace itemValueMod
if (dogtag != null && dogtag.Level != 0) if (dogtag != null && dogtag.Level != 0)
{ {
editedPrice *= dogtag.Level; editedPrice *= dogtag.Level;
Debug.LogError($" DogtagComponent: {editedPrice}"); //Debug.LogError($" DogtagComponent: {editedPrice}");
} }
var repairKit = item.GetItemComponent<RepairKitComponent>(); var repairKit = item.GetItemComponent<RepairKitComponent>();
@ -93,7 +93,7 @@ namespace itemValueMod
if (repairKit.Resource > 0) if (repairKit.Resource > 0)
{ {
editedPrice *= repairKit.Resource / originalMax; editedPrice *= repairKit.Resource / originalMax;
Debug.LogError($" RepairKitComponent: {editedPrice}"); //Debug.LogError($" RepairKitComponent: {editedPrice}");
} }
else else
{ {
@ -104,11 +104,11 @@ namespace itemValueMod
var resource = item.GetItemComponent<ResourceComponent>(); var resource = item.GetItemComponent<ResourceComponent>();
if (resource != null && resource.Value != 0 && resource.MaxResource != 0) if (resource != null && resource.Value != 0 && resource.MaxResource != 0)
{ {
Debug.LogError($" ResourceComponent.value: {resource.Value}"); //Debug.LogError($" ResourceComponent.value: {resource.Value}");
Debug.LogError($" ResourceComponent.MaxResource: {resource.MaxResource}"); //Debug.LogError($" ResourceComponent.MaxResource: {resource.MaxResource}");
editedPrice *= resource.Value / resource.MaxResource; editedPrice *= resource.Value / resource.MaxResource;
Debug.LogError($" ResourceComponent: {editedPrice}"); //Debug.LogError($" ResourceComponent: {editedPrice}");
} }
var foodDrink = item.GetItemComponent<FoodDrinkComponent>(); var foodDrink = item.GetItemComponent<FoodDrinkComponent>();
@ -117,7 +117,7 @@ namespace itemValueMod
GInterface208 ginterface208_0 = (GInterface208)foodDrink.GetType().GetField("ginterface208_0", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(foodDrink); GInterface208 ginterface208_0 = (GInterface208)foodDrink.GetType().GetField("ginterface208_0", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(foodDrink);
editedPrice *= foodDrink.HpPercent / ginterface208_0.MaxResource; editedPrice *= foodDrink.HpPercent / ginterface208_0.MaxResource;
Debug.LogError($" FoodDrinkComponent: {editedPrice}"); //Debug.LogError($" FoodDrinkComponent: {editedPrice}");
} }
var keys = item.GetItemComponent<KeyComponent>(); var keys = item.GetItemComponent<KeyComponent>();
@ -131,7 +131,7 @@ namespace itemValueMod
double multi = totalMinusUsed / ginterface212_0.MaximumNumberOfUsage; double multi = totalMinusUsed / ginterface212_0.MaximumNumberOfUsage;
editedPrice *= multi; editedPrice *= multi;
Debug.LogError($" KeyComponent: {editedPrice}"); //Debug.LogError($" KeyComponent: {editedPrice}");
} }
} }
@ -139,18 +139,18 @@ namespace itemValueMod
if (sideEffect != null && sideEffect.Value != 0) if (sideEffect != null && sideEffect.Value != 0)
{ {
editedPrice *= sideEffect.Value / sideEffect.MaxResource; editedPrice *= sideEffect.Value / sideEffect.MaxResource;
Debug.LogError($" SideEffectComponent: {editedPrice}"); //Debug.LogError($" SideEffectComponent: {editedPrice}");
} }
_price = editedPrice * editedMulti; _price = editedPrice * editedMulti;
Debug.LogError($"ENDING PRICE: {_price}"); //Debug.LogError($"ENDING PRICE: {_price}");
return _price; return _price;
} }
public static string ValueStr(this Item item) public static string ValueStr(this Item item)
{ {
var result = Math.Round(item.Value()).ToString(); var result = Math.Round(item.Value()).ToString();
Debug.LogError($"price, rounded to string: {result}"); //Debug.LogError($"price, rounded to string: {result}");
return result; return result;
} }