Jump to content

Search the Community

Showing results for tags 'crafting'.



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. [code]package com.argon.player.packet.impl; import com.argon.Config; import com.argon.event.Event; import com.argon.event.EventContainer; import com.argon.event.EventManager; import com.argon.item.ItemAssistant; import com.argon.player.Client; import com.argon.player.skills.SkillConstants; import static com.argon.player.skills.impl.BarbarianFishing.checkAll; /** * * @author Fuzen Seth * [MENTION=98951]infor[/MENTION]mation RS2 Crafting skill. * [MENTION=3199]Sin[/MENTION]ce 19.12.2014 */ public class NewCrafting { public static final int CHISEL = 1755; public static final double BOOST_MODIFIER = 2.003D; public enum Gem { OPAL(1625, 1609, 1, 1, 886), JADE(1627, 1611, 4, 13, 886), RED_TOPAZ(1629, 1613, 20, 16, 887), SAPPHIRE(1623, 1607, 35, 20, 888), EMERALD(1621, 1605, 43, 27, 889), RUBY(1619, 1603, 46, 34, 887), DIAMOND(1617, 1601, 60, 43, 890), DRAGONSTONE(1631, 1615, 70, 55,885), ONYX(6571, 6573, 200, 67, 2717); private final double experience; private final int levelRequired; private final int cut, uncut; private final int emote; private Gem(int cut, int uncut, double experience, int levelRequired, int emote) { this.cut = cut; this.uncut = uncut; this.experience = experience; this.levelRequired = levelRequired; this.emote = emote; } public int getLevelRequired() { return levelRequired; } public double getExperience() { return experience; } public int getUncut() { return uncut; } public int getCut() { return cut; } public int getEmote() { return emote; } } private Gem gem; private int quantity; public static boolean checkAll(Client player, Gem gem) { final String gemName = ItemAssistant.getItemName(gem.getCut()); if (player.duelingWith > 0 || player.isDead) return false; if (!player.getItems().playerHasItem(CHISEL) && !containsGem(player)) return false; if (player.playerLevel[SkillConstants.CRAFTING] < gem.getLevelRequired()) { player.sendMessage("You need a crafting level of "+gem.getLevelRequired()+" to cut "+gemName.toLowerCase()+"."); player.getDialogueManager().sendStatement("You need a crafting level of "+gem.getLevelRequired()+" to cut "+gemName.toLowerCase()+"."); return false; } return true; } /** If the uncut gem exists. */ private static final boolean containsGem(Client player) { for (Gem gem : Gem.values()) { if (gem != null) continue; if (player.getItems().playerHasItem(gem.getCut())) { player.getItems().deleteItem(gem.getCut(), 1); return true; } } return false; } /** * Processes gem cutting (looped task) * [MENTION=75098]Para[/MENTION]m player * [MENTION=75098]Para[/MENTION]m gem */ public static void cut(Client player, Gem gem) { String name = ItemAssistant.getItemName(gem.getCut()); String gemName = name.replace("uncut", ""); if (!checkAll(player, gem)) return; if (player.getTemporaryAttribrutes().get("crafting") != null) return; player.getTemporaryAttribrutes().put("crafting", player); player.startAnimation(gem.getEmote()); EventManager.getSingleton().addEvent((EventContainer e) -> { if (!checkAll(player, gem) ||!player.getItems().playerHasItem(gem.getCut(), 1)) { e.stop(); player.getTemporaryAttribrutes().remove("crafting"); return; } player.getItems().deleteItem2(gem.getCut(), 1); player.startAnimation(gem.getEmote()); player.getItems().addItem(gem.getUncut(), 1); player.sendMessage("You cut the "+gemName+"."); player.getPlayerAssistant().addSkillXP((int) gem.getExperience() * Config.CRAFTING_EXPERIENCE * (int) Math.floor(BOOST_MODIFIER), SkillConstants.CRAFTING); }, 1500); } } [/code] hashMap temporaryAttribruttes to player class, it's used to check player actions e.g walk,object.
  2. [code]import com.rs2hd.model.Player; import com.rs2hd.model.World; import com.rs2hd.model.Skills; import com.rs2hd.event.Event; /** * * @author ethan */ public class Crafting { public enum Gem { OPAL(1625, 1609, 13, 1), JADE(1627, 1611, 33, 13), TOPAZ(1629, 1613, 45, 16), SAPPHIRE(1623, 1607, 60, 20), EMERALD(1621, 1605, 80, 27), RUBY(1619, 1603, 90, 34), DIAMOND(1617, 1601, 110, 43), DRAGONSTONE(1631, 1615, 150, 55), ONYX(6571, 6573, 200, 67); private int gemId; private int craftedGemId; private int xp; private int level; Gem(int gemId, int craftedGemId, int xp, int level) { this.gemId = gemId; this.craftedGemId = craftedGemId; this.xp = xp; this.level = level; } public int getGemId() { return gemId; } public int getCraftedGemId() { return craftedGemId; } public int getXp() { return xp; } public int getLevel() { return level; } } private Player player; private Gem gem; private static final int CHISEL = 1755; public Crafting(Player player) { this.player = player; } public void execute(int itemUsed, int usedOn) { if (itemUsed == CHISEL || usedOn == CHISEL) { determineGem(itemUsed, usedOn); if (!hasCraftingLevel()) { player.getActionSender().sendMessage("You need a crafting level of " + gem.getLevel() + " to craft this gem."); return; } if (player.isBusy()) { return; } player.setBusy(true); World.getInstance().registerEvent(new Event(2100) { [MENTION=15855]Over[/MENTION]ride public void execute() { if (player.getInventory().numberOf(gem.getGemId()) <= 0) { player.getActionSender().sendMessage("You've ran out of gems to craft."); this.stop(); return; } player.getInventory().deleteItem(gem.getGemId(), 1); player.getInventory().addItem(gem.getCraftedGemId(), 1); player.getActionSender().sendMessage("You successfully crafted a gem!"); player.getSkills().addXp(Skills.CRAFTING, gem.getXp()); player.animate(885); player.setBusy(false); } }); } } private void determineGem(int itemUsed, int itemUsedOn) { Gem gemTemp; for (int i = 0; i < Gem.values().length; i++) { gemTemp = Gem.values()[i]; if (itemUsed == gemTemp.getGemId() || itemUsedOn == gemTemp.getGemId()) { gem = Gem.values()[i]; } } } private boolean hasCraftingLevel() { if (player.getSkills().getLevel(Skills.CRAFTING) >= gem.getLevel()) { return true; } return false; } }[/code] To replace the crafting in 562 rs2hd with this you'll want to go into you crafting.java and replace everything but the line of code at the top that says [code]package com.rs2hd.content.skills.Crafting[/code] then go to ItemPacketHandler.java search for [code]Crafting.craft(itemUsed, itemUsedWith);[/code] and replace it with [code]Crafting crafting = new Crafting(player); crafting.execute(itemUsed, itemUsedWith);[/code]
  3. [img]http://puu.sh/5CwkV.png[/img] This took me extremely long to do because I couldn't find a good damn event system. Then I just used the Action system... --- Go into [B]package[/B] com.rs.player.game.content and make a new class. Name it Spinning(.java). In the new class, add the following: [code] package com.rs.game.player.content; import com.rs.game.Animation; import com.rs.game.item.Item; import com.rs.game.player.Player; import com.rs.game.player.Skills; /** * The spinning wheel. * * @author Arham Siddiqui */ public class Spinning { /** * The spinning animation. */ public static final Animation SPINNING_ANIMATION = new Animation(896); /** * Can the player spin the Item? * * @param player The player. * @param itemId The Item's ID. * @return If the player can spin the Item. */ public static boolean canSpin(Player player, int itemId) { for (SpinningItem item : SpinningItem.values()) { for (int beforeId : item.getBeforeId()) { if (beforeId == itemId) { spin(player, item, itemId); return true; } } } return false; } /** * Gets the before ID from the after ID. * * @param afterId The after ID to be dependant on. * @return The before ID. */ public static int[] getBeforeFromAfter(int afterId) { for (SpinningItem item : SpinningItem.values()) { if (item.getAfterId() == afterId) { return item.getBeforeId(); } } return null; } /** * Spins the Item. * * @param player The player spinning the Item. * @param item The SpinningItem being spun. */ private static void spin(Player player, SpinningItem item, int itemId) { if (player.getSkills().getLevel(Skills.CRAFTING) < item.getSkillRequirement()) { player.getPackets().sendGameMessage("You need a Crafting level of " + item.getSkillRequirement() + " to craft this."); return; } player.setNextAnimation(SPINNING_ANIMATION); player.getInventory().deleteItem(new Item(itemId)); player.getSkills().addXp(Skills.CRAFTING, item.getExp()); player.getInventory().addItem(new Item(item.getAfterId())); } /** * The spinnable items. */ public enum SpinningItem { /** * The wool. */ WOOL(new int[]{1737}, 1759, 1, 2.5), /** * The flax. */ FLAX(new int[]{1779}, 1777, 1, 15), /** * The sinew */ SINEW(new int[]{9436}, 9438, 10, 15), /** * The magical roots. */ MAGIC_ROOTS(new int[]{6051}, 6038, 19, 30), /** * All the tree roots. */ TREE_ROOTS(new int[]{6049, 6047, 6045, 6043}, 6038, 19, 30), /** * The yak hair. */ YAK_HAIR(new int[]{10814}, 954, 30, 25); /** * The ID before. */ private int[] beforeId; /** * The ID after. */ private int afterId; /** * The required level. */ private int skillRequirement; /** * The experience gained. */ private double exp; /** * The single spinning Item. * * @param beforeId The Item ID before. * @param afterId The Item ID after. * @param skillRequirement The required level of Crafting to make the Item. * @param exp The experience gained for spinning the item. */ SpinningItem(int[] beforeId, int afterId, int skillRequirement, double exp) { this.beforeId = beforeId; this.afterId = afterId; this.skillRequirement = skillRequirement; this.exp = exp; } /** * Gets the ID before. * * @return The ID before. */ public int[] getBeforeId() { return beforeId; } /** * Gets the ID after. * * @return The ID after. */ public int getAfterId() { return afterId; } /** * Gets the Crafting level required. * * @return The Crafting level required. */ public int getSkillRequirement() { return skillRequirement; } /** * Gets the experience gained. * * @return The experience gained. */ public double getExp() { return exp; } } } [/code] Next, go into [B]package[/B] com.rs.game.player.dialogues. Make a new class called SpinningD(.java). In the file, add: [code] package com.rs.game.player.dialogues; import com.rs.cache.loaders.ItemDefinitions; import com.rs.cores.CoresManager; import com.rs.events.Event; import com.rs.events.EventManager; import com.rs.game.player.Player; import com.rs.game.player.actions.Action; import com.rs.game.player.content.SkillsDialogue; import com.rs.game.player.content.Spinning; /** * The dialogue of the spinning wheel. * @author Arham Siddiqui */ public class SpinningD extends Dialogue { private int itemId[]; @Override public void start() { SkillsDialogue.sendSkillsDialogue(player, SkillsDialogue.MAKE, "Choose how many you wish to make, then click on the chosen item to begin.", 28, new int[] {1759, 1777, 9438, 9438, 6038, 954}, new SkillsDialogue.ItemNameFilter() { @Override public String rename(String name) { if (name.equalsIgnoreCase(ItemDefinitions.getItemDefinitions(1759).getName())) { return "Ball of wool (Wool)"; } else if (name.equalsIgnoreCase(ItemDefinitions.getItemDefinitions(1777).getName())) { return "Bow string (Flax)"; } else if (name.equalsIgnoreCase(ItemDefinitions.getItemDefinitions(9438).getName()) && SkillsDialogue.getItemSlot(16) == 2) { return "C'bow string (Sinew)"; } else if (name.equalsIgnoreCase(ItemDefinitions.getItemDefinitions(9438).getName()) && SkillsDialogue.getItemSlot(17) == 3) { return "C'bow string (Tree roots)"; } else if (name.equalsIgnoreCase(ItemDefinitions.getItemDefinitions(6038).getName())) { return "Magic string (Magic roots)"; } else if (name.equalsIgnoreCase(ItemDefinitions.getItemDefinitions(954).getName())) { return "Rope (Yak hide)"; } return name; } }); } @Override public void run(int interfaceId, int componentId) { int option = SkillsDialogue.getItemSlot(componentId); itemId = Spinning.getBeforeFromAfter(SkillsDialogue.getItem(option)); final int[] quantity = {SkillsDialogue.getQuantity(player)}; int invQuantity = player.getInventory().getItems().getNumberOf(itemId[0]); if (quantity[0] > invQuantity) quantity[0] = invQuantity; Action action = new Action() { @Override public boolean start(Player player) { if (quantity[0] <= 0) { return false; } return true; } @Override public boolean process(Player player) { if (quantity[0] <= 0) { return false; } return true; } @Override public int processWithDelay(Player player) { quantity[0]--; Spinning.canSpin(player, itemId[0]); return 5; } @Override public void stop(Player player) { } }; player.getActionManager().setAction(action); end(); } @Override public void finish() { } } [/code] Next, go into ObjectHandler and find: [code] "SmeltingD" [/code] You should see: [code] if (object.getDefinitions().name .equalsIgnoreCase("furnace")) player.getDialogueManager().startDialogue("SmeltingD", object); [/code] Below all that, add: [code] else if (object.getDefinitions().name.toLowerCase().contains("spinning")) player.getDialogueManager().startDialogue("SpinningD"); [/code] Add the following in DialogueHandler(.java): [quote name='Datbeastmayne'][code] handledDialogues.put("SpinningD", (Class<Dialogue>) Class .forName(SpinningD.class.getCanonicalName()));[/code][/QUOTE] below: [code] public static final void init() { try { [/code] [quote name='arham 4']Forgot to release some code: Go into SkillsDialogue(.java) and add: [code] private static int[] items; public static void setItem(int... item) { items = item; } public static int getItem(int slot) { return items[slot]; } [/code] Next, find: [code] setQuantity(player, maxQuantity);[/code] Below that, add: [code] setItem(items); [/code] Finished![/QUOTE] --- Finished! Some nice things to go along with this: [url=http://www.runelocus.com/forums/showthread.php?98314-Pickables-Get-your-Onions-Cabbage-Flax-Wheat-and-Potato-all-right-here!][718] Pickables - Get your Onions, Cabbage, Flax, Wheat, and Potato all right here![/url] And for those who still need the interface fix:
  4. Crowley

    PI Crafting Issue

    So the source i started using a while back aparently has non working crafting, and after pulling all my hair out trying to figure this out, I need help fixing it. Basically the problem is, Leather crafting does not work. it goes as far as bringing up the crafting menu for each dragonhide, but no further. here is the contents of crafting.java Also i might mention that I made a simple few lines in useitem.java to make a chisel and uncut sapphire, when used on one another create uncut sapphire and a chunk of experience to test that possibility, it worked like a charm, except no matter how i set it up, crafting doesn't receive any experience at all. not even for the working methods on my current crafting for gems.. [CODE]package server.model.players.skills; import server.model.players.Client; import server.Config; import java.sql.Date; import java.text.SimpleDateFormat; import java.util.Calendar; public class Crafting { Client c; public Crafting(Client c) { this.c = c; } public int hideType = 0, makeId = 0, amount = 0, craftType = 0, exp = 0, index = 0; public void resetCrafting() { hideType = 0; makeId = 0; amount = 0; c.craftingLeather = true; craftType = 0; } public void handleChisel(int id1, int id2) { if (id1 == 1755) cutGem(id2); else cutGem(id1); } public int[][] gems = {{1623,1727,1,50},{1621,1729,27,68},{1619,1725,34,85},{1617,1731,43,108},{1631,1712,55,138},{6571,6585,67,168}}; public void cutGem(int id) { for (int j = 0; j < gems.length; j++) { if (gems[j][0] == id) { if (c.playerLevel[c.playerCrafting] >= gems[j][2]) { c.getItems().deleteItem(id, c.getItems().getItemSlot(id),1); c.getItems().addItem(gems[j][1], 1); c.getPA().addSkillXP(gems[j][3] * Config.CRAFTING_EXPERIENCE, c.playerCrafting); break; } } } } public void handleCraftingClick(int clickId) { for (int j = 0; j < buttons.length; j++) { if (buttons[j][0] == clickId) { craftType = buttons[j][1]; amount = buttons[j][2]; checkRequirements(); break; } } } public void checkRequirements() { for (int j = 0; j < expsAndLevels.length; j++) { if (expsAndLevels[j][0] == hideType) { if (c.playerLevel[c.playerCrafting] >= expsAndLevels[j][1]) { if (c.getItems().playerHasItem(hideType, 1)) { c.getPA().closeAllWindows(); exp = expsAndLevels[j][2]; index = j; craftHides(hideType); } } else { c.sendMessage("You need a crafting level of " + expsAndLevels[j][1] + " to craft this."); } } } } public void craftHides(int id) { for (int j = 0; j < amount; j++) { if (!c.getItems().playerHasItem(id,craftType)) break; c.getItems().deleteItem(id, craftType); if (getItemToAdd() <= 0) break; c.getItems().addItem(getItemToAdd(), 1); c.getPA().addSkillXP(exp * Config.CRAFTING_EXPERIENCE, c.playerCrafting); } resetCrafting(); } public int getItemToAdd() { if (craftType == 1) { return vambs[index]; } else if (craftType == 2) { return chaps[index]; } else if (craftType == 3) { return bodys[index]; } return -1; } public int[] vambs = {1065,2487,2489,2491}; public int[] chaps = {1099,2493,2495,2497}; public int[] bodys = {1135,2499,2501,2503}; public void handleLeather(int item1, int item2) { if (item1 == 1733) { openLeather(item2); } else { openLeather(item1); } } public int[][] buttons = {{34185,1,1},{34184,1,5},{34183,1,10},{34182,1,27},{34189,2,1},{34188,2,5},{34187,2,10},{34186,2,27},{34193,3,1},{34192,3,5},{34191,3,10},{34190,3,27}}; public int[][] expsAndLevels = {{1745,62,57},{2505,66,70},{2507,73,78},{2509,79,86}}; public void openLeather(int item) { if (item == 1745) { c.getPA().sendFrame164(8880); //green dhide c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 1099); // middle c.getPA().sendFrame246(8883, 250, 1065); // left picture c.getPA().sendFrame246(8885, 250, 1135); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2505) { c.getPA().sendFrame164(8880); //blue c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2493); // middle c.getPA().sendFrame246(8883, 250, 2487); // left picture c.getPA().sendFrame246(8885, 250, 2499); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2507) { c.getPA().sendFrame164(8880); c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2495); // middle c.getPA().sendFrame246(8883, 250, 2489); // left picture c.getPA().sendFrame246(8885, 250, 2501); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2509) { c.getPA().sendFrame164(8880); c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2497); // middle c.getPA().sendFrame246(8883, 250, 2491); // left picture c.getPA().sendFrame246(8885, 250, 2503); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } c.craftingLeather = true; } }[/CODE] Hopefully it's just something i've overlooked, but you never know.. I also stumbled across a basic crafting setup by a fellow named phl0w on another website, the contents of the java being: [CODE]package server.model.players.skills; import server.model.players.Client; import server.util.Misc; public class Crafting { Client c; public Crafting(Client c) { this.c = c; } public enum LeatherCrafting { LEATHERVAMBS(1741, 1063, 11, 22, 1), LEATHERCHAPS(1741, 1095, 14, 25, 1), LEATHERBODY(1741, 1129, 18, 27, 1), GREENVAMBS(1745, 1065, 57, 62, 1), GREENCHAPS(1745, 1099, 60, 124, 2), GREENBODY(1745, 1135, 63, 186, 3), BLUEVAMBS(2505, 2487, 66, 70, 1), BLUECHAPS(2505, 2493, 68, 140, 2), BLUEBODY(2505, 2499, 71, 210, 3), REDVAMBS(2507, 2489, 73, 78, 1), REDCHAPS(2507, 2495, 75, 156, 2), REDBODY(2507, 2501, 77, 234, 3), BLACKVAMBS(2509, 2491, 79, 86, 1), BLACKCHAPS(2509, 2497, 82, 172, 2), BLACKBODY(2509, 2503, 84, 258, 3); private int leatherId, outcome, reqLevel, XP, reqAmt; private LeatherCrafting(int leatherId, int outcome, int reqLevel, int XP, int reqAmt) { this.leatherId = leatherId; this.outcome = outcome; this.reqLevel = reqLevel; this.XP = XP; this.reqAmt = reqAmt; } public int getLeather() { return leatherId; } public int getOutcome() { return outcome; } public int getReqLevel() { return reqLevel; } public int getXP() { return XP; } public int getReqAmt() { return reqAmt; } } int[][] leathers = { {1741, 1095, 1063, 1129}, {1745, 1099, 1065, 1135}, {2505, 2493, 2487, 2499}, {2507, 2495, 2489, 2501}, {2509, 2497, 2491, 2503}}; public void openLeather(int hide) { for (int i = 0; i < leathers.length; i++) { if (leathers[i][0] == hide) { c.getPA().sendFrame164(8880); //leather c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, leathers[i][1]); // middle c.getPA().sendFrame246(8883, 250, leathers[i][2]); // left picture c.getPA().sendFrame246(8885, 250, leathers[i][3]); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); } } c.craftingLeather = true; c.hideId = hide; } public void handleLeather(int item1, int item2) { openLeather((item1 == 1733) ? item2 : item1); } public void handleCraftingClick(int clickId) { switch (clickId) { case 34185: //Vambs switch (c.hideId) { case 1741: craftLeather(1063); //Leather vambs break; case 1745: craftLeather(1065); //Green d'hide vambs break; case 2505: craftLeather(2487); //Blue d'hide vambs break; case 2507: craftLeather(2489); //Red d'hide vambs break; case 2509: craftLeather(2491); //Black d'hide vambs break; } break; case 34189: switch (c.hideId) { case 1741: craftLeather(1095); //Leather chaps break; case 1745: craftLeather(1099); //Green d'hide chaps break; case 2505: craftLeather(2493); //Blue d'hide chaps break; case 2507: craftLeather(2495); //Red d'hide chaps break; case 2509: craftLeather(2497); //Black d'hide chaps break; } break; case 34193: switch (c.hideId) { case 1741: craftLeather(1129); //Leather body break; case 1745: craftLeather(1135); //Green d'hide body break; case 2505: craftLeather(2499); //Blue d'hide body break; case 2507: craftLeather(2501); //Red d'hide body break; case 2509: craftLeather(2503); //Black d'hide body break; } break; } } private LeatherCrafting forLeather(int id) { for (LeatherCrafting lc : LeatherCrafting.values()) { if (lc.getOutcome() == id) { return lc; } } return null; } public void craftLeather(int id) { LeatherCrafting lea = forLeather(id); if (lea != null) { if (c.playerLevel[c.playerCrafting] >= lea.getReqLevel()) { if (c.getItems().playerHasItem(lea.getLeather(), lea.getReqAmt())) { c.startAnimation(1249); c.getItems().deleteItem(lea.getLeather(), lea.getReqAmt()); c.getItems().addItem(lea.getOutcome(), 1); c.getPA().addSkillXP(lea.getXP(), c.playerCrafting); resetCrafting(); } else { c.sendMessage("You do not have enough items to craft this item."); } } else { c.sendMessage("You need a crafting level of "+lea.getReqLevel()+" to craft this item."); } c.getPA().removeAllWindows(); } } public void resetCrafting() { c.craftingLeather = false; c.hideId = -1; } public enum GemCrafting { OPAL(1625, 1609, 891, 1, 15, true), JADE(1627, 1611, 891, 13, 20, true), REDTOPAZ(1629, 1613, 892, 16, 25, true), SAPPHIRE(1623, 1607, 888, 1, 50, false), EMERALD(1621, 1605, 889, 27, 68, false), RUBY(1619, 1603, 887, 34, 85, false), DIAMOND(1631, 1601, 890, 43, 108, false), DRAGONSTONE(6571, 1615, 890, 55, 138, false), ONYX(6571, 6573, 2717, 67, 168, false); private int uncutID, cutID, animation, levelReq, XP; private boolean isSemiPrecious; private GemCrafting(int uncutID, int cutID, int animation, int levelReq, int XP, boolean semiPrecious) { this.uncutID = uncutID; this.cutID = cutID; this.animation = animation; this.levelReq = levelReq; this.XP = XP; this.isSemiPrecious = semiPrecious; } public int getUncut() { return uncutID; } public int getCut() { return cutID; } public int getAnim() { return animation; } public int getReq() { return levelReq; } public int getXP() { return XP; } public boolean isSemiPrecious() { return isSemiPrecious; } } public void handleChisel(int id1, int id2) { cutGem((id1 == 1755) ? id2 : id1); } private GemCrafting forGem(int id) { for (GemCrafting g : GemCrafting.values()) { if (g.getUncut() == id) { return g; } } return null; } public void cutGem(int id) { GemCrafting gem = forGem(id); if (gem != null) { if (c.getItems().playerHasItem(gem.getUncut(), 1)) { if (c.playerLevel[c.playerCrafting] >= gem.getReq()) { c.getItems().deleteItem(gem.getUncut(), 1); if (gem.isSemiPrecious()) { if (Misc.random(100) == 37) { c.sendMessage("You accidently crush the gem!"); c.getItems().addItem(1633, 1); } } else { c.getItems().addItem(gem.getCut(), 1); c.getPA().addSkillXP(gem.getXP(), c.playerCrafting); } c.startAnimation(gem.getAnim()); } else { c.sendMessage("You need a crafting level of "+gem.getReq()+" to cut this gem."); } } } } }[/CODE] but I can't try that one, because it needs me to declaire the public int "public int hideId;" in with my player.java it makes no difference and errors on the hideId in Crafting.java... If anyone can help me either fix my current crafting so I can make hides and gain experience, or help me figure out why declaring the public int hideid doesn't do me no good i would be hugely appreciative
  5. [SIZE=4]So I saw someone else released it for 718 so I thought, well might as well release for 562, lol (You may have to change around the methods a bit)[/SIZE] [SIZE=3]What you're adding:[/SIZE] [IMG]http://i.imgur.com/Yblv72G.png[/IMG] [IMG]http://i.imgur.com/xac7U3U.png[/IMG] Create a new class called Spinning and copy + paste this in it [CODE]package org.devilsscape.game.player.skills.crafting; import org.devilsscape.cache.loaders.ItemDefinitions; import org.devilsscape.game.Animation; import org.devilsscape.game.player.Player; import org.devilsscape.game.player.Skills; import org.devilsscape.game.player.skills.Skill; /** * spinning shit, lol * * @author K-Shan/Brainiac * */ public class Spinning extends Skill { /** * emote */ public static final int SPINNING_EMOTE = 5; /** * spin stuff */ public enum Spinnables { WOOL(1737, 1759, 1, 2.5), FLAX(1779, 1777, 10, 15), SINEW(9436, 9438, 10, 15), TREE_ROOTS(6043, 9438, 10, 15), MAGIC_ROOTS(6051, 6038, 19, 30), YAK_HAIR(10814, 954, 30, 25); private int itemId; private int productId; private int levelRequired; private double exp; private Spinnables(int itemId, int productId, int levelRequired, double exp) { this.itemId = itemId; this.productId = productId; this.levelRequired = levelRequired; this.exp = exp; } public int getItemId() { return itemId; } public int getProductId() { return productId; } public int getLevel() { return levelRequired; } public double getExp() { return exp; } } /** * amount of the item being spinned */ private int amount; /** * the current spinning item. */ private Spinnables spin; /** * instance * @param spin * @param amount */ public Spinning(Spinnables spin, int amount) { this.spin = spin; this.amount = amount; } /** * if the player has the required level or not. * @param player * @return */ private boolean hasCraftingLevel(Player player) { if(player.getSkills().getLevel(Skills.CRAFTING) < spin.getLevel()) { player.getActionSender().sendMessage("You need a Crafting level of "+spin.getLevel()+" in order to spin this."); return false; } return true; } @Override public boolean start(Player player) { String itemName = ItemDefinitions.getItemDefinitions(spin.getItemId()).getName(); if(!player.getInventory().contains(spin.getItemId(), 1)) { player.getActionSender().sendMessage("You do not have any "+itemName+" in your inventory."); return false; } if(!hasCraftingLevel(player)) return false; player.getActionSender().sendMessage("You place the "+itemName+" inside of the wheel.."); return true; } @Override public boolean process(Player player) { if(!player.getInventory().contains(spin.getItemId(), 1)) { String itemName = ItemDefinitions.getItemDefinitions(spin.getItemId()).getName(); player.getActionSender().sendMessage("You have ran out of "+itemName+"."); return false; } if(!hasCraftingLevel(player)) return false; if(amount <= 0) return false; return true; } @Override public int processWithDelay(Player player) { String itemName = ItemDefinitions.getItemDefinitions(spin.getItemId()).getName(); String productName = ItemDefinitions.getItemDefinitions(spin.getProductId()).getName(); amount--; player.setNextAnimation(new Animation(SPINNING_EMOTE)); player.getInventory().deleteItem(spin.getItemId(), 1); player.getInventory().addItem(spin.getProductId(), 1); player.getSkills().addXp(Skills.CRAFTING, spin.getExp()); player.getActionSender().sendMessage("You successfully spin the "+itemName+" into a "+productName+"."); if(amount > 0) return 3; return 0; } @Override public void stop(Player player) { setSkillDelay(player, 3); } }[/CODE] In your object handler class or ObjectPacketHandler1 class and place this under handleOption2 (if you're using RuneEscape you shouldn't have a problem) [CODE]case "spinning wheel": if(objectDef.containsOption(1, "Spin")) { player.getActionSender().sendInterface(459); player.getActionSender().sendItemOnInterface(459, 20, 1, 1759); // ball of wool player.getActionSender().sendItemOnInterface(459, 14, 1, 1777); // bow string player.getActionSender().sendItemOnInterface(459, 24, 1, 6038); // Magic string player.getActionSender().sendItemOnInterface(459, 32, 1, 9438); // c bow string player.getActionSender().sendItemOnInterface(459, 28, 1, 9438); // c bow string player.getActionSender().sendItemOnInterface(459, 36, 1, 954); // rope } break;[/CODE] Next, go to your button handler class and under switch (buttonId) { add this new case: [CODE]case 459: player.getActionSender().sendCloseInterface(); switch(buttonId) { case 19: // ball of wool if(packetId == 216) { // make 1 player.getSkillExecutor().setSkill(new Spinning(Spinnables.WOOL, 1)); } else if(packetId == 19) { // make 5 player.getSkillExecutor().setSkill(new Spinning(Spinnables.WOOL, 5)); } else if(packetId == 193) { // make all player.getSkillExecutor().setSkill(new Spinning(Spinnables.WOOL, player.getInventory().numberOf(Spinnables.WOOL.getItemId()))); } break; case 17: // bow string if(packetId == 216) { // make 1 player.getSkillExecutor().setSkill(new Spinning(Spinnables.FLAX, 1)); } else if(packetId == 19) { // make 5 player.getSkillExecutor().setSkill(new Spinning(Spinnables.FLAX, 5)); } else if(packetId == 193) { // make all player.getSkillExecutor().setSkill(new Spinning(Spinnables.FLAX, player.getInventory().numberOf(Spinnables.FLAX.getItemId()))); } break; case 23: // magic string if(packetId == 193) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.MAGIC_ROOTS, player.getInventory().numberOf(Spinnables.MAGIC_ROOTS.getItemId()))); } else if(packetId == 216) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.MAGIC_ROOTS, 1)); } else if(packetId == 19) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.MAGIC_ROOTS, 5)); } break; case 31: // tree roots if(packetId == 193) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.TREE_ROOTS, player.getInventory().numberOf(Spinnables.TREE_ROOTS.getItemId()))); } else if(packetId == 216) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.TREE_ROOTS, 1)); } else if(packetId == 19) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.TREE_ROOTS, 5)); } break; case 27: // sinew if(packetId == 193) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.SINEW, player.getInventory().numberOf(Spinnables.SINEW.getItemId()))); } else if(packetId == 216) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.SINEW, 1)); } else if(packetId == 19) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.SINEW, 5)); } break; case 35: // rope if(packetId == 193) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.YAK_HAIR, player.getInventory().numberOf(Spinnables.YAK_HAIR.getItemId()))); } else if(packetId == 216) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.YAK_HAIR, 1)); } else if(packetId == 19) { player.getSkillExecutor().setSkill(new Spinning(Spinnables.YAK_HAIR, 5)); } break; } break;[/CODE] And don't forget to import: [CODE]import org.devilsscape.game.player.skills.crafting.Spinning; import org.devilsscape.game.player.skills.crafting.Spinning.Spinnables;[/CODE] Happy coding :)
  6. I Ban U

    Crafting Help.

    I came across an error in crafting and when you use the needle on Red, green, etc.. leather it shows up the interface where you can choose Vambs, Chaps, or Body and when you click on one nothing happens. Any ideas? Heres my crafting.java [code]package server.model.players.skills; import server.model.players.Client; import server.Config; public class Crafting { Client c; public Crafting(Client c) { this.c = c; } public int hideType = 0, makeId = 0, amount = 0, craftType = 0, exp = 0, index = 0; public void resetCrafting() { hideType = 0; makeId = 0; amount = 0; c.craftingLeather = false; craftType = 0; } public void handleChisel(int id1, int id2) { if (id1 == 1755) cutGem(id2); else cutGem(id1); } public int[][] gems = {{1623,1727,1,50},{1621,1729,27,68},{1619,1725,34,85},{1617,1731,43,108},{1631,1712,55,138},{6571,6585,67,168}}; public void cutGem(int id) { for (int j = 0; j < gems.length; j++) { if (gems[j][0] == id) { if (c.playerLevel[c.playerCrafting] >= gems[j][2]) { c.getItems().deleteItem(id, c.getItems().getItemSlot(id),1); c.getItems().addItem(gems[j][1], 1); c.getPA().addSkillXP(gems[j][3] * Config.CRAFTING_EXPERIENCE, c.playerCrafting); break; } } } } public void handleCraftingClick(int clickId) { for (int j = 0; j < buttons.length; j++) { if (buttons[j][0] == clickId) { craftType = buttons[j][1]; amount = buttons[j][2]; checkRequirements(); break; } } } public void checkRequirements() { for (int j = 0; j < expsAndLevels.length; j++) { if (expsAndLevels[j][0] == hideType) { if (c.playerLevel[c.playerCrafting] >= expsAndLevels[j][1]) { if (c.getItems().playerHasItem(hideType, 1)) { c.getPA().closeAllWindows(); exp = expsAndLevels[j][2]; index = j; craftHides(hideType); } } else { c.sendMessage("You need a crafting level of " + expsAndLevels[j][1] + " to craft this."); } } } } public void craftHides(int id) { for (int j = 0; j < amount; j++) { if (!c.getItems().playerHasItem(id,craftType)) break; c.getItems().deleteItem(id, craftType); if (getItemToAdd() <= 0) break; c.getItems().addItem(getItemToAdd(), 1); c.getPA().addSkillXP(exp * Config.CRAFTING_EXPERIENCE, c.playerCrafting); } resetCrafting(); } public int getItemToAdd() { if (craftType == 1) { return vambs[index]; } else if (craftType == 2) { return chaps[index]; } else if (craftType == 3) { return bodys[index]; } return -1; } public int[] vambs = {1065,2487,2489,2491}; public int[] chaps = {1099,2493,2495,2497}; public int[] bodys = {1135,2499,2501,2503}; public void handleLeather(int item1, int item2) { if (item1 == 1733) { openLeather(item2); } else { openLeather(item1); } } public int[][] buttons = {{34185,1,1},{34184,1,5},{34183,1,10},{34182,1,27},{34189,2,1},{34188,2,5},{34187,2,10},{34186,2,27},{34193,3,1},{34192,3,5},{34191,3,10},{34190,3,27}}; public int[][] expsAndLevels = {{1745,62,57},{2505,66,70},{2507,73,78},{2509,79,86}}; public void openLeather(int item) { if (item == 1745) { c.getPA().sendFrame164(8880); //green dhide c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 1099); // middle c.getPA().sendFrame246(8883, 250, 1065); // left picture c.getPA().sendFrame246(8885, 250, 1135); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2505) { c.getPA().sendFrame164(8880); //blue c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2493); // middle c.getPA().sendFrame246(8883, 250, 2487); // left picture c.getPA().sendFrame246(8885, 250, 2499); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2507) { c.getPA().sendFrame164(8880); c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2495); // middle c.getPA().sendFrame246(8883, 250, 2489); // left picture c.getPA().sendFrame246(8885, 250, 2501); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2509) { c.getPA().sendFrame164(8880); c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2497); // middle c.getPA().sendFrame246(8883, 250, 2491); // left picture c.getPA().sendFrame246(8885, 250, 2503); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } c.craftingLeather = true; } }[/code]e]
  7. Well hey. I have an issue with crafting. Gems cut perfectly. When it comes to d'hides, I'll click it to craft something, and it does nothing. I have all the required items, levels, but not sure about the code. Just to clarify; the interface to craft D'hide top, bottom or vambs will come up, I click one, nothing happens. This is my Crafting.Java; [CODE]package server.model.players.skills; import server.model.players.Client; import server.Config; public class Crafting { Client c; public Crafting(Client c) { this.c = c; } public int hideType = 0, makeId = 0, amount = 0, craftType = 0, exp = 0, index = 0; public void resetCrafting() { hideType = 0; makeId = 0; amount = 0; c.craftingLeather = false; craftType = 0; } public void handleChisel(int id1, int id2) { if (id1 == 1755) cutGem(id2); else cutGem(id1); } public int[][] gems = {{1623,1727,1,50},{1621,1729,27,68},{1619,1725,34,85},{1617,1731,43,108},{1631,1712,55,138},{6571,6585,67,168}}; public void cutGem(int id) { for (int j = 0; j < gems.length; j++) { if (gems[j][0] == id) { if (c.playerLevel[c.playerCrafting] >= gems[j][2]) { c.getItems().deleteItem(id, c.getItems().getItemSlot(id),1); c.getItems().addItem(gems[j][1], 1); c.getPA().addSkillXP(gems[j][3] * Config.CRAFTING_EXPERIENCE, c.playerCrafting); break; } } } } public void handleCraftingClick(int clickId) { for (int j = 0; j < buttons.length; j++) { if (buttons[j][0] == clickId) { craftType = buttons[j][1]; amount = buttons[j][2]; checkRequirements(); break; } } } public void checkRequirements() { for (int j = 0; j < expsAndLevels.length; j++) { if (expsAndLevels[j][0] == hideType) { if (c.playerLevel[c.playerCrafting] >= expsAndLevels[j][1]) { if (c.getItems().playerHasItem(hideType, 1)) { c.getPA().closeAllWindows(); exp = expsAndLevels[j][2]; index = j; craftHides(hideType); } } else { c.sendMessage("You need a crafting level of " + expsAndLevels[j][1] + " to craft this."); } } } } public void craftHides(int id) { for (int j = 0; j < amount; j++) { if (!c.getItems().playerHasItem(id,craftType)) break; c.getItems().deleteItem(id, craftType); if (getItemToAdd() <= 0) break; c.getItems().addItem(getItemToAdd(), 1); c.getPA().addSkillXP(exp * Config.CRAFTING_EXPERIENCE, c.playerCrafting); } resetCrafting(); } public int getItemToAdd() { if (craftType == 1) { return vambs[index]; } else if (craftType == 2) { return chaps[index]; } else if (craftType == 3) { return bodys[index]; } return -1; } public int[] vambs = {1065,2487,2489,2491}; public int[] chaps = {1099,2493,2495,2497}; public int[] bodys = {1135,2499,2501,2503}; public void handleLeather(int item1, int item2) { if (item1 == 1733) { openLeather(item2); } else { openLeather(item1); } } public int[][] buttons = {{34185,1,1},{34184,1,5},{34183,1,10},{34182,1,27},{34189,2,1},{34188,2,5},{34187,2,10},{34186,2,27},{34193,3,1},{34192,3,5},{34191,3,10},{34190,3,27}}; public int[][] expsAndLevels = {{1745,62,57},{2505,66,70},{2507,73,78},{2509,79,86}}; public void openLeather(int item) { if (item == 1745) { c.getPA().sendFrame164(8880); //green dhide c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 1099); // middle c.getPA().sendFrame246(8883, 250, 1065); // left picture c.getPA().sendFrame246(8885, 250, 1135); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2505) { c.getPA().sendFrame164(8880); //blue c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2493); // middle c.getPA().sendFrame246(8883, 250, 2487); // left picture c.getPA().sendFrame246(8885, 250, 2499); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2507) { c.getPA().sendFrame164(8880); c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2495); // middle c.getPA().sendFrame246(8883, 250, 2489); // left picture c.getPA().sendFrame246(8885, 250, 2501); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2509) { c.getPA().sendFrame164(8880); c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2497); // middle c.getPA().sendFrame246(8883, 250, 2491); // left picture c.getPA().sendFrame246(8885, 250, 2503); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } c.craftingLeather = true; } }[/CODE]
  8. Currently has gem cutting, and leather crafting. Implement this in your skills folder, my packaging may be different towards yours. [code] package org.runevx.model.content.skills; import org.runevx.model.players.Player; import org.runevx.model.players.item.Item; import org.runevx.model.players.skill.Skill; import org.runevx.model.world.World; import org.runevx.task.Task; import org.runevx.util.Misc; /** * [MENTION=52317]auth[/MENTION]or Resolute */ public class Crafting { private enum Gems { SAPPHIRE(1623, 1607, 20, 50), EMERALD(1621, 1605, 27, 67.5), RUBY(1619, 1603, 34, 85), DIAMOND(1617, 1601, 43, 107.5), DRAGONSTONE(1631, 1615, 55, 137.5), ONYX(6571, 6573, 67, 167.5); Gems(int uncutGems, int cutGem, int levelRequired, double experience) { this.uncutGem = (short) uncutGems; this.cutGem = (short) cutGem; this.levelRequired = (byte) levelRequired; this.experience = experience; } private short uncutGem, cutGem; private double experience; private byte levelRequired; public short getUncutGem() { return uncutGem; } public short getCutGem() { return cutGem; } public byte getLevelRequired() { return levelRequired; } public double getExperience() { return experience; } } private static Gems getGem(int id) { for (Gems g : Gems.values()) { if (id == g.getUncutGem()) { return g; } } return null; } public static void cutGem(Player p, int useWith, int usedWith) { for (Gems g : Gems.values()) { if (useWith == g.getUncutGem() && usedWith == 1755 || usedWith == g.getUncutGem() && useWith == 1755) { createGem(p, g.getUncutGem()); } } } private static void createGem(final Player p, int itemId) { final Gems gem = getGem(itemId); final Item item = new Item(gem.getUncutGem(), 1); if (p.getSkill().getLevel()[Skill.CRAFTING] < gem.getLevelRequired()) { p.getActionSender().sendMessage("You must have "+ gem.getLevelRequired() +" crafting to cut this gem.."); return; } p.getUpdateFlags().sendAnimation(885, 0); p.getActionSender().sendMessage("You cut the " + item.getDefinition().getName().toLowerCase() + "."); World.getScheduler().schedule(new Task(p, 2) { [MENTION=15855]Over[/MENTION]ride public void execute() { p.getInventory().removeItem(item); p.getInventory().addItem(new Item(gem.getCutGem())); p.getSkill().addExp(Skill.CRAFTING, gem.getExperience()); this.stop(); } }); } private enum Leather { LEATHERVAMBS(1741, 1063, 1, 11, 22), LEATHERCHAPS(1741, 1095, 2, 18, 27), LEATHERBODY(1741, 1129, 3, 14, 25), GREENVAMBS(1745, 1065, 1, 57, 62), GREENCHAPS(1745, 1099, 2, 60, 124), GREENBODY(1745, 1135, 3, 63, 186), BLUEVAMBS(2505, 2487, 1, 66, 70), BLUECHAPS(2505, 2493, 2, 68, 140), BLUEBODY(2505, 2499, 3, 71, 210), REDVAMBS(2507, 2489, 1, 73, 78), REDCHAPS(2507, 2495, 2, 75, 156), REDBODY(2507, 2501, 3, 77, 234), BLACKVAMBS(2509, 2491, 1, 79, 86), BLACKCHAPS(2509, 2497, 2, 82, 172), BLACKBODY(2509, 2503, 3, 84, 258); Leather(int leatherId, int outcome, int amount, int levelRequired, double experience) { this.leatherId = (short) leatherId; this.outcome = (short) outcome; this.amount = (byte) amount; this.levelRequired = (byte) levelRequired; this.experience = experience; } private short leatherId, outcome; private byte amount, levelRequired; private double experience; public short getLeatherId() { return leatherId; } public short getOutcome() { return outcome; } public byte getAmount() { return amount; } public byte getLevelRequired() { return levelRequired; } public double getExperience() { return experience; } } private static Leather getLeather(int id) { for (Leather leather : Leather.values()) { if (id == leather.getOutcome()) { return leather; } } return null; } //credits to Jimmy for this array private static final int[][] leathers = { {1741, 1095, 1063, 1129}, {1745, 1099, 1065, 1135}, {2505, 2493, 2487, 2499}, {2507, 2495, 2489, 2501}, {2509, 2497, 2491, 2503}}; public static void showInterface(Player p, int usedWith, int useWith) { for (int[] i : leathers) { if (useWith == i[0] && usedWith == 1733 || useWith == 1733 && usedWith == i[0]) { p.getActionSender().sendItemOnInterface(8884, 250, i[1]); p.getActionSender().sendItemOnInterface(8883, 250, i[2]); p.getActionSender().sendItemOnInterface(8885, 250, i[3]); p.getActionSender().sendString("Vambs", 8889); p.getActionSender().sendString("Chaps", 8893); p.getActionSender().sendString("Body", 8897); p.setHide(i[0]); } } } private static void createLeather(final Player p, final int id, final int amount) { final Leather leather = getLeather(id); boolean remove = Misc.random(10) > 8; if (leather == null || (Boolean) p.getAttributes().get("isCrafting")) return; if (p.getSkill().getLevel()[Skill.CRAFTING] < leather.getLevelRequired()) { p.getActionSender().sendMessage("You must have "+ leather.getLevelRequired() +" crafting to do this.."); return; } if (remove) p.getInventory().removeItem(new Item(1734, 1)); p.getAttributes().put("isCrafting", Boolean.TRUE); World.getScheduler().schedule(new Task(p, 2) { int count = amount; [MENTION=15855]Over[/MENTION]ride public void execute() { if (count <= 0 || p.getInventory().getItemContainer().getCount(leather.getLeatherId()) < leather.getAmount() || !p.getInventory().getItemContainer().contains(1734) || !p.getInventory().getItemContainer().contains(1733)) { resetCrafting(p); this.stop(); return; } p.getUpdateFlags().sendAnimation(1249, 0); p.getInventory().removeItem(new Item(leather.getLeatherId(), leather.getAmount())); p.getInventory().addItem(new Item(leather.getOutcome())); p.getSkill().addExp(Skill.CRAFTING, leather.getExperience()); count--; } }); } public static void actionButtons(Player p, int buttonId) { switch(buttonId) { case 34193: switch(p.getHide()) { case 1741: createLeather(p, 1129, 1); break; case 1745: createLeather(p, 1135, 1); break; case 2505: createLeather(p, 2499, 1); break; case 2507: createLeather(p, 2501, 1); break; case 2509: createLeather(p, 2503, 1); break; } break; case 34192: switch(p.getHide()) { case 1741: createLeather(p, 1129, 5); break; case 1745: createLeather(p, 1135, 5); break; case 2505: createLeather(p, 2499, 5); break; case 2507: createLeather(p, 2501, 5); break; case 2509: createLeather(p, 2503, 5); break; } break; case 34191: switch(p.getHide()) { case 1741: createLeather(p, 1129, 10); break; case 1745: createLeather(p, 1135, 10); break; case 2505: createLeather(p, 2499, 10); break; case 2507: createLeather(p, 2501, 10); break; case 2509: createLeather(p, 2503, 10); break; } break; case 34189: switch(p.getHide()) { case 1741: createLeather(p, 1095, 1); break; case 1745: createLeather(p, 1099, 1); break; case 2505: createLeather(p, 2493, 1); break; case 2507: createLeather(p, 2495, 1); break; case 2509: createLeather(p, 2497, 1); break; } break; case 34188: switch(p.getHide()) { case 1741: createLeather(p, 1095, 5); break; case 1745: createLeather(p, 1099, 5); break; case 2505: createLeather(p, 2493, 5); break; case 2507: createLeather(p, 2495, 5); break; case 2509: createLeather(p, 2497, 5); break; } break; case 34187: switch(p.getHide()) { case 1741: createLeather(p, 1095, 10); break; case 1745: createLeather(p, 1099, 10); break; case 2505: createLeather(p, 2493, 10); break; case 2507: createLeather(p, 2501, 10); break; case 2509: createLeather(p, 2497, 10); break; } break; case 34185: switch(p.getHide()) { case 1741: createLeather(p, 1063, 1); break; case 1745: createLeather(p, 1065, 1); break; case 2505: createLeather(p, 2487, 1); break; case 2507: createLeather(p, 2489, 1); break; case 2509: createLeather(p, 2491, 1); break; } break; case 34184: switch(p.getHide()) { case 1741: createLeather(p, 1063, 5); break; case 1745: createLeather(p, 1065, 5); break; case 2505: createLeather(p, 2487, 5); break; case 2507: createLeather(p, 2489, 5); break; case 2509: createLeather(p, 2491, 5); break; } break; case 34183: switch(p.getHide()) { case 1741: createLeather(p, 1063, 10); break; case 1745: createLeather(p, 1065, 10); break; case 2505: createLeather(p, 2487, 10); break; case 2507: createLeather(p, 2489, 10); break; case 2509: createLeather(p, 2491, 10); break; } break; } p.getActionSender().removeInterfaces(); } public static void resetCrafting(Player p) { p.setHide(0); p.getAttributes().put("isCrafting", Boolean.FALSE); } } [/code] In ButtonPacketHandler.java, in the method handleButton, under switch (buttonId) { [code] case 34193: case 34192: case 34191: case 34189: case 34188: case 34187: case 34185: case 34184: case 34183: Crafting.actionButtons(player, buttonId); break; [/code] Still in the same file, implement this import [code] import [COLOR="#FF0000"]com.rs2.model.content.skills[/COLOR].Crafting; [/code] Now in ItemPacketHandler.java, search for the method useItemOnItem, under secondClickItem [code] Crafting.cutGem(player, firstClickItem.getId(), secondClickItem.getId()); Crafting.showInterface(player, firstClickItem.getId(), secondClickItem.getId()); [/code] Still in the same file, implement this import [code] import [COLOR="#FF0000"]com.rs2.model.content.skills[/COLOR].Crafting; [/code] Search for initAttributes() in Player.java, under it implement this: [code] getAttributes().put("isCrafting", Boolean.FALSE); [/code] Declare this variable aswell, in the same file [code] private int hide; [/code] And theses setters and getters.. [code] public int getHide() { return hide; } public void setHide(int hide) { this.hide = hide; } [/code] Now in your WalkPacketHandler.java, simply implement this within the handlePacket method [code] if ((Boolean) p.getAttributes().get("isCrafting")) player.getAttributes().put("isCrafting", Boolean.FALSE); [/code] Highly recommend you to modify the current exp rates. The messages are wrong, and the x option isn't added for leathers. :P
  9. [code]package server.model.players.skills; import server.model.players.Client; import server.util.Misc; public class Crafting { Client c; public Crafting(Client c) { this.c = c; } public enum LeatherCrafting { LEATHERVAMBS(1741, 1063, 11, 22, 1), LEATHERCHAPS(1741, 1095, 14, 25, 1), LEATHERBODY(1741, 1129, 18, 27, 1), GREENVAMBS(1745, 1065, 57, 62, 1), GREENCHAPS(1745, 1099, 60, 124, 2), GREENBODY(1745, 1135, 63, 186, 3), BLUEVAMBS(2505, 2487, 66, 70, 1), BLUECHAPS(2505, 2493, 68, 140, 2), BLUEBODY(2505, 2499, 71, 210, 3), REDVAMBS(2507, 2489, 73, 78, 1), REDCHAPS(2507, 2495, 75, 156, 2), REDBODY(2507, 2501, 77, 234, 3), BLACKVAMBS(2509, 2491, 79, 86, 1), BLACKCHAPS(2509, 2497, 82, 172, 2), BLACKBODY(2509, 2503, 84, 258, 3); private int leatherId, outcome, reqLevel, XP, reqAmt; private LeatherCrafting(int leatherId, int outcome, int reqLevel, int XP, int reqAmt) { this.leatherId = leatherId; this.outcome = outcome; this.reqLevel = reqLevel; this.XP = XP; this.reqAmt = reqAmt; } public int getLeather() { return leatherId; } public int getOutcome() { return outcome; } public int getReqLevel() { return reqLevel; } public int getXP() { return XP; } public int getReqAmt() { return reqAmt; } } int[][] leathers = { {1741, 1095, 1063, 1129}, {1745, 1099, 1065, 1135}, {2505, 2493, 2487, 2499}, {2507, 2495, 2489, 2501}, {2509, 2497, 2491, 2503}}; public void openLeather(int hide) { for (int i = 0; i < leathers.length; i++) { if (leathers[i][0] == hide) { c.getPA().sendFrame164(8880); //leather c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, leathers[i][1]); // middle c.getPA().sendFrame246(8883, 250, leathers[i][2]); // left picture c.getPA().sendFrame246(8885, 250, leathers[i][3]); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); } } c.craftingLeather = true; c.hideId = hide; } public void handleLeather(int item1, int item2) { openLeather((item1 == 1733) ? item2 : item1); } public void handleCraftingClick(int clickId) { switch (clickId) { case 34185: //Vambs switch (c.hideId) { case 1741: craftLeather(1063); //Leather vambs break; case 1745: craftLeather(1065); //Green d'hide vambs break; case 2505: craftLeather(2487); //Blue d'hide vambs break; case 2507: craftLeather(2489); //Red d'hide vambs break; case 2509: craftLeather(2491); //Black d'hide vambs break; } break; case 34189: switch (c.hideId) { case 1741: craftLeather(1095); //Leather chaps break; case 1745: craftLeather(1099); //Green d'hide chaps break; case 2505: craftLeather(2493); //Blue d'hide chaps break; case 2507: craftLeather(2495); //Red d'hide chaps break; case 2509: craftLeather(2497); //Black d'hide chaps break; } break; case 34193: switch (c.hideId) { case 1741: craftLeather(1129); //Leather body break; case 1745: craftLeather(1135); //Green d'hide body break; case 2505: craftLeather(2499); //Blue d'hide body break; case 2507: craftLeather(2501); //Red d'hide body break; case 2509: craftLeather(2503); //Black d'hide body break; } break; } } private LeatherCrafting forLeather(int id) { for (LeatherCrafting lc : LeatherCrafting.values()) { if (lc.getOutcome() == id) { return lc; } } return null; } public void craftLeather(int id) { LeatherCrafting lea = forLeather(id); if (lea != null) { if (c.playerLevel[c.playerCrafting] >= lea.getReqLevel()) { if (c.getItems().playerHasItem(lea.getLeather(), lea.getReqAmt())) { c.startAnimation(1249); c.getItems().deleteItem(lea.getLeather(), lea.getReqAmt()); c.getItems().addItem(lea.getOutcome(), 1); c.getPA().addSkillXP(lea.getXP(), c.playerCrafting); resetCrafting(); } else { c.sendMessage("You do not have enough items to craft this item."); } } else { c.sendMessage("You need a crafting level of "+lea.getReqLevel()+" to craft this item."); } c.getPA().removeAllWindows(); } } public void resetCrafting() { c.craftingLeather = false; c.hideId = -1; } public enum GemCrafting { OPAL(1625, 1609, 891, 1, 15, true), JADE(1627, 1611, 891, 13, 20, true), REDTOPAZ(1629, 1613, 892, 16, 25, true), SAPPHIRE(1623, 1607, 888, 1, 50, false), EMERALD(1621, 1605, 889, 27, 68, false), RUBY(1619, 1603, 887, 34, 85, false), DIAMOND(1617, 1601, 890, 43, 108, false), DRAGONSTONE(1631, 1615, 890, 55, 138, false), ONYX(6571, 6573, 2717, 67, 168, false); private int uncutID, cutID, animation, levelReq, XP; private boolean isSemiPrecious; private GemCrafting(int uncutID, int cutID, int animation, int levelReq, int XP, boolean semiPrecious) { this.uncutID = uncutID; this.cutID = cutID; this.animation = animation; this.levelReq = levelReq; this.XP = XP; this.isSemiPrecious = semiPrecious; } public int getUncut() { return uncutID; } public int getCut() { return cutID; } public int getAnim() { return animation; } public int getReq() { return levelReq; } public int getXP() { return XP; } public boolean isSemiPrecious() { return isSemiPrecious; } } public void handleChisel(int id1, int id2) { cutGem((id1 == 1755) ? id2 : id1); } private GemCrafting forGem(int id) { for (GemCrafting g : GemCrafting.values()) { if (g.getUncut() == id) { return g; } } return null; } public void cutGem(int id) { GemCrafting gem = forGem(id); if (gem != null) { if (c.getItems().playerHasItem(gem.getUncut(), 1)) { if (c.playerLevel[c.playerCrafting] >= gem.getReq()) { c.getItems().deleteItem(gem.getUncut(), 1); if (gem.isSemiPrecious()) { if (Misc.random(100) == 37) { c.sendMessage("You accidently crush the gem!"); c.getItems().addItem(1633, 1); } } else { c.getItems().addItem(gem.getCut(), 1); c.getPA().addSkillXP(gem.getXP(), c.playerCrafting); } c.startAnimation(gem.getAnim()); } else { c.sendMessage("You need a crafting level of "+gem.getReq()+" to cut this gem."); } } } } }[/code] UseItem.java: ItemOnItem: [code] if (itemUsed == 1733 || useWith == 1733) { c.getCrafting().handleLeather(itemUsed, useWith); } if (itemUsed == 1755 || useWith == 1755) { c.getCrafting().handleChisel(itemUsed,useWith); }[/code]
  10. I tried releasing stuff for Rune Escape before, but no one used it. I decided I'd start releasing content for a base people do use. [code] import com.rs2hd.model.Player; import com.rs2hd.model.Skills; /** * * @author Ethan R. Horner <[email protected]> * @version 1.0 * @since 2011 * */ public class RuneCrafting { private RcDefinitions definitions; private transient Player player; public enum RcDefinitions { AIR(1, 5, 556), MIND(2, 5.5, 558), WATER(5, 6, 555), EARTH(9, 6.5, 557), FIRE(14, 7, 554), BODY(20, 7.5, 559), COSMIC(27, 8, 564), CHAOS(35, 8.5, 562), NATURE(44, 9, 562), LAW(54, 9.5, 563), DEATH(65, 10, 560), BLOOD(70, 10.5, 565), SOUL(1, 1, 566); /** * constructor * * @param level * @param exp * @param runeId */ private RcDefinitions(int level, double exp, int runeId) { this.level = level; this.exp = exp; this.runeId = runeId; } private int level; private double exp; private int runeId; private int getLevel() { return level; } private double getXp() { return exp; } private int getRuneId() { return runeId; } } /** * starts rune crafting * * @param player * used to get information from the player class * @param definitions * used to grab data out of the enum */ public void startRuneCrafting(Player player, RcDefinitions definitions) { this.player = player; this.definitions = definitions; if(!checkAll(player)) { return; } this.process(player); } /** * checks multiple variables before letting player craft runes * * @param player * used to get information from player class * @return */ private boolean checkAll(Player player) { if(!hasRcLevel(player)) { return false; } if(!hasEssence(player)) { return false; } return true; } /** * checks to see if player has correct rune crafting level * * @param player * used to get information from player class * @return */ private boolean hasRcLevel(Player player) { if(definitions.getLevel() > player.getSkills().getLevel(Skills.RUNECRAFTING)) { player.sm("You do not have the level required to craft this rune."); return false; } return true; } /** * checks to see if player has essence * * @param player * used to get information from the player class * @return */ private boolean hasEssence(Player player) { if(!player.getInventory().contains(1436, 1)) { player.sm("You need rune essence to craft this rune."); return false; } return true; } /** * handles process * * @param player * used to get information from the player class */ private void process(Player player) { addRewards(player); player.animate(791); player.graphics(186); player.sm("You craft some runes."); } /** * adds rewards to players skill and inventory * * @param player * used gets information from the player class */ private void addRewards(Player player) { if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 1) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp()); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 11) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 2); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 2); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 22) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 3); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 3); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 33) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 4); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 4); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 44) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 5); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 5); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 55) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 6); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 6); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 66) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 7); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 7); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 77) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 8); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 8); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 88) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 9); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 9); } if(player.getSkills().getLevel(Skills.RUNECRAFTING) >= 99) { int runes = player.getInventory().numberOf(1436); player.getInventory().addItem(definitions.getRuneId(), runes * 10); player.getInventory().deleteItem(1436, runes); player.getSkills().addXp(Skills.RUNECRAFTING, definitions.getXp() * runes * 10); } } }[/code]
  11. Difficulty: .25/10 Knowledge: Copy & Paste. Well, I made this in about 10 minutes while my Internet was out. Wouldn't have taken as long, but I had to dig up my old Item ID List. Anyway, this might help a few of you noobs out there. It's good if you're trying to learn some small shit. (Plus a friend of mine wanted me to release this.) Here it is: Step 1: Go into your ItemPacketHandler Class. Search for your itemOnItem void. It should look something like this: [CODE]private void itemOnItem[/CODE] Step 2: Now, put this inside the void: [CODE] // Slayer Helmets - by Repo if (UseWith(4164,4166,usedWith,itemUsed)) { // Making Masked Earmuffs if (player.SmokingKills == 0){ // If Smoking Kills is not completed. player.sm("You must complete Smoking Kills to learn how to make these."); return; } if (player.SmokingKills == 1) // If Smoking Kills is completed. player.sm("You combine your items to create some Masked earmuffs."); player.getInventory().deleteItem(usedWith, 1); player.getInventory().deleteItem(itemUsed, 1); player.getInventory().addItem(13277, 1); } if (UseWith(13277,4551,usedWith,itemUsed)) { // Making Slayer Helmet if (player.SmokingKills == 0){ // If Smoking Kills is not completed. player.sm("You must complete Smoking Kills to learn how to make these."); return; } if (player.SmokingKills == 1 && player.getSkills().getLevel(12) < 55) { // If Smoking Kills is completed and your Crafting level is less than 55. player.sm("Your Crafting level is not high enough to make this item!"); player.sm("Your Crafting level must be: 55."); } if (player.SmokingKills == 1 && player.getSkills().getLevel(12) > 54) { // If Smoking Kills is completed and your Crafting level is equal to or higher than 55. if (player.getInventory().contains(4168) && player.getInventory().contains(8921)) { // All items. player.sm("You combine your items to create a Slayer Helmet."); player.getInventory().deleteItem(usedWith, 1); // Ear Muffs and Face Mask player.getInventory().deleteItem(itemUsed, 1); // Spiny Helmet player.getInventory().deleteItem(4168, 1); // Nose Peg player.getInventory().deleteItem(8921, 1); // Black Mask player.getInventory().addItem(13263, 1); // Slayer Helmet } } } if (UseWith(13263,15488,usedWith,itemUsed)) { // Making Full Slayer Helmet ( Hexcrest first ) if (player.SmokingKills == 0){ // If Smoking Kills is not completed. player.sm("You must complete Smoking Kills to learn how to make these."); return; } if (player.SmokingKills == 1 && player.getSkills().getLevel(12) < 55) { // If Smoking Kills is completed and your Crafting level is less than 55. player.sm("Your Crafting level is not high enough to make this item!"); player.sm("Your Crafting level must be: 55."); } if (player.SmokingKills == 1 && player.getSkills().getLevel(12) > 54) { // If Smoking Kills is completed and your Crafting level is equal to or higher than 55. if (player.getInventory().contains(15490)) { // Focus Sight player.sm("You combine your items to create a Full Slayer Helmet."); player.getInventory().deleteItem(usedWith, 1); // Slayer Helmet player.getInventory().deleteItem(itemUsed, 1); // Hexcrest player.getInventory().deleteItem(15490, 1); // Focus Sight player.getInventory().addItem(15492, 1); // Full Slayer Helmet } } } else if (UseWith(13263,15490,usedWith,itemUsed)) { // Making Full Slayer Helmet ( Focus Sight first ) if (player.SmokingKills == 0){ // If Smoking Kills is not completed. player.sm("You must complete Smoking Kills to learn how to make these."); return; } if (player.SmokingKills == 1 && player.getSkills().getLevel(12) < 55) { // If Smoking Kills is completed and your Crafting level is less than 55. player.sm("Your Crafting level is not high enough to make this item!"); player.sm("Your Crafting level must be: 55."); } if (player.SmokingKills == 1 && player.getSkills().getLevel(12) > 54) { // If Smoking Kills is completed and your Crafting level is equal to or higher than 55. if (player.getInventory().contains(15488)) { // Hexcrest player.sm("You combine your items to create a Full Slayer Helmet."); player.getInventory().deleteItem(usedWith, 1); // Slayer Helmet player.getInventory().deleteItem(itemUsed, 1); // Focus Sight player.getInventory().deleteItem(15488, 1); // Hexcrest player.getInventory().addItem(15492, 1); // Full Slayer Helmet } } } [/CODE] Step 3: Put this int in your Player class: [CODE]public int SmokingKills;[/CODE] Step 4: Save, Compile, Enjoy. [CENTER]Inb4flaming.[/CENTER]
  12. Hey guys, I need help with a somewhat simple error. Although I've been messing around with it for about an hour or two trying to figure out how to fix this.. Here's the error code: [CODE]client.java:20757: ')' expected } else if(playerHasItemAmount <= (1734, 5) && playerHasItemAmount <= (1741, 5)) { ^ client.java:20757: not a statement } else if(playerHasItemAmount <= (1734, 5) && playerHasItemAmount <= (1741, 5)) { ^ client.java:20757: ';' expected } else if(playerHasItemAmount <= (1734, 5) && playerHasItemAmount <= (1741, 5)) { ^ client.java:20757: ')' expected } else if(playerHasItemAmount <= (1734, 5) && playerHasItemAmount <= (1741, 5)) { ^ client.java:20757: not a statement } else if(playerHasItemAmount <= (1734, 5) && playerHasItemAmount <= (1741, 5)) { ^ client.java:20757: not a statement } else if(playerHasItemAmount <= (1734, 5) && playerHasItemAmount <= (1741, 5)) { ^ client.java:20757: ';' expected } else if(playerHasItemAmount <= (1734, 5) && playerHasItemAmount <= (1741, 5)) { ^ client.java:20760: 'else' without 'if' } else { ^ 8 errors You have sucsessfully compiled Press any key to continue . . .[/CODE] Here is the full code that had the errors: [CODE]case 33189: if(playerHasItemAmount(1734, 5) && playerHasItemAmount(1741, 5) && playerLevel[12] >= 0) { RemoveAllWindows(); deleteItem(1734, getItemSlot(1734), 5); deleteItem(1741, getItemSlot(1741), 5); addItem(1059, 5); addSkillXP(135, 12); sendMessage("You craft 5 leather gloves."); } else if(playerHasItemAmount <= (1734, 5) && playerHasItemAmount <= (1741, 5)) { RemoveAllWindows(); sendMessage("You need at least 5 pieces of leather and thread to craft these."); } else { RemoveAllWindows(); sendMessage("You don't have any leather and/or thread."); } break;[/CODE] Can someone please help me? I try and figure stuff out on my own, but this is stumping me.. I've tried getting help from 2 different people, and they couldn't figure this out.. =/
  13. [CENTER][SIZE=5][URL="http://www.runelocus.com/forums/showthread.php?60084-RS2HD-Real-Spirit-Shield-Creations&p=532692#post532692"]http://www.runelocus.com/forums/showthread.php?60084-RS2HD-Real-Spirit-Shield-Creations&p=532692#post532692[/URL]< This is for the real way![/SIZE][/CENTER] Difficulty: .25/10 Knowledge: Copy & Paste. As requested, here it is: Step 1: Go into your ItemPacketHandler Class. Search for your itemOnItem void. It should look something like this: [CODE]private void itemOnItem[/CODE] Step 2: Now, put this inside the void: [CODE] // Spirit shields - by Repo if (UseWith(13754,13734,usedWith,itemUsed)) { // Making a Blessed Spirit Shield if (player.getSkills().getLevel(5) > 74) { // Must have level 75 Prayer to do this. player.sm("You pour the light Elixir all over the Spirit Shield."); player.getSkills().addXp(5, 75000); player.getInventory().deleteItem(usedWith, 1); player.getInventory().deleteItem(itemUsed, 1); player.getInventory().addItem(13736, 1); // Blessed Spirit Shield } else if (player.getSkills().getLevel(5) < 75) { // If your Prayer level is less than 75. player.sm("Your Prayer level is not high enough to make this item!"); player.sm("Your Prayer level must be: 75."); } } if (UseWith(13746,13736,usedWith,itemUsed)) { // Arcane Spirit Shield if (player.getSkills().getLevel(5) > 94) { // Must have level 95 Prayer to do this. player.sm("You attach the Arcane Sigil to your Blessed Spirit Shield."); player.sm("Your shield begins to glow a bright orange color."); player.getSkills().addXp(5, 100000); player.getInventory().deleteItem(usedWith, 1); player.getInventory().deleteItem(itemUsed, 1); player.getInventory().addItem(13738, 1); // Arcane Spirit Shield } else if (player.getSkills().getLevel(5) < 95) { // If your Prayer level is less than 95. player.sm("Your Prayer level is not high enough to make this item!"); player.sm("Your Prayer level must be: 95."); } } if (UseWith(13748,13736,usedWith,itemUsed)) { // Divine Spirit Shield if (player.getSkills().getLevel(5) > 94) { // Must have level 95 Prayer to do this. player.sm("You attach the Divine Sigil to your Blessed Spirit Shield."); player.sm("Your shield begins to glow a divine green color."); player.getSkills().addXp(5, 100000); player.getInventory().deleteItem(usedWith, 1); player.getInventory().deleteItem(itemUsed, 1); player.getInventory().addItem(13740, 1); // Divine Spirit Shield } else if (player.getSkills().getLevel(5) < 95) { // If your Prayer level is less than 95. player.sm("Your Prayer level is not high enough to make this item!"); player.sm("Your Prayer level must be: 95."); } } if (UseWith(13750,13736,usedWith,itemUsed)) { // Elysian Spirit Shield if (player.getSkills().getLevel(5) > 94) { // Must have level 95 Prayer to do this. player.sm("You attach the Elysian Sigil to your Blessed Spirit Shield."); player.sm("Your shield begins to glow a light blue color."); player.getSkills().addXp(5, 100000); player.getInventory().deleteItem(usedWith, 1); player.getInventory().deleteItem(itemUsed, 1); player.getInventory().addItem(13742, 1); // Elysian Spirit Shield } else if (player.getSkills().getLevel(5) < 95) { // If your Prayer level is less than 95. player.sm("Your Prayer level is not high enough to make this item!"); player.sm("Your Prayer level must be: 95."); } } if (UseWith(13752,13736,usedWith,itemUsed)) { // Spectral Spirit Shield if (player.getSkills().getLevel(5) > 94) { // Must have level 95 Prayer to do this. player.sm("You attach the Spectral Sigil to your Blessed Spirit Shield."); player.sm("Your shield begins to glow a vivid blue color."); player.getSkills().addXp(5, 100000); player.getInventory().deleteItem(usedWith, 1); player.getInventory().deleteItem(itemUsed, 1); player.getInventory().addItem(13744, 1); // Spectral Spirit Shield } else if (player.getSkills().getLevel(5) < 95) { // If your Prayer level is less than 95. player.sm("Your Prayer level is not high enough to make this item!"); player.sm("Your Prayer level must be: 95."); } } [/CODE] Step 3: Save, Compile, Enjoy. I might release my "With Anvil" version later tonight, depending on how far I get with my Tutorial Quest. [CENTER]Inb4flaming.[/CENTER]
  14. Well I'm literally like 500 bars from 99! So yeah, who ever wants to come I suggest logging on now in advanced and wait at [B]Seer's bank[/B] [B]World 23[/B] Estimation: [B]10 - 20 minutes[/B] This is going to be a double 99 party (Not actually a drop party; sorry!) With my sister (Who's getting 99 Herblore) And myself getting [B]99 Crafting[/B]. So yeah anyone who wants to come read above! :) [B]IGN:[/B] Loldielol
  15. * Removed because it was too incomplete. Just keep the normal PI crafting class.
  16. [B]While i am editing my first source I came stuck with some boredom I mean why does every server have uncut sapphire, emerald lvl 40, ruby lvl60 and dragonstone there are other uncuts to :o I decided to recode crafting a bit. So its a bit more unique I used random items and random amulets for know since im in the beta phase of my server still. I DID code the amulets and uncut prizes, xp, and stuff already. I just started coding a few days ago, and spent a lot of time on it recently; don't be to hard this is the first thing I made on my own :D [/B] Picture: [img]http://img824.imageshack.us/img824/2152/jajajazh.jpg[/img] [SIZE=4][B]Please tell me what ya think, it means a lot to a beginning coder (:[/B][/SIZE] [CODE]showInterface(2311); } if ((itemUsed == 1617 || otherItem == 1617) && (itemUsed == 1755 || otherItem == 1755)) { crafting(2450, 1617, 1731, 66); //diamond } if ((itemUsed == 1619 || otherItem == 1619) && (itemUsed == 1755 || otherItem == 1755)) { crafting(1760, 1619, 1725, 57); //ruby } if ((itemUsed == 1621 || otherItem == 1621) && (itemUsed == 1755 || otherItem == 1755)) { crafting(855, 1621, 1729, 39); //emerald } if ((itemUsed == 1623 || otherItem == 1623) && (itemUsed == 1755 || otherItem == 1755)) { crafting(185, 1623, 1727, 0); //saphire } if ((itemUsed == 1631 || otherItem == 1631) && (itemUsed == 1755 || otherItem == 1755)) { crafting(5100, 1631, 1712, 83); //dragonstone } if ((itemUsed == 6571 || otherItem == 6571) && (itemUsed == 1755 || otherItem == 1755)) { crafting(8400, 6571, 6585, 94); //onyx } if ((itemUsed == 1629 || otherItem == 1629) && (itemUsed == 1755 || otherItem == 1755)) { crafting(3330, 1629, 1478, 75); //red topaz } if ((itemUsed == 3109 || otherItem == 3109) && (itemUsed == 1755 || otherItem == 1755)) { crafting(65000, 3109, 4081, 99); //Salve Ball } if ((itemUsed == 1627 || otherItem == 1627) && (itemUsed == 1755 || otherItem == 1755)) { crafting(1240, 1627, 4250, 48); //Jade } if ((itemUsed == 1625 || otherItem == 1625) && (itemUsed == 1755 || otherItem == 1755)) { crafting(410, 1625, 6040, 21); //opal } [/CODE]
  17. Hello, I recently started coding again on a PI server. Now, I'm not that good. I noticed that crafting D'hides isn't working, and I couldn't figure it out how to make it work with thread. Here's the code it has atm. [CODE]package server.model.players.skills; import server.model.players.Client; import server.Config; public class Crafting { Client c; public Crafting(Client c) { this.c = c; } public int hideType = 0, makeId = 0, amount = 0, craftType = 0, exp = 0, index = 0; public void resetCrafting() { hideType = 0; makeId = 0; amount = 0; c.craftingLeather = false; craftType = 0; } public void handleChisel(int id1, int id2) { if (id1 == 1755) cutGem(id2); else cutGem(id1); } public int[][] gems = {{1623,1727,1,50},{1621,1729,27,68},{1619,1725,34,85},{1617,1731,43,108},{1631,1712,55,138},{6571,6573,67,168}}; public void cutGem(int id) { for (int j = 0; j < gems.length; j++) { if (gems[j][0] == id) { if (c.playerLevel[c.playerCrafting] >= gems[j][2]) { c.getItems().deleteItem(id, c.getItems().getItemSlot(id),1); c.getItems().addItem(gems[j][1], 1); c.getPA().addSkillXP(gems[j][3] * Config.CRAFTING_EXPERIENCE, c.playerCrafting); break; } } } } public void handleCraftingClick(int clickId) { for (int j = 0; j < buttons.length; j++) { if (buttons[j][0] == clickId) { craftType = buttons[j][1]; amount = buttons[j][2]; checkRequirements(); break; } } } public void checkRequirements() { for (int j = 0; j < expsAndLevels.length; j++) { if (expsAndLevels[j][0] == hideType) { if (c.playerLevel[c.playerCrafting] >= expsAndLevels[j][1]) { if (c.getItems().playerHasItem(hideType, 1)) { c.getPA().closeAllWindows(); exp = expsAndLevels[j][2]; index = j; craftHides(hideType); } } else { c.sendMessage("You need a crafting level of " + expsAndLevels[j][1] + " to craft this."); } } } } public void craftHides(int id) { for (int j = 0; j < amount; j++) { if (!c.getItems().playerHasItem(id,craftType)) break; c.getItems().deleteItem(id, craftType); if (getItemToAdd() <= 0) break; c.getItems().addItem(getItemToAdd(), 1); c.getPA().addSkillXP(exp * Config.CRAFTING_EXPERIENCE, c.playerCrafting); } resetCrafting(); } public int getItemToAdd() { if (craftType == 1) { return vambs[index]; } else if (craftType == 2) { return chaps[index]; } else if (craftType == 3) { return bodys[index]; } return -1; } public int[] vambs = {1065,2487,2489,2491}; public int[] chaps = {1099,2493,2495,2497}; public int[] bodys = {1135,2499,2501,2503}; public void handleLeather(int item1, int item2) { if (item1 == 1733) { openLeather(item2); } else { openLeather(item1); } } public int[][] buttons = {{34185,1,1},{34184,1,5},{34183,1,10},{34182,1,27},{34189,2,1},{34188,2,5},{34187,2,10},{34186,2,27},{34193,3,1},{34192,3,5},{34191,3,10},{34190,3,27}}; public int[][] expsAndLevels = {{1745,62,57},{2505,66,70},{2507,73,78},{2509,79,86}}; public void openLeather(int item) { if (item == 1745) { c.getPA().sendFrame164(8880); //green dhide c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 1099); // middle c.getPA().sendFrame246(8883, 250, 1065); // left picture c.getPA().sendFrame246(8885, 250, 1135); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2505) { c.getPA().sendFrame164(8880); //blue c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2493); // middle c.getPA().sendFrame246(8883, 250, 2487); // left picture c.getPA().sendFrame246(8885, 250, 2499); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2507) { c.getPA().sendFrame164(8880); c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2495); // middle c.getPA().sendFrame246(8883, 250, 2489); // left picture c.getPA().sendFrame246(8885, 250, 2501); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } else if (item == 2509) { c.getPA().sendFrame164(8880); c.getPA().sendFrame126("What would you like to make?", 8879); c.getPA().sendFrame246(8884, 250, 2497); // middle c.getPA().sendFrame246(8883, 250, 2491); // left picture c.getPA().sendFrame246(8885, 250, 2503); // right pic c.getPA().sendFrame126("Vambs", 8889); c.getPA().sendFrame126("Chaps", 8893); c.getPA().sendFrame126("Body", 8897); hideType = item; } c.craftingLeather = true; } }[/CODE] Stone cutting works fine, it's just the D'hide part. Please help.
×