mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-19 13:00:19 -07:00
Fixed world events + Added correct cooking burn rates + Fixed superheat spell
This commit is contained in:
parent
9ffc1bbdd4
commit
c88d45367d
5 changed files with 78 additions and 84 deletions
|
|
@ -7,98 +7,100 @@ import java.util.HashMap;
|
||||||
|
|
||||||
public enum CookableItems {
|
public enum CookableItems {
|
||||||
/** meats */
|
/** meats */
|
||||||
CHICKEN(2140,2138,2144,1,30,30),
|
CHICKEN(2140,2138,2144,1,30,30,128,512),
|
||||||
UGTHANKI(2140,2138,2144,1,40,40),
|
UGTHANKI(2140,2138,2144,1,40,40,128,512),
|
||||||
RABBIT(3228,3226,7222,1,30,30),
|
RABBIT(3228,3226,7222,1,30,30,128,512),
|
||||||
DARK_CRAB(14939, 14937, 14941, 90, 215, 100),
|
DARK_CRAB(14939, 14937, 14941, 90, 215, 100,0,150),
|
||||||
CRAB(7521, 7518, 7520,21, 100, 100),
|
CRAB(7521, 7518, 7520,21, 100, 100,85,438),
|
||||||
|
|
||||||
/** fish */
|
/** fish */
|
||||||
SHRIMP(315, 317, 7954,1, 45, 35),
|
SHRIMP(315, 317, 7954,1, 45, 35,128,512),
|
||||||
KARAMBWANJI(3151, 3150, 592,1, 10, 30),
|
KARAMBWANJI(3151, 3150, 592,1, 10, 30,128,512),
|
||||||
SARDINE(325, 327, 369,1, 40, 38),
|
SARDINE(325, 327, 369,1, 40, 38,118,492),
|
||||||
ANCHOVIES(319, 321, 323,1, 30, 34),
|
ANCHOVIES(319, 321, 323,1, 30, 34,128,512),
|
||||||
HERRING(347, 345, 357,5, 50, 41),
|
HERRING(347, 345, 357,5, 50, 41,108,472),
|
||||||
MACKEREL(355, 353, 357,10, 60, 45),
|
MACKEREL(355, 353, 357,10, 60, 45,98,452),
|
||||||
TROUT(333, 335, 343,15, 70, 50),
|
TROUT(333, 335, 343,15, 70, 50,88,432),
|
||||||
COD(339, 341, 343,18, 75, 52),
|
COD(339, 341, 343,18, 75, 52,74,420),
|
||||||
PIKE(351, 349, 343,20, 80, 53),
|
PIKE(351, 349, 343,20, 80, 53,78,412),
|
||||||
SALMON(329, 331, 343,25, 58, 90),
|
SALMON(329, 331, 343,25, 58, 90,68,392),
|
||||||
SLIMY_EEL(3381, 3379, 3383,28, 95, 58),
|
SLIMY_EEL(3381, 3379, 3383,28, 95, 58,72,406),
|
||||||
TUNA(361, 359, 367,30, 100, 64),
|
TUNA(361, 359, 367,30, 100, 64,58,372),
|
||||||
RAINBOW_FISH(10136, 10138, 10140,35, 110, 60),
|
RAINBOW_FISH(10136, 10138, 10140,35, 110, 60,48,387),
|
||||||
CAVE_EEL(5003, 5001, 5002,38, 115, 40),
|
CAVE_EEL(5003, 5001, 5002,38, 115, 40,42,386),
|
||||||
LOBSTER(379, 377, 381,40, 120, 74),
|
LOBSTER(379, 377, 381,40, 120, 74,38,332),
|
||||||
BASS(365, 363, 367,43, 130, 80),
|
BASS(365, 363, 367,43, 130, 80,28,312),
|
||||||
SWORDFISH(373, 371, 375,45, 140, 86),
|
SWORDFISH(373, 371, 375,45, 140, 86,18,292),
|
||||||
LAVA_EEL(2149, 2148, 3383,53, 30, 53),
|
LAVA_EEL(2149, 2148, 3383,53, 30, 53,12,282),
|
||||||
MONKFISH(7946, 7944, 7948,62, 150, 92),
|
MONKFISH(7946, 7944, 7948,62, 150, 92,11,275),
|
||||||
SHARK(385, 383, 387,80, 210, 100),
|
SHARK(385, 383, 387,80, 210, 100,0,202),
|
||||||
SEA_TURTLE(397, 395, 399,82, 212, 100),
|
SEA_TURTLE(397, 395, 399,82, 212, 100,0,202),
|
||||||
MANTA_RAY(391, 389, 393,91, 216, 100),
|
MANTA_RAY(391, 389, 393,91, 216, 100,0,202),
|
||||||
KARAMBWAN(3144, 3142, 3146,1, 80, 30),
|
KARAMBWAN(3144, 3142, 3146,1, 80, 30,70,255),
|
||||||
|
|
||||||
/** snails */
|
/** snails */
|
||||||
THIN_SNAIL(3369, 3363, 3375,12, 70, 70),
|
THIN_SNAIL(3369, 3363, 3375,12, 70, 70,109,502),
|
||||||
LEAN_SNAIL(3371, 3365, 3375,17, 80, 80),
|
LEAN_SNAIL(3371, 3365, 3375,17, 80, 80,100,486),
|
||||||
FAT_SNAIL(3373, 3367, 3375,22, 95, 95),
|
FAT_SNAIL(3373, 3367, 3375,22, 95, 95,95,456),
|
||||||
|
|
||||||
//Bread
|
//Bread
|
||||||
BREAD(2309, 2307, 2311,1,40,40),
|
BREAD(2309, 2307, 2311,1,40,40,118,492),
|
||||||
|
|
||||||
//Cake
|
//Cake
|
||||||
CAKE(1891, 1889, 1903, 40, 180, 95),
|
CAKE(1891, 1889, 1903, 40, 180, 95,38,332),
|
||||||
|
|
||||||
//Beef(s) (Rat, Bear, Cow, Yak)
|
//Beef(s) (Rat, Bear, Cow, Yak)
|
||||||
BEEF(2142,2132,2146,1,30,30),
|
BEEF(2142,2132,2146,1,30,30,128,512),
|
||||||
RAT_MEAT(2142,2134,2146,1,30,30),
|
RAT_MEAT(2142,2134,2146,1,30,30,128,512),
|
||||||
BEAR_MEAT(2142,2136,2146,1,30,30),
|
BEAR_MEAT(2142,2136,2146,1,30,30,128,512),
|
||||||
YAK_MEAT(2142,10816,2146,1,30,30),
|
YAK_MEAT(2142,10816,2146,1,30,30,128,512),
|
||||||
|
|
||||||
//Skewered foods
|
//Skewered foods
|
||||||
SKEWER_1(9988, 9986, 9990,21, 82, 82),
|
SKEWER_1(9988, 9986, 9990,21, 82, 82,108,496),
|
||||||
SKEWER_2(2878, 2876, 7226,30, 140, 140),
|
SKEWER_2(2878, 2876, 7226,30, 140, 140,85,476),
|
||||||
SKEWER_3(7568, 7566, 7570,41, 160, 140),
|
SKEWER_3(7568, 7566, 7570,41, 160, 140,75,456),
|
||||||
SKEWER_4(9980, 9984, 9982,11, 62, 62),
|
SKEWER_4(9980, 9984, 9982,11, 62, 62,115,502),
|
||||||
SKEWER_5(7223, 7224, 7222,16, 70, 62),
|
SKEWER_5(7223, 7224, 7222,16, 70, 62,113,499),
|
||||||
|
|
||||||
//Pies
|
//Pies
|
||||||
PIE_1(2325, 2321, 2329, 10, 78, 60),
|
PIE_1(2325, 2321, 2329, 10, 78, 60,78,412),
|
||||||
PIE_2(2327, 2319, 2329, 20, 110, 80),
|
PIE_2(2327, 2319, 2329, 20, 110, 80,78,412),
|
||||||
PIE_3(7170, 7169, 2329, 29,128,85),
|
PIE_3(7170, 7169, 2329, 29,128,85,78,412),
|
||||||
PIE_4(2323,2317,2329,30,130,85),
|
PIE_4(2323,2317,2329,30,130,85,78,412),
|
||||||
GARDEN_PIE(7178,7176,2329,34,138, 89),
|
GARDEN_PIE(7178,7176,2329,34,138, 89,78,412),
|
||||||
FISH_PIE(7188,7186,2329,47,164,110),
|
FISH_PIE(7188,7186,2329,47,164,110,78,412),
|
||||||
ADMIRAL_PIE(7198,7196,2329,70,210,140),
|
ADMIRAL_PIE(7198,7196,2329,70,210,140,78,412),
|
||||||
WILD_PIE(7208,7206,2329,85,240,140),
|
WILD_PIE(7208,7206,2329,85,240,140,78,412),
|
||||||
SUMMER_PIE(7218,7216,2329,95,260,160),
|
SUMMER_PIE(7218,7216,2329,95,260,160,78,412),
|
||||||
|
|
||||||
//Pizzas
|
//Pizzas
|
||||||
PIZZA_1(2289, 2287,2305, 35, 143, 86),
|
PIZZA_1(2289, 2287,2305, 35, 143, 86,48,352),
|
||||||
|
|
||||||
//Bowl foods
|
//Bowl foods
|
||||||
BOWL_1(2003, 2001, 2005,25, 117, 58),
|
BOWL_1(2003, 2001, 2005,25, 117, 58,68,392),
|
||||||
BOWL_2(4239, 4237, 4239,20, 52, 1),
|
BOWL_2(4239, 4237, 4239,20, 52, 1,68,392),
|
||||||
BOWL_3(7078, 7076, 7090,13, 50, 60),
|
BOWL_3(7078, 7076, 7090,13, 50, 60,68,392),
|
||||||
BOWL_4(7084, 1871, 7092,43, 60, 70),
|
BOWL_4(7084, 1871, 7092,43, 60, 70,68,392),
|
||||||
BOWL_5(7082, 7080, 7094,57, 120, 80),
|
BOWL_5(7082, 7080, 7094,57, 120, 80,68,392),
|
||||||
|
|
||||||
//Miscellaneous
|
//Miscellaneous
|
||||||
RAW_OOMLIE(Items.RAW_OOMLIE_2337, 0, Items.BURNT_OOMLIE_2426, 50, 0, 999), // always burns
|
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, 110, 999);
|
OOMLIE_WRAP(Items.COOKED_OOMLIE_WRAP_2343, Items.WRAPPED_OOMLIE_2341, Items.BURNT_OOMLIE_WRAP_2345, 50, 110, 999,0,0);
|
||||||
|
|
||||||
public static HashMap<Integer,CookableItems>cookingMap = new HashMap<>();
|
public static HashMap<Integer,CookableItems>cookingMap = new HashMap<>();
|
||||||
public static HashMap<Integer, CookableItems>intentionalBurnMap = new HashMap<>();
|
public static HashMap<Integer, CookableItems>intentionalBurnMap = new HashMap<>();
|
||||||
public int raw,cooked,level,burnLevel,burnt;
|
public int raw,cooked,level,burnLevel,burnt;
|
||||||
double experience;
|
double experience;
|
||||||
CookableItems(int cooked, int raw, int burnt, int level, double experience, int burnLevel){
|
double low,high;
|
||||||
|
CookableItems(int cooked, int raw, int burnt, int level, double experience, int burnLevel, double low, double high){
|
||||||
this.raw = raw;
|
this.raw = raw;
|
||||||
this.cooked = cooked;
|
this.cooked = cooked;
|
||||||
this.burnt = burnt;
|
this.burnt = burnt;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.experience = experience;
|
this.experience = experience;
|
||||||
this.burnLevel = burnLevel;
|
this.burnLevel = burnLevel;
|
||||||
|
this.low = low;
|
||||||
|
this.high = high;
|
||||||
}
|
}
|
||||||
|
|
||||||
static{
|
static{
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,21 @@
|
||||||
package core.game.node.entity.skill.cooking;
|
package core.game.node.entity.skill.cooking;
|
||||||
|
|
||||||
import core.game.container.impl.EquipmentContainer;
|
import core.game.container.impl.EquipmentContainer;
|
||||||
import org.rs09.consts.Items;
|
|
||||||
import core.game.world.map.Location;
|
|
||||||
import core.game.content.quest.tutorials.tutorialisland.TutorialSession;
|
import core.game.content.quest.tutorials.tutorialisland.TutorialSession;
|
||||||
import core.game.content.quest.tutorials.tutorialisland.TutorialStage;
|
import core.game.content.quest.tutorials.tutorialisland.TutorialStage;
|
||||||
import core.game.node.entity.skill.Skills;
|
|
||||||
import core.game.node.entity.impl.Animator;
|
import core.game.node.entity.impl.Animator;
|
||||||
import core.game.node.entity.player.Player;
|
import core.game.node.entity.player.Player;
|
||||||
import core.game.node.entity.player.link.audio.Audio;
|
import core.game.node.entity.player.link.audio.Audio;
|
||||||
import core.game.node.entity.player.link.diary.DiaryType;
|
import core.game.node.entity.player.link.diary.DiaryType;
|
||||||
|
import core.game.node.entity.skill.Skills;
|
||||||
import core.game.node.item.GroundItemManager;
|
import core.game.node.item.GroundItemManager;
|
||||||
import core.game.node.item.Item;
|
import core.game.node.item.Item;
|
||||||
import core.game.node.object.GameObject;
|
import core.game.node.object.GameObject;
|
||||||
import core.game.system.task.Pulse;
|
import core.game.system.task.Pulse;
|
||||||
|
import core.game.world.map.Location;
|
||||||
import core.game.world.update.flag.context.Animation;
|
import core.game.world.update.flag.context.Animation;
|
||||||
import core.tools.RandomFunction;
|
import core.tools.RandomFunction;
|
||||||
|
import org.rs09.consts.Items;
|
||||||
import static core.tools.RandomFunction.RANDOM;
|
|
||||||
|
|
||||||
public class StandardCookingPulse extends Pulse {
|
public class StandardCookingPulse extends Pulse {
|
||||||
//range animation
|
//range animation
|
||||||
|
|
@ -118,21 +116,19 @@ public class StandardCookingPulse extends Pulse {
|
||||||
public boolean isBurned(final Player player, final GameObject object, int food) {
|
public boolean isBurned(final Player player, final GameObject object, int food) {
|
||||||
boolean hasGauntlets = player.getEquipment().containsItem(new Item(Items.COOKING_GAUNTLETS_775));
|
boolean hasGauntlets = player.getEquipment().containsItem(new Item(Items.COOKING_GAUNTLETS_775));
|
||||||
double burn_stop = (double) CookableItems.getBurnLevel(food);
|
double burn_stop = (double) CookableItems.getBurnLevel(food);
|
||||||
|
CookableItems item = CookableItems.forId(food);
|
||||||
if (hasGauntlets && (food == Items.RAW_SWORDFISH_371 || food == Items.RAW_LOBSTER_377 || food == Items.RAW_SHARK_383)) {
|
if (hasGauntlets && (food == Items.RAW_SWORDFISH_371 || food == Items.RAW_LOBSTER_377 || food == Items.RAW_SHARK_383)) {
|
||||||
burn_stop -= 6;
|
burn_stop -= 6;
|
||||||
}
|
}
|
||||||
if (player.getSkills().getLevel(Skills.COOKING) > burn_stop) {
|
if (player.getSkills().getLevel(Skills.COOKING) > burn_stop) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
double burn_chance = 60.0 + (object.getName().equals("fire") ? 1.00 : 0) - (object.getId() == 114 ? 1.00 : 0);
|
int cook_level = player.getSkills().getLevel(Skills.COOKING);
|
||||||
double cook_level = (double) player.getSkills().getLevel(Skills.COOKING);
|
double host_ratio = RandomFunction.randomDouble(100.0);
|
||||||
double lev_needed = (double) CookableItems.forId(food).level;
|
double low = item.low + (object.getName().contains("fire") ? 0 : (0.1 * item.low));
|
||||||
double multi_a = (burn_stop - lev_needed);
|
double high = item.high + (object.getName().contains("fire") ? 0 : (0.1 * item.high));
|
||||||
double burn_dec = (burn_chance / multi_a);
|
double client_ratio = RandomFunction.getSkillSuccessChance(low,high,cook_level);
|
||||||
double multi_b = (cook_level - lev_needed);
|
return host_ratio > client_ratio;
|
||||||
burn_chance -= (multi_b * burn_dec);
|
|
||||||
double randNum = RANDOM.nextDouble() * 100.0;
|
|
||||||
return !(burn_chance <= randNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean cook(final Player player, final GameObject object, final boolean burned, final int initial, final int product) {
|
public boolean cook(final Player player, final GameObject object, final boolean burned, final int initial, final int product) {
|
||||||
|
|
|
||||||
|
|
@ -65,15 +65,12 @@ public final class SuperheatSpell extends MagicSpell {
|
||||||
player.sendMessage("You need a Smithing level of at least " + bar.getLevel() + " to do this.");
|
player.sendMessage("You need a Smithing level of at least " + bar.getLevel() + " to do this.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean hasOres = true;
|
|
||||||
for (Item items : bar.getOres()) {
|
for (Item items : bar.getOres()) {
|
||||||
if (!player.getInventory().contains(items.getId(), item.getAmount())) {
|
if (!player.getInventory().contains(items.getId(), items.getAmount())) {
|
||||||
player.getPacketDispatch().sendMessage("You do not have the required ores to make this bar.");
|
player.getPacketDispatch().sendMessage("You do not have the required ores to make this bar.");
|
||||||
hasOres = false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!hasOres) return false;
|
|
||||||
if (!super.meetsRequirements(entity, true, true)) {
|
if (!super.meetsRequirements(entity, true, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package rs09.game.content.ame.events
|
package rs09.game.content.ame.events
|
||||||
|
|
||||||
import core.game.component.Component
|
import core.game.component.Component
|
||||||
import core.plugin.Initializable
|
|
||||||
import org.rs09.consts.NPCs
|
import org.rs09.consts.NPCs
|
||||||
import rs09.game.interaction.InteractionListener
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
|
@ -10,7 +9,7 @@ class SandwichLadyHandler : InteractionListener(){
|
||||||
val SANDWICH_LADY = NPCs.SANDWICH_LADY_3117
|
val SANDWICH_LADY = NPCs.SANDWICH_LADY_3117
|
||||||
override fun defineListeners() {
|
override fun defineListeners() {
|
||||||
|
|
||||||
on(NPC,SANDWICH_LADY,"talk-to"){player, node ->
|
on(SANDWICH_LADY,NPC,"talk-to"){player, node ->
|
||||||
if(player.antiMacroHandler?.hasEvent()!! && player.antiMacroHandler.event.name == "Sandwich Lady") {
|
if(player.antiMacroHandler?.hasEvent()!! && player.antiMacroHandler.event.name == "Sandwich Lady") {
|
||||||
player.interfaceManager?.open(Component(297))
|
player.interfaceManager?.open(Component(297))
|
||||||
node.asNpc().clear()
|
node.asNpc().clear()
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ class WorldEventInitializer : Plugin<Any>{
|
||||||
* a list. It also prevents unnecessary plugins from being loaded if an event isn't currently active.
|
* a list. It also prevents unnecessary plugins from being loaded if an event isn't currently active.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
val result = ClassGraph().enableClassInfo().whitelistPackages("core.game.content.global.worldevents").scan()
|
val result = ClassGraph().enableClassInfo().whitelistPackages("rs09.game.content.global.worldevents").scan()
|
||||||
result.getSubclasses("core.game.content.global.worldevents.WorldEvent").forEach(Consumer { p: ClassInfo ->
|
result.getSubclasses("rs09.game.content.global.worldevents.WorldEvent").forEach(Consumer { p: ClassInfo ->
|
||||||
val c = p.loadClass().newInstance() as WorldEvent
|
val c = p.loadClass().newInstance() as WorldEvent
|
||||||
if(c.checkActive()) c.initialize().also { WorldEvents.add(c) }
|
if(c.checkActive()) c.initialize().also { WorldEvents.add(c) }
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue