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. 67
      src/public/js/burning.js

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

@ -1,73 +1,71 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
Ascii85 (1.0.3) Ascii85 (1.1.0)
afm (0.2.2) afm (0.2.2)
backports (3.15.0) daemons (1.4.1)
daemons (1.3.1)
deep_merge (1.2.2) deep_merge (1.2.2)
eventmachine (1.2.7) eventmachine (1.2.7)
ffi (1.11.1) ffi (1.15.5)
hashery (2.1.2) hashery (2.1.2)
listen (3.1.5) listen (3.8.0)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.10)
ruby_dep (~> 1.2) multi_json (1.15.0)
multi_json (1.13.1) mustermann (3.0.0)
mustermann (1.0.3) ruby2_keywords (~> 0.0.1)
pdf-core (0.7.0) pdf-core (0.9.0)
pdf-reader (2.2.0) pdf-reader (2.11.0)
Ascii85 (~> 1.0.0) Ascii85 (~> 1.0)
afm (~> 0.2.1) afm (~> 0.2.1)
hashery (~> 2.0) hashery (~> 2.0)
ruby-rc4 ruby-rc4
ttfunk ttfunk
prawn (2.2.2) prawn (2.4.0)
pdf-core (~> 0.7.0) pdf-core (~> 0.9.0)
ttfunk (~> 1.5) ttfunk (~> 1.7)
prawn-templates (0.1.1) prawn-templates (0.1.2)
pdf-reader (~> 2.0) pdf-reader (~> 2.0)
prawn (~> 2.2) prawn (~> 2.2)
rack (2.0.7) rack (2.2.8)
rack-protection (2.0.5) rack-protection (3.1.0)
rack rack (~> 2.2, >= 2.2.4)
rb-fsevent (0.10.3) rb-fsevent (0.11.2)
rb-inotify (0.10.0) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
rerun (0.13.0) rerun (0.14.0)
listen (~> 3.0) listen (~> 3.0)
ruby-rc4 (0.1.5) ruby-rc4 (0.1.5)
ruby_dep (1.5.0) ruby2_keywords (0.0.5)
sinatra (2.0.5) sinatra (3.1.0)
mustermann (~> 1.0) mustermann (~> 3.0)
rack (~> 2.0) rack (~> 2.2, >= 2.2.4)
rack-protection (= 2.0.5) rack-protection (= 3.1.0)
tilt (~> 2.0) tilt (~> 2.0)
sinatra-contrib (2.0.5) sinatra-contrib (3.1.0)
backports (>= 2.8.2)
multi_json multi_json
mustermann (~> 1.0) mustermann (~> 3.0)
rack-protection (= 2.0.5) rack-protection (= 3.1.0)
sinatra (= 2.0.5) sinatra (= 3.1.0)
tilt (>= 1.3, < 3) tilt (~> 2.0)
thin (1.7.2) thin (1.8.2)
daemons (~> 1.0, >= 1.0.9) daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4) eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3) rack (>= 1, < 3)
tilt (2.0.9) tilt (2.2.0)
ttfunk (1.5.1) ttfunk (1.7.0)
PLATFORMS PLATFORMS
ruby x86_64-linux
DEPENDENCIES DEPENDENCIES
deep_merge (~> 1.2, >= 1.2.1) deep_merge (~> 1.2, >= 1.2.1)
prawn (= 2.2.2) prawn
prawn-templates (= 0.1.1) prawn-templates
rerun rerun
sinatra sinatra
sinatra-contrib sinatra-contrib
thin thin
BUNDLED WITH 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": [ "key_leads": [
"Guilder Setting" "Guilder Setting"
] ],
"born": true
}, },
"Tender": { "Tender": {
"time": 20, "time": 20,
@ -348,7 +349,8 @@
], ],
"key_leads": [ "key_leads": [
"Clansman Setting" "Clansman Setting"
] ],
"born": true
}, },
"Wordbearer": { "Wordbearer": {
"time": 15, "time": 15,
@ -649,7 +651,8 @@
], ],
"key_leads": [ "key_leads": [
"Clansman Setting" "Clansman Setting"
] ],
"born": true
}, },
"Ardent": { "Ardent": {
"time": 21, "time": 21,
@ -931,7 +934,8 @@
"key_leads": [ "key_leads": [
"Guilder Setting", "Guilder Setting",
"Artificer Setting" "Artificer Setting"
] ],
"born": true
}, },
"Abecedart": { "Abecedart": {
"time": 20, "time": 20,

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

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

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

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

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

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

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

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

Loading…
Cancel
Save