def _TTSCVictoryPartiesMenu__messagesChanged(self): self.clearMenu() try: lt = base.localAvatar except: return None for section in VictoryPartiesMenu: if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print 'warning: tried to link Victory Parties phrase %s which does not seem to exist' % phrase break self.append(SCStaticTextTerminal(phrase)) menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print 'warning: tried to link Victory Parties phrase %s which does not seem to exist' % phrase break menu.append(SCStaticTextTerminal(phrase)) menuName = str(section[0]) self.append(SCMenuHolder(menuName, menu))
def __SillyPhaseOneMessagesChanged(self): self.clearMenu() try: lt = base.localAvatar except: return for section in SillyPhaseOneMenu: if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print( 'warning: tried to link Silly PhaseOne phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) else: menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print( 'warning: tried to link Silly PhaseOne phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) menuName = str(section[0]) self.append(SCMenuHolder(menuName, menu))
def __boardingMessagesChanged(self, zoneId): self.clearMenu() try: lt = base.localAvatar except: return for count in xrange(len(BoardingMenuGuide)): section = BoardingMenuGuide[count] if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print 'warning: tried to link boarding phrase %s which does not seem to exist' % phrase break self.append(SCStaticTextTerminal(phrase)) else: menu = SCMenu() phrases = ZoneIdsToMsgs[zoneId][count] for phrase in phrases: if phrase not in OTPLocalizer.SpeedChatStaticText: print 'warning: tried to link boarding phrase %s which does not seem to exist' % phrase break menu.append(SCStaticTextTerminal(phrase)) menuName = str(section[0]) self.append(SCMenuHolder(menuName, menu))
def __messagesChanged(self, inSellbotFieldOffice): self.clearMenu() try: lt = base.localAvatar except: return for section in SellbotFieldOfficeMenu: if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print 'warning: tried to link Winter phrase %s which does not seem to exist' % phrase break self.append(SCStaticTextTerminal(phrase)) elif inSellbotFieldOffice: menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print 'warning: tried to link Halloween phrase %s which does not seem to exist' % phrase break menu.append(SCStaticTextTerminal(phrase)) menuName = str(section[0]) self.append(SCMenuHolder(menuName, menu))
def __messagesChanged(self): # clear out everything from our menu self.clearMenu() # if local toon has not been created, don't panic try: lt = base.localAvatar except: return for section in LawbotNerfMenu: if section[0] == -1: #This is not a submenu but a terminal! for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print(('warning: tried to link Lawbot Nerf phrase %s which does not seem to exist' % phrase)) break self.append(SCStaticTextTerminal(phrase)) else: #this should be a submenu menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print(('warning: tried to link Lawbot Nerf phrase %s which does not seem to exist' % phrase)) break menu.append(SCStaticTextTerminal(phrase)) menuName = str(section[0]) self.append(SCMenuHolder(menuName, menu))
def __boardingMessagesChanged(self, zoneId): # Clear out everything from our menu self.clearMenu() # If local toon has not been created, don't panic try: lt = base.localAvatar except: return for count in xrange(len(BoardingMenuGuide)): section = BoardingMenuGuide[count] if section[0] == -1: # This is not a submenu but a terminal! for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print( 'warning: tried to link boarding phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) else: # This should be a submenu, get the list of phrases from the corresponding zoneId menu = SCMenu() phrases = ZoneIdsToMsgs[zoneId][count] for phrase in phrases: if phrase not in OTPLocalizer.SpeedChatStaticText: print( 'warning: tried to link boarding phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) # add the menu to self (SpeedChat won't display empty menus) menuName = str(section[0]) self.append(SCMenuHolder(menuName, menu))
def __carolMessagesChanged(self): # clear out everything from our menu self.clearMenu() # if local toon has not been created, don't panic try: lt = base.localAvatar except: return for section in CarolMenu: if section[0] == -1: #This is not a submenu but a terminal! for phrase in list(section[1].keys()): blatherTxt = section[1][phrase] if blatherTxt not in OTPLocalizer.SpeedChatStaticText: print(('warning: tried to link Carol phrase %s which does not seem to exist' % blatherTxt)) break self.append(TTSCIndexedTerminal(SpeedChatStaticText.get(phrase, None), blatherTxt)) else: #this should be a submenu menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print(('warning: tried to link Carol phrase %s which does not seem to exist' % phrase)) break menu.append(SCStaticTextTerminal(phrase)) menuName = str(section[0]) self.append( SCMenuHolder(menuName, menu) )
def _TTSCCarolMenu__carolMessagesChanged(self): self.clearMenu() try: lt = base.localAvatar except: return None for section in CarolMenu: if section[0] == -1: for phrase in section[1].keys(): blatherTxt = section[1][phrase] if blatherTxt not in OTPLocalizer.SpeedChatStaticText: print 'warning: tried to link Carol phrase %s which does not seem to exist' % blatherTxt break self.append( TTSCIndexedTerminal( SpeedChatStaticText.get(phrase, None), blatherTxt)) menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print 'warning: tried to link Carol phrase %s which does not seem to exist' % phrase break menu.append(SCStaticTextTerminal(phrase)) menuName = str(section[0]) self.append(SCMenuHolder(menuName, menu))
def __tasksChanged(self): self.clearMenu() try: lt = base.localAvatar except: return phrases = [] def addTerminal(terminal, self=self, phrases=phrases): displayText = terminal.getDisplayText() if displayText not in phrases: self.append(terminal) phrases.append(displayText) for task in lt.quests: taskId, fromNpcId, toNpcId, rewardId, toonProgress = task q = Quests.getQuest(taskId) if q is None: continue msgs = q.getSCStrings(toNpcId, toonProgress) if type(msgs) != type([]): msgs = [msgs] for i in xrange(len(msgs)): addTerminal( TTSCToontaskTerminal(msgs[i], taskId, toNpcId, toonProgress, i)) needToontask = 1 if hasattr(lt, 'questCarryLimit'): needToontask = len(lt.quests) != lt.questCarryLimit if needToontask: addTerminal(SCStaticTextTerminal(1299))
def __zoneChanged(self, zoneId=0): # save the meet menu if we have one if self.meetMenuHolder: del self[0] # clear out everything from our menu self.clearMenu() # if local toon has not been created, don't panic try: lt = base.localAvatar except: return # keep a list of the phrases we've added to the menu, to # detect duplicates phrases = [] def addTerminal(terminal, self=self, phrases=phrases): displayText = terminal.getDisplayText() if displayText not in phrases: self.append(terminal) phrases.append(displayText) # rebuild our menu # Everybody gets the global messages # Plus add the ones for the zone you are in if you have some for msg in (GLOBAL_MSGS + ZoneToMsgs.get(zoneId, [])): assert (msg in OTPLocalizer.SpeedChatStaticText) addTerminal(SCStaticTextTerminal(msg)) # put the meet menu back, if we had one if self.meetMenuHolder: self[0:0] = [self.meetMenuHolder]
def __phrasesChanged(self, zoneId=0): self.clearMenu() try: lt = base.localAvatar except: return for trickId in lt.petTrickPhrases: if trickId not in PetTricks.TrickId2scIds: TTSCPetTrickMenu.notify.warning('unknown trick ID: %s' % trickId) else: for msg in PetTricks.TrickId2scIds[trickId]: self.append(SCStaticTextTerminal(msg))
def __init__(self): SCMenu.__init__(self) self.meetMenuHolder = None zoneId = base.cr.playGame.getPlaceId() if zoneId and zoneId == 11000: meetMenu = SCMenu() for msgIndex in OTPLocalizer.SCFactoryMeetMenuIndexes: term = SCStaticTextTerminal(msgIndex) meetMenu.append(term) self.meetMenuHolder = SCMenuHolder.SCMenuHolder( OTPLocalizer.SCMenuFactoryMeet, meetMenu) self[0:0] = [self.meetMenuHolder] self.accept('factoryZoneChanged', self.__zoneChanged) self.__zoneChanged()
def __init__(self): SCMenu.__init__(self) self.meetMenuHolder = None # the meet menu really only makes sense for Sellbot HQ zoneId = base.cr.playGame.getPlaceId() if zoneId and (zoneId == 11000): meetMenu = SCMenu() for msgIndex in OTPLocalizer.SCFactoryMeetMenuIndexes: term = SCStaticTextTerminal(msgIndex) meetMenu.append(term) self.meetMenuHolder = SCMenuHolder.SCMenuHolder( OTPLocalizer.SCMenuFactoryMeet, meetMenu) self[0:0] = [self.meetMenuHolder] # listen for changes to the factory location self.accept("factoryZoneChanged", self.__zoneChanged) self.__zoneChanged()
def __tasksChanged(self): # clear out everything from our menu self.clearMenu() # if local toon has not been created, don't panic try: lt = base.localAvatar except: return # keep a list of the phrases we've added to the menu, to # detect duplicates phrases = [] def addTerminal(terminal, self=self, phrases=phrases): displayText = terminal.getDisplayText() if displayText not in phrases: self.append(terminal) phrases.append(displayText) # rebuild our menu for task in lt.quests: taskId, fromNpcId, toNpcId, rewardId, toonProgress = task q = Quests.getQuest(taskId) if q is None: continue msgs = q.getSCStrings(toNpcId, toonProgress) # getSCStrings might return a list of strings, or just a string if type(msgs) != type([]): msgs = [msgs] for i in xrange(len(msgs)): addTerminal( TTSCToontaskTerminal(msgs[i], taskId, toNpcId, toonProgress, i)) # if toon has open task slots, or no task slots, # append 'i need a toontask'. needToontask = 1 if hasattr(lt, 'questCarryLimit'): needToontask = (len(lt.quests) != lt.questCarryLimit) if needToontask: # add 'I need to get a ToonTask' # see Localizer.SpeedChatStaticText addTerminal(SCStaticTextTerminal(1299))
def __phrasesChanged(self, zoneId=0): # clear out everything from our menu self.clearMenu() # if local toon has not been created, don't panic try: lt = base.localAvatar except: return # rebuild our menu for trickId in lt.petTrickPhrases: if trickId not in PetTricks.TrickId2scIds: TTSCPetTrickMenu.notify.warning( 'unknown trick ID: %s' % trickId) else: # there may be multiple msgs per trick for msg in PetTricks.TrickId2scIds[trickId]: assert msg in OTPLocalizer.SpeedChatStaticText self.append(SCStaticTextTerminal(msg))
def __messagesChanged(self, carol): self.clearMenu() try: lt = base.localAvatar except: return winterMenu = [] if carol: winterMenu.append(WinterMenu[0]) winterMenu.append(WinterMenu[1]) for section in winterMenu: if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: print( 'warning: tried to link Winter phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) else: menu = SCMenu() for phrase in list(section[1].keys()): blatherTxt = section[1][phrase] if blatherTxt not in OTPLocalizer.SpeedChatStaticText: print( 'warning: tried to link Winter phrase %s which does not seem to exist' % phrase) break menu.append( TTSCIndexedTerminal( OTPLocalizer.SpeedChatStaticText.get(phrase, None), blatherTxt)) menuName = str(section[0]) self.append(SCMenuHolder(menuName, menu)) return
def __zoneChanged(self, zoneId=0): if self.meetMenuHolder: del self[0] self.clearMenu() try: lt = base.localAvatar except: return phrases = [] def addTerminal(terminal, self=self, phrases=phrases): displayText = terminal.getDisplayText() if displayText not in phrases: self.append(terminal) phrases.append(displayText) for msg in GLOBAL_MSGS + ZoneToMsgs.get(zoneId, []): addTerminal(SCStaticTextTerminal(msg)) if self.meetMenuHolder: self[0:0] = [self.meetMenuHolder]
def __init__(self, indices): SCMenu.__init__(self) for index in indices: term = SCStaticTextTerminal(index) self.append(term)