isNumeric() публичный Метод

public isNumeric ( string test ) : bool
test string
Результат bool
Пример #1
0
        void findBlock(string[] args)
        {
            // Attempt on an alternitive block lookup method, for speed's sake..
            functions lookup = new functions();

            if (!lookup.isNumeric(args[2]))
            {
                return;
            }
            if (!lookup.isNumeric(args[3]))
            {
                return;
            }
            if (!lookup.isNumeric(args[4]))
            {
                return;
            }

            int blockX = int.Parse(args[2]);
            int blockY = int.Parse(args[3]);
            int blockZ = int.Parse(args[4]);

            decimal ChunkX = decimal.Divide(blockX, 16);
            decimal ChunkZ = decimal.Divide(blockZ, 16);

            ChunkX = Math.Floor(ChunkX);
            ChunkZ = Math.Floor(ChunkZ);

            Classes.Chunk    thisChunk = null;
            Classes.MapBlock thisblock = null;

            foreach (Classes.Chunk b in Mainform.Chunks)
            {
                if (b.x == ChunkX & b.z == ChunkZ)
                {
                    thisChunk = b;
                    break;
                }
            }

            thisblock = thisChunk.getBlock(blockX, blockY, blockZ);

            if (thisblock != null)
            {
                Packets.chatMessage cm = new Packets.chatMessage(Socket, Mainform, "FOUND IT. " + thisblock.Name, true);
            }
            else
            {
                Packets.chatMessage cm = new Packets.chatMessage(Socket, Mainform, "Fail :(", true);
            }
        }
Пример #2
0
        void dropStack(string[] args)
        {
            functions lookup = new functions();

            Classes.Item thisitem = null;

            if (!lookup.isNumeric(args[2]))
            {
                return;
            }

            foreach (Classes.Item b in Mainform.inventory)
            {
                if (b.slot == (short.Parse(args[2])))
                {
                    thisitem = b;
                    break;
                }
            }

            if (thisitem == null)
            {
                return;
            }

            Packets.ClickWindow click  = new Packets.ClickWindow(Socket, Mainform, short.Parse(args[2]), 0, 0, thisitem);
            Packets.ClickWindow click2 = new Packets.ClickWindow(Socket, Mainform, -999, 0, 0, thisitem); //Slot -999 is outside window click, which drops it.
        }
Пример #3
0
        void placeBlock(string[] args)
        {
            functions lookup = new functions();

            if (!lookup.isNumeric(args[2]))
            {
                return;
            }
            if (!lookup.isNumeric(args[3]))
            {
                return;
            }
            if (!lookup.isNumeric(args[4]))
            {
                return;
            }

            int blockX = int.Parse(args[2]);
            int blockY = int.Parse(args[3]);
            int blockZ = int.Parse(args[4]) - 1; // - 1 corrects some error in sending this packet that results in the Z coord being off.

            int heldSlot = Mainform.selectedSlot + 36;

            Classes.Item heldItem = null;

            foreach (Classes.Item b in Mainform.inventory)
            {
                if (b.slot == heldSlot)
                {
                    heldItem = b;
                    break;
                }
            }

            if (heldItem != null)
            {
                Packets.placeBlock myblock = new Packets.placeBlock(blockX, (byte)blockY, blockZ, 3, heldItem, Socket);
            }
            else
            {
                Packets.chatMessage chat = new Packets.chatMessage(Socket, Mainform, "Not holding anything.", true);
            }
        }
Пример #4
0
        void cselect(string[] args)
        {
            functions lookup = new functions();
            int       blockId;

            if (!lookup.isNumeric(args[2]))
            {
                return;
            }

            blockId = int.Parse(args[2]);

            Packets.creativeInventory ci = new Packets.creativeInventory(Socket, Mainform, 40, new Classes.Item(blockId, 1, 2, 0));
        }
Пример #5
0
        void holdChange(string[] args)
        {
            functions test = new functions();

            if (!test.isNumeric(args[2]))
            {
                return;
            }

            if (short.Parse(args[2]) < 0 || short.Parse(args[2]) > 9)
            {
                return;
            }

            Mainform.selectedSlot = short.Parse(args[2]);
            Packets.HeldItemChange hic = new Packets.HeldItemChange(Socket, Mainform, true);
        }