public int Compare(KeyValuePair <int, WrapperGarrisonFollower> follower1, KeyValuePair <int, WrapperGarrisonFollower> follower2) { WrapperGarrisonFollower value = follower1.Value; WrapperGarrisonFollower value2 = follower2.Value; FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(value); FollowerStatus followerStatus2 = GeneralHelpers.GetFollowerStatus(value2); bool flag = (value.Flags & 8) != 0; bool flag2 = (value2.Flags & 8) != 0; bool flag3 = !flag && followerStatus != FollowerStatus.inactive; bool flag4 = !flag2 && followerStatus2 != FollowerStatus.inactive; if (flag3 != flag4) { return((!flag3) ? 1 : -1); } if (followerStatus != followerStatus2) { return(followerStatus - followerStatus2); } int num = (value.ItemLevelArmor + value.ItemLevelWeapon) / 2; int num2 = (value2.ItemLevelArmor + value2.ItemLevelWeapon) / 2; if (num2 != num) { return(num2 - num); } if (value.Quality != value2.Quality) { return(value2.Quality - value.Quality); } return(0); }
private FollowerListItem InsertFollowerIntoListView(WrapperGarrisonFollower follower) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); if (record == null) { return(null); } if (record.GarrFollowerTypeID != (uint)GarrisonStatus.GarrisonFollowerType) { return(null); } if (this.m_isCombatAllyList) { bool flags = (follower.Flags & 8) != 0; FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower); if (flags || follower.ZoneSupportSpellID <= 0 || followerStatus == FollowerStatus.inactive || followerStatus == FollowerStatus.fatigued || followerStatus == FollowerStatus.inBuilding) { return(null); } } GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_followerListItemPrefab); gameObject.transform.SetParent(this.m_followerListViewContents.transform, false); FollowerListItem component = gameObject.GetComponent <FollowerListItem>(); component.SetFollower(follower); return(component); }
public int Compare(KeyValuePair <int, WrapperGarrisonFollower> follower1, KeyValuePair <int, WrapperGarrisonFollower> follower2) { WrapperGarrisonFollower value = follower1.Value; WrapperGarrisonFollower wrapperGarrisonFollower = follower2.Value; FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(value); FollowerStatus followerStatu = GeneralHelpers.GetFollowerStatus(wrapperGarrisonFollower); bool flags = (value.Flags & 8) != 0; bool flag = (wrapperGarrisonFollower.Flags & 8) != 0; bool flag1 = (flags ? false : followerStatus != FollowerStatus.inactive); if (flag1 != (flag ? false : followerStatu != FollowerStatus.inactive)) { return(!flag1 ? 1 : -1); } if (followerStatus != followerStatu) { return((int)followerStatus - (int)followerStatu); } int itemLevelArmor = (value.ItemLevelArmor + value.ItemLevelWeapon) / 2; int num = (wrapperGarrisonFollower.ItemLevelArmor + wrapperGarrisonFollower.ItemLevelWeapon) / 2; if (num != itemLevelArmor) { return(num - itemLevelArmor); } if (value.Quality == wrapperGarrisonFollower.Quality) { return(0); } return(wrapperGarrisonFollower.Quality - value.Quality); }
private void InsertFollowerIntoListView(WrapperGarrisonFollower follower, FollowerCategory followerCategory) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); if (record == null) { return; } if (record.GarrFollowerTypeID != (uint)GarrisonStatus.GarrisonFollowerType) { return; } bool flags = (follower.Flags & 8) != 0; bool flag = !flags; FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower); switch (followerCategory) { case FollowerCategory.ActiveChampion: { if (!flag || followerStatus == FollowerStatus.inactive) { return; } break; } case FollowerCategory.InactiveChampion: { if (!flag || followerStatus != FollowerStatus.inactive) { return; } break; } case FollowerCategory.Troop: { if (!flags || follower.Durability <= 0) { return; } break; } default: { return; } } FollowerListItem followerListItem = UnityEngine.Object.Instantiate <FollowerListItem>(this.m_followerDetailListItemPrefab); followerListItem.transform.SetParent(this.m_followerDetailListContent.transform, false); followerListItem.SetFollower(follower); }
private void CreateCombatAllyItems(int combatAllyMissionID, int combatAllyMissionCost) { foreach (WrapperGarrisonFollower follower in PersistentFollowerData.followerDictionary.Values) { FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower); if (follower.ZoneSupportSpellID > 0 && (followerStatus == FollowerStatus.available || followerStatus == FollowerStatus.onMission)) { FollowerInventoryListItem followerInventoryListItem = Object.Instantiate <FollowerInventoryListItem>(this.m_combatAllyChampionListItemPrefab); followerInventoryListItem.transform.SetParent(this.m_combatAllyListContent.transform, false); followerInventoryListItem.SetCombatAllyChampion(follower, combatAllyMissionID, combatAllyMissionCost); } } }
private void CreateCombatAllyItems(int combatAllyMissionID, int combatAllyMissionCost) { foreach (WrapperGarrisonFollower value in PersistentFollowerData.followerDictionary.Values) { FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(value); if (value.ZoneSupportSpellID <= 0 || followerStatus != FollowerStatus.available && followerStatus != FollowerStatus.onMission) { continue; } FollowerInventoryListItem followerInventoryListItem = UnityEngine.Object.Instantiate <FollowerInventoryListItem>(this.m_combatAllyChampionListItemPrefab); followerInventoryListItem.transform.SetParent(this.m_combatAllyListContent.transform, false); followerInventoryListItem.SetCombatAllyChampion(value, combatAllyMissionID, combatAllyMissionCost); } }
private void ChangeFollowerActiveResultHandler(LegionCompanionWrapper.ChangeFollowerActiveResultEvent eventArgs) { if (eventArgs.Result == 0) { PersistentFollowerData.AddOrUpdateFollower(eventArgs.Follower); FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(eventArgs.Follower); if (followerStatus == FollowerStatus.inactive) { Debug.Log("Follower is now inactive. " + eventArgs.ActivationsRemaining + " activations remain for the day."); } else { Debug.Log("Follower is now active. " + eventArgs.ActivationsRemaining + " activations remain for the day."); } if (this.FollowerDataChangedAction != null) { this.FollowerDataChangedAction(); } LegionCompanionWrapper.RequestFollowerActivationData((int)GarrisonStatus.GarrisonType); } }
public int Compare(KeyValuePair <int, WrapperGarrisonFollower> follower1, KeyValuePair <int, WrapperGarrisonFollower> follower2) { WrapperGarrisonFollower value = follower1.Value; WrapperGarrisonFollower wrapperGarrisonFollower = follower2.Value; FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(value); FollowerStatus followerStatu = GeneralHelpers.GetFollowerStatus(wrapperGarrisonFollower); if (followerStatus != followerStatu) { return((int)followerStatus - (int)followerStatu); } bool flag = this.HasUsefulAbility(value); if (flag != this.HasUsefulAbility(wrapperGarrisonFollower)) { return(!flag ? 1 : -1); } int itemLevelArmor = (value.ItemLevelArmor + value.ItemLevelWeapon) / 2; int num = (wrapperGarrisonFollower.ItemLevelArmor + wrapperGarrisonFollower.ItemLevelWeapon) / 2; if (num != itemLevelArmor) { return(num - itemLevelArmor); } if (value.Quality != wrapperGarrisonFollower.Quality) { return(wrapperGarrisonFollower.Quality - value.Quality); } bool flags = (value.Flags & 8) != 0; bool flags1 = (wrapperGarrisonFollower.Flags & 8) != 0; if (flags == flags1) { return(0); } return(!flags1 ? 1 : -1); }