Can now make sinew from both beef and bear

Sinew no longer hangs
This commit is contained in:
bushtail 2022-03-20 23:30:06 +00:00 committed by Ryan
parent 6c3cee0b82
commit 4d72ebef6f
2 changed files with 53 additions and 13 deletions

View file

@ -1,17 +1,22 @@
package core.game.node.entity.skill.cooking package core.game.node.entity.skill.cooking
import api.*
import core.game.node.scenery.Scenery import core.game.node.scenery.Scenery
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.item.Item import core.game.node.item.Item
import org.rs09.consts.Items import org.rs09.consts.Items
import org.rs09.consts.Items.BREAD_DOUGH_2307 import org.rs09.consts.Items.BREAD_DOUGH_2307
import org.rs09.consts.Items.RAW_BEAR_MEAT_2136
import org.rs09.consts.Items.RAW_BEEF_2132 import org.rs09.consts.Items.RAW_BEEF_2132
import org.rs09.consts.Items.SEAWEED_401 import org.rs09.consts.Items.SEAWEED_401
import org.rs09.consts.Items.UNCOOKED_CAKE_1889 import org.rs09.consts.Items.UNCOOKED_CAKE_1889
import rs09.game.interaction.InteractionListener import rs09.game.interaction.InteractionListener
import rs09.game.node.entity.skill.cooking.CookingDialogue import rs09.game.node.entity.skill.cooking.CookingDialogue
//author: Ceik /**
* @author Ceikry
* @author bushtail - added bear meat for sinew making
*/
class CookingRewrite : InteractionListener() { class CookingRewrite : InteractionListener() {
val RAW_FOODS: IntArray val RAW_FOODS: IntArray
@ -20,6 +25,7 @@ class CookingRewrite : InteractionListener() {
val list = CookableItems.values().map { it.raw }.toMutableList() val list = CookableItems.values().map { it.raw }.toMutableList()
list.add(Items.COOKED_MEAT_2142) list.add(Items.COOKED_MEAT_2142)
list.add(RAW_BEEF_2132) list.add(RAW_BEEF_2132)
list.add(RAW_BEAR_MEAT_2136)
list.add(SEAWEED_401) list.add(SEAWEED_401)
RAW_FOODS = list.toIntArray() RAW_FOODS = list.toIntArray()
} }
@ -31,8 +37,8 @@ class CookingRewrite : InteractionListener() {
val obj = with.asScenery() val obj = with.asScenery()
val range = obj.name.toLowerCase().contains("range") val range = obj.name.toLowerCase().contains("range")
when (item.id) { when (item.id) {
RAW_BEEF_2132 -> if (range) { RAW_BEEF_2132, RAW_BEAR_MEAT_2136 -> if (range) {
player.dialogueInterpreter.open(CookingDialogue(item.id,9436,true,obj)) player.dialogueInterpreter.open(CookingDialogue(item.id,9436,true,obj,item.id))
return@onUseWith true return@onUseWith true
} }
BREAD_DOUGH_2307, UNCOOKED_CAKE_1889 -> if (!range) { BREAD_DOUGH_2307, UNCOOKED_CAKE_1889 -> if (!range) {

View file

@ -3,20 +3,28 @@ package rs09.game.node.entity.skill.cooking
import api.* import api.*
import core.cache.def.impl.ItemDefinition import core.cache.def.impl.ItemDefinition
import core.game.node.scenery.Scenery import core.game.node.scenery.Scenery
import core.game.node.entity.player.link.RunScript
import core.game.node.entity.skill.cooking.CookableItems import core.game.node.entity.skill.cooking.CookableItems
import core.game.node.entity.skill.cooking.CookingRewrite.Companion.cook import core.game.node.entity.skill.cooking.CookingRewrite.Companion.cook
import core.game.node.item.Item
import core.net.packet.PacketRepository import core.net.packet.PacketRepository
import core.net.packet.context.ChildPositionContext import core.net.packet.context.ChildPositionContext
import core.net.packet.out.RepositionChild import core.net.packet.out.RepositionChild
import org.rs09.consts.Items
import rs09.game.content.dialogue.DialogueFile import rs09.game.content.dialogue.DialogueFile
import rs09.game.content.dialogue.SkillDialogueHandler
import rs09.tools.START_DIALOGUE import rs09.tools.START_DIALOGUE
/**
* @author Ceikry
* @author bushtail - fixing it up
*/
class CookingDialogue(vararg val args: Any) : DialogueFile(){ class CookingDialogue(vararg val args: Any) : DialogueFile(){
var initial = 0 var initial = 0
var product = 0 var product = 0
var `object`: Scenery? = null var `object`: Scenery? = null
var sinew = false var sinew = false
var itemid = 0
override fun handle(componentID: Int, buttonID: Int) { override fun handle(componentID: Int, buttonID: Int) {
when(stage){ when(stage){
START_DIALOGUE -> { START_DIALOGUE -> {
@ -30,14 +38,14 @@ class CookingDialogue(vararg val args: Any) : DialogueFile(){
} }
`object` = args.get(1) as Scenery `object` = args.get(1) as Scenery
} }
4 -> { 5 -> {
initial = args.get(0) as Int initial = args.get(0) as Int
product = args.get(1) as Int product = args.get(1) as Int
sinew = args.get(2) as Boolean sinew = args.get(2) as Boolean
`object` = args.get(3) as Scenery `object` = args.get(3) as Scenery
itemid = args.get(4) as Int
if (sinew) { if (sinew) {
player!!.dialogueInterpreter.sendOptions( options(
"Select one",
"Dry the meat into sinew", "Dry the meat into sinew",
"Cook the meat" "Cook the meat"
) )
@ -54,9 +62,16 @@ class CookingDialogue(vararg val args: Any) : DialogueFile(){
val amount = getAmount(buttonID) val amount = getAmount(buttonID)
when (amount) { when (amount) {
-1 -> { -1 -> {
sendInputDialogue(player!!, true, "Enter the amount:"){value -> val handler: SkillDialogueHandler =
cook(player!!, `object`, initial, product, value as Int) object : SkillDialogueHandler(player!!, SkillDialogue.ONE_OPTION, Item(product)) {
} override fun create(amount: Int, index: Int) {
cook(player, `object`, initial, product, amount)
}
override fun getAll(index: Int) : Int {
return getAmount(amountInInventory(player, initial))
}
}
handler.open()
} }
else -> { else -> {
end() end()
@ -67,10 +82,29 @@ class CookingDialogue(vararg val args: Any) : DialogueFile(){
100 -> { 100 -> {
when (buttonID) { when (buttonID) {
1 -> cook(player!!, `object`, initial, product, 1) 1 -> {
val handler: SkillDialogueHandler =
object : SkillDialogueHandler(player!!, SkillDialogue.ONE_OPTION, Item(Items.SINEW_9436)) {
override fun create(amount: Int, index: Int) {
cook(player, `object`, initial, Items.SINEW_9436, amount)
}
override fun getAll(index: Int) : Int {
return getAmount(amountInInventory(player, initial))
}
}
handler.open()
}
2 -> { 2 -> {
product = CookableItems.forId(initial).cooked val handler: SkillDialogueHandler =
display() object : SkillDialogueHandler(player!!, SkillDialogue.ONE_OPTION, Item(CookableItems.forId(itemid).cooked)) {
override fun create(amount: Int, index: Int) {
cook(player, `object`, initial, CookableItems.forId(itemid).cooked, amount)
}
override fun getAll(index: Int) : Int {
return getAmount(amountInInventory(player, itemid))
}
}
handler.open()
} }
} }
} }