mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Seperate stored counter into an independent class
This commit is contained in:
parent
792eb2157a
commit
f262140fb6
@ -200,7 +200,8 @@
|
||||
"UseImmersifier": true,
|
||||
"DoubleEvent": true,
|
||||
"UseStamina": false,
|
||||
"WeeklyFarming": false
|
||||
"WeeklyFarming": false,
|
||||
"SimulatedUniverseElite": {}
|
||||
},
|
||||
"RogueBlessing": {
|
||||
"PresetBlessingFilter": "preset",
|
||||
|
@ -1473,6 +1473,12 @@
|
||||
"WeeklyFarming": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
},
|
||||
"SimulatedUniverseElite": {
|
||||
"type": "stored",
|
||||
"value": {},
|
||||
"display": "hide",
|
||||
"stored": "StoredSimulatedUniverseElite"
|
||||
}
|
||||
},
|
||||
"RogueBlessing": {
|
||||
|
@ -248,6 +248,8 @@ RogueWorld:
|
||||
DoubleEvent: true
|
||||
UseStamina: false
|
||||
WeeklyFarming: false
|
||||
SimulatedUniverseElite:
|
||||
stored: StoredSimulatedUniverseElite
|
||||
|
||||
RogueBlessing:
|
||||
PresetBlessingFilter:
|
||||
|
@ -293,5 +293,18 @@
|
||||
},
|
||||
"order": 0,
|
||||
"color": "#777777"
|
||||
},
|
||||
"SimulatedUniverseElite": {
|
||||
"name": "SimulatedUniverseElite",
|
||||
"path": "Rogue.RogueWorld.SimulatedUniverseElite",
|
||||
"i18n": "RogueWorld.SimulatedUniverseElite.name",
|
||||
"stored": "StoredSimulatedUniverseElite",
|
||||
"attrs": {
|
||||
"time": "2020-01-01 00:00:00",
|
||||
"total": 0,
|
||||
"value": 100
|
||||
},
|
||||
"order": 0,
|
||||
"color": "#777777"
|
||||
}
|
||||
}
|
@ -140,6 +140,7 @@ class GeneratedConfig:
|
||||
RogueWorld_DoubleEvent = True
|
||||
RogueWorld_UseStamina = False
|
||||
RogueWorld_WeeklyFarming = False
|
||||
RogueWorld_SimulatedUniverseElite = {}
|
||||
|
||||
# Group `RogueBlessing`
|
||||
RogueBlessing_PresetBlessingFilter = 'preset' # preset, custom
|
||||
|
@ -976,6 +976,10 @@
|
||||
"WeeklyFarming": {
|
||||
"name": "Boss Material Farming",
|
||||
"help": "Do not stop after point reward is full; farm the boss 100 times instead to obtain trace materials"
|
||||
},
|
||||
"SimulatedUniverseElite": {
|
||||
"name": "RogueWorld.SimulatedUniverseElite.name",
|
||||
"help": "RogueWorld.SimulatedUniverseElite.help"
|
||||
}
|
||||
},
|
||||
"RogueBlessing": {
|
||||
|
@ -976,6 +976,10 @@
|
||||
"WeeklyFarming": {
|
||||
"name": "Recolección de Materiales de Jefes",
|
||||
"help": "No detenerse después de que los puntos semanales estén llenos, farmear al jefe 100 veces para obtener materiales de rastro"
|
||||
},
|
||||
"SimulatedUniverseElite": {
|
||||
"name": "RogueWorld.SimulatedUniverseElite.name",
|
||||
"help": "RogueWorld.SimulatedUniverseElite.help"
|
||||
}
|
||||
},
|
||||
"RogueBlessing": {
|
||||
|
@ -976,6 +976,10 @@
|
||||
"WeeklyFarming": {
|
||||
"name": "ボス素材を収集",
|
||||
"help": "週間ポイントが満点に達しても停止せず、100回のボスをファームして軌跡素材を入手"
|
||||
},
|
||||
"SimulatedUniverseElite": {
|
||||
"name": "RogueWorld.SimulatedUniverseElite.name",
|
||||
"help": "RogueWorld.SimulatedUniverseElite.help"
|
||||
}
|
||||
},
|
||||
"RogueBlessing": {
|
||||
|
@ -976,6 +976,10 @@
|
||||
"WeeklyFarming": {
|
||||
"name": "刷取Boss材料",
|
||||
"help": "每周积分满后不停止,刷取100次Boss以获取形迹材料"
|
||||
},
|
||||
"SimulatedUniverseElite": {
|
||||
"name": "剩余Boss材料掉落次数",
|
||||
"help": "RogueWorld.SimulatedUniverseElite.help"
|
||||
}
|
||||
},
|
||||
"RogueBlessing": {
|
||||
|
@ -976,6 +976,10 @@
|
||||
"WeeklyFarming": {
|
||||
"name": "刷取Boss材料",
|
||||
"help": "每週積分滿後不停止,刷取100次Boss以獲取形跡材料"
|
||||
},
|
||||
"SimulatedUniverseElite": {
|
||||
"name": "RogueWorld.SimulatedUniverseElite.name",
|
||||
"help": "RogueWorld.SimulatedUniverseElite.help"
|
||||
}
|
||||
},
|
||||
"RogueBlessing": {
|
||||
|
@ -205,25 +205,29 @@ class StoredImmersifier(StoredCounter):
|
||||
|
||||
|
||||
class StoredSimulatedUniverse(StoredCounter, StoredExpiredAtMonday0400):
|
||||
pass
|
||||
|
||||
|
||||
class StoredSimulatedUniverseElite(StoredCounter, StoredExpiredAtMonday0400):
|
||||
# These variables are used in Rogue Farming feature.
|
||||
|
||||
# Times of boss drop chance per week. In current version of StarRail, this value is 100.
|
||||
FIXED_DEFAULT = 100
|
||||
|
||||
# Times left to farm. Resets to 100 every Monday 04:00, and decreases each time the elite boss is cleared.
|
||||
FarmingCounter = FIXED_DEFAULT
|
||||
value = FIXED_DEFAULT
|
||||
|
||||
def farm_dec(self, value = 1):
|
||||
self.FarmingCounter -= value
|
||||
self.value -= value
|
||||
|
||||
def farm_reset(self,):
|
||||
self.FarmingCounter = self.FIXED_DEFAULT
|
||||
def farm_reset(self):
|
||||
self.value = self.FIXED_DEFAULT
|
||||
|
||||
def farm_not_complete(self) -> bool:
|
||||
return self.FarmingCounter > 0
|
||||
return self.value > 0
|
||||
|
||||
def farm_get_remain(self) -> int:
|
||||
return self.FarmingCounter
|
||||
return self.value
|
||||
|
||||
|
||||
class StoredAssignment(StoredCounter):
|
||||
|
@ -20,6 +20,7 @@ from module.config.stored.classes import (
|
||||
StoredImmersifier,
|
||||
StoredInt,
|
||||
StoredSimulatedUniverse,
|
||||
StoredSimulatedUniverseElite,
|
||||
StoredTrailblazePower,
|
||||
)
|
||||
|
||||
@ -50,3 +51,4 @@ class StoredGenerated:
|
||||
Assignment = StoredAssignment("Assignment.Assignment.Assignment")
|
||||
Credit = StoredInt("DataUpdate.ItemStorage.Credit")
|
||||
StallerJade = StoredInt("DataUpdate.ItemStorage.StallerJade")
|
||||
SimulatedUniverseElite = StoredSimulatedUniverseElite("Rogue.RogueWorld.SimulatedUniverseElite")
|
||||
|
@ -386,7 +386,7 @@ class MapControl(Combat, AimDetectorMixin):
|
||||
end_point = waypoints[-1]
|
||||
end_point.expected_end.append('item')
|
||||
|
||||
self.goto(*waypoints)
|
||||
return self.goto(*waypoints)
|
||||
|
||||
def clear_enemy(self, *waypoints):
|
||||
"""
|
||||
@ -403,7 +403,7 @@ class MapControl(Combat, AimDetectorMixin):
|
||||
end_point = waypoints[-1]
|
||||
end_point.expected_end.append('enemy')
|
||||
|
||||
self.goto(*waypoints)
|
||||
return self.goto(*waypoints)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -348,16 +348,20 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI):
|
||||
return
|
||||
|
||||
if self.config.stored.SimulatedUniverse.is_expired():
|
||||
# Expired, do rogue and reset farming counter
|
||||
self.config.stored.SimulatedUniverse.farm_reset()
|
||||
# Expired, do rogue
|
||||
pass
|
||||
|
||||
if self.config.stored.SimulatedUniverseElite.is_expired():
|
||||
# Expired, reset farming counter
|
||||
self.config.stored.SimulatedUniverseElite.farm_reset()
|
||||
|
||||
elif self.config.stored.SimulatedUniverse.is_full():
|
||||
if self.config.RogueWorld_UseImmersifier and self.config.stored.Immersifier.value > 0:
|
||||
logger.info(
|
||||
'Reached weekly point limit but still have immersifiers left, continue to use them')
|
||||
elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_complete():
|
||||
elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete():
|
||||
logger.attr(
|
||||
"Farming Counter", self.config.stored.SimulatedUniverse.farm_get_remain())
|
||||
"Farming Counter", self.config.stored.SimulatedUniverseElite.farm_get_remain())
|
||||
logger.info(
|
||||
'Reached weekly point limit but still continue to farm materials')
|
||||
else:
|
||||
|
@ -170,13 +170,14 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
|
||||
pass
|
||||
|
||||
result = super().clear_enemy(*waypoints)
|
||||
# logger.attr("result",result)
|
||||
|
||||
if 'enemy' in result:
|
||||
# runs when one elite battle finishes (do not handle whether the battle succeeded or failed), and decreases rogue farming count by 1
|
||||
if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_complete():
|
||||
self.config.stored.SimulatedUniverse.farm_dec()
|
||||
if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete():
|
||||
self.config.stored.SimulatedUniverseElite.farm_dec()
|
||||
logger.info(
|
||||
f"Cleared elite boss, decrease farming count by 1, now {self.config.stored.SimulatedUniverse.FarmingCounter}")
|
||||
|
||||
f"Cleared elite boss, decrease farming count by 1, now {self.config.stored.SimulatedUniverseElite.farm_get_remain()}")
|
||||
return result
|
||||
|
||||
def _domain_event_expected_end(self):
|
||||
|
Loading…
Reference in New Issue
Block a user