Some little corrections (#91)

* Some little corrections

* Update WorldSessionActor.scala

Fate & Chord requests
This commit is contained in:
SouNourS 2017-03-04 16:04:17 +01:00 committed by pschord
parent 5f02d73f99
commit b00748727e
6 changed files with 36 additions and 17 deletions

View file

@ -21,11 +21,11 @@ import scodec.codecs._
* @param seq_time na
* @param unk3 na
* @param is_crouching whether the player is crouched
* @param is_jumping na
* @param unk4 na
* @param unk5 na
* @param is_cloaking whether the player is cloaked by virtue of an Infiltration Suit
* @param unk5 na
* @param unk6 na
* @param unk7 na
*/
final case class PlayerStateMessageUpstream(avatar_guid : PlanetSideGUID,
pos : Vector3,
@ -36,11 +36,11 @@ final case class PlayerStateMessageUpstream(avatar_guid : PlanetSideGUID,
seq_time : Int,
unk3 : Int,
is_crouching : Boolean,
is_jumping : Boolean,
unk4 : Boolean,
unk5 : Boolean,
is_cloaking : Boolean,
unk6 : Int,
unk7 : Int)
unk5 : Int,
unk6 : Int)
extends PlanetSideGamePacket {
type Packet = PlayerStateMessageUpstream
def opcode = GamePacketOpcode.PlayerStateMessageUpstream
@ -58,10 +58,10 @@ object PlayerStateMessageUpstream extends Marshallable[PlayerStateMessageUpstrea
("seq_time" | uintL(10)) ::
("unk3" | uintL(3)) ::
("is_crouching" | bool) ::
("is_jumping" | bool) ::
("unk4" | bool) ::
("unk5" | bool) ::
("is_cloaking" | bool) ::
("unk6" | uint8L) ::
("unk7" | uint16L)
("unk5" | uint8L) ::
("unk6" | uint16L)
).as[PlayerStateMessageUpstream]
}

View file

@ -50,7 +50,7 @@ final case class ShiftState(unk : Int,
final case class PlayerStateShiftMessage(state : Option[ShiftState],
unk : Option[Int] = None)
extends PlanetSideGamePacket {
type Packet = TimeOfDayMessage
type Packet = PlayerStateShiftMessage
def opcode = GamePacketOpcode.PlayerStateShiftMessage
def encode = PlayerStateShiftMessage.encode(this)
}

View file

@ -7,9 +7,9 @@ import scodec.codecs._
object TransactionType extends Enumeration {
type Type = Value
val Unk0,
Unk1,
Learn, // certif term or Buy (v-term)
Buy,
Sell,
Sell, // or forget on certif term
Unk4,
Unk5,
Infantry_Loadout,

View file

@ -136,7 +136,7 @@ class LoginSessionActor extends Actor with MDCContextAware {
def updateServerList() = {
val msg = VNLWorldStatusMessage("Welcome to PlanetSide! ",
Vector(
WorldInformation(serverName, WorldStatus.Up, ServerType.Released,
WorldInformation(serverName, WorldStatus.Up, ServerType.Beta,
Vector(WorldConnectionInfo(serverAddress)), PlanetSideEmpire.VS)
))

View file

@ -1,6 +1,7 @@
// Copyright (c) 2016 PSForever.net to present
import java.net.InetAddress
import java.io.File
import java.util.Locale
import akka.actor.{ActorSystem, Props}
import ch.qos.logback.classic.LoggerContext
@ -18,6 +19,7 @@ import scala.collection.JavaConverters._
import scala.concurrent.Await
import scala.concurrent.duration._
object PsLogin {
private val logger = org.log4s.getLogger
@ -209,6 +211,7 @@ object PsLogin {
}
def main(args : Array[String]) : Unit = {
Locale.setDefault(Locale.US); // to have floats with dots, not comma...
this.args = args
run()

View file

@ -10,7 +10,7 @@ import scodec.bits._
import org.log4s.MDC
import MDCContextAware.Implicits._
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 {
private[this] val log = org.log4s.getLogger
@ -235,7 +235,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
case KeepAliveMessage(code) =>
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)
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)
}
if (messagetype == ChatMessageType.CMT_VOICE) {
sendResponse(PacketCoding.CreateGamePacket(0, ChatMsg(ChatMessageType.CMT_VOICE, false, "IlllIIIlllIlIllIlllIllI", contents, None)))
}
// TODO: handle this appropriately
if(messagetype == ChatMessageType.CMT_QUIT) {
sendResponse(DropCryptoSession())
@ -306,9 +310,11 @@ class WorldSessionActor extends Actor with MDCContextAware {
sendResponse(PacketCoding.CreateGamePacket(0, ObjectDeleteMessage(object_guid, 0)))
case msg @ ObjectDeleteMessage(object_guid, unk1) =>
sendResponse(PacketCoding.CreateGamePacket(0, ObjectDeleteMessage(object_guid, 0)))
log.info("ObjectDelete: " + msg)
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)
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 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)))
// 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)))
if(unk1 != 0){ // TODO : medkit use ?!
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) =>
log.info("GenericObjectState: " + msg)
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)
case msg @ WeaponDelayFireMessage(seq_time, weapon_guid) =>
@ -344,6 +358,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
log.info("WarpgateRequest: " + msg)
case msg @ MountVehicleMsg(player_guid, vehicle_guid, unk) =>
//sendResponse(PacketCoding.CreateGamePacket(0, ObjectAttachMessage(vehicle_guid,player_guid,0)))
log.info("MounVehicleMsg: "+msg)
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) =>
log.info("BugReportMessage: " + msg)
case default => log.debug(s"Unhandled GamePacket ${pkt}")
case default => log.error(s"Unhandled GamePacket ${pkt}")
}
def failWithError(error : String) = {