📄 clmain.pas
字号:
end;
procedure TfrmMain.AppLogout;
begin
if mrOk = FrmDlg.DMessageDlg ('Would you like to logout ?', [mbOk, mbCancel]) then begin
SendClientMessage (CM_SOFTCLOSE, 0, 0, 0, 0);
PlayScene.ClearActors;
CloseAllWindows;
if not BoOneClick then begin
// PlayScene.MemoLog.Lines.Add('小退关闭');
g_SoftClosed := TRUE;
ActiveCmdTimer (tcSoftClose);
end else begin
ActiveCmdTimer (tcReSelConnect);
end;
if g_boBagLoaded then
Savebags ('.\Data\' + g_sServerName + '.' + CharName + '.itm', @g_ItemArr);
g_boBagLoaded := FALSE;
end;
end;
procedure TfrmMain.AppExit;
begin
if mrOk = FrmDlg.DMessageDlg ('Would you like to quit Legend of Mir?', [mbOk, mbCancel]) then begin
if g_boBagLoaded then
Savebags ('.\Data\' + g_sServerName + '.' + CharName + '.itm', @g_ItemArr);
g_boBagLoaded := FALSE;
FrmMain.Close;
end;
end;
procedure TfrmMain.PrintScreenNow;
function IntToStr2(n: integer): string;
begin
if n < 10 then Result := '0' + IntToStr(n)
else Result := IntToStr(n);
end;
var
i, k, n, checksum: integer;
flname: string;
dib: TDIB;
ddsd: TDDSurfaceDesc;
sptr, dptr: PByte;
begin
if not DxDraw.CanDraw then exit;
while TRUE do begin
flname := 'Images' + IntToStr2(g_nCaptureSerial) + '.bmp';
if not FileExists (flname) then break;
Inc (g_nCaptureSerial);
end;
dib := TDIB.Create;
dib.BitCount := 8;
dib.Width := SCREENWIDTH;
dib.Height := SCREENHEIGHT;
dib.ColorTable := g_WMainImages.MainPalette;
dib.UpdatePalette;
ddsd.dwSize := SizeOf(ddsd);
checksum := 0; //盲农芥阑父电促.
try
DxDraw.Primary.Lock (TRect(nil^), ddsd);
for i := (600-120) to SCREENHEIGHT-10 do begin
sptr := PBYTE(integer(ddsd.lpSurface) + (SCREENHEIGHT - 1 - i)*ddsd.lPitch + 200);
for k:=0 to 400-1 do begin
checksum := checksum + byte(pbyte(integer(sptr) + k)^);
end;
end;
finally
DxDraw.Primary.Unlock();
end;
try
SetBkMode (DxDraw.Primary.Canvas.Handle, TRANSPARENT);
DxDraw.Primary.Canvas.Font.Color := clWhite;
n := 0;
if g_MySelf <> nil then begin
DxDraw.Primary.Canvas.TextOut (0, 0, g_sServerName + ' ' + g_MySelf.m_sUserName);
Inc (n, 1);
end;
DxDraw.Primary.Canvas.TextOut (0, (n)*12, 'CheckSum=' + IntToStr(checksum));
DxDraw.Primary.Canvas.TextOut (0, (n+1)*12, DateToStr(Date));
DxDraw.Primary.Canvas.TextOut (0, (n+2)*12, TimeToStr(Time));
DxDraw.Primary.Canvas.Release;
DxDraw.Primary.Lock (TRect(nil^), ddsd);
for i := 0 to dib.Height-1 do begin
sptr := PBYTE(integer(ddsd.lpSurface) + (dib.Height - 1 - i)*ddsd.lPitch);
dptr := PBYTE(integer(dib.PBits) + i * SCREENWIDTH);
// dptr := PBYTE(integer(dib.PBits) + i * 800);
Move (sptr^, dptr^, SCREENWIDTH);
// Move (sptr^, dptr^, 800);
end;
finally
DxDraw.Primary.Unlock();
end;
dib.SaveToFile (flname);
dib.Clear;
dib.Free;
end;
{------------------------------------------------------------}
procedure TfrmMain.ProcessKeyMessages;
begin
{
case ActionKey of
VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8:
begin
UseMagic (MouseX, MouseY, GetMagicByKey (char ((ActionKey-VK_F1) + byte('1')) )); //胶农赴 谅钎
//DScreen.AddSysMsg ('KEY' + IntToStr(Random(10000)));
ActionKey := 0;
TargetX := -1;
exit;
end;
end;
}
case ActionKey of
VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8: begin
UseMagic (g_nMouseX, g_nMouseY, GetMagicByKey (char ((ActionKey-VK_F1) + byte('1')) )); //胶农赴 谅钎
ActionKey := 0;
g_nTargetX := -1;
exit;
end;
12..19: begin
UseMagic (g_nMouseX, g_nMouseY, GetMagicByKey (char ((ActionKey-12) + byte('1') + byte($14)) ));
ActionKey := 0;
g_nTargetX := -1;
exit;
end;
end;
end;
procedure TfrmMain.ProcessActionMessages;
var
mx, my, dx, dy, crun: integer;
ndir, adir, mdir: byte;
bowalk, bostop: Boolean;
label
LB_WALK,TTTT;
begin
if g_MySelf = nil then exit;
//Move
if (g_nTargetX >= 0) and CanNextAction and ServerAcceptNextAction then begin //ActionLock捞 钱府搁, ActionLock篮 悼累捞 场唱扁 傈俊 钱赴促.
if (g_nTargetX <> g_MySelf.m_nCurrX) or (g_nTargetY <> g_MySelf.m_nCurrY) then begin
TTTT:
mx := g_MySelf.m_nCurrX;
my := g_MySelf.m_nCurrY;
dx := g_nTargetX;
dy := g_nTargetY;
ndir := GetNextDirection (mx, my, dx, dy);
case g_ChrAction of
caWalk: begin
LB_WALK:
//Jacky 打开
{
DScreen.AddSysMsg ('caWalk ' + IntToStr(Myself.XX) + ' ' +
IntToStr(Myself.m_nCurrY) + ' ' +
IntToStr(TargetX) + ' ' +
IntToStr(TargetY));
}
crun := g_MySelf.CanWalk;
if IsUnLockAction (CM_WALK, ndir) and (crun > 0) then begin
GetNextPosXY (ndir, mx, my);
bowalk := TRUE;
bostop := FALSE;
if not PlayScene.CanWalk (mx, my) then begin
bowalk := FALSE;
adir := 0;
if not bowalk then begin //涝备 八荤
mx := g_MySelf.m_nCurrX;
my := g_MySelf.m_nCurrY;
GetNextPosXY (ndir, mx, my);
if CheckDoorAction (mx, my) then
bostop := TRUE;
end;
if not bostop and not PlayScene.CrashMan(mx,my) then begin //荤恩篮 磊悼栏肺 乔窍瘤 臼澜..
mx := g_MySelf.m_nCurrX;
my := g_MySelf.m_nCurrY;
adir := PrivDir(ndir);
GetNextPosXY (adir, mx, my);
if not Map.CanMove(mx,my) then begin
mx := g_MySelf.m_nCurrX;
my := g_MySelf.m_nCurrY;
adir := NextDir (ndir);
GetNextPosXY (adir, mx, my);
if Map.CanMove(mx,my) then
bowalk := TRUE;
end else
bowalk := TRUE;
end;
if bowalk then begin
g_MySelf.UpdateMsg (CM_WALK, mx, my, adir, 0, 0, '', 0);
g_dwLastMoveTick := GetTickCount;
end else begin
mdir := GetNextDirection (g_MySelf.m_nCurrX, g_MySelf.m_nCurrY, dx, dy);
if mdir <> g_MySelf.m_btDir then
g_MySelf.SendMsg (CM_TURN, g_MySelf.m_nCurrX, g_MySelf.m_nCurrY, mdir, 0, 0, '', 0);
g_nTargetX := -1;
end;
end else begin
g_MySelf.UpdateMsg (CM_WALK, mx, my, ndir, 0, 0, '', 0); //亲惑 付瘤阜 疙飞父 扁撅
g_dwLastMoveTick := GetTickCount;
end;
end else begin
g_nTargetX := -1;
end;
end;
caRun: begin
//免助跑
if g_boCanStartRun or (g_nRunReadyCount >= 1) then begin
crun := g_MySelf.CanRun;
//骑马开始
if (g_MySelf.m_btHorse <> 0)
and (GetDistance (mx, my, dx, dy) >= 3)
and (crun > 0)
and IsUnLockAction (CM_HORSERUN, ndir) then begin
GetNextHorseRunXY (ndir, mx, my);
if PlayScene.CanRun (g_MySelf.m_nCurrX, g_MySelf.m_nCurrY, mx, my) then begin
g_MySelf.UpdateMsg (CM_HORSERUN, mx, my, ndir, 0, 0, '', 0);
g_dwLastMoveTick := GetTickCount;
end else begin //如果跑失败则跳回去走
g_ChrAction:=caWalk;
goto TTTT;
end;
end else begin
//骑马结束
if (GetDistance (mx, my, dx, dy) >= 2) and (crun > 0) then begin
if IsUnLockAction (CM_RUN, ndir) then begin
GetNextRunXY (ndir, mx, my);
if PlayScene.CanRun (g_MySelf.m_nCurrX, g_MySelf.m_nCurrY, mx, my) then begin
g_MySelf.UpdateMsg (CM_RUN, mx, my, ndir, 0, 0, '', 0);
g_dwLastMoveTick := GetTickCount;
end else begin //如果跑失败则跳回去走
g_ChrAction:=caWalk;
goto TTTT;
end;
end else
g_nTargetX := -1;
end else begin
//Jacky
mdir := GetNextDirection (g_MySelf.m_nCurrX, g_MySelf.m_nCurrY, dx, dy);
if mdir <> g_MySelf.m_btDir then
g_MySelf.SendMsg (CM_TURN, g_MySelf.m_nCurrX, g_MySelf.m_nCurrY, mdir, 0, 0, '', 0);
g_nTargetX := -1;
//Jacky
//if crun = -1 then begin
//DScreen.AddSysMsg ('瘤陛篮 钝 荐 绝嚼聪促.');
//TargetX := -1;
//end;
goto LB_WALK;
{if crun = -2 then begin
DScreen.AddSysMsg ('泪矫饶俊 钝 荐 乐嚼聪促.');
TargetX := -1;
end; }
end;
end; //骑马结束
end else begin
Inc (g_nRunReadyCount);
goto LB_WALK;
end;
end;
end;
end;
end;
g_nTargetX := -1; //茄锅俊 茄沫究..
if g_MySelf.RealActionMsg.Ident > 0 then begin
FailAction := g_MySelf.RealActionMsg.Ident; //角菩且锭 措厚
FailDir := g_MySelf.RealActionMsg.Dir;
if g_MySelf.RealActionMsg.Ident = CM_SPELL then begin
SendSpellMsg (g_MySelf.RealActionMsg.Ident,
g_MySelf.RealActionMsg.X,
g_MySelf.RealActionMsg.Y,
g_MySelf.RealActionMsg.Dir,
g_MySelf.RealActionMsg.State);
end else
SendActMsg (g_MySelf.RealActionMsg.Ident,
g_MySelf.RealActionMsg.X,
g_MySelf.RealActionMsg.Y,
g_MySelf.RealActionMsg.Dir);
g_MySelf.RealActionMsg.Ident := 0;
//皋春甫 罐篮饶 10惯磊惫 捞惑 吧栏搁 磊悼栏肺 荤扼咙
if g_nMDlgX <> -1 then
if (abs(g_nMDlgX-g_MySelf.m_nCurrX) >= 8) or (abs(g_nMDlgY-g_MySelf.m_nCurrY) >= 8) then begin
FrmDlg.CloseMDlg;
g_nMDlgX := -1;
end;
end;
end;
procedure TfrmMain.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
msg, wc, dir, mx, my: integer;
ini: TIniFile;
begin
case Key of
VK_PAUSE: begin
Key:=0;
PrintScreenNow();
end;
end;
if g_DWinMan.KeyDown (Key, Shift) then exit;
if (g_MySelf = nil) or (DScreen.CurrentScene <> PlayScene) then exit;
mx:=g_MySelf.m_nCurrX;
my:=g_MySelf.m_nCurrY;
case Key of
VK_F1, VK_F2, VK_F3, VK_F4,
VK_F5, VK_F6, VK_F7, VK_F8: begin
if (GetTickCount - g_dwLatestSpellTick > (g_dwSpellTime{500}{+200} + g_dwMagicDelayTime)) then begin
if ssCtrl in Shift then begin
ActionKey:=Key - 100;
end else begin
ActionKey:=Key;
end;
end;
Key:=0;
end;
VK_F9: begin
FrmDlg.OpenItemBag;
end;
VK_F10: begin
FrmDlg.StatePage := 0;
FrmDlg.OpenMyStatus;
end;
VK_F11: begin
FrmDlg.StatePage := 3;
FrmDlg.OpenMyStatus;
end;
VK_F12: begin
if (ssCtrl in Shift) and (ssAlt in Shift) then begin
frmDlgConfig.Top:= (SCREENHEIGHT - frmDlgConfig.Height) div 2;
frmDlgConfig.Left:= (SCREENWIDTH - frmDlgConfig.Width) div 2;
frmDlgConfig.Open;
end else begin
FrmDlg.DOptionClick;
end;
end;
word('H'): begin
if ssCtrl in Shift then begin
SendSay ('@AttackMode');
end;
end;
word('A'): begin
if ssCtrl in Shift then begin
SendSay ('@Rest');
end;
end;
word('D'): begin
if ssCtrl in Shift then begin
SendPassword('',0);
{
SetInputStatus();
if m_boPasswordIntputStatus then
DScreen.AddChatBoardString ('请输入密码:', clBlue, clWhite);
}
end;
end;
{
word('D'): begin
if ssCtrl in Shift then begin
FrmDlg.DChgGamePwd.Visible:=not FrmDlg.DChgGamePwd.Visible;
end;
end;
}
word('F'): begin
if ssCtrl in Shift then begin
if g_nCurFont < MAXFONT-1 then Inc(g_nCurFont)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -