private int GetMaxTroops(int garrClassSpecID) { GarrClassSpecRec record = StaticDB.garrClassSpecDB.GetRecord(garrClassSpecID); int followerClassLimit = 0; if (record != null) { followerClassLimit = (int)record.FollowerClassLimit; } foreach (WrapperGarrisonTalent value in PersistentTalentData.talentDictionary.Values) { if ((value.Flags & 1) == 0) { continue; } GarrTalentRec garrTalentRec = StaticDB.garrTalentDB.GetRecord(value.GarrTalentID); if (garrTalentRec == null) { continue; } foreach (GarrAbilityEffectRec garrAbilityEffectRec in from rec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID((int)garrTalentRec.GarrAbilityID) where (rec.AbilityAction != 34 ? false : (ulong)rec.ActionRecordID == (long)garrClassSpecID) select rec) { followerClassLimit += (int)garrAbilityEffectRec.ActionValueFlat; } } return(followerClassLimit); }
private int GetMaxTroops(int garrClassSpecID) { GarrClassSpecRec record = StaticDB.garrClassSpecDB.GetRecord(garrClassSpecID); int num = 0; if (record != null) { num = (int)record.FollowerClassLimit; } foreach (WrapperGarrisonTalent wrapperGarrisonTalent in PersistentTalentData.talentDictionary.Values) { if ((wrapperGarrisonTalent.Flags & 1) != 0) { GarrTalentRec record2 = StaticDB.garrTalentDB.GetRecord(wrapperGarrisonTalent.GarrTalentID); if (record2 != null) { foreach (GarrAbilityEffectRec garrAbilityEffectRec in from rec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID((int)record2.GarrAbilityID) where rec.AbilityAction == 34 && rec.ActionRecordID == garrClassSpecID select rec) { num += (int)garrAbilityEffectRec.ActionValueFlat; } } } } return(num); }
private int GetMaxTroops(int garrClassSpecID) { GarrClassSpecRec record = StaticDB.garrClassSpecDB.GetRecord(garrClassSpecID); int maxTroops = 0; if (record != null) { maxTroops = (int)record.FollowerClassLimit; } IEnumerator enumerator = PersistentTalentData.talentDictionary.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; JamGarrisonTalent jamGarrisonTalent = (JamGarrisonTalent)obj; if ((jamGarrisonTalent.Flags & 1) != 0) { GarrTalentRec record2 = StaticDB.garrTalentDB.GetRecord(jamGarrisonTalent.GarrTalentID); if (record2 != null) { StaticDB.garrAbilityEffectDB.EnumRecordsByParentID((int)record2.GarrAbilityID, delegate(GarrAbilityEffectRec effectRec) { if (effectRec.AbilityAction == 34u && (ulong)effectRec.ActionRecordID == (ulong)((long)garrClassSpecID)) { maxTroops += (int)effectRec.ActionValueFlat; } return(true); }); } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } return(maxTroops); }
public void SetFollower(JamGarrisonFollower follower) { this.m_followerID = follower.GarrFollowerID; this.followerIDText.text = string.Concat(new object[] { "ID:", follower.GarrFollowerID, " Q:", follower.Quality }); this.m_inParty = false; this.SetAvailabilityStatus(follower); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); if (record == null) { return; } if (record.GarrFollowerTypeID != 4u) { return; } if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0) { this.nameText.text = record.TitleName; } else if (record != null) { CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID); this.nameText.text = record2.Name; } this.m_levelText.text = string.Empty + follower.FollowerLevel; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID; Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, num); if (sprite != null) { this.followerPortrait.sprite = sprite; this.portraitErrorText.gameObject.SetActive(false); } else { this.portraitErrorText.text = string.Empty + num; this.portraitErrorText.gameObject.SetActive(true); } GarrClassSpecRec record3 = StaticDB.garrClassSpecDB.GetRecord((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID)); Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record3.UiTextureAtlasMemberID); if (atlasSprite != null) { this.m_classIcon.sprite = atlasSprite; } Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true); foreach (Transform transform in componentsInChildren) { if (transform != this.m_troopHeartContainer.transform) { Object.DestroyImmediate(transform.gameObject); } } bool flag = (follower.Flags & 8) != 0; if (flag) { this.m_portraitQualityRing.color = Color.white; this.m_levelBorder.color = Color.white; this.nameText.color = Color.white; int j; for (j = 0; j < follower.Durability; j++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } for (int k = j; k < record.Vitality; k++) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab); gameObject2.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_portraitQualityRing.gameObject.SetActive(false); this.m_portraitQualityRing_TitleQuality.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); this.m_levelBorder_TitleQuality.gameObject.SetActive(false); this.followerPortraitFrame.enabled = false; this.m_progressBarObj.SetActive(false); this.m_levelText.gameObject.SetActive(false); } else { this.m_levelText.gameObject.SetActive(true); if (follower.Quality == 6) { this.m_portraitQualityRing.gameObject.SetActive(false); this.m_portraitQualityRing_TitleQuality.gameObject.SetActive(true); this.m_levelBorder.gameObject.SetActive(false); this.m_levelBorder_TitleQuality.gameObject.SetActive(true); } else { this.m_portraitQualityRing.gameObject.SetActive(true); this.m_portraitQualityRing_TitleQuality.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(true); this.m_levelBorder_TitleQuality.gameObject.SetActive(false); } Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality); this.m_portraitQualityRing.color = qualityColor; this.m_levelBorder.color = qualityColor; if (follower.Quality <= 1) { this.nameText.color = Color.white; } else { this.nameText.color = qualityColor; } uint num2; bool flag2; bool flag3; GeneralHelpers.GetXpCapInfo(follower.FollowerLevel, follower.Quality, out num2, out flag2, out flag3); if (flag3) { this.m_progressBarObj.SetActive(false); } else { this.m_progressBarObj.SetActive(true); float fillAmount = Mathf.Clamp01((float)follower.Xp / num2); this.m_progressBarFillImage.fillAmount = fillAmount; this.m_xpAmountText.text = string.Concat(new object[] { string.Empty, follower.Xp, "/", num2 }); } } }
private void SetFollowerAppearance(JamGarrisonFollower follower, bool nextCapIsForQuality, bool isMaxLevelAndMaxQuality, bool isTroop, float initialEntranceDelay) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); this.m_troopHeartContainerEmpty.SetActive(isTroop); this.m_troopHeartContainerFull.SetActive(isTroop); this.m_expiredPortraitX.SetActive(false); if (isTroop) { this.m_levelBorder.get_gameObject().SetActive(false); this.m_progressBarObj.SetActive(false); this.m_portraitBG.get_gameObject().SetActive(false); this.m_troopHeartContainerEmpty.SetActive(true); this.m_troopHeartContainerFull.SetActive(true); Transform[] componentsInChildren = this.m_troopHeartContainerEmpty.GetComponentsInChildren <Transform>(true); Transform[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Transform transform = array[i]; if (transform != this.m_troopHeartContainerEmpty.get_transform()) { Object.DestroyImmediate(transform.get_gameObject()); } } Transform[] componentsInChildren2 = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(true); Transform[] array2 = componentsInChildren2; for (int j = 0; j < array2.Length; j++) { Transform transform2 = array2[j]; if (transform2 != this.m_troopHeartContainerFull.get_transform()) { Object.DestroyImmediate(transform2.get_gameObject()); } } float num = 0.15f; JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary.get_Item(follower.GarrFollowerID); for (int k = 0; k < jamGarrisonFollower.Durability; k++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.get_transform().SetParent(this.m_troopHeartContainerFull.get_transform(), false); if (k >= follower.Durability) { float num2 = initialEntranceDelay + (float)(jamGarrisonFollower.Durability - (k - follower.Durability)) * num; float num3 = 2f; iTween.ValueTo(gameObject, iTween.Hash(new object[] { "name", "fade", "from", 0f, "to", 1f, "time", num3, "easetype", iTween.EaseType.easeOutCubic, "delay", num2, "onupdatetarget", gameObject, "onupdate", "SetHeartEffectProgress", "oncomplete", "FinishHeartEffect" })); } } for (int l = 0; l < record.Vitality; l++) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab); gameObject2.get_transform().SetParent(this.m_troopHeartContainerEmpty.get_transform(), false); } if (follower.Durability <= 0) { DelayedUIAnim delayedUIAnim = base.get_gameObject().AddComponent <DelayedUIAnim>(); float num4 = initialEntranceDelay + (float)(jamGarrisonFollower.Durability - follower.Durability) * num + 1f; delayedUIAnim.Init(num4, "RedFailX", "SFX/UI_Mission_Fail_Red_X", this.m_followerPortrait.get_transform(), 1.5f); DelayedObjectEnable delayedObjectEnable = base.get_gameObject().AddComponent <DelayedObjectEnable>(); delayedObjectEnable.Init(num4 + 0.25f, this.m_expiredPortraitX); } } int iconFileDataID = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID; Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, iconFileDataID); if (sprite != null) { this.m_followerPortrait.set_sprite(sprite); } if (isTroop) { this.m_qualityBorder.get_gameObject().SetActive(false); this.m_levelBorder.get_gameObject().SetActive(false); this.m_followerNameText.set_color(Color.get_white()); } else { Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality); this.m_qualityBorder.set_color(qualityColor); this.m_levelBorder.set_color(qualityColor); this.m_followerNameText.set_color(qualityColor); } CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID); this.m_followerNameText.set_text(record2.Name); if (follower.FollowerLevel < 110) { this.m_iLevelText.set_text(StaticDB.GetString("LEVEL", null) + " " + follower.FollowerLevel); } else { this.m_iLevelText.set_text(StaticDB.GetString("ILVL", null) + " " + (follower.ItemLevelArmor + follower.ItemLevelWeapon) / 2); } GarrClassSpecRec record3 = StaticDB.garrClassSpecDB.GetRecord((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID)); this.m_classText.set_text(record3.ClassSpec); Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record3.UiTextureAtlasMemberID); if (atlasSprite != null) { this.m_classIcon.set_sprite(atlasSprite); } if (!isTroop) { if (isMaxLevelAndMaxQuality) { this.m_progressBarObj.SetActive(false); this.m_toNextLevelOrUpgradeText.set_text(string.Empty); } else if (nextCapIsForQuality) { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.set_text(StaticDB.GetString("TO_NEXT_UPGRADE", string.Empty)); } else { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.set_text(StaticDB.GetString("TO_NEXT_LEVEL", string.Empty)); } } }
public void SetAvailabilityStatus(WrapperGarrisonFollower follower) { GarrMissionRec record; int num; this.m_isCombatAlly = false; if (follower.CurrentMissionID != 0) { WrapperGarrisonMission item = PersistentMissionData.missionDictionary[follower.CurrentMissionID]; this.m_missionStartedTime = item.StartTime; this.m_missionDuration = item.MissionDuration; } bool flags = (follower.Flags & 4) != 0; bool flag = (follower.Flags & 2) != 0; this.m_onMission = follower.CurrentMissionID != 0; bool currentBuildingID = follower.CurrentBuildingID != 0; bool flags1 = (follower.Flags & 8) != 0; if (!this.m_onMission) { record = null; } else { record = StaticDB.garrMissionDB.GetRecord(follower.CurrentMissionID); } GarrMissionRec garrMissionRec = record; if (garrMissionRec != null && (garrMissionRec.Flags & 16) != 0) { this.m_isCombatAlly = true; } this.m_statusText.gameObject.SetActive(true); this.darkeningImage.gameObject.SetActive(true); this.m_statusText.color = Color.white; this.m_troopHeartContainer.SetActive(false); if (flags) { this.m_statusText.color = Color.red; if (follower.FollowerLevel != 110) { this.m_statusText.text = FollowerListItem.m_inactiveString; } } else if (flag) { this.m_statusText.text = FollowerListItem.m_fatiguedString; } else if (this.m_isCombatAlly) { this.m_statusText.text = FollowerListItem.m_combatAllyString; } else if (this.m_onMission) { this.m_statusText.text = FollowerListItem.m_onMissionString; } else if (currentBuildingID) { this.m_statusText.text = FollowerListItem.m_inBuildingString; } else if (!this.m_inParty) { GarrFollowerRec garrFollowerRec = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? (int)garrFollowerRec.AllianceGarrClassSpecID : (int)garrFollowerRec.HordeGarrClassSpecID); GarrClassSpecRec garrClassSpecRec = StaticDB.garrClassSpecDB.GetRecord(num); if (flags1) { this.m_statusText.text = string.Empty; this.m_statusText.gameObject.SetActive(false); this.m_troopHeartContainer.SetActive(true); } else { this.m_statusText.text = garrClassSpecRec.ClassSpec; } this.darkeningImage.gameObject.SetActive(false); } else { this.m_statusText.text = FollowerListItem.m_inPartyString; } this.m_availableForMission = (flags || flag || this.m_onMission ? 1 : (int)currentBuildingID) == 0; }
public void SetAvailabilityStatus(WrapperGarrisonFollower follower) { this.m_isCombatAlly = false; if (follower.CurrentMissionID != 0) { WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[follower.CurrentMissionID]; this.m_missionStartedTime = wrapperGarrisonMission.StartTime; this.m_missionDuration = wrapperGarrisonMission.MissionDuration; } bool flag = (follower.Flags & 4) != 0; bool flag2 = (follower.Flags & 2) != 0; this.m_onMission = (follower.CurrentMissionID != 0); bool flag3 = follower.CurrentBuildingID != 0; bool flag4 = (follower.Flags & 8) != 0; GarrMissionRec garrMissionRec = (!this.m_onMission) ? null : StaticDB.garrMissionDB.GetRecord(follower.CurrentMissionID); if (garrMissionRec != null && (garrMissionRec.Flags & 16u) != 0u) { this.m_isCombatAlly = true; } this.m_statusText.gameObject.SetActive(true); this.darkeningImage.gameObject.SetActive(true); this.m_statusText.color = Color.white; this.m_troopHeartContainer.SetActive(false); if (flag) { this.m_statusText.color = Color.red; if (follower.FollowerLevel != 110) { this.m_statusText.text = FollowerListItem.m_inactiveString; } } else if (flag2) { this.m_statusText.text = FollowerListItem.m_fatiguedString; } else if (this.m_isCombatAlly) { this.m_statusText.text = FollowerListItem.m_combatAllyString; } else if (this.m_onMission) { this.m_statusText.text = FollowerListItem.m_onMissionString; } else if (flag3) { this.m_statusText.text = FollowerListItem.m_inBuildingString; } else if (this.m_inParty) { this.m_statusText.text = FollowerListItem.m_inPartyString; } else { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int key = (int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID); GarrClassSpecRec record2 = StaticDB.garrClassSpecDB.GetRecord(key); if (!flag4) { this.m_statusText.text = record2.ClassSpec; } else { this.m_statusText.text = string.Empty; this.m_statusText.gameObject.SetActive(false); this.m_troopHeartContainer.SetActive(true); } this.darkeningImage.gameObject.SetActive(false); } this.m_availableForMission = (!flag && !flag2 && !this.m_onMission && !flag3); }
private void SetFollowerAppearance(WrapperGarrisonFollower follower, bool nextCapIsForQuality, bool isMaxLevelAndMaxQuality, bool isTroop, float initialEntranceDelay) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); this.m_troopHeartContainerEmpty.SetActive(isTroop); this.m_troopHeartContainerFull.SetActive(isTroop); this.m_expiredPortraitX.SetActive(false); if (isTroop) { this.m_levelBorder.gameObject.SetActive(false); this.m_progressBarObj.SetActive(false); this.m_portraitBG.gameObject.SetActive(false); this.m_troopHeartContainerEmpty.SetActive(true); this.m_troopHeartContainerFull.SetActive(true); Transform[] componentsInChildren = this.m_troopHeartContainerEmpty.GetComponentsInChildren <Transform>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { Transform transforms = componentsInChildren[i]; if (transforms != this.m_troopHeartContainerEmpty.transform) { UnityEngine.Object.Destroy(transforms.gameObject); } } Transform[] transformArrays = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(true); for (int j = 0; j < (int)transformArrays.Length; j++) { Transform transforms1 = transformArrays[j]; if (transforms1 != this.m_troopHeartContainerFull.transform) { UnityEngine.Object.Destroy(transforms1.gameObject); } } float single = 0.15f; WrapperGarrisonFollower item = PersistentFollowerData.preMissionFollowerDictionary[follower.GarrFollowerID]; for (int k = 0; k < item.Durability; k++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainerFull.transform, false); if (k >= follower.Durability) { float single1 = initialEntranceDelay + (float)(item.Durability - (k - follower.Durability)) * single; float single2 = 2f; iTween.ValueTo(gameObject, iTween.Hash(new object[] { "name", "fade", "from", 0f, "to", 1f, "time", single2, "easetype", iTween.EaseType.easeOutCubic, "delay", single1, "onupdatetarget", gameObject, "onupdate", "SetHeartEffectProgress", "oncomplete", "FinishHeartEffect" })); } } for (int l = 0; l < record.Vitality; l++) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab); gameObject1.transform.SetParent(this.m_troopHeartContainerEmpty.transform, false); } if (follower.Durability <= 0) { DelayedUIAnim delayedUIAnim = base.gameObject.AddComponent <DelayedUIAnim>(); float single3 = initialEntranceDelay + (float)(item.Durability - follower.Durability) * single + 1f; delayedUIAnim.Init(single3, "RedFailX", "SFX/UI_Mission_Fail_Red_X", this.m_followerPortrait.transform, 1.5f, 0.3f); DelayedObjectEnable delayedObjectEnable = base.gameObject.AddComponent <DelayedObjectEnable>(); delayedObjectEnable.Init(single3 + 0.25f, this.m_expiredPortraitX); } } Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceIconFileDataID : record.HordeIconFileDataID)); if (sprite != null) { this.m_followerPortrait.sprite = sprite; } if (!isTroop) { if (follower.Quality != 6) { this.m_qualityBorder.gameObject.SetActive(true); this.m_levelBorder.gameObject.SetActive(true); } else { this.m_qualityBorder.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); } Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality); this.m_qualityBorder.color = qualityColor; this.m_troopBackground.SetActive(false); this.m_followerBackground.SetActive(true); } else { this.m_qualityBorder.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); this.m_troopBackground.SetActive(true); this.m_followerBackground.SetActive(false); this.m_iLevelText.gameObject.SetActive(false); } CreatureRec creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID)); if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0) { this.m_followerNameText.text = record.TitleName; } else if (record != null) { this.m_followerNameText.text = creatureRec.Name; } this.m_iLevelText.text = follower.FollowerLevel.ToString(); GarrClassSpecRec garrClassSpecRec = StaticDB.garrClassSpecDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? (int)record.AllianceGarrClassSpecID : (int)record.HordeGarrClassSpecID)); this.m_classText.text = garrClassSpecRec.ClassSpec; if (!isTroop) { if (isMaxLevelAndMaxQuality) { this.m_progressBarObj.SetActive(false); this.m_toNextLevelOrUpgradeText.text = string.Empty; } else if (!nextCapIsForQuality) { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_LEVEL", string.Empty); } else { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_UPGRADE", string.Empty); } } }