diff --git a/src/TestPanel.js b/src/TestPanel.js index 9cf2e1b..65a96f7 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -389,8 +389,39 @@ function FoodPopupWindow(p) { } } - return
Foods in Recipe
{FOODCOUNT}
Confirm
Cancel
}> - {FOODLIST.map((key)=>)} + return +
+
Foods in Recipe
+
{FOODCOUNT}
+
+
+
{p.setFoodMenuWindowOpen(false)}}>Confirm
+
{p.setFoodMenuWindowOpen(false);p.setFoodPointData(p.prevFoodPointData)}}>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 + }} + >
} @@ -440,10 +471,42 @@ const [classNameSetter,setClassNameSetter] = useState(0) const [points,setPoints] = useState([]) const [skillPointData,setSkillPointData] = useState([]) const [prevSkillPointData,setPrevSkillPointData] = useState([]) +const [prevPoints,setPrevPoints] = useState([]) const [foodPointData,setFoodPointData] = useState({}) const [prevFoodPointData,setPrevFoodPointData] = useState({}) +const [BUFFS,setBUFFS] = useState({}) + +function CalculateBuffs(foodPointData) { + + const boost_prefixes = { + pp_consumption:"Rich", + pp_recovery:"Light", + weak_point_dmg:"Crisp", + hp_recovery:"Robust", + } + const boost_suffixes = { + potency:"Meat", + pp:"Fruit", + dmg_res:"Vegetable", + hp:"Seafood", + } + + var categories= {} + Object.keys(GetData("food_mult","0")).filter((key)=>key!=="id"&&key!=="amount").forEach((key)=>{categories[key]={count:0}}) + Object.keys(foodPointData).map((key)=>{return {...GetData("food",key),amount:foodPointData[key]}}).forEach((item)=>{ + for (var key of Object.keys(item)) { + 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() { var saveObj = { level:level, @@ -549,8 +612,20 @@ useEffect(()=>{ } },[BUILDID,GetData,BACKENDURL,p]) +useEffect(()=>{ + setBUFFS(CalculateBuffs(foodPointData)??[]) +},[foodPointData]) + //console.log(p.GetData("class",p.className,"icon")) +function deepCopySkills(skillData) { + var newSkillObj = [] + for (var data of skillData) { + newSkillObj.push({...data}) + } + return newSkillObj +} + return (<> @@ -568,7 +643,7 @@ useEffect(()=>{
Author
Build Name
{setClassSelectWindowOpen(true)}}>Class
-
{setClassSkillTreeWindowOpen(true)}}>Sub-Class
+
{setPrevPoints([...points]);setPrevSkillPointData(deepCopySkills(skillPointData));setClassSkillTreeWindowOpen(true)}}>Sub-Class
@@ -614,7 +689,7 @@ useEffect(()=>{

Equip

-

Weapons

1
+
{setWeaponSelectWindowOpen(true)}} className="equipPaletteSlot">

Weapons

1
{setArmorSlotSelection(1);setArmorSelectWindowOpen(true)}} className={"equipPaletteSlot"+rarityCheck(selectedArmor1)}>

Armor 1

{setArmorSlotSelection(2);setArmorSelectWindowOpen(true)}} className={"equipPaletteSlot"+rarityCheck(selectedArmor2)}>

Armor 2

{setArmorSlotSelection(3);setArmorSelectWindowOpen(true)}} className={"equipPaletteSlot"+rarityCheck(selectedArmor3)}>

Armor 3

@@ -758,13 +833,10 @@ useEffect(()=>{

Current Effects

- {effectPage===1?<>

Effect Name

  • {setFoodMenuWindowOpen(true)}}>Food Boost Effect - - - + {effectPage===1?<>

    Effect Name

    • {setPrevFoodPointData({...foodPointData});setFoodMenuWindowOpen(true)}}>Food Boost Effect
        -
      •  [Meat] Potency +10.0%
      • -
      •  [Crisp] Potency to Weak Point +5.0%
      • + {Object.keys(BUFFS).length==0&&
      • Add Quick Food
      • } + {Object.keys(BUFFS).map((key)=>
      •  [{BUFFS[key].from}] {key} +{BUFFS[key].count}
      • )}
    • Shifta / Deband @@ -849,7 +921,7 @@ useEffect(()=>{
      Your Skill Points{20-points[treePage-1]}
      SP{points[treePage-1]}
-
Confirm
Cancel
+
{setClassSkillTreeWindowOpen(false)}} className="skillConfirm">
Confirm
{setPoints(prevPoints);setSkillPointData(prevSkillPointData);setClassSkillTreeWindowOpen(false)}}>Cancel
@@ -882,7 +954,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 @@ -910,7 +982,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 @@ -944,7 +1016,8 @@ useEffect(()=>{ foodMenuWindowOpen={foodMenuWindowOpen} setFoodMenuWindowOpen={setFoodMenuWindowOpen} foodPointData={foodPointData} - setFoodPointData={setFoodPointData}/> + setFoodPointData={setFoodPointData} + prevFoodPointData={prevFoodPointData}/> {setAugmentSelectWindowOpen(false)}} shouldFocusAfterRender={true} shouldCloseOnOverlayClick={true} shouldCloseOnEsc={true} className="modal" overlayClassName="modalOverlayAugment">