Skip to content

Commit

Permalink
Merge pull request #1 from mnoreke/Development
Browse files Browse the repository at this point in the history
Updated module for Foundry V11. Working for DnD5e system 2.4.1. Not all features tested, but will handle if bug reports come in.
  • Loading branch information
mnoreke authored Dec 17, 2023
2 parents 15f113c + c43b4fc commit f439ea5
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 191 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

/.vs
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# All Goblins Have Names
[![Version (latest)](https://img.shields.io/github/v/release/jsabol/all-goblins-have-names)](https://github.com/jsabol/all-goblins-have-names/releases/latest)
[![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Fall-goblins-have-names&colorB=4aa94a)](https://forge-vtt.com/bazaar#package=all-goblins-have-names)
[![GitHub downloads (latest)](https://img.shields.io/badge/dynamic/json?label=Downloads@latest&query=assets[?(@.name.includes('zip'))].download_count&url=https://api.github.com/repos/jsabol/all-goblins-have-names/releases/latest&color=green)](https://github.com/jsabol/all-goblins-have-names/releases/latest)
# All Goblins Have Names Reborn
[![Version (latest)](https://img.shields.io/github/v/release/mnoreke/all-goblins-have-names)](https://github.com/mnoreke/all-goblins-have-names/releases/latest)
[![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Fall-goblins-have-names-reborn&colorB=4aa94a)](https://forge-vtt.com/bazaar#package=all-goblins-have-names-reborn)
[![GitHub downloads (latest)](https://img.shields.io/badge/dynamic/json?label=Downloads@latest&query=assets[?(@.name.includes('zip'))].download_count&url=https://api.github.com/repos/mnoreke/all-goblins-have-names/releases/latest&color=green)](https://github.com/mnoreke/all-goblins-have-names/releases/latest)

A module for Foundry VTT. Allows you to use a rolltable as the Display Name for a token so each new
token will get a random name. It can also roll random biographies for tokens when used with [Better Rolltables](https://foundryvtt.com/packages/better-rolltables/).

## Reborn Status

A module for Foundry VTT. Allows you to use a table as the Display Name for a token so each new
token will get a random name. It can also roll random biographies for tokens when used with [Better Rolltables](https://foundryvtt.com/packages/better-rolltables/).
I picked this module up in December 2023 as it hadn't been updated in a while. I have it working for what I need for DnD5e. Anything else that doesn't work will be reviewd at as bug reports come in here on GitHub.

## How to use it

First, grab your random name table and drag it into a Journal entry. That will give you some
text that looks similar to `@RollTable[2cbm3cP46dxcxO5Z]{Dwarf Female Name}`. Now, open the Actor
and click Prototype Token. Paste your `@RollTable[...` text into the Token Name. When you drag your Actor
text that looks similar to `@UUID[RollTable.OfTzIzGy7fyCgGz7]{Elf First Name}`. Now, open the Actor
and click Prototype Token. Paste your `@UUID[RollTable...` text into the Token Name. When you drag your Actor
onto the map to create a new Token, its name will be randomized!

If you are working directly with a compendium, then the string will instead look like `@UUID[Compendium.monks-enhanced-journal.person-names.RollTable.AQBywLCajYDmBTay]{Dwarf Last Name}`.

### Return more than one result for firstname + lastname

When multiple lines are returned from a table, the lines will be joined together with a space. For example, you could have a roll table formula of 1d1, and have two results which are also tables for a firstname and a lastname, both with range 1-1.
Expand All @@ -34,9 +38,9 @@ This module provides a few methods under the `game.allGoblinsHaveNames` namespac

## Installation

You can install this module through the Foundry module UI
You can install this module through the Foundry module UI.

## Get help

You can [file an issue](https://github.com/jsabol/all-goblins-have-names/issues/new) on github if
you're running into a bug or reach me on the Foundry VTT discord as Cattegy#7436.
You can [file an issue](https://github.com/mnoreke/all-goblins-have-names/issues/new) on github if
you're running into a bug or reach me on the Foundry VTT discord as Gandamir.
28 changes: 16 additions & 12 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
{
"name": "all-goblins-have-names",
"title": "All Goblins Have Names",
"description": "Use a table as the display name for a token. New tokens get a random name.",
"name": "all-goblins-have-names-reborn",
"title": "All Goblins Have Names Reborn",
"description": "Use a rolltable as the display name for a token. New tokens get a random name.",
"authors": [
{
"name": "Tom Rodriguez",
"name": "Gandamir",
"discord": "gandamir"
},
{
"name": "Tom Rodriguez (previous)",
"discord": "toasty#8538"
},
{
"name": "Cattegy",
"name": "Cattegy (previous)",
"discord": "Cattegy#7436"
}
],
"version": "2.0.1",
"minimumCoreVersion": "9.0",
"compatibleCoreVersion": "9.254",
"version": "3.0.0",
"minimumCoreVersion": "11.0",
"compatibleCoreVersion": "11.315",
"esmodules": ["scripts/index.js"],
"url": "https://github.com/jsabol/all-goblins-have-names",
"url": "https://github.com/mnoreke/all-goblins-have-names",
"readme": "README.md",
"license": "LICENSE",
"bugs": "https://github.com/jsabol/all-goblins-have-names/issues",
"download": "https://github.com/jsabol/all-goblins-have-names/releases/latest/download/module.zip",
"manifest": "https://github.com/jsabol/all-goblins-have-names/releases/latest/download/module.json",
"bugs": "https://github.com/mnoreke/all-goblins-have-names/issues",
"download": "https://github.com/mnoreke/all-goblins-have-names/releases/latest/download/module.zip",
"manifest": "https://github.com/mnoreke/all-goblins-have-names/releases/latest/download/module.json",
"flags": {
"allowBugReporter": true
}
Expand Down
28 changes: 14 additions & 14 deletions scripts/better-table-util.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
export function isBetterTable(table) {
return (
table.data.flags &&
table.data.flags["better-rolltables"] &&
table.data.flags["better-rolltables"]["table-type"] == "better"
);
return (
table.data.flags &&
table.data.flags["better-rolltables"] &&
table.data.flags["better-rolltables"]["table-type"] == "better"
);
}

export function isStoryTable(table) {
return (
table.data.flags &&
table.data.flags["better-rolltables"] &&
table.data.flags["better-rolltables"]["table-type"] == "story"
);
return (
table.data.flags &&
table.data.flags["better-rolltables"] &&
table.data.flags["better-rolltables"]["table-type"] == "story"
);
}

export async function rollBetterTable(table) {
const result = await game.betterTables.getBetterTableResults(table);
return result;
const result = await game.betterTables.getBetterTableResults(table);
return result;
}

export async function rollStoryTable(table) {
const result = await game.betterTables.getStoryResults(table);
return result.storyHtml;
const result = await game.betterTables.getStoryResults(table);
return result.storyHtml;
}
Loading

0 comments on commit f439ea5

Please sign in to comment.