def showCurrentMode(self):
     if self._isEnabled:
         log.info('Sixth Sense Message enabled')
         Utils.addClientMessage(sm_settings.get('EnableSystemMsg'), True)
     else:
         log.info('Sixth Sense Message disabled')
         Utils.addClientMessage(sm_settings.get('DisableSystemMsg'), True)
    def showSixthSenseIndicator(self):
        if not self._isEnabled or not self._activeParams:
            log.info('sixth sense message is disabled or nothing to do.')
            return
        currentTime = Utils.getTime()
        cooldownTime = self._getCooldownTime(currentTime, self._cooldownInterval)
        if cooldownTime > 0:
            log.info('[time:{:.1f}] invoke sixth sense, but it\'s not time yet. (rest {:.1f}s)'.format(currentTime, cooldownTime))
            Utils.addClientMessage(sm_settings.get('CooldownMsg').format(rest=int(math.ceil(cooldownTime))))
            return
        log.info('[time:{:.1f}] invoke sixth sense.'.format(currentTime))

        player = Utils.getPlayer()
        teamAmount = Utils.getTeamAmount()
        cellIndex = MinimapInfo.getCellIndexByPosition(Utils.getPos())
        
        messenger = IngameMessanger()
        log.info('current chat channel: {}'.format(messenger.getChannelLabels()))
        log.info('current team amount: {}'.format(teamAmount))

        self._isDone = {}
        for index, param in enumerate(self._activeParams):
            self._currentIndex = index
            self._currentParam = param
            self._doSixthSense(messenger, currentTime, player, cellIndex, teamAmount)
        if self._isDone:
            log.debug('success commands, update last activity.')
            self._lastActivity = currentTime
    def onBattleStart(self):
        self._isEnabled = sm_settings.get('ActiveByDefault')
        self._lastActivity = 0

        arena = ArenaInfo()
        vehicle = VehicleInfo()

        log.info('on battle start')
        log.info('current battle type: {} [{}({}) = "{}"]'.format(arena.battleType, arena.attrLabel, arena.id, arena.name))
        log.info('current vehicle class: {} [{}] ({})'.format(vehicle.classAbbr, vehicle.className, vehicle.name))

        self._activeParams = []
        cooldownInterval = []
        for i, p in enumerate(sm_settings.getParamsBattleType(arena.battleType)):
            log.info('[{}]: CommandOrder: {}'.format(i, p.getInfo('CommandOrder')))
            log.info('[{}]: CooldownInterval: {}, CommandDelay: {}, TextDelay: {}'.format(i,
                    p.getInfo('CooldownInterval'),
                    p.getInfo('CommandDelay'),
                    p.getInfo('TextDelay')))
            log.info('[{}]: MinTeamAmount: {}, MaxTeamAmount: {}'.format(i,
                    p.getInfo('MinTeamAmount'),
                    p.getInfo('MaxTeamAmount')))
            log.info('[{}]: Enable Vehicle Type: {}'.format(i, p.getInfo('EnableVehicleType')))
            if vehicle.classAbbr in p.get('EnableVehicleType', VEHICLE_TYPE.LIST):
                log.info('[{}]: current vehicle type is {}, add to list.'.format(i, vehicle.classAbbr))
                self._activeParams.append(p)
                cooldownInterval.append(p.get('CooldownInterval'))
            else:
                log.info('[{}]: current vehicle type is {}, do nothing.'.format(i, vehicle.classAbbr))
                self._activeParams.append(None)

        self._cooldownInterval = min(t for t in cooldownInterval)
        log.info('minimal CoolDownInterval: {}'.format(self._cooldownInterval))
        self.showCurrentMode()