You are viewing a potentially older version of this package. View all versions.
morphine-VampireDB-0.1.0 icon

VampireDB

Stupid simple wrapper for LiteDB

Date uploaded 2 weeks ago
Version 0.1.0
Download link morphine-VampireDB-0.1.0.zip
Downloads 8
Dependency string morphine-VampireDB-0.1.0

This mod requires the following mods to function

BepInEx-BepInExPack_V_Rising-1.733.2 icon
BepInEx-BepInExPack_V_Rising

BepInEx pack for V Rising. Preconfigured and includes Unity Base DLLs.

Preferred version: 1.733.2
deca-VampireCommandFramework-0.10.2 icon
deca-VampireCommandFramework

Command framework for developers to easily create universal commands for their plugins.

Preferred version: 0.10.2

README

logo

VampireDB

Stupid simple wrapper for litedb

For Admins:

To install just take BOTH dlls and put them in the plugins folder. ๐ŸŽ‰That's it!๐ŸŽ‰

For devs:

some examples:

// tdbset <key> <value>
[Command("dbset", shortHand: "dbs", adminOnly: true)]
public void SetValue(ChatCommandContext ctx, string key, string value)
{
Storage.Instance.Set(ctx.User.PlatformId, key, value);
ctx.Reply($"Saved: {key} = {value}");
}

// tdbget <key>
[Command("dbget", shortHand: "dbg", adminOnly: true)]
public void GetValue(ChatCommandContext ctx, string key)
{
    string result;
    if (Storage.Instance.TryGet(ctx.User.PlatformId, key, out result))
        ctx.Reply($"{key} = {result}");
    else
        ctx.Reply($"No entry for '{key}'.");
}
// tdbget <key>
[Command("dbgetInt", shortHand: "dbgi", adminOnly: true)]
public void GetIntValue(ChatCommandContext ctx, string key)
{
    int result;
    if (Storage.Instance.TryGet(ctx.User.PlatformId, key, out result))
        ctx.Reply($"{key} = {result}");
    else
        ctx.Reply($"No entry for '{key}'.");
}
// tdbinc <key> [delta]   (increments an integer field; default +1)
[Command("dbinc", shortHand: "dbi", adminOnly: true)]
public void IncrementValue(ChatCommandContext ctx, string key, int delta = 1)
{
    int newVal = Storage.Instance.Update<int>(
        ctx.User.PlatformId,
        key,
        current => current + delta,
        0
    );
    ctx.Reply($"{key} incremented to {newVal}");
}

// tdbdel <key>
[Command("dbdel", shortHand: "dbd", adminOnly: true)]
public void DeleteValue(ChatCommandContext ctx, string key)
{
    bool removed = Storage.Instance.Delete(ctx.User.PlatformId, key);
    ctx.Reply(removed ? $"Deleted '{key}'." : $"Nothing to delete for '{key}'.");
}