diff --git a/Erupe/network/mhfpacket/msg_mhf_load_house.go b/Erupe/network/mhfpacket/msg_mhf_load_house.go index c8d6116f8..7e4c0cb85 100644 --- a/Erupe/network/mhfpacket/msg_mhf_load_house.go +++ b/Erupe/network/mhfpacket/msg_mhf_load_house.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -10,12 +10,12 @@ import ( // MsgMhfLoadHouse represents the MSG_MHF_LOAD_HOUSE type MsgMhfLoadHouse struct { - AckHandle uint32 - Unk0 uint32 - Unk1 uint8 - Unk2 uint8 - Unk3 uint16 // Hardcoded 0 in binary - DataSize uint8 + AckHandle uint32 + CharID uint32 + Unk1 uint8 + Unk2 uint8 + Unk3 uint16 // Hardcoded 0 in binary + DataSize uint8 RawDataPayload []byte } @@ -27,7 +27,7 @@ func (m *MsgMhfLoadHouse) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfLoadHouse) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { m.AckHandle = bf.ReadUint32() - m.Unk0 = bf.ReadUint32() + m.CharID = bf.ReadUint32() m.Unk1 = bf.ReadUint8() m.Unk2 = bf.ReadUint8() m.Unk3 = bf.ReadUint16() diff --git a/Erupe/network/mhfpacket/msg_mhf_update_interior.go b/Erupe/network/mhfpacket/msg_mhf_update_interior.go index e91ec976d..590d413e5 100644 --- a/Erupe/network/mhfpacket/msg_mhf_update_interior.go +++ b/Erupe/network/mhfpacket/msg_mhf_update_interior.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -9,7 +9,10 @@ import ( ) // MsgMhfUpdateInterior represents the MSG_MHF_UPDATE_INTERIOR -type MsgMhfUpdateInterior struct{} +type MsgMhfUpdateInterior struct { + AckHandle uint32 + InteriorData []byte +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfUpdateInterior) Opcode() network.PacketID { @@ -18,7 +21,9 @@ func (m *MsgMhfUpdateInterior) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfUpdateInterior) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.InteriorData = bf.ReadBytes(20) + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/server/channelserver/handlers_house.go b/Erupe/server/channelserver/handlers_house.go index e0a116bfd..e5b449958 100644 --- a/Erupe/server/channelserver/handlers_house.go +++ b/Erupe/server/channelserver/handlers_house.go @@ -8,7 +8,14 @@ import ( "go.uber.org/zap" ) -func handleMsgMhfUpdateInterior(s *Session, p mhfpacket.MHFPacket) {} +func handleMsgMhfUpdateInterior(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfUpdateInterior) + _, err := s.server.db.Exec("UPDATE characters SET house=$1 WHERE id=$2", pkt.InteriorData, s.charID) + if err != nil { + panic(err) + } + doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) +} func handleMsgMhfEnumerateHouse(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfEnumerateHouse) @@ -19,8 +26,14 @@ func handleMsgMhfUpdateHouse(s *Session, p mhfpacket.MHFPacket) {} func handleMsgMhfLoadHouse(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfLoadHouse) - // Seems to generate same response regardless of upgrade tier - data, _ := hex.DecodeString("0000000000000000000000000000000000000000") + var data []byte + err := s.server.db.QueryRow("SELECT house FROM characters WHERE id=$1", s.charID).Scan(&data) + if err != nil { + panic(err) + } + if data == nil { + data, _ = hex.DecodeString("0000000000000000000000000000000000000000") + } doAckBufSucceed(s, pkt.AckHandle, data) }