no message
This commit is contained in:
parent
f9c37bb84e
commit
bbbc06bb79
|
|
@ -7,25 +7,15 @@ package gui.UI_LenheartUI;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import java.util.List;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import javax.swing.event.MouseInputAdapter;
|
||||
import javax.swing.table.*;
|
||||
import com.intellij.uiDesigner.core.*;
|
||||
import com.jgoodies.forms.factories.*;
|
||||
import com.jgoodies.forms.layout.*;
|
||||
import database.DBConPool;
|
||||
|
||||
import gui.tw.Drop;
|
||||
import info.clearthought.layout.*;
|
||||
import net.miginfocom.swing.*;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.life.MapleLifeFactory;
|
||||
import tools.FileoutputUtil;
|
||||
|
||||
|
||||
/**
|
||||
* @author dongj
|
||||
|
|
@ -85,23 +75,35 @@ public class ExplosiveControl extends JPanel {
|
|||
}
|
||||
|
||||
private void 一键清空独立爆率表(ActionEvent e) {
|
||||
// 检查 Shift 键是否被按下
|
||||
boolean isShiftPressed = (e.getModifiers() & InputEvent.CTRL_MASK) != 0;
|
||||
if(isShiftPressed){
|
||||
Drop.deleteGWAll();
|
||||
ClearTable(table2);
|
||||
}
|
||||
}
|
||||
|
||||
private void 一键清空全局爆率表(ActionEvent e) {
|
||||
// 检查 Shift 键是否被按下
|
||||
boolean isShiftPressed = (e.getModifiers() & InputEvent.CTRL_MASK) != 0;
|
||||
if(isShiftPressed){
|
||||
Drop.deleteQJAll();
|
||||
ClearTable(table1);
|
||||
}
|
||||
}
|
||||
|
||||
private void button物品ID查询掉落(ActionEvent e) {
|
||||
ClearTable(table2);
|
||||
WriteTable2(Drop.getItemIdsMob(this.物品ID查询掉落.getText()));
|
||||
ClearTable(table1);
|
||||
WriteTable1(Drop.getItemIdsQQ(this.物品ID查询掉落.getText()));
|
||||
}
|
||||
|
||||
private void 物品名查询掉落函数(ActionEvent e) {
|
||||
ClearTable(table2);
|
||||
WriteTable2(Drop.getItemNamesMob(this.物品名查询掉落.getText()));
|
||||
ClearTable(table1);
|
||||
WriteTable1(Drop.getItemNamesQQ(this.物品名查询掉落.getText()));
|
||||
}
|
||||
|
||||
private void 怪物ID查询掉落函数(ActionEvent e) {
|
||||
|
|
@ -128,6 +130,36 @@ public class ExplosiveControl extends JPanel {
|
|||
}
|
||||
|
||||
private void 新增独立爆率配置(ActionEvent e) {
|
||||
// 检查 Shift 键是否被按下
|
||||
boolean isShiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0;
|
||||
|
||||
if (isShiftPressed) {
|
||||
// 按住 Shift 键,弹出输入框让用户输入批量数据
|
||||
String input = showMultiLineInputDialog();
|
||||
if (input != null && !input.isEmpty()) {
|
||||
// 分割输入的文本
|
||||
String[] pairs = input.split("\n");
|
||||
for (String pair : pairs) {
|
||||
String[] values = pair.split(",");
|
||||
if (values.length == 3) {
|
||||
try {
|
||||
Integer MonId = Integer.valueOf(values[0].trim());
|
||||
Integer itemId = Integer.valueOf(values[1].trim());
|
||||
Integer chance = Integer.valueOf(values[2].trim());
|
||||
Drop.insertGWId(MonId, itemId, chance);
|
||||
} catch (NumberFormatException ex) {
|
||||
JOptionPane.showMessageDialog(null, "批量添加失败!部分数据格式有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(null, "批量添加失败!检查怪物ID和物品ID是否有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "批量添加失败!数据格式有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
// 刷新怪物爆物数据
|
||||
刷新怪物爆物数据(null);
|
||||
}
|
||||
} else {
|
||||
Integer MonId;
|
||||
Integer ItemId;
|
||||
Integer Chance;
|
||||
|
|
@ -151,52 +183,116 @@ public class ExplosiveControl extends JPanel {
|
|||
|
||||
刷新怪物爆物数据(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void 独立爆率删除配置(ActionEvent e) {
|
||||
|
||||
int selectedRow = table2.getSelectedRow();
|
||||
if (selectedRow != -1) {
|
||||
int[] selectedRows = table2.getSelectedRows();
|
||||
if (selectedRows.length > 0) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel) table2.getModel();
|
||||
Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0);
|
||||
Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2);
|
||||
|
||||
// 由于删除行后索引会改变,为了避免索引混乱,从后往前删除
|
||||
for (int i = selectedRows.length - 1; i >= 0; i--) {
|
||||
int selectedRow = selectedRows[i];
|
||||
// 将视图中的行索引转换为 TableModel 中的实际行索引
|
||||
int modelRow = table2.convertRowIndexToModel(selectedRow);
|
||||
|
||||
Integer Ids = (Integer) tableModel.getValueAt(modelRow, 0);
|
||||
Integer MonId = (Integer) tableModel.getValueAt(modelRow, 2);
|
||||
|
||||
Drop.deleteGWId(Ids, MonId);
|
||||
tableModel.removeRow(selectedRow);
|
||||
if(tableModel.getRowCount() > selectedRow)table2.setRowSelectionInterval(selectedRow, selectedRow);
|
||||
tableModel.removeRow(modelRow);
|
||||
}
|
||||
if (tableModel.getRowCount() > 0) {
|
||||
int newSelectedRow = Math.min(selectedRows[0], tableModel.getRowCount() - 1);
|
||||
table2.setRowSelectionInterval(newSelectedRow, newSelectedRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String showMultiLineInputDialog() {
|
||||
JTextArea textArea = new JTextArea(15, 40);
|
||||
textArea.setLineWrap(true);
|
||||
textArea.setWrapStyleWord(true);
|
||||
|
||||
int option = JOptionPane.showConfirmDialog(
|
||||
null,
|
||||
new JScrollPane(textArea),
|
||||
"批量添加",
|
||||
JOptionPane.OK_CANCEL_OPTION,
|
||||
JOptionPane.PLAIN_MESSAGE
|
||||
);
|
||||
|
||||
return (option == JOptionPane.OK_OPTION) ? textArea.getText().trim() : null;
|
||||
}
|
||||
|
||||
private void 新增全局爆率配置(ActionEvent e) {
|
||||
// 检查 Shift 键是否被按下
|
||||
boolean isShiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0;
|
||||
|
||||
if (isShiftPressed) {
|
||||
// 按住 Shift 键,弹出输入框让用户输入批量数据
|
||||
String input = showMultiLineInputDialog();
|
||||
if (input != null && !input.isEmpty()) {
|
||||
// 分割输入的文本
|
||||
String[] pairs = input.split("\n");
|
||||
for (String pair : pairs) {
|
||||
String[] values = pair.split(",");
|
||||
if (values.length == 2) {
|
||||
try {
|
||||
Integer itemId = Integer.valueOf(values[0].trim());
|
||||
Integer chance = Integer.valueOf(values[1].trim());
|
||||
Drop.insertQQ(itemId, chance);
|
||||
} catch (NumberFormatException ex) {
|
||||
JOptionPane.showMessageDialog(null, "批量添加失败!部分数据格式有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(null, "批量添加失败!检查怪物ID和物品ID是否有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "批量添加失败!数据格式有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
// 刷新怪物爆物数据
|
||||
刷新怪物爆物数据(null);
|
||||
}
|
||||
} else {
|
||||
// 正常点击,执行单条数据添加逻辑
|
||||
Integer ItemId;
|
||||
Integer Chance;
|
||||
try {
|
||||
ItemId = Integer.valueOf(this.G_5.getText());
|
||||
Chance = Integer.valueOf(this.G_6.getText());
|
||||
ItemId = Integer.valueOf(G_5.getText());
|
||||
Chance = Integer.valueOf(G_6.getText());
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(null, "新增失败!检查是否填写了全部参数", "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Drop.insertQQ(ItemId, Chance);
|
||||
} catch (Exception ee) {
|
||||
|
||||
JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
// 刷新怪物爆物数据
|
||||
刷新怪物爆物数据(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void 删除全局爆率配置(ActionEvent e) {
|
||||
int selectedRow = table1.getSelectedRow();
|
||||
if (selectedRow != -1) {
|
||||
int[] selectedRows = table1.getSelectedRows();
|
||||
if (selectedRows.length > 0) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
||||
Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0);
|
||||
Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2);
|
||||
|
||||
tableModel.removeRow(selectedRow);
|
||||
if(tableModel.getRowCount() > selectedRow)table1.setRowSelectionInterval(selectedRow, selectedRow);
|
||||
for (int i = selectedRows.length - 1; i >= 0; i--) {
|
||||
int selectedRow = selectedRows[i];
|
||||
int modelRow = table1.convertRowIndexToModel(selectedRow);
|
||||
Integer Ids = (Integer) tableModel.getValueAt(modelRow, 0);
|
||||
Drop.deleteQQId(Ids);
|
||||
tableModel.removeRow(modelRow);
|
||||
}
|
||||
if (tableModel.getRowCount() > 0) {
|
||||
int newSelectedRow = Math.min(selectedRows[0], tableModel.getRowCount() - 1);
|
||||
table1.setRowSelectionInterval(newSelectedRow, newSelectedRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ new FormModel {
|
|||
name: "this"
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jformdesigner.runtime.NullLayout ) ) {
|
||||
name: "panel1"
|
||||
"border": new javax.swing.border.TitledBorder( "危险操作" )
|
||||
"border": new javax.swing.border.TitledBorder( "危险操作 - 按住Ctrl点击生效" )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button9"
|
||||
"text": "一键清空独立爆率表"
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class FightControl extends JPanel {
|
|||
}
|
||||
|
||||
private void 保存配置(ActionEvent e) {
|
||||
// Start. = this.toggleButton3.isSelected() ? 1 : 0;
|
||||
|
||||
List<ZLConfig> Buf = new ArrayList<>();
|
||||
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
||||
|
|
@ -61,6 +62,10 @@ public class FightControl extends JPanel {
|
|||
特殊控制台.setTwConfig();
|
||||
}
|
||||
|
||||
private void 战力开关(ActionEvent e) {
|
||||
// TODO add your code here
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
||||
scrollPane1 = new JScrollPane();
|
||||
|
|
@ -68,6 +73,8 @@ public class FightControl extends JPanel {
|
|||
button21 = new JButton();
|
||||
button19 = new JButton();
|
||||
button25 = new JButton();
|
||||
toggleButton3 = new JToggleButton();
|
||||
label3 = new JLabel();
|
||||
|
||||
//======== this ========
|
||||
setLayout(null);
|
||||
|
|
@ -114,6 +121,20 @@ public class FightControl extends JPanel {
|
|||
add(button25);
|
||||
button25.setBounds(270, 620, 100, 35);
|
||||
|
||||
//---- toggleButton3 ----
|
||||
toggleButton3.setIcon(new ImageIcon(getClass().getResource("/image/OFF3.png")));
|
||||
toggleButton3.setSelectedIcon(new ImageIcon(getClass().getResource("/image/ON3.png")));
|
||||
toggleButton3.setFocusPainted(false);
|
||||
toggleButton3.setContentAreaFilled(false);
|
||||
toggleButton3.addActionListener(e -> 战力开关(e));
|
||||
add(toggleButton3);
|
||||
toggleButton3.setBounds(485, 10, 100, 35);
|
||||
|
||||
//---- label3 ----
|
||||
label3.setText("\u6218\u529b\u5f00\u5173");
|
||||
add(label3);
|
||||
label3.setBounds(590, 15, 185, 30);
|
||||
|
||||
{
|
||||
// compute preferred size
|
||||
Dimension preferredSize = new Dimension();
|
||||
|
|
@ -157,5 +178,7 @@ public class FightControl extends JPanel {
|
|||
private JButton button21;
|
||||
private JButton button19;
|
||||
private JButton button25;
|
||||
private JToggleButton toggleButton3;
|
||||
private JLabel label3;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,28 @@ new FormModel {
|
|||
"x": 270
|
||||
"y": 620
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "toggleButton3"
|
||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/image/OFF3.png" )
|
||||
"selectedIcon": new com.jformdesigner.model.SwingIcon( 0, "/image/ON3.png" )
|
||||
"focusPainted": false
|
||||
"contentAreaFilled": false
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "战力开关", true ) )
|
||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
||||
"width": 100
|
||||
"height": 35
|
||||
"x": 485
|
||||
"y": 10
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label3"
|
||||
"text": "战力开关"
|
||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
||||
"width": 185
|
||||
"height": 30
|
||||
"x": 590
|
||||
"y": 15
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 1570, 670 )
|
||||
|
|
|
|||
Loading…
Reference in New Issue