Exemplo n.º 1
0
        private void CompileMenuItem_Click(object sender, EventArgs e)
        {
            Save();
            Parser    p   = new Parser(CodeView.Text);
            var       ctx = HackContext.GameContext;
            ProjImage img = null;

#if DEBUG
            img = p.Parse();
            img.Emit(ctx, ctx.MyPlayer.X, ctx.MyPlayer.Y);
#else
            try
            {
                LogBox.Text = "";
                OutputLog(DateTime.Now.ToString());
                img = p.Parse();
#if ENG
                OutputLog($"Compilation completed,{img.Projs.Count} projectiles generated");
#else
                OutputLog($"编译成功,生成了{img.Projs.Count}个弹幕");
#endif
                if (ctx != null)
                {
                    img.Emit(ctx, ctx.MyPlayer.X, ctx.MyPlayer.Y);
#if ENG
                    OutputLog($"Projectiles has been emited");
#else
                    OutputLog($"已经发射到游戏");
#endif
                }
                else
                {
#if ENG
                    OutputLog($"Game isn't locked.Failed.");
#else
                    OutputLog($"未锁定游戏进程,发射弹幕失败");
#endif
                }
            }
            catch (ParseException pe)
            {
                /*string[] s = pe.Message.Split(new string[] { "," }, StringSplitOptions.None);
                 * if (s[0] == "un")
                 *      OutputLog($"编译失败,索引为{s[1]}开头的Token类型未知");
                 * else if (s[0] == "ex")
                 *      OutputLog($"编译失败,索引为{s[1]}开头的Token超出预期");
                 * else if (s[0] == "ab")
                 *      OutputLog($"编译失败,名称为{s[2]}的宏不存在");
                 * CodeView.CodeBox.Select(Convert.ToInt32(s[1]), 1);*/
                OutputLog(pe.Message);
                CodeView.CodeBox.Select(pe.Offset, 1);
            }
            OutputLog("\n\n");
#endif
        }
Exemplo n.º 2
0
        public PagePanel_Basic(int Width, int Height) : base(Width, Height)
        {
            FunctionsNumber        = new Dictionary <Control, int>();
            ButtonsPanel           = new Panel();
            ButtonsPanel.Bounds    = new Rectangle(0, 0, 60, Height);
            ButtonsPanel.BackColor = Color.FromArgb(30, 255, 255, 255);
            Controls.Add(ButtonsPanel);

            ContentPanel           = new Panel();
            ContentPanel.Bounds    = new Rectangle(60, 3, Width - 60, Height - 6);
            ContentPanel.BackColor = TextButton.SelectedColor;
            Controls.Add(ContentPanel);

            Page1              = new Panel();
            Page1.Bounds       = new Rectangle(3, 0, Width - 60, Height);
            Page2              = new Panel();
            Page2.Bounds       = new Rectangle(3, 0, Width - 60, Height);
            Page3              = new Panel();
            Page3.Bounds       = new Rectangle(3, 0, Width - 60, Height);
            PageEvent          = new Panel();
            PageEvent.Bounds   = new Rectangle(3, 0, Width - 60, Height);
            PageBuilder        = new Panel();
            PageBuilder.Bounds = new Rectangle(3, 0, Width - 60, Height);
            PageMisc           = new Panel();
            PageMisc.Bounds    = new Rectangle(3, 0, Width - 60, Height);

            AddFunction(Page1, MainForm.CurrentLanguage["InfLife"], "3BD0E7860C0441E2B95E63C3F04B4871", true, Utils.InfiniteLife_E, Utils.InfiniteLife_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfOxygen"], "37EF93BAB687481F87D4D0F95941C781", true, Utils.InfiniteOxygen_E, Utils.InfiniteOxygen_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfMinion"], "D1808E759CBC533C332968E2603376AD", true, Utils.InfiniteMinion_E, Utils.InfiniteMinion_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfMana"], "E8A50F6CC601D8B3977E8E9D4677F6DD", true, Utils.InfiniteMana_E, Utils.InfiniteMana_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfItemAmmo"], "830D900B05074CD0A8DADD1D2EB5F6BC", true, Utils.InfiniteAmmo_E, Utils.InfiniteAmmo_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfFly"], "8669ADD79BBDD647B240409BE2094DDB", true, Utils.InfiniteFly_E, Utils.InfiniteFly_D);
            AddFunction(Page1, MainForm.CurrentLanguage["ImmuneDebuff"], "A339FE530BB6693DCA0ABC020138A880", true, Utils.ImmuneDebuffs_E, Utils.ImmuneDebuffs_D);
            AddFunction(Page1, MainForm.CurrentLanguage["HighLight"], "800DE5238B9475F09B2D49BAD8CF56D6", true, Utils.HighLight_E, Utils.HighLight_D);
            AddFunction(Page1, MainForm.CurrentLanguage["GhostMode"], "BC5F7996B2B89012715CFBCDBF9434CB", true, Utils.GhostMode_E, Utils.GhostMode_D);

            AddFunction(Page2, MainForm.CurrentLanguage["SlowFall"], "84E55372621C1D6FD4389456C0D64C33", true, Utils.LowGravity_E, Utils.LowGravity_D);
            AddFunction(Page2, MainForm.CurrentLanguage["FastSpeed"], "5B9B9517D95F6F86CCE0D6F0CF16EDAA", true, Utils.FastSpeed_E, Utils.FastSpeed_D);
            AddFunction(Page2, MainForm.CurrentLanguage["ProjectileIgnoreTiles"], "9E594D35FA0657AFA83604C40FF88C76", true, Utils.ProjectileIgnoreTile_E, Utils.ProjectileIgnoreTile_D);
            AddFunction(Page2, MainForm.CurrentLanguage["GrabFarAway"], "BDBFD8A007CA446B01FC3D5DA7BA8560", true, Utils.GrabItemFarAway_E, Utils.GrabItemFarAway_D);
            AddFunction(Page2, MainForm.CurrentLanguage["BonusTwoSlots"], "265E7EE043E026964283772D666DD914", true, Utils.BonusTwoSlots_E, Utils.BonusTwoSlots_D);
            AddFunction(Page2, MainForm.CurrentLanguage["GoldHoleDropBags"], "4FB4064F1FEB6E155313756DCBB82203", true, Utils.GoldHoleDropsBag_E, Utils.GoldHoleDropsBag_D);
            AddFunction(Page2, MainForm.CurrentLanguage["SlimeGunBurnNPCS"], "23280EF2B335403BEF698C2F6AB9CB8A", true, Utils.SlimeGunBurn_E, Utils.SlimeGunBurn_D);
            AddFunction(Page2, MainForm.CurrentLanguage["FishOnlyCrates"], "77D322DE31DDE8C328C44A8A7E63AD04", true, Utils.FishOnlyCrates_E, Utils.FishOnlyCrates_D);
            AddFunction(Page2, MainForm.CurrentLanguage["EnableAllRecipes"], "DA840529BCE9704EF4F1BA5CB6C6ECD4", true, Utils.EnableAllRecipes_E, Utils.EnableAllRecipes_D);
            AddFunction(Page2, MainForm.CurrentLanguage["StengthenedVampireKnives"], "418C48524EA50ECC6717C5D629AF7B32", true, Utils.StrengthenVampireKnives_E, Utils.StrengthenVampireKnives_D);
            AddFunction(Page2, MainForm.CurrentLanguage["SwingIgnoringTiles"], "4B246B44592B441C9DC23E9EBC077A98", true, Utils.SwingIgnoringTils_E, Utils.SwingIgnoringTils_D);
            AddFunction(Page2, MainForm.CurrentLanguage["SwingingAttacksAll"], "1D2F13AE9E084743898A11EE64D744D2", true, Utils.SwingingAttacksAll_E, Utils.SwingingAttacksAll_D);

            AddFunction(Page3, MainForm.CurrentLanguage["BurnAllNPCS"], "9A3F870D0DDB5B46F6E1B1266D6882AD", false,
                        g =>
            {
                int i = 0;
                PopupProgressBar p        = new PopupProgressBar();
                p.MainProgressBar.Maximum = NPC.MAXNUMBER;
                System.Timers.Timer timer = new System.Timers.Timer(1);
                timer.Elapsed            += (sender, e) =>
                {
                    var b   = p.MainProgressBar;
                    b.Value = i;
                    b.Invalidate();
                    b.Text = b.Value + "/" + b.Maximum;
                    if (i >= b.Maximum)
                    {
                        p.Dispose();
                    }
                };
                timer.Start();
                p.Show();
                p.Location = new Point(MainForm.MainFormInstance.Location.X + MainForm.MainFormInstance.Width / 2 - p.ClientSize.Width / 2, MainForm.MainFormInstance.Location.Y + MainForm.MainFormInstance.Height / 2 - p.ClientSize.Height / 2);
                new Thread(() =>
                {
                    MainForm.MainFormInstance.Enabled = false;
                    var npc = HackContext.GameContext.NPC;
                    for (; i < NPC.MAXNUMBER; i++)
                    {
                        if (npc[i].Active)
                        {
                            npc[i].AddBuff(153, 216000);
                        }
                    }
                    MainForm.MainFormInstance.Enabled = true;
                }).Start();
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["BurnAllPlayers"], "37EF93BAB687481F87D4D0F95941C781", false,
                        g =>
            {
                int i = 0;
                PopupProgressBar p        = new PopupProgressBar();
                p.MainProgressBar.Maximum = Player.MAXNUMBER;
                System.Timers.Timer timer = new System.Timers.Timer(1);
                timer.Elapsed            += (sender, e) =>
                {
                    var b   = p.MainProgressBar;
                    b.Value = i;
                    b.Invalidate();
                    b.Text = b.Value + "/" + b.Maximum;
                    if (i >= b.Maximum)
                    {
                        p.Dispose();
                    }
                };
                timer.Start();
                p.Show();
                p.Location = new Point(MainForm.MainFormInstance.Location.X + MainForm.MainFormInstance.Width / 2 - p.ClientSize.Width / 2, MainForm.MainFormInstance.Location.Y + MainForm.MainFormInstance.Height / 2 - p.ClientSize.Height / 2);
                new Thread(() =>
                {
                    MainForm.MainFormInstance.Enabled = false;
                    var player = HackContext.GameContext.Players;
                    for (; i < Player.MAX_PLAYER; i++)
                    {
                        if (player[i].Active)
                        {
                            player[i].AddBuff(44, 216000);
                        }
                    }
                    MainForm.MainFormInstance.Enabled = true;
                }).Start();
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["PourLavaOntoPlayers"], "D1808E759CBC533C332968E2603376AD", false, Utils.DropLavaOntoPlayers, null);
            FunctionButton _b = null;

            _b = AddFunction(Page3, MainForm.CurrentLanguage["RandomUUID"], "E8A50F6CC601D8B3977E8E9D4677F6DD", false,
                             g =>
            {
                HackContext.GameContext.UUID = Guid.NewGuid().ToString();
                _b.Text = HackContext.GameContext.UUID;
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["ExploreWholeWorld"], "830D900B05074CD0A8DADD1D2EB5F6BC", false, Utils.RevealMap, null);
            AddFunction(Page3, MainForm.CurrentLanguage["RightClickToTP"], "8669ADD79BBDD647B240409BE2094DDB", false, Utils.RightClickToTP, null);
            AddFunction(Page3, MainForm.CurrentLanguage["ProjectilePuzzle"], "A339FE530BB6693DCA0ABC020138A880", false,
                        g =>
            {
                OpenFileDialog ofd = new OpenFileDialog();

                ofd.Filter = "png files (*.png)|*.png";
                if (ofd.ShowDialog(this) == DialogResult.OK)
                {
                    var ctx       = HackContext.GameContext;
                    var config    = (MainForm.Configs["CFG_ProjDrawer"] as CFG_ProjDrawer);
                    ProjImage img = ProjImage.FromImage(ofd.FileName, config.ProjType, config.Resolution);
                    this.Enabled  = false;
                    img.Emit(ctx, new MPointF(ctx.MyPlayer.X, ctx.MyPlayer.Y));
                    this.Enabled = true;
                }
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["RainbowTexting"], "89494BDF0C804010910932F71E5EC75E", false,
                        g =>
            {
                MForm Form = new MForm
                {
                    BackColor     = Color.FromArgb(90, 90, 90),
                    Text          = MainForm.CurrentLanguage["RainbowTexting"],
                    StartPosition = FormStartPosition.CenterParent,
                    ClientSize    = new Size(245, 72)
                };

                CheckBox ReloadAllFonts = new CheckBox()
                {
                    Text     = MainForm.CurrentLanguage["ReloadFonts"],
                    Location = new Point(10, 0),
                    Size     = new Size(200, 20),
                };
                Form.MainPanel.Controls.Add(ReloadAllFonts);

                Label Tip = new Label()
                {
                    Text      = MainForm.CurrentLanguage["Text"] + ":",
                    Location  = new Point(0, 20),
                    Size      = new Size(80, 20),
                    TextAlign = ContentAlignment.MiddleCenter
                };
                Form.MainPanel.Controls.Add(Tip);

                TextBox Box = new TextBox
                {
                    BorderStyle = BorderStyle.FixedSingle,
                    BackColor   = Color.FromArgb(120, 120, 120),
                    Text        = "",
                    Location    = new Point(85, 20),
                    Size        = new Size(95, 20),
                    ImeMode     = ImeMode.On
                };
                Form.MainPanel.Controls.Add(Box);

                Button ConfirmButton    = new Button();
                ConfirmButton.Text      = MainForm.CurrentLanguage["Confirm"];
                ConfirmButton.FlatStyle = FlatStyle.Flat;
                ConfirmButton.Size      = new Size(65, 20);
                ConfirmButton.Location  = new Point(180, 20);
                ConfirmButton.Click    += (s1, e1) =>
                {
                    if (HackContext.Characters == null)
                    {
                        HackContext.Characters = new Dictionary <char, ProjImage>();
                        HackContext.LoadRainbowFonts(HackContext.Characters);
                    }
                    if (ReloadAllFonts.Checked)
                    {
                        HackContext.Characters.Clear();
                        HackContext.LoadRainbowFonts(HackContext.Characters);
                    }
                    RainbowTextDrawer rtd = new RainbowTextDrawer(HackContext.Characters);
                    rtd.DrawString(Box.Text, center: new MPointF());
                    var ctx    = HackContext.GameContext;
                    var player = ctx.MyPlayer;
                    rtd.Emit(ctx, new MPointF(player.X, player.Y));
                    Form.Dispose();
                };
                Form.MainPanel.Controls.Add(ConfirmButton);
                Form.Activated += (s, e) =>
                {
                    Box.Focus();
                };
                Form.ShowDialog(this);
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["CoronaVirus"], "7FF4CE10ED9B4924BA63F92E2443C79A", false,
                        g =>
            {
                var player = g.MyPlayer;
                for (int i = 0; i < 3; i++)
                {
                    NPC.NewNPC(g, Convert.ToInt32(player.X), Convert.ToInt32(player.Y) - 2, 51);
                }
                player.AddBuff(44, 600, true);
                player.AddBuff(153, 600, true);
                player.AddBuff(67, 600, true);
                player.AddBuff(24, 600, true);
            }, null);
            //AddFunction(Page3, MainForm.CurrentLanguage["HarpLeftClickTP"], "800DE5238B9475F09B2D49BAD8CF56D6", true, Utils.HarpToTP_E, Utils.HarpToTP_D);

            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleDayNight"], "E6F33D980A95291E6D0C0033F39E6629", false, g => g.DayTime        = !g.DayTime, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleSunDial"], "6FFF093BA44EEFD41C9E3585FA18EBBA", false, g => g.FastForwardTime = !g.FastForwardTime, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleBloodMoon"], "C8DE8467590D278A312E9C5A0A63DF84", false, g => g.BloodMoon     = !g.BloodMoon, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleEclipse"], "DA4EFFA8EAC423555CF33536D6851570", false, g => g.Eclipse         = !g.Eclipse, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleSnowMoon"], "A74C10BB62FE043E1924AB2267570C42", false, g => g.SnowMoon       = !g.SnowMoon, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["TogglePumpkinMoon"], "192BB3BD522421DC4AC18EC61800EE04", false, g => g.PumpkinMoon = !g.PumpkinMoon, null);

            AddFunction(PageBuilder, MainForm.CurrentLanguage["SuperRange"], "2045F3ED1E8276545D86390FFFA9B02E", true, Utils.SuperRange_E, Utils.SuperRange_D);
            AddFunction(PageBuilder, MainForm.CurrentLanguage["FastTilingAndWallingSpeed"], "B5892B95C1D1C38DA5E8E0499E34235D", true, Utils.FastTileAndWallSpeed_E, Utils.FastTileAndWallSpeed_D);
            AddFunction(PageBuilder, MainForm.CurrentLanguage["MechanicalRulerEffect"], "B84EB7D6788F944E81654735A22DB528", true, Utils.MachinicalRulerEffect_E, Utils.MachinicalRulerEffect_D);
            AddFunction(PageBuilder, MainForm.CurrentLanguage["MechanicalGlassesEffect"], "62DC9F0484D233B9FB54A6BF15521354", true, Utils.ShowCircuit_E, Utils.ShowCircuit_D);

            AddFunction(PageMisc, MainForm.CurrentLanguage["ShadowDodge"], "4C930E9DB193D5E61AFEDB24E8D5392E", true, Utils.ShadowDodge_E, Utils.ShadowDodge_D);
            AddFunction(PageMisc, MainForm.CurrentLanguage["ShowInvisiblePlayers"], "1EE572824476A3BBB1AA367E70BFF790", true, Utils.ShowInvisiblePlayers_E, Utils.ShowInvisiblePlayers_D);

            AddTab(MainForm.CurrentLanguage["Basic_1"], Page1).Selected = true;
            AddTab(MainForm.CurrentLanguage["Basic_2"], Page2);
            AddTab(MainForm.CurrentLanguage["Advanced"], Page3);
            AddTab(MainForm.CurrentLanguage["Event"], PageEvent);
            AddTab(MainForm.CurrentLanguage["Builder"], PageBuilder);
            AddTab(MainForm.CurrentLanguage["Miscs"], PageMisc);
        }
Exemplo n.º 3
0
        public PagePanel_Basic(int Width, int Height) : base(Width, Height)
        {
            FunctionsNumber        = new Dictionary <Control, int>();
            ButtonsPanel           = new Panel();
            ButtonsPanel.Bounds    = new Rectangle(0, 0, 60, Height);
            ButtonsPanel.BackColor = Color.FromArgb(30, 255, 255, 255);
            Controls.Add(ButtonsPanel);

            ContentPanel           = new Panel();
            ContentPanel.Bounds    = new Rectangle(60, 3, Width - 60, Height - 6);
            ContentPanel.BackColor = TextButton.SelectedColor;
            Controls.Add(ContentPanel);

            Page1              = new Panel();
            Page1.Bounds       = new Rectangle(3, 0, Width - 60, Height);
            Page2              = new Panel();
            Page2.Bounds       = new Rectangle(3, 0, Width - 60, Height);
            Page3              = new Panel();
            Page3.Bounds       = new Rectangle(3, 0, Width - 60, Height);
            PageEvent          = new Panel();
            PageEvent.Bounds   = new Rectangle(3, 0, Width - 60, Height);
            PageBuilder        = new Panel();
            PageBuilder.Bounds = new Rectangle(3, 0, Width - 60, Height);
            PageMisc           = new Panel();
            PageMisc.Bounds    = new Rectangle(3, 0, Width - 60, Height);

            AddFunction(Page1, MainForm.CurrentLanguage["InfLife"], "3BD0E7860C0441E2B95E63C3F04B4871", true, Utils.InfiniteLife_E, Utils.InfiniteLife_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfOxygen"], "37EF93BAB687481F87D4D0F95941C781", true, Utils.InfiniteOxygen_E, Utils.InfiniteOxygen_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfMinion"], "D1808E759CBC533C332968E2603376AD", true, Utils.InfiniteMinion_E, Utils.InfiniteMinion_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfMana"], "E8A50F6CC601D8B3977E8E9D4677F6DD", true, Utils.InfiniteMana_E, Utils.InfiniteMana_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfItemAmmo"], "830D900B05074CD0A8DADD1D2EB5F6BC", true, Utils.InfiniteAmmo_E, Utils.InfiniteAmmo_D);
            AddFunction(Page1, MainForm.CurrentLanguage["InfFly"], "8669ADD79BBDD647B240409BE2094DDB", true, Utils.InfiniteFly_E, Utils.InfiniteFly_D);
            AddFunction(Page1, MainForm.CurrentLanguage["ImmuneDebuff"], "A339FE530BB6693DCA0ABC020138A880", true, Utils.ImmuneDebuffs_E, Utils.ImmuneDebuffs_D);
            AddFunction(Page1, MainForm.CurrentLanguage["HighLight"], "800DE5238B9475F09B2D49BAD8CF56D6", true, Utils.HighLight_E, Utils.HighLight_D);
            AddFunction(Page1, MainForm.CurrentLanguage["GhostMode"], "BC5F7996B2B89012715CFBCDBF9434CB", true, Utils.GhostMode_E, Utils.GhostMode_D);

            AddFunction(Page2, MainForm.CurrentLanguage["SlowFall"], "84E55372621C1D6FD4389456C0D64C33", true, Utils.LowGravity_E, Utils.LowGravity_D);
            AddFunction(Page2, MainForm.CurrentLanguage["FastSpeed"], "5B9B9517D95F6F86CCE0D6F0CF16EDAA", true, Utils.FastSpeed_E, Utils.FastSpeed_D);
            AddFunction(Page2, MainForm.CurrentLanguage["ProjectileIgnoreTiles"], "9E594D35FA0657AFA83604C40FF88C76", true, Utils.ProjectileIgnoreTile_E, Utils.ProjectileIgnoreTile_D);
            AddFunction(Page2, MainForm.CurrentLanguage["GrabFarAway"], "BDBFD8A007CA446B01FC3D5DA7BA8560", true, Utils.GrabItemFarAway_E, Utils.GrabItemFarAway_D);
            AddFunction(Page2, MainForm.CurrentLanguage["BonusTwoSlots"], "265E7EE043E026964283772D666DD914", true, Utils.BonusTwoSlots_E, Utils.BonusTwoSlots_D);
            AddFunction(Page2, MainForm.CurrentLanguage["GoldHoleDropBags"], "4FB4064F1FEB6E155313756DCBB82203", true, Utils.GoldHoleDropsBag_E, Utils.GoldHoleDropsBag_D);
            AddFunction(Page2, MainForm.CurrentLanguage["SlimeGunBurnNPCS"], "23280EF2B335403BEF698C2F6AB9CB8A", true, Utils.SlimeGunBurn_E, Utils.SlimeGunBurn_D);
            AddFunction(Page2, MainForm.CurrentLanguage["FishOnlyCrates"], "77D322DE31DDE8C328C44A8A7E63AD04", true, Utils.FishOnlyCrates_E, Utils.FishOnlyCrates_D);
            AddFunction(Page2, MainForm.CurrentLanguage["EnableAllRecipes"], "DA840529BCE9704EF4F1BA5CB6C6ECD4", true, Utils.EnableAllRecipes_E, Utils.EnableAllRecipes_D);
            AddFunction(Page2, MainForm.CurrentLanguage["StengthenedVampireKnives"], "418C48524EA50ECC6717C5D629AF7B32", true, Utils.StrengthenVampireKnives_E, Utils.StrengthenVampireKnives_D);

            AddFunction(Page3, MainForm.CurrentLanguage["BurnAllNPCS"], "9A3F870D0DDB5B46F6E1B1266D6882AD", false,
                        g =>
            {
                int i = 0;
                PopupProgressBar p        = new PopupProgressBar();
                p.MainProgressBar.Maximum = NPC.MAXNUMBER;
                System.Timers.Timer timer = new System.Timers.Timer(1);
                timer.Elapsed            += (sender, e) =>
                {
                    var b   = p.MainProgressBar;
                    b.Value = i;
                    b.Invalidate();
                    b.Text = b.Value + "/" + b.Maximum;
                    if (i >= b.Maximum)
                    {
                        p.Dispose();
                    }
                };
                timer.Start();
                p.Show();
                p.Location = new Point(MainForm.MainFormInstance.Location.X + MainForm.MainFormInstance.Width / 2 - p.ClientSize.Width / 2, MainForm.MainFormInstance.Location.Y + MainForm.MainFormInstance.Height / 2 - p.ClientSize.Height / 2);
                new Thread(() =>
                {
                    MainForm.MainFormInstance.Enabled = false;
                    var npc = HackContext.GameContext.NPC;
                    for (; i < NPC.MAXNUMBER; i++)
                    {
                        if (npc[i].Active)
                        {
                            npc[i].AddBuff(0x99, 216000);
                        }
                    }
                    MainForm.MainFormInstance.Enabled = true;
                }).Start();
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["BurnAllPlayers"], "37EF93BAB687481F87D4D0F95941C781", false,
                        g =>
            {
                int i = 0;
                PopupProgressBar p        = new PopupProgressBar();
                p.MainProgressBar.Maximum = NPC.MAXNUMBER;
                System.Timers.Timer timer = new System.Timers.Timer(1);
                timer.Elapsed            += (sender, e) =>
                {
                    var b   = p.MainProgressBar;
                    b.Value = i;
                    b.Invalidate();
                    b.Text = b.Value + "/" + b.Maximum;
                    if (i >= b.Maximum)
                    {
                        p.Dispose();
                    }
                };
                timer.Start();
                p.Show();
                p.Location = new Point(MainForm.MainFormInstance.Location.X + MainForm.MainFormInstance.Width / 2 - p.ClientSize.Width / 2, MainForm.MainFormInstance.Location.Y + MainForm.MainFormInstance.Height / 2 - p.ClientSize.Height / 2);
                new Thread(() =>
                {
                    MainForm.MainFormInstance.Enabled = false;
                    var player = HackContext.GameContext.Players;
                    for (; i < Player.MAX_PLAYER; i++)
                    {
                        if (player[i].Active)
                        {
                            player[i].AddBuff(44, 216000);
                        }
                    }
                    MainForm.MainFormInstance.Enabled = true;
                }).Start();
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["PourLavaOntoPlayers"], "D1808E759CBC533C332968E2603376AD", false, Utils.DropLavaOntoPlayers, null);
            FunctionButton _b = null;

            _b = AddFunction(Page3, MainForm.CurrentLanguage["RandomUUID"], "E8A50F6CC601D8B3977E8E9D4677F6DD", false,
                             g =>
            {
                HackContext.GameContext.UUID = Guid.NewGuid().ToString();
                _b.Text = HackContext.GameContext.UUID;
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["ExploreWholeWorld"], "830D900B05074CD0A8DADD1D2EB5F6BC", false, Utils.RevealMap, null);
            AddFunction(Page3, MainForm.CurrentLanguage["RightClickToTP"], "8669ADD79BBDD647B240409BE2094DDB", false, Utils.RightClickToTP, null);
            AddFunction(Page3, MainForm.CurrentLanguage["ProjectilePuzzle"], "A339FE530BB6693DCA0ABC020138A880", false,
                        g =>
            {
                OpenFileDialog ofd = new OpenFileDialog();

                ofd.Filter = "png files (*.png)|*.png";
                if (ofd.ShowDialog(this) == DialogResult.OK)
                {
                    var ctx       = HackContext.GameContext;
                    ProjImage img = ProjImage.FromImage(ofd.FileName, MainForm.Config_ProjDrawer.ProjType, MainForm.Config_ProjDrawer.Resolution);
                    this.Enabled  = false;
                    img.Emit(ctx, ctx.MyPlayer.X, ctx.MyPlayer.Y);
                    this.Enabled = true;
                }
            }, null);
            AddFunction(Page3, MainForm.CurrentLanguage["HarpLeftClickTP"], "800DE5238B9475F09B2D49BAD8CF56D6", true, Utils.HarpToTP_E, Utils.HarpToTP_D);

            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleDayNight"], "E6F33D980A95291E6D0C0033F39E6629", false, g => g.DayTime        = !g.DayTime, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleSunDial"], "6FFF093BA44EEFD41C9E3585FA18EBBA", false, g => g.FastForwardTime = !g.FastForwardTime, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleBloodMoon"], "C8DE8467590D278A312E9C5A0A63DF84", false, g => g.BloodMoon     = !g.BloodMoon, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleEclipse"], "DA4EFFA8EAC423555CF33536D6851570", false, g => g.Eclipse         = !g.Eclipse, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["ToggleSnowMoon"], "A74C10BB62FE043E1924AB2267570C42", false, g => g.SnowMoon       = !g.SnowMoon, null);
            AddFunction(PageEvent, MainForm.CurrentLanguage["TogglePumpkinMoon"], "192BB3BD522421DC4AC18EC61800EE04", false, g => g.PumpkinMoon = !g.PumpkinMoon, null);

            AddFunction(PageBuilder, MainForm.CurrentLanguage["SuperRange"], "2045F3ED1E8276545D86390FFFA9B02E", true, Utils.SuperRange_E, Utils.SuperRange_D);
            AddFunction(PageBuilder, MainForm.CurrentLanguage["FastTileSpeed"], "B5892B95C1D1C38DA5E8E0499E34235D", true, Utils.FastTileSpeed_E, Utils.FastTileSpeed_D);
            AddFunction(PageBuilder, MainForm.CurrentLanguage["RulerEffect"], "6FFA25DEFAFB8DD7EE02BC7179509859", true, Utils.RulerEffect_E, Utils.RulerEffect_D);
            AddFunction(PageBuilder, MainForm.CurrentLanguage["MechanicalRulerEffect"], "B84EB7D6788F944E81654735A22DB528", true, Utils.MachinicalRulerEffect_E, Utils.MachinicalRulerEffect_D);
            AddFunction(PageBuilder, MainForm.CurrentLanguage["MechanicalGlassesEffect"], "62DC9F0484D233B9FB54A6BF15521354", true, Utils.ShowCircuit_E, Utils.ShowCircuit_D);

            AddFunction(PageMisc, MainForm.CurrentLanguage["ShadowDodge"], "4C930E9DB193D5E61AFEDB24E8D5392E", true, Utils.ShadowDodge_E, Utils.ShadowDodge_D);
            AddFunction(PageMisc, MainForm.CurrentLanguage["ShowInvisiblePlayers"], "1EE572824476A3BBB1AA367E70BFF790", true, Utils.ShowInvisiblePlayers_E, Utils.ShowInvisiblePlayers_D);

            AddTab(MainForm.CurrentLanguage["Basic_1"], Page1).Selected = true;
            AddTab(MainForm.CurrentLanguage["Basic_2"], Page2);
            AddTab(MainForm.CurrentLanguage["Advanced"], Page3);
            AddTab(MainForm.CurrentLanguage["Event"], PageEvent);
            AddTab(MainForm.CurrentLanguage["Builder"], PageBuilder);
            AddTab(MainForm.CurrentLanguage["Miscs"], PageMisc);
        }
Exemplo n.º 4
0
        public void InitControls()
        {
            MemoryStream ms = new MemoryStream(resource.ItemImage);
            BinaryReader br = new BinaryReader(ms);

            while (true)
            {
                if (br.PeekChar() == -1)
                {
                    break;
                }
                string       name   = br.ReadString();
                long         length = br.ReadInt64();
                byte[]       data   = br.ReadBytes((int)length);
                MemoryStream imgms  = new MemoryStream(data);
                Image        img    = Image.FromStream(imgms);
                item_images.Images.Add(name, img);
            }
            br.Close();
            ms.Close();
            item_images.ColorDepth = ColorDepth.Depth32Bit;
            item_images.ImageSize  = new Size(20, 20);

            {
                var none = item_images.Images[0];                //just to load all images
            }

            status = new Label()
            {
                Text     = Lang.none,
                Location = new Point(0, 50),
                Size     = new Size(140, 25),
                Font     = new Font("Arial", 10)
            };
            this.Controls.Add(status);

#if ENG
#else
            UpdateTool = new Button()
            {
                Location = new Point(150, 50),
                Size     = new Size(50, 25),
                Text     = "更新"
            };
            UpdateTool.Click += delegate(object sender, EventArgs e)
            {
                System.Diagnostics.Process.Start(Path.GetFullPath("./VersionManager.exe"));
                Environment.Exit(0);
            };
            this.Controls.Add(UpdateTool);
#endif

            Extra = new Button()
            {
                Location = new Point(250, 50),
                Size     = new Size(50, 25),
                Text     = Lang.extra
            };
            Extra.Click += delegate(object sender, EventArgs e)
            {
                if (ExtraHack == null)
                {
                    if (!CanHack)
                    {
                        MessageBox.Show(Lang.nonePlayerBase);
                        return;
                    }
                    ExtraHack = new ExtForm(Context);
                    ExtraHack.Show(this);
                    ExtraHack.Location = new Point(Location.X + Width, Location.Y);
                    Extra.Font         = new Font("Arial", 10, FontStyle.Bold);
                }
                else
                {
                    ExtraHack.Dispose();
                    ExtraHack  = null;
                    Extra.Font = new Font("Arial", 10);
                }
            };
            this.Controls.Add(Extra);

            Script = new Button()
            {
                Location = new Point(200, 50),
                Size     = new Size(50, 25),
                Text     = Lang.script
            };
            Script.Click += delegate(object sender, EventArgs e)
            {
                if (ScriptForm == null)
                {
                    ScriptForm = new ScriptForm(Context);
                    ScriptForm.Show(this);
                    Script.Font = new Font("Arial", 10, FontStyle.Bold);
                }
                else
                {
                    if (ScriptForm.Visible)
                    {
                        ScriptForm.Visible = false;
                        Script.Font        = new Font("Arial", 10);
                    }
                    else
                    {
                        ScriptForm.Visible = true;
                        Script.Font        = new Font("Arial", 10, FontStyle.Bold);
                    }
                }
            };
            this.Controls.Add(Script);



            mainTab = new MTabControl()
            {
                Location      = new Point(0, 75),
                Size          = new Size(300, 500 - 105),
                SelectedIndex = 0
            };
            buttonTabPage1 = RegisterTab("1");

            buttonTabPage2 = RegisterTab("2");

            buttonTabPage6 = RegisterTab("3");

            buttonTabPage3 = RegisterTab(Lang.Event);

            buttonTabPage4 = RegisterTab(Lang.builder);

            buttonTabPage5 = RegisterTab(Lang.eff);


            this.Controls.Add(mainTab);



            AddButton(buttonTabPage1, Lang.infLife, 0, Utils.InfiniteLife_E, Utils.InfiniteLife_D);
            AddButton(buttonTabPage1, Lang.infOxygen, 1, Utils.InfiniteOxygen_E, Utils.InfiniteOxygen_D);
            AddButton(buttonTabPage1, Lang.infSummon, 2, Utils.InfiniteMinion_E, Utils.InfiniteMinion_D);
            AddButton(buttonTabPage1, Lang.infMana, 3, Utils.InfiniteMana_E, Utils.InfiniteMana_D);
            AddButton(buttonTabPage1, Lang.infItemAndAmmo, 4, (ctx) => { Utils.InfiniteItem_E(ctx); Utils.InfiniteAmmo_E(ctx); }, (ctx) => { Utils.InfiniteItem_D(ctx); Utils.InfiniteAmmo_D(ctx); });
            AddButton(buttonTabPage1, Lang.infFly, 5, Utils.InfiniteFly_E, Utils.InfiniteFly_D);
            AddButton(buttonTabPage1, Lang.immuneStoned, 6, Utils.ImmuneDebuffs_E, Utils.ImmuneDebuffs_D, true);
            AddButton(buttonTabPage1, Lang.highLight, 7, Utils.HighLight_E, Utils.HighLight_D);
            AddButton(buttonTabPage1, Lang.ghostMode, 8, Utils.GhostMode_E, Utils.GhostMode_D);

            /*AddButton(buttonTabPage1, Lang.respawnAtOnce, 9, HackFunctions.NoRespawnTime, HackFunctions.De_NoRespawnTime);
             * AddButton(buttonTabPage1, Lang.attackThroughWalls, 10, HackFunctions.AttackThroughWalls, HackFunctions.De_AttackThroughWalls);
             * AddButton(buttonTabPage1, Lang.noPotionDelay, 11, HackFunctions.NoPotionDelay, HackFunctions.De_NoPotionDelay);*/

            AddButton(buttonTabPage2, Lang.decreaseGravity, 0, Utils.LowGravity_E, Utils.LowGravity_D);
            AddButton(buttonTabPage2, Lang.increaseSpeed, 1, Utils.FastSpeed_E, Utils.FastSpeed_D);
            //AddButton(buttonTabPage2, Lang.killAllNPC, 2, HackFunctions.KillAllNPC, HackFunctions.De_KillAllNPC);
            AddButton(buttonTabPage2, Lang.projectileThroughWalls, 3, Utils.ProjectileIgnoreTile_E, Utils.ProjectileIgnoreTile_D);
            AddButton(buttonTabPage2, Lang.superPick, 4, Utils.GrabItemFarAway_E, Utils.GrabItemFarAway_D);
            AddButton(buttonTabPage2, Lang.extraTwoSlots, 5, Utils.BonusTwoSlots_E, Utils.BonusTwoSlots_D);
            AddButton(buttonTabPage2, Lang.goldHoleDropBag, 6, Utils.GoldHoleDropsBag_E, Utils.GoldHoleDropsBag_D);
            AddButton(buttonTabPage2, Lang.slimeGunBurn, 7, Utils.SlimeGunBurn_E, Utils.SlimeGunBurn_D);
            AddButton(buttonTabPage2, Lang.fishOnlyCrates, 8, Utils.FishOnlyCrates_E, Utils.FishOnlyCrates_D);
            //AddButton(buttonTabPage2, Lang.killAllScreen, 9, HackFunctions.KillAllScreen, HackFunctions.De_KillAllScreen);
            AddButton(buttonTabPage2, Lang.allRecipe, 10, Utils.EnableAllRecipes_E, Utils.EnableAllRecipes_D);
            AddButton(buttonTabPage2, Lang.strengthen_Vampire_Knives, 11, Utils.StrengthenVampireKnives_E, Utils.StrengthenVampireKnives_D);


            //AddButton(buttonTabPage6, Lang.blockAttacking, 0, HackFunctions.BlockAttacking, HackFunctions.De_BlockAttacking, true);
            AddButton(buttonTabPage6, Lang.burnAllNPC, 1, (Context) =>
            {
                int i                     = 0;
                Form p                    = new Form();
                ProgressBar pb            = new ProgressBar();
                Label tip                 = new Label(), percent = new Label();
                tip.Text                  = "Burning NPCS...";
                tip.Location              = new Point(0, 0);
                tip.Size                  = new Size(150, 30);
                tip.TextAlign             = ContentAlignment.MiddleCenter;
                percent.Location          = new Point(150, 0);
                percent.Size              = new Size(50, 30);
                percent.TextAlign         = ContentAlignment.MiddleCenter;
                System.Timers.Timer timer = new System.Timers.Timer(1);
                p.FormBorderStyle         = FormBorderStyle.FixedSingle;
                p.ClientSize              = new Size(300, 60);
                p.ControlBox              = false;
                pb.Location               = new Point(0, 30);
                pb.Size                   = new Size(300, 30);
                pb.Maximum                = NPC.MAXNUMBER;
                pb.Minimum                = 0;
                pb.Value                  = 0;
                p.Controls.Add(tip);
                p.Controls.Add(percent);
                p.Controls.Add(pb);
                timer.Elapsed += (sender, e) =>
                {
                    pb.Value     = i;
                    percent.Text = pb.Value + "/" + pb.Maximum;
                    if (i >= pb.Maximum)
                    {
                        p.Dispose();
                    }
                };
                timer.Start();
                p.Show();
                p.Location = new Point(MainForm.mainWindow.Location.X + MainForm.mainWindow.Width / 2 - p.ClientSize.Width / 2, MainForm.mainWindow.Location.Y + MainForm.mainWindow.Height / 2 - p.ClientSize.Height / 2);
                new Thread(() =>
                {
                    this.Enabled = false;
                    if (ExtForm.Window != null)
                    {
                        ExtForm.Window.Enabled = false;
                    }
                    var npc = Context.NPC;
                    for (; i < NPC.MAXNUMBER; i++)
                    {
                        if (npc[i].Active)
                        {
                            npc[i].AddBuff(0x99, 216000);
                        }
                    }
                    if (ExtForm.Window != null)
                    {
                        ExtForm.Window.Enabled = true;
                    }
                    this.Enabled = true;
                }).Start();
            }, null, false);
            AddButton(buttonTabPage6, Lang.burnAllPlayer, 2, (Context) =>
            {
                int i                     = 0;
                Form p                    = new Form();
                ProgressBar pb            = new ProgressBar();
                Label tip                 = new Label(), percent = new Label();
                tip.Text                  = "Burning Players...";
                tip.Location              = new Point(0, 0);
                tip.Size                  = new Size(150, 30);
                tip.TextAlign             = ContentAlignment.MiddleCenter;
                percent.Location          = new Point(150, 0);
                percent.Size              = new Size(50, 30);
                percent.TextAlign         = ContentAlignment.MiddleCenter;
                System.Timers.Timer timer = new System.Timers.Timer(1);
                p.FormBorderStyle         = FormBorderStyle.FixedSingle;
                p.ClientSize              = new Size(300, 60);
                p.ControlBox              = false;
                pb.Location               = new Point(0, 30);
                pb.Size                   = new Size(300, 30);
                pb.Maximum                = NPC.MAXNUMBER;
                pb.Minimum                = 0;
                pb.Value                  = 0;
                p.Controls.Add(tip);
                p.Controls.Add(percent);
                p.Controls.Add(pb);
                timer.Elapsed += (sender, e) =>
                {
                    pb.Value     = i;
                    percent.Text = pb.Value + "/" + pb.Maximum;
                    if (i >= pb.Maximum)
                    {
                        p.Dispose();
                    }
                };
                timer.Start();
                p.Show();
                p.Location = new Point(MainForm.mainWindow.Location.X + MainForm.mainWindow.Width / 2 - p.ClientSize.Width / 2, MainForm.mainWindow.Location.Y + MainForm.mainWindow.Height / 2 - p.ClientSize.Height / 2);
                new Thread(() =>
                {
                    this.Enabled = false;
                    if (ExtForm.Window != null)
                    {
                        ExtForm.Window.Enabled = false;
                    }
                    var player = Context.Players;
                    for (; i < Player.MAX_PLAYER; i++)
                    {
                        if (player[i].Active)
                        {
                            player[i].AddBuff(44, 216000);
                        }
                    }
                    if (ExtForm.Window != null)
                    {
                        ExtForm.Window.Enabled = true;
                    }
                    this.Enabled = true;
                }).Start();
            }, null, false);
            AddButton(buttonTabPage6, Lang.dropLava, 3, Utils.DropLavaOntoPlayers, null, false);
            Button u = null;
            u = AddButton(buttonTabPage6, Lang.randomUUID, 4, (Context) =>
            {
                Context.UUID = Guid.NewGuid().ToString();
                u.Text       = Lang.randomUUID + ":" + Context.UUID;
            }, null, false);
            u.Font = new Font("SimSun", 8);
            AddButton(buttonTabPage6, Lang.exploreAll, 5, Utils.RevealMap, null, false);
            AddButton(buttonTabPage6, Lang.rightClickToTP, 6, Utils.RightClickToTP, null, false);
            AddButton(buttonTabPage6, Lang.drawProjs, 7, (ctx) =>
            {
                OpenFileDialog ofd = new OpenFileDialog();

                ofd.Filter = "png files (*.png)|*.png";
                if (ofd.ShowDialog(this) == DialogResult.OK)
                {
                    ProjImage img = ProjImage.FromImage(ofd.FileName, Config_ProjDrawer.ProjType, Config_ProjDrawer.Resolution);
                    this.Enabled  = false;
                    img.Emit(ctx, ctx.MyPlayer.X, ctx.MyPlayer.Y);
                    this.Enabled = true;
                }
            }, null, false);
            AddButton(buttonTabPage6, Lang.harpTP, 8, Utils.HarpToTP_E, Utils.HarpToTP_D, true);



            AddButton(buttonTabPage3, Lang.toggleDay, 0, (Context) => Context.DayTime             = !Context.DayTime, null, false);
            AddButton(buttonTabPage3, Lang.toggleSunDial, 1, (Context) => Context.FastForwardTime = !Context.FastForwardTime, null, false);
            AddButton(buttonTabPage3, Lang.toggleBloodMoon, 2, (Context) => Context.BloodMoon     = !Context.BloodMoon, null, false);
            AddButton(buttonTabPage3, Lang.toggleEclipse, 3, (Context) => Context.Eclipse         = !Context.Eclipse, null, false);
            AddButton(buttonTabPage3, Lang.snowMoon, 4, (Context) => Context.SnowMoon             = !Context.SnowMoon, null, false);
            AddButton(buttonTabPage3, Lang.pumpkinMoon, 5, (Context) => Context.PumpkinMoon       = !Context.PumpkinMoon, null, false);


            AddButton(buttonTabPage4, Lang.superRange, 0, Utils.SuperRange_E, Utils.SuperRange_D);
            AddButton(buttonTabPage4, Lang.fastTileSpeed, 1, Utils.FastTileSpeed_E, Utils.FastTileSpeed_D);
            AddButton(buttonTabPage4, Lang.rulerEffect, 2, Utils.RulerEffect_E, Utils.RulerEffect_D);
            AddButton(buttonTabPage4, Lang.machinicalRulerEffect, 3, Utils.MachinicalRulerEffect_E, Utils.MachinicalRulerEffect_D);
            AddButton(buttonTabPage4, Lang.showCircuit, 4, Utils.ShowCircuit_E, Utils.ShowCircuit_D);

            //AddButton(buttonTabPage5, Lang.infernoEffect, 0, HackFunctions.InfernoEffect, HackFunctions.De_InfernoEffect);
            AddButton(buttonTabPage5, Lang.shadowDodge, 1, Utils.ShadowDodge_E, Utils.ShadowDodge_D);
            AddButton(buttonTabPage5, Lang.showInvisiblePlayers, 2, Utils.ShowInvisiblePlayers_E, Utils.ShowInvisiblePlayers_D);

            LoadConfigs();
            LoadPlugins();
        }