From 52c8cf8fcb99c209b7bdf7eb76c534797cf3827f Mon Sep 17 00:00:00 2001 From: powershellwhizz <51530986+powershellwhizz@users.noreply.github.com> Date: Fri, 21 Jan 2022 16:18:04 +1100 Subject: [PATCH 1/6] Update Model.js --- bin/Model.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/Model.js b/bin/Model.js index af86409..0b5a99a 100644 --- a/bin/Model.js +++ b/bin/Model.js @@ -22,10 +22,10 @@ module.exports = class Model { this.rules.push(ruleName); } - addWeaponData (weaponData, selection) { + addWeaponData (weaponData, selection, unitnumber) { let newMatch = weaponData.$.name.match(weaponNameWithoutNumberRegex).groups, selectionNumber = selection.$.name.match(weaponNameWithoutNumberRegex).groups.number, - newNumber = newMatch.number ? parseInt(newMatch.number, 10) : selectionNumber ? parseInt(selectionNumber, 10) : 1; + newNumber = parseInt(selection.$.number, 10) / unitnumber; for (const weapon of this.weapons) { if (weapon.name === newMatch.weaponName) { @@ -37,7 +37,7 @@ module.exports = class Model { this.weapons.push({ name: newMatch.weaponName, number: newNumber }); } - handleSelectionDataRecursive (selectionData) { + handleSelectionDataRecursive (selectionData, number) { for (const selection of selectionData[0].selection) { if (selection.profiles && selection.profiles[0] !== "") for (const profile of selection.profiles[0].profile) @@ -55,7 +55,7 @@ module.exports = class Model { if (0 < ignore) continue; - this.addWeaponData(profile, selection); + this.addWeaponData(profile, selection, number); break; case "abilities": this.addAbilityData(profile); @@ -63,7 +63,7 @@ module.exports = class Model { } if (selection.selections && selection.selections[0] !== "") - this.handleSelectionDataRecursive(selection.selections); + this.handleSelectionDataRecursive(selection.selections, number); } } @@ -101,4 +101,4 @@ module.exports = class Model { return true; } -} \ No newline at end of file +} From 9ff95f25dfc46d2ae020c5f1366c320a181ab9a4 Mon Sep 17 00:00:00 2001 From: powershellwhizz <51530986+powershellwhizz@users.noreply.github.com> Date: Fri, 21 Jan 2022 16:18:24 +1100 Subject: [PATCH 2/6] Update ModelCollection.js --- bin/ModelCollection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ModelCollection.js b/bin/ModelCollection.js index 490f75e..9187493 100644 --- a/bin/ModelCollection.js +++ b/bin/ModelCollection.js @@ -50,7 +50,7 @@ module.exports = class ModelCollection { //console.log("selections: " + selectionData); if (selectionData && selectionData[0] !== "" && selectionData[0].selection) - newModel.handleSelectionDataRecursive(selectionData); + newModel.handleSelectionDataRecursive(selectionData, newModel.number); this.add(newModel); } @@ -137,4 +137,4 @@ module.exports = class ModelCollection { delete this.models[name]; } } -} \ No newline at end of file +} From b6842fdf20c5decc718f20083976c98cd872c5dd Mon Sep 17 00:00:00 2001 From: powershellwhizz <51530986+powershellwhizz@users.noreply.github.com> Date: Mon, 24 Jan 2022 20:15:06 +1100 Subject: [PATCH 3/6] Update .gitignore --- .gitignore/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore/.gitignore b/.gitignore/.gitignore index 8d1c8b6..de4e7b1 100644 --- a/.gitignore/.gitignore +++ b/.gitignore/.gitignore @@ -1 +1,2 @@ - + node_modules/ + files/ From 562e6b2e4ef704077ea455955f80d24f6f96582c Mon Sep 17 00:00:00 2001 From: Graham Allen Date: Mon, 24 Jan 2022 20:19:56 +1100 Subject: [PATCH 4/6] fixed lua bug script --- .gitignore/.gitignore | 1 + lua_modules/MatchedPlay.lua | 2 +- test.txt | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 test.txt diff --git a/.gitignore/.gitignore b/.gitignore/.gitignore index de4e7b1..b6d2f99 100644 --- a/.gitignore/.gitignore +++ b/.gitignore/.gitignore @@ -1,2 +1,3 @@ node_modules/ files/ + test.txt diff --git a/lua_modules/MatchedPlay.lua b/lua_modules/MatchedPlay.lua index 6c9b63f..4fbf26d 100644 --- a/lua_modules/MatchedPlay.lua +++ b/lua_modules/MatchedPlay.lua @@ -371,7 +371,7 @@ function hideCard(player, card) if element.attributes ~= nil and element.attributes.id ~= nil and (element.attributes.id:find("^ymc%-")) ~= nil and -- if we find a card - element.attributes.active = true then + element.attributes.active == true then return -- we found a card that is still visible, so we dont want to reset the UI end diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..4f84a22 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +sad \ No newline at end of file From 3672282a4c20b7b6822ea41ce5954aecb88df342 Mon Sep 17 00:00:00 2001 From: Graham Allen Date: Sat, 5 Feb 2022 15:46:05 +1100 Subject: [PATCH 5/6] cleanup local dir --- .gitignore | 3 +++ .gitignore/.gitignore | 3 --- test.txt | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 .gitignore delete mode 100644 .gitignore/.gitignore delete mode 100644 test.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..309f1b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.json +/node_modules +/files \ No newline at end of file diff --git a/.gitignore/.gitignore b/.gitignore/.gitignore deleted file mode 100644 index b6d2f99..0000000 --- a/.gitignore/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - node_modules/ - files/ - test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index 4f84a22..0000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -sad \ No newline at end of file From 41be47c25ca7035bee2ad31cc8bcd33479146ed3 Mon Sep 17 00:00:00 2001 From: Graham Allen Date: Sun, 6 Feb 2022 15:19:08 +1100 Subject: [PATCH 6/6] renamed some parameters to make it clearer what they do --- .gitignore | 1 - bin/Model.js | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 309f1b2..c545850 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -*.json /node_modules /files \ No newline at end of file diff --git a/bin/Model.js b/bin/Model.js index 0b5a99a..f26403e 100644 --- a/bin/Model.js +++ b/bin/Model.js @@ -22,10 +22,10 @@ module.exports = class Model { this.rules.push(ruleName); } - addWeaponData (weaponData, selection, unitnumber) { + addWeaponData (weaponData, selection, numberOfModelsInUnit) { let newMatch = weaponData.$.name.match(weaponNameWithoutNumberRegex).groups, selectionNumber = selection.$.name.match(weaponNameWithoutNumberRegex).groups.number, - newNumber = parseInt(selection.$.number, 10) / unitnumber; + newNumber = parseInt(selection.$.number, 10) / numberOfModelsInUnit; for (const weapon of this.weapons) { if (weapon.name === newMatch.weaponName) { @@ -37,7 +37,7 @@ module.exports = class Model { this.weapons.push({ name: newMatch.weaponName, number: newNumber }); } - handleSelectionDataRecursive (selectionData, number) { + handleSelectionDataRecursive (selectionData, numberOfModelsInUnit) { for (const selection of selectionData[0].selection) { if (selection.profiles && selection.profiles[0] !== "") for (const profile of selection.profiles[0].profile) @@ -55,7 +55,7 @@ module.exports = class Model { if (0 < ignore) continue; - this.addWeaponData(profile, selection, number); + this.addWeaponData(profile, selection, numberOfModelsInUnit); break; case "abilities": this.addAbilityData(profile); @@ -63,7 +63,7 @@ module.exports = class Model { } if (selection.selections && selection.selections[0] !== "") - this.handleSelectionDataRecursive(selection.selections, number); + this.handleSelectionDataRecursive(selection.selections, numberOfModelsInUnit); } }