configmerchant.pas

来自「FIR引擎最新源码+注册」· PAS 代码 · 共 554 行 · 第 1/2 页

PAS
554
字号
    SelMerchant.m_boDenyRefStatus := CheckBoxDenyRefStatus.Checked;
  end;
end;

procedure TfrmConfigMerchant.EditXChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_nCurrX := EditX.Value;
  ModValue();
end;

procedure TfrmConfigMerchant.EditYChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_nCurrY := EditY.Value;
  ModValue();
end;

procedure TfrmConfigMerchant.EditShowNameChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_sCharName := Trim(EditShowName.Text);
  ModValue();
end;

procedure TfrmConfigMerchant.EditImageIdxChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_wAppr := EditImageIdx.Value;
  ModValue();
end;

procedure TfrmConfigMerchant.EditScriptNameChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_sScript := Trim(EditScriptName.Text);
  ModValue();
end;

procedure TfrmConfigMerchant.EditMapNameChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_sMapName := Trim(EditMapName.Text);
  ModValue();
end;

procedure TfrmConfigMerchant.ComboBoxDirChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_nFlag := ComboBoxDir.ItemIndex;
  ModValue();
end;

procedure TfrmConfigMerchant.CheckBoxOfCastleClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boCastle := CheckBoxOfCastle.Checked;
  ModValue();
end;


procedure TfrmConfigMerchant.CheckBoxAutoMoveClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boCanMove := CheckBoxAutoMove.Checked;
  ModValue();
end;


procedure TfrmConfigMerchant.EditMoveTimeChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_dwMoveTime := EditMoveTime.Value;
  ModValue();
end;

procedure TfrmConfigMerchant.LoadScriptFile;
var
  I: Integer;
  sScriptFile: string;
  LoadList: TStringList;
  LineText: string;
  boNoHeader: Boolean;
begin
  if SelMerchant = nil then Exit;
  sScriptFile := g_Config.sEnvirDir + 'Market_Def\' + SelMerchant.m_sScript + '-' + SelMerchant.m_sMapName + '.txt';
  MemoScript.Visible := False;
  LineText := '(';
  if SelMerchant.m_boBuy then LineText := LineText + sBUY + ' ';
  if SelMerchant.m_boSell then LineText := LineText + sSELL + ' ';
  if SelMerchant.m_boMakeDrug then LineText := LineText + sMAKEDURG + ' ';
  if SelMerchant.m_boStorage then LineText := LineText + sSTORAGE + ' ';
  if SelMerchant.m_boGetback then LineText := LineText + sGETBACK + ' ';
  if SelMerchant.m_boUpgradenow then LineText := LineText + sUPGRADENOW + ' ';
  if SelMerchant.m_boGetBackupgnow then LineText := LineText + sGETBACKUPGNOW + ' ';
  if SelMerchant.m_boRepair then LineText := LineText + sREPAIR + ' ';
  if SelMerchant.m_boS_repair then LineText := LineText + sSUPERREPAIR + ' ';
  if SelMerchant.m_boSendmsg then LineText := LineText + sSL_SENDMSG + ' ';

  if SelMerchant.m_boBuyOff then LineText := LineText + sBUYOFF + ' ';
  if SelMerchant.m_boSellOff then LineText := LineText + sSELLOFF + ' ';
  if SelMerchant.m_boGetSellGold then LineText := LineText + sGETSELLGOLD + ' ';

  LineText := LineText + ')';
  MemoScript.Lines.Add(LineText);
  LineText := '%' + IntToStr(SelMerchant.m_nPriceRate);
  MemoScript.Lines.Add(LineText);
  for I := 0 to SelMerchant.m_ItemTypeList.Count - 1 do begin
    LineText := '+' + IntToStr(Integer(SelMerchant.m_ItemTypeList.Items[I]));
    MemoScript.Lines.Add(LineText);
  end;
  if FileExists(sScriptFile) then begin
    LoadList := TStringList.Create;
    LoadList.LoadFromFile(sScriptFile);
    boNoHeader := False;
    for I := 0 to LoadList.Count - 1 do begin
      LineText := LoadList.Strings[I];
      if (LineText = '') or (LineText[1] = ';') then Continue;

      if (LineText[1] = '[') or (LineText[1] = '#') then boNoHeader := True;
      if boNoHeader then begin
        MemoScript.Lines.Add(LineText);
      end;

    end;
    LoadList.Free;
  end;
  MemoScript.Visible := True;
