Minor quest function refactors
Quest journal text improvements
This commit is contained in:
@@ -66,6 +66,7 @@ import core.game.world.repository.Repository
|
||||
import core.game.consumable.*
|
||||
import core.ServerConstants
|
||||
import core.api.utils.Vector
|
||||
import core.game.node.entity.player.link.quest.Quest
|
||||
import core.tools.*
|
||||
import core.game.world.update.flag.*
|
||||
import core.game.world.update.flag.context.*
|
||||
@@ -1478,6 +1479,18 @@ fun sendItemOnInterface(player: Player, iface: Int, child: Int, item: Int, amoun
|
||||
player.packetDispatch.sendItemOnInterface(item, amount, iface, child)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a zoomed item to a specific child on an interface
|
||||
* @param player the player to send the packet to
|
||||
* @param iface the ID of the interface to send the item onto
|
||||
* @Param child the index of the child on the interface to send the item onto
|
||||
* @param item the ID of the item to send
|
||||
* @param zoom the amount of zoom to apply to the item - defaults to 230
|
||||
*/
|
||||
fun sendItemZoomOnInterface(player: Player, iface: Int, child: Int, item: Int, zoom: Int = 230) {
|
||||
player.packetDispatch.sendItemZoomOnInterface(item, zoom, iface, child)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a dialogue box with a single item and some text
|
||||
* @param player the player to send it to
|
||||
@@ -1588,14 +1601,14 @@ fun runTask(entity: Entity, delay: Int = 0, repeatTimes: Int = 1, task: () -> Un
|
||||
* @param player the player to get the QP for
|
||||
* @return the number of QP the player has
|
||||
*/
|
||||
fun getQP(player: Player): Int {
|
||||
fun getQuestPoints(player: Player): Int {
|
||||
return player.questRepository.points
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the stage for the given quest for the given player
|
||||
*/
|
||||
fun questStage(player: Player, quest: String): Int {
|
||||
fun getQuestStage(player: Player, quest: String): Int {
|
||||
return player.questRepository.getStage(quest)
|
||||
}
|
||||
|
||||
@@ -1621,7 +1634,6 @@ fun isQuestComplete(player: Player, quest: String): Boolean {
|
||||
return player.questRepository.getStage(quest) == 100
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a player meets the requirements to start a quest, and then starts it if they do. Returns success bool
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,11 @@ public abstract class Quest implements Plugin<Object> {
|
||||
*/
|
||||
public static final String RED = "<col=8A0808>";
|
||||
|
||||
/**
|
||||
* Represents the bright red string.
|
||||
*/
|
||||
public static final String BRIGHT_RED = "<col=FF0000>";
|
||||
|
||||
/**
|
||||
* Represents the blue string.
|
||||
*/
|
||||
@@ -151,7 +156,7 @@ public abstract class Quest implements Plugin<Object> {
|
||||
line++;
|
||||
}
|
||||
} else {
|
||||
send = send.replace("!!",RED).replace("??",BLUE).replace("---",BLACK + "<str>").replace("/--", BLUE);
|
||||
send = send.replace("!!", RED).replace("??", BLUE).replace("---", BLACK + "<str>").replace("/--", BLUE).replace("%%", BRIGHT_RED).replace("&&", BLUE);
|
||||
line(player, send, line, false);
|
||||
}
|
||||
}
|
||||
@@ -164,12 +169,13 @@ public abstract class Quest implements Plugin<Object> {
|
||||
* @param crossed True if the message should be crossed out.
|
||||
*/
|
||||
public void line(Player player, String message, int line, final boolean crossed) {
|
||||
String send = message;
|
||||
String send;
|
||||
if(!crossed){
|
||||
send = BLUE + "" + message.replace("<n>", "<br><br>").replace("<blue>", BLUE).replace("<red>", RED);
|
||||
send = send.replace("!!",RED).replace("??",BLUE);
|
||||
send = send.replace("!!", RED).replace("??", BLUE).replace("%%", BRIGHT_RED).replace("&&", BLUE);
|
||||
} else {
|
||||
send = BLUE + "" + message.replace("??","").replace("!!","");
|
||||
send = BLACK + "" + message.replace("<n>", "<br><br>").replace("<blue>", "").replace("<red>", "RED");
|
||||
send = send.replace("!!", "").replace("??", "").replace("%%", "").replace("&&", "");
|
||||
}
|
||||
player.getPacketDispatch().sendString(crossed ? "<str>" + send + "</str>" : send, JOURNAL_COMPONENT, line);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import core.ServerConstants
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.tools.SystemLogger
|
||||
import core.game.system.command.Privilege
|
||||
import java.io.FileReader
|
||||
import core.tools.*
|
||||
@@ -138,7 +137,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
|
||||
}
|
||||
|
||||
on(NPCs.SIEGFRIED_ERKLE_933, IntType.NPC, "trade"){ player, node ->
|
||||
val points = getQP(player)
|
||||
val points = getQuestPoints(player)
|
||||
if(points < 40){
|
||||
sendNPCDialogue(player, NPCs.SIEGFRIED_ERKLE_933, "I'm sorry, adventurer, but you need 40 quest points to buy from me.")
|
||||
return@on true
|
||||
|
||||
Reference in New Issue
Block a user