From 755e84dff7cc6bc79ccd2810841bcbf82cc3b0e8 Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Fri, 14 Mar 2025 17:27:46 +0800 Subject: [PATCH] no message --- src/gui/UI_LenheartUI/ExplosiveControl.java | 218 ++++++++++++-------- src/gui/UI_LenheartUI/ExplosiveControl.jfd | 8 +- src/gui/tw/Drop.java | 124 +++-------- 3 files changed, 163 insertions(+), 187 deletions(-) diff --git a/src/gui/UI_LenheartUI/ExplosiveControl.java b/src/gui/UI_LenheartUI/ExplosiveControl.java index 29b7eea..4f49093 100644 --- a/src/gui/UI_LenheartUI/ExplosiveControl.java +++ b/src/gui/UI_LenheartUI/ExplosiveControl.java @@ -116,10 +116,10 @@ public class ExplosiveControl extends JPanel { public void SetRightL(JTable tableobj){ DefaultTableModel tableModel = (DefaultTableModel)tableobj.getModel(); - // 创建一个自定义的单元格渲染器,用于右对齐字符串 + DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setHorizontalAlignment(JLabel.RIGHT); - // 遍历表格的所有列,将字符串类型的列设置为右对齐 + for (int i = 0; i < tableobj.getColumnCount(); i++) { if (tableobj.getColumnClass(i) == String.class) { tableobj.getColumnModel().getColumn(i).setCellRenderer(rightRenderer); @@ -144,7 +144,7 @@ public class ExplosiveControl extends JPanel { try { Drop.insertGWId(MonId, ItemId, Chance); } catch (Exception ee) { - // 显示消息提示框 + JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE); return; } @@ -153,7 +153,7 @@ public class ExplosiveControl extends JPanel { } private void 独立爆率删除配置(ActionEvent e) { - // TODO add your code here + int selectedRow = table2.getSelectedRow(); if (selectedRow != -1) { DefaultTableModel tableModel = (DefaultTableModel) table2.getModel(); @@ -180,7 +180,7 @@ public class ExplosiveControl extends JPanel { try { Drop.insertQQ( ItemId, Chance); } catch (Exception ee) { - // 显示消息提示框 + JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE); return; } @@ -194,45 +194,93 @@ public class ExplosiveControl extends JPanel { DefaultTableModel tableModel = (DefaultTableModel) table1.getModel(); Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0); Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2); - // TODO add your code here + tableModel.removeRow(selectedRow); if(tableModel.getRowCount() > selectedRow)table1.setRowSelectionInterval(selectedRow, selectedRow); } } private void 独立爆率一键导入(ActionEvent e) { - // 创建 JFileChooser 实例 + JFileChooser fileChooser = new JFileChooser(); - // 显示文件选择对话框 + int result = fileChooser.showOpenDialog(null); - // 处理用户的选择 + if (result == JFileChooser.APPROVE_OPTION) { - // 用户选择了文件 + File selectedFile = fileChooser.getSelectedFile(); - System.out.println("选择的文件: " + selectedFile.getAbsolutePath()); - } else if (result == JFileChooser.CANCEL_OPTION) { - + Drop.importDataMob(selectedFile.getAbsolutePath()); } } private void 独立爆率一键导出(ActionEvent e) { - // 创建 JFileChooser 实例 + JFileChooser folderChooser = new JFileChooser(); - // 设置选择模式为只选择文件夹 + folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - // 显示文件夹选择对话框 + + JRadioButton option1 = new JRadioButton("卡片"); + JRadioButton option2 = new JRadioButton("怪物"); + + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(option1); + buttonGroup.add(option2); + + option1.setSelected(true); + + + JPanel optionPanel = new JPanel(); + optionPanel.add(option1); + optionPanel.add(option2); + + + folderChooser.setAccessory(optionPanel); + + int result = folderChooser.showOpenDialog(null); - // 处理用户的选择 + if (result == JFileChooser.APPROVE_OPTION) { - // 用户选择了文件夹 + File selectedFolder = folderChooser.getSelectedFile(); - System.out.println("选择的文件夹: " + selectedFolder.getAbsolutePath()); - } else if (result == JFileChooser.CANCEL_OPTION) { + String selectedMode = option1.isSelected() ? "卡片" : "怪物"; + + Drop.exportData(selectedFolder.getAbsolutePath() + "/独立爆率" + selectedMode + ".txt", selectedMode.equals("卡片") ? Drop.getKPS(): Drop.getMobBLs()); + } + } + private void 全局爆率一键导出(ActionEvent e) { + + JFileChooser folderChooser = new JFileChooser(); + + folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + + int result = folderChooser.showOpenDialog(null); + + + if (result == JFileChooser.APPROVE_OPTION) { + + File selectedFolder = folderChooser.getSelectedFile(); + Drop.exportData(selectedFolder.getAbsolutePath().toString() + "/全局爆率.txt",Drop.getQQS()); + } + } + + private void 全局爆率一键导入(ActionEvent e) { + + JFileChooser fileChooser = new JFileChooser(); + + + int result = fileChooser.showOpenDialog(null); + + + if (result == JFileChooser.APPROVE_OPTION) { + + File selectedFile = fileChooser.getSelectedFile(); + Drop.importDataQQ(selectedFile.getAbsolutePath()); } } @@ -240,7 +288,7 @@ public class ExplosiveControl extends JPanel { private void initComponents() { - // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off + panel1 = new JPanel(); button9 = new JButton(); button10 = new JButton(); @@ -292,28 +340,28 @@ public class ExplosiveControl extends JPanel { label12 = new JLabel(); G_6 = new JTextField(); - //======== this ======== + setLayout(null); - //======== panel1 ======== + { panel1.setBorder(new TitledBorder("\u5371\u9669\u64cd\u4f5c")); panel1.setLayout(null); - //---- button9 ---- + button9.setText("\u4e00\u952e\u6e05\u7a7a\u72ec\u7acb\u7206\u7387\u8868"); button9.addActionListener(e -> 一键清空独立爆率表(e)); panel1.add(button9); button9.setBounds(5, 30, 190, button9.getPreferredSize().height); - //---- button10 ---- + button10.setText("\u4e00\u952e\u6e05\u7a7a\u5168\u5c40\u7206\u7387\u8868"); button10.addActionListener(e -> 一键清空全局爆率表(e)); panel1.add(button10); button10.setBounds(5, 60, 190, button10.getPreferredSize().height); { - // compute preferred size + Dimension preferredSize = new Dimension(); for(int i = 0; i < panel1.getComponentCount(); i++) { Rectangle bounds = panel1.getComponent(i).getBounds(); @@ -330,19 +378,19 @@ public class ExplosiveControl extends JPanel { add(panel1); panel1.setBounds(25, 5, 200, 105); - //======== panel2 ======== + { panel2.setBorder(new TitledBorder("\u602a\u7269\u5361\u7247")); panel2.setLayout(null); - //---- button11 ---- + button11.setText("\u52a0\u8f7d\u5237\u65b0\u602a\u7269\u5361\u7247"); button11.addActionListener(e -> 加载刷新怪物卡片(e)); panel2.add(button11); button11.setBounds(5, 19, 190, button11.getPreferredSize().height); { - // compute preferred size + Dimension preferredSize = new Dimension(); for(int i = 0; i < panel2.getComponentCount(); i++) { Rectangle bounds = panel2.getComponent(i).getBounds(); @@ -359,7 +407,7 @@ public class ExplosiveControl extends JPanel { add(panel2); panel2.setBounds(25, 120, 200, 65); - //======== panel3 ======== + { panel3.setBorder(new TitledBorder("\u5feb\u6377\u6e05\u7406\u6240\u6709\u7206\u7387")); panel3.setLayout(null); @@ -368,30 +416,30 @@ public class ExplosiveControl extends JPanel { panel3.add(物品ID清理); 物品ID清理.setBounds(10, 85, 115, 物品ID清理.getPreferredSize().height); - //---- button13 ---- + button13.setText("\u6e05\u7406"); button13.addActionListener(e -> 根据怪物ID清理(e)); panel3.add(button13); button13.setBounds(130, 35, 58, 25); - //---- button14 ---- + button14.setText("\u6e05\u7406"); button14.addActionListener(e -> 根据物品ID清理(e)); panel3.add(button14); button14.setBounds(130, 85, 58, 25); - //---- label5 ---- + label5.setText("\u6839\u636e\u602a\u7269ID\u6e05\u7406"); panel3.add(label5); label5.setBounds(15, 20, 85, 17); - //---- label6 ---- + label6.setText("\u6839\u636e\u7269\u54c1ID\u6e05\u7406"); panel3.add(label6); label6.setBounds(15, 70, 85, 17); { - // compute preferred size + Dimension preferredSize = new Dimension(); for(int i = 0; i < panel3.getComponentCount(); i++) { Rectangle bounds = panel3.getComponent(i).getBounds(); @@ -408,14 +456,14 @@ public class ExplosiveControl extends JPanel { add(panel3); panel3.setBounds(25, 200, 200, 125); - //======== panel4 ======== + { panel4.setBorder(new TitledBorder("\u5feb\u6377\u67e5\u8be2")); panel4.setLayout(null); panel4.add(物品ID查询掉落); 物品ID查询掉落.setBounds(10, 40, 115, 物品ID查询掉落.getPreferredSize().height); - //---- button15 ---- + button15.setText("\u67e5\u8be2"); button15.addActionListener(e -> button物品ID查询掉落(e)); panel4.add(button15); @@ -423,7 +471,7 @@ public class ExplosiveControl extends JPanel { panel4.add(物品名查询掉落); 物品名查询掉落.setBounds(10, 90, 115, 物品名查询掉落.getPreferredSize().height); - //---- button16 ---- + button16.setText("\u67e5\u8be2"); button16.addActionListener(e -> 物品名查询掉落函数(e)); panel4.add(button16); @@ -431,7 +479,7 @@ public class ExplosiveControl extends JPanel { panel4.add(怪物ID查询掉落); 怪物ID查询掉落.setBounds(10, 140, 115, 怪物ID查询掉落.getPreferredSize().height); - //---- button17 ---- + button17.setText("\u67e5\u8be2"); button17.addActionListener(e -> 怪物ID查询掉落函数(e)); panel4.add(button17); @@ -439,34 +487,34 @@ public class ExplosiveControl extends JPanel { panel4.add(怪物名查询掉落); 怪物名查询掉落.setBounds(10, 190, 115, 怪物名查询掉落.getPreferredSize().height); - //---- button18 ---- + button18.setText("\u67e5\u8be2"); button18.addActionListener(e -> 怪物名查询掉落函数(e)); panel4.add(button18); button18.setBounds(130, 190, 58, 25); - //---- label1 ---- + label1.setText("\u7269\u54c1ID\u67e5\u8be2\u6389\u843d"); panel4.add(label1); label1.setBounds(new Rectangle(new Point(15, 25), label1.getPreferredSize())); - //---- label2 ---- + label2.setText("\u7269\u54c1\u540d\u67e5\u8be2\u6389\u843d"); panel4.add(label2); label2.setBounds(15, 75, 85, 17); - //---- label3 ---- + label3.setText("\u602a\u7269ID\u67e5\u8be2\u6389\u843d"); panel4.add(label3); label3.setBounds(15, 125, 85, 17); - //---- label4 ---- + label4.setText("\u602a\u7269\u540d\u67e5\u8be2\u6389\u843d"); panel4.add(label4); label4.setBounds(15, 175, 85, 17); { - // compute preferred size + Dimension preferredSize = new Dimension(); for(int i = 0; i < panel4.getComponentCount(); i++) { Rectangle bounds = panel4.getComponent(i).getBounds(); @@ -483,15 +531,15 @@ public class ExplosiveControl extends JPanel { add(panel4); panel4.setBounds(25, 340, 200, 235); - //======== panel5 ======== + { panel5.setBorder(new TitledBorder("\u602a\u7269\u72ec\u7acb\u7206\u7387")); panel5.setLayout(new GridLayout()); - //======== scrollPane3 ======== + { - //---- table2 ---- + table2.setModel(new DefaultTableModel( new Object[][] { }, @@ -519,17 +567,15 @@ public class ExplosiveControl extends JPanel { add(panel5); panel5.setBounds(235, 5, 840, 580); - //======== panel6 ======== + { panel6.setBorder(new TitledBorder("\u5168\u5c40\u7206\u7387")); panel6.setLayout(new GridLayout()); - //======== scrollPane1 ======== + { - scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); - //---- table1 ---- + table1.setModel(new DefaultTableModel( new Object[][] { }, @@ -548,119 +594,121 @@ public class ExplosiveControl extends JPanel { { TableColumnModel cm = table1.getColumnModel(); cm.getColumn(0).setMaxWidth(50); - cm.getColumn(1).setMinWidth(180); + cm.getColumn(1).setMinWidth(150); } scrollPane1.setViewportView(table1); } panel6.add(scrollPane1); } add(panel6); - panel6.setBounds(1080, 5, 420, 580); + panel6.setBounds(1080, 5, 410, 580); - //---- button1 ---- + button1.setText("\u65b0\u589e\u914d\u7f6e"); button1.addActionListener(e -> 新增独立爆率配置(e)); add(button1); button1.setBounds(235, 625, 95, button1.getPreferredSize().height); - //---- button2 ---- + button2.setText("\u5220\u9664\u914d\u7f6e"); button2.addActionListener(e -> 独立爆率删除配置(e)); add(button2); button2.setBounds(345, 625, 95, 34); - //---- button5 ---- + button5.setText("\u4e00\u952e\u5bfc\u5165"); button5.addActionListener(e -> 独立爆率一键导入(e)); add(button5); button5.setBounds(455, 625, 95, 34); - //---- button6 ---- + button6.setText("\u4e00\u952e\u5bfc\u51fa"); button6.addActionListener(e -> 独立爆率一键导出(e)); add(button6); button6.setBounds(560, 625, 95, 34); - //---- button3 ---- + button3.setText("\u65b0\u589e\u914d\u7f6e"); button3.addActionListener(e -> 新增全局爆率配置(e)); add(button3); button3.setBounds(1080, 625, 95, 34); - //---- button4 ---- + button4.setText("\u5220\u9664\u914d\u7f6e"); button4.addActionListener(e -> 删除全局爆率配置(e)); add(button4); button4.setBounds(1185, 625, 95, 34); - //---- button7 ---- + button7.setText("\u4e00\u952e\u5bfc\u5165"); + button7.addActionListener(e -> 全局爆率一键导入(e)); add(button7); button7.setBounds(1290, 625, 95, 34); - //---- button8 ---- + button8.setText("\u4e00\u952e\u5bfc\u51fa"); + button8.addActionListener(e -> 全局爆率一键导出(e)); add(button8); button8.setBounds(1395, 625, 95, 34); - //---- button19 ---- + button19.setText("\u5237\u65b0\u602a\u7269\u7206\u7269\u6570\u636e"); button19.addActionListener(e -> 刷新怪物爆物数据(e)); add(button19); button19.setBounds(45, 585, 155, 60); - //---- G_1 ---- + G_1.setToolTipText("\u602a\u7269ID"); add(G_1); G_1.setBounds(280, 590, 100, 30); - //---- G_2 ---- + G_2.setToolTipText("\u7269\u54c1ID"); add(G_2); G_2.setBounds(425, 590, 100, 30); - //---- G_3 ---- + G_3.setToolTipText("\u7206\u7387"); add(G_3); G_3.setBounds(560, 590, 100, 30); - //---- label7 ---- + label7.setText("\u602a\u7269ID"); add(label7); label7.setBounds(new Rectangle(new Point(240, 595), label7.getPreferredSize())); - //---- label8 ---- + label8.setText("\u7269\u54c1ID"); add(label8); label8.setBounds(385, 595, 37, 17); - //---- label9 ---- + label9.setText("\u7206\u7387"); add(label9); label9.setBounds(530, 595, 37, 17); - //---- label11 ---- + label11.setText("\u7269\u54c1ID"); add(label11); label11.setBounds(1085, 595, 37, 17); - //---- G_5 ---- + G_5.setToolTipText("\u7269\u54c1ID"); add(G_5); G_5.setBounds(1125, 590, 100, 30); - //---- label12 ---- + label12.setText("\u7206\u7387"); add(label12); label12.setBounds(1230, 595, 37, 17); - //---- G_6 ---- + G_6.setToolTipText("\u7206\u7387"); add(G_6); G_6.setBounds(1260, 590, 100, 30); { - // compute preferred size + Dimension preferredSize = new Dimension(); for(int i = 0; i < getComponentCount(); i++) { Rectangle bounds = getComponent(i).getBounds(); @@ -673,30 +721,30 @@ public class ExplosiveControl extends JPanel { setMinimumSize(preferredSize); setPreferredSize(preferredSize); } - // JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on + SetRightL(this.table1); SetRightL(this.table2); DefaultTableModel tableModel = (DefaultTableModel) table2.getModel(); - // 创建 TableRowSorter 并关联到 JTable + TableRowSorter sorter = new TableRowSorter<>(tableModel); table2.setRowSorter(sorter); DefaultTableModel tableModel1 = (DefaultTableModel) table1.getModel(); - // 创建 TableRowSorter 并关联到 JTable + TableRowSorter sorter1 = new TableRowSorter<>(tableModel1); table1.setRowSorter(sorter1); - // 为 JTable 添加鼠标监听器 + table2.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { - // 获取点击的行和列 + int row = table2.rowAtPoint(e.getPoint()); if (row >= 0) { - // 获取点击单元格的值 + Object MonId = table2.getValueAt(row, 2); Object ItemId = table2.getValueAt(row, 4); Object Chance = table2.getValueAt(row, 5); @@ -711,11 +759,11 @@ public class ExplosiveControl extends JPanel { table1.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { - // 获取点击的行和列 + int row = table1.rowAtPoint(e.getPoint()); if (row >= 0) { - // 获取点击单元格的值 + Object ItemId = table1.getValueAt(row, 2); Object Chance = table1.getValueAt(row, 3); @@ -726,7 +774,7 @@ public class ExplosiveControl extends JPanel { }); } - // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off + private JPanel panel1; private JButton button9; private JButton button10; @@ -777,5 +825,5 @@ public class ExplosiveControl extends JPanel { private JTextField G_5; private JLabel label12; private JTextField G_6; - // JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on + } diff --git a/src/gui/UI_LenheartUI/ExplosiveControl.jfd b/src/gui/UI_LenheartUI/ExplosiveControl.jfd index db12ac9..1b35cb0 100644 --- a/src/gui/UI_LenheartUI/ExplosiveControl.jfd +++ b/src/gui/UI_LenheartUI/ExplosiveControl.jfd @@ -271,8 +271,6 @@ new FormModel { "border": new javax.swing.border.TitledBorder( "全局爆率" ) add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { name: "scrollPane1" - "horizontalScrollBarPolicy": 31 - "verticalScrollBarPolicy": 21 add( new FormComponent( "javax.swing.JTable" ) { name: "table1" "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { @@ -292,14 +290,14 @@ new FormModel { add( null ) }, new java.util.Vector { add( new com.jformdesigner.model.SwingTableColumn( null, 0, 0, 50, true ) ) - add( new com.jformdesigner.model.SwingTableColumn( null, 0, 180, 0, true ) ) + add( new com.jformdesigner.model.SwingTableColumn( null, 0, 150, 0, true ) ) add( null ) add( null ) } ) } ) } ) }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { - "width": 420 + "width": 410 "height": 580 "x": 1080 "y": 5 @@ -366,6 +364,7 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "button7" "text": "一键导入" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "全局爆率一键导入", true ) ) }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { "width": 95 "height": 34 @@ -375,6 +374,7 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "button8" "text": "一键导出" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "全局爆率一键导出", true ) ) }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { "width": 95 "height": 34 diff --git a/src/gui/tw/Drop.java b/src/gui/tw/Drop.java index f496697..d9c25b5 100644 --- a/src/gui/tw/Drop.java +++ b/src/gui/tw/Drop.java @@ -89,10 +89,6 @@ public class Drop { public static List mobs =null; public static List QQS =null; - /** - * 获得怪物爆率集合 - * @return - */ public static List getMobBLs() { if (mobs != null) { @@ -133,10 +129,7 @@ public class Drop { return mobs; } - /** - * 获得卡片爆率集合 - * @return - */ + public static List getKPS() { List mobBLs = getMobBLs(); List collect = mobBLs.stream() @@ -146,11 +139,7 @@ public class Drop { } - /** - * 根据序号 删除怪物爆率 - * @param id 序号 - * @param dropperid 怪物id - */ + public static void deleteGWId(int id,int dropperid) { try { final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); @@ -169,10 +158,7 @@ public class Drop { .collect(Collectors.toList()); } - /** - * 根据怪物id删除这个怪物的爆率 - * @param dropperid 怪物id - */ + public static void deleteGWdropperid(int dropperid) { try { final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); @@ -192,9 +178,7 @@ public class Drop { .collect(Collectors.toList()); } - /** - * 清空怪物爆率表 - */ + public static void deleteGWAll() { try { final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); @@ -210,13 +194,7 @@ public class Drop { mobs = null; } - /** - * 修改怪物爆率 - * @param dropperid 怪物id - * @param itemid 物品id - * @param chance 爆率 - * @param id 序号 - */ + public static void updateGWId(int dropperid, int itemid, int chance, int id) { try { 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) { try { final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); @@ -281,10 +254,7 @@ public class Drop { mobs =null; } - /** - * 获得全局爆率集合 - * @return - */ + public static List getQQS() { if (QQS!=null){ return QQS; @@ -314,10 +284,7 @@ public class Drop { return QQS; } - /** - * 根据序号 删除全局爆率 - * @param id 序号 - */ + public static void deleteQQId(int id) { try { final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); @@ -338,12 +305,7 @@ public class Drop { .collect(Collectors.toList()); } - /** - * 修改全局爆率 - * @param itemid 物品id - * @param chance 爆率 - * @param id 序号 - */ + public static void updateQQId(int itemid, int chance, int id) { try { 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 ) { try { final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); @@ -400,10 +358,7 @@ public class Drop { MapleMonsterInformationProvider.getInstance().retrieveGlobal(); } - /** - * 批量增加全局爆率 - * @param drops - */ + public static void insertQQALL(List drops) { for (Drop drop : drops) { @@ -433,9 +388,7 @@ public class Drop { MapleMonsterInformationProvider.getInstance().retrieveGlobal(); } - /** - * 删除全局爆率集合 - */ + public static void deleteQJAll() { try { final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection(); @@ -451,9 +404,7 @@ public class Drop { MapleMonsterInformationProvider.getInstance().retrieveGlobal(); QQS = null; } - /** - * 清理道具id爆率 - */ + public static void deleteItemId(int itemId) { try { @@ -491,18 +442,14 @@ public class Drop { .collect(Collectors.toList()); } - /** - * 根据道具id查询掉落 - */ + public static List getItemIdsMob(String itemId) { List mobBLs = getMobBLs(); return mobBLs.stream().filter(drop -> String.valueOf(drop.getItemId()).contains(itemId)) .collect(Collectors.toList()); } - /** - * 根据物品名称查询掉落 - */ + public static List getItemNamesMob(String itemName) { List mobBLs = getMobBLs(); return mobBLs.stream().filter(drop -> String.valueOf(drop.getItenName()).contains(itemName)) @@ -511,48 +458,35 @@ public class Drop { - /** - * 根据道具id查询全局掉落 - */ + public static List getItemIdsQQ(String itemId) { List qqs = getQQS(); return qqs.stream().filter(drop -> String.valueOf(drop.getItemId()).contains(itemId)) .collect(Collectors.toList()); } - /** - * 根据物品名称查询全局掉落 - */ + public static List getItemNamesQQ(String itemName) { List qqs = getQQS(); return qqs.stream().filter(drop -> String.valueOf(drop.getItenName()).contains(itemName)) .collect(Collectors.toList()); } - /** - * 根据怪物id查询掉落 - */ + public static List getMobIdsMob(String MobId) { List mobBLs = getMobBLs(); return mobBLs.stream().filter(drop -> String.valueOf(drop.getDropperid()).contains(MobId)) .collect(Collectors.toList()); } - /** - * 根据物品名称查询掉落 - */ + public static List getMobNames(String MobName) { List mobBLs = getMobBLs(); return mobBLs.stream().filter(drop -> String.valueOf(drop.getDropName()).contains(MobName)) .collect(Collectors.toList()); } - /** - * 排序 - * @param drops 原始集合 - * @param type 1按序号排序 2道具id 3道具名字 4怪物id 5怪物名字 6爆率 - * @return - */ + public static List sort(final List drops,int type) { switch (type){ case 1: @@ -577,9 +511,7 @@ public class Drop { return drops; } - /** - *导出 - */ + public static void exportData (String file,List drops){ JSONObject jsonObject1 = new JSONObject(); jsonObject1.put("bl", drops); @@ -589,13 +521,11 @@ public class Drop { fileWriter.write(jsonString1); } - /** - * 导入全局 - */ + public static void importDataQQ(String file){ FileReader fileReader = new FileReader(file); String result3 = fileReader.readString(); - //转json + JSONObject jsonObject1 = JSONObject.parseObject(result3); List bl = jsonObject1.getJSONArray("bl").toJavaList(Drop.class); @@ -603,13 +533,11 @@ public class Drop { insertQQALL(bl); } - /** - * 导入怪物 - */ + public static void importDataMob(String file){ FileReader fileReader = new FileReader(file); String result3 = fileReader.readString(); - //转json + JSONObject jsonObject1 = JSONObject.parseObject(result3); List bl = jsonObject1.getJSONArray("bl").toJavaList(Drop.class); @@ -625,7 +553,7 @@ public class Drop { importDataQQ("E:\\MXD\\cs.txt"); -// insertGWId(3037,11,11); + } }