Beispiel #1
0
 public int GetContainerId(Container container)
 {
     for (int i = 0; i < Constants.MaxOpenContainers; ++i)
     {
         if (openContainers[i] != null && openContainers[i].Container == container)
             return i;
     }
     return -1;
 }
Beispiel #2
0
 public byte OpenContainer(Container container, Location location)
 {
     byte i;
     for (i = 0; i < Constants.MaxOpenContainers; i++)
     {
         if (openContainers[i] == null)
         {
             openContainers[i] = new InventoryContainer(container, i, location);
             return i;
         }
     }
     // TODO: handle more than 16, replace last one
     return i;
 }
Beispiel #3
0
 public byte OpenContainer(Container container)
 {
     return OpenContainer(container, null);
 }
Beispiel #4
0
 public InventoryContainer(Container cont, byte id, Location loc)
 {
     Container = cont;
     Id = id;
     Location = loc;
 }
Beispiel #5
0
 public void OpenContainerAt(Container container, byte index)
 {
     if (index < Constants.MaxOpenContainers)
         openContainers[index] = new InventoryContainer(container, index, null);
 }
Beispiel #6
0
        public void SendContainerOpen(Container container, byte containerId)
        {
            NetworkMessage message = new NetworkMessage();

            ContainerOpenPacket.Add(
                message,
                containerId,
                container.Info.SpriteId,
                "Container",
                container.Volume,
                container.Parent != null,
                container.Items
            );

            Send(message);
        }