Esempio n. 1
0
        public static void Update(TrinityItem actor)
        {
            if (actor.ActorType != ActorType.Item)
            {
                return;
            }

            if (!actor.IsAcdBased || !actor.IsAcdValid)
            {
                return;
            }

            var commonData = actor.CommonData;

            actor.AcdId = commonData.ACDId;

            var slot = ZetaDia.Memory.Read <InventorySlot>(commonData.BaseAddress + 0x164);
            var col  = ZetaDia.Memory.Read <int>(commonData.BaseAddress + 0x168);
            var row  = ZetaDia.Memory.Read <int>(commonData.BaseAddress + 0x16c);

            var columnChanged = col != actor.InventoryColumn;
            var rowChanged    = row != actor.InventoryRow;
            var slotChanged   = slot != actor.InventorySlot;

            actor.LastInventorySlot   = actor.InventorySlot;
            actor.LastInventoryRow    = actor.InventoryRow;
            actor.LastInventoryColumn = actor.InventoryColumn;

            actor.InventorySlot   = slot;
            actor.InventoryRow    = row;
            actor.InventoryColumn = col;

            //if (!actor.IsEquipment && Core.Player.IsInTown)
            //{
            actor.ItemStackQuantity = actor.Attributes.ItemStackQuantity;
            //}

            if (actor.LastInventorySlot == InventorySlot.None && actor.InventorySlot == InventorySlot.BackpackItems)
            {
                UpdateBasicProperties(actor);
                actor.Attributes = new AttributesWrapper(commonData);
                Create(actor);
                actor.OnPickedUp();
            }

            if (columnChanged || rowChanged || slotChanged)
            {
                actor.OnMoved();
            }

            if (actor.InventorySlot == InventorySlot.BackpackItems && actor.IsUnidentified && !actor.Attributes.IsUnidentified)
            {
                //actor.Attributes = new AttributesWrapper(commonData);
                UpdateBasicProperties(actor);
                Create(actor);
                actor.OnIdentified();
            }
        }
Esempio n. 2
0
        public static void Update(TrinityItem actor)
        {
            if (actor.ActorType != ActorType.Item)
            {
                return;
            }

            if (actor.CommonData == null)
            {
                return;
            }

            var columnChanged = actor.InventoryColumn != actor.LastInventoryColumn;
            var rowChanged    = actor.InventoryRow != actor.LastInventoryRow;
            var slotChanged   = actor.InventorySlot != actor.LastInventorySlot;

            actor.LastInventorySlot   = actor.InventorySlot;
            actor.LastInventoryRow    = actor.InventoryRow;
            actor.LastInventoryColumn = actor.InventoryColumn;

            if (actor.LastInventorySlot == InventorySlot.None && actor.InventorySlot == InventorySlot.BackpackItems)
            {
                actor.OnPickedUp();
            }

            if (columnChanged || rowChanged || slotChanged)
            {
                actor.OnMoved();
            }

            if (actor.InventorySlot == InventorySlot.BackpackItems && actor.IsUnidentified && !actor.Attributes.IsUnidentified)
            {
                actor.OnIdentified();
            }

            Create(actor);
        }