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 e571da619..6b200781c 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 @@ -3,6 +3,7 @@ package world.gregs.voidps.engine.entity.character import org.rsmod.game.pathfinder.collision.CollisionStrategy import world.gregs.voidps.engine.client.variable.Variable import world.gregs.voidps.engine.client.variable.Variables +import world.gregs.voidps.engine.data.definition.GraphicDefinitions 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 @@ -13,9 +14,11 @@ 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.get 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.VisualMask 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 @@ -43,32 +46,69 @@ interface Character : Entity, Variable, EventDispatcher, Comparable { /** * 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 + fun exactMove(delta: Delta, delay: Int = tile.distanceTo(tile.add(delta)) * 30, direction: Direction = Direction.NONE, startDelay: Int = 0) { tele(delta) if (this is Player) { movementType = MoveType.Walk } - setExactMovement(Delta.EMPTY, delay, start.delta(tile), direction = direction) + val startDelta = delta.invert() + visuals.exactMovement.apply { + startX = startDelta.x + startY = startDelta.y + this.startDelay = startDelay + endX = 0 + endY = 0 + endDelay = delay + this.direction = direction.ordinal + } + flagExactMovement() } /** * 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) + exactMove(target.delta(tile), delay, direction, startDelay) } + /** + * Force a message to be displayed above character + */ fun say(message: String) { visuals.say.text = message flagSay() } + /** + * Apply [id] graphical effect (aka spotanim) to the character with optional [delay] + * @see GraphicDefinitions for adjusting height, rotation and refresh + */ + fun gfx(id: String, delay: Int? = null) { + val definition = get().getOrNull(id) ?: return + val mask = if (this is Player) VisualMask.PLAYER_GRAPHIC_1_MASK else VisualMask.NPC_GRAPHIC_1_MASK + val graphic = if (visuals.flagged(mask)) 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] + if (visuals.flagged(mask)) { + flagPrimaryGraphic() + } else { + flagSecondaryGraphic() + } + } + + /** + * Remove any graphical effects in progress + */ + fun clearGfx() { + visuals.primaryGraphic.reset() + flagPrimaryGraphic() + visuals.secondaryGraphic.reset() + flagSecondaryGraphic() + } } 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 b87af8af4..0cc018e59 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 @@ -1,13 +1,10 @@ package world.gregs.voidps.engine.entity.character import world.gregs.voidps.engine.data.definition.AnimationDefinitions -import world.gregs.voidps.engine.data.definition.GraphicDefinitions import world.gregs.voidps.engine.entity.Entity -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.Skill import world.gregs.voidps.engine.entity.obj.GameObject import world.gregs.voidps.engine.entity.obj.ObjectShape @@ -16,7 +13,6 @@ import world.gregs.voidps.engine.suspend.SuspendableContext import world.gregs.voidps.network.login.protocol.visual.VisualMask 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 import world.gregs.voidps.type.Delta import world.gregs.voidps.type.Direction import world.gregs.voidps.type.Distance @@ -94,31 +90,6 @@ fun Character.flagPrimaryGraphic() = visuals.flag(if (this is Player) VisualMask 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 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] - if (primaryGfxFlagged(this)) { - flagPrimaryGraphic() - } else { - flagSecondaryGraphic() - } -} - -fun Character.clearGraphic() { - 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) { val after = (levels.get(Skill.Constitution) - amount).coerceAtLeast(0) @@ -151,32 +122,6 @@ fun Character.clearWatch() { private fun watchIndex(character: Character) = if (character is Player) character.index or 0x8000 else character.index -/** - * @param endDelta The delta position to move towards - * @param endDelay Number of client ticks to take moving - * @param startDelta The delta position to start at - * @param startDelay Client ticks until starting the movement - * @param direction The cardinal direction to face during movement - */ -fun Character.setExactMovement( - endDelta: Delta = Delta.EMPTY, - endDelay: Int = 0, - startDelta: Delta = Delta.EMPTY, - startDelay: Int = 0, - direction: Direction = Direction.NONE -) { - val move = visuals.exactMovement - check(endDelay > startDelay) { "End delay ($endDelay) must be after start delay ($startDelay)." } - move.startX = startDelta.x - move.startY = startDelta.y - move.startDelay = startDelay - move.endX = endDelta.x - move.endY = endDelta.y - move.endDelay = endDelay - move.direction = direction.ordinal - flagExactMovement() -} - val Character.turn: Delta get() = Tile(visuals.turn.targetX, visuals.turn.targetY, tile.level).delta(tile) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/achievement/ExplorersRing.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/achievement/ExplorersRing.kts index 9b7ddbff6..9d8d7f0a9 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/achievement/ExplorersRing.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/achievement/ExplorersRing.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.activity.achievement import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.engine.inv.discharge import world.gregs.voidps.engine.inv.inventory @@ -21,7 +20,7 @@ playerSpawn { player -> inventoryOption("Run-replenish", "explorers_ring_*") { if (player.inventory.discharge(player, slot)) { player.setAnimation("run_replenish") - player.setGraphic("run_replenish") + player.gfx("run_replenish") player.runEnergy += MAX_RUN_ENERGY / 2 player["explorers_ring_last_use"] = TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis()) player.message("You feel refreshed as the ring revitalises you and a charge is used up.") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/ItemOnItems.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/ItemOnItems.kts index 056009e21..09f35a78e 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/ItemOnItems.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/ItemOnItems.kts @@ -17,7 +17,6 @@ import world.gregs.voidps.engine.entity.character.player.skill.exp.exp import world.gregs.voidps.engine.entity.character.player.skill.level.Level import world.gregs.voidps.engine.entity.character.player.skill.level.Level.has import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.inv.Inventory import world.gregs.voidps.engine.inv.inventory @@ -93,7 +92,7 @@ fun useItemOnItem( player.setAnimation(def.animation) } if (def.graphic.isNotEmpty()) { - player.setGraphic(def.graphic) + player.gfx(def.graphic) } if (def.sound.isNotEmpty()) { player.playSound(def.sound) 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 13da433e6..0b9a11f39 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 @@ -7,7 +7,6 @@ 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.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.get import world.gregs.voidps.engine.inv.inventory import world.gregs.voidps.engine.inv.replace @@ -18,12 +17,12 @@ import world.gregs.voidps.world.interact.entity.proj.shoot object EssenceMine { fun teleport(npc: NPC, player: Player) { npc.say("Senventior Disthine Molenko!") - npc.setGraphic("curse_cast") + npc.gfx("curse_cast") npc.face(player) if (!npc.contains("old_model")) { npc.setAnimation("curse") } - player.setGraphic("curse_hit") + player.gfx("curse_hit") player.shoot("curse", player.tile) player.softQueue("essence_mine_teleport", 3) { player["last_npc_teleport_to_rune_essence_mine"] = npc.id diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/RuneEssenceMine.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/RuneEssenceMine.kts index 26fcf64ae..9a288198f 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/RuneEssenceMine.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/RuneEssenceMine.kts @@ -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.move.tele -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.obj.objectOperate import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.queue.softQueue @@ -13,7 +12,7 @@ val areas: AreaDefinitions by inject() objectOperate("Enter", "rune_essence_exit_portal") { player.message("You step through the portal...") - player.setGraphic("curse_hit", delay = 30) + player.gfx("curse_hit", delay = 30) target.tile.shoot("curse", player.tile) player.softQueue("essence_mine_exit", 3) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/Runecrafting.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/Runecrafting.kts index 9efa0cec8..caf4efe31 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/Runecrafting.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/runecrafting/Runecrafting.kts @@ -20,7 +20,6 @@ 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.player.skill.level.Level.has import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.obj.objectOperate import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.inv.* @@ -67,7 +66,7 @@ fun Runecrafting.bindRunes(player: Player, id: String, itemDefinition: ItemDefin TransactionError.None -> { player.exp(Skill.Runecrafting, rune.xp * essence) player.setAnimation("bind_runes") - player.setGraphic("bind_runes") + player.gfx("bind_runes") player.playSound("bind_runes") player.message("You bind the temple's power into ${id.toSentenceCase().plural()}.", ChatType.Filter) } @@ -127,7 +126,7 @@ itemOnObjectOperate("*_rune", "*_altar") { } } player.setAnimation("bind_runes") - player.setGraphic("bind_runes") + player.gfx("bind_runes") player.playSound("bind_runes") if (successes != count) { player.message("You partially succeed to bind the temple's power into $combination runes.", ChatType.Filter) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/smithing/SuperheatItem.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/smithing/SuperheatItem.kts index bc8677216..0c7557721 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/smithing/SuperheatItem.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/skill/smithing/SuperheatItem.kts @@ -8,7 +8,6 @@ import world.gregs.voidps.engine.data.definition.data.Smelting import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.entity.character.player.skill.level.Level.has import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.inv.inventory import world.gregs.voidps.engine.inv.transact.TransactionError @@ -42,7 +41,7 @@ itemOnItem(fromInterface = "modern_spellbook", fromComponent = "superheat_item") if (player.inventory.transaction.error == TransactionError.None) { player.playSound("superheat_all") player.setAnimation(spell) - player.setGraphic(spell) + player.gfx(spell) val definition = spellDefinitions.get(spell) player.experience.add(Skill.Magic, definition.experience) player.experience.add(Skill.Smithing, smelting.exp(player, bar)) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/Ectophial.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/Ectophial.kts index 869d13832..e571a766d 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/Ectophial.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/Ectophial.kts @@ -8,7 +8,6 @@ import world.gregs.voidps.engine.data.definition.AreaDefinitions import world.gregs.voidps.engine.entity.character.mode.interact.Interact import world.gregs.voidps.engine.entity.character.player.chat.ChatType import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.item.Item import world.gregs.voidps.engine.entity.obj.GameObjects import world.gregs.voidps.engine.inject @@ -24,7 +23,7 @@ val objects: GameObjects by inject() inventoryItem("Empty", "ectophial", "inventory") { player.strongQueue("ectophial") { player.setAnimation("empty_ectophial") - player.setGraphic("empty_ectophial") + player.gfx("empty_ectophial") player.message("You empty the ectoplasm onto the ground around your feet...", ChatType.Filter) player.start("movement_delay", 4) delay(4) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/HomeTeleport.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/HomeTeleport.kts index 84e992a61..088f1dfd7 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/HomeTeleport.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/HomeTeleport.kts @@ -11,7 +11,6 @@ import world.gregs.voidps.engine.client.variable.start import world.gregs.voidps.engine.data.definition.AreaDefinitions import world.gregs.voidps.engine.entity.character.move.tele import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.queue.weakQueue import world.gregs.voidps.engine.timer.epochSeconds @@ -40,7 +39,7 @@ interfaceOption("Cast", "lumbridge_home_teleport", "modern_spellbook") { } player.start("teleport_delay", 17) repeat(17) { - player.setGraphic("home_tele_${it + 1}") + player.gfx("home_tele_${it + 1}") val ticks = player.setAnimation("home_tele_${it + 1}") pause(ticks) } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/JewelleryTeleport.kt b/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/JewelleryTeleport.kt index 6bbb6621e..78ec84687 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/JewelleryTeleport.kt +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/JewelleryTeleport.kt @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.entity.character.clearAnimation import world.gregs.voidps.engine.entity.character.move.tele 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 import world.gregs.voidps.engine.inv.discharge import world.gregs.voidps.engine.map.collision.random import world.gregs.voidps.engine.queue.ActionPriority @@ -25,14 +24,14 @@ fun itemTeleport(player: Player, inventory: String, slot: Int, area: Area, type: player.closeInterfaces() player.queue("teleport_$type", onCancel = null) { player.playSound("teleport") - player.setGraphic("teleport_$type") + player.gfx("teleport_$type") player.animate("teleport_$type") player.tele(area.random(player)!!) val int = player.setAnimation("teleport_land_$type") if (int == -1) { player.clearAnimation() } else { - player.setGraphic("teleport_land_$type") + player.gfx("teleport_land_$type") } } return true diff --git a/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/Teleports.kts b/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/Teleports.kts index 3210478e7..be6274977 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/Teleports.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/activity/transport/teleport/Teleports.kts @@ -10,7 +10,6 @@ import world.gregs.voidps.engine.entity.character.move.tele 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.entity.character.setGraphic import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.inv.inventory import world.gregs.voidps.engine.inv.remove @@ -41,12 +40,12 @@ interfaceOption("Cast", "*_teleport", "*_spellbook") { player.exp(Skill.Magic, definition.experience) val book = id.removeSuffix("_spellbook") player.playSound("teleport") - player.setGraphic("teleport_$book") + player.gfx("teleport_$book") player.animate("teleport_$book") player.tele(areas[component].random(player)!!) delay(1) player.playSound("teleport_land") - player.setGraphic("teleport_land_$book") + player.gfx("teleport_land_$book") player.animate("teleport_land_$book") if (book == "ancient") { delay(1) @@ -67,7 +66,7 @@ inventoryItem("*", "*_teleport") { player.queue("teleport", onCancel = null) { if (player.inventory.remove(item.id)) { player.playSound("teleport_$type") - player.setGraphic("teleport_$type") + player.gfx("teleport_$type") player.setAnimation("teleport_$type") delay(3) player.tele(map.random(player)!!) 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 662c3a19c..f603b4b4d 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 @@ -50,7 +50,7 @@ adminCommand("npcchat") { adminCommand("npcgfx") { val npc = npcs[player.tile.addY(1)].first() - npc.setGraphic(content)// 93 + npc.gfx(content)// 93 } adminCommand("npchit") { 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 fb8e8921e..8107cea0d 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 @@ -10,7 +10,6 @@ import world.gregs.voidps.engine.entity.character.player.* import world.gregs.voidps.engine.get import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.map.zone.DynamicZones -import world.gregs.voidps.type.Delta import world.gregs.voidps.type.Direction import world.gregs.voidps.world.interact.entity.combat.hit.damage import world.gregs.voidps.world.interact.entity.effect.transform @@ -48,8 +47,8 @@ adminCommand("emote (emote-id)", "perform render emote by int or string id (-1 t adminCommand("gfx (gfx-id)", "perform graphic effect by int or string id (-1 to clear)") { when (content) { - "-1", "" -> player.clearGraphic() - else -> player.setGraphic(content)// 93 + "-1", "" -> player.clearGfx() + else -> player.gfx(content)// 93 } } @@ -70,7 +69,15 @@ adminCommand("chat (message)", "force a chat message over players head") { } adminCommand("move") { - player.setExactMovement(Delta(0, -2), 120, startDelay = 60, direction = Direction.SOUTH) + val move = player.visuals.exactMovement + move.startX = 0 + move.startY = 0 + move.startDelay = 60 + move.endX = 0 + move.endY = -2 + move.endDelay = 120 + move.direction = Direction.SOUTH.ordinal + player.flagExactMovement() } adminCommand("hit [amount]", "damage player by an amount") { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/community/assist/RequestAssist.kts b/game/src/main/kotlin/world/gregs/voidps/world/community/assist/RequestAssist.kts index 068819757..4e55e3af7 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/community/assist/RequestAssist.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/community/assist/RequestAssist.kts @@ -18,7 +18,6 @@ import world.gregs.voidps.engine.entity.character.player.req.request import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.entity.character.player.skill.exp.BlockedExperience import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.event.onEvent import world.gregs.voidps.engine.timer.TICKS import world.gregs.voidps.world.community.assist.Assistance.MAX_EXPERIENCE @@ -112,7 +111,7 @@ fun setupAssistant(player: Player, assisted: Player) { setAssistAreaStatus(player, true) player.sendVariable("total_xp_earned") player.setAnimation("assist") - player.setGraphic("assist") + player.gfx("assist") toggleInventory(player, enabled = false) } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/dialogue/type/LevelUp.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/dialogue/type/LevelUp.kts index 8e874d480..d0104b8f8 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/dialogue/type/LevelUp.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/dialogue/type/LevelUp.kts @@ -9,7 +9,6 @@ import world.gregs.voidps.engine.entity.character.player.skill.exp.Experience import world.gregs.voidps.engine.entity.character.player.skill.exp.experience import world.gregs.voidps.engine.entity.character.player.skill.level.MaxLevelChanged import world.gregs.voidps.engine.entity.character.player.skill.level.maxLevelChange -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.queue.weakQueue import world.gregs.voidps.world.interact.entity.combat.hit.combatHit import world.gregs.voidps.world.interact.entity.sound.playJingle @@ -39,7 +38,7 @@ maxLevelChange { player -> else -> true// TODO has unlocked something } player.playJingle("level_up_${skill.name.lowercase()}${if (unlock) "_unlock" else ""}", 0.5) - player.setGraphic("level_up") + player.gfx("level_up") player.addVarbit("skill_stat_flash", skill.name.lowercase()) levelUp(skill, """ Congratulations! You've just advanced${skill.name.an()} ${skill.name} level! diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/death/PlayerDeath.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/death/PlayerDeath.kts index 1b1ef370d..8c342a191 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/death/PlayerDeath.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/death/PlayerDeath.kts @@ -137,7 +137,7 @@ fun retribution(source: Player) { if (!source.praying("retribution")) { return } - source.setGraphic("retribution") + source.gfx("retribution") val maxHit = (source.levels.get(Skill.Prayer) * 2.5).toInt() val target = source.target for (direction in Direction.all) { @@ -155,7 +155,7 @@ fun wrath(source: Player) { if (!source.praying("wrath")) { return } - source.setGraphic("wrath") + source.gfx("wrath") for (direction in Direction.all) { val inner = source.tile.add(direction) val outer = inner.add(direction) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/effect/Stun.kt b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/effect/Stun.kt index 7a1993adf..e1fa8e32e 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/effect/Stun.kt +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/effect/Stun.kt @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.client.variable.start import world.gregs.voidps.engine.entity.character.Character import world.gregs.voidps.engine.entity.character.hit import world.gregs.voidps.engine.entity.character.player.Player -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.network.login.protocol.visual.update.Hitsplat val Character.stunned: Boolean get() = hasClock("stunned") @@ -24,7 +23,7 @@ fun Character.stun(target: Character, ticks: Int, hit: Int = -1): Boolean { if (hit != -1) { target.hit(this, hit, Hitsplat.Mark.Regular) } - target.setGraphic("stun_long") + target.gfx("stun_long") target.message("You've been stunned!") target["delay"] = ticks target.start("stunned", ticks) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/AhrimsSet.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/AhrimsSet.kts index 8b8083397..8802e64d3 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/AhrimsSet.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/AhrimsSet.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.armour.barrows 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.setGraphic import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.engine.inv.itemAdded import world.gregs.voidps.engine.inv.itemRemoved @@ -40,6 +39,6 @@ characterCombatAttack(type = "magic") { character -> } val drain = target.levels.drain(Skill.Strength, 5) if (drain < 0) { - target.setGraphic("ahrims_effect") + target.gfx("ahrims_effect") } } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/GuthansSet.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/GuthansSet.kts index 52a4402e4..f08cb45e6 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/GuthansSet.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/GuthansSet.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.armour.barrows 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.setGraphic import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.engine.inv.itemAdded import world.gregs.voidps.engine.inv.itemRemoved @@ -34,6 +33,6 @@ fun Player.hasFullSet() = BarrowsArmour.hasSet(this, characterCombatAttack(type = "melee") { character -> if (character.contains("guthans_set_effect") && random.nextInt(4) == 0) { character.levels.boost(Skill.Constitution, damage) - target.setGraphic("guthans_effect") + target.gfx("guthans_effect") } } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/KarilsSet.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/KarilsSet.kts index afdc8863c..111d3ca6b 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/KarilsSet.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/KarilsSet.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.armour.barrows 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.setGraphic import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.engine.inv.itemAdded import world.gregs.voidps.engine.inv.itemRemoved @@ -36,6 +35,6 @@ characterCombatAttack("karils_crossbow*", "range") { character -> return@characterCombatAttack } if (target.levels.drain(Skill.Agility, multiplier = 0.20) < 0) { - target.setGraphic("karils_effect") + target.gfx("karils_effect") } } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/ToragsSet.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/ToragsSet.kts index 0d3a107d8..4960efd1c 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/ToragsSet.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/armour/barrows/ToragsSet.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.armour.barrows import world.gregs.voidps.engine.entity.character.player.Player -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.engine.inv.itemAdded import world.gregs.voidps.engine.inv.itemRemoved @@ -37,6 +36,6 @@ characterCombatAttack("torags_hammers*", "melee") { character -> } if (target.runEnergy > 0) { target.runEnergy -= target.runEnergy / 5 - target.setGraphic("torags_effect") + target.gfx("torags_effect") } } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/drink/Overload.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/drink/Overload.kts index 58552ad38..ed6cf817d 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/drink/Overload.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/consume/drink/Overload.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.entity.character.player.Player 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.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.engine.queue.queue import world.gregs.voidps.engine.timer.timerStart @@ -61,7 +60,7 @@ timerStart("overload") { player -> repeat(5) { player.directHit(100) player.setAnimation("overload") - player.setGraphic("overload") + player.gfx("overload") pause(2) } } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/Magic.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/Magic.kts index 2f859d426..4c6d370bf 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/Magic.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/Magic.kts @@ -4,7 +4,6 @@ import world.gregs.voidps.engine.data.definition.SpellDefinitions import world.gregs.voidps.engine.entity.character.Character 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.world.interact.entity.combat.characterCombatSwing import world.gregs.voidps.world.interact.entity.combat.combatSwing @@ -55,14 +54,14 @@ fun castSpell(source: Character, target: Character): Boolean { } if (source.weapon.def["weapon_type", ""] == "salamander" && source.spell.isBlank()) { source.setAnimation("salamander_scorch") - source.setGraphic("salamander_blaze") + source.gfx("salamander_blaze") time = 0 } else { val staff = source.weapon.def["category", ""] == "staff" val animation: String = if (staff && definition.contains("animation_staff")) definition["animation_staff"] else definition["animation", ""] val graphic: String = if (staff && definition.contains("graphic_staff")) definition["graphic_staff"] else definition["graphic", ""] source.setAnimation(animation) - source.setGraphic(graphic) + source.gfx(graphic) } val damage = source.hit(target, delay = if (time == -1) 64 else time) if (damage != -1) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/Spells.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/Spells.kts index a6068c30f..c9aa3c637 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/Spells.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/Spells.kts @@ -1,6 +1,5 @@ package world.gregs.voidps.world.interact.entity.player.combat.magic.spell -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.type.random import world.gregs.voidps.world.interact.entity.combat.hit.characterCombatHit import world.gregs.voidps.world.interact.entity.combat.hit.combatAttack @@ -11,7 +10,7 @@ import kotlin.random.nextInt characterCombatHit { character -> if (spell.isNotBlank()) { - character.setGraphic("${spell}_hit") + character.gfx("${spell}_hit") } } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureGroup.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureGroup.kts index b67287c27..7c07c6a8f 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureGroup.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureGroup.kts @@ -7,7 +7,6 @@ import world.gregs.voidps.engine.entity.character.player.Players import world.gregs.voidps.engine.entity.character.player.name 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.world.interact.entity.player.combat.magic.spell.removeSpellItems import world.gregs.voidps.world.interact.entity.player.toxin.curePoison @@ -27,7 +26,7 @@ interfaceOption(component = "cure_group", id = "lunar_spellbook") { players .filter { other -> other.tile.within(player.tile, 1) && other.poisoned } .forEach { target -> - target.setGraphic(spell) + target.gfx(spell) target.curePoison() target.message("You have been cured by ${player.name}") } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureMe.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureMe.kts index 3eaf60991..9088404e6 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureMe.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureMe.kts @@ -5,7 +5,6 @@ import world.gregs.voidps.engine.client.ui.interfaceOption import world.gregs.voidps.engine.data.definition.SpellDefinitions 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.world.interact.entity.player.combat.magic.spell.removeSpellItems import world.gregs.voidps.world.interact.entity.player.toxin.curePoison @@ -24,7 +23,7 @@ interfaceOption(component = "cure_me", id = "lunar_spellbook") { } val definition = definitions.get(spell) player.setAnimation("lunar_cast") - player.setGraphic(spell) + player.gfx(spell) player.experience.add(Skill.Magic, definition.experience) player.curePoison() } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureOther.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureOther.kts index 386ac37e2..a8dfd5bfd 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureOther.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/CureOther.kts @@ -7,7 +7,6 @@ import world.gregs.voidps.engine.data.definition.SpellDefinitions import world.gregs.voidps.engine.entity.character.player.name 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.world.interact.entity.player.combat.magic.spell.removeSpellItems import world.gregs.voidps.world.interact.entity.player.toxin.curePoison @@ -28,7 +27,7 @@ itemOnPlayerApproach(id = "lunar_spellbook", component = "cure_other") { val definition = definitions.get(spell) player.start("movement_delay", 2) player.setAnimation("lunar_cast") - target.setGraphic(spell) + target.gfx(spell) player.experience.add(Skill.Magic, definition.experience) target.curePoison() target.message("You have been cured by ${player.name}.") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/EnergyTransfer.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/EnergyTransfer.kts index 600874646..92f2be9f4 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/EnergyTransfer.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/EnergyTransfer.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.client.variable.start import world.gregs.voidps.engine.data.definition.SpellDefinitions 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.type.random import world.gregs.voidps.world.interact.entity.combat.hit.damage @@ -44,7 +43,7 @@ itemOnPlayerApproach(id = "lunar_spellbook", component = "energy_transfer") { val definition = definitions.get(spell) player.start("movement_delay", 2) player.setAnimation("lunar_cast") - target.setGraphic(spell) + target.gfx(spell) player.experience.add(Skill.Magic, definition.experience) player.damage(random.nextInt(95, 100)) player.specialAttackEnergy = 0 diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/HealGroup.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/HealGroup.kts index 836eeb1e1..78102067b 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/HealGroup.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/HealGroup.kts @@ -7,7 +7,6 @@ import world.gregs.voidps.engine.entity.character.player.Players import world.gregs.voidps.engine.entity.character.player.name 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.world.interact.entity.combat.hit.damage import world.gregs.voidps.world.interact.entity.player.combat.magic.spell.removeSpellItems @@ -32,7 +31,7 @@ interfaceOption(component = "heal_group", id = "lunar_spellbook") { .filter { other -> other != player && other.tile.within(player.tile, 1) && other.levels.getOffset(Skill.Constitution) < 0 } .take(5) group.forEach { target -> - target.setGraphic(spell) + target.gfx(spell) player.experience.add(Skill.Magic, definition.experience) healed += target.levels.restore(Skill.Constitution, amount / group.size) target.message("You have been healed by ${player.name}.") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/HealOther.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/HealOther.kts index a7ae866b1..64057101d 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/HealOther.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/HealOther.kts @@ -7,7 +7,6 @@ import world.gregs.voidps.engine.data.definition.SpellDefinitions import world.gregs.voidps.engine.entity.character.player.name 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.world.interact.entity.combat.hit.damage import world.gregs.voidps.world.interact.entity.player.combat.magic.spell.removeSpellItems @@ -32,7 +31,7 @@ itemOnPlayerApproach(id = "lunar_spellbook", component = "heal_other") { val amount = (player.levels.get(Skill.Constitution) * 0.75).toInt() + 1 player.start("movement_delay", 2) player.setAnimation("lunar_cast") - target.setGraphic(spell) + target.gfx(spell) player.experience.add(Skill.Magic, definition.experience) val restored = target.levels.restore(Skill.Constitution, amount) target.message("You have been healed by ${player.name}.") 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 51f9e2cbb..3339f620c 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 @@ -8,7 +8,6 @@ import world.gregs.voidps.engine.client.variable.stop import world.gregs.voidps.engine.data.definition.SpellDefinitions 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.timer.epochSeconds import world.gregs.voidps.world.interact.entity.combat.hit.combatHit @@ -32,7 +31,7 @@ interfaceOption("Cast", "vengeance", "lunar_spellbook") { } val definition = definitions.get(spell) player.setAnimation(spell) - player.setGraphic(spell) + player.gfx(spell) player.experience.add(Skill.Magic, definition.experience) player["vengeance"] = true player.start("vengeance_delay", definition["delay_seconds"], epochSeconds()) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/VengeanceOther.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/VengeanceOther.kts index 24048c548..f30b330dd 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/VengeanceOther.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/magic/spell/book/lunar/VengeanceOther.kts @@ -7,7 +7,6 @@ import world.gregs.voidps.engine.client.variable.start import world.gregs.voidps.engine.data.definition.SpellDefinitions 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 import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.timer.epochSeconds import world.gregs.voidps.world.interact.entity.player.combat.magic.spell.removeSpellItems @@ -31,7 +30,7 @@ itemOnPlayerApproach(id = "lunar_spellbook", component = "vengeance_other") { val definition = definitions.get(spell) player.start("movement_delay", 2) player.setAnimation("lunar_cast") - target.setGraphic(spell) + target.gfx(spell) player.experience.add(Skill.Magic, definition.experience) target["vengeance"] = true player.start("vengeance_delay", definition["delay_seconds"], epochSeconds()) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/BarrelchestAnchor.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/BarrelchestAnchor.kts index 209c999ca..b1c833b05 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/BarrelchestAnchor.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/BarrelchestAnchor.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.melee.special 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 import world.gregs.voidps.world.interact.entity.combat.hit.hit import world.gregs.voidps.world.interact.entity.player.combat.melee.drainByDamage import world.gregs.voidps.world.interact.entity.player.combat.special.specialAttack @@ -10,7 +9,7 @@ import world.gregs.voidps.world.interact.entity.sound.playSound specialAttack("sunder") { player -> player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") player.playSound("${id}_special") val damage = player.hit(target, delay = 60) if (damage >= 0) { 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 2eafbd1ca..4fd17033e 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 @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.melee.special 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 import world.gregs.voidps.world.interact.entity.player.combat.special.SpecialAttack import world.gregs.voidps.world.interact.entity.player.combat.special.specialAttackPrepare import world.gregs.voidps.world.interact.entity.sound.playSound @@ -13,7 +12,7 @@ specialAttackPrepare("rampage") { player -> return@specialAttackPrepare } player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") player.playSound("${id}_special") player.say("Raarrrrrgggggghhhhhhh!") player.levels.drain(Skill.Attack, multiplier = 0.10) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonClaws.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonClaws.kts index 873ffc0fa..b2a56db7b 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonClaws.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonClaws.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.melee.special import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.type.random import world.gregs.voidps.world.interact.entity.combat.hit.Damage import world.gregs.voidps.world.interact.entity.combat.hit.Hit @@ -11,7 +10,7 @@ import world.gregs.voidps.world.interact.entity.player.combat.special.specialAtt specialAttack("slice_and_dice") { player -> player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") val weapon = player.weapon var (hit1, hit2, hit3, hit4) = intArrayOf(0, 0, 0, 0) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonHalberd.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonHalberd.kts index c69005a77..bf5393aac 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonHalberd.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/DragonHalberd.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.entity.character.npc.NPCs import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.Players import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.character.size import world.gregs.voidps.engine.inject import world.gregs.voidps.world.interact.entity.combat.hit.hit @@ -18,7 +17,7 @@ val npcs: NPCs by inject() specialAttack("sweep") { player -> player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") player.playSound("${id}_special") val dir = target.tile.delta(player.tile).toDirection() val firstTile = target.tile.add(if (dir.isDiagonal()) dir.horizontal() else dir.rotate(2)) 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 4487f4fd9..9d106c353 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 @@ -3,7 +3,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.melee.special 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 -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.timer.timerStart import world.gregs.voidps.engine.timer.timerStop import world.gregs.voidps.engine.timer.timerTick @@ -22,7 +21,7 @@ specialAttackPrepare("sanctuary") { player -> return@specialAttackPrepare } player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") player.playSound("${id}_special") player.say("For Camelot!") if (player.weapon.id.startsWith("enhanced")) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/GraniteMaul.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/GraniteMaul.kts index be3d1e831..ef943805b 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/GraniteMaul.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/GraniteMaul.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.melee.special import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.world.interact.entity.combat.hit.hit import world.gregs.voidps.world.interact.entity.combat.target import world.gregs.voidps.world.interact.entity.player.combat.special.SpecialAttack @@ -17,6 +16,6 @@ specialAttackPrepare("quick_smash") { player -> } val target = player.target ?: return@specialAttackPrepare player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") player.hit(target) } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/KorasiSword.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/KorasiSword.kts index 2899a93c3..5a380e4f6 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/KorasiSword.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/KorasiSword.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.entity.character.npc.NPCs import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.Players import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.map.spiral import world.gregs.voidps.type.random @@ -26,7 +25,7 @@ val lineOfSight: LineValidator by inject() specialAttack("disrupt") { player -> player["korasi_chain"] = mutableSetOf(target.index) player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") areaSound("godwars_saradomin_magic_impact", player.tile, 10) areaSound("godwars_godsword_special_attack", player.tile, 5) val maxHit = Damage.maximum(player, target, "melee", player.weapon) @@ -39,7 +38,7 @@ characterCombatHit("korasis_sword") { target -> return@characterCombatHit } areaSound("godwars_saradomin_magic_impact", target.tile, 10) - target.setGraphic("disrupt_hit") + target.gfx("disrupt_hit") if (!target.inMultiCombat) { return@characterCombatHit } 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 0a4e5b93e..7044344d8 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 @@ -4,7 +4,6 @@ import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.client.variable.hasClock 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 import world.gregs.voidps.engine.entity.character.size import world.gregs.voidps.engine.map.collision.blocked import world.gregs.voidps.engine.timer.toTicks @@ -30,9 +29,9 @@ combatPrepare("melee") { player -> specialAttack("shove") { player -> player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") val duration = TimeUnit.SECONDS.toTicks(3) - target.setGraphic("shove_hit") + target.gfx("shove_hit") target.freeze(duration) player["delay"] = duration player.hit(target, damage = -1) // Hit with no damage so target can auto-retaliate diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/StaffOfLight.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/StaffOfLight.kts index ef05db358..12d942bca 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/StaffOfLight.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/melee/special/StaffOfLight.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.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.engine.inv.itemRemoved import world.gregs.voidps.engine.timer.timerStart @@ -21,7 +20,7 @@ itemRemoved("staff_of_light*", EquipSlot.Weapon, "worn_equipment") { player -> combatHit { player -> if (player.softTimers.contains("power_of_light")) { - player.setGraphic("power_of_light_hit") + player.gfx("power_of_light_hit") } } @@ -31,7 +30,7 @@ specialAttackPrepare("power_of_light") { player -> return@specialAttackPrepare } player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") player[id] = TimeUnit.MINUTES.toTicks(1) player.softTimers.start(id) } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/Prayers.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/Prayers.kts index 4b1f6d8b2..4ab1656f3 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/Prayers.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/Prayers.kts @@ -4,7 +4,6 @@ import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.flagAppearance import world.gregs.voidps.engine.entity.character.player.headIcon import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.world.interact.entity.player.combat.prayer.PrayerConfigs.ACTIVE_CURSES import world.gregs.voidps.world.interact.entity.player.combat.prayer.PrayerConfigs.ACTIVE_PRAYERS @@ -23,7 +22,7 @@ prayerStart { player -> val curses = player.isCurses() if (curses) { player.setAnimation("activate_$prayer") - player.setGraphic("activate_$prayer") + player.gfx("activate_$prayer") } else { player.playSound("activate_$prayer") } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/Leech.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/Leech.kts index f97753e3d..cf1443f42 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/Leech.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/Leech.kts @@ -8,7 +8,6 @@ import world.gregs.voidps.engine.entity.character.player.Player 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.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.queue.queue import world.gregs.voidps.engine.timer.timerStart import world.gregs.voidps.engine.timer.timerTick @@ -135,9 +134,9 @@ fun cast(source: Character, target: Character, sap: Boolean, name: String) { source.queue("leech", 1) { val type = if (sap) "sap" else "leech" source.setAnimation(type) - source.setGraphic("cast_${type}_${name}") + source.gfx("cast_${type}_${name}") val time = source.shoot("proj_${type}_${name}", target) - target.setGraphic("land_${type}_${name}", delay = time) + target.gfx("land_${type}_${name}", delay = time) } } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/PrayerBonus.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/PrayerBonus.kts index 97e3d8bcf..70f7efcc9 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/PrayerBonus.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/PrayerBonus.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.prayer.active import world.gregs.voidps.engine.data.definition.PrayerDefinitions import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.inject import world.gregs.voidps.type.random import world.gregs.voidps.world.interact.entity.combat.hit.characterCombatAttack @@ -35,7 +34,7 @@ characterCombatAttack { character -> val damage = target["protected_damage", 0] if (damage > 0) { target.setAnimation("deflect", delay) - target.setGraphic("deflect_$type", delay) + target.gfx("deflect_$type", delay) if (random.nextDouble() >= 0.4) { target.hit(target = character, type = "deflect", delay = delay, damage = (damage * 0.10).toInt()) } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/Redemption.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/Redemption.kts index bb9299a57..8f7ef5d2f 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/Redemption.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/Redemption.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.prayer.active import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.entity.character.player.skill.level.levelChange -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.world.interact.entity.player.combat.prayer.praying levelChange(Skill.Constitution) { player -> @@ -12,5 +11,5 @@ levelChange(Skill.Constitution) { player -> player.levels.set(Skill.Prayer, 0) val health = (player.levels.getMax(Skill.Prayer) * 2.5).toInt() player.levels.restore(Skill.Constitution, health) - player.setGraphic("redemption") + player.gfx("redemption") } \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/SoulSplit.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/SoulSplit.kts index e34b637f4..2ab9b2f76 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/SoulSplit.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/prayer/active/SoulSplit.kts @@ -3,7 +3,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.prayer.active import world.gregs.voidps.engine.entity.character.Character 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.setGraphic import world.gregs.voidps.engine.timer.CLIENT_TICKS import world.gregs.voidps.engine.timer.characterTimerStart import world.gregs.voidps.engine.timer.characterTimerStop @@ -23,7 +22,7 @@ combatAttack { player -> target["soul_split_delay"] = CLIENT_TICKS.toTicks(time) target["soul_split_source"] = player target["soul_split_damage"] = damage - target.setGraphic("soul_split_hit", time) + target.gfx("soul_split_hit", time) target.softTimers.start("soul_split") } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/Ammo.kt b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/Ammo.kt index 168b86664..34567f2ee 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/Ammo.kt +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/Ammo.kt @@ -7,7 +7,6 @@ import world.gregs.voidps.engine.entity.character.Character import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.equip.equipped import world.gregs.voidps.engine.entity.character.player.skill.Skill -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.item.Item import world.gregs.voidps.engine.entity.item.floor.FloorItems import world.gregs.voidps.engine.get @@ -128,7 +127,7 @@ object Ammo { private fun chance(source: Player, target: Character, name: String, chance: Double): Boolean { if (random.nextDouble() < chance) { - target.setGraphic(name) + target.gfx(name) source.playSound(name, delay = 40) return true } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/Ranged.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/Ranged.kts index f7a243573..8b4971ad2 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/Ranged.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/Ranged.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.entity.character.Character 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.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.inject import world.gregs.voidps.world.interact.entity.combat.* import world.gregs.voidps.world.interact.entity.combat.hit.hit @@ -59,7 +58,7 @@ fun swing(character: Character, target: Character) { when (style.stringId) { "thrown" -> { val ammoName = character.ammo.removePrefix("corrupt_").removeSuffix("_p++").removeSuffix("_p+").removeSuffix("_p") - character.setGraphic("${ammoName}_throw") + character.gfx("${ammoName}_throw") if (weapon.contains("dart")) { character.playSound("dart_throw") } else if (weapon.contains("javelin")) { @@ -73,7 +72,7 @@ fun swing(character: Character, target: Character) { } } "bow" -> { - character.setGraphic("${if (ammo.endsWith("brutal")) "brutal" else ammo}_shoot") + character.gfx("${if (ammo.endsWith("brutal")) "brutal" else ammo}_shoot") if (weapon.contains("shortbow")) { character.playSound("shortbow_shoot") } else { @@ -85,7 +84,7 @@ fun swing(character: Character, target: Character) { } "salamander" -> { time = 0 - character.setGraphic("salamander_${character.attackType}") + character.gfx("salamander_${character.attackType}") } "crossbow" -> character.playSound("crossbow_shoot") } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/DarkBow.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/DarkBow.kts index f9abf44f2..1af66a267 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/DarkBow.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/DarkBow.kts @@ -3,7 +3,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.special import world.gregs.voidps.engine.entity.character.Character 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 import world.gregs.voidps.engine.entity.distanceTo import world.gregs.voidps.world.interact.entity.combat.combatSwing import world.gregs.voidps.world.interact.entity.combat.hit.characterCombatHit @@ -16,7 +15,7 @@ import world.gregs.voidps.world.interact.entity.sound.playSound specialAttack("descent_of_darkness") { player -> val dragon = player.ammo == "dragon_arrow" player.setAnimation("bow_accurate") - player.setGraphic("${player.ammo}_double_shot") + player.gfx("${player.ammo}_double_shot") player.playSound("dark_bow_special") player.playSound("descent_of_${if (dragon) "dragons" else "darkness"}") @@ -38,13 +37,13 @@ specialAttack("descent_of_darkness") { player -> characterCombatHit("dark_bow*", "range") { character -> source.playSound("descent_of_darkness") source.playSound("descent_of_darkness", delay = 20) - character.setGraphic("descent_of_${if (source.ammo == "dragon_arrow") "dragons" else "darkness"}_hit") + character.gfx("descent_of_${if (source.ammo == "dragon_arrow") "dragons" else "darkness"}_hit") } combatSwing("dark_bow*", "range") { player -> player.setAnimation("bow_accurate") val ammo = player.ammo - player.setGraphic("${ammo}_double_shot") + player.gfx("${ammo}_double_shot") val time1 = player.shoot(ammo, target, true) val time2 = player.shoot(ammo, target, false) player.hit(target, delay = time1) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/GodBows.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/GodBows.kts index 50a16d8a5..8bdcca5c2 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/GodBows.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/GodBows.kts @@ -3,7 +3,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.special import world.gregs.voidps.engine.entity.character.Character 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.setGraphic import world.gregs.voidps.engine.timer.* import world.gregs.voidps.world.interact.entity.combat.hit.* import world.gregs.voidps.world.interact.entity.sound.playSound @@ -39,7 +38,7 @@ combatAttack("zamorak_bow", handler = specialHandler) val hitHandler: suspend CombatHit.(Character) -> Unit = { character -> if (special) { - character.setGraphic("${weapon.id}_special_hit") + character.gfx("${weapon.id}_special_hit") source.playSound("god_bow_special_hit") } } @@ -60,7 +59,7 @@ timerTick("restorative_shot", "balanced_shot") { player -> val restore = player["restoration_amount", 0] player.restoration -= restore player.levels.restore(Skill.Constitution, restore) - player.setGraphic("saradomin_bow_restoration") + player.gfx("saradomin_bow_restoration") } timerStop("restorative_shot", "balanced_shot") { player -> diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MagicLongbow.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MagicLongbow.kts index 876f76994..73d1e9aac 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MagicLongbow.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MagicLongbow.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.special import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.world.interact.entity.combat.hit.hit import world.gregs.voidps.world.interact.entity.player.combat.special.specialAttack import world.gregs.voidps.world.interact.entity.proj.shoot @@ -9,7 +8,7 @@ import world.gregs.voidps.world.interact.entity.sound.playSound specialAttack("powershot") { player -> player.setAnimation("bow_accurate") - player.setGraphic("special_arrow_shoot") + player.gfx("special_arrow_shoot") player.playSound("${id}_special") val time = player.shoot(id = "special_arrow", target = target) player.hit(target, delay = time) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MagicShortbow.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MagicShortbow.kts index 7beb7e8db..4d1a4d622 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MagicShortbow.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MagicShortbow.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.special import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.distanceTo import world.gregs.voidps.world.interact.entity.combat.hit.hit import world.gregs.voidps.world.interact.entity.player.combat.special.specialAttack @@ -10,8 +9,8 @@ import world.gregs.voidps.world.interact.entity.sound.playSound specialAttack("snapshot") { player -> player.setAnimation("${id}_special") - player.setGraphic("${id}_special") - player.setGraphic("${id}_special", delay = 30) + player.gfx("${id}_special") + player.gfx("${id}_special", delay = 30) player.playSound("${id}_special") val distance = player.tile.distanceTo(target) val time1 = player.shoot(id = "special_arrow", target = target, delay = 20, flightTime = 10 + distance * 3) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MorrigansJavelin.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MorrigansJavelin.kts index 22c859295..0fac10bf8 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MorrigansJavelin.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MorrigansJavelin.kts @@ -3,7 +3,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.special import world.gregs.voidps.engine.client.message 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 import world.gregs.voidps.engine.timer.characterTimerStart import world.gregs.voidps.engine.timer.characterTimerTick import world.gregs.voidps.engine.timer.npcTimerStop @@ -16,7 +15,7 @@ import world.gregs.voidps.world.interact.entity.proj.shoot specialAttack("phantom_strike") { player -> val ammo = player.ammo player.setAnimation("throw_javelin") - player.setGraphic("${ammo}_special") + player.gfx("${ammo}_special") val time = player.shoot(id = ammo, target = target) val damage = player.hit(target, delay = time) if (damage != -1) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MorrigansThrowingAxe.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MorrigansThrowingAxe.kts index 77e3d092c..44813d366 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MorrigansThrowingAxe.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/MorrigansThrowingAxe.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.special import world.gregs.voidps.engine.client.variable.start import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.world.interact.entity.combat.hit.hit import world.gregs.voidps.world.interact.entity.player.combat.range.ammo import world.gregs.voidps.world.interact.entity.player.combat.special.specialAttack @@ -11,7 +10,7 @@ import world.gregs.voidps.world.interact.entity.proj.shoot specialAttack("hamstring") { player -> val ammo = player.ammo player.setAnimation("throw_morrigans_throwing_axe_special") - player.setGraphic("${ammo}_special") + player.gfx("${ammo}_special") val time = player.shoot(id = ammo, target = target, height = 15) if (player.hit(target, delay = time) != -1) { target.start(id, 100) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/RuneThrowingAxe.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/RuneThrowingAxe.kts index bd7d177de..844727e23 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/RuneThrowingAxe.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/RuneThrowingAxe.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.entity.character.npc.NPCs import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.Players import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.map.spiral import world.gregs.voidps.world.interact.entity.combat.Target @@ -26,7 +25,7 @@ specialAttack("chainhit") { player -> val ammo = player.ammo player["chain_hits"] = mutableSetOf(target.index) player.setAnimation("rune_throwing_axe_special") - player.setGraphic("${ammo}_special_throw") + player.gfx("${ammo}_special_throw") val time = player.shoot(id = "${ammo}_special", target = target) player.hit(target, delay = time) } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/Seercull.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/Seercull.kts index 3d044d1cd..8f71ad408 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/Seercull.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/Seercull.kts @@ -3,7 +3,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.special import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.entity.character.player.skill.level.characterLevelChange import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.world.interact.entity.combat.hit.characterCombatHit import world.gregs.voidps.world.interact.entity.combat.hit.combatAttack import world.gregs.voidps.world.interact.entity.combat.hit.hit @@ -13,14 +12,14 @@ import world.gregs.voidps.world.interact.entity.sound.playSound specialAttack("soulshot") { player -> player.setAnimation("bow_accurate") - player.setGraphic("seercull_special_shoot") + player.gfx("seercull_special_shoot") player.playSound("seercull_special") val time = player.shoot(id = "seercull_special_arrow", target = target) player.hit(target, delay = time) } characterCombatHit("seercull", "range") { character -> - character.setGraphic("seercull_special_hit") + character.gfx("seercull_special_hit") } combatAttack("seercull*") { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/ZaniksCrossbow.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/ZaniksCrossbow.kts index 6b3ff4ced..4b56ab0b6 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/ZaniksCrossbow.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/special/ZaniksCrossbow.kts @@ -2,14 +2,13 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.special 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 import world.gregs.voidps.world.interact.entity.combat.hit.hit import world.gregs.voidps.world.interact.entity.player.combat.special.specialAttack import world.gregs.voidps.world.interact.entity.proj.shoot specialAttack("defiance") { player -> player.setAnimation("zaniks_crossbow_special") - player.setGraphic("zaniks_crossbow_special") + player.gfx("zaniks_crossbow_special") val time = player.shoot(id = "zaniks_crossbow_bolt", target = target) val damage = player.hit(target, delay = time) if (damage != -1) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/weapon/Chinchompa.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/weapon/Chinchompa.kts index 9af6e9c8a..78667db8f 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/weapon/Chinchompa.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/weapon/Chinchompa.kts @@ -1,7 +1,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.range.weapon import world.gregs.voidps.engine.entity.character.player.Player -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.type.random import world.gregs.voidps.world.interact.entity.combat.hit.characterCombatHit import world.gregs.voidps.world.interact.entity.combat.hit.combatAttack @@ -14,7 +13,7 @@ import kotlin.random.nextInt characterCombatHit("*chinchompa", "range") { character -> source as Player source.playSound("chinchompa_explode", delay = 40) - character.setGraphic("chinchompa_hit") + character.gfx("chinchompa_hit") } combatAttack(type = "range") { source -> diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/weapon/HandCannon.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/weapon/HandCannon.kts index a1b3a950f..862030914 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/weapon/HandCannon.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/range/weapon/HandCannon.kts @@ -4,7 +4,6 @@ import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.equip.equipped import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.item.Item import world.gregs.voidps.engine.inv.equipment import world.gregs.voidps.engine.inv.remove @@ -25,14 +24,14 @@ combatSwing("hand_cannon", "range") { player -> val ammo = player.equipped(EquipSlot.Ammo) player.ammo = ammo.id player.setAnimation("hand_cannon_shoot") - player.setGraphic("hand_cannon_shoot") + player.gfx("hand_cannon_shoot") val time = player.shoot(id = player.ammo, target = target) player.hit(target, delay = time) if (player.specialAttack) { val rapid = player.attackType == "rapid" player.strongQueue("hit", 2) { player.setAnimation("hand_cannon_special") - player.setGraphic("hand_cannon_special") + player.gfx("hand_cannon_special") player.shoot(id = player.ammo, target = target) player.hit(target, delay = if (rapid) 30 else 60) } @@ -45,7 +44,7 @@ fun explode(player: Player, chance: Double) { return } player.setAnimation("hand_cannon_explode") - player.setGraphic("hand_cannon_explode") + player.gfx("hand_cannon_explode") player.weapon = Item.EMPTY player.damage(random.nextInt(10..160)) player.message("Your hand cannon explodes!") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/special/SpecialAttacks.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/special/SpecialAttacks.kts index 9a2d257bc..5bb056011 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/special/SpecialAttacks.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/combat/special/SpecialAttacks.kts @@ -2,7 +2,6 @@ package world.gregs.voidps.world.interact.entity.player.combat.special import world.gregs.voidps.engine.client.variable.variableSet import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.world.interact.entity.combat.hit.hit import world.gregs.voidps.world.interact.entity.combat.weapon import world.gregs.voidps.world.interact.entity.sound.playSound @@ -27,12 +26,12 @@ variableSet("special_attack", to = true) { player -> specialAttack { player -> player.setAnimation("${id}_special") - player.setGraphic("${id}_special") + player.gfx("${id}_special") player.playSound("${id}_special") val damage = player.hit(target) if (damage >= 0) { target.setAnimation("${id}_hit") - target.setGraphic("${id}_hit") + target.gfx("${id}_hit") } player.emit(SpecialAttackHit(id, target, damage)) } diff --git a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/display/tab/Emotes.kts b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/display/tab/Emotes.kts index 506024494..9863de342 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/display/tab/Emotes.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/interact/entity/player/display/tab/Emotes.kts @@ -73,7 +73,7 @@ interfaceOption(id = "emotes") { if (id == "air_guitar") { player.playJingle(id) } - player.setGraphic("emote_$id") + player.gfx("emote_$id") character.setAnimation("emote_$id") } } @@ -160,38 +160,38 @@ suspend fun Interaction.playEnhancedEmote(player: Player, type: String) } suspend fun Interaction.playEnhancedYawnEmote(player: Player) { - player.setGraphic("emote_enhanced_yawn") + player.gfx("emote_enhanced_yawn") player.animate("emote_enhanced_yawn") } suspend fun Interaction.playGiveThanksEmote(player: Player) { - player.setGraphic("emote_give_thanks") + player.gfx("emote_give_thanks") player.animate("emote_turkey_transform") player.transform("turkey") player.animate("emote_turkey_dance") - player.setGraphic("emote_give_thanks") + player.gfx("emote_give_thanks") player.clearTransform() player.animate("emote_turkey_return") } suspend fun Interaction.playSealOfApprovalEmote(player: Player) { - player.setGraphic("emote_seal_of_approval") + player.gfx("emote_seal_of_approval") player.animate("emote_seal_of_approval") player.transform("seal") player.animate("emote_seal_clap") player.animate("emote_seal_return") - player.setGraphic("emote_seal_of_approval") + player.gfx("emote_seal_of_approval") player.clearTransform() player.animate("emote_seal_stand") } suspend fun Interaction.playSkillCapeEmote(player: Player, skill: String) { - player.setGraphic("emote_$skill") + player.gfx("emote_$skill") player.animate("emote_$skill") } suspend fun Interaction.playDungeoneeringCapeEmote(player: Player) { - player.setGraphic("emote_dungeoneering_start") + player.gfx("emote_dungeoneering_start") player.animate("emote_dungeoneering_start") when (random.nextInt(3)) { 0 -> { @@ -214,21 +214,21 @@ suspend fun Interaction.playDungeoneeringMasterCapeEmote(player: Player) val direction = player.facing player.transform("sagittarian_ranger") - player.setGraphic("emote_dung_master_bow") + player.gfx("emote_dung_master_bow") var tile = player.tile.add(direction.rotate(1)) var rotation = tile.delta(player.tile).toDirection().rotate(2) areaGraphic("emote_dung_master_hobgoblin", tile, rotation = rotation) player.animate("emote_dung_master_bow") player.transform("celestial_mage") - player.setGraphic("emote_dung_master_spell") + player.gfx("emote_dung_master_spell") tile = player.tile.add(direction.rotate(7)) rotation = tile.delta(player.tile).toDirection().rotate(4) areaGraphic("emote_dung_master_gravecreeper", tile, rotation = rotation) player.animate("emote_dung_master_spell") player.transform("primal_warrior") - player.setGraphic("emote_dung_master_return") + player.gfx("emote_dung_master_return") tile = player.tile.add(direction) rotation = direction.inverse().rotate(7) areaGraphic("emote_dung_master_flesh_spoiler", tile, rotation = rotation) 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 c1931e75e..1c35e122a 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 @@ -35,8 +35,8 @@ inventoryItem("Emote", "reindeer_hat", "worn_equipment") { player.message("Please wait till you've finished performing your current emote.") return@inventoryItem } - player.setGraphic("emote_reindeer") - player.setGraphic("emote_reindeer_2") + player.gfx("emote_reindeer") + player.gfx("emote_reindeer_2") player.animate("emote_reindeer") } @@ -101,7 +101,7 @@ continueDialogue("snow_globe", "continue") { player -> interfaceClose("snow_globe") { player -> player.queue("snow_globe_close") { - player.setGraphic("emote_snow_globe_flurry") + player.gfx("emote_snow_globe_flurry") val ticks = player.setAnimation("emote_trample_snow") pause(ticks) player.message("The snow globe fills your inventory with snow!") @@ -153,7 +153,7 @@ inventoryItem("Celebrate", "tenth_anniversary_cake") { player.message("Please wait till you've finished performing your current emote.") return@inventoryItem } - player.setGraphic("10th_anniversary_cake") + player.gfx("10th_anniversary_cake") player.animate("emote_10th_anniversary_cake") } @@ -170,7 +170,7 @@ inventoryItem("Spin (2010)", "golden_hammer", "worn_equipment") { player.message("Please wait till you've finished performing your current emote.") return@inventoryItem } - player.setGraphic("emote_golden_hammer_spin") + player.gfx("emote_golden_hammer_spin") player.animate("emote_golden_hammer_spin") } @@ -179,7 +179,7 @@ inventoryOptions("Jump", "Walk", "Bow", "Dance", item = "*_marionette", inventor player.message("Please wait till you've finished performing your current emote.") return@inventoryOptions } - player.setGraphic("emote_${item.id}_${option.lowercase()}") + player.gfx("emote_${item.id}_${option.lowercase()}") player.animate("emote_marionette_${option.lowercase()}") } @@ -196,7 +196,7 @@ inventoryItem("Emote", "chocatrice_cape", "worn_equipment") { player.message("Please wait till you've finished performing your current emote.") return@inventoryItem } - player.setGraphic("emote_chocatrice_cape") + player.gfx("emote_chocatrice_cape") player.animate("emote_chocatrice_cape") } @@ -205,7 +205,7 @@ inventoryItem("Juggle", "squirrel_ears", "worn_equipment") { player.message("Please wait till you've finished performing your current emote.") return@inventoryItem } - player.setGraphic("emote_squirrel_ears") + player.gfx("emote_squirrel_ears") player.animate("emote_squirrel_ears") } @@ -228,7 +228,7 @@ inventoryOptions("Play-with", item = "eek") { player.message("Please wait till you've finished performing your current emote.") return@inventoryOptions } - player.setGraphic("play_with_eek") + player.gfx("play_with_eek") player.animate("play_with_eek") } 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 4f03c7f16..4aa162ed1 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 @@ -5,7 +5,6 @@ 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 import world.gregs.voidps.engine.entity.character.player.Player -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.queue.softQueue import world.gregs.voidps.world.activity.quest.questComplete import world.gregs.voidps.world.activity.skill.runecrafting.EssenceMine @@ -74,8 +73,8 @@ fun ChoiceBuilder>.teleportMe() { choice { option("Yes, that sounds good. Teleport me!") { npc("Okey dokey! Ready?") - player.setGraphic("curse_hit") - target.setGraphic("curse_cast") + player.gfx("curse_hit") + target.gfx("curse_cast") target.say("Dipsolum sententa sententi!") target.shoot("curse", player.tile, offset = 64) player.softQueue("cromperty_teleport", 2) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/falador/DressingRoom.kt b/game/src/main/kotlin/world/gregs/voidps/world/map/falador/DressingRoom.kt index beb875c24..12ab88928 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/falador/DressingRoom.kt +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/falador/DressingRoom.kt @@ -4,12 +4,11 @@ import world.gregs.voidps.engine.client.ui.closeDialogue import world.gregs.voidps.engine.client.ui.open import world.gregs.voidps.engine.entity.character.mode.interact.Interaction import world.gregs.voidps.engine.entity.character.player.Player -import world.gregs.voidps.engine.entity.character.setGraphic internal suspend fun Interaction.openDressingRoom(id: String) { player.closeDialogue() delay(1) - player.setGraphic("dressing_room_start") + player.gfx("dressing_room_start") delay(1) player.open(id) player.softTimers.start("dressing_room") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/falador/DressingRoom.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/falador/DressingRoom.kts index 6a05c4b13..04057c154 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/falador/DressingRoom.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/falador/DressingRoom.kts @@ -1,9 +1,7 @@ package world.gregs.voidps.world.map.falador import world.gregs.voidps.engine.client.ui.closeMenu -import world.gregs.voidps.engine.entity.character.clearGraphic import world.gregs.voidps.engine.entity.character.player.flagAppearance -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.timer.timerStart import world.gregs.voidps.engine.timer.timerStop import world.gregs.voidps.engine.timer.timerTick @@ -13,13 +11,13 @@ timerStart("dressing_room") { } timerTick("dressing_room") { player -> - player.setGraphic("dressing_room") + player.gfx("dressing_room") } timerStop("dressing_room") { player -> - player.clearGraphic() + player.clearGfx() player["delay"] = 1 player.closeMenu() - player.setGraphic("dressing_room_finish") + player.gfx("dressing_room_finish") player.flagAppearance() } \ No newline at end of file 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 495e735ac..b955e5ed8 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 @@ -14,7 +14,6 @@ import world.gregs.voidps.engine.entity.character.player.chat.notEnough import world.gregs.voidps.engine.entity.character.player.flagAppearance import world.gregs.voidps.engine.entity.character.player.male import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.npcSpawn import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.inv.holdsItem @@ -218,7 +217,7 @@ npcTimerTick("makeover") { npc -> val current: String = npc["transform_id", "makeover_mage_male"] val toFemale = current == "makeover_mage_male" npc.transform = if (toFemale) "makeover_mage_female" else "makeover_mage_male" - npc.setGraphic("curse_hit", delay = 15) + npc.gfx("curse_hit", delay = 15) npc.setAnimation("bind_staff") npc.softQueue("transform", 1) { npc.say(if (toFemale) "Ooh!" else "Aha!") diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/combat_hall/ArcheryTarget.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/combat_hall/ArcheryTarget.kts index 398c7004d..0dac70083 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/combat_hall/ArcheryTarget.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/lumbridge/combat_hall/ArcheryTarget.kts @@ -11,7 +11,6 @@ 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.player.skill.level.Interpolation import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.obj.GameObject import world.gregs.voidps.engine.entity.obj.objectOperate import world.gregs.voidps.engine.inv.equipment @@ -59,7 +58,7 @@ fun swing(player: Player, obj: GameObject, delay: Int) { player.equipment.remove(player.ammo) player.face(obj) player.setAnimation("bow_accurate") - player.setGraphic("training_arrows_shoot") + player.gfx("training_arrows_shoot") // We're going to ignore success check as we have no [Character] to check against val maxHit = Damage.maximum(player, player, "range", weapon) val hit = random.nextInt(-1, maxHit + 1) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/ourania/OuraniaAltar.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/ourania/OuraniaAltar.kts index 9cbc5eb0a..9df5d0462 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/ourania/OuraniaAltar.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/ourania/OuraniaAltar.kts @@ -9,7 +9,6 @@ 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.entity.character.setGraphic import world.gregs.voidps.engine.entity.item.drop.DropTables import world.gregs.voidps.engine.entity.item.drop.ItemDrop import world.gregs.voidps.engine.entity.obj.objectOperate @@ -56,7 +55,7 @@ objectOperate("Craft-rune", "ourania_altar") { TransactionError.None -> { player.exp(Skill.Runecrafting, experience) player.setAnimation("bind_runes") - player.setGraphic("bind_runes") + player.gfx("bind_runes") player.playSound("bind_runes") player.message("You bind the temple's power into runes.", ChatType.Filter) if (usedArdougneCloak) { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/ourania/ZamorakCrafter.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/ourania/ZamorakCrafter.kts index 301554e09..40637f937 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/ourania/ZamorakCrafter.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/ourania/ZamorakCrafter.kts @@ -5,7 +5,6 @@ import world.gregs.voidps.engine.entity.character.face import world.gregs.voidps.engine.entity.character.mode.Patrol import world.gregs.voidps.engine.entity.character.mode.move.npcMove import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.npcSpawn import world.gregs.voidps.engine.entity.obj.GameObjects import world.gregs.voidps.engine.inject @@ -26,7 +25,7 @@ npcMove("zamorak_crafter*", to = Tile(3314, 4811)) { } delay(4) npc.setAnimation("bind_runes") - npc.setGraphic("bind_runes") + npc.gfx("bind_runes") delay(4) val patrol = patrols.get("zamorak_crafter_to_bank") npc.mode = Patrol(npc, patrol.waypoints) 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 564348fd6..9d86bf04e 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 @@ -292,7 +292,7 @@ npcLevelChange("delrith", Skill.Constitution) { npc -> fun Context.questComplete() { player.setAnimation("silverlight_showoff") - player.setGraphic("silverlight_sparkle") + player.gfx("silverlight_sparkle") player.playSound("equip_silverlight") player.playJingle("quest_complete_1") player["demon_slayer"] = "completed" diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/GypsyAris.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/GypsyAris.kts index 016e12060..b1ae76519 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/GypsyAris.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/GypsyAris.kts @@ -6,7 +6,6 @@ import world.gregs.voidps.engine.client.shakeCamera import world.gregs.voidps.engine.client.turnCamera import world.gregs.voidps.engine.client.ui.close import world.gregs.voidps.engine.client.ui.open -import world.gregs.voidps.engine.event.Context import world.gregs.voidps.engine.entity.character.face import world.gregs.voidps.engine.entity.character.mode.Face import world.gregs.voidps.engine.entity.character.move.running @@ -17,7 +16,7 @@ import world.gregs.voidps.engine.entity.character.npc.npcOperate import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.combatLevel import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic +import world.gregs.voidps.engine.event.Context import world.gregs.voidps.engine.inv.inventory import world.gregs.voidps.engine.inv.remove import world.gregs.voidps.engine.queue.LogoutBehaviour @@ -270,7 +269,7 @@ suspend fun SuspendableContext.cutscene() { player.playJingle("quest_complete_1") player.face(Direction.SOUTH_WEST) player.setAnimation("silverlight_showoff") - player.setGraphic("silverlight_sparkle") + player.gfx("silverlight_sparkle") npc("wally", "I am the greatest demon slayer EVER!") npc("By reciting the correct magical incantation, and thrusting Silverlight into Delrith while he was newly summoned, Wally was able to imprison Delrith in the stone table at the centre of the circle.") 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 a722ab47a..a947156d2 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 @@ -275,13 +275,13 @@ fun teleport(player: Player, target: NPC) { player.closeInterfaces() player.queue("teleport", onCancel = null) { target.face(player) - target.setGraphic("tele_other") + target.gfx("tele_other") target.setAnimation("tele_other") player.playSound("tele_other_cast") target.say("Veniens! Sallakar! Rinnesset!") delay(2) player.setAnimation("lunar_teleport") - player.setGraphic("tele_other_receive") + player.gfx("tele_other_receive") player.playSound("teleport_all") delay(2) player["abyss_obstacles"] = random.nextInt(0, 12) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/palace/SirPrysin.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/palace/SirPrysin.kts index 50427c965..97d1b066f 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/palace/SirPrysin.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/palace/SirPrysin.kts @@ -8,7 +8,6 @@ import world.gregs.voidps.engine.entity.character.npc.NPCOption import world.gregs.voidps.engine.entity.character.npc.npcOperate 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 import world.gregs.voidps.engine.entity.obj.GameObjects import world.gregs.voidps.engine.inject import world.gregs.voidps.engine.inv.add @@ -266,7 +265,7 @@ suspend fun NPCOption.giveSilverlight() { player.inventory.add("silverlight") item("silverlight", 600, "Sir Prysin hands you a very shiny sword.") player.setAnimation("silverlight_showoff") - player.setGraphic("silverlight_sparkle") + player.gfx("silverlight_sparkle") player.playSound("equip_silverlight") delay() target.face(Direction.NONE) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/palace/VarrockPalaceDrain.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/palace/VarrockPalaceDrain.kts index 4f2ec6b1d..0b5404ee9 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/palace/VarrockPalaceDrain.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/varrock/palace/VarrockPalaceDrain.kts @@ -4,7 +4,6 @@ import com.github.michaelbull.logging.InlineLogger import world.gregs.voidps.engine.client.message import world.gregs.voidps.engine.client.ui.interact.itemOnObjectOperate import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.obj.objectOperate import world.gregs.voidps.engine.entity.playerSpawn import world.gregs.voidps.engine.inv.add @@ -54,7 +53,7 @@ itemOnObjectOperate("*of_water", "varrock_palace_drain") { player["demon_slayer_drain_dislodged"] = true player.message("You pour the liquid down the drain.") player.setAnimation("toss_water") - player.setGraphic("toss_water") + player.gfx("toss_water") player.playSound("demon_slayer_drain") player.playSound("demon_slayer_key_fall") if (player.quest("demon_slayer") == "key_hunt") { diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/wilderness/WildernessLevers.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/wilderness/WildernessLevers.kts index 71e3b4f20..c18e258f7 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/wilderness/WildernessLevers.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/wilderness/WildernessLevers.kts @@ -5,7 +5,6 @@ import world.gregs.voidps.engine.client.variable.start import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.entity.character.player.chat.ChatType import world.gregs.voidps.engine.entity.character.setAnimation -import world.gregs.voidps.engine.entity.character.setGraphic import world.gregs.voidps.engine.entity.obj.objectOperate import world.gregs.voidps.engine.suspend.SuspendableContext import world.gregs.voidps.world.interact.dialogue.type.choice @@ -45,13 +44,13 @@ suspend fun SuspendableContext.pullLever(player: Player) { teleportTakeOff("Pull", "lever_*") { delay = 3 player.playSound("teleport") - player.setGraphic("teleport_modern") + player.gfx("teleport_modern") player.setAnimation("teleport_modern") } teleportLand("Pull", "lever_*") { player.playSound("teleport_land") - player.setGraphic("teleport_land_modern") + player.gfx("teleport_land_modern") player.setAnimation("teleport_land_modern") val message: String = obj.getOrNull("land_message") ?: return@teleportLand player.message(message, ChatType.Filter) diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/wizards_tower/Traiborn.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/wizards_tower/Traiborn.kts index 776a51bc4..18d7ac0d3 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/wizards_tower/Traiborn.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/wizards_tower/Traiborn.kts @@ -186,7 +186,7 @@ suspend fun PlayerChoice.justTellMe(): Unit = option("Just tell me if you suspend fun TargetInteraction.startSpell() { npc("Hurrah! That's all 25 sets of bones.") target.setAnimation("traiborn_bone_spell") - target.setGraphic("traiborn_bone_spell") + target.gfx("traiborn_bone_spell") player.playSound("demon_slayer_bone_spell") npc("Wings of dark and colour too, Spreading in the morning dew; Locked away I have a key; Return it now, please, unto me.") player.playSound("demon_slayer_cupboard_appear") diff --git a/game/src/test/kotlin/world/gregs/voidps/world/activity/skill/FishingTest.kt b/game/src/test/kotlin/world/gregs/voidps/world/activity/skill/FishingTest.kt index b0aab3d0a..a5a4adb2b 100644 --- a/game/src/test/kotlin/world/gregs/voidps/world/activity/skill/FishingTest.kt +++ b/game/src/test/kotlin/world/gregs/voidps/world/activity/skill/FishingTest.kt @@ -2,6 +2,7 @@ package world.gregs.voidps.world.activity.skill import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test +import world.gregs.voidps.FakeRandom import world.gregs.voidps.engine.entity.character.player.skill.Skill import world.gregs.voidps.engine.inv.add import world.gregs.voidps.engine.inv.inventory @@ -14,7 +15,9 @@ internal class FishingTest : WorldTest() { @Test fun `Fishing gives fish and removes bait`() { - setRandom(Random) + setRandom(object : FakeRandom() { + override fun nextInt(until: Int): Int = 0 + }) val player = createPlayer("fisher", emptyTile) player.levels.set(Skill.Fishing, 20) val fishingSpot = createNPC("fishing_spot_lure_bait_lumbridge", emptyTile.addY(1)) diff --git a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/ExactMovement.kt b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/ExactMovement.kt index cff88a5e3..efd84bdab 100644 --- a/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/ExactMovement.kt +++ b/network/src/main/kotlin/world/gregs/voidps/network/login/protocol/visual/update/ExactMovement.kt @@ -2,6 +2,15 @@ package world.gregs.voidps.network.login.protocol.visual.update import world.gregs.voidps.network.login.protocol.Visual +/** + * @param startX The delta position to start X at + * @param startY The delta position to start Y at + * @param startDelay Client ticks until starting the movement + * @param endX The delta position to move X towards + * @param endY The delta position to move Y towards + * @param endDelay Number of client ticks to take moving + * @param direction The cardinal direction to face during movement + */ data class ExactMovement( var startX: Int = 0, var startY: Int = 0, diff --git a/types/src/main/kotlin/world/gregs/voidps/type/Delta.kt b/types/src/main/kotlin/world/gregs/voidps/type/Delta.kt index 09a0f6c85..f4e34fb6f 100644 --- a/types/src/main/kotlin/world/gregs/voidps/type/Delta.kt +++ b/types/src/main/kotlin/world/gregs/voidps/type/Delta.kt @@ -23,6 +23,8 @@ value class Delta(val id: Long) : Coordinate3D { fun isVertical() = y != 0 + fun invert() = Delta(-x, -y, -level) + override fun copy(x: Int, y: Int, level: Int) = Delta(x, y, level) fun toDirection(): Direction = when { diff --git a/types/src/test/kotlin/world/gregs/voidps/type/DeltaTest.kt b/types/src/test/kotlin/world/gregs/voidps/type/DeltaTest.kt index 23e1e2a12..2b7bfaabc 100644 --- a/types/src/test/kotlin/world/gregs/voidps/type/DeltaTest.kt +++ b/types/src/test/kotlin/world/gregs/voidps/type/DeltaTest.kt @@ -1,6 +1,6 @@ package world.gregs.voidps.type -import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test internal class DeltaTest { @@ -80,4 +80,69 @@ internal class DeltaTest { assertEquals(1, delta.level) } + @Test + fun `Vertical test`() { + assertTrue(Delta(0, 10, 1).isVertical()) + assertTrue(Delta(0, -5, 0).isVertical()) + assertFalse(Delta(5, 0, 2).isVertical()) + } + + @Test + fun `Horizontal test`() { + assertTrue(Delta(10, 1, 1).isHorizontal()) + assertTrue(Delta(-5, 2, 0).isHorizontal()) + assertFalse(Delta(0, 3, 2).isHorizontal()) + } + + @Test + fun `Cardinal test`() { + assertTrue(Delta(10, 0, 1).isCardinal()) + assertTrue(Delta(-5, 0, 0).isCardinal()) + assertTrue(Delta(0, 10, 1).isCardinal()) + assertTrue(Delta(0, -5, 0).isCardinal()) + assertFalse(Delta(3, 3, 2).isCardinal()) + assertFalse(Delta(-5, 3, 2).isCardinal()) + assertFalse(Delta(1, -3, 2).isCardinal()) + assertFalse(Delta(-1, -3, 2).isCardinal()) + } + + @Test + fun `Diagonal test`() { + assertTrue(Delta(10, 11, 1).isDiagonal()) + assertTrue(Delta(-10, 11, 1).isDiagonal()) + assertTrue(Delta(10, -11, 1).isDiagonal()) + assertTrue(Delta(-5, -15, 1).isDiagonal()) + assertFalse(Delta(10, 0, 2).isDiagonal()) + assertFalse(Delta(-10, 0, 0).isDiagonal()) + assertFalse(Delta(0, 10, 1).isDiagonal()) + assertFalse(Delta(0, -10, 2).isDiagonal()) + } + + @Test + fun `Invert test`() { + // Given + val delta = Delta(0, 10, 1) + // When + val result = delta.invert() + val x = result.x + val y = result.y + val level = result.level + // Then + assertEquals(0, x) + assertEquals(-10, y) + assertEquals(-1, level) + } + + @Test + fun `Direction test`() { + assertEquals(Direction.NORTH_WEST, Delta(-5, 15, 1).toDirection()) + assertEquals(Direction.NORTH, Delta(0, 11, 2).toDirection()) + assertEquals(Direction.NORTH_EAST, Delta(10, 11, 0).toDirection()) + assertEquals(Direction.EAST, Delta(10, 0, 1).toDirection()) + assertEquals(Direction.SOUTH_EAST, Delta(6, -11, 3).toDirection()) + assertEquals(Direction.SOUTH, Delta(0, -8, 0).toDirection()) + assertEquals(Direction.SOUTH_WEST, Delta(-1, -4, 2).toDirection()) + assertEquals(Direction.WEST, Delta(-5, 0, 1).toDirection()) + } + } \ No newline at end of file