Untitled

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

Reply to "Untitled"

Here you can reply to the paste above