diff --git a/package-lock.json b/package-lock.json index d4538a2..34fe0fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "^12.1.3", "@testing-library/user-event": "^13.5.0", + "express": "^4.17.3", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "5.0.0", diff --git a/package.json b/package.json index 81e6a53..24162fd 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "^12.1.3", "@testing-library/user-event": "^13.5.0", + "express": "^4.17.3", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "5.0.0", diff --git a/src/App.js b/src/App.js index ad122fc..ba4a763 100644 --- a/src/App.js +++ b/src/App.js @@ -51,7 +51,9 @@ function App() { (key==="intuition"&&i===13)|| (key==="raising"&&i===14)|| (key==="resolution"&&i===15)) { - return true + if (data.floor_storage[key]>0) { + return true + } } } return false diff --git a/src/App.js.bak b/src/App.js.bak index 6dd27b4..a81e023 100644 --- a/src/App.js.bak +++ b/src/App.js.bak @@ -35,23 +35,25 @@ function App() { function NameMatches(i) { for (var key of Object.keys(data.floor_storage)) { - if (key==="safety"&&i===0|| - key==="sight"&&i===1|| - key==="strength"&&i===2|| - key==="steel"&&i===3|| - key==="affluence"&&i===4|| - key==="flight"&&i===5|| - key==="alteration"&&i===6|| - key==="purity"&&i===7|| - key==="fortune"&&i===8|| - key==="witching"&&i===9|| - key==="serenity"&&i===10|| - key==="rage"&&i===11|| - key==="lust"&&i===12|| - key==="intuition"&&i===13|| - key==="raising"&&i===14|| - key==="resolution"&&i===15) { - return true + if ((key==="safety"&&i===0)|| + (key==="sight"&&i===1)|| + (key==="strength"&&i===2)|| + (key==="steel"&&i===3)|| + (key==="affluence"&&i===4)|| + (key==="flight"&&i===5)|| + (key==="alteration"&&i===6)|| + (key==="purity"&&i===7)|| + (key==="fortune"&&i===8)|| + (key==="witching"&&i===9)|| + (key==="serenity"&&i===10)|| + (key==="rage"&&i===11)|| + (key==="lust"&&i===12)|| + (key==="intuition"&&i===13)|| + (key==="raising"&&i===14)|| + (key==="resolution"&&i===15)) { + if (data.floor_storage[key]>0) { + return true + } } } return false @@ -115,6 +117,7 @@ function App() { {data.death_count[0]} { data.floor_effects.map((eff,i)=>{ + console.log(data.floor_buff_storage) return <> {i in data.floor_buff_storage&&
}
diff --git a/src/backend/data.json b/src/backend/data.json index bad33a9..b088bea 100644 --- a/src/backend/data.json +++ b/src/backend/data.json @@ -1,90 +1,90 @@ { "pomander": [ [ - 0, - 0, - 0 + 3, + 1, + 6 ], [ - 0, - 0, - 0 + 3, + 3, + 12 ], [ - 0, - 0, - 0 + 3, + 1, + 24 ], [ - 0, - 0, - 0 + 3, + 1, + 17 ], [ + 3, 0, - 0, - 0 + 7 ], [ - 0, - 0, - 0 + 3, + 1, + 5 ], [ + 3, 0, - 0, - 0 + 14 ], [ + 3, 0, - 0, - 0 + 8 ], [ - 0, - 0, - 0 + 3, + 3, + 14 ], [ - 0, - 4, - 4 + 3, + 1, + 20 ], [ + 3, 0, - 0, - 0 + 13 ], [ - 0, - 0, - 0 + 3, + 1, + 13 ], [ - 9, - 19, - 19 + 2, + 0, + 8 ], [ - 0, - 0, - 0 + 3, + 1, + 13 ], [ + 3, 0, - 4, 4 ], [ - 0, - 0, - 0 + 1, + 1, + 8 ] ], "accursed_hoard": [ [ - 2, - 3 + 0, + 0 ], [ 0, @@ -92,37 +92,37 @@ ], [ 0, - 0 + 3 ], [ 0, - 0 + 8 ] ], "mimics": [ - 20, - 3 + 14, + 0 ], "traps": [ [ - 0, - 0 + 1, + 2 ], [ 0, - 0 + 2 ], [ - 3, - 4 + 1, + 2 ], [ 0, - 0 + 4 ], [ - 3, - 4 + 0, + 1 ] ], "floor_effects": [ @@ -132,56 +132,56 @@ ], [ 0, - 0 + 2 ], [ 0, - 0 + 4 ], [ - 0, - 0 + 1, + 5 ], [ - 0, - 0 + 1, + 2 ], [ 0, 0 ], [ - 0, - 0 + 1, + 2 ], [ 0, - 0 + 1 ], [ 0, - 0 + 1 ], [ - 2, - 3 + 0, + 0 ], [ 0, - 0 + 3 ] ], "death_count": [ - 4, - 6 + 0, + 3 ], - "floor": 13, + "floor": 64, "accursed_hoard_detected": false, - "previous_pomander": "lust", + "previous_pomander": "fortune", "floor_storage": { - "lust": 1 + "fortune": 1 }, "floor_buff_storage": { - "9": true + "4": true } } \ No newline at end of file diff --git a/src/backend/data.json.bak b/src/backend/data.json.bak new file mode 100644 index 0000000..bcef02c --- /dev/null +++ b/src/backend/data.json.bak @@ -0,0 +1,186 @@ +{ + "pomander": [ + [ + 3, + 1, + 6 + ], + [ + 3, + 0, + 9 + ], + [ + 3, + 0, + 23 + ], + [ + 3, + 0, + 16 + ], + [ + 3, + 0, + 7 + ], + [ + 3, + 0, + 4 + ], + [ + 3, + 0, + 14 + ], + [ + 3, + 0, + 8 + ], + [ + 3, + 0, + 11 + ], + [ + 3, + 1, + 20 + ], + [ + 3, + 0, + 13 + ], + [ + 2, + 0, + 12 + ], + [ + 3, + 0, + 8 + ], + [ + 3, + 0, + 12 + ], + [ + 0, + 0, + 4 + ], + [ + 0, + 0, + 7 + ] + ], + "accursed_hoard": [ + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 3 + ], + [ + 0, + 8 + ] + ], + "mimics": [ + 2, + 0 + ], + "traps": [ + [ + 0, + 1 + ], + [ + 0, + 2 + ], + [ + 0, + 1 + ], + [ + 0, + 4 + ], + [ + 0, + 1 + ] + ], + "floor_effects": [ + [ + 0, + 0 + ], + [ + 0, + 2 + ], + [ + 0, + 4 + ], + [ + 0, + 4 + ], + [ + 0, + 1 + ], + [ + 0, + 0 + ], + [ + 0, + 1 + ], + [ + 0, + 1 + ], + [ + 0, + 1 + ], + [ + 0, + 0 + ], + [ + 0, + 3 + ] + ], + "death_count": [ + 0, + 3 + ], + "floor": 0, + "accursed_hoard_detected": false, + "previous_pomander": "safety", + "floor_storage": { + "witching": 1, + "safety": 0 + }, + "floor_buff_storage": {} +} \ No newline at end of file diff --git a/src/backend/logreader.js b/src/backend/logreader.js index 667a768..a873213 100644 --- a/src/backend/logreader.js +++ b/src/backend/logreader.js @@ -160,6 +160,13 @@ function ParseString(str) { pomander[pomander_slot][0]-=1 update_file=true } else + if (split[4].includes("uses a pomander of ")) { + var pomander_name=split[4].substring(split[4].indexOf("uses a pomander of ")+"uses a pomander of ".length) + pomander_name=pomander_name.substring(0,pomander_name.length-1) + var pomander_slot = GetPomanderSlot(pomander_name) + pomander[pomander_slot][0]-=1 + update_file=true + } else if (split[4].includes("You cannot carry any more of that item.")) { var pomander_name=split[4].substring("You return the pomander of ".length) pomander_name=pomander_name.replace(" to the coffer. You cannot carry any more of that item.","") @@ -206,6 +213,7 @@ function ParseString(str) { accursed_hoard_detected=false for (var i=0;i0) { + if (pomander_name in floor_storage&&floor_storage[pomander_name]>0) { floor_storage[pomander_name]-- + previous_pomander="" } else { pomander[pomander_slot][1]++ pomander[pomander_slot][2]++ @@ -292,67 +301,67 @@ function ParseString(str) { if (split[4].includes("An ancient enchantment stimulates your humours, increasing the speed with which you act.")) { floor_effects[0][0]++ floor_effects[0][1]++ - floor_buff_storage={0:true} + floor_buff_storage={...floor_buff_storage,0:true} update_file=true } else if (split[4].includes("An ancient enchantment revitalizes your body and mind.")) { floor_effects[1][0]++ floor_effects[1][1]++ - floor_buff_storage={1:true} + floor_buff_storage={...floor_buff_storage,1:true} update_file=true } else if (split[4].includes("The gathering gloom appears to invigorate the floor's denizens.")) { floor_effects[2][0]++ floor_effects[2][1]++ - floor_buff_storage={2:true} + floor_buff_storage={...floor_buff_storage,2:true} update_file=true } else if (split[4].includes("An ancient enchantment clouds your eyes, making it difficult to discern your quarry.")) { floor_effects[3][0]++ floor_effects[3][1]++ - floor_buff_storage={3:true} + floor_buff_storage={...floor_buff_storage,3:true} update_file=true } else if (split[4].includes("The items in your bag have temporarily transformed into worthless stone.")) { floor_effects[4][0]++ floor_effects[4][1]++ - floor_buff_storage={4:true} + floor_buff_storage={...floor_buff_storage,4:true} update_file=true } else if (split[4].includes("An ancient enchantment clouds your mind, making it impossible to remember previously learned abilities.")) { floor_effects[5][0]++ floor_effects[5][1]++ - floor_buff_storage={5:true} + floor_buff_storage={...floor_buff_storage,5:true} update_file=true } else if (split[4].includes("An ancient enchantment saps your health.")) { floor_effects[6][0]++ floor_effects[6][1]++ - floor_buff_storage={6:true} + floor_buff_storage={...floor_buff_storage,6:true} update_file=true } else if (split[4].includes("An ancient enchantment saps your very strength, weakening your blows.")) { floor_effects[7][0]++ floor_effects[7][1]++ - floor_buff_storage={7:true} + floor_buff_storage={...floor_buff_storage,7:true} update_file=true } else if (split[4].includes("Your body is fatigued and wounds refuse to heal on their own.")) { floor_effects[8][0]++ floor_effects[8][1]++ - floor_buff_storage={8:true} + floor_buff_storage={...floor_buff_storage,8:true} update_file=true } else if (split[4].includes("Your entire body feels heavy.")) { floor_effects[9][0]++ floor_effects[9][1]++ - floor_buff_storage={9:true} + floor_buff_storage={...floor_buff_storage,9:true} update_file=true } else if (split[4].includes("You find yourself short of breath, unable to sprint.")) { floor_effects[10][0]++ floor_effects[10][1]++ - floor_buff_storage={10:true} + floor_buff_storage={...floor_buff_storage,10:true} update_file=true } diff --git a/src/backend/logreader.js.bak b/src/backend/logreader.js.bak index ac72da7..a7e299c 100644 --- a/src/backend/logreader.js.bak +++ b/src/backend/logreader.js.bak @@ -96,6 +96,7 @@ var options = { var previous_pomander="" var floor_storage={} +var floor_buff_storage={} var update_file=false; tail = new Tail(process.argv[2], options); @@ -114,6 +115,7 @@ if (fs.existsSync('./data.json')) { accursed_hoard_detected=master_obj.accursed_hoard_detected previous_pomander=master_obj.previous_pomander floor_storage=master_obj.floor_storage + floor_buff_storage=master_obj.floor_buff_storage } @@ -139,6 +141,7 @@ function CreateMasterObj() { accursed_hoard_detected:accursed_hoard_detected, previous_pomander:previous_pomander, floor_storage:floor_storage, + floor_buff_storage:floor_buff_storage, } } @@ -157,6 +160,13 @@ function ParseString(str) { pomander[pomander_slot][0]-=1 update_file=true } else + if (split[4].includes("uses a pomander of ")) { + var pomander_name=split[4].substring(split[4].indexOf("uses a pomander of ")+"uses a pomander of ".length) + pomander_name=pomander_name.substring(0,pomander_name.length-1) + var pomander_slot = GetPomanderSlot(pomander_name) + pomander[pomander_slot][0]-=1 + update_file=true + } else if (split[4].includes("You cannot carry any more of that item.")) { var pomander_name=split[4].substring("You return the pomander of ".length) pomander_name=pomander_name.replace(" to the coffer. You cannot carry any more of that item.","") @@ -179,6 +189,7 @@ function ParseString(str) { floor=Number(fl) previous_pomander="" floor_storage={} + floor_buff_storage={} accursed_hoard_detected=false update_file=true } else @@ -188,6 +199,7 @@ function ParseString(str) { floor=Number(fl) previous_pomander="" floor_storage={} + floor_buff_storage={} accursed_hoard_detected=false update_file=true } else @@ -197,9 +209,11 @@ function ParseString(str) { floor=0 previous_pomander="" floor_storage={} + floor_buff_storage={} accursed_hoard_detected=false for (var i=0;i0) { + if (pomander_name in floor_storage&&floor_storage[pomander_name]>0) { floor_storage[pomander_name]-- + previous_pomander="" } else { pomander[pomander_slot][1]++ pomander[pomander_slot][2]++ @@ -286,56 +301,67 @@ function ParseString(str) { if (split[4].includes("An ancient enchantment stimulates your humours, increasing the speed with which you act.")) { floor_effects[0][0]++ floor_effects[0][1]++ + floor_buff_storage={0:true} update_file=true } else if (split[4].includes("An ancient enchantment revitalizes your body and mind.")) { floor_effects[1][0]++ floor_effects[1][1]++ + floor_buff_storage={1:true} update_file=true } else if (split[4].includes("The gathering gloom appears to invigorate the floor's denizens.")) { floor_effects[2][0]++ floor_effects[2][1]++ + floor_buff_storage={2:true} update_file=true } else if (split[4].includes("An ancient enchantment clouds your eyes, making it difficult to discern your quarry.")) { floor_effects[3][0]++ floor_effects[3][1]++ + floor_buff_storage={3:true} update_file=true } else if (split[4].includes("The items in your bag have temporarily transformed into worthless stone.")) { floor_effects[4][0]++ floor_effects[4][1]++ + floor_buff_storage={4:true} update_file=true } else if (split[4].includes("An ancient enchantment clouds your mind, making it impossible to remember previously learned abilities.")) { floor_effects[5][0]++ floor_effects[5][1]++ + floor_buff_storage={5:true} update_file=true } else if (split[4].includes("An ancient enchantment saps your health.")) { floor_effects[6][0]++ floor_effects[6][1]++ + floor_buff_storage={6:true} update_file=true } else if (split[4].includes("An ancient enchantment saps your very strength, weakening your blows.")) { floor_effects[7][0]++ floor_effects[7][1]++ + floor_buff_storage={7:true} update_file=true } else if (split[4].includes("Your body is fatigued and wounds refuse to heal on their own.")) { floor_effects[8][0]++ floor_effects[8][1]++ + floor_buff_storage={8:true} update_file=true } else if (split[4].includes("Your entire body feels heavy.")) { floor_effects[9][0]++ floor_effects[9][1]++ + floor_buff_storage={9:true} update_file=true } else if (split[4].includes("You find yourself short of breath, unable to sprint.")) { floor_effects[10][0]++ floor_effects[10][1]++ + floor_buff_storage={10:true} update_file=true }