@drincs/pixi-vn-json 1.6.2 → 1.7.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.
Files changed (140) hide show
  1. package/dist/importer.cjs +1 -0
  2. package/dist/importer.d.cts +613 -0
  3. package/dist/importer.d.ts +613 -0
  4. package/dist/importer.mjs +1 -0
  5. package/dist/index.cjs +2 -2
  6. package/dist/index.d.cts +608 -19
  7. package/dist/index.d.ts +608 -19
  8. package/dist/index.mjs +3 -0
  9. package/dist/unifier.cjs +1 -0
  10. package/dist/unifier.d.cts +594 -0
  11. package/dist/unifier.d.ts +594 -0
  12. package/dist/unifier.mjs +1 -0
  13. package/package.json +26 -3
  14. package/dist/PixiVNJsonConditionalStatements-S3pFEkW9.d.cts +0 -249
  15. package/dist/PixiVNJsonConditionalStatements-S3pFEkW9.d.ts +0 -249
  16. package/dist/classes/LabelJson.cjs +0 -3
  17. package/dist/classes/LabelJson.d.cts +0 -44
  18. package/dist/classes/LabelJson.d.ts +0 -44
  19. package/dist/classes/LabelJson.js +0 -3
  20. package/dist/classes/index.cjs +0 -3
  21. package/dist/classes/index.d.cts +0 -12
  22. package/dist/classes/index.d.ts +0 -12
  23. package/dist/classes/index.js +0 -3
  24. package/dist/constants.cjs +0 -1
  25. package/dist/constants.d.cts +0 -3
  26. package/dist/constants.d.ts +0 -3
  27. package/dist/constants.js +0 -1
  28. package/dist/functions/assets.cjs +0 -3
  29. package/dist/functions/assets.d.cts +0 -14
  30. package/dist/functions/assets.d.ts +0 -14
  31. package/dist/functions/assets.js +0 -3
  32. package/dist/functions/importer.cjs +0 -3
  33. package/dist/functions/importer.d.cts +0 -24
  34. package/dist/functions/importer.d.ts +0 -24
  35. package/dist/functions/importer.js +0 -3
  36. package/dist/functions/index.cjs +0 -3
  37. package/dist/functions/index.d.cts +0 -16
  38. package/dist/functions/index.d.ts +0 -16
  39. package/dist/functions/index.js +0 -3
  40. package/dist/functions/operation-utility.cjs +0 -3
  41. package/dist/functions/operation-utility.d.cts +0 -16
  42. package/dist/functions/operation-utility.d.ts +0 -16
  43. package/dist/functions/operation-utility.js +0 -3
  44. package/dist/functions/utility.cjs +0 -3
  45. package/dist/functions/utility.d.cts +0 -17
  46. package/dist/functions/utility.d.ts +0 -17
  47. package/dist/functions/utility.js +0 -3
  48. package/dist/index.js +0 -3
  49. package/dist/interface/PixiVNJson.cjs +0 -1
  50. package/dist/interface/PixiVNJson.d.cts +0 -30
  51. package/dist/interface/PixiVNJson.d.ts +0 -30
  52. package/dist/interface/PixiVNJson.js +0 -0
  53. package/dist/interface/PixiVNJsonArithmeticOperations.cjs +0 -1
  54. package/dist/interface/PixiVNJsonArithmeticOperations.d.cts +0 -2
  55. package/dist/interface/PixiVNJsonArithmeticOperations.d.ts +0 -2
  56. package/dist/interface/PixiVNJsonArithmeticOperations.js +0 -0
  57. package/dist/interface/PixiVNJsonCanvas.cjs +0 -1
  58. package/dist/interface/PixiVNJsonCanvas.d.cts +0 -71
  59. package/dist/interface/PixiVNJsonCanvas.d.ts +0 -71
  60. package/dist/interface/PixiVNJsonCanvas.js +0 -0
  61. package/dist/interface/PixiVNJsonCanvasAnimate.cjs +0 -1
  62. package/dist/interface/PixiVNJsonCanvasAnimate.d.cts +0 -19
  63. package/dist/interface/PixiVNJsonCanvasAnimate.d.ts +0 -19
  64. package/dist/interface/PixiVNJsonCanvasAnimate.js +0 -0
  65. package/dist/interface/PixiVNJsonCanvasEffect.cjs +0 -1
  66. package/dist/interface/PixiVNJsonCanvasEffect.d.cts +0 -11
  67. package/dist/interface/PixiVNJsonCanvasEffect.d.ts +0 -11
  68. package/dist/interface/PixiVNJsonCanvasEffect.js +0 -0
  69. package/dist/interface/PixiVNJsonCanvasTicker.cjs +0 -1
  70. package/dist/interface/PixiVNJsonCanvasTicker.d.cts +0 -48
  71. package/dist/interface/PixiVNJsonCanvasTicker.d.ts +0 -48
  72. package/dist/interface/PixiVNJsonCanvasTicker.js +0 -0
  73. package/dist/interface/PixiVNJsonConditionalResultToCombine.cjs +0 -1
  74. package/dist/interface/PixiVNJsonConditionalResultToCombine.d.cts +0 -2
  75. package/dist/interface/PixiVNJsonConditionalResultToCombine.d.ts +0 -2
  76. package/dist/interface/PixiVNJsonConditionalResultToCombine.js +0 -0
  77. package/dist/interface/PixiVNJsonConditionalStatements.cjs +0 -1
  78. package/dist/interface/PixiVNJsonConditionalStatements.d.cts +0 -2
  79. package/dist/interface/PixiVNJsonConditionalStatements.d.ts +0 -2
  80. package/dist/interface/PixiVNJsonConditionalStatements.js +0 -0
  81. package/dist/interface/PixiVNJsonConditions.cjs +0 -1
  82. package/dist/interface/PixiVNJsonConditions.d.cts +0 -2
  83. package/dist/interface/PixiVNJsonConditions.d.ts +0 -2
  84. package/dist/interface/PixiVNJsonConditions.js +0 -0
  85. package/dist/interface/PixiVNJsonIfElse.cjs +0 -1
  86. package/dist/interface/PixiVNJsonIfElse.d.cts +0 -2
  87. package/dist/interface/PixiVNJsonIfElse.d.ts +0 -2
  88. package/dist/interface/PixiVNJsonIfElse.js +0 -0
  89. package/dist/interface/PixiVNJsonInput.cjs +0 -1
  90. package/dist/interface/PixiVNJsonInput.d.cts +0 -9
  91. package/dist/interface/PixiVNJsonInput.d.ts +0 -9
  92. package/dist/interface/PixiVNJsonInput.js +0 -0
  93. package/dist/interface/PixiVNJsonLabelStep.cjs +0 -1
  94. package/dist/interface/PixiVNJsonLabelStep.d.cts +0 -114
  95. package/dist/interface/PixiVNJsonLabelStep.d.ts +0 -114
  96. package/dist/interface/PixiVNJsonLabelStep.js +0 -0
  97. package/dist/interface/PixiVNJsonLabels.cjs +0 -1
  98. package/dist/interface/PixiVNJsonLabels.d.cts +0 -20
  99. package/dist/interface/PixiVNJsonLabels.d.ts +0 -20
  100. package/dist/interface/PixiVNJsonLabels.js +0 -0
  101. package/dist/interface/PixiVNJsonMediaTransiotions.cjs +0 -1
  102. package/dist/interface/PixiVNJsonMediaTransiotions.d.cts +0 -30
  103. package/dist/interface/PixiVNJsonMediaTransiotions.d.ts +0 -30
  104. package/dist/interface/PixiVNJsonMediaTransiotions.js +0 -0
  105. package/dist/interface/PixiVNJsonOperations.cjs +0 -1
  106. package/dist/interface/PixiVNJsonOperations.d.cts +0 -18
  107. package/dist/interface/PixiVNJsonOperations.d.ts +0 -18
  108. package/dist/interface/PixiVNJsonOperations.js +0 -0
  109. package/dist/interface/PixiVNJsonSound.cjs +0 -1
  110. package/dist/interface/PixiVNJsonSound.d.cts +0 -27
  111. package/dist/interface/PixiVNJsonSound.d.ts +0 -27
  112. package/dist/interface/PixiVNJsonSound.js +0 -0
  113. package/dist/interface/PixiVNJsonStepSwitch.cjs +0 -1
  114. package/dist/interface/PixiVNJsonStepSwitch.d.cts +0 -2
  115. package/dist/interface/PixiVNJsonStepSwitch.d.ts +0 -2
  116. package/dist/interface/PixiVNJsonStepSwitch.js +0 -0
  117. package/dist/interface/PixiVNJsonUnionCondition.cjs +0 -1
  118. package/dist/interface/PixiVNJsonUnionCondition.d.cts +0 -2
  119. package/dist/interface/PixiVNJsonUnionCondition.d.ts +0 -2
  120. package/dist/interface/PixiVNJsonUnionCondition.js +0 -0
  121. package/dist/interface/PixiVNJsonValue.cjs +0 -1
  122. package/dist/interface/PixiVNJsonValue.d.cts +0 -2
  123. package/dist/interface/PixiVNJsonValue.d.ts +0 -2
  124. package/dist/interface/PixiVNJsonValue.js +0 -0
  125. package/dist/interface/index.cjs +0 -1
  126. package/dist/interface/index.d.cts +0 -13
  127. package/dist/interface/index.d.ts +0 -13
  128. package/dist/interface/index.js +0 -0
  129. package/dist/managers/TranslateManager.cjs +0 -1
  130. package/dist/managers/TranslateManager.d.cts +0 -42
  131. package/dist/managers/TranslateManager.d.ts +0 -42
  132. package/dist/managers/TranslateManager.js +0 -1
  133. package/dist/managers/index.cjs +0 -1
  134. package/dist/managers/index.d.cts +0 -16
  135. package/dist/managers/index.d.ts +0 -16
  136. package/dist/managers/index.js +0 -1
  137. package/dist/utils/log-utility.cjs +0 -1
  138. package/dist/utils/log-utility.d.cts +0 -8
  139. package/dist/utils/log-utility.d.ts +0 -8
  140. package/dist/utils/log-utility.js +0 -1
