mirror of
https://bitbucket.org/grumdrig/pq-web.git
synced 2026-09-29 08:44: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) {
|
||||
if (storage) {
|
||||
var r = loadRoster();
|
||||
r[newguy.name] = newguy;
|
||||
r[newguy.Traits.Name] = newguy;
|
||||
storeRoster(r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,5 @@
|
||||
// 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 lasttick, timerid;
|
||||
|
||||
@@ -550,20 +533,23 @@ var AllBars, AllLists;
|
||||
|
||||
|
||||
function InitializeCharacter(sheet) {
|
||||
// TODO: some of the below is probably redundant
|
||||
// TODO: just set needed info and then load game?
|
||||
|
||||
game = sheet;
|
||||
randseed(game.seed);
|
||||
|
||||
game.tasks = 0;
|
||||
game.elapsed = 0;
|
||||
|
||||
Put(Traits, 'Name', sheet.name);
|
||||
Put(Traits, 'Name', sheet.Traits.Name);
|
||||
Put(Traits, 'Level', 1);
|
||||
Put(Traits, 'Race', sheet.race);
|
||||
Put(Traits, 'Class', sheet['class']);
|
||||
Put(Traits, 'Race', sheet.Traits.Race);
|
||||
Put(Traits, 'Class', sheet.Traits.Class);
|
||||
|
||||
$.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));
|
||||
$.each(K.Stats, function (i,stat) { Put(Stats, stat, sheet.Stats[stat]); });
|
||||
Put(Stats, 'HP Max', Random(8) + sheet.Stats.CON.div(6));
|
||||
Put(Stats, 'MP Max', Random(8) + sheet.Stats.INT.div(6));
|
||||
|
||||
game.bestequip = 'Sharp Stick';
|
||||
Put(Equips, 'Weapon', game.bestequip);
|
||||
@@ -593,7 +579,6 @@ function InitializeCharacter(sheet) {
|
||||
Plots.Add((game.bestplot = 'Prologue'));
|
||||
game.act = 0;
|
||||
|
||||
//debugger;
|
||||
QuestBar.reset(1);
|
||||
|
||||
EncumBar.reset(GetI(Stats, "STR") + 10);
|
||||
@@ -1032,7 +1017,7 @@ function LoadCharacter() {
|
||||
storage = null;
|
||||
}
|
||||
|
||||
if (!sheet.Traits) {
|
||||
if (!sheet.Traits.Level) {
|
||||
// New game
|
||||
InitializeCharacter(sheet);
|
||||
} else {
|
||||
@@ -1047,13 +1032,14 @@ function LoadCharacter() {
|
||||
|
||||
|
||||
|
||||
/*$IFDEF CHEATS*/
|
||||
$(function() {
|
||||
function Cheats() {
|
||||
if ($(".cheater").length) return;
|
||||
|
||||
function cheat(label, effect) {
|
||||
var b = $("<button/>");
|
||||
b.text(label);
|
||||
b.click(effect);
|
||||
b.appendTo('body');
|
||||
$("<button/>", {
|
||||
class: "cheater",
|
||||
text: label,
|
||||
click: effect}).appendTo('body');
|
||||
}
|
||||
|
||||
cheat("Task", function () {
|
||||
@@ -1113,8 +1099,7 @@ $(function() {
|
||||
|
||||
cheat("Quit", quit);
|
||||
|
||||
});
|
||||
/*$ENDIF*/
|
||||
}
|
||||
|
||||
function HotOrNot() {
|
||||
// Figure out which spell is best
|
||||
@@ -1197,6 +1182,10 @@ function FormKeyDown(e) {
|
||||
//Navigate(GetHostAddr() + 'name=' + UrlEncode(Get(Traits,'Name')));
|
||||
}
|
||||
|
||||
if (e.which == 3) { // ^C
|
||||
Cheats();
|
||||
}
|
||||
|
||||
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);
|
||||
Brag("guild");
|
||||
|
||||
@@ -142,23 +142,26 @@ function TNewGuyForm_SoldClick() {
|
||||
|
||||
function sold() {
|
||||
var newguy = {
|
||||
name: $("#Name").val(),
|
||||
race: $("input:radio[name=Race]:checked").val(),
|
||||
'class': $("input:radio[name=Class]:checked").val(),
|
||||
Traits: {
|
||||
Name: $("#Name").val(),
|
||||
Race: $("input:radio[name=Race]:checked").val(),
|
||||
Class: $("input:radio[name=Class]:checked").val()
|
||||
},
|
||||
dna: stats.seed,
|
||||
seed: stats.seed,
|
||||
birthday: ''+new Date(),
|
||||
birthstamp: +new Date()
|
||||
birthstamp: +new Date(),
|
||||
Stats: {}
|
||||
};
|
||||
$.each(K.Stats, function (index,value) {
|
||||
newguy[value] = stats[value];
|
||||
newguy.Stats[value] = stats[value];
|
||||
});
|
||||
addToRoster(newguy);
|
||||
|
||||
// TODO: cheesy
|
||||
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() {
|
||||
|
||||
+4
-4
@@ -126,9 +126,9 @@ Testing:
|
||||
<td><a class="icon go">⚔</a></td>
|
||||
<td>
|
||||
<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 class="rc">Level $Traits.Level $class</div>
|
||||
<div class="rc">Level $Traits.Level $Traits.Class</div>
|
||||
<div class="bs">$bestequip / $bestspell / $beststat</div>
|
||||
</td>
|
||||
<td>
|
||||
@@ -141,10 +141,10 @@ Testing:
|
||||
|
||||
|
||||
<script type="text/charsheet" id="sheet">
|
||||
$name the $race [$hostname]
|
||||
$Traits.Name the $Traits.Race [$hostname]
|
||||
"$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)
|
||||
Quest: $bestquest ($QuestBar.hint)
|
||||
|
||||
@@ -1,50 +1,63 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
var games;
|
||||
var games;
|
||||
|
||||
function load() {
|
||||
var roster = $("#roster");
|
||||
roster.empty();
|
||||
|
||||
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.");
|
||||
function load() {
|
||||
var roster = $("#roster");
|
||||
roster.empty();
|
||||
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
|
||||
games = loadRoster();
|
||||
$.each(games, function (key, c) {
|
||||
if (!c.Traits) {
|
||||
delete games[key];
|
||||
return;
|
||||
}
|
||||
|
||||
games = loadRoster();
|
||||
$.each(games, function (key, c) {
|
||||
if (!c.Traits) {
|
||||
delete games[key];
|
||||
return;
|
||||
|
||||
var name = c.Traits.Name;
|
||||
|
||||
var br = brag(c);
|
||||
roster.append(br);
|
||||
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;
|
||||
|
||||
var br = brag(c);
|
||||
roster.append(br);
|
||||
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
|
||||
});
|
||||
|
||||
/*
|
||||
});
|
||||
|
||||
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'/>");
|
||||
p.appendTo(roster);
|
||||
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();
|
||||
|
||||
@@ -56,15 +69,5 @@ $(document).ready(function () {
|
||||
window.location = "newguy.html?sold";
|
||||
});
|
||||
|
||||
function brag(sheet) {
|
||||
var brag = $(template($("#badge").html(), sheet));
|
||||
if (sheet.motto)
|
||||
brag.find(".bs").text('"' + sheet.motto + '"');
|
||||
return brag;
|
||||
}
|
||||
|
||||
$("#clear").click(function () {
|
||||
storeRoster({});
|
||||
load();
|
||||
});
|
||||
$("#clear").click(clearRoster);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user