Skip to content

Commit

Permalink
support unequip
Browse files Browse the repository at this point in the history
  • Loading branch information
SiriusAshling committed Oct 22, 2021
1 parent 4f91fb2 commit dafc8f1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "header-language",
"displayName": "Ori WotW Header Language",
"description": "Support for the .wotwrh language",
"version": "0.2.4",
"version": "0.2.5",
"publisher": "orirando",
"license": "MIT",
"repository": {
Expand Down
10 changes: 10 additions & 0 deletions src/parsePickup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const ifBoundsRegex = /^24\|(-?\d+(?:[,.]\d+)?)\|(-?\d+(?:[,.]\d+)?)\|(-?\d+(?:[
const ifSelfEqualRegex = /^25\|(-?\d+(?:[,.]\d+)?)\|/;
const ifSelfGreaterRegex = /^26\|(-?\d+(?:[,.]\d+)?)\|/;
const ifSelfLessRegex = /^27\|(-?\d+(?:[,.]\d+)?)\|/;
const unequipRegex = /^28\|(\d+)$/;

const integerValueRegex = /^(\d+)(?:\|(?:skip=)?(\d+))?$/;
const integerBoundaryValueRegex = /^(\d+)$/;
Expand Down Expand Up @@ -252,6 +253,14 @@ function parseIfSelfGreater(string: string): Pickup | undefined {
function parseIfSelfLess(string: string): Pickup | undefined {
return parseIfSelf(string, ifSelfLessRegex, "less than");
}
function parseUnequip(string: string): Pickup | undefined {
const match = string.match(unequipRegex);
if (match === null) { return undefined; }

const equpimentString = match[1];
const equipment = equipVariants[equpimentString] ?? equpimentString;
return { name: `Unequip ${equipment}`, next: null };
}
const sysCommandParsers = [
parseAutoSave,
parseSetResource,
Expand All @@ -275,6 +284,7 @@ const sysCommandParsers = [
parseIfSelfEqual,
parseIfSelfGreater,
parseIfSelfLess,
parseUnequip,
];
function parseSysCommand(string: string): Pickup | undefined {
const match = string.match(sysCommandRegex);
Expand Down
7 changes: 6 additions & 1 deletion syntaxes/ori-wotw-header.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
{ "include": "#createWarp" },
{ "include": "#destroyWarp" },
{ "include": "#ifbounds" },
{ "include": "#ifself" }
{ "include": "#ifself" },
{ "include": "#unequip" }
]
},
"autosave": {
Expand Down Expand Up @@ -213,6 +214,10 @@
{ "include": "#pickup" }
]
},
"unequip": {
"match": "\\G4\\|28\\|(?:100[0-5]|20[01]\\d|300[0-5]|400\\d)\\b",
"name": "variable.other.enummember"
},
"teleporter": {
"match": "\\G5\\|-?(?:\\d|1[0-7])\\b",
"name": "variable.other.enummember"
Expand Down

0 comments on commit dafc8f1

Please sign in to comment.