Advertisement
go6odn28

legendary_farmming

Mar 3rd, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.90 KB | None | 0 0
  1. def legendary_obtained(crafting_material, quantity):
  2.     shards = False
  3.     fragments = False
  4.     motes = False
  5.     if crafting_material == "shards":
  6.         shards = True
  7.     elif crafting_material == "fragments":
  8.         fragments = True
  9.     elif crafting_material == "motes":
  10.         motes = True
  11.  
  12.     if quantity > 250:
  13.         quantity_left = quantity - 250
  14.     else:
  15.         quantity_left = 0
  16.  
  17.     if shards:
  18.         return "Shadowmourne obtained!", quantity_left
  19.     elif fragments:
  20.         return "Valanyr obtained!", quantity_left
  21.     elif motes:
  22.         return "Dragonwrath obtained!", quantity_left
  23.  
  24.  
  25. flag = False
  26. materials_dict = {}
  27. junk_dict = {}
  28. while True:
  29.     materials = input().split()
  30.     if not materials:
  31.         break
  32.  
  33.     for i in range(1, len(materials), 2):
  34.         material = materials[i].lower()
  35.         if material == "shards" or material == "fragments" or material == "motes":
  36.             if material not in materials_dict.keys():
  37.                 materials_dict[material] = 0
  38.             materials_dict[material] += int(materials[i - 1])
  39.             if materials_dict[material] >= 250:
  40.                 legendary_item, materials_dict[material] = legendary_obtained(material, materials_dict[material])
  41.                 print(legendary_item)
  42.                 flag = True
  43.                 break
  44.         else:
  45.             if material not in junk_dict:
  46.                 junk_dict[material] = 0
  47.             junk_dict[material] += int(materials[i - 1])
  48.     if flag:
  49.         break
  50.     materials.clear()
  51.  
  52. print(f"shards: {materials_dict.get('shards') if materials_dict.get('shards') is not None else 0}")
  53. print(f"fragments: {materials_dict.get('fragments') if materials_dict.get('fragments') is not None else 0}")
  54. print(f"motes: {materials_dict.get('motes') if materials_dict.get('motes') is not None else 0}")
  55. for key, value in junk_dict.items():
  56.     print(f"{key}: {value}")
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement