package plugin.quests.cooksassistant import com.rs2.event.EventContext import com.rs2.event.EventSubscriber import com.rs2.event.SubscribesTo import com.rs2.event.impl.ItemOnObjectEvent import com.rs2.game.content.StaticNpcList.COOK import com.rs2.game.content.StaticObjectList.COOKING_RANGE import com.rs2.game.content.quests.QuestAssistant import com.rs2.game.content.skills.cooking.Cooking import com.rs2.game.players.Player @SubscribesTo(ItemOnObjectEvent::class) class CooksRangePlugin : EventSubscriber { override fun test(event: ItemOnObjectEvent) = event.gameObject == COOKING_RANGE override fun subscribe(context: EventContext, player: Player, event: ItemOnObjectEvent) { val stage = player.pluginData.getInt(CooksAssistantConstants.PLUGIN_ID, QuestAssistant.STAGE_KEY, CooksAssistantConstants.STAGE_NOT_STARTED) if (stage < CooksAssistantConstants.STAGE_COMPLETE) { player.talkingNpc = COOK val dialogue = player.dialogueFactory dialogue.clear() dialogue.sendNpcChat(COOK, "Hey! Who said you could use that?") .sendStatement("You need to complete Cook's Assistant before using the Cook's range.") .execute() return } Cooking.startCooking(player, event.item, event.gameObject) } }