Fix AX references

This commit is contained in:
Justin Edmund 2023-01-02 21:40:27 -08:00
parent 9d5d67601c
commit eac805106a
4 changed files with 13 additions and 12 deletions

View file

@ -80,7 +80,7 @@ const WeaponHovercard = (props: Props) => {
} }
const createPrimaryAxSkillString = () => { const createPrimaryAxSkillString = () => {
const primaryAxSkills = axData[props.gridWeapon.object.ax - 1] const primaryAxSkills = axData[props.gridWeapon.object.ax_type - 1]
if (props.gridWeapon.ax) { if (props.gridWeapon.ax) {
const simpleAxSkill = props.gridWeapon.ax[0] const simpleAxSkill = props.gridWeapon.ax[0]
@ -97,7 +97,7 @@ const WeaponHovercard = (props: Props) => {
} }
const createSecondaryAxSkillString = () => { const createSecondaryAxSkillString = () => {
const primaryAxSkills = axData[props.gridWeapon.object.ax - 1] const primaryAxSkills = axData[props.gridWeapon.object.ax_type - 1]
if (props.gridWeapon.ax) { if (props.gridWeapon.ax) {
const primarySimpleAxSkill = props.gridWeapon.ax[0] const primarySimpleAxSkill = props.gridWeapon.ax[0]
@ -230,7 +230,7 @@ const WeaponHovercard = (props: Props) => {
</div> </div>
</div> </div>
{props.gridWeapon.object.ax > 0 && {props.gridWeapon.object.ax &&
props.gridWeapon.ax && props.gridWeapon.ax &&
props.gridWeapon.ax[0].modifier && props.gridWeapon.ax[0].modifier &&
props.gridWeapon.ax[0].strength props.gridWeapon.ax[0].strength

View file

@ -148,7 +148,7 @@ const WeaponModal = (props: Props) => {
if (props.gridWeapon.object.series == 17 && weaponKey3Id) if (props.gridWeapon.object.series == 17 && weaponKey3Id)
object.weapon.weapon_key3_id = weaponKey3Id object.weapon.weapon_key3_id = weaponKey3Id
if (props.gridWeapon.object.ax > 0) { if (props.gridWeapon.object.ax && props.gridWeapon.object.ax_type > 0) {
object.weapon.ax_modifier1 = primaryAxModifier object.weapon.ax_modifier1 = primaryAxModifier
object.weapon.ax_modifier2 = secondaryAxModifier object.weapon.ax_modifier2 = secondaryAxModifier
object.weapon.ax_strength1 = primaryAxValue object.weapon.ax_strength1 = primaryAxValue
@ -287,7 +287,7 @@ const WeaponModal = (props: Props) => {
<section> <section>
<h3>{t('modals.weapon.subtitles.ax_skills')}</h3> <h3>{t('modals.weapon.subtitles.ax_skills')}</h3>
<AXSelect <AXSelect
axType={props.gridWeapon.object.ax} axType={props.gridWeapon.object.ax_type}
currentSkills={props.gridWeapon.ax} currentSkills={props.gridWeapon.ax}
onOpenChange={receiveAxOpen} onOpenChange={receiveAxOpen}
sendValidity={receiveValidity} sendValidity={receiveValidity}
@ -314,7 +314,7 @@ const WeaponModal = (props: Props) => {
} }
function openChange(open: boolean) { function openChange(open: boolean) {
if (props.gridWeapon.object.ax > 0 || props.gridWeapon.object.awakening) { if (props.gridWeapon.object.ax || props.gridWeapon.object.awakening) {
setFormValid(false) setFormValid(false)
} else { } else {
setFormValid(true) setFormValid(true)
@ -369,7 +369,7 @@ const WeaponModal = (props: Props) => {
{[2, 3, 17, 24].includes(props.gridWeapon.object.series) {[2, 3, 17, 24].includes(props.gridWeapon.object.series)
? keySelect() ? keySelect()
: ''} : ''}
{props.gridWeapon.object.ax > 0 ? axSelect() : ''} {props.gridWeapon.object.ax ? axSelect() : ''}
{props.gridWeapon.awakening ? awakeningSelect() : ''} {props.gridWeapon.awakening ? awakeningSelect() : ''}
<Button <Button
contained={true} contained={true}

View file

@ -290,7 +290,7 @@ const WeaponUnit = (props: Props) => {
if ( if (
props.gridWeapon && props.gridWeapon &&
props.gridWeapon.object.ax && props.gridWeapon.object.ax &&
props.gridWeapon.object.ax > 0 && props.gridWeapon.object.ax_type > 0 &&
props.gridWeapon.ax && props.gridWeapon.ax &&
axSkill axSkill
) { ) {
@ -310,7 +310,7 @@ const WeaponUnit = (props: Props) => {
let images: JSX.Element[] = [] let images: JSX.Element[] = []
if ( if (
props.gridWeapon && props.gridWeapon &&
props.gridWeapon.object.ax > 0 && props.gridWeapon.object.ax &&
props.gridWeapon.ax && props.gridWeapon.ax &&
props.gridWeapon.ax.length > 0 props.gridWeapon.ax.length > 0
) { ) {
@ -327,10 +327,10 @@ const WeaponUnit = (props: Props) => {
if ( if (
props.gridWeapon && props.gridWeapon &&
props.gridWeapon.object.ax && props.gridWeapon.object.ax &&
props.gridWeapon.object.ax > 0 && props.gridWeapon.object.ax_type > 0 &&
props.gridWeapon.ax props.gridWeapon.ax
) { ) {
const axOptions = axData[props.gridWeapon.object.ax - 1] const axOptions = axData[props.gridWeapon.object.ax_type - 1]
const weaponAxSkill: SimpleAxSkill = props.gridWeapon.ax[0] const weaponAxSkill: SimpleAxSkill = props.gridWeapon.ax[0]
let axSkill = axOptions.find((ax) => ax.id === weaponAxSkill.modifier) let axSkill = axOptions.find((ax) => ax.id === weaponAxSkill.modifier)

3
types/Weapon.d.ts vendored
View file

@ -8,7 +8,8 @@ interface Weapon {
max_level: number max_level: number
max_skill_level: number max_skill_level: number
series: number series: number
ax: number ax: boolean
ax_type: number
awakening: boolean awakening: boolean
name: { name: {
[key: string]: string [key: string]: string