You are viewing a potentially older version of this package. View all versions.
MoSadie-MoCore-1.0.0 icon

MoCore

Common plugin across MoSadie's plugins

Date uploaded 2 years ago
Version 1.0.0
Download link MoSadie-MoCore-1.0.0.zip
Downloads 142
Dependency string MoSadie-MoCore-1.0.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

MoCore

A common plugin used across my other BepInEx plugins.

Setup

Add the dll

Download the latest version from the release page and place it into a lib folder with your code. Add the following to your .csProj file:

<Project Sdk="Microsoft.NET.Sdk">
    ...

    <ItemGroup>
        <Reference Include="MoCore">
            <HintPath>lib/com.mosadie.mocore.dll</HintPath>
        </Reference>
    </ItemGroup>

</Project>

In your main Plugin class

Have the plugin class implement MoPlugin and call MoCore.RegisterPlugin and pass itself. The plugin should also make use of the BepInDependency attribute to make sure it loads after MoCore.

Example of the attribute:

[BepInDependency("com.mosadie.mocore", BepInDependency.DependencyFlags.HardDependency)]

Example of version checking in Awake:

if (!MoCore.MoCore.RegisterPlugin(this))
{
    Log.LogError("Failed to register plugin with MoCore. Please check the logs for more information.");
    return;
}

Make sure to mark as dependencies on Thunderstore as well

If using the tcli here is how it looks in thunderstore.yml

[package.dependencies]
BepInEx-BepInExPack= "5.4.2100"
MoSadie-MoCore= "1.0.0"

Features

Game Version Checking

Return a url to a json file from GetVersionCheckUrl and you can use the return value of RegisterPlugin to determine if the game versinon supports your plugin. Pass null for the GetVersionCheckUrl to disable version checking. In addition there is a configuration option in MoCore to skip version checking.

Here is a example of what the version json file looks like:

{
    "1.2.3": [ // Plugin version
        "4.1579" // Application.version value
    ]
}

CHANGELOG

v2.0.2

Added wildcard support to the HTTP server, this will mean nothing to most people. All it allows is the ability to allow remote requests to use the HTTP server.

v2.0.1

Forgot to add a shutdown method to the HTTP server, so it can be properly disposed of when the game exits. Not sure if this is needed, but it doesn't hurt to have it.

v2.0.0

Added two new features to MoCore:

  • Centralized HTTP server, so plugins can use the same port to listen for requests. See the new GetHttpHandler method in IMoPlugin for more information.
    • The short version: In the new method, return an object that implements IMoHttpHandler, and the server will call it when a request comes in. Your code can modify the response from there.
  • Moved the Variable system from SlipChat, meaning now your plugin can simply call VariableHandler.ParseVariables to parse a string with variables in it, and it will return the string with the variables replaced with their values. This is also available via the HTTP server, for those feeling fancy.

v1.0.0

Initial release!