From c17eb9b8a9c5394bbd3ad30ad1360c4430d47c3a Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Thu, 12 Aug 2021 21:03:45 +0900 Subject: [PATCH] Fix the rest of dudley's breaking --- src/TestPanel.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/TestPanel.js b/src/TestPanel.js index 2ffa068..b213c4c 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -3,6 +3,9 @@ import Modal from 'react-modal' import { DisplayIcon } from './DEFAULTS'; import { ExpandTooltip } from './components/ExpandTooltip'; +//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; + /** * Hook that alerts clicks outside of the passed ref */ @@ -162,6 +165,10 @@ function SelectorWindow(p) { } +function GetSpecialWeaponName(item) { + return item[WEAPON_EXISTENCE_DATA]!==undefined?(item[WEAPON_EXISTENCE_DATA].special_name?.length>0)?item[WEAPON_EXISTENCE_DATA].special_name:(item[WEAPON_WEAPON].name+" "+item[WEAPON_WEAPONTYPE].name):"" +} + function TestPanel(p) { const [bpGraphMax,setbpGraphMax] = useState(1000) const [hpGraphMax,sethpGraphMax] = useState(1000) @@ -184,9 +191,6 @@ const [classSelectWindowOpen,setClassSelectWindowOpen] = useState(false) const [weaponSelectWindowOpen,setWeaponSelectWindowOpen] = useState(false) const [armorSelectWindowOpen,setArmorSelectWindowOpen] = useState(false) -//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; - const [selectedWeapon,setSelectedWeapon] = useState([]) const [selectedArmor1,setSelectedArmor1] = useState([]) const [selectedArmor2,setSelectedArmor2] = useState([]) @@ -296,7 +300,7 @@ useEffect(()=>{

Equipped Weapon

-

{selectedWeapon[WEAPON_WEAPON]?.name + " " + selectedWeapon[WEAPON_WEAPONTYPE]?.name}+40

+

{GetSpecialWeaponName(selectedWeapon)}+40

{weaponPage === 1 ? @@ -545,7 +549,7 @@ AUGMENT } }} displayFunction={(item)=>{ - return
  • {setSelectedWeapon(item);setWeaponSelectWindowOpen(false)}}>
    {item[WEAPON_EXISTENCE_DATA].special_name ?? item[WEAPON_WEAPON].name+" "+item[WEAPON_WEAPONTYPE].name}

    {item[WEAPON_WEAPON].atk} {item[WEAPON_POTENTIAL_TOOLTIP].map((pot,i)=><>{(i!==0)&&
    }{pot.name}: {pot.description?pot.description.split("\\n").map((it)=><>{it}
    ):<>})}}> + return
  • {setSelectedWeapon(item);setWeaponSelectWindowOpen(false)}}>
    {GetSpecialWeaponName(item)}

    {item[WEAPON_WEAPON].atk} {item[WEAPON_POTENTIAL_TOOLTIP].map((pot,i)=><>{(i!==0)&&
    }{pot.name}: {pot.description?pot.description.split("\\n").map((it)=><>{it}
    ):<>})}}> {item[WEAPON_POTENTIAL].name}
  • }} />