Browse Source

Hireling Availability by Market Class scripts/macros

master
Brandon Cornejo 7 months ago
parent
commit
30e033359b
  1. 40
      roll20/hireling_availability.js
  2. 24
      roll20/macros/hireling-availability.macro

40
roll20/hireling_availability.js

@ -0,0 +1,40 @@
const availability_map = {
'Mercenaries': {
'Light Infantry': ['4d100', '5d20', '5d10', '3d4', '1d6', '1d2'],
'Heavy Infantry': ['2d100', '5d10', '3d8', '1d8', '1d3', '1d100<85'],
'Slinger': ['8d20', '4d10', '2d10', '1d6', '1d2', '1d100<70'],
'Bowman': ['8d20', '4d10', '2d10', '1d6', '1d2', '1d100<70'],
'Crossbowman': ['8d20', '4d10', '2d10', '1d6', '1d2', '1d100<70'],
'Longbowman': ['4d20', '2d10', '1d10', '1d3', '1', '1d100<33'],
'Light Cavalry': ['4d20', '2d10', '1d10', '1d3', '1', '1d100<33'],
'Mounted Crossbowman': ['3d20', '4d4', '2d4', '1d2', '1d100<70', '1d100<23'],
'Horse Archers': ['3d20', '4d4', '2d4', '1d3', '1d100<70', '1d100<23'],
'Medium Cavalry': ['3d20', '4d4', '2d4', '1d2', '1d100<70', '1d100<23'],
'Heavy Cavalry': ['4d10', '1d10', '1d6', '2d100<50', '1d100<50', '1d100<15'],
'Cataphract Cavalry': ['3d10', '1d8', '1d4', '2d100<33', '1d100<40', '1d100<10'],
'Beast Riders': ['3d10', '1d8', '1d4', '2d100<33', '1d100<40', '1d100<10'],
},
'Specialists': {
},
'Henchmen': {
'Normal Men': ['4d100', '5d20', '4d8', '3d4', '1d6', '1d2'],
'Level 1': ['5d10', '2d6', '1d4', '1d2', '1d100<65', '1d100<20'],
'Level 2': ['3d10', '2d4', '1d3', '1', '1d100<40', '1d100<15'],
'Level 3': ['1d10', '1d3', '1d100<85', '1d100<33', '1d100<15', '1d100<5'],
'Level 4': ['1d6', '1d2', '1d100<45', '1d100<15', '1d100<5', '0']
},
};
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content.indexOf("!hirelingavailability") !== -1) {
var attrs = msg.content.split(' ');
attrs[2] = attrs[2].replace('-', ' ');
if(attrs[1] in availability_map && attrs[2] in availability_map[attrs[1]]) {
let roll_text = availability_map[attrs[1]][attrs[2]][attrs[3] - 1];
let template = `&{template:acks} {{name=Hireling Availability}} {{subheader=${attrs[1]} - ${attrs[2]}}} {{desc=Market Class ${attrs[3]}}} {{Available=[[${roll_text}]]}}`;
sendChat(msg.who, template);
}
}
});

24
roll20/macros/hireling-availability.macro

@ -0,0 +1,24 @@
!scriptcard {{
--#hideCard|1
--:Initialize Card|
--&HirelingType|?{Hireling Type|Mercenaries|Specialists|Henchmen}
--=MarketClass|?{Market Class|VI,6|V,5|IV,4|III,3|II,2|I,1}
--C[&HirelingType]|Henchmen:>Henchmen|Specialists:>Specialists|Mercenaries:>Mercenaries
--@hirelingavailability|[&HirelingType] [&SubType] [$MarketClass]
--X|
--:Henchmen|
--iHireling Availability Check;Select Henchman Type|q;SubType;Henchman|Normal Men,Normal-Men|Level 1,Level-1|Level 2,Level-2|Level 3,Level-3|Level 4,Level-4
--<|
--:Specialists|
--&SubType|SPECTYPE
--iHireling Availability Check;Select Specialist Type|q;SubType;Specialist|Not|Available|Yet
--<|
--:Mercenaries|
--iHireling Availability Check;Select Mercenary Type|q;SubType;Mercenary|Light Infantry,Light-Infantry|Heavy Infantry,Heavy-Infantry|Slinger,Slinger|Bowman,Bowman|Crossbowman,Crossbowman|Longbowman,Longbowman|Light Cavalry,Light-Cavalry|Mounted Crossbowman,Mounted-Crossbowman|Horse Archers,Horse-Archers|Medium Cavalry,Medium-Cavalry|Heavy Cavalry,Heavy-Cavalry|Cataphract Cavalry,Cataphract-Cavalry|Beast Riders,Beast-Riders
--<|
}}
Loading…
Cancel
Save