예제 #1
0
 def setNextPhase(self, phase, message):
     self.currentPhase = phase
     self.notify.debug('setting next phase of invasion to %s' %
                       self.currentPhase)
     text = PLocalizer.InvasionJollyRogerNextBrigade % (
         self.currentPhase, self.totalPhases - self.currentPhase)
     base.localAvatar.guiMgr.messageStack.addModalTextMessage(
         text,
         seconds=10,
         priority=0,
         color=PiratesGuiGlobals.TextFG14,
         icon=(HolidayGlobals.getHolidayIcon(self.holidayId), ''),
         modelName='general_frame_f')
     if self.brigadeText:
         self.brigadeText[
             'text'] = PLocalizer.InvasionJollyRogerBrigadeUpdate % (
                 self.currentPhase, self.totalPhases - self.currentPhase)
     if self.canPlaySfx:
         if self.currentPhase == 1:
             sfx = self.startMessages[message]
         else:
             if self.currentPhase == 2:
                 sfx = self.secondWaveMessages[message]
             else:
                 if self.currentPhase == 7:
                     sfx = self.lastWaveMessages[message]
                 else:
                     sfx = self.waveMessages[message]
         base.playSfx(sfx)
예제 #2
0
    def showHolidayMessage(self, holidayId, msgType):
        self.notify.debug('showHolidayMessage-holidayId:' + str(holidayId))
        taskMgr.remove('showHolidayMessage-holidayId:' + str(holidayId))
        if not hasattr(base, 'localAvatar'):
            return None

        paidStatus = Freebooter.getPaidStatus(localAvatar.getDoId(),
                                              checkHoliday=False)
        if base.localAvatar.getTutorialState(
        ) < PiratesGlobals.TUT_MET_JOLLY_ROGER or self.inNewsWorld() == None:
            taskMgr.doMethodLater(15,
                                  self.showHolidayMessage,
                                  'showHolidayMessage-holidayId:' +
                                  str(holidayId),
                                  extraArgs=[holidayId, msgType])
            return None

        if msgType == 1:
            (hours, minutes) = self.getTimeRemaining(holidayId)
            message = HolidayGlobals.getHolidayStartMsg(holidayId, paidStatus)
            if message and re.findall('%\\(hours\\)s', message) and re.findall(
                    '%\\(minutes\\)s', message):
                message = message % {'hours': hours, 'minutes': minutes}

            chatMessage = HolidayGlobals.getHolidayStartChatMsg(
                holidayId, paidStatus)
            if chatMessage and re.findall('%\\(hours\\)s',
                                          chatMessage) and re.findall(
                                              '%\\(minutes\\)s', chatMessage):
                chatMessage = chatMessage % {
                    'hours': hours,
                    'minutes': minutes
                }

        elif msgType == 0:
            message = HolidayGlobals.getHolidayEndMsg(holidayId, paidStatus)
            chatMessage = HolidayGlobals.getHolidayEndChatMsg(
                holidayId, paidStatus)

        if message:
            base.localAvatar.guiMgr.messageStack.addModalTextMessage(
                message,
                seconds=45,
                priority=0,
                color=PiratesGuiGlobals.TextFG14,
                icon=(HolidayGlobals.getHolidayIcon(holidayId), ''),
                modelName='general_frame_f')

        if chatMessage:
            base.talkAssistant.receiveGameMessage(chatMessage)
 def setNextPhase(self, phase, message):
     self.currentPhase = phase
     self.notify.debug('setting next phase of invasion to %s' % self.currentPhase)
     text = PLocalizer.InvasionJollyRogerNextBrigade % (self.currentPhase, self.totalPhases - self.currentPhase)
     base.localAvatar.guiMgr.messageStack.addModalTextMessage(text, seconds = 10, priority = 0, color = PiratesGuiGlobals.TextFG14, icon = (HolidayGlobals.getHolidayIcon(self.holidayId), ''), modelName = 'general_frame_f')
     if self.brigadeText:
         self.brigadeText['text'] = PLocalizer.InvasionJollyRogerBrigadeUpdate % (self.currentPhase, self.totalPhases - self.currentPhase)
     
     if self.canPlaySfx:
         if self.currentPhase == 1:
             sfx = self.startMessages[message]
         elif self.currentPhase == 2:
             sfx = self.secondWaveMessages[message]
         elif self.currentPhase == 7:
             sfx = self.lastWaveMessages[message]
         else:
             sfx = self.waveMessages[message]
         base.playSfx(sfx)