We have food. And the food now makes sense. Thanks dudley

master
Joshua Sigona 3 years ago
parent cda7fb9b86
commit 1a9841d2b9
  1. 43
      src/TestPanel.js

@ -464,12 +464,35 @@ const [prevSkillPointData,setPrevSkillPointData] = useState([])
const [foodPointData,setFoodPointData] = useState({}) const [foodPointData,setFoodPointData] = useState({})
const [prevFoodPointData,setPrevFoodPointData] = useState({}) const [prevFoodPointData,setPrevFoodPointData] = useState({})
const [BUFFS,setBUFFS] = useState({})
function CalculateBuffs(foodPointData) { function CalculateBuffs(foodPointData) {
var boost_prefixes = {
pp_consumption:"Rich",
pp_recovery:"Light",
weak_point_dmg:"Crisp",
hp_recovery:"Robust",
}
var boost_suffixes = {
potency:"Meat",
pp:"Fruit",
dmg_res:"Vegetable",
hp:"Seafood",
}
var categories= {} var categories= {}
Object.keys(GetData("food_mult","0")).filter((key)=>key!=="id"&&key!=="amount").forEach((key)=>{categories[key]={from:"",count:0}}) Object.keys(GetData("food_mult","0")).filter((key)=>key!=="id"&&key!=="amount").forEach((key)=>{categories[key]={count:0}})
//Object.keys(foodPointData). Object.keys(foodPointData).map((key)=>{return {...GetData("food",key),amount:foodPointData[key]}}).forEach((item)=>{
console.log(foodPointData) for (var key of Object.keys(item)) {
return categories if (key in categories && item[key]) {
categories[key].count+=item.amount
}
}
})
var finalObj = {}
Object.keys(categories).filter((key)=>categories[key].count>0).forEach((key)=>finalObj[key]={...categories[key],from:boost_prefixes[key]??boost_suffixes[key]})
return finalObj
} }
function SaveData() { function SaveData() {
@ -577,6 +600,14 @@ useEffect(()=>{
} }
},[BUILDID,GetData,BACKENDURL,p]) },[BUILDID,GetData,BACKENDURL,p])
useEffect(()=>{
setBUFFS(CalculateBuffs(foodPointData)??[])
},[foodPointData])
useEffect(()=>{
console.log(BUFFS)
},[BUFFS])
//console.log(p.GetData("class",p.className,"icon")) //console.log(p.GetData("class",p.className,"icon"))
return (<> return (<>
@ -788,8 +819,8 @@ useEffect(()=>{
<PageControl pages={2} currentPage={effectPage} setCurrentPage={setEffectPage}/> <PageControl pages={2} currentPage={effectPage} setCurrentPage={setEffectPage}/>
{effectPage===1?<><h3>Effect Name</h3><ul className="infoBuffs"><li onClick={()=>{setFoodMenuWindowOpen(true)}}>Food Boost Effect {effectPage===1?<><h3>Effect Name</h3><ul className="infoBuffs"><li onClick={()=>{setFoodMenuWindowOpen(true)}}>Food Boost Effect
<ul> <ul>
{Object.keys(CalculateBuffs(foodPointData)??[]).map((key)=><li><img alt="" src="https://i.imgur.com/TQ8EBW2.png" />&ensp;[Meat] {key} +10.0%</li>)} {Object.keys(BUFFS).length==0&&<li>Add Quick Food</li>}
<li><img alt="" src="https://i.imgur.com/TQ8EBW2.png" />&ensp;[Crisp] Potency to Weak Point +5.0%</li> {Object.keys(BUFFS).map((key)=><li><img alt="" src="https://i.imgur.com/TQ8EBW2.png" />&ensp;[{BUFFS[key].from}] {key} +{BUFFS[key].count}</li>)}
</ul> </ul>
</li> </li>
<li>Shifta / Deband <li>Shifta / Deband

Loading…
Cancel
Save