def __getReady2UnlockItems(self, vehicleBattleXp):
        ready2UnlockModules = []
        ready2UnlockVehicles = []
        possible2UnlockItems = g_techTreeDP.getAllPossibleItems2Unlock(self.__vehicle, self._unlocks)
        getter = self._items.getItemByCD
        for itemTypeCD, unlockProps in possible2UnlockItems.iteritems():
            item = getter(itemTypeCD)
            if self.__vehicleXp - unlockProps.xpCost <= vehicleBattleXp:
                if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
                    avgBattles2Unlock = self.__getAvgBattles2Unlock(unlockProps)
                    if self.__vehicleXp > unlockProps.xpCost or 0 < avgBattles2Unlock <= MIN_BATTLES_TO_SHOW_PROGRESS:
                        ready2UnlockVehicles.append(self.__makeUnlockVehicleVO(item, unlockProps, avgBattles2Unlock))
                elif self.__vehicleXp > unlockProps.xpCost:
                    ready2UnlockModules.append(self.__makeUnlockModuleVO(item, unlockProps))

        return (ready2UnlockVehicles, ready2UnlockModules)
Beispiel #2
0
def _getNextToUnlockItemCD(intCD):
    vehicle = getVehicleByIntCD(intCD)
    if vehicle is None:
        return False
    stats = g_itemsCache.items.stats
    items = g_techTreeDP.getAllPossibleItems2Unlock(vehicle, stats.unlocks)
    getter = g_itemsCache.items.getItemByCD
    result = []
    for itemTypeCD, unlockProps in items.iteritems():
        item = getter(itemTypeCD)
        if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
            continue
        result.append(item)

    if result:
        result = sorted(result, cmp=_researchItemComparator)
        intCD = result[0].intCD
    else:
        intCD = None
    return intCD
Beispiel #3
0
    def __getReady2UnlockItems(self, vehicleBattleXp):
        ready2UnlockModules = []
        ready2UnlockVehicles = []
        possible2UnlockItems = g_techTreeDP.getAllPossibleItems2Unlock(
            self.__vehicle, self._unlocks)
        getter = self._items.getItemByCD
        for itemTypeCD, unlockProps in possible2UnlockItems.iteritems():
            item = getter(itemTypeCD)
            if self.__vehicleXp - unlockProps.xpCost <= vehicleBattleXp:
                if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
                    avgBattles2Unlock = self.__getAvgBattles2Unlock(
                        unlockProps)
                    if self.__vehicleXp > unlockProps.xpCost or 0 < avgBattles2Unlock <= MIN_BATTLES_TO_SHOW_PROGRESS:
                        ready2UnlockVehicles.append(
                            self.__makeUnlockVehicleVO(item, unlockProps,
                                                       avgBattles2Unlock))
                elif self.__vehicleXp > unlockProps.xpCost:
                    ready2UnlockModules.append(
                        self.__makeUnlockModuleVO(item, unlockProps))

        return (ready2UnlockVehicles, ready2UnlockModules)
Beispiel #4
0
def _getNextToUnlockItemCD(intCD):
    vehicle = getVehicleByIntCD(intCD)
    if vehicle is None:
        return False
    else:
        stats = g_itemsCache.items.stats
        items = g_techTreeDP.getAllPossibleItems2Unlock(vehicle, stats.unlocks)
        getter = g_itemsCache.items.getItemByCD
        result = []
        for itemTypeCD, unlockProps in items.iteritems():
            item = getter(itemTypeCD)
            if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
                continue
            result.append(item)

        if result:
            result = sorted(result, cmp=_researchItemComparator)
            intCD = result[0].intCD
        else:
            intCD = None
        return intCD