Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/gui/UI_LenheartUI/ExplosiveControl.java
This commit is contained in:
雪风 2025-03-14 17:33:19 +08:00
commit 3181b54d0d
2 changed files with 117 additions and 189 deletions

View File

@ -116,10 +116,10 @@ public class ExplosiveControl extends JPanel {
public void SetRightL(JTable tableobj){ public void SetRightL(JTable tableobj){
DefaultTableModel tableModel = (DefaultTableModel)tableobj.getModel(); DefaultTableModel tableModel = (DefaultTableModel)tableobj.getModel();
// 创建一个自定义的单元格渲染器用于右对齐字符串
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
rightRenderer.setHorizontalAlignment(JLabel.RIGHT); rightRenderer.setHorizontalAlignment(JLabel.RIGHT);
// 遍历表格的所有列将字符串类型的列设置为右对齐
for (int i = 0; i < tableobj.getColumnCount(); i++) { for (int i = 0; i < tableobj.getColumnCount(); i++) {
if (tableobj.getColumnClass(i) == String.class) { if (tableobj.getColumnClass(i) == String.class) {
tableobj.getColumnModel().getColumn(i).setCellRenderer(rightRenderer); tableobj.getColumnModel().getColumn(i).setCellRenderer(rightRenderer);
@ -144,7 +144,7 @@ public class ExplosiveControl extends JPanel {
try { try {
Drop.insertGWId(MonId, ItemId, Chance); Drop.insertGWId(MonId, ItemId, Chance);
} catch (Exception ee) { } catch (Exception ee) {
// 显示消息提示框
JOptionPane.showMessageDialog(null, "新增失败检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "新增失败检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE);
return; return;
} }
@ -153,7 +153,7 @@ public class ExplosiveControl extends JPanel {
} }
private void 独立爆率删除配置(ActionEvent e) { private void 独立爆率删除配置(ActionEvent e) {
// TODO add your code here
int selectedRow = table2.getSelectedRow(); int selectedRow = table2.getSelectedRow();
if (selectedRow != -1) { if (selectedRow != -1) {
DefaultTableModel tableModel = (DefaultTableModel) table2.getModel(); DefaultTableModel tableModel = (DefaultTableModel) table2.getModel();
@ -180,7 +180,7 @@ public class ExplosiveControl extends JPanel {
try { try {
Drop.insertQQ( ItemId, Chance); Drop.insertQQ( ItemId, Chance);
} catch (Exception ee) { } catch (Exception ee) {
// 显示消息提示框
JOptionPane.showMessageDialog(null, "新增失败检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "新增失败检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE);
return; return;
} }
@ -194,91 +194,91 @@ public class ExplosiveControl extends JPanel {
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel(); DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0); Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0);
Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2); Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2);
// TODO add your code here
tableModel.removeRow(selectedRow); tableModel.removeRow(selectedRow);
if(tableModel.getRowCount() > selectedRow)table1.setRowSelectionInterval(selectedRow, selectedRow); if(tableModel.getRowCount() > selectedRow)table1.setRowSelectionInterval(selectedRow, selectedRow);
} }
} }
private void 独立爆率一键导入(ActionEvent e) { private void 独立爆率一键导入(ActionEvent e) {
// 创建 JFileChooser 实例
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
// 显示文件选择对话框
int result = fileChooser.showOpenDialog(null); int result = fileChooser.showOpenDialog(null);
// 处理用户的选择
if (result == JFileChooser.APPROVE_OPTION) { if (result == JFileChooser.APPROVE_OPTION) {
// 用户选择了文件
File selectedFile = fileChooser.getSelectedFile(); File selectedFile = fileChooser.getSelectedFile();
Drop.importDataMob(selectedFile.getAbsolutePath()); Drop.importDataMob(selectedFile.getAbsolutePath());
} }
} }
private void 独立爆率一键导出(ActionEvent e) { private void 独立爆率一键导出(ActionEvent e) {
// 创建 JFileChooser 实例
JFileChooser folderChooser = new JFileChooser(); JFileChooser folderChooser = new JFileChooser();
// 设置选择模式为只选择文件夹
folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
// 创建两个单选按钮
JRadioButton option1 = new JRadioButton("卡片"); JRadioButton option1 = new JRadioButton("卡片");
JRadioButton option2 = new JRadioButton("怪物"); JRadioButton option2 = new JRadioButton("怪物");
// 创建按钮组确保单选效果
ButtonGroup buttonGroup = new ButtonGroup(); ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(option1); buttonGroup.add(option1);
buttonGroup.add(option2); buttonGroup.add(option2);
// 默认选中模式 1
option1.setSelected(true); option1.setSelected(true);
// 创建一个面板来放置单选按钮
JPanel optionPanel = new JPanel(); JPanel optionPanel = new JPanel();
optionPanel.add(option1); optionPanel.add(option1);
optionPanel.add(option2); optionPanel.add(option2);
// 将面板添加到 JFileChooser 的底部
folderChooser.setAccessory(optionPanel); folderChooser.setAccessory(optionPanel);
// 显示文件夹选择对话框
int result = folderChooser.showOpenDialog(null); int result = folderChooser.showOpenDialog(null);
// 处理用户的选择
if (result == JFileChooser.APPROVE_OPTION) { if (result == JFileChooser.APPROVE_OPTION) {
// 用户选择了文件夹
File selectedFolder = folderChooser.getSelectedFile(); File selectedFolder = folderChooser.getSelectedFile();
String selectedMode = option1.isSelected() ? "卡片" : "怪物"; String selectedMode = option1.isSelected() ? "卡片" : "怪物";
// 调用你的导出数据方法
Drop.exportData(selectedFolder.getAbsolutePath() + "/独立爆率" + selectedMode + ".txt", selectedMode.equals("卡片") ? Drop.getKPS(): Drop.getMobBLs()); Drop.exportData(selectedFolder.getAbsolutePath() + "/独立爆率" + selectedMode + ".txt", selectedMode.equals("卡片") ? Drop.getKPS(): Drop.getMobBLs());
} }
} }
private void 全局爆率一键导出(ActionEvent e) { private void 全局爆率一键导出(ActionEvent e) {
// 创建 JFileChooser 实例
JFileChooser folderChooser = new JFileChooser(); JFileChooser folderChooser = new JFileChooser();
// 设置选择模式为只选择文件夹
folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
// 显示文件夹选择对话框
int result = folderChooser.showOpenDialog(null); int result = folderChooser.showOpenDialog(null);
// 处理用户的选择
if (result == JFileChooser.APPROVE_OPTION) { if (result == JFileChooser.APPROVE_OPTION) {
// 用户选择了文件夹
File selectedFolder = folderChooser.getSelectedFile(); File selectedFolder = folderChooser.getSelectedFile();
Drop.exportData(selectedFolder.getAbsolutePath().toString() + "/全局爆率.txt",Drop.getQQS()); Drop.exportData(selectedFolder.getAbsolutePath().toString() + "/全局爆率.txt",Drop.getQQS());
} }
} }
private void 全局爆率一键导入(ActionEvent e) { private void 全局爆率一键导入(ActionEvent e) {
// 创建 JFileChooser 实例
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
// 显示文件选择对话框
int result = fileChooser.showOpenDialog(null); int result = fileChooser.showOpenDialog(null);
// 处理用户的选择
if (result == JFileChooser.APPROVE_OPTION) { if (result == JFileChooser.APPROVE_OPTION) {
// 用户选择了文件
File selectedFile = fileChooser.getSelectedFile(); File selectedFile = fileChooser.getSelectedFile();
Drop.importDataQQ(selectedFile.getAbsolutePath()); Drop.importDataQQ(selectedFile.getAbsolutePath());
} }
@ -288,7 +288,7 @@ public class ExplosiveControl extends JPanel {
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
panel1 = new JPanel(); panel1 = new JPanel();
button9 = new JButton(); button9 = new JButton();
button10 = new JButton(); button10 = new JButton();
@ -340,28 +340,28 @@ public class ExplosiveControl extends JPanel {
label12 = new JLabel(); label12 = new JLabel();
G_6 = new JTextField(); G_6 = new JTextField();
//======== this ========
setLayout(null); setLayout(null);
//======== panel1 ========
{ {
panel1.setBorder(new TitledBorder("\u5371\u9669\u64cd\u4f5c")); panel1.setBorder(new TitledBorder("\u5371\u9669\u64cd\u4f5c"));
panel1.setLayout(null); panel1.setLayout(null);
//---- button9 ----
button9.setText("\u4e00\u952e\u6e05\u7a7a\u72ec\u7acb\u7206\u7387\u8868"); button9.setText("\u4e00\u952e\u6e05\u7a7a\u72ec\u7acb\u7206\u7387\u8868");
button9.addActionListener(e -> 一键清空独立爆率表(e)); button9.addActionListener(e -> 一键清空独立爆率表(e));
panel1.add(button9); panel1.add(button9);
button9.setBounds(5, 30, 190, button9.getPreferredSize().height); button9.setBounds(5, 30, 190, button9.getPreferredSize().height);
//---- button10 ----
button10.setText("\u4e00\u952e\u6e05\u7a7a\u5168\u5c40\u7206\u7387\u8868"); button10.setText("\u4e00\u952e\u6e05\u7a7a\u5168\u5c40\u7206\u7387\u8868");
button10.addActionListener(e -> 一键清空全局爆率表(e)); button10.addActionListener(e -> 一键清空全局爆率表(e));
panel1.add(button10); panel1.add(button10);
button10.setBounds(5, 60, 190, button10.getPreferredSize().height); button10.setBounds(5, 60, 190, button10.getPreferredSize().height);
{ {
// compute preferred size
Dimension preferredSize = new Dimension(); Dimension preferredSize = new Dimension();
for(int i = 0; i < panel1.getComponentCount(); i++) { for(int i = 0; i < panel1.getComponentCount(); i++) {
Rectangle bounds = panel1.getComponent(i).getBounds(); Rectangle bounds = panel1.getComponent(i).getBounds();
@ -378,19 +378,19 @@ public class ExplosiveControl extends JPanel {
add(panel1); add(panel1);
panel1.setBounds(25, 5, 200, 105); panel1.setBounds(25, 5, 200, 105);
//======== panel2 ========
{ {
panel2.setBorder(new TitledBorder("\u602a\u7269\u5361\u7247")); panel2.setBorder(new TitledBorder("\u602a\u7269\u5361\u7247"));
panel2.setLayout(null); panel2.setLayout(null);
//---- button11 ----
button11.setText("\u52a0\u8f7d\u5237\u65b0\u602a\u7269\u5361\u7247"); button11.setText("\u52a0\u8f7d\u5237\u65b0\u602a\u7269\u5361\u7247");
button11.addActionListener(e -> 加载刷新怪物卡片(e)); button11.addActionListener(e -> 加载刷新怪物卡片(e));
panel2.add(button11); panel2.add(button11);
button11.setBounds(5, 19, 190, button11.getPreferredSize().height); button11.setBounds(5, 19, 190, button11.getPreferredSize().height);
{ {
// compute preferred size
Dimension preferredSize = new Dimension(); Dimension preferredSize = new Dimension();
for(int i = 0; i < panel2.getComponentCount(); i++) { for(int i = 0; i < panel2.getComponentCount(); i++) {
Rectangle bounds = panel2.getComponent(i).getBounds(); Rectangle bounds = panel2.getComponent(i).getBounds();
@ -407,7 +407,7 @@ public class ExplosiveControl extends JPanel {
add(panel2); add(panel2);
panel2.setBounds(25, 120, 200, 65); panel2.setBounds(25, 120, 200, 65);
//======== panel3 ========
{ {
panel3.setBorder(new TitledBorder("\u5feb\u6377\u6e05\u7406\u6240\u6709\u7206\u7387")); panel3.setBorder(new TitledBorder("\u5feb\u6377\u6e05\u7406\u6240\u6709\u7206\u7387"));
panel3.setLayout(null); panel3.setLayout(null);
@ -416,30 +416,30 @@ public class ExplosiveControl extends JPanel {
panel3.add(物品ID清理); panel3.add(物品ID清理);
物品ID清理.setBounds(10, 85, 115, 物品ID清理.getPreferredSize().height); 物品ID清理.setBounds(10, 85, 115, 物品ID清理.getPreferredSize().height);
//---- button13 ----
button13.setText("\u6e05\u7406"); button13.setText("\u6e05\u7406");
button13.addActionListener(e -> 根据怪物ID清理(e)); button13.addActionListener(e -> 根据怪物ID清理(e));
panel3.add(button13); panel3.add(button13);
button13.setBounds(130, 35, 58, 25); button13.setBounds(130, 35, 58, 25);
//---- button14 ----
button14.setText("\u6e05\u7406"); button14.setText("\u6e05\u7406");
button14.addActionListener(e -> 根据物品ID清理(e)); button14.addActionListener(e -> 根据物品ID清理(e));
panel3.add(button14); panel3.add(button14);
button14.setBounds(130, 85, 58, 25); button14.setBounds(130, 85, 58, 25);
//---- label5 ----
label5.setText("\u6839\u636e\u602a\u7269ID\u6e05\u7406"); label5.setText("\u6839\u636e\u602a\u7269ID\u6e05\u7406");
panel3.add(label5); panel3.add(label5);
label5.setBounds(15, 20, 85, 17); label5.setBounds(15, 20, 85, 17);
//---- label6 ----
label6.setText("\u6839\u636e\u7269\u54c1ID\u6e05\u7406"); label6.setText("\u6839\u636e\u7269\u54c1ID\u6e05\u7406");
panel3.add(label6); panel3.add(label6);
label6.setBounds(15, 70, 85, 17); label6.setBounds(15, 70, 85, 17);
{ {
// compute preferred size
Dimension preferredSize = new Dimension(); Dimension preferredSize = new Dimension();
for(int i = 0; i < panel3.getComponentCount(); i++) { for(int i = 0; i < panel3.getComponentCount(); i++) {
Rectangle bounds = panel3.getComponent(i).getBounds(); Rectangle bounds = panel3.getComponent(i).getBounds();
@ -456,14 +456,14 @@ public class ExplosiveControl extends JPanel {
add(panel3); add(panel3);
panel3.setBounds(25, 200, 200, 125); panel3.setBounds(25, 200, 200, 125);
//======== panel4 ========
{ {
panel4.setBorder(new TitledBorder("\u5feb\u6377\u67e5\u8be2")); panel4.setBorder(new TitledBorder("\u5feb\u6377\u67e5\u8be2"));
panel4.setLayout(null); panel4.setLayout(null);
panel4.add(物品ID查询掉落); panel4.add(物品ID查询掉落);
物品ID查询掉落.setBounds(10, 40, 115, 物品ID查询掉落.getPreferredSize().height); 物品ID查询掉落.setBounds(10, 40, 115, 物品ID查询掉落.getPreferredSize().height);
//---- button15 ----
button15.setText("\u67e5\u8be2"); button15.setText("\u67e5\u8be2");
button15.addActionListener(e -> button物品ID查询掉落(e)); button15.addActionListener(e -> button物品ID查询掉落(e));
panel4.add(button15); panel4.add(button15);
@ -471,7 +471,7 @@ public class ExplosiveControl extends JPanel {
panel4.add(物品名查询掉落); panel4.add(物品名查询掉落);
物品名查询掉落.setBounds(10, 90, 115, 物品名查询掉落.getPreferredSize().height); 物品名查询掉落.setBounds(10, 90, 115, 物品名查询掉落.getPreferredSize().height);
//---- button16 ----
button16.setText("\u67e5\u8be2"); button16.setText("\u67e5\u8be2");
button16.addActionListener(e -> 物品名查询掉落函数(e)); button16.addActionListener(e -> 物品名查询掉落函数(e));
panel4.add(button16); panel4.add(button16);
@ -479,7 +479,7 @@ public class ExplosiveControl extends JPanel {
panel4.add(怪物ID查询掉落); panel4.add(怪物ID查询掉落);
怪物ID查询掉落.setBounds(10, 140, 115, 怪物ID查询掉落.getPreferredSize().height); 怪物ID查询掉落.setBounds(10, 140, 115, 怪物ID查询掉落.getPreferredSize().height);
//---- button17 ----
button17.setText("\u67e5\u8be2"); button17.setText("\u67e5\u8be2");
button17.addActionListener(e -> 怪物ID查询掉落函数(e)); button17.addActionListener(e -> 怪物ID查询掉落函数(e));
panel4.add(button17); panel4.add(button17);
@ -487,34 +487,34 @@ public class ExplosiveControl extends JPanel {
panel4.add(怪物名查询掉落); panel4.add(怪物名查询掉落);
怪物名查询掉落.setBounds(10, 190, 115, 怪物名查询掉落.getPreferredSize().height); 怪物名查询掉落.setBounds(10, 190, 115, 怪物名查询掉落.getPreferredSize().height);
//---- button18 ----
button18.setText("\u67e5\u8be2"); button18.setText("\u67e5\u8be2");
button18.addActionListener(e -> 怪物名查询掉落函数(e)); button18.addActionListener(e -> 怪物名查询掉落函数(e));
panel4.add(button18); panel4.add(button18);
button18.setBounds(130, 190, 58, 25); button18.setBounds(130, 190, 58, 25);
//---- label1 ----
label1.setText("\u7269\u54c1ID\u67e5\u8be2\u6389\u843d"); label1.setText("\u7269\u54c1ID\u67e5\u8be2\u6389\u843d");
panel4.add(label1); panel4.add(label1);
label1.setBounds(new Rectangle(new Point(15, 25), label1.getPreferredSize())); label1.setBounds(new Rectangle(new Point(15, 25), label1.getPreferredSize()));
//---- label2 ----
label2.setText("\u7269\u54c1\u540d\u67e5\u8be2\u6389\u843d"); label2.setText("\u7269\u54c1\u540d\u67e5\u8be2\u6389\u843d");
panel4.add(label2); panel4.add(label2);
label2.setBounds(15, 75, 85, 17); label2.setBounds(15, 75, 85, 17);
//---- label3 ----
label3.setText("\u602a\u7269ID\u67e5\u8be2\u6389\u843d"); label3.setText("\u602a\u7269ID\u67e5\u8be2\u6389\u843d");
panel4.add(label3); panel4.add(label3);
label3.setBounds(15, 125, 85, 17); label3.setBounds(15, 125, 85, 17);
//---- label4 ----
label4.setText("\u602a\u7269\u540d\u67e5\u8be2\u6389\u843d"); label4.setText("\u602a\u7269\u540d\u67e5\u8be2\u6389\u843d");
panel4.add(label4); panel4.add(label4);
label4.setBounds(15, 175, 85, 17); label4.setBounds(15, 175, 85, 17);
{ {
// compute preferred size
Dimension preferredSize = new Dimension(); Dimension preferredSize = new Dimension();
for(int i = 0; i < panel4.getComponentCount(); i++) { for(int i = 0; i < panel4.getComponentCount(); i++) {
Rectangle bounds = panel4.getComponent(i).getBounds(); Rectangle bounds = panel4.getComponent(i).getBounds();
@ -531,15 +531,15 @@ public class ExplosiveControl extends JPanel {
add(panel4); add(panel4);
panel4.setBounds(25, 340, 200, 235); panel4.setBounds(25, 340, 200, 235);
//======== panel5 ========
{ {
panel5.setBorder(new TitledBorder("\u602a\u7269\u72ec\u7acb\u7206\u7387")); panel5.setBorder(new TitledBorder("\u602a\u7269\u72ec\u7acb\u7206\u7387"));
panel5.setLayout(new GridLayout()); panel5.setLayout(new GridLayout());
//======== scrollPane3 ========
{ {
//---- table2 ----
table2.setModel(new DefaultTableModel( table2.setModel(new DefaultTableModel(
new Object[][] { new Object[][] {
}, },
@ -567,15 +567,15 @@ public class ExplosiveControl extends JPanel {
add(panel5); add(panel5);
panel5.setBounds(235, 5, 840, 580); panel5.setBounds(235, 5, 840, 580);
//======== panel6 ========
{ {
panel6.setBorder(new TitledBorder("\u5168\u5c40\u7206\u7387")); panel6.setBorder(new TitledBorder("\u5168\u5c40\u7206\u7387"));
panel6.setLayout(new GridLayout()); panel6.setLayout(new GridLayout());
//======== scrollPane1 ========
{ {
//---- table1 ----
table1.setModel(new DefaultTableModel( table1.setModel(new DefaultTableModel(
new Object[][] { new Object[][] {
}, },
@ -603,112 +603,112 @@ public class ExplosiveControl extends JPanel {
add(panel6); add(panel6);
panel6.setBounds(1080, 5, 410, 580); panel6.setBounds(1080, 5, 410, 580);
//---- button1 ----
button1.setText("\u65b0\u589e\u914d\u7f6e"); button1.setText("\u65b0\u589e\u914d\u7f6e");
button1.addActionListener(e -> 新增独立爆率配置(e)); button1.addActionListener(e -> 新增独立爆率配置(e));
add(button1); add(button1);
button1.setBounds(235, 625, 95, button1.getPreferredSize().height); button1.setBounds(235, 625, 95, button1.getPreferredSize().height);
//---- button2 ----
button2.setText("\u5220\u9664\u914d\u7f6e"); button2.setText("\u5220\u9664\u914d\u7f6e");
button2.addActionListener(e -> 独立爆率删除配置(e)); button2.addActionListener(e -> 独立爆率删除配置(e));
add(button2); add(button2);
button2.setBounds(345, 625, 95, 34); button2.setBounds(345, 625, 95, 34);
//---- button5 ----
button5.setText("\u4e00\u952e\u5bfc\u5165"); button5.setText("\u4e00\u952e\u5bfc\u5165");
button5.addActionListener(e -> 独立爆率一键导入(e)); button5.addActionListener(e -> 独立爆率一键导入(e));
add(button5); add(button5);
button5.setBounds(455, 625, 95, 34); button5.setBounds(455, 625, 95, 34);
//---- button6 ----
button6.setText("\u4e00\u952e\u5bfc\u51fa"); button6.setText("\u4e00\u952e\u5bfc\u51fa");
button6.addActionListener(e -> 独立爆率一键导出(e)); button6.addActionListener(e -> 独立爆率一键导出(e));
add(button6); add(button6);
button6.setBounds(560, 625, 95, 34); button6.setBounds(560, 625, 95, 34);
//---- button3 ----
button3.setText("\u65b0\u589e\u914d\u7f6e"); button3.setText("\u65b0\u589e\u914d\u7f6e");
button3.addActionListener(e -> 新增全局爆率配置(e)); button3.addActionListener(e -> 新增全局爆率配置(e));
add(button3); add(button3);
button3.setBounds(1080, 625, 95, 34); button3.setBounds(1080, 625, 95, 34);
//---- button4 ----
button4.setText("\u5220\u9664\u914d\u7f6e"); button4.setText("\u5220\u9664\u914d\u7f6e");
button4.addActionListener(e -> 删除全局爆率配置(e)); button4.addActionListener(e -> 删除全局爆率配置(e));
add(button4); add(button4);
button4.setBounds(1185, 625, 95, 34); button4.setBounds(1185, 625, 95, 34);
//---- button7 ----
button7.setText("\u4e00\u952e\u5bfc\u5165"); button7.setText("\u4e00\u952e\u5bfc\u5165");
button7.addActionListener(e -> 全局爆率一键导入(e)); button7.addActionListener(e -> 全局爆率一键导入(e));
add(button7); add(button7);
button7.setBounds(1290, 625, 95, 34); button7.setBounds(1290, 625, 95, 34);
//---- button8 ----
button8.setText("\u4e00\u952e\u5bfc\u51fa"); button8.setText("\u4e00\u952e\u5bfc\u51fa");
button8.addActionListener(e -> 全局爆率一键导出(e)); button8.addActionListener(e -> 全局爆率一键导出(e));
add(button8); add(button8);
button8.setBounds(1395, 625, 95, 34); button8.setBounds(1395, 625, 95, 34);
//---- button19 ----
button19.setText("\u5237\u65b0\u602a\u7269\u7206\u7269\u6570\u636e"); button19.setText("\u5237\u65b0\u602a\u7269\u7206\u7269\u6570\u636e");
button19.addActionListener(e -> 刷新怪物爆物数据(e)); button19.addActionListener(e -> 刷新怪物爆物数据(e));
add(button19); add(button19);
button19.setBounds(45, 585, 155, 60); button19.setBounds(45, 585, 155, 60);
//---- G_1 ----
G_1.setToolTipText("\u602a\u7269ID"); G_1.setToolTipText("\u602a\u7269ID");
add(G_1); add(G_1);
G_1.setBounds(280, 590, 100, 30); G_1.setBounds(280, 590, 100, 30);
//---- G_2 ----
G_2.setToolTipText("\u7269\u54c1ID"); G_2.setToolTipText("\u7269\u54c1ID");
add(G_2); add(G_2);
G_2.setBounds(425, 590, 100, 30); G_2.setBounds(425, 590, 100, 30);
//---- G_3 ----
G_3.setToolTipText("\u7206\u7387"); G_3.setToolTipText("\u7206\u7387");
add(G_3); add(G_3);
G_3.setBounds(560, 590, 100, 30); G_3.setBounds(560, 590, 100, 30);
//---- label7 ----
label7.setText("\u602a\u7269ID"); label7.setText("\u602a\u7269ID");
add(label7); add(label7);
label7.setBounds(new Rectangle(new Point(240, 595), label7.getPreferredSize())); label7.setBounds(new Rectangle(new Point(240, 595), label7.getPreferredSize()));
//---- label8 ----
label8.setText("\u7269\u54c1ID"); label8.setText("\u7269\u54c1ID");
add(label8); add(label8);
label8.setBounds(385, 595, 37, 17); label8.setBounds(385, 595, 37, 17);
//---- label9 ----
label9.setText("\u7206\u7387"); label9.setText("\u7206\u7387");
add(label9); add(label9);
label9.setBounds(530, 595, 37, 17); label9.setBounds(530, 595, 37, 17);
//---- label11 ----
label11.setText("\u7269\u54c1ID"); label11.setText("\u7269\u54c1ID");
add(label11); add(label11);
label11.setBounds(1085, 595, 37, 17); label11.setBounds(1085, 595, 37, 17);
//---- G_5 ----
G_5.setToolTipText("\u7269\u54c1ID"); G_5.setToolTipText("\u7269\u54c1ID");
add(G_5); add(G_5);
G_5.setBounds(1125, 590, 100, 30); G_5.setBounds(1125, 590, 100, 30);
//---- label12 ----
label12.setText("\u7206\u7387"); label12.setText("\u7206\u7387");
add(label12); add(label12);
label12.setBounds(1230, 595, 37, 17); label12.setBounds(1230, 595, 37, 17);
//---- G_6 ----
G_6.setToolTipText("\u7206\u7387"); G_6.setToolTipText("\u7206\u7387");
add(G_6); add(G_6);
G_6.setBounds(1260, 590, 100, 30); G_6.setBounds(1260, 590, 100, 30);
{ {
// compute preferred size
Dimension preferredSize = new Dimension(); Dimension preferredSize = new Dimension();
for(int i = 0; i < getComponentCount(); i++) { for(int i = 0; i < getComponentCount(); i++) {
Rectangle bounds = getComponent(i).getBounds(); Rectangle bounds = getComponent(i).getBounds();
@ -721,30 +721,30 @@ public class ExplosiveControl extends JPanel {
setMinimumSize(preferredSize); setMinimumSize(preferredSize);
setPreferredSize(preferredSize); setPreferredSize(preferredSize);
} }
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
SetRightL(this.table1); SetRightL(this.table1);
SetRightL(this.table2); SetRightL(this.table2);
DefaultTableModel tableModel = (DefaultTableModel) table2.getModel(); DefaultTableModel tableModel = (DefaultTableModel) table2.getModel();
// 创建 TableRowSorter 并关联到 JTable
TableRowSorter<DefaultTableModel> sorter = new TableRowSorter<>(tableModel); TableRowSorter<DefaultTableModel> sorter = new TableRowSorter<>(tableModel);
table2.setRowSorter(sorter); table2.setRowSorter(sorter);
DefaultTableModel tableModel1 = (DefaultTableModel) table1.getModel(); DefaultTableModel tableModel1 = (DefaultTableModel) table1.getModel();
// 创建 TableRowSorter 并关联到 JTable
TableRowSorter<DefaultTableModel> sorter1 = new TableRowSorter<>(tableModel1); TableRowSorter<DefaultTableModel> sorter1 = new TableRowSorter<>(tableModel1);
table1.setRowSorter(sorter1); table1.setRowSorter(sorter1);
// JTable 添加鼠标监听器
table2.addMouseListener(new MouseInputAdapter() { table2.addMouseListener(new MouseInputAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// 获取点击的行和列
int row = table2.rowAtPoint(e.getPoint()); int row = table2.rowAtPoint(e.getPoint());
if (row >= 0) { if (row >= 0) {
// 获取点击单元格的值
Object MonId = table2.getValueAt(row, 2); Object MonId = table2.getValueAt(row, 2);
Object ItemId = table2.getValueAt(row, 4); Object ItemId = table2.getValueAt(row, 4);
Object Chance = table2.getValueAt(row, 5); Object Chance = table2.getValueAt(row, 5);
@ -759,11 +759,11 @@ public class ExplosiveControl extends JPanel {
table1.addMouseListener(new MouseInputAdapter() { table1.addMouseListener(new MouseInputAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// 获取点击的行和列
int row = table1.rowAtPoint(e.getPoint()); int row = table1.rowAtPoint(e.getPoint());
if (row >= 0) { if (row >= 0) {
// 获取点击单元格的值
Object ItemId = table1.getValueAt(row, 2); Object ItemId = table1.getValueAt(row, 2);
Object Chance = table1.getValueAt(row, 3); Object Chance = table1.getValueAt(row, 3);
@ -774,7 +774,7 @@ public class ExplosiveControl extends JPanel {
}); });
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
private JPanel panel1; private JPanel panel1;
private JButton button9; private JButton button9;
private JButton button10; private JButton button10;
@ -825,5 +825,5 @@ public class ExplosiveControl extends JPanel {
private JTextField G_5; private JTextField G_5;
private JLabel label12; private JLabel label12;
private JTextField G_6; private JTextField G_6;
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
} }

View File

@ -89,10 +89,6 @@ public class Drop {
public static List<Drop> mobs =null; public static List<Drop> mobs =null;
public static List<Drop> QQS =null; public static List<Drop> QQS =null;
/**
* 获得怪物爆率集合
* @return
*/
public static List<Drop> getMobBLs() { public static List<Drop> getMobBLs() {
if (mobs != null) { if (mobs != null) {
@ -133,10 +129,7 @@ public class Drop {
return mobs; return mobs;
} }
/**
* 获得卡片爆率集合
* @return
*/
public static List<Drop> getKPS() { public static List<Drop> getKPS() {
List<Drop> mobBLs = getMobBLs(); List<Drop> mobBLs = getMobBLs();
List<Drop> collect = mobBLs.stream() List<Drop> collect = mobBLs.stream()
@ -146,11 +139,7 @@ public class Drop {
} }
/**
* 根据序号 删除怪物爆率
* @param id 序号
* @param dropperid 怪物id
*/
public static void deleteGWId(int id,int dropperid) { public static void deleteGWId(int id,int dropperid) {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -169,10 +158,7 @@ public class Drop {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 根据怪物id删除这个怪物的爆率
* @param dropperid 怪物id
*/
public static void deleteGWdropperid(int dropperid) { public static void deleteGWdropperid(int dropperid) {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -192,9 +178,7 @@ public class Drop {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 清空怪物爆率表
*/
public static void deleteGWAll() { public static void deleteGWAll() {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -210,13 +194,7 @@ public class Drop {
mobs = null; mobs = null;
} }
/**
* 修改怪物爆率
* @param dropperid 怪物id
* @param itemid 物品id
* @param chance 爆率
* @param id 序号
*/
public static void updateGWId(int dropperid, int itemid, int chance, int id) { public static void updateGWId(int dropperid, int itemid, int chance, int id) {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -242,12 +220,7 @@ public class Drop {
}); });
} }
/**
* 添加怪物爆率
* @param dropperid 怪物id
* @param itemid 物品id
* @param chance 爆率
*/
public static void insertGWId(int dropperid, int itemid, int chance) { public static void insertGWId(int dropperid, int itemid, int chance) {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -281,10 +254,7 @@ public class Drop {
mobs =null; mobs =null;
} }
/**
* 获得全局爆率集合
* @return
*/
public static List<Drop> getQQS() { public static List<Drop> getQQS() {
if (QQS!=null){ if (QQS!=null){
return QQS; return QQS;
@ -314,10 +284,7 @@ public class Drop {
return QQS; return QQS;
} }
/**
* 根据序号 删除全局爆率
* @param id 序号
*/
public static void deleteQQId(int id) { public static void deleteQQId(int id) {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -338,12 +305,7 @@ public class Drop {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 修改全局爆率
* @param itemid 物品id
* @param chance 爆率
* @param id 序号
*/
public static void updateQQId(int itemid, int chance, int id) { public static void updateQQId(int itemid, int chance, int id) {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -370,11 +332,7 @@ public class Drop {
} }
/**
* 增加全局爆率
* @param itemid 物品id
* @param chance 爆率
*/
public static void insertQQ(int itemid, int chance ) { public static void insertQQ(int itemid, int chance ) {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -400,10 +358,7 @@ public class Drop {
MapleMonsterInformationProvider.getInstance().retrieveGlobal(); MapleMonsterInformationProvider.getInstance().retrieveGlobal();
} }
/**
* 批量增加全局爆率
* @param drops
*/
public static void insertQQALL(List<Drop> drops) { public static void insertQQALL(List<Drop> drops) {
for (Drop drop : drops) { for (Drop drop : drops) {
@ -433,9 +388,7 @@ public class Drop {
MapleMonsterInformationProvider.getInstance().retrieveGlobal(); MapleMonsterInformationProvider.getInstance().retrieveGlobal();
} }
/**
* 删除全局爆率集合
*/
public static void deleteQJAll() { public static void deleteQJAll() {
try { try {
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
@ -451,9 +404,7 @@ public class Drop {
MapleMonsterInformationProvider.getInstance().retrieveGlobal(); MapleMonsterInformationProvider.getInstance().retrieveGlobal();
QQS = null; QQS = null;
} }
/**
* 清理道具id爆率
*/
public static void deleteItemId(int itemId) { public static void deleteItemId(int itemId) {
try { try {
@ -491,18 +442,14 @@ public class Drop {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 根据道具id查询掉落
*/
public static List<Drop> getItemIdsMob(String itemId) { public static List<Drop> getItemIdsMob(String itemId) {
List<Drop> mobBLs = getMobBLs(); List<Drop> mobBLs = getMobBLs();
return mobBLs.stream().filter(drop -> String.valueOf(drop.getItemId()).contains(itemId)) return mobBLs.stream().filter(drop -> String.valueOf(drop.getItemId()).contains(itemId))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 根据物品名称查询掉落
*/
public static List<Drop> getItemNamesMob(String itemName) { public static List<Drop> getItemNamesMob(String itemName) {
List<Drop> mobBLs = getMobBLs(); List<Drop> mobBLs = getMobBLs();
return mobBLs.stream().filter(drop -> String.valueOf(drop.getItenName()).contains(itemName)) return mobBLs.stream().filter(drop -> String.valueOf(drop.getItenName()).contains(itemName))
@ -511,48 +458,35 @@ public class Drop {
/**
* 根据道具id查询全局掉落
*/
public static List<Drop> getItemIdsQQ(String itemId) { public static List<Drop> getItemIdsQQ(String itemId) {
List<Drop> qqs = getQQS(); List<Drop> qqs = getQQS();
return qqs.stream().filter(drop -> String.valueOf(drop.getItemId()).contains(itemId)) return qqs.stream().filter(drop -> String.valueOf(drop.getItemId()).contains(itemId))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 根据物品名称查询全局掉落
*/
public static List<Drop> getItemNamesQQ(String itemName) { public static List<Drop> getItemNamesQQ(String itemName) {
List<Drop> qqs = getQQS(); List<Drop> qqs = getQQS();
return qqs.stream().filter(drop -> String.valueOf(drop.getItenName()).contains(itemName)) return qqs.stream().filter(drop -> String.valueOf(drop.getItenName()).contains(itemName))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 根据怪物id查询掉落
*/
public static List<Drop> getMobIdsMob(String MobId) { public static List<Drop> getMobIdsMob(String MobId) {
List<Drop> mobBLs = getMobBLs(); List<Drop> mobBLs = getMobBLs();
return mobBLs.stream().filter(drop -> String.valueOf(drop.getDropperid()).contains(MobId)) return mobBLs.stream().filter(drop -> String.valueOf(drop.getDropperid()).contains(MobId))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 根据物品名称查询掉落
*/
public static List<Drop> getMobNames(String MobName) { public static List<Drop> getMobNames(String MobName) {
List<Drop> mobBLs = getMobBLs(); List<Drop> mobBLs = getMobBLs();
return mobBLs.stream().filter(drop -> String.valueOf(drop.getDropName()).contains(MobName)) return mobBLs.stream().filter(drop -> String.valueOf(drop.getDropName()).contains(MobName))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 排序
* @param drops 原始集合
* @param type 1按序号排序 2道具id 3道具名字 4怪物id 5怪物名字 6爆率
* @return
*/
public static List<Drop> sort(final List<Drop> drops,int type) { public static List<Drop> sort(final List<Drop> drops,int type) {
switch (type){ switch (type){
case 1: case 1:
@ -577,9 +511,7 @@ public class Drop {
return drops; return drops;
} }
/**
*导出
*/
public static void exportData (String file,List<Drop> drops){ public static void exportData (String file,List<Drop> drops){
JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("bl", drops); jsonObject1.put("bl", drops);
@ -589,13 +521,11 @@ public class Drop {
fileWriter.write(jsonString1); fileWriter.write(jsonString1);
} }
/**
* 导入全局
*/
public static void importDataQQ(String file){ public static void importDataQQ(String file){
FileReader fileReader = new FileReader(file); FileReader fileReader = new FileReader(file);
String result3 = fileReader.readString(); String result3 = fileReader.readString();
//转json
JSONObject jsonObject1 = JSONObject.parseObject(result3); JSONObject jsonObject1 = JSONObject.parseObject(result3);
List<Drop> bl = jsonObject1.getJSONArray("bl").toJavaList(Drop.class); List<Drop> bl = jsonObject1.getJSONArray("bl").toJavaList(Drop.class);
@ -603,13 +533,11 @@ public class Drop {
insertQQALL(bl); insertQQALL(bl);
} }
/**
* 导入怪物
*/
public static void importDataMob(String file){ public static void importDataMob(String file){
FileReader fileReader = new FileReader(file); FileReader fileReader = new FileReader(file);
String result3 = fileReader.readString(); String result3 = fileReader.readString();
//转json
JSONObject jsonObject1 = JSONObject.parseObject(result3); JSONObject jsonObject1 = JSONObject.parseObject(result3);
List<Drop> bl = jsonObject1.getJSONArray("bl").toJavaList(Drop.class); List<Drop> bl = jsonObject1.getJSONArray("bl").toJavaList(Drop.class);
@ -625,7 +553,7 @@ public class Drop {
importDataQQ("E:\\MXD\\cs.txt"); importDataQQ("E:\\MXD\\cs.txt");
// insertGWId(3037,11,11);
} }
} }