Example #1
0
 def invalidateUnlocks(self, unlocks):
     """
     Update status of nodes that became available to unlock or unlock after
     unlocks items (modules, vehicles).
     :param unlocks: set(<int:item compact descriptor>, ...)
     :return:  tuple( <list of next to unlock>, <list of unlocked vehicles> ),
        where:
            list of next to unlock - [(
                <int:vehicle compact descriptor>,
                <new state>, <instance of UnlockProps>
            ), ... ]
            list of unlocked vehicles - [(
                <int:vehicle compact descriptor>, <new state>,
            ), ... ]
     """
     next2Unlock = []
     unlocked = []
     unlockStats = self.getUnlockStats()
     items = g_techTreeDP.getNext2UnlockByItems(unlocks,
                                                **unlockStats._asdict())
     if len(items):
         next2Unlock = map(
             lambda item:
             (item[0], self._changeNext2Unlock(item[0], item[1], unlockStats
                                               ), item[1]._makeTuple()),
             items.iteritems())
     filtered = filter(
         lambda unlock: getTypeOfCD(unlock) == GUI_ITEM_TYPE.VEHICLE,
         unlocks)
     if len(filtered):
         unlocked = map(
             lambda item: (item, self._change2UnlockedByCD(item)), filtered)
     return (next2Unlock, unlocked)
Example #2
0
 def invalidateUnlocks(self, unlocks):
     """
     Update status of nodes that became available to unlock or unlock after
     unlocks items (modules, vehicles).
     :param unlocks: set(<int:item compact descriptor>, ...)
     :return:  tuple( <list of next to unlock>, <list of unlocked vehicles> ),
        where:
            list of next to unlock - [(
                <int:vehicle compact descriptor>,
                <new state>, <instance of UnlockProps>
            ), ... ]
            list of unlocked vehicles - [(
                <int:vehicle compact descriptor>, <new state>,
            ), ... ]
     """
     next2Unlock = []
     unlocked = []
     unlockStats = self.getUnlockStats()
     items = g_techTreeDP.getNext2UnlockByItems(unlocks, **unlockStats._asdict())
     if len(items):
         next2Unlock = map(lambda item: (item[0], self._changeNext2Unlock(item[0], item[1], unlockStats), item[1]._makeTuple()), items.iteritems())
     filtered = filter(lambda unlock: getTypeOfCD(unlock) == GUI_ITEM_TYPE.VEHICLE, unlocks)
     if len(filtered):
         unlocked = map(lambda item: (item, self._change2UnlockedByCD(item)), filtered)
     return (next2Unlock, unlocked)
Example #3
0
 def invalidateUnlocks(self, unlocks):
     next2Unlock = []
     unlocked = []
     unlockStats = self.getUnlockStats()
     items = g_techTreeDP.getNext2UnlockByItems(unlocks, **unlockStats._asdict())
     if len(items):
         next2Unlock = map(lambda item: (item[0], self._changeNext2Unlock(item[0], item[1], unlockStats), item[1]._makeTuple()), items.iteritems())
     filtered = filter(lambda unlock: getTypeOfCompactDescr(unlock) == GUI_ITEM_TYPE.VEHICLE, unlocks)
     if len(filtered):
         unlocked = map(lambda item: (item, self._change2UnlockedByCD(item)), filtered)
     return (next2Unlock, unlocked)
Example #4
0
 def invalidateUnlocks(self, unlocks):
     next2Unlock = []
     unlocked = []
     unlockStats = self.getUnlockStats()
     items = g_techTreeDP.getNext2UnlockByItems(unlocks, **unlockStats._asdict())
     if len(items):
         next2Unlock = map(lambda item: (item[0], self._changeNext2Unlock(item[0], item[1], unlockStats), item[1]._makeTuple()), items.iteritems())
     filtered = filter(lambda unlock: getTypeOfCompactDescr(unlock) == GUI_ITEM_TYPE.VEHICLE, unlocks)
     if len(filtered):
         unlocked = map(lambda item: (item, self._change2UnlockedByCD(item)), filtered)
     return (next2Unlock, unlocked)
 def invalidateUnlocks(self, unlocks):
     next2Unlock = []
     unlocked = []
     unlockStats = self.getUnlockStats()
     items = g_techTreeDP.getNext2UnlockByItems(unlocks, **unlockStats._asdict())
     if items:
         next2Unlock = map(lambda item: (item[0], self._changeNext2Unlock(item[0], item[1], unlockStats), item[1].makeTuple()), items.iteritems())
     filtered = [ unlock for unlock in unlocks if getTypeOfCD(unlock) == GUI_ITEM_TYPE.VEHICLE ]
     if filtered:
         unlocked = [ (item, self._change2UnlockedByCD(item)) for item in filtered ]
     return (next2Unlock, unlocked)
Example #6
0
 def invalidateUnlocks(self, unlocks):
     self._unlocks |= unlocks
     next2Unlock = []
     unlocked = []
     items = g_techTreeDP.getNext2UnlockByItems(unlocks, unlocked=self._unlocks, xps=self._xps, freeXP=max(self._accFreeXP, 0))
     if len(items):
         next2Unlock = map(lambda item: (item[0], self._changeNext2Unlock(item[0], item[1]), item[1]._makeTuple()), items.iteritems())
     filtered = filter(lambda unlock: getTypeOfCompactDescr(unlock) == _VEHICLE, unlocks)
     if len(filtered):
         unlocked = map(lambda item: (item, self._change2UnlockedByCD(item)), filtered)
     return (next2Unlock, unlocked)
Example #7
0
 def invalidateUnlocks(self, unlocks):
     self._unlocks |= unlocks
     next2Unlock = []
     unlocked = []
     items = g_techTreeDP.getNext2UnlockByItems(unlocks,
                                                unlocked=self._unlocks,
                                                xps=self._xps,
                                                freeXP=max(
                                                    self._accFreeXP, 0))
     if len(items):
         next2Unlock = map(
             lambda item: (item[0], self._changeNext2Unlock(
                 item[0], item[1]), item[1]._makeTuple()),
             items.iteritems())
     filtered = filter(
         lambda unlock: getTypeOfCompactDescr(unlock) == _VEHICLE, unlocks)
     if len(filtered):
         unlocked = map(
             lambda item: (item, self._change2UnlockedByCD(item)), filtered)
     return (next2Unlock, unlocked)
Example #8
0
 def invalidateUnlocks(self, unlocks):
     next2Unlock = []
     unlocked = []
     prevUnlocked = []
     unlockStats = self.getUnlockStats()
     items = g_techTreeDP.getNext2UnlockByItems(unlocks,
                                                **unlockStats._asdict())
     if items:
         next2Unlock = [(item[0],
                         self._changeNext2Unlock(item[0], item[1],
                                                 unlockStats),
                         item[1].makeTuple()) for item in items.iteritems()]
     filtered = [
         unlock for unlock in unlocks
         if getTypeOfCD(unlock) == GUI_ITEM_TYPE.VEHICLE
     ]
     if filtered:
         unlocked = [(item, self._change2UnlockedByCD(item))
                     for item in filtered]
         parents = map(g_techTreeDP.getTopLevel, filtered)
         prevUnlocked = [(item, self._changePreviouslyUnlockedByCD(item))
                         for item in chain(*parents)]
     return (next2Unlock, unlocked, prevUnlocked)