Skip to content

Commit

Permalink
Merge pull request #1070 from snap01/develop
Browse files Browse the repository at this point in the history
Fix skill name migration issue with 0.7.7
  • Loading branch information
snap01 authored May 10, 2022
2 parents dbde3f5 + e625925 commit 7fa8229
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion module/items/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class CoC7Item extends Item {
}

static getNamePartsSpec (skillName, specialization) {
if (specialization === '') {
if (!specialization) {
return {
name: skillName,
specialization: '',
Expand Down
13 changes: 6 additions & 7 deletions module/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ export class Updater {
const documentType = pack.metadata.type
if (
!['Actor', 'Item', 'Macro', 'RollTable', 'Scene'].includes(documentType)
)
{return}
) { return }

// Unlock the pack for editing
const wasLocked = pack.locked
Expand Down Expand Up @@ -566,7 +565,7 @@ export class Updater {
}
const parts = CoC7Item.getNamePartsSpec(
updateData.name,
item.data.specialization.group ?? item.data.specialization
(typeof item.data.specialization?.group === 'string' ? item.data.specialization.group : item.data.specialization)
)
updateData.name = parts.name
updateData['data.skillName'] = parts.skillName
Expand All @@ -586,7 +585,7 @@ export class Updater {
}
const parts = CoC7Item.getNamePartsSpec(
updateData['data.items'][k].name,
v.data.specialization.group ?? v.data.specialization
(typeof v.data.specialization?.group === 'string' ? v.data.specialization.group : v.data.specialization)
)
updateData['data.items'][k].name = parts.name
updateData['data.items'][k].data.skillName = parts.skillName
Expand All @@ -608,7 +607,7 @@ export class Updater {
}
const parts = CoC7Item.getNamePartsSpec(
updateData['data.skills'][k].name,
v.data.specialization.group ?? v.data.specialization
(typeof v.data.specialization?.group === 'string' ? v.data.specialization.group : v.data.specialization)
)
updateData['data.skills'][k].name = parts.name
updateData['data.skills'][k].data.skillName = parts.skillName
Expand All @@ -631,7 +630,7 @@ export class Updater {
}
const parts = CoC7Item.getNamePartsSpec(
updateData['data.groups'][o].skills[k].name,
v.data.specialization.group ?? v.data.specialization
(typeof v.data.specialization?.group === 'string' ? v.data.specialization.group : v.data.specialization)
)
updateData['data.groups'][o].skills[k].name = parts.name
updateData['data.groups'][o].skills[k].data.skillName =
Expand All @@ -656,7 +655,7 @@ export class Updater {
}
const parts = CoC7Item.getNamePartsSpec(
updateData['data.skills'][k].name,
v.data.specialization.group ?? v.data.specialization
(typeof v.data.specialization?.group === 'string' ? v.data.specialization.group : v.data.specialization)
)
updateData['data.skills'][k].name = parts.name
updateData['data.skills'][k].data.skillName = parts.skillName
Expand Down

0 comments on commit 7fa8229

Please sign in to comment.