mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
139 lines
4.6 KiB
Go
139 lines
4.6 KiB
Go
package channelserver
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"erupe-ce/common/byteframe"
|
|
"erupe-ce/network/mhfpacket"
|
|
)
|
|
|
|
func handleMsgMhfGetTowerInfo(s *Session, p mhfpacket.MHFPacket) {
|
|
pkt := p.(*mhfpacket.MsgMhfGetTowerInfo)
|
|
var data []*byteframe.ByteFrame
|
|
type TowerInfo struct {
|
|
TRP []uint64
|
|
TowerSkill [][]byte // 132 bytes
|
|
TowerHistory [][]byte // 20 bytes
|
|
}
|
|
|
|
towerInfo := TowerInfo{
|
|
TRP: []uint64{0},
|
|
TowerSkill: [][]byte{make([]byte, 132)},
|
|
TowerHistory: [][]byte{make([]byte, 20)},
|
|
}
|
|
|
|
// Example data
|
|
// towerInfo.TowerSkill[0], _ = hex.DecodeString("0000001C0000000500050000000000020000000000000000000000000000000000030003000000000003000500050000000300030003000300030003000200030001000300020002000300010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
|
|
|
switch pkt.InfoType {
|
|
case 1:
|
|
for _, trp := range towerInfo.TRP {
|
|
bf := byteframe.NewByteFrame()
|
|
bf.WriteUint64(trp)
|
|
data = append(data, bf)
|
|
}
|
|
case 2:
|
|
for _, skills := range towerInfo.TowerSkill {
|
|
bf := byteframe.NewByteFrame()
|
|
bf.WriteBytes(skills)
|
|
data = append(data, bf)
|
|
}
|
|
case 4:
|
|
for _, history := range towerInfo.TowerHistory {
|
|
bf := byteframe.NewByteFrame()
|
|
bf.WriteBytes(history)
|
|
data = append(data, bf)
|
|
}
|
|
}
|
|
doAckEarthSucceed(s, pkt.AckHandle, data)
|
|
}
|
|
|
|
func handleMsgMhfPostTowerInfo(s *Session, p mhfpacket.MHFPacket) {
|
|
pkt := p.(*mhfpacket.MsgMhfPostTowerInfo)
|
|
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
|
}
|
|
|
|
func handleMsgMhfGetTenrouirai(s *Session, p mhfpacket.MHFPacket) {
|
|
// if the game gets bad responses for this it breaks the ability to save
|
|
pkt := p.(*mhfpacket.MsgMhfGetTenrouirai)
|
|
var data []byte
|
|
var err error
|
|
if pkt.Unk0 == 1 {
|
|
data, err = hex.DecodeString("0A218EAD000000000000000000000001010000000000060010")
|
|
} else if pkt.Unk2 == 4 {
|
|
data, err = hex.DecodeString("0A218EAD0000000000000000000000210101005000000202010102020104001000000202010102020106003200000202010002020104000C003202020101020201030032000002020101020202059C4000000202010002020105C35000320202010102020201003C00000202010102020203003200000201010001020203002800320201010101020204000C00000201010101020206002800000201010001020101003C00320201020101020105C35000000301020101020106003200000301020001020104001000320301020101020105C350000003010201010202030028000003010200010201030032003203010201010202059C4000000301020101010206002800000301020001010201003C00320301020101010206003200000301020101010204000C000003010200010101010050003203010201010101059C40000003010201010101030032000003010200010101040010003203010001010101060032000003010001010102030028000003010001010101010050003203010000010102059C4000000301000001010206002800000301000001010010")
|
|
} else {
|
|
data = []byte{0x00, 0x00, 0x00, 0x00}
|
|
s.logger.Info("GET_TENROUIRAI request for unknown type")
|
|
}
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
doAckBufSucceed(s, pkt.AckHandle, data)
|
|
}
|
|
|
|
func handleMsgMhfPostTenrouirai(s *Session, p mhfpacket.MHFPacket) {
|
|
pkt := p.(*mhfpacket.MsgMhfPostTenrouirai)
|
|
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
|
}
|
|
|
|
func handleMsgMhfGetBreakSeibatuLevelReward(s *Session, p mhfpacket.MHFPacket) {}
|
|
|
|
type WeeklySeibatuRankingReward struct {
|
|
Unk0 int32
|
|
Unk1 int32
|
|
Unk2 uint32
|
|
Unk3 int32
|
|
Unk4 int32
|
|
Unk5 int32
|
|
}
|
|
|
|
func handleMsgMhfGetWeeklySeibatuRankingReward(s *Session, p mhfpacket.MHFPacket) {
|
|
pkt := p.(*mhfpacket.MsgMhfGetWeeklySeibatuRankingReward)
|
|
var data []*byteframe.ByteFrame
|
|
weeklySeibatuRankingRewards := []WeeklySeibatuRankingReward{
|
|
{0, 0, 0, 0, 0, 0},
|
|
}
|
|
for _, reward := range weeklySeibatuRankingRewards {
|
|
bf := byteframe.NewByteFrame()
|
|
bf.WriteInt32(reward.Unk0)
|
|
bf.WriteInt32(reward.Unk1)
|
|
bf.WriteUint32(reward.Unk2)
|
|
bf.WriteInt32(reward.Unk3)
|
|
bf.WriteInt32(reward.Unk4)
|
|
bf.WriteInt32(reward.Unk5)
|
|
data = append(data, bf)
|
|
}
|
|
doAckEarthSucceed(s, pkt.AckHandle, data)
|
|
}
|
|
|
|
func handleMsgMhfPresentBox(s *Session, p mhfpacket.MHFPacket) {
|
|
pkt := p.(*mhfpacket.MsgMhfPresentBox)
|
|
var data []*byteframe.ByteFrame
|
|
/*
|
|
bf.WriteUint32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
bf.WriteInt32(0)
|
|
*/
|
|
doAckEarthSucceed(s, pkt.AckHandle, data)
|
|
}
|
|
|
|
func handleMsgMhfGetGemInfo(s *Session, p mhfpacket.MHFPacket) {
|
|
pkt := p.(*mhfpacket.MsgMhfGetGemInfo)
|
|
var data []*byteframe.ByteFrame
|
|
/*
|
|
bf.WriteUint16(0)
|
|
bf.WriteUint16(0)
|
|
*/
|
|
doAckEarthSucceed(s, pkt.AckHandle, data)
|
|
}
|
|
|
|
func handleMsgMhfPostGemInfo(s *Session, p mhfpacket.MHFPacket) {}
|