bcsfe-wrapper-python 0.1.8__py3-none-any.whl → 0.1.10__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
@@ -24,21 +24,17 @@ class BCSFEWrapper:
24
24
  core.set_config_path(data_folder.add("config.yaml"))
25
25
  core.set_log_path(data_folder.add("log.txt"))
26
26
  core.core_data.init_data()
27
-
28
27
  core.core_data.config.set(core.ConfigKey.STRICT_UPGRADE, False)
29
28
  core.core_data.config.set(core.ConfigKey.UPDATE_TO_BETAS, False)
30
29
  core.print_config_err = False
31
30
 
32
31
  @classmethod
33
32
  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)
35
- country_code = core.CountryCode.from_code(cc)
36
- game_version = core.GameVersion.from_string(gv)
33
+ dummy = cls(b"", cc=cc, gv=gv)
37
34
  server_handler, result = core.ServerHandler.from_codes(
38
- transfer_code, confirmation_code, country_code, game_version, print=False
35
+ transfer_code, confirmation_code, core.CountryCode.from_code(cc), core.GameVersion.from_string(gv), print=False
39
36
  )
40
- if server_handler is None:
41
- raise RuntimeError(f"Download failed. Check your codes or internet connection.")
37
+ if server_handler is None: raise RuntimeError("Download failed.")
42
38
  return cls(server_handler.save_file.to_data().get_bytes(), cc=cc, gv=gv)
43
39
 
44
40
  def save(self, output_path: Optional[str] = None):
@@ -49,13 +45,9 @@ class BCSFEWrapper:
49
45
  def upload_to_server(self) -> Tuple[Optional[str], Optional[str]]:
50
46
  handler = core.ServerHandler(self.save_file, print=False)
51
47
  codes = handler.get_codes()
52
- if codes:
53
- return codes
54
- return None, None
55
-
56
- def _set_val(self, attr: str, amount: int):
57
- setattr(self.save_file, attr, amount)
48
+ return codes if codes else (None, None)
58
49
 
50
+ def _set_val(self, attr: str, amount: int): setattr(self.save_file, attr, amount)
59
51
  def edit_catfood(self, amount: int): self._set_val("catfood", amount)
60
52
  def edit_xp(self, amount: int): self._set_val("xp", amount)
61
53
  def edit_normal_tickets(self, amount: int): self._set_val("normal_tickets", amount)
@@ -76,51 +68,65 @@ class BCSFEWrapper:
76
68
  for cid in cat_ids:
77
69
  cat = self.save_file.cats.get_cat_by_id(cid)
78
70
  if cat: cat.unlock(self.save_file)
79
-
80
71
  def unlock_all_cats(self):
81
72
  for cat in self.save_file.cats.cats: cat.unlock(self.save_file)
82
-
83
73
  def upgrade_cats(self, cat_ids: List[int], base: int = 19, plus: int = 0):
84
74
  for cid in cat_ids:
85
75
  cat = self.save_file.cats.get_cat_by_id(cid)
86
- if cat:
87
- cat.upgrade.base = base
88
- cat.upgrade.plus = plus
89
-
76
+ if cat: cat.upgrade.base, cat.upgrade.plus = base, plus
90
77
  def upgrade_all_cats(self, base: Optional[int] = None, plus: Optional[int] = None):
91
78
  for cat in self.save_file.cats.cats:
92
79
  if not cat.is_unlocked(self.save_file): continue
93
80
  power_up = core.PowerUpHelper(cat, self.save_file)
94
81
  cat.upgrade.base = (base if base is not None else power_up.get_max_possible_base()) - 1
95
82
  cat.upgrade.plus = plus if plus is not None else power_up.get_max_possible_plus()
96
-
97
83
  def set_cat_form(self, cat_ids: List[int], form: int = 2):
98
84
  for cid in cat_ids:
99
85
  cat = self.save_file.cats.get_cat_by_id(cid)
100
86
  if cat: cat.set_form(form)
101
-
102
87
  def true_form_all_cats(self):
103
88
  cats = self.save_file.cats.get_unlocked_cats()
104
89
  self.save_file.cats.true_form_cats(self.save_file, cats, True, True)
105
90
  self.save_file.cats.fourth_form_cats(self.save_file, cats, True, True)
106
91
 
107
92
  def clear_tutorial(self): edits.clear_tutorial.clear_tutorial(self.save_file, False)
108
- def clear_story_chapters(self, chapters: List[int] = [0, 1, 2]):
109
- for c_id in chapters:
110
- if c_id < len(self.save_file.story.chapters):
111
- chapter = self.save_file.story.chapters[c_id]
93
+
94
+ def _clear_chapter_group(self, chapters_obj, chapters_to_clear: List[int]):
95
+ for c_id in chapters_to_clear:
96
+ if c_id < len(chapters_obj.chapters):
97
+ chapter = chapters_obj.chapters[c_id]
112
98
  chapter.clear_all(self.save_file)
113
99
  for stage in chapter.stages: stage.treasure = 3
114
100
 
115
- # 魔界編の解放
116
- def unlock_aku_realm(self):
117
- edits.aku_realm.unlock_aku_realm(self.save_file)
118
-
119
- def edit_gamatoto_xp(self, xp: int): self.save_file.gamatoto.xp = xp
120
- def edit_ototo_engineers(self, amount: int): self.save_file.ototo.engineers = amount
121
- def unban(self):
122
- self.save_file.show_ban_message = False
123
- self.save_file.banned = False
101
+ def clear_empire_of_cats(self, chapters: List[int] = [0, 1, 2]):
102
+ self._clear_chapter_group(self.save_file.story.chapters, chapters)
103
+ def clear_into_the_future(self, chapters: List[int] = [0, 1, 2]):
104
+ self._clear_chapter_group(self.save_file.story.chapters, [c + 3 for c in chapters])
105
+ def clear_cats_of_the_cosmos(self, chapters: List[int] = [0, 1, 2]):
106
+ self._clear_chapter_group(self.save_file.story.chapters, [c + 6 for c in chapters])
107
+
108
+ def _clear_legend_group(self, legend_obj, max_star: int = 1):
109
+ for map_id in range(len(legend_obj.chapters)):
110
+ for star in range(min(max_star, legend_obj.get_total_stars(map_id))):
111
+ for stage_id in range(legend_obj.get_total_stages(map_id, star)):
112
+ legend_obj.clear_stage(map_id, star, stage_id, overwrite_clear_progress=True)
113
+
114
+ def clear_legend_stories(self, max_star: int = 1): self._clear_legend_group(self.save_file.legend_stories, max_star)
115
+ def clear_true_legends(self, max_star: int = 1): self._clear_legend_group(self.save_file.uncanny_legends, max_star)
116
+ def clear_zero_legends(self, max_star: int = 1): self._clear_legend_group(self.save_file.zero_legends, max_star)
117
+
118
+ # ゾンビ襲来クリア機能
119
+ def clear_zombie_outbreaks(self, chapters: List[int] = [0, 1, 2, 3, 4, 5, 6, 7, 8]):
120
+ """
121
+ 指定した章のゾンビ襲来をすべてクリアします。
122
+ 0-2: 日本編, 3-5: 未来編, 6-8: 宇宙編
123
+ """
124
+ for chapter_id in chapters:
125
+ for stage_id in range(48): # 各章48ステージ
126
+ self.save_file.outbreaks.clear_outbreak(chapter_id, stage_id, True)
127
+
128
+ def unlock_aku_realm(self): edits.aku_realm.unlock_aku_realm(self.save_file)
129
+ def unban(self): self.save_file.show_ban_message = self.save_file.banned = False
124
130
  def get_inquiry_code(self) -> str: return self.save_file.inquiry_code
125
131
  def edit_inquiry_code(self, new_code: str): self.save_file.inquiry_code = new_code
126
132
  def get_save_file(self) -> core.SaveFile: return self.save_file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcsfe-wrapper-python
3
- Version: 0.1.8
3
+ Version: 0.1.10
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=S2h-jzE4bnQldJt6pDTQc1jyrF8f0_JMzGVQoHw8u4E,5941
2
+ bcsfe_wrapper/wrapper.py,sha256=pz_PBS05feXPvNiLzgMo4FeDv9azN0Yie5VwOOY-Ww0,7204
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.8.dist-info/METADATA,sha256=wVEXszrvVmqtcrjIXF7rTIh_m4PkavikXnJC8y0QTBU,4326
202
- bcsfe_wrapper_python-0.1.8.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
203
- bcsfe_wrapper_python-0.1.8.dist-info/top_level.txt,sha256=kqyMKpAdNg39_kGGtqsxOSLPIb-qx7R1mQj1hReUsYM,14
204
- bcsfe_wrapper_python-0.1.8.dist-info/RECORD,,
201
+ bcsfe_wrapper_python-0.1.10.dist-info/METADATA,sha256=9zw8961i0yoLagmaGhnYjFihwTYRquiBx4wm64roKcs,4327
202
+ bcsfe_wrapper_python-0.1.10.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
203
+ bcsfe_wrapper_python-0.1.10.dist-info/top_level.txt,sha256=kqyMKpAdNg39_kGGtqsxOSLPIb-qx7R1mQj1hReUsYM,14
204
+ bcsfe_wrapper_python-0.1.10.dist-info/RECORD,,