mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Cleaned up logic and removed comments.
This commit is contained in:
parent
dfc9604673
commit
f64c765df3
3 changed files with 3 additions and 48 deletions
|
|
@ -2,7 +2,6 @@ package content.global.skill.construction.decoration.kitchen
|
||||||
|
|
||||||
import core.api.addItem
|
import core.api.addItem
|
||||||
import core.api.freeSlots
|
import core.api.freeSlots
|
||||||
import core.api.hasSpaceFor
|
|
||||||
import core.api.sendDialogue
|
import core.api.sendDialogue
|
||||||
import core.game.dialogue.DialogueFile
|
import core.game.dialogue.DialogueFile
|
||||||
import core.game.dialogue.Topic
|
import core.game.dialogue.Topic
|
||||||
|
|
@ -19,8 +18,7 @@ abstract class AbstractContainer(containerId: Int, containers: Map<Int,List<Pair
|
||||||
|
|
||||||
private fun checkItem(player: Player, idx : Int){
|
private fun checkItem(player: Player, idx : Int){
|
||||||
val item = containerItemsIds[idx]
|
val item = containerItemsIds[idx]
|
||||||
if (hasSpaceFor(player, item, 1)){
|
if (addItem(player, item)){
|
||||||
addItem(player, item)
|
|
||||||
end()
|
end()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
||||||
|
|
@ -26,46 +26,4 @@ class BeerBarrelInteraction : InteractionListener {
|
||||||
return@onUseWith true
|
return@onUseWith true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
override fun handle(event: NodeUsageEvent): Boolean {
|
|
||||||
val player = event.player
|
|
||||||
val `object` = event.usedWith as Scenery
|
|
||||||
|
|
||||||
if (player.inventory.remove(Item(BEER_GLASS_1919))) {
|
|
||||||
player.animate(Animation.create(3661 + (`object`.id - 13569)))
|
|
||||||
player.sendMessage(
|
|
||||||
"You fill up your glass with " + `object`.name.lowercase(Locale.getDefault()).replace("barrel", "")
|
|
||||||
.trim { it <= ' ' } + ".")
|
|
||||||
player.inventory.add(Item(getReward(`object`.id), 1))
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the beer reward based on the interacted barrel.
|
|
||||||
* @return the item to give.
|
|
||||||
*/
|
|
||||||
fun getReward(barrelId: Int): Int {
|
|
||||||
when (barrelId) {
|
|
||||||
13568 -> return 1917
|
|
||||||
13569 -> return 5763
|
|
||||||
13570 -> return 1905
|
|
||||||
13571 -> return 1909
|
|
||||||
13572 -> return 1911
|
|
||||||
13573 -> return 5755
|
|
||||||
}
|
|
||||||
return 1917
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
/**
|
|
||||||
* The object ids
|
|
||||||
*/
|
|
||||||
private val OBJECTS = intArrayOf(
|
|
||||||
13568, 13569, 13570, 13571, 13572, 13573
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
@ -66,7 +66,7 @@ class StoveInteraction : InteractionListener {
|
||||||
|
|
||||||
on(stoves_with_kettle, SCENERY, "take-kettle"){ player, node ->
|
on(stoves_with_kettle, SCENERY, "take-kettle"){ player, node ->
|
||||||
if (getAttribute(player, kettleBoiled, 0) == 0){
|
if (getAttribute(player, kettleBoiled, 0) == 0){
|
||||||
sendMessage(player, "This is not your kettle.") //inauthentic message
|
sendMessage(player, "This is not your kettle.")
|
||||||
return@on false
|
return@on false
|
||||||
}
|
}
|
||||||
else if (getAttribute(player, kettleBoiled, 0) == 1){
|
else if (getAttribute(player, kettleBoiled, 0) == 1){
|
||||||
|
|
@ -79,7 +79,6 @@ class StoveInteraction : InteractionListener {
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//todo get the authentic message
|
|
||||||
sendMessage(player, "You do not have space to do that.")
|
sendMessage(player, "You do not have space to do that.")
|
||||||
return@on false
|
return@on false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue