Skip to content

Commit

Permalink
Merge pull request LmeSzinc#417 from LmeSzinc/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LmeSzinc authored Apr 14, 2024
2 parents d985ca3 + aa700b8 commit 9849267
Show file tree
Hide file tree
Showing 31 changed files with 1,102 additions and 119 deletions.
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
"WeeklyFarming": false,
"UseStamina": false,
"SimulatedUniverseElite": {}
},
"RogueBlessing": {
"PresetBlessingFilter": "preset",
Expand Down
15 changes: 12 additions & 3 deletions module/base/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from concurrent.futures import ThreadPoolExecutor

import module.config.server as server_
from module.base.button import Button, ButtonWrapper, ClickButton, match_template
from module.base.timer import Timer
Expand Down Expand Up @@ -50,11 +48,22 @@ def __init__(self, config, device=None, task=None):
self.interval_timer = {}

@cached_class_property
def worker(self) -> ThreadPoolExecutor:
def worker(self):
"""
A thread pool to run things at background
Examples:
```
def func(image):
logger.info('Update thread start')
with self.config.multi_set():
self.dungeon_get_simuni_point(image)
self.dungeon_update_stamina(image)
ModuleBase.worker.submit(func, self.device.image)
```
"""
logger.hr('Creating worker')
from concurrent.futures import ThreadPoolExecutor
pool = ThreadPoolExecutor(1)
return pool

Expand Down
13 changes: 12 additions & 1 deletion module/config/argument/args.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"aScreenCap_nc",
"DroidCast",
"DroidCast_raw",
"scrcpy"
"scrcpy",
"nemu_ipc"
],
"display": "hide"
},
Expand Down Expand Up @@ -1466,9 +1467,19 @@
"type": "checkbox",
"value": true
},
"WeeklyFarming": {
"type": "checkbox",
"value": false
},
"UseStamina": {
"type": "checkbox",
"value": false
},
"SimulatedUniverseElite": {
"type": "stored",
"value": {},
"display": "hide",
"stored": "StoredSimulatedUniverseElite"
}
},
"RogueBlessing": {
Expand Down
16 changes: 15 additions & 1 deletion module/config/argument/argument.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,18 @@ Emulator:
option: [ auto, cn, en ]
ScreenshotMethod:
value: auto
option: [ auto, ADB, ADB_nc, uiautomator2, aScreenCap, aScreenCap_nc, DroidCast, DroidCast_raw, scrcpy ]
option: [
auto,
ADB,
ADB_nc,
uiautomator2,
aScreenCap,
aScreenCap_nc,
DroidCast,
DroidCast_raw,
scrcpy,
nemu_ipc,
]
ControlMethod:
value: MaaTouch
option: [ minitouch, MaaTouch ]
Expand Down Expand Up @@ -246,7 +257,10 @@ RogueWorld:
option: [ combat, occurrence ]
UseImmersifier: true
DoubleEvent: true
WeeklyFarming: false
UseStamina: 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"
}
}
4 changes: 3 additions & 1 deletion module/config/config_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GeneratedConfig:
Emulator_GameClient = 'android' # android, cloud_android
Emulator_PackageName = 'auto' # auto, CN-Official, CN-Bilibili, OVERSEA-America, OVERSEA-Asia, OVERSEA-Europe, OVERSEA-TWHKMO
Emulator_GameLanguage = 'auto' # auto, cn, en
Emulator_ScreenshotMethod = 'auto' # auto, ADB, ADB_nc, uiautomator2, aScreenCap, aScreenCap_nc, DroidCast, DroidCast_raw, scrcpy
Emulator_ScreenshotMethod = 'auto' # auto, ADB, ADB_nc, uiautomator2, aScreenCap, aScreenCap_nc, DroidCast, DroidCast_raw, scrcpy, nemu_ipc
Emulator_ControlMethod = 'MaaTouch' # minitouch, MaaTouch
Emulator_AdbRestart = False

Expand Down Expand Up @@ -138,7 +138,9 @@ class GeneratedConfig:
RogueWorld_DomainStrategy = 'combat' # combat, occurrence
RogueWorld_UseImmersifier = True
RogueWorld_DoubleEvent = True
RogueWorld_WeeklyFarming = False
RogueWorld_UseStamina = False
RogueWorld_SimulatedUniverseElite = {}

# Group `RogueBlessing`
RogueBlessing_PresetBlessingFilter = 'preset' # preset, custom
Expand Down
11 changes: 10 additions & 1 deletion module/config/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
"aScreenCap_nc": "aScreenCap_nc",
"DroidCast": "DroidCast",
"DroidCast_raw": "DroidCast_raw",
"scrcpy": "scrcpy"
"scrcpy": "scrcpy",
"nemu_ipc": "nemu_ipc"
},
"ControlMethod": {
"name": "Control Method",
Expand Down Expand Up @@ -969,9 +970,17 @@
"name": "Participate in Double Planer Event",
"help": ""
},
"WeeklyFarming": {
"name": "Farm 100 Elites Weekly",
"help": ""
},
"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."
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {
Expand Down
11 changes: 10 additions & 1 deletion module/config/i18n/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
"aScreenCap_nc": "aScreenCap_nc",
"DroidCast": "DroidCast",
"DroidCast_raw": "DroidCast_raw",
"scrcpy": "scrcpy"
"scrcpy": "scrcpy",
"nemu_ipc": "nemu_ipc"
},
"ControlMethod": {
"name": "Método de control",
Expand Down Expand Up @@ -969,9 +970,17 @@
"name": "Participa en doble planer evento",
"help": ""
},
"WeeklyFarming": {
"name": "Granja 100 élites semanalmente",
"help": ""
},
"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"
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {
Expand Down
11 changes: 10 additions & 1 deletion module/config/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
"aScreenCap_nc": "aScreenCap_nc",
"DroidCast": "DroidCast",
"DroidCast_raw": "DroidCast_raw",
"scrcpy": "scrcpy"
"scrcpy": "scrcpy",
"nemu_ipc": "nemu_ipc"
},
"ControlMethod": {
"name": "Emulator.ControlMethod.name",
Expand Down Expand Up @@ -969,9 +970,17 @@
"name": "RogueWorld.DoubleEvent.name",
"help": "RogueWorld.DoubleEvent.help"
},
"WeeklyFarming": {
"name": "RogueWorld.WeeklyFarming.name",
"help": "RogueWorld.WeeklyFarming.help"
},
"UseStamina": {
"name": "RogueWorld.UseStamina.name",
"help": "RogueWorld.UseStamina.help"
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {
Expand Down
11 changes: 10 additions & 1 deletion module/config/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
"aScreenCap_nc": "aScreenCap_nc",
"DroidCast": "DroidCast",
"DroidCast_raw": "DroidCast_raw",
"scrcpy": "scrcpy"
"scrcpy": "scrcpy",
"nemu_ipc": "nemu_ipc"
},
"ControlMethod": {
"name": "模拟器控制方案",
Expand Down Expand Up @@ -969,9 +970,17 @@
"name": "参与双倍内圈仪器活动",
"help": ""
},
"WeeklyFarming": {
"name": "每周刷100精英怪",
"help": ""
},
"UseStamina": {
"name": "使用开拓力刷内圈遗器",
"help": "每日副本任务将不再打本,所有开拓力将优先被用于领取浸器奖励,双倍活动时除外"
},
"SimulatedUniverseElite": {
"name": "剩余Boss材料掉落次数",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {
Expand Down
11 changes: 10 additions & 1 deletion module/config/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
"aScreenCap_nc": "aScreenCap_nc",
"DroidCast": "DroidCast",
"DroidCast_raw": "DroidCast_raw",
"scrcpy": "scrcpy"
"scrcpy": "scrcpy",
"nemu_ipc": "nemu_ipc"
},
"ControlMethod": {
"name": "模擬器控制方案",
Expand Down Expand Up @@ -969,9 +970,17 @@
"name": "參與雙倍內圈儀器活動",
"help": ""
},
"WeeklyFarming": {
"name": "每週農100精英怪",
"help": ""
},
"UseStamina": {
"name": "用開拓力農遺器",
"help": "每日副本任務將不再打本,所有開拓力將優先被用於領取浸器獎勵,雙倍活動時除外"
},
"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")
Loading

0 comments on commit 9849267

Please sign in to comment.