def setOpenPort(self, portId, oldPortId, quiet = 0): openPortUID = EnemyGlobals.OPEN_PORT_DICT.get(portId, '') openPortName = PLocalizer.OpenPortNames.get(openPortUID) oldPortUID = EnemyGlobals.OPEN_PORT_DICT.get(oldPortId, '') oldPortName = PLocalizer.OpenPortNames.get(oldPortUID) if openPortName: self.openPortLabel.show() self.openPortLabel['text'] = PLocalizer.OpenPortMessage % openPortName if not quiet: if oldPortId: oldPortMessage = HighSeasGlobals.getPortClosedMessage(oldPortUID) openPortMessage = HighSeasGlobals.getPortOpenMessage(openPortUID) messageText = oldPortMessage[0] + openPortMessage[0] messageSoundList = [ oldPortMessage[1], openPortMessage[1]] base.localAvatar.guiMgr.queueInstructionMessage(messageText, messageSoundList, messageCategory = MessageGlobals.MSG_CAT_TELL_PORT) else: allPortMessage = HighSeasGlobals.getInitPortMessage() openPortMessage = HighSeasGlobals.getPortOpenMessage(openPortUID) messageText = allPortMessage[0] + openPortMessage[0] messageSoundList = [ allPortMessage[1], openPortMessage[1]] base.localAvatar.guiMgr.queueInstructionMessage(messageText, messageSoundList, messageCategory = MessageGlobals.MSG_CAT_TELL_PORT) self.disableAnchorButton() else: self.openPortLabel.hide() self.hideWrongPort()
def tellWrongPort(self): taskMgr.remove('hideWrongPortText') openPortName = '' if localAvatar.ship: portIndex = localAvatar.ship.getOpenPort() openPortUID = EnemyGlobals.OPEN_PORT_DICT.get(portIndex, '') openPortName = PLocalizer.OpenPortNames.get(openPortUID, '') if openPortName: localPortUID = '' if localAvatar.getPort(): localPortDO = base.cr.doId2do.get(localAvatar.getPort()) if localPortDO: localPortUID = localPortDO.uniqueId if localPortUID in EnemyGlobals.NON_WILD_ISLANDS: wrongIslandMessage = HighSeasGlobals.getWrongIslandMessage() messageText1 = wrongIslandMessage[0] messageSound1 = wrongIslandMessage[1] else: wildIslandMessage = HighSeasGlobals.getWildIslandMessage() messageText1 = wildIslandMessage[0] messageSound1 = wildIslandMessage[1] openPortMessage = HighSeasGlobals.getPortOpenMessage(openPortUID) messageText2 = openPortMessage[0] messageSound2 = openPortMessage[1] messageText = messageText1 + messageText2 base.localAvatar.guiMgr.lockInstructionMessage(self, messageText, [ messageSound1, messageSound2], messageCategory = MessageGlobals.MSG_CAT_NO_PORT) else: base.localAvatar.guiMgr.lockInstructionMessage(self, PLocalizer.WrongIslandNoPort, messageCategory = MessageGlobals.MSG_CAT_NO_PORT)