API

Assembly: Spark.Classes Interface: IClassesPlugin Implementation: ClassesPlugin

Interface

public interface IClassesPlugin
{
    // Database queries
    List<ClassEntry> GetAllClasses();
    ClassEntry GetClass(string classId);

    // Main class
    void SetMainClass(string entityId, string classId,
        GameObject source = null);
    string GetMainClass(string entityId);

    // Secondary classes
    void AddSecondaryClass(string entityId, string classId,
        GameObject source = null);
    void RemoveSecondaryClass(string entityId, string classId);
    List<string> GetSecondaryClasses(string entityId);

    // Unlocking
    void UnlockClass(string entityId, string classId,
        GameObject source = null);
    bool IsClassUnlocked(string entityId, string classId);
    List<string> GetUnlockedClasses(string entityId);
}

ClassEntry

Extends SparkDatabaseEntry. Defines a character class (Warrior, Mage, etc.).

The entry is intentionally minimal. Class depth comes from extensions added by other plugins (Combat stats, Progression, Spellbooks, etc.).

Events

Event
Fields
Description

ClassSelectedEvent

EntityId, ClassId, IsMainClass, Source

Class assigned

ClassUnlockedEvent

EntityId, ClassId, Source

Class unlocked

Both events are struct-based ISparkEvent implementations with a Timestamp field.

Save Data

ClassesSaveData

Extends SaveDataEntry.

Field
Type
Description

mainClassId

string

Currently selected main class

secondaryClassIds

List<string>

Active secondary classes

unlockedClassIds

List<string>

All unlocked classes

Methods:

Setting a main or secondary class automatically unlocks it.

Usage

Last updated

Was this helpful?