mirror of
https://bitbucket.org/grumdrig/pq-web.git
synced 2026-09-29 00:34:00 -06:00
Kill redundant info in saves.
Move TODOs into a README. Hide the cheats not very well.
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
@@ -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,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");
|
||||||
|
|||||||
@@ -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
@@ -126,9 +126,9 @@ Testing:
|
|||||||
<td><a class="icon go">⚔</a></td>
|
<td><a class="icon go">⚔</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)
|
||||||
|
|||||||
@@ -1,50 +1,63 @@
|
|||||||
$(document).ready(function () {
|
var games;
|
||||||
|
|
||||||
var games;
|
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
var roster = $("#roster");
|
var roster = $("#roster");
|
||||||
roster.empty();
|
roster.empty();
|
||||||
|
|
||||||
if (!window.localStorage) {
|
if (!window.localStorage) {
|
||||||
roster.html("<b>Hrumph:</b> This browser does not support local storage. You can still play fast and loose: your character will live only as long as the game stays running in your browser.");
|
roster.html("<b>Hrumph:</b> This browser does not support local storage. You can still play fast and loose: your character will live only as long as the game stays running in your browser.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
games = loadRoster();
|
||||||
|
$.each(games, function (key, c) {
|
||||||
|
if (!c.Traits) {
|
||||||
|
delete games[key];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
games = loadRoster();
|
var name = c.Traits.Name;
|
||||||
$.each(games, function (key, c) {
|
|
||||||
if (!c.Traits) {
|
var br = brag(c);
|
||||||
delete games[key];
|
roster.append(br);
|
||||||
return;
|
br.find("a.go").attr("href", "main.html#" + name);
|
||||||
|
|
||||||
|
br.find("a.x").click(function () {
|
||||||
|
if (confirm("Terminate " + Pick(["faithful","noble","loyal","brave"])+
|
||||||
|
" " + name + "?")) {
|
||||||
|
delete games[name];
|
||||||
|
storeRoster(games);
|
||||||
|
load();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
var name = c.Traits.Name;
|
|
||||||
|
br.find("a.sheet").click(function () {
|
||||||
var br = brag(c);
|
alert(template($("#sheet").html(), games[name]));
|
||||||
roster.append(br);
|
// TODO: put in a window or whatev
|
||||||
br.find("a.go").attr("href", "main.html#" + name);
|
});
|
||||||
|
|
||||||
br.find("a.x").click(function () {
|
/*
|
||||||
if (confirm("Terminate " + Pick(["faithful","noble","loyal","brave"])+
|
|
||||||
" " + name + "?")) {
|
|
||||||
delete games[name];
|
|
||||||
storeRoster(games);
|
|
||||||
load();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
br.find("a.sheet").click(function () {
|
|
||||||
alert(template($("#sheet").html(), games[name]));
|
|
||||||
// TODO: put in a window or whatev
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
var p = $("<p style='font:6pt verdana'/>");
|
var p = $("<p style='font:6pt verdana'/>");
|
||||||
p.appendTo(roster);
|
p.appendTo(roster);
|
||||||
p.text(JSON.stringify(c));
|
p.text(JSON.stringify(c));
|
||||||
*/
|
*/
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
@@ -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();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user