mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
code cleanup
This commit is contained in:
@@ -289,11 +289,11 @@ func handleMsgMhfPlayNormalGacha(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
dbUpdate.Seek(0, 0)
|
dbUpdate.Seek(0, 0)
|
||||||
// response needs all item info and the rarity
|
// response needs all item info and the rarity
|
||||||
resp.WriteBytes(dbUpdate.Data())
|
resp.WriteBytes(dbUpdate.Data())
|
||||||
resp.WriteUint8(uint8(items[ind].(*gachaItem).rarityIcon))
|
resp.WriteUint8(items[ind].(*gachaItem).rarityIcon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resp.Seek(0, 0)
|
resp.Seek(0, 0)
|
||||||
resp.WriteUint8(uint8(results))
|
resp.WriteUint8(results)
|
||||||
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||||
|
|
||||||
// add claimables to DB
|
// add claimables to DB
|
||||||
@@ -454,13 +454,13 @@ func handleMsgMhfPlayStepupGacha(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
rollFrame.Seek(0, 0)
|
rollFrame.Seek(0, 0)
|
||||||
// response needs all item info and the rarity
|
// response needs all item info and the rarity
|
||||||
resp.WriteBytes(rollFrame.Data())
|
resp.WriteBytes(rollFrame.Data())
|
||||||
resp.WriteUint8(uint8(items[ind].(*gachaItem).rarityIcon))
|
resp.WriteUint8(items[ind].(*gachaItem).rarityIcon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resp.WriteBytes(stepFrame.Data())
|
resp.WriteBytes(stepFrame.Data())
|
||||||
resp.Seek(0, 0)
|
resp.Seek(0, 0)
|
||||||
resp.WriteUint8(uint8(results + stepResults))
|
resp.WriteUint8(results + stepResults)
|
||||||
resp.WriteUint8(uint8(results))
|
resp.WriteUint8(results)
|
||||||
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||||
|
|
||||||
// add claimables to DB
|
// add claimables to DB
|
||||||
@@ -477,7 +477,6 @@ func handleMsgMhfPlayStepupGacha(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
SET gacha_trial = CASE WHEN (gacha_trial > $1) then gacha_trial - $1 else gacha_trial end,
|
SET gacha_trial = CASE WHEN (gacha_trial > $1) then gacha_trial - $1 else gacha_trial end,
|
||||||
gacha_prem = CASE WHEN NOT (gacha_trial > $1) then gacha_prem - $1 else gacha_prem end
|
gacha_prem = CASE WHEN NOT (gacha_trial > $1) then gacha_prem - $1 else gacha_prem end
|
||||||
WHERE id=$2`, currNumber, s.charID)
|
WHERE id=$2`, currNumber, s.charID)
|
||||||
|
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Fatal("Failed to update gacha_items in db", zap.Error(err))
|
s.logger.Fatal("Failed to update gacha_items in db", zap.Error(err))
|
||||||
@@ -639,7 +638,7 @@ func handleMsgMhfPlayBoxGacha(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
dbUpdate.Seek(0, 0)
|
dbUpdate.Seek(0, 0)
|
||||||
// response needs all item info and the rarity
|
// response needs all item info and the rarity
|
||||||
resp.WriteBytes(dbUpdate.Data())
|
resp.WriteBytes(dbUpdate.Data())
|
||||||
resp.WriteUint8(uint8(items[ind].(*gachaItem).rarityIcon))
|
resp.WriteUint8(items[ind].(*gachaItem).rarityIcon)
|
||||||
|
|
||||||
usedItemHash = append(usedItemHash, int64(items[ind].(*gachaItem).itemhash))
|
usedItemHash = append(usedItemHash, int64(items[ind].(*gachaItem).itemhash))
|
||||||
}
|
}
|
||||||
@@ -647,7 +646,7 @@ func handleMsgMhfPlayBoxGacha(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
items = append(items[:ind], items[ind+1:]...)
|
items = append(items[:ind], items[ind+1:]...)
|
||||||
}
|
}
|
||||||
resp.Seek(0, 0)
|
resp.Seek(0, 0)
|
||||||
resp.WriteUint8(uint8(results))
|
resp.WriteUint8(results)
|
||||||
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||||
|
|
||||||
// add claimables to DB
|
// add claimables to DB
|
||||||
|
|||||||
Reference in New Issue
Block a user