Fix #30 - Disable dual skills dop

This commit is contained in:
LeRatierBretonnien 2025-01-10 00:11:25 +01:00
parent 03a54d86e6
commit 70c4fd5a74
8 changed files with 54 additions and 28 deletions

View File

@ -441,7 +441,8 @@
},
"Notitications": {
"NoWeaponSkill": "No weapon skill found for this weapon. Check Weapon definition or available skills/era",
"NoWeaponType": "No weapon type found for this weapon subtype. Check Weapon definition or available skills/era"
"NoWeaponType": "No weapon type found for this weapon subtype. Check Weapon definition or available skills/era",
"skillAlreadyExists": "Skill already exists"
}
}
}

View File

@ -98,22 +98,30 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
case "skills":
context.tab = context.tabs.skills
context.skills = doc.itemTypes.skill
context.skills.sort((a, b) => a.name.localeCompare(b.name))
break
case "equipment":
context.tab = context.tabs.equipment
context.weapons = doc.itemTypes.weapon
context.weapons.sort((a, b) => a.name.localeCompare(b.name))
context.armors = doc.itemTypes.armor
context.armors.sort((a, b) => a.name.localeCompare(b.name))
context.gears = doc.itemTypes.gear
context.gears.sort((a, b) => a.name.localeCompare(b.name))
break
case "status":
context.tab = context.tabs.status
context.injuries = doc.itemTypes.injury
context.injuries.sort((a, b) => a.name.localeCompare(b.name))
context.mentaldisorders = doc.itemTypes.mentaldisorder
context.mentaldisorders.sort((a, b) => a.name.localeCompare(b.name))
context.bonds = doc.itemTypes.bond
context.bonds.sort((a, b) => a.name.localeCompare(b.name))
break
case "biography":
context.tab = context.tabs.biography
context.motivations = doc.itemTypes.motivation
context.motivations.sort((a, b) => a.name.localeCompare(b.name))
context.enrichedDescription = await TextEditor.enrichHTML(doc.system.description, { async: true })
context.enrichedNotes = await TextEditor.enrichHTML(doc.system.notes, { async: true })
break

View File

@ -42,6 +42,23 @@ export default class CthulhuEternalActor extends Actor {
return super._onUpdate(changed, options, userId)
}
async createEmbeddedDocuments(embeddedName, data, operation) {
let newData = []
if (embeddedName === "Item") {
for (let i of data) {
if (i.type === "skill") {
if (this.items.find(item => item.name.toLowerCase() === i.name.toLowerCase())) {
ui.notifications.warn(game.i18n.localize("CTHULHUETERNAL.Notifications.skillAlreadyExists"))
continue
}
}
newData.push(i)
}
return super.createEmbeddedDocuments(embeddedName, newData, operation)
}
return super.createEmbeddedDocuments(embeddedName, data, operation)
}
async _preCreate(data, options, user) {
await super._preCreate(data, options, user)

View File

View File

@ -1 +1 @@
MANIFEST-000048
MANIFEST-000052

View File

@ -1,3 +1,3 @@
2025/01/09-15:39:16.704802 7f0abb7fe6c0 Recovering log #46
2025/01/09-15:39:16.715860 7f0abb7fe6c0 Delete type=3 #44
2025/01/09-15:39:16.715933 7f0abb7fe6c0 Delete type=0 #46
2025/01/10-00:04:46.700736 7f0abaffd6c0 Recovering log #50
2025/01/10-00:04:46.711152 7f0abaffd6c0 Delete type=3 #48
2025/01/10-00:04:46.711210 7f0abaffd6c0 Delete type=0 #50

View File

@ -1,8 +1,8 @@
2025/01/09-15:36:12.923109 7f0aba7fc6c0 Recovering log #42
2025/01/09-15:36:12.933058 7f0aba7fc6c0 Delete type=3 #40
2025/01/09-15:36:12.933138 7f0aba7fc6c0 Delete type=0 #42
2025/01/09-15:36:31.742879 7f0ab9bff6c0 Level-0 table #47: started
2025/01/09-15:36:31.742910 7f0ab9bff6c0 Level-0 table #47: 0 bytes OK
2025/01/09-15:36:31.749117 7f0ab9bff6c0 Delete type=0 #45
2025/01/09-15:36:31.749289 7f0ab9bff6c0 Manual compaction at level-0 from '!folders!DD8331Hda4rhvEf9' @ 72057594037927935 : 1 .. '!items!zplzTG30QXHURusr' @ 0 : 0; will stop at (end)
2025/01/09-15:36:31.759629 7f0ab9bff6c0 Manual compaction at level-1 from '!folders!DD8331Hda4rhvEf9' @ 72057594037927935 : 1 .. '!items!zplzTG30QXHURusr' @ 0 : 0; will stop at (end)
2025/01/09-15:39:16.704802 7f0abb7fe6c0 Recovering log #46
2025/01/09-15:39:16.715860 7f0abb7fe6c0 Delete type=3 #44
2025/01/09-15:39:16.715933 7f0abb7fe6c0 Delete type=0 #46
2025/01/09-16:20:07.336867 7f0ab9bff6c0 Level-0 table #51: started
2025/01/09-16:20:07.336898 7f0ab9bff6c0 Level-0 table #51: 0 bytes OK
2025/01/09-16:20:07.343031 7f0ab9bff6c0 Delete type=0 #49
2025/01/09-16:20:07.352821 7f0ab9bff6c0 Manual compaction at level-0 from '!folders!DD8331Hda4rhvEf9' @ 72057594037927935 : 1 .. '!items!zplzTG30QXHURusr' @ 0 : 0; will stop at (end)
2025/01/09-16:20:07.369688 7f0ab9bff6c0 Manual compaction at level-1 from '!folders!DD8331Hda4rhvEf9' @ 72057594037927935 : 1 .. '!items!zplzTG30QXHURusr' @ 0 : 0; will stop at (end)

Binary file not shown.