def hasValidReasonToEnter(self, avId): av = self.air.doId2do.get(avId) if av: chatArray = None needsToVisit = av.questManager.hasAnObjectiveToVisit( self.npcId, self.zoneId) lastVisited = av.questManager.wasLastObjectiveToVisit(self.npcId) if not lastVisited and not needsToVisit: # This avatar entered for no reason. They either have no quests or no objective to visit me. chatArray = NPCGlobals.NPCEnter_Pointless_Dialogue elif lastVisited or (needsToVisit and (isinstance(needsToVisit, VisitNPCObjective) and not needsToVisit.isPreparedToVisit())): # This avatar entered, but still has to complete the objective I gave him/her. chatArray = NPCGlobals.NPCEnter_MFCO_Dialogue welcomeToShopDialogueIndex = 28 if chatArray: chat = random.choice(chatArray) if '{avatarName}' in chat: chat = ChatGlobals.mentionAvatar(chat, av.getName()) elif '{shopName}' in chat and ( chatArray == NPCGlobals.NPCEnter_Pointless_Dialogue and NPCGlobals.NPCEnter_Pointless_Dialogue.index(chat) == welcomeToShopDialogueIndex): chat = chat.format( shopName=ZoneUtil.zone2TitleDict[self.zoneId][0]) self.d_setChat(chat) return chatArray is None
def talk2Toon(self, chatType, chatIndex, avId): toon = self.cr.doId2do.get(avId) if not toon: return if chatType in [SHARED_GREETINGS, SHARED_COMMENTS, SHARED_GOODBYES]: self.currentChat = CHATTER[chatType][chatIndex] elif chatType in [CHAR_GREETINGS, CHAR_COMMENTS, CHAR_GOODBYES]: self.currentChat = CHATTER[chatType][self.charId][chatIndex] if '{avatarName}' in self.currentChat: self.currentChat = ChatGlobals.mentionAvatar( self.currentChat, toon.getName()) self.neutralFSM.request('turn2target', [toon])
def enterTeleportIn(self, requestStatus): self.nextState = requestStatus.get('nextState', 'walk') if requestStatus['avId'] != base.localAvatar.doId: av = base.cr.doId2do.get(requestStatus['avId']) if av: base.localAvatar.gotoNode(av) base.localAvatar.b_setChat( ChatGlobals.getGreeting(av.getName())) base.localAvatar.startPosHprBroadcast() base.localAvatar.b_setAnimState('teleportIn', callback=self.teleportInDone) base.localAvatar.d_broadcastPositionNow() base.localAvatar.b_setParent(CIGlobals.SPRender) base.transitions.irisIn()
def __newFriendRequest(self, requester, name, dna): head = ToonGlobals.generateGuiHead(dna) size = (0.55 * 1.5, 0.55 * 1.5, 0.35 * 1.5) request = GlobalDialog( message=ChatGlobals.mentionAvatar(self.MessageFriendRequest, name), style=1, text_wordwrap=12, doneEvent='friendRequestDone-%d' % requester, extraArgs=[requester], text_scale=0.065, pos=(-0.85, 0, -0.275), geom=head, geom_scale=(0.125 * 1.25, 0.125 * 1.25, 0.1625 * 1.25), scale=size, image_scale=size, text_pos=(0.15, 0.075, 0), relief=None) request.reparentTo(base.a2dTopRight) text = request.component('text0') text.setScale(0.065, 0.1) for cmpt in request.components(): if 'Button' in cmpt: btn = request.component(cmpt) btn.setScale(btn, btn.getSx(), btn.getSy() + 0.1, btn.getSz() + 0.2) self.friendRequests[requester] = request self.acceptOnce('friendRequestDone-%d' % requester, self.handleFriendRequestChoice) self.requestIval = Sequence( Func(self.popUpSfx.play), LerpScaleInterval(request, 0.35, size, startScale=0.01, blendType='easeOut')) self.requestIval.start()
ConfigVariableDouble('extractor-step-time').setValue(0.01) DirectGuiGlobals.setDefaultFontFunc(CIGlobals.getToonFont) DirectGuiGlobals.setDefaultFont(CIGlobals.getToonFont()) DirectGuiGlobals.setDefaultRolloverSound( loader.loadSfx("phase_3/audio/sfx/GUI_rollover.ogg")) DirectGuiGlobals.setDefaultClickSound( loader.loadSfx("phase_3/audio/sfx/GUI_create_toon_fwd.ogg")) DirectGuiGlobals.setDefaultDialogGeom( loader.loadModel("phase_3/models/gui/dialog_box_gui.bam")) from src.coginvasion.nametag import NametagGlobals from src.coginvasion.margins.MarginManager import MarginManager from src.coginvasion.globals import ChatGlobals ChatGlobals.loadWhiteListData() NametagGlobals.setMe(base.cam) NametagGlobals.setCardModel('phase_3/models/props/panel.bam') NametagGlobals.setArrowModel('phase_3/models/props/arrow.bam') NametagGlobals.setChatBalloon3dModel('phase_3/models/props/chatbox.bam') NametagGlobals.setChatBalloon2dModel( 'phase_3/models/props/chatbox_noarrow.bam') NametagGlobals.setThoughtBalloonModel( 'phase_3/models/props/chatbox_thought_cutout.bam') chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui.bam') NametagGlobals.setPageButton(chatButtonGui.find('**/Horiz_Arrow_UP'), chatButtonGui.find('**/Horiz_Arrow_DN'), chatButtonGui.find('**/Horiz_Arrow_Rllvr'), chatButtonGui.find('**/Horiz_Arrow_UP')) NametagGlobals.setQuitButton(chatButtonGui.find('**/CloseBtn_UP'), chatButtonGui.find('**/CloseBtn_DN'),
def setChat(self, chat): chat = ChatGlobals.filterChat(chat, self.animal) DistributedToon.setChat(self, chat)
def setChat(self, chat): chat = ChatGlobals.filterChat(chat, self.animal) Toon.Toon.setChat(self, chat)