Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions definitions/api/TextColor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,7 @@ interface ITextColor {
formatText(str: string): string;
}

/**
* @version 2.0.0
*/
declare const TextColor: ITextColor;
22 changes: 21 additions & 1 deletion definitions/feature/command.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
/**
* @since 2.0.0
*/
interface CommandEvents {
/**
* Called on any command being used.
* @param label The beginning of the command line (for example, `'test'` in '.test 123')
* @param args The list of arguments of the command line (for example, `['123']` in '.test 123')
* @param commandLine The command line (for example, `'.test 123 test'` in '.test 123 test')
* @returns Whether the command usage is successful or not (return `false` if the user misused the command)
* @since 2.0.0
*/
"execute" : (label: string, args: string[], commandLine: string) => boolean;
}

// A class representing a Latite Client command.
/**
* A class representing a Latite Client command.
* @since 2.0.0
*/
declare class Command {
/**
* @since 2.0.0
*/
readonly name: string;
/**
* @since 2.0.0
*/
readonly description: string;
/**
* @since 2.0.0
*/
readonly aliases: string[];

/**
Expand All @@ -21,8 +37,12 @@ declare class Command {
* @param description A short description of what the command does
* @param usage The usage of the command put '$' in place of the actual command name and preifx. Example: usage: "$ <name>" -> ".commandname <name>"
* @param aliases Alternative command names the user can use the execute the same command. Can be empty
* @since 2.0.0
*/
constructor(name: string, description: string, usage: string, aliases: string[]);

/**
* @since 2.0.0
*/
on: <K extends keyof CommandEvents>(eventName: K, handler: CommandEvents[K]) => void;
}
39 changes: 39 additions & 0 deletions definitions/feature/hudmodule.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,54 @@
/**
* @since 2.0.0
*/
declare class HudModule extends Module {
/**
*
* @param name
* @param displayName
* @param description
* @param key
* @param resizable
* @since 2.0.0
*/
constructor(name: string, displayName: string, description: string, key: KeyCode, resizable: boolean);

/**
* @since 2.0.0
*/
getRect(): Rect;
/**
* @since 2.0.0
*/
setRect(newRect: Rect): void;
/**
* @since 2.0.0
*/
setBounds(width: number, height: number): void;
/**
* @since 2.0.0
*/
getSize(): number;
/**
* @since 2.0.0
*/
setSize(): number;
/**
* @since 2.0.0
*/
getPos(): Vector2;
/**
* @since 2.0.0
*/
setPos(x: number, y: number): void;
}

/**
* @since 2.0.0
*/
declare class TextModule extends HudModule {
/**
* @since 2.0.0
*/
constructor(name: string, displayName: string, description: string, key: KeyCode);
}
5 changes: 5 additions & 0 deletions definitions/feature/manager/commandmgr.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/**
* @since 2.0.0
*/
declare class CommandManager {
/**
* Gets the command prefix, default is '.'
* @since 2.0.0
*/
getPrefix(): string;

/**
* Adds a command into the client
* @param cmd The command to add
* @since 2.0.0
*/
registerCommand(cmd: Command): void;

Expand Down
6 changes: 6 additions & 0 deletions definitions/feature/manager/mmgr.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/**
* @since 2.0.0
*/
interface ModuleManager {
/**
* Registers a module into the Latite mod. This makes it appear in the mod menu, and be interactive.
* @param mod The module to register.
* @since 2.0.0
*/
registerModule(mod: Module): void;

Expand All @@ -12,12 +16,14 @@ interface ModuleManager {
* For example, ArmorHud is the internal name for Armor Hud.
* Position is the internal name of Coordinates
* @param name The name of the module to get.
* @since 2.0.0
*/
getModuleByName(name: string): Module | null;

/**
* Loop through each module.
* @param callback
* @since 2.0.0
*/
forEachModule(callback: (mod: Module) => void): void;
}
53 changes: 46 additions & 7 deletions definitions/feature/module.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
/**
* @since 2.0.0
*/
interface ModuleEvents {
/**
* Called on any module being enabled.
* @since 2.0.0
*/
"enable": () => void,
/**
* Called on any module being disabled.
* @since 2.0.0
*/
"disable": () => void,
/**
* Called on every frame. Return a bool to set the toggle form of the module - `true` makes it a hold module, like player list; `false`, standard toggle form.
* @since 2.0.0
*/
"get-hold-to-toggle": () => boolean, // I had no idea how to write this

Expand All @@ -17,6 +23,7 @@ interface ModuleEvents {
* @note Only available in HUD modules.
* @param isPreview If it's a preview in the main menu (when module settings are extended.)
* @param isEditor If it's in the HUD editor where you move modules around.
* @since 2.0.0
*/
"render": (isPreview: boolean, isEditor: boolean) => void,
/**
Expand All @@ -27,58 +34,85 @@ interface ModuleEvents {
/**
* Called on every frame; use this to render text. Return a string to render it on the next frame.
* @note Only available in text modules.
* @since 2.0.0
*/
"text": (isPreview: boolean, isEditor: boolean) => string;
}

/**
* @since 2.0.0
*/
declare class Module {
/**
* @since 2.0.0
*/
readonly name: string
/**
* @since 2.0.0
*/
readonly displayName: string
/**
* @since 2.0.0
*/
readonly description: string
/**
* @since 2.0.0
*/
readonly key: KeyCode

/**
* IDs for script modules are always 255.
* @since 2.0.0
*/
readonly id: number;
/**
* If the module is a HUD module (that you can move in the hud editor)
* @since 2.0.0
*/
readonly visual: boolean;
/**
* If the module is visible in the ClickGui
* @since 2.0.0
*/
readonly visible: boolean;

/**
*
* @param name The internal name of the module.
* @param displayName The display name of the module. Shown in the ClickGUI.
* @param description A short description of what the module does.
* @param key The default keybind to activate the module.
*/
/**
*
* @param name The internal name of the module.
* @param displayName The display name of the module. Shown in the ClickGUI.
* @param description A short description of what the module does.
* @param key The default keybind to activate the module.
* @since 2.0.0
*/
constructor(name: string, displayName: string, description: string, key: KeyCode);

/**
* @since 2.0.0
*/
on: <K extends keyof ModuleEvents>(eventName: K, handler: ModuleEvents[K]) => void;

/**
* Checks if the module is enabled.
* @since 2.0.0
*/
isEnabled(): boolean;

/**
* Set the module to be enabled or not.
* @param b The new status of the module.
* @since 2.0.0
*/
setEnabled(b: boolean): void;

/**
* Check if the module is blocked.
* @since 2.0.0
*/
isBlocked(): boolean;

/**
* Gets the settings of the module.
* @since 2.0.0
*/
getSettings(): Setting[];

Expand All @@ -88,6 +122,7 @@ declare class Module {
* @param displayName The name that shows in the menu
* @param description A short description of what the setting does
* @param defVal The default value
* @since 2.0.0
*/
addBoolSetting(name: string, displayName: string, description: string, defVal: boolean): Setting;

Expand All @@ -100,6 +135,7 @@ declare class Module {
* @param max The maximum value
* @param interval The precision of the setting
* @param defVal The default value
* @since 2.0.0
*/
addNumberSetting(name: string, displayName: string, description: string, min: number, max: number, interval: number, defVal: number): Setting;

Expand All @@ -109,6 +145,7 @@ declare class Module {
* @param displayName The name that shows in the menu
* @param description A short description of what the setting does
* @param defVal The default value
* @since 2.0.0
*/
addKeySetting(name: string, displayName: string, description: string, defVal: KeyCode): Setting;

Expand All @@ -118,6 +155,7 @@ declare class Module {
* @param displayName The name that shows in the menu
* @param description A short description of what the setting does
* @param defVal The default value
* @since 2.0.0
*/
addTextSetting(name: string, displayName: string, description: string, defVal: string): Setting;

Expand All @@ -127,6 +165,7 @@ declare class Module {
* @param displayName The name that shows in the menu
* @param description A short description of what the setting does
* @param defVal The default value
* @since 2.0.0
*/
addColorSetting(name: string, displayName: string, description: string, defVal: Color): Setting;
}
16 changes: 16 additions & 0 deletions definitions/feature/setting.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @since 2.0.0
*/
declare class Setting {
/**
* DO NOT USE - not implemented
Expand All @@ -6,28 +9,41 @@ declare class Setting {

/**
* The name of the setting
* @since 2.0.0
*/
readonly name: string;
/**
* @since 2.0.0
*/
readonly displayName: string;
/**
* @since 2.0.0
*/
readonly description: string;

/**
* @since 2.0.0
*/
toString(): string;

/**
* Gets the value of the setting. Could be null.
* @since 2.0.0
*/
getValue(): any;

/**
* Sets the setting value.
* @param value The value to set. Must be of type corresponding to the type of the setting.
* @since 2.0.0
*/
setValue(value: any): void;

/**
* Set that this setting will only show when another setting is on or off.
* @param settingName The setting that this setting will depend on (internal name).
* @param value The value the other setting needs to be for this setting to show
* @since 2.0.0
*/
setCondition(settingName: string, value?: boolean): void;
}
Loading