Esempio n. 1
0
 def injectButton(self, event):
     if not config.data['enabled']: return
     if inject.g_appLoader().getDefBattleApp():
         if g_gui.get_key(config.data['buttonShow']) and event.isKeyDown(
         ) and self.battleStarted:
             if config.data[
                     'showOnlyLightTanks'] and Vehicle.getVehicleClassTag(
                         self.player.getVehicleDescriptor(
                         ).type.tags) != VEHICLE_CLASS_NAME.LIGHT_TANK:
                 return
             self.status = not self.status
             message = config.i18n[
                 'UI_message_on'] if self.status else config.i18n[
                     'UI_message_off']
             color = '#84DE40' if self.status else '#FFA500'
             inject.message(message, color)
             self.setVisible(self.status)
         if g_gui.get_key(
                 config.buttons['buttonMark']) and event.isKeyDown():
             if self.player:
                 teamBase = self.player.guiSessionProvider.getArenaDP(
                 ).getNumberOfTeam()
                 teamBase -= 1
                 position = self.player.getOwnVehiclePosition()
                 message = 'map: %s, base: %s, pos: %s' % (
                     self.mapSelected, teamBase, position)
                 # noinspection PyProtectedMember
                 gameplayID = self.player.arena.arenaType._ArenaType__gameplayCfg[
                     'gameplayID']
                 print '"%s": [%s]([%s], [%s])' % (
                     self.mapSelected, gameplayID, position
                     if not teamBase else '', position if teamBase else '')
                 inject.message(message)
                 self.createModel(position)
Esempio n. 2
0
    def autoUse(self, state, value):
        if not config.data['autoRepair']: return
        if self.ctrl is None:
            return
        # status = '%s' % [key for key, ids in VEHICLE_VIEW_STATE.__dict__.iteritems() if ids == state][0]
        time = random.uniform(config.data['timerMin'], config.data['timerMax'])
        if config.data['extinguishFire'] and state == VEHICLE_VIEW_STATE.FIRE:
            BigWorld.callback(time, partial(self.useItem, 'extinguisher'))
            time += 0.1

        if state == VEHICLE_VIEW_STATE.DEVICES:
            deviceName, deviceState, actualState = value
            if deviceState in DEVICE_STATE_AS_DAMAGE:
                if deviceName in COMPLEX_ITEM:
                    itemName = COMPLEX_ITEM[deviceName]
                else:
                    itemName = deviceName
                equipmentTag = 'medkit' if deviceName in TANKMEN_ROLES_ORDER_DICT['enum'] else 'repairkit'
                specific = config.data['repairPriority'][Vehicle.getVehicleClassTag(BigWorld.player().vehicleTypeDescriptor.type.tags)][equipmentTag]
                if itemName in specific:
                    if config.data['healCrew'] and equipmentTag == 'medkit':
                        BigWorld.callback(time, partial(self.useItem, 'medkit', deviceName))
                    if config.data['repairDevices'] and equipmentTag == 'repairkit':
                        BigWorld.callback(time, partial(self.useItem, 'repairkit', deviceName))
                        time += 0.1

        if config.data['removeStun'] and state == VEHICLE_VIEW_STATE.STUN:
            BigWorld.callback(time, partial(self.useItem, 'medkit'))
Esempio n. 3
0
 def startBattle(self):
     if not config.data['enabled']: return
     self.player = BigWorld.player()
     del self.points[:]
     InputHandler.g_instance.onKeyDown += self.injectButton
     InputHandler.g_instance.onKeyUp += self.injectButton
     vehicle = self.player.arena.vehicles[self.player.playerVehicleID]
     if config.data['showOnlyLightTanks'] and Vehicle.getVehicleClassTag(
             self.player.getVehicleDescriptor(
             ).type.tags) != VEHICLE_CLASS_NAME.LIGHT_TANK:
         return
     self.height = float((vehicle['vehicleType'].hull.turretPositions[0] +
                          vehicle['vehicleType'].turret.gunPosition +
                          vehicle['vehicleType'].chassis.hullPosition).y)
     # 0 ctf, 1 domination, 2 assault
     # noinspection PyProtectedMember
     gameplayID = self.player.arena.arenaType._ArenaType__gameplayCfg[
         'gameplayID']
     if self.mapSelected and self.mapSelected in mapsData.data and len(
             mapsData.data[self.mapSelected]) > 2:
         teamBase = self.player.guiSessionProvider.getArenaDP(
         ).getNumberOfTeam()
         teamBase -= 1
         if gameplayID < len(mapsData.data[self.mapSelected]) and len(
                 mapsData.data[self.mapSelected][gameplayID]) > 1:
             for position in mapsData.data[
                     self.mapSelected][gameplayID][teamBase]:
                 self.points.append(self.createModel(
                     Math.Vector3(position)))
     if len(self.points):
         self.battleStarted = True
     self.status = config.data['showOnStartBattle']
     self.setVisible(self.status)
     self.checkBattleStarted()
