Git Product home page Git Product logo

rpg-table-randomizer's People

Contributors

dependabot[bot] avatar derikb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rpg-table-randomizer's Issues

Serializing NPCs with field values that are Results doesn't work.

Calling toJSON outside the context of a JSON.stringify doesn't recursive call toJSON on all the properties, so trying to create serializable objects from the NPC class fails if there are results or result sets in the field values.

defaultToJSON probably needs to check for "toJSON" method on any objects and call it if it's there.

Add separate dice roller export

I should be able to set up multiple entry points, so having one that is just the dice roller might be nice for my character sheet app (I want to add a dice roller there, but I don't need all the other randomization stuff at this point.

Name: last name returns Undefined

Happened when I used generateList() with no arguments, first names were "Peta" (female) and "Istu" (male) which are from the native american list (which is the list with no lastnames).

Add toJSON for NPC class

Forgot it.

Also I think NPCSchema needs to import isEmpty. Also it could take a toJSON method too.

Simulating a bonus to rolling on a table?

I'm trying to figure out how I would simulate having a bonus when rolling on a table? For example, when rolling on table A, add +1 bonus if your character is an Elf.

Allow tables that only generate results from other tables

A way to have a top level table that uses a bunch of different other tables to generate some larger result.

For example, a mission generator that draws on tables for actions, antagonists, patrons, rewards, etc. This is possible with the current code by just having 1 result in a table that is just a token for another table, but that seems cheap and possibly confusing.

For example:

"sequence": "rollall",
"tables": {
    "action": [
        { "label": "{{table:mission_action}}" }
    ],
    "patron": [
        { "label": "{{table:mission_patron}}" }
    ],
    "antagonist": [
        { "label": "{{table:mission_antagonist}}" }
    ],
    "complication": [
        { "label": "{{table:mission_complication}}" }
    ],
    "reward": [
        { "label": "{{table:mission_reward}}" }
    ]
}

Add NPC generator via custom schemas

The idea being you can create a schema for fields and calculations and then use that to generate an NPC using the randomized, tables, names, rolls, etc.

Was going to do this as a separate module but it made more sense in the end to work it in here.

Dependency parser

Way to see what table dependencies there are for a specific RandomTable or NPC Schema. This would be helpful for causes where not all tables are currently available or need to be selected/added from a centralized source.

Reference in NPC to uuid library fails out of context

When using the library in another codebase, the relative reference to uuid fails because uuid gets installed in the other code bases node_modules directory which is no longer in the same relative position.

Bleah... this means either you have to:

  • use a "bare" import and force people to use a bundler or...
  • load it from a cdn, import { v4 as uuidv4 } from 'https://jspm.dev/uuid'; or...
  • ??

NPC._convertFieldValue can error out for certain values

NPC._convertFieldValue falls back from a few simple types to checking className property, but fails to first confirm a) that the value is an object b) that is has the className property.

I think the issue came up in some code when NPCSchemaField.defaultEmpty returned null, which doesn't fit any of the branches in _convertFieldValue.

Add unit tests

Should be able to unit test a lot of this now that it's all in modules.

Bug: Stupid mistake in randomizer

Somehow I missed that Randomizer.registerTokenType is coded as registerTokenType = function (name, process) { which is broken syntax in that context... Not quite sure how that got through.

Option for ordered tables

in re #36 have an option where the (sub)table is an ordered table, such that each entry represents a numeric value(s). The table could then be "rolled on" via a dice token or could just be selected from with an integer.

NPC: Update generator to allow for child classes

It would be helpful if the NPC creation process could return classes that extend the base NPC class, so you can add extra properties, methods, etc. but still be able to make use the of the code in initializeNewNPC that sets all the random fields.

Resolve issue where tables could recursively call themselves and loop

If you set up your tokens in a certain way you could end up recursively calling the same table(s) until you ran out of memory.

Need to figure out a way to somehow track token/subtable rolls so they either stop at a certain number or they make sure they aren't recursively calling the same table/subtable that was called higher up in the stack.

Bug: {{ name:random }} token doesn't work.

In the nameTokenCallback the random is getting reset to an empty string and then in createName that is not being handled. The arg defaults to "random" but that only works if the value is undefined.

Probably nameTokenCallback you set the unset/empty/etc fields to "random".
Though maybe createName should handle empty values too.

NPCSchemaField types are not really being handled

Other than the array type and getting multiple results from the source, the type property is mostly ignored. Should be using that in various places to I think to help with typing the field values, and serialize/unserialize.

Add class for table entries

The randomizer code would be a lot smoother if in the RandomTable itself we normalized all the entries. Right now they can be strings, arrays, objects. Should generate a simple class that has all the properties. That should make the randomizer's select methods a lot less reliant on checking types.

RandomTable.tables might make more sense as a Map

Rather than a plain Object. That will help maintain the order in the original? It would also make serialization simpler.

In general, I think, avoiding plain Objects as properties is a good idea.

Offer name-free browser package?

The names are largest part of the browser build, so offering them as an optional add-on may be preferable to cut down the size.

Update Randomizer.getTableByKey to call set method and check typing

Right now calling Randomizer.setTableKeyLookup directly replaces Randomizer.getTableByKey, which means when calling that method elsewhere you don't really know what you'll get in return.

Change this so the former method sets a separate method (marked as internal) and then the latter method calls that separate method and checks typing before returning anything. This way we can be sure getTableByKey's return is always RandomTable|null.

Change RandomName to class

In case you want to have multiple name generators in one project. With the current method you can only set the nameddata once.

Typings not being found

In my VSCode setup at least, the typings I added are not being found when I install the package in another app... There must be some setting or config off causing them to not get found.

Add browser test

We should test the browserified version of the code.

Need to figure out how to do that with Mocha (if we can).

Remove TableRoller dependency from RandomName

It was only in there for adding table tokens to names, which is unnecessary and adds complication. You can also do that in a random table outside of the basic name generation (see the holmes name sample data).

Add class(es) for table results

As used in Randomizer, they tend to be:

  • table {String} perhaps with special method for "isDefault" where name === default
  • result {String}
  • desc {String} Extra... text...

Would simplify some kind I think to be able to have a class for this. Maybe a class for a collection of them, since tables can return an array of results. That would aid in formatting table result output a lot I think.

Add Typescript declarations

Even though the code isn't written in typescript having the declarations would help for including the module in a typescript project (like the Angular one I am working on).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.