diff --git a/pkg/lobby/app_core.go b/pkg/lobby/app_core.go index b509196..7d320e2 100644 --- a/pkg/lobby/app_core.go +++ b/pkg/lobby/app_core.go @@ -399,6 +399,7 @@ func (a *App) OnEntryLobbyBattle(p *AppPeer, side byte) { continue } NoticeChatMessage(peer, "SERVER", ">", msg) + // NoticeEntryUserCount(peer, lobby.Id, aeug, titans) } } } @@ -692,7 +693,12 @@ func (a *App) OnGetRoomRestTime(p *AppPeer, roomId uint16) uint16 { if !ok { return 0 } - return uint16(room.Deadline.Sub(time.Now()).Seconds() + 1) + + t := room.Deadline.Sub(time.Now()).Seconds() + if t < 0 { + t = 0 + } + return uint16(t) } func (a *App) OnGetRoomMember(p *AppPeer, roomId uint16) (count uint16, users []string) { @@ -748,7 +754,9 @@ func (a *App) OnEntryRoomMatch(p *AppPeer, side byte) { continue } NoticeChatMessage(peer, "SERVER", ">", msg) + // NoticeEntryUserCount(peer, p.Room.Id, aeug, titans) } + } func (a *App) OnEnterRoom(p *AppPeer, roomId, _, _ uint16) bool { @@ -833,8 +841,13 @@ func (a *App) OnExitRoom(p *AppPeer) { } -func (a *App) OnGetRoomMatchEntryUserCount(p *AppPeer, roomId uint16) { - //保留 +func (a *App) OnGetRoomMatchEntryUserCount(p *AppPeer, roomId uint16) (aeug uint16, titans uint16) { + if p.Lobby != nil { + if room, ok := p.Lobby.Rooms[roomId]; ok { + return room.GetEntryUserCount() + } + } + return } func (a *App) OnNoticeRoomBattleStart(p *AppPeer) { diff --git a/pkg/lobby/msg_lobby.go b/pkg/lobby/msg_lobby.go index 938a662..ba39a27 100644 --- a/pkg/lobby/msg_lobby.go +++ b/pkg/lobby/msg_lobby.go @@ -175,6 +175,7 @@ func NoticeLobbyUserCount(p *AppPeer, lobbyId, inLobby, inBattle uint16) { } func NoticeEntryUserCount(p *AppPeer, lobbyId, aeug, titans uint16) { + // Doesn't work.. n := NewServerNotice(0x640F) w := n.Writer() w.Write16(lobbyId) diff --git a/pkg/lobby/msg_room.go b/pkg/lobby/msg_room.go index 03720a8..bb16837 100644 --- a/pkg/lobby/msg_room.go +++ b/pkg/lobby/msg_room.go @@ -1,8 +1,9 @@ package lobby import ( - "github.com/golang/glog" . "zdxsv/pkg/lobby/message" + + "github.com/golang/glog" ) var _ = register(0x6401, "GetRoomCount", func(p *AppPeer, m *Message) { @@ -40,11 +41,15 @@ var _ = register(0x640B, "GetRoomJoinInfo", func(p *AppPeer, m *Message) { var _ = register(0x6403, "GetRoomUserCount", func(p *AppPeer, m *Message) { roomId := m.Reader().Read16() count := p.app.OnGetRoomUserCount(p, roomId) + maxCount := p.app.OnGetRoomJoinInfo(p, roomId) a := NewServerAnswer(m) w := a.Writer() w.Write16(roomId) w.Write16(count) // 現在人数 // なんかこの後にWrite16したらティターンズの人数が変わったがメモリ的な問題っぽい + w.Write16(0) // ??? + w.Write16(maxCount) + w.Write16(count) // ??? p.SendMessage(a) }) @@ -276,10 +281,10 @@ var _ = register(0x6504, "EntryRoomMatch", func(p *AppPeer, m *Message) { var _ = register(0x6406, "EnterRoom", func(p *AppPeer, m *Message) { r := m.Reader() roomId := r.Read16() - hoge := r.Read16() - huga := r.Read16() - p.app.OnEnterRoom(p, roomId, hoge, huga) - glog.Infoln("EnterRoom", roomId, hoge, huga) + unk1 := r.Read16() + unk2 := r.Read16() + p.app.OnEnterRoom(p, roomId, unk1, unk2) + glog.Infoln("EnterRoom", roomId, unk1, unk2) p.SendMessage(NewServerAnswer(m)) }) @@ -291,13 +296,13 @@ var _ = register(0x6501, "ExitRoom", func(p *AppPeer, m *Message) { var _ = register(0x6412, "GetRoomMatchEntryUserCount", func(p *AppPeer, m *Message) { r := m.Reader() roomId := r.Read16() - p.app.OnGetRoomMatchEntryUserCount(p, roomId) + aeug, titans := p.app.OnGetRoomMatchEntryUserCount(p, roomId) a := NewServerAnswer(m) w := a.Writer() w.Write16(roomId) - w.Write16(0) // うまく動かん - w.Write16(0) // うまく動かん - p.SendMessage(NewServerAnswer(m)) + w.Write16(aeug) + w.Write16(titans) + p.SendMessage(a) }) var _ = register(0x6508, "NoticeRoomBattleStart", func(p *AppPeer, m *Message) {