akef-cards 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. akef_cards-0.3.0/LICENSE +21 -0
  2. akef_cards-0.3.0/PKG-INFO +442 -0
  3. akef_cards-0.3.0/README.md +407 -0
  4. akef_cards-0.3.0/akef_cards/__init__.py +12 -0
  5. akef_cards-0.3.0/akef_cards/client.py +256 -0
  6. akef_cards-0.3.0/akef_cards/contract.py +112 -0
  7. akef_cards-0.3.0/akef_cards/data/faces.json +177 -0
  8. akef_cards-0.3.0/akef_cards/data/icons/ASSAULT.png +0 -0
  9. akef_cards-0.3.0/akef_cards/data/icons/Agi.png +0 -0
  10. akef_cards-0.3.0/akef_cards/data/icons/Atk.png +0 -0
  11. akef_cards-0.3.0/akef_cards/data/icons/CASTER.png +0 -0
  12. akef_cards-0.3.0/akef_cards/data/icons/ComboSkillDamageIncrease.png +0 -0
  13. akef_cards-0.3.0/akef_cards/data/icons/CriticalDamageIncrease.png +0 -0
  14. akef_cards-0.3.0/akef_cards/data/icons/CriticalRate.png +0 -0
  15. akef_cards-0.3.0/akef_cards/data/icons/CrystDamageIncrease.png +0 -0
  16. akef_cards-0.3.0/akef_cards/data/icons/DEFENDER.png +0 -0
  17. akef_cards-0.3.0/akef_cards/data/icons/DamageToBrokenUnitIncrease.png +0 -0
  18. akef_cards-0.3.0/akef_cards/data/icons/Def.png +0 -0
  19. akef_cards-0.3.0/akef_cards/data/icons/FireDamageIncrease.png +0 -0
  20. akef_cards-0.3.0/akef_cards/data/icons/GUARD.png +0 -0
  21. akef_cards-0.3.0/akef_cards/data/icons/HealOutputIncrease.png +0 -0
  22. akef_cards-0.3.0/akef_cards/data/icons/HealTakenIncrease.png +0 -0
  23. akef_cards-0.3.0/akef_cards/data/icons/MaxHp.png +0 -0
  24. akef_cards-0.3.0/akef_cards/data/icons/NaturalDamageIncrease.png +0 -0
  25. akef_cards-0.3.0/akef_cards/data/icons/NormalAttackDamageIncrease.png +0 -0
  26. akef_cards-0.3.0/akef_cards/data/icons/NormalSkillDamageIncrease.png +0 -0
  27. akef_cards-0.3.0/akef_cards/data/icons/PhysicalAndSpellInflictionEnhance.png +0 -0
  28. akef_cards-0.3.0/akef_cards/data/icons/PhysicalDamageIncrease.png +0 -0
  29. akef_cards-0.3.0/akef_cards/data/icons/PoiseDamageOutputScalar.png +0 -0
  30. akef_cards-0.3.0/akef_cards/data/icons/PulseDamageIncrease.png +0 -0
  31. akef_cards-0.3.0/akef_cards/data/icons/SUPPORTER.png +0 -0
  32. akef_cards-0.3.0/akef_cards/data/icons/Str.png +0 -0
  33. akef_cards-0.3.0/akef_cards/data/icons/UltimateSkillDamageIncrease.png +0 -0
  34. akef_cards-0.3.0/akef_cards/data/icons/UltimateSpGainScalar.png +0 -0
  35. akef_cards-0.3.0/akef_cards/data/icons/VANGUARD.png +0 -0
  36. akef_cards-0.3.0/akef_cards/data/icons/Will.png +0 -0
  37. akef_cards-0.3.0/akef_cards/data/icons/Wisd.png +0 -0
  38. akef_cards-0.3.0/akef_cards/data/text.json +2900 -0
  39. akef_cards-0.3.0/akef_cards/draw.py +304 -0
  40. akef_cards-0.3.0/akef_cards/errors.py +7 -0
  41. akef_cards-0.3.0/akef_cards/factory.py +87 -0
  42. akef_cards-0.3.0/akef_cards/fonts/Barlow-Bold.ttf +0 -0
  43. akef_cards-0.3.0/akef_cards/fonts/Barlow-Medium.ttf +0 -0
  44. akef_cards-0.3.0/akef_cards/fonts/Barlow-Regular.ttf +0 -0
  45. akef_cards-0.3.0/akef_cards/fonts/Barlow-SemiBold.ttf +0 -0
  46. akef_cards-0.3.0/akef_cards/fonts/FiraSans-Bold.ttf +0 -0
  47. akef_cards-0.3.0/akef_cards/fonts/FiraSans-Medium.ttf +0 -0
  48. akef_cards-0.3.0/akef_cards/fonts/FiraSans-Regular.ttf +0 -0
  49. akef_cards-0.3.0/akef_cards/fonts/FiraSans-SemiBold.ttf +0 -0
  50. akef_cards-0.3.0/akef_cards/fonts/NotoSansJP.ttf +0 -0
  51. akef_cards-0.3.0/akef_cards/fonts/NotoSansKR.ttf +0 -0
  52. akef_cards-0.3.0/akef_cards/fonts/NotoSansSC.ttf +0 -0
  53. akef_cards-0.3.0/akef_cards/fonts/NotoSansTC.ttf +0 -0
  54. akef_cards-0.3.0/akef_cards/fonts/NotoSansThai.ttf +0 -0
  55. akef_cards-0.3.0/akef_cards/fonts/OFL-FiraSans.txt +93 -0
  56. akef_cards-0.3.0/akef_cards/fonts/OFL-Noto.txt +93 -0
  57. akef_cards-0.3.0/akef_cards/fonts/OFL.txt +93 -0
  58. akef_cards-0.3.0/akef_cards/framing.py +30 -0
  59. akef_cards-0.3.0/akef_cards/gacha.py +59 -0
  60. akef_cards-0.3.0/akef_cards/i18n.py +126 -0
  61. akef_cards-0.3.0/akef_cards/images.py +158 -0
  62. akef_cards-0.3.0/akef_cards/live.py +69 -0
  63. akef_cards-0.3.0/akef_cards/memo.py +26 -0
  64. akef_cards-0.3.0/akef_cards/monument.py +99 -0
  65. akef_cards-0.3.0/akef_cards/py.typed +0 -0
  66. akef_cards-0.3.0/akef_cards/roster.py +61 -0
  67. akef_cards-0.3.0/akef_cards/sources/__init__.py +0 -0
  68. akef_cards-0.3.0/akef_cards/sources/skport.py +300 -0
  69. akef_cards-0.3.0/akef_cards/templates/__init__.py +28 -0
  70. akef_cards-0.3.0/akef_cards/templates/compare.py +217 -0
  71. akef_cards-0.3.0/akef_cards/templates/compare_styles.py +226 -0
  72. akef_cards-0.3.0/akef_cards/templates/contract_board.py +125 -0
  73. akef_cards-0.3.0/akef_cards/templates/contract_detail.py +140 -0
  74. akef_cards-0.3.0/akef_cards/templates/contract_midnight.py +81 -0
  75. akef_cards-0.3.0/akef_cards/templates/factory_board.py +169 -0
  76. akef_cards-0.3.0/akef_cards/templates/flex.py +72 -0
  77. akef_cards-0.3.0/akef_cards/templates/ingame.py +179 -0
  78. akef_cards-0.3.0/akef_cards/templates/live_board.py +156 -0
  79. akef_cards-0.3.0/akef_cards/templates/live_parts.py +57 -0
  80. akef_cards-0.3.0/akef_cards/templates/monument_board.py +115 -0
  81. akef_cards-0.3.0/akef_cards/templates/monument_event.py +209 -0
  82. akef_cards-0.3.0/akef_cards/templates/parts.py +301 -0
  83. akef_cards-0.3.0/akef_cards/templates/profile.py +251 -0
  84. akef_cards-0.3.0/akef_cards/templates/profile_midnight.py +168 -0
  85. akef_cards-0.3.0/akef_cards/templates/profile_poster.py +183 -0
  86. akef_cards-0.3.0/akef_cards/templates/pulls_board.py +166 -0
  87. akef_cards-0.3.0/akef_cards/templates/pulls_poster.py +210 -0
  88. akef_cards-0.3.0/akef_cards/templates/roster_board.py +129 -0
  89. akef_cards-0.3.0/akef_cards/templates/showcase.py +524 -0
  90. akef_cards-0.3.0/akef_cards/templates/talents.py +184 -0
  91. akef_cards-0.3.0/akef_cards/templates/wiki_board.py +131 -0
  92. akef_cards-0.3.0/akef_cards/templates/wiki_pages.py +293 -0
  93. akef_cards-0.3.0/akef_cards.egg-info/PKG-INFO +442 -0
  94. akef_cards-0.3.0/akef_cards.egg-info/SOURCES.txt +101 -0
  95. akef_cards-0.3.0/akef_cards.egg-info/dependency_links.txt +1 -0
  96. akef_cards-0.3.0/akef_cards.egg-info/requires.txt +7 -0
  97. akef_cards-0.3.0/akef_cards.egg-info/top_level.txt +1 -0
  98. akef_cards-0.3.0/pyproject.toml +47 -0
  99. akef_cards-0.3.0/setup.cfg +4 -0
  100. akef_cards-0.3.0/tests/test_showcase.py +430 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vaibhav Shresth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,442 @@
1
+ Metadata-Version: 2.4
2
+ Name: akef-cards
3
+ Version: 0.3.0
4
+ Summary: Image cards for Arknights: Endfield, from an Enka UID or a SKPORT account
5
+ Author-email: SORA <shresthvaibhav13@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ShresthVaibhav/akef-cards
8
+ Project-URL: Documentation, https://github.com/ShresthVaibhav/akef-cards/tree/main/docs
9
+ Project-URL: Issues, https://github.com/ShresthVaibhav/akef-cards/issues
10
+ Keywords: arknights,endfield,enka,skport,card,image,pillow
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Games/Entertainment
20
+ Classifier: Topic :: Multimedia :: Graphics
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: akef_cards/fonts/OFL.txt
26
+ License-File: akef_cards/fonts/OFL-FiraSans.txt
27
+ License-File: akef_cards/fonts/OFL-Noto.txt
28
+ Requires-Dist: Pillow>=10
29
+ Requires-Dist: aiohttp>=3.9
30
+ Requires-Dist: akef>=0.3
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=8; extra == "dev"
33
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ # akef-cards
37
+
38
+ Image cards for Arknights: Endfield. Operator builds, profiles, pull history, endgame stuff and a few more.
39
+ Operator and profile cards only need an Enka UID, no login. The rest read your SKPORT account.
40
+
41
+ All the data side (SKPORT, Enka, final stats, the wiki) lives in [akef](https://github.com/ShresthVaibhav/akef).
42
+ This one only draws. If you just want the numbers, use akef on its own.
43
+
44
+ ## Install
45
+
46
+ ```
47
+ pip install akef-cards
48
+ ```
49
+
50
+ Pulls in akef too. Python 3.10+. Longer docs in [`docs/`](https://github.com/ShresthVaibhav/akef-cards/blob/main/docs/README.md), runnable scripts in
51
+ [`examples/`](https://github.com/ShresthVaibhav/akef-cards/tree/main/examples).
52
+
53
+ ## Quick start
54
+
55
+ ```py
56
+ import asyncio
57
+ import akef_cards
58
+
59
+
60
+ async def main():
61
+ async with akef_cards.Cards() as cards:
62
+ profile = await cards.enka(4727743200)
63
+ for build in profile.builds:
64
+ image = await cards.render(build)
65
+ image.save(f"{build.name}.png")
66
+
67
+
68
+ asyncio.run(main())
69
+ ```
70
+
71
+ Enka only sees the operators in the in-game showcase, max 4. Thats how enka works, not our fault. For the whole
72
+ roster use a SKPORT token:
73
+
74
+ ```py
75
+ import akef
76
+
77
+ async with akef.Client(token) as client, akef_cards.Cards() as cards:
78
+ card = await client.card()
79
+ build = await cards.skport(card, "Arcane")
80
+ image = await cards.render(build)
81
+ ```
82
+
83
+ ## Every card
84
+
85
+ Each `render_*` gives back a Pillow image, or a list when theres more than one page. `template=` picks the look.
86
+
87
+ | Card | Call | Templates | Needs |
88
+ | --- | --- | --- | --- |
89
+ | Operator | `render(build)` | 1 light, 2 dark in-game | enka or skport |
90
+ | Compare | `render_compare(uid_a, uid_b, "Yvonne")` | 1 landscape, 2 dark split | enka |
91
+ | Profile | `render_profile(player)` | 1 light, 2 dark, 3 yellow poster | enka or skport |
92
+ | Roster | `render_roster(roster)` | 1 | skport |
93
+ | Pull history | `render_pulls(history)` | 1 board, 2 poster | skport |
94
+ | Live status | `render_live(live)` | 1 light, 2 dark | skport |
95
+ | Monument | `render_monument(monument)` | 1 | skport |
96
+ | Monument event | `render_monument_event(monument)` | 1 light, 2 dark | skport |
97
+ | Factory | `render_factory(factory)` | 1 light, 2 dark | skport |
98
+ | Contingency Contract | `render_contract(contracts)` | 1 light, 2 dark | skport |
99
+ | Contract detail | `render_contract_detail(detail)` | 1 light, 2 dark | skport |
100
+ | Wiki | `render_wiki_pages(page)` | 1 light, 2 dark | skport wiki |
101
+
102
+ ## Operator
103
+
104
+ ```py
105
+ image = await cards.render(build) # light
106
+ image = await cards.render(build, template=2) # dark, game menu style
107
+ ```
108
+
109
+ Stats are checked against the in-game screen and they match, rounding and all. Enka's site gives Gilberta's ult
110
+ gain a talent bonus the game doesnt, so for her we go with the game.
111
+
112
+ <details>
113
+ <summary>Template 1</summary>
114
+
115
+ ![operator light](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/operator_1.jpg)
116
+ </details>
117
+
118
+ <details>
119
+ <summary>Template 2</summary>
120
+
121
+ ![operator dark](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/operator_2.jpg)
122
+ </details>
123
+
124
+ ### Custom art
125
+
126
+ Dont like the default splash? Pass `art=` with your own. A file path, a url, raw bytes or a Pillow image all
127
+ work, on both templates. On template 1 the art takes the whole left side, no circles behind it.
128
+
129
+ ```py
130
+ image = await cards.render(build, art="my_art.png")
131
+ image = await cards.render(build, art="https://example.com/art.png")
132
+ image = await cards.render(build, art=attachment_bytes, template=2) # from a bot upload
133
+ image = await cards.render(build, art=pillow_image) # edit it first if you want
134
+ ```
135
+
136
+ Custom art is never saved to the disk cache. Some image hosts block scripts, if a url fails download it
137
+ yourself and pass the bytes. [`custom_art.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/custom_art.py) makes the ones below.
138
+
139
+ <details>
140
+ <summary>Custom art examples</summary>
141
+
142
+ ![gilberta custom art, template 1](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/art_pigeonfight99_1.jpg)
143
+ ![gilberta custom art, template 2](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/art_pigeonfight99_2.jpg)
144
+
145
+ art by pigeonfight99
146
+
147
+ ![gilberta custom art, template 1](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/art_kisaragi_pana_1.jpg)
148
+ ![gilberta custom art, template 2](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/art_kisaragi_pana_2.jpg)
149
+
150
+ art by kisaragi_pana
151
+ </details>
152
+
153
+ ## Compare
154
+
155
+ Two UIDs and an operator, or a list of them. One card per operator that both players are showing. If only one
156
+ of them has it, its skipped with a warning.
157
+
158
+ ```py
159
+ pages = await cards.render_compare(uid_a, uid_b, "Yvonne")
160
+ pages = await cards.render_compare(uid_a, uid_b, ["Gilberta", "Yvonne"], template=2)
161
+ ```
162
+
163
+ <details>
164
+ <summary>Template 1</summary>
165
+
166
+ ![compare landscape](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/compare_1.jpg)
167
+ </details>
168
+
169
+ <details>
170
+ <summary>Template 2</summary>
171
+
172
+ ![compare split](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/compare_2.jpg)
173
+ </details>
174
+
175
+ ## Profile
176
+
177
+ ```py
178
+ [image] = await cards.render_profile(profile.player) # enka, always one page
179
+ pages = await cards.render_profile(cards.skport_player(card), grid="3x3") # skport, whole roster so many pages
180
+ ```
181
+
182
+ SKPORT gives the full roster, so a big account becomes a few images with 8 or 9 operators each. Enka is one page
183
+ since it only has the showcase.
184
+
185
+ <details>
186
+ <summary>Template 1</summary>
187
+
188
+ ![profile light](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/profile_1.jpg)
189
+ </details>
190
+
191
+ <details>
192
+ <summary>Template 2</summary>
193
+
194
+ ![profile dark](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/profile_2.jpg)
195
+ </details>
196
+
197
+ <details>
198
+ <summary>Template 3</summary>
199
+
200
+ ![profile poster](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/profile_3.jpg)
201
+ </details>
202
+
203
+ ## SKPORT cards
204
+
205
+ ```py
206
+ card = await client.card()
207
+
208
+ image = await cards.render_live(cards.skport_live(card), template=2)
209
+ image = await cards.render_roster(cards.skport_roster(card))
210
+ image = await cards.render_factory(cards.skport_factory(card))
211
+ image = await cards.render_pulls(await cards.skport_pulls(card, await client.pulls()))
212
+ image = await cards.render_pulls(await cards.skport_pulls(card, pulls, after=date(2026, 10, 1))) # just a period
213
+ ```
214
+
215
+ <details>
216
+ <summary>Live status</summary>
217
+
218
+ ![live light](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/live_1.jpg)
219
+ ![live dark](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/live_2.jpg)
220
+ </details>
221
+
222
+ <details>
223
+ <summary>Roster</summary>
224
+
225
+ ![roster](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/roster.jpg)
226
+ </details>
227
+
228
+ <details>
229
+ <summary>Factory</summary>
230
+
231
+ ![factory light](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/factory_1.jpg)
232
+ ![factory dark](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/factory_2.jpg)
233
+ </details>
234
+
235
+ <details>
236
+ <summary>Pull history</summary>
237
+
238
+ ![pulls board](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/pulls_1.jpg)
239
+ ![pulls poster](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/pulls_2.jpg)
240
+ </details>
241
+
242
+ ## Monument
243
+
244
+ The overview shows every event at once. The event card goes deep on one: each stage, the clear time and the team
245
+ you used, as big portraits so you can flex. Agony clears get a red frame.
246
+
247
+ ```py
248
+ monument = cards.skport_monument(card, await client.monument())
249
+ overview = await cards.render_monument(monument)
250
+
251
+ latest = await cards.render_monument_event(monument) # newest event
252
+ one = await cards.render_monument_event(monument, "Marked by Dark Shadows")
253
+ many = await cards.render_monument_event(monument, ["Searing Scars", 0]) # list in, list out
254
+ ```
255
+
256
+ <details>
257
+ <summary>Overview</summary>
258
+
259
+ ![monument](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/monument.jpg)
260
+ </details>
261
+
262
+ <details>
263
+ <summary>Event, light and dark</summary>
264
+
265
+ ![monument event light](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/monument_event_1.jpg)
266
+ ![monument event dark](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/monument_event_2.jpg)
267
+ </details>
268
+
269
+ ## Contingency Contract
270
+
271
+ A summary card, and a detail one with your best 4 battles and the teams you ran.
272
+
273
+ ```py
274
+ image = await cards.render_contract(cards.skport_contract(card))
275
+
276
+ detail = cards.skport_contract_detail(card, await client.contract())
277
+ image = await cards.render_contract_detail(detail, template=2)
278
+ ```
279
+
280
+ <details>
281
+ <summary>Summary</summary>
282
+
283
+ ![contract light](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/contract_1.jpg)
284
+ ![contract dark](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/contract_2.jpg)
285
+ </details>
286
+
287
+ <details>
288
+ <summary>Detail</summary>
289
+
290
+ ![contract detail light](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/contract_detail_1.jpg)
291
+ ![contract detail dark](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/contract_detail_2.jpg)
292
+ </details>
293
+
294
+ ## Wiki
295
+
296
+ An operator's page from SKPORT's official wiki, split in six cards: overview, skills, talents, growth, profile
297
+ and lore.
298
+
299
+ ```py
300
+ from akef import WikiPart
301
+
302
+ ops = await client.wiki("operators")
303
+ item = await client.wiki_item(next(o for o in ops if o.name == "Arcane").id)
304
+ page = cards.wiki(item, await client.wiki_index()) # same as akef.wiki_page(...)
305
+ pages = await cards.render_wiki_pages(page) # all six
306
+ pages = await cards.render_wiki_pages(page, [WikiPart.SKILLS, WikiPart.LORE]) # just these
307
+ image = await cards.render_wiki(page, "talents", template=2) # one
308
+ ```
309
+
310
+ `wiki_index()` is one more round of requests that names the materials and weapons a page links to. Talents,
311
+ growth and profile need it, the other three dont.
312
+
313
+ <details>
314
+ <summary>Overview, light and dark</summary>
315
+
316
+ ![wiki light](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/wiki_1.jpg)
317
+ ![wiki dark](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/wiki_2.jpg)
318
+ </details>
319
+
320
+ <details>
321
+ <summary>Talents</summary>
322
+
323
+ ![wiki talents](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/wiki_talents.jpg)
324
+ </details>
325
+
326
+ ## Options
327
+
328
+ | Option | Where | What it does |
329
+ | --- | --- | --- |
330
+ | `template=` | every card with more than one look | picks the look |
331
+ | `hidden=True` | every card | blurs the UID |
332
+ | `art=` | operator card | your own art instead of the splash: image, bytes, path or url |
333
+ | `grid="3x3"` | profile | 9 operators a page instead of 8 |
334
+ | `lang=` | `Cards(lang="ja")` | names in that language |
335
+
336
+ `render_bytes()` gives a `BytesIO` with a file name, ready to send if youre making a bot. Every `Build` also has
337
+ the plain numbers: `build.stats.atk`, `build.gear[0].lines`, `build.skills` and so on. Those come from akef,
338
+ see its [Enka and final stats docs](https://github.com/ShresthVaibhav/akef/blob/main/docs/enka.md).
339
+
340
+ <details>
341
+ <summary>hidden=True</summary>
342
+
343
+ ![hidden uid](https://raw.githubusercontent.com/ShresthVaibhav/akef-cards/main/docs/images/hidden.jpg)
344
+ </details>
345
+
346
+ ## Caching
347
+
348
+ On by default, nothing to set up.
349
+
350
+ | What | Where | How long |
351
+ | --- | --- | --- |
352
+ | splash art and icons | disk, survives restarts | until the folder hits 15 MB, oldest used go first |
353
+ | finished cards | memory | last 8 |
354
+ | enka player data | memory | enka's own ttl |
355
+ | game data tables | disk | until a patch needs new ones |
356
+
357
+ Images are saved by their file name, not the link, so when SKPORT moves a link it still hits the cache. Art you
358
+ pass with `art=` is never saved.
359
+
360
+ ```py
361
+ cards = akef_cards.Cards(cache_mb=100, kept_cards=32) # more room
362
+ cards = akef_cards.Cards(cache_mb=None) # no size limit
363
+ cards = akef_cards.Cards(cache=False) # always fetch and draw fresh
364
+ cards.clear_cache()
365
+ ```
366
+
367
+ ## Game data
368
+
369
+ Final stats are worked out by akef from Enka's public game data. The first card downloads the tables and keeps
370
+ them on disk, after a patch they refresh by themselves when something new shows up. If enka didnt add it yet
371
+ either you get `akef.MissingGameData`. Refresh by hand with `await cards.update()`. Details in
372
+ [akef's docs](https://github.com/ShresthVaibhav/akef/blob/main/docs/enka.md#game-data).
373
+
374
+ ## Every method
375
+
376
+ <details>
377
+ <summary>All of them in one table</summary>
378
+
379
+ | Method | Does |
380
+ | --- | --- |
381
+ | `enka(uid)` | Enka profile: showcased builds plus `player` for the profile card |
382
+ | `skport(card, name, stats=True)` | a build for any operator on a SKPORT card |
383
+ | `skport_player(card)` | profile data with the whole roster |
384
+ | `skport_live(card)` | sanity, dailies, weeklies, battle pass, echoes, contract |
385
+ | `skport_roster(card)` | everyone you own with their training |
386
+ | `skport_factory(card)` | regions, settlements and Dijiang |
387
+ | `skport_pulls(card, pulls, after=None)` | pull history ready to draw |
388
+ | `skport_monument(card, monument)` | monument events and clears |
389
+ | `skport_contract(card)` | contract summary |
390
+ | `skport_contract_detail(card, detail)` | contract runs and teams |
391
+ | `wiki(item, index=None)` | a readable wiki page |
392
+ | `render(build, template, art, hidden)` | operator card |
393
+ | `render_bytes(build, format="PNG", ...)` | operator card as a file for bots |
394
+ | `render_compare(a, b, names, template)` | two players side by side |
395
+ | `render_profile(player, template, grid)` | profile pages |
396
+ | `render_live(live, template)` | live status |
397
+ | `render_roster(roster)` | roster board |
398
+ | `render_factory(factory, template)` | factory |
399
+ | `render_pulls(history, template)` | pull history |
400
+ | `render_monument(monument)` | every monument event |
401
+ | `render_monument_event(monument, event, template)` | one event, or a list |
402
+ | `render_contract(contracts, template)` | contract summary |
403
+ | `render_contract_detail(detail, template)` | best 4 contract runs |
404
+ | `render_wiki(page, part, template)` | one wiki card |
405
+ | `render_wiki_pages(page, parts, template)` | several wiki cards |
406
+ | `update()` | refresh game data |
407
+ | `clear_cache()` | forget cached cards and Enka answers |
408
+
409
+ Every `render_*` takes `hidden=True` too, except the wiki ones, theres no UID on those.
410
+ </details>
411
+
412
+ ## Languages
413
+
414
+ Names follow Enka's 14 languages. Our own labels are English for now, anything not translated is drawn in English
415
+ and logged so you can see whats missing. Translators welcome, see [Languages](https://github.com/ShresthVaibhav/akef-cards/blob/main/docs/getting-started.md#languages).
416
+
417
+ ## Examples
418
+
419
+ | Script | Shows |
420
+ | --- | --- |
421
+ | [`enka_uid.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/enka_uid.py) | every showcased operator from a UID |
422
+ | [`skport.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/skport.py) | operator cards from a SKPORT account |
423
+ | [`profile.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/profile.py) | profile from enka and from skport |
424
+ | [`compare.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/compare.py) | two players side by side |
425
+ | [`endgame.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/endgame.py) | monument and contract cards |
426
+ | [`wiki.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/wiki.py) | all six wiki cards |
427
+ | [`every_card.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/every_card.py) | every card in every template |
428
+ | [`caching.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/caching.py) | how fast the cache makes things |
429
+ | [`custom_art.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/custom_art.py) | Gilberta with fan art from a path, bytes or pillow image |
430
+ | [`options.py`](https://github.com/ShresthVaibhav/akef-cards/blob/main/examples/options.py) | hidden uid, bytes for bots, languages |
431
+
432
+ Scripts that need SKPORT read the token from `SKPORT_TOKEN` or `~/.skport_token`.
433
+
434
+ ## License
435
+
436
+ MIT. Ships [Barlow](https://github.com/jpt/barlow), [Fira Sans](https://github.com/mozilla/Fira),
437
+ [Noto Sans JP, KR, TC, SC](https://github.com/notofonts/noto-cjk) and [Noto Sans Thai](https://github.com/notofonts/thai)
438
+ under the SIL Open Font License (see `akef_cards/fonts/`). Game data and art come from
439
+ [Enka.Network](https://enka.network) and the game itself, big thanks to enka fr. Gilberta fan art in the custom
440
+ art example by pigeonfight99 and kisaragi_pana, it belongs to them and isnt covered by the MIT license.
441
+
442
+ Not affiliated with Hypergryph or Gryphline.