Exemplo n.º 1
0
    def computeCategoryCounts(self):
        counts = {}
        for category in self.doIds.values():
            counts[category] = counts.get(category, 0) + 1

        for stackType in self.stacks.keys():
            category = InventoryId.getCategory(stackType)
            if category:
                counts[category] = counts.get(category, 0) + 1

        self.categoryCounts = counts
    def computeCategoryCounts(self):
        counts = { }
        for category in self.doIds.values():
            counts[category] = counts.get(category, 0) + 1

        for stackType in self.stacks.keys():
            category = InventoryId.getCategory(stackType)
            if category:
                counts[category] = counts.get(category, 0) + 1
                continue

        self.categoryCounts = counts
Exemplo n.º 3
0
    def setStacks(self, stackTypesAndQuantities):
        old = self.stacks
        self.stacks = dict(stackTypesAndQuantities)
        stacksInCategory = {}
        for t, q in stackTypesAndQuantities:
            if old.get(t, 0) != q:
                messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, t), [q])
            categoryId = InventoryId.getCategory(t)
            categoryList = stacksInCategory.setdefault(categoryId, {})
            categoryList[t] = self.stacks[t]

        self.stacksInCategory = stacksInCategory
    def setStacks(self, stackTypesAndQuantities):
        old = self.stacks
        self.stacks = dict(stackTypesAndQuantities)
        stacksInCategory = { }
        for (t, q) in stackTypesAndQuantities:
            if old.get(t, 0) != q:
                messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, t), [
                    q])

            categoryId = InventoryId.getCategory(t)
            categoryList = stacksInCategory.setdefault(categoryId, { })
            categoryList[t] = self.stacks[t]

        self.stacksInCategory = stacksInCategory
Exemplo n.º 5
0
 def stack(self, stackType, quantity):
     self.stacks[stackType] = quantity
     categoryId = InventoryId.getCategory(stackType)
     category = self.stacksInCategory.setdefault(categoryId, { })
     if quantity:
         category[stackType] = quantity
     else:
         category.pop(stackType, None)
     messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, stackType), [
         quantity])
     messenger.send(InventoryGlobals.getAnyChangeMsg(self.doId))
     if stackType == InventoryType.Vitae_Level and stackType == InventoryType.Vitae_Cost or stackType == InventoryType.Vitae_Left:
         localAvatar.guiMgr.gameGui.updateVitae(self.getStackQuantity(InventoryType.Vitae_Level), self.getStackQuantity(InventoryType.Vitae_Cost), self.getStackQuantity(InventoryType.Vitae_Left))
     
     if self.ownerId == localAvatar.getDoId():
         localAvatar.gotSpecialReward(stackType)
 def stack(self, stackType, quantity):
     self.stacks[stackType] = quantity
     categoryId = InventoryId.getCategory(stackType)
     category = self.stacksInCategory.setdefault(categoryId, { })
     if quantity:
         category[stackType] = quantity
     else:
         category.pop(stackType, None)
     messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, stackType), [
         quantity])
     messenger.send(InventoryGlobals.getAnyChangeMsg(self.doId))
     if stackType == InventoryType.Vitae_Level and stackType == InventoryType.Vitae_Cost or stackType == InventoryType.Vitae_Left:
         localAvatar.guiMgr.gameGui.updateVitae(self.getStackQuantity(InventoryType.Vitae_Level), self.getStackQuantity(InventoryType.Vitae_Cost), self.getStackQuantity(InventoryType.Vitae_Left))
     
     if self.ownerId == localAvatar.getDoId():
         localAvatar.gotSpecialReward(stackType)
Exemplo n.º 7
0
 def makeButton(self, parent, pos, cellSizeX, cellSizeZ):
     if InventoryId.isStackable(self.uid):
         data = [
          self.uid, 1]
     else:
         data = [
          InventoryId.getCategory(self.uid), self.uid]
     simpleItemGui = SimpleItemGUI([self.uid, 1], parent=parent, pos=pos)
     self.itemName = simpleItemGui.nameTag['text']
     self.shortDesc = self.itemName
     self.longDesc = self.itemName
     simpleItemGui.destroy()
     geomParams = InventoryItemGui.getGeomParams(self.uid)
     button = DirectButton(parent=parent, relief=None, rolloverSound=None, text='', text_scale=0.05, textMayChange=1, geom=geomParams['geom'], geom_pos=(0,
                                                                                                                                                         0,
                                                                                                                                                         0), geom_scale=geomParams['geom_scale'], pos=pos, extraArgs=[self])
     return button
Exemplo n.º 8
0
 def makeButton(self, parent, pos, cellSizeX, cellSizeZ):
     if InventoryId.isStackable(self.uid):
         data = [
             self.uid,
             1]
     else:
         data = [
             InventoryId.getCategory(self.uid),
             self.uid]
     simpleItemGui = SimpleItemGUI([
         self.uid,
         1], parent = parent, pos = pos)
     self.itemName = simpleItemGui.nameTag['text']
     self.shortDesc = self.itemName
     self.longDesc = self.itemName
     simpleItemGui.destroy()
     geomParams = InventoryItemGui.getGeomParams(self.uid)
     button = DirectButton(parent = parent, relief = None, rolloverSound = None, text = '', text_scale = 0.050000000000000003, textMayChange = 1, geom = geomParams['geom'], geom_pos = (0, 0, 0), geom_scale = geomParams['geom_scale'], pos = pos, extraArgs = [
         self])
     return button