-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Macro for same item name now creates (#314)
* fix: async restores treasure result text (#272) * fix: async restores treasure result text * fix: avoid race conditions with flag "async:false" * fix: Monster Data Model bugfixes (#279) * fix: On dropping item onto actor, check for existence before checking for anything related to containers * fix: Remove pre-container-data-model code for handling containers on monsters * fix: Programmers and linguists agree: Why Plurals? * fix: don't reroll on round 1 if already rolled (#280) * Create CNAME * docs: add Haxxer as a contributor for code (#281) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * fix(temporary): removed caching from the build ci * fix: AC/AAC display fix + party overview fix (#286) * fix: Add missing usesAscendingAC key * fix: Update deprecated code * fix: use game.system.id instead of OSE.systemName when getting party members * fix: Additional v1.7.x fixes (#289) * fix: Character generator now properly sets scores * fix: Items should once again properly display their descriptions. * fix: Treasure items should be created under the Treasure inventory heading * fix: Item and armor descriptions should target the correct fields * fix: replaced broken chart with "translated" badge * chore: update README to where people can find the Discord invite * feat: add Catalan and Chinese support to manifest * Updates to Item Piles system integration (#292) * Updates to system integration * Added unstackable item types * [enhancement] Added option to revert Ctrl/Meta behavior (#294) * [enhancement] Added option to revert Ctrl/Meta behavior * Extracted skipDialogCheck to method * Removed comment about monster testing. * Moved skipRollDialogcheck to helper collection * cleanup Co-authored-by: bakbakbakbakbak <[email protected]> * docs: add bakbakbakbakbak as a contributor for code (#302) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * docs: add adn770 as a contributor for translation (#303) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * [enhancement] Container delete confirmation (#299) * [enhancement] Added confirmation when deleting containers containing items * [fix] Container now pushes out containing items. * Changed to Dialog.confirm * Cleanup * cleanup * Allow first item check condition to allow no item Co-authored-by: bakbakbakbakbak <[email protected]> * fix: shopping cart now deducts gold * Remove confusing monster options (#308) Co-authored-by: bakbakbakbakbak <[email protected]> * [fix] Correctly creating link anchors in TextEditor & dragging items to hotbar (#304) * [fix] Use item.getDragData to fix bad link * [fix] Macro creation when dragging item from actor * Fixed macro warning for non-actor items * Tests for item macros * Cleanup * Unlinked token macro fix * Fixed typo in en.json * Fixed bug on row 67 * Non-destructive macro removal * Macro logic * Cleanup Co-authored-by: bakbakbakbakbak <[email protected]> * fix: Macro for same item name now creates Co-authored-by: Anthony Ronda <[email protected]> Co-authored-by: Tim <[email protected]> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Adam Oresten <[email protected]> Co-authored-by: bakbakbakbakbak <[email protected]>
- Loading branch information
1 parent
d268006
commit 01c0174
Showing
27 changed files
with
387 additions
and
119 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { createOseMacro } from '../../module/macros'; | ||
import { trashChat, waitForInput } from '../testUtils'; | ||
|
||
|
||
export const key = 'ose.actor.macro'; | ||
export const options = { | ||
displayName: 'The Character Sheet: Item Macros' | ||
}; | ||
|
||
export default ({ before, beforeEach, after, describe, it, expect, assert, ...context }) => { | ||
const testCharacterName = 'Quench Test Character'; | ||
const prepareActor = async (data) => { | ||
await trashChat(); | ||
await trashActor(); | ||
|
||
return Actor.create({ | ||
...data, | ||
name: testCharacterName, | ||
type: 'character' | ||
}); | ||
}; | ||
const testActor = () => game.actors.getName(testCharacterName); | ||
const trashActor = () => testActor()?.delete(); | ||
const trashMacro = async () => { | ||
await game.macros.find(o => o.name === "Test Macro Item")?.delete(); | ||
await game.user.assignHotbarMacro(null, 1); | ||
} | ||
const createItem = (type) => { return testActor()?.createEmbeddedDocuments("Item", [{ type: type, name: "Test Macro Item" }]) }; | ||
|
||
const createItemMacroData = (item) => { | ||
const dragData = item.toDragData(); | ||
dragData.item = item; | ||
dragData.type = "Item" | ||
return dragData | ||
}; | ||
|
||
const canCreate = async (type) => { | ||
await createItem(type); | ||
const item = testActor().items.contents[0]; | ||
const data = createItemMacroData(item); | ||
const macro = await createOseMacro(data, 1); | ||
await waitForInput(); | ||
|
||
const createdMacro = game.user.getHotbarMacros()[0]; | ||
expect(createdMacro?.macro?.command.indexOf("game.ose.rollItemMacro")).not.equal(-1) | ||
} | ||
|
||
before(async () => { | ||
await trashChat(); | ||
}) | ||
|
||
describe('Item Macro', () => { | ||
before(async () => { | ||
await prepareActor(); | ||
trashMacro(); | ||
}) | ||
|
||
after(async () => { | ||
await trashChat(); | ||
await trashActor(); | ||
}) | ||
|
||
afterEach(() => { | ||
trashMacro(); | ||
}) | ||
|
||
it('Create weapon macro', async () => { await canCreate("weapon") }) | ||
it('Create spell macro', async () => { await canCreate("spell") }) | ||
}) | ||
}; |
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
Oops, something went wrong.