Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP feat: move to v13 #1667

Open
wants to merge 202 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
14aa2e1
fix: get GM control buttons working in v13
marvin9257 Oct 17, 2024
777120c
fix: need to check if active
marvin9257 Oct 17, 2024
1043c31
fix: renderChatLog hook uses htmlElement and not html
marvin9257 Oct 17, 2024
22835a3
fix: renderChatHTML hook changed
marvin9257 Oct 17, 2024
b4dbece
fix: damage message update
marvin9257 Oct 17, 2024
b5e8c73
fix: remove overall flex
marvin9257 Oct 17, 2024
cb3ef32
fix: change measuredTemplate reference
marvin9257 Oct 18, 2024
eb136ff
fix: stop overwriting itemTypes.skills
marvin9257 Oct 18, 2024
b9b155e
fix: make npc characteristics area higher
marvin9257 Oct 18, 2024
e86a9da
fix: flavor table style fix
marvin9257 Oct 19, 2024
71ace92
fix: setup custom pause image
marvin9257 Oct 19, 2024
5022e6e
fix: more style changes for request roll
marvin9257 Oct 19, 2024
953c10f
fix: cleanup requestRoll dialog setup
marvin9257 Oct 19, 2024
f6fd76f
fix: scrollbar track colors
marvin9257 Oct 19, 2024
488b4cc
fix: stat table header border
marvin9257 Oct 19, 2024
60ce999
fix: tab padding and borders
marvin9257 Oct 19, 2024
f1b3550
Fix: update min compatibility version
marvin9257 Oct 19, 2024
6731fa8
fix: move initiative roll to DialogV2
marvin9257 Oct 19, 2024
f120fd5
fix: move to DialogV2 for skill select with chain and contested rolls
marvin9257 Oct 19, 2024
028c479
fix: clean up effectDM for damage rolls
marvin9257 Oct 19, 2024
5abb79f
fix: style fixes misc
marvin9257 Oct 19, 2024
2efe2b3
fix: more style fixes
marvin9257 Oct 20, 2024
ad75378
fix: css error
marvin9257 Oct 20, 2024
3c159f2
fix: and another css issue
marvin9257 Oct 20, 2024
2fd50de
fix: move item transfer dialog to V2
marvin9257 Oct 20, 2024
e366e3e
fix: convert roll formula validate to DialogV2
marvin9257 Oct 21, 2024
8c83680
fix: move roll setting dialog to DialogV2
marvin9257 Oct 21, 2024
64085a9
fix: need to wrap with div standard-form
marvin9257 Oct 21, 2024
9ede4cf
fix: consumable dialog to DialogV2
marvin9257 Oct 21, 2024
5b52107
fix: try to set format correctly
marvin9257 Oct 21, 2024
680d9ba
fix: move ROF dialogs to DialogV2
marvin9257 Oct 21, 2024
ce60837
fix: convert damage dialog to DialogV2
marvin9257 Oct 22, 2024
c3de0ef
fix: add card titles for popouts
marvin9257 Oct 22, 2024
c755cc1
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Oct 22, 2024
84aea92
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Oct 23, 2024
6707d6b
fix: style fixes
marvin9257 Oct 23, 2024
72446ea
fix: ship sheet style changes
marvin9257 Oct 23, 2024
c381ee5
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Oct 28, 2024
017ae5e
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Nov 5, 2024
a4d558a
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Nov 9, 2024
7e41c62
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Nov 18, 2024
9b5135c
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Nov 19, 2024
00fc31c
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Nov 20, 2024
0de0cae
fix: npc icons and form font weight
marvin9257 Nov 21, 2024
fd71ab3
fix: dialog labels should't wrap inputs
marvin9257 Nov 21, 2024
07c4330
fix: padding on dialogs fieldsets
marvin9257 Nov 21, 2024
6557130
fix: flavor layout and spacing
marvin9257 Nov 21, 2024
4592288
fix: more style changes
marvin9257 Nov 21, 2024
f1c4973
fix: add border to flavor-table
marvin9257 Nov 22, 2024
0b89957
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Nov 22, 2024
4c6c041
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Nov 26, 2024
c40da7b
fix: update colorScheme setting
marvin9257 Nov 26, 2024
bcd6f23
fix: move ruleset change Dialog to V2 and localize
marvin9257 Nov 27, 2024
615f89c
fix: warning when disabling untrained
marvin9257 Nov 28, 2024
d7d2668
fix: refactor delete item and move to DialogV2
marvin9257 Nov 29, 2024
f3edb45
fix: migrate delete AE to DialogV2
marvin9257 Nov 29, 2024
a4df284
fix: AE sheet render to V2 and fix grid
marvin9257 Nov 29, 2024
27df8f7
fix: update delete effect warning to DialogV2
marvin9257 Nov 29, 2024
1aec0b0
fix: delete confirmation of consumable from item
marvin9257 Nov 29, 2024
f9711a3
fix: Delete ship position confirm to DialogV2
marvin9257 Nov 29, 2024
cc742d2
fix: migrate confirm macro replace to DialogV2
marvin9257 Nov 29, 2024
38e5850
fix: fix roll enrichers
marvin9257 Nov 30, 2024
86c18ca
fix: remove unneeded code
marvin9257 Dec 1, 2024
5bdc72a
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Dec 4, 2024
fa360d6
fix: update package-lock
marvin9257 Dec 4, 2024
1e9bd03
fix: menu h2 border
marvin9257 Dec 4, 2024
be45acf
fix: effects list style for FVTT default
marvin9257 Dec 4, 2024
1c49f9f
fix: remove preset width for Effect Dialog edit
marvin9257 Dec 5, 2024
9d1daf0
fix: refactor item sheet getData
marvin9257 Dec 6, 2024
830d114
fix: misc cleanup
marvin9257 Dec 7, 2024
364257d
fix: initial itemV2 no tabs
marvin9257 Dec 7, 2024
e79aca8
fix: add drag-drop handlers
marvin9257 Dec 8, 2024
615e86e
fix: some styling and add y scroll
marvin9257 Dec 8, 2024
f70b179
Update footer.html
marvin9257 Dec 8, 2024
ff8c8df
fix: this.object now this.document
marvin9257 Dec 8, 2024
9cc586f
fix: improve drag drop for item sheet
marvin9257 Dec 9, 2024
5a5c439
fix: deep scan error
marvin9257 Dec 9, 2024
81c8a8d
refactor: use prosemirror rather than contenteditable for descriptions
marvin9257 Dec 9, 2024
60a1d36
refactor: item sheet listeners to V2 format
marvin9257 Dec 11, 2024
cb098aa
fix: some commenting clarification
marvin9257 Dec 11, 2024
864cbed
fix: re add content editable handling -just in case
marvin9257 Dec 11, 2024
2624401
fix: move from jQuery to htmlElement for handleContentEditable
marvin9257 Dec 11, 2024
44bbdaf
fix: now use _configureRenderParts to select item sheet
marvin9257 Dec 12, 2024
c006a6c
refactor: move core drag-drop code to abstract sheet
marvin9257 Dec 12, 2024
f5103a0
fix: broader def of can drag/drop
marvin9257 Dec 12, 2024
7c254f1
fix: clean-up
marvin9257 Dec 12, 2024
56fb951
fix: add drop stubs to AbstractItemSheet
marvin9257 Dec 12, 2024
e83201c
fix: get tabs working on weapon sheet
marvin9257 Dec 13, 2024
a0727f1
fix: cleanup skill callback
marvin9257 Dec 16, 2024
c86d6fb
fix: no longer need tabs definition in DEFAULT
marvin9257 Dec 16, 2024
8d114a4
fix: make tabs a partial
marvin9257 Dec 16, 2024
4bccb2c
fix: fix some clashes with event being a variable
marvin9257 Dec 16, 2024
e470bae
fix: add tabs for ship components
marvin9257 Dec 16, 2024
cfa9503
fix: weapon sheet scroll bar
marvin9257 Dec 16, 2024
b7d95d2
fix: remove from parent item when changing consumable to another type
marvin9257 Dec 17, 2024
d0df252
fix: remove unnecessary item-sheet div from item sheets
marvin9257 Dec 17, 2024
63778f0
fix: move ship position sheet to ItemV2
marvin9257 Dec 17, 2024
dee76b2
fix: add item sheet icons
marvin9257 Dec 18, 2024
9aff66c
fix: initial appV2 for advancedSettings
marvin9257 Dec 19, 2024
a72dcd4
fix: move remaining settings forms to ApplicationV2
marvin9257 Dec 19, 2024
eeccc95
fix: add a few more icons to dialogs
marvin9257 Dec 19, 2024
7e8b1dd
Delete renderActorSheet.ts
marvin9257 Dec 20, 2024
54808e5
fix: item sheet style improvements
marvin9257 Dec 20, 2024
d552dcd
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Dec 20, 2024
cc3f054
fix: item sidebar revised partial update for V2
marvin9257 Dec 20, 2024
e3821de
fix: missing position icon and editImage action
marvin9257 Dec 20, 2024
a89b5eb
fix: missing icon and edit image action
marvin9257 Dec 20, 2024
0a0898b
fix: compendium -> inCompendium
marvin9257 Dec 21, 2024
65af0e4
fix: monkeypatch chat context
marvin9257 Dec 21, 2024
f8df1c9
Update twodsix.css
marvin9257 Dec 21, 2024
b950a20
fix: update to new navigation-tabs partial
marvin9257 Dec 21, 2024
fbfce8f
refactor: move chat actions and context menu extended ChatLog
marvin9257 Dec 22, 2024
5e0650d
refactor: to include chat popouts for extending chat messages
marvin9257 Dec 22, 2024
7c64e3d
fix: streamline _getEntryContext
marvin9257 Dec 22, 2024
1bf0e14
fix: add expandRoll to pop out messages
marvin9257 Dec 23, 2024
d15f88c
fix: _onRender is async and tabs.tabName.cssClass
marvin9257 Dec 24, 2024
6bcdbd6
fix: allow action image to be redefined
marvin9257 Dec 25, 2024
ea0a1aa
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Dec 26, 2024
2dae669
fix: make position actor image open actor sheet
marvin9257 Dec 27, 2024
e5ba813
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Dec 27, 2024
4befea3
fix: convert abstract and animal sheet to V2
marvin9257 Dec 31, 2024
2a86186
fix: itemEdit action
marvin9257 Dec 31, 2024
11c47a4
fix: add image edit action
marvin9257 Dec 31, 2024
3b6a366
fix: item-create action to itemCreate
marvin9257 Dec 31, 2024
06c649f
fix: move robot sheet to V2
marvin9257 Dec 31, 2024
e4ad8ca
fix: force draggable on animal and actor sheets
marvin9257 Dec 31, 2024
6e4f64e
fix: configure drag-drop for non-GM's
marvin9257 Dec 31, 2024
0e5ca7d
fix: create DragDrop objects using core and legacy dragDrop definition
marvin9257 Jan 1, 2025
c78644a
fix: updates to Active Effects
marvin9257 Jan 2, 2025
b21a531
fix: vehicle sheet to ActorSheetV2
marvin9257 Jan 2, 2025
bedacfd
fix: move performAttack to action
marvin9257 Jan 2, 2025
ca1da9b
fix: refactor skilTalentRoll to action
marvin9257 Jan 3, 2025
5a74552
fix: refactor rollable-characteristic to action
marvin9257 Jan 3, 2025
47b03c4
fix: edit comments
marvin9257 Jan 3, 2025
4a7b553
fix: refactor roll-damage to action
marvin9257 Jan 3, 2025
4f3d5aa
fix: don't use event as variable / parameter
marvin9257 Jan 3, 2025
6063e2d
fix: refactor item-value-edit listeners
marvin9257 Jan 3, 2025
05ae1d7
fix: refactor last of AbstractActorSheet from JQuery to DOM
marvin9257 Jan 3, 2025
5157b38
fix: refactor space-object sheet to ActorSheetV2
marvin9257 Jan 4, 2025
014a6a5
fix: delete duplicate context reference
marvin9257 Jan 4, 2025
abdc950
fix: use partial for reference
marvin9257 Jan 4, 2025
8fdadde
fix: fvtt default style clean-up
marvin9257 Jan 4, 2025
617911c
fix: change renderChatHTML code from JQuery to DOM
marvin9257 Jan 4, 2025
ef8550a
fix: try to avoid safety issue
marvin9257 Jan 4, 2025
d83b812
fix: revert to JQuery to avoid async
marvin9257 Jan 4, 2025
eed8162
fix: back to async method
marvin9257 Jan 4, 2025
934019f
fix: refactor message hook to change text rather than inject html
marvin9257 Jan 6, 2025
964e367
fix: work with data copy when mutating and creating dropped item
marvin9257 Jan 7, 2025
27b02aa
fix: deepscan issue
marvin9257 Jan 7, 2025
973bdf1
fix: multiple changes
marvin9257 Jan 8, 2025
fb736c4
fix: deepscan issue
marvin9257 Jan 8, 2025
59884ab
fix: drag-drop selector for animal and robot sheets
marvin9257 Jan 8, 2025
7166f8c
fix: traveller sheet style fixes for new SheetV2 header
marvin9257 Jan 8, 2025
ec63c4f
fix: get tabs working on traveller sheet
marvin9257 Jan 8, 2025
5b7936e
fix: adjust effect actions for new blank
marvin9257 Jan 8, 2025
aa53734
fix: consumable / attachment adds from traveller sheet
marvin9257 Jan 8, 2025
e8a5b54
fix: add ability to select an new actor image
marvin9257 Jan 8, 2025
e51c81b
refactor: move from {{editor to <prose-mirror on traveller sheet
marvin9257 Jan 9, 2025
80317b0
refactor: use core dragdrop object rather than a custom one
marvin9257 Jan 9, 2025
fb8f0db
fix: refactor correct _onDrop handling to AbstractItemSheet
marvin9257 Jan 9, 2025
43da36a
fix: item tabs displayed and checkbox backgrounds
marvin9257 Jan 9, 2025
701df3d
refactor: initial ship sheet
marvin9257 Jan 9, 2025
e70b303
refactor: move ship listeners to actions
marvin9257 Jan 10, 2025
b62d8f3
fix: add id's for sheet options
marvin9257 Jan 10, 2025
86f4446
fix: refactor battlesheet to ActorV2
marvin9257 Jan 10, 2025
1ba32a6
fix: deepscan issue
marvin9257 Jan 10, 2025
c567d3d
fix: style and selector fixes
marvin9257 Jan 10, 2025
baa8ce4
fix: refactor joat calcs to abstract sheet
marvin9257 Jan 11, 2025
5113b8d
fix: try to align stats tables
marvin9257 Jan 11, 2025
23ed961
fix: ship action backgrounds
marvin9257 Jan 11, 2025
f6dfb79
fix: use prosemirror tab on ship sheets
marvin9257 Jan 11, 2025
117a396
fix: style fixes
marvin9257 Jan 12, 2025
1ebecbb
fix: clean-up actor image alignment
marvin9257 Jan 12, 2025
ace5471
fix: adjust standard form
marvin9257 Jan 12, 2025
d47bf78
fix: misc typos and missing/incorrect actions fixes
marvin9257 Jan 13, 2025
9f13b55
fix: consumable toggling and layout
marvin9257 Jan 14, 2025
f884ccc
fix: add a setting for the default weapon damage formula
marvin9257 Jan 14, 2025
afcdd9f
fix: can't use id in sheet default options
marvin9257 Jan 14, 2025
065693d
fix: drag drop duplication issue for consumables on same actor
marvin9257 Jan 15, 2025
775f658
fix: auto mode dialog not working for NPC sheet
marvin9257 Jan 16, 2025
0b8bfef
fix: move from JQuery to DOM for settings interface
marvin9257 Jan 16, 2025
4e2b81d
fix: render(true) is now render({force:true})
marvin9257 Jan 17, 2025
b09f9a9
fix: make string value formally parseInt
marvin9257 Jan 17, 2025
32b2789
fix : check for JQuery element on render settings config hook
marvin9257 Jan 17, 2025
3057013
fix: refactor Roll Settings Dialog to DOM from JQuery
marvin9257 Jan 18, 2025
69b6b4d
fix: missing null check
marvin9257 Jan 18, 2025
a2cf1e8
refactor: remove showConsumableList and showAttachmentList settings
marvin9257 Jan 19, 2025
2edfc8b
fix: cleanup traveller sheet hbs
marvin9257 Jan 20, 2025
8fe47c6
feat: refactor AP to a string and allow formulas
marvin9257 Jan 20, 2025
32d0994
feat: allow dragging and dropping of AE's to travellers
marvin9257 Jan 20, 2025
e0c2fee
fix: add default missing to be zero for select replaceFormulaData
marvin9257 Jan 21, 2025
9df7f62
fix: drag drop to work with items and AE's
marvin9257 Jan 21, 2025
09b8d8b
refactor: allow AE's to be dropped on tokens
marvin9257 Jan 21, 2025
c24eb79
refactor: leverage internal localization for ui.notifications
marvin9257 Jan 21, 2025
734c1bb
refactor: move sheetUtils from JQuery to DOM
marvin9257 Jan 21, 2025
b126541
refactor: request roll from JQuery to DOM
marvin9257 Jan 21, 2025
e73746b
Merge remote-tracking branch 'upstream/master' into move-to-DialogV2
marvin9257 Jan 22, 2025
71030f1
fix: simplify chat context calcs
marvin9257 Jan 22, 2025
478888f
refactor: move initiative roll dialog from JQuery to DOM
marvin9257 Jan 22, 2025
0745408
fix: get rid of newItem check since it doesn't seem to do anything
marvin9257 Jan 22, 2025
c8670d0
fix: get rid of legacy code that adds "draggable" attribute
marvin9257 Jan 22, 2025
ed96a13
refactor: delete unused chat card hooks
marvin9257 Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,307 changes: 654 additions & 653 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"last 3 versions"
],
"dependencies": {
"@league-of-foundry-developers/foundry-vtt-types": "github:League-of-Foundry-Developers/foundry-vtt-types#2315d2385e256f8e7011667683f0859f1f769fdf"
"@league-of-foundry-developers/foundry-vtt-types": "github:League-of-Foundry-Developers/foundry-vtt-types#2315d2385e256f8e7011667683f0859f1f769fdf",
"latest-version": "^9.0.0"
}
}
25 changes: 25 additions & 0 deletions src/migrations/2025_01_20_09_11_refactor_armorPiercing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck This turns off *all* typechecking, make sure to remove this once foundry-vtt-types are updated to cover v10.
import { applyToAllItems, applyToAllActors } from "../module/utils/migration-utils";

async function refactorArmorPiercing(item: TwodsixItem): Promise<void> {
if (foundry.utils.hasProperty(item.system, 'armorPiercing')) {
if (typeof item.system.armorPiercing === 'number') {
const newString = item.system.armorPiercing === 0 ? "0" : item.system.armorPiercing.toString();
await item.update({'system.armorPiercing': newString});
}
}
}

async function refactorItems (actor:TwodsixActor): Promise<void> {
for (const item of actor.items) {
await refactorArmorPiercing(item);
}
}

export async function migrate(): Promise<void> {
await applyToAllItems(refactorArmorPiercing);
await applyToAllActors(refactorItems);
console.log("Armor Piercing Migration Complete");
return Promise.resolve();
}
14 changes: 14 additions & 0 deletions src/module/data/commonSchemaUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,17 @@ export function migrateStringToNumber(source:any, field:string):void {
}
}
}

/**
* Convert field from number to string.
* @param {any} source data source (document.system)
* @param {string} field system field to convert.
* @returns {void}
*/
export function migrateNumberToString(source:any, field:string):void {
if ( Object.hasOwn(source, field)) {
if ( typeof source[field] !== 'string') {
source[field] = source[field].toString() || "0";
}
}
}
23 changes: 19 additions & 4 deletions src/module/data/item.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck This turns off *all* typechecking, make sure to remove this once foundry-vtt-types are updated to cover v10.
import { makeResourceField, makeValueField, migrateStringToNumber} from "./commonSchemaUtils";
import { makeResourceField, makeValueField, migrateNumberToString, migrateStringToNumber} from "./commonSchemaUtils";
import { GearData, makeTargetTemplate, TwodsixItemBaseData } from "./item-base";

const fields = foundry.data.fields;
Expand All @@ -25,7 +25,7 @@ export class WeaponData extends GearData {
schema.doubleTap = new fields.BooleanField({ required: true, initial: false});
schema.recoil = new fields.BooleanField({ required: true, initial: false});
schema.features = new fields.StringField({...requiredBlankString});
schema.armorPiercing = new fields.NumberField({...requiredInteger, initial: 0});
schema.armorPiercing = new fields.StringField({required: true, blank: false, initial: "0" });
schema.parryAV = new fields.NumberField({...requiredInteger, initial: 0});
schema.isShield = new fields.BooleanField({ required: true, initial: false});
schema.handlingModifiers = new fields.StringField({...requiredBlankString});
Expand Down Expand Up @@ -61,6 +61,11 @@ export class WeaponData extends GearData {
source.ammo = 0;
}
}
if ("armorPiercing" in source) {
if (typeof source.armorPiercing !== 'string') {
migrateNumberToString(source, 'armorPiercing');
}
}
return super.migrateData(source);
}
}
Expand Down Expand Up @@ -153,7 +158,7 @@ export class ConsumableData extends GearData {
schema.currentCount = new fields.NumberField({...requiredInteger, initial: 1});
schema.max = new fields.NumberField({...requiredInteger, initial: 0});
schema.subtype = new fields.StringField({required: true, blank: false, initial: "other" });
schema.armorPiercing = new fields.NumberField({...requiredInteger, initial: 0});
schema.armorPiercing = new fields.StringField({required: true, blank: false, initial: "0" });
schema.bonusDamage = new fields.StringField({...requiredBlankString});
schema.ammoRangeModifier = new fields.StringField({required: true, blank: false, initial: "0" });
schema.isAttachment = new fields.BooleanField({ required: true, initial: false});
Expand All @@ -171,6 +176,11 @@ export class ConsumableData extends GearData {
source.ammoRangeModifier = "0";
}
}
if ("armorPiercing" in source) {
if (typeof source.armorPiercing !== 'string') {
migrateNumberToString(source, 'armorPiercing');
}
}
return super.migrateData(source);
}
}
Expand Down Expand Up @@ -199,7 +209,7 @@ export class ComponentData extends GearData {
schema.isBaseHull = new fields.BooleanField({ required: true, initial: false});
schema.rollModifier = new fields.StringField({...requiredBlankString});
schema.rateOfFire = new fields.StringField({...requiredBlankString});
schema.armorPiercing = new fields.NumberField({...requiredInteger, initial: 0});
schema.armorPiercing = new fields.StringField({required: true, blank: false, initial: "0" });
schema.actorLink = new fields.StringField({...requiredBlankString});
schema.hardened = new fields.BooleanField({ required: true, initial: false});
schema.ammunition = makeResourceField(0, 0);
Expand All @@ -212,6 +222,11 @@ export class ComponentData extends GearData {
if ("purchasePrice" in source) {
migrateStringToNumber(source, "purchasePrice");
}
if ("armorPiercing" in source) {
if (typeof source.armorPiercing !== 'string') {
migrateNumberToString(source, 'armorPiercing');
}
}
return super.migrateData(source);
}
}
Expand Down
22 changes: 14 additions & 8 deletions src/module/entities/TwodsixActiveEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ export class TwodsixActiveEffect extends ActiveEffect {
*/
async _onCreate(data: object, options: object, userId: string):void {
await super._onCreate(data, options, userId);
if(game.userId === userId && this.parent?.type === 'traveller') {
if (game.userId === userId && this.parent?.type === 'traveller') {
await checkEncumbranceStatus(this);
}
// A hack to fix a bug in v13
if (data.changes?.length === 0) {
data.changes.push({});
}
}

/**
Expand Down Expand Up @@ -101,13 +105,15 @@ async function checkEncumbranceStatus (activeEffect:TwodsixActiveEffect):void {
function changesEncumbranceStat(activeEffect:TwodsixActiveEffect):boolean {
if (activeEffect.changes.length > 0) {
for (const change of activeEffect.changes) {
if (change.key.includes('system.characteristics.strength.value') ||
change.key.includes('system.characteristics.strength.current') ||
change.key.includes('system.characteristics.strength.mod') ||
(change.key.includes('system.characteristics.endurance.value') && ['CEATOM', "BARBARIC"].includes(game.settings.get('twodsix', 'ruleset'))) ||
change.key.includes('system.encumbrance.max') ||
change.key.includes('system.encumbrance.value')) {
return true;
if (change.key){
if (change.key.includes('system.characteristics.strength.value') ||
change.key.includes('system.characteristics.strength.current') ||
change.key.includes('system.characteristics.strength.mod') ||
(change.key.includes('system.characteristics.endurance.value') && ['CEATOM', "BARBARIC"].includes(game.settings.get('twodsix', 'ruleset'))) ||
change.key.includes('system.encumbrance.max') ||
change.key.includes('system.encumbrance.value')) {
return true;
}
}
}
}
Expand Down
Loading
Loading