From 2af31e72275954e2fdf774c45c8b702abb95bff5 Mon Sep 17 00:00:00 2001 From: KlutzyBubbles Date: Sat, 10 Feb 2024 15:51:00 +1100 Subject: [PATCH] more changes --- types/color.d.ts | 1 - types/object.d.ts | 2 +- types/timer.d.ts | 2 +- types/turns.d.ts | 9 +++- types/ui.d.ts | 132 ---------------------------------------------- 5 files changed, 9 insertions(+), 137 deletions(-) diff --git a/types/color.d.ts b/types/color.d.ts index 03a95c7..1b6461d 100644 --- a/types/color.d.ts +++ b/types/color.d.ts @@ -112,7 +112,6 @@ interface Color extends ColorInput { } // Because capitalization is ignored, and custom colors can be added, a lot more indexers can be used -// TODO Check if indexing a not known color errors or undefined type ColorConstructor = { [index in ColorLiteralIgnoreCase]: Color; } & { diff --git a/types/object.d.ts b/types/object.d.ts index 80ae728..5a62b7d 100644 --- a/types/object.d.ts +++ b/types/object.d.ts @@ -1643,7 +1643,7 @@ interface GObject extends GlobalConstructor { */ attachInvisibleHider(this: void, id: string, hidden: boolean, players?: ColorLiteral[]): boolean; - UI: UI; + UI: UIConstructor; } interface GObjectConstructor { diff --git a/types/timer.d.ts b/types/timer.d.ts index dad7e16..f751204 100644 --- a/types/timer.d.ts +++ b/types/timer.d.ts @@ -46,7 +46,7 @@ type CreateTimer = { * * Will not be used by default */ - parameters?: any; + parameters?: CustomTableObject; /** * Length of time in seconds before the function is triggered. diff --git a/types/turns.d.ts b/types/turns.d.ts index 674ff20..77cb736 100644 --- a/types/turns.d.ts +++ b/types/turns.d.ts @@ -9,12 +9,12 @@ interface TurnsConstructor { /** * If the turn order is automatic or custom. 1=auto, 2=custom. */ - type: number; + type: TurnOrderType; /** * A table of strings, representing the player turn order. */ - order: string[]; + order: ColorLiteral[]; /** * Enable/disable reversing turn rotation direction. @@ -56,6 +56,11 @@ interface TurnsConstructor { getPreviousTurnColor(this: void): ColorLiteral; } +declare const enum TurnOrderType { + Auto = 1, + Custom = 2 +} + /** * Turns, a static global class, is the in-game turns system. It allows you to modify the player turns in the same way that the in-game Turns menu does. * diff --git a/types/ui.d.ts b/types/ui.d.ts index 44bb598..d506539 100644 --- a/types/ui.d.ts +++ b/types/ui.d.ts @@ -1,135 +1,3 @@ -interface UI { - /** - * Indicates whether (the server) has finished loading all UI custom assets. - */ - loading: boolean; - - /** - * Obtains the value of a specified attribute of a UI element. What it returns will typically be a string or a number. - * - * @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element. - * @param {string} attribute The name of the attribute you wish to get the value of. - * @returns {any} The value of the attribute. - */ - getAttribute(this: void, id: string, attribute: string): any; - - /** - * Returns the attributes and their values of a UI element. It only returns the attributes (and values) for elements that have had those attributes set by the user. - * - * @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element. - * @returns {Record} A table of attributes and their values. - */ - getAttributes(this: void, id: string): Record; - - /** - * Returns a table/array of custom assets. - * - * @returns {CustomAsset[]} A table/array of custom assets. - */ - getCustomAssets(this: void): CustomAsset[]; - - /** - * Obtains the value between elements tags, like: ValueToGet - * - * @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element. - * @returns {string} The value between elements tags. - */ - getValue(this: void, id: string): string; - - /** - * Returns the contents of the current UI formatted as XML. - * - * @returns {string} The contents of the current UI formatted as XML. - */ - getXml(this: void): string; - - /** - * Returns the contents of the current UI formatted as a table. - * - * @returns {XMLData} The contents of the current UI formatted as a table. - */ - getXmlTable(this: void): XMLData; - - /** - * Hides the given UI element. Unlike the "active" attribute, hide triggers animations. - * - * @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element. - * @returns {boolean} True if the UI element was hidden, false otherwise. - */ - hide(this: void, id: string): boolean; - - /** - * Sets the value of a specified attribute of a UI element. - * - * @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element. - * @param {string} attribute The name of the attribute you want to set the value of. - * @param {any} value The value to set for the attribute. - * @returns {boolean} True if the attribute was set, false otherwise. - */ - setAttribute(this: void, id: string, attribute: string, value: any): boolean; - - /** - * Updates the value of the supplied attributes of a UI element. You do not need to set every attribute with the data table, an element will continue using any previous values you do not overwrite. - * - * @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element. - * @param {Record} data A Table with key/value pairs representing attributes and their values. - * @returns {boolean} True if the attributes were set, false otherwise. - */ - setAttributes(this: void, id: string, data: Record): boolean; - - /** - * Replaces all classes on a UI element. - * - * @param {string} id The ID of the UI element that should have its classes replaced. - * @param {string} names Space separated class names. - * @returns {boolean} True if the classes were set, false otherwise. - */ - setClass(this: void, id: string, names: string): boolean; - - /** - * Sets/replaces the custom assets which your UI may make use of. - * - * @param {CustomAsset[]} assets A table/array containing sub-tables which each represent a custom asset. - * @returns {boolean} True if the custom assets were set, false otherwise. - */ - setCustomAssets(this: void, assets: CustomAsset[]): boolean; - - /** - * Updates the value between elements tags, like: ValueChanged - * - * @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element. - * @param {string} value The value to put between the element tags. - * @returns {boolean} True if the value was set, false otherwise. - */ - setValue(this: void, id: string, value: string): boolean; - - /** - * Sets/replaces the UI with the contents of the provided XML. - * - * @param {string} xml A string containing XML representing the desired UI. - * @param {CustomAsset} assets A table/array containing sub-tables which each represent a custom asset. - * @returns {boolean} True if the UI was set, false otherwise. - */ - setXml(this: void, xml: string, assets: CustomAsset): boolean; - - /** - * Sets/replaces the UI with the contents of the provided UI table. - * - * @param {XMLData} data The UI table to set the UI to. - * @param {CustomAsset} assets A table/array of custom assets. - * @returns {boolean} True if the UI was set, false otherwise. - */ - setXmlTable(this: void, data: XMLData, assets?: CustomAsset[]): boolean; - - /** - * Displays the given UI element. Unlike the "active" attribute, show triggers animations. - * - * @param {string} id The Id that was assigned, as an attribute, to the desired XML UI element. - * @returns {boolean} True if the UI element was shown, false otherwise. - */ - show(this: void, id: string): boolean; -} - interface UIConstructor { /** * Indicates whether (the server) has finished loading all UI custom assets.