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 _doSendTeamMsg(self, messenger, cellIndex=None): if self._isDone.get('msg'): return msg = self._currentParam.get('ImSpotted').format(pos=MinimapInfo.getCellName(cellIndex)) if not msg: return log.info('[{}]: action: send message to team channel: "{}"'.format(self._currentIndex, msg)) ret = messenger.sendTeam(msg) self._isDone['msg'] = ret
def _doSendSquadMsg(self, messenger, cellIndex=None): if self._isDone.get('msg'): return msg = self._currentParam.get('ImSpotted').format(pos=MinimapInfo.getCellName(cellIndex)) if not msg: return if not 'squad' in messenger.getChannelLabels(): log.info('[{}]: action: no squad channel, skip.'.format(self._currentIndex)) return log.info('[{}]: action: send message to squad channel: "{}"'.format(self._currentIndex, msg)) ret = messenger.sendSquad(msg) self._isDone['msg'] = ret
def _doPing(self, messenger, cellIndex=None): if self._isDone.get('ping') or not cellIndex: return log.info('[{}]: action: do ping at {}'.format(self._currentIndex, MinimapInfo.getCellName(cellIndex))) messenger.doPing(cellIndex) self._isDone['ping'] = True