Skip to content

Commit

Permalink
修复无法加载问题
Browse files Browse the repository at this point in the history
  • Loading branch information
EternalRider committed Mar 1, 2024
1 parent be522b1 commit a936536
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 25 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
## 使用效果
![91e50d2666d93105a8bca089ff61403b](https://github.com/EternalRider/spellbook/assets/46736326/fbbde62e-4171-441f-bb99-10a8bdcb7050)


## 操作方式
### 准备槽
#### 法术槽
Expand Down Expand Up @@ -34,3 +33,10 @@
#### 页边
- 双击左侧页边:向前翻一页。
- 双击右侧页边:向后翻一页。

## API
```
const spellbook = game.modules.get('spellbook')?.api
spellbook.openSpellSlot(actor,type);
spellbook.openSpellBook(item);
```
6 changes: 4 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "spellbook",
"title": "法术书",
"description": "提供一个独立于系统的法术书界面。",
"version": "1.0.1",
"version": "1.0.2",
"author": "EternalRider",
"dependencies": [
{
Expand All @@ -14,7 +14,9 @@
"socket": true,
"esmodules": ["./scripts/init.js"],
"scripts": [],
"styles": [],
"styles": [
"./styles/module.css"
],
"packs": [],
"url": "https://github.com/EternalRider/spellbook",
"minimumCoreVersion": "11",
Expand Down
45 changes: 25 additions & 20 deletions scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Hooks.once('init', function () {
game.modules.get(MODULE_ID).api = Utilities; // 之后可被如此调用: const spellbook = game.modules.get('spellbook')?.api;
// game.modules.get(moduleName).const = { };
// SpellBookToolBar.init();

console.log('SpellBook | Initializing SpellBook');
});

// Hooks.once("socketlib.ready", () => {
Expand All @@ -15,26 +17,29 @@ Hooks.once('init', function () {

Hooks.on('ready', () => {
register_settings();
});

Hooks.on('getItemSheetHeaderButtons', (sheet, buttons) => {
if (game.settings.get(MODULE_ID, 'showItemButton') ?? false) {
buttons.unshift({
class: MODULE_ID + '-item-config',
label: '法术书',
icon: 'fa-regular fa-book-open-cover',
onclick: () => Utilities.configItem(sheet.item)
});
}
Hooks.on('getItemSheetHeaderButtons', (sheet, buttons) => {
if (game.settings.get(MODULE_ID, 'showItemButton') ?? false) {
buttons.unshift({
class: MODULE_ID + '-item-config',
label: '法术书',
icon: 'fa-regular fa-book-open-cover',
onclick: () => Utilities.configItem(sheet.item)
});
}
});

Hooks.on('getActorSheetHeaderButtons', (sheet, buttons) => {
if (game.settings.get(MODULE_ID, 'showActorButton') ?? false) {
buttons.unshift({
class: MODULE_ID + '-prepare-slot',
label: '准备槽',
icon: 'fa-regular fa-book-open-cover',
onclick: () => Utilities.openSpellSlot(sheet.actor, game.settings.get(MODULE_ID, 'defaultType') ?? "")
});
}
});

console.log('SpellBook | Ready');
});

Hooks.on('getActorSheetHeaderButtons', (sheet, buttons) => {
if (game.settings.get(MODULE_ID, 'showActorButton') ?? false) {
buttons.unshift({
class: MODULE_ID + '-prepare-slot',
label: '准备槽',
icon: 'fa-regular fa-book-open-cover',
onclick: () => Utilities.openPrepareSlot(sheet.actor, game.settings.get(MODULE_ID, 'defaultType') ?? "")
});
}
});
2 changes: 1 addition & 1 deletion scripts/settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* globals game, FormApplication, $ */

import * as CONST from './constants.js'
// import * as CONST from './constants.js'
const MODULE_ID = 'spellbook';

// export const settingVariables = [
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as CONST from './constants.js'
// import * as CONST from './constants.js'
const MODULE_ID = 'spellbook';
import { PreparSlot } from "./function/prepar-slot.js";
import { SpellBook } from "./function/spell-book.js";
Expand Down

0 comments on commit a936536

Please sign in to comment.