📄 configmerchant.pas
字号:
begin
if SelMerchant <> nil then begin
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 + ' ';
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -