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 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); }