internal HardpointCounter(ChassisDef chassisDef, ChassisLocations location) { MechStatisticsRules.GetHardpointCountForLocation(chassisDef, location, ref numBallistic, ref numEnergy, ref numMissile, ref numSmall); }
private static DumperDataEntry FillMech(MechDef d, int parts, int maxparts, int storage, int active, int sma_parts) { DumperDataEntry r = new DumperDataEntry(); r.DataTxt = new string[9]; r.DataTxt[0] = ((storage + active) > 0 ? "+" : "-") + d.Chassis.Tonnage + "t " + TryLoc(d.Chassis.Description.UIName) + " " + TryLoc(d.Chassis.VariantName); r.DataTxt[1] = TryLoc(d.Chassis.StockRole) + ""; int bal = 0; int en = 0; int mis = 0; int sup = 0; foreach (ChassisLocations c in AllChassisLocs) { MechStatisticsRules.GetHardpointCountForLocation(d, c, ref bal, ref en, ref mis, ref sup); } r.DataTxt[2] = bal + "/" + en + "/" + mis + "/" + sup; r.DataTxt[3] = (d.Chassis.Tonnage - d.Chassis.InitialTonnage) + "/" + d.Chassis.Heatsinks; float carmor = 0; float marmor = 0; foreach (ChassisLocations c in AllChassisLocs) { carmor += d.GetLocationLoadoutDef(c).AssignedArmor; marmor += d.GetChassisLocationDef(c).MaxArmor; if (d.GetChassisLocationDef(c).MaxRearArmor > 0) { carmor += d.GetLocationLoadoutDef(c).AssignedRearArmor; marmor += d.GetChassisLocationDef(c).MaxRearArmor; } } float div = UnityGameInstance.BattleTechGame.MechStatisticsConstants.ARMOR_PER_TENTH_TON * 10f; if (d.Chassis.ChassisTags.Contains("chassis_ferro")) { if (d.Chassis.ChassisTags.Contains("chassis_clan")) { div = UnityGameInstance.BattleTechGame.MechStatisticsConstants.ARMOR_PER_TENTH_TON * 12f; } else { div = UnityGameInstance.BattleTechGame.MechStatisticsConstants.ARMOR_PER_TENTH_TON * 11.2f; } } carmor /= div; marmor /= div; carmor = Mathf.Round(carmor * 10) / 10; marmor = Mathf.Round(marmor * 10) / 10; r.DataTxt[3] += "/" + carmor + "/" + marmor + "/" + (d.Chassis.Tonnage - d.Chassis.InitialTonnage - marmor); if (d.Chassis.MovementCapDef == null) { d.Chassis.RefreshMovementCaps(); if (d.Chassis.MovementCapDef == null) { r.DataTxt[4] = "??/" + d.Chassis.MaxJumpjets; } else { r.DataTxt[4] = d.Chassis.MovementCapDef.MaxWalkDistance + "/" + d.Chassis.MaxJumpjets; } } else { r.DataTxt[4] = d.Chassis.MovementCapDef.MaxWalkDistance + "/" + d.Chassis.MaxJumpjets; } r.DataTxt[5] = d.Chassis.MeleeDamage + "/" + d.Chassis.MeleeInstability + "/" + d.Chassis.DFADamage + "/" + d.Chassis.DFAInstability; r.DataTxt[6] = active + "/" + storage + "/" + parts; if (sma_parts >= 0) { r.DataTxt[6] += "(" + sma_parts + ")"; } r.DataTxt[6] += "/" + maxparts; r.DataTxt[7] = d.Chassis.Description.Id + "/" + d.Description.Id; Dictionary <string, int> eq = new Dictionary <string, int>(); Dictionary <string, int> feq = new Dictionary <string, int>(); foreach (MechComponentRef c in d.Inventory) { if (c.ComponentDefType == ComponentType.Weapon) { WeaponDef wep = c.Def as WeaponDef; if (wep != null && wep.WeaponCategoryValue.IsMelee || wep.WeaponSubType == WeaponSubType.AIImaginary || wep.WeaponEffectID.Contains("WeaponEffect-Artillery")) { continue; } } string key = c.Def.Description.Id; if (c.IsFixed) { if (feq.ContainsKey(key)) { feq[key]++; } else { feq.Add(key, 1); } } else { if (eq.ContainsKey(key)) { eq[key]++; } else { eq.Add(key, 1); } } } string txteq = ""; string txtfeq = ""; foreach (string key in eq.Keys.OrderBy((k) => k)) { if (!string.IsNullOrEmpty(txteq)) { txteq += ","; } txteq += key + ":" + eq[key]; } foreach (string key in feq.Keys.OrderBy((k) => k)) { if (!string.IsNullOrEmpty(txtfeq)) { txtfeq += ","; } txtfeq += key + ":" + feq[key]; } string txtext = ""; foreach (string ex in ExtrasToNote) { if (d.Chassis.ChassisTags.Contains(ex)) { if (!string.IsNullOrEmpty(txtext)) { txtext += ","; } txtext += ex; } } r.DataTxt[8] = txtext + "/" + txteq + "/" + txtfeq; r.Sort = string.Format("{0,3}_{1}", new object[] { d.Chassis.Tonnage, d.Chassis.VariantName }); r.DataCsv = d.Chassis.Tonnage + ";" + d.Chassis.Description.UIName + ";" + d.Chassis.VariantName + ";" + d.Chassis.StockRole; r.DataCsv += ";" + bal + ";" + en + ";" + mis + ";" + sup; r.DataCsv += ";" + (d.Chassis.Tonnage - d.Chassis.InitialTonnage) + ";" + d.Chassis.Heatsinks + ";" + carmor + ";" + marmor + ";" + (d.Chassis.Tonnage - d.Chassis.InitialTonnage - marmor); r.DataCsv += ";" + (d.Chassis.MovementCapDef == null ? -1f : d.Chassis.MovementCapDef.MaxWalkDistance) + ";" + d.Chassis.MaxJumpjets; r.DataCsv += ";" + d.Chassis.MeleeDamage + ";" + d.Chassis.MeleeInstability + ";" + d.Chassis.DFADamage + ";" + d.Chassis.DFAInstability; r.DataCsv += ";" + active + ";" + storage + ";" + parts; if (sma_parts >= 0) { r.DataCsv += "(" + sma_parts + ")"; } r.DataCsv += ";" + maxparts; r.DataCsv += ";" + d.Chassis.Description.Id + ";" + d.Description.Id; r.DataCsv += ";" + txtext + ";" + txteq + ";" + txtfeq; return(r); }