mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-13 15:34:42 +00:00
initial ActionCancelMessage packet work and tests; borrowed aphedox hack message to pry at door
This commit is contained in:
parent
249eb96cc5
commit
3dd2d72117
5 changed files with 72 additions and 8 deletions
|
|
@ -7,12 +7,7 @@ import net.psforever.objects.doors.{DoorDefinition, IFFLockDefinition}
|
||||||
import net.psforever.objects.equipment.CItem.DeployedItem
|
import net.psforever.objects.equipment.CItem.DeployedItem
|
||||||
import net.psforever.objects.equipment._
|
import net.psforever.objects.equipment._
|
||||||
import net.psforever.objects.inventory.InventoryTile
|
import net.psforever.objects.inventory.InventoryTile
|
||||||
<<<<<<< c5ae9e477ccade5759eac2e9526ba898d0e8f16b
|
|
||||||
import net.psforever.objects.terminals.{CertTerminalDefinition, OrderTerminalDefinition}
|
import net.psforever.objects.terminals.{CertTerminalDefinition, OrderTerminalDefinition}
|
||||||
import net.psforever.packet.game.objectcreate.ObjectClass
|
|
||||||
=======
|
|
||||||
import net.psforever.objects.terminals.OrderTerminalDefinition
|
|
||||||
>>>>>>> automated doors, IFF locks, and bases thus that only permissible doors can be opened by players of correct faction alignment; Base is just a prototype example, hastily created for this functionality; LocalService will eventually be used for doors messages (and other things)
|
|
||||||
import net.psforever.types.PlanetSideEmpire
|
import net.psforever.types.PlanetSideEmpire
|
||||||
|
|
||||||
object GlobalDefinitions {
|
object GlobalDefinitions {
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ object GamePacketOpcode extends Enumeration {
|
||||||
// OPCODES 0x20-2f
|
// OPCODES 0x20-2f
|
||||||
case 0x20 => noDecoder(UnknownMessage32)
|
case 0x20 => noDecoder(UnknownMessage32)
|
||||||
case 0x21 => game.ActionProgressMessage.decode
|
case 0x21 => game.ActionProgressMessage.decode
|
||||||
case 0x22 => noDecoder(ActionCancelMessage)
|
case 0x22 => game.ActionCancelMessage.decode
|
||||||
case 0x23 => noDecoder(ActionCancelAcknowledgeMessage)
|
case 0x23 => noDecoder(ActionCancelAcknowledgeMessage)
|
||||||
case 0x24 => game.SetEmpireMessage.decode
|
case 0x24 => game.SetEmpireMessage.decode
|
||||||
case 0x25 => game.EmoteMsg.decode
|
case 0x25 => game.EmoteMsg.decode
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright (c) 2017 PSForever
|
||||||
|
package net.psforever.packet.game
|
||||||
|
|
||||||
|
import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket}
|
||||||
|
import scodec.Codec
|
||||||
|
import scodec.codecs._
|
||||||
|
|
||||||
|
/**
|
||||||
|
* na
|
||||||
|
* @param player_guid na
|
||||||
|
* @param object_guid na
|
||||||
|
* @param unk na
|
||||||
|
*/
|
||||||
|
final case class ActionCancelMessage(player_guid : PlanetSideGUID,
|
||||||
|
object_guid : PlanetSideGUID,
|
||||||
|
unk : Int)
|
||||||
|
extends PlanetSideGamePacket {
|
||||||
|
type Packet = ActionCancelMessage
|
||||||
|
def opcode = GamePacketOpcode.ActionCancelMessage
|
||||||
|
def encode = ActionCancelMessage.encode(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
object ActionCancelMessage extends Marshallable[ActionCancelMessage] {
|
||||||
|
implicit val codec : Codec[ActionCancelMessage] = (
|
||||||
|
("player_guid" | PlanetSideGUID.codec) ::
|
||||||
|
("object_guid" | PlanetSideGUID.codec) ::
|
||||||
|
("unk" | uint4L)
|
||||||
|
).as[ActionCancelMessage]
|
||||||
|
}
|
||||||
29
common/src/test/scala/game/ActionCancelMessageTest.scala
Normal file
29
common/src/test/scala/game/ActionCancelMessageTest.scala
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright (c) 2017 PSForever
|
||||||
|
package game
|
||||||
|
|
||||||
|
import org.specs2.mutable._
|
||||||
|
import net.psforever.packet._
|
||||||
|
import net.psforever.packet.game._
|
||||||
|
import scodec.bits._
|
||||||
|
|
||||||
|
class ActionCancelMessageTest extends Specification {
|
||||||
|
val string = hex"22 201ee01a10"
|
||||||
|
|
||||||
|
"decode" in {
|
||||||
|
PacketCoding.DecodePacket(string).require match {
|
||||||
|
case ActionCancelMessage(player_guid, object_guid, unk) =>
|
||||||
|
player_guid mustEqual PlanetSideGUID(7712)
|
||||||
|
object_guid mustEqual PlanetSideGUID(6880)
|
||||||
|
unk mustEqual 1
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"encode" in {
|
||||||
|
val msg = ActionCancelMessage(PlanetSideGUID(7712), PlanetSideGUID(6880), 1)
|
||||||
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||||
|
|
||||||
|
pkt mustEqual string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -553,11 +553,19 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
progressBarUpdate.cancel
|
progressBarUpdate.cancel
|
||||||
if(progressBarValue.isDefined) {
|
if(progressBarValue.isDefined) {
|
||||||
val progressBarVal : Float = progressBarValue.get + delta
|
val progressBarVal : Float = progressBarValue.get + delta
|
||||||
sendResponse(PacketCoding.CreateGamePacket(0, RepairMessage(target.GUID, progressBarVal.toInt)))
|
val vis = if(progressBarVal == 0L) {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
else if(progressBarVal >= 100L) {
|
||||||
|
4
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
3
|
||||||
|
}
|
||||||
|
sendResponse(PacketCoding.CreateGamePacket(0, HackMessage(1, target.GUID.guid, player.GUID.guid, progressBarVal.toInt, 0L, vis, 8L)))
|
||||||
if(progressBarVal > 100) {
|
if(progressBarVal > 100) {
|
||||||
progressBarValue = None
|
progressBarValue = None
|
||||||
log.info(s"We've hacked the item $target! Now what?")
|
log.info(s"We've hacked the item $target! Now what?")
|
||||||
sendResponse(PacketCoding.CreateGamePacket(0, ChangeFireStateMessage_Stop(tool_guid)))
|
|
||||||
//TODO now what?
|
//TODO now what?
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -1132,6 +1140,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
case msg @ TargetingImplantRequest(list) =>
|
case msg @ TargetingImplantRequest(list) =>
|
||||||
log.info("TargetingImplantRequest: "+msg)
|
log.info("TargetingImplantRequest: "+msg)
|
||||||
|
|
||||||
|
case msg @ ActionCancelMessage(u1, u2, u3) =>
|
||||||
|
log.info("Cancelled: "+msg)
|
||||||
|
|
||||||
case default => log.error(s"Unhandled GamePacket $pkt")
|
case default => log.error(s"Unhandled GamePacket $pkt")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue