Kill redundant info in saves.

Move TODOs into a README.

Hide the cheats not very well.
This commit is contained in:
Eric Fredricksen
2010-07-10 14:08:51 -07:00
parent 18c1b16ce8
commit 92027392dd
7 changed files with 107 additions and 95 deletions
+18
View File
@@ -0,0 +1,18 @@
// Before launch
// TODO: Hide cheaters
// After launch
// TODO: No local storage on IE - why?
// TODO: Do something about background-size failure on IE.
// TODO: Stop using HTML to save the game
// TODO: Get fully operational in Opera
// TODO: Online leader board
// TODO: Server side saves
// TODO: Active controls on fake Xp screen
// TODO: Refactor logic to run with visible interface as a layer on top
// TODO: Charsheet in some more pleasing delivery method
// TODO: Use a cookie rather than a fragment to choose char?
// TODO: Line up things on main.html perfectly
// TODO: Finalize borders in sections of main
// TODO: Better ipad support
+1 -1
View File
@@ -214,7 +214,7 @@ function storeRoster(roster) {
function addToRoster(newguy) { function addToRoster(newguy) {
if (storage) { if (storage) {
var r = loadRoster(); var r = loadRoster();
r[newguy.name] = newguy; r[newguy.Traits.Name] = newguy;
storeRoster(r); storeRoster(r);
} }
} }
-1
View File
@@ -177,7 +177,6 @@
</div> </div>
<br> <br>
Cheat
</body> </body>
+22 -33
View File
@@ -1,22 +1,5 @@
// Copyright (c)2002-2010 Eric Fredricksen <e@fredricksen.net> all rights reserved // Copyright (c)2002-2010 Eric Fredricksen <e@fredricksen.net> all rights reserved
// Before launch
// TODO: Test and get working in IE
// TODO: Hide cheaters
// After launch
// TODO: Stop using HTML to save the game
// TODO: Get fully operational in Opera
// TODO: Online leader board
// TODO: Server side saves
// TODO: Active controls on fake Xp screen
// TODO: Refactor logic to run with visible interface as a layer on top
// TODO: Charsheet in some more pleasing delivery method
// TODO: Use a cookie rather than a fragment to choose char?
// TODO: Line up things on main.html perfectly
// TODO: Finalize borders in sections of main
// TODO: Better ipad support
var game = {}; var game = {};
var lasttick, timerid; var lasttick, timerid;
@@ -550,20 +533,23 @@ var AllBars, AllLists;
function InitializeCharacter(sheet) { function InitializeCharacter(sheet) {
// TODO: some of the below is probably redundant
// TODO: just set needed info and then load game?
game = sheet; game = sheet;
randseed(game.seed); randseed(game.seed);
game.tasks = 0; game.tasks = 0;
game.elapsed = 0; game.elapsed = 0;
Put(Traits, 'Name', sheet.name); Put(Traits, 'Name', sheet.Traits.Name);
Put(Traits, 'Level', 1); Put(Traits, 'Level', 1);
Put(Traits, 'Race', sheet.race); Put(Traits, 'Race', sheet.Traits.Race);
Put(Traits, 'Class', sheet['class']); Put(Traits, 'Class', sheet.Traits.Class);
$.each(K.Stats, function (i,stat) { Put(Stats, stat, sheet[stat]); }); $.each(K.Stats, function (i,stat) { Put(Stats, stat, sheet.Stats[stat]); });
Put(Stats, 'HP Max', Random(8) + sheet.CON.div(6)); Put(Stats, 'HP Max', Random(8) + sheet.Stats.CON.div(6));
Put(Stats, 'MP Max', Random(8) + sheet.INT.div(6)); Put(Stats, 'MP Max', Random(8) + sheet.Stats.INT.div(6));
game.bestequip = 'Sharp Stick'; game.bestequip = 'Sharp Stick';
Put(Equips, 'Weapon', game.bestequip); Put(Equips, 'Weapon', game.bestequip);
@@ -593,7 +579,6 @@ function InitializeCharacter(sheet) {
Plots.Add((game.bestplot = 'Prologue')); Plots.Add((game.bestplot = 'Prologue'));
game.act = 0; game.act = 0;
//debugger;
QuestBar.reset(1); QuestBar.reset(1);
EncumBar.reset(GetI(Stats, "STR") + 10); EncumBar.reset(GetI(Stats, "STR") + 10);
@@ -1032,7 +1017,7 @@ function LoadCharacter() {
storage = null; storage = null;
} }
if (!sheet.Traits) { if (!sheet.Traits.Level) {
// New game // New game
InitializeCharacter(sheet); InitializeCharacter(sheet);
} else { } else {
@@ -1047,13 +1032,14 @@ function LoadCharacter() {
/*$IFDEF CHEATS*/ function Cheats() {
$(function() { if ($(".cheater").length) return;
function cheat(label, effect) { function cheat(label, effect) {
var b = $("<button/>"); $("<button/>", {
b.text(label); class: "cheater",
b.click(effect); text: label,
b.appendTo('body'); click: effect}).appendTo('body');
} }
cheat("Task", function () { cheat("Task", function () {
@@ -1113,8 +1099,7 @@ $(function() {
cheat("Quit", quit); cheat("Quit", quit);
}); }
/*$ENDIF*/
function HotOrNot() { function HotOrNot() {
// Figure out which spell is best // Figure out which spell is best
@@ -1197,6 +1182,10 @@ function FormKeyDown(e) {
//Navigate(GetHostAddr() + 'name=' + UrlEncode(Get(Traits,'Name'))); //Navigate(GetHostAddr() + 'name=' + UrlEncode(Get(Traits,'Name')));
} }
if (e.which == 3) { // ^C
Cheats();
}
if (e.which == 7) { // ^G if (e.which == 7) { // ^G
game.guild = InputBox('Choose a guild.\r\rMake sure you undestand the guild rules before you join one. To learn more about guilds, visit http://progressquest.com/guilds.php', game.guild); game.guild = InputBox('Choose a guild.\r\rMake sure you undestand the guild rules before you join one. To learn more about guilds, visit http://progressquest.com/guilds.php', game.guild);
Brag("guild"); Brag("guild");
+9 -6
View File
@@ -142,23 +142,26 @@ function TNewGuyForm_SoldClick() {
function sold() { function sold() {
var newguy = { var newguy = {
name: $("#Name").val(), Traits: {
race: $("input:radio[name=Race]:checked").val(), Name: $("#Name").val(),
'class': $("input:radio[name=Class]:checked").val(), Race: $("input:radio[name=Race]:checked").val(),
Class: $("input:radio[name=Class]:checked").val()
},
dna: stats.seed, dna: stats.seed,
seed: stats.seed, seed: stats.seed,
birthday: ''+new Date(), birthday: ''+new Date(),
birthstamp: +new Date() birthstamp: +new Date(),
Stats: {}
}; };
$.each(K.Stats, function (index,value) { $.each(K.Stats, function (index,value) {
newguy[value] = stats[value]; newguy.Stats[value] = stats[value];
}); });
addToRoster(newguy); addToRoster(newguy);
// TODO: cheesy // TODO: cheesy
var args = (window.location.href.indexOf("?sold") > 0) ? "?quit" : ""; var args = (window.location.href.indexOf("?sold") > 0) ? "?quit" : "";
window.location = "main.html" + args + "#" + newguy.name; window.location = "main.html" + args + "#" + newguy.Traits.Name;
} }
function cancel() { function cancel() {
+4 -4
View File
@@ -126,9 +126,9 @@ Testing:
<td><a class="icon go">&#x2694;</a></td> <td><a class="icon go">&#x2694;</a></td>
<td> <td>
<div> <div>
<a class="go"><b>$name</b></a> the $race ($bestplot) <a class="go"><b>$Traits.Name</b></a> the $Trace.Race ($bestplot)
</div> </div>
<div class="rc">Level $Traits.Level $class</div> <div class="rc">Level $Traits.Level $Traits.Class</div>
<div class="bs">$bestequip / $bestspell / $beststat</div> <div class="bs">$bestequip / $bestspell / $beststat</div>
</td> </td>
<td> <td>
@@ -141,10 +141,10 @@ Testing:
<script type="text/charsheet" id="sheet"> <script type="text/charsheet" id="sheet">
$name the $race [$hostname] $Traits.Name the $Traits.Race [$hostname]
"$motto" "$motto"
Level $Traits.Level $class (exp. $ExpBar.position/$ExpBar.max) Level $Traits.Level $Traits.Class (exp. $ExpBar.position/$ExpBar.max)
Plot stage: $bestplot ($PlotBar.hint) Plot stage: $bestplot ($PlotBar.hint)
Quest: $bestquest ($QuestBar.hint) Quest: $bestquest ($QuestBar.hint)
+16 -13
View File
@@ -1,5 +1,3 @@
$(document).ready(function () {
var games; var games;
function load() { function load() {
@@ -46,6 +44,21 @@ $(document).ready(function () {
}); });
} }
function brag(sheet) {
var brag = $(template($("#badge").html(), sheet));
if (sheet.motto)
brag.find(".bs").text('"' + sheet.motto + '"');
return brag;
}
function clearRoster() {
storeRoster({});
load();
}
$(document).ready(function () {
load(); load();
$("#roll").click(function () { $("#roll").click(function () {
@@ -56,15 +69,5 @@ $(document).ready(function () {
window.location = "newguy.html?sold"; window.location = "newguy.html?sold";
}); });
function brag(sheet) { $("#clear").click(clearRoster);
var brag = $(template($("#badge").html(), sheet));
if (sheet.motto)
brag.find(".bs").text('"' + sheet.motto + '"');
return brag;
}
$("#clear").click(function () {
storeRoster({});
load();
});
}); });