diff --git a/ASS.csproj b/ASS.csproj
index 1337880..7cbb8b3 100644
--- a/ASS.csproj
+++ b/ASS.csproj
@@ -99,6 +99,6 @@
- copy "$(TargetPath)" "C:\SPT\BepInEx\plugins\dvize.ASS.dll"
+ copy "$(TargetPath)" "F:\SPT-AKI\BepInEx\plugins\dvize.ASS.dll"
\ No newline at end of file
diff --git a/Plugin.cs b/Plugin.cs
index c500aaf..7969150 100644
--- a/Plugin.cs
+++ b/Plugin.cs
@@ -21,6 +21,10 @@ namespace armorMod
{
get; set;
}
+ private ConfigEntry LoseInsuranceOnRepair
+ {
+ get; set;
+ }
private static ConfigEntry TimeDelayRepairInSec
{
get; set;
@@ -41,6 +45,8 @@ namespace armorMod
private float newMaxDurabilityDrainRate;
private ArmorComponent armor;
private static float timeSinceLastHit = 0f;
+ private static InsuranceCompanyClass insurance;
+ private static List insuranceList;
private readonly Dictionary> equipmentSlotDictionary = new Dictionary>
{
@@ -54,6 +60,7 @@ namespace armorMod
internal void Awake()
{
ArmorServiceMode = Config.Bind("Armor Repair Settings", "Enable/Disable Mod", true, "Enables the Armor Repairing Options Below");
+ LoseInsuranceOnRepair = Config.Bind("Armor Repair Settings", "Lose Insurance On Repair", true, "If Enabled, you will lose insurance on whenever the armor is repaired in-raid");
TimeDelayRepairInSec = Config.Bind("Armor Repair Settings", "Time Delay Repair in Sec", 60f, "How Long Before you were last hit that it repairs armor");
ArmorRepairRateOverTime = Config.Bind("Armor Repair Settings", "Armor Repair Rate", 0.5f, "How much durability per second is repaired");
MaxDurabilityDegradationRateOverTime = Config.Bind("Armor Repair Settings", "Max Durability Drain Rate", 0.025f, "How much max durability per second of repairs is drained");
@@ -75,6 +82,9 @@ namespace armorMod
player.BeingHitAction += Player_BeingHitAction;
player.OnPlayerDeadOrUnspawn += Player_OnPlayerDeadOrUnspawn;
runOnceAlready = true;
+
+ //get insurance singleton
+ insurance = Singleton.Instance;
}
RepairArmor();
@@ -115,12 +125,46 @@ namespace armorMod
if (armor.Repairable.Durability + newRepairRate >= armor.Repairable.MaxDurability)
{
armor.Repairable.Durability = armor.Repairable.MaxDurability;
+
+ //check if insuredItems class contains the item
+ if (insurance != null && LoseInsuranceOnRepair.Value)
+ {
+ // use accesstools to get private List list_0;
+ insuranceList = (List)AccessTools.Field(typeof(InsuranceCompanyClass), "list_0").GetValue(insurance);
+
+ //check the insuranceList for the item by id and remove it if it exists
+ var x = insuranceList.Where(i => i.itemId == item.Id).FirstOrDefault();
+ if (x != null)
+ {
+ //remove from insuranceList
+ insuranceList.Remove(x);
+ }
+
+ }
+
//Logger.LogInfo("ASS: Setting MaxDurability for " + item.LocalizedName());
}
else
{
armor.Repairable.Durability += newRepairRate;
armor.Repairable.MaxDurability -= newMaxDurabilityDrainRate;
+
+ //check if insuredItems class contains the item
+ if (insurance != null && LoseInsuranceOnRepair.Value)
+ {
+ // use accesstools to get private List list_0;
+ insuranceList = (List)AccessTools.Field(typeof(InsuranceCompanyClass), "list_0").GetValue(insurance);
+
+ //check the insuranceList for the item by id and remove it if it exists
+ var x = insuranceList.Where(i => i.itemId == item.Id).FirstOrDefault();
+ if (x != null)
+ {
+ //remove from insuranceList
+ insuranceList.Remove(x);
+ }
+
+ }
+
//Logger.LogInfo("ASS: Repairing " + item.LocalizedName() + " : " + armor.Repairable.Durability + "/" + armor.Repairable.MaxDurability);
}
}