mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
fix: re-enable CI lint job and fix ~65 lint errors (partial)
Re-enable the golangci-lint job in CI (disabled Oct 2025), update to Go 1.25 and golangci-lint-action v7. Fix errcheck, gosimple S1009, staticcheck SA4031 and SA2001 errors across 54 files. Remaining ~39 lint errors will be addressed in follow-up commits.
This commit is contained in:
@@ -71,11 +71,11 @@ func Compress(rawData []byte) ([]byte, error) {
|
||||
output = append(output, []byte{byte(nullCount)}...)
|
||||
break
|
||||
} else if i != 0 && nullCount != 0 {
|
||||
r.UnreadByte()
|
||||
_ = r.UnreadByte()
|
||||
output = append(output, []byte{byte(nullCount)}...)
|
||||
break
|
||||
} else if i != 0 && nullCount == 0 {
|
||||
r.UnreadByte()
|
||||
_ = r.UnreadByte()
|
||||
output = output[:len(output)-2]
|
||||
output = append(output, []byte{byte(0xFF)}...)
|
||||
break
|
||||
|
||||
@@ -80,7 +80,7 @@ func doAckSimpleFail(s *Session, ackHandle uint32, data []byte) {
|
||||
|
||||
func updateRights(s *Session) {
|
||||
rightsInt := uint32(2)
|
||||
s.server.db.QueryRow("SELECT rights FROM users u INNER JOIN characters c ON u.id = c.user_id WHERE c.id = $1", s.charID).Scan(&rightsInt)
|
||||
_ = s.server.db.QueryRow("SELECT rights FROM users u INNER JOIN characters c ON u.id = c.user_id WHERE c.id = $1", s.charID).Scan(&rightsInt)
|
||||
s.courses, rightsInt = mhfcourse.GetCourseStruct(rightsInt)
|
||||
update := &mhfpacket.MsgSysUpdateRight{
|
||||
ClientRespAckHandle: 0,
|
||||
@@ -303,7 +303,7 @@ func logoutPlayer(s *Session) {
|
||||
if mhfcourse.CourseExists(30, s.courses) {
|
||||
rpGained = timePlayed / 900
|
||||
timePlayed = timePlayed % 900
|
||||
s.server.db.Exec("UPDATE characters SET cafe_time=cafe_time+$1 WHERE id=$2", sessionTime, s.charID)
|
||||
_, _ = s.server.db.Exec("UPDATE characters SET cafe_time=cafe_time+$1 WHERE id=$2", sessionTime, s.charID)
|
||||
} else {
|
||||
rpGained = timePlayed / 1800
|
||||
timePlayed = timePlayed % 1800
|
||||
@@ -329,8 +329,8 @@ func logoutPlayer(s *Session) {
|
||||
}
|
||||
|
||||
// Update time_played and guild treasure hunt
|
||||
s.server.db.Exec("UPDATE characters SET time_played = $1 WHERE id = $2", timePlayed, s.charID)
|
||||
s.server.db.Exec(`UPDATE guild_characters SET treasure_hunt=NULL WHERE character_id=$1`, s.charID)
|
||||
_, _ = s.server.db.Exec("UPDATE characters SET time_played = $1 WHERE id = $2", timePlayed, s.charID)
|
||||
_, _ = s.server.db.Exec(`UPDATE guild_characters SET treasure_hunt=NULL WHERE character_id=$1`, s.charID)
|
||||
}
|
||||
|
||||
// NOW do cleanup (after save is complete)
|
||||
@@ -449,7 +449,7 @@ func handleMsgSysRecordLog(s *Session, p mhfpacket.MHFPacket) {
|
||||
for i := 0; i < 176; i++ {
|
||||
val = bf.ReadUint8()
|
||||
if val > 0 && mhfmon.Monsters[i].Large {
|
||||
s.server.db.Exec(`INSERT INTO kill_logs (character_id, monster, quantity, timestamp) VALUES ($1, $2, $3, $4)`, s.charID, i, val, TimeAdjusted())
|
||||
_, _ = s.server.db.Exec(`INSERT INTO kill_logs (character_id, monster, quantity, timestamp) VALUES ($1, $2, $3, $4)`, s.charID, i, val, TimeAdjusted())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -665,7 +665,7 @@ func handleMsgMhfTransitMessage(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
if strings.HasPrefix(stage.id, findPartyParams.StagePrefix) {
|
||||
sb3 := byteframe.NewByteFrameFromBytes(stage.rawBinaryData[stageBinaryKey{1, 3}])
|
||||
sb3.Seek(4, 0)
|
||||
_, _ = sb3.Seek(4, 0)
|
||||
|
||||
stageDataParams := 7
|
||||
if _config.ErupeConfig.RealClientMode <= _config.G10 {
|
||||
@@ -741,7 +741,7 @@ func handleMsgMhfTransitMessage(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
}
|
||||
resp.Seek(0, io.SeekStart)
|
||||
_, _ = resp.Seek(0, io.SeekStart)
|
||||
resp.WriteUint16(count)
|
||||
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
@@ -954,7 +954,7 @@ func handleMsgMhfGetExtraInfo(s *Session, p mhfpacket.MHFPacket) {}
|
||||
func userGetItems(s *Session) []mhfitem.MHFItemStack {
|
||||
var data []byte
|
||||
var items []mhfitem.MHFItemStack
|
||||
s.server.db.QueryRow(`SELECT item_box FROM users u WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$1)`, s.charID).Scan(&data)
|
||||
_ = s.server.db.QueryRow(`SELECT item_box FROM users u WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$1)`, s.charID).Scan(&data)
|
||||
if len(data) > 0 {
|
||||
box := byteframe.NewByteFrameFromBytes(data)
|
||||
numStacks := box.ReadUint16()
|
||||
@@ -977,7 +977,7 @@ func handleMsgMhfEnumerateUnionItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
func handleMsgMhfUpdateUnionItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfUpdateUnionItem)
|
||||
newStacks := mhfitem.DiffItemStacks(userGetItems(s), pkt.UpdatedItems)
|
||||
s.server.db.Exec(`UPDATE users u SET item_box=$1 WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$2)`, mhfitem.SerializeWarehouseItems(newStacks), s.charID)
|
||||
_, _ = s.server.db.Exec(`UPDATE users u SET item_box=$1 WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$2)`, mhfitem.SerializeWarehouseItems(newStacks), s.charID)
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -990,17 +990,17 @@ func handleMsgMhfCheckWeeklyStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
err := s.server.db.QueryRow(fmt.Sprintf("SELECT %s_checked FROM stamps WHERE character_id=$1", pkt.StampType), s.charID).Scan(&lastCheck)
|
||||
if err != nil {
|
||||
lastCheck = TimeAdjusted()
|
||||
s.server.db.Exec("INSERT INTO stamps (character_id, hl_checked, ex_checked) VALUES ($1, $2, $2)", s.charID, TimeAdjusted())
|
||||
_, _ = s.server.db.Exec("INSERT INTO stamps (character_id, hl_checked, ex_checked) VALUES ($1, $2, $2)", s.charID, TimeAdjusted())
|
||||
} else {
|
||||
s.server.db.Exec(fmt.Sprintf(`UPDATE stamps SET %s_checked=$1 WHERE character_id=$2`, pkt.StampType), TimeAdjusted(), s.charID)
|
||||
_, _ = s.server.db.Exec(fmt.Sprintf(`UPDATE stamps SET %s_checked=$1 WHERE character_id=$2`, pkt.StampType), TimeAdjusted(), s.charID)
|
||||
}
|
||||
|
||||
if lastCheck.Before(TimeWeekStart()) {
|
||||
s.server.db.Exec(fmt.Sprintf("UPDATE stamps SET %s_total=%s_total+1 WHERE character_id=$1", pkt.StampType, pkt.StampType), s.charID)
|
||||
_, _ = s.server.db.Exec(fmt.Sprintf("UPDATE stamps SET %s_total=%s_total+1 WHERE character_id=$1", pkt.StampType, pkt.StampType), s.charID)
|
||||
updated = 1
|
||||
}
|
||||
|
||||
s.server.db.QueryRow(fmt.Sprintf("SELECT %s_total, %s_redeemed FROM stamps WHERE character_id=$1", pkt.StampType, pkt.StampType), s.charID).Scan(&total, &redeemed)
|
||||
_ = s.server.db.QueryRow(fmt.Sprintf("SELECT %s_total, %s_redeemed FROM stamps WHERE character_id=$1", pkt.StampType, pkt.StampType), s.charID).Scan(&total, &redeemed)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(total)
|
||||
bf.WriteUint16(redeemed)
|
||||
@@ -1016,10 +1016,10 @@ func handleMsgMhfExchangeWeeklyStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
var total, redeemed uint16
|
||||
var tktStack mhfitem.MHFItemStack
|
||||
if pkt.Unk1 == 10 { // Yearly Sub Ex
|
||||
s.server.db.QueryRow("UPDATE stamps SET hl_total=hl_total-48, hl_redeemed=hl_redeemed-48 WHERE character_id=$1 RETURNING hl_total, hl_redeemed", s.charID).Scan(&total, &redeemed)
|
||||
_ = s.server.db.QueryRow("UPDATE stamps SET hl_total=hl_total-48, hl_redeemed=hl_redeemed-48 WHERE character_id=$1 RETURNING hl_total, hl_redeemed", s.charID).Scan(&total, &redeemed)
|
||||
tktStack = mhfitem.MHFItemStack{Item: mhfitem.MHFItem{ItemID: 2210}, Quantity: 1}
|
||||
} else {
|
||||
s.server.db.QueryRow(fmt.Sprintf("UPDATE stamps SET %s_redeemed=%s_redeemed+8 WHERE character_id=$1 RETURNING %s_total, %s_redeemed", pkt.StampType, pkt.StampType, pkt.StampType, pkt.StampType), s.charID).Scan(&total, &redeemed)
|
||||
_ = s.server.db.QueryRow(fmt.Sprintf("UPDATE stamps SET %s_redeemed=%s_redeemed+8 WHERE character_id=$1 RETURNING %s_total, %s_redeemed", pkt.StampType, pkt.StampType, pkt.StampType, pkt.StampType), s.charID).Scan(&total, &redeemed)
|
||||
if pkt.StampType == "hl" {
|
||||
tktStack = mhfitem.MHFItemStack{Item: mhfitem.MHFItem{ItemID: 1630}, Quantity: 5}
|
||||
} else {
|
||||
@@ -1043,7 +1043,7 @@ func getGoocooData(s *Session, cid uint32) [][]byte {
|
||||
for i := 0; i < 5; i++ {
|
||||
err := s.server.db.QueryRow(fmt.Sprintf("SELECT goocoo%d FROM goocoo WHERE id=$1", i), cid).Scan(&goocoo)
|
||||
if err != nil {
|
||||
s.server.db.Exec("INSERT INTO goocoo (id) VALUES ($1)", s.charID)
|
||||
_, _ = s.server.db.Exec("INSERT INTO goocoo (id) VALUES ($1)", s.charID)
|
||||
return goocoos
|
||||
}
|
||||
if err == nil && goocoo != nil {
|
||||
@@ -1216,7 +1216,7 @@ func handleMsgMhfStampcardStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
var stamps, rewardTier, rewardUnk uint16
|
||||
reward := mhfitem.MHFItemStack{Item: mhfitem.MHFItem{}}
|
||||
s.server.db.QueryRow(`UPDATE characters SET stampcard = stampcard + $1 WHERE id = $2 RETURNING stampcard`, pkt.Stamps, s.charID).Scan(&stamps)
|
||||
_ = s.server.db.QueryRow(`UPDATE characters SET stampcard = stampcard + $1 WHERE id = $2 RETURNING stampcard`, pkt.Stamps, s.charID).Scan(&stamps)
|
||||
bf.WriteUint16(stamps - pkt.Stamps)
|
||||
bf.WriteUint16(stamps)
|
||||
|
||||
@@ -1578,7 +1578,7 @@ func handleMsgMhfGetTrendWeapon(s *Session, p mhfpacket.MHFPacket) {
|
||||
j := 0
|
||||
for rows.Next() {
|
||||
trendWeapons[i][j].WeaponType = i
|
||||
rows.Scan(&trendWeapons[i][j].WeaponID)
|
||||
_ = rows.Scan(&trendWeapons[i][j].WeaponID)
|
||||
j++
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ func handleMsgMhfGetAchievement(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint16(0) // Unk
|
||||
resp.WriteUint32(achData.Progress)
|
||||
}
|
||||
resp.Seek(0, io.SeekStart)
|
||||
_, _ = resp.Seek(0, io.SeekStart)
|
||||
resp.WriteUint32(points)
|
||||
resp.WriteUint32(points)
|
||||
resp.WriteUint32(points)
|
||||
|
||||
@@ -54,7 +54,7 @@ func handleMsgMhfCheckDailyCafepoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
var bondBonus, bonusQuests, dailyQuests uint32
|
||||
bf := byteframe.NewByteFrame()
|
||||
if midday.After(dailyTime) {
|
||||
addPointNetcafe(s, 5)
|
||||
_ = addPointNetcafe(s, 5)
|
||||
bondBonus = 5 // Bond point bonus quests
|
||||
bonusQuests = s.server.erupeConfig.GameplayOptions.BonusQuestAllowance
|
||||
dailyQuests = s.server.erupeConfig.GameplayOptions.DailyQuestAllowance
|
||||
@@ -196,7 +196,7 @@ func handleMsgMhfPostCafeDurationBonusReceived(s *Session, p mhfpacket.MHFPacket
|
||||
`, cbID).Scan(&cafeBonus.ID, &cafeBonus.ItemType, &cafeBonus.Quantity)
|
||||
if err == nil {
|
||||
if cafeBonus.ItemType == 17 {
|
||||
addPointNetcafe(s, int(cafeBonus.Quantity))
|
||||
_ = addPointNetcafe(s, int(cafeBonus.Quantity))
|
||||
}
|
||||
}
|
||||
s.server.db.Exec("INSERT INTO public.cafe_accepted VALUES ($1, $2)", cbID, s.charID)
|
||||
|
||||
@@ -46,7 +46,7 @@ func init() {
|
||||
zapConfig := zap.NewDevelopmentConfig()
|
||||
zapConfig.DisableCaller = true
|
||||
zapLogger, _ := zapConfig.Build()
|
||||
defer zapLogger.Sync()
|
||||
defer func() { _ = zapLogger.Sync() }()
|
||||
logger := zapLogger.Named("commands")
|
||||
cmds := _config.ErupeConfig.Commands
|
||||
for _, cmd := range cmds {
|
||||
@@ -74,7 +74,7 @@ func sendServerChatMessage(s *Session, message string) {
|
||||
Message: message,
|
||||
SenderName: "Erupe",
|
||||
}
|
||||
msgBinChat.Build(bf)
|
||||
_ = msgBinChat.Build(bf)
|
||||
|
||||
castedBin := &mhfpacket.MsgSysCastedBinary{
|
||||
CharID: 0,
|
||||
@@ -191,7 +191,7 @@ func parseChatCommand(s *Session, command string) {
|
||||
}
|
||||
temp = &mhfpacket.MsgSysDeleteObject{ObjID: object.id}
|
||||
deleteNotif.WriteUint16(uint16(temp.Opcode()))
|
||||
temp.Build(deleteNotif, s.clientContext)
|
||||
_ = temp.Build(deleteNotif, s.clientContext)
|
||||
}
|
||||
for _, session := range s.server.sessions {
|
||||
if s == session {
|
||||
@@ -199,7 +199,7 @@ func parseChatCommand(s *Session, command string) {
|
||||
}
|
||||
temp = &mhfpacket.MsgSysDeleteUser{CharID: session.charID}
|
||||
deleteNotif.WriteUint16(uint16(temp.Opcode()))
|
||||
temp.Build(deleteNotif, s.clientContext)
|
||||
_ = temp.Build(deleteNotif, s.clientContext)
|
||||
}
|
||||
deleteNotif.WriteUint16(uint16(network.MSG_SYS_END))
|
||||
s.QueueSendNonBlocking(deleteNotif.Data())
|
||||
@@ -211,14 +211,14 @@ func parseChatCommand(s *Session, command string) {
|
||||
}
|
||||
temp = &mhfpacket.MsgSysInsertUser{CharID: session.charID}
|
||||
reloadNotif.WriteUint16(uint16(temp.Opcode()))
|
||||
temp.Build(reloadNotif, s.clientContext)
|
||||
_ = temp.Build(reloadNotif, s.clientContext)
|
||||
for i := 0; i < 3; i++ {
|
||||
temp = &mhfpacket.MsgSysNotifyUserBinary{
|
||||
CharID: session.charID,
|
||||
BinaryType: uint8(i + 1),
|
||||
}
|
||||
reloadNotif.WriteUint16(uint16(temp.Opcode()))
|
||||
temp.Build(reloadNotif, s.clientContext)
|
||||
_ = temp.Build(reloadNotif, s.clientContext)
|
||||
}
|
||||
}
|
||||
for _, obj := range s.stage.objects {
|
||||
@@ -234,7 +234,7 @@ func parseChatCommand(s *Session, command string) {
|
||||
OwnerCharID: obj.ownerCharID,
|
||||
}
|
||||
reloadNotif.WriteUint16(uint16(temp.Opcode()))
|
||||
temp.Build(reloadNotif, s.clientContext)
|
||||
_ = temp.Build(reloadNotif, s.clientContext)
|
||||
}
|
||||
reloadNotif.WriteUint16(uint16(network.MSG_SYS_END))
|
||||
s.QueueSendNonBlocking(reloadNotif.Data())
|
||||
@@ -404,7 +404,7 @@ func parseChatCommand(s *Session, command string) {
|
||||
err := s.server.db.QueryRow(`SELECT discord_token FROM users u WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$1)`, s.charID).Scan(&_token)
|
||||
if err != nil {
|
||||
randToken := make([]byte, 4)
|
||||
rand.Read(randToken)
|
||||
_, _ = rand.Read(randToken)
|
||||
_token = fmt.Sprintf("%x-%x", randToken[:2], randToken[2:])
|
||||
s.server.db.Exec(`UPDATE users u SET discord_token = $1 WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$2)`, _token, s.charID)
|
||||
}
|
||||
@@ -469,7 +469,7 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
var returnToSender bool
|
||||
if pkt.MessageType == BinaryMessageTypeChat {
|
||||
tmp.SetLE()
|
||||
tmp.Seek(8, 0)
|
||||
_, _ = tmp.Seek(8, 0)
|
||||
message = string(tmp.ReadNullTerminatedBytes())
|
||||
author = string(tmp.ReadNullTerminatedBytes())
|
||||
}
|
||||
@@ -478,7 +478,7 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
realPayload := pkt.RawDataPayload
|
||||
if pkt.BroadcastType == BroadcastTypeTargeted {
|
||||
tmp.SetBE()
|
||||
tmp.Seek(0, 0)
|
||||
_, _ = tmp.Seek(0, 0)
|
||||
msgBinTargeted = &binpacket.MsgBinTargeted{}
|
||||
err := msgBinTargeted.Parse(tmp)
|
||||
if err != nil {
|
||||
@@ -497,13 +497,13 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.SetLE()
|
||||
m.Build(bf)
|
||||
_ = m.Build(bf)
|
||||
realPayload = bf.Data()
|
||||
} else {
|
||||
bf := byteframe.NewByteFrameFromBytes(pkt.RawDataPayload)
|
||||
bf.SetLE()
|
||||
chatMessage := &binpacket.MsgBinChat{}
|
||||
chatMessage.Parse(bf)
|
||||
_ = chatMessage.Parse(bf)
|
||||
if strings.HasPrefix(chatMessage.Message, s.server.erupeConfig.CommandPrefix) {
|
||||
parseChatCommand(s, chatMessage.Message)
|
||||
return
|
||||
|
||||
@@ -122,7 +122,7 @@ func TestHandleMsgSysCastBinary_DiceCommand(t *testing.T) {
|
||||
Message: "@dice",
|
||||
SenderName: "TestPlayer",
|
||||
}
|
||||
msg.Build(bf)
|
||||
_ = msg.Build(bf)
|
||||
|
||||
pkt := &mhfpacket.MsgSysCastBinary{
|
||||
Unk: 0,
|
||||
@@ -157,7 +157,7 @@ func TestBroadcastTypes(t *testing.T) {
|
||||
TargetCharIDs: []uint32{1, 2, 3},
|
||||
RawDataPayload: []byte{0xDE, 0xAD, 0xBE, 0xEF},
|
||||
}
|
||||
msg.Build(bf)
|
||||
_ = msg.Build(bf)
|
||||
return bf.Data()
|
||||
},
|
||||
},
|
||||
@@ -245,7 +245,7 @@ func TestBinaryMessageTypes(t *testing.T) {
|
||||
Message: "test",
|
||||
SenderName: "Player",
|
||||
}
|
||||
msg.Build(bf)
|
||||
_ = msg.Build(bf)
|
||||
return bf.Data()
|
||||
},
|
||||
},
|
||||
@@ -429,12 +429,12 @@ func TestChatMessageParsing(t *testing.T) {
|
||||
Message: tt.messageContent,
|
||||
SenderName: tt.authorName,
|
||||
}
|
||||
msg.Build(bf)
|
||||
_ = msg.Build(bf)
|
||||
|
||||
// Parse it back
|
||||
parseBf := byteframe.NewByteFrameFromBytes(bf.Data())
|
||||
parseBf.SetLE()
|
||||
parseBf.Seek(8, 0) // Skip initial bytes
|
||||
_, _ = parseBf.Seek(8, 0) // Skip initial bytes
|
||||
|
||||
message := string(parseBf.ReadNullTerminatedBytes())
|
||||
author := string(parseBf.ReadNullTerminatedBytes())
|
||||
|
||||
@@ -572,7 +572,7 @@ func BenchmarkCompress(b *testing.B) {
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
save.Compress()
|
||||
_ = save.Compress()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,6 +587,6 @@ func BenchmarkDecompress(b *testing.B) {
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
save.Decompress()
|
||||
_ = save.Decompress()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func handleMsgMhfListMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteBytes(stringsupport.PaddedString(name, 16, true))
|
||||
}
|
||||
}
|
||||
resp.Seek(0, 0)
|
||||
_, _ = resp.Seek(0, 0)
|
||||
resp.WriteUint32(count)
|
||||
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
@@ -613,8 +613,8 @@ func TestSaveDataSerialization(t *testing.T) {
|
||||
|
||||
// Simulate binary serialization
|
||||
buf := new(bytes.Buffer)
|
||||
binary.Write(buf, binary.LittleEndian, savedata.CharID)
|
||||
binary.Write(buf, binary.LittleEndian, savedata.Playtime)
|
||||
_ = binary.Write(buf, binary.LittleEndian, savedata.CharID)
|
||||
_ = binary.Write(buf, binary.LittleEndian, savedata.Playtime)
|
||||
|
||||
// Should have 8 bytes (4 + 4)
|
||||
if buf.Len() != 8 {
|
||||
@@ -625,8 +625,8 @@ func TestSaveDataSerialization(t *testing.T) {
|
||||
data := buf.Bytes()
|
||||
var charID uint32
|
||||
var playtime uint32
|
||||
binary.Read(bytes.NewReader(data), binary.LittleEndian, &charID)
|
||||
binary.Read(bytes.NewReader(data[4:]), binary.LittleEndian, &playtime)
|
||||
_ = binary.Read(bytes.NewReader(data), binary.LittleEndian, &charID)
|
||||
_ = binary.Read(bytes.NewReader(data[4:]), binary.LittleEndian, &playtime)
|
||||
|
||||
if charID != tt.charID || playtime != tt.playtime {
|
||||
t.Error("serialization round-trip failed")
|
||||
|
||||
@@ -179,10 +179,10 @@ func TestAckPacketStructure(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
|
||||
// Write opcode (2 bytes, big endian)
|
||||
binary.Write(&buf, binary.BigEndian, uint16(network.MSG_SYS_ACK))
|
||||
_ = binary.Write(&buf, binary.BigEndian, uint16(network.MSG_SYS_ACK))
|
||||
|
||||
// Write ack handle (4 bytes, big endian)
|
||||
binary.Write(&buf, binary.BigEndian, tt.ackHandle)
|
||||
_ = binary.Write(&buf, binary.BigEndian, tt.ackHandle)
|
||||
|
||||
// Write data
|
||||
buf.Write(tt.data)
|
||||
@@ -590,7 +590,7 @@ func TestSaveDataCorruptionDetection_Integration(t *testing.T) {
|
||||
|
||||
// Check that database wasn't updated with corrupted data
|
||||
var savedName string
|
||||
db.QueryRow("SELECT name FROM characters WHERE id = $1", charID).Scan(&savedName)
|
||||
_ = db.QueryRow("SELECT name FROM characters WHERE id = $1", charID).Scan(&savedName)
|
||||
if savedName == "HackedName" {
|
||||
t.Error("corrupted save data was incorrectly written to database")
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ func (s *Server) onInteraction(ds *discordgo.Session, i *discordgo.InteractionCr
|
||||
var temp string
|
||||
err := s.db.QueryRow(`UPDATE users SET discord_id = $1 WHERE discord_token = $2 RETURNING discord_id`, i.Member.User.ID, i.ApplicationCommandData().Options[0].StringValue()).Scan(&temp)
|
||||
if err == nil {
|
||||
ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
_ = ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Content: "Your Erupe account was linked successfully.",
|
||||
@@ -23,7 +23,7 @@ func (s *Server) onInteraction(ds *discordgo.Session, i *discordgo.InteractionCr
|
||||
},
|
||||
})
|
||||
} else {
|
||||
ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
_ = ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Content: "Failed to link Erupe account.",
|
||||
@@ -35,7 +35,7 @@ func (s *Server) onInteraction(ds *discordgo.Session, i *discordgo.InteractionCr
|
||||
password, _ := bcrypt.GenerateFromPassword([]byte(i.ApplicationCommandData().Options[0].StringValue()), 10)
|
||||
_, err := s.db.Exec(`UPDATE users SET password = $1 WHERE discord_id = $2`, password, i.Member.User.ID)
|
||||
if err == nil {
|
||||
ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
_ = ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Content: "Your Erupe account password has been updated.",
|
||||
@@ -43,7 +43,7 @@ func (s *Server) onInteraction(ds *discordgo.Session, i *discordgo.InteractionCr
|
||||
},
|
||||
})
|
||||
} else {
|
||||
ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
_ = ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Content: "Failed to update Erupe account password.",
|
||||
|
||||
@@ -71,7 +71,7 @@ func handleMsgMhfGetUdSchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
} else {
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
rows.Scan(&id, &start)
|
||||
_ = rows.Scan(&id, &start)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ func handleMsgMhfGetKeepLoginBoostStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
for rows.Next() {
|
||||
var temp loginBoost
|
||||
rows.StructScan(&temp)
|
||||
_ = rows.StructScan(&temp)
|
||||
loginBoosts = append(loginBoosts, temp)
|
||||
}
|
||||
if len(loginBoosts) == 0 {
|
||||
|
||||
@@ -177,7 +177,7 @@ func handleMsgMhfInfoFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
} else {
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
rows.Scan(&id, &start)
|
||||
_ = rows.Scan(&id, &start)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -678,13 +678,13 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
guild.LeaderCharID = guildMembers[i].CharID
|
||||
guildMembers[0].OrderIndex = guildMembers[i].OrderIndex
|
||||
guildMembers[i].OrderIndex = 1
|
||||
guildMembers[0].Save(s)
|
||||
guildMembers[i].Save(s)
|
||||
_ = guildMembers[0].Save(s)
|
||||
_ = guildMembers[i].Save(s)
|
||||
bf.WriteUint32(guildMembers[i].CharID)
|
||||
break
|
||||
}
|
||||
}
|
||||
guild.Save(s)
|
||||
_ = guild.Save(s)
|
||||
}
|
||||
case mhfpacket.OperateGuildApply:
|
||||
err = guild.CreateApplication(s, s.charID, GuildApplicationTypeApplied, nil)
|
||||
@@ -709,7 +709,7 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
Body: fmt.Sprintf("You have withdrawn from 「%s」.", guild.Name),
|
||||
IsSystemMessage: true,
|
||||
}
|
||||
mail.Send(s, nil)
|
||||
_ = mail.Send(s, nil)
|
||||
}
|
||||
bf.WriteUint32(uint32(response))
|
||||
case mhfpacket.OperateGuildDonateRank:
|
||||
@@ -728,7 +728,7 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
return
|
||||
}
|
||||
guild.Comment = stringsupport.SJISToUTF8(pkt.Data2.ReadNullTerminatedBytes())
|
||||
guild.Save(s)
|
||||
_ = guild.Save(s)
|
||||
case mhfpacket.OperateGuildUpdateMotto:
|
||||
if !characterGuildInfo.IsLeader && !characterGuildInfo.IsSubLeader() {
|
||||
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
@@ -737,7 +737,7 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
_ = pkt.Data1.ReadUint16()
|
||||
guild.SubMotto = pkt.Data1.ReadUint8()
|
||||
guild.MainMotto = pkt.Data1.ReadUint8()
|
||||
guild.Save(s)
|
||||
_ = guild.Save(s)
|
||||
case mhfpacket.OperateGuildRenamePugi1:
|
||||
handleRenamePugi(s, pkt.Data2, guild, 1)
|
||||
case mhfpacket.OperateGuildRenamePugi2:
|
||||
@@ -788,7 +788,7 @@ func handleRenamePugi(s *Session, bf *byteframe.ByteFrame, guild *Guild, num int
|
||||
default:
|
||||
guild.PugiName3 = name
|
||||
}
|
||||
guild.Save(s)
|
||||
_ = guild.Save(s)
|
||||
}
|
||||
|
||||
func handleChangePugi(s *Session, outfit uint8, guild *Guild, num int) {
|
||||
@@ -800,7 +800,7 @@ func handleChangePugi(s *Session, outfit uint8, guild *Guild, num int) {
|
||||
case 3:
|
||||
guild.PugiOutfit3 = outfit
|
||||
}
|
||||
guild.Save(s)
|
||||
_ = guild.Save(s)
|
||||
}
|
||||
|
||||
func handleDonateRP(s *Session, amount uint16, guild *Guild, _type int) []byte {
|
||||
@@ -912,7 +912,7 @@ func handleMsgMhfOperateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
mail.Send(s, nil)
|
||||
_ = mail.Send(s, nil)
|
||||
for _, channel := range s.server.Channels {
|
||||
for _, session := range channel.sessions {
|
||||
if session.charID == pkt.CharID {
|
||||
|
||||
@@ -182,7 +182,7 @@ func handleMsgMhfAnswerGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(guild.ID)
|
||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
for _, m := range mail {
|
||||
m.Send(s, nil)
|
||||
_ = m.Send(s, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ func SendMailNotification(s *Session, m *Mail, recipient *Session) {
|
||||
SenderName: getCharacterName(s, m.SenderID),
|
||||
}
|
||||
|
||||
notification.Build(bf)
|
||||
_ = notification.Build(bf)
|
||||
|
||||
castedBinary := &mhfpacket.MsgSysCastedBinary{
|
||||
CharID: m.SenderID,
|
||||
@@ -183,7 +183,7 @@ func SendMailNotification(s *Session, m *Mail, recipient *Session) {
|
||||
RawDataPayload: bf.Data(),
|
||||
}
|
||||
|
||||
castedBinary.Build(bf, s.clientContext)
|
||||
_ = castedBinary.Build(bf, s.clientContext)
|
||||
|
||||
recipient.QueueSendMHFNonBlocking(castedBinary)
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ func handleMsgMhfSaveOtomoAirou(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
save.WriteBytes(bf.DataFromCurrent())
|
||||
save.Seek(0, 0)
|
||||
_, _ = save.Seek(0, 0)
|
||||
save.WriteUint8(catsExist)
|
||||
comp, err := nullcomp.Compress(save.Data())
|
||||
if err != nil {
|
||||
|
||||
@@ -39,7 +39,7 @@ func buildCatBytes(cats []Airou) []byte {
|
||||
for _, cat := range cats {
|
||||
catBuf := new(bytes.Buffer)
|
||||
// ID (uint32)
|
||||
binary.Write(catBuf, binary.BigEndian, cat.ID)
|
||||
_ = binary.Write(catBuf, binary.BigEndian, cat.ID)
|
||||
// 1 byte skip (unknown bool)
|
||||
catBuf.WriteByte(0)
|
||||
// Name (18 bytes)
|
||||
@@ -57,17 +57,17 @@ func buildCatBytes(cats []Airou) []byte {
|
||||
// 5 bytes skip (affection and colour sliders)
|
||||
catBuf.Write(make([]byte, 5))
|
||||
// Experience (uint32)
|
||||
binary.Write(catBuf, binary.BigEndian, cat.Experience)
|
||||
_ = binary.Write(catBuf, binary.BigEndian, cat.Experience)
|
||||
// 1 byte skip (bool for weapon equipped)
|
||||
catBuf.WriteByte(0)
|
||||
// WeaponType (uint8)
|
||||
catBuf.WriteByte(cat.WeaponType)
|
||||
// WeaponID (uint16)
|
||||
binary.Write(catBuf, binary.BigEndian, cat.WeaponID)
|
||||
_ = binary.Write(catBuf, binary.BigEndian, cat.WeaponID)
|
||||
|
||||
catData := catBuf.Bytes()
|
||||
// catDefLen (uint32) - total length of the cat data after this field
|
||||
binary.Write(buf, binary.BigEndian, uint32(len(catData)))
|
||||
_ = binary.Write(buf, binary.BigEndian, uint32(len(catData)))
|
||||
buf.Write(catData)
|
||||
}
|
||||
return buf.Bytes()
|
||||
@@ -174,7 +174,7 @@ func TestGetAirouDetails_ExtraTrailingBytes(t *testing.T) {
|
||||
buf.WriteByte(1) // catCount = 1
|
||||
|
||||
catBuf := new(bytes.Buffer)
|
||||
binary.Write(catBuf, binary.BigEndian, uint32(99)) // catID
|
||||
_ = binary.Write(catBuf, binary.BigEndian, uint32(99)) // catID
|
||||
catBuf.WriteByte(0) // skip
|
||||
catBuf.Write(make([]byte, 18)) // name
|
||||
catBuf.WriteByte(3) // currentTask
|
||||
@@ -182,7 +182,7 @@ func TestGetAirouDetails_ExtraTrailingBytes(t *testing.T) {
|
||||
catBuf.WriteByte(1) // personality
|
||||
catBuf.WriteByte(2) // class
|
||||
catBuf.Write(make([]byte, 5)) // affection skip
|
||||
binary.Write(catBuf, binary.BigEndian, uint32(500)) // experience
|
||||
_ = binary.Write(catBuf, binary.BigEndian, uint32(500)) // experience
|
||||
catBuf.WriteByte(0) // weapon equipped bool
|
||||
catBuf.WriteByte(6) // weaponType
|
||||
binary.Write(catBuf, binary.BigEndian, uint16(50)) // weaponID
|
||||
|
||||
@@ -227,7 +227,7 @@ func loadQuestFile(s *Session, questId int) []byte {
|
||||
}
|
||||
fileBytes := byteframe.NewByteFrameFromBytes(decrypted)
|
||||
fileBytes.SetLE()
|
||||
fileBytes.Seek(int64(fileBytes.ReadUint32()), 0)
|
||||
_, _ = fileBytes.Seek(int64(fileBytes.ReadUint32()), 0)
|
||||
|
||||
bodyLength := 320
|
||||
if _config.ErupeConfig.RealClientMode <= _config.S6 {
|
||||
@@ -244,12 +244,12 @@ func loadQuestFile(s *Session, questId int) []byte {
|
||||
questBody := byteframe.NewByteFrameFromBytes(fileBytes.ReadBytes(uint(bodyLength)))
|
||||
questBody.SetLE()
|
||||
// Find the master quest string pointer
|
||||
questBody.Seek(40, 0)
|
||||
fileBytes.Seek(int64(questBody.ReadUint32()), 0)
|
||||
questBody.Seek(40, 0)
|
||||
_, _ = questBody.Seek(40, 0)
|
||||
_, _ = fileBytes.Seek(int64(questBody.ReadUint32()), 0)
|
||||
_, _ = questBody.Seek(40, 0)
|
||||
// Overwrite it
|
||||
questBody.WriteUint32(uint32(bodyLength))
|
||||
questBody.Seek(0, 2)
|
||||
_, _ = questBody.Seek(0, 2)
|
||||
|
||||
// Rewrite the quest strings and their pointers
|
||||
var tempString []byte
|
||||
@@ -258,9 +258,9 @@ func loadQuestFile(s *Session, questId int) []byte {
|
||||
for i := 0; i < 8; i++ {
|
||||
questBody.WriteUint32(uint32(tempPointer))
|
||||
temp := int64(fileBytes.Index())
|
||||
fileBytes.Seek(int64(fileBytes.ReadUint32()), 0)
|
||||
_, _ = fileBytes.Seek(int64(fileBytes.ReadUint32()), 0)
|
||||
tempString = fileBytes.ReadNullTerminatedBytes()
|
||||
fileBytes.Seek(temp+4, 0)
|
||||
_, _ = fileBytes.Seek(temp+4, 0)
|
||||
tempPointer += len(tempString) + 1
|
||||
newStrings.WriteNullTerminatedBytes(tempString)
|
||||
}
|
||||
@@ -278,7 +278,7 @@ func makeEventQuest(s *Session, rows *sql.Rows) ([]byte, error) {
|
||||
var questId, activeDuration, inactiveDuration, flags int
|
||||
var maxPlayers, questType uint8
|
||||
var startTime time.Time
|
||||
rows.Scan(&id, &maxPlayers, &questType, &questId, &mark, &flags, &startTime, &activeDuration, &inactiveDuration)
|
||||
_ = rows.Scan(&id, &maxPlayers, &questType, &questId, &mark, &flags, &startTime, &activeDuration, &inactiveDuration)
|
||||
|
||||
data := loadQuestFile(s, questId)
|
||||
if data == nil {
|
||||
@@ -388,7 +388,7 @@ func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
_, err = tx.Exec("UPDATE event_quests SET start_time = $1 WHERE id = $2", newRotationTime, id)
|
||||
if err != nil {
|
||||
tx.Rollback() // Rollback if an error occurs
|
||||
_ = tx.Rollback()
|
||||
break
|
||||
}
|
||||
startTime = newRotationTime // Set the new start time so the quest can be used/removed immediately.
|
||||
@@ -421,7 +421,7 @@ func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
rows.Close()
|
||||
tx.Commit()
|
||||
_ = tx.Commit()
|
||||
}
|
||||
|
||||
tuneValues := []tuneValue{
|
||||
|
||||
@@ -119,13 +119,13 @@ func (s *Session) notifyRavi() {
|
||||
raviNotif := byteframe.NewByteFrame()
|
||||
temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: 0x40000}
|
||||
raviNotif.WriteUint16(uint16(temp.Opcode()))
|
||||
temp.Build(raviNotif, s.clientContext)
|
||||
_ = temp.Build(raviNotif, s.clientContext)
|
||||
temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: 0x50000}
|
||||
raviNotif.WriteUint16(uint16(temp.Opcode()))
|
||||
temp.Build(raviNotif, s.clientContext)
|
||||
_ = temp.Build(raviNotif, s.clientContext)
|
||||
temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: 0x60000}
|
||||
raviNotif.WriteUint16(uint16(temp.Opcode()))
|
||||
temp.Build(raviNotif, s.clientContext)
|
||||
_ = temp.Build(raviNotif, s.clientContext)
|
||||
raviNotif.WriteUint16(0x0010) // End it.
|
||||
if s.server.erupeConfig.GameplayOptions.LowLatencyRaviente {
|
||||
for session := range sema.clients {
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
)
|
||||
|
||||
// createMockServerWithRaviente creates a mock server with raviente and semaphore
|
||||
@@ -26,9 +25,6 @@ func TestRavienteInitialization(t *testing.T) {
|
||||
state: make([]uint32, 30),
|
||||
support: make([]uint32, 30),
|
||||
}
|
||||
if r == nil {
|
||||
t.Fatal("Raviente is nil")
|
||||
}
|
||||
if len(r.register) != 30 {
|
||||
t.Errorf("register length = %d, want 30", len(r.register))
|
||||
}
|
||||
@@ -221,9 +217,4 @@ func TestMockServerPacketHandling(t *testing.T) {
|
||||
t.Errorf("ByteFrame length = %d, want 4", len(bf.Data()))
|
||||
}
|
||||
|
||||
// Verify packet types can be instantiated
|
||||
pkt := &mhfpacket.MsgSysAck{}
|
||||
if pkt == nil {
|
||||
t.Error("Failed to create MsgSysAck")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ func handleMsgMhfEnumerateRengokuRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
defer rows.Close()
|
||||
|
||||
for rows.Next() {
|
||||
rows.StructScan(&score)
|
||||
_ = rows.StructScan(&score)
|
||||
if score.Name == s.Name {
|
||||
bf.WriteUint32(i)
|
||||
bf.WriteUint32(score.Score)
|
||||
|
||||
@@ -354,7 +354,7 @@ func getGuaranteedItems(s *Session, gachaID uint32, rollID uint8) []GachaItem {
|
||||
items, err := s.server.db.Queryx(`SELECT item_type, item_id, quantity FROM gacha_items WHERE entry_id = (SELECT id FROM gacha_entries WHERE entry_type = $1 AND gacha_id = $2)`, rollID, gachaID)
|
||||
if err == nil {
|
||||
for items.Next() {
|
||||
items.StructScan(&reward)
|
||||
_ = items.StructScan(&reward)
|
||||
rewards = append(rewards, reward)
|
||||
}
|
||||
}
|
||||
@@ -586,7 +586,7 @@ func handleMsgMhfGetBoxGachaInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
var entryIDs []uint32
|
||||
for entries.Next() {
|
||||
var entryID uint32
|
||||
entries.Scan(&entryID)
|
||||
_ = entries.Scan(&entryID)
|
||||
entryIDs = append(entryIDs, entryID)
|
||||
}
|
||||
bf := byteframe.NewByteFrame()
|
||||
|
||||
@@ -324,7 +324,7 @@ func handleMsgMhfGetTenrouirai(s *Session, p mhfpacket.MHFPacket) {
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
temp := TenrouiraiCharScore{}
|
||||
rows.Scan(&temp.Name, &temp.Score)
|
||||
_ = rows.Scan(&temp.Name, &temp.Score)
|
||||
tenrouirai.CharScore = append(tenrouirai.CharScore, temp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ func (s *Server) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session)
|
||||
bf.WriteUint16(uint16(pkt.Opcode()))
|
||||
|
||||
// Build the packet onto the byteframe.
|
||||
pkt.Build(bf, session.clientContext)
|
||||
_ = pkt.Build(bf, session.clientContext)
|
||||
|
||||
// Enqueue in a non-blocking way that drops the packet if the connections send buffer channel is full.
|
||||
session.QueueSendNonBlocking(bf.Data())
|
||||
@@ -347,7 +347,7 @@ func (s *Server) BroadcastChatMessage(message string) {
|
||||
Message: message,
|
||||
SenderName: s.name,
|
||||
}
|
||||
msgBinChat.Build(bf)
|
||||
_ = msgBinChat.Build(bf)
|
||||
|
||||
s.BroadcastMHF(&mhfpacket.MsgSysCastedBinary{
|
||||
MessageType: BinaryMessageTypeChat,
|
||||
@@ -390,7 +390,7 @@ func (s *Server) BroadcastRaviente(ip uint32, port uint16, stage []byte, _type u
|
||||
func (s *Server) DiscordChannelSend(charName string, content string) {
|
||||
if s.erupeConfig.Discord.Enabled && s.discordBot != nil {
|
||||
message := fmt.Sprintf("**%s**: %s", charName, content)
|
||||
s.discordBot.RealtimeChannelSend(message)
|
||||
_ = s.discordBot.RealtimeChannelSend(message)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ func (s *Server) DiscordScreenShotSend(charName string, title string, descriptio
|
||||
if s.erupeConfig.Discord.Enabled && s.discordBot != nil {
|
||||
imageUrl := fmt.Sprintf("%s:%d/api/ss/bbs/%s", s.erupeConfig.Screenshots.Host, s.erupeConfig.Screenshots.Port, articleToken)
|
||||
message := fmt.Sprintf("**%s**: %s - %s %s", charName, title, description, imageUrl)
|
||||
s.discordBot.RealtimeChannelSend(message)
|
||||
_ = s.discordBot.RealtimeChannelSend(message)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ func (s *Server) DisconnectUser(uid uint32) {
|
||||
} else {
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
rows.Scan(&cid)
|
||||
_ = rows.Scan(&cid)
|
||||
cids = append(cids, cid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func (s *Semaphore) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Sessio
|
||||
bf.WriteUint16(uint16(pkt.Opcode()))
|
||||
|
||||
// Build the packet onto the byteframe.
|
||||
pkt.Build(bf, session.clientContext)
|
||||
_ = pkt.Build(bf, session.clientContext)
|
||||
|
||||
// Enqueue in a non-blocking way that drops the packet if the connections send buffer channel is full.
|
||||
session.QueueSendNonBlocking(bf.Data())
|
||||
|
||||
@@ -131,7 +131,7 @@ func (s *Session) QueueSendMHF(pkt mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(uint16(pkt.Opcode()))
|
||||
|
||||
// Build the packet onto the byteframe.
|
||||
pkt.Build(bf, s.clientContext)
|
||||
_ = pkt.Build(bf, s.clientContext)
|
||||
|
||||
// Queue it.
|
||||
s.QueueSend(bf.Data())
|
||||
|
||||
@@ -170,11 +170,11 @@ func applyPatchSchemas(t *testing.T, db *sqlx.DB, projectRoot string) {
|
||||
|
||||
_, err = tx.Exec(string(patchSQL))
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
_ = tx.Rollback()
|
||||
t.Logf("Warning: Failed to apply patch %s: %v", filename, err)
|
||||
// Continue with other patches even if one fails
|
||||
} else {
|
||||
tx.Commit()
|
||||
_ = tx.Commit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user