Ejemplo n.º 1
0
        public static Item CloneItem(Item originalItem)
        {
            var clonedItem = CreateItem(originalItem.Owner, originalItem.ItemDefinition);

            AffixGenerator.CloneIntoItem(originalItem, clonedItem);
            return(clonedItem);
        }
Ejemplo n.º 2
0
        public Item(GS.Map.World world, ItemTable definition)
            : base(world, definition.SNOActor)
        {
            SetInitialValues(definition);
            this.ItemHasChanges = true;//initial, this is set to true.
            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;

            Attributes[GameAttribute.Item_Quality_Level] = 1;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType))
            {
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
            }
            if (this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
            {
                Attributes[GameAttribute.Item_Quality_Level] = 3;
            }

            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;

            if (Attributes[GameAttribute.Item_Quality_Level] >= 3)
            {
                affixNumber = Attributes[GameAttribute.Item_Quality_Level] - 2;
            }
            AffixGenerator.Generate(this, affixNumber);
        }
Ejemplo n.º 3
0
        public Item(GS.Map.World world, ItemTable definition)
            : base(world, definition.SNOActor)
        {
            this.ItemDefinition = definition;

            this.GBHandle.Type     = (int)GBHandleType.Gizmo;
            this.GBHandle.GBID     = definition.Hash;
            this.ItemType          = ItemGroup.FromHash(definition.ItemType1);
            this.EquipmentSlot     = 0;
            this.InventoryLocation = new Vector2D {
                X = 0, Y = 0
            };
            this.Scale     = 1.0f;
            this.RotationW = 0.0f;
            this.RotationAxis.Set(0.0f, 0.0f, 1.0f);
            this.CurrentState = ItemState.Normal;
            this.Field2       = 0x00000000;
            this.Field7       = 0;
            this.NameSNOId    = -1;   // I think it is ignored anyways - farmy
            this.Field10      = 0x00;

            this.ItemLevel = definition.ItemLevel;

            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;

            Attributes[GameAttribute.Item_Quality_Level] = 1;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType))
            {
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
            }
            if (this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
            {
                Attributes[GameAttribute.Item_Quality_Level] = 3;
            }

            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;

            if (Attributes[GameAttribute.Item_Quality_Level] >= 3)
            {
                affixNumber = Attributes[GameAttribute.Item_Quality_Level] - 2;
            }
            AffixGenerator.Generate(this, affixNumber);
        }