From 367b5649614a8904035887dee61ab29bcc333a96 Mon Sep 17 00:00:00 2001 From: bartvdbraak Date: Wed, 5 Feb 2020 20:38:44 +0100 Subject: [PATCH] Slayer point unlocks, removal list filter --- src/components/TableSection.vue | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/components/TableSection.vue b/src/components/TableSection.vue index 034f94a..9a1e308 100644 --- a/src/components/TableSection.vue +++ b/src/components/TableSection.vue @@ -96,18 +96,35 @@ export default { this.currentMaster = this.mastersData[this.$route.params.id]; this.monstersData = this.currentMaster.assignments; - //filter the list of Monsters + //filter the list of Monsters and calculate task chances this.filterData(); - this.generateTaskWeights(); + this.generateTaskWeights(); }, filterData() { this.filtered_items = this.monstersData; - //filter based on Account Stats + let removeIds = []; + //filter based on Stats this.configData.statUnlocks.forEach(stat=>{ - // For each stat requirement, remove those from list where the current stat value is greater or equal to the monsters requirement value. - this.filtered_items = _.filter(this.filtered_items, function(o){ return parseInt(stat.value.current) >= parseInt(o[stat.filter]) } ); + //for each stat requirement, remove those from list where the current stat value is greater or equal to the monsters requirement value. + this.filtered_items = _.filter(this.filtered_items, function(monster){ return parseInt(stat.value.current) >= parseInt(monster[stat.filter]) } ); }); + + //filter based on Point Unlocks + this.configData.pointUnlocks.forEach(reward=>{ + if ((reward.unlock === 'true' && reward.block) || reward.unlock === 'false') { + //if reward unlocked but blocks monsters OR reward not unlocked and doesnt block + //then, add to removal + removeIds = removeIds.concat(reward.monster_ids) + } + }); + + //filter based on Block List + + //filter based on Quest unlocks + + //handle removal list + this.filtered_items = _.filter(this.filtered_items, function(monster){ return !removeIds.includes(parseInt(monster.id)) } ); }, generateTaskWeights() { //calculate total weight