mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-29 07:45:26 +00:00
Some little corrections (#91)
* Some little corrections * Update WorldSessionActor.scala Fate & Chord requests
This commit is contained in:
parent
5f02d73f99
commit
b00748727e
6 changed files with 36 additions and 17 deletions
|
|
@ -21,11 +21,11 @@ import scodec.codecs._
|
||||||
* @param seq_time na
|
* @param seq_time na
|
||||||
* @param unk3 na
|
* @param unk3 na
|
||||||
* @param is_crouching whether the player is crouched
|
* @param is_crouching whether the player is crouched
|
||||||
|
* @param is_jumping na
|
||||||
* @param unk4 na
|
* @param unk4 na
|
||||||
* @param unk5 na
|
|
||||||
* @param is_cloaking whether the player is cloaked by virtue of an Infiltration Suit
|
* @param is_cloaking whether the player is cloaked by virtue of an Infiltration Suit
|
||||||
|
* @param unk5 na
|
||||||
* @param unk6 na
|
* @param unk6 na
|
||||||
* @param unk7 na
|
|
||||||
*/
|
*/
|
||||||
final case class PlayerStateMessageUpstream(avatar_guid : PlanetSideGUID,
|
final case class PlayerStateMessageUpstream(avatar_guid : PlanetSideGUID,
|
||||||
pos : Vector3,
|
pos : Vector3,
|
||||||
|
|
@ -36,11 +36,11 @@ final case class PlayerStateMessageUpstream(avatar_guid : PlanetSideGUID,
|
||||||
seq_time : Int,
|
seq_time : Int,
|
||||||
unk3 : Int,
|
unk3 : Int,
|
||||||
is_crouching : Boolean,
|
is_crouching : Boolean,
|
||||||
|
is_jumping : Boolean,
|
||||||
unk4 : Boolean,
|
unk4 : Boolean,
|
||||||
unk5 : Boolean,
|
|
||||||
is_cloaking : Boolean,
|
is_cloaking : Boolean,
|
||||||
unk6 : Int,
|
unk5 : Int,
|
||||||
unk7 : Int)
|
unk6 : Int)
|
||||||
extends PlanetSideGamePacket {
|
extends PlanetSideGamePacket {
|
||||||
type Packet = PlayerStateMessageUpstream
|
type Packet = PlayerStateMessageUpstream
|
||||||
def opcode = GamePacketOpcode.PlayerStateMessageUpstream
|
def opcode = GamePacketOpcode.PlayerStateMessageUpstream
|
||||||
|
|
@ -58,10 +58,10 @@ object PlayerStateMessageUpstream extends Marshallable[PlayerStateMessageUpstrea
|
||||||
("seq_time" | uintL(10)) ::
|
("seq_time" | uintL(10)) ::
|
||||||
("unk3" | uintL(3)) ::
|
("unk3" | uintL(3)) ::
|
||||||
("is_crouching" | bool) ::
|
("is_crouching" | bool) ::
|
||||||
|
("is_jumping" | bool) ::
|
||||||
("unk4" | bool) ::
|
("unk4" | bool) ::
|
||||||
("unk5" | bool) ::
|
|
||||||
("is_cloaking" | bool) ::
|
("is_cloaking" | bool) ::
|
||||||
("unk6" | uint8L) ::
|
("unk5" | uint8L) ::
|
||||||
("unk7" | uint16L)
|
("unk6" | uint16L)
|
||||||
).as[PlayerStateMessageUpstream]
|
).as[PlayerStateMessageUpstream]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ final case class ShiftState(unk : Int,
|
||||||
final case class PlayerStateShiftMessage(state : Option[ShiftState],
|
final case class PlayerStateShiftMessage(state : Option[ShiftState],
|
||||||
unk : Option[Int] = None)
|
unk : Option[Int] = None)
|
||||||
extends PlanetSideGamePacket {
|
extends PlanetSideGamePacket {
|
||||||
type Packet = TimeOfDayMessage
|
type Packet = PlayerStateShiftMessage
|
||||||
def opcode = GamePacketOpcode.PlayerStateShiftMessage
|
def opcode = GamePacketOpcode.PlayerStateShiftMessage
|
||||||
def encode = PlayerStateShiftMessage.encode(this)
|
def encode = PlayerStateShiftMessage.encode(this)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ import scodec.codecs._
|
||||||
object TransactionType extends Enumeration {
|
object TransactionType extends Enumeration {
|
||||||
type Type = Value
|
type Type = Value
|
||||||
val Unk0,
|
val Unk0,
|
||||||
Unk1,
|
Learn, // certif term or Buy (v-term)
|
||||||
Buy,
|
Buy,
|
||||||
Sell,
|
Sell, // or forget on certif term
|
||||||
Unk4,
|
Unk4,
|
||||||
Unk5,
|
Unk5,
|
||||||
Infantry_Loadout,
|
Infantry_Loadout,
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ class LoginSessionActor extends Actor with MDCContextAware {
|
||||||
def updateServerList() = {
|
def updateServerList() = {
|
||||||
val msg = VNLWorldStatusMessage("Welcome to PlanetSide! ",
|
val msg = VNLWorldStatusMessage("Welcome to PlanetSide! ",
|
||||||
Vector(
|
Vector(
|
||||||
WorldInformation(serverName, WorldStatus.Up, ServerType.Released,
|
WorldInformation(serverName, WorldStatus.Up, ServerType.Beta,
|
||||||
Vector(WorldConnectionInfo(serverAddress)), PlanetSideEmpire.VS)
|
Vector(WorldConnectionInfo(serverAddress)), PlanetSideEmpire.VS)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2016 PSForever.net to present
|
// Copyright (c) 2016 PSForever.net to present
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
import akka.actor.{ActorSystem, Props}
|
import akka.actor.{ActorSystem, Props}
|
||||||
import ch.qos.logback.classic.LoggerContext
|
import ch.qos.logback.classic.LoggerContext
|
||||||
|
|
@ -18,6 +19,7 @@ import scala.collection.JavaConverters._
|
||||||
import scala.concurrent.Await
|
import scala.concurrent.Await
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
|
|
||||||
object PsLogin {
|
object PsLogin {
|
||||||
private val logger = org.log4s.getLogger
|
private val logger = org.log4s.getLogger
|
||||||
|
|
||||||
|
|
@ -209,6 +211,7 @@ object PsLogin {
|
||||||
}
|
}
|
||||||
|
|
||||||
def main(args : Array[String]) : Unit = {
|
def main(args : Array[String]) : Unit = {
|
||||||
|
Locale.setDefault(Locale.US); // to have floats with dots, not comma...
|
||||||
this.args = args
|
this.args = args
|
||||||
run()
|
run()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import scodec.bits._
|
||||||
import org.log4s.MDC
|
import org.log4s.MDC
|
||||||
import MDCContextAware.Implicits._
|
import MDCContextAware.Implicits._
|
||||||
import net.psforever.packet.game.objectcreate._
|
import net.psforever.packet.game.objectcreate._
|
||||||
import net.psforever.types.{ChatMessageType, PlanetSideEmpire, Vector3}
|
import net.psforever.types.{ChatMessageType, TransactionType, PlanetSideEmpire, Vector3}
|
||||||
|
|
||||||
class WorldSessionActor extends Actor with MDCContextAware {
|
class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
private[this] val log = org.log4s.getLogger
|
private[this] val log = org.log4s.getLogger
|
||||||
|
|
@ -235,7 +235,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
case KeepAliveMessage(code) =>
|
case KeepAliveMessage(code) =>
|
||||||
sendResponse(PacketCoding.CreateGamePacket(0, KeepAliveMessage(0)))
|
sendResponse(PacketCoding.CreateGamePacket(0, KeepAliveMessage(0)))
|
||||||
|
|
||||||
case msg @ PlayerStateMessageUpstream(avatar_guid, pos, vel, unk1, aim_pitch, unk2, seq_time, unk3, is_crouching, unk4, unk5, is_cloaking, unk6, unk7) =>
|
case msg @ PlayerStateMessageUpstream(avatar_guid, pos, vel, unk1, aim_pitch, unk2, seq_time, unk3, is_crouching, is_jumping, unk4, is_cloaking, unk5, unk6) =>
|
||||||
//log.info("PlayerState: " + msg)
|
//log.info("PlayerState: " + msg)
|
||||||
|
|
||||||
case msg @ ChatMsg(messagetype, has_wide_contents, recipient, contents, note_contents) =>
|
case msg @ ChatMsg(messagetype, has_wide_contents, recipient, contents, note_contents) =>
|
||||||
|
|
@ -244,6 +244,10 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
log.info("Chat: " + msg)
|
log.info("Chat: " + msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (messagetype == ChatMessageType.CMT_VOICE) {
|
||||||
|
sendResponse(PacketCoding.CreateGamePacket(0, ChatMsg(ChatMessageType.CMT_VOICE, false, "IlllIIIlllIlIllIlllIllI", contents, None)))
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: handle this appropriately
|
// TODO: handle this appropriately
|
||||||
if(messagetype == ChatMessageType.CMT_QUIT) {
|
if(messagetype == ChatMessageType.CMT_QUIT) {
|
||||||
sendResponse(DropCryptoSession())
|
sendResponse(DropCryptoSession())
|
||||||
|
|
@ -306,9 +310,11 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
sendResponse(PacketCoding.CreateGamePacket(0, ObjectDeleteMessage(object_guid, 0)))
|
sendResponse(PacketCoding.CreateGamePacket(0, ObjectDeleteMessage(object_guid, 0)))
|
||||||
|
|
||||||
case msg @ ObjectDeleteMessage(object_guid, unk1) =>
|
case msg @ ObjectDeleteMessage(object_guid, unk1) =>
|
||||||
|
sendResponse(PacketCoding.CreateGamePacket(0, ObjectDeleteMessage(object_guid, 0)))
|
||||||
log.info("ObjectDelete: " + msg)
|
log.info("ObjectDelete: " + msg)
|
||||||
|
|
||||||
case msg @ MoveItemMessage(item_guid, avatar_guid_1, avatar_guid_2, dest, unk1) =>
|
case msg @ MoveItemMessage(item_guid, avatar_guid_1, avatar_guid_2, dest, unk1) =>
|
||||||
|
sendResponse(PacketCoding.CreateGamePacket(0, ObjectAttachMessage(avatar_guid_1,item_guid,dest)))
|
||||||
log.info("MoveItem: " + msg)
|
log.info("MoveItem: " + msg)
|
||||||
|
|
||||||
case msg @ ChangeAmmoMessage(item_guid, unk1) =>
|
case msg @ ChangeAmmoMessage(item_guid, unk1) =>
|
||||||
|
|
@ -319,13 +325,21 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
// TODO: Not all fields in the response are identical to source in real packet logs (but seems to be ok)
|
// TODO: Not all fields in the response are identical to source in real packet logs (but seems to be ok)
|
||||||
// TODO: Not all incoming UseItemMessage's respond with another UseItemMessage (i.e. doors only send out GenericObjectStateMsg)
|
// TODO: Not all incoming UseItemMessage's respond with another UseItemMessage (i.e. doors only send out GenericObjectStateMsg)
|
||||||
sendResponse(PacketCoding.CreateGamePacket(0, UseItemMessage(avatar_guid, unk1, object_guid, unk2, unk3, unk4, unk5, unk6, unk7, unk8, unk9)))
|
sendResponse(PacketCoding.CreateGamePacket(0, UseItemMessage(avatar_guid, unk1, object_guid, unk2, unk3, unk4, unk5, unk6, unk7, unk8, unk9)))
|
||||||
// TODO: This should only actually be sent to doors upon opening; may break non-door items upon use
|
if(unk1 != 0){ // TODO : medkit use ?!
|
||||||
sendResponse(PacketCoding.CreateGamePacket(0, GenericObjectStateMsg(object_guid, 16)))
|
sendResponse(PacketCoding.CreateGamePacket(0, GenericObjectStateMsg(object_guid, 16)))
|
||||||
|
sendResponse(PacketCoding.CreateGamePacket(0, ObjectDeleteMessage(PlanetSideGUID(unk1), 2)))
|
||||||
|
} else {
|
||||||
|
// TODO: This should only actually be sent to doors upon opening; may break non-door items upon use
|
||||||
|
sendResponse(PacketCoding.CreateGamePacket(0, GenericObjectStateMsg(object_guid, 16)))
|
||||||
|
}
|
||||||
|
|
||||||
case msg @ GenericObjectStateMsg(object_guid, unk1) =>
|
case msg @ GenericObjectStateMsg(object_guid, unk1) =>
|
||||||
log.info("GenericObjectState: " + msg)
|
log.info("GenericObjectState: " + msg)
|
||||||
|
|
||||||
case msg @ ItemTransactionMessage(terminal_guid, transaction_type, item_page, item_name, unk1, item_guid) =>
|
case msg @ ItemTransactionMessage(terminal_guid, transaction_type, item_page, item_name, unk1, item_guid) =>
|
||||||
|
if(transaction_type == TransactionType.Sell) {
|
||||||
|
sendResponse(PacketCoding.CreateGamePacket(0, ObjectDeleteMessage(item_guid, 0)))
|
||||||
|
}
|
||||||
log.info("ItemTransaction: " + msg)
|
log.info("ItemTransaction: " + msg)
|
||||||
|
|
||||||
case msg @ WeaponDelayFireMessage(seq_time, weapon_guid) =>
|
case msg @ WeaponDelayFireMessage(seq_time, weapon_guid) =>
|
||||||
|
|
@ -344,6 +358,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
log.info("WarpgateRequest: " + msg)
|
log.info("WarpgateRequest: " + msg)
|
||||||
|
|
||||||
case msg @ MountVehicleMsg(player_guid, vehicle_guid, unk) =>
|
case msg @ MountVehicleMsg(player_guid, vehicle_guid, unk) =>
|
||||||
|
//sendResponse(PacketCoding.CreateGamePacket(0, ObjectAttachMessage(vehicle_guid,player_guid,0)))
|
||||||
log.info("MounVehicleMsg: "+msg)
|
log.info("MounVehicleMsg: "+msg)
|
||||||
|
|
||||||
case msg @ AvatarGrenadeStateMessage(player_guid, state) =>
|
case msg @ AvatarGrenadeStateMessage(player_guid, state) =>
|
||||||
|
|
@ -355,7 +370,8 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
case msg @ BugReportMessage(version_major,version_minor,version_date,bug_type,repeatable,location,zone,pos,summary,desc) =>
|
case msg @ BugReportMessage(version_major,version_minor,version_date,bug_type,repeatable,location,zone,pos,summary,desc) =>
|
||||||
log.info("BugReportMessage: " + msg)
|
log.info("BugReportMessage: " + msg)
|
||||||
|
|
||||||
case default => log.debug(s"Unhandled GamePacket ${pkt}")
|
case default => log.error(s"Unhandled GamePacket ${pkt}")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def failWithError(error : String) = {
|
def failWithError(error : String) = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue