Skip to content

Commit

Permalink
Merge pull request #37 from dmrickey/2.13.0.next
Browse files Browse the repository at this point in the history
2.13.0.next
  • Loading branch information
dmrickey authored Jul 24, 2024
2 parents 0be9a5e + 94918c2 commit b1cd223
Show file tree
Hide file tree
Showing 72 changed files with 1,717 additions and 618 deletions.
15 changes: 15 additions & 0 deletions hbs/global-bonus-actor-disabled-container.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div id="ckl-global-bonus-actor-disabled-container">
<h2>{{localize 'ckl-roll-bonuses.global-bonus.actor.disable'}}</h2>
<p class="ckl-description">{{localize 'ckl-roll-bonuses.global-bonus.actor.description'}}</p>

<div style="display:flex;flex-direction:column;">
{{#each settings }}
<li class="form-group">
<label class="checkbox" {{#if checked}}style="text-decoration: line-through;"{{/if}}>
<input type="checkbox" name="{{path}}" {{#if checked}}checked{{/if}}>
{{label}}
</label>
</li>
{{/each}}
</div>
</div>
31 changes: 31 additions & 0 deletions hbs/gm-global-settings-config.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<form class="ckl-auto-global-settings">
<p class="main-description">{{{localize "ckl-roll-bonuses.global-settings.application.description"}}}</p>
<hr>

<ul class="section-list">
{{#each sections}}
<li class="section form-group">
<label>
<input name="{{key}}" type="checkbox" {{#if value}}checked{{/if}} />
<span>{{label}}</span>
</label>
<div class="text">
<div class="description">
{{description}}
</div>
{{#if issues}}
<div class="issues">
{{issues}}
</div>
{{/if}}
</div>
</li>
<hr>
{{/each}}
</ul>
<div class="form-group">
<button type="submit">
<i class="fas fa-save"></i> {{localize 'PF1.Save'}}
</button>
</div>
</form>
File renamed without changes.
63 changes: 63 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@
"mythic-weapon-focus": "Mythic Weapon Focus",
"mythicElementalFocus": "Mythic Elemental Focus",
"mythicSpellFocus": "Mythic Spell Focus",
"precise-shot": "Precise Shot",
"racial-weapon-focus": "Racial Weapon Focus",
"ranged-increment-penalty": "Ranged Increment Penalty Bonuses",
"ranged-increment-penalty-increment-penalty-offset": "Increment Penalty Reduction",
"ranged-increment-penalty-max-increment-offset": "Maximum Increment Offset",
"ranged-increment-penalty-penalty-offset": "Overall Penalty Reduction",
"school-dc": "Spell School DC",
"schoolClOffset": "Spell School CL",
"self": "Targets Self",
Expand Down Expand Up @@ -154,7 +159,12 @@
"mythic-weapon-focus": "Double Weapon Focus attack bonuses.",
"mythicElementalFocus": "Double Elemental Focus bonuses.",
"mythicSpellFocus": "Double Spell Focus bonuses.",
"precise-shot": "Negate penalty for shooting into melee.",
"racial-weapon-focus": "+1 bonus on attack rolls for chosen racial weapons. The weapon must be tagged with the race to be able to apply the bonus.",
"ranged-increment-penalty": "Modify the penalties associated with ranged weapon increments.",
"ranged-increment-penalty-increment-penalty-offset": "Modify the number of maximum range increments.",
"ranged-increment-penalty-max-increment-offset": "Reduce the penalty per increment.",
"ranged-increment-penalty-penalty-offset": "Reduce the total penalty.",
"school-dc": "Modify DC for spells with the chosen school.",
"schoolClOffset": "Modify CL for spells with the chosen school.",
"self": "Apply bonuses to all actions on this same Item.",
Expand Down Expand Up @@ -184,6 +194,55 @@
"cancel": "Cancel",
"cl-mod": "{mod} CL",
"cl-label-mod": "{mod} CL ({label})",
"global-bonus": {
"actor": {
"description": "The global bonuses that the GM has enabled for this world. Each setting can be individually disabled here if it is not suitable for this particular actor.",
"disable": "Disable Global Bonuses for this Actor"
},
"attack-label": {
"higher-ground": "Higher Ground",
"range-increment-penalty": "Ranged Penalty ({range}{units})",
"shoot-into-melee": "Into Melee"
},
"label": {
"higher-ground": "Higher Ground Melee Bonus",
"range-increment-penalty": "Ranged Increment Penalty",
"shoot-into-melee": "Shooting into Melee",
"require-melee-threaten": "Require Melee Threatens"
},
"warning": {
"range-increment-error-plural": "The farthest target ({distance}{units}) is outside of your maximum range ({max}{units}).",
"range-increment-error-singular": "The target ({distance}{units}) is outside of your maximum range ({max}{units}).",
"require-melee-threaten-plural": "You do not threaten at least one of the targets.",
"require-melee-threaten-singular": "You do not threaten the target."
}
},
"global-settings": {
"application": {
"description": "This attempts to automate global bonuses that are tedious to do manually. Some of these are a best-effort and should work under most circumstances, but due to their nature some will have quirks that may be unavoidable.",
"hint": "Configure specific combat bonuses that can be automated. These are global combat options that are aren't meant to be configured for specific feats or abilities, but apply to everyone.",
"label": "Configure Global Bonuses",
"title": "Global Bonuses",
"section": {
"higher-ground": {
"description": "Add +1 to melee attacks when made from a higher elevation.",
"issues": ""
},
"range-increment-penalty": {
"description": "Add ranged incremental attack penalties. Enabling this also enables bonuses to modify Ranged Attack Penalties and Range Increments.",
"issues": "This should fully work in most circumstances. The only case I have found where it could add the wrong penalty is if a large (or larger) token is partially hidden by a wall. It could be that the visible part is farther away than the closest part. The mod only calcuates based on the closest part of the target regardless of walls."
},
"shoot-into-melee": {
"description": "Adds penalties for shooting into melee. This requires that you have an ally adjacent to your target, that your target has a different disposition than you and your ally, and that at least your target or your ally threatens the other (threaten requires an equipped melee weapon or nautral attack). This also adds a Specific Bonus for Precise Shot. Make sure to open the Precise Shot feat so that it's configured. This correctly takes into account size differences.",
"issues": "You can normally ignore this penalty (disregarding Precise Shot) if you're shooting at a creature that's engaged in melee which is large enough for you target a spot on it at least 10 feet away from your allies. I cannot take into account if those \"ok-to-shoot-at-spots\" are somehow not in range or not visible--if the creature is large enough, the penalty is automatically negated."
},
"require-melee-threaten": {
"description": "Reject a melee attack if the attacker does not threaten the target. When using a melee action, this will reject the action if the target is out of range.",
"issues": "There may be circumstances where the GM is allowing a melee attack against a target even though it isn't in range. To work around this, simply don't target the desired token. If you have suggestions on a different way around this, let me know."
}
}
}
},
"crit-damage-label": {
"crit": " (Crit Only)",
"nonCrit": " (Non-crit Only)",
Expand Down Expand Up @@ -321,6 +380,10 @@
"name": "Martial Focus",
"default": "Martial Focus"
},
"precise-shot": {
"name": "Precise Shot",
"default": "Precise Shot"
},
"racial-weapon-focus": {
"name": "Racial Weapon Focus",
"default": "Gnome Weapon Focus"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packs/buffs/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000352
MANIFEST-000392
10 changes: 7 additions & 3 deletions packs/buffs/LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024/07/13-10:45:30.831 2c54 Recovering log #350
2024/07/13-10:45:30.835 2c54 Delete type=0 #350
2024/07/13-10:45:30.835 2c54 Delete type=3 #348
2024/07/23-21:05:38.861 9524 Recovering log #390
2024/07/23-21:05:38.865 9524 Delete type=0 #390
2024/07/23-21:05:38.865 9524 Delete type=3 #388
2024/07/23-21:38:38.247 90f0 Level-0 table #395: started
2024/07/23-21:38:38.247 90f0 Level-0 table #395: 0 bytes OK
2024/07/23-21:38:38.248 90f0 Delete type=0 #393
2024/07/23-21:38:38.249 90f0 Manual compaction at level-0 from '!items!3p2PtsJOLjsF390z' @ 72057594037927935 : 1 .. '!items!UITO7TgwvXGWG1N7' @ 0 : 0; will stop at (end)
14 changes: 7 additions & 7 deletions packs/buffs/LOG.old
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
2024/07/13-10:43:39.321 5464 Recovering log #347
2024/07/13-10:43:39.324 5464 Delete type=0 #347
2024/07/13-10:43:39.324 5464 Delete type=3 #346
2024/07/13-10:44:41.842 776c Level-0 table #351: started
2024/07/13-10:44:41.842 776c Level-0 table #351: 0 bytes OK
2024/07/13-10:44:41.843 776c Delete type=0 #349
2024/07/13-10:44:41.845 776c Manual compaction at level-0 from '!items!3p2PtsJOLjsF390z' @ 72057594037927935 : 1 .. '!items!UITO7TgwvXGWG1N7' @ 0 : 0; will stop at (end)
2024/07/23-09:27:48.928 a1cc Recovering log #386
2024/07/23-09:27:48.931 a1cc Delete type=0 #386
2024/07/23-09:27:48.931 a1cc Delete type=3 #384
2024/07/23-21:05:17.069 90f0 Level-0 table #391: started
2024/07/23-21:05:17.069 90f0 Level-0 table #391: 0 bytes OK
2024/07/23-21:05:17.070 90f0 Delete type=0 #389
2024/07/23-21:05:17.071 90f0 Manual compaction at level-0 from '!items!3p2PtsJOLjsF390z' @ 72057594037927935 : 1 .. '!items!UITO7TgwvXGWG1N7' @ 0 : 0; will stop at (end)
Binary file not shown.
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion packs/documentation/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000294
MANIFEST-000336
10 changes: 7 additions & 3 deletions packs/documentation/LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024/07/13-10:45:30.838 1a0 Recovering log #292
2024/07/13-10:45:30.841 1a0 Delete type=0 #292
2024/07/13-10:45:30.841 1a0 Delete type=3 #290
2024/07/23-21:05:38.868 a1cc Recovering log #333
2024/07/23-21:05:38.871 a1cc Delete type=0 #333
2024/07/23-21:05:38.871 a1cc Delete type=3 #331
2024/07/23-21:38:38.246 90f0 Level-0 table #339: started
2024/07/23-21:38:38.246 90f0 Level-0 table #339: 0 bytes OK
2024/07/23-21:38:38.247 90f0 Delete type=0 #337
2024/07/23-21:38:38.249 90f0 Manual compaction at level-0 from '!journal!FrG2K3YAM1jdSxcC' @ 72057594037927935 : 1 .. '!journal.pages!FrG2K3YAM1jdSxcC.zHKvVEnQ3jAyUiKn' @ 0 : 0; will stop at (end)
21 changes: 14 additions & 7 deletions packs/documentation/LOG.old
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
2024/07/13-10:43:39.328 7180 Recovering log #289
2024/07/13-10:43:39.331 7180 Delete type=0 #289
2024/07/13-10:43:39.331 7180 Delete type=3 #288
2024/07/13-10:44:41.843 776c Level-0 table #293: started
2024/07/13-10:44:41.843 776c Level-0 table #293: 0 bytes OK
2024/07/13-10:44:41.844 776c Delete type=0 #291
2024/07/13-10:44:41.845 776c Manual compaction at level-0 from '!journal!FrG2K3YAM1jdSxcC' @ 72057594037927935 : 1 .. '!journal.pages!FrG2K3YAM1jdSxcC.zHKvVEnQ3jAyUiKn' @ 0 : 0; will stop at (end)
2024/07/23-09:27:48.935 9734 Recovering log #329
2024/07/23-09:27:48.938 9734 Delete type=0 #329
2024/07/23-09:27:48.938 9734 Delete type=3 #327
2024/07/23-21:05:17.074 90f0 Level-0 table #334: started
2024/07/23-21:05:17.083 90f0 Level-0 table #334: 632545 bytes OK
2024/07/23-21:05:17.085 90f0 Delete type=0 #332
2024/07/23-21:05:17.086 90f0 Manual compaction at level-0 from '!journal!FrG2K3YAM1jdSxcC' @ 72057594037927935 : 1 .. '!journal.pages!FrG2K3YAM1jdSxcC.zHKvVEnQ3jAyUiKn' @ 0 : 0; will stop at '!journal.pages!FrG2K3YAM1jdSxcC.zHKvVEnQ3jAyUiKn' @ 2441 : 1
2024/07/23-21:05:17.086 90f0 Compacting 1@0 + 1@1 files
2024/07/23-21:05:17.090 90f0 Generated table #335@0: 10 keys, 40296 bytes
2024/07/23-21:05:17.090 90f0 Compacted 1@0 + 1@1 files => 40296 bytes
2024/07/23-21:05:17.091 90f0 compacted to: files[ 0 1 0 0 0 0 0 ]
2024/07/23-21:05:17.091 90f0 Delete type=2 #324
2024/07/23-21:05:17.092 90f0 Delete type=2 #334
2024/07/23-21:05:17.092 90f0 Manual compaction at level-0 from '!journal.pages!FrG2K3YAM1jdSxcC.zHKvVEnQ3jAyUiKn' @ 2441 : 1 .. '!journal.pages!FrG2K3YAM1jdSxcC.zHKvVEnQ3jAyUiKn' @ 0 : 0; will stop at (end)
Binary file removed packs/documentation/MANIFEST-000294
Binary file not shown.
Binary file added packs/documentation/MANIFEST-000336
Binary file not shown.
2 changes: 1 addition & 1 deletion src/bonuses/all-specific-bonuses.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SpecificBonuses {
/**
* @type {Record<string, SpecificBonus>}}
*/
static allBonuses = {}
static allBonuses = {};

static get dictionaryKeys() {
return Object.values(this.allBonuses)
Expand Down
4 changes: 2 additions & 2 deletions src/bonuses/weapon-focus/weapon-focus.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { KeyedDFlagHelper, getDocDFlags } from "../../util/flag-helpers.mjs";
import { customGlobalHooks } from "../../util/hooks.mjs";
import { registerItemHint } from "../../util/item-hints.mjs";
import { localize, localizeBonusLabel } from "../../util/localize.mjs";
import { GlobalSettings, LanguageSettings } from "../../util/settings.mjs";
import { SharedSettings, LanguageSettings } from "../../util/settings.mjs";
import { signed } from '../../util/to-signed-string.mjs';
import { uniqueArray } from "../../util/unique-array.mjs";
import { SpecificBonuses } from '../all-specific-bonuses.mjs';
Expand Down Expand Up @@ -168,7 +168,7 @@ Hooks.on('renderItemSheet', (
/** @type {[HTMLElement]} */[html],
/** @type {unknown} */ _data
) => {
if (GlobalSettings.elephantInTheRoom) return;
if (SharedSettings.elephantInTheRoom) return;
if (!(item instanceof pf1.documents.item.ItemPF)) return;

/** @type {string | undefined} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { KeyedDFlagHelper, getDocDFlags } from "../../util/flag-helpers.mjs";
import { customGlobalHooks } from "../../util/hooks.mjs";
import { registerItemHint } from "../../util/item-hints.mjs";
import { localize, localizeBonusLabel } from "../../util/localize.mjs";
import { GlobalSettings, LanguageSettings } from '../../util/settings.mjs';
import { SharedSettings, LanguageSettings } from '../../util/settings.mjs';
import { SpecificBonuses } from '../all-specific-bonuses.mjs';
import { greaterWeaponFocusKey } from "../weapon-focus/ids.mjs";
import { WeaponSpecializationSettings, weaponSpecializationKey } from "./weapon-specialization.mjs";
Expand Down Expand Up @@ -95,7 +95,7 @@ Hooks.on('renderItemSheet', (
/** @type {[HTMLElement]} */[html],
/** @type {unknown} */ _data
) => {
if (GlobalSettings.elephantInTheRoom) return;
if (SharedSettings.elephantInTheRoom) return;
if (!(item instanceof pf1.documents.item.ItemPF)) return;

const name = item?.name?.toLowerCase() ?? '';
Expand Down
4 changes: 2 additions & 2 deletions src/bonuses/weapon-specialization/weapon-specialization.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { KeyedDFlagHelper, getDocDFlags } from "../../util/flag-helpers.mjs";
import { customGlobalHooks } from "../../util/hooks.mjs";
import { registerItemHint } from "../../util/item-hints.mjs";
import { localize, localizeBonusLabel } from "../../util/localize.mjs";
import { GlobalSettings, LanguageSettings } from "../../util/settings.mjs";
import { SharedSettings, LanguageSettings } from "../../util/settings.mjs";
import { uniqueArray } from "../../util/unique-array.mjs";
import { SpecificBonuses } from '../all-specific-bonuses.mjs';
import { weaponFocusKey } from "../weapon-focus/ids.mjs";
Expand Down Expand Up @@ -105,7 +105,7 @@ Hooks.on('renderItemSheet', (
/** @type {[HTMLElement]} */[html],
/** @type {unknown} */ _data
) => {
if (GlobalSettings.elephantInTheRoom) return;
if (SharedSettings.elephantInTheRoom) return;
if (!(item instanceof pf1.documents.item.ItemPF)) return;

const name = item?.name?.toLowerCase() ?? '';
Expand Down
61 changes: 61 additions & 0 deletions src/global-bonuses/all-global-bonuses.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { MODULE_NAME } from '../consts.mjs';
import { addGlobalBonusDisablerToActor } from '../handlebars-handlers/global-bonuses/add-global-bonus-disabler-to-actor.mjs';
import { api } from '../util/api.mjs';
import { LocalHookHandler, localHooks } from '../util/hooks.mjs';
import { GlobalBonusSettings } from '../util/settings.mjs';
import { BaseGlobalBonus } from './base-global-bonus.mjs';

export class GlobalBonuses {
/**
* @param {typeof BaseGlobalBonus} bonus
*/
static registerBonus(bonus) {
GlobalBonuses.allBonuses.push(bonus);
GlobalBonusSettings.registerKey(bonus);
Hooks.once('i18nInit', () => {
if (GlobalBonusSettings.setting(bonus.key)) {
bonus.registerBonuses();
}
});

api.globalTypeMap[bonus.key] = bonus;
}

/**
* @type {Array<typeof BaseGlobalBonus>}}
*/
static allBonuses = [];
}

/**
* @param {ItemAction} action
* @param {RollData} rollData
*/
function initRollData(action, rollData) {
GlobalBonuses.allBonuses.forEach((bonus) => {
const { actor } = action;
if (bonus.isDisabled() || bonus.isDisabledForActor(actor)) {
return;
}

bonus.initRollData(action, rollData);
});
}
LocalHookHandler.registerHandler(localHooks.initItemActionRollData, initRollData);

Hooks.on('renderActorSheet', (
/** @type {ActorSheetPF} */ { actor, isEditable },
/** @type {[HTMLElement]} */[html],
/** @type {unknown} */ _data
) => {
const bonuses = GlobalBonuses.allBonuses
.filter((b) => !b.isDisabled());
const settings = bonuses.map((b) => ({
checked: b.isDisabledForActor(actor),
journal: `journal - ${b.key}`, // TODO
label: b.label,
path: `flags.${MODULE_NAME}.${b.actorDisabledFlag}`,
}));

addGlobalBonusDisablerToActor(html, settings, isEditable);
});
Loading

0 comments on commit b1cd223

Please sign in to comment.