Exemple #1
0
        private static void setGridItem(object type, string select, string pbName)
        {
            int i = 0;

            if (select == "InventoryBelt")
            {
                foreach (var iGrid in (GetPropertyValue(type, select) as IList <InventoryBelt>))
                {
                    if (iGrid.BeltSlot == 0 && pbName == "charBelt1")
                    {
                        iBeltItem = iGrid;
                    }
                    else if (iGrid.BeltSlot == 1 && pbName == "charBelt2")
                    {
                        iBeltItem = iGrid;
                    }
                }
            }
            else if (select == "InventoryEquipped")
            {
                foreach (var iGrid in (GetPropertyValue(type, select) as IList <InventoryEquipped>))
                {
                    if (iGrid.BodyPart == coords.BodyPart)
                    {
                        iEquippedItem = iGrid;
                    }
                }
            }
            else
            {
                foreach (var iGrid in (GetPropertyValue(type, select) as IList <InventoryGrid>))
                {
                    if (iGrid.InventoryX == coords.x && iGrid.InventoryY == coords.y)
                    {
                        iGridItem       = ObjectExtensions.Copy(iGrid);
                        globalItemIndex = i;
                        return;
                    }
                    i++;
                }
                iGridItem = null;
            }
        }
Exemple #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));
                }
            }
        }