-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit
stackGroup
property to consumables and treasure
- Loading branch information
Showing
21 changed files
with
79 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
type ConsumableTrait = keyof typeof CONFIG.PF2E.consumableTraits; | ||
type OtherConsumableTag = "herbal"; | ||
|
||
export type { ConsumableTrait, OtherConsumableTag }; | ||
type AmmoStackGroup = | ||
| "arrows" | ||
| "blowgunDarts" | ||
| "bolts" | ||
| "coins" | ||
| "gems" | ||
| "rounds5" | ||
| "rounds10" | ||
| "slingBullets" | ||
| "sprayPellets" | ||
| "woodenTaws"; | ||
|
||
export type { AmmoStackGroup, ConsumableTrait, OtherConsumableTag }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,4 @@ | ||
import { ItemSheetOptions } from "@item/base/sheet/sheet.ts"; | ||
import { PhysicalItemSheetData, PhysicalItemSheetPF2e } from "@item/physical/index.ts"; | ||
import * as R from "remeda"; | ||
import { PhysicalItemSheetPF2e } from "@item/physical/index.ts"; | ||
import type { ContainerPF2e } from "./document.ts"; | ||
|
||
export class ContainerSheetPF2e extends PhysicalItemSheetPF2e<ContainerPF2e> { | ||
override async getData(options?: Partial<ItemSheetOptions>): Promise<ContainerSheetData> { | ||
return { | ||
...(await super.getData(options)), | ||
stackGroups: R.pick(CONFIG.PF2E.stackGroups, ["sacks"]), | ||
}; | ||
} | ||
} | ||
|
||
interface ContainerSheetData extends PhysicalItemSheetData<ContainerPF2e> { | ||
stackGroups: { sacks: string }; | ||
} | ||
export class ContainerSheetPF2e extends PhysicalItemSheetPF2e<ContainerPF2e> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ItemSourcePF2e, isPhysicalData } from "@item/base/data/index.ts"; | ||
import { itemIsOfType } from "@item/helpers.ts"; | ||
import { MigrationBase } from "../base.ts"; | ||
|
||
/** Limit `stackGroup` property to consumables and treasure */ | ||
export class Migration906LimitStackGroup extends MigrationBase { | ||
static override version = 0.906; | ||
|
||
override async updateItem(source: MaybeWithToBeDeletedStackGroup): Promise<void> { | ||
const toDelete = !isPhysicalData(source) || !itemIsOfType(source, "consumable", "treasure"); | ||
if (toDelete && "stackGroup" in source.system) { | ||
source.system["-=stackGroup"] = null; | ||
} else if (itemIsOfType(source, "consumable", "treasure")) { | ||
source.system.stackGroup = source.system.slug === "rations" ? null : source.system.stackGroup || null; | ||
} | ||
} | ||
} | ||
|
||
type MaybeWithToBeDeletedStackGroup = ItemSourcePF2e & { system: { "-=stackGroup"?: null } }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters