Code cleanup
Reorganised imports Removed redundant qualifiers
This commit is contained in:
@@ -47,7 +47,7 @@ class ServerConstants {
|
||||
var PLAYER_SAVE_PATH: String? = null
|
||||
|
||||
@JvmField
|
||||
var PLAYER_ATTRIBUTE_PATH = "ish";
|
||||
var PLAYER_ATTRIBUTE_PATH = "ish"
|
||||
|
||||
//path to the various config files, such as npc_spawns.json
|
||||
var CONFIG_PATH: String? = null
|
||||
|
||||
@@ -20,7 +20,7 @@ import core.game.node.entity.player.link.TeleportManager
|
||||
import core.game.node.entity.player.link.audio.Audio
|
||||
import core.game.node.entity.player.link.emote.Emotes
|
||||
import core.game.node.entity.player.link.quest.QuestRepository
|
||||
import core.game.node.entity.player.link.prayer.PrayerType;
|
||||
import core.game.node.entity.player.link.prayer.PrayerType
|
||||
import core.game.node.entity.skill.Skills
|
||||
import content.data.skill.SkillingTool
|
||||
import content.global.skill.slayer.Tasks
|
||||
@@ -1439,7 +1439,7 @@ fun <A, G> visualize(entity: Entity, anim: A, gfx: G) {
|
||||
* @param pulse the Pulse object to submit
|
||||
*/
|
||||
fun submitWorldPulse(pulse: Pulse) {
|
||||
GameWorld.Pulser.submit(pulse)
|
||||
Pulser.submit(pulse)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1928,7 +1928,7 @@ fun runcs2 (player: Player, scriptId: Int, vararg arguments: Any) {
|
||||
fun sendItemSelect (player: Player, vararg options: String, keepAlive: Boolean = false, callback: (slot: Int, optionIndex: Int) -> Unit) {
|
||||
player.interfaceManager.openSingleTab(Component(12))
|
||||
val scriptArgs = arrayOf ((12 shl 16) + 18, 93, 4, 7, 0, -1, "", "", "", "", "", "", "", "", "")
|
||||
for (i in 0 until kotlin.math.min(9, options.size))
|
||||
for (i in 0 until min(9, options.size))
|
||||
scriptArgs[6 + i] = options[i]
|
||||
runcs2(player, 150, *scriptArgs)
|
||||
val settings = IfaceSettingsBuilder()
|
||||
@@ -1941,8 +1941,8 @@ fun sendItemSelect (player: Player, vararg options: String, keepAlive: Boolean =
|
||||
|
||||
fun announceIfRare(player: Player, item: Item) {
|
||||
if (item.definition.getConfiguration(ItemConfigParser.RARE_ITEM, false)) {
|
||||
sendNews("${player.username} has just received: ${item.amount} x ${item.name}.");
|
||||
GlobalKillCounter.incrementRareDrop(player, item);
|
||||
sendNews("${player.username} has just received: ${item.amount} x ${item.name}.")
|
||||
GlobalKillCounter.incrementRareDrop(player, item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ enum class EquipmentSlot {
|
||||
slotMap["chest"] = CHEST; slotMap["body"] = CHEST; slotMap["torso"] = CHEST
|
||||
slotMap["shield"] = SHIELD; slotMap["off"] = SHIELD
|
||||
slotMap["legs"] = LEGS; slotMap["leg"] = LEGS
|
||||
slotMap["hands"] = HANDS; slotMap["hand"] = HANDS; slotMap["brace"] = HANDS; slotMap["bracelet"] = HANDS;
|
||||
slotMap["hands"] = HANDS; slotMap["hand"] = HANDS; slotMap["brace"] = HANDS; slotMap["bracelet"] = HANDS
|
||||
slotMap["feet"] = FEET
|
||||
slotMap["ring"] = RING
|
||||
slotMap["ammo"] = AMMO; slotMap["ammunition"] = AMMO
|
||||
|
||||
@@ -3,7 +3,6 @@ package core.api.regionspec
|
||||
import core.api.regionspec.contracts.*
|
||||
import core.game.world.map.Region
|
||||
import core.game.world.map.RegionChunk
|
||||
import core.game.world.map.RegionPlane
|
||||
import core.game.world.map.build.DynamicRegion
|
||||
|
||||
class RegionSpecification(val regionContract: RegionSpecContract = EmptyRegionContract(), vararg val chunkContracts: ChunkSpecContract = arrayOf(EmptyChunkContract())) {
|
||||
|
||||
@@ -4,6 +4,6 @@ import core.game.world.map.build.DynamicRegion
|
||||
|
||||
class UseExistingRegionContract(val region: DynamicRegion) : RegionSpecContract {
|
||||
override fun instantiateRegion(): DynamicRegion {
|
||||
return region;
|
||||
return region
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,8 @@ class AIRepository {
|
||||
|
||||
@JvmStatic fun clearAllBots() {
|
||||
PulseRepository.toList().forEach { (_, it) ->
|
||||
it.stop();
|
||||
it.botScript.bot.clear();
|
||||
it.stop()
|
||||
it.botScript.bot.clear()
|
||||
AIPlayer.deregister((it.botScript.bot as AIPlayer).uid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ class ScriptAPI(private val bot: Player) {
|
||||
return false
|
||||
|
||||
if (acceptedPredicate != null) {
|
||||
return acceptedPredicate(e) && !Pathfinder.find(bot, e).isMoveNear;
|
||||
return acceptedPredicate(e) && !Pathfinder.find(bot, e).isMoveNear
|
||||
} else {
|
||||
val name = e?.name
|
||||
return (acceptedNames?.stream()?.anyMatch({ s -> s.equals(name, true) }) ?: true && !Pathfinder.find(bot, e).isMoveNear)
|
||||
|
||||
@@ -2,12 +2,12 @@ package core.game.dialogue
|
||||
import core.game.node.entity.player.Player
|
||||
import core.tools.END_DIALOGUE
|
||||
|
||||
abstract class DialogueBuilderFile : core.game.dialogue.DialogueFile() {
|
||||
var data: ArrayList<core.game.dialogue.DialogueClause> = ArrayList()
|
||||
abstract class DialogueBuilderFile : DialogueFile() {
|
||||
var data: ArrayList<DialogueClause> = ArrayList()
|
||||
//var stages: ArrayList<Int> = ArrayList()
|
||||
abstract fun create(b: core.game.dialogue.DialogueBuilder)
|
||||
abstract fun create(b: DialogueBuilder)
|
||||
init {
|
||||
create(core.game.dialogue.DialogueBuilder(this))
|
||||
create(DialogueBuilder(this))
|
||||
}
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
for((i, clause) in data.iterator().withIndex()) {
|
||||
@@ -23,46 +23,46 @@ abstract class DialogueBuilderFile : core.game.dialogue.DialogueFile() {
|
||||
}
|
||||
|
||||
interface DialogueNode {
|
||||
fun handle(df: core.game.dialogue.DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int
|
||||
fun handle(df: DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int
|
||||
}
|
||||
|
||||
class NpcLNode(val value: String): core.game.dialogue.DialogueNode {
|
||||
override fun handle(df: core.game.dialogue.DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
class NpcLNode(val value: String): DialogueNode {
|
||||
override fun handle(df: DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
df.npcl(value)
|
||||
return stage + 1
|
||||
}
|
||||
}
|
||||
class NpcNode(val values: Array<String>): core.game.dialogue.DialogueNode {
|
||||
override fun handle(df: core.game.dialogue.DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
class NpcNode(val values: Array<String>): DialogueNode {
|
||||
override fun handle(df: DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
df.npc(*values)
|
||||
return stage + 1
|
||||
}
|
||||
}
|
||||
class PlayerLNode(val value: String): core.game.dialogue.DialogueNode {
|
||||
override fun handle(df: core.game.dialogue.DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
class PlayerLNode(val value: String): DialogueNode {
|
||||
override fun handle(df: DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
df.playerl(value)
|
||||
return stage + 1
|
||||
}
|
||||
}
|
||||
class ClosureNode(val f: (Player) -> Int): core.game.dialogue.DialogueNode {
|
||||
override fun handle(df: core.game.dialogue.DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
class ClosureNode(val f: (Player) -> Int): DialogueNode {
|
||||
override fun handle(df: DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
return f(df.player!!)
|
||||
}
|
||||
}
|
||||
|
||||
class OptionEntry(val text: String, val nextStage: Int, val predicate: (Player) -> Boolean = { _ -> true }) {}
|
||||
|
||||
class OptionsNode(var options: ArrayList<core.game.dialogue.OptionEntry>): core.game.dialogue.DialogueNode {
|
||||
class OptionsNode(var options: ArrayList<OptionEntry>): DialogueNode {
|
||||
fun optionNames(player: Player): Array<String?> {
|
||||
return options.asSequence().filter({ it.predicate(player) }).map({ it.text }).toList().toTypedArray()
|
||||
}
|
||||
override fun handle(df: core.game.dialogue.DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
override fun handle(df: DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
val tmp: Array<String?> = optionNames(df.player!!)
|
||||
if(tmp.size > 1) {
|
||||
df.options(*tmp)
|
||||
return stage + 1
|
||||
} else if(tmp.size == 1) {
|
||||
val tmp: List<core.game.dialogue.OptionEntry> = options.asSequence().filter({ it.predicate(df.player!!) }).toList()
|
||||
val tmp: List<OptionEntry> = options.asSequence().filter({ it.predicate(df.player!!) }).toList()
|
||||
df.stage = tmp[0].nextStage
|
||||
df.handle(componentID, 0)
|
||||
return df.stage
|
||||
@@ -71,17 +71,17 @@ class OptionsNode(var options: ArrayList<core.game.dialogue.OptionEntry>): core.
|
||||
}
|
||||
}
|
||||
}
|
||||
class OptionsDispatchNode(var options: ArrayList<core.game.dialogue.OptionEntry>): core.game.dialogue.DialogueNode {
|
||||
override fun handle(df: core.game.dialogue.DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
val tmp: List<core.game.dialogue.OptionEntry> = options.asSequence().filter({ it.predicate(df.player!!) }).toList()
|
||||
class OptionsDispatchNode(var options: ArrayList<OptionEntry>): DialogueNode {
|
||||
override fun handle(df: DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
val tmp: List<OptionEntry> = options.asSequence().filter({ it.predicate(df.player!!) }).toList()
|
||||
df.stage = tmp[buttonID-1].nextStage
|
||||
df.handle(componentID, 0)
|
||||
return df.stage
|
||||
}
|
||||
}
|
||||
|
||||
class DialogueClause(val predicate: (player: Player) -> Boolean, val nodes: ArrayList<core.game.dialogue.DialogueNode>) {
|
||||
fun handle(df: core.game.dialogue.DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
class DialogueClause(val predicate: (player: Player) -> Boolean, val nodes: ArrayList<DialogueNode>) {
|
||||
fun handle(df: DialogueFile, componentID: Int, buttonID: Int, stage: Int): Int {
|
||||
if(stage < nodes.size) {
|
||||
return nodes[stage].handle(df, componentID, buttonID, stage)
|
||||
} else {
|
||||
@@ -90,59 +90,59 @@ class DialogueClause(val predicate: (player: Player) -> Boolean, val nodes: Arra
|
||||
}
|
||||
}
|
||||
|
||||
class DialogueOptionsBuilder(var target: core.game.dialogue.DialogueBuilderFile, val clauseIndex: Int, var options: ArrayList<core.game.dialogue.OptionEntry>) {
|
||||
fun option(value: String): core.game.dialogue.DialogueBuilder {
|
||||
options.add(core.game.dialogue.OptionEntry(value, target.data[clauseIndex].nodes.size))
|
||||
return core.game.dialogue.DialogueBuilder(target, clauseIndex)
|
||||
class DialogueOptionsBuilder(var target: DialogueBuilderFile, val clauseIndex: Int, var options: ArrayList<OptionEntry>) {
|
||||
fun option(value: String): DialogueBuilder {
|
||||
options.add(OptionEntry(value, target.data[clauseIndex].nodes.size))
|
||||
return DialogueBuilder(target, clauseIndex)
|
||||
}
|
||||
|
||||
fun optionIf(value: String, predicate: (Player) -> Boolean): core.game.dialogue.DialogueBuilder {
|
||||
options.add(core.game.dialogue.OptionEntry(value, target.data[clauseIndex].nodes.size, predicate))
|
||||
return core.game.dialogue.DialogueBuilder(target, clauseIndex)
|
||||
fun optionIf(value: String, predicate: (Player) -> Boolean): DialogueBuilder {
|
||||
options.add(OptionEntry(value, target.data[clauseIndex].nodes.size, predicate))
|
||||
return DialogueBuilder(target, clauseIndex)
|
||||
}
|
||||
}
|
||||
|
||||
class DialogueBuilder(var target: core.game.dialogue.DialogueBuilderFile, var clauseIndex: Int = -1) {
|
||||
fun onPredicate(predicate: (player: Player) -> Boolean): core.game.dialogue.DialogueBuilder {
|
||||
target.data.add(core.game.dialogue.DialogueClause(predicate, ArrayList()))
|
||||
class DialogueBuilder(var target: DialogueBuilderFile, var clauseIndex: Int = -1) {
|
||||
fun onPredicate(predicate: (player: Player) -> Boolean): DialogueBuilder {
|
||||
target.data.add(DialogueClause(predicate, ArrayList()))
|
||||
clauseIndex = target.data.size - 1
|
||||
return this
|
||||
}
|
||||
fun onQuestStages(name: String, vararg stages: Int): core.game.dialogue.DialogueBuilder {
|
||||
fun onQuestStages(name: String, vararg stages: Int): DialogueBuilder {
|
||||
return onPredicate() { player ->
|
||||
val questStage = player.questRepository.getStage(name)
|
||||
return@onPredicate stages.contains(questStage)
|
||||
}
|
||||
}
|
||||
fun playerl(value: String): core.game.dialogue.DialogueBuilder {
|
||||
target.data[clauseIndex].nodes.add(core.game.dialogue.PlayerLNode(value))
|
||||
fun playerl(value: String): DialogueBuilder {
|
||||
target.data[clauseIndex].nodes.add(PlayerLNode(value))
|
||||
return this
|
||||
}
|
||||
fun npcl(value: String): core.game.dialogue.DialogueBuilder {
|
||||
target.data[clauseIndex].nodes.add(core.game.dialogue.NpcLNode(value))
|
||||
fun npcl(value: String): DialogueBuilder {
|
||||
target.data[clauseIndex].nodes.add(NpcLNode(value))
|
||||
return this
|
||||
}
|
||||
fun npc(vararg values: String): core.game.dialogue.DialogueBuilder {
|
||||
target.data[clauseIndex].nodes.add(core.game.dialogue.NpcNode(values as Array<String>))
|
||||
fun npc(vararg values: String): DialogueBuilder {
|
||||
target.data[clauseIndex].nodes.add(NpcNode(values as Array<String>))
|
||||
return this
|
||||
}
|
||||
fun endWith(f: (Player) -> Unit) {
|
||||
target.data[clauseIndex].nodes.add(core.game.dialogue.ClosureNode({ player ->
|
||||
target.data[clauseIndex].nodes.add(ClosureNode({ player ->
|
||||
f(player)
|
||||
return@ClosureNode END_DIALOGUE
|
||||
}))
|
||||
}
|
||||
fun end() {
|
||||
target.data[clauseIndex].nodes.add(core.game.dialogue.ClosureNode({ _ ->
|
||||
target.data[clauseIndex].nodes.add(ClosureNode({ _ ->
|
||||
return@ClosureNode END_DIALOGUE
|
||||
}))
|
||||
}
|
||||
fun options(): core.game.dialogue.DialogueOptionsBuilder {
|
||||
var options: ArrayList<core.game.dialogue.OptionEntry> = ArrayList()
|
||||
val node = core.game.dialogue.OptionsNode(options)
|
||||
val dispatchNode = core.game.dialogue.OptionsDispatchNode(options)
|
||||
fun options(): DialogueOptionsBuilder {
|
||||
var options: ArrayList<OptionEntry> = ArrayList()
|
||||
val node = OptionsNode(options)
|
||||
val dispatchNode = OptionsDispatchNode(options)
|
||||
target.data[clauseIndex].nodes.add(node)
|
||||
target.data[clauseIndex].nodes.add(dispatchNode)
|
||||
return core.game.dialogue.DialogueOptionsBuilder(target, clauseIndex, options)
|
||||
return DialogueOptionsBuilder(target, clauseIndex, options)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ import core.tools.START_DIALOGUE
|
||||
abstract class DialogueFile {
|
||||
var player: Player? = null
|
||||
var npc: NPC? = null
|
||||
var interpreter: core.game.dialogue.DialogueInterpreter? = null
|
||||
var interpreter: DialogueInterpreter? = null
|
||||
open var stage = START_DIALOGUE
|
||||
var dialoguePlugin: core.game.dialogue.DialoguePlugin? = null
|
||||
var dialoguePlugin: DialoguePlugin? = null
|
||||
|
||||
abstract fun handle(componentID: Int, buttonID: Int)
|
||||
|
||||
fun load(player: Player, npc: NPC?, interpreter: core.game.dialogue.DialogueInterpreter): DialogueFile {
|
||||
fun load(player: Player, npc: NPC?, interpreter: DialogueInterpreter): DialogueFile {
|
||||
this.player = player
|
||||
this.npc = npc
|
||||
this.interpreter = interpreter
|
||||
@@ -29,7 +29,7 @@ abstract class DialogueFile {
|
||||
if (npc != null) {
|
||||
return interpreter!!.sendDialogues(
|
||||
npc,
|
||||
if (npc!!.id > 8591) core.game.dialogue.FacialExpression.OLD_NORMAL else core.game.dialogue.FacialExpression.FRIENDLY,
|
||||
if (npc!!.id > 8591) FacialExpression.OLD_NORMAL else FacialExpression.FRIENDLY,
|
||||
*messages
|
||||
)
|
||||
}
|
||||
@@ -37,10 +37,10 @@ abstract class DialogueFile {
|
||||
}
|
||||
|
||||
open fun npc(id: Int, vararg messages: String?): Component? {
|
||||
return interpreter!!.sendDialogues(id, core.game.dialogue.FacialExpression.FRIENDLY, *messages)
|
||||
return interpreter!!.sendDialogues(id, FacialExpression.FRIENDLY, *messages)
|
||||
}
|
||||
|
||||
open fun npc(expression: core.game.dialogue.FacialExpression?, vararg messages: String?): Component? {
|
||||
open fun npc(expression: FacialExpression?, vararg messages: String?): Component? {
|
||||
return if (npc == null) {
|
||||
interpreter!!.sendDialogues(0, expression, *messages)
|
||||
} else interpreter!!.sendDialogues(npc, expression, *messages)
|
||||
@@ -50,7 +50,7 @@ abstract class DialogueFile {
|
||||
return interpreter!!.sendDialogues(player, null, *messages)
|
||||
}
|
||||
|
||||
open fun player(expression: core.game.dialogue.FacialExpression?, vararg messages: String?): Component? {
|
||||
open fun player(expression: FacialExpression?, vararg messages: String?): Component? {
|
||||
return interpreter!!.sendDialogues(player, expression, *messages)
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ abstract class DialogueFile {
|
||||
* @param expr the FacialExpression to use, located in the FacialExpression enum.
|
||||
* @param msg the message for the NPC to say
|
||||
*/
|
||||
open fun npcl(expr: core.game.dialogue.FacialExpression?, msg: String?): Component? {
|
||||
open fun npcl(expr: FacialExpression?, msg: String?): Component? {
|
||||
return npc(expr, *splitLines(msg!!))
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ abstract class DialogueFile {
|
||||
* @param expr the FacialExpression to use, located in the FacialExpression enum.
|
||||
* @param msg the message for the player to say
|
||||
*/
|
||||
open fun playerl(expr: core.game.dialogue.FacialExpression?, msg: String?): Component? {
|
||||
open fun playerl(expr: FacialExpression?, msg: String?): Component? {
|
||||
return player(expr, *splitLines(msg!!))
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ abstract class DialogueFile {
|
||||
if(interpreter != null) interpreter!!.close()
|
||||
}
|
||||
|
||||
open fun sendNormalDialogue(entity: Entity?, expression: core.game.dialogue.FacialExpression?, vararg messages: String?) {
|
||||
open fun sendNormalDialogue(entity: Entity?, expression: FacialExpression?, vararg messages: String?) {
|
||||
interpreter!!.sendDialogues(entity, expression, *messages)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ package core.game.dialogue
|
||||
* Topic/IfTopic system backported from my personal project
|
||||
* @author Ceikry
|
||||
*/
|
||||
open class Topic<T>(val expr: core.game.dialogue.FacialExpression, val text: String, val toStage: T, val skipPlayer: Boolean = false) {
|
||||
constructor(text: String, toStage: T, skipPlayer: Boolean = false) : this(core.game.dialogue.FacialExpression.ASKING, text, toStage, skipPlayer)
|
||||
open class Topic<T>(val expr: FacialExpression, val text: String, val toStage: T, val skipPlayer: Boolean = false) {
|
||||
constructor(text: String, toStage: T, skipPlayer: Boolean = false) : this(FacialExpression.ASKING, text, toStage, skipPlayer)
|
||||
}
|
||||
class IfTopic<T>(expr: core.game.dialogue.FacialExpression, text: String, toStage: T, val showCondition: Boolean, skipPlayer: Boolean = false) : Topic<T>(expr, text, toStage, skipPlayer) {
|
||||
constructor(text: String, toStage: T, showCondition: Boolean, skipPlayer: Boolean = false) : this(core.game.dialogue.FacialExpression.ASKING, text, toStage, showCondition, skipPlayer)
|
||||
class IfTopic<T>(expr: FacialExpression, text: String, toStage: T, val showCondition: Boolean, skipPlayer: Boolean = false) : Topic<T>(expr, text, toStage, skipPlayer) {
|
||||
constructor(text: String, toStage: T, showCondition: Boolean, skipPlayer: Boolean = false) : this(FacialExpression.ASKING, text, toStage, showCondition, skipPlayer)
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.tools.START_DIALOGUE
|
||||
|
||||
class EmptyPlugin(player: Player? = null,val file: DialogueFile?) : core.game.dialogue.DialoguePlugin(player) {
|
||||
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
|
||||
class EmptyPlugin(player: Player? = null,val file: DialogueFile?) : DialoguePlugin(player) {
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return EmptyPlugin(player,null)
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ class GrandExchange : StartupListener, Commands {
|
||||
|
||||
private fun canUpdatePriceIndex(seller: GrandExchangeOffer, buyer: GrandExchangeOffer): Boolean {
|
||||
if(seller.playerUID == buyer.playerUID) return false
|
||||
if(!ServerConstants.BOTS_INFLUENCE_PRICE_INDEX && (seller.isBot || buyer.isBot)) return false;
|
||||
if(!ServerConstants.BOTS_INFLUENCE_PRICE_INDEX && (seller.isBot || buyer.isBot)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package core.game.interaction
|
||||
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.world.GameWorld
|
||||
|
||||
typealias UseWithExecutor = (Player, Node, Node, Int) -> Boolean
|
||||
typealias InteractExecutor = (Player, Node, Int) -> Boolean
|
||||
|
||||
@@ -439,7 +439,7 @@ abstract class CombatSwingHandler(var type: CombatStyle?) {
|
||||
if (!(state.targets.size == 1 && state.targets[0] == state)) {
|
||||
for (s in state.targets) {
|
||||
if (s != null && s != state) {
|
||||
adjustBattleState(entity, victim, s);
|
||||
adjustBattleState(entity, victim, s)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -651,7 +651,7 @@ abstract class CombatSwingHandler(var type: CombatStyle?) {
|
||||
for(x2 in 0 until victim!!.size()) {
|
||||
for(y2 in 0 until victim!!.size()) {
|
||||
val dst = victim!!.location.transform(x2, y2, 0)
|
||||
val path = Pathfinder.PROJECTILE.find(src, 1, dst, 1, 1, 0, 0, 0, false, RegionManager::getClippingFlag)
|
||||
val path = PROJECTILE.find(src, 1, dst, 1, 1, 0, 0, 0, false, RegionManager::getClippingFlag)
|
||||
if(path.isSuccessful && (!checkClose || path.points.size <= 1)) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ open class MagicSwingHandler (vararg flags: SwingHandlerFlag)
|
||||
if (entity is Player && !flags.contains(SwingHandlerFlag.IGNORE_PRAYER_BOOSTS_ACCURACY)) {
|
||||
prayer += entity.prayer.getSkillBonus(Skills.MAGIC)
|
||||
}
|
||||
val additional = getSetMultiplier(entity, Skills.MAGIC);
|
||||
val additional = getSetMultiplier(entity, Skills.MAGIC)
|
||||
val effective = floor(level * prayer * additional + spellBonus)
|
||||
val bonus =
|
||||
if (!flags.contains(SwingHandlerFlag.IGNORE_STAT_BOOSTS_ACCURACY))
|
||||
|
||||
@@ -137,7 +137,7 @@ open class MeleeSwingHandler (vararg flags: SwingHandlerFlag)
|
||||
if(entity is Player && SkillcapePerks.isActive(SkillcapePerks.PRECISION_STRIKES, entity)){ //Attack skillcape perk
|
||||
effectiveAttackLevel += 6
|
||||
}
|
||||
effectiveAttackLevel *= getSetMultiplier(entity, Skills.ATTACK);
|
||||
effectiveAttackLevel *= getSetMultiplier(entity, Skills.ATTACK)
|
||||
effectiveAttackLevel = floor(effectiveAttackLevel)
|
||||
|
||||
if (!flags.contains(SwingHandlerFlag.IGNORE_STAT_BOOSTS_ACCURACY))
|
||||
|
||||
@@ -47,7 +47,7 @@ open class RangeSwingHandler (vararg flags: SwingHandlerFlag)
|
||||
distance += 2
|
||||
}
|
||||
if (entity is Player) {
|
||||
val rw = RangeWeapon.get(entity.getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId());
|
||||
val rw = RangeWeapon.get(entity.getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId())
|
||||
if(rw != null && (rw.weaponType == WeaponType.DOUBLE_SHOT || rw.weaponType == WeaponType.DEGRADING)) {
|
||||
// Dark bow and crystal bow have a 10-square range, independent of whether longrange stance is used
|
||||
distance = 10
|
||||
|
||||
@@ -102,7 +102,7 @@ class PlayerSaver (val player: Player){
|
||||
for(key in player.gameAttributes.savedAttributes){
|
||||
val value = player.gameAttributes.attributes[key]
|
||||
value ?: continue
|
||||
val isExpirable = player.gameAttributes.keyExpirations.containsKey(key);
|
||||
val isExpirable = player.gameAttributes.keyExpirations.containsKey(key)
|
||||
val attr = JSONObject()
|
||||
val type = when(value){
|
||||
is Int -> "int"
|
||||
|
||||
@@ -198,7 +198,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
|
||||
.enableOptions(0 until 9)
|
||||
.build()
|
||||
player.packetDispatch.sendIfaceSettings(settings, 0, 621, 0, 28)
|
||||
player.packetDispatch.sendRunScript(150, "IviiiIsssssssss", "", "", "", "", "Sell X", "Sell 10", "Sell 5", "Sell 1", "Value", -1, 0, 7, 4, 93, 621 shl 16);
|
||||
player.packetDispatch.sendRunScript(150, "IviiiIsssssssss", "", "", "", "", "Sell X", "Sell 10", "Sell 5", "Sell 1", "Value", -1, 0, 7, 4, 93, 621 shl 16)
|
||||
return@onOpen true
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class MapDumpCommand : CommandPlugin() {
|
||||
LocationObjectMap[value] = locations
|
||||
}
|
||||
}
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
private fun findObj(player: Player?, args: List<String>?) {
|
||||
@@ -76,7 +76,7 @@ class MapDumpCommand : CommandPlugin() {
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -496,6 +496,6 @@ class VisualCommand : CommandPlugin() {
|
||||
return true
|
||||
}*/
|
||||
}
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ import core.plugin.Initializable
|
||||
* Rotten Potato -> Player interaction dialogue
|
||||
* @author Ceikry
|
||||
*/
|
||||
class RPUseWithPlayerDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
|
||||
class RPUseWithPlayerDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
var other: Player? = null
|
||||
val ID = 38575796
|
||||
|
||||
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return RPUseWithPlayerDialogue(player)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class RottenPotatoOptionHandler : OptionHandler() {
|
||||
for(option in ROTTEN_POTATO_OPTIONS) {
|
||||
ItemDefinition.forId(Items.ROTTEN_POTATO_5733).handlers["option:${option.toLowerCase()}"] = this
|
||||
}
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(player: Player?, node: Node?, option: String?): Boolean {
|
||||
|
||||
@@ -146,7 +146,7 @@ class FunCommandSet : CommandSet(Privilege.ADMIN) {
|
||||
*/
|
||||
define("dumpappearance", Privilege.MODERATOR){ player, _ ->
|
||||
val json = JSONObject()
|
||||
PlayerSaver(player).saveAppearance(json);
|
||||
PlayerSaver(player).saveAppearance(json)
|
||||
val equipJson = PlayerSaver(player).saveContainer(player.equipment)
|
||||
json["equipment"] = equipJson
|
||||
val jsonString = json.toJSONString()
|
||||
|
||||
@@ -596,7 +596,7 @@ class MiscCommandSet : CommandSet(Privilege.ADMIN){
|
||||
}
|
||||
|
||||
define("rules", Privilege.STANDARD, "", "Shows the rules."){ player, _ ->
|
||||
RulesAndInfo.setBaseRulesAndInfo(player);
|
||||
RulesAndInfo.setBaseRulesAndInfo(player)
|
||||
player.packetDispatch.sendInterfaceConfig(384, 17, true)
|
||||
openInterface(player, 384)
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ class ModelViewerCommandSet : CommandSet(Privilege.ADMIN) {
|
||||
const val ATTRIBUTE_YAW = "modelYaw"
|
||||
|
||||
private fun display(player: Player, pageNum: Int, buttonID: Int) : Boolean {
|
||||
BookInterface.clearBookLines(player, BookInterface.FANCY_BOOK_2_27, BookInterface.FANCY_BOOK_2_27_LINE_IDS);
|
||||
BookInterface.clearButtons(player, BookInterface.FANCY_BOOK_2_27, BookInterface.FANCY_BOOK_2_27_BUTTON_IDS);
|
||||
BookInterface.setTitle(player, BookInterface.FANCY_BOOK_2_27, BookInterface.FANCY_BOOK_2_27_LINE_IDS, TITLE);
|
||||
BookInterface.clearBookLines(player, BookInterface.FANCY_BOOK_2_27, BookInterface.FANCY_BOOK_2_27_LINE_IDS)
|
||||
BookInterface.clearButtons(player, BookInterface.FANCY_BOOK_2_27, BookInterface.FANCY_BOOK_2_27_BUTTON_IDS)
|
||||
BookInterface.setTitle(player, BookInterface.FANCY_BOOK_2_27, BookInterface.FANCY_BOOK_2_27_LINE_IDS, TITLE)
|
||||
|
||||
// Custom button interfaces for model book
|
||||
// These are non-standard. No pages are "turned" here.
|
||||
|
||||
@@ -19,8 +19,8 @@ class ShopParser{
|
||||
fun openUid(player: Player,uid: Int): Boolean {
|
||||
/* val shop = UID_SHOPS[uid] ?: return false;
|
||||
shop.open(player);*/
|
||||
return true;
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
fun load(){
|
||||
|
||||
@@ -9,7 +9,7 @@ import core.game.node.entity.skill.Skills
|
||||
import core.game.system.timer.*
|
||||
import core.game.event.*
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
import org.rs09.consts.Items
|
||||
|
||||
class SkillRestore : RSTimer (1, "skillrestore", isAuto = true, isSoft = true) {
|
||||
val ticksSinceLastRestore = IntArray (25)
|
||||
@@ -28,7 +28,7 @@ class SkillRestore : RSTimer (1, "skillrestore", isAuto = true, isSoft = true) {
|
||||
val current = getDynLevel (entity, i)
|
||||
|
||||
if (current != max)
|
||||
skills.updateLevel (i, if (current < max) 1 else -1, max);
|
||||
skills.updateLevel (i, if (current < max) 1 else -1, max)
|
||||
}
|
||||
ticksSinceLastRestore[i] = 0
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package core.game.system.timer.impl
|
||||
|
||||
import core.api.*
|
||||
import core.game.system.timer.*
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
import org.json.simple.*
|
||||
import core.game.system.timer.PersistTimer
|
||||
import core.game.system.timer.RSTimer
|
||||
import core.game.system.timer.TimerFlag
|
||||
|
||||
class Skulled : PersistTimer (1, "skulled", flags = arrayOf(TimerFlag.ClearOnDeath)) {
|
||||
override fun onRegister (entity: Entity) {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package core.game.system.timer.impl
|
||||
|
||||
import core.game.system.timer.*
|
||||
import core.api.*
|
||||
import core.api.sendMessage
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
import org.json.simple.*
|
||||
import core.game.system.timer.PersistTimer
|
||||
import core.game.system.timer.RSTimer
|
||||
import core.game.system.timer.TimerFlag
|
||||
|
||||
class Teleblock : PersistTimer (1, "teleblock", flags = arrayOf(TimerFlag.ClearOnDeath)) {
|
||||
override fun run (entity: Entity) : Boolean {
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.lang.management.ManagementFactory
|
||||
|
||||
class DeadlockDetector : Runnable {
|
||||
override fun run() {
|
||||
val mbean = ManagementFactory.getThreadMXBean();
|
||||
val mbean = ManagementFactory.getThreadMXBean()
|
||||
val deadLockedThreads = mbean.findDeadlockedThreads()
|
||||
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ internal constructor() : Pathfinder() {
|
||||
var queue = PriorityQueue(4096, UIntAsPointComparator(end))
|
||||
queue.add(((curX.toUInt()) shl 8) or (curY.toUInt()))
|
||||
while(!foundPath && !queue.isEmpty()) {
|
||||
val point = queue.poll();
|
||||
val point = queue.poll()
|
||||
val curCost = ((point and 0xff0000u) shr 16).toInt()
|
||||
curX = ((point and 0x0000ff00u) shr 8).toInt()
|
||||
curY = (point and 0x000000ffu).toInt()
|
||||
@@ -324,7 +324,7 @@ internal constructor() : Pathfinder() {
|
||||
if(0 <= newSceneX && newSceneX < 104 && 0 <= newSceneY && newSceneY < 104 && via[newSceneX][newSceneY] == 0) {
|
||||
if(dir.canMoveFrom(z, absX, absY, clipMaskSupplier)) {
|
||||
val diagonalPenalty = Math.abs(dir.stepX) + Math.abs(dir.stepY) - 1
|
||||
val flag = flagForDirection(dir);
|
||||
val flag = flagForDirection(dir)
|
||||
check(newSceneX, newSceneY, flag, newCost, diagonalPenalty)
|
||||
if(via[newSceneX][newSceneY] == flag) {
|
||||
queue.add(((newCost + diagonalPenalty).toUInt() shl 16) or (newSceneX.toUInt() shl 8) or newSceneY.toUInt())
|
||||
|
||||
@@ -113,7 +113,7 @@ class DisconnectionQueue {
|
||||
fun add(player: Player, clear: Boolean = false) {
|
||||
if(queue[player.name] != null) return
|
||||
queue[player.name] = DisconnectionEntry(player, clear)
|
||||
log(this::class.java, Log.INFO, "Queueing ${player.name} for disconnection.");
|
||||
log(this::class.java, Log.INFO, "Queueing ${player.name} for disconnection.")
|
||||
}
|
||||
|
||||
operator fun contains(name: String?): Boolean {
|
||||
|
||||
@@ -143,7 +143,7 @@ object Repository {
|
||||
val oldPl = players[i]
|
||||
players.remove(oldPl)
|
||||
oldPl.clear()
|
||||
break;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ enum class EFlagType {
|
||||
NPC;
|
||||
companion object {
|
||||
@JvmStatic fun of (e: Entity) : EFlagType {
|
||||
if (e is core.game.node.entity.player.Player) return EFlagType.Player
|
||||
else return EFlagType.NPC
|
||||
if (e is core.game.node.entity.player.Player) return Player
|
||||
else return NPC
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ class EasterBunnyDialogueFile(val NEED_BASKET : Boolean) : DialogueFile() {
|
||||
if(NEED_BASKET){
|
||||
when(stage++){
|
||||
0 -> npc("Hello, adventurer! Thank goodness you're here!")
|
||||
1 -> player(core.game.dialogue.FacialExpression.THINKING,"Thanks goodness I'M here?")
|
||||
1 -> player(FacialExpression.THINKING,"Thanks goodness I'M here?")
|
||||
2 -> npc("Yes, yes, I need your help, you see!")
|
||||
3 -> npc("I have lost ALL of my eggs. What a terrible thing.")
|
||||
4 -> npc("Us easter bunnies rely on EGGS to live.")
|
||||
5 -> npc("Take this basket, please, and do me a kindness.")
|
||||
6 -> player(core.game.dialogue.FacialExpression.THINKING,"What kindness might that be?")
|
||||
6 -> player(FacialExpression.THINKING,"What kindness might that be?")
|
||||
7 -> npc("I need you to try and gather up as many of my","lost eggs as you can.")
|
||||
8 -> npc("Please, for me? I will reward you for your time.")
|
||||
9 -> player("Fine, I suppose I will.")
|
||||
@@ -39,8 +39,8 @@ class EasterBunnyDialogueFile(val NEED_BASKET : Boolean) : DialogueFile() {
|
||||
when (stage) {
|
||||
0 -> options("Ask about rewards", "Ask about egg location").also { stage++ }
|
||||
1 -> when (buttonID) {
|
||||
1 -> player(core.game.dialogue.FacialExpression.THINKING, "What kind of rewards can I claim?").also { stage = 10 }
|
||||
2 -> player(core.game.dialogue.FacialExpression.THINKING, "Where were some eggs last seen?").also { stage = 20 }
|
||||
1 -> player(FacialExpression.THINKING, "What kind of rewards can I claim?").also { stage = 10 }
|
||||
2 -> player(FacialExpression.THINKING, "Where were some eggs last seen?").also { stage = 20 }
|
||||
}
|
||||
|
||||
10 -> {
|
||||
|
||||
@@ -755,7 +755,7 @@ enum class Decoders530(val opcode: Int) {
|
||||
val showGroundDeco = (prefs shr 5) and 1 == 1
|
||||
val selectiveRoofs = (prefs shr 4) and 1 == 1
|
||||
val allLayersVisible = (prefs shr 3) and 1 == 1
|
||||
val brightness = prefs and 0x7;
|
||||
val brightness = prefs and 0x7
|
||||
//added in the above so that we don't have to figure it out later, not doing more
|
||||
//because we currently have genuinely no use for this information.
|
||||
return Packet.PlayerPrefsUpdate(player, prefs)
|
||||
|
||||
@@ -130,7 +130,7 @@ object Login {
|
||||
fun proceedWith(session: IoSession, details: PlayerDetails, opcode: Int) {
|
||||
if (Repository.uid_map.contains(details.uid)) {
|
||||
session.write(AuthResponse.AlreadyOnline)
|
||||
return;
|
||||
return
|
||||
}
|
||||
details.session = session
|
||||
details.info.translate(UIDInfo(details.ipAddress, "DEPRECATED", "DEPRECATED", "DEPRECATED"))
|
||||
|
||||
@@ -150,7 +150,7 @@ object ClassScanner {
|
||||
definePlugin(clazz)
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
log(this::class.java, Log.ERR, "Failed to load plugin ${p.name}.");
|
||||
log(this::class.java, Log.ERR, "Failed to load plugin ${p.name}.")
|
||||
|
||||
if (t is NoSuchMethodException && p.superclass.simpleName == core.game.dialogue.DialoguePlugin::class.simpleName) {
|
||||
log(this::class.java, Log.ERR,
|
||||
|
||||
Reference in New Issue
Block a user