Skip to content

A Foundry VTT module to enhance the dnd5e inventory. Allows to customize your Inventory in various ways.

License

Notifications You must be signed in to change notification settings

p4535992/foundryvtt-inventory-plus

Repository files navigation

Inventory+

Latest Release Download Count

Forge Installs

Foundry Core Compatible Version

Latest Version

Foundry Hub Endorsements

GitHub all releases

Translation status

If you want to buy me a coffee alt-text

A Foundry VTT module to enhance the dnd5e inventory. Allows to customize your Inventory in various ways, transfer items instead duplicate between character sheet, ordering the items, and many other feature hidden under the hood.

  • Delete every category even the default ones of dnd5e
  • Add item in every category even the non-default ones of dnd5e
  • Specify what type of item can be put on a category
  • Set up a max weight for the category

example

NOTE: This module is under maintenance, I have no plans to update or add features. However, I will try to fix any bugs as possible. Any contribution is welcome.

Installation

It's always better and easier to install modules through in in app browser. Just search for "Inventory Plus!"

To install this module manually:

  1. Inside the Foundry "Configuration and Setup" screen, click "Add-on Modules"
  2. Click "Install Module"
  3. In the "Manifest URL" field, paste the following url: https://raw.githubusercontent.com/p4535992/foundryvtt-inventory-plus/master/src/module.json
  4. Click 'Install' and wait for installation to complete
  5. Don't forget to enable the module in game using the "Manage Module" button

libWrapper

This module uses the libWrapper library for wrapping core methods. It is a hard dependency and it is recommended for the best experience and compatibility with other modules.

Details

This module allows you to create custom inventory categories and sort items into them and the default categories. You can also order the categories around and even disable weight tracking on a per category basis.

Known issue

  • The no dialog on the edit category is frozen for now just "close" the dialog
  • The retrieve of the category depend on the name used for the category so for now hus use unique name category

Features

Due to collisions, code maintenance problems, and reduction in the number of modules I have rewritten for the inherent use of the module some features of other modules, mentioned in the credits of this document. I invite you to support these authors in their various kofis and patreons. Each feature is non-blocking with the other modules and can be activated / deactivated from a specific module setting, which we list below

Feature: Integration with Variant Encumbrance: If enabled it will calculate the weight with the API of the module 'VariantEncumbrance' for a better and smarter calculation of the weight, if the module is present and active

Feature: Integration with Item Collection: Use equipped/unequipped feature of the 'ItemCollection/Item Container' module for the backpack. Bags can be unequipped by players or GM, so that their reported weight drops to 0 in your inventory (only bags with a capacity other than 0 can be unequipped). ATTENTION: If the module 'Variant Encumbrance' is present and active this feature is disabled by default if the module settings 'Feature: Integration with Variant Encumbrance' is enabled.

Feature: Enable item transfer: This feature is been removed in favor of a external module Transfer stuff, you can install with this json: https://raw.githubusercontent.com/p4535992/foundryvtt-transfer-stuff/master/src/module.json

Feature: Enable inventory sorter: Automatically sorts all actors' items (inventory, features, and spells) alphabetically (within each category).

Feature: Equipment Multiplier: Apply a weight multiplier to equipped items

[Only with 'Feature: Equipment Multiplier' enabled] Equipment Multiplier value: What weight multiplier to apply to equipped items. ATTENTION: If the module 'Variant Encumbrance' is present and active this feature is disabled by default if the module settings 'Feature: Integration with Variant Encumbrance' is enabled.

Feature: Do Not increase weight by quantity for no ammunition item: This is a homebrew rule, for non-ammunition items don't increase weight by quantity (so 5 potions = 1 item weight for example). ATTENTION: If the module 'Variant Encumbrance' is present and active this feature is disabled by default if the module settings 'Feature: Integration with Variant Encumbrance' is enabled.,

Feature: Do Not apply weight for equipped armor item: This is a homebrew rule, for equipped armor types (clothing, light, medium, heavy, natural), the weight is set to 0 and not applied. ATTENTION: If the module 'Variant Encumbrance' is present and active this feature is disabled by default if the module settings 'Feature: Integration with Variant Encumbrance' is enabled.

Hide button for manage default categories: By default only GM can see this button, but if you enable this module settings the button is hide for everyone.

API

game.modules.get('inventory-plus').api.calculateWeightFromActor(actorIdOrName:string) ⇒ number

A method to calculate the weight (the one from the module filters) on inventory array and the current currency present on the actor

Returns: number

Param Type Description Default
actorIdOrName string The actor id or name (if founded) undefined

game.modules.get('inventory-plus').api.isCategoryFulled(actor: Actor, categoryType: string, itemData:ItemData) ⇒ boolean

Returns: boolean

Param Type Description Default
actor Actor The actor undefined
categoryType string The id of the category undefined
itemData ItemData The item data to drop on the inventory with specific category type undefined

game.modules.get('inventory-plus').api.addCategory(actorId: string, categoryLabel: string, ignoreWeight: boolean | undefined, maxWeight: number | undefined, ownWeight: number | undefined, items: ItemData[] | undefined, explicitTypes: InventoryPlusItemType[]|undefined) ⇒ Promise

Param Type Description Default
actorId string The actor Id undefined
categoryLabel string The label of the category undefined
ignoreWeight boolean The boolean value for ignore the weight false
maxWeight number The value of the max weight of the category 0
ownWeight number The value of the own weight of the category 0
items ItemData[] The array of itemData to associate to the category. If the item is not present on the actor it will be created so pay attention. undefined
explicitTypes InventoryPlusItemType[] The array of InventoryPlusItemType associated to the category undefined

Example

const actorEntityTmp = game.actors?.getName('PARTY INVENTORY');
const actorId = actorEntityTmp.id;
game.modules.get('inventory-plus').api.addCategory(actorId, 'label16')

Models used from API

The InventoryPlusItemType object is represented like this:

{
  id: string;
  name: string;
  img: string;
  isSelected: boolean;
  isInventory: boolean;
}

The Category object is represented like this:

{
	label: string;
	items: Item[];
	dataset: {
		type: string;
		/* only NPC and Vehicle */
		"weapon-type"?: string;
		"armor.type"?: string;
		"activation.type"?: string;
	};
	/* only NPC and Vehicle */
	hasActions?: boolean;
	crewable?: boolean;
	columns?: [
		{
			label: string;
			css: string;
			property: string;
			editable?: string;
		}
	];
	/* non default dnd5e */
	sortFlag: number;
	ignoreWeight: boolean;
	maxWeight: number;
	ownWeight: number;
	collapsed: boolean;
	explicitTypes: InventoryPlusItemType[];
	ignoreBulk: boolean;
	maxBulk: number;
	ownBulk: number;
    customId: string;
}

Build

Install all packages

npm install

npm build scripts

build

will build the code and copy all necessary assets into the dist folder and make a symlink to install the result into your foundry data; create a foundryconfig.json file with your Foundry Data path.

{
  "dataPath": "~/.local/share/FoundryVTT/"
}

build will build and set up a symlink between dist and your dataPath.

npm run-script build

NOTE:

You don't need to build the foundryconfig.json file you can just copy the content of the dist folder on the module folder under modules of Foundry

build:watch

build:watch will build and watch for changes, rebuilding automatically.

npm run-script build:watch

clean

clean will remove all contents in the dist folder (but keeps the link from build:install).

npm run-script clean

prettier-format

prettier-format launch the prettier plugin based on the configuration here

npm run-script prettier-format

package

package generates a zip file containing the contents of the dist folder generated previously with the build command. Useful for those who want to manually load the module or want to create their own release

npm run-script package

Issues

Any issues, bugs, or feature requests are always welcome to be reported directly to the Issue Tracker, or using the Bug Reporter Module.

License

This package is under an GPL-3.0 License and the Foundry Virtual Tabletop Limited License Agreement for module development.

Credits