Skip to content

Commit da9a545

Browse files
authored
Merge pull request #1446 from runhey/dev
Automated PR 2026.02.26
2 parents 99d0a14 + 340f742 commit da9a545

66 files changed

Lines changed: 57 additions & 627 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/i18n/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"costume_carpbanner_type": "鲤鱼旗皮肤",
1111
"costume_carpbanner_default": "吉鲤游风",
1212
"costume_carpbanner_1": "无垢莲台",
13+
"costume_carpbanner_2": "萤灯月夜",
1314
"costume_carpbanner_type_help": "多数结界通用",
1415
"costume_battle_10": "流焰蝶舞",
1516
"costume_battle_11": "辰烁奇夜",

tasks/Component/Costume/config.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This Python file uses the following encoding: utf-8
22
# @author runhey
33
# github https://github.com/runhey
4-
from pydantic import BaseModel, Field
4+
from pydantic import BaseModel, Field, field_validator
55
from enum import Enum
66

77
# 庭院皮肤
@@ -24,16 +24,12 @@ class MainType(str, Enum):
2424
# 结界皮肤
2525
class RealmType(str, Enum):
2626
COSTUME_REALM_DEFAULT = 'costume_realm_default' # 妖扇结界
27-
COSTUME_REALM_1 = 'costume_realm_1' # 鬼灵咒符
28-
COSTUME_REALM_2 = 'costume_realm_2' # 狐梦之乡
29-
COSTUME_REALM_3 = 'costume_realm_3' # 编心织忆
30-
COSTUME_REALM_4 = 'costume_realm_4' # 花海繁生
31-
COSTUME_REALM_5 = 'costume_realm_5' # 莲心梦乡
3227

3328
# 鲤鱼旗皮肤
3429
class CarpBannerType(str, Enum):
3530
COSTUME_CARPBANNER_DEFAULT = 'costume_carpbanner_default' # 吉鲤游风
36-
COSTUME_CARPBANNER_1 = 'costume_carpbanner_1' # 无垢莲台(仅适配莲心梦乡)
31+
COSTUME_CARPBANNER_1 = 'costume_carpbanner_1' # 无垢莲台
32+
COSTUME_CARPBANNER_2 = 'costume_carpbanner_2' # 萤灯月夜
3733

3834
# 主题,就是庭院最右下角的展开按钮
3935
class ThemeType(str, Enum):
@@ -81,6 +77,14 @@ class CostumeConfig(BaseModel):
8177
costume_sign_type: SignType = Field(default=SignType.COSTUME_SIGN_DEFAULT, description='costume_sign_type_help')
8278
costume_battle_type: BattleType = Field(default=BattleType.COSTUME_BATTLE_DEFAULT, description='costume_battle_type_help')
8379

80+
@field_validator('costume_realm_type', mode='after')
81+
@classmethod
82+
def validator_realm(cls, v: RealmType) -> RealmType:
83+
return RealmType.COSTUME_REALM_DEFAULT
84+
85+
86+
87+
8488

8589

8690

tasks/Component/Costume/costume_base.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from tasks.Component.Costume.config import (MainType, CostumeConfig, RealmType,
99
ThemeType, ShikigamiType, SignType, BattleType, CarpBannerType)
1010
from tasks.Component.Costume.assets import CostumeAssets
11-
from tasks.Component.CostumeRealm.assets import CostumeRealmAssets
1211
from tasks.Component.CostumeBattle.assets import CostumeBattleAssets
1312
from tasks.Component.CostumeShikigami.assets import CostumeShikigamiAssets
1413
from tasks.Component.CostumeCarpBanner.assets import CostumeCarpBannerAssets
@@ -26,29 +25,13 @@
2625
}
2726

2827

29-
# 结界皮肤
30-
realm_costume_model = {
31-
getattr(RealmType, f"COSTUME_REALM_{i}"): {
32-
'I_SHI_CARD': f'I_SHI_CARD_{i}',
33-
'I_SHI_DEFENSE': f'I_SHI_DEFENSE_{i}',
34-
'I_SHI_GROWN': f'I_SHI_GROWN_{i}',
35-
'I_CARD_EXP': f'I_CARD_EXP_{i}',
36-
'I_BOX_AP': f'I_BOX_AP_{i}',
37-
'I_BOX_EXP': f'I_BOX_EXP_{i}',
38-
'I_REALM_SHIN': f'I_REALM_SHIN_{i}',
39-
'I_UTILIZE_EXP': f'I_UTILIZE_EXP_{i}',
40-
'I_BOX_EXP_MAX': f'I_BOX_EXP_MAX_{i}',
41-
} for i in range(1, 6)
42-
}
43-
44-
4528
# 鲤鱼旗皮肤
4629
carpbanner_costume_model = {
4730
getattr(CarpBannerType, f"COSTUME_CARPBANNER_{i}"): {
4831
'I_SHI_CARD': f'I_SHI_CARD_{i}',
4932
'I_SHI_DEFENSE': f'I_SHI_DEFENSE_{i}',
5033
'I_SHI_GROWN': f'I_SHI_GROWN_{i}',
51-
} for i in range(1, 2)
34+
} for i in range(1, 3)
5235
}
5336

5437

@@ -96,7 +79,6 @@ def check_costume(self, config: CostumeConfig=None):
9679
if config is None:
9780
config: CostumeConfig = self.config.model.global_game.costume_config
9881
self.check_costume_main(config.costume_main_type)
99-
self.check_costume_realm(config.costume_realm_type)
10082
self.check_costume_carpbanner(config.costume_carpbanner_type)
10183
self.check_costume_battle(config.costume_battle_type)
10284
self.check_costume_shikigami(config.costume_shikigami_type)
@@ -138,19 +120,6 @@ def check_costume_carpbanner(self, carpbanner_type: CarpBannerType):
138120
# 执行替换(覆盖结界皮肤的同名key)
139121
self.replace_img(key, assert_value)
140122

141-
def check_costume_realm(self, realm_type: RealmType):
142-
if realm_type == RealmType.COSTUME_REALM_DEFAULT:
143-
return
144-
logger.info(f'Switch realm theme {realm_type}')
145-
costume_realm_assets = CostumeRealmAssets()
146-
model = realm_costume_model.get(realm_type, {})
147-
for key, value in model.items():
148-
if not hasattr(costume_realm_assets, value):
149-
logger.warning(f'Realm asset {value} not found, skip')
150-
continue
151-
assert_value: RuleImage = getattr(costume_realm_assets, value)
152-
self.replace_img(key, assert_value)
153-
154123
def check_costume_battle(self, battle_type: BattleType):
155124
if battle_type == BattleType.COSTUME_BATTLE_DEFAULT:
156125
return

tasks/Component/CostumeCarpBanner/assets.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ class CostumeCarpBannerAssets:
1919
I_SHI_DEFENSE_1 = RuleImage(roi_front=(216,258,22,33), roi_back=(178,209,261,274), threshold=0.6, method="Template matching", file="./tasks/Component/CostumeCarpBanner/cb1/cb1_shi_defense_1.png")
2020

2121

22+
# Image Rule Assets
23+
# 育成
24+
I_SHI_GROWN_2 = RuleImage(roi_front=(585,336,21,38), roi_back=(519,212,220,281), threshold=0.5, method="Template matching", file="./tasks/Component/CostumeCarpBanner/cb2/cb2_shi_grown_2.png")
25+
# 结界卡
26+
I_SHI_CARD_2 = RuleImage(roi_front=(871,341,20,36), roi_back=(823,210,252,297), threshold=0.5, method="Template matching", file="./tasks/Component/CostumeCarpBanner/cb2/cb2_shi_card_2.png")
27+
# 防守
28+
I_SHI_DEFENSE_2 = RuleImage(roi_front=(287,343,19,38), roi_back=(178,209,261,274), threshold=0.5, method="Template matching", file="./tasks/Component/CostumeCarpBanner/cb2/cb2_shi_defense_2.png")
29+
30+
1.89 KB
Loading
1.89 KB
Loading
1.99 KB
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[
2+
{
3+
"itemName": "shi_grown_2",
4+
"imageName": "cb2_shi_grown_2.png",
5+
"roiFront": "585,336,21,38",
6+
"roiBack": "519,212,220,281",
7+
"method": "Template matching",
8+
"threshold": 0.5,
9+
"description": "育成"
10+
},
11+
{
12+
"itemName": "shi_card_2",
13+
"imageName": "cb2_shi_card_2.png",
14+
"roiFront": "871,341,20,36",
15+
"roiBack": "823,210,252,297",
16+
"method": "Template matching",
17+
"threshold": 0.5,
18+
"description": "结界卡"
19+
},
20+
{
21+
"itemName": "shi_defense_2",
22+
"imageName": "cb2_shi_defense_2.png",
23+
"roiFront": "287,343,19,38",
24+
"roiBack": "178,209,261,274",
25+
"method": "Template matching",
26+
"threshold": 0.5,
27+
"description": "防守"
28+
}
29+
]

tasks/Component/CostumeRealm/README.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

tasks/Component/CostumeRealm/assets.py

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)