def setChat(self, category, msg, avId): if self.cr.doId2do.has_key(avId): avatar = self.cr.doId2do[avId] str = CCharChatter.getChatter(self.getName())[category][msg] if '%' in str: str = copy.deepcopy(str) avName = avatar.getName() str = string.replace(str, '%', avName) track = Sequence() if category != CCharChatter.GOODBYE: curHpr = self.getHpr() self.headsUp(avatar) destHpr = self.getHpr() self.setHpr(curHpr) track.append(self.makeTurnToHeadingTrack(destHpr[0])) if self.getName() == 'Donald': chatFlags = CFThought | CFTimeout else: chatFlags = CFSpeech | CFTimeout track.append(Func(self.setChatAbsolute, str, chatFlags)) self.chatTrack.stop() self.chatTrack = track self.chatTrack.play()
def enter(self): """ //////////////////////////////////////////////////////////////////// // Function: called when the character enters the lonely state // create a doLater to wait a random amount of time // before deciding what to do next (such as walk to a // new area). // Parameters: none // Changes: //////////////////////////////////////////////////////////////////// """ # so lonely... oh, so lonely... if hasattr(self.character, "name"): name = self.character.getName() else: name = "character" self.notify.debug("Chatty " + self.character.getName() + "...") # if the last person we talked to leaves the chat # sphere and re-enters, don't greet them again #self.lastChatTarget = 0 self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter()) # only spawn the chat task if this is a talking char if self.chatter != None: # remove any old taskMgr.remove(self.__chatTaskName) # spawn the new task taskMgr.add(self.blather, self.__chatTaskName) StateData.StateData.enter(self)
def setChat(self, category, msg, avId): if self.cr.doId2do.has_key(avId): avatar = self.cr.doId2do[avId] str = CCharChatter.getChatter(self.getName())[category][msg] if '%' in str: str = copy.deepcopy(str) avName = avatar.getName() str = string.replace(str, '%', avName) track = Sequence() if category != CCharChatter.GOODBYE: curHpr = self.getHpr() self.headsUp(avatar) destHpr = self.getHpr() self.setHpr(curHpr) track.append(self.makeTurnToHeadingTrack(destHpr[0])) if self.getName() == 'Donald': chatFlags = CFThought | CFTimeout else: chatFlags = CFSpeech | CFTimeout track.append(Func(self.setChatAbsolute, str, chatFlags)) self.chatTrack.stop() self.chatTrack = track self.chatTrack.play()
def enterChatty(self): chatter = CCharChatter.getChatter(self.getName(), self.getCCChatter()) if not chatter: self.chatterExists = False self.fsm.request('Lonely') else: self.chatterExists = True self.chatty.enter() self.acceptOnce(self.chattyDoneEvent, self.__decideNextState)
def enter(self): if hasattr(self.character, "name"): name = self.character.getName() else: name = "character" self.notify.debug("Chatty " + self.character.getName() + "...") self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter()) if self.chatter != None: taskMgr.remove(self._CharChattyStateAI__chatTaskName) taskMgr.add(self.blather, self._CharChattyStateAI__chatTaskName) StateData.StateData.enter(self)
def enter(self): if hasattr(self.character, 'name'): name = self.character.getName() else: name = 'character' self.notify.debug('Chatty ' + self.character.getName() + '...') self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter()) if self.chatter != None: taskMgr.remove(self._CharChattyStateAI__chatTaskName) taskMgr.add(self.blather, self._CharChattyStateAI__chatTaskName) StateData.StateData.enter(self)
def enter(self): if hasattr(self.character, 'name'): name = self.character.getName() else: name = 'character' self.notify.debug('Chatty ' + self.character.getName() + '...') self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter()) if self.chatter != None: taskMgr.remove(self.__chatTaskName) taskMgr.add(self.blather, self.__chatTaskName) StateData.StateData.enter(self) return
def enter(self): if hasattr(self.character, 'name'): name = self.character.getName() else: name = 'character' self.notify.debug('Chatty ' + self.character.getName() + '...') self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter()) if self.chatter != None: taskMgr.remove(self.__chatTaskName) taskMgr.add(self.blather, self.__chatTaskName) else: self.notify.debug('Chatter is none.. sending done message') self.leave(timeout=1) StateData.StateData.enter(self) return
def setChat(self, category, msg, avId): if self.cr.doId2do.has_key(avId): avatar = self.cr.doId2do[avId] chatter = CCharChatter.getChatter(self.getName(), self.getCCChatter()) if category >= len(chatter): self.notify.debug("Chatter's changed") return None elif len(chatter[category]) <= msg: self.notify.debug("Chatter's changed") return None str = chatter[category][msg] if '%' in str: str = copy.deepcopy(str) avName = avatar.getName() str = string.replace(str, '%', avName) track = Sequence() if category != CCharChatter.GOODBYE: curHpr = self.getHpr() self.headsUp(avatar) destHpr = self.getHpr() self.setHpr(curHpr) track.append(self.makeTurnToHeadingTrack(destHpr[0])) if self.getName() == Donald and self.getName( ) == WesternPluto or self.getName() == Pluto: chatFlags = CFThought | CFTimeout if hasattr(base.cr, 'newsManager') and base.cr.newsManager: holidayIds = base.cr.newsManager.getHolidayIdList() if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds: if self.getName() == Pluto: chatFlags = CFTimeout | CFSpeech elif self.getName() == DonaldDock: chatFlags = CFTimeout | CFSpeech self.nametag3d.hide() else: chatFlags = CFTimeout | CFSpeech self.chatterDialogue = self.getChatterDialogue(category, msg) track.append( Func(self.setChatAbsolute, str, chatFlags, self.chatterDialogue)) self.chatTrack.finish() self.chatTrack = track self.chatTrack.start()
def setChat(self, category, msg, avId): if self.cr.doId2do.has_key(avId): avatar = self.cr.doId2do[avId] chatter = CCharChatter.getChatter(self.getName(), self.getCCChatter()) if category >= len(chatter): self.notify.debug("Chatter's changed") return None elif len(chatter[category]) <= msg: self.notify.debug("Chatter's changed") return None str = chatter[category][msg] if '%' in str: str = copy.deepcopy(str) avName = avatar.getName() str = string.replace(str, '%', avName) track = Sequence() if category != CCharChatter.GOODBYE: curHpr = self.getHpr() self.headsUp(avatar) destHpr = self.getHpr() self.setHpr(curHpr) track.append(self.makeTurnToHeadingTrack(destHpr[0])) if self.getName() == Donald and self.getName() == WesternPluto or self.getName() == Pluto: chatFlags = CFThought | CFTimeout if hasattr(base.cr, 'newsManager') and base.cr.newsManager: holidayIds = base.cr.newsManager.getHolidayIdList() if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds: if self.getName() == Pluto: chatFlags = CFTimeout | CFSpeech elif self.getName() == DonaldDock: chatFlags = CFTimeout | CFSpeech self.nametag3d.hide() else: chatFlags = CFTimeout | CFSpeech self.chatterDialogue = self.getChatterDialogue(category, msg) track.append(Func(self.setChatAbsolute, str, chatFlags, self.chatterDialogue)) self.chatTrack.finish() self.chatTrack = track self.chatTrack.start()
def setCorrectChatter(self): self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter())
def getLatestChatter(self): self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter())
def setCorrectChatter(self): """Forces an update on self.chatter, possibly affected by holidays.""" self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter())
def setCorrectChatter(self): self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter())
def getLatestChatter(self): self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter())
def setChat(self, category, msg, avId): if self.cr.doId2do.has_key(avId): avatar = self.cr.doId2do[avId] chatter = CCharChatter.getChatter(self.getName(), self.getCCChatter()) if category >= len(chatter): self.notify.debug("Chatter's changed") return elif len(chatter[category]) <= msg: self.notify.debug("Chatter's changed") return str = chatter[category][msg] if '%' in str: # make our own copy of the message str = copy.deepcopy(str) # get the avatar's name avName = avatar.getName() # slap it in str = string.replace(str, '%', avName) track = Sequence() # Character doesn't bother to turn to you when saying goodbye if category != CCharChatter.GOODBYE: # turn to face the avatar # calculate the destination hpr curHpr = self.getHpr() self.headsUp(avatar) destHpr = self.getHpr() self.setHpr(curHpr) track.append(self.makeTurnToHeadingTrack(destHpr[0])) #Change the animation for vampire mickey #if self == base.cr.doFind("vampire_mickey"): # self.loop('chat') # chat flags are different for DL Donald if self.getName() == Donald or self.getName( ) == WesternPluto or self.getName() == Pluto: chatFlags = CFThought | CFTimeout # Make Pluto talk during April Toons' Week. if hasattr(base.cr, "newsManager") and base.cr.newsManager: holidayIds = base.cr.newsManager.getHolidayIdList() if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds: if self.getName() == Pluto: chatFlags = CFTimeout | CFSpeech elif self.getName() == DonaldDock: chatFlags = CFTimeout | CFSpeech self.nametag3d.hide() else: chatFlags = CFTimeout | CFSpeech # Figure out appropriate audio file here, which will get used # in setChatAbsolute below # getChatterDialogue defined in Char.py so that chatter can # be loaded simultaneously with default char dialogue self.chatterDialogue = self.getChatterDialogue(category, msg) # make a track to say the message track.append( Func(self.setChatAbsolute, str, chatFlags, self.chatterDialogue)) self.chatTrack.finish() self.chatTrack = track self.chatTrack.start()