bcsfe 3.0.0__py3-none-any.whl

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 (168) hide show
  1. bcsfe/__init__.py +12 -0
  2. bcsfe/__main__.py +64 -0
  3. bcsfe/cli/__init__.py +21 -0
  4. bcsfe/cli/color.py +189 -0
  5. bcsfe/cli/dialog_creator.py +682 -0
  6. bcsfe/cli/edits/__init__.py +23 -0
  7. bcsfe/cli/edits/aku_realm.py +11 -0
  8. bcsfe/cli/edits/basic_items.py +402 -0
  9. bcsfe/cli/edits/cat_editor.py +715 -0
  10. bcsfe/cli/edits/clear_tutorial.py +11 -0
  11. bcsfe/cli/edits/enemy_editor.py +192 -0
  12. bcsfe/cli/edits/event_tickets.py +147 -0
  13. bcsfe/cli/edits/fixes.py +43 -0
  14. bcsfe/cli/edits/map.py +249 -0
  15. bcsfe/cli/edits/rare_ticket_trade.py +45 -0
  16. bcsfe/cli/feature_handler.py +294 -0
  17. bcsfe/cli/file_dialog.py +154 -0
  18. bcsfe/cli/main.py +327 -0
  19. bcsfe/cli/save_management.py +529 -0
  20. bcsfe/cli/server_cli.py +71 -0
  21. bcsfe/core/__init__.py +361 -0
  22. bcsfe/core/country_code.py +104 -0
  23. bcsfe/core/crypto.py +164 -0
  24. bcsfe/core/game/__init__.py +3 -0
  25. bcsfe/core/game/battle/__init__.py +3 -0
  26. bcsfe/core/game/battle/battle_items.py +127 -0
  27. bcsfe/core/game/battle/cleared_slots.py +306 -0
  28. bcsfe/core/game/battle/enemy.py +132 -0
  29. bcsfe/core/game/battle/slots.py +200 -0
  30. bcsfe/core/game/catbase/__init__.py +49 -0
  31. bcsfe/core/game/catbase/beacon_base.py +67 -0
  32. bcsfe/core/game/catbase/cat.py +1243 -0
  33. bcsfe/core/game/catbase/drop_chara.py +74 -0
  34. bcsfe/core/game/catbase/gatya.py +454 -0
  35. bcsfe/core/game/catbase/gatya_item.py +155 -0
  36. bcsfe/core/game/catbase/item_pack.py +190 -0
  37. bcsfe/core/game/catbase/login_bonuses.py +184 -0
  38. bcsfe/core/game/catbase/matatabi.py +69 -0
  39. bcsfe/core/game/catbase/medals.py +171 -0
  40. bcsfe/core/game/catbase/mission.py +321 -0
  41. bcsfe/core/game/catbase/my_sale.py +58 -0
  42. bcsfe/core/game/catbase/nyanko_club.py +254 -0
  43. bcsfe/core/game/catbase/officer_pass.py +79 -0
  44. bcsfe/core/game/catbase/playtime.py +97 -0
  45. bcsfe/core/game/catbase/powerup.py +179 -0
  46. bcsfe/core/game/catbase/scheme_items.py +195 -0
  47. bcsfe/core/game/catbase/special_skill.py +331 -0
  48. bcsfe/core/game/catbase/stamp.py +58 -0
  49. bcsfe/core/game/catbase/talent_orbs.py +710 -0
  50. bcsfe/core/game/catbase/unlock_popups.py +71 -0
  51. bcsfe/core/game/catbase/upgrade.py +190 -0
  52. bcsfe/core/game/catbase/user_rank_rewards.py +276 -0
  53. bcsfe/core/game/gamoto/__init__.py +9 -0
  54. bcsfe/core/game/gamoto/base_materials.py +90 -0
  55. bcsfe/core/game/gamoto/cat_shrine.py +207 -0
  56. bcsfe/core/game/gamoto/catamins.py +59 -0
  57. bcsfe/core/game/gamoto/gamatoto.py +496 -0
  58. bcsfe/core/game/gamoto/ototo.py +660 -0
  59. bcsfe/core/game/localizable.py +31 -0
  60. bcsfe/core/game/map/__init__.py +41 -0
  61. bcsfe/core/game/map/aku.py +229 -0
  62. bcsfe/core/game/map/challenge.py +73 -0
  63. bcsfe/core/game/map/chapters.py +362 -0
  64. bcsfe/core/game/map/dojo.py +360 -0
  65. bcsfe/core/game/map/enigma.py +219 -0
  66. bcsfe/core/game/map/event.py +898 -0
  67. bcsfe/core/game/map/ex_stage.py +102 -0
  68. bcsfe/core/game/map/gauntlets.py +351 -0
  69. bcsfe/core/game/map/item_reward_stage.py +416 -0
  70. bcsfe/core/game/map/legend_quest.py +381 -0
  71. bcsfe/core/game/map/map_names.py +100 -0
  72. bcsfe/core/game/map/map_reset.py +116 -0
  73. bcsfe/core/game/map/outbreaks.py +264 -0
  74. bcsfe/core/game/map/story.py +1166 -0
  75. bcsfe/core/game/map/timed_score.py +193 -0
  76. bcsfe/core/game/map/tower.py +68 -0
  77. bcsfe/core/game/map/uncanny.py +47 -0
  78. bcsfe/core/game/map/zero_legends.py +295 -0
  79. bcsfe/core/game_version.py +244 -0
  80. bcsfe/core/io/__init__.py +31 -0
  81. bcsfe/core/io/adb_handler.py +181 -0
  82. bcsfe/core/io/bc_csv.py +263 -0
  83. bcsfe/core/io/command.py +50 -0
  84. bcsfe/core/io/config.py +449 -0
  85. bcsfe/core/io/data.py +647 -0
  86. bcsfe/core/io/git_handler.py +92 -0
  87. bcsfe/core/io/json_file.py +45 -0
  88. bcsfe/core/io/path.py +269 -0
  89. bcsfe/core/io/root_handler.py +105 -0
  90. bcsfe/core/io/save.py +3730 -0
  91. bcsfe/core/io/thread_helper.py +76 -0
  92. bcsfe/core/io/waydroid.py +120 -0
  93. bcsfe/core/io/yaml.py +61 -0
  94. bcsfe/core/locale_handler.py +713 -0
  95. bcsfe/core/log.py +133 -0
  96. bcsfe/core/max_value_helper.py +35 -0
  97. bcsfe/core/server/__init__.py +21 -0
  98. bcsfe/core/server/client_info.py +34 -0
  99. bcsfe/core/server/event_data.py +377 -0
  100. bcsfe/core/server/game_data_getter.py +217 -0
  101. bcsfe/core/server/headers.py +29 -0
  102. bcsfe/core/server/managed_item.py +203 -0
  103. bcsfe/core/server/request.py +64 -0
  104. bcsfe/core/server/server_handler.py +668 -0
  105. bcsfe/core/server/updater.py +86 -0
  106. bcsfe/core/theme_handler.py +308 -0
  107. bcsfe/files/locales/en/core/config.properties +94 -0
  108. bcsfe/files/locales/en/core/files.properties +9 -0
  109. bcsfe/files/locales/en/core/input.properties +29 -0
  110. bcsfe/files/locales/en/core/locale.properties +33 -0
  111. bcsfe/files/locales/en/core/main.properties +108 -0
  112. bcsfe/files/locales/en/core/save.properties +97 -0
  113. bcsfe/files/locales/en/core/server.properties +47 -0
  114. bcsfe/files/locales/en/core/theme.properties +24 -0
  115. bcsfe/files/locales/en/core/updater.properties +19 -0
  116. bcsfe/files/locales/en/edits/bannable_items.properties +30 -0
  117. bcsfe/files/locales/en/edits/cats.properties +118 -0
  118. bcsfe/files/locales/en/edits/enemy.properties +17 -0
  119. bcsfe/files/locales/en/edits/fixes.properties +13 -0
  120. bcsfe/files/locales/en/edits/gamototo.properties +54 -0
  121. bcsfe/files/locales/en/edits/gatya.properties +5 -0
  122. bcsfe/files/locales/en/edits/gold_pass.properties +6 -0
  123. bcsfe/files/locales/en/edits/items.properties +52 -0
  124. bcsfe/files/locales/en/edits/map.properties +122 -0
  125. bcsfe/files/locales/en/edits/medals.properties +8 -0
  126. bcsfe/files/locales/en/edits/missions.properties +7 -0
  127. bcsfe/files/locales/en/edits/playtime.properties +7 -0
  128. bcsfe/files/locales/en/edits/scheme_items.properties +6 -0
  129. bcsfe/files/locales/en/edits/special_skills.properties +10 -0
  130. bcsfe/files/locales/en/edits/talent_orbs.properties +26 -0
  131. bcsfe/files/locales/en/edits/treasures.properties +24 -0
  132. bcsfe/files/locales/en/edits/user_rank.properties +9 -0
  133. bcsfe/files/locales/vi/core/config.properties +84 -0
  134. bcsfe/files/locales/vi/core/files.properties +9 -0
  135. bcsfe/files/locales/vi/core/input.properties +28 -0
  136. bcsfe/files/locales/vi/core/locale.properties +29 -0
  137. bcsfe/files/locales/vi/core/main.properties +108 -0
  138. bcsfe/files/locales/vi/core/save.properties +99 -0
  139. bcsfe/files/locales/vi/core/server.properties +67 -0
  140. bcsfe/files/locales/vi/core/theme.properties +23 -0
  141. bcsfe/files/locales/vi/core/updater.properties +21 -0
  142. bcsfe/files/locales/vi/edits/bannable_items.properties +30 -0
  143. bcsfe/files/locales/vi/edits/cats.properties +125 -0
  144. bcsfe/files/locales/vi/edits/enemy.properties +17 -0
  145. bcsfe/files/locales/vi/edits/fixes.properties +13 -0
  146. bcsfe/files/locales/vi/edits/gamototo.properties +54 -0
  147. bcsfe/files/locales/vi/edits/gatya.properties +4 -0
  148. bcsfe/files/locales/vi/edits/gold_pass.properties +6 -0
  149. bcsfe/files/locales/vi/edits/items.properties +51 -0
  150. bcsfe/files/locales/vi/edits/map.properties +118 -0
  151. bcsfe/files/locales/vi/edits/medals.properties +8 -0
  152. bcsfe/files/locales/vi/edits/missions.properties +7 -0
  153. bcsfe/files/locales/vi/edits/playtime.properties +7 -0
  154. bcsfe/files/locales/vi/edits/scheme_items.properties +6 -0
  155. bcsfe/files/locales/vi/edits/special_skills.properties +10 -0
  156. bcsfe/files/locales/vi/edits/talent_orbs.properties +25 -0
  157. bcsfe/files/locales/vi/edits/treasures.properties +24 -0
  158. bcsfe/files/locales/vi/edits/user_rank.properties +9 -0
  159. bcsfe/files/locales/vi/metadata.json +4 -0
  160. bcsfe/files/max_values.json +26 -0
  161. bcsfe/files/themes/default.json +16 -0
  162. bcsfe/py.typed +0 -0
  163. bcsfe-3.0.0.dist-info/METADATA +393 -0
  164. bcsfe-3.0.0.dist-info/RECORD +168 -0
  165. bcsfe-3.0.0.dist-info/WHEEL +5 -0
  166. bcsfe-3.0.0.dist-info/entry_points.txt +2 -0
  167. bcsfe-3.0.0.dist-info/licenses/LICENSE +675 -0
  168. bcsfe-3.0.0.dist-info/top_level.txt +1 -0
bcsfe/__init__.py ADDED
@@ -0,0 +1,12 @@
1
+ __version__ = "3.0.0"
2
+
3
+ from bcsfe import core, cli
4
+
5
+
6
+ __all__ = ["core", "cli"]
7
+
8
+
9
+ def run():
10
+ from bcsfe import __main__
11
+
12
+ __main__.main()
bcsfe/__main__.py ADDED
@@ -0,0 +1,64 @@
1
+ from __future__ import annotations
2
+ import traceback
3
+
4
+ from bcsfe import cli
5
+
6
+ from bcsfe import core
7
+
8
+ import bcsfe
9
+ import argparse
10
+
11
+
12
+ def main():
13
+ parser = argparse.ArgumentParser("bcsfe")
14
+
15
+ parser.add_argument(
16
+ "--version", "-v", action="store_true", help="display the version and exit"
17
+ )
18
+ parser.add_argument(
19
+ "--input-path", "-i", type=str, help="input path to save file to edit"
20
+ )
21
+ parser.add_argument(
22
+ "--config-path",
23
+ "-c",
24
+ type=str,
25
+ default=None,
26
+ help="path to the config file. If unspecified defaults to Documents/bcsfe/config.yaml",
27
+ )
28
+ parser.add_argument(
29
+ "--log-path",
30
+ "-l",
31
+ type=str,
32
+ default=None,
33
+ help="path to the log file. If unspecified defaults to Documents/bcsfe/bcsfe.log",
34
+ )
35
+
36
+ args = parser.parse_args()
37
+ if args.version:
38
+ print(bcsfe.__version__)
39
+ exit()
40
+
41
+ if args.config_path is not None:
42
+ core.set_config_path(core.Path(args.config_path))
43
+
44
+ if args.log_path is not None:
45
+ core.set_log_path(core.Path(args.log_path))
46
+
47
+ core.core_data.init_data()
48
+
49
+ try:
50
+ cli.main.Main().main(args.input_path)
51
+ except KeyboardInterrupt:
52
+ cli.main.Main.leave()
53
+ except Exception as e:
54
+ tb = traceback.format_exc()
55
+ cli.color.ColoredText.localize("error", error=e, traceback=tb)
56
+ try:
57
+ cli.main.Main.exit_editor()
58
+ except Exception:
59
+ pass
60
+ except KeyboardInterrupt:
61
+ pass
62
+
63
+
64
+ main()
bcsfe/cli/__init__.py ADDED
@@ -0,0 +1,21 @@
1
+ from bcsfe.cli import (
2
+ color,
3
+ dialog_creator,
4
+ main,
5
+ file_dialog,
6
+ feature_handler,
7
+ save_management,
8
+ server_cli,
9
+ edits,
10
+ )
11
+
12
+ __all__ = [
13
+ "color",
14
+ "dialog_creator",
15
+ "main",
16
+ "file_dialog",
17
+ "feature_handler",
18
+ "save_management",
19
+ "server_cli",
20
+ "edits",
21
+ ]
bcsfe/cli/color.py ADDED
@@ -0,0 +1,189 @@
1
+ from __future__ import annotations
2
+ from typing import Any
3
+ from aenum import NamedConstant # type: ignore
4
+ import colored # type: ignore
5
+ from bcsfe import core
6
+
7
+
8
+ class ColorHex(NamedConstant):
9
+ GREEN = "#008000"
10
+ G = GREEN
11
+ RED = "#FF0000"
12
+ R = RED
13
+ DARK_YELLOW = "#D7C32A"
14
+ DY = DARK_YELLOW
15
+ BLACK = "#000000"
16
+ BL = BLACK
17
+ WHITE = "#FFFFFF"
18
+ W = WHITE
19
+ CYAN = "#00FFFF"
20
+ C = CYAN
21
+ DARK_GREY = "#A9A9A9"
22
+ DG = DARK_GREY
23
+ BLUE = "#0000FF"
24
+ B = BLUE
25
+ YELLOW = "#FFFF00"
26
+ Y = YELLOW
27
+ MAGENTA = "#FF00FF"
28
+ M = MAGENTA
29
+ DARK_BLUE = "#00008B"
30
+ DB = DARK_BLUE
31
+ DARK_CYAN = "#008B8B"
32
+ DC = DARK_CYAN
33
+ DARK_MAGENTA = "#8B008B"
34
+ DM = DARK_MAGENTA
35
+ DARK_RED = "#8B0000"
36
+ DR = DARK_RED
37
+ DARK_GREEN = "#006400"
38
+ DGN = DARK_GREEN
39
+ LIGHT_GREY = "#D3D3D3"
40
+ LG = LIGHT_GREY
41
+ ORANGE = "#FFA500"
42
+ O = ORANGE
43
+
44
+ @staticmethod
45
+ def from_name(name: str) -> str:
46
+ if name == "":
47
+ return ""
48
+ return getattr(ColorHex, name.upper())
49
+
50
+
51
+ class ColorHelper:
52
+ def __init__(self):
53
+ self.theme_handler = core.core_data.theme_manager
54
+
55
+ def get_color(self, color_name: str) -> str:
56
+ try:
57
+ first_char = color_name[0]
58
+ except IndexError:
59
+ return ""
60
+ if first_char == "#":
61
+ return color_name
62
+ if first_char == "@":
63
+ try:
64
+ second_char = color_name[1]
65
+ except IndexError:
66
+ return ""
67
+ try:
68
+ third_char = color_name[2]
69
+ except IndexError:
70
+ third_char = ""
71
+ if second_char == "p":
72
+ return self.theme_handler.get_primary_color()
73
+ if second_char == "s" and third_char != "u":
74
+ return self.theme_handler.get_secondary_color()
75
+ if second_char == "t":
76
+ return self.theme_handler.get_tertiary_color()
77
+ if second_char == "q":
78
+ return self.theme_handler.get_quaternary_color()
79
+ if second_char == "e":
80
+ return self.theme_handler.get_error_color()
81
+ if second_char == "w":
82
+ return self.theme_handler.get_warning_color()
83
+ if second_char == "s" and third_char == "u":
84
+ return self.theme_handler.get_success_color()
85
+ return self.theme_handler.get_theme_color(color_name[1:])
86
+ try:
87
+ return ColorHex.from_name(color_name)
88
+ except AttributeError:
89
+ return ""
90
+
91
+
92
+ class ColoredText:
93
+ def __init__(self, string: str, end: str = "\n") -> None:
94
+ string = string.replace("\\n", "\n")
95
+ self.string = string
96
+ self.end = end
97
+ self.color_helper = ColorHelper()
98
+ self.display(string)
99
+
100
+ def display(self, string: str) -> None:
101
+ text_data = self.parse(string)
102
+ for i, (text, color) in enumerate(text_data):
103
+ if i == len(text_data) - 1:
104
+ text += self.end
105
+ if color == "":
106
+ print(text, end="")
107
+ else:
108
+ try:
109
+ fg = colored.fg(color) # type: ignore
110
+ except Exception:
111
+ print(text, end="")
112
+ continue
113
+ print(colored.stylize(text, fg), end="") # type: ignore
114
+
115
+ @staticmethod
116
+ def localize(
117
+ string: str, escape: bool = True, **kwargs: Any
118
+ ) -> ColoredText:
119
+ return ColoredText(
120
+ core.core_data.local_manager.get_key(
121
+ string, escape=escape, **kwargs
122
+ )
123
+ )
124
+
125
+ def parse(self, txt: str) -> list[tuple[str, str]]:
126
+ txt = "<@p>" + txt + "</>"
127
+ output: list[tuple[str, str]] = []
128
+ i = 0
129
+ tags: list[str] = []
130
+ inside_tag = False
131
+ in_closing_tag = False
132
+ tag_text = ""
133
+ text = ""
134
+ special_chars = core.LocalManager.get_special_chars()
135
+ while i < len(txt):
136
+ char = txt[i]
137
+ if (
138
+ char == "\\"
139
+ and i + 1 < len(txt)
140
+ and txt[i + 1] in special_chars
141
+ ):
142
+ i += 1
143
+ char = txt[i]
144
+ text += char
145
+ i += 1
146
+ continue
147
+ if tags:
148
+ tag = tags[-1]
149
+ else:
150
+ tag = ""
151
+ if char == ">" and inside_tag:
152
+ inside_tag = False
153
+ if not in_closing_tag:
154
+ tags.append(tag_text)
155
+ if in_closing_tag:
156
+ in_closing_tag = False
157
+ tag_text = ""
158
+ if char == "<" and not inside_tag:
159
+ inside_tag = True
160
+ if text:
161
+ color = self.color_helper.get_color(tag)
162
+ output.append((text, color))
163
+ text = ""
164
+ tag_text = ""
165
+ if char == "/" and inside_tag:
166
+ in_closing_tag = True
167
+ if tags:
168
+ tags.pop()
169
+ if not inside_tag and char != ">" and char != "<":
170
+ text += char
171
+ if inside_tag and char != "<" and char != ">":
172
+ tag_text += char
173
+ i += 1
174
+ return output
175
+
176
+
177
+ class ColoredInput:
178
+ def __init__(self, end: str = "") -> None:
179
+ self.end = end
180
+
181
+ def get(self, display_string: str) -> str:
182
+ ColoredText(display_string, end=self.end)
183
+ return input()
184
+
185
+ def localize(self, string: str, escape: bool = True, **kwargs: Any) -> str:
186
+ text = core.core_data.local_manager.get_key(
187
+ string, escape=escape, **kwargs
188
+ )
189
+ return self.get(text)