示例#1
0
文件: MsgTeam.cs 项目: Pircs/Yi
        private static void Invite(YiObj player, ref MsgTeam packet)
        {
            if (!TeamSystem.Teams.ContainsKey(player.UniqueId))
            {
                return;
            }
            if (TeamSystem.Teams[player.UniqueId].Members.ContainsKey(packet.TargetUniqueId))
            {
                return;
            }
            if (TeamSystem.Teams[player.UniqueId].Members.Count > 4)
            {
                return;
            }

            if (!GameWorld.Maps[player.MapId].Entities.TryGetValue(packet.TargetUniqueId, out var found))
            {
                return;
            }
            if (found == null)
            {
                return;
            }
            var target = found;

            (target as Player)?.Send(Invite(player));
            if (target is Bot)
            {
                TeamSystem.Join(player, target);
            }
        }
示例#2
0
文件: MsgTeam.cs 项目: Pircs/Yi
 private static void AcceptInvite(YiObj player, ref MsgTeam packet)
 {
     if (GameWorld.Maps[player.MapId].Entities.TryGetValue(packet.TargetUniqueId, out var found))
     {
         var leader = found;
         TeamSystem.Join(leader, player);
     }
 }
示例#3
0
文件: MsgTeam.cs 项目: Pircs/Yi
        public static byte[] Create(YiObj human, MsgTeamAction action)
        {
            var msg = new MsgTeam
            {
                Size = (ushort)sizeof(MsgTeam),
                Id   = 1023, Mode = action, TargetUniqueId = human.UniqueId
            };

            return(msg);
        }
示例#4
0
文件: MsgTeam.cs 项目: Pircs/Yi
        private static void CreateTeam(Player player, ref MsgTeam packet)
        {
            if (GameWorld.Maps.TryGetValue(player.MapId, out var map))
            {
                if (map.Flags.HasFlag(MapFlags.DisableTeams))
                {
                    player.GetMessage("SYSTEM", player.Name, "Team's are not allowed on this map.", MsgTextType.Action);
                    return;
                }
            }

            TeamSystem.Teams.AddOrUpdate(player.UniqueId, new TeamSystem.TeamData(player));
            player.Send(packet);
        }
示例#5
0
文件: MsgTeam.cs 项目: Pircs/Yi
 private static void DismissTeam(YiObj leader, ref MsgTeam packet)
 {
     if (packet.TargetUniqueId != leader.UniqueId)
     {
         return;
     }
     if (!TeamSystem.Teams.ContainsKey(leader.UniqueId))
     {
         return;
     }
     if (leader.UniqueId != TeamSystem.Teams[leader.UniqueId].Leader.UniqueId)
     {
         return;
     }
     TeamSystem.Disband(leader);
 }
示例#6
0
文件: MsgTeam.cs 项目: Pircs/Yi
 private static void Kick(YiObj player, ref MsgTeam packet)
 {
     if (!TeamSystem.Teams.ContainsKey(player.UniqueId))
     {
         return;
     }
     if (!TeamSystem.Teams[player.UniqueId].Members.ContainsKey(packet.TargetUniqueId))
     {
         return;
     }
     if (!TeamSystem.Teams[player.UniqueId].Members.TryGetValue(packet.TargetUniqueId, out var kick))
     {
         return;
     }
     TeamSystem.Leave(player, kick);
 }
示例#7
0
文件: MsgTeam.cs 项目: Pircs/Yi
 private static void AcceptJoin(YiObj player, ref MsgTeam packet)
 {
     if (!TeamSystem.Teams.ContainsKey(player.UniqueId))
     {
         return;
     }
     if (TeamSystem.Teams[player.UniqueId].Members.Count > 4)
     {
         return;
     }
     if (!GameWorld.Maps[player.MapId].Entities.TryGetValue(packet.TargetUniqueId, out var found))
     {
         return;
     }
     if (found == null)
     {
         return;
     }
     TeamSystem.Join(player, found);
 }
示例#8
0
文件: MsgTeam.cs 项目: Pircs/Yi
        private static void RequestJoin(YiObj player, ref MsgTeam packet)
        {
            if (GameWorld.Maps[player.MapId].Entities.TryGetValue(packet.TargetUniqueId, out var obj))
            {
                if (obj == null)
                {
                    return;
                }

                var leader = obj;
                if (!TeamSystem.Teams.ContainsKey(leader.UniqueId))
                {
                    return;
                }
                if (TeamSystem.Teams[leader.UniqueId].Members.Count > 4)
                {
                    return;
                }
                if (TeamSystem.Teams[leader.UniqueId].Locked)
                {
                    Message.SendTo(player, "TeamData currently not accepting new members.", MsgTextType.Top);
                    return;
                }
                if (leader is Bot)
                {
                    //leader.TeamData.Join(player);
                    return;
                }
                var playerLeader = leader as Player;
                if (playerLeader != null)
                {
                    packet.TargetUniqueId = player.UniqueId;
                    playerLeader.Send(packet);
                }
            }
        }