Compare commits
No commits in common. "8651c4f874f86f900b9e80f15eaec24ed55b61eb" and "1a888af6c5c57490a2a746c570858bf2da57b759" have entirely different histories.
8651c4f874
...
1a888af6c5
|
|
@ -30,19 +30,6 @@ public class DamageControl extends JPanel {
|
||||||
//数组
|
//数组
|
||||||
String[] T = new String[]{"ddbb","ddzb","ddxs","dbbb","dbzb","dbxs","qgbb","qgzb","qgxs"};
|
String[] T = new String[]{"ddbb","ddzb","ddxs","dbbb","dbzb","dbxs","qgbb","qgzb","qgxs"};
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DamageControl() {
|
public DamageControl() {
|
||||||
Config = Start.ConfigValuesJson;
|
Config = Start.ConfigValuesJson;
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
@ -57,7 +44,6 @@ public class DamageControl extends JPanel {
|
||||||
|
|
||||||
//设置属性
|
//设置属性
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
SetRightL(Tables[i]);
|
|
||||||
settableui(i,T[i]);
|
settableui(i,T[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +54,7 @@ public class DamageControl extends JPanel {
|
||||||
// 使用 entrySet() 遍历键值对
|
// 使用 entrySet() 遍历键值对
|
||||||
for (Map.Entry<String, Object> entry : JsonBuffer.entrySet()) {
|
for (Map.Entry<String, Object> entry : JsonBuffer.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
String value = entry.getValue().toString();
|
Integer value = (int)entry.getValue();
|
||||||
DefaultTableModel tableModel = (DefaultTableModel) Tables[Index].getModel();
|
DefaultTableModel tableModel = (DefaultTableModel) Tables[Index].getModel();
|
||||||
Object[] rowData = {Integer.valueOf(key), value};
|
Object[] rowData = {Integer.valueOf(key), value};
|
||||||
tableModel.addRow(rowData);
|
tableModel.addRow(rowData);
|
||||||
|
|
@ -98,7 +84,7 @@ public class DamageControl extends JPanel {
|
||||||
|
|
||||||
for (int i = 0; i < rowCount; i++) {
|
for (int i = 0; i < rowCount; i++) {
|
||||||
String Key = tableModel.getValueAt(i, 0).toString();
|
String Key = tableModel.getValueAt(i, 0).toString();
|
||||||
String Value = tableModel.getValueAt(i, 1).toString();
|
Integer Value = (int) tableModel.getValueAt(i, 1);
|
||||||
Buffer.put(Key,Value);
|
Buffer.put(Key,Value);
|
||||||
}
|
}
|
||||||
Config.put(TableName, Buffer);
|
Config.put(TableName, Buffer);
|
||||||
|
|
@ -272,7 +258,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
@ -296,7 +282,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
@ -320,7 +306,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
@ -344,7 +330,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
@ -368,7 +354,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
@ -392,7 +378,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
@ -416,7 +402,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
@ -440,7 +426,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
@ -464,7 +450,7 @@ public class DamageControl extends JPanel {
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class<?>[] columnTypes = new Class<?>[] {
|
Class<?>[] columnTypes = new Class<?>[] {
|
||||||
Integer.class, String.class
|
Integer.class, Integer.class
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex) {
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ new FormModel {
|
||||||
add( "段数" )
|
add( "段数" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
@ -39,7 +39,7 @@ new FormModel {
|
||||||
add( "段数" )
|
add( "段数" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
@ -63,7 +63,7 @@ new FormModel {
|
||||||
add( "系数" )
|
add( "系数" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
@ -87,7 +87,7 @@ new FormModel {
|
||||||
add( "倍数" )
|
add( "倍数" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
@ -111,7 +111,7 @@ new FormModel {
|
||||||
add( "倍数" )
|
add( "倍数" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
@ -135,7 +135,7 @@ new FormModel {
|
||||||
add( "系数" )
|
add( "系数" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
@ -159,7 +159,7 @@ new FormModel {
|
||||||
add( "伤害" )
|
add( "伤害" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
@ -183,7 +183,7 @@ new FormModel {
|
||||||
add( "伤害" )
|
add( "伤害" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
@ -207,7 +207,7 @@ new FormModel {
|
||||||
add( "系数" )
|
add( "系数" )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( class java.lang.Integer )
|
add( class java.lang.Integer )
|
||||||
add( class java.lang.String )
|
add( class java.lang.Integer )
|
||||||
}, new java.util.Vector {
|
}, new java.util.Vector {
|
||||||
add( null )
|
add( null )
|
||||||
add( null )
|
add( null )
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,25 @@ package gui.UI_LenheartUI;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.io.File;
|
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 java.util.List;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.*;
|
import javax.swing.border.*;
|
||||||
import javax.swing.event.MouseInputAdapter;
|
import javax.swing.event.MouseInputAdapter;
|
||||||
import javax.swing.table.*;
|
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 gui.tw.Drop;
|
||||||
|
import info.clearthought.layout.*;
|
||||||
|
import net.miginfocom.swing.*;
|
||||||
|
import server.MapleItemInformationProvider;
|
||||||
|
import server.life.MapleLifeFactory;
|
||||||
|
import tools.FileoutputUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dongj
|
* @author dongj
|
||||||
|
|
@ -75,35 +85,23 @@ public class ExplosiveControl extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 一键清空独立爆率表(ActionEvent e) {
|
private void 一键清空独立爆率表(ActionEvent e) {
|
||||||
// 检查 Shift 键是否被按下
|
Drop.deleteGWAll();
|
||||||
boolean isShiftPressed = (e.getModifiers() & InputEvent.CTRL_MASK) != 0;
|
ClearTable(table2);
|
||||||
if(isShiftPressed){
|
|
||||||
Drop.deleteGWAll();
|
|
||||||
ClearTable(table2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 一键清空全局爆率表(ActionEvent e) {
|
private void 一键清空全局爆率表(ActionEvent e) {
|
||||||
// 检查 Shift 键是否被按下
|
Drop.deleteQJAll();
|
||||||
boolean isShiftPressed = (e.getModifiers() & InputEvent.CTRL_MASK) != 0;
|
ClearTable(table1);
|
||||||
if(isShiftPressed){
|
|
||||||
Drop.deleteQJAll();
|
|
||||||
ClearTable(table1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button物品ID查询掉落(ActionEvent e) {
|
private void button物品ID查询掉落(ActionEvent e) {
|
||||||
ClearTable(table2);
|
ClearTable(table2);
|
||||||
WriteTable2(Drop.getItemIdsMob(this.物品ID查询掉落.getText()));
|
WriteTable2(Drop.getItemIdsMob(this.物品ID查询掉落.getText()));
|
||||||
ClearTable(table1);
|
|
||||||
WriteTable1(Drop.getItemIdsQQ(this.物品ID查询掉落.getText()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 物品名查询掉落函数(ActionEvent e) {
|
private void 物品名查询掉落函数(ActionEvent e) {
|
||||||
ClearTable(table2);
|
ClearTable(table2);
|
||||||
WriteTable2(Drop.getItemNamesMob(this.物品名查询掉落.getText()));
|
WriteTable2(Drop.getItemNamesMob(this.物品名查询掉落.getText()));
|
||||||
ClearTable(table1);
|
|
||||||
WriteTable1(Drop.getItemNamesQQ(this.物品名查询掉落.getText()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 怪物ID查询掉落函数(ActionEvent e) {
|
private void 怪物ID查询掉落函数(ActionEvent e) {
|
||||||
|
|
@ -130,169 +128,75 @@ public class ExplosiveControl extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 新增独立爆率配置(ActionEvent e) {
|
private void 新增独立爆率配置(ActionEvent e) {
|
||||||
// 检查 Shift 键是否被按下
|
Integer MonId;
|
||||||
boolean isShiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0;
|
Integer ItemId;
|
||||||
|
Integer Chance;
|
||||||
if (isShiftPressed) {
|
try {
|
||||||
// 按住 Shift 键,弹出输入框让用户输入批量数据
|
MonId = Integer.valueOf(this.G_1.getText());
|
||||||
String input = showMultiLineInputDialog();
|
ItemId = Integer.valueOf(this.G_2.getText());
|
||||||
if (input != null && !input.isEmpty()) {
|
Chance = Integer.valueOf(this.G_3.getText());
|
||||||
// 分割输入的文本
|
} catch (Exception ex) {
|
||||||
String[] pairs = input.split("\n");
|
JOptionPane.showMessageDialog(null, "新增失败!检查是否填写了全部参数", "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||||
for (String pair : pairs) {
|
return;
|
||||||
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;
|
|
||||||
try {
|
|
||||||
MonId = Integer.valueOf(this.G_1.getText());
|
|
||||||
ItemId = Integer.valueOf(this.G_2.getText());
|
|
||||||
Chance = Integer.valueOf(this.G_3.getText());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
JOptionPane.showMessageDialog(null, "新增失败!检查是否填写了全部参数", "提示", JOptionPane.INFORMATION_MESSAGE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
Drop.insertGWId(MonId, ItemId, Chance);
|
|
||||||
} catch (Exception ee) {
|
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
刷新怪物爆物数据(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Drop.insertGWId(MonId, ItemId, Chance);
|
||||||
|
} catch (Exception ee) {
|
||||||
|
|
||||||
|
JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
刷新怪物爆物数据(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 独立爆率删除配置(ActionEvent e) {
|
private void 独立爆率删除配置(ActionEvent e) {
|
||||||
int[] selectedRows = table2.getSelectedRows();
|
|
||||||
if (selectedRows.length > 0) {
|
int selectedRow = table2.getSelectedRow();
|
||||||
|
if (selectedRow != -1) {
|
||||||
DefaultTableModel tableModel = (DefaultTableModel) table2.getModel();
|
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--) {
|
Drop.deleteGWId(Ids,MonId);
|
||||||
int selectedRow = selectedRows[i];
|
tableModel.removeRow(selectedRow);
|
||||||
// 将视图中的行索引转换为 TableModel 中的实际行索引
|
if(tableModel.getRowCount() > selectedRow)table2.setRowSelectionInterval(selectedRow, selectedRow);
|
||||||
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(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) {
|
private void 新增全局爆率配置(ActionEvent e) {
|
||||||
// 检查 Shift 键是否被按下
|
Integer ItemId;
|
||||||
boolean isShiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0;
|
Integer Chance;
|
||||||
|
try {
|
||||||
if (isShiftPressed) {
|
ItemId = Integer.valueOf(this.G_5.getText());
|
||||||
// 按住 Shift 键,弹出输入框让用户输入批量数据
|
Chance = Integer.valueOf(this.G_6.getText());
|
||||||
String input = showMultiLineInputDialog();
|
} catch (Exception ex) {
|
||||||
if (input != null && !input.isEmpty()) {
|
JOptionPane.showMessageDialog(null, "新增失败!检查是否填写了全部参数", "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||||
// 分割输入的文本
|
return;
|
||||||
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(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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Drop.insertQQ( ItemId, Chance);
|
||||||
|
} catch (Exception ee) {
|
||||||
|
|
||||||
|
JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
刷新怪物爆物数据(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 删除全局爆率配置(ActionEvent e) {
|
private void 删除全局爆率配置(ActionEvent e) {
|
||||||
int[] selectedRows = table1.getSelectedRows();
|
int selectedRow = table1.getSelectedRow();
|
||||||
if (selectedRows.length > 0) {
|
if (selectedRow != -1) {
|
||||||
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
||||||
for (int i = selectedRows.length - 1; i >= 0; i--) {
|
Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0);
|
||||||
int selectedRow = selectedRows[i];
|
Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2);
|
||||||
int modelRow = table1.convertRowIndexToModel(selectedRow);
|
|
||||||
Integer Ids = (Integer) tableModel.getValueAt(modelRow, 0);
|
tableModel.removeRow(selectedRow);
|
||||||
Drop.deleteQQId(Ids);
|
if(tableModel.getRowCount() > selectedRow)table1.setRowSelectionInterval(selectedRow, selectedRow);
|
||||||
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"
|
name: "this"
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jformdesigner.runtime.NullLayout ) ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jformdesigner.runtime.NullLayout ) ) {
|
||||||
name: "panel1"
|
name: "panel1"
|
||||||
"border": new javax.swing.border.TitledBorder( "危险操作 - 按住Ctrl点击生效" )
|
"border": new javax.swing.border.TitledBorder( "危险操作" )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "button9"
|
name: "button9"
|
||||||
"text": "一键清空独立爆率表"
|
"text": "一键清空独立爆率表"
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ public class FightControl extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 保存配置(ActionEvent e) {
|
private void 保存配置(ActionEvent e) {
|
||||||
Start.zlkg = this.toggleButton3.isSelected() ? 1 : 0;
|
|
||||||
|
|
||||||
List<ZLConfig> Buf = new ArrayList<>();
|
List<ZLConfig> Buf = new ArrayList<>();
|
||||||
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
||||||
|
|
@ -59,16 +58,9 @@ public class FightControl extends JPanel {
|
||||||
Buf.add(buffer);
|
Buf.add(buffer);
|
||||||
}
|
}
|
||||||
Start.zlConfigs = Buf;
|
Start.zlConfigs = Buf;
|
||||||
|
|
||||||
String[] originalArray = this.textArea1.getText().split(","); // 按逗号切割成数组
|
|
||||||
Start.shxs = originalArray;
|
|
||||||
特殊控制台.setTwConfig();
|
特殊控制台.setTwConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 战力开关(ActionEvent e) {
|
|
||||||
// TODO add your code here
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
||||||
scrollPane1 = new JScrollPane();
|
scrollPane1 = new JScrollPane();
|
||||||
|
|
@ -76,11 +68,6 @@ public class FightControl extends JPanel {
|
||||||
button21 = new JButton();
|
button21 = new JButton();
|
||||||
button19 = new JButton();
|
button19 = new JButton();
|
||||||
button25 = new JButton();
|
button25 = new JButton();
|
||||||
toggleButton3 = new JToggleButton();
|
|
||||||
label3 = new JLabel();
|
|
||||||
label1 = new JLabel();
|
|
||||||
scrollPane2 = new JScrollPane();
|
|
||||||
textArea1 = new JTextArea();
|
|
||||||
|
|
||||||
//======== this ========
|
//======== this ========
|
||||||
setLayout(null);
|
setLayout(null);
|
||||||
|
|
@ -113,48 +100,19 @@ public class FightControl extends JPanel {
|
||||||
button21.setText("\u5220\u9664\u914d\u7f6e");
|
button21.setText("\u5220\u9664\u914d\u7f6e");
|
||||||
button21.addActionListener(e -> 删除配置(e));
|
button21.addActionListener(e -> 删除配置(e));
|
||||||
add(button21);
|
add(button21);
|
||||||
button21.setBounds(375, 615, 100, 35);
|
button21.setBounds(375, 620, 100, 35);
|
||||||
|
|
||||||
//---- button19 ----
|
//---- button19 ----
|
||||||
button19.setText("\u4fdd\u5b58\u914d\u7f6e");
|
button19.setText("\u4fdd\u5b58\u914d\u7f6e");
|
||||||
button19.addActionListener(e -> 保存配置(e));
|
button19.addActionListener(e -> 保存配置(e));
|
||||||
add(button19);
|
add(button19);
|
||||||
button19.setBounds(525, 615, 100, 35);
|
button19.setBounds(20, 620, 100, 35);
|
||||||
|
|
||||||
//---- button25 ----
|
//---- button25 ----
|
||||||
button25.setText("\u65b0\u589e\u914d\u7f6e");
|
button25.setText("\u65b0\u589e\u914d\u7f6e");
|
||||||
button25.addActionListener(e -> 新增配置(e));
|
button25.addActionListener(e -> 新增配置(e));
|
||||||
add(button25);
|
add(button25);
|
||||||
button25.setBounds(270, 615, 100, 35);
|
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(20, 615, 100, 35);
|
|
||||||
|
|
||||||
//---- label3 ----
|
|
||||||
label3.setText("\u6218\u529b\u5f00\u5173");
|
|
||||||
add(label3);
|
|
||||||
label3.setBounds(125, 620, 185, 30);
|
|
||||||
|
|
||||||
//---- label1 ----
|
|
||||||
label1.setText("\u4f24\u5bb3\u663e\u793a\u5355\u4f4d");
|
|
||||||
add(label1);
|
|
||||||
label1.setBounds(new Rectangle(new Point(490, 10), label1.getPreferredSize()));
|
|
||||||
|
|
||||||
//======== scrollPane2 ========
|
|
||||||
{
|
|
||||||
|
|
||||||
//---- textArea1 ----
|
|
||||||
textArea1.setLineWrap(true);
|
|
||||||
scrollPane2.setViewportView(textArea1);
|
|
||||||
}
|
|
||||||
add(scrollPane2);
|
|
||||||
scrollPane2.setBounds(490, 35, 940, 110);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// compute preferred size
|
// compute preferred size
|
||||||
|
|
@ -172,9 +130,6 @@ public class FightControl extends JPanel {
|
||||||
}
|
}
|
||||||
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
|
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
|
||||||
|
|
||||||
|
|
||||||
this.toggleButton3.setSelected(Start.zlkg == 1 ? true : false);
|
|
||||||
|
|
||||||
DefaultTableModel tableModel = (DefaultTableModel)this.table1.getModel();
|
DefaultTableModel tableModel = (DefaultTableModel)this.table1.getModel();
|
||||||
// 创建一个自定义的单元格渲染器,用于右对齐字符串
|
// 创建一个自定义的单元格渲染器,用于右对齐字符串
|
||||||
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
|
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
|
||||||
|
|
@ -194,15 +149,6 @@ public class FightControl extends JPanel {
|
||||||
Object[] rowData = {Count, NameFront ,NameBack};
|
Object[] rowData = {Count, NameFront ,NameBack};
|
||||||
tableModel.addRow(rowData);
|
tableModel.addRow(rowData);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
String XB = "";
|
|
||||||
for (String shx : Start.shxs) {
|
|
||||||
XB += shx;
|
|
||||||
XB += ",";
|
|
||||||
}
|
|
||||||
XB = XB.substring(0, XB.length() - 1);
|
|
||||||
this.textArea1.setText(XB);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
|
||||||
|
|
@ -211,10 +157,5 @@ public class FightControl extends JPanel {
|
||||||
private JButton button21;
|
private JButton button21;
|
||||||
private JButton button19;
|
private JButton button19;
|
||||||
private JButton button25;
|
private JButton button25;
|
||||||
private JToggleButton toggleButton3;
|
|
||||||
private JLabel label3;
|
|
||||||
private JLabel label1;
|
|
||||||
private JScrollPane scrollPane2;
|
|
||||||
private JTextArea textArea1;
|
|
||||||
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ new FormModel {
|
||||||
"width": 100
|
"width": 100
|
||||||
"height": 35
|
"height": 35
|
||||||
"x": 375
|
"x": 375
|
||||||
"y": 615
|
"y": 620
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "button19"
|
name: "button19"
|
||||||
|
|
@ -49,8 +49,8 @@ new FormModel {
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
||||||
"width": 100
|
"width": 100
|
||||||
"height": 35
|
"height": 35
|
||||||
"x": 525
|
"x": 20
|
||||||
"y": 615
|
"y": 620
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "button25"
|
name: "button25"
|
||||||
|
|
@ -60,49 +60,8 @@ new FormModel {
|
||||||
"width": 100
|
"width": 100
|
||||||
"height": 35
|
"height": 35
|
||||||
"x": 270
|
"x": 270
|
||||||
"y": 615
|
|
||||||
} )
|
|
||||||
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": 20
|
|
||||||
"y": 615
|
|
||||||
} )
|
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
|
||||||
name: "label3"
|
|
||||||
"text": "战力开关"
|
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
|
||||||
"width": 185
|
|
||||||
"height": 30
|
|
||||||
"x": 125
|
|
||||||
"y": 620
|
"y": 620
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
|
||||||
name: "label1"
|
|
||||||
"text": "伤害显示单位"
|
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
|
||||||
"x": 490
|
|
||||||
"y": 10
|
|
||||||
} )
|
|
||||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
|
||||||
name: "scrollPane2"
|
|
||||||
add( new FormComponent( "javax.swing.JTextArea" ) {
|
|
||||||
name: "textArea1"
|
|
||||||
"lineWrap": true
|
|
||||||
} )
|
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
|
||||||
"x": 490
|
|
||||||
"y": 35
|
|
||||||
"width": 940
|
|
||||||
"height": 110
|
|
||||||
} )
|
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 0 )
|
"location": new java.awt.Point( 0, 0 )
|
||||||
"size": new java.awt.Dimension( 1570, 670 )
|
"size": new java.awt.Dimension( 1570, 670 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue