From a193cbd6f02ab5c72849b6c208398e8947a14eea Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Sat, 11 Sep 2021 16:07:55 +0900 Subject: [PATCH 1/4] 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 From 1a9841d2b9f98f5a0acbda3f41a540be9bedf16c Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Sat, 11 Sep 2021 17:21:20 +0900 Subject: [PATCH 2/4] We have food. And the food now makes sense. Thanks dudley --- src/TestPanel.js | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/src/TestPanel.js b/src/TestPanel.js index 498f1bb..1951e94 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -464,12 +464,35 @@ const [prevSkillPointData,setPrevSkillPointData] = useState([]) const [foodPointData,setFoodPointData] = useState({}) const [prevFoodPointData,setPrevFoodPointData] = useState({}) +const [BUFFS,setBUFFS] = useState({}) + 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= {} - 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 + 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() { @@ -577,6 +600,14 @@ useEffect(()=>{ } },[BUILDID,GetData,BACKENDURL,p]) +useEffect(()=>{ + setBUFFS(CalculateBuffs(foodPointData)??[]) +},[foodPointData]) + +useEffect(()=>{ + console.log(BUFFS) +},[BUFFS]) + //console.log(p.GetData("class",p.className,"icon")) return (<> @@ -788,8 +819,8 @@ useEffect(()=>{ {effectPage===1?<>

    Effect Name

    • {setFoodMenuWindowOpen(true)}}>Food Boost Effect
        - {Object.keys(CalculateBuffs(foodPointData)??[]).map((key)=>
      •  [Meat] {key} +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 From 0a7a4977e3adc29f806e9e61e5e9b35b3cd22c5e Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Sat, 11 Sep 2021 18:12:58 +0900 Subject: [PATCH 3/4] Confirm and cancel button implementations completed. --- src/TestPanel.js | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/TestPanel.js b/src/TestPanel.js index 1951e94..a7905f6 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -389,7 +389,18 @@ function FoodPopupWindow(p) { } } - return
      Foods in Recipe
      {FOODCOUNT}
      Confirm
      Cancel
      } + 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={()=>{ @@ -460,6 +471,7 @@ 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({}) @@ -468,13 +480,13 @@ const [BUFFS,setBUFFS] = useState({}) function CalculateBuffs(foodPointData) { - var boost_prefixes = { + const boost_prefixes = { pp_consumption:"Rich", pp_recovery:"Light", weak_point_dmg:"Crisp", hp_recovery:"Robust", } - var boost_suffixes = { + const boost_suffixes = { potency:"Meat", pp:"Fruit", dmg_res:"Vegetable", @@ -605,11 +617,19 @@ useEffect(()=>{ },[foodPointData]) useEffect(()=>{ - console.log(BUFFS) -},[BUFFS]) + console.log(prevSkillPointData) +},[prevSkillPointData]) //console.log(p.GetData("class",p.className,"icon")) +function deepCopySkills(skillData) { + var newSkillObj = [] + for (var data of skillData) { + newSkillObj.push({...data}) + } + return newSkillObj +} + return (<> @@ -627,7 +647,7 @@ useEffect(()=>{
      Author
      Build Name
      {setClassSelectWindowOpen(true)}}>Class
      -
      {setClassSkillTreeWindowOpen(true)}}>Sub-Class
      +
      {setPrevPoints([...points]);setPrevSkillPointData(deepCopySkills(skillPointData));setClassSkillTreeWindowOpen(true)}}>Sub-Class
      @@ -817,7 +837,7 @@ useEffect(()=>{

      Current Effects

      - {effectPage===1?<>

      Effect Name

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

        Effect Name

        • {setPrevFoodPointData({...foodPointData});setFoodMenuWindowOpen(true)}}>Food Boost Effect
            {Object.keys(BUFFS).length==0&&
          • Add Quick Food
          • } {Object.keys(BUFFS).map((key)=>
          •  [{BUFFS[key].from}] {key} +{BUFFS[key].count}
          • )} @@ -905,7 +925,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
            @@ -1000,7 +1020,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="modalOverlay">
            From 84df17a89780f70ab3f0bc1d77e5ca8d8e7e20be Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Sat, 11 Sep 2021 18:18:16 +0900 Subject: [PATCH 4/4] Fix removal of weapon select window onclick function being gone. --- src/TestPanel.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/TestPanel.js b/src/TestPanel.js index a7905f6..dec5b18 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -616,10 +616,6 @@ useEffect(()=>{ setBUFFS(CalculateBuffs(foodPointData)??[]) },[foodPointData]) -useEffect(()=>{ - console.log(prevSkillPointData) -},[prevSkillPointData]) - //console.log(p.GetData("class",p.className,"icon")) function deepCopySkills(skillData) { @@ -693,7 +689,7 @@ function deepCopySkills(skillData) {

            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