@@ -1,249 +0,0 @@
1
- import { StorageElementType } from '@drincs/pixi-vn';
2
-
3
- type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
- type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
5
- interface PixiVNJsonRandom<Then> {
6
- type: "stepswitch";
7
- choiceType: "random";
8
- elements: PixiVNJsonStepSwitchElementsType<Then>;
9
- }
10
- interface PixiVNJsonSequentialRandom<Then> {
11
- type: "stepswitch";
12
- choiceType: "sequentialrandom";
13
- elements: PixiVNJsonStepSwitchElementsType<Then>;
14
- /**
15
- * When the sequential ends, what should be the value? If undefined, it will return undefined.
16
- * If "lastItem", it will return the last item in the array.
17
- */
18
- end: undefined | "lastItem";
19
- /**
20
- * The subId is used for manager nested switches
21
- */
22
- nestedId?: string;
23
- }
24
- interface PixiVNJsonSequential<Then> {
25
- type: "stepswitch";
26
- choiceType: "sequential";
27
- elements: PixiVNJsonStepSwitchElementsType<Then>;
28
- /**
29
- * When the sequential ends, what should be the value? If undefined, it will return undefined.
30
- * If "lastItem", it will return the last item in the array.
31
- */
32
- end: undefined | "lastItem";
33
- /**
34
- * The subId is used for manager nested switches
35
- */
36
- nestedId?: string;
37
- }
38
- interface PixiVNJsonLoop<Then> {
39
- type: "stepswitch";
40
- choiceType: "loop";
41
- elements: PixiVNJsonStepSwitchElementsType<Then>;
42
- nestedId?: string;
43
- }
44
- type PixiVNJsonStepSwitch<Then> = PixiVNJsonRandom<Then> | PixiVNJsonSequential<Then> | PixiVNJsonLoop<Then> | PixiVNJsonSequentialRandom<Then>;
45
-
46
- /**
47
- * This element is used in case a {@link PixiVNJsonConditionalStatements} gives a result that must be combined with another calculated through other {@link PixiVNJsonConditionalStatements}.
48
- * in case this possibility is not managed, it will be taken into consideration {@link PixiVNJsonConditionalResultToCombine.firstItem}
49
- */
50
- type PixiVNJsonConditionalResultToCombine<T> = {
51
- type: "resulttocombine";
52
- /**
53
- * This variable is interpreted differently by Pixi'VN depending on the value
54
- */
55
- combine: "cross" | "union";
56
- firstItem?: T;
57
- secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
58
- };
59
-
60
- type PixiVNJsonStorageGet = {
61
- type: "value";
62
- storageOperationType: "get";
63
- /**
64
- * Key of the storage
65
- */
66
- key: string;
67
- /**
68
- * Type of the storage, if it is a flagStorage or a storage.
69
- * If it is a flagStorage, the value will be get with the function {@link getFlag}
70
- */
71
- storageType: "storage" | "flagStorage" | "tempstorage";
72
- };
73
- type PixiVNJsonParamGet = {
74
- type: "value";
75
- storageOperationType: "get";
76
- /**
77
- * Key of the storage
78
- */
79
- key: number;
80
- storageType: "params";
81
- };
82
- type PixiVNJsonLabelGet = {
83
- type: "value";
84
- storageOperationType: "get";
85
- /**
86
- * Id of the label
87
- */
88
- label: string;
89
- /**
90
- * If it is a label, the value will be get with the function {@link narration.getTimesLabelOpened}
91
- */
92
- storageType: "label";
93
- };
94
- type PixiVNJsonChoiceGet = {
95
- type: "value";
96
- storageOperationType: "get";
97
- /**
98
- * index of the choice
99
- */
100
- index: number;
101
- /**
102
- * If it is a choice, the value will be get with the function {@link narration.getTimesChoiceOpened}
103
- */
104
- storageType: "choice";
105
- };
106
- type PixiVNJsonLogicGet = {
107
- type: "value";
108
- storageOperationType: "get";
109
- operation: PixiVNJsonArithmeticOperations | PixiVNJsonConditions;
110
- storageType: "logic";
111
- };
112
- type PixiVNJsonValueGet = PixiVNJsonStorageGet | PixiVNJsonParamGet | PixiVNJsonLabelGet | PixiVNJsonChoiceGet | PixiVNJsonLogicGet;
113
- type PixiVNJsonOnlyStorageSet = {
114
- type: "value";
115
- storageOperationType: "set";
116
- /**
117
- * Key of the storage
118
- */
119
- key: string;
120
- /**
121
- * Value to be set in the storage
122
- */
123
- value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
124
- /**
125
- * Type of the storage, if it is a flagStorage or a storage.
126
- */
127
- storageType: "storage" | "tempstorage";
128
- };
129
- type PixiVNJsonOnlyParamSet = {
130
- type: "value";
131
- storageOperationType: "set";
132
- /**
133
- * Key of the storage
134
- */
135
- key: number;
136
- /**
137
- * Value to be set in the storage
138
- */
139
- value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
140
- storageType: "params";
141
- };
142
- type PixiVNJsonFlagSet = {
143
- type: "value";
144
- storageOperationType: "set";
145
- /**
146
- * Key of the storage
147
- */
148
- key: string;
149
- /**
150
- * Value to be set in the storage
151
- */
152
- value: boolean;
153
- /**
154
- * Type of the storage, if it is a flagStorage or a storage.
155
- */
156
- storageType: "flagStorage";
157
- };
158
- type PixiVNJsonValueSet = PixiVNJsonOnlyStorageSet | PixiVNJsonFlagSet | PixiVNJsonOnlyParamSet;
159
-
160
- interface PixiVNJsonArithmeticOperationsArithmetic {
161
- type: "arithmetic";
162
- /**
163
- * Left value of the arithmetic operation
164
- */
165
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
166
- /**
167
- * Right value of the arithmetic operation
168
- */
169
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
170
- /**
171
- * Operator of the arithmetic operation
172
- */
173
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
174
- }
175
- interface PixiVNJsonArithmeticOperationsArithmeticSingle {
176
- type: "arithmeticsingle";
177
- /**
178
- * Left value of the arithmetic operation
179
- */
180
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
181
- /**
182
- * Operator of the arithmetic operation
183
- */
184
- operator: "INT" | "FLOOR" | "FLOAT";
185
- }
186
- /**
187
- * Arithmetic operations for the PixiVNJson
188
- */
189
- type PixiVNJsonArithmeticOperations = PixiVNJsonArithmeticOperationsArithmeticSingle | PixiVNJsonArithmeticOperationsArithmetic;
190
-
191
- type PixiVNJsonUnionConditionAndOr = {
192
- type: "union";
193
- conditions: PixiVNJsonConditions[];
194
- unionType: "and" | "or";
195
- };
196
- type PixiVNJsonUnionConditionNot = {
197
- type: "union";
198
- condition: PixiVNJsonConditions;
199
- unionType: "not";
200
- };
201
- type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionConditionNot;
202
-
203
- /**
204
- * Comparation for PixiVNJson.
205
- * In this comparation, the values to be converted to string and compared.
206
- */
207
- type PixiVNJsonComparation = {
208
- type: "compare";
209
- /**
210
- * Left value of the comparation
211
- */
212
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
213
- /**
214
- * Right value of the comparation
215
- */
216
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
217
- /**
218
- * Operator of the comparation
219
- */
220
- operator: "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
221
- };
222
- type PixiVNJsonValueCondition = StorageElementType | PixiVNJsonValueGet;
223
- /**
224
- * Conditions for PixiVNJson
225
- */
226
- type PixiVNJsonConditions = PixiVNJsonComparation | PixiVNJsonValueCondition | PixiVNJsonUnionCondition | PixiVNJsonArithmeticOperations;
227
-
228
- /**
229
- * If-Else condition for PixiVNJson
230
- */
231
- interface PixiVNJsonIfElse<Then> {
232
- type: "ifelse";
233
- /**
234
- * The list of conditions to be checked.
235
- */
236
- condition: PixiVNJsonConditions;
237
- /**
238
- * The value to be returned if the condition is true.
239
- */
240
- then: Then | PixiVNJsonIfElse<Then>;
241
- /**
242
- * The value to be returned if the condition is false.
243
- */
244
- else?: Then | PixiVNJsonIfElse<Then>;
245
- }
246
-
247
- type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
248
-
249
- export type { PixiVNJsonArithmeticOperations as P, PixiVNJsonArithmeticOperationsArithmetic as a, PixiVNJsonArithmeticOperationsArithmeticSingle as b, PixiVNJsonConditionalResultToCombine as c, PixiVNJsonConditionalStatements as d, PixiVNJsonComparation as e, PixiVNJsonConditions as f, PixiVNJsonIfElse as g, PixiVNJsonStepSwitch as h, PixiVNJsonStepSwitchElementsType as i, PixiVNJsonStepSwitchElementType as j, PixiVNJsonUnionCondition as k, PixiVNJsonChoiceGet as l, PixiVNJsonLabelGet as m, PixiVNJsonLogicGet as n, PixiVNJsonParamGet as o, PixiVNJsonStorageGet as p, PixiVNJsonValueGet as q, PixiVNJsonValueSet as r };
@@ -1,249 +0,0 @@
1
- import { StorageElementType } from '@drincs/pixi-vn';
2
-
3
- type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
- type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
5
- interface PixiVNJsonRandom<Then> {
6
- type: "stepswitch";
7
- choiceType: "random";
8
- elements: PixiVNJsonStepSwitchElementsType<Then>;
9
- }
10
- interface PixiVNJsonSequentialRandom<Then> {
11
- type: "stepswitch";
12
- choiceType: "sequentialrandom";
13
- elements: PixiVNJsonStepSwitchElementsType<Then>;
14
- /**
15
- * When the sequential ends, what should be the value? If undefined, it will return undefined.
16
- * If "lastItem", it will return the last item in the array.
17
- */
18
- end: undefined | "lastItem";
19
- /**
20
- * The subId is used for manager nested switches
21
- */
22
- nestedId?: string;
23
- }
24
- interface PixiVNJsonSequential<Then> {
25
- type: "stepswitch";
26
- choiceType: "sequential";
27
- elements: PixiVNJsonStepSwitchElementsType<Then>;
28
- /**
29
- * When the sequential ends, what should be the value? If undefined, it will return undefined.
30
- * If "lastItem", it will return the last item in the array.
31
- */
32
- end: undefined | "lastItem";
33
- /**
34
- * The subId is used for manager nested switches
35
- */
36
- nestedId?: string;
37
- }
38
- interface PixiVNJsonLoop<Then> {
39
- type: "stepswitch";
40
- choiceType: "loop";
41
- elements: PixiVNJsonStepSwitchElementsType<Then>;
42
- nestedId?: string;
43
- }
44
- type PixiVNJsonStepSwitch<Then> = PixiVNJsonRandom<Then> | PixiVNJsonSequential<Then> | PixiVNJsonLoop<Then> | PixiVNJsonSequentialRandom<Then>;
45
-
46
- /**
47
- * This element is used in case a {@link PixiVNJsonConditionalStatements} gives a result that must be combined with another calculated through other {@link PixiVNJsonConditionalStatements}.
48
- * in case this possibility is not managed, it will be taken into consideration {@link PixiVNJsonConditionalResultToCombine.firstItem}
49
- */
50
- type PixiVNJsonConditionalResultToCombine<T> = {
51
- type: "resulttocombine";
52
- /**
53
- * This variable is interpreted differently by Pixi'VN depending on the value
54
- */
55
- combine: "cross" | "union";
56
- firstItem?: T;
57
- secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
58
- };
59
-
60
- type PixiVNJsonStorageGet = {
61
- type: "value";
62
- storageOperationType: "get";
63
- /**
64
- * Key of the storage
65
- */
66
- key: string;
67
- /**
68
- * Type of the storage, if it is a flagStorage or a storage.
69
- * If it is a flagStorage, the value will be get with the function {@link getFlag}
70
- */
71
- storageType: "storage" | "flagStorage" | "tempstorage";
72
- };
73
- type PixiVNJsonParamGet = {
74
- type: "value";
75
- storageOperationType: "get";
76
- /**
77
- * Key of the storage
78
- */
79
- key: number;
80
- storageType: "params";
81
- };
82
- type PixiVNJsonLabelGet = {
83
- type: "value";
84
- storageOperationType: "get";
85
- /**
86
- * Id of the label
87
- */
88
- label: string;
89
- /**
90
- * If it is a label, the value will be get with the function {@link narration.getTimesLabelOpened}
91
- */
92
- storageType: "label";
93
- };
94
- type PixiVNJsonChoiceGet = {
95
- type: "value";
96
- storageOperationType: "get";
97
- /**
98
- * index of the choice
99
- */
100
- index: number;
101
- /**
102
- * If it is a choice, the value will be get with the function {@link narration.getTimesChoiceOpened}
103
- */
104
- storageType: "choice";
105
- };
106
- type PixiVNJsonLogicGet = {
107
- type: "value";
108
- storageOperationType: "get";
109
- operation: PixiVNJsonArithmeticOperations | PixiVNJsonConditions;
110
- storageType: "logic";
111
- };
112
- type PixiVNJsonValueGet = PixiVNJsonStorageGet | PixiVNJsonParamGet | PixiVNJsonLabelGet | PixiVNJsonChoiceGet | PixiVNJsonLogicGet;
113
- type PixiVNJsonOnlyStorageSet = {
114
- type: "value";
115
- storageOperationType: "set";
116
- /**
117
- * Key of the storage
118
- */
119
- key: string;
120
- /**
121
- * Value to be set in the storage
122
- */
123
- value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
124
- /**
125
- * Type of the storage, if it is a flagStorage or a storage.
126
- */
127
- storageType: "storage" | "tempstorage";
128
- };
129
- type PixiVNJsonOnlyParamSet = {
130
- type: "value";
131
- storageOperationType: "set";
132
- /**
133
- * Key of the storage
134
- */
135
- key: number;
136
- /**
137
- * Value to be set in the storage
138
- */
139
- value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
140
- storageType: "params";
141
- };
142
- type PixiVNJsonFlagSet = {
143
- type: "value";
144
- storageOperationType: "set";
145
- /**
146
- * Key of the storage
147
- */
148
- key: string;
149
- /**
150
- * Value to be set in the storage
151
- */
152
- value: boolean;
153
- /**
154
- * Type of the storage, if it is a flagStorage or a storage.
155
- */
156
- storageType: "flagStorage";
157
- };
158
- type PixiVNJsonValueSet = PixiVNJsonOnlyStorageSet | PixiVNJsonFlagSet | PixiVNJsonOnlyParamSet;
159
-
160
- interface PixiVNJsonArithmeticOperationsArithmetic {
161
- type: "arithmetic";
162
- /**
163
- * Left value of the arithmetic operation
164
- */
165
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
166
- /**
167
- * Right value of the arithmetic operation
168
- */
169
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
170
- /**
171
- * Operator of the arithmetic operation
172
- */
173
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
174
- }
175
- interface PixiVNJsonArithmeticOperationsArithmeticSingle {
176
- type: "arithmeticsingle";
177
- /**
178
- * Left value of the arithmetic operation
179
- */
180
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
181
- /**
182
- * Operator of the arithmetic operation
183
- */
184
- operator: "INT" | "FLOOR" | "FLOAT";
185
- }
186
- /**
187
- * Arithmetic operations for the PixiVNJson
188
- */
189
- type PixiVNJsonArithmeticOperations = PixiVNJsonArithmeticOperationsArithmeticSingle | PixiVNJsonArithmeticOperationsArithmetic;
190
-
191
- type PixiVNJsonUnionConditionAndOr = {
192
- type: "union";
193
- conditions: PixiVNJsonConditions[];
194
- unionType: "and" | "or";
195
- };
196
- type PixiVNJsonUnionConditionNot = {
197
- type: "union";
198
- condition: PixiVNJsonConditions;
199
- unionType: "not";
200
- };
201
- type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionConditionNot;
202
-
203
- /**
204
- * Comparation for PixiVNJson.
205
- * In this comparation, the values to be converted to string and compared.
206
- */
207
- type PixiVNJsonComparation = {
208
- type: "compare";
209
- /**
210
- * Left value of the comparation
211
- */
212
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
213
- /**
214
- * Right value of the comparation
215
- */
216
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
217
- /**
218
- * Operator of the comparation
219
- */
220
- operator: "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
221
- };
222
- type PixiVNJsonValueCondition = StorageElementType | PixiVNJsonValueGet;
223
- /**
224
- * Conditions for PixiVNJson
225
- */
226
- type PixiVNJsonConditions = PixiVNJsonComparation | PixiVNJsonValueCondition | PixiVNJsonUnionCondition | PixiVNJsonArithmeticOperations;
227
-
228
- /**
229
- * If-Else condition for PixiVNJson
230
- */
231
- interface PixiVNJsonIfElse<Then> {
232
- type: "ifelse";
233
- /**
234
- * The list of conditions to be checked.
235
- */
236
- condition: PixiVNJsonConditions;
237
- /**
238
- * The value to be returned if the condition is true.
239
- */
240
- then: Then | PixiVNJsonIfElse<Then>;
241
- /**
242
- * The value to be returned if the condition is false.
243
- */
244
- else?: Then | PixiVNJsonIfElse<Then>;
245
- }
246
-
247
- type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
248
-
249
- export type { PixiVNJsonArithmeticOperations as P, PixiVNJsonArithmeticOperationsArithmetic as a, PixiVNJsonArithmeticOperationsArithmeticSingle as b, PixiVNJsonConditionalResultToCombine as c, PixiVNJsonConditionalStatements as d, PixiVNJsonComparation as e, PixiVNJsonConditions as f, PixiVNJsonIfElse as g, PixiVNJsonStepSwitch as h, PixiVNJsonStepSwitchElementsType as i, PixiVNJsonStepSwitchElementType as j, PixiVNJsonUnionCondition as k, PixiVNJsonChoiceGet as l, PixiVNJsonLabelGet as m, PixiVNJsonLogicGet as n, PixiVNJsonParamGet as o, PixiVNJsonStorageGet as p, PixiVNJsonValueGet as q, PixiVNJsonValueSet as r };
@@ -1,3 +0,0 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var se=Object.create;var q=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var W=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Z=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of le(t))!ce.call(i,r)&&r!==e&&q(i,r,{get:()=>t[r],enumerable:!(a=oe(t,r))||a.enumerable});return i};var pe=(i,t,e)=>(e=i!=null?se(fe(i)):{},ue(q(e,"default",{value:i,enumerable:true}),i));var ee=Z((I,Q)=>{(function(i,t){typeof I=="object"?Q.exports=I=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(I,function(){var i=i||(function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof W=="function")try{a=W("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||(function(){function n(){}return function(s){var u;return n.prototype=s,u=new n,n.prototype=null,u}})(),f={},p=f.lib={},l=p.Base=(function(){return {extend:function(n){var s=o(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),d=p.WordArray=l.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||x).stringify(this)},concat:function(n){var s=this.words,u=n.words,T=this.sigBytes,N=n.sigBytes;if(this.clamp(),T%4)for(var P=0;P<N;P++){var M=u[P>>>2]>>>24-P%4*8&255;s[T+P>>>2]|=M<<24-(T+P)%4*8;}else for(var E=0;E<N;E+=4)s[T+E>>>2]=u[E>>>2];return this.sigBytes+=N,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=l.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],u=0;u<n;u+=4)s.push(r());return new d.init(s,n)}}),h=f.enc={},x=h.Hex={stringify:function(n){for(var s=n.words,u=n.sigBytes,T=[],N=0;N<u;N++){var P=s[N>>>2]>>>24-N%4*8&255;T.push((P>>>4).toString(16)),T.push((P&15).toString(16));}return T.join("")},parse:function(n){for(var s=n.length,u=[],T=0;T<s;T+=2)u[T>>>3]|=parseInt(n.substr(T,2),16)<<24-T%8*4;return new d.init(u,s/2)}},m=h.Latin1={stringify:function(n){for(var s=n.words,u=n.sigBytes,T=[],N=0;N<u;N++){var P=s[N>>>2]>>>24-N%4*8&255;T.push(String.fromCharCode(P));}return T.join("")},parse:function(n){for(var s=n.length,u=[],T=0;T<s;T++)u[T>>>2]|=(n.charCodeAt(T)&255)<<24-T%4*8;return new d.init(u,s)}},y=h.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},g=p.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new d.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=y.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,u=this._data,T=u.words,N=u.sigBytes,P=this.blockSize,M=P*4,E=N/M;n?E=t.ceil(E):E=t.max((E|0)-this._minBufferSize,0);var O=E*P,Y=t.min(O*4,N);if(O){for(var z=0;z<O;z+=P)this._doProcessBlock(T,z);s=T.splice(0,O),u.sigBytes-=Y;}return new d.init(s,Y)},clone:function(){var n=l.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});p.Hasher=g.extend({cfg:l.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,u){return new n.init(u).finalize(s)}},_createHmacHelper:function(n){return function(s,u){return new b.HMAC.init(n,u).finalize(s)}}});var b=f.algo={};return f})(Math);return i});});var ie=Z((D,te)=>{(function(i,t){typeof D=="object"?te.exports=D=t(ee()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(D,function(i){return (function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,o=t.algo,f=[],p=o.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,d){for(var h=this._hash.words,x=h[0],m=h[1],y=h[2],g=h[3],V=h[4],b=0;b<80;b++){if(b<16)f[b]=l[d+b]|0;else {var n=f[b-3]^f[b-8]^f[b-14]^f[b-16];f[b]=n<<1|n>>>31;}var s=(x<<5|x>>>27)+V+f[b];b<20?s+=(m&y|~m&g)+1518500249:b<40?s+=(m^y^g)+1859775393:b<60?s+=(m&y|m&g|y&g)-1894007588:s+=(m^y^g)-899497514,V=g,g=y,y=m<<30|m>>>2,m=x,x=s;}h[0]=h[0]+x|0,h[1]=h[1]+m|0,h[2]=h[2]+y|0,h[3]=h[3]+g|0,h[4]=h[4]+V|0;},_doFinalize:function(){var l=this._data,d=l.words,h=this._nDataBytes*8,x=l.sigBytes*8;return d[x>>>5]|=128<<24-x%32,d[(x+64>>>9<<4)+14]=Math.floor(h/4294967296),d[(x+64>>>9<<4)+15]=h,l.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=r._createHelper(p),t.HmacSHA1=r._createHmacHelper(p);})(),i.SHA1});});var re=pe(ie());var k="___param___";var v=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(o=>{t[o]===void 0&&(r==="empty_string"?t[o]="":r==="copy_key"&&(i._beforeToTranslate?t[o]=i._beforeToTranslate(o):t[o]=o));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){let{defaultValue:r="copy_key"}=a;return t.forEach(o=>{if(o.choices){let f=[];Array.isArray(o.choices)?f=[o.choices]:f=i.getConditionalsThenElse(o.choices),f.forEach(p=>p.forEach(l=>{if("type"in l){let d=[];l.type==="ifelse"||l.type==="stepswitch"?i.getConditionalsThenElse(l,d):d=[l],d.map(x=>i.getConditionalsThenElse(x.text)).forEach(x=>{Array.isArray(x)&&x.forEach(m=>{Array.isArray(m)?m.forEach(y=>{typeof y=="string"?i.addKey(e,y,{defaultValue:r}):i.getConditionalsThenElse(y).forEach(g=>{Array.isArray(g)?g.forEach(V=>{typeof V=="string"&&i.addKey(e,V,{defaultValue:r});}):typeof g=="string"&&i.addKey(e,g,{defaultValue:r});});}):typeof m=="string"&&i.addKey(e,m,{defaultValue:r});});});}}));}if(o.dialogue){let f=[];Array.isArray(o.dialogue)?f=[o.dialogue]:f=i.getConditionalsThenElse(o.dialogue),f.forEach(p=>{if(typeof p=="string")i.addKey(e,p,{defaultValue:r});else if("text"in p){let l=i.getConditionalsThenElse(p.text);typeof l=="string"&&(l=[l]),l.forEach(d=>{typeof d=="string"?i.addKey(e,d,{defaultValue:r}):i.getConditionalsThenElse(d).forEach(x=>{typeof x=="string"?i.addKey(e,x,{defaultValue:r}):Array.isArray(x)&&x.forEach(m=>{typeof m=="string"?i.addKey(e,m,{defaultValue:r}):i.getConditionalsThenElse(m).forEach(y=>{typeof y=="string"&&i.addKey(e,y,{defaultValue:r});});});});});}});}o.conditionalStep&&i.getConditionalsThenElse(o.conditionalStep).forEach(p=>{Array.isArray(p)?i.generateJsonTranslation(p,e,a):i.generateJsonTranslation([p],e,a);});}),e}};var R=v;var S;(r=>(r.log=(o,...f)=>console.log(`[Pixi\u2019VN Json] ${o}`,...f),r.warn=(o,...f)=>console.warn(`[Pixi\u2019VN Json] ${o}`,...f),r.error=(o,...f)=>console.error(`[Pixi\u2019VN Json] ${o}`,...f),r.info=(o,...f)=>console.info(`[Pixi\u2019VN Json] ${o}`,...f)))(S||={});function ge(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function he(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "resulttocombine":return ye(i);case "ifelse":return c(i.condition)?c(i.then):c(i.else);case "stepswitch":let e=c(i.elements)||[];if(e.length===0){S.error("getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case "random":let a=ge(0,e.length-1);return c(e[a]);case "loop":let r=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),c(e[r]);case "sequential":let o,f=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(o=c(e[e.length-1])),f>e.length-1?o:c(e[f]);case "sequentialrandom":let p=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:true});if(p==null&&i.end=="lastItem"){let l=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!l||!l?.usedRandomNumbers){S.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let d=l.usedRandomNumbers[`0-${e.length-1}`];return c(e[d[d.length-1]])}if(p==null){S.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return c(e[p])}}return i}function _(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(c(i.conditionalStep));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let e={...i,conditionalStep:void 0,...t};return _(e)}else pixiVn.storage.getFlag(pixiVn.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&pixiVn.storage.setFlag(pixiVn.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return i}function ye(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(o=>{let f=c(o);e.push(f);});else {let o=c(r);e.push(o);}});let a=t?[t,...e]:e;if(a.length===0){S.warn("combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return R.t(a);if(typeof a[0]=="object"){let r=a,o,f=r.map((n,s)=>{n=_(n);let u=c(n.dialogue)||"";return s===0?(o=c(n.glueEnabled)||false,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),o===false&&(u=`
2
-
3
- `+u),o=c(n.glueEnabled)||false,u)}),p=c(f[0]),l=typeof p=="object"&&"character"in p?p.character:void 0,d=f.flatMap(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let u;return Array.isArray(s)?u=s.map(T=>{let N=c(T);return R.t(`${N}`)}):u=c(s)||"",R.t(u)}),h=r.find(n=>n.end),x=r.find(n=>n.choices),m=false,y=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&pixiVn.storage.setFlag(pixiVn.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),m=r[r.length-1].glueEnabled,y=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let g=r.find(n=>n.labelToOpen),V=[];return r.forEach(n=>{n.operations&&V.forEach(s=>{V.push(s);});}),{dialogue:l?{character:l,text:d}:d,end:h?.end,choices:x?.choices,glueEnabled:m,goNextStep:y,labelToOpen:g?.labelToOpen,operations:V}}}function me(i){if(!i)return false;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case "compare":let t=c(i.leftValue),e=c(i.rightValue);switch(i.operator){case "==":return t===e;case "!=":return t!==e;case "<":return t<e;case "<=":return t<=e;case ">":return t>e;case ">=":return t>=e;case "CONTAINS":return t.toString().includes(e.toString())}break;case "valueCondition":return !!c(i.value);case "union":return xe(i)}return !!i}function Te(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case "storage":case "tempstorage":return pixiVn.storage.getVariable(i.key);case "flagStorage":return pixiVn.storage.getFlag(i.key);case "label":return pixiVn.narration.getTimesLabelOpened(i.label);case "choice":return pixiVn.narration.getTimesChoiceMade(i.index);case "logic":return c(i.operation);case "params":let t=pixiVn.storage.getVariable(`${k}${pixiVn.narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];S.warn("getValue params not found");return}return i}function xe(i){if(i.unionType==="not")return !c(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=c(i.conditions[e])||false,i.unionType==="and"){if(!t)return false}else if(t)return true;return t}function ne(i){let t=c(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=c(t):e=t,i.storageType){case "flagStorage":pixiVn.storage.setFlag(i.key,i.value);break;case "storage":pixiVn.storage.setVariable(i.key,e);break;case "tempstorage":pixiVn.storage.setTempVariable(i.key,e);break;case "params":let a=pixiVn.storage.getVariable(`${k}${pixiVn.narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),pixiVn.storage.setTempVariable(`${k}${pixiVn.narration.openedLabels.length-1}`,a);break}}function c(i){let t=he(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return Te(t);case "arithmetic":case "arithmeticsingle":return be(t);case "compare":case "valueCondition":case "union":return me(t)}return t}function be(i){let t=c(i.leftValue);switch(i.type){case "arithmetic":let e=c(i.rightValue);switch(i.operator){case "*":return t*e;case "/":return t/e;case "+":return t+e;case "-":return t-e;case "%":return t%e;case "POW":return Math.pow(t,e);case "RANDOM":return pixiVn.narration.getRandomNumber(t,e)}case "arithmeticsingle":switch(i.operator){case "INT":return parseInt(t);case "FLOOR":return Math.floor(t);case "FLOAT":return parseFloat(t)}break}}async function G(i){let t=c(i);if(t)switch(t.type){case "assets":switch(t.operationType){case "load":await pixiVn.Assets.load(t.aliases);break;case "lazyload":pixiVn.Assets.backgroundLoad(t.aliases);break}break;case "bundle":switch(t.operationType){case "load":await pixiVn.Assets.loadBundle(t.aliases);break;case "lazyload":pixiVn.Assets.backgroundLoadBundle(t.aliases);break}break}}async function X(i,t){let e=c(i);if(e)switch(e.type){case "sound":switch(e.operationType){case "play":pixiVn.sound.play(e.alias,e.props);break;case "stop":pixiVn.sound.stop(e.alias);break;case "pause":pixiVn.sound.pause(e.alias);break;case "resume":pixiVn.sound.resume(e.alias);break;case "volume":pixiVn.sound.volume(e.alias,e.value);break}break;case "assets":case "bundle":await G(e);break;case "image":switch(e.operationType){case "show":let p=new pixiVn.ImageSprite(e.props,e.url||e.alias);await U(p,e);break;case "edit":let l=pixiVn.canvas.find(e.alias);l?e.props&&await l.setMemory({...l.memory,...e.props}):S.error(`Image with alias ${e.alias} not found.`);break;case "remove":F(e);break}break;case "video":switch(e.operationType){case "show":let p=new pixiVn.VideoSprite(e.props,e.url||e.alias);await U(p,e);break;case "edit":let l=pixiVn.canvas.find(e.alias);l?e.props&&await l.setMemory({...l.memory,...e.props}):S.error(`Video with alias ${e.alias} not found.`);break;case "remove":F(e);break;case "pause":let d=pixiVn.canvas.find(e.alias);d?d.paused=true:S.error(`Video with alias ${e.alias} not found.`);break;case "resume":let h=pixiVn.canvas.find(e.alias);h?h.paused=false:S.error(`Video with alias ${e.alias} not found.`);break}break;case "imagecontainer":switch(e.operationType){case "show":let p=new pixiVn.ImageContainer(e.props,e.urls);await U(p,e);break;case "edit":let l=pixiVn.canvas.find(e.alias);l?e.props&&await l.setMemory({...l.memory,...e.props}):S.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":F(e);break}break;case "canvaselement":switch(e.operationType){case "edit":try{let p=pixiVn.canvas.find(e.alias);p?e.props&&(p.memory={...p.memory,...e.props}):S.error(`Canvas Element with alias ${e.alias} not found.`);}catch(p){S.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,p);}break;case "remove":F(e);break}break;case "value":ne(e);break;case "operationtoconvert":if(t){let p="";e.values.forEach(d=>{if(typeof d=="string")p+=d;else {let h=c(d);p+=`${h}`;}});let l=await t(p);l&&await X(l,t);}break;case "input":switch(e.operationType){case "request":pixiVn.narration.requestInput({type:e.valueType},e.defaultValue);break}break;case "fade":let a=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case "move":let r=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,r);break;case "rotate":let o=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,o);break;case "zoom":let f=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,f);break;case "shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}async function U(i,t){if(t.transition)switch(t.transition.type){case "fade":await pixiVn.showWithFade(t.alias,i,t.transition.props,t.transition.priority);break;case "dissolve":await pixiVn.showWithDissolve(t.alias,i,t.transition.props,t.transition.priority);break;case "movein":case "moveout":await pixiVn.moveIn(t.alias,i,t.transition.props,t.transition.priority);break;case "zoomin":case "zoomout":await pixiVn.zoomIn(t.alias,i,t.transition.props,t.transition.priority);break;case "pushin":case "pushout":await pixiVn.pushIn(t.alias,i,t.transition.props,t.transition.priority);break}else await i.load(),pixiVn.canvas.add(t.alias,i);}function F(i){if(i.transition)switch(i.transition.type){case "fade":pixiVn.removeWithFade(i.alias,i.transition.props,i.transition.priority);break;case "dissolve":pixiVn.removeWithDissolve(i.alias,i.transition.props,i.transition.priority);break;case "movein":case "moveout":pixiVn.moveOut(i.alias,i.transition.props,i.transition.priority);break;case "zoomin":case "zoomout":pixiVn.zoomOut(i.alias,i.transition.props,i.transition.priority);break;case "pushin":case "pushout":pixiVn.pushOut(i.alias,i.transition.props,i.transition.priority);break}else pixiVn.canvas.remove(i.alias);}var j=class extends pixiVn.LabelAbstract{constructor(t,e,a,r={}){a||(a={}),a.onLoadingLabel=async()=>{for(let o of e){let f;if(typeof o=="function"?f=o():f=o,f=_(f),f.operations){let p=f.operations.map(l=>G(l));await Promise.all(p);}}},super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let e=this._steps[t];return this.stepConverter(e)}operationStringConvert;skipEmptyDialogs=false;getStepSha(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, re.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let o=c(r);o?(o&&!Array.isArray(o)&&typeof o=="object"&&(o=c(o)||""),Array.isArray(o)?a=a.concat(o):a.push(`${o}`)):a.push(`${r}`);}}),e=a;}else {let a=c(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=c(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=c(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:v.t(this.getDialogueText(e.text))}:v.t(this.getDialogueText(e))}getChoices(t){return c(t)?.map(r=>c(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a=typeof t=="function"?t():t;a=pixiVn.createExportableElement(a),a=_(a);let r=this.operationStringConvert?y=>this.operationStringConvert(y,a,e):void 0,{operations:o=[]}=a;for(let y of o)await X(y,r);let{labelToOpen:f=[]}=a,p=this.getChoices(a.choices),l=c(a.glueEnabled),d=this.getDialogue(a.dialogue),h=[];Array.isArray(f)||(f=[f]),f.forEach(y=>{let g=c(y);g&&h.push(g);});let x=c(a.goNextStep),m=c(a.end);if(p){let y=p.map(g=>{let V="";if(Array.isArray(g.text)){let n=[];g.text.forEach(s=>{if(typeof s=="string")n.push(v.t(s));else if(s&&typeof s=="object"){let u=c(s);u&&!Array.isArray(u)&&typeof u=="object"&&(u=c(u)||""),u&&(Array.isArray(u)?n=n.concat(v.t(u)):n.push(v.t(u)));}}),V=n;}else typeof g.text=="string"&&(V=v.t(g.text));return {label:g.label,text:V,props:g.props,type:g.type,oneTime:g.oneTime,onlyHaveNoChoice:g.onlyHaveNoChoice,autoSelect:g.autoSelect}});pixiVn.narration.choiceMenuOptions=y;}else pixiVn.narration.choiceMenuOptions=void 0;d!==void 0&&(pixiVn.narration.dialogue=d,this.skipEmptyDialogs&&typeof d=="string"&&(d===""||RegExp(/^\s+$/).test(d))&&(x=true)),l?pixiVn.storage.setFlag(pixiVn.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):l===false&&pixiVn.storage.setFlag(pixiVn.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let y of h){let g=y.label;typeof g=="object"&&(g=c(g)||"");let V=y.params?.map(b=>c(b));e={...e,...y.props},y.type==="jump"?(pixiVn.narration.openedLabels.length>0&&pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${k}${pixiVn.narration.openedLabels.length}`,V),await pixiVn.narration.callLabel(g,e)):(pixiVn.storage.setTempVariable(`${k}${pixiVn.narration.openedLabels.length}`,V),await pixiVn.narration.callLabel(g,e));}m==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e,{runNow:true})):m==="label_end"&&pixiVn.narration.closeCurrentLabel(),x&&await pixiVn.narration.goNext(e,{runNow:true});}}};module.exports=j;
@@ -1,44 +0,0 @@
1
- import { LabelAbstract, LabelProps, StepLabelPropsType, StepLabelType } from '@drincs/pixi-vn';
2
- import PixiVNJsonLabelStep from '../interface/PixiVNJsonLabelStep.cjs';
3
- import { PixiVNJsonOperation } from '../interface/PixiVNJsonOperations.cjs';
4
- import '../PixiVNJsonConditionalStatements-S3pFEkW9.cjs';
5
- import '../interface/PixiVNJsonCanvas.cjs';
6
- import '../interface/PixiVNJsonCanvasAnimate.cjs';
7
- import '../interface/PixiVNJsonCanvasEffect.cjs';
8
- import '../interface/PixiVNJsonCanvasTicker.cjs';
9
- import '../interface/PixiVNJsonMediaTransiotions.cjs';
10
- import '../interface/PixiVNJsonInput.cjs';
11
- import '../interface/PixiVNJsonSound.cjs';
12
-
13
- type LabelJsonOptions = {
14
- /**
15
- * Function that converts a string to a {@link PixiVNJsonOperation}.
16
- * If is a special operation you can return undefined and can run the operation.
17
- */
18
- operationStringConvert?: (value: string, step: PixiVNJsonLabelStep, props: StepLabelPropsType | {}) => Promise<PixiVNJsonOperation | undefined>;
19
- /**
20
- * If true and a dialog is empty or has only spaces, {@link PixiVNJsonLabelStep.goNextStep} will be set to true.
21
- */
22
- skipEmptyDialogs?: boolean;
23
- };
24
- declare class LabelJson<T extends {} = {}> extends LabelAbstract<LabelJson<T>, T> {
25
- /**
26
- * @param id is the id of the label
27
- * @param steps is the list of steps that the label will perform
28
- * @param props is the properties of the label
29
- */
30
- constructor(id: string, steps: (PixiVNJsonLabelStep | (() => PixiVNJsonLabelStep))[], props?: LabelProps<LabelJson<T>>, options?: LabelJsonOptions);
31
- private _steps;
32
- get steps(): StepLabelType<T>[];
33
- get stepCount(): number;
34
- getStepById(stepId: number): StepLabelType<T> | undefined;
35
- private operationStringConvert?;
36
- private skipEmptyDialogs;
37
- getStepSha(index: number): string | undefined;
38
- private getDialogueText;
39
- private getDialogue;
40
- private getChoices;
41
- private stepConverter;
42
- }
43
-
44
- export { type LabelJsonOptions, LabelJson as default };
@@ -1,44 +0,0 @@
1
- import { LabelAbstract, LabelProps, StepLabelPropsType, StepLabelType } from '@drincs/pixi-vn';
2
- import PixiVNJsonLabelStep from '../interface/PixiVNJsonLabelStep.js';
3
- import { PixiVNJsonOperation } from '../interface/PixiVNJsonOperations.js';
4
- import '../PixiVNJsonConditionalStatements-S3pFEkW9.js';
5
- import '../interface/PixiVNJsonCanvas.js';
6
- import '../interface/PixiVNJsonCanvasAnimate.js';
7
- import '../interface/PixiVNJsonCanvasEffect.js';
8
- import '../interface/PixiVNJsonCanvasTicker.js';
9
- import '../interface/PixiVNJsonMediaTransiotions.js';
10
- import '../interface/PixiVNJsonInput.js';
11
- import '../interface/PixiVNJsonSound.js';
12
-
13
- type LabelJsonOptions = {
14
- /**
15
- * Function that converts a string to a {@link PixiVNJsonOperation}.
16
- * If is a special operation you can return undefined and can run the operation.
17
- */
18
- operationStringConvert?: (value: string, step: PixiVNJsonLabelStep, props: StepLabelPropsType | {}) => Promise<PixiVNJsonOperation | undefined>;
19
- /**
20
- * If true and a dialog is empty or has only spaces, {@link PixiVNJsonLabelStep.goNextStep} will be set to true.
21
- */
22
- skipEmptyDialogs?: boolean;
23
- };
24
- declare class LabelJson<T extends {} = {}> extends LabelAbstract<LabelJson<T>, T> {
25
- /**
26
- * @param id is the id of the label
27
- * @param steps is the list of steps that the label will perform
28
- * @param props is the properties of the label
29
- */
30
- constructor(id: string, steps: (PixiVNJsonLabelStep | (() => PixiVNJsonLabelStep))[], props?: LabelProps<LabelJson<T>>, options?: LabelJsonOptions);
31
- private _steps;
32
- get steps(): StepLabelType<T>[];
33
- get stepCount(): number;
34
- getStepById(stepId: number): StepLabelType<T> | undefined;
35
- private operationStringConvert?;
36
- private skipEmptyDialogs;
37
- getStepSha(index: number): string | undefined;
38
- private getDialogueText;
39
- private getDialogue;
40
- private getChoices;
41
- private stepConverter;
42
- }
43
-
44
- export { type LabelJsonOptions, LabelJson as default };