bcsfe-wrapper-python 0.1.5__py3-none-any.whl → 0.1.7__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.
bcsfe_wrapper/wrapper.py CHANGED
@@ -7,14 +7,7 @@ from bcsfe.cli import edits
7
7
 
8
8
  class BCSFEWrapper:
9
9
  def __init__(self, save_path_or_data: Union[str, bytes], cc: str = "jp", gv: str = "13.1.0"):
10
- # パスの初期化
11
- data_folder = core.Path.get_data_folder()
12
- core.set_config_path(data_folder.add("config.yaml"))
13
- core.set_log_path(data_folder.add("log.txt"))
14
-
15
- # コアデータの初期化
16
- core.core_data.init_data()
17
-
10
+ self._init_core()
18
11
  self.cc = core.CountryCode.from_code(cc)
19
12
  self.gv = core.GameVersion.from_string(gv)
20
13
 
@@ -26,23 +19,26 @@ class BCSFEWrapper:
26
19
  self.save_file = core.SaveFile(core.Data(save_path_or_data), cc=self.cc, gv=self.gv)
27
20
  self.save_path = None
28
21
 
29
- @classmethod
30
- def from_server(cls, transfer_code: str, confirmation_code: str, cc: str = "jp", gv: str = "13.1.0") -> 'BCSFEWrapper':
31
- # サーバーからダウンロードする前に初期化が必要
22
+ def _init_core(self):
32
23
  data_folder = core.Path.get_data_folder()
33
24
  core.set_config_path(data_folder.add("config.yaml"))
25
+ core.set_log_path(data_folder.add("log.txt"))
34
26
  core.core_data.init_data()
35
27
 
28
+ core.core_data.config.set(core.ConfigKey.STRICT_UPGRADE, False)
29
+ core.core_data.config.set(core.ConfigKey.UPDATE_TO_BETAS, False)
30
+ core.print_config_err = False
31
+
32
+ @classmethod
33
+ def from_server(cls, transfer_code: str, confirmation_code: str, cc: str = "jp", gv: str = "13.1.0") -> 'BCSFEWrapper':
34
+ dummy_wrapper = cls(b"", cc=cc, gv=gv)
36
35
  country_code = core.CountryCode.from_code(cc)
37
36
  game_version = core.GameVersion.from_string(gv)
38
-
39
37
  server_handler, result = core.ServerHandler.from_codes(
40
38
  transfer_code, confirmation_code, country_code, game_version, print=False
41
39
  )
42
-
43
40
  if server_handler is None:
44
41
  raise RuntimeError(f"Download failed. Check your codes or internet connection.")
45
-
46
42
  return cls(server_handler.save_file.to_data().get_bytes(), cc=cc, gv=gv)
47
43
 
48
44
  def save(self, output_path: Optional[str] = None):
@@ -57,14 +53,19 @@ class BCSFEWrapper:
57
53
  return codes
58
54
  return None, None
59
55
 
60
- def edit_catfood(self, amount: int): self.save_file.catfood = amount
61
- def edit_xp(self, amount: int): self.save_file.xp = amount
62
- def edit_normal_tickets(self, amount: int): self.save_file.normal_tickets = amount
63
- def edit_rare_tickets(self, amount: int): self.save_file.rare_tickets = amount
64
- def edit_platinum_tickets(self, amount: int): self.save_file.platinum_tickets = amount
65
- def edit_legend_tickets(self, amount: int): self.save_file.legend_tickets = amount
66
- def edit_np(self, amount: int): self.save_file.np = amount
67
- def edit_leadership(self, amount: int): self.save_file.leadership = amount
56
+ # 制限を無視して設定するための内部メソッド
57
+ def _set_val(self, attr: str, amount: int):
58
+ setattr(self.save_file, attr, amount)
59
+
60
+ def edit_catfood(self, amount: int): self._set_val("catfood", amount)
61
+ def edit_xp(self, amount: int): self._set_val("xp", amount)
62
+ def edit_normal_tickets(self, amount: int): self._set_val("normal_tickets", amount)
63
+ def edit_rare_tickets(self, amount: int): self._set_val("rare_tickets", amount)
64
+ def edit_platinum_tickets(self, amount: int): self._set_val("platinum_tickets", amount)
65
+ def edit_legend_tickets(self, amount: int): self._set_val("legend_tickets", amount)
66
+ def edit_np(self, amount: int): self._set_val("np", amount)
67
+ def edit_leadership(self, amount: int): self._set_val("leadership", amount)
68
+
68
69
  def edit_battle_items(self, amount: int):
69
70
  for item in self.save_file.battle_items.items: item.amount = amount
70
71
  def edit_catseyes(self, amount: int):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcsfe-wrapper-python
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: A Python wrapper for BCSFE-Python to easily interact with Battle Cats save files.
5
5
  Home-page: https://github.com/fieryhenry/BCSFE-Python
6
6
  Author: Manus AI
@@ -1,5 +1,5 @@
1
1
  bcsfe_wrapper/__init__.py,sha256=o2LbyVJjuRV1gap8wDbsv39kEUJM1rt8Lq49u1RYYXA,268
2
- bcsfe_wrapper/wrapper.py,sha256=Gnpe0vSei-LGaethtL8SkcCnww_iXYSomsFCeAgWmJk,5774
2
+ bcsfe_wrapper/wrapper.py,sha256=Fl2XhILwH_BhMizDvsWbNiRA-G2meycZjU0IKdIFG84,5893
3
3
  bcsfe_wrapper/bcsfe/__init__.py,sha256=vCHjSoJq5u684HLQXahhtA64MZWffNHFdhweP7RM0f4,144
4
4
  bcsfe_wrapper/bcsfe/__main__.py,sha256=Dam14Fv6L-tRRufIkIRpr69dM0b2ybU1eALJxIw_eFI,2091
5
5
  bcsfe_wrapper/bcsfe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -198,7 +198,7 @@ bcsfe_wrapper/bcsfe/files/locales/vi/edits/treasures.properties,sha256=U9uKsF4y0
198
198
  bcsfe_wrapper/bcsfe/files/locales/vi/edits/user_rank.properties,sha256=FcldhzKM0UmuhmGzI3dGzxstuKcw-t-gkbmKLZT4VKg,603
199
199
  bcsfe_wrapper/bcsfe/files/themes/default.json,sha256=w8eqqd9ATIFwUcvOWTdJjyd1T3LGgUm3iVkJhT5wfEo,392
200
200
  bcsfe_wrapper/bcsfe/files/themes/discord.json,sha256=W1dtEev6tap_waHOxvSqENDcMRA9jfBvjW7t-ssdGs4,370
201
- bcsfe_wrapper_python-0.1.5.dist-info/METADATA,sha256=h4sQqByl11oBi84-NzUdouvWbhOUQUEatKWUxdoeKjk,4326
202
- bcsfe_wrapper_python-0.1.5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
203
- bcsfe_wrapper_python-0.1.5.dist-info/top_level.txt,sha256=kqyMKpAdNg39_kGGtqsxOSLPIb-qx7R1mQj1hReUsYM,14
204
- bcsfe_wrapper_python-0.1.5.dist-info/RECORD,,
201
+ bcsfe_wrapper_python-0.1.7.dist-info/METADATA,sha256=a5eGItff14vKwhtrv88JRfjLGt_rHOre2d3X6jRF6n0,4326
202
+ bcsfe_wrapper_python-0.1.7.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
203
+ bcsfe_wrapper_python-0.1.7.dist-info/top_level.txt,sha256=kqyMKpAdNg39_kGGtqsxOSLPIb-qx7R1mQj1hReUsYM,14
204
+ bcsfe_wrapper_python-0.1.7.dist-info/RECORD,,