Fixed numerous interfaces, including Puro puro, Destroy item, Equipment, kept on death, Cooking (single prompts i.e. raw fish -> range), Fletching (make set i.e. fletching arrows, bow)
Rewrote herb cleaning to listener Fixed studded leather crafting level requirement and xp Fixed bow stringing stealing strings ::quest <player> can now be used to look up a player's completed quests
This commit is contained in:
@@ -3,7 +3,6 @@ package content.global.skill.cooking
|
||||
import core.api.*
|
||||
import core.cache.def.impl.ItemDefinition
|
||||
import core.game.node.scenery.Scenery
|
||||
import content.global.skill.cooking.CookableItems
|
||||
import content.global.skill.cooking.CookingRewrite.Companion.cook
|
||||
import core.net.packet.PacketRepository
|
||||
import core.net.packet.context.ChildPositionContext
|
||||
@@ -15,6 +14,7 @@ import core.tools.START_DIALOGUE
|
||||
/**
|
||||
* @author Ceikry
|
||||
* @author bushtail - fixing it up
|
||||
* @auther Woah - for more fixing up
|
||||
*/
|
||||
|
||||
class CookingDialogue(vararg val args: Any) : DialogueFile(){
|
||||
@@ -47,7 +47,7 @@ class CookingDialogue(vararg val args: Any) : DialogueFile(){
|
||||
"Dry the meat into sinew",
|
||||
"Cook the meat"
|
||||
)
|
||||
stage = 100
|
||||
stage = if (amountInInventory(player!!, initial) > 1) 100 else 101
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class CookingDialogue(vararg val args: Any) : DialogueFile(){
|
||||
when (buttonID) {
|
||||
1 -> {
|
||||
product = Items.SINEW_9436
|
||||
display(Items.COOKED_MEAT_2142)
|
||||
display()
|
||||
}
|
||||
2 -> {
|
||||
product = CookableItems.forId(initial).cooked
|
||||
@@ -86,6 +86,19 @@ class CookingDialogue(vararg val args: Any) : DialogueFile(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
101 -> {
|
||||
when (buttonID) {
|
||||
1 -> {
|
||||
end()
|
||||
cook(player!!, `object`, initial, Items.SINEW_9436, 1)
|
||||
}
|
||||
2 -> {
|
||||
end()
|
||||
cook(player!!, `object`, initial, CookableItems.forId(initial).cooked, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,12 +112,23 @@ class CookingDialogue(vararg val args: Any) : DialogueFile(){
|
||||
return -1
|
||||
}
|
||||
|
||||
fun display(vararg args : Int) {
|
||||
fun display() {
|
||||
player!!.packetDispatch.sendItemZoomOnInterface(initial, 160, 307, 2)
|
||||
player!!.packetDispatch.sendString("<br><br><br><br>${ItemDefinition.forId(initial).name}", 307, 6)
|
||||
|
||||
// Re-format this interface because it is not formatted properly for the chat-box
|
||||
// Swords
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 0, 12, 15))
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 1, 431, 15))
|
||||
// "How many would you like to cook?"
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 7, 0, 12))
|
||||
// Right click context menu boxes
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 3, 58, 27))
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 4, 58, 27))
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 5, 58, 27))
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 6, 58, 27))
|
||||
|
||||
player!!.interfaceManager.openChatbox(307)
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 3, 60, 90))
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 2, 208, 20))
|
||||
player!!.packetDispatch.sendItemZoomOnInterface(if(args.size == 1) args[0] else product, 160, 307, 2)
|
||||
player!!.packetDispatch.sendString(ItemDefinition.forId(product).name, 307, 3)
|
||||
stage = 1
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package content.global.skill.cooking
|
||||
|
||||
import core.api.amountInInventory
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.node.entity.player.Player
|
||||
@@ -15,6 +16,7 @@ import org.rs09.consts.Items.UNCOOKED_CAKE_1889
|
||||
/**
|
||||
* @author Ceikry
|
||||
* @author bushtail - added bear meat for sinew making
|
||||
* @author Woah - added single food cooking
|
||||
*/
|
||||
class CookingRewrite : InteractionListener {
|
||||
|
||||
@@ -47,7 +49,17 @@ class CookingRewrite : InteractionListener {
|
||||
}
|
||||
|
||||
//cook a standard item
|
||||
player.dialogueInterpreter.open(CookingDialogue(item.id,obj))
|
||||
if (amountInInventory(player, item.id) > 1) {
|
||||
player.dialogueInterpreter.open(CookingDialogue(item.id,obj))
|
||||
} else {
|
||||
// Don't display dialogue if player only has *1* of the item
|
||||
val product = if (CookableItems.intentionalBurn(item.id)) { // checks intentional burning
|
||||
CookableItems.getIntentionalBurn(item.id).id
|
||||
} else {
|
||||
CookableItems.forId(item.id).cooked
|
||||
}
|
||||
cook(player, obj, item.id, product, 1)
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class StuddedArmourPlugin extends UseWithHandler {
|
||||
* @version 1.0
|
||||
*/
|
||||
public enum StuddedArmour {
|
||||
CHAPS(new Item(1095), new Item(1097), 18, 27), BODY(new Item(1129), new Item(1133), 41, 40);
|
||||
CHAPS(new Item(1095), new Item(1097), 44, 42), BODY(new Item(1129), new Item(1133), 41, 40);
|
||||
|
||||
/**
|
||||
* Represents the unstudded item.
|
||||
|
||||
@@ -63,7 +63,7 @@ class FletchingListeners : InteractionListener {
|
||||
|
||||
onUseWith(IntType.ITEM,ARROW_SHAFT,*FEATHERS){ player, shaft, feather ->
|
||||
val handler: SkillDialogueHandler =
|
||||
object : SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, Item(FLETCHED_SHAFT)) {
|
||||
object : SkillDialogueHandler(player, SkillDialogue.MAKE_SET_ONE_OPTION, Item(FLETCHED_SHAFT)) {
|
||||
override fun create(amount: Int, index: Int) {
|
||||
player.pulseManager.run(HeadlessArrowPulse(player, shaft.asItem(), Item(feather.id), amount))
|
||||
}
|
||||
@@ -73,14 +73,13 @@ class FletchingListeners : InteractionListener {
|
||||
}
|
||||
}
|
||||
handler.open()
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, Components.SKILL_MULTI1_309, 2, 210, 10))
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
onUseWith(IntType.ITEM,FLETCHED_SHAFT,*UNFINISHED_ARROWS){ player, shaft, unfinished ->
|
||||
val head = Fletching.arrowHeadMap[unfinished.id] ?: return@onUseWith false
|
||||
val handler: SkillDialogueHandler =
|
||||
object : SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, head.getFinished()) {
|
||||
object : SkillDialogueHandler(player, SkillDialogue.MAKE_SET_ONE_OPTION, head.getFinished()) {
|
||||
override fun create(amount: Int, index: Int) {
|
||||
player.pulseManager.run(ArrowHeadPulse(player, shaft.asItem(), head, amount))
|
||||
}
|
||||
@@ -90,7 +89,6 @@ class FletchingListeners : InteractionListener {
|
||||
}
|
||||
}
|
||||
handler.open()
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, Components.SKILL_MULTI1_309, 2, 210, 10))
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class FletchingPlugin extends UseWithHandler {
|
||||
//handle darts
|
||||
if(Fletching.isDart(event.getUsedItem().getId())){
|
||||
final Fletching.Darts dart = Fletching.dartMap.get(event.getUsedItem().getId());
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, dart.getFinished()) {
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.MAKE_SET_ONE_OPTION, dart.getFinished()) {
|
||||
@Override
|
||||
public void create(final int amount, int index) {
|
||||
player.getPulseManager().run(new DartPulse(player, event.getUsedItem(), dart, amount));
|
||||
@@ -60,7 +60,6 @@ public class FletchingPlugin extends UseWithHandler {
|
||||
}
|
||||
};
|
||||
handler.open();
|
||||
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 309, 2, 230, 10));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -78,7 +77,7 @@ public class FletchingPlugin extends UseWithHandler {
|
||||
final boolean hasFeather = (featherId == 314 || (featherId >= 10087 && featherId <= 10091));
|
||||
|
||||
if (hasFeather) {
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, bolt.getFinished()) {
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.MAKE_SET_ONE_OPTION, bolt.getFinished()) {
|
||||
@Override
|
||||
public void create(final int amount, int index) {
|
||||
player.getPulseManager().run(new BoltPulse(player, event.getUsedItem(), bolt, new Item(featherId), amount));
|
||||
@@ -89,7 +88,6 @@ public class FletchingPlugin extends UseWithHandler {
|
||||
}
|
||||
};
|
||||
handler.open();
|
||||
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 309, 2, 210, 10));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -53,7 +53,7 @@ class GemBoltListener : InteractionListener {
|
||||
|
||||
|
||||
val handler: SkillDialogueHandler =
|
||||
object : SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, Item(bolt.product)) {
|
||||
object : SkillDialogueHandler(player, SkillDialogue.MAKE_SET_ONE_OPTION, Item(bolt.product)) {
|
||||
override fun create(amount: Int, index: Int) {
|
||||
player.pulseManager.run(GemBoltPulse(player, used as? Item, bolt, amount))
|
||||
}
|
||||
@@ -63,7 +63,6 @@ class GemBoltListener : InteractionListener {
|
||||
}
|
||||
}
|
||||
handler.open()
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 309, 2, 210, 10))
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package content.global.skill.fletching.items.bow;
|
||||
|
||||
import core.api.Container;
|
||||
import core.api.ContentAPIKt;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.world.map.zone.ZoneBorders;
|
||||
import core.game.node.entity.skill.SkillPulse;
|
||||
@@ -46,6 +48,9 @@ public class StringPulse extends SkillPulse<Item> {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a fletching level of " + bow.level + " to string this bow.");
|
||||
return false;
|
||||
}
|
||||
if (!player.getInventory().containsItem(new Item(bow.unfinished))) {
|
||||
return false;
|
||||
}
|
||||
if (!player.getInventory().containsItem(new Item(bow.string))) {
|
||||
player.getDialogueInterpreter().sendDialogue("You seem to have run out of bow strings.");
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package content.global.skill.herblore
|
||||
|
||||
import core.api.*
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Dirty herb cleaning listener
|
||||
* @author Woah
|
||||
*/
|
||||
class HerbCleanListener : InteractionListener {
|
||||
override fun defineListeners() {
|
||||
on(IntType.ITEM, "clean") { player, node ->
|
||||
lock(player, 1)
|
||||
if (!requireQuest(player, "Druidic Ritual", "before you can use Herblore.")) return@on true
|
||||
val herb: Herbs = Herbs.forItem(node as Item) ?: return@on true
|
||||
|
||||
if (getDynLevel(player, Skills.HERBLORE) < herb.level) {
|
||||
sendMessage(player, "You need level " + herb.level + " Herblore to clean the " + herb.product.name.replace("Clean", "Grimy") + ".")
|
||||
return@on true
|
||||
}
|
||||
|
||||
val exp = herb.experience
|
||||
replaceSlot(player, node.asItem().slot, herb.product, node.asItem())
|
||||
rewardXP(player, Skills.HERBLORE, exp)
|
||||
playAudio(player, 5153)
|
||||
sendMessage(player, "You clean the dirt from the " + herb.product.name.lowercase(Locale.getDefault()).replace("clean", "").trim { it <= ' ' } + " leaf.")
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.api.Container;
|
||||
import static core.api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents the cleaning of a dirty herb.
|
||||
* @author Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class HerbCleanPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.setOptionHandler("clean", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (!player.getQuestRepository().isComplete("Druidic Ritual")) {
|
||||
player.getPacketDispatch().sendMessage("You must complete the Druidic Ritual quest before you can use Herblore.");
|
||||
return true;
|
||||
}
|
||||
final Herbs herb = Herbs.forItem((Item) node);
|
||||
if (player.getSkills().getLevel(Skills.HERBLORE) < herb.getLevel()) {
|
||||
player.getPacketDispatch().sendMessage("You need level " + herb.getLevel() + " Herblore to clean the " + herb.getProduct().getName().replace("Clean", "Grimy") + ".");
|
||||
return true;
|
||||
}
|
||||
double exp = herb.getExperience();
|
||||
if (removeItem(player, node.asItem(), Container.INVENTORY)){
|
||||
player.getSkills().addExperience(Skills.HERBLORE, exp, true);
|
||||
addItem(player, herb.getProduct().getId(), 1, Container.INVENTORY);
|
||||
playAudio(player, 5153);
|
||||
player.getPacketDispatch().sendMessage("You clean the dirt from the " + herb.getProduct().getName().toLowerCase().replace("clean", "").trim() + " leaf.");
|
||||
}
|
||||
player.lock(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWalk() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user