convert EnumeratePrice to use structs

This commit is contained in:
wish
2023-12-03 19:05:30 +11:00
parent 5662564842
commit ddcef6570f

View File

@@ -2,7 +2,6 @@ package channelserver
import (
"encoding/binary"
"encoding/hex"
"erupe-ce/common/mhfcourse"
"erupe-ce/common/mhfmon"
ps "erupe-ce/common/pascalstring"
@@ -648,12 +647,167 @@ func handleMsgMhfTransferItem(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfEnumeratePrice(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfEnumeratePrice)
//resp := byteframe.NewByteFrame()
//resp.WriteUint16(0) // Entry type 1 count
//resp.WriteUint16(0) // Entry type 2 count
// directly lifted for now because lacking it crashes the counter on having actual events present
data, _ := hex.DecodeString("0000000066000003E800000000007300640100000320000000000006006401000003200000000000300064010000044C00000000007200640100000384000000000034006401000003840000000000140064010000051400000000006E006401000003E8000000000016006401000003E8000000000001006401000003200000000000430064010000057800000000006F006401000003840000000000330064010000044C00000000000B006401000003E800000000000F006401000006400000000000700064010000044C0000000000110064010000057800000000004C006401000003E8000000000059006401000006A400000000006D006401000005DC00000000004B006401000005DC000000000050006401000006400000000000350064010000070800000000006C0064010000044C000000000028006401000005DC00000000005300640100000640000000000060006401000005DC00000000005E0064010000051400000000007B006401000003E80000000000740064010000070800000000006B0064010000025800000000001B0064010000025800000000001C006401000002BC00000000001F006401000006A400000000007900640100000320000000000008006401000003E80000000000150064010000070800000000007A0064010000044C00000000000E00640100000640000000000055006401000007D0000000000002006401000005DC00000000002F0064010000064000000000002A0064010000076C00000000007E006401000002BC0000000000440064010000038400000000005C0064010000064000000000005B006401000006A400000000007D0064010000076C00000000007F006401000005DC0000000000540064010000064000000000002900640100000960000000000024006401000007D0000000000081006401000008340000000000800064010000038400000000001A006401000003E800000000002D0064010000038400000000004A006401000006A400000000005A00640100000384000000000027006401000007080000000000830064010000076C000000000040006401000006400000000000690064010000044C000000000025006401000004B000000000003100640100000708000000000082006401000003E800000000006500640100000640000000000051006401000007D000000000008C0064010000070800000000004D0064010000038400000000004E0064010000089800000000008B006401000004B000000000002E006401000009600000000000920064010000076C00000000008E00640100000514000000000068006401000004B000000000002B006401000003E800000000002C00640100000BB8000000000093006401000008FC00000000009000640100000AF0000000000094006401000006A400000000008D0064010000044C000000000052006401000005DC00000000004F006401000008980000000000970064010000070800000000006A0064010000064000000000005F00640100000384000000000026006401000008FC000000000096006401000007D00000000000980064010000076C000000000041006401000006A400000000003B006401000007080000000000360064010000083400000000009F00640100000A2800000000009A0064010000076C000000000021006401000007D000000000006300640100000A8C0000000000990064010000089800000000009E006401000007080000000000A100640100000C1C0000000000A200640100000C800000000000A400640100000DAC0000000000A600640100000C800000000000A50064010010")
doAckBufSucceed(s, pkt.AckHandle, data)
bf := byteframe.NewByteFrame()
var lbPrices []struct {
Unk0 uint16
Unk1 uint16
Unk2 uint32
}
var wantedList []struct {
Unk0 uint32
Unk1 uint32
Unk2 uint32
Unk3 uint16
Unk4 uint16
Unk5 uint16
Unk6 uint16
Unk7 uint16
Unk8 uint16
Unk9 uint16
}
gzPrices := []struct {
Unk0 uint16
Gz uint16
Unk1 uint16
Unk2 uint16
MonID uint16
Unk3 uint16
Unk4 uint8
}{
{0, 1000, 0, 0, 115, 100, 1},
{0, 800, 0, 0, 6, 100, 1},
{0, 800, 0, 0, 48, 100, 1},
{0, 1100, 0, 0, 114, 100, 1},
{0, 900, 0, 0, 52, 100, 1},
{0, 900, 0, 0, 20, 100, 1},
{0, 1300, 0, 0, 110, 100, 1},
{0, 1000, 0, 0, 22, 100, 1},
{0, 1000, 0, 0, 1, 100, 1},
{0, 800, 0, 0, 67, 100, 1},
{0, 1400, 0, 0, 111, 100, 1},
{0, 900, 0, 0, 51, 100, 1},
{0, 1100, 0, 0, 11, 100, 1},
{0, 1000, 0, 0, 15, 100, 1},
{0, 1600, 0, 0, 112, 100, 1},
{0, 1100, 0, 0, 17, 100, 1},
{0, 1400, 0, 0, 76, 100, 1},
{0, 1000, 0, 0, 89, 100, 1},
{0, 1700, 0, 0, 109, 100, 1},
{0, 1500, 0, 0, 75, 100, 1},
{0, 1500, 0, 0, 80, 100, 1},
{0, 1600, 0, 0, 53, 100, 1},
{0, 1800, 0, 0, 108, 100, 1},
{0, 1100, 0, 0, 40, 100, 1},
{0, 1500, 0, 0, 83, 100, 1},
{0, 1600, 0, 0, 96, 100, 1},
{0, 1500, 0, 0, 94, 100, 1},
{0, 1300, 0, 0, 123, 100, 1},
{0, 1000, 0, 0, 116, 100, 1},
{0, 1800, 0, 0, 107, 100, 1},
{0, 600, 0, 0, 27, 100, 1},
{0, 600, 0, 0, 28, 100, 1},
{0, 700, 0, 0, 31, 100, 1},
{0, 1700, 0, 0, 121, 100, 1},
{0, 800, 0, 0, 8, 100, 1},
{0, 1000, 0, 0, 21, 100, 1},
{0, 1800, 0, 0, 122, 100, 1},
{0, 1100, 0, 0, 14, 100, 1},
{0, 1600, 0, 0, 85, 100, 1},
{0, 2000, 0, 0, 2, 100, 1},
{0, 1500, 0, 0, 47, 100, 1},
{0, 1600, 0, 0, 42, 100, 1},
{0, 1900, 0, 0, 126, 100, 1},
{0, 700, 0, 0, 68, 100, 1},
{0, 900, 0, 0, 92, 100, 1},
{0, 1600, 0, 0, 91, 100, 1},
{0, 1700, 0, 0, 125, 100, 1},
{0, 1900, 0, 0, 127, 100, 1},
{0, 1500, 0, 0, 84, 100, 1},
{0, 1600, 0, 0, 41, 100, 1},
{0, 2400, 0, 0, 36, 100, 1},
{0, 2000, 0, 0, 129, 100, 1},
{0, 2100, 0, 0, 128, 100, 1},
{0, 900, 0, 0, 26, 100, 1},
{0, 1000, 0, 0, 45, 100, 1},
{0, 900, 0, 0, 74, 100, 1},
{0, 1700, 0, 0, 90, 100, 1},
{0, 900, 0, 0, 39, 100, 1},
{0, 1800, 0, 0, 131, 100, 1},
{0, 1900, 0, 0, 64, 100, 1},
{0, 1600, 0, 0, 105, 100, 1},
{0, 1100, 0, 0, 37, 100, 1},
{0, 1200, 0, 0, 49, 100, 1},
{0, 1800, 0, 0, 130, 100, 1},
{0, 1000, 0, 0, 101, 100, 1},
{0, 1600, 0, 0, 81, 100, 1},
{0, 2000, 0, 0, 140, 100, 1},
{0, 1800, 0, 0, 77, 100, 1},
{0, 900, 0, 0, 78, 100, 1},
{0, 2200, 0, 0, 139, 100, 1},
{0, 1200, 0, 0, 46, 100, 1},
{0, 2400, 0, 0, 146, 100, 1},
{0, 1900, 0, 0, 142, 100, 1},
{0, 1300, 0, 0, 104, 100, 1},
{0, 1200, 0, 0, 43, 100, 1},
{0, 1000, 0, 0, 44, 100, 1},
{0, 3000, 0, 0, 147, 100, 1},
{0, 2300, 0, 0, 144, 100, 1},
{0, 2800, 0, 0, 148, 100, 1},
{0, 1700, 0, 0, 141, 100, 1},
{0, 1100, 0, 0, 82, 100, 1},
{0, 1500, 0, 0, 79, 100, 1},
{0, 2200, 0, 0, 151, 100, 1},
{0, 1800, 0, 0, 106, 100, 1},
{0, 1600, 0, 0, 95, 100, 1},
{0, 900, 0, 0, 38, 100, 1},
{0, 2300, 0, 0, 150, 100, 1},
{0, 2000, 0, 0, 152, 100, 1},
{0, 1900, 0, 0, 65, 100, 1},
{0, 1700, 0, 0, 59, 100, 1},
{0, 1800, 0, 0, 54, 100, 1},
{0, 2100, 0, 0, 159, 100, 1},
{0, 2600, 0, 0, 154, 100, 1},
{0, 1900, 0, 0, 33, 100, 1},
{0, 2000, 0, 0, 99, 100, 1},
{0, 2700, 0, 0, 153, 100, 1},
{0, 2200, 0, 0, 158, 100, 1},
{0, 1800, 0, 0, 161, 100, 1},
{0, 3100, 0, 0, 162, 100, 1},
{0, 3200, 0, 0, 164, 100, 1},
{0, 3500, 0, 0, 166, 100, 1},
{0, 3200, 0, 0, 165, 100, 1},
}
bf.WriteUint16(uint16(len(lbPrices)))
for _, lb := range lbPrices {
bf.WriteUint16(lb.Unk0)
bf.WriteUint16(lb.Unk1)
bf.WriteUint32(lb.Unk2)
}
bf.WriteUint16(uint16(len(wantedList)))
for _, wanted := range wantedList {
bf.WriteUint32(wanted.Unk0)
bf.WriteUint32(wanted.Unk1)
bf.WriteUint32(wanted.Unk2)
bf.WriteUint16(wanted.Unk3)
bf.WriteUint16(wanted.Unk4)
bf.WriteUint16(wanted.Unk5)
bf.WriteUint16(wanted.Unk6)
bf.WriteUint16(wanted.Unk7)
bf.WriteUint16(wanted.Unk8)
bf.WriteUint16(wanted.Unk9)
}
bf.WriteUint8(uint8(len(gzPrices)))
for _, gz := range gzPrices {
bf.WriteUint16(gz.Unk0)
bf.WriteUint16(gz.Gz)
bf.WriteUint16(gz.Unk1)
bf.WriteUint16(gz.Unk2)
bf.WriteUint16(gz.MonID)
bf.WriteUint16(gz.Unk3)
bf.WriteUint8(gz.Unk4)
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
func handleMsgMhfEnumerateOrder(s *Session, p mhfpacket.MHFPacket) {