From db24004a5d4477dab71d4cfd058a5b625dc0716d Mon Sep 17 00:00:00 2001
From: DameryDad <74715860+DameryDad@users.noreply.github.com>
Date: Fri, 21 Jul 2023 10:49:37 +0100
Subject: [PATCH] API_Meta fix
Updated API_Meta header as per The Arron's comment
---
RPGMaster-Suite/1.5.02/RPGMasterSuite.js | 4230 +---------------------
RPGMaster-Suite/2.1.0/RPGMasterSuite.js | 13 +-
2 files changed, 38 insertions(+), 4205 deletions(-)
diff --git a/RPGMaster-Suite/1.5.02/RPGMasterSuite.js b/RPGMaster-Suite/1.5.02/RPGMasterSuite.js
index 9f17353aa1..b3eba53733 100644
--- a/RPGMaster-Suite/1.5.02/RPGMasterSuite.js
+++ b/RPGMaster-Suite/1.5.02/RPGMasterSuite.js
@@ -1,7 +1,15 @@
+// Github: https://github.com/Roll20/roll20-api-scripts/tree/master/RPGMaster-Suite
+// By: Richard @ Damery
+// Contact: https://app.roll20.net/users/6497708/richard-at-damery
+
+var API_Meta = API_Meta||{}; // eslint-disable-line no-var
+API_Meta.RPGMasterLoader={offset:Number.MAX_SAFE_INTEGER,lineCount:-1};
+{try{throw new Error('');}catch(e){API_Meta.RPGMasterLoader.offset=(parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/,'$1'),10)-7);}}
+
/**
- * CommandMaster.js
+ * RPGMasterLoader.js
*
- * * Copyright 2020: Richard @ Damery.
+ * * Copyright 2022: Richard @ Damery.
* Licensed under the GPL Version 3 license.
* http://www.gnu.org/licenses/gpl.html
*
@@ -15,4211 +23,35 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * This script is the GM control capability for the RedMaster series
- * of APIs for Roll20. It allows the other RedMaster series APIs to
- * register with it with their current commands and ability button specs
- * which are used by CommandMaster to build the GM Maintenance Menu,
- * and to update Character Sheets that use the commands in abilities
- * with the latest command structures. It supports other functions
- * useful to the GM as needed.
- *
- * v0.001 02/05/2021 Initial creation as a clone of attackMaster
- * v0.002-1.025 Early development. See v2.027 for details.
- * v2.026 27/02/2022 Added Class-DB as a standard database. Fixed 'Specials' action
- * button & updated command registration. Fixed command registration errors.
- * Added token-setup buttons to add all possible character Powers & Priest
- * spells from Class-DB.
- * v2.027 10/03/2022 Add sychronisation of Database indexing to ensure happens after
- * all databases loaded by all APIs before indexing done. Add
- * "Creature" character class. Use AttackMaster version of --check-saves
- * to unify character setup. Added token-setup buttons to check who
- * controls what Char Sheets & toggle control DM/Player
- * v2.030 28/03/2022 Moved all Table Mgt, Ability Mgt, Chat Mgt, Database Mgt to a
- * shared library
- * v2.031 24/04/2022 Moved all game-specific and character sheet-specific data structures
- * to the RPGM game-specific library api.
- * v0.2.32 20/07/2022 Converted to use revised internal database structures
- * v0.2.33 17/09/2022 Moved additional common RPGMaster functions to Library. Moved common
- * help handouts to Library. Optionally allow semi-colons as terminators
- * for escaped characters in commands. Improve generating of spell lists
- * for Priest classes, and Power lists for all classes. Change --help to
- * provide a menu of links to help handouts
- * v1.3.00 17/09/2022 First release of RPGMaster APIs with RPG-version-specific Library
- * v1.3.01 04/10/2022 Allow Wizard and Priest spells to be stored as powers
- * v1.3.02 23/10/2022 Fixed error with Specials action button
- * v1.3.03 29/10/2022 Trap initialisation errors. Add All Powers will add race powers from
- * the race database. Add Race selection to Class menu.
- * v1.3.04 17/11/2022 Added possible creature data attributes, & fixed certain creature
- * setup issues. Added weapon data update after race/class/level change
- * to support things like attacks/round improvement
- * v1.4.01 28/11/2022 Added support for the fighting Styles-DB. Fixed help menu. Improved
- * creature attribute dice rolling. Improved creature HD & HP calcs.
- * Added creature attribute dexdef dexterity bonus for ranged attacks.
- * Added use of alpha indexed drop down for selection of creatures.
- * Added suppression of power inheritance. Added function to check
- * player, speakingas, token & character names for illegal characters.
- * v1.4.02 13/12/2022 Added API button on token & character name checks to support immediate
- * correction. Add ability to specify weapons and armour for creatures
- * with probability of different sets. Split handling of PC Race specifications
- * and Creature specifications, so that Races don't get set up with
- * spurious creature specs.
- * v1.4.03 16/01/2023 Added creature attkmsg & dmgmsg attributes to support messages to
- * display with attack and damage rolls respectively.
- * v1.4.04 24/01/2023 Added support for converting manually created character sheets to
- * RPGMaster format. Added ability to configure the default token bars.
- * Added functions to set token bars for all campaign tokens. Added
- * separate Ammo list for Equipment conversion. Tidied up Token-Setup
- * menu.
- * v1.4.05 02/03/2023 Non-functional update release to maintain version sequence.
- * v1.4.06 08/04/2023 Added support for when a magic item character sheet is first dragged
- * to the player map, to set it to isdrawing=true and link to the CS.
- * v1.4.07 14/04/2023 Fixed bug stopping Token Setup, Add to Spellbook from working.
- * v1.5.01 19/05/2023 Non-functional version number synchronisation release.
- * v1.5.02 02/06/2023 First release as RPGMasterSuite.js, so that a search of the "One Click"
- * library for "RPGMaster" will find this API and load the whole suite.
- */
-
-var CommandMaster = (function() {
- 'use strict';
- var version = '1.5.02',
- author = 'RED',
- pending = null;
+ * This script is just a placeholder for loading other scripts in
+ * the RPGMaster suite of API / Mods, so that a One Click search for
+ * 'RPGMaster' finds the loader and allows loading of the suite.
+**/
+
+const RPGMasterLoader = (() => { // eslint-disable-line no-unused-vars
+ 'use strict';
+ const version = '2.1.0';
+ API_Meta.RPGMasterLoader.version = version;
const lastUpdate = 1684607663;
+ const schemaVersion = 0.1;
- /*
- * Define redirections for functions moved to the RPGMaster library
- */
-
- const getRPGMap = (...a) => libRPGMaster.getRPGMap(...a);
- const getHandoutIDs = (...a) => libRPGMaster.getHandoutIDs(...a);
- const setAttr = (...a) => libRPGMaster.setAttr(...a);
- const attrLookup = (...a) => libRPGMaster.attrLookup(...a);
- const getTableField = (...t) => libRPGMaster.getTableField(...t);
- const getTable = (...t) => libRPGMaster.getTable(...t);
- const getLvlTable = (...t) => libRPGMaster.getLvlTable(...t);
- const initValues = (...v) => libRPGMaster.initValues(...v);
- const setAbility = (...a) => libRPGMaster.setAbility(...a);
- const abilityLookup = (...a) => libRPGMaster.abilityLookup(...a);
- const doDisplayAbility = (...a) => libRPGMaster.doDisplayAbility(...a);
- const getAbility = (...a) => libRPGMaster.getAbility(...a);
- const getDBindex = (...a) => libRPGMaster.getDBindex(...a);
- const updateHandouts = (...a) => libRPGMaster.updateHandouts(...a);
- const getCharacter = (...a) => libRPGMaster.getCharacter(...a);
- const classObjects = (...a) => libRPGMaster.classObjects(...a);
- const addMIspells = (...a) => libRPGMaster.addMIspells(...a);
- const getMagicList = (...a) => libRPGMaster.getMagicList(...a);
- const handleCheckSaves = (...a) => libRPGMaster.handleCheckSaves(...a);
- const handleCheckWeapons = (...a) => libRPGMaster.handleCheckWeapons(...a);
- const resolveData = (...a) => libRPGMaster.resolveData(...a);
- const findPower = (...a) => libRPGMaster.findPower(...a);
- const handleGetBaseThac0 = (...a) => libRPGMaster.handleGetBaseThac0(...a);
- const sendToWho = (...m) => libRPGMaster.sendToWho(...m);
- const sendPublic = (...m) => libRPGMaster.sendPublic(...m);
- const sendAPI = (...m) => libRPGMaster.sendAPI(...m);
- const sendFeedback = (...m) => libRPGMaster.sendFeedback(...m);
- const sendResponse = (...m) => libRPGMaster.sendResponse(...m);
- const sendResponsePlayer = (...p) => libRPGMaster.sendResponsePlayer(...p);
- const sendResponseError = (...e) => libRPGMaster.sendResponseError(...e);
- const sendError = (...e) => libRPGMaster.sendError(...e);
- const sendParsedMsg = (...m) => libRPGMaster.sendParsedMsg(...m);
- const sendGMquery = (...m) => libRPGMaster.sendGMquery(...m);
-
- /*
- * Handle for reference to character sheet field mapping table.
- * See RPG library for your RPG/character sheet combination for
- * full details of this mapping. See also the help handout on
- * RPGMaster character sheet setup.
- */
-
- var fields = {
- defaultTemplate: 'RPGMdefault',
- warningTemplate: 'RPGMwarning',
- menuTemplate: 'RPGMmenu',
- };
-
- /*
- * List of the "standard" RPGMaster databases to support identification of
- * custom user databases and db entries to give priority to.
- */
-
-// const stdDB = ['MU_Spells_DB','PR_Spells_DB','Powers_DB','MI_DB','MI_DB_Ammo','MI_DB_Armour','MI_DB_Light','MI_DB_Potions','MI_DB_Rings','MI_DB_Scrolls_Books','MI_DB_Wands_Staves_Rods','MI_DB_Weapons','Attacks_DB','Class_DB','Race-DB','Race-DB-Creatures'];
-
- /*
- * Handle for the Database Index, used for rapid access to the character
- * sheet ability fields used to hold database items.
- */
-
- var DBindex = {};
-
- /*
- * Handle for the API Databases in the RPGM Game-specific Library
- */
-
- var dbNames = {};
-
- /*
- * Handle for the library object used to pass back RPG & character sheet
- * specific data tables.
- */
-
- var RPGMap = {};
-
- /*
- * CommandMaster related help handout information.
- */
-
- const handouts = Object.freeze({
- CommandMaster_Help: {name:'CommandMaster Help',
- version:2.04,
- avatar:'https://s3.amazonaws.com/files.d20.io/images/257656656/ckSHhNht7v3u60CRKonRTg/thumb.png?1638050703',
- bio:'
'
- +'
Command Master API
'
- +'
The CommandMaster API is part of the RPGMaster suite of APIs for Roll20, and manages the initialisation of a Campaign to use the RPGMaster APIs, communication and command syntax updates between the APIs and, most importantly for the DM, easy menu-driven setup of Tokens and Character Sheets to work with the APIs.
'
- +'
Syntax of CommandMaster calls
'
- +'
The CommandMaster API is called using !cmd.
'
- +'
!cmd --initialise
'
- +'
Commands to be sent to the CommandMaster API must be preceded by two hyphens \'--\' as above for the --initialise command. Parameters to these commands are separated by vertical bars \'|\', for example:
'
- +'
!cmd --register action|description|api-call|api-command|parameters
'
- +'
Commands can be stacked in the call, for example:
'
- +'
!cmd --initialise --abilities
'
- +'
When specifying the commands in this document, parameters enclosed in square brackets [like this] are optional: the square brackets are not included when calling the command with an optional parameter, they are just for description purposes in this document. Parameters that can be one of a small number of options have those options listed, separated by forward slash \'/\', meaning at least one of those listed must be provided (unless the parameter is also specified in [...] as optional): again, the slash \'/\' is not part of the command. Parameters in UPPERCASE are literal, and must be spelt as shown (though their case is actually irrelevant).
'
- +'
How CommandMaster Works
'
- +'
The CommandMaster API coordinates other APIs in the RPGMaster API series and provides the DM with facilities to set the Campaign up to use them. It will initialise a Campaign in Roll20 to use the RPGMaster series APIs. APIs can register their commands with CommandMaster and, should they change in the future, CommandMaster will search all Character Sheets and databases for that command and offer the DM the option to automatically update any or all of those found to the new command structure of that API. Selected Tokens and their associated Character Sheets can be set up with the correct Token Action Buttons, with spell-users given spells in their spell book, fighters given weapon proficiencies, setting saving throws correctly, and linking token circles to standard Character Sheet fields.
'
- +'
Initialising a Campaign
'
- +'
Using the --initialise command will add a number of Player Macros for the DM that will run the most-used RPGMater DM commands, which can be flagged to appear in the Macro Bar at the bottom of the DM\'s screen for ease of access.
'
- +'
Setting up tokens & character sheets
'
- +'
Selecting one or multiple tokens and running the --abilities command will allow token action buttons and RPGMaster API capabilities to be set up for all the represented Character Sheets at the same time, though all Character Sheets will be set up the same way.
'
- +'
Registering API commands
'
- +'
Any API command can be registered with CommandMaster using the --register command. This will allow the command registered to be added as a Token Action Button to Character Sheets by the abilities command, and to be optionally updated in all Character Sheets wherever used should the details of the registration change.
'
- +'
Editing Character Sheet abilities
'
- +'
Danger: this command is very powerful, and can ruin your campaign if mis-used! The --edit command can be used to change any string in Character Sheet ability macros to any other string, using \'escaped\' characters to replace even the most complex strings. However, use with care!
'
- +'
'
- +'
Command Index
'
- +'
1. Campaign setup
'
- +'
--initialise
'
- +'--abilities
'
- +'
2. Character Sheet configuration
'
- +'
--conv-spells
'
- +'--conv-items
'
- +'--token-defaults
'
- +'--check-chars
'
- +'--class-menu [token_id]
'
- +'--add-spells [POWERS/MUSPELLS/PRSPELLS] | [level]
'
- +'--add-profs
'
- +'--set-prof [NOT-PROF/PROFICIENT/SPECIALIST/MASTERY] | weapon | weapon-type
'
- +'--set-all-prof
'
- +'
3. Command and Ability maintenance
'
- +'
--register action|description|api-call|api-command|parameters
'
- +'--edit old-string | new-string
'
- +'
4. Other commands
'
- +'
--help
'
- +'--debug [ON/OFF]
'
- +'
'
- +'
1. Campaign setup
'
- +'
1.1 Initialise for RPGMaster APIs
'
- +'
--initialise
'
- +'
This command creates a number of Player Macros which can be found under the Player Macro tab in the Chat window (the tab that looks like three bulleted lines, next to the cog). These macros hold a number of DM commands that are useful in setting up and running a campaign. It is recommended that the "Show in Bar" flags for these macros are set, and the "Show Macro Bar" flag is set (the macro bar is standard Roll20 functionality - see Roll20 Help Centre for more information).
'
- +'
The buttons added are:
'
- +'
'
- +' - Maint-menu: Runs the !init --maint command
'
- +' - Token-setup: Runs the !cmd --abilities command
'
- +' - Add-items: Runs the !magic --gm-edit-mi command
'
- +' - End-of-Day: Runs the !init --end-of-day command
'
- +' - Initiative-menu: Runs the !init --init command
'
- +' - Check-tracker: Runs the !init --check-tracker command
'
- +'
'
- +'
The DM can drag Macro Bar buttons around on-screen to re-order them, or even right-click them to change their name and colour of the button. Feel free to do this to make the Macro Bar as usable for you as you desire.
'
- +'
1.2 Setup Tokens & Character Sheets
'
- +'
--abilities
'
- +'
Displays a menu with which one or more selected tokens and the Character Sheets they represent can be set up with the correct Token Action Buttons and data specific to the RPGMaster APIs, to work with the APIs in the best way. The menu provides buttons to add any command registered with CommandMaster (see --register command) as a Token Action Button, change control of the sheet and set the visibility of the token name to players (which also affects RoundMaster behaviour), set the Character Class and Level of the Character, add spells to spell books, add granted powers, add or change weapon proficiencies and proficiency levels for each weapon, set the correct saving throws based on race, class & level of character / NPC / creature, and optionally clear or set the Token \'circles\' to represent AC (bar 1), base Thac0 (bar 2) and HP (bar 3). Essentially, using this menu accesses the commands in section 2 without the DM having to run them individually.
'
- +'
All tokens selected when menu items are used will be set up the same way: exceptions to this are using the Set Saves button (sets saves for each selected token/character sheet correctly for the specifications of that sheet), and the Set All Profs button (sets weapon proficiencies to proficient based on the weapons in each individual token/character sheet\'s item bag). Different tokens can be selected and set up differently without having to refresh the menu.
'
- +'
2. Character Sheet configuration
'
- +'
The commands in this section can be accessed using the --abilities command menu. The individual commands below are used less frequently.
'
- +'
2.1 Convert Character Sheet Spells
'
- +'
--conv-spells
'
- +'
Works on multiple selected tokens representing several Character Sheets.
'
- +'
For Character Sheets that have not been created using the commands provided by the !cmd --abilities menu, pre-existing from previous Roll20 campaigns using the Advanced D&D2e Character Sheet, this command does its best to convert all spells in tables on the Character Sheet to RPGMaster format and replace them with spells that exist in the RPGMaster spell databases. Those that the system can\'t automatically match are subsequently displayed in a menu, with additional buttons that list the spells that do exist in the databases that can be used to replace them by selecting both the spell to be replaced and the replacement spell.
'
- +'
It is possible that not all spells will be able to be replaced, if the Character Sheet reflects campaign experience where bespoke spells or spells from other handbooks have been available. In this case, the spells can be left unconverted, and the DM might add the spells to their own databases using the information provided in the Magic Database Help handout. Until the spells are added to the databases, they will not work, and cannot be memorised for spell use.
'
- +'
This command can be used on multiple selected tokens, as stated above. All the Character Sheets represented by the selected tokens will be converted, and the displayed list of spells to manually match represents the unmatched spells from all those Character Sheets. As the spells are manually matched, they will be replaced on all of the selected Character Sheets.
'
- +'
2.2 Convert Character Sheet Equipment
'
- +'
--conv-items
'
- +'
Works on multiple selected tokens representing several Character Sheets.
'
- +'
As for the --conv-spells command, Character Sheets that have not been created using the commands provided by the !cmd --abilities menu, pre-existing from previous Roll20 campaigns using the Advanced D&D2e Character Sheet, this command does its best to convert all weapons, armour, other items of equipment and magical items such as potions, rings etc, in tables on the Character Sheet to RPGMaster format and replace them with weapons, armour and items that exist in the RPGMaster spell databases. Those that the system can\'t automatically match are subsequently displayed in a menu, with additional buttons that list the items that do exist in the databases that can be used to replace the unknown ones by selecting both the item to be replaced and the replacement item.
'
- +'
It is possible that not all weapons, armour, equipment and especially magic items will be able to be matched if the Character Sheet reflects campaign experience where bespoke magic items and equipment or equipment from other handbooks have been available. In this case, the items can be left unconverted, and the DM might add the items to their own databases using the information provided in the Weapon & Armour Database Help or Magic Database Help handouts. Until the items of equipment are added to the databases, if they are weapons they cannot be taken in-hand to fight with, armour will not be counted towards armour class calculations, and items that contribute to saving throws will not do so.
'
- +'
As with the --conv-spells command, this command can be used on multiple selected tokens. All the Character Sheets represented by the selected tokens will be converted, and the displayed list of items to manually match represents the unmatched items from all those Character Sheets. As the items are manually matched, they will be replaced on all of the selected Character Sheets.
'
- +'
2.3 Set Default Token Bar mappings
'
- +'
--token-defaults
'
- +'
This command uses the selected token as a model to set the default token bar mappings that will be used in future by the RPGMaster APIs.
'
- +'
The standard defaults distributed with the APIs are for token bar1 to represent AC, bar2 to represent Thac0-base, and bar3 to represent HP. However, alternative mappings can be made. It is highly recommended that HP, AC and Thac0-base are represented in some order because these are the most common values to be affected by spells and circumstances, both in and out of combat situations.
'
- +'
If no token is selected, or the token selected to be the model does not have any bars linked to a character sheet, an error message will be displayed. If some but not all the bars are linked, then any bars not linked will be automatically matched to some of the recommended Character Sheet fields of AC, Thac0-base, and HP (in that order of priority).
'
- +'
Once this mapping is done, a menu will be displayed that can be used to map other tokens to the new defaults: either just the selected tokens, or all tokens in the campaign, or just those tokens that have bars currently linked to Character Sheets (i.e. excluding creature mobs with multiple tokens with unlinked bars representing a single character sheet). A button also exists to clear the bar links for all selected tokens to create creature mobs.
'
- +'
2.4 Check control of Character Sheets
'
- +'
--check-chars
'
- +'
Displays a list of every Character Sheet with a defined Class, Level, or Monster Hit Dice categorised by DM Controlled, Player Controlled PCs & NPCs, Player Controlled Creatures, and Controlled by Everyone. Each name is shown as a button which, if selected, swaps control of that Character Sheet between DM control and the control of a selected Player (the Player, of course, must be one that has already accepted an invite to join the campaign). A button is also provided at the bottom of this menu to toggle the running of this check whenever the Campaign is loaded.
'
- +'
2.5 Set Character Class, Race & Species
'
- +'
--class-menu [token_id]
'
- +'
Takes an optional ID for a token representing a character. If not specified, takes the currently selected token
'
- +'
Displays a menu from which the Race, Class and Level of a Character can be set, or a Creature species can be selected. Setting the Race, Class and Level of a Character (PC or NPC) enables all other capabilities to be used as appropriate for that character sheet in this and other APIs in the RPGMaster API suite, such as spell use, appropriate race & class powers, selection of allowed weapons, and the like. Selecting a Creature species automatically sets up the Character Sheet in an optimal way for the APIs to use it to represent the chosen creature, including saves, armour class, hit dice and rolling of hit points, as well as special attacks such as paralysation & level drain of high level undead, spell use by the likes of Orc Shamen, regeneration powers, and so on. However, it does not automatically give weapons, armour equipment, or magic items to Creatures - if appropriate this still needs to be done by the DM/Game Creator.
'
- +'
DMs/Game Creatores can add to or amend the Class, Race and Creature definitions. Refer to the appropriate database help handout distributed with the APIs and created as handouts in your campaign for more information.
'
- +'
2.6 Add spells to spell book
'
- +'
--add-spells [POWERS/MUSPELLS/PRSPELLS] | [level]
'
- +'
Displays a menu allowing spells in the Spells Databases to be added to the Character Sheet(s) represented by the selected Token(s). If no spell type and/or spell level is specified, the initial menu shown is for Level 1 Wizard spells (MUSPELLS). Buttons are shown on the menu that allow navigation to other levels, spell types and powers. For Priests, a button is also provided to add every spell allowed for the Priest\'s Class to their spellbooks at all levels (of course, they will only be able to memorise those that their experience level allows them to). For all Character Classes that have Powers (or Power-like capabilities, such as Priestly Turn Undead or Paladin Lay on Hands), there is a button on the Powers menu to add Powers that the character\'s Class can have.
'
- +'
Note: adding spells / powers to a sheet does not mean the Character can immediately use them. They must be memorised first. Use the commands in the MagicMaster API to memorise spells and powers.
'
- +'
2.7 Choose weapon proficiencies
'
- +'
--add-profs
'
- +'
Displays a menu from which to select proficiencies and level of proficiency for any weapons in the Weapon Databases for the Character Sheet(s) represented by the selected tokens. Also provides a button for making the Character proficient in all weapons carried (i.e. those currently in their Item table).
'
- +'
All current proficiencies are displayed, with the proficiency level of each, which can be changed or removed. It is also now possible to select proficiencies in Fighting Styles as introduced by The Complete Fighter\'s Handbook: these can be found under the Choose Style button, and can also be set as Proficient or Specialised. Selecting a Fighting Style proficiency grants benefits as defined in the Handbook, or as modified by the DM - see the Styles Database Help handout for more information.
'
- +'
Note: this does more than just entering the weapon in the proficiency table. It adds the weapon group that the weapon belongs to as a field to the table (see weapon database help handouts for details), which is then used by the AttackMaster API to manage related weapon attacks and give the correct proficiency bonuses or penalties for the class and weapon used.
'
- +'
2.8 Set weapon proficiencies
'
- +'
--set-prof [NOT-PROF/PROFICIENT/SPECIALIST/MASTERY] | weapon | weapon-type
'
- +'
Sets a specific weapon proficiency to a named level. If the proficiency level is omitted, PROFICIENT is assumed. If the weapon already exists in the proficiencies table, the existing proficiency level is updated to that specified. Otherwise, the weapon (and its weapon group) are added to the table at the specified level.
'
- +'
Note: this does more than just entering the weapon in the proficiency table. It adds the weapon group that the weapon belongs to as a field to the table (see weapon database help handouts for details), which is then used by the AttackMaster API to manage related weapon attacks and give the correct proficiency bonuses or penalties for the class and weapon used.
'
- +'
2.9 Add proficiencies for all carried weapons
'
- +'
--set-all-prof
'
- +'
Adds all currently carried weapons (those in the Items table) to PROFICIENT, saving them and their weapon group to the weapon proficiency table. Those weapons found that are already in the table are reset to PROFICIENT (overwriting any existing different proficiency level). Any other proficiencies already in the table are not altered.
'
- +'
Note: this command always adds a weapon proficiency called innate. This proficiency is used for attacks with innate weapons, such as claws and bites, but also for spells that require a touch attack. Indeed, to make this even more specific, the weapons database distributed with the AttackMaster and MagicMaster APIs includes a weapon called Touch.
'
- +'
Tip: if using the MagicMaster API then running the !magic --gm-edit-mi command and adding weapons before running this command can speed up setting up character sheets.
'
- +'
3. Command and Ability maintenance
'
- +'
3.1 Register an API command
'
- +'
--register action|description|api-call|api-command|parameters
'
- +'
Register an API command with the CommandMaster API to achieve two outcomes: allow the command to be set up as a Token Action Button, and/or automatically maintain & update the syntax of the commands in Character Sheet ability macros and the RPGMaster API databases.
'
- +'
This is a powerful and potentially hazardous command. Registry of an API command is remembered by the system in the state variable, which is preserved throughout the life of the Campaign in Roll20. If a subsequent registration of the same action has different parameters, the system detects this and searches all Character Sheet ability macros for the old version of the command and replaces all of them with the new command. It also changes the parameters, using a syntax including a range of character \'escapes\' to substitute characters that Roll20 might otherwise interpret as commands itself. In detail, the --register command takes:
'
- +'
'
- +' action: | the unique name given to this command in the whole system. This can be any legal text name including A-Z, a-z, 1-9, -, _ only. Must start with an alpha. Case is ignored. |
'
- +' description: | a short description of the command, which is displayed in the menu that allows the command to be added as a Token Action Button. |
'
- +' api-call: | the API call without the !, e.g. cmd, or magic, etc |
'
- +' api-command: | the command to be passed to the specified API, with the hyphens replaced by ~~ or plusses replaced by **, e.g. ~~cast-spell or **menu. |
'
- +' parameters: | the parameters (or initial parameters) to be passed as part of this command to replace the matching existing command parameters. This string is \'escaped\' using the following character replacements: |
'
- +'
'
- +'
'
- +' Character | Parameter separator | ? | [ | ] | < | > | @ | - | | | : | & | { | } |
'
- +' Substitute | %% | ^ | << | >> | | | ` | ~ | | | | & | { | } |
'
- +' Alternative | \\vbar; | \\ques; | \\lbrak; | \\rbrak; | \\lt; | \\gt; | \\at; | \\dash; | \\vbar; | \\clon; | \\amp; | \\lbrc; | \\rbrc; |
'
- +'
'
- +'
Commands cannot have a CR (carrage return/new line) in the middle of them, but CR can separate commands in multi-command sequences.
'
- +'
If the parameter string ends with $$, this will ensure that a complete command up to the next CR is to be replaced (including everything up to the CR even if not part of the command). If there is not a $$ on the end of the parameter string, then only the command and parameters that are matched are replaced (using a parameter count of each old and new parameter separated by \'%%\') - the rest of the line (including any remaining parameters not so matched) will be left in place.
'
- +'
Here are some examples of registration commands:
'
- +'
--register Spells_menu|Open a menu with spell management functions|magic|~~spellmenu |\`{selected|token_id}
'
- +'--register Use_power|Use a Power|magic|~~cast-spell|POWER%%\`{selected|token_id}
'
- +'--register Attack_hit|Do an attack where Roll20 rolls the dice|attk|~~attk-hit|\`{selected|token_id}
'
- +'
3.2 Edit ability macros
'
- +'
--edit existing-string | new-string
'
- +'
Danger: use this command with extreme care! It can destroy your Campaign! It is recommended that you make a backup copy of your Campaign before using this command. --register is more controlled, as it has been tested with the RPGMaster command strings, and any future releases that change the API commands will be fully tested before release for their effect on Campaigns, with accompanying release notes. Using the --edit function directly can have unintended consequences!
'
- +'
Replaces an existing \'escaped\' string with a new replacement string in all ability macros on all Character Sheets. These strings both use the same escape sequence replacements as for the --register command (see section 3.1) as in fact --register and --edit use the same functionality.
'
- +'
Examples of its use are to change API command calls, or Character Sheet field name access in macros should the field names change.
'
- +'
'
- +'
4. Other Commands
'
- +'
4.1 Display help on these commands
'
- +'
--help
'
- +'
This command does not take any arguments. It displays a very short version of this document, showing the mandatory and optional arguments, and a brief description of each command.
'
- +'
4.2 Switch on or off Debug mode
'
- +'
--debug (ON/OFF)
'
- +'
Takes one mandatory argument which should be ON or OFF.
'
- +'
The command turns on a verbose diagnostic mode for the API which will trace what commands are being processed, including internal commands, what attributes are being set and changed, and more detail about any errors that are occurring. The command can be used by the DM or any Player - so the DM or a technical advisor can play as a Player and see the debugging messages.
'
- +'
'
- +'
',
- },
- });
-
- /*
- * Handles for other RPG and Character Sheet specific data tables
- * obtained from the RPGMaster Library.
- */
-
- var fieldGroups;
- var primeClasses;
- var classLevels;
- var spellLevels;
- var saveLevels;
- var baseSaves;
- var raceSaveMods;
- var clTypeLists;
- var miTypeLists;
- var spTypeLists;
- var baseThac0table;
-
- const PR_Enum = Object.freeze({
- YESNO: 'YESNO',
- CUSTOM: 'CUSTOM',
- });
-
- const messages = Object.freeze({
- noChar: '&{template:'+fields.warningTemplate+'} {{name=^^tname^^\'s\nMagic Items Bag}}{{desc=^^tname^^ does not have an associated Character Sheet, and so cannot attack}}',
- initMsg: '&{template:'+fields.menuTemplate+'} {{name=Initialisation Complete}}{{desc=Initialisation complete. Command macros created. Go to Macro tab (next to the cog at the top of the Chat window), and select them to show In Bar, and turn on the Macro Quick Bar. Then start by dragging some characters on to the map to create tokens, and use Token-setup and Add-Items on each}}',
- waitMsg: '&{template:'+fields.warningTemplate+'} {{name=Please Wait}}{{desc=Gathering data. Please wait for the menu to appear.}}',
- convMsg: '&{template:'+fields.warningTemplate+'} {{name=Sheet Conversion}}{{Section1=You are about to convert the selected sheets to work with RPGMaster. This will move data from current tables and other places where it has previously been entered, and move it to where RPGMaster can make use of it. This means that the Character Sheets will probably become unusable in the way you were previously playing.