public bool MultipleMelee(float damage, int amountTargets, List <Collider2D> enemies, Vector3 playerPosition) { AttackedEnemies.Clear(); if (!HasEnemies(enemies)) { return(false); } var closest = MultiClosestTarget(amountTargets, enemies, playerPosition); if (closest != null) { AttackedEnemies = closest; foreach (Collider2D coll in AttackedEnemies) { CharActions charActions = coll.GetComponent <CharActions>(); charActions.TakeDamage(damage); bool isCrit = Random.Range(0, 100) < 30; DamagePopup.Create(damageInfo, coll.transform.position, damage, isCrit); } return(true); } else { return(false); } }
public void RegisterCharacter(CharID charID, CharActions charActions) { if (charActionsDic == null) { charActionsDic = new Dictionary <CharID, CharActions>(); } charActionsDic.Add(charID, charActions); }
private static void AntiAfk(uint windowHandler) { new Thread(() => { /* * P The message was posted to the queue with the PostMessage function. No information is available concerning the ultimate disposition of the message. * S The message was sent with the SendMessage function. This means that the sender doesn’t regain control until the receiver processes and returns the message. The receiver can, therefore, pass a return value back to the sender. * s The message was sent, but security prevents access to the return value. * R Each ‘S’ line has a corresponding ‘R’ (return) line that lists the message return value. Sometimes message calls are nested, which means that one message handler sends another message. * * <001492> 0003043E R WM_CAPTURECHANGED * <001493> 0003043E S WM_NCHITTEST xPos:-76 yPos:286 * <001494> 0003043E R WM_NCHITTEST nHittest:HTCLIENT * <001495> 0003043E S WM_SETCURSOR hwnd:0003043E nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE * <001496> 0003043E R WM_SETCURSOR fHaltProcessing:False * <001497> 0003043E P WM_MOUSEMOVE fwKeys:0000 xPos:1309 yPos:227 * > * <001498> 0003043E P WM_KEYDOWN nVirtKey:'W' cRepeat:1 ScanCode:11 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 * <001499> 0003043E P WM_CHAR chCharCode:'119' (119) cRepeat:1 ScanCode:11 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 * <001500> 0003043E P WM_KEYUP nVirtKey:'W' cRepeat:1 ScanCode:11 fExtended:0 fAltDown:0 fRepeat:1 fUp:1 * <001501> 0003043E P WM_KEYDOWN nVirtKey:'S' cRepeat:1 ScanCode:1F fExtended:0 fAltDown:0 fRepeat:0 fUp:0 * <001502> 0003043E P WM_CHAR chCharCode:'115' (115) cRepeat:1 ScanCode:1F fExtended:0 fAltDown:0 fRepeat:0 fUp:0 * <001503> 0003043E P WM_KEYUP nVirtKey:'S' cRepeat:1 ScanCode:1F fExtended:0 fAltDown:0 fRepeat:1 fUp:1 * > * <001504> 0003043E P WM_SYSKEYDOWN nVirtKey:VK_MENU cRepeat:1 ScanCode:38 fExtended:0 fAltDown:1 fRepeat:0 fUp:0 * <001505> 0003043E S WM_NCACTIVATE fActive:False * <001506> 0003043E R WM_NCACTIVATE fDeactivateOK:True */ while (true) { var timeout = MinimalLongTimeTimeout.TotalSeconds + Randomizer.Next(0, LongTimeRandomTimeout); var dtNow = DateTime.Now; Console.WriteLine($"-> Movement [{dtNow.Hour:D2}h {dtNow.Minute:D2}m {dtNow.Second:D2}s], Next press in {timeout} sec"); var nextAction = Randomizer.Next(0, CharActions.Length); CharActions[nextAction](windowHandler); Thread.Sleep(TimeSpan.FromSeconds(timeout)); } }).Start(); }
public virtual IntPtr WindowProcedure(IntPtr hwnd, WmConstants msg, IntPtr wparam, IntPtr lparam) // Routine called by Windows whenever a new message is received for the current window. { switch (msg) { case WmConstants.Wm_erasebkgnd: return(IntPtr.Zero + 1); case WmConstants.Wm_paint: PaintDc l_dc = new PaintDc(this); l_dc.Get(); ExposeActions?.Invoke(this, l_dc, l_dc.PaintRect()); l_dc.Release(); return(IntPtr.Zero); case WmConstants.Wm_lbuttondown: PointerButtonPressActions?.Invoke(this, (short)lparam.ToInt64(), (short)(lparam.ToInt64() >> 16), 1); return(IntPtr.Zero); case WmConstants.Wm_keydown: KeyDownActions?.Invoke(this, (int)wparam.ToInt64(), (int)lparam.ToInt64()); return(IntPtr.Zero); case WmConstants.Wm_keyup: KeyUpActions?.Invoke(this, (int)wparam.ToInt64(), (int)lparam.ToInt64()); return(IntPtr.Zero); case WmConstants.Wm_char: CharActions?.Invoke(this, (char)wparam.ToInt64(), (int)lparam.ToInt64()); return(IntPtr.Zero); case WmConstants.Wm_close: // Temporary handling to close the application as soon as we close a window. CloseActions?.Invoke(this); return(IntPtr.Zero); default: return(Win32.DefWindowProc(hwnd, msg, wparam, lparam)); } }
public bool SingleMelee(float damage, List <Collider2D> enemies, Vector3 playerPosition) { AttackedEnemies.Clear(); if (!HasEnemies(enemies)) { return(false); } var closest = ClosestTarget(enemies, playerPosition); if (closest != null) { AttackedEnemies.Add(closest); CharActions charActions = closest.GetComponent <CharActions>(); charActions.TakeDamage(damage); bool isCrit = Random.Range(0, 100) < 30; DamagePopup.Create(damageInfo, closest.transform.position, damage, isCrit); return(true); } else { return(false); } }