unsafe private void InitControls() { MainPanel = new Panel() { Size = new Size(260, 450), Location = new Point(0, 0) }; this.Controls.Add(MainPanel); Button playerHack = AddButton(Lang.playerHack, delegate(object sender, EventArgs e) { PlayerEditorForm ie = new PlayerEditorForm(); ie.Show(); } ); playerHack.Size = new Size(255, 30); playerHack.Location = new Point(0, 30); Button itemAdd = AddButton(Lang.addItem, delegate(object sender, EventArgs e) { Form f = new Form(); TextBox ItemName = new TextBox(); TextBox ItemCount = new TextBox(); ComboBox prefix = new ComboBox(); Button et = new Button(); f.Text = Lang.addItem; f.StartPosition = FormStartPosition.CenterParent; f.FormBorderStyle = FormBorderStyle.FixedSingle; f.MaximizeBox = false; f.MinimizeBox = false; f.Size = new Size(265, 105); Label tip1 = new Label() { Text = "ItemName", Location = new Point(0, 5), Size = new Size(80, 20) }; f.Controls.Add(tip1); ItemName.Location = new Point(85, 0); ItemName.Size = new Size(95, 20); ItemName.Text = MainForm.resource.Items[0].name; ItemName.AutoCompleteMode = AutoCompleteMode.Suggest; ItemName.AutoCompleteSource = AutoCompleteSource.CustomSource; ItemName.AutoCompleteCustomSource = new AutoCompleteStringCollection(); ItemName.AutoCompleteCustomSource.AddRange(MainForm.resource.Items.Select(i => i.name).ToArray()); f.Controls.Add(ItemName); Label tip2 = new Label() { Text = "ItemStack", Location = new Point(0, 25), Size = new Size(80, 20) }; f.Controls.Add(tip2); ItemCount.Location = new Point(85, 20); ItemCount.Size = new Size(95, 20); ItemCount.Text = "1"; ItemCount.KeyPress += delegate(object sender1, KeyPressEventArgs e1) { if (!Char.IsNumber(e1.KeyChar) && e1.KeyChar != 8) { e1.Handled = true; } }; f.Controls.Add(ItemCount); prefix.Location = new Point(85, 40); prefix.Size = new Size(95, 20); prefix.DropDownStyle = ComboBoxStyle.DropDownList; prefix.DropDownHeight = 150; foreach (var o in MainForm.resource.Prefix) { string[] t = o.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); string v = t[0]; prefix.Items.Add(v); } prefix.SelectedIndex = 0; f.Controls.Add(prefix); Label tip3 = new Label() { Text = "ItemPrefix", Location = new Point(0, 45), Size = new Size(80, 20) }; f.Controls.Add(tip3); et.Text = Lang.confirm; et.Size = new Size(65, 60); et.Location = new Point(180, 0); et.Click += delegate(object sender1, EventArgs e1) { var r = MainForm.resource.Items.Where(t => t.name.ToLower().Contains(ItemName.Text.ToLower())); if (r.Count() > 0) { var player = Context.MyPlayer; int num = Item.NewItem(Context, player.X, player.Y, 0, 0, r.ElementAt(0).id, Convert.ToInt32(ItemCount.Text), false, Convert.ToByte(MainForm.resource.Prefix[prefix.SelectedIndex].Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries)[1]), true); NetMessage.SendData(MainForm.Context, 21, -1, -1, 0, num, 0, 0, 0, 0, 0, 0); f.Dispose(); } }; f.Controls.Add(et); f.StartPosition = FormStartPosition.CenterParent; f.ShowDialog(this); } ); itemAdd.Size = new Size(255, 30); itemAdd.Location = new Point(0, 60); Button addBuff = AddButton(Lang.addBuff, delegate(object sender, EventArgs e) { Form f = new Form(); TextBox BuffID = new TextBox() { Text = "0" }; TextBox BuffTime = new TextBox() { Text = "0" }; Button et = new Button(); f.Text = Lang.addBuffWnd; f.StartPosition = FormStartPosition.CenterParent; f.FormBorderStyle = FormBorderStyle.FixedSingle; f.MaximizeBox = false; f.MinimizeBox = false; f.Size = new Size(265, 80); Label tip1 = new Label() { Text = Lang.wndBuffID, Location = new Point(0, 5), Size = new Size(80, 20) }; f.Controls.Add(tip1); BuffID.Location = new Point(85, 0); BuffID.Size = new Size(95, 20); BuffID.KeyPress += delegate(object sender1, KeyPressEventArgs e1) { if (!Char.IsNumber(e1.KeyChar) && e1.KeyChar != 8 && e1.KeyChar != '-') { e1.Handled = true; } }; f.Controls.Add(BuffID); Label tip2 = new Label() { Text = Lang.wndBuffTime, Location = new Point(0, 25), Size = new Size(80, 20) }; f.Controls.Add(tip2); BuffTime.Location = new Point(85, 20); BuffTime.Size = new Size(95, 20); BuffTime.KeyPress += delegate(object sender1, KeyPressEventArgs e1) { if (!Char.IsNumber(e1.KeyChar) && e1.KeyChar != 8 && e1.KeyChar != '-') { e1.Handled = true; } }; f.Controls.Add(BuffTime); et.Text = Lang.confirm; et.Size = new Size(65, 40); et.Location = new Point(180, 0); et.Click += delegate(object sender1, EventArgs e1) { Context.MyPlayer.AddBuff(Convert.ToInt32(BuffID.Text), Convert.ToInt32(BuffTime.Text), false); f.Dispose(); }; f.Controls.Add(et); f.StartPosition = FormStartPosition.CenterParent; f.ShowDialog(this); } ); addBuff.Location = new Point(0, 0); addBuff.Size = new Size(85, 30); Button addPet = AddButton(Lang.addPet, delegate(object sender, EventArgs e) { Form f = new Form(); Button et = new Button(); f.Text = Lang.addPetWnd; f.StartPosition = FormStartPosition.CenterParent; f.FormBorderStyle = FormBorderStyle.FixedSingle; f.MaximizeBox = false; f.MinimizeBox = false; f.Size = new Size(265, 60); Label tip = new Label() { Text = Lang.addPetWnd, Size = new Size(55, 20), Location = new Point(0, 5) }; f.Controls.Add(tip); ComboBox pet = new ComboBox() { DropDownStyle = ComboBoxStyle.DropDownList, DropDownHeight = 150 }; foreach (var o in MainForm.resource.Pets) { string[] t = o.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); string v = t[0]; pet.Items.Add(v); } pet.SelectedIndex = 0; pet.Location = new Point(60, 0); pet.Size = new Size(120, 20); f.Controls.Add(pet); et.Text = Lang.confirm; et.Size = new Size(65, 20); et.Location = new Point(180, 0); et.Click += delegate(object sender1, EventArgs e1) { Context.MyPlayer.AddBuff(GetPetFromIndex(pet.SelectedIndex), 18000, false); f.Dispose(); }; f.Controls.Add(et); f.StartPosition = FormStartPosition.CenterParent; f.ShowDialog(this); } ); addPet.Location = new Point(85, 0); addPet.Size = new Size(85, 30); Button setMount = AddButton(Lang.setMount, delegate(object sender, EventArgs e) { Form f = new Form(); Button et = new Button(); f.Text = Lang.setMountWnd; f.StartPosition = FormStartPosition.CenterParent; f.FormBorderStyle = FormBorderStyle.FixedSingle; f.MaximizeBox = false; f.MinimizeBox = false; f.Size = new Size(265, 60); Label tip = new Label() { Text = Lang.setMountWnd, Size = new Size(55, 20), Location = new Point(0, 5) }; f.Controls.Add(tip); ComboBox mount = new ComboBox() { DropDownStyle = ComboBoxStyle.DropDownList, DropDownHeight = 150 }; foreach (var o in MainForm.resource.Mounts) { string[] t = o.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); string v = t[0]; mount.Items.Add(v); } mount.SelectedIndex = 0; mount.Location = new Point(60, 0); mount.Size = new Size(120, 20); f.Controls.Add(mount); et.Text = Lang.confirm; et.Size = new Size(65, 20); et.Location = new Point(180, 0); et.Click += delegate(object sender1, EventArgs e1) { Context.MyPlayer.AddBuff(GetMountFromIndex(mount.SelectedIndex), 18000, false); f.Dispose(); }; f.Controls.Add(et); f.StartPosition = FormStartPosition.CenterParent; f.ShowDialog(this); } ); setMount.Location = new Point(170, 0); setMount.Size = new Size(85, 30); Button NewNPC = AddButton(Lang.newNpc, delegate(object sender, EventArgs e) { Form f = new Form(); TextBox NPCType = new TextBox() { Text = "50" }; TextBox Times = new TextBox() { Text = "1" }; Button et = new Button(); f.Text = Lang.newNpc; f.StartPosition = FormStartPosition.CenterParent; f.FormBorderStyle = FormBorderStyle.FixedSingle; f.MaximizeBox = false; f.MinimizeBox = false; f.Size = new Size(265, 85); Label tip1 = new Label() { Text = "NPC ID", Location = new Point(0, 5), Size = new Size(80, 20) }; f.Controls.Add(tip1); NPCType.Location = new Point(85, 0); NPCType.Size = new Size(95, 20); NPCType.KeyPress += delegate(object sender1, KeyPressEventArgs e1) { if (!Char.IsNumber(e1.KeyChar) && e1.KeyChar != 8 && e1.KeyChar != '-') { e1.Handled = true; } }; f.Controls.Add(NPCType); Label tip2 = new Label() { Text = Lang.number, Location = new Point(0, 25), Size = new Size(80, 20) }; f.Controls.Add(tip2); Times.Location = new Point(85, 20); Times.Size = new Size(95, 20); Times.KeyPress += delegate(object sender1, KeyPressEventArgs e1) { if (!Char.IsNumber(e1.KeyChar) && e1.KeyChar != 8 && e1.KeyChar != '-') { e1.Handled = true; } }; f.Controls.Add(Times); et.Text = Lang.confirm; et.Size = new Size(65, 40); et.Location = new Point(180, 0); et.Click += delegate(object sender1, EventArgs e1) { var player = Context.MyPlayer; for (int i = 0; i < Convert.ToInt32(Times.Text); i++) { NPC.NewNPC(Context, (int)player.X, (int)player.Y, Convert.ToInt32(NPCType.Text)); } f.Dispose(); }; f.Controls.Add(et); f.StartPosition = FormStartPosition.CenterParent; f.ShowDialog(this); } ); NewNPC.Location = new Point(0, 90); NewNPC.Size = new Size(255, 30); Button Projs = AddButton("弹幕管理", delegate(object sender, EventArgs e) { ProjsBrowser pb = new ProjsBrowser(); pb.Show(); } ); Projs.Location = new Point(0, 120); Projs.Size = new Size(255, 30); Button wiki = AddButton("Wiki", delegate(object sender, EventArgs e) { WikiForm wikiform = new WikiForm(); wikiform.Show(); } ); wiki.Location = new Point(0, 150); wiki.Size = new Size(255, 30); Button advanced = AddButton(Lang.more, delegate(object sender, EventArgs e) { if (specialForm == null) { specialForm = new AdvForm(Context); specialForm.Show(this); specialForm.Location = new Point(Location.X + Width, Location.Y); ((Button)sender).Font = new Font("Arial", 8, FontStyle.Bold); } else { specialForm.Dispose(); specialForm = null; ((Button)sender).Font = new Font("Arial", 8); } } ); advanced.Font = new Font("Arial", 8); advanced.ForeColor = Color.Red; advanced.Location = new Point(0, 180); advanced.Size = new Size(255, 30); //slot.Text = "1"; }
public PagePanel_Player(int Width, int Height) : base(Width, Height) { EditPlayerInfoButton = new Button(); EditPlayerInfoButton.Enabled = false; EditPlayerInfoButton.FlatStyle = FlatStyle.Flat; EditPlayerInfoButton.Text = MainForm.CurrentLanguage["EditPlayer"]; EditPlayerInfoButton.BackColor = Color.FromArgb(100, 150, 150, 150); EditPlayerInfoButton.Bounds = new Rectangle(215, 3, 80, 30); EditPlayerInfoButton.Click += (s, e) => { int i = Convert.ToInt32(PlayerListView.SelectedItems[0].Text); PlayerEditorForm f = new PlayerEditorForm(HackContext.GameContext.Players[i], i == HackContext.GameContext.MyPlayerIndex); f.Show(); }; Controls.Add(EditPlayerInfoButton); TpToPlayerButton = new Button(); TpToPlayerButton.Enabled = false; TpToPlayerButton.FlatStyle = FlatStyle.Flat; TpToPlayerButton.Text = MainForm.CurrentLanguage["TpTo"]; TpToPlayerButton.BackColor = Color.FromArgb(100, 150, 150, 150); TpToPlayerButton.Bounds = new Rectangle(215, 33, 80, 30); TpToPlayerButton.Click += (s, e) => { var p = HackContext.GameContext.Players[Convert.ToInt32(PlayerListView.SelectedItems[0].Text)]; var mp = HackContext.GameContext.MyPlayer; mp.X = p.X; mp.Y = p.Y; }; Controls.Add(TpToPlayerButton); AddBuffButton = new Button(); AddBuffButton.Enabled = false; AddBuffButton.FlatStyle = FlatStyle.Flat; AddBuffButton.Text = MainForm.CurrentLanguage["AddBuff"]; AddBuffButton.BackColor = Color.FromArgb(100, 150, 150, 150); AddBuffButton.Bounds = new Rectangle(215, 63, 80, 30); Controls.Add(AddBuffButton); AddBuffButton.Click += (s, e) => { var ps = PlayerListView.SelectedIndices; if (ps.Count == 0) { return; } MForm AddBuffMForm = new MForm { BackColor = Color.FromArgb(90, 90, 90), Text = MainForm.CurrentLanguage["AddBuff"], StartPosition = FormStartPosition.CenterParent, ClientSize = new Size(245, 72) }; Label BuffTypeTip = new Label() { Text = MainForm.CurrentLanguage["BuffType"], Location = new Point(0, 0), Size = new Size(80, 20), TextAlign = ContentAlignment.MiddleCenter }; AddBuffMForm.MainPanel.Controls.Add(BuffTypeTip); TextBox BuffID = new TextBox { BorderStyle = BorderStyle.FixedSingle, BackColor = Color.FromArgb(120, 120, 120), Text = "0", Location = new Point(85, 0), Size = new Size(95, 20) }; BuffID.KeyPress += (s1, e1) => e1.Handled = e1.Handled || (!Char.IsNumber(e1.KeyChar) && e1.KeyChar != 8 && e1.KeyChar != '-'); AddBuffMForm.MainPanel.Controls.Add(BuffID); Label BuffTimeTip = new Label() { Text = MainForm.CurrentLanguage["BuffTime"], Location = new Point(0, 20), Size = new Size(80, 20), TextAlign = ContentAlignment.MiddleCenter }; AddBuffMForm.MainPanel.Controls.Add(BuffTimeTip); TextBox BuffTime = new TextBox { BorderStyle = BorderStyle.FixedSingle, BackColor = Color.FromArgb(120, 120, 120), Text = "0", Location = new Point(85, 20), Size = new Size(95, 20) }; BuffTime.KeyPress += (s1, e1) => e1.Handled = e1.Handled || (!Char.IsNumber(e1.KeyChar) && e1.KeyChar != 8 && e1.KeyChar != '-'); AddBuffMForm.MainPanel.Controls.Add(BuffTime); Button ConfirmButton = new Button(); ConfirmButton.Text = MainForm.CurrentLanguage["Confirm"]; ConfirmButton.FlatStyle = FlatStyle.Flat; ConfirmButton.Size = new Size(65, 40); ConfirmButton.Location = new Point(180, 0); ConfirmButton.Click += (s1, e1) => { HackContext.GameContext.Players[ps[0]].AddBuff(Convert.ToInt32(BuffID.Text), Convert.ToInt32(BuffTime.Text), false); AddBuffMForm.Dispose(); }; AddBuffMForm.MainPanel.Controls.Add(ConfirmButton); AddBuffMForm.ShowDialog(this); }; SetPetButton = new Button(); SetPetButton.Enabled = false; SetPetButton.FlatStyle = FlatStyle.Flat; SetPetButton.Text = MainForm.CurrentLanguage["SetPet"]; SetPetButton.BackColor = Color.FromArgb(100, 150, 150, 150); SetPetButton.Bounds = new Rectangle(215, 93, 80, 30); Controls.Add(SetPetButton); SetPetButton.Click += (s, e) => { var ps = PlayerListView.SelectedIndices; if (ps.Count == 0) { return; } MForm SetPetMForm = new MForm { BackColor = Color.FromArgb(90, 90, 90), Text = MainForm.CurrentLanguage["SetPet"], StartPosition = FormStartPosition.CenterParent, ClientSize = new Size(245, 52) }; Label PetTypeTip = new Label() { Text = MainForm.CurrentLanguage["Pet"], Location = new Point(0, 0), Size = new Size(80, 20), TextAlign = ContentAlignment.MiddleCenter }; SetPetMForm.MainPanel.Controls.Add(PetTypeTip); ComboBox PetComboBox = new ComboBox() { DropDownStyle = ComboBoxStyle.DropDownList, DropDownHeight = 150, Location = new Point(85, 0), Size = new Size(95, 20) }; foreach (var o in GameResLoader.Pets) { PetComboBox.Items.Add(o); } PetComboBox.SelectedIndex = 0; SetPetMForm.MainPanel.Controls.Add(PetComboBox); Button ConfirmButton = new Button(); ConfirmButton.Text = MainForm.CurrentLanguage["Confirm"]; ConfirmButton.FlatStyle = FlatStyle.Flat; ConfirmButton.Size = new Size(65, 20); ConfirmButton.Location = new Point(180, 0); ConfirmButton.Click += (s1, e1) => { HackContext.GameContext.Players[ps[0]].AddBuff(GetPetFromIndex(PetComboBox.SelectedIndex), 18000, false); SetPetMForm.Dispose(); }; SetPetMForm.MainPanel.Controls.Add(ConfirmButton); SetPetMForm.ShowDialog(this); }; SetMountButton = new Button(); SetMountButton.Enabled = false; SetMountButton.FlatStyle = FlatStyle.Flat; SetMountButton.Text = MainForm.CurrentLanguage["SetMount"]; SetMountButton.BackColor = Color.FromArgb(100, 150, 150, 150); SetMountButton.Bounds = new Rectangle(215, 123, 80, 30); Controls.Add(SetMountButton); SetMountButton.Click += (s, e) => { var ps = PlayerListView.SelectedIndices; if (ps.Count == 0) { return; } MForm SetMountMForm = new MForm { BackColor = Color.FromArgb(90, 90, 90), Text = MainForm.CurrentLanguage["SetMount"], StartPosition = FormStartPosition.CenterParent, ClientSize = new Size(245, 52) }; Label MountTypeTip = new Label() { Text = MainForm.CurrentLanguage["Mount"], Location = new Point(0, 0), Size = new Size(80, 20), TextAlign = ContentAlignment.MiddleCenter }; SetMountMForm.MainPanel.Controls.Add(MountTypeTip); ComboBox MountComboBox = new ComboBox() { DropDownStyle = ComboBoxStyle.DropDownList, DropDownHeight = 150, Location = new Point(85, 0), Size = new Size(95, 20) }; foreach (var o in GameResLoader.Mounts) { MountComboBox.Items.Add(o); } MountComboBox.SelectedIndex = 0; SetMountMForm.MainPanel.Controls.Add(MountComboBox); Button ConfirmButton = new Button(); ConfirmButton.Text = MainForm.CurrentLanguage["Confirm"]; ConfirmButton.FlatStyle = FlatStyle.Flat; ConfirmButton.Size = new Size(65, 20); ConfirmButton.Location = new Point(180, 0); ConfirmButton.Click += (s1, e1) => { HackContext.GameContext.Players[ps[0]].AddBuff(GetMountFromIndex(MountComboBox.SelectedIndex), 18000, false); SetMountMForm.Dispose(); }; SetMountMForm.MainPanel.Controls.Add(ConfirmButton); SetMountMForm.ShowDialog(this); }; PlayerAttributePanel = new Panel(); PlayerAttributePanel.Bounds = new Rectangle(3, 203, 210, 165); PlayerAttributePanel.BorderStyle = BorderStyle.FixedSingle; Controls.Add(PlayerAttributePanel); PlayerNameInfoView = AddPlayerAttribute(MainForm.CurrentLanguage["PlayerName"], 120); PlayerLifeInfoView = AddPlayerAttribute(MainForm.CurrentLanguage["Life"], 120); PlayerManaInfoView = AddPlayerAttribute(MainForm.CurrentLanguage["Mana"], 120); PlayerMaxLifeInfoView = AddPlayerAttribute(MainForm.CurrentLanguage["MaxLife"], 120); PlayerMaxManaInfoView = AddPlayerAttribute(MainForm.CurrentLanguage["MaxMana"], 120); PlayerXInfoView = AddPlayerAttribute(MainForm.CurrentLanguage["X_Coor"], 120); PlayerYInfoView = AddPlayerAttribute(MainForm.CurrentLanguage["Y_Coor"], 120); PlayerInventoryBaseAddressInfoView = AddPlayerAttribute(MainForm.CurrentLanguage["PlayerInvAddress"], 120); PlayerListView = new MListView(); PlayerListView.SelectedIndexChanged += (s, e) => { var m = s as MListView; if (m.SelectedIndices.Count > 0) { EditPlayerInfoButton.Enabled = true; TpToPlayerButton.Enabled = true; bool t = Convert.ToInt32(m.SelectedItems[0].SubItems[0].Text) == HackContext.GameContext.MyPlayerIndex; AddBuffButton.Enabled = t; SetPetButton.Enabled = t; SetMountButton.Enabled = t; } else { EditPlayerInfoButton.Enabled = false; TpToPlayerButton.Enabled = false; AddBuffButton.Enabled = false; SetPetButton.Enabled = false; SetMountButton.Enabled = false; ClearPlayerAttribute(); } }; PlayerListView.Bounds = new Rectangle(3, 3, 210, 200); PlayerListView.Columns.Add(MainForm.CurrentLanguage["Index"], 40); PlayerListView.Columns.Add(MainForm.CurrentLanguage["Name"], 70); PlayerListView.Columns.Add(MainForm.CurrentLanguage["Life"], 50); PlayerListView.Columns.Add(MainForm.CurrentLanguage["Mana"], 50); Controls.Add(PlayerListView); UpdatePlayerTimer = new System.Timers.Timer(); UpdatePlayerTimer.Interval = 500; //每隔500ms进行一次玩家列表的检查和更新 UpdatePlayerTimer.Elapsed += (s, e) => { if (!Visible) { return; } if (PlayerListView.SelectedIndices.Count > 0) { UpdatePlayerAttribute(HackContext.GameContext.Players[Convert.ToInt32(PlayerListView.SelectedItems[0].Text)]); } UpdatePlayerList(); }; UpdatePlayerTimer.Start(); //开启更新线程 }