Compare commits

..

No commits in common. 'cc968e00e6707ef6005d3d9ad62752e0c33a8b49' and '2d6d5347988149999bd636b4110f7511d61264eb' have entirely different histories.

  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'
gem 'prawn-templates'
gem 'prawn', '2.2.2'
gem 'prawn-templates', '0.1.1'
gem 'deep_merge', '~> 1.2', '>= 1.2.1'
group :development do

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

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

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

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

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

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

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

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

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

@ -1937,31 +1937,63 @@ function calculateAge($scope){
$scope.age = age;
}
function isSubsetting(setting) { return !Object.values(setting).some((lp) => lp.born); }
function calculateSettingNames($scope, burningData){
let stockSettings = burningData.lifepaths[$scope.stock];
$scope.settingNames = Object.keys(stockSettings);
var settingNames = null;
var lastCurrentSetting = $scope.currentSetting;
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]));
if ( ! $scope.enforceLifepathReqts ) {
// Display all settings and subsettings
settingNames = [];
for(key in burningData.lifepaths[$scope.stock]){
settingNames.push(key);
}
else {
// Only settings that are leads from the last lifepath are allowed
var lastLifepath = $scope.selectedLifepaths[$scope.selectedLifepaths.length-1];
}
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);
}
}
}
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");
// 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)));
if( setting == lead ){
settingNames.push(setting);
}
}
}
}
}
var currentSettingNeedsUpdate = !$scope.settingNames.includes(lastCurrentSetting);
$scope.settingNames = settingNames;
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 ){
$scope.currentSetting = $scope.settingNames[0];
@ -1974,6 +2006,13 @@ 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;
@ -1985,7 +2024,7 @@ function calculateCurrentSettingLifepathNames($scope, burningData){
if ( $scope.selectedLifepaths.length == 0 ){
// Only "Born" lifepaths are allowed
for(var i = 0; i < all.length; i++){
if ( burningData.lifepaths[$scope.stock][$scope.currentSetting][all[i]].born ){
if ( isBornLifepath(all[i]) ){
currentSettingLifepathNames.push(all[i]);
}
}
@ -1995,7 +2034,7 @@ function calculateCurrentSettingLifepathNames($scope, burningData){
for(var j = 0; j < lifepathNames.length; j++){
var lifepathName = lifepathNames[j];
if ( burningData.lifepaths[$scope.stock][$scope.currentSetting][lifepathName].born )
if ( isBornLifepath(lifepathName) )
continue;
var rexpr = burningData.lifepaths[$scope.stock][$scope.currentSetting][lifepathName].requires_expr

Loading…
Cancel
Save