import BigWorld
import Math
import math
import Vehicle
import CommandMapping
import Keys
import random
import os
from constants import AIMING_MODE
from math import pi, sin, cos, atan, atan2, sqrt, fmod, asin, tan, acos
from functools import partial
from Avatar import PlayerAvatar
from AvatarInputHandler.control_modes import ArcadeControlMode, SniperControlMode, StrategicControlMode
from AvatarInputHandler.gun_marker_ctrl import _StandardShotResult
from gui.SystemMessages import SM_TYPE
from gui.SystemMessages import pushMessage
from gui.Scaleform.daapi.view.lobby.LobbyView import LobbyView
from gui.scaleform.battle_entry import BattleEntry
AimData = {'ModEnable': True,
'ToggleKye': 'KEY_NUMPAD0',
'Vehicle_List': [],
'Speed_List': [],
'Dir_List': [],
'Target_Last_Shot_Point': None,
'Target_Last_Pos': (0, 0, 0),
'Target': None,
'Target_Id': None,
'Target_Last_HullPosition': None,
'Target_Last_TurretPositions': None,
'Target_Last_GunPosition': None,
'Old_DesiredShotPoint': None,
'TimeOut': 100.0,
'AimPoint': -0.48,
'BufDistMax': 100.0,
'BufDistMin': 50.0,
'SizeBufSpeed': 16,
'SizeBufDir': 8,
'Max_Ray_Koef': 10,
'__Type__': 'not_pierced',
'HullBboxMin': None,
'HullBboxMax': None,
'ImpactTag': ['lightTank',
'mediumTank',
'heavyTank',
'AT-SPG',
'SPG'],
'ImpactSet': None,
'MeSpeed': 0}
AimPointx = 0.0
AimPointy = 1.5
AimPointz = 0.0
isLogin = True
LOGIN_TEXT_MESSAGE = '<font color="#cc9933"><b>FK NOOB AIM</b></font>'
Old_Populate = LobbyView._populate
def New_Populate(self):
global isLogin
Old_Populate(self)
if isLogin:
pushMessage(LOGIN_TEXT_MESSAGE, SM_TYPE.MediumInfo)
isLogin = False
LobbyView._populate = New_Populate
import functools
from gui.Scaleform.framework import WindowLayer
from gui.shared.personality import ServicesLocator
from gui.Scaleform.genConsts.BATTLE_MESSAGES_CONSTS import BATTLE_MESSAGES_CONSTS
from gui.Scaleform.genConsts.BATTLE_VIEW_ALIASES import BATTLE_VIEW_ALIASES
from gui.Scaleform.daapi.view.battle.shared.messages.fading_messages import _COLOR_TO_METHOD
# Usage:
# color=BATTLE_MESSAGES_CONSTS, possible values:
# COLOR_YELLOW = 'yellow'
# COLOR_RED = 'red'
# COLOR_PURPLE = 'purple'
# COLOR_GREEN = 'green'
# COLOR_GOLD = 'gold'
# COLOR_SELF = 'self'
# panel=BATTLE_VIEW_ALIASES, possible values:
# VEHICLE_MESSAGES = 'battleVehicleMessages' (above consumables panel)
# VEHICLE_ERROR_MESSAGES = 'battleVehicleErrorMessages' (near crosshair)
# PLAYER_MESSAGES = 'battlePlayerMessages' (above minimap)
# sendFadingMessage('Hello from playerMessages!', color=BATTLE_MESSAGES_CONSTS.COLOR_PURPLE)
# sendFadingMessage('Hello from vehicleErrorMessages!', color=BATTLE_MESSAGES_CONSTS.COLOR_YELLOW, panel=BATTLE_VIEW_ALIASES.VEHICLE_ERROR_MESSAGES)
def sendFadingMessage(text, color=BATTLE_MESSAGES_CONSTS.COLOR_GREEN, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES):
app = ServicesLocator.appLoader.getDefBattleApp()
battlePage = app.containerManager.getContainer(WindowLayer.VIEW).getView()
if battlePage is not None:
viewComponent = battlePage.components.get(panel)
method = getattr(viewComponent, _COLOR_TO_METHOD.get(color, 'as_showGreenMessageS'), None)
if method is not None:
method(None, text)
return
BigWorld.callback(0.0, functools.partial(sendFadingMessage, text, color, panel))
Old_ChangeColor = _StandardShotResult.getShotResult
Old_PlayerAvatar = PlayerAvatar.handleKey
Old_Arcade_HandleKeyEvent = ArcadeControlMode.handleKeyEvent
Old_Sniper_HandleKeyEvent = SniperControlMode.handleKeyEvent
Old_Strategic_HandleKeyEvent = StrategicControlMode.handleKeyEvent
Old_OnEnterWorld = PlayerAvatar.vehicle_onAppearanceReady
Old_OnLeaveWorld = PlayerAvatar.vehicle_onLeaveWorld
marker = None
showtime = 0
targetid = None
descr = None
class AutoAimBot():
def __init__(self):
self.__Player__ = BigWorld.player()
self.startTimer = BigWorld.time()
self.targetFlag = False
self.Track = True
def update(self):
global targetid, marker, showtime, descr
global AimPointx
global AimPointy
global AimPointz
global AimData
TimeOut = AimData['TimeOut']
AimPoint = AimData['AimPoint']
__Player__ = BigWorld.player()
if AimData['Target'] is None or not BigWorld.player().arena.vehicles.get(AimData['Target_Id'])['isAlive']:
AutoAimManager.lost()
elif not __Player__.arena.vehicles[__Player__.playerVehicleID]['isAlive']:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
sendFadingMessage('Смерть!! Отменить автоприцеливание!!', color=BATTLE_MESSAGES_CONSTS.COLOR_RED, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
else:
if AimData['Target_Id'] not in AimData['Vehicle_List']:
if self.Track:
if sendFadingMessage is not None:
sendFadingMessage('При отслеживании цели... возможно, стоит вести огонь вслепую!', color=BATTLE_MESSAGES_CONSTS.COLOR_GOLD, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
self.Track = False
if self.startTimer + TimeOut < BigWorld.time():
self.targetFlag = False
if sendFadingMessage is not None:
sendFadingMessage('Истечение времени отслеживания и снятие блокировки.', color=BATTLE_MESSAGES_CONSTS.COLOR_RED, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
self.Track = True
AutoAimManager.lost()
self.targetFlag = True
TargetPosition = AimData['Target_Last_Pos']
TargetSpeed = 0.0
for Speed_Dir in AimData['Speed_List']:
TargetSpeed = TargetSpeed + Speed_Dir
TargetSpeed = TargetSpeed / len(AimData['Speed_List'])
else:
try:
if self.targetFlag:
AimData['Target'] = BigWorld.entity(AimData['Target_Id'])
AutoAimManager.remove()
BigWorld.callback(0.01, partial(AutoAimManager.add, AutoAimBot()))
sendFadingMessage('Цель зафиксирована', color=BATTLE_MESSAGES_CONSTS.COLOR_GREEN, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
self.Track = True
self.startTimer = BigWorld.time()
TargetPosition = AimData['Target'].position
SpeedInfo = AimData['Target'].filter.speedInfo.value
speed = SpeedInfo[0]
fwdSpeedLimit, bckwdSpeedLimit = AimData['Target'].typeDescriptor.physics['speedLimits']
MAX_SPEED_MULTIPLIER = 1.5
fwdSpeedLimit *= MAX_SPEED_MULTIPLIER
bckwdSpeedLimit *= MAX_SPEED_MULTIPLIER
if speed > fwdSpeedLimit:
speed = fwdSpeedLimit
elif speed < -bckwdSpeedLimit:
speed = -bckwdSpeedLimit
TargetSpeed = abs(round(speed, 3))
AimData['Target_Last_HullPosition'] = AimData['Target'].typeDescriptor.chassis.hullPosition
AimData['Target_Last_TurretPositions'] = AimData['Target'].typeDescriptor.hull.turretPositions
AimData['Target_Last_GunPosition'] = AimData['Target'].typeDescriptor.turret.gunPosition
except:
AutoAimManager.lost()
self.Track = True
__x__, __y__, __z__ = __Player__.gunRotator.markerInfo[0]
Dist = (__Player__.getOwnVehiclePosition() - Math.Vector3(__x__, __y__, __z__)).length
if Dist < AimData['BufDistMax'] and Dist > AimData['BufDistMin']:
__SizeBufSpeed__ = int(1 + (AimData['SizeBufSpeed'] - 1) / (AimData['BufDistMax'] - AimData['BufDistMin']) * (Dist - AimData['BufDistMin']))
__SizeBufDir__ = int(1 + (AimData['SizeBufDir'] - 1) / (AimData['BufDistMax'] - AimData['BufDistMin']) * (Dist - AimData['BufDistMin']))
elif Dist > AimData['BufDistMax']:
__SizeBufSpeed__ = AimData['SizeBufSpeed']
__SizeBufDir__ = AimData['SizeBufDir']
elif Dist < AimData['BufDistMin']:
__SizeBufSpeed__ = 1
__SizeBufDir__ = 1
LastPosition = None
if AimData['Target_Last_Shot_Point'] is None:
LastPosition = TargetPosition
else:
LastPosition = AimData['Target_Last_Shot_Point']
AimData['Target_Last_Shot_Point'] = TargetPosition
AimData['Speed_List'].append(TargetSpeed)
while len(AimData['Speed_List']) > __SizeBufSpeed__:
AimData['Speed_List'].pop(0)
TargetSpeed = 0.0
for Speed_Dir in AimData['Speed_List']:
TargetSpeed = TargetSpeed + Speed_Dir
TargetSpeed = TargetSpeed / len(AimData['Speed_List'])
if int(TargetSpeed) == 0:
TargetSpeed = 0.0
TargetMoved = TargetPosition - LastPosition
TargetMoved.normalise()
AimData['Dir_List'].append(TargetMoved)
while len(AimData['Dir_List']) > __SizeBufDir__:
AimData['Dir_List'].pop(0)
TargetMoved = (0, 0, 0)
for Moved_Dir in AimData['Dir_List']:
TargetMoved = Math.Vector3(TargetMoved) + Math.Vector3(Moved_Dir)
TargetMoved = TargetMoved / len(AimData['Dir_List'])
DefaultDistOffset = Dist - 15 + 13.75
__DistOffset__ = 100000.0 / (DefaultDistOffset * DefaultDistOffset * DefaultDistOffset) + 0.9 if Dist > 40 else 20.0
ShotSpeed = __Player__.vehicleTypeDescriptor.shot.speed
ShotGravity = __Player__.vehicleTypeDescriptor.shot.gravity
ShotMD = math.ceil(ShotSpeed * ShotSpeed / ShotGravity)
if Dist <= ShotMD:
Loc = math.asin(Dist * ShotGravity / (ShotSpeed * ShotSpeed)) * 0.5
else:
Loc = 0.785398
Angle = Loc / (math.pi * math.degrees(math.pi))
if AimData['ImpactSet'] == AimData['ImpactTag'][4]:
ShotTime = round(Dist / (ShotSpeed * math.cos(Angle)), 3)
else:
ShotTime = round(math.sin(Loc) * ShotSpeed / ShotGravity * 2, 3)
#Route = round(TargetSpeed * ShotTime * __AimOffset__ * __DistOffset__, 3)
#AimData['Target_Last_Pos'] = TargetPosition + TargetMoved * (TargetPosition - LastPosition).length
Route = Math.Matrix(AimData['Target'].matrix)
AimData['Target_Last_Pos'] = Route.translation + ShotTime * speed * Route.applyToAxis(2)
if AimData['ImpactSet'] == AimData['ImpactTag'][4]:
if __Player__.inputHandler.ctrlModeName == 'strategic':
NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 3, 0)
else:
NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 2.0, 0)
else:
NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 1.6, 0)
#if TargetSpeed == 0.0:
# if AimData['MeSpeed'] != 0.0:
# NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 1.6, 0)
# elif AimData['MeSpeed'] == 0.0 and AimData['__Type__'] == 'great_pierced':
# NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0.2, 1.6, 0.2)
# else:
# NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 1.5, 0)
#else:
__Player__.gunRotator._VehicleGunRotator__updateShotPointOnServer(NewTargetPosition)
if __Player__.gunRotator._VehicleGunRotator__time is None:
return
TimeDiff = __Player__.gunRotator._VehicleGunRotator__getTimeDiff()
if TimeDiff is None:
return
__Player__.gunRotator._VehicleGunRotator__time = self.startTimer
__Player__.gunRotator._VehicleGunRotator__rotate(NewTargetPosition, TimeDiff)
__Player__.gunRotator._VehicleGunRotator__updateGunMarker()
AimData['__Type__'] = 'not_pierced'
return
class AutoAimManager():
autoaim = None
@staticmethod
def add(autoaim):
AutoAimManager.remove()
AutoAimManager.autoaim = autoaim
__Player__ = BigWorld.player()
__Player__.soundNotifications.play('target_captured')
if hasattr(__Player__, 'gunRotator'):
__Player__.gunRotator.clientMode = False
AutoAimManager.update()
BigWorld.flushPythonLog()
@staticmethod
def remove():
if AutoAimManager.autoaim is None:
return
else:
__Player__ = BigWorld.player()
AutoAimManager.autoaim = None
if hasattr(__Player__, 'gunRotator'):
__Player__.gunRotator.clientMode = True
if hasattr(__Player__, 'soundNotifications'):
__Player__.soundNotifications.play('target_unlocked')
return
@staticmethod
def lost():
if AutoAimManager.autoaim is None:
return
else:
__Player__ = BigWorld.player()
AutoAimManager.autoaim = None
if hasattr(__Player__, 'gunRotator'):
__Player__.gunRotator.clientMode = True
if hasattr(__Player__, 'soundNotifications'):
__Player__.soundNotifications.play('target_lost')
return
@staticmethod
def hasAutoAim():
return AutoAimManager.autoaim is not None
@staticmethod
def update():
if AutoAimManager.hasAutoAim():
AutoAimManager.autoaim.update()
if AimData['ImpactSet'] == AimData['ImpactTag'][4]:
BigWorld.callback(0.095, AutoAimManager.update)
else:
BigWorld.callback(0.085, AutoAimManager.update)
else:
AutoAimManager.remove()
def FindTarget():
player = BigWorld.player()
Class = player.arena.vehicles[player.playerVehicleID]['vehicleType'].type
AimData['ImpactSet'] = set(Class.tags & frozenset(AimData['ImpactTag'])).pop()
camera = BigWorld.camera().position
playerVehicleID = player.playerVehicleID
playerVehicle = BigWorld.entity(playerVehicleID)
desiredShotPoint = player.inputHandler.getDesiredShotPoint()
if desiredShotPoint is None:
desiredShotPoint = player.gunRotator.markerInfo[0]
if camera is None or desiredShotPoint is None:
return
else:
new_target = None
new_target_m = None
distance_to_target = math.radians(AimData['Max_Ray_Koef'])
vehicles = player.arena.vehicles
distance_to_target_m = int(0)
v1norm = normalize(desiredShotPoint - camera)
for vehicleID in AimData['Vehicle_List']:
vehicle = BigWorld.entity(vehicleID)
if vehicle is not None and vehicle.isAlive():
v2norm = normalize(vehicle.position - camera)
distance = math.acos(v1norm.x * v2norm.x + v1norm.y * v2norm.y + v1norm.z * v2norm.z)
if distance < 0:
distance = -distance
if distance > math.pi:
distance = 2 * math.pi - distance
if distance < distance_to_target:
new_target = vehicle
distance_to_target = distance
if distance_to_target_m:
distance = playerVehicle.position.flatDistTo(vehicle.position)
if distance < distance_to_target_m:
new_target_m = vehicle
distance_to_target_m = distance
if new_target is AimData['Target'] and new_target_m is not AimData['Target']:
new_target = new_target_m
return new_target
return
def normalize(v):
return v / math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z)
def __GetBattleOn():
return hasattr(BigWorld.player(), 'arena')
def __GetIsLive(id):
return __GetBattleOn() and id in BigWorld.player().arena.vehicles and BigWorld.player().arena.vehicles.get(id)['isAlive']
def __GetIsFriendly(id):
return __GetBattleOn() and BigWorld.player().arena.vehicles[BigWorld.player().playerVehicleID]['team'] == BigWorld.player().arena.vehicles[id]['team']
def New_Arcade_HandleKeyEvent(self, isDown, key, mods, event = None):
global AimPointx
global AimPointy
global AimPointz
if not AimData['ModEnable'] or sendFadingMessage is None:
return Old_Arcade_HandleKeyEvent(self, isDown, key, mods, event)
elif CommandMapping is None:
return Old_Arcade_HandleKeyEvent(self, isDown, key, mods, event)
else:
CmdMap = CommandMapping.g_instance
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET, key) and isDown:
__Target__ = FindTarget()
if __Target__ is None:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Arcade_HandleKeyEvent(self, isDown, key, mods, event)
if __Target__ is not None and __GetIsLive(__Target__.id):
AimData['Target_Id'] = __Target__.id
AimData['Target'] = __Target__
AimData['HullBboxMin'], AimData['HullBboxMax'], _ = __Target__.typeDescriptor.hull.hitTester.bbox
AutoAimManager.add(AutoAimBot())
return sendFadingMessage('В аркадном режиме цель заблокирована', color=BATTLE_MESSAGES_CONSTS.COLOR_GOLD, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET_OFF, key) and isDown:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Arcade_HandleKeyEvent(self, isDown, key, mods, event)
return
def New_Sniper_HandleKeyEvent(self, isDown, key, mods, event = None):
global AimPointx
global AimPointy
global AimPointz
if not AimData['ModEnable'] or sendFadingMessage is None:
return Old_Sniper_HandleKeyEvent(self, isDown, key, mods, event)
elif CommandMapping is None:
return Old_Sniper_HandleKeyEvent(self, isDown, key, mods, event)
else:
CmdMap = CommandMapping.g_instance
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET, key) and isDown:
__Target__ = FindTarget()
if __Target__ is None:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Sniper_HandleKeyEvent(self, isDown, key, mods, event)
if __Target__ is not None and __GetIsLive(__Target__.id):
AimData['Target_Id'] = __Target__.id
AimData['Target'] = __Target__
AimData['HullBboxMin'], AimData['HullBboxMax'], _ = __Target__.typeDescriptor.hull.hitTester.bbox
AutoAimManager.add(AutoAimBot())
return sendFadingMessage('Снайперский режим захватывает цель.', color=BATTLE_MESSAGES_CONSTS.COLOR_GOLD, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET_OFF, key) and isDown:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Sniper_HandleKeyEvent(self, isDown, key, mods, event)
return
def New_Strategic_HandleKeyEvent(self, isDown, key, mods, event = None):
global AimPointx
global AimPointy
global AimPointz
if not AimData['ModEnable'] or sendFadingMessage is None:
return Old_Strategic_HandleKeyEvent(self, isDown, key, mods, event)
elif CommandMapping is None:
return Old_Strategic_HandleKeyEvent(self, isDown, key, mods, event)
else:
CmdMap = CommandMapping.g_instance
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET, key) and isDown:
__Target__ = FindTarget()
if __Target__ is None:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Strategic_HandleKeyEvent(self, isDown, key, mods, event)
if __Target__ is not None and __GetIsLive(__Target__.id):
AimData['Target_Id'] = __Target__.id
AimData['Target'] = __Target__
AimData['HullBboxMin'], AimData['HullBboxMax'], _ = __Target__.typeDescriptor.hull.hitTester.bbox
AutoAimManager.add(AutoAimBot())
return sendFadingMessage('Вид сверху позволяет зафиксировать цель.', color=BATTLE_MESSAGES_CONSTS.COLOR_GOLD, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET_OFF, key) and isDown:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Strategic_HandleKeyEvent(self, isDown, key, mods, event)
return
def New_OnEnterWorld(self, vehicle):
Old_OnEnterWorld(self, vehicle)
if __GetIsLive(vehicle.id) and not __GetIsFriendly(vehicle.id):
if vehicle.id not in AimData['Vehicle_List']:
AimData['Vehicle_List'].append(vehicle.id)
def New_OnLeaveWorld(self, vehicle):
Old_OnLeaveWorld(self, vehicle)
if vehicle.id in AimData['Vehicle_List']:
AimData['Vehicle_List'].remove(vehicle.id)
def OnVehicleKilled(targetID, atackerID, reason):
if targetID in AimData['Vehicle_List']:
AimData['Vehicle_List'].remove(targetID)
def Clear_Homing():
global AimPointx
global AimPointy
global AimPointz
AimData['Vehicle_List'] = []
AimData['Speed_List'] = []
AimData['target_last'] = None
AimData['Target'] = None
AimData['Target_Id'] = None
AimData['Target_Last_HullPosition'] = None
AimData['Target_Last_TurretPositions'] = None
AimData['__Type__'] = 'not_pierced'
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
return
def new_afterCreate():
old_afterCreate(self)
BigWorld.player().arena.onVehicleKilled += OnVehicleKilled
Clear_Homing()
for values in BigWorld.entities.values():
if type(values) is Vehicle.Vehicle:
if values.id not in AimData['Vehicle_List']:
AimData['Vehicle_List'].append(values.id)
def new_beforeDelete():
old_beforeDelete(self)
BigWorld.player().arena.onVehicleKilled -= OnVehicleKilled
Clear_Homing()
def New_PlayerAvatar(current, isDown, key, mods):
Old_PlayerAvatar(current, isDown, key, mods)
if sendFadingMessage is not None:
if AimData['ModEnable'] and key == getattr(Keys, AimData['ToggleKye'], None) and isDown:
AimData['ModEnable'] = False
sendFadingMessage('Отключите модуль автоматической регулировки.', color=BATTLE_MESSAGES_CONSTS.COLOR_RED, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
return
if not AimData['ModEnable'] and key == getattr(Keys, AimData['ToggleKye'], None) and isDown:
AimData['ModEnable'] = True
sendFadingMessage('Включить модуль автоматической регулировки', color=BATTLE_MESSAGES_CONSTS.COLOR_GREEN, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
return
@classmethod
def New_ChangeColor(cls, gunMarker, excludeTeam = 0, piercingMultiplier = 1):
collision = gunMarker.collData
if collision is None:
return _SHOT_RESULT.UNDEFINED
else:
entity = collision.entity
if entity.health <= 0 or entity.publicInfo['team'] == excludeTeam:
return _SHOT_RESULT.UNDEFINED
player = BigWorld.player()
if player is None:
return _SHOT_RESULT.UNDEFINED
vDesc = player.getVehicleDescriptor()
gunInstallationSlot = vDesc.gunInstallations[gunMarker.gunInstallationIndex]
shot = vDesc.shot if gunInstallationSlot.isMainInstallation() else gunInstallationSlot.gun.shots[0]
ppDesc = shot.piercingPower
maxDist = shot.maxDistance
dist = (gunMarker.position - player.getOwnVehiclePosition()).length
piercingPower = computePiercingPowerAtDist(ppDesc, dist, maxDist, piercingMultiplier)
piercingPercent = 1000.0
if piercingPower > 0.0:
armor = collision.armor
piercingPercent = 100.0 + (armor - piercingPower) / piercingPower * 100.0
if piercingPercent >= 150:
result = _SHOT_RESULT.NOT_PIERCED
elif 90 < piercingPercent < 150:
result = _SHOT_RESULT.LITTLE_PIERCED
else:
result = _SHOT_RESULT.GREAT_PIERCED
AimData['__Type__'] = result
if piercingPercent >= 150:
result = _SHOT_RESULT.NOT_PIERCED
AimData['__Type__'] = 'not_pierced'
elif 90 < piercingPercent < 150:
result = _SHOT_RESULT.LITTLE_PIERCED
AimData['__Type__'] = 'little_pierced'
else:
result = _SHOT_RESULT.GREAT_PIERCED
AimData['__Type__'] = 'great_pierced'
return result
speed_ = BigWorld.player().vehicle.filter.speedInfo.value[0] * 3.6
if player.arena.vehicles[player.playerVehicleID]['isAlive']:
AimData['MeSpeed'] = abs(round(speed_, 3))
else:
AimData['MeSpeed'] = 0
return Old_ChangeColor(cls, gunMarker, excludeTeam = 0, piercingMultiplier = 1)
_StandardShotResult.getShotResult = New_ChangeColor
PlayerAvatar.handleKey = New_PlayerAvatar
ArcadeControlMode.handleKeyEvent = New_Arcade_HandleKeyEvent
SniperControlMode.handleKeyEvent = New_Sniper_HandleKeyEvent
StrategicControlMode.handleKeyEvent = New_Strategic_HandleKeyEvent
#PlayerAvatar.vehicle_onEnterWorld = New_OnEnterWorld
PlayerAvatar.vehicle_onAppearanceReady = New_OnEnterWorld
PlayerAvatar.vehicle_onLeaveWorld = New_OnLeaveWorld
old_afterCreate = BattleEntry.afterCreate
BattleEntry.afterCreate = new_afterCreate
old_beforeDelete = BattleEntry.beforeDelete
BattleEntry.beforeDelete = new_beforeDelete
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
При необходимости вы можете самостоятельно это изучить.
import Math
import math
import Vehicle
import CommandMapping
import Keys
import random
import os
from constants import AIMING_MODE
from math import pi, sin, cos, atan, atan2, sqrt, fmod, asin, tan, acos
from functools import partial
from Avatar import PlayerAvatar
from AvatarInputHandler.control_modes import ArcadeControlMode, SniperControlMode, StrategicControlMode
from AvatarInputHandler.gun_marker_ctrl import _StandardShotResult
from gui.SystemMessages import SM_TYPE
from gui.SystemMessages import pushMessage
from gui.Scaleform.daapi.view.lobby.LobbyView import LobbyView
from gui.scaleform.battle_entry import BattleEntry
AimData = {'ModEnable': True,
'ToggleKye': 'KEY_NUMPAD0',
'Vehicle_List': [],
'Speed_List': [],
'Dir_List': [],
'Target_Last_Shot_Point': None,
'Target_Last_Pos': (0, 0, 0),
'Target': None,
'Target_Id': None,
'Target_Last_HullPosition': None,
'Target_Last_TurretPositions': None,
'Target_Last_GunPosition': None,
'Old_DesiredShotPoint': None,
'TimeOut': 100.0,
'AimPoint': -0.48,
'BufDistMax': 100.0,
'BufDistMin': 50.0,
'SizeBufSpeed': 16,
'SizeBufDir': 8,
'Max_Ray_Koef': 10,
'__Type__': 'not_pierced',
'HullBboxMin': None,
'HullBboxMax': None,
'ImpactTag': ['lightTank',
'mediumTank',
'heavyTank',
'AT-SPG',
'SPG'],
'ImpactSet': None,
'MeSpeed': 0}
AimPointx = 0.0
AimPointy = 1.5
AimPointz = 0.0
isLogin = True
LOGIN_TEXT_MESSAGE = '<font color="#cc9933"><b>FK NOOB AIM</b></font>'
Old_Populate = LobbyView._populate
def New_Populate(self):
global isLogin
Old_Populate(self)
if isLogin:
pushMessage(LOGIN_TEXT_MESSAGE, SM_TYPE.MediumInfo)
isLogin = False
LobbyView._populate = New_Populate
import functools
from gui.Scaleform.framework import WindowLayer
from gui.shared.personality import ServicesLocator
from gui.Scaleform.genConsts.BATTLE_MESSAGES_CONSTS import BATTLE_MESSAGES_CONSTS
from gui.Scaleform.genConsts.BATTLE_VIEW_ALIASES import BATTLE_VIEW_ALIASES
from gui.Scaleform.daapi.view.battle.shared.messages.fading_messages import _COLOR_TO_METHOD
# Usage:
# color=BATTLE_MESSAGES_CONSTS, possible values:
# COLOR_YELLOW = 'yellow'
# COLOR_RED = 'red'
# COLOR_PURPLE = 'purple'
# COLOR_GREEN = 'green'
# COLOR_GOLD = 'gold'
# COLOR_SELF = 'self'
# panel=BATTLE_VIEW_ALIASES, possible values:
# VEHICLE_MESSAGES = 'battleVehicleMessages' (above consumables panel)
# VEHICLE_ERROR_MESSAGES = 'battleVehicleErrorMessages' (near crosshair)
# PLAYER_MESSAGES = 'battlePlayerMessages' (above minimap)
# sendFadingMessage('Hello from playerMessages!', color=BATTLE_MESSAGES_CONSTS.COLOR_PURPLE)
# sendFadingMessage('Hello from vehicleErrorMessages!', color=BATTLE_MESSAGES_CONSTS.COLOR_YELLOW, panel=BATTLE_VIEW_ALIASES.VEHICLE_ERROR_MESSAGES)
def sendFadingMessage(text, color=BATTLE_MESSAGES_CONSTS.COLOR_GREEN, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES):
app = ServicesLocator.appLoader.getDefBattleApp()
battlePage = app.containerManager.getContainer(WindowLayer.VIEW).getView()
if battlePage is not None:
viewComponent = battlePage.components.get(panel)
method = getattr(viewComponent, _COLOR_TO_METHOD.get(color, 'as_showGreenMessageS'), None)
if method is not None:
method(None, text)
return
BigWorld.callback(0.0, functools.partial(sendFadingMessage, text, color, panel))
Old_ChangeColor = _StandardShotResult.getShotResult
Old_PlayerAvatar = PlayerAvatar.handleKey
Old_Arcade_HandleKeyEvent = ArcadeControlMode.handleKeyEvent
Old_Sniper_HandleKeyEvent = SniperControlMode.handleKeyEvent
Old_Strategic_HandleKeyEvent = StrategicControlMode.handleKeyEvent
Old_OnEnterWorld = PlayerAvatar.vehicle_onAppearanceReady
Old_OnLeaveWorld = PlayerAvatar.vehicle_onLeaveWorld
marker = None
showtime = 0
targetid = None
descr = None
class AutoAimBot():
def __init__(self):
self.__Player__ = BigWorld.player()
self.startTimer = BigWorld.time()
self.targetFlag = False
self.Track = True
def update(self):
global targetid, marker, showtime, descr
global AimPointx
global AimPointy
global AimPointz
global AimData
TimeOut = AimData['TimeOut']
AimPoint = AimData['AimPoint']
__Player__ = BigWorld.player()
if AimData['Target'] is None or not BigWorld.player().arena.vehicles.get(AimData['Target_Id'])['isAlive']:
AutoAimManager.lost()
elif not __Player__.arena.vehicles[__Player__.playerVehicleID]['isAlive']:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
sendFadingMessage('Смерть!! Отменить автоприцеливание!!', color=BATTLE_MESSAGES_CONSTS.COLOR_RED, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
else:
if AimData['Target_Id'] not in AimData['Vehicle_List']:
if self.Track:
if sendFadingMessage is not None:
sendFadingMessage('При отслеживании цели... возможно, стоит вести огонь вслепую!', color=BATTLE_MESSAGES_CONSTS.COLOR_GOLD, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
self.Track = False
if self.startTimer + TimeOut < BigWorld.time():
self.targetFlag = False
if sendFadingMessage is not None:
sendFadingMessage('Истечение времени отслеживания и снятие блокировки.', color=BATTLE_MESSAGES_CONSTS.COLOR_RED, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
self.Track = True
AutoAimManager.lost()
self.targetFlag = True
TargetPosition = AimData['Target_Last_Pos']
TargetSpeed = 0.0
for Speed_Dir in AimData['Speed_List']:
TargetSpeed = TargetSpeed + Speed_Dir
TargetSpeed = TargetSpeed / len(AimData['Speed_List'])
else:
try:
if self.targetFlag:
AimData['Target'] = BigWorld.entity(AimData['Target_Id'])
AutoAimManager.remove()
BigWorld.callback(0.01, partial(AutoAimManager.add, AutoAimBot()))
sendFadingMessage('Цель зафиксирована', color=BATTLE_MESSAGES_CONSTS.COLOR_GREEN, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
self.Track = True
self.startTimer = BigWorld.time()
TargetPosition = AimData['Target'].position
SpeedInfo = AimData['Target'].filter.speedInfo.value
speed = SpeedInfo[0]
fwdSpeedLimit, bckwdSpeedLimit = AimData['Target'].typeDescriptor.physics['speedLimits']
MAX_SPEED_MULTIPLIER = 1.5
fwdSpeedLimit *= MAX_SPEED_MULTIPLIER
bckwdSpeedLimit *= MAX_SPEED_MULTIPLIER
if speed > fwdSpeedLimit:
speed = fwdSpeedLimit
elif speed < -bckwdSpeedLimit:
speed = -bckwdSpeedLimit
TargetSpeed = abs(round(speed, 3))
AimData['Target_Last_HullPosition'] = AimData['Target'].typeDescriptor.chassis.hullPosition
AimData['Target_Last_TurretPositions'] = AimData['Target'].typeDescriptor.hull.turretPositions
AimData['Target_Last_GunPosition'] = AimData['Target'].typeDescriptor.turret.gunPosition
except:
AutoAimManager.lost()
self.Track = True
__x__, __y__, __z__ = __Player__.gunRotator.markerInfo[0]
Dist = (__Player__.getOwnVehiclePosition() - Math.Vector3(__x__, __y__, __z__)).length
if Dist < AimData['BufDistMax'] and Dist > AimData['BufDistMin']:
__SizeBufSpeed__ = int(1 + (AimData['SizeBufSpeed'] - 1) / (AimData['BufDistMax'] - AimData['BufDistMin']) * (Dist - AimData['BufDistMin']))
__SizeBufDir__ = int(1 + (AimData['SizeBufDir'] - 1) / (AimData['BufDistMax'] - AimData['BufDistMin']) * (Dist - AimData['BufDistMin']))
elif Dist > AimData['BufDistMax']:
__SizeBufSpeed__ = AimData['SizeBufSpeed']
__SizeBufDir__ = AimData['SizeBufDir']
elif Dist < AimData['BufDistMin']:
__SizeBufSpeed__ = 1
__SizeBufDir__ = 1
LastPosition = None
if AimData['Target_Last_Shot_Point'] is None:
LastPosition = TargetPosition
else:
LastPosition = AimData['Target_Last_Shot_Point']
AimData['Target_Last_Shot_Point'] = TargetPosition
AimData['Speed_List'].append(TargetSpeed)
while len(AimData['Speed_List']) > __SizeBufSpeed__:
AimData['Speed_List'].pop(0)
TargetSpeed = 0.0
for Speed_Dir in AimData['Speed_List']:
TargetSpeed = TargetSpeed + Speed_Dir
TargetSpeed = TargetSpeed / len(AimData['Speed_List'])
if int(TargetSpeed) == 0:
TargetSpeed = 0.0
TargetMoved = TargetPosition - LastPosition
TargetMoved.normalise()
AimData['Dir_List'].append(TargetMoved)
while len(AimData['Dir_List']) > __SizeBufDir__:
AimData['Dir_List'].pop(0)
TargetMoved = (0, 0, 0)
for Moved_Dir in AimData['Dir_List']:
TargetMoved = Math.Vector3(TargetMoved) + Math.Vector3(Moved_Dir)
TargetMoved = TargetMoved / len(AimData['Dir_List'])
DefaultDistOffset = Dist - 15 + 13.75
__DistOffset__ = 100000.0 / (DefaultDistOffset * DefaultDistOffset * DefaultDistOffset) + 0.9 if Dist > 40 else 20.0
ShotSpeed = __Player__.vehicleTypeDescriptor.shot.speed
ShotGravity = __Player__.vehicleTypeDescriptor.shot.gravity
ShotMD = math.ceil(ShotSpeed * ShotSpeed / ShotGravity)
if Dist <= ShotMD:
Loc = math.asin(Dist * ShotGravity / (ShotSpeed * ShotSpeed)) * 0.5
else:
Loc = 0.785398
Angle = Loc / (math.pi * math.degrees(math.pi))
if AimData['ImpactSet'] == AimData['ImpactTag'][4]:
ShotTime = round(Dist / (ShotSpeed * math.cos(Angle)), 3)
else:
ShotTime = round(math.sin(Loc) * ShotSpeed / ShotGravity * 2, 3)
#Route = round(TargetSpeed * ShotTime * __AimOffset__ * __DistOffset__, 3)
#AimData['Target_Last_Pos'] = TargetPosition + TargetMoved * (TargetPosition - LastPosition).length
Route = Math.Matrix(AimData['Target'].matrix)
AimData['Target_Last_Pos'] = Route.translation + ShotTime * speed * Route.applyToAxis(2)
if AimData['ImpactSet'] == AimData['ImpactTag'][4]:
if __Player__.inputHandler.ctrlModeName == 'strategic':
NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 3, 0)
else:
NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 2.0, 0)
else:
NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 1.6, 0)
#if TargetSpeed == 0.0:
# if AimData['MeSpeed'] != 0.0:
# NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 1.6, 0)
# elif AimData['MeSpeed'] == 0.0 and AimData['__Type__'] == 'great_pierced':
# NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0.2, 1.6, 0.2)
# else:
# NewTargetPosition = Math.Vector3(AimData['Target_Last_Pos'][:]) + Math.Vector3(0, 1.5, 0)
#else:
__Player__.gunRotator._VehicleGunRotator__updateShotPointOnServer(NewTargetPosition)
if __Player__.gunRotator._VehicleGunRotator__time is None:
return
TimeDiff = __Player__.gunRotator._VehicleGunRotator__getTimeDiff()
if TimeDiff is None:
return
__Player__.gunRotator._VehicleGunRotator__time = self.startTimer
__Player__.gunRotator._VehicleGunRotator__rotate(NewTargetPosition, TimeDiff)
__Player__.gunRotator._VehicleGunRotator__updateGunMarker()
AimData['__Type__'] = 'not_pierced'
return
class AutoAimManager():
autoaim = None
@staticmethod
def add(autoaim):
AutoAimManager.remove()
AutoAimManager.autoaim = autoaim
__Player__ = BigWorld.player()
__Player__.soundNotifications.play('target_captured')
if hasattr(__Player__, 'gunRotator'):
__Player__.gunRotator.clientMode = False
AutoAimManager.update()
BigWorld.flushPythonLog()
@staticmethod
def remove():
if AutoAimManager.autoaim is None:
return
else:
__Player__ = BigWorld.player()
AutoAimManager.autoaim = None
if hasattr(__Player__, 'gunRotator'):
__Player__.gunRotator.clientMode = True
if hasattr(__Player__, 'soundNotifications'):
__Player__.soundNotifications.play('target_unlocked')
return
@staticmethod
def lost():
if AutoAimManager.autoaim is None:
return
else:
__Player__ = BigWorld.player()
AutoAimManager.autoaim = None
if hasattr(__Player__, 'gunRotator'):
__Player__.gunRotator.clientMode = True
if hasattr(__Player__, 'soundNotifications'):
__Player__.soundNotifications.play('target_lost')
return
@staticmethod
def hasAutoAim():
return AutoAimManager.autoaim is not None
@staticmethod
def update():
if AutoAimManager.hasAutoAim():
AutoAimManager.autoaim.update()
if AimData['ImpactSet'] == AimData['ImpactTag'][4]:
BigWorld.callback(0.095, AutoAimManager.update)
else:
BigWorld.callback(0.085, AutoAimManager.update)
else:
AutoAimManager.remove()
def FindTarget():
player = BigWorld.player()
Class = player.arena.vehicles[player.playerVehicleID]['vehicleType'].type
AimData['ImpactSet'] = set(Class.tags & frozenset(AimData['ImpactTag'])).pop()
camera = BigWorld.camera().position
playerVehicleID = player.playerVehicleID
playerVehicle = BigWorld.entity(playerVehicleID)
desiredShotPoint = player.inputHandler.getDesiredShotPoint()
if desiredShotPoint is None:
desiredShotPoint = player.gunRotator.markerInfo[0]
if camera is None or desiredShotPoint is None:
return
else:
new_target = None
new_target_m = None
distance_to_target = math.radians(AimData['Max_Ray_Koef'])
vehicles = player.arena.vehicles
distance_to_target_m = int(0)
v1norm = normalize(desiredShotPoint - camera)
for vehicleID in AimData['Vehicle_List']:
vehicle = BigWorld.entity(vehicleID)
if vehicle is not None and vehicle.isAlive():
v2norm = normalize(vehicle.position - camera)
distance = math.acos(v1norm.x * v2norm.x + v1norm.y * v2norm.y + v1norm.z * v2norm.z)
if distance < 0:
distance = -distance
if distance > math.pi:
distance = 2 * math.pi - distance
if distance < distance_to_target:
new_target = vehicle
distance_to_target = distance
if distance_to_target_m:
distance = playerVehicle.position.flatDistTo(vehicle.position)
if distance < distance_to_target_m:
new_target_m = vehicle
distance_to_target_m = distance
if new_target is AimData['Target'] and new_target_m is not AimData['Target']:
new_target = new_target_m
return new_target
return
def normalize(v):
return v / math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z)
def __GetBattleOn():
return hasattr(BigWorld.player(), 'arena')
def __GetIsLive(id):
return __GetBattleOn() and id in BigWorld.player().arena.vehicles and BigWorld.player().arena.vehicles.get(id)['isAlive']
def __GetIsFriendly(id):
return __GetBattleOn() and BigWorld.player().arena.vehicles[BigWorld.player().playerVehicleID]['team'] == BigWorld.player().arena.vehicles[id]['team']
def New_Arcade_HandleKeyEvent(self, isDown, key, mods, event = None):
global AimPointx
global AimPointy
global AimPointz
if not AimData['ModEnable'] or sendFadingMessage is None:
return Old_Arcade_HandleKeyEvent(self, isDown, key, mods, event)
elif CommandMapping is None:
return Old_Arcade_HandleKeyEvent(self, isDown, key, mods, event)
else:
CmdMap = CommandMapping.g_instance
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET, key) and isDown:
__Target__ = FindTarget()
if __Target__ is None:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Arcade_HandleKeyEvent(self, isDown, key, mods, event)
if __Target__ is not None and __GetIsLive(__Target__.id):
AimData['Target_Id'] = __Target__.id
AimData['Target'] = __Target__
AimData['HullBboxMin'], AimData['HullBboxMax'], _ = __Target__.typeDescriptor.hull.hitTester.bbox
AutoAimManager.add(AutoAimBot())
return sendFadingMessage('В аркадном режиме цель заблокирована', color=BATTLE_MESSAGES_CONSTS.COLOR_GOLD, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET_OFF, key) and isDown:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Arcade_HandleKeyEvent(self, isDown, key, mods, event)
return
def New_Sniper_HandleKeyEvent(self, isDown, key, mods, event = None):
global AimPointx
global AimPointy
global AimPointz
if not AimData['ModEnable'] or sendFadingMessage is None:
return Old_Sniper_HandleKeyEvent(self, isDown, key, mods, event)
elif CommandMapping is None:
return Old_Sniper_HandleKeyEvent(self, isDown, key, mods, event)
else:
CmdMap = CommandMapping.g_instance
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET, key) and isDown:
__Target__ = FindTarget()
if __Target__ is None:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Sniper_HandleKeyEvent(self, isDown, key, mods, event)
if __Target__ is not None and __GetIsLive(__Target__.id):
AimData['Target_Id'] = __Target__.id
AimData['Target'] = __Target__
AimData['HullBboxMin'], AimData['HullBboxMax'], _ = __Target__.typeDescriptor.hull.hitTester.bbox
AutoAimManager.add(AutoAimBot())
return sendFadingMessage('Снайперский режим захватывает цель.', color=BATTLE_MESSAGES_CONSTS.COLOR_GOLD, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET_OFF, key) and isDown:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Sniper_HandleKeyEvent(self, isDown, key, mods, event)
return
def New_Strategic_HandleKeyEvent(self, isDown, key, mods, event = None):
global AimPointx
global AimPointy
global AimPointz
if not AimData['ModEnable'] or sendFadingMessage is None:
return Old_Strategic_HandleKeyEvent(self, isDown, key, mods, event)
elif CommandMapping is None:
return Old_Strategic_HandleKeyEvent(self, isDown, key, mods, event)
else:
CmdMap = CommandMapping.g_instance
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET, key) and isDown:
__Target__ = FindTarget()
if __Target__ is None:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Strategic_HandleKeyEvent(self, isDown, key, mods, event)
if __Target__ is not None and __GetIsLive(__Target__.id):
AimData['Target_Id'] = __Target__.id
AimData['Target'] = __Target__
AimData['HullBboxMin'], AimData['HullBboxMax'], _ = __Target__.typeDescriptor.hull.hitTester.bbox
AutoAimManager.add(AutoAimBot())
return sendFadingMessage('Вид сверху позволяет зафиксировать цель.', color=BATTLE_MESSAGES_CONSTS.COLOR_GOLD, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
if CmdMap.isFired(CommandMapping.CMD_CM_LOCK_TARGET_OFF, key) and isDown:
AimData['Target_Id'] = None
AimData['Target'] = None
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
AutoAimManager.remove()
return Old_Strategic_HandleKeyEvent(self, isDown, key, mods, event)
return
def New_OnEnterWorld(self, vehicle):
Old_OnEnterWorld(self, vehicle)
if __GetIsLive(vehicle.id) and not __GetIsFriendly(vehicle.id):
if vehicle.id not in AimData['Vehicle_List']:
AimData['Vehicle_List'].append(vehicle.id)
def New_OnLeaveWorld(self, vehicle):
Old_OnLeaveWorld(self, vehicle)
if vehicle.id in AimData['Vehicle_List']:
AimData['Vehicle_List'].remove(vehicle.id)
def OnVehicleKilled(targetID, atackerID, reason):
if targetID in AimData['Vehicle_List']:
AimData['Vehicle_List'].remove(targetID)
def Clear_Homing():
global AimPointx
global AimPointy
global AimPointz
AimData['Vehicle_List'] = []
AimData['Speed_List'] = []
AimData['target_last'] = None
AimData['Target'] = None
AimData['Target_Id'] = None
AimData['Target_Last_HullPosition'] = None
AimData['Target_Last_TurretPositions'] = None
AimData['__Type__'] = 'not_pierced'
AimData['HullBboxMin'] = None
AimData['HullBboxMax'] = None
AimData['ImpactSet'] = None
AimData['MeSpeed'] = 0.0
AimPointx = 0.0
AimPointy = 0.0
AimPointz = 0.0
return
def new_afterCreate():
old_afterCreate(self)
BigWorld.player().arena.onVehicleKilled += OnVehicleKilled
Clear_Homing()
for values in BigWorld.entities.values():
if type(values) is Vehicle.Vehicle:
if values.id not in AimData['Vehicle_List']:
AimData['Vehicle_List'].append(values.id)
def new_beforeDelete():
old_beforeDelete(self)
BigWorld.player().arena.onVehicleKilled -= OnVehicleKilled
Clear_Homing()
def New_PlayerAvatar(current, isDown, key, mods):
Old_PlayerAvatar(current, isDown, key, mods)
if sendFadingMessage is not None:
if AimData['ModEnable'] and key == getattr(Keys, AimData['ToggleKye'], None) and isDown:
AimData['ModEnable'] = False
sendFadingMessage('Отключите модуль автоматической регулировки.', color=BATTLE_MESSAGES_CONSTS.COLOR_RED, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
return
if not AimData['ModEnable'] and key == getattr(Keys, AimData['ToggleKye'], None) and isDown:
AimData['ModEnable'] = True
sendFadingMessage('Включить модуль автоматической регулировки', color=BATTLE_MESSAGES_CONSTS.COLOR_GREEN, panel=BATTLE_VIEW_ALIASES.PLAYER_MESSAGES)
return
@classmethod
def New_ChangeColor(cls, gunMarker, excludeTeam = 0, piercingMultiplier = 1):
collision = gunMarker.collData
if collision is None:
return _SHOT_RESULT.UNDEFINED
else:
entity = collision.entity
if entity.health <= 0 or entity.publicInfo['team'] == excludeTeam:
return _SHOT_RESULT.UNDEFINED
player = BigWorld.player()
if player is None:
return _SHOT_RESULT.UNDEFINED
vDesc = player.getVehicleDescriptor()
gunInstallationSlot = vDesc.gunInstallations[gunMarker.gunInstallationIndex]
shot = vDesc.shot if gunInstallationSlot.isMainInstallation() else gunInstallationSlot.gun.shots[0]
ppDesc = shot.piercingPower
maxDist = shot.maxDistance
dist = (gunMarker.position - player.getOwnVehiclePosition()).length
piercingPower = computePiercingPowerAtDist(ppDesc, dist, maxDist, piercingMultiplier)
piercingPercent = 1000.0
if piercingPower > 0.0:
armor = collision.armor
piercingPercent = 100.0 + (armor - piercingPower) / piercingPower * 100.0
if piercingPercent >= 150:
result = _SHOT_RESULT.NOT_PIERCED
elif 90 < piercingPercent < 150:
result = _SHOT_RESULT.LITTLE_PIERCED
else:
result = _SHOT_RESULT.GREAT_PIERCED
AimData['__Type__'] = result
if piercingPercent >= 150:
result = _SHOT_RESULT.NOT_PIERCED
AimData['__Type__'] = 'not_pierced'
elif 90 < piercingPercent < 150:
result = _SHOT_RESULT.LITTLE_PIERCED
AimData['__Type__'] = 'little_pierced'
else:
result = _SHOT_RESULT.GREAT_PIERCED
AimData['__Type__'] = 'great_pierced'
return result
speed_ = BigWorld.player().vehicle.filter.speedInfo.value[0] * 3.6
if player.arena.vehicles[player.playerVehicleID]['isAlive']:
AimData['MeSpeed'] = abs(round(speed_, 3))
else:
AimData['MeSpeed'] = 0
return Old_ChangeColor(cls, gunMarker, excludeTeam = 0, piercingMultiplier = 1)
_StandardShotResult.getShotResult = New_ChangeColor
PlayerAvatar.handleKey = New_PlayerAvatar
ArcadeControlMode.handleKeyEvent = New_Arcade_HandleKeyEvent
SniperControlMode.handleKeyEvent = New_Sniper_HandleKeyEvent
StrategicControlMode.handleKeyEvent = New_Strategic_HandleKeyEvent
#PlayerAvatar.vehicle_onEnterWorld = New_OnEnterWorld
PlayerAvatar.vehicle_onAppearanceReady = New_OnEnterWorld
PlayerAvatar.vehicle_onLeaveWorld = New_OnLeaveWorld
old_afterCreate = BattleEntry.afterCreate
BattleEntry.afterCreate = new_afterCreate
old_beforeDelete = BattleEntry.beforeDelete
BattleEntry.beforeDelete = new_beforeDelete
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
При необходимости вы можете самостоятельно это изучить.
