Exemple #1
0
 def requestBoard(self, *args):
     self.notify.debug('requestBoard')
     avId = self.air.getAvatarIdFromSender()
     if self.findAvatar(avId) != None:
         self.notify.warning(
             'Ignoring multiple requests from %s to board.' % avId)
         return
     av = self.air.doId2do.get(avId)
     if av:
         boardResponse = self.checkBoard(av)
         newArgs = (avId, ) + args + (boardResponse, )
         if not ToontownAccessAI.canAccess(
                 avId, self.zoneId, 'DistributedElevatorAI.requestBoard'):
             self.notify.warning(
                 'Toon %s does not have access to the eleavtor.' % avId)
             self.rejectingBoardersHandler(*newArgs)
             return
         if self.boardingParty and self.boardingParty.hasActiveGroup(
                 avId) and self.boardingParty.getGroupLeader(avId) != avId:
             self.notify.warning(
                 'Rejecting %s from boarding the elevator because he is already part of a Boarding Group.'
                 % avId)
             self.rejectingBoardersHandler(*newArgs)
             return
         if boardResponse == 0:
             self.acceptingBoardersHandler(*newArgs)
         else:
             self.rejectingBoardersHandler(*newArgs)
     else:
         self.notify.warning(
             'avid: %s does not exist, but tried to board an elevator' %
             avId)
     return
 def requestEnter(self):
     # A client is requesting sole use of the fishing spot.  If
     # it's available, he can have it.
     avId = self.air.getAvatarIdFromSender()
     self.notify.debug("requestEnter: avId: %s" % (avId))
     if self.avId == avId:
         # This seems to happen in the estates when we get a double request
         # coming out of fishing directly onto the dock
         self.notify.debug("requestEnter: avId %s is already fishing here" % (avId))
         return
     
     # Check that player has full access
     if not ToontownAccessAI.canAccess(avId, self.zoneId):
         self.sendUpdateToAvatarId(avId, "rejectEnter", [])
         return
     
     if self.avId == 0:
         self.avId = avId
         # Tell the pond we are here
         self.pond.addAvSpot(avId, self)
         self.acceptOnce(self.air.getAvatarExitEvent(self.avId),
                         self.unexpectedExit)
         self.__stopTimeout()
         self.d_setOccupied(self.avId)
         self.d_setMovie(FishGlobals.EnterMovie)
         self.__startTimeout(FishGlobals.CastTimeout)
         self.air.writeServerEvent("fished_enter",self.avId, "%s" % (self.zoneId))
     else:
         self.sendUpdateToAvatarId(avId, "rejectEnter", [])
    def requestBoard(self, *args):
        self.notify.debug("requestBoard")
        avId = self.air.getAvatarIdFromSender()
        if (self.findAvatar(avId) != None):
            self.notify.warning("Ignoring multiple requests from %s to board." % (avId))
            return        

        av = self.air.doId2do.get(avId)
        if av:
            newArgs = (avId,) + args
            
            if not ToontownAccessAI.canAccess(avId, self.zoneId):
                self.notify.warning("Tooon %s does not have access to the trolley." % (avId))
                self.rejectingBoardersHandler(*newArgs)
                return
                
            # Only toons with hp greater than 0 may board the trolley.
            if (av.hp > 0) and self.accepting:
                self.acceptingBoardersHandler(*newArgs)
            else:
                self.rejectingBoardersHandler(*newArgs)
        else:
            self.notify.warning(
                "avid: %s does not exist, but tried to board a trolley" % avId
                )
    def __getAccessLevel(self, avatarID):
        av = self.air.doId2do.get(avatarID)
        allowed = 0
        suitType = -1
        if av:
            if self.doorType == DoorTypes.EXT_COGHQ and self.isLockedDoor():
                parts = av.getCogParts()
                dept = ToontownGlobals.cogHQZoneId2deptIndex(
                    self.destinationZone)
                if CogDisguiseGlobals.isPaidSuitComplete(av, parts, dept):
                    if av.getCogMerits(
                    )[dept] >= CogDisguiseGlobals.getTotalMerits(av, dept):
                        suitType = CogDisguiseGlobals.suitTypes.FullSuit
                    else:
                        suitType = CogDisguiseGlobals.suitTypes.NoMerits
                    allowed = 1
                else:
                    suitType = CogDisguiseGlobals.suitTypes.NoSuit
                if ToontownGlobals.SELLBOT_NERF_HOLIDAY in self.air.holidayManager.currentHolidays:
                    allowed = 1

            else:
                allowed = 1

        if not ToontownAccessAI.canAccess(
                avatarID, self.zoneId,
                'DistributedSellbotHQDoorAI.__getAccessLevel'):
            allowed = 0

        return (allowed, suitType)
Exemple #5
0
    def requestEnter(self):
        avatarID = self.air.getAvatarIdFromSender()
        assert (self.notify.debug("requestEnter: avatarID:%s" % avatarID))
        # Ext cog hq doors require all cog disguise parts
        # does the toon have a complete cog disguise?
        dept = ToontownGlobals.cogHQZoneId2deptIndex(self.destinationZone)
        av = self.air.doId2do.get(avatarID)
        if av:
            if self.doorType == DoorTypes.EXT_COGHQ and self.isLockedDoor():
                parts = av.getCogParts()
                if CogDisguiseGlobals.isSuitComplete(parts, dept):
                    allowed = 1
                else:
                    allowed = 0
            # Interior doors allow all
            else:
                allowed = 1

        # Check that player has full access
        if not ToontownAccessAI.canAccess(avatarID, self.zoneId):
            allowed = 0

        # Now send a message back - either reject or accept
        if not allowed:
            self.sendReject(avatarID, self.isLockedDoor())
        else:
            self.enqueueAvatarIdEnter(avatarID)
            self.sendUpdateToAvatarId(
                avatarID, "setOtherZoneIdAndDoId",
                [self.destinationZone,
                 self.otherDoor.getDoId()])
Exemple #6
0
    def requestEnter(self):
        avatarID = self.air.getAvatarIdFromSender()
        allowed = 0
        dept = ToontownGlobals.cogHQZoneId2deptIndex(self.destinationZone)
        av = self.air.doId2do.get(avatarID)
        if av:
            if self.doorType == DoorTypes.EXT_COGHQ and self.isLockedDoor():
                parts = av.getCogParts()
                if CogDisguiseGlobals.isSuitComplete(parts, dept):
                    allowed = 1
                else:
                    allowed = 0
            else:
                allowed = 1

        if not ToontownAccessAI.canAccess(
                avatarID, self.zoneId, 'DistributedCogHQDoorAI.requestEnter'):
            allowed = 0

        if not allowed:
            self.sendReject(avatarID, self.isLockedDoor())
        else:
            self.enqueueAvatarIdEnter(avatarID)
            self.sendUpdateToAvatarId(
                avatarID, 'setOtherZoneIdAndDoId',
                [self.destinationZone,
                 self.otherDoor.getDoId()])
 def checkBoard(self, avId, elevatorId):
     elevator = simbase.air.doId2do.get(elevatorId)
     avatar = simbase.air.doId2do.get(avId)
     if avatar:
         if not ToontownAccessAI.canAccess(avId, self.zoneId, 'DistributedBoardingPartyAI.checkBoard'):
             return REJECT_NOTPAID
         elif elevator:
             return elevator.checkBoard(avatar)
     return REJECT_BOARDINGPARTY
Exemple #8
0
 def requestEnter(self):
     avatarID = self.air.getAvatarIdFromSender()
     lockedVal = self.isLockedDoor()
     if not ToontownAccessAI.canAccess(avatarID, self.zoneId,
                                       'DistributedDoorAI.requestEnter'):
         lockedVal = True
     if lockedVal:
         self.sendReject(avatarID, lockedVal)
     else:
         self.enqueueAvatarIdEnter(avatarID)
         self.sendUpdateToAvatarId(
             avatarID, 'setOtherZoneIdAndDoId',
             [self.otherDoor.getZoneId(),
              self.otherDoor.getDoId()])
Exemple #9
0
    def requestEnter(self):
        assert (self.debugPrint("requestEnter()"))
        avatarID = self.air.getAvatarIdFromSender()
        assert (self.notify.debug("  avatarID:%s" % (str(avatarID), )))
        lockedVal = self.isLockedDoor()

        # Check that player has full access
        if not ToontownAccessAI.canAccess(avatarID, self.zoneId):
            lockedVal = True

        if lockedVal:
            self.sendReject(avatarID, lockedVal)
        else:
            self.enqueueAvatarIdEnter(avatarID)
            self.sendUpdateToAvatarId(
                avatarID, "setOtherZoneIdAndDoId",
                [self.otherDoor.getZoneId(),
                 self.otherDoor.getDoId()])
Exemple #10
0
    def requestBoard(self, *args):
        self.notify.debug("requestBoard")
        avId = self.air.getAvatarIdFromSender()
        if (self.findAvatar(avId) != None):
            self.notify.warning(
                "Ignoring multiple requests from %s to board." % (avId))
            return

        av = self.air.doId2do.get(avId)
        if av:
            # Only toons with hp greater than the minLaff may board the elevator.
            boardResponse = self.checkBoard(av)
            newArgs = (avId, ) + args + (boardResponse, )

            # Check that player has full access
            if not ToontownAccessAI.canAccess(avId, self.zoneId):
                self.notify.warning(
                    "Toon %s does not have access to theeleavtor. " % (avId))
                self.rejectingBoardersHandler(*newArgs)
                return

            # Toons who have an active Boarding Group and
            # are not the leader will be rejected if they try to board the elevator.
            if self.boardingParty and self.boardingParty.hasActiveGroup(avId) and \
               (self.boardingParty.getGroupLeader(avId) != avId):
                self.notify.warning(
                    'Rejecting %s from boarding the elevator because he is already part of a Boarding Group.'
                    % avId)
                self.rejectingBoardersHandler(*newArgs)
                return

            if boardResponse == 0:
                self.acceptingBoardersHandler(*newArgs)
            else:
                self.rejectingBoardersHandler(*newArgs)
        else:
            self.notify.warning(
                "avid: %s does not exist, but tried to board an elevator" %
                avId)
        return
 def requestBoard(self, *args):
     self.notify.debug('requestBoard')
     avId = self.air.getAvatarIdFromSender()
     if self.findAvatar(avId) != None:
         self.notify.warning(
             'Ignoring multiple requests from %s to board.' % avId)
         return
     av = self.air.doId2do.get(avId)
     if av:
         newArgs = (avId, ) + args
         if not ToontownAccessAI.canAccess(
                 avId, self.zoneId, 'DistributedTrolleyAI.requestBoard'):
             self.notify.warning(
                 'Tooon %s does not have access to the trolley.' % avId)
             self.rejectingBoardersHandler(*newArgs)
             return
         if av.hp > 0 and self.accepting:
             self.acceptingBoardersHandler(*newArgs)
         else:
             self.rejectingBoardersHandler(*newArgs)
     else:
         self.notify.warning(
             'avid: %s does not exist, but tried to board a trolley' % avId)
     return