sdsd

From sdsd, 3 Years ago, written in Plain Text, viewed 52 times.
URL https://paste.bugabuse.net/view/86642482 Embed
Download Paste or View Raw
  1. package com.rs2.model.content.skills.Cooking;
  2.  
  3. import com.rs2.Constants;
  4. import com.rs2.model.content.skills.Skill;
  5. import com.rs2.model.players.Player;
  6. import com.rs2.model.players.item.Item;
  7. import com.rs2.model.players.item.ItemDefinition;
  8.  
  9. /**
  10.  * Created by IntelliJ IDEA. User: vayken Date: 22/12/11 Time: 21:29 To change
  11.  * this template use File | Settings | File Templates.
  12.  */
  13. public class OneIngredients {
  14.         public static enum MixItemData {
  15.                 PIE_SHELL(1953, 0, 2313, 2315, 1, 0, true, 0),
  16.                 REDBERRY_PIE(1951, 0, 2315, 2321, 10, 78, true, 0),
  17.                 APPLE_PIE(1955, 0, 2315, 2317, 30, 130, true, 0),
  18.                 MEAT_PIE(2142, 0, 2315, 2319, 20, 110, true, 0),
  19.                 CURRY(2007, 0, 1921, 2009, 60, 280, true, 7496),
  20.                 CURRY_LEAF(5970, 3, 1921, 2009, 60, 280, true, 0),
  21.                 MEAT_PIZZA(2142, 0, 2289, 2293, 45, 169, true, 0),
  22.                 ANCHOVIE_PIZZA(319, 0, 2289, 2297, 45, 169, true, 0),
  23.                 PINEAPPLE_PIZZA(2116, 0, 2289, 2301, 65, 195, true, 0),
  24.                 PINEAPPLE_PIZZA2(2118, 0, 2289, 2301, 65, 195, true, 0),
  25.                 CHOCOLATE_CAKE(1973, 0, 1891, 1897, 50, 210, true, 0),
  26.                 CHOCOLATE_CAKE2(1975, 0, 1891, 1897, 50, 210, true, 0),
  27.                 CHOCOLATE_MILK(1975, 0, 1927, 1977, 4, 0, true, 0),
  28.                 CAKE1(2516, 0, 1887, 1889, 40, 0, true, 0),
  29.                 CAKE2(1927, 0, 1887, 1889, 40, 0, true, 0),
  30.                 CAKE3(1944, 0, 1887, 1889, 40, 0, true, 0),
  31.                 SPICY_SAUCE(1550, 0, 1923, 7074, 9, 25, true, 0),
  32.                 SPICY_SAUCE2(2169, 0, 7074, 7072, 9, 25, true, 0),
  33.                 CON_CARNE(2142, 0, 7072, 7062, 11, 55, true, 0),
  34.                 SCRAMBLED_EGG(1944, 0, 1923, 7076, 13, 50, true, 0),
  35.                 SCRAMBLED_EGG_AND_TOMATO(1982, 0, 7078, 7064, 23, 50, true, 0),
  36.                 FRIED_ONION(1957, 0, 1923, 1871, 42, 60, true, 0),
  37.                 FRIED_MUSHROOM(6004, 0, 1923, 7080, 46, 60, true, 0),
  38.                 MUSHROOM_AND_ONION(7082, 0, 7084, 7066, 57, 120, false, 1923),
  39.                 POTATO_WITH_BUTTER(6697, 0, 6705, 6703, 39, 95.5, false, 1923),
  40.                 CHILLI_POTATO(6703, 0, 7062, 7054, 41, 165.5, false, 1923),
  41.                 CHEESE_POTATO(6703, 0, 1985, 6705, 47, 199.5, false, 1923),
  42.                 EGG_POTATO(6703, 0, 7064, 7056, 51, 195.5, false, 1923),
  43.                 MUSHROOM_AND_ONION_POTATO(7082, 0, 7066, 7058, 64, 270.5, false, 1923),
  44.                 TUNA_POTATO(6703, 0, 7068, 7060, 68, 309.5, false, 1923),
  45.                 WINE(1987, 0, 1937, 1993, 68, 309.5, false, 0),
  46.                 NETTLE(4241, 0, 1921, 4237, 20, 52, false, 0),
  47.                 NETTLE_TEA(4239, 0, 1980, 4242, 20, 52, false, 1923),;
  48.                
  49.                
  50.                 private int primaryIngredient;
  51.                 private int amount;
  52.                 private int recipient;
  53.                 private int result;
  54.                 private int level;
  55.                 private double experience;
  56.                 private boolean hasRecipient;
  57.                 private int emptyOne;
  58.  
  59.                 public static MixItemData forIdItem(int itemUsed, int withItem) {
  60.                         for (MixItemData mixItemData : MixItemData.values()) {
  61.                                 if ((mixItemData.primaryIngredient == itemUsed && mixItemData.recipient == withItem) || (mixItemData.primaryIngredient == withItem && mixItemData.recipient == itemUsed)) {
  62.                                         return mixItemData;
  63.                                 }
  64.                         }
  65.                         return null;
  66.                 }
  67.  
  68.                 private MixItemData(int primaryIngredient, int amount, int recipient, int result, int level, double experience, boolean hasRecipient, int emptyOne) {
  69.                         this.primaryIngredient = primaryIngredient;
  70.                         this.amount = amount;
  71.                         this.recipient = recipient;
  72.                         this.result = result;
  73.                         this.level = level;
  74.                         this.experience = experience;
  75.                         this.hasRecipient = hasRecipient;
  76.                         this.emptyOne = emptyOne;
  77.                 }
  78.  
  79.                 public int getPrimaryIngredient() {
  80.                         return primaryIngredient;
  81.                 }
  82.  
  83.                 public int getAmount() {
  84.                         return amount;
  85.                 }
  86.  
  87.                 public int getRecipient() {
  88.                         return recipient;
  89.                 }
  90.  
  91.                 public int getResult() {
  92.                         return result;
  93.                 }
  94.  
  95.                 public int getLevel() {
  96.                         return level;
  97.                 }
  98.  
  99.                 public double getExperience() {
  100.                         return experience;
  101.                 }
  102.  
  103.                 public boolean hasRecipient() {
  104.                         return hasRecipient;
  105.                 }
  106.  
  107.                 public int getEmptyOne() {
  108.                         return emptyOne;
  109.                 }
  110.         }
  111.  
  112.         public static boolean mixItems(Player player, int itemUsed, int withItem, int itemUsedSlot, int withItemSlot) {
  113.                 MixItemData rightData = MixItemData.forIdItem(itemUsed, withItem);
  114.                 if (rightData == null) {
  115.                         return false;
  116.                 }
  117.                 player.getActionSender().removeInterfaces();
  118.                 if (!Constants.COOKING_ENABLED) {
  119.                         player.getActionSender().sendMessage("This skill is currently disabled.");
  120.                         return true;
  121.                 }
  122.                 if (player.getSkill().getLevel()[Skill.COOKING] < rightData.getLevel()) {
  123.                         player.getDialogue().sendStatement("You need a cooking level of " + rightData.getLevel() + " to do this.");
  124.                         return true;
  125.                 }
  126.                 int amount = rightData.getAmount() == 0 ? 1 : rightData.getAmount();
  127.                 if (player.getInventory().getItemAmount(rightData.getPrimaryIngredient()) < amount) {
  128.                         player.getDialogue().sendStatement("You need " + amount + " " + ItemDefinition.forId(rightData.getPrimaryIngredient()).getName().toLowerCase() + " to do this");
  129.                         return true;
  130.                 }
  131.                 if ((rightData.getResult() == 1871 || rightData.getResult() == 7080 || rightData.getResult() == 7074) && !player.getInventory().getItemContainer().contains(946)) {
  132.                         player.getActionSender().sendMessage("You need a knife for that.");
  133.                         return true;
  134.                 }
  135.                 if (rightData.getResult() == 1889)// making cake
  136.                 {
  137.                         if (!player.getInventory().getItemContainer().contains(2516) || !player.getInventory().getItemContainer().contains(1927) || !player.getInventory().getItemContainer().contains(1944)) {
  138.                                 return true;
  139.                         } else {
  140.                                 handleCake(player);
  141.                                 return true;
  142.                         }
  143.                 }
  144.                 if (rightData.getResult() == 7066) {
  145.                         player.getInventory().addItem(new Item(1923));
  146.                 }
  147.                 if (rightData.hasRecipient()) {
  148.                         player.getActionSender().sendMessage("You put the " + ItemDefinition.forId(rightData.getPrimaryIngredient()).getName().toLowerCase() + " into the " + ItemDefinition.forId(rightData.getRecipient()).getName().toLowerCase() + " and make a " + ItemDefinition.forId(rightData.getResult()).getName().toLowerCase() + ".");
  149.                 } else {
  150.                         player.getActionSender().sendMessage("You mix the " + ItemDefinition.forId(rightData.getPrimaryIngredient()).getName().toLowerCase() + " with the " + ItemDefinition.forId(rightData.getRecipient()).getName().toLowerCase() + " and make a " + ItemDefinition.forId(rightData.getResult()).getName().toLowerCase() + ".");
  151.                 }
  152.                 if (rightData.getResult() != 1889) {
  153.                         player.getInventory().removeItem(new Item(rightData.getPrimaryIngredient(), amount));
  154.                 }
  155.                 player.getInventory().removeItem(new Item(rightData.getRecipient()));
  156.                 player.getInventory().addItemToSlot(new Item(rightData.getResult()), itemUsed == rightData.getRecipient() ? itemUsedSlot : withItemSlot);
  157.                 player.getSkill().addExp(Skill.COOKING, rightData.getExperience());
  158.                 /* empty recipients */
  159.                 if (rightData.getEmptyOne() != 0) {
  160.                         player.getInventory().addItem(new Item(rightData.getEmptyOne()));
  161.                 }
  162.                 return true;
  163.         }
  164.  
  165.         public static void handleCake(Player player) {
  166.                 player.getInventory().removeItem(new Item(2516));
  167.                 player.getInventory().removeItem(new Item(1927));
  168.                 player.getInventory().removeItem(new Item(1944));
  169.                 player.getInventory().removeItem(new Item(1887));
  170.                 player.getInventory().addItem(new Item(3727));
  171.                 player.getInventory().addItem(new Item(1931));
  172.                 player.getInventory().addItem(new Item(1889));
  173.                 player.getActionSender().sendMessage("You mix the ingredients together and make a cake.");
  174.         }
  175. }

Reply to "sdsd"

Here you can reply to the paste above