二數據庫的名字密碼沒有修改
大家會打開db.properties這個文件吧? ? ? ?
修改下面幾處
# qualified class name of your JDBC driver
driver=com.mysql.jdbc.Driver
# JDBC URL to your database
url=jdbc:mysql://127.0.0.1:3306/odinms odinms是冒險島數據庫的名字切忌IP別修改
# credentials for database access
user = root你的數據庫
password = root數據庫密碼
服務器不能開起,出現:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFacto
ry
at net.odinms.net.world.WorldServer.<clinit>(WorldServer.java:51)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 1 more
你如果只在channel.properties裡增加線數是沒用的.
我就先已開10條線做例子首先打開channel.properties
修改
# hostname or IP address of your world server
net.odinms.world.host=127.0.0.1
# number of channels to host in this process
net.odinms.channel.count=10
# channel keys
# (these are defined in the channels table)
net.odinms.channel.0.key=release1
net.odinms.channel.1.key=release2
net.odinms.channel.2.key=release3
net.odinms.channel.3.key=release4
net.odinms.channel.4.key=release5
net.odinms.channel.5.key=release6
net.odinms.channel.6.key=release7
net.odinms.channel.7.key=release8
net.odinms.channel.8.key=release9
net.odinms.channel.9.key=release10
如果你只修改了這裡是沒用的.
然後打開數據庫channelcofnig列表此列表為線程設置
增加第一項為數據庫裡的線數ID從1開始一直寫到9
第二項為線數從2開始寫到10 ,為什麼從2開始?因為一線是默認在其他地方所以不用寫
第三項為名字全寫成net.odinms.channel.net.port就行了
第四項為端口7575是一線而這裡是從2線開始所以我們從7576開始寫7576 7577 .....
一直寫到10線的地方..
public int getlength(String str){
int i,t=0;
byte[] bt = str.getBytes();
for (i=1;i<=bt.length;i++){
if (bt[i-1]<0) {t=t+2;i++;}
else t=t+1;
}
return t;
}
修改的方法是:
1.在src\net\sf\odinms\net\login\handler找到ServerlistRequestHandler.java
找到:
c.getSession().write(MaplePacketCreator.getServerList(0, "XXXX", LoginServer.getInstance().getLoad()));
在下面加
c.getSession().write(MaplePacketCreator.getServerList(1, "XXXX", LoginServer.getInstance().getLoad()));
要想更多選區就繼續加
c.getSession().write(MaplePacketCreator.getServerList(2, "XXXX", LoginServer.getInstance().getLoad()));
其中XXXX隨便取
在編譯下
2.打開端裡的login.PROPERTIES文件修改成
# hostname or IP address of your world server
net.odinms.world.host=127.0.0.1
# number of channels to host in this process
net.odinms.world.count=3
# login server key
# (this is defined in the loginserver table)
net.odinms.login.key=releaselogin
net.odinms.login.0.key=xxxxxx
net.odinms.login.1.key=xxxxxxx
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
找到
public final String readAsciiString(int n) {
char ret[] = new char[n];
for (int x = 0; x < n; x++) {
ret[x] = (char) readByte();
}
return String.valueOf(ret);
}
修改為:
public final String readAsciiString(int n) {
//char ret[] = new char[n];
byte ret[] = new byte[n];
for (int x = 0; x < n; x++) {
ret[x] = (byte) readByte();
}
try {
String str= new String(ret,"gbk");
return str;
} catch (Exception e) {
System.err.println(e);
}
return null;
}
public int getlength(String str){
int i,t=0;
byte[] bt = str.getBytes();
for (i=1;i<=bt.length;i++){
if (bt[i-1]<0) {t=t+2;i++;}
else t=t+1;
}
return t;
}