Exemple #1
3
    def __init__(self, data, position):
        super(_StaticObjectMarker3D, self).__init__()
        path = data.get('path')
        offset = data.get('offset', Math.Vector3(0, 0, 0))
        self.__model = None
        if path is not None:
            try:
                self.__model = BigWorld.Model(path)
                self.__model.position = Math.Vector3(position[:]) + offset
                self.__model.castsShadow = False
            except ValueError:
                LOG_CURRENT_EXCEPTION()
                LOG_ERROR('Model not found', path)
                return
            except AttributeError:
                LOG_CURRENT_EXCEPTION()
                return

            BigWorld.addModel(self.__model)
            action = data.get('action')
            if action is not None and len(action):
                try:
                    self.__model.action(action)()
                except ValueError:
                    LOG_ERROR('Action not found', path, action)

        return
Exemple #2
0
 def stop(self, finished = False, reason = TUTORIAL_STOP_REASON.DEFAULT):
     if self._tutorialStopped:
         return
     else:
         if self.__callbackID is not None:
             BigWorld.cancelCallback(self.__callbackID)
             self.__callbackID = None
         if self._funcScene is not None:
             self._funcScene.leave()
         if self._data is not None:
             self._data.clear()
         GlobalStorage.clearFlags()
         if self._sound is not None:
             self._sound.stop()
         self._sound = None
         if self._gui is not None:
             self._gui.fini(isItemsRevert=self._descriptor.isItemsRevertIfStop(reason))
         self._gui = None
         if finished:
             self._cache.setFinished(True).write()
         else:
             self._cache.update(self._currentChapter, self._flags.getDict() if self._flags else None)
         self._cache = None
         g_tutorialWeaver.clear()
         clearTutorialProxy()
         self.removeEffectsInQueue()
         self._nextChapter = False
         self._tutorialStopped = True
         self._initialized = 0
         return
Exemple #3
0
 def requestEmblemByUrl(cls, url, callback):
     if hasattr(BigWorld.player(), 'customFilesCache'):
         if url is not None:
             BigWorld.player().customFilesCache.get(url, lambda _, data: callback(data))
     else:
         LOG_WARNING('Trying to get emblem by url from non-account', url)
     return
Exemple #4
0
    def save(self):
        tmpList = []
        for fireKey, listKeyInfo in self.__mapping.iteritems():
            for command, satelliteKeys, isDefault in listKeyInfo:
                if isDefault:
                    continue
                if len(satelliteKeys):
                    continue
                commandName = self.getName(command)
                listSatelliteKeyNames = []
                for key in satelliteKeys:
                    listSatelliteKeyNames.append('KEY_' + BigWorld.keyToString(key))

                strSatelliteKeyNames = ''
                for keyName in listSatelliteKeyNames:
                    strSatelliteKeyNames += keyName + ' '

                strSatelliteKeyNames = strSatelliteKeyNames.strip()
                fireKeyName = 'KEY_' + BigWorld.keyToString(fireKey)
                tmpList.append((commandName, fireKeyName, strSatelliteKeyNames))

        if len(tmpList):
            section = Settings.g_instance.userPrefs
            section.deleteSection(CommandMapping.__USER_CONFIG_SECTION_NAME)
            section = section.createSection(CommandMapping.__USER_CONFIG_SECTION_NAME)
            for commandName, fireKeyName, strSatelliteKeynames in tmpList:
                subsec = section.createSection(commandName)
                subsec.writeString('fireKey', fireKeyName)
                subsec.writeString('satelliteKeys', strSatelliteKeyNames)

            Settings.g_instance.save()
Exemple #5
0
 def _callbackWrapper(self, requestType, callback, cooldown, *args):
     callbackID = self._waiters.pop(requestType, None)
     if callbackID is not None:
         BigWorld.cancelCallback(callbackID)
     self._cooldown.adjust(requestType, cooldown)
     callback(*args)
     return
 def __getControlQuestion(self, usingGold = False):
     if usingGold:
         currencyFormatter = BigWorld.wg_getGoldFormat(long(self.controlNumber))
     else:
         currencyFormatter = BigWorld.wg_getIntegralFormat(long(self.controlNumber))
     question = makeHtmlString('html_templates:lobby/dialogs', 'vehicleSellQuestion', {'controlNumber': currencyFormatter})
     return question
Exemple #7
0
    def __devDismissInvalidTankmen(self, tmanInvID, callback):

        def response(code):
            LOG_WARNING('Invalid tankman dismissing result', tmanInvID, code)
            callback(code >= 0)

        BigWorld.player().inventory.dismissTankman(tmanInvID, response)
Exemple #8
0
 def _clearEntitiesAndSpaces(self):
     from gui.shared.utils.HangarSpace import g_hangarSpace
     keepClientOnlySpaces = False
     if g_hangarSpace is not None and g_hangarSpace.inited:
         keepClientOnlySpaces = g_hangarSpace.spaceLoading()
     BigWorld.clearEntitiesAndSpaces(keepClientOnlySpaces)
     return
Exemple #9
0
 def _doAttention(self, index, duration):
     player = BigWorld.player()
     if player is not None and player.isTeleport:
         position = minimap_utils.getPositionByCellIndex(index, *self._boundingBox)
         result = BigWorld.collide(player.spaceID, (position[0], 1000.0, position[2]), (position[0], -1000.0, position[2]))
         player.base.vehicle_teleport((position[0], result[0][1], position[2]), 0)
     return
Exemple #10
0
 def __setSoundMuted(self, isMuted):
     BigWorld.wg_setMovieSoundMuted(isMuted)
     SoundGroups.g_instance.enableAmbientAndMusic(isMuted)
     if isMuted:
         MusicController.g_musicController.play(MusicController.MUSIC_EVENT_LOBBY)
     else:
         MusicController.g_musicController.stop()
Exemple #11
0
    def handleKey(self, key, isDown, offset):
        cmdMap = CommandMapping.g_instance
        if cmdMap.isFired(CommandMapping.CMD_RADIAL_MENU_SHOW, key):
            if isDown:
                if self.__currentVehicleDesc is None:
                    self.__currentVehicleDesc = self.__getCurrentVehicleDesc()
                if self.__currentVehicleDesc is not None:
                    self.__currentTarget = BigWorld.target()
                    mouseUsedForShow = getScaleformKey(key) <= BW_TO_SCALEFORM[Keys.KEY_MOUSE7]
                    self.__onMenuShow(offset, mouseUsedForShow)
            else:
                self.__onMenuHide()
        elif isDown:
            if not self.__ingameMenuIsVisible():
                if self.__currentVehicleDesc is None:
                    self.__currentVehicleDesc = self.__getCurrentVehicleDesc()
                if not self.__showed:
                    self.__currentTarget = BigWorld.target()
                for command in self.KEYB_MAPPINGS:
                    shortcut = self.KEYB_CMDS_MAPPINGS[command]
                    if cmdMap.isFired(getattr(CommandMapping, shortcut), key):
                        action = self.__getMappedCommand(command)
                        if action not in self.DENIED_KEYB_CMDS:
                            self.onAction(action)

        return
 def __updateAim(self):
     if self.getPlaybackSpeedIdx() == 0:
         player = BigWorld.player()
         if isPlayerAvatar():
             if player.inputHandler.aim is not None:
                 player.inputHandler.aim._update()
             BigWorld.callback(0, self.__updateAim)
    def __onResourcesLoaded(self, resourceRefs):
        if self.guid not in BigWorld.userDataObjects:
            return
        else:
            self.__clear()
            if self.modelName in resourceRefs.failedIDs:
                return
            try:
                self.__model = resourceRefs[self.modelName]
                self.__modelMatrix = Matrix()
                self.__modelMatrix.setIdentity()
                servo = BigWorld.Servo(self.__modelMatrix)
                self.__model.addMotor(servo)
                BigWorld.addModel(self.__model)
                if self.actionName != '':
                    action = self.__model.action(self.actionName)
                    if action is not None:
                        action()
                if self.pixieName != '' and self.pixieName not in resourceRefs.failedIDs:
                    pixieNode = self.__model.node(self.pixieHardPoint)
                    pixieNode.attach(resourceRefs[self.pixieName])
                if self.soundName != '':
                    self.__sound = SoundGroups.g_instance.playSoundModel(self.__model, self.soundName)
            except:
                LOG_CURRENT_EXCEPTION()
                self.__model = None
                return

            self.__prevTime = BigWorld.time()
            self.__update()
            return
Exemple #14
0
    def onLogoff(self, arg):
        import BigWorld

        def logOff():
            g_appLoader.goToLoginByRQ()

        BigWorld.callback(0.1, logOff)
    def __doShot(self, data):
        data['_timerID'] = None
        try:
            vehicle = data['entity']
            if not vehicle.isAlive():
                self.stop(data)
                return
            burstCount, burstInterval = data['_burst']
            gunModel = data['_gunModel']
            effPlayer = data['_effectsListPlayer']
            effPlayer.stop()
            if burstCount == 1:
                effPlayer.play(gunModel, None, partial(self.stop, data))
                withShot = 1
            else:
                data['_burst'] = (burstCount - 1, burstInterval)
                data['_timerID'] = BigWorld.callback(burstInterval, partial(self.__doShot, data))
                effPlayer.play(gunModel)
                withShot = 2
            if data['entity'].isPlayerVehicle:
                avatar = BigWorld.player()
                avatar.getOwnVehicleShotDispersionAngle(avatar.gunRotator.turretRotationSpeed, withShot)
            if not vehicle.appearance.isInWater:
                groundWaveEff = effPlayer.effectsList.relatedEffects.get('groundWave')
                if groundWaveEff is not None:
                    self.__doGroundWaveEffect(data['entity'], groundWaveEff, gunModel)
            self.__doRecoil(vehicle, gunModel)
            if vehicle.isPlayerVehicle:
                appearance = vehicle.appearance
                appearance.executeShootingVibrations(vehicle.typeDescriptor.shot['shell']['caliber'])
        except Exception:
            LOG_CURRENT_EXCEPTION()
            self.stop(data)

        return
 def destroy(self):
     BigWorld.player().arena.onPeriodChange -= self.__arenaPeriodChanged
     if self.__startEngineCbk is not None:
         BigWorld.cancelCallback(self.__startEngineCbk)
     self._vehicle = None
     self._gearUpCbk = None
     return
Exemple #17
0
 def create(self):
     if self.__flagEntity is not None:
         LOG_ERROR('Flags: Wrong usage of offline flags')
         return
     else:
         self.__entityID = BigWorld.createEntity('OfflineFlag', BigWorld.player().spaceID, 0, self.__position, Vector3(0.0, 0.0, 0.0), dict({'flagID': self.__flagID}))
         return
Exemple #18
0
def showCursor():
    """not scaleform specific. show the bigworld mouse cursor"""
    import GUI
    import BigWorld
    c = GUI.mcursor()
    c.visible = 1
    BigWorld.setCursor(c)
 def tryBattlesTillCaptchaReset(self):
     if self.__tryReset:
         return
     if self.__triesLeft > 1:
         self.__tryReset = True
         LOG_WARNING('Client try battlesTillCaptcha reset')
         BigWorld.player().challengeCaptcha('', '', lambda resultID, errorCode: None)
Exemple #20
0
 def delayCallback(self, seconds, func, *args, **kwargs):
     curId = self.__callbacks.get(func)
     if curId is not None:
         BigWorld.cancelCallback(curId)
         del self.__callbacks[func]
     curId = BigWorld.callback(seconds, functools.partial(self.__funcWrapper, func, *args, **kwargs))
     self.__callbacks[func] = curId
    def handleLoginRejectedBan(self, status, message):
        try:
            LOG_DEBUG('handleLoginRejectedBan', message)
            msg_dict = json.loads(message)
            if not isinstance(msg_dict, dict):
                self.handleLoginCustomDefinedError(status, message)
                return
            self.__loginDataLoader.token2 = msg_dict.get('token2', '')
            self.__loginDataLoader.saveUserToken(self.__loginDataLoader.passLength, self.__loginDataLoader.token2)
            json_dict = msg_dict.get('bans')
            msg_dict = json.loads(json_dict)
        except Exception:
            LOG_CURRENT_EXCEPTION()
            self.handleLoginCustomDefinedError(status, message)
            return

        expiryTime = 0
        reason = ''
        if isinstance(msg_dict, dict):
            expiryTime = int(msg_dict.get('expiryTime', 0))
            reason = i18n.encodeUtf8(msg_dict.get('reason', ''))
        if reason == BAN_REASON.CHINA_MIGRATION:
            self.__handleMigrationNeeded()
        if reason.startswith('#'):
            reason = i18n.makeString(reason)
        if expiryTime > 0:
            expiryTime = makeLocalServerTime(expiryTime)
            expiryTime = BigWorld.wg_getLongDateFormat(expiryTime) + ' ' + BigWorld.wg_getLongTimeFormat(expiryTime)
            errorMessage = i18n.makeString(MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN, time=expiryTime, reason=reason)
        else:
            errorMessage = i18n.makeString(MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN_UNLIMITED, reason=reason)
        self.onSetStatus(errorMessage, self.ALL_VALID)
 def _populate(self):
     super(BattleLoading, self)._populate()
     g_sessionProvider.addArenaCtrl(self)
     BigWorld.wg_updateColorGrading()
     BigWorld.wg_enableGUIBackground(True, False)
     self._addArenaTypeData()
     Waiting.close()
 def shot(self, vehicle, attacker_id, points, effects_index):
     if not (_config.data['enabled'] and self.on_off): return
     if not vehicle.isStarted: return
     if not vehicle.isPlayerVehicle: return
     if BigWorld.player().team == BigWorld.player().arena.vehicles.get(attacker_id)['team']: return
     if vehicle.health < 1: return
     self.shots += 1
     index_hit, decode_comp_name = DamageFromShotDecoder.decodeHitPoints(points, vehicle.typeDescriptor)
     #compName = decode_comp_name[0].componentName if decode_comp_name else None
     has_pierced_hit = index_hit >= VEHICLE_HIT_EFFECT.ARMOR_PIERCED
     is_blocked = self.blocked_armor_hit(vehicle, decode_comp_name[0]) if decode_comp_name else False
     if is_blocked:
         for shell in BigWorld.player().arena.vehicles.get(attacker_id)['vehicleType'].gun['shots']:
             if effects_index == shell['shell']['effectsIndex']:
                 type_shell = shell['shell']['kind']
                 if type_shell != 'HIGH_EXPLOSIVE':
                     self.avgDMG, _ = shell['shell']['damage']
                     if has_pierced_hit:
                         self.list[self.shots] = {
                             'id'      : attacker_id,
                             'avgDMG'  : self.avgDMG,
                             'isDamage': False,
                             'used'    : False
                         }
                         BigWorld.callback(0.15, partial(self.shout_damage_hp, self.shots))
                     else: self.shout_damage()
                 break
     else: self.clear_data()
 def __calculateClosestPoint(self, start, dir):
     dir.normalise()
     end = start + dir.scale(10000.0)
     testResTerrain = BigWorld.wg_collideSegment(BigWorld.player().spaceID, start, end, 128, 8)
     terrainSuitsForCheck = testResTerrain and testResTerrain[1].dot(Math.Vector3(0.0, 1.0, 0.0)) <= math.cos(ShotPointCalculatorPlanar.TERRAIN_MIN_ANGLE)
     testResNonTerrain = BigWorld.wg_collideSegment(BigWorld.player().spaceID, start, end, 136)
     testResDynamic = collideDynamic(start, end, (BigWorld.player().playerVehicleID,), False)
     closestPoint = None
     closestDist = 1000000
     isPointConvenient = True
     if testResTerrain:
         closestPoint = testResTerrain[0]
         closestDist = (testResTerrain[0] - start).length
     if terrainSuitsForCheck:
         isPointConvenient = closestDist >= ShotPointCalculatorPlanar.MIN_DIST
     if testResNonTerrain is not None:
         dist = (testResNonTerrain[0] - start).length
         if dist < closestDist:
             closestPoint = testResNonTerrain[0]
             closestDist = dist
             isPointConvenient = closestDist >= ShotPointCalculatorPlanar.MIN_DIST
     if closestPoint is None and testResDynamic is None:
         return (AimingSystems.shootInSkyPoint(start, dir), True)
     else:
         if testResDynamic is not None:
             dynDist = testResDynamic[0]
             if dynDist <= closestDist:
                 dir = end - start
                 dir.normalise()
                 closestPoint = start + dir * dynDist
                 isPointConvenient = True
         return (closestPoint, isPointConvenient)
Exemple #25
0
    def __devSellInvalidVehicle(self, vehInvID, callback):

        def response(code):
            LOG_WARNING('Invalid vehicle selling result', vehInvID, code)
            callback(code >= 0)

        BigWorld.player().inventory.sellVehicle(vehInvID, True, [], [], response)
 def __updateSound(self, angleDiff):
     if self.__manualSound is None:
         return
     else:
         if self.__gearSound is not None and angleDiff >= _PlayerTurretRotationSoundEffect.__MIN_ANGLE_TO_ENABLE_GEAR:
             if self.__currentSpeedState != self.__SPEED_FAST and self.__currentSpeedState != self.__SPEED_PRE_FAST:
                 nextSpeedState = self.__SPEED_PRE_FAST
             else:
                 nextSpeedState = self.__currentSpeedState
         elif angleDiff >= _PlayerTurretRotationSoundEffect.__MIN_ANGLE_TO_ENABLE_MANUAL:
             nextSpeedState = self.__SPEED_SLOW
         else:
             nextSpeedState = self.__SPEED_IDLE
         stateFn = self.__stateTable[self.__currentSpeedState][nextSpeedState]
         if stateFn is not None:
             stateFn()
         self.__currentSpeedState = nextSpeedState
         if g__attachToCam:
             __p = BigWorld.camera().position
         else:
             __p = BigWorld.player().position
         isTurretAlive = BigWorld.player().deviceStates.get('turretRotator', None) is None
         if self.__gearDamagedParam is not None:
             self.__gearDamagedParam.value = 0.0 if isTurretAlive else 1.0
         if self.__manGearDamagedParam is not None:
             self.__manGearDamagedParam.value = 0.0 if isTurretAlive else 1.0
         if self.__manualSound is not None:
             self.__manualSound.position = __p
         if self.__gearSound is not None:
             self.__gearSound.position = __p
         return
 def __init_sound(self):
     if BigWorld.player() is not None and BigWorld.player().getVehicleAttached() is not None:
         self.connectSoundToMatrix(BigWorld.player().getVehicleAttached().appearance.modelsDesc['turret']['model'].matrix)
     else:
         self.connectSoundToMatrix(mathUtils.createIdentityMatrix())
     self.delayCallback(self.__updatePeriod, self.__update)
     return
