mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Fix: Get obtain with Trailblaze_EXP drops
This commit is contained in:
parent
4a5508859e
commit
ca18869f2f
BIN
assets/share/combat/obtain/OBTAIN_4.png
Normal file
BIN
assets/share/combat/obtain/OBTAIN_4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
assets/share/combat/obtain/OBTAIN_TRAILBLAZE_EXP.SEARCH.png
Normal file
BIN
assets/share/combat/obtain/OBTAIN_TRAILBLAZE_EXP.SEARCH.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
assets/share/combat/obtain/OBTAIN_TRAILBLAZE_EXP.png
Normal file
BIN
assets/share/combat/obtain/OBTAIN_TRAILBLAZE_EXP.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
@ -71,8 +71,8 @@ class GenerateItemBase(GenerateKeyword):
|
|||||||
|
|
||||||
class GenerateItemCurrency(GenerateItemBase):
|
class GenerateItemCurrency(GenerateItemBase):
|
||||||
output_file = './tasks/planner/keywords/item_currency.py'
|
output_file = './tasks/planner/keywords/item_currency.py'
|
||||||
# Leave 'Credit' only
|
# Leave 'Credit' and `Trailblaze_EXP`
|
||||||
whitelist = [2]
|
whitelist = [2, 22]
|
||||||
|
|
||||||
def iter_keywords(self) -> t.Iterable[dict]:
|
def iter_keywords(self) -> t.Iterable[dict]:
|
||||||
for data in self.iter_items():
|
for data in self.iter_items():
|
||||||
|
@ -80,3 +80,23 @@ OBTAIN_3 = ButtonWrapper(
|
|||||||
button=(965, 414, 1029, 478),
|
button=(965, 414, 1029, 478),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
OBTAIN_4 = ButtonWrapper(
|
||||||
|
name='OBTAIN_4',
|
||||||
|
share=Button(
|
||||||
|
file='./assets/share/combat/obtain/OBTAIN_4.png',
|
||||||
|
area=(1041, 414, 1105, 478),
|
||||||
|
search=(1021, 394, 1125, 498),
|
||||||
|
color=(76, 101, 109),
|
||||||
|
button=(1041, 414, 1105, 478),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
OBTAIN_TRAILBLAZE_EXP = ButtonWrapper(
|
||||||
|
name='OBTAIN_TRAILBLAZE_EXP',
|
||||||
|
share=Button(
|
||||||
|
file='./assets/share/combat/obtain/OBTAIN_TRAILBLAZE_EXP.png',
|
||||||
|
area=(827, 425, 860, 451),
|
||||||
|
search=(813, 349, 877, 589),
|
||||||
|
color=(167, 173, 194),
|
||||||
|
button=(827, 425, 860, 451),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
@ -7,7 +7,7 @@ from module.ocr.ocr import Digit
|
|||||||
from tasks.combat.assets.assets_combat_obtain import *
|
from tasks.combat.assets.assets_combat_obtain import *
|
||||||
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
|
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
|
||||||
from tasks.dungeon.keywords import DungeonList
|
from tasks.dungeon.keywords import DungeonList
|
||||||
from tasks.planner.keywords import ITEM_CLASSES
|
from tasks.planner.keywords import ITEM_CLASSES, KEYWORDS_ITEM_CURRENCY
|
||||||
from tasks.planner.model import ObtainedAmmount, PlannerMixin
|
from tasks.planner.model import ObtainedAmmount, PlannerMixin
|
||||||
from tasks.planner.scan import OcrItemName
|
from tasks.planner.scan import OcrItemName
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class CombatObtain(PlannerMixin):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _obtain_get_entry(dungeon: DungeonList, index: int = 1, prev: ObtainedAmmount = None):
|
def _obtain_get_entry(dungeon: DungeonList, index: int = 1, prev: ObtainedAmmount = None, start: int = 0):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
dungeon: Current dungeon
|
dungeon: Current dungeon
|
||||||
@ -101,7 +101,7 @@ class CombatObtain(PlannerMixin):
|
|||||||
prev: Previous item checked
|
prev: Previous item checked
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
ButtonWrapper: Item entry, or None if no more check needed
|
int: Item entry index, or None if no more check needed
|
||||||
"""
|
"""
|
||||||
if (index > 1 and prev is None) or (index <= 1 and prev is not None):
|
if (index > 1 and prev is None) or (index <= 1 and prev is not None):
|
||||||
raise ScriptError(f'_obtain_get_entry: index and prev must be set together, index={index}, prev={prev}')
|
raise ScriptError(f'_obtain_get_entry: index and prev must be set together, index={index}, prev={prev}')
|
||||||
@ -111,20 +111,29 @@ class CombatObtain(PlannerMixin):
|
|||||||
|
|
||||||
def may_obtain_one():
|
def may_obtain_one():
|
||||||
if prev is None:
|
if prev is None:
|
||||||
return OBTAIN_1
|
if start:
|
||||||
|
return 1 + start
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def may_obtain_multi():
|
def may_obtain_multi():
|
||||||
if prev is None:
|
if prev is None:
|
||||||
return OBTAIN_1
|
if start:
|
||||||
|
return 1 + start
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
# End at the item with the lowest rarity
|
# End at the item with the lowest rarity
|
||||||
if prev.item.is_rarity_green:
|
if prev.item.is_rarity_green:
|
||||||
return None
|
return None
|
||||||
if index == 2:
|
# End at credict
|
||||||
return OBTAIN_2
|
if prev.item == KEYWORDS_ITEM_CURRENCY.Credit:
|
||||||
if index == 3:
|
return None
|
||||||
return OBTAIN_3
|
if start:
|
||||||
|
return index + start
|
||||||
|
else:
|
||||||
|
return index
|
||||||
|
|
||||||
if dungeon is None:
|
if dungeon is None:
|
||||||
return may_obtain_multi()
|
return may_obtain_multi()
|
||||||
@ -185,18 +194,38 @@ class CombatObtain(PlannerMixin):
|
|||||||
index = 1
|
index = 1
|
||||||
prev = None
|
prev = None
|
||||||
items = []
|
items = []
|
||||||
|
dic_entry = {
|
||||||
|
1: OBTAIN_1,
|
||||||
|
2: OBTAIN_2,
|
||||||
|
3: OBTAIN_3,
|
||||||
|
4: OBTAIN_4,
|
||||||
|
}
|
||||||
|
|
||||||
self._find_may_obtain()
|
self._find_may_obtain()
|
||||||
|
|
||||||
|
trailblaze_exp = False
|
||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
entry = self._obtain_get_entry(dungeon, index=index, prev=prev)
|
if not trailblaze_exp and self.appear(OBTAIN_TRAILBLAZE_EXP):
|
||||||
if entry is None:
|
trailblaze_exp = True
|
||||||
|
logger.attr('trailblaze_exp', trailblaze_exp)
|
||||||
|
|
||||||
|
entry_index = self._obtain_get_entry(dungeon, index=index, prev=prev, start=int(trailblaze_exp))
|
||||||
|
if entry_index is None:
|
||||||
logger.info('Obtain get end')
|
logger.info('Obtain get end')
|
||||||
break
|
break
|
||||||
|
try:
|
||||||
|
entry = dic_entry[entry_index]
|
||||||
|
except KeyError:
|
||||||
|
logger.error(f'No obtain entry for {entry_index}')
|
||||||
|
break
|
||||||
|
|
||||||
self._obtain_enter(entry)
|
self._obtain_enter(entry)
|
||||||
item = self._obtain_parse()
|
item = self._obtain_parse()
|
||||||
if item is not None:
|
if item.item == KEYWORDS_ITEM_CURRENCY.Trailblaze_EXP:
|
||||||
|
logger.warning('Trailblaze_EXP is in obtain list, OBTAIN_TRAILBLAZE_EXP may need to verify')
|
||||||
|
index += 1
|
||||||
|
prev = item
|
||||||
|
elif item is not None:
|
||||||
items.append(item)
|
items.append(item)
|
||||||
index += 1
|
index += 1
|
||||||
prev = item
|
prev = item
|
||||||
@ -258,6 +287,7 @@ class CombatObtain(PlannerMixin):
|
|||||||
OBTAIN_1.load_offset(MAY_OBTAIN)
|
OBTAIN_1.load_offset(MAY_OBTAIN)
|
||||||
OBTAIN_2.load_offset(MAY_OBTAIN)
|
OBTAIN_2.load_offset(MAY_OBTAIN)
|
||||||
OBTAIN_3.load_offset(MAY_OBTAIN)
|
OBTAIN_3.load_offset(MAY_OBTAIN)
|
||||||
|
OBTAIN_4.load_offset(MAY_OBTAIN)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,3 +16,16 @@ Credit = ItemCurrency(
|
|||||||
item_group=0,
|
item_group=0,
|
||||||
dungeon_id=-1,
|
dungeon_id=-1,
|
||||||
)
|
)
|
||||||
|
Trailblaze_EXP = ItemCurrency(
|
||||||
|
id=2,
|
||||||
|
name='Trailblaze_EXP',
|
||||||
|
cn='里程',
|
||||||
|
cht='里程',
|
||||||
|
en='Trailblaze EXP',
|
||||||
|
jp='マイレージ',
|
||||||
|
es='EXP trazacaminos',
|
||||||
|
rarity='Rare',
|
||||||
|
item_id=22,
|
||||||
|
item_group=0,
|
||||||
|
dungeon_id=-1,
|
||||||
|
)
|
||||||
|
@ -22,7 +22,7 @@ class OcrItemName(Ocr):
|
|||||||
result = result.replace('念火之心', '忿火之心')
|
result = result.replace('念火之心', '忿火之心')
|
||||||
result = re.sub('工造机$', '工造机杼', result)
|
result = re.sub('工造机$', '工造机杼', result)
|
||||||
result = re.sub('工造轮', '工造迴轮', result)
|
result = re.sub('工造轮', '工造迴轮', result)
|
||||||
result = re.sub('月狂牙', '月狂獠牙', result)
|
result = re.sub('月狂[療撩]?牙', '月狂獠牙', result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user