Exemplo n.º 1
0
 private void Start()
 {
     newItem = ScriptableObject.CreateInstance <ModItem>().Create("WindTurbine", ItemType.Inventory);
     newItem.setInventorySettings("Wind Turbine", "A wind turbine which can be repurposed in several ways.", null, "Item/" + newItem.name, 5);
     RAPI.addItem(newItem);
     RConsole.Log("firstmod loaded!");
 }
Exemplo n.º 2
0
        private void SetSpawnRate()
        {
            var args = RConsole.lcargs;

            if (args.Length != 2)
            {
                RConsole.Log(MoreAnimalsArgumentsAreInvalid);
                return;
            }


            int spawnRate;

            if ((!int.TryParse(args[1], out spawnRate)))
            {
                RConsole.Log(MoreAnimalsArgumentsAreInvalid);
                return;
            }

            if (spawnRate < 1 || spawnRate > 50)
            {
                RConsole.Log(MoreAnimalsArgumentAreOutOfRange);
            }

            ObjectSpawnerLandmarkEditPatch.DomesticSpawnFactor = spawnRate;
        }
Exemplo n.º 3
0
 // The Start() method is being called when your mod gets loaded.
 public void Start()
 {
     tick = 0;
     RConsole.Log("Mumble Link has been loaded!");
     RConsole.Log("Starting connection to Mumble...");
     GetMumble();
 }
Exemplo n.º 4
0
    public void Start()
    {
        if (instance != null)
        {
            throw new Exception("Earls Mod singleton was already set");
        }
        instance = this;

        harmony = HarmonyInstance.Create(harmonyID);
        harmony.PatchAll(Assembly.GetExecutingAssembly());

        settingsPath = Path.Combine(Directory.GetCurrentDirectory(), "mods", "ModData", "EarlsMod.json");
        settings     = LoadSettings();
        if (SceneManager.GetActiveScene().name == network.gameSceneName)
        {
            StartCoroutine(ForceSettings());
        }

        SceneManager.sceneLoaded += OnSceneLoaded;

        List <Item_Base> items = ItemManager.GetAllItems();

        foreach (var item in items)
        {
            defaultStackSizes.Add(item.UniqueIndex, item.settings_Inventory.StackSize);
            defaultMaxUses.Add(item.UniqueIndex, item.MaxUses);
        }

        RConsole.registerCommand(typeof(EarlsMod), "Toggles on/off Earls Mod menu.", "ybmenu", ToggleUI);

        StartCoroutine(LoadBundle());
    }
        private void SetDaylength()
        {
            var args = RConsole.lcargs;

            if (args.Length != 2)
            {
                RConsole.Log(DayLengthArgumentsAreInvalid);
                return;
            }

            float length;

            if ((!float.TryParse(args[1], out length)))
            {
                RConsole.Log(DayLengthArgumentAreOutOfRange);
                return;
            }

            if (length < 1 ||
                length > 90)
            {
                RConsole.Log(DayLengthArgumentAreOutOfRange);
                return;
            }

            m_dayLength = length;
            RConsole.Log(string.Format("{0}: Sucessfully set daylength to {1} minutes.", ModNamePrefix, m_dayLength));
        }
    private void Start()
    {
        instance = HarmonyInstance.Create("com.aquatikjustice.rainwaterscrops");
        instance.PatchAll(Assembly.GetExecutingAssembly());

        RConsole.registerCommand("rwcChance", "Let's you set the difficulty to High, Medium, Low", "rwcChance", new Action(SetChance));

        settingsPath = Directory.GetCurrentDirectory() + @"\mods\configs\RWC-Config.cfg";

        if (!Directory.Exists(Directory.GetCurrentDirectory() + @"\mods\configs"))
        {
            Directory.CreateDirectory(Directory.GetCurrentDirectory() + @"\mods\configs");
        }

        if (!File.Exists(settingsPath))
        {
            using (var writer = new StreamWriter(settingsPath))
            {
                writer.Write(rwcChance);
            }
        }
        else
        {
            LoadSavedSettings();
        }
    }
Exemplo n.º 7
0
    IEnumerator Start()
    {
        RNotification notification = FindObjectOfType <RNotify>().AddNotification(RNotify.NotificationType.spinning, "Loading MoreStorages...");

        var bundleLoadRequest = AssetBundle.LoadFromFileAsync("mods\\ModData\\MoreStorages\\morestorages.assets");

        yield return(bundleLoadRequest);

        assetbundle = bundleLoadRequest.assetBundle;
        if (assetbundle == null)
        {
            RConsole.LogError("Failed to load AssetBundle for MoreStorages!");
            notification.Close();
            yield return(null);
        }

        List <Item_Base> list = Traverse.Create(typeof(ItemManager)).Field("allAvailableItems").GetValue <List <Item_Base> >();

        Item_Base Placeable_MoreStorages_MinecraftChest = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_MinecraftChest");

        Placeable_MoreStorages_MinecraftChest.Initialize(9845, "Placeable_MoreStorages_MinecraftChest", 1);
        list.Add(Placeable_MoreStorages_MinecraftChest);
        RegisterChest(Placeable_MoreStorages_MinecraftChest);

        Item_Base Placeable_MoreStorages_Barrel = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_Barrel");

        Placeable_MoreStorages_Barrel.Initialize(9846, "Placeable_MoreStorages_Barrel", 1);
        list.Add(Placeable_MoreStorages_Barrel);
        RegisterChest(Placeable_MoreStorages_Barrel);

        Item_Base Placeable_MoreStorages_Crate = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_Crate");

        Placeable_MoreStorages_Crate.Initialize(9847, "Placeable_MoreStorages_Crate", 1);
        list.Add(Placeable_MoreStorages_Crate);
        RegisterChest(Placeable_MoreStorages_Crate);

        Item_Base Placeable_MoreStorages_Luggage = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_Luggage");

        Placeable_MoreStorages_Luggage.Initialize(9848, "Placeable_MoreStorages_Luggage", 1);
        list.Add(Placeable_MoreStorages_Luggage);
        RegisterChest(Placeable_MoreStorages_Luggage);

        Item_Base Placeable_MoreStorages_MedievalChest = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_MedievalChest");

        Placeable_MoreStorages_MedievalChest.Initialize(9849, "Placeable_MoreStorages_MedievalChest", 1);
        list.Add(Placeable_MoreStorages_MedievalChest);
        RegisterChest(Placeable_MoreStorages_MedievalChest);

        Item_Base Placeable_MoreStorages_Package = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_Package");

        Placeable_MoreStorages_Package.Initialize(9850, "Placeable_MoreStorages_Package", 1);
        list.Add(Placeable_MoreStorages_Package);
        RegisterChest(Placeable_MoreStorages_Package);


        Traverse.Create(typeof(ItemManager)).Field("allAvailableItems").SetValue(list);

        notification.Close();
        RConsole.Log("MoreStorages has been successfully loaded!");
    }
Exemplo n.º 8
0
    public MemoryMappedViewAccessor GetMumble()
    {
        if (mumble != null)
        {
            return(mumble);
        }

        if (tick % 600 != 0)
        {
            return(null);
        }


        try
        {
            mapped = MemoryMappedFile.OpenExisting("MumbleLink", MemoryMappedFileRights.FullControl);

            mumble = mapped.CreateViewAccessor();
            RConsole.Log("Connected to Mumble.");
            return(mumble);
        }
        catch (System.IO.FileNotFoundException)
        {
            RConsole.Log("Mumble not found. Checking again in 10 seconds...");
        }

        return(null);
    }
Exemplo n.º 9
0
    public void Start()
    {
        if (instance != null)
        {
            throw new Exception("MoreSailsMoreSpeed singleton was already set");
        }
        instance = this;

        harmony = HarmonyInstance.Create(harmonyID);
        harmony.PatchAll(Assembly.GetExecutingAssembly());

        RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Lower all sails", "sailsOpen", SailsOpen);
        RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Raise all sails", "sailsClose", SailsClose);
        RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Rotate sails by a certain number", "sailsRotate", SailsRotate);
        RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Toggle all engines at once", "toggleEngines", ToggleAllEngines);
        RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Toggle all engines's direction at once", "toggleEnginesDir", ToggleAllEnginesDir);
        RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Tells you your current speed, 1.5 = default drift speed", "raftSpeed", PrintSpeed);

        if (SceneManager.GetActiveScene().isLoaded&& SceneManager.GetActiveScene().name == network.gameSceneName)
        {
            WorldEvent_WorldLoaded();
        }

        RConsole.Log(modPrefix + "loaded!");
    }
Exemplo n.º 10
0
    public void PrintSpeed()
    {
        Raft   raft  = FindObjectOfType <Raft>();
        object value = Traverse.Create(raft).Field("currentMovementSpeed").GetValue() as object;

        RConsole.Log(value.ToString());
    }
Exemplo n.º 11
0
 private void RegisterCommands()
 {
     RConsole.registerCommand(typeof(BasicSpawner), "Spawns the item", "spawn", SpawnItem);
     RConsole.registerCommand(typeof(BasicSpawner), "Opens your default browser to the list of items", "itemList", OpenBrowerList);
     RConsole.registerCommand(typeof(BasicSpawner), "List all the items into the console", "itemListConsole", PrintItems);
     RConsole.registerCommand(typeof(BasicSpawner), "Exports the list of items to a .txt file", "exportItemList", ExportList);
 }
Exemplo n.º 12
0
    public void OnModUnload()
    {
        RConsole.Log(string.Format("{0} has been unloaded!", ModNamePrefix));

        m_harmony.UnpatchAll(HarmonyId);
        Destroy(gameObject);
    }
Exemplo n.º 13
0
    // Token: 0x060000DD RID: 221
    public static void GiveItem(Item_Base item, int amount, Player p = null)
    {
        if (p == null)
        {
            p = UnityEngine.Object.FindObjectOfType <Player>();
        }
        FieldInfo field = Enumerable.FirstOrDefault <FieldInfo>(typeof(Player).GetFields((BindingFlags)36), (FieldInfo x) => x.Name == "playerInventory");

        if (field == null)
        {
            RConsole.Log("Couldn't find playerInventory");
            return;
        }
        PlayerInventory pi = (PlayerInventory)field.GetValue(p);

        if (pi == null)
        {
            RConsole.Log("Couldn't get playerInventory");
            return;
        }
        try
        {
            pi.AddItem(item.name, 1);
        }
        catch (Exception ex)
        {
            RConsole.Log(ex.ToString());
        }
    }
Exemplo n.º 14
0
        private void SetSpawnRate()
        {
            var args = RConsole.lcargs;

            if (args.Length != 2)
            {
                RConsole.Log(MoreAnimalsArgumentsAreInvalid);
                return;
            }


            int spawnRate;

            if ((!int.TryParse(args[1], out spawnRate)))
            {
                RConsole.Log(MoreAnimalsArgumentsAreInvalid);
                return;
            }

            if (spawnRate < 1 || spawnRate > 50)
            {
                RConsole.Log(MoreAnimalsArgumentAreOutOfRange);
                return;
            }

            ObjectSpawnerLandmarkEditPatch.DomesticSpawnFactor = spawnRate;
            RConsole.Log(string.Format("{0}: Animal factor set to {1} successfully.", ModNamePrefix, spawnRate));
        }
Exemplo n.º 15
0
        public IEnumerator Start()
        {
            var request = AssetBundle.LoadFromFileAsync("mods/ModData/MoreRareAnimals/llama_animator_fix.assets");

            yield return(request);

            m_assetBundle = request.assetBundle;

            m_harmony = HarmonyInstance.Create(HarmonyId);
            m_harmony.PatchAll(Assembly.GetExecutingAssembly());
            RConsole.registerCommand(typeof(MoreRareAnimals),
                                     "Gives you the ability to change the rare animal spanwn rate.",
                                     "morerareanimals",
                                     SetRareProbabilities);

            RConsole.registerCommand(typeof(MoreRareAnimals),
                                     "Gives you the ability to change the domestic animal spawn rate.",
                                     "moreanimals",
                                     SetSpawnRate);

            RConsole.registerCommand(typeof(MoreRareAnimals),
                                     "Gives you the ability to change the default animal scale factors.",
                                     "moreanimalscales",
                                     SetAnimalScales);

            RConsole.Log(string.Format("{0} has been loaded!", ModNamePrefix));
        }
 private void Start()
 {
     path = Directory.GetCurrentDirectory() + path;
     RConsole.Log("ItemDataGenerator loaded!");
     Generate();
     RConsole.Log("ItemData Generated! at " + path);
 }
Exemplo n.º 17
0
    IEnumerator LoadBundle()
    {
        // Load Bundle
        if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "mods", "ModData", "earlsmod.assets")))
        {
            menuBundle = AssetBundle.LoadFromFile(Path.Combine(Directory.GetCurrentDirectory(), "mods", "ModData", "earlsmod.assets"));
            RConsole.Log(modPrefix + "Loaded menu bundle from local file.");
        }
        else
        {
            UnityWebRequest uwr = UnityWebRequestAssetBundle.GetAssetBundle("https://github.com/earlbalai/earlsmod/blob/master/earlsmod.assets?raw=true");
            yield return(uwr.SendWebRequest());

            // Get an asset from the bundle and instantiate it.
            menuBundle = DownloadHandlerAssetBundle.GetContent(uwr);
            RConsole.Log(modPrefix + "Loaded menu bundle from remote repository.");
        }

        var loadAsset = menuBundle.LoadAssetAsync <GameObject>("EarlsMod_Canvas");

        yield return(loadAsset.isDone);

        menu = (GameObject)Instantiate(loadAsset.asset, gameObject.transform);
        UISetup();
    }
