- Joined
- Jul 2, 2011
- Messages
- 783
- Reaction score
- 230
Hmm... try using a different sources Start.java. Since you don't know how to modify if, you do take a look around channel+Start you might find something ;D
Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!
Join Today!Cashshopserver.java
PHP:/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 ~ 2010 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other version of the GNU Affero General Public License. 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/>. */ package handling.cashshop; import java.net.InetSocketAddress; import handling.MapleServerHandler; import handling.channel.PlayerStorage; import handling.mina.MapleCodecFactory; import org.apache.mina.common.ByteBuffer; import org.apache.mina.common.SimpleByteBufferAllocator; import org.apache.mina.common.IoAcceptor; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.transport.socket.nio.SocketAcceptorConfig; import org.apache.mina.transport.socket.nio.SocketAcceptor; import server.MTSStorage; import server.ServerProperties; public class CashShopServer { private static String ip; private static InetSocketAddress InetSocketadd; private final static int PORT = 8600; private static IoAcceptor acceptor; private static PlayerStorage players, playersMTS; private static boolean finishedShutdown = false; public static final void run_startup_configurations() { ip = ServerProperties.getProperty("net.sf.odinms.world.host") + ":" + PORT; ByteBuffer.setUseDirectBuffers(false); ByteBuffer.setAllocator(new SimpleByteBufferAllocator()); acceptor = new SocketAcceptor(); final SocketAcceptorConfig cfg = new SocketAcceptorConfig(); cfg.getSessionConfig().setTcpNoDelay(true); cfg.setDisconnectOnUnbind(true); cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory())); players = new PlayerStorage(-10); playersMTS = new PlayerStorage(-20); try { InetSocketadd = new InetSocketAddress(PORT); acceptor.bind(InetSocketadd, new MapleServerHandler(-1, true), cfg); System.out.println("Listening on port " + PORT + "."); } catch (final Exception e) { System.err.println("Binding to port " + PORT + " failed"); e.printStackTrace(); throw new RuntimeException("Binding failed.", e); } } public static final String getIP() { return ip; } public static final PlayerStorage getPlayerStorage() { return players; } public static final PlayerStorage getPlayerStorageMTS() { return playersMTS; } public static final void shutdown() { if (finishedShutdown) { return; } System.out.println("Saving all connected clients (CS)..."); players.disconnectAll(); playersMTS.disconnectAll(); MTSStorage.getInstance().saveBuyNow(true); System.out.println("Shutting down CS..."); acceptor.unbindAll(); finishedShutdown = true; } public static boolean isShutdown() { return finishedShutdown; } }
And use the LIB files from Lithium source.
Have fun bye
Well, what is Xephyr Based on? Lithium. Also, more than most of the servers are based on Lithium. So, what do you think? -.-
Cash shop still disconnects. Help with that?
Channelserver.java
PHP:/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 ~ 2010 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other version of the GNU Affero General Public License. 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/>. */ package handling.channel; import client.MapleCharacter; import constants.GameConstants; import constants.ServerConstants; import java.io.IOException; import java.net.InetSocketAddress; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import handling.MapleServerHandler; import handling.login.LoginServer; import handling.mina.MapleCodecFactory; import handling.world.CheaterData; import java.util.concurrent.locks.ReentrantReadWriteLock; import scripting.EventScriptManager; import server.MapleSquad; import server.MapleSquad.MapleSquadType; import server.maps.MapleMapFactory; import server.shops.HiredMerchant; import server.life.PlayerNPC; import org.apache.mina.common.ByteBuffer; import org.apache.mina.common.SimpleByteBufferAllocator; import org.apache.mina.common.IoAcceptor; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.transport.socket.nio.SocketAcceptorConfig; import org.apache.mina.transport.socket.nio.SocketAcceptor; import java.util.ArrayList; import java.util.EnumMap; import java.util.HashSet; import java.util.Set; import server.ServerProperties; import server.events.*; import server.maps.AramiaFireWorks; import server.maps.MapleMapObject; import tools.ConcurrentEnumMap; import tools.packet.CWvsContext; public class ChannelServer { public static long serverStartTime; public int eventMap = 0; private int expRate, mesoRate, dropRate = 2, dropRate2 = 3, cashRate = 3, traitRate = 3; private short port = 8585; private static final short DEFAULT_PORT = 8585; private int channel, running_MerchantID = 0, flags = 0; private String serverMessage, ip, serverName; private boolean shutdown = false, finishedShutdown = false, MegaphoneMuteState = false, adminOnly = false; private PlayerStorage players; private IoAcceptor acceptor; private final MapleMapFactory mapFactory; private EventScriptManager eventSM; private AramiaFireWorks works = new AramiaFireWorks(); private static final Map<Integer, ChannelServer> instances = new HashMap<Integer, ChannelServer>(); private final Map<MapleSquadType, MapleSquad> mapleSquads = new ConcurrentEnumMap<MapleSquadType, MapleSquad>(MapleSquadType.class); private final Map<Integer, HiredMerchant> merchants = new HashMap<Integer, HiredMerchant>(); private final List<PlayerNPC> playerNPCs = new LinkedList<PlayerNPC>(); private final ReentrantReadWriteLock merchLock = new ReentrantReadWriteLock(); //merchant public boolean eventOn = false; private int eventmap = -1; private final Map<MapleEventType, MapleEvent> events = new EnumMap<MapleEventType, MapleEvent>(MapleEventType.class); private ChannelServer(final int channel) { this.channel = channel; mapFactory = new MapleMapFactory(channel); } public static Set<Integer> getAllInstance() { return new HashSet<Integer>(instances.keySet()); } public final void loadEvents() { if (events.size() != 0) { return; } events.put(MapleEventType.CokePlay, new MapleCoconut(channel, MapleEventType.CokePlay)); //yep, coconut. same poop events.put(MapleEventType.Coconut, new MapleCoconut(channel, MapleEventType.Coconut)); events.put(MapleEventType.Fitness, new MapleFitness(channel, MapleEventType.Fitness)); events.put(MapleEventType.OlaOla, new MapleOla(channel, MapleEventType.OlaOla)); events.put(MapleEventType.OxQuiz, new MapleOxQuiz(channel, MapleEventType.OxQuiz)); events.put(MapleEventType.Snowball, new MapleSnowball(channel, MapleEventType.Snowball)); events.put(MapleEventType.Survival, new MapleSurvival(channel, MapleEventType.Survival)); } public final void run_startup_configurations() { setChannel(channel); //instances.put try { expRate = Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.exp")); mesoRate = Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.meso")); serverMessage = ServerProperties.getProperty("net.sf.odinms.world.serverMessage"); serverName = ServerProperties.getProperty("net.sf.odinms.login.serverName"); flags = Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.flags", "0")); adminOnly = Boolean.parseBoolean(ServerProperties.getProperty("net.sf.odinms.world.admin", "false")); eventSM = new EventScriptManager(this, ServerProperties.getProperty("net.sf.odinms.channel.events").split(",")); port = Short.parseShort(ServerProperties.getProperty("net.sf.odinms.channel.net.port" + channel, String.valueOf(DEFAULT_PORT + channel))); } catch (Exception e) { throw new RuntimeException(e); } ip = ServerProperties.getProperty("net.sf.odinms.channel.net.interface") + ":" + port; ByteBuffer.setUseDirectBuffers(false); ByteBuffer.setAllocator(new SimpleByteBufferAllocator()); acceptor = new SocketAcceptor(); final SocketAcceptorConfig acceptor_config = new SocketAcceptorConfig(); acceptor_config.getSessionConfig().setTcpNoDelay(true); acceptor_config.setDisconnectOnUnbind(true); acceptor_config.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory())); players = new PlayerStorage(channel); loadEvents(); try { acceptor.bind(new InetSocketAddress(port), new MapleServerHandler(channel, false), acceptor_config); System.out.println("Channel " + channel + ": Listening on port " + port + ""); eventSM.init(); } catch (IOException e) { System.out.println("Binding to port " + port + " failed (ch: " + getChannel() + ")" + e); } } public final void shutdown() { if (finishedShutdown) { return; } broadcastPacket(CWvsContext.serverNotice(0, "This channel will now shut down.")); // dc all clients by hand so we get sessionClosed... shutdown = true; System.out.println("Channel " + channel + ", Saving characters..."); getPlayerStorage().disconnectAll(); System.out.println("Channel " + channel + ", Unbinding..."); acceptor.unbindAll(); acceptor = null; //temporary while we dont have !addchannel instances.remove(channel); setFinishShutdown(); } public final void unbind() { acceptor.unbindAll(); } public final boolean hasFinishedShutdown() { return finishedShutdown; } public final MapleMapFactory getMapFactory() { return mapFactory; } public static final ChannelServer newInstance(final int channel) { return new ChannelServer(channel); } public static final ChannelServer getInstance(final int channel) { return instances.get(channel); } public final void addPlayer(final MapleCharacter chr) { getPlayerStorage().registerPlayer(chr); } public final PlayerStorage getPlayerStorage() { if (players == null) { //wth players = new PlayerStorage(channel); //wthhhh } return players; } public void setEventMap(int id){ this.eventMap = id; } public int getEventMap(){ return this.eventMap; } public final void removePlayer(final MapleCharacter chr) { getPlayerStorage().deregisterPlayer(chr); } public final void removePlayer(final int idz, final String namez) { getPlayerStorage().deregisterPlayer(idz, namez); } public final String getServerMessage() { return serverMessage; } public final void setServerMessage(final String newMessage) { serverMessage = newMessage; broadcastPacket(CWvsContext.serverMessage(serverMessage)); } public final void broadcastPacket(final byte[] data) { getPlayerStorage().broadcastPacket(data); } public final void broadcastSmegaPacket(final byte[] data) { getPlayerStorage().broadcastSmegaPacket(data); } public final void broadcastGMPacket(final byte[] data) { getPlayerStorage().broadcastGMPacket(data); } public final int getExpRate() { return expRate; } public final void setExpRate(final int expRate) { this.expRate = expRate; } public final int getCashRate() { return cashRate; } public final int getChannel() { return channel; } public final void setChannel(final int channel) { instances.put(channel, this); LoginServer.addChannel(channel); } public static final ArrayList<ChannelServer> getAllInstances() { return new ArrayList<ChannelServer>(instances.values()); } public final String getIP() { return ip; } public final boolean isShutdown() { return shutdown; } public final int getLoadedMaps() { return mapFactory.getLoadedMaps(); } public final EventScriptManager getEventSM() { return eventSM; } public final void reloadEvents() { eventSM.cancel(); eventSM = new EventScriptManager(this, ServerProperties.getProperty("net.sf.odinms.channel.events").split(",")); eventSM.init(); } public final int getMesoRate() { return mesoRate; } public final void setMesoRate(final int mesoRate) { this.mesoRate = mesoRate; } public final int getDropRate() { return dropRate; } public final int getDropRate2() { return dropRate2; } public static final void startChannel_Main() { serverStartTime = System.currentTimeMillis(); for (int i = 0; i < Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.channel.count", "0")); i++) { newInstance(i + 1).run_startup_configurations(); } } public Map<MapleSquadType, MapleSquad> getAllSquads() { return Collections.unmodifiableMap(mapleSquads); } public final MapleSquad getMapleSquad(final String type) { return getMapleSquad(MapleSquadType.valueOf(type.toLowerCase())); } public final MapleSquad getMapleSquad(final MapleSquadType type) { return mapleSquads.get(type); } public final boolean addMapleSquad(final MapleSquad squad, final String type) { final MapleSquadType types = MapleSquadType.valueOf(type.toLowerCase()); if (types != null && !mapleSquads.containsKey(types)) { mapleSquads.put(types, squad); squad.scheduleRemoval(); return true; } return false; } public final boolean removeMapleSquad(final MapleSquadType types) { if (types != null && mapleSquads.containsKey(types)) { mapleSquads.remove(types); return true; } return false; } public final int closeAllMerchant() { int ret = 0; merchLock.writeLock().lock(); try { final Iterator<Entry<Integer, HiredMerchant>> merchants_ = merchants.entrySet().iterator(); while (merchants_.hasNext()) { HiredMerchant hm = merchants_.next().getValue(); hm.closeShop(true, false); //HiredMerchantSave.QueueShopForSave(hm); hm.getMap().removeMapObject(hm); merchants_.remove(); ret++; } } finally { merchLock.writeLock().unlock(); } //hacky for (int i = 910000001; i <= 910000022; i++) { for (MapleMapObject mmo : mapFactory.getMap(i).getAllHiredMerchantsThreadsafe()) { ((HiredMerchant) mmo).closeShop(true, false); //HiredMerchantSave.QueueShopForSave((HiredMerchant) mmo); ret++; } } return ret; } public final int addMerchant(final HiredMerchant hMerchant) { merchLock.writeLock().lock(); try { running_MerchantID++; merchants.put(running_MerchantID, hMerchant); return running_MerchantID; } finally { merchLock.writeLock().unlock(); } } public final void removeMerchant(final HiredMerchant hMerchant) { merchLock.writeLock().lock(); try { merchants.remove(hMerchant.getStoreId()); } finally { merchLock.writeLock().unlock(); } } public final boolean containsMerchant(final int accid, int cid) { boolean contains = false; merchLock.readLock().lock(); try { final Iterator itr = merchants.values().iterator(); while (itr.hasNext()) { HiredMerchant hm = (HiredMerchant) itr.next(); if (hm.getOwnerAccId() == accid || hm.getOwnerId() == cid) { contains = true; break; } } } finally { merchLock.readLock().unlock(); } return contains; } public final List<HiredMerchant> searchMerchant(final int itemSearch) { final List<HiredMerchant> list = new LinkedList<HiredMerchant>(); merchLock.readLock().lock(); try { final Iterator itr = merchants.values().iterator(); while (itr.hasNext()) { HiredMerchant hm = (HiredMerchant) itr.next(); if (hm.searchItem(itemSearch).size() > 0) { list.add(hm); } } } finally { merchLock.readLock().unlock(); } return list; } public final void toggleMegaphoneMuteState() { this.MegaphoneMuteState = !this.MegaphoneMuteState; } public final boolean getMegaphoneMuteState() { return MegaphoneMuteState; } public int getEvent() { return eventmap; } public final void setEvent(final int ze) { this.eventmap = ze; } public MapleEvent getEvent(final MapleEventType t) { return events.get(t); } public final Collection<PlayerNPC> getAllPlayerNPC() { return playerNPCs; } public final void addPlayerNPC(final PlayerNPC npc) { if (playerNPCs.contains(npc)) { return; } playerNPCs.add(npc); getMapFactory().getMap(npc.getMapId()).addMapObject(npc); } public final void removePlayerNPC(final PlayerNPC npc) { if (playerNPCs.contains(npc)) { playerNPCs.remove(npc); getMapFactory().getMap(npc.getMapId()).removeMapObject(npc); } } public final String getServerName() { return serverName; } public final void setServerName(final String sn) { this.serverName = sn; } public final String getTrueServerName() { return serverName.substring(0, serverName.length() - (GameConstants.GMS ? 2 : 3)); } public final int getPort() { return port; } public static final Set<Integer> getChannelServer() { return new HashSet<Integer>(instances.keySet()); } public final void setShutdown() { this.shutdown = true; System.out.println("Channel " + channel + " has set to shutdown and is closing Hired Merchants..."); } public final void setFinishShutdown() { this.finishedShutdown = true; System.out.println("Channel " + channel + " has finished shutdown."); } public final boolean isAdminOnly() { return adminOnly; } public final static int getChannelCount() { return instances.size(); } public final int getTempFlag() { return flags; } public static Map<Integer, Integer> getChannelLoad() { Map<Integer, Integer> ret = new HashMap<Integer, Integer>(); for (ChannelServer cs : instances.values()) { ret.put(cs.getChannel(), cs.getConnectedClients()); } return ret; } public int getConnectedClients() { return getPlayerStorage().getConnectedClients(); } public List<CheaterData> getCheaters() { List<CheaterData> cheaters = getPlayerStorage().getCheaters(); Collections.sort(cheaters); return cheaters; } public List<CheaterData> getReports() { List<CheaterData> cheaters = getPlayerStorage().getReports(); Collections.sort(cheaters); return cheaters; } public void broadcastMessage(byte[] message) { broadcastPacket(message); } public void broadcastSmega(byte[] message) { broadcastSmegaPacket(message); } public void broadcastGMMessage(byte[] message) { broadcastGMPacket(message); } public AramiaFireWorks getFireWorks() { return works; } public int getTraitRate() { return traitRate; } }
Some people can't even leech correctly so I guess, yes.Was posting the entire java class really necessary?
@standeman praat nooit alleen Nederlands, zet er dan een vertaling bij.
Never talk in Dutch only, add a translation too.