From 0bafb65550a7cd1dc0cfd3c8bac10ca06f7eef9a Mon Sep 17 00:00:00 2001 From: Ziggy Date: Mon, 10 Apr 2023 01:13:30 +0200 Subject: [PATCH] Added RetrieveAuctionItemMessage and RetrieveAuctionItemResponseMessage --- .../common/network/packets/PacketType.java | 4 +- ...age.java => RetrieveAuctionItemMessage.kt} | 59 +++++++++---------- ... => RetrieveAuctionItemResponseMessage.kt} | 59 +++++++++---------- 3 files changed, 58 insertions(+), 64 deletions(-) rename src/main/java/com/projectswg/common/network/packets/swg/zone/auction/{RetrieveAuctionItemMessage.java => RetrieveAuctionItemMessage.kt} (73%) rename src/main/java/com/projectswg/common/network/packets/swg/zone/auction/{RetrieveAuctionItemResponseMessage.java => RetrieveAuctionItemResponseMessage.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 7332220..336a229 100644 --- a/src/main/java/com/projectswg/common/network/packets/PacketType.java +++ b/src/main/java/com/projectswg/common/network/packets/PacketType.java @@ -318,8 +318,8 @@ public enum PacketType { CANCEL_LIVE_AUCTION_MESSAGE (CancelLiveAuctionMessage.CRC, CancelLiveAuctionMessage.class), CANCEL_LIVE_AUCTION_RESPONSE_MESSAGE (CancelLiveAuctionResponseMessage.CRC, CancelLiveAuctionResponseMessage.class), AUCTION_QUERY_HEADERS_RESPONSE_MESSAGE (AuctionQueryHeadersResponseMessage.CRC, AuctionQueryHeadersResponseMessage.class), - RETRIEVE_AUCTION_ITEM_MESSAGE (RetrieveAuctionItemMessage.CRC, RetrieveAuctionItemMessage.class), - RETRIEVE_AUCTION_ITEM_RESPONSE_MESSAGE (RetrieveAuctionItemResponseMessage.CRC, RetrieveAuctionItemResponseMessage.class), + RETRIEVE_AUCTION_ITEM_MESSAGE (RetrieveAuctionItemMessage.Companion.getCrc(), RetrieveAuctionItemMessage.class), + RETRIEVE_AUCTION_ITEM_RESPONSE_MESSAGE (RetrieveAuctionItemResponseMessage.Companion.getCrc(), RetrieveAuctionItemResponseMessage.class), IS_VENDOR_OWNER_MESSAGE (IsVendorOwnerMessage.CRC, IsVendorOwnerMessage.class), COMMODITIES_ITEM_TYPE_LIST_REPSONSE (CommoditiesItemTypeListResponse.CRC, CommoditiesItemTypeListResponse.class), COMMODITIES_ITEM_TYPE_LIST_REQUEST (CommoditiesItemTypeListRequest.CRC, CommoditiesItemTypeListRequest.class), diff --git a/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.java b/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.kt similarity index 73% rename from src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.java rename to src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.kt index e0aad02..19c7a6a 100644 --- a/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.java +++ b/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.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,34 @@ * 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 RetrieveAuctionItemMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("RetrieveAuctionItemMessage"); - - public RetrieveAuctionItemMessage() { - - } - - public RetrieveAuctionItemMessage(String command) { - - } - - public RetrieveAuctionItemMessage(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 RetrieveAuctionItemMessage( + var objectId: Long = 0L, + var vendorId: Long = 0L, +) : SWGPacket() { + + companion object { + val crc = getCrc("RetrieveAuctionItemMessage") } -} + override fun decode(data: NetBuffer) { + if (!super.checkDecode(data, crc)) return + objectId = data.long + vendorId = data.long + } + + override fun encode(): NetBuffer { + val data = NetBuffer.allocate(22) + + data.addShort(3) + data.addInt(crc) + data.addLong(objectId) + data.addLong(vendorId) + + return data + } +} \ No newline at end of file diff --git a/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.java b/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.kt similarity index 72% rename from src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.java rename to src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.kt index db187d1..229e2d5 100644 --- a/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.java +++ b/src/main/java/com/projectswg/common/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.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,34 @@ * 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 RetrieveAuctionItemResponseMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("RetrieveAuctionItemResponseMessage"); - - public RetrieveAuctionItemResponseMessage() { - - } - - public RetrieveAuctionItemResponseMessage(String command) { - - } - - public RetrieveAuctionItemResponseMessage(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 RetrieveAuctionItemResponseMessage( + var objectId: Long = 0L, + var error: Int = 0, +) : SWGPacket() { + + companion object { + val crc = getCrc("RetrieveAuctionItemResponseMessage") } -} + override fun decode(data: NetBuffer) { + if (!super.checkDecode(data, crc)) return + objectId = data.long + error = data.int + } + + override fun encode(): NetBuffer { + val data = NetBuffer.allocate(18) + + data.addShort(3) + data.addInt(crc) + data.addLong(objectId) + data.addInt(error) + + return data + } +} \ No newline at end of file