Exemplo n.º 18
0
 static void Prefix(ref SeagullState newState)
 {
     if (newState == SeagullState.Peck)
     {
         newState = SeagullState.FlyAway;
         RConsole.Log("No More Peck: Seagull is flying off now");
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// Mod initialization point.
 /// </summary>
 public void Start()
 {
     RConsole.Log("\"Utility Craft +\" starts loading.");
     INI.Open();
     INI.SetConfigurationFromINI();
     INI.Close();
     RConsole.Log("UtilCraft+ has been loaded!");
 }
 public void Start()
 {
     RConsole.Log(string.Format("{0} has been loaded!", ModNamePrefix));
     RConsole.registerCommand(typeof(LongerDayNightCycles),
                              "Gives you the ability to change the duration of a day.",
                              "daylength",
                              SetDaylength);
 }
Exemplo n.º 21
0
    public void Start()
    {
        ComponentManager <GlassHoneyUse> .Value = this;

        harmonyInstance = HarmonyInstance.Create(HARMONY_ID);
        harmonyInstance.PatchAll(Assembly.GetExecutingAssembly());

        RConsole.Log(logPrefix + " loaded!");
    }
Exemplo n.º 22
0
 public void OnModUnload()
 {
     RConsole.Log(modPrefix + "unloaded!");
     PersonController_GroundControll_Patch.sprintByDefault = false;
     PersonController_GroundControll_Patch.crouchIsToggle  = false;
     //menuBundle.Unload(true);
     harmony.UnpatchAll(harmonyID);
     Destroy(gameObject);
 }
Exemplo n.º 23
0
 public void OnModUnload()
 {
     CLIU.Echo("unloaded!");
     RConsole.unregisterCommand("sailsOpen");
     RConsole.unregisterCommand("sailsClose");
     RConsole.unregisterCommand("sailsDecay");
     harmony.UnpatchAll(harmonyID);
     Destroy(gameObject);
 }
Exemplo n.º 24
0
 public void OnModUnload()
 {
     if (GameModeValueManager.GetCurrentGameModeValue().gameMode != GameMode.Easy)
     {
         GameModeValueManager.GetCurrentGameModeValue().playerSpecificVariables.clearInventoryOnSurrender = true;
     }
     RConsole.Log("InvPersist has been unloaded!");
     Destroy(gameObject); // Please do not remove that line!
 }
Exemplo n.º 25
0
 public void OnModUnload()
 {
     RConsole.Log(modPrefix + "unloaded!");
     menuBundle.Unload(true);
     StopAllCoroutines();
     SaveSettings();
     harmony.UnpatchAll(harmonyID);
     Destroy(gameObject);
 }
Exemplo n.º 26
0
 public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     if (scene.name == network.gameSceneName)
     {
         settings = LoadSettings();
         StartCoroutine(ForceSettings());
         RConsole.Log(modPrefix + "Scene " + scene.name + " loaded.");
     }
 }
Exemplo n.º 27
0
    private void Start()
    {
        instance = HarmonyInstance.Create("com.aquatikjustice.GameOptions");
        instance.PatchAll(Assembly.GetExecutingAssembly());

        RConsole.registerCommand("gamemode", "Change the gamemode. Usage: gamemode <mode> (Options: Creative, Easy, Normal, Hardcore)", "gamemode", new Action(SwitchMode));
        RConsole.registerCommand("joinable", "Set whether your friends can join your game or not. Usage: joinable <true|false>", "joinable", new Action(ChangeAllowFriends));
        RConsole.registerCommand("friendlyFire", "Toggles whether Friendly Fire is on or off.", "friendlyFire", new Action(SetFriendlyFire));
        Log("<color=#ffcf01>GameOptions</color> - LOADED");
    }
Exemplo n.º 28
0
    private static void SyncFiltersWithPlayers()
    {
        RConsole.Log(string.Format("{0}: Sync was requested. Syncing filters with players...", ModNamePrefix));

        var mappings = GetCurrentFilterMapping();

        MessageHandler.SendMessage(
            new MessageSyncNetFilters(
                (Messages)MessageHandler.FilteredNetsMessages.SyncNetFilters, mappings));
    }
Exemplo n.º 29
0
 private void Log(string text)//Just an easier function to call instead of RConsole.Log
 {
     try
     {
         RConsole.Log(text);
     }
     catch (Exception e)
     {
         RConsole.Log(e.ToString());
     }
 }
Exemplo n.º 30
0
    public void Start()
    {
        RConsole.Log("StackMod has been loaded!");
        RConsole.registerCommand(typeof(StackMod), "", "stacksize", getCommand);

        lastSize = PlayerPrefs.GetInt("lastSize", 0);

        if (lastSize != 0)
        {
            Change(lastSize);
        }
    }