public override void Run(string pluginDir) { try { _menu = new Menu("Sector10", "Sector10"); _menu.AddItem(new MenuBool("EnableMovement", "Enable movement", false)); OptionPanel.AddMenu(_menu); Chat.WriteLine("Sector10 bot loaded!"); Game.OnUpdate += OnUpdate; } catch (Exception e) { Chat.WriteLine(e.Message); } }
public override void Run(string pluginDir) { try { Chat.WriteLine("TestPlugin loaded"); Chat.WriteLine($"LocalPlayer: {DynelManager.LocalPlayer.Identity}"); Chat.WriteLine($" Name: {DynelManager.LocalPlayer.Name}"); Chat.WriteLine($" Pos: {DynelManager.LocalPlayer.Position}"); Chat.WriteLine($" MoveState: {DynelManager.LocalPlayer.MovementState}"); Chat.WriteLine($" Health: {DynelManager.LocalPlayer.GetStat(Stat.Health)}"); /* * Chat.WriteLine("Playfield"); * Chat.WriteLine($" Identity: {Playfield.Identity}"); * Chat.WriteLine($" Name: {Playfield.Name}"); * Chat.WriteLine($" AllowsVehicles: {Playfield.AllowsVehicles}"); * Chat.WriteLine($" IsDungeon: {Playfield.IsDungeon}"); * Chat.WriteLine($" IsShadowlands: {Playfield.IsShadowlands}"); * Chat.WriteLine($" NumDynels: {DynelManager.AllDynels.Count}"); */ Chat.WriteLine("Team:"); Chat.WriteLine($"\tIsInTeam: {Team.IsInTeam}"); Chat.WriteLine($"\tIsLeader: {Team.IsLeader}"); Chat.WriteLine($"\tIsRaid: {Team.IsRaid}"); mc = new MovementController(drawPath: true); foreach (TeamMember teamMember in Team.Members) { Chat.WriteLine($"\t{teamMember.Name} - {teamMember.Identity} - {teamMember.Level} - {teamMember.Profession} - IsLeader:{teamMember.IsLeader} @ Team {teamMember.TeamIndex + 1}"); } Chat.WriteLine("Tests:"); /* * Chat.WriteLine($"Base stat: {DynelManager.LocalPlayer.GetStat(Stat.RunSpeed, 1)}"); * Chat.WriteLine($"Modified stat: {DynelManager.LocalPlayer.GetStat(Stat.RunSpeed, 2)}"); * Chat.WriteLine($"No Trickle stat: {DynelManager.LocalPlayer.GetStat(Stat.RunSpeed, 3)}"); * * Team.Members.ForEach(x => Chat.WriteLine($"{x.Name} IsLeader: {x.IsLeader}")); * * foreach (Room room in Playfield.Rooms) * { * Chat.WriteLine($"Ptr: {room.Pointer.ToString("X4")}\tName: {room.Name}\tIdx: {room.Instance}\tRot: {room.Rotation}\tPos: {room.Position}\tCenter: {room.Center}\tTemplatePos: {room.TemplatePos}\tYOffset: {room.YOffset}\tNumDoors: {room.NumDoors}\tFloor: {room.Floor}"); * } * * //AO3D export * foreach (Room room in Playfield.Rooms) * { * Chat.WriteLine($"new RoomInstance(\"{room.Name}\", {room.Floor}, new Vector3{room.Position}, {(int)room.Rotation / 90}, {room.LocalRect.MinX}, {room.LocalRect.MinY}, {room.LocalRect.MaxX}, {room.LocalRect.MaxY}, new Vector3{room.Center}, new Vector3{room.TemplatePos}),"); * } */ /* * foreach(Spell spell in Spell.List) * { * Chat.WriteLine($"\t{spell.Identity}\t{spell.Name}\t{spell.MeetsUseReqs()}\t{spell.IsReady}"); * } */ foreach (PerkAction perkAction in PerkAction.List) { //Chat.WriteLine($"\t{perk.Identity}\t{perk.Hash}\t{perk.Name}\t{perk.MeetsSelfUseReqs()}\t{perk.GetStat(Stat.AttackDelay)}"); Chat.WriteLine($"{perkAction.Name} = 0x{((uint)perkAction.Hash).ToString("X4")},"); } /* * Chat.WriteLine("Buffs:"); * foreach(Buff buff in DynelManager.LocalPlayer.Buffs) * { * Chat.WriteLine($"\tBuff: {buff.Name}\t{buff.RemainingTime}/{buff.TotalTime}"); * } */ /* * Perk perk; * if(Perk.Find(PerkHash.Gore, out perk)) * { * if(DynelManager.LocalPlayer.FightingTarget != null) * Chat.WriteLine($"Can use perk? {perk.MeetsUseReqs(DynelManager.LocalPlayer.FightingTarget)}"); * } */ /* * Chat.WriteLine("Pet Identities:"); * foreach(Identity identity in DynelManager.LocalPlayer.Pets) * { * Chat.WriteLine($"\t{identity}"); * } * * Chat.WriteLine("Pet Dynels:"); * foreach(SimpleChar pet in DynelManager.LocalPlayer.GetPetDynels()) * { * Chat.WriteLine($"\t{pet.Name}"); * } */ /* * Item item; * if(Inventory.Find(244216, out item)) * { * DummyItem dummyItem = DummyItem.GetFromTemplate(item.Slot); * dummyItem.MeetsUseReqs(); * } */ //DevExtras.LoadAllSurfaces(); /* * MovementController movementController = new MovementController(true); * * List<Vector3> testPath = new List<Vector3> { * new Vector3(438.6, 8.0f, 524.4f), * new Vector3(446.8f, 8.0f, 503.7f), * new Vector3(460.8, 15.1f, 414.0f) * }; * * movementController.RunPath(testPath); */ Chat.WriteLine($"Missions ({Mission.List.Count})"); foreach (Mission mission in Mission.List) { Chat.WriteLine($" {mission.Identity.ToString()}"); Chat.WriteLine($" Source: {mission.Source.ToString()}"); Chat.WriteLine($" Playfield: {mission.Playfield.ToString()}"); Chat.WriteLine($" DisplayName: {mission.DisplayName}"); } /* * List<Item> characterItems = Inventory.Items; * //List<Item> characterItems = Inventory.Items; * * foreach (Item item in characterItems) * { * Chat.WriteLine($"{item.Slot} - {item.LowId} - {item.Name} - {item.QualityLevel} - {item.UniqueIdentity}"); * } */ /* * Chat.WriteLine("Backpacks:"); * * List<Container> backpacks = Inventory.Backpacks; * foreach(Container backpack in backpacks) * { * Chat.WriteLine($"{backpack.Identity} - IsOpen:{backpack.IsOpen}{((backpack.IsOpen) ? $" - Items:{backpack.Items.Count}" : "")}"); * } */ /* * Item noviRing; * if (Inventory.Find(226307, out noviRing)) * { * //noviRing.Equip(EquipSlot.Cloth_RightFinger); * * Container openBag = Inventory.Backpacks.FirstOrDefault(x => x.IsOpen); * if(openBag != null) * { * noviRing.MoveToContainer(openBag); * } * } */ //DynelManager.LocalPlayer.CastNano(new Identity(IdentityType.NanoProgram, 223372), DynelManager.LocalPlayer); _menu = new Menu("TestPlugin", "TestPlugin"); _menu.AddItem(new MenuBool("DrawingTest", "Drawing Test", false)); //_menu.AddItem(new MenuTest("CrashTime", "Inb4 Crash")); OptionPanel.AddMenu(_menu); Chat.RegisterCommand("split", (string command, string[] param, ChatWindow chatWindow) => { if (param.Length < 2) { return; } if (Inventory.Find(int.Parse(param[0]), out Item item)) { item.Split(int.Parse(param[1])); } }); Chat.RegisterCommand("openwindow", (string command, string[] param, ChatWindow chatWindow) => { testWindow = Window.CreateFromXml("Test", $"{pluginDir}\\TestWindow.xml"); testWindow.Show(true); chatWindow.WriteLine($"Window.Pointer: {testWindow.Pointer.ToString("X4")}"); chatWindow.WriteLine($"Window.Name: {testWindow.Name}"); if (testWindow.IsValid) { if (testWindow.FindView("testTextView", out TextView testView)) { Chat.WriteLine($"testTextView.Pointer: {testView.Pointer.ToString("X4")}"); Chat.WriteLine($"testTextView.Text: {testView.Text}"); testView.Text = "1337"; Chat.WriteLine($"testTextView.Text(New): {testView.Text}"); } if (testWindow.FindView("testPowerBar", out PowerBarView testPowerBar)) { Chat.WriteLine($"testPowerBar.Pointer: {testPowerBar.Pointer.ToString("X4")}"); Chat.WriteLine($"testPowerBar.Value: {testPowerBar.Value}"); testPowerBar.Value = 0.1f; } } }); Chat.RegisterCommand("savesettings", (string command, string[] param, ChatWindow chatWindow) => { Settings.Save(); }); Chat.RegisterCommand("test", (string command, string[] param, ChatWindow chatWindow) => { Settings["DrawStuff"] = true; //DynelManager.LocalPlayer.Position += Vector3.Rotate(Vector3.Zero, DynelManager.LocalPlayer.Rotation.Forward, 90); /* * if (Targeting.Target == null) * Chat.WriteLine("No target"); * else * Chat.WriteLine(Targeting.Target.Identity); * * * if (Targeting.TargetChar == null) * Chat.WriteLine("No target or target isn't a char"); * else * Chat.WriteLine(Targeting.TargetChar.Identity); */ if (Spell.Find(85872, out Spell spell)) { Chat.WriteLine($"Drain Self No Target: {spell.MeetsUseReqs()}"); Chat.WriteLine($"Drain Self Self: {spell.MeetsSelfUseReqs()}"); Chat.WriteLine($"Drain Self No Target: {spell.MeetsUseReqs(Targeting.TargetChar)}"); } /* * foreach(Pet pet in DynelManager.LocalPlayer.Pets) * { * Chat.WriteLine(pet.Character != null ? pet.Character.Name : "No pet character found"); * Chat.WriteLine(pet.Type); * } */ //DevExtras.Test(); //if (DynelManager.LocalPlayer.Buffs.Find(215264, out Buff testBuff)) // testBuff.Remove(); /* * if (DynelManager.LocalPlayer.FightingTarget != null) * { * chatWindow.WriteLine(DynelManager.LocalPlayer.GetLogicalRangeToTarget(DynelManager.LocalPlayer.FightingTarget).ToString()); * * * if (Perk.Find("Capture Vigor", out Perk perk)) * { * chatWindow.WriteLine(perk.GetStat(Stat.AttackRange).ToString()); * chatWindow.WriteLine(perk.IsInRange(DynelManager.LocalPlayer.FightingTarget).ToString()); * } * }*/ }); _ipcChannel = new IPCChannel(1); _ipcChannel.RegisterCallback((int)IPCOpcode.Test, (sender, msg) => { TestMessage testMsg = (TestMessage)msg; Chat.WriteLine($"TestMessage: {testMsg.Leet} - {testMsg.Position}"); }); _ipcChannel.RegisterCallback((int)IPCOpcode.Empty, (sender, msg) => { Chat.WriteLine($"EmptyMessage"); }); Settings = new Settings("TestPlugin"); Settings.AddVariable("DrawStuff", false); Settings.AddVariable("AnotherVariable", 1911); Game.OnUpdate += OnUpdate; Game.TeleportStarted += Game_OnTeleportStarted; Game.TeleportEnded += Game_OnTeleportEnded; Game.TeleportFailed += Game_OnTeleportFailed; Game.PlayfieldInit += Game_PlayfieldInit; MiscClientEvents.AttemptingSpellCast += AttemptingSpellCast; //Network.N3MessageReceived += Network_N3MessageReceived; //Network.N3MessageSent += Network_N3MessageSent; //Network.PacketReceived += Network_PacketReceived; //Network.PacketSent += Network_PacketSent; Network.ChatMessageReceived += Network_ChatMessageReceived; Team.TeamRequest += Team_TeamRequest; Team.MemberLeft += Team_MemberLeft; Item.ItemUsed += Item_ItemUsed; NpcDialog.AnswerListChanged += NpcDialog_AnswerListChanged; //DynelManager.DynelSpawned += DynelSpawned; //DynelManager.CharInPlay += CharInPlay; } catch (Exception e) { Chat.WriteLine(e.Message); } }