Beispiel #1
0
func handle_client_player_selection(ctx frontend.Service, client frontend.Client, m *msg.PlayerSelectionReq) {
	player, ok := ctx.Players().GetById(m.PlayerId)
	if !ok {
		client.CloseWith(&msg.PlayerSelectionErrorResp{})
		return
	}

	client.SetPlayer(player)
	client.Send(&msg.PlayerSelectionResp{player})
}
Beispiel #2
0
func handle_client_login(ctx frontend.Service, client frontend.Client, m *msg.RealmLoginReq) {
	if infos, ok := ctx.Backend().GetUserInfos(m.Ticket); ok {
		client.SetUserInfos(*infos)
		ctx.Backend().NotifyUserConnection(infos.Id, true)

		client.Send(&msg.RealmLoginSuccess{ctx.Config().CommunityId})
	} else {
		client.CloseWith(&msg.RealmLoginError{})
	}
}