コード例 #1
0
ファイル: MarketOrder.cs プロジェクト: strannik-au/evemon
        /// <summary>
        /// Populates the serialization object order with the info from the API.
        /// </summary>
        /// <param name="src">The source.</param>
        private void PopulateOrderInfo(SerializableOrderListItem src)
        {
            OwnerID         = src.OwnerID;
            ID              = src.OrderID;
            Item            = StaticItems.GetItemByID(src.ItemID);
            UnitaryPrice    = src.UnitaryPrice;
            InitialVolume   = src.InitialVolume;
            RemainingVolume = src.RemainingVolume;
            MinVolume       = src.MinVolume;
            Duration        = src.Duration;
            Issued          = src.Issued;
            IssuedFor       = src.IssuedFor;
            m_stationID     = src.StationID;
            UpdateStation();

            if (src.IsBuyOrder == 0)
            {
                return;
            }

            BuyOrder buyOrder = (BuyOrder)this;

            buyOrder.Escrow = src.Escrow;
            buyOrder.Range  = src.Range;
        }
コード例 #2
0
ファイル: PlanetaryPin.cs プロジェクト: Slazanger/evemon
        /// <summary>
        /// Gets the volume.
        /// </summary>
        /// <returns></returns>
        private double GetVolume()
        {
            Item item = StaticItems.GetItemByID(ContentTypeID);

            return(item != null && m_volumeProperty != null?m_volumeProperty.
                   GetNumericValue(item) * ContentQuantity : 0.0);
        }
コード例 #3
0
        /// <summary>
        /// Handles the Click event of the showInBrowserMenuItem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void showInBrowserMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripItem menuItem = sender as ToolStripItem;

            if (menuItem == null)
            {
                return;
            }

            PlanetaryPin pin = lvPlanetary.SelectedItems[0]?.Tag as PlanetaryPin;

            // showInstallationInBrowserMenuItem
            if (menuItem == showInstallationInBrowserMenuItem)
            {
                if (pin?.TypeID == null)
                {
                    return;
                }

                Item installation = StaticItems.GetItemByID(pin.TypeID);

                if (installation != null)
                {
                    PlanWindow.ShowPlanWindow(Character).ShowItemInBrowser(installation);
                }

                return;
            }

            // showCommodityInBrowserMenuItem
            if (menuItem == showCommodityInBrowserMenuItem)
            {
                if (pin?.ContentTypeID == null)
                {
                    return;
                }

                Item commmodity = StaticItems.GetItemByID(pin.ContentTypeID);

                if (commmodity != null)
                {
                    PlanWindow.ShowPlanWindow(Character).ShowItemInBrowser(commmodity);
                }

                return;
            }


            if (pin?.Colony?.PlanetTypeID == null)
            {
                return;
            }

            Item planet = StaticItems.GetItemByID(pin.Colony.PlanetTypeID);

            if (planet != null)
            {
                PlanWindow.ShowPlanWindow(Character).ShowItemInBrowser(planet);
            }
        }
コード例 #4
0
        /// <summary>
        /// Scans for prices.
        /// </summary>
        /// <returns></returns>
        private static IEnumerable <MineralPrice> GetPrices(IMineralParser parser)
        {
            string content = String.Empty;

            try
            {
                content = HttpWebClientService.DownloadString(parser.URL).Result;
            }
            catch (HttpWebClientServiceException ex)
            {
                ExceptionHandler.LogException(ex, false);
            }

            // Scan for prices
            MatchCollection mc = parser.Tokenizer.Matches(content);

            return(mc.Cast <Match>().Select(match =>
            {
                int typeID;
                string name = Int32.TryParse(match.Groups["name"].Value, out typeID)
                    ? StaticItems.GetItemByID(typeID).Name
                    : match.Groups["name"].Value;

                return new MineralPrice
                {
                    Name = name,
                    Price = Decimal.Parse(match.Groups["price"].Value,
                                          NumberStyles.Currency,
                                          CultureInfo.InvariantCulture)
                };
            }));
        }
コード例 #5
0
        /// <summary>
        /// Handles the MouseDown event of the pictureBox control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
        private void pictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            PictureBox pictureBox = sender as PictureBox;

            if (pictureBox == null)
            {
                return;
            }

            // Right click reset the cursor
            pictureBox.Cursor = Cursors.Default;

            int typeId =
                pictureBox == ShipPictureBox
                    ? m_attacker.ShipTypeID
                    : pictureBox == WeaponPictureBox
                        ? m_attacker.WeaponTypeID
                        : Item.UnknownItem.ID;

            // Set the selected item
            m_selectedItem = StaticItems.GetItemByID(typeId);

            // Display the context menu
            contextMenuStrip.Show(pictureBox, e.Location);
        }
コード例 #6
0
ファイル: KillReportVictim.cs プロジェクト: henrikja/EVEMon
        /// <summary>
        /// Updates the content.
        /// </summary>
        private void UpdateContent()
        {
            Task.WhenAll(
                GetImageForAsync(CharacterPictureBox),
                GetImageForAsync(ShipPictureBox),
                GetImageForAsync(CorpPictureBox));

            if (m_killLog.Victim.AllianceID != 0)
            {
                Task.WhenAll(GetImageForAsync(AlliancePictureBox));
                AllianceNameLabel.Text = m_killLog.Victim.AllianceName;
            }
            else
            {
                CorpAllianceFlowLayoutPanel.Controls.Remove(AllianceNameLabel);
                CorpAllianceFlowLayoutPanel.Padding = new Padding(0, 12, 0, 0);
            }

            CharacterNameLabel.Text = m_killLog.Victim.Name;
            CorpNameLabel.Text      = m_killLog.Victim.CorporationName;

            Item ship = StaticItems.GetItemByID(m_killLog.Victim.ShipTypeID);

            ShipNameLabel.Text  = ship.Name;
            ShipGroupLabel.Text = String.Format(CultureConstants.DefaultCulture, ShipGroupLabel.Text, ship.GroupName);

            KillTimeLabel.Text       = m_killLog.KillTime.ToLocalTime().DateTimeToDotFormattedString();
            SolarSystemLabel.Text    = m_killLog.SolarSystem?.Name;
            SecStatusLabel.Text      = m_killLog.SolarSystem?.SecurityLevel.ToNumericString(1);
            SecStatusLabel.ForeColor = m_killLog.SolarSystem?.SecurityLevelColor ?? SystemColors.ControlText;
            ConstelationLabel.Text   = m_killLog.SolarSystem?.Constellation?.Name;
            RegionLabel.Text         = m_killLog.SolarSystem?.Constellation?.Region?.Name;
        }
コード例 #7
0
        /// <summary>
        /// Gets the output item by its ID (can be a blueprint or an item).
        /// </summary>
        /// <param name="id">The itemID of the blueprint.</param>
        /// <returns>The output item from the bluperint.</returns>
        private Item GetOutputItem(int id)
        {
            switch (Activity)
            {
            case BlueprintActivity.Manufacturing:
                return(StaticBlueprints.GetBlueprintByID(InstalledItem.ID).ProducesItem ??
                       StaticItems.GetItemByID(0));

            case BlueprintActivity.ResearchingMaterialEfficiency:
            case BlueprintActivity.ResearchingTimeEfficiency:
            case BlueprintActivity.Copying:
                return(InstalledItem);

            case BlueprintActivity.Invention:
            case BlueprintActivity.ReverseEngineering:
                return(StaticBlueprints.GetBlueprintByID(id) ?? StaticItems.GetItemByID(0));

            case BlueprintActivity.SimpleReactions:
            case BlueprintActivity.Reactions:
                return(StaticItems.GetItemByID(InstalledItem?.ReactionOutcome?.Item?.ID ?? 0));

            default:
                return(StaticItems.GetItemByID(0));
            }
        }
コード例 #8
0
        private string GetShipTypeName(int characterId, string dataSource, string accessToken)
        {
            var location   = _locationApi.GetCharactersCharacterIdShip(characterId, dataSource, accessToken);
            var shipTypeId = location.ShipTypeId.GetValueOrDefault();
            var ship       = StaticItems.GetItemByID(shipTypeId);

            return(ship == null || shipTypeId == 0 ? EveMonConstants.UnknownText : ship.Name);
        }
コード例 #9
0
ファイル: KillReportVictim.cs プロジェクト: henrikja/EVEMon
        /// <summary>
        /// Handles the Click event of the showInShipBrowserMenuItem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void showInShipBrowserMenuItem_Click(object sender, EventArgs e)
        {
            Item item = StaticItems.GetItemByID(m_killLog.Victim.ShipTypeID);

            if (item != null)
            {
                PlanWindow.ShowPlanWindow(m_killLog.Character).ShowShipInBrowser(item);
            }
        }
コード例 #10
0
ファイル: ContractItem.cs プロジェクト: Darkfoe703/evemon
 /// <summary>
 /// Constructor from the API.
 /// </summary>
 /// <param name="src">The source.</param>
 internal ContractItem(EsiContractItemsListItem src)
 {
     RecordID    = src.RecordID;
     Item        = StaticItems.GetItemByID(src.TypeID);
     Quantity    = src.Quantity;
     RawQuantity = src.RawQuantity;
     Singleton   = src.Singleton;
     Included    = src.Included;
 }
コード例 #11
0
        private IEnumerable <SerializableCharacterJumpCloneImplant> GetJumpCloneImplants(List <GetCharactersCharacterIdClonesJumpClone> characterClones)
        {
            var implants = characterClones.SelectMany(x => x.Implants, (jc, imp) => new SerializableCharacterJumpCloneImplant
            {
                JumpCloneID = jc.JumpCloneId.GetValueOrDefault(),
                TypeID      = imp.GetValueOrDefault(),
                TypeName    = StaticItems.GetItemByID(imp.GetValueOrDefault()).Name
            });

            return(implants);
        }
コード例 #12
0
        private IEnumerable <SerializableNewImplant> GetImplants(int characterId, string dataSource, string accessToken)
        {
            var characterImplants = _clonesApi.GetCharactersCharacterIdImplants(characterId, dataSource, accessToken);

            var implants = characterImplants.Select(x => new SerializableNewImplant
            {
                ID   = x.GetValueOrDefault(),
                Name = StaticItems.GetItemByID(x.GetValueOrDefault()).Name
            });

            return(implants);
        }
コード例 #13
0
        /// <summary>
        /// Occurs when we downloaded a loadout from BattleClinic
        /// </summary>
        /// <param name="feed"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        private void OnLoadoutDownloaded(SerializableLoadoutFeed loadoutFeed, string errorMessage)
        {
            if (this.IsDisposed)
            {
                return;
            }

            // Reset the controls
            btnPlan.Enabled = false;
            m_prerequisites.Clear();
            tvLoadout.Nodes.Clear();
            Cursor.Current = Cursors.Default;

            // Was there an error ?
            if (!String.IsNullOrEmpty(errorMessage) || loadoutFeed.Race.Loadouts.Length == 0)
            {
                lblTrainTime.Text    = String.Format(CultureConstants.DefaultCulture, "Couldn't download that loadout.\r\n{0}", errorMessage);
                lblTrainTime.Visible = true;
                return;
            }

            var loadout = loadoutFeed.Race.Loadouts[0];

            // Fill the items tree
            var slotTypes = loadout.Slots.GroupBy(x => x.SlotType);

            foreach (var slotType in slotTypes)
            {
                TreeNode typeNode = new TreeNode(s_typeMap[slotType.Key]);

                foreach (var slot in slotType)
                {
                    Item item = StaticItems.GetItemByID(slot.ItemID);
                    if (item == null)
                    {
                        continue;
                    }

                    TreeNode slotNode = new TreeNode();
                    slotNode.Text = item.Name;
                    slotNode.Tag  = item;
                    typeNode.Nodes.Add(slotNode);

                    m_prerequisites.AddRange(item.Prerequisites);
                }

                tvLoadout.Nodes.Add(typeNode);
            }

            // Compute the training time
            UpdatePlanningControls();
            tvLoadout.ExpandAll();
        }
コード例 #14
0
        /// <summary>
        /// Adds the groups.
        /// </summary>
        /// <returns></returns>
        private IEnumerable <ListViewItem> AddGroups()
        {
            var    items = new List <ListViewItem>();
            double materiaEffModifier = 1d - (double)nudME.Value / 100;

            foreach (var marketGroup in StaticItems.AllGroups)
            {
                // Create the groups
                var  group   = new ListViewGroup(marketGroup.CategoryPath);
                bool hasItem = false;
                foreach (var material in m_blueprint.MaterialRequirements)
                {
                    if (material.Activity == m_activity && marketGroup.Items.Any(y => y.ID == material.ID))
                    {
                        hasItem = true;

                        // Create the item
                        var item = new ListViewItem(group)
                        {
                            Tag  = StaticItems.GetItemByID(material.ID),
                            Text = material.Name
                        };

                        // Add the item to the list
                        items.Add(item);

                        // Calculate the base material quantity
                        long baseMaterialQuantity = material.Quantity;
                        // Calculate the actual material quantity
                        long actualMaterialQuantity = (long)Math.Ceiling(material.Quantity *
                                                                         materiaEffModifier * m_materialFacilityMultiplier);

                        // Add the base quantity for every item
                        var subItemBase = new ListViewItem.ListViewSubItem(item,
                                                                           baseMaterialQuantity.ToString("N0"));
                        item.SubItems.Add(subItemBase);
                        // Add the quantity needed according to the character's skills for every item
                        var subItem = new ListViewItem.ListViewSubItem(item,
                                                                       actualMaterialQuantity.ToString("N0"));
                        item.SubItems.Add(subItem);
                    }
                }

                // Add the group that has an item
                if (hasItem)
                {
                    PropertiesList.Groups.Add(group);
                }
            }

            return(items);
        }
コード例 #15
0
ファイル: IndustryJob.cs プロジェクト: deslona/evemu_personal
        /// <summary>
        /// Gets the output item by its ID (can be a blueprint or an item).
        /// </summary>
        /// <param name="id">The itemID of the blueprint.</param>
        /// <returns>The output item from the bluperint.</returns>
        private static Item GetOutputItem(long id)
        {
            // Is it a blueprint ?
            Item item = StaticBlueprints.GetBlueprintByID(id);

            // Then it's an item
            if (item == null)
            {
                item = StaticItems.GetItemByID(id);
            }

            return(item);
        }
コード例 #16
0
ファイル: MarketOrder.cs プロジェクト: deslona/evemu_personal
        /// <summary>
        /// Gets an item by its ID or its name.
        /// </summary>
        /// <param name="src"></param>
        /// <returns></returns>
        private static Item GetItem(SerializableOrderBase src)
        {
            // Try get item by its ID
            Item item = StaticItems.GetItemByID(src.ItemID);

            // We failed? Try get item by its name
            if (item == null)
            {
                item = StaticItems.GetItemByName(src.Item);
            }

            return(item);
        }
コード例 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KillLogItem"/> class.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <param name="isInContainer">if set to <c>true</c> item is in container.</param>
        internal KillLogItem(SerializableKillLogItemListItem src, bool isInContainer = false)
        {
            m_typeID     = src.TypeID;
            EVEFlag      = src.EVEFlag;
            QtyDestroyed = src.QtyDestroyed;
            QtyDropped   = src.QtyDropped;
            Singleton    = src.Singleton;
            Item         = StaticItems.GetItemByID(src.TypeID);

            FittingContentGroup = GetFittingContentGroup();
            IsInContainer       = isInContainer;

            m_items.AddRange(src.Items.Select(item => new KillLogItem(item, true)));
        }
コード例 #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Asset" /> class.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        internal Asset(SerializableAssetListItem src)
        {
            src.ThrowIfNull(nameof(src));

            LocationID      = src.LocationID;
            Quantity        = src.Quantity;
            Item            = StaticItems.GetItemByID(src.TypeID);
            FlagID          = src.EVEFlag;
            m_flag          = EveFlag.GetFlagText(src.EVEFlag);
            TypeOfBlueprint = GetTypeOfBlueprint(src.RawQuantity);
            Container       = String.Empty;
            Volume          = GetVolume();
            TotalVolume     = Quantity * Volume;
        }
コード例 #19
0
        /// <summary>
        /// Handles the Click event of the showInShipBrowserMenuItem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void showInShipBrowserMenuItem_Click(object sender, EventArgs e)
        {
            if (m_selectedKillLog == null)
            {
                return;
            }

            Ship ship = StaticItems.GetItemByID(m_selectedKillLog.Victim.ShipTypeID) as Ship;

            if (ship == null)
            {
                return;
            }

            PlanWindow.ShowPlanWindow(Character).ShowShipInBrowser(ship);
        }
コード例 #20
0
ファイル: MarketOrder.cs プロジェクト: deslona/evemu_personal
 /// <summary>
 /// Constructor from the API.
 /// </summary>
 /// <param name="src"></param>
 protected MarketOrder(SerializableOrderListItem src)
 {
     m_state           = GetState(src);
     m_orderID         = src.OrderID;
     m_itemID          = src.ItemID;
     m_item            = StaticItems.GetItemByID(src.ItemID);
     m_station         = GetStationByID(src.StationID);
     m_unitaryPrice    = src.UnitaryPrice;
     m_initialVolume   = src.InitialVolume;
     m_remainingVolume = src.RemainingVolume;
     m_lastStateChange = DateTime.UtcNow;
     m_minVolume       = src.MinVolume;
     m_duration        = src.Duration;
     m_issued          = src.Issued;
     m_issuedFor       = src.IssuedFor;
 }
コード例 #21
0
ファイル: Asset.cs プロジェクト: Darkfoe703/evemon
        /// <summary>
        /// Initializes a new instance of the <see cref="Asset" /> class.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <param name="character">The owning character.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        internal Asset(EsiAssetListItem src, CCPCharacter character)
        {
            src.ThrowIfNull(nameof(src));

            int flagID = EveFlag.GetFlagID(src.EVEFlag);

            LocationID      = src.LocationID;
            Quantity        = src.Quantity;
            Item            = StaticItems.GetItemByID(src.TypeID);
            FlagID          = (short)flagID;
            m_character     = character;
            m_flag          = EveFlag.GetFlagText(flagID);
            TypeOfBlueprint = GetTypeOfBlueprint(src.IsBPC);
            Container       = string.Empty;
            Volume          = GetVolume();
            TotalVolume     = Quantity * Volume;
        }
コード例 #22
0
ファイル: PlanetaryPin.cs プロジェクト: Slazanger/evemon
        /// <summary>
        /// Initializes a new instance of the <see cref="PlanetaryPin"/> class.
        /// </summary>
        /// <param name="colony">The colony.</param>
        /// <param name="src">The source.</param>
        internal PlanetaryPin(PlanetaryColony colony, EsiPlanetaryPin src)
        {
            var type      = StaticItems.GetItemByID(src.TypeID);
            var extractor = src.ExtractorDetails;
            var contents  = src.Contents;

            type.ThrowIfNull(nameof(type));

            Colony        = colony;
            ID            = src.PinID;
            TypeID        = src.TypeID;
            TypeName      = type.Name;
            SchematicID   = src.SchematicID;
            InstallTime   = src.InstallTime;
            ExpiryTime    = src.ExpiryTime;
            State         = GetState();
            ContentVolume = GetVolume();

            if (extractor != null)
            {
                CycleTime        = (short)extractor.CycleTime;
                QuantityPerCycle = extractor.QuantityPerCycle;
            }

            // Old EVEMon could only handle one item in contents
            if (contents != null && contents.Count > 0)
            {
                var firstItem = contents[0];
                int typeID    = firstItem.TypeID;
                ContentQuantity = firstItem.Amount;
                ContentTypeID   = typeID;
                ContentTypeName = StaticItems.GetItemName(typeID);
            }
            else
            {
                ContentQuantity = 0;
                ContentTypeID   = 0;
                ContentTypeName = string.Empty;
            }
            LastLaunchTime = src.LastCycleStart;

            GroupName = type.GroupName;
        }
コード例 #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlanetaryPin"/> class.
        /// </summary>
        /// <param name="colony">The colony.</param>
        /// <param name="src">The source.</param>
        internal PlanetaryPin(PlanetaryColony colony, SerializablePlanetaryPin src)
        {
            Colony           = colony;
            ID               = src.PinID;
            TypeID           = src.TypeID;
            TypeName         = GetPinName(src.TypeName);
            SchematicID      = src.SchematicID;
            CycleTime        = src.CycleTime;
            QuantityPerCycle = src.QuantityPerCycle;
            ContentQuantity  = src.ContentQuantity;
            ContentTypeID    = src.ContentTypeID;
            ContentTypeName  = src.ContentTypeName;
            LastLaunchTime   = src.LastLaunchTime;
            InstallTime      = src.InstallTime;
            ExpiryTime       = src.ExpiryTime;
            State            = GetState();
            ContentVolume    = GetVolume();

            GroupName = StaticItems.GetItemByID(src.TypeID).GroupName;
        }
コード例 #24
0
ファイル: MarketOrder.cs プロジェクト: Darkfoe703/evemon
        /// <summary>
        /// Populates the serialization object order with the info from the API.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <param name="ownerID">The owner of this order.</param>
        /// <param name="issuedFor">Whether the order was issued for a corporation or a
        /// character.</param>
        private void PopulateOrderInfo(EsiOrderListItem src, IssuedFor issuedFor)
        {
            OwnerID         = src.IssuedBy;
            ID              = src.OrderID;
            Item            = StaticItems.GetItemByID(src.ItemID);
            UnitaryPrice    = src.UnitaryPrice;
            InitialVolume   = src.InitialVolume;
            RemainingVolume = src.RemainingVolume;
            MinVolume       = src.MinVolume;
            Duration        = src.Duration;
            Issued          = src.Issued;
            IssuedFor       = issuedFor;
            m_stationID     = src.StationID;
            UpdateStation();

            var buyOrder = this as BuyOrder;

            if (src.IsBuyOrder && buyOrder != null)
            {
                buyOrder.Escrow = src.Escrow;
                buyOrder.Range  = src.Range;
            }
        }
コード例 #25
0
ファイル: LoadoutHelper.cs プロジェクト: wbSD/evemon
        /// <summary>
        /// Deserializes a DNA loadout text.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <returns></returns>
        public static ILoadoutInfo DeserializeDnaFormat(string text)
        {
            string[] lines = text.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            ILoadoutInfo loadoutInfo = new LoadoutInfo();

            // Nothing to evaluate
            if (lines.Length == 0)
            {
                return(loadoutInfo);
            }

            var     listOfItems = new List <Item>();
            Loadout loadout     = null;

            foreach (string line in lines.Where(line => !String.IsNullOrEmpty(line)))
            {
                // Retrieve the ship
                if (line == lines.First())
                {
                    int shipID;
                    if (line.TryParseInv(out shipID))
                    {
                        loadoutInfo.Ship = StaticItems.GetItemByID(shipID);
                        if (loadoutInfo.Ship == null)
                        {
                            return(loadoutInfo);
                        }
                        loadout = new Loadout(loadoutInfo.Ship.Name, String.Empty);
                        continue;
                    }
                }

                // Retrieve the item
                int  itemID;
                Item item = line.Substring(0, line.LastIndexOf(';')).TryParseInv(out itemID) ?
                            (StaticItems.GetItemByID(itemID) ?? Item.UnknownItem) : Item.UnknownItem;

                // Retrieve the quantity
                int quantity;
                line.Substring(line.LastIndexOf(';') + 1).TryParseInv(out quantity);

                // Trim excess ammo & charges, no need to display more than the max number of modules
                if (item.MarketGroup.BelongsIn(DBConstants.AmmosAndChargesMarketGroupID) && quantity > 8)
                {
                    quantity = 1;
                }

                for (int i = 0; i < quantity; i++)
                {
                    listOfItems.Add(item);
                }
            }

            if (loadout == null)
            {
                return(loadoutInfo);
            }

            loadout.Items = listOfItems;
            loadoutInfo.Loadouts.Add(loadout);

            return(loadoutInfo);
        }
コード例 #26
0
        /// <summary>
        /// Update the required materials list.
        /// </summary>
        private void UpdateRequiredMaterialsList()
        {
            int productionEfficiencyLevel = (m_character.Skills.FirstOrDefault(x => x.ID == DBConstants.ProductionEfficiencySkillID)).LastConfirmedLvl;

            m_propertiesList.BeginUpdate();
            try
            {
                // Clear everything
                m_propertiesList.Items.Clear();
                m_propertiesList.Groups.Clear();
                m_propertiesList.Columns.Clear();

                // Create the columns
                m_propertiesList.Columns.Add("Item");
                m_propertiesList.Columns.Add("Quantity (You)");
                m_propertiesList.Columns.Add("Quantity (Perfect)");
                m_propertiesList.Columns.Add("Damage Per Run");

                int  perfectME       = 0;
                int  perfectMELevel  = 0;
                bool hasPerfect      = false;
                bool hasDamagePerRun = false;
                var  items           = new List <ListViewItem>();
                foreach (var marketGroup in StaticItems.AllGroups)
                {
                    // Create the groups
                    var  group   = new ListViewGroup(marketGroup.FullCategoryName);
                    bool hasItem = false;
                    foreach (var material in m_blueprint.MaterialRequirements.Where(x => x.Activity == Activity && marketGroup.Items.Any(y => y.ID == x.ID)))
                    {
                        hasItem = true;

                        // Create the item
                        ListViewItem item = new ListViewItem(group);
                        item.Tag  = StaticItems.GetItemByID(material.ID);
                        item.Text = material.Name;

                        // Add the item to the list
                        items.Add(item);

                        // Set if the item is a raw material and therefore waste affected
                        bool isRawMaterial = material.WasteAffected;

                        // Calculate the base material quantity
                        int baseMaterialQuantity = (int)Math.Round(material.Quantity * m_materialMultiplier * GetImplantMultiplier("G"), 0, MidpointRounding.AwayFromZero);

                        // Calculate the perfect material efficiency level if it's a raw material
                        if (isRawMaterial)
                        {
                            perfectMELevel = (int)Math.Round((0.02 * m_blueprint.WasteFactor * baseMaterialQuantity), 0, MidpointRounding.AwayFromZero);
                        }

                        // Store the highest perfect material efficiency level
                        if (perfectMELevel > perfectME)
                        {
                            perfectME = perfectMELevel;
                        }

                        // Calculate the needed quantity by the character skills
                        int youQuantity = (Activity == BlueprintActivity.Manufacturing && isRawMaterial ?
                                           (int)Math.Round(baseMaterialQuantity * (1.25 - (0.05 * productionEfficiencyLevel)) + (baseMaterialQuantity * m_waste), 0, MidpointRounding.AwayFromZero) :
                                           baseMaterialQuantity);

                        // Calculate the perfect quantity
                        int perfectQuantity = (Activity == BlueprintActivity.Manufacturing && isRawMaterial ?
                                               (int)Math.Round(baseMaterialQuantity * (1 + m_waste), 0, MidpointRounding.AwayFromZero) : baseMaterialQuantity);

                        // Add the quantity for every item
                        var subItemYou = new ListViewItem.ListViewSubItem(item, youQuantity.ToString());
                        item.SubItems.Add(subItemYou);

                        // Has perfect values ?
                        hasPerfect |= (youQuantity != perfectQuantity);

                        // Add the perfect quantity for every item
                        var subItemPerfect = new ListViewItem.ListViewSubItem(item, perfectQuantity.ToString());
                        item.SubItems.Add(subItemPerfect);

                        // Has damage per run ?
                        hasDamagePerRun |= (material.DamagePerJob > 0 && material.DamagePerJob < 1);

                        // Add the damage per run for every item (empty string if it's 1)
                        string damagePerRun = (material.DamagePerJob > 0 && material.DamagePerJob < 1 ?
                                               String.Format("{0:P1}", material.DamagePerJob) : String.Empty);
                        var subItemDamagePerRun = new ListViewItem.ListViewSubItem(item, damagePerRun);
                        item.SubItems.Add(subItemDamagePerRun);
                    }

                    // Add the group that has an item
                    if (hasItem)
                    {
                        m_propertiesList.Groups.Add(group);
                    }
                }

                // Remove the "Perfect" column if all values are empty
                if (!hasPerfect)
                {
                    RemoveColumn(items, 2);
                }

                // Remove the "Damage Per Run" column if all values are empty
                if (!hasDamagePerRun)
                {
                    RemoveColumn(items, m_propertiesList.Columns.Count - 1);
                }

                // Add the items
                m_propertiesList.Items.AddRange(items.OrderBy(x => x.Text).ToArray());

                // Display the Perfect ME
                if (tabControl.SelectedTab == tpManufacturing)
                {
                    lblPerfectMEValue.Text = perfectME.ToString("#,##0");
                }

                // Show/Hide the "no item required" label and autoresize the columns
                m_propertiesList.Visible = m_propertiesList.Items.Count > 0;
                if (m_propertiesList.Visible)
                {
                    m_propertiesList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                }
            }
            finally
            {
                m_propertiesList.EndUpdate();
            }
        }
コード例 #27
0
        public override void Parse(EveNotification notification, KeyValuePair <YamlNode, YamlNode> pair,
                                   IDictionary <string, string> parsedDict)
        {
            switch (pair.Key.ToString().ToUpperInvariant())
            {
            case "CHARID":
            case "SENDERCHARID":
            case "RECEIVERCHARID":
            case "OWNERID":
            case "LOCATIONOWNERID":
            case "DESTROYERID":
            case "INVOKINGCHARID":
            case "CORPID":
            case "PODKILLERID":
            case "NEWCEOID":
            case "OLDCEOID":
            {
                parsedDict[pair.Key.ToString()] = EveIDToName.GetIDToName(pair.Value.ToString());
                break;
            }

            case "CLONESTATIONID":
            case "CORPSTATIONID":
            case "LOCATIONID":
            {
                parsedDict[pair.Key.ToString()] = Station.GetByID(int.Parse(pair.Value.ToString())).Name;
                break;
            }

            case "SHIPTYPEID":
            case "TYPEID":
            {
                parsedDict[pair.Key.ToString()] = StaticItems.GetItemByID(int.Parse(pair.Value.ToString())).Name;
                break;
            }

            case "MEDALID":
            {
                var medal = notification.CCPCharacter.CharacterMedals
                            .FirstOrDefault(x => x.ID.ToString() == pair.Value.ToString());

                parsedDict[pair.Key.ToString()] = medal == null
                        ? EveMonConstants.UnknownText
                        : medal.Title ?? EveMonConstants.UnknownText;

                parsedDict.Add("medalDescription", medal == null
                        ? EveMonConstants.UnknownText
                        : medal.Description ?? EveMonConstants.UnknownText);
                break;
            }

            case "ENDDATE":
            case "STARTDATE":
            {
                parsedDict[pair.Key.ToString()] = string.Format(CultureConstants.InvariantCulture,
                                                                "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", long.Parse(pair.Value.ToString())
                                                                .WinTimeStampToDateTime());
                break;
            }

            case "NOTIFICATION_CREATED":
            {
                parsedDict[pair.Key.ToString()] = string.Format(CultureConstants.InvariantCulture,
                                                                "{0:dddd, MMMM d, yyyy} (EVE Time)", long.Parse(pair.Value.ToString())
                                                                .WinTimeStampToDateTime());
                break;
            }

            case "TYPEIDS":
            {
                YamlSequenceNode typeIDs = pair.Value as YamlSequenceNode;

                if (typeIDs == null)
                {
                    break;
                }

                switch (notification.TypeID)
                {
                case 56:
                case 57:
                {
                    if (!typeIDs.Any())
                    {
                        parsedDict[pair.Key.ToString()] = "None were in the clone";
                    }
                    else
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (var typeID in typeIDs)
                        {
                            sb
                            .AppendLine()
                            .AppendLine($"Type: {StaticItems.GetItemByID(int.Parse(typeID.ToString())).Name}");
                        }
                        parsedDict[pair.Key.ToString()] = sb.ToString();
                    }
                }
                break;
                }
                break;
            }

            case "ISHOUSEWARMINGGIFT":
            {
                if (!Convert.ToBoolean(pair.Value))
                {
                    break;
                }

                switch (notification.TypeID)
                {
                case 34:
                    // Tritanium
                    parsedDict[pair.Key.ToString()] = StaticItems.GetItemByID(34).Name;
                    break;
                }
                break;
            }

            case "LEVEL":
            {
                parsedDict[pair.Key.ToString()] = $"{Standing.Status(double.Parse(pair.Value.ToString()))} Standing";
                break;
            }
            }
        }