Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Jan 17, 2022
1 parent a0f9a0b commit 951973f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## Version 1.2.3
- Added API method:
- `openItemPileInventory` - forces a given set of users to open an item pile's inventory UI
- `ItemPiles.API.openItemPileInventory` - forces a given set of users to open an item pile's inventory UI
- Fixed API methods not accepting `Token` objects, will now properly cast to their `TokenDocument`
- Fixed hooks and macros not being called on item pile interaction
- Fixed various API methods being broken, oops

## Version 1.2.2 Hotfix
- Fixed hotkeys being broken on Foundry v9
Expand Down
14 changes: 7 additions & 7 deletions scripts/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ export default class API {
*
* @returns {Promise<array>} An array of objects, each containing the item that was added or updated, and the quantity that was added
*/
static async addItems(target, items, { interactionId = false }) {
static async addItems(target, items, { interactionId = false } = {}) {

const hookResult = Hooks.call(HOOKS.ITEM.PRE_ADD, target, items, interactionId);
if (hookResult === false) return;
Expand Down Expand Up @@ -966,7 +966,7 @@ export default class API {
*
* @returns {Promise<array>} An array of objects, each containing the item that was removed or updated, the quantity that was removed, and whether the item was deleted
*/
static async removeItems(target, items, { interactionId = false }) {
static async removeItems(target, items, { interactionId = false } = {}) {

const hookResult = Hooks.call(HOOKS.ITEM.PRE_REMOVE, target, items, interactionId);
if (hookResult === false) return;
Expand Down Expand Up @@ -1093,7 +1093,7 @@ export default class API {
*
* @returns {Promise<object>} An array of objects, each containing the item that was added or updated, and the quantity that was transferred
*/
static async transferItems(source, target, items, { interactionId = false }) {
static async transferItems(source, target, items, { interactionId = false } = {}) {

const hookResult = Hooks.call(HOOKS.ITEM.PRE_TRANSFER, source, target, items, interactionId);
if (hookResult === false) return;
Expand Down Expand Up @@ -1263,7 +1263,7 @@ export default class API {
* @returns {Promise<object>} An array containing a key value pair of the attribute path and the quantity of that attribute that was removed
*
*/
static async addAttributes(target, attributes, { interactionId = false }) {
static async addAttributes(target, attributes, { interactionId = false } = {}) {

const hookResult = Hooks.call(HOOKS.ATTRIBUTE.PRE_ADD, target, attributes, interactionId);
if (hookResult === false) return;
Expand Down Expand Up @@ -1346,7 +1346,7 @@ export default class API {
*
* @returns {Promise<object>} An array containing a key value pair of the attribute path and the quantity of that attribute that was removed
*/
static async removeAttributes(target, attributes, { interactionId = false }) {
static async removeAttributes(target, attributes, { interactionId = false } = {}) {

const hookResult = Hooks.call(HOOKS.ATTRIBUTE.PRE_REMOVE, target, attributes, interactionId);
if (hookResult === false) return;
Expand Down Expand Up @@ -1454,7 +1454,7 @@ export default class API {
*
* @returns {Promise<object>} An object containing a key value pair of each attribute transferred, the key being the attribute path and its value being the quantity that was transferred
*/
static async transferAttributes(source, target, attributes, { interactionId = false }) {
static async transferAttributes(source, target, attributes, { interactionId = false } = {}) {

const hookResult = Hooks.call(HOOKS.ATTRIBUTE.PRE_TRANSFER, source, target, attributes, interactionId);
if (hookResult === false) return;
Expand Down Expand Up @@ -1555,7 +1555,7 @@ export default class API {
*
* @returns {Promise<object>} An object containing a key value pair of each attribute transferred, the key being the attribute path and its value being the quantity that was transferred
*/
static async transferAllAttributes(source, target, { interactionId = false }) {
static async transferAllAttributes(source, target, { interactionId = false } = {}) {

const hookResult = Hooks.call(HOOKS.ATTRIBUTE.PRE_TRANSFER_ALL, source, target, interactionId);
if (hookResult === false) return;
Expand Down

0 comments on commit 951973f

Please sign in to comment.