def stop_woodcutting(self):
if self.last_action and self.last_action[0] == "woodcutting":
wood_type = self.last_action[1]
time_spent = math.ceil(time.time() - self.last_action_time) / 60
self.last_action = None
self.last_action = None
current_wood_lvl = wood_lvl(wood_type)
wood_amount = math.floor(time_spent * self.wood_rate(wood_type) * self.woodcutting_rate)
xp_amount = current_wood_lvl * wood_amount
self.inventory[wood_type] = self.inventory.get(wood_type, 0) + wood_amount
if self.inventory[wood_type] == 0:
del self.inventory[wood_type]
self.woodcutting_xp += xp_amount
self.write_data()
return wood_type, time_spent, wood_amount, xp_amount
else:
return False, self.last_action
评论列表
文章目录