Most of the main hull of navigation working

This commit is contained in:
Eric Fredricksen
2010-07-02 21:39:26 -07:00
parent 1d4908bfb1
commit 9e7bb12434
7 changed files with 38 additions and 12 deletions
+4 -4
View File
@@ -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 = {};
+1
View File
@@ -124,3 +124,4 @@
+process config.js
+process main.js
+process newguy.js
+process roster.js
+1
View File
@@ -10,6 +10,7 @@
<div id="titlebar">
<img src="swords.gif">
<span>Progress Quest/web v8.0</span>
<button style="float:right;color:red" id="quit">X</button>
</div>
<script src="jquery.js"></script>
+5
View File
@@ -1019,6 +1019,11 @@ function FormCreate() {
ExpBar.reposition(0);
EncumBar.reposition(0);
$("#quit").click(function () {
window.location = "roster.html";
// TODO: save
});
LoadCharacter();
}
+8 -3
View File
@@ -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() {
+1
View File
@@ -11,6 +11,7 @@
Here it goes
</dl>
<button id=roll>Roll One Up</button>
<button id=test>Test</button>
<button id=clear>Clear</button>
</body>
+17 -4
View File
@@ -12,13 +12,21 @@ $(document).ready(function () {
roster.text("Err...no local storage");
return;
}
$.each(games, function (index, c) {
$.each(games, function (key, c) {
var p = $("<dt/>");
p.appendTo(roster);
p.text(c.name);
var a = $("<a/>", {href: "main.html#" + c.name})
a.text(c.name);
a.appendTo(p);
var rm = $("<button/>");
rm.text("X");
rm.css("color", "red");
rm.appendTo(p);
rm.click(function () {
delete games[c.name];
storeRoster(games);
load();
});
p = $("<dd/>");
p.appendTo(roster);
p.text("Level " + (c.level || 1) + " " + c.race + " " + c['class']);
@@ -27,14 +35,19 @@ $(document).ready(function () {
load();
$("#roll").click(function () {
window.location = "newguy.html";
});
$("#test").click(function () {
games.push({testy:"cul", "name":"betsy"});
var n = GenerateName();
games[n] = {level: -10,name:n,race:GenerateName(),"class":GenerateName()};
storeRoster(games);
load();
});
$("#clear").click(function () {
storeRoster([]);
storeRoster({});
load();
});
});