public bool DeepEquals(DestinyProfileComponent?other) { return(other is not null && (UserInfo is not null ? UserInfo.DeepEquals(other.UserInfo) : other.UserInfo is null) && DateLastPlayed == other.DateLastPlayed && VersionsOwned == other.VersionsOwned && CharacterIds.DeepEqualsListNaive(other.CharacterIds) && SeasonHashes.DeepEqualsListNaive(other.SeasonHashes) && CurrentSeasonHash == other.CurrentSeasonHash && CurrentSeasonRewardPowerCap == other.CurrentSeasonRewardPowerCap); }
public bool ContainsCharacterWithAge(CharacterAge age) { var characterDetails = m_project.AllCharacterDetailDictionary; return(CharacterIds.Any(c => { if (CharacterVerseData.IsCharacterStandard(c)) { return age == CharacterAge.Adult; } return characterDetails[c].Age == age; })); }
public bool ContainsCharacterWithGender(CharacterGender gender) { var characterDetails = m_project.AllCharacterDetailDictionary; return(CharacterIds.Any(c => { if (CharacterVerseData.IsCharacterStandard(c)) { return gender == CharacterGender.Either; } return characterDetails[c].Gender == gender; })); }
/// <summary> /// We used to use this in character group generation. We no longer use it, but since there are a lot of tests for it and it might /// be useful in the future, we'll keep it around for now. /// </summary> public bool Matches(CharacterDetail character, CharacterGenderMatchingOptions genderMatchingOptions, CharacterAgeMatchingOptions ageMatchingOptions) { if (!CharacterIds.Any()) { return(false); // Probably a group set aside for a special purpose in the group generator (e.g., narrator) } if (CharacterVerseData.IsCharacterStandard(character.CharacterId)) { switch (CharacterVerseData.GetStandardCharacterType(character.CharacterId)) { case CharacterVerseData.StandardCharacter.Narrator: return(CharacterIds.All(i => CharacterVerseData.GetStandardCharacterType(i) == CharacterVerseData.StandardCharacter.Narrator)); default: return(CharacterIds.All(i => { var type = CharacterVerseData.GetStandardCharacterType(i); return type != CharacterVerseData.StandardCharacter.Narrator && type != CharacterVerseData.StandardCharacter.NonStandard; })); } } if (CharacterIds.Any(i => CharacterVerseData.IsCharacterStandard(i))) { return(false); } bool result = true; var characterDetails = m_project.AllCharacterDetailDictionary; result &= CharacterIds.All(i => { CharacterGender gender = characterDetails[i].Gender; return(genderMatchingOptions.Matches(character.Gender, gender)); }); result &= CharacterIds.All(i => { CharacterAge age = characterDetails[i].Age; return(ageMatchingOptions.Matches(character.Age, age)); }); return(result); }
public bool ContainsOnlyCharactersWithAge(CharacterAge age) { var characterDetails = m_project.AllCharacterDetailDictionary; return(CharacterIds.All(c => { if (CharacterVerseData.IsCharacterStandard(c)) { return age == CharacterAge.Adult; } CharacterDetail characterDetail; if (!characterDetails.TryGetValue(c, out characterDetail)) { return false; } return characterDetail.Age == age; })); }
public bool ContainsCharacterWithGender(CharacterGender gender) { var characterDetails = m_project.AllCharacterDetailDictionary; return(CharacterIds.Any(c => { if (CharacterVerseData.IsCharacterStandard(c)) { return gender == CharacterGender.Either; } CharacterDetail characterDetail; if (!characterDetails.TryGetValue(c, out characterDetail)) { return false; } return characterDetail.Gender == gender; })); }
public void Update(DestinyProfileComponent?other) { if (other is null) { return; } if (!UserInfo.DeepEquals(other.UserInfo)) { UserInfo.Update(other.UserInfo); OnPropertyChanged(nameof(UserInfo)); } if (DateLastPlayed != other.DateLastPlayed) { DateLastPlayed = other.DateLastPlayed; OnPropertyChanged(nameof(DateLastPlayed)); } if (VersionsOwned != other.VersionsOwned) { VersionsOwned = other.VersionsOwned; OnPropertyChanged(nameof(VersionsOwned)); } if (!CharacterIds.DeepEqualsListNaive(other.CharacterIds)) { CharacterIds = other.CharacterIds; OnPropertyChanged(nameof(CharacterIds)); } if (!SeasonHashes.DeepEqualsListNaive(other.SeasonHashes)) { SeasonHashes = other.SeasonHashes; OnPropertyChanged(nameof(SeasonHashes)); } if (CurrentSeasonHash != other.CurrentSeasonHash) { CurrentSeasonHash = other.CurrentSeasonHash; OnPropertyChanged(nameof(CurrentSeasonHash)); } if (CurrentSeasonRewardPowerCap != other.CurrentSeasonRewardPowerCap) { CurrentSeasonRewardPowerCap = other.CurrentSeasonRewardPowerCap; OnPropertyChanged(nameof(CurrentSeasonRewardPowerCap)); } }
public static Character GetCharacter(CharacterIds pId) { switch (pId) { case (CharacterIds.Taylor): return(new Taylor()); case (CharacterIds.Erickson): return(new Erickson()); case (CharacterIds.VonderEhe): return(new VonderEhe()); case (CharacterIds.Shannon): return(new Shannon()); default: throw new Exception("Character not found. Id=" + pId); } }
public static void UpdateClansWithInfo(ClansOutput result) { CharacterIds.Clear(); CharacterClans.Clear(); ClanLeaders.Clear(); ClanNames.Clear(); Players.ForEach(player => player.ClanId = 0); foreach (var row in result.Clans) { CharacterIds.Add(row.CharacterName, row.CharacterId); CharacterClans.Add(row.CharacterId, row.ClanId); if (row.IsLeader) { ClanLeaders.Add(row.CharacterId); } if (!ClanNames.ContainsKey(row.ClanId)) { ClanNames.Add(row.ClanId, row.ClanName); } Player foundPlayer = Players.FirstOrDefault(x => x.Name == row.CharacterName); if (foundPlayer != null) { foundPlayer.Id = row.CharacterId; foundPlayer.ClanId = row.ClanId; foundPlayer.IsClanLeader = row.IsLeader; } } byte[] message = MergeByteArrays(ToBytes(Command.ClanUpdate)); // inform game servers that they need to update clans from db by themselves foreach (Socket gameServer in GameServers) { gameServer.SendOrFail(message); } }
public bool Equals(DestinyProfileComponent input) { if (input == null) { return(false); } return (( UserInfo == input.UserInfo || (UserInfo != null && UserInfo.Equals(input.UserInfo)) ) && ( DateLastPlayed == input.DateLastPlayed || (DateLastPlayed != null && DateLastPlayed.Equals(input.DateLastPlayed)) ) && ( VersionsOwned == input.VersionsOwned || (VersionsOwned != null && VersionsOwned.Equals(input.VersionsOwned)) ) && ( CharacterIds == input.CharacterIds || (CharacterIds != null && CharacterIds.SequenceEqual(input.CharacterIds)) ) && ( SeasonHashes == input.SeasonHashes || (SeasonHashes != null && SeasonHashes.SequenceEqual(input.SeasonHashes)) ) && ( CurrentSeasonHash == input.CurrentSeasonHash || (CurrentSeasonHash.Equals(input.CurrentSeasonHash)) ) && ( CurrentSeasonRewardPowerCap == input.CurrentSeasonRewardPowerCap || (CurrentSeasonRewardPowerCap.Equals(input.CurrentSeasonRewardPowerCap)) )); }
public static void PlayerLogin(Socket conn, string characterName) { var newPlayer = new Player(conn, characterName); // if it's a character that's in some clan, get his id if (CharacterIds.ContainsKey(newPlayer.Name)) { newPlayer.Id = CharacterIds[newPlayer.Name]; // if a clan for this character id is found, assign clan to character if (CharacterClans.ContainsKey(newPlayer.Id)) { newPlayer.ClanId = CharacterClans[newPlayer.Id]; } // set him as clan leader if he's in the list of clan leaders if (ClanLeaders.Contains(newPlayer.Id)) { newPlayer.IsClanLeader = true; } } // if it's a reconnecting character, remove him from list of online characters Players.RemoveAll(x => x.Name == newPlayer.Name); // add him to list of online characters Players.Add(newPlayer); // update this player in groups if he was in one before reconnecting Groups.ForEach(group => group.UpdateReconnectedPlayer(newPlayer)); if (PendingKicks.ContainsKey(newPlayer.Name)) //cancel automatic kick { PendingKicks[newPlayer.Name].Stop(); PendingKicks.Remove(newPlayer.Name); } }
public static void SetAnimation(CharacterIds characterId, string animationName) { }
public void SetGroupIdLabel() { if (GroupIdLabel != Label.None) { return; } if (AssignedToCameoActor) { GroupIdLabel = Label.Other; GroupIdOtherText = VoiceActor.Name; return; } if (CharacterIds.All(c => CharacterVerseData.IsCharacterOfType(c, CharacterVerseData.StandardCharacter.Narrator))) { GroupIdLabel = Label.Narrator; } else if (IsVoiceActorAssigned) { VoiceActor.VoiceActor actor = VoiceActor; if (actor.Age == ActorAge.Child) { GroupIdLabel = Label.Child; } else if (actor.Gender == ActorGender.Male) { GroupIdLabel = Label.Male; } else { GroupIdLabel = Label.Female; } } else { if (ContainsOnlyCharactersWithAge(CharacterAge.Child)) { GroupIdLabel = Label.Child; } else if (ContainsCharacterWithGender(CharacterGender.Male)) { GroupIdLabel = Label.Male; } else if (ContainsCharacterWithGender(CharacterGender.Female)) { GroupIdLabel = Label.Female; } else if (ContainsCharacterWithGender(CharacterGender.PreferMale)) { GroupIdLabel = Label.Male; } else if (ContainsCharacterWithGender(CharacterGender.PreferFemale)) { GroupIdLabel = Label.Female; } else { GroupIdLabel = Label.Male; } } }