mirror of
https://github.com/redstrate/Kawari.git
synced 2025-07-24 21:47:45 +00:00
Rename GilShopTransactionAck to ShopLogMessage and outline the ItemObtainedLogMessage opcode
-IOLM is not implemented yet, we just have the struct defined for now.
This commit is contained in:
parent
ba2632ebd3
commit
2406bc7d09
4 changed files with 36 additions and 17 deletions
|
@ -296,7 +296,7 @@
|
|||
"size": 232
|
||||
},
|
||||
{
|
||||
"name": "GilShopTransactionAck",
|
||||
"name": "ShopLogMessage",
|
||||
"opcode": 974,
|
||||
"size": 32
|
||||
},
|
||||
|
@ -309,6 +309,11 @@
|
|||
"name": "EffectResult",
|
||||
"opcode": 431,
|
||||
"size": 96
|
||||
},
|
||||
{
|
||||
"name": "ItemObtainedLogMessage",
|
||||
"opcode": 456,
|
||||
"size": 22
|
||||
}
|
||||
],
|
||||
"ClientZoneIpcType": [
|
||||
|
|
|
@ -506,22 +506,35 @@ pub enum ServerZoneIpcData {
|
|||
#[bw(pad_size_to = 6)]
|
||||
unk2: Vec<u8>,
|
||||
},
|
||||
#[brw(little)]
|
||||
#[br(pre_assert(*magic == ServerZoneIpcType::GilShopTransactionAck))]
|
||||
GilShopTransactionAck {
|
||||
/// Sent by the server when an item is obtained from shops that accept gil.
|
||||
#[br(pre_assert(*magic == ServerZoneIpcType::ShopLogMessage))]
|
||||
ShopLogMessage {
|
||||
event_id: u32,
|
||||
/// When buying: 0x697
|
||||
/// When selling: 0x698
|
||||
/// When buying back: 0x699
|
||||
message_type: u32,
|
||||
/// Always 3 at gil shops, regardless of the interactions going on
|
||||
unk1: u32,
|
||||
/// Always 3, regardless of the interactions going on
|
||||
params_count: u32,
|
||||
item_id: u32,
|
||||
item_quantity: u32,
|
||||
#[brw(pad_after = 8)]
|
||||
total_sale_cost: u32,
|
||||
},
|
||||
#[brw(little)]
|
||||
/// Sent by the server when an item is obtained in ways other than gil shops (e.g. Poetics shops).
|
||||
#[br(pre_assert(*magic == ServerZoneIpcType::ItemObtainedLogMessage))]
|
||||
ItemObtainedLogMessage {
|
||||
event_id: u32,
|
||||
/// Non-stackable item or a single item: 750 / 0x2EE ("You obtained a .")
|
||||
/// Stackable item: 751 / 0x2EF ("You obtained .")
|
||||
message_type: u32,
|
||||
/// Always 2
|
||||
params_count: u32,
|
||||
item_id: u32,
|
||||
#[brw(pad_after = 2)]
|
||||
/// Set to zero if only one item was obtained (stackable or not)
|
||||
item_quantity: u32,
|
||||
},
|
||||
#[br(pre_assert(*magic == ServerZoneIpcType::UpdateInventorySlot))]
|
||||
UpdateInventorySlot {
|
||||
/// Starts from zero and increases by one for each of these packets during this gameplay session
|
||||
|
@ -1048,11 +1061,11 @@ mod tests {
|
|||
},
|
||||
),
|
||||
(
|
||||
ServerZoneIpcType::GilShopTransactionAck,
|
||||
ServerZoneIpcData::GilShopTransactionAck {
|
||||
ServerZoneIpcType::ShopLogMessage,
|
||||
ServerZoneIpcData::ShopLogMessage {
|
||||
event_id: 0,
|
||||
message_type: 0,
|
||||
unk1: 0,
|
||||
params_count: 0,
|
||||
item_id: 0,
|
||||
item_quantity: 0,
|
||||
total_sale_cost: 0,
|
||||
|
|
|
@ -1086,6 +1086,7 @@ impl ZoneConnection {
|
|||
self.player_data.item_sequence += 1;
|
||||
}
|
||||
|
||||
// TODO: When we add support for ItemObtainedLogMessage, rename this and update this
|
||||
pub async fn send_gilshop_ack(
|
||||
&mut self,
|
||||
event_id: u32,
|
||||
|
@ -1095,12 +1096,12 @@ impl ZoneConnection {
|
|||
message_type: LogMessageType,
|
||||
) {
|
||||
let ipc = ServerZoneIpcSegment {
|
||||
op_code: ServerZoneIpcType::GilShopTransactionAck,
|
||||
op_code: ServerZoneIpcType::ShopLogMessage,
|
||||
timestamp: timestamp_secs(),
|
||||
data: ServerZoneIpcData::GilShopTransactionAck {
|
||||
data: ServerZoneIpcData::ShopLogMessage {
|
||||
event_id,
|
||||
message_type: message_type as u32,
|
||||
unk1: 3,
|
||||
params_count: 3,
|
||||
item_id,
|
||||
item_quantity,
|
||||
total_sale_cost: item_quantity * price_per_item,
|
||||
|
|
|
@ -391,7 +391,7 @@ impl LuaPlayer {
|
|||
let new_gil = self.player_data.inventory.currency.gil.quantity - cost;
|
||||
self.remove_gil(cost, false);
|
||||
|
||||
let shop_packets_to_send = vec![
|
||||
let shop_packets_to_send = [
|
||||
(
|
||||
ServerZoneIpcType::UpdateInventorySlot,
|
||||
ServerZoneIpcData::UpdateInventorySlot {
|
||||
|
@ -422,11 +422,11 @@ impl LuaPlayer {
|
|||
},
|
||||
),
|
||||
(
|
||||
ServerZoneIpcType::GilShopTransactionAck,
|
||||
ServerZoneIpcData::GilShopTransactionAck {
|
||||
ServerZoneIpcType::ShopLogMessage,
|
||||
ServerZoneIpcData::ShopLogMessage {
|
||||
event_id: shop_id,
|
||||
message_type: LogMessageType::ItemBoughtBack as u32,
|
||||
unk1: 3,
|
||||
params_count: 3,
|
||||
item_id: bb_item.id,
|
||||
item_quantity: item_dst_info.quantity,
|
||||
total_sale_cost: item_dst_info.quantity * bb_item.price_low,
|
||||
|
|
Loading…
Add table
Reference in a new issue