mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 16:04:38 +01:00
typing and formatting review
This commit is contained in:
@@ -776,14 +776,13 @@ func handleMsgMhfUpdateGuacot(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ScenarioCounterItem struct {
|
||||||
|
MainID uint32 `db:"scenario_id"`
|
||||||
|
CategoryID uint8 `db:"category_id"` // 0 = basic, 1 = veteran, 3 = other, 6 = pallone, 7 = diva
|
||||||
|
}
|
||||||
|
|
||||||
func handleMsgMhfInfoScenarioCounter(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgMhfInfoScenarioCounter(s *Session, p mhfpacket.MHFPacket) {
|
||||||
type ScenarioCounterItem struct {
|
|
||||||
MainID uint32 `db:"scenario_id"`
|
|
||||||
CategoryID uint8 `db:"category_id"` // 0 = basic, 1 = veteran, 3 = other, 6 = pallone, 7 = diva
|
|
||||||
}
|
|
||||||
|
|
||||||
pkt := p.(*mhfpacket.MsgMhfInfoScenarioCounter)
|
pkt := p.(*mhfpacket.MsgMhfInfoScenarioCounter)
|
||||||
|
|
||||||
scenarioData, err := s.server.db.Queryx("SELECT scenario_id, category_id FROM scenario_counter")
|
scenarioData, err := s.server.db.Queryx("SELECT scenario_id, category_id FROM scenario_counter")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Error("Failed to get scenario counter info from db", zap.Error(err))
|
s.logger.Error("Failed to get scenario counter info from db", zap.Error(err))
|
||||||
@@ -791,31 +790,28 @@ func handleMsgMhfInfoScenarioCounter(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
var scenarioCount uint32
|
var scenarioCount uint8
|
||||||
for scenarioData.Next() {
|
for scenarioData.Next() {
|
||||||
postData := &ScenarioCounterItem{}
|
scenario := &ScenarioCounterItem{}
|
||||||
err = scenarioData.StructScan(&postData)
|
err = scenarioData.StructScan(&scenario)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
scenarioCount++
|
scenarioCount++
|
||||||
bf.WriteUint32(postData.MainID)
|
bf.WriteUint32(scenario.MainID)
|
||||||
// if item exchange
|
// if item exchange
|
||||||
if postData.CategoryID == 3 || postData.CategoryID == 6 || postData.CategoryID == 7 {
|
if scenario.CategoryID == 3 || scenario.CategoryID == 6 || scenario.CategoryID == 7 {
|
||||||
bf.WriteUint8(1)
|
bf.WriteBool(true)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bf.WriteUint8(0)
|
bf.WriteBool(false)
|
||||||
|
|
||||||
}
|
}
|
||||||
bf.WriteUint8(postData.CategoryID)
|
bf.WriteUint8(scenario.CategoryID)
|
||||||
}
|
}
|
||||||
|
|
||||||
data := byteframe.NewByteFrame()
|
data := byteframe.NewByteFrame()
|
||||||
data.WriteUint8(uint8(scenarioCount)) // Entry count
|
data.WriteUint8(scenarioCount)
|
||||||
data.WriteBytes(bf.Data())
|
data.WriteBytes(bf.Data())
|
||||||
doAckBufSucceed(s, pkt.AckHandle, data.Data())
|
doAckBufSucceed(s, pkt.AckHandle, data.Data())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMsgMhfGetEtcPoints(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgMhfGetEtcPoints(s *Session, p mhfpacket.MHFPacket) {
|
||||||
|
|||||||
Reference in New Issue
Block a user