public void broadcastVoteMsg() { for (ChannelServer lol : ChannelServer.getAllInstances()) { lol.broadcastPacket( MaplePacketCreator.serverNotice( 6, "[Vote Reminder] Please do not forget to vote for us every 12 hrs. There are rewards for voting which you can claim from Charles at henesys. http://ninjams,org/vote")); } }
public void sendFML() { for (ChannelServer lol : ChannelServer.getAllInstances()) { lol.broadcastPacket(MaplePacketCreator.sendYellowTip(MapleFML.getFML())); } int lol = (int) (Math.random() * 3); /* if (lol < 1) { MainIRC.getInstance().sendGlobalMessage("#FML : " + MapleFML.getFML()); } else {*/ MainIRC.getInstance().sendMessage("#ninjashelp", "#FML : " + MapleFML.getFML()); // } }
public final void guildMessage(final MaplePacket serverNotice) { for (final MapleGuildCharacter mgc : members) { for (final ChannelServer cs : ChannelServer.getAllInstances()) { if (cs.getPlayerStorage().getCharacterById(mgc.getId()) != null) { final MapleCharacter chr = cs.getPlayerStorage().getCharacterById(mgc.getId()); if (serverNotice != null) { chr.getClient().getSession().write(serverNotice); } else { chr.getMap().removePlayer(chr); chr.getMap().addPlayer(chr); } } } } }
public void sendBashQuote() { MainIRC.getInstance().sendMessage("Sunny", "#BASH : 0"); for (ChannelServer lol : ChannelServer.getAllInstances()) { MainIRC.getInstance().sendMessage("Sunny", "#BASH : 1 - " + lol.getChannel()); List<String> gay = BashBot.getQuotes(); MainIRC.getInstance().sendMessage("Sunny", "#BASH : 2- Gay"); lol.broadcastPacket( MaplePacketCreator.sendYellowTip( "---------------------------------------Random bash.org Quote---------------------------------------")); for (String i : gay) { lol.broadcastPacket(MaplePacketCreator.sendYellowTip(i)); } lol.broadcastPacket( MaplePacketCreator.sendYellowTip( "---------------------------------------Random bash.org Quote---------------------------------------")); if (lol.getChannel() == 2) { for (String i : gay) { MainIRC.getInstance().sendIrcMessage("#BASH : " + i); } } } }
public static final void PartyOperatopn( final SeekableLittleEndianAccessor slea, final MapleClient c) { final int operation = slea.readByte(); final WorldChannelInterface wci = ChannelServer.getInstance(c.getChannel()).getWorldInterface(); MapleParty party = c.getPlayer().getParty(); MaplePartyCharacter partyplayer = new MaplePartyCharacter(c.getPlayer()); switch (operation) { case 1: // create if (c.getPlayer().getParty() == null) { try { party = wci.createParty(partyplayer); c.getPlayer().setParty(party); } catch (RemoteException e) { c.getChannelServer().reconnectWorld(); } c.getSession().write(MaplePacketCreator.partyCreated()); } else { c.getPlayer().dropMessage(5, "You can't create a party as you are already in one"); } break; case 2: // leave if (party != null) { // are we in a party? o.O" try { if (partyplayer.equals(party.getLeader())) { // disband wci.updateParty(party.getId(), PartyOperation.DISBAND, partyplayer); if (c.getPlayer().getEventInstance() != null) { c.getPlayer().getEventInstance().disbandParty(); } } else { wci.updateParty(party.getId(), PartyOperation.LEAVE, partyplayer); if (c.getPlayer().getEventInstance() != null) { c.getPlayer().getEventInstance().leftParty(c.getPlayer()); } } } catch (RemoteException e) { c.getChannelServer().reconnectWorld(); } c.getPlayer().setParty(null); } break; case 3: // accept invitation final int partyid = slea.readInt(); if (c.getPlayer().getParty() == null) { try { party = wci.getParty(partyid); if (party != null) { if (party.getMembers().size() < 6) { wci.updateParty(party.getId(), PartyOperation.JOIN, partyplayer); c.getPlayer().receivePartyMemberHP(); c.getPlayer().updatePartyMemberHP(); } else { c.getSession().write(MaplePacketCreator.partyStatusMessage(17)); } } else { c.getPlayer().dropMessage(5, "The party you are trying to join does not exist"); } } catch (RemoteException e) { c.getChannelServer().reconnectWorld(); } } else { c.getPlayer().dropMessage(5, "You can't join the party as you are already in one"); } break; case 4: // invite // TODO store pending invitations and check against them final MapleCharacter invited = c.getChannelServer().getPlayerStorage().getCharacterByName(slea.readMapleAsciiString()); if (invited != null && c.getPlayer().canFuck(invited)) { if (invited.getParty() == null) { if (party.getMembers().size() < 6) { invited.getClient().getSession().write(MaplePacketCreator.partyInvite(c.getPlayer())); } else { c.getSession().write(MaplePacketCreator.partyStatusMessage(16)); } } else { c.getSession().write(MaplePacketCreator.partyStatusMessage(17)); } } else { c.getSession().write(MaplePacketCreator.partyStatusMessage(19)); } break; case 5: // expel if (partyplayer.equals(party.getLeader())) { final MaplePartyCharacter expelled = party.getMemberById(slea.readInt()); if (expelled != null) { try { wci.updateParty(party.getId(), PartyOperation.EXPEL, expelled); if (c.getPlayer().getEventInstance() != null) { /*if leader wants to boot someone, then the whole party gets expelled TODO: Find an easier way to get the character behind a MaplePartyCharacter possibly remove just the expellee.*/ if (expelled.isOnline()) { c.getPlayer().getEventInstance().disbandParty(); } } } catch (RemoteException e) { c.getChannelServer().reconnectWorld(); } } } break; case 6: // change leader final MaplePartyCharacter newleader = party.getMemberById(slea.readInt()); try { wci.updateParty(party.getId(), PartyOperation.CHANGE_LEADER, newleader); } catch (RemoteException e) { c.getChannelServer().reconnectWorld(); } break; default: System.out.println("Unhandled Party function." + operation + ""); break; } }
public void sendMLIA() { for (ChannelServer lol : ChannelServer.getAllInstances()) { lol.broadcastPacket(MaplePacketCreator.sendYellowTip(MLIABot.findMLIA())); } MainIRC.getInstance().sendIrcMessage("#MLIA : " + MLIABot.findMLIA()); }
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { slea.readByte(); slea.readInt(); // ? slea.readInt(); // position, but we dont need it o.o int oid = slea.readInt(); MapleMapObject ob = c.getPlayer().getMap().getMapObject(oid); if (ob == null) { c.getSession().write(MaplePacketCreator.getInventoryFull()); c.getSession().write(MaplePacketCreator.getShowInventoryFull()); return; } if (ob instanceof MapleMapItem) { MapleMapItem mapitem = (MapleMapItem) ob; synchronized (mapitem) { if (mapitem.isPickedUp()) { c.getSession().write(MaplePacketCreator.getInventoryFull()); c.getSession().write(MaplePacketCreator.getShowInventoryFull()); return; } double distance = c.getPlayer().getPosition().distanceSq(mapitem.getPosition()); c.getPlayer().getCheatTracker().checkPickupAgain(); if (distance > 90000.0) { // 300^2, 550 is approximatly the range of ultis // AutobanManager.getInstance().addPoints(c, 100, 300000, "Itemvac"); c.getPlayer().getCheatTracker().registerOffense(CheatingOffense.ITEMVAC); // Double.valueOf(Math.sqrt(distance)) } else if (distance > 30000.0) { // log.warn("[h4x] Player {} is picking up an item that's fairly far away: {}", // c.getPlayer().getName(), Double.valueOf(Math.sqrt(distance))); c.getPlayer().getCheatTracker().registerOffense(CheatingOffense.SHORT_ITEMVAC); } if (mapitem.getMeso() > 0) { if (c.getPlayer().getParty() != null) { ChannelServer cserv = c.getChannelServer(); int mesoAmm = mapitem.getMeso(); int partyNum = 0; Collection<MaplePartyCharacter> partyMembers = c.getPlayer().getParty().getMembers(); for (MaplePartyCharacter partyMember : partyMembers) { if (partyMember.getMapid() == c.getPlayer().getMapId()) { partyNum++; } } int mesoGain = mesoAmm / partyNum; for (MaplePartyCharacter partyMember : partyMembers) { if (partyMember.getMapid() == c.getPlayer().getMapId()) { cserv .getPlayerStorage() .getCharacterById(partyMember.getId()) .gainMeso(mesoGain, true, true); } } } else { c.getPlayer().gainMeso(mapitem.getMeso(), true, true); } c.getPlayer() .getMap() .broadcastMessage( MaplePacketCreator.removeItemFromMap( mapitem.getObjectId(), 2, c.getPlayer().getId()), mapitem.getPosition()); c.getPlayer().getCheatTracker().pickupComplete(); c.getPlayer().getMap().removeMapObject(ob); } else { StringBuilder logInfo = new StringBuilder("Picked up by "); logInfo.append(c.getPlayer().getName()); if (mapitem.getItem().getItemId() >= 5000000 && mapitem.getItem().getItemId() <= 5000100) { int petId = MaplePet.createPet(mapitem.getItem().getItemId()); if (petId == -1) { return; } MapleInventoryManipulator.addById( c, mapitem.getItem().getItemId(), mapitem.getItem().getQuantity(), "Cash Item was purchased.", null, petId); c.getPlayer() .getMap() .broadcastMessage( MaplePacketCreator.removeItemFromMap( mapitem.getObjectId(), 2, c.getPlayer().getId()), mapitem.getPosition()); c.getPlayer().getCheatTracker().pickupComplete(); c.getPlayer().getMap().removeMapObject(ob); } else { if (MapleInventoryManipulator.addFromDrop(c, mapitem.getItem(), logInfo.toString())) { c.getPlayer() .getMap() .broadcastMessage( MaplePacketCreator.removeItemFromMap( mapitem.getObjectId(), 2, c.getPlayer().getId()), mapitem.getPosition()); c.getPlayer().getCheatTracker().pickupComplete(); c.getPlayer().getMap().removeMapObject(ob); } else { c.getPlayer().getCheatTracker().pickupComplete(); return; } if (mapitem.getItem().getItemId() == 1002357) { c.getPlayer().finishAchievement(13); } } } mapitem.setPickedUp(true); } } c.getSession().write(MaplePacketCreator.enableActions()); }
@Override public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception, IllegalCommandSyntaxException { MapleCharacter player = c.getPlayer(); if (splitted[0].equals("@dojob")) { NPCScriptManager npc = NPCScriptManager.getInstance(); npc.start(c, 9001001); } else if (splitted[0].equals("@spinel")) { NPCScriptManager npc = NPCScriptManager.getInstance(); npc.start(c, 9000020); } else if (splitted[0].equals("@str") || splitted[0].equals("@int") || splitted[0].equals("@luk") || splitted[0].equals("@dex")) { int amount = Integer.parseInt(splitted[1]); boolean str = splitted[0].equals("@str"); boolean Int = splitted[0].equals("@int"); boolean luk = splitted[0].equals("@luk"); boolean dex = splitted[0].equals("@dex"); if (amount > 0 && amount <= player.getRemainingAp() && amount <= 32763 || amount < 0 && amount >= -32763 && Math.abs(amount) + player.getRemainingAp() <= 32767) { if (str && amount + player.getStr() <= 32767 && amount + player.getStr() >= 4) { player.setStr(player.getStr() + amount); player.updateSingleStat(MapleStat.STR, player.getStr()); player.setRemainingAp(player.getRemainingAp() - amount); player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp()); } else if (Int && amount + player.getInt() <= 32767 && amount + player.getInt() >= 4) { player.setInt(player.getInt() + amount); player.updateSingleStat(MapleStat.INT, player.getInt()); player.setRemainingAp(player.getRemainingAp() - amount); player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp()); } else if (luk && amount + player.getLuk() <= 32767 && amount + player.getLuk() >= 4) { player.setLuk(player.getLuk() + amount); player.updateSingleStat(MapleStat.LUK, player.getLuk()); player.setRemainingAp(player.getRemainingAp() - amount); player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp()); } else if (dex && amount + player.getDex() <= 32767 && amount + player.getDex() >= 4) { player.setDex(player.getDex() + amount); player.updateSingleStat(MapleStat.DEX, player.getDex()); player.setRemainingAp(player.getRemainingAp() - amount); player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp()); } else { mc.dropMessage( "Please make sure the stat you are trying to raise is not over 32,767 or under 4."); } } else { mc.dropMessage( "Please make sure your AP is not over 32,767 and you have enough to distribute."); } } else if (splitted[0].equals("@emo")) { player.setHp(0); player.updateSingleStat(MapleStat.HP, 0); } else if (splitted[0].equals("@expfix")) { player.setExp(0); player.updateSingleStat(MapleStat.EXP, player.getExp()); mc.dropMessage("Your exp has been fixed~!"); } else if (splitted[0].equals("@myap")) { mc.dropMessage( "You currently have " + c.getPlayer().getStr() + " STR, " + c.getPlayer().getDex() + " DEX, " + c.getPlayer().getLuk() + " LUK, " + c.getPlayer().getInt() + " INT."); mc.dropMessage("You currently have " + c.getPlayer().getRemainingAp() + " Ability Points."); } else if (splitted[0].equals("@commands")) { mc.dropMessage("The player Commands are:"); mc.dropMessage( "@str, @int, @dex, @achievements, @luk, @save, @dojob, @expfix, @myap, @emo, @rebirth, @apreset, @dispose, @goto"); } else if (splitted[0].equals("@rebirth")) { if (player.getLevel() >= 200) { int totalrebirth = c.getPlayer().getReborns() + 1; mc.dropMessage("You have been reborned. For a total of " + totalrebirth + " times."); player.doReborn(); } else { mc.dropMessage("You are not level 200 yet!"); } } else if (splitted[0].equals("@save")) { if (!player.getCheatTracker().Spam(60000, 0)) { // 1 minute player.saveToDB(true); mc.dropMessage("Character information saved."); } else { mc.dropMessage("You cannot save more than once every minute."); } } else if (splitted[0].equalsIgnoreCase("@achievements")) { mc.dropMessage("Your finished achievements:"); for (Integer i : c.getPlayer().getFinishedAchievements()) { mc.dropMessage( MapleAchievements.getInstance().getById(i).getName() + " - " + MapleAchievements.getInstance().getById(i).getReward() + " NX."); } } else if (splitted[0].equals("@dispose")) { NPCScriptManager.getInstance().dispose(c); c.getSession().write(MaplePacketCreator.enableActions()); mc.dropMessage("Done."); } else if (splitted[0].equals("@apreset")) { if (player.getMeso() >= 5000000) { int str = c.getPlayer().getStr(); int dex = c.getPlayer().getDex(); int int_ = c.getPlayer().getInt(); int luk = c.getPlayer().getLuk(); int newap = c.getPlayer().getRemainingAp() + (str - 4) + (dex - 4) + (int_ - 4) + (luk - 4); c.getPlayer().setStr(4); c.getPlayer().setDex(4); c.getPlayer().setInt(4); c.getPlayer().setLuk(4); c.getPlayer().setRemainingAp(newap); List<Pair<MapleStat, Integer>> stats = new ArrayList<Pair<MapleStat, Integer>>(); stats.add(new Pair<MapleStat, Integer>(MapleStat.STR, Integer.valueOf(str))); stats.add(new Pair<MapleStat, Integer>(MapleStat.DEX, Integer.valueOf(dex))); stats.add(new Pair<MapleStat, Integer>(MapleStat.INT, Integer.valueOf(int_))); stats.add(new Pair<MapleStat, Integer>(MapleStat.LUK, Integer.valueOf(luk))); stats.add(new Pair<MapleStat, Integer>(MapleStat.AVAILABLEAP, Integer.valueOf(newap))); c.getSession().write(MaplePacketCreator.updatePlayerStats(stats)); mc.dropMessage("Your ap has been reseted. Please CC or Relogin to apply the changes"); } else { mc.dropMessage("Not enough mesos. You need 5mill to apreset"); } } else if (splitted[0].equals("@goto")) { ChannelServer cserv = c.getChannelServer(); HashMap<String, Integer> maps = new HashMap<String, Integer>(); maps.put("henesys", 100000000); maps.put("ellinia", 101000000); maps.put("perion", 102000000); maps.put("kerning", 103000000); maps.put("lith", 104000000); maps.put("sleepywood", 105040300); maps.put("florina", 110000000); maps.put("orbis", 200000000); maps.put("happy", 209000000); maps.put("elnath", 211000000); maps.put("ludi", 220000000); maps.put("omega", 221000000); maps.put("korean", 222000000); maps.put("aqua", 230000000); maps.put("leafre", 240000000); maps.put("mulung", 250000000); maps.put("herb", 251000000); maps.put("nlc", 600000000); maps.put("shrine", 800000000); maps.put("showa", 801000000); maps.put("fm", 910000000); if (maps.containsKey(splitted[1])) { player.changeMap( cserv.getMapFactory().getMap(maps.get(splitted[1])), cserv.getMapFactory().getMap(maps.get(splitted[1])).getPortal(0)); } else { mc.dropMessage( "No map enetered do @goto <henesys|ellinia|perion|kerning|lith|sleepywood|florina|orbis|happy|elnath|ludi|omega|korean|aqua|leafre|mulung|herb|nlc|shrine|showa|fm>"); } } }