end;

procedure TfrmConfigMerchant.ChangeScriptAllowAction;
var
  LineText: string;
begin
  if (SelMerchant = nil) or (MemoScript.Lines.Count <= 0) then Exit;
  LineText := '(';
  if SelMerchant.m_boBuy then LineText := LineText + sBUY + ' ';
  if SelMerchant.m_boSell then LineText := LineText + sSELL + ' ';
  if SelMerchant.m_boMakeDrug then LineText := LineText + sMAKEDURG + ' ';
  if SelMerchant.m_boStorage then LineText := LineText + sSTORAGE + ' ';
  if SelMerchant.m_boGetback then LineText := LineText + sGETBACK + ' ';
  if SelMerchant.m_boUpgradenow then LineText := LineText + sUPGRADENOW + ' ';
  if SelMerchant.m_boGetBackupgnow then LineText := LineText + sGETBACKUPGNOW + ' ';
  if SelMerchant.m_boRepair then LineText := LineText + sREPAIR + ' ';
  if SelMerchant.m_boS_repair then LineText := LineText + sSUPERREPAIR + ' ';
  if SelMerchant.m_boSendmsg then LineText := LineText + sSL_SENDMSG + ' ';
  LineText := LineText + ')';
  MemoScript.Lines[0] := LineText;
end;

procedure TfrmConfigMerchant.CheckBoxBuyClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boBuy := CheckBoxBuy.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxSellClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boSell := CheckBoxSell.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxGetbackClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boGetback := CheckBoxGetback.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxStorageClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boStorage := CheckBoxStorage.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxUpgradenowClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boUpgradenow := CheckBoxUpgradenow.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxGetbackupgnowClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boGetBackupgnow := CheckBoxGetbackupgnow.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxRepairClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boRepair := CheckBoxRepair.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxS_repairClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boS_repair := CheckBoxS_repair.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxMakedrugClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boMakeDrug := CheckBoxMakedrug.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.CheckBoxSendMsgClick(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  SelMerchant.m_boSendmsg := CheckBoxSendMsg.Checked;
  ModValue();
  ChangeScriptAllowAction();
end;

procedure TfrmConfigMerchant.EditPriceRateChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;

  SelMerchant.m_nPriceRate := EditPriceRate.Value;
  MemoScript.Lines[1] := '%' + IntToStr(SelMerchant.m_nPriceRate);
  ModValue();

end;

procedure TfrmConfigMerchant.ButtonScriptSaveClick(Sender: TObject);
var
  sScriptFile: string;
begin
  sScriptFile := g_Config.sEnvirDir + 'Market_Def\' + SelMerchant.m_sScript + '-' + SelMerchant.m_sMapName + '.txt';
  MemoScript.Lines.SaveToFile(sScriptFile);
  uModValue();
  ButtonReLoadNpc.Enabled := True;
end;

procedure TfrmConfigMerchant.ButtonReLoadNpcClick(Sender: TObject);
begin
  if (SelMerchant = nil) then Exit;
  try
    EnterCriticalSection(ProcessHumanCriticalSection);
    SelMerchant.ClearScript;
    SelMerchant.LoadNpcScript;
  finally
    LeaveCriticalSection(ProcessHumanCriticalSection);
  end;
  ButtonReLoadNpc.Enabled := False;
end;



procedure TfrmConfigMerchant.MemoScriptChange(Sender: TObject);
begin
  if not boOpened or (SelMerchant = nil) then Exit;
  ModValue();
end;





end.

⌨️ 快捷键说明

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