Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: custom game settings parsing and missing Roadhog setting #372

Merged
merged 5 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/behavior_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 22
node-version: 22.4
cache: npm
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
key: ${{ github.run_id }}-node-modules
path: |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "npm run compile-standalone",
"check-types": "tsc --noEmit",
"lint": "eslint src --ext ts",
"lint": "npx eslint src --ext ts",
"test": "node runTests.mjs",
"prepare": "husky"
},
Expand Down
1 change: 1 addition & 0 deletions src/data/customGameSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4304,6 +4304,7 @@ export const customGameSettingsSchema: CustomGameSettingSchema =
"orisa",
"pharah",
"reinhardt",
"roadhog",
"sigma",
"soldier",
"sombra",
Expand Down
6 changes: 6 additions & 0 deletions src/tests/decompiler/customGameSettings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ settings
{
Hover Jets Maximum Time: 300%
}

Roadhog
{
Take a Breather Cooldown Time: 0%
Whole Hog Knockback Scalar: 200%
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/tests/decompiler/results/customGameSettings.opy
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ settings {
"pharah": {
"passiveMaxTime%": 300
},
"roadhog": {
"secondaryFireCooldown%": 0,
"ultKb%": 200
},
"general": {
"abilityCooldown%": 137
}
Expand Down
19 changes: 6 additions & 13 deletions src/utils/decompilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,18 @@ export function decompileCustomGameSettingsDict(
for (var key of objKeys) {
if (currentLanguage in kwObj[key]) {
if (
elem
.toLowerCase()
.startsWith(kwObj[key][currentLanguage].toLowerCase())
potentialKey.toLowerCase() ===
kwObj[key][currentLanguage].toLowerCase()
) {
keyName = key;
value = elem.substring(kwObj[key][currentLanguage].length);
value = potentialValue;
break;
}
} else if (
elem.toLowerCase().startsWith(kwObj[key]["en-US"].toLowerCase())
potentialKey.toLowerCase() === kwObj[key]["en-US"].toLowerCase()
) {
keyName = key;
value = elem.substring(kwObj[key]["en-US"].length);
value = potentialValue;
break;
}
}
Expand Down Expand Up @@ -159,14 +158,8 @@ export function decompileCustomGameSettingsDict(
}

if (keyName === null || value === null) {
error("No translation found for key of element '" + elem + "'");
}

if (!value.startsWith(":")) {
console.log(value);
error("Expected ':' after key in element '" + elem + "'");
error("No translation found for key of element '" + potentialKey + "'");
}
value = value.substring(1).trim();

if (isInvalidButAcceptedProperty) {
continue;
Expand Down