mirror of
https://github.com/ericaxu/gemmy.git
synced 2026-07-22 07:30:31 +00:00
✨ Add documentation to Granite (#11)
This commit is contained in:
parent
e3544e814b
commit
5b12e16381
16 changed files with 608 additions and 83 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -16,7 +16,7 @@ main.js
|
|||
*.map
|
||||
|
||||
# obsidian
|
||||
data.json
|
||||
.obsidian
|
||||
|
||||
# Exclude macOS Finder (System Explorer) View States
|
||||
.DS_Store
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@ node_modules
|
|||
.github
|
||||
package-lock.json
|
||||
main.js
|
||||
src/quotes/quotes.ts
|
||||
|
|
|
|||
1
LICENSE
1
LICENSE
|
|
@ -1,6 +1,7 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Erica Xu
|
||||
Copyright (c) 2023 Obsidian TTRPG Community and Collaborators
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
314
docs/Adding-animation-to-plugin-source.md
Normal file
314
docs/Adding-animation-to-plugin-source.md
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
# Adding your new animations to the plugin code
|
||||
|
||||
This guide walks you step-by-step for adding your created animations into the source code.
|
||||
|
||||
Each file where you need to add your additions will include commented templates to make the process easier.
|
||||
|
||||
For this pages examples, I will use the following popular character: Pikachu.
|
||||
|
||||
> 👿 Please DO NOT add a Pikachu animation to a public copy of this plugin.
|
||||
|
||||
## 1. Adding quotes to QuoteManager.ts
|
||||
|
||||
> ⚠ If you have not already added your new character's quote lines in [Quotes](Quotes.ts), do that first. You can find instructions in [Adding quotes to Granite](Adding-quotes-to-Granite.md).
|
||||
|
||||
To have your characters say something within Granite, we need to tell the plugin to add its quotes. In [QuoteManager.ts](QuoteManager.ts), you will first want to import the quotes you created in [Quotes.ts](Quotes.ts).
|
||||
|
||||
### Imports
|
||||
|
||||
Underneath the import section, add your new character to the import list.
|
||||
|
||||
**Before**:
|
||||
|
||||
```ts
|
||||
import GranitePlugin from './main';
|
||||
import { AnimationSourceType } from './Setting';
|
||||
import { GraniteMode, GraniteState } from './Granite';
|
||||
import { DRAKE_EXCLUSIVE_QUOTES, GEMMY_EXCLUSIVE_QUOTES, GRANITE_BASE_QUOTES, Quotes } from './quotes/Quotes';
|
||||
```
|
||||
|
||||
**After**:
|
||||
|
||||
```ts
|
||||
import GranitePlugin from './main';
|
||||
import { AnimationSourceType } from './Setting';
|
||||
import { GraniteMode, GraniteState } from './Granite';
|
||||
import { PIKACHU_EXCLUSIVE_QUOTES, DRAKE_EXCLUSIVE_QUOTES, GEMMY_EXCLUSIVE_QUOTES, GRANITE_BASE_QUOTES, Quotes } from './quotes/Quotes';
|
||||
```
|
||||
|
||||
|
||||
### Quotemap
|
||||
|
||||
In the QuoteManager class, you will want to add your new character to the quote map.
|
||||
|
||||
**Before**:
|
||||
|
||||
```ts
|
||||
constructor(plugin: GranitePlugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
this.quoteMap = {
|
||||
[AnimationSourceType.GEMMY]: {
|
||||
[GraniteMode.IDLE]: this.getIdleQuotes(GEMMY_EXCLUSIVE_QUOTES),
|
||||
[GraniteMode.WRITING]: this.getWritingQuotes(GEMMY_EXCLUSIVE_QUOTES),
|
||||
},
|
||||
[AnimationSourceType.DRAKE]: {
|
||||
[GraniteMode.IDLE]: this.getIdleQuotes(DRAKE_EXCLUSIVE_QUOTES),
|
||||
[GraniteMode.WRITING]: this.getWritingQuotes(DRAKE_EXCLUSIVE_QUOTES),
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
**After**:
|
||||
|
||||
```ts
|
||||
constructor(plugin: GranitePlugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
this.quoteMap = {
|
||||
[AnimationSourceType.GEMMY]: {
|
||||
[GraniteMode.IDLE]: this.getIdleQuotes(GEMMY_EXCLUSIVE_QUOTES),
|
||||
[GraniteMode.WRITING]: this.getWritingQuotes(GEMMY_EXCLUSIVE_QUOTES),
|
||||
},
|
||||
[AnimationSourceType.DRAKE]: {
|
||||
[GraniteMode.IDLE]: this.getIdleQuotes(DRAKE_EXCLUSIVE_QUOTES),
|
||||
[GraniteMode.WRITING]: this.getWritingQuotes(DRAKE_EXCLUSIVE_QUOTES),
|
||||
},
|
||||
};
|
||||
[AnimationSourceType.PIKACHU]: {
|
||||
[GraniteMode.IDLE]: this.getIdleQuotes(PIKACHU_EXCLUSIVE_QUOTES),
|
||||
[GraniteMode.WRITING]: this.getWritingQuotes(PIKACHU_EXCLUSIVE_QUOTES),
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## 2. Import your animations into Animations.ts
|
||||
|
||||
To add your newly created animations into Granite to be rendered, we need to tell the plugin to process the gifs.
|
||||
|
||||
### Imports
|
||||
|
||||
Under the import section, we need to map a value to the animations.
|
||||
|
||||
**Before**:
|
||||
```ts
|
||||
// Draconic Animations
|
||||
import EMERGE_MOTION_DRAKE from '../animations/drake/drake_emerge.gif';
|
||||
import POP_MOTION_DRAKE from '../animations/drake/drake_pop.gif';
|
||||
import DISAPPEAR_MOTION_DRAKE from '../animations/drake/drake_disappear.gif';
|
||||
import ANGRY_MOTION_DRAKE from '../animations/drake/drake_angry.gif';
|
||||
import LOOK_MOTION_DRAKE from '../animations/drake/drake_lookAround.gif';
|
||||
import IDLE_MOTION_DRAKE from '../animations/drake/drake_idle.gif';
|
||||
import DISAPPOINT_IMG_DRAKE from '../animations/drake/drake_disappoint.gif';
|
||||
```
|
||||
|
||||
After:
|
||||
```ts
|
||||
// Draconic Animations
|
||||
import EMERGE_MOTION_DRAKE from '../animations/PIKACHU/PIKACHU_emerge.gif';
|
||||
import POP_MOTION_DRAKE from '../animations/PIKACHU/PIKACHU_pop.gif';
|
||||
import DISAPPEAR_MOTION_DRAKE from '../animations/drake/drake_disappear.gif';
|
||||
import ANGRY_MOTION_DRAKE from '../animations/drake/drake_angry.gif';
|
||||
import LOOK_MOTION_DRAKE from '../animations/drake/drake_lookAround.gif';
|
||||
import IDLE_MOTION_DRAKE from '../animations/drake/drake_idle.gif';
|
||||
import DISAPPOINT_IMG_DRAKE from '../animations/drake/drake_disappoint.gif';
|
||||
|
||||
// Pikachu Animations
|
||||
import EMERGE_MOTION_PIKACHU from '../animations/drake/drake_emerge.gif';
|
||||
import POP_MOTION_PIKACHU from '../animations/drake/drake_pop.gif';
|
||||
import DISAPPEAR_MOTION_PIKACHU from '../animations/drake/pikachu_disappear.gif';
|
||||
import ANGRY_MOTION_PIKACHU from '../animations/pikachu/pikachu_angry.gif';
|
||||
import LOOK_MOTION_PIKACHU from '../animations/pikachu/pikachu_lookAround.gif';
|
||||
import IDLE_MOTION_PIKACHU from '../animations/pikachu/pikachu_idle.gif';
|
||||
import DISAPPOINT_IMG_PIKACHU from '../animations/pikachu/pikachu_disappoint.gif';
|
||||
```
|
||||
|
||||
### Animations class
|
||||
|
||||
Within the animations export class, you will want to add your animation map.
|
||||
|
||||
**Before**:
|
||||
```ts
|
||||
// the mappings from an animation type to an actual image file for the drakeling
|
||||
public readonly drakeAnimationMap: Record<AnimationType, string>;
|
||||
```
|
||||
|
||||
**After**:
|
||||
```ts
|
||||
// the mappings from an animation type to an actual image file for the pikachu
|
||||
public readonly pikachuAnimationMap: Record<AnimationType, string>;
|
||||
// the mappings from an animation type to an actual image file for the drakeling
|
||||
public readonly drakeAnimationMap: Record<AnimationType, string>;
|
||||
```
|
||||
|
||||
|
||||
### Animation Map
|
||||
|
||||
Then further down, define the animation map.
|
||||
|
||||
**Before**:
|
||||
|
||||
```ts
|
||||
constructor(plugin: GranitePlugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
this.drakeAnimationMap = {
|
||||
[AnimationType.EMERGE]: EMERGE_MOTION_DRAKE,
|
||||
[AnimationType.POP_MOTION]: POP_MOTION_DRAKE,
|
||||
[AnimationType.DISAPPEAR_MOTION]: DISAPPEAR_MOTION_DRAKE,
|
||||
[AnimationType.ANGRY_MOTION]: ANGRY_MOTION_DRAKE,
|
||||
[AnimationType.LOOK_MOTION]: LOOK_MOTION_DRAKE,
|
||||
[AnimationType.IDLE_MOTION]: IDLE_MOTION_DRAKE,
|
||||
[AnimationType.DISAPPOINT_IMG]: DISAPPOINT_IMG_DRAKE,
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
**After**:
|
||||
|
||||
```ts
|
||||
constructor(plugin: GranitePlugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
this.pikachuAnimationMap = {
|
||||
[AnimationType.EMERGE]: EMERGE_MOTION_PIKACHU,
|
||||
[AnimationType.POP_MOTION]: POP_MOTION_PIKACHU,
|
||||
[AnimationType.DISAPPEAR_MOTION]: DISAPPEAR_MOTION_PIKACHU,
|
||||
[AnimationType.ANGRY_MOTION]: ANGRY_MOTION_PIKACHU,
|
||||
[AnimationType.LOOK_MOTION]: LOOK_MOTION_PIKACHU,
|
||||
[AnimationType.IDLE_MOTION]: IDLE_MOTION_PIKACHU,
|
||||
[AnimationType.DISAPPOINT_IMG]: DISAPPOINT_IMG_PIKACHU,
|
||||
};
|
||||
|
||||
this.drakeAnimationMap = {
|
||||
[AnimationType.EMERGE]: EMERGE_MOTION_DRAKE,
|
||||
[AnimationType.POP_MOTION]: POP_MOTION_DRAKE,
|
||||
[AnimationType.DISAPPEAR_MOTION]: DISAPPEAR_MOTION_DRAKE,
|
||||
[AnimationType.ANGRY_MOTION]: ANGRY_MOTION_DRAKE,
|
||||
[AnimationType.LOOK_MOTION]: LOOK_MOTION_DRAKE,
|
||||
[AnimationType.IDLE_MOTION]: IDLE_MOTION_DRAKE,
|
||||
[AnimationType.DISAPPOINT_IMG]: DISAPPOINT_IMG_DRAKE,
|
||||
};
|
||||
```
|
||||
|
||||
### Source Map
|
||||
|
||||
And right below that, add your character to the source map.
|
||||
|
||||
**Before**:
|
||||
|
||||
```ts
|
||||
this.animationSourceMap = {
|
||||
[AnimationSourceType.DRAKE]: this.drakeAnimationMap,
|
||||
[AnimationSourceType.GEMMY]: this.gemmyAnimationMap,
|
||||
};
|
||||
```
|
||||
|
||||
**After**:
|
||||
|
||||
```ts
|
||||
this.animationSourceMap = {
|
||||
[AnimationSourceType.PIKACHU]: this.pikachuAnimationMap,
|
||||
[AnimationSourceType.DRAKE]: this.drakeAnimationMap,
|
||||
[AnimationSourceType.GEMMY]: this.gemmyAnimationMap,
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## 3. Update Settings.ts
|
||||
|
||||
Now we need to make it so that you can toggle which character to use in your settings.
|
||||
|
||||
### AnimationSourceType
|
||||
|
||||
In the animation source type section, we need to define the name of the character for the animations we have loaded thus far.
|
||||
|
||||
**Before**:
|
||||
|
||||
```ts
|
||||
export enum AnimationSourceType {
|
||||
GEMMY = 'gemmy',
|
||||
DRAKE = 'drake',
|
||||
```
|
||||
|
||||
**After**:
|
||||
|
||||
```ts
|
||||
export enum AnimationSourceType {
|
||||
GEMMY = 'gemmy',
|
||||
DRAKE = 'drake',
|
||||
PIKACHU = 'pikachu',
|
||||
```
|
||||
|
||||
### PluginSettingsTab
|
||||
|
||||
Now, we add the new character to the dropdown list.
|
||||
|
||||
**Before**:
|
||||
|
||||
```ts
|
||||
.addDropdown(dropdown =>
|
||||
dropdown
|
||||
.addOption(AnimationSourceType.GEMMY, 'Gemmy')
|
||||
.addOption(AnimationSourceType.DRAKE, 'Drake')
|
||||
```
|
||||
|
||||
**After**:
|
||||
|
||||
```ts
|
||||
.addDropdown(dropdown =>
|
||||
dropdown
|
||||
.addOption(AnimationSourceType.GEMMY, 'Gemmy')
|
||||
.addOption(AnimationSourceType.DRAKE, 'Drake')
|
||||
.addOption(AnimationSourceType.PIKACHU, 'Pikachu')
|
||||
```
|
||||
|
||||
## 4. Update Main.ts
|
||||
|
||||
This last update will tell Granite what to load based on the settings provided.
|
||||
|
||||
### Async loadsettings
|
||||
|
||||
Before:
|
||||
|
||||
```ts
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
|
||||
// migrations
|
||||
// @ts-ignore
|
||||
if (this.settings.animationSource === 'dragon') {
|
||||
this.settings.animationSource = AnimationSourceType.DRAKE;
|
||||
}
|
||||
// @ts-ignore
|
||||
if (this.settings.animationSource === 'original') {
|
||||
this.settings.animationSource = AnimationSourceType.GEMMY;
|
||||
}
|
||||
|
||||
await this.saveSettings();
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
```ts
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
|
||||
// migrations
|
||||
if (this.settings.animationSource === 'rat') {
|
||||
this.settings.animationSource = AnimationSourceType.PIKACHU;
|
||||
}
|
||||
// @ts-ignore
|
||||
if (this.settings.animationSource === 'dragon') {
|
||||
this.settings.animationSource = AnimationSourceType.DRAKE;
|
||||
}
|
||||
// @ts-ignore
|
||||
if (this.settings.animationSource === 'original') {
|
||||
this.settings.animationSource = AnimationSourceType.GEMMY;
|
||||
}
|
||||
|
||||
await this.saveSettings();
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
47
docs/Adding-animations-to-Granite.md
Normal file
47
docs/Adding-animations-to-Granite.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# Adding animations to Granite Plugin
|
||||
|
||||
This page gives the overall guidelines on what an animation needs to be to be successful in this plugin.
|
||||
|
||||
## What format do these need to be in?
|
||||
|
||||
All animations need to be in a `.gif` format.
|
||||
|
||||
## Supported Emotes
|
||||
|
||||
Granite supports a few different character emotes within the plugin.
|
||||
|
||||
- Angry
|
||||
- Disappear
|
||||
- Disappoint
|
||||
- Emerge
|
||||
- Idle
|
||||
- Look Around
|
||||
- Pop
|
||||
|
||||
## How long is each animation?
|
||||
|
||||
- Angry is 1.92 seconds
|
||||
- Disappear is 1.92 seconds
|
||||
- Disappoint is 0.16 seconds
|
||||
- Emerge is 3.84 seconds
|
||||
- Idle is 7.3 seconds
|
||||
- Look Around is 6.4 seconds
|
||||
- Pop is 1.92 seconds
|
||||
|
||||
## Where to place the animated gifs
|
||||
|
||||
These animations are stored in `animations/name` where name is the name of the character.
|
||||
|
||||
**Example**: As of writing this, Granite plugin has two characters: `gemmy` and `drake`. Gemmy's animations are located in `animations/gemmy` and Drake's animations are located in `animations/drake`.
|
||||
|
||||
## What naming convention should I use?
|
||||
|
||||
The animations need to be in lower case text.
|
||||
|
||||
Additionally, the animations need to be named charactername_emote.gif, to match the emote they are for.
|
||||
|
||||
Example: `gemmy_angry.gif` is the angry animation for Gemmy.
|
||||
|
||||
## How do I add them to the plugin itself?
|
||||
|
||||
See [Adding animations to plugin details](Adding-animation-to-plugin-source.md).
|
||||
60
docs/Adding-quotes-to-Granite.md
Normal file
60
docs/Adding-quotes-to-Granite.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
# Adding quotes to Granite Plugin
|
||||
|
||||
All quotes are handled in [Quotes,ts](src/quotes/Quotes.ts).
|
||||
This file is a javascript array of objects, with each section controlling a certain character.
|
||||
|
||||
Quotes are grouped under `Base Quotes`, and individual `Character Quotes`.
|
||||
They are grouped further by `General`, `Idle`, and `Writing Mode` quotes.
|
||||
|
||||
## Adding quotes to an existing character
|
||||
|
||||
1. Open [Quotes.ts](src/quotes/Quotes.ts) and find the character you want to edit.
|
||||
2. Determine if you are editing a general quote, idle quote, or writing mode quote.
|
||||
3. In the section that you want to add your line to, use the following formatting to add your line:
|
||||
|
||||
```json
|
||||
`You are a background character in your own life.`,
|
||||
```
|
||||
|
||||
How this may look in its `.json` file:
|
||||
|
||||
```json
|
||||
"general": [
|
||||
"You are a background character in your own life.",
|
||||
],
|
||||
```
|
||||
|
||||
|
||||
Some rules of thumb:
|
||||
- Every quote line needs to end with a comma `,`.
|
||||
- Every quote line needs to be surrounded by double quotes `"`.
|
||||
|
||||
## Adding a new character
|
||||
|
||||
To add a new character into the quotes, you can add the following to the bottom of [Quotes.ts](src/quotes/Quotes.ts):
|
||||
|
||||
**Before**:
|
||||
|
||||
```ts
|
||||
export const DRAKE_EXCLUSIVE_QUOTES: Quotes = {
|
||||
general: [],
|
||||
idle: [],
|
||||
writingMode: [],
|
||||
};
|
||||
```
|
||||
|
||||
**After**:
|
||||
|
||||
```ts
|
||||
export const DRAKE_EXCLUSIVE_QUOTES: Quotes = {
|
||||
general: [],
|
||||
idle: [],
|
||||
writingMode: [],
|
||||
};
|
||||
export const PIKACHU_EXCLUSIVE_QUOTES: Quotes = {
|
||||
general: [],
|
||||
idle: [],
|
||||
writingMode: [],
|
||||
};
|
||||
```
|
||||
21
docs/README.md
Normal file
21
docs/README.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Developing Granite plugin
|
||||
|
||||
These documents go over the more advanced features of adding to and developing Granite.
|
||||
|
||||
## Guides
|
||||
|
||||
1. [Adding quotes to Granite](Adding-quotes-to-Granite.md)
|
||||
2. [Adding animations to Granite](Adding-animations-to-Granite.md)
|
||||
3. [Adding animation to plugin source files](Adding-animation-to-plugin-source.md)
|
||||
|
||||
## Developer environment
|
||||
|
||||
Granite is NPM enabled. You can retrieve the packages needed by using `npm -i D`.
|
||||
|
||||
To auto-build the plugin while you are adding changes, you can use the following command in your terminal/IDE of choice: `npm run dev`.
|
||||
|
||||
If you wish to specify a different output file for the built `main.js`, then add a `.env` file in the root directory of your fork, and add the following to the file:
|
||||
|
||||
`OUTDIR="/absolute/path/to/your/vault/.obsidian/plugins/Granite"`
|
||||
|
||||
This way, you can reload Obsidian and see your updated changes. You may also utilize the [Hot Reload](https://github.com/pjeby/hot-reload) to reload Obsidian for you.
|
||||
79
main.js
79
main.js
File diff suppressed because one or more lines are too long
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
"id": "granite",
|
||||
"name": "Granite",
|
||||
"version": "0.1.1",
|
||||
"minAppVersion": "0.19.0",
|
||||
"version": "0.1.2",
|
||||
"minAppVersion": "1.4.0",
|
||||
"description": "A Goal Reinforcing And Note Improving Tiny Entity",
|
||||
"author": "Obsidian, and the Obsidian TTRPG Community",
|
||||
"author": "Obsidian Team, and the Obsidian TTRPG Community",
|
||||
"authorUrl": "https://github.com/Obsidian-TTRPG-Community/gemmy_ttrpg",
|
||||
"fundingUrl": "",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
"format": "prettier --write ."
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Obsidian TTRPG Community",
|
||||
"author": "Obsidian, and the Obsidian TTRPG Community",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.6",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,17 @@ import LOOK_MOTION_DRAKE from '../animations/drake/drake_lookAround.gif';
|
|||
import IDLE_MOTION_DRAKE from '../animations/drake/drake_idle.gif';
|
||||
import DISAPPOINT_IMG_DRAKE from '../animations/drake/drake_disappoint.gif';
|
||||
|
||||
// Importing a new character? Copy the below and change the NAME with your character name.
|
||||
//
|
||||
// Name Animations
|
||||
// import EMERGE_MOTION_NAME from '../animations/name/name_emerge.gif';
|
||||
// import POP_MOTION_NAME from '../animations/name/name_pop.gif';
|
||||
// import DISAPPEAR_MOTION_NAME from '../animations/name/name_disappear.gif';
|
||||
// import ANGRY_MOTION_NAME from '../animations/name/name_angry.gif';
|
||||
// import LOOK_MOTION_NAME from '../animations/name/name_lookAround.gif';
|
||||
// import IDLE_MOTION_NAME from '../animations/name/name_idle.gif';
|
||||
// import DISAPPOINT_IMG_NAME from '../animations/name/name_disappoint.gif';
|
||||
|
||||
export enum AnimationType {
|
||||
EMERGE = 'emerge',
|
||||
POP_MOTION = 'pop_motion',
|
||||
|
|
@ -32,6 +43,10 @@ export enum AnimationType {
|
|||
export class Animations {
|
||||
public readonly plugin: GranitePlugin;
|
||||
|
||||
// Copy and paste this below, where name is your new character name.
|
||||
// the mappings from an animation type to an actual image file for the name
|
||||
// public readonly nameAnimationMap: Record<AnimationType, string>;
|
||||
|
||||
// the mappings from an animation type to an actual image file for the drakeling
|
||||
public readonly drakeAnimationMap: Record<AnimationType, string>;
|
||||
// the mappings from an animation type to an actual image file for the granite
|
||||
|
|
@ -43,6 +58,19 @@ export class Animations {
|
|||
constructor(plugin: GranitePlugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
// Add your character to the animation map.
|
||||
// Replace name with your new character's name.
|
||||
//
|
||||
// this.nameAnimationMap = {
|
||||
// [AnimationType.EMERGE]: EMERGE_MOTION_NAME,
|
||||
// [AnimationType.POP_MOTION]: POP_MOTION_NAME,
|
||||
// [AnimationType.DISAPPEAR_MOTION]: DISAPPEAR_MOTION_NAME,
|
||||
// [AnimationType.ANGRY_MOTION]: ANGRY_MOTION_NAME,
|
||||
// [AnimationType.LOOK_MOTION]: LOOK_MOTION_NAME,
|
||||
// [AnimationType.IDLE_MOTION]: IDLE_MOTION_NAME,
|
||||
// [AnimationType.DISAPPOINT_IMG]: DISAPPOINT_IMG_NAME,
|
||||
// };
|
||||
|
||||
this.drakeAnimationMap = {
|
||||
[AnimationType.EMERGE]: EMERGE_MOTION_DRAKE,
|
||||
[AnimationType.POP_MOTION]: POP_MOTION_DRAKE,
|
||||
|
|
@ -64,6 +92,8 @@ export class Animations {
|
|||
};
|
||||
|
||||
this.animationSourceMap = {
|
||||
// Add your character to the animation source map, where name is your character name.
|
||||
// [AnimationSourceType.NAME]: this.nameAnimationMap,
|
||||
[AnimationSourceType.DRAKE]: this.drakeAnimationMap,
|
||||
[AnimationSourceType.GEMMY]: this.gemmyAnimationMap,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import GranitePlugin from './main';
|
|||
import { AnimationSourceType } from './Setting';
|
||||
import { GraniteMode, GraniteState } from './Granite';
|
||||
import { DRAKE_EXCLUSIVE_QUOTES, GEMMY_EXCLUSIVE_QUOTES, GRANITE_BASE_QUOTES, Quotes } from './quotes/Quotes';
|
||||
// When you need to add a character, add the following to the above: NAME_EXCLUSIVE_QUOTES,
|
||||
// Example import { NAME_EXCLUSIVE_QUOTES, DRAKE_EXCLUSIVE_QUOTES, GEMMY_EXCLUSIVE_QUOTES, GRANITE_BASE_QUOTES, Quotes } from './quotes/Quotes';
|
||||
|
||||
export class QuoteManager {
|
||||
public readonly plugin: GranitePlugin;
|
||||
|
|
@ -20,6 +22,13 @@ export class QuoteManager {
|
|||
[GraniteMode.IDLE]: this.getIdleQuotes(DRAKE_EXCLUSIVE_QUOTES),
|
||||
[GraniteMode.WRITING]: this.getWritingQuotes(DRAKE_EXCLUSIVE_QUOTES),
|
||||
},
|
||||
// Copy and paste below to add your character's source here.
|
||||
// Replace NAME with your new character's name
|
||||
//
|
||||
// [AnimationSourceType.NAME]: {
|
||||
// [GraniteMode.IDLE]: this.getIdleQuotes(NAME_EXCLUSIVE_QUOTES),
|
||||
// [GraniteMode.WRITING]: this.getWritingQuotes(NAME_EXCLUSIVE_QUOTES),
|
||||
// },
|
||||
};
|
||||
|
||||
console.log('granite | build quote map', this.quoteMap);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import GranitePlugin from './main';
|
|||
export enum AnimationSourceType {
|
||||
GEMMY = 'gemmy',
|
||||
DRAKE = 'drake',
|
||||
// When you need to add a new character, add the following above:
|
||||
// NAME = 'name',
|
||||
}
|
||||
|
||||
export interface GraniteSettings {
|
||||
|
|
@ -41,6 +43,8 @@ export class GraniteSettingsTab extends PluginSettingTab {
|
|||
dropdown
|
||||
.addOption(AnimationSourceType.GEMMY, 'Gemmy')
|
||||
.addOption(AnimationSourceType.DRAKE, 'Drake')
|
||||
// When you need to add a new character, copy and paste the following line above this one, and change the NAME
|
||||
// .addOption(AnimationSourceType.NAME, 'Name')
|
||||
.setValue(this.plugin.settings.animationSource)
|
||||
.onChange(async value => {
|
||||
// Explicitly cast the value to the correct type
|
||||
|
|
|
|||
|
|
@ -67,6 +67,12 @@ export default class GranitePlugin extends Plugin {
|
|||
this.granite.disappear();
|
||||
}
|
||||
|
||||
// Within the async, update your new character by adding them to the load list,
|
||||
// where name is your character name and type is the type of creature it is.
|
||||
// if (this.settings.animationSource === 'type') {
|
||||
// this.settings.animationSource = AnimationSourceType.NAME;
|
||||
// }
|
||||
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
|
||||
|
|
|
|||
|
|
@ -13,62 +13,67 @@ export const GRANITE_BASE_QUOTES: Quotes = {
|
|||
idle: [
|
||||
"You can't arrest us! We already ate the evidence!",
|
||||
"Don't ever split the party!",
|
||||
'If you kill a hive mind, is that murder or genocide?',
|
||||
'Roll initiative!',
|
||||
'You can try!',
|
||||
"If you kill a hive mind, is that murder or genocide?",
|
||||
"Roll initiative!",
|
||||
"You can try!",
|
||||
"I'm not short, I'm concentrated awesome.",
|
||||
"I'm not greedy, I'm just allergic to poverty.",
|
||||
"I don't always cast spells, but when I do, it's fireball.",
|
||||
"I don't need luck, I have a high charisma stat.",
|
||||
"I don't always drink ale, but when I do, it's with my fellow adventurers after slaying a dragon.",
|
||||
"I don't always roll a critical hit, but when I do, the DM forgets to make me reroll the damage.",
|
||||
'I may be chaotic neutral on paper, but in reality, I just like to watch the world burn.',
|
||||
'It’s not stealing if it belongs to a dead guy.',
|
||||
'Who needs an army when you have a bag of holding full of rocks?',
|
||||
'Let me show you how to wear a snake.',
|
||||
'WHY WOULD YOU DO THAT!',
|
||||
'That dice needs to be retired!',
|
||||
"I may be chaotic neutral on paper, but in reality, I just like to watch the world burn.",
|
||||
"It’s not stealing if it belongs to a dead guy.",
|
||||
"Who needs an army when you have a bag of holding full of rocks?",
|
||||
"Let me show you how to wear a snake.",
|
||||
"WHY WOULD YOU DO THAT!",
|
||||
"That dice needs to be retired!",
|
||||
"I don't kill without reason. Fortunately, I'm bored. Reason enough!",
|
||||
'Ah, my favoured enemy. Something alive.',
|
||||
"Ah, my favoured enemy. Something alive.",
|
||||
"I slap the barrel with my member!... the 'barrel' open's its mouth!",
|
||||
"I'm not deprived, I'm depraved.",
|
||||
'You need a free hand to attempt a grapple',
|
||||
`Careful how much you carry; the GM might actually ask you to calculate your inventory weight!`,
|
||||
`Don't do that! Then we'll have to go look up the grapple rules!`,
|
||||
`50 page backstory... NOPE`,
|
||||
`It's astounding anyone can understand you, with all those Nat 1 Charisma rolls.`,
|
||||
`The cheddar monks are here to save the day!`,
|
||||
`You've been Gygaxed.`,
|
||||
`STEP AWAY FROM THE PURCHASE MORE DICE BUTTON`,
|
||||
`After thousands of years, I have attained my current state, while you struggle to complete this simple note.`,
|
||||
`You are a background character in your own life.`,
|
||||
"You need a free hand to attempt a grapple",
|
||||
"Careful how much you carry; the GM might actually ask you to calculate your inventory weight!",
|
||||
"Don't do that! Then we'll have to go look up the grapple rules!",
|
||||
"50 page backstory... NOPE",
|
||||
"It's astounding anyone can understand you, with all those Nat 1 Charisma rolls.",
|
||||
"The cheddar monks are here to save the day!",
|
||||
"You've been Gygaxed.",
|
||||
"STEP AWAY FROM THE PURCHASE MORE DICE BUTTON",
|
||||
"After thousands of years, I have attained my current state, while you struggle to complete this simple note.",
|
||||
"You are a background character in your own life.",
|
||||
"What... sorry Who is the Bard doing now?",
|
||||
"DO NOT put the portable hole in the bag of holding!",
|
||||
"DO NOT put the bag of holding in the portable hole!",
|
||||
"If the shed's a'Rocking... RUN",
|
||||
],
|
||||
writingMode: [
|
||||
`Player's dont take notes... maybe you should try that?`,
|
||||
`Is that the best you can do? Keep writing!`,
|
||||
`Write first, editor later.`,
|
||||
`AI could probably write a better note...`,
|
||||
`I love hearing your keyboard. Don't stop.`,
|
||||
`How about we review some old notes today?`,
|
||||
`Why not just use a template?`,
|
||||
`Doesn't matter how much you plan... they will derail anyway!`,
|
||||
`Maybe it's time to go get some water or coffee.`,
|
||||
`That's not how rivers are in real-life...`,
|
||||
`Anything is better than a blank page, even me. Write something!`,
|
||||
`Have you given out Inspiration recently?`,
|
||||
`Call me Jeeves. I. Dare. You.`,
|
||||
`I cast 'Summon Bigger Fish`,
|
||||
`Do you touch it?`,
|
||||
`What would Matt Mercer do?`,
|
||||
`To continue, please insert more credits`,
|
||||
`Have you considered just... Not?`,
|
||||
"Player's dont take notes... maybe you should try that?",
|
||||
"Is that the best you can do? Keep writing!",
|
||||
"Write first, editor later.",
|
||||
"AI could probably write a better note...",
|
||||
"I love hearing your keyboard. Don't stop.",
|
||||
"How about we review some old notes today?",
|
||||
"Why not just use a template?",
|
||||
"Doesn't matter how much you plan... they will derail anyway!",
|
||||
"Maybe it's time to go get some water or coffee.",
|
||||
"That's not how rivers are in real-life...",
|
||||
"Anything is better than a blank page, even me. Write something!",
|
||||
"Have you given out Inspiration recently?",
|
||||
"Call me Jeeves. I. Dare. You.",
|
||||
"I cast 'Summon Bigger Fish'",
|
||||
"Do you touch it?",
|
||||
"What would Matt Mercer do?",
|
||||
"To continue, please insert more credits",
|
||||
"Have you considered just... Not?",
|
||||
"You can't just write 'I win'",
|
||||
],
|
||||
};
|
||||
|
||||
export const GEMMY_EXCLUSIVE_QUOTES: Quotes = {
|
||||
general: [],
|
||||
idle: [
|
||||
`You pooping?`,
|
||||
"You pooping?",
|
||||
],
|
||||
writingMode: [],
|
||||
};
|
||||
|
|
@ -78,3 +83,19 @@ export const DRAKE_EXCLUSIVE_QUOTES: Quotes = {
|
|||
idle: [],
|
||||
writingMode: [],
|
||||
};
|
||||
|
||||
// Copy and paste this above. Change NAME with your new character
|
||||
// Be mindful of the indentations as comment mode strips them
|
||||
// export const NAME_EXCLUSIVE_QUOTES: Quotes = {
|
||||
// general: [
|
||||
//
|
||||
// ],
|
||||
//
|
||||
// idle: [
|
||||
|
||||
// ],
|
||||
//
|
||||
// writingMode: [
|
||||
// "You can't just write 'I win'",
|
||||
// ],
|
||||
// };
|
||||
|
|
|
|||
|
|
@ -1,12 +1,3 @@
|
|||
/*
|
||||
|
||||
This CSS file will be included with your plugin, and
|
||||
available in the app when your plugin is enabled.
|
||||
|
||||
If your plugin does not need CSS, delete this file.
|
||||
|
||||
*/
|
||||
|
||||
:root {
|
||||
--granite-size: 80px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue