diff --git a/network/mhfpacket/msg_mhf_play_box_gacha.go b/network/mhfpacket/msg_mhf_play_box_gacha.go index c47100e6f..f09c018f8 100644 --- a/network/mhfpacket/msg_mhf_play_box_gacha.go +++ b/network/mhfpacket/msg_mhf_play_box_gacha.go @@ -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 } diff --git a/network/mhfpacket/msg_mhf_play_normal_gacha.go b/network/mhfpacket/msg_mhf_play_normal_gacha.go index 8d1844c4d..46f2706a6 100644 --- a/network/mhfpacket/msg_mhf_play_normal_gacha.go +++ b/network/mhfpacket/msg_mhf_play_normal_gacha.go @@ -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 } diff --git a/network/mhfpacket/msg_mhf_play_stepup_gacha.go b/network/mhfpacket/msg_mhf_play_stepup_gacha.go index 653fc799f..83808ae1a 100644 --- a/network/mhfpacket/msg_mhf_play_stepup_gacha.go +++ b/network/mhfpacket/msg_mhf_play_stepup_gacha.go @@ -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 } diff --git a/patch-schema/gacha-db-2.sql b/patch-schema/gacha-db-2.sql index 857ce8a47..1ed90d7a4 100644 --- a/patch-schema/gacha-db-2.sql +++ b/patch-schema/gacha-db-2.sql @@ -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; diff --git a/server/channelserver/handlers_shop_gacha.go b/server/channelserver/handlers_shop_gacha.go index 589dd2a6d..b50809967 100644 --- a/server/channelserver/handlers_shop_gacha.go +++ b/server/channelserver/handlers_shop_gacha.go @@ -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)