Jump to content

Search the Community

Showing results for tags 'handling'.



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 8 results

  1. Should be easy to figure out. May have bugs or not work, I haven't tested it but would like others to post the results! Create a new class and add this in it and name that class TeleportHandler.java: package com.rs.game.player.content; import com.rs.game.WorldTile; import com.rs.game.player.Player; import com.rs.utils.Logger; /** * * @author LionScape * */ public class TeleportHandler { public static void init() { Logger.log("TeleportHandler", "All teleports have been configured."); } /** * X */ public static int[] X = { 3213, 3093, 3222, 2757, 2964, 3093}; /** * Y */ public static int[] Y = { 3423, 3493, 3218, 3477, 3378, 3244}; /** * Teleport method. */ private static void teleport(int a, int b, int c) { getPlayer().setNextWorldTile(new WorldTile(a, b, c)); getPlayer().stopAll(); } /** * Plane */ public static int[] Z = { 0, 1, 2, 3 }; /** * Varrock */ public static void gotoVarrock() { out("You teleport to Varrock."); teleport(X[1],Y[1],Z[1]); } /** * Edgeville */ public static void gotoEdgeville() { out("You teleport to Edgeville."); teleport(X[2],Y[2],Z[1]); } /** * Lumbridge */ public static void gotoLumbridge() { out("You teleport to Lumbridge."); teleport(X[3],Y[3],Z[1]); } /** * Camelot */ public static void gotoCamelot() { out("You teleport to Camelot."); teleport(X[4],Y[4],Z[1]); } /** * Falador */ public static void gotoFalador() { out("You teleport to Falador."); teleport(X[5],Y[5],Z[1]); } /** * Draynor Village */ public static void gotoDraynor() { out("You teleport to Draynor."); teleport(X[6],Y[6],Z[1]); } /** * Message method. */ private static void out(String text) { getPlayer().getPackets().sendGameMessage(text); } /** * Player getPlayer() */ private static Player getPlayer() { return getPlayer(); } } =========================================== Add this return method in Player.java =========================================== public TeleportHandler getTH() { return getTH(); } To use this system: Add this in any class, case or method you want. Switch out CITYNAMEHERE with your city of choice. Draynor, Lumbridge, Edgeville, Varrock etc. player.getTH().gotoCITYNAMEHERE(); Just thought this could be a simple way to teleport to places instead of using the old: player.setNextWorldTile(new WorldTile(x, y, z));
  2. Awhile ago i made a teleport handler that wasn't the best. But im back with a better teleport handler. First off add this class Fix the imports and the packaging [CODE]package org.rs2server.entity.players.teleport; import org.rs2server.Config; import org.rs2server.entity.players.Client; import org.rs2server.entity.players.PlayerHandler; import org.rs2server.event.CycleEvent; import org.rs2server.event.CycleEventContainer; import org.rs2server.event.CycleEventHandler; /** * This class will handle all everything to do with the teleporting * it will check if the player is eligible to teleport and * handle all the animations and gfxs. * @author Zack/Optimum * */ public class Teleport { /** * The player teleporting */ private Client player; /** * The targeted x, y and h coordinates */ private int targetX, targetY, targetH; /** * Constructor for teleporting * [MENTION=75098]Para[/MENTION]m player - the player */ public Teleport(Client player){ this.player = player; } /** * Submits a new teleport tab type * [MENTION=75098]Para[/MENTION]m tarX - the new x coordinates * [MENTION=75098]Para[/MENTION]m tarY - the new y coordinates */ public void submitTab(final int tarX, final int tarY){ this.targetX = tarX; this.targetY = tarY; startTeleport(TeleportType.TELETAB_TELEPORT); } /** * Submits a new ancient teleport type * [MENTION=75098]Para[/MENTION]m tarX - the new x coordinates * [MENTION=75098]Para[/MENTION]m tarY - the new y coordinates */ public void submitAncient(final int tarX, final int tarY){ this.targetX = tarX; this.targetY = tarY; startTeleport(TeleportType.ANICENT_TELEPORT); } /** * Submits a new ancient teleport type * [MENTION=75098]Para[/MENTION]m tarX - the new x coordinates * [MENTION=75098]Para[/MENTION]m tarY - the new y coordinates * [MENTION=75098]Para[/MENTION]m tarH - the new height */ public void submitAncient(final int tarX, final int tarY, final int tarH){ this.targetX = tarX; this.targetY = tarY; this.targetH = tarH; startTeleport(TeleportType.ANICENT_TELEPORT); } /** * Submits a new modern teleport * [MENTION=75098]Para[/MENTION]m tarX - the new x coordinates * [MENTION=75098]Para[/MENTION]m tarY - the new y coordinates */ public void submitModern(final int tarX, final int tarY){ this.targetX = tarX; this.targetY = tarY; startTeleport(TeleportType.MODERN_TELEPORT); } /** * Submits a new modern teleport * [MENTION=75098]Para[/MENTION]m tarX - the new x coordinates * [MENTION=75098]Para[/MENTION]m tarY - the new y coordinates * [MENTION=75098]Para[/MENTION]m tarH - the new height */ public void submitModern(final int tarX, final int tarY, final int tarH){ this.targetX = tarX; this.targetY = tarY; this.targetH = tarH; startTeleport(TeleportType.MODERN_TELEPORT); } /** * Handles the teleport event in 3 stages */ public void startTeleport(final TeleportType teleType){ if(!canTeleport(player)) return; final int startStage = teleType.getTickTimer1Start(); final int middleStage = teleType.getTickTimer2Start(); final int stopStage = teleType.getStopTimer(); cancelTradeAndDuel(player); player.stopMovement(); player.isTeleporting = true; player.startAnimation(teleType.getStartGfxAnim()[0]); if(teleType.getStartGfxAnim()[2] == 100) player.gfx100(teleType.getStartGfxAnim()[1]); else player.gfx0(teleType.getStartGfxAnim()[1]); CycleEventHandler.getSingleton().addEvent(player, new CycleEvent() { int stage = 0; [MENTION=15855]Over[/MENTION]ride public void execute(CycleEventContainer container) { if (stage == startStage) { player.startAnimation(teleType.getTimer1GfxAnim()[0]); if(teleType.getTimer1GfxAnim()[2] == 100) player.gfx100(teleType.getTimer1GfxAnim()[1]); else player.gfx0(teleType.getTimer1GfxAnim()[1]); } if (stage == middleStage){ player.startAnimation(teleType.getTimer2GfxAnim()[0]); if(teleType.getTimer2GfxAnim()[2] == 100) player.gfx100(teleType.getTimer2GfxAnim()[1]); else player.gfx0(teleType.getTimer2GfxAnim()[1]); player.getPA().movePlayer(targetX, targetY, targetH); } if(stage == stopStage){ player.startAnimation(65535); player.resetWalkingQueue(); container.stop(); } stage++; System.out.println("Teleport Stage: " + stage); } [MENTION=15855]Over[/MENTION]ride public void stop() { player.isTeleporting = false; } }, 1); } /** * Checks to see if the player is eligible for teleporting * [MENTION=75098]Para[/MENTION]m player - The target player * [MENTION=184045]return[/MENTION] true if the player can teleport */ public boolean canTeleport(Client player){ if(player == null) return false; if(player.isDead) return false; if (isDueling(player)) return false; if(isTeleBlocked(player)) return false; if(player.isTeleporting) return false; if(wildyLevelCheck(player)) return false; return true; } /** * Checks to see if the player is in a duel * [MENTION=75098]Para[/MENTION]m player - The target player * [MENTION=184045]return[/MENTION] true if the player is in a duel */ public boolean isDueling(Client player){ if (player.duelStatus == 5) { player.sendMessage("You can't teleport during a duel!"); return true; } else return false; } /** * Checks if the player is teleblocked * [MENTION=75098]Para[/MENTION]m player - The target player * [MENTION=184045]return[/MENTION] true if player is teleblocked */ public boolean isTeleBlocked(Client player){ if (System.currentTimeMillis() - player.teleBlockDelay < player.teleBlockLength) { player.sendMessage("You are teleblocked and can't teleport."); return true; } else return false; } /** * Cancels the trade and duel for {@link player} and * the opponent he is dueling / trading with * [MENTION=75098]Para[/MENTION]m player - the target player */ public void cancelTradeAndDuel(Client player){ if (player.duelStatus >= 1 && player.duelStatus <= 4) { Client o = (Client) PlayerHandler.players[player.duelingWith]; player.duelStatus = 0; o.duelStatus = 0; o.getTradeAndDuel().declineDuel(); player.getTradeAndDuel().declineDuel(); } } /** * Checks the current player wilderness level and returns true * if the player is above the max teleport wilderness level * [MENTION=75098]Para[/MENTION]m player - The target player * [MENTION=184045]return[/MENTION] if player is in wildy > 20 */ public boolean wildyLevelCheck(Client player){ if (player.inWild() && player.wildLevel > Config.NO_TELEPORT_WILD_LEVEL) { player.sendMessage("You can't teleport above level " + Config.NO_TELEPORT_WILD_LEVEL + " in the wilderness."); return true; } else return false; } } [/CODE] Now add this class inside the same package [CODE]package org.rs2server.entity.players.teleport; /** * Contains all the teleport types and all their data * @author Zack/Optimum * */ public enum TeleportType { MODERN_TELEPORT( new int[] {714, -1, 0}, 1, new int[] {-1, 308, 100}, 3, new int[] {715, -1, 0}, 6), ANICENT_TELEPORT( new int[] {9599, 1681, 0}, 5, new int[] {-1, -1, 0}, 5, new int[] {-1, -1, 0}, 5), TELETAB_TELEPORT( new int[] {9597, 1680, 0}, 2, new int[] {4731, -1, 0}, 3, new int[] {9598, -1, 0}, 4); int[] startGfxAnim; int tickTimer1Start; int[] timer1GfxAnim; int tickTimer2Start; int[] timer2GfxAnim; int stopTimer; TeleportType(int[] startGfxAnim, int tickTimer1Start, int[] timer1GfxAnim, int tickTimer2Start, int[] timer2GfxAnim, int stopTimer){ this.startGfxAnim = startGfxAnim; this.tickTimer1Start = tickTimer1Start; this.timer1GfxAnim = timer1GfxAnim; this.tickTimer2Start = tickTimer2Start; this.timer2GfxAnim = timer2GfxAnim; this.stopTimer = stopTimer; } public int[] getStartGfxAnim(){ return startGfxAnim; } public int getTickTimer1Start(){ return tickTimer1Start; } public int[] getTimer1GfxAnim(){ return timer1GfxAnim; } public int getTickTimer2Start(){ return tickTimer2Start; } public int[] getTimer2GfxAnim(){ return timer2GfxAnim; } public int getStopTimer(){ return stopTimer; } } [/CODE] now go to Client.java and add these: [code] private Teleport teleport = new Teleport(this); public Teleport getTeleportHandler(){ return teleport; }[/code] this is an example of how to use this: [code] case 4171: case 117048: case 75010: case 50056: case 84237: if(c.playerMagicBook != 1) { c.getTeleportHandler().submitModern(Config.RESPAWN_X, Config.RESPAWN_Y); } else { c.getTeleportHandler().submitAncient(Config.RESPAWN_X, Config.RESPAWN_Y); } break;[/code] If i have missed anything please tell me.
  3. Add new java file called AbstractMinigame. package server.model.minigames; [CODE]package server.model.minigames; import server.model.players.Client; /** * * @author Fuzen Seth * [MENTION=98951]infor[/MENTION]mation s */ public abstract class AbstractMinigame { /** Returns to the minigame's name.*/ public abstract String getName(); /** Start the minigame. */ public abstract void start(Client client); /** Force stops the minigame. */ public abstract void forceStop(Client client); /** Displays the interfaces that are used in the minigame. */ public abstract void displayInterfaces(Client client); } [/CODE] This is a example of the mage arena minigame. It's a simple start. [CODE]package server.model.minigames.impl; import server.model.minigames.AbstractMinigame; import server.model.players.Client; /** * * @author Fuzen Seth * [MENTION=98951]infor[/MENTION]mation Mage arena minigame. * [MENTION=3199]Sin[/MENTION]ce 23.8.2014 */ public class MageArena extends AbstractMinigame { /** AbstractMinigame is the super class. */ public MageArena() { super(); } /** Name of the minigame. */ [MENTION=15855]Over[/MENTION]ride public String getName() { return "Mage arena"; } /** Starts the mage arena minigame. */ [MENTION=15855]Over[/MENTION]ride public void start(Client client) { } /** Force stops the minigame. */ [MENTION=15855]Over[/MENTION]ride public void forceStop(Client client) { // TODO Auto-generated method stub } /** The minigame's fighting state. */ public enum FightState { NOT_STARTED, IN_BATTLE, FINISHED; } /** This minigame doesn't use any interfaces. */ [MENTION=15855]Over[/MENTION]ride public void displayInterfaces(Client client) { } } [/CODE]
  4. [B]package server.world;[/B] [CODE]package server.world; import java.util.ArrayList; import server.configuration.Configuration; import server.event.Event; import server.event.EventContainer; import server.event.EventManager; import server.model.npcs.NPC; import server.model.players.Client; import server.model.players.EmotesManager; import server.model.players.Player; import server.util.Misc; /** * * @author Fuzen Seth * [MENTION=3199]Sin[/MENTION]ce 21.8.2014 */ public class World { /** Represents the connected world players*/ private static final ArrayList<Client> players = new ArrayList<>(); /** Initializes the World.*/ public static void init() { addServerMessageTask(); addCleanMemoryTask(); } /** Spawns a new world NPC. */ public static void spawnNPC(int id, int type, int x, int y, int plane) { NPC npc = new NPC(id, type); npc.makeX = x; npc.makeY = y; npc.heightLevel = plane; } /** The message task. */ public static void addServerMessageTask() { final String[] MESSAGES = { "Did you know? Theres a castle in lumbridge.", "Did you know? High level players are better.", "Did you know? There is many minigames to explore."}; EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer e) { for (Client players : getPlayers()) { players.sendMessage(MESSAGES[Misc.random(MESSAGES.length - 1)]); return; } } }, 25000); } public static void addCleanMemoryTask() { EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer e) { System.gc(); System.out.println(""+Configuration.NAME+"'s memory cleaned."); } }, 25000); } /** Moves all world players to given coordinate.*/ public static void movePlayers(int x, int y, int plane) { for (Client players : getPlayers()) { players.getPlayerAssistant().movePlayer(x, y, plane); } } /** Adds a new world player.*/ public static void addPlayer(Client player) { if (getPlayers().size() < 2000) return; players.add(player); } /** Removes a world player. */ public static void removePlayer(Client player) { players.remove(player); } /** [MENTION=184045]return[/MENTION] world players */ public static ArrayList<Client> getPlayers() { return players; } } [/CODE]
  5. Utils.java [CODE]public static int calculatePercent(double a, double b, int trials) { double syntax = 100 * a / b; double ratio = syntax / trials; Math.floor(ratio); return (int) ratio; }[/CODE] [CODE]public static int getRandomCommon() { int ran = Utils.random(6); if(ran == 1) { return 0; } else if(ran == 2) { return 3; } else if(ran == 3) { return 5; } else if(ran == 4) { return 7; } else if(ran == 5) { return 9; } else if(ran == 6) { return 11; } else { return 1; } } public static int getRandomUncommon() { int ran = Utils.random(3); if(ran == 1) { return 0; } else if(ran == 2) { return 2; } else { return 10; } } public static int getRandomRare() { int ran = Utils.random(3); if(ran == 1) { return 4; } else if(ran == 2) { return 8; } else { return 12; } } private static int getSpinChances() { int common = Utils.random(10, 12); int uncommon = Utils.random(10, 20); int rare = Utils.random(0, 40); int superRare = Utils.random(0, 3333);// it would take 2000 spins ~ to get a super rare in RS if(common == 10 || common == 11) { return getRandomCommon(); } else if(common != 10 || common != 11 && uncommon == 11 || uncommon == 14) { return getRandomUncommon(); } else if(common != 10 || common != 11 && uncommon != 11 || uncommon != 14 && rare == 12% 100 || rare == (10)) { return getRandomRare(); } else if(common != 10 || common != 11 && uncommon != 11 || uncommon != 14 && rare != 12% 100 || rare != (10) && superRare == Utils.calculatePercent(1, .333, 2)) {//2 sof spins p/day return 6;//super rare } else { return getRandomCommon(); } } [/CODE] i did as much research as possible, so this is as accurate as I could get it [video]http://tinypic.com/player.php?v=vg4rnt&s=6[/video]
  6. Alright i need help handling and object problem i just ran into. I'll explain it. Also the object that i'm trying to code was, how do i say it...... It's already in the mapdata? Lol i don't know how to put it but i hope you know what i mean like it was already there in the server. Alright example: Suppose the object Id is: 69 (Just an example). And i made it so that when you click it, it teleports you say to the grand exchange but the same object is there (Object 69) I want to make the same object on the other side teleport you back to where i first came from. Say i clicked the object then it teleported me near the same object at the grand exchange but the same object/Id is there i want to make that object/Id teleport me back from where i first came from. Damn i hope that wasn't to confusing but i need help with that lol. Thanks in advanced.
  7. Create a new class called "Specials" and paste this inside of it. [CODE]package server.model.players; import server.model.players.Client; import server.model.players.CombatAssistant; import java.util.HashMap; import server.util.Misc; import server.Config; import server.Server; import server.model.npcs.NPCHandler; import server.model.npcs.NPC; /* * * Created by L A * */ public class Specials { private Client c; public Specials(Client c) { this.c = c; } private enum specialAttack { //ItemName(ItemId, SpecDamage, SpecAccuracy, SpecAmount, Anim, GFX0, GFX100, DoubleHit, SsSpec, SpecEffect) ABYSSAL_WHIP(4151, 1, 1, 5, 1658, 341, -1, false, false, 0), DRAGON_DAGGER(1215, .95, 1.15, 2.5, 1062, -1, 252, true, false, 0), DRAGON_DAGGER_P(1231, .85, 1.15, 2.5, 1062, -1, 252, true, false, 0), DRAGON_DAGGER_PP(5698, .85, 1.15, 2.5, 1062, -1, 252, true, false, 0), DRAGON_DAGGER_PPP(5680, .85, 1.15, 2.5, 1062, -1, 252, true, false, 0), DRAGON_LONG(1305, 1.20, 1.10, 2.5, 1058, -1, 248, false, false, 0), DRAGON_MACE(1434, 1.55, .85, 2.5, 1060, -1, 251, false, false, 0), DRAGON_SCIMITAR(4587, 1, 1, 2.5, 1872, -1, 347, false, false, 1), DRAGON_HALBERD(3204, 1.25, .85, 3.3, 1203, -1, 282, true, false, 0), BARRELCHEST_ANCHOR(10887, 1.55, 1.05, 5, 5870, -1, 1027, false, false, 0), GRANITE_MAUL(4153, 1.10, .85, 5, 1667, -1, 337, false, false, 0), KORASIS_SWORD(18786, 1.55, 1.55, 5.5, 1872, -1, 1224, false, false, 0), ARMADYL_GODSWORD(11694, 1.55, 1.75, 5, 7074, 1222, -1, false, false, 0), BANDOS_GODSWORD(11696, 1.35, 1.75, 10, 7073, 1223, -1, false, false, 3), SARADOMIN_GODSWRD(11698, 1.35, 1.75, 5, 7071, 1220, -1, false, false, 4), ZAMORAK_GODSWORD(11700, 1.35, 1.75, 5, 7070, 1221, -1, false, false, 2), SARADOMIN_SWORD(11730, 1.10, 1.35, 10, 7072, -1, 1224, true, true, 0), VESTAS_LONGSWORD(13899, 1.55, 1.35, 2.5, 10502, -1, -1, false, false, 0), VESTAS_SPEAR(13905, 1.35, 1.45, 5, 10499, 1835, -1, false, false, 5), STATIUSS_WARHAMMER(13902, 1.55, 1.25, 3.3, 10505, 1840, -1, false, false, 0), MORRIGANS_JAVELIN(13879, 1.55, 1.25, 5, 10501, 1836, -1, false, false, 7), MORRIGANS_THROWNAXE(13883, 1.55, 1.25, 2.5, 10504, 1838, -1, false, false, 0), MAGIC_SHORTBOW(861, 1.05, .95, 5.5, 1074, -1, -1, true, false, 0), MAGIC_LONGBOW(859, 1.20, 1.05, 5.5, 426, -1, -1, false, false, 0), DARK_BOW(11235, 1.35, 1.35, 5.5, 426, -1, -1, true, false, 0), HAND_CANNON(15241, 1.45, 1.25, 5, 12175, 2138, -1, false, false, 0); private int weapon, anim, gfx1, gfx2, specEffect; private double specDamage, specAccuracy, specAmount; private boolean doubleHit, ssSpec; private specialAttack(int weapon, double specDamage, double specAccuracy, double specAmount, int anim, int gfx1, int gfx2, boolean doubleHit, boolean ssSpec, int specEffect) { this.weapon = weapon; this.specDamage = specDamage; this.specAccuracy = specAccuracy; this.specAmount = specAmount; this.anim = anim; this.gfx1 = gfx1; this.gfx2 = gfx2; this.doubleHit = doubleHit; this.ssSpec = ssSpec; this.specEffect = specEffect; } private int getWeapon() { return weapon; } private double getSpecDamage() { return specDamage; } private double getSpecAccuracy() { return specAccuracy; } private double getSpecAmount() { return specAmount; } private int getAnim() { return anim; } private int getGfx1() { return gfx1; } private int getGfx2() { return gfx2; } private boolean getDoubleHit() { return doubleHit; } private boolean getSsSpec() { return ssSpec; } private int getSpecEffect() { return specEffect; } public static HashMap <Integer,specialAttack> specialAttack = new HashMap<Integer,specialAttack>(); public static specialAttack getWeapon(int weapon) { return specialAttack.get(weapon); } static { for (specialAttack SA : specialAttack.values()) specialAttack.put(SA.getWeapon(), SA); } } public void activateSpecial(int weapon, int i) { int equippedWeapon = c.playerEquipment[c.playerWeapon]; if(Server.npcHandler.npcs[i] == null && c.npcIndex > 0) { return; } if(Server.playerHandler.players[i] == null && c.playerIndex > 0) { return; } c.doubleHit = false; c.specEffect = 0; c.projectileStage = 0; c.specMaxHitIncrease = 2; if(c.npcIndex > 0) { c.oldNpcIndex = i; } else if (c.playerIndex > 0){ c.oldPlayerIndex = i; Server.playerHandler.players[i].underAttackBy = c.playerId; Server.playerHandler.players[i].logoutDelay = System.currentTimeMillis(); Server.playerHandler.players[i].singleCombatDelay = System.currentTimeMillis(); Server.playerHandler.players[i].killerId = c.playerId; } c.specEffect = 0; c.projectileStage = 0; for (specialAttack SA : specialAttack.values()) { if (NPCHandler.npcs[c.npcIndex] == null && c.npcIndex > 0) { return; } if (PlayerHandler.players[c.playerIndex] == null && c.playerIndex > 0) { return; } if (equippedWeapon == 14484) { c.gfx0(1950); c.startAnimation(10961); c.specAccuracy = 1.55; c.clawDamage = 0; if (c.playerIndex > 0) { Client o = (Client) Server.playerHandler.players[c.playerIndex]; if (Misc.random(c.getCombat().calculateMeleeAttack()) > Misc.random(o.getCombat().calculateMeleeDefence())) { c.clawDamage = Misc.random(c.getCombat().calculateMeleeMaxHit() + Misc.random(2)); } c.clawIndex = c.playerIndex; c.clawType = 1; } else if (c.npcIndex > 0) { NPC n = Server.npcHandler.npcs[c.npcIndex]; if (Misc.random(c.getCombat().calculateMeleeAttack()) > Misc.random(n.defence)) { c.clawDamage = Misc.random(c.getCombat().calculateMeleeMaxHit() + Misc.random(2)); } c.clawIndex = c.npcIndex; c.clawType = 2; } c.doubleHit = true; c.usingClaws = true; c.specEffect = 5; c.hitDelay = c.getCombat().getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); } if (equippedWeapon == SA.getWeapon()) { if (SA.getWeapon() == 11235) { c.usingBow = true; c.dbowSpec = true; c.rangeItemUsed = c.playerEquipment[c.playerArrows]; c.getItems().deleteArrow(); c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.hitDelay = 3; c.startAnimation(426); c.projectileStage = 1; c.gfx100(c.getCombat().getRangeStartGFX()); c.hitDelay = c.getCombat().getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) c.attackTimer--; if (c.playerIndex > 0) c.getCombat().fireProjectilePlayer(); else if (c.npcIndex > 0) c.getCombat().fireProjectileNpc(); c.specAccuracy = SA.getSpecAccuracy(); c.specDamage = SA.getSpecDamage(); } else if (SA.getWeapon() == 15241) { c.usingBow = true; c.rangeItemUsed = c.playerEquipment[c.playerArrows]; c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.startAnimation(12175); c.specAccuracy = SA.getSpecAccuracy(); c.specDamage = SA.getSpecDamage(); c.hitDelay = 5; c.attackTimer-= 7; c.hitDelay = c.getCombat().getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) if (c.playerIndex > 0) c.getCombat().fireProjectilePlayer(); else if (c.npcIndex > 0) c.getCombat().fireProjectileNpc(); } else if (SA.getWeapon() == 13879 || SA.getWeapon() == 13883) { c.usingRangeWeapon = true; c.rangeItemUsed = c.playerEquipment[c.playerWeapon]; c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.startAnimation(SA.getAnim()); c.gfx0(SA.getGfx1()); c.specAccuracy = SA.getSpecAccuracy(); c.specDamage = SA.getSpecDamage(); c.projectileStage = 1; c.hitDelay = c.getCombat().getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) c.attackTimer--; if (c.playerIndex > 0) c.getCombat().fireProjectilePlayer(); else if (c.npcIndex > 0) c.getCombat().fireProjectileNpc(); } else if (SA.getWeapon() == 859 || SA.getWeapon() == 861) { c.usingBow = true; c.bowSpecShot = 1; c.rangeItemUsed = c.playerEquipment[c.playerArrows]; c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.startAnimation(SA.getAnim()); c.projectileStage = 1; c.hitDelay = c.getCombat().getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) c.attackTimer--; if (c.playerIndex > 0) c.getCombat().fireProjectilePlayer(); else if (c.npcIndex > 0) c.getCombat().fireProjectileNpc(); } else if (SA.getGfx1() == -1) { c.gfx100(SA.getGfx2()); c.startAnimation(SA.getAnim()); c.specDamage = SA.getSpecDamage(); c.specAccuracy = SA.getSpecAccuracy(); c.hitDelay = c.getCombat().getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.doubleHit = SA.getDoubleHit(); c.ssSpec = SA.getSsSpec(); } else { c.gfx0(SA.getGfx1()); c.startAnimation(SA.getAnim()); c.specDamage = SA.getSpecDamage(); c.specAccuracy = SA.getSpecAccuracy(); c.hitDelay = c.getCombat().getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.doubleHit = SA.getDoubleHit(); c.ssSpec = SA.getSsSpec(); } } c.delayedDamage = Misc.random(c.getCombat().calculateMeleeMaxHit()); c.delayedDamage2 = Misc.random(c.getCombat().calculateMeleeMaxHit()); c.usingSpecial = false; c.getItems().updateSpecialBar(); } } public double specAmount() { for (specialAttack SA : specialAttack.values()) { if (c.playerEquipment[c.playerWeapon] == SA.getWeapon()) { return SA.getSpecAmount(); } } return 0; } } [/CODE] To add another special attack, simply follow this format: [CODE][COLOR="Red"]ABYSSAL_WHIP[/COLOR]([COLOR="Blue"]4151[/COLOR], [COLOR="Lime"]1[/COLOR], [COLOR="DarkOrchid"]1[/COLOR], [COLOR="Magenta"]5[/COLOR], [COLOR="Orange"]1658[/COLOR], [COLOR="Yellow"]341[/COLOR], [COLOR="Indigo"]-1[/COLOR], [COLOR="Teal"]false[/COLOR], [COLOR="SlateGray"]false[/COLOR], [COLOR="Cyan"]0[/COLOR]),[/CODE] [COLOR="Red"]Name of weapon[/COLOR] [COLOR="Blue"]Id of weapon[/COLOR] [COLOR="Lime"]Spec Damage[/COLOR] [COLOR="DarkOrchid"]Spec Accuracy[/COLOR] [COLOR="Magenta"]Spec Amount[/COLOR] [COLOR="Orange"]Animation[/COLOR] [COLOR="Yellow"]Gfx0[/COLOR] [COLOR="Indigo"]Gfx100[/COLOR] [COLOR="Teal"]Double hit[/COLOR] [COLOR="SlateGray"]SsSpec[/COLOR] [COLOR="Cyan"]Spec Effect[/COLOR] If there is no gfx0, gfx100, or animation, put "-1". If there is no specEffect, put "0". Go to CombatAssistant.java and find your activateSpecial method. It should look like this: [CODE]public void activateSpecial(int weapon, int i){ if(Server.npcHandler.npcs[i] == null && c.npcIndex > 0) { return; } if(Server.playerHandler.players[i] == null && c.playerIndex > 0) { return; } c.doubleHit = false; c.specEffect = 0; c.projectileStage = 0; c.specMaxHitIncrease = 2; if(c.npcIndex > 0) { c.oldNpcIndex = i; } else if (c.playerIndex > 0){ c.oldPlayerIndex = i; Server.playerHandler.players[i].underAttackBy = c.playerId; Server.playerHandler.players[i].logoutDelay = System.currentTimeMillis(); Server.playerHandler.players[i].singleCombatDelay = System.currentTimeMillis(); Server.playerHandler.players[i].killerId = c.playerId; } String weaponName = c.getItems().getItemName(weapon).toLowerCase(); switch(weapon) { case 1305: // dragon long c.gfx100(248); c.startAnimation(1058); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.specAccuracy = 1.10; c.specDamage = 1.20; break; case 18369: c.startAnimation(2890); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.specAccuracy = .10; c.specDamage = 5.0; break; case 15241: // hand cannon spec!! c.usingBow = true; c.rangeItemUsed = c.playerEquipment[c.playerArrows]; c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.startAnimation(12175); c.specAccuracy = 8.5; c.specDamage = 1.75; c.hitDelay = 5; c.attackTimer-= 7; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) if (c.playerIndex > 0) fireProjectilePlayer(); else if (c.npcIndex > 0) fireProjectileNpc(); break; case 1215: // dragon daggers case 1231: case 5680: case 5698: c.gfx100(252); c.startAnimation(1062); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.doubleHit = true; c.specAccuracy = 13.0; c.specDamage = 0.85; break; case 10887: c.gfx100(1027); c.specAccuracy = 5.0; c.specDamage = 1.35; c.startAnimation(5870); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 14484: c.gfx0(1950); c.startAnimation(10961); c.specAccuracy = 7.0; c.clawDamage = 0; if (c.playerIndex > 0) { Client o = (Client) Server.playerHandler.players[c.playerIndex]; if (Misc.random(calculateMeleeAttack()) > Misc.random(o.getCombat().calculateMeleeDefence())) { c.clawDamage = Misc.random(calculateMeleeMaxHit() + Misc.random(2)); } c.clawIndex = c.playerIndex; c.clawType = 1; } else if (c.npcIndex > 0) { NPC n = Server.npcHandler.npcs[c.npcIndex]; if (Misc.random(calculateMeleeAttack()) > Misc.random(n.defence)) { c.clawDamage = Misc.random(calculateMeleeMaxHit() + Misc.random(2)); } c.clawIndex = c.npcIndex; c.clawType = 2; } c.doubleHit = true; c.usingClaws = true; c.specEffect = 5; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 4151: // whip case 15441: // whip case 15442: // whip case 15443: // whip case 15444: // whip if(Server.npcHandler.npcs[i] != null) { Server.npcHandler.npcs[i].gfx100(341); } c.specAccuracy = 11.0; c.specDamage = 1.25; c.startAnimation(1658); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 11694: // ags c.startAnimation(7074); c.specDamage = 1.35; c.specAccuracy = 7.55; c.gfx0(1222); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 18786: c.gfx100(1224); c.startAnimation(1872); c.specAccuracy = 7.00; c.specDamage = 1.55; c.ssSpec = true; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 19780: c.gfx100(1224); c.startAnimation(1872); c.specAccuracy = 7.00; c.specDamage = 1.55; c.ssSpec = true; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 11730: c.gfx100(1224); c.startAnimation(7072); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.doubleHit = true; c.ssSpec = true; c.specAccuracy = 1.55; c.specDamage = 1.10; break; case 13905: // Vesta spear c.startAnimation(10499); c.gfx0(1835); c.specAccuracy = 12.5; c.specDamage = 1.08; c.specEffect = 6; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 13899: // Vesta LongSword c.startAnimation(10502); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()+1); c.specDamage = 1.55; c.specAccuracy = 7.00; break; case 13902: // Statius c.startAnimation(10505); c.gfx0(1840); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()+1); c.specDamage = 1.55; c.specAccuracy = 7.25; break; case 11700: c.startAnimation(7070); c.gfx0(1221); if (c.playerIndex > 0) { } else { Server.npcHandler.npcs[c.npcIndex].gfx0(2104); } c.specAccuracy = 1.55; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.specEffect = 2; break; case 11696: c.startAnimation(7073); c.gfx0(1223); c.specDamage = 1.15; c.specAccuracy = 7.85; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.specEffect = 3; break; case 18367: c.startAnimation(410); c.gfx0(604); c.specDamage = 1.20; c.specAccuracy = 2.00; c.specEffect = 6; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 11698: c.startAnimation(7071); c.gfx0(1220); c.specAccuracy = 8.00; c.specDamage = 1.15; c.specEffect = 4; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 1249: c.startAnimation(405); c.gfx100(253); if (c.playerIndex > 0) { Client o = (Client)Server.playerHandler.players[i]; o.getPA().getSpeared(c.absX, c.absY); } break; case 3204: // d hally c.gfx100(282); c.startAnimation(1203); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if(Server.npcHandler.npcs[i] != null && c.npcIndex > 0) { if(!c.goodDistance(c.getX(), c.getY(), Server.npcHandler.npcs[i].getX(), Server.npcHandler.npcs[i].getY(), 1)){ c.doubleHit = true; } } if(Server.playerHandler.players[i] != null && c.playerIndex > 0) { if(!c.goodDistance(c.getX(), c.getY(), Server.playerHandler.players[i].getX(),Server.playerHandler.players[i].getY(), 1)){ c.doubleHit = true; c.delayedDamage2 = Misc.random(calculateMeleeMaxHit()); } } break; case 4153: // maul c.startAnimation(1667); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); /*if (c.playerIndex > 0) gmaulPlayer(i); else gmaulNpc(i);*/ c.gfx100(337); break; case 4587: // dscimmy c.gfx100(347); c.specEffect = 1; c.startAnimation(1872); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); break; case 1434: // mace c.startAnimation(1060); c.gfx100(251); c.specMaxHitIncrease = 3; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase())+1; c.specDamage = 1.55; c.specAccuracy = 0.85; break; case 859: // magic long c.usingBow = true; c.bowSpecShot = 3; c.rangeItemUsed = c.playerEquipment[c.playerArrows]; c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.startAnimation(426); c.gfx100(250); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); c.projectileStage = 1; if (c.fightMode == 2) c.attackTimer--; break; case 13883: // Morrigan Throwing Axe c.usingRangeWeapon = true; c.rangeItemUsed = c.playerEquipment[c.playerWeapon]; c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.startAnimation(10501); c.gfx0(1836); c.hitDelay = 3; c.specAccuracy = 6.90; c.specDamage = 1.20; c.projectileStage = 1; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) c.attackTimer--; if (c.playerIndex > 0) fireProjectilePlayer(); else if (c.npcIndex > 0) fireProjectileNpc(); break; case 13879: // Morrigan Javeline c.usingRangeWeapon = true; c.rangeItemUsed = c.playerEquipment[c.playerWeapon]; c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.startAnimation(10504); c.gfx0(1838); c.specAccuracy = 5.00; c.specDamage = 1.08; c.hitDelay = 3; c.projectileStage = 1; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) c.attackTimer--; if (c.playerIndex > 0) fireProjectilePlayer(); else if (c.npcIndex > 0) fireProjectileNpc(); break; case 861: // magic short c.usingBow = true; c.bowSpecShot = 1; c.rangeItemUsed = c.playerEquipment[c.playerArrows]; c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.startAnimation(1074); c.hitDelay = 3; c.projectileStage = 1; c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) c.attackTimer--; if (c.playerIndex > 0) fireProjectilePlayer(); else if (c.npcIndex > 0) fireProjectileNpc(); break; case 11235: // dark bow case 15701: // dark bow case 15702: // dark bow case 15703: // dark bow case 15704: // dark bow c.usingBow = true; c.dbowSpec = true; c.rangeItemUsed = c.playerEquipment[c.playerArrows]; c.getItems().deleteArrow(); c.getItems().deleteArrow(); c.lastWeaponUsed = weapon; c.hitDelay = 3; c.startAnimation(426); c.projectileStage = 1; c.gfx100(getRangeStartGFX()); c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()); if (c.fightMode == 2) c.attackTimer--; if (c.playerIndex > 0) fireProjectilePlayer(); else if (c.npcIndex > 0) fireProjectileNpc(); c.specAccuracy = 1.75; c.specDamage = 1.50; break; } c.delayedDamage = Misc.random(calculateMeleeMaxHit()); c.delayedDamage2 = Misc.random(calculateMeleeMaxHit()); c.usingSpecial = false; c.getItems().updateSpecialBar(); }[/CODE] Replace the whole thing with this: [CODE] public void activateSpecial(int weapon, int i) { c.getSA().activateSpecial(weapon, i); }[/CODE] Now, for every instance of "activateSpecial(weapon, i);", do this: Change: [CODE]activateSpecial(c.playerEquipment[c.playerWeapon], i);[/CODE] To: [CODE]c.getSA().activateSpecial(c.playerEquipment[c.playerWeapon], i);[/CODE] There should be about 3 instances of "activateSpecial(weapon, i);". Go to your checkSpecAmount method. It should look like this: [CODE] public boolean checkSpecAmount(int weapon) { switch(weapon) { case 1249: case 1215: case 1231: case 5680: case 5698: case 1305: case 1434: case 13899: if(c.specAmount >= 2.5) { c.specAmount -= 2.5; c.getItems().addSpecialBar(weapon); return true; } return false; case 4151: case 15241: case 15441: // whip case 15442: // whip case 15443: // whip case 15444: // whip case 11694: case 18786: case 14484: case 11698: case 4153: case 13902: case 13905: case 13883: case 13879: case 19780: case 15486: case 11700: case 18369: case 10887: if(c.specAmount >= 5) { c.specAmount -= 5; c.getItems().addSpecialBar(weapon); return true; } return false; case 3204: if(c.specAmount >= 3) { c.specAmount -= 3; c.getItems().addSpecialBar(weapon); return true; } return false; case 1377: case 11696: case 11730: case 18367: if(c.specAmount >= 10) { c.specAmount -= 10; c.getItems().addSpecialBar(weapon); return true; } return false; case 4587: case 859: case 861: case 15701: // dark bow case 15702: // dark bow case 15703: // dark bow case 15704: // dark bow case 11235: if(c.specAmount >= 5.5) { c.specAmount -= 5.5; c.getItems().addSpecialBar(weapon); return true; } return false; default: return true; // incase u want to test a weapon } }[/CODE] Replace the whole thing with this: [CODE] public boolean checkSpecAmount(int weapon) { if(c.specAmount >= c.getSA().specAmount()) { c.specAmount -= c.getSA().specAmount(); c.getItems().addSpecialBar(weapon); return true; } return false; }[/CODE] ------- To add another special weapon, add the data to the enum, and add the spec bar to your weapon via ItemAssistant.
  8. No softnyx. You were completely wrong. -.- Now to start handling a packet, you need the opcode. You can get that my making the server printing out the unhandled opcode id. Now once you have the opcode(s) you will need to head over to your client. Open your client, and open up z-filesearcher. Search for how your client sends out packets. For example in moonlight 634 deob it is. [code] static GameOutPacket x = new GameOutPacket(79, 16);[/code] Now you want to search something like this: [code]GameOutPacket(79[/code] And z-file-searcher should come up with the necessary results. For this bit i recommend you put your deob into a eclipse java project, makes it so much easier. So i searched up my code up there and i got. [code] [2] qda.java (Line 9) static GameOutPacket p = new GameOutPacket(79, 3); [/code] So we head over to qda.java in your client. And now find the actual line with it. so I found [code] static GameOutPacket p = new GameOutPacket(79, 3); [/code] Now if you have eclipse this will make it very easy. So if you have eclipse, right click the p -> references -> project Now it will come up with the references for p. [img]http://screensnapr.com/e/VQPXya.png[/img] Now go to the packetcomposer reference. Now my one came up with [code] wm var_wm = em.SendPacket(qda.p, naa.T, -84); ((wm) var_wm).o.b((byte) -125, (int) (qca.e.a(82, -126) ? 1 : 0)); ((wm) var_wm).o.writeLEShort(i_77_, (byte) 3); dfa.a(30, var_wm); Class_wf.a(true, ((Entity) class_ke).regionLocalX[0], ((Entity) class_ke).thisPlayerRegionY[0], (byte) -91, class_ke.h((byte) 70), 0, class_ke.h((byte) 125), -2, 0); } [/code] Your one should also be similar to this. So once we have that. we streamify it (idk im trying to sound smart ^^) [code] ((wm) var_wm).o.b((byte) -125, (int) (qca.e.a(82, -126) ? 1 : 0)); [/code] is equal to [code] readByteS [/code] and [code] ((wm) var_wm).o.writeLEShort(i_77_, (byte) 3); dfa.a(30, var_wm); [/code] is [code] readLEShort [/code] obviously. Now once you have the streams we handle it. Within a class. So i handled it liek this: [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using RuneScape.Model.Characters; using RuneScape.Model.Items; using RuneScape.Model.Items.Containers; using RuneScape.Model; using RuneScape.Model.Objects; using RuneScape.Model.Shops; using RuneScape.Model.Effects; using RuneScape.Model.Hits; using RuneScape.Model.Npcs; using RuneScape.Model.Maps; using RuneScape.Content; using RuneScape.Content.Skills; using RuneScape.Content.Interfaces; using RuneScape.Communication.Messages.Outgoing; namespace RuneScape.Communication.Messages.Incoming { class MagicOnEntity : IPacketHandler { #region Methods public void Handle(Character character, Packet packet) { int int1 = packet.ReadLEShortA(); int int2 = packet.ReadInt(); int int3 = packet.ReadLEShort(); int int4 = packet.ReadByteA(); int int5 = packet.ReadShortA(); Program.Logger.WriteInfo("int1:" + int1+ "int2:" + int2+ "int3:" + int3+ "int4:" +int4+ "int5:" +int5); } /// <summary> /// Handles magc on npc /// </summary> public void MagicOnNpc(Character character, Packet packet) { character.PlayAnimation(Animation.Create(1661)); } #endregion Methods } } [/code] I made it make an animation just to test it and prnt the info to make sure it was right. Now i don't know how your source handles these packets, but if you look at other packet classes you will find out. I tried. Unless this is completely wrong. ^^
×