javalent / fantasy-statblocks

Create Dungeons and Dragons style statblocks for Obsidian.md
MIT License
339 stars 69 forks source link

[probably 🐞] Custom dice callbacks don't work #404

Closed silentjames closed 2 months ago

silentjames commented 2 months ago

Check for existing bug reports before submitting.

Expected Behavior

Dice lines should be rendered as before.

Current behaviour

I've created a couple of statblocks for World of Darkness games some months ago, and now I'm kinda confused with recent changes :) Not sure, is it a bug or I no longer know how to use Dice Roller, but still!


  1. Here is the example of json from one statblock:
{
  "type": "property",
  "id": "ead8883848e8",
  "properties": [
      "athletics"
  ],
  "fallback": "-",
  "conditioned": true,
  "display": "Athletics",
  "dice": true,
  "diceCallback": "return [{ text: monster.athletics + 'd10|none|noform|nodice|text(' + monster.athletics +')' }]"
},

It transforms into:

<div class="line athletics svelte-1rketb6">
   <span class="property-name svelte-1rketb6">Athletics</span>
   <div class="statblock-markdown svelte-1c3hzq4 el-p" data-tag-name="p">
      <p>1</p>
   </div>
</div>

So, the result is just plain text.


  1. Another statblock also have same piece of json, but it results in error:

1 1d10|noform ^ at D._token (plugin:obsidian-dice-roller:12:320) at D.next (plugin:obsidian-dice-roller:11:3309) at W.next (plugin:obsidian-dice-roller:12:581) at Function.from () at Sh.parse (plugin:obsidian-dice-roller:3058:5649) at Mh.getRoller (plugin:obsidian-dice-roller:3058:9358) at So.postprocessor (plugin:obsidian-dice-roller:3079:34) at eval (plugin:obsidian-dice-roller:3081:2736) at t.render (app.js:1:1296676) at m (plugin:obsidian-5e-statblocks:446:220) postprocessor @ plugin:obsidian-dice-roller:3079


And HTML part is totally different:

```html
<div class="line athletics svelte-1rketb6">
   <span class="property-name svelte-1rketb6">Athletics</span>
   <div class="statblock-markdown svelte-1c3hzq4 el-p" data-tag-name="p">
      <p>
         <code>dice: 1d10|none|noform|nodice|text(1)|render|noform|avg|noparen</code>
      </p>
   </div>
</div>

Have no idea where the part with '|render|noform|avg|noparen' comes from. Especially avg - because I don't need average result here at all.

Reproduction

You'll probably need to add my statblocks: 1st one, VtM v20 Vampire en.json, and 2nd, WoD v20 Agent en.json. Also, here is the CSS to display everything properly - here, world-of-darkness-statblocks.css.zip And note texts:

1st one, Vampire ```statblock columnWidth: 680 layout: VtM v20 Vampire en dice: true #### GENERAL INFO #### name: Edward Lewis desc: NSA agent clan: Tremere generation: 8 sire: [[Дункан Фегредо | Duncan Fegredo]] nature: Bon Vivant demeanor: Competitor concept: Deviant img: [[Валентайн.png]] img_title: favorire look img_alt: img_alt_title: #### ATTRIBUTES #### Attributes: ATTRIBUTES Physical: PHYSICAL Strength: 1 Dexterity: 2 Stamina: 3 Social: SOCIAL Charisma: 4 Manipulation: 5 Appearance: 6 Mental: MENTAL Perception: 5 Intelligence: 4 Wits: 3 #### ABILITIES #### Abilities: ABILITIES Talents: TALENTS alertness: 1 athletics: 2 awareness: 3 brawl: 4 empathy: 5 expression: 4 intimidation: 3 leadership: 2 streetwise: 1 subterfuge: 0 new_talent: new_talent_value: Skills: SKILLS animalken: 5 crafts: 4 drive: 3 etiquette: 2 firearms: 1 larceny: 0 melee: 1 performance: 2 stealth: 3 survival: 4 new_skill: new_skill_value: Knowledges: KNOWLEDGES academics: 1 computer: 1 finance: 2 investigation: 2 law: 3 medicine: 3 occult: 4 politics: 4 science: 5 technology: 5 new_knowledge: new_knowledge_value: #### ADVANTAGES #### Advantages: ADVANTAGES Disciplines: DISCIPLINES discipline1_name: Animalism discipline1_value: 4 discipline2_name: Obfuscate discipline2_value: 3 discipline3_name: Potence discipline3_value: 2 discipline4_name: Celerity discipline4_value: 1 discipline5_name: Precence discipline5_value: 1 discipline6_name: Obtenebration discipline6_value: 1 Backgrounds: BACKGROUNDS background1_name: Herd background1_value: 1 background2_name: Fame background2_value: 2 background3_name: Status background3_value: 3 background4_name: Resources background4_value: 4 background5_name: Domitor background5_value: 5 background6_name: background6_value: Virtues: VIRTUES conscience: 1 selfcontrol: 3 courage: 4 #### MERITS / FLAWS #### Merits: MERITS merit1_name: Natural Leader merit1_value: -1 merit2_name: Old Pal merit2_value: -2 merit3_name: Friend of the Underground merit3_value: -3 merit4_name: Patagia merit4_value: -4 merit5_name: Arcane merit5_value: -5 merit6_name: merit6_value: merit7_name: merit7_value: Flaws: FLAWS flaw1_name: Deep Sleeper flaw1_value: +1 flaw2_name: Vulnerability to Silver flaw2_value: +2 flaw3_name: Repelled by Crosses flaw3_value: +3 flaw4_name: Conspicuous Consumption flaw4_value: +4 flaw5_name: Laughingstock flaw5_value: +5 flaw6_name: flaw6_value: flaw7_name: flaw7_value: #### PATH / WILLPOWER / BLOOD #### Path: HUMANITY path_value: 3 Willpower: WILLPOWER willpower_main: 8 willpower_current: 7 Bloodpool: BLOOD POOL blood: 33 Health: HEALTH aggravated: 2 lethal: 2 bashing: 3 #### SPECIALTIES #### Specialties: SPECIALTIES specialty1_origin: Strength specialty1_name: Powerful Arms specialty2_origin: Stamina specialty2_name: Tough as Nails specialty3_origin: Expression specialty3_name: Impromptu specialty4_origin: Larceny specialty4_name: Pickpocketing specialty5_origin: specialty5_name: specialty6_origin: specialty6_name: Weakness: show_weakness: yes #### ОРУЖИЕ #### Weapon: Weapon weapon1_name: пистолет damage1: 4 range1: 20 firerate1: 4 capacity1: 15 conceal1: ПК weapon2_name: damage2: range2: firerate2: capacity2: conceal2: weapon3_name: damage3: range3: firerate3: capacity3: conceal3: weapon4_name: damage4: range4: firerate4: capacity4: conceal4: ```
2nd, Agent ```statblock columnWidth: 680 column: 1 layout: WoD v20 Agent en dice: true #### GENERAL INFO #### name: Gerald Osbourne desc: SAD agent nature: Architect demeanor: Confidant concept: Leader agency: FBI rank: SAD Director codename: img: [[Джеральд Осборн.png]] img_title: img_alt: img_alt_title: #### ATTRIBUTES #### Attributes: ATTRIBUTES Physical: PHYSICAL Strength: 2 Dexterity: 3 Stamina: 3 Social: SOCIAL Charisma: 4 Manipulation: 4 Appearance: 2 Mental: MENTAL Perception: 4 Intelligence: 4 Wits: 5 #### ABILITIES #### Abilities: ABILITIES Talents: TALENTS alertness: 3 athletics: 2 awareness: 0 brawl: 2 empathy: 0 expression: 0 intimidation: 3 leadership: 4 streetwise: 2 subterfuge: 4 new_talent: new_talent_value: Skills: SKILLS animalken: 0 drive: 2 crafts: 0 etiquette: 0 firearms: 3 larceny: 0 melee: 0 performance: 0 stealth: 2 survival: 0 new_skill: new_skill_value: Knowledges: KNOWLEDGES academics: 2 computer: 3 finance: 0 investigation: 4 law: 4 medicine: 0 occult: 3 politics: 4 science: 2 technology: 0 new_knowledge: Covert Culture new_knowledge_value: 3 #### ADVANTAGES #### Advantages: ADVANTAGES Numina: NUMINA numina1_name: Psychometry numina1_value: 3 numina2_name: numina2_value: numina3_name: numina3_value: numina4_name: numina4_value: numina5_name: numina5_value: numina6_name: numina6_value: Backgrounds: BACKGROUNDS background1_name: Rank background1_value: 6 background2_name: Allies background2_value: 5 background3_name: Contacts background3_value: 5 background4_name: Influence background4_value: 4 background5_name: Resources background5_value: 4 background6_name: background6_value: Virtues: VIRTUES conscience: 2 selfcontrol: 5 courage: 4 #### MERITS / FLAWS #### Merits: MERITS merit1_name: [[Здравый смысл|Common Sense]] merit1_value: -1 merit2_name: Top Secret Access merit2_value: -2 merit3_name: Political Ties merit3_value: -3 merit4_name: Agency Insider merit4_value: -3 merit5_name: merit5_value: merit6_name: merit6_value: merit7_name: merit7_value: Flaws: FLAWS flaw1_name: Bad Sight flaw1_value: +1 flaw2_name: flaw2_value: flaw3_name: flaw3_value: flaw4_name: flaw4_value: flaw5_name: flaw5_value: flaw6_name: flaw6_value: flaw7_name: flaw7_value: #### HUMANITY / WILLPOWER / HEALTH #### Humanity: HUMANITY humanity_value: 6 Willpower: WILLPOWER willpower_main: 6 willpower_current: 6 Health: HEALTH bashing: 0 lethal: 0 #### SPECIALTIES #### Specialties: SPECIALTIES specialty1_origin: Allies specialty1_name: Fellow FBI agents specialty2_origin: Influence specialty2_name: Federal police powers of investigation specialty3_origin: specialty3_name: specialty4_origin: specialty4_name: specialty5_origin: specialty5_name: specialty6_origin: specialty6_name: #### WEAPON #### Weapon: WEAPON weapon1_name: SIG-Sauer P226 9mm damage1: 4 range1: 20 firerate1: 4 capacity1: 15 conceal1: P weapon2_name: Springfield HS 2000 .45 damage2: 5 range2: 25 firerate2: 3 capacity2: 13+1 conceal2: J weapon3_name: damage3: range3: firerate3: capacity3: conceal3: weapon4_name: damage4: range4: firerate4: capacity4: conceal4: ```

Which Operating Systems are you using?

Obsidian Version Check

1.5.3 and 1.5.12

Plugin Version

4.3.0

Confirmation

Possible solution

No response

valentine195 commented 2 months ago

This is actually a dice roller issue, fixed by https://github.com/javalent/dice-roller/pull/315