Skip to content

Commit

Permalink
feat: Supports (and requires) the pf2e system version 2.6.0. Removes …
Browse files Browse the repository at this point in the history
…the deprecated IWR reminder feature as full support for IWR is now part of the system. Fully removes the partially removed player items rarity colorization feature as that too is part of the system. Updates types to match the latest pf2e version.
  • Loading branch information
xdy committed Jan 1, 2023
1 parent e018bbf commit bedf8f6
Show file tree
Hide file tree
Showing 86 changed files with 2,355 additions and 739 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,6 @@ A demo video of most features: https://www.youtube.com/watch?v=WzDq2N1X07s
about Flat Checks to rolls. It is far from complete, but it's a good start. To use it add it to your
character. It currently handles: Target is undetected, hidden, invisible or concealed. Self is blinded or
dazzled. Self has Blind-Fight.
* (Deprecated, will break with the next pf2e system release. You know the one that contains proper IWR handling
making this Workbench feature obsolete...) Option to create an IWR (Immunity, Weakness, Resistance) reminder
message after a damage roll against a target with an IWR that matches damage types of the attacking weapon or
spell. NOTE: Currently only handles 'simple' IWR, it doesn't handle things like 'All', 'Physical', 'All (except
force)', etc.

## Installation

Expand Down
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "4.25.0",
"id": "xdy-pf2e-workbench",
"compatibility": {
"minimum": "10.284",
"minimum": "10.291",
"verified": "10.291",
"maximum": "10"
},
Expand All @@ -15,8 +15,8 @@
"type": "system",
"manifest": "https://github.com/foundryvtt/pf2e/releases/download/latest/system.json",
"compatibility": {
"minimum": "4.4.0",
"verified": "4.5.1"
"minimum": "4.6.0",
"verified": "4.6.0"
}
}
]
Expand Down
592 changes: 296 additions & 296 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@
"@types/css-minimizer-webpack-plugin": "^3.2.1",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^8.0.0",
"@types/jquery": "^3.5.14",
"@types/luxon": "^3.1.0",
"@types/jquery": "^3.5.16",
"@types/luxon": "^3.2.0",
"@types/mini-css-extract-plugin": "^2.5.1",
"@types/node": "^18.11.18",
"@types/sortablejs": "^1.15.0",
"@types/tooltipster": "^0.0.31",
"@types/webpack-env": "^1.18.0",
"@types/yaireo__tagify": "^4.16.0",
"@types/yaireo__tagify": "^4.16.1",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"css-minimizer-webpack-plugin": "^4.2.2",
"eslint": "^8.30.0",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
Expand Down
80 changes: 0 additions & 80 deletions src/module/feature/reminders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { TokenDocumentPF2e } from "@scene";
import { CombatantPF2e } from "@module/encounter";
import { ActorFlagsPF2e } from "@actor/data/base";
import { ChatMessagePF2e } from "@module/chat-message";
import { SpellPF2e } from "@item";
import { ActorPF2e, CreaturePF2e } from "@actor";

export async function reminderBreathWeapon(message: ChatMessagePF2e) {
Expand Down Expand Up @@ -169,82 +168,3 @@ export async function reminderTargeting(message: ChatMessagePF2e) {
}
}
}

// Deprecated with next pf2e release (and broken, won't fix)
export async function reminderIWR(message: ChatMessagePF2e) {
if (game.user?.isGM && message.flags && message.user && message.user.targets && message.user.targets.size >= 1) {
const targets = message.user.targets;
const output: string[] = [];
for (const target of targets) {
let damageTypes: string[] = Object.keys(message.flags?.pf2e?.damageRoll?.types?.valueOf() || {}).flatMap(
(value, _index) => value
);
if (damageTypes.length === 0) {
const originUUID = message.flags?.pf2e?.origin?.uuid;
if (originUUID) {
const origin: SpellPF2e | null = <SpellPF2e>await fromUuid(<string>originUUID);
damageTypes = Object.values(origin.system.damage.value).map((x) => x.type.value);
}
}
if (damageTypes.length > 0) {
const traits = target.actor?.system.traits;
// Filter traits that are in damageTypes
const diTypes = traits?.di?.value
? traits?.di?.value
?.filter((value: string) => {
return damageTypes.includes(value);
})
.map((trait) => {
return trait?.charAt(0).toLocaleUpperCase() + trait.slice(1);
})
: [];
const dvTypes = traits?.dv
? traits?.dv
.filter((trait) => damageTypes.includes(trait.type))
.filter((trait) => trait.value)
.map(
(trait) =>
trait?.type.charAt(0).toLocaleUpperCase() + trait.type?.slice(1) + ":" + trait.value
)
: [];
const drTypes = traits?.dr
? traits?.dr
.filter((trait) => damageTypes.includes(trait.type))
.filter((trait) => trait.value)
.map(
(trait) =>
trait?.type.charAt(0).toLocaleUpperCase() + trait.type?.slice(1) + ":" + trait.value
)
: [];

if (diTypes.length > 0) {
output.push(game.i18n.localize(`${MODULENAME}.SETTINGS.reminderIWR.immuneTo`) + diTypes.join(", "));
}
if (dvTypes.length > 0) {
output.push(game.i18n.localize(`${MODULENAME}.SETTINGS.reminderIWR.weakTo`) + dvTypes.join(", "));
}
if (drTypes.length > 0) {
output.push(
game.i18n.localize(`${MODULENAME}.SETTINGS.reminderIWR.resistantTo`) + drTypes.join(", ")
);
}
if (output.length > 0) {
let caveat = "";
if (game.settings.get(MODULENAME, "reminderIWRCaveat")) {
caveat = game.i18n.localize(`${MODULENAME}.SETTINGS.reminderIWR.notComplex`);
}
ChatMessage.create({
content:
game.i18n.format(`${MODULENAME}.SETTINGS.reminderIWR.is`, {
name: target?.actor?.token?.name || "",
}) +
output +
caveat,
whisper: ChatMessage.getWhisperRecipients("GM").map((u) => u.id),
blind: true,
}).then();
}
}
}
}
}
7 changes: 0 additions & 7 deletions src/module/feature/settingsHandler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ export function toggleMenuSettings(html: JQuery, settings: SettingsMenuPF2eWorkb
html.find(`select[name="${settingName}"]`).parent().parent().toggle(!valueFunction);
}

if (settingName !== `reminderIWR` && settingName.startsWith(`reminderIWR`)) {
const valueFunction = !game.settings.get(MODULENAME, "reminderIWR");

html.find(`input[name="${settingName}"]`).parent().parent().toggle(!valueFunction);
html.find(`select[name="${settingName}"]`).parent().parent().toggle(!valueFunction);
}

if (settingName !== `tokenAnimation` && settingName.startsWith(`tokenAnimation`)) {
const valueFunction = !game.settings.get(MODULENAME, "tokenAnimation");

Expand Down
9 changes: 0 additions & 9 deletions src/module/settings/qol-world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ export class WorkbenchQolWorldSettings extends SettingsMenuPF2eWorkbench {
type: Boolean,
onChange: () => debouncedReload(),
},
playerItemsRarityColour: {
name: `${MODULENAME}.SETTINGS.playerItemsRarityColour.name`,
hint: `${MODULENAME}.SETTINGS.playerItemsRarityColour.hint`,
scope: "world",
config: true,
default: false,
type: Boolean,
onChange: () => debouncedReload(),
},
castPrivateSpell: {
name: `${MODULENAME}.SETTINGS.castPrivateSpell.name`,
hint: `${MODULENAME}.SETTINGS.castPrivateSpell.hint`,
Expand Down
18 changes: 0 additions & 18 deletions src/module/settings/reminders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,6 @@ export class WorkbenchRemindersSettings extends SettingsMenuPF2eWorkbench {
type: Boolean,
onChange: () => debouncedReload(),
},
reminderIWR: {
name: `${MODULENAME}.SETTINGS.reminderIWR.name`,
hint: `${MODULENAME}.SETTINGS.reminderIWR.hint`,
scope: "world",
config: true,
default: false,
type: Boolean,
onChange: () => debouncedReload(),
},
reminderIWRCaveat: {
name: `${MODULENAME}.SETTINGS.reminderIWRCaveat.name`,
hint: `${MODULENAME}.SETTINGS.reminderIWRCaveat.hint`,
scope: "world",
config: true,
default: true,
type: Boolean,
onChange: () => debouncedReload(),
},
reminderTargeting: {
name: `${MODULENAME}.SETTINGS.reminderTargeting.name`,
hint: `${MODULENAME}.SETTINGS.reminderTargeting.hint`,
Expand Down
19 changes: 0 additions & 19 deletions src/module/xdy-pf2e-workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
autoReduceStunned,
reminderBreathWeapon,
reminderCannotAttack,
reminderIWR,
reminderTargeting,
} from "./feature/reminders";
import { setupNPCScaler } from "./feature/cr-scaler/NPCScalerSetup";
Expand Down Expand Up @@ -133,7 +132,6 @@ Hooks.once("init", async (_actor: ActorPF2e) => {
game.settings.get(MODULENAME, "automatedAnimationOn") ||
game.settings.get(MODULENAME, "reminderBreathWeapon") ||
game.settings.get(MODULENAME, "reminderTargeting") ||
game.settings.get(MODULENAME, "reminderIWR") ||
game.settings.get(MODULENAME, "reminderCannotAttack")
) {
Hooks.on("createChatMessage", (message: ChatMessagePF2e) => {
Expand All @@ -158,10 +156,6 @@ Hooks.once("init", async (_actor: ActorPF2e) => {
if (game.settings.get(MODULENAME, "reminderBreathWeapon")) {
reminderBreathWeapon(message).then();
}
} else {
if (game.settings.get(MODULENAME, "reminderIWR")) {
reminderIWR(message).then();
}
}
});
}
Expand Down Expand Up @@ -403,7 +397,6 @@ Hooks.once("init", async (_actor: ActorPF2e) => {
}

if (
game.settings.get(MODULENAME, "playerItemsRarityColour") ||
game.settings.get(MODULENAME, "castPrivateSpell") ||
game.settings.get(MODULENAME, "addGmRKButtonToNpc") ||
game.settings.get(MODULENAME, "quickQuantities") ||
Expand All @@ -421,18 +414,6 @@ Hooks.once("init", async (_actor: ActorPF2e) => {
});
}

if (game.settings.get(MODULENAME, "playerItemsRarityColour")) {
$html.find(".item").each((_i, e) => {
$(e).each((_i, e) => {
const rarity = $(e).attr("data-item-rarity");
const mystified = $(e).find("span").hasClass("gm-mystified-data");
if (rarity && !mystified) {
$(e).find("h4").addClass(`xdy-pf2e-workbench-rarity-${rarity}`);
}
});
});
}

if (game.user?.isGM && game.settings.get(MODULENAME, "addGmRKButtonToNpc")) {
addGmRKButtonToNpc($html, sheet);
}
Expand Down
13 changes: 0 additions & 13 deletions static/lang/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,6 @@
"name": "单词或随机表后缀",
"hint": "添加文本到新名称后缀,默认为“”(例如:'Creature'),如果这与随机表的名称一致,则该表的随机文本结果将用作后缀。 这将在任何随机词前缀被添加*之前*生效(见前面的选项)"
},
"reminderIWR": {
"weakTo": " <strong>弱点</strong> ",
"is": "{name}是",
"immuneTo": " <strong>免疫</strong> ",
"name": "免疫/弱点/抗力提醒",
"resistantTo": " <strong>抗性</strong> ",
"hint": "勾选此项,受到伤害时提示免疫/弱点/抗力。目前只能处理“简单”伤害类型(如钝击或火焰,但“全部”或“物理”不行)",
"notComplex": "<br><br>注意:复杂的免疫、弱点和抗性比如全部、心灵、物理等暂不支持,如果目标拥有此类抗力/弱点,请手动处理。"
},
"customPauseImage": {
"hint": "自定义暂停图标。留空则使用系统默认的闹钟图标。",
"name": "自定义暂停图标。"
Expand Down Expand Up @@ -471,10 +462,6 @@
"petrified": "被石化",
"unconscious": "失去意识"
},
"reminderIWRCaveat": {
"hint": "勾选此项,在每条信息中提醒复杂抗力/弱点无法支持。",
"name": "勾选此项,在每条信息中提醒复杂抗力/弱点无法支持。"
},
"tokenAnimation": {
"hint": "启用此项更改token的移动动画。如有Multilevel Tokens模组,可能会引发问题。",
"name": "启用以更改token移动动画。"
Expand Down
13 changes: 0 additions & 13 deletions static/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,6 @@
"hint": "Check to allow eidolons that are dead/have no hp to attack without a reminder.",
"name": "Eidolons can attack while dead"
},
"reminderIWR": {
"hint": "Check to show reminder for IWR when damage is taken. Currently only handles 'simple' damage types (e.g. handles ones like 'Bludgeoning' or 'Fire', not ones like 'All' or 'Physical')",
"immuneTo": " <strong>Immune</strong> to ",
"is": "{name} is",
"name": "IWR reminder",
"notComplex": "<br><br>NOTE: Complex IWR such as All, Mental, Physical, etc, are not yet supported, check manually if you target might have such.",
"resistantTo": " <strong>Resistant</strong> to ",
"weakTo": " <strong>Weak</strong> to "
},
"reminderIWRCaveat": {
"hint": "Check to show warning about complex IWR not being supported in each message.",
"name": "Check to show warning about complex IWR not being supported in each message."
},
"remindersSettings": {
"hint": "Enable and configure various reminders",
"label": "Manage Reminders Settings",
Expand Down
13 changes: 0 additions & 13 deletions static/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,6 @@
"hint": "Cliquez pour permettre aux eidolons qui sont morts/n'ont plus de PV d'attaquer sans rappel.",
"name": "Les eidolons peuvent attaquer alors qu'ils sont morts"
},
"reminderIWR": {
"hint": "Activer pour montrer un rappel des résistances/faiblesses/immunités lorsque les dégâts sont appliqués. Ne prend en compte actuellement que les types de dégâts simples (ex : contondant ou feu, pas ceux comme 'tous' ou 'Physique')",
"immuneTo": " <strong>Immunité</strong> : ",
"is": "{name} est",
"name": "Rappel FIR",
"notComplex": "<br><br>NOTE : Les Immunités/Faiblesses/Résistances complexes (comme Tous, mental, physique, etc...) ne sont pas encore prises en compte. Vérifiez manuellement si vos cibles pourraient en avoir de telles.",
"resistantTo": " <strong>Résistance</strong> : ",
"weakTo": " <strong>Faiblesse</strong> : "
},
"reminderIWRCaveat": {
"hint": "Cliquez pour afficher un avertissement à propos des FIR complexes qui ne sont pas supportées dans chaque message.",
"name": "Cliquez pour afficher un avertissement à propos des FIR complexes qui ne sont pas supportées dans chaque message."
},
"remindersSettings": {
"hint": "Activer et configurer des pense-bêtes divers",
"label": "Régler les pense-bêtes",
Expand Down
13 changes: 0 additions & 13 deletions static/lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,6 @@
"hint": "Permite que Eidolons que estejam mortos ou sem PV possam atacar sem mostrar o lembrete.",
"name": "Ignorar lembrete para Eidolons"
},
"reminderIWR": {
"hint": "Mostra lembrete para Imunidades, Fraquezas e Resistências quando dano é recebido. Atualmente só funciona com tipos \\\"simples\\\", como \\\"fogo\\\" e \\\"contundente\\\", mas não \\\"todo dano\\\" ou \\\"Físico\\\".",
"immuneTo": " <strong>Imune</strong> a ",
"is": "{name} é",
"name": "Imunidades, Fraquezas e Resistências",
"resistantTo": " <strong>Resistente</strong> a ",
"weakTo": " <strong>Fraco</strong> a ",
"notComplex": "<br><br>NOTA: \"A tudo\", mental, fisico e outras complexidades devem ser verificadas na ficha do alvo."
},
"remindersSettings": {
"hint": "Configure vários lembretes.",
"label": "Configurações de Lembretes",
Expand All @@ -387,10 +378,6 @@
"name": "Texto customizado para usar no texto de Pause.",
"hint": "Texto customizado para usar no texto de Pause. Deixe vazio para utilizar o texto padrão 'Jogo Pausado'."
},
"reminderIWRCaveat": {
"name": "Mostrar Alerta de verificação de certas Fraquezas/Imunidades/Resistencias, não suportados em cada mensagem.",
"hint": "Mostrar Alerta de verificação de certas Fraquezas/Imunidades/Resistencias, não suportados em cada mensagem."
},
"applyClumsyIfWieldingLargerWeapon": {
"hint": "Automaticamente aplica Desajeitado se a Arma for maior de quem á estiver segurando.",
"name": "Automaticamente aplica Desajeitado se a Arma for maior de quem á estiver segurando."
Expand Down
Loading

0 comments on commit bedf8f6

Please sign in to comment.