示例#1
0
    def enter(self):
        ShtikerPage.ShtikerPage.enter(self)
        # Get the current street name
        try:
            zone = base.cr.playGame.getPlace().getZoneId()
        except:
            zone = 0

        # if we are going to an HQ, change the button
        if base.localAvatar.lastHood >= ToontownGlobals.BossbotHQ:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToCogHQ
        else:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToPlayground

        if ((zone and ZoneUtil.isPlayground(zone)) or self.book.safeMode):
            self.safeZoneButton.hide()
        else:
            self.safeZoneButton.show()

        if ((base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate
             and base.cr.playGame.hood.loader.atMyEstate())
                or self.book.safeMode):
            self.goHomeButton.hide()
        elif base.housingEnabled:
            self.goHomeButton.show()

        if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate:
            if base.cr.playGame.hood.loader.atMyEstate():
                self.hoodLabel['text'] = (TTLocalizer.MapPageYouAreAtHome)
                self.hoodLabel.show()
            else:
                avatar = base.cr.identifyAvatar(
                    base.cr.playGame.hood.loader.estateOwnerId)
                if avatar:
                    avName = avatar.getName()
                    self.hoodLabel['text'] = (
                        TTLocalizer.MapPageYouAreAtSomeonesHome %
                        (TTLocalizer.GetPossesive(avName)))
                    self.hoodLabel.show()
        elif zone:
            hoodName = ToontownGlobals.hoodNameMap.get(
                ZoneUtil.getCanonicalHoodId(zone), ("", ))[-1]
            streetName = ToontownGlobals.StreetNames.get(
                ZoneUtil.getCanonicalBranchZone(zone), ("", ))[-1]
            # Make sure we have a hoodName to report
            # It is ok if we do not have a street name, it will just be empty
            if hoodName:
                self.hoodLabel['text'] = (TTLocalizer.MapPageYouAreHere %
                                          (hoodName, streetName))
                self.hoodLabel.show()
            else:
                self.hoodLabel.hide()
        else:
            self.hoodLabel.hide()

        safeZonesVisited = base.localAvatar.hoodsVisited
        hoodsAvailable = base.cr.hoodMgr.getAvailableZones()

        #print("### hoods visited = ", safeZonesVisited)
        #print("### hoods avail = ", hoodsAvailable)

        # The hoods that we can see is the intersection of the zones we have
        # visited and the hoods that are available
        hoodVisibleList = PythonUtil.intersection(safeZonesVisited,
                                                  hoodsAvailable)

        #print("### hoods viz = ", hoodVisibleList)

        # The hoods that we can teleport to is the intersection of the hoods
        # we can see and the hoods the local toon has teleport access to
        hoodTeleportList = base.localAvatar.getTeleportAccess()

        for hood in self.allZones:
            label = self.labels[self.allZones.index(hood)]
            clouds = self.clouds[self.allZones.index(hood)]
            # If we can see that hood, show the button, hide the clouds
            if ((not self.book.safeMode) and (hood in hoodVisibleList)):
                label.show()
                for cloud in clouds:
                    cloud.hide()
                fullname = base.cr.hoodMgr.getFullnameFromId(hood)
                if hood in hoodTeleportList:
                    text = (TTLocalizer.MapPageGoTo % fullname)
                    label['text'] = ("", text, text)
                else:
                    label['text'] = ("", fullname, fullname)

            # If we cannot see that hood, hide the button, show the clouds
            else:
                label.hide()
                for cloud in clouds:
                    cloud.show()

        return
示例#2
0
    def enter(self):
        ShtikerPage.ShtikerPage.enter(self)
        try:
            zone = base.cr.playGame.getPlace().getZoneId()
        except:
            zone = 0

        if base.localAvatar.lastHood >= ToontownGlobals.BossbotHQ:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToCogHQ
        else:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToPlayground
        if zone and ZoneUtil.isPlayground(zone) or self.book.safeMode:
            self.safeZoneButton.hide()
        else:
            self.safeZoneButton.show()
        if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate and base.cr.playGame.hood.loader.atMyEstate() or self.book.safeMode:
            self.goHomeButton.hide()
        elif base.housingEnabled:
            self.goHomeButton.show()
        if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate:
            if base.cr.playGame.hood.loader.atMyEstate():
                self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtHome
                self.hoodLabel.show()
            else:
                avatar = base.cr.identifyAvatar(base.cr.playGame.hood.loader.estateOwnerId)
                if avatar:
                    avName = avatar.getName()
                    self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtSomeonesHome % TTLocalizer.GetPossesive(avName, 'book')
                    self.hoodLabel.show()
        elif zone:
            hoodName = ToontownGlobals.hoodNameMap.get(ZoneUtil.getCanonicalHoodId(zone), ('',))[-1]
            streetName = ToontownGlobals.StreetNames.get(ZoneUtil.getCanonicalBranchZone(zone), ('',))[-1]
            if hoodName:
                self.hoodLabel['text'] = TTLocalizer.MapPageYouAreHere % (hoodName, streetName)
                self.hoodLabel.show()
            else:
                self.hoodLabel.hide()
        else:
            self.hoodLabel.hide()
        safeZonesVisited = base.localAvatar.hoodsVisited
        hoodsAvailable = base.cr.hoodMgr.getAvailableZones()
        hoodVisibleList = PythonUtil.intersection(safeZonesVisited, hoodsAvailable)
        hoodTeleportList = base.localAvatar.getTeleportAccess()
        for hood in self.allZones:
            label = self.labels[self.allZones.index(hood)]
            clouds = self.clouds[self.allZones.index(hood)]
            if not self.book.safeMode and hood in hoodVisibleList:
                label['text_fg'] = (0, 0, 0, 1)
                label.show()
                for cloud in clouds:
                    cloud.hide()

                fullname = base.cr.hoodMgr.getFullnameFromId(hood)
                if hood in hoodTeleportList:
                    text = TTLocalizer.MapPageGoTo % fullname
                    label['text'] = ('', text, text)
                else:
                    label['text'] = ('', fullname, fullname)
            else:
                label.hide()
                for cloud in clouds:
                    cloud.show()
    def enter(self):
        ShtikerPage.ShtikerPage.enter(self)
        try:
            zone = base.cr.playGame.getPlace().getZoneId()
        except:
            zone = 0

        if base.localAvatar.lastHood >= ToontownGlobals.BossbotHQ:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToCogHQ
        else:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToPlayground
        if zone and ZoneUtil.isPlayground(zone) or self.book.safeMode:
            self.safeZoneButton.hide()
        else:
            self.safeZoneButton.show()
        if base.cr.playGame.getPlaceId(
        ) == ToontownGlobals.MyEstate and base.cr.playGame.hood.loader.atMyEstate(
        ) or self.book.safeMode:
            self.goHomeButton.hide()
        elif base.housingEnabled:
            self.goHomeButton.show()
        if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate:
            if base.cr.playGame.hood.loader.atMyEstate():
                self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtHome
                self.hoodLabel.show()
            else:
                avatar = base.cr.identifyAvatar(
                    base.cr.playGame.hood.loader.estateOwnerId)
                if avatar:
                    avName = avatar.getName()
                    self.hoodLabel[
                        'text'] = TTLocalizer.MapPageYouAreAtSomeonesHome % TTLocalizer.GetPossesive(
                            avName)
                    self.hoodLabel.show()
        elif zone:
            hoodName = ToontownGlobals.hoodNameMap.get(
                ZoneUtil.getCanonicalHoodId(zone), ('', ))[-1]
            streetName = ToontownGlobals.StreetNames.get(
                ZoneUtil.getCanonicalBranchZone(zone), ('', ))[-1]
            if hoodName:
                self.hoodLabel['text'] = TTLocalizer.MapPageYouAreHere % (
                    hoodName, streetName)
                self.hoodLabel.show()
            else:
                self.hoodLabel.hide()
        else:
            self.hoodLabel.hide()
        safeZonesVisited = base.localAvatar.hoodsVisited
        hoodsAvailable = base.cr.hoodMgr.getAvailableZones()
        hoodVisibleList = PythonUtil.intersection(safeZonesVisited,
                                                  hoodsAvailable)
        hoodTeleportList = base.localAvatar.getTeleportAccess()
        for hood in self.allZones:
            label = self.labels[self.allZones.index(hood)]
            clouds = self.clouds[self.allZones.index(hood)]
            if not self.book.safeMode and hood in hoodVisibleList:
                label['text_fg'] = (0, 0, 0, 1)
                label.show()
                for cloud in clouds:
                    cloud.hide()

                fullname = base.cr.hoodMgr.getFullnameFromId(hood)
                if hood in hoodTeleportList:
                    text = TTLocalizer.MapPageGoTo % fullname
                    label['text'] = ('', text, text)
                else:
                    label['text'] = ('', fullname, fullname)
            else:
                label['text_fg'] = (0, 0, 0, 0.65)
                label.show()
                for cloud in clouds:
                    cloud.show()