def collect_material(self, material_id, collect_material): if self.material_cooltime() > 0: return failure.Failure((gateway_pb2.EC_UNABLE_TO_OPERATE, 'Exist cooltime')) material_price = Cache.material_price(material_id) if not material_price: return failure.Failure((gateway_pb2.EC_UNABLE_TO_OPERATE, 'Material is not exist')) if self.honbul() < material_price['price']: return failure.Failure((gateway_pb2.EC_NOT_ENOUGH_HONBUL, 'Need more honbul')) # 재료생성 RND = random.randint R = round C = math.ceil F = math.floor amount = eval(material_price['amount']) amount *= Properties.COLLECT_MATERIAL_MULTIPIER # 응답저장 collect_material.material_id = material_id collect_material.amount = amount collect_material.honbul = self.honbul()