From a193cbd6f02ab5c72849b6c208398e8947a14eea Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Sat, 11 Sep 2021 16:07:55 +0900 Subject: [PATCH] Food panel has more functionality --- src/TestPanel.js | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/TestPanel.js b/src/TestPanel.js index 7168b2b..5e8fa32 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -389,8 +389,28 @@ function FoodPopupWindow(p) { } } - return
Foods in Recipe
{FOODCOUNT}
Confirm
Cancel
}> - {FOODLIST.map((key)=>)} + return
Foods in Recipe
{FOODCOUNT}
Confirm
Cancel
} + sortItems={["Standard Sort","Alphabetical","Food Name","Food Type","Popularity"]} + filter={true} + dataFunction={()=>{ + return Object.keys(GetData("food")).map((key)=>GetData("food")[key]) + }} + filterFunction={(page,item)=>item} + searchFieldFunction={(searchText,item)=>searchText.length>0?item.name.trim().toLowerCase().includes(searchText.toLowerCase()):true} + sortOrderFunction={(sort,itemA,itemB)=>{ + switch (sort) { + case "Standard Sort":return itemB.id-itemA.id + case "Alphabetical":return itemA.name.localeCompare(itemB.name) + case "Food Name":return itemA.name.substr(itemA.name.lastIndexOf(" ")).localeCompare(itemB.name.substr(itemB.name.lastIndexOf(" "))) + case "Food Type":return itemA.food_type.localeCompare(itemB.food_type)!==0?itemA.food_type.localeCompare(itemB.food_type):itemA.name.substr(itemA.name.lastIndexOf(" ")).localeCompare(itemB.name.substr(itemB.name.lastIndexOf(" "))) + case "Popularity":return itemB.popularity-itemA.popularity + default:return 0 + } + }} + displayFunction={(item)=>{ + return + }} + >
} @@ -442,6 +462,14 @@ const [prevSkillPointData,setPrevSkillPointData] = useState([]) const [foodPointData,setFoodPointData] = useState({}) const [prevFoodPointData,setPrevFoodPointData] = useState({}) +function CalculateBuffs(foodPointData) { + var categories= {} + Object.keys(GetData("food_mult","0")).filter((key)=>key!=="id"&&key!=="amount").forEach((key)=>{categories[key]={from:"",count:0}}) + //Object.keys(foodPointData). + console.log(foodPointData) + return categories +} + function SaveData() { var saveObj = { level:level, @@ -757,11 +785,8 @@ useEffect(()=>{

Current Effects

{effectPage===1?<>

Effect Name

  • {setFoodMenuWindowOpen(true)}}>Food Boost Effect - - -
      -
    •  [Meat] Potency +10.0%
    • + {Object.keys(CalculateBuffs(foodPointData)??[]).map((key)=>
    •  [Meat] {key} +10.0%
    • )}
    •  [Crisp] Potency to Weak Point +5.0%
  • @@ -880,7 +905,7 @@ useEffect(()=>{ default:return true } }} - searchFieldFunction={(searchText,item)=>searchText.length>0?(item[WEAPON_WEAPON].name.toLowerCase()+" "+item[WEAPON_WEAPONTYPE].name.toLowerCase()).includes(searchText.toLowerCase()):true} + searchFieldFunction={(searchText,item)=>searchText.length>0?(item[WEAPON_WEAPON].name.toLowerCase()+" "+item[WEAPON_WEAPONTYPE].name.toLowerCase()).includes(searchText.trim().toLowerCase()):true} sortOrderFunction={(sort,itemA,itemB)=>{ switch (sort) { case "Rarity":return itemB[1].rarity-itemA[1].rarity @@ -908,7 +933,7 @@ useEffect(()=>{ }):[] }} filterFunction={(page,item)=>item.slot===armorSlotSelection} - searchFieldFunction={(searchText,item)=>searchText.length>0?item.name.toLowerCase().includes(searchText.toLowerCase()):true} + searchFieldFunction={(searchText,item)=>searchText.length>0?item.name.trim().toLowerCase().includes(searchText.toLowerCase()):true} sortOrderFunction={(sort,itemA,itemB)=>{ switch (sort) { case "Rarity":return itemB.rarity-itemA.rarity