Exemple #28
0
    def _clearWaiters(self):
        if self._waiters is not None:
            while len(self._waiters):
                _, callbackID = self._waiters.popitem()
                BigWorld.cancelCallback(callbackID)

        return
 def __onTick(self):
     self.__timerID = BigWorld.callback(self.__ROTATION_TICK_LENGTH, self.__onTick)
     lockEnabled = BigWorld.player().inputHandler.getAimingMode(AIMING_MODE.TARGET_LOCK)
     usePredictedLockShotPoint = lockEnabled and VehicleGunRotator.USE_LOCK_PREDICTION
     replayCtrl = BattleReplay.g_replayCtrl
     if not self.__clientMode and not replayCtrl.isPlaying and not usePredictedLockShotPoint:
         return
     else:
         replayCtrl = BattleReplay.g_replayCtrl
         if replayCtrl.isPlaying:
             shotPoint = replayCtrl.getGunRotatorTargetPoint()
         else:
             predictedLockShotPoint = self.predictLockedTargetShotPoint() if usePredictedLockShotPoint else None
             shotPoint = self.__shotPointSourceFunctor() if predictedLockShotPoint is None else predictedLockShotPoint
         if shotPoint is None and self.__targetLastShotPoint:
             shotPoint = self.__lastShotPoint
         if replayCtrl.isRecording:
             if shotPoint is not None:
                 replayCtrl.setGunRotatorTargetPoint(shotPoint)
         self.__updateShotPointOnServer(shotPoint)
         timeDiff = self.__getTimeDiff()
         if timeDiff is None:
             return
         self.__time = BigWorld.time()
         self.__rotate(shotPoint, timeDiff)
         self.__updateGunMarker()
         if replayCtrl.isPlaying:
             replayCtrl.resetUpdateGunOnTimeWarp()
         return
 def onLogin(self, user, password, host, hdlr, isSocialToken2Login = False):
     self.__onLoggingTryingEndHdlr = hdlr
     self.__kickedFromServer = False
     self.__kickPeripheryID = None
     if self.__closeCallbackId:
         BigWorld.cancelCallback(self.__closeCallbackId)
         self.__closeCallbackId = None
     if not isSocialToken2Login:
         if not self.__validateCredentials(user.lower().strip(), password.strip()):
             self.__onLoggingTryingEndHdlr()
             return
     Waiting.show('login')
     self.__loginDataLoader.host = host
     self.__loginDataLoader.user = user
     self.__loginDataLoader.passLength = len(password)
     self.__loginDataLoader.saveUserConfig(user, self.__loginDataLoader.host)
     password = pwd_token.generate(password)
     if len(self.__loginDataLoader.token2):
         password = ''
     token2 = self.__loginDataLoader.token2
     if AUTO_LOGIN_QUERY_URL == host:
         g_preDefinedHosts.autoLoginQuery(lambda host: connectionManager.connect(getHostURL(host, token2), user, password, host.keyPath, nickName=None, token2=token2, isNeedSavingPwd=self.__loginDataLoader.rememberPwd))
         return
     else:
         host = g_preDefinedHosts.byUrl(host)
         connectionManager.connect(getHostURL(host, token2, True), user, password, host.keyPath, nickName=None, token2=token2, isNeedSavingPwd=self.__loginDataLoader.rememberPwd)
         return
 def __showBrowser(self):
     BigWorld.callback(0.01, self.as_loadBrowserS)
def assembleTerrainMatKindSensor(appearance, lodStateLink):
    TERRAIN_MAT_KIND_SENSOR_LOD_DIST = 100.0
    TERRAIN_MAT_KIND_SENSOR_MAX_PRIORITY = 15
    compoundModel = appearance.compoundModel
    invertedOrigin = Math.Matrix(compoundModel.matrix)
    leftNodeMatrix = Math.Matrix(compoundModel.node(TankNodeNames.TRACK_LEFT_MID))
    rightNodeMatrix = Math.Matrix(compoundModel.node(TankNodeNames.TRACK_RIGHT_MID))
    leftNodeMatrix.postMultiply(invertedOrigin)
    rightNodeMatrix.postMultiply(invertedOrigin)
    scanLength = 4.0
    offset = Math.Vector3(0.0, scanLength * 0.5, 0.0)
    localPoints = (leftNodeMatrix.translation + offset, rightNodeMatrix.translation + offset, Math.Vector3(0.0, 0.0, 0.0) + offset)
    sensor = appearance.terrainMatKindSensor = Vehicular.TerrainMatKindSensor(compoundModel.root, localPoints, scanLength, BigWorld.player().spaceID)
    sensor.setLodLink(lodStateLink)
    sensor.setLodSettings(shared_components.LodSettings(TERRAIN_MAT_KIND_SENSOR_LOD_DIST, TERRAIN_MAT_KIND_SENSOR_MAX_PRIORITY))
