Exemple #1
0
 public static void LogOnce(DropOnDestroyed d)
 {
     if (PluginConfig.EnableResourceLogging && _loggedDropOnDestroyed.Add(d.name))
     {
         LogString(StringHelper.DropOnDestroyedToString(d));
     }
 }
 private static void DropOnDestroyed_Prefix(ref DropOnDestroyed __instance)
 {
     if (__instance.name == "MineRock_Tin(Clone)" && PluginConfig.Tin.Enabled)
     {
         if (__instance.m_dropWhenDestroyed != null)
         {
             try
             {
                 PluginConfig.Tin.ModifyDropTable(__instance.m_dropWhenDestroyed);
             }
             catch (Exception ex)
             {
                 ConfigurableHarvestPlugin.LogInfo(BepInEx.Logging.LogLevel.Error, $"Failed applying modification to Tin: {ex.ToString()}");
             }
         }
     }
     //[3/7/2021 12:11 PM] [DropOnDestroyed] name=MineRock_Obsidian(Clone), m_dropWhenDestroyed=m_dropChance=1, m_dropMin=5, m_dropMax=8, m_oneOfEach=False, m_drops=[m_item=Obsidian, m_stackMin=1, m_stackMax=1, m_weight=1]
     if (__instance.name == "MineRock_Obsidian(Clone)" && PluginConfig.Obsidian.Enabled)
     {
         if (__instance.m_dropWhenDestroyed != null)
         {
             try
             {
                 PluginConfig.Obsidian.ModifyDropTable(__instance.m_dropWhenDestroyed);
             }
             catch (Exception ex)
             {
                 ConfigurableHarvestPlugin.LogInfo(BepInEx.Logging.LogLevel.Error, $"Failed applying modification to Obsidian: {ex.ToString()}");
             }
         }
     }
     Log.LogOnce(__instance);
 }
 static void Postfix(ref DropOnDestroyed __instance)
 {
     if (__instance.gameObject.name.Contains("Rock"))
     {
         __instance.m_dropWhenDestroyed.m_dropMin     = Mathf.RoundToInt(dropMinMult.Value * __instance.m_dropWhenDestroyed.m_dropMin);
         __instance.m_dropWhenDestroyed.m_dropMax     = Mathf.RoundToInt(dropMaxMult.Value * __instance.m_dropWhenDestroyed.m_dropMax);
         __instance.m_dropWhenDestroyed.m_dropChance *= dropChanceMult.Value;
     }
 }
 static void Postfix(ref DropOnDestroyed __instance)
 {
     dropTableObject = "";
 }
 static void Prefix(ref DropOnDestroyed __instance)
 {
     dropTableObject = __instance.gameObject.name;
 }
 private static void SetLink(DropOnDestroyed __instance)
 {
     CreateLink(__instance.m_dropWhenDestroyed, __instance.gameObject);
 }
Exemple #7
0
 public static string DropOnDestroyedToString(DropOnDestroyed x)
 {
     return($"[{x.GetType().Name}] name={x.name}, m_dropWhenDestroyed={DropTableToString(x.m_dropWhenDestroyed)}");
 }