bc-deeplib 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.types/declarations.d.ts +15 -0
- package/.types/elements.d.ts +38 -0
- package/.types/type-override.d.ts +3 -0
- package/README.md +1 -1
- package/package.json +28 -12
- package/public/styles/DeepLib.css +206 -0
- package/public/styles/Gratitude.css +23 -0
- package/src/Base/BaseModule.ts +45 -0
- package/src/Base/BaseSubscreen.ts +198 -0
- package/src/Base/Initialization.ts +83 -0
- package/src/Base/Modules.ts +16 -0
- package/src/Base/SettingDefinitions.ts +14 -0
- package/src/DeepLib.ts +33 -0
- package/src/Migrators/BaseMigrator.ts +4 -0
- package/src/Models/Base.ts +4 -0
- package/src/Models/Settings.ts +7 -0
- package/src/Modules/GUI.ts +123 -0
- package/src/Modules/Version.ts +89 -0
- package/src/Screens/Debug.ts +99 -0
- package/src/Screens/MainMenu.ts +138 -0
- package/src/Screens/Support.ts +99 -0
- package/src/Utilities/Data.ts +40 -0
- package/src/Utilities/Elements/.AdvancedElements.ts +70 -0
- package/src/Utilities/Elements/.ElementHelpers.ts +100 -0
- package/src/Utilities/Elements/Button.ts +54 -0
- package/src/Utilities/Elements/Checkbox.ts +63 -0
- package/src/Utilities/Elements/Input.ts +72 -0
- package/src/Utilities/Elements/Label.ts +50 -0
- package/src/Utilities/Elements/Tooltip.ts +30 -0
- package/src/Utilities/Logger.ts +79 -0
- package/src/Utilities/Messages.ts +36 -0
- package/src/Utilities/SDK.ts +104 -0
- package/src/Utilities/String.ts +31 -0
- package/src/Utilities/Style.ts +24 -0
- package/src/Utilities/Translation.ts +59 -0
- package/dist/Base/BaseModule.d.ts +0 -13
- package/dist/Base/BaseModule.js +0 -41
- package/dist/Base/BaseSetting.d.ts +0 -29
- package/dist/Base/BaseSetting.js +0 -152
- package/dist/Base/Modules.d.ts +0 -5
- package/dist/Base/Modules.js +0 -17
- package/dist/Base/SettingDefinitions.d.ts +0 -8
- package/dist/Base/SettingDefinitions.js +0 -19
- package/dist/Base/SettingUtils.d.ts +0 -17
- package/dist/Base/SettingUtils.js +0 -101
- package/dist/DeepLib.d.ts +0 -17
- package/dist/DeepLib.js +0 -33
- package/dist/Models/Base.d.ts +0 -4
- package/dist/Models/Base.js +0 -2
- package/dist/Models/Settings.d.ts +0 -6
- package/dist/Models/Settings.js +0 -2
- package/dist/Modules/Version.d.ts +0 -13
- package/dist/Modules/Version.js +0 -62
- package/dist/Screens/MainMenu.d.ts +0 -11
- package/dist/Screens/MainMenu.js +0 -80
- package/dist/Screens/Support.d.ts +0 -14
- package/dist/Screens/Support.js +0 -99
- package/dist/Utils/Data.d.ts +0 -5
- package/dist/Utils/Data.js +0 -42
- package/dist/Utils/Logger.d.ts +0 -4
- package/dist/Utils/Logger.js +0 -6
- package/dist/Utils/Messages.d.ts +0 -2
- package/dist/Utils/Messages.js +0 -32
- package/dist/Utils/RibbonMenu.d.ts +0 -9
- package/dist/Utils/RibbonMenu.js +0 -32
- package/dist/Utils/SDK.d.ts +0 -21
- package/dist/Utils/SDK.js +0 -75
- package/dist/Utils/String.d.ts +0 -5
- package/dist/Utils/String.js +0 -30
- package/dist/Utils/Translation.d.ts +0 -10
- package/dist/Utils/Translation.js +0 -43
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class Style {
|
|
2
|
+
static inject(id: string, styleSource: string) {
|
|
3
|
+
const isStyleLoaded = !!document.getElementById(id);
|
|
4
|
+
|
|
5
|
+
if (isStyleLoaded) return;
|
|
6
|
+
|
|
7
|
+
const styleElement = document.createElement('style');
|
|
8
|
+
styleElement.id = id;
|
|
9
|
+
styleElement.appendChild(document.createTextNode(styleSource));
|
|
10
|
+
document.head.appendChild(styleElement);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static eject(id: string) {
|
|
14
|
+
const style = document.getElementById(id);
|
|
15
|
+
if (!style) return;
|
|
16
|
+
|
|
17
|
+
style.remove();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static reload(id: string, styleSource: string) {
|
|
21
|
+
Style.eject(id);
|
|
22
|
+
Style.inject(id, styleSource);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
type TranslationDict = {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export class Localization {
|
|
6
|
+
private Translation: TranslationDict = {};
|
|
7
|
+
private static PathToTranslation: string;
|
|
8
|
+
|
|
9
|
+
constructor(options: {
|
|
10
|
+
pathToTranslationsFolder: string;
|
|
11
|
+
}) {
|
|
12
|
+
Localization.PathToTranslation = options.pathToTranslationsFolder.endsWith('/') ? options.pathToTranslationsFolder : options.pathToTranslationsFolder + '/';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static async init() {
|
|
16
|
+
const lang = TranslationLanguage.toLowerCase();
|
|
17
|
+
const translation = await Localization.fetchLanguageFile(lang);
|
|
18
|
+
|
|
19
|
+
if (lang === 'en') {
|
|
20
|
+
Localization.prototype.Translation = translation;
|
|
21
|
+
} else {
|
|
22
|
+
const fallbackTranslation = await Localization.fetchLanguageFile('en');
|
|
23
|
+
Localization.prototype.Translation = { ...fallbackTranslation, ...translation };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static getText(srcTag: string) {
|
|
28
|
+
return Localization.prototype.Translation?.[srcTag] || srcTag || '';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private static async fetchLanguageFile(lang: string): Promise<TranslationDict> {
|
|
32
|
+
const response = await fetch(`${Localization.PathToTranslation}${lang}.lang`);
|
|
33
|
+
|
|
34
|
+
if (lang !== 'en' && !response.ok) {
|
|
35
|
+
return this.fetchLanguageFile('en');
|
|
36
|
+
}
|
|
37
|
+
const langFileContent = await response.text();
|
|
38
|
+
|
|
39
|
+
return this.parseLanguageFile(langFileContent);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private static parseLanguageFile(content: string): TranslationDict {
|
|
43
|
+
const translations: TranslationDict = {};
|
|
44
|
+
const lines = content.split('\n');
|
|
45
|
+
|
|
46
|
+
for (const line of lines) {
|
|
47
|
+
if (line.trim() === '' || line.trim().startsWith('#')) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const [key, value] = line.split('=');
|
|
52
|
+
translations[key.trim()] = value.trim();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return translations;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const getText = (string: string): string => Localization.getText(string);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseSettingsModel } from "../Models/Base.js";
|
|
2
|
-
import { Subscreen } from "./SettingDefinitions.js";
|
|
3
|
-
export declare abstract class BaseModule {
|
|
4
|
-
get settingsScreen(): Subscreen | null;
|
|
5
|
-
get settingsStorage(): string | null;
|
|
6
|
-
get settings(): BaseSettingsModel;
|
|
7
|
-
get defaultSettings(): BaseSettingsModel | null;
|
|
8
|
-
Init(): void;
|
|
9
|
-
registerDefaultSettings(): void;
|
|
10
|
-
Load(): void;
|
|
11
|
-
Run(): void;
|
|
12
|
-
Unload(): void;
|
|
13
|
-
}
|
package/dist/Base/BaseModule.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseModule = void 0;
|
|
4
|
-
const Data_js_1 = require("../Utils/Data.js");
|
|
5
|
-
const SDK_js_1 = require("../Utils/SDK.js");
|
|
6
|
-
class BaseModule {
|
|
7
|
-
get settingsScreen() {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
get settingsStorage() {
|
|
11
|
-
return this.constructor.name;
|
|
12
|
-
}
|
|
13
|
-
get settings() {
|
|
14
|
-
if (!this.settingsStorage)
|
|
15
|
-
return {};
|
|
16
|
-
if (!(0, Data_js_1.PlayerStorage)(SDK_js_1.bcSdkMod.ModInfo.name)) {
|
|
17
|
-
Player[SDK_js_1.bcSdkMod.ModInfo.name] = {};
|
|
18
|
-
this.registerDefaultSettings();
|
|
19
|
-
}
|
|
20
|
-
else if (!(0, Data_js_1.PlayerStorage)(SDK_js_1.bcSdkMod.ModInfo.name)[this.settingsStorage])
|
|
21
|
-
this.registerDefaultSettings();
|
|
22
|
-
return (0, Data_js_1.PlayerStorage)(SDK_js_1.bcSdkMod.ModInfo.name)[this.settingsStorage];
|
|
23
|
-
}
|
|
24
|
-
get defaultSettings() {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
Init() {
|
|
28
|
-
this.registerDefaultSettings();
|
|
29
|
-
}
|
|
30
|
-
registerDefaultSettings() {
|
|
31
|
-
const storage = this.settingsStorage;
|
|
32
|
-
const defaults = this.defaultSettings;
|
|
33
|
-
if (!storage || !defaults)
|
|
34
|
-
return;
|
|
35
|
-
(0, Data_js_1.PlayerStorage)(SDK_js_1.bcSdkMod.ModInfo.name)[storage] = Object.assign(defaults, (0, Data_js_1.PlayerStorage)(SDK_js_1.bcSdkMod.ModInfo.name)[storage] ?? {});
|
|
36
|
-
}
|
|
37
|
-
Load() { }
|
|
38
|
-
Run() { }
|
|
39
|
-
Unload() { }
|
|
40
|
-
}
|
|
41
|
-
exports.BaseModule = BaseModule;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Setting } from "../../.types/setting.js";
|
|
2
|
-
import { BaseSettingsModel } from "../Models/Base.js";
|
|
3
|
-
import { BaseModule } from "./BaseModule.js";
|
|
4
|
-
export declare abstract class GuiSubscreen {
|
|
5
|
-
static START_X: number;
|
|
6
|
-
static START_Y: number;
|
|
7
|
-
static X_MOD: number;
|
|
8
|
-
static Y_MOD: number;
|
|
9
|
-
static POS_BAK: number;
|
|
10
|
-
static TEXT_ALIGN_BAK: CanvasTextAlign;
|
|
11
|
-
readonly module: BaseModule | null;
|
|
12
|
-
constructor(module?: BaseModule);
|
|
13
|
-
get name(): string;
|
|
14
|
-
get icon(): string;
|
|
15
|
-
get SubscreenName(): string;
|
|
16
|
-
setSubscreen(screen: GuiSubscreen | string | null): GuiSubscreen | null;
|
|
17
|
-
get settings(): BaseSettingsModel;
|
|
18
|
-
get multipageStructure(): Setting[][];
|
|
19
|
-
get structure(): Setting[];
|
|
20
|
-
get character(): Character;
|
|
21
|
-
getYPos(ix: number): number;
|
|
22
|
-
getXPos(ix: number): number;
|
|
23
|
-
hideElements(): void;
|
|
24
|
-
Load(): void;
|
|
25
|
-
Run(): void;
|
|
26
|
-
Click(): void;
|
|
27
|
-
Exit(): void;
|
|
28
|
-
Unload(): void;
|
|
29
|
-
}
|
package/dist/Base/BaseSetting.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GuiSubscreen = void 0;
|
|
4
|
-
const Modules_js_1 = require("./Modules.js");
|
|
5
|
-
const Data_js_1 = require("../Utils/Data.js");
|
|
6
|
-
const Translation_js_1 = require("../Utils/Translation.js");
|
|
7
|
-
const SettingDefinitions_js_1 = require("./SettingDefinitions.js");
|
|
8
|
-
const SettingUtils_js_1 = require("./SettingUtils.js");
|
|
9
|
-
class GuiSubscreen {
|
|
10
|
-
static START_X = 180;
|
|
11
|
-
static START_Y = 205;
|
|
12
|
-
static X_MOD = 950;
|
|
13
|
-
static Y_MOD = 75;
|
|
14
|
-
static POS_BAK = GuiSubscreen.START_X;
|
|
15
|
-
static TEXT_ALIGN_BAK;
|
|
16
|
-
module = null;
|
|
17
|
-
constructor(module) {
|
|
18
|
-
if (module)
|
|
19
|
-
this.module = module;
|
|
20
|
-
SettingDefinitions_js_1.SETTING_FUNC_NAMES.forEach((name) => {
|
|
21
|
-
const funcName = SettingDefinitions_js_1.SETTING_FUNC_PREFIX + SettingDefinitions_js_1.SETTING_NAME_PREFIX + this.name + name;
|
|
22
|
-
if (typeof this[name] === "function" && typeof window[funcName] !== "function")
|
|
23
|
-
window[funcName] = () => {
|
|
24
|
-
this[name]();
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
get name() {
|
|
29
|
-
return "UNKNOWN";
|
|
30
|
-
}
|
|
31
|
-
get icon() {
|
|
32
|
-
return "";
|
|
33
|
-
}
|
|
34
|
-
get SubscreenName() {
|
|
35
|
-
return SettingDefinitions_js_1.SETTING_NAME_PREFIX + this.constructor.name;
|
|
36
|
-
}
|
|
37
|
-
setSubscreen(screen) {
|
|
38
|
-
return (0, SettingDefinitions_js_1.setSubscreen)(screen);
|
|
39
|
-
}
|
|
40
|
-
get settings() {
|
|
41
|
-
return this.module?.settings;
|
|
42
|
-
}
|
|
43
|
-
get multipageStructure() {
|
|
44
|
-
return [[]];
|
|
45
|
-
}
|
|
46
|
-
get structure() {
|
|
47
|
-
return this.multipageStructure[Math.min(PreferencePageCurrent - 1, this.multipageStructure.length - 1)];
|
|
48
|
-
}
|
|
49
|
-
get character() {
|
|
50
|
-
return SettingUtils_js_1.GUI.instance?.currentCharacter;
|
|
51
|
-
}
|
|
52
|
-
getYPos(ix) {
|
|
53
|
-
return GuiSubscreen.START_Y + GuiSubscreen.Y_MOD * (ix % 9);
|
|
54
|
-
}
|
|
55
|
-
getXPos(ix) {
|
|
56
|
-
return GuiSubscreen.START_X + GuiSubscreen.X_MOD * Math.floor(ix / 9);
|
|
57
|
-
}
|
|
58
|
-
hideElements() {
|
|
59
|
-
this.multipageStructure.forEach((item, ix, arr) => {
|
|
60
|
-
if (ix != PreferencePageCurrent - 1) {
|
|
61
|
-
item.forEach((setting) => {
|
|
62
|
-
if (setting.type == "text" || setting.type == "number")
|
|
63
|
-
return;
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
Load() {
|
|
69
|
-
for (const module of (0, Modules_js_1.modules)()) {
|
|
70
|
-
if (!module.settingsScreen)
|
|
71
|
-
continue;
|
|
72
|
-
if (!Object.keys(module.settings).length)
|
|
73
|
-
module.registerDefaultSettings();
|
|
74
|
-
}
|
|
75
|
-
this.multipageStructure.forEach((s) => s.forEach((item) => {
|
|
76
|
-
switch (item.type) {
|
|
77
|
-
case "text":
|
|
78
|
-
let input = ElementCreateInput(item.id, "text", item.setting(), "255");
|
|
79
|
-
input.setAttribute("autocomplete", "off");
|
|
80
|
-
break;
|
|
81
|
-
case "number":
|
|
82
|
-
ElementCreateInput(item.id, "number", item.setting(), "255");
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}));
|
|
86
|
-
CharacterAppearanceForceUpCharacter = Player.MemberNumber ?? -1;
|
|
87
|
-
}
|
|
88
|
-
Run() {
|
|
89
|
-
GuiSubscreen.POS_BAK = GuiSubscreen.START_X;
|
|
90
|
-
GuiSubscreen.TEXT_ALIGN_BAK = MainCanvas.textAlign;
|
|
91
|
-
GuiSubscreen.START_X = 550;
|
|
92
|
-
MainCanvas.textAlign = "left";
|
|
93
|
-
DrawCharacter(Player, 50, 50, 0.9, false);
|
|
94
|
-
DrawText((0, Translation_js_1.getText)(`${this.name}.title`), GuiSubscreen.START_X, GuiSubscreen.START_Y - GuiSubscreen.Y_MOD, "Black", "#D7F6E9");
|
|
95
|
-
DrawButton(1815, 75, 90, 90, "", "White", "Icons/Exit.png", "Responsive");
|
|
96
|
-
if (this.multipageStructure.length > 1) {
|
|
97
|
-
MainCanvas.textAlign = "center";
|
|
98
|
-
PreferencePageChangeDraw(1595, 75, this.multipageStructure.length);
|
|
99
|
-
MainCanvas.textAlign = "left";
|
|
100
|
-
}
|
|
101
|
-
this.hideElements();
|
|
102
|
-
GuiSubscreen.START_X = GuiSubscreen.POS_BAK;
|
|
103
|
-
MainCanvas.textAlign = GuiSubscreen.TEXT_ALIGN_BAK;
|
|
104
|
-
}
|
|
105
|
-
Click() {
|
|
106
|
-
GuiSubscreen.POS_BAK = GuiSubscreen.START_X;
|
|
107
|
-
GuiSubscreen.TEXT_ALIGN_BAK = MainCanvas.textAlign;
|
|
108
|
-
GuiSubscreen.START_X = 550;
|
|
109
|
-
MainCanvas.textAlign = "left";
|
|
110
|
-
if (MouseIn(1815, 75, 90, 90))
|
|
111
|
-
return this.Exit();
|
|
112
|
-
if (this.multipageStructure.length > 1)
|
|
113
|
-
PreferencePageChangeClick(1595, 75, this.multipageStructure.length);
|
|
114
|
-
this.structure.forEach((item, ix, arr) => {
|
|
115
|
-
switch (item.type) {
|
|
116
|
-
case "checkbox":
|
|
117
|
-
if (MouseIn(this.getXPos(ix) + 600, this.getYPos(ix) - 32, 64, 64) && !item.disabled) {
|
|
118
|
-
item.setSetting(!item.setting());
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
case "button":
|
|
122
|
-
if (MouseIn(item.position[0], item.position[1], item.size[0], item.size[1]))
|
|
123
|
-
item.callback();
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
GuiSubscreen.START_X = GuiSubscreen.POS_BAK;
|
|
128
|
-
MainCanvas.textAlign = GuiSubscreen.TEXT_ALIGN_BAK;
|
|
129
|
-
}
|
|
130
|
-
Exit() {
|
|
131
|
-
this.multipageStructure.forEach((s) => s.forEach((item) => {
|
|
132
|
-
switch (item.type) {
|
|
133
|
-
case "number":
|
|
134
|
-
if (!CommonIsNumeric(ElementValue(item.id))) {
|
|
135
|
-
ElementRemove(item.id);
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
case "text":
|
|
139
|
-
item.setSetting(ElementValue(item.id));
|
|
140
|
-
ElementRemove(item.id);
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
}));
|
|
144
|
-
CharacterAppearanceForceUpCharacter = -1;
|
|
145
|
-
CharacterLoadCanvas(Player);
|
|
146
|
-
(0, SettingDefinitions_js_1.setSubscreen)("mainmenu");
|
|
147
|
-
(0, Data_js_1.dataStore)();
|
|
148
|
-
}
|
|
149
|
-
Unload() {
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
exports.GuiSubscreen = GuiSubscreen;
|
package/dist/Base/Modules.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { BaseModule } from "./BaseModule.js";
|
|
2
|
-
export declare const modulesMap: Map<string, BaseModule>;
|
|
3
|
-
export declare function modules(): BaseModule[];
|
|
4
|
-
export declare function registerModule<T extends BaseModule>(module: T): T;
|
|
5
|
-
export declare function getModule<T extends BaseModule>(moduleType: string): T;
|
package/dist/Base/Modules.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getModule = exports.registerModule = exports.modules = exports.modulesMap = void 0;
|
|
4
|
-
exports.modulesMap = new Map();
|
|
5
|
-
function modules() {
|
|
6
|
-
return [...exports.modulesMap.values()];
|
|
7
|
-
}
|
|
8
|
-
exports.modules = modules;
|
|
9
|
-
function registerModule(module) {
|
|
10
|
-
exports.modulesMap.set(module.constructor.name, module);
|
|
11
|
-
return module;
|
|
12
|
-
}
|
|
13
|
-
exports.registerModule = registerModule;
|
|
14
|
-
function getModule(moduleType) {
|
|
15
|
-
return exports.modulesMap.get(moduleType);
|
|
16
|
-
}
|
|
17
|
-
exports.getModule = getModule;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BaseModule } from "./BaseModule.js";
|
|
2
|
-
import { GuiSubscreen } from "./BaseSetting.js";
|
|
3
|
-
export declare let SETTING_NAME_PREFIX: string;
|
|
4
|
-
export declare const SETTING_FUNC_PREFIX: string;
|
|
5
|
-
export declare const SETTING_FUNC_NAMES: string[];
|
|
6
|
-
export type Subscreen = new (module: BaseModule) => GuiSubscreen;
|
|
7
|
-
export declare function getCurrentSubscreen(): GuiSubscreen | null;
|
|
8
|
-
export declare function setSubscreen(subscreen: GuiSubscreen | string | null): GuiSubscreen | null;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setSubscreen = exports.getCurrentSubscreen = exports.SETTING_FUNC_NAMES = exports.SETTING_FUNC_PREFIX = exports.SETTING_NAME_PREFIX = void 0;
|
|
4
|
-
const SettingUtils_js_1 = require("./SettingUtils.js");
|
|
5
|
-
exports.SETTING_NAME_PREFIX = "Mod";
|
|
6
|
-
exports.SETTING_FUNC_PREFIX = "PreferenceSubscreen";
|
|
7
|
-
exports.SETTING_FUNC_NAMES = ["Load", "Run", "Click", "Unload", "Exit"];
|
|
8
|
-
function getCurrentSubscreen() {
|
|
9
|
-
return SettingUtils_js_1.GUI.instance && SettingUtils_js_1.GUI.instance.currentSubscreen;
|
|
10
|
-
}
|
|
11
|
-
exports.getCurrentSubscreen = getCurrentSubscreen;
|
|
12
|
-
function setSubscreen(subscreen) {
|
|
13
|
-
if (!SettingUtils_js_1.GUI.instance) {
|
|
14
|
-
throw new Error("Attempt to set subscreen before init");
|
|
15
|
-
}
|
|
16
|
-
SettingUtils_js_1.GUI.instance.currentSubscreen = subscreen;
|
|
17
|
-
return SettingUtils_js_1.GUI.instance.currentSubscreen;
|
|
18
|
-
}
|
|
19
|
-
exports.setSubscreen = setSubscreen;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BaseModule } from "./BaseModule.js";
|
|
2
|
-
import { GuiSubscreen } from "./BaseSetting.js";
|
|
3
|
-
import { MainMenu } from '../Screens/MainMenu.js';
|
|
4
|
-
export declare class GUI extends BaseModule {
|
|
5
|
-
static instance: GUI | null;
|
|
6
|
-
private _subscreens;
|
|
7
|
-
private _mainMenu;
|
|
8
|
-
private _currentSubscreen;
|
|
9
|
-
get subscreens(): GuiSubscreen[];
|
|
10
|
-
get mainMenu(): MainMenu;
|
|
11
|
-
get currentSubscreen(): GuiSubscreen | null;
|
|
12
|
-
set currentSubscreen(subscreen: GuiSubscreen | string | null);
|
|
13
|
-
get currentCharacter(): Character;
|
|
14
|
-
constructor();
|
|
15
|
-
get defaultSettings(): null;
|
|
16
|
-
Load(): void;
|
|
17
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GUI = void 0;
|
|
4
|
-
const BaseModule_js_1 = require("./BaseModule.js");
|
|
5
|
-
const Modules_js_1 = require("./Modules.js");
|
|
6
|
-
const RibbonMenu_js_1 = require("../Utils/RibbonMenu.js");
|
|
7
|
-
const Translation_js_1 = require("../Utils/Translation.js");
|
|
8
|
-
const SettingDefinitions_js_1 = require("./SettingDefinitions.js");
|
|
9
|
-
const MainMenu_js_1 = require("../Screens/MainMenu.js");
|
|
10
|
-
const SDK_js_1 = require("../Utils/SDK.js");
|
|
11
|
-
class GUI extends BaseModule_js_1.BaseModule {
|
|
12
|
-
static instance = null;
|
|
13
|
-
_subscreens;
|
|
14
|
-
_mainMenu;
|
|
15
|
-
_currentSubscreen = null;
|
|
16
|
-
get subscreens() {
|
|
17
|
-
return this._subscreens;
|
|
18
|
-
}
|
|
19
|
-
get mainMenu() {
|
|
20
|
-
return this._mainMenu;
|
|
21
|
-
}
|
|
22
|
-
get currentSubscreen() {
|
|
23
|
-
return this._currentSubscreen;
|
|
24
|
-
}
|
|
25
|
-
set currentSubscreen(subscreen) {
|
|
26
|
-
if (this._currentSubscreen) {
|
|
27
|
-
this._currentSubscreen.Unload();
|
|
28
|
-
}
|
|
29
|
-
if (typeof subscreen === "string") {
|
|
30
|
-
const scr = this._subscreens?.find((s) => s.name === subscreen);
|
|
31
|
-
if (!scr)
|
|
32
|
-
throw `Failed to find screen name ${subscreen}`;
|
|
33
|
-
this._currentSubscreen = scr;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this._currentSubscreen = subscreen;
|
|
37
|
-
}
|
|
38
|
-
PreferenceMessage = "";
|
|
39
|
-
PreferencePageCurrent = 1;
|
|
40
|
-
let subscreenName = "";
|
|
41
|
-
if (this._currentSubscreen) {
|
|
42
|
-
subscreenName = SettingDefinitions_js_1.SETTING_NAME_PREFIX + this._currentSubscreen?.name;
|
|
43
|
-
this._currentSubscreen.Load();
|
|
44
|
-
}
|
|
45
|
-
PreferenceSubscreen = subscreenName;
|
|
46
|
-
}
|
|
47
|
-
get currentCharacter() {
|
|
48
|
-
return Player;
|
|
49
|
-
}
|
|
50
|
-
constructor() {
|
|
51
|
-
super();
|
|
52
|
-
if (GUI.instance) {
|
|
53
|
-
throw new Error("Duplicate initialization");
|
|
54
|
-
}
|
|
55
|
-
this._mainMenu = new MainMenu_js_1.MainMenu(this);
|
|
56
|
-
this._subscreens = [this._mainMenu];
|
|
57
|
-
GUI.instance = this;
|
|
58
|
-
}
|
|
59
|
-
get defaultSettings() {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
Load() {
|
|
63
|
-
for (const module of (0, Modules_js_1.modules)()) {
|
|
64
|
-
if (!module.settingsScreen)
|
|
65
|
-
continue;
|
|
66
|
-
this._subscreens.push(new module.settingsScreen(module));
|
|
67
|
-
}
|
|
68
|
-
this._mainMenu.subscreens = this._subscreens;
|
|
69
|
-
let modIndex = RibbonMenu_js_1.RibbonMenu.getModIndex(SDK_js_1.bcSdkMod.ModInfo.name);
|
|
70
|
-
SDK_js_1.bcSdkMod.prototype.hookFunction("PreferenceRun", SDK_js_1.HookPriority.OverrideBehavior, (args, next) => {
|
|
71
|
-
if (this._currentSubscreen) {
|
|
72
|
-
MainCanvas.textAlign = "left";
|
|
73
|
-
this._currentSubscreen.Run();
|
|
74
|
-
MainCanvas.textAlign = "center";
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
next(args);
|
|
78
|
-
RibbonMenu_js_1.RibbonMenu.drawModButton(modIndex, (modIndex) => {
|
|
79
|
-
DrawButton(1815, RibbonMenu_js_1.RibbonMenu.getYPos(modIndex), 90, 90, "", "White", "Icons/Arousal.png", (0, Translation_js_1.getText)("infosheet.button.responsive_popup"));
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
SDK_js_1.bcSdkMod.prototype.hookFunction("PreferenceClick", SDK_js_1.HookPriority.OverrideBehavior, (args, next) => {
|
|
83
|
-
if (this._currentSubscreen) {
|
|
84
|
-
this._currentSubscreen.Click();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
next(args);
|
|
88
|
-
RibbonMenu_js_1.RibbonMenu.handleModClick(modIndex, (modIndex) => {
|
|
89
|
-
(0, SettingDefinitions_js_1.setSubscreen)(new MainMenu_js_1.MainMenu(this));
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
SDK_js_1.bcSdkMod.prototype.hookFunction("InformationSheetExit", SDK_js_1.HookPriority.OverrideBehavior, (args, next) => {
|
|
93
|
-
if (this._currentSubscreen) {
|
|
94
|
-
this._currentSubscreen.Exit();
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
return next(args);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.GUI = GUI;
|
package/dist/DeepLib.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './Base/BaseModule.js';
|
|
2
|
-
export * from './Base/BaseSetting.js';
|
|
3
|
-
export * from './Base/Modules.js';
|
|
4
|
-
export * from './Base/SettingDefinitions.js';
|
|
5
|
-
export * from './Base/SettingUtils.js';
|
|
6
|
-
export * from './Models/Base.js';
|
|
7
|
-
export * from './Models/Settings.js';
|
|
8
|
-
export * from './Modules/Version.js';
|
|
9
|
-
export * from './Screens/MainMenu.js';
|
|
10
|
-
export * from './Screens/Support.js';
|
|
11
|
-
export * from './Utils/Data.js';
|
|
12
|
-
export * from './Utils/Logger.js';
|
|
13
|
-
export * from './Utils/Messages.js';
|
|
14
|
-
export * from './Utils/RibbonMenu.js';
|
|
15
|
-
export * from './Utils/SDK.js';
|
|
16
|
-
export * from './Utils/String.js';
|
|
17
|
-
export * from './Utils/Translation.js';
|
package/dist/DeepLib.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Base/BaseModule.js"), exports);
|
|
18
|
-
__exportStar(require("./Base/BaseSetting.js"), exports);
|
|
19
|
-
__exportStar(require("./Base/Modules.js"), exports);
|
|
20
|
-
__exportStar(require("./Base/SettingDefinitions.js"), exports);
|
|
21
|
-
__exportStar(require("./Base/SettingUtils.js"), exports);
|
|
22
|
-
__exportStar(require("./Models/Base.js"), exports);
|
|
23
|
-
__exportStar(require("./Models/Settings.js"), exports);
|
|
24
|
-
__exportStar(require("./Modules/Version.js"), exports);
|
|
25
|
-
__exportStar(require("./Screens/MainMenu.js"), exports);
|
|
26
|
-
__exportStar(require("./Screens/Support.js"), exports);
|
|
27
|
-
__exportStar(require("./Utils/Data.js"), exports);
|
|
28
|
-
__exportStar(require("./Utils/Logger.js"), exports);
|
|
29
|
-
__exportStar(require("./Utils/Messages.js"), exports);
|
|
30
|
-
__exportStar(require("./Utils/RibbonMenu.js"), exports);
|
|
31
|
-
__exportStar(require("./Utils/SDK.js"), exports);
|
|
32
|
-
__exportStar(require("./Utils/String.js"), exports);
|
|
33
|
-
__exportStar(require("./Utils/Translation.js"), exports);
|
package/dist/Models/Base.d.ts
DELETED
package/dist/Models/Base.js
DELETED
package/dist/Models/Settings.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseModule } from "../Base/BaseModule";
|
|
2
|
-
export declare class VersionModule extends BaseModule {
|
|
3
|
-
private static isItNewVersion;
|
|
4
|
-
static Version: string;
|
|
5
|
-
static NewVersionMessage: string;
|
|
6
|
-
constructor(newVersionMessage: string);
|
|
7
|
-
Load(): void;
|
|
8
|
-
static isNewVersion(current: string | undefined, candidate: string): boolean;
|
|
9
|
-
static sendNewVersionMessage(): void;
|
|
10
|
-
static saveVersion(): void;
|
|
11
|
-
static loadVersion(): string | undefined;
|
|
12
|
-
static checkIfNewVersion(): void;
|
|
13
|
-
}
|
package/dist/Modules/Version.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VersionModule = void 0;
|
|
4
|
-
const BaseModule_1 = require("../Base/BaseModule");
|
|
5
|
-
const Data_1 = require("../Utils/Data");
|
|
6
|
-
const Messages_1 = require("../Utils/Messages");
|
|
7
|
-
const SDK_1 = require("../Utils/SDK");
|
|
8
|
-
class VersionModule extends BaseModule_1.BaseModule {
|
|
9
|
-
static isItNewVersion = false;
|
|
10
|
-
static Version;
|
|
11
|
-
static NewVersionMessage;
|
|
12
|
-
constructor(newVersionMessage) {
|
|
13
|
-
super();
|
|
14
|
-
VersionModule.Version = SDK_1.bcSdkMod.ModInfo.version;
|
|
15
|
-
VersionModule.NewVersionMessage = newVersionMessage;
|
|
16
|
-
}
|
|
17
|
-
Load() {
|
|
18
|
-
SDK_1.bcSdkMod.prototype.hookFunction("ChatRoomSync", SDK_1.HookPriority.Observe, (args, next) => {
|
|
19
|
-
next(args);
|
|
20
|
-
if ((0, Data_1.PlayerStorage)(SDK_1.bcSdkMod.ModInfo.name).Global.ShowNewVersionMessage && VersionModule.isItNewVersion) {
|
|
21
|
-
VersionModule.sendNewVersionMessage();
|
|
22
|
-
}
|
|
23
|
-
}, 'VersionsModule');
|
|
24
|
-
}
|
|
25
|
-
static isNewVersion(current, candidate) {
|
|
26
|
-
if (current !== undefined) {
|
|
27
|
-
const CURRENT_ = current.split("."), CANDIDATE_ = candidate.split(".");
|
|
28
|
-
for (let i = 0; i < 3; i++) {
|
|
29
|
-
if (CURRENT_[i] === CANDIDATE_[i]) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
return CANDIDATE_[i] > CURRENT_[i];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (current === undefined || current === "" || !current) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
static sendNewVersionMessage() {
|
|
41
|
-
(0, Messages_1.sendLocalSmart)("DeepLibModNewVersion", VersionModule.NewVersionMessage);
|
|
42
|
-
}
|
|
43
|
-
static saveVersion() {
|
|
44
|
-
if ((0, Data_1.PlayerStorage)(SDK_1.bcSdkMod.ModInfo.name)) {
|
|
45
|
-
(0, Data_1.PlayerStorage)(SDK_1.bcSdkMod.ModInfo.name).Version = VersionModule.Version;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
static loadVersion() {
|
|
49
|
-
if ((0, Data_1.PlayerStorage)(SDK_1.bcSdkMod.ModInfo.name)?.Version) {
|
|
50
|
-
return (0, Data_1.PlayerStorage)(SDK_1.bcSdkMod.ModInfo.name).Version;
|
|
51
|
-
}
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
static checkIfNewVersion() {
|
|
55
|
-
let LoadedVersion = VersionModule.loadVersion();
|
|
56
|
-
if (VersionModule.isNewVersion(LoadedVersion, VersionModule.Version)) {
|
|
57
|
-
VersionModule.isItNewVersion = true;
|
|
58
|
-
VersionModule.saveVersion();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.VersionModule = VersionModule;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GuiSubscreen } from '../Base/BaseSetting.js';
|
|
2
|
-
import { GUI } from '../Base/SettingUtils.js';
|
|
3
|
-
export declare class MainMenu extends GuiSubscreen {
|
|
4
|
-
subscreens: GuiSubscreen[];
|
|
5
|
-
get name(): string;
|
|
6
|
-
constructor(module: GUI);
|
|
7
|
-
Load(): void;
|
|
8
|
-
Run(): void;
|
|
9
|
-
Click(): void;
|
|
10
|
-
Exit(): void;
|
|
11
|
-
}
|