Compare commits

..

2 Commits

2 changed files with 5 additions and 5 deletions

View File

@ -293,7 +293,7 @@ export class AdvantageSheet extends HandlebarsApplicationMixin(DocumentSheetV2)
_onRender(context, options) { _onRender(context, options) {
if (this._selectedVariant == null) { if (this._selectedVariant == null) {
this._selectedVariant = this.document.system.auswahl[0].name this._selectedVariant = this.document.system.auswahl?.[0]?.name ?? ""
this._currentSelectedVariant = this.document.system.auswahl?.find(p => p.name === this._selectedVariant) this._currentSelectedVariant = this.document.system.auswahl?.find(p => p.name === this._selectedVariant)
this._currentSelectedVariantIndex = this.document.system.auswahl?.findIndex(p => p.name === this._selectedVariant) this._currentSelectedVariantIndex = this.document.system.auswahl?.findIndex(p => p.name === this._selectedVariant)
} }

View File

@ -339,7 +339,7 @@ export class XmlImport {
async #addSkillFromCompendiumByNameToActor(talentName, taw, actor, combatStatistics, attributes) { async #addSkillFromCompendiumByNameToActor(talentName, taw, actor, combatStatistics, attributes) {
const compendiumOfSkills = game.packs.get('DSA_4-1.Skills'); const compendiumOfSkills = game.packs.get('DSA_4-1.Skills');
const talentId = compendiumOfSkills.index.find(skill => skill.name === talentName) const talentId = compendiumOfSkills.index.find(skill => skill.name.trim() === talentName.trim())
if (talentId) { if (talentId) {
const talent = await compendiumOfSkills.getDocument(talentId._id); const talent = await compendiumOfSkills.getDocument(talentId._id);
@ -368,7 +368,7 @@ export class XmlImport {
async #addAdvantageFromCompendiumByNameToActor(advantageName, advantageValue, actor) { async #addAdvantageFromCompendiumByNameToActor(advantageName, advantageValue, actor) {
const compendiumOfAdvantages = game.packs.get('DSA_4-1.Advantage'); const compendiumOfAdvantages = game.packs.get('DSA_4-1.Advantage');
const advantageId = compendiumOfAdvantages.index.find(skill => skill.name === advantageName) const advantageId = compendiumOfAdvantages.index.find(skill => skill.name.trim() === advantageName.trim())
if (advantageId) { if (advantageId) {
const advantage = await compendiumOfAdvantages.getDocument(advantageId._id); const advantage = await compendiumOfAdvantages.getDocument(advantageId._id);
@ -385,7 +385,7 @@ export class XmlImport {
async #addSpellsFromCompendiumByNameToActor(spellName, zfw, representation, hauszauber, actor) { async #addSpellsFromCompendiumByNameToActor(spellName, zfw, representation, hauszauber, actor) {
const compendiumOfSpells = game.packs.get('DSA_4-1.Spells') const compendiumOfSpells = game.packs.get('DSA_4-1.Spells')
const SCREAMING_NAME = spellName.toUpperCase() const SCREAMING_NAME = spellName.toUpperCase()
const spellId = compendiumOfSpells.index.find(spell => spell.name === SCREAMING_NAME) const spellId = compendiumOfSpells.index.find(spell => spell.name.trim() === SCREAMING_NAME.trim())
if (spellId) { if (spellId) {
const spell = await compendiumOfSpells.getDocument(spellId._id); const spell = await compendiumOfSpells.getDocument(spellId._id);
@ -403,7 +403,7 @@ export class XmlImport {
async #addLiturgiesFromCompendiumByNameToActor(liturgyName, actor) { async #addLiturgiesFromCompendiumByNameToActor(liturgyName, actor) {
const compendiumOfLiturgies = game.packs.get('DSA_4-1.Liturgies'); const compendiumOfLiturgies = game.packs.get('DSA_4-1.Liturgies');
const liturgyId = compendiumOfLiturgies.index.find(liturgy => { const liturgyId = compendiumOfLiturgies.index.find(liturgy => {
return liturgy.name === LiturgyData.lookupAlias(liturgyName.split(" (")[0]) return liturgy.name.trim() === LiturgyData.lookupAlias(liturgyName.split(" (")[0]).trim()
}) })
if (liturgyId) { if (liturgyId) {