variable changes

This commit is contained in:
wish
2023-01-15 21:36:50 +11:00
parent e1df9fca04
commit 7d4559b589
5 changed files with 47 additions and 50 deletions

View File

@@ -1,19 +1,19 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfPlayBoxGacha represents the MSG_MHF_PLAY_BOX_GACHA // MsgMhfPlayBoxGacha represents the MSG_MHF_PLAY_BOX_GACHA
type MsgMhfPlayBoxGacha struct{ type MsgMhfPlayBoxGacha struct {
AckHandle uint32 AckHandle uint32
GachaHash uint32 GachaID uint32
RollType uint8 RollType uint8
CurrencyMode uint8 GachaType uint8
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,9 +24,9 @@ func (m *MsgMhfPlayBoxGacha) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfPlayBoxGacha) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfPlayBoxGacha) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.GachaHash = bf.ReadUint32() m.GachaID = bf.ReadUint32()
m.RollType = bf.ReadUint8() m.RollType = bf.ReadUint8()
m.CurrencyMode = bf.ReadUint8() m.GachaType = bf.ReadUint8()
return nil return nil
} }

View File

@@ -10,10 +10,10 @@ import (
// MsgMhfPlayNormalGacha represents the MSG_MHF_PLAY_NORMAL_GACHA // MsgMhfPlayNormalGacha represents the MSG_MHF_PLAY_NORMAL_GACHA
type MsgMhfPlayNormalGacha struct { type MsgMhfPlayNormalGacha struct {
AckHandle uint32 AckHandle uint32
GachaID uint32 GachaID uint32
RollType uint8 RollType uint8
CurrencyMode uint8 GachaType uint8
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -26,7 +26,7 @@ func (m *MsgMhfPlayNormalGacha) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.GachaID = bf.ReadUint32() m.GachaID = bf.ReadUint32()
m.RollType = bf.ReadUint8() m.RollType = bf.ReadUint8()
m.CurrencyMode = bf.ReadUint8() m.GachaType = bf.ReadUint8()
return nil return nil
} }

View File

@@ -1,19 +1,19 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfPlayStepupGacha represents the MSG_MHF_PLAY_STEPUP_GACHA // MsgMhfPlayStepupGacha represents the MSG_MHF_PLAY_STEPUP_GACHA
type MsgMhfPlayStepupGacha struct{ type MsgMhfPlayStepupGacha struct {
AckHandle uint32 AckHandle uint32
GachaHash uint32 GachaID uint32
RollType uint8 RollType uint8
CurrencyMode uint8 GachaType uint8
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,9 +24,9 @@ func (m *MsgMhfPlayStepupGacha) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfPlayStepupGacha) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfPlayStepupGacha) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.GachaHash = bf.ReadUint32() m.GachaID = bf.ReadUint32()
m.RollType = bf.ReadUint8() m.RollType = bf.ReadUint8()
m.CurrencyMode = bf.ReadUint8() m.GachaType = bf.ReadUint8()
return nil return nil
} }

View File

@@ -25,14 +25,13 @@ CREATE TABLE IF NOT EXISTS public.gacha_shop (
min_gr INTEGER, min_gr INTEGER,
min_hr INTEGER, min_hr INTEGER,
name TEXT, name TEXT,
link1 TEXT, url_banner TEXT,
link2 TEXT, url_feature TEXT,
link3 TEXT, url_thumbnail TEXT,
is_wide_banner BOOLEAN, wide BOOLEAN,
flag1 INTEGER, recommended BOOLEAN,
flag2 INTEGER, gacha_type INTEGER,
flag3 INTEGER, hidden BOOLEAN
flag4 INTEGER
); );
DROP TABLE IF EXISTS public.gacha_shop_items; DROP TABLE IF EXISTS public.gacha_shop_items;

View File

@@ -29,14 +29,13 @@ type Gacha struct {
MinGR uint32 `db:"min_gr"` MinGR uint32 `db:"min_gr"`
MinHR uint32 `db:"min_hr"` MinHR uint32 `db:"min_hr"`
Name string `db:"name"` Name string `db:"name"`
Link1 string `db:"link1"` URLBanner string `db:"url_banner"`
Link2 string `db:"link2"` URLFeature string `db:"url_feature"`
Link3 string `db:"link3"` URLThumbnail string `db:"url_thumbnail"`
IsWideBanner bool `db:"is_wide_banner"` Wide bool `db:"wide"`
Flag1 uint8 `db:"flag1"` Recommended bool `db:"recommended"`
Flag2 uint8 `db:"flag2"` GachaType uint8 `db:"gacha_type"`
Flag3 uint8 `db:"flag3"` Hidden bool `db:"hidden"`
Flag4 uint8 `db:"flag4"`
} }
type GachaEntry struct { type GachaEntry struct {
@@ -72,7 +71,7 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
switch pkt.ShopType { switch pkt.ShopType {
case 1: // Running gachas case 1: // Running gachas
var count uint16 var count uint16
shopEntries, err := s.server.db.Queryx("SELECT id, min_gr, min_hr, name, link1, link2, link3, is_wide_banner, flag1, flag2, flag3, flag4 FROM gacha_shop") shopEntries, err := s.server.db.Queryx("SELECT id, min_gr, min_hr, name, url_banner, url_feature, url_thumbnail, wide, recommended, gacha_type, hidden FROM gacha_shop")
if err != nil { if err != nil {
doAckBufSucceed(s, pkt.AckHandle, make([]byte, 4)) doAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
return return
@@ -91,14 +90,13 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
resp.WriteUint32(gacha.MinHR) resp.WriteUint32(gacha.MinHR)
resp.WriteUint32(0) // only 0 in known packet resp.WriteUint32(0) // only 0 in known packet
ps.Uint8(resp, gacha.Name, true) ps.Uint8(resp, gacha.Name, true)
ps.Uint8(resp, gacha.Link1, false) ps.Uint8(resp, gacha.URLBanner, false)
ps.Uint8(resp, gacha.Link2, false) ps.Uint8(resp, gacha.URLFeature, false)
resp.WriteBool(gacha.IsWideBanner) resp.WriteBool(gacha.Wide)
ps.Uint8(resp, gacha.Link3, false) ps.Uint8(resp, gacha.URLThumbnail, false)
resp.WriteUint8(gacha.Flag1) resp.WriteBool(gacha.Recommended)
resp.WriteUint8(gacha.Flag2) resp.WriteUint8(gacha.GachaType)
resp.WriteUint8(gacha.Flag3) resp.WriteBool(gacha.Hidden)
resp.WriteUint8(gacha.Flag4)
count++ count++
} }
resp.Seek(0, 0) resp.Seek(0, 0)