Jump to content

Search the Community

Showing results for tags 'handler'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 12 results

  1. After adding varago to my server i got this error: [QUOTE] Launching Rome... [Launcher] Initing Cache... [Launcher] Initing Data Files... [Launcher] Initing Fishing Spots... [Launcher] Initing NPC Combat Scripts... [Launcher] Initing Dialogues... [Launcher] Initing Controlers... [Launcher] Initing Cutscenes... [Launcher] Initing Friend Chats Manager... [Launcher] Initing Cores Manager... [Launcher] Initing World... [Launcher] Initing Region Builder... [Launcher] Initing Server Channel Handler... ERROR! THREAD NAME: main org.jboss.netty.channel.ChannelException: Failed to bind to: 0.0.0.0/0.0.0.0:435 94 at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:2 98) at com.rs.net.ServerChannelHandler.<init>(ServerChannelHandler.java:44) at com.rs.net.ServerChannelHandler.init(ServerChannelHandler.java:23) at com.rs.Launcher.main(Launcher.java:89) Caused by: java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:444) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java: 214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.bind(N ioServerSocketPipelineSink.java:138) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handle ServerSocket(NioServerSocketPipelineSink.java:90) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventS unk(NioServerSocketPipelineSink.java:64) at org.jboss.netty.channel.Channels.bind(Channels.java:569) at org.jboss.netty.channel.AbstractChannel.bind(AbstractChannel.java:187 ) at org.jboss.netty.bootstrap.ServerBootstrap$Binder.channelOpen(ServerBo otstrap.java:343) at org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:170) at org.jboss.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioS erverSocketChannel.java:80) at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newC hannel(NioServerSocketChannelFactory.java:158) at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newC hannel(NioServerSocketChannelFactory.java:86) at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:2 77) ... 3 more [Launcher] Failed initing Server Channel Handler. Shutting down... [/QUOTE] Anyone knows how to fix this error? Thanks for answers. And even after refreshing my cache it still shows this error
  2. I have added full magic on ground packet including tele grab which you need to do yourself (the actual spell). WorldPacketsDecoder: [CODE]else if (packetId == MAGIC_ON_GROUND_PACKET) { MagicOnGroundPacketHandler.handlePacket(player, stream, packetId); }[/CODE] Create [B]new file[/B] in com.rs.net.decoders.handlers. [CODE]package com.enso.net.decoders.handlers; import com.enso.game.item.Item; import com.enso.game.player.Player; import com.enso.game.player.content.MagicAbility; import com.enso.io.InputStream; /** * * [MENTION=52317]auth[/MENTION]or Fuzen Seth * [MENTION=3199]Sin[/MENTION]ce 9.12.2013 * [MENTION=33707]Cat[/MENTION]egory Represents a player using magic spell to a ground item. */ public class MagicOnGroundPacketHandler { /** * Tele grab spell id. */ public static final int TELE_GRAB = 44; /** * The regular spellbook. */ public static final int REGULAR_SPELLBOOK = 190; /** * The ancient spellbook. */ public static final int ANCIENT_SPELLBOOK = -1; /** * The lunar spellbook. */ public static final int LUNAR_SPELLBOOK = -1; /** * We handle the magic on ground packet. * [MENTION=75098]Para[/MENTION]m player * [MENTION=75098]Para[/MENTION]m stream * [MENTION=75098]Para[/MENTION]m packetId */ public static final void handlePacket(Player player, InputStream stream, int packetId) { int inventoryInter = stream.readInt() >> 16; int itemId = stream.readShort(); int junk = stream.readShort(); int itemSlot = stream.readShortLE(); int interfaceSet = stream.readIntV1(); int spellId = interfaceSet & 0xFFF; int magicInter = interfaceSet >> 16; Item item = new Item(itemId); switch (inventoryInter) { case REGULAR_SPELLBOOK: switch (spellId) { /** * Teleportation grab * Takes a item from ground by using magic. */ case TELE_GRAB: MagicAbility.preformTeleGrab(player, item); break; } break; default: if (player.isDeveloperMode()) System.out.println("Item:" + itemId + "slot:" + itemSlot + "spell:" + spellId + "i:" + interfaceSet + "l:" + magicInter + "x:" + junk + "k:" + inventoryInter); } } } [/CODE] Enjoy, [B]don't forget to replace imports from 'enso' to 'rs'.[/B]
  3. I'm having 100 errors with my compiler and I need something to be fixed in the objecthandler.java What did I do wrong here?? : [CODE]package server.world; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import server.Server; import server.model.objects.Objects; import server.model.players.Client; import server.model.players.Player; import server.util.Misc; /** * @author Sanity */ public class ObjectHandler { public List<Objects> globalObjects = new ArrayList<Objects>(); public ObjectHandler() { loadGlobalObjects("./Data/cfg/global-objects.cfg"); loadDoorConfig("./Data/cfg/doors.cfg"); } /** * Adds object to list **/ public void addObject(Objects object) { globalObjects.add(object); } /** * Removes object from list **/ public void removeObject(Objects object) { globalObjects.remove(object); } /** * Does object exist **/ public Objects objectExists(int objectX, int objectY, int objectHeight) { for(Objects o : globalObjects) { if(o.getObjectX() == objectX && o.getObjectY() == objectY && o.getObjectHeight() == objectHeight) { return o; } } return null; } /** * Update objects when entering a new region or logging in **/ public void updateObjects(Client c) { for(Objects o : globalObjects) { if(c != null) { if(c.heightLevel == o.getObjectHeight() && o.objectTicks == 0) { if (c.distanceToPoint(o.getObjectX(), o.getObjectY()) <= 60) { c.getPA().object(o.getObjectId(), o.getObjectX(), o.getObjectY(), o.getObjectFace(), o.getObjectType()); } } } } if (c.distanceToPoint(2813, 3463) <= 60) { c.getFarming().updateHerbPatch(); } if (c.distanceToPoint(2961, 3389) <= 60) { c.getPA().object(6552, 2961, 3389, -1, 10); } } /** * Creates the object for anyone who is within 60 squares of the object **/ArrayList<Objects> toremove = new ArrayList<Objects>(); for (Objects s): globalObjects) { if (s.getObjectX() == o.getObjectX() && s.getObjectY() == o.getObjectY()) { toremove.add(s); } } for (Objects s): toremove) { if (globalObjects.contains(s)) { globalObjects.remove(s); } } globalObjects.add(o); public void placeObject(Objects (o) { for (Player p : Server.playerHandler.players){ if(p != null) { Client person = (Client) if(person != null){ if(person.heightLevel == o.getObjectHeight() && o.objectTicks == 0) { if (person.distanceToPoint(o.getObjectX(), o.getObjectY()) <= 60) { person.getPA().object(o.getObjectId(), o.getObjectX(), o.getObjectY(), o.getObjectFace(), o.getObjectType()); } } } } } } public void process() { for (int j = 0; j < globalObjects.size(); j++) { if (globalObjects.get(j) != null) { Objects o = globalObjects.get(j); if(o.objectTicks > 0) { o.objectTicks--; } if (o.objectTicks == 1) { Objects deleteObject = objectExists(o.getObjectX(), o.getObjectY(), o.getObjectHeight()); removeObject(deleteObject); o.objectTicks = 0; placeObject(o); removeObject(o); if (isObelisk(o.objectId)) { int index = getObeliskIndex(o.objectId); if (activated[index]) { activated[index] = false; teleportObelisk(index); } } } } } /*for(Objects o : globalObjects) { if(o.objectTicks > 0) { o.objectTicks--; } if(o.objectTicks == 1) { Objects deleteObject = objectExists(o.getObjectX(), o.getObjectY(), o.getObjectHeight()); if(deleteObject != null) { removeObject(deleteObject); } o.objectTicks = 0; placeObject(o); removeObject(o); if (isObelisk(o.objectId)) { int index = getObeliskIndex(o.objectId); if (activated[index]) { activated[index] = false; teleportObelisk(index); } } break; } }*/ } public boolean loadGlobalObjects(String fileName) { String line = ""; String token = ""; String token2 = ""; String token2_2 = ""; String[] token3 = new String[10]; boolean EndOfFile = false; int ReadMode = 0; BufferedReader objectFile = null; try { objectFile = new BufferedReader(new FileReader("./"+fileName)); } catch(FileNotFoundException fileex) { Misc.println(fileName+": file not found."); return false; } try { line = objectFile.readLine(); } catch(IOException ioexception) { Misc.println(fileName+": error loading file."); return false; } while(EndOfFile == false && line != null) { line = line.trim(); int spot = line.indexOf("="); if (spot > -1) { token = line.substring(0, spot); token = token.trim(); token2 = line.substring(spot + 1); token2 = token2.trim(); token2_2 = token2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token3 = token2_2.split("\t"); if (token.equals("object")) { Objects object = new Objects(Integer.parseInt(token3[0]), Integer.parseInt(token3[1]), Integer.parseInt(token3[2]), Integer.parseInt(token3[3]), Integer.parseInt(token3[4]), Integer.parseInt(token3[5]), 0); addObject(object); } } else { if (line.equals("[ENDOFOBJECTLIST]")) { try { objectFile.close(); } catch(IOException ioexception) { } return true; } } try { line = objectFile.readLine(); } catch(IOException ioexception1) { EndOfFile = true; } } try { objectFile.close(); } catch(IOException ioexception) { } return false; } /** * Doors **/ public static final int MAX_DOORS = 100; public static int[][] doors = new int[MAX_DOORS][5]; public static int doorFace = 0; public void doorHandling(int doorId, int doorX, int doorY, int doorHeight) { for(int i = 0; i < doors.length; i++){ if(doorX == doors[i][0] && doorY == doors[i][1] && doorHeight == doors[i][2]) { if(doors[i][4] == 0) { doorId++; } else { doorId--; } for (Player p : Server.playerHandler.players){ if(p != null) { Client person = (Client)p; if(person != null){ if(person.heightLevel == doorHeight) { if (person.distanceToPoint(doorX, doorY) <= 60) { person.getPA().object(-1, doors[i][0], doors[i][1], 0, 0); if(doors[i][3] == 0 && doors[i][4] == 1) { person.getPA().object(doorId, doors[i][0], doors[i][1]+1, -1, 0); } else if(doors[i][3] == -1 && doors[i][4] == 1) { person.getPA().object(doorId, doors[i][0]-1, doors[i][1], -2, 0); } else if(doors[i][3] == -2 && doors[i][4] == 1) { person.getPA().object(doorId, doors[i][0], doors[i][1]-1, -3, 0); } else if(doors[i][3] == -3 && doors[i][4] == 1) { person.getPA().object(doorId, doors[i][0]+1, doors[i][1], 0, 0); } else if(doors[i][3] == 0 && doors[i][4] == 0) { person.getPA().object(doorId, doors[i][0]-1, doors[i][1], -3, 0); } else if(doors[i][3] == -1 && doors[i][4] == 0) { person.getPA().object(doorId, doors[i][0], doors[i][1]-1, 0, 0); } else if(doors[i][3] == -2 && doors[i][4] == 0) { person.getPA().object(doorId, doors[i][0]+1, doors[i][1], -1, 0); } else if(doors[i][3] == -3 && doors[i][4] == 0) { person.getPA().object(doorId, doors[i][0], doors[i][1]+1, -2, 0); } } } } } } } } } public boolean loadDoorConfig(String fileName) { String line = ""; String token = ""; String token2 = ""; String token2_2 = ""; String[] token3 = new String[10]; boolean EndOfFile = false; int ReadMode = 0; BufferedReader objectFile = null; try { objectFile = new BufferedReader(new FileReader("./"+fileName)); } catch(FileNotFoundException fileex) { Misc.println(fileName+": file not found."); return false; } try { line = objectFile.readLine(); } catch(IOException ioexception) { Misc.println(fileName+": error loading file."); return false; } int door = 0; while(EndOfFile == false && line != null) { line = line.trim(); int spot = line.indexOf("="); if (spot > -1) { token = line.substring(0, spot); token = token.trim(); token2 = line.substring(spot + 1); token2 = token2.trim(); token2_2 = token2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token3 = token2_2.split("\t"); if (token.equals("door")) { doors[door][0] = Integer.parseInt(token3[0]); doors[door][1] = Integer.parseInt(token3[1]); doors[door][2] = Integer.parseInt(token3[2]); doors[door][3] = Integer.parseInt(token3[3]); doors[door][4] = Integer.parseInt(token3[4]); door++; } } else { if (line.equals("[ENDOFDOORLIST]")) { try { objectFile.close(); } catch(IOException ioexception) { } return true; } } try { line = objectFile.readLine(); } catch(IOException ioexception1) { EndOfFile = true; } } try { objectFile.close(); } catch(IOException ioexception) { } return false; } public final int IN_USE_ID = 14825; public boolean isObelisk(int id) { for (int j = 0; j < obeliskIds.length; j++) { if (obeliskIds[j] == id) return true; } return false; } public int[] obeliskIds = {14829,14830,111235,14828,14826,14831}; public int[][] obeliskCoords = {{3154,3618},{3225,3665},{3033,3730},{3104,3792},{2978,3864},{3305,3914}}; public boolean[] activated = {false,false,false,false,false,false}; public void startObelisk(int obeliskId) { int index = getObeliskIndex(obeliskId); if (index >= 0) { if (!activated[index]) { activated[index] = true; Objects obby1 = new Objects(14825, obeliskCoords[index][0], obeliskCoords[index][1], 0, -1, 10, 0); Objects obby2 = new Objects(14825, obeliskCoords[index][0] + 4, obeliskCoords[index][1], 0, -1, 10, 0); Objects obby3 = new Objects(14825, obeliskCoords[index][0], obeliskCoords[index][1] + 4, 0, -1, 10, 0); Objects obby4 = new Objects(14825, obeliskCoords[index][0] + 4, obeliskCoords[index][1] + 4, 0, -1, 10, 0); addObject(obby1); addObject(obby2); addObject(obby3); addObject(obby4); Server.objectHandler.placeObject(obby1); Server.objectHandler.placeObject(obby2); Server.objectHandler.placeObject(obby3); Server.objectHandler.placeObject(obby4); Objects obby5 = new Objects(obeliskIds[index], obeliskCoords[index][0], obeliskCoords[index][1], 0, -1, 10, 10); Objects obby6 = new Objects(obeliskIds[index], obeliskCoords[index][0] + 4, obeliskCoords[index][1], 0, -1, 10, 10); Objects obby7 = new Objects(obeliskIds[index], obeliskCoords[index][0], obeliskCoords[index][1] + 4, 0, -1, 10, 10); Objects obby8 = new Objects(obeliskIds[index], obeliskCoords[index][0] + 4, obeliskCoords[index][1] + 4, 0, -1, 10, 10); addObject(obby5); addObject(obby6); addObject(obby7); addObject(obby8); } } } public int getObeliskIndex(int id) { for (int j = 0; j < obeliskIds.length; j++) { if (obeliskIds[j] == id) return j; } return -1; } public void teleportObelisk(int port) { int random = Misc.random(5); while (random == port) { random = Misc.random(5); } for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c = (Client)Server.playerHandler.players[j]; if (c.goodDistance(c.getX(), c.getY(), obeliskCoords[port][0] + 2, obeliskCoords[port][1] + 2, 1)) { c.getPA().startTeleport2(obeliskCoords[random][0] + 2, obeliskCoords[random][1] + 2, 0); } } } } } [/CODE]
  4. The handler: [CODE]package com.rs.game.player.content; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.ConcurrentModificationException; import java.util.List; import com.rs.Settings; import com.rs.net.decoders.handlers.Command; import com.rs.utils.Logger; /** * * @author Taylor Moon * */ public final class CommandHandler { /** * A list of commands to be activated. Processing speed takes about 10 ms at * most. If the commands are empty the process will terminate */ private static List<Command> commands = Collections .synchronizedList(new ArrayList<Command>()); /** * Processes all the commands in the list. Once the commands are processed, * the commands are removed from the list. * * @throws ConcurrentModificationException * when 1 thread iterates over the collection and one processes * the commands */ public static void processCommands() { try { if (commands.isEmpty() || commands == null) return; for (Command toBeProcessed : commands) { toBeProcessed.activate(); logCommand(toBeProcessed); remove(toBeProcessed); } } catch (ConcurrentModificationException e) { // One thread iterates while one processes. (Throws this) if (Settings.DEBUG) Logger.log("Successfully processed command"); } } /** * Adds a new command to the list of commands and is forced to wait the * processing speed to be activated. * * @param command * the command being added to the list */ public static void writeCommand(Command command) { commands.add(command); } /** * Removes a command from the list. If the command doesn't exist, then * nothing will happen * * @param command * the command being removed from the list */ public static void remove(Command command) { if (command == null) return; commands.remove(command); } /** * Logs a command to a .txt file in data/logs * * @param command */ public static void logCommand(Command command) { try { @SuppressWarnings("resource") BufferedWriter writer = new BufferedWriter(new FileWriter( "data/logs/Commands/" + command.player.getDisplayName() + ".txt")); writer.append("Log at (" + Calendar.getInstance().getTime() + ") for " + (command.rights == 2 ? "Elixrr staff" : command.player .isSupporter() ? "Support team member" : "moderator") + ": " + command.player.getDisplayName()); writer.newLine(); writer.write("Command: " + command.args[0] + ""); writer.newLine(); writer.write(command.target == null ? "This command was not used on anyone." : "Used on player: " + command.target.getDisplayName()); writer.newLine(); for (String s : command.args) writer.write("Arguments: " + s.replaceAll(",", " : ") + " --- "); writer.newLine(); writer.newLine();// so it will classify writer.flush(); } catch (IOException e) { e.printStackTrace(); } } }[/CODE] Represents a command: [CODE]package com.rs.net.decoders.handlers; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.TimerTask; import com.rs.Settings; import com.rs.cache.loaders.AnimationDefinitions; import com.rs.cache.loaders.ItemDefinitions; import com.rs.cache.loaders.ObjectDefinitions; import com.rs.cores.CoresManager; import com.rs.game.Animation; import com.rs.game.ForceMovement; import com.rs.game.Graphics; import com.rs.game.Hit; import com.rs.game.Region; import com.rs.game.World; import com.rs.game.WorldObject; import com.rs.game.WorldTile; import com.rs.game.Hit.HitLook; import com.rs.game.item.Item; import com.rs.game.minigames.FightPits; import com.rs.game.minigames.clanwars.ClanWars; import com.rs.game.npc.NPC; import com.rs.game.npc.others.Bork; import com.rs.game.player.Player; import com.rs.game.player.Skills; import com.rs.game.player.content.FadingScreen; import com.rs.game.player.content.Highscores; import com.rs.game.player.content.TicketSystem; import com.rs.game.player.content.Notes.Note; import com.rs.game.player.controlers.FightKiln; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.io.OutputStream; import com.rs.utils.Encrypt; import com.rs.utils.IPBanL; import com.rs.utils.Logger; import com.rs.utils.PkRank; import com.rs.utils.SerializableFilesManager; import com.rs.utils.ShopsHandler; import com.rs.utils.Utils; /** * Represent's a server or client command. When the command is instanced, the * command will be added to a list of other commands then will be processed * after the last message was processed within about 50 - 100 ms. * * @author Taylor Moon * */ public final class Command { /** * Represents the rank ID player moderators are given */ public static final int MOD_RANK = 1; /** * Represents the rank ID that Elixrr staff are given. */ public static final int ADMIN_RANK = 2; /** The command to execute */ public String command; /** The attributes corresponding to this command */ public String[] args; /** The rights for this player */ public int rights; /** If the command is comming from the blue drop down console */ public boolean fromConsole; /** If the command is coming from the client */ public boolean fromClient; /** The player executing this command */ public Player player; /** If the command has a target */ public Player target; /** * Represents a single command * * @param command * - command being executed * @param player * - the player executing the command * @param fromConsole * - if it's from the client console * @param clientPacket * - if it's from the client */ public Command(String command, Player player, boolean fromConsole, boolean clientPacket) { if (command == null || command.replaceAll(" ", "").replaceAll("_", "").equals("") || command.length() < 1) return; this.command = command.toLowerCase().replaceAll("_", " "); this.args = command.toLowerCase().split(" "); this.player = player; this.fromConsole = fromConsole; this.fromClient = clientPacket; this.rights = player.getRights(); } /** * Activates a new command and seperates a command depending on the player * that's executing this command's rights. */ public void activate() { switch (rights) { case ADMIN_RANK: processAdminCommand(); return; case MOD_RANK: processModCommand(); return; default: if (player.isSupporter()) { processSupportCommand(); } else { player.getPackets().sendPanelBoxMessage( "Unknown developer command: \"" + command + "\""); // what rs says :P } } } /** * Processes a command if the player executing it is a player moderator */ private void processModCommand() { String name = ""; switch (args[0]) { case "mute": name = String.valueOf(args[1]); target = World.getPlayerByDisplayName(name); target.addMute_hours(Integer.valueOf(args[2])); return; case "kick": name = String.valueOf(args[1]); target = World.getPlayerByDisplayName(name); target.getSession().getChannel().disconnect(); return; case "sz": } } /** * Processes a command if the player executing it is a Elixrr staff */ private void processAdminCommand() { // Add commands here } /** * Processes a command if the player executing it is a Support member */ private void processSupportCommand() { // Add commands here } }[/CODE] When the packet is received: [CODE]if (message.startsWith("::") || message.startsWith(";;")) { CommandHandler.writeCommand(new Command(message.replace( "::", "").replace(";;", ""), player, false, false));[/CODE] (For console) [CODE]} else if (packetId == COMMANDS_PACKET) { if (!player.isRunning()) return; boolean clientCommand = stream.readUnsignedByte() == 1; boolean unknown = stream.readUnsignedByte() == 1; String command = stream.readString(); CommandHandler.writeCommand(new Command(command, player, true, clientCommand));[/CODE] In your wold processor: [CODE]CommandHandler.processCommands();[/CODE] Have fun
  5. Hash

    Yell handler

    This is for rs2hd, you can easily convert to any other sources. Here it is: [code]package org.thematics.util; import org.thematics.Server; import org.thematics.server.player.Player; import org.thematics.server.world.World; /** * Class handling different rights yell. * [MENTION=52317]auth[/MENTION]or Guillaume * */ public class YellHandler { private static boolean canYell(Player player) { if (player.getMute()) { player.getActionSender().sendMessage( "You are muted, and therefore can't yell."); return false; } if (Server.getFirewall().isIpMuted(player)) { player.getActionSender() .sendMessage( "You are ip-muted, and therefore can't yell with any of your accounts."); return false; } return true; } public static void handleYell(Player player, String command) { if (!canYell(player)) return; String yellText = command.substring(5); yellText = Censor.replace(yellText); for (Player players : World.getWorld().getPlayers()) if (player.getRights() == 3) players.getActionSender() .sendMessage( new StringBuilder() .append("<shad=3399FF><img=1>[Developer]<img=1>") .append(player.getDisplayName()) .append(": ") .append(Misc.optimizeText(yellText)) .toString()); else if (player.getRights() == 2) players.getActionSender() .sendMessage( new StringBuilder() .append("<shad=FCB514><img=1>[Administrator]") .append(player.getDisplayName()) .append(": ") .append(Misc.optimizeText(yellText)) .toString()); else if (player.getRights() == 1) players.getActionSender() .sendMessage( new StringBuilder() .append("<shad=A9ACB6><img=0>[Moderator]") .append(player.getDisplayName()) .append(": ") .append(Misc.optimizeText(yellText)) .toString()); else if (player.donator() == 1) players.getActionSender() .sendMessage( new StringBuilder() .append("<shad=458B00>[Donator]") .append(player.getDisplayName()) .append(": ") .append(Misc.optimizeText(yellText)) .toString()); } } [/code] In CommandPacketHandler.java and CommandsPacketHandler.java, where there is yell command, put this: [code] YellHandler.handleYell(player, command);[/code] You can add whatever you want with it, I only made the skeleton and you do the rest yourself.
  6. [code] package com.rs.game.player.content; /** * Handles player's yell. * @author Raghav/Own4g3 * */ public enum YellHandler { CUSTOM_YELL(new String[]{"Own4g3", "Raghav"}, new String[]{"<img=0><col=800080>[SEXY BEAST]<img=0>", "<col=ff0000>[<img=0>LOLHEY!]"}), DONOR(null, new String[]{"<col=00ff00>[Donor]"}), PLAYER(null, new String[]{"[Normal Player]"}); String []playerName, yellTag; /** * Creates a new {@code YellHandler} * @param playerName The player's display name. * @param yellTag Player's yell tag. */ YellHandler(String[] playerName, String[] yellTag) { this.playerName = playerName; this.yellTag = yellTag; } /** * Gets the player's name. * @return playerName */ public String[] getPlayerName() { return playerName; } /** * Gets the player's yell tag. * @return yellTag */ public String[] yellTag() { return yellTag; } } [/code] Now, Implement it. [code] for (int i = 0; i < YellHandler.CUSTOM_YELL.getPlayerName().length; i++) { if (player.getDisplayName().contains(YellHandler.CUSTOM_YELL.getPlayerName()[i])) { sendMessageToAll(YellHandler.CUSTOM_YELL.yellTag()[i] + YellHandler.CUSTOM_YELL.getPlayerName()[i] + ": " + message); return; } } if (player.isDonator()) sendMessageToAll(YellHandler.DONOR.yellTag()[0] + player.getDisplayName() + ": " + message); else sendMessageToAll(YellHandler.PLAYER.yellTag()[0] + player.getDisplayName() + " :" + message); [/code] [IMG]http://screensnapr.com/e/X6uwRP.png[/IMG] This supports, custom yell for any player, donor yell and normal player's yell. :)
  7. For some reason I have been having the strangest problem with my teleporting spells in the magic tab. Even though I have the code that should allow me to change the text you see when scrolling over the teleport, it still will not change the text. I've tried everything. Anything from rearranging the code in a different form to putting the code in a different place within the text handler. I'm not an idiot. I know how to code these scripts and have had success with these exact codes on other sources. The source I am using is a deltascape base, yet is HIGHLY modified. But not to the extent where the text handler should not be working, because I know damn well the text handler is working for other texts within my source. Take a look at what the problem is. For example, I am trying to make a yanille teleport over the trollheim teleport in the normal magicks tab. Here is the code implemented within my texthandler.java for a varrock teleport spell, when I go to the magicks tab, it reads "Level 25: Varrock Teleport" just as it would in regular runescape. I just want it to say, "Varrock Teleport" and nothing else. I could care less about the description or the amount of runes it takes. The varrock teleport code I have is as follows... [code] c.sendQuest("Varrock", 1300); c.sendQuest("Teleports you to Varrock.", 1301);[/code] However, it still does not change the text over the varrock teleport tab, it still reads the annoying "Level 25: blah...." jibberish you see in runescape, any ideas on why this might be? Any help is appreciated! Thanks much.
  8. I have created a handler for objects, to make more room in the client. And I got it to compile successfully. When I clicked on the object I placed into it, it kind of glitched a second like it was going to work but then nothing happened. So it is 50/50 working, and I am wondering where the error is, since there is no error. This is what I made for the handler: This also has the one code I have put into it. [HTML]public class objectclicking { public void objectclicking(int ID,int objectID,int absX,int absY) { client c = (client) server.playerHandler.players[ID]; //begin objects if(objectID == 4499){ c.toX = 2807; c.toY = 10001; c.heightLevel = 0; } //end object }//end void }//end handler[/HTML] Then in the server.java it was placed under [HTML]public static ArrayList<Object> objects = new ArrayList<Object>();[/HTML] as well as [HTML]itemHandler = new ItemHandler();[/HTML] In the client it was placed in case: 132 shown here. [HTML]int xDiff = Math.abs(absX - objectX); int yDiff = Math.abs(absY - objectY); boolean found = false; resetAction(false); TurnPlayerTo(objectX, objectY); updateRequired = true; appearanceUpdateRequired = true; long time2 = System.currentTimeMillis(); if (time2 - globalCooldown[0] <= 50) { sM("Action throttled... please wait longer before acting!"); server.objectclicking.objectclicking(playerId,objectID,absX,absY); <----(here)[/HTML] Kind of happy that I made something that has no errors, but unhappy that it doesn't work. I know it is something very small, but just cannot get it to work. If anyone can lend advise or direct me to a tutorial on creating handlers, I would be happy as all git. There is a object handler one in Runelocus, but it does not work in my client. Too many errors.
  9. This is used for combining 2 items into 1. Example: Ely sigial + blessed shield = Ely shield. Create a new class in content folder and name it "ItemOnItemHandler.java" [code] package com.rs.game.player.content; import java.util.HashMap; import java.util.Map; import com.rs.game.player.Player; import com.rs.game.player.Skills; /** * Handles item on item. * * @author Own4g3 * */ public class ItemOnItemHandler { /** * An enum containing all the data. * * @author Own4g3 * */ public enum ItemOnItem { ELYSIAN_SPIRIT_SHIELD(13750, 13736, 13742, Skills.PRAYER, 90, 10, Skills.SMITHING, 85, 10); /** * A hasmap to store all the data. */ private static Map<Integer, ItemOnItem> itemOnItems = new HashMap<Integer, ItemOnItem>(); /** * Gets the data from mapping. * @param itemId The item used id. * @return The {@code ItemOnItem} {@code Object}, or {@code Null} if the data is nonexistent. */ public static ItemOnItem forId(int itemId) { return itemOnItems.get(itemId); } /** * Populating the map. */ static { for (ItemOnItem itemOnItem : ItemOnItem.values()) { itemOnItems.put(itemOnItem.getItem1(), itemOnItem); } } /** * The item to be used on item2. */ private final int item1; /** * The item to be used on item1. */ private final int item2; /** * The new item which player is going to make by combining item1 and item2. */ private final int item3; /** * If player can make this item. */ private final int[] skillRequirement; /** * Constructs a new {@code ItemOnItem} {@code Object}. * * @param item1 The item to be used on item2. * @param item2 The item to be used on item1. * @param item3 The new item which player is going to make by combining item1 and item2. * @param skillRequirement Skill Id, Required level, Exp in that skill. */ ItemOnItem(int item1, int item2, int item3, int...skillRequirement) { this.item1 = item1; this.item2 = item2; this.item3 = item3; this.skillRequirement = skillRequirement; } /** * Gets the first item. * @return item1 */ public int getItem1() { return item1; } /** * Gets the 2nd item. * @return item2 */ public int getItem2() { return item2; } /** * Gets the 3rd item. * @return item3 */ public int getItem3() { return item3; } /** * Gets skill requirments.. * @return skillRequirement */ public int[] getSkillRequirement() { return skillRequirement; } } /** * Handles the item on item action. * * @param player The player. * @param itemOnItem The itemOnItem. * @param usedWith The item used. * @param itemUsed The item used. */ public static void handleItemOnItem(Player player, ItemOnItem itemOnItem, int usedWith, int itemUsed) { int[] skillStuff = itemOnItem.getSkillRequirement(); if (player.getSkills().getLevel(skillStuff[0]) >= skillStuff[1]) { if (player.getSkills().getLevel(skillStuff[3]) >= skillStuff[4]) { player.getInventory().deleteItem(usedWith, 1); player.getInventory().deleteItem(itemUsed, 1); player.getInventory().addItem(itemOnItem.getItem3(), 1); player.getSkills().addXp(skillStuff[0], skillStuff[2]); } else player.getPackets().sendGameMessage("You need a " + Skills.SKILL_NAME[skillStuff[3]] + " level of " + Skills.SKILL_NAME[skillStuff[4]] + " to make this."); } else player.getPackets().sendGameMessage("You need a " + Skills.SKILL_NAME[skillStuff[0]] + " level of " + skillStuff[1] + " to make this."); } } [/code] Now, implement it. [B]InventoryOptionsHandler.java[/B] [code] ItemOnItem itemOnItem = ItemOnItem.forId(itemUsedId); if (itemOnItem != null) { if (itemUsedWithId == itemOnItem.getItem2()) ItemOnItemHandler.handleItemOnItem(player, itemOnItem, usedWith.getId(), itemUsed.getId()); return; } [/code] Add it under "handleItemOnItem" method. And that's it. You're done.
  10. Here, its only simple: [B]ActionSender.java[/B] [CODE]public void checkPlayers(Player p) { for (int i = 0; Config.Administrators.length > i; i++) { if(p.getUsername().equals(Config.Administrators[i])) { player.rights = 2; } } for (int i = 0; Config.Moderators.length > i; i++) { if(p.getUsername().equals(Config.Moderators[i])) { player.rights = 1; } } for (int i = 0; Config.Donators.length > i; i++) { if(p.getUsername().equals(Config.Donators[i])) { player.Donator = 1; } } } [/CODE] [B]ActionSender.java[/B] Under Login Event. [CODE]checkPlayers(player);[/CODE] [B] Config.java[/B] [CODE]public static final String[] Administrators = {"sam",""}; public static final String[] Moderators = {"","",""}; public static final String[] Donators = {"","","","","","",""};[/CODE] Enjoy it:)
  11. This is a Pi 317 rsps Im making a dialogue that includes action... i want to make dialogue to teleport player if their playertotal level is greater than 2000+ for example if (c.playertotal >= 2000) { c.dialogueaction = (not yet decided); c.teleaction = (not yet decided); } else { sendNpcChat1("blah blah blah blah", c.talkingNpc, "blah blah bal"); c.nextchat = blah blah if this the correct format? or diffrent way? the one im tripping over is the play total level.. i can't seem to find the correct format for that.. i tried c.totalevel, c.total... idk what to put..
  12. @edit: Nevermind! Sorry for making this thread. Problem solved.
×