Compare commits

...

8 Commits

  1. 4
      Gemfile
  2. 80
      Gemfile.lock
  3. 16
      README.md
  4. 12
      src/data/gold/lifepaths/dwarf.json
  5. 6
      src/data/gold/lifepaths/elf.json
  6. 12
      src/data/gold/lifepaths/man.json
  7. 6
      src/data/gold/lifepaths/orc.json
  8. 6
      src/data/gold/lifepaths/roden.json
  9. 6
      src/data/gold/lifepaths/wolf.json
  10. 9
      src/data/troll/lifepaths.json
  11. 1
      src/data/wizard/lifepaths.json
  12. 75
      src/public/js/burning.js

@ -3,8 +3,8 @@ source 'https://rubygems.org'
gem 'thin'
gem 'sinatra'
gem 'sinatra-contrib'
gem 'prawn', '2.2.2'
gem 'prawn-templates', '0.1.1'
gem 'prawn'
gem 'prawn-templates'
gem 'deep_merge', '~> 1.2', '>= 1.2.1'
group :development do

@ -1,73 +1,71 @@
GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.0.3)
Ascii85 (1.1.0)
afm (0.2.2)
backports (3.15.0)
daemons (1.3.1)
daemons (1.4.1)
deep_merge (1.2.2)
eventmachine (1.2.7)
ffi (1.11.1)
ffi (1.15.5)
hashery (2.1.2)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
multi_json (1.13.1)
mustermann (1.0.3)
pdf-core (0.7.0)
pdf-reader (2.2.0)
Ascii85 (~> 1.0.0)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
multi_json (1.15.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
pdf-core (0.9.0)
pdf-reader (2.11.0)
Ascii85 (~> 1.0)
afm (~> 0.2.1)
hashery (~> 2.0)
ruby-rc4
ttfunk
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
prawn-templates (0.1.1)
prawn (2.4.0)
pdf-core (~> 0.9.0)
ttfunk (~> 1.7)
prawn-templates (0.1.2)
pdf-reader (~> 2.0)
prawn (~> 2.2)
rack (2.0.7)
rack-protection (2.0.5)
rack
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
rack (2.2.8)
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rerun (0.13.0)
rerun (0.14.0)
listen (~> 3.0)
ruby-rc4 (0.1.5)
ruby_dep (1.5.0)
sinatra (2.0.5)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.5)
ruby2_keywords (0.0.5)
sinatra (3.1.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.1.0)
tilt (~> 2.0)
sinatra-contrib (2.0.5)
backports (>= 2.8.2)
sinatra-contrib (3.1.0)
multi_json
mustermann (~> 1.0)
rack-protection (= 2.0.5)
sinatra (= 2.0.5)
tilt (>= 1.3, < 3)
thin (1.7.2)
mustermann (~> 3.0)
rack-protection (= 3.1.0)
sinatra (= 3.1.0)
tilt (~> 2.0)
thin (1.8.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
tilt (2.0.9)
ttfunk (1.5.1)
tilt (2.2.0)
ttfunk (1.7.0)
PLATFORMS
ruby
x86_64-linux
DEPENDENCIES
deep_merge (~> 1.2, >= 1.2.1)
prawn (= 2.2.2)
prawn-templates (= 0.1.1)
prawn
prawn-templates
rerun
sinatra
sinatra-contrib
thin
BUNDLED WITH
1.17.2
2.3.7

@ -126,3 +126,19 @@ Some notes:
}
}
```
# Building
Requires Ruby 3.1 or better for support.
On Debian or derivatives this requires `apt-get install ruby-dev` in order to allow eventmachine to work (which is a hard dependency for thin, the webserver we're using for charred.
In order to run in normal use, simply run:
```
# sudo apt-get install ruby-dev bundler
# bundler install # on some distros this might be bundler3.1
# cd src
# HOST=0.0.0.0 PORT=7878 RACK_ENV=production ruby app.rb
```

@ -19,7 +19,8 @@
],
"key_leads": [
"Guilder Setting"
]
],
"born": true
},
"Tender": {
"time": 20,
@ -348,7 +349,8 @@
],
"key_leads": [
"Clansman Setting"
]
],
"born": true
},
"Wordbearer": {
"time": 15,
@ -649,7 +651,8 @@
],
"key_leads": [
"Clansman Setting"
]
],
"born": true
},
"Ardent": {
"time": 21,
@ -931,7 +934,8 @@
"key_leads": [
"Guilder Setting",
"Artificer Setting"
]
],
"born": true
},
"Abecedart": {
"time": 20,

@ -24,7 +24,8 @@
],
"key_leads": [
"Citadel Setting"
]
],
"born": true
},
"Rider": {
"time": 20,
@ -1178,7 +1179,8 @@
"key_leads": [
"Wilderlands Setting",
"Citadel Setting"
]
],
"born": true
},
"Student": {
"time": 25,

@ -25,7 +25,8 @@
"Professional Soldier Subsetting",
"Seafaring Setting",
"Religious Subsetting"
]
],
"born": true
},
"Farmer": {
"time": 8,
@ -701,6 +702,7 @@
},
"Villager Setting": {
"Village Born": {
"born": true,
"time": 10,
"res": 4,
"leads": [
@ -2408,6 +2410,7 @@
},
"City Dweller Setting": {
"City Born": {
"born": true,
"time": 12,
"res": 10,
"leads": [
@ -5136,7 +5139,8 @@
"Professional Soldier Subsetting",
"Seafaring Setting",
"Religious Subsetting"
]
],
"born": true
},
"Bastard": {
"time": 6,
@ -7617,7 +7621,8 @@
"key_leads": [
"Professional Soldier Subsetting",
"Outcast Subsetting"
]
],
"born": true
},
"Ditch Digging": {
"time": 4,
@ -9874,6 +9879,7 @@
},
"Seafaring Setting": {
"Son Of A Gun": {
"born": true,
"time": 8,
"res": 3,
"leads": [

@ -27,7 +27,8 @@
"key_leads": [
"Black Legion Subsetting",
"Servant Of The Dark Blood Subsetting"
]
],
"born": true
},
"Cattle Slave": {
"time": 5,
@ -427,7 +428,8 @@
],
"key_leads": [
"Servant Of The Dark Blood Subsetting"
]
],
"born": true
},
"The Rites": {
"time": 3,

@ -20,7 +20,8 @@
],
"key_leads": [
"Society Subsetting"
]
],
"born": true
},
"Hand": {
"time": 3,
@ -567,7 +568,8 @@
],
"key_leads": [
"Society Subsetting"
]
],
"born": true
},
"Pinky": {
"time": 2,

@ -23,7 +23,8 @@
],
"key_leads": [
"Captive Subsetting"
]
],
"born": true
},
"Yearling": {
"time": 1,
@ -329,7 +330,8 @@
],
"key_leads": [
"Captive Subsetting"
]
],
"born": true
},
"Caged And Beaten": {
"time": 0.5,

@ -19,7 +19,8 @@
],
"key_leads": [
"Pit Setting"
]
],
"born": true
},
"Bogey": {
"time": 7,
@ -249,7 +250,8 @@
],
"key_leads": [
"Pit Setting"
]
],
"born": true
},
"Dweller": {
"time": 4,
@ -384,7 +386,8 @@
"key_leads": [
"Pit Setting",
"Cavedweller Setting"
]
],
"born": true
},
"Tortured": {
"time": 3,

@ -3,6 +3,7 @@
"settings": {
"Special Gifted Lifepaths": {
"Gifted Child": {
"born": true,
"time": 9,
"res": 4,
"leads": [

@ -1937,63 +1937,31 @@ function calculateAge($scope){
$scope.age = age;
}
function isSubsetting(setting) { return !Object.values(setting).some((lp) => lp.born); }
function calculateSettingNames($scope, burningData){
var settingNames = null;
let stockSettings = burningData.lifepaths[$scope.stock];
$scope.settingNames = Object.keys(stockSettings);
var lastCurrentSetting = $scope.currentSetting;
if ( ! $scope.enforceLifepathReqts ) {
// Display all settings and subsettings
settingNames = [];
for(key in burningData.lifepaths[$scope.stock]){
settingNames.push(key);
}
}
else if ( $scope.selectedLifepaths.length == 0 ){
// All settings are allowed. Subsettings have no Born lifepath so don't include them.
settingNames = [];
for(key in burningData.lifepaths[$scope.stock]){
if( key.toLowerCase().indexOf("subsetting") < 0 ){
settingNames.push(key);
}
if ($scope.enforceLifepathReqts){
if ( $scope.selectedLifepaths.length == 0 ){
// All settings are allowed. Subsettings have no Born lifepath so don't include them.
$scope.settingNames = $scope.settingNames.filter(s => !isSubsetting(stockSettings[s]));
}
}
else {
// Only settings that are leads from the last lifepath are allowed
var lastLifepath = $scope.selectedLifepaths[$scope.selectedLifepaths.length-1];
settingNames = [];
var all = Object.keys(burningData.lifepaths[$scope.stock]);
for(var i = 0; i < all.length; i++){
//console.log("calculateSettingNames: checking if '"+all[i]+"' is allowed");
var setting = all[i];
if ( lastLifepath.setting == setting ){
settingNames.push(setting);
continue;
}
if ( lastLifepath.leads ){
for(var j = 0; j < lastLifepath.keyLeads.length; j++){
var lead = lastLifepath.keyLeads[j];
//console.log("calculateSettingNames: checking lead: '"+lead+"' is allowed");
else {
// Only settings that are leads from the last lifepath are allowed
var lastLifepath = $scope.selectedLifepaths[$scope.selectedLifepaths.length-1];
if( setting == lead ){
settingNames.push(setting);
}
}
}
// Doing this filtering instead of [lastLifepath.setting, ...lastLifepath.keyLeads] for two reasons:
// only presents settings present in this server and maintains relative order.
$scope.settingNames = $scope.settingNames.filter(s => s == lastLifepath.setting
|| (Array.isArray(lastLifepath.keyLeads) && lastLifepath.keyLeads.includes(s)));
}
}
$scope.settingNames = settingNames;
var currentSettingNeedsUpdate = true;
for(var i = 0; i < $scope.settingNames.length; i++){
if( $scope.settingNames[i] == lastCurrentSetting){
currentSettingNeedsUpdate = false;
break;
}
}
var currentSettingNeedsUpdate = !$scope.settingNames.includes(lastCurrentSetting);
if ( currentSettingNeedsUpdate && $scope.settingNames.length > 0 ){
$scope.currentSetting = $scope.settingNames[0];
@ -2006,13 +1974,6 @@ function calculatePTGS($scope) {
}
function isBornLifepath(lifepathName) {
return lifepathName.indexOf("Born") >= 0 ||
lifepathName == "Son Of A Gun" ||
lifepathName == "Gifted Child";
}
function calculateCurrentSettingLifepathNames($scope, burningData){
var currentSettingLifepathNames = null;
@ -2024,7 +1985,7 @@ function calculateCurrentSettingLifepathNames($scope, burningData){
if ( $scope.selectedLifepaths.length == 0 ){
// Only "Born" lifepaths are allowed
for(var i = 0; i < all.length; i++){
if ( isBornLifepath(all[i]) ){
if ( burningData.lifepaths[$scope.stock][$scope.currentSetting][all[i]].born ){
currentSettingLifepathNames.push(all[i]);
}
}
@ -2034,7 +1995,7 @@ function calculateCurrentSettingLifepathNames($scope, burningData){
for(var j = 0; j < lifepathNames.length; j++){
var lifepathName = lifepathNames[j];
if ( isBornLifepath(lifepathName) )
if ( burningData.lifepaths[$scope.stock][$scope.currentSetting][lifepathName].born )
continue;
var rexpr = burningData.lifepaths[$scope.stock][$scope.currentSetting][lifepathName].requires_expr

Loading…
Cancel
Save