diff --git a/config.js b/config.js
index 2ce11ba..2fe510a 100644
--- a/config.js
+++ b/config.js
@@ -128,10 +128,8 @@ function loadRoster() {
try {
r = JSON.parse(r);
} catch (err) {
- r = [];
+ r = {};
}
- //if (!$.isArray(roster))
- // roster = [];
return r;
}
}
@@ -141,7 +139,9 @@ function storeRoster(roster) {
}
function addToRoster(newguy) {
- storeRoster(loadRoster().concat([newguy]));
+ var r = loadRoster();
+ r[newguy.name] = newguy;
+ storeRoster(r);
}
var K = {};
diff --git a/jsl.conf b/jsl.conf
index e1cb767..84a91ef 100644
--- a/jsl.conf
+++ b/jsl.conf
@@ -123,4 +123,5 @@
#
+process config.js
+process main.js
-+process newguy.js
\ No newline at end of file
++process newguy.js
++process roster.js
\ No newline at end of file
diff --git a/main.html b/main.html
index 0333bb4..da0efe6 100644
--- a/main.html
+++ b/main.html
@@ -10,6 +10,7 @@
Progress Quest/web v8.0
+
diff --git a/main.js b/main.js
index 5744e29..3c8e6a6 100644
--- a/main.js
+++ b/main.js
@@ -1019,6 +1019,11 @@ function FormCreate() {
ExpBar.reposition(0);
EncumBar.reposition(0);
+ $("#quit").click(function () {
+ window.location = "roster.html";
+ // TODO: save
+ });
+
LoadCharacter();
}
diff --git a/newguy.js b/newguy.js
index 8fe4963..8c00907 100644
--- a/newguy.js
+++ b/newguy.js
@@ -38,11 +38,12 @@ function RollEm() {
(stats.total < (3 * 18)) ? 'silver' :
'white';
Total.css("background-color", color);
+
+ $("#Unroll").attr("disabled", !stats.history.length);
}
function RerollClick() {
stats.history.push(stats.seed);
- $("#Unroll").attr("disabled", false);
RollEm();
}
@@ -76,12 +77,12 @@ $(document).ready(function () {
$("#Name")[0].select();
}
$('#Sold').click(sold);
+ $('#Cancel').click(cancel);
});
function UnrollClick() {
randseed(stats.history.pop());
- $("#Unroll").attr("disabled", !stats.history.length);
RollEm();
}
@@ -144,8 +145,12 @@ function sold() {
$.each('STR,CON,DEX,INT,WIS,CHA'.split(','), function (index,value) {
newguy[value] = stats[value];
});
- alert(JSON.stringify(newguy));
addToRoster(newguy);
+ window.location = "main.html#" + newguy.name;
+}
+
+function cancel() {
+ window.location = "roster.html";
}
function GenClick() {
diff --git a/roster.html b/roster.html
index 07c7c06..8fb1265 100644
--- a/roster.html
+++ b/roster.html
@@ -11,6 +11,7 @@
Here it goes
+