Remove migration changes and abandon support
This commit is contained in:
parent
1a1cc758f2
commit
4268937ed1
@ -1,5 +1,3 @@
|
|||||||
import { CURRENT_VERSION, versions } from '../constants/versions.mjs';
|
|
||||||
|
|
||||||
const { HTMLField, SchemaField, NumberField, StringField, BooleanField, FilePathField, ArrayField } = foundry.data.fields;
|
const { HTMLField, SchemaField, NumberField, StringField, BooleanField, FilePathField, ArrayField } = foundry.data.fields;
|
||||||
|
|
||||||
export const CARD_ZONES = {
|
export const CARD_ZONES = {
|
||||||
@ -13,20 +11,12 @@ export const CARD_ZONES = {
|
|||||||
export class HenchCardDataModel extends foundry.abstract.TypeDataModel {
|
export class HenchCardDataModel extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
version: new StringField({ required: true, blank: true, initial: CURRENT_VERSION, options: versions }),
|
|
||||||
cue: new StringField({required: true, blank: true, initial: ""}),
|
cue: new StringField({required: true, blank: true, initial: ""}),
|
||||||
zone: new StringField({required: true, blank: false, initial: CARD_ZONES.DECK, options: CARD_ZONES}),
|
zone: new StringField({required: true, blank: false, initial: CARD_ZONES.DECK, options: CARD_ZONES}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static migrateData(source) {
|
static migrateData(source) {
|
||||||
// Draft 0 -> Draft 1
|
|
||||||
if(!source.version || source.version === versions.DRAFT_0) {
|
|
||||||
// Changes
|
|
||||||
|
|
||||||
source.version = versions.DRAFT_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.migrateData(source);
|
return super.migrateData(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import { CURRENT_VERSION, versions } from '../constants/versions.mjs';
|
|
||||||
|
|
||||||
import { CARD_ZONES } from "./hench-card.mjs";
|
import { CARD_ZONES } from "./hench-card.mjs";
|
||||||
|
|
||||||
const { StringField } = foundry.data.fields;
|
const { StringField } = foundry.data.fields;
|
||||||
@ -7,19 +5,10 @@ const { StringField } = foundry.data.fields;
|
|||||||
// Data Model
|
// Data Model
|
||||||
export class HenchCardsDataModel extends foundry.abstract.TypeDataModel {
|
export class HenchCardsDataModel extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {};
|
||||||
version: new StringField({ required: true, blank: true, initial: CURRENT_VERSION, options: versions }),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static migrateData(source) {
|
static migrateData(source) {
|
||||||
// Draft 0 -> Draft 1
|
|
||||||
if(!source.version || source.version === versions.DRAFT_0) {
|
|
||||||
// Changes
|
|
||||||
|
|
||||||
source.version = versions.DRAFT_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.migrateData(source);
|
return super.migrateData(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
export const versions = {
|
|
||||||
DRAFT_0: "0",
|
|
||||||
DRAFT_1: "1",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const CURRENT_VERSION = versions.DRAFT_1;
|
|
@ -2,7 +2,6 @@ const { HTMLField, SchemaField, NumberField, StringField, BooleanField, FilePath
|
|||||||
|
|
||||||
import { getBossMutation, nullStorylineKey, storylineKeys } from './boss.mjs';
|
import { getBossMutation, nullStorylineKey, storylineKeys } from './boss.mjs';
|
||||||
import { nullPlaybookKey, playbookKeys, lookupPlaybook, getPlaybookMutation } from './playbooks.mjs';
|
import { nullPlaybookKey, playbookKeys, lookupPlaybook, getPlaybookMutation } from './playbooks.mjs';
|
||||||
import { CURRENT_VERSION, versions } from './constants/versions.mjs';
|
|
||||||
|
|
||||||
const textField = () => new StringField({ required: true, blank: true });
|
const textField = () => new StringField({ required: true, blank: true });
|
||||||
|
|
||||||
@ -42,7 +41,6 @@ const nullPlaybook = lookupPlaybook(nullPlaybookKey);
|
|||||||
export class HenchDataModel extends foundry.abstract.TypeDataModel {
|
export class HenchDataModel extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
version: new StringField({ required: true, blank: true, initial: CURRENT_VERSION, options: versions }),
|
|
||||||
look: textField(),
|
look: textField(),
|
||||||
details: cappedArrayField(promptField(), 2),
|
details: cappedArrayField(promptField(), 2),
|
||||||
fixedInclinations: cappedArrayField(textField(), 2),
|
fixedInclinations: cappedArrayField(textField(), 2),
|
||||||
@ -74,90 +72,14 @@ export class HenchDataModel extends foundry.abstract.TypeDataModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static migrateData(source) {
|
static migrateData(source) {
|
||||||
// Draft 0 -> Draft 1
|
// New stress cap
|
||||||
if(!source.version || source.version === versions.DRAFT_0) {
|
if(source.stress) {
|
||||||
source = this.migrateFromDraft0(source);
|
source.stress = Math.min(source.stress, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.migrateData(source);
|
return super.migrateData(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
static migrateFromDraft0(source) {
|
|
||||||
// Update stress cap.
|
|
||||||
if(source.stress > 8) {
|
|
||||||
source.stress = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add exp trigger.
|
|
||||||
source.experienceTriggers.splice(2, 0, {
|
|
||||||
marked: false,
|
|
||||||
description: "You got on the boss's nerves.",
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update playbooks details
|
|
||||||
var playbook = lookupPlaybook(source.playbook);
|
|
||||||
switch(source.playbook) {
|
|
||||||
case "SUPERFAN":
|
|
||||||
// Change first detail. Wipe response.
|
|
||||||
source.details[0] = playbook.details[0];
|
|
||||||
|
|
||||||
// Update forum lurker move description
|
|
||||||
source.moves[4].description = playbook.moves[4].description;
|
|
||||||
break;
|
|
||||||
case "BADASS":
|
|
||||||
// Change first detail. Wipe response
|
|
||||||
source.details[0] = playbook.details[0];
|
|
||||||
|
|
||||||
// Change 3rd mission planning question
|
|
||||||
source.missionPlanning[2] = playbook.missionPlanningQuestions[2];
|
|
||||||
|
|
||||||
// Update prep ability
|
|
||||||
source.moves[4].description = playbook.moves[4].description;
|
|
||||||
break;
|
|
||||||
case "LABMAN":
|
|
||||||
// Rename playbook
|
|
||||||
source.playbook = "INVENTOR";
|
|
||||||
// Grab based on new name
|
|
||||||
playbook = lookupPlaybook(source.playbook);
|
|
||||||
|
|
||||||
// Change first gear item
|
|
||||||
source.fixedGear[5].description = playbook.gear[0].description;
|
|
||||||
|
|
||||||
// Update prep ability
|
|
||||||
source.moves[4].description = playbook.moves[4].description;
|
|
||||||
break;
|
|
||||||
case "DEMOTED":
|
|
||||||
// Change mission planning question
|
|
||||||
source.missionPlanning[0] = playbook.missionPlanningQuestions[0];
|
|
||||||
|
|
||||||
// Update prep ability
|
|
||||||
source.moves[4].description = playbook.moves[4].description;
|
|
||||||
break;
|
|
||||||
case "OUTCAST":
|
|
||||||
// Update prep ability
|
|
||||||
source.moves[4].description = playbook.moves[4].description;
|
|
||||||
break;
|
|
||||||
case "USURPER":
|
|
||||||
// Update prep ability
|
|
||||||
source.moves[4].description = playbook.moves[4].description;
|
|
||||||
break;
|
|
||||||
case "TIMECARD":
|
|
||||||
// Update gear
|
|
||||||
source.fixedGear[8].description = playbook.gear[3].description;
|
|
||||||
|
|
||||||
// Update prep ability
|
|
||||||
source.moves[4].name = playbook.moves[4].name;
|
|
||||||
source.moves[4].description = playbook.moves[4].description;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
source.version = versions.DRAFT_1;
|
|
||||||
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
async _preCreate(data, options, user) {
|
async _preCreate(data, options, user) {
|
||||||
await super._preCreate(data, options, user);
|
await super._preCreate(data, options, user);
|
||||||
@ -197,7 +119,6 @@ export class HenchDataModel extends foundry.abstract.TypeDataModel {
|
|||||||
export class BossDataModel extends foundry.abstract.TypeDataModel {
|
export class BossDataModel extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
version: new StringField({ required: true, blank: true, initial: CURRENT_VERSION, options: versions }),
|
|
||||||
look: textField(),
|
look: textField(),
|
||||||
details: cappedArrayField(promptField(), 4),
|
details: cappedArrayField(promptField(), 4),
|
||||||
storyline: new StringField({ required: true, blank: false, initial: nullStorylineKey, options: storylineKeys}),
|
storyline: new StringField({ required: true, blank: false, initial: nullStorylineKey, options: storylineKeys}),
|
||||||
@ -212,12 +133,6 @@ export class BossDataModel extends foundry.abstract.TypeDataModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static migrateData(source) {
|
static migrateData(source) {
|
||||||
if(!source.version || source.version === versions.DRAFT_0) {
|
|
||||||
// Changes
|
|
||||||
|
|
||||||
source.version = versions.DRAFT_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.migrateData(source);
|
return super.migrateData(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user