Example #1
0
        public static void ShowTree(int index)
        {
            RecipeTreeForm form = new RecipeTreeForm();

            form.ConstructTree(index);
            form.Show();
        }
Example #2
0
        public ItemsTabPage()
        {
            if (Items == null)
            {
                using (var s = Assembly.GetExecutingAssembly().GetManifestResourceStream("QTRHacker.NewDimension.Res.Game.WikiRes.zip"))
                {
                    ZipArchive z = new ZipArchive(s);
                    using (var u = new StreamReader(z.GetEntry("ItemInfo.json").Open()))
                        Items = JArray.Parse(u.ReadToEnd());
                    using (var u = new StreamReader(z.GetEntry("ItemName_cn.json").Open()))
                        Items_cn = JArray.Parse(u.ReadToEnd());
                    using (var u = new StreamReader(z.GetEntry("RecipeInfo.json").Open()))
                        Recipes = JArray.Parse(u.ReadToEnd());
                }
            }
            this.BackColor   = Color.LightGray;
            this.BorderStyle = BorderStyle.None;

            ItemListView               = new ListView();
            ItemListView.Bounds        = new Rectangle(5, 5, 450, 440);
            ItemListView.FullRowSelect = true;
            ItemListView.MultiSelect   = false;
            ItemListView.HideSelection = false;
            ItemListView.View          = View.Details;
            ItemListView.Columns.Add(MainForm.CurrentLanguage["Index"], 50);
            ItemListView.Columns.Add(MainForm.CurrentLanguage["Rare"], 50);
            ItemListView.Columns.Add(MainForm.CurrentLanguage["EnglishName"], 125);
            ItemListView.Columns.Add(MainForm.CurrentLanguage["ChineseName"], 125);
            ItemListView.Columns.Add(MainForm.CurrentLanguage["Type"], 70);

            ItemListView.MouseDoubleClick += (s, e) =>
            {
                int id     = Convert.ToInt32(ItemListView.SelectedItems[0].Text.ToString());
                var player = HackContext.GameContext.MyPlayer;
                int num    = Functions.GameObjects.Item.NewItem(HackContext.GameContext, player.X, player.Y, 0, 0, id, Items[id]["maxStack"].ToObject <int>(), false, 0, true);
                Functions.GameObjects.NetMessage.SendData(HackContext.GameContext, 21, -1, -1, 0, num, 0, 0, 0, 0, 0, 0);
            };
            ContextMenuStrip strip = ItemListView.ContextMenuStrip = new ContextMenuStrip();

            strip.Items.Add(MainForm.CurrentLanguage["AddToInvMax"]).Click += (s, e) =>
            {
                int id     = Convert.ToInt32(ItemListView.SelectedItems[0].Text.ToString());
                var player = HackContext.GameContext.MyPlayer;
                int num    = Functions.GameObjects.Item.NewItem(HackContext.GameContext, player.X, player.Y, 0, 0, id, Items[id]["maxStack"].ToObject <int>(), false, 0, true);
                Functions.GameObjects.NetMessage.SendData(HackContext.GameContext, 21, -1, -1, 0, num, 0, 0, 0, 0, 0, 0);
            };
            strip.Items.Add(MainForm.CurrentLanguage["AddToInvOne"]).Click += (s, e) =>
            {
                int id     = Convert.ToInt32(ItemListView.SelectedItems[0].Text.ToString());
                var player = HackContext.GameContext.MyPlayer;
                int num    = Functions.GameObjects.Item.NewItem(HackContext.GameContext, player.X, player.Y, 0, 0, id, 1, false, 0, true);
                Functions.GameObjects.NetMessage.SendData(HackContext.GameContext, 21, -1, -1, 0, num, 0, 0, 0, 0, 0, 0);
            };
            strip.Items.Add(MainForm.CurrentLanguage["ShowRecipeTree"]).Click += (s, e) =>
            {
                int id = Convert.ToInt32(ItemListView.SelectedItems[0].Text.ToString());
                RecipeTreeForm.ShowTree(id);
            };
            ItemListView.SelectedIndexChanged += ItemListView_SelectedIndexChanged;

            ItemInfoPage = new ItemInfoSubPage();
            ItemInfoPage.OnRequireItemDoubleClick  += RequireItems_MouseDoubleClick;
            ItemInfoPage.OnRecipeToItemDoubleClick += RecipeToItems_MouseDoubleClick;

            AccInfoPage = new AccInfoSubPage();


            SearcherPage = new SearcherSubPage();
            SearcherPage.BlockCheckBox.CheckedChanged      += Filter_CheckedChanged;
            SearcherPage.WallCheckBox.CheckedChanged       += Filter_CheckedChanged;
            SearcherPage.HeadCheckBox.CheckedChanged       += Filter_CheckedChanged;
            SearcherPage.BodyCheckBox.CheckedChanged       += Filter_CheckedChanged;
            SearcherPage.LegCheckBox.CheckedChanged        += Filter_CheckedChanged;
            SearcherPage.AccessoryCheckBox.CheckedChanged  += Filter_CheckedChanged;
            SearcherPage.MeleeCheckBox.CheckedChanged      += Filter_CheckedChanged;
            SearcherPage.RangedCheckBox.CheckedChanged     += Filter_CheckedChanged;
            SearcherPage.MagicCheckBox.CheckedChanged      += Filter_CheckedChanged;
            SearcherPage.SummonCheckBox.CheckedChanged     += Filter_CheckedChanged;
            SearcherPage.BuffCheckBox.CheckedChanged       += Filter_CheckedChanged;
            SearcherPage.ConsumableCheckBox.CheckedChanged += Filter_CheckedChanged;
            SearcherPage.OthersCheckBox.CheckedChanged     += Filter_CheckedChanged;

            SearcherPage.KeyWordTextBox.KeyDown += (s, e) =>
            {
                if (e.KeyCode == Keys.Enter)
                {
                    e.Handled = true;
                    KeyWord   = SearcherPage.KeyWordTextBox.Text;
                    RefreshItems();
                }
            };

            SearcherPage.SearchButton.Click += (s, e) =>
            {
                KeyWord = SearcherPage.KeyWordTextBox.Text;
                RefreshItems();
            };

            SearcherPage.ResetButton.Click += (s, e) =>
            {
                KeyWord = "";
                SearcherPage.KeyWordTextBox.Text = "";
                RefreshItems();
            };

            InfoTabs        = new MTabControl();
            InfoTabs.Bounds = new Rectangle(460, 5, 270, 440);
            InfoTabs.Controls.Add(ItemInfoPage);
            InfoTabs.Controls.Add(AccInfoPage);
            InfoTabs.Controls.Add(SearcherPage);

            Controls.Add(ItemListView);
            Controls.Add(InfoTabs);
        }