public unsafe static long $Invoke0(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(BattleParticipant.CreateFromObject(GCHandledObjects.GCHandleToObject(*args)))); }
public ISerializable FromObject(object obj) { Dictionary <string, object> dictionary = obj as Dictionary <string, object>; this.BattleVersion = (dictionary.ContainsKey("battleVersion") ? Convert.ToString(dictionary["battleVersion"], CultureInfo.InvariantCulture) : "21.0".ToString()); this.CmsVersion = (dictionary.ContainsKey("cmsVersion") ? Convert.ToString(dictionary["cmsVersion"], CultureInfo.InvariantCulture) : Service.Get <FMS>().GetFileVersion("patches/base.json").ToString()); this.MissionId = (dictionary.ContainsKey("missionId") ? Convert.ToString(dictionary["missionId"], CultureInfo.InvariantCulture) : null); this.EarnedStars = Convert.ToInt32(dictionary["stars"], CultureInfo.InvariantCulture); this.DamagePercent = Convert.ToInt32(dictionary["baseDamagePercent"], CultureInfo.InvariantCulture); this.ManifestVersion = Convert.ToString(dictionary["manifestVersion"], CultureInfo.InvariantCulture); this.RecordID = Convert.ToString(dictionary["battleId"], CultureInfo.InvariantCulture); this.Attacker = BattleParticipant.CreateFromObject(dictionary["attacker"]); this.Defender = BattleParticipant.CreateFromObject(dictionary["defender"]); this.EndBattleServerTime = Convert.ToUInt32(dictionary["attackDate"], CultureInfo.InvariantCulture); if (dictionary.ContainsKey("planetId")) { this.PlanetId = Convert.ToString(dictionary["planetId"], CultureInfo.InvariantCulture); } if (dictionary.ContainsKey("potentialMedalGain")) { this.PotentialMedalsToGain = Convert.ToInt32(dictionary["potentialMedalGain"], CultureInfo.InvariantCulture); } if (dictionary.ContainsKey("troopsExpended")) { this.troopsExpended = (dictionary["troopsExpended"] as Dictionary <string, object>); } if (dictionary.ContainsKey("attackerGuildTroopsExpended")) { this.attackerGuildTroopsDeployed = (dictionary["attackerGuildTroopsExpended"] as Dictionary <string, object>); } this.DefenderDeployedData = null; if (dictionary.ContainsKey("looted")) { Dictionary <string, object> dictionary2 = dictionary["looted"] as Dictionary <string, object>; if (dictionary2 != null) { if (dictionary2.ContainsKey("credits")) { this.LootCreditsDeducted = Convert.ToInt32(dictionary2["credits"], CultureInfo.InvariantCulture); } if (dictionary2.ContainsKey("materials")) { this.LootMaterialsDeducted = Convert.ToInt32(dictionary2["materials"], CultureInfo.InvariantCulture); } if (dictionary2.ContainsKey("contraband")) { this.LootContrabandDeducted = Convert.ToInt32(dictionary2["contraband"], CultureInfo.InvariantCulture); } } } bool flag = false; if (dictionary.ContainsKey("earned")) { Dictionary <string, object> dictionary3 = dictionary["earned"] as Dictionary <string, object>; if (dictionary3 != null) { flag = true; if (dictionary3.ContainsKey("credits")) { this.LootCreditsEarned = Convert.ToInt32(dictionary3["credits"], CultureInfo.InvariantCulture); } if (dictionary3.ContainsKey("materials")) { this.LootMaterialsEarned = Convert.ToInt32(dictionary3["materials"], CultureInfo.InvariantCulture); } if (dictionary3.ContainsKey("contraband")) { this.LootContrabandEarned = Convert.ToInt32(dictionary3["contraband"], CultureInfo.InvariantCulture); } } } if (!flag) { this.LootCreditsEarned = this.LootCreditsDeducted; this.LootMaterialsEarned = this.LootMaterialsDeducted; this.LootContrabandEarned = this.LootContrabandDeducted; } if (dictionary.ContainsKey("maxLootable")) { Dictionary <string, object> dictionary4 = dictionary["maxLootable"] as Dictionary <string, object>; if (dictionary4 != null) { if (dictionary4.ContainsKey("credits")) { this.LootCreditsAvailable = Convert.ToInt32(dictionary4["credits"], CultureInfo.InvariantCulture); } if (dictionary4.ContainsKey("materials")) { this.LootMaterialsAvailable = Convert.ToInt32(dictionary4["materials"], CultureInfo.InvariantCulture); } if (dictionary4.ContainsKey("contraband")) { this.LootContrabandAvailable = Convert.ToInt32(dictionary4["contraband"], CultureInfo.InvariantCulture); } } } this.Revenged = false; if (dictionary.ContainsKey("revenged")) { this.Revenged = Convert.ToBoolean(dictionary["revenged"], CultureInfo.InvariantCulture); } string playerId = Service.Get <CurrentPlayer>().PlayerId; this.Won = ((this.AttackerID == playerId && this.EarnedStars > 0) || (this.DefenderID == playerId && this.EarnedStars == 0)); if (dictionary.ContainsKey("defenseEncounterProfile")) { this.DefenseEncounterProfile = (dictionary["defenseEncounterProfile"] as string); } if (dictionary.ContainsKey("battleScript")) { this.BattleScript = (dictionary["battleScript"] as string); } if (dictionary.ContainsKey("attackerEquipment")) { this.AttackerEquipment = new List <string>(); List <object> list = dictionary["attackerEquipment"] as List <object>; if (list != null) { int i = 0; int count = list.Count; while (i < count) { this.AttackerEquipment.Add((string)list[i]); i++; } } } if (dictionary.ContainsKey("defenderEquipment")) { this.DefenderEquipment = new List <string>(); List <object> list2 = dictionary["defenderEquipment"] as List <object>; if (list2 != null) { int j = 0; int count2 = list2.Count; while (j < count2) { this.DefenderEquipment.Add((string)list2[j]); j++; } } } return(this); }