public ClientInfo(string rank, TeamId team, short ribbon, int icon) { this.rank = rank; this.team = team; this.ribbon = ribbon; this.icon = icon; }
public void AppointChairman(TeamId teamId, TeamMemberId teamMemberId) { var team = _teamRepository.Get(teamId); var teamMember = _teamMemberRepository.Get(teamMemberId); var chairmanship = team.AppointChairman(teamMember); _teamChairmanshipRepository.Add(chairmanship); }
public void AppointChairman(TeamId teamId, TeamMemberId teamMemberId) { var team = _teamRepository.Get(teamId); var teamMember = _teamMemberRepository.Get(teamMemberId); Enforce.That(teamMember.IsPartOf(team.Id), Sorry.NotPartOfTheTeam); Enforce.That(teamMember.IsMemberSinceAtLeastTwoYears(), Sorry.NotMemberSinceAtLeastTwoYears); team.SetNewChairman(teamMember.Id); }
public void AppointChairman(TeamId teamId, TeamMemberId teamMemberId) { var team = _teamRepository.Get(teamId); var teamMember = _teamMemberRepository.Get(teamMemberId); teamMember.MustBePartOfTheTeam(team.Id); teamMember.MustBeAMemberForAtLeastTwoYears(); team.SetNewChairman(teamMember.Id); }
public GameObject(Map map, int id, float x, float y, int collisionRadius, int visionRadius = 0) : base(x, y) { this.map = map; this.id = id; this.target = null; this.collisionRadius = collisionRadius; this.visionRadius = visionRadius; this.team = 0; this.movementUpdated = false; this.toRemove = false; this.attackerCount = 0; this.dashing = false; this.visibleByTeam = new bool[] { false, false, false }; }
public static Team CreateTeamWithMembers(TeamId teamId, Name name, List <Guid> members) { // prepare var odataProvider = new TeamOdataProvider(); var writeRepository = new TeamWriteRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); var readRepository = new TeamReadRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), odataProvider); // create var team = new Team(teamId, name); foreach (var member in members) { team.AddMember(new Member(member)); } writeRepository.CreateAsync(team).GetAwaiter().GetResult(); // result var result = readRepository.GetAsync(teamId.GetGuid()).Result; return(result); }
protected virtual ScoreboardSummaryEntry ParseSummaryEntry(string[] dataEntries) { ScoreboardSummaryEntry summary = new ScoreboardSummaryEntry(); summary.TeamId = TeamId.Parse(dataEntries[0]); summary.Category = _categoryProvider?.GetCategory(summary.TeamId); summary.Location = dataEntries[1]; if (Utilities.TryParseEnumSpaceless <Division>(dataEntries[2], out Division division)) { summary.Division = division; } if (Enum.TryParse <Tier>(dataEntries[3]?.Trim(), true, out Tier tier)) { summary.Tier = tier; } summary.ImageCount = int.Parse(dataEntries[4]); summary.PlayTime = Utilities.ParseHourMinuteTimespan(dataEntries[5]); summary.TotalScore = int.Parse(dataEntries[7]); summary.Warnings |= dataEntries[6].Contains("T") ? ScoreWarnings.TimeOver : 0; summary.Warnings |= dataEntries[6].Contains("M") ? ScoreWarnings.MultiImage : 0; return(summary); }
/// <summary> /// Add player to the game and to his team /// </summary> /// <param name="player"></param> public void AddUnitToTeam(Unit unit, TeamId teamId) { if (teamId == TeamId.BLUE) { unit.DefineTeam(BlueTeam); BlueTeam.AddUnit(unit); } else if (teamId == TeamId.PURPLE) { unit.DefineTeam(PurpleTeam); PurpleTeam.AddUnit(unit); } else if (teamId == TeamId.NEUTRAL) { unit.DefineTeam(NeutralTeam); NeutralTeam.AddUnit(unit); } else { throw new Exception("Unknown team...(" + teamId + ")!"); } }
public void NotifyEnterVision(GameObject o, TeamId team) { var m = o as Minion; if (m != null) { var eva = new EnterVisionAgain(m); _game.PacketHandlerManager.broadcastPacketTeam(team, eva, Channel.CHL_S2C); NotifySetHealth(m); return; } var c = o as Champion; // TODO: Fix bug where enemy champion is not visible to user when vision is acquired until the enemy champion moves if (c != null) { var eva = new EnterVisionAgain(c); _game.PacketHandlerManager.broadcastPacketTeam(team, eva, Channel.CHL_S2C); NotifySetHealth(c); } }
protected override void ParseDetailedSummaryEntry(ScoreboardDetails details, string[] dataEntries) { var summary = new ScoreboardSummaryEntry(); details.Summary = summary; // ID, Division (labeled location, their bug), Location (labeled division, their bug), tier, scored img, play time, score time, current score, warn summary.TeamId = TeamId.Parse(dataEntries[0]); summary.Category = _categoryProvider?.GetCategory(summary.TeamId); if (Utilities.TryParseEnumSpaceless <Division>(dataEntries[1], out Division division)) { summary.Division = division; } summary.Location = dataEntries[2]; if (Enum.TryParse <Tier>(dataEntries[3], true, out Tier tier)) { summary.Tier = tier; } summary.ImageCount = int.Parse(dataEntries[4].Trim()); summary.PlayTime = Utilities.ParseHourMinuteTimespan(dataEntries[5]); string scoreTimeText = dataEntries[6]; // to deal with legacy scoreboards int scoreTimeIndOffset = 0; if (scoreTimeText.Contains(":")) { details.ScoreTime = Utilities.ParseHourMinuteTimespan(dataEntries[6]); } else { details.ScoreTime = summary.PlayTime; scoreTimeIndOffset = -1; } summary.TotalScore = int.Parse(dataEntries[7 + scoreTimeIndOffset].Trim()); string warnStr = dataEntries[8 + scoreTimeIndOffset]; summary.Warnings |= warnStr.Contains("T") ? ScoreWarnings.TimeOver : 0; summary.Warnings |= warnStr.Contains("M") ? ScoreWarnings.MultiImage : 0; }
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { // assumes we're performing a supported conversion: string parse or team # => TeamId; or teamId => string if (value == null) { throw new ArgumentNullException(nameof(value)); } switch (value) { case string s: if (TeamId.TryParse(s, out TeamId val)) { return(val); } else if (s.Length == DefaultCompetitionNumericIdLength && int.TryParse(s, out int teamNumber)) { // ctor does bounds checking return(new TeamId(DefaultCompetition, teamNumber)); } break; case short tempShort: // ctor does bounds checking return(new TeamId(DefaultCompetition, tempShort)); case int i: // ctor does bounds checking return(new TeamId(DefaultCompetition, i)); case TeamId t: return(t.ToString()); } throw new NotSupportedException("The specified conversion is not supported."); }
public string GetMinionModel(TeamId team, MinionSpawnType type) { var teamDictionary = new Dictionary <TeamId, string> { { TeamId.TEAM_BLUE, "Blue" }, { TeamId.TEAM_PURPLE, "Red" } }; var typeDictionary = new Dictionary <MinionSpawnType, string> { { MinionSpawnType.MINION_TYPE_MELEE, "Basic" }, { MinionSpawnType.MINION_TYPE_CASTER, "Wizard" }, { MinionSpawnType.MINION_TYPE_CANNON, "MechCannon" }, { MinionSpawnType.MINION_TYPE_SUPER, "MechMelee" } }; if (!teamDictionary.ContainsKey(team) || !typeDictionary.ContainsKey(type)) { return(string.Empty); } return($"{teamDictionary[team]}_Minion_{typeDictionary[type]}"); }
/// <summary> /// Change captain for existing team. /// </summary> /// <param name="team">team for editing.</param> /// <param name="captainId">Player who should become captain.</param> public void ChangeCaptain(TeamId team, PlayerId captainId) { _authService.CheckAccess(AuthOperations.Teams.Edit); var teamToEdit = Get(team.Id); if (teamToEdit == null) { throw new MissingEntityException(ServiceResources.ExceptionMessages.TeamNotFound, team.Id); } var captainTeamId = _getPlayerTeamQuery.Execute(new FindByPlayerCriteria { Id = captainId.Id }); if (captainTeamId == teamToEdit.Id || captainTeamId == 0) { teamToEdit.SetCaptain(captainId); _teamRepository.Update(teamToEdit); } else { throw new ValidationException(ServiceResources.ExceptionMessages.PlayerIsPlayerOfAnotherTeam); } }
public override int GetHashCode() { int hash = 1; if (TeamId.Length != 0) { hash ^= TeamId.GetHashCode(); } if (LeaderId.Length != 0) { hash ^= LeaderId.GetHashCode(); } hash ^= members_.GetHashCode(); if (Status != 0) { hash ^= Status.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// When invited to a team /// </summary> public TeamQueuePage(string Invid, LobbyStatus NewLobby = null, bool IsReturningToLobby = false, TeamId SelectedTeam = null, string BotDifficulty = null) { InitializeComponent(); Client.InviteListView = InviteListView; Client.RiotConnection.MessageReceived += Update_OnMessageReceived; //MainWindow Window = new MainWindow(); //Window.Hide(); //Opps Invite = Invid; CurrentLobby = NewLobby; selectedTeamId = SelectedTeam; botDifficulty = BotDifficulty; if (!IsReturningToLobby) { LoadStats(); } Client.CurrentPage = this; Client.ReturnButton.Visibility = Visibility.Visible; Client.ReturnButton.Content = "Return to Lobby"; }
public async Task <IEnumerable <Team> > ListAsync(string filter, int?skip, int?limit) { var filterDefinition = _teamOdataProvider.GetFilterDefinition(filter); IFindFluent <TeamClass, TeamClass> fluent = _collection.Find(filterDefinition); fluent = fluent.Skip(skip).Limit(limit); var teamClasses = await fluent.ToListAsync(); var result = new List <Team>(); foreach (var teamClass in teamClasses) { var team = new Team(TeamId.With(teamClass.Id), new Name(teamClass.Name)); team.SetImage(teamClass.Image); team.SetDescription((Description)teamClass.Description); team.SetImage(teamClass.Image); Layout layout = null; if (teamClass.Layout != null) { layout = new Layout(teamClass.Layout.Id); } team.SetLayout(layout); team.SetFilterContent(teamClass.FilterContent); foreach (var member in teamClass.Members) { team.AddMember(new Member(member.Id)); } team.SetVersion(teamClass.Version); result.Add(team); } return(result); }
public async Task InitializeAsync(IServiceProvider provider) { _allServiceCategoryMap = new Dictionary <TeamId, ServiceCategory?>(); string allServiceCategoryMapFile = provider.GetRequiredService <IConfiguration>().GetValue <string>("allServiceCategoryMapFile", null); if (!string.IsNullOrWhiteSpace(allServiceCategoryMapFile) && File.Exists(allServiceCategoryMapFile)) { foreach (var line in await File.ReadAllLinesAsync(allServiceCategoryMapFile).ConfigureAwait(false)) { try { string[] components = line.Split(new[] { ':' }, 2); if (CyberPatriot.Models.Serialization.ServiceCategoryExtensions.TryParseAliasName(components[1].Trim(), out ServiceCategory value)) { _allServiceCategoryMap[TeamId.Parse(components[0].Trim())] = value; } } catch { // oh well } } } }
public static void Log(string matchId, EventType eventOccurred, TeamId teamIndex, String team1 = null, String team2 = null, int?playerId = null) { var matchEvent = EventBuilder.New(matchId, eventOccurred, teamIndex, team1, team2, playerId); EventRepository.Store(matchEvent); // Sync up with read model // 1: read all events // 2: play all events using Match class // 3: save state to relational DB for reads/live var match = Replay(matchId); MatchSynchronizer.Save(match); // or // 1: do nothing here // 2: expect a scheduled job do previous sync steps // or // 1: do nothing here // 2: expect read stack replays events via Match class when requested }
public void NotifyDebugMessage(TeamId team, string message) { var dm = new DebugMessage(message); _packetHandlerManager.BroadcastPacketTeam(team, dm, Channel.CHL_S2C); }
public void NotifyTint(TeamId team, bool enable, float speed, GameServerCore.Content.Color color) { var tint = new SetScreenTint(team, enable, speed, color.R, color.G, color.B, color.A); _packetHandlerManager.BroadcastPacket(tint, Channel.CHL_S2C); }
public bool teamHasVisionOn(TeamId team, GameObject o) { if (o == null) return false; if (o.getTeam() == team) return true; lock (objects) { foreach (var kv in objects) { if (kv.Value.getTeam() == team || (kv.Value.distanceWith(o) < kv.Value.getVisionRadius() && !mesh.isAnythingBetween(kv.Value, o))) { var unit = kv.Value as Unit; if (unit == null || unit.isDead()) continue; return true; } } } return false; }
public void NotifySetTeam(IAttackableUnit unit, TeamId team) { var p = new SetTeam(unit, team); _packetHandlerManager.BroadcastPacket(p, Channel.CHL_S2C); }
public static bool InGoalArea(TeamId team, Point position, Point boardSize, int goalAreaSize) { return(team == TeamId.Red ? position.Y >= boardSize.Y - goalAreaSize : position.Y < goalAreaSize); }
public LeaveVisionResponse(IGameObject o, TeamId team) { Obj = o; Team = team; }
public bool broadcastPacketTeam(TeamId team, LeagueSandbox.GameServer.Logic.Packets.Packet packet, Channel channelNo, PacketFlags flag = PacketFlags.Reliable) { return(broadcastPacketTeam(team, packet.GetBytes(), channelNo, flag)); }
public Team(TeamId teamId) { _teamId = teamId; _memberIds = new List <TeamMemberId>(); }
public Team(TeamId teamId) { _teamId = teamId; _memberIds = new List<TeamMemberId>(); }
public Team(TeamId teamId) { _teamId = teamId; }
public static void notifyMinionSpawned(Minion m, TeamId team) { var ms = new MinionSpawn(m); PacketHandlerManager.getInstace().broadcastPacketTeam(team, ms, Channel.CHL_S2C); notifySetHealth(m); }
public void MustBePartOfTheTeam(TeamId id) { Enforce.That(IsPartOf(id), Sorry.NotPartOfTheTeam); }
public static void notifyChampionSpawned(Champion c, TeamId team) { var hs = new HeroSpawn2(c); PacketHandlerManager.getInstace().broadcastPacketTeam(team, hs, Channel.CHL_S2C); }
public bool IsVisibleByTeam(TeamId team) { return(team == Team || _visibleByTeam[team]); }
public TeamMember(TeamId teamId, TeamMemberId teamMemberId, DateTime joinDate) { _teamId = teamId; _teamMemberId = teamMemberId; _joinDate = joinDate; }
public static void notifyEnterVision(GameObject o, TeamId team) { var m = o as Minion; if (m != null) { var eva = new EnterVisionAgain(m); PacketHandlerManager.getInstace().broadcastPacketTeam(team, eva, Channel.CHL_S2C); notifySetHealth(m); return; } var c = o as Champion; // TODO: Fix bug where enemy champion is not visible to user when vision is acquired until the enemy champion moves if (c != null) { var eva = new EnterVisionAgain(c); PacketHandlerManager.getInstace().broadcastPacketTeam(team, eva, Channel.CHL_S2C); notifySetHealth(c); return; } }
public Team Get(TeamId id) { return _storage[id]; }
public TeamChairmanship(TeamId teamId, TeamMemberId teamMemberId, DateTime starting) { _teamId = teamId; _teamMemberId = teamMemberId; _starting = starting; }
public bool broadcastPacketTeam(TeamId team, IntWarsSharp.Logic.Packets.Packet packet, Channel channelNo, PacketFlags flag = PacketFlags.Reliable) { return broadcastPacketTeam(team, packet.GetBytes(), channelNo, flag); }
public SetTeam(IAttackableUnit unit, TeamId team) : base(PacketCmd.PKT_S2C_SET_TEAM) { WriteNetId(unit); Write((int)team); }
protected bool Equals(TeamId other) { return _value == other._value; }
public SurrenderResponse(IChampion starter, byte flag, byte yesVotes, byte noVotes, byte maxVotes, TeamId team, float timeOut) { Starter = starter; Flag = flag; YesVotes = yesVotes; NoVotes = noVotes; MaxVotes = maxVotes; Team = team; TimeOut = timeOut; }
public Team(TeamId teamId) { _id = teamId; }
public bool isVisibleByTeam(TeamId team) { return (team == getTeam() || visibleByTeam[Convert.fromTeamId(team)]); }
public void NotifySurrender(IChampion starter, byte flag, byte yesVotes, byte noVotes, byte maxVotes, TeamId team, float timeOut) { var surrender = new Surrender(starter, flag, yesVotes, noVotes, maxVotes, team, timeOut); _packetHandlerManager.BroadcastPacketTeam(team, surrender, Channel.CHL_S2C); }
/** * Sets the team of the object * @param team the new team */ public void setTeam(TeamId team) { this.team = team; visibleByTeam[Convert.fromTeamId(team)] = true; }
public void NotifyChampionSpawned(IChampion c, TeamId team) { var hs = new HeroSpawn2(c); _packetHandlerManager.BroadcastPacketTeam(team, hs, Channel.CHL_S2C); }
public Team(string name, TeamId id, BitmapImage avatar, BitmapImage background, List<Point> path) { Name = name; Id = id; Avatar = avatar; Background = background; Path = path; CurrentPositionIndex = 0; IsHardQuestion = false; }
public Dictionary<int, Unit> getVisionUnits(TeamId team) { return visionUnits[Convert.fromTeamId(team)]; }
public Team(string name, TeamId id, string avatar, string background, string gameBoard, List<Point> path) { Name = name; Id = id; Avatar = avatar; Background = background; GameBoard = gameBoard; Path = path; CurrentPositionIndex = 0; IsHardQuestion = false; }
public void SetVisibleByTeam(TeamId team, bool visible) { _visibleByTeam[team] = visible; }
public static void notifyLeaveVision(GameObject o, TeamId team) { var lv = new LeaveVision(o); PacketHandlerManager.getInstace().broadcastPacketTeam(team, lv, Channel.CHL_S2C); // Not exactly sure what this is yet var c = o as Champion; if (o == null) { var deleteObj = new DeleteObjectFromVision(o); PacketHandlerManager.getInstace().broadcastPacketTeam(team, deleteObj, Channel.CHL_S2C); } }
public EndGamePayload(TeamId winner) { Winner = winner; }
internal void GuardAppointmentAsChairman(TeamId teamId) { Enforce.That(IsPartOf(teamId), Sorry.NotPartOfTheTeam); Enforce.That(IsMemberSinceAtLeastTwoYears(), Sorry.NotMemberSinceAtLeastTwoYears); }
static void Main(string[] args) { string jsonPath; if (args.Length < 1) { Console.Error.WriteLine("Enter path to JSON file:"); jsonPath = Console.ReadLine(); } else { jsonPath = args[0]; } Console.Error.WriteLine($"Got {jsonPath} as JSON path"); string categoryPath; if (args.Length < 2) { Console.Error.WriteLine("Enter path to category map file:"); categoryPath = Console.ReadLine(); } else { categoryPath = args[1]; } Console.Error.WriteLine($"Got {categoryPath} as category mapfile path"); var input = JsonConvert.DeserializeObject <Output>(File.ReadAllText(jsonPath)); var teamCategoryDictionary = File.ReadAllLines(categoryPath).Select(l => l.Trim().Split(new[] { ':' }, 2)).Where(l => TeamId.TryParse(l[0], out TeamId _)).ToDictionary(l => TeamId.Parse(l[0]), l => ServiceCategoryExtensions.ParseCanonicalName(l[1])); // fix summary data foreach (var teamSummary in input.summary.TeamList) { if (teamSummary.Category == null && teamCategoryDictionary.TryGetValue(teamSummary.TeamId, out ServiceCategory newCategory)) { teamSummary.Category = newCategory; } } // fix details foreach (var knownCategory in teamCategoryDictionary) { if (input.teams.TryGetValue(knownCategory.Key, out var teamDetails) && teamDetails.Summary.Category == null) { teamDetails.Summary.Category = knownCategory.Value; } } Console.Write(JsonConvert.SerializeObject(input)); }
bool IsPartOf(TeamId teamId) { return _teamId.Equals(teamId); }
public bool broadcastPacketTeam(TeamId team, byte[] data, Channel channelNo, PacketFlags flag = PacketFlags.Reliable) { foreach (var ci in game.getPlayers()) if (ci.Item2.getPeer() != null && ci.Item2.getTeam() == team) sendPacket(ci.Item2.getPeer(), data, channelNo, flag); return true; }