Esempio n. 4
0
    def __getSlotsData(self, vehsList):
        result = []
        for v in vehsList:
            nationID, _ = v.type.id
            result.append({
                'vehicleID':
                v.intCD,
                'vehicleName':
                self.__getVehicleName(v),
                'flagIcon':
                _FLAG_ICON_TEMPLATE % nations.NAMES[nationID],
                'vehicleIcon':
                getIconPath(v.type.name),
                'vehicleType':
                _VEHICLE_TYPE_TEMPLATE %
                Vehicle.getVehicleClassTag(v.type.tags),
                'isElite':
                False,
                'isPremium':
                isPremium(v.type.tags),
                'vehicleLevel':
                _VEHICLE_LEVEL_TEMPLATE % v.type.level
            })

        return result
Esempio n. 5
0
 def startBattle(self):
     InputHandler.g_instance.onKeyDown += self.injectButton
     # InputHandler.g_instance.onKeyUp += self.injectButton
     if config.data['enabled']:
         self.player = BigWorld.player()
         self.modelSplashVisible = config.data['showSplashOnDefault']
         self.modelDotVisible = config.data['showDotOnDefault']
         self.scaleSplash = None
         self.modelSplash = StaticObjectMarker3D(
             {'path': config.data['modelPathSplash']}, (0, 0, 0))
         self.modelDot = StaticObjectMarker3D(
             {'path': config.data['modelPathDot']}, (0, 0, 0))
         self.modelDot._StaticObjectMarker3D__model.scale = (0.1, 0.1, 0.1)
         if Vehicle.getVehicleClassTag(self.player.vehicleTypeDescriptor.
                                       type.tags) == VEHICLE_CLASS_NAME.SPG:
             self.modelDot._StaticObjectMarker3D__model.scale = (0.5, 0.5,
                                                                 0.5)
         self.modelSplash._StaticObjectMarker3D__model.visible = False
         self.modelDot._StaticObjectMarker3D__model.visible = False
         self.modelSplashCircle = BigWorld.PyTerrainSelectedArea()
         self.modelSplashCircle.setup(
             'content/Interface/CheckPoint/CheckPoint_yellow_black.model',
             Math.Vector2(2.0, 2.0), 0.5, 4294967295L)
         self.modelSplash._StaticObjectMarker3D__model.root.attach(
             self.modelSplashCircle)
         self.modelSplashCircle.enableAccurateCollision(False)
Esempio n. 6
0
 def __setVehicleData(self, vehicleDescr=None, maxHealth=None):
     if vehicleDescr is not None:
         vehicleType = vehicleDescr.type
         self.compactDescr = vehicleType.compactDescr
         self.strCompactDescr = vehicleDescr.makeCompactDescr()
         tags = vehicleType.tags
         self.tags = tags
         self.classTag = Vehicle.getVehicleClassTag(tags)
         self.isObserver = isObserver(tags)
         self.isPremiumIGR = isPremiumIGR(tags)
         self.turretYawLimits = vehicle_getter.getYawLimits(vehicleDescr)
         self.isDualGunVehicle = vehicleDescr.isDualgunVehicle
         self.chassisType = vehicleDescr.chassis.chassisType
         self.shortName = vehicleType.shortUserString
         self.name = Vehicle.getUserName(vehicleType=vehicleType,
                                         textPrefix=True)
         self.shortNameWithPrefix = Vehicle.getShortUserName(
             vehicleType=vehicleType, textPrefix=True)
         self.guiName = Vehicle.getShortUserName(vehicleType)
         self.nationID = vehicleType.id[0]
         self.level = vehicleType.level
         self.maxHealth = maxHealth
         self.isOnlyForBattleRoyaleBattles = isBattleRoyaleTank(tags)
         vName = vehicleType.name
         self.iconName = settings.makeVehicleIconName(vName)
         self.iconPath = settings.makeContourIconSFPath(vName)
     else:
         vehicleName = i18n.makeString(settings.UNKNOWN_VEHICLE_NAME)
         self.tags = frozenset()
         self.compactDescr = 0
         self.strCompactDescr = ''
         self.classTag = None
         self.isObserver = False
         self.isPremiumIGR = False
         self.turretYawLimits = None
         self.shortName = vehicleName
         self.isDualGunVehicle = False
         self.chassisType = 0
         self.name = vehicleName
         self.guiName = vehicleName
         self.shortNameWithPrefix = vehicleName
         self.nationID = nations.NONE_INDEX
         self.level = settings.UNKNOWN_VEHICLE_LEVEL
         self.iconName = settings.UNKNOWN_CONTOUR_ICON_NAME
         self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
         self.shortNameWithPrefix = vehicleName
         self.maxHealth = None
         self.isOnlyForBattleRoyaleBattles = False
     return
 def repair(self, equipmentTag):
     specific = config.data['repairPriority'][Vehicle.getVehicleClassTag(
         BigWorld.player().vehicleTypeDescriptor.type.tags)][equipmentTag]
     if config.data['useGoldKits'] and self.items[equipmentTag][3]:
         equipment = self.items[equipmentTag][3]
         if equipment is not None:
             # noinspection PyUnresolvedReferences
             devices = [
                 name for name, state in equipment.getEntitiesIterator()
                 if state and state != DEVICE_STATE_NORMAL
             ]
             result = []
             for device in specific:
                 if device in COMPLEX_ITEM:
                     itemName = COMPLEX_ITEM[device]
                 else:
                     itemName = device
                 if itemName in devices:
                     result.append(device)
             if len(result) > 1:
                 self.useItemGold(equipmentTag)
             elif result:
                 self.useItem(equipmentTag, result[0])
     elif self.items[equipmentTag][2]:
         equipment = self.items[equipmentTag][2]
         if equipment is not None:
             # noinspection PyUnresolvedReferences
             devices = [
                 name for name, state in equipment.getEntitiesIterator()
                 if state and state != DEVICE_STATE_NORMAL
             ]
             result = []
             for device in specific:
                 if device in COMPLEX_ITEM:
                     itemName = COMPLEX_ITEM[device]
                 else:
                     itemName = device
                 if itemName in devices:
                     result.append(device)
             if len(result) > 1:
                 self.useItemGold(equipmentTag)
             elif result:
                 self.useItem(equipmentTag, result[0])
Esempio n. 8
0
 def startBattle(self):
     InputHandler.g_instance.onKeyDown += self.injectButton
     # InputHandler.g_instance.onKeyUp += self.injectButton
     if config.data['enabled']:
         self.player = BigWorld.player()
         self.modelSplashVisible = config.data['showSplashOnDefault']
         self.modelDotVisible = config.data['showDotOnDefault']
         self.scaleSplash = None
         self.modelSplash = StaticObjectMarker3D(
             {'path': config.data['modelPathSplash']}, (0, 0, 0))
         self.modelDot = StaticObjectMarker3D(
             {'path': config.data['modelPathDot']}, (0, 0, 0))
         self.modelDot._StaticObjectMarker3D__model.scale = (0.1, 0.1, 0.1)
         if Vehicle.getVehicleClassTag(self.player.vehicleTypeDescriptor.
                                       type.tags) == VEHICLE_CLASS_NAME.SPG:
             self.modelDot._StaticObjectMarker3D__model.scale = (0.5, 0.5,
                                                                 0.5)
         self.modelSplash._StaticObjectMarker3D__model.visible = False
         self.modelDot._StaticObjectMarker3D__model.visible = False
Esempio n. 9
0
 def __setVehicleData(self, vehicleDescr=None):
     if vehicleDescr is not None:
         vehicleType = vehicleDescr.type
         self.compactDescr = vehicleType.compactDescr
         tags = vehicleType.tags
         self.classTag = Vehicle.getVehicleClassTag(tags)
         self.isObserver = isObserver(tags)
         self.isPremiumIGR = isPremiumIGR(tags)
         self.turretYawLimits = vehicle_getter.getYawLimits(vehicleDescr)
         self.shortName = vehicleType.shortUserString
         self.name = Vehicle.getUserName(vehicleType=vehicleType,
                                         textPrefix=True)
         self.shortNameWithPrefix = Vehicle.getShortUserName(
             vehicleType=vehicleType, textPrefix=True)
         self.guiName = Vehicle.getShortUserName(vehicleType)
         self.nationID = vehicleType.id[0]
         self.level = vehicleType.level
         self.maxHealth = vehicleDescr.maxHealth
         vName = vehicleType.name
         self.iconName = settings.makeVehicleIconName(vName)
         self.iconPath = settings.makeContourIconSFPath(vName)
     else:
         self.compactDescr = 0
         self.classTag = None
         self.isObserver = False
         self.isPremiumIGR = False
         self.turretYawLimits = None
         self.shortName = settings.UNKNOWN_VEHICLE_NAME
         self.name = settings.UNKNOWN_VEHICLE_NAME
         self.guiName = settings.UNKNOWN_VEHICLE_NAME
         self.shortNameWithPrefix = settings.UNKNOWN_VEHICLE_NAME
         self.nationID = nations.NONE_INDEX
         self.level = settings.UNKNOWN_VEHICLE_LEVEL
         self.iconName = settings.UNKNOWN_CONTOUR_ICON_NAME
         self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
         self.shortNameWithPrefix = settings.UNKNOWN_VEHICLE_NAME
         self.maxHealth = None
     return
Esempio n. 10
0
 def getOrderByClass(self):
     return Vehicle.getOrderByVehicleClass(Vehicle.getVehicleClassTag(self.vehicle.descriptor.type.tags))