From b6fa20ecd30dc19612b38cfdf8019c5b8690ba6b Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Wed, 25 Aug 2021 23:03:15 +0900 Subject: [PATCH] Loading Builds is now possible. --- src/App.js | 3 +-- src/TestPanel.js | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/App.js b/src/App.js index 39f2d03..ed1fd92 100644 --- a/src/App.js +++ b/src/App.js @@ -12,8 +12,7 @@ import { HashRouter, Switch, Route, - useHistory, - useParams + useHistory } from "react-router-dom"; import { HashLink as Link } from 'react-router-hash-link'; diff --git a/src/TestPanel.js b/src/TestPanel.js index 15b4803..c2b5359 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -304,7 +304,7 @@ const [ppGraphMax,setppGraphMax] = useState(1000) const [atkGraphMax,setatkGraphMax] = useState(1000) const [defGraphMax,setdefGraphMax] = useState(1000) -const [author,setauthor] = useState("Player") +const [author,setAuthor] = useState("Player") const [buildName,setbuildName] = useState("Character") const [className,setClassName] = useState("Ranger") const [subclassName,setSubClassName] = useState("Force") @@ -366,7 +366,38 @@ function SaveData() { function LoadData(build) { if (build) { - + axios.get(BACKENDURL+"/getBuild?id="+build) + .then((data)=>{ + setAuthor(data.data.creator) + setbuildName(data.data.build_name) + setClassName(GetData("class",data.data.class1,"name",true)) + setSubClassName(GetData("class",data.data.class2,"name",true)) + var dat = JSON.parse(data.data.data) + setLevel(dat.level) + setsecondaryLevel(dat.secondaryLevel) + setPoints(dat.points) + setSkillPointData(dat.skillPointData) + var dat1=p.GetData("weapon_existence_data") + var weapon_type=GetData("weapon_type",dat.weaponType) + var weapon=GetData("weapon",dat.weaponBaseName) + var potential=GetData("potential",weapon.potential_id,undefined,true) + var potential_all=GetData("potential_data") + var potential_tooltip=[] + for (var pot in potential_all) { + if (pot.includes(potential.name)) { + potential_tooltip.push(p.GetData("potential_data",pot)) + } + } + var existence_data = Array.isArray(dat1)?dat1.filter((weapon_existence_data)=>weapon_existence_data.weapon_type_id===weapon_type.id&&weapon_existence_data.weapon_id===weapon.id)[0]:undefined + console.log(JSON.stringify([weapon_type,weapon,potential,potential_tooltip,existence_data])) + setSelectedWeapon([weapon_type,weapon,potential,potential_tooltip,existence_data]) + setSelectedArmor1(GetData("armor",dat.armor1Name)) + setSelectedArmor2(GetData("armor",dat.armor2Name)) + setSelectedArmor3(GetData("armor",dat.armor3Name)) + }) + .catch((err)=>{ + console.log(err.message) + }) } } @@ -407,7 +438,7 @@ useEffect(()=>{ useEffect(()=>{ LoadData(BUILDID) -},[BUILDID]) +},[BUILDID,GetData]) //console.log(p.GetData("class",p.className,"icon")) @@ -422,7 +453,7 @@ useEffect(()=>{

Basic Information

-
Author
+
Author
Build Name
{setClassSelectWindowOpen(true)}}>Class
{setClassSkillTreeWindowOpen(true)}}>Sub-Class