Added table and general functions for stats system #21

Merged
waifu merged 16 commits from stats_system into dev 2025-06-25 20:45:13 -07:00
Showing only changes of commit 8c5c860ef6 - Show all commits

View file

@ -1,5 +1,5 @@
# Kemoverse - a gacha-style bot for the Fediverse.
# Copyright © 2025 Waifu VD15, Moon, and contributors.
# Copyright © 2025 Waifu, VD15, Moon, and contributors.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -75,6 +75,19 @@ def get_random_card() -> Card | None:
'image_url': chosen['file_id']
}
def get_cards(card_ids: list[int]) -> list[tuple]:
'''
Retrieves stats for a list of card IDs.
Returns a list of tuples: (id, name, rarity, file_id, power, charm, wit, ...)
'''
Outdated
Review

Bundle stats into character creation. Unless there's a case where a character will exist without having stats, it doesn't make a great deal of sense to have them separate.

Bundle stats into character creation. Unless there's a case where a character will exist without having stats, it doesn't make a great deal of sense to have them separate.
Outdated
Review

I just realized that if we bundle it into the card creation we also need to add the changes to the do_create function, which seems logical since that's the way we create cards... I'll work on adding it there.
Also thanks for the feedback king.

I just realized that if we bundle it into the card creation we also need to add the changes to the do_create function, which seems logical since that's the way we create cards... I'll work on adding it there. Also thanks for the feedback king.
if not card_ids:
return []
placeholders = ','.join('?' for _ in card_ids)
query = f'SELECT * FROM cards WHERE id IN ({placeholders})'
CURSOR.execute(query, card_ids)
return CURSOR.fetchall()
def get_player(username: str) -> int:
'''Retrieve a player ID by username, or return None if not found.'''