public static void CheckIsDefaultAddOn(ItemSyncData __instance) { try { //if ((__instance.SyncData[1] == ((int)eItemIDs.BedrollKit).ToString() // || __instance.SyncData[1] == ((int)eItemIDs.TentKit).ToString())) //{ // WorkInProgress.Instance.MyLogger.LogDebug($"CheckIsDefaultAddOn[{__instance.SyncData[0]}]={__instance.SyncData[10]}"); //} if (__instance.SyncData[1] == ((int)eItemIDs.BedrollKit).ToString() || __instance.SyncData[1] == ((int)eItemIDs.TentKit).ToString()) { if (string.IsNullOrEmpty(__instance.SyncData[10]) || __instance.SyncData[10] == "-1") { __instance.SyncData[10] = WorkInProgress.ItemDurabilities[eItemIDs.BedrollKit].MaxDurability.ToString(); WorkInProgress.Instance.MyLogger.LogDebug($"{Enum.GetName(typeof(eItemIDs), int.Parse(__instance.SyncData[1]))}: No durability saved, default to {__instance.SyncData[10]}"); } else { WorkInProgress.Instance.MyLogger.LogDebug($"{Enum.GetName(typeof(eItemIDs), int.Parse(__instance.SyncData[1]))}: Load durability with {__instance.SyncData[10]}"); } //int i = 0; //foreach (var item in __instance.SyncData) //{ // WorkInProgress.Instance.MyLogger.LogDebug($" > {i}={item}"); // i++; //} } } catch (Exception ex) { WorkInProgress.Instance.MyLogger.LogError("CheckIsDefaultAddOn: " + ex.Message); } }
public static void CheckIsDefaultAddOn(ItemSyncData __instance) { try { if (__instance.SyncData[1] == "4200040" && (__instance.SyncData[12] == "WaterContainerWaterType/Clean;" || __instance.SyncData[12] == "WaterContainerWaterType/Fresh;") && string.IsNullOrEmpty(__instance.SyncData[10])) { __instance.SyncData[10] = WorkInProgress.ItemDurabilities[eItemIDs.RiverWater].MaxDurability.ToString(); if (__instance.SyncData[12] == "WaterContainerWaterType/Clean;") { __instance.SyncData[10] = WorkInProgress.ItemDurabilities[eItemIDs.CleanWater].MaxDurability.ToString(); } //WorkInProgress.Instance.MyLogger.LogDebug($"InitializeDurabilityW[{__instance.SyncData[0]}]: {__instance.SyncData[12]}"); //int i = 0; //foreach (var item in __instance.SyncData) //{ // WorkInProgress.Instance.MyLogger.LogDebug($" > {i}={item}"); // i++; //} } } catch (Exception ex) { WorkInProgress.Instance.MyLogger.LogError("CheckIsDefaultAddOn: " + ex.Message); } }