Jump to content

Search the Community

Showing results for tags 'potion'.



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

  1. [img]http://puu.sh/dnvqe/98f5d75db5.png[/img] ItemClick3.java find [CODE]int itemId = c.getInStream().readSignedWordA();[/CODE] add this code under integer itemId [CODE] final String itemName = ItemAssistant.getItemName(itemId).toLowerCase();[/CODE] then add this [CODE] if (itemName.contains("(4)") || itemName.contains("(3)") || itemName.contains("(2)") || itemName.contains("(1)")) { c.getItems().deleteItem(itemId, 1); c.getItems().addItem(229, 1); c.sendMessage("You empty the "+itemName+"."); }[/CODE]
  2. Chinchillaa

    Potion effects?

    I used to play a server that had a zamorak brew, but it would increase your levels just as a super set would. I am interested on doing this on my server but how should I? Could someone post me some code or tell me what to change? Sorry I'm new it's probably simple :) Cheers.
  3. This is for rs2hd, but you can convert easily for any other source. Create a class in src.com.rs2hd.content, named PotionDrinking. Once done, paste this in it: [code]package com.rs2hd.content; import com.rs2hd.model.Item; import com.rs2hd.model.Player; import com.rs2hd.content.Effects.PotionEffects; /** * Handles potion drinking. * [MENTION=52317]auth[/MENTION]or Guillaume (Hash - RuneLocus) ; (ByteValue - Rune-Server) * */ public class PotionDrinking { private static Potions getPotion(int id) { for (Potions potion : Potions.values()) if (id == potion.getPotionId()) return potion; return null; } public static enum Potions { ATTACK_POTION1(125, 229), ATTACK_POTION2(123, 125), ATTACK_POTION3(121, 123), ATTACK_POTION4(2428, 121), ANTIPOISON1(179, 229), ANTIPOISON2(177, 179), ANTIPOISON3(175, 177), ANTIPOISON4(2446, 175), RELICYM_BALM1(4848, 229), RELICYM_BALM2(4846, 4848), RELICYM_BALM3(4844, 4846), RELICYM_BALM4(4842, 4844), STRENGTH_POTION1(119, 229), STRENGTH_POTION2(117, 119), STRENGTH_POTION3(115, 117), STRENGTH_POTION4(113, 115), RESTORE_POTION1(131, 229), RESTORE_POTION2(129, 131), RESTORE_POTION3(127, 129), RESTORE_POTION4(2430, 127), ENERGY_POTION1(3014, 229), ENERGY_POTION2(3012, 3014), ENERGY_POTION3(3010, 3012), ENERGY_POTION4(3008, 3010), DEFENCE_POTION1(137, 229), DEFENCE_POTION2(135, 137), DEFENCE_POTION3(133, 135), DEFENCE_POTION4(2432, 133), AGILITY_POTION1(3038, 229), AGILITY_POTION2(3036, 3038), AGILITY_POTION3(3034, 3036), AGILITY_POTION4(3032, 3034), COMBAT_POTION1(9745, 229), COMBAT_POTION2(9743, 9745), COMBAT_POTION3(9741, 9743), COMBAT_POTION4(9739, 9741), PRAYER_POTION1(143, 229), PRAYER_POTION2(141, 143), PRAYER_POTION3(139, 141), PRAYER_POTION4(2434, 139), SUMMONING_POTION1(12146, 229), SUMMONING_POTION2(12144, 12146), SUMMONING_POTION3(12142, 12144), SUMMONING_POTION4(12140, 12142), SUPER_ATTACK_POTION1(149, 229), SUPER_ATTACK_POTION2(147, 149), SUPER_ATTACK_POTION3(145, 147), SUPER_ATTACK_POTION4(2436, 145), SUPER_ANTIPOISON1(185, 229), SUPER_ANTIPOISON2(183, 185), SUPER_ANTIPOISON3(181, 183), SUPER_ANTIPOISON4(2448, 181), FISHING_POTION1(155, 229), FISHING_POTION2(153, 155), FISHING_POTION3(151, 153), FISHING_POTION4(2438, 151), SUPER_ENERGY_POTION1(3022, 229), SUPER_ENERGY_POTION2(3020, 3022), SUPER_ENERGY_POTION3(3018, 3020), SUPER_ENERGY_POTION4(3016, 3018), HUNTER_POTION1(10004, 229), HUNTER_POTION2(10002, 10004), HUNTER_POTION3(10000, 10002), HUNTER_POTION4(9998, 10000), SUPER_STRENGHT_POTION1(161, 229), SUPER_STRENGHT_POTION2(159, 161), SUPER_STRENGHT_POTION3(157, 159), SUPER_STRENGHT_POTION4(2440, 157), SUPER_RESTORE_POTION1(3030, 229), SUPER_RESTORE_POTION2(3028, 3030), SUPER_RESTORE_POTION3(3026, 3028), SUPER_RESTORE_POTION4(3024, 3026), SUPER_DEFENCE_POTION1(167, 229), SUPER_DEFENCE_POTION2(165, 167), SUPER_DEFENCE_POTION3(163, 165), SUPER_DEFENCE_POTION4(2442, 163), ANTIPOISON_PLUS1(5949, 229), ANTIPOISON_PLUS2(5947, 5949), ANTIPOISON_PLUS3(5945, 5947), ANTIPOISON_PLUS4(5943, 5945), ANTI_FIREBREATH_POTION1(2458, 229), ANTI_FIREBREATH_POTION2(2456, 2458), ANTI_FIREBREATH_POTION3(2454, 2456), ANTI_FIREBREATH_POTION4(2452, 2454), RANGING_POTION1(173, 229), RANGING_POTION2(171, 173), RANGING_POTION3(169, 171), RANGING_POTION4(2444, 169), MAGIC_POTION1(3046, 229), MAGIC_POTION2(3044, 3046), MAGIC_POTION3(3042, 3044), MAGIC_POTION4(3040, 3042), ZAMORAK_BREW1(193, 229), ZAMORAK_BREW2(191, 193), ZAMORAK_BREW3(189, 191), ZAMORAK_BREW4(2450, 189), ANTIPOISON_PLUSPLUS1(5958, 229), ANTIPOISON_PLUSPLUS2(5956, 5958), ANTIPOISON_PLUSPLUS3(5954, 5956), ANTIPOISON_PLUSPLUS4(5952, 5954), SARADOMIN_BREW1(6691, 229), SARADOMIN_BREW2(6689, 6691), SARADOMIN_BREW3(6687, 6689), SARADOMIN_BREW4(6685, 6687); private int potionId; private int newId; private Potions(int potionId, int newId) { this.potionId = potionId; this.newId = newId; } public int getPotionId() { return potionId; } public int getNewPotionId() { return newId; } public void drinkPotion(Player player, int slot) { Item item = player.getInventory().getContainer().get(slot); Potions potion = getPotion(item.getId()); if (canDrink(player, potion)) { player.getInventory().getContainer() .set(slot, (getNewPotionId()) == -1 ? null : new Item(getNewPotionId(), 1)); player.animate(1327); player.addPotDelay(3000); player.getInventory().refresh(); drinkMessage(player, potion, item); PotionEffects.applyPotionEffects(player, potion); } } public void drinkMessage(Player player, Potions potion, Item item) { String itemdef = item.getDefinition().getName(); String potionName = itemdef.substring(0, itemdef.length() - 4).toLowerCase(); final String POTION_MESSAGE = "You drink some of your " + potionName + "."; final String SARADOMIN_BREW_MESSAGE = "You drink some of the foul liquid."; int dosesLeft = Integer.parseInt((itemdef.substring(itemdef.length() - 2, itemdef.length() - 1))) - 1; if (potion.getPotionId() == 6685 || potion.getPotionId() == 6687 || potion.getPotionId() == 6689 || potion.getPotionId() == 6691) player.getActionSender().sendMessage(SARADOMIN_BREW_MESSAGE); else player.getActionSender().sendMessage(POTION_MESSAGE); if (dosesLeft >= 2) player.getActionSender().sendMessage("You have " + dosesLeft + " doses left."); else if (dosesLeft == 1) player.getActionSender().sendMessage("You have " + dosesLeft + " dose left."); if (getNewPotionId() == 229) player.getActionSender().sendMessage("You finish your potion."); } public boolean canDrink(Player player, Potions potion) { if (player.getPotDelay() < System.currentTimeMillis()) return true; if (player.isBusy()) return false; return false; } } } [/code] -------------------------------------------------------------------------------------------------------------------------- In Player.java, add this with all the other ones: [code]private transient PotionDrinking potionDrinking; private transient Effects effects;[/code] and add [code]public PotionDrinking getPotionDrinking() { return potionDrinking; } public Effects getEffects() { return effects; } public void addPotDelay(long time) { foodDelay = time + System.currentTimeMillis(); } public long getPotDelay() { return foodDelay; } [/code] and if you didn't add it from the other snippets, add this with your variables at top of the class: [code]private transient long foodDelay;[/code] --------------------------------------------------------------------------------------------------------------------------------------------- In ItemPacketHandler.java, find [code]private void itemSelect(final Player player, final Packet packet) {[/code] and under [code]if (interfaceId == 149) {[/code] add [code]for(Potions potion : Potions.values()) { if(potion != null && id == potion.getPotionId()) potion.drinkPotion(player, slot); }[/code] and import [code]import com.rs2hd.content.PotionDrinking.Potions;[/code] -------------------------------------------------------------------------------------------------------------------------------------------- In com.rs2hd.content, create a class named Effects and paste this in it: [code]package com.rs2hd.content; import com.rs2hd.GameEngine; import com.rs2hd.content.Foods.Food; import com.rs2hd.content.PotionDrinking.Potions; import com.rs2hd.model.Player; import com.rs2hd.model.Skills; public class Effects { /** * Class to handle the effects of potions/food when a player drinks/eats it. * [MENTION=52317]auth[/MENTION]or Guillaume (Hash - RuneLocus ; ByteValue - Rune-Server) * */ /* Use only if the boost is added to the current level */ private static boolean differentBoost; /** * Gets the player's level after adding the boost to the real level or current level. * @return currentLevel + boost * else * @return realLevel + boost */ public static int getCurrentLevel(int realLevel, int currentLevel, double boost) { if (differentBoost) return (int) (currentLevel + boost); else return (int) (realLevel + boost); } /** * Applies a boost to more than 1 skill * */ public static void getCurrentLevels(Player player, int[] skills, int realLevel, int currentLevel, double boost) { for (int i = 0; i < skills.length; i++) player.getSkills().set(skills[i], (int) (realLevel + boost)); } static class PotionEffects { /** * Applies effects to the player's skills after drinking the potion. * */ public static void applyPotionEffects(Player player, Potions potion) { int skill = 0; int currentLevel = player.getSkills().getLevel(skill); int realLevel = player.getSkills().getLevelForXp(skill); double boost = 0; double normalBoost = 3.0 + (realLevel * 0.10); double superBoost = 5.0 + (realLevel * 0.15); double extremeBoost = 5.0 + (realLevel * 0.22); switch(potion.getPotionId()) { /************************************ * COMBAT POTIONS * ************************************/ case 125: // Attack potions case 123: case 121: case 2428: skill = Skills.ATTACK; boost = normalBoost; break; case 145: // Super attack potions case 147: case 149: case 2436: skill = Skills.ATTACK; boost = superBoost; break; case 15308: // Extreme attack potions case 15309: case 15310: case 15311: skill = Skills.ATTACK; boost = extremeBoost; break; case 113: // Strength potions case 115: case 117: case 119: skill = Skills.STRENGTH; boost = normalBoost; break; case 157: // Super strength potions case 159: case 161: case 2440: skill = Skills.STRENGTH; boost = superBoost; break; case 15312: // Extreme strength potions case 15313: case 15314: case 15315: skill = Skills.STRENGTH; boost = extremeBoost; break; case 133: // Defence potions case 135: case 137: case 2432: skill = Skills.DEFENCE; boost = normalBoost; break; case 163: // Super defence potions case 165: case 167: case 2442: skill = Skills.DEFENCE; boost = superBoost; break; case 15316: // Extreme defence potions case 15317: case 15318: case 15319: skill = Skills.DEFENCE; boost = extremeBoost; break; case 9739: // Combat potions case 9741: case 9743: case 9745: boost = normalBoost; getCurrentLevels(player, new int[] {0, 2}, realLevel, currentLevel, boost); break; case 139: // Prayer potions case 141: case 143: case 2434: skill = Skills.PRAYER; differentBoost = true; boost = 7.0 + (0.25 * realLevel); if (currentLevel + boost > realLevel) boost = 0; break; case 175: case 177: case 179: case 2446: GameEngine.poison.curePoison(player); if (player.getPoisonImmunity() < System.currentTimeMillis()) { player.getActionSender().sendMessage("You are now immune to poison."); player.addImmunityToPoison(0x15f90); } break; case 181: case 183: case 185: case 2448: GameEngine.poison.curePoison(player); if (player.getPoisonImmunity() < System.currentTimeMillis()) { player.getActionSender().sendMessage("You are now immune to poison."); player.addImmunityToPoison(0x57e40); } break; /************************************ * SKILLS POTIONS * ************************************/ case 3032: // Agility potions case 3034: case 3036: case 3038: differentBoost = true; skill = Skills.AGILITY; boost = 2 + (Math.random() * ((3 - 2) + 1)); break; } player.getSkills().set(skill, getCurrentLevel(realLevel, currentLevel, boost)); } } /** * Handles the effects of the food when a player eats it. * [MENTION=52317]auth[/MENTION]or Guillaume * */ static class FoodEffects { public static void applyFoodEffect(Player player, Food food) { int skill = 0; int currentLevel = player.getSkills().getLevel(skill); int realLevel = player.getSkills().getLevelForXp(skill); double boost = 0; switch (food.getFoodId()) { case 7218: case 7220: skill = Skills.AGILITY; player.setRunEnergy((int)(player.getRunEnergy() + (double) player.getRunEnergy() * (20 / 100))); boost = 5; break; case 7178: case 7180: skill = Skills.FARMING; boost = 3; } player.getSkills().set(skill, getCurrentLevel(realLevel, currentLevel, boost)); } } } [/code] P.S. Not all the potions are finished, but look at other ones and you'll know how to add them. Feel free to ask any questions!
  4. Does anyone have a link, or now how to add Recover Special Potion, if you do post below thank you.
  5. You will need to modify the imports and packaging to your server. This includes most potions for the #377 revision. Conventions are poor when using ID, however that is what I prefer. Add this class: [code] import server.game.players.Client; /** * * @author 0021sordna & 210jrellik * @date 2-28-2012 * @category Potions * */ public class PotionMixing { private final Client c; public PotionMixing(final Client c) { this.c = c; } /* * Constants for use later. */ private static final int VIAL = 227; private static final int EMPTY_VIAL = 229; /** * * @author 210jrellik * @date 2-28-2012 */ public enum CombiningDoses { STRENGTH(119, 117, 115, 113, VIAL, "Strength"), SUPER_STRENGTH(161, 159, 157, 2440, VIAL, "Super strength"), ATTACK(125, 123, 121, 2428, VIAL, "Attack"), SUPER_ATTACK(149, 147, 145, 2436, VIAL, "Super attack"), DEFENCE(137, 135, 133, 2432, VIAL, "Defence"), SUPER_DEFENCE(167, 165, 163, 2442, VIAL, "Super defence"), RANGING_POTION(173, 171, 169, 2444, VIAL, "Ranging"), FISHING(155, 153, 151, 2438, VIAL, "Fishing"), PRAYER(143, 141, 139, 2434, VIAL, "Prayer"), ANTIFIRE(2458, 2456, 2454, 2452, VIAL, "Antifire"), ZAMORAK_BREW(193, 191, 189, 2450, VIAL, "Zamorakian brew"), ANTIPOISON(179, 177, 175, 2446, VIAL, "Antipoison"), RESTORE(131, 129, 127, 2430, VIAL, "Restoration"), MAGIC_POTION(3046, 3044, 3042, 3040, VIAL, "Magic"), SUPER_RESTORE(3030, 3028, 3026, 3024, VIAL, "Super Restoration"), ENERGY(3014, 3012, 3010, 3008, VIAL, "Energy"), SUPER_ENERGY(3022, 3020, 3018, 3016, VIAL, "Super Energy"), AGILITY(3038, 3036, 3034, 3032, VIAL, "Agility"), SARADOMIN_BREW(6691, 6689, 6687, 6685, VIAL, "Saradomin brew"), ANTIPOISON1(5949, 5947, 5945, 5943, VIAL, "Antipoison(+)"), ANTIPOISON2(5958, 5956, 5954, 5952, VIAL, "Antipoison(++)"), SUPER_ANTIPOISON(185, 183, 181, 2448, VIAL, "Super Antipoison"), RELICYMS_BALM(4848, 4846, 4844, 4842, VIAL, "Relicym's balm"), SERUM_207(3414, 3412, 3410, 3408, VIAL, "Serum 207"), COMBAT(9745, 9743, 9741, 9739, VIAL, "Combat"); /* * This is what the data in the above enumeration is, in order. * EX: * COMBAT(oneDosePotionID, twoDosePotionID, threeDosePotionID, fourDosePotionID, vial, "potionName"); */ int oneDosePotionID, twoDosePotionID, threeDosePotionID, fourDosePotionID, vial; String potionName; /** * @param oneDosePotionID - This is the ID for the potion when it contains one dose. * * @param twoDosePotionID - This is the ID for the potion when it contains two doses. * * @param threeDosePotionID - This is the ID for the potion when it contains three doses. * * @param fourDosePotionID - This is the ID for the (full) potion when it contains four doses. * * @param vial - This is referenced from: * private static final int VIAL = 227; * It's a constant and its value never changes. * * @param potionName - This is a string which is used to set a name for the potion. * Within an enumeration you can use the name(). method to take the name in-front of the stored data. This however could not be done because of some potion names. */ private CombiningDoses(int oneDosePotionID, int twoDosePotionID, int threeDosePotionID, int fourDosePotionID, int vial, String potionName) { this.oneDosePotionID = oneDosePotionID; this.twoDosePotionID = twoDosePotionID; this.threeDosePotionID = threeDosePotionID; this.fourDosePotionID = fourDosePotionID; this.vial = vial; this.potionName = potionName; } /* * These are code getters to use the data stored in the above enumeration. */ public int getDoseID1() { return oneDosePotionID; } public int getDoseID2() { return twoDosePotionID; } public int getDoseID3() { return threeDosePotionID; } public int getFourDosePotionID() { return fourDosePotionID; } public int getVial() { return vial; } public String getPotionName() { return potionName; } /** * * @param id * @return The dose that this id represents for this potion, or -1 if it doesn't belong to this potion. * @date 2/28/12 * @author 0021sordna */ public int getDoseForID(int id) { if (id == this.oneDosePotionID) { return 1; } if (id == this.twoDosePotionID) { return 2; } if (id == this.threeDosePotionID) { return 3; } if (id == this.fourDosePotionID) { return 4; } return -1; } /** * * @param dose * @return The ID for this dose of the potion, or -1 if this dose doesn't exist. * @date 2/28/12 * @author 0021sordna */ public int getIDForDose(int dose) { if (dose == 1) { return this.oneDosePotionID; } if (dose == 2) { return this.twoDosePotionID; } if (dose == 3) { return this.threeDosePotionID; } if (dose == 4) { return this.fourDosePotionID; } if (dose == 0) { return EMPTY_VIAL; } return -1; } /** * * @param ID * @return The potion that matches the ID. ID can be any dose of the potion. * @date 2/28/12 * @author 0021sordna */ public static CombiningDoses getPotionByID(int id) { for (CombiningDoses potion : CombiningDoses.values()) { if (id == potion.oneDosePotionID) { return potion; } if (id == potion.twoDosePotionID) { return potion; } if (id == potion.threeDosePotionID) { return potion; } if (id == potion.fourDosePotionID) { return potion; } } return null; } } /** * * @param firstPotID * @param secondPotID * @date 2/28/12 * @author 0021sordna & 210jrellik */ public void potionCombination(int firstPotID, int secondPotID) { CombiningDoses potion = CombiningDoses.getPotionByID(firstPotID); if (potion == null) { return; } if (potion.getDoseForID(secondPotID) > 0) { int firstPotAmount = potion.getDoseForID(firstPotID); int secondPotAmount = potion.getDoseForID(secondPotID); if (firstPotAmount + secondPotAmount <= 4) { c.getItems().deleteItem(firstPotID, c.getItems().getItemSlot(firstPotID), 1); c.getItems().deleteItem(secondPotID, c.getItems().getItemSlot(secondPotID), 1); c.getItems().addItem(potion.getIDForDose(firstPotAmount + secondPotAmount), 1); c.getItems().addItem(EMPTY_VIAL, 1); } else { int overflow = (firstPotAmount + secondPotAmount) - 4; c.getItems().deleteItem(firstPotID, c.getItems().getItemSlot(firstPotID), 1); c.getItems().deleteItem(secondPotID, c.getItems().getItemSlot(secondPotID), 1); c.getItems().addItem(potion.getIDForDose(4), 1); c.getItems().addItem(potion.getIDForDose(overflow), 1); } } else { c.sendMessage("You can't combine a " + potion.getPotionName() + " potion with a " + CombiningDoses.getPotionByID(secondPotID).getPotionName() + " potion."); } } } [/code] Within UseItem class either replace or add: [code] /* * Herblore Potion Mixing */ if (c.getItems().getItemName(itemUsed).contains("(") && c.getItems().getItemName(useWith).contains("(")) { c.getPotMixing().potionCombination(itemUsed, useWith); } [/code]
  6. Basically, whenever i drink super str (any dose) it only boosts to 110 instead of 118 when im 99 str. Rest of the pots work, i've tried using the pots from another source, same problem. I've also used the code from super att. same problem. please help! switch (potionID) { case 2436: case 145: case 147: case 149: root = getLevelForXP(0); toAdd = 5 + (int)Math.round(root * 0.1414141414); if ((skillLvl[0] + toAdd) > (root + toAdd)) { skillLvl[0] = root + toAdd; } else { skillLvl[0] += toAdd; } getActionSender().setSkillLvl(this, 0); break; case 2440: case 157: case 159: case 161: root = getLevelForXP(2); toAdd = 5 + (int)Math.round(root * 0.1414141414); if ((skillLvl[2] + toAdd) > (root + toAdd)) { skillLvl[2] = root + toAdd; } else { skillLvl[2] += toAdd; } getActionSender().setSkillLvl(this, 2); break; that is the code I have used. I'm on Rofl-pvp
  7. hey guys, question says it all. how do i add overload effects for the fishing potion to make it like a overload if i drank it. now when i click a fishing potion , it says :" unknown item id : 2438 " my friend has his server on and fishing potion works exactly like an overload , but he won't tell me how to do it. he just told me " edit the itemdefinitions.java please help ? i want the bonus added in the fishing potion , and i don't want it to give damage when drinking. thanks. and this is the code inside the itemdefinitions.java for the fishing potion : [CODE] <examine>4 doses of fishing potion.</examine> <id>2438</id> <stackable>false</stackable> <name>Fishing potion(4)</name> <noted>false</noted> <equipId>-1</equipId> </itemDefinition> <itemDefinition> <price> <minPrice>0</minPrice> <maxPrice>0</maxPrice> <normPrice>0</normPrice> </price> <bonus> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> <int>0</int> </bonus>[/CODE] please reply asap. thx :)
×