def __init__(self, avatar, lessonId, entities, bootcampGui,
                 soundAssistant):
        lessonSettings = getBattleSettings(lessonId)
        super(BattleAssistant,
              self).__init__(HintSystem(avatar, lessonSettings.hints))
        self.__idHighlight = None
        self.__lessonId = lessonId
        self.__idClosePrebattleTimer = None
        self.__soundAssistant = soundAssistant
        self.__highlightedElements = set()
        for animationName, panelName in BattleAssistant.HIGHLIGHTED_GUI_DICT.iteritems(
        ):
            curPanels = lessonSettings.visiblePanels
            if lessonId > 0:
                prevPanels = getBattleSettings(lessonId - 1).visiblePanels
                if panelName not in prevPanels and panelName in curPanels:
                    self.__highlightedElements.add(animationName)
            if panelName in curPanels:
                self.__highlightedElements.add(animationName)

        markers = {}
        if hasattr(avatar, 'arenaExtraData'):
            if 'markers' in avatar.arenaExtraData:
                markers = avatar.arenaExtraData['markers']
        from BootcampMarkers import BootcampMarkersManager
        self._markerManager = BootcampMarkersManager()
        self._markerManager.init(entities, markers, bootcampGui)
        g_bootcampEvents.onUIStateChanged += self._onUIStateChanged
        return
class BattleAssistant(BaseAssistant):
    ASSISTANT_TIMEOUT_HIGHLIGHT = 10.0
    ASSISTANT_CLOSE_PREBATTLE = 3.0
    HIGHLIGHTED_GUI_DICT = {
        'Minimap': BATTLE_VIEW_ALIASES.MINIMAP,
        'MinimapAppear': BATTLE_VIEW_ALIASES.MINIMAP,
        'FragCorrelationBar': BATTLE_VIEW_ALIASES.FRAG_CORRELATION_BAR,
        'ConsumableSlot4': BATTLE_VIEW_ALIASES.CONSUMABLES_PANEL,
        'ConsumableSlot5': BATTLE_VIEW_ALIASES.CONSUMABLES_PANEL,
        'ConsumableSlot6': BATTLE_VIEW_ALIASES.CONSUMABLES_PANEL,
        'ConsumablesAppear': BATTLE_VIEW_ALIASES.CONSUMABLES_PANEL
    }

    def __init__(self, avatar, lessonId, entities, bootcampGui,
                 soundAssistant):
        lessonSettings = getBattleSettings(lessonId)
        super(BattleAssistant,
              self).__init__(HintSystem(avatar, lessonSettings.hints))
        self.__idHighlight = None
        self.__lessonId = lessonId
        self.__idClosePrebattleTimer = None
        self.__soundAssistant = soundAssistant
        self.__highlightedElements = set()
        for animationName, panelName in BattleAssistant.HIGHLIGHTED_GUI_DICT.iteritems(
        ):
            curPanels = lessonSettings.visiblePanels
            if lessonId > 0:
                prevPanels = getBattleSettings(lessonId - 1).visiblePanels
                if panelName not in prevPanels and panelName in curPanels:
                    self.__highlightedElements.add(animationName)
            if panelName in curPanels:
                self.__highlightedElements.add(animationName)

        markers = {}
        if hasattr(avatar, 'arenaExtraData'):
            if 'markers' in avatar.arenaExtraData:
                markers = avatar.arenaExtraData['markers']
        from BootcampMarkers import BootcampMarkersManager
        self._markerManager = BootcampMarkersManager()
        self._markerManager.init(entities, markers, bootcampGui)
        g_bootcampEvents.onUIStateChanged += self._onUIStateChanged
        return

    @property
    def combatSound(self):
        return self.__soundAssistant

    def getMarkers(self):
        return self._markerManager

    def _update(self):
        super(BattleAssistant, self)._update()
        try:
            self._markerManager.update()
            g_bootcampEvents.onUIStateChanged(UI_STATE.UPDATE)
        except Exception:
            LOG_CURRENT_EXCEPTION_BOOTCAMP()

    def _doStart(self):
        self._markerManager.start()

    def __doHighlight(self):
        for name in self.__highlightedElements:
            g_eventBus.handleEvent(
                events.LoadViewEvent(BootcampEvent.ADD_HIGHLIGHT, None, name),
                EVENT_BUS_SCOPE.BATTLE)
            g_bootcampEvents.onHighlightAdded(self.HIGHLIGHTED_GUI_DICT[name])

        self.__idHighlight = None
        self.__highlightedElements.clear()
        return

    def _onUIStateChanged(self, state):
        if state == UI_STATE.START:
            self.__idHighlight = BigWorld.callback(
                BattleAssistant.ASSISTANT_TIMEOUT_HIGHLIGHT,
                self.__doHighlight)
            prebattle = getBattleSettings(self.__lessonId).prebattle
            if prebattle.has_key('visible_hints'):
                g_eventBus.handleEvent(
                    events.LoadViewEvent(VIEW_ALIAS.BOOTCAMP_PREBATTLE_HITNS,
                                         None, prebattle),
                    EVENT_BUS_SCOPE.BATTLE)
                self.__idClosePrebattleTimer = BigWorld.callback(
                    prebattle['timeout'], self.__onClosePrebattle)
        elif state == UI_STATE.STOP:
            self.stop()
        return

    def _doStop(self):
        self._markerManager.stop()
        self._markerManager.clear()
        g_bootcampEvents.onUIStateChanged -= self._onUIStateChanged
        if self.__idHighlight is not None:
            BigWorld.cancelCallback(self.__idHighlight)
            self.__idHighlight = None
        if self.__idClosePrebattleTimer is not None:
            BigWorld.cancelCallback(self.__idClosePrebattleTimer)
            self.__idClosePrebattleTimer = None
        return

    def __onClosePrebattle(self):
        g_eventBus.handleEvent(
            events.BootcampEvent(BootcampEvent.CLOSE_PREBATTLE, None, {}),
            EVENT_BUS_SCOPE.BATTLE)
        self.__idClosePrebattleTimer = None
        return