mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 02:24:45 +00:00
Restore /warp -list functionality
This commit is contained in:
parent
825f00da6d
commit
677ecd8dd5
|
|
@ -673,11 +673,11 @@ class ChatActor(
|
|||
case (CMT_WARP, _, contents) if gmCommandAllowed =>
|
||||
val buffer = contents.toLowerCase.split("\\s+")
|
||||
val (coordinates, waypoint) = (buffer.lift(0), buffer.lift(1), buffer.lift(2)) match {
|
||||
case (Some(x), Some(y), Some(z)) => (Some(x, y, z), None)
|
||||
case (Some("to"), Some(character), None) => (None, None) // TODO not implemented
|
||||
case (Some("near"), Some(objectName), None) => (None, None) // TODO not implemented
|
||||
case (Some(waypoint), None, None) => (None, Some(waypoint))
|
||||
case _ => (None, None)
|
||||
case (Some(x), Some(y), Some(z)) => (Some(x, y, z), None)
|
||||
case (Some("to"), Some(character), None) => (None, None) // TODO not implemented
|
||||
case (Some("near"), Some(objectName), None) => (None, None) // TODO not implemented
|
||||
case (Some(waypoint), None, None) if waypoint.nonEmpty => (None, Some(waypoint))
|
||||
case _ => (None, None)
|
||||
}
|
||||
(coordinates, waypoint) match {
|
||||
case (Some((x, y, z)), None) if List(x, y, z).forall { str =>
|
||||
|
|
@ -685,6 +685,12 @@ class ChatActor(
|
|||
coordinate.isDefined && coordinate.get >= 0 && coordinate.get <= 8191
|
||||
} =>
|
||||
sessionActor ! SessionActor.SetPosition(Vector3(x.toFloat, y.toFloat, z.toFloat))
|
||||
case (None, Some(waypoint)) if waypoint == "-list" =>
|
||||
val zone = PointOfInterest.get(session.player.Zone.id)
|
||||
zone match {
|
||||
case Some(zone: PointOfInterest) => sessionActor ! SessionActor.SendResponse(ChatMsg(UNK_229, true, "", PointOfInterest.listAll(zone), None))
|
||||
case _ => ChatMsg(UNK_229, true, "", s"unknown player zone '${session.player.Zone.id}'", None)
|
||||
}
|
||||
case (None, Some(waypoint)) if waypoint != "-help" =>
|
||||
PointOfInterest.getWarpLocation(session.zone.id, waypoint) match {
|
||||
case Some(location) => sessionActor ! SessionActor.SetPosition(location)
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ object PointOfInterest {
|
|||
* @return all of the location keys
|
||||
*/
|
||||
def listLocations(zone: PointOfInterest): String = {
|
||||
var out: String = "warps: "
|
||||
var out: String = "Locations: "
|
||||
if (zone.locations.nonEmpty) {
|
||||
out += zone.locations.keys.toArray.sorted.mkString(", ")
|
||||
} else
|
||||
|
|
@ -201,7 +201,7 @@ object PointOfInterest {
|
|||
* @return all of the warpgate keys
|
||||
*/
|
||||
def listWarpgates(zone: PointOfInterest): String = {
|
||||
var out: String = "gatenames: "
|
||||
var out: String = "Gates: "
|
||||
if (zone.gates.isEmpty)
|
||||
out += "none"
|
||||
else
|
||||
|
|
@ -209,6 +209,15 @@ object PointOfInterest {
|
|||
out
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name for all of the warpgates and locations that can be visited in this `CSRZone`.
|
||||
* @param zone the `CSRZone`
|
||||
* @return all of the warpgate and location keys
|
||||
*/
|
||||
def listAll(zone: PointOfInterest): String = {
|
||||
s"${listWarpgates(zone)} ${listLocations(zone)}"
|
||||
}
|
||||
|
||||
/**
|
||||
* Select, of all the `CSRZone` locations and warpgates, a pseudorandom destination to spawn the player in the zone if none has been specified.
|
||||
* @param zone the `CSRZone`
|
||||
|
|
|
|||
Loading…
Reference in a new issue