Added NPC who sells fighter torso for 7.5M - Captain Cain
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# This file is a template, and might need editing before it works on your project.
|
||||
# This is the Gradle build system for JVM applications
|
||||
# https://gradle.org/
|
||||
# https://github.com/gradle/gradle
|
||||
image: gradle:alpine
|
||||
|
||||
# Disable the Gradle daemon for Continuous Integration servers as correctness
|
||||
# is usually a priority over speed in CI environments. Using a fresh
|
||||
# runtime for each build is more reliable since the runtime is completely
|
||||
# isolated from any previous builds.
|
||||
variables:
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
|
||||
before_script:
|
||||
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script: gradle --build-cache assemble
|
||||
cache:
|
||||
key: "$CI_COMMIT_REF_NAME"
|
||||
policy: push
|
||||
paths:
|
||||
- build
|
||||
- .gradle
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script: gradle check
|
||||
cache:
|
||||
key: "$CI_COMMIT_REF_NAME"
|
||||
policy: pull
|
||||
paths:
|
||||
- build
|
||||
- .gradle
|
||||
@@ -311,4 +311,22 @@ public abstract class DialoguePlugin implements Plugin<Player> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the automatic linesplitting feature in DialUtils to produce npc dialogues
|
||||
* @param expr the FacialExpression to use, located in the FacialExpression enum.
|
||||
* @param msg the message for the NPC to say
|
||||
*/
|
||||
public Component npcl(FacialExpression expr, String msg){
|
||||
return npc(expr, api.DialUtils.splitLines(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the automatic linesplitting feature in DialUtils to produce player dialogues
|
||||
* @param expr the FacialExpression to use, located in the FacialExpression enum.
|
||||
* @param msg the message for the player to say
|
||||
*/
|
||||
public Component playerl(FacialExpression expr, String msg){
|
||||
return player(expr, api.DialUtils.splitLines(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
package api
|
||||
import rs09.game.system.SystemLogger
|
||||
import java.util.*
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package rs09.game.content.dialogue
|
||||
|
||||
import api.ContentAPI
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.temporal.ChronoUnit
|
||||
import java.util.*
|
||||
|
||||
@Initializable
|
||||
class CaptainCainDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
val sdf = SimpleDateFormat("ddMMyyyy")
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return CaptainCainDialogue(player)
|
||||
}
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npcl(FacialExpression.FRIENDLY, "Hello, there, adventurer. Say, you wouldn't happen to be interested in purchasing a Fighter Torso would you?")
|
||||
stage = 0
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
val start = sdf.parse("27112020").toInstant()
|
||||
val now = Date().toInstant()
|
||||
val days = ChronoUnit.DAYS.between(start,now)
|
||||
when(stage){
|
||||
0 -> npcl(FacialExpression.ANNOYED,"I'm having to offer this service because it's been $days days since Ryan promised to give us barbarian assault.").also { stage++ }
|
||||
1 -> options("Yes, please.","No, thanks.").also { stage++ }
|
||||
2 -> when(buttonId){
|
||||
1 -> playerl(FacialExpression.FRIENDLY, "Yes, please.").also { stage = 10 }
|
||||
2 -> playerl(FacialExpression.HALF_THINKING, "No, thanks.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
10 -> npcl(FacialExpression.FRIENDLY, "Alright, then, that'll be 7,500,000 gold please.").also { stage++ }
|
||||
11 -> options("Here you go!","Nevermind.").also { stage++ }
|
||||
12 -> when(buttonId){
|
||||
1 -> if(ContentAPI.inInventory(player, 995, 7500000))
|
||||
playerl(FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 }
|
||||
else
|
||||
playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE }
|
||||
|
||||
2 -> playerl(FacialExpression.FRIENDLY, "On second thought, nevermind.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
20 -> {
|
||||
npcl(FacialExpression.FRIENDLY, "Thank you much, kind sir. And here's your torso.")
|
||||
if(ContentAPI.removeItem(player, Item(995,7500000), api.Container.INVENTORY)) {
|
||||
ContentAPI.addItem(player, Items.FIGHTER_TORSO_10551, 1)
|
||||
}
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.CAPTAIN_CAIN_5030)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user