mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-16 17:05:03 +01:00
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
type Goocoo struct {
|
type Goocoo struct {
|
||||||
Index uint32
|
Index uint32
|
||||||
Data1 []uint16
|
Data1 []int16
|
||||||
Data2 []uint32
|
Data2 []uint32
|
||||||
Name []byte
|
Name []byte
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ func (m *MsgMhfUpdateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clien
|
|||||||
for i := 0; i < int(m.EntryCount); i++ {
|
for i := 0; i < int(m.EntryCount); i++ {
|
||||||
temp.Index = bf.ReadUint32()
|
temp.Index = bf.ReadUint32()
|
||||||
for j := 0; j < 22; j++ {
|
for j := 0; j < 22; j++ {
|
||||||
temp.Data1 = append(temp.Data1, bf.ReadUint16())
|
temp.Data1 = append(temp.Data1, bf.ReadInt16())
|
||||||
}
|
}
|
||||||
for j := 0; j < 2; j++ {
|
for j := 0; j < 2; j++ {
|
||||||
temp.Data2 = append(temp.Data2, bf.ReadUint32())
|
temp.Data2 = append(temp.Data2, bf.ReadUint32())
|
||||||
|
|||||||
5
patch-schema/15-reset-goocoos.sql
Normal file
5
patch-schema/15-reset-goocoos.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
UPDATE goocoo SET goocoo0=NULL, goocoo1=NULL, goocoo2=NULL, goocoo3=NULL, goocoo4=NULL;
|
||||||
|
|
||||||
|
END;
|
||||||
@@ -959,39 +959,31 @@ func handleMsgMhfExchangeWeeklyStamp(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||||
}
|
}
|
||||||
|
|
||||||
func getGookData(s *Session, cid uint32) (uint16, []byte) {
|
func getGoocooData(s *Session, cid uint32) [][]byte {
|
||||||
var data []byte
|
var goocoo []byte
|
||||||
var count uint16
|
var goocoos [][]byte
|
||||||
bf := byteframe.NewByteFrame()
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
err := s.server.db.QueryRow(fmt.Sprintf("SELECT goocoo%d FROM goocoo WHERE id=$1", i), cid).Scan(&data)
|
err := s.server.db.QueryRow(fmt.Sprintf("SELECT goocoo%d FROM goocoo WHERE id=$1", i), cid).Scan(&goocoo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.server.db.Exec("INSERT INTO goocoo (id) VALUES ($1)", s.charID)
|
s.server.db.Exec("INSERT INTO goocoo (id) VALUES ($1)", s.charID)
|
||||||
return 0, bf.Data()
|
return goocoos
|
||||||
}
|
}
|
||||||
if err == nil && data != nil {
|
if err == nil && goocoo != nil {
|
||||||
count++
|
goocoos = append(goocoos, goocoo)
|
||||||
if s.charID == cid && count == 1 {
|
|
||||||
goocoo := byteframe.NewByteFrameFromBytes(data)
|
|
||||||
bf.WriteBytes(goocoo.ReadBytes(4))
|
|
||||||
d := goocoo.ReadBytes(2)
|
|
||||||
bf.WriteBytes(d)
|
|
||||||
bf.WriteBytes(d)
|
|
||||||
bf.WriteBytes(goocoo.DataFromCurrent())
|
|
||||||
} else {
|
|
||||||
bf.WriteBytes(data)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count, bf.Data()
|
return goocoos
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMsgMhfEnumerateGuacot(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgMhfEnumerateGuacot(s *Session, p mhfpacket.MHFPacket) {
|
||||||
pkt := p.(*mhfpacket.MsgMhfEnumerateGuacot)
|
pkt := p.(*mhfpacket.MsgMhfEnumerateGuacot)
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
count, data := getGookData(s, s.charID)
|
goocoos := getGoocooData(s, s.charID)
|
||||||
bf.WriteUint16(count)
|
bf.WriteUint16(uint16(len(goocoos)))
|
||||||
bf.WriteBytes(data)
|
bf.WriteUint16(0)
|
||||||
|
for _, goocoo := range goocoos {
|
||||||
|
bf.WriteBytes(goocoo)
|
||||||
|
}
|
||||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1004,7 +996,7 @@ func handleMsgMhfUpdateGuacot(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
bf.WriteUint32(goocoo.Index)
|
bf.WriteUint32(goocoo.Index)
|
||||||
for i := range goocoo.Data1 {
|
for i := range goocoo.Data1 {
|
||||||
bf.WriteUint16(goocoo.Data1[i])
|
bf.WriteInt16(goocoo.Data1[i])
|
||||||
}
|
}
|
||||||
for i := range goocoo.Data2 {
|
for i := range goocoo.Data2 {
|
||||||
bf.WriteUint32(goocoo.Data2[i])
|
bf.WriteUint32(goocoo.Data2[i])
|
||||||
|
|||||||
@@ -215,10 +215,12 @@ func handleMsgMhfLoadHouse(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
bf.WriteBytes(houseFurniture)
|
bf.WriteBytes(houseFurniture)
|
||||||
case 10: // Garden
|
case 10: // Garden
|
||||||
bf.WriteBytes(garden)
|
bf.WriteBytes(garden)
|
||||||
c, d := getGookData(s, pkt.CharID)
|
goocoos := getGoocooData(s, pkt.CharID)
|
||||||
bf.WriteUint16(c)
|
bf.WriteUint16(uint16(len(goocoos)))
|
||||||
bf.WriteUint16(0)
|
bf.WriteUint16(0)
|
||||||
bf.WriteBytes(d)
|
for _, goocoo := range goocoos {
|
||||||
|
bf.WriteBytes(goocoo)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if len(bf.Data()) == 0 {
|
if len(bf.Data()) == 0 {
|
||||||
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||||
|
|||||||
Reference in New Issue
Block a user