Ejemplo n.º 1
0
    def __handleUnexpectedExit(self, avId):
        self.notify.warning('avatar:' + str(avId) + ' has exited unexpectedly')

        # Only do customer work with the busy id
        if (self.customerId == avId):
            taskMgr.remove(self.uniqueName('clearMovie'))
            toon = self.air.doId2do.get(avId)
            if (toon == None):
                toon = DistributedToonAI.DistributedToonAI(self.air)
                toon.doId = avId

            if self.customerDNA:
                toon.b_setDNAString(self.customerDNA.makeNetString())
                # Force a database write since the toon is gone and might
                # have missed the distributed update.
                db = DatabaseObject.DatabaseObject(self.air, avId)
                db.storeObject(toon, ["setDNAString"])
        else:
            self.notify.warning('invalid customer avId: %s, customerId: %s ' %
                                (avId, self.customerId))

        # Only do busy work with the busy id
        # Warning: send the clear movie at the end of this transaction because
        # it clears out all the useful values needed here
        if (self.busy == avId):
            self.sendClearMovie(None)
        else:
            self.notify.warning('not busy with avId: %s, busy: %s ' %
                                (avId, self.busy))
Ejemplo n.º 2
0
    def __gotOwnerAv(self, db, retCode):
        print("gotOwnerAv information")
        if retCode == 0 and db.values.has_key('setDNAString'):
            aidc = self.air.dclassesByName['DistributedToonAI']
            self.ownerAv = DistributedToonAI.DistributedToonAI(self.air)
            self.ownerAv.doId = db.doId
            print("owner doId = %d" % db.doId)
            self.ownerAv.inventory = InventoryBase.InventoryBase(self.ownerAv)
            self.ownerAv.teleportZoneArray = []

            try:
                db.fillin(self.ownerAv, aidc)
            except Exception, theException:
                assert (self.notify.debug(
                    'suspicious: customer %s, owner %s: Exception = %s: DistributedClosetAI.__gotOwnerAv: invalid db'
                    % (self.customerId, db.doId, str(theException))))
                assert (self.notify.debug(
                    "FIXME: %s: DistributedClosetAI.__gotOwnerAv: This toon's DB is so broken: look at setClothesBottomsList."
                    % (db.doId)))
                self.air.writeServerEvent(
                    'suspicious', self.customerId,
                    'DistributedClosetAI.__gotOwnerAv: invalid db. ownerId %s'
                    % (db.doId))
                self.air.writeServerEvent(
                    'FIXME', db.doId,
                    "DistributedClosetAI.__gotOwnerAv: This toon's DB is so broken: look at setClothesBottomsList."
                )
                return

            self.__openCloset()
            self.dummyToonAI = self.ownerAv
Ejemplo n.º 3
0
 def readToon(self, fields=None):
     # Reads and returns a DistributedToonAI object.  Note that an
     # empty DistributedToonAI will be returned by this call; the
     # values will be filled in on the toon at some later point in
     # time, after the database has responded to the query.
     toon = DistributedToonAI.DistributedToonAI(self.air)
     self.readObject(toon, fields)
     return toon
Ejemplo n.º 4
0
    def __gotData(self, db, retcode):
        if retcode == 0 and 'setDNAString' in db.values:
            self.av = DistributedToonAI.DistributedToonAI(self.air)
            self.av.doId = db.doId
            self.av.inventory = InventoryBase.InventoryBase(self.av)
            self.av.teleportZoneArray = []
            db.fillin(self.av, self.dclass)

            # to prevent mem leaks, you should call toon.patchDelete at
            # some point.

            print('Got avatar %s, "%s".' % (self.av.doId, self.av.name))
            if self.event is not None:
                messenger.send(self.event, [self.av])
        else:
            print("Could not get avatar %s, retcode = %s." %
                  (db.doId, retcode))
            if self.event is not None:
                messenger.send(self.event, [None])
Ejemplo n.º 5
0
    def __gotData(self, db, retcode):
        self.requested.remove(db.doId)
        if retcode == 0 and 'setMoney' in db.values:
            av = DistributedToonAI.DistributedToonAI(self.air)
            av.doId = db.doId
            av.inventory = InventoryBase.InventoryBase(av)
            av.teleportZoneArray = []
            db.fillin(av, self.dclass)
            self.processAvatar(av, db)
            self.nonAvatar = 0
        else:
            if self.objIdList != None:
                print("Not an avatar: %s" % (db.doId))
            self.nonAvatar += 1

        if self.objIdList != None or self.nonAvatar < self.endOfListCount:
            self.getNextAvatar()
        elif len(self.requested) == 0:
            self.stop()
            self.done()
 def readToon(self, fields=None):
     toon = DistributedToonAI.DistributedToonAI(self.air)
     self.readObject(toon, fields)
     return toon