Esempio n. 1
0
 public abstract void AddContainerOpen(byte localID, Container cont);
Esempio n. 2
0
 public override void AddContainerOpen(byte localID, Container cont)
 {
     throw new NotImplementedException();
 }
Esempio n. 3
0
 public abstract void UpdateOpenContainer(byte localID, Container cont);
Esempio n. 4
0
 /// <summary>
 /// Given a container, this method returns
 /// at which index the container is relative
 /// to the player's opened container list. 
 /// Note: container must be in open containers.
 /// </summary>
 /// <param name="container">The container whose index
 /// to look for.</param>
 /// <returns>Index of container.</returns>
 public byte GetContainerIndex(Container container)
 {
     for (byte i = 0; i < Constants.MAX_CONTAINERS; i++) {
         if (openContainers[i] == container) {
             return i;
         }
     }
     throw new Exception("Invalid state in GetContainerIndex()");
 }
Esempio n. 5
0
 public override void UpdateOpenContainer(byte localID, Container cont)
 {
     throw new NotImplementedException();
 }
Esempio n. 6
0
 /// <summary>
 /// Updates the player's client with the specified
 /// container.
 /// </summary>
 /// <param name="container">The container to update.</param>
 public void UpdateContainer(Container container)
 {
     AddAffected();
     protocolS.UpdateOpenContainer(
         GetContainerIndex(container), container);
 }
Esempio n. 7
0
 /// <summary>
 /// Closes the specified container. Note: Container
 /// must be open.
 /// </summary>
 /// <param name="container">Container to close</param>
 public void AppendCloseContainer(Container container)
 {
     if (openContainers[0] == container) {
         AppendCloseContainer(0);
     } else if (openContainers[1] == container) {
         AppendCloseContainer(1);
     } else {
         throw new Exception("Invalid call to CloseContainer()");
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Open the specified container and resets/sends data.
        /// </summary>
        /// <param name="container">The container to open.</param>
        public void OpenContainer(Container container)
        {
            if (openContainers[0] == container ||
                openContainers[1] == container) {
                return;
            }

            byte index = GetFreeContainerIndex();
            if (openContainers[index] != null) {
                openContainers[index].RemoveViewer(this);
            }

            openContainers[index] = container;
            container.AddViewer(this);
            AddAffected();
            protocolS.AddContainerOpen(index, container);
        }
Esempio n. 9
0
        public List<Item> GetItemsInContainer(Container container)
        {
            List<Item> itemList = new List<Item>();

            foreach (Item item in container.GetItems())
            {
                itemList.Add(item);

                if (item.Type == /*Constants.TYPE_CONTAINER*/ 9220) // TODO: WHAT IS THIS? Why not TYPE_CONTAINER?
                    itemList.AddRange(GetItemsInContainer((Container)item));
            }

            return itemList;
        }
Esempio n. 10
0
 public Item Clone()
 {
     Item item = null;
     if (itemDict[ItemID].IsOfType(Constants.TYPE_CONTAINER)) {
         string attr = itemDict[ItemID].
         GetAttribute(Constants.ATTRIBUTE_CONTAINER_SIZE);
         byte containerSize = attr == null ? (byte) 0 : byte.Parse(attr);
         item = new Container(ItemID, containerSize);
     } else {
         item = new Item(ItemID);
     }
     Clone(item);
     return item;
 }
Esempio n. 11
0
 /// <summary>
 /// Updates an open container.
 /// </summary>
 /// <param name="localID">The local ID of the container.</param>
 /// <param name="cont">A reference to the container.</param>
 public override void UpdateOpenContainer(byte localID, Container cont)
 {
     AddContainerOpen(localID, cont);
 }
Esempio n. 12
0
 /// <summary>
 /// Adds a container open to the player's client.
 /// </summary>
 /// <param name="localID">The local ID of the container.</param>
 /// <param name="cont">A reference to the container.</param>
 public override void AddContainerOpen(byte localID, Container cont)
 {
     netmsg.AddU16(0x13); //Open container header
     netmsg.AddByte(localID);
     netmsg.AddU16(cont.ItemID);
     foreach (Item item in cont.GetItems()) {
         AddCarryingItem(item);
     }
     netmsg.AddU16(0xFFFF);
 }