예제 #1
0
    def invalidateInventory(self, nodeCDs):
        result = []
        nodes_ = (node for node in self._getNodesToInvalidate()
                  if node.getNodeCD() in nodeCDs)
        for node in nodes_:
            nodeCD = node.getNodeCD()
            state = node.getState()
            item = self.getItem(nodeCD)
            if item.isInInventory:
                state = NODE_STATE.removeIfHas(state,
                                               NODE_STATE_FLAGS.ENOUGH_MONEY)
                state = NODE_STATE.addIfNot(state,
                                            NODE_STATE_FLAGS.IN_INVENTORY)
                state = NODE_STATE.removeIfHas(
                    state, NODE_STATE_FLAGS.VEHICLE_IN_RENT)
                state = NODE_STATE.removeIfHas(state,
                                               NODE_STATE_FLAGS.LAST_2_BUY)
                if item.isRented and not item.isPremiumIGR:
                    state = self._checkExpiredRent(state, item)
                    state = self._checkMoney(state, nodeCD)
                if self._canSell(nodeCD):
                    state = NODE_STATE.addIfNot(state,
                                                NODE_STATE_FLAGS.CAN_SELL)
                else:
                    state = NODE_STATE.removeIfHas(state,
                                                   NODE_STATE_FLAGS.CAN_SELL)
            else:
                state = NODE_STATE.removeIfHas(state,
                                               NODE_STATE_FLAGS.IN_INVENTORY)
                state = NODE_STATE.removeIfHas(
                    state, NODE_STATE_FLAGS.VEHICLE_IN_RENT)
                state = NODE_STATE.removeIfHas(state,
                                               NODE_STATE_FLAGS.CAN_SELL)
                state = NODE_STATE.removeIfHas(state,
                                               NODE_STATE_FLAGS.SELECTED)
                state = NODE_STATE.changeLast2Buy(
                    state, self._needLast2BuyFlag(nodeCD))
                state = self._checkMoney(state, nodeCD)
            state = self._checkBuyingActionState(state, item)
            state = self._checkRestoreState(state, item)
            state = self._checkRentableState(state, item)
            state = self._checkTradeInState(state, item)
            node.setState(state)
            result.append((nodeCD, state))

        return result
예제 #2
0
 def _changePreviouslyUnlocked(self, node):
     state = node.getState()
     return NODE_STATE.changeLast2Buy(
         state, self._isLastUnlocked(node.getNodeCD()))
예제 #3
0
 def _change2Unlocked(self, node):
     state = super(NationTreeData, self)._change2Unlocked(node)
     return NODE_STATE.changeLast2Buy(
         state, self._isLastUnlocked(node.getNodeCD()))