def _change2Unlocked(self, node): state = NODE_STATE.change2Unlocked(node['state']) if state < 0: return node['state'] node['state'] = state if self._canBuy(node['id']): state = NODE_STATE.add(state, NODE_STATE.ENOUGH_MONEY) else: state = NODE_STATE.remove(state, NODE_STATE.ENOUGH_MONEY) if state < 0: return node['state'] node['state'] = state return state
def _change2Unlocked(self, node): state = NODE_STATE.change2Unlocked(node.getState()) if state < 0: return node.getState() node.setState(state) if self._mayObtainForMoney(node.getNodeCD()): state = NODE_STATE.add(state, NODE_STATE_FLAGS.ENOUGH_MONEY) else: state = NODE_STATE.remove(state, NODE_STATE_FLAGS.ENOUGH_MONEY) if state < 0: return node.getState() node.setState(state) return state
def _change2Unlocked(self, node): """ Changes state of node to 'unlocked'. :param node: node data. :return: int containing new state of node. """ state = NODE_STATE.change2Unlocked(node['state']) if state < 0: return node['state'] node['state'] = state if self._mayObtainForMoney(node['id']): state = NODE_STATE.add(state, NODE_STATE_FLAGS.ENOUGH_MONEY) else: state = NODE_STATE.remove(state, NODE_STATE_FLAGS.ENOUGH_MONEY) if state < 0: return node['state'] node['state'] = state return state
def _change2Unlocked(self, node): """ Changes state of node to 'unlocked'. :param node: node data. :return: int containing new state of node. """ state = NODE_STATE.change2Unlocked(node.getState()) if state < 0: return node.getState() node.setState(state) if self._mayObtainForMoney(node.getNodeCD()): state = NODE_STATE.add(state, NODE_STATE_FLAGS.ENOUGH_MONEY) else: state = NODE_STATE.remove(state, NODE_STATE_FLAGS.ENOUGH_MONEY) if state < 0: return node.getState() node.setState(state) return state
def _change2Unlocked(self, node): state = NODE_STATE.change2Unlocked(node.getState()) if state < 0: return node.getState() node.setState(state) if canBuyGoldForItemThroughWeb( node.getNodeCD()) or self._mayObtainForMoney(node.getNodeCD()): state = NODE_STATE.add(state, NODE_STATE_FLAGS.ENOUGH_MONEY) else: state = NODE_STATE.remove(state, NODE_STATE_FLAGS.ENOUGH_MONEY) if state < 0: return node.getState() if not node.isActionPrice(): state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.ACTION) else: state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.ACTION) state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.BLUEPRINT) node.setState(state) return state