Advertisement
koassount

BoneTriggerScoutOnly -Abendigo

Mar 30th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. package org.thor.plugins.game
  2.  
  3. import org.thor.DEBUG
  4. import org.thor.define.*
  5. import org.thor.define.Client.clientDLL
  6. import org.thor.define.Client.enemies
  7. import org.thor.define.Engine.clientState
  8. import org.thor.define.offsets.m_dwForceAttack
  9. import org.neptune.spear.keyPressed
  10. import java.lang.Math.*
  11. import org.thor.util.random
  12.  
  13.  
  14.  
  15.  
  16. object BoneTriggerScopedOnly : InGame("Bone Trigger Scoped Only", duration = 1) {
  17.  
  18. private const val KEY = 5
  19.  
  20.  
  21. val TARGET_BONE = Bones.HEAD
  22. private const val FOV = 9
  23.  
  24. private val aim = Vector(0F, 0F, 0F)
  25. private var hold = false
  26.  
  27.  
  28.  
  29.  
  30. private const val MIN_SCOPE_DURATION = 85
  31. private const val MAX_SCOPE_DURATION = 160
  32.  
  33. private const val BOLT_ACTION_ONLY = true
  34.  
  35. private var scopeDuration = 0
  36.  
  37. override fun cycle() {
  38. if(!keyPressed(KEY)) return
  39. val scoped = +Me.inScope
  40. if (!scoped) {
  41. scopeDuration = 0
  42. return
  43. }
  44.  
  45. scopeDuration += duration
  46. if (scopeDuration < random(MIN_SCOPE_DURATION, MAX_SCOPE_DURATION)) return
  47.  
  48. try {
  49. val weapon = (+Me().weapon).type!!
  50. if (Weapons.SSG08 !=weapon || (BOLT_ACTION_ONLY && !weapon.boltAction)) return
  51. } catch (t: Throwable) {
  52. if (DEBUG) t.printStackTrace()
  53. }
  54.  
  55.  
  56.  
  57. val myPosition = +Me().position
  58. val angle = clientState(1024).angle()
  59.  
  60. var closestDelta = Int.MAX_VALUE
  61. for ((i, e) in enemies) {
  62. if (+e.dead || +e.dormant || !+e.spotted) continue
  63.  
  64. val ePos = e.bonePosition(TARGET_BONE.id)
  65. val distance = distance(myPosition, ePos)
  66.  
  67. calculateAngle(Me(), myPosition, ePos, aim.reset())
  68. normalizeAngle(aim)
  69.  
  70. val pitchDiff = abs(angle.x - aim.x)
  71. val yawDiff = abs(angle.y - aim.y)
  72. val diff = sin(toRadians(pitchDiff.toDouble())) + sin(toRadians(yawDiff.toDouble()))
  73. val delta = abs(diff * distance)
  74.  
  75. if (delta <= FOV && delta < closestDelta) closestDelta = delta.toInt()
  76. }
  77.  
  78. if (closestDelta <= FOV && !hold) {
  79. clientDLL[m_dwForceAttack] = 5.toByte()
  80. hold = true
  81. } else if (hold) {
  82. clientDLL[m_dwForceAttack] = 4.toByte()
  83. hold = false
  84. }
  85. }
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement