mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-20 13:30:27 -07:00
Add: Genie Random Event
This commit is contained in:
parent
c5020d155d
commit
0619c577e9
5 changed files with 61 additions and 1259 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -4433,7 +4433,7 @@
|
|||
},
|
||||
{
|
||||
"npc_id": "2329",
|
||||
"loc_data": "{1702,4823,0,0,6}"
|
||||
"loc_data": "{3093,3260,0,1,6}-{1702.4822,0,0,0]"
|
||||
},
|
||||
{
|
||||
"npc_id": "2330",
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@ import rs09.game.content.ame.events.certer.CerterNPC
|
|||
import rs09.game.content.ame.events.drilldemon.SeargentDamienNPC
|
||||
import rs09.game.content.ame.events.evilchicken.EvilChickenNPC
|
||||
import rs09.game.content.ame.events.sandwichlady.SandwichLadyRENPC
|
||||
import rs09.game.content.ame.events.genie.GenieNPC
|
||||
import rs09.game.content.global.WeightBasedTable
|
||||
import rs09.game.content.global.WeightedItem
|
||||
|
||||
enum class RandomEvents(val npc: RandomEventNPC, val loot: WeightBasedTable? = null) {
|
||||
SANDWICH_LADY(SandwichLadyRENPC()),
|
||||
GENIE(GenieNPC()),
|
||||
CERTER(CerterNPC(),WeightBasedTable.create(
|
||||
WeightedItem(Items.COINS_995,1,100,2.0),
|
||||
WeightedItem(Items.SPINACH_ROLL_1969,1,1,2.0),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package rs09.game.content.ame.events.genie
|
||||
|
||||
import api.ContentAPI
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.cache.def.impl.ItemDefinition
|
||||
import core.game.component.Component
|
||||
import core.game.node.entity.combat.ImpactHandler
|
||||
import core.game.node.item.GroundItemManager
|
||||
import core.game.node.item.Item
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
class GenieDialogue : DialogueFile() {
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
val assigned = player!!.getAttribute("genie:item",0)
|
||||
npcl(FacialExpression.NEUTRAL, "Ah, so you are there, ${player!!.name.capitalize()}. I'm so glad you summoned me. Please take this lamp and make your wish.")
|
||||
ContentAPI.addItemOrDrop(player!!, assigned)
|
||||
player!!.antiMacroHandler.event?.terminate()
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package rs09.game.content.ame.events.genie
|
||||
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.ame.RandomEventNPC
|
||||
import rs09.game.content.global.WeightBasedTable
|
||||
|
||||
class GenieNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NPCs.GENIE_409) {
|
||||
val phrases = arrayOf("Greetings, @name!","Ehem... Master @name?","Are you there, Master @name?","No one ignores me!")
|
||||
var assigned_item = 0
|
||||
val items = arrayOf(Items.LAMP_2528)
|
||||
|
||||
override fun tick() {
|
||||
if(RandomFunction.random(1,15) == 5){
|
||||
sendChat(phrases.random().replace("@name",player.name.capitalize()))
|
||||
}
|
||||
super.tick()
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
super.init()
|
||||
assignItem()
|
||||
sendChat(phrases.random().replace("@name",player.name.capitalize()))
|
||||
}
|
||||
|
||||
fun assignItem(){
|
||||
assigned_item = items.random()
|
||||
player.setAttribute("genie:item",assigned_item)
|
||||
}
|
||||
|
||||
override fun talkTo(npc: NPC) {
|
||||
player.dialogueInterpreter.open(GenieDialogue(),npc)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue