Fix Seaweed, Ectofuntus Pot Filling, and Quest Typos
This commit is contained in:
+61
-58
@@ -1,5 +1,7 @@
|
||||
package rs09.game.content.zone.phasmatys.bonegrinder
|
||||
|
||||
import api.Container
|
||||
import api.ContentAPI
|
||||
import core.game.content.global.Bones
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
@@ -13,16 +15,18 @@ import rs09.game.world.GameWorld.Pulser
|
||||
private const val LOADER = 11162
|
||||
private const val BONE_GRINDER = 11163
|
||||
private const val BIN = 11164
|
||||
|
||||
private const val LOADED_BONE_KEY = "/save:bonegrinder-bones"
|
||||
private const val BONE_HOPPER_KEY = "/save:bonegrinder-hopper"
|
||||
private const val BONE_BIN_KEY = "/save:bonegrinder-bin"
|
||||
|
||||
private val FILL_ANIM = Animation(1649)
|
||||
private val WIND_ANIM = Animation(1648)
|
||||
private val SCOOP_ANIM = Animation(1650)
|
||||
|
||||
class BoneGrinderListener : InteractionListener() {
|
||||
|
||||
val boneIDs = Bones.values().map { it.itemId }.toIntArray()
|
||||
private val boneIDs = Bones.values().map { it.itemId }.toIntArray()
|
||||
|
||||
override fun defineListeners() {
|
||||
|
||||
@@ -67,15 +71,15 @@ class BoneGrinderListener : InteractionListener() {
|
||||
fun handleFill(player: Player): Boolean{
|
||||
val bone = getBone(player)
|
||||
if(bone == null){
|
||||
player.sendMessage("You have no bones to grind.")
|
||||
ContentAPI.sendMessage(player,"You have no bones to grind.")
|
||||
return true
|
||||
}
|
||||
if(player.getAttribute(BONE_HOPPER_KEY,false) != false){
|
||||
player.sendMessage("You already have some bones in the hopper.")
|
||||
if(ContentAPI.getAttribute(player,BONE_HOPPER_KEY,false)){
|
||||
ContentAPI.sendMessage(player,"You already have some bones in the hopper.")
|
||||
return true
|
||||
}
|
||||
if(player.getAttribute(BONE_BIN_KEY,false) != false){
|
||||
player.sendMessage("You already have some bonemeal that needs to be collected.")
|
||||
if(ContentAPI.getAttribute(player,BONE_BIN_KEY,false)){
|
||||
ContentAPI.sendMessage(player,"You already have some bonemeal that needs to be collected.")
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -84,15 +88,14 @@ class BoneGrinderListener : InteractionListener() {
|
||||
override fun pulse(): Boolean {
|
||||
when(stage++){
|
||||
0 -> {
|
||||
player.lock()
|
||||
player.animator.animate(FILL_ANIM)
|
||||
ContentAPI.lock(player, FILL_ANIM.duration)
|
||||
ContentAPI.animate(player,FILL_ANIM)
|
||||
}
|
||||
FILL_ANIM.duration -> {
|
||||
player.sendMessage("You fill the hopper with bones.")
|
||||
player.unlock()
|
||||
player.inventory.remove(Item(bone.itemId))
|
||||
player.setAttribute(LOADED_BONE_KEY,bone.ordinal)
|
||||
player.setAttribute(BONE_HOPPER_KEY,true)
|
||||
ContentAPI.sendMessage(player,"You fill the hopper with bones.")
|
||||
ContentAPI.removeItem(player,Item(bone.itemId),Container.INVENTORY)
|
||||
ContentAPI.setAttribute(player,LOADED_BONE_KEY,bone.ordinal)
|
||||
ContentAPI.setAttribute(player,BONE_HOPPER_KEY,true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -100,30 +103,28 @@ class BoneGrinderListener : InteractionListener() {
|
||||
}
|
||||
}
|
||||
|
||||
if(player.inventory.getAmount(bone.itemId) > 0){
|
||||
if(ContentAPI.inInventory(player,bone.itemId)){
|
||||
player.pulseManager.run(object : Pulse(){
|
||||
var stage = 0
|
||||
override fun pulse(): Boolean {
|
||||
when(stage++){
|
||||
0 -> Pulser.submit(fillPulse).also { delay = FILL_ANIM.duration + 1}
|
||||
1 -> {
|
||||
player.walkingQueue.reset()
|
||||
player.walkingQueue.addPath(3659,3524,true)
|
||||
ContentAPI.stopWalk(player)
|
||||
ContentAPI.forceWalk(player,Location(3659,3524),"smart")
|
||||
delay = 2
|
||||
}
|
||||
2 -> {
|
||||
player.faceLocation(Location.create(3659, 3526, 1))
|
||||
handleWind(player)
|
||||
delay = WIND_ANIM.duration + 1
|
||||
}
|
||||
3 -> {
|
||||
player.walkingQueue.reset()
|
||||
player.walkingQueue.addPath(3658,3524,true)
|
||||
ContentAPI.stopWalk(player)
|
||||
ContentAPI.forceWalk(player,Location(3658,3524),"smart")
|
||||
delay = 2
|
||||
}
|
||||
4 -> {
|
||||
player.faceLocation(Location.create(3658, 3525, 1))
|
||||
if(!player.inventory.contains(Items.EMPTY_POT_1931,1)){
|
||||
if(!ContentAPI.inInventory(player,Items.EMPTY_POT_1931,1)){
|
||||
return handleEmpty(player)
|
||||
} else {
|
||||
handleEmpty(player)
|
||||
@@ -131,12 +132,12 @@ class BoneGrinderListener : InteractionListener() {
|
||||
}
|
||||
}
|
||||
5 -> {
|
||||
player.walkingQueue.reset()
|
||||
player.walkingQueue.addPath(3660,3524,true)
|
||||
ContentAPI.stopWalk(player)
|
||||
ContentAPI.forceWalk(player,Location(3660,3524),"smart")
|
||||
delay = 4
|
||||
}
|
||||
6 -> {
|
||||
player.faceLocation(Location.create(3660,3526))
|
||||
ContentAPI.face(player,Location(3660,3526))
|
||||
handleFill(player)
|
||||
return true
|
||||
}
|
||||
@@ -151,13 +152,13 @@ class BoneGrinderListener : InteractionListener() {
|
||||
}
|
||||
|
||||
fun handleWind(player: Player): Boolean{
|
||||
if(!player.getAttribute(BONE_HOPPER_KEY,false)){
|
||||
player.sendMessage("You have no bones loaded to grind.")
|
||||
if(!ContentAPI.getAttribute(player,BONE_HOPPER_KEY,false)){
|
||||
ContentAPI.sendMessage(player,"You have no bones loaded to grind.")
|
||||
return true
|
||||
}
|
||||
|
||||
if(player.getAttribute(BONE_BIN_KEY,false)){
|
||||
player.sendMessage("You already have some bonemeal which you need to collect.")
|
||||
if(ContentAPI.getAttribute(player,BONE_BIN_KEY,false)){
|
||||
ContentAPI.sendMessage(player,"You already have some bonemeal which you need to collect.")
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -166,15 +167,15 @@ class BoneGrinderListener : InteractionListener() {
|
||||
override fun pulse(): Boolean {
|
||||
when(stage++){
|
||||
0 -> {
|
||||
player.lock()
|
||||
player.animator.animate(WIND_ANIM)
|
||||
player.sendMessage("You wind the handle.")
|
||||
ContentAPI.face(player,Location(3659, 3526, 1))
|
||||
ContentAPI.lock(player,WIND_ANIM.duration)
|
||||
ContentAPI.animate(player,WIND_ANIM)
|
||||
ContentAPI.sendMessage(player,"You wind the handle.")
|
||||
}
|
||||
WIND_ANIM.duration -> {
|
||||
player.unlock()
|
||||
player.sendMessage("The bonemeal falls into the bin.")
|
||||
player.setAttribute(BONE_HOPPER_KEY,false)
|
||||
player.setAttribute(BONE_BIN_KEY,true)
|
||||
ContentAPI.sendMessage(player,"The bonemeal falls into the bin.")
|
||||
ContentAPI.setAttribute(player,BONE_HOPPER_KEY,false)
|
||||
ContentAPI.setAttribute(player,BONE_BIN_KEY,true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -184,51 +185,54 @@ class BoneGrinderListener : InteractionListener() {
|
||||
return true
|
||||
}
|
||||
|
||||
fun handleStatus(player: Player): Boolean{
|
||||
val bonesLoaded = player.getAttribute(BONE_HOPPER_KEY,false)
|
||||
val boneMealReady = player.getAttribute(BONE_BIN_KEY,false)
|
||||
private fun handleStatus(player: Player): Boolean{
|
||||
val bonesLoaded = ContentAPI.getAttribute(player,BONE_HOPPER_KEY,false)
|
||||
val boneMealReady = ContentAPI.getAttribute(player,BONE_BIN_KEY,false)
|
||||
|
||||
if(bonesLoaded) player.sendMessage("There are bones waiting in the hopper.")
|
||||
if(boneMealReady) player.sendMessage("There is bonemeal waiting in the bin to be collected.")
|
||||
if(bonesLoaded) ContentAPI.sendMessage(player,"There are bones waiting in the hopper.")
|
||||
if(boneMealReady) ContentAPI.sendMessage(player,"There is bonemeal waiting in the bin to be collected.")
|
||||
|
||||
if(!bonesLoaded && !boneMealReady){
|
||||
player.sendMessage("There is nothing loaded into the machine.")
|
||||
ContentAPI.sendMessage(player,"There is nothing loaded into the machine.")
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
fun handleEmpty(player: Player): Boolean{
|
||||
if(!player.getAttribute(BONE_BIN_KEY,false)){
|
||||
player.sendMessage("You have no bonemeal to collect.")
|
||||
if(!ContentAPI.getAttribute(player,BONE_BIN_KEY,false)){
|
||||
ContentAPI.sendMessage(player,"You have no bonemeal to collect.")
|
||||
return true
|
||||
}
|
||||
|
||||
if(player.getAttribute(BONE_HOPPER_KEY,false) && !player.getAttribute(BONE_BIN_KEY,false)){
|
||||
player.sendMessage("You need to wind the wheel to grind the bones.")
|
||||
if(ContentAPI.getAttribute(player,BONE_HOPPER_KEY,false) && !ContentAPI.getAttribute(player,BONE_BIN_KEY,false)){
|
||||
ContentAPI.sendMessage(player,"You need to wind the wheel to grind the bones.")
|
||||
return true
|
||||
}
|
||||
|
||||
if(!player.inventory.contains(Items.EMPTY_POT_1931,1)){
|
||||
player.sendMessage("You don't have any pots to take the bonemeal with.")
|
||||
if(!ContentAPI.inInventory(player,Items.EMPTY_POT_1931,1)){
|
||||
ContentAPI.sendMessage(player,"You don't have any pots to take the bonemeal with.")
|
||||
return true
|
||||
}
|
||||
|
||||
val bone = Bones.values()[player.getAttribute(LOADED_BONE_KEY,-1)]
|
||||
val bone = Bones.values()[ContentAPI.getAttribute(player,LOADED_BONE_KEY,-1)]
|
||||
|
||||
|
||||
player.lock()
|
||||
Pulser.submit(object : Pulse(){
|
||||
var stage = 0
|
||||
override fun pulse(): Boolean {
|
||||
when(stage++){
|
||||
0 -> player.animator.animate(SCOOP_ANIM)
|
||||
0 -> {
|
||||
ContentAPI.face(player,Location(3658, 3525, 1))
|
||||
ContentAPI.lock(player, SCOOP_ANIM.duration)
|
||||
ContentAPI.animate(player,SCOOP_ANIM)
|
||||
}
|
||||
SCOOP_ANIM.duration -> {
|
||||
player.unlock()
|
||||
if(player.inventory.remove(Item(Items.EMPTY_POT_1931))){
|
||||
player.inventory.add(bone.boneMeal)
|
||||
player.setAttribute(BONE_BIN_KEY,false)
|
||||
player.setAttribute(BONE_HOPPER_KEY,false)
|
||||
player.setAttribute(LOADED_BONE_KEY,-1)
|
||||
if(ContentAPI.removeItem(player,Item(Items.EMPTY_POT_1931),Container.INVENTORY)){
|
||||
ContentAPI.addItem(player,bone.boneMeal.id)
|
||||
ContentAPI.setAttribute(player,BONE_BIN_KEY,false)
|
||||
ContentAPI.setAttribute(player,BONE_HOPPER_KEY,false)
|
||||
ContentAPI.setAttribute(player,LOADED_BONE_KEY,-1)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -236,13 +240,12 @@ class BoneGrinderListener : InteractionListener() {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
fun getBone(player: Player): Bones? {
|
||||
for(bone in Bones.values()){
|
||||
if(player.inventory.contains(bone.itemId,1)) return bone
|
||||
if(ContentAPI.inInventory(player,bone.itemId)) return bone
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import core.game.node.entity.skill.Skills
|
||||
import core.game.node.entity.skill.gather.SkillingTool
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.net.packet.out.SkillLevel
|
||||
import org.rs09.consts.Components
|
||||
|
||||
object CanoeUtils {
|
||||
|
||||
Reference in New Issue
Block a user