Authenticity improvement for cooking burn rates
This commit is contained in:
@@ -6,148 +6,164 @@ import core.game.node.item.Item;
|
||||
import java.util.HashMap;
|
||||
|
||||
public enum CookableItems {
|
||||
/** meats */
|
||||
CHICKEN(2140,2138,2144,1,30,34,128,512),
|
||||
UGTHANKI(2140,2138,2144,1,40,100,0,512),
|
||||
RABBIT(3228,3226,7222,1,30,34,128,512),
|
||||
CRAB(7521, 7518, 7520,21, 100, 62,85,438),
|
||||
|
||||
/** fish */
|
||||
CRAYFISH(13433, 13435, 13437,1, 30, 34,128,512),
|
||||
SHRIMP(315, 317, 7954,1, 30, 34,128,512),
|
||||
KARAMBWANJI(3151, 3150, 592,1, 10, 28,128,512),
|
||||
SARDINE(325, 327, 369,1, 40, 38,118,492),
|
||||
ANCHOVIES(319, 321, 323,1, 30, 34,128,512),
|
||||
HERRING(347, 345, 357,5, 50, 41,108,472),
|
||||
MACKEREL(355, 353, 357,10, 60, 45,98,452),
|
||||
TROUT(333, 335, 343,15, 70, 50,88,432),
|
||||
COD(339, 341, 343,18, 75, 52,74,420),
|
||||
PIKE(351, 349, 343,20, 80, 53,78,412),
|
||||
SALMON(329, 331, 343,25, 90, 58,68,392),
|
||||
SLIMY_EEL(3381, 3379, 3383,28, 95, 58,72,406),
|
||||
TUNA(361, 359, 367,30, 100, 65,58,372),
|
||||
RAINBOW_FISH(10136, 10138, 10140,35, 110, 60,48,387),
|
||||
CAVE_EEL(5003, 5001, 5002,38, 115, 74,42,386),
|
||||
LOBSTER(379, 377, 381,40, 120, 74,38,332),
|
||||
BASS(365, 363, 367,43, 130, 79,28,312),
|
||||
SWORDFISH(373, 371, 375,45, 140, 86,18,292),
|
||||
LAVA_EEL(2149, 2148, 3383,53, 30, 53,12,282),
|
||||
MONKFISH(7946, 7944, 7948,62, 150, 92,11,275),
|
||||
SHARK(385, 383, 387,80, 210, 100,0,202),
|
||||
SEA_TURTLE(397, 395, 399,82, 212, 100,0,202),
|
||||
MANTA_RAY(391, 389, 393,91, 216, 100,0,202),
|
||||
KARAMBWAN(3144, 3142, 3146,30, 190, 100,0,255),
|
||||
|
||||
/** snails */
|
||||
THIN_SNAIL(3369, 3363, 3375,12, 70, 47,109,502),
|
||||
LEAN_SNAIL(3371, 3365, 3375,17, 80, 50,100,486),
|
||||
FAT_SNAIL(3373, 3367, 3375,22, 95, 56,95,456),
|
||||
|
||||
//Bread
|
||||
BREAD(2309, 2307, 2311,1,40,37,118,492),
|
||||
|
||||
//Cake
|
||||
CAKE(1891, 1889, 1903, 40, 180, 74,38,332),
|
||||
|
||||
//Beef(s) (Rat, Bear, Cow, Yak)
|
||||
BEEF(2142,2132,2146,1,30,34,128,512),
|
||||
RAT_MEAT(2142,2134,2146,1,30,34,128,512),
|
||||
BEAR_MEAT(2142,2136,2146,1,30,34,128,512),
|
||||
YAK_MEAT(2142,10816,2146,1,30,34,128,512),
|
||||
|
||||
//Skewered foods
|
||||
SKEWER_ROAST_BEAST(9988, 9986, 9990,21, 99, 82,108,496),
|
||||
SKEWER_CHOMPY(2878, 2876, 7226,30, 140, 99,85,476),
|
||||
SKEWER_JUBBLY(7568, 7566, 7570,41, 160, 140,75,456),
|
||||
SKEWER_ROAST_BIRD(9980, 9984, 9982,11, 62, 99,115,502),
|
||||
SKEWER_ROAST_RABBIT(7223, 7224, 7222,16, 72, 99,113,499),
|
||||
|
||||
//Pies
|
||||
PIE_REDBERRY(2325, 2321, 2329, 10, 78, 50,78,412),
|
||||
PIE_MEAT(2327, 2319, 2329, 20, 110, 53,78,412),
|
||||
PIE_MUD(7170, 7168, 2329, 29,128,63,78,412),
|
||||
PIE_APPLE(2323,2317,2329,30,130,63,78,412),
|
||||
GARDEN_PIE(7178,7176,2329,34,138, 68,78,412),
|
||||
FISH_PIE(7188,7186,2329,47,164,74,78,412),
|
||||
ADMIRAL_PIE(7198,7196,2329,70,210,94,78,412),
|
||||
WILD_PIE(7208,7206,2329,85,240,140,78,412),
|
||||
SUMMER_PIE(7218,7216,2329,95,260,160,78,412),
|
||||
|
||||
//Pizzas
|
||||
PIZZA_PLAIN(2289, 2287,2305, 35, 143, 68,48,352),
|
||||
|
||||
//Bowl foods
|
||||
BOWL_STEW(2003, 2001, 2005,25, 117, 58,68,392),
|
||||
BOWL_NETTLE(4239, 4237, 4239,20, 52, 1,68,392),
|
||||
BOWL_EGG(7078, 7076, 7090,13, 50, 48,68,392),
|
||||
BOWL_ONION(7084, 1871, 7092,43, 60, 77,68,392),
|
||||
BOWL_MUSHROOM(7082, 7080, 7094,46, 60, 90,68,392),
|
||||
|
||||
/* Vegetables */
|
||||
BAKED_POTATO(6701, 1942, 6699, 7, 15, 41, 108, 472),
|
||||
SWEETCORN(5988, 5986, 5990, 28, 104, 54, 90, 424),
|
||||
|
||||
//Miscellaneous
|
||||
RAW_OOMLIE(Items.RAW_OOMLIE_2337, 0, Items.BURNT_OOMLIE_2426, 50, 0, 999,0,0), // always burns
|
||||
OOMLIE_WRAP(Items.COOKED_OOMLIE_WRAP_2343, Items.WRAPPED_OOMLIE_2341, Items.BURNT_OOMLIE_WRAP_2345, 50, 30, 40,112,476),
|
||||
SEAWEED(Items.SEAWEED_401,0,Items.SODA_ASH_1781,0,0,999,0,0),
|
||||
/**
|
||||
* Sinew gets overridden by BEEF in this enum, due to values being looked up by the items RAW id.
|
||||
* This gets corrected in {@link SinewCookingPulse}
|
||||
*/
|
||||
SINEW(Items.SINEW_9436,Items.RAW_BEEF_2132,Items.SINEW_9436,0,3,0,0,0);
|
||||
|
||||
public final static HashMap<Integer,CookableItems>cookingMap = new HashMap<>();
|
||||
public final static HashMap<Integer, CookableItems>intentionalBurnMap = new HashMap<>();
|
||||
public final int raw,cooked,level,burnLevel,burnt;
|
||||
public final double experience;
|
||||
double low,high;
|
||||
CookableItems(int cooked, int raw, int burnt, int level, double experience, int burnLevel, double low, double high){
|
||||
this.raw = raw;
|
||||
this.cooked = cooked;
|
||||
this.burnt = burnt;
|
||||
this.level = level;
|
||||
this.experience = experience;
|
||||
this.burnLevel = burnLevel;
|
||||
this.low = low;
|
||||
this.high = high;
|
||||
}
|
||||
|
||||
static{
|
||||
CookableItems[] cookableItems = values();
|
||||
int cookableItemsLength = cookableItems.length;
|
||||
for(int x = 0; x < cookableItemsLength; x++){
|
||||
CookableItems item = cookableItems[x];
|
||||
cookingMap.putIfAbsent(item.raw,item);
|
||||
intentionalBurnMap.putIfAbsent(item.cooked,item);
|
||||
}
|
||||
}
|
||||
|
||||
public static CookableItems forId(int id){
|
||||
return cookingMap.get(id);
|
||||
}
|
||||
|
||||
public static Item getCooked(int id){
|
||||
return new Item(cookingMap.get(id).cooked);
|
||||
}
|
||||
|
||||
public static Item getBurnt(int id){
|
||||
return new Item(cookingMap.get(id).burnt);
|
||||
}
|
||||
|
||||
public static Item getRaw(int id){
|
||||
return new Item(cookingMap.get(id).raw);
|
||||
}
|
||||
|
||||
public static boolean intentionalBurn(int id){
|
||||
return (intentionalBurnMap.get(id) != null);
|
||||
}
|
||||
|
||||
public static Item getIntentionalBurn(int id){
|
||||
return new Item(intentionalBurnMap.get(id).burnt);
|
||||
}
|
||||
|
||||
public static int getBurnLevel(int id){
|
||||
return cookingMap.get(id).burnLevel;
|
||||
}
|
||||
// meats
|
||||
CHICKEN(2140, 2138, 2144, 1, 30, 128, 512, 128, 512),
|
||||
UGTHANKI(2140, 2138, 2144, 1, 40, 40, 252, 30, 253),
|
||||
RABBIT(3228, 3226, 7222, 1, 30, 128, 512, 128, 512),
|
||||
CRAB(7521, 7518, 7520, 21, 100, 57, 377, 57, 377),
|
||||
|
||||
// fish
|
||||
CRAYFISH(13433, 13435, 13437, 1, 30, 128, 512, 128, 512),
|
||||
SHRIMP(315, 317, 7954, 1, 30, 128, 512, 128, 512),
|
||||
KARAMBWANJI(3151, 3150, 592, 1, 10, 200, 400, 200, 400),
|
||||
SARDINE(325, 327, 369, 1, 40, 118, 492, 118, 492),
|
||||
ANCHOVIES(319, 321, 323, 1, 30, 128, 512, 128, 512),
|
||||
HERRING(347, 345, 357, 5, 50, 108, 472, 108, 472),
|
||||
MACKEREL(355, 353, 357, 10, 60, 98, 452, 98, 452),
|
||||
TROUT(333, 335, 343, 15, 70, 88, 432, 88, 432),
|
||||
COD(339, 341, 343, 18, 75, 83, 422, 88, 432),
|
||||
PIKE(351, 349, 343, 20, 80, 78, 412, 78, 412),
|
||||
SALMON(329, 331, 343, 25, 90, 68, 392, 68, 392),
|
||||
SLIMY_EEL(3381, 3379, 3383, 28, 95, 63, 382, 63, 382),
|
||||
TUNA(361, 359, 367, 30, 100, 58, 372, 58, 372),
|
||||
RAINBOW_FISH(10136, 10138, 10140, 35, 110, 56, 370, 56, 370),
|
||||
CAVE_EEL(5003, 5001, 5002, 38, 115, 38, 332, 38, 332),
|
||||
LOBSTER(379, 377, 381, 40, 120, 38, 332, 38, 332),
|
||||
BASS(365, 363, 367, 43, 130, 33, 312, 33, 312),
|
||||
SWORDFISH(373, 371, 375, 45, 140, 18, 292, 30, 310),
|
||||
LAVA_EEL(2149, 2148, 3383, 53, 30, 256, 256, 256, 256), // never burn
|
||||
MONKFISH(7946, 7944, 7948, 62, 150, 11, 275, 13, 280),
|
||||
SHARK(385, 383, 387, 80, 210, 1, 202, 1, 232),
|
||||
SEA_TURTLE(397, 395, 399, 82, 212, 1, 202, 1, 222),
|
||||
MANTA_RAY(391, 389, 393, 91, 216, 1, 202, 1, 222),
|
||||
KARAMBWAN(3144, 3142, 3146, 30, 190, 70, 255, 70, 255),
|
||||
|
||||
// snails
|
||||
THIN_SNAIL(3369, 3363, 3375, 12, 70, 93, 444, 93, 444),
|
||||
LEAN_SNAIL(3371, 3365, 3375, 17, 80, 85, 428, 93, 444),
|
||||
FAT_SNAIL(3373, 3367, 3375, 22, 95, 73, 402, 73, 402),
|
||||
|
||||
// bread
|
||||
BREAD(2309, 2307, 2311, 1, 40, 0, 0, 118, 492),
|
||||
|
||||
// cake
|
||||
CAKE(1891, 1889, 1903, 40, 180, 0, 0, 38, 332),
|
||||
|
||||
// beef(s) (rat, bear, cow, yak)
|
||||
BEEF(2142, 2132, 2146, 1, 30, 128, 512, 128, 512),
|
||||
RAT_MEAT(2142, 2134, 2146, 1, 30, 128, 512, 128, 512),
|
||||
BEAR_MEAT(2142, 2136, 2146, 1, 30, 128, 512, 128, 512),
|
||||
YAK_MEAT(2142, 10816, 2146, 1, 30, 128, 512, 128, 512),
|
||||
|
||||
// skewered foods
|
||||
SKEWER_ROAST_BEAST(9988, 9986, 9990, 21, 99, 180, 255, 180, 255),
|
||||
SKEWER_CHOMPY(2878, 2876, 7226, 30, 140, 200, 255, 200, 255),
|
||||
SKEWER_JUBBLY(7568, 7566, 7570, 41, 160, 195, 250, 195, 250), // Can burn at 99 cooking. Ballpark low/high.
|
||||
SKEWER_ROAST_BIRD(9980, 9984, 9982, 11, 62, 155, 255, 155, 255),
|
||||
SKEWER_ROAST_RABBIT(7223, 7224, 7222, 16, 72, 160, 255, 160, 255),
|
||||
|
||||
// pies
|
||||
REDBERRY_PIE(2325, 2321, 2329, 10, 78, 0, 0, 98, 452),
|
||||
MEAT_PIE(2327, 2319, 2329, 20, 110, 0, 0, 78, 412),
|
||||
MUD_PIE(7170, 7168, 2329, 29, 128, 0, 0, 58, 372),
|
||||
APPLE_PIE(2323, 2317, 2329, 30, 130, 0, 0, 58, 372),
|
||||
GARDEN_PIE(7178, 7176, 2329, 34, 138, 0, 0, 48, 352),
|
||||
FISH_PIE(7188, 7186, 2329, 47, 164, 0, 0, 38, 332),
|
||||
ADMIRAL_PIE(7198, 7196, 2329, 70, 210, 0, 0, 15, 270),
|
||||
WILD_PIE(7208, 7206, 2329, 85, 240, 0, 0, 1, 222),
|
||||
SUMMER_PIE(7218, 7216, 2329, 95, 260, 0, 0, 1, 212),
|
||||
|
||||
// pizzas
|
||||
PIZZA_PLAIN(2289, 2287, 2305, 35, 143, 0, 0, 48, 352),
|
||||
|
||||
// bowl foods
|
||||
BOWL_STEW(2003, 2001, 2005, 25, 117, 68, 392, 68, 392),
|
||||
BOWL_NETTLE(4239, 4237, 4239, 20, 52, 78, 412, 78, 412),
|
||||
BOWL_EGG(7078, 7076, 7090, 13, 50, 0, 0, 90, 438),
|
||||
BOWL_ONION(7084, 1871, 7092, 43, 60, 36, 322, 36, 322),
|
||||
BOWL_MUSHROOM(7082, 7080, 7094, 46, 60, 16, 282, 16, 282),
|
||||
|
||||
// vegetables
|
||||
BAKED_POTATO(6701, 1942, 6699, 7, 15, 0, 0, 108, 472),
|
||||
SWEETCORN(5988, 5986, 5990, 28, 104, 78, 412, 78, 412),
|
||||
|
||||
// miscellaneous
|
||||
RAW_OOMLIE(Items.RAW_OOMLIE_2337, 0, Items.BURNT_OOMLIE_2426, 50, 0, 0, 0, 0, 0), // always burns
|
||||
OOMLIE_WRAP(Items.COOKED_OOMLIE_WRAP_2343, Items.WRAPPED_OOMLIE_2341, Items.BURNT_OOMLIE_WRAP_2345, 50, 30, 106, 450, 112, 476),
|
||||
SEAWEED(Items.SEAWEED_401, 0, Items.SODA_ASH_1781, 0, 0, 0, 0, 0, 0),
|
||||
|
||||
/**
|
||||
* Sinew gets overridden by BEEF in this enum, due to values being looked up by the items RAW id.
|
||||
* This gets corrected in {@link SinewCookingPulse}
|
||||
*/
|
||||
SINEW(Items.SINEW_9436, Items.RAW_BEEF_2132, Items.SINEW_9436, 0, 3, 0, 0, 0, 0);
|
||||
|
||||
public final static HashMap<Integer, CookableItems> cookingMap = new HashMap<>();
|
||||
public final static HashMap<Integer, CookableItems> intentionalBurnMap = new HashMap<>();
|
||||
public final static HashMap<Integer, int[]> gauntletValues = new HashMap<>();
|
||||
public final static HashMap<Integer, int[]> lumbridgeRangeValues = new HashMap<>();
|
||||
public final int cooked, raw, burnt, level, low, high, lowRange, highRange;
|
||||
public final double experience;
|
||||
|
||||
CookableItems(int cooked, int raw, int burnt, int level, double experience, int low, int high, int lowRange, int highRange) {
|
||||
this.cooked = cooked;
|
||||
this.raw = raw;
|
||||
this.burnt = burnt;
|
||||
this.level = level;
|
||||
this.experience = experience;
|
||||
this.low = low;
|
||||
this.high = high;
|
||||
this.lowRange = lowRange;
|
||||
this.highRange = highRange;
|
||||
}
|
||||
|
||||
static {
|
||||
for (CookableItems item : values()) {
|
||||
cookingMap.putIfAbsent(item.raw, item);
|
||||
intentionalBurnMap.putIfAbsent(item.cooked, item);
|
||||
}
|
||||
|
||||
gauntletValues.put(Items.RAW_LOBSTER_377, new int[]{55, 368});
|
||||
gauntletValues.put(Items.RAW_SWORDFISH_371, new int[]{30, 310});
|
||||
gauntletValues.put(Items.RAW_MONKFISH_7944, new int[]{24, 290});
|
||||
gauntletValues.put(Items.RAW_SHARK_383, new int[]{15, 270});
|
||||
|
||||
lumbridgeRangeValues.put(Items.BREAD_DOUGH_2307, new int[]{128, 512});
|
||||
lumbridgeRangeValues.put(Items.RAW_BEEF_2132, new int[]{138, 532});
|
||||
lumbridgeRangeValues.put(Items.RAW_RAT_MEAT_2134, new int[]{138, 532});
|
||||
lumbridgeRangeValues.put(Items.RAW_BEAR_MEAT_2136, new int[]{138, 532});
|
||||
lumbridgeRangeValues.put(Items.RAW_YAK_MEAT_10816, new int[]{138, 532});
|
||||
lumbridgeRangeValues.put(Items.RAW_CHICKEN_2138, new int[]{138, 532});
|
||||
lumbridgeRangeValues.put(Items.RAW_SHRIMPS_317, new int[]{138, 532});
|
||||
lumbridgeRangeValues.put(Items.RAW_ANCHOVIES_321, new int[]{138, 532});
|
||||
lumbridgeRangeValues.put(Items.RAW_SARDINE_327, new int[]{128, 512});
|
||||
lumbridgeRangeValues.put(Items.RAW_HERRING_345, new int[]{118, 492});
|
||||
lumbridgeRangeValues.put(Items.RAW_MACKEREL_353, new int[]{108, 472});
|
||||
lumbridgeRangeValues.put(Items.UNCOOKED_BERRY_PIE_2321, new int[]{108, 462});
|
||||
lumbridgeRangeValues.put(Items.THIN_SNAIL_3363, new int[]{103, 464});
|
||||
lumbridgeRangeValues.put(Items.RAW_TROUT_335, new int[]{98, 452});
|
||||
lumbridgeRangeValues.put(Items.LEAN_SNAIL_3365, new int[]{95, 448});
|
||||
lumbridgeRangeValues.put(Items.RAW_COD_341, new int[]{93, 442});
|
||||
lumbridgeRangeValues.put(Items.RAW_PIKE_349, new int[]{88, 432});
|
||||
lumbridgeRangeValues.put(Items.UNCOOKED_MEAT_PIE_2319, new int[]{88, 432});
|
||||
lumbridgeRangeValues.put(Items.FAT_SNAIL_3367, new int[]{83, 422});
|
||||
lumbridgeRangeValues.put(Items.UNCOOKED_STEW_2001, new int[]{78, 412});
|
||||
lumbridgeRangeValues.put(Items.RAW_SALMON_331, new int[]{78, 402});
|
||||
}
|
||||
|
||||
public static CookableItems forId(int id) {
|
||||
return cookingMap.get(id);
|
||||
}
|
||||
|
||||
public static Item getBurnt(int id) {
|
||||
return new Item(cookingMap.get(id).burnt);
|
||||
}
|
||||
|
||||
public static boolean intentionalBurn(int id) {
|
||||
return (intentionalBurnMap.get(id) != null);
|
||||
}
|
||||
|
||||
public static Item getIntentionalBurn(int id) {
|
||||
return new Item(intentionalBurnMap.get(id).burnt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
package core.game.node.entity.skill.cooking;
|
||||
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import org.crandor.game.content.global.consumable.Consumables;
|
||||
import org.crandor.game.content.global.consumable.Food;
|
||||
import core.game.node.entity.skill.cooking.CookableItems;
|
||||
import core.game.node.entity.skill.cooking.CookingPulse;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.link.RunScript;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.node.object.GameObject;
|
||||
import org.crandor.net.packet.PacketRepository;
|
||||
import org.crandor.net.packet.context.ChildPositionContext;
|
||||
import org.crandor.net.packet.out.RepositionChild;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the dialogue used to handle the amount to make of a cookable item.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*//*
|
||||
|
||||
@InitializablePlugin
|
||||
public final class CookingDialoguePlugin extends DialoguePlugin {
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the cooking dialogue id.
|
||||
*//*
|
||||
|
||||
public static final int DIALOGUE_ID = 43989;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the sinew item.
|
||||
*//*
|
||||
|
||||
private static final Item SINEW = new Item(9436);
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the meat item.
|
||||
*//*
|
||||
|
||||
private static final Item MEAT = new Item(2142);
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the food we're cooking.
|
||||
*//*
|
||||
|
||||
private int food;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the obejct we're cooking on.
|
||||
*//*
|
||||
|
||||
private GameObject object;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingDialoguePlugin} {@code Object}.
|
||||
*//*
|
||||
|
||||
public CookingDialoguePlugin() {
|
||||
*/
|
||||
/**
|
||||
* empty.
|
||||
*//*
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingDialoguePlugin} {@code Object}.
|
||||
* @param player the player.
|
||||
*//*
|
||||
|
||||
public CookingDialoguePlugin(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new CookingDialoguePlugin(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
food = ((int) args[0]);
|
||||
object = ((GameObject) args[1]);
|
||||
if (args.length == 3) {
|
||||
interpreter.sendOptions("Select an Option", "Dry the meat into sinew.", "Cook the meat.");
|
||||
stage = 100;
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().getAmount(CookableItems.forId(food).raw) == 1) {
|
||||
end();
|
||||
cook(player,object,food,1);
|
||||
return true;
|
||||
}
|
||||
display();
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
end();
|
||||
int amount = getAmount(buttonId);
|
||||
if (amount == -1) {
|
||||
player.setAttribute("runscript", new RunScript() {
|
||||
@Override
|
||||
public boolean handle() {
|
||||
int amount = (int) value;
|
||||
cook(player, object, food, amount);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
player.getDialogueInterpreter().sendInput(false, "Enter the amount:");
|
||||
} else if (amount == 28) {
|
||||
player.setAttribute("runscript", new RunScript() {
|
||||
@Override
|
||||
public boolean handle() {
|
||||
cook(player, object, food, amount);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
cook(player, object, food, amount);
|
||||
break;
|
||||
*/
|
||||
/*case 100:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
food = Consumables.forFood(SINEW);
|
||||
display();
|
||||
break;
|
||||
case 2:
|
||||
food = Consumables.forFood(MEAT);
|
||||
display();
|
||||
break;
|
||||
}
|
||||
break;*//*
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DIALOGUE_ID };
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Method used to display the content food.
|
||||
*//*
|
||||
|
||||
public void display() {
|
||||
player.getInterfaceManager().openChatbox(307);
|
||||
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 307, 3, 60, 79));
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(CookableItems.getRaw(food).getId(), 160, 307, 2);
|
||||
player.getPacketDispatch().sendString(CookableItems.getRaw(food).getName(), 307, 3);
|
||||
stage = 0;
|
||||
}
|
||||
|
||||
public void cook(Player player, GameObject object, int food, int amount){
|
||||
player.getPulseManager().run(new CookingPulse(player,object,food,amount));
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Method used to get the amount to make based off the button id.
|
||||
* @param buttonId the button id.
|
||||
* @return the amount to make.
|
||||
*//*
|
||||
|
||||
private final int getAmount(final int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 5:
|
||||
return 1;
|
||||
case 4:
|
||||
return 5;
|
||||
case 3:
|
||||
return -1;
|
||||
case 2:
|
||||
return 28;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -1,263 +0,0 @@
|
||||
/*
|
||||
package core.game.node.entity.skill.cooking;
|
||||
|
||||
import org.crandor.cache.def.impl.ItemDefinition;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import org.crandor.game.content.global.consumable.Consumables;
|
||||
import org.crandor.game.content.global.consumable.Food;
|
||||
import core.game.node.entity.skill.cooking.CookableItems;
|
||||
import core.game.node.entity.skill.cooking.CookingPulse;
|
||||
import org.crandor.game.interaction.NodeUsageEvent;
|
||||
import org.crandor.game.interaction.UseWithHandler;
|
||||
import org.crandor.game.node.Node;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.link.RunScript;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.node.object.GameObject;
|
||||
import org.crandor.game.world.map.Direction;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.net.packet.PacketRepository;
|
||||
import org.crandor.net.packet.context.ChildPositionContext;
|
||||
import org.crandor.net.packet.out.RepositionChild;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.plugin.Plugin;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Handles the interaction of a raw food (or if intentionally burning cooked food)
|
||||
* with a range/fire.
|
||||
* @author ceik
|
||||
*//*
|
||||
|
||||
@InitializablePlugin
|
||||
public class CookingPlugin extends UseWithHandler {
|
||||
|
||||
public static int DIALOGUE_ID = 43989;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the objects allowed to cook {@code Food} on.
|
||||
*//*
|
||||
|
||||
public static final int[] OBJECTS = new int[] { 21302, 13528, 13529, 13533, 13531, 13536, 13539, 13542, 2728, 2729, 2730, 2731, 2732, 2859, 3038, 3039, 3769, 3775, 4265, 4266, 5249, 5499, 5631, 5632, 5981, 9682, 10433, 11404, 11405, 11406, 12102, 12796, 13337, 13881, 14169, 14919, 15156, 20000, 20001, 21620, 21792, 22713, 22714, 23046, 24283, 24284, 25155, 25156, 25465, 25730, 27297, 29139, 30017, 32099, 33500, 34495, 34546, 36973, 37597, 37629, 37726, 114, 4172, 5275, 8750, 16893, 22154, 34410, 34565, 114, 9085, 9086, 9087, 12269, 15398, 25440, 25441, 2724, 2725, 2726, 4618, 4650, 5165, 6093, 6094, 6095, 6096, 8712, 9439, 9440, 9441, 10824, 17640, 17641, 17642, 17643, 18039, 21795, 24285, 24329, 27251, 33498, 35449, 36815, 36816, 37426, 40110 };
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingPlugin} {@code Object}.
|
||||
*//*
|
||||
|
||||
public CookingPlugin() {
|
||||
super(2140, 1861, 3228, 7521, 3151, 325, 319, 347, 355, 333, 339, 351, 329, 3381, 361, 10136, 5003, 379, 365, 373, 2149, 7946, 385, 397, 391, 3369, 3371, 3373, 1893, 1895, 1897, 1899, 1901, 1963, 2102, 2120, 2108, 5972, 5504, 1982, 1965, 1957, 5988, 1781, 6701, 6703, 6705, 7056, 7058, 7060, 1933, 1783, 1927, 1929, 6032, 6034, 2011, 227, 1921, 1937, 7934, 7086, 4239, 7068, 7086, 2003, 7078, 7072, 4239, 7062, 7064, 7084, 1871, 7082, 2309, 1891, 1967, 1971, 2142, 9436, 2142, 2142, 2325, 2333, 2327, 2331, 7170, 2323, 2335, 7178, 7180, 7188, 7190, 7198, 7200, 7208, 7210, 7218, 7220, 2289, 2291, 2293, 2295, 2297, 2299, 2301, 2303, 315, 9988, 2878, 7568, 9980, 7223, 5982, 598, 4293, 10816, 2138, 2134, 3142, 2136, 1859, 3226, 7518, 3150, 327, 321, 345, 353, 335, 341, 349, 331, 3379, 359, 10138, 5001, 377, 363, 371, 2148, 7944, 383, 395, 389, 3363, 3365, 3367, 5986, 401, 1942, 4237, 2001, 7076, 1871, 7080, 2307, 1889, 2132, 2132, 2132, 2132, 2321, 2319, 7168, 2317, 7176, 7186, 7196, 7206, 7216, 2287, 317, 9986, 2876, 7566, 9984, 7224);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
new CookingDialoguePlugin().init();
|
||||
for (int object : OBJECTS) {
|
||||
addHandler(object, OBJECT_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final GameObject object = (GameObject) event.getUsedWith();
|
||||
final int food = event.getUsedItem().getId();
|
||||
//handles intentional burning (deprecates BurnMeatPlugin)
|
||||
if(CookableItems.intentionalBurn(food)){
|
||||
event.getPlayer().getPulseManager().run(new CookingPulse(event.getPlayer(),object,event.getUsedItem().getId(),true));
|
||||
return true;
|
||||
}
|
||||
event.getPlayer().getDialogueInterpreter().open(DIALOGUE_ID, food, event.getUsedWith());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getDestination(final Player player, final Node node) {
|
||||
if (node.getName().toLowerCase().equals("fire")) {
|
||||
return player.getLocation().getY() > node.getLocation().getY() ? node.getLocation().transform(0, 1, 0) : player.getLocation().getX() < node.getLocation().getX() ? node.getLocation().transform(-1, 0, 0) : player.getLocation().getX() > node.getLocation().getX() ? node.getLocation().transform(1, 0, 0) : node.getLocation().transform(0, -1, 0);
|
||||
} else {
|
||||
Direction direction = node.getDirection();
|
||||
if (direction == Direction.NORTH) {
|
||||
return node.getLocation().transform(1, 1, 0);
|
||||
} else if (direction == Direction.SOUTH) {
|
||||
return node.getLocation().transform(-1, 0, 0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final class CookingDialoguePlugin extends DialoguePlugin {
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the sinew item.
|
||||
*//*
|
||||
|
||||
private final Item SINEW = new Item(9436);
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the meat item.
|
||||
*//*
|
||||
|
||||
private final Item MEAT = new Item(2142);
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the food we're cooking.
|
||||
*//*
|
||||
|
||||
private int food;
|
||||
|
||||
private int product;
|
||||
|
||||
private boolean nonFood = false;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the obejct we're cooking on.
|
||||
*//*
|
||||
|
||||
private GameObject object;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingDialoguePlugin} {@code Object}.
|
||||
*//*
|
||||
|
||||
public CookingDialoguePlugin() {
|
||||
*/
|
||||
/**
|
||||
* empty.
|
||||
*//*
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingDialoguePlugin} {@code Object}.
|
||||
* @param player the player.
|
||||
*//*
|
||||
|
||||
public CookingDialoguePlugin(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new CookingDialoguePlugin(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
food = ((int) args[0]);
|
||||
if (args.length == 3){
|
||||
nonFood = true;
|
||||
stage = 0;
|
||||
product = (int)args[1];
|
||||
display();
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().getAmount(CookableItems.forId(food).raw) == 1) {
|
||||
end();
|
||||
cook(player,object,food,1);
|
||||
return true;
|
||||
}
|
||||
display();
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
end();
|
||||
int amount = getAmount(buttonId);
|
||||
if (amount == -1) {
|
||||
player.setAttribute("runscript", new RunScript() {
|
||||
@Override
|
||||
public boolean handle() {
|
||||
int amount = (int) value;
|
||||
if(nonFood){
|
||||
cookNonFood(player,food,product,amount);
|
||||
return false;
|
||||
}
|
||||
cook(player, object, food, amount);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
player.getDialogueInterpreter().sendInput(false, "Enter the amount:");
|
||||
} else if (amount == 28) {
|
||||
player.setAttribute("runscript", new RunScript() {
|
||||
@Override
|
||||
public boolean handle() {
|
||||
if(nonFood){
|
||||
cookNonFood(player,food,product,amount);
|
||||
}
|
||||
cook(player, object, food, amount);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if(nonFood){
|
||||
cookNonFood(player,food,product,amount);
|
||||
break;
|
||||
}
|
||||
cook(player, object, food, amount);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DIALOGUE_ID };
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Method used to display the content food.
|
||||
*//*
|
||||
|
||||
public void display() {
|
||||
player.getInterfaceManager().openChatbox(307);
|
||||
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 307, 3, 60, 79));
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(nonFood ? product : CookableItems.getCooked(food).getId(), 160, 307, 2);
|
||||
player.getPacketDispatch().sendString(nonFood ? ItemDefinition.forId(product).getName() : CookableItems.getCooked(food).getName(), 307, 3);
|
||||
stage = 0;
|
||||
}
|
||||
|
||||
public void cookNonFood(Player player, int food, int product, int amount){
|
||||
player.getPulseManager().run(new CookingPulse(player,food,amount,product,false));
|
||||
}
|
||||
|
||||
public void cook(Player player, GameObject object, int food, int amount){
|
||||
player.getPulseManager().run(new CookingPulse(player,object,food,amount));
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Method used to get the amount to make based off the button id.
|
||||
* @param buttonId the button id.
|
||||
* @return the amount to make.
|
||||
*//*
|
||||
|
||||
private final int getAmount(final int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 5:
|
||||
return 1;
|
||||
case 4:
|
||||
return 5;
|
||||
case 3:
|
||||
return -1;
|
||||
case 2:
|
||||
return 28;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,244 +0,0 @@
|
||||
/*
|
||||
package core.game.node.entity.skill.cooking;
|
||||
|
||||
import org.crandor.game.content.global.SkillcapePerks;
|
||||
import plugin.tutorial.TutorialSession;
|
||||
import plugin.tutorial.TutorialStage;
|
||||
import core.game.node.entity.skill.SkillPulse;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import org.crandor.game.node.entity.impl.Animator;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.link.audio.Audio;
|
||||
import org.crandor.game.node.entity.player.link.diary.DiaryType;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.node.object.GameObject;
|
||||
import org.crandor.game.system.task.Pulse;
|
||||
import org.crandor.game.world.update.flag.context.Animation;
|
||||
|
||||
import static org.crandor.tools.RandomFunction.RANDOM;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Pulse for cooking
|
||||
* @author ceik
|
||||
*//*
|
||||
|
||||
public final class CookingPulse extends Pulse {
|
||||
private static Player player;
|
||||
|
||||
private static GameObject node;
|
||||
|
||||
private static boolean intentionalBurn = false;
|
||||
|
||||
//range animation
|
||||
private static final Animation RANGE_ANIMATION = new Animation(883, Animator.Priority.HIGH);
|
||||
|
||||
//fire animation
|
||||
private static final Animation FIRE_ANIMATION = new Animation(897, Animator.Priority.HIGH);
|
||||
|
||||
//Cooking sound
|
||||
public static final Audio SOUND = new Audio(2393, 1, 1);
|
||||
|
||||
//food's ID
|
||||
private final int food;
|
||||
|
||||
//amount to cook
|
||||
private int amount;
|
||||
|
||||
//whether or not we are cooking food
|
||||
private boolean isFood = true;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingPulse} {@code Object}.
|
||||
* @param player the player.
|
||||
* @param node the object node (fire/range)
|
||||
* @param food the food to cook.
|
||||
* @param amount the amount to cook
|
||||
*//*
|
||||
|
||||
public CookingPulse(Player player, GameObject node, final int food, final int amount) {
|
||||
this.player = player;
|
||||
this.node = node;
|
||||
this.food = food;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Another constructor for the Cooking Pulse, this time flags it as an intentional burn
|
||||
* @param player the player cooking
|
||||
* @param node the object being used to cook (range/fire)
|
||||
* @param food the item being cooked
|
||||
* @param intentionalBurn whether or not it's an intentional burn
|
||||
*//*
|
||||
|
||||
public CookingPulse(Player player, GameObject node, final int food, final boolean intentionalBurn) {
|
||||
this.player = player;
|
||||
this.food = food;
|
||||
this.amount = 1;
|
||||
this.intentionalBurn = intentionalBurn;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* handler for cooking non-food items
|
||||
* @param player the player cooking
|
||||
* @param item the item being cooked
|
||||
* @param amount the amount the player has
|
||||
* @param isFood whether we are cooking food
|
||||
*//*
|
||||
|
||||
public CookingPulse(Player player, final int item, int amount, int product, final boolean isFood){
|
||||
this.player = player;
|
||||
this.food = item;
|
||||
this.amount = amount;
|
||||
this.isFood = isFood;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (intentionalBurn || checkRequirements()) {
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if(intentionallyBurn(food) || !checkRequirements()){
|
||||
return true;
|
||||
}
|
||||
return reward();
|
||||
}
|
||||
|
||||
public boolean checkRequirements() { //check if the player has the requirements
|
||||
if (!node.isActive()) {
|
||||
return true;
|
||||
}
|
||||
//handle cook's assistant range
|
||||
if(node.getId() == 114 && !player.getQuestRepository().isComplete("Cook's Assistant")){
|
||||
player.getPacketDispatch().sendMessage("You need to have completed the Cook's Assistant quest in order to use that range.");
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < CookableItems.forId(food).level) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a cooking level of " + CookableItems.forId(food).level + " to cook this.");
|
||||
return false;
|
||||
}
|
||||
int inventoryAmount = player.getInventory().getAmount(CookableItems.forId(food).raw);
|
||||
if (amount > inventoryAmount) {
|
||||
amount = inventoryAmount;
|
||||
}
|
||||
if (amount < 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void animate() {
|
||||
player.animate(getAnimation(node));
|
||||
}
|
||||
|
||||
public boolean reward() {
|
||||
if (getDelay() == 1) {
|
||||
setDelay(node.getName().toLowerCase().equals("range") ? 5 : 4);
|
||||
return false;
|
||||
}
|
||||
//handle tutorial stuff
|
||||
if(!TutorialSession.getExtension(player).finished()){
|
||||
updateTutorial(player);
|
||||
amount --;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cook(player,node,isBurned(player,node,food),food)) {
|
||||
amount--;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return amount < 1;
|
||||
}
|
||||
|
||||
public boolean cook(final Player player, final GameObject object, final boolean burned, final int food) {
|
||||
Item item = CookableItems.getRaw(food);
|
||||
if(intentionalBurn){ //stops the cook function from being ran if we burning on purpose
|
||||
return false;
|
||||
}
|
||||
//lumbridge diary
|
||||
if (CookableItems.forId(food) != null && player.getInventory().remove(item)) {
|
||||
if (!burned) {
|
||||
player.getInventory().add(CookableItems.getCooked(food));
|
||||
} else {
|
||||
player.getInventory().add(CookableItems.getBurnt(food));
|
||||
}
|
||||
player.getSkills().addExperience(Skills.COOKING, burned ? 0 : CookableItems.forId(food).experience, true);
|
||||
player.getPacketDispatch().sendMessage(getMessage(item, burned));
|
||||
player.getAudioManager().send(SOUND);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean intentionallyBurn(int food){
|
||||
if(intentionalBurn && player.getInventory().remove(new Item(food))){ //only runs if it's flagged as intentional burning
|
||||
player.getInventory().add(CookableItems.getIntentionalBurn(food));
|
||||
player.getPacketDispatch().sendMessage("You deliberately burn the perfectly good piece of meat.");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessage(Item food, boolean burned){
|
||||
if(!burned) {
|
||||
return "You manage to cook some " + food.getName().replace("Raw ", "");
|
||||
} else {
|
||||
return "You accidentally burn some " + food.getName().replace("Raw ","");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBurned(final Player player, final GameObject object, int food) {
|
||||
double burn_stop = (double)CookableItems.getBurnLevel(food);
|
||||
if (SkillcapePerks.hasSkillcapePerk(player, SkillcapePerks.COOKING)) {
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.COOKING) > burn_stop) {
|
||||
return false;
|
||||
}
|
||||
double burn_chance = 60.0 + (object.getName().equals("fire") ? 1.00 : 0) - (object.getId() == 114 ? 1.00 : 0);
|
||||
double cook_level = (double) player.getSkills().getLevel(Skills.COOKING);
|
||||
double lev_needed = (double) CookableItems.forId(food).level;
|
||||
double multi_a = (burn_stop - lev_needed);
|
||||
double burn_dec = (burn_chance / multi_a);
|
||||
double multi_b = (cook_level - lev_needed);
|
||||
burn_chance -= (multi_b * burn_dec);
|
||||
double randNum = RANDOM.nextDouble() * 100.0;
|
||||
return !(burn_chance <= randNum);
|
||||
}
|
||||
|
||||
public boolean updateTutorial(Player player){
|
||||
if (TutorialSession.getExtension(player).getStage() == 14) {
|
||||
TutorialStage.load(player, 15, false);
|
||||
return cook(player, node,true, food);
|
||||
} else if (TutorialSession.getExtension(player).getStage() == 15) {
|
||||
TutorialStage.load(player, 16, false);
|
||||
return cook(player, node, false, food);
|
||||
}
|
||||
if (TutorialSession.getExtension(player).getStage() == 20) {
|
||||
TutorialStage.load(player, 21, false);
|
||||
return cook(player, node, false, food);
|
||||
}
|
||||
return cook(player, node, isBurned(player,node,food),food);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Gets the animation to use based on the interacting object.
|
||||
* @param object the object.
|
||||
* @return the animation.
|
||||
*//*
|
||||
|
||||
private final Animation getAnimation(final GameObject object) {
|
||||
return !object.getName().toLowerCase().equals("fire") ? RANGE_ANIMATION : FIRE_ANIMATION;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -23,6 +23,8 @@ public class StandardCookingPulse extends Pulse {
|
||||
|
||||
//Cooking sound
|
||||
public static final Audio SOUND = new Audio(2577, 1, 1);
|
||||
|
||||
private static final int LUMBRIDGE_RANGE = 114;
|
||||
|
||||
private final int initial;
|
||||
private final int product;
|
||||
@@ -46,7 +48,7 @@ public class StandardCookingPulse extends Pulse {
|
||||
properties = CookableItems.forId(initial);
|
||||
if (checkRequirements()) {
|
||||
super.start();
|
||||
cook(player, object, CookableItems.cookingMap.get(initial) != null && isBurned(player, object, initial), initial, product);
|
||||
cook(player, object, properties != null && burned, initial, product);
|
||||
amount--;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +69,7 @@ public class StandardCookingPulse extends Pulse {
|
||||
this.experience = 0;
|
||||
if (properties != null) {
|
||||
// Handle Cook's Assistant range
|
||||
if (object.getId() == 114 && !player.getQuestRepository().isComplete("Cook's Assistant")) {
|
||||
if (object.getId() == LUMBRIDGE_RANGE && !player.getQuestRepository().isComplete("Cook's Assistant")) {
|
||||
player.getPacketDispatch().sendMessage("You need to have completed the Cook's Assistant quest in order to use that range.");
|
||||
return false;
|
||||
}
|
||||
@@ -90,7 +92,7 @@ public class StandardCookingPulse extends Pulse {
|
||||
|
||||
public boolean reward() {
|
||||
if (getDelay() == 1) {
|
||||
int delay = object.getName().toLowerCase().equals("range") ? 5 : 4;
|
||||
int delay = object.getName().toLowerCase().contains("range") ? 5 : 4;
|
||||
if(SkillcapePerks.isActive(SkillcapePerks.HASTY_COOKING, player)) {
|
||||
delay -= 1;
|
||||
}
|
||||
@@ -105,28 +107,30 @@ public class StandardCookingPulse extends Pulse {
|
||||
}
|
||||
return amount < 1;
|
||||
}
|
||||
|
||||
|
||||
public boolean isBurned(final Player player, final Scenery object, int food) {
|
||||
boolean hasGauntlets = player.getEquipment().containsItem(new Item(Items.COOKING_GAUNTLETS_775));
|
||||
double burn_stop = (double) CookableItems.getBurnLevel(food);
|
||||
int effectiveCookingLevel = player.getSkills().getLevel(Skills.COOKING);
|
||||
if(SkillcapePerks.isActive(SkillcapePerks.HASTY_COOKING, player)) {
|
||||
if (SkillcapePerks.isActive(SkillcapePerks.HASTY_COOKING, player)) {
|
||||
effectiveCookingLevel -= 5;
|
||||
}
|
||||
int gauntlets_boost = 0;
|
||||
CookableItems item = CookableItems.forId(food);
|
||||
if (hasGauntlets && (food == Items.RAW_SWORDFISH_371 || food == Items.RAW_LOBSTER_377 || food == Items.RAW_MONKFISH_7944 || food == Items.RAW_SHARK_383)) {
|
||||
burn_stop -= 6;
|
||||
gauntlets_boost += 6;
|
||||
int low, high;
|
||||
if (hasGauntlets && CookableItems.gauntletValues.containsKey(food)) {
|
||||
int[] successValues = CookableItems.gauntletValues.get(food);
|
||||
low = successValues[0];
|
||||
high = successValues[1];
|
||||
} else if (object.getId() == LUMBRIDGE_RANGE) {
|
||||
int[] successValues = CookableItems.lumbridgeRangeValues.getOrDefault(food, new int[]{item.lowRange, item.highRange});
|
||||
low = successValues[0];
|
||||
high = successValues[1];
|
||||
} else {
|
||||
boolean isFire = object.getName().toLowerCase().contains("fire");
|
||||
low = isFire ? item.low : item.lowRange;
|
||||
high = isFire ? item.high : item.highRange;
|
||||
}
|
||||
if (effectiveCookingLevel >= burn_stop) {
|
||||
return false;
|
||||
}
|
||||
int cook_level = effectiveCookingLevel + gauntlets_boost;
|
||||
double host_ratio = RandomFunction.randomDouble(100.0);
|
||||
double low = item.low + (object.getName().contains("fire") ? 0 : (0.1 * item.low));
|
||||
double high = item.high + (object.getName().contains("fire") ? 0 : (0.1 * item.high));
|
||||
double client_ratio = RandomFunction.getSkillSuccessChance(low,high,cook_level);
|
||||
double client_ratio = RandomFunction.getSkillSuccessChance(low, high, effectiveCookingLevel);
|
||||
return host_ratio > client_ratio;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user