public abstract void AddContainerOpen(byte localID, Container cont);
public override void AddContainerOpen(byte localID, Container cont) { throw new NotImplementedException(); }
public abstract void UpdateOpenContainer(byte localID, Container cont);
/// <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()"); }
public override void UpdateOpenContainer(byte localID, Container cont) { throw new NotImplementedException(); }
/// <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); }
/// <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()"); } }
/// <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); }
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; }
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; }
/// <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); }
/// <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); }