public void OnWndProc(WndEventArgs args) { if (args.Msg == WM_MOUSEDOWN) { if (args.WParam == VK_LBUTTON) { Vector3?nearestWard = Ward.FindNearestWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y)); if (nearestWard != null) { SpellSlot wardSpellSlot = Ward.FindWardSpellSlot(ObjectManager.Player); if (wardSpellSlot != SpellSlot.Unknown) { ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot, (Vector3)nearestWard); } } WardSpot nearestSafeWard = Ward.FindNearestSafeWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y)); if (nearestSafeWard != null) { SpellSlot wardSpellSlot = Ward.FindWardSpellSlot(ObjectManager.Player); if (wardSpellSlot != SpellSlot.Unknown) { ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, nearestSafeWard.MagneticPosition); _PutSafeWard = nearestSafeWard; } } } } }
void Game_OnGameUpdate(EventArgs args) { if (_PutSafeWard != null) { if (Math.Sqrt(Math.Pow(_PutSafeWard.ClickPosition.X - ObjectManager.Player.Position.X, 2) + Math.Pow(_PutSafeWard.ClickPosition.Y - ObjectManager.Player.Position.Y, 2)) <= 650.0) { SpellSlot wardSpellSlot = Ward.FindWardSpellSlot(ObjectManager.Player); if (wardSpellSlot != SpellSlot.Unknown) { ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot, (Vector3)_PutSafeWard.ClickPosition); } _PutSafeWard = null; } } }