Skip to content

Commit 666fb83

Browse files
committed
01. autoSet wzPath on startServer(gui)
02. remove item operation interval 03. fix account online status 04. fix login ballon msg 05. change default database setting
1 parent ec9d8c1 commit 666fb83

13 files changed

+52
-100
lines changed

config.ini

-42
This file was deleted.

src/client/.LCKMapleClient.java~

-1
This file was deleted.

src/client/MapleClient.java

+28-9
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public int finishLogin() {
452452
loggedIn = false;
453453
return 7;
454454
}
455-
updateLoginState(MapleClient.LOGIN_LOGGEDIN, getSessionIPAddress() == "/127.0.0.1" ? null : getSessionIPAddress());
455+
updateLoginState(MapleClient.LOGIN_LOGGEDIN, /*getSessionIPAddress() == "/127.0.0.1" ? null :*/ getSessionIPAddress());
456456
} finally {
457457
login_mutex.unlock();
458458
}
@@ -502,10 +502,9 @@ public int fblogin(String login, String pwd, boolean ipMacBanned) {
502502
boolean updatePasswordHashtosha1 = false;
503503

504504
// Check if the passwords are correct here. :B
505-
506-
// if (password_otp.equals(pwd)) { // Check if a
507-
// password upgrade is needed. loginok = 0;
508-
if ((LoginCryptoLegacy.isLegacyPassword(passhash)) && (LoginCryptoLegacy.checkPassword(pwd, passhash))) {
505+
// if (password_otp.equals(pwd)) { // Check if a
506+
// password upgrade is needed. loginok = 0;
507+
if ((LoginCryptoLegacy.isLegacyPassword(passhash)) && (LoginCryptoLegacy.checkPassword(pwd, passhash))) {
509508
loginok = 0;
510509
updatePasswordHash = true;
511510
} else if ((salt == null) && (LoginCrypto.checkSha1Hash(passhash, pwd))) {
@@ -538,7 +537,7 @@ public int fblogin(String login, String pwd, boolean ipMacBanned) {
538537
}
539538
return loginok;
540539
}
541-
540+
542541
public int login(String login, String pwd, boolean ipMacBanned) {
543542
int loginok = 5;
544543
try {
@@ -575,7 +574,7 @@ public int login(String login, String pwd, boolean ipMacBanned) {
575574
//如果卡号了,这个if会导致账号登陆不进去,为了解决卡号问题,把这里设置成永远false
576575
//!ServerConfig.防卡号=true来控制强制登陆,为了让卡号了也能进游戏
577576
//if (!ServerConstants.防卡号 && getLoginState() > MapleClient.LOGIN_NOTLOGGEDIN) { // already loggedin
578-
if (loginstate > MapleClient.LOGIN_NOTLOGGEDIN) { // already loggedin
577+
if (loginstate > MapleClient.LOGIN_NOTLOGGEDIN) { // already loggedin
579578
loggedIn = false;
580579
loginok = 7;
581580
} else {
@@ -999,13 +998,33 @@ public final void disconnect(final boolean RemoveInChannelServer, final boolean
999998
}
1000999
}
10011000
}
1002-
if (!serverTransition && isLoggedIn()) {
1001+
if (!serverTransition && isLoggedIn() && getAccID() > 0) {
10031002
updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN, getSessionIPAddress());
10041003
}
10051004
}
10061005

10071006
public final String getSessionIPAddress() {
1008-
return session.getRemoteAddress().toString().split(":")[0];
1007+
if (session != null && session.getRemoteAddress() != null) {
1008+
return session.getRemoteAddress().toString().split(":")[0];
1009+
}
1010+
return getLastIPAddress();
1011+
}
1012+
1013+
public final String getLastIPAddress() {
1014+
String sessionIP = null;
1015+
try {
1016+
final PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT SessionIP FROM accounts WHERE id = ?");
1017+
ps.setInt(1, this.accId);
1018+
final ResultSet rs = ps.executeQuery();
1019+
if (rs.next()) {
1020+
sessionIP = rs.getString("SessionIP");
1021+
}
1022+
rs.close();
1023+
ps.close();
1024+
} catch (final SQLException e) {
1025+
System.err.println("Failed in getLastIPAddress for client.");
1026+
}
1027+
return sessionIP == null ? "" : sessionIP;
10091028
}
10101029

10111030
public final boolean CheckIPAddress() {

src/constants/ServerConstants.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
package constants;
2222

23-
import handling.login.Balloon;
23+
import handling.login.handler.Balloon;
2424
import java.util.ArrayList;
2525
import java.util.List;
2626
import server.ServerProperties;
@@ -62,7 +62,7 @@ public static String ChangeAutoReg() {
6262
public static List<Balloon> getBalloons() {
6363
if (lBalloon.isEmpty()) {
6464
lBalloon.add(new Balloon("[ZlhssMS服务端]致力于打造最完善的079", 236, 122));
65-
lBalloon.add(new Balloon("购买请联系QQ:529926174", 0, 276));
65+
/* lBalloon.add(new Balloon("购买请联系QQ:529926174", 0, 276));*/
6666
}
6767
return lBalloon;
6868
}

src/gui/ZlhssMS.form

+1-1
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@
803803
<Component class="java.awt.Checkbox" name="checkbox1">
804804
<Properties>
805805
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
806-
<Color id="&#x9ed8;&#x8ba4;&#x5149;&#x6807;"/>
806+
<Color id="Default Cursor"/>
807807
</Property>
808808
<Property name="name" type="java.lang.String" value="123" noResource="true"/>
809809
</Properties>

src/gui/ZlhssMS.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,9 @@ private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
771771
try {
772772
// TODO add your handling code here:
773773
if (Start.Check) {
774+
if (System.getProperty("net.sf.odinms.wzpath") == null) {
775+
System.setProperty("net.sf.odinms.wzpath", "wz");
776+
}
774777
Start.instance.startServer();
775778
String 输出 = "[服务器] 服务器启动成功!";
776779
printChatLog(输出);
@@ -866,7 +869,7 @@ private void checkbox1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
866869
// TODO add your handling code here:
867870
boolean status = checkbox1.getState();
868871
ServerConstants.Super_password = status;
869-
if(!status){
872+
if (!status) {
870873
ServerConstants.superpw = "";
871874
} else {
872875
ServerConstants.superpw = jTextField26.getText();

src/handling/MapleServerHandler.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,17 @@ public void sessionClosed(final IoSession session) throws Exception {
372372

373373
if (client != null) {
374374
try {
375-
FileWriter fw = isLoggedIP(session);
375+
/* FileWriter fw = isLoggedIP(session);
376376
if (fw != null) {
377377
fw.write("=== Session Closed ===");
378378
fw.write(nl);
379379
fw.flush();
380-
}
380+
}*/
381381
client.disconnect(true, cs);
382+
} catch (Exception ex) {
383+
ex.printStackTrace();
382384
} finally {
383-
session.close();
385+
session.close(true);
384386
session.removeAttribute(MapleClient.CLIENT_KEY);
385387
}
386388
}
@@ -1011,7 +1013,7 @@ public static void handlePacket(final RecvPacketOpcode header, final SeekableLit
10111013
System.out.println("[未经处理的] 客户端包 [" + header.toString() + "] 发现了");
10121014
break;
10131015
}
1014-
/* if (c.getPlayer().getNX() >= 10) {
1016+
/* if (c.getPlayer().getNX() >= 10) {
10151017
c.getPlayer().modifyCSPoints(1, -10);
10161018
} else {
10171019
c.getPlayer().dropMessage("您的点卷已经消耗光了。无法再做任何操作");

src/handling/channel/handler/InterServerHandler.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ public static void Loggedin(final int playerid, final MapleClient c) {
167167
final int state = c.getLoginState();
168168
boolean allowLogin = false;
169169
String allowLoginTip = null;
170-
//进入这里可能是卡角色了
171-
if (state == MapleClient.LOGIN_SERVER_TRANSITION || state == MapleClient.CHANGE_CHANNEL || state == MapleClient.LOGIN_NOTLOGGEDIN) {
170+
if (state == MapleClient.LOGIN_SERVER_TRANSITION || state == MapleClient.CHANGE_CHANNEL) {
172171
List<String> charNames = c.loadCharacterNames(c.getWorld());
173172
allowLogin = !World.isCharacterListConnected(charNames);
174173
if (!allowLogin) {

src/handling/channel/handler/InventoryHandler.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ public static final void ItemMove(final SeekableLittleEndianAccessor slea, final
9191
return;
9292
}
9393
MapleCharacter player = c.getPlayer();
94-
player.setCurrenttime(System.currentTimeMillis());
94+
/* player.setCurrenttime(System.currentTimeMillis());
9595
if (player.getCurrenttime() - player.getLasttime() < player.get防止复制时间()) {
9696
c.getPlayer().dropMessage(5, "请慢点使用.不然会掉线哟!");
9797
c.getSession().write(MaplePacketCreator.enableActions());
9898
return;
99-
}
99+
}*/
100100
player.setLasttime(System.currentTimeMillis());
101101
c.getPlayer().updateTick(slea.readInt());
102102
final MapleInventoryType type = MapleInventoryType.getByType(slea.readByte()); //04

src/handling/login/handler/Balloon.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package handling.login;
1+
package handling.login.handler;
22

33
public class Balloon {
44

src/handling/login/handler/CharLoginHandler.java

+1-28
Original file line numberDiff line numberDiff line change
@@ -451,35 +451,8 @@ public static void Character_WithoutSecondPassword(final SeekableLittleEndianAcc
451451
}
452452
String ip = c.getSessionIPAddress();
453453
LoginServer.putLoginAuth(charId, ip.substring(ip.indexOf('/') + 1, ip.length()), c.getTempIP(), c.getChannel());
454-
// c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, ip);
455-
/*
456-
* if (c.getLoginState() == 2) { c.updateLoginState(2, ip);
457-
* System.out.println("输出登录2"); } else {
458-
*/
454+
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, c.getSessionIPAddress());
459455
c.getSession().write(MaplePacketCreator.getServerIP(Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]), charId));
460-
461-
/*
462-
* final String currentpw = c.getSecondPassword(); if (slea.available()
463-
* != 0) { if (currentpw != null) { // Hack c.getSession().close();
464-
* return; } final String setpassword = slea.readMapleAsciiString();
465-
*
466-
* if (setpassword.length() >= 4 && setpassword.length() <= 16) {
467-
* c.setSecondPassword(setpassword); c.updateSecondPassword();
468-
*
469-
* if (!c.login_Auth(charId)) { c.getSession().close(); return; } } else
470-
* { c.getSession().write(LoginPacket.secondPwError((byte) 0x14));
471-
* return; } } else if (loginFailCount(c) || currentpw != null ||
472-
* !c.login_Auth(charId)) { c.getSession().close(); return; }
473-
*/
474-
//这句是我屏蔽的
475-
// String ip = c.getSessionIPAddress();
476-
// LoginServer.putLoginAuth(charId, ip.substring(ip.indexOf('/') + 1, ip.length()), c.getTempIP(), c.getChannel());
477-
// c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, c.getSessionIPAddress());
478-
// System.out.println("··········A"+charId);
479-
// System.out.println("··········C"+c.getSessionIPAddress());
480-
// System.out.println("··········B"+ChannelServer.getInstance(c.getChannel()).getIP());
481-
// c.getSession().write(MaplePacketCreator.getServerIP(Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]), charId));
482-
// c.getSession().write(MaplePacketCreator.getServerIP(0, charId));
483456
}
484457

485458
public static final void Character_WithSecondPassword(final SeekableLittleEndianAccessor slea, final MapleClient c) {

src/tools/packet/LoginPacket.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import constants.ServerConstants;
3131
import handling.MaplePacket;
3232
import handling.SendPacketOpcode;
33-
import handling.login.Balloon;
33+
import handling.login.handler.Balloon;
3434
import handling.login.LoginServer;
3535
import tools.data.output.MaplePacketLittleEndianWriter;
3636
import tools.HexTool;
@@ -259,13 +259,12 @@ public static final MaplePacket getServerList(final int serverId, final String s
259259
mplew.write(serverId);
260260
mplew.writeShort(i - 1);
261261
}
262-
/*mplew.writeShort(ServerConstants.getBalloons().size());
262+
mplew.writeShort(ServerConstants.getBalloons().size());
263263
for (Balloon balloon : ServerConstants.getBalloons()) {
264264
mplew.writeShort(balloon.nX);
265265
mplew.writeShort(balloon.nY);
266266
mplew.writeMapleAsciiString(balloon.sMessage);
267-
}*/
268-
mplew.writeShort(0);
267+
}
269268

270269
//System.err.println(HexTool.toString(mplew.getPacket().getBytes()));
271270
return mplew.getPacket();

服务端配置.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ wzurl = jdbc:mysql://localhost:3306/maoxiandao079?autoReconnect=true&characterEn
77

88
# credentials for database access
99
user = root
10-
password = zhangleilei
10+
password = root
1111
timeout = 300000
1212

1313
#Channel Setting
@@ -30,9 +30,9 @@ ZlhssMS.UserLimit = 500
3030
ZlhssMS.MaxCharacters = 3
3131
#########################################
3232
ZlhssMS.Port = 7575
33-
ZlhssMS.LPort = 9595
33+
ZlhssMS.LPort = 8484
3434
ZlhssMS.SCPort = 8600
35-
ZlhssMS.IP = 139.224.226.157
35+
ZlhssMS.IP = 221.231.130.70
3636
#########################################
3737
ZlhssMS.Debug = false
3838
ZlhssMS.封包显示 = false

0 commit comments

Comments
 (0)