Exemple #1
0
        public static ItemLocation FromLocation(Location location, byte stack)
        {
            ItemLocation loc = new ItemLocation();

            loc.Type           = Constants.ItemLocationType.Ground;
            loc.GroundLocation = location;
            loc.StackOrder     = stack;
            return(loc);
        }
Exemple #2
0
        public static ItemLocation FromContainer(byte container, byte position)
        {
            ItemLocation loc = new ItemLocation();

            loc.Type          = Constants.ItemLocationType.Container;
            loc.ContainerId   = container;
            loc.ContainerSlot = position;
            loc.StackOrder    = position;
            return(loc);
        }
Exemple #3
0
        public static ItemLocation FromItemLocation(ItemLocation location)
        {
            switch (location.Type)
            {
            case Constants.ItemLocationType.Container:
                return(ItemLocation.FromContainer(location.ContainerId, location.ContainerSlot));

            case Constants.ItemLocationType.Ground:
                return(ItemLocation.FromLocation(location.GroundLocation, location.StackOrder));

            /*case Constants.ItemLocationType.Slot:
             *  return ItemLocation.FromSlot(location.Slot);*/
            default:
                return(null);
            }
        }
Exemple #4
0
        public IEnumerable <Item> GetItems()
        {
            byte slot = 0;

            int numItems = Memory.ReadInt((int)address + Addresses.Container.DistanceAmount);

            for (uint i = 0; i < numItems; i++)
            {
                int itemId = Memory.ReadInt(address + (i * Addresses.Container.StepSlot) + Addresses.Container.DistanceItemId);
                if (itemId > 0)
                {
                    yield return(new Item((uint)itemId, Memory.ReadByte(address + (i * Addresses.Container.StepSlot) + Addresses.Container.DistanceItemCount), ItemLocation.FromContainer(number, slot)));
                }
                slot++;
            }
        }
Exemple #5
0
 public Item(uint id, byte count, ItemLocation location)
 {
     this.id       = id;
     this.count    = count;
     this.location = location;
 }