Merge branch 'master' into 'master'

Add: Genie Random Event

See merge request 2009scape/2009scape!305
This commit is contained in:
Ceikry 2021-10-18 02:52:12 +00:00
commit 1cd298b14c
5 changed files with 61 additions and 1259 deletions

File diff suppressed because it is too large Load diff

View file

@ -4433,7 +4433,7 @@
}, },
{ {
"npc_id": "2329", "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", "npc_id": "2330",

View file

@ -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.drilldemon.SeargentDamienNPC
import rs09.game.content.ame.events.evilchicken.EvilChickenNPC import rs09.game.content.ame.events.evilchicken.EvilChickenNPC
import rs09.game.content.ame.events.sandwichlady.SandwichLadyRENPC 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.WeightBasedTable
import rs09.game.content.global.WeightedItem import rs09.game.content.global.WeightedItem
enum class RandomEvents(val npc: RandomEventNPC, val loot: WeightBasedTable? = null) { enum class RandomEvents(val npc: RandomEventNPC, val loot: WeightBasedTable? = null) {
SANDWICH_LADY(SandwichLadyRENPC()), SANDWICH_LADY(SandwichLadyRENPC()),
GENIE(GenieNPC()),
CERTER(CerterNPC(),WeightBasedTable.create( CERTER(CerterNPC(),WeightBasedTable.create(
WeightedItem(Items.COINS_995,1,100,2.0), WeightedItem(Items.COINS_995,1,100,2.0),
WeightedItem(Items.SPINACH_ROLL_1969,1,1,2.0), WeightedItem(Items.SPINACH_ROLL_1969,1,1,2.0),

View file

@ -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
}
}

View file

@ -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)
}
}