diff --git a/src/TestPanel.js b/src/TestPanel.js index 032c855..6b36f32 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -7,7 +7,8 @@ import { SkillTree } from './skilltree/skillTree'; import axios from 'axios'; import Helmet from 'react-helmet' -import { useLocation,useHistory,useParams,matchPath } from 'react-router'; +import { useLocation,useHistory,useParams,matchPath } from 'react-router' +import { ArrowUpShort } from 'react-bootstrap-icons' //Helper variables for Weapon selector with structure: [weapon_type,weapon,potential,potential_tooltip,weapon_existence_data] const WEAPON_WEAPONTYPE=0;const WEAPON_WEAPON=1;const WEAPON_POTENTIAL=2;const WEAPON_POTENTIAL_TOOLTIP=3;const WEAPON_EXISTENCE_DATA=4; @@ -288,23 +289,107 @@ function SkillTreeContainer(p){ } +function FoodItem(p) { + const {description,dmg_res,editors_choice, + hp,hp_recovery,icon,id,name,popularity,potency, + pp,pp_consumption,pp_recovery,weak_point_dmg,rarity, + food_type} = p.item + const {modifyPoints} = p + const [points,setPoints] = useState(p.points) + const boosts = [ + { + name:"Damage Resistance", + icon:"", + val:dmg_res + }, + { + name:"Health", + icon:"", + val:hp + }, + { + name:"Health Recovery", + icon:"", + val:hp_recovery + }, + { + name:"Potency", + icon:"pot", + val:potency + }, + { + name:"Damage Resistance", + icon:"", + val:dmg_res + }, + { + name:"PP Boost", + icon:"", + val:pp + }, + { + name:"PP Consumption Reduction", + icon:"", + val:pp_consumption + }, + { + name:"PP Recovery", + icon:"", + val:pp_recovery + }, + { + name:"Weak Point Damage", + icon:"atk", + val:weak_point_dmg + }] + + useEffect(()=>{ + setPoints(p.points) + },[p.points]) + + return
0?"Active":""} r${rarity}`}> +
+ +
+
+ {name} +
+
 
+
+ {boosts.filter((val)=>val.val).map((val=>Up))} +
+
+ {modifyPoints(name,-1)}}>- + {points} + {modifyPoints(name,1)}}>+ +
+} + function FoodPopupWindow(p) { - return - -
XXXL Super Duper Extra Crispy Delicious Sweet Mouth-Watering Meat
 
9999Indomitable Unit
-0+
-
Potato 2
 
9999Indomitable Unit
-0+
-
Dog with Claws
 
9999Indomitable Unit
-0+
-
If you put your ear to it you can hear the PSO2 lobby music
 
9999Indomitable Unit
-0+
-
XXXL Super Duper Extra Crispy Delicious Sweet Mouth-Watering Meat
 
9999Indomitable Unit
-0+
-
Potato 2
 
9999Indomitable Unit
-0+
-
Dog with Claws
 
9999Indomitable Unit
-0+
-
If you put your ear to it you can hear the PSO2 lobby music
 
9999Indomitable Unit
-0+
-
XXXL Super Duper Extra Crispy Delicious Sweet Mouth-Watering Meat
 
9999Indomitable Unit
-0+
-
Potato 2
 
9999Indomitable Unit
-0+
-
Dog with Claws
 
9999Indomitable Unit
-0+
-
If you put your ear to it you can hear the PSO2 lobby music
 
9999Indomitable Unit
-0+
- + const {GetData,foodPointData,setFoodPointData} = p + + const MAX_SELECTED=10; + const [FOODLIST,setFOODLIST] = useState(Object.keys(GetData("food"))) + const [FOODS,setFOODS] = useState(GetData("food")) + + useEffect(()=>{ + setFOODLIST(Object.keys(GetData("food"))) + setFOODS(GetData("food")) + },[GetData]) + + function modifyPoints(foodName,add) { + var temp = {...foodPointData} + var total = Object.keys(foodPointData).reduce((total,food)=>foodPointData[food]+total,0) + console.log(total) + if (add+total<=10&&add+total>=0) { + temp[foodName] = Math.min(Math.max((temp[foodName]??0)+add,0),MAX_SELECTED) + setFoodPointData(temp) + } + } + + return + {FOODLIST.map((key)=>)} } @@ -352,6 +437,8 @@ const [classNameSetter,setClassNameSetter] = useState(0) const [points,setPoints] = useState([]) const [skillPointData,setSkillPointData] = useState([]) +const [foodPointData,setFoodPointData] = useState({}) + function SaveData() { var saveObj = { level:level, @@ -868,7 +955,9 @@ useEffect(()=>{ + setFoodMenuWindowOpen={setFoodMenuWindowOpen} + foodPointData={foodPointData} + setFoodPointData={setFoodPointData}/> )