Exemplo n.º 1
0
        public override void Execute()
        {
            RelationshipManager.PlayerTeam playerTeam = RelationshipManager.ServerInstance.FindPlayersTeam(base.UserId);
            AppTeamInfo teamInfo    = ((playerTeam == null) ? AppPlayerExtensions.GetAppTeamInfo(base.Player, base.UserId) : AppPlayerExtensions.GetAppTeamInfo(playerTeam, base.UserId));
            AppResponse appResponse = Pool.Get <AppResponse>();

            appResponse.teamInfo = teamInfo;
            Send(appResponse);
        }
Exemplo n.º 2
0
        public static AppTeamInfo GetAppTeamInfo(this RelationshipManager.PlayerTeam team, ulong requesterSteamId)
        {
            AppTeamInfo appTeamInfo = Pool.Get <AppTeamInfo>();

            appTeamInfo.members = Pool.GetList <AppTeamInfo.Member>();
            BasePlayer player     = null;
            BasePlayer basePlayer = null;

            for (int i = 0; i < team.members.Count; i++)
            {
                ulong      num         = team.members[i];
                BasePlayer basePlayer2 = RelationshipManager.FindByID(num);
                if (!basePlayer2)
                {
                    basePlayer2 = null;
                }
                if (num == requesterSteamId)
                {
                    player = basePlayer2;
                }
                if (num == team.teamLeader)
                {
                    basePlayer = basePlayer2;
                }
                Vector2            vector = Util.WorldToMap(basePlayer2?.transform.position ?? Vector3.zero);
                AppTeamInfo.Member member = Pool.Get <AppTeamInfo.Member>();
                member.steamId = num;
                member.name    = basePlayer2?.displayName ?? SingletonComponent <ServerMgr> .Instance.persistance.GetPlayerName(num) ?? "";

                member.x         = vector.x;
                member.y         = vector.y;
                member.isOnline  = basePlayer2?.IsConnected ?? false;
                member.spawnTime = basePlayer2?.lifeStory?.timeBorn ?? 0;
                member.isAlive   = basePlayer2?.IsAlive() ?? false;
                member.deathTime = basePlayer2?.previousLifeStory?.timeDied ?? 0;
                appTeamInfo.members.Add(member);
            }
            appTeamInfo.leaderSteamId  = team.teamLeader;
            appTeamInfo.mapNotes       = GetMapNotes(player, true);
            appTeamInfo.leaderMapNotes = GetMapNotes((requesterSteamId != team.teamLeader) ? basePlayer : null, false);
            return(appTeamInfo);
        }
Exemplo n.º 3
0
        public static AppTeamInfo GetAppTeamInfo(this BasePlayer player, ulong steamId)
        {
            AppTeamInfo appTeamInfo = Pool.Get <AppTeamInfo>();

            appTeamInfo.members = Pool.GetList <AppTeamInfo.Member>();
            AppTeamInfo.Member member = Pool.Get <AppTeamInfo.Member>();
            if (player != null)
            {
                Vector2 vector = Util.WorldToMap(player.transform.position);
                member.steamId   = player.userID;
                member.name      = player.displayName ?? "";
                member.x         = vector.x;
                member.y         = vector.y;
                member.isOnline  = player.IsConnected;
                member.spawnTime = player.lifeStory?.timeBorn ?? 0;
                member.isAlive   = player.IsAlive();
                member.deathTime = player.previousLifeStory?.timeDied ?? 0;
            }
            else
            {
                member.steamId = steamId;
                member.name    = SingletonComponent <ServerMgr> .Instance.persistance.GetPlayerName(steamId) ?? "";

                member.x         = 0f;
                member.y         = 0f;
                member.isOnline  = false;
                member.spawnTime = 0u;
                member.isAlive   = false;
                member.deathTime = 0u;
            }
            appTeamInfo.members.Add(member);
            appTeamInfo.leaderSteamId  = 0uL;
            appTeamInfo.mapNotes       = GetMapNotes(player, true);
            appTeamInfo.leaderMapNotes = GetMapNotes(null, false);
            return(appTeamInfo);
        }