private void RefreshActivePerksGrid() { if (this.activePerksGrid == null) { this.activePerksGrid = this.screen.GetElement <UXGrid>("GridActSlotsPerks"); this.activePerksGrid.SetTemplateItem("TemplateActSlotPerks"); } this.activePerkTimerLabels.Clear(); IDataController dataController = Service.Get <IDataController>(); Lang lang = Service.Get <Lang>(); PerkManager perkManager = Service.Get <PerkManager>(); List <ActivatedPerkData> playerActivePerks = perkManager.GetPlayerActivePerks(); Squad currentSquad = Service.Get <SquadController>().StateManager.GetCurrentSquad(); if (currentSquad == null) { return; } string squadLevelUIDFromSquad = GameUtils.GetSquadLevelUIDFromSquad(currentSquad); int availableSlotsCount = perkManager.GetAvailableSlotsCount(squadLevelUIDFromSquad); int squadLevelMax = perkManager.SquadLevelMax; List <UXElement> list = new List <UXElement>(); int num = -1; int i = 1; int num2 = 0; while (i <= squadLevelMax) { string squadLevelUIDFromLevel = GameUtils.GetSquadLevelUIDFromLevel(i); SquadLevelVO squadLevelVO = dataController.Get <SquadLevelVO>(squadLevelUIDFromLevel); int slots = squadLevelVO.Slots; if (num != slots) { bool flag = slots > availableSlotsCount; bool flag2 = num2 < playerActivePerks.Count && !flag; int level = squadLevelVO.Level; string itemUid = "PerkSlot_" + slots.ToString(); UXElement uXElement = base.FetchPerkGridItem(this.activePerksGrid, itemUid); UXElement subElement = this.activePerksGrid.GetSubElement <UXElement>(itemUid, "AvailableSlotGroupPerks"); UXLabel subElement2 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelAvActSlotPerks"); UXElement subElement3 = this.activePerksGrid.GetSubElement <UXElement>(itemUid, "ActivatedSlotGroupPerks"); UXElement subElement4 = this.activePerksGrid.GetSubElement <UXElement>(itemUid, "LockedSlotGroupPerks"); UXLabel subElement5 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelPerkTitleActSlotPerks"); UXLabel subElement6 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelPerkLvlActSlotPerks"); UXLabel subElement7 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelPerkMessageTimerActSlotPerks"); UXLabel subElement8 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelPerkTimerActSlotPerks"); UXButton subElement9 = this.activePerksGrid.GetSubElement <UXButton>(itemUid, "BtnRemoveActSlotPerks"); UXTexture subElement10 = this.activePerksGrid.GetSubElement <UXTexture>(itemUid, "TexturePerkArtActSlotPerks"); UXButton uXButton = uXElement as UXButton; if (flag) { uXButton.Enabled = false; subElement.Visible = false; subElement4.Visible = true; subElement3.Visible = false; subElement9.Visible = false; UXLabel subElement11 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelSquadLvlLockedSlotPerks"); subElement11.Text = level.ToString(); UXLabel subElement12 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelSquadLvlLockedSlotPerks"); subElement12.Text = lang.Get("PERK_ACTIVATE_UPGRADE_CARD_LVL_REQ", new object[] { level }); } else if (flag2) { subElement.Visible = false; subElement4.Visible = false; subElement3.Visible = true; subElement9.Visible = true; ActivatedPerkData activatedPerkData = playerActivePerks[num2++]; string perkId = activatedPerkData.PerkId; PerkViewController perkViewController = Service.Get <PerkViewController>(); PerkVO perkVO = dataController.Get <PerkVO>(perkId); subElement5.Text = perkViewController.GetPerkNameForGroup(perkVO.PerkGroup); subElement6.Text = StringUtils.GetRomanNumeral(perkVO.PerkTier); perkViewController.SetPerkImage(subElement10, perkVO); subElement7.Text = lang.Get("PERK_ACTIVE_SLOT_ACTIVE_TIMER_DESC", new object[0]); this.UpdateLabelTimeRemaining(subElement8, lang, "PERK_ACTIVE_SLOT_ACTIVE_TIMER", activatedPerkData.EndTime); subElement8.Tag = activatedPerkData; this.activePerkTimerLabels.Add(subElement8); uXButton.Enabled = true; uXButton.Tag = perkVO; uXButton.OnClicked = new UXButtonClickedDelegate(this.OnPerkSlotButtonClicked); subElement9.Tag = perkId; subElement9.Visible = true; subElement9.OnClicked = new UXButtonClickedDelegate(this.OnRemoveButtonClicked); } else { uXButton.Enabled = false; subElement4.Visible = false; subElement3.Visible = false; subElement9.Visible = false; subElement.Visible = true; subElement2.Text = lang.Get("PERK_ACTIVE_SLOT_TITLE", new object[0]); } list.Add(uXElement); num = slots; } i++; } this.activePerksGrid.ClearWithoutDestroy(); int j = 0; int count = list.Count; while (j < count) { this.activePerksGrid.AddItem(list[j], j); j++; } this.activePerksGrid.RepositionItems(); list.Clear(); }
public static int TransferPrizeFromInventory(PrizeType prizeType, string prizeID) { Lang lang = Service.Get <Lang>(); IDataController dataController = Service.Get <IDataController>(); CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); PrizeInventory prizes = currentPlayer.Prizes; Inventory inventory = currentPlayer.Inventory; InventoryStorage inventoryStorage = null; IUpgradeableVO finalUnitFromPrize = TimedEventPrizeUtils.GetFinalUnitFromPrize(prizeType, prizeID); string text = null; string text2 = null; string id = null; int result = 0; int num = 0; switch (prizeType) { case PrizeType.Currency: num = prizes.GetResourceAmount(prizeID); TimedEventPrizeUtils.GetCurrencyAmountToTransfer(prizeID, ref num, ref result); if (num > 0) { inventory.ModifyItemAmount(prizeID, num); prizes.ModifyResourceAmount(prizeID, -num); text = "INVENTORY_REWARD_USED_CURRENCY"; text2 = lang.Get(prizeID.ToUpper(), new object[0]); } else { id = "INVENTORY_NO_ROOM"; } break; case PrizeType.Infantry: case PrizeType.Vehicle: case PrizeType.Mercenary: inventoryStorage = inventory.Troop; if (inventoryStorage.GetTotalStorageCapacity() >= inventoryStorage.GetTotalStorageAmount() + finalUnitFromPrize.Size) { num = 1; inventoryStorage.ModifyItemAmount(finalUnitFromPrize.Uid, num); prizes.ModifyTroopAmount(prizeID, -num); text = "INVENTORY_REWARD_USED_TROOP"; text2 = LangUtils.GetTroopDisplayName((TroopTypeVO)finalUnitFromPrize); StorageSpreadUtils.UpdateAllStarportFullnessMeters(); } else { id = "NOT_ENOUGH_HOUSING"; } result = prizes.GetTroopAmount(prizeID); break; case PrizeType.Hero: inventoryStorage = inventory.Hero; if (!Service.Get <BuildingLookupController>().HasHeroCommand()) { id = "INVENTORY_NO_HERO_COMMAND"; } else if (inventoryStorage.GetTotalStorageCapacity() >= inventoryStorage.GetTotalStorageAmount() + finalUnitFromPrize.Size) { bool flag = false; foreach (KeyValuePair <string, InventoryEntry> current in inventoryStorage.GetInternalStorage()) { if (current.get_Value().Amount > 0) { TroopTypeVO troopTypeVO = dataController.Get <TroopTypeVO>(current.get_Key()); if (troopTypeVO.UpgradeGroup == finalUnitFromPrize.UpgradeGroup) { flag = true; break; } } } if (!flag) { flag = ContractUtils.HasExistingHeroContract(finalUnitFromPrize.UpgradeGroup); } if (!flag) { num = 1; inventoryStorage.ModifyItemAmount(finalUnitFromPrize.Uid, num); prizes.ModifyTroopAmount(prizeID, -num); text = "INVENTORY_REWARD_USED_HERO"; text2 = LangUtils.GetTroopDisplayName((TroopTypeVO)finalUnitFromPrize); Service.Get <EventManager>().SendEvent(EventId.HeroMobilizedFromPrize, finalUnitFromPrize.Uid); } else { id = "INVENTORY_NO_ROOM_HERO_IN_QUEUE"; } } else { id = "INVENTORY_NO_ROOM_HERO"; } result = prizes.GetTroopAmount(prizeID); break; case PrizeType.SpecialAttack: inventoryStorage = inventory.SpecialAttack; if (!Service.Get <BuildingLookupController>().HasStarshipCommand()) { id = "INVENTORY_NO_FLEET_COMMAND"; } else if (inventoryStorage.GetTotalStorageCapacity() >= inventoryStorage.GetTotalStorageAmount() + finalUnitFromPrize.Size) { num = 1; inventoryStorage.ModifyItemAmount(finalUnitFromPrize.Uid, num); prizes.ModifySpecialAttackAmount(prizeID, -num); text = "INVENTORY_REWARD_USED_TROOP"; text2 = LangUtils.GetStarshipDisplayName((SpecialAttackTypeVO)finalUnitFromPrize); Service.Get <EventManager>().SendEvent(EventId.StarshipMobilizedFromPrize, finalUnitFromPrize.Uid); } else { id = "NOT_ENOUGH_SPACE"; } result = prizes.GetSpecialAttackAmount(prizeID); break; } if (num > 0) { InventoryTransferRequest request = new InventoryTransferRequest(prizeID, num); Service.Get <ServerAPI>().Enqueue(new InventoryTransferCommand(request)); } else { string message = lang.Get(id, new object[0]); AlertScreen.ShowModal(false, null, message, null, null); } if (text != null) { string text3 = (prizeType == PrizeType.Hero) ? text2 : lang.Get("AMOUNT_AND_NAME", new object[] { num, text2 }); string instructions = lang.Get(text, new object[] { text3 }); Service.Get <UXController>().MiscElementsManager.ShowPlayerInstructions(instructions, 1f, 2f); } return(result); }
private void AddFeaturedRewardItemToGrid(PlanetLootEntryVO lootEntry, int order) { IDataController dataController = Service.Get <IDataController>(); InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>(); Lang lang = Service.Get <Lang>(); CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(lootEntry.SupplyDataUid); if (optional == null) { Service.Get <StaRTSLogger>().ErrorFormat("Couldn't find CrateSupplyVO: {0} specified in PlanetLootEntryVO: {1}", new object[] { lootEntry.SupplyDataUid, lootEntry.Uid }); return; } string uid = lootEntry.Uid; UXElement uXElement = this.rewardsGrid.CloneTemplateItem(uid); uXElement.Tag = lootEntry; UXLabel subElement = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardName"); subElement.Text = inventoryCrateRewardController.GetCrateSupplyRewardName(optional); UXUtils.ClampUILabelWidth(subElement, 200, 0); UXLabel subElement2 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelGate"); subElement2.Text = string.Empty; if (!string.IsNullOrEmpty(lootEntry.NotesString)) { subElement2.Text = lang.Get(lootEntry.NotesString, new object[0]); UXUtils.ClampUILabelWidth(subElement2, 200, 0); } for (int i = 1; i <= 3; i++) { string name = string.Format("RewardItemCardQ{0}", new object[] { i }); this.rewardsGrid.GetSubElement <UXElement>(uid, name).Visible = false; } this.rewardsGrid.GetSubElement <UXElement>(uid, "RewardItemDefault").Visible = false; this.rewardsGrid.GetSubElement <UXElement>(uid, "pBarRewardItemFrag").Visible = false; this.rewardsGrid.GetSubElement <UXElement>(uid, "IconUpgrade").Visible = false; UXLabel subElement3 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardTypeLootTimer"); UXUtils.ClampUILabelWidth(subElement3, 200, 0); bool flag = this.DoesLootEntryHaveCountdown(lootEntry); subElement3.Visible = flag; if (flag) { this.UpdateTimeRemainingLabel(lootEntry); } UXButton subElement4 = this.rewardsGrid.GetSubElement <UXButton>(uid, "BtnRewardInfo"); UXButton subElement5 = this.rewardsGrid.GetSubElement <UXButton>(uid, "BtnRewardItemCard"); subElement5.InitTweenComponent(); subElement4.Visible = false; if (optional.Type == SupplyType.Hero || optional.Type == SupplyType.Troop || optional.Type == SupplyType.SpecialAttack || optional.Type == SupplyType.Shard || optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack) { subElement4.Visible = true; subElement4.Tag = optional; subElement4.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked); subElement5.Tag = optional; subElement5.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked); } else { subElement5.DisablePlayTween(); } UXLabel subElement6 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardTypeLootTable"); subElement6.Visible = true; this.rewardsGrid.GetSubElement <UXSprite>(uid, "SpriteIconFragmentLootTable").Visible = false; if (optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack) { this.SetupShardRewardItemElements(uid, optional); } else if (optional.Type == SupplyType.Shard) { this.SetupEquipmentShardRewardItemElements(uid, optional); } else { this.rewardsGrid.GetSubElement <UXElement>(uid, "RewardItemDefault").Visible = true; this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelFragProgress").Text = string.Empty; UXSprite subElement7 = this.rewardsGrid.GetSubElement <UXSprite>(uid, "SpriteRewardItemImage"); IGeometryVO geometryVO = null; if (optional.Type == SupplyType.Currency) { subElement6.Visible = false; geometryVO = UXUtils.GetDefaultCurrencyIconVO(optional.RewardUid); } else if (optional.Type == SupplyType.Hero || optional.Type == SupplyType.Troop) { geometryVO = dataController.Get <TroopTypeVO>(optional.RewardUid); } else if (optional.Type == SupplyType.SpecialAttack) { geometryVO = dataController.Get <SpecialAttackTypeVO>(optional.RewardUid); } if (geometryVO != null) { ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(geometryVO, subElement7, false); GeometryProjector item = ProjectorUtils.GenerateProjector(config); this.projectors.Add(item); } } this.SetupLockedRewardItemElements(uid, lootEntry); if (subElement6.Visible) { string typeStringID = lootEntry.TypeStringID; if (!string.IsNullOrEmpty(typeStringID)) { subElement6.Visible = true; subElement6.Text = lang.Get(typeStringID, new object[0]); } else { subElement6.Visible = false; } } subElement6.InitTweenComponent(); subElement3.InitTweenComponent(); if (flag && subElement6.Visible) { subElement6.EnablePlayTween(); subElement3.EnablePlayTween(); } else { subElement6.ResetPlayTweenTarget(); subElement3.ResetPlayTweenTarget(); subElement6.TextColor = Color.white; subElement3.TextColor = Color.white; } this.rewardsGrid.AddItem(uXElement, order); }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.ScreenClosing) { if (id != EventId.BattleLoadStart) { switch (id) { case EventId.BattleEndFullyProcessed: case EventId.BattleLeftBeforeStarting: case EventId.BattleReplayEnded: Service.Get <BuffController>().ClearEquipmentBuffs(); return(EatResponse.NotEaten); case EventId.BattleCancelRequested: case EventId.BattleCanceled: case EventId.BattleNextRequested: case EventId.BattleReplayRequested: return(EatResponse.NotEaten); case EventId.BattleReplaySetup: { BattleRecord battleRecord = (BattleRecord)cookie; ArmoryController.AddEquipmentBuffs(battleRecord.AttackerEquipment, battleRecord.DefenderEquipment); return(EatResponse.NotEaten); } case EventId.BattleRecordRetrieved: { GetReplayResponse getReplayResponse = (GetReplayResponse)cookie; BattleRecord replayData = getReplayResponse.ReplayData; ArmoryController.AddEquipmentBuffs(replayData.AttackerEquipment, replayData.DefenderEquipment); return(EatResponse.NotEaten); } case EventId.BattleLoadedForDefend: break; default: if (id != EventId.ScreenClosing) { return(EatResponse.NotEaten); } if (!(cookie is InventoryCrateCollectionScreen)) { return(EatResponse.NotEaten); } GameUtils.CloseStoreOrInventoryScreen(); Service.Get <EventManager>().UnregisterObserver(this, EventId.ScreenClosing); if (this.AllowUnlockCelebration) { this.ShowEquipmentUnlockedCelebration(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } CurrentBattle currentBattle = Service.Get <BattleController>().GetCurrentBattle(); ArmoryController.AddEquipmentBuffs(currentBattle.AttackerEquipment, currentBattle.DefenderEquipment); } else if (id != EventId.ScreenLoaded) { if (id != EventId.PlanetConfirmRelocate) { switch (id) { case EventId.EquipmentUnlocked: this.pendingCelebrationEquipment = (cookie as EquipmentVO); this.UpdateLastEquipmentUnlocked(this.pendingCelebrationEquipment.Uid); if (this.AllowUnlockCelebration) { if (GameUtils.IsUnlockBlockingScreenOpen()) { Service.Get <EventManager>().RegisterObserver(this, EventId.ScreenClosing); } else { this.ShowEquipmentUnlockedCelebration(); } } break; case EventId.EquipmentUpgraded: { ContractEventData contractEventData = cookie as ContractEventData; IDataController dataController = Service.Get <IDataController>(); EquipmentVO equipmentVO = dataController.Get <EquipmentVO>(contractEventData.Contract.ProductUid); this.UpdateActiveArmoryLevel(equipmentVO); break; } case EventId.EquipmentActivated: case EventId.EquipmentDeactivated: this.UpdateArmoryBuildingTooltip(); break; } } else { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); IDataController dataController2 = Service.Get <IDataController>(); for (int i = currentPlayer.ActiveArmory.Equipment.Count - 1; i >= 0; i--) { EquipmentVO equipment = dataController2.Get <EquipmentVO>(currentPlayer.ActiveArmory.Equipment[i]); if (!ArmoryUtils.IsEquipmentValidForPlanet(equipment, (string)cookie)) { this.DeactivateEquipmentOnClient(currentPlayer, equipment); } } } } else if (cookie is ArmoryScreen) { this.UpdateLastEquipmentUnlocked("false"); } return(EatResponse.NotEaten); }
public ISerializable FromObject(object obj) { Dictionary <string, object> dictionary = obj as Dictionary <string, object>; if (dictionary == null) { return(this); } if (dictionary.ContainsKey("playerId")) { this.PlayerId = (dictionary["playerId"] as string); } if (dictionary.ContainsKey("name")) { this.PlayerName = (dictionary["name"] as string); } if (dictionary.ContainsKey("scalars")) { Dictionary <string, object> dictionary2 = dictionary["scalars"] as Dictionary <string, object>; int attackRating = 0; int defenseRating = 0; if (dictionary2 != null) { if (dictionary2.ContainsKey("attackRating")) { attackRating = Convert.ToInt32(dictionary2["attackRating"], CultureInfo.InvariantCulture); } if (dictionary2.ContainsKey("defenseRating")) { defenseRating = Convert.ToInt32(dictionary2["defenseRating"], CultureInfo.InvariantCulture); } } this.Medals = GameUtils.CalcuateMedals(attackRating, defenseRating); } if (dictionary.ContainsKey("playerModel")) { Dictionary <string, object> dictionary3 = dictionary["playerModel"] as Dictionary <string, object>; if (dictionary3 != null) { if (dictionary3.ContainsKey("faction")) { this.Faction = StringUtils.ParseEnum <FactionType>(dictionary3["faction"].ToString()); } if (dictionary3.ContainsKey("guildInfo")) { Dictionary <string, object> dictionary4 = dictionary3["guildInfo"] as Dictionary <string, object>; if (dictionary4 != null && dictionary4.ContainsKey("guildName")) { this.SquadName = WWW.UnEscapeURL(dictionary4["guildName"] as string); } } if (dictionary3.ContainsKey("map")) { Dictionary <string, object> dictionary5 = dictionary3["map"] as Dictionary <string, object>; if (dictionary5 != null && dictionary5.ContainsKey("buildings")) { List <object> list = dictionary5["buildings"] as List <object>; if (list != null) { IDataController dataController = Service.Get <IDataController>(); int i = 0; int count = list.Count; while (i < count) { Dictionary <string, object> dictionary6 = list[i] as Dictionary <string, object>; if (dictionary6 != null && dictionary6.ContainsKey("uid")) { BuildingTypeVO buildingTypeVO = dataController.Get <BuildingTypeVO>(dictionary6["uid"] as string); if (buildingTypeVO.Type == BuildingType.HQ) { this.HQLevel = buildingTypeVO.Lvl; break; } } i++; } } } } this.ActiveIdentity = true; if (dictionary3.ContainsKey("identitySwitchTimes")) { Dictionary <string, object> dictionary7 = dictionary3["identitySwitchTimes"] as Dictionary <string, object>; if (dictionary7 != null && dictionary7.ContainsKey(this.PlayerId)) { this.ActiveIdentity = (Convert.ToInt32(dictionary7[this.PlayerId], CultureInfo.InvariantCulture) == 0); } } } } return(this); }
private void PrepareEntityView(SmartEntity entity, GameObject gameObject) { EntityRef entityRef = gameObject.AddComponent <EntityRef>(); entityRef.Entity = entity; IDataController dataController = Service.Get <IDataController>(); GameObjectViewComponent gameObjectViewComponent; if (entity.GameObjectViewComp != null) { gameObjectViewComponent = entity.GameObjectViewComp; UnityEngine.Object.Destroy(gameObjectViewComponent.MainGameObject); gameObjectViewComponent.MainGameObject = gameObject; } else { float tooltipHeightOffset = 0f; if (entity.BuildingComp != null) { tooltipHeightOffset = entity.BuildingComp.BuildingType.TooltipHeightOffset; EffectsTypeVO effectsTypeVO = dataController.Get <EffectsTypeVO>("effect203"); AssetManager assetManager = Service.Get <AssetManager>(); assetManager.RegisterPreloadableAsset(effectsTypeVO.AssetName); AssetHandle assetHandle = AssetHandle.Invalid; assetManager.Load(ref assetHandle, effectsTypeVO.AssetName, new AssetSuccessDelegate(this.SparkFxSuccess), null, entity); } else if (entity.TroopComp != null) { TroopTypeVO troopTypeVO = Service.Get <IDataController>().Get <TroopTypeVO>(entity.TroopComp.TroopType.Uid); tooltipHeightOffset = troopTypeVO.TooltipHeightOffset; } gameObjectViewComponent = new GameObjectViewComponent(gameObject, tooltipHeightOffset); entity.Add(gameObjectViewComponent); } SupportComponent supportComp = entity.SupportComp; SupportViewComponent supportViewComp = entity.SupportViewComp; if (supportComp != null && supportViewComp == null) { SupportViewComponent component = new SupportViewComponent(); entity.Add <SupportViewComponent>(component); if (Service.Get <BuildingController>().PurchasingBuilding != entity) { Service.Get <BuildingTooltipController>().EnsureBuildingTooltip(entity); } } GeneratorComponent generatorComp = entity.GeneratorComp; GeneratorViewComponent generatorViewComponent = entity.GeneratorViewComp; if (generatorComp != null && generatorViewComponent == null) { generatorViewComponent = new GeneratorViewComponent(entity); entity.Add <GeneratorViewComponent>(generatorViewComponent); } TrapComponent trapComp = entity.TrapComp; TrapViewComponent trapViewComponent = entity.TrapViewComp; if (trapComp != null && trapViewComponent == null) { Animator component2 = gameObjectViewComponent.MainGameObject.GetComponent <Animator>(); Transform transform = gameObjectViewComponent.MainGameObject.transform.FindChild("Contents"); if (component2 == null) { Service.Get <StaRTSLogger>().ErrorFormat("A trap has been added that does not have a MecAnim controller. Building Uid: {0}, AssetName: {1}", new object[] { entity.BuildingComp.BuildingType.Uid, entity.BuildingComp.BuildingType.AssetName }); } else if (transform == null) { Service.Get <StaRTSLogger>().ErrorFormat("A trap has been added that does not have a Contents transform. Building Uid: {0}, AssetName: {1}", new object[] { entity.BuildingComp.BuildingType.Uid, entity.BuildingComp.BuildingType.AssetName }); } else { GameObject gameObject2 = transform.gameObject; if (gameObject2 == null) { Service.Get <StaRTSLogger>().ErrorFormat("A trap has been added that does not have a Contents GameObject. Building Uid: {0}, AssetName: {1}", new object[] { entity.BuildingComp.BuildingType.Uid, entity.BuildingComp.BuildingType.AssetName }); } trapViewComponent = new TrapViewComponent(component2); if (trapComp.Type.EventType == TrapEventType.Turret) { Transform transform2 = gameObjectViewComponent.MainGameObject.transform; Transform transform3 = transform2.FindChild(trapComp.Type.TurretTED.TurretAnimatorName); if (transform3 == null) { Service.Get <StaRTSLogger>().ErrorFormat("Trap {0}: Cannot find a gameobject in path {1}", new object[] { entity.BuildingComp.BuildingType.Uid, trapComp.Type.TurretTED.TurretAnimatorName }); } else { Animator component3 = transform3.gameObject.GetComponent <Animator>(); if (component3 == null) { Service.Get <StaRTSLogger>().ErrorFormat("Trap {0}: Cannot find an animator on gameobject in path {1}", new object[] { entity.BuildingComp.BuildingType.Uid, trapComp.Type.TurretTED.TurretAnimatorName }); } else { trapViewComponent.TurretAnim = component3; } } } entity.Add <TrapViewComponent>(trapViewComponent); } } AssetMeshDataMonoBehaviour component4 = gameObjectViewComponent.MainGameObject.GetComponent <AssetMeshDataMonoBehaviour>(); if (component4 != null && component4.OtherGameObjects != null) { for (int i = 0; i < component4.OtherGameObjects.Count; i++) { if (component4.OtherGameObjects[i].name.Contains("center_of_mass")) { gameObjectViewComponent.CenterOfMass = component4.OtherGameObjects[i]; } else if (component4.OtherGameObjects[i].name.Contains("locator_hit")) { gameObjectViewComponent.HitLocators.Add(component4.OtherGameObjects[i]); } else if (component4.OtherGameObjects[i].name.Contains("locator_vehicle")) { gameObjectViewComponent.VehicleLocator = component4.OtherGameObjects[i]; } else if (component4.OtherGameObjects[i].name.Contains("locator_effect")) { gameObjectViewComponent.EffectLocators.Add(component4.OtherGameObjects[i]); } } } FactoryComponent factoryComp = entity.FactoryComp; if (factoryComp != null) { EffectsTypeVO effectsTypeVO2 = dataController.Get <EffectsTypeVO>("effect203"); AssetManager assetManager2 = Service.Get <AssetManager>(); assetManager2.RegisterPreloadableAsset(effectsTypeVO2.AssetName); AssetHandle assetHandle2 = AssetHandle.Invalid; assetManager2.Load(ref assetHandle2, effectsTypeVO2.AssetName, new AssetSuccessDelegate(this.SparkFxSuccess), null, entity); } this.SetupGunLocators(entity, component4); if (entity.TroopShieldHealthComp != null && entity.TroopShieldViewComp == null) { TroopTypeVO troop = Service.Get <IDataController>().Get <TroopTypeVO>(entity.TroopComp.TroopType.Uid); entity.Add <TroopShieldViewComponent>(new TroopShieldViewComponent(troop)); } gameObject.SetActive(false); this.CheckHealthView(entity); this.CheckMeterShaderView(entity); Service.Get <EntityRenderController>().UpdateNewEntityView(entity); }
public override void ShowView() { this.donateTroopsPanel.Visible = true; this.donateTroopsTitle.Text = this.lang.Get("SQUAD_DONATE_TO_USER", new object[] { this.recipientUserName }); this.hasTroops = false; this.hasEligibleTroop = false; IEnumerable <KeyValuePair <string, InventoryEntry> > allTroops = Service.Get <CurrentPlayer>().GetAllTroops(); if (allTroops != null) { using (IEnumerator <KeyValuePair <string, InventoryEntry> > enumerator = allTroops.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <string, InventoryEntry> current = enumerator.get_Current(); if (current.get_Value().Amount > 0) { string key = current.get_Key(); IDataController dataController = Service.Get <IDataController>(); TroopTypeVO troopTypeVO = dataController.Get <TroopTypeVO>(key); if (!troopTypeVO.PreventDonation) { bool flag = this.AddTroopItem(current, troopTypeVO); this.hasTroops = true; if (flag && !this.hasEligibleTroop) { this.hasEligibleTroop = true; } } } } } } this.capacityBar.Visible = this.hasEligibleTroop; this.hintLabel.Visible = this.hasEligibleTroop; this.noTroopsLabel.Visible = !this.hasEligibleTroop; this.trainTroopsButton.Visible = !this.hasEligibleTroop; this.buildVehiclesButton.Visible = !this.hasEligibleTroop; if (this.hasTroops) { this.troopDonateGrid.RepositionItemsFrameDelayed(); this.hintLabel.Text = this.lang.Get("SQUAD_DONATE_LIMIT", new object[] { this.troopDonationLimit }); this.troopDonateCloseBtn.Visible = false; this.donateTroopsCancel.OnClicked = new UXButtonClickedDelegate(this.OnDonateClose); this.donateTroopsConfirm.OnClicked = new UXButtonClickedDelegate(this.OnDonateConfirm); this.donateTroopsCancel.Visible = true; this.donateTroopsConfirm.Visible = true; } else { this.noTroopsLabel.Text = this.lang.Get("SQUAD_DONATE_NO_TROOPS", new object[0]); UXSprite element = this.screen.GetElement <UXSprite>("SpriteTroopDonatePanelScrollRight"); element.Visible = false; } if (!this.hasEligibleTroop) { this.donateTroopsCancel.Visible = false; this.donateTroopsConfirm.Visible = false; this.SetupTrainTroopsButtons(); this.troopDonateCloseBtn.Visible = true; } this.earnReputationPanel.Visible = true; if (!Service.Get <TroopDonationTrackController>().IsTroopDonationProgressComplete()) { this.ShowRepProgressDonationState(); } else { this.earnReputationProgress.Visible = false; this.earnReputationComplete.Visible = true; this.UpdateLabelTimeRemaining(this.earnReputationTimer); Service.Get <ViewTimeEngine>().RegisterClockTimeObserver(this, 1f); } this.RefreshView(); }
public void HandleReceiptVerificationResponse(string uid, string transactionId, string currencyCode, double price, double bonusMultiplier, bool isPromo, string offerUid, CrateData crateData) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); IDataController dataController = Service.Get <IDataController>(); InAppPurchaseTypeVO inAppPurchaseTypeVO = dataController.Get <InAppPurchaseTypeVO>(uid); if (inAppPurchaseTypeVO.IsPromo) { isPromo = true; } bool flag = !string.IsNullOrEmpty(offerUid); string text = inAppPurchaseTypeVO.RewardEmpire; if (currentPlayer.Faction == FactionType.Rebel) { text = inAppPurchaseTypeVO.RewardRebel; } if (string.IsNullOrEmpty(text) && !flag) { Service.Get <StaRTSLogger>().Error("MoneyReceiptVerifyResponse:" + inAppPurchaseTypeVO.Uid + " faction specific reward uids do not exist"); return; } bool flag2 = false; TargetedBundleVO targetedBundleVO = null; if (flag) { targetedBundleVO = dataController.GetOptional <TargetedBundleVO>(offerUid); if (targetedBundleVO != null) { Service.Get <TargetedBundleController>().GrantTargetedBundleRewards(targetedBundleVO); flag2 = true; } else { Service.Get <StaRTSLogger>().Error("MoneyReceiptVerifyResponse: targeted offer " + offerUid + " does not exist"); } } else { RewardVO optional = dataController.GetOptional <RewardVO>(text); if (optional == null) { Service.Get <StaRTSLogger>().Error("MoneyReceiptVerifyResponse:" + text + " does not exist"); } else if (inAppPurchaseTypeVO.CurrencyType.Equals("hard")) { RewardUtils.GrantReward(currentPlayer, optional, bonusMultiplier); } else { RewardUtils.GrantInAppPurchaseRewardToHQInventory(optional); } } if (inAppPurchaseTypeVO.ProductId.Contains("promo")) { isPromo = true; } int amount; if (inAppPurchaseTypeVO.CurrencyType.Equals("hard")) { amount = (int)Math.Floor(bonusMultiplier * (double)inAppPurchaseTypeVO.Amount); } else { amount = inAppPurchaseTypeVO.Amount; } this.Consume(inAppPurchaseTypeVO.ProductId); string text2 = uid; bool flag3 = false; SaleTypeVO currentActiveSale = SaleUtils.GetCurrentActiveSale(); if (currentActiveSale != null && !isPromo) { text2 = text2 + "_" + currentActiveSale.Uid; } if (isPromo) { text2 += "_promo"; flag3 = true; } if (GameConstants.IAP_FORCE_POPUP_ENABLED) { flag3 = true; } if (flag2) { Service.Get <TargetedBundleController>().HandleTargetedOfferSuccess(crateData, targetedBundleVO); } else if (flag3) { this.ShowRedemptionScreen(amount, uid); Service.Get <EventManager>().SendEvent(EventId.InAppPurchaseMade, null); } Service.Get <DMOAnalyticsController>().LogPaymentAction(currencyCode, price, inAppPurchaseTypeVO.ProductId, 1, text2); }
public static void UpdateAllStarportFullnessMeters() { GamePlayer worldOwner = GameUtils.GetWorldOwner(); Dictionary <string, InventoryEntry> internalStorage = worldOwner.Inventory.Troop.GetInternalStorage(); IDataController dataController = Service.Get <IDataController>(); List <TroopTypeVO> list = new List <TroopTypeVO>(); foreach (string current in internalStorage.Keys) { list.Add(dataController.Get <TroopTypeVO>(current)); } List <StarportNode> list2 = new List <StarportNode>(); NodeList <StarportNode> starportNodeList = Service.Get <BuildingLookupController>().StarportNodeList; for (StarportNode starportNode = starportNodeList.Head; starportNode != null; starportNode = starportNode.Next) { if (!ContractUtils.IsBuildingConstructing(starportNode.BuildingComp.Entity)) { list2.Add(starportNode); } } list.Sort(new Comparison <TroopTypeVO>(StorageSpreadUtils.CompareTroop)); int count = list.Count; int[] array = new int[count]; for (int i = 0; i < count; i++) { array[i] = internalStorage[list[i].Uid].Amount; } list2.Sort(new Comparison <StarportNode>(StorageSpreadUtils.CompareStarportNode)); int num = 0; int count2 = list2.Count; PriorityList <int> priorityList = new PriorityList <int>(); int[] array2 = new int[count2]; for (int j = 0; j < count2; j++) { int storage = list2[j].BuildingComp.BuildingType.Storage; array2[j] = storage; num += storage; int priority = -j; priorityList.Add(j, priority); } int num2 = 0; while (num2 < count && num > 0) { int size = list[num2].Size; int num3 = array[num2]; while (num3 > 0 && num > 0) { bool flag = false; for (int k = 0; k < count2; k++) { int element = priorityList.GetElement(k); int num4 = array2[element]; if (size <= num4) { array2[element] -= size; num -= size; int num5 = priorityList.GetPriority(k); priorityList.RemoveAt(k); num5 -= size * count2; priorityList.Add(element, num5); flag = true; break; } } if (!flag) { int num6 = size; int num7 = 0; while (num7 < count2 && num6 > 0) { int num8 = array2[num7]; if (num8 > 0) { int num9 = (num6 < num8) ? num6 : num8; array2[num7] -= num9; num -= num9; num6 -= num9; } num7++; } } num3--; } num2++; } for (int l = 0; l < count2; l++) { BuildingComponent buildingComp = list2[l].BuildingComp; int storage2 = buildingComp.BuildingType.Storage; int num10 = storage2 - array2[l]; Entity entity = buildingComp.Entity; StorageSpreadUtils.SetStarportFullnessPercent(entity, (float)num10 / (float)storage2); StorageSpreadUtils.SetStarportFillSize(entity, num10); } }
public void EnsureBuildingTooltip(SmartEntity building) { if (building == null || building.SupportViewComp == null || Service.Get <PostBattleRepairController>().IsEntityInRepair(building)) { return; } SupportViewComponent supportViewComp = building.SupportViewComp; BuildingComponent buildingComp = building.BuildingComp; BuildingTypeVO buildingType = buildingComp.BuildingType; if (!supportViewComp.Enabled) { return; } IState currentState = Service.Get <GameStateMachine>().CurrentState; if (currentState is WarBoardState) { return; } bool flag = currentState is HomeState; bool editState = currentState is EditBaseState; bool baseLayoutState = currentState is BaseLayoutToolState; int num = -1; int timeTotal = -1; string text = null; IUpgradeableVO iconAsset = null; bool flag2 = Service.Get <BuildingController>().SelectedBuilding == building; SupportViewComponentState supportViewComponentState = SupportViewComponentState.Dormant; Contract contract = Service.Get <ISupportController>().FindCurrentContract(buildingComp.BuildingTO.Key); if (contract != null) { if (this.ShouldShowProgress(contract, flag, editState, baseLayoutState, building)) { int remainingTimeForView = contract.GetRemainingTimeForView(); if (remainingTimeForView <= 0 || !Service.Get <ISupportController>().IsContractValidForStorage(contract)) { text = Service.Get <Lang>().Get("STOPPED", new object[0]); supportViewComponentState = SupportViewComponentState.Bubble; } else { num = remainingTimeForView; timeTotal = contract.TotalTime; if (this.ShouldShowIcon(contract.DeliveryType, flag)) { IDataController dataController = Service.Get <IDataController>(); DeliveryType deliveryType = contract.DeliveryType; if (deliveryType != DeliveryType.Starship && deliveryType != DeliveryType.UpgradeStarship) { if (deliveryType == DeliveryType.UpgradeEquipment) { iconAsset = dataController.Get <EquipmentVO>(contract.ProductUid); } else { iconAsset = dataController.Get <TroopTypeVO>(contract.ProductUid); } } else { iconAsset = dataController.Get <SpecialAttackTypeVO>(contract.ProductUid); } supportViewComponentState = SupportViewComponentState.IconProgress; } else { supportViewComponentState = SupportViewComponentState.Progress; } } } } else { text = this.GetBubbleText(building, flag, editState, flag2); if (text != null) { supportViewComponentState = this.GetBubbleViewComponentStateBasedOnBuilding(building); } } if ((flag2 & flag) && supportViewComponentState == SupportViewComponentState.Dormant && buildingType.Type == BuildingType.Starport) { supportViewComponentState = SupportViewComponentState.General; } if (supportViewComponentState != SupportViewComponentState.Dormant) { bool flag3 = supportViewComponentState == supportViewComp.State; BuildingTooltip buildingTooltip; if (flag3) { buildingTooltip = supportViewComp.BuildingTooltip; } else { supportViewComp.TeardownElements(); UXController uXController = Service.Get <UXController>(); MiscElementsManager miscElementsManager = uXController.MiscElementsManager; GameObjectViewComponent gameObjectViewComp = building.GameObjectViewComp; string text2 = gameObjectViewComp.MainGameObject.GetInstanceID().ToString(); string name = "BuildingTooltip" + text2; GameObject worldUIParent = Service.Get <UXController>().WorldUIParent; switch (supportViewComponentState) { case SupportViewComponentState.Bubble: if (buildingType.Type == BuildingType.ChampionPlatform) { buildingTooltip = miscElementsManager.CreateBubbleRepairTooltip(name, worldUIParent); } else { buildingTooltip = miscElementsManager.CreateBubbleTooltip(name, worldUIParent); } break; case SupportViewComponentState.BubbleHQ: case SupportViewComponentState.BubbleArmoryUpgrade: case SupportViewComponentState.BubbleShardUpgrade: buildingTooltip = miscElementsManager.CreateHQBubbleTooltip(name, worldUIParent); break; case SupportViewComponentState.Progress: buildingTooltip = miscElementsManager.CreateProgressTooltip(name, worldUIParent); break; case SupportViewComponentState.IconProgress: buildingTooltip = miscElementsManager.CreateIconProgressTooltip(name, worldUIParent); break; default: buildingTooltip = miscElementsManager.CreateGeneralTooltip(name, worldUIParent); break; } } buildingTooltip.SetSelected(flag2); buildingTooltip.SetTitle(this.GetBuildingTitle(buildingType)); buildingTooltip.SetLevel(buildingType); buildingTooltip.SetBubbleText(text); buildingTooltip.SetIconAsset(iconAsset); buildingTooltip.SetTime(num); buildingTooltip.SetProgress(num, timeTotal); if (!flag3) { supportViewComp.SetupElements(buildingTooltip, supportViewComponentState); } } }
private void UpdateElements() { IDataController dataController = Service.Get <IDataController>(); TargetedBundleController targetedBundleController = Service.Get <TargetedBundleController>(); this.currentOffer = targetedBundleController.CurrentTargetedOffer; if (this.currentOffer != null) { UXLabel element = base.GetElement <UXLabel>("LabelTitle"); element.Text = this.lang.Get(this.currentOffer.Title, new object[0]); UXLabel element2 = base.GetElement <UXLabel>("LabelDescription"); element2.Text = this.lang.Get(this.currentOffer.Description, new object[0]); TextureVO optional = dataController.GetOptional <TextureVO>("gui_textures_promotional"); if (optional != null) { UXTexture element3 = base.GetElement <UXTexture>("TexturePromoArt"); element3.LoadTexture(optional.AssetName); } optional = dataController.GetOptional <TextureVO>("targeted_bundle_entry"); if (optional != null) { UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentEntry"); element4.LoadTexture(optional.AssetName); } optional = dataController.GetOptional <TextureVO>("targeted_bundle_treads"); if (optional != null) { UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentRight"); element5.LoadTexture(optional.AssetName); } optional = dataController.GetOptional <TextureVO>("targeted_bundle_treads"); if (optional != null) { UXTexture element6 = base.GetElement <UXTexture>("TextureEnvironmentLeft"); element6.LoadTexture(optional.AssetName); } optional = dataController.GetOptional <TextureVO>("targeted_bundle_dust"); if (optional != null) { UXTexture element7 = base.GetElement <UXTexture>("TextureEnvironmentDustRight"); element7.LoadTexture(optional.AssetName); element7 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft"); element7.LoadTexture(optional.AssetName); } int i = 0; int count = this.currentOffer.RewardUIDs.Count; while (i < count) { RewardVO rewardVO = dataController.Get <RewardVO>(this.currentOffer.RewardUIDs[i]); if (!RewardUtils.SetupTargetedOfferCrateRewardDisplay(rewardVO, this.itemLabels[i], this.itemSprites[i])) { List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO); int j = 0; int count2 = rewardComponents.Count; while (j < count2) { RewardComponentTag rewardComponentTag = rewardComponents[j]; this.itemLabels[i].Text = this.lang.Get("AMOUNT_AND_NAME", new object[] { rewardComponentTag.RewardName, rewardComponentTag.Quantity }); RewardUtils.SetRewardIcon(this.itemSprites[i], rewardComponentTag.RewardGeometryConfig, AnimationPreference.AnimationAlways); j++; } } i++; } if (targetedBundleController.IsCurrencyCostOffer(this.currentOffer)) { this.SetupCurrencyCostOffer(this.currentOffer); } else { this.SetupIAPLinkedOffer(this.currentOffer); } UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.currentOffer.Character1Image, ref this.charGeometry1); UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.currentOffer.Character2Image, ref this.charGeometry2); uint serverTime = Service.Get <ServerAPI>().ServerTime; this.timeRemaining = (int)(targetedBundleController.OfferExpiresAt - serverTime); this.timerLabel.Text = this.lang.Get("expires_in", new object[] { GameUtils.GetTimeLabelFromSeconds(this.timeRemaining) }); this.valueLabel.Text = this.lang.Get("PERCENTAGE", new object[] { this.currentOffer.Discount.ToString() }); this.value2Label.Text = this.lang.Get("TARGETED_BUNDLE_DISCOUNT", new object[] { this.currentOffer.Discount.ToString() }); return; } Service.Get <StaRTSLogger>().Error("No current offer available for targeted bundle screen"); }
public void ReadRow(Row row) { this.Uid = row.Uid; this.MissionType = StringUtils.ParseEnum <MissionType>(row.TryGetString(CampaignMissionVO.COLUMN_missionType)); this.Waves = row.TryGetString(CampaignMissionVO.COLUMN_waves); this.Map = row.TryGetString(CampaignMissionVO.COLUMN_map); this.CampaignUid = row.TryGetString(CampaignMissionVO.COLUMN_campaignUid); this.Title = row.TryGetString(CampaignMissionVO.COLUMN_title); this.UnlockOrder = row.TryGetInt(CampaignMissionVO.COLUMN_unlockOrder); this.Description = row.TryGetString(CampaignMissionVO.COLUMN_description); this.Rewards = row.TryGetString(CampaignMissionVO.COLUMN_rewards); this.MasteryStars = 3; this.IntroStory = row.TryGetString(CampaignMissionVO.COLUMN_introStory); this.SuccessStory = row.TryGetString(CampaignMissionVO.COLUMN_winStory); this.FailureStory = row.TryGetString(CampaignMissionVO.COLUMN_loseStory); this.GoalFailureStory = row.TryGetString(CampaignMissionVO.COLUMN_goalFailStory); this.OpponentName = row.TryGetString(CampaignMissionVO.COLUMN_opponentName); this.GoalString = row.TryGetString(CampaignMissionVO.COLUMN_goalString); this.GoalFailureString = row.TryGetString(CampaignMissionVO.COLUMN_goalFailString); this.ProgressString = row.TryGetString(CampaignMissionVO.COLUMN_progressString); this.Replayable = row.TryGetBool(CampaignMissionVO.COLUMN_replay); this.Grind = row.TryGetBool(CampaignMissionVO.COLUMN_grind); this.BattleMusic = row.TryGetString(CampaignMissionVO.COLUMN_battleMusic); this.AmbientMusic = row.TryGetString(CampaignMissionVO.COLUMN_ambientMusic); this.CampaignPoints = this.ParseCampaignPoints(row.TryGetString(CampaignMissionVO.COLUMN_campaignPoints)); this.FixedWaves = row.TryGetBool(CampaignMissionVO.COLUMN_fixedWaves); this.RaidDescriptionID = row.TryGetString(CampaignMissionVO.COLUMN_raidDesc); this.RaidBriefingBGTextureName = row.TryGetString(CampaignMissionVO.COLUMN_raidImage); this.TotalLoot = null; ValueObjectController valueObjectController = Service.Get <ValueObjectController>(); List <StrIntPair> strIntPairs = valueObjectController.GetStrIntPairs(this.Uid, row.TryGetString(CampaignMissionVO.COLUMN_totalLoot)); if (strIntPairs != null) { int num = 6; this.TotalLoot = new int[num]; for (int i = 0; i < num; i++) { this.TotalLoot[i] = -1; } int j = 0; int count = strIntPairs.Count; while (j < count) { StrIntPair strIntPair = strIntPairs[j]; this.TotalLoot[(int)StringUtils.ParseEnum <CurrencyType>(strIntPair.StrKey)] = strIntPair.IntVal; j++; } } IDataController dataController = Service.Get <IDataController>(); this.Conditions = new List <ConditionVO>(); string[] array = row.TryGetStringArray(CampaignMissionVO.COLUMN_victoryConditions); for (int k = 0; k < array.Length; k++) { this.Conditions.Add(dataController.Get <ConditionVO>(array[k])); } if (!string.IsNullOrEmpty(this.CampaignUid)) { CampaignVO optional = dataController.GetOptional <CampaignVO>(this.CampaignUid); if (optional != null) { CampaignVO expr_2AB = optional; int totalMissions = expr_2AB.TotalMissions; expr_2AB.TotalMissions = totalMissions + 1; optional.TotalMasteryStars += this.MasteryStars; } else { Service.Get <StaRTSLogger>().ErrorFormat("CampaignMissionVO {0} that references a CampaignVO Uid {1} that doesn't exist", new object[] { this.Uid, this.CampaignUid }); } } this.FailureCondition = row.TryGetString(CampaignMissionVO.COLUMN_failureCondition); this.BIChapterId = row.TryGetString(CampaignMissionVO.COLUMN_bi_chap_id); this.BIContext = row.TryGetString(CampaignMissionVO.COLUMN_bi_context); this.BIEnemyTier = row.TryGetInt(CampaignMissionVO.COLUMN_bi_enemy_tier); this.BIMissionId = row.TryGetString(CampaignMissionVO.COLUMN_bi_mission_id); this.BIMissionName = row.TryGetString(CampaignMissionVO.COLUMN_bi_mission_name); }