qpremake 1.5.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/README.md +184 -0
- package/lib/_localizationFiles/English.d.ts +2 -0
- package/lib/_localizationFiles/English.js +307 -0
- package/lib/_mods/parserModules/addSymbol.d.ts +7 -0
- package/lib/_mods/parserModules/addSymbol.js +18 -0
- package/lib/_mods/parserModules/expression.d.ts +7 -0
- package/lib/_mods/parserModules/expression.js +45 -0
- package/lib/_mods/parserModules/expression_parser.d.ts +143 -0
- package/lib/_mods/parserModules/expression_parser.js +728 -0
- package/lib/_mods/parserModules/img.d.ts +8 -0
- package/lib/_mods/parserModules/img.js +42 -0
- package/lib/_mods/parserModules/qpOriginal.d.ts +5 -0
- package/lib/_mods/parserModules/qpOriginal.js +27 -0
- package/lib/_mods/parserModules/sectionID.d.ts +13 -0
- package/lib/_mods/parserModules/sectionID.js +56 -0
- package/lib/_mods/parserModules/tags.d.ts +9 -0
- package/lib/_mods/parserModules/tags.js +29 -0
- package/lib/_mods/parserModules/uaddminus.d.ts +9 -0
- package/lib/_mods/parserModules/uaddminus.js +42 -0
- package/lib/_mods/parserModules/variantCheck.d.ts +10 -0
- package/lib/_mods/parserModules/variantCheck.js +53 -0
- package/lib/_queenSystem/handler/actionGenrator.d.ts +994 -0
- package/lib/_queenSystem/handler/actionGenrator.js +646 -0
- package/lib/_queenSystem/handler/actionInputGenerator.d.ts +95 -0
- package/lib/_queenSystem/handler/actionInputGenerator.js +373 -0
- package/lib/_queenSystem/handler/actionInputRequesterGenerator.d.ts +92 -0
- package/lib/_queenSystem/handler/actionInputRequesterGenerator.js +341 -0
- package/lib/_queenSystem/handler/cardHandler.d.ts +20 -0
- package/lib/_queenSystem/handler/cardHandler.js +61 -0
- package/lib/_queenSystem/handler/effectGenerator.d.ts +1 -0
- package/lib/_queenSystem/handler/effectGenerator.js +127 -0
- package/lib/_queenSystem/handler/localizationHandler.d.ts +28 -0
- package/lib/_queenSystem/handler/localizationHandler.js +166 -0
- package/lib/_queenSystem/handler/modHandler.d.ts +10 -0
- package/lib/_queenSystem/handler/modHandler.js +36 -0
- package/lib/_queenSystem/handler/oldDataProcessor.d.ts +9 -0
- package/lib/_queenSystem/handler/oldDataProcessor.js +129 -0
- package/lib/_queenSystem/handler/registryHandler.d.ts +36 -0
- package/lib/_queenSystem/handler/registryHandler.js +63 -0
- package/lib/_queenSystem/handler/zoneHandler.d.ts +102 -0
- package/lib/_queenSystem/handler/zoneHandler.js +606 -0
- package/lib/_queenSystem/loader/loader_card.d.ts +20 -0
- package/lib/_queenSystem/loader/loader_card.js +124 -0
- package/lib/_queenSystem/loader/loader_effect.d.ts +27 -0
- package/lib/_queenSystem/loader/loader_effect.js +163 -0
- package/lib/_queenSystem/loader/loader_handler.d.ts +11 -0
- package/lib/_queenSystem/loader/loader_handler.js +24 -0
- package/lib/_queenSystem/loader/loader_localization.d.ts +11 -0
- package/lib/_queenSystem/loader/loader_localization.js +73 -0
- package/lib/_queenSystem/loader/loader_mod.d.ts +10 -0
- package/lib/_queenSystem/loader/loader_mod.js +72 -0
- package/lib/_queenSystem/loader/loader_subtype.d.ts +9 -0
- package/lib/_queenSystem/loader/loader_subtype.js +39 -0
- package/lib/_queenSystem/loader/loader_type.d.ts +9 -0
- package/lib/_queenSystem/loader/loader_type.js +39 -0
- package/lib/_queenSystem/loader/loader_zone.d.ts +14 -0
- package/lib/_queenSystem/loader/loader_zone.js +35 -0
- package/lib/_queenSystem/queenSystem.d.ts +127 -0
- package/lib/_queenSystem/queenSystem.js +996 -0
- package/lib/_queenSystem/renderer/rendererInterface.d.ts +9 -0
- package/lib/_queenSystem/renderer/rendererInterface.js +2 -0
- package/lib/data/actionRegistry.d.ts +56 -0
- package/lib/data/actionRegistry.js +60 -0
- package/lib/data/cardRegistry.d.ts +1162 -0
- package/lib/data/cardRegistry.js +716 -0
- package/lib/data/deckRegistry.d.ts +19 -0
- package/lib/data/deckRegistry.js +41 -0
- package/lib/data/effectRegistry.d.ts +465 -0
- package/lib/data/effectRegistry.js +151 -0
- package/lib/data/effectTypeRegistry.d.ts +14 -0
- package/lib/data/effectTypeRegistry.js +14 -0
- package/lib/data/operatorRegistry.d.ts +92 -0
- package/lib/data/operatorRegistry.js +82 -0
- package/lib/data/rarityRegistry.d.ts +28 -0
- package/lib/data/rarityRegistry.js +63 -0
- package/lib/data/registryRegistry.d.ts +10 -0
- package/lib/data/registryRegistry.js +14 -0
- package/lib/data/subtypeRegistry.d.ts +15 -0
- package/lib/data/subtypeRegistry.js +15 -0
- package/lib/data/systemRegistry.d.ts +253 -0
- package/lib/data/systemRegistry.js +56 -0
- package/lib/data/zoneRegistry.d.ts +43 -0
- package/lib/data/zoneRegistry.js +157 -0
- package/lib/effectTextParser/index.d.ts +42 -0
- package/lib/effectTextParser/index.js +316 -0
- package/lib/global/index.d.ts +8 -0
- package/lib/global/index.js +12 -0
- package/lib/index.d.ts +6344 -0
- package/lib/index.js +213 -0
- package/lib/specificEffects/e_cond.d.ts +11 -0
- package/lib/specificEffects/e_cond.js +36 -0
- package/lib/specificEffects/e_fruit.d.ts +3 -0
- package/lib/specificEffects/e_fruit.js +187 -0
- package/lib/specificEffects/e_generic.d.ts +191 -0
- package/lib/specificEffects/e_generic.js +662 -0
- package/lib/specificEffects/e_generic_cardTargetting.d.ts +38 -0
- package/lib/specificEffects/e_generic_cardTargetting.js +82 -0
- package/lib/specificEffects/e_generic_noneTargetting.d.ts +10 -0
- package/lib/specificEffects/e_generic_noneTargetting.js +26 -0
- package/lib/specificEffects/e_status.d.ts +80 -0
- package/lib/specificEffects/e_status.js +151 -0
- package/lib/specificEffects/e_test.d.ts +3 -0
- package/lib/specificEffects/e_test.js +21 -0
- package/lib/types/abstract/gameComponents/API.d.ts +19 -0
- package/lib/types/abstract/gameComponents/API.js +2 -0
- package/lib/types/abstract/gameComponents/card.d.ts +108 -0
- package/lib/types/abstract/gameComponents/card.js +771 -0
- package/lib/types/abstract/gameComponents/effect.d.ts +82 -0
- package/lib/types/abstract/gameComponents/effect.js +331 -0
- package/lib/types/abstract/gameComponents/effectSubtype.d.ts +22 -0
- package/lib/types/abstract/gameComponents/effectSubtype.js +40 -0
- package/lib/types/abstract/gameComponents/effectType.d.ts +11 -0
- package/lib/types/abstract/gameComponents/effectType.js +8 -0
- package/lib/types/abstract/gameComponents/settings.d.ts +80 -0
- package/lib/types/abstract/gameComponents/settings.js +68 -0
- package/lib/types/abstract/gameComponents/zone.d.ts +113 -0
- package/lib/types/abstract/gameComponents/zone.js +614 -0
- package/lib/types/abstract/gameComponents/zone_gridBased.d.ts +18 -0
- package/lib/types/abstract/gameComponents/zone_gridBased.js +58 -0
- package/lib/types/abstract/gameComponents/zone_stackBased.d.ts +13 -0
- package/lib/types/abstract/gameComponents/zone_stackBased.js +55 -0
- package/lib/types/abstract/generics/node.d.ts +23 -0
- package/lib/types/abstract/generics/node.js +46 -0
- package/lib/types/abstract/generics/position.d.ts +23 -0
- package/lib/types/abstract/generics/position.js +91 -0
- package/lib/types/abstract/generics/tree.d.ts +25 -0
- package/lib/types/abstract/generics/tree.js +153 -0
- package/lib/types/abstract/generics/universalResponse.d.ts +4 -0
- package/lib/types/abstract/generics/universalResponse.js +2 -0
- package/lib/types/abstract/generics/wraper.d.ts +21 -0
- package/lib/types/abstract/generics/wraper.js +56 -0
- package/lib/types/abstract/parser/component.d.ts +88 -0
- package/lib/types/abstract/parser/component.js +132 -0
- package/lib/types/abstract/parser/index.d.ts +6 -0
- package/lib/types/abstract/parser/index.js +28 -0
- package/lib/types/abstract/parser/modPack.d.ts +21 -0
- package/lib/types/abstract/parser/modPack.js +48 -0
- package/lib/types/abstract/parser/moduleInputObject.d.ts +12 -0
- package/lib/types/abstract/parser/moduleInputObject.js +21 -0
- package/lib/types/abstract/parser/options.d.ts +31 -0
- package/lib/types/abstract/parser/options.js +45 -0
- package/lib/types/abstract/serializedGameComponents/Gamestate.d.ts +46 -0
- package/lib/types/abstract/serializedGameComponents/Gamestate.js +70 -0
- package/lib/types/abstract/serializedGameComponents/Localized.d.ts +69 -0
- package/lib/types/abstract/serializedGameComponents/Localized.js +84 -0
- package/lib/types/defaultZones/ability.d.ts +10 -0
- package/lib/types/defaultZones/ability.js +22 -0
- package/lib/types/defaultZones/deck.d.ts +25 -0
- package/lib/types/defaultZones/deck.js +90 -0
- package/lib/types/defaultZones/drop.d.ts +5 -0
- package/lib/types/defaultZones/drop.js +13 -0
- package/lib/types/defaultZones/field.d.ts +11 -0
- package/lib/types/defaultZones/field.js +35 -0
- package/lib/types/defaultZones/grave.d.ts +8 -0
- package/lib/types/defaultZones/grave.js +21 -0
- package/lib/types/defaultZones/hand.d.ts +5 -0
- package/lib/types/defaultZones/hand.js +14 -0
- package/lib/types/defaultZones/storage.d.ts +9 -0
- package/lib/types/defaultZones/storage.js +21 -0
- package/lib/types/defaultZones/system.d.ts +12 -0
- package/lib/types/defaultZones/system.js +35 -0
- package/lib/types/defaultZones/void.d.ts +4 -0
- package/lib/types/defaultZones/void.js +10 -0
- package/lib/types/effects/effectSubtypes/subtype_chained.d.ts +10 -0
- package/lib/types/effects/effectSubtypes/subtype_chained.js +17 -0
- package/lib/types/effects/effectSubtypes/subtype_delayed.d.ts +9 -0
- package/lib/types/effects/effectSubtypes/subtype_delayed.js +16 -0
- package/lib/types/effects/effectSubtypes/subtype_fieldLock.d.ts +9 -0
- package/lib/types/effects/effectSubtypes/subtype_fieldLock.js +21 -0
- package/lib/types/effects/effectSubtypes/subtype_graveLock.d.ts +9 -0
- package/lib/types/effects/effectSubtypes/subtype_graveLock.js +21 -0
- package/lib/types/effects/effectSubtypes/subtype_hand_or_fieldLock.d.ts +9 -0
- package/lib/types/effects/effectSubtypes/subtype_hand_or_fieldLock.js +21 -0
- package/lib/types/effects/effectSubtypes/subtype_hardUnique.d.ts +9 -0
- package/lib/types/effects/effectSubtypes/subtype_hardUnique.js +15 -0
- package/lib/types/effects/effectSubtypes/subtype_instant.d.ts +8 -0
- package/lib/types/effects/effectSubtypes/subtype_instant.js +20 -0
- package/lib/types/effects/effectSubtypes/subtype_once.d.ts +12 -0
- package/lib/types/effects/effectSubtypes/subtype_once.js +27 -0
- package/lib/types/effects/effectSubtypes/subtype_unique.d.ts +9 -0
- package/lib/types/effects/effectSubtypes/subtype_unique.js +16 -0
- package/lib/types/effects/effectTypes/initEffect.d.ts +7 -0
- package/lib/types/effects/effectTypes/initEffect.js +23 -0
- package/lib/types/effects/effectTypes/lockEffect.d.ts +9 -0
- package/lib/types/effects/effectTypes/lockEffect.js +25 -0
- package/lib/types/effects/effectTypes/manualEffect.d.ts +9 -0
- package/lib/types/effects/effectTypes/manualEffect.js +18 -0
- package/lib/types/effects/effectTypes/passiveEffect.d.ts +9 -0
- package/lib/types/effects/effectTypes/passiveEffect.js +23 -0
- package/lib/types/effects/effectTypes/triggerEffect.d.ts +9 -0
- package/lib/types/effects/effectTypes/triggerEffect.js +28 -0
- package/lib/types/errors/cannotLoad.d.ts +5 -0
- package/lib/types/errors/cannotLoad.js +13 -0
- package/lib/types/errors/cardNotExist.d.ts +5 -0
- package/lib/types/errors/cardNotExist.js +13 -0
- package/lib/types/errors/cardNotInApplicableZone.d.ts +5 -0
- package/lib/types/errors/cardNotInApplicableZone.js +13 -0
- package/lib/types/errors/effectCondNotMet.d.ts +5 -0
- package/lib/types/errors/effectCondNotMet.js +13 -0
- package/lib/types/errors/effectNotExist.d.ts +5 -0
- package/lib/types/errors/effectNotExist.js +13 -0
- package/lib/types/errors/error.d.ts +17 -0
- package/lib/types/errors/error.js +42 -0
- package/lib/types/errors/incorrectActionType.d.ts +5 -0
- package/lib/types/errors/incorrectActionType.js +13 -0
- package/lib/types/errors/index.d.ts +16 -0
- package/lib/types/errors/index.js +36 -0
- package/lib/types/errors/invalidOrderMap.d.ts +6 -0
- package/lib/types/errors/invalidOrderMap.js +14 -0
- package/lib/types/errors/invalidPosition.d.ts +6 -0
- package/lib/types/errors/invalidPosition.js +13 -0
- package/lib/types/errors/subTypeOverrideConflict.d.ts +7 -0
- package/lib/types/errors/subTypeOverrideConflict.js +15 -0
- package/lib/types/errors/unknownError.d.ts +5 -0
- package/lib/types/errors/unknownError.js +13 -0
- package/lib/types/errors/unregisteredAction.d.ts +6 -0
- package/lib/types/errors/unregisteredAction.js +13 -0
- package/lib/types/errors/wrongEffectIdx.d.ts +5 -0
- package/lib/types/errors/wrongEffectIdx.js +14 -0
- package/lib/types/errors/zoneAttrConflict.d.ts +5 -0
- package/lib/types/errors/zoneAttrConflict.js +15 -0
- package/lib/types/errors/zoneFull.d.ts +5 -0
- package/lib/types/errors/zoneFull.js +13 -0
- package/lib/types/errors/zoneNotExist.d.ts +5 -0
- package/lib/types/errors/zoneNotExist.js +13 -0
- package/lib/types/misc.d.ts +97 -0
- package/lib/types/misc.js +8 -0
- package/lib/types/mods/effectTextParserModule.d.ts +16 -0
- package/lib/types/mods/effectTextParserModule.js +81 -0
- package/lib/types/mods/gameModule.d.ts +5 -0
- package/lib/types/mods/gameModule.js +8 -0
- package/lib/utils/index.d.ts +78 -0
- package/lib/utils/index.js +562 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# qpRemake
|
|
2
|
+
Alpha branch is finally ended and will be merged into main!!, only a renderer pending!
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
1. make effects
|
|
6
|
+
2. add more actions (if needed)
|
|
7
|
+
3. update the effect registry
|
|
8
|
+
4. update the card registry
|
|
9
|
+
5. add a deck registry
|
|
10
|
+
6. make level / wave control
|
|
11
|
+
7. make a good renderer
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Current progress:
|
|
16
|
+
|
|
17
|
+
| | Cards | Effects | Archtypes | Actions |
|
|
18
|
+
|:--------------:|:-----:|:-------:|:---------:|:-------:|
|
|
19
|
+
|<span style="color:green">Current</span> | <span style="color:green">49</span> | <span style="color:green">59</span> | <span style="color:green">1.5*</span> | <span style="color:green">50</span> |
|
|
20
|
+
| <span style="color:orange">Total</span> | <span style="color:orange">200</span> | <span style="color:orange">600?</span> | <span style="color:orange">12</span> | |
|
|
21
|
+
|
|
22
|
+
( * ) : Fruit and Some of Generic
|
|
23
|
+
|
|
24
|
+
## How to get and run the project
|
|
25
|
+
|
|
26
|
+
### Clone the project:
|
|
27
|
+
|
|
28
|
+
In an empty folder you want the project in, open a terminal and run:
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/BlueG15/qpRemake
|
|
31
|
+
```
|
|
32
|
+
### Run the project
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run dev
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This runs ```tsc```, adn then run ```./build/main.js```
|
|
39
|
+
|
|
40
|
+
## Game components
|
|
41
|
+
system have zones, zones have cards, cards have effects, effects have types and subtypes
|
|
42
|
+
effects "activate" by sending API calls to system in the form of Actions
|
|
43
|
+
|
|
44
|
+
> TODO : explain this stuff better
|
|
45
|
+
|
|
46
|
+
## Main gameplay loop
|
|
47
|
+
|
|
48
|
+
A turn starts when a player performs an action, then proceeds in phases; to simplify its
|
|
49
|
+
chain -> resolution -> trigger
|
|
50
|
+
these steps go in a loop until every action is resolved
|
|
51
|
+
|
|
52
|
+
> TODO : add infinite loop detection somehow
|
|
53
|
+
|
|
54
|
+
## Project structure
|
|
55
|
+
```
|
|
56
|
+
/queenSystem (main folder)
|
|
57
|
+
|----> /handler
|
|
58
|
+
|----> /loader
|
|
59
|
+
|----> /renderer
|
|
60
|
+
|----> rendererInterface.ts
|
|
61
|
+
|----> queenSystem
|
|
62
|
+
|----> testSuite
|
|
63
|
+
|
|
64
|
+
/data
|
|
65
|
+
|----> various registries (enums and const and whatnot)
|
|
66
|
+
|
|
67
|
+
/types
|
|
68
|
+
|----> classes and types and stuff
|
|
69
|
+
|
|
70
|
+
/specificEffects <--- expand this folder
|
|
71
|
+
|----> effect files
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> TODO : draw better diagrams for this
|
|
75
|
+
|
|
76
|
+
## Contribution workflow guide
|
|
77
|
+
|
|
78
|
+
### Make effects
|
|
79
|
+
|
|
80
|
+
This process involves making a class extending from either ```Effect``` or an existing class that does (something else in the ```SpecificEffects``` folder)
|
|
81
|
+
|
|
82
|
+
This child class has 5 jobs :
|
|
83
|
+
1. Overriding ```canRespondAndActivate_final``` to check the activation condition of the card (ignoring any types or subtypes conditions). If the effect does not have an condition, just return true.
|
|
84
|
+
|
|
85
|
+
> This function takes in a readonly version of the ```Card``` the effect is housed, the current ```system``` object and the current ```Action```. Returns a boolean.
|
|
86
|
+
|
|
87
|
+
2. Overriding ```activate_final``` to well...activate. This function only gets called if the above function returns true, so declare the type of the Action parameter differently if you want.
|
|
88
|
+
|
|
89
|
+
> This function takes in a readonly version of the ```Card``` the effect is housed, the current ```system``` object and the current ```Action```. Returns an ```Action[]```.
|
|
90
|
+
|
|
91
|
+
3. Overriding ```createInputObj``` to inform the system of what type of input to take in, return ```undefined``` means no input. One can invoke the ```Request``` object to create an input object quickly, or just create one manually.
|
|
92
|
+
|
|
93
|
+
> This whole system is not...great imo, but hopefully its "servicable"
|
|
94
|
+
|
|
95
|
+
4. If the effect has a parameter (most do, since x and upgraded x may behave the exact same just with different number so its convenient to write it once), you can make a quick getter and setter to access a ```Map<string, number>``` within the effect named ```attr```, this map will be loaded with data upon effect creation. (This getter and setter is optional as no outside system uses this, only this effect and maybe others extending from it)
|
|
96
|
+
|
|
97
|
+
5. Return some parameters to inject into the effect text by overriding the ```getDisplayInput``` function.
|
|
98
|
+
|
|
99
|
+
Going over how to make an action, you need to invoke the const ```actionConstructorRegistry```, hopefully ts takes over the rest of the guiding process if i do my magic correctly
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
Update 1.2.9:
|
|
103
|
+
I added a custom eslint rule to prevent overriding @final methods and classes, it seems to...not work very well..idk why,
|
|
104
|
+
If anyone knows how to write a better version of this rule, pls help
|
|
105
|
+
|
|
106
|
+
### Add more actions (if needed)
|
|
107
|
+
|
|
108
|
+
If you need more actions, please uhhh, notify me and skip that effect
|
|
109
|
+
|
|
110
|
+
Actions also have inputs with weird handling, I have made a template class for any effect that specifically wants the inputs for an a_pos_change but anything else is albeit possible, not short enough to be put on here so skip any effects that wants it
|
|
111
|
+
|
|
112
|
+
For me in the future, this requires updating actionConstructorRegistry and changing the handling logic over in queenSystem
|
|
113
|
+
|
|
114
|
+
### Update effect registry
|
|
115
|
+
|
|
116
|
+
```effectRegistry``` is a file located in ```/data```, housing a const for effect..well...data. This is technically initial data as cards can override this. Do include type, subtypes and any additional variables, these will be loaded into the attr map
|
|
117
|
+
|
|
118
|
+
check the ```effectData``` type for more info
|
|
119
|
+
|
|
120
|
+
### Update card registry
|
|
121
|
+
|
|
122
|
+
```cardRegistry``` is a file located in ```/data```, housing a const for cards, plus some extra enums and stuff. you can probably figure out what to entry based on the ```cardData``` type
|
|
123
|
+
|
|
124
|
+
include the ```upgrade_1``` variant if the card is upgradable
|
|
125
|
+
|
|
126
|
+
### Update defaultSetting
|
|
127
|
+
|
|
128
|
+
default setting is a class located in ```types/abstract/gameComponents/setting``` (may subject to change), include the file name of the new effect class in the ```effectFiles``` array
|
|
129
|
+
|
|
130
|
+
Oh one more note, that effectFile has to have a default export, either of a Record from effectName to the class or of the class itself
|
|
131
|
+
|
|
132
|
+
### Running tests
|
|
133
|
+
|
|
134
|
+
You can add tests if you want, there is a test suite file located in ```/_queenSystem/testSuite ```. Invoke the test back in main.
|
|
135
|
+
|
|
136
|
+
### Make renderers
|
|
137
|
+
|
|
138
|
+
The renderer interface can be found in ```./_queenSystem```, it goes like this:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
interface qpRenderer {
|
|
142
|
+
init(s : Localized_system, callback : () => any) : void;
|
|
143
|
+
startTurn(s : Localized_system, callback : (a? : Action) => any) : void;
|
|
144
|
+
update(phase : TurnPhase, s : Localized_system, a : Action, callback : () => any) : void;
|
|
145
|
+
requestInput<T extends inputType>(inputSet : validSetFormat<T> , phase : TurnPhase, s : Localized_system, a : Action, callback : (input : inputDataSpecific<T>) => any) : void;
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The renderer interface is built upon a pause-resume model. On each ```Action``` or each API calls to the main system. The system processes the data, pause, then call the renderer.
|
|
150
|
+
|
|
151
|
+
> The renderer ***HAVE TO*** call callback manually
|
|
152
|
+
> The callback is also bound to the system, so it cannot be rebind
|
|
153
|
+
|
|
154
|
+
This callback based approach was prefered to other approaches to a generic renderer interface due to promises. A renderer can take as much time as it wants, the system only continues after the callback function is called.
|
|
155
|
+
|
|
156
|
+
### Improving the text parser
|
|
157
|
+
|
|
158
|
+
The text parser for qpRemake is a modular XML-based text parser, specialized for effect text.
|
|
159
|
+
The parser can be found [****in this github repo.****](https://github.com/BlueG15/qpEffectTextParser)
|
|
160
|
+
|
|
161
|
+
There are only a handful of modules right now, allowing stuff like
|
|
162
|
+
```XML
|
|
163
|
+
<string> a + "_" + b </>
|
|
164
|
+
```
|
|
165
|
+
```XML
|
|
166
|
+
<if type = "number"><numeric> a + b > c </><string> A + B </><string> C + D </></>
|
|
167
|
+
```
|
|
168
|
+
Check the GitHub repo for the parser for more info.
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
//generic symbols
|
|
5
|
+
yes: "YES",
|
|
6
|
+
no: "NO",
|
|
7
|
+
true: "TRUE",
|
|
8
|
+
false: "FALSE",
|
|
9
|
+
//operator names
|
|
10
|
+
o_null: "No operator",
|
|
11
|
+
o_aurora: "Aurora",
|
|
12
|
+
o_esper: "Esper",
|
|
13
|
+
o_idol: "Idol",
|
|
14
|
+
o_leo: "Leo",
|
|
15
|
+
o_queen: "Queen",
|
|
16
|
+
o_omega: "Omega",
|
|
17
|
+
o_kaia: "Dragoon",
|
|
18
|
+
//operator real names
|
|
19
|
+
o_real_aurora: "Alyssa Neskara",
|
|
20
|
+
o_real_esper: "Irene",
|
|
21
|
+
o_real_idol: "Lisa",
|
|
22
|
+
o_real_leo: "Leo",
|
|
23
|
+
o_real_queen: "Elaine Myras",
|
|
24
|
+
o_real_omega: "Kyril",
|
|
25
|
+
o_real_kaia: "Kaia",
|
|
26
|
+
//operator description, not filled
|
|
27
|
+
o_desc_aurora: "",
|
|
28
|
+
o_desc_esper: "",
|
|
29
|
+
o_desc_idol: "",
|
|
30
|
+
o_desc_leo: "",
|
|
31
|
+
o_desc_queen: "",
|
|
32
|
+
o_desc_omega: "",
|
|
33
|
+
o_desc_kaia: "",
|
|
34
|
+
//rarities
|
|
35
|
+
r_white: "<white> white </>",
|
|
36
|
+
r_blue: "<blue> blue </>",
|
|
37
|
+
r_green: "<green> green </>",
|
|
38
|
+
r_red: "<red> red </>",
|
|
39
|
+
r_ability: "<yellow> ability </>",
|
|
40
|
+
r_algo: "<purple> algo </>",
|
|
41
|
+
//archtype full names
|
|
42
|
+
//TODO : insert all
|
|
43
|
+
a_fruit: "All Natural",
|
|
44
|
+
a_legion: "Legion's Commanđ",
|
|
45
|
+
a_nova: "Supernova's Wake",
|
|
46
|
+
a_generic: "Generic",
|
|
47
|
+
a_other: "No archtype",
|
|
48
|
+
a_enemy: "Enemy",
|
|
49
|
+
a_boss: "Boss",
|
|
50
|
+
//UI element names
|
|
51
|
+
ui_catalog: "catalog",
|
|
52
|
+
ui_gallery: "gallery",
|
|
53
|
+
ui_play: "play",
|
|
54
|
+
ui_setting: "setting",
|
|
55
|
+
ui_credit: "credit",
|
|
56
|
+
//setting options:
|
|
57
|
+
//TODO : finish this when Setting is done
|
|
58
|
+
ui_s_language: "language",
|
|
59
|
+
ui_s_mods: "mods",
|
|
60
|
+
//helps
|
|
61
|
+
h_activate: "<green>[Click to activate]</>",
|
|
62
|
+
//errors
|
|
63
|
+
err_noActivate: "<yellow>[ will not activate ]</>",
|
|
64
|
+
err_notActiveTurn: "<red>[ card not active ]</>",
|
|
65
|
+
err_usedOnce: "<red>[</> <icon id=\"once\"></> <red>used ]</>",
|
|
66
|
+
err_disabled: "<red>[ disabled ]</>",
|
|
67
|
+
err_conditionNotMet: "<red>[ condition not met ]</>",
|
|
68
|
+
err_noValidTargets: "<yellow>[ no targets ]</>",
|
|
69
|
+
err_notLocation: "<red>[ cannot activate from this location ]</>",
|
|
70
|
+
err_noCounters: "<red>[ not enough counters ]</>",
|
|
71
|
+
err_tooManyCounters: "<red>[ too many counters ]</>",
|
|
72
|
+
err_noAttackPower: "<red>[ no attack power ]</>",
|
|
73
|
+
err_noSlots: "<red>[ no available field slots ]</>",
|
|
74
|
+
err_maxReached: "<yellow>[ max reached ]</>",
|
|
75
|
+
err_editNoAllow: "Not enough health.",
|
|
76
|
+
//keyword desc
|
|
77
|
+
key_desc_void: "<void/> - Voided cards are removed from play until the deck is RELOADED.",
|
|
78
|
+
key_desc_suspend: "<suspend/> - Delay the target, but does not make the target immune to further delays.",
|
|
79
|
+
key_desc_decompile: "<decompile/> - Send the card to the trash without destroying it. Does not claim loot on the target.",
|
|
80
|
+
key_desc_exposed: "<exposed/> - Card has no other card in front of it.",
|
|
81
|
+
key_desc_covered: "<cover/> - Card has another card in front of it.",
|
|
82
|
+
key_desc_automate: "<automate/> - Card acts on its own.",
|
|
83
|
+
key_desc_decaybuff: "<specialbuff>DECAY BUFF</> - Buff is reduced at the end of each turn.",
|
|
84
|
+
key_desc_singlebuff: "<specialbuff>SINGLE ATTACK BUFF</> - Buff is removed after attacking.",
|
|
85
|
+
key_desc_aligned: "<aligned/> - In the same column as this card.",
|
|
86
|
+
key_desc_pathed: "<pathed/> - There exists a continuous line of cards between two of your cards (excluding diagonals).",
|
|
87
|
+
key_desc_exec: "<exec/> - Activates when the card is executed, after the attack and before being sent to the grave",
|
|
88
|
+
key_void: "vOID",
|
|
89
|
+
key_suspend: "SUSPEND",
|
|
90
|
+
key_decompile: "COMPILE",
|
|
91
|
+
key_exposed: "EXPOSED",
|
|
92
|
+
key_covered: "COVER",
|
|
93
|
+
key_automate: "AUTOMATE",
|
|
94
|
+
key_aligned: "ALIGNED",
|
|
95
|
+
key_pathed: "PATHED",
|
|
96
|
+
key_exec: "EXECUTE",
|
|
97
|
+
key_decaybuff: "DECAY BUFF",
|
|
98
|
+
key_singlebuff: "SINGLE ATTACK BUFF",
|
|
99
|
+
//effect type/subtype name
|
|
100
|
+
//TODO : add more later once coded
|
|
101
|
+
e_t_none: "NO TYPE",
|
|
102
|
+
e_t_none_desc: "",
|
|
103
|
+
e_t_lock: "LOCK",
|
|
104
|
+
e_t_lock_desc: "You must do something in order to play this card from your hand manually.",
|
|
105
|
+
e_t_counter: "COUNTER",
|
|
106
|
+
e_t_counter_desc: "Dont do much, just a resource for other effects",
|
|
107
|
+
e_t_manual: "MANUAL",
|
|
108
|
+
e_t_manual_desc: "Click to activate. this card cannot attack afterwards.",
|
|
109
|
+
e_t_trigger: "TRIGGER",
|
|
110
|
+
e_t_trigger_desc: "Activates automatically when something specific happens. Does not take a turn.",
|
|
111
|
+
e_t_passive: "PASSIVE",
|
|
112
|
+
e_t_passive_desc: "Happens automatically, does not activate.",
|
|
113
|
+
e_t_status: "STATUS EFFECT",
|
|
114
|
+
e_t_status_desc: "Status effects are temporary effects.",
|
|
115
|
+
e_t_init: "INITIALIZE",
|
|
116
|
+
e_t_init_desc: "Activates when this card is played to the field.",
|
|
117
|
+
// effectTypeExec,"EXECUTE"
|
|
118
|
+
// effectTypeExec_desc,"Activates when this card is EXECUTED."
|
|
119
|
+
// effectTypeDestruction,"DESTRUCTION"
|
|
120
|
+
// effectTypeDestruction_desc,"Activates when this card is destroyed (DECOMPILE and EXECUTE do not count as destruction)."
|
|
121
|
+
// effectTypeVolatile,"VOLATILE"
|
|
122
|
+
// effectTypeVolatile_desc,"VOID thsis card when it leaves the field."
|
|
123
|
+
// effectTypeDefense,"DEFENSE"
|
|
124
|
+
// effectTypeDefense_desc,"This card cannot take more than a certain amount of damage at once."
|
|
125
|
+
// effectTypeDragoon,"DRAGOON'S LINK"
|
|
126
|
+
// effectTypeDragoon_desc,"Programs created from the same Dragoon are linked."
|
|
127
|
+
// effectTypeSingle,"CONSUMABLE"
|
|
128
|
+
// effectTypeSingle_desc,"After this card uses its effect, remove it from the game and your decklist."
|
|
129
|
+
// effectTypeArtifact,"PRELOAD"
|
|
130
|
+
// effectTypeArtifact_desc,"This card starts in your hand."
|
|
131
|
+
// effectTypeStorage,"CACHED"
|
|
132
|
+
// effectTypeStorage_desc,"This effect applies while this card is in Storage."
|
|
133
|
+
// effectFlagBonded,"BONDED"
|
|
134
|
+
// effectFlagBonded_desc,"This effect cannot be removed."
|
|
135
|
+
e_st_chained: "CHAINED",
|
|
136
|
+
e_st_chained_desc: "This effect chains directly to the event that triggered it.",
|
|
137
|
+
e_st_delayed: "DELAYED",
|
|
138
|
+
e_st_delayed_desc: "This effects chains to the event that triggers it, but activates after that event resolves.",
|
|
139
|
+
e_st_unique: "UNIQUE",
|
|
140
|
+
e_st_unique_desc: "This effect can only activate once per copy of this card in a turn.",
|
|
141
|
+
e_st_hardUnique: "HARD_UNIQUE",
|
|
142
|
+
e_st_hardUnique_desc: "This effect can only activate once across all copies of this card in a turn.",
|
|
143
|
+
e_st_instant: "INSTANT",
|
|
144
|
+
e_st_instant_desc: "This effect does not take a turn to activate.",
|
|
145
|
+
e_st_once: "ONCE",
|
|
146
|
+
e_st_once_desc: "This effect can only be activated once.",
|
|
147
|
+
e_st_fieldLock: "FIELD_LOCK",
|
|
148
|
+
e_st_fieldLock_desc: "This card has to be on the field to activate this effect.",
|
|
149
|
+
e_st_handOrFieldLock: "FIELD_OR_HAND_LOCK",
|
|
150
|
+
e_st_handOrFieldLock_desc: "This card has to be on the field or in hand to activate this effect.",
|
|
151
|
+
e_st_graveLock: "GRAVE_LOCK",
|
|
152
|
+
e_st_graveLock_desc: "This card has to be on the grave to activate this effect.",
|
|
153
|
+
//card extension
|
|
154
|
+
//TODO : fill this in,
|
|
155
|
+
ex_fruit: "fruit",
|
|
156
|
+
ex_legion: "legion",
|
|
157
|
+
ex_nova: "nova",
|
|
158
|
+
ex_generic: "generic",
|
|
159
|
+
//cardID -> cardName, except the extension part
|
|
160
|
+
//TODO : fill this in, only simple fruits for now
|
|
161
|
+
c_blank: "Blank",
|
|
162
|
+
c_knife: "Knife",
|
|
163
|
+
c_quantum_sigil: "QuantumSigil",
|
|
164
|
+
c_sentry: "Sentry",
|
|
165
|
+
c_stagemarker: "StageMarker",
|
|
166
|
+
c_security: "Security",
|
|
167
|
+
c_objective_data: "Data",
|
|
168
|
+
c_active: "ACTIVE",
|
|
169
|
+
c_dummy: "Dummy",
|
|
170
|
+
c_loot_dummy: "Dummy",
|
|
171
|
+
c_lock_core: "Core",
|
|
172
|
+
c_machine_block: "MachineBlock",
|
|
173
|
+
c_machine_coin: "MachineCoin",
|
|
174
|
+
c_brain_queen: "Brain",
|
|
175
|
+
c_story_oxygen: "O",
|
|
176
|
+
c_story_hydrogen: "H",
|
|
177
|
+
c_story_backdoor: "Backdoor",
|
|
178
|
+
c_flower_hologram: "Hologram",
|
|
179
|
+
c_stagemark: "Stagemark",
|
|
180
|
+
c_firewall: "Firewall",
|
|
181
|
+
c_target: "Target",
|
|
182
|
+
c_curse: "Curse",
|
|
183
|
+
c_dark_power: "DarkPower",
|
|
184
|
+
c_zira_defeat: "Zira",
|
|
185
|
+
c_legion_token: "Clone",
|
|
186
|
+
c_bug_passive: "Bug",
|
|
187
|
+
c_strong_bug: "Bug",
|
|
188
|
+
c_nova_protean: "Protean",
|
|
189
|
+
c_test: "Debug",
|
|
190
|
+
c_after_burner: "Afterburner",
|
|
191
|
+
c_battery: "Battery",
|
|
192
|
+
c_flash_bang: "Flashbang",
|
|
193
|
+
c_cinder: "Cinder",
|
|
194
|
+
c_ember: "Ember",
|
|
195
|
+
c_capacitor: "DamageCapacitor",
|
|
196
|
+
c_apple: "Apple",
|
|
197
|
+
c_banana: "Banana",
|
|
198
|
+
c_cherry: "Cherry",
|
|
199
|
+
c_lemon: "Lemon",
|
|
200
|
+
c_pomegranate: "Pomegranate",
|
|
201
|
+
c_pumpkin: "Pumpkin",
|
|
202
|
+
c_pollinate: "Pollinate",
|
|
203
|
+
c_greenhouse: "Greenhouse",
|
|
204
|
+
c_growth: "Growth",
|
|
205
|
+
c_spring: "Spring",
|
|
206
|
+
c_summer: "Summer",
|
|
207
|
+
c_autumn: "Autumn",
|
|
208
|
+
c_winter: "Winter",
|
|
209
|
+
c_demeter: "Demeter",
|
|
210
|
+
c_persephone: "Persephone",
|
|
211
|
+
//effectID -> display XML
|
|
212
|
+
e_apple: `Add <uadd>up to</> =a <uadd>cards</><uminus>card</> with the same name as this card from your deck to your hand`,
|
|
213
|
+
e_lemon: "Attack with all cards on your field with the same name as this card.",
|
|
214
|
+
e_pomegranate: `If this card is sent to the trash, deal =a damage to all <exposed/> enemies and =b damage to all <cover/> enemies`,
|
|
215
|
+
e_banana: `Target 1 level 1 [.fruit] card in your trash (except cards whose name are the same as this card's). Play it to the field.`,
|
|
216
|
+
e_pumpkin: `Increase the health of all cards on your field with the same name as this card by =b.`,
|
|
217
|
+
e_quick: "This card does not take a turn to play to the field.",
|
|
218
|
+
e_draw: `Draw =a cards, this is =c == 0 ? "NOT" : ""; treated as a Turn draw.`,
|
|
219
|
+
e_attack: `Attack =a times.`,
|
|
220
|
+
e_fragile: `If this card attacks, destroy it afterwards.`,
|
|
221
|
+
//zone names
|
|
222
|
+
z_deck: "Deck",
|
|
223
|
+
z_field: "Field",
|
|
224
|
+
z_grave: "GY",
|
|
225
|
+
z_hand: "Hand",
|
|
226
|
+
z_void: "Void",
|
|
227
|
+
z_ability: "Ability card zone",
|
|
228
|
+
z_system: "System",
|
|
229
|
+
z_storage: "Storage",
|
|
230
|
+
z_drop: "Drop zone",
|
|
231
|
+
//Log command
|
|
232
|
+
//action names
|
|
233
|
+
l_turnStart: "turnStart",
|
|
234
|
+
l_turnReset: "turnReset",
|
|
235
|
+
l_turnEnd: "turnEnd",
|
|
236
|
+
l_posChange: "posChange",
|
|
237
|
+
l_drawAction: "drawAction",
|
|
238
|
+
l_activateEffect: "activateEffect",
|
|
239
|
+
l_shuffle: "shuffle",
|
|
240
|
+
l_addStatusEffect: "addStatusEffect",
|
|
241
|
+
l_removeStatusEffect: "removeStatusEffect",
|
|
242
|
+
l_activateEffectSubtypeSpecificFunc: "activateEffectSubtypeSpecificFunc",
|
|
243
|
+
l_modifyAnotherAction: "modifyAnotherAction",
|
|
244
|
+
l_increaseTurnCount: "increaseTurnCount",
|
|
245
|
+
l_setThreatLevel: "setThreatLevel",
|
|
246
|
+
l_doThreatLevelBurn: "doThreatLevelBurn",
|
|
247
|
+
l_forcefullyEndTheGame: "forcefullyEndTheGame",
|
|
248
|
+
l_nullAction: "nullAction",
|
|
249
|
+
l_internalActivateEffectSignal: "[internal action] activateEffectSignal",
|
|
250
|
+
l_freeUpStatusIDs: "[internal action] free up status ids",
|
|
251
|
+
//Preset-deck names ? Maybe no need
|
|
252
|
+
//maybe just rewrite this whole section
|
|
253
|
+
d_null_deck: "Not a deck",
|
|
254
|
+
d_all_lemons: "Oops, all lemon!",
|
|
255
|
+
d_all_apples: "Oops, all apples!",
|
|
256
|
+
d_natural: "All Natural",
|
|
257
|
+
d_queenIntro: "Queen's Kit 1",
|
|
258
|
+
d_esperIntro: "All Natural",
|
|
259
|
+
d_auroraIntro: "Sakura Bloom",
|
|
260
|
+
d_leoIntro: "Mech Mayhem",
|
|
261
|
+
d_idolIntro: "Performing Art",
|
|
262
|
+
d_esperPuzzle1: "Puzzle Kit",
|
|
263
|
+
d_auroraReprogram: "Puzzle Kit",
|
|
264
|
+
d_auroraStarter1: "Sakura MKI",
|
|
265
|
+
d_idolStarter1: "Performing Art",
|
|
266
|
+
d_esperStarter1: "All Natural",
|
|
267
|
+
d_queenChess: "Checkmate",
|
|
268
|
+
d_esperDungeon1: "All Natural",
|
|
269
|
+
d_esperDungeon2: "Year's End",
|
|
270
|
+
d_esperDungeon3: "Magna Magicae",
|
|
271
|
+
d_auroraDungeon1: "Sakura Bloom",
|
|
272
|
+
d_auroraDungeonSpirit: "Spirit Calling",
|
|
273
|
+
d_idolDungeon1: "Center Stage",
|
|
274
|
+
d_idolDungeonMahou: "Trial of Heart",
|
|
275
|
+
d_leoDungeon1: "Mech Mayhem",
|
|
276
|
+
d_dragoonDungeon1: "Old and New",
|
|
277
|
+
d_dragoonDungeon2: "Stronger Together",
|
|
278
|
+
d_dragoonDungeonInf: "Infinite Curiosity",
|
|
279
|
+
d_omegaDungeon1: "Legion's Command",
|
|
280
|
+
d_collabEden: "Eden's Edge",
|
|
281
|
+
d_collabCross: "World Seekers",
|
|
282
|
+
d_collabVault: "Void's Vault",
|
|
283
|
+
d_collabNova: "Supernova's Wake",
|
|
284
|
+
d_auroraSide1: "Sakura MKII",
|
|
285
|
+
d_queenSide1: "Queen's Royal",
|
|
286
|
+
d_queenOmegaDuel: "Queen's Royal",
|
|
287
|
+
d_idolSide1: "Live Performance",
|
|
288
|
+
d_idolSide2: "Live Performance",
|
|
289
|
+
d_dragoonStory1: "Myths and Legends",
|
|
290
|
+
d_dragoonStoryFlame: "The Flame",
|
|
291
|
+
d_esperSide1: "Presentation Kit",
|
|
292
|
+
d_esperSide2: "Presentation Kit?",
|
|
293
|
+
d_leoSide1: "Mech Kit",
|
|
294
|
+
d_leoSide2: "Fire Kit",
|
|
295
|
+
d_idolExPuzzle1: "Puzzle Kit",
|
|
296
|
+
d_leoExPuzzle1: "Puzzle Kit",
|
|
297
|
+
d_exPuzzleMage: "Puzzle Kit",
|
|
298
|
+
d_collabEdenDemo: "Eden's Edge",
|
|
299
|
+
d_collabCrossDemo: "World Seekers",
|
|
300
|
+
d_collabVaultDemo: "Void's Vault",
|
|
301
|
+
d_collabNovaDemo: "Supernova's Wake",
|
|
302
|
+
//TODO : fill this in once we do story or dialog or tutorials
|
|
303
|
+
//Story dialog
|
|
304
|
+
//Tutorial
|
|
305
|
+
//Ability unlocks
|
|
306
|
+
//Credits
|
|
307
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DisplayComponent, ParserModule, moduleInputObject, parseOptions } from '../../types/abstract/parser';
|
|
2
|
+
export default class addSymbolModule extends ParserModule {
|
|
3
|
+
cmdName: string[];
|
|
4
|
+
requiredAttr: string[][];
|
|
5
|
+
doCheckRequiredAttr: boolean;
|
|
6
|
+
evaluate(cmd: string, args: moduleInputObject, option: parseOptions, raw: string): DisplayComponent[];
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const parser_1 = require("../../types/abstract/parser");
|
|
4
|
+
class addSymbolModule extends parser_1.ParserModule {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.cmdName = ['symbol'];
|
|
8
|
+
this.requiredAttr = [["id"]];
|
|
9
|
+
this.doCheckRequiredAttr = true;
|
|
10
|
+
}
|
|
11
|
+
evaluate(cmd, args, option, raw) {
|
|
12
|
+
let x = args.getAttr("id");
|
|
13
|
+
if (!x)
|
|
14
|
+
return [];
|
|
15
|
+
return [new parser_1.SymbolComponent(x, undefined, "symbol", raw).addSectionID(x)];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = addSymbolModule;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ParserModule, moduleInputObject, parseOptions } from '../../types/abstract/parser';
|
|
2
|
+
export default class expressionModule extends ParserModule {
|
|
3
|
+
cmdName: string[];
|
|
4
|
+
requiredAttr: string[][];
|
|
5
|
+
doCheckRequiredAttr: boolean;
|
|
6
|
+
evaluate(cmd: string, args: moduleInputObject, option: parseOptions, raw: string): any;
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
const expression_parser_1 = __importDefault(require("./expression_parser"));
|
|
7
|
+
const parser_1 = require("../../types/abstract/parser");
|
|
8
|
+
const util_1 = __importDefault(require("util"));
|
|
9
|
+
class expressionModule extends parser_1.ParserModule {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.cmdName = ['expression', "expr", "ex"];
|
|
13
|
+
this.requiredAttr = [["expr"]];
|
|
14
|
+
this.doCheckRequiredAttr = false;
|
|
15
|
+
}
|
|
16
|
+
evaluate(cmd, args, option, raw) {
|
|
17
|
+
let expr = args.getAttr("expr");
|
|
18
|
+
if (!expr)
|
|
19
|
+
expr = this.try_collapse_child_to_text(args);
|
|
20
|
+
if (!expr)
|
|
21
|
+
return [new parser_1.TextComponent("", "No expr", cmd, raw)];
|
|
22
|
+
expression_parser_1.default.bindVariables(option.inputNumber, option.inputString);
|
|
23
|
+
try {
|
|
24
|
+
const parse_result = expression_parser_1.default.parse(expr);
|
|
25
|
+
// const debug = parse_result.flatMap(r =>
|
|
26
|
+
// r ? r.toString().split("\n").map(str => new textComponent(str, undefined, cmd, raw)) : []
|
|
27
|
+
// )
|
|
28
|
+
const eval_result = parse_result.map(expr => expr.evaluate(expression_parser_1.default)[0]);
|
|
29
|
+
const flattened_parse_result = expression_parser_1.default.flattenExpressions(eval_result);
|
|
30
|
+
const res = flattened_parse_result.map(e => {
|
|
31
|
+
if (typeof e === "string") {
|
|
32
|
+
return new parser_1.TextComponent(e, undefined, cmd, raw);
|
|
33
|
+
}
|
|
34
|
+
return e;
|
|
35
|
+
});
|
|
36
|
+
// res.unshift(...debug)
|
|
37
|
+
// res.unshift(new textComponent(`Parsed Len : ${res.length}`, undefined, cmd, raw))
|
|
38
|
+
return res;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
return util_1.default.format(e).split("\n").map(str => new parser_1.TextComponent("", str, cmd, raw));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = expressionModule;
|