Fix for 20Q and some warn console for debug

This commit is contained in:
Vlyan
2021-01-02 17:23:01 +01:00
parent 66353d71c6
commit 91aab76e01
2 changed files with 12 additions and 6 deletions

View File

@@ -200,7 +200,7 @@ export class TwentyQuestionsDialog extends FormApplication {
// School Ability // School Ability
if (stepKey === "step3.school_ability") { if (stepKey === "step3.school_ability") {
if (item.data.data.technique_type !== "school_ability") { if (item.data.data.technique_type !== "school_ability") {
// console.warn("This technique is not a school ability"); console.warn("This technique is not a school ability");
return; return;
} }
if ( if (
@@ -208,12 +208,12 @@ export class TwentyQuestionsDialog extends FormApplication {
(e) => e.type === "technique" && e.data.data.technique_type === "school_ability" (e) => e.type === "technique" && e.data.data.technique_type === "school_ability"
) )
) { ) {
// console.warn("This technique is not a school ability", item.data.data.technique_type); console.warn("This technique is not a school ability", item.data.data.technique_type);
return; return;
} }
} else if (!this.actor.data.data.techniques[item.data.data.technique_type]) { } else if (!this.object.data.step3.allowed_techniques?.[item.data.data.technique_type]) {
// Tech not allowed // Tech not allowed
// console.warn("This technique is not allowed for your character", item.data.data.technique_type); console.warn("This technique is not allowed for your character", item.data.data.technique_type);
return; return;
} }
break; break;
@@ -222,31 +222,37 @@ export class TwentyQuestionsDialog extends FormApplication {
switch (stepKey) { switch (stepKey) {
case "step9.distinction": case "step9.distinction":
if (item.data.data.peculiarity_type !== "distinction") { if (item.data.data.peculiarity_type !== "distinction") {
console.warn("Wrong type", item.data.data.peculiarity_type);
return; return;
} }
break; break;
case "step10.adversity": case "step10.adversity":
if (item.data.data.peculiarity_type !== "adversity") { if (item.data.data.peculiarity_type !== "adversity") {
console.warn("Wrong type", item.data.data.peculiarity_type);
return; return;
} }
break; break;
case "step11.passion": case "step11.passion":
if (item.data.data.peculiarity_type !== "passion") { if (item.data.data.peculiarity_type !== "passion") {
console.warn("Wrong type", item.data.data.peculiarity_type);
return; return;
} }
break; break;
case "step12.anxiety": case "step12.anxiety":
if (item.data.data.peculiarity_type !== "anxiety") { if (item.data.data.peculiarity_type !== "anxiety") {
console.warn("Wrong type", item.data.data.peculiarity_type);
return; return;
} }
break; break;
case "step13.advantage": case "step13.advantage":
if (!["distinction", "passion"].includes(item.data.data.peculiarity_type)) { if (!["distinction", "passion"].includes(item.data.data.peculiarity_type)) {
console.warn("Wrong type", item.data.data.peculiarity_type);
return; return;
} }
break; break;
case "step13.disadvantage": case "step13.disadvantage":
if (!["adversity", "anxiety"].includes(item.data.data.peculiarity_type)) { if (!["adversity", "anxiety"].includes(item.data.data.peculiarity_type)) {
console.warn("Wrong type", item.data.data.peculiarity_type);
return; return;
} }
break; break;
@@ -287,7 +293,7 @@ export class TwentyQuestionsDialog extends FormApplication {
// Store this form datas in actor // Store this form datas in actor
this.actor.data.data.twenty_questions = this.object.data; this.actor.data.data.twenty_questions = this.object.data;
this.actor.update({ await this.actor.update({
data: { data: {
twenty_questions: this.object.data, twenty_questions: this.object.data,
}, },

View File

@@ -282,7 +282,7 @@ export class TwentyQuestions {
// Update actor // Update actor
await actor.update({ await actor.update({
name: (formData.step2.family + " " + formData.step19.firstname).trim(), name: (formData.step2.family + " " + formData.step19.firstname).trim(),
data: actor.data.data, data: actorDatas,
}); });
} }