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
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfPlayBoxGacha represents the MSG_MHF_PLAY_BOX_GACHA
type MsgMhfPlayBoxGacha struct{
type MsgMhfPlayBoxGacha struct {
AckHandle uint32
GachaHash uint32
RollType uint8
CurrencyMode uint8
GachaID uint32
RollType uint8
GachaType uint8
}
// 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
func (m *MsgMhfPlayBoxGacha) 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()
m.GachaType = bf.ReadUint8()
return nil
}

View File

@@ -10,10 +10,10 @@ import (
// MsgMhfPlayNormalGacha represents the MSG_MHF_PLAY_NORMAL_GACHA
type MsgMhfPlayNormalGacha struct {
AckHandle uint32
GachaID uint32
RollType uint8
CurrencyMode uint8
AckHandle uint32
GachaID uint32
RollType uint8
GachaType uint8
}
// 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.GachaID = bf.ReadUint32()
m.RollType = bf.ReadUint8()
m.CurrencyMode = bf.ReadUint8()
m.GachaType = bf.ReadUint8()
return nil
}

View File

@@ -1,19 +1,19 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfPlayStepupGacha represents the MSG_MHF_PLAY_STEPUP_GACHA
type MsgMhfPlayStepupGacha struct{
type MsgMhfPlayStepupGacha struct {
AckHandle uint32
GachaHash uint32
RollType uint8
CurrencyMode uint8
GachaID uint32
RollType uint8
GachaType uint8
}
// 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
func (m *MsgMhfPlayStepupGacha) 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()
m.GachaType = bf.ReadUint8()
return nil
}

View File

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

View File

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