Exemple #33
0
 def __loadStatsCallback(self, timeout=None):
     if constants.IS_SHOW_SERVER_STATS:
         self.__statsCallbackID = BigWorld.callback(
             timeout if timeout is not None else self.STATS_REQUEST_TIMEOUT,
             self.__requestServerStats)
     return
Exemple #34
0
 def __requestServerStats(self):
     self.__clearStatsCallback()
     if hasattr(BigWorld.player(), 'requestServerStats'):
         BigWorld.player().requestServerStats()
Exemple #35
0
 def cancel(self):
     if self.__callbackId is not None:
         BigWorld.cancelCallback(self.__callbackId)
         self.__callbackId = None
 def _showView(self, isBubble):
     _showTimerView(self._typeID, self._viewID, self._panel, self._totalTime, isBubble, BigWorld.serverTime() - self._startTime)
 def _startTick(self):
     if self._totalTime > 0 and self._typeID not in _SECONDARY_TIMERS:
         self._panel.as_setTimeInSecondsS(self._typeID, self._totalTime, BigWorld.serverTime() - self._startTime)
 def __updateInspireTimer(self, isSourceVehicle, isInactivation, endTime, duration):
     LOG_DEBUG('[INSPIRE] {} __updateInspireTimer: isSourceVehicle: {}, isInactivation: {}, endTime: {}, duration: {}'.format(*(str(x) for x in (BigWorld.player().id,
      isSourceVehicle,
      isInactivation,
      endTime,
      duration))))
     if isInactivation is not None:
         self._hideTimer(_TIMER_STATES.INSPIRE)
         self._hideTimer(_TIMER_STATES.INSPIRE_CD)
         if isInactivation:
             self._timers.addTimer(_TIMER_STATES.INSPIRE_CD, _TIMER_STATES.WARNING_VIEW, duration, endTime)
             self.as_setSecondaryTimerTextS(_TIMER_STATES.INSPIRE_CD, i18n.makeString(EPIC_BATTLE.INSPIRE_INSPIRED))
         else:
             self._timers.addTimer(_TIMER_STATES.INSPIRE, _TIMER_STATES.WARNING_VIEW, duration, endTime)
             text = i18n.makeString(EPIC_BATTLE.INSPIRE_INSPIRING) if isSourceVehicle else i18n.makeString(EPIC_BATTLE.INSPIRE_INSPIRED)
             self.as_setSecondaryTimerTextS(_TIMER_STATES.INSPIRE, text)
     else:
         self._hideTimer(_TIMER_STATES.INSPIRE)
         self._hideTimer(_TIMER_STATES.INSPIRE_CD)
     return
Exemple #39
0
 def __onAvatarBecomePlayer(self):
     self._machine.post(
         StringEvent(PlayerEventID.AVATAR_BECOME_PLAYER,
                     arenaGuiType=getattr(BigWorld.player(), 'arenaGuiType',
                                          ARENA_GUI_TYPE.UNKNOWN)))
 def goNext(self):
     import BigWorld
     BigWorld.callback(0.1, lambda : g_bootcampEvents.onIntroVideoGoNext())
     if self.__isCurrentlyHighlighting(INTRO_HIGHLIGHT_TYPE.START_BUTTON):
         self.__setHighlighting(INTRO_HIGHLIGHT_TYPE.START_BUTTON, False)
 def _resetTime(self, resetTime):
     if resetTime:
         self._populateTime = int(BigWorld.time())
 def _init(self):
     self._avatar = BigWorld.player()
 def _request(self, callback):
     _logger.debug('Make server request to reset session stats')
     BigWorld.player().sessionStats.resetStats(lambda code, errStr, ext: self._response(code, callback, ctx=ext, errStr=errStr))
 def onLeaveWorld(self):
     self.__stopExtras()
     BigWorld.player().vehicle_onLeaveWorld(self)
Exemple #45
0
 def getStoredEpicDiscount(self):
     return BigWorld.player().epicMetaGame.getStoredDiscount()
Exemple #46
0
                                     userprefs.get('cache/xvmscales.json.gz'))
        _load_wn8_data_callback(None, userprefs.get('cache/wn8exp.json.gz'))
        _load_xte_data_callback(None, userprefs.get('cache/xte.json.gz'))
        _load_xtdb_data_callback(None, userprefs.get('cache/xtdb.json.gz'))

        # request latest values
        filecache.get_url(_XVMSCALE_DATA_URL, _load_xvmscale_data_callback)
        filecache.get_url(_WN8_DATA_URL, _load_wn8_data_callback)
        filecache.get_url(_XTE_DATA_URL, _load_xte_data_callback)
        filecache.get_url(_XTDB_DATA_URL, _load_xtdb_data_callback)

    except Exception, ex:
        err(traceback.format_exc())


BigWorld.callback(0, _init)


def _getRanges(turret, gun, nation, vclass):
    visionRadius = firingRadius = artyRadius = 0
    gunsInfoPath = _VEHICLE_TYPE_XML_PATH + nation + '/components/guns.xml/shared/'

    # Turret-dependent
    visionRadius = int(turret.circularVisionRadius)  # 240..420

    # Gun-dependent
    shots = gun.shots
    for shot in shots:
        radius = int(shot.maxDistance)
        if firingRadius < radius:
            firingRadius = radius  # 10000, 720, 395, 360, 350
Exemple #47
0
 def increaseSkillLevel(self, skillID):
     BigWorld.player().epicMetaGame.increaseAbility(skillID)
Exemple #48
0
 def changeEquippedSkills(self, skillIDArray, vehicleCD, callback=None):
     if callback is None:
         BigWorld.player().epicMetaGame.setSelectedAbilities(skillIDArray, vehicleCD)
     else:
         BigWorld.player().epicMetaGame.setSelectedAbilities(skillIDArray, vehicleCD, callback)
     return
def _makeShowTime():
    return BigWorld.time()
Exemple #50
0
 def onTriggerDeactivated(self, args):
     if args['type'] == TriggersManager.TRIGGER_TYPE.AREA and args[
             'name'] == self._triggerName:
         self._triggered = False
         BigWorld.player().updatePersonalDeathZoneWarningNotification(
             False, 0)
Exemple #51
0
 def __clearStatsCallback(self):
     if self.__statsCallbackID is not None:
         BigWorld.cancelCallback(self.__statsCallbackID)
         self.__statsCallbackID = None
     return
Exemple #52
0
 def _get_battleresults(self):
     (arenaUniqueId,) = self.req['args']
     player = BigWorld.player()
     player.battleResultsCache.get(int(arenaUniqueId), self._battleResultsCallback)
Exemple #53
0
def makeArcadeCameraMatrix():
    matrix = Math.WGCombinedMP()
    matrix.translationSrc = BigWorld.player().getOwnVehicleMatrix()
    matrix.rotationSrc = BigWorld.camera().invViewMatrix
    return matrix
def new__startGUI(self):
    if old__startGUI is not None:
        old__startGUI(self)

    global CONFIG_FILENAME, LOG_FILENAME, DAMAGE_FILTER, \
           SHOW_INFO, REC_COUNT, PRINT_LOG, GUI_TEXT_FONT, GUI_TEXT_XY, GUI_TEXT_COLOR, \
           GLOBAL_STATISTICS, TANKS_STATISTICS, PLAYER_SHOTS

    CONFIG_FILENAME = getConfigFileName()
    if CONFIG_FILENAME is not None:
        config = json.loads(
            re.compile('(/\*(.|\n)*?\*/)|((#|//).*?$)', re.I | re.M).sub(
                '',
                codecs.open(CONFIG_FILENAME, 'r', 'utf-8-sig').read()))
        DAMAGE_FILTER = config['System']['DamageStatistics']['Filter']
        SHOW_INFO = config['System']['DamageStatistics']['ShowDamageList']
        REC_COUNT = config['System']['DamageStatistics']['RecordsCount']
        GUI_TEXT_XY = (
            config['System']['DamageStatistics']['GUIFormat']['Position'][0],
            config['System']['DamageStatistics']['GUIFormat']['Position'][1])
        GUI_TEXT_COLOR = config['System']['DamageStatistics']['GUIFormat'][
            'Color']
        PRINT_LOG = config['System']['DamageStatistics']['PrintLog']
        LOG_FILENAME = getLogFileName(
            config['System']['DamageStatistics']['LogFormat']['Dir'],
            config['System']['DamageStatistics']['LogFormat']['Prefix'])
    GLOBAL_STATISTICS.clear()
    TANKS_STATISTICS.clear()
    PLAYER_SHOTS.clear()
    for vID in BigWorld.player().arena.vehicles:  #Кэшируем статистику
        vehicleType = BigWorld.player().arena.vehicles[vID]['vehicleType']
        TANKS_STATISTICS[vID] = {}
        TANKS_STATISTICS[vID]['UserName'] = BigWorld.player(
        ).arena.vehicles[vID]['name']
        TANKS_STATISTICS[vID][
            'name'] = vehicleType.type.shortUserString.replace(' ', '')
        TANKS_STATISTICS[vID]['type'] = {}
        TANKS_STATISTICS[vID]['type']['id'], \
        TANKS_STATISTICS[vID]['type']['name']  = getTankType(vehicleType.type.tags)
        TANKS_STATISTICS[vID]['isEnemy'] = (
            BigWorld.player().arena.vehicles[vID]['team'] !=
            BigWorld.player().team)
        TANKS_STATISTICS[vID]['isAlive'] = True
        #       TANKS_STATISTICS[vID]['balanceWeight'] = float(vehicleType.balanceWeight)
        TANKS_STATISTICS[vID]['hp'] = int(vehicleType.maxHealth)
        #Оборудование
        TANKS_STATISTICS[vID]['gun'] = {}  #Орудие
        TANKS_STATISTICS[vID]['gun']['shell'] = {0: {'typeName': 'AP',   'damage': 0}, \
                                                 1: {'typeName': 'APRC', 'damage': 0}, \
                                                 2: {'typeName': 'HC',   'damage': 0}, \
                                                 3: {'typeName': 'HE',   'damage': 0}} #Снаряды
        for shellID in vehicleType.gun['shots']:
            index, _ = getShellTypeID(shellID['shell']['kind'])
            TANKS_STATISTICS[vID]['gun']['caliber'] = float(
                shellID['shell']['caliber'])
            damage = float(shellID['shell']['damage'][0])
            if damage > TANKS_STATISTICS[vID]['gun']['shell'][index]['damage']:
                TANKS_STATISTICS[vID]['gun']['shell'][index]['damage'] = damage
            TANKS_STATISTICS[vID]['gun']['shell'][index][
                'effectsIndex'] = shellID['shell']['effectsIndex']
        if TANKS_STATISTICS[vID]['type']['id'] == 4:  #САУ
            shellID = 3  #ОФ
        else:  #Остальные
            if TANKS_STATISTICS[vID]['gun']['shell'][0]['damage'] != 0:
                shellID = 0  #ББ
            elif TANKS_STATISTICS[vID]['gun']['shell'][1]['damage'] != 0:
                shellID = 1  #ПК для тех у кого нет ББ
            else:
                shellID = 3  #иначе ОФ
        TANKS_STATISTICS[vID]['gun'][
            'mainShell'] = shellID  #Базовый снаряд танка
        TANKS_STATISTICS[vID]['gun']['mainDamage'] = TANKS_STATISTICS[vID][
            'gun']['shell'][TANKS_STATISTICS[vID]['gun']['mainShell']][
                'damage']  #Урон базовым снарядом
    printStrings(('------------------------- %s -------------------------\n' % datetime.now().strftime('%d.%m.%y %H:%M:%S'), \
                  '\nReason: BattleLoading\n\n'))
    printStartInfo()
    if SHOW_INFO:
        global GUI_TEXT
        GUI_TEXT = TextLabel(GUI_TEXT_XY[0], GUI_TEXT_XY[1], GUI_TEXT_COLOR,
                             GUI_TEXT_FONT, REC_COUNT)
        GUI_TEXT.Show()
Exemple #55
0
def makeDefaultCameraMatrix():
    return BigWorld.camera().invViewMatrix
Exemple #56
0
def endDustStorm():
    BigWorld.player().model.root.detach(dustStorm)
    BigWorld.player().model.root.detach(dustStormChunks)
    BigWorld.delFogEmitter(dustStormFog)
Exemple #57
0
def setup():
    BigWorld.camera(BigWorld.CursorCamera())
    BigWorld.setCursor(GUI.mcursor())
    GUI.mcursor().visible = True
 def __startCallback(self):
     if self.__time < self.__maxTime:
         self.__callbackId = BigWorld.callback(self.__timeOut,
                                               self.__onCallback)
     else:
         self._onTimedOutTick()
Exemple #59
0
 def _requestCache(self, callback):
     """
     Overloaded method to request shop cache
     """
     BigWorld.player().shop.getCache(lambda resID, value, rev: self._response(resID, value, callback))
Exemple #60
0
def makeStrategicCameraMatrix():
    matrix = Math.WGStrategicAreaViewMP()
    matrix.source = BigWorld.camera().invViewMatrix
    matrix.baseScale = (1.0, 1.0)
    return matrix