Skip to content

Commit

Permalink
fix netcafe time reset
Browse files Browse the repository at this point in the history
  • Loading branch information
sekaiwish committed Nov 10, 2022
1 parent ec2ff61 commit c7ba4bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/channelserver/handlers_cafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,14 @@ func handleMsgMhfGetCafeDuration(s *Session, p mhfpacket.MHFPacket) {

var cafeReset time.Time
err := s.server.db.QueryRow(`SELECT cafe_reset FROM characters WHERE id=$1`, s.charID).Scan(&cafeReset)
if err != nil {
cafeReset = TimeWeekNext()
s.server.db.Exec(`UPDATE characters SET cafe_reset=$1 WHERE id=$2`, cafeReset, s.charID)
}
if Time_Current_Adjusted().After(cafeReset) {
cafeReset = TimeWeekNext()
s.server.db.Exec(`UPDATE characters SET cafe_time=0, cafe_reset=$1 WHERE id=$2; DELETE FROM cafe_accepted WHERE character_id=$2`, cafeReset, s.charID)
s.server.db.Exec(`UPDATE characters SET cafe_time=0, cafe_reset=$1 WHERE id=$2`, cafeReset, s.charID)
s.server.db.Exec(`DELETE FROM cafe_accepted WHERE character_id=$1`, s.charID)
}

var cafeTime uint32
Expand Down

0 comments on commit c7ba4bd

Please sign in to comment.