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)
 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)
 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 sunkAShipFanfare(self, shipToAttackDoId):
        if localAvatar.ship and localAvatar.ship == self:
            if localAvatar.ship.getSiegeTeam():
                return None

            attackMessage = HighSeasGlobals.getShipSunkMessage()
            if attackMessage:
                base.localAvatar.guiMgr.queueInstructionMessage(attackMessage[0], attackMessage[1], None, 1.0, messageCategory = MessageGlobals.MSG_CAT_SUNK_SHIP)
 def sunkAShipFanfare(self, shipToAttackDoId):
     if localAvatar.ship and localAvatar.ship == self:
         if localAvatar.ship.getSiegeTeam():
             return None
         
         attackMessage = HighSeasGlobals.getShipSunkMessage()
         if attackMessage:
             base.localAvatar.guiMgr.queueInstructionMessage(attackMessage[0], attackMessage[1], None, 1.0, messageCategory = MessageGlobals.MSG_CAT_SUNK_SHIP)
Esempio n. 7
0
 def announceAttack(self, shipToAttackDoId, hunterLevel):
     if localAvatar.ship and localAvatar.ship.getDoId() == shipToAttackDoId:
         simple = random.choice([
             0,
             1])
         attackMessage = None
         if hunterLevel == EnemyGlobals.SHIP_THREAT_BOUNTY_HUNTERS:
             attackMessage = HighSeasGlobals.getInboundHunterMessage()
         else:
             simple = random.choice([
                 0,
                 1])
             if simple:
                 attackMessage = HighSeasGlobals.getInboundMessage()
             else:
                 attackMessage = HighSeasGlobals.getInboundHelpMessage()
         if attackMessage:
             base.localAvatar.guiMgr.queueInstructionMessage(attackMessage[0], attackMessage[1], None, 1.0, messageCategory = MessageGlobals.MSG_CAT_ANNOUNCE_ATTACK)
 def announceAttack(self, shipToAttackDoId, hunterLevel):
     if localAvatar.ship and localAvatar.ship.getDoId() == shipToAttackDoId:
         simple = random.choice([
             0,
             1])
         attackMessage = None
         if hunterLevel == EnemyGlobals.SHIP_THREAT_BOUNTY_HUNTERS:
             attackMessage = HighSeasGlobals.getInboundHunterMessage()
         else:
             simple = random.choice([
                 0,
                 1])
             if simple:
                 attackMessage = HighSeasGlobals.getInboundMessage()
             else:
                 attackMessage = HighSeasGlobals.getInboundHelpMessage()
         if attackMessage:
             base.localAvatar.guiMgr.queueInstructionMessage(attackMessage[0], attackMessage[1], None, 1.0, messageCategory = MessageGlobals.MSG_CAT_ANNOUNCE_ATTACK)
Esempio n. 9
0
 def setThreatLevel(self, threatLevel, quiet=0):
     if localAvatar.ship and localAvatar.ship.getSiegeTeam():
         quiet = 0
         threatLevel = 0
     threatCard = loader.loadModel('models/gui/ship_threat_icons')
     threatImage = None
     threatIconName = EnemyGlobals.THREAT_ICON_DICT.get(threatLevel)
     if threatIconName:
         threatImage = threatCard.find('**/%s*' % threatIconName)
     self.threatFrame['image'] = threatImage
     self.threatFrame['image_scale'] = 0.135
     threatDescription = HighSeasGlobals.getThreatLevelDescription(threatLevel, 0)
     if threatDescription and not quiet:
         base.localAvatar.guiMgr.queueInstructionMessageFront(threatDescription[0], threatDescription[1], threatImage, 1.0, messageCategory=MessageGlobals.MSG_CAT_THREAT_LEVEL)
     return
    def setThreatLevel(self, threatLevel, quiet = 0):
        if localAvatar.ship and localAvatar.ship.getSiegeTeam():
            quiet = 0
            threatLevel = 0

        threatCard = loader.loadModel('models/gui/ship_threat_icons')
        threatImage = None
        threatIconName = EnemyGlobals.THREAT_ICON_DICT.get(threatLevel)
        if threatIconName:
            threatImage = threatCard.find('**/%s*' % threatIconName)

        self.threatFrame['image'] = threatImage
        self.threatFrame['image_scale'] = 0.13500000000000001
        threatDescription = HighSeasGlobals.getThreatLevelDescription(threatLevel, 0)
        if threatDescription and not quiet:
            base.localAvatar.guiMgr.queueInstructionMessageFront(threatDescription[0], threatDescription[1], threatImage, 1.0, messageCategory = MessageGlobals.MSG_CAT_THREAT_LEVEL)