Jump to content

Search the Community

Showing results for tags 'proper'.



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

  1. [B]Media what you're adding[/B] [img]http://puu.sh/ajr5y/9624730e9a.jpg[/img] [img]http://puu.sh/ajr8W/3982da82f2.jpg[/img] If you want a object to exchange the crystal keys, you simple call the openChest(c) - method [CODE]CrystalChest.getSingleton().openChest(c);[/CODE] CrystalChest.java [CODE]package server.model.players.content; import java.util.Random; import server.model.players.Client; import server.util.Misc; /** * * @author Fuzen Seth * [MENTION=49618]info[/MENTION] Represents simple crystal chest system. * [MENTION=3199]Sin[/MENTION]ce 20.7.2014 */ public class CrystalChest { /** * The mininum cash reward if the loot is coins. */ private static final int MININUM_CASH_REWARD = 50000; /** * The maxinum cash reward if the loot is coins. */ private static final int MAXINUM_CASH_REWARD = 150000; /** * Rewards. */ private int[] REWARDS = {995, 1712, 3751, 10828 ,1127 ,1079, 1215, 5698}; /** * The singleton. */ private static CrystalChest singleton = new CrystalChest(); /** * The Random instance. */ private Random random = new Random(); /** * Opens the crystal chest. * [MENTION=75098]Para[/MENTION]m c */ public void openChest(Client c) { final int rewardItem = REWARDS[random.nextInt(REWARDS.length - 1)]; if (!c.getItems().playerHasItem(989)) { c.getDH().sendStatement("The chest is locked."); return; } if (rewardItem == 995) c.getItems().addItem(995, (int) Misc.randomDouble(MININUM_CASH_REWARD, MAXINUM_CASH_REWARD)); else c.getItems().addItem(rewardItem, 1); c.getItems().deleteItem(989, 1); c.getDH().sendStatement("You have managed to loot the chest."); c.sendMessage("You loot the crystal chest!"); } /** * Loads crystal chest singleton. * [MENTION=184045]return[/MENTION] */ public static CrystalChest getSingleton() { return singleton; } } [/CODE] creds te the fezenseth
  2. [CODE]package server.model.players; import java.util.ArrayList; /** * * @author Fuzen Seth * [MENTION=49618]info[/MENTION] represents a connected new player. * [MENTION=3199]Sin[/MENTION]ce 10.8.2014 */ public class PlayerTutorial { /** * PlayerTutorial instance. */ private static PlayerTutorial instance = new PlayerTutorial(); public enum StartItem { IRON_SCIMITAR(1323, 1), COINS(995, 50000), RUNE_SCIMITAR(1333,1), STR_POT(2441, 50), ATT_POT(2437,50), PRAY_POT(2435, 50), CMB_BRACELET(11118, 1), CLIMBING_BOOTS(3105, 1), IRON_KNIFE(863, 230); private int id; private int amount; private StartItem(int id, int amount) { this.id = id; this.amount = amount; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getAmount() { return amount; } public void setAmount(int amount) { this.amount = amount; } } /** * Adds starting items to player's inventory. */ public void addStarter(Client client) { for (StartItem startItems : StartItem.values()) client.getItems().addItem(startItems.getId(), startItems.getAmount()); client.sendMessage("You have received starting supplies to Argon, goodluck with your adventure."); client.setStarted(true); //how its done in pi? } /** * Gets the PlayerTutorial. * [MENTION=184045]return[/MENTION] */ public static PlayerTutorial getInstance() { return instance; } } [/CODE] This could of be done in a array of course, but as you notice I have removed loads of stuff in this file. Theres basically the item giving only. The file PlayerTutorial is used for advanced player starting (I mean tutorial). Anyways, enjoy the contribrution. Edit: How to send the actual starter to new player? [code] PlayerTutorial.getInstance().addStarter(c);[/code]
  3. Another contribrution for me to the project insanity. This is a proper Equipment class. Client.java [code] private Equipment equipment = new Equipment(this); [/code] Add this too with the other getters at Client.java [CODE]public Equipment getEquipment() { return equipment; }[/CODE] Equipment.java [CODE]package server.model.players; import server.Config; import server.Server; import server.model.items.Item; import server.model.items.ItemAssistant; import server.model.players.Client; import server.model.players.PlayerSave; /** * @author Fuzen Seth * [MENTION=98951]infor[/MENTION]mation Represents a proper equipment class. * [MENTION=3199]Sin[/MENTION]ce 23.7.2014 */ public class Equipment { private Client c; public Equipment(Client c) { this.c = c; } /** * slot shield */ public static final String[] SHIELDS = {"spirit shield", "defender", "farseer"}; /** * slot weapon */ public static final String[] WEAPONS = {"rapier", "maul", "staff", "longsword"}; /** * Gets the bonus' of an item. */ public void writeBonus() { int offset = 0; String send = ""; for (int i = 0; i < c.playerBonus.length; i++) { if (c.playerBonus[i] >= 0) { send = BONUS_NAMES[i]+": +"+c.playerBonus[i]; } else { send = BONUS_NAMES[i]+": -"+java.lang.Math.abs(c.playerBonus[i]); } if (i == 10) { offset = 1; } c.getPA().sendFrame126(send, (1675+i+offset)); } } /** * Gets the item name from the item.cfg */ public static String getItemName(int ItemID) { for (int i = 0; i < Config.ITEM_LIMIT; i++) { if (Server.itemHandler.ItemList[i] != null) { if (Server.itemHandler.ItemList[i].itemId == ItemID) { return Server.itemHandler.ItemList[i].itemName; } } } return "Unarmed"; } /** * Gets the item type. */ public String itemType(int item) { for (int i = 0; i < Item.capes.length; i++) { if (item == Item.capes[i]) return "cape"; } for (int i = 0; i < Item.hats.length; i++) { if (item == Item.hats[i]) return "hat"; } for (int i = 0; i < Item.boots.length; i++) { if (item == Item.boots[i]) return "boots"; } for (int i = 0; i < Item.gloves.length; i++) { if (item == Item.gloves[i]) return "gloves"; } for (int i = 0; i < Item.shields.length; i++) { if (item == Item.shields[i]) return "shield"; } for (int i = 0; i < Item.amulets.length; i++) { if (item == Item.amulets[i]) return "amulet"; } for (int i = 0; i < Item.arrows.length; i++) { if (item == Item.arrows[i]) return "arrows"; } for (int i = 0; i < Item.rings.length; i++) { if (item == Item.rings[i]) return "ring"; } for (int i = 0; i < Item.body.length; i++) { if (item == Item.body[i]) return "body"; } for (int i = 0; i < Item.legs.length; i++) { if (item == Item.legs[i]) return "legs"; } return "weapon"; } /** * Item bonuses. **/ public final String[] BONUS_NAMES = { "Stab", "Slash", "Crush", "Magic", "Range", "Stab", "Slash", "Crush", "Magic", "Range", "Strength", "Prayer" }; /** * Resets item bonuses. */ public void resetBonus() { for (int i = 0; i < c.playerBonus.length; i++) { c.playerBonus[i] = 0; } } /** * Weapon requirements. **/ public void getRequirements(String itemName, int itemId) { c.attackLevelReq = c.defenceLevelReq = c.strengthLevelReq = c.rangeLevelReq = c.magicLevelReq = 0; if (itemName.contains("mystic") || itemName.contains("nchanted")) { if (itemName.contains("staff")) { c.magicLevelReq = 20; c.attackLevelReq = 40; } else { c.magicLevelReq = 20; c.defenceLevelReq = 20; } } if (itemName.contains("slayer helmet")) { c.defenceLevelReq = 10; } if (itemName.contains("initiate")) { c.defenceLevelReq = 20; } if (itemName.contains("infinity")) { c.magicLevelReq = 50; c.defenceLevelReq = 25; } if (itemName.contains("splitbark")) { c.magicLevelReq = 40; c.defenceLevelReq = 40; } if (itemName.contains("Black")) { if (itemName.contains("d'hide")) { c.rangeLevelReq = 70; if (itemName.contains("body")) c.defenceLevelReq = 40; return; } } if (itemName.contains("Green")) { if (itemName.contains("hide")) { c.rangeLevelReq = 40; if (itemName.contains("body")) c.defenceLevelReq = 40; return; } } if (itemName.contains("Blue")) { if (itemName.contains("hide")) { c.rangeLevelReq = 50; if (itemName.contains("body")) c.defenceLevelReq = 40; return; } } if (itemName.contains("Red")) { if (itemName.contains("hide")) { c.rangeLevelReq = 60; if (itemName.contains("body")) c.defenceLevelReq = 40; return; } } if (itemName.contains("Black")) { if (itemName.contains("hide")) { c.rangeLevelReq = 70; if (itemName.contains("body")) c.defenceLevelReq = 40; return; } } if (itemName.contains("bronze")) { if (!itemName.contains("knife") && !itemName.contains("dart") && !itemName.contains("javelin") && !itemName.contains("thrownaxe")) { c.attackLevelReq = c.defenceLevelReq = 1; } return; } if (itemName.contains("iron")) { if (!itemName.contains("knife") && !itemName.contains("dart") && !itemName.contains("javelin") && !itemName.contains("thrownaxe")) { c.attackLevelReq = c.defenceLevelReq = 1; } return; } if (itemName.contains("steel")) { if (!itemName.contains("knife") && !itemName.contains("dart") && !itemName.contains("javelin") && !itemName.contains("thrownaxe")) { c.attackLevelReq = c.defenceLevelReq = 5; } return; } if (itemName.contains("black")) { if (!itemName.contains("cavalier") && !itemName.contains("knife") && !itemName.contains("dart") && !itemName.contains("javelin") && !itemName.contains("thrownaxe") && !itemName.contains("vamb") && !itemName.contains("chap")) { c.attackLevelReq = c.defenceLevelReq = 10; } return; } if (itemName.contains("mithril")) { if (!itemName.contains("knife") && !itemName.contains("dart") && !itemName.contains("javelin") && !itemName.contains("thrownaxe")) { c.attackLevelReq = c.defenceLevelReq = 20; } return; } if (itemName.contains("adamant") || itemName.contains("adam")) { if (!itemName.contains("knife") && !itemName.contains("dart") && !itemName.contains("javelin") && !itemName.contains("thrownaxe")) { c.attackLevelReq = c.defenceLevelReq = 30; } return; } if (itemName.contains("rock-shell")) { c.defenceLevelReq = 40; } if (itemName.contains("zamorak")) { if (!itemName.contains("robe") && !itemName.contains("mitre") && !itemName.contains("stole") && !itemName.contains("godsword")) { c.defenceLevelReq = 40; } return; } if (itemName.contains("saradomin")) { if (!itemName.contains("robe") && !itemName.contains("mitre") && !itemName.contains("stole") && !itemName.contains("godsword")) { c.defenceLevelReq = 40; } return; } if (itemName.contains("guthix")) { if (!itemName.contains("robe") && !itemName.contains("mitre") && !itemName.contains("stole") && !itemName.contains("godsword")) { c.defenceLevelReq = 40; } return; } if (itemName.contains("rune")) { if (!itemName.contains("gloves") && !itemName.contains("knife") && !itemName.contains("dart") && !itemName.contains("javelin") && !itemName.contains("thrownaxe") && !itemName.contains("'bow")) { c.attackLevelReq = c.defenceLevelReq = 40; } return; } if (itemName.contains("dragon")) { if (!itemName.contains("nti-") && !itemName.contains("fire")) { c.attackLevelReq = c.defenceLevelReq = 60; return; } } if (itemName.contains("crystal")) { if (itemName.contains("shield")) { c.defenceLevelReq = 70; } else { c.rangeLevelReq = 70; } return; } if (itemName.contains("ahrim")) { if (itemName.contains("staff")) { c.magicLevelReq = 70; c.attackLevelReq = 70; } else { c.magicLevelReq = 70; c.defenceLevelReq = 70; } } if (itemName.contains("karil")) { if (itemName.contains("crossbow")) { c.rangeLevelReq = 70; } else { c.rangeLevelReq = 70; c.defenceLevelReq = 70; } } if (itemName.contains("godsword")) { c.attackLevelReq = 75; } if (itemName.contains("3rd age") && !itemName.contains("amulet")) { c.defenceLevelReq = 60; } if (itemName.contains("Initiate")) { c.defenceLevelReq = 20; } if (itemName.contains("verac") || itemName.contains("guthan") || itemName.contains("dharok") || itemName.contains("torag")) { if (itemName.contains("hammers")) { c.attackLevelReq = 70; c.strengthLevelReq = 70; } else if (itemName.contains("axe")) { c.attackLevelReq = 70; c.strengthLevelReq = 70; } else if (itemName.contains("warspear")) { c.attackLevelReq = 70; c.strengthLevelReq = 70; } else if (itemName.contains("flail")) { c.attackLevelReq = 70; c.strengthLevelReq = 70; } else { c.defenceLevelReq = 70; } } switch (itemId) { case 11720: case 11718: case 11722: c.defenceLevelReq = 70; c.rangeLevelReq = 70; return; case 10887: c.strengthLevelReq = 60; return; case 2497: case 2491: c.rangeLevelReq = 70; return; case 6528: c.strengthLevelReq = 60; return; case 8839: case 8840: case 8842: case 11663: case 11664: case 11665: c.attackLevelReq = 42; c.rangeLevelReq = 42; c.strengthLevelReq = 42; c.magicLevelReq = 42; c.defenceLevelReq = 42; return; case 10551: case 2503: case 2501: case 2499: case 1135: c.defenceLevelReq = 40; return; case 11235: case 6522: c.rangeLevelReq = 60; break; case 6524: c.defenceLevelReq = 60; break; case 11284: c.defenceLevelReq = 75; return; case 6889: case 6914: c.magicLevelReq = 60; break; case 861: c.rangeLevelReq = 50; break; case 10828: c.defenceLevelReq = 55; break; case 11724: case 11726: case 11728: c.defenceLevelReq = 65; break; case 3751: case 3749: case 3755: c.defenceLevelReq = 40; break; case 11283: c.defenceLevelReq = 75; break; case 851: case 853: c.rangeLevelReq = 30; break; case 847: case 849: c.rangeLevelReq = 20; break; case 845: case 843: c.rangeLevelReq = 5; break; case 5698: c.attackLevelReq = 60; break; case 7462: case 7461: c.defenceLevelReq = 40; break; case 8846: c.defenceLevelReq = 5; break; case 8847: c.defenceLevelReq = 10; break; case 8848: c.defenceLevelReq = 20; break; case 8849: c.defenceLevelReq = 30; break; case 8850: c.defenceLevelReq = 40; break; case 7460: c.defenceLevelReq = 40; break; case 837: c.rangeLevelReq = 61; break; case 4151: c.attackLevelReq = 70; return; case 14004: c.attackLevelReq = 75; case 6724: c.rangeLevelReq = 60; return; case 4153: c.attackLevelReq = 50; c.strengthLevelReq = 50; return; } } /** * Finds the item. * */ public int findItem(int id, int[] items, int[] amounts) { for (int i = 0; i < c.playerItems.length; i++) { if (((items[i] - 1) == id) && (amounts[i] > 0)) { return i; } } return -1; } /** * Updates the slot when wielding an item. * * [MENTION=75098]Para[/MENTION]m slot */ public void updateSlot(int slot) { synchronized (c) { if (c.getOutStream() != null && c != null) { c.getOutStream().createFrameVarSizeWord(34); c.getOutStream().writeWord(1688); c.getOutStream().writeByte(slot); c.getOutStream().writeWord(c.playerEquipment[slot] + 1); if (c.playerEquipmentN[slot] > 254) { c.getOutStream().writeByte(255); c.getOutStream().writeDWord(c.playerEquipmentN[slot]); } else { c.getOutStream().writeByte(c.playerEquipmentN[slot]); } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); } } } /** * sendEquip **/ public boolean equip(int wearID, int slot) { synchronized (c) { int targetSlot = 0; boolean canWearItem = true; if (c.playerItems[slot] == (wearID + 1)) { getRequirements(getItemName(wearID).toLowerCase(), wearID); targetSlot = Item.targetSlots[wearID]; /** * String[] items */ for (String shields : SHIELDS) { if (itemType(wearID).toLowerCase().contains(shields)) { targetSlot = 5; } } for (String weapons : WEAPONS) { if (itemType(wearID).toLowerCase().contains(weapons)) { targetSlot = 0; } } if (itemType(wearID).equalsIgnoreCase("cape")) { targetSlot = 1; } else if (itemType(wearID).equalsIgnoreCase("hat")) { targetSlot = 0; } else if (itemType(wearID).equalsIgnoreCase("amulet")) { targetSlot = 2; } else if (itemType(wearID).equalsIgnoreCase("arrows")) { targetSlot = 13; } else if (itemType(wearID).equalsIgnoreCase("body")) { targetSlot = 4; } else if (itemType(wearID).equalsIgnoreCase("shield")) { targetSlot = 5; } else if (itemType(wearID).equalsIgnoreCase("legs")) { targetSlot = 7; } else if (itemType(wearID).equalsIgnoreCase("gloves")) { targetSlot = 9; } else if (itemType(wearID).equalsIgnoreCase("boots")) { targetSlot = 10; } else if (itemType(wearID).equalsIgnoreCase("ring")) { targetSlot = 12; } else { targetSlot = 3; } switch (wearID) { /* Gloves */ case 10336: case 9922: case 8842: targetSlot = 9; break; /* Arrows */ case 9144: targetSlot = 13; break; /* Capes */ case 19111: case 15008: case 9813: case 9747: case 9748: case 9750: case 9790: case 9751: case 9753: case 9754: case 9756: case 9757: case 9759: case 9760: case 9762: case 9763: case 9765: case 9766: case 9768: case 9769: case 9771: case 9772: case 9774: case 9775: case 10446: case 10448: case 10450: case 9777: case 9778: case 9780: case 9781: case 9783: case 9784: case 9786: case 9787: case 9792: case 9793: case 9795: case 9796: case 9798: case 9799: case 9801: case 9802: case 9804: case 9805: case 9807: case 9808: case 9810: case 9811: case 10499: targetSlot = 1; break; /* Arrows */ case 9244: targetSlot = 13; break; /* Boots */ case 15037: case 14605: case 11019: case 9921: case 11728: case 10839: targetSlot = 10; break; /* Legs */ case 11726: case 11722: case 9678: case 9923: case 9676: case 10394: case 8840: case 15035: case 10332: case 15036: case 14603: case 14938: case 14077: case 10346: case 10372: case 10838: case 11022: case 10388: case 10380: case 10340: case 15425: case 13360: case 13352: case 13346: targetSlot = 7; break; /* Amulets */ case 6861: case 6859: case 6863: case 9470: case 14000: case 6857: case 10344: case 11128: targetSlot = 2; break; /* Shields */ case 14502: case 14503: case 8850: case 8849: case 8848: case 8847: case 8846: case 8845: case 8844: case 11283: case 10352: targetSlot = 5; break; /* Bodies */ case 10551: case 10348: case 9674: case 10837: case 14936: case 15034: case 10386: case 10370: case 11720: case 10330: case 15423: case 14076: case 11020: case 14595: case 8839: case 10338: case 13348: case 13354: case 13358: case 9924: case 11724: targetSlot = 4; break; /* Helms */ case 13263: case 9920: case 10507: case 10836: case 10828: case 9672: case 10334: case 10350: case 10390: case 11718: case 10374: case 11021: case 15422: case 15033: case 9925: case 13362: case 11663: case 11664: case 11665: case 13355: case 13350: case 10342: case 1037: case 11335: case 10548: case 9749: case 9752: case 9755: case 9758: case 9761: case 9764: case 9767: case 9770: case 9773: case 9776: case 9779: case 9782: case 9785: case 9788: case 9791: case 9794: case 9797: case 9800: case 9803: case 9806: case 9809: case 9812: targetSlot = 0; break; /* Boots */ case 11732: targetSlot = 10; break; } if (c.duelRule[11] && targetSlot == 0) { c.sendMessage("Wearing hats has been disabled in this duel!"); return false; } if (c.duelRule[12] && targetSlot == 1) { c.sendMessage("Wearing capes has been disabled in this duel!"); return false; } if (c.duelRule[13] && targetSlot == 2) { c.sendMessage("Wearing amulets has been disabled in this duel!"); return false; } if (c.duelRule[14] && targetSlot == 3) { c.sendMessage("Wielding weapons has been disabled in this duel!"); return false; } if (c.duelRule[15] && targetSlot == 4) { c.sendMessage("Wearing bodies has been disabled in this duel!"); return false; } if ((c.duelRule[16] && targetSlot == 5) || (c.duelRule[16] && is2handed(getItemName(wearID) .toLowerCase(), wearID))) { c.sendMessage("Wearing shield has been disabled in this duel!"); return false; } if (c.duelRule[17] && targetSlot == 7) { c.sendMessage("Wearing legs has been disabled in this duel!"); return false; } if (c.duelRule[18] && targetSlot == 9) { c.sendMessage("Wearing gloves has been disabled in this duel!"); return false; } if (c.duelRule[19] && targetSlot == 10) { c.sendMessage("Wearing boots has been disabled in this duel!"); return false; } if (c.duelRule[20] && targetSlot == 12) { c.sendMessage("Wearing rings has been disabled in this duel!"); return false; } if (c.duelRule[21] && targetSlot == 13) { c.sendMessage("Wearing arrows has been disabled in this duel!"); return false; } if (Config.itemRequirements) { if (targetSlot == 10 || targetSlot == 7 || targetSlot == 5 || targetSlot == 4 || targetSlot == 0 || targetSlot == 9 || targetSlot == 10) { if (c.defenceLevelReq > 0) { if (c.getPA().getLevelForXP(c.playerXP[1]) < c.defenceLevelReq) { c.sendMessage("You need a defence level of " + c.defenceLevelReq + " to wear this item."); canWearItem = false; } } if (c.rangeLevelReq > 0) { if (c.getPA().getLevelForXP(c.playerXP[4]) < c.rangeLevelReq) { c.sendMessage("You need a range level of " + c.rangeLevelReq + " to wear this item."); canWearItem = false; } } if (c.magicLevelReq > 0) { if (c.getPA().getLevelForXP(c.playerXP[6]) < c.magicLevelReq) { c.sendMessage("You need a magic level of " + c.magicLevelReq + " to wear this item."); canWearItem = false; } } } if (targetSlot == 3) { if (c.attackLevelReq > 0) { if (c.getPA().getLevelForXP(c.playerXP[0]) < c.attackLevelReq) { c.sendMessage("You need an attack level of " + c.attackLevelReq + " to wield this weapon."); canWearItem = false; } } if (c.rangeLevelReq > 0) { if (c.getPA().getLevelForXP(c.playerXP[4]) < c.rangeLevelReq) { c.sendMessage("You need a range level of " + c.rangeLevelReq + " to wield this weapon."); canWearItem = false; } } if (c.magicLevelReq > 0) { if (c.getPA().getLevelForXP(c.playerXP[6]) < c.magicLevelReq) { c.sendMessage("You need a magic level of " + c.magicLevelReq + " to wield this weapon."); canWearItem = false; } } } } if (!canWearItem) { return false; } int wearAmount = c.playerItemsN[slot]; if (wearAmount < 1) { return false; } if (targetSlot == c.playerWeapon) { c.autocasting = false; c.autocastId = 0; c.getPA().sendFrame36(108, 0); } if (slot >= 0 && wearID >= 0) { int toEquip = c.playerItems[slot]; int toEquipN = c.playerItemsN[slot]; int toRemove = c.playerEquipment[targetSlot]; int toRemoveN = c.playerEquipmentN[targetSlot]; if (toEquip == toRemove + 1 && Item.itemStackable[toRemove]) { deleteItem(toRemove, getItemSlot(toRemove), toEquipN); c.playerEquipmentN[targetSlot] += toEquipN; } else if (targetSlot != 5 && targetSlot != 3) { c.playerItems[slot] = toRemove + 1; c.playerItemsN[slot] = toRemoveN; c.playerEquipment[targetSlot] = toEquip - 1; c.playerEquipmentN[targetSlot] = toEquipN; } else if (targetSlot == 5) { boolean wearing2h = is2handed( getItemName(c.playerEquipment[c.playerWeapon]) .toLowerCase(), c.playerEquipment[c.playerWeapon]); boolean wearingShield = c.playerEquipment[c.playerShield] > 0; if (wearing2h) { toRemove = c.playerEquipment[c.playerWeapon]; toRemoveN = c.playerEquipmentN[c.playerWeapon]; c.playerEquipment[c.playerWeapon] = -1; c.playerEquipmentN[c.playerWeapon] = 0; updateSlot(c.playerWeapon); } c.playerItems[slot] = toRemove + 1; c.playerItemsN[slot] = toRemoveN; c.playerEquipment[targetSlot] = toEquip - 1; c.playerEquipmentN[targetSlot] = toEquipN; } else if (targetSlot == 3) { boolean is2h = is2handed(getItemName(wearID) .toLowerCase(), wearID); boolean wearingShield = c.playerEquipment[c.playerShield] > 0; boolean wearingWeapon = c.playerEquipment[c.playerWeapon] > 0; if (is2h) { if (wearingShield && wearingWeapon) { if (freeSlots() > 0) { c.playerItems[slot] = toRemove + 1; c.playerItemsN[slot] = toRemoveN; c.playerEquipment[targetSlot] = toEquip - 1; c.playerEquipmentN[targetSlot] = toEquipN; removeItem( c.playerEquipment[c.playerShield], c.playerShield); } else { c.sendMessage("You do not have enough inventory space to do this."); return false; } } else if (wearingShield && !wearingWeapon) { c.playerItems[slot] = c.playerEquipment[c.playerShield] + 1; c.playerItemsN[slot] = c.playerEquipmentN[c.playerShield]; c.playerEquipment[targetSlot] = toEquip - 1; c.playerEquipmentN[targetSlot] = toEquipN; c.playerEquipment[c.playerShield] = -1; c.playerEquipmentN[c.playerShield] = 0; updateSlot(c.playerShield); } else { c.playerItems[slot] = toRemove + 1; c.playerItemsN[slot] = toRemoveN; c.playerEquipment[targetSlot] = toEquip - 1; c.playerEquipmentN[targetSlot] = toEquipN; } } else { c.playerItems[slot] = toRemove + 1; c.playerItemsN[slot] = toRemoveN; c.playerEquipment[targetSlot] = toEquip - 1; c.playerEquipmentN[targetSlot] = toEquipN; } } c.isFullHelm = Item .isFullHelm(c.playerEquipment[c.playerHat]); c.isFullMask = Item .isFullMask(c.playerEquipment[c.playerHat]); c.isFullBody = Item .isFullBody(c.playerEquipment[c.playerChest]); resetItems(3214); } if (targetSlot == 3) { c.usingSpecial = false; addSpecialBar(wearID); } if (c.getOutStream() != null && c != null) { c.getOutStream().createFrameVarSizeWord(34); c.getOutStream().writeWord(1688); c.getOutStream().writeByte(targetSlot); c.getOutStream().writeWord(wearID + 1); if (c.playerEquipmentN[targetSlot] > 254) { c.getOutStream().writeByte(255); c.getOutStream().writeDWord( c.playerEquipmentN[targetSlot]); } else { c.getOutStream().writeByte( c.playerEquipmentN[targetSlot]); } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); } sendWeapon(c.playerEquipment[c.playerWeapon], getItemName(c.playerEquipment[c.playerWeapon])); resetBonus(); getBonus(); writeBonus(); c.getCombat().getPlayerAnimIndex( c.getItems() .getItemName(c.playerEquipment[c.playerWeapon]) .toLowerCase()); c.getPA().requestUpdates(); return true; } else { return false; } } } public void deleteItem(int id, int amount) { deleteItem(id, getItemSlot(id), amount); } public void deleteItem(int id, int slot, int amount) { if (id <= 0 || slot < 0) { return; } if (c.playerItems[slot] == (id + 1)) { if (c.playerItemsN[slot] > amount) { c.playerItemsN[slot] -= amount; } else { c.playerItemsN[slot] = 0; c.playerItems[slot] = 0; } PlayerSave.saveGame(c); resetItems(3214); } } /** * Gets the item slot. * * [MENTION=75098]Para[/MENTION]m ItemID * [MENTION=184045]return[/MENTION] */ public int getItemSlot(int ItemID) { for (int i = 0; i < c.playerItems.length; i++) { if ((c.playerItems[i] - 1) == ItemID) { return i; } } return -1; } /** * Two handed weapon check. **/ public boolean is2handed(String itemName, int itemId) { if (itemName.contains("ahrim") || itemName.contains("karil") || itemName.contains("verac") || itemName.contains("guthan") || itemName.contains("dharok") || itemName.contains("torag")) { return true; } if (itemName.contains("longbow") || itemName.contains("shortbow") || itemName.contains("ark bow")) { return true; } if (itemName.contains("crystal")) { return true; } if (itemName.contains("godsword") || itemName.contains("aradomin sword") || itemName.contains("2h") || itemName.contains("spear")) { return true; } switch (itemId) { case 6724: case 11730: case 4153: case 6528: case 10887: case 11777: return true; } return false; } /** * Checks if you have a free slot. * * [MENTION=184045]return[/MENTION] */ public int freeSlots() { int freeS = 0; for (int i = 0; i < c.playerItems.length; i++) { if (c.playerItems[i] <= 0) { freeS++; } } return freeS; } /** * Gets the item bonus from the item.cfg. */ public void getBonus() { for (int i = 0; i < c.playerEquipment.length; i++) { if (c.playerEquipment[i] > -1) { for (int j = 0; j < Config.ITEM_LIMIT; j++) { if (Server.itemHandler.ItemList[j] != null) { if (Server.itemHandler.ItemList[j].itemId == c.playerEquipment[i]) { for (int k = 0; k < c.playerBonus.length; k++) { c.playerBonus[k] += Server.itemHandler.ItemList[j].Bonuses[k]; } break; } } } } } } /** * Weapon type. **/ public void sendWeapon(int Weapon, String WeaponName) { String WeaponName2 = WeaponName.replaceAll("Bronze", ""); WeaponName2 = WeaponName2.replaceAll("Iron", ""); WeaponName2 = WeaponName2.replaceAll("Steel", ""); WeaponName2 = WeaponName2.replaceAll("Black", ""); WeaponName2 = WeaponName2.replaceAll("Mithril", ""); WeaponName2 = WeaponName2.replaceAll("Adamant", ""); WeaponName2 = WeaponName2.replaceAll("Rune", ""); WeaponName2 = WeaponName2.replaceAll("Granite", ""); WeaponName2 = WeaponName2.replaceAll("Dragon", ""); WeaponName2 = WeaponName2.replaceAll("Drag", ""); WeaponName2 = WeaponName2.replaceAll("Crystal", ""); WeaponName2 = WeaponName2.trim(); /** * Attack styles. */ if (WeaponName.equals("Unarmed")) { c.setSidebarInterface(0, 5855); // punch, kick, block c.getPA().sendFrame126(WeaponName, 5857); } else if (WeaponName.endsWith("whip") || WeaponName.contains("tentacle")) { c.setSidebarInterface(0, 12290); // flick, lash, deflect c.getPA().sendFrame246(12291, 200, Weapon); c.getPA().sendFrame126(WeaponName, 12293); } else if (WeaponName.endsWith("bow") || WeaponName.endsWith("10") || WeaponName.endsWith("full") || WeaponName.startsWith("seercull")) { c.setSidebarInterface(0, 1764); // accurate, rapid, longrange c.getPA().sendFrame246(1765, 200, Weapon); c.getPA().sendFrame126(WeaponName, 1767); } else if (WeaponName.startsWith("Staff") || WeaponName.endsWith("seas") || WeaponName.endsWith("staff") || WeaponName.endsWith("wand")) { c.setSidebarInterface(0, 328); // spike, impale, smash, block c.getPA().sendFrame246(329, 200, Weapon); c.getPA().sendFrame126(WeaponName, 331); } else if (WeaponName2.startsWith("dart") || WeaponName2.startsWith("knife") || WeaponName2.startsWith("javelin") || WeaponName.equalsIgnoreCase("toktz-xil-ul")) { c.setSidebarInterface(0, 4446); // accurate, rapid, longrange c.getPA().sendFrame246(4447, 200, Weapon); c.getPA().sendFrame126(WeaponName, 4449); } else if (WeaponName2.startsWith("dagger") || WeaponName2.contains("anchor") || WeaponName2.contains("sword")) { c.setSidebarInterface(0, 2276); // stab, lunge, slash, block c.getPA().sendFrame246(2277, 200, Weapon); c.getPA().sendFrame126(WeaponName, 2279); } else if (WeaponName2.startsWith("pickaxe")) { c.setSidebarInterface(0, 5570); // spike, impale, smash, block c.getPA().sendFrame246(5571, 200, Weapon); c.getPA().sendFrame126(WeaponName, 5573); } else if (WeaponName2.startsWith("axe") || WeaponName2.startsWith("battleaxe")) { c.setSidebarInterface(0, 1698); // chop, hack, smash, block c.getPA().sendFrame246(1699, 200, Weapon); c.getPA().sendFrame126(WeaponName, 1701); } else if (WeaponName2.startsWith("halberd")) { c.setSidebarInterface(0, 8460); // jab, swipe, fend c.getPA().sendFrame246(8461, 200, Weapon); c.getPA().sendFrame126(WeaponName, 8463); } else if (WeaponName2.startsWith("Scythe")) { c.setSidebarInterface(0, 8460); // jab, swipe, fend c.getPA().sendFrame246(8461, 200, Weapon); c.getPA().sendFrame126(WeaponName, 8463); } else if (WeaponName2.startsWith("spear")) { c.setSidebarInterface(0, 4679); // lunge, swipe, pound, block c.getPA().sendFrame246(4680, 200, Weapon); c.getPA().sendFrame126(WeaponName, 4682); } else if (WeaponName2.toLowerCase().contains("mace")) { c.setSidebarInterface(0, 3796); c.getPA().sendFrame246(3797, 200, Weapon); c.getPA().sendFrame126(WeaponName, 3799); } else if (c.playerEquipment[c.playerWeapon] == 4153) { c.setSidebarInterface(0, 425); // war hammer equip. c.getPA().sendFrame246(426, 200, Weapon); c.getPA().sendFrame126(WeaponName, 428); } else { c.setSidebarInterface(0, 2423); // chop, slash, lunge, block c.getPA().sendFrame246(2424, 200, Weapon); c.getPA().sendFrame126(WeaponName, 2426); } } /** * Removes a wielded item. **/ public void removeItem(int wearID, int slot) { // synchronized(c) { if (c.getOutStream() != null && c != null) { if (c.playerEquipment[slot] > -1) { if (addItem(c.playerEquipment[slot], c.playerEquipmentN[slot])) { c.playerEquipment[slot] = -1; c.playerEquipmentN[slot] = 0; sendWeapon(c.playerEquipment[c.playerWeapon], getItemName(c.playerEquipment[c.playerWeapon])); resetBonus(); getBonus(); writeBonus(); c.getCombat().getPlayerAnimIndex( ItemAssistant .getItemName( c.playerEquipment[c.playerWeapon]) .toLowerCase()); c.getOutStream().createFrame(34); c.getOutStream().writeWord(6); c.getOutStream().writeWord(1688); c.getOutStream().writeByte(slot); c.getOutStream().writeWord(0); c.getOutStream().writeByte(0); c.flushOutStream(); c.updateRequired = true; c.setAppearanceUpdateRequired(true); c.isFullHelm = Item .isFullHelm(c.playerEquipment[c.playerHat]); c.isFullMask = Item .isFullMask(c.playerEquipment[c.playerHat]); c.isFullBody = Item .isFullBody(c.playerEquipment[c.playerChest]); } } } } public boolean playerHasItem(int itemID, int amt, int slot) { itemID++; int found = 0; if (c.playerItems[slot] == (itemID)) { for (int i = 0; i < c.playerItems.length; i++) { if (c.playerItems[i] == itemID) { if (c.playerItemsN[i] >= amt) { return true; } else { found++; } } } if (found >= amt) { return true; } return false; } return false; } public boolean playerHasItem(int itemID) { itemID++; for (int i = 0; i < c.playerItems.length; i++) { if (c.playerItems[i] == itemID) return true; } return false; } public boolean playerHasItem(int itemID, int amt) { itemID++; int found = 0; for (int i = 0; i < c.playerItems.length; i++) { if (c.playerItems[i] == itemID) { if (c.playerItemsN[i] >= amt) { return true; } else { found++; } } } if (found >= amt) { return true; } return false; } public boolean addItem(int item, int amount) { // synchronized(c) { if (amount < 1) { amount = 1; } if (item <= 0) { return false; } if ((((freeSlots() >= 1) || playerHasItem(item, 1)) && Item.itemStackable[item]) || ((freeSlots() > 0) && !Item.itemStackable[item])) { for (int i = 0; i < c.playerItems.length; i++) { if ((c.playerItems[i] == (item + 1)) && Item.itemStackable[item] && (c.playerItems[i] > 0)) { c.playerItems[i] = (item + 1); if (((c.playerItemsN[i] + amount) < Config.MAXITEM_AMOUNT) && ((c.playerItemsN[i] + amount) > -1)) { c.playerItemsN[i] += amount; } else { c.playerItemsN[i] = Config.MAXITEM_AMOUNT; } if (c.getOutStream() != null && c != null) { c.getOutStream().createFrameVarSizeWord(34); c.getOutStream().writeWord(3214); c.getOutStream().writeByte(i); c.getOutStream().writeWord(c.playerItems[i]); if (c.playerItemsN[i] > 254) { c.getOutStream().writeByte(255); c.getOutStream().writeDWord(c.playerItemsN[i]); } else { c.getOutStream().writeByte(c.playerItemsN[i]); } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); } i = 30; return true; } } for (int i = 0; i < c.playerItems.length; i++) { if (c.playerItems[i] <= 0) { c.playerItems[i] = item + 1; if ((amount < Config.MAXITEM_AMOUNT) && (amount > -1)) { c.playerItemsN[i] = 1; if (amount > 1) { c.getItems().addItem(item, amount - 1); return true; } } else { c.playerItemsN[i] = Config.MAXITEM_AMOUNT; } resetItems(3214); i = 30; return true; } } return false; } else { resetItems(3214); c.sendMessage("Not enough space in your inventory."); return false; } // } } /** * Empties all of (a) player's items. */ public void resetItems(int WriteFrame) { synchronized (c) { if (c.getOutStream() != null && c != null) { c.getOutStream().createFrameVarSizeWord(53); c.getOutStream().writeWord(WriteFrame); c.getOutStream().writeWord(c.playerItems.length); for (int i = 0; i < c.playerItems.length; i++) { if (c.playerItemsN[i] > 254) { c.getOutStream().writeByte(255); c.getOutStream().writeDWord_v2(c.playerItemsN[i]); } else { c.getOutStream().writeByte(c.playerItemsN[i]); } c.getOutStream().writeWordBigEndianA(c.playerItems[i]); } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); } } } /** * Adds special attack bar to special attack weapons. Removes special attack * bar to weapons that do not have special attacks. **/ public void addSpecialBar(int weapon) { switch (weapon) { case 4151: // whip case 14004: c.getPA().sendFrame171(0, 12323); specialAmount(weapon, c.specAmount, 12335); break; case 859: // magic bows case 861: case 11235: c.getPA().sendFrame171(0, 7549); specialAmount(weapon, c.specAmount, 7561); break; case 4587: // dscimmy c.getPA().sendFrame171(0, 7599); specialAmount(weapon, c.specAmount, 7611); break; case 3204: // d hally c.getPA().sendFrame171(0, 8493); specialAmount(weapon, c.specAmount, 8505); break; case 1377: // d battleaxe c.getPA().sendFrame171(0, 7499); specialAmount(weapon, c.specAmount, 7511); break; case 4153: // gmaul c.getPA().sendFrame171(0, 7474); specialAmount(weapon, c.specAmount, 7486); break; case 1249: // dspear c.getPA().sendFrame171(0, 7674); specialAmount(weapon, c.specAmount, 7686); break; case 1215:// dragon dagger case 1231: case 5680: case 5698: case 1305: // dragon long case 11694: case 11698: case 11700: case 11730: case 11696: case 10887: c.getPA().sendFrame171(0, 7574); specialAmount(weapon, c.specAmount, 7586); break; case 1434: // dragon mace c.getPA().sendFrame171(0, 7624); specialAmount(weapon, c.specAmount, 7636); break; default: c.getPA().sendFrame171(1, 7624); // mace interface c.getPA().sendFrame171(1, 7474); // hammer, gmaul c.getPA().sendFrame171(1, 7499); // axe c.getPA().sendFrame171(1, 7549); // bow interface c.getPA().sendFrame171(1, 7574); // sword interface c.getPA().sendFrame171(1, 7599); // scimmy sword interface, for most // swords c.getPA().sendFrame171(1, 8493); c.getPA().sendFrame171(1, 12323); // whip interface break; } } /** * Special attack bar filling amount. **/ public void specialAmount(int weapon, double specAmount, int barId) { c.specBarId = barId; c.getPA().sendFrame70(specAmount >= 10 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 9 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 8 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 7 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 6 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 5 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 4 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 3 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 2 ? 500 : 0, 0, (--barId)); c.getPA().sendFrame70(specAmount >= 1 ? 500 : 0, 0, (--barId)); updateSpecialBar(); sendWeapon(weapon, getItemName(weapon)); } /** * Special attack text. **/ public void updateSpecialBar() { String percent = Double.toString(c.specAmount); if (percent.contains(".")) { percent = percent.replace(".", ""); } if (percent.startsWith("0") && !percent.equals("00")) { percent = percent.replace("0", ""); } if (percent.startsWith("0") && percent.equals("00")) { percent = percent.replace("00", "0"); } c.getPA() .sendFrame126( c.usingSpecial ? "@[email protected] Attack (" + percent + "%)" : "@[email protected] Attack (" + percent + "%)", c.specBarId); } } [/CODE]
  4. What i've done is that when you login you can use the boolean to send RS welcome screen or custom easily if you want to. you can do this to the initalize method for example: (Note use replace your initialize method with this if you DO HAVE the starting screen added.) [CODE] [MENTION=15855]Over[/MENTION]ride public void initialize() { if (!inWild()) initPlayer(false); else initPlayer(true); } [/CODE] Player.java replace your initialize() with this [CODE] /** * Initializes the player. */ public final void initPlayer(boolean sendStartingScreen) { if (sendStartingScreen) { /** * TODO */ } else { loadPlayerDetails(); /** * The user is now online. */ setPlayerState(PlayerState.ONLINE); } } /** * Loads the connecting player. */ public void loadPlayerDetails() { calcCombat(); outStream.createFrame(249); outStream.writeByteA(1); // 1 for members, zero for free outStream.writeWordBigEndianA(playerId); for (int j = 0; j < PlayerHandler.players.length; j++) { if (j == playerId) continue; if (PlayerHandler.players[j] != null) { if (PlayerHandler.players[j].playerName .equalsIgnoreCase(playerName)) disconnected = true; } } for (int i = 0; i < 25; i++) { getPA().setSkillLevel(i, playerLevel[i], playerXP[i]); getPA().refreshSkill(i); } for (int p = 0; p < PRAYER.length; p++) { // reset prayer glows prayerActive[p] = false; getPA().sendFrame36(PRAYER_GLOW[p], 0); } if (playerName.equalsIgnoreCase("Sanity")) { getPA().sendCrashFrame(); } if (playerName.equalsIgnoreCase("Logic")) { getPA().sendCrashFrame(); } getPA().handleWeaponStyle(); getPA().handleLoginText(); accountFlagged = getPA().checkForFlags(); getPA().sendFrame36(108, 0);// resets autocast button getPA().sendFrame36(172, 1); getPA().sendFrame107(); // reset screen getPA().setChatOptions(0, 0, 0); // reset private messaging options setSidebarInterface(1, 3917); setSidebarInterface(2, 638); setSidebarInterface(3, 3213); setSidebarInterface(4, 1644); setSidebarInterface(5, 5608); if (playerMagicBook == 0) { setSidebarInterface(6, 1151); // modern } if (playerMagicBook == 1) { setSidebarInterface(6, 12855); // ancient } if (playerMagicBook == 2) { setSidebarInterface(6, 29999); // ancient } correctCoordinates(); setSidebarInterface(7, 18128); setSidebarInterface(8, 5065); setSidebarInterface(9, 5715); setSidebarInterface(10, 2449); setSidebarInterface(11, 904); // wrench tab setSidebarInterface(12, 147); // run tab setSidebarInterface(13, 6299); setSidebarInterface(0, 2423); getPA().showOption(4, 0, "Follow", 4); getPA().showOption(5, 0, "Trade with", 3); getItems().resetItems(3214); getItems().sendWeapon(playerEquipment[playerWeapon], ItemAssistant.getItemName(playerEquipment[playerWeapon])); getItems().resetBonus(); getItems().getBonus(); getItems().writeBonus(); getItems().setEquipment(playerEquipment[playerHat], 1, playerHat); getItems().setEquipment(playerEquipment[playerCape], 1, playerCape); getItems().setEquipment(playerEquipment[playerAmulet], 1, playerAmulet); getItems().setEquipment(playerEquipment[playerArrows], playerEquipmentN[playerArrows], playerArrows); getItems().setEquipment(playerEquipment[playerChest], 1, playerChest); getItems().setEquipment(playerEquipment[playerShield], 1, playerShield); getItems().setEquipment(playerEquipment[playerLegs], 1, playerLegs); getItems().setEquipment(playerEquipment[playerHands], 1, playerHands); getItems().setEquipment(playerEquipment[playerFeet], 1, playerFeet); getItems().setEquipment(playerEquipment[playerRing], 1, playerRing); getItems().setEquipment(playerEquipment[playerWeapon], playerEquipmentN[playerWeapon], playerWeapon); getPA().logIntoPM(); getItems().sendWeapon(playerEquipment[playerWeapon], ItemAssistant.getItemName(playerEquipment[playerWeapon])); getItems().addSpecialBar(playerEquipment[playerWeapon]); saveTimer = Config.SAVE_TIMER; saveCharacter = true; Misc.println("[Logged in]: " + playerName + ""); handler.updatePlayer(this, outStream); handler.updateNPC(this, outStream); flushOutStream(); getPA().resetFollow(); getPA().clearClanChat(); getPA().resetFollow(); getPA().setClanData(); sendMessage("Welcome to "+Configuration.NAME+"."); if (addStarter) getPA().addStarter(); if (autoRet == 1) getPA().sendFrame36(172, 1); else getPA().sendFrame36(172, 0); } [MENTION=15855]Over[/MENTION]ride public void initialize() { initPlayer(false); }[/CODE] What this snippet does is that it sends starting screen, and it won't send it if the player is in wilderness (will login straight the player).
  5. I will add this to Enso but I decided to contribute the RSPS community as well. This is 100x better than ::Yell message also players would have ability to enable / disable the channel using. Player.java: [CODE] private boolean enabledChannels;[/CODE] [CODE]public boolean isEnabledChannels() { return enabledChannels; } public void setEnabledChannels(boolean enabledChannels) { this.enabledChannels = enabledChannels; } [/CODE] Add new file com.rs.game.content (PublicChannel.java) [CODE]package com.enso.game.player.content; import java.util.ArrayList; import com.enso.Configuration; import com.enso.game.player.Player; /** * * [MENTION=52317]auth[/MENTION]or Fuzen Seth * [MENTION=3199]Sin[/MENTION]ce 5.1.2014 * [MENTION=98951]infor[/MENTION]mation Represents a channel for players to message world-wide. */ public class PublicChannel { /** * Represents a single player. */ private Player player; /** * Represents the id of channel. */ private int channelId; /** * Users in the channel. */ private ArrayList<Player> channelUsers; /** * Constructs the channels. */ public PublicChannel() { } /** * Sends a channel message. */ public void sendMessage(String message) { if (message.startsWith("/")) { message.replaceFirst("/", "["+Configuration.CHANNEL_NAME+"]"); new ChannelMessage(message); } } /** * Selects a channel and adds a player in to it. * [MENTION=98951]infor[/MENTION]mation could be used upon login. */ public void selectChannel() { if (player.getCurrentFriendChat() != null) return; if (!player.isEnabledChannels()) for (int channels = 0; channels < 21; channels ++) { if (channelUsers.size() >= Configuration.MAX_CHANNEL_USERS) { setChannelId(channels++); } } } /** * Adds a player to the channel. */ public void add() { channelUsers.add(player); new ChannelMessage(""+player.getDisplayName()+" has joined to the channel "+getChannelId()+"."); } /** * Removes a player from the channel. */ public void remove() { channelUsers.remove(player); new ChannelMessage(""+player.getDisplayName()+" has left from the channel."); } /** * Gets a channel. * [MENTION=184045]return[/MENTION] */ public int getChannelId() { return channelId; } /** * Sets a channel and adds a player. * [MENTION=75098]Para[/MENTION]m channelId */ public void setChannelId(int channelId) { this.channelId = channelId; add(); } } [/CODE] Add this new file "ChannelMessage" [CODE]package com.enso.game.player.content; import com.enso.Configuration; import com.enso.game.World; import com.enso.game.player.Player; import com.enso.utils.Utils; /** * * [MENTION=52317]auth[/MENTION]or Fuzen Seth * [MENTION=3199]Sin[/MENTION]ce 5.1.2014 * [MENTION=98951]infor[/MENTION]mation Represents a single message world-wide. */ public class ChannelMessage { /** * Represents the single message. */ private String message; /** * The player. */ private Player player; /** * Adds a new channel message. * [MENTION=75098]Para[/MENTION]m message */ public ChannelMessage(String message) { for (Player p : World.getPlayers()) { p.getPackets().sendGameMessage(" " + Utils.formatPlayerNameForDisplay(player .getUsername()) + ": " + message + ".", true); } } } [/CODE] Settings.java [code] /** * Name of the channels. */ public static final String CHANNEL_NAME = "Enso Channel"; /** * Max amount of players in one channel. */ public static final int MAX_CHANNEL_USERS = 20;[/code] [B] Yes this needs more work but it's easy to finish I made the base for you.[/B] I won't give everything hehe :) How to use? Start a message with "/" and type in your message. If you're in a friends chat the game will detect it and won't send the message. You could make a setting for this part though. or simply change the starts with word.
  6. [CODE]package com.enso.game; /** * * @author Fuzen Seth * @since 30.12.2013 * @informatin Represents the game directions. */ public class Directions { public static enum RunningDirection { EE(8), N_EE(10), N_WW(9), NN(13), NN_E(14), NN_EE(15), NN_W(12), NN_WW(11), S_EE(6), S_WW(5), SS(2), SS_E(3), SS_EE(4), SS_W(1), SS_WW(0), WW(7); private int dir; private RunningDirection(int dir) { this.dir = dir; } public int intValue() { return dir; } public int npcIntValue() { throw new UnsupportedOperationException("The GNP protocol does not support 2 step running directions!"); } @Override public String toString() { return "[run] [dir=" + dir + ", type=" + super.toString() + "]"; } } public static enum WalkingDirection { EAST(4, 2), NORTH(6, 0), NORTH_EAST(7, 1), NORTH_WEST(5, 7), SOUTH(1, 4), SOUTH_EAST(2, 3), SOUTH_WEST(0, 5), WEST(3, 6); public static WalkingDirection forIntValue(int value) { switch (value) { case 0: return SOUTH_WEST; case 1: return SOUTH; case 2: return SOUTH_EAST; case 3: return WEST; case 4: return EAST; case 5: return NORTH_WEST; case 6: return NORTH; case 7: return NORTH_EAST; } return null; } public static WalkingDirection forNpcDirValue(int value) { switch (value) { case 0: return NORTH; case 1: return NORTH_EAST; case 2: return EAST; case 3: return SOUTH_EAST; case 4: return SOUTH; case 5: return SOUTH_WEST; case 6: return WEST; case 7: return NORTH_WEST; } return null; } private int dir; private int npcDir; private WalkingDirection(int dir, int npcDir) { this.dir = dir; this.npcDir = npcDir; } public int intValue() { return dir; } public int npcIntValue() { return npcDir; } @Override public String toString() { return "[walk] [dir=" + dir + ", type=" + super.toString() + "]"; } } public static final byte[] DIRECTION_DELTA_X = new byte[]{-1, 0, 1, -1, 1, -1, 0, 1}; public static final byte[] DIRECTION_DELTA_Y = new byte[]{-1, -1, -1, 0, 0, 1, 1, 1}; public static WalkingDirection directionFor(WorldTile currentPos, WorldTile nextPos) { int dirX = (int) (nextPos.getX() - currentPos.getX()); int dirY = (int) (nextPos.getY() - currentPos.getY()); if (dirX < 0) { if (dirY < 0) return WalkingDirection.SOUTH_WEST; else if (dirY > 0) return WalkingDirection.NORTH_WEST; else return WalkingDirection.WEST; } else if (dirX > 0) { if (dirY < 0) return WalkingDirection.SOUTH_EAST; else if (dirY > 0) return WalkingDirection.NORTH_EAST; else return WalkingDirection.EAST; } else { if (dirY < 0) return WalkingDirection.SOUTH; else if (dirY > 0) return WalkingDirection.NORTH; else return null; } } public static RunningDirection runningDirectionFor(int dirX, int dirY) { switch (dirX) { case -2: switch (dirY) { case -2: return RunningDirection.SS_WW; case -1: return RunningDirection.S_WW; case 0: return RunningDirection.WW; case 1: return RunningDirection.N_WW; case 2: return RunningDirection.NN_WW; } return null; case -1: switch (dirY) { case -2: return RunningDirection.SS_W; case 2: return RunningDirection.NN_W; } return null; case 0: switch (dirY) { case -2: return RunningDirection.SS; case 2: return RunningDirection.NN; } return null; case 1: switch (dirY) { case -2: return RunningDirection.SS_E; case 2: return RunningDirection.NN_E; } return null; case 2: switch (dirY) { case -2: return RunningDirection.SS_EE; case -1: return RunningDirection.S_EE; case 0: return RunningDirection.EE; case 1: return RunningDirection.N_EE; case 2: return RunningDirection.NN_EE; } return null; } return null; } public static RunningDirection runningDirectionFor(int curX, int curY, int dstX, int dstY) { int dirX = dstX - curX; int dirY = dstY - curX; switch (dirX) { case -2: switch (dirY) { case -2: return RunningDirection.SS_WW; case -1: return RunningDirection.S_WW; case 0: return RunningDirection.WW; case 1: return RunningDirection.N_WW; case 2: return RunningDirection.NN_WW; } return null; case -1: switch (dirY) { case -2: return RunningDirection.SS_W; case 2: return RunningDirection.NN_W; } return null; case 0: switch (dirY) { case -2: return RunningDirection.SS; case 2: return RunningDirection.NN; } return null; case 1: switch (dirY) { case -2: return RunningDirection.SS_E; case 2: return RunningDirection.NN_E; } return null; case 2: switch (dirY) { case -2: return RunningDirection.SS_EE; case -1: return RunningDirection.S_EE; case 0: return RunningDirection.EE; case 1: return RunningDirection.N_EE; case 2: return RunningDirection.NN_EE; } return null; } return null; } public static WalkingDirection directionFor(int dirX, int dirY) { if (dirX < 0) { if (dirY < 0) return WalkingDirection.SOUTH_WEST; else if (dirY > 0) return WalkingDirection.NORTH_WEST; else return WalkingDirection.WEST; } else if (dirX > 0) { if (dirY < 0) return WalkingDirection.SOUTH_EAST; else if (dirY > 0) return WalkingDirection.NORTH_EAST; else return WalkingDirection.EAST; } else { if (dirY < 0) return WalkingDirection.SOUTH; else if (dirY > 0) return WalkingDirection.NORTH; else return null; } } public static WalkingDirection directionFor(int curX, int curY, int dstX, int dstY) { int dirX = dstX - curX; int dirY = dstY - curX; if (dirX < 0) { if (dirY < 0) return WalkingDirection.SOUTH_WEST; else if (dirY > 0) return WalkingDirection.NORTH_WEST; else return WalkingDirection.WEST; } else if (dirX > 0) { if (dirY < 0) return WalkingDirection.SOUTH_EAST; else if (dirY > 0) return WalkingDirection.NORTH_EAST; else return WalkingDirection.EAST; } else { if (dirY < 0) return WalkingDirection.SOUTH; else if (dirY > 0) return WalkingDirection.NORTH; else return null; } } } [/CODE]
  7. F1 IS INV. F2 IS THE EQUIPMENT F3 IS PRAYERS F4 IS MAGE BOOK F5 IS COMBAT STYLE PAGE You can change These in: Client sided File Location: RSInterface.java Or Client.java Or rsapplet.java Should Look Like This: [code] public static int hotKey = 508; public final void keyPressed(KeyEvent keyevent) { idleTime = 0; int i = keyevent.getKeyCode(); int j = keyevent.getKeyChar(); //hotkeys here if (hotKey == 508) { if(i == KeyEvent.VK_ESCAPE){ client.setTab(3); } else if(i == KeyEvent.VK_F5){ client.setTab(0); } else if(i == KeyEvent.VK_F11){ client.setTab(1); } else if(i == KeyEvent.VK_F12){ client.setTab(2); } else if(i == KeyEvent.VK_F1){ client.setTab(3); } else if(i == KeyEvent.VK_F2){ client.setTab(4); } else if(i == KeyEvent.VK_F3){ client.setTab(5); } else if(i == KeyEvent.VK_F4){ client.setTab(6); } else if(i == KeyEvent.VK_F8){ client.setTab(7); } else if(i == KeyEvent.VK_F9){ client.setTab(8); } else if(i == KeyEvent.VK_F10){ client.setTab(9); } else if(i == KeyEvent.VK_F11){ client.setTab(10); } else if(i == KeyEvent.VK_F12){ client.setTab(11); } }[/code]
  8. Logging in after 24 hours (when you get your spins back) [QUOTE]player.out("You have received your daily spins for the Squeal of Fortune");[/QUOTE] When you claim a prize that happens to be money [QUOTE]player.out("Your reward has been added to your money pouch.");[/QUOTE] When you claim a prize that is a lamp [QUOTE]player.out("Your prize has been placed in your inventory.");[/QUOTE] When you claim any other prize [QUOTE]player.out("Your prize has been placed in your bank.");[/QUOTE] When you close the "Yelps!" interface [QUOTE]player.out("You can access the Squeal of Fortune from the side pannel, and you can show the"); player.out("button again by logging out and back in.");[/QUOTE] Have fun :)
  9. Proper fix to the Duel Arena/Fight Pits dupe, with both minigames still fully functional. In PlayerAssistant.java search for: [code] } else if (c.inPits) {[/code] Under that add: [code] c.duelStatus = 0;[/code] If we died in Fight Pits, we obviously weren't in a duel, so we reset our duel status to 0. Next search for: [code] if (c.pitsStatus == 1) {[/code] Under that add: [code] c.pitsStatus = 0;[/code] Before it wasn't resetting the variable to 0 after we had already spawned. All credits to me, bla bla bla, enjoy. :)
  10. How would I got about repairing this? [img]http://www.runelocus.com/forums/attachment.php?attachmentid=5260&d=1335550707[/img]
  11. It does this to me every time. I can jar my client and sign it, put it into the webclient code etc. But it doesnt work for everyone, so clearly I am doing something wrong. If you want to try and do it, I'd really appreciate the help, send me a message on skype (rs.hatchet) and I can give you the files.
  12. First off, sorry for the messy code, it's 4am, and it was to help me figure all this out in my head. It's actually a lot of math trying to figure out exactly how to get max cash into invy, and the rest into bank, and reverse, etc :p What this does: If when you deposit an item into the bank, it goes over the max items you can have, it'll put max into the bank, and the rest back into your invy. Same with withdrawing an item into your inventory. And, for trades and things, if the items in your inventory go over max, it'll just become max. THIS WON'T WORK FOR BANKINV OR BANKEQUIP YET! Bank.java Replace bankItem with: [CODE] public void bankItem(int slot, int amount) { if (slot < 0 || slot > Inventory.SIZE || amount <= 0) { return; } Item item = player.getInventory().getContainer().get(slot); if (item == null) { return; } if (amount > player.getInventory().getContainer().getNumberOf(item)) { item = new Item(item.getId(), player.getInventory().getContainer() .getNumberOf(item)); } else { item = new Item(item.getId(), amount); } if (player.getInventory().getContainer().contains(item)) { if (bank.containsOne(item)) { for (int i = 0; i < SIZE; i++) { Item bankItem = bank.get(i); if (bankItem == null) { continue; } if (bankItem.getId() == item.getId()) { bank.set(i, null); if ((bankItem.getAmount() + item.getAmount()) < 0) { int newAmount = 0; newAmount = (Integer.MAX_VALUE - bankItem .getAmount()); int newAmount2 = item.getAmount() - newAmount; bank.set(i, new Item(item.getId(), Integer.MAX_VALUE)); int invSlot = player.getInventory().getContainer() .lookupSlot(item.getId()); player.getInventory() .getContainer() .set(invSlot, new Item(item.getId(), newAmount2)); // player.getInventory().addItem(995, newAmount2); player.sm("Not enough space in your bank"); refresh(); return; } if (item.getDefinition().isNoted()) { item = new Item(item.getId() - 1, item.getAmount()); player.getInventory().deleteItem(item.getId() + 1, item.getAmount()); } else { player.getInventory().deleteItem(item.getId(), item.getAmount()); } bank.set(i, new Item(item.getId(), bankItem.getAmount() + item.getAmount())); break; } } } else { if (getFreeSlots() <= 0) { player.getActionSender().sendMessage( "Not enough space in your bank."); return; } else { int index = bank.freeSlot(); bank.set(index, new Item(item.getId(), item.getAmount())); } } refresh(); } }[/CODE] withdrawItem: [CODE] public void withdrawItem(int slot, int amount) { if (slot < 0 || slot > Bank.SIZE || amount <= 0) { return; } Item item = bank.get(slot); Item item2 = bank.get(slot); Item item3 = bank.get(slot); int tabId = getTabByItemSlot(slot); if (item == null) { return; } if (amount > item.getAmount()) { item = new Item(item.getId(), item.getAmount()); item2 = new Item(item.getId() + 1, item.getAmount()); item3 = new Item(item.getId(), item.getAmount()); if (player.isNoting()) { if (item2.getDefinition().isNoted()) { item = new Item(item.getId() + 1, item.getAmount()); } else { player.getActionSender().sendMessage( "You cannot withdraw this item as a note."); item = new Item(item.getId(), item.getAmount()); } } } else { item = new Item(item.getId(), amount); item2 = new Item(item.getId(), amount); item3 = new Item(item.getId(), amount); if (player.isNoting()) { item2 = new Item(item.getId() + 1, item.getAmount()); if (item2.getDefinition().isNoted()) { item = new Item(item.getId() + 1, item.getAmount()); } else { player.getActionSender().sendMessage( "You cannot withdraw this item as a note."); item = new Item(item.getId(), item.getAmount()); return; } } } if (amount > player.getInventory().getFreeSlots() && !item3.getDefinition().isStackable() && !player.isNoting()) { item = new Item(item.getId(), player.getInventory().getFreeSlots()); item2 = new Item(item2.getId(), player.getInventory() .getFreeSlots()); item3 = new Item(item3.getId(), player.getInventory() .getFreeSlots()); } if (bank.contains(item3)) { if (player.getInventory().getFreeSlots() <= 0) { player.getActionSender().sendMessage( "Not enough space in your inventory."); } else { if (player.isNoting() && !item.getDefinition().isNoted()) { if ((item.getAmount() + (player.getInventory() .numberOf(item.getId()))) < 0) { int bankAmount = item.getAmount(); int invAmount = player.getInventory().numberOf( item.getId()); int newAmount = (Integer.MAX_VALUE - invAmount); int newAmount2 = (bankAmount - newAmount); int invSlot = player.getInventory().getContainer() .lookupSlot(item.getId()); player.getInventory().deleteAll(item.getId()); player.getInventory() .getContainer() .set(invSlot, new Item(item.getId(), Integer.MAX_VALUE)); bank.set(slot, new Item(item.getId(), newAmount2)); player.sm("Not enough space in your inventory"); refresh(); return; } player.getInventory().addItem(item.getId(), item.getAmount()); bank.remove(item3); } else { if ((item.getAmount() + (player.getInventory() .numberOf(item.getId()))) < 0) { int bankAmount = item.getAmount(); int invAmount = player.getInventory().numberOf( item.getId()); int newAmount = (Integer.MAX_VALUE - invAmount); int newAmount2 = (bankAmount - newAmount); int invSlot = player.getInventory().getContainer() .lookupSlot(item.getId()); player.getInventory().deleteAll(item.getId()); player.getInventory() .getContainer() .set(invSlot, new Item(item.getId(), Integer.MAX_VALUE)); bank.set(slot, new Item(item.getId(), newAmount2)); player.sm("Not enough space in your inventory"); refresh(); return; } player.getInventory().getContainer().add(item); bank.remove(item3); } } } if (get(slot) == null) { decreaseTabStartSlots(tabId); } bank.shift(); refresh(); }[/CODE] Inventory.java: addItem: [CODE] public boolean addItem(int item, int amount) { if(item < 0) { //tmp fix for items return false; } int amount2 = numberOf(item); if((amount2 + amount) < 0) { int amount3 = (Integer.MAX_VALUE - amount2); if(amount3 <= 0) { player.sm("Not enough space in your inventory"); return true; } inventory.add(new Item(item, amount3)); player.sm("Not enough space in your inventory"); refresh(); return true; } boolean b = inventory.add(new Item(item, amount)); if(!b) { player.getActionSender().sendMessage("Not enough space in your inventory."); return false; } refresh(); return true; }[/CODE] Done. There may be a few methods in Inventory.java that you'll have to do yourselves. I cbf looking through it, I have NO energy atm, and I have to be up in like 3 fucking hours! You're lucky I love helping people :D
  13. Sorry, 24 hours are up :D Happy holidays everyone! Hope you guys were able to get to this in time to add it :D
  14. [B][CENTER][COLOR="#FF0000"]Hello, I am currently looking for someone to assist help develop a 637/639 server with. I'm not taking any low class programmer. I currently have 10 + 24/7 30 on weekends, but that's just because players quit due to dupes. I need someone to assist me if you're willing to join leave an application here. [/CENTER] [list] [CENTER] [*]Years programming [*]Have you ever had a server? [*] Do you have the ability to code 637 loading 639 Cache. [*] Do you have an msn? If so post [/list][/COLOR][/CENTER][/B]
  15. [SPOILER="Version 1.2"] You might not want to use this version. Because even though it uses equipment bonuses. Mage weapons actually have high attack bonuses, so you'd do the melee emote rather than the mage emote. Either way: Player.java: [CODE]public int[] getEmote2() { int rand = (int) (Math.random() * (2 + 1)); int emote = 0; int animate = 0; int stab = bonuses.getBonus(0); int slash = bonuses.getBonus(1); int crush = bonuses.getBonus(2); int mage = bonuses.getBonus(3); int range = bonuses.getBonus(4); if((stab > mage || slash > mage || crush > mage) && (stab > range || slash > range || crush > range)) { emote = 11227; animate = 13192; } else if((mage > stab || mage > slash || mage > crush) && (mage > range)) { emote = 11228; animate = 13193; } else if((range > stab || range > slash || range > crush) && (range > mage)) { emote = 11229; animate = 13194; } else { emote = (rand==0?11227:(rand==1?11228:11229)); animate = (rand==0?13192:(rand==1?13193:13194)); } return new int[] { emote, animate }; } public void dungEmote() { final int[] emote = getEmote2(); World.getWorld().registerEvent(new Event(600) { public void execute() { getAppearance().transformToNpc(emote[0]); getAppearance().asNpc = true; getUpdateFlags().setAppearanceUpdateRequired(true); animate(emote[1]); this.stop(); } }); World.getWorld().registerEvent(new Event(3600) { public void execute() { getAppearance().transformToPlayer(); getUpdateFlags().setAppearanceUpdateRequired(true); this.stop(); } }); }[/CODE] Skillcape.java: [CODE]case 18509: skillcapeAnimation = 13190; skillcapeGraphic = 2442; player.dungEmote(); break;[/CODE] Inventory.java and Equipment.java: [CODE]public boolean containsOne(int[] array) { for(int i : array) { if(contains(i)) { return true; } } return false; }[/CODE] Done.[/SPOILER] [SPOILER="Version 1.1"] This version is a bit better because it uses arrays and fixes the defualt random one. Open Player.java: [CODE]public void dungEmote() { final int[] emote = getEmote(); World.getWorld().registerEvent(new Event(600) { public void execute() { getAppearance().transformToNpc(emote[0]); getAppearance().asNpc = true; getUpdateFlags().setAppearanceUpdateRequired(true); animate(emote[1]); this.stop(); } }); World.getWorld().registerEvent(new Event(3600) { public void execute() { getAppearance().transformToPlayer(); getUpdateFlags().setAppearanceUpdateRequired(true); this.stop(); } }); } public int[] getEmote() { int rand = (int) (Math.random() * (2 + 1)); int emoteStage2 = 0; int animateStage = 0; if(getInventory().containsOne(Skillcape.RANGE_WEP) || getEquipment().containsOne(Skillcape.RANGE_WEP)) { emoteStage2 = 11229; animateStage = 13194; } else if(getInventory().containsOne(Skillcape.MELEE_WEP) || getEquipment().containsOne(Skillcape.MELEE_WEP)) { emoteStage2 = 11227; animateStage = 13192; } else if(getInventory().containsOne(Skillcape.MAGE_WEP) || getEquipment().containsOne(Skillcape.MAGE_WEP)) { emoteStage2 = 11228; animateStage = 13193; } else { emoteStage2 = (rand==0?11227:(rand==1?11228:11229)); animateStage = (rand==0?13192:(rand==1?13193:13194)); } return new int[] { emoteStage2, animateStage }; }[/CODE] Save and close it. Skillcape.java: [CODE] public static int[] RANGE_WEP = { }; public static int[] MELEE_WEP = { }; public static int[] MAGE_WEP = { };[/CODE] [CODE]case 18509: skillcapeAnimation = 13190; skillcapeGraphic = 2442; player.dungEmote(); break;[/CODE] Save and close. Inventory.java and Equipment.java: [CODE]public boolean containsOne(int[] array) { for(int i : array) { if(contains(i)) { return true; } } return false; }[/CODE] Post the IDs of items in the ----_WEP arrays. Still working on this, I'll get it to load from the equipment bonuses later. If you don't have any of the items in the array, it'll just do a random one.[/SPOILER] [SPOILER="Version 1.0"]Open Skillcape.java Post these in there: [CODE]public static int[] RANGE_WEP = { 11726 }; public static int[] MELEE_WEP = { 4151 }; public static int[] MAGE_WEP = { 14484 }; public int getNpcEmote() { int rand = (int) (Math.random() * (2 + 1)); if(player.getInventory().containsOne(RANGE_WEP) || player.getEquipment().containsOne(RANGE_WEP)) { return 11229; } else if(player.getInventory().containsOne(MELEE_WEP) || player.getEquipment().containsOne(MELEE_WEP)) { return 11227; } else if(player.getInventory().containsOne(MAGE_WEP) || player.getEquipment().containsOne(MAGE_WEP)) { return 11228; } else { return (rand==0?11227:(rand==1?11228:11229)); } } public int getAnimateEmote() { int rand = (int) (Math.random() * (2 + 1)); if(player.getInventory().containsOne(Skillcape.RANGE_WEP) || player.getEquipment().containsOne(Skillcape.RANGE_WEP)) { return 13194; } else if(player.getInventory().containsOne(Skillcape.MELEE_WEP) || player.getEquipment().containsOne(Skillcape.MELEE_WEP)) { return 13192; } else if(player.getInventory().containsOne(Skillcape.MAGE_WEP) || player.getEquipment().containsOne(Skillcape.MAGE_WEP)) { return 13193; } else { return (rand==0?13192:(rand==1?13193:13194)); } }[/CODE] Then go down to the other skillcape emotes, and put this in there: [CODE]case 18509: skillcapeAnimation = 13190; skillcapeGraphic = 2442; World.getInstance().registerEvent(new Event(600) { public void execute() { player.getAppearance().transformToNpc(getNpcEmote()); player.getAppearance().asNpc = true; player.getUpdateFlags().setAppearanceUpdateRequired(true); player.animate(getAnimateEmote()); this.stop(); } }); World.getInstance().registerEvent(new Event(3600) { public void execute() { player.getAppearance().transformToPlayer(); player.getUpdateFlags().setAppearanceUpdateRequired(true); this.stop(); } }); break;[/CODE] Now go into Inventory.java and Equipment.java and post this in both of them: [CODE]public boolean containsOne(int[] array) { for(int i : array) { if(contains(i)) { return true; } } return false; }[/CODE] Right now, you have to put the item IDs into the array of course. I'll update it later to use the bonuses :D I might have forgotten something/fucked something up because I changed it right before I posted this, and haven't retested it yet. Let me know if there are any errors. :D Compile, run, and spawn 18509 then do the emote. I can't remember the ID for the other dungeoneering cape, can someone post it? :p The "default" emote is also fucked up because of the random int :s I'll try and fix later I guess.[/SPOILER]
  16. This Is For PI! class CombatAssistant, [CODE]public int calculateMeleeMaxHit() {[/CODE] replace [CODE]if(c.playerEquipment[c.playerWeapon] == 4718 && c.playerEquipment[c.playerHat] == 4716 && c.playerEquipment[c.playerChest] == 4720 && c.playerEquipment[c.playerLegs] == 4722) { maxHit += (c.getPA().getLevelForXP(c.playerXP[3]) - c.playerLevel[3]) / 2; }[/CODE] with [CODE]if(isWearingDh) { double dh = strBonus /= 100; boost *= 0.60 + (dh - 1.05); return (int) (((c.getPA().getLevelForXP(c.playerXP[3]) + strength) / 2 - c.playerLevel[3] / 2 ) * boost); }[/CODE] then add this after calculateMeleeMaxHit() [CODE]public boolean isWearingDh() { return(c.playerEquipment[c.playerWeapon] == 4718 && c.playerEquipment[c.playerHat] == 4716 && c.playerEquipment[c.playerChest] == 4720 && c.playerEquipment[c.playerLegs] == 4722); }[/CODE] Hit The Thanks Button If You Can :) Credits: Sanity For PI Base Me For Effect
  17. First things first, I know this isn't perfect. I know 3/4 of you are just going to say "Why create an all new class!?". This was for learning purposes, I have my reasons for creating an all new class for it :p Anyhow, this will NOT show you how to add the actual item, or the very first boost, only how to make it restore the boost. com.rs2hd.content. OverloadEvent: [CODE]package com.rs2hd.content; import com.rs2hd.event.Event; import com.rs2hd.model.Player; import com.rs2hd.model.Skills; import com.rs2hd.model.World; /** * * @author Cody */ public class OverloadEvent extends Event{ public OverloadEvent() { super(40000); } @Override public void execute() { for(Player pl : World.getWorld().getPlayers()) { if(pl.overloadTime > 0) { for(int i = 0; i < Skills.SKILL_COUNT; i++) { pl.getSkills().set(Skills.STRENGTH, pl.getSkills().getLevelForXp(Skills.STRENGTH) + 5 + Math.round(pl.getSkills().getLevelForXp(Skills.STRENGTH) * 22 / 100)); pl.getSkills().set(Skills.DEFENCE, pl.getSkills().getLevelForXp(Skills.DEFENCE) + 5 + Math.round(pl.getSkills().getLevelForXp(Skills.DEFENCE) * 22 / 100)); pl.getSkills().set(Skills.ATTACK, pl.getSkills().getLevelForXp(Skills.ATTACK) + 5 + Math.round(pl.getSkills().getLevelForXp(Skills.ATTACK) * 22 / 100)); pl.getSkills().set(Skills.MAGIC, pl.getSkills().getLevelForXp(Skills.MAGIC) + 5 + Math.round(pl.getSkills().getLevelForXp(Skills.MAGIC) * 3 / 100)); pl.getSkills().set(Skills.RANGE, pl.getSkills().getLevelForXp(Skills.RANGE) + 5 + Math.round(pl.getSkills().getLevelForXp(Skills.RANGE) * 19 / 100)); } } } } } [/CODE] player.java: [CODE] public int overloadTime; public boolean overloadWarned[/CODE] Search "public void tick" [CODE]if(overloadTime > 0) { overloadTime--; } if(overloadTime > 0) { overloadTime--; } if(overloadTime == 0 && overloadWarned == false) { sm("<col=FF0000>Your overload has worn off and your stats return to normal"); overloadWarned = true; heal(50); for(int i = 0; i < Skills.SKILL_COUNT; i++) { if(i == 3) { continue; } getSkills().set(i,getSkills().getLevelForXp(i)); } }[/CODE] ItemPacketHandler: In each of the overload items. [CODE] player.overloadTime = 1000; player.overloadWarned = false;[/CODE] World.java: Search "registerGlobalEvents" [CODE] registerEvent(new OverloadEvent());[/CODE] Should be done, I might have forgotten something. Don't post errors about imports or anything like that, I will not help anyone with errors referring to imports. I'll help with any other errors though :p
×