public Reputation(ReputationRecord record, Faction faction, int defaultValue, ReputationFlags defaultFlags) { m_record = record; m_record.ReputationIndex = faction.ReputationIndex; m_record.Value = defaultValue; m_record.Flags = defaultFlags; Faction = faction; m_standing = GetStanding(defaultValue); RealmWorldDBMgr.DatabaseProvider.SaveOrUpdate(m_record); }
public Reputation(ReputationRecord record, Faction faction, int defaultValue, ReputationFlags defaultFlags) { m_record = record; m_record.ReputationIndex = faction.ReputationIndex; m_record.Value = defaultValue; m_record.Flags = defaultFlags; Faction = faction; m_standing = GetStanding(defaultValue); m_record.Save(); }
/// <summary> /// Handles the DrawItem event of the lbStandings control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.DrawItemEventArgs"/> instance containing the event data.</param> private void lbStandings_DrawItem(object sender, DrawItemEventArgs e) { if (e.Index < 0 || e.Index >= lbStandings.Items.Count) { return; } object item = lbStandings.Items[e.Index]; Standing standing = item as Standing; if (standing != null) { DrawItem(standing, e); } else { DrawItem((string)item, e); } }
private void CalculateTotalPoints(Standing standing) { List <double> points = new List <double>(); if (standing.DGT1Points != null) { points.Add(standing.DGT1Points); } if (standing.DGT2Points != null) { points.Add(standing.DGT2Points); } if (standing.DGT3Points != null) { points.Add(standing.DGT3Points); } if (standing.DGT4Points != null) { points.Add(standing.DGT4Points); } if (standing.DGT5Points != null) { points.Add(standing.DGT5Points); } double min = 0.0; if (points.Count > 4) { min = 100.0; foreach (var p in points) { if (p < min) { min = p; } } } double totalPoints = points.Sum() - min; standing.TotalPoints = totalPoints; }
public ActionResult Standing() { List <Standing> model = new List <Standing>(); Standing st; List <Team> Teams = db.Teams.ToList(); List <Record> Records = db.Records.ToList(); foreach (Team tr in db.Teams) { st = new Standing(); st.Name = tr.Name; st.TeamRecord = Records.Find(o => o.TeamID == tr.ID); model.Add(st); } var s = model.OrderByDescending(o => o.TeamRecord.Win); return(View(s.ToList())); }
private void UpdatePlacePoints(Standing standing, Result result, IQueryable <Competition> competitions) { int i = 0; foreach (var c in competitions.OrderBy(c => c.Date)) { i++; if (c == result.Competition) { break; } } switch (i) { case 1: standing.DGT1Place = result.Place; standing.DGT1Points = result.Points; break; case 2: standing.DGT2Place = result.Place; standing.DGT2Points = result.Points; break; case 3: standing.DGT3Place = result.Place; standing.DGT3Points = result.Points; break; case 4: standing.DGT4Place = result.Place; standing.DGT4Points = result.Points; break; case 5: standing.DGT5Place = result.Place; standing.DGT5Points = result.Points; break; } }
internal IEnumerable <Standing> GetStandings(IEnumerable <Teams> allTeams, IEnumerable <Matches> allMatches) { List <Standing> standingsList = new List <Standing>(); var competititionNamesArray = new string[] { "Betri deildin", "1. deild", "Betri deildin kvinnur", "2. deild" }; foreach (string competititionName in competititionNamesArray) { Standing standing = new Standing() { StandingCompetitionName = competititionName, TeamStandings = GetStandings(competititionName, allTeams, allMatches) }; foreach (TeamStanding teamStanding in standing.TeamStandings) { teamStanding.Position = standing.TeamStandings.ToList().IndexOf(teamStanding) + 1; teamStanding.PositionColor = GetPositionColor(teamStanding); } standingsList.Add(standing); } return(standingsList); }
public async Task <List <Standing> > GetOverallStandings() { var array = await GetLeaderboardArrayFromApi(GameType.Overall); List <Standing> standings = new List <Standing>(); foreach (var item in array) { var standing = new Standing { Ranking = item.Value["ranking"].AsInt, PlayerId = item.Value["gamerGuid"], PlayerName = item.Value["gamerNickname"], Points = item.Value["points"].AsFloat }; standings.Add(standing); } return(standings); }
public async Task <ActionResult <Standing> > PostStanding(Standing standing) { _context.Standings.Add(standing); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (StandingExists(standing.RaceId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetStanding", new { id = standing.RaceId }, standing)); }
void Update() { if (Input.GetButton("Horizontal") || Input.GetButton("Vertical")) { Moving.Invoke(); rb.transform.Translate(new Vector2((Input.GetAxisRaw("Horizontal") * speed) * Time.deltaTime, (Input.GetAxisRaw("Vertical") * speed) * Time.deltaTime)); } else { Standing.Invoke(); } fireTimer += Time.deltaTime; AnimateReady(fireTimer >= fireRate); if (Input.GetButton("Fire1") && fireTimer >= fireRate) { fireTimer = 0.0f; Instantiate(projectile, transform.position, transform.rotation); } }
public Standing(Standing other) { this.id = other.id; this.entry_name = other.entry_name; this.player_name = other.player_name; this.movement = other.movement; this.own_entry = other.own_entry; this.rank = other.rank; this.last_rank = other.last_rank; this.rank_sort = other.rank_sort; this.total = other.total; this.matches_played = other.matches_played; this.matches_won = other.matches_won; this.matches_drawn = other.matches_drawn; this.matches_lost = other.matches_lost; this.points_for = other.points_for; this.points_against = other.points_against; this.points_total = other.points_total; this.division = other.division; this.entry = other.entry; }
public void TestGenerateMatchWhitValidTournament() { // Arrange var tournament = new TournamentBuilder().Build(); var standing = new Standing(tournament); var firstMovie = tournament.Movies.First(); var lastMovie = tournament.Movies.First(); var expected = standing.GetWinnerMatch(firstMovie, lastMovie); // Act var result = standing.GenerateMatch(firstMovie, lastMovie); // Assert standing.Rankings.Count() .Should().Be(tournament.Movies.Count()); standing.Rankings .FirstOrDefault(r => r.Movie.Id == expected.Id) .Score.Should().Be(1); result.Should().BeEquivalentTo(expected); }
public Standing GetBestCurrentForm(List <Standing> teams) { var bestTeam = new Standing(); var bestForm = 0; foreach (var team in teams) { var leagueId = new LeagueEndpoint().GetLeagueByName(team.Group).LeagueId; var formScore = this.GetTeamForm(team.TeamName, leagueId); // It might be the case that two teams have the same score // Need to verify how to choose the best form in this case if (formScore > bestForm) { bestForm = formScore; bestTeam = team; } } return(bestTeam); }
/// <summary> /// Wait for player to spawn /// </summary> /// <returns></returns> private IEnumerator WaitForSpawn() { while (!GameObject.Find("CustomMap_SpawnPoint")) { yield return(new WaitForEndOfFrame()); } VehicleManager vehicleManager = UnityEngine.Object.FindObjectOfType <VehicleManager>(); Standing stand = _parent.GetComponent <Standing>(); vehicleManager.GetSessionMarker().SetMarker(GameObject.Find("CustomMap_SpawnPoint").transform); yield return(new WaitForSeconds(1f)); vehicleManager.GetSessionMarker().ResetPlayerAtMarker(); UnityEngine.Object.Destroy(GameObject.Find("CustomMap_SpawnPoint")); _async.allowSceneActivation = true; vehicleManager.timeSinceLastTransition = 0f; stand.Start(); yield break; }
public void Execute(Player player) { Rigidbody rb = player.GetComponent <Rigidbody>(); rb.velocity = new Vector3(player.speed, 0, 0); // Put all key checks into State functions - this gets run every frame the state is active - no need for switch if (Input.GetKeyUp(KeyCode.W)) { Standing standing = new Standing(); standing.Enter(player); } if (Input.GetKeyDown(KeyCode.Space)) { LongJump lJump = new LongJump(); lJump.Enter(player); } if (Input.GetKeyDown(KeyCode.S)) { Sliding slide = new Sliding(); slide.Enter(player); } }
/// <summary> /// Process Student average and check Graduation /// </summary> /// <param name="average"> Average Course Mark</param> /// <returns>IsGraduated and Standings</returns> private Tuple <bool, Standing> CheckGraduation(int average) { Standing standing = Standing.None; if (average < 50) { standing = Standing.Remedial; } else if (average < 70) { standing = Standing.Average; } else if (average < 90) { standing = Standing.MagnaCumLaude; } else { standing = Standing.SumaCumLaude; } switch (standing) { case Standing.Remedial: return(new Tuple <bool, Standing>(false, standing)); case Standing.Average: return(new Tuple <bool, Standing>(true, standing)); case Standing.SumaCumLaude: return(new Tuple <bool, Standing>(true, standing)); case Standing.MagnaCumLaude: return(new Tuple <bool, Standing>(true, standing)); default: return(new Tuple <bool, Standing>(false, standing)); } }
public void AddStandings(int leagueId) { var url = $"https://allsportsapi.com/api/football/?&met=Standings&leagueId={leagueId}&APIkey={apikey}"; var json = new WebClient().DownloadString(url); var result = JsonConvert.DeserializeObject <Root>(json); foreach (var jsonStanding in result.result.total) { Standing standing = Mapper.Map <Standing>(jsonStanding); Team team = _context.Teams.FirstOrDefault(t => t.TeamKey.ToString() == jsonStanding.team_key); if (team == null) { AddTeams(int.Parse(jsonStanding.league_key)); } standing.Team = team; standing.League = _context.Leagues.FirstOrDefault(t => t.LeagueID.ToString() == jsonStanding.league_key); Standing standingDB = _context.Standings.FirstOrDefault(s => s.TeamKey == standing.TeamKey); if (standingDB == null) { _context.Standings.Add(standing); } else { if (!Equals(standing, standingDB)) { standing.ID = standingDB.ID; standing.LeagueId = standingDB.LeagueId; standing.TeamID = standingDB.TeamID; _context.Entry(standingDB).CurrentValues.SetValues(standing); } } } _context.SaveChanges(); }
/// <summary> /// Draws the list item for the given standing /// </summary> /// <param name="contact"></param> /// <param name="e"></param> private void DrawItem(Contact contact, DrawItemEventArgs e) { Graphics g = e.Graphics; // Draw background g.FillRectangle(e.Index % 2 == 0 ? Brushes.White : Brushes.LightGray, e.Bounds); // Measure and draw contact name Size contactTextSize = TextRenderer.MeasureText(g, contact.Name, m_contactsBoldFont, Size.Empty, Format); TextRenderer.DrawText(g, contact.Name, m_contactsBoldFont, new Rectangle( e.Bounds.Left + contact.EntityImage.Width + 4, e.Bounds.Top + (contact.Group == ContactGroup.Agent ? PadTop : (e.Bounds.Height - contactTextSize.Height) / 2), contactTextSize.Width + PadLeft, contactTextSize.Height), Color.Black); // Draw text for agents if (contact.Group == ContactGroup.Agent) { Agent agent = StaticGeography.GetAgentByName(contact.Name); if (agent != null) { Station agentStation = agent.Station; string agentLocationText = agentStation != null ? agentStation.Name : agent.Station.Name; // Determine the agent level and division string agentLevelText = (agent.AgentType != AgentType.BasicAgent && agent.AgentType != AgentType.ResearchAgent) ? agent.AgentType. GetDescription() : $"Level {Skill.GetRomanFromInt(agent.Level)}"; string agentLevelDivisionText = $"( {agentLevelText} - {agent.Division} )"; // Calculate text size Size agentLocationTextSize = TextRenderer.MeasureText(g, agentLocationText, m_contactsFont, Size.Empty, Format); Size agentLevelDivisionTextSize = TextRenderer.MeasureText(g, agentLevelDivisionText, m_contactsFont, Size.Empty, Format); // Draw agent level and division text TextRenderer.DrawText(g, agentLevelDivisionText, m_contactsFont, new Rectangle(e.Bounds.Left + contact.EntityImage.Width + 4 + contactTextSize.Width + PadRight, e.Bounds.Top + PadTop, agentLevelDivisionTextSize.Width + PadLeft, agentLevelDivisionTextSize.Height), Color.Black, Format); // Draw agent location TextRenderer.DrawText(g, agentLocationText, m_contactsFont, new Rectangle( e.Bounds.Left + contact.EntityImage.Width + 4, e.Bounds.Top + PadTop + agentLevelDivisionTextSize.Height, agentLocationTextSize.Width + PadLeft, agentLocationTextSize.Height), Color.Black); } } else if (Settings.UI.SafeForWork) { string contactStandingStatusText = $"({Standing.Status(contact.Standing)})"; // Measure and draw standing text Size contactStandingStatusTextSize = TextRenderer.MeasureText(g, contactStandingStatusText, m_contactsFont, Size.Empty, Format); TextRenderer.DrawText(g, contactStandingStatusText, m_contactsFont, new Rectangle(e.Bounds.Left + contact.EntityImage.Width + 4 + contactTextSize.Width + PadRight, e.Bounds.Top + (e.Bounds.Height - contactStandingStatusTextSize.Height) / 2, contactStandingStatusTextSize. Width + PadLeft, contactStandingStatusTextSize.Height), Color.Black); // Draw watchlist text if (contact.IsInWatchlist) { const string ContactInWatchListText = " - Watching"; Size contactInWatchListTextSize = TextRenderer.MeasureText(g, ContactInWatchListText, m_contactsFont, Size.Empty, Format); TextRenderer.DrawText(g, ContactInWatchListText, m_contactsFont, new Rectangle(e.Bounds.Left + contact.EntityImage.Width + 4 + contactTextSize.Width + contactStandingStatusTextSize.Width + PadRight, e.Bounds.Top + (e.Bounds.Height - contactStandingStatusTextSize.Height) / 2, contactInWatchListTextSize.Width + PadLeft, contactInWatchListTextSize.Height), Color.Black); } } else { // Draw standing image Image standingImage = Standing.GetStandingImage((int)contact.Standing); g.DrawImage(standingImage, new Rectangle(e.Bounds.Left + contact.EntityImage. Width + 4 + contactTextSize.Width + PadRight * 2, e.Bounds.Top + (e.Bounds. Height - standingImage.Size.Height) / 2, standingImage.Width, standingImage.Height)); // Draw watchlist image if (contact.IsInWatchlist) { g.DrawImage(Resources.Watch, new Rectangle(e.Bounds.Left + contact. EntityImage.Width + 4 + contactTextSize.Width + standingImage.Width + PadRight * 3, e.Bounds.Top + (e.Bounds.Height - Resources.Watch. Height) / 2, Resources.Watch.Width, Resources.Watch.Height)); } } // Draw images if (!Settings.UI.SafeForWork) { g.DrawImage(contact.EntityImage, new Rectangle(e.Bounds.Left + PadLeft / 2, ContactDetailHeight / 2 - contact.EntityImage.Height / 2 + e.Bounds.Top, contact.EntityImage.Width, contact.EntityImage.Height)); } }
/// <summary> /// Updates the content. /// </summary> internal void UpdateContent() { // Returns if not visible if (!Visible) { return; } // When no character, we just hide the list if (Character == null) { noContactsLabel.Visible = true; lbContacts.Visible = false; return; } int scrollBarPosition = lbContacts.TopIndex; // Update the standings list lbContacts.BeginUpdate(); try { IList <Contact> contacts = Character.Contacts.ToList(); if (!ShowAllContacts && !ShowContactsInWatchList) { contacts = contacts.Where(contact => Standing.Status(contact.Standing) == ShowContactsWithStandings).ToList(); } if (ShowContactsInWatchList) { contacts = contacts.Where(contact => contact.IsInWatchlist).ToList(); } IEnumerable <IGrouping <ContactGroup, Contact> > groups = contacts.GroupBy(x => x.Group).OrderBy(x => (int)x.Key); // Scroll through groups lbContacts.Items.Clear(); foreach (IGrouping <ContactGroup, Contact> group in groups) { string groupHeaderText = $"{@group.Key.GetDescription()} ({@group.Count()})"; lbContacts.Items.Add(groupHeaderText); // Add items in the group when it's not collapsed if (m_collapsedGroups.Contains(groupHeaderText)) { continue; } foreach (Contact contact in group.OrderBy(contact => contact.Name)) { contact.ContactImageUpdated += contact_ContactImageUpdated; lbContacts.Items.Add(contact); } } // Display or hide the "no contacts" label. noContactsLabel.Visible = !contacts.Any(); lbContacts.Visible = contacts.Any(); // Invalidate display lbContacts.Invalidate(); } finally { lbContacts.EndUpdate(); lbContacts.TopIndex = scrollBarPosition; } }
public override void Parse(EveNotification notification, KeyValuePair <YamlNode, YamlNode> pair, IDictionary <string, string> parsedDict) { switch (pair.Key.ToString().ToUpperInvariant()) { case "CHARID": case "SENDERCHARID": case "RECEIVERCHARID": case "OWNERID": case "LOCATIONOWNERID": case "DESTROYERID": case "INVOKINGCHARID": case "CORPID": case "PODKILLERID": case "NEWCEOID": case "OLDCEOID": { parsedDict[pair.Key.ToString()] = EveIDToName.GetIDToName(pair.Value.ToString()); break; } case "CLONESTATIONID": case "CORPSTATIONID": case "LOCATIONID": { parsedDict[pair.Key.ToString()] = Station.GetByID(int.Parse(pair.Value.ToString())).Name; break; } case "SHIPTYPEID": case "TYPEID": { parsedDict[pair.Key.ToString()] = StaticItems.GetItemByID(int.Parse(pair.Value.ToString())).Name; break; } case "MEDALID": { var medal = notification.CCPCharacter.CharacterMedals .FirstOrDefault(x => x.ID.ToString() == pair.Value.ToString()); parsedDict[pair.Key.ToString()] = medal == null ? EveMonConstants.UnknownText : medal.Title ?? EveMonConstants.UnknownText; parsedDict.Add("medalDescription", medal == null ? EveMonConstants.UnknownText : medal.Description ?? EveMonConstants.UnknownText); break; } case "ENDDATE": case "STARTDATE": { parsedDict[pair.Key.ToString()] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", long.Parse(pair.Value.ToString()) .WinTimeStampToDateTime()); break; } case "NOTIFICATION_CREATED": { parsedDict[pair.Key.ToString()] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy} (EVE Time)", long.Parse(pair.Value.ToString()) .WinTimeStampToDateTime()); break; } case "TYPEIDS": { YamlSequenceNode typeIDs = pair.Value as YamlSequenceNode; if (typeIDs == null) { break; } switch (notification.TypeID) { case 56: case 57: { if (!typeIDs.Any()) { parsedDict[pair.Key.ToString()] = "None were in the clone"; } else { StringBuilder sb = new StringBuilder(); foreach (var typeID in typeIDs) { sb .AppendLine() .AppendLine($"Type: {StaticItems.GetItemByID(int.Parse(typeID.ToString())).Name}"); } parsedDict[pair.Key.ToString()] = sb.ToString(); } } break; } break; } case "ISHOUSEWARMINGGIFT": { if (!Convert.ToBoolean(pair.Value)) { break; } switch (notification.TypeID) { case 34: // Tritanium parsedDict[pair.Key.ToString()] = StaticItems.GetItemByID(34).Name; break; } break; } case "LEVEL": { parsedDict[pair.Key.ToString()] = $"{Standing.Status(double.Parse(pair.Value.ToString()))} Standing"; break; } } }
/// <summary> /// Loads an existing Reputation from the given Record. /// </summary> public Reputation(ReputationRecord record, Faction faction) { m_record = record; Faction = faction; m_standing = GetStanding(record.Value); }
/// <summary> /// Parses the notification text. /// </summary> /// <param name="notification">The notification.</param> /// <param name="pair">The pair.</param> /// <param name="parsedDict">The parsed dictionary.</param> public override void Parse(EveNotification notification, KeyValuePair <YamlNode, YamlNode> pair, IDictionary <string, string> parsedDict) { string key = pair.Key.ToString(), value = pair.Value.ToString(); long valueAsLong; decimal amount; double valueAsDouble; int typeID = notification.TypeID; DateTime timestamp = notification.SentDate; YamlSequenceNode typeIDs; // The value is often used as an int64 in the list below, simplify calculation if (!value.TryParseInv(out valueAsLong)) { valueAsLong = 0L; } switch (key.ToUpperInvariant()) { case "CHARID": case "SENDERCHARID": case "RECEIVERCHARID": case "OWNERID": case "LOCATIONOWNERID": case "DESTROYERID": case "INVOKINGCHARID": case "PODKILLERID": case "NEWCEOID": case "OLDCEOID": case "CORPID": case "VICTIMID": case "DECLAREDBYID": case "AGAINSTID": case "CREDITORID": case "FACTIONID": case "DEFENDERID": case "ENEMYID": case "AGGRESSORID": case "ALLYID": case "MERCID": case "AGGRESSORCORPID": case "AGGRESSORALLIANCEID": parsedDict[key] = EveIDToName.GetIDToName(valueAsLong); break; case "CLONESTATIONID": case "CORPSTATIONID": case "LOCATIONID": case "STRUCTUREID": case "EXTERNALID2": parsedDict[key] = EveIDToStation.GetIDToStation(valueAsLong)?.Name ?? EveMonConstants.UnknownText; break; case "SOLARSYSTEMID": // If it overflows the result will be invalid anyways parsedDict[key] = StaticGeography.GetSolarSystemName((int)valueAsLong); break; case "SHIPTYPEID": case "TYPEID": case "STRUCTURETYPEID": case "VICTIMSHIPTYPEID": // If it overflows the result will be invalid anyways parsedDict[key] = StaticItems.GetItemName((int)valueAsLong); break; case "MEDALID": var medal = notification.CCPCharacter.CharacterMedals.FirstOrDefault(x => (x.ID.ToString() == value)); parsedDict[key] = medal?.Title ?? EveMonConstants.UnknownText; parsedDict.Add("medalDescription", medal?.Description ?? EveMonConstants.UnknownText); break; case "AMOUNT": case "ISKVALUE": // Format as ISK amount if (value.TryParseInv(out amount)) { parsedDict[key] = amount.ToString("N2"); } break; case "ENDDATE": case "STARTDATE": case "DECLOAKTIME": case "DESTRUCTTIME": case "TIMEFINISHED": parsedDict[key] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", valueAsLong. WinTimeStampToDateTime()); break; case "NOTIFICATION_CREATED": parsedDict[key] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", timestamp); break; case "DUEDATE": case "ISSUEDATE": parsedDict[key] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy} (EVE Time)", valueAsLong.WinTimeStampToDateTime()); break; case "CAMPAIGNEVENTTYPE": switch (value) { case "1": parsedDict[key] = "Territorial Claim Unit"; break; case "2": parsedDict[key] = "Infrastructure Hub"; break; case "3": parsedDict[key] = "Station"; break; default: parsedDict[key] = EveMonConstants.UnknownText; break; } break; case "TYPEIDS": typeIDs = pair.Value as YamlSequenceNode; if (typeIDs != null && (typeID == 56 || typeID == 57)) { parsedDict[key] = BuildImplantList(typeIDs); } break; case "LISTOFTYPESANDQTY": typeIDs = pair.Value as YamlSequenceNode; if (typeIDs != null) { parsedDict[key] = BuildItemList(typeIDs); } break; case "ISHOUSEWARMINGGIFT": // Tritanium parsedDict[key] = StaticItems.GetItemName(typeID); break; case "LEVEL": if (value.TryParseInv(out valueAsDouble)) { parsedDict[key] = Standing.Status(valueAsDouble) + " Standing"; } break; case "SHIELDVALUE": case "ARMORVALUE": case "HULLVALUE": if (value.TryParseInv(out valueAsDouble)) { parsedDict[key] = (valueAsDouble * 100.0).ToString("N0"); } break; } }
public ProcessedMatchTeam(ProcessedTeam baseTeam, Standing stand) : base(baseTeam.id, baseTeam.entry, baseTeam.picks, baseTeam.score, baseTeam.events, baseTeam.activeChip, baseTeam.history, baseTeam.form) { standing = stand; }
/// <summary> /// Changes the reputation value with a specific Faction. /// Is called by ReputationCollect.SetValue /// </summary> /// <param name="value"></param> /// <returns>Whether hostility changed due to the stending change</returns> internal bool SetValue(int value) { var oldSt = m_standing; var wasHostile = Hostile; m_standing = GetStanding(value); var nowHostile = Hostile; m_record.Value = value; return (oldSt != m_standing) && (wasHostile != nowHostile); }
private bool doIncrementStandings(Standing standing) { return(standing.matches_played < GlobalConfig.CloudAppConfig.CurrentGameWeek); }
private void CheckStanding(Skeleton s) { float standingRaw = Math.Abs(s.Joints[JointType.KneeLeft].Position.Y - s.Joints[JointType.KneeRight].Position.Y); standingCounter++; if (standingCounter > 40) { if (standingRaw > 0.1) { standing = Standing.walking; standingCounter = 0; } else { standing = Standing.standing; } } }
public void Update() { if (broadcastingBlock != null) { var temp = BroadcastingEnabled; BroadcastingEnabled = broadcastingBlock.IsWorking; if (temp != BroadcastingEnabled) { PlayAudioForBroadcastingChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(broadcasting, blocks); if (blocks.Count > 0) { broadcastingBlock = blocks.FirstOrDefault(); } } if (miningBlock != null) { var temp = MiningDronesEnabled; MiningDronesEnabled = miningBlock.IsWorking; if (temp != MiningDronesEnabled) { PlayAudioForMiningChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(mining, blocks); if (blocks.Count > 0) { miningBlock = blocks.FirstOrDefault(); } } if (formationBlock != null) { var temp = DroneMode.ToString(); DroneMode = formationBlock.IsWorking ? DroneModes.Fighter : DroneMode = DroneModes.AtRange; if (temp != DroneMode.ToString()) { PlayAudioForDroneModeChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(formation, blocks); if (blocks.Count > 0) { formationBlock = blocks.FirstOrDefault(); } } if (agressiveBlock != null) { var temp = Stance; Stance = agressiveBlock.IsWorking?Standing.Hostile:Stance = Standing.Passive; if (temp != Stance) { PlayAudioForStanceChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(agressive, blocks); if (blocks.Count > 0) { agressiveBlock = blocks.FirstOrDefault(); } } if (modeBlock != null) { var temp = StandingOrder; if (modeBlock.IsWorking) { StandingOrder = ActionTypes.Guard; } else { StandingOrder = ActionTypes.Sentry; } if (temp != StandingOrder) { PlayAudioForStandingOrderChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(mode, blocks); if (blocks.Count > 0) { modeBlock = blocks.FirstOrDefault(); } } if (onoffBlock != null) { var temp = DronesOnline; if (onoffBlock.IsWorking) { DronesOnline = true; } else { DronesOnline = false; } if (temp != DronesOnline) { PlayAudioForDronesOnlineChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(onoff, blocks); if (blocks.Count > 0) { onoffBlock = blocks.FirstOrDefault(); } } }
public StandingTest() { testStanding = new Standing("Inter"); }
public static bool IsHostileStanding(Standing standing) { return standing <= Standing.Hostile; }
public ProcessedMatchTeam(int teamId, EntryData ent, Standing stand, List <ProcessedPick> processedPicks, Score s, List <TeamMatchEvent> eventList, string chip, TeamHistory history, List <string> form) : base(teamId, ent, processedPicks, s, eventList, chip, history, form) { standing = stand; }
/// <summary> /// Loads an existing Reputation from the given Record. /// </summary> public Reputation(ReputationRecord record, Faction faction) { m_record = record; Faction = faction; m_standing = GetStanding(record.Value); }
/// <summary>Loads an existing Reputation from the given Record.</summary> public Reputation(ReputationRecord record, Faction faction) { this.m_record = record; this.Faction = faction; this.m_standing = Reputation.GetStanding(record.Value); }
private void SetStanding(string[] args) { if (args.Length != 2 && args[1].Length > 1) return; if (args[1].ToLower().Contains("hostile")) { standing = Standing.Hostile; } else if (args[1].ToLower().Contains("passive")) { standing = Standing.Passive; } Util.GetInstance().Log("[PlayerDrone.Update] updating orbitrange to " + args[1], orderlog); }
public static bool IsHostileStanding(Standing standing) { return(standing <= Standing.Hostile); }
private void SetNumberOfFinals(User user, Standing standing) { List <string> qualified = new List <string>() { user.UserBet.Qualified1Color, user.UserBet.Qualified2Color, user.UserBet.Qualified3Color, user.UserBet.Qualified4Color, user.UserBet.Qualified5Color, user.UserBet.Qualified6Color, user.UserBet.Qualified7Color, user.UserBet.Qualified8Color, user.UserBet.Qualified9Color, user.UserBet.Qualified10Color, user.UserBet.Qualified11Color, user.UserBet.Qualified12Color, user.UserBet.Qualified13Color, user.UserBet.Qualified14Color, user.UserBet.Qualified15Color, user.UserBet.Qualified16Color, }; List <string> quarterfinals = new List <string>() { user.UserBet.QuarterFinalist1Color, user.UserBet.QuarterFinalist2Color, user.UserBet.QuarterFinalist3Color, user.UserBet.QuarterFinalist4Color, user.UserBet.QuarterFinalist5Color, user.UserBet.QuarterFinalist6Color, user.UserBet.QuarterFinalist7Color, user.UserBet.QuarterFinalist8Color, }; List <string> semiFinals = new List <string>() { user.UserBet.Semifinalist1Color, user.UserBet.Semifinalist2Color, user.UserBet.Semifinalist3Color, user.UserBet.Semifinalist4Color, }; List <string> finals = new List <string>() { user.UserBet.Finalist1Color, user.UserBet.Finalist2Color }; int numberOfQualified = 0; foreach (var qualify in qualified) { if (qualify == "green") { numberOfQualified += 1; } } int numberOfQuarterfinals = 0; foreach (var quarterfinal in quarterfinals) { if (quarterfinal == "green") { numberOfQuarterfinals += 1; } } int numberOfSemifinals = 0; foreach (var semiFinal in semiFinals) { if (semiFinal == "green") { numberOfSemifinals += 1; } } int numberOfFinals = 0; foreach (var final in finals) { if (final == "green") { numberOfFinals += 1; } } standing.NumberOfQualified = numberOfQualified; standing.NumberOfQuarterFinals = numberOfQuarterfinals; standing.NumberOfSemiFinals = numberOfSemifinals; standing.NumberOfFinals = numberOfFinals; }
/// <summary> /// Draws the list item for the given standing /// </summary> /// <param name="standing"></param> /// <param name="e"></param> private void DrawItem(Standing standing, DrawItemEventArgs e) { Graphics g = e.Graphics; // Draw background g.FillRectangle(e.Index % 2 == 0 ? Brushes.White : Brushes.LightGray, e.Bounds); Skill diplomacySkill = Character.Skills[DBConstants.DiplomacySkillID]; Skill connectionsSkill = Character.Skills[DBConstants.ConnectionsSkillID]; SkillLevel diplomacySkillLevel = new SkillLevel(diplomacySkill, diplomacySkill.LastConfirmedLvl); SkillLevel connectionsSkillLevel = new SkillLevel(connectionsSkill, connectionsSkill.LastConfirmedLvl); // Texts string standingText = $"{standing.EntityName} {standing.EffectiveStanding:N2}"; string standingStatusText = $"({Standing.Status(standing.EffectiveStanding)})"; string standingsDetailsText = $"{(standing.StandingValue < 0 ? diplomacySkillLevel : connectionsSkillLevel)} " + $"raises your effective standing from {standing.StandingValue:N2}"; // Measure texts Size standingTextSize = TextRenderer.MeasureText(g, standingText, m_standingsBoldFont, Size.Empty, Format); Size standingStatusTextSize = TextRenderer.MeasureText(g, standingStatusText, m_standingsBoldFont, Size.Empty, Format); Size standingsDetailsTextSize = TextRenderer.MeasureText(g, standingsDetailsText, m_standingsFont, Size.Empty, Format); bool standingsDiffer = Math.Abs(standing.EffectiveStanding - standing.StandingValue) > double.Epsilon; // Draw texts TextRenderer.DrawText(g, standingText, m_standingsBoldFont, new Rectangle( e.Bounds.Left + standing.EntityImage.Width + 4, e.Bounds.Top + (standingsDiffer ? PadTop : (e.Bounds.Height - standingTextSize.Height) / 2), standingTextSize.Width + PadLeft, standingTextSize.Height), Color.Black); TextRenderer.DrawText(g, standingStatusText, m_standingsBoldFont, new Rectangle( e.Bounds.Left + standing.EntityImage.Width + 4 + standingTextSize.Width + PadRight, e.Bounds.Top + (standingsDiffer ? PadTop : (e.Bounds.Height - standingStatusTextSize.Height) / 2), standingStatusTextSize.Width + PadLeft, standingStatusTextSize.Height), GetStatusColor(Standing.Status(standing.EffectiveStanding))); if (standingsDiffer) { TextRenderer.DrawText(g, standingsDetailsText, m_standingsFont, new Rectangle( e.Bounds.Left + standing.EntityImage.Width + 4, e.Bounds.Top + PadTop + standingTextSize.Height, standingsDetailsTextSize.Width + PadLeft, standingsDetailsTextSize.Height), Color.Black); } // Draw the entity image if (Settings.UI.SafeForWork) { return; } g.DrawImage(standing.EntityImage, new Rectangle(e.Bounds.Left + PadLeft / 2, StandingDetailHeight / 2 - standing.EntityImage.Height / 2 + e.Bounds.Top, standing.EntityImage.Width, standing.EntityImage.Height)); }
public void DoesNotAcceptNegativeNumberOfGoals(bool isHomeGame, int homeGoals, int awayGoals) { Standing s = new Standing("test"); Assert.Throws <ArgumentException>(() => { s.AddGame(isHomeGame, homeGoals, awayGoals); }); }