import React, { useEffect,useState,useRef } from 'react';
import Tooltip from 'react-simple-tooltip' //Mess with all tooltip props here: https://cedricdelpoux.github.io/react-simple-tooltip/
import Modal from 'react-modal'
/**
* Hook that alerts clicks outside of the passed ref
*/
function useOutsideAlerter(ref,setEdit) {
useEffect(() => {
/**
* Alert if clicked on outside of element
*/
function handleClickOutside(event) {
if (ref.current && !ref.current.contains(event.target)) {
setEdit(false)
}
}
// Bind the event listener
document.addEventListener("mousedown", handleClickOutside);
return () => {
// Unbind the event listener on clean up
document.removeEventListener("mousedown", handleClickOutside);
};
}, [ref,setEdit]);
}
function EditBox(p) {
useEffect(()=>{
var timer1 = setTimeout(()=>{
document.getElementById("editBoxInput").focus()
document.getElementById("editBoxInput").select()
},100)
return () => {
clearTimeout(timer1);
};
},[p.edit])
return {
if (e.key==="Enter") {p.setEdit(false)}
else if (e.key==="Escape") {p.setEdit(false)}
}} maxLength={p.maxlength?p.maxlength:20} onBlur={()=>{p.setEdit(false)}} value={p.value} onChange={(f)=>{f.currentTarget.value.length>0?p.setName(f.currentTarget.value):p.setName(p.originalName)}}>
}
function EditBoxInput(p) {
const [edit,setEdit] = useState(false)
useEffect(()=>{
if (p.callback) {
p.callback()
}
},[edit,p])
return <>
{setEdit(true)}}>
{edit?
:<>{p.prefix}{p.data}>}
>
}
function PageControlButton(p) {
return {p.setCurrentPage(p.page)}} className={(p.currentPage===p.page)?"selected":"unselected"}>{p.pageName?p.pageName:p.page}
}
function PageControl(p) {
var pages = []
for (var i=0;i)
}
return
{pages.map((page,i)=>{return {page}})}
}
function ExpandTooltip(p) {
return {p.mouseOverText}
}
function Class(p) {
const CLASSES = p.GetData("class")
const class_obj = CLASSES[p.name]
return class_obj?<>{class_obj.name}>:<>>
}
function ClassSelector(p){
const CLASSES = p.GetData("class")
const wrapperRef = useRef(null);
useOutsideAlerter(wrapperRef,p.setEdit);
return <>
Class Selector
{Object.keys(CLASSES).map((cl,i)=>{
return
})}
>
}
function EditableClass(p){
const [edit,setEdit] = useState(false)
return <>{setEdit(!edit)}}>
{edit&&}
>
}
function PopupWindow(p) {
return {p.setModalOpen(false)}} shouldFocusAfterRender={true} shouldCloseOnOverlayClick={true} shouldCloseOnEsc={true} className="modal" overlayClassName="modalOverlay">
{p.title}
{p.showCloseButton&&
{p.setModalOpen(false)}}>
}
{p.children}
}
function TestPanel(p) {
const [bpGraphMax,setbpGraphMax] = useState(1000)
const [hpGraphMax,sethpGraphMax] = useState(1000)
const [ppGraphMax,setppGraphMax] = useState(1000)
const [atkGraphMax,setatkGraphMax] = useState(1000)
const [defGraphMax,setdefGraphMax] = useState(1000)
const [author,setauthor] = useState("Player")
const [buildName,setbuildName] = useState("Character")
const [className,setclassName] = useState("Hunter")
const [subclassName,setsubclassName] = useState("Force")
const [level,setLevel] = useState(20)
const [secondaryLevel,setsecondaryLevel] = useState(20)
const [effectPage,setEffectPage] = useState(1)
const [weaponPage,setWeaponPage] = useState(1)
const [statPage,setStatPage] = useState(1)
const [modalOpen,setModalOpen] = useState(false)
const [tabPage,setTabPage] = useState(1)
const [sortSelector,setSortSelector] = useState("Standard Sort")
const sortItems=[
{name:"Standard Sort",value:"id"},
{name:"Rarity",value:"rarity"},
{name:"Attack",value:"atk"},
{name:"Potency",value:"potency"}]
const [filter,setFilter] = useState("")
const filterEnabled=true
useEffect(()=>{
if (p.bp>1000) {
setbpGraphMax(3000)
sethpGraphMax(3000)
setppGraphMax(3000)
setatkGraphMax(3000)
setdefGraphMax(3000)
} else {
setbpGraphMax(1000)
sethpGraphMax(1000)
setppGraphMax(1000)
setatkGraphMax(1000)
setdefGraphMax(1000)
}
},[p.bp])
const [itemList,setItemList] = useState([])
useEffect(()=>{
var dat1=p.GetData("weapon_existence_data")
if (Array.isArray(dat1)) {
setItemList(dat1.map((we)=>{
var weapon_type=p.GetData("weapon_type",we.weapon_type_id,undefined,true)
var weapon=p.GetData("weapon",we.weapon_id,undefined,true)
var potential=p.GetData("potential",weapon.potential_id,undefined,true)
return [weapon_type,weapon,potential]
}))
}
},[p])
//console.log(p.GetData("class",p.className,"icon"))
return (<>
Basic Information
Author |
|
Build Name |
|
Class |
|
|
Sub-Class |
|
|
Equip
{setModalOpen(true)}} className="equipPaletteSlot">
Weapons
1
Equipped Weapon
Resurgir Rifle+40
Abilitiy Details
{weaponPage===1?
- } tooltip={<>Potency +20%/
Critical Hit Rage +15% for 30 seconds after a successful sidestep>}/>Dynamo Unit Lv.3
- } tooltip={<>Potency +4%>}/>Fixa Attack Lv.3
- } tooltip={<>PP +5
Ranged Weapon Potency +2.0%>}/>Pettas Soul II
- } tooltip={<>HP -10, Potency +1.5%,
Potency Floor Increase +1.5%
Damage Resistance -1.5%>}/>Alts Secreta II
- } tooltip={<>HP +10
Ranged Weapon Potency +2.0%>}/>Gigas Precision II
- } tooltip={<>Ranged Weapon Potency +2.0%>}/>Precision III
:
}
Properties
{weaponPage===1?
- Enhancement Lv. +35
- Multi-Weapon -
- Element -
:
- Enhancement Lv. -
- Multi-Weapon -
- Element -
}
Basic Stats
Battle Power |
{p.bp} |
|
HP |
{p.hp} |
|
PP |
{p.pp} |
|
Attack |
{p.statDisplayAtk} |
|
Defense |
{p.def} |
|
Weapon Up |
+{(p.weaponUp1*100).toFixed(1)}%
+{(p.weaponUp3*100).toFixed(1)}% |
+{(p.weaponUp2*100).toFixed(1)}% |
|
Ailment Resist. |
{p.damageResist} |
|
|
Damage Resist. |
{p.damageResist} |
|
|
Damage Stats
{statPage===1?<>
Critical Hit Rate |
5% |
Critical Multiplier |
120% |
Midrange |
126 |
Critcal |
152 |
Effective |
127 |
>:<>
Critical Hit Rate |
- |
Critical Multiplier |
- |
Midrange |
- |
Critcal |
- |
Effective |
- |
>
}
{itemList.filter((item)=>{
switch (tabPage) {
case 2:{
return item[0].name==="Assault Rifle"
}
case 3:{
return item[0].name==="Launcher"
}
case 4:{
return item[0].name==="Rod"
}
case 5:{
return item[0].name==="Talis"
}
default:{
return true
}
}
}).filter((item)=>{
if (filter.length>0) {
return (item[1].name.toLowerCase()+" "+item[0].name.toLowerCase()).includes(filter.toLowerCase())
} else {
return true
}
}).sort((a,b)=>{
switch (sortSelector) {
case "Rarity":{
return b[1].rarity-a[1].rarity
}
case "Attack":{
return b[1].atk-a[1].atk
}
default:{
return 0
}
}
}).map((item)=>- {item[1].name} {item[0].name}
{item[1].atk} {item[2].name}Lv.4: Potency +24%/
20% chance of Restasigne not being consumed on use. Effect starts 10 sec after equip )}
>
)
}
export default TestPanel;