mirror of
https://bitbucket.org/grumdrig/pq.git
synced 2026-09-29 00:33:59 -06:00
Part II: This is an ex post facto rendering of pq6 in its various versions in
svn, so that changes will be trackable thataway This is version 6.1 as found in the old sources. Used whathappened.py to update it.
This commit is contained in:
+102
-32
@@ -1,13 +1,14 @@
|
||||
unit NewGuy;
|
||||
{ copyright (c)2002 Eric Fredricksen all rights reserved }
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, ComCtrls, Psock, NMHttp, NMURL;
|
||||
Dialogs, StdCtrls, ExtCtrls, ComCtrls, Psock, NMHttp, NMURL, AppEvnts;
|
||||
|
||||
type
|
||||
TForm2 = class(TForm)
|
||||
TNewGuyForm = class(TForm)
|
||||
Race: TRadioGroup;
|
||||
Klass: TRadioGroup;
|
||||
Label2: TLabel;
|
||||
@@ -28,42 +29,48 @@ type
|
||||
Total: TPanel;
|
||||
Sold: TButton;
|
||||
Unroll: TButton;
|
||||
GroupBox2: TGroupBox;
|
||||
GameStyle: TTrackBar;
|
||||
Label9: TLabel;
|
||||
Label10: TLabel;
|
||||
Name: TLabeledEdit;
|
||||
OldRolls: TListBox;
|
||||
Button2: TButton;
|
||||
Server: TNMHTTP;
|
||||
Online: TCheckBox;
|
||||
PoorCodeDesign: TNMURL;
|
||||
Account: TLabeledEdit;
|
||||
Password: TLabeledEdit;
|
||||
ApplicationEvents1: TApplicationEvents;
|
||||
GuildGet: TNMHTTP;
|
||||
procedure RerollClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure UnrollClick(Sender: TObject);
|
||||
procedure ServerSuccess(Cmd: CmdType);
|
||||
procedure SoldClick(Sender: TObject);
|
||||
procedure ServerFailure(Cmd: CmdType);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ServerAboutToSend(Sender: TObject);
|
||||
procedure ApplicationEvents1Minimize(Sender: TObject);
|
||||
procedure GuildGetSuccess(Cmd: CmdType);
|
||||
private
|
||||
procedure RollEm;
|
||||
function GetAccount: String;
|
||||
function GetPassword: String;
|
||||
public
|
||||
procedure ReportSuccess(Cmd: CmdType);
|
||||
procedure BragSuccess(Cmd: CmdType);
|
||||
function Go: Boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
Form2: TForm2;
|
||||
NewGuyForm: TNewGuyForm;
|
||||
|
||||
function UrlEncode(s: string): string;
|
||||
|
||||
implementation
|
||||
|
||||
uses Main;
|
||||
uses Main, SelServ;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
function UrlEncode(s: string): string;
|
||||
begin
|
||||
Form2.PoorCodeDesign.InputString := s;
|
||||
Result := Form2.PoorCodeDesign.Encode;
|
||||
NewGuyForm.PoorCodeDesign.InputString := s;
|
||||
Result := NewGuyForm.PoorCodeDesign.Encode;
|
||||
end;
|
||||
|
||||
procedure Roll(stat: TPanel);
|
||||
@@ -85,7 +92,7 @@ begin
|
||||
Result := Result / d;
|
||||
end;
|
||||
|
||||
procedure TForm2.RollEm;
|
||||
procedure TNewGuyForm.RollEm;
|
||||
begin
|
||||
ReRoll.Tag := RandSeed;
|
||||
Roll(STR);
|
||||
@@ -103,25 +110,37 @@ begin
|
||||
else Total.Color := clWhite;
|
||||
end;
|
||||
|
||||
procedure TForm2.RerollClick(Sender: TObject);
|
||||
procedure TNewGuyForm.RerollClick(Sender: TObject);
|
||||
begin
|
||||
OldRolls.Items.Insert(0, IntToStr(ReRoll.Tag));
|
||||
Unroll.Enabled := true;
|
||||
RollEm;
|
||||
end;
|
||||
|
||||
procedure TForm2.FormShow(Sender: TObject);
|
||||
function TNewGuyForm.Go: Boolean;
|
||||
begin
|
||||
Randomize;
|
||||
RollEm;
|
||||
with Race do
|
||||
ItemIndex := Random(Items.Count);
|
||||
with Klass do
|
||||
ItemIndex := Random(Items.Count);
|
||||
Name.SetFocus;
|
||||
Tag := 1;
|
||||
Result := mrOk = ShowModal;
|
||||
end;
|
||||
|
||||
procedure TForm2.UnrollClick(Sender: TObject);
|
||||
procedure TNewGuyForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
if Tag > 0 then begin
|
||||
Tag := 0;
|
||||
Caption := 'Progress Quest - New Character';
|
||||
if MainForm.GetHostName <> '' then
|
||||
Caption := Caption + ' [' + MainForm.GetHostName + ']';
|
||||
Randomize;
|
||||
RollEm;
|
||||
with Race do
|
||||
ItemIndex := Random(Items.Count);
|
||||
with Klass do
|
||||
ItemIndex := Random(Items.Count);
|
||||
Name.SetFocus;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TNewGuyForm.UnrollClick(Sender: TObject);
|
||||
begin
|
||||
RandSeed := StrToInt(OldRolls.Items[0]);
|
||||
OldRolls.Items.Delete(0);
|
||||
@@ -129,11 +148,12 @@ begin
|
||||
RollEm;
|
||||
end;
|
||||
|
||||
procedure TForm2.ServerSuccess(Cmd: CmdType);
|
||||
procedure TNewGuyForm.ServerSuccess(Cmd: CmdType);
|
||||
begin
|
||||
if (LowerCase(Split(Server.Body,0)) = 'ok') then begin
|
||||
Form1.Traits.Hint := Split(Server.Body,1);
|
||||
Form1.Traits.Tag := StrToInt(Form1.Traits.Hint);
|
||||
MainForm.SetPasskey(Split(Server.Body,1));
|
||||
MainForm.SetLogin(GetAccount);
|
||||
MainForm.SetPassword(GetPassword);
|
||||
Server.OnSuccess := nil;
|
||||
Server.OnFailure := nil;
|
||||
ModalResult := mrOk;
|
||||
@@ -142,20 +162,43 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm2.ReportSuccess(Cmd: CmdType);
|
||||
procedure TNewGuyForm.BragSuccess(Cmd: CmdType);
|
||||
begin
|
||||
ShowMessage(Server.Body);
|
||||
if (LowerCase(Split(Server.Body,0)) = 'report') then
|
||||
ShowMessage(Split(Server.Body,1));
|
||||
end;
|
||||
|
||||
procedure TForm2.SoldClick(Sender: TObject);
|
||||
function TNewGuyForm.GetAccount: String;
|
||||
begin
|
||||
if not Online.Checked
|
||||
Result := '';
|
||||
if Account.Visible then Result := Account.Text;
|
||||
end;
|
||||
|
||||
function TNewGuyForm.GetPassword: String;
|
||||
begin
|
||||
Result := '';
|
||||
if Password.Visible then Result := Password.Text;
|
||||
end;
|
||||
|
||||
procedure TNewGuyForm.SoldClick(Sender: TObject);
|
||||
var url, args: String;
|
||||
begin
|
||||
if MainForm.GetHostAddr = ''
|
||||
then ModalResult := mrOk
|
||||
else begin
|
||||
try
|
||||
Screen.Cursor := crHourglass;
|
||||
try
|
||||
Server.Get('http://www.progressquest.com/hi.php?cmd=create&name=' + UrlEncode(Name.Text) + RevString);
|
||||
Server.HeaderInfo.UserId := GetAccount;
|
||||
Server.HeaderInfo.Password := GetPassword;
|
||||
args := 'cmd=create' +
|
||||
'&name=' + UrlEncode(Name.Text) +
|
||||
'&realm=' + UrlEncode(MainForm.GetHostName) +
|
||||
RevString;
|
||||
if (MainForm.Label8.Tag and 16) = 0
|
||||
then url := MainForm.GetHostAddr
|
||||
else url := 'http://www.progressquest.com/create.php?';
|
||||
Server.Get(url + args);
|
||||
except
|
||||
on ESockError do begin
|
||||
ShowMessage('Error connecting to server');
|
||||
@@ -168,4 +211,31 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TNewGuyForm.ServerFailure(Cmd: CmdType);
|
||||
begin
|
||||
ShowMessage('Connection to server ' + MainForm.GetHostName + ' failed');
|
||||
end;
|
||||
|
||||
procedure TNewGuyForm.ServerAboutToSend(Sender: TObject);
|
||||
begin
|
||||
Server.SendHeader.Values['Content-Type'] := 'text/plain';
|
||||
Server.SendHeader.Values['Motto'] := MainForm.GetMotto;
|
||||
Server.SendHeader.Values['Guild'] := MainForm.GetGuild;
|
||||
end;
|
||||
|
||||
procedure TNewGuyForm.ApplicationEvents1Minimize(Sender: TObject);
|
||||
begin
|
||||
MainForm.MinimizeIt;
|
||||
end;
|
||||
|
||||
procedure TNewGuyForm.GuildGetSuccess(Cmd: CmdType);
|
||||
var s,b: string;
|
||||
begin
|
||||
b := GuildGet.Body;
|
||||
s := Take(b);
|
||||
if s <> '' then ShowMessage(s);
|
||||
s := Take(b);
|
||||
if s <> '' then Navigate(s);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user