当前位置: 首页>>代码示例>>Python>>正文


Python CatalogItemList.index方法代码示例

本文整理汇总了Python中toontown.catalog.CatalogItemList.CatalogItemList.index方法的典型用法代码示例。如果您正苦于以下问题:Python CatalogItemList.index方法的具体用法?Python CatalogItemList.index怎么用?Python CatalogItemList.index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在toontown.catalog.CatalogItemList.CatalogItemList的用法示例。


在下文中一共展示了CatalogItemList.index方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DistributedFurnitureManagerAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import index [as 别名]

#.........这里部分代码省略.........
            self.director.b_setGhostMode(0)
        if director:
            if director.zoneId != self.zoneId:
                self.air.writeServerEvent('suspicious', avId=directorId, issue='Tried to become director from another zone!')
                return
            director.b_setGhostMode(1)

        self.director = director
        self.sendUpdate('setDirector', [directorId])

        # Let's also save the furniture to the house (and thus to the DB) while
        # we're at it...
        self.saveToHouse()

    def avatarEnter(self):
        pass

    def avatarExit(self):
        pass


    # Furniture-manipulation:
    def moveItemToAttic(self, doId):
        item = self.getItemObject(doId)

        self.atticItems.append(item.catalogItem)
        self.d_setAtticItems(self.getAtticItems())

        item.destroy()
        self.items.remove(item)

        return ToontownGlobals.FM_MovedItem

    def moveItemFromAttic(self, index, x, y, z, h, p, r):
        item = self.getAtticFurniture(self.atticItems, index)

        self.atticItems.remove(item)
        self.d_setAtticItems(self.getAtticItems())

        item.posHpr = (x, y, z, h, p, r)

        # TODO: Add DistributedTrunkAI when accessories are enabled
        # TODO2: Is there any point in repeating this? Perhaps we should unify this (and the above)
        # into a single self.__getDOFromItem(item)?
        if item.getFlags() & FLCloset:
            if self.house.gender is 0:
                # If they have a male closet, we need to make it a female closet.
                if item.furnitureType - 500 < 10:
                    item.furnitureType += 10
            elif item.furnitureType - 500 > 10:
                # If they have a female closet, we need to make it a male closet.
                item.furnitureType -= 10
            do = DistributedClosetAI(self.air, self, item)
        elif item.getFlags() & FLBank:
            do = DistributedBankAI(self.air, self, item)
        elif item.getFlags() & FLPhone:
            do = DistributedPhoneAI(self.air, self, item)
        elif item.getFlags() & FLTrunk:
            if self.house.gender is 0:
                if item.furnitureType - 500 > 10:
                    item.furnitureType += 10
                elif item.furnitureType - 500 > 10:
                    item.furnitureType -=10
                do = DistributedTrunkAI(self.air, self, item)
        else:
            do = DistributedFurnitureItemAI(self.air, self, item)
开发者ID:Grant11,项目名称:mf0DJnN,代码行数:70,代码来源:DistributedFurnitureManagerAI.py

示例2: DistributedFurnitureManagerAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import index [as 别名]

#.........这里部分代码省略.........
            return
        if senderId != directorId and directorId != 0:
            self.air.writeServerEvent('suspicious', avId=senderId, issue='Tried to make someone else (%d) move their furniture!' % directorId)
            return
        director = self.air.doId2do.get(directorId)
        if directorId and not director:
            self.air.writeServerEvent('suspicious', avId=directorId, issue='Tried to move furniture without being on the shard!')
            return
        if self.director:
            self.director.b_setGhostMode(0)
        if director:
            if director.zoneId != self.zoneId:
                self.air.writeServerEvent('suspicious', avId=directorId, issue='Tried to become director from another zone!')
                return
            director.b_setGhostMode(1)
        self.director = director
        self.sendUpdate('setDirector', [directorId])
        self.saveToHouse()

    def avatarEnter(self):
        pass

    def avatarExit(self):
        pass

    def moveItemToAttic(self, doId):
        item = self.getItemObject(doId)
        self.atticItems.append(item.catalogItem)
        self.d_setAtticItems(self.getAtticItems())
        item.destroy()
        self.items.remove(item)
        return ToontownGlobals.FM_MovedItem

    def moveItemFromAttic(self, index, x, y, z, h, p, r):
        item = self.getAtticFurniture(self.atticItems, index)
        self.atticItems.remove(item)
        self.d_setAtticItems(self.getAtticItems())
        item.posHpr = (x,
         y,
         z,
         h,
         p,
         r)
        if item.getFlags() & FLTrunk:
            if self.house.gender is 0:
                if item.furnitureType - 4000 < 10:
                    item.furnitureType += 10
            elif item.furnitureType - 4000 > 10:
                item.furnitureType -= 10
            do = DistributedTrunkAI(self.air, self, item)
        elif item.getFlags() & FLCloset:
            if self.house.gender is 0:
                if item.furnitureType - 500 < 10:
                    item.furnitureType += 10
            elif item.furnitureType - 500 > 10:
                item.furnitureType -= 10
            do = DistributedClosetAI(self.air, self, item)
        elif item.getFlags() & FLBank:
            do = DistributedBankAI(self.air, self, item)
        elif item.getFlags() & FLPhone:
            do = DistributedPhoneAI(self.air, self, item)
        else:
            do = DistributedFurnitureItemAI(self.air, self, item)

        do.generateWithRequired(self.zoneId)
        self.items.append(do)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:70,代码来源:DistributedFurnitureManagerAI.py

示例3: DistributedFurnitureManagerAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import index [as 别名]

#.........这里部分代码省略.........
        if self.director:
            self.director.b_setGhostMode(0)
        if director:
            if director.zoneId != self.zoneId:
                self.air.writeServerEvent('suspicious', avId=directorId, issue='Tried to become director from another zone!')
                return
            director.b_setGhostMode(1)

        self.director = director
        self.sendUpdate('setDirector', [directorId])

        # Let's also save the furniture to the house (and thus to the DB) while
        # we're at it...
        self.saveToHouse()

    def avatarEnter(self):
        pass

    def avatarExit(self):
        pass

    # Furniture-manipulation:
    def moveItemToAttic(self, doId):
        item = self.getItemObject(doId)

        self.atticItems.append(item.catalogItem)
        self.d_setAtticItems(self.getAtticItems())

        item.destroy()
        self.items.remove(item)

        return ToontownGlobals.FM_MovedItem

    def moveItemFromAttic(self, index, x, y, z, h, p, r):
        item = self.getAtticFurniture(self.atticItems, index)

        self.atticItems.remove(item)
        self.d_setAtticItems(self.getAtticItems())

        item.posHpr = (x, y, z, h, p, r)

        if item.getFlags() & FLTrunk:
            if self.house.gender is 0:
                if item.furnitureType - 4000 < 10:
                    item.furnitureType += 10
            elif item.furnitureType - 4000 > 10:
                item.furnitureType -= 10
            do = DistributedTrunkAI(self.air, self, item)
        elif item.getFlags() & FLCloset:
            if self.house.gender is 0:
                if item.furnitureType - 500 < 10:
                    item.furnitureType += 10
            elif item.furnitureType - 500 > 10:
                item.furnitureType -= 10
            do = DistributedClosetAI(self.air, self, item)
        elif item.getFlags() & FLBank:
            pass # We don't want banks in the estates
        elif item.getFlags() & FLPhone:
            do = DistributedPhoneAI(self.air, self, item)
        else:
            do = DistributedFurnitureItemAI(self.air, self, item)

        do.generateWithRequired(self.zoneId)
        self.items.append(do)

        return (ToontownGlobals.FM_MovedItem, do.doId)
开发者ID:swingmaster66,项目名称:LimitNetworkTT-1.4.6,代码行数:70,代码来源:DistributedFurnitureManagerAI.py


注:本文中的toontown.catalog.CatalogItemList.CatalogItemList.index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。