Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Ghost Players #4

Merged
merged 8 commits into from Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Erupe/server/channelserver/handlers_event.go
Expand Up @@ -186,7 +186,7 @@ func handleMsgMhfGetKeepLoginBoostStatus(s *Session, p mhfpacket.MHFPacket) {
if loginBoostStatus[d].WeekReq == CurrentWeek || loginBoostStatus[d].WeekCount != 0 {
loginBoostStatus[d].WeekCount = CurrentWeek
}
if !loginBoostStatus[d].Available && loginBoostStatus[d].WeekCount == loginBoostStatus[d].WeekReq && uint32(time.Now().In(time.FixedZone("UTC+1", 1*60*60)).Unix()) >= loginBoostStatus[d].Expiration {
if !loginBoostStatus[d].Available && loginBoostStatus[d].WeekCount >= loginBoostStatus[d].WeekReq && uint32(time.Now().In(time.FixedZone("UTC+1", 1*60*60)).Unix()) >= loginBoostStatus[d].Expiration {
loginBoostStatus[d].Expiration = 1
}
if !insert {
Expand Down
18 changes: 9 additions & 9 deletions Erupe/server/channelserver/handlers_stage.go
Expand Up @@ -13,11 +13,9 @@ func handleMsgSysCreateStage(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgSysCreateStage)

s.server.stagesLock.Lock()
if s.server.stages[pkt.StageID]==nil{
stage := NewStage(pkt.StageID)
stage.maxPlayers = uint16(pkt.PlayerCount)
s.server.stages[stage.id] = stage
}
s.server.stagesLock.Unlock()
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
}
Expand Down Expand Up @@ -92,7 +90,6 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) {
clientNotif := byteframe.NewByteFrame()
for session := range s.stage.clients {
var cur mhfpacket.MHFPacket
if session.charID != s.charID {
cur = &mhfpacket.MsgSysInsertUser{
CharID: session.charID,
}
Expand All @@ -119,9 +116,6 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) {
}
clientNotif.WriteUint16(uint16(cur.Opcode()))
cur.Build(clientNotif, session.clientContext)
} else {
continue
}
}
s.stage.RUnlock()
clientNotif.WriteUint16(0x0010) // End it.
Expand All @@ -132,7 +126,6 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) {
clientDupObjNotif := byteframe.NewByteFrame()
s.stage.RLock()
for _, obj := range s.stage.objects {
if obj.ownerCharID != s.charID {
cur := &mhfpacket.MsgSysDuplicateObject{
ObjID: obj.id,
X: obj.x,
Expand All @@ -143,7 +136,6 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) {
}
clientDupObjNotif.WriteUint16(uint16(cur.Opcode()))
cur.Build(clientDupObjNotif, s.clientContext)
}
}
s.stage.RUnlock()
clientDupObjNotif.WriteUint16(0x0010) // End it.
Expand Down Expand Up @@ -171,8 +163,16 @@ func removeSessionFromStage(s *Session) {
// Actually delete it form the objects map.
delete(s.stage.objects, objID)
}
}
}
for objListID, stageObjectList := range s.stage.objectList {
if stageObjectList.charid == s.charID {
//Added to prevent duplicates from flooding ObjectMap and causing server hangs
s.stage.objectList[objListID].status=false
s.stage.objectList[objListID].charid=0
}
}
}


func handleMsgSysEnterStage(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgSysEnterStage)
Expand Down
2 changes: 1 addition & 1 deletion Erupe/www/erupe/login.html
Expand Up @@ -30,7 +30,7 @@ <h5 class="mb-1" style="font-size: 16px;color: White; position: relative; left:
</div>
<h5 class="mb-1" style="font-size: 16px;color: White; position: relative; left: 5px;" ><b>Password</b></h5>
<div class="form-group">
<input type="text" class="form-control" id="password" placeholder="Password" onkeyup="showKeyCode(event);" onclick="CUE_Selected()" onmouseover="CUE_Cursor()" value="" autocomplete="on">
<input type="password" class="form-control" id="password" placeholder="Password" onkeyup="showKeyCode(event);" onclick="CUE_Selected()" onmouseover="CUE_Cursor()" value="" autocomplete="on">
</div>
<h5 class="mb-1" style="font-size: 16px;color: White; position: relative; left: 5px;" ><b>Server Selection</b></h5>
<div class="form-group">
Expand Down