From b42ae65fa25f803d98cf16d16258ab50816ee9da Mon Sep 17 00:00:00 2001 From: Eric Fredricksen Date: Wed, 7 Jul 2010 11:09:50 -0700 Subject: [PATCH] Go through proper channels with test button --- config.js | 2 ++ main.js | 13 ++++++------- newguy.js | 15 +++++++++++---- roster.html | 4 +--- roster.js | 10 +--------- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/config.js b/config.js index 19161fe..b087119 100644 --- a/config.js +++ b/config.js @@ -171,6 +171,8 @@ function addToRoster(newguy) { var K = {}; +K.Stats = ["STR","CON","DEX","INT","WIS","CHA"]; + K.Spells = [ "Slime Finger", "Rabbit Punch", diff --git a/main.js b/main.js index e9f3a45..9d0aedd 100644 --- a/main.js +++ b/main.js @@ -19,7 +19,7 @@ // 1: pq 6.0, some early release I guess;)n't remember var RevString = '&rev=6'; -var game = {}; // queue: [] }; +var game = {}; var lasttick, timerid; function timeGetTime() { @@ -521,18 +521,14 @@ var AllBars, AllLists; function InitializeCharacter(sheet) { game = sheet; + randseed(game.seed); Put(Traits, 'Name', sheet.name); Put(Traits, 'Level', 1); Put(Traits, 'Race', sheet.race); Put(Traits, 'Class', sheet['class']); - Put(Stats, 'STR', sheet.STR); - Put(Stats, 'CON', sheet.CON); - Put(Stats, 'DEX', sheet.DEX); - Put(Stats, 'INT', sheet.INT); - Put(Stats, 'WIS', sheet.WIS); - Put(Stats, 'CHA', sheet.CHA); + $.each(K.Stats, function (i,stat) { Put(Stats, stat, sheet[stat]); }); Put(Stats, 'HP Max', Random(8) + sheet.CON.div(6)); Put(Stats, 'MP Max', Random(8) + sheet.INT.div(6)); @@ -990,6 +986,9 @@ function LoadCharacter() { } $("#titlebar span").text("Progress Quest - " + GameSaveName()); + + if (window.location.href.indexOf("?quit#") > 0) + $("#quit").click(); // TODO: cheesy } diff --git a/newguy.js b/newguy.js index 4942ed6..94f93aa 100644 --- a/newguy.js +++ b/newguy.js @@ -85,6 +85,9 @@ $(document).ready(function () { seed = new Alea(); RollEm(); + + if (window.location.href.indexOf("?sold") > 0) + sold(); // TODO: cheesy }); @@ -147,11 +150,15 @@ function sold() { birthday: ''+new Date(), birthstamp: +new Date() }; - $.each('STR,CON,DEX,INT,WIS,CHA'.split(','), function (index,value) { - newguy[value] = stats[value]; - }); + $.each(K.Stats, function (index,value) { + newguy[value] = stats[value]; + }); addToRoster(newguy); - window.location = "main.html#" + newguy.name; + + // TODO: cheesy + var args = (window.location.href.indexOf("?sold") > 0) ? "?quit" : ""; + + window.location = "main.html" + args + "#" + newguy.name; } function cancel() { diff --git a/roster.html b/roster.html index 8f6889f..d6d9369 100644 --- a/roster.html +++ b/roster.html @@ -33,8 +33,6 @@ body { margin-right: 10%; text-align: left; } -#roll { -} #newc { text-align: center; } @@ -63,7 +61,7 @@ blockquote { background-color: #ffd; border: solid 1px #fdb; padding: 1ex; -font-size: 11pt; + font-size: 11pt; } diff --git a/roster.js b/roster.js index b0ae474..3857f4c 100644 --- a/roster.js +++ b/roster.js @@ -47,15 +47,7 @@ $(document).ready(function () { }); $("#test").click(function () { - var n = GenerateName(); - games[n] = {Traits: {Level: -10,Name:n,Race:GenerateName(), - Class:GenerateName()}, - Stats: {best: "STR 99"}, - Plots: {last: "Act VII"}, - Spells: {best: "Bad Schwarma XIV"}, - Equips: {best: "Cottonwood Sollerets"}}; - storeRoster(games); - load(); + window.location = "newguy.html?sold"; }); function brag(sheet) {