Rename unique canonical keys to generic object
This commit is contained in:
parent
99a2474cbb
commit
2909da98eb
7 changed files with 27 additions and 29 deletions
|
|
@ -107,13 +107,13 @@ const SummonGrid = (props: Props) => {
|
|||
}
|
||||
|
||||
function populateSummons(list: [GridSummon]) {
|
||||
list.forEach((object: GridSummon) => {
|
||||
if (object.main)
|
||||
state.grid.summons.mainSummon = object
|
||||
else if (object.friend)
|
||||
state.grid.summons.friendSummon = object
|
||||
else if (!object.main && !object.friend && object.position != null)
|
||||
state.grid.summons.allSummons[object.position] = object
|
||||
list.forEach((gridObject: GridSummon) => {
|
||||
if (gridObject.main)
|
||||
state.grid.summons.mainSummon = gridObject
|
||||
else if (gridObject.friend)
|
||||
state.grid.summons.friendSummon = gridObject
|
||||
else if (!gridObject.main && !gridObject.friend && gridObject.position != null)
|
||||
state.grid.summons.allSummons[gridObject.position] = gridObject
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const SummonUnit = (props: Props) => {
|
|||
})
|
||||
|
||||
const gridSummon = props.gridSummon
|
||||
const summon = gridSummon?.summon
|
||||
const summon = gridSummon?.object
|
||||
|
||||
useEffect(() => {
|
||||
generateImageUrl()
|
||||
|
|
@ -38,7 +38,7 @@ const SummonUnit = (props: Props) => {
|
|||
function generateImageUrl() {
|
||||
let imgSrc = ""
|
||||
if (props.gridSummon) {
|
||||
const summon = props.gridSummon.summon!
|
||||
const summon = props.gridSummon.object!
|
||||
|
||||
// Generate the correct source for the summon
|
||||
if (props.unitType == 0 || props.unitType == 2)
|
||||
|
|
@ -72,8 +72,8 @@ const SummonUnit = (props: Props) => {
|
|||
{ (gridSummon) ?
|
||||
<UncapIndicator
|
||||
type="summon"
|
||||
ulb={gridSummon.summon.uncap.ulb || false}
|
||||
flb={gridSummon.summon.uncap.flb || false}
|
||||
ulb={gridSummon.object.uncap.ulb || false}
|
||||
flb={gridSummon.object.uncap.flb || false}
|
||||
uncapLevel={gridSummon.uncap_level}
|
||||
updateUncap={passUncapData}
|
||||
special={false}
|
||||
|
|
|
|||
|
|
@ -104,14 +104,12 @@ const WeaponGrid = (props: Props) => {
|
|||
}
|
||||
|
||||
function populateWeapons(list: [GridWeapon]) {
|
||||
let weapons: GridArray<GridWeapon> = {}
|
||||
|
||||
list.forEach((object: GridWeapon) => {
|
||||
if (object.mainhand) {
|
||||
state.grid.weapons.mainWeapon = object
|
||||
state.party.element = object.weapon.element
|
||||
} else if (!object.mainhand && object.position != null) {
|
||||
state.grid.weapons.allWeapons[object.position] = object
|
||||
list.forEach((gridObject: GridWeapon) => {
|
||||
if (gridObject.mainhand) {
|
||||
state.grid.weapons.mainWeapon = gridObject
|
||||
state.party.element = gridObject.object.element
|
||||
} else if (!gridObject.mainhand && gridObject.position != null) {
|
||||
state.grid.weapons.allWeapons[gridObject.position] = gridObject
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -159,7 +157,7 @@ const WeaponGrid = (props: Props) => {
|
|||
function storeGridWeapon(gridWeapon: GridWeapon) {
|
||||
if (gridWeapon.position == -1) {
|
||||
state.grid.weapons.mainWeapon = gridWeapon
|
||||
state.party.element = gridWeapon.weapon.element
|
||||
state.party.element = gridWeapon.object.element
|
||||
} else {
|
||||
// Store the grid unit at the correct position
|
||||
state.grid.weapons.allWeapons[gridWeapon.position] = gridWeapon
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const WeaponUnit = (props: Props) => {
|
|||
})
|
||||
|
||||
const gridWeapon = props.gridWeapon
|
||||
const weapon = gridWeapon?.weapon
|
||||
const weapon = gridWeapon?.object
|
||||
|
||||
useEffect(() => {
|
||||
generateImageUrl()
|
||||
|
|
@ -37,7 +37,7 @@ const WeaponUnit = (props: Props) => {
|
|||
function generateImageUrl() {
|
||||
let imgSrc = ""
|
||||
if (props.gridWeapon) {
|
||||
const weapon = props.gridWeapon.weapon!
|
||||
const weapon = props.gridWeapon.object!
|
||||
|
||||
if (props.unitType == 0)
|
||||
imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-main/${weapon.granblue_id}.jpg`
|
||||
|
|
@ -70,8 +70,8 @@ const WeaponUnit = (props: Props) => {
|
|||
{ (gridWeapon) ?
|
||||
<UncapIndicator
|
||||
type="weapon"
|
||||
ulb={gridWeapon.weapon.uncap.ulb || false}
|
||||
flb={gridWeapon.weapon.uncap.flb || false}
|
||||
ulb={gridWeapon.object.uncap.ulb || false}
|
||||
flb={gridWeapon.object.uncap.flb || false}
|
||||
uncapLevel={gridWeapon.uncap_level}
|
||||
updateUncap={passUncapData}
|
||||
special={false}
|
||||
|
|
|
|||
4
types/GridCharacter.d.ts
vendored
4
types/GridCharacter.d.ts
vendored
|
|
@ -1,6 +1,6 @@
|
|||
interface GridCharacter {
|
||||
interface GridCharacter {
|
||||
id: string
|
||||
position: number
|
||||
character: Character
|
||||
object: Character
|
||||
uncap_level: number
|
||||
}
|
||||
4
types/GridSummon.d.ts
vendored
4
types/GridSummon.d.ts
vendored
|
|
@ -1,8 +1,8 @@
|
|||
interface GridSummon {
|
||||
interface GridSummon {
|
||||
id: string
|
||||
main: boolean
|
||||
friend: boolean
|
||||
position: number
|
||||
summon: Summon
|
||||
object: Summon
|
||||
uncap_level: number
|
||||
}
|
||||
2
types/GridWeapon.d.ts
vendored
2
types/GridWeapon.d.ts
vendored
|
|
@ -2,6 +2,6 @@ interface GridWeapon {
|
|||
id: string
|
||||
mainhand: boolean
|
||||
position: number
|
||||
weapon: Weapon
|
||||
object: Weapon
|
||||
uncap_level: number
|
||||
}
|
||||
Loading…
Reference in a new issue