private string GetAffectedUnit() { string[] effectUids = this.selectedEquipment.EffectUids; if (effectUids != null) { StaticDataController staticDataController = Service.StaticDataController; int i = 0; int num = effectUids.Length; while (i < num) { EquipmentEffectVO equipmentEffectVO = staticDataController.Get <EquipmentEffectVO>(effectUids[i]); if (equipmentEffectVO.AffectedTroopIds != null && equipmentEffectVO.AffectedTroopIds.Length > 0) { return(this.lang.Get("trp_title_" + equipmentEffectVO.AffectedTroopIds[0], new object[0])); } if (equipmentEffectVO.AffectedSpecialAttackIds != null && equipmentEffectVO.AffectedSpecialAttackIds.Length > 0) { return(this.lang.Get("shp_title_" + equipmentEffectVO.AffectedSpecialAttackIds[0], new object[0])); } if (equipmentEffectVO.AffectedBuildingIds != null && equipmentEffectVO.AffectedBuildingIds.Length > 0) { return(this.lang.Get("bld_title_" + equipmentEffectVO.AffectedBuildingIds[0], new object[0])); } i++; } } return(null); }
private void ApplySpecialAttackEquipmentBuffs(SpecialAttack specialAttack) { StaticDataController staticDataController = Service.StaticDataController; List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(specialAttack.TeamType); int num = (equipmentBuffsForTeam == null) ? 0 : equipmentBuffsForTeam.Count; for (int i = 0; i < num; i++) { EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i]; if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedSpecialAttackIds != null) { int j = 0; int num2 = equipmentEffectVO.AffectedSpecialAttackIds.Length; while (j < num2) { if (equipmentEffectVO.AffectedSpecialAttackIds[j] == specialAttack.VO.SpecialAttackID) { int k = 0; int num3 = equipmentEffectVO.BuffUids.Length; while (k < num3) { BuffTypeVO buffVO = staticDataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]); specialAttack.AddAppliedBuff(buffVO, BuffVisualPriority.Equipment); k++; } break; } j++; } } } }
private static void AddEquipmentAssets(List <string> equipment, List <IAssetVO> assets, IDataController dc) { if (equipment != null) { int i = 0; int count = equipment.Count; while (i < count) { EquipmentVO equipmentVO = dc.Get <EquipmentVO>(equipment[i]); string[] effectUids = equipmentVO.EffectUids; if (effectUids != null) { int j = 0; int num = effectUids.Length; while (j < num) { EquipmentEffectVO equipmentEffectVO = dc.Get <EquipmentEffectVO>(effectUids[j]); string[] buffUids = equipmentEffectVO.BuffUids; if (buffUids != null) { int k = 0; int num2 = buffUids.Length; while (k < num2) { ProjectileUtils.AddBuffProjectileAssets(buffUids[k], assets, dc); k++; } } j++; } } i++; } } }
public static void AddEquipmentBuffs(List <string> attackerEquipment, List <string> defenderEquipment) { BuffController buffController = Service.BuffController; buffController.ClearEquipmentBuffs(); StaticDataController staticDataController = Service.StaticDataController; if (attackerEquipment != null) { int i = 0; int count = attackerEquipment.Count; while (i < count) { EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(attackerEquipment[i]); string[] effectUids = equipmentVO.EffectUids; if (effectUids != null) { int j = 0; int num = effectUids.Length; while (j < num) { EquipmentEffectVO effectVO = staticDataController.Get <EquipmentEffectVO>(effectUids[j]); buffController.AddAttackerEquipmentBuff(effectVO); j++; } } i++; } } if (defenderEquipment != null) { int k = 0; int count2 = defenderEquipment.Count; while (k < count2) { EquipmentVO equipmentVO2 = staticDataController.Get <EquipmentVO>(defenderEquipment[k]); string[] effectUids2 = equipmentVO2.EffectUids; if (effectUids2 != null) { int l = 0; int num2 = effectUids2.Length; while (l < num2) { EquipmentEffectVO effectVO2 = staticDataController.Get <EquipmentEffectVO>(effectUids2[l]); buffController.AddDefenderEquipmentBuff(effectVO2); l++; } } k++; } } }
private static string GetEquipmentBuildingShaderName(EquipmentVO equipmentVO) { StaticDataController staticDataController = Service.StaticDataController; string text = string.Empty; if (!string.IsNullOrEmpty(equipmentVO.BuildingID)) { string uid = equipmentVO.EffectUids[0]; EquipmentEffectVO equipmentEffectVO = staticDataController.Get <EquipmentEffectVO>(uid); string uid2 = equipmentEffectVO.BuffUids[0]; BuffTypeVO buffTypeVO = staticDataController.Get <BuffTypeVO>(uid2); text = buffTypeVO.ShaderName; if (text.StartsWith("PL_2")) { text = text.Replace("PL_2", string.Empty); } } return(text); }
private bool IsEquipmentActiveOnDeployable(StaticDataController sdc, string deployableUid) { CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); List <string> list = (currentBattle.Type != BattleType.PveDefend) ? currentBattle.AttackerEquipment : currentBattle.DefenderEquipment; if (list == null) { return(false); } if (deployableUid.Equals("squadTroops")) { return(false); } string b = (!this.IsStarship) ? sdc.Get <TroopTypeVO>(deployableUid).TroopID : sdc.Get <SpecialAttackTypeVO>(deployableUid).SpecialAttackID; int i = 0; int count = list.Count; while (i < count) { EquipmentVO equipmentVO = sdc.Get <EquipmentVO>(list[i]); for (int j = 0; j < equipmentVO.EffectUids.Length; j++) { EquipmentEffectVO equipmentEffectVO = sdc.Get <EquipmentEffectVO>(equipmentVO.EffectUids[j]); string[] array = (!this.IsStarship) ? equipmentEffectVO.AffectedTroopIds : equipmentEffectVO.AffectedSpecialAttackIds; if (array != null) { for (int k = 0; k < array.Length; k++) { if (array[k] == b) { return(true); } } } } i++; } return(false); }
private void ApplyBuildingEquipmentBuffs(SmartEntity entity) { if (entity.TeamComp == null || entity.BuildingComp == null) { return; } StaticDataController staticDataController = Service.StaticDataController; List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(entity.TeamComp.TeamType); int num = (equipmentBuffsForTeam == null) ? 0 : equipmentBuffsForTeam.Count; for (int i = 0; i < num; i++) { EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i]; if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedBuildingIds != null) { string buildingID = entity.BuildingComp.BuildingType.BuildingID; int j = 0; int num2 = equipmentEffectVO.AffectedBuildingIds.Length; while (j < num2) { if (equipmentEffectVO.AffectedBuildingIds[j] == buildingID) { int k = 0; int num3 = equipmentEffectVO.BuffUids.Length; while (k < num3) { BuffTypeVO buffType = staticDataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]); this.TryAddBuffStack(entity, buffType, GameUtils.DeduceArmorType(entity), BuffVisualPriority.Equipment, entity); k++; } break; } j++; } } } }
private void ApplyTroopEquipmentBuffs(SmartEntity entity) { if (entity.TeamComp == null || entity.TroopComp == null) { return; } IDataController dataController = Service.Get <IDataController>(); List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(entity.TeamComp.TeamType); int num = (equipmentBuffsForTeam != null) ? equipmentBuffsForTeam.Count : 0; for (int i = 0; i < num; i++) { EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i]; if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedTroopIds != null) { string troopID = entity.TroopComp.TroopType.TroopID; int j = 0; int num2 = equipmentEffectVO.AffectedTroopIds.Length; while (j < num2) { if (equipmentEffectVO.AffectedTroopIds[j] == troopID) { int k = 0; int num3 = equipmentEffectVO.BuffUids.Length; while (k < num3) { BuffTypeVO buffType = dataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]); this.TryAddBuffStack(entity, buffType, BuffController.DeduceArmorType(entity), BuffVisualPriority.Equipment); k++; } break; } j++; } } } }
private void DisplayBarsForEquipmentBuffs(StaticDataController sdc) { int num = 1; int num2 = this.selectedEquipment.EffectUids.Length; int i = 0; int num3 = num2; while (i < num3) { EquipmentEffectVO equipmentEffectVO = sdc.Get <EquipmentEffectVO>(this.selectedEquipment.EffectUids[i]); EquipmentEffectVO equipmentEffectVO2 = null; if (this.nextEquipmentVoUpgrade != null && this.nextEquipmentVoUpgrade.EffectUids.Length > 0 && this.nextEquipmentVoUpgrade.EffectUids.Length > i) { equipmentEffectVO2 = sdc.Get <EquipmentEffectVO>(this.nextEquipmentVoUpgrade.EffectUids[i]); } ArmorType armorType = ArmorType.Invalid; if (equipmentEffectVO.AffectedBuildingIds != null && equipmentEffectVO.AffectedBuildingIds.Length > 0) { BuildingTypeVO minLevel = Service.BuildingUpgradeCatalog.GetMinLevel(equipmentEffectVO.AffectedBuildingIds[0]); if (minLevel != null) { armorType = minLevel.ArmorType; } } else if (equipmentEffectVO.AffectedTroopIds != null && equipmentEffectVO.AffectedTroopIds.Length > 0) { TroopTypeVO minLevel2 = Service.TroopUpgradeCatalog.GetMinLevel(equipmentEffectVO.AffectedTroopIds[0]); if (minLevel2 != null) { armorType = minLevel2.ArmorType; } } int j = 0; int num4 = equipmentEffectVO.BuffUids.Length; while (j < num4) { BuffTypeVO buffTypeVO = sdc.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[j]); BuffTypeVO buffTypeVO2 = null; if (equipmentEffectVO2 != null && equipmentEffectVO2.BuffUids.Length > 0 && equipmentEffectVO2.BuffUids.Length > j) { buffTypeVO2 = sdc.Get <BuffTypeVO>(equipmentEffectVO2.BuffUids[j]); } int num5 = buffTypeVO.Values[(int)armorType]; int nextValue = num5; if (ArmoryUtils.IsEquipmentOwned(Service.CurrentPlayer, this.selectedEquipment)) { nextValue = ((buffTypeVO2 != null) ? buffTypeVO2.Values[(int)armorType] : num5); } string buffString = this.GetBuffString(buffTypeVO.Modify); this.SetupBar(num, buffString, num5, nextValue, 1, false); num++; if (num >= 3) { break; } j++; } if (num >= 3) { break; } i++; } for (int k = num; k <= 3; k++) { base.GetElement <UXElement>(string.Format("pBar{0}", num)).Visible = false; num++; } }
private static void AddSummonableVisitorsToList(BattleInitializationData battleData, StaticDataController idc, List <IAssetVO> assets, SkinController sc) { List <string> list = new List <string>(); List <string> list2 = new List <string>(); List <string> list3 = new List <string>(); if (battleData.AttackerEquipment != null) { list3.AddRange(battleData.AttackerEquipment); } if (battleData.DefenderEquipment != null) { list3.AddRange(battleData.DefenderEquipment); } int count = list3.Count; for (int i = 0; i < count; i++) { EquipmentVO equipmentVO = idc.Get <EquipmentVO>(list3[i]); int num = equipmentVO.EffectUids.Length; for (int j = 0; j < num; j++) { EquipmentEffectVO equipmentEffectVO = idc.Get <EquipmentEffectVO>(equipmentVO.EffectUids[j]); int num2 = equipmentEffectVO.BuffUids.Length; for (int k = 0; k < num2; k++) { BuffTypeVO buffTypeVO = idc.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]); if (buffTypeVO.Modify == BuffModify.Summon) { SummonDetailsVO summonDetailsVO = idc.Get <SummonDetailsVO>(buffTypeVO.Details); int num3 = summonDetailsVO.VisitorUids.Length; for (int l = 0; l < num3; l++) { string item = summonDetailsVO.VisitorUids[l]; List <string> list4 = (summonDetailsVO.VisitorType != VisitorType.Troop) ? list2 : list; if (!list4.Contains(item)) { list4.Add(item); } } } } } } int m = 0; int count2 = list.Count; while (m < count2) { MapDataLoaderUtils.AddDeployableToList <TroopTypeVO>(list[m], 1, assets, list3, idc, sc); m++; } int n = 0; int count3 = list2.Count; while (n < count3) { MapDataLoaderUtils.AddDeployableToList <SpecialAttackTypeVO>(list2[n], 1, assets, list3, idc, sc); n++; } }
public void AddDefenderEquipmentBuff(EquipmentEffectVO effectVO) { this.defenderEquipmentBuffs.Add(effectVO); }
public void AddAttackerEquipmentBuff(EquipmentEffectVO effectVO) { this.attackerEquipmentBuffs.Add(effectVO); }
public bool IsEquipmentValidForTab(EquipmentVO vo, EquipmentTab selectedTab) { if (selectedTab == EquipmentTab.All) { return(true); } TroopUpgradeCatalog troopUpgradeCatalog = Service.Get <TroopUpgradeCatalog>(); IDataController dataController = Service.Get <IDataController>(); if (vo.EffectUids == null) { return(false); } int i = 0; int num = vo.EffectUids.Length; while (i < num) { EquipmentEffectVO optional = dataController.GetOptional <EquipmentEffectVO>(vo.EffectUids[i]); if (optional == null) { Service.Get <StaRTSLogger>().Error("CMS Error: EffectUids is empty for EquipmentEffectVO " + optional.Uid); return(false); } switch (selectedTab) { case EquipmentTab.Troops: if (optional.AffectedTroopIds != null && optional.AffectedTroopIds.Length != 0) { int j = 0; int num2 = optional.AffectedTroopIds.Length; while (j < num2) { if (troopUpgradeCatalog.GetMinLevel(optional.AffectedTroopIds[j]).Type != TroopType.Hero) { return(true); } j++; } } break; case EquipmentTab.Heroes: if (optional.AffectedTroopIds != null && optional.AffectedTroopIds.Length != 0) { int k = 0; int num3 = optional.AffectedTroopIds.Length; while (k < num3) { if (troopUpgradeCatalog.GetMinLevel(optional.AffectedTroopIds[k]).Type == TroopType.Hero) { return(true); } k++; } } break; case EquipmentTab.Structures: if (optional.AffectedBuildingIds != null && optional.AffectedBuildingIds.Length != 0) { return(true); } break; } i++; } return(false); }
public bool IsEquipmentValidForTab(EquipmentVO vo, EquipmentTab selectedTab) { if (selectedTab == EquipmentTab.All) { return(true); } TroopUpgradeCatalog troopUpgradeCatalog = Service.TroopUpgradeCatalog; StaticDataController staticDataController = Service.StaticDataController; if (vo.EffectUids == null) { return(false); } int i = 0; int num = vo.EffectUids.Length; while (i < num) { EquipmentEffectVO optional = staticDataController.GetOptional <EquipmentEffectVO>(vo.EffectUids[i]); if (optional == null) { Service.Logger.Error("CMS Error: EffectUids is empty for EquipmentEffectVO " + optional.Uid); return(false); } if (selectedTab != EquipmentTab.Structures) { if (selectedTab != EquipmentTab.Troops) { if (selectedTab == EquipmentTab.Heroes) { if (optional.AffectedTroopIds != null && optional.AffectedTroopIds.Length > 0) { int j = 0; int num2 = optional.AffectedTroopIds.Length; while (j < num2) { if (troopUpgradeCatalog.GetMinLevel(optional.AffectedTroopIds[j]).Type == TroopType.Hero) { return(true); } j++; } } } } else if (optional.AffectedTroopIds != null && optional.AffectedTroopIds.Length > 0) { int k = 0; int num3 = optional.AffectedTroopIds.Length; while (k < num3) { if (troopUpgradeCatalog.GetMinLevel(optional.AffectedTroopIds[k]).Type != TroopType.Hero) { return(true); } k++; } } } else if (optional.AffectedBuildingIds != null && optional.AffectedBuildingIds.Length > 0) { return(true); } i++; } return(false); }