public void SetFollower(WrapperGarrisonFollower oldFollower, WrapperGarrisonFollower newFollower, float initialEffectDelay) { this.m_followerID = oldFollower.GarrFollowerID; bool flag = (oldFollower.Flags & 8) != 0; if (flag) { this.SetFollowerAppearance(newFollower, false, false, true, initialEffectDelay); return; } this.m_showedLevelUpEffect = false; bool isMaxLevelAndMaxQuality = false; bool nextCapIsForQuality = false; GeneralHelpers.GetXpCapInfo(oldFollower.FollowerLevel, oldFollower.Quality, out this.m_currentCap, out nextCapIsForQuality, out isMaxLevelAndMaxQuality); this.SetFollowerAppearance(oldFollower, nextCapIsForQuality, isMaxLevelAndMaxQuality, false, initialEffectDelay); GeneralHelpers.GetXpCapInfo(newFollower.FollowerLevel, newFollower.Quality, out this.m_newCap, out this.m_newCapIsQuality, out this.m_newFollowerIsMaxLevelAndMaxQuality); this.m_fancyNumberDisplay.SetNumberLabel(StaticDB.GetString("XP2", null)); this.m_fancyNumberDisplay.SetValue((int)(this.m_currentCap - (uint)oldFollower.Xp), true, 0f); if (oldFollower.FollowerLevel != newFollower.FollowerLevel || oldFollower.Quality != newFollower.Quality) { this.m_fancyNumberDisplay.SetValue(0, initialEffectDelay); } else { this.m_fancyNumberDisplay.SetValue((int)(this.m_currentCap - (uint)newFollower.Xp), initialEffectDelay); } }
public void HandleFollowerDataChanged() { if (!this.m_popupView.activeSelf) { return; } FollowerExperienceDisplay[] componentsInChildren = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true); int num = 0; foreach (FollowerExperienceDisplay followerExperienceDisplay in componentsInChildren) { if (PersistentFollowerData.preMissionFollowerDictionary.ContainsKey(followerExperienceDisplay.GetFollowerID())) { WrapperGarrisonFollower oldFollower = PersistentFollowerData.preMissionFollowerDictionary[followerExperienceDisplay.GetFollowerID()]; bool flag = PersistentFollowerData.followerDictionary.ContainsKey(followerExperienceDisplay.GetFollowerID()); WrapperGarrisonFollower newFollower; if (flag) { newFollower = PersistentFollowerData.followerDictionary[followerExperienceDisplay.GetFollowerID()]; } else { newFollower = default(WrapperGarrisonFollower); newFollower.GarrFollowerID = oldFollower.GarrFollowerID; newFollower.Quality = oldFollower.Quality; newFollower.Durability = 0; } float initialEffectDelay = (float)num * this.m_experienceDisplayEntranceDelay; followerExperienceDisplay.SetFollower(oldFollower, newFollower, initialEffectDelay); num++; } } }
private void SetFillValue(int newXPRemainingUntilNextLevel) { if (newXPRemainingUntilNextLevel == 0 && this.m_currentCap != this.m_newCap) { if (!this.m_showedLevelUpEffect) { Main.instance.m_UISound.Play_ChampionLevelUp(); UiAnimMgr.instance.PlayAnim("FlameGlowPulse", this.m_followerPortrait.transform, Vector3.zero, 2f, 0f); UiAnimMgr.instance.PlayAnim("MinimapPulseAnim", this.m_followerPortrait.transform, Vector3.zero, 2f, 0f); this.m_showedLevelUpEffect = true; } WrapperGarrisonFollower follower = PersistentFollowerData.followerDictionary[this.m_followerID]; this.SetFollowerAppearance(follower, this.m_newCapIsQuality, this.m_newFollowerIsMaxLevelAndMaxQuality, false, 0f); this.m_currentCap = this.m_newCap; this.m_fancyNumberDisplay.SetValue((int)this.m_newCap, true, 0f); this.m_fancyNumberDisplay.SetValue((int)(this.m_newCap - (uint)follower.Xp), 0f); } this.m_xpAmountText.text = string.Concat(new object[] { string.Empty, (long)((ulong)this.m_currentCap - (ulong)((long)newXPRemainingUntilNextLevel)), "\\", this.m_currentCap }); float fillAmount = Mathf.Clamp01((float)((ulong)this.m_currentCap - (ulong)((long)newXPRemainingUntilNextLevel)) / this.m_currentCap); this.m_progressBarFillImage.fillAmount = fillAmount; }
private void InitEquipmentSlots(WrapperGarrisonFollower follower) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy(componentsInChildren[i].gameObject); } bool flag = false; bool flag2 = true; for (int j = 0; j < follower.AbilityIDs.Count; j++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[j]); if ((record.Flags & 1u) != 0u) { flag = true; GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab); gameObject.transform.SetParent(this.m_equipmentSlotsRootObject.transform, false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(follower.AbilityIDs[j], true, true, this); } } bool flag3 = (follower.Flags & 8) != 0; GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); if (flag3 || follower.FollowerLevel < MissionDetailView.GarrisonFollower_GetMaxFollowerLevel((int)record2.GarrFollowerTypeID)) { flag2 = false; } this.m_equipmentSlotsText.gameObject.SetActive(flag || flag2); }
public void HandleFollowerDataChanged() { WrapperGarrisonFollower wrapperGarrisonFollower; if (!this.m_popupView.activeSelf) { return; } FollowerExperienceDisplay[] componentsInChildren = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true); int num = 0; FollowerExperienceDisplay[] followerExperienceDisplayArray = componentsInChildren; for (int i = 0; i < (int)followerExperienceDisplayArray.Length; i++) { FollowerExperienceDisplay followerExperienceDisplay = followerExperienceDisplayArray[i]; if (PersistentFollowerData.preMissionFollowerDictionary.ContainsKey(followerExperienceDisplay.GetFollowerID())) { WrapperGarrisonFollower item = PersistentFollowerData.preMissionFollowerDictionary[followerExperienceDisplay.GetFollowerID()]; wrapperGarrisonFollower = (!PersistentFollowerData.followerDictionary.ContainsKey(followerExperienceDisplay.GetFollowerID()) ? new WrapperGarrisonFollower() { GarrFollowerID = item.GarrFollowerID, Quality = item.Quality, Durability = 0 } : PersistentFollowerData.followerDictionary[followerExperienceDisplay.GetFollowerID()]); followerExperienceDisplay.SetFollower(item, wrapperGarrisonFollower, (float)num * this.m_experienceDisplayEntranceDelay); num++; } } }
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 static FollowerStatus GetFollowerStatus(WrapperGarrisonFollower follower) { bool flag = (follower.Flags & 4) != 0; if (flag) { return(FollowerStatus.inactive); } bool flag2 = (follower.Flags & 2) != 0; if (flag2) { return(FollowerStatus.fatigued); } bool flag3 = follower.CurrentBuildingID != 0; if (flag3) { return(FollowerStatus.inBuilding); } bool flag4 = follower.CurrentMissionID != 0; if (flag4) { return(FollowerStatus.onMission); } return(FollowerStatus.available); }
public void InitFollowerList() { FollowerListItem[] componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true); FollowerListItem[] followerListItemArray = componentsInChildren; for (int i = 0; i < (int)followerListItemArray.Length; i++) { FollowerListItem followerListItem = followerListItemArray[i]; if (PersistentFollowerData.followerDictionary.ContainsKey(followerListItem.m_followerID)) { WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[followerListItem.m_followerID]; if ((item.Flags & 8) == 0 || item.Durability > 0) { followerListItem.SetFollower(item); } else { followerListItem.gameObject.SetActive(false); followerListItem.transform.SetParent(Main.instance.transform); } } else { followerListItem.gameObject.SetActive(false); followerListItem.transform.SetParent(Main.instance.transform); } } Transform mFollowerListViewContents = this.m_followerListViewContents.transform; float single = this.m_followerListViewContents.transform.localPosition.x; Vector3 vector3 = this.m_followerListViewContents.transform.localPosition; mFollowerListViewContents.localPosition = new Vector3(single, 0f, vector3.z); this.SortFollowerListData(); componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true); foreach (KeyValuePair <int, WrapperGarrisonFollower> mSortedFollowerList in this.m_sortedFollowerList) { bool flag = false; FollowerListItem[] followerListItemArray1 = componentsInChildren; int num = 0; while (num < (int)followerListItemArray1.Length) { if (followerListItemArray1[num].m_followerID != mSortedFollowerList.Value.GarrFollowerID) { num++; } else { flag = true; break; } } if (!flag) { if ((mSortedFollowerList.Value.Flags & 8) == 0 || mSortedFollowerList.Value.Durability > 0) { this.InsertFollowerIntoListView(mSortedFollowerList.Value); } } } }
public static void CachePreMissionFollower(WrapperGarrisonFollower follower) { if (PersistentFollowerData.instance.m_preMissionFollowerDictionary.ContainsKey(follower.GarrFollowerID)) { PersistentFollowerData.instance.m_preMissionFollowerDictionary.Remove(follower.GarrFollowerID); } PersistentFollowerData.instance.m_preMissionFollowerDictionary.Add(follower.GarrFollowerID, follower); }
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); }
public void Test() { WrapperGarrisonFollower wrapperGarrisonFollower = new WrapperGarrisonFollower(); WrapperGarrisonFollower wrapperGarrisonFollower1 = new WrapperGarrisonFollower(); wrapperGarrisonFollower.Quality = 1; wrapperGarrisonFollower.FollowerLevel = 108; wrapperGarrisonFollower.Xp = 2400; wrapperGarrisonFollower.GarrFollowerID = 616; wrapperGarrisonFollower1.Quality = 1; wrapperGarrisonFollower1.FollowerLevel = 109; wrapperGarrisonFollower1.Xp = 124; wrapperGarrisonFollower1.GarrFollowerID = 616; this.m_testXPDisplay[0].SetFollower(wrapperGarrisonFollower, wrapperGarrisonFollower1, 0f); WrapperGarrisonFollower wrapperGarrisonFollower2 = new WrapperGarrisonFollower(); WrapperGarrisonFollower wrapperGarrisonFollower3 = new WrapperGarrisonFollower(); wrapperGarrisonFollower2.Quality = 2; wrapperGarrisonFollower2.FollowerLevel = 109; wrapperGarrisonFollower2.Xp = 2650; wrapperGarrisonFollower2.GarrFollowerID = 621; wrapperGarrisonFollower3.Quality = 2; wrapperGarrisonFollower3.FollowerLevel = 110; wrapperGarrisonFollower3.Xp = 777; wrapperGarrisonFollower3.GarrFollowerID = 621; this.m_testXPDisplay[1].SetFollower(wrapperGarrisonFollower2, wrapperGarrisonFollower3, 0.5f); WrapperGarrisonFollower wrapperGarrisonFollower4 = new WrapperGarrisonFollower(); WrapperGarrisonFollower wrapperGarrisonFollower5 = new WrapperGarrisonFollower(); wrapperGarrisonFollower4.Quality = 3; wrapperGarrisonFollower4.FollowerLevel = 110; wrapperGarrisonFollower4.Xp = 57000; wrapperGarrisonFollower4.GarrFollowerID = 617; wrapperGarrisonFollower5.Quality = 4; wrapperGarrisonFollower5.FollowerLevel = 110; wrapperGarrisonFollower5.Xp = 0; wrapperGarrisonFollower5.GarrFollowerID = 617; this.m_testXPDisplay[2].SetFollower(wrapperGarrisonFollower4, wrapperGarrisonFollower5, 1f); WrapperGarrisonFollower wrapperGarrisonFollower6 = new WrapperGarrisonFollower(); WrapperGarrisonFollower wrapperGarrisonFollower7 = new WrapperGarrisonFollower(); wrapperGarrisonFollower7 = new WrapperGarrisonFollower() { GarrFollowerID = wrapperGarrisonFollower6.GarrFollowerID, Quality = wrapperGarrisonFollower6.Quality, Durability = 0 }; wrapperGarrisonFollower6.Quality = 3; wrapperGarrisonFollower6.FollowerLevel = 110; wrapperGarrisonFollower6.Xp = 57000; wrapperGarrisonFollower6.GarrFollowerID = 729; wrapperGarrisonFollower6.Flags = 8; wrapperGarrisonFollower6.Durability = 0; this.m_testXPDisplay[3].SetFollower(wrapperGarrisonFollower6, wrapperGarrisonFollower7, 1.5f); }
public void Test() { WrapperGarrisonFollower oldFollower = default(WrapperGarrisonFollower); WrapperGarrisonFollower newFollower = default(WrapperGarrisonFollower); oldFollower.Quality = 1; oldFollower.FollowerLevel = 108; oldFollower.Xp = 2400; oldFollower.GarrFollowerID = 616; newFollower.Quality = 1; newFollower.FollowerLevel = 109; newFollower.Xp = 124; newFollower.GarrFollowerID = 616; this.m_testXPDisplay[0].SetFollower(oldFollower, newFollower, 0f); WrapperGarrisonFollower oldFollower2 = default(WrapperGarrisonFollower); WrapperGarrisonFollower newFollower2 = default(WrapperGarrisonFollower); oldFollower2.Quality = 2; oldFollower2.FollowerLevel = 109; oldFollower2.Xp = 2650; oldFollower2.GarrFollowerID = 621; newFollower2.Quality = 2; newFollower2.FollowerLevel = 110; newFollower2.Xp = 777; newFollower2.GarrFollowerID = 621; this.m_testXPDisplay[1].SetFollower(oldFollower2, newFollower2, 0.5f); WrapperGarrisonFollower oldFollower3 = default(WrapperGarrisonFollower); WrapperGarrisonFollower newFollower3 = default(WrapperGarrisonFollower); oldFollower3.Quality = 3; oldFollower3.FollowerLevel = 110; oldFollower3.Xp = 57000; oldFollower3.GarrFollowerID = 617; newFollower3.Quality = 4; newFollower3.FollowerLevel = 110; newFollower3.Xp = 0; newFollower3.GarrFollowerID = 617; this.m_testXPDisplay[2].SetFollower(oldFollower3, newFollower3, 1f); WrapperGarrisonFollower oldFollower4 = default(WrapperGarrisonFollower); WrapperGarrisonFollower newFollower4 = default(WrapperGarrisonFollower); newFollower4 = default(WrapperGarrisonFollower); newFollower4.GarrFollowerID = oldFollower4.GarrFollowerID; newFollower4.Quality = oldFollower4.Quality; newFollower4.Durability = 0; oldFollower4.Quality = 3; oldFollower4.FollowerLevel = 110; oldFollower4.Xp = 57000; oldFollower4.GarrFollowerID = 729; oldFollower4.Flags = 8; oldFollower4.Durability = 0; this.m_testXPDisplay[3].SetFollower(oldFollower4, newFollower4, 1.5f); }
public static void UpdateFollower(WrapperGarrisonMissionFollowerInfo followerInfo) { if (!PersistentFollowerData.instance.m_followerDictionary.Any((KeyValuePair <int, WrapperGarrisonFollower> f) => f.Value.DbID == followerInfo.FollowerDBID)) { Debug.LogError("Could not find follower with DB ID " + followerInfo.FollowerDBID); return; } WrapperGarrisonFollower value = PersistentFollowerData.instance.m_followerDictionary.First((KeyValuePair <int, WrapperGarrisonFollower> f) => f.Value.DbID == followerInfo.FollowerDBID).Value; value.CurrentMissionID = 0; PersistentFollowerData.instance.m_followerDictionary[value.GarrFollowerID] = value; }
private void HandleUseEquipmentResult(WrapperGarrisonFollower oldFollower, WrapperGarrisonFollower newFollower) { if (this.m_garrFollowerID != newFollower.GarrFollowerID) { return; } foreach (int num in newFollower.AbilityIDs) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(num); if ((record.Flags & 1u) != 0u) { bool flag = true; foreach (int num2 in oldFollower.AbilityIDs) { if (num2 == num) { flag = false; break; } } if (flag) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); foreach (AbilityDisplay abilityDisplay in componentsInChildren) { bool flag2 = true; foreach (int num3 in newFollower.AbilityIDs) { if (abilityDisplay.GetAbilityID() == num3) { flag2 = false; break; } } if (flag2) { Debug.Log(string.Concat(new object[] { "New ability is ", num, " replacing ability ID ", abilityDisplay.GetAbilityID() })); abilityDisplay.SetAbility(num, true, true, this); Main.instance.m_UISound.Play_UpgradeEquipment(); UiAnimMgr.instance.PlayAnim("FlameGlowPulse", abilityDisplay.transform, Vector3.zero, 2f, 0f); } } } } } }
private void SetTroopSlotForExistingFollower(TroopSlot[] troopSlots, WrapperGarrisonFollower follower) { if (follower.Durability <= 0) { return; } TroopSlot[] troopSlotArray = troopSlots; for (int i = 0; i < (int)troopSlotArray.Length; i++) { int ownedFollowerID = troopSlotArray[i].GetOwnedFollowerID(); if (ownedFollowerID != 0 && ownedFollowerID == follower.GarrFollowerID) { return; } } TroopSlot[] troopSlotArray1 = troopSlots; for (int j = 0; j < (int)troopSlotArray1.Length; j++) { TroopSlot troopSlot = troopSlotArray1[j]; if (troopSlot.IsCollected()) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceIconFileDataID : record.HordeIconFileDataID); troopSlot.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num); return; } } TroopSlot[] troopSlotArray2 = troopSlots; for (int k = 0; k < (int)troopSlotArray2.Length; k++) { TroopSlot troopSlot1 = troopSlotArray2[k]; if (troopSlot1.IsPendingCreate()) { GarrFollowerRec garrFollowerRec = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int num1 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? garrFollowerRec.AllianceIconFileDataID : garrFollowerRec.HordeIconFileDataID); troopSlot1.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num1); return; } } TroopSlot[] troopSlotArray3 = troopSlots; for (int l = 0; l < (int)troopSlotArray3.Length; l++) { TroopSlot troopSlot2 = troopSlotArray3[l]; if (troopSlot2.IsEmpty()) { GarrFollowerRec record1 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int num2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record1.AllianceIconFileDataID : record1.HordeIconFileDataID); troopSlot2.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num2); return; } } }
private void GarrisonDataResultHandler(LegionCompanionWrapper.GarrisonDataRequestResultEvent eventArgs) { PersistentFollowerData.ClearData(); PersistentMissionData.ClearData(); PersistentTalentData.ClearData(); if (this.GarrisonDataResetStartedAction != null) { this.GarrisonDataResetStartedAction(); } GarrisonStatus.SetFaction(eventArgs.Data.PvpFaction); GarrisonStatus.SetGarrisonServerConnectTime(eventArgs.Data.ServerTime); GarrisonStatus.SetCurrencies(eventArgs.Data.GoldCurrency, eventArgs.Data.OrderhallResourcesCurrency, eventArgs.Data.WarResourcesCurrency); GarrisonStatus.SetCharacterName(eventArgs.Data.CharacterName); GarrisonStatus.SetCharacterLevel(eventArgs.Data.CharacterLevel); GarrisonStatus.SetCharacterClass(eventArgs.Data.CharacterClassID); for (int i = 0; i < eventArgs.Data.Followers.Count; i++) { WrapperGarrisonFollower wrapperGarrisonFollower = eventArgs.Data.Followers[i]; if (StaticDB.garrFollowerDB.GetRecord(wrapperGarrisonFollower.GarrFollowerID) != null) { PersistentFollowerData.AddOrUpdateFollower(wrapperGarrisonFollower); bool flag = (wrapperGarrisonFollower.Flags & 8) != 0; if (flag && wrapperGarrisonFollower.Durability <= 0 && this.TroopExpiredAction != null) { this.TroopExpiredAction(wrapperGarrisonFollower); } } } for (int j = 0; j < eventArgs.Data.Missions.Count; j++) { PersistentMissionData.AddMission(eventArgs.Data.Missions[j]); } for (int k = 0; k < eventArgs.Data.Talents.Count; k++) { PersistentTalentData.AddOrUpdateTalent(eventArgs.Data.Talents[k]); } if (!GarrisonStatus.Initialized) { this.GarrisonDataResetFinishedAction += this.HandleEnterWorld; GarrisonStatus.Initialized = true; } if (this.GarrisonDataResetFinishedAction != null) { this.GarrisonDataResetFinishedAction(); } if (this.FollowerDataChangedAction != null) { this.FollowerDataChangedAction(); } Singleton <Login> .Instance.MobileLoginDataRequestComplete(); }
private void HandleUseArmamentResult(int result, WrapperGarrisonFollower oldFollower, WrapperGarrisonFollower newFollower) { if (result != 0) { return; } if (newFollower.GarrFollowerID != this.m_followerID) { return; } this.SetAvailabilityStatus(newFollower); UiAnimMgr.instance.PlayAnim("FlameGlowPulse", this.followerPortraitFrame.transform, Vector3.zero, 1.5f, 0f); Main.instance.m_UISound.Play_UpgradeArmament(); }
public static FollowerCanCounterMechanic HasFollowerWhoCanCounter(int garrMechanicTypeID) { bool flag = false; using (Dictionary <int, WrapperGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.Values.GetEnumerator()) { while (enumerator.MoveNext()) { WrapperGarrisonFollower follower = enumerator.Current; for (int i = 0; i < follower.AbilityIDs.Count; i++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[i]); if (record == null) { Debug.Log(string.Concat(new object[] { "Invalid Ability ID ", follower.AbilityIDs[i], " from follower ", follower.GarrFollowerID })); } else { IEnumerable <GarrAbilityEffectRec> source = from garrAbilityEffectRec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID) where garrAbilityEffectRec.GarrMechanicTypeID != 0 && garrAbilityEffectRec.AbilityAction == 0 && garrMechanicTypeID == (int)garrAbilityEffectRec.GarrMechanicTypeID select garrAbilityEffectRec; if (source.Any(delegate(GarrAbilityEffectRec garrAbilityEffectRec) { bool flag2 = (follower.Flags & 4) != 0; bool flag3 = (follower.Flags & 2) != 0; bool flag4 = follower.CurrentMissionID != 0; bool flag5 = follower.CurrentBuildingID != 0; return(!flag2 && !flag3 && !flag4 && !flag5); })) { return(FollowerCanCounterMechanic.yesAndAvailable); } flag |= (source.Count <GarrAbilityEffectRec>() > 0); } } } } if (flag) { return(FollowerCanCounterMechanic.yesButBusy); } return(FollowerCanCounterMechanic.no); }
private void HandleUseEquipmentResult(WrapperGarrisonFollower oldFollower, WrapperGarrisonFollower newFollower) { if (this.m_garrFollowerID != newFollower.GarrFollowerID) { return; } foreach (int abilityID in newFollower.AbilityIDs) { if ((StaticDB.garrAbilityDB.GetRecord(abilityID).Flags & 1) != 0) { bool flag = true; foreach (int num in oldFollower.AbilityIDs) { if (num != abilityID) { continue; } flag = false; break; } if (!flag) { continue; } AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { AbilityDisplay abilityDisplay = componentsInChildren[i]; bool flag1 = true; foreach (int abilityID1 in newFollower.AbilityIDs) { if (abilityDisplay.GetAbilityID() != abilityID1) { continue; } flag1 = false; break; } if (flag1) { Debug.Log(string.Concat(new object[] { "New ability is ", abilityID, " replacing ability ID ", abilityDisplay.GetAbilityID() })); abilityDisplay.SetAbility(abilityID, true, true, this); Main.instance.m_UISound.Play_UpgradeEquipment(); UiAnimMgr.instance.PlayAnim("FlameGlowPulse", abilityDisplay.transform, Vector3.zero, 1f, 0f); } } } } }
public void InitFollowerList() { FollowerListItem[] componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true); foreach (FollowerListItem followerListItem in componentsInChildren) { if (!PersistentFollowerData.followerDictionary.ContainsKey(followerListItem.m_followerID)) { followerListItem.gameObject.SetActive(false); followerListItem.transform.SetParent(Main.instance.transform); } else { WrapperGarrisonFollower follower = PersistentFollowerData.followerDictionary[followerListItem.m_followerID]; bool flag = (follower.Flags & 8) != 0; if (flag && follower.Durability <= 0) { followerListItem.gameObject.SetActive(false); followerListItem.transform.SetParent(Main.instance.transform); } else { followerListItem.SetFollower(follower); } } } this.m_followerListViewContents.transform.localPosition = new Vector3(this.m_followerListViewContents.transform.localPosition.x, 0f, this.m_followerListViewContents.transform.localPosition.z); this.SortFollowerListData(); componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true); foreach (KeyValuePair <int, WrapperGarrisonFollower> keyValuePair in this.m_sortedFollowerList) { bool flag2 = false; foreach (FollowerListItem followerListItem2 in componentsInChildren) { if (followerListItem2.m_followerID == keyValuePair.Value.GarrFollowerID) { flag2 = true; break; } } if (!flag2) { bool flag3 = (keyValuePair.Value.Flags & 8) != 0; if (!flag3 || keyValuePair.Value.Durability > 0) { this.InsertFollowerIntoListView(keyValuePair.Value); } } } }
public static FollowerCanCounterMechanic HasFollowerWhoCanCounter(int garrMechanicTypeID) { FollowerCanCounterMechanic followerCanCounterMechanic; bool flag = false; Dictionary <int, WrapperGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { WrapperGarrisonFollower current = enumerator.Current; for (int i = 0; i < current.AbilityIDs.Count; i++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(current.AbilityIDs[i]); if (record == null) { Debug.Log(string.Concat(new object[] { "Invalid Ability ID ", current.AbilityIDs[i], " from follower ", current.GarrFollowerID })); } else if ((record.Flags & 1) == 0) { IEnumerable <GarrAbilityEffectRec> recordsByParentID = from garrAbilityEffectRec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID) where (garrAbilityEffectRec.GarrMechanicTypeID == 0 || garrAbilityEffectRec.AbilityAction != 0 ? false : (long)garrMechanicTypeID == (ulong)garrAbilityEffectRec.GarrMechanicTypeID) select garrAbilityEffectRec; if (!recordsByParentID.Any <GarrAbilityEffectRec>((GarrAbilityEffectRec garrAbilityEffectRec) => ((current.Flags & 4) != 0 || (current.Flags & 2) != 0 || current.CurrentMissionID != 0 ? 1 : (int)(current.CurrentBuildingID != 0)) == 0)) { flag = flag | recordsByParentID.Count <GarrAbilityEffectRec>() > 0; } else { followerCanCounterMechanic = FollowerCanCounterMechanic.yesAndAvailable; return(followerCanCounterMechanic); } } } } if (flag) { return(FollowerCanCounterMechanic.yesButBusy); } return(FollowerCanCounterMechanic.no); } finally { ((IDisposable)enumerator).Dispose(); } return(followerCanCounterMechanic); }
public void SetCombatAllyChampion(WrapperGarrisonFollower follower, int garrMissionID, int missionCost) { this.m_combatAllyMissionID = garrMissionID; this.m_combatAllyChampion = new WrapperGarrisonFollower?(follower); this.m_combatAllyAbilityDisplay.SetSpell(this.m_combatAllyChampion.Value.ZoneSupportSpellID); this.m_combatAllySlot.SetFollower(follower.GarrFollowerID); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); CreatureRec creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE ? record.HordeCreatureID : record.AllianceCreatureID)); if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0) { this.m_combatAllyName.text = record.TitleName; } else if (record != null) { this.m_combatAllyName.text = creatureRec.Name; } Text mCombatAllyName = this.m_combatAllyName; WrapperGarrisonFollower value = this.m_combatAllyChampion.Value; mCombatAllyName.color = GeneralHelpers.GetQualityColor(value.Quality); if (missionCost > GarrisonStatus.WarResources()) { this.m_useItemButtonLabel.text = StaticDB.GetString("CANT_AFFORD", "Can't Afford"); this.m_useItemButtonLabel.color = Color.red; this.m_useItemButton.interactable = false; } else { this.m_useItemButtonLabel.text = StaticDB.GetString("ASSIGN_CHAMPION", null); } int numActiveChampions = GeneralHelpers.GetNumActiveChampions(); int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers(); this.m_isOverMaxChampionSoftCap = false; this.m_needMoreResources = false; if (numActiveChampions > maxActiveFollowers) { this.m_isOverMaxChampionSoftCap = true; } if (GarrisonStatus.WarResources() < missionCost) { this.m_needMoreResources = true; } this.SetCombatAllyAvailabilityStatus(); }
private void SetTroopSlotForExistingFollower(TroopSlot[] troopSlots, WrapperGarrisonFollower follower) { if (follower.Durability <= 0) { return; } foreach (TroopSlot troopSlot in troopSlots) { int ownedFollowerID = troopSlot.GetOwnedFollowerID(); if (ownedFollowerID != 0 && ownedFollowerID == follower.GarrFollowerID) { return; } } foreach (TroopSlot troopSlot2 in troopSlots) { if (troopSlot2.IsCollected()) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int iconFileDataID = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID; troopSlot2.SetCharShipment(this.m_charShipmentRec.ID, 0UL, follower.GarrFollowerID, false, iconFileDataID); return; } } foreach (TroopSlot troopSlot3 in troopSlots) { if (troopSlot3.IsPendingCreate()) { GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int iconFileDataID2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record2.AllianceIconFileDataID : record2.HordeIconFileDataID; troopSlot3.SetCharShipment(this.m_charShipmentRec.ID, 0UL, follower.GarrFollowerID, false, iconFileDataID2); return; } } foreach (TroopSlot troopSlot4 in troopSlots) { if (troopSlot4.IsEmpty()) { GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int iconFileDataID3 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record3.AllianceIconFileDataID : record3.HordeIconFileDataID; troopSlot4.SetCharShipment(this.m_charShipmentRec.ID, 0UL, follower.GarrFollowerID, false, iconFileDataID3); return; } } }
private void SetCombatAllyAvailabilityStatus() { WrapperGarrisonFollower value = this.m_combatAllyChampion.Value; bool flags = (value.Flags & 4) != 0; WrapperGarrisonFollower wrapperGarrisonFollower = this.m_combatAllyChampion.Value; bool flag = (wrapperGarrisonFollower.Flags & 2) != 0; bool currentMissionID = this.m_combatAllyChampion.Value.CurrentMissionID != 0; bool currentBuildingID = this.m_combatAllyChampion.Value.CurrentBuildingID != 0; if ((flags || flag || currentMissionID ? 1 : (int)currentBuildingID) == 0) { this.m_combatAllyStatus.gameObject.SetActive(false); this.m_combatAllyUnavailableDarkener.gameObject.SetActive(false); this.m_mainButton.enabled = true; this.m_expandArrow.SetActive(true); return; } this.m_combatAllyStatus.gameObject.SetActive(true); this.m_combatAllyUnavailableDarkener.gameObject.SetActive(true); this.m_mainButton.enabled = false; this.m_expandArrow.SetActive(false); if (flags) { this.m_combatAllyStatus.color = Color.red; this.m_combatAllyStatus.text = FollowerInventoryListItem.m_inactiveString; this.m_combatAllyUnavailableDarkener.color = new Color(1f, 0.4f, 0.4f, 1f); } else if (flag) { this.m_combatAllyStatus.text = FollowerInventoryListItem.m_fatiguedString; this.m_combatAllyUnavailableDarkener.color = new Color(0.4f, 0.4f, 1f, 1f); } else if (currentMissionID) { this.m_combatAllyStatus.text = FollowerInventoryListItem.m_onMissionString; this.m_combatAllyUnavailableDarkener.color = new Color(0.4f, 0.4f, 1f, 1f); } else if (currentBuildingID) { this.m_combatAllyStatus.text = FollowerInventoryListItem.m_inBuildingString; this.m_combatAllyUnavailableDarkener.color = new Color(0.4f, 0.4f, 1f, 1f); } }
public static FollowerStatus GetFollowerStatus(WrapperGarrisonFollower follower) { if ((follower.Flags & 4) != 0) { return(FollowerStatus.inactive); } if ((follower.Flags & 2) != 0) { return(FollowerStatus.fatigued); } if (follower.CurrentBuildingID != 0) { return(FollowerStatus.inBuilding); } if (follower.CurrentMissionID != 0) { return(FollowerStatus.onMission); } return(FollowerStatus.available); }
public void InitHeartPanel() { if (this.m_heartPanel == null || this.m_garrFollowerRec == null) { return; } Image[] componentsInChildren = this.m_heartArea.GetComponentsInChildren<Image>(true); foreach (Image image in componentsInChildren) { if (image != null && image.gameObject != this.m_heartArea) { image.transform.SetParent(null); Object.Destroy(image.gameObject); } } WrapperGarrisonFollower wrapperGarrisonFollower = this.m_follower; if (PersistentFollowerData.preMissionFollowerDictionary.ContainsKey(this.m_follower.GarrFollowerID)) { wrapperGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary[this.m_follower.GarrFollowerID]; } int num = 1; if (GeneralHelpers.MissionHasUncounteredDeadly(this.m_enemyPortraitsGroup)) { num = wrapperGarrisonFollower.Durability; } for (int j = 0; j < wrapperGarrisonFollower.Durability - num; j++) { GameObject gameObject = Object.Instantiate<GameObject>(this.m_fullHeartPrefab); gameObject.transform.SetParent(this.m_heartArea.transform, false); } for (int k = 0; k < num; k++) { GameObject gameObject2 = Object.Instantiate<GameObject>(this.m_outlineHeartPrefab); gameObject2.transform.SetParent(this.m_heartArea.transform, false); } for (int l = 0; l < (int)this.m_garrFollowerRec.Vitality - wrapperGarrisonFollower.Durability; l++) { GameObject gameObject3 = Object.Instantiate<GameObject>(this.m_emptyHeartPrefab); gameObject3.transform.SetParent(this.m_heartArea.transform, false); } }
private void UpdateChampionButtons(WrapperGarrisonFollower follower) { if (this.m_activateChampionButton == null || this.m_deactivateChampionButton == null) { return; } if ((follower.Flags & 8) == 0) { bool flags = (follower.Flags & 4) != 0; bool remainingFollowerActivations = GarrisonStatus.GetRemainingFollowerActivations() > 0; this.m_activateChampionButton.SetActive((!flags ? false : remainingFollowerActivations)); int numActiveChampions = GeneralHelpers.GetNumActiveChampions(); int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers(); bool currentMissionID = follower.CurrentMissionID != 0; this.m_deactivateChampionButton.SetActive((flags || currentMissionID ? false : numActiveChampions > maxActiveFollowers)); } else { this.m_activateChampionButton.SetActive(false); this.m_deactivateChampionButton.SetActive(false); } }
private void InitEquipmentSlots(WrapperGarrisonFollower follower) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { UnityEngine.Object.Destroy(componentsInChildren[i].gameObject); } bool flag = false; for (int j = 0; j < follower.AbilityIDs.Count; j++) { if ((StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[j]).Flags & 1) != 0) { flag = true; GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab); gameObject.transform.SetParent(this.m_equipmentSlotsRootObject.transform, false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(follower.AbilityIDs[j], true, true, this); } } this.m_equipmentSlotsText.gameObject.SetActive(flag); }
public void OnPartyBuffSectionTapped() { List <int> list = new List <int>(); MissionFollowerSlot[] componentsInChildren = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); List <WrapperGarrisonFollower> list2 = new List <WrapperGarrisonFollower>(); for (int i = 0; i < componentsInChildren.Length; i++) { int currentGarrFollowerID = componentsInChildren[i].GetCurrentGarrFollowerID(); if (PersistentFollowerData.followerDictionary.ContainsKey(currentGarrFollowerID)) { WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[currentGarrFollowerID]; list2.Add(item); } } GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(this.m_garrMissionID); if (record == null) { return; } int adjustedMissionDuration = GeneralHelpers.GetAdjustedMissionDuration(record, list2, this.enemyPortraitsGroup); foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren) { int currentGarrFollowerID2 = missionFollowerSlot.GetCurrentGarrFollowerID(); if (currentGarrFollowerID2 != 0) { int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(currentGarrFollowerID2, this.m_garrMissionID, this.missionFollowerSlotGroup, adjustedMissionDuration); foreach (int item2 in buffsForCurrentMission) { list.Add(item2); } } } AllPopups.instance.ShowPartyBuffsPopup(list.ToArray()); }
private void UpdateChampionButtons(WrapperGarrisonFollower follower) { if (this.m_activateChampionButton == null || this.m_deactivateChampionButton == null) { return; } bool flag = (follower.Flags & 8) != 0; if (flag) { this.m_activateChampionButton.SetActive(false); this.m_deactivateChampionButton.SetActive(false); } else { bool flag2 = (follower.Flags & 4) != 0; bool flag3 = GarrisonStatus.GetRemainingFollowerActivations() > 0; this.m_activateChampionButton.SetActive(flag2 && flag3); int numActiveChampions = GeneralHelpers.GetNumActiveChampions(); int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers(); bool flag4 = follower.CurrentMissionID != 0; this.m_deactivateChampionButton.SetActive(!flag2 && !flag4 && numActiveChampions > maxActiveFollowers); } }