Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature of material farming in task RogueWorld #361

Merged
merged 12 commits into from
Apr 14, 2024
Merged
4 changes: 3 additions & 1 deletion config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@
"DomainStrategy": "combat",
"UseImmersifier": true,
"DoubleEvent": true,
"UseStamina": false
"UseStamina": false,
"WeeklyFarming": false,
"SimulatedUniverseElite": {}
},
"RogueBlessing": {
"PresetBlessingFilter": "preset",
Expand Down
10 changes: 10 additions & 0 deletions module/config/argument/args.json
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,16 @@
"UseStamina": {
"type": "checkbox",
"value": false
},
"WeeklyFarming": {
"type": "checkbox",
"value": false
},
"SimulatedUniverseElite": {
"type": "stored",
"value": {},
"display": "hide",
"stored": "StoredSimulatedUniverseElite"
}
},
"RogueBlessing": {
Expand Down
3 changes: 3 additions & 0 deletions module/config/argument/argument.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ RogueWorld:
UseImmersifier: true
DoubleEvent: true
UseStamina: false
WeeklyFarming: false
SimulatedUniverseElite:
stored: StoredSimulatedUniverseElite

RogueBlessing:
PresetBlessingFilter:
Expand Down
13 changes: 13 additions & 0 deletions module/config/argument/stored.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 2 additions & 0 deletions module/config/config_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class GeneratedConfig:
RogueWorld_UseImmersifier = True
RogueWorld_DoubleEvent = True
RogueWorld_UseStamina = False
RogueWorld_WeeklyFarming = False
RogueWorld_SimulatedUniverseElite = {}

# Group `RogueBlessing`
RogueBlessing_PresetBlessingFilter = 'preset' # preset, custom
Expand Down
8 changes: 8 additions & 0 deletions module/config/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,14 @@
"UseStamina": {
"name": "Farm Planers Using Trailblase Power",
"help": "Task \"Dungeon\" will no longer run, and all trailblaze power will be used first to claim immersion rewards, except for double events."
},
"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": {
Expand Down
8 changes: 8 additions & 0 deletions module/config/i18n/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,14 @@
"UseStamina": {
"name": "Reclamar de planers mediante poder trazacaminos",
"help": "La tarea de mazmorra ya no se ejecutará y todo el poder trazacaminos se usará primero para reclamar recompensas de inmersión, excepto para eventos dobles"
},
"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": {
Expand Down
8 changes: 8 additions & 0 deletions module/config/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,14 @@
"UseStamina": {
"name": "RogueWorld.UseStamina.name",
"help": "RogueWorld.UseStamina.help"
},
"WeeklyFarming": {
"name": "ボス素材を収集",
"help": "週間ポイントが満点に達しても停止せず、100回のボスをファームして軌跡素材を入手"
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {
Expand Down
8 changes: 8 additions & 0 deletions module/config/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,14 @@
"UseStamina": {
"name": "使用开拓力刷内圈遗器",
"help": "每日副本任务将不再打本,所有开拓力将优先被用于领取浸器奖励,双倍活动时除外"
},
"WeeklyFarming": {
"name": "刷取Boss材料",
"help": "每周积分满后不停止,刷取100次Boss以获取形迹材料"
},
"SimulatedUniverseElite": {
"name": "剩余Boss材料掉落次数",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {
Expand Down
8 changes: 8 additions & 0 deletions module/config/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,14 @@
"UseStamina": {
"name": "用開拓力農遺器",
"help": "每日副本任務將不再打本,所有開拓力將優先被用於領取浸器獎勵,雙倍活動時除外"
},
"WeeklyFarming": {
"name": "刷取Boss材料",
"help": "每週積分滿後不停止,刷取100次Boss以獲取形跡材料"
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {
Expand Down
24 changes: 24 additions & 0 deletions module/config/stored/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,30 @@ 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.
value = FIXED_DEFAULT

def farm_dec(self, delta = 1):
self.value -= delta
if self.value < 0:
self.value = 0

def farm_reset(self):
self.value = self.FIXED_DEFAULT

def farm_not_complete(self) -> bool:
return self.value > 0

def farm_get_remain(self) -> int:
return self.value


class StoredAssignment(StoredCounter):
pass

Expand Down
2 changes: 2 additions & 0 deletions module/config/stored/stored_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
StoredImmersifier,
StoredInt,
StoredSimulatedUniverse,
StoredSimulatedUniverseElite,
StoredTrailblazePower,
)

Expand Down Expand Up @@ -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")
4 changes: 2 additions & 2 deletions tasks/map/control/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def clear_item(self, *waypoints):
end_point = waypoints[-1]
end_point.expected_end.append('item')

self.goto(*waypoints)
return self.goto(*waypoints)

def clear_enemy(self, *waypoints):
"""
Expand All @@ -403,7 +403,7 @@ def clear_enemy(self, *waypoints):
end_point = waypoints[-1]
end_point.expected_end.append('enemy')

self.goto(*waypoints)
return self.goto(*waypoints)


if __name__ == '__main__':
Expand Down
17 changes: 14 additions & 3 deletions tasks/rogue/entry/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ def check_stop_condition(self):
"""
logger.info(f'RogueWorld_UseImmersifier={self.config.RogueWorld_UseImmersifier}, '
f'RogueWorld_UseStamina={self.config.RogueWorld_UseStamina}, '
f'RogueWorld_DoubleEvent={self.config.RogueWorld_DoubleEvent}'
f'RogueWorld_DoubleEvent={self.config.RogueWorld_DoubleEvent}, '
f'RogueWorld_WeeklyFarming={self.config.RogueWorld_WeeklyFarming}, '
f'RogueDebug_DebugMode={self.config.RogueDebug_DebugMode}')
# This shouldn't happen
if self.config.RogueWorld_UseStamina and not self.config.RogueWorld_UseImmersifier:
Expand All @@ -345,13 +346,23 @@ def check_stop_condition(self):
if self.config.RogueDebug_DebugMode:
# Always run
return


if self.config.stored.SimulatedUniverseElite.is_expired():
# Expired, reset farming counter
self.config.stored.SimulatedUniverseElite.farm_reset()

if self.config.stored.SimulatedUniverse.is_expired():
# Expired, do rogue
pass
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')
logger.info(
'Reached weekly point limit but still have immersifiers left, continue to use them')
elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete():
logger.info(
'Reached weekly point limit but still continue to farm materials')
logger.attr(
"Farming Counter", self.config.stored.SimulatedUniverseElite.farm_get_remain())
else:
raise RogueReachedWeeklyPointLimit
else:
Expand Down
8 changes: 8 additions & 0 deletions tasks/rogue/route/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ def clear_elite(self, *waypoints):
pass

result = super().clear_enemy(*waypoints)
# logger.attr("result",result)

if 'enemy' in result:
# runs when one elite battle finishes, and decreases rogue farming count by 1
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, decreasing farming count by 1, now {self.config.stored.SimulatedUniverseElite.farm_get_remain()}")
return result

def _domain_event_expected_end(self):
Expand Down