package server;
import client.MapleCharacter;
import constants.ServerConstants;
import constants.WorldConstants;
import database.DatabaseConnection;
import handling.CashShopOpcode;
import handling.InteractionOpcode;
import handling.RecvPacketOpcode;
import handling.SendPacketOpcode;
import handling.channel.ChannelServer;
import handling.world.WorldBroadcastService;
import java.awt.HeadlessException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import scripting.portal.PortalScriptManager;
import scripting.reactor.ReactorScriptManager;
import server.shop.MapleShopFactory;
import tools.FileoutputUtil;
import tools.MaplePacketCreator;
import tools.Pair;
import tools.packet.NPCPacket;
/**
*
* @author Fairyms
*/
public class ManagerSin extends javax.swing.JFrame {
public static int exp[] = new int[20];
public static int meso[] = new int[20];
public static int drop[] = new int[20];
//public int wid[] = new int[20];
/**
* Creates new form ManagerSin
*/
public ManagerSin() {
Connection con = DatabaseConnection.getConnection();
try {
try (PreparedStatement ps = con.prepareStatement("SELECT * FROM accounts");
ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
initInformation(rs);
}
rs.close();
ps.close();
}
} catch (SQLException ex) {
FileoutputUtil.log("Failed to load npc name data. " + ex);
}
initComponents();
setData();
setworld();
}
public int exp(int w) {
int i;
for (i = 0; i < wid.getItemCount(); i++) {
int ttt = Integer.parseInt(String.valueOf(wid.getItemAt(i)));
if (w == ttt) {
//FileoutputUtil.log("经验倍率:"+ exp[i]+" " + ttt );
break;
}
}
return exp[i];
}
public int meso(int w) {
int i;
for (i = 0; i < wid.getItemCount(); i++) {
int ttt = Integer.parseInt(String.valueOf(wid.getItemAt(i)));
if (w == ttt) {
//FileoutputUtil.log("金币爆率:"+ meso[i]+" " + ttt );
break;
}
}
return meso[i];
}
public int drop(int w) {
int i;
for (i = 0; i < wid.getItemCount(); i++) {
int ttt = Integer.parseInt(String.valueOf(wid.getItemAt(i)));
if (w == ttt) {
//FileoutputUtil.log("物品爆率:"+ drop[i]+" " + ttt );
break;
}
}
return drop[i];
}
public void initInformation(ResultSet sqlItemData) throws SQLException {
/*this.id = sqlItemData.getInt("id");
this.name = sqlItemData.getInt("name");
this.pasw = sqlItemData.getString("password");
this.nxCredit = sqlItemData.getString("nxCredit");
this.loggedin = sqlItemData.getString("loggedin");*/
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767));
jLabel14 = new javax.swing.JLabel();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jButton4 = new javax.swing.JButton();
exprate = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jButton7 = new javax.swing.JButton();
mesorate = new javax.swing.JTextField();
jLabel15 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
servermessage = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jLabel11 = new javax.swing.JLabel();
noticeContent = new javax.swing.JTextField();
jButton6 = new javax.swing.JButton();
jButton23 = new javax.swing.JButton();
jButton24 = new javax.swing.JButton();
jButton21 = new javax.swing.JButton();
jLabel17 = new javax.swing.JLabel();
droprate = new javax.swing.JTextField();
jButton22 = new javax.swing.JButton();
jButton13 = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
jButton12 = new javax.swing.JButton();
jButton17 = new javax.swing.JButton();
jButton16 = new javax.swing.JButton();
jLabel13 = new javax.swing.JLabel();
jButton19 = new javax.swing.JButton();
jButton18 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jButton11 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
jLabel12 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
itemList = new javax.swing.JList();
jButton3 = new javax.swing.JButton();
beAdd = new javax.swing.JTextField();
jScrollPane7 = new javax.swing.JScrollPane();
chatlog = new javax.swing.JTextPane();
jLabel22 = new javax.swing.JLabel();
wworld = new javax.swing.JComboBox();
jLabel16 = new javax.swing.JLabel();
wid = new javax.swing.JComboBox();
jLabel18 = new javax.swing.JLabel();
jButton8 = new javax.swing.JButton();
badd2 = new javax.swing.JTextField();
jScrollPane2 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jButton9 = new javax.swing.JButton();
jButton15 = new javax.swing.JButton();
jButton20 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("服务端管理工具");
setBackground(new java.awt.Color(255, 255, 255));
setName("MSJW"); // NOI18N
setResizable(false);
setType(java.awt.Window.Type.POPUP);
jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel14.setText("Generated Code write by NetBeans IDE.This ServerManager that made for MapleDEV");
jButton4.setText("修改");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
exprate.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
jLabel4.setText("物品暴率");
jLabel5.setText("倍");
jLabel2.setText("经验暴率");
jLabel3.setText("倍");
jButton1.setText("修改");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("修改");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel6.setText("金币暴率");
jLabel7.setText("倍");
jButton7.setText("弹出");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
mesorate.setToolTipText("");
jLabel15.setFont(new java.awt.Font("宋体", 1, 12)); // NOI18N
jLabel15.setText("玩家操作(选择列表玩家进行)");
jLabel8.setFont(new java.awt.Font("宋体", 1, 12)); // NOI18N
jLabel8.setText("消息相关");
jLabel8.setToolTipText("");
jTextField1.setText("物品代码");
jLabel10.setText("服务器公告");
jTextField2.setText("数量");
jButton5.setText("变更");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jLabel11.setFont(new java.awt.Font("宋体", 1, 12)); // NOI18N
jLabel11.setText("游戏公告");
jButton6.setText("公告");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton23.setText("保存数据");
jButton23.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton23ActionPerformed(evt);
}
});
jButton24.setText("关闭服务器");
jButton24.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton24ActionPerformed(evt);
}
});
jButton21.setText("发送物品");
jButton21.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton21ActionPerformed(evt);
}
});
jLabel17.setFont(new java.awt.Font("宋体", 1, 12)); // NOI18N
jLabel17.setText("服务器管理");
jLabel17.setToolTipText("");
jButton22.setText("在线玩家数");
jButton22.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton22ActionPerformed(evt);
}
});
jButton13.setText("给予全服");
jButton13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton13ActionPerformed(evt);
}
});
jButton14.setText("初始化列表");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
jButton12.setText("删除选择项");
jButton12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton12ActionPerformed(evt);
}
});
jButton17.setText("Portal 脚本");
jButton17.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton17ActionPerformed(evt);
}
});
jButton16.setText("物品掉落");
jButton16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton16ActionPerformed(evt);
}
});
jLabel13.setFont(new java.awt.Font("굴림", 1, 12)); // NOI18N
jLabel13.setText("重置(更新)");
jButton19.setText("Event 脚本");
jButton19.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton19ActionPerformed(evt);
}
});
jButton18.setText("商店");
jButton18.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton18ActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("宋体", 1, 12)); // NOI18N
jLabel1.setText("修改暴率");
jLabel1.setToolTipText("");
jButton11.setText("NPC");
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});
jButton10.setText("信息");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
jLabel12.setText("Item List (项目列表)");
jLabel9.setFont(new java.awt.Font("굴림", 1, 12)); // NOI18N
jLabel9.setText("Progress Event");
itemList.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "< 项目, 数量 >" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
itemList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane1.setViewportView(itemList);
jButton3.setText("添加到列表");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
beAdd.setText("物品代码");
chatlog.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
chatlog.setEnabled(false);
jScrollPane7.setViewportView(chatlog);
jLabel22.setFont(new java.awt.Font("宋体", 1, 12)); // NOI18N
jLabel22.setText("消息记录");
wworld.setToolTipText("");
wworld.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
wworldItemStateChanged(evt);
}
});
jLabel16.setText("选择大区");
wid.setEnabled(false);
jLabel18.setText("ID:");
jButton8.setText("清空记录");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
badd2.setText("数量");
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"AID", "角色名", "等级", "职业", "当前位置"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jScrollPane2.setViewportView(jTable1);
if (jTable1.getColumnModel().getColumnCount() > 0) {
jTable1.getColumnModel().getColumn(0).setMinWidth(50);
jTable1.getColumnModel().getColumn(0).setPreferredWidth(50);
jTable1.getColumnModel().getColumn(0).setMaxWidth(50);
jTable1.getColumnModel().getColumn(1).setMinWidth(110);
jTable1.getColumnModel().getColumn(1).setPreferredWidth(110);
jTable1.getColumnModel().getColumn(1).setMaxWidth(110);
jTable1.getColumnModel().getColumn(2).setMinWidth(40);
jTable1.getColumnModel().getColumn(2).setPreferredWidth(40);
jTable1.getColumnModel().getColumn(2).setMaxWidth(40);
jTable1.getColumnModel().getColumn(4).setPreferredWidth(200);
}
jButton9.setText("踢下线");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jButton15.setText("封包头");
jButton15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton15ActionPerformed(evt);
}
});
jButton20.setText("给点卷");
jButton20.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton20ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jButton6)
.addGap(14, 14, 14)
.addComponent(jButton7)
.addGap(18, 18, 18)
.addComponent(jButton10)
.addGap(18, 18, 18)
.addComponent(jButton11)
.addGap(18, 18, 18)
.addComponent(jButton8)
.addGap(31, 31, 31))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exprate)
.addGap(9, 9, 9)
.addComponent(jLabel3)
.addGap(11, 11, 11)
.addComponent(jButton1))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(droprate, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(8, 8, 8)
.addComponent(jLabel5)
.addGap(12, 12, 12)
.addComponent(jButton2)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mesorate, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(8, 8, 8)
.addComponent(jLabel7)
.addGap(12, 12, 12)
.addComponent(jButton4)))
.addGap(166, 166, 166)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel16)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(wworld, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(wid, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(2, 2, 2)
.addComponent(jLabel10))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(3, 3, 3)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(servermessage, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5)))
.addGap(31, 31, 31)))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(jLabel22))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(noticeContent, javax.swing.GroupLayout.PREFERRED_SIZE, 385, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 390, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(223, 223, 223)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton19, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel13)
.addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jLabel9)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(7, 7, 7)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton21)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel17)
.addComponent(jButton22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton24, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jLabel15)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 408, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(beAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(badd2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(wworld, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel16)
.addComponent(wid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel18))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jButton1)
.addComponent(exprate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton17)))
.addComponent(jButton16))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(droprate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(jButton2)
.addComponent(jButton18))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(9, 9, 9)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(mesorate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(jButton4)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton19)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(3, 3, 3)
.addComponent(jLabel10))
.addComponent(jButton15))
.addGap(7, 7, 7)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(servermessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5))
.addGap(1, 1, 1)
.addComponent(jLabel11)
.addGap(4, 4, 4)
.addComponent(noticeContent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton6)
.addComponent(jButton7)
.addComponent(jButton10)
.addComponent(jButton11)
.addComponent(jButton8))
.addGap(6, 6, 6)
.addComponent(jLabel22))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addGap(6, 6, 6)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton14)
.addGap(18, 18, 18)
.addComponent(jButton3)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(beAdd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(badd2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton20))
.addGap(30, 30, 30)
.addComponent(jLabel15))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel17)
.addGap(10, 10, 10)
.addComponent(jButton22)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton24, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton23)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton21)
.addComponent(jButton9))))
.addGap(8, 8, 8)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(23, Short.MAX_VALUE))
);
jTabbedPane1.addTab("通用", jPanel1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel14)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
String element = beAdd.getText();
String count = badd2.getText();
//String[] entry = element.split(",");
//entry[0] = entry[0].trim();
//entry[1] = entry[1].trim();
int itemId = 0;
short quantity = -1;
boolean s = false;
try {
itemId = Integer.valueOf(element);
quantity = Short.valueOf(count);
s = true;
} catch (NumberFormatException nfe) {
JOptionPane.showMessageDialog(null, "请重新输入.");
}
if (s) {
itemListModel.addElement(itemId + ", " + quantity);
itemList.setModel(itemListModel);
} else {
JOptionPane.showMessageDialog(null, "出错");
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
sendNotice(4);
}//GEN-LAST:event_jButton10ActionPerformed
private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
sendNotice(5);
}//GEN-LAST:event_jButton11ActionPerformed
private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton18ActionPerformed
MapleShopFactory.getInstance().clear();
JOptionPane.showMessageDialog(null, "商店初始化成功...");
}//GEN-LAST:event_jButton18ActionPerformed
private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
for (ChannelServer instance : ChannelServer.getAllInstances()) {
instance.reloadEvents();
}
JOptionPane.showMessageDialog(null, "Event 脚本初始化成功...");
}//GEN-LAST:event_jButton19ActionPerformed
private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
//MapleMonsterProvider.getInstance().clearDrops();
ReactorScriptManager.getInstance().clearDrops();
JOptionPane.showMessageDialog(null, "物品掉落初始化成功....");
}//GEN-LAST:event_jButton16ActionPerformed
private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed
PortalScriptManager.getInstance().clearScripts();
JOptionPane.showMessageDialog(null, "Portal 脚本初始化成功...");
}//GEN-LAST:event_jButton17ActionPerformed
//GEN-FIRST:event_jButton12ActionPerformed
private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {
itemListModel.remove(itemList.getSelectedIndex());
itemList.setModel(itemListModel);
}
//GEN-LAST:event_jButton12ActionPerformed
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
itemListModel = new DefaultListModel();
itemList.setModel(itemListModel);
}//GEN-LAST:event_jButton14ActionPerformed
private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
List<Pair<Integer, Short>> itemEntries = new ArrayList<>();
try {
for (Object elementObj : itemListModel.toArray()) {
String str = (String) elementObj;
String[] entry = str.split(",");
if (str.equals("< 项目, 数量 >")) {
JOptionPane.showMessageDialog(null, "错误:请添加项目!.");
return;
}
entry[0] = entry[0].trim();
entry[1] = entry[1].trim();
itemEntries.add(new Pair<>(Integer.valueOf(entry[0]), Short.valueOf(entry[1])));
}
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(null, "项目列表有错.");
return;
}
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
cserv.broadcastPacket(MaplePacketCreator.serverMessageRedText("恭喜!获得了管理员赠送的礼物。"));
for (MapleCharacter player : cserv.getPlayerStorage().getAllCharacters()) {
for (Pair<Integer, Short> itemEntry : itemEntries) {
player.gainItem(itemEntry.getLeft(), itemEntry.getRight(), false, -1, "服务端控制台发送物品");
}
}
}
}//GEN-LAST:event_jButton13ActionPerformed
private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton22ActionPerformed
int users = 0;
for (ChannelServer csev : ChannelServer.getAllInstances()) {
users += csev.getPlayerStorage().getAllCharacters().size();
}
JOptionPane.showMessageDialog(null, "在线玩家数 : " + users);
}//GEN-LAST:event_jButton22ActionPerformed
private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
String val_item = jTextField1.getText(); //物品ID
String val_quan = jTextField2.getText(); //数量
int val_targ;//目标 角色名
if (jTable1.getSelectedRow() != -1) {
val_targ = (Integer) ManagerSin.jTable1.getValueAt(jTable1.getSelectedRow(), 0);
} else {
JOptionPane.showMessageDialog(null, "您未选择角色。");
return;
}
int item;
short quan = 0;
try {
item = Integer.parseInt(val_item);
quan = Short.parseShort(val_quan);
} catch (NumberFormatException e) {
item = 0;
}
if (val_targ < 0 || item < 1 || quan < 1) {
JOptionPane.showMessageDialog(null, "Debug:错误!");
return;
}
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
//cserv.broadcastPacket(NPCPacket.getNPCTalk(2007, (byte) 0, "获得了管理员赠送的礼物。", "00 00", (byte) 0));
//cserv.broadcastPacket(MaplePacketCreator.serverNotice(1, "恭喜!获得了管理员赠送的礼物。"));
for (MapleCharacter player : cserv.getPlayerStorage().getAllCharacters()) {
if (val_targ == player.getClient().getAccID()) {
player.gainItem(item, quan, false, -1, "服务端控制台发送物品");
player.getClient().getSession().write(MaplePacketCreator.serverMessageRedText("恭喜!获得了运营员赠送的礼物。"));
}
}
}
//MapleCharacter.gainReward(val_targ, item, quan);
JOptionPane.showMessageDialog(null, "奖励发放成功。.");
}//GEN-LAST:event_jButton21ActionPerformed
private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed
minutesLeft = 2;
if (ts == null && (t == null || !t.isAlive())) {
t = new Thread(ShutdownServer.getInstance());
ts = Timer.EventTimer.getInstance().register(new Runnable() {
@Override
public void run() {
if (minutesLeft == 0) {
ShutdownServer.getInstance().shutdown();
t.start();
ts.cancel(false);
return;
}
WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.serverMessageNotice("服务器将在" + minutesLeft + "分钟后进行停机维护, 请及时安全下线, 以免造成不必要的损失"));
minutesLeft--;
}
}, 60000);
JOptionPane.showMessageDialog(null, "服务器将在" + minutesLeft + "分钟后关闭!");
} else {
JOptionPane.showMessageDialog(null, "关闭进程正在进行或者关闭已完成, 请稍候");
}
}//GEN-LAST:event_jButton24ActionPerformed
private void jButton23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton23ActionPerformed
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
//cserv.saveAllMerchant();
for (MapleCharacter hp : cserv.getPlayerStorage().getAllCharacters()) {
hp.saveToDB(false, false);
}
}
//MedalRanking.getInstance().save();
JOptionPane.showMessageDialog(null, "保存完毕.");
}//GEN-LAST:event_jButton23ActionPerformed
/* 消息处理 */
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
sendNotice(0);
}//GEN-LAST:event_jButton6ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
modifyServer(3, servermessage.getText());
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
sendNotice(1);
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
//modifyServer(1, droprate.getText());
int ee = wworld.getSelectedIndex();
drop[ee] = Integer.parseInt(droprate.getText());
sendNotice("物品爆率已经改变,现在为 " + drop[ee] + " 倍!");
}//GEN-LAST:event_jButton2ActionPerformed
/* 修改暴率 */
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
//modifyServer(0, exprate.getText());
int ee = wworld.getSelectedIndex();
exp[ee] = Integer.parseInt(exprate.getText());
sendNotice("经验倍率已经改变,现在为 " + exp[ee] + " 倍!");
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
//modifyServer(2, mesorate.getText());
int ee = wworld.getSelectedIndex();
meso[ee] = Integer.parseInt(mesorate.getText());
sendNotice("金币爆率已经改变,现在为 " + meso[ee] + " 倍!");
}//GEN-LAST:event_jButton4ActionPerformed
private void wworldItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_wworldItemStateChanged
int index = wworld.getSelectedIndex();
//FileoutputUtil.log(index);
wid.getItemAt(index);
exprate.setText(exp[index] + "");
mesorate.setText(meso[index] + "");
droprate.setText(drop[index] + "");
}//GEN-LAST:event_wworldItemStateChanged
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
chatlog.setText("");
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
int val_targ;
if (jTable1.getSelectedRow() != -1) {
val_targ = (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0); //目标 角色名
} else {
JOptionPane.showMessageDialog(null, "您未选择角色。");
return;
}
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
for (MapleCharacter player : cserv.getPlayerStorage().getAllCharacters()) {
if (val_targ == player.getClient().getAccID()) {
player.getClient().getSession().write(MaplePacketCreator.serverMessagePopUp("[通知] 你已经被运营员强制踢下线!"));
player.getClient().disconnect(true, player.getClient().getChannel() == -10);
player.getClient().getSession().close(true);
break;
}
}
}
}//GEN-LAST:event_jButton9ActionPerformed
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
SendPacketOpcode.reloadValues();
RecvPacketOpcode.reloadValues();
InteractionOpcode.reloadValues();
CashShopOpcode.reloadValues();
JOptionPane.showMessageDialog(null, "已重置包头。");
}//GEN-LAST:event_jButton15ActionPerformed
private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton20ActionPerformed
try {
int count = Integer.parseInt(badd2.getText());
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
cserv.broadcastPacket(MaplePacketCreator.serverMessageRedText("恭喜!获得了管理员赠送的 " + count + " 点卷!"));
for (MapleCharacter player : cserv.getPlayerStorage().getAllCharacters()) {
player.modifyCSPoints(1, count);
}
}
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(null, "错误!\r\n" + e);
}
}//GEN-LAST:event_jButton20ActionPerformed
protected static Thread t = null;
private static ScheduledFuture<?> ts = null;
private int minutesLeft = 0;
private void setData() {
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
//TODO: Handle this for 118
//exprate.setText(cserv.getExpRate() + "");
// droprate.setText(cserv.getDropRate() + "");
//mesorate.setText(cserv.getMesoRate() + "");
//servermessage.setText(cserv.getServerMessage());
//chatlog.setText("");
break;
}
}
private void setworld() {
int i = 0;
for (WorldConstants.Option e : WorldConstants.values()) {
if (e.show()) {
String mWorld = e.name();
wworld.addItem(mWorld);
wid.addItem(e.getWorld());
//wcode.addItem(e.getWorld());
exp[i] = e.getExp();
meso[i] = e.getMeso();
drop[i] = e.getDrop();
//wid[i] = e.getWorld();
i += 1;
//break;
}
}
wworldItemStateChanged(null);
}
private void modifyServer(int type, String str) {
try {
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
switch (type) {
//TODO: fix this
case 0:
//cserv.setExpRate(Integer.valueOf(str));
break;
case 1:
//cserv.setDropRate(Integer.valueOf(str));
break;
case 2:
//cserv.setMesoRate(Byte.valueOf(str));
break;
case 3:
//cserv.setServerMessage(str);
break;
}
}
setData();
JOptionPane.showMessageDialog(null, "成功修改设置。");
} catch (HeadlessException e) {
JOptionPane.showMessageDialog(null, "错误!\r\n" + e);
}
}
/* 修改暴率结束 */
private void sendNotice(String str) {
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
cserv.broadcastPacket(MaplePacketCreator.serverMessageNotice("[公告事项] " + str));
}
}
private void sendNotice(int type) {
try {
String str = noticeContent.getText();
byte[] p = null;
switch (type) {
case 0:
p = MaplePacketCreator.serverMessageNotice("[公告事项] " + str);
break;
case 1:
p = MaplePacketCreator.serverMessageRedText("[来自运营员的消息] \n\r\n\r" + str);
break;
case 2:
//p = MainPacketCreator.getGMText(8, str);
break;
case 3:
//p = UIPacket.showInfo(str);
break;
case 4:
p = MaplePacketCreator.serverNotice(5, str);
break;
case 5:
p = NPCPacket.sendNPCSay(2007,str);
}
for (ChannelServer cserv : ChannelServer.getAllInstances()) {
cserv.broadcastPacket(p);
}
if (type == 0) {
chatlog.setText(chatlog.getText() + "[公告事项] " + str + "\n");
}
//JOptionPane.showMessageDialog(null, "通知完成。.");
noticeContent.setText("");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "错误!\r\n" + e);
}
}
/* 消息处理 结束 */
/* 活动处理结束 */
/**
* @param args the command line arguments
*/
public static void main(final boolean args) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ManagerSin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (args) {
new ManagerSin().setVisible(true);
} else {
new ManagerSin().setVisible(false);
}
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField badd2;
private javax.swing.JTextField beAdd;
public static javax.swing.JTextPane chatlog;
private javax.swing.JTextField droprate;
private javax.swing.JTextField exprate;
private javax.swing.Box.Filler filler1;
private javax.swing.JList itemList;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton15;
private javax.swing.JButton jButton16;
private javax.swing.JButton jButton17;
private javax.swing.JButton jButton18;
private javax.swing.JButton jButton19;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton20;
private javax.swing.JButton jButton21;
private javax.swing.JButton jButton22;
private javax.swing.JButton jButton23;
private javax.swing.JButton jButton24;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane7;
private javax.swing.JTabbedPane jTabbedPane1;
public static javax.swing.JTable jTable1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField mesorate;
private javax.swing.JTextField noticeContent;
private javax.swing.JTextField servermessage;
private javax.swing.JComboBox wid;
private javax.swing.JComboBox wworld;
// End of variables declaration//GEN-END:variables
private DefaultListModel itemListModel = new DefaultListModel();
}