bc-deeplib 1.0.0 → 1.0.2

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.
@@ -1,6 +1,9 @@
1
- import { PlayerStorage } from "../Utils/Data.js";
2
- import { GUI } from './SettingUtils.js';
3
- export class BaseModule {
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 {
4
7
  get settingsScreen() {
5
8
  return null;
6
9
  }
@@ -10,13 +13,13 @@ export class BaseModule {
10
13
  get settings() {
11
14
  if (!this.settingsStorage)
12
15
  return {};
13
- if (!PlayerStorage(GUI.modName)) {
14
- Player[GUI.modName] = {};
16
+ if (!(0, Data_js_1.PlayerStorage)(SDK_js_1.bcSdkMod.ModInfo.name)) {
17
+ Player[SDK_js_1.bcSdkMod.ModInfo.name] = {};
15
18
  this.registerDefaultSettings();
16
19
  }
17
- else if (!PlayerStorage(GUI.modName)[this.settingsStorage])
20
+ else if (!(0, Data_js_1.PlayerStorage)(SDK_js_1.bcSdkMod.ModInfo.name)[this.settingsStorage])
18
21
  this.registerDefaultSettings();
19
- return PlayerStorage(GUI.modName)[this.settingsStorage];
22
+ return (0, Data_js_1.PlayerStorage)(SDK_js_1.bcSdkMod.ModInfo.name)[this.settingsStorage];
20
23
  }
21
24
  get defaultSettings() {
22
25
  return null;
@@ -29,9 +32,10 @@ export class BaseModule {
29
32
  const defaults = this.defaultSettings;
30
33
  if (!storage || !defaults)
31
34
  return;
32
- PlayerStorage(GUI.modName)[storage] = Object.assign(defaults, PlayerStorage(GUI.modName)[storage] ?? {});
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] ?? {});
33
36
  }
34
37
  Load() { }
35
38
  Run() { }
36
39
  Unload() { }
37
40
  }
41
+ exports.BaseModule = BaseModule;
@@ -12,9 +12,6 @@ export declare abstract class GuiSubscreen {
12
12
  constructor(module?: BaseModule);
13
13
  get name(): string;
14
14
  get icon(): string;
15
- get label(): string;
16
- get message(): string;
17
- set message(message: string);
18
15
  get SubscreenName(): string;
19
16
  setSubscreen(screen: GuiSubscreen | string | null): GuiSubscreen | null;
20
17
  get settings(): BaseSettingsModel;
@@ -29,11 +26,4 @@ export declare abstract class GuiSubscreen {
29
26
  Click(): void;
30
27
  Exit(): void;
31
28
  Unload(): void;
32
- tooltip(text: string): void;
33
- drawCheckbox(label: string, description: string, value: boolean, order: number, disabled?: boolean): void;
34
- drawBetterButton(position: number[], size: number[], label: string, color: string, image?: string, disabled?: boolean): void;
35
- drawButton(label: string, color: string, order: number, XOffset: number, disabled?: boolean): void;
36
- elementHide(elementId: string): void;
37
- elementPosition(elementId: string, label: string, description: string, order: number, disabled?: boolean): void;
38
- drawLabel(label: string, description: string, order: number): void;
39
29
  }
@@ -1,8 +1,12 @@
1
- import { modules } from "./Modules.js";
2
- import { dataStore } from "../Utils/Data.js";
3
- import { SETTING_FUNC_NAMES, SETTING_FUNC_PREFIX, SETTING_NAME_PREFIX, setSubscreen } from "./SettingDefinitions.js";
4
- import { GUI } from "./SettingUtils.js";
5
- export class GuiSubscreen {
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 {
6
10
  static START_X = 180;
7
11
  static START_Y = 205;
8
12
  static X_MOD = 950;
@@ -13,10 +17,10 @@ export class GuiSubscreen {
13
17
  constructor(module) {
14
18
  if (module)
15
19
  this.module = module;
16
- SETTING_FUNC_NAMES.forEach((name) => {
17
- const fName = SETTING_FUNC_PREFIX + SETTING_NAME_PREFIX + this.name + name;
18
- if (typeof this[name] === "function" && typeof window[fName] !== "function")
19
- window[fName] = () => {
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] = () => {
20
24
  this[name]();
21
25
  };
22
26
  });
@@ -27,20 +31,11 @@ export class GuiSubscreen {
27
31
  get icon() {
28
32
  return "";
29
33
  }
30
- get label() {
31
- return "UNDEFINED SETTING SCREEN";
32
- }
33
- get message() {
34
- return PreferenceMessage;
35
- }
36
- set message(message) {
37
- PreferenceMessage = message;
38
- }
39
34
  get SubscreenName() {
40
- return SETTING_NAME_PREFIX + this.constructor.name;
35
+ return SettingDefinitions_js_1.SETTING_NAME_PREFIX + this.constructor.name;
41
36
  }
42
37
  setSubscreen(screen) {
43
- return setSubscreen(screen);
38
+ return (0, SettingDefinitions_js_1.setSubscreen)(screen);
44
39
  }
45
40
  get settings() {
46
41
  return this.module?.settings;
@@ -52,7 +47,7 @@ export class GuiSubscreen {
52
47
  return this.multipageStructure[Math.min(PreferencePageCurrent - 1, this.multipageStructure.length - 1)];
53
48
  }
54
49
  get character() {
55
- return GUI.instance?.currentCharacter;
50
+ return SettingUtils_js_1.GUI.instance?.currentCharacter;
56
51
  }
57
52
  getYPos(ix) {
58
53
  return GuiSubscreen.START_Y + GuiSubscreen.Y_MOD * (ix % 9);
@@ -65,13 +60,13 @@ export class GuiSubscreen {
65
60
  if (ix != PreferencePageCurrent - 1) {
66
61
  item.forEach((setting) => {
67
62
  if (setting.type == "text" || setting.type == "number")
68
- this.elementHide(setting.id);
63
+ return;
69
64
  });
70
65
  }
71
66
  });
72
67
  }
73
68
  Load() {
74
- for (const module of modules()) {
69
+ for (const module of (0, Modules_js_1.modules)()) {
75
70
  if (!module.settingsScreen)
76
71
  continue;
77
72
  if (!Object.keys(module.settings).length)
@@ -96,6 +91,7 @@ export class GuiSubscreen {
96
91
  GuiSubscreen.START_X = 550;
97
92
  MainCanvas.textAlign = "left";
98
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");
99
95
  DrawButton(1815, 75, 90, 90, "", "White", "Icons/Exit.png", "Responsive");
100
96
  if (this.multipageStructure.length > 1) {
101
97
  MainCanvas.textAlign = "center";
@@ -103,23 +99,6 @@ export class GuiSubscreen {
103
99
  MainCanvas.textAlign = "left";
104
100
  }
105
101
  this.hideElements();
106
- this.structure.forEach((item, ix, arr) => {
107
- switch (item.type) {
108
- case "checkbox":
109
- this.drawCheckbox(item.label, item.description, item.setting(), ix, item.disabled);
110
- break;
111
- case "text":
112
- case "number":
113
- this.elementPosition(item.id, item.label, item.description, ix, item.disabled);
114
- break;
115
- case "label":
116
- this.drawLabel(item.label, item.description, ix);
117
- break;
118
- case "button":
119
- this.drawBetterButton(item.position, item.size, item.label, item.color, item.image, item.disabled);
120
- break;
121
- }
122
- });
123
102
  GuiSubscreen.START_X = GuiSubscreen.POS_BAK;
124
103
  MainCanvas.textAlign = GuiSubscreen.TEXT_ALIGN_BAK;
125
104
  }
@@ -164,47 +143,10 @@ export class GuiSubscreen {
164
143
  }));
165
144
  CharacterAppearanceForceUpCharacter = -1;
166
145
  CharacterLoadCanvas(Player);
167
- setSubscreen("mainmenu");
168
- dataStore(GUI.modName);
146
+ (0, SettingDefinitions_js_1.setSubscreen)("mainmenu");
147
+ (0, Data_js_1.dataStore)();
169
148
  }
170
149
  Unload() {
171
150
  }
172
- tooltip(text) {
173
- drawTooltip(300, 850, 1400, text, "left");
174
- }
175
- drawCheckbox(label, description, value, order, disabled = false) {
176
- var isHovering = MouseIn(this.getXPos(order), this.getYPos(order) - 32, 600, 64);
177
- DrawCheckbox(this.getXPos(order) + 600, this.getYPos(order) - 32, 64, 64, "", value ?? false, disabled);
178
- }
179
- drawBetterButton(position, size, label, color, image = "", disabled = false) {
180
- var isHovering = MouseIn(position[0], position[1] - 32, size[0], size[1]);
181
- DrawButton(position[0], position[1], size[0], size[1], "", color, "", "", disabled);
182
- DrawImageResize(image, position[0] + 10, position[1] + 10, 60, 60);
183
- }
184
- drawButton(label, color, order, XOffset, disabled = false) {
185
- var isHovering = MouseIn(this.getXPos(order) + XOffset, this.getYPos(order) - 32, 200, 64);
186
- DrawButton(this.getXPos(order) + XOffset, this.getYPos(order) - 32, 200, 64, "", color, "", "", disabled);
187
- }
188
- elementHide(elementId) {
189
- ElementPosition(elementId, -999, -999, 1, 1);
190
- }
191
- elementPosition(elementId, label, description, order, disabled = false) {
192
- var isHovering = MouseIn(this.getXPos(order), this.getYPos(order) - 32, 600, 64);
193
- ElementPosition(elementId, this.getXPos(order) + 750 + 225, this.getYPos(order), 800, 64);
194
- if (disabled)
195
- ElementSetAttribute(elementId, "disabled", "true");
196
- if (!disabled)
197
- document.getElementById(elementId)?.removeAttribute("disabled");
198
- }
199
- drawLabel(label, description, order) {
200
- var isHovering = MouseIn(this.getXPos(order), this.getYPos(order) - 32, 600, 64);
201
- }
202
- }
203
- function drawTooltip(x, y, width, text, align) {
204
- const bak = MainCanvas.textAlign;
205
- MainCanvas.textAlign = align;
206
- DrawRect(x, y, width, 65, "#ffff88");
207
- DrawEmptyRect(x, y, width, 65, "Black");
208
- DrawTextFit(text, align === "left" ? x + 3 : x + width / 2, y + 33, width - 6, "black");
209
- MainCanvas.textAlign = bak;
210
151
  }
152
+ exports.GuiSubscreen = GuiSubscreen;
@@ -1,11 +1,17 @@
1
- export const modulesMap = new Map();
2
- export function modules() {
3
- return [...modulesMap.values()];
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()];
4
7
  }
5
- export function registerModule(module) {
6
- modulesMap.set(module.constructor.name, module);
8
+ exports.modules = modules;
9
+ function registerModule(module) {
10
+ exports.modulesMap.set(module.constructor.name, module);
7
11
  return module;
8
12
  }
9
- export function getModule(moduleType) {
10
- return modulesMap.get(moduleType);
13
+ exports.registerModule = registerModule;
14
+ function getModule(moduleType) {
15
+ return exports.modulesMap.get(moduleType);
11
16
  }
17
+ exports.getModule = getModule;
@@ -1,7 +1,7 @@
1
1
  import { BaseModule } from "./BaseModule.js";
2
2
  import { GuiSubscreen } from "./BaseSetting.js";
3
+ export declare let SETTING_NAME_PREFIX: string;
3
4
  export declare const SETTING_FUNC_PREFIX: string;
4
- export declare const SETTING_NAME_PREFIX: string;
5
5
  export declare const SETTING_FUNC_NAMES: string[];
6
6
  export type Subscreen = new (module: BaseModule) => GuiSubscreen;
7
7
  export declare function getCurrentSubscreen(): GuiSubscreen | null;
@@ -1,14 +1,19 @@
1
- import { GUI } from "./SettingUtils.js";
2
- export const SETTING_FUNC_PREFIX = "PreferenceSubscreen";
3
- export const SETTING_NAME_PREFIX = "BCR";
4
- export const SETTING_FUNC_NAMES = ["Load", "Run", "Click", "Unload", "Exit"];
5
- export function getCurrentSubscreen() {
6
- return GUI.instance && GUI.instance.currentSubscreen;
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;
7
10
  }
8
- export function setSubscreen(subscreen) {
9
- if (!GUI.instance) {
11
+ exports.getCurrentSubscreen = getCurrentSubscreen;
12
+ function setSubscreen(subscreen) {
13
+ if (!SettingUtils_js_1.GUI.instance) {
10
14
  throw new Error("Attempt to set subscreen before init");
11
15
  }
12
- GUI.instance.currentSubscreen = subscreen;
13
- return GUI.instance.currentSubscreen;
16
+ SettingUtils_js_1.GUI.instance.currentSubscreen = subscreen;
17
+ return SettingUtils_js_1.GUI.instance.currentSubscreen;
14
18
  }
19
+ exports.setSubscreen = setSubscreen;
@@ -3,7 +3,6 @@ import { GuiSubscreen } from "./BaseSetting.js";
3
3
  import { MainMenu } from '../Screens/MainMenu.js';
4
4
  export declare class GUI extends BaseModule {
5
5
  static instance: GUI | null;
6
- static modName: string | null;
7
6
  private _subscreens;
8
7
  private _mainMenu;
9
8
  private _currentSubscreen;
@@ -12,7 +11,7 @@ export declare class GUI extends BaseModule {
12
11
  get currentSubscreen(): GuiSubscreen | null;
13
12
  set currentSubscreen(subscreen: GuiSubscreen | string | null);
14
13
  get currentCharacter(): Character;
15
- constructor(ModName: string);
14
+ constructor();
16
15
  get defaultSettings(): null;
17
16
  Load(): void;
18
17
  }
@@ -1,10 +1,15 @@
1
- import { BaseModule } from "./BaseModule.js";
2
- import { modules } from "./Modules.js";
3
- import { SETTING_NAME_PREFIX } from "./SettingDefinitions.js";
4
- import { MainMenu } from '../Screens/MainMenu.js';
5
- export class GUI extends BaseModule {
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 {
6
12
  static instance = null;
7
- static modName = null;
8
13
  _subscreens;
9
14
  _mainMenu;
10
15
  _currentSubscreen = null;
@@ -34,7 +39,7 @@ export class GUI extends BaseModule {
34
39
  PreferencePageCurrent = 1;
35
40
  let subscreenName = "";
36
41
  if (this._currentSubscreen) {
37
- subscreenName = SETTING_NAME_PREFIX + this._currentSubscreen?.name;
42
+ subscreenName = SettingDefinitions_js_1.SETTING_NAME_PREFIX + this._currentSubscreen?.name;
38
43
  this._currentSubscreen.Load();
39
44
  }
40
45
  PreferenceSubscreen = subscreenName;
@@ -42,25 +47,55 @@ export class GUI extends BaseModule {
42
47
  get currentCharacter() {
43
48
  return Player;
44
49
  }
45
- constructor(ModName) {
50
+ constructor() {
46
51
  super();
47
52
  if (GUI.instance) {
48
53
  throw new Error("Duplicate initialization");
49
54
  }
50
- this._mainMenu = new MainMenu(this);
55
+ this._mainMenu = new MainMenu_js_1.MainMenu(this);
51
56
  this._subscreens = [this._mainMenu];
52
- GUI.modName = ModName;
53
57
  GUI.instance = this;
54
58
  }
55
59
  get defaultSettings() {
56
60
  return null;
57
61
  }
58
62
  Load() {
59
- for (const module of modules()) {
63
+ for (const module of (0, Modules_js_1.modules)()) {
60
64
  if (!module.settingsScreen)
61
65
  continue;
62
66
  this._subscreens.push(new module.settingsScreen(module));
63
67
  }
64
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
+ });
65
99
  }
66
100
  }
101
+ exports.GUI = GUI;
package/dist/DeepLib.d.ts CHANGED
@@ -3,3 +3,15 @@ export * from './Base/BaseSetting.js';
3
3
  export * from './Base/Modules.js';
4
4
  export * from './Base/SettingDefinitions.js';
5
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 CHANGED
@@ -1,5 +1,33 @@
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';
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);
@@ -1,3 +1,4 @@
1
1
  export type BaseSettingsModel = {
2
2
  ModEnabled: boolean;
3
+ ShowNewVersionMessage: boolean;
3
4
  };
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,6 @@
1
+ import { BaseSettingsModel } from './Base';
1
2
  export type SettingsModel = {
2
3
  [x: string]: any;
4
+ Global: BaseSettingsModel;
3
5
  Version: string;
4
6
  };
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,62 @@
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,6 +1,9 @@
1
- import { GuiSubscreen } from '../Base/BaseSetting.js';
2
- import { GUI } from '../Base/SettingUtils.js';
3
- export class MainMenu extends GuiSubscreen {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MainMenu = void 0;
4
+ const BaseSetting_js_1 = require("../Base/BaseSetting.js");
5
+ const SettingUtils_js_1 = require("../Base/SettingUtils.js");
6
+ class MainMenu extends BaseSetting_js_1.GuiSubscreen {
4
7
  subscreens = [];
5
8
  get name() {
6
9
  return 'mainmenu';
@@ -10,16 +13,16 @@ export class MainMenu extends GuiSubscreen {
10
13
  this.subscreens = module.subscreens;
11
14
  }
12
15
  Load() {
13
- if (!GUI.instance?.currentSubscreen) {
16
+ if (!SettingUtils_js_1.GUI.instance?.currentSubscreen) {
14
17
  this.setSubscreen(this);
15
18
  return;
16
19
  }
17
20
  super.Load();
18
21
  }
19
22
  Run() {
20
- let tmp = GuiSubscreen.START_X;
23
+ let tmp = BaseSetting_js_1.GuiSubscreen.START_X;
21
24
  var prev = MainCanvas.textAlign;
22
- GuiSubscreen.START_X = 550;
25
+ BaseSetting_js_1.GuiSubscreen.START_X = 550;
23
26
  MainCanvas.textAlign = 'left';
24
27
  DrawCharacter(Player, 50, 50, 0.9, false);
25
28
  DrawButton(1815, 75, 90, 90, '', 'White', 'Icons/Exit.png');
@@ -30,8 +33,8 @@ export class MainMenu extends GuiSubscreen {
30
33
  const PY = i % 6;
31
34
  if (screen.name == 'mainmenu')
32
35
  continue;
33
- DrawButton(GuiSubscreen.START_X + 430 * PX, 190 + 120 * PY, 450, 90, '', 'White', '', '');
34
- DrawImageResize(screen.icon, GuiSubscreen.START_X + 430 * PX + 10, 190 + 120 * PY + 10, 70, 70);
36
+ DrawButton(BaseSetting_js_1.GuiSubscreen.START_X + 430 * PX, 190 + 120 * PY, 450, 90, '', 'White', '', '');
37
+ DrawImageResize(screen.icon, BaseSetting_js_1.GuiSubscreen.START_X + 430 * PX + 10, 190 + 120 * PY + 10, 70, 70);
35
38
  MainCanvas.textAlign = 'left';
36
39
  MainCanvas.textAlign = 'center';
37
40
  i++;
@@ -46,27 +49,27 @@ export class MainMenu extends GuiSubscreen {
46
49
  DrawButton(1500, 830, 405, 80, '', '#49225C');
47
50
  DrawImageResize('Assets/Female3DCG/Emoticon/Coffee/Icon.png', 1510, 840, 60, 60);
48
51
  DrawTextFit('Support Me❤', 1580, 870, 320, 'Black');
49
- GuiSubscreen.START_X = tmp;
52
+ BaseSetting_js_1.GuiSubscreen.START_X = tmp;
50
53
  MainCanvas.textAlign = prev;
51
54
  }
52
55
  Click() {
53
56
  if (MouseIn(1815, 75, 90, 90))
54
57
  return this.Exit();
55
- let tmp = GuiSubscreen.START_X;
56
- GuiSubscreen.START_X = 550;
58
+ let tmp = BaseSetting_js_1.GuiSubscreen.START_X;
59
+ BaseSetting_js_1.GuiSubscreen.START_X = 550;
57
60
  let i = 0;
58
61
  for (const screen of this.subscreens) {
59
62
  const PX = Math.floor(i / 6);
60
63
  const PY = i % 6;
61
64
  if (screen.name == 'mainmenu')
62
65
  continue;
63
- if (MouseIn(GuiSubscreen.START_X + 430 * PX, 190 + 120 * PY, 450, 90)) {
66
+ if (MouseIn(BaseSetting_js_1.GuiSubscreen.START_X + 430 * PX, 190 + 120 * PY, 450, 90)) {
64
67
  this.setSubscreen(screen);
65
68
  return;
66
69
  }
67
70
  i++;
68
71
  }
69
- GuiSubscreen.START_X = tmp;
72
+ BaseSetting_js_1.GuiSubscreen.START_X = tmp;
70
73
  }
71
74
  Exit() {
72
75
  CharacterAppearanceForceUpCharacter = -1;
@@ -74,3 +77,4 @@ export class MainMenu extends GuiSubscreen {
74
77
  this.setSubscreen(null);
75
78
  }
76
79
  }
80
+ exports.MainMenu = MainMenu;
@@ -1,6 +1,10 @@
1
- import { GuiSubscreen } from '../Base/BaseSetting.js';
2
- export class GuiSupport extends GuiSubscreen {
3
- static thankYouList = ['Ellena'];
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuiSupport = void 0;
4
+ const BaseSetting_js_1 = require("../Base/BaseSetting.js");
5
+ const Translation_js_1 = require("../Utils/Translation.js");
6
+ class GuiSupport extends BaseSetting_js_1.GuiSubscreen {
7
+ static thankYouList = ['Ellena', 'weboos'];
4
8
  static thankYouNext = 0;
5
9
  static thankYou = '';
6
10
  get name() {
@@ -10,7 +14,7 @@ export class GuiSupport extends GuiSubscreen {
10
14
  return [
11
15
  {
12
16
  type: 'button',
13
- position: [GuiSubscreen.START_X, GuiSubscreen.START_Y],
17
+ position: [BaseSetting_js_1.GuiSubscreen.START_X, BaseSetting_js_1.GuiSubscreen.START_Y],
14
18
  size: [405, 80],
15
19
  label: 'support.button.ko-fi',
16
20
  color: '#49225C',
@@ -22,7 +26,7 @@ export class GuiSupport extends GuiSubscreen {
22
26
  },
23
27
  {
24
28
  type: 'any',
25
- position: [GuiSubscreen.START_X, GuiSubscreen.START_Y + GuiSubscreen.Y_MOD + 20],
29
+ position: [BaseSetting_js_1.GuiSubscreen.START_X, BaseSetting_js_1.GuiSubscreen.START_Y + BaseSetting_js_1.GuiSubscreen.Y_MOD + 20],
26
30
  size: [405, 80],
27
31
  label: 'support.button.patreon',
28
32
  color: '#49225C',
@@ -37,7 +41,7 @@ export class GuiSupport extends GuiSubscreen {
37
41
  static getSupporter() {
38
42
  if (GuiSupport.thankYouNext < CommonTime())
39
43
  GuiSupport.doNextThankYou();
40
- return `${'support.other.thankyou'}, ${GuiSupport.thankYou}`;
44
+ return `${(0, Translation_js_1.getText)('support.other.thankyou')}, ${GuiSupport.thankYou}`;
41
45
  }
42
46
  static doNextThankYou() {
43
47
  if (GuiSupport.thankYou && GuiSupport.thankYouList.length < 2)
@@ -47,9 +51,9 @@ export class GuiSupport extends GuiSubscreen {
47
51
  }
48
52
  Load() {
49
53
  GuiSupport.doNextThankYou();
50
- ElementCreateDiv('ResponsiveGratitude');
51
- let elm = document.getElementById('ResponsiveGratitude');
52
- ElementContent('ResponsiveGratitude', gratitudeHtml);
54
+ ElementCreateDiv('DeepLibGratitude');
55
+ let elm = document.getElementById('DeepLibGratitude');
56
+ ElementContent('DeepLibGratitude', gratitudeHtml);
53
57
  const font = MainCanvas.canvas.clientWidth <= MainCanvas.canvas.clientHeight * 2
54
58
  ? MainCanvas.canvas.clientWidth / 50
55
59
  : MainCanvas.canvas.clientHeight / 25;
@@ -61,19 +65,20 @@ export class GuiSupport extends GuiSubscreen {
61
65
  }
62
66
  Run() {
63
67
  super.Run();
64
- let tmp = GuiSubscreen.START_X;
65
- GuiSubscreen.START_X = 550;
66
- DrawText(GuiSupport.getSupporter(), GuiSubscreen.START_X + 300, GuiSubscreen.START_Y - GuiSubscreen.Y_MOD, 'Black', '#D7F6E9');
67
- GuiSubscreen.START_X = tmp;
68
+ let tmp = BaseSetting_js_1.GuiSubscreen.START_X;
69
+ BaseSetting_js_1.GuiSubscreen.START_X = 550;
70
+ DrawText(GuiSupport.getSupporter(), BaseSetting_js_1.GuiSubscreen.START_X + 300, BaseSetting_js_1.GuiSubscreen.START_Y - BaseSetting_js_1.GuiSubscreen.Y_MOD, 'Black', '#D7F6E9');
71
+ BaseSetting_js_1.GuiSubscreen.START_X = tmp;
68
72
  }
69
73
  Click() {
70
74
  super.Click();
71
75
  }
72
76
  Exit() {
73
- ElementRemove('ResponsiveGratitude');
77
+ ElementRemove('Gratitude');
74
78
  super.Exit();
75
79
  }
76
80
  }
81
+ exports.GuiSupport = GuiSupport;
77
82
  const gratitudeHtml = `
78
83
  <h1 class="ResponsiveH">Dear Supporters!</h1>
79
84
  <p class="ResponsiveP">
@@ -1,4 +1,5 @@
1
- export declare const PlayerStorage: (modName: string) => any;
2
- export declare const ExtensionStorage: (modName: string) => any;
3
- export declare function dataTake(modName: string): void;
4
- export declare function dataStore(modName: string): void;
1
+ import { SettingsModel } from '../Models/Settings.js';
2
+ export declare const PlayerStorage: (modName: string) => SettingsModel;
3
+ export declare const ExtensionStorage: (modName: string) => string;
4
+ export declare function dataTake(): void;
5
+ export declare function dataStore(): void;
@@ -1,27 +1,42 @@
1
- import { modules } from '../DeepLib.js';
2
- import { _String } from "./String.js";
3
- export const PlayerStorage = (modName) => Player[modName];
4
- export const ExtensionStorage = (modName) => Player.ExtensionSettings[modName];
5
- export function dataTake(modName) {
6
- if (ExtensionStorage(modName)) {
7
- Player[modName] = JSON.parse(LZString.decompressFromBase64(ExtensionStorage(modName)));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataStore = exports.dataTake = exports.ExtensionStorage = exports.PlayerStorage = void 0;
4
+ const SDK_js_1 = require("./SDK.js");
5
+ const DeepLib_js_1 = require("../DeepLib.js");
6
+ const String_js_1 = require("./String.js");
7
+ const PlayerStorage = (modName) => (typeof Player?.[modName] === 'object' ? CommonCloneDeep(Player?.[modName]) : undefined);
8
+ exports.PlayerStorage = PlayerStorage;
9
+ const ExtensionStorage = (modName) => Player.ExtensionSettings[modName];
10
+ exports.ExtensionStorage = ExtensionStorage;
11
+ function dataTake() {
12
+ const modName = SDK_js_1.bcSdkMod.ModInfo.name;
13
+ if ((0, exports.ExtensionStorage)(modName)) {
14
+ Player[modName] = JSON.parse(LZString.decompressFromBase64((0, exports.ExtensionStorage)(modName)));
8
15
  }
9
16
  else {
10
17
  Player[modName] = {};
11
18
  }
12
19
  }
13
- export function dataStore(modName) {
14
- if (!ExtensionStorage(modName))
15
- Player.ExtensionSettings[modName] = "";
16
- let Data = {
17
- Version: "1.0.0"
20
+ exports.dataTake = dataTake;
21
+ function dataStore() {
22
+ const modName = SDK_js_1.bcSdkMod.ModInfo.name;
23
+ const modVersion = SDK_js_1.bcSdkMod.ModInfo.version;
24
+ if (!(0, exports.ExtensionStorage)(modName))
25
+ Player.ExtensionSettings[modName] = '';
26
+ const Data = {
27
+ Global: {
28
+ ModEnabled: (0, exports.PlayerStorage)(modName).Global.ModEnabled,
29
+ ShowNewVersionMessage: (0, exports.PlayerStorage)(modName).Global.ShowNewVersionMessage
30
+ },
31
+ Version: modVersion
18
32
  };
19
- for (let module of modules()) {
33
+ for (let module of (0, DeepLib_js_1.modules)()) {
20
34
  if (!module.settingsStorage)
21
35
  continue;
22
- Data[module.settingsStorage] = PlayerStorage(modName)[module.settingsStorage];
36
+ Data[module.settingsStorage] = (0, exports.PlayerStorage)(modName)[module.settingsStorage];
23
37
  }
24
38
  ;
25
- Player.ExtensionSettings[modName] = _String.encode(Data);
39
+ Player.ExtensionSettings[modName] = String_js_1._String.encode(Data);
26
40
  ServerPlayerExtensionSettingsSync(modName);
27
41
  }
42
+ exports.dataStore = dataStore;
@@ -0,0 +1,4 @@
1
+ declare class Logger {
2
+ }
3
+ export declare const logger: Logger;
4
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logger = void 0;
4
+ class Logger {
5
+ }
6
+ exports.logger = new Logger();
@@ -0,0 +1,2 @@
1
+ export declare function sendLocalSmart(id: string, message: string, timeoutInSeconds?: number): void;
2
+ export declare function sendAction(msg: string): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendAction = exports.sendLocalSmart = void 0;
4
+ function sendLocalSmart(id, message, timeoutInSeconds) {
5
+ const div = document.createElement('div');
6
+ div.id = id;
7
+ div.setAttribute('class', 'ChatMessage DeepLibMessage');
8
+ div.setAttribute('data-time', ChatRoomCurrentTime());
9
+ div.setAttribute('data-sender', Player?.MemberNumber + '');
10
+ div.innerHTML =
11
+ message.replaceAll('\n\t', '') +
12
+ `<br><a class="DeepLibText" onClick='document.getElementById("${id}").remove();'><b>Close (Click)</b></a>`;
13
+ ChatRoomAppendChat(div);
14
+ if (!timeoutInSeconds)
15
+ return;
16
+ setTimeout(() => div?.remove(), timeoutInSeconds * 1000);
17
+ }
18
+ exports.sendLocalSmart = sendLocalSmart;
19
+ function sendAction(msg) {
20
+ ServerSend('ChatRoomChat', {
21
+ Content: 'Beep',
22
+ Type: 'Action',
23
+ Dictionary: [
24
+ { Tag: 'Beep', Text: 'msg' },
25
+ { Tag: '发送私聊', Text: 'msg' },
26
+ { Tag: 'Biep', Text: 'msg' },
27
+ { Tag: 'Sonner', Text: 'msg' },
28
+ { Tag: 'msg', Text: msg }
29
+ ]
30
+ });
31
+ }
32
+ exports.sendAction = sendAction;
@@ -0,0 +1,9 @@
1
+ export declare class RibbonMenu {
2
+ private static START_Y;
3
+ private static MOD_Y;
4
+ static getYPos(modIndex: number): number;
5
+ static registerMod(modName: string): void;
6
+ static getModIndex(modName: string): number | undefined;
7
+ static drawModButton(modIndex: number | undefined, callback: (modIndex: number) => void): void;
8
+ static handleModClick(modIndex: number | undefined, callback: (modIndex: number) => void): void;
9
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RibbonMenu = void 0;
4
+ class RibbonMenu {
5
+ static START_Y = 820;
6
+ static MOD_Y = 110;
7
+ static getYPos(modIndex) {
8
+ return this.START_Y - this.MOD_Y * (modIndex % 6);
9
+ }
10
+ static registerMod(modName) {
11
+ if (!window.RibbonMenuMods)
12
+ window.RibbonMenuMods = [];
13
+ if (window.RibbonMenuMods.length >= 6)
14
+ return console.warn(`${modName} can't be added to Ribbon Menu. It is full`);
15
+ window.RibbonMenuMods.push(modName);
16
+ }
17
+ static getModIndex(modName) {
18
+ return window.RibbonMenuMods?.indexOf(modName);
19
+ }
20
+ static drawModButton(modIndex, callback) {
21
+ if (PreferenceSubscreen === "" && modIndex !== undefined)
22
+ callback(modIndex);
23
+ return;
24
+ }
25
+ static handleModClick(modIndex, callback) {
26
+ if (PreferenceSubscreen === "" && modIndex !== undefined)
27
+ if (MouseIn(1815, RibbonMenu.getYPos(modIndex), 90, 90))
28
+ callback(modIndex);
29
+ return;
30
+ }
31
+ }
32
+ exports.RibbonMenu = RibbonMenu;
@@ -0,0 +1,21 @@
1
+ import { ModSDKModInfo, ModSDKModOptions, PatchHook } from 'bondage-club-mod-sdk';
2
+ export declare enum HookPriority {
3
+ Observe = 0,
4
+ AddBehavior = 1,
5
+ ModifyBehavior = 5,
6
+ OverrideBehavior = 10,
7
+ Top = 100
8
+ }
9
+ type ModuleCategory = string;
10
+ export declare class bcSdkMod {
11
+ private static SDK;
12
+ private static patchedFunctions;
13
+ static ModInfo: ModSDKModInfo;
14
+ constructor(info: ModSDKModInfo, options: ModSDKModOptions);
15
+ initPatchableFunction(target: string): PatchedFunctionData;
16
+ hookFunction(target: string, priority: number, hook: PatchHook, module?: ModuleCategory | null): () => void;
17
+ patchFunction(target: string, patches: Record<string, string>): void;
18
+ removeHookByModule(target: string, module: ModuleCategory): boolean;
19
+ removeAllHooksByModule(module: ModuleCategory): boolean;
20
+ }
21
+ export {};
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.bcSdkMod = exports.HookPriority = void 0;
7
+ const bondage_club_mod_sdk_1 = __importDefault(require("bondage-club-mod-sdk"));
8
+ var HookPriority;
9
+ (function (HookPriority) {
10
+ HookPriority[HookPriority["Observe"] = 0] = "Observe";
11
+ HookPriority[HookPriority["AddBehavior"] = 1] = "AddBehavior";
12
+ HookPriority[HookPriority["ModifyBehavior"] = 5] = "ModifyBehavior";
13
+ HookPriority[HookPriority["OverrideBehavior"] = 10] = "OverrideBehavior";
14
+ HookPriority[HookPriority["Top"] = 100] = "Top";
15
+ })(HookPriority || (exports.HookPriority = HookPriority = {}));
16
+ class bcSdkMod {
17
+ static SDK;
18
+ static patchedFunctions = new Map();
19
+ static ModInfo;
20
+ constructor(info, options) {
21
+ bcSdkMod.SDK = bondage_club_mod_sdk_1.default.registerMod(info, options);
22
+ bcSdkMod.ModInfo = info;
23
+ }
24
+ initPatchableFunction(target) {
25
+ let result = bcSdkMod.patchedFunctions.get(target);
26
+ if (!result) {
27
+ result = {
28
+ name: target,
29
+ hooks: []
30
+ };
31
+ bcSdkMod.patchedFunctions.set(target, result);
32
+ }
33
+ return result;
34
+ }
35
+ hookFunction(target, priority, hook, module = null) {
36
+ const data = this.initPatchableFunction(target);
37
+ if (data.hooks.some((h) => h.hook === hook)) {
38
+ return () => null;
39
+ }
40
+ const removeCallback = bcSdkMod.SDK?.hookFunction(target, priority, hook);
41
+ data.hooks.push({
42
+ hook,
43
+ priority,
44
+ module,
45
+ removeCallback
46
+ });
47
+ data.hooks.sort((a, b) => b.priority - a.priority);
48
+ return removeCallback;
49
+ }
50
+ patchFunction(target, patches) {
51
+ this.patchFunction(target, patches);
52
+ }
53
+ removeHookByModule(target, module) {
54
+ const data = this.initPatchableFunction(target);
55
+ for (let i = data.hooks.length - 1; i >= 0; i--) {
56
+ if (data.hooks[i].module === module) {
57
+ data.hooks[i].removeCallback();
58
+ data.hooks.splice(i, 1);
59
+ }
60
+ }
61
+ return true;
62
+ }
63
+ removeAllHooksByModule(module) {
64
+ for (const data of bcSdkMod.patchedFunctions.values()) {
65
+ for (let i = data.hooks.length - 1; i >= 0; i--) {
66
+ if (data.hooks[i].module === module) {
67
+ data.hooks[i].removeCallback();
68
+ data.hooks.splice(i, 1);
69
+ }
70
+ }
71
+ }
72
+ return true;
73
+ }
74
+ }
75
+ exports.bcSdkMod = bcSdkMod;
@@ -1,4 +1,7 @@
1
- export class _String {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._String = void 0;
4
+ class _String {
2
5
  static encode(string) {
3
6
  return LZString.compressToBase64(JSON.stringify(string));
4
7
  }
@@ -24,3 +27,4 @@ export class _String {
24
27
  return ret;
25
28
  }
26
29
  }
30
+ exports._String = _String;
@@ -0,0 +1,10 @@
1
+ export declare class Localization {
2
+ private static Translation;
3
+ private static FallbackTranslation;
4
+ private static ServerUrl;
5
+ static load(serverUrl: string): Promise<void>;
6
+ static getText(srcTag: string): string;
7
+ private static fetchLanguageFile;
8
+ private static parseLanguageFile;
9
+ }
10
+ export declare const getText: (string: string) => string;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getText = exports.Localization = void 0;
4
+ class Localization {
5
+ static Translation = {};
6
+ static FallbackTranslation = {};
7
+ static ServerUrl = '';
8
+ static async load(serverUrl) {
9
+ this.ServerUrl = serverUrl;
10
+ const lang = TranslationLanguage.toLowerCase();
11
+ this.Translation = await Localization.fetchLanguageFile(lang);
12
+ if (lang == 'en') {
13
+ return;
14
+ }
15
+ this.FallbackTranslation = await Localization.fetchLanguageFile('en');
16
+ }
17
+ static getText(srcTag) {
18
+ return this.Translation[srcTag] || this.FallbackTranslation?.[srcTag] || srcTag || '';
19
+ }
20
+ static async fetchLanguageFile(lang) {
21
+ const response = await fetch(`${this.ServerUrl}/translations/${lang}.lang`);
22
+ if (lang != 'en' && !response.ok) {
23
+ return this.fetchLanguageFile('en');
24
+ }
25
+ const langFileContent = await response.text();
26
+ return this.parseLanguageFile(langFileContent);
27
+ }
28
+ static parseLanguageFile(content) {
29
+ const translations = {};
30
+ const lines = content.split('\n');
31
+ for (const line of lines) {
32
+ if (line.trim() === '' || line.trim().startsWith('#')) {
33
+ continue;
34
+ }
35
+ const [key, value] = line.split('=');
36
+ translations[key.trim()] = value.trim();
37
+ }
38
+ return translations;
39
+ }
40
+ }
41
+ exports.Localization = Localization;
42
+ const getText = (string) => Localization.getText(string);
43
+ exports.getText = getText;
package/package.json CHANGED
@@ -1,28 +1,24 @@
1
1
  {
2
2
  "name": "bc-deeplib",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "author": "dDeepLb",
5
+ "description": "Package for easier development of BC mods without need to repeat myself in every mod",
5
6
  "license": "MIT",
6
- "module": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "type": "module",
9
7
  "files": [
10
- "dist",
11
- "LICENSE",
12
- "README.md"
8
+ "/dist"
13
9
  ],
10
+ "main": "./dist/DeepLib.js",
11
+ "types": "./dist/DeepLib.d.ts",
14
12
  "scripts": {
15
13
  "prepare": "tsc"
16
14
  },
17
15
  "dependencies": {
18
- "bondage-club-mod-sdk": "^1.1.0"
16
+ "bondage-club-mod-sdk": "^1.2.0"
19
17
  },
20
18
  "devDependencies": {
21
19
  "@types/node": "^20.11.19",
22
20
  "lz-string": "^1.5.0",
23
21
  "typescript": "^5.3.3",
24
22
  "bc-stubs": "github:bananarama92/BC-stubs"
25
- },
26
- "description": "Package for easier development of BC mods without need to repeat myself in every mod",
27
- "main": "index.js"
23
+ }
28
24
  }