Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

fix: unable to log in to the game normally after version 8.x #7

Merged
merged 1 commit into from
May 21, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions answer/server_state_checker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package answer

import (
"fmt"
"github.com/ggmolly/belfast/connection"
"github.com/ggmolly/belfast/logger"
"github.com/ggmolly/belfast/orm"
"github.com/ggmolly/belfast/protobuf"
"google.golang.org/protobuf/proto"
)

func Forge_SC10019(buffer *[]byte, client *connection.Client) (int, int, error) {
response := protobuf.SC_10019{}

// Update server list
var belfastServers []orm.Server
// Decrease by 1 the state of all servers
err := orm.GormDB.Order("id asc").Find(&belfastServers).Error
if err != nil {
logger.LogEvent("Server", "SC_10019", fmt.Sprintf("failed to fetch servers: %s", err.Error()), logger.LOG_LEVEL_ERROR)
return 0, 10019, err
}
Servers = make([]*protobuf.SERVERINFO, len(belfastServers))
for i, server := range belfastServers {
Servers[i] = &protobuf.SERVERINFO{
Ids: []uint32{server.ID},
Ip: proto.String(server.IP),
Port: proto.Uint32(server.Port),
State: proto.Uint32(*server.StateID - 1), // StateID is 0-based in Azur Lane, but 1-based in the database
Name: proto.String(server.Name),
Sort: proto.Uint32(uint32(i + 1)),
}
}
response.Serverlist = Servers
logger.LogEvent("Server", "SC_10019", fmt.Sprintf("sending %d servers", len(response.Serverlist)), logger.LOG_LEVEL_WARN)
return client.SendMessage(10019, &response)
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func init() {
JP: &[]packets.PacketHandler{answer.Forge_SC10803_CN_JP_KR_TW},
KR: &[]packets.PacketHandler{answer.Forge_SC10803_CN_JP_KR_TW},
})
packets.RegisterPacketHandler(10018, []packets.PacketHandler{answer.Forge_SC10019})
packets.RegisterPacketHandler(10022, []packets.PacketHandler{answer.JoinServer})
packets.RegisterPacketHandler(10026, []packets.PacketHandler{answer.PlayerExist})
packets.RegisterPacketHandler(11001, []packets.PacketHandler{
Expand Down
141 changes: 141 additions & 0 deletions protobuf/CS_10018.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

147 changes: 147 additions & 0 deletions protobuf/SC_10019.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading