Advertisement
Guest User

Untitled

a guest
Dec 16th, 2023
973
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.77 KB | None | 0 0
  1. using BepInEx;
  2. using HarmonyLib;
  3. using BepInEx.Logging;
  4. using BepInEx.Configuration;
  5. using UnityEngine;
  6. using System.Reflection;
  7.  
  8. namespace %YOUR_MOD_NAME%
  9. {
  10.   [BepInPlugin(modGUID, modName, modVersion)]
  11.   [BepInProcess("Lethal Company.exe")]
  12.   [BepInDependency("ImoutoSama.PersonalBoombox", "1.1.0")]
  13.   public class %YOUR_MOD_NAME_PLUGIN% : BaseUnityPlugin
  14.   {
  15.     private const string modGUID = YOUR_UNIQUE_GUID;
  16.     private const string modName = YOUR_MOD_NAME;
  17.     private const string modVersion = YOUR_VERSION;
  18.  
  19.     private readonly Harmony harmony = new Harmony(modGUID);
  20.  
  21.     internal ManualLogSource logger;
  22.  
  23.     public ConfigEntry<bool> overridePriceFlagConfig;
  24.     public ConfigEntry<int> overridePriceValueConfig;
  25.  
  26.     void Awake(){
  27.       logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
  28.       logger.LogInfo($"Plugin {modName} has been added!");
  29.  
  30.       overridePriceFlagConfig = Config.Bind("General", "Override Price Flag", false, "If you want to override price of the boomboxes, you MUST set this to true.");
  31.       overridePriceValueConfig = ConfigBindClamp("General", "Override Price Value", 30, "Overrides the price of the boomboxes by this value. Clamped from 0 to 1000.", 0, 1000);
  32.  
  33.       var request = PersonalBoombox.PersonalBoomboxPlugin.AddFromAssemblyDll(Assembly.GetExecutingAssembly().Location);
  34.       request.overridePriceFlag = overridePriceFlagConfig.Value;
  35.       request.overridePriceValue = overridePriceValueConfig.Value;
  36.     }
  37.  
  38.     public ConfigEntry<int> ConfigBindClamp(string section, string key, int defaultValue, string description, int min, int max){
  39.       var config = Config.Bind(section, key, defaultValue, description);
  40.       config.Value = Mathf.Clamp(config.Value, min, max);
  41.       return config;
  42.     }
  43.  
  44.   }
  45.  
  46. }
  47.  
Advertisement
Comments
  • Lyfalda
    1 year (edited)
    # text 0.15 KB | 0 0
    1. I suppose the version in (line 12) [BepInDependency("ImoutoSama.PersonalBoombox", "1.1.0")] should be updated to the last version of the mod each time right ?
Add Comment
Please, Sign In to add comment
Advertisement