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

📄 functionconfig.pas

📁 M2server 的功能插件 值得研究 此插件支持最新英雄M2
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      end;
    end;
  finally
    ListViewDisallow.Items.EndUpdate;
  end;
end;

procedure TFrmFunctionConfig.ListBoxitemListDblClick(Sender: TObject);
var
  ListItem: TListItem;
  sItemName: string;
  I: Integer;
begin
  try
    sItemName := ListBoxitemList.Items.Strings[ListBoxitemList.ItemIndex];
  except
    sItemName := '';
  end;
  if (sItemName <> '') then begin
    if InListBoxitemList(sItemName) then begin
      Application.MessageBox('你要选择的物品已经在禁止物品列表中,请选择其他物品!!!', '提示信息', MB_ICONQUESTION);
      Exit;
    end;
    ListViewDisallow.Items.BeginUpdate;
    try
      ListItem := ListViewDisallow.Items.Add;
      ListItem.Caption := sItemName;
      ListItem.SubItems.Add('0');
      ListItem.SubItems.Add('0');
      ListItem.SubItems.Add('0');
      ListItem.SubItems.Add('0');
    finally
      ListViewDisallow.Items.EndUpdate;
    end;
  end;
end;

procedure TFrmFunctionConfig.ListViewDisallowClick(Sender: TObject);
var
  ListItem: TListItem;
  boCanDrop: Boolean;
  boCanDeal: Boolean;
  boCanStorage: Boolean;
  boCanRepair: Boolean;
begin
  try
    ListItem := ListViewDisallow.Items.Item[ListViewDisallow.ItemIndex];
    boCanDrop := Boolean(StrToInt(ListItem.SubItems.Strings[0]));
    boCanDeal := Boolean(StrToInt(ListItem.SubItems.Strings[1]));
    boCanStorage := Boolean(StrToInt(ListItem.SubItems.Strings[2]));
    boCanRepair := Boolean(StrToInt(ListItem.SubItems.Strings[3]));
    ButtonDisallowDrop.Enabled := True;
    ButtonDisallowDeal.Enabled := True;
    ButtonDisallowStorage.Enabled := True;
    ButtonDisallowRepair.Enabled := True;
    ButtonDisallowDel.Enabled := True;
    if not boCanDrop then begin
      ButtonDisallowDrop.Caption := '禁止仍';
      ButtonDisallowDrop.ShowHint := False;
    end else begin
      ButtonDisallowDrop.Caption := '允许仍';
      ButtonDisallowDrop.ShowHint := True;
    end;
    if not boCanDeal then begin
      ButtonDisallowDeal.Caption := '禁止交易';
      ButtonDisallowDeal.ShowHint := False;
    end else begin
      ButtonDisallowDeal.Caption := '允许交易';
      ButtonDisallowDeal.ShowHint := True;
    end;
    if not boCanStorage then begin
      ButtonDisallowStorage.Caption := '禁止存';
      ButtonDisallowStorage.ShowHint := False;
    end else begin
      ButtonDisallowStorage.Caption := '允许存';
      ButtonDisallowStorage.ShowHint := True;
    end;
    if not boCanRepair then begin
      ButtonDisallowRepair.Caption := '禁止修理';
      ButtonDisallowRepair.ShowHint := False;
    end else begin
      ButtonDisallowRepair.Caption := '允许修理';
      ButtonDisallowRepair.ShowHint := True;
    end;
  except
    ButtonDisallowDrop.Enabled := False;
    ButtonDisallowDeal.Enabled := False;
    ButtonDisallowStorage.Enabled := False;
    ButtonDisallowRepair.Enabled := False;
    ButtonDisallowDel.Enabled := False;
  end;
end;

procedure TFrmFunctionConfig.ButtonDisallowDropClick(Sender: TObject);
var
  ListItem: TListItem;
begin
  try
    ListItem := ListViewDisallow.Items.Item[ListViewDisallow.ItemIndex];
    if ButtonDisallowDrop.ShowHint then begin
      ListItem.SubItems.Strings[0] := '0';
      ButtonDisallowDrop.ShowHint := False;
      ButtonDisallowDrop.Caption := '禁止仍';
    end else begin
      ListItem.SubItems.Strings[0] := '1';
      ButtonDisallowDrop.ShowHint := True;
      ButtonDisallowDrop.Caption := '允许仍';
    end;
  except
  end;
end;

procedure TFrmFunctionConfig.ButtonDisallowDealClick(Sender: TObject);
var
  ListItem: TListItem;
begin
  try
    ListItem := ListViewDisallow.Items.Item[ListViewDisallow.ItemIndex];
    if ButtonDisallowDeal.ShowHint then begin
      ListItem.SubItems.Strings[1] := '0';
      ButtonDisallowDeal.ShowHint := False;
      ButtonDisallowDeal.Caption := '禁止交易';
    end else begin
      ListItem.SubItems.Strings[1] := '1';
      ButtonDisallowDeal.ShowHint := True;
      ButtonDisallowDeal.Caption := '允许交易';
    end;
  except
  end;
end;

procedure TFrmFunctionConfig.ButtonDisallowStorageClick(Sender: TObject);
var
  ListItem: TListItem;
begin
  try
    ListItem := ListViewDisallow.Items.Item[ListViewDisallow.ItemIndex];
    if ButtonDisallowStorage.ShowHint then begin
      ListItem.SubItems.Strings[2] := '0';
      ButtonDisallowStorage.ShowHint := False;
      ButtonDisallowStorage.Caption := '禁止存';
    end else begin
      ListItem.SubItems.Strings[2] := '1';
      ButtonDisallowStorage.ShowHint := True;
      ButtonDisallowStorage.Caption := '允许存';
    end;
  except
  end;
end;

procedure TFrmFunctionConfig.ButtonDisallowRepairClick(Sender: TObject);
var
  ListItem: TListItem;
begin
  try
    ListItem := ListViewDisallow.Items.Item[ListViewDisallow.ItemIndex];
    if ButtonDisallowRepair.ShowHint then begin
      ListItem.SubItems.Strings[3] := '0';
      ButtonDisallowRepair.ShowHint := False;
      ButtonDisallowRepair.Caption := '禁止修理';
    end else begin
      ListItem.SubItems.Strings[3] := '1';
      ButtonDisallowRepair.ShowHint := True;
      ButtonDisallowRepair.Caption := '允许修理';
    end;
  except
  end;
end;

procedure TFrmFunctionConfig.ButtonDisallowDelClick(Sender: TObject);
begin
  try
    ListViewDisallow.DeleteSelected;
  except
  end;
end;

procedure TFrmFunctionConfig.RefLoadDisallowStdItems();
var
  I: Integer;
  ListItem: TListItem;
  CheckItem: pTCheckItem;
  sItemName: string;
  sCanDrop: string;
  sCanDeal: string;
  sCanStorage: string;
  sCanRepair: string;
begin
  ListViewDisallow.Items.Clear;
  for I := 0 to g_CheckItemList.Count - 1 do begin
    CheckItem := pTCheckItem(g_CheckItemList.Items[I]);
    sItemName := CheckItem.szItemName;
    sCanDrop := IntToStr(Integer(CheckItem.boCanDrop));
    sCanDeal := IntToStr(Integer(CheckItem.boCanDeal));
    sCanStorage := IntToStr(Integer(CheckItem.boCanStorage));
    sCanRepair := IntToStr(Integer(CheckItem.boCanRepair));
    ListViewDisallow.Items.BeginUpdate;
    try
      ListItem := ListViewDisallow.Items.Add;
      ListItem.Caption := sItemName;
      ListItem.SubItems.Add(sCanDrop);
      ListItem.SubItems.Add(sCanDeal);
      ListItem.SubItems.Add(sCanStorage);
      ListItem.SubItems.Add(sCanRepair);
    finally
      ListViewDisallow.Items.EndUpdate;
    end;
  end;
end;

procedure TFrmFunctionConfig.ButtonDisallowSaveClick(Sender: TObject);
var
  I: Integer;
  ListItem: TListItem;
  SaveList: Classes.TStringList;
  sFileName: string;
  sLineText: string;
  sItemName: string;
  sCanDrop: string;
  sCanDeal: string;
  sCanStorage: string;
  sCanRepair: string;
begin
  ButtonDisallowSave.Enabled := False;
  sFileName := '.\CheckItemList.txt';
  SaveList := Classes.TStringList.Create;
  SaveList.Add(';引擎插件禁止物品配置文件');
  SaveList.Add(';物品名称'#9'扔'#9'交易'#9'存'#9'修');
  ListViewDisallow.Items.BeginUpdate;
  try
    for I := 0 to ListViewDisallow.Items.Count - 1 do begin
      ListItem := ListViewDisallow.Items.Item[I];
      sItemName := ListItem.Caption;
      sCanDrop := ListItem.SubItems.Strings[0];
      sCanDeal := ListItem.SubItems.Strings[1];
      sCanStorage := ListItem.SubItems.Strings[2];
      sCanRepair := ListItem.SubItems.Strings[3];
      sLineText := sItemName + #9 + sCanDrop + #9 + sCanDeal + #9 + sCanStorage + #9 + sCanRepair;
      SaveList.Add(sLineText);
    end;
  finally
    ListViewDisallow.Items.EndUpdate;
  end;
  SaveList.SaveToFile(sFileName);
  SaveList.Free;
  Application.MessageBox('保存完成!!!', '提示信息', MB_ICONQUESTION);
  ButtonDisallowSave.Enabled := True;
end;

procedure TFrmFunctionConfig.ButtonLoadCheckItemListClick(Sender: TObject);
begin
  ButtonLoadCheckItemList.Enabled := False;
  LoadCheckItemList();
  RefLoadDisallowStdItems();
  Application.MessageBox('重新加载禁止物品配置完成!!!', '提示信息', MB_ICONQUESTION);
  ButtonLoadCheckItemList.Enabled := True;
end;

end.

⌨️ 快捷键说明

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