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); } }
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); } }
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); }
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); }
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); }
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); }
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); }
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); } } }