-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39e10eb
commit a87b5c0
Showing
17 changed files
with
17,838 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Build obsidian plugin | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- "*" # Push events to matching any tag format, i.e. 1.0, 20.15.10 | ||
|
||
env: | ||
PLUGIN_NAME: obsidian-5e-statblocks # Change this to the name of your plugin-id folder | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "14.x" # You might need to adjust this value to your own version | ||
- name: Build | ||
id: build | ||
run: | | ||
npm install | ||
npm run build --if-present | ||
mkdir ${{ env.PLUGIN_NAME }} | ||
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }} | ||
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }} | ||
ls | ||
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: ${{ github.ref }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload zip file | ||
id: upload-zip | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./${{ env.PLUGIN_NAME }}.zip | ||
asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip | ||
asset_content_type: application/zip | ||
- name: Upload main.js | ||
id: upload-main | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./main.js | ||
asset_name: main.js | ||
asset_content_type: text/javascript | ||
- name: Upload manifest.json | ||
id: upload-manifest | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./manifest.json | ||
asset_name: manifest.json | ||
asset_content_type: application/json | ||
- name: Upload styles.css | ||
id: upload-css | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./styles.css | ||
asset_name: styles.css | ||
asset_content_type: text/css |
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,14 @@ | ||
# Intellij | ||
*.iml | ||
.idea | ||
|
||
# npm | ||
node_modules | ||
package-lock.json | ||
|
||
# build | ||
main.js | ||
*.js.map | ||
.DS_Store | ||
*build.js | ||
rollup.config-dev.js |
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,51 @@ | ||
type ability = | ||
| "strength" | ||
| "dexterity" | ||
| "constitution" | ||
| "intelligence" | ||
| "wisdom" | ||
| "charisma"; | ||
|
||
interface Monster { | ||
name: string; | ||
size: string; | ||
type: string; | ||
subtype: string; | ||
alignment: string; | ||
ac: number; | ||
hp: number; | ||
hit_dice?: string; | ||
speed: string; | ||
stats: [number, number, number, number, number, number]; | ||
saves?: { [K in ability]?: number }[]; | ||
skills?: { [key: string]: number }[]; | ||
damage_vulnerabilities: string; | ||
damage_resistances: string; | ||
damage_immunities: string; | ||
condition_immunities: string; | ||
senses: string; | ||
languages: string; | ||
cr: string | number; | ||
traits?: Trait[]; | ||
actions?: Trait[]; | ||
legendary_actions?: Trait[]; | ||
reactions?: Trait[]; | ||
} | ||
|
||
interface StatblockMonster | ||
extends Omit< | ||
Monster, | ||
"traits" | "actions" | "legendary_actions" | "reactions" | ||
> { | ||
traits: Map<string, Trait>; | ||
actions: Map<string, Trait>; | ||
legendary_actions: Map<string, Trait>; | ||
reactions: Map<string, Trait>; | ||
monster: string; | ||
} | ||
|
||
interface Trait { | ||
name: string; | ||
desc: string; | ||
[key: string]: any; | ||
} |
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,2 +1,158 @@ | ||
# obsidian-statblock | ||
Create Dungeons and Dragons style statblocks for Obsidian.md | ||
# Obsidian 5e Statblocks | ||
|
||
Create 5e-styled statblocks in Obsidian.md notes. | ||
|
||
<img src="https://raw.githubusercontent.com/valentine195/obsidian-statblock/master/images/example.png"> | ||
|
||
## Usage | ||
|
||
A statblock may be defined in a note using the syntax below. | ||
|
||
All fields are optional - if not provided, that Statblock will simply not render them. | ||
|
||
The `monster` field may be combined with other fields to override the field. See ![Overriding Fields](#Overriding-Fields). | ||
|
||
```` | ||
```statblock | ||
monster: <SRD Monster Name> | ||
``` | ||
```` | ||
|
||
OR | ||
|
||
```` | ||
```statblock | ||
name: string | ||
size: string | ||
type: string | ||
subtype: string | ||
alignment: string | ||
ac: number | ||
hp: number | ||
hit_dice: string | ||
speed: string | ||
stats: [number, number, number, number, number, number] | ||
saves: | ||
- <ability-score>: number | ||
skillsaves: | ||
- <skill-name>: number | ||
damage_vulnerabilities: string | ||
damage_resistances: string | ||
damage_immunities: string | ||
condition_immunities: string | ||
senses: string | ||
languages: string | ||
cr: number | ||
traits: | ||
- [<trait-name>, <trait-description>] | ||
- ... | ||
actions: | ||
- [<trait-name>, <trait-description>] | ||
- ... | ||
legendary_actions: | ||
- [<legendary_actions-name>, <legendary_actions-description>] | ||
- ... | ||
reactions: | ||
- [<reaction-name>, <reaction-description>] | ||
- ... | ||
``` | ||
```` | ||
|
||
### Overriding Fields | ||
|
||
The `monster` field may be combined with other fields to override the field of the specified SRD monster. For example: | ||
|
||
```` | ||
```statblock | ||
monster: Ancient Black Dragon | ||
name: Paarthurnax | ||
``` | ||
```` | ||
|
||
<img src="https://raw.githubusercontent.com/valentine195/obsidian-statblock/master/images/override.png"> | ||
|
||
### Full Example | ||
|
||
```` | ||
```statblock | ||
name: Ancient Black Dragon | ||
size: Gargantuan | ||
type: dragon | ||
subtype: | ||
alignment: chaotic evil | ||
ac: 22 | ||
hp: 367 | ||
hit_dice: 21d20 | ||
speed: 40 ft., fly 80 ft., swim 40 ft. | ||
stats: [27, 14, 25, 16, 15, 19] | ||
saves: | ||
- dexterity: 9 | ||
- constitution: 14 | ||
- wisdom: 9 | ||
- charisma: 11 | ||
skills: | ||
- perception: 16 | ||
- stealth: 9 | ||
damage_vulnerabilities: | ||
damage_resistances: | ||
damage_immunities: acid | ||
condition_immunities: | ||
senses: blindsight 60 ft., darkvision 120 ft., passive Perception 26 | ||
languages: Common, Draconic | ||
cr: 21 | ||
traits: | ||
- [Amphibious, The dragon can breathe air and water.] | ||
- [Legendary Resistance (3/Day), If the dragon fails a saving throw, it can choose to succeed instead.] | ||
actions: | ||
- [Multiattack, The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.] | ||
- [Bite, Melee Weapon Attack:+ 15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 9 (2d8) acid damage.] | ||
- [Claw, Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.] | ||
- [Tail, Melee Weapon Attack: +15 to hit, reach 20 ft ., one target. Hit: 17 (2d8 + 8) bludgeoning damage.] | ||
- [Frightful Presence, Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.] | ||
- [Acid Breath (Recharge 5-6), The dragon exhales acid in a 90-foot line that is 10 feet wide. Each creature in that line must make a DC 22 Dexterity saving throw, taking 67 (15d8) acid damage on a failed save, or half as much damage on a successful one.] | ||
reactions: | ||
legendary_actions: | ||
- [Detect, The dragon makes a Wisdom (Perception) check.] | ||
- [Tail Attack, The dragon makes a tail attack.] | ||
- [Wing Attack (Costs 2 Actions), The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.] | ||
``` | ||
```` | ||
|
||
# Installation | ||
|
||
<!-- ## From within Obsidian | ||
From Obsidian v0.9.8, you can activate this plugin within Obsidian by doing the following: | ||
- Open Settings > Third-party plugin | ||
- Make sure Safe mode is **off** | ||
- Click Browse community plugins | ||
- Search for this plugin | ||
- Click Install | ||
- Once installed, close the community plugins window and activate the newly installed plugin --> | ||
|
||
## From GitHub | ||
|
||
- Download the Latest Release from the Releases section of the GitHub Repository | ||
- Extract the plugin folder from the zip to your vault's plugins folder: `<vault>/.obsidian/plugins/` | ||
Note: On some machines the `.obsidian` folder may be hidden. On MacOS you should be able to press `Command+Shift+Dot` to show the folder in Finder. | ||
- Reload Obsidian | ||
- If prompted about Safe Mode, you can disable safe mode and enable the plugin. | ||
Otherwise head to Settings, third-party plugins, make sure safe mode is off and | ||
enable the plugin from there. | ||
|
||
### Updates | ||
|
||
You can follow the same procedure to update the plugin | ||
|
||
# Warning | ||
|
||
This plugin comes with no guarantee of stability and bugs may delete data. | ||
Please ensure you have automated backups. | ||
|
||
# TTRPG plugins | ||
|
||
If you're using Obsidian to run/plan a TTRPG, you may find my other plugin useful: | ||
|
||
- [Obsidian Leaflet](https://github.com/valentine195/obsidian-leaflet-plugin) - Add interactive maps to Obsidian.md notes | ||
- [Dice Roller](https://github.com/valentine195/obsidian-dice-roller) - Inline dice rolling for Obsidian.md |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,10 @@ | ||
{ | ||
"id": "obsidian-5e-statblocks", | ||
"name": "5e Statblocks", | ||
"version": "0.0.1", | ||
"description": "Create 5e styled statblocks in Obsidian.md", | ||
"minAppVersion": "0.12.0", | ||
"author": "Jeremy Valentine", | ||
"authorUrl": "", | ||
"isDesktopOnly": false | ||
} |
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,24 @@ | ||
{ | ||
"name": "obsidian-5e-statblocks", | ||
"version": "0.0.1", | ||
"description": "Create 5e styled statblocks in Obsidian.md", | ||
"main": "main.js", | ||
"scripts": { | ||
"dev": "rollup --config rollup.config-dev.js -w", | ||
"build": "rollup --config rollup.config.js" | ||
}, | ||
"keywords": [], | ||
"author": "Jeremy Valentine", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@rollup/plugin-typescript": "^6.0.0", | ||
"@types/node": "^14.14.2", | ||
"obsidian": "https://github.com/obsidianmd/obsidian-api/tarball/master", | ||
"rollup": "^2.32.1", | ||
"rollup-plugin-css-only": "^3.1.0", | ||
"tslib": "^2.0.3", | ||
"typescript": "^4.0.3" | ||
} | ||
} |
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,30 @@ | ||
import typescript from '@rollup/plugin-typescript'; | ||
import {nodeResolve} from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import css from "rollup-plugin-css-only"; | ||
|
||
const banner = | ||
`/* | ||
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP | ||
if you want to view the source visit the plugins github repository | ||
*/ | ||
`; | ||
|
||
export default { | ||
input: './src/main.ts', | ||
output: { | ||
dir: '.', | ||
sourcemap: 'inline', | ||
sourcemapExcludeSources: true, | ||
format: 'cjs', | ||
exports: 'default', | ||
banner, | ||
}, | ||
external: ['obsidian'], | ||
plugins: [ | ||
typescript(), | ||
nodeResolve({browser: true}), | ||
commonjs(), | ||
css({ output: "styles.css" }), | ||
] | ||
}; |
Oops, something went wrong.