public override void HandleItemDrag(string name, ItemBase draggedItem, DragAndDropManager.DragRemoveItem dragDelegate, SegmentEntity targetEntity)
    {
        ExtraStorageHoppers hopper      = targetEntity as ExtraStorageHoppers;
        ItemBase            itemForSlot = this.GetItemForSlot(hopper, name);
        bool flag = true;

        if (itemForSlot != null)
        {
            flag = (draggedItem.mnItemID == itemForSlot.mnItemID);
        }
        if (hopper.OT && hopper.IsEmpty() && !hopper.ExemplarSet)
        {
            hopper.SetExemplar(draggedItem);
        }
        if (name == "ItemSlot" + this.SlotCount && flag && hopper.IsNotFull() && hopper.CheckExemplar(draggedItem))
        {
            ItemBase itemBase         = ItemManager.CloneItem(draggedItem);
            int      currentStackSize = ItemManager.GetCurrentStackSize(itemBase);
            if (hopper.RemainingCapacity < currentStackSize)
            {
                ItemManager.SetItemCount(itemBase, hopper.RemainingCapacity);
            }
            ExtraStorageHopperWindowNew.StoreItems(WorldScript.mLocalPlayer, hopper, itemBase);
            InventoryPanelScript.mbDirty = true;
            SurvivalHotBarManager.MarkAsDirty();
            SurvivalHotBarManager.MarkContentDirty();
            ExtraStorageHopperWindowNew.networkRedraw = true;
        }
    }
 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 ",
             itemToStore
         }));
         return(false);
     }
     if (hopper.AddItem(itemToStore) && hopper.CheckExemplar(itemToStore))
     {
         if (player.mbIsLocalPlayer)
         {
             Color lCol = Color.green;
             if (itemToStore.mType == ItemType.ItemCubeStack)
             {
                 ItemCubeStack itemCubeStack = itemToStore as ItemCubeStack;
                 if (CubeHelper.IsGarbage(itemCubeStack.mCubeType))
                 {
                     lCol = Color.red;
                 }
                 if (CubeHelper.IsSmeltableOre(itemCubeStack.mCubeType))
                 {
                     lCol = Color.green;
                 }
             }
             if (itemToStore.mType == ItemType.ItemStack)
             {
                 lCol = Color.cyan;
             }
             if (itemToStore.mType == ItemType.ItemSingle)
             {
                 lCol = Color.white;
             }
             if (itemToStore.mType == ItemType.ItemCharge)
             {
                 lCol = Color.magenta;
             }
             if (itemToStore.mType == ItemType.ItemDurability)
             {
                 lCol = Color.yellow;
             }
             if (itemToStore.mType == ItemType.ItemLocation)
             {
                 lCol = Color.gray;
             }
             FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 0.75f, "Stored " + player.GetItemName(itemToStore), lCol, 1.5f, 64f);
         }
         player.mInventory.VerifySuitUpgrades();
         if (!WorldScript.mbIsServer)
         {
             NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindowNew", "StoreItems", null, itemToStore, hopper, 0f);
         }
         return(true);
     }
     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);
 }