bcsfe-wrapper-python 0.1.8__py3-none-any.whl → 0.1.9__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)
@@ -64,7 +56,6 @@ class BCSFEWrapper:
64
56
  def edit_legend_tickets(self, amount: int): self._set_val("legend_tickets", amount)
65
57
  def edit_np(self, amount: int): self._set_val("np", amount)
66
58
  def edit_leadership(self, amount: int): self._set_val("leadership", amount)
67
-
68
59
  def edit_battle_items(self, amount: int):
69
60
  for item in self.save_file.battle_items.items: item.amount = amount
70
61
  def edit_catseyes(self, amount: int):
@@ -76,51 +67,57 @@ class BCSFEWrapper:
76
67
  for cid in cat_ids:
77
68
  cat = self.save_file.cats.get_cat_by_id(cid)
78
69
  if cat: cat.unlock(self.save_file)
79
-
80
70
  def unlock_all_cats(self):
81
71
  for cat in self.save_file.cats.cats: cat.unlock(self.save_file)
82
-
83
72
  def upgrade_cats(self, cat_ids: List[int], base: int = 19, plus: int = 0):
84
73
  for cid in cat_ids:
85
74
  cat = self.save_file.cats.get_cat_by_id(cid)
86
- if cat:
87
- cat.upgrade.base = base
88
- cat.upgrade.plus = plus
89
-
75
+ if cat: cat.upgrade.base, cat.upgrade.plus = base, plus
90
76
  def upgrade_all_cats(self, base: Optional[int] = None, plus: Optional[int] = None):
91
77
  for cat in self.save_file.cats.cats:
92
78
  if not cat.is_unlocked(self.save_file): continue
93
79
  power_up = core.PowerUpHelper(cat, self.save_file)
94
80
  cat.upgrade.base = (base if base is not None else power_up.get_max_possible_base()) - 1
95
81
  cat.upgrade.plus = plus if plus is not None else power_up.get_max_possible_plus()
96
-
97
82
  def set_cat_form(self, cat_ids: List[int], form: int = 2):
98
83
  for cid in cat_ids:
99
84
  cat = self.save_file.cats.get_cat_by_id(cid)
100
85
  if cat: cat.set_form(form)
101
-
102
86
  def true_form_all_cats(self):
103
87
  cats = self.save_file.cats.get_unlocked_cats()
104
88
  self.save_file.cats.true_form_cats(self.save_file, cats, True, True)
105
89
  self.save_file.cats.fourth_form_cats(self.save_file, cats, True, True)
106
90
 
107
91
  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]
92
+
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
+ # 未来編のインデックス調整が必要な場合はここで
105
+ self._clear_chapter_group(self.save_file.story.chapters, [c + 3 for c in chapters])
106
+ def clear_cats_of_the_cosmos(self, chapters: List[int] = [0, 1, 2]):
107
+ self._clear_chapter_group(self.save_file.story.chapters, [c + 6 for c in chapters])
108
+
109
+ def _clear_legend_group(self, legend_obj, max_star: int = 1):
110
+ for map_id in range(len(legend_obj.chapters)):
111
+ for star in range(min(max_star, legend_obj.get_total_stars(map_id))):
112
+ for stage_id in range(legend_obj.get_total_stages(map_id, star)):
113
+ legend_obj.clear_stage(map_id, star, stage_id, overwrite_clear_progress=True)
114
+
115
+ def clear_legend_stories(self, max_star: int = 1): self._clear_legend_group(self.save_file.legend_stories, max_star)
116
+ def clear_true_legends(self, max_star: int = 1): self._clear_legend_group(self.save_file.uncanny_legends, max_star)
117
+ def clear_zero_legends(self, max_star: int = 1): self._clear_legend_group(self.save_file.zero_legends, max_star)
118
+
119
+ def unlock_aku_realm(self): edits.aku_realm.unlock_aku_realm(self.save_file)
120
+ def unban(self): self.save_file.show_ban_message = self.save_file.banned = False
124
121
  def get_inquiry_code(self) -> str: return self.save_file.inquiry_code
125
122
  def edit_inquiry_code(self, new_code: str): self.save_file.inquiry_code = new_code
126
123
  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.9
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=usME2jMjcVAuev78LzSHNolk2Y9BgOB5lwdhvEGPekY,6841
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.9.dist-info/METADATA,sha256=kOUN0Tx6siluQfpiriGHriVEExJ4rwnYJAhg3LNg5XM,4326
202
+ bcsfe_wrapper_python-0.1.9.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
203
+ bcsfe_wrapper_python-0.1.9.dist-info/top_level.txt,sha256=kqyMKpAdNg39_kGGtqsxOSLPIb-qx7R1mQj1hReUsYM,14
204
+ bcsfe_wrapper_python-0.1.9.dist-info/RECORD,,