Framework for V Rising mod developers to easily build commands.
This plugin should be installed into the BepInEx/plugins
folder and be kept up to date. It is required by other plugins for commands. In the future there will be more universal configurations for server operators to manage commands across plugins.
dotnet add package VRising.VampireCommandFramework
[BepInDependency("gg.deca.VampireCommandFramework")]
CommandRegistry.RegisterAll()
[Command("foo")]
public void Foo(ICommandContext ctx, int count, string orValues = "with defaults", float someFloat=3f)
=> ctx.Reply($"You'd do stuff here with your parsed {count} and stuff");
The above would execute for:
.foo 5
.foo 5 works
.foo 5 "or really fancy" 3.145
But if you typed .foo 5.123
you'd see a generated usage message back like
.foo (count) [orValues ="with defaults"] [someFloat=3]
All commands execute through the same pipeline and through a series of middleware. You can add your own middleware to the pipeline by adding a class that implements ICommandMiddleware
and adding it to the CommandRegistry.Middlewares
list. Middleware is where you'd implement things like cooldowns, permissions, logging, command 'costs', that could apply across commands even from other vcf plugins.
Please feel free to direct questions to @decaprime on discord at the V Rising Modding Discord