Пример #1
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 (!obj.IsAir && !obj.favorited && TEDisplayDoll.FitsDisplayDoll(obj))
         {
             return(this.TryFitting(inv, context, slot, false));
         }
     }
     if ((Main.cursorOverride != 8 || context != 23) && (context != 24 && context != 25))
     {
         return(false);
     }
     inv[slot] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, inv[slot], GetItemSettings.InventoryEntityToPlayerInventorySettings);
     if (Main.netMode == 1)
     {
         if (context == 25)
         {
             NetMessage.SendData(121, -1, -1, (NetworkText)null, Main.myPlayer, (float)this.ID, (float)slot, 1f, 0, 0, 0);
         }
         else
         {
             NetMessage.SendData(121, -1, -1, (NetworkText)null, Main.myPlayer, (float)this.ID, (float)slot, 0.0f, 0, 0, 0);
         }
     }
     return(true);
 }
Пример #2
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 (TEDisplayDoll.FitsDisplayDoll(newItem))
                {
                    instruction = Lang.misc[76].Value;
                    return(true);
                }
                break;

            case 23:
            case 24:
            case 25:
                if (Main.player[Main.myPlayer].ItemSpace(newItem).CanTakeItemToPersonalInventory)
                {
                    instruction = Lang.misc[68].Value;
                    return(true);
                }
                break;
            }
            return(false);
        }
Пример #3
0
        public static int Place(int x, int y)
        {
            TEDisplayDoll teDisplayDoll = new TEDisplayDoll();

            teDisplayDoll.Position                        = new Point16(x, y);
            teDisplayDoll.ID                              = TileEntity.AssignNewID();
            teDisplayDoll.type                            = TEDisplayDoll._myEntityID;
            TileEntity.ByID[teDisplayDoll.ID]             = (TileEntity)teDisplayDoll;
            TileEntity.ByPosition[teDisplayDoll.Position] = (TileEntity)teDisplayDoll;
            return(teDisplayDoll.ID);
        }
Пример #4
0
        public static void Framing_CheckTile(int callX, int callY)
        {
            if (WorldGen.destroyObject)
            {
                return;
            }
            int  num1       = callX;
            int  num2       = callY;
            Tile tileSafely = Framing.GetTileSafely(callX, callY);
            int  num3       = num1 - (int)tileSafely.frameX / 18 % 2;
            int  y          = num2 - (int)tileSafely.frameY / 18 % 3;
            bool flag       = false;

            for (int index1 = num3; index1 < num3 + 2; ++index1)
            {
                for (int index2 = y; index2 < y + 3; ++index2)
                {
                    Tile tile = Main.tile[index1, index2];
                    if (!tile.active() || tile.type != (ushort)470)
                    {
                        flag = true;
                    }
                }
            }
            if (!WorldGen.SolidTileAllowBottomSlope(num3, y + 3) || !WorldGen.SolidTileAllowBottomSlope(num3 + 1, y + 3))
            {
                flag = true;
            }
            if (!flag)
            {
                return;
            }
            TEDisplayDoll.Kill(num3, y);
            if ((int)Main.tile[callX, callY].frameX / 72 != 1)
            {
                Item.NewItem(num3 * 16, y * 16, 32, 48, 498, 1, false, 0, false, false);
            }
            else
            {
                Item.NewItem(num3 * 16, y * 16, 32, 48, 1989, 1, false, 0, false, false);
            }
            WorldGen.destroyObject = true;
            for (int i = num3; i < num3 + 2; ++i)
            {
                for (int j = y; j < y + 3; ++j)
                {
                    if (Main.tile[i, j].active() && Main.tile[i, j].type == (ushort)470)
                    {
                        WorldGen.KillTile(i, j, false, false, false);
                    }
                }
            }
            WorldGen.destroyObject = false;
        }
Пример #5
0
        public static bool IsBreakable(int clickX, int clickY)
        {
            int x      = clickX;
            int index1 = clickY;

            if ((int)Main.tile[x, index1].frameX % 36 != 0)
            {
                --x;
            }
            int y      = index1 - (int)Main.tile[x, index1].frameY / 18;
            int index2 = TEDisplayDoll.Find(x, y);

            return(index2 == -1 || !(TileEntity.ByID[index2] as TEDisplayDoll).ContainsItems());
        }
Пример #6
0
 public static int Hook_AfterPlacement(
     int x,
     int y,
     int type      = 470,
     int style     = 0,
     int direction = 1,
     int alternate = 0)
 {
     if (Main.netMode != 1)
     {
         return(TEDisplayDoll.Place(x, y - 2));
     }
     NetMessage.SendTileSquare(Main.myPlayer, x, y - 1, 3, TileChangeType.None);
     NetMessage.SendData(87, -1, -1, (NetworkText)null, x, (float)(y - 2), (float)TEDisplayDoll._myEntityID, 0.0f, 0, 0, 0);
     return(-1);
 }
Пример #7
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 && TEDisplayDoll.FitsDisplayDoll(obj)))
            {
                Main.cursorOverride = 9;
                return(true);
            }
            if (obj.IsAir || context != 23 && context != 24 && context != 25 || !Main.player[Main.myPlayer].ItemSpace(inv[slot]).CanTakeItemToPersonalInventory)
            {
                return(false);
            }
            Main.cursorOverride = 8;
            return(true);
        }
Пример #8
0
        public static void OnPlayerInteraction(Player player, int clickX, int clickY)
        {
            int x     = clickX;
            int index = clickY;

            if ((int)Main.tile[x, index].frameX % 36 != 0)
            {
                --x;
            }
            int y1 = index - (int)Main.tile[x, index].frameY / 18;
            int id = TEDisplayDoll.Find(x, y1);

            if (id == -1)
            {
                return;
            }
            int y2 = y1 + 1;

            TEDisplayDoll.accessoryTargetSlot = 3;
            TileEntity.BasicOpenCloseInteraction(player, x, y2, id);
        }
Пример #9
0
 public override void NetPlaceEntityAttempt(int x, int y)
 {
     NetMessage.SendData(86, -1, -1, (NetworkText)null, TEDisplayDoll.Place(x, y), (float)x, (float)y, 0.0f, 0, 0, 0);
 }