⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clmain.pas

📁 传奇源代码的delphi版本
💻 PAS
📖 第 1 页 / 共 5 页
字号:
                     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;

      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.CMDialogKey(var Msg: TWMKEY);
begin
  if (Msg.CharCode = VK_TAB) then
    if (g_MySelf <> nil) and (DScreen.CurrentScene = PlayScene) then
      if g_boShowAllItem then
        FrmDlg.DOptionsDropViewOffClick(Nil,0,0)
      else
        FrmDlg.DOptionsDropViewOnClick(Nil,0,0);
  inherited
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 (ssAlt in Shift) and (Key=VK_RETURN) then
  begin
    DXDraw.Finalize;
    if doFullScreen in DXDraw.Options then
    begin
      RestoreWindow;
      BorderStyle := bsSizeable;
      DXDraw.Options := DXDraw.Options - [doFullScreen];
    end else
    begin
      StoreWindow;
      DXDraw.Cursor := crNone;
      BorderStyle := bsNone;
      DXDraw.Options := DXDraw.Options + [doFullScreen];
    end;
    DXDraw.Initialize;
  end;

  if g_DWinMan.KeyDown (Key, Shift) then exit;

  if (ssCtrl in Shift) and not(g_boSkillSetting) then
    FrmDlg.DSkillBar.SetImgIndex (g_WMainImages, 712);

  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 + g_dwMagicDelayTime)) then begin
        if frmdlg.DSkillBar.FaceIndex = 712 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;
    end;
    //窗口测试专用
    VK_HOME: begin
     //FrmDlg.DAddBag3.Visible := True;
     //FrmDlg.DRefineDlg.Visible := True;
     //FrmDlg.DStoragePass.Visible := True;
     //FrmDlg.EnterPasswd.Visible := true;
     FrmDlg.DBank.Visible := true;
    end;
//    VK_ESCAPE: begin
//      CloseAllWindows;
//    end;
    word('H'): begin
      if ssCtrl in Shift then begin
        SendSay ('@AttackMode');
        end else begin
        if not PlayScene.EdChat.Visible then begin
          FrmDlg.OpenHelpWin();
        end
      end;
    end;

    word('Y'): begin
      if not PlayScene.EdChat.Visible then
        FrmDlg.OpenItemShopDlg();
    end;
    
    word('A'): begin
      if ssCtrl in Shift then begin
        SendSay ('@Rest');
      end else begin
        if not PlayScene.EdChat.Visible then begin
          FrmDlg.DAbout.Visible:=not FrmDlg.DAbout.Visible;
        end
      end;
    end;
    
    word('F'): begin
      if ssCtrl in Shift then begin
        if g_nCurFont < MAXFONT-1 then Inc(g_nCurFont)
        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 (CLI.Get(CLI.Exists('ini')).sValue);
        if ini <> nil then begin
          ini.WriteString ('Setup', 'FontName', g_sCurFontName);
          ini.Free;
        end;
      end;
    end;

    word('X'):
         begin
            if g_MySelf = nil then exit;
            if ssAlt in Shift then begin
               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 ('你在战斗期间不能结束游戏.', clYellow, clRed);
            end;
         end;
      word('D'):
          begin
            if not(PlayScene.EdChat.Visible) then
              ToggleAutoRun;
          end;
      word('Q'):
          begin
            if g_MySelf = nil then exit;
            if ssAlt in Shift then begin
              if (GetTickCount - g_dwLatestStruckTick > 10000) and
                 (GetTickCount - g_dwLatestMagicTick > 10000) and
                 (GetTickCount - g_dwLatestHitTick > 10000) or
                 (g_MySelf.m_boDeath) then AppExit
              else
                DScreen.AddChatBoardString ('你在战斗期间不能结束游戏.', clYellow, clRed);
            end else begin
              if not PlayScene.EdChat.Visible then begin
                FrmDlg.OpenQuestAccept();
              end;
            end;
          end;

      word('V'):
          begin
            if not(PlayScene.EdChat.Visible) then
              FrmDlg.DBotMiniMapClick(Nil,0,0);
          end;
    word('B'): begin
        if not PlayScene.EdChat.Visible then begin


  if (g_nMapIndex < 1) then
    DScreen.AddChatBoardString('没有大地图信息.', clWhite, clRed)
  else begin

    if not g_boViewMap then begin
      g_nViewMapLv := 1;
      g_boViewMap := TRUE;
    end else begin
      if g_nViewMapLv >= 2 then begin
        g_nViewMapLv:=0;
       g_boViewMap := FALSE;
       end else Inc(g_nViewMapLv);
     end;
  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 begin
             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;
         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('O'): begin
        if not PlayScene.EdChat.Visible then
          FrmDlg.DOptionClick;
      end;

      word('P'): begin
        if not PlayScene.EdChat.Visible then
          FrmDlg.ToggleShowGroupDlg;
      end;

      word('Z'): begin
        if not PlayScene.EdChat.Visible then begin
          if ssCtrl in Shift then FrmDlg.DBeltSwapClick(Nil,0,0)
          else FrmDlg.DBeltCloseClick(Nil,0,0);
        end;
      end;

      word('L'): begin
        if not PlayScene.EdChat.Visible then
          FrmDlg.DBotLoverClick(Nil,0,0);
      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.OpenMailDlg;
      end;

     word('R'): begin
        if not PlayScene.EdChat.Visible then
          if FrmDlg.DSkillbar.Visible then
            FrmDlg.DOptionsSkillBarOffClick(Nil,0,0)
          else
            FrmDlg.DOptionsSkillBarOnClick(Nil,0,0)
      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 (DScreen.CurrentScene = SelectChrScene) then begin
     if (key = #13) and (FrmDlg.DCreateChr.Visible = false) then
       SelectChrScene.SelChrStartClick;
   end;

   if g_DWinMan.KeyPress (Key) then exit;

   if DScr

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -