This commit is contained in:
Andrew Gutekanst
2020-03-02 23:36:27 -05:00
parent 82f92e2f24
commit af22707b48
302 changed files with 487 additions and 486 deletions

View File

@@ -20,7 +20,7 @@ func (m *MsgMhfAddKouryouPoint) Opcode() network.PacketID {
func (m *MsgMhfAddKouryouPoint) Parse(bf *byteframe.ByteFrame) error { func (m *MsgMhfAddKouryouPoint) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.KouryouPoints = bf.ReadUint32() m.KouryouPoints = bf.ReadUint32()
return nil; return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.

View File

@@ -18,7 +18,7 @@ func (m *MsgMhfEnumerateRengokuRanking) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateRengokuRanking) Parse(bf *byteframe.ByteFrame) error { func (m *MsgMhfEnumerateRengokuRanking) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
return nil; return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.

View File

@@ -11,7 +11,6 @@ type MsgMhfGetTenrouirai struct{
Unk0 uint16 Unk0 uint16
Unk1 uint32 Unk1 uint32
Unk2 uint16 Unk2 uint16
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.

View File

@@ -6,9 +6,9 @@ import (
"encoding/base64" "encoding/base64"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"io"
"io/ioutil" "io/ioutil"
"os" "os"
"io"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
@@ -60,7 +60,7 @@ func saveDataDiff(b []byte, save []byte) []byte {
var seekBytes []byte var seekBytes []byte
seekOperation := 0 seekOperation := 0
write := byte(0) write := byte(0)
for(len(b) > 2){ for len(b) > 2 {
if bytes.IndexRune(b, 2) != 0 { if bytes.IndexRune(b, 2) != 0 {
seekBytes = b[:bytes.IndexRune(b, 2)+1] seekBytes = b[:bytes.IndexRune(b, 2)+1]
} else { } else {
@@ -161,7 +161,7 @@ func saveCompress(rawData []byte) ([]byte, error) {
} }
nullCount++ nullCount++
if(nullCount == 255){ if nullCount == 255 {
output = append(output, []byte{0xFF, 0x00}...) output = append(output, []byte{0xFF, 0x00}...)
nullCount = 0 nullCount = 0
} }
@@ -174,7 +174,6 @@ func saveCompress(rawData []byte) ([]byte, error) {
return output, nil return output, nil
} }
func updateRights(s *Session) { func updateRights(s *Session) {
update := &mhfpacket.MsgSysUpdateRight{ update := &mhfpacket.MsgSysUpdateRight{
Unk0: 0, Unk0: 0,
@@ -1891,7 +1890,7 @@ func handleMsgMhfLoadDecoMyset(s *Session, p mhfpacket.MHFPacket) {
} else { } else {
// set first byte to 1 to avoid pop up every time without save // set first byte to 1 to avoid pop up every time without save
body := make([]byte, 0x226) body := make([]byte, 0x226)
body[0] = 1; body[0] = 1
doSizedAckResp(s, pkt.AckHandle, body) doSizedAckResp(s, pkt.AckHandle, body)
} }
} }
@@ -1907,11 +1906,15 @@ func handleMsgMhfSaveDecoMyset(s *Session, p mhfpacket.MHFPacket) {
} else { } else {
numSets := bf.ReadUint8() // sets being written numSets := bf.ReadUint8() // sets being written
// empty save // empty save
if len(loadData) == 0{ loadData = []byte{0x01, 0x00} } if len(loadData) == 0 {
loadData = []byte{0x01, 0x00}
}
savedSets := loadData[1] // existing saved sets savedSets := loadData[1] // existing saved sets
// no sets, new slice with just first 2 bytes for appends later // no sets, new slice with just first 2 bytes for appends later
if savedSets == 0{ loadData = []byte{0x01, 0x00} } if savedSets == 0 {
loadData = []byte{0x01, 0x00}
}
for i := 0; i < int(numSets); i++ { for i := 0; i < int(numSets); i++ {
writeSet := bf.ReadUint16() writeSet := bf.ReadUint16()
dataChunk := bf.ReadBytes(76) dataChunk := bf.ReadBytes(76)
@@ -1981,7 +1984,7 @@ func handleMsgMhfLoadHunterNavi(s *Session, p mhfpacket.MHFPacket) {
} else { } else {
// set first byte to 1 to avoid pop up every time without save // set first byte to 1 to avoid pop up every time without save
body := make([]byte, 0x226) body := make([]byte, 0x226)
body[0] = 1; body[0] = 1
doSizedAckResp(s, pkt.AckHandle, body) doSizedAckResp(s, pkt.AckHandle, body)
} }
} }
@@ -2143,7 +2146,6 @@ func handleMsgMhfGetPaperData(s *Session, p mhfpacket.MHFPacket) {
doSizedAckResp(s, pkt.AckHandle, data) doSizedAckResp(s, pkt.AckHandle, data)
// s.QueueAck(pkt.AckHandle, data) // s.QueueAck(pkt.AckHandle, data)
} }
func handleMsgMhfGetNotice(s *Session, p mhfpacket.MHFPacket) {} func handleMsgMhfGetNotice(s *Session, p mhfpacket.MHFPacket) {}