diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/Character.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/Character.kt index 13f67409b..e571da619 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/Character.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/Character.kt @@ -6,15 +6,21 @@ import world.gregs.voidps.engine.client.variable.Variables import world.gregs.voidps.engine.entity.Entity import world.gregs.voidps.engine.entity.character.mode.Mode import world.gregs.voidps.engine.entity.character.mode.move.Steps +import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.npc.NPC import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.appearance +import world.gregs.voidps.engine.entity.character.player.movementType import world.gregs.voidps.engine.entity.character.player.skill.level.Levels import world.gregs.voidps.engine.event.EventDispatcher import world.gregs.voidps.engine.queue.ActionQueue import world.gregs.voidps.engine.suspend.Suspension import world.gregs.voidps.engine.timer.Timers import world.gregs.voidps.network.login.protocol.visual.Visuals +import world.gregs.voidps.network.login.protocol.visual.update.player.MoveType +import world.gregs.voidps.type.Delta +import world.gregs.voidps.type.Direction +import world.gregs.voidps.type.Tile import kotlin.coroutines.Continuation interface Character : Entity, Variable, EventDispatcher, Comparable { @@ -33,6 +39,36 @@ interface Character : Entity, Variable, EventDispatcher, Comparable { override fun compareTo(other: Character): Int { return index.compareTo(other.index) } + + /** + * Gradually move the characters appeared location to [delta] over [delay] time + */ + fun exactMove(delta: Delta, delay: Int = tile.distanceTo(tile.add(delta)) * 30, direction: Direction = Direction.NONE) { + val start = tile + tele(delta) + if (this is Player) { + movementType = MoveType.Walk + } + setExactMovement(Delta.EMPTY, delay, start.delta(tile), direction = direction) + } + + /** + * Gradually move the characters appeared location to [target] over [delay] time + */ + fun exactMove(target: Tile, delay: Int = tile.distanceTo(target) * 30, direction: Direction = Direction.NONE, startDelay: Int = 0) { + val start = tile + tele(target) + if (this is Player) { + movementType = MoveType.Walk + } + setExactMovement(Delta.EMPTY, delay, start.delta(tile), startDelay, direction = direction) + } + + fun say(message: String) { + visuals.say.text = message + flagSay() + } + } val Entity.size: Int diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/Visuals.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/Visuals.kt index 6be66a036..b87af8af4 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/Visuals.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/Visuals.kt @@ -14,7 +14,6 @@ import world.gregs.voidps.engine.entity.obj.ObjectShape import world.gregs.voidps.engine.get import world.gregs.voidps.engine.suspend.SuspendableContext import world.gregs.voidps.network.login.protocol.visual.VisualMask -import world.gregs.voidps.network.login.protocol.visual.Visuals import world.gregs.voidps.network.login.protocol.visual.update.Hitsplat import world.gregs.voidps.network.login.protocol.visual.update.Turn import world.gregs.voidps.network.login.protocol.visual.update.player.MoveType @@ -27,7 +26,7 @@ fun Character.flagAnimation() = visuals.flag(if (this is Player) VisualMask.PLAY fun Character.flagColourOverlay() = visuals.flag(if (this is Player) VisualMask.PLAYER_COLOUR_OVERLAY_MASK else VisualMask.NPC_COLOUR_OVERLAY_MASK) -fun Character.flagForceChat() = visuals.flag(if (this is Player) VisualMask.PLAYER_FORCE_CHAT_MASK else VisualMask.NPC_FORCE_CHAT_MASK) +fun Character.flagSay() = visuals.flag(if (this is Player) VisualMask.PLAYER_SAY_MASK else VisualMask.NPC_SAY_MASK) fun Character.flagHits() = visuals.flag(if (this is Player) VisualMask.PLAYER_HITS_MASK else VisualMask.NPC_HITS_MASK) @@ -89,54 +88,36 @@ fun Character.colourOverlay(colour: Int, delay: Int, duration: Int) { softTimers.start("colour_overlay") } -var Character.forceChat: String - get() = visuals.forceChat.text - set(value) { - visuals.forceChat.text = value - flagForceChat() - } - -private fun getPlayerMask(index: Int) = when (index) { - 1 -> VisualMask.PLAYER_GRAPHIC_2_MASK - else -> VisualMask.PLAYER_GRAPHIC_1_MASK -} +private fun primaryGfxFlagged(character: Character) = character.visuals.flagged(if (character is Player) VisualMask.PLAYER_GRAPHIC_1_MASK else VisualMask.NPC_GRAPHIC_1_MASK) -private fun getNPCMask(index: Int) = when (index) { - 1 -> VisualMask.NPC_GRAPHIC_2_MASK - else -> VisualMask.NPC_GRAPHIC_1_MASK -} - -private fun index(character: Character) = if (character is Player) character.visuals.getIndex(::getPlayerMask) else character.visuals.getIndex(::getNPCMask) +fun Character.flagPrimaryGraphic() = visuals.flag(if (this is Player) VisualMask.PLAYER_GRAPHIC_1_MASK else VisualMask.NPC_GRAPHIC_1_MASK) -fun Character.flagGraphic(index: Int) = visuals.flag(if (this is Player) getPlayerMask(index) else getNPCMask(index)) - -private fun Visuals.getIndex(indexer: (Int) -> Int): Int { - for (i in 0 until 2) { - if (!flagged(indexer(i))) { - return i - } - } - return -1 -} +fun Character.flagSecondaryGraphic() = visuals.flag(if (this is Player) VisualMask.PLAYER_GRAPHIC_2_MASK else VisualMask.NPC_GRAPHIC_2_MASK) fun Character.setGraphic(id: String, delay: Int? = null) { val definition = get().getOrNull(id) ?: return - val index = index(this) - val graphic = if (index == 0) visuals.primaryGraphic else visuals.secondaryGraphic + val graphic = if (primaryGfxFlagged(this)) visuals.primaryGraphic else visuals.secondaryGraphic graphic.id = definition.id graphic.delay = delay ?: definition["delay", 0] val characterHeight = (this as? NPC)?.def?.get("height", 0) ?: 40 graphic.height = (characterHeight + definition["height", -1000]).coerceAtLeast(0) graphic.rotation = definition["rotation", 0] graphic.forceRefresh = definition["force_refresh", false] - flagGraphic(index) + if (primaryGfxFlagged(this)) { + flagPrimaryGraphic() + } else { + flagSecondaryGraphic() + } } fun Character.clearGraphic() { - val index = index(this) - val graphic = if (index == 0) visuals.primaryGraphic else visuals.secondaryGraphic - graphic.reset() - flagGraphic(index) + if (primaryGfxFlagged(this)) { + visuals.primaryGraphic.reset() + flagPrimaryGraphic() + } else { + visuals.secondaryGraphic.reset() + flagSecondaryGraphic() + } } fun Character.hit(source: Character, amount: Int, mark: Hitsplat.Mark, delay: Int = 0, critical: Boolean = false, soak: Int = -1) { @@ -196,34 +177,6 @@ fun Character.setExactMovement( flagExactMovement() } -fun Character.setExactMove(delta: Delta, delay: Int = tile.distanceTo(tile.add(delta)) * 30, direction: Direction = Direction.NONE) { - val start = tile - tele(delta) - if (this is Player) { - movementType = MoveType.Walk - } - setExactMovement(Delta.EMPTY, delay, start.delta(tile), direction = direction) -} - -context(SuspendableContext<*>) suspend fun Character.exactMove(delta: Delta, delay: Int = tile.distanceTo(tile.add(delta)) * 30, direction: Direction = Direction.NONE) { - character.setExactMove(delta, delay, direction) - delay(delay / 30) -} - -fun Character.setExactMove(target: Tile, delay: Int = tile.distanceTo(target) * 30, direction: Direction = Direction.NONE, startDelay: Int = 0) { - val start = tile - tele(target) - if (this is Player) { - movementType = MoveType.Walk - } - setExactMovement(Delta.EMPTY, delay, start.delta(tile), startDelay, direction = direction) -} - -context(SuspendableContext<*>) suspend fun Character.exactMove(target: Tile, delay: Int = tile.distanceTo(target) * 30, direction: Direction = Direction.NONE, startDelay: Int = 0) { - character.setExactMove(target, delay, direction, startDelay) - delay((startDelay + delay) / 30) -} - val Character.turn: Delta get() = Tile(visuals.turn.targetX, visuals.turn.targetY, tile.level).delta(tile) diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/player/PlayerVisuals.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/player/PlayerVisuals.kt index fe02dc4c2..611ee427f 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/player/PlayerVisuals.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/player/PlayerVisuals.kt @@ -58,11 +58,10 @@ var Player.headIcon: Int headIcon = value } -var Player.renderEmote: String - get() = get().get(appearance.emote).stringId - set(value) = flag { - emote = get().get(value).id - } +fun Player.renderEmote(id: String) = flag { + val definition = get().get(id) + appearance.emote = definition.id +} fun Player.clearRenderEmote() = flag { emote = 1426 diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/suspend/SuspendableContext.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/suspend/SuspendableContext.kt index a7a4dcfb2..91378f66f 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/suspend/SuspendableContext.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/suspend/SuspendableContext.kt @@ -3,6 +3,9 @@ package world.gregs.voidps.engine.suspend import kotlinx.coroutines.suspendCancellableCoroutine import world.gregs.voidps.engine.entity.character.Character import world.gregs.voidps.engine.event.Context +import world.gregs.voidps.type.Delta +import world.gregs.voidps.type.Direction +import world.gregs.voidps.type.Tile interface SuspendableContext : Context { /** @@ -25,4 +28,20 @@ interface SuspendableContext : Context { character.delay = it } } + + /** + * Delay until the appeared location of the character has moved [delta] in [delay] time + */ + suspend fun Character.exactMoveDelay(delta: Delta, delay: Int = tile.distanceTo(tile.add(delta)) * 30, direction: Direction = Direction.NONE) { + character.exactMove(delta, delay, direction) + delay(delay / 30) + } + + /** + * Delay until the appeared location of the character has moved to [target] in [delay] time + */ + suspend fun Character.exactMoveDelay(target: Tile, delay: Int = tile.distanceTo(target) * 30, direction: Direction = Direction.NONE, startDelay: Int = 0) { + character.exactMove(target, delay, direction, startDelay) + delay((startDelay + delay) / 30) + } } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/dnd/shootingstar/ShootingStar.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/dnd/shootingstar/ShootingStar.kts index c72830e8b..1918bd932 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/dnd/shootingstar/ShootingStar.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/dnd/shootingstar/ShootingStar.kts @@ -10,7 +10,6 @@ import world.gregs.voidps.engine.data.Settings import world.gregs.voidps.engine.data.definition.data.Rock import world.gregs.voidps.engine.data.settingsReload import world.gregs.voidps.engine.entity.World -import world.gregs.voidps.engine.entity.character.setExactMove import world.gregs.voidps.engine.entity.character.mode.interact.Interact import world.gregs.voidps.engine.entity.character.move.walkTo import world.gregs.voidps.engine.entity.character.npc.NPC @@ -120,7 +119,7 @@ fun startCrashedStarEvent() { for (player in under) { player.damage(random.nextInt(10, 50)) val direction = Direction.all.first { !player.blocked(it) } - player.setExactMove(direction.delta, 1, direction = direction.inverse()) + player.exactMove(direction.delta, 1, direction = direction.inverse()) player.setAnimation("step_back_startled") } World.queue("falling_star_object_removal", 1) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/BarbarianAdvanced.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/BarbarianAdvanced.kts index 5bbc3beb5..163bf4372 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/BarbarianAdvanced.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/BarbarianAdvanced.kts @@ -1,7 +1,5 @@ package world.gregs.voidps.world.activity.skill.agility.course -import world.gregs.voidps.engine.entity.character.exactMove -import world.gregs.voidps.engine.entity.character.setExactMove import world.gregs.voidps.engine.entity.character.face import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.move.walkTo @@ -25,7 +23,7 @@ objectOperate("Run-up", "barbarian_outpost_run_wall") { player.setAnimation("barbarian_wall_jump_climb") delay(7) player.setAnimation("barbarian_wall_jump") - player.exactMove(Tile(2538, 3545, 2), 30, Direction.NORTH) + player.exactMoveDelay(Tile(2538, 3545, 2), 30, Direction.NORTH) delay(1) player.exp(Skill.Agility, 15.0) player.agilityStage(3) @@ -53,7 +51,7 @@ objectOperate("Fire", "barbarian_outpost_spring") { delay(1) player.tele(2533, 3547, 3) player.setAnimation("barbarian_spring_shoot") - player.exactMove(Tile(2532, 3553, 3), 60, Direction.NORTH) + player.exactMoveDelay(Tile(2532, 3553, 3), 60, Direction.NORTH) target.animate("barbarian_spring_reset") delay(2) player.exp(Skill.Agility, 15.0) @@ -65,8 +63,8 @@ objectOperate("Cross", "barbarian_outpost_balance_beam") { delay() player.setAnimation("circus_cartwheel") delay() - player.exactMove(Tile(2536, 3553, 3), 45, Direction.EAST) - player.renderEmote = "beam_balance" + player.exactMoveDelay(Tile(2536, 3553, 3), 45, Direction.EAST) + player.renderEmote("beam_balance") delay() player.exp(Skill.Agility, 15.0) player.agilityStage(6) @@ -85,9 +83,9 @@ objectOperate("Jump-over", "barbarian_outpost_gap") { objectOperate("Slide-down", "barbarian_outpost_roof") { player.setAnimation("barbarian_slide_start") - player.exactMove(player.tile.copy(x = 2540), 30, Direction.EAST) + player.exactMoveDelay(player.tile.copy(x = 2540), 30, Direction.EAST) player.setAnimation("barbarian_slide") - player.setExactMove(player.tile.copy(x = 2543, level = 1), 90, Direction.EAST) + player.exactMove(player.tile.copy(x = 2543, level = 1), 90, Direction.EAST) delay() player.setAnimation("barbarian_slide") delay() diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/BarbarianOutpost.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/BarbarianOutpost.kts index 3d6f51f67..8d1f959ae 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/BarbarianOutpost.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/BarbarianOutpost.kts @@ -2,8 +2,6 @@ package world.gregs.voidps.world.activity.skill.agility.course import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.data.Settings -import world.gregs.voidps.engine.entity.character.exactMove -import world.gregs.voidps.engine.entity.character.setExactMove import world.gregs.voidps.engine.entity.character.face import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.move.walkOver @@ -36,7 +34,7 @@ objectOperate("Squeeze-through", "barbarian_outpost_entrance") { } player.setAnimation("climb_through_pipe") val end = if (player.tile.y >= 3560) 3558 else 3561 - player.exactMove(Tile(2552, end), 60, direction = if (player.tile.y >= 3560) Direction.SOUTH else Direction.NORTH) + player.exactMoveDelay(Tile(2552, end), 60, direction = if (player.tile.y >= 3560) Direction.SOUTH else Direction.NORTH) } objectOperate("Swing-on", "barbarian_outpost_rope_swing") { @@ -51,12 +49,12 @@ objectOperate("Swing-on", "barbarian_outpost_rope_swing") { target.animate("swing_rope") delay() if (success) { - player.setExactMove(player.tile.copy(y = 3549), 60, Direction.SOUTH) + player.exactMove(player.tile.copy(y = 3549), 60, Direction.SOUTH) delay() player.exp(Skill.Agility, 22.0) player.message("You skillfully swing across.", ChatType.Filter) } else { - player.exactMove(player.tile.copy(y = 3550), 50, Direction.SOUTH) + player.exactMoveDelay(player.tile.copy(y = 3550), 50, Direction.SOUTH) delay(1) player.tele(player.tile.copy(y = 9950)) player.damage(50) @@ -74,7 +72,7 @@ objectOperate("Walk-across", "barbarian_outpost_log_balance") { val disable = Settings["agility.disableCourseFailure", false] val success = disable || Level.success(player.levels.get(Skill.Agility), 93) // 62.1% success rate at 35 player.message("You walk carefully across the slippery log...", ChatType.Filter) - player.renderEmote = "rope_balance" + player.renderEmote("rope_balance") if (success) { player.walkOver(Tile(2541, 3546)) player.clearRenderEmote() @@ -88,7 +86,7 @@ objectOperate("Walk-across", "barbarian_outpost_log_balance") { delay() player.message("... but you lose your footing and fall into the water.", ChatType.Filter) player.tele(2545, 3545) - player.renderEmote = "tread_water" + player.renderEmote("tread_water") delay() player.walkOver(Tile(2545, 3543)) player.message("Something in the water bites you.", ChatType.Filter) @@ -114,7 +112,7 @@ objectOperate("Walk-across", "barbarian_outpost_balancing_ledge") { val disable = Settings["agility.disableCourseFailure", false] val success = disable || Level.success(player.levels.get(Skill.Agility), 93) // 62.1% success rate delay() - player.renderEmote = "ledge_balance" + player.renderEmote("ledge_balance") player.message("You put your foot on the ledge and try to edge across...", ChatType.Filter) if (success) { player.walkOver(Tile(2532, 3547, 1)) @@ -131,7 +129,7 @@ objectOperate("Walk-across", "barbarian_outpost_balancing_ledge") { delay() player.tele(2534, 3546, 1) player.face(Direction.SOUTH) - player.renderEmote = "falling" + player.renderEmote("falling") delay() player.tele(2534, 3546, 0) player.clearRenderEmote() @@ -156,7 +154,7 @@ objectOperate("Climb-over", "barbarian_outpost_crumbling_wall") { } player.message("You climb the low wall...", ChatType.Filter) player.setAnimation("climb_over_wall") - player.setExactMove(target.tile.addX(1), 60, Direction.EAST) + player.exactMove(target.tile.addX(1), 60, Direction.EAST) delay() if (target.tile.equals(2542, 3553)) { if (player.agilityStage == 5) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeAdvanced.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeAdvanced.kts index 66c6c9837..f44d5594b 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeAdvanced.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeAdvanced.kts @@ -47,10 +47,10 @@ objectApproach("Run-across", "gnome_sign_post_advanced") { player.setAnimation("gnome_wall_${if (success) "run" else "fail"}") delay(1) if (!success) { - player.exactMove(Tile(2480, 3418, 3), 30, Direction.EAST) + player.exactMoveDelay(Tile(2480, 3418, 3), 30, Direction.EAST) delay(5) } - player.exactMove(Tile(2484, 3418, 3), if (success) 60 else 210, Direction.EAST) + player.exactMoveDelay(Tile(2484, 3418, 3), if (success) 60 else 210, Direction.EAST) if (success) { player.exp(Skill.Agility, 25.0) } else { @@ -75,14 +75,14 @@ objectApproach("Swing-to", "gnome_pole_advanced") { player.face(Direction.NORTH) delay() player.setAnimation("gnome_run_up") - player.exactMove(tile.copy(y = 3421), 60, Direction.NORTH) + player.exactMoveDelay(tile.copy(y = 3421), 60, Direction.NORTH) player.setAnimation("gnome_jump") - player.exactMove(tile.copy(y = 3425), 30, Direction.NORTH) + player.exactMoveDelay(tile.copy(y = 3425), 30, Direction.NORTH) player.setAnimation("gnome_swing") delay(4) - player.exactMove(tile.copy(y = 3429), 30, Direction.NORTH) + player.exactMoveDelay(tile.copy(y = 3429), 30, Direction.NORTH) delay(4) - player.exactMove(tile.copy(y = 3432), 30, Direction.NORTH) + player.exactMoveDelay(tile.copy(y = 3432), 30, Direction.NORTH) delay(1) player.agilityStage(6) player.exp(Skill.Agility, 25.0) @@ -91,7 +91,7 @@ objectApproach("Swing-to", "gnome_pole_advanced") { objectOperate("Jump-over", "gnome_barrier_advanced") { player.setAnimation("gnome_jump_barrier") delay() - player.exactMove(Tile(2485, 3434, 3), 30, Direction.NORTH) + player.exactMoveDelay(Tile(2485, 3434, 3), 30, Direction.NORTH) delay(1) player.tele(2485, 3436, 0) player.setAnimation("gnome_pipe_land") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeAgility.kt b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeAgility.kt index d8bd70968..e0a223fd9 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeAgility.kt +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeAgility.kt @@ -1,19 +1,18 @@ package world.gregs.voidps.world.activity.skill.agility.course -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.npc.NPCs import world.gregs.voidps.type.Zone import world.gregs.voidps.type.random internal fun NPCs.gnomeTrainer(message: String, zone: Zone) { val trainer = get(zone).randomOrNull(random) ?: return - trainer.forceChat = message + trainer.say(message) } internal fun NPCs.gnomeTrainer(message: String, zones: List) { for (zone in zones) { val trainer = get(zone).randomOrNull(random) ?: continue - trainer.forceChat = message + trainer.say(message) break } } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeStronghold.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeStronghold.kts index 33bcfb88c..3a432aa0a 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeStronghold.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/GnomeStronghold.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.activity.skill.agility.course import world.gregs.voidps.engine.client.message -import world.gregs.voidps.engine.entity.character.exactMove import world.gregs.voidps.engine.entity.character.face import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.move.walkOver @@ -23,7 +22,7 @@ val npcs: NPCs by inject() objectOperate("Walk-across", "gnome_log_balance") { player.agilityCourse("gnome") npcs.gnomeTrainer("Okay get over that log, quick quick!", listOf(Zone(878901), Zone(878900), Zone(876852))) - player.renderEmote = "rope_balance" + player.renderEmote("rope_balance") player.message("You walk carefully across the slippery log...", ChatType.Filter) player.walkOver(Tile(2474, 3429)) player.clearRenderEmote() @@ -57,7 +56,7 @@ objectOperate("Climb", "gnome_tree_branch_up") { objectOperate("Walk-on", "gnome_balancing_rope") { npcs.gnomeTrainer("Come on scaredy cat, get across that rope!", Zone(9263413)) - player.renderEmote = "rope_balance" + player.renderEmote("rope_balance") player.walkOver(Tile(2483, 3420, 2)) player.agilityStage(4) player.clearRenderEmote() @@ -66,7 +65,7 @@ objectOperate("Walk-on", "gnome_balancing_rope") { } objectOperate("Walk-on", "gnome_balancing_rope_end") { - player.renderEmote = "rope_balance" + player.renderEmote("rope_balance") player.walkOver(Tile(2477, 3420, 2)) player.clearRenderEmote() player.exp(Skill.Agility, 7.5) @@ -101,11 +100,11 @@ objectOperate("Squeeze-through", "gnome_obstacle_pipe_*") { player.message("You pull yourself through the pipes..", ChatType.Filter) delay() player.setAnimation("climb_through_pipe") - player.exactMove(target.tile.addY(2)) + player.exactMoveDelay(target.tile.addY(2)) player.face(Direction.NORTH) player.tele(target.tile.addY(3)) player.setAnimation("climb_through_pipe", delay = 1) - player.exactMove(target.tile.addY(6)) + player.exactMoveDelay(target.tile.addY(6)) if (player.agilityStage == 6) { player.agilityStage = 0 player.inc("gnome_course_laps") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/WildernessCourse.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/WildernessCourse.kts index 05ed9df9f..4550f8e66 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/WildernessCourse.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/agility/course/WildernessCourse.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.activity.skill.agility.course import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.data.Settings -import world.gregs.voidps.engine.entity.character.exactMove import world.gregs.voidps.engine.entity.character.face import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.move.walkOver @@ -44,7 +43,7 @@ objectOperate("Open", "wilderness_agility_door_closed") { val success = true//disable || Level.success(player.levels.get(Skill.Agility), 200..250) player.message("You go through the gate and try to edge over the ridge...", ChatType.Filter) enterDoor(target, delay = 1) - player.renderEmote = "beam_balance" + player.renderEmote("beam_balance") // if (!success) { // fallIntoPit() // return@strongQueue @@ -74,7 +73,7 @@ objectOperate("Open", "wilderness_agility_gate_east_closed", "wilderness_agility player.message("You go through the gate and try to edge over the ridge...", ChatType.Filter) player.walkTo(player.tile.copy(x = player.tile.x.coerceIn(2997, 2998))) enterDoor(target) - player.renderEmote = "beam_balance" + player.renderEmote("beam_balance") if (!success) { fallIntoPit() return@objectOperate @@ -98,7 +97,7 @@ suspend fun SuspendableContext.fallIntoPit() { player.setAnimation("rope_walk_fall_down") player.message("You lose your footing and fall into the wolf pit.", ChatType.Filter) delay() - player.exactMove(Tile(3001, 3923), 25, Direction.SOUTH) + player.exactMoveDelay(Tile(3001, 3923), 25, Direction.SOUTH) } objectOperate("Squeeze-through", "wilderness_obstacle_pipe") { @@ -110,11 +109,11 @@ objectOperate("Squeeze-through", "wilderness_obstacle_pipe") { player.walkTo(target.tile.addY(-1)) } player.setAnimation("climb_through_pipe", delay = 30) - player.exactMove(Tile(3004, 3940), startDelay = 30, delay = 96, direction = Direction.NORTH) + player.exactMoveDelay(Tile(3004, 3940), startDelay = 30, delay = 96, direction = Direction.NORTH) player.tele(3004, 3947) delay() player.setAnimation("climb_through_pipe", delay = 30) - player.exactMove(Tile(3004, 3950), startDelay = 30, delay = 96, direction = Direction.NORTH) + player.exactMoveDelay(Tile(3004, 3950), startDelay = 30, delay = 96, direction = Direction.NORTH) player.exp(Skill.Agility, 12.5) player.agilityStage(1) } @@ -129,11 +128,11 @@ objectOperate("Swing-on", "wilderness_rope_swing") { target.animate("swing_rope") delay() if (success) { - player.exactMove(player.tile.copy(y = 3958), 60, Direction.NORTH) + player.exactMoveDelay(player.tile.copy(y = 3958), 60, Direction.NORTH) player.exp(Skill.Agility, 20.0) player.message("You skillfully swing across.", ChatType.Filter) } else { - player.exactMove(player.tile.copy(y = 3957), 50, Direction.NORTH) + player.exactMoveDelay(player.tile.copy(y = 3957), 50, Direction.NORTH) delay(1) player.tele(3004, 10357) player.damage((player.levels.get(Skill.Constitution) * 0.15).toInt() + 10) @@ -149,7 +148,7 @@ objectOperate("Cross", "wilderness_stepping_stone") { for (i in 0..5) { player.setAnimation("stepping_stone_jump") player.playSound("jump") - player.exactMove(target.tile.addX(-i), delay = 30, direction = Direction.WEST, startDelay = 15) + player.exactMoveDelay(target.tile.addX(-i), delay = 30, direction = Direction.WEST, startDelay = 15) delay(1) if (i == 2 && !Settings["agility.disableCourseFailure", false] && !Level.success(player.levels.get(Skill.Agility), 180..250)) { player.setAnimation("rope_walk_fall_down") @@ -176,7 +175,7 @@ objectOperate("Walk-across", "wilderness_log_balance") { val success = disable || Level.success(player.levels.get(Skill.Agility), 200..250) if (success) { player.walkOver(target.tile) - player.renderEmote = "beam_balance" + player.renderEmote("beam_balance") player.walkOver(Tile(2994, 3945)) player.message("You skillfully edge across the gap.", type = ChatType.Filter) player.clearRenderEmote() @@ -185,7 +184,7 @@ objectOperate("Walk-across", "wilderness_log_balance") { player.agilityStage(4) } else { player.walkOver(target.tile) - player.renderEmote = "beam_balance" + player.renderEmote("beam_balance") player.walkOver(Tile(2998, 3945)) player.message("You slip and fall onto the spikes below.", type = ChatType.Filter) player.setAnimation("rope_walk_fall_down") @@ -206,7 +205,7 @@ objectOperate("Walk-across", "wilderness_log_balance") { objectOperate("Climb", "wilderness_agility_rocks") { player.message("You walk carefully across the slippery log...", ChatType.Filter) - player.renderEmote = "climbing" + player.renderEmote("climbing") player.walkOver(player.tile.copy(y = 3933)) player.clearRenderEmote() player.message("You reach the top.", type = ChatType.Filter) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/prayer/BoneBurying.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/prayer/BoneBurying.kts index a86519877..be30df374 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/prayer/BoneBurying.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/prayer/BoneBurying.kts @@ -6,6 +6,7 @@ import world.gregs.voidps.engine.client.variable.hasClock import world.gregs.voidps.engine.client.variable.start import world.gregs.voidps.engine.entity.character.player.chat.ChatType import world.gregs.voidps.engine.entity.character.player.skill.Skill +import world.gregs.voidps.engine.entity.character.player.skill.exp.exp import world.gregs.voidps.engine.entity.character.setAnimation import world.gregs.voidps.engine.inv.inventory import world.gregs.voidps.engine.inv.remove @@ -32,7 +33,7 @@ inventoryOption("Bury", "inventory") { } player.start("bone_delay", 1) player.setAnimation("bend_down") - player.experience.add(Skill.Prayer, xp) + player.exp(Skill.Prayer, xp) player["i_wonder_if_itll_sprout_task"] = true player.weakQueue("bury", 1, onCancel = null) { player.message("You bury the ${item.def.name.lowercase()}.", ChatType.Filter) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/EssenceMine.kt b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/EssenceMine.kt index be10950c4..13da433e6 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/EssenceMine.kt +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/EssenceMine.kt @@ -3,7 +3,6 @@ package world.gregs.voidps.world.activity.skill.runecrafting import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.data.definition.AreaDefinitions import world.gregs.voidps.engine.entity.character.face -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.npc.NPC import world.gregs.voidps.engine.entity.character.player.Player @@ -18,7 +17,7 @@ import world.gregs.voidps.world.interact.entity.proj.shoot object EssenceMine { fun teleport(npc: NPC, player: Player) { - npc.forceChat = "Senventior Disthine Molenko!" + npc.say("Senventior Disthine Molenko!") npc.setGraphic("curse_cast") npc.face(player) if (!npc.contains("old_model")) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/thieving/Pickpocketing.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/thieving/Pickpocketing.kts index 9fd485f53..5a5ce7166 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/thieving/Pickpocketing.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/thieving/Pickpocketing.kts @@ -7,7 +7,6 @@ import world.gregs.voidps.engine.data.definition.AnimationDefinitions import world.gregs.voidps.engine.data.definition.data.Pocket import world.gregs.voidps.engine.entity.World import world.gregs.voidps.engine.entity.character.face -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.npc.NPC import world.gregs.voidps.engine.entity.character.npc.npcApproach import world.gregs.voidps.engine.entity.character.player.Player @@ -59,7 +58,7 @@ npcApproach("Pickpocket") { player.exp(Skill.Thieving, pocket.xp) } else { target.face(player) - target.forceChat = pocket.caughtMessage + target.say(pocket.caughtMessage) target.setAnimation(NPCAttack.animation(target, animationDefinitions)) player.message("You fail to pick the ${name}'s pocket.", ChatType.Filter) target.stun(player, pocket.stunTicks, pocket.stunHit) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/command/debug/NPCUpdatingCommands.kts b/game/src/main/kotlin/world/gregs/voidps/world/command/debug/NPCUpdatingCommands.kts index 388bb0eac..662c3a19c 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/command/debug/NPCUpdatingCommands.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/command/debug/NPCUpdatingCommands.kts @@ -45,7 +45,7 @@ adminCommand("npcoverlay") { adminCommand("npcchat") { val npc = npcs[player.tile.addY(1)].first() - npc.forceChat = "Testing" + npc.say("Testing") } adminCommand("npcgfx") { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/command/debug/PlayerUpdatingCommands.kts b/game/src/main/kotlin/world/gregs/voidps/world/command/debug/PlayerUpdatingCommands.kts index f9579ce02..fb8e8921e 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/command/debug/PlayerUpdatingCommands.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/command/debug/PlayerUpdatingCommands.kts @@ -41,8 +41,8 @@ adminCommand("anim (anim-id)", "perform animation by int or string id (-1 to cle adminCommand("emote (emote-id)", "perform render emote by int or string id (-1 to clear)") { when (content) { - "-1", "" -> player.renderEmote = "human_stand" - else -> player.renderEmote = content + "-1", "" -> player.renderEmote("human_stand") + else -> player.renderEmote(content) } } @@ -66,7 +66,7 @@ adminCommand("overlay") { } adminCommand("chat (message)", "force a chat message over players head") { - player.forceChat = content + player.say(content) } adminCommand("move") { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/npc/Cows.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/npc/Cows.kts index e8232c564..31132b619 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/npc/Cows.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/npc/Cows.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.npc import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.client.ui.interact.itemOnNPCOperate -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.mode.EmptyMode import world.gregs.voidps.engine.entity.character.setAnimation import world.gregs.voidps.engine.entity.npcSpawn @@ -21,7 +20,7 @@ npcTimerStart("eat_grass") { npc -> npcTimerTick("eat_grass") { npc -> if (npc.mode == EmptyMode) { - npc.forceChat = "Moo" + npc.say("Moo") npc.setAnimation("cow_eat_grass") } } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/npc/move/Ducklings.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/npc/move/Ducklings.kts index c8c07ede0..7dd2fd4b5 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/npc/move/Ducklings.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/npc/move/Ducklings.kts @@ -1,6 +1,5 @@ package world.gregs.voidps.world.interact.entity.npc.move -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.mode.EmptyMode import world.gregs.voidps.engine.entity.character.mode.Follow import world.gregs.voidps.engine.entity.character.mode.Wander @@ -25,7 +24,7 @@ fun isDuck(it: NPC) = it.id.startsWith("duck") && it.id.endsWith("swim") npcDeath("duck*swim") { npc -> val ducklings: NPC = npc["ducklings"] ?: return@npcDeath - ducklings.forceChat = "Eek!" + ducklings.say("Eek!") followParent(ducklings) } @@ -41,9 +40,9 @@ npcTimerTick("follow_parent") { npc -> npc.mode = Follow(npc, parent) parent["ducklings"] = npc if (random.nextInt(300) < 1) { - parent.forceChat = "Quack?" + parent.say("Quack?") npc.softQueue("quack", 1) { - npc.forceChat = if (random.nextBoolean()) "Cheep Cheep!" else "Eep!" + npc.say(if (random.nextBoolean()) "Cheep Cheep!" else "Eep!") } } cancel() diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/drink/Tea.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/drink/Tea.kts index 0cbd6bf0e..d1b9b0974 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/drink/Tea.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/drink/Tea.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.consume.drink import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.client.ui.interact.itemOnItem -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.inv.charges import world.gregs.voidps.engine.inv.discharge @@ -54,7 +53,7 @@ inventoryItem("Drink", "tea_flask") { return@inventoryItem } - player.forceChat = "Ahhh, tea is so refreshing!" + player.say("Ahhh, tea is so refreshing!") player.levels.boost(Skill.Attack, 3) player.levels.restore(Skill.Constitution, 30) player.message("You take a drink from the flask...") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/food/Kebab.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/food/Kebab.kts index 7aeacc02f..da6bd53fd 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/food/Kebab.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/food/Kebab.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.consume.food import world.gregs.voidps.engine.client.message -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.player.chat.ChatType import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.type.random @@ -48,6 +47,6 @@ val phrases = listOf("Lovely!", "Scrummy!", "Delicious!", "Yum!") consume("ugthanki_kebab") { player -> if (player.levels.get(Skill.Constitution) != player.levels.getMax(Skill.Constitution)) { - player.forceChat = phrases.random() + player.say(phrases.random()) } } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/Vengeance.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/Vengeance.kts index 842ce8363..51f9e2cbb 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/Vengeance.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/Vengeance.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.client.variable.remaining import world.gregs.voidps.engine.client.variable.start import world.gregs.voidps.engine.client.variable.stop import world.gregs.voidps.engine.data.definition.SpellDefinitions -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.entity.character.setAnimation import world.gregs.voidps.engine.entity.character.setGraphic @@ -43,7 +42,7 @@ combatHit { player -> if (!player.contains("vengeance") || type == "damage" || damage < 4) { return@combatHit } - player.forceChat = "Taste vengeance!" + player.say("Taste vengeance!") player.hit(target = source, type = "damage", delay = 0, damage = (damage * 0.75).toInt()) player.stop("vengeance") } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonBattleaxe.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonBattleaxe.kts index 897e124eb..2eafbd1ca 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonBattleaxe.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonBattleaxe.kts @@ -1,6 +1,5 @@ package world.gregs.voidps.world.interact.entity.player.combat.melee.special -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.entity.character.setAnimation import world.gregs.voidps.engine.entity.character.setGraphic @@ -16,7 +15,7 @@ specialAttackPrepare("rampage") { player -> player.setAnimation("${id}_special") player.setGraphic("${id}_special") player.playSound("${id}_special") - player.forceChat = "Raarrrrrgggggghhhhhhh!" + player.say("Raarrrrrgggggghhhhhhh!") player.levels.drain(Skill.Attack, multiplier = 0.10) player.levels.drain(Skill.Defence, multiplier = 0.10) player.levels.drain(Skill.Magic, multiplier = 0.10) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/Excalibur.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/Excalibur.kts index d7f5aeede..4487f4fd9 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/Excalibur.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/Excalibur.kts @@ -1,6 +1,5 @@ package world.gregs.voidps.world.interact.entity.player.combat.melee.special -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.entity.character.setAnimation @@ -25,7 +24,7 @@ specialAttackPrepare("sanctuary") { player -> player.setAnimation("${id}_special") player.setGraphic("${id}_special") player.playSound("${id}_special") - player.forceChat = "For Camelot!" + player.say("For Camelot!") if (player.weapon.id.startsWith("enhanced")) { player.levels.boost(Skill.Defence, multiplier = 0.15) player[id] = TimeUnit.SECONDS.toTicks(if (seersVillageEliteTasks(player)) 24 else 12) / 4 diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/SpearShove.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/SpearShove.kts index 7ea4a9917..0a4e5b93e 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/SpearShove.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/SpearShove.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.melee.special import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.client.variable.hasClock -import world.gregs.voidps.engine.entity.character.setExactMove import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.setAnimation import world.gregs.voidps.engine.entity.character.setGraphic @@ -41,6 +40,6 @@ specialAttack("shove") { player -> val direction = target.tile.delta(actual).toDirection() val delta = direction.delta if (!target.blocked(direction)) { - target.setExactMove(delta, 30, direction.inverse()) + target.exactMove(delta, 30, direction.inverse()) } } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/display/tab/ItemEmotes.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/display/tab/ItemEmotes.kts index 00c1de202..c1931e75e 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/display/tab/ItemEmotes.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/display/tab/ItemEmotes.kts @@ -214,12 +214,12 @@ inventoryItem("Play-with", "toy_horsey_*") { player.message("Please wait till you've finished performing your current emote.") return@inventoryItem } - player.forceChat = when (random.nextInt(0, 3)) { + player.say(when (random.nextInt(0, 3)) { 0 -> "Come on Dobbin, we can win the race!" 1 -> "Hi-ho Silver, and away!" else -> "Neaahhhyyy! Giddy-up horsey!" - } -// player.forceChat = "Just say neigh to gambling!" + }) +// player.say("Just say neigh to gambling!") player.animate("emote_${item.id}") } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/ardougne/WizardCromperty.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/ardougne/WizardCromperty.kts index e8ee5e8b3..4f03c7f16 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/ardougne/WizardCromperty.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/ardougne/WizardCromperty.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.map.ardougne import world.gregs.voidps.engine.client.message -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.npc.NPCOption import world.gregs.voidps.engine.entity.character.npc.npcOperate @@ -77,7 +76,7 @@ fun ChoiceBuilder>.teleportMe() { npc("Okey dokey! Ready?") player.setGraphic("curse_hit") target.setGraphic("curse_cast") - target.forceChat = "Dipsolum sententa sententi!" + target.say("Dipsolum sententa sententi!") target.shoot("curse", player.tile, offset = 64) player.softQueue("cromperty_teleport", 2) { player.tele(2649, 3271) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/falador/MakeoverMage.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/falador/MakeoverMage.kts index 636d4921f..495e735ac 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/falador/MakeoverMage.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/falador/MakeoverMage.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.client.ui.event.interfaceClose import world.gregs.voidps.engine.client.ui.event.interfaceOpen import world.gregs.voidps.engine.client.ui.interfaceOption import world.gregs.voidps.engine.data.definition.EnumDefinitions -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.npc.NPCOption import world.gregs.voidps.engine.entity.character.npc.NPCs import world.gregs.voidps.engine.entity.character.npc.npcOperate @@ -222,6 +221,6 @@ npcTimerTick("makeover") { npc -> npc.setGraphic("curse_hit", delay = 15) npc.setAnimation("bind_staff") npc.softQueue("transform", 1) { - npc.forceChat = if (toFemale) "Ooh!" else "Aha!" + npc.say(if (toFemale) "Ooh!" else "Aha!") } } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/karamja/BartenderZambo.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/karamja/BartenderZambo.kts index 378220fa5..12fbf9db3 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/karamja/BartenderZambo.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/karamja/BartenderZambo.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.map.karamja import world.gregs.voidps.engine.client.ui.interact.itemOnNPCOperate -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.mode.interact.TargetInteraction import world.gregs.voidps.engine.entity.character.npc.NPC import world.gregs.voidps.engine.entity.character.npc.npcOperate @@ -37,6 +36,6 @@ itemOnNPCOperate("barcrawl_card", "bartender_zambo") { suspend fun TargetInteraction.barCrawl() = barCrawlDrink( effects = { - player.forceChat = "Mmmmm, dat was luverly..." + player.say("Mmmmm, dat was luverly...") } ) \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/Hans.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/Hans.kts index 6f5e68f7f..e6e10bfbb 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/Hans.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/Hans.kts @@ -1,6 +1,5 @@ package world.gregs.voidps.world.map.lumbridge -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.mode.Retreat import world.gregs.voidps.engine.entity.character.npc.npcOperate import world.gregs.voidps.world.interact.dialogue.EvilLaugh @@ -16,7 +15,7 @@ npcOperate("Talk-to", "hans") { npc("Who, the Duke? He's in his study, on the first floor.") } option("I have come to kill everyone in this castle!") { - target.forceChat = "Help! Help!" + target.say("Help! Help!") target.mode = Retreat(target, player) } option("I don't know. I'm lost. Where am I?") { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/LumbridgeChurch.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/LumbridgeChurch.kts index e44a02e3d..f0def4809 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/LumbridgeChurch.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/LumbridgeChurch.kts @@ -8,7 +8,6 @@ import world.gregs.voidps.engine.client.ui.interact.itemOnObjectOperate import world.gregs.voidps.engine.entity.character.animate import world.gregs.voidps.engine.event.Context import world.gregs.voidps.engine.entity.character.face -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.mode.interact.Interaction import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.npc.NPCs @@ -100,9 +99,9 @@ suspend fun Interaction.returnSkull() { player.turnCamera(Tile(3248, 3193).add(offset), 320) delay(2) player.face(Direction.NORTH) - restlessGhost.forceChat = "Release! Thank you" + restlessGhost.say("Release! Thank you") delay(4) - restlessGhost.forceChat = "stranger." + restlessGhost.say("stranger.") restlessGhost.animate("restless_ghost_ascends") restlessGhost.shoot("restless_ghost", Tile(3243, 3193).add(offset), height = 20, endHeight = 0, flightTime = 50) delay(2) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/LumbridgeFlag.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/LumbridgeFlag.kts index 648f4e154..ada342bdd 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/LumbridgeFlag.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/LumbridgeFlag.kts @@ -1,14 +1,13 @@ package world.gregs.voidps.world.map.lumbridge import world.gregs.voidps.engine.entity.character.animate -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.obj.objectOperate objectOperate("Raise", "lumbridge_flag") { target.animate("lumbridge_flag") player.animate("lumbridge_flag_raise") player.animate("lumbridge_flag_stop_raise") - player.forceChat = "All Hail the Duke!" + player.say("All Hail the Duke!") player.animate("emote_salute") player["raise_the_roof_task"] = true } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/port_sarim/BartenderRustyAnchor.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/port_sarim/BartenderRustyAnchor.kts index 1eae50ef2..761682056 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/port_sarim/BartenderRustyAnchor.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/port_sarim/BartenderRustyAnchor.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.map.port_sarim import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.client.ui.interact.itemOnNPCOperate -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.mode.interact.TargetInteraction import world.gregs.voidps.engine.entity.character.npc.NPC import world.gregs.voidps.engine.entity.character.npc.npcOperate @@ -49,6 +48,6 @@ suspend fun TargetInteraction.barCrawl() = barCrawlDrink( npc("Ok one Black Skull Ale coming up, 8 coins please.") }, effects = { - player.forceChat = "Hiccup!" + player.say("Hiccup!") } ) \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/BartenderBlueMoonInn.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/BartenderBlueMoonInn.kts index 619b82d4d..2494f8388 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/BartenderBlueMoonInn.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/BartenderBlueMoonInn.kts @@ -3,7 +3,6 @@ package world.gregs.voidps.world.map.varrock import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.client.ui.interact.itemOnNPCApproach import world.gregs.voidps.engine.data.Settings -import world.gregs.voidps.engine.entity.character.forceChat import world.gregs.voidps.engine.entity.character.mode.interact.TargetInteraction import world.gregs.voidps.engine.entity.character.npc.NPC import world.gregs.voidps.engine.entity.character.npc.npcApproach @@ -75,6 +74,6 @@ suspend fun TargetInteraction.barCrawl() = barCrawlDrink( player.levels.drain(Skill.Strength, 6) player.levels.drain(Skill.Smithing, 6) player.damage(0) - player.forceChat = "Blearrgh!" + player.say("Blearrgh!") } ) \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/Delrith.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/Delrith.kts index 6374be519..564348fd6 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/Delrith.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/Delrith.kts @@ -160,7 +160,7 @@ suspend fun SuspendableContext.cutscene() { player.moveCamera(Tile(3231, 3376).add(offset), 475, 1, 1) npc("denath", "Arise, O mighty Delrith! Bring destruction to this soft, weak city!") for (wizard in wizards) { - wizard.forceChat = "Arise, Delrith!" + wizard.say("Arise, Delrith!") } npc("dark_wizard_water", "Arise, Delrith!", title = "Dark wizards") @@ -250,7 +250,7 @@ npcOperate("*", "delrith") { val selected = words[choice - 1] val suffix = if (index == 4) "!" else "..." val text = "$selected$suffix" - player.forceChat = text + player.say(text) player(text, largeHead = true, clickToContinue = false) val expected = DemonSlayerSpell.getWord(player, index + 1) if (selected != expected) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/abyss/MageOfZamorak.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/abyss/MageOfZamorak.kts index 6eaa4685e..a722ab47a 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/abyss/MageOfZamorak.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/abyss/MageOfZamorak.kts @@ -278,7 +278,7 @@ fun teleport(player: Player, target: NPC) { target.setGraphic("tele_other") target.setAnimation("tele_other") player.playSound("tele_other_cast") - target.forceChat = "Veniens! Sallakar! Rinnesset!" + target.say("Veniens! Sallakar! Rinnesset!") delay(2) player.setAnimation("lunar_teleport") player.setGraphic("tele_other_receive") diff --git a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/Encoders.kt b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/Encoders.kt index a57009b16..73458c810 100644 --- a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/Encoders.kt +++ b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/Encoders.kt @@ -1,7 +1,7 @@ package world.gregs.voidps.network.login.protocol import world.gregs.voidps.network.login.protocol.visual.* -import world.gregs.voidps.network.login.protocol.visual.encode.ForceChatEncoder +import world.gregs.voidps.network.login.protocol.visual.encode.SayEncoder import world.gregs.voidps.network.login.protocol.visual.encode.WatchEncoder import world.gregs.voidps.network.login.protocol.visual.encode.npc.* import world.gregs.voidps.network.login.protocol.visual.encode.player.* @@ -9,7 +9,7 @@ import world.gregs.voidps.network.login.protocol.visual.encode.player.* fun playerVisualEncoders() = castOf( WatchEncoder(VisualMask.PLAYER_WATCH_MASK), PlayerTimeBarEncoder(), - ForceChatEncoder(VisualMask.PLAYER_FORCE_CHAT_MASK), + SayEncoder(VisualMask.PLAYER_SAY_MASK), PlayerHitsEncoder(), PlayerTurnEncoder(), PlayerExactMovementEncoder(), @@ -31,7 +31,7 @@ fun npcVisualEncoders() = castOf( NPCColourOverlayEncoder(), NPCHitsEncoder(), WatchEncoder(VisualMask.NPC_WATCH_MASK), - ForceChatEncoder(VisualMask.NPC_FORCE_CHAT_MASK), + SayEncoder(VisualMask.NPC_SAY_MASK), NPCTimeBarEncoder(), NPCSecondaryGraphicEncoder() ) diff --git a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/VisualMask.kt b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/VisualMask.kt index fe053dc9a..aba88edd2 100644 --- a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/VisualMask.kt +++ b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/VisualMask.kt @@ -4,7 +4,7 @@ object VisualMask { // Players const val PLAYER_WATCH_MASK = 0x1 const val PLAYER_TIME_BAR_MASK = 0x400 - const val PLAYER_FORCE_CHAT_MASK = 0x1000 + const val PLAYER_SAY_MASK = 0x1000 const val PLAYER_HITS_MASK = 0x4 const val PLAYER_TURN_MASK = 0x2 const val PLAYER_EXACT_MOVEMENT_MASK = 0x2000 @@ -25,7 +25,7 @@ object VisualMask { const val NPC_COLOUR_OVERLAY_MASK = 0x2000 const val NPC_HITS_MASK = 0x40 const val NPC_WATCH_MASK = 0x80 - const val NPC_FORCE_CHAT_MASK = 0x1 + const val NPC_SAY_MASK = 0x1 const val NPC_TIME_BAR_MASK = 0x800 const val NPC_GRAPHIC_2_MASK = 0x400 } \ No newline at end of file diff --git a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/Visuals.kt b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/Visuals.kt index e6f49c48c..f91652fcd 100644 --- a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/Visuals.kt +++ b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/Visuals.kt @@ -19,7 +19,7 @@ abstract class Visuals(index: Int) { val timeBar = TimeBar() val turn = Turn() val watch = Watch() - val forceChat = ForceChat() + val say = Say() val hits = Hits(self = index) fun flag(mask: Int) { @@ -42,7 +42,7 @@ abstract class Visuals(index: Int) { hits.clear() turn.clear() watch.clear() - forceChat.clear() + say.clear() timeBar.clear() secondaryGraphic.clear() } diff --git a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/encode/ForceChatEncoder.kt b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/encode/SayEncoder.kt similarity index 72% rename from network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/encode/ForceChatEncoder.kt rename to network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/encode/SayEncoder.kt index 7e6535349..10d23cee3 100644 --- a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/encode/ForceChatEncoder.kt +++ b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/encode/SayEncoder.kt @@ -4,10 +4,10 @@ import world.gregs.voidps.buffer.write.Writer import world.gregs.voidps.network.login.protocol.visual.VisualEncoder import world.gregs.voidps.network.login.protocol.visual.Visuals -class ForceChatEncoder(mask: Int) : VisualEncoder(mask) { +class SayEncoder(mask: Int) : VisualEncoder(mask) { override fun encode(writer: Writer, visuals: Visuals) { - writer.writeString(visuals.forceChat.text) + writer.writeString(visuals.say.text) } } \ No newline at end of file diff --git a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/ForceChat.kt b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/Say.kt similarity index 82% rename from network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/ForceChat.kt rename to network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/Say.kt index d56082c5f..1007a572d 100644 --- a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/ForceChat.kt +++ b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/Say.kt @@ -2,7 +2,7 @@ package world.gregs.voidps.network.login.protocol.visual.update import world.gregs.voidps.network.login.protocol.Visual -data class ForceChat(var text: String = "") : Visual { +data class Say(var text: String = "") : Visual { override fun needsReset(): Boolean { return text.isNotEmpty() }