📄 clmain.pas
字号:
else g_nCurFont := 0;
g_sCurFontName := g_FontArr[g_nCurFont];
FrmMain.Font.Name := g_sCurFontName;
FrmMain.Canvas.Font.Name := g_sCurFontName;
DxDraw.Surface.Canvas.Font.Name := g_sCurFontName;
PlayScene.EdChat.Font.Name := g_sCurFontName;
ini := TIniFile.Create ('.\mir.ini');
if ini <> nil then begin
ini.WriteString ('Setup', 'FontName', g_sCurFontName);
ini.Free;
end;
end;
end;
word('Z'): begin
if ssCtrl in Shift then begin
g_boShowAllItem:=not g_boShowAllItem;
end else
if not PlayScene.EdChat.Visible then begin
if CanNextAction and ServerAcceptNextAction then begin
SendPickup; //捡物品
end;
end;
end;
word('X'):
begin
if g_MySelf = nil then exit;
if ssAlt in Shift then begin
//强行退出
g_dwLatestStruckTick:=GetTickCount() + 10001;
g_dwLatestMagicTick:=GetTickCount() + 10001;
g_dwLatestHitTick:=GetTickCount() + 10001;
//
if (GetTickCount - g_dwLatestStruckTick > 10000) and
(GetTickCount - g_dwLatestMagicTick > 10000) and
(GetTickCount - g_dwLatestHitTick > 10000) or
(g_MySelf.m_boDeath) then
begin
AppLogOut;
end else
DScreen.AddChatBoardString ('You cannot terminate connection during fight.', clYellow, clRed);
end;
end;
word('Q'):
begin
if g_MySelf = nil then exit;
if ssAlt in Shift then begin
//强行退出
g_dwLatestStruckTick:=GetTickCount() + 10001;
g_dwLatestMagicTick:=GetTickCount() + 10001;
g_dwLatestHitTick:=GetTickCount() + 10001;
//
if (GetTickCount - g_dwLatestStruckTick > 10000) and
(GetTickCount - g_dwLatestMagicTick > 10000) and
(GetTickCount - g_dwLatestHitTick > 10000) or
(g_MySelf.m_boDeath) then
begin
AppExit;
end else
DScreen.AddChatBoardString ('You cannot terminate connection during fight.', clYellow, clRed);
end;
end;
word('V'): begin
if not PlayScene.EdChat.Visible then begin
if not g_boViewMiniMap then begin
if GetTickCount > g_dwQueryMsgTick then begin
g_dwQueryMsgTick := GetTickCount + 3000;
FrmMain.SendWantMiniMap;
g_nViewMinMapLv:=1;
end;
end else begin
if g_nViewMinMapLv >= 2 then begin
g_nViewMinMapLv:=0;
g_boViewMiniMap := FALSE;
end else Inc(g_nViewMinMapLv);
end;
end;
end;
word('T'): begin
if not PlayScene.EdChat.Visible then begin
if GetTickCount > g_dwQueryMsgTick then begin
g_dwQueryMsgTick := GetTickCount + 3000;
FrmMain.SendDealTry;
end;
end;
end;
word('G'): begin
if ssCtrl in Shift then begin
if g_FocusCret <> nil then
if g_GroupMembers.Count = 0 then
SendCreateGroup(g_FocusCret.m_sUserName)
else SendAddGroupMember(g_FocusCret.m_sUserName);
PlayScene.EdChat.Text:=g_FocusCret.m_sUserName;
end else begin
if ssAlt in Shift then begin
if g_FocusCret <> nil then
SendDelGroupMember(g_FocusCret.m_sUserName)
end else begin
if not PlayScene.EdChat.Visible then begin
if FrmDlg.DGuildDlg.Visible then begin
FrmDlg.DGuildDlg.Visible := FALSE;
end else
if GetTickCount > g_dwQueryMsgTick then begin
g_dwQueryMsgTick := GetTickCount + 3000;
FrmMain.SendGuildDlg;
end;
end;
end;
end;
end;
word('P'): begin
if not PlayScene.EdChat.Visible then
FrmDlg.ToggleShowGroupDlg;
end;
word('C'): begin
if not PlayScene.EdChat.Visible then begin
FrmDlg.StatePage := 0;
FrmDlg.OpenMyStatus;
end;
end;
word('I'): begin
if not PlayScene.EdChat.Visible then
FrmDlg.OpenItemBag;
end;
word('S'): begin
if not PlayScene.EdChat.Visible then begin
FrmDlg.StatePage := 3;
FrmDlg.OpenMyStatus;
end;
end;
word('W'): begin
if not PlayScene.EdChat.Visible then
FrmDlg.OpenFriendDlg();
end;
word('M'): begin
if not PlayScene.EdChat.Visible then
FrmDlg.OpenAdjustAbility;
end;
end;
case Key of
VK_UP:
with DScreen do begin
if ChatBoardTop > 0 then Dec (ChatBoardTop);
end;
VK_DOWN:
with DScreen do begin
if ChatBoardTop < ChatStrs.Count-1 then
Inc (ChatBoardTop);
end;
VK_PRIOR:
with DScreen do begin
if ChatBoardTop > VIEWCHATLINE then
ChatBoardTop := ChatBoardTop - VIEWCHATLINE
else ChatBoardTop := 0;
end;
VK_NEXT:
with DScreen do begin
if ChatBoardTop + VIEWCHATLINE < ChatStrs.Count-1 then
ChatBoardTop := ChatBoardTop + VIEWCHATLINE
else ChatBoardTop := ChatStrs.Count-1;
if ChatBoardTop < 0 then ChatBoardTop := 0;
end;
end;
end;
procedure TfrmMain.FormKeyPress(Sender: TObject; var Key: Char);
begin
if g_DWinMan.KeyPress (Key) then exit;
if DScreen.CurrentScene = PlayScene then begin
if PlayScene.EdChat.Visible then begin
//傍烹栏肺 贸府秦具 窍绰 版快父 酒贰肺 逞绢皑
exit;
end;
case byte(key) of
byte('1')..byte('6'):
begin
EatItem (byte(key) - byte('1')); //骇飘 酒捞袍阑 荤侩茄促.
end;
27: //ESC
begin
end;
byte(' '), 13: //盲泼 冠胶
begin
PlayScene.EdChat.Visible := TRUE;
PlayScene.EdChat.SetFocus;
SetImeMode (PlayScene.EdChat.Handle, LocalLanguage);
if FrmDlg.BoGuildChat then begin
PlayScene.EdChat.Text := '!~';
PlayScene.EdChat.SelStart := Length(PlayScene.EdChat.Text);
PlayScene.EdChat.SelLength := 0;
end else begin
PlayScene.EdChat.Text := '';
end;
end;
byte('@'),
byte('!'),
byte('/'):
begin
PlayScene.EdChat.Visible := TRUE;
PlayScene.EdChat.SetFocus;
SetImeMode (PlayScene.EdChat.Handle, LocalLanguage);
if key = '/' then begin
if WhisperName = '' then PlayScene.EdChat.Text := key
else if Length(WhisperName) > 2 then PlayScene.EdChat.Text := '/' + WhisperName + ' '
else PlayScene.EdChat.Text := key;
PlayScene.EdChat.SelStart := Length(PlayScene.EdChat.Text);
PlayScene.EdChat.SelLength := 0;
end else begin
PlayScene.EdChat.Text := key;
PlayScene.EdChat.SelStart := 1;
PlayScene.EdChat.SelLength := 0;
end;
end;
end;
key := #0;
end;
end;
function TfrmMain.GetMagicByKey (Key: char): PTClientMagic;
var
i: integer;
pm: PTClientMagic;
begin
Result := nil;
for i:=0 to g_MagicList.Count-1 do begin
pm := PTClientMagic (g_MagicList[i]);
if pm.Key = Key then begin
Result := pm;
break;
end;
end;
end;
procedure TfrmMain.UseMagic (tx, ty: integer; pcm: PTClientMagic); //tx, ty: 胶农赴 谅钎烙.
var
tdir, targx, targy, targid: integer;
pmag: PTUseMagicInfo;
begin
if pcm = nil then exit;
if (pcm.Def.wSpell + pcm.Def.btDefSpell <= g_MySelf.m_Abil.MP) or (pcm.Def.btEffectType = 0) then begin
if pcm.Def.btEffectType = 0 then begin //八过,瓤苞绝澜
//八过 虐绰 青悼阑 蝶肺 窍瘤 臼绰促.
//辑滚俊 流立 傈崔茄促.
//if CanNextAction and ServerAcceptNextAction then begin
//堪拳搬篮 茄锅 荤侩饶 9檬鳖瘤绰 促矫 喘妨瘤瘤 臼霸 茄促.
if pcm.Def.wMagicId = 26 then begin //堪拳搬
if GetTickCount - g_dwLatestFireHitTick < 10 * 1000 then begin
exit;
end;
end;
//公怕焊绰 茄锅 荤侩饶 3檬鳖瘤绰 促矫 喘妨瘤瘤 臼绰促.
if pcm.Def.wMagicId = 27 then begin //公怕焊
if GetTickCount - g_dwLatestRushRushTick < 3 * 1000 then begin
exit;
end;
end;
//八过篮 掉饭捞(500ms) 绝捞 喘妨柳促.
if GetTickCount - g_dwLatestSpellTick > g_dwSpellTime{500} then begin
g_dwLatestSpellTick := GetTickCount;
g_dwMagicDelayTime := 0; //pcm.Def.DelayTime;
SendSpellMsg (CM_SPELL, g_MySelf.m_btDir{x}, 0, pcm.Def.wMagicId, 0);
end;
end else begin
tdir := GetFlyDirection (390, 175, tx, ty);
// MagicTarget := FocusCret;
//魔法锁定
if (pcm.Def.wMagicId = 2)
or (pcm.Def.wMagicId = 14)
or (pcm.Def.wMagicId = 15)
or (pcm.Def.wMagicId = 19) then begin
g_MagicTarget:=g_FocusCret;
end else begin
if not g_boMagicLock or (PlayScene.IsValidActor (g_FocusCret) and (not g_FocusCret.m_boDeath)) then begin
g_MagicLockActor:=g_FocusCret;
end;
g_MagicTarget:=g_MagicLockActor;
end;
if not PlayScene.IsValidActor (g_MagicTarget) then
g_MagicTarget := nil;
if g_MagicTarget = nil then begin
PlayScene.CXYfromMouseXY (tx, ty, targx, targy);
targid := 0;
end else begin
targx := g_MagicTarget.m_nCurrX;
targy := g_MagicTarget.m_nCurrY;
targid := g_MagicTarget.m_nRecogId;
end;
if CanNextAction and ServerAcceptNextAction then begin
g_dwLatestSpellTick := GetTickCount; //付过 荤侩
new (pmag);
FillChar (pmag^, sizeof(TUseMagicInfo), #0);
pmag.EffectNumber := pcm.Def.btEffect;
pmag.MagicSerial := pcm.Def.wMagicId;
pmag.ServerMagicCode := 0;
g_dwMagicDelayTime := 200 + pcm.Def.dwDelayTime; //促澜 付过阑 荤侩且锭鳖瘤 浆绰 矫埃
case pmag.MagicSerial of
//0, 2, 11, 12, 15, 16, 17, 13, 23, 24, 26, 27, 28, 29: ;
2, 14, 15, 16, 17, 18, 19, 21, //厚傍拜 付过 力寇
12, 25, 26, 28, 29, 30, 31: ;
else g_dwLatestMagicTick := GetTickCount;
end;
//荤恩阑 傍拜窍绰 版快狼 掉饭捞
g_dwMagicPKDelayTime := 0;
if g_MagicTarget <> nil then
if g_MagicTarget.m_btRace = 0 then
g_dwMagicPKDelayTime := 300 + Random(1100); //(600+200 + MagicDelayTime div 5);
g_MySelf.SendMsg (CM_SPELL, targx, targy, tdir, Integer(pmag), targid, '', 0);
end;// else
//Dscreen.AddSysMsg ('泪矫饶俊 荤侩且 荐 乐嚼聪促.');
//Inc (SpellCount);
end;
end else
Dscreen.AddSysMsg ('Not enough magic points.');
//Dscreen.AddSysMsg ('魔法值不够!!!' + IntToStr(pcm.Def.wSpell) + '+' + IntToStr(pcm.Def.btDefSpell) + '/' +IntToStr(g_MySelf.m_Abil.MP));
end;
procedure TfrmMain.UseMagicSpell (who, effnum, targetx, targety, magic_id: integer);
var
actor: TActor;
adir: integer;
UseMagic: PTUseMagicInfo;
begin
actor := PlayScene.FindActor (who);
if actor <> nil then begin
adir := GetFlyDirection (actor.m_nCurrX, actor.m_nCurrY, targetx, targety);
new (UseMagic);
FillChar (UseMagic^, sizeof(TUseMagicInfo), #0);
UseMagic.EffectNumber := effnum; //magnum;
UseMagic.ServerMagicCode := 0; //烙矫
UseMagic.MagicSerial := magic_id;
actor.SendMsg (SM_SPELL, 0, 0, adir, Integer(UseMagic), 0, '', 0);
Inc (g_nSpellCount);
end else
Inc (g_nSpellFailCount);
end;
procedure TfrmMain.UseMagicFire (who, efftype, effnum, targetx, targety, target: integer);
var
actor: TActor;
adir, sound: integer;
pmag: PTUseMagicInfo;
begin
sound:=0;//jacky
actor := PlayScene.FindActor (who);
if actor <> nil then begin
//
actor.SendMsg (SM_MAGICFIRE, target{111magid}, efftype, effnum, targetx, targety, '', sound);
//efftype = EffectType
//effnum = Effect
//if actor = Myself then Dec (SpellCount);
if g_nFireCount < g_nSpellCount then
Inc (g_nFireCount);
end;
g_MagicTarget := nil;
end;
procedure TfrmMain.UseMagicFireFail (who: integer);
var
actor: TActor;
begin
actor := PlayScene.FindActor (who);
if actor <> nil then begin
actor.SendMsg (SM_MAGICFIRE_FAIL, 0, 0, 0, 0, 0, '', 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -