public static bool TakeItems(Player player, ExtraStorageHoppers hopper)
 {
     //ENABLE/DISABLE FEEDING OF HIVEBIND - ONLY FOR VOID HOPPER
     if (hopper.GetCubeValue() == 0)
     {
         if (hopper.FeedHiveMind)
         {
             hopper.FeedHiveMind = false;
             FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 1f, "Not Feeding Hivemind!", Color.green, 2f);
         }
         else
         {
             hopper.FeedHiveMind = true;
             FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 1f, "Feeding Hivemind!", Color.red, 2f);
         }
         return(true);
     }
     //******************** TAKE ITEMS FROM HOPPER AND ADD THEM TO INVENTORY ********************
     if (hopper.mnStorageUsed > 0)
     {
         ItemBase lItemToAdd = hopper.RemoveFirstInventoryItem();
         if (lItemToAdd != null)
         {
             Debug.Log("RemovingFirstInventoryItem from for " + player.mUserName);
             if (!player.mInventory.AddItem(lItemToAdd))
             {
                 if (!hopper.AddItem(lItemToAdd))
                 {
                     ItemManager.instance.DropItem(lItemToAdd, player.mnWorldX, player.mnWorldY, player.mnWorldZ, Vector3.zero);
                 }
                 return(false);
             }
             if (player.mbIsLocalPlayer)
             {
                 Color green = Color.green;
                 if (lItemToAdd.mType == ItemType.ItemCubeStack)
                 {
                     ItemCubeStack stack = lItemToAdd as ItemCubeStack;
                     if (CubeHelper.IsGarbage(stack.mCubeType))
                     {
                         green = Color.red;
                     }
                     if (CubeHelper.IsSmeltableOre(stack.mCubeType))
                     {
                         green = Color.green;
                     }
                 }
                 if (lItemToAdd.mType == ItemType.ItemStack)
                 {
                     green = Color.cyan;
                 }
                 if (lItemToAdd.mType == ItemType.ItemSingle)
                 {
                     green = Color.white;
                 }
                 if (lItemToAdd.mType == ItemType.ItemCharge)
                 {
                     green = Color.magenta;
                 }
                 if (lItemToAdd.mType == ItemType.ItemDurability)
                 {
                     green = Color.yellow;
                 }
                 if (lItemToAdd.mType == ItemType.ItemLocation)
                 {
                     green = Color.gray;
                 }
                 FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 1f, player.GetItemName(lItemToAdd), green, 1.5f);
             }
             player.mInventory.VerifySuitUpgrades();
             if (!WorldScript.mbIsServer)
             {
                 NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindow", "TakeItems", null, lItemToAdd, hopper, 0f);
             }
             return(true);
         }
     }
     return(false);
 }
 public static bool StoreItems(Player player, ExtraStorageHoppers hopper, ItemBase itemToStore)
 {
     if ((player == WorldScript.mLocalPlayer) && !WorldScript.mLocalPlayer.mInventory.RemoveItemByExample(itemToStore, true))
     {
         Debug.Log(string.Concat(new object[] { "Player ", player.mUserName, " doesnt have ", player.GetItemName(itemToStore) }));
         return(false);
     }
     if (!hopper.AddItem(itemToStore))
     {
         Debug.LogWarning("Bad thing that used to be unhandled! Thread interaccess probably caused this to screw up!");
         if (player == WorldScript.mLocalPlayer)
         {
             WorldScript.mLocalPlayer.mInventory.AddItem(itemToStore);
             return(false);
         }
         player.mInventory.AddItem(itemToStore);
         return(false);
     }
     if (player.mbIsLocalPlayer)
     {
         Color    green = Color.green;
         ItemBase lItem = itemToStore;
         if (lItem.mType == ItemType.ItemCubeStack)
         {
             ItemCubeStack stack = lItem as ItemCubeStack;
             if (CubeHelper.IsGarbage(stack.mCubeType))
             {
                 green = Color.red;
             }
             if (CubeHelper.IsSmeltableOre(stack.mCubeType))
             {
                 green = Color.green;
             }
         }
         if (lItem.mType == ItemType.ItemStack)
         {
             green = Color.cyan;
         }
         if (lItem.mType == ItemType.ItemSingle)
         {
             green = Color.white;
         }
         if (lItem.mType == ItemType.ItemCharge)
         {
             green = Color.magenta;
         }
         if (lItem.mType == ItemType.ItemDurability)
         {
             green = Color.yellow;
         }
         if (lItem.mType == ItemType.ItemLocation)
         {
             green = Color.gray;
         }
         if (hopper.GetCubeValue() == 0)
         {
             green = Color.red;
             FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 0.75f, "Sent " + player.GetItemName(lItem) + " to the void!", green, 1.5f);
         }
         else
         {
             FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 0.75f, "Stored " + player.GetItemName(lItem), green, 1.5f);
         }
     }
     player.mInventory.VerifySuitUpgrades();
     if (!WorldScript.mbIsServer)
     {
         NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindow", "StoreItems", null, itemToStore, hopper, 0f);
     }
     return(true);
 }
 public static bool TakeItems(Player player, ExtraStorageHoppers hopper, ItemBase item)
 {
     //ENABLE/DISABLE FEEDING OF HIVEBIND - ONLY FOR VOID HOPPER
     if (hopper.GetCubeValue() == 0)
     {
         if (hopper.FeedHiveMind)
         {
             hopper.FeedHiveMind = false;
             FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 1f, "Not Feeding Hivemind!", Color.green, 2f);
         }
         else
         {
             hopper.FeedHiveMind = true;
             FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 1f, "Feeding Hivemind!", Color.red, 2f);
         }
         return(true);
     }
     else if (hopper.mnStorageUsed > 0)
     {
         ItemBase itemBase;
         if (item == null)
         {
             itemBase = hopper.RemoveFirstInventoryItem();
         }
         else if (item.mType == ItemType.ItemCubeStack)
         {
             hopper.TryPartialExtractItemsOrCubes(null, item.mnItemID, (item as ItemCubeStack).mCubeType, (item as ItemCubeStack).mCubeValue, ItemManager.GetCurrentStackSize(item), out itemBase);
         }
         else
         {
             hopper.TryPartialExtractItems(null, item.mnItemID, ItemManager.GetCurrentStackSize(item), out itemBase);
         }
         if (itemBase != null)
         {
             Debug.Log("Removing Item from StorageHopper for " + player.mUserName);
             if (!player.mInventory.AddItem(itemBase))
             {
                 if (!hopper.AddItem(itemBase))
                 {
                     ItemManager.instance.DropItem(itemBase, player.mnWorldX, player.mnWorldY, player.mnWorldZ, Vector3.zero);
                 }
                 return(false);
             }
             if (player.mbIsLocalPlayer)
             {
                 Color lCol = Color.green;
                 if (itemBase.mType == ItemType.ItemCubeStack)
                 {
                     ItemCubeStack itemCubeStack = itemBase as ItemCubeStack;
                     if (CubeHelper.IsGarbage(itemCubeStack.mCubeType))
                     {
                         lCol = Color.red;
                     }
                     if (CubeHelper.IsSmeltableOre(itemCubeStack.mCubeType))
                     {
                         lCol = Color.green;
                     }
                 }
                 if (itemBase.mType == ItemType.ItemStack)
                 {
                     lCol = Color.cyan;
                 }
                 if (itemBase.mType == ItemType.ItemSingle)
                 {
                     lCol = Color.white;
                 }
                 if (itemBase.mType == ItemType.ItemCharge)
                 {
                     lCol = Color.magenta;
                 }
                 if (itemBase.mType == ItemType.ItemDurability)
                 {
                     lCol = Color.yellow;
                 }
                 if (itemBase.mType == ItemType.ItemLocation)
                 {
                     lCol = Color.gray;
                 }
                 FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 1f, player.GetItemName(itemBase), lCol, 1.5f, 64f);
             }
             player.mInventory.VerifySuitUpgrades();
             if (!WorldScript.mbIsServer)
             {
                 NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindowNew", "TakeItems", null, itemBase, hopper, 0f);
             }
             return(true);
         }
     }
     return(false);
 }