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 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 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
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
80 changes: 65 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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"
}
}
79 changes: 39 additions & 40 deletions src/module/entities/TwodsixActor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,8 @@ export default class TwodsixActor extends Actor {
await matching.update({"system.value": updateValue});
return false;
}
const addedSkill = (await (<ActorSheet>this.sheet)._onDropItemCreate(foundry.utils.duplicate(skillData)))[0];
//const addedSkill = (await this.createEmbeddedDocuments("Item", [foundry.utils.duplicate(skillData)]))[0];

const addedSkill = (await this.createEmbeddedDocuments("Item", [foundry.utils.duplicate(skillData)]))[0];
if (addedSkill.system.value < 0 || !addedSkill.system.value) {
if (!game.settings.get('twodsix', 'hideUntrainedSkills')) {
const skillValue = CONFIG.Item.dataModels.skills.schema.getInitialValue().value ?? -3;
Expand All @@ -992,33 +992,24 @@ export default class TwodsixActor extends Actor {
return false;
}

let transferData = {};
//Need to catch because Monk's enhanced Journal drops item data not TwodsixItem
try {
transferData = itemData.toJSON();
} catch(err) {
console.log(`Try importing as direct data ${err}`);
transferData = itemData;
}
let numberToMove = itemData.system?.quantity ?? 1;

const originalItem:TwodsixItem = await fromUuid(itemData.uuid);
//Handle moving items from another actor if enabled by settings
if (itemData.actor && game.settings.get("twodsix", "transferDroppedItems")) {
const sourceActor = itemData.actor; //fix
if (originalItem.actor && game.settings.get("twodsix", "transferDroppedItems")) {
if (itemData.system.quantity > 1) {
numberToMove = await getMoveNumber(itemData);
if (numberToMove >= itemData.system.quantity) {
await itemData.update({"system.equipped": "ship"});
await originalItem.update({"system.equipped": "ship"});
numberToMove = itemData.system.quantity;
await sourceActor.deleteEmbeddedDocuments("Item", [itemData.id]);
await originalItem.delete();
} else if (numberToMove === 0) {
return false;
} else {
await sourceActor.updateEmbeddedDocuments("Item", [{_id: itemData.id, 'system.quantity': (itemData.system.quantity - numberToMove)}]);
await originalItem.update({'system.quantity': (itemData.system.quantity - numberToMove)});
}
} else if (itemData.system.quantity === 1) {
await itemData.update({"system.equipped": "ship"});
await sourceActor.deleteEmbeddedDocuments("Item", [itemData.id]);
await originalItem.update({"system.equipped": "ship"});
await originalItem.delete();
} else {
return false;
}
Expand All @@ -1042,30 +1033,36 @@ export default class TwodsixActor extends Actor {
}

// Create the owned item
transferData.system.quantity = numberToMove;
transferData.system.equipped = "backpack";
delete transferData._id;
itemData.system.quantity = numberToMove;
itemData.system.equipped = "backpack";
if (Object.hasOwn(itemData, '_id')) {
delete itemData._id;
}
if (Object.hasOwn(itemData, 'uuid')){
delete itemData.uuid;
}

// Prepare effects
if ( transferData.effects?.length > 0) {
for (const effect of transferData.effects) {
if ( itemData.effects?.length > 0) {
for (const effect of itemData.effects) {
effect.disabled = false;
effect.transfer = game.settings.get('twodsix', "useItemActiveEffects");
}
}

//Link an actor skill with names defined by item.associatedSkillName
transferData.system.skill = this.getBestSkill(transferData.system.associatedSkillName, false)?.id ?? this.getUntrainedSkill()?.id;
itemData.system.skill = this.getBestSkill(itemData.system.associatedSkillName, false)?.id ?? this.getUntrainedSkill()?.id;

//Remove any attached consumables
transferData.system.consumables = [];
transferData.system.useConsumableForAttack = '';
itemData.system.consumables = [];
itemData.system.useConsumableForAttack = '';

//Create Item
const addedItem = (await this.createEmbeddedDocuments("Item", [transferData]))[0];
const addedItem = (await this.createEmbeddedDocuments("Item", [itemData]))[0];
if (game.settings.get('twodsix', 'useEncumbranceStatusIndicators') && this.type === 'traveller' && !TWODSIX.WeightlessItems.includes(addedItem.type)) {
await applyEncumberedEffect(this);
}
console.log(`Twodsix | Added Item ${itemData.name} to character`);
console.log(`Twodsix | Added Item ${addedItem.name} to character`);
return (!!addedItem);
}

Expand Down Expand Up @@ -1399,21 +1396,23 @@ function getEquipmentWeight(item:TwodsixItem):number {
*/
async function getMoveNumber(itemData:TwodsixItem): Promise <number> {
const returnNumber:number = await new Promise((resolve) => {
new Dialog({
title: game.i18n.localize("TWODSIX.Actor.Items.QuantityToTransfer"),
new foundry.applications.api.DialogV2({
window: {title: "TWODSIX.Actor.Items.QuantityToTransfer"},
content:
`<div style="display: flex; align-items: center; gap: 2ch; justify-content: center;"><img src="` + itemData.img + `" data-tooltip = "` + itemData.name +`" width="50" height="50"> ` + itemData.name + `</div>`+
`<div><label for='amount'>` + game.i18n.localize("TWODSIX.Actor.Items.Amount") + `<input type="number" name="amount" value="` +
itemData.system.quantity + `" max="` + itemData.system.quantity + `" min = "0"></input></label></div>`,
buttons: {
Transfer: {
label: `<i class="fa-solid fa-arrow-right-arrow-left"></i> ` + game.i18n.localize("TWODSIX.Actor.Items.Transfer"),
callback:
(html:JQuery) => {
resolve(html.find('[name="amount"]')[0]["value"]);
}
`<div><label for='amount'>` + game.i18n.localize("TWODSIX.Actor.Items.Amount") + `</label><input type="number" name="amount" value="` +
itemData.system.quantity + `" max="` + itemData.system.quantity + `" min = "0"></input></div>`,
buttons: [
{
action: "Transfer",
icon: "fa-solid fa-arrow-right-arrow-left",
label: "TWODSIX.Actor.Items.Transfer",
callback: (event, button, dialog) => {
const html:jQuery = $(dialog);
resolve(html.find('[name="amount"]')[0]["value"]);
}
}
},
],
default: `Transfer`
}).render(true);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
Hooks.on("renderPause", (app, html, options) => {
if (options.paused) {
// 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.

/**
* Extend the GamePause application to use custom banner.
* @extends {GamePause}
*/
export class TwodsixGamePause extends foundry.applications.ui.GamePause {
/** @override */
async _renderHTML(context, _options) {
const svgImage = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' preserveAspectRatio='xMidYMid meet' version='1.0' viewBox='0 0 300 300'%3E%3Cg fill='%2329aaff' stroke='none'%3E%3Cpath d='M1636 2943 c-37 -37 -54 -71 -75 -153 -14 -52 -73 -179 -97 -209 -7 -9 -173 99 -213 139 -100 99 -161 134 -161 93 0 -10 -11 -42 -25 -71 -28 -59 -31 -95 -14 -152 7 -21 9 -54 5 -73 l-7 -35 -50 19 c-99 38 -155 72 -225 139 -69 66 -108 89 -122 75 -16 -15 -4 -161 17 -225 13 -36 28 -91 36 -123 11 -52 11 -57 -4 -53 -9 2 -43 7 -76 10 -33 4 -103 20 -155 37 -80 26 -100 29 -124 20 -25 -10 -28 -15 -22 -42 15 -75 56 -154 97 -189 67 -56 119 -107 119 -116 0 -5 -98 -11 -218 -12 -119 -2 -219 -6 -221 -8 -2 -2 3 -12 12 -22 10 -10 17 -21 17 -25 0 -8 107 -109 167 -156 29 -23 59 -54 68 -71 l15 -29 -39 -21 c-58 -29 -207 -70 -257 -70 -23 0 -46 -5 -49 -11 -21 -33 154 -151 256 -173 15 -3 36 -14 49 -24 l22 -18 -84 -79 c-67 -65 -94 -84 -143 -100 -102 -34 -85 -62 70 -116 129 -45 176 -53 225 -39 19 5 36 8 38 5 2 -2 -6 -24 -18 -49 -22 -46 -111 -136 -135 -136 -6 0 -19 -8 -29 -19 -21 -23 -11 -33 67 -57 54 -17 60 -17 105 -1 44 16 132 23 144 12 21 -21 -58 -235 -107 -292 -19 -23 -35 -48 -35 -57 0 -22 40 -30 116 -23 53 4 79 13 143 50 43 25 94 52 115 61 58 24 58 32 -15 -232 -30 -111 -24 -116 82 -62 108 55 143 82 164 128 21 44 44 72 60 72 20 0 37 -78 46 -205 4 -66 8 -121 8 -122 4 -15 37 7 78 49 35 38 53 67 62 101 14 56 63 113 70 81 5 -26 34 -66 118 -161 40 -45 81 -96 91 -114 25 -46 38 -46 53 -2 7 21 30 74 52 118 25 49 42 97 43 124 6 89 26 94 75 19 29 -45 47 -59 123 -99 49 -26 93 -54 98 -63 13 -24 35 -19 40 9 3 13 3 78 1 142 -6 153 -1 162 76 133 78 -30 122 -55 160 -90 26 -24 36 -28 47 -19 8 6 11 15 9 20 -3 4 -8 80 -11 167 l-6 160 45 -9 c24 -4 66 -23 93 -41 44 -29 57 -33 130 -35 55 -1 87 2 99 11 17 12 12 20 -62 107 -99 116 -133 167 -133 197 0 28 6 30 105 36 44 2 105 12 135 21 30 9 76 22 102 28 l48 12 -54 33 c-30 17 -100 75 -156 129 l-102 97 39 12 c21 6 67 25 103 41 36 16 94 40 130 52 96 32 99 35 70 66 -35 38 -131 84 -198 96 -31 6 -78 20 -104 31 -41 17 -46 23 -38 39 11 20 89 69 109 69 19 0 72 39 161 120 82 74 82 74 54 82 -67 18 -219 20 -284 5 -36 -9 -79 -18 -96 -21 l-31 -5 22 64 c20 56 56 120 76 135 3 3 10 16 14 30 4 13 33 50 63 82 l55 58 -180 0 c-142 0 -183 -3 -199 -15 -22 -17 -48 -20 -39 -5 4 6 9 23 11 38 3 15 25 58 49 95 49 76 78 153 73 191 l-3 25 -88 -29 c-88 -30 -130 -48 -239 -100 -32 -16 -60 -24 -64 -19 -3 5 -5 64 -5 130 1 66 -4 129 -9 140 -25 45 -141 0 -192 -74 -12 -18 -30 -42 -41 -54 l-20 -22 -18 34 c-10 19 -28 69 -40 112 -11 43 -35 122 -53 176 l-33 98 -27 -28z m104 -442 c117 -26 263 -88 352 -151 24 -17 54 -38 68 -47 43 -28 173 -166 215 -228 70 -103 129 -234 151 -333 56 -251 35 -473 -66 -689 -154 -331 -482 -562 -840 -593 -341 -30 -620 66 -851 291 -94 92 -127 137 -198 269 -25 47 -76 184 -89 240 -21 88 -35 230 -28 282 4 29 10 78 13 108 7 73 66 248 111 333 146 271 383 445 717 525 54 13 376 8 445 -7z' transform='translate(0.000000,300.000000) scale(0.100000,-0.100000)'/%3E%3Cpath d='M1339 2416 c-129 -23 -262 -77 -377 -153 -59 -39 -202 -170 -202 -184 0 -6 -9 -20 -21 -32 -55 -59 -139 -246 -165 -372 -18 -84 -20 -266 -5 -352 55 -299 257 -560 536 -689 296 -137 658 -109 932 73 74 49 183 151 230 217 21 28 42 56 48 61 21 19 93 190 116 275 34 124 34 339 0 460 -94 341 -348 592 -690 681 -98 26 -297 33 -402 15z' transform='translate(0.000000,300.000000) scale(0.100000,-0.100000)'/%3E%3C/g%3E%3C/svg%3E";
const replaceCode = `%23`+ game.settings.get('twodsix', 'defaultColor').substring(1);
html.find("img")[0].src = svgImage.replace('%2329aaff', replaceCode);
const img = document.createElement("img");
img.src = svgImage.replace('%2329aaff', replaceCode);
if ( context.spin ) {
img.classList.add("fa-spin");
}
const caption = document.createElement("figcaption");
caption.innerText = context.text;
return [img, caption];
}
});
}
Loading
Loading