mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-16 11:30:17 -07:00
Reimplemented credit shop + updated constlib + bugfix for Drill Demon
This commit is contained in:
parent
795883c657
commit
dc000db82b
5 changed files with 88 additions and 4 deletions
Binary file not shown.
|
|
@ -14,6 +14,7 @@ class SeargentDamienDialogue(val isCorrect: Boolean = false) : DialogueFile() {
|
||||||
0 -> npc(FacialExpression.OLD_NORMAL,"My god you actually did it, you limp","wristed worm-bodied MAGGOT! Take this","and get out of my sight.").also { stage++ }
|
0 -> npc(FacialExpression.OLD_NORMAL,"My god you actually did it, you limp","wristed worm-bodied MAGGOT! Take this","and get out of my sight.").also { stage++ }
|
||||||
1 -> {
|
1 -> {
|
||||||
end()
|
end()
|
||||||
|
player!!.unlock()
|
||||||
DrillDemonUtils.cleanup(player!!)
|
DrillDemonUtils.cleanup(player!!)
|
||||||
player!!.pulseManager.run(object : Pulse(){
|
player!!.pulseManager.run(object : Pulse(){
|
||||||
override fun pulse(): Boolean {
|
override fun pulse(): Boolean {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class SupriseExamListeners : InteractionListener() {
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
|
|
||||||
on(BOOK_OF_KNOWLEDGE,ITEM,"read"){player, node ->
|
on(BOOK_OF_KNOWLEDGE,ITEM,"read"){player, _ ->
|
||||||
player.setAttribute("caller"){skill: Int,p: Player ->
|
player.setAttribute("caller"){skill: Int,p: Player ->
|
||||||
if(p.inventory.remove(Item(BOOK_OF_KNOWLEDGE))) {
|
if(p.inventory.remove(Item(BOOK_OF_KNOWLEDGE))) {
|
||||||
val level = p.skills.getStaticLevel(skill)
|
val level = p.skills.getStaticLevel(skill)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package rs09.game.interaction.inter
|
||||||
|
|
||||||
|
import core.game.node.entity.player.Player
|
||||||
|
import core.game.node.item.Item
|
||||||
|
import org.rs09.consts.Components
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
import rs09.game.interaction.InterfaceListener
|
||||||
|
|
||||||
|
class CreditShopInterface : InterfaceListener() {
|
||||||
|
|
||||||
|
val CREDIT_SHOP = Components.CREDIT_SHOP
|
||||||
|
val TEXT_CHILD = 39
|
||||||
|
|
||||||
|
override fun defineListeners() {
|
||||||
|
on(CREDIT_SHOP){player, component, opcode, buttonID, slot, itemID ->
|
||||||
|
val item = getItem(buttonID)
|
||||||
|
|
||||||
|
if(opcode == 155){
|
||||||
|
player.dialogueInterpreter.sendDialogue("This item costs ${item.price} credits.")
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
|
||||||
|
if(buttonID == 14 || buttonID == 21){
|
||||||
|
val specific = when(opcode){
|
||||||
|
196 -> if(buttonID == 14) Items.RED_PARTYHAT_1038 else Items.RED_HWEEN_MASK_1057
|
||||||
|
124 -> if(buttonID == 14) Items.GREEN_PARTYHAT_1044 else Items.GREEN_HWEEN_MASK_1053
|
||||||
|
199 -> if(buttonID == 14) Items.BLUE_PARTYHAT_2422 else Items.BLUE_HWEEN_MASK_1055
|
||||||
|
234 -> Items.YELLOW_PARTYHAT_1040
|
||||||
|
168 -> Items.PURPLE_PARTYHAT_1046
|
||||||
|
166 -> Items.WHITE_PARTYHAT_1048
|
||||||
|
else -> Items.DWARF_WEED_SEED_5303
|
||||||
|
}
|
||||||
|
attemptPurchase(player,specific,item.price)
|
||||||
|
} else {
|
||||||
|
attemptPurchase(player,item.id,item.price)
|
||||||
|
}
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpen(CREDIT_SHOP){player, component ->
|
||||||
|
sendCredits(player)
|
||||||
|
return@onOpen true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getItem(buttonID: Int): ShopItem{
|
||||||
|
return when(buttonID){
|
||||||
|
14 -> ShopItem(Items.BLUE_PARTYHAT_2422,75)
|
||||||
|
18 -> ShopItem(Items.SCYTHE_1419,100)
|
||||||
|
20 -> ShopItem(Items.JANGLES_THE_MONKEY_14648,200)
|
||||||
|
17 -> ShopItem(Items.CHRISTMAS_CRACKER_962,65)
|
||||||
|
21 -> ShopItem(Items.BLUE_HWEEN_MASK_1055,65)
|
||||||
|
16 -> ShopItem(Items.SANTA_HAT_1050,65)
|
||||||
|
19 -> ShopItem(Items.BUNNY_EARS_1037,150)
|
||||||
|
15 -> ShopItem(Items.EASTER_RING_7927,100)
|
||||||
|
else -> ShopItem(0,0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun sendCredits(player: Player){
|
||||||
|
player.packetDispatch.sendString("You have ${player.details.credits} credits to spend.",CREDIT_SHOP,TEXT_CHILD)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun attemptPurchase(player: Player, item: Int, price: Int){
|
||||||
|
if(player.details.credits < price){
|
||||||
|
player.dialogueInterpreter.sendDialogue("You don't have enough credits for that.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.inventory.add(Item(item))){
|
||||||
|
player.details.credits -= price
|
||||||
|
} else {
|
||||||
|
player.dialogueInterpreter.sendDialogue("You don't have enough inventory space for that.")
|
||||||
|
}
|
||||||
|
sendCredits(player)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class ShopItem(val id: Int, val price: Int)
|
||||||
|
}
|
||||||
|
|
@ -132,9 +132,9 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
/**
|
/**
|
||||||
* Opens the credit/voting shop
|
* Opens the credit/voting shop
|
||||||
*/
|
*/
|
||||||
/*define("shop", Command.Privilege.STANDARD){ player, _ ->
|
define("shop", Command.Privilege.STANDARD){ player, _ ->
|
||||||
CreditShop().open(player)
|
player.interfaceManager.open(Component(Components.CREDIT_SHOP))
|
||||||
}*/
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the player a list of currently active GE sell offers
|
* Shows the player a list of currently active GE sell offers
|
||||||
|
|
@ -460,5 +460,9 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
player.antiMacroHandler.event = RandomEvents.SURPRISE_EXAM.npc.create(player,null,"sexam")
|
player.antiMacroHandler.event = RandomEvents.SURPRISE_EXAM.npc.create(player,null,"sexam")
|
||||||
player.antiMacroHandler.event!!.init()
|
player.antiMacroHandler.event!!.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define("addcredits",Command.Privilege.ADMIN){player,_ ->
|
||||||
|
player.details.credits += 100
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue