Example #1
0
        public static Item CloneItem(Item originalItem)
        {
            var clonedItem = CreateItem(originalItem.Owner, originalItem.ItemDefinition);

            AffixGenerator.CloneIntoItem(originalItem, clonedItem);
            return(clonedItem);
        }
Example #2
0
        public Item(GS.Map.World world, ItemTable definition, bool Craft = false)
            : base(world, definition.SNOActor)
        {
            //Attributes[GameAttribute.Requirement,38] = (ulong)definition.RequiredLevel;
            SetInitialValues(definition);
            this.ItemHasChanges = true;//initial, this is set to true.
            // level requirement
            //Attributes[GameAttribute.Requirement, 316] = 10f;
            //Attributes[GameAttribute.Requirements_Ease_Percent, 38] = definition.RequiredLevel - 1;
            string[] parts = definition.Name.Split(new char[] { '_' });
            //Attributes[GameAttribute.Requirement,1] = definition.RequiredLevel;
            Attributes[GameAttribute.Item_Quality_Level] = 1;
            //Attributes[GameAttribute.Core_Attributes_From_Item_Bonus_Multiplier] = 1;

            this.Field2 = 0;

            this.Field11 = 0;
            Attributes[GameAttribute.IdentifyCost] = 1;
            //this.ItemType.Flags = this.ItemType.Flags | ItemFlags.Unknown | ItemFlags.Socketable;


            //this.Attributes[GameAttribute.Sockets] = 1;
            this.Attributes[GameAttribute.Sockets_Filled] = 0;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType))
            {
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(8);
            }

            if (Attributes[GameAttribute.Item_Quality_Level] > 5 & Attributes[GameAttribute.Item_Quality_Level] < 9)
            {
                if (RandomHelper.Next(0, 100) < 85)
                {
                    Attributes[GameAttribute.Item_Quality_Level] -= 2;
                }
            }

            if (this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
            {
                Attributes[GameAttribute.Item_Quality_Level] = 3;
            }

            if (parts[0] == "Unique")
            {
                Logger.Debug("Геренация уникального предмета");
                Attributes[GameAttribute.Item_Quality_Level] = 9;

                if ((Item.IsArmor(this.ItemType)))
                {
                    Attributes[GameAttribute.Armor_Item] = definition.ItemLevel + RandomHelper.Next(0, 20);
                }
                if ((Item.IsWeapon(this.ItemType)))
                {
                    Attributes[GameAttribute.Attacks_Per_Second_Item] = 1.1f;
                    Attributes[GameAttribute.Damage_Weapon_Min, 0]    = (definition.ItemLevel + definition.RequiredLevel + RandomHelper.Next(1, 4)) * 2;
                    Attributes[GameAttribute.Damage_Weapon_Delta, 0] += RandomHelper.Next(1, 3);
                    //scripted //Attributes[GameAttribute.Damage_Weapon_Max, 0] += Attributes[GameAttribute.Damage_Weapon_Min, 0] + Attributes[GameAttribute.Damage_Weapon_Delta, 0];
                }
                if (definition.SNOSet != -1)
                {
                    Attributes[GameAttribute.Item_Quality_Level] = 10;
                    if ((Item.IsArmor(this.ItemType)))
                    {
                        Attributes[GameAttribute.Armor_Item] = definition.ItemLevel * RandomHelper.Next(2, 4);
                    }
                    if ((Item.IsWeapon(this.ItemType)))
                    {
                        Attributes[GameAttribute.Damage_Weapon_Min] = (definition.ItemLevel + definition.RequiredLevel + RandomHelper.Next(2, 6)) * 2;
                        Attributes[GameAttribute.Damage_Weapon_Max] = (definition.ItemLevel + definition.RequiredLevel + RandomHelper.Next(7, 20)) * 2;
                    }
                }
            }
            else
            {
                if ((Item.IsWeapon(this.ItemType)))
                {
                    Attributes[GameAttribute.Damage_Weapon_Min, 0]   += RandomHelper.Next(-2, 2);
                    Attributes[GameAttribute.Damage_Weapon_Delta, 0] += RandomHelper.Next(0, 2);
                }
                if ((Item.IsArmor(this.ItemType)))
                {
                    Attributes[GameAttribute.Armor_Item] += RandomHelper.Next(-1, 3);
                }
            }

            /*
             * Inferior, 0
             * Normal, 1
             * Superior, 2
             * Magic1, 3
             * Magic2, 4
             * Magic3, 5
             * Rare4, 6
             * Rare5, 7
             * Rare6, 8
             * Legendary, 9
             * Artifact, 10
             */
            Attributes[GameAttribute.ItemStackQuantityLo] = 1;
            Attributes[GameAttribute.Seed] = RandomHelper.Next(); //unchecked((int)2286800181);

            RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
            RandomGenerator.Next();
            if (Item.IsArmor(this.ItemType))
            {
                RandomGenerator.Next(); // next value is used but unknown if armor
            }
            RandomGenerator.ReinitSeed();

            ApplyWeaponSpecificOptions(definition);
            ApplyArmorSpecificOptions(definition);
            ApplyDurability(definition);
            ApplySkills(definition);
            ApplyAttributeSpecifier(definition);



            int affixNumber = 1;

            #region
            if (Craft == true)
            {
                if (definition.Name == "ChestArmor_002" ||
                    definition.Name == "Boots_002" ||
                    definition.Name == "Crossbow_001" ||
                    definition.Name == "Wand_001" ||
                    definition.Name == "Axe_1h_002" ||
                    definition.Name == "Pants_003" ||
                    definition.Name == "Bracers_002" ||
                    definition.Name == "Gloves_003" ||
                    definition.Name == "Shield_003" ||
                    definition.Name == "Sword_2h_002" ||
                    definition.Name == "Helm_003" ||
                    definition.Name == "Belt_003" ||
                    definition.Name == "Shoulders_002" ||
                    definition.Name == "CombatStaff_2H_002" ||
                    definition.Name == "Shoulders_003" ||
                    definition.Name == "Boots_004" ||
                    definition.Name == "MightyWeapon1H_003" ||
                    definition.Name == "Mace_2H_004" ||
                    definition.Name == "ChestArmor_005" ||
                    definition.Name == "Gloves_005" ||
                    definition.Name == "Bow_005" ||
                    definition.Name == "Wand_006" ||
                    definition.Name == "FistWeapon_1H_004" ||
                    definition.Name == "Boots_006" ||
                    definition.Name == "Axe_2H_005" ||
                    definition.Name == "Axe_1H_007" ||
                    definition.Name == "Wand_004"
                    )
                {
                    Attributes[GameAttribute.Item_Quality_Level] = 4;
                }
                if (definition.Name == "Quiver_004" || //Нужно добавить будет аффикс на +10% к скорости атаки.
                    definition.Name == "Quiver_005" ||
                    definition.Name == "Axe_1H_004" ||
                    definition.Name == "Handxbow_004" ||
                    definition.Name == "CeremonialDagger_1H_003" ||
                    definition.Name == "Sword_2H_004" ||
                    definition.Name == "Shield_006" ||
                    definition.Name == "Mace_1H_006" ||
                    definition.Name == "HandXbow_008" ||
                    definition.Name == "Bracers_006" ||
                    definition.Name == "CombatStaff_2H_004" ||
                    definition.Name == "ChestArmor_006" ||

                    definition.Name == "Mojo_004" || //Нужно добавить аффикс на 3-5 дамага
                    definition.Name == "Dagger_006" ||
                    definition.Name == "Orb_003")    //Нужно добавить будет аффикс на 5-6 дамага.
                {
                    Attributes[GameAttribute.Item_Quality_Level] = 5;
                }
                if (definition.Name == "Helm_004" ||
                    definition.Name == "Belt_006" ||
                    definition.Name == "Wand_007" ||
                    definition.Name == "Shoulders_006" ||
                    definition.Name == "Pants_006" ||
                    definition.Name == "Sword_1H_008")
                {
                    Attributes[GameAttribute.Item_Quality_Level] = 6;
                }
                if (definition.Name == "Staff_006" ||
                    definition.Name == "-1")
                {
                    Attributes[GameAttribute.Item_Quality_Level] = 7;
                }
            }
            #endregion

            if (Attributes[GameAttribute.Item_Quality_Level] >= 3)
            {
                affixNumber = Attributes[GameAttribute.Item_Quality_Level] - 2;
            }
            if (Attributes[GameAttribute.Item_Quality_Level] >= 3)
            {
                affixNumber = Attributes[GameAttribute.Item_Quality_Level] - 2;
            }
            AffixGenerator.Generate(this, affixNumber);
            //
            if (this.Quality > 5 & this.Quality < 9)
            {
                this.Field7 = 1;

                /*world..InGameClient.SendMessage(new GameSyncedDataMessage
                 * {
                 *  Field0 = GameData
                 * });
                 * RareItemNameMessage*/


                this.World.BroadcastIfRevealed(new RareItemNameMessage
                {
                    Field0 = (int)this.DynamicID,
                    Field1 = new RareItemName {
                        snoAffixStringList = this.ItemDefinition.SNORareNamePrefixStringList
                    }
                }, this);
            }

            this.Attributes.BroadcastChangedIfRevealed();

            //if (definition.Name == "Quiver_004")
            //    AffixList.Add(new Affix(2044719016));
        }