@malib/gear 0.8.0 → 0.9.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/internal.d.ts CHANGED
@@ -10,3 +10,8 @@ export * from "./lib/logic/bonusstattype";
10
10
  export * from "./lib/logic/enhancement";
11
11
  export * from "./lib/logic/scroll";
12
12
  export * from "./lib/logic/upgrade";
13
+ export * from "./lib/serialize/fromplain";
14
+ export * from "./lib/serialize/interface";
15
+ export * from "./lib/serialize/toplain";
16
+ export * from "./lib/serialize/util";
17
+ export * from "./lib/serialize/validate";
package/lib/gear.d.ts CHANGED
@@ -85,11 +85,11 @@ export declare class Gear {
85
85
  /** 잠재능력 등급 */
86
86
  grade: PotentialGrade;
87
87
  /** 잠재옵션 목록 */
88
- potentials: (Potential | undefined)[];
88
+ potentials: (Potential | null)[];
89
89
  /** 에디셔널 잠재능력 등급 */
90
90
  additionalGrade: PotentialGrade;
91
91
  /** 에디셔널 잠재옵션 목록 */
92
- additionalPotentials: (Potential | undefined)[];
92
+ additionalPotentials: (Potential | null)[];
93
93
  /** 소울 */
94
94
  soulWeapon: SoulWeapon;
95
95
  constructor();
@@ -129,8 +129,8 @@ export declare class Gear {
129
129
  getBooleanValue(type: GearPropType): boolean;
130
130
  /**
131
131
  * 장비에 신비의 모루 외형을 적용합니다.
132
- * @param icon 외형 아이콘
133
- * @param name 외형 장비명
132
+ * @param icon 외형 아이콘.
133
+ * @param name 외형 장비명.
134
134
  */
135
135
  setAnvil(icon: GearIcon, name: string): void;
136
136
  /**
@@ -0,0 +1,8 @@
1
+ import { Gear } from "../gear";
2
+ import { GearLike } from "./interface";
3
+ /**
4
+ * 순수 객체를 장비로 변환합니다.
5
+ * @param like 변환할 객체.
6
+ * @returns 변환된 장비.
7
+ */
8
+ export declare function plainToGear(like: GearLike): Gear;
@@ -0,0 +1,53 @@
1
+ import { GearIcon, GearReq } from "../gear";
2
+ import { GearPropType } from "../gearproptype";
3
+ import { GearType } from "../geartype";
4
+ import { PotentialGrade } from "../potentialgrade";
5
+ import { Soul } from "../soul";
6
+ /**
7
+ * `Gear`를 나타내는 순수 객체 형식
8
+ */
9
+ export interface GearLike {
10
+ id: number;
11
+ name: string;
12
+ desc?: string;
13
+ icon: GearIcon;
14
+ anvilIcon?: GearIcon;
15
+ anvilName?: string;
16
+ type: GearType;
17
+ req: GearReq;
18
+ props: [GearPropType, number][];
19
+ options: [GearPropType, OptionLike][];
20
+ tuc?: number;
21
+ up?: number;
22
+ fail?: number;
23
+ hammer?: number;
24
+ maxStar?: number;
25
+ star?: number;
26
+ amazing?: boolean;
27
+ karma?: number;
28
+ canPot?: boolean;
29
+ grade?: PotentialGrade;
30
+ pots?: (PotLike | null)[];
31
+ addGrade?: PotentialGrade;
32
+ addPots?: (PotLike | null)[];
33
+ soulWeapon: SoulWeaponLike;
34
+ }
35
+ export interface OptionLike {
36
+ base?: number;
37
+ bonus?: number;
38
+ upgrade?: number;
39
+ enchant?: number;
40
+ }
41
+ export interface PotLike {
42
+ code: number;
43
+ optionType: number;
44
+ reqLevel: number;
45
+ summary: string;
46
+ option: [GearPropType, number][];
47
+ }
48
+ export interface SoulWeaponLike {
49
+ enchanted?: boolean;
50
+ soul?: Soul;
51
+ charge?: number;
52
+ chargeOption?: [GearPropType, number][];
53
+ }
@@ -0,0 +1,8 @@
1
+ import { Gear } from "../gear";
2
+ import { GearLike } from "./interface";
3
+ /**
4
+ * 장비를 순수 객체로 변환합니다.
5
+ * @param like 변환할 장비.
6
+ * @returns 변환된 순수 객체.
7
+ */
8
+ export declare function gearToPlain(gear: Gear): GearLike;
@@ -0,0 +1,19 @@
1
+ import { Gear } from "../gear";
2
+ /**
3
+ * 장비를 문자열로 변환합니다. `JSON.stringify`를 사용합니다.
4
+ * @param gear 변환할 장비.
5
+ * @returns 장비를 나타내는 문자열.
6
+ */
7
+ export declare function stringifyGear(gear: Gear): string;
8
+ /**
9
+ * 문자열을 장비로 변환합니다. 입력을 검사하지 않고 `JSON.parse`를 사용합니다.
10
+ * @param gear 변환할 문자열.
11
+ * @returns 장비. 입력이 잘못되었을 경우 오류가 발생하거나 장비를 반환합니다.
12
+ */
13
+ export declare function parseGear(like: string): Gear;
14
+ /**
15
+ * 문자열을 장비로 변환합니다. 입력을 검사하고 `JSON.parse`를 사용합니다.
16
+ * @param gear 변환할 문자열.
17
+ * @returns 장비. 입력이 잘못되었을 경우 `null`을 반환합니다.
18
+ */
19
+ export declare function validateParseGear(maybe: string): Gear | null;
@@ -0,0 +1,7 @@
1
+ import { GearLike } from "./interface";
2
+ /**
3
+ * 객체가 `GearLike` 형식인지 여부를 확인합니다.
4
+ * @param input 확인할 객체.
5
+ * @returns 입력이 `GearLike` 형식일 경우 `true`; 아닐 경우 `false`.
6
+ */
7
+ export declare const isGearLike: (input: unknown) => input is GearLike;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malib/gear",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",