Merge pull request #80 from ZeruLight/feature/raviente-latency

implement customisable Raviente latency
This commit is contained in:
wish
2023-08-13 11:49:49 +10:00
committed by GitHub
4 changed files with 17 additions and 5 deletions

View File

@@ -48,6 +48,7 @@
"DailyQuestAllowance": 1,
"MezfesSoloTickets": 10,
"MezfesGroupTickets": 4,
"LowLatencyRaviente": false,
"RegularRavienteMaxPlayers": 8,
"ViolentRavienteMaxPlayers": 8,
"BerserkRavienteMaxPlayers": 32,

View File

@@ -133,6 +133,7 @@ type GameplayOptions struct {
DailyQuestAllowance uint32 // Number of Daily Quests to allow daily
MezfesSoloTickets uint32 // Number of solo tickets given weekly
MezfesGroupTickets uint32 // Number of group tickets given weekly
LowLatencyRaviente bool // Toggles low latency mode for Raviente, can be network intensive
RegularRavienteMaxPlayers uint8
ViolentRavienteMaxPlayers uint8
BerserkRavienteMaxPlayers uint8

View File

@@ -272,13 +272,12 @@ func handleMsgSysPing(s *Session, p mhfpacket.MHFPacket) {
}
func handleMsgSysTime(s *Session, p mhfpacket.MHFPacket) {
//pkt := p.(*mhfpacket.MsgSysTime)
resp := &mhfpacket.MsgSysTime{
GetRemoteTime: false,
Timestamp: uint32(TimeAdjusted().Unix()), // JP timezone
}
s.QueueSendMHF(resp)
s.notifyRavi()
}
func handleMsgSysIssueLogkey(s *Session, p mhfpacket.MHFPacket) {

View File

@@ -196,7 +196,9 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) {
resp.WriteUint8(0)
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
}
s.notifyRavi()
if s.server.erupeConfig.GameplayOptions.LowLatencyRaviente {
s.notifyRavi()
}
s.server.raviente.Unlock()
}
@@ -241,6 +243,10 @@ func handleMsgSysLoadRegister(s *Session, p mhfpacket.MHFPacket) {
}
func (s *Session) notifyRavi() {
sema := getRaviSemaphore(s.server)
if sema == nil {
return
}
var temp mhfpacket.MHFPacket
raviNotif := byteframe.NewByteFrame()
temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: 4}
@@ -253,11 +259,16 @@ func (s *Session) notifyRavi() {
raviNotif.WriteUint16(uint16(temp.Opcode()))
temp.Build(raviNotif, s.clientContext)
raviNotif.WriteUint16(0x0010) // End it.
sema := getRaviSemaphore(s.server)
if sema != nil {
if s.server.erupeConfig.GameplayOptions.LowLatencyRaviente {
for session := range sema.clients {
session.QueueSend(raviNotif.Data())
}
} else {
for session := range sema.clients {
if session.charID == s.charID {
session.QueueSend(raviNotif.Data())
}
}
}
}