@dchighs/dc-config-mapper 0.1.3 → 0.2.0
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/data-compiler.js +19 -7
- package/dist/mappers/index.d.ts +1 -0
- package/dist/mappers/index.js +1 -0
- package/dist/mappers/maze-islands.mapper.d.ts +1 -0
- package/dist/mappers/tower-islands.mapper.d.ts +97 -0
- package/dist/mappers/tower-islands.mapper.js +33 -0
- package/dist/schemas/islands/maze-islands/island.schema.d.ts +1 -0
- package/dist/schemas/islands/maze-islands/island.schema.js +1 -0
- package/dist/schemas/islands/tower-islands/floor.schema.d.ts +29 -0
- package/dist/schemas/islands/tower-islands/floor.schema.js +25 -0
- package/dist/schemas/islands/tower-islands/island.schema.d.ts +98 -0
- package/dist/schemas/islands/tower-islands/island.schema.js +71 -0
- package/dist/schemas/islands/tower-islands/reward.schema.d.ts +25 -0
- package/dist/schemas/islands/tower-islands/reward.schema.js +23 -0
- package/dist/schemas/islands/tower-islands/square.schema.d.ts +46 -0
- package/dist/schemas/islands/tower-islands/square.schema.js +52 -0
- package/package.json +1 -1
package/dist/data-compiler.js
CHANGED
|
@@ -20,22 +20,32 @@ class DataCompiler {
|
|
|
20
20
|
}
|
|
21
21
|
return "";
|
|
22
22
|
}
|
|
23
|
-
processIdsSuffix({ context, data, key, prefix }) {
|
|
23
|
+
processIdsSuffix({ context, data, dataCopy, key, prefix }) {
|
|
24
24
|
const baseKey = key.slice(prefix.length).slice(0, -this.idsSuffix.length);
|
|
25
25
|
const pluralizedKey = (0, pluralize_1.default)(baseKey);
|
|
26
26
|
if (context[pluralizedKey]) {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const idList = dataCopy[key];
|
|
28
|
+
const contextItems = context[pluralizedKey];
|
|
29
|
+
const relatedItems = idList
|
|
30
|
+
.map(id => {
|
|
31
|
+
const foundItem = contextItems.find(item => item.id === id);
|
|
32
|
+
if (!foundItem) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return (0, lodash_1.isObject)(foundItem)
|
|
36
|
+
? this.compile({ data: { ...foundItem }, context: context })
|
|
37
|
+
: foundItem;
|
|
38
|
+
})
|
|
39
|
+
.filter(item => item !== null);
|
|
30
40
|
data[`${prefix}${pluralizedKey}`] = relatedItems;
|
|
31
41
|
delete data[key];
|
|
32
42
|
}
|
|
33
43
|
}
|
|
34
|
-
processIdSuffix({ context, data, key, prefix }) {
|
|
44
|
+
processIdSuffix({ context, data, key, prefix, dataCopy }) {
|
|
35
45
|
const baseKey = key.slice(prefix.length).slice(0, -this.idSuffix.length);
|
|
36
46
|
const pluralizedKey = (0, pluralize_1.default)(baseKey);
|
|
37
47
|
if (context[pluralizedKey]) {
|
|
38
|
-
const foundItem = context[pluralizedKey].find((item) => item.id ===
|
|
48
|
+
const foundItem = context[pluralizedKey].find((item) => item.id === dataCopy[key]);
|
|
39
49
|
data[`${prefix}${baseKey}`] = foundItem ? this.compile({ data: foundItem, context: context }) : null;
|
|
40
50
|
delete data[key];
|
|
41
51
|
}
|
|
@@ -60,14 +70,16 @@ class DataCompiler {
|
|
|
60
70
|
if (key.endsWith(this.idsSuffix) && Array.isArray(value)) {
|
|
61
71
|
this.processIdsSuffix({
|
|
62
72
|
data: data,
|
|
73
|
+
dataCopy: dataCopy,
|
|
63
74
|
key: key,
|
|
64
75
|
prefix: matchedPrefix,
|
|
65
|
-
context: context
|
|
76
|
+
context: context,
|
|
66
77
|
});
|
|
67
78
|
}
|
|
68
79
|
else if (key.endsWith(this.idSuffix) && value) {
|
|
69
80
|
this.processIdSuffix({
|
|
70
81
|
data: data,
|
|
82
|
+
dataCopy: dataCopy,
|
|
71
83
|
key: key,
|
|
72
84
|
prefix: matchedPrefix,
|
|
73
85
|
context: context
|
package/dist/mappers/index.d.ts
CHANGED
package/dist/mappers/index.js
CHANGED
|
@@ -19,3 +19,4 @@ __exportStar(require("./items.mapper"), exports);
|
|
|
19
19
|
__exportStar(require("./skills.mapper"), exports);
|
|
20
20
|
__exportStar(require("./heroic-races.mapper"), exports);
|
|
21
21
|
__exportStar(require("./maze-islands.mapper"), exports);
|
|
22
|
+
__exportStar(require("./tower-islands.mapper"), exports);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Localization } from "@dchighs/dc-localization";
|
|
2
|
+
import { GameConfigDto } from "@dchighs/dc-config";
|
|
3
|
+
export type TowerIslandsDto = GameConfigDto["game_data"]["config"]["tower_island"];
|
|
4
|
+
export declare class TowerIslandsMapper {
|
|
5
|
+
readonly localization: Localization;
|
|
6
|
+
constructor(localization: Localization);
|
|
7
|
+
map(data: TowerIslandsDto): {
|
|
8
|
+
islands: import("@dchighs/dc-localization/dist/types").Translated<{
|
|
9
|
+
id: number;
|
|
10
|
+
name_key: string;
|
|
11
|
+
availability: {
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
};
|
|
15
|
+
initial_square_id: number;
|
|
16
|
+
pool: {
|
|
17
|
+
size: number;
|
|
18
|
+
time: number;
|
|
19
|
+
};
|
|
20
|
+
initial_points: number;
|
|
21
|
+
currency_id: number;
|
|
22
|
+
min_level: number;
|
|
23
|
+
tower_size: number[];
|
|
24
|
+
zip_file_name: string;
|
|
25
|
+
sound_tag: string;
|
|
26
|
+
max_die_roll: number;
|
|
27
|
+
help_view_id: number;
|
|
28
|
+
square_ids: number[];
|
|
29
|
+
floor_ids: number[];
|
|
30
|
+
}>[];
|
|
31
|
+
floors: import("@dchighs/dc-localization/dist/types").Translated<{
|
|
32
|
+
id: number;
|
|
33
|
+
y: number;
|
|
34
|
+
x_flip: boolean;
|
|
35
|
+
floor_image: string;
|
|
36
|
+
area: number;
|
|
37
|
+
roll_die_price: number;
|
|
38
|
+
}>[];
|
|
39
|
+
squares: import("@dchighs/dc-localization/dist/types").Translated<{
|
|
40
|
+
id: number;
|
|
41
|
+
type: string;
|
|
42
|
+
is_highlight: boolean;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
ixy: string;
|
|
46
|
+
rewards: {
|
|
47
|
+
chest?: number | undefined;
|
|
48
|
+
egg?: number | undefined;
|
|
49
|
+
}[] | undefined;
|
|
50
|
+
wall: string | undefined;
|
|
51
|
+
catapult_destination_square_id: number | undefined;
|
|
52
|
+
piece_reward_id: number | undefined;
|
|
53
|
+
}>[];
|
|
54
|
+
rewards: import("@dchighs/dc-localization/dist/types").Translated<{
|
|
55
|
+
id: number;
|
|
56
|
+
dragon_id: number;
|
|
57
|
+
last_piece_cost: number;
|
|
58
|
+
pieces_count: number;
|
|
59
|
+
show_new_badge: boolean;
|
|
60
|
+
area: number;
|
|
61
|
+
}>[];
|
|
62
|
+
happy_hours: import("@dchighs/dc-localization/dist/types").Translated<{
|
|
63
|
+
id: number;
|
|
64
|
+
availability: {
|
|
65
|
+
from: number;
|
|
66
|
+
to: number;
|
|
67
|
+
};
|
|
68
|
+
island_id: number;
|
|
69
|
+
discount: number;
|
|
70
|
+
}>[];
|
|
71
|
+
parameters: import("@dchighs/dc-localization/dist/types").Translated<{
|
|
72
|
+
id: number;
|
|
73
|
+
name: string;
|
|
74
|
+
value: any;
|
|
75
|
+
}>[];
|
|
76
|
+
currencies: import("@dchighs/dc-localization/dist/types").Translated<{
|
|
77
|
+
id: number;
|
|
78
|
+
tid_name: string;
|
|
79
|
+
actions: Array<number>;
|
|
80
|
+
}>[];
|
|
81
|
+
actions: import("@dchighs/dc-localization/dist/types").Translated<{
|
|
82
|
+
id: number;
|
|
83
|
+
type: string;
|
|
84
|
+
tid_name: string;
|
|
85
|
+
image: string;
|
|
86
|
+
pool_percent: number;
|
|
87
|
+
max_points: number;
|
|
88
|
+
extra_parameters?: {
|
|
89
|
+
max_time?: number;
|
|
90
|
+
cooldown?: number;
|
|
91
|
+
max_control_level?: number;
|
|
92
|
+
max_production?: number;
|
|
93
|
+
max_level?: number;
|
|
94
|
+
};
|
|
95
|
+
}>[];
|
|
96
|
+
};
|
|
97
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TowerIslandsMapper = void 0;
|
|
4
|
+
const island_schema_1 = require("../schemas/islands/tower-islands/island.schema");
|
|
5
|
+
const square_schema_1 = require("../schemas/islands/tower-islands/square.schema");
|
|
6
|
+
const floor_schema_1 = require("../schemas/islands/tower-islands/floor.schema");
|
|
7
|
+
const reward_schema_1 = require("../schemas/islands/tower-islands/reward.schema");
|
|
8
|
+
class TowerIslandsMapper {
|
|
9
|
+
constructor(localization) {
|
|
10
|
+
this.localization = localization;
|
|
11
|
+
}
|
|
12
|
+
map(data) {
|
|
13
|
+
return {
|
|
14
|
+
islands: data.islands.map(island => {
|
|
15
|
+
const squareIds = data.squares.filter(square => square.island_id === island.id).map(square => square.id);
|
|
16
|
+
const floorIds = data.floors.filter(floor => floor.island_id === island.id).map(floor => floor.id);
|
|
17
|
+
return this.localization.translate(island_schema_1.towerIslandSchema.parse({
|
|
18
|
+
...island,
|
|
19
|
+
square_ids: squareIds,
|
|
20
|
+
floor_ids: floorIds
|
|
21
|
+
}));
|
|
22
|
+
}),
|
|
23
|
+
floors: data.floors.map(floor => this.localization.translate(floor_schema_1.towerIslandsFloorSchema.parse(floor))),
|
|
24
|
+
squares: data.squares.map(square => this.localization.translate(square_schema_1.towerIslandsSquareSchema.parse(square))),
|
|
25
|
+
rewards: data.rewards.map(reward => this.localization.translate(reward_schema_1.towerIslandsRewardSchema.parse(reward))),
|
|
26
|
+
happy_hours: data.happy_hours.map(happyHour => this.localization.translate(happyHour)),
|
|
27
|
+
parameters: data.parameters.map(parameter => this.localization.translate(parameter)),
|
|
28
|
+
currencies: data.currencies.map(currency => this.localization.translate(currency)),
|
|
29
|
+
actions: data.actions.map(action => this.localization.translate(action)),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.TowerIslandsMapper = TowerIslandsMapper;
|
|
@@ -45,6 +45,7 @@ exports.mazeIslandSchema = zod_1.z.object({
|
|
|
45
45
|
return {
|
|
46
46
|
id: data.id,
|
|
47
47
|
name: data.name,
|
|
48
|
+
name_key: data.tid_name,
|
|
48
49
|
availability: {
|
|
49
50
|
from: new Date(data.availability.from * 1000).toISOString(),
|
|
50
51
|
to: new Date(data.availability.to * 1000).toISOString(),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const towerIslandsFloorSchema: z.ZodPipe<z.ZodObject<{
|
|
3
|
+
id: z.ZodNumber;
|
|
4
|
+
y: z.ZodNumber;
|
|
5
|
+
x_flip: z.ZodNumber;
|
|
6
|
+
floor_image: z.ZodString;
|
|
7
|
+
area: z.ZodNumber;
|
|
8
|
+
roll_die_price: z.ZodObject<{
|
|
9
|
+
ep: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
island_id: z.ZodNumber;
|
|
12
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
13
|
+
id: number;
|
|
14
|
+
y: number;
|
|
15
|
+
x_flip: boolean;
|
|
16
|
+
floor_image: string;
|
|
17
|
+
area: number;
|
|
18
|
+
roll_die_price: number;
|
|
19
|
+
}, {
|
|
20
|
+
id: number;
|
|
21
|
+
y: number;
|
|
22
|
+
x_flip: number;
|
|
23
|
+
floor_image: string;
|
|
24
|
+
area: number;
|
|
25
|
+
roll_die_price: {
|
|
26
|
+
ep: number;
|
|
27
|
+
};
|
|
28
|
+
island_id: number;
|
|
29
|
+
}>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.towerIslandsFloorSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../../../utils");
|
|
6
|
+
exports.towerIslandsFloorSchema = zod_1.z.object({
|
|
7
|
+
id: zod_1.z.number(),
|
|
8
|
+
y: zod_1.z.number(),
|
|
9
|
+
x_flip: zod_1.z.number(),
|
|
10
|
+
floor_image: zod_1.z.string(),
|
|
11
|
+
area: zod_1.z.number(),
|
|
12
|
+
roll_die_price: zod_1.z.object({
|
|
13
|
+
ep: zod_1.z.number(),
|
|
14
|
+
}),
|
|
15
|
+
island_id: zod_1.z.number(),
|
|
16
|
+
}).strict().transform(data => {
|
|
17
|
+
return {
|
|
18
|
+
id: data.id,
|
|
19
|
+
y: data.y,
|
|
20
|
+
x_flip: (0, utils_1.numberToBoolean)(data.x_flip),
|
|
21
|
+
floor_image: data.floor_image,
|
|
22
|
+
area: data.area,
|
|
23
|
+
roll_die_price: data.roll_die_price.ep,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const towerIslandSchema: z.ZodPipe<z.ZodObject<{
|
|
3
|
+
id: z.ZodNumber;
|
|
4
|
+
analytics_id: z.ZodString;
|
|
5
|
+
tid_name: z.ZodString;
|
|
6
|
+
start_ts: z.ZodNumber;
|
|
7
|
+
end_ts: z.ZodNumber;
|
|
8
|
+
initial_square_id: z.ZodNumber;
|
|
9
|
+
tutorial_id: z.ZodNumber;
|
|
10
|
+
tutorial_die_result: z.ZodNumber;
|
|
11
|
+
pool_size: z.ZodNumber;
|
|
12
|
+
pool_time: z.ZodNumber;
|
|
13
|
+
initial_points: z.ZodNumber;
|
|
14
|
+
currency_id: z.ZodNumber;
|
|
15
|
+
min_level: z.ZodNumber;
|
|
16
|
+
building_id: z.ZodNumber;
|
|
17
|
+
building_position: z.ZodArray<z.ZodNumber>;
|
|
18
|
+
tower_size: z.ZodArray<z.ZodNumber>;
|
|
19
|
+
zip_file: z.ZodString;
|
|
20
|
+
sound_tag: z.ZodString;
|
|
21
|
+
canvas_assets_url: z.ZodString;
|
|
22
|
+
mobile_first_floor_position: z.ZodArray<z.ZodNumber>;
|
|
23
|
+
mobile_floor_height: z.ZodNumber;
|
|
24
|
+
mobile_interior_wall_margin: z.ZodNumber;
|
|
25
|
+
mobile_final_dragon_scale: z.ZodArray<z.ZodNumber>;
|
|
26
|
+
mobile_final_dragon_position: z.ZodArray<z.ZodNumber>;
|
|
27
|
+
mobile_final_dragon_info_position: z.ZodArray<z.ZodNumber>;
|
|
28
|
+
max_die_roll: z.ZodNumber;
|
|
29
|
+
help_view_id: z.ZodNumber;
|
|
30
|
+
active_platforms: z.ZodObject<{
|
|
31
|
+
ios: z.ZodArray<z.ZodNumber>;
|
|
32
|
+
canvas: z.ZodArray<z.ZodNumber>;
|
|
33
|
+
android: z.ZodArray<z.ZodNumber>;
|
|
34
|
+
amazon: z.ZodArray<z.ZodNumber>;
|
|
35
|
+
windows: z.ZodArray<z.ZodNumber>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
square_ids: z.ZodArray<z.ZodNumber>;
|
|
38
|
+
floor_ids: z.ZodArray<z.ZodNumber>;
|
|
39
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
40
|
+
id: number;
|
|
41
|
+
name_key: string;
|
|
42
|
+
availability: {
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
};
|
|
46
|
+
initial_square_id: number;
|
|
47
|
+
pool: {
|
|
48
|
+
size: number;
|
|
49
|
+
time: number;
|
|
50
|
+
};
|
|
51
|
+
initial_points: number;
|
|
52
|
+
currency_id: number;
|
|
53
|
+
min_level: number;
|
|
54
|
+
tower_size: number[];
|
|
55
|
+
zip_file_name: string;
|
|
56
|
+
sound_tag: string;
|
|
57
|
+
max_die_roll: number;
|
|
58
|
+
help_view_id: number;
|
|
59
|
+
square_ids: number[];
|
|
60
|
+
floor_ids: number[];
|
|
61
|
+
}, {
|
|
62
|
+
id: number;
|
|
63
|
+
analytics_id: string;
|
|
64
|
+
tid_name: string;
|
|
65
|
+
start_ts: number;
|
|
66
|
+
end_ts: number;
|
|
67
|
+
initial_square_id: number;
|
|
68
|
+
tutorial_id: number;
|
|
69
|
+
tutorial_die_result: number;
|
|
70
|
+
pool_size: number;
|
|
71
|
+
pool_time: number;
|
|
72
|
+
initial_points: number;
|
|
73
|
+
currency_id: number;
|
|
74
|
+
min_level: number;
|
|
75
|
+
building_id: number;
|
|
76
|
+
building_position: number[];
|
|
77
|
+
tower_size: number[];
|
|
78
|
+
zip_file: string;
|
|
79
|
+
sound_tag: string;
|
|
80
|
+
canvas_assets_url: string;
|
|
81
|
+
mobile_first_floor_position: number[];
|
|
82
|
+
mobile_floor_height: number;
|
|
83
|
+
mobile_interior_wall_margin: number;
|
|
84
|
+
mobile_final_dragon_scale: number[];
|
|
85
|
+
mobile_final_dragon_position: number[];
|
|
86
|
+
mobile_final_dragon_info_position: number[];
|
|
87
|
+
max_die_roll: number;
|
|
88
|
+
help_view_id: number;
|
|
89
|
+
active_platforms: {
|
|
90
|
+
ios: number[];
|
|
91
|
+
canvas: number[];
|
|
92
|
+
android: number[];
|
|
93
|
+
amazon: number[];
|
|
94
|
+
windows: number[];
|
|
95
|
+
};
|
|
96
|
+
square_ids: number[];
|
|
97
|
+
floor_ids: number[];
|
|
98
|
+
}>>;
|
|
@@ -0,0 +1,71 @@
|
|
|
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.towerIslandSchema = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
exports.towerIslandSchema = zod_1.z.object({
|
|
10
|
+
id: zod_1.z.number(),
|
|
11
|
+
analytics_id: zod_1.z.string(),
|
|
12
|
+
tid_name: zod_1.z.string(),
|
|
13
|
+
start_ts: zod_1.z.number(),
|
|
14
|
+
end_ts: zod_1.z.number(),
|
|
15
|
+
initial_square_id: zod_1.z.number(),
|
|
16
|
+
tutorial_id: zod_1.z.number(),
|
|
17
|
+
tutorial_die_result: zod_1.z.number(),
|
|
18
|
+
pool_size: zod_1.z.number(),
|
|
19
|
+
pool_time: zod_1.z.number(),
|
|
20
|
+
initial_points: zod_1.z.number(),
|
|
21
|
+
currency_id: zod_1.z.number(),
|
|
22
|
+
min_level: zod_1.z.number(),
|
|
23
|
+
building_id: zod_1.z.number(),
|
|
24
|
+
building_position: zod_1.z.array(zod_1.z.number()),
|
|
25
|
+
tower_size: zod_1.z.array(zod_1.z.number()),
|
|
26
|
+
zip_file: zod_1.z.string(),
|
|
27
|
+
sound_tag: zod_1.z.string(),
|
|
28
|
+
canvas_assets_url: zod_1.z.string(),
|
|
29
|
+
mobile_first_floor_position: zod_1.z.array(zod_1.z.number()),
|
|
30
|
+
mobile_floor_height: zod_1.z.number(),
|
|
31
|
+
mobile_interior_wall_margin: zod_1.z.number(),
|
|
32
|
+
mobile_final_dragon_scale: zod_1.z.array(zod_1.z.number()),
|
|
33
|
+
mobile_final_dragon_position: zod_1.z.array(zod_1.z.number()),
|
|
34
|
+
mobile_final_dragon_info_position: zod_1.z.array(zod_1.z.number()),
|
|
35
|
+
max_die_roll: zod_1.z.number(),
|
|
36
|
+
help_view_id: zod_1.z.number(),
|
|
37
|
+
active_platforms: zod_1.z.object({
|
|
38
|
+
ios: zod_1.z.array(zod_1.z.number()),
|
|
39
|
+
canvas: zod_1.z.array(zod_1.z.number()),
|
|
40
|
+
android: zod_1.z.array(zod_1.z.number()),
|
|
41
|
+
amazon: zod_1.z.array(zod_1.z.number()),
|
|
42
|
+
windows: zod_1.z.array(zod_1.z.number()),
|
|
43
|
+
}),
|
|
44
|
+
// injected properties
|
|
45
|
+
square_ids: zod_1.z.array(zod_1.z.number()),
|
|
46
|
+
floor_ids: zod_1.z.array(zod_1.z.number()),
|
|
47
|
+
}).strict().transform(data => {
|
|
48
|
+
return {
|
|
49
|
+
id: data.id,
|
|
50
|
+
name_key: data.tid_name,
|
|
51
|
+
availability: {
|
|
52
|
+
from: new Date(data.start_ts * 1000).toISOString(),
|
|
53
|
+
to: new Date(data.end_ts * 1000).toISOString(),
|
|
54
|
+
},
|
|
55
|
+
initial_square_id: data.initial_square_id,
|
|
56
|
+
pool: {
|
|
57
|
+
size: data.pool_size,
|
|
58
|
+
time: data.pool_time,
|
|
59
|
+
},
|
|
60
|
+
initial_points: data.initial_points,
|
|
61
|
+
currency_id: data.currency_id,
|
|
62
|
+
min_level: data.min_level,
|
|
63
|
+
tower_size: data.tower_size,
|
|
64
|
+
zip_file_name: node_path_1.default.basename(data.zip_file),
|
|
65
|
+
sound_tag: data.sound_tag,
|
|
66
|
+
max_die_roll: data.max_die_roll,
|
|
67
|
+
help_view_id: data.help_view_id,
|
|
68
|
+
square_ids: data.square_ids,
|
|
69
|
+
floor_ids: data.floor_ids,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const towerIslandsRewardSchema: z.ZodPipe<z.ZodObject<{
|
|
3
|
+
id: z.ZodNumber;
|
|
4
|
+
dragon_reward_id: z.ZodNumber;
|
|
5
|
+
last_piece_cost: z.ZodNumber;
|
|
6
|
+
num_pieces: z.ZodNumber;
|
|
7
|
+
show_new_badge: z.ZodNumber;
|
|
8
|
+
area: z.ZodNumber;
|
|
9
|
+
island_id: z.ZodNumber;
|
|
10
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
11
|
+
id: number;
|
|
12
|
+
dragon_id: number;
|
|
13
|
+
last_piece_cost: number;
|
|
14
|
+
pieces_count: number;
|
|
15
|
+
show_new_badge: boolean;
|
|
16
|
+
area: number;
|
|
17
|
+
}, {
|
|
18
|
+
id: number;
|
|
19
|
+
dragon_reward_id: number;
|
|
20
|
+
last_piece_cost: number;
|
|
21
|
+
num_pieces: number;
|
|
22
|
+
show_new_badge: number;
|
|
23
|
+
area: number;
|
|
24
|
+
island_id: number;
|
|
25
|
+
}>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.towerIslandsRewardSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../../../utils");
|
|
6
|
+
exports.towerIslandsRewardSchema = zod_1.z.object({
|
|
7
|
+
id: zod_1.z.number(),
|
|
8
|
+
dragon_reward_id: zod_1.z.number(),
|
|
9
|
+
last_piece_cost: zod_1.z.number(),
|
|
10
|
+
num_pieces: zod_1.z.number(),
|
|
11
|
+
show_new_badge: zod_1.z.number(),
|
|
12
|
+
area: zod_1.z.number(),
|
|
13
|
+
island_id: zod_1.z.number(),
|
|
14
|
+
}).strict().transform(data => {
|
|
15
|
+
return {
|
|
16
|
+
id: data.id,
|
|
17
|
+
dragon_id: data.dragon_reward_id,
|
|
18
|
+
last_piece_cost: data.last_piece_cost,
|
|
19
|
+
pieces_count: data.num_pieces,
|
|
20
|
+
show_new_badge: (0, utils_1.numberToBoolean)(data.show_new_badge),
|
|
21
|
+
area: data.area,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const towerIslandsSquareSchema: z.ZodPipe<z.ZodObject<{
|
|
3
|
+
id: z.ZodNumber;
|
|
4
|
+
type: z.ZodString;
|
|
5
|
+
highlight: z.ZodNumber;
|
|
6
|
+
x: z.ZodNumber;
|
|
7
|
+
y: z.ZodNumber;
|
|
8
|
+
island_id: z.ZodNumber;
|
|
9
|
+
ixy: z.ZodString;
|
|
10
|
+
rewards_array: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11
|
+
chest: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
egg: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}, z.core.$strip>>>;
|
|
14
|
+
wall: z.ZodOptional<z.ZodString>;
|
|
15
|
+
catapult_destination_square_id: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
piece_reward_id: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
18
|
+
id: number;
|
|
19
|
+
type: string;
|
|
20
|
+
is_highlight: boolean;
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
ixy: string;
|
|
24
|
+
rewards: {
|
|
25
|
+
chest?: number | undefined;
|
|
26
|
+
egg?: number | undefined;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
wall: string | undefined;
|
|
29
|
+
catapult_destination_square_id: number | undefined;
|
|
30
|
+
piece_reward_id: number | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
id: number;
|
|
33
|
+
type: string;
|
|
34
|
+
highlight: number;
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
island_id: number;
|
|
38
|
+
ixy: string;
|
|
39
|
+
rewards_array?: {
|
|
40
|
+
chest?: number | undefined;
|
|
41
|
+
egg?: number | undefined;
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
wall?: string | undefined;
|
|
44
|
+
catapult_destination_square_id?: number | undefined;
|
|
45
|
+
piece_reward_id?: number | undefined;
|
|
46
|
+
}>>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.towerIslandsSquareSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../../../utils");
|
|
6
|
+
/*
|
|
7
|
+
{
|
|
8
|
+
id: number;
|
|
9
|
+
type: string;
|
|
10
|
+
highlight: number;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
island_id: number;
|
|
14
|
+
ixy: string;
|
|
15
|
+
rewards_array?: Array<{
|
|
16
|
+
chest?: number;
|
|
17
|
+
egg?: number;
|
|
18
|
+
}>;
|
|
19
|
+
wall?: string;
|
|
20
|
+
catapult_destination_square_id?: number;
|
|
21
|
+
piece_reward_id?: number;
|
|
22
|
+
}
|
|
23
|
+
*/
|
|
24
|
+
exports.towerIslandsSquareSchema = zod_1.z.object({
|
|
25
|
+
id: zod_1.z.number(),
|
|
26
|
+
type: zod_1.z.string(),
|
|
27
|
+
highlight: zod_1.z.number(),
|
|
28
|
+
x: zod_1.z.number(),
|
|
29
|
+
y: zod_1.z.number(),
|
|
30
|
+
island_id: zod_1.z.number(),
|
|
31
|
+
ixy: zod_1.z.string(),
|
|
32
|
+
rewards_array: zod_1.z.array(zod_1.z.object({
|
|
33
|
+
chest: zod_1.z.number().optional(),
|
|
34
|
+
egg: zod_1.z.number().optional(),
|
|
35
|
+
})).optional(),
|
|
36
|
+
wall: zod_1.z.string().optional(),
|
|
37
|
+
catapult_destination_square_id: zod_1.z.number().optional(),
|
|
38
|
+
piece_reward_id: zod_1.z.number().optional(),
|
|
39
|
+
}).strict().transform(data => {
|
|
40
|
+
return {
|
|
41
|
+
id: data.id,
|
|
42
|
+
type: data.type,
|
|
43
|
+
is_highlight: (0, utils_1.numberToBoolean)(data.highlight),
|
|
44
|
+
x: data.x,
|
|
45
|
+
y: data.y,
|
|
46
|
+
ixy: data.ixy,
|
|
47
|
+
rewards: data.rewards_array,
|
|
48
|
+
wall: data.wall,
|
|
49
|
+
catapult_destination_square_id: data.catapult_destination_square_id,
|
|
50
|
+
piece_reward_id: data.piece_reward_id,
|
|
51
|
+
};
|
|
52
|
+
});
|
package/package.json
CHANGED