示例#1
0
        private void PrepareItemDetailSection(CreateItemDiv item)
        {
            string file = string.Format(@"{0}\Data\Items\Images\{1}", PublicStaticVariables.thisAppDataDir, item.thisVersion);
            string dir  = string.Format(@"{0}\Data\Items\Images\{1}", PublicStaticVariables.thisAppDataDir, item.thisVersion);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            Image tempImageSprite = Image.FromFile(file + @"\" + item.aItem.Image.Sprite);

            Image image = CommonMethods.cropImage(tempImageSprite, new Rectangle(item.aItem.Image.X, item.aItem.Image.Y, item.aItem.Image.Width, item.aItem.Image.Height));

            //Update the Item image
            picBoxItemDetail.Image = image;

            //Update the Title and price
            lblDetailName.Text  = item.thisItemDisplayName;
            lblDetailPrice.Text = "Cost: " + item.aItem.Gold.TotalPrice;

            using (Stream s = GenerateStreamFromString(item.htmlToolTipOfItem))
            {
                richEditCtrDetails.LoadDocument(s, DocumentFormat.Html);
            }

            ParagraphProperties parProperties = richEditCtrDetails.Document.BeginUpdateParagraphs(richEditCtrDetails.Document.Selection);

            parProperties.LineSpacingType       = ParagraphLineSpacing.Multiple;
            parProperties.LineSpacingMultiplier = 0.7f;
            richEditCtrDetails.Document.EndUpdateParagraphs(parProperties);
        }
示例#2
0
        private void CreateRowOfItemDetailsInto(List <int> itemRowList, int row)
        {
            try
            {
                int center = (pnlItemDetailInto.Width / 2);
                int yPos   = (row - 1) * 70;
                int xPos   = center - (itemRowList.Count() * (50 / 2));
                for (int i = 0; i < itemRowList.Count(); i++)
                {
                    CreateItemDiv item = new CreateItemDiv();

                    item = getItemsFromServer.itemsPrepared.FirstOrDefault(o => o.thisID == itemRowList[i]);

                    if (item.thisID != 0)
                    {
                        ItemControl itemControl = new ItemControl(form1, this);
                        itemControl.ItemCostLabel = item.aItem.Gold.TotalPrice.ToString();
                        string file = string.Format(@"{0}\Data\Items\Images\{1}", PublicStaticVariables.thisAppDataDir, item.thisVersion);
                        string dir  = string.Format(@"{0}\Data\Items\Images\{1}", PublicStaticVariables.thisAppDataDir, item.thisVersion);

                        if (!Directory.Exists(dir))
                        {
                            Directory.CreateDirectory(dir);
                        }

                        Image temp = Image.FromFile(string.Format(@"{0}\{1}", file, item.aItem.Image.Sprite));
                        itemControl.ItemImage = CommonMethods.cropImage(temp, new Rectangle(item.aItem.Image.X, item.aItem.Image.Y, item.aItem.Image.Width, item.aItem.Image.Height));

                        itemControl.Name = "ItemControlInto " + item.aItem.Name;

                        itemControl.item = item;

                        itemControl.Location = new Point(xPos, yPos);
                        itemControl.Click   += itemControl_Click;

                        pnlItemDetailInto.Controls.Add(itemControl);
                        xPos += 50;
                    }
                    else
                    {
                        XtraMessageBox.Show(string.Format(@"This is awkward.. So, there was a reference to an item ID that does NOT exist.
Either Rito forgot to remove this reference when they deleted an item 
or Rito for some reason has an incorrect item ID listed
or Rito is planning to add a new item but didnt finish the job (Im hoping for this one)
or something went horribly wrong.
Please continue : )"), "League Build Stats - Notice");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#3
0
        public string CreateItemPicBoxTooltip(CreateItemDiv itemPreped)
        {
            //Generate tooltip for item on maintopbar
            string sTooltip = string.Format(@"
						<div style='max-width:300px;'>
						<p style='color:White; font-family:Tahoma; font-size:10pt; text-smoothing-mode:AntiAlias; max-width:300px;'> 
							<span style='font-size:12pt;'>{0} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <br/>
							<span style='color:Yellow;'>Cost: {1}</span> <br/><br/>
							{2}<br/>
						"                        ,//</p></div>"
                                            itemPreped.thisItemDisplayName, itemPreped.aItem.Gold.TotalPrice, itemPreped.DivText);

            //todo: this is a test to show the stats of the items
            if (((ToolStripMenuItem)contextMenuStrip1.Items[0]).Checked)
            {
                try
                {
                    Type myType = typeof(StatsStatic);
                    System.Reflection.PropertyInfo[] properties = myType.GetProperties();

                    foreach (System.Reflection.PropertyInfo property in properties)
                    {
                        Double statValue   = (Double)itemPreped.aItem.Stats.GetType().GetProperty(property.Name).GetValue(itemPreped.aItem.Stats);
                        Double uniqueValue = 0.0;
                        foreach (KeyValuePair <string, StatsStatic> uniqueStats in itemPreped.aItem.UniqueStats)
                        {
                            uniqueValue += (Double)uniqueStats.Value.GetType().GetProperty(property.Name).GetValue(uniqueStats.Value);
                        }

                        Double newValue = statValue + uniqueValue;
                        if (newValue != 0.0)
                        {
                            sTooltip += "<br/>" + property.Name.Replace("Mod", "") + ": " + newValue;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }

            sTooltip += "</p></div>";

            return(sTooltip);
        }
示例#4
0
        private void SortRiotItemData(ItemListStatic items)
        {
            itemGold_Names.Clear();
            //Sort items by price
            foreach (System.Collections.Generic.KeyValuePair <int, RiotSharp.StaticDataEndpoint.ItemStatic> i in items.Items)
            {
                //Removes rengar upgraded trinket from cluttering the Item list, the base rengar tricket desciption has all information needed
                if (!(i.Value.Gold.Purchasable == false && i.Value.RequiredChampion == "Rengar"))
                {
                    //Removes the explorer ward from the item list, it might have been available in the past but it doesn't matter much. Same with golden transcendence
                    if (i.Value.Name != "Explorer's Ward" && i.Value.Name != "Golden Transcendence")
                    {
                        //Remove the duplicate free Buiscuit that used to be obtained from mastery, either way this item doesn't matter much
                        if (!(i.Value.Name == "Total Biscuit of Rejuvenation" && i.Value.Gold.TotalPrice == 0))
                        {
                            //Add Stealth Detection tag where i think it is missing
                            if (i.Value.Description.Contains("Vision Ward"))
                            {
                                if (i.Value.Tags == null)
                                {
                                    i.Value.Tags.Add("Stealth");
                                }
                                else if (!i.Value.Tags.Contains("Stealth"))
                                {
                                    i.Value.Tags.Add("Stealth");
                                }
                            }
                            itemGold_Names.Add(new KeyValuePair <int, int>(i.Value.Id, i.Value.Gold.TotalPrice));
                        }
                    }
                }
            }



            itemGold_Names.Sort(Compare2);

            itemsPrepared.Clear();
            //Loop through all sorted item names and store item data
            foreach (var item in itemGold_Names)
            {
                ItemStatic i = items.Items[item.Key];

                int           enchantBaseId = 0;
                ItemStatic    enchantBaseItem;
                CreateItemDiv newItem = new CreateItemDiv();
                if (i.Name.Contains("Enchantment:") && i.From != null)                 //todo: added && i.From != null
                {
                    enchantBaseId = Convert.ToInt16(i.From[0]);
                    items.Items.TryGetValue(enchantBaseId, out enchantBaseItem);
                    newItem.SetupItemInformation(i, items.Version, enchantBaseItem);
                }
                else
                {
                    newItem.SetupItemInformation(i, items.Version);
                }
                itemsPrepared.Add(newItem);
            }

            ItemDataCorrections.RunCorrections(items);


            version = items.Version;
        }
示例#5
0
        private void pnlItem_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                string dataString = e.Data.GetData(DataFormats.Text) as string;
                if ((dataString.Contains("ITEM") || dataString.Contains("ELIXIR")) && form1.itemsTab.getItemsFromServer.itemsPrepared != null)
                {
                    string itemID = dataString.Replace("ITEM", "");
                    itemID = itemID.Replace("ELIXIR", "");
                    if (form1.itemsTab.getItemsFromServer.itemsPrepared.Count > 0)
                    {
                        //Generate PicBox
                        CreateItemDiv itemPreped = form1.itemsTab.getItemsFromServer.itemsPrepared.Find(o => o.thisID.ToString() == itemID);


                        PictureBox itemPicBox = new PictureBox();
                        itemPicBox.Size     = new Size(48, 48);
                        itemPicBox.Location = new Point(0, 0);
                        string file      = string.Format(@"{0}\Data\Items\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, itemPreped.thisVersion, itemPreped.aItem.Image.Sprite);
                        Image  imageItem = Image.FromFile(file);
                        Image  image     = CommonMethods.cropImage(imageItem, new Rectangle(itemPreped.aItem.Image.X, itemPreped.aItem.Image.Y, itemPreped.aItem.Image.Width, itemPreped.aItem.Image.Height));
                        itemPicBox.Image       = image;
                        itemPicBox.MouseClick += itemPicBox_MouseClick;
                        itemPicBox.Cursor      = Cursors.Hand;
                        itemPicBox.Tag         = itemPreped;

                        Panel thisPnl = sender as Panel;
                        thisPnl.Tag = itemPreped;
                        if (thisPnl.Controls.Count > 0)
                        {
                            List <Control> ctrls = thisPnl.Controls.Cast <Control>().ToList();
                            thisPnl.Controls.Clear();
                            foreach (Control c in ctrls)
                            {
                                c.Dispose();
                            }
                        }
                        thisPnl.Controls.Add(itemPicBox);

                        string sTooltip = CreateItemPicBoxTooltip(itemPreped);



                        //tooltip
                        UltraToolTipInfo temp = new UltraToolTipInfo();
                        switch (thisPnl.Name)
                        {
                        case "pnlItem1":
                        {
                            temp = tipInfoItem1;
                            break;
                        }

                        case "pnlItem2":
                        {
                            temp = tipInfoItem2;
                            break;
                        }

                        case "pnlItem3":
                        {
                            temp = tipInfoItem3;
                            break;
                        }

                        case "pnlItem4":
                        {
                            temp = tipInfoItem4;
                            break;
                        }

                        case "pnlItem5":
                        {
                            temp = tipInfoItem5;
                            break;
                        }

                        case "pnlItem6":
                        {
                            temp = tipInfoItem6;
                            break;
                        }

                        case "pnlElixir":
                        {
                            temp = tipInfoItemElixir;
                            break;
                        }
                        }
                        ultraToolTipManagerGearIcon.SetUltraToolTip(itemPicBox, temp);
                        temp.ToolTipTextFormatted = sTooltip;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            UpdateTotalGoldCost();
        }
示例#6
0
        private StatsStatic GetItemsStats(StatsStatic statsStatic)
        {
            List <string> uniqueStatsList = new List <string>();

            foreach (Panel p in form1.mainTopBar.itemPanels)
            {
                if (p.Tag != null)
                {
                    try
                    {
                        CreateItemDiv itemPreped = (CreateItemDiv)p.Tag;

                        Type myType = typeof(StatsStatic);
                        System.Reflection.PropertyInfo[] properties = myType.GetProperties();

                        List <string> tempUniqueStatsList = new List <string>();

                        foreach (System.Reflection.PropertyInfo property in properties)
                        {
                            Double statValue   = (Double)itemPreped.aItem.Stats.GetType().GetProperty(property.Name).GetValue(itemPreped.aItem.Stats);
                            Double uniqueValue = 0.0;
                            foreach (KeyValuePair <string, StatsStatic> uniqueStats in itemPreped.aItem.UniqueStats)
                            {
                                if (!uniqueStatsList.Contains(uniqueStats.Key))
                                {
                                    uniqueValue += (Double)uniqueStats.Value.GetType().GetProperty(property.Name).GetValue(uniqueStats.Value);
                                    if (uniqueValue != 0.0)
                                    {
                                        tempUniqueStatsList.Add(uniqueStats.Key);
                                    }
                                }
                            }


                            if (statValue != 0.0 || uniqueValue != 0.0)
                            {
                                Double newValue = (Double)statsStatic.GetType().GetProperty(property.Name).GetValue(statsStatic);
                                if (property.Name == "PercentSlowReistance" ||
                                    property.Name == "PercentTenacityMod" ||
                                    property.Name == "RPercentArmorPenetrationMod" ||
                                    property.Name == "RFlatMagicPenetrationMod")
                                {
                                    newValue = (1 - (1 - statValue) * (1 - newValue));
                                    newValue = (1 - (1 - uniqueValue) * (1 - newValue));
                                }
                                else
                                {
                                    newValue += statValue + uniqueValue;
                                }

                                statsStatic.GetType().GetProperty(property.Name).SetValue(statsStatic, newValue);
                            }
                        }
                        foreach (string s in tempUniqueStatsList)
                        {
                            uniqueStatsList.Add(s);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
            return(statsStatic);
        }
示例#7
0
        private void RecursiveItemChildren(CreateItemDiv item, Panel pnl, int LayerCount, int LayerPosition, bool start)
        {
            Panel pnlNew = new Panel();

            pnlNew.Width       = pnl.Width / LayerCount;
            pnlNew.Height      = 20;
            pnlNew.AutoSize    = true;
            pnlNew.BorderStyle = System.Windows.Forms.BorderStyle.None;
            pnlNew.Name        = "TreeItem" + item.aItem.Name;
            if (LayerPosition > 1)
            {
                pnlNew.Location = new Point((pnl.Width / LayerCount) * (LayerPosition - 1), 74);
            }
            else if (start)
            {
                pnlNew.Location = new Point(0, 0);
            }
            else
            {
                pnlNew.Location = new Point(0, 74);
            }

            int centerPos = ((pnlNew.Width - 50) / (2));
            int yPosition = 0;

            ItemControl itemControl = new ItemControl(form1, this);

            itemControl.ItemCostLabel = item.aItem.Gold.TotalPrice.ToString();
            itemControl.Margin        = new System.Windows.Forms.Padding(0);

            string file = string.Format(@"{0}\Data\Items\Images\{1}", PublicStaticVariables.thisAppDataDir, item.thisVersion);
            string dir  = string.Format(@"{0}\Data\Items\Images\{1}", PublicStaticVariables.thisAppDataDir, item.thisVersion);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            Image temp = Image.FromFile(string.Format(@"{0}\{1}", file, item.aItem.Image.Sprite));

            itemControl.ItemImage = CommonMethods.cropImage(temp, new Rectangle(item.aItem.Image.X, item.aItem.Image.Y, item.aItem.Image.Width, item.aItem.Image.Height));

            itemControl.Name = "ItemControlTree " + item.aItem.Name;

            itemControl.item = item;

            itemControl.Location = new Point(centerPos, yPosition);
            itemControl.Click   += itemControl_Click;

            pnlNew.Controls.Add(itemControl);
            pnl.Controls.Add(pnlNew);


            int position = 0;

            if (item.aItem.From != null)
            {
                //Create Connecting Lines to children
                Color color = Color.DimGray;

                Panel pnlLine1 = new Panel();
                pnlLine1.BackColor = color;
                pnlLine1.Margin    = new Padding(0, 0, 0, 0);
                int line1x1 = itemControl.Location.X + 50 / 2;
                int line1y1 = itemControl.Location.Y + 63;
                pnlLine1.Location = new Point(line1x1, line1y1);
                int line1x2 = 1;
                int line1y2 = 5;
                pnlLine1.Size = new Size(line1x2, line1y2);
                pnlNew.Controls.Add(pnlLine1);

                Panel pnlLine2 = new Panel();
                pnlLine2.BackColor = color;
                pnlLine2.Margin    = new Padding(0, 0, 0, 0);
                int icount  = item.aItem.From.Count();
                int line2x1 = pnlNew.Width / (icount * 2);
                int line2y1 = line1y1 + line1y2;
                pnlLine2.Location = new Point(line2x1, line2y1);
                int line2x2 = (pnlNew.Width / (icount * 2)) * (icount * 2 - 2);
                int line2y2 = 1;
                pnlLine2.Size = new Size(line2x2, line2y2);
                if (icount > 1)
                {
                    pnlNew.Controls.Add(pnlLine2);
                }

                for (int i = 0; i < icount; i++)
                {
                    Panel pnlLine3 = new Panel();
                    pnlLine3.BackColor = color;
                    pnlLine3.Margin    = new Padding(0, 0, 0, 0);
                    int line3x1 = pnlNew.Width / (icount * 2) * (i * 2 + 1);
                    int line3y1 = line1y1 + line1y2;
                    pnlLine3.Location = new Point(line3x1, line3y1);
                    int line3x2 = 1;
                    int line3y2 = 6;
                    pnlLine3.Size = new Size(line3x2, line3y2);

                    pnlNew.Controls.Add(pnlLine3);
                }



                //Create children tree
                foreach (string sItem in item.aItem.From)
                {
                    position += 1;

                    CreateItemDiv cItem = getItemsFromServer.itemsPrepared.FirstOrDefault(o => o.thisID.ToString() == sItem);
                    RecursiveItemChildren(cItem, pnlNew, item.aItem.From.Count, position, false);
                    pnl.AutoSize    = true;
                    pnlNew.AutoSize = true;
                }
            }
            pnl.AutoSize    = true;
            pnlNew.AutoSize = true;
        }
示例#8
0
        internal void GenerateItemDetails(CreateItemDiv item)
        {
            try
            {
                //Go to Items Tab
                //XtraTabControl xtraTabControl = form1.Controls.Find("xtraTabControl", true)[0] as XtraTabControl;
                //xtraTabControl.SelectedTabPageIndex = 0;


                //clear all detail sections
                pnlItemDetailsTree.SuspendLayout();
                pnlItemDetailInto.SuspendLayout();

                if (pnlItemDetailsTree.Controls.Count > 0)
                {
                    List <Control> ctrls = pnlItemDetailsTree.Controls.Cast <Control>().ToList();
                    pnlItemDetailsTree.Controls.Clear();
                    foreach (Control c in ctrls)
                    {
                        c.Dispose();
                    }
                }

                if (pnlItemDetailInto.Controls.Count > 0)
                {
                    List <Control> ctrls = pnlItemDetailInto.Controls.Cast <Control>().ToList();
                    pnlItemDetailInto.Controls.Clear();
                    foreach (Control c in ctrls)
                    {
                        c.Dispose();
                    }
                }
                picBoxItemDetail.Image = null;
                lblDetailName.Text     = "";
                lblDetailPrice.Text    = "";
                using (Stream s = GenerateStreamFromString(""))
                {
                    richEditCtrDetails.LoadDocument(s, DocumentFormat.Html);
                }

                //Prepare Item "Into" details
                if (item.aItem.Into != null)
                {
                    List <int> itemsInto = item.aItem.Into;
                    int        total     = itemsInto.Count();
                    decimal    rows      = Math.Floor(((decimal)total / 8)) + 1;
                    int        ind       = 0;
                    int        indStart  = 0;
                    for (int i = 0; i < rows; i++)
                    {
                        List <int> itemRowList = new List <int>();
                        int        indEnd;
                        if (total - ind > 8)
                        {
                            indEnd = ind + 8;
                        }
                        else
                        {
                            indEnd = total;
                        }
                        for (ind = indStart; ind < indEnd; ind++)
                        {
                            itemRowList.Add(item.aItem.Into[ind]);
                        }
                        CreateRowOfItemDetailsInto(itemRowList, i + 1);
                        indStart = ind;
                    }
                }

                //Prepare Item tree details
                RecursiveItemChildren(item, pnlItemDetailsTree, 1, 1, true);

                pnlItemDetailsTree.ResumeLayout();
                pnlItemDetailInto.ResumeLayout();


                //Prepare Item Details section
                PrepareItemDetailSection(item);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }