From 48be1e000eb55d172a52c3c2519c1a53d4defa71 Mon Sep 17 00:00:00 2001 From: Ziggy Date: Tue, 11 Apr 2023 16:19:07 +0200 Subject: [PATCH] Finished CancelLiveAuctionMessage and CancelLiveAuctionResponseMessage packets --- .../common/network/packets/PacketType.java | 4 +- ...ssage.java => CancelLiveAuctionMessage.kt} | 56 ++++++++--------- ...va => CancelLiveAuctionResponseMessage.kt} | 60 +++++++++---------- 3 files changed, 56 insertions(+), 64 deletions(-) rename src/main/java/com/projectswg/common/network/packets/swg/zone/auction/{CancelLiveAuctionMessage.java => CancelLiveAuctionMessage.kt} (73%) rename src/main/java/com/projectswg/common/network/packets/swg/zone/auction/{CancelLiveAuctionResponseMessage.java => CancelLiveAuctionResponseMessage.kt} (72%) diff --git a/src/main/java/com/projectswg/common/network/packets/PacketType.java b/src/main/java/com/projectswg/common/network/packets/PacketType.java index 336a229..13e7fa8 100644 --- a/src/main/java/com/projectswg/common/network/packets/PacketType.java +++ b/src/main/java/com/projectswg/common/network/packets/PacketType.java @@ -315,8 +315,8 @@ public enum PacketType { AUCTION_QUERY_HEADERS_MESSAGE (AuctionQueryHeadersMessage.Companion.getCrc(), AuctionQueryHeadersMessage.class), GET_AUCTION_DETAILS (GetAuctionDetails.CRC, GetAuctionDetails.class), GET_AUCTION_DETAILS_RESPONSE (GetAuctionDetailsResponse.CRC, GetAuctionDetailsResponse.class), - CANCEL_LIVE_AUCTION_MESSAGE (CancelLiveAuctionMessage.CRC, CancelLiveAuctionMessage.class), - CANCEL_LIVE_AUCTION_RESPONSE_MESSAGE (CancelLiveAuctionResponseMessage.CRC, CancelLiveAuctionResponseMessage.class), + CANCEL_LIVE_AUCTION_MESSAGE (CancelLiveAuctionMessage.Companion.getCrc(), CancelLiveAuctionMessage.class), + CANCEL_LIVE_AUCTION_RESPONSE_MESSAGE (CancelLiveAuctionResponseMessage.Companion.getCrc(), CancelLiveAuctionResponseMessage.class), AUCTION_QUERY_HEADERS_RESPONSE_MESSAGE (AuctionQueryHeadersResponseMessage.CRC, AuctionQueryHeadersResponseMessage.class), RETRIEVE_AUCTION_ITEM_MESSAGE (RetrieveAuctionItemMessage.Companion.getCrc(), RetrieveAuctionItemMessage.class), RETRIEVE_AUCTION_ITEM_RESPONSE_MESSAGE (RetrieveAuctionItemResponseMessage.Companion.getCrc(), RetrieveAuctionItemResponseMessage.class), diff --git a/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionMessage.java b/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionMessage.kt similarity index 73% rename from src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionMessage.java rename to src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionMessage.kt index bf0e5f7..a639eae 100644 --- a/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionMessage.java +++ b/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionMessage.kt @@ -1,5 +1,5 @@ /*********************************************************************************** - * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * Copyright (c) 2023 /// Project SWG /// www.projectswg.com * * * * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * @@ -24,37 +24,31 @@ * You should have received a copy of the GNU Affero General Public License * * along with PSWGCommon. If not, see . * ***********************************************************************************/ -package com.projectswg.common.network.packets.swg.zone.auction; +package com.projectswg.common.network.packets.swg.zone.auction -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.NetBuffer +import com.projectswg.common.network.packets.SWGPacket -public class CancelLiveAuctionMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("CancelLiveAuctionMessage"); - - public CancelLiveAuctionMessage() { - - } - - public CancelLiveAuctionMessage(String command) { - - } - - public CancelLiveAuctionMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; +data class CancelLiveAuctionMessage( + var objectId: Long = 0L, +) : SWGPacket() { + + companion object { + val crc = getCrc("CancelLiveAuctionMessage") } -} + override fun decode(data: NetBuffer) { + if (!super.checkDecode(data, crc)) return + objectId = data.long + } + + override fun encode(): NetBuffer { + val data = NetBuffer.allocate(14) + + data.addShort(2) + data.addInt(crc) + data.addLong(objectId) + + return data + } +} \ No newline at end of file diff --git a/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.java b/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.kt similarity index 72% rename from src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.java rename to src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.kt index 229bddf..1a1d51d 100644 --- a/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.java +++ b/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.kt @@ -1,5 +1,5 @@ /*********************************************************************************** - * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * Copyright (c) 2023 /// Project SWG /// www.projectswg.com * * * * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * @@ -24,37 +24,35 @@ * You should have received a copy of the GNU Affero General Public License * * along with PSWGCommon. If not, see . * ***********************************************************************************/ -package com.projectswg.common.network.packets.swg.zone.auction; +package com.projectswg.common.network.packets.swg.zone.auction -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.NetBuffer +import com.projectswg.common.network.packets.SWGPacket -public class CancelLiveAuctionResponseMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("CancelLiveAuctionResponseMessage"); - - public CancelLiveAuctionResponseMessage() { - - } - - public CancelLiveAuctionResponseMessage(String command) { - - } - - public CancelLiveAuctionResponseMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; +data class CancelLiveAuctionResponseMessage( + var objectId: Long = 0L, + var errorCode: Int = 0, + var vendorRefusal: Boolean = false, +) : SWGPacket() { + + companion object { + val crc = getCrc("CancelLiveAuctionResponseMessage") } -} + override fun decode(data: NetBuffer) { + if (!super.checkDecode(data, crc)) return + objectId = data.long + } + + override fun encode(): NetBuffer { + val data = NetBuffer.allocate(19) + + data.addShort(4) + data.addInt(crc) + data.addLong(objectId) + data.addInt(errorCode) + data.addBoolean(vendorRefusal) + + return data + } +} \ No newline at end of file