Mottos and other support for keys

This commit is contained in:
Eric Fredricksen
2010-07-05 23:44:05 -07:00
parent 39229d3667
commit a5295df3ce
2 changed files with 31 additions and 35 deletions
+26 -33
View File
@@ -814,7 +814,7 @@ function ExportCharSheet() {
*/ */
} }
function TMainForm_CharSheet() { function CharSheet() {
var f = ''; var f = '';
function Wr(a) { f = f + a; } function Wr(a) { f = f + a; }
function WrLn(a) { if (a != undefined) Wr(a); Wr("\r\n"); } function WrLn(a) { if (a != undefined) Wr(a); Wr("\r\n"); }
@@ -1024,6 +1024,8 @@ function FormCreate() {
}); });
LoadCharacter(); LoadCharacter();
$(document).keypress(FormKeyDown);
} }
@@ -1210,29 +1212,34 @@ function GameSaveName() {
} }
function TMainForm_FormKeyDown() { function InputBox(message, def) {
if ((FindWindow('TAppBuilder', nil) > 0) && (ssCtrl in Shift) && (ssShift in Shift) && (Key == ord('C'))) { var i = prompt(message, def || '');
/*$IFDEF CHEATS*/ return (i !== null) ? i : def;
Cheats.Visible = ! Cheats.Visible;
/*$ENDIF*/
} }
if ((ssCtrl in Shift) && (Key == ord('A'))) {
ShowMessage(CharSheet); function FormKeyDown(e) {
if (e.which == 1) { // ^A
alert(CharSheet());
} }
if (!GetPasskey()) Exit; // no need for these things
if ((ssCtrl in Shift) && (Key == ord('B'))) { if (e.which == 13) { // ^M
Brag('b'); game.motto = InputBox('Declare your motto!', game.motto);
Navigate(GetHostAddr + 'name=' + UrlEncode(Get(Traits,'Name'))); // Brag('m');
// Navigate(GetHostAddr + 'name=' + UrlEncode(Get(Traits,'Name')));
} }
if ((ssCtrl in Shift) && (Key == ord('M'))) {
SetMotto(InputBox('Progress Quest', 'Declare your motto!', GetMotto)); if (!GetPasskey()) return; // no need for these things
Brag('m');
Navigate(GetHostAddr + 'name=' + UrlEncode(Get(Traits,'Name'))); if (e.which == 2) { // ^B
//Brag('b');
//Navigate(GetHostAddr + 'name=' + UrlEncode(Get(Traits,'Name')));
} }
if ((ssCtrl in Shift) && (Key == ord('G'))) {
SetGuild(InputBox('Progress Quest', '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', GetGuild)); if (e.which == 7) { // ^G
Guildify; 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);
// Guildify();
} }
} }
function Navigate(url) { function Navigate(url) {
@@ -1316,17 +1323,3 @@ function TMainForm_Guildify() {
} }
} }
function TMainForm_OnQueryEndSession() {
FReportSave = false;
FormClose(Self, Action);
ReplyMessage(-1);
}
function TMainForm_OnEndSession() {
if (Msg.wParam) {
FReportSave = false;
FormClose(Self, Action);
}
ReplyMessage(0);
}
+4 -1
View File
@@ -64,7 +64,10 @@ $(document).ready(function () {
}); });
return dict || ''; return dict || '';
}); });
return $(brag); brag = $(brag);
if (sheet.motto)
brag.find(".bs").text('"' + sheet.motto + '"');
return brag;
} }
$("#clear").click(function () { $("#clear").click(function () {