def damageToon(self, toon, deduction):
     toon.takeDamage(deduction)
     if toon.getHp() <= 0:
         self.sendUpdate('toonDied', [toon.doId])
         empty = InventoryBase.InventoryBase(toon)
         toon.b_setInventory(empty.makeNetString())
         self.removeToon(toon.doId)
    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
Beispiel #3
0
    def damageToon(self, toon, deduction):
        toon.takeDamage(deduction)
        assert self.notify.debug('%s. toon %s hit for %s to %s/%s' % (self.doId, toon.doId, deduction, toon.getHp(), toon.getMaxHp()))
        if toon.getHp() <= 0:
            assert self.notify.debug('%s. toon died: %s' % (self.doId, toon.doId))
            self.sendUpdate('toonDied', [toon.doId])

            # Clear out the Toon's inventory.
            empty = InventoryBase.InventoryBase(toon)
            toon.b_setInventory(empty.makeNetString())

            # We'll go ahead and remove the toon now, rather than
            # waiting for him to tell us when he's gone.  That will
            # ensure he's not involved in any more activity even if
            # he's got a slow client (or a rogue client) that doesn't
            # tell us he's gone right away.
            self.removeToon(toon.doId)
Beispiel #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])
Beispiel #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()