/// <summary> /// Deserialization constructor. /// </summary> /// <param name="group">Market Group the Blueprint will be a member of.</param> /// <param name="src">Source serializable blueprint.</param> internal Blueprint(MarketGroup group, SerializableBlueprint src) : base(group, src) { RunsPerCopy = src.MaxProductionLimit; ProducesItem = StaticItems.GetItemByID(src.ProduceItemID); ProductionTime = src.ProductionTime; ResearchCopyTime = src.ResearchCopyTime; ResearchMaterialTime = src.ResearchMaterialTime; ResearchProductivityTime = src.ResearchProductivityTime; ResearchInventionTime = src.InventionTime; ReverseEngineeringTime = src.ReverseEngineeringTime; // Invented blueprints m_inventBlueprints = new Dictionary <int, double>(src.InventionTypeIDs?.Count ?? 0); if (src.InventionTypeIDs != null && src.InventionTypeIDs.Any()) { m_inventBlueprints.AddRange(src.InventionTypeIDs); } // Materials prerequisites m_materialRequirements = new FastList <StaticRequiredMaterial>(src.ReqMaterial?.Count ?? 0); if (src.ReqMaterial == null) { return; } foreach (SerializableRequiredMaterial prereq in src.ReqMaterial) { m_materialRequirements.Add(new StaticRequiredMaterial(prereq)); } }
/// <summary> /// Constructor. /// </summary> /// <param name="src">The source.</param> /// <exception cref="System.ArgumentNullException">src</exception> public Material(SerializableMaterialQuantity src) { src.ThrowIfNull(nameof(src)); Item = StaticItems.GetItemByID(src.ID); Quantity = src.Quantity; }
/// <summary> /// Initialize static masteries. /// </summary> internal static void Load() { MasteriesDatafile datafile = Util.DeserializeDatafile <MasteriesDatafile>( DatafileConstants.MasteriesDatafile); foreach (SerializableMasteryShip srcShip in datafile.MasteryShips) { Ship ship = StaticItems.GetItemByID(srcShip.ID) as Ship; if (ship != null) { s_masteryShipsByID[ship.ID] = new MasteryShip(srcShip, ship); } } GlobalDatafileCollection.OnDatafileLoaded(); }
/// <summary> /// Gets the material's name. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> private static string GetName(int id) { Item item = StaticItems.GetItemByID(id); return(item?.Name ?? String.Empty); }
/// <summary> /// Format a property value as shown in EVE /// </summary> /// <param name="value"></param> /// <returns></returns> private string Format(string value) { if (float.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out m_value)) { try { // Format a value of Structure Volume if (m_id == 161) { return(String.Format(CultureConstants.DefaultCulture, "{0:#,##0.0##} {1}", m_value, m_unit)); } // Format a value of Capacitor Capacity if (m_id == 482) { return(String.Format(CultureConstants.DefaultCulture, "{0:#,##0} {1}", Math.Floor(m_value), m_unit)); } // Format a value of Ships Warp Speed if (m_id == 1281) { return(String.Format(CultureConstants.DefaultCulture, "{0:0.0#} {1}", m_value, m_unit)); } switch (m_unitID) { // Format a value of Mass case 2: if (m_value <= 1000) { return(String.Format(CultureConstants.DefaultCulture, "{0:#,##0.0#} {1}", m_value, m_unit)); } else { return(String.Format(CultureConstants.DefaultCulture, "{0:#,##0} {1}", m_value, m_unit)); } // Format a value of Millseconds case 101: return(String.Format(CultureConstants.DefaultCulture, "{0:#,##0.00} {1}", m_value / 1000, m_unit)); // Format a value of Absolute Percentage case 127: return(String.Format(CultureConstants.DefaultCulture, "{0} {1}", (m_value) * 100, m_unit)); // Format a value of Inverse Absolute Percentage case 108: return(String.Format(CultureConstants.DefaultCulture, "{0} {1}", (1 - m_value) * 100, m_unit)); // Format a value of Modifier Percentage case 109: return(String.Format(CultureConstants.DefaultCulture, "{0:0.###} {1}", (m_value - 1) * 100, m_unit)); // Format a value of Inverse Modifier Percentage case 111: return(String.Format(CultureConstants.DefaultCulture, "{0:0.###} {1}", (1 - m_value) * 100, m_unit)); // A reference to a group, it has been pre-transformed on XmlGenerator. case 115: // "groupID" return(value); // A reference to an item or a skill. case 116: // "typeID" int id = Int32.Parse(value); return(StaticItems.GetItemByID(id).Name); // Format a Sizeclass case 117: // "1=small 2=medium 3=l" int size = Int32.Parse(value); switch (size) { case 1: return("Small"); case 2: return("Medium"); case 3: return("Large"); case 4: return("Extra Large"); default: return("Unknown"); } // Format all other values (use of thousand and decimal separator) default: return(String.Format(CultureConstants.DefaultCulture, "{0:#,##0.###} {1}", m_value, m_unit)); } } catch { return("Error"); } } return(value); }
private static string GetName(int id) { Item item = StaticItems.GetItemByID(id); return(item != null ? item.Name : String.Empty); }
/// <summary> /// Format a property value as shown in EVE. /// </summary> /// <param name="value"></param> /// <returns></returns> private String Format(String value) { Single numericValue; if (!Single.TryParse(value, NumberStyles.Number, CultureConstants.InvariantCulture, out numericValue)) { return(value); } try { // Format a value of Packaged Volume if (Name == DBConstants.PackagedVolumePropertyName) { return($"{numericValue:N1} {Unit}"); } // Format a value of Structure Volume if (ID == DBConstants.VolumePropertyID) { return(numericValue <= 1000 ? $"{numericValue:N2} {Unit}" : $"{numericValue:#,##0.0##} {Unit}"); } // Format a value of Capacitor Capacity if (ID == DBConstants.CapacitorCapacityPropertyID) { return($"{Math.Floor(numericValue):N0} {Unit}"); } // Format a value of Ships Warp Speed if (ID == DBConstants.ShipWarpSpeedPropertyID) { return($"{numericValue:N2} {Unit}"); } switch (UnitID) { // Format a value of Mass case DBConstants.MassUnitID: return(numericValue <= 1000 ? $"{numericValue:#,##0.0#} {Unit}" : $"{numericValue:N0} {Unit}"); // Format a value of Millseconds case DBConstants.MillsecondsUnitID: return($"{numericValue / 1000:N2} {Unit}"); // Format a value of Absolute Percentage case DBConstants.AbsolutePercentUnitID: return($"{numericValue * 100} {Unit}"); // Format a value of Inverse Absolute Percentage case DBConstants.InverseAbsolutePercentUnitID: return($"{(1 - numericValue) * 100} {Unit}"); // Format a value of Modifier Percentage case DBConstants.ModifierPercentUnitID: return($"{(numericValue - 1) * 100:0.###} {Unit}"); // Format a value of Inverse Modifier Percentage case DBConstants.InversedModifierPercentUnitID: return($"{(1 - numericValue) * 100:0.###} {Unit}"); // A reference to a group (groupID), it has been pre-transformed on XmlGenerator case DBConstants.GroupIDUnitID: return(value); // A reference to an item or a skill (typeID) case DBConstants.TypeUnitID: int id = Int32.Parse(value, CultureConstants.InvariantCulture); Item item = StaticItems.GetItemByID(id); return(id == 0 ? String.Empty : item != null ? item.Name : EveMonConstants.UnknownText); // Format a Sizeclass ("1=small 2=medium 3=l") case DBConstants.SizeclassUnitID: int size = Int32.Parse(value, CultureConstants.InvariantCulture); switch (size) { case 1: return("Small"); case 2: return("Medium"); case 3: return("Large"); case 4: return("Extra Large"); default: return(EveMonConstants.UnknownText); } // Format all other values (use of thousand and decimal separator) default: return($"{numericValue:#,##0.###} {Unit}"); } } catch (FormatException) { return("N/A"); } }
public Material(SerializableMaterialQuantity src) { m_product = StaticItems.GetItemByID(src.ID); m_quantity = src.Quantity; }