mirror of
https://bitbucket.org/grumdrig/pq-web.git
synced 2026-09-29 00:34:00 -06:00
Logo and get best stats showing on roster
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<img src="logo.png" alt="Progress Quest">
|
||||
|
||||
<div class="vbox window">
|
||||
|
||||
<div id="titlebar">
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
var RevString = '&rev=6';
|
||||
|
||||
var game = {}; // queue: [] };
|
||||
|
||||
var lasttick, timerid;
|
||||
|
||||
function timeGetTime() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
function StartTimer() {
|
||||
if (!game.timerid) {
|
||||
game.lasttick = timeGetTime();
|
||||
game.timerid = setInterval(Timer1Timer, 100);
|
||||
if (!timerid) {
|
||||
lasttick = timeGetTime();
|
||||
timerid = setInterval(Timer1Timer, 100);
|
||||
}
|
||||
// BS location for this, but...
|
||||
// MainForm.Caption = 'ProgressQuest - ' + ChangeFileExt(ExtractFileName(MainForm.GameSaveName()), '');
|
||||
@@ -449,6 +449,7 @@ function ListBox(id, columns, fixedkeys) {
|
||||
var tr = $("<tr><td>" + caption + "</td></tr>");
|
||||
tr.appendTo(this.box);
|
||||
tr.each(function () {this.scrollIntoView();});
|
||||
game[this.id].last = caption;
|
||||
return tr;
|
||||
};
|
||||
|
||||
@@ -492,14 +493,16 @@ function ListBox(id, columns, fixedkeys) {
|
||||
};
|
||||
|
||||
this.save = function (game) {
|
||||
var dict = {html: this.box.html()};
|
||||
if (!game[this.id])
|
||||
game[this.id] = {};
|
||||
var dict = game[this.id];
|
||||
dict.html = this.box.html();
|
||||
if (this.columns == 2) {
|
||||
this.rows().each(function (index) {
|
||||
dict[$(this).children().first().text()] =
|
||||
$(this).children().last().text();
|
||||
});
|
||||
}
|
||||
game[this.id] = dict;
|
||||
};
|
||||
|
||||
this.load = function (game) {
|
||||
@@ -565,6 +568,16 @@ $(document).ready(FormCreate);
|
||||
function WinSpell() {
|
||||
AddR(Spells, K.Spells[RandomLow(Min(GetI(Stats,'WIS')+GetI(Traits,'Level'),
|
||||
K.Spells.length))], 1);
|
||||
|
||||
// Now figure out which spell is best
|
||||
// TODO: really only need to check the one we just ++'d
|
||||
var flat = 1; // Flattening constant
|
||||
var best = 0;
|
||||
for (var i = 1; i < Spells.length(); ++i)
|
||||
if ((i+flat) * toArabic(Get(Spells,i)) >
|
||||
(best+flat) * toArabic(Get(Spells,best)))
|
||||
best = i;
|
||||
game.Spells.best = Spells.label(best) + ' ' + Get(Spells, best);
|
||||
}
|
||||
|
||||
function LPick(list, goal) {
|
||||
@@ -585,7 +598,7 @@ function Abs(x) {
|
||||
|
||||
function WinEquip() {
|
||||
var posn = Random(Equips.length());
|
||||
game.bestequip = posn; // remember as the "best item"
|
||||
|
||||
if (!posn) {
|
||||
stuff = K.Weapons;
|
||||
better = K.OffenseAttrib;
|
||||
@@ -615,6 +628,8 @@ function WinEquip() {
|
||||
if (plus > 0) name = '+' + name;
|
||||
|
||||
Put(Equips, posn, name);
|
||||
game.Equips.best = name;
|
||||
if (posn > 1) game.Equips.best += ' ' + Equips.label(posn);
|
||||
}
|
||||
|
||||
|
||||
@@ -638,6 +653,13 @@ function WinStat() {
|
||||
});
|
||||
}
|
||||
Add(Stats, $(i).find("td").first().text(), 1);
|
||||
|
||||
var best = 0;
|
||||
for (var i = 1; i <= 5; ++i) {
|
||||
if (GetI(Stats,i) > GetI(Stats,best))
|
||||
best = i;
|
||||
}
|
||||
game.Stats.best = Stats.label(best) + ' ' + GetI(Stats, best);
|
||||
}
|
||||
|
||||
function SpecialItem() {
|
||||
@@ -993,12 +1015,12 @@ function Timer1Timer() {
|
||||
|
||||
Dequeue();
|
||||
} else {
|
||||
var elapsed = timeGetTime() - game.lasttick;
|
||||
var elapsed = timeGetTime() - lasttick;
|
||||
if (elapsed > 100) elapsed = 100;
|
||||
if (elapsed < 0) elapsed = 0;
|
||||
TaskBar.increment(elapsed);
|
||||
}
|
||||
game.lasttick = timeGetTime();
|
||||
lasttick = timeGetTime();
|
||||
}
|
||||
|
||||
function FormCreate() {
|
||||
@@ -1065,7 +1087,7 @@ function LoadCharacter() {
|
||||
|
||||
|
||||
function FormShow() {
|
||||
if (game.timerid) return;
|
||||
if (timerid) return;
|
||||
var done = false;
|
||||
var exportandexit = false;
|
||||
|
||||
@@ -1125,9 +1147,9 @@ $(function() {
|
||||
});
|
||||
|
||||
cheat("Pause", function () {
|
||||
if (game.timerid) {
|
||||
clearTimeout(game.timerid);
|
||||
game.timerid = null;
|
||||
if (timerid) {
|
||||
clearTimeout(timerid);
|
||||
timerid = null;
|
||||
} else {
|
||||
StartTimer();
|
||||
}
|
||||
@@ -1245,8 +1267,7 @@ function Brag(trigger) {
|
||||
with (Traits) for (i = 0; i <= Items.length()-1; ++i)
|
||||
url = url + '&' + LowerCase(Items[i].Caption[1]) + '=' + UrlEncode(Items[i].Subitems[0]);
|
||||
url = url + '&x=' + IntToStr(ExpBar.Position);
|
||||
url = url + '&i=' + UrlEncode(Get(Equips, game.bestequip));
|
||||
if (game.bestequip > 1) url = url + '+' + Equips[game.bestequip].Caption;
|
||||
url = url + '&i=' + UrlEncode(game.Equips.best);
|
||||
var best = 0;
|
||||
if (Spells.length() > 0) with (Spells) {
|
||||
for (i = 1; i <= Items.length()-1; ++i)
|
||||
|
||||
@@ -12,6 +12,9 @@ input, button { display: inline; }
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<img src="logo.png" alt="Progress Quest">
|
||||
|
||||
<div class="vbox window">
|
||||
|
||||
<div id="titlebar">
|
||||
|
||||
+10
-2
@@ -16,13 +16,20 @@ div.rc {
|
||||
font: 8pt Verdana
|
||||
}
|
||||
|
||||
div.best {
|
||||
div.bs {
|
||||
font: 7pt Verdana
|
||||
}
|
||||
|
||||
td.brag button {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<img src="logo.png" alt="Progress Quest">
|
||||
|
||||
<dl id=roster>
|
||||
Here it goes
|
||||
</dl>
|
||||
@@ -37,7 +44,8 @@ Here it goes
|
||||
<script id="bumble" type="text/html">
|
||||
<table><tr><td class="brag">
|
||||
<div>
|
||||
<a><b>$Traits.Name</b></a> of Localhost ($Plots.act)
|
||||
<a><b>$Traits.Name</b></a> of Localhost ($Plots.last)
|
||||
<button>X</button>
|
||||
</div>
|
||||
<div class="rc">Level $Traits.Level $Traits.Race $Traits.Class</div>
|
||||
<div class="bs">$Equips.best / $Spells.best / $Stats.best</div>
|
||||
|
||||
@@ -5,7 +5,6 @@ $(document).ready(function () {
|
||||
function load() {
|
||||
var roster = $("#roster");
|
||||
roster.empty();
|
||||
roster.text("Loading...");
|
||||
|
||||
games = loadRoster()
|
||||
if (!games) {
|
||||
@@ -13,31 +12,21 @@ $(document).ready(function () {
|
||||
return;
|
||||
}
|
||||
$.each(games, function (key, c) {
|
||||
roster.append(brag(c));
|
||||
var name = c.Traits.Name;
|
||||
|
||||
var p = $("<p/>");
|
||||
p.appendTo(roster);
|
||||
p.text(JSON.stringify(c));
|
||||
|
||||
var p = $("<dt/>");
|
||||
p.appendTo(roster);
|
||||
var a = $("<a/>", {href: "main.html#" + c.name})
|
||||
a.text(c.name);
|
||||
a.appendTo(p);
|
||||
var br = brag(c);
|
||||
roster.append(br);
|
||||
br.find("a").attr("href", "main.html#" + name)
|
||||
|
||||
var rm = $("<button/>");
|
||||
rm.text("X");
|
||||
rm.css("color", "red");
|
||||
rm.appendTo(roster);
|
||||
rm.click(function () {
|
||||
delete games[c.name];
|
||||
br.find("button").click(function () {
|
||||
delete games[name];
|
||||
storeRoster(games);
|
||||
load();
|
||||
});
|
||||
|
||||
p = $("<dd/>");
|
||||
|
||||
var p = $("<p style='font:6pt verdana'/>");
|
||||
p.appendTo(roster);
|
||||
p.text("Level " + (c.level || 1) + " " + c.race + " " + c['class']);
|
||||
p.text(JSON.stringify(c));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user