public ISerializable FromObject(object obj) { Dictionary <string, object> dictionary = obj as Dictionary <string, object>; this.CombatEncounter = (new CombatEncounter().FromObject(dictionary["combatEncounter"]) as CombatEncounter); List <object> list = dictionary["battleActions"] as List <object>; foreach (object current in list) { Dictionary <string, object> dictionary2 = current as Dictionary <string, object>; string actionId = dictionary2["actionId"] as string; this.BattleActions.Add(BattleRecord.CreateBattleAction(actionId, current)); } if (dictionary.ContainsKey("attackerDeploymentData")) { object obj2 = dictionary["attackerDeploymentData"]; if (obj2 != null) { this.AttackerDeploymentData = (new BattleDeploymentData().FromObject(obj2) as BattleDeploymentData); } } if (dictionary.ContainsKey("defenderDeploymentData")) { object obj3 = dictionary["defenderDeploymentData"]; if (obj3 != null) { this.DefenderDeploymentData = (new BattleDeploymentData().FromObject(obj3) as BattleDeploymentData); } } if (dictionary.ContainsKey("battleType")) { this.BattleType = StringUtils.ParseEnum <BattleType>(dictionary["battleType"] as string); } else { this.BattleType = BattleType.Pvp; } this.BattleLength = Convert.ToInt32(dictionary["battleLength"]); if (dictionary.ContainsKey("lowFPS")) { this.LowestFPS = (float)Convert.ToInt32(dictionary["lowFPS"]); } if (dictionary.ContainsKey("lowFPSTime")) { this.LowestFPSTime = (uint)Convert.ToInt32(dictionary["lowFPSTime"]); } if (dictionary.ContainsKey("missionId")) { this.MissionId = (dictionary["missionId"] as string); } if (dictionary.ContainsKey("planetId")) { this.PlanetId = (dictionary["planetId"] as string); } if (this.PlanetId == null && this.CombatEncounter.map.Planet != null) { this.PlanetId = this.CombatEncounter.map.Planet.Uid; } if (dictionary.ContainsKey("battleVersion")) { this.BattleVersion = (dictionary["battleVersion"] as string); } this.CmsVersion = (dictionary["manifestVersion"] as string); if (dictionary.ContainsKey("battleAttributes")) { this.BattleAttributes = new BattleAttributes(); this.BattleAttributes.FromObject(dictionary["battleAttributes"]); } this.LootCreditsAvailable = Convert.ToInt32(dictionary["lootCreditsAvailable"]); this.LootMaterialsAvailable = Convert.ToInt32(dictionary["lootMaterialsAvailable"]); if (dictionary.ContainsKey("lootContrabandAvailable")) { this.LootContrabandAvailable = Convert.ToInt32(dictionary["lootContrabandAvailable"]); } this.BuildingLootCreditsMap = new Dictionary <string, int>(); if (dictionary.ContainsKey("lootBuildingCreditsMap")) { Dictionary <string, object> dictionary3 = dictionary["lootBuildingCreditsMap"] as Dictionary <string, object>; if (dictionary3 != null) { foreach (KeyValuePair <string, object> current2 in dictionary3) { this.BuildingLootCreditsMap.Add(current2.Key, Convert.ToInt32(current2.Value)); } } } this.BuildingLootMaterialsMap = new Dictionary <string, int>(); if (dictionary.ContainsKey("lootBuildingMaterialsMap")) { Dictionary <string, object> dictionary4 = dictionary["lootBuildingMaterialsMap"] as Dictionary <string, object>; if (dictionary4 != null) { foreach (KeyValuePair <string, object> current3 in dictionary4) { this.BuildingLootMaterialsMap.Add(current3.Key, Convert.ToInt32(current3.Value)); } } } this.BuildingLootContrabandMap = new Dictionary <string, int>(); if (dictionary.ContainsKey("lootBuildingContrabandMap")) { Dictionary <string, object> dictionary5 = dictionary["lootBuildingContrabandMap"] as Dictionary <string, object>; if (dictionary5 != null) { foreach (KeyValuePair <string, object> current4 in dictionary5) { this.BuildingLootContrabandMap.Add(current4.Key, Convert.ToInt32(current4.Value)); } } } this.victoryConditionsUids = new List <string>(); List <object> list2 = dictionary["victoryConditions"] as List <object>; int i = 0; int count = list2.Count; while (i < count) { this.victoryConditionsUids.Add(list2[i] as string); i++; } this.failureConditionUid = (dictionary["failureCondition"] as string); this.DefenderGuildTroops = new Dictionary <string, int>(); if (dictionary.ContainsKey("donatedTroops")) { Dictionary <string, object> dictionary6 = dictionary["donatedTroops"] as Dictionary <string, object>; if (dictionary6 != null) { foreach (KeyValuePair <string, object> current5 in dictionary6) { this.DefenderGuildTroops.Add(current5.Key, Convert.ToInt32(current5.Value)); } } } this.AttackerGuildTroops = new Dictionary <string, int>(); if (dictionary.ContainsKey("donatedTroopsAttacker")) { Dictionary <string, object> dictionary7 = dictionary["donatedTroopsAttacker"] as Dictionary <string, object>; if (dictionary7 != null) { foreach (KeyValuePair <string, object> current6 in dictionary7) { this.AttackerGuildTroops.Add(current6.Key, Convert.ToInt32(current6.Value)); } } } this.DefenderChampions = new Dictionary <string, int>(); if (dictionary.ContainsKey("champions")) { Dictionary <string, object> dictionary8 = dictionary["champions"] as Dictionary <string, object>; if (dictionary8 != null) { foreach (KeyValuePair <string, object> current7 in dictionary8) { this.DefenderChampions.Add(current7.Key, Convert.ToInt32(current7.Value)); } } } if (dictionary.ContainsKey("defenseEncounterProfile")) { this.DefenseEncounterProfile = (dictionary["defenseEncounterProfile"] as string); } if (dictionary.ContainsKey("battleScript")) { this.BattleScript = (dictionary["battleScript"] as string); } this.DisabledBuildings = new List <string>(); if (dictionary.ContainsKey("disabledBuildings")) { List <object> list3 = dictionary["disabledBuildings"] as List <object>; for (int j = 0; j < list3.Count; j++) { this.DisabledBuildings.Add((string)list3[j]); } } if (dictionary.ContainsKey("simSeedA")) { this.SimSeed.SimSeedA = uint.Parse(dictionary["simSeedA"] as string); } if (dictionary.ContainsKey("simSeedB")) { this.SimSeed.SimSeedB = uint.Parse(dictionary["simSeedB"] as string); } if (dictionary.ContainsKey("viewTimePreBattle")) { this.ViewTimePassedPreBattle = float.Parse(dictionary["viewTimePreBattle"] as string); } this.AttackerWarBuffs = this.ParseStringList(dictionary, "attackerWarBuffs"); this.DefenderWarBuffs = this.ParseStringList(dictionary, "defenderWarBuffs"); this.AttackerEquipment = this.ParseStringList(dictionary, "attackerEquipment"); this.DefenderEquipment = this.ParseStringList(dictionary, "defenderEquipment"); return(this); }
public unsafe static long $Invoke1(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(BattleRecord.CreateBattleAction(Marshal.PtrToStringUni(*(IntPtr *)args), GCHandledObjects.GCHandleToObject(args[1])))); }