mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 07:39:25 +08:00
Merge branch 'dev' into feature/more
This commit is contained in:
15
alas.py
15
alas.py
@@ -45,7 +45,22 @@ class AzurLaneAutoScript:
|
||||
AutoRestart_AttemptsToRestart = 0
|
||||
AutoRestart_NotifyWhenAutoRestart = False
|
||||
|
||||
def pre_init(self):
|
||||
from PIL import Image
|
||||
Image.init()
|
||||
|
||||
# Manually register PngImagePlugin
|
||||
from PIL import PngImagePlugin
|
||||
Image.register_open(PngImagePlugin.PngImageFile.format, PngImagePlugin.PngImageFile, PngImagePlugin._accept)
|
||||
Image.register_save(PngImagePlugin.PngImageFile.format, PngImagePlugin._save)
|
||||
Image.register_save_all(PngImagePlugin.PngImageFile.format, PngImagePlugin._save_all)
|
||||
|
||||
Image.register_extensions(PngImagePlugin.PngImageFile.format, [".png", ".apng"])
|
||||
|
||||
Image.register_mime(PngImagePlugin.PngImageFile.format, "image/png")
|
||||
|
||||
def __init__(self, config_name='alas'):
|
||||
self.pre_init()
|
||||
logger.hr('Start', level=0)
|
||||
self.config_name = config_name
|
||||
# Skip first restart
|
||||
|
||||
90
bin/Lua/SpeedUp.lua
Normal file
90
bin/Lua/SpeedUp.lua
Normal file
@@ -0,0 +1,90 @@
|
||||
function Main1()
|
||||
SN = gg.choice({
|
||||
"设置倍速",
|
||||
"还原倍速",
|
||||
"退出",
|
||||
}, nil, "倍速面板")
|
||||
if SN==1 then
|
||||
HS9()
|
||||
end
|
||||
if SN==2 then
|
||||
HS666()
|
||||
end
|
||||
if SN==3 then
|
||||
exit()
|
||||
end
|
||||
FX=false
|
||||
end
|
||||
|
||||
function HS9()
|
||||
x = gg.prompt({"倍速(默认5倍)"},{"5.0"},{number})
|
||||
n = x[1]
|
||||
-- 清除
|
||||
gg.clearResults()
|
||||
gg.setRanges(32)
|
||||
-- 第一次搜索
|
||||
gg.searchNumber("1.0;0.33333334327;0.02999999933::9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
|
||||
gg.refineNumber("1.0", gg.TYPE_AUTO, false, gg.SIGN_EQUAL, 0, -1, 0)
|
||||
results=gg.getResultCount()
|
||||
gg.getResults(100)
|
||||
gg.editAll(n, gg.TYPE_FLOAT)
|
||||
-- 判断
|
||||
if results==0 then
|
||||
-- 清除
|
||||
gg.clearResults()
|
||||
gg.setRanges(32)
|
||||
-- 第二次搜索
|
||||
gg.searchNumber("1.0;0.33333334327;0.02999999933::9", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
|
||||
gg.refineNumber("1.0", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
|
||||
gg.getResults(100)
|
||||
gg.editAll(n, gg.TYPE_DWORD)
|
||||
end
|
||||
-- 清除
|
||||
gg.clearResults()
|
||||
gg.toast("修改成功")
|
||||
end
|
||||
|
||||
function HS666()
|
||||
x = gg.prompt({"还原倍速(默认5倍)"},{"5.0"},{number})
|
||||
n = x[1]
|
||||
-- 清除
|
||||
gg.clearResults()
|
||||
gg.setRanges(32)
|
||||
-- 第一次搜索
|
||||
gg.searchNumber(n..";0.33333334327;0.02999999933::9", gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1, 0)
|
||||
gg.refineNumber(n, gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1, 0)
|
||||
gg.getResults(100)
|
||||
gg.editAll("1", gg.TYPE_DOUBLE)
|
||||
gg.getResultCount(results)
|
||||
-- 判断
|
||||
if results==nil then
|
||||
-- 清除
|
||||
gg.clearResults()
|
||||
gg.setRanges(32)
|
||||
-- 第二次搜索
|
||||
gg.searchNumber(n..";0.33333334327;0.02999999933::9", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
|
||||
gg.refineNumber(n, gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
|
||||
gg.getResults(100)
|
||||
gg.editAll("1", gg.TYPE_DWORD)
|
||||
end
|
||||
-- 清除
|
||||
gg.clearResults()
|
||||
gg.toast("还原成功")
|
||||
end
|
||||
|
||||
function exit()
|
||||
gg.alert("退出成功")
|
||||
os.exit()
|
||||
end
|
||||
|
||||
-- 循环
|
||||
-- while true do
|
||||
-- if gg.isVisible(true) then
|
||||
-- FX=true
|
||||
-- gg.setVisible(false)
|
||||
-- end
|
||||
gg.clearResults()
|
||||
-- if FX==true then
|
||||
Main1()
|
||||
-- end
|
||||
-- end
|
||||
@@ -6,6 +6,35 @@
|
||||
#include <sol/sol.hpp>
|
||||
|
||||
#include "utils.hpp"
|
||||
#include "il2cpp.hpp"
|
||||
|
||||
using fnset_TimeScaleT = void(*)(float);
|
||||
|
||||
static fnset_TimeScaleT get_Time_set_timeScale() {
|
||||
Il2CppDomain* domain = il2cpp_domain_get();
|
||||
size_t assembly_count = 0;
|
||||
Il2CppAssembly** assemblies = il2cpp_domain_get_assemblies(domain, &assembly_count);
|
||||
|
||||
Il2CppClass* cls = nullptr;
|
||||
for (size_t i = 0; i < assembly_count; ++i) {
|
||||
Il2CppImage* image = il2cpp_assembly_get_image(assemblies[i]);
|
||||
Il2CppClass* klass = il2cpp_class_from_name(image, "UnityEngine", "Time");
|
||||
if (klass != nullptr) {
|
||||
cls = klass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cls != nullptr) {
|
||||
MethodInfo* method_info = il2cpp_class_get_method_from_name(cls, "set_timeScale", 1);
|
||||
if (method_info != nullptr) {
|
||||
auto method = reinterpret_cast<fnset_TimeScaleT>(method_info->methodPointer);
|
||||
SPDLOG_INFO("Found Time.set_timeScale at {}", (void*)method_info->methodPointer);
|
||||
return method;
|
||||
}
|
||||
}
|
||||
SPDLOG_ERROR("Failed to get Time.set_timeScale");
|
||||
throw std::runtime_error("Failed to get Time.set_timeScale");
|
||||
}
|
||||
|
||||
#define IS_ENABLED(n) \
|
||||
if (is_enabled(n)) { \
|
||||
@@ -211,6 +240,19 @@ void Cracker::disable_all() {
|
||||
disable_no_emotion_warning();
|
||||
disable_opsi_fast_move();
|
||||
disable_gg_factor();
|
||||
disable_global_speedup();
|
||||
}
|
||||
|
||||
void Cracker::enable_global_speedup(float rate) {
|
||||
// IS_ENABLED(GLOBAL_SPEEDUP)
|
||||
get_Time_set_timeScale()(rate);
|
||||
ENABLE(GLOBAL_SPEEDUP)
|
||||
}
|
||||
|
||||
void Cracker::disable_global_speedup() {
|
||||
// IS_DISABLED(GLOBAL_SPEEDUP)
|
||||
get_Time_set_timeScale()(1.0);
|
||||
DISABLE(GLOBAL_SPEEDUP)
|
||||
}
|
||||
|
||||
void Cracker::enable_gg_factor() {
|
||||
@@ -261,14 +303,13 @@ void Cracker::update_gg_factor(double factor) {
|
||||
|
||||
void Cracker::enable_opsi_fast_move() {
|
||||
IS_ENABLED(OPSI_FAST_MOVE)
|
||||
m_original.WorldConst_BaseMoveDuration = m_state["WorldConst"]["BaseMoveDuration"];
|
||||
m_state["WorldConst"]["BaseMoveDuration"] = 0.0;
|
||||
ENABLE(OPSI_FAST_MOVE)
|
||||
}
|
||||
|
||||
void Cracker::disable_opsi_fast_move() {
|
||||
IS_DISABLED(OPSI_FAST_MOVE)
|
||||
m_state["WorldConst"]["BaseMoveDuration"] = m_original.WorldConst_BaseMoveDuration;
|
||||
m_state["WorldConst"]["BaseMoveDuration"] = 0.35;
|
||||
ENABLE(OPSI_FAST_MOVE)
|
||||
}
|
||||
|
||||
@@ -405,9 +446,6 @@ void Cracker::disable_remove_hard_mode_ship_properties_limit() {
|
||||
void Cracker::enable_fast_stage_move() {
|
||||
IS_ENABLED(FAST_STAGE_MOVE_CRACK)
|
||||
|
||||
m_original.ChapterConst_ShipStepDuration = m_state["ChapterConst"]["ShipStepDuration"];
|
||||
m_original.ChapterConst_ShipStepQuickPlayScale = m_state["ChapterConst"]["ShipStepQuickPlayScale"];
|
||||
|
||||
m_state["ChapterConst"]["ShipStepDuration"] = 0.0;
|
||||
m_state["ChapterConst"]["ShipStepQuickPlayScale"] = 0.0;
|
||||
|
||||
@@ -417,8 +455,8 @@ void Cracker::enable_fast_stage_move() {
|
||||
void Cracker::disable_fast_stage_move() {
|
||||
IS_DISABLED(FAST_STAGE_MOVE_CRACK)
|
||||
|
||||
m_state["ChapterConst"]["ShipStepDuration"] = m_original.ChapterConst_ShipStepDuration;
|
||||
m_state["ChapterConst"]["ShipStepQuickPlayScale"] = m_original.ChapterConst_ShipStepQuickPlayScale;
|
||||
m_state["ChapterConst"]["ShipStepDuration"] = 0.5;
|
||||
m_state["ChapterConst"]["ShipStepQuickPlayScale"] = 0.5;
|
||||
|
||||
ENABLE(FAST_STAGE_MOVE_CRACK)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ enum {
|
||||
NO_EMOTION_WARNING,
|
||||
OPSI_FAST_MOVE,
|
||||
GG_FACTOR,
|
||||
GLOBAL_SPEEDUP,
|
||||
};
|
||||
|
||||
class Cracker {
|
||||
@@ -103,6 +104,9 @@ public:
|
||||
|
||||
void disable_all();
|
||||
|
||||
void enable_global_speedup(float rate);
|
||||
void disable_global_speedup();
|
||||
|
||||
void enable_gg_factor();
|
||||
void disable_gg_factor();
|
||||
void update_gg_factor(double factor);
|
||||
@@ -156,8 +160,6 @@ private:
|
||||
sol::state_view m_state;
|
||||
struct {
|
||||
Lua::Function Ship_getShipProperties;
|
||||
double ChapterConst_ShipStepDuration;
|
||||
double ChapterConst_ShipStepQuickPlayScale;
|
||||
Lua::Function WorldFleetSelectLayer_CheckValid;
|
||||
Lua::Function BossSingleBattleFleetSelectSubPanel_CheckValid;
|
||||
Lua::Function Chapter_IsEliteFleetLegal;
|
||||
@@ -166,7 +168,6 @@ private:
|
||||
Lua::Function ys_Battle_BattleManualWeaponAutoBot_SetActive;
|
||||
Lua::Function Ship_cosumeEnergy;
|
||||
Lua::Function Ship_getEnergy;
|
||||
double WorldConst_BaseMoveDuration;
|
||||
Lua::Function Ship_intimacyAdditions;
|
||||
} m_original;
|
||||
struct {
|
||||
|
||||
@@ -9,7 +9,9 @@ struct UnityEngine_Component_Fields : UnityEngine_Object_Fields {};
|
||||
|
||||
struct UnityEngine_Behaviour_Fields : UnityEngine_Component_Fields {};
|
||||
|
||||
struct UnityEngine_MonoBehaviour_Fields : UnityEngine_Behaviour_Fields {};
|
||||
struct UnityEngine_MonoBehaviour_Fields : UnityEngine_Behaviour_Fields {
|
||||
void* m_CancellationTokenSource; // struct System_Threading_CancellationTokenSource_o* m_CancellationTokenSource;
|
||||
};
|
||||
|
||||
struct LuaInterface_LuaStatePtr_Fields {
|
||||
intptr_t L;
|
||||
|
||||
@@ -603,6 +603,34 @@ CrackerServer::CrackerServer() {
|
||||
res.status = 200;
|
||||
});
|
||||
|
||||
Post("/enable_global_speedup", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Json::Reader reader;
|
||||
Json::Value j;
|
||||
reader.parse(req.body, j);
|
||||
Cracker::Instance().enable_global_speedup(j["rate"].asFloat());
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable global speedup failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
res.status = 200;
|
||||
});
|
||||
|
||||
Post("/disable_global_speedup", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Json::Reader reader;
|
||||
Json::Value j;
|
||||
reader.parse(req.body, j);
|
||||
Cracker::Instance().disable_global_speedup();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable global speedup failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
res.status = 200;
|
||||
});
|
||||
|
||||
std::thread([this] {
|
||||
SPDLOG_INFO("Start server on port 23897");
|
||||
listen("0.0.0.0", 23897);
|
||||
|
||||
@@ -89,5 +89,15 @@ POST http://127.0.0.1:23897/enable_opsi_fast_move
|
||||
###
|
||||
POST http://127.0.0.1:23897/disable_opsi_fast_move
|
||||
|
||||
###
|
||||
POST http://127.0.0.1:23897/enable_global_speedup
|
||||
|
||||
{
|
||||
"rate": 10.0
|
||||
}
|
||||
|
||||
###
|
||||
POST http://127.0.0.1:23897/disable_global_speedup
|
||||
|
||||
###
|
||||
POST http://127.0.0.1:23897/is_alive
|
||||
@@ -1,9 +1,9 @@
|
||||
if (NOT DEFINED ENV{NDK_ROOT})
|
||||
if (NOT DEFINED NDK_ROOT)
|
||||
message(FATAL_ERROR "NDK_ROOT is not defined. Please set it to the root directory of your Android NDK.")
|
||||
endif ()
|
||||
message(STATUS "Using Android NDK: $ENV{NDK_ROOT}")
|
||||
message(STATUS "Using Android NDK: ${NDK_ROOT}")
|
||||
if (NOT DEFINED ANDROID_ABI)
|
||||
message("ANDROID_ABI is not defined. Defaulting to x86")
|
||||
set(ANDROID_ABI x86)
|
||||
endif ()
|
||||
set(CMAKE_TOOLCHAIN_FILE $ENV{NDK_ROOT}/build/cmake/android.toolchain.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${NDK_ROOT}/build/cmake/android.toolchain.cmake)
|
||||
@@ -1,4 +1,89 @@
|
||||
{
|
||||
"Dashboard": {
|
||||
"Oil": {
|
||||
"Value": 0,
|
||||
"Limit": 0,
|
||||
"Color": "^000000",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"Coin": {
|
||||
"Value": 0,
|
||||
"Limit": 0,
|
||||
"Color": "^FFAA33",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"Gem": {
|
||||
"Value": 0,
|
||||
"Color": "^FF3333",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"Pt": {
|
||||
"Value": 0,
|
||||
"Color": "^00BFFF",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"Cube": {
|
||||
"Value": 0,
|
||||
"Color": "^33FFFF",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"ActionPoint": {
|
||||
"Value": 0,
|
||||
"Total": 0,
|
||||
"Color": "^0000FF",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"YellowCoin": {
|
||||
"Value": 0,
|
||||
"Color": "^FF8800",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"PurpleCoin": {
|
||||
"Value": 0,
|
||||
"Color": "^7700BB",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"Core": {
|
||||
"Value": 0,
|
||||
"Color": "^AAAAAA",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"Medal": {
|
||||
"Value": 0,
|
||||
"Color": "^FFDD00",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"Merit": {
|
||||
"Value": 0,
|
||||
"Color": "^FFFF00",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"GuildCoin": {
|
||||
"Value": 0,
|
||||
"Color": "^AAAAAA",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"ResearchPercent": {
|
||||
"Value": 0,
|
||||
"Limit": 100,
|
||||
"Color": "^00AA00",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"PlayerLevel": {
|
||||
"Value": 0,
|
||||
"Color": "^FFAA33",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"PlayerExp": {
|
||||
"Value": 0,
|
||||
"Limit": 0,
|
||||
"Color": "^FFAA33",
|
||||
"Record": "2020-01-01 00:00:00"
|
||||
},
|
||||
"Storage": {
|
||||
"Storage": {}
|
||||
}
|
||||
},
|
||||
"Alas": {
|
||||
"Emulator": {
|
||||
"Serial": "auto",
|
||||
@@ -137,6 +222,7 @@
|
||||
"GameLibDir": null
|
||||
},
|
||||
"Misc": {
|
||||
"GlobalSpeedup": 1.0,
|
||||
"ChapterMove": false,
|
||||
"OpsiMove": false,
|
||||
"RemoveHardMapLimit": "disable",
|
||||
@@ -3137,6 +3223,12 @@
|
||||
"Raid": 16500,
|
||||
"Ash": 16500
|
||||
},
|
||||
"SpeedUp": {
|
||||
"Enable": false,
|
||||
"PushLua": false,
|
||||
"Timeout": 600,
|
||||
"Rate": 5
|
||||
},
|
||||
"ChangeShip": {
|
||||
"Enable": false,
|
||||
"PushLua": false,
|
||||
|
||||
@@ -270,41 +270,55 @@ class CampaignUI(MapOperation, CampaignEvent, CampaignOcr):
|
||||
return False
|
||||
|
||||
def campaign_set_chapter_20241219(self, chapter, stage, mode='combat'):
|
||||
if not self.config.MAP_CHAPTER_SWITCH_20241219:
|
||||
return False
|
||||
|
||||
if self._campaign_name_is_hard(f'{chapter}{stage}'):
|
||||
self.config.override(Campaign_Mode='hard')
|
||||
|
||||
if mode == 'story':
|
||||
self.campaign_ensure_mode_20241219('story')
|
||||
return True
|
||||
if chapter in ['a', 'c', 't']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('part1')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
if chapter in ['b', 'd', 'ttl']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('part2')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
if chapter in ['ex_sp']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('sp')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
if chapter in ['ex_ex']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('ex')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
if self.config.MAP_CHAPTER_SWITCH_20241219:
|
||||
if self._campaign_name_is_hard(f'{chapter}{stage}'):
|
||||
self.config.override(Campaign_Mode='hard')
|
||||
# part1, part2, sp, ex
|
||||
if mode == 'story':
|
||||
self.campaign_ensure_mode_20241219('story')
|
||||
return True
|
||||
if chapter in ['a', 'c', 't']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('part1')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
if chapter in ['b', 'd', 'ttl']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('part2')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
if chapter in ['ex_sp']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('sp')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
if chapter in ['ex_ex']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('ex')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
if self.config.MAP_CHAPTER_SWITCH_20241219_SP:
|
||||
if self._campaign_name_is_hard(f'{chapter}{stage}'):
|
||||
self.config.override(Campaign_Mode='hard')
|
||||
# (empty), normal, sp, (empty)
|
||||
if chapter in ['sp', 't', 'ht']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
# normal is on the position of part2
|
||||
self.campaign_ensure_aside_20241219('part2')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
if chapter in ['ex_sp']:
|
||||
self.ui_goto_event()
|
||||
self.campaign_ensure_mode_20241219('combat')
|
||||
self.campaign_ensure_aside_20241219('sp')
|
||||
self.campaign_ensure_chapter(chapter)
|
||||
return True
|
||||
return False
|
||||
|
||||
def campaign_set_chapter(self, name, mode='normal'):
|
||||
"""
|
||||
|
||||
@@ -265,6 +265,7 @@ class CampaignRun(CampaignEvent, ShopStatus):
|
||||
'event_20240829_cn',
|
||||
'event_20241024_cn',
|
||||
'event_20241121_cn',
|
||||
'event_20250424_cn',
|
||||
]:
|
||||
name = convert.get(name, name)
|
||||
else:
|
||||
|
||||
@@ -1,4 +1,274 @@
|
||||
{
|
||||
"Dashboard": {
|
||||
"Oil": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Limit": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^000000",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"Coin": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Limit": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^FFAA33",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"Gem": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^FF3333",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"Pt": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^00BFFF",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"Cube": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^33FFFF",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"ActionPoint": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Total": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^0000FF",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"YellowCoin": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^FF8800",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"PurpleCoin": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^7700BB",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"Core": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^AAAAAA",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"Medal": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^FFDD00",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"Merit": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^FFFF00",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"GuildCoin": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^AAAAAA",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"ResearchPercent": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Limit": {
|
||||
"type": "input",
|
||||
"value": 100
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^00AA00",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"PlayerLevel": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^FFAA33",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"PlayerExp": {
|
||||
"Value": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Limit": {
|
||||
"type": "input",
|
||||
"value": 0
|
||||
},
|
||||
"Color": {
|
||||
"type": "input",
|
||||
"value": "^FFAA33",
|
||||
"display": "hide"
|
||||
},
|
||||
"Record": {
|
||||
"type": "datetime",
|
||||
"value": "2020-01-01 00:00:00",
|
||||
"validate": "datetime"
|
||||
}
|
||||
},
|
||||
"Storage": {
|
||||
"Storage": {
|
||||
"type": "storage",
|
||||
"value": {},
|
||||
"valuetype": "ignore",
|
||||
"display": "disabled"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Alas": {
|
||||
"Emulator": {
|
||||
"Serial": {
|
||||
@@ -607,6 +877,10 @@
|
||||
}
|
||||
},
|
||||
"Misc": {
|
||||
"GlobalSpeedup": {
|
||||
"type": "input",
|
||||
"value": 1.0
|
||||
},
|
||||
"ChapterMove": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
@@ -15777,6 +16051,24 @@
|
||||
"value": 16500
|
||||
}
|
||||
},
|
||||
"SpeedUp": {
|
||||
"Enable": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
},
|
||||
"PushLua": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
},
|
||||
"Timeout": {
|
||||
"type": "input",
|
||||
"value": 600
|
||||
},
|
||||
"Rate": {
|
||||
"type": "input",
|
||||
"value": 5
|
||||
}
|
||||
},
|
||||
"ChangeShip": {
|
||||
"Enable": {
|
||||
"type": "checkbox",
|
||||
|
||||
@@ -197,6 +197,7 @@ FakePlayer:
|
||||
Level: ""
|
||||
Id: ""
|
||||
Misc:
|
||||
GlobalSpeedup: 1.0
|
||||
ChapterMove: false
|
||||
OpsiMove: false
|
||||
RemoveHardMapLimit:
|
||||
@@ -1102,7 +1103,11 @@ ChangeAttribute:
|
||||
ShipData:
|
||||
type: textarea
|
||||
value: ''
|
||||
|
||||
SpeedUp:
|
||||
Enable: false
|
||||
PushLua: false
|
||||
Timeout: 600
|
||||
Rate: 5
|
||||
InfiniteDelay:
|
||||
Commission:
|
||||
value: false
|
||||
|
||||
@@ -60,11 +60,3 @@ Freebies:
|
||||
# ==================== Opsi ====================
|
||||
|
||||
# ==================== ChangeShip ====================
|
||||
ChangeShip:
|
||||
ShipData:
|
||||
ShipData: |
|
||||
106021;1;6
|
||||
107041;1;6
|
||||
206011;1;6
|
||||
107011;1;6
|
||||
|
||||
|
||||
@@ -514,16 +514,7 @@ EventStory:
|
||||
option: [ true, ]
|
||||
option_bold: [ true, ]
|
||||
|
||||
# ==================== GGHandler ====================
|
||||
GGHandler:
|
||||
Timeout:
|
||||
value: 1200
|
||||
ChangeShip:
|
||||
Timeout:
|
||||
value: 90
|
||||
ChangeAttribute:
|
||||
Timeout:
|
||||
value: 600
|
||||
# ==================== GameManager ====================
|
||||
|
||||
# ==================== Dashboard ====================
|
||||
Dashboard:
|
||||
|
||||
@@ -22,7 +22,6 @@ Alas:
|
||||
- OldRetire
|
||||
Restart:
|
||||
- Scheduler
|
||||
- RestartEmulator
|
||||
- AutoRestart
|
||||
- InstanceRestart
|
||||
- ExitWhenMaintenance
|
||||
@@ -493,6 +492,7 @@ Tool:
|
||||
- GameManager
|
||||
- GGHandler
|
||||
- PowerLimit
|
||||
- SpeedUp
|
||||
- ChangeShip
|
||||
- ChangeAttribute
|
||||
SomethingSpecial:
|
||||
|
||||
@@ -118,6 +118,7 @@ class GeneratedConfig:
|
||||
FakePlayer_Id = None
|
||||
|
||||
# Group `Misc`
|
||||
Misc_GlobalSpeedup = 1.0
|
||||
Misc_ChapterMove = False
|
||||
Misc_OpsiMove = False
|
||||
Misc_RemoveHardMapLimit = 'disable' # disable, remove_ship_properties_limit, remove_ship_type_limit, remove_both
|
||||
@@ -647,6 +648,12 @@ class GeneratedConfig:
|
||||
ChangeAttribute_Timeout = 600
|
||||
ChangeAttribute_ShipData = None
|
||||
|
||||
# Group `SpeedUp`
|
||||
SpeedUp_Enable = False
|
||||
SpeedUp_PushLua = False
|
||||
SpeedUp_Timeout = 600
|
||||
SpeedUp_Rate = 5
|
||||
|
||||
# Group `InfiniteDelay`
|
||||
InfiniteDelay_Commission = False
|
||||
InfiniteDelay_Research = False
|
||||
|
||||
@@ -119,6 +119,7 @@ class ManualConfig:
|
||||
MAP_HAS_MODE_SWITCH = False # event_20240725_cn has mode switch in map preparation
|
||||
# Events from 20240725 to 20241219 introduced new chapter switches
|
||||
MAP_CHAPTER_SWITCH_20241219 = False
|
||||
MAP_CHAPTER_SWITCH_20241219_SP = False
|
||||
# Since event_20241219_cn chapter B unlocks event startup
|
||||
# which means chapter AB are continuous
|
||||
STAGE_INCREASE_AB = False
|
||||
|
||||
@@ -175,7 +175,7 @@ class ConfigGenerator:
|
||||
data = {}
|
||||
# Add dashboard to args
|
||||
dashboard_and_task = {**self.task, **self.dashboard}
|
||||
for path, groups in deep_iter(dashboard_and_task, depth=3):
|
||||
for path, groups in deep_iter(dashboard_and_task, min_depth=1, depth=3):
|
||||
if 'tasks' not in path and 'Dashboard' not in path:
|
||||
continue
|
||||
task = path[2] if 'tasks' in path else path[0]
|
||||
|
||||
@@ -924,6 +924,10 @@
|
||||
"name": "Misc._info.name",
|
||||
"help": "Misc._info.help"
|
||||
},
|
||||
"GlobalSpeedup": {
|
||||
"name": "Misc.GlobalSpeedup.name",
|
||||
"help": "Misc.GlobalSpeedup.help"
|
||||
},
|
||||
"ChapterMove": {
|
||||
"name": "Misc.ChapterMove.name",
|
||||
"help": "Misc.ChapterMove.help"
|
||||
@@ -3732,6 +3736,28 @@
|
||||
"help": "ChangeAttribute.ShipData.help"
|
||||
}
|
||||
},
|
||||
"SpeedUp": {
|
||||
"_info": {
|
||||
"name": "SpeedUp._info.name",
|
||||
"help": "SpeedUp._info.help"
|
||||
},
|
||||
"Enable": {
|
||||
"name": "SpeedUp.Enable.name",
|
||||
"help": "SpeedUp.Enable.help"
|
||||
},
|
||||
"PushLua": {
|
||||
"name": "SpeedUp.PushLua.name",
|
||||
"help": "SpeedUp.PushLua.help"
|
||||
},
|
||||
"Timeout": {
|
||||
"name": "SpeedUp.Timeout.name",
|
||||
"help": "SpeedUp.Timeout.help"
|
||||
},
|
||||
"Rate": {
|
||||
"name": "SpeedUp.Rate.name",
|
||||
"help": "SpeedUp.Rate.help"
|
||||
}
|
||||
},
|
||||
"InfiniteDelay": {
|
||||
"_info": {
|
||||
"name": "InfiniteDelay._info.name",
|
||||
|
||||
@@ -924,6 +924,10 @@
|
||||
"name": "Misc._info.name",
|
||||
"help": "Misc._info.help"
|
||||
},
|
||||
"GlobalSpeedup": {
|
||||
"name": "Misc.GlobalSpeedup.name",
|
||||
"help": "Misc.GlobalSpeedup.help"
|
||||
},
|
||||
"ChapterMove": {
|
||||
"name": "Misc.ChapterMove.name",
|
||||
"help": "Misc.ChapterMove.help"
|
||||
@@ -3732,6 +3736,28 @@
|
||||
"help": "ChangeAttribute.ShipData.help"
|
||||
}
|
||||
},
|
||||
"SpeedUp": {
|
||||
"_info": {
|
||||
"name": "SpeedUp._info.name",
|
||||
"help": "SpeedUp._info.help"
|
||||
},
|
||||
"Enable": {
|
||||
"name": "SpeedUp.Enable.name",
|
||||
"help": "SpeedUp.Enable.help"
|
||||
},
|
||||
"PushLua": {
|
||||
"name": "SpeedUp.PushLua.name",
|
||||
"help": "SpeedUp.PushLua.help"
|
||||
},
|
||||
"Timeout": {
|
||||
"name": "SpeedUp.Timeout.name",
|
||||
"help": "SpeedUp.Timeout.help"
|
||||
},
|
||||
"Rate": {
|
||||
"name": "SpeedUp.Rate.name",
|
||||
"help": "SpeedUp.Rate.help"
|
||||
}
|
||||
},
|
||||
"InfiniteDelay": {
|
||||
"_info": {
|
||||
"name": "InfiniteDelay._info.name",
|
||||
|
||||
@@ -924,6 +924,10 @@
|
||||
"name": "杂项",
|
||||
"help": ""
|
||||
},
|
||||
"GlobalSpeedup": {
|
||||
"name": "全局加速",
|
||||
"help": "1表示不使用,不要开太高!"
|
||||
},
|
||||
"ChapterMove": {
|
||||
"name": "章节图移动加速",
|
||||
"help": ""
|
||||
@@ -3732,6 +3736,28 @@
|
||||
"help": "格式为\"舰船Id;舰船星级;类型Id:属性>目标值[;属性>目标值...]\"\n参考https://github.com/0O0o0oOoO00/SmallKai中的数据"
|
||||
}
|
||||
},
|
||||
"SpeedUp": {
|
||||
"_info": {
|
||||
"name": "全局倍速",
|
||||
"help": "需要和倍率一起使用"
|
||||
},
|
||||
"Enable": {
|
||||
"name": "启用",
|
||||
"help": ""
|
||||
},
|
||||
"PushLua": {
|
||||
"name": "始终推送Lua",
|
||||
"help": "有时推送时会失败,视情况开启或者关闭"
|
||||
},
|
||||
"Timeout": {
|
||||
"name": "时限(秒)",
|
||||
"help": "该项目的时限,该项数值与其他项目之和不得大于gg的"
|
||||
},
|
||||
"Rate": {
|
||||
"name": "速率",
|
||||
"help": ""
|
||||
}
|
||||
},
|
||||
"InfiniteDelay": {
|
||||
"_info": {
|
||||
"name": "无限推迟",
|
||||
|
||||
@@ -924,6 +924,10 @@
|
||||
"name": "Misc._info.name",
|
||||
"help": "Misc._info.help"
|
||||
},
|
||||
"GlobalSpeedup": {
|
||||
"name": "Misc.GlobalSpeedup.name",
|
||||
"help": "Misc.GlobalSpeedup.help"
|
||||
},
|
||||
"ChapterMove": {
|
||||
"name": "Misc.ChapterMove.name",
|
||||
"help": "Misc.ChapterMove.help"
|
||||
@@ -3732,6 +3736,28 @@
|
||||
"help": "ChangeAttribute.ShipData.help"
|
||||
}
|
||||
},
|
||||
"SpeedUp": {
|
||||
"_info": {
|
||||
"name": "SpeedUp._info.name",
|
||||
"help": "SpeedUp._info.help"
|
||||
},
|
||||
"Enable": {
|
||||
"name": "SpeedUp.Enable.name",
|
||||
"help": "SpeedUp.Enable.help"
|
||||
},
|
||||
"PushLua": {
|
||||
"name": "SpeedUp.PushLua.name",
|
||||
"help": "SpeedUp.PushLua.help"
|
||||
},
|
||||
"Timeout": {
|
||||
"name": "SpeedUp.Timeout.name",
|
||||
"help": "SpeedUp.Timeout.help"
|
||||
},
|
||||
"Rate": {
|
||||
"name": "SpeedUp.Rate.name",
|
||||
"help": "SpeedUp.Rate.help"
|
||||
}
|
||||
},
|
||||
"InfiniteDelay": {
|
||||
"_info": {
|
||||
"name": "InfiniteDelay._info.name",
|
||||
|
||||
@@ -66,6 +66,7 @@ class GGHandler:
|
||||
self.handle_u2_restart()
|
||||
success = self.change_attribute()
|
||||
success = self.multiplier() and success
|
||||
success = self.speed_up() and success
|
||||
# if not success:
|
||||
# from module.exception import GameStuckError
|
||||
# raise GameStuckError
|
||||
@@ -350,6 +351,18 @@ class GGHandler:
|
||||
# self.gg.set_on('change_attribute')
|
||||
return True
|
||||
|
||||
def speed_up(self):
|
||||
if not deep_get(self.config.data, "GameManager.SpeedUp.Enable"):
|
||||
return False
|
||||
success = timeout(self.gg.set_on,
|
||||
timeout_sec=deep_get(self.config.data, "GameManager.GGHandler.Timeout"),
|
||||
func='speedup',
|
||||
factor=self.factor)
|
||||
self.GGData.set_data(target='gg_on', value=True)
|
||||
|
||||
# success = self.gg.set_on(factor=self.factor)
|
||||
return True
|
||||
|
||||
def multiplier(self):
|
||||
logger.hr('GG Multiplier', level=2)
|
||||
success = timeout(self.gg.set_on,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from module.gg_handler.speedup import SpeedUp
|
||||
from module.logger import logger
|
||||
from module.gg_handler.gg_data import GGData
|
||||
from module.config.config import deep_get
|
||||
@@ -34,7 +35,7 @@ class GGU2(Base):
|
||||
|
||||
def set_on(self, func='multiplier', factor=200):
|
||||
"""
|
||||
func : 'multiplier' or 'change_type' or 'change_attribute'
|
||||
func : 'multiplier' or 'change_type' or 'change_attribute' or 'speedup'
|
||||
factor : factor used in multiplier
|
||||
"""
|
||||
_name_dict = {
|
||||
@@ -160,6 +161,10 @@ class GGU2(Base):
|
||||
# self.d.app_stop(self.gg_package_name)
|
||||
return 1
|
||||
|
||||
def speedup(self):
|
||||
speedup = SpeedUp(self.config, self.device)
|
||||
speedup.Run()
|
||||
|
||||
def multiplier(self):
|
||||
_run = False
|
||||
_set = False
|
||||
|
||||
81
module/gg_handler/speedup.py
Normal file
81
module/gg_handler/speedup.py
Normal file
@@ -0,0 +1,81 @@
|
||||
from module.gg_handler.gg_data import GGData
|
||||
from module.logger import logger
|
||||
from module.config.deep import deep_get, deep_set
|
||||
from module.base.base import ModuleBase
|
||||
import uiautomator2 as u2
|
||||
|
||||
|
||||
class SpeedUp(ModuleBase):
|
||||
|
||||
def __init__(self, config, device):
|
||||
super().__init__(config, device)
|
||||
self.d = u2.connect(self.device.serial)
|
||||
self.gg_package_name = deep_get(self.config.data, keys='GameManager.GGHandler.GGPackageName')
|
||||
|
||||
def Run(self):
|
||||
_run = False
|
||||
_set = False
|
||||
_confirmed = False
|
||||
import os
|
||||
rate = float(deep_get(self.config.data, keys='GameManager.SpeedUp.Rate', default=5.0))
|
||||
_repush = deep_get(self.config.data, keys='GameManager.SpeedUp.PushLua')
|
||||
if _repush:
|
||||
self.device.adb_shell("mkdir /sdcard/Notes")
|
||||
self.device.sleep(0.5)
|
||||
self.device.adb_shell("rm /sdcard/Notes/SpeedUp.lua")
|
||||
self.device.sleep(0.5)
|
||||
self.device.adb_push("bin/Lua/SpeedUp.lua", "/sdcard/Notes/SpeedUp.lua")
|
||||
self.device.sleep(0.5)
|
||||
logger.info('Lua Pushed')
|
||||
while 1:
|
||||
self.device.sleep(1)
|
||||
if self.d(resourceId=f"{self.gg_package_name}:id/search_toolbar").exists:
|
||||
self.d.xpath(
|
||||
f'//*[@resource-id="{self.gg_package_name}'
|
||||
f':id/search_toolbar"]/android.widget.ImageView[last()]'
|
||||
).click()
|
||||
logger.info('Click run Scripts')
|
||||
self.device.sleep(0.3)
|
||||
if self.d(resourceId=f"{self.gg_package_name}:id/file").exists:
|
||||
self.d(resourceId=f"{self.gg_package_name}:id/file").send_keys("/sdcard/Notes/SpeedUp.lua")
|
||||
logger.info('Lua path set')
|
||||
if self.d.xpath('//*[@text="执行"]').exists:
|
||||
self.d.xpath('//*[@text="执行"]').click()
|
||||
logger.info('Click Run')
|
||||
self.device.sleep(0.5)
|
||||
if self.d.xpath('//*[contains(@text,"设置倍速")]').exists:
|
||||
self.d.xpath('//*[contains(@text,"设置倍速")]').click()
|
||||
logger.info('Click Change Statistic')
|
||||
self.device.sleep(0.5)
|
||||
if self.d(resourceId=f"{self.gg_package_name}:id/edit").exists:
|
||||
self.d(resourceId=f"{self.gg_package_name}:id/edit").send_keys(f"{rate}")
|
||||
logger.info(f'Factor Set: {rate}')
|
||||
self.device.sleep(0.5)
|
||||
_set = True
|
||||
if _set and self.d.xpath('//*[@text="确定"]').exists:
|
||||
self.d.xpath('//*[@text="确定"]').click()
|
||||
logger.info("Click confirm")
|
||||
self.device.sleep(0.5)
|
||||
_confirmed = True
|
||||
if _confirmed:
|
||||
self.d.wait_timeout = deep_get(self.config.data, "GameManager.SpeedUp.Timeout")
|
||||
logger.info(f'Xpath timeout set to {self.d.wait_timeout} seconds')
|
||||
|
||||
if _set and _confirmed:
|
||||
try:
|
||||
# GGData(self.config).set_data(target='gg_on', value=True)
|
||||
self.d.xpath('//*[@text="确定"]').click()
|
||||
except Exception as e:
|
||||
pass
|
||||
# GGData(self.config).set_data(target='gg_on', value=True)
|
||||
logger.attr('GG', 'Enabled')
|
||||
logger.info("Close the script")
|
||||
self.d.wait_timeout = 3
|
||||
logger.info(f'Xpath timeout set to {self.d.wait_timeout} seconds')
|
||||
if _set and _confirmed:
|
||||
break
|
||||
else:
|
||||
return 0
|
||||
logger.hr('GG Enabled: SpeedUp', level=2)
|
||||
# self.d.app_stop(self.gg_package_name)
|
||||
return 1
|
||||
@@ -44,6 +44,9 @@ class CrackApi:
|
||||
exp: int
|
||||
curr_star: int
|
||||
|
||||
class GlobalSpeedupRate(BaseModel):
|
||||
rate: float
|
||||
|
||||
def __init__(self, base_url):
|
||||
self.api_url = base_url
|
||||
|
||||
@@ -231,5 +234,11 @@ class CrackApi:
|
||||
def disable_opsi_fast_move(self):
|
||||
self.post("disable_opsi_fast_move")
|
||||
|
||||
def enable_global_speedup(self, rate: GlobalSpeedupRate):
|
||||
self.post("enable_global_speedup", data=rate.json())
|
||||
|
||||
def disable_global_speedup(self):
|
||||
self.post("disable_global_speedup")
|
||||
|
||||
def is_alive(self):
|
||||
self.post("is_alive")
|
||||
|
||||
@@ -27,6 +27,7 @@ ALL_ENABLE_OPS = [
|
||||
CrackOp.EnableRemoveHardModeShipTypeLimit,
|
||||
CrackOp.EnableRemoveHardModeShipPropertiesLimit,
|
||||
CrackOp.EnableGGFactor,
|
||||
CrackOp.EnableGlobalSpeedup,
|
||||
]
|
||||
|
||||
REMOTE_PORT = 23897
|
||||
@@ -156,6 +157,13 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
api.enable_gg_factor()
|
||||
elif op == CrackOp.DisableGGFactor:
|
||||
api.disable_gg_factor()
|
||||
elif op == CrackOp.EnableGlobalSpeedup:
|
||||
rate = float(deep_get(config.data, "Hook.Misc.GlobalSpeedup", 1.0))
|
||||
if rate == 1.0:
|
||||
continue
|
||||
api.enable_global_speedup(CrackApi.GlobalSpeedupRate(rate=rate))
|
||||
elif op == CrackOp.DisableGlobalSpeedup:
|
||||
api.disable_global_speedup()
|
||||
else:
|
||||
logger.error(f"Unsupported op: {op}")
|
||||
|
||||
@@ -204,6 +212,7 @@ CHAPTER_CRACK_OPS = [
|
||||
CrackOp.EnableRemoveHardModeLimit,
|
||||
CrackOp.EnableFakePlayer,
|
||||
CrackOp.EnableGGFactor,
|
||||
CrackOp.EnableGlobalSpeedup,
|
||||
]
|
||||
|
||||
|
||||
@@ -222,6 +231,7 @@ OPSI_CRACK_OPS = [
|
||||
CrackOp.EnableGlobalShipProperties,
|
||||
CrackOp.EnableFakePlayer,
|
||||
CrackOp.EnableGGFactor,
|
||||
CrackOp.EnableGlobalSpeedup,
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,12 @@ class CrackOp:
|
||||
class DisableFakePlayer(Op):
|
||||
...
|
||||
|
||||
class EnableGlobalSpeedup(Op):
|
||||
...
|
||||
|
||||
class DisableGlobalSpeedup(Op):
|
||||
...
|
||||
|
||||
class EnableNoBBAnimation(Op):
|
||||
...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user