mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 15:02:59 +00:00
opus defined as set of cards
This commit is contained in:
parent
e44892878f
commit
73e88349b6
5 changed files with 46 additions and 26 deletions
1
Pipfile
1
Pipfile
|
@ -8,6 +8,7 @@ verify_ssl = true
|
|||
[packages]
|
||||
requests = "*"
|
||||
pillow = "*"
|
||||
roman = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.6"
|
||||
|
|
10
Pipfile.lock
generated
10
Pipfile.lock
generated
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "f0fedb7b3061de81b354fc95cf267f1b59bce83abd94a44f259ebf7f1e500930"
|
||||
"sha256": "b4a419cd1c9cb31843b62441f0f8b04d2a88a9b3e4c86e01eb077f9c7f6d6e83"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
@ -92,6 +92,14 @@
|
|||
"index": "pypi",
|
||||
"version": "==2.26.0"
|
||||
},
|
||||
"roman": {
|
||||
"hashes": [
|
||||
"sha256:2c46ac8db827d34e4fa9ccc0577e7f0b0d84f16ffe112351bd4f1ec2eb12d73f",
|
||||
"sha256:c2a1f14ab47373aecc141edbcdd66595949c9d0ed932fe76bd547df1b55f7278"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==3.3"
|
||||
},
|
||||
"urllib3": {
|
||||
"hashes": [
|
||||
"sha256:39fb8672126159acb139a7718dd10806104dec1e2f0f6c88aab05d17df10c8d4",
|
||||
|
|
20
fftcg/cards.py
Normal file
20
fftcg/cards.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import requests
|
||||
|
||||
from .card import Card
|
||||
|
||||
APIURL = "https://fftcg.square-enix-games.com/de/get-cards"
|
||||
|
||||
|
||||
class Cards:
|
||||
def __init__(self, params):
|
||||
# supported params:
|
||||
# [str] text (required)
|
||||
# [array] type, element, cost, rarity, power, category_1, set
|
||||
# [str] language, code, multicard="○"|"", ex_burst="○"|"", special="《S》"|""
|
||||
# [int] exactmatch=0|1
|
||||
|
||||
req = requests.post(APIURL, json=params)
|
||||
self.__content = [Card(card_data) for card_data in req.json()["cards"]]
|
||||
|
||||
def __str__(self):
|
||||
return "\n".join(str(card) for card in self.__content)
|
|
@ -1,15 +1,17 @@
|
|||
import requests
|
||||
from roman import toRoman
|
||||
|
||||
from .card import Card
|
||||
|
||||
APIURL = "https://fftcg.square-enix-games.com/de/get-cards"
|
||||
from .cards import Cards
|
||||
|
||||
|
||||
class Opus:
|
||||
def __init__(self, params):
|
||||
# self.__cards = [Card(card_data) for card_data in data]
|
||||
req = requests.post(APIURL, json=params)
|
||||
self.__cards = [Card(card_data) for card_data in req.json()["cards"]]
|
||||
class Opus(Cards):
|
||||
def __init__(self, number):
|
||||
if isinstance(number, int):
|
||||
number = f"Opus {toRoman(number)}"
|
||||
|
||||
def __str__(self):
|
||||
return "\n".join(str(card) for card in self.__cards)
|
||||
params = {
|
||||
"text": "",
|
||||
"element": ["fire"],
|
||||
"set": [number],
|
||||
}
|
||||
|
||||
Cards.__init__(self, params)
|
||||
|
|
17
main.py
17
main.py
|
@ -3,21 +3,10 @@
|
|||
from fftcg.opus import Opus
|
||||
|
||||
|
||||
def print_hi(name):
|
||||
# supported params:
|
||||
# [str] language, text,
|
||||
# [array] type, element, cost, rarity, power, category_1, set
|
||||
# [str] multicard="○"|"", ex_burst="○"|"", code, special="《S》"|""
|
||||
# [int] exactmatch=0|1
|
||||
params = {
|
||||
"text": "",
|
||||
"element": ["fire"],
|
||||
"set": ["Opus XIV"],
|
||||
}
|
||||
|
||||
opus = Opus(params)
|
||||
def main():
|
||||
opus = Opus(14)
|
||||
print(opus)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print_hi('PyCharm')
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue