mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-22 10:55:13 -06:00
Combination runes + basic house door handling
This commit is contained in:
parent
baafb941a3
commit
3520b46f45
4 changed files with 71 additions and 7 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package core.game.node.entity.skill.magic;
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -9,7 +11,9 @@ public enum CombinationRune {
|
|||
MIST_RUNE(4695,Runes.WATER_RUNE,Runes.AIR_RUNE),
|
||||
DUST_RUNE(4696, Runes.AIR_RUNE,Runes.EARTH_RUNE),
|
||||
SMOKE_RUNE(4697,Runes.FIRE_RUNE,Runes.AIR_RUNE),
|
||||
MUD_RUNE(4698,Runes.EARTH_RUNE,Runes.WATER_RUNE);
|
||||
MUD_RUNE(4698,Runes.EARTH_RUNE,Runes.WATER_RUNE),
|
||||
COMBO_ELEMENTAL(Items.ELEMENTAL_RUNE_12850, Runes.FIRE_RUNE, Runes.AIR_RUNE, Runes.EARTH_RUNE, Runes.WATER_RUNE),
|
||||
COMBO_CATALYTIC(Items.CATALYTIC_RUNE_12851, Runes.MIND_RUNE, Runes.BODY_RUNE, Runes.DEATH_RUNE, Runes.CHAOS_RUNE);
|
||||
|
||||
|
||||
public Runes[] types;
|
||||
|
|
|
|||
|
|
@ -737,14 +737,10 @@ object ContentAPI {
|
|||
* Force an entity to walk to a given destination.
|
||||
* @param entity the entity to forcewalk
|
||||
* @param dest the Location object to walk to
|
||||
* @param type the type of pathfinder to use. "smart" for the SMART pathfinder, "clip" for the noclip pathfinder, anything else for DUMB.
|
||||
* @param type the type of pathfinder to use. "smart" for the SMART pathfinder, anything else for DUMB.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun forceWalk(entity: Entity, dest: Location, type: String){
|
||||
if(type == "clip"){
|
||||
ForceMovement(entity, dest, 10, 10).run()
|
||||
return
|
||||
}
|
||||
val pathfinder = when(type){
|
||||
"smart" -> Pathfinder.SMART
|
||||
else -> Pathfinder.DUMB
|
||||
|
|
@ -753,6 +749,19 @@ object ContentAPI {
|
|||
path.walk(entity)
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces an entity to walk a certain number of steps in the desired direction. This ignores normal pathfinding rules.
|
||||
* @param entity the entity to move
|
||||
* @param steps the # of steps to take
|
||||
* @param dir the Direction to take them in. An enum exists for this called Direction. Default is the player's currently-facing direction.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun forceWalkStep(entity: Entity, steps: Int, dir: Direction = entity.direction){
|
||||
val newLoc = entity.location.transform(dir, steps)
|
||||
entity.walkingQueue.reset()
|
||||
entity.walkingQueue.addPath(newLoc.x, newLoc.y)
|
||||
}
|
||||
|
||||
/**
|
||||
* Interrupts a given entity's walking queue
|
||||
* @param entity the entity to interrupt
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import api.ContentAPI
|
|||
import core.game.node.entity.combat.DeathTask
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import org.rs09.consts.Items
|
||||
import kotlin.math.max
|
||||
|
||||
|
|
@ -41,6 +42,13 @@ object FOGUtils {
|
|||
}
|
||||
}
|
||||
|
||||
fun isInHouse(player: Player): Boolean {
|
||||
for(z in houseZones){
|
||||
if(z.insideBorder(player)) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun updateHuntStatus(player: Player, hunter: Boolean){
|
||||
player.packetDispatch.sendInterfaceConfig(730, 25, hunter)
|
||||
player.packetDispatch.sendInterfaceConfig(730, 26, !hunter)
|
||||
|
|
@ -71,6 +79,13 @@ object FOGUtils {
|
|||
player.packetDispatch.sendInterfaceConfig(730, 23, false)
|
||||
}
|
||||
|
||||
val houseZones = arrayOf(
|
||||
ZoneBorders(1650, 5702, 1652, 5704),
|
||||
ZoneBorders(1666, 5703, 1668, 5705),
|
||||
ZoneBorders(1675, 5687, 1677, 5689),
|
||||
ZoneBorders(1655, 5682, 1657, 5684)
|
||||
)
|
||||
|
||||
val startLocations = arrayOf(
|
||||
Location.create(1627, 5708, 0),
|
||||
Location.create(1624, 5697, 0),
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import core.game.node.Node
|
|||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.map.Direction
|
||||
import core.game.world.map.zone.MapZone
|
||||
import core.game.world.map.zone.ZoneBuilder
|
||||
import core.game.world.map.zone.ZoneRestriction
|
||||
|
|
@ -57,6 +58,7 @@ class FOGZone : MapZone("Fist of Guthix", true, ZoneRestriction.RANDOM_EVENTS, Z
|
|||
|
||||
override fun interact(e: Entity?, target: Node?, option: Option?): Boolean {
|
||||
if(e !is Player) return false
|
||||
target ?: return false
|
||||
|
||||
when(option?.name?.toLowerCase()){
|
||||
"take-stone" -> {
|
||||
|
|
@ -75,7 +77,41 @@ class FOGZone : MapZone("Fist of Guthix", true, ZoneRestriction.RANDOM_EVENTS, Z
|
|||
}
|
||||
|
||||
"pass" -> {
|
||||
ContentAPI.forceWalk(e, e.location.transform(e.direction), "clip")
|
||||
ContentAPI.submitIndividualPulse(e, object : Pulse(){
|
||||
var counter = 0
|
||||
val stepDir = if(!FOGUtils.isInHouse(e)) {
|
||||
when (target.asScenery().rotation) {
|
||||
0 -> Direction.WEST
|
||||
1 -> Direction.NORTH
|
||||
2 -> Direction.EAST
|
||||
3 -> Direction.SOUTH
|
||||
else -> target.direction
|
||||
}
|
||||
} else {
|
||||
when (target.asScenery().rotation) {
|
||||
0 -> Direction.EAST
|
||||
1 -> Direction.SOUTH
|
||||
2 -> Direction.WEST
|
||||
3 -> Direction.NORTH
|
||||
else -> target.direction
|
||||
}
|
||||
}
|
||||
override fun pulse(): Boolean {
|
||||
when(counter++){
|
||||
0 -> {
|
||||
ContentAPI.lockInteractions(e,5)
|
||||
ContentAPI.forceWalk(e, target.location, "dumb")
|
||||
ContentAPI.face(e, target.location.transform(stepDir))
|
||||
}
|
||||
1 -> {
|
||||
ContentAPI.forceWalkStep(e, 1, stepDir)
|
||||
}
|
||||
2 -> e.unlock().also { return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue