public override ISerializable FromObject(object obj) { this.FinishedContracts = new List <ContractTO>(); List <object> list = (List <object>)obj; for (int i = 0; i < list.Count; i++) { Dictionary <string, object> dictionary = list[i] as Dictionary <string, object>; List <object> list2 = dictionary["message"] as List <object>; for (int j = 0; j < list2.Count; j++) { ContractTO item = new ContractTO().FromObject(list2[j]) as ContractTO; this.FinishedContracts.Add(item); } } return(this); }
public BuildingInstantUpgradeRequest(string buildingKey, string buildingUid, string tag) { this.buildingKey = buildingKey; this.tag = tag; ContractTO contractTO = new ContractTO(); contractTO.Uid = buildingUid; contractTO.BuildingKey = buildingKey; contractTO.EndTime = ServerTime.Time; contractTO.ContractType = ContractType.Upgrade; Contract contract = new Contract(buildingUid, DeliveryType.UpgradeBuilding, 0, 0.0); contract.ContractTO = contractTO; BuildingTypeVO buildingTypeVO = Service.Get <IDataController>().Get <BuildingTypeVO>(buildingUid); bool simulateTroopContractUpdate = buildingTypeVO.Type != BuildingType.Starport; base.CalculateChecksum(contract, true, simulateTroopContractUpdate); }
public BuildingConstructRequest(string buildingKey, string buildingUid, Position position, bool payWithHardCurrency, bool instant, string tag) { this.BuildingUid = buildingUid; this.Position = position; this.PayWithHardCurrency = payWithHardCurrency; this.Tag = tag; Contract contract = null; if (instant) { ContractTO contractTO = new ContractTO(); contractTO.Uid = buildingUid; contractTO.BuildingKey = buildingKey; contractTO.EndTime = ServerTime.Time; contractTO.ContractType = ContractType.Build; contract = new Contract(buildingUid, DeliveryType.Building, 0, 0.0); contract.ContractTO = contractTO; } base.CalculateChecksum(contract, false, true); }
public EatResponse OnEvent(EventId id, object cookie) { if (id == EventId.ContractCompletedForStoryAction) { ContractTO contractTO = (ContractTO)cookie; if (contractTO.ContractType == ContractType.Upgrade) { BuildingTypeVO buildingTypeVO = Service.Get <IDataController>().Get <BuildingTypeVO>(contractTO.Uid); if (buildingTypeVO.Type == BuildingType.NavigationCenter) { this.CheckSatisfyTrigger(contractTO.Tag); } } } else if (id == EventId.PlanetUnlocked) { this.CheckSatisfyTrigger((string)cookie); } return(EatResponse.NotEaten); }
private void AddOfflineContractTasksToQueue() { List <ContractTO> contractEventsThatHappenedOffline = Service.ISupportController.GetContractEventsThatHappenedOffline(); if (contractEventsThatHappenedOffline == null || contractEventsThatHappenedOffline.Count < 1) { return; } int count = contractEventsThatHappenedOffline.Count; StaticDataController staticDataController = Service.StaticDataController; for (int i = 0; i < count; i++) { ContractTO contractTO = contractEventsThatHappenedOffline[i]; if (contractTO.ContractType == ContractType.Upgrade) { BuildingTypeVO buildingTypeVO = staticDataController.Get <BuildingTypeVO>(contractTO.Uid); if (buildingTypeVO.Type == BuildingType.HQ) { this.AddTaskToAppropriateQueue(new HQCelebRUFTask()); } } } }
public EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.ContractAdded: { ContractEventData contractEventData = (ContractEventData)cookie; if (contractEventData.Contract.ProductUid.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } case EventId.ContractBacklogUpdated: IL_18: switch (id) { case EventId.ScreenClosing: { UXFactory uXFactory = cookie as UXFactory; string text = (uXFactory != null && !(uXFactory.Root == null)) ? uXFactory.Root.name : string.Empty; if (text.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } case EventId.ScreenClosed: case EventId.ScreenOverlayClosing: IL_34: if (id != EventId.BuildingPurchaseSuccess) { if (id != EventId.BuildingSelected) { if (id != EventId.DroidPurchaseAnimationComplete) { if (id != EventId.EntityKilled) { if (id != EventId.TroopDeployed) { if (id == EventId.TroopDonationTrackRewardReceived) { goto IL_3C0; } if (id == EventId.SpecialAttackDeployed) { SpecialAttack specialAttack = (SpecialAttack)cookie; if (specialAttack.VO.Uid.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } if (id == EventId.ButtonClicked) { string text2 = (string)cookie; if (text2.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } if (id == EventId.ContractCompletedForStoryAction) { ContractTO contractTO = (ContractTO)cookie; if (contractTO.Uid.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } if (id == EventId.InventoryResourceUpdated) { string text3 = (string)cookie; if (text3.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } if (id != EventId.HeroDeployed && id != EventId.ChampionDeployed) { if (id != EventId.EquipmentUnlocked) { return(EatResponse.NotEaten); } goto IL_3C0; } } Entity entity = (Entity)cookie; TroopComponent troopComponent = entity.Get <TroopComponent>(); ITroopDeployableVO troopType = troopComponent.TroopType; if (troopType.Uid.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } Entity entity2 = (Entity)cookie; string text4 = string.Empty; string a = this.prepareArgs[1]; if (a == "troopKilled") { TroopComponent troopComponent2 = entity2.Get <TroopComponent>(); if (troopComponent2 == null) { return(EatResponse.NotEaten); } text4 = troopComponent2.TroopType.Uid; } else if (a == "buildingKilled") { BuildingComponent buildingComponent = entity2.Get <BuildingComponent>(); if (buildingComponent == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType = buildingComponent.BuildingType; text4 = buildingType.Uid; } if (text4.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } IL_3C0: this.CountEvent(); return(EatResponse.NotEaten); } Entity entity3 = (Entity)cookie; BuildingComponent buildingComponent2 = entity3.Get <BuildingComponent>(); if (buildingComponent2 == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType2 = buildingComponent2.BuildingType; if (buildingType2.Uid.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } else { Entity entity4 = (Entity)cookie; BuildingComponent buildingComponent3 = entity4.Get <BuildingComponent>(); if (buildingComponent3 == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType3 = buildingComponent3.BuildingType; if (buildingType3.Uid.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } break; case EventId.ScreenLoaded: { UXFactory uXFactory2 = cookie as UXFactory; string name = uXFactory2.Root.name; if (name.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } } goto IL_34; case EventId.ContractStarted: { ContractEventData contractEventData2 = (ContractEventData)cookie; if (contractEventData2.Contract.ProductUid.Equals(this.eventData[0], StringComparison.InvariantCultureIgnoreCase)) { this.CountEvent(); } return(EatResponse.NotEaten); } } goto IL_18; }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.BuildingConstructed) { if (id != EventId.ClearableCleared) { switch (id) { case EventId.BuildingLevelUpgraded: case EventId.BuildingSwapped: { Entity entity = (cookie as ContractEventData).Entity; if (entity != null) { bool flag = this.buildingSelector.IsPartOfSelection(entity); if (entity != null & flag) { this.buildingSelector.DeselectSelectedBuilding(); } Entity entity2 = this.ReplaceBuildingAfterTOChange(entity); if (flag && entity2 != null) { this.buildingSelector.SelectBuilding(entity2, Vector3.zero); } Service.Get <AchievementController>().TryUnlockAchievementById(AchievementType.BuildingLevel, entity2.Get <BuildingComponent>().BuildingType.Uid); this.CheckStarportFullness(entity2); } break; } case EventId.BuildingConstructed: this.CheckStarportFullness(((ContractEventData)cookie).Entity); break; } } else { Entity entity3 = (cookie as ContractEventData).Entity; if (entity3 != null && this.buildingSelector.SelectedBuilding == entity3) { this.buildingSelector.DeselectSelectedBuilding(); } Service.Get <EntityFactory>().DestroyEntity(entity3, true, true); } } else if (id != EventId.ContractCompleted) { if (id == EventId.ContractCompletedForStoryAction) { ContractTO contractTO = (ContractTO)cookie; if (contractTO.ContractType == ContractType.Upgrade) { BuildingTypeVO buildingTypeVO = Service.Get <IDataController>().Get <BuildingTypeVO>(contractTO.Uid); if (buildingTypeVO.Type == BuildingType.HQ) { this.OnHQUpgraded(); } } } } else { ContractEventData contractEventData = cookie as ContractEventData; ContractType contractType = contractEventData.Contract.ContractTO.ContractType; if (contractType == ContractType.Upgrade || contractType == ContractType.Build) { BuildingTypeVO buildingTypeVO2 = Service.Get <IDataController>().Get <BuildingTypeVO>(contractEventData.Contract.ProductUid); if (buildingTypeVO2.Type == BuildingType.NavigationCenter) { Service.Get <CurrentPlayer>().AddUnlockedPlanet(contractEventData.Contract.Tag); } if (buildingTypeVO2.Type == BuildingType.HQ && buildingTypeVO2.Lvl >= GameConstants.OBJECTIVES_UNLOCKED) { Service.Get <ObjectiveManager>().RefreshFromServer(); } } } return(EatResponse.NotEaten); }
public override ISerializable FromObject(object obj) { Dictionary <string, object> dictionary = obj as Dictionary <string, object>; if (dictionary == null) { Service.Logger.Error("Attempted to create invalid PvpTarget."); return(null); } if (dictionary.ContainsKey("battleId")) { this.BattleId = (string)dictionary["battleId"]; } if (dictionary.ContainsKey("playerId")) { this.PlayerId = (string)dictionary["playerId"]; } if (dictionary.ContainsKey("name")) { this.PlayerName = (string)dictionary["name"]; } if (dictionary.ContainsKey("level")) { this.PlayerLevel = Convert.ToInt32(dictionary["level"]); } if (dictionary.ContainsKey("xp")) { this.PlayerXp = Convert.ToInt32(dictionary["xp"]); } if (dictionary.ContainsKey("attackRating")) { this.PlayerAttackRating = Convert.ToInt32(dictionary["attackRating"]); } if (dictionary.ContainsKey("defenseRating")) { this.PlayerDefenseRating = Convert.ToInt32(dictionary["defenseRating"]); } if (dictionary.ContainsKey("attacksWon")) { this.PlayerAttacksWon = Convert.ToInt32(dictionary["attacksWon"]); } if (dictionary.ContainsKey("defensesWon")) { this.PlayerDefensesWon = Convert.ToInt32(dictionary["defensesWon"]); } if (dictionary.ContainsKey("guildId")) { this.GuildId = (string)dictionary["guildId"]; } if (dictionary.ContainsKey("guildName")) { this.GuildName = (string)dictionary["guildName"]; } if (dictionary.ContainsKey("map")) { this.BaseMap = new Map(); this.BaseMap.FromObject(dictionary["map"]); this.BaseMap.InitializePlanet(); } if (dictionary.ContainsKey("resources")) { this.BuildingLootCreditsMap = new Dictionary <string, int>(); this.BuildingLootMaterialsMap = new Dictionary <string, int>(); this.BuildingLootContrabandMap = new Dictionary <string, int>(); Dictionary <string, object> dictionary2 = dictionary["resources"] as Dictionary <string, object>; foreach (KeyValuePair <string, object> current in dictionary2) { Dictionary <string, object> dictionary3 = current.Value as Dictionary <string, object>; if (dictionary3 != null) { if (dictionary3.ContainsKey("credits")) { this.BuildingLootCreditsMap.Add(current.Key, Convert.ToInt32(dictionary3["credits"])); this.AvailableCredits += Convert.ToInt32(dictionary3["credits"]); } if (dictionary3.ContainsKey("materials")) { this.BuildingLootMaterialsMap.Add(current.Key, Convert.ToInt32(dictionary3["materials"])); this.AvailableMaterials += Convert.ToInt32(dictionary3["materials"]); } if (dictionary3.ContainsKey("contraband")) { this.BuildingLootContrabandMap.Add(current.Key, Convert.ToInt32(dictionary3["contraband"])); this.AvailableContraband += Convert.ToInt32(dictionary3["contraband"]); } } } } if (dictionary.ContainsKey("potentialPoints")) { Dictionary <string, object> dictionary4 = dictionary["potentialPoints"] as Dictionary <string, object>; if (dictionary4 != null) { if (dictionary4.ContainsKey("potentialScoreWin")) { this.PotentialMedalsToGain = Convert.ToInt32(dictionary4["potentialScoreWin"]); } if (dictionary4.ContainsKey("potentialScoreLose")) { this.PotentialMedalsToLose = Convert.ToInt32(dictionary4["potentialScoreLose"]); } if (dictionary4.ContainsKey("potentialPointsWin")) { this.PotentialTournamentRatingDeltaWin = Convert.ToInt32(dictionary4["potentialPointsWin"]); } if (dictionary4.ContainsKey("potentialPointsLose")) { this.PotentialTournamentRatingDeltaLose = Convert.ToInt32(dictionary4["potentialPointsLose"]); } } } if (dictionary.ContainsKey("guildTroops")) { this.GuildDonatedTroops = new Dictionary <string, int>(); Dictionary <string, object> dictionary5 = dictionary["guildTroops"] as Dictionary <string, object>; if (dictionary5 != null) { foreach (KeyValuePair <string, object> current2 in dictionary5) { string key = current2.Key; int num = 0; Dictionary <string, object> dictionary6 = current2.Value as Dictionary <string, object>; if (dictionary6 != null) { foreach (KeyValuePair <string, object> current3 in dictionary6) { num += Convert.ToInt32(current3.Value); } this.GuildDonatedTroops.Add(key, num); } } } } if (dictionary.ContainsKey("champions")) { this.Champions = new Dictionary <string, int>(StringComparer.Ordinal); Dictionary <string, object> dictionary7 = dictionary["champions"] as Dictionary <string, object>; if (dictionary7 != null) { foreach (KeyValuePair <string, object> current4 in dictionary7) { string key2 = current4.Key; this.Champions.Add(key2, Convert.ToInt32(current4.Value)); } } } if (dictionary.ContainsKey("creditsCharged")) { this.CreditsCharged = Convert.ToInt32(dictionary["creditsCharged"]); } this.Contracts = new List <ContractTO>(); if (dictionary.ContainsKey("contracts")) { List <object> list = dictionary["contracts"] as List <object>; if (list != null) { for (int i = 0; i < list.Count; i++) { ContractTO item = new ContractTO().FromObject(list[i]) as ContractTO; this.Contracts.Add(item); } } } if (dictionary.ContainsKey("faction")) { string name = Convert.ToString(dictionary["faction"]); this.PlayerFaction = StringUtils.ParseEnum <FactionType>(name); } if (dictionary.ContainsKey("attackerDeployables")) { this.AttackerDeployableServerData = (dictionary["attackerDeployables"] as Dictionary <string, object>); } if (dictionary.ContainsKey("equipment")) { List <object> list2 = dictionary["equipment"] as List <object>; if (list2 != null) { this.Equipment = new List <string>(); int j = 0; int count = list2.Count; while (j < count) { this.Equipment.Add(list2[j] as string); j++; } } } return(this); }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.ButtonClicked) { if (id <= EventId.EntityKilled) { if (id <= EventId.BuildingSelected) { if (id != EventId.BuildingPurchaseSuccess) { if (id != EventId.BuildingSelected) { return(EatResponse.NotEaten); } Entity entity = (Entity)cookie; BuildingComponent buildingComponent = entity.Get <BuildingComponent>(); if (buildingComponent == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType = buildingComponent.BuildingType; if (buildingType.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { Entity entity2 = (Entity)cookie; BuildingComponent buildingComponent2 = entity2.Get <BuildingComponent>(); if (buildingComponent2 == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType2 = buildingComponent2.BuildingType; if (buildingType2.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else { if (id == EventId.DroidPurchaseAnimationComplete) { goto IL_3D4; } if (id != EventId.EntityKilled) { return(EatResponse.NotEaten); } Entity entity3 = (Entity)cookie; string text = ""; string text2 = this.prepareArgs[1]; if (text2 == "troopKilled") { TroopComponent troopComponent = entity3.Get <TroopComponent>(); if (troopComponent == null) { return(EatResponse.NotEaten); } text = troopComponent.TroopType.Uid; } else if (text2 == "buildingKilled") { BuildingComponent buildingComponent3 = entity3.Get <BuildingComponent>(); if (buildingComponent3 == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType3 = buildingComponent3.BuildingType; text = buildingType3.Uid; } if (text.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id <= EventId.TroopDonationTrackRewardReceived) { if (id != EventId.TroopDeployed) { if (id != EventId.TroopDonationTrackRewardReceived) { return(EatResponse.NotEaten); } goto IL_3D4; } } else if (id != EventId.SpecialAttackDeployed) { if (id != EventId.ButtonClicked) { return(EatResponse.NotEaten); } string text3 = (string)cookie; if (text3.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { SpecialAttack specialAttack = (SpecialAttack)cookie; if (specialAttack.VO.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id <= EventId.InventoryResourceUpdated) { if (id <= EventId.ContractStarted) { if (id != EventId.ContractAdded) { if (id != EventId.ContractStarted) { return(EatResponse.NotEaten); } ContractEventData contractEventData = (ContractEventData)cookie; if (contractEventData.Contract.ProductUid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { ContractEventData contractEventData2 = (ContractEventData)cookie; if (contractEventData2.Contract.ProductUid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id != EventId.ContractCompletedForStoryAction) { if (id != EventId.InventoryResourceUpdated) { return(EatResponse.NotEaten); } string text4 = (string)cookie; if (text4.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { ContractTO contractTO = (ContractTO)cookie; if (contractTO.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id <= EventId.ScreenLoaded) { if (id != EventId.ScreenClosing) { if (id != EventId.ScreenLoaded) { return(EatResponse.NotEaten); } UXFactory uXFactory = cookie as UXFactory; string name = uXFactory.Root.name; if (name.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { UXFactory uXFactory2 = cookie as UXFactory; string text5 = (uXFactory2 == null || uXFactory2.Root == null) ? string.Empty : uXFactory2.Root.name; if (text5.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id != EventId.HeroDeployed && id != EventId.ChampionDeployed) { if (id != EventId.EquipmentUnlocked) { return(EatResponse.NotEaten); } goto IL_3D4; } Entity entity4 = (Entity)cookie; TroopComponent troopComponent2 = entity4.Get <TroopComponent>(); ITroopDeployableVO troopType = troopComponent2.TroopType; if (troopType.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); IL_3D4: this.CountEvent(); return(EatResponse.NotEaten); }