SHOW:
|
|
- or go back to the newest paste.
| 1 | ===== | |
| 2 | ||
| 3 | Kwskii | |
| 4 | ||
| 5 | ## Features | |
| 6 | ||
| 7 | Options; | |
| 8 | - Per Weapon Recoil Reduction | |
| 9 | - Per Weapon Anti Bloom | |
| 10 | - Per Weapon Fire Rate Control and Autofire | |
| 11 | - Fast Weapon Switching using Animation Canceling | |
| 12 | - Quick Shoot Hotkey using Animation Canceling | |
| 13 | - Turbo use Option to Autofire Use when the button is held down | |
| 14 | - AR Perfect Aim 100% First Shot Accuracy | |
| 15 | - Fast Edit Reset to automaticly stop editing upon rightclick | |
| 16 | ||
| 17 | Always On Features; | |
| 18 | - Auto Reload Cancel on Weapon Switch or Use | |
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ## Usage | |
| 23 | ||
| 24 | Start Script in CMD Window | |
| 25 | ||
| 26 | """ | |
| 27 | # TODO | |
| 28 | # -Add Keybinds to select weapon loadout | |
| 29 | # -Tune Weapon Defs | |
| 30 | # -Add LMG Def | |
| 31 | # -Add Couch Peek | |
| 32 | # -Add type checker in Quick_Shoot to check if pump or rocket, etc | |
| 33 | # -Add Key Handlers like jump, escape, map, inventory, build, edit, crouch, reload | |
| 34 | # -Add Turbofarming | |
| 35 | ||
| 36 | # -Add Fast_Shoot time to Weapon Defs | |
| 37 | # -Add Crouch Modifier to Weapon Defs | |
| 38 | ||
| 39 | #Current Bugs; | |
| 40 | ||
| 41 | #Bug #1: | |
| 42 | #Effect: When Hip Firing with Recoil compensation aiming the weapon upward causes the anti recoil to over compensate. | |
| 43 | ||
| 44 | #Imports: | |
| 45 | from time import gmtime, strftime, sleep, time | |
| 46 | from ctypes import windll, c_uint, Structure, c_long, byref | |
| 47 | from win32api import GetKeyState, GetAsyncKeyState | |
| 48 | import mouse | |
| 49 | import keyboard | |
| 50 | import weapon | |
| 51 | ||
| 52 | #Weapon_Tables Init | |
| 53 | nowep = weapon.Weapon("None") | |
| 54 | Pickaxe = weapon.Weapon("Pickaxe") | |
| 55 | AR = weapon.Weapon("AR") | |
| 56 | SCAR = weapon.Weapon("SCAR") | |
| 57 | BURST = weapon.Weapon("BURST") | |
| 58 | PUMP = weapon.Weapon("PUMP") | |
| 59 | TAC = weapon.Weapon("TAC") | |
| 60 | HEAVY = weapon.Weapon("HEAVY") | |
| 61 | SMG = weapon.Weapon("SMG") | |
| 62 | S_SMG = weapon.Weapon("S_SMG") | |
| 63 | TOMMYGUN = weapon.Weapon("TOMMYGUN") | |
| 64 | P90 = weapon.Weapon("P90") | |
| 65 | HR = weapon.Weapon("HR") | |
| 66 | BOLT = weapon.Weapon("BOLT") | |
| 67 | SAR = weapon.Weapon("SAR") | |
| 68 | ROCKET = weapon.Weapon("ROCKET") | |
| 69 | NADES = weapon.Weapon("NADES") | |
| 70 | HEAL = weapon.Weapon("HEAL") | |
| 71 | ||
| 72 | #Settings; | |
| 73 | ||
| 74 | #Debug: | |
| 75 | Debug = True #Debug Mode, used for Output of Debug Info. | |
| 76 | Debug_Movement = False #If Debug Mode is On, output Mouse Movement Info. | |
| 77 | Debug_Buttons = True #If Debug Mode is On, output Mouse Button Activity. | |
| 78 | Debug_Wheel = False #If Debug Mode is On, output Mouse Wheel Movement Info. | |
| 79 | Debug_Keyboard = False #If Debug Mode is On, output Keyboard Activity. | |
| 80 | ||
| 81 | ||
| 82 | #Features; | |
| 83 | ||
| 84 | #General: | |
| 85 | Option_AR_Perfect_Aim = False #If Enabled, causes constant First Shot Accuracy with AR when in ADS. | |
| 86 | Option_Fast_Weapon_Switch = True #If Enabled, causes the Weapon Pullout Animation Cancel to be done on every weapon switch. | |
| 87 | Option_Reload_Canceling = True #If Enabled, causes an Animation Cancel to occur if reloading when attempting to use. | |
| 88 | ||
| 89 | #Quick Shoot: | |
| 90 | Option_Quick_Shoot = True #If Enabled, allows an instant fire of a specific weapon choosen below. | |
| 91 | if Option_Quick_Shoot: | |
| 92 | Quick_Shoot_Default_Weapon = PUMP | |
| 93 | QuickShoot_Fire_Attempts = 40 #(Delay is 10ms so loop of 40 is around 400ms). | |
| 94 | ||
| 95 | #Turbo Use: | |
| 96 | Option_Turbo_Use = True #When Enabled, causes the use Key to Autofire when held down. | |
| 97 | Delay_Turbo_Use = 0.060 #Time inbetween autofire + the natural 20ms delay for the keypress. | |
| 98 | ||
| 99 | #Editing: | |
| 100 | Option_Fast_Edit_Reset = True #When the Reset Edit Button is Pressed, Instantly exit edit mode. | |
| 101 | ||
| 102 | #Ghost Peaking(TODO): | |
| 103 | Use_Ghost_Peaking = True #If Enabled, uses a Modifier Key to enable fast crouching while shooting. | |
| 104 | Ghost_Peak_Delay = 100 #Time between Ghost Peak Shots. | |
| 105 | ||
| 106 | #Fast Farming(TODO): | |
| 107 | Fast_Farming = False #If Enabled, Uses a Button to activate "Current Farming Exploit". | |
| 108 | Turbofarm_Activation_Window = 300 #Delay from pressing "Farming_Button" to start Normal Farming instead of turbo. | |
| 109 | Turbofarm_Fast_Swing_Delay = 200 | |
| 110 | Turbofarm_Emote_Time = 70 | |
| 111 | Turbofarm_Slow_Swing_Delay = 400 | |
| 112 | Turbofarm_Emote_Cancel_Delay = 300 | |
| 113 | STWAF = False #If Enabled, Switch to a Weapon of Choice after Farming. | |
| 114 | STWAF_WeaponSlot = 1 #Weapon to Switch to after Farming. | |
| 115 | ||
| 116 | #Anti Recoil: | |
| 117 | Use_No_Recoil_ADS = True #If Enabled, Reduces Recoil when ADS Firing. | |
| 118 | Use_No_Recoil_Hipfire = True #If Enabled, Reduces Recoil when Hip Firing. | |
| 119 | Use_Jitter = True #If Enabled, Moves the Aim back and forth while firing. | |
| 120 | ||
| 121 | #Weapon Slot Options | |
| 122 | Default_Ingame_Weapon_Slot1 = AR | |
| 123 | Default_Ingame_Weapon_Slot2 = PUMP | |
| 124 | Default_Ingame_Weapon_Slot3 = SMG | |
| 125 | Default_Ingame_Weapon_Slot4 = HR | |
| 126 | Default_Ingame_Weapon_Slot5 = HEAL | |
| 127 | ||
| 128 | #------------------------------- | |
| 129 | #Keybinds; | |
| 130 | #------------------------------- | |
| 131 | ||
| 132 | #Macro Related; | |
| 133 | #------------------------------- | |
| 134 | ||
| 135 | #General: | |
| 136 | Keybind_Fire = "left" #Key to Shoot Weapons. | |
| 137 | ||
| 138 | #Key to Fast Fire Pre Set Weapon. | |
| 139 | if Option_Quick_Shoot: | |
| 140 | Keybind_QuickShoot_Button = "x2" | |
| 141 | Keybind_QuickShoot_Button_Code = 0x06 | |
| 142 | ||
| 143 | Keybind_Enable = "middle" #Key to Enable/Disable the Macro. | |
| 144 | Keybind_Edit = "alt" #Desired Key to go into edit mode.(Must have In-game set to alternate). | |
| 145 | Keybind_Use = "f" #Desired key for Use. | |
| 146 | if Option_Turbo_Use: | |
| 147 | Keybind_Use_Key_Code = 0x46 | |
| 148 | ||
| 149 | #Weapon Keybinds Part 1 (Macro) | |
| 150 | #----------------------------------------------- | |
| 151 | #Set these to the same as in-game if not using fast weapon switching. | |
| 152 | #If using fast weapon switching set these to your desired keys for each slot- | |
| 153 | #and scroll down to set the alternate in game key binds so the fast switch can work. | |
| 154 | Keybind_Weapon_Slot1 = "2" | |
| 155 | Keybind_Weapon_Slot2 = "3" | |
| 156 | Keybind_Weapon_Slot3 = "4" | |
| 157 | Keybind_Weapon_Slot4 = "z" | |
| 158 | Keybind_Weapon_Slot5 = "x" | |
| 159 | Keybind_Weapon_Pickaxe = "l" | |
| 160 | ||
| 161 | #Ingame; | |
| 162 | #These Keybinds should match the ones set in game. | |
| 163 | #------------------------------- | |
| 164 | ||
| 165 | #General: | |
| 166 | Ingame_Keybind_Jump = "space" | |
| 167 | Ingame_Keybind_Crouch = "shift" #Ingame Keybind set for Crouch. | |
| 168 | Ingame_Keybind_Fire = "k" #Ingame Keybind set to Fire(Not Mouse1!!!). | |
| 169 | if Option_Turbo_Use: | |
| 170 | Ingame_Keybind_Use = "i" | |
| 171 | else: | |
| 172 | Ingame_Keybind_Use = Keybind_Use | |
| 173 | Ingame_Keybind_Reload = "r" | |
| 174 | ||
| 175 | #Weapon Keybinds Part 2 (In-game) | |
| 176 | # Fast Weapon Switching: | |
| 177 | #------------------------------------------------- | |
| 178 | #Used ONLY when Option_Fast_Weapon_Switch is Enabled. | |
| 179 | #Fast Weapon Switching is Required to have intermedary control over the weapon keys so- | |
| 180 | #they need to be set to something different in-game. | |
| 181 | #Ignore this Section if not using Fast Weapon Switching. | |
| 182 | if Option_Fast_Weapon_Switch == True: | |
| 183 | Ingame_Weapon_Slot1 = "p" | |
| 184 | Ingame_Weapon_Slot2 = "6" | |
| 185 | Ingame_Weapon_Slot3 = "7" | |
| 186 | Ingame_Weapon_Slot4 = "8" | |
| 187 | Ingame_Weapon_Slot5 = "9" | |
| 188 | Ingame_Weapon_Pickaxe = "0" | |
| 189 | else: | |
| 190 | Ingame_Weapon_Slot1 = Keybind_Weapon_Slot1 | |
| 191 | Ingame_Weapon_Slot2 = Keybind_Weapon_Slot2 | |
| 192 | Ingame_Weapon_Slot3 = Keybind_Weapon_Slot3 | |
| 193 | Ingame_Weapon_Slot4 = Keybind_Weapon_Slot4 | |
| 194 | Ingame_Weapon_Slot5 = Keybind_Weapon_Slot5 | |
| 195 | Ingame_Weapon_Pickaxe = Keybind_Weapon_Pickaxe | |
| 196 | ||
| 197 | #Other Weapons | |
| 198 | Weapon_Trap = "5" #Actual In-game Keybind used to select traps. | |
| 199 | ||
| 200 | #Building: | |
| 201 | Ingame_Keybind_Ramp = "e" #Actual Ingame Keybind set for Ramp. | |
| 202 | Ingame_Keybind_Wall = "x" #Actual Ingame Keybind set for Wall(Thumb Button 2 on Logetech G502). | |
| 203 | Ingame_Keybind_Platform = "q" #Actual Ingame Keybind set for Platform. | |
| 204 | Ingame_Keybind_Roof = "[" #Actual Ingame Keybind set for Roof. | |
| 205 | ||
| 206 | #Editing: | |
| 207 | Ingame_Keybind_Edit = "]" #Alternate Ingame Keybind set for Edit. | |
| 208 | Ingame_Keybind_Edit_Reset = "right" #Actual Ingame Keybind set for Edit Reset. | |
| 209 | ||
| 210 | #Emoting: | |
| 211 | Keybind_EmoteWheel_Up = "up" | |
| 212 | Keybind_EmoteWheel_Down = "down" | |
| 213 | Keybind_Emote = "n" | |
| 214 | Keybind_FastEmote1 = "f1" | |
| 215 | Keybind_FastEmote2 = "f2" | |
| 216 | Keybind_FastEmote3 = "f3" | |
| 217 | ||
| 218 | ||
| 219 | #Globals: | |
| 220 | global Running | |
| 221 | global Enabled | |
| 222 | global Current_Weapon | |
| 223 | global Current_Loadout | |
| 224 | global JitterFlop | |
| 225 | global Editing | |
| 226 | global Building | |
| 227 | global Crouching | |
| 228 | global Jumping | |
| 229 | global Reloading | |
| 230 | global Using | |
| 231 | ||
| 232 | #Main Functions; | |
| 233 | ||
| 234 | #Main Function: Gets run at start after init. | |
| 235 | def main(): | |
| 236 | # Print out a List of the Globals to Check Inits. | |
| 237 | DebugPrint('Printing Globals List:')
| |
| 238 | DebugPrintGlobals() | |
| 239 | ||
| 240 | #Hook Logical Mouse Events. | |
| 241 | DebugPrint('Hooking Mouse Input')
| |
| 242 | mouse.hook(Mouse_Input) | |
| 243 | ||
| 244 | #Hook Logical Keyboard Events. | |
| 245 | DebugPrint('Hooking Keyboard Input')
| |
| 246 | keyboard.hook(Keyboard_Input) | |
| 247 | ||
| 248 | ||
| 249 | #Helper Functions; | |
| 250 | ||
| 251 | #Move Mouse: Moves Mouse Relative to Current Location. | |
| 252 | def Move_Mouse(x, y): | |
| 253 | windll.user32.mouse_event( | |
| 254 | c_uint(0x0001), | |
| 255 | c_uint(x), | |
| 256 | c_uint(y), | |
| 257 | c_uint(0), | |
| 258 | c_uint(0) | |
| 259 | ) | |
| 260 | ||
| 261 | class POINT(Structure): | |
| 262 | _fields_ = [("x", c_long), ("y", c_long)] | |
| 263 | ||
| 264 | def queryMousePosition(): | |
| 265 | pt = POINT() | |
| 266 | windll.user32.GetCursorPos(byref(pt)) | |
| 267 | return pt | |
| 268 | ||
| 269 | #Cancel Anim: Cancels Weapon Switching Animation and Pickaxe Swings. | |
| 270 | def Cancel_Anim(Weapon, Emote_Bind): | |
| 271 | #Emote to cancel pull out animation. | |
| 272 | keyboard.press(Emote_Bind); | |
| 273 | sleep(0.100); | |
| 274 | #Switch to Desired Weapon. | |
| 275 | Switch_to_Weapon(Weapon) | |
| 276 | sleep(0.020); | |
| 277 | keyboard.release(Emote_Bind); | |
| 278 | sleep(0.030); | |
| 279 | ||
| 280 | #Converts Inventory Slot ID to actual weapon slot. | |
| 281 | def InvSlot_to_WeaponKeybind(InvSlot): | |
| 282 | if InvSlot == 0: | |
| 283 | return Ingame_Weapon_Slot1 | |
| 284 | if InvSlot == 1: | |
| 285 | return Ingame_Weapon_Slot2 | |
| 286 | if InvSlot == 2: | |
| 287 | return Ingame_Weapon_Slot3 | |
| 288 | if InvSlot == 3: | |
| 289 | return Ingame_Weapon_Slot4 | |
| 290 | if InvSlot == 4: | |
| 291 | return Ingame_Weapon_Slot5 | |
| 292 | ||
| 293 | #Check Quick Shoot Button Function. | |
| 294 | def isPressed_QuickShoot_Button(): | |
| 295 | QuickShoot_Button_State = GetKeyState(Keybind_QuickShoot_Button_Code) | |
| 296 | DebugPrint("MB6:{0}".format(QuickShoot_Button_State))
| |
| 297 | if QuickShoot_Button_State < 0: | |
| 298 | return True | |
| 299 | return False | |
| 300 | ||
| 301 | def Toggle_Enabled(): | |
| 302 | global Enabled | |
| 303 | if Enabled: | |
| 304 | Enabled = False | |
| 305 | else: | |
| 306 | Enabled = True | |
| 307 | DebugPrint("Enabled changed to {0}".format(Enabled))
| |
| 308 | ||
| 309 | #Debug PrintFunction: Print's Debug Output if Debug is Enabled. | |
| 310 | def DebugPrint(s): | |
| 311 | if Debug: | |
| 312 | print("{0}:{1}".format(strftime("%H:%M:%S", gmtime()),s));
| |
| 313 | ||
| 314 | def DebugPrintGlobals(): | |
| 315 | for k, v in globals().items(): | |
| 316 | print("{0} = {1}".format(k, v))
| |
| 317 | ||
| 318 | #Turbo Use Function: Sends the Use Event as long as the Use key is held down. | |
| 319 | def Turbo_Use(): | |
| 320 | global Reloading | |
| 321 | global Using | |
| 322 | ||
| 323 | #Check if we are Reloading and want to use Reload Canceling. | |
| 324 | if Reloading and Option_Reload_Canceling: | |
| 325 | #Since we are canceling the Reload, set global to false. | |
| 326 | Reloading = False | |
| 327 | Using = False | |
| 328 | ||
| 329 | #Switch Directly to Pickaxe to Cancel the Reload. | |
| 330 | keyboard.send(Ingame_Weapon_Pickaxe); | |
| 331 | sleep(0.020); | |
| 332 | ||
| 333 | #Switch Back to the Weapon we had before the Animation Cancel. | |
| 334 | Switch_to_Weapon(Current_Weapon) | |
| 335 | ||
| 336 | #Check if we are'nt already Using. | |
| 337 | if not Using: | |
| 338 | Using = True | |
| 339 | DebugPrint("Detected Use Action") | |
| 340 | ||
| 341 | #Handle Turbo Use Action. | |
| 342 | if Option_Turbo_Use: | |
| 343 | ||
| 344 | overrun = 400 | |
| 345 | #While Use Key is Down Loop. | |
| 346 | while True: | |
| 347 | #Overrun Protection. | |
| 348 | overrun = overrun - 1 | |
| 349 | if overrun == 0: | |
| 350 | break | |
| 351 | ||
| 352 | sleep(0.020) #Sleep To prevent GetKeyState Lockup. | |
| 353 | ||
| 354 | if windll.user32.GetKeyState(Keybind_Use_Key_Code) >= 0: | |
| 355 | break | |
| 356 | ||
| 357 | DebugPrint("Sending Turbo Use Action") | |
| 358 | ||
| 359 | #Send Use Action. | |
| 360 | keyboard.press(Ingame_Keybind_Use) | |
| 361 | sleep(0.020) | |
| 362 | keyboard.release(Ingame_Keybind_Use) | |
| 363 | ||
| 364 | #Delay a Pre Set amount. | |
| 365 | sleep(Delay_Turbo_Use) | |
| 366 | else: | |
| 367 | print("Sending Use Action") | |
| 368 | keyboard.send(Ingame_Keybind_Use) | |
| 369 | sleep(0.080) | |
| 370 | ||
| 371 | ||
| 372 | #Shooting Functions; | |
| 373 | ||
| 374 | #Quick_Shoot: Quick Switches to Desired Weapon, pulls trigger and then switches back. | |
| 375 | def Quick_Shoot(Weapon): | |
| 376 | global Editing | |
| 377 | global Building | |
| 378 | global Reloading | |
| 379 | ||
| 380 | #Set Building and Editing to False since we are now shooting. | |
| 381 | Building = False | |
| 382 | Editing = False | |
| 383 | ||
| 384 | #Store our Current Weapon so we can return to it after Quick. | |
| 385 | OldWeapon = Current_Weapon | |
| 386 | print("Insta Shooting {0}".format(Weapon.name))
| |
| 387 | ||
| 388 | #Loop Until Button is Detected | |
| 389 | while True: | |
| 390 | if not isPressed_QuickShoot_Button(): | |
| 391 | break #Break to Handle Quick Shoot. | |
| 392 | sleep(0.100) | |
| 393 | ||
| 394 | #Check if we are ADS | |
| 395 | MB2_State = GetKeyState(0x02) | |
| 396 | DebugPrint("Checking for MB2 or Reload") | |
| 397 | if MB2_State < 0 or Reloading: | |
| 398 | #We are ADS and trying to shoot with No Recoil. | |
| 399 | DebugPrint("Detected MB2 for ADS or Reloading") | |
| 400 | keyboard.send(Ingame_Weapon_Pickaxe); | |
| 401 | sleep(0.020); | |
| 402 | ||
| 403 | #Since we are shooting and have canceled any reload anim by now set it to false. | |
| 404 | Reloading = False | |
| 405 | ||
| 406 | #Emote to cancel pull out animation. | |
| 407 | Cancel_Anim(Weapon, Keybind_FastEmote3) | |
| 408 | ||
| 409 | count = 0 | |
| 410 | #Loop while Attempting to Fire at a specified count. | |
| 411 | while True: | |
| 412 | count = count + 1 | |
| 413 | if count == QuickShoot_Fire_Attempts: | |
| 414 | break #Break when we have hit the end of the delay. | |
| 415 | #Send Fire Event. | |
| 416 | keyboard.send(Ingame_Keybind_Fire) | |
| 417 | DebugPrint("Firing Fast") | |
| 418 | sleep(0.010) | |
| 419 | #Switch back to Weapon that was Active before the Fast Shoot. | |
| 420 | Switch_to_Weapon(OldWeapon) | |
| 421 | sleep(0.100) | |
| 422 | #Check if MB1 is still down. | |
| 423 | Handle_MB1_Down() | |
| 424 | ||
| 425 | #Fire: Handles No Recoil and Anti Bloom | |
| 426 | def Fire(ADS, Recoil): | |
| 427 | global JitterFlop | |
| 428 | global Crouching | |
| 429 | global Reloading | |
| 430 | ||
| 431 | #Init Locals | |
| 432 | local_Jitter = 0 | |
| 433 | local_Jitter_ADS = 0 | |
| 434 | ||
| 435 | #We are Shooting and not reloading so set global to False | |
| 436 | Reloading = False | |
| 437 | ||
| 438 | Local_Mouse_Pos = queryMousePosition() | |
| 439 | ||
| 440 | DebugPrint("Sending Simulated Fire Event") | |
| 441 | keyboard.press(Ingame_Keybind_Fire) #Send the input to fire the weapon | |
| 442 | sleep(0.020) #Delay to ensure the fire button gets recognized by the game | |
| 443 | ||
| 444 | if Current_Weapon.name != "Pickaxe" and (Current_Weapon.type == "AR" or Current_Weapon.type == "SMG"): | |
| 445 | ||
| 446 | #We are Shooting with Fire Button Down and without a Pickaxe | |
| 447 | if Current_Weapon.ControlFireRate: | |
| 448 | #Release the Fire Button if we are controlling Fire Rate | |
| 449 | keyboard.release(Ingame_Keybind_Fire) | |
| 450 | ||
| 451 | #If Fire has beeen called with the Recoil Bool then we can compensate | |
| 452 | if Recoil: | |
| 453 | #We are not Pickaxing and wanting to use Jitter so set it based on weapon | |
| 454 | if Use_Jitter: | |
| 455 | if JitterFlop == False: | |
| 456 | JitterFlop = True | |
| 457 | local_Jitter = Current_Weapon.jitter | |
| 458 | local_Jitter_ADS = Current_Weapon.jitter_ADS | |
| 459 | else: | |
| 460 | JitterFlop = False | |
| 461 | local_Jitter = Current_Weapon.jitter * -1 | |
| 462 | local_Jitter_ADS = Current_Weapon.jitter_ADS * -1 | |
| 463 | if Current_Weapon.firstshot == 0: | |
| 464 | Current_Weapon.firstshot = time() | |
| 465 | print("firstshot: {0}".format(time()))
| |
| 466 | if ADS: | |
| 467 | #mouse.move(local_Jitter_ADS, Current_Weapon.recoil_ADS_Static, absolute=False, duration=Current_Weapon.update_time_ADS) | |
| 468 | Move_Mouse(local_Jitter_ADS, Current_Weapon.recoil_ADS_Init) | |
| 469 | else: | |
| 470 | print("current coursor pos: X:{0}, Y:{1}".format(Local_Mouse_Pos.x, Local_Mouse_Pos.y))
| |
| 471 | Move_Mouse(local_Jitter, Current_Weapon.recoil_Hip_Init) | |
| 472 | else: | |
| 473 | difference = time() - Current_Weapon.firstshot | |
| 474 | print("Not firstshot, Difference: {0}".format(difference))
| |
| 475 | if ADS: | |
| 476 | #mouse.move(local_Jitter_ADS, Current_Weapon.recoil_ADS_Static, absolute=False, duration=Current_Weapon.update_time_ADS) | |
| 477 | if difference >= Current_Weapon.recoil_ADS_Init_Delay: | |
| 478 | Move_Mouse(local_Jitter_ADS, Current_Weapon.recoil_ADS_Static) | |
| 479 | else: | |
| 480 | Move_Mouse(local_Jitter_ADS, Current_Weapon.recoil_ADS_Init) | |
| 481 | else: | |
| 482 | if difference >= Current_Weapon.recoil_Hip_Init_Delay: | |
| 483 | print("current coursor pos: X:{0}, Y:{1}".format(Local_Mouse_Pos.x, Local_Mouse_Pos.y))
| |
| 484 | Move_Mouse(local_Jitter, Current_Weapon.recoil_Hip_Static) | |
| 485 | else: | |
| 486 | print("current coursor pos: X:{0}, Y:{1}".format(Local_Mouse_Pos.x, Local_Mouse_Pos.y))
| |
| 487 | Move_Mouse(local_Jitter, Current_Weapon.recoil_Hip_Init) | |
| 488 | #mouse.move(local_Jitter, Current_Weapon.recoil_Hip_Static, absolute=False, duration=Current_Weapon.update_time) | |
| 489 | DebugPrint("Done Sending Simulated Fire Event") | |
| 490 | ||
| 491 | #Switch to Weapon: Finds Weapon in Current Loadout and Switches to it | |
| 492 | def Switch_to_Weapon(Weapon): | |
| 493 | global Editing | |
| 494 | global Building | |
| 495 | global Current_Weapon | |
| 496 | global Reloading | |
| 497 | ||
| 498 | if Weapon == Current_Weapon and not Building and not Editing: | |
| 499 | return 2 #Return Error:2 Which means Weapon is Already Out. | |
| 500 | ||
| 501 | #Check if we are trying to switch to the Pickaxe. | |
| 502 | if Weapon.name == "Pickaxe": | |
| 503 | DebugPrint("Attempting to Switch Weapon to Pickaxe") | |
| 504 | ||
| 505 | #Send Event to Switch to Pickaxe. | |
| 506 | keyboard.send(Ingame_Weapon_Pickaxe) | |
| 507 | ||
| 508 | #Set the Global to the new weapon. | |
| 509 | Current_Weapon = Weapon | |
| 510 | ||
| 511 | #Reset Globals. | |
| 512 | Building = False | |
| 513 | Editing = False | |
| 514 | Reloading = False | |
| 515 | ||
| 516 | return 1 #Return 1 for Success. | |
| 517 | else: #We are trying to switch to another weapon other than the pickaxe. | |
| 518 | ||
| 519 | DebugPrint("Attempting to Switch Weapon\nSearching for Weapon:{0} in Current Loadout".format(Weapon.name))
| |
| 520 | ||
| 521 | #Parse the Players Current Loadout for the Weapon. | |
| 522 | for i in range(len(Current_Loadout)): | |
| 523 | DebugPrint("Checking Inventory Slot{0}\nFound: {1}".format(i, Current_Loadout[i].name))
| |
| 524 | ||
| 525 | if Current_Loadout[i].name == Weapon.name: | |
| 526 | DebugPrint("Found Weapon, Attempting Switch") | |
| 527 | ||
| 528 | #Switch to the Found weapon | |
| 529 | keyboard.send(InvSlot_to_WeaponKeybind(i)) | |
| 530 | ||
| 531 | #Set the Global to the new weapon. | |
| 532 | Current_Weapon = Weapon | |
| 533 | ||
| 534 | #Reset Globals. | |
| 535 | Building = False | |
| 536 | Editing = False | |
| 537 | Reloading = False | |
| 538 | ||
| 539 | return 1 #Return 1 for Success. | |
| 540 | elif i >= 5: #We have reached the end of the Loadout. | |
| 541 | break #Break to return 3 Error. | |
| 542 | return 3 #Return 3 Which means Unknown Error. | |
| 543 | ||
| 544 | #Handle Mouse Button 1 Down, Pretty much the Bread and Butter | |
| 545 | #TODO need to find a better way to check MB1, MB2 and MB6 so it doesnt use Win32API | |
| 546 | def Handle_MB1_Down(): | |
| 547 | ||
| 548 | #Locals | |
| 549 | ADS = False | |
| 550 | overrun = 0 | |
| 551 | ||
| 552 | #Debug Out | |
| 553 | DebugPrint("MB1 Event Detected") | |
| 554 | ||
| 555 | #Loop While MB1 is down and fast shoot button is not pressed | |
| 556 | while True: | |
| 557 | #Prevent Infinite Loop from an Overrun Error. | |
| 558 | overrun = overrun + 1 | |
| 559 | if overrun >= 4000: | |
| 560 | Current_Weapon.firstshot = 0 #Reset First Shot Timer | |
| 561 | keyboard.release(Ingame_Keybind_Fire) #Relase the Actual Fire Key | |
| 562 | break #Break if we hit overrun | |
| 563 | ||
| 564 | #Use Win32API to get state of MB1 and MB2 because mouse.is_pressed() is retarted | |
| 565 | MB1_State = GetKeyState(0x01) | |
| 566 | DebugPrint("Checking if MB1 is Still Down") | |
| 567 | #Check if MB1 is still down both Logically and Hardware Based | |
| 568 | if MB1_State >= 0 and GetAsyncKeyState(0x01) == 0: | |
| 569 | Current_Weapon.firstshot = 0 #Reset First Shot Timer | |
| 570 | DebugPrint("MB1 Button Released, State: {0}".format(MB1_State))
| |
| 571 | keyboard.release(Ingame_Keybind_Fire) #Relase the Actual Fire Key | |
| 572 | break #Break if we are not pressing MB1 Anymore | |
| 573 | else: | |
| 574 | DebugPrint("MB1 Still Detected, State: {0}".format(MB1_State))
| |
| 575 | ||
| 576 | #Check if we are in Pickaxe Mode | |
| 577 | if Current_Weapon.name == "Pickaxe": | |
| 578 | ||
| 579 | #Check if Quick Shoot Button is Pressed | |
| 580 | if isPressed_QuickShoot_Button() and Option_Quick_Shoot: | |
| 581 | break #Break to Handle Quick Shoot | |
| 582 | ||
| 583 | DebugPrint("Swinging Pickaxe") | |
| 584 | Fire(False, False) # Send Command to Swing Pickaxe | |
| 585 | ||
| 586 | #FastFarming would go here | |
| 587 | ||
| 588 | #if we are using Quick shoot then we need to check every 10ms during the pickaxe swing delay | |
| 589 | if Option_Quick_Shoot: | |
| 590 | count = 20 # 20x10ms = 200ms (Current Optimal Pickaxe Swingtime) | |
| 591 | while True: | |
| 592 | count = count - 1 | |
| 593 | if count <= 0: | |
| 594 | break #Break to Swing the Axe again | |
| 595 | if isPressed_QuickShoot_Button(): | |
| 596 | break #Break to Handle Quick Shoot | |
| 597 | sleep(0.010) | |
| 598 | else: #Not using Quickshoot so just delay 200ms | |
| 599 | sleep(0.200) | |
| 600 | ||
| 601 | else: # Trying to Fire something that is not a pickaxe | |
| 602 | ||
| 603 | #Check if we are trying to Quick Shoot | |
| 604 | if isPressed_QuickShoot_Button() and Option_Quick_Shoot: | |
| 605 | Current_Weapon.firstshot = 0 #Reset First Shot Timer | |
| 606 | if not Current_Weapon.ControlFireRate: #Fire Key may still be Down from Last Fire() so release it. | |
| 607 | keyboard.release(Ingame_Keybind_Fire) | |
| 608 | break #Break to Handle Quick Shoot | |
| 609 | ||
| 610 | #Check if we are ADS. | |
| 611 | MB2_State = GetKeyState(0x02) | |
| 612 | DebugPrint("Checking for MB2") | |
| 613 | #Check for MB2 both Logically and Hardware Based | |
| 614 | if MB2_State < 0 and GetAsyncKeyState(0x02) == 1: | |
| 615 | #We are ADS and trying to shoot with No Recoil | |
| 616 | DebugPrint("MB2 is Detected, Setting ADS to True") | |
| 617 | ADS = True | |
| 618 | else: | |
| 619 | ADS = False | |
| 620 | ||
| 621 | #Check if we should use anti recoil for hipfire | |
| 622 | if Use_No_Recoil_Hipfire and not ADS: | |
| 623 | #Hipfire No Recoil | |
| 624 | DebugPrint("Hipfire Reducing") | |
| 625 | Fire(False, True) | |
| 626 | ||
| 627 | #Check if we are trying to Quick Shoot | |
| 628 | if isPressed_QuickShoot_Button() and Option_Quick_Shoot: | |
| 629 | Current_Weapon.firstshot = 0 #Reset First Shot Timer | |
| 630 | if not Current_Weapon.ControlFireRate: #Fire Key may still be Down from Last Fire() so release it. | |
| 631 | keyboard.release(Ingame_Keybind_Fire) | |
| 632 | break #Break to Handle Quick Shoot | |
| 633 | ||
| 634 | #Delay for the set amount of time in the Weapon Def | |
| 635 | sleep(Current_Weapon.update_time) | |
| 636 | elif ADS and Use_No_Recoil_ADS: | |
| 637 | #ADS, No Recoil | |
| 638 | DebugPrint("ADS Reducing") | |
| 639 | Fire(True, True) | |
| 640 | ||
| 641 | #Check if we are trying to Quick Shoot | |
| 642 | if isPressed_QuickShoot_Button() and Option_Quick_Shoot: | |
| 643 | Current_Weapon.firstshot = 0 #Reset First Shot Timer | |
| 644 | if not Current_Weapon.ControlFireRate: #Fire Key may still be Down from Last Fire() so release it. | |
| 645 | keyboard.release(Ingame_Keybind_Fire) | |
| 646 | break #Break to Handle Quick Shoot | |
| 647 | ||
| 648 | #Delay for the set amount of time in the Weapon Def | |
| 649 | sleep(Current_Weapon.update_time_ADS) | |
| 650 | else: | |
| 651 | #No Recoil Mode Off | |
| 652 | DebugPrint("Not Reducing") | |
| 653 | Fire(False, False) | |
| 654 | ||
| 655 | #Check if we are trying to Quick Shoot | |
| 656 | if isPressed_QuickShoot_Button() and Option_Quick_Shoot: | |
| 657 | Current_Weapon.firstshot = 0 #Reset First Shot Timer | |
| 658 | if not Current_Weapon.ControlFireRate: #Fire Key may still be Down from Last Fire() so release it. | |
| 659 | keyboard.release(Ingame_Keybind_Fire) | |
| 660 | break #Break to Handle Quick Shoot | |
| 661 | ||
| 662 | #Delay for the set amount of time in the Weapon Def | |
| 663 | sleep(Current_Weapon.delay_time) | |
| 664 | ||
| 665 | # if Current_Weapon.ControlFireRate == False: | |
| 666 | # Current_Weapon.firstshot = 0 | |
| 667 | # keyboard.release(Ingame_Keybind_Fire) | |
| 668 | # break | |
| 669 | ||
| 670 | #Keyboard Hook Callback Function: Gets run when Keyboard activity is detected. | |
| 671 | def Keyboard_Input(Keyboard_Event): | |
| 672 | global Editing | |
| 673 | global Building | |
| 674 | global Crouching | |
| 675 | global Jumping | |
| 676 | global Reloading | |
| 677 | global Using | |
| 678 | ||
| 679 | if type(Keyboard_Event) == keyboard._keyboard_event.KeyboardEvent: | |
| 680 | #Debug Output | |
| 681 | if Debug_Keyboard: | |
| 682 | DebugPrint("Keyboard_Event: Key:{0},Scancode:{1}, Action:{2},Modifier:{3} Time:{4}".format(Keyboard_Event.name,Keyboard_Event.scan_code, Keyboard_Event.event_type, Keyboard_Event.modifiers, Keyboard_Event.time))
| |
| 683 | ||
| 684 | #Weapon Slot 1 | |
| 685 | if Keyboard_Event.name == Keybind_Weapon_Slot1 and Keyboard_Event.event_type == "down" and Enabled: | |
| 686 | ||
| 687 | #Get Weapon in Slot 1 of Inventory | |
| 688 | TargetWeapon = Current_Loadout[0] | |
| 689 | ||
| 690 | #Check if we should try and Fast Switch the Weapon | |
| 691 | if Option_Fast_Weapon_Switch and TargetWeapon.type != "Heal" and TargetWeapon.type != "Nade": | |
| 692 | if TargetWeapon != Current_Weapon or (Building or Editing): | |
| 693 | Cancel_Anim(TargetWeapon, Keybind_FastEmote3) | |
| 694 | else: | |
| 695 | DebugPrint("Error when attempting to fast switch: Weapon Already Selected") | |
| 696 | else: | |
| 697 | #If we are in the middle of a reload then Cancel by switching to Pickaxe | |
| 698 | if Reloading: | |
| 699 | Reloading = False | |
| 700 | keyboard.send(Ingame_Weapon_Pickaxe); | |
| 701 | sleep(0.020); | |
| 702 | Switch_to_Weapon(TargetWeapon) | |
| 703 | ||
| 704 | #Weapon Slot 2 | |
| 705 | elif Keyboard_Event.name == Keybind_Weapon_Slot2 and Keyboard_Event.event_type == "down" and Enabled: | |
| 706 | ||
| 707 | #Get Weapon in Slot 2 of Inventory | |
| 708 | TargetWeapon = Current_Loadout[1] | |
| 709 | ||
| 710 | #Check if we should try and Fast Switch the Weapon | |
| 711 | if Option_Fast_Weapon_Switch and TargetWeapon.type != "Heal" and TargetWeapon.type != "Nade": | |
| 712 | if TargetWeapon != Current_Weapon or (Building or Editing): | |
| 713 | Cancel_Anim(TargetWeapon, Keybind_FastEmote3) | |
| 714 | else: | |
| 715 | DebugPrint("Error when attempting to fast switch: Weapon Already Selected") | |
| 716 | else: | |
| 717 | #If we are in the middle of a reload then Cancel by switching to Pickaxe | |
| 718 | if Reloading: | |
| 719 | Reloading = False | |
| 720 | keyboard.send(Ingame_Weapon_Pickaxe); | |
| 721 | sleep(0.020); | |
| 722 | Switch_to_Weapon(TargetWeapon) | |
| 723 | ||
| 724 | #Weapon Slot 3 | |
| 725 | elif Keyboard_Event.name == Keybind_Weapon_Slot3 and Keyboard_Event.event_type == "down" and Enabled: | |
| 726 | ||
| 727 | #Get Weapon in Slot 3 of Inventory | |
| 728 | TargetWeapon = Current_Loadout[2] | |
| 729 | ||
| 730 | #Check if we should try and Fast Switch the Weapon | |
| 731 | if Option_Fast_Weapon_Switch and TargetWeapon.type != "Heal" and TargetWeapon.type != "Nade": | |
| 732 | if TargetWeapon != Current_Weapon or (Building or Editing): | |
| 733 | Cancel_Anim(TargetWeapon, Keybind_FastEmote3) | |
| 734 | else: | |
| 735 | DebugPrint("Error when attempting to fast switch: Weapon Already Selected") | |
| 736 | else: | |
| 737 | #If we are in the middle of a reload then Cancel by switching to Pickaxe | |
| 738 | if Reloading: | |
| 739 | Reloading = False | |
| 740 | keyboard.send(Ingame_Weapon_Pickaxe); | |
| 741 | sleep(0.020); | |
| 742 | Switch_to_Weapon(TargetWeapon) | |
| 743 | ||
| 744 | #Weapon Slot 4 | |
| 745 | elif Keyboard_Event.name == Keybind_Weapon_Slot4 and Keyboard_Event.event_type == "down" and Enabled: | |
| 746 | ||
| 747 | #Get Weapon in Slot 4 of Inventory | |
| 748 | TargetWeapon = Current_Loadout[3] | |
| 749 | ||
| 750 | #Check if we should try and Fast Switch the Weapon | |
| 751 | if Option_Fast_Weapon_Switch and TargetWeapon.type != "Heal" and TargetWeapon.type != "Nade": | |
| 752 | if TargetWeapon != Current_Weapon or (Building or Editing): | |
| 753 | Cancel_Anim(TargetWeapon, Keybind_FastEmote3) | |
| 754 | else: | |
| 755 | DebugPrint("Error when attempting to fast switch: Weapon Already Selected") | |
| 756 | else: | |
| 757 | #If we are in the middle of a reload then Cancel by switching to Pickaxe | |
| 758 | if Reloading: | |
| 759 | Reloading = False | |
| 760 | keyboard.send(Ingame_Weapon_Pickaxe); | |
| 761 | sleep(0.020); | |
| 762 | Switch_to_Weapon(TargetWeapon) | |
| 763 | ||
| 764 | #Weapon Slot 5 | |
| 765 | elif Keyboard_Event.name == Keybind_Weapon_Slot5 and Keyboard_Event.event_type == "down" and Enabled: | |
| 766 | ||
| 767 | #Get Weapon in Slot one of Inventory | |
| 768 | TargetWeapon = Current_Loadout[4] | |
| 769 | ||
| 770 | #Check if we should try and Fast Switch the Weapon | |
| 771 | if Option_Fast_Weapon_Switch and TargetWeapon.type != "Heal" and TargetWeapon.type != "Nade": | |
| 772 | if TargetWeapon != Current_Weapon or (Building or Editing): | |
| 773 | Cancel_Anim(TargetWeapon, Keybind_FastEmote3) | |
| 774 | else: | |
| 775 | DebugPrint("Error when attempting to fast switch: Weapon Already Selected") | |
| 776 | else: | |
| 777 | #If we are in the middle of a reload then Cancel by switching to Pickaxe | |
| 778 | if Reloading: | |
| 779 | Reloading = False | |
| 780 | keyboard.send(Ingame_Weapon_Pickaxe); | |
| 781 | sleep(0.020); | |
| 782 | Switch_to_Weapon(TargetWeapon) | |
| 783 | ||
| 784 | #Weapon Slot Pickaxe | |
| 785 | elif Keyboard_Event.name == Keybind_Weapon_Pickaxe and Keyboard_Event.event_type == "down" and Enabled: | |
| 786 | ||
| 787 | #Check if we should try and Fast Switch the Weapon | |
| 788 | if Option_Fast_Weapon_Switch: | |
| 789 | if Pickaxe != Current_Weapon or (Building or Editing): | |
| 790 | Cancel_Anim(Pickaxe, Keybind_FastEmote3) | |
| 791 | else: | |
| 792 | DebugPrint("Error when attempting to fast switch: Weapon Already Selected") | |
| 793 | else: | |
| 794 | Switch_to_Weapon(Pickaxe) | |
| 795 | ||
| 796 | #Edit Keybind Handling | |
| 797 | elif Keyboard_Event.name == Keybind_Edit and Keyboard_Event.event_type == "down" and Enabled: | |
| 798 | #Set the Edit flag | |
| 799 | if not Editing: | |
| 800 | keyboard.send(Ingame_Keybind_Edit) | |
| 801 | DebugPrint("Detected Editing") | |
| 802 | Editing = True | |
| 803 | elif Keyboard_Event.name == Keybind_Edit and Keyboard_Event.event_type == "up" and Enabled: | |
| 804 | #Set the Edit flag | |
| 805 | if Editing: | |
| 806 | keyboard.send(Ingame_Keybind_Edit) | |
| 807 | DebugPrint("Finished Editing") | |
| 808 | Editing = False | |
| 809 | ||
| 810 | #Building Keybind Handling | |
| 811 | elif Keyboard_Event.name == Ingame_Keybind_Ramp and Keyboard_Event.event_type == "down" and Enabled: | |
| 812 | DebugPrint("Detected Building") | |
| 813 | #Set the Building flag | |
| 814 | Building = True | |
| 815 | elif Keyboard_Event.name == Ingame_Keybind_Platform and Keyboard_Event.event_type == "down" and Enabled: | |
| 816 | DebugPrint("Detected Building") | |
| 817 | #Set the Building flag | |
| 818 | Building = True | |
| 819 | elif Keyboard_Event.name == Ingame_Keybind_Roof and Keyboard_Event.event_type == "down" and Enabled: | |
| 820 | DebugPrint("Detected Building") | |
| 821 | #Set the Building flag | |
| 822 | Building = True | |
| 823 | ||
| 824 | #Cruching Keybind Handling | |
| 825 | elif Keyboard_Event.name == Ingame_Keybind_Crouch and Keyboard_Event.event_type == "down" and Enabled: | |
| 826 | DebugPrint("Detected Crouching") | |
| 827 | #Set the Building flag | |
| 828 | if Crouching: | |
| 829 | Crouching = False | |
| 830 | else: | |
| 831 | Crouching = True | |
| 832 | ||
| 833 | #Jumping Keybind Handling | |
| 834 | elif Keyboard_Event.name == Ingame_Keybind_Jump and Keyboard_Event.event_type == "down" and Enabled: | |
| 835 | DebugPrint("Detected Jumping") | |
| 836 | #Set the Jumping Global to Current Time. | |
| 837 | Jumping = time() | |
| 838 | #Set the Crouching Global to False since if jumping we are not crouching. | |
| 839 | Crouching = False | |
| 840 | ||
| 841 | #Reload Keybind Handling | |
| 842 | elif Keyboard_Event.name == Ingame_Keybind_Reload and Keyboard_Event.event_type == "down" and Enabled: | |
| 843 | DebugPrint("Detected Reloading") | |
| 844 | Reloading = True | |
| 845 | ||
| 846 | #Use Keybind Handling | |
| 847 | elif Keyboard_Event.name == Keybind_Use and Keyboard_Event.event_type == "down" and Enabled: | |
| 848 | Turbo_Use() | |
| 849 | elif Keyboard_Event.name == Keybind_Use and Keyboard_Event.event_type == "up" and Enabled: | |
| 850 | Using = False | |
| 851 | DebugPrint("Detected End of Use Action") | |
| 852 | ||
| 853 | #Mouse Hook Callback Function: Gets run when Mouse activity is detected. | |
| 854 | def Mouse_Input(Mouse_Event): | |
| 855 | global Editing | |
| 856 | global Building | |
| 857 | ||
| 858 | if Running: | |
| 859 | #Mouse Wheel Event. | |
| 860 | if type(Mouse_Event) == mouse._mouse_event.MoveEvent: | |
| 861 | if Debug_Movement: | |
| 862 | DebugPrint("Move_Event: x:{0}, y:{1}, Time:{2}".format(Mouse_Event.x, Mouse_Event.y, Mouse_Event.time))
| |
| 863 | ||
| 864 | #Mouse Button Event. | |
| 865 | elif type(Mouse_Event) == mouse._mouse_event.ButtonEvent: | |
| 866 | ||
| 867 | if Debug_Buttons: | |
| 868 | DebugPrint("Button_Event: Type:{0}, Button:{1}, Time:{2}".format(Mouse_Event.event_type, Mouse_Event.button, Mouse_Event.time))
| |
| 869 | ||
| 870 | #Handle MouseButton1 Down Event | |
| 871 | if Mouse_Event.event_type == "down" and Mouse_Event.button == Keybind_Fire and Enabled: | |
| 872 | #Only Handle MB1 for Weapons so if building or editing then we dont want to control it. | |
| 873 | if not Editing and not Building: | |
| 874 | Handle_MB1_Down() | |
| 875 | ||
| 876 | #Handle MouseButton2 Down Event | |
| 877 | elif Mouse_Event.event_type == "down" and Mouse_Event.button == Ingame_Keybind_Edit_Reset and Enabled: | |
| 878 | #Fast Edit Reset: | |
| 879 | if Editing and Option_Fast_Edit_Reset: | |
| 880 | ||
| 881 | #If we are editing and right click with Fast Reset enabled then exit edit mode. | |
| 882 | keyboard.send(Ingame_Keybind_Edit) | |
| 883 | DebugPrint("Finished Editing with Quick Reset") | |
| 884 | Editing = False | |
| 885 | ||
| 886 | #Handle Quick Switch Weapon | |
| 887 | elif Mouse_Event.event_type == "down" and Mouse_Event.button == Keybind_QuickShoot_Button and Enabled: | |
| 888 | Quick_Shoot(PUMP) | |
| 889 | ||
| 890 | #Handle Enable Eventv | |
| 891 | elif Mouse_Event.event_type == "down" and Mouse_Event.button == Keybind_Enable: | |
| 892 | Toggle_Enabled() | |
| 893 | ||
| 894 | #Handle Building Event | |
| 895 | elif Mouse_Event.event_type == "down" and Mouse_Event.button == Ingame_Keybind_Wall: | |
| 896 | DebugPrint("Detected Building") | |
| 897 | Building = True | |
| 898 | ||
| 899 | elif type(Mouse_Event) == mouse._mouse_event.WheelEvent: | |
| 900 | if Debug_Wheel: | |
| 901 | DebugPrint("Wheel_Event: Delta:{0}, Time:{1}".format(Mouse_Event.delta, Mouse_Event.time))
| |
| 902 | ||
| 903 | def Init_Weapons(): | |
| 904 | #AR | |
| 905 | #Info; | |
| 906 | #Advertised Fire Rate = 181.81ms (5.5) | |
| 907 | AR.recoil_Hip_Init = 21 | |
| 908 | AR.recoil_Hip_Init_Delay = 0.340 | |
| 909 | AR.recoil_Hip_Static = 23 | |
| 910 | AR.recoil_ADS_Init = 30 | |
| 911 | AR.recoil_ADS_Init_Delay = 0.330 | |
| 912 | AR.recoil_ADS_Static = 1 | |
| 913 | AR.jitter = 0 | |
| 914 | AR.jitter_ADS = 0 | |
| 915 | AR.update_time = 0.040 #+0.020 | |
| 916 | if Option_AR_Perfect_Aim: | |
| 917 | AR.update_time_ADS = 0.330 | |
| 918 | else: | |
| 919 | AR.update_time_ADS = 0.040 | |
| 920 | AR.firstshot = 0.0 | |
| 921 | AR.ControlFireRate = True | |
| 922 | AR.type = "AR" | |
| 923 | #SCAR | |
| 924 | SCAR.recoil_Hip_Init = 21 | |
| 925 | SCAR.recoil_Hip_Init_Delay = 0.340 | |
| 926 | SCAR.recoil_Hip_Static = 23 | |
| 927 | SCAR.recoil_ADS_Init = 30 | |
| 928 | SCAR.recoil_ADS_Init_Delay = 0.330 | |
| 929 | SCAR.recoil_ADS_Static = 1 | |
| 930 | SCAR.jitter = 0 | |
| 931 | SCAR.jitter_ADS = 0 | |
| 932 | SCAR.update_time = 0.040 | |
| 933 | SCAR.update_time_ADS = 0.330 | |
| 934 | SCAR.firstshot = 0.0 | |
| 935 | SCAR.ControlFireRate = True | |
| 936 | SCAR.type = "AR" | |
| 937 | #BURST | |
| 938 | BURST.recoil_Hip_Init = 150 | |
| 939 | BURST.recoil_Hip_Static = 100 | |
| 940 | BURST.recoil_ADS_Init = 125 | |
| 941 | BURST.recoil_ADS_Static = 70 | |
| 942 | BURST.jitter = 2 | |
| 943 | BURST.jitter_ADS = 2 | |
| 944 | BURST.update_time = 10 | |
| 945 | BURST.update_time_ADS = 10 | |
| 946 | BURST.firstshot = 0 | |
| 947 | BURST.type = "AR" | |
| 948 | #PUMP | |
| 949 | PUMP.firstshot = 0 | |
| 950 | PUMP.type = "Shotgun" | |
| 951 | #TAC | |
| 952 | TAC.firstshot = 0 | |
| 953 | TAC.type = "Shotgun" | |
| 954 | #HEAVY | |
| 955 | HEAVY.firstshot = 0 | |
| 956 | HEAVY.type = "Shotgun" | |
| 957 | #SMG | |
| 958 | SMG.recoil_Hip_Init = 4 | |
| 959 | SMG.recoil_Hip_Init_Delay = 0.160 | |
| 960 | SMG.recoil_Hip_Static = 8 | |
| 961 | SMG.recoil_ADS_Init = 5 | |
| 962 | SMG.recoil_ADS_Init_Delay = 0.160 | |
| 963 | SMG.recoil_ADS_Static = 1 | |
| 964 | SMG.jitter = 10 | |
| 965 | SMG.jitter_ADS = 2 | |
| 966 | SMG.update_time = 0.010 | |
| 967 | SMG.update_time_ADS = 0.010 | |
| 968 | SMG.firstshot = 0.0 | |
| 969 | SMG.ControlFireRate = False | |
| 970 | SMG.type = "SMG" | |
| 971 | #SILENCEDSMG | |
| 972 | S_SMG.recoil_Hip_Init = 150 | |
| 973 | S_SMG.recoil_Hip_Static = 100 | |
| 974 | S_SMG.recoil_ADS_Init = 125 | |
| 975 | S_SMG.recoil_ADS_Static = 70 | |
| 976 | S_SMG.jitter = 2 | |
| 977 | S_SMG.jitter_ADS = 2 | |
| 978 | S_SMG.update_time = 10 | |
| 979 | S_SMG.update_time_ADS = 10 | |
| 980 | S_SMG.firstshot = 0 | |
| 981 | S_SMG.type = "SMG" | |
| 982 | #TOMMYGUN | |
| 983 | TOMMYGUN.recoil_Hip_Init = 150 | |
| 984 | TOMMYGUN.recoil_Hip_Static = 100 | |
| 985 | TOMMYGUN.recoil_ADS_Init = 125 | |
| 986 | TOMMYGUN.recoil_ADS_Static = 70 | |
| 987 | TOMMYGUN.jitter = 2 | |
| 988 | TOMMYGUN.jitter_ADS = 2 | |
| 989 | TOMMYGUN.update_time = 10 | |
| 990 | TOMMYGUN.update_time_ADS = 10 | |
| 991 | TOMMYGUN.firstshot = 0 | |
| 992 | TOMMYGUN.type = "SMG" | |
| 993 | #P90 | |
| 994 | P90.recoil_Hip_Init = 150 | |
| 995 | P90.recoil_Hip_Static = 100 | |
| 996 | P90.recoil_ADS_Init = 125 | |
| 997 | P90.recoil_ADS_Static = 70 | |
| 998 | P90.jitter = 2 | |
| 999 | P90.jitter_ADS = 2 | |
| 1000 | P90.update_time = 10 | |
| 1001 | P90.update_time_ADS = 10 | |
| 1002 | P90.firstshot = 0 | |
| 1003 | P90.type = "SMG" | |
| 1004 | #Hunting Rifle | |
| 1005 | HR.firstshot = 0 | |
| 1006 | HR.type = "Sniper" | |
| 1007 | #Bolt Rifle | |
| 1008 | BOLT.firstshot = 0 | |
| 1009 | BOLT.type = "Sniper" | |
| 1010 | #Scoped AR | |
| 1011 | SAR.firstshot = 0 | |
| 1012 | SAR.type = "Sniper" | |
| 1013 | #Rockets | |
| 1014 | ROCKET.firstshot = 0 | |
| 1015 | ROCKET.type = "Splode" | |
| 1016 | #Grenades | |
| 1017 | NADES.firstshot = 0 | |
| 1018 | NADES.type = "Nade" | |
| 1019 | #Healing | |
| 1020 | HEAL.type = "Heal" | |
| 1021 | ||
| 1022 | #Detect if we are being run | |
| 1023 | if __name__ == '__main__': | |
| 1024 | DebugPrint('Starting FortBolt\n')
| |
| 1025 | DebugPrint('Initalizing Globals\n')
| |
| 1026 | Running = True | |
| 1027 | Enabled = False | |
| 1028 | JitterFlop = False | |
| 1029 | Editing = False | |
| 1030 | Building = False | |
| 1031 | Crouching = False | |
| 1032 | Reloading = False | |
| 1033 | Using = False | |
| 1034 | Jumping = 0.0 | |
| 1035 | Init_Weapons() | |
| 1036 | Current_Weapon = Pickaxe | |
| 1037 | Current_Loadout = [AR, PUMP, SMG, HR, HEAL] | |
| 1038 | ||
| 1039 | try: | |
| 1040 | main() | |
| 1041 | exit | |
| 1042 | except ValueError: | |
| 1043 | print("Error: Could not Run Script") |