zois-core 3.0.0 → 3.0.1
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/dist/messaging.js +5 -5
- package/dist/modules/moduleContext.js +11 -0
- package/dist/modules/modulesManager.js +2 -2
- package/dist/shards/checkbox.js +2 -2
- package/dist/shards/input.js +4 -4
- package/dist/shards/text.js +6 -2
- package/dist/types/modules/moduleContext.d.ts +1 -0
- package/dist/types/modules/modulesManager.d.ts +3 -3
- package/dist/types/shards/checkbox.d.ts +1 -1
- package/dist/types/shards/input.d.ts +2 -2
- package/dist/types/wardrobe.d.ts +1 -1
- package/dist/wardrobe.js +2 -2
- package/package.json +1 -1
package/dist/messaging.js
CHANGED
|
@@ -119,7 +119,7 @@ class MessagesManager {
|
|
|
119
119
|
if (responseDto) {
|
|
120
120
|
const validationResult = await validateData(data2.data, responseDto);
|
|
121
121
|
if (!validationResult.isValid) {
|
|
122
|
-
logger.warn(`DTO Failure:`, validationResult);
|
|
122
|
+
logger.warn(`DTO Failure:`, validationResult, data2.data);
|
|
123
123
|
resolve({
|
|
124
124
|
isError: true
|
|
125
125
|
});
|
|
@@ -154,7 +154,7 @@ class MessagesManager {
|
|
|
154
154
|
if (responseDto) {
|
|
155
155
|
const validationResult = await validateData(data2.data, responseDto);
|
|
156
156
|
if (!validationResult.isValid) {
|
|
157
|
-
logger.warn(`DTO Failure:`, validationResult);
|
|
157
|
+
logger.warn(`DTO Failure:`, validationResult, data2.data);
|
|
158
158
|
resolve({
|
|
159
159
|
isError: true
|
|
160
160
|
});
|
|
@@ -223,7 +223,7 @@ class MessagesManager {
|
|
|
223
223
|
if (dto) {
|
|
224
224
|
const validationResult = await validateData(data.data, dto);
|
|
225
225
|
if (!validationResult.isValid) {
|
|
226
|
-
logger.warn(`DTO Failure:`, validationResult);
|
|
226
|
+
logger.warn(`DTO Failure:`, validationResult, data.data);
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -252,7 +252,7 @@ class MessagesManager {
|
|
|
252
252
|
if (typeof data.requestId !== "string") return;
|
|
253
253
|
const validationResult = await validateData(data.data, dto);
|
|
254
254
|
if (dto && !validationResult.isValid) {
|
|
255
|
-
logger.warn(`DTO Failure:`, validationResult);
|
|
255
|
+
logger.warn(`DTO Failure:`, validationResult, data.data);
|
|
256
256
|
return next(args);
|
|
257
257
|
}
|
|
258
258
|
const _data = _listener?.(data.data, beep.MemberNumber, beep.MemberName);
|
|
@@ -288,7 +288,7 @@ class MessagesManager {
|
|
|
288
288
|
if (isZoiChatRoomMessage(_message) && _message.Dictionary.msg === message && !sender.IsPlayer()) {
|
|
289
289
|
const validationResult = await validateData(_message.Dictionary.data, dto);
|
|
290
290
|
if (dto && !validationResult.isValid) {
|
|
291
|
-
logger.warn(`DTO Failure:`, validationResult);
|
|
291
|
+
logger.warn(`DTO Failure:`, validationResult, _message.Dictionary.data);
|
|
292
292
|
return next(args);
|
|
293
293
|
}
|
|
294
294
|
_listener?.(_message.Dictionary.data, sender);
|
|
@@ -42,6 +42,17 @@ class ModuleContext {
|
|
|
42
42
|
);
|
|
43
43
|
return this.registerCleanup(removePatch);
|
|
44
44
|
}
|
|
45
|
+
commandCombine(add) {
|
|
46
|
+
CommandCombine(add);
|
|
47
|
+
return this.registerCleanup(() => {
|
|
48
|
+
if (Array.isArray(add)) {
|
|
49
|
+
const tags = add.map((c) => c.Tag);
|
|
50
|
+
Commands = Commands.filter((c) => !tags.includes(c.Tag));
|
|
51
|
+
} else {
|
|
52
|
+
Commands = Commands.filter((c) => c.Tag !== add.Tag);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
45
56
|
dispose() {
|
|
46
57
|
if (this.disposed) return;
|
|
47
58
|
this.disposed = true;
|
|
@@ -25,10 +25,10 @@ class ModulesManager {
|
|
|
25
25
|
get(name) {
|
|
26
26
|
const module = this.modules.get(name);
|
|
27
27
|
if (module === void 0) return null;
|
|
28
|
-
return
|
|
28
|
+
return module;
|
|
29
29
|
}
|
|
30
30
|
getAll() {
|
|
31
|
-
return [...this.modules.values()
|
|
31
|
+
return [...this.modules.values()];
|
|
32
32
|
}
|
|
33
33
|
getLoaded() {
|
|
34
34
|
return [...this.loaded].map((name) => this.get(name)).filter((module) => module !== null);
|
package/dist/shards/checkbox.js
CHANGED
|
@@ -132,12 +132,12 @@ class CheckboxShard extends Shard {
|
|
|
132
132
|
input.disabled = true;
|
|
133
133
|
wrapper.classList.add("zcDisabled");
|
|
134
134
|
}
|
|
135
|
-
input.addEventListener("change", () => {
|
|
135
|
+
input.addEventListener("change", (event) => {
|
|
136
136
|
if (typeof isDisabled === "function" && isDisabled()) {
|
|
137
137
|
input.checked = !input.checked;
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
if (typeof onChange === "function") onChange();
|
|
140
|
+
if (typeof onChange === "function") onChange(event);
|
|
141
141
|
if (input.checked) {
|
|
142
142
|
}
|
|
143
143
|
});
|
package/dist/shards/input.js
CHANGED
|
@@ -10,13 +10,13 @@ class InputShard extends Shard {
|
|
|
10
10
|
if (value) input.value = value;
|
|
11
11
|
setFontFamily(input, MOD_DATA.fontFamily);
|
|
12
12
|
if (typeof isDisabled === "function" && isDisabled()) input.classList.add("zcDisabled");
|
|
13
|
-
input.addEventListener("change", () => {
|
|
13
|
+
input.addEventListener("change", (event) => {
|
|
14
14
|
if (typeof isDisabled === "function" && isDisabled()) return input.classList.add("zcDisabled");
|
|
15
|
-
if (typeof onChange === "function") onChange();
|
|
15
|
+
if (typeof onChange === "function") onChange(event);
|
|
16
16
|
});
|
|
17
|
-
input.addEventListener("input", () => {
|
|
17
|
+
input.addEventListener("input", (event) => {
|
|
18
18
|
if (typeof isDisabled === "function" && isDisabled()) return input.classList.add("zcDisabled");
|
|
19
|
-
if (typeof onInput === "function") onInput();
|
|
19
|
+
if (typeof onInput === "function") onInput(event);
|
|
20
20
|
});
|
|
21
21
|
return {
|
|
22
22
|
base: input
|
package/dist/shards/text.js
CHANGED
|
@@ -12,8 +12,12 @@ class TextShard extends Shard {
|
|
|
12
12
|
p.style.margin = "0";
|
|
13
13
|
p.style.boxSizing = "border-box";
|
|
14
14
|
if (this.context.height) p.style.overflow = "auto";
|
|
15
|
-
if (this.context.withBackground)
|
|
16
|
-
|
|
15
|
+
if (this.context.withBackground) {
|
|
16
|
+
p.style.background = "var(--tmd-element,rgb(239, 239, 239))";
|
|
17
|
+
p.style.border = "1px solid var(--tmd-element-hover, #d2d2d2)";
|
|
18
|
+
} else if (this.context.withBorder) {
|
|
19
|
+
p.style.border = "2px solid var(--tmd-accent, rgb(236, 236, 236))";
|
|
20
|
+
}
|
|
17
21
|
setFontFamily(p, MOD_DATA.fontFamily);
|
|
18
22
|
return {
|
|
19
23
|
base: p
|
|
@@ -5,5 +5,6 @@ export declare class ModuleContext {
|
|
|
5
5
|
private registerCleanup;
|
|
6
6
|
hookFunction<TFunctionName extends string>(functionName: TFunctionName, priority: HookPriority, hook: PatchHook<GetDotedPathType<typeof globalThis, TFunctionName>>): () => void;
|
|
7
7
|
patchFunction(functionName: string, patches: Record<string, string | null>): () => void;
|
|
8
|
+
commandCombine(add: ICommand | ICommand[]): () => void;
|
|
8
9
|
dispose(): void;
|
|
9
10
|
}
|
|
@@ -6,9 +6,9 @@ export declare class ModulesManager {
|
|
|
6
6
|
private readonly loaded;
|
|
7
7
|
private readonly contexts;
|
|
8
8
|
registerModules(): void;
|
|
9
|
-
get<T extends BaseModule>(name: string):
|
|
10
|
-
getAll():
|
|
11
|
-
getLoaded():
|
|
9
|
+
get<T extends BaseModule>(name: string): T | null;
|
|
10
|
+
getAll(): BaseModule[];
|
|
11
|
+
getLoaded(): BaseModule[];
|
|
12
12
|
isInitialized(name: string): boolean;
|
|
13
13
|
isLoaded(name: string): boolean;
|
|
14
14
|
init(name: string): boolean;
|
|
@@ -7,7 +7,7 @@ export interface CheckboxShardContext extends ShardContext<"checkbox" | "label">
|
|
|
7
7
|
text: string;
|
|
8
8
|
icon?: SVGElement | HTMLImageElement;
|
|
9
9
|
}[];
|
|
10
|
-
onChange?: () => void;
|
|
10
|
+
onChange?: (event: Event) => void;
|
|
11
11
|
isDisabled?: () => boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare class CheckboxShard extends Shard<CheckboxShardContext> {
|
|
@@ -4,8 +4,8 @@ export interface InputShardContext extends ShardContext {
|
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
textArea?: boolean;
|
|
6
6
|
fontSize?: number | "auto";
|
|
7
|
-
onChange?: () => void;
|
|
8
|
-
onInput?: () => void;
|
|
7
|
+
onChange?: (event: Event) => void;
|
|
8
|
+
onInput?: (event: Event) => void;
|
|
9
9
|
isDisabled?: () => boolean;
|
|
10
10
|
}
|
|
11
11
|
export declare class InputShard extends Shard<InputShardContext> {
|
package/dist/types/wardrobe.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare function isCosplay(item: Item | Asset | AssetGroup): boolean;
|
|
|
19
19
|
export declare function isBody(item: Item | Asset | AssetGroup): boolean;
|
|
20
20
|
export declare function isBind(item: Item | Asset | AssetGroup, excludeSlots?: AssetGroupName[]): boolean;
|
|
21
21
|
export type IncludeType = "Cosplay" | "Binds" | "Collar" | "Locks";
|
|
22
|
-
export declare function importAppearance(C: Character, bundleToAttach: Item[], include?: IncludeType[], characterValidate?: Character, ignoreAccessValidation?: boolean): void;
|
|
22
|
+
export declare function importAppearance(C: Character, bundleToAttach: Item[], include?: IncludeType[], characterValidate?: Character, ignoreAccessValidation?: boolean, push?: boolean): void;
|
|
23
23
|
export declare function validationCanAccessCheck(C: Character, group: AssetGroupName, asset: Asset): boolean;
|
|
24
24
|
export declare function serverAppearanceBundleToAppearance(assetFamily: IAssetFamily, serverAppearanceBundle: AppearanceBundle): Item[];
|
|
25
25
|
export declare function addRequiredAppearanceItems(appearanceBundle: Item[]): void;
|
package/dist/wardrobe.js
CHANGED
|
@@ -87,7 +87,7 @@ function isBind(item, excludeSlots = ["ItemNeck", "ItemNeckAccessories", "ItemNe
|
|
|
87
87
|
if (group.Category !== "Item" || group.BodyCosplay) return false;
|
|
88
88
|
return !excludeSlots.includes(group.Name);
|
|
89
89
|
}
|
|
90
|
-
function importAppearance(C, bundleToAttach, include = ["Cosplay", "Binds", "Collar", "Locks"], characterValidate = C, ignoreAccessValidation = false) {
|
|
90
|
+
function importAppearance(C, bundleToAttach, include = ["Cosplay", "Binds", "Collar", "Locks"], characterValidate = C, ignoreAccessValidation = false, push = true) {
|
|
91
91
|
bundleToAttach = bundleToAttach.filter((i) => !!i && !isBody(i));
|
|
92
92
|
if (!include.includes("Cosplay")) bundleToAttach = bundleToAttach.filter((i) => !isCosplay(i));
|
|
93
93
|
if (!include.includes("Binds")) bundleToAttach = bundleToAttach.filter((i) => !isBind(i));
|
|
@@ -131,7 +131,7 @@ function importAppearance(C, bundleToAttach, include = ["Cosplay", "Binds", "Col
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
CharacterRefresh(C);
|
|
134
|
-
if (!C.IsNpc()) ChatRoomCharacterUpdate(C);
|
|
134
|
+
if (!C.IsNpc() && push) ChatRoomCharacterUpdate(C);
|
|
135
135
|
}
|
|
136
136
|
function validationCanAccessCheck(C, group, asset) {
|
|
137
137
|
return !ValidationIsItemBlockedOrLimited(C, Player.MemberNumber, group, asset.Name) && ServerChatRoomGetAllowItem(Player, C);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zois-core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Library for developing mods for BC. It includes the tools that I consider necessary. The library is being developed mostly for personal use in my mods.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"zois-core": "dist/scripts/zois-core.js"
|