Skip to content

Commit

Permalink
Remove cake
Browse files Browse the repository at this point in the history
  • Loading branch information
calendulish committed Nov 16, 2024
1 parent 9f9dc59 commit 719de5c
Showing 1 changed file with 0 additions and 75 deletions.
75 changes: 0 additions & 75 deletions src/steam_tools_ng/core/fakerun.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,75 +27,6 @@

_ = i18n.get_translation


async def mixing_igredients(ids: List[str]) -> AsyncGenerator[utils.ModuleData, None]:
yield utils.ModuleData(display=str(34), status=_("Mixing ingredients"))
await asyncio.sleep(2)

try:
for id_ in ids:
with client.SteamAPIExecutor(int(id_)):
await asyncio.sleep(2)
yield utils.ModuleData(display=id_, status=_("Sugar successfully added"))
except ProcessLookupError:
yield utils.ModuleData(error=_("Steam Client is not running."))


async def cake(
webapi_session: webapi.SteamWebAPI,
steamid: universe.SteamId,
game_id: int,
) -> AsyncGenerator[utils.ModuleData, None]:
yield utils.ModuleData(display=str(34), status=_("Loading a delicious cake"))
ids = config.parser.get('fakerun', 'cakes').strip().split(',')
call([config.file_manager, "steam://friends/status/invisible"])

if len(ids) < 3:
yield utils.ModuleData(error=_("Not enough ingredients"))
return

try:
game_list = await webapi_session.get_owned_games(steamid, appids_filter=[game_id, *ids])

if len(game_list) != 4:
raise ValueError
except aiohttp.ClientError:
module_data = utils.ModuleData(error=_("Check your connection. (server down?)"))

async for data in utils.timed_module_data(15, module_data):
yield data

return
except ValueError:
yield utils.ModuleData(error=_("Some ingredients are missing from your cuisine"))
return

call([config.file_manager, "steam://run/{game_id}"])
await asyncio.sleep(3)

async for slice_ in mixing_igredients(ids):
yield slice_

community_session = community.Community.get_session(0)

while True:
last_played_game = await community_session.get_last_played_game(steamid)

if last_played_game == game_id:
yield utils.ModuleData(display=str(34), status=_("getting cake out of pan"))

# Prevent pan to fall out of hands
await asyncio.sleep(3)

async for slice_ in mixing_igredients(ids):
yield slice_

yield utils.ModuleData(display=str(34), status=_("Cake is ready"))
break

await asyncio.sleep(10)


async def main(
steamid: universe.SteamId,
game_id: int,
Expand All @@ -104,12 +35,6 @@ async def main(
webapi_session = webapi.SteamWebAPI.get_session(0)
login_session = login.Login.get_session(0)

if game_id == 34:
assert isinstance(extra_game_id, int), "No extra game_id"
async for slice_ in cake(webapi_session, steamid, extra_game_id):
yield slice_
return

if not await login_session.is_limited():
try:
game_list = await webapi_session.get_owned_games(steamid, appids_filter=[game_id])
Expand Down

0 comments on commit 719de5c

Please sign in to comment.