implement normal gacha functionality

This commit is contained in:
wish
2023-01-15 19:55:08 +11:00
parent 5a9d22a28a
commit 341276c0ff
4 changed files with 464 additions and 379 deletions

View File

@@ -1,18 +1,18 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfPlayNormalGacha represents the MSG_MHF_PLAY_NORMAL_GACHA
type MsgMhfPlayNormalGacha struct{
AckHandle uint32
GachaHash uint32
RollType uint8
type MsgMhfPlayNormalGacha struct {
AckHandle uint32
GachaID uint32
RollType uint8
CurrencyMode uint8
}
@@ -24,7 +24,7 @@ func (m *MsgMhfPlayNormalGacha) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfPlayNormalGacha) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.GachaHash = bf.ReadUint32()
m.GachaID = bf.ReadUint32()
m.RollType = bf.ReadUint8()
m.CurrencyMode = bf.ReadUint8()
return nil

View File

@@ -1,17 +1,18 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfReceiveGachaItem represents the MSG_MHF_RECEIVE_GACHA_ITEM
type MsgMhfReceiveGachaItem struct{
AckHandle uint32
Unk0 uint16
type MsgMhfReceiveGachaItem struct {
AckHandle uint32
Max uint8
Freeze bool
}
// Opcode returns the ID associated with this packet type.
@@ -22,7 +23,8 @@ func (m *MsgMhfReceiveGachaItem) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfReceiveGachaItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Max = bf.ReadUint8()
m.Freeze = bf.ReadBool()
return nil
}