def _getNodeData(self,
                  nodeCD,
                  previewItem,
                  guiItem,
                  unlockStats,
                  unlockProps,
                  path,
                  level=-1,
                  topLevel=False):
     itemTypeID = guiItem.itemTypeID
     if itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         renderer = 'root' if self._rootCD == nodeCD else 'vehicle'
     else:
         renderer = 'item'
     state = NODE_STATE_FLAGS.LOCKED
     if itemTypeID != GUI_ITEM_TYPE.VEHICLE:
         if guiItem.isInstalled(previewItem):
             state |= NODE_STATE_FLAGS.SELECTED
     else:
         inventoryVehicle = self.getItem(nodeCD)
         if inventoryVehicle.isUnlocked:
             state = NODE_STATE_FLAGS.UNLOCKED
             if inventoryVehicle.isInInventory:
                 state |= NODE_STATE_FLAGS.IN_INVENTORY
     displayInfo = {'path': path, 'renderer': renderer, 'level': level}
     return nodes.RealNode(nodeCD,
                           guiItem,
                           0,
                           state,
                           displayInfo,
                           unlockProps=unlockProps)
Пример #2
0
 def _makeRealExposedNode(self, node, guiItem, unlockStats, displayInfo):
     nodeCD = node.nodeCD
     earnedXP = unlockStats.getVehXP(nodeCD)
     state = NODE_STATE_FLAGS.LOCKED
     available, unlockProps = g_techTreeDP.isNext2Unlock(
         nodeCD, level=guiItem.level, **unlockStats._asdict())
     if guiItem.isUnlocked:
         state = NODE_STATE_FLAGS.UNLOCKED
         if guiItem.isInInventory:
             state |= NODE_STATE_FLAGS.IN_INVENTORY
             if self._canSell(nodeCD):
                 state |= NODE_STATE_FLAGS.CAN_SELL
         else:
             if canBuyGoldForItemThroughWeb(
                     nodeCD) or self._mayObtainForMoney(nodeCD):
                 state |= NODE_STATE_FLAGS.ENOUGH_MONEY
             if self._isLastUnlocked(nodeCD):
                 state |= NODE_STATE_FLAGS.LAST_2_BUY
         if nodeCD in self._wereInBattle:
             state |= NODE_STATE_FLAGS.WAS_IN_BATTLE
         if guiItem.buyPrices.itemPrice.isActionPrice(
         ) and not guiItem.isRestorePossible():
             state |= NODE_STATE_FLAGS.ACTION
     else:
         if available:
             state = NODE_STATE_FLAGS.NEXT_2_UNLOCK
             if g_techTreeDP.getAllVehiclePossibleXP(
                     unlockProps.parentID,
                     unlockStats) >= unlockProps.xpCost:
                 state |= NODE_STATE_FLAGS.ENOUGH_XP
         if unlockProps.discount:
             state |= NODE_STATE_FLAGS.ACTION
     if guiItem.isElite:
         state |= NODE_STATE_FLAGS.ELITE
     if guiItem.isPremium:
         state |= NODE_STATE_FLAGS.PREMIUM
     if guiItem.isRented and not guiItem.isPremiumIGR:
         state = self._checkExpiredRent(state, guiItem)
         state = self._checkMoney(state, nodeCD)
     if guiItem.isRentable and not guiItem.isInInventory:
         state = self._checkMoney(state, nodeCD)
     if self._isVehicleCanBeChanged():
         state |= NODE_STATE_FLAGS.VEHICLE_CAN_BE_CHANGED
     bpfProps = self._getBlueprintsProps(node.nodeCD, guiItem.level)
     if bpfProps is not None and bpfProps.totalCount > 0:
         state |= NODE_STATE_FLAGS.BLUEPRINT
     state = self._checkRestoreState(state, guiItem)
     state = self._checkRentableState(state, guiItem)
     state = self._checkTradeInState(state, guiItem)
     state = self._checkTechTreeEvents(state, guiItem, unlockProps)
     price = getGUIPrice(guiItem, self._stats.money,
                         self._items.shop.exchangeRate)
     return nodes.RealNode(node.nodeCD,
                           guiItem,
                           earnedXP,
                           state,
                           displayInfo,
                           unlockProps=unlockProps,
                           bpfProps=bpfProps,
                           price=price)
Пример #3
0
 def _getNodeData(self, nodeCD, rootItem, guiItem, unlockStats, unlockProps, path, level=-1, topLevel=False):
     itemTypeID = guiItem.itemTypeID
     available = False
     xp = 0
     state = NODE_STATE_FLAGS.LOCKED
     if topLevel and itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         available, unlockProps = g_techTreeDP.isNext2Unlock(nodeCD, **unlockStats._asdict())
         xp = g_techTreeDP.getAllVehiclePossibleXP(unlockProps.parentID, unlockStats)
     if guiItem.isUnlocked:
         state = NODE_STATE_FLAGS.UNLOCKED
         if itemTypeID != GUI_ITEM_TYPE.VEHICLE and rootItem.isInInventory and guiItem.isInstalled(rootItem):
             state |= NODE_STATE_FLAGS.INSTALLED
         elif guiItem.isInInventory:
             if rootItem.isInInventory or itemTypeID == GUI_ITEM_TYPE.VEHICLE:
                 state |= NODE_STATE_FLAGS.IN_INVENTORY
             if self._canSell(nodeCD):
                 state |= NODE_STATE_FLAGS.CAN_SELL
         elif canBuyGoldForItemThroughWeb(nodeCD) or self._mayObtainForMoney(nodeCD):
             state |= NODE_STATE_FLAGS.ENOUGH_MONEY
         if nodeCD in self._wereInBattle:
             state |= NODE_STATE_FLAGS.WAS_IN_BATTLE
         if guiItem.buyPrices.itemPrice.isActionPrice():
             state |= NODE_STATE_FLAGS.SHOP_ACTION
     else:
         if not topLevel:
             available = unlockStats.isSeqUnlocked(unlockProps.required) and unlockStats.isUnlocked(self._rootCD)
             xp = g_techTreeDP.getAllVehiclePossibleXP(self._rootCD, unlockStats)
         if available:
             state = NODE_STATE_FLAGS.NEXT_2_UNLOCK
             if xp >= unlockProps.xpCost:
                 state |= NODE_STATE_FLAGS.ENOUGH_XP
     if itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         if guiItem.isElite:
             state |= NODE_STATE_FLAGS.ELITE
         if guiItem.isPremium:
             state |= NODE_STATE_FLAGS.PREMIUM
         if guiItem.isRented and not guiItem.isPremiumIGR and not guiItem.isTelecom:
             state = self._checkExpiredRent(state, guiItem)
             state = self._checkMoney(state, nodeCD)
         if guiItem.isRentable and not guiItem.isInInventory and not guiItem.isTelecom:
             state = self._checkMoney(state, nodeCD)
         if self._isVehicleCanBeChanged():
             state |= NODE_STATE_FLAGS.VEHICLE_CAN_BE_CHANGED
         if guiItem.isHidden:
             state |= NODE_STATE_FLAGS.PURCHASE_DISABLED
         state = self._checkRestoreState(state, guiItem)
         state = self._checkRentableState(state, guiItem)
         state = self._checkTradeInState(state, guiItem)
         renderer = 'root' if self._rootCD == nodeCD else 'vehicle'
     else:
         renderer = 'item'
     price = getGUIPrice(guiItem, self._stats.money, self._items.shop.exchangeRate)
     displayInfo = {'path': path,
      'renderer': renderer,
      'level': level}
     return nodes.RealNode(nodeCD, guiItem, unlockStats.getVehXP(nodeCD), state, displayInfo, unlockProps=unlockProps, price=price)
Пример #4
0
 def _makeRealExposedNode(self, node, guiItem, unlockStats, displayInfo):
     """
     Gets node data that stores to node list.
     """
     nodeCD = node.nodeCD
     earnedXP = unlockStats.getVehXP(nodeCD)
     state = NODE_STATE_FLAGS.LOCKED
     available, unlockProps = g_techTreeDP.isNext2Unlock(
         nodeCD, **unlockStats._asdict())
     if guiItem.isUnlocked:
         state = NODE_STATE_FLAGS.UNLOCKED
         if guiItem.isInInventory:
             state |= NODE_STATE_FLAGS.IN_INVENTORY
             if self._canSell(nodeCD):
                 state |= NODE_STATE_FLAGS.CAN_SELL
         elif self._mayObtainForMoney(nodeCD):
             state |= NODE_STATE_FLAGS.ENOUGH_MONEY
         if nodeCD in self._wereInBattle:
             state |= NODE_STATE_FLAGS.WAS_IN_BATTLE
         if guiItem.buyPrices.itemPrice.isActionPrice():
             state |= NODE_STATE_FLAGS.SHOP_ACTION
     elif available:
         state = NODE_STATE_FLAGS.NEXT_2_UNLOCK
         if g_techTreeDP.getAllVehiclePossibleXP(
                 unlockProps.parentID, unlockStats) >= unlockProps.xpCost:
             state |= NODE_STATE_FLAGS.ENOUGH_XP
     if guiItem.isElite:
         state |= NODE_STATE_FLAGS.ELITE
     if guiItem.isPremium:
         state |= NODE_STATE_FLAGS.PREMIUM
     if guiItem.isRented and not guiItem.isPremiumIGR:
         state = self._checkExpiredRent(state, guiItem)
         state = self._checkMoney(state, nodeCD)
     if guiItem.isRentable and not guiItem.isInInventory:
         state = self._checkMoney(state, nodeCD)
     if self._isVehicleCanBeChanged():
         state |= NODE_STATE_FLAGS.VEHICLE_CAN_BE_CHANGED
     state = self._checkRestoreState(state, guiItem)
     state = self._checkRentableState(state, guiItem)
     state = self._checkTradeInState(state, guiItem)
     price = getGUIPrice(guiItem, self._stats.money,
                         self._items.shop.exchangeRate)
     return nodes.RealNode(node.nodeCD,
                           guiItem,
                           earnedXP,
                           state,
                           displayInfo,
                           unlockProps=unlockProps,
                           price=price)