예제 #1
0
        public override bool TryGetItemGamepadOverrideInstructions(
            Item[] inv,
            int context,
            int slot,
            out string instruction)
        {
            instruction = "";
            Item newItem = inv[slot];

            if (newItem.IsAir || newItem.favorited)
            {
                return(false);
            }
            switch (context)
            {
            case 0:
                if (TEHatRack.FitsHatRack(newItem))
                {
                    instruction = Lang.misc[76].Value;
                    return(true);
                }
                break;

            case 26:
            case 27:
                if (Main.player[Main.myPlayer].ItemSpace(newItem).CanTakeItemToPersonalInventory)
                {
                    instruction = Lang.misc[68].Value;
                    return(true);
                }
                break;
            }
            return(false);
        }
예제 #2
0
        public override bool OverrideItemSlotHover(Item[] inv, int context = 0, int slot = 0)
        {
            Item obj = inv[slot];

            if (!obj.IsAir && !inv[slot].favorited && (context == 0 && TEHatRack.FitsHatRack(obj)))
            {
                Main.cursorOverride = 9;
                return(true);
            }
            if (obj.IsAir || context != 26 && context != 27 || !Main.player[Main.myPlayer].ItemSpace(inv[slot]).CanTakeItemToPersonalInventory)
            {
                return(false);
            }
            Main.cursorOverride = 8;
            return(true);
        }
예제 #3
0
        private bool TryFitting(Item[] inv, int context = 0, int slot = 0, bool justCheck = false)
        {
            if (!TEHatRack.FitsHatRack(inv[slot]))
            {
                return(false);
            }
            if (justCheck)
            {
                return(true);
            }
            int index1 = TEHatRack.hatTargetSlot;

            ++TEHatRack.hatTargetSlot;
            for (int index2 = 0; index2 < 2; ++index2)
            {
                if (this._items[index2].IsAir)
                {
                    index1 = index2;
                    TEHatRack.hatTargetSlot = index2 + 1;
                    break;
                }
            }
            for (int index2 = 0; index2 < 2; ++index2)
            {
                if (inv[slot].type == this._items[index2].type)
                {
                    index1 = index2;
                }
            }
            if (TEHatRack.hatTargetSlot >= 2)
            {
                TEHatRack.hatTargetSlot = 0;
            }
            SoundEngine.PlaySound(7, -1, -1, 1, 1f, 0.0f);
            Utils.Swap <Item>(ref this._items[index1], ref inv[slot]);
            if (Main.netMode == 1)
            {
                NetMessage.SendData(124, -1, -1, (NetworkText)null, Main.myPlayer, (float)this.ID, (float)index1, 0.0f, 0, 0, 0);
            }
            return(true);
        }
예제 #4
0
 public override bool OverrideItemSlotLeftClick(Item[] inv, int context = 0, int slot = 0)
 {
     if (!ItemSlot.ShiftInUse)
     {
         return(false);
     }
     if (Main.cursorOverride == 9 && context == 0)
     {
         Item obj = inv[slot];
         if (Main.cursorOverride == 9 && !obj.IsAir && (!obj.favorited && context == 0) && TEHatRack.FitsHatRack(obj))
         {
             return(this.TryFitting(inv, context, slot, false));
         }
     }
     if ((Main.cursorOverride != 8 || context != 23) && (context != 26 && context != 27))
     {
         return(false);
     }
     inv[slot] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, inv[slot], GetItemSettings.InventoryEntityToPlayerInventorySettings);
     if (Main.netMode == 1)
     {
         NetMessage.SendData(124, -1, -1, (NetworkText)null, Main.myPlayer, (float)this.ID, (float)slot, 0.0f, 0, 0, 0);
     }
     return(true);
 }