📄 clmain.pas
字号:
word('H'): //措牢傍拜 规过
begin
if ssCtrl in Shift then begin
SendSay ('@傍拜规侥');
end;
end;
word('A'):
begin
if ssCtrl in Shift then begin
SendSay ('@绒侥');
end;
end;
{
Ctrl + F 改版游戏的字体,你可以选择8种不同的字体(目前还不能使用)
}
word('F'):
begin
if ssCtrl in Shift then begin
if CurFont < MAXFONT-1 then Inc(CurFont)
else CurFont := 0;
CurFontName := FontArr[CurFont];
FrmMain.Font.Name := CurFontName;
FrmMain.Canvas.Font.Name := CurFontName;
DxDraw1.Surface.Canvas.Font.Name := CurFontName;
PlayScene.EdChat.Font.Name := CurFontName;
ini := TIniFile.Create ('.\mir.ini');
if ini <> nil then begin
ini.WriteString ('Setup', 'FontName', CurFontName);
ini.Free;
end;
end;
end;
{
Alt + X 重新开始游戏(当角色死亡后特别有用)
}
word('X'):
begin
if Myself = nil then exit;
if ssAlt in Shift then begin
if (GetTickCount - LatestStruckTime > 10000) and
(GetTickCount - LatestMagicTime > 10000) and
(GetTickCount - LatestHitTime > 10000) or
(Myself.Death) then
begin
AppLogOut;
end else
// DScreen.AddChatBoardString ('傈捧吝俊绰 立加阑 谗阑 荐 绝嚼聪促.', clYellow, clRed);
DScreen.AddChatBoardString ('正在战斗,不能注销.', clYellow, clRed);
end;
end;
word('Q'):
begin
if Myself = nil then exit;
if ssAlt in Shift then begin
if (GetTickCount - LatestStruckTime > 10000) and
(GetTickCount - LatestMagicTime > 10000) and
(GetTickCount - LatestHitTime > 10000) or
(Myself.Death) then
begin
AppExit;
end else
// DScreen.AddChatBoardString ('傈捧吝俊绰 立加阑 谗阑 荐 绝嚼聪促.', clYellow, clRed);
DScreen.AddChatBoardString ('正在战斗,不能退出游戏.', clYellow, clRed);
end;
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 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;
{
特殊命令 /玩家名字 无距离限制的交流,你也可以用鼠标左键点击聊天窗口中角色的名字来使用这个功能。
!交流文字 向所有人发言(八级以上的玩家才能使用,所有公开发言的信息能够在游戏中保留10秒)
!!文字 如果你们创建了小组,你所发的信息将被组内的其他玩家看见
!~文字 这种广播功能治提供给同一行会的玩家
@拒绝私聊 拒绝所有的私人聊天的命令
@拒绝+人名 对特定的某一个人聊天文字进行屏蔽
@拒绝行会聊天 屏蔽行会聊天所有消息的命令
@退出门派 脱离行会
}
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 MagicList.Count-1 do begin
pm := PTClientMagic (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;
//是否可以使用魔法:需要的点数<当前点数,或者是魔法EffectType = 0
if (pcm.Def.Spell + pcm.Def.DefSpell <= Myself.Abil.MP) or (pcm.Def.EffectType = 0) then begin
if pcm.Def.EffectType = 0 then begin //八过,瓤苞绝澜
//八过 虐绰 青悼阑 蝶肺 窍瘤 臼绰促.
//辑滚俊 流立 傈崔茄促.
//if CanNextAction and ServerAcceptNextAction then begin
//堪拳搬篮 茄锅 荤侩饶 9檬鳖瘤绰 促矫 喘妨瘤瘤 臼霸 茄促.
if pcm.Def.MagicId = 26 then begin //堪拳搬
if GetTickCount - LatestFireHitTime < 10 * 1000 then begin
exit;
end;
end;
//公怕焊绰 茄锅 荤侩饶 3檬鳖瘤绰 促矫 喘妨瘤瘤 臼绰促.
if pcm.Def.MagicId = 27 then begin //公怕焊
if GetTickCount - LatestRushRushTime < 3 * 1000 then begin
exit;
end;
end;
//八过篮 掉饭捞(500ms) 绝捞 喘妨柳促.
if GetTickCount - LatestSpellTime > 500 then begin
LatestSpellTime := GetTickCount;
MagicDelayTime := 0; //pcm.Def.DelayTime;
SendSpellMsg (CM_SPELL, Myself.Dir{x}, 0, pcm.Def.MagicId, 0);
end;
end else begin
tdir := GetFlyDirection (390, 175, tx, ty);
MagicTarget := FocusCret;
if not PlayScene.IsValidActor (MagicTarget) then
MagicTarget := nil;
if MagicTarget = nil then begin
PlayScene.CXYfromMouseXY (tx, ty, targx, targy);
targid := 0;
end else begin
targx := MagicTarget.XX;
targy := MagicTarget.YY;
targid := MagicTarget.RecogId;
end;
if CanNextAction and ServerAcceptNextAction then begin
LatestSpellTime := GetTickCount; //付过 荤侩
new (pmag);
FillChar (pmag^, sizeof(TUseMagicInfo), #0);
pmag.EffectNumber := pcm.Def.Effect;
pmag.MagicSerial := pcm.Def.MagicId;
pmag.ServerMagicCode := 0;
MagicDelayTime := 200 + pcm.Def.DelayTime; //促澜 付过阑 荤侩且锭鳖瘤 浆绰 矫埃
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 LatestMagicTime := GetTickCount;
end;
//荤恩阑 傍拜窍绰 版快狼 掉饭捞
MagicPKDelayTime := 0;
if MagicTarget <> nil then
if MagicTarget.Race = 0 then
MagicPKDelayTime := 300 + Random(1100); //(600+200 + MagicDelayTime div 5);
Myself.SendMsg (CM_SPELL, targx, targy, tdir, Integer(pmag), targid, '', 0);
end;// else
//Dscreen.AddSysMsg ('泪矫饶俊 荤侩且 荐 乐嚼聪促.');
//Inc (SpellCount);
end;
end else
Dscreen.AddSysMsg ('点数不够,无法使用.');
// Dscreen.AddSysMsg ('付仿捞 葛磊而聪促.');
// Dscreen.AddSysMsg ('付过荤侩');
end;
procedure TFrmMain.UseMagicSpell (who, effnum, targetx, targety, magic_id: integer);
var
actor: TActor;
adir: integer;
pmag: PTUseMagicInfo;
begin
actor := PlayScene.FindActor (who);
if actor <> nil then begin
adir := GetFlyDirection (actor.XX, actor.YY, targetx, targety);
new (pmag);
FillChar (pmag^, sizeof(TUseMagicInfo), #0);
pmag.EffectNumber := effnum; //magnum;
pmag.ServerMagicCode := 0; //烙矫
pmag.MagicSerial := magic_id;
actor.SendMsg (SM_SPELL, 0, 0, adir, Integer(pmag), 0, '', 0);
Inc (SpellCount);
end else
Inc (SpellFailCount);
end;
procedure TFrmMain.UseMagicFire (who, efftype, effnum, targetx, targety, target: integer);
var
actor: TActor;
adir, sound: integer;
pmag: PTUseMagicInfo;
begin
actor := PlayScene.FindActor (who);
if actor <> nil then begin
actor.SendMsg (SM_MAGICFIRE, target{111magid}, efftype, effnum, targetx, targety, '', sound);
//if actor = Myself then Dec (SpellCount);
if FireCount < SpellCount then
Inc (FireCount);
end;
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);
end;
MagicTarget := nil;
end;
//吃药
procedure TFrmMain.EatItem (idx: integer);
begin
if idx in [0..MAXBAGITEMCL-1] then begin
if (EatingItem.S.Name <> '') and (GetTickCount - EatTime > 5 * 1000) then begin //5秒之内只能吃一次药
EatingItem.S.Name := '';
end;
if (EatingItem.S.Name = '') and (ItemArr[idx].S.Name <> '') and (ItemArr[idx].S.StdMode <= 3) then begin
EatingItem := ItemArr[idx];
ItemArr[idx].S.Name := '';
//氓阑 佬绰 巴... 劳鳃 巴牢 瘤 拱绢夯促.
if (ItemArr[idx].S.StdMode = 4) and (ItemArr[idx].S.Shape < 100) then begin
//shape > 100捞搁 弓澜 酒捞袍 烙..
if ItemArr[idx].S.Shape < 50 then begin
if mrYes <> FrmDlg.DMessageDlg (ItemArr[idx].S.Name + '阑 劳洒矫摆嚼聪鳖?', [mbYes, mbNo]) then begin
ItemArr[idx] := EatingItem;
exit;
end;
end else begin
//shape > 50捞搁 林巩 辑 辆幅...
if mrYes <> FrmDlg.DMessageDlg (ItemArr[idx].S.Name + '阑 荤侩窍矫摆嚼聪鳖?', [mbYes, mbNo]) then begin
ItemArr[idx] := EatingItem;
exit;
end;
end;
end;
EatTime := GetTickCount;
SendEat (ItemArr[idx].MakeIndex, ItemArr[idx].S.Name );
ItemUseSound (ItemArr[idx].S.StdMode);
end;
end else begin
if (idx = -1) and ItemMoving then begin
ItemMoving := FALSE;
EatingItem := MovingItem.Item;
MovingItem.Item.S.Name := '';
//氓阑 佬绰 巴... 劳鳃 巴牢 瘤 拱绢夯促.
if (EatingItem.S.StdMode = 4) and (EatingItem.S.Shape < 100) then begin
//shape > 100捞搁 弓澜 酒捞袍 烙..
if EatingItem.S.Shape < 50 then begin
// if mrYes <> FrmDlg.DMessageDlg ('"' + EatingItem.S.Name + '"阑(甫) 劳洒矫摆嚼聪鳖?', [mbYes, mbNo]) then begin
if mrYes <> FrmDlg.DMessageDlg ('"' + EatingItem.S.Name + '"物品是否使用?', [mbYes, mbNo]) then begin
AddItemBag (EatingItem);
exit;
end;
end else begin
//shape > 50捞搁 林巩 辑 辆幅...
// if mrYes <> FrmDlg.DMessageDlg ('"' + EatingItem.S.Name + '"阑(甫) 荤侩窍矫摆嚼聪鳖?', [mbYes, mbNo]) then begin
if mrYes <> FrmDlg.DMessageDlg ('"' + EatingItem.S.Name + '"物品是否使用?', [mbYes, mbNo]) then begin
AddItemBag (EatingItem);
exit;
end;
end;
end;
EatTime := GetTickCount;
SendEat (EatingItem.MakeIndex, EatingItem.S.Name );
ItemUseSound (EatingItem.S.StdMode);
end;
end;
end;
function TFrmMain.TargetInSwordLongAttackRange (ndir: integer): Boolean;
var
nx, ny: integer;
actor: TActor;
begin
Result := FALSE;
GetFrontPosition (Myself.XX, Myself.YY, ndir, nx, ny);
GetFrontPosition (nx, ny, ndir, nx, ny);
if (abs(Myself.XX-nx) = 2) or (abs(Myself.YY-ny) = 2) then begin
actor := PlayScene.FindActorXY (nx, ny);
if actor <>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -