Ejemplo n.º 1
0
        private static Image GetStashBitmap(int x, int y, int selectedPanel, PictureBox pb, InventoryGrid iGrid)
        {
            string itemName     = "";
            string itemLocation = null;
            string stackSize    = null;
            int    itemRarity   = 0;

            pb.Size        = new Size(50, 50);
            pb.MaximumSize = new Size(50, 50);
            if (iGrid == null)
            {
                return(null);
            }
            if (iGrid.Armor != null)
            {
                itemName   = iGrid.Armor.Name;
                itemRarity = iGrid.Rarity;
                if (ItemDataDisplay.ParseItemNameForType(itemName) == "Amulet" || ItemDataDisplay.ParseItemNameForType(itemName) == "Ring")
                {
                    pb.Size        = new Size(50, 50);
                    pb.MaximumSize = new Size(50, 50);
                }
                else
                {
                    if (iGrid.ItemType != "Belt")
                    {
                        pb.MaximumSize = new Size(50, 100);
                        pb.Size        = new Size(50, 100);
                    }
                }
            }
            if (iGrid.Weapon != null)
            {
                itemName       = iGrid.Weapon.Name;
                itemRarity     = iGrid.Rarity;
                pb.MaximumSize = new Size(50, 100);
                pb.Size        = new Size(50, 100);
            }
            if (iGrid.Potion != null)
            {
                itemName   = iGrid.Potion.Name;
                itemRarity = iGrid.Rarity;
            }
            if (iGrid.Gem != null)
            {
                itemName   = iGrid.Gem.Name;
                itemRarity = iGrid.Rarity;
                if (iGrid.Gem.StackSize > 0)
                {
                    stackSize = iGrid.Gem.StackSize.ToString();
                }
            }
            if (iGrid.Reagent != null)
            {
                itemName       = iGrid.Reagent.Name;
                itemRarity     = iGrid.Rarity;
                pb.MaximumSize = new Size(50, 50);
                pb.Size        = new Size(50, 50);
                if (iGrid.Reagent.StackSize > 0)
                {
                    stackSize = iGrid.Reagent.StackSize.ToString();
                }
            }

            if (iGrid.NPC2Consumable != null)
            {
                itemName       = iGrid.NPC2Consumable.Name;
                itemRarity     = iGrid.Rarity;
                pb.MaximumSize = new Size(50, 50);
                pb.Size        = new Size(50, 50);
            }

            if (iGrid.Enneract != null)
            {
                itemName   = iGrid.Enneract.Name;
                itemRarity = iGrid.Rarity;
                string[] enneractData;
                WolcenStaticData.ItemEnneract.TryGetValue(itemName, out enneractData);
                itemLocation   = enneractData[1];
                pb.MaximumSize = new Size(50, 50);
                pb.Size        = new Size(50, 50);
            }

            if (itemLocation == null)
            {
                WolcenStaticData.ItemLocations.TryGetValue(itemName, out itemLocation);
            }

            if (iGrid.MagicEffects != null)
            {
                if (iGrid.MagicEffects.RolledAffixes != null)
                {
                    foreach (var effect in iGrid.MagicEffects.RolledAffixes)
                    {
                        string effectId = effect.EffectId;
                        if (effect.Parameters != null)
                        {
                            int           effectParamCount = effect.Parameters.Count();
                            List <string> aSem             = new List <string>();
                            for (int z = 0; z < effect.Parameters.Count(); z++)
                            {
                                aSem.Add(effect.Parameters[z].semantic);
                            }
                            string[] actualSemantics = aSem.ToArray();
                            if (actualSemantics != null)
                            {
                                string[] semantics = null;
                                WolcenStaticData.Semantics.TryGetValue(effectId, out semantics);
                                if (semantics != null)
                                {
                                    if (semantics.Count() != actualSemantics.Count())
                                    {
                                        LogMe.WriteLog("Error: Wrong Semantic count (" + semantics.Count() + ")->(" + actualSemantics.Count() + ")");
                                        for (int z = 0; z < actualSemantics.Count(); z++)
                                        {
                                            LogMe.WriteLog("Error-Cont: Actual Parameters for EffectId: " + effectId + "(" + actualSemantics[z] + ")");
                                        }
                                    }
                                    else if (semantics.Count() == actualSemantics.Count())
                                    {
                                        for (int z = 0; z < actualSemantics.Count(); z++)
                                        {
                                            if (semantics[z] != actualSemantics[z])
                                            {
                                                LogMe.WriteLog("Error: semantic miss-match " + effectId + "(" + semantics[z] + ")->(" + actualSemantics[z] + ")");
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    for (int z = 0; z < actualSemantics.Count(); z++)
                                    {
                                        LogMe.WriteLog("Error: Semantic doesn't exist for EffectID: " + effectId + "(" + actualSemantics[z] + ")");
                                    }
                                }
                            }
                        }
                    }
                }

                if (iGrid.MagicEffects.Default != null)
                {
                    foreach (var effect in iGrid.MagicEffects.Default)
                    {
                        string effectId = effect.EffectId;
                        if (effect.Parameters != null)
                        {
                            int           effectParamCount = effect.Parameters.Count();
                            List <string> aSem             = new List <string>();
                            for (int z = 0; z < effect.Parameters.Count(); z++)
                            {
                                aSem.Add(effect.Parameters[z].semantic);
                            }
                            string[] actualSemantics = aSem.ToArray();
                            if (actualSemantics != null)
                            {
                                string[] semantics = null;
                                WolcenStaticData.Semantics.TryGetValue(effectId, out semantics);
                                if (semantics != null)
                                {
                                    if (semantics.Count() != actualSemantics.Count())
                                    {
                                        LogMe.WriteLog("Error: Wrong Semantic count (" + semantics.Count() + ")->(" + actualSemantics.Count() + ")");
                                        for (int z = 0; z < actualSemantics.Count(); z++)
                                        {
                                            LogMe.WriteLog("Error-Cont: Actual Parameters for EffectId: " + effectId + "(" + actualSemantics[z] + ")");
                                        }
                                    }
                                    else if (semantics.Count() == actualSemantics.Count())
                                    {
                                        for (int z = 0; z < actualSemantics.Count(); z++)
                                        {
                                            if (semantics[z] != actualSemantics[z])
                                            {
                                                LogMe.WriteLog("Error: semantic miss-match " + effectId + "(" + semantics[z] + ")->(" + actualSemantics[z] + ")");
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    for (int z = 0; z < actualSemantics.Count(); z++)
                                    {
                                        LogMe.WriteLog("Error: Semantic doesn't exist for EffectID: " + effectId + "(" + actualSemantics[z] + ")");
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (File.Exists(Directory.GetCurrentDirectory() + itemLocation))
            {
                return(InventoryManager.CombineGridBitmaps(Directory.GetCurrentDirectory() + itemLocation, itemRarity, iGrid.ItemType, pb, stackSize));
            }
            else
            {
                if (iGrid.Armor != null)
                {
                    return(new Bitmap(Image.FromFile(Directory.GetCurrentDirectory() + "\\UIResources\\Items\\unknown_armor.png")));
                }
                if (iGrid.Weapon != null)
                {
                    return(new Bitmap(Image.FromFile(Directory.GetCurrentDirectory() + "\\UIResources\\Items\\unknown_weapon.png")));
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        public static void LoadItemData(object sender, Panel panel, object type, string select)
        {
            coords.x        = -1;
            coords.y        = -1;
            coords.panelID  = -1;
            coords.BodyPart = -1;
            iGridItem       = null;
            iBeltItem       = null;
            iEquippedItem   = null;

            PictureBox pb         = (sender as PictureBox);
            PictureBox pictureBox = (sender as PictureBox);

            if (pb == null)
            {
                return;
            }

            accessablePictureBox = pb;
            if (select != "InventoryBelt" && select != "InventoryEquipped")
            {
                coords.x = Convert.ToInt32(pb.Name.Split('|')[0]);
                coords.y = Convert.ToInt32(pb.Name.Split('|')[1]);
                if (pb.Name.Split('|').Length == 3)
                {
                    coords.panelID = Convert.ToInt32(pb.Name.Split('|')[2]);
                    type           = (type as IList)[coords.panelID];
                }
            }
            else if (select == "InventoryEquipped")
            {
                coords.BodyPart = InventoryManager.charMap[pb.Name];
            }
            setGridItem(type, select, pb.Name);

            Panel itemStatDisplay = panel;

            UnloadItemData(itemStatDisplay);

            string itemName = null;

            if (itemName == null && iBeltItem != null)
            {
                itemName = iBeltItem.Potion.Name;
            }
            if (itemName == null)
            {
                itemName = getItemStat("Armor", "Name");
            }
            if (itemName == null)
            {
                itemName = getItemStat("Weapon", "Name");
            }
            if (itemName == null)
            {
                itemName = getItemStat("Potion", "Name");
            }
            if (itemName == null)
            {
                itemName = getItemStat("Gem", "Name");
            }
            if (itemName == null)
            {
                itemName = getItemStat("Reagent", "Name");
            }
            if (itemName == null)
            {
                itemName = getItemStat("Enneract", "Name");
            }
            if (itemName == null)
            {
                itemName = getItemStat("NPC2Consumable", "Name");
            }
            if (itemName == null)
            {
                return;
            }

            string l_itemName = null;

            WolcenStaticData.ItemLocalizedNames.TryGetValue(itemName, out l_itemName);
            if (l_itemName == null)
            {
                return;
            }

            Color itemRarity = getItemColorRarity();

            itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, l_itemName, itemStatDisplay, 13, itemRarity));
            string itemType = ParseItemNameForType(itemName);

            string itemStat = null;

            itemStat = getItemStat("Armor", "Health");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Health: " + itemStat, itemStatDisplay, 9, Color.White));
            }
            itemStat = getItemStat("Armor", "Armor");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Force Shield: " + itemStat, itemStatDisplay, 9, Color.White));
            }
            itemStat = getItemStat("Armor", "Resistance");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "All Resistance: " + itemStat, itemStatDisplay, 9, Color.White));
            }

            itemStat = getItemStat("Weapon", "DamageMin");
            string itemStat2 = getItemStat("Weapon", "DamageMax");

            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Material Damage: " + itemStat + "-" + itemStat2, itemStatDisplay, 9, Color.White));
            }
            itemStat = getItemStat("Weapon", "ResourceGeneration");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Resource Generation: " + itemStat, itemStatDisplay, 9, Color.White));
            }

            itemStat = getItemStat("Weapon", "ShieldResistance");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Resistance: " + itemStat, itemStatDisplay, 9, Color.White));
            }
            itemStat = getItemStat("Weapon", "ShieldBlockChance");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Block Chance: " + itemStat, itemStatDisplay, 9, Color.White));
            }
            itemStat = getItemStat("Weapon", "ShieldBlockEfficiency");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Block Efficiency: " + itemStat, itemStatDisplay, 9, Color.White));
            }

            itemStat = getItemStat("Potion", "Charge");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Charge: " + itemStat, itemStatDisplay, 9, Color.White));
            }
            itemStat = getItemStat("Potion", "ImmediateMana");
            if (itemStat != null)
            {
                if (itemStat.Contains("-"))
                {
                    if (itemStat != null && itemStat != "0")
                    {
                        itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Rage Generation: " + itemStat.Substring(1, itemStat.Length - 1), itemStatDisplay, 9, Color.White));
                    }
                }
                else
                {
                    if (itemStat != null && itemStat != "0")
                    {
                        itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Umbra Generation: " + itemStat, itemStatDisplay, 9, Color.White));
                    }
                }
            }
            itemStat = getItemStat("Potion", "ImmediateHP");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Health Generation: " + itemStat, itemStatDisplay, 9, Color.White));
            }

            itemStat = getItemStat("Potion", "ImmediateStamina");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Stamina Generation: " + itemStat, itemStatDisplay, 9, Color.White));
            }

            if (itemType != "Potions")
            {
                List <Effect> defaultEffects = getItemMagicEffect("Default");
                if (defaultEffects != null)
                {
                    foreach (Effect effect in defaultEffects)
                    {
                        string s_Effect = WolcenStaticData.MagicLocalized[effect.EffectId];
                        if (s_Effect.Contains("%1") || s_Effect.Contains("%2"))
                        {
                            if (!effect.Parameters[0].semantic.Contains("TriggeredSkillSelector"))
                            {
                                if (effect.EffectId.ToLower().Contains("percent") ||
                                    effect.Parameters[0].semantic.ToLower().Contains("percent") ||
                                    effect.Parameters[0].semantic.ToLower().Contains("ChanceFlatFloat") ||
                                    effect.Parameters[0].semantic.ToLower().Contains("PossibilityInt"))
                                {
                                    s_Effect = s_Effect.Replace("%1", "%1%");
                                }
                                if (effect.Parameters.Count > 1)
                                {
                                    if (effect.Parameters[1].semantic.ToLower().Contains("percent") ||
                                        effect.Parameters[1].semantic.ToLower().Contains("ChanceFlatFloat") ||
                                        effect.Parameters[1].semantic.ToLower().Contains("PossibilityInt"))
                                    {
                                        s_Effect = s_Effect.Replace("%2", "%2%");
                                    }
                                }

                                if (effect.Parameters.Count <= 0)
                                {
                                    LogMe.WriteLog("Error: effectID(" + effect.EffectId + "), effectName(" + effect.EffectName + ") missing semantics!");
                                    return;
                                }

                                if (effect.EffectId.ToLower().Contains("rage_conservation_time"))
                                {
                                    s_Effect = s_Effect.Replace("%1", "+" + effect.Parameters[0].value.ToString() + "/s");
                                }
                                else
                                {
                                    s_Effect = s_Effect.Replace("%1", "+" + effect.Parameters[0].value.ToString());
                                    if (s_Effect.Contains("%2") && effect.Parameters.Count > 1)
                                    {
                                        s_Effect = s_Effect.Replace("%2", effect.Parameters[1].value.ToString());
                                    }
                                }
                            }
                            else
                            {
                                if (effect.EffectId.ToLower().Contains("percent") ||
                                    effect.Parameters[1].semantic.ToLower().Contains("ChanceFlatFloat") ||
                                    effect.Parameters[1].semantic.ToLower().Contains("PossibilityInt"))
                                {
                                    s_Effect = s_Effect.Replace("%1", "%1%");
                                }

                                if (effect.Parameters.Count <= 0)
                                {
                                    LogMe.WriteLog("Error: effectID(" + effect.EffectId + "), effectName(" + effect.EffectName + ") missing semantics!");
                                    return;
                                }

                                s_Effect = s_Effect.Replace("%1", "+" + effect.Parameters[1].value.ToString());
                            }
                        }
                        itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, s_Effect, itemStatDisplay, 9, Color.White));
                    }
                }
            }

            if (itemName.Contains("Reagent"))
            {
                itemStat = getItemStat("Reagent", "StackSize");
                if (itemStat != null && itemStat != "0")
                {
                    itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Amount in stack: " + itemStat, itemStatDisplay, 9, Color.White));
                }

                switch (Convert.ToInt32(itemName.Substring(8, 1)))
                {
                case 1:
                    itemStat = "Rerolls all magic effects when used on an item. It will consume all socketed gems to guarantee a magic effect whose power depends on the gems' level, and whose type is chosen randomly among all the types of gems on the item.";
                    break;

                case 2:
                    itemStat = "Removes a random magic effect and adds another when used on an item. It will consume all socketed gems to guarantee a new magic effect whose power depends on the gems' level, and whose type is chosen randomly among all the types of gems on the item.";
                    break;

                case 3:
                    itemStat = "Adds a new random magic effect when used on an item. It will consume all socketed gems to guarantee a new magic effect whose power depends on the gems' level, and whose type is chosen randomly among all the types of gems on the item.";
                    break;

                case 4:
                    itemStat = "Removes a random magic effect when used on an item. It will consume all socketed gems to guarantee keeping a magic effect whose type is chosen randomly among all the types of gems on the item. Greater gems power allow the keeping of higher level magic effects.";
                    break;
                }
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, itemStat, itemStatDisplay, 9, Color.White));
                itemStatDisplay.Controls.Add(createLabelLineBreak(itemStatDisplay));

                if (itemName.Contains("Legendary"))
                {
                    itemStat = "This item can only be applied on legendary items.";
                }
                else
                {
                    itemStat = "This item cannot be applied on legendary and unique items.";
                }
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, itemStat, itemStatDisplay, 9, Color.White));
                return;
            }

            itemStatDisplay.Controls.Add(createLabelLineBreak(itemStatDisplay));

            itemStat = getItemStat("Gem", "StackSize");
            if (itemStat != null && itemStat != "0")
            {
                itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, "Amount in stack: " + itemStat, itemStatDisplay, 9, Color.White));
            }

            itemStat = getItemStat("Gem", "Name");
            if (itemStat != null)
            {
                string       socketType      = null;
                string       localizedEffect = null;
                var          GemAffixes      = WolcenStaticData.GemAffixesWithValues[itemStat];
                List <int[]> GemOrder        = new List <int[]>
                {
                    new int[] { 0, 3, 6 },
                    new int[] { 1, 4, 7 },
                    new int[] { 2, 5, 8 }
                };

                if (itemStat.Contains("physical_Gem"))
                {
                    GemOrder.RemoveAt(2);
                    GemOrder.Add(new int[] { 2, 5, 6 });
                }

                foreach (int[] d in GemOrder)
                {
                    foreach (int i in d)
                    {
                        socketType      = WolcenStaticData.SocketType[i];
                        localizedEffect = WolcenStaticData.MagicLocalized[GemAffixes.ElementAt(i).Key];
                        if (GemAffixes.ElementAt(i).Key.ToLower().Contains("percent"))
                        {
                            localizedEffect = localizedEffect.Replace("%1", "%1%");
                        }
                        if (localizedEffect.Contains("%2"))
                        {
                            localizedEffect = localizedEffect.Replace("%2", GemAffixes.ElementAt(i).Value);
                        }
                        localizedEffect = localizedEffect.Replace("%1", "+" + GemAffixes.ElementAt(i).Value);
                        itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, socketType, itemStatDisplay, 9, ColorTranslator.FromHtml(WolcenStaticData.SocketColor[i])));
                        itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, localizedEffect, itemStatDisplay, 7, ColorTranslator.FromHtml(WolcenStaticData.SocketColor[i])));
                    }
                }
                return;
            }

            List <Socket> Sockets = getSockets();

            if (Sockets != null)
            {
                foreach (Socket socket in Sockets)
                {
                    string s_Socket = WolcenStaticData.SocketType[socket.Effect];
                    if (socket.Gem == null)
                    {
                        s_Socket += " [empty]";
                    }
                    else
                    {
                        s_Socket += " " + WolcenStaticData.ItemLocalizedNames[socket.Gem.Name];
                    }
                    itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, s_Socket, itemStatDisplay, 9, ColorTranslator.FromHtml(WolcenStaticData.SocketColor[socket.Effect])));
                    if (socket.Gem != null)
                    {
                        itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, getGemStats(socket.Gem.Name, socket.Effect), itemStatDisplay, 7, ColorTranslator.FromHtml(WolcenStaticData.SocketColor[socket.Effect])));
                    }
                }
            }
            itemStatDisplay.Controls.Add(createLabelLineBreak(itemStatDisplay));

            List <Effect> magicEffects = getItemMagicEffect("RolledAffixes");

            if (magicEffects != null)
            {
                foreach (Effect effect in magicEffects)
                {
                    string s_Effect = WolcenStaticData.MagicLocalized[effect.EffectId];
                    if (s_Effect.Contains("%1") || s_Effect.Contains("%2"))
                    {
                        if (!effect.Parameters[0].semantic.Contains("TriggeredSkillSelector"))
                        {
                            if (effect.EffectId.ToLower().Contains("percent") ||
                                effect.Parameters[0].semantic.ToLower().Contains("percent") ||
                                effect.Parameters[0].semantic.ToLower().Contains("ChanceFlatFloat") ||
                                effect.Parameters[0].semantic.ToLower().Contains("PossibilityInt"))
                            {
                                s_Effect = s_Effect.Replace("%1", "%1%");
                            }

                            if (effect.Parameters.Count > 1)
                            {
                                if (effect.Parameters[1].semantic.ToLower().Contains("percent") ||
                                    effect.Parameters[1].semantic.ToLower().Contains("ChanceFlatFloat") ||
                                    effect.Parameters[1].semantic.ToLower().Contains("PossibilityInt"))
                                {
                                    s_Effect = s_Effect.Replace("%2", "%2%");
                                }
                            }

                            if (effect.Parameters.Count <= 0)
                            {
                                LogMe.WriteLog("Error: effectID(" + effect.EffectId + "), effectName(" + effect.EffectName + ") missing semantics!");
                                return;
                            }


                            if (effect.EffectId.ToLower().Contains("rage_conservation_time"))
                            {
                                s_Effect = s_Effect.Replace("%1", "+" + effect.Parameters[0].value.ToString() + "/s");
                            }
                            else
                            {
                                s_Effect = s_Effect.Replace("%1", "+" + effect.Parameters[0].value.ToString());
                                if (s_Effect.Contains("%2") && effect.Parameters.Count > 1)
                                {
                                    s_Effect = s_Effect.Replace("%2", effect.Parameters[1].value.ToString());
                                }
                            }
                        }
                        else
                        {
                            if (effect.EffectId.ToLower().Contains("percent") ||
                                effect.Parameters[1].semantic.ToLower().Contains("percent") ||
                                effect.Parameters[1].semantic.ToLower().Contains("ChanceFlatFloat") ||
                                effect.Parameters[1].semantic.ToLower().Contains("PossibilityInt"))
                            {
                                s_Effect = s_Effect.Replace("%1", "%1%");
                            }

                            if (effect.Parameters.Count <= 0)
                            {
                                LogMe.WriteLog("Error: effectID(" + effect.EffectId + "), effectName(" + effect.EffectName + ") missing semantics!");
                                return;
                            }

                            s_Effect = s_Effect.Replace("%1", "+" + effect.Parameters[1].value.ToString());
                        }
                    }
                    itemStatDisplay.Controls.Add(createLabel(pictureBox.Name, s_Effect, itemStatDisplay, 9, Color.White));
                }
            }
        }