Skip Cutscenes
Profile Changer
Paimon Follow
Fixed Auto Cooking
This commit is contained in:
RyujinZX 2022-06-12 06:21:18 +03:00
parent 2328cbaf9b
commit 351d3f3f78
3 changed files with 95 additions and 44 deletions

View File

@ -148,19 +148,23 @@ DO_APP_FUNC(0x04C9A750, void, MoleMole_LCIndicatorPlugin_HideIcon, (LCIndicatorP
DO_APP_FUNC(0x02854E30, void, MoleMole_PlayerModule_RequestPlayerCook, (MoleMole_PlayerModule* __this, uint32_t recipeId, uint32_t avatarId, uint32_t qteQuality, uint32_t count, MethodInfo* method));
DO_APP_FUNC(0x02858180, void, MoleMole_PlayerModule_OnPlayerCookRsp, (MoleMole_PlayerModule* __this, PlayerCookRsp* rsp, MethodInfo* method));
DO_APP_FUNC(0x033F5820, void, MoleMole_CookingQtePageContext_UpdateProficiency, (CookingQtePageContext* __this, MethodInfo* method));
DO_APP_FUNC(0x0116AA10, uint32_t, CookRecipeExcelConfig_get_maxProficiency, (CookRecipeExcelConfig* __this, MethodInfo* method));
DO_APP_FUNC(0x008ECD70, uint32_t, MoleMole_Config_CookRecipeExcelConfig_CheckCookFoodMaxNum, (uint32_t UpdateCookRecipeDic, MethodInfo* method));
DO_APP_FUNC(0x032256C0, void, CookingQtePageContext_CloseItemGotPanel, (CookingQtePageContext* __this, MethodInfo* method));
// Profile Changer | RyujinZX#6666
DO_APP_FUNC(0x027A41A0, Button_1*, ProfilePage, (MonoInLevelPlayerProfilePage* __this, MethodInfo* method)); // MonoInLevelPlayerProfilePage_get_logoutButton
DO_APP_FUNC(0x016A77B0, void, ProfileEditPage, (MonoFriendInformationDialog* __this, Sprite* value, MethodInfo* method)); // MonoFriendInformationDialog_set_icon
// Game Object Utility
// Game Object, Component, Transform Utility
DO_APP_FUNC(0x0662F130, GameObject*, GameObject_Find, (String* name, MethodInfo* method));
DO_APP_FUNC(0x0662F190, Component_1*, GameObject_GetComponentByName, (GameObject* __this, String* type, MethodInfo* method));
DO_APP_FUNC(0x0662F660, bool, GameObject_get_active, (GameObject* __this, MethodInfo* method));
DO_APP_FUNC(0x0662F720, void, GameObject_set_active, (GameObject* __this, bool value, MethodInfo* method));
DO_APP_FUNC(0x065546E0, Transform*, Transform_GetChild, (Transform* __this, int32_t index, MethodInfo* method));
DO_APP_FUNC(0x0652EA10, Component_1*, Component_1_GetComponent_1, (Component_1* __this, String* type, MethodInfo* method));
// Utility
DO_APP_FUNC(0x03551B60, String*, Text_get_text, (Text* __this, MethodInfo* method));
DO_APP_FUNC(0x06568060, void, Text_set_text, (Text* __this, String* value, MethodInfo* method));
DO_APP_FUNC(0x0658D6B0, void, Slider_1_set_value, (Slider_1* __this, float value, MethodInfo* method));
DO_APP_FUNC(0x0658D560, void, Slider_1_set_maxValue, (Slider_1* __this, float value, MethodInfo* method));

View File

@ -6,22 +6,27 @@
namespace cheat::feature
{
namespace GameObject {
app::GameObject* Profirency = nullptr;
}
namespace Components {
app::Component_1* Profirency = nullptr;
}
static void PlayerModule_RequestPlayerCook(app::MoleMole_PlayerModule* __this, uint32_t recipeId, uint32_t avatarId, uint32_t qteQuality, uint32_t count, MethodInfo* method);
static void PlayerModule_OnPlayerCookRsp(app::MoleMole_PlayerModule* __this, app::PlayerCookRsp* rsp, MethodInfo* method);
static void CookingQtePageContext_UpdateProficiency(app::CookingQtePageContext* __this, MethodInfo* method);
static void CookingQtePageContext_SetProficiencyInfo(app::CookingQtePageContext* __this, MethodInfo* method);
static uint32_t CookRecipeExcelConfig_get_maxProficiency(app::CookRecipeExcelConfig* __this, MethodInfo* method);
AutoCook::AutoCook() : Feature(),
NF(f_Enabled, "Auto Cooking", "AutoCook", false),
NF(f_Count, "Count Item", "AutoCook", 1),
NF(f_Quality, "Quality", "AutoCook", 1)
NF(f_Enabled, "Standart Cooking", "AutoCook", false),
NF(f_FastProficiency, "Fast Proficiency", "AutoCook", false),
NF(f_CountField, "Count Item", "AutoCook", 1),
NF(f_QualityField, "Quality", "AutoCook", 1)
{
HookManager::install(app::MoleMole_PlayerModule_RequestPlayerCook, PlayerModule_RequestPlayerCook);
HookManager::install(app::MoleMole_PlayerModule_OnPlayerCookRsp, PlayerModule_OnPlayerCookRsp);
HookManager::install(app::MoleMole_PlayerModule_OnPlayerCookRsp, PlayerModule_OnPlayerCookRsp);
HookManager::install(app::MoleMole_CookingQtePageContext_UpdateProficiency, CookingQtePageContext_UpdateProficiency);
HookManager::install(app::CookRecipeExcelConfig_get_maxProficiency, CookRecipeExcelConfig_get_maxProficiency);
}
const FeatureGUIInfo& AutoCook::GetGUIInfo() const
@ -32,11 +37,13 @@ namespace cheat::feature
void AutoCook::DrawMain()
{
ConfigWidget(f_Enabled, "Automatic cooking.");
ConfigWidget("Count Item", f_Count, 1, 1, 100,
ConfigWidget(f_Enabled, "Fast Cooking if the recipe has fast cooking open. \n" \
"If fast cooking is closed, you in addition need to turn on Fast Proficiency.");
ConfigWidget(f_FastProficiency, "Quickly prepare an unstudied recipe to the maximum possible.");
ConfigWidget("Count Item", f_CountField, 1, 1, 100,
"How much to cook at a time.\n" \
"(If the recipe is not fully explored, set it to 1.)");
ConfigWidget("Quality Cooking", f_Quality, 1, 1, 3, "Quality of the cook.");
"(For standard mode only.)");
ConfigWidget("Quality Cooking", f_QualityField, 1, 1, 3, "Quality of the cook.");
}
bool AutoCook::NeedStatusDraw() const
@ -46,7 +53,7 @@ namespace cheat::feature
void AutoCook::DrawStatus()
{
ImGui::Text("Auto Cook");
ImGui::Text("Auto Cooking [%s]", f_FastProficiency ? "Proficiency" : "Standart");
}
AutoCook& AutoCook::GetInstance()
@ -57,51 +64,88 @@ namespace cheat::feature
// Auto Cooking | RyujinZX#6666
std::vector<std::string> split(std::string& s, char delimeter)
{
std::stringstream ss(s);
std::string item;
std::vector<std::string> tokens;
while (std::getline(ss, item, delimeter))
{
tokens.push_back(item);
}
return tokens;
}
static void PlayerModule_RequestPlayerCook(app::MoleMole_PlayerModule* __this, uint32_t recipeId, uint32_t avatarId, uint32_t qteQuality, uint32_t count, MethodInfo* method)
{
AutoCook& autoCook = AutoCook::GetInstance();
if (autoCook.f_Enabled)
if (autoCook.f_Enabled || autoCook.f_FastProficiency)
{
qteQuality = autoCook.f_Quality;
count = autoCook.f_Count;
}
autoCook.CookFoodMaxNum = app::MoleMole_Config_CookRecipeExcelConfig_CheckCookFoodMaxNum(recipeId, nullptr);
qteQuality = autoCook.f_QualityField;
return CALL_ORIGIN(PlayerModule_RequestPlayerCook, __this, recipeId, avatarId, qteQuality, count, method);
if (!autoCook.f_FastProficiency && autoCook.f_Enabled){
count = autoCook.f_CountField;
if (autoCook.f_CountField > autoCook.CookFoodMaxNum)
count = autoCook.CookFoodMaxNum;
return CALL_ORIGIN(PlayerModule_RequestPlayerCook, __this, recipeId, avatarId, qteQuality, count, method);
}
if (autoCook.f_Enabled && autoCook.f_FastProficiency) {
count = 1;
GameObject::Profirency = app::GameObject_Find(string_to_il2cppi("/Canvas/Pages/CookingPage/GrpCooking/GrpTab/GrpItemTips/CookingItemTip/Viewport/ItemTips_Cooking(Clone)/Content/GrpProficiency/Level/"), nullptr);
auto RectTransform = app::GameObject_GetComponentByName(GameObject::Profirency, string_to_il2cppi("RectTransform"), nullptr);
auto TransformChild = app::Transform_GetChild(reinterpret_cast<app::Transform*>(RectTransform), 0, nullptr);
auto TextComponent = app::Component_1_GetComponent_1(reinterpret_cast<app::Component_1*>(TransformChild), string_to_il2cppi("Text"), nullptr);
if (TextComponent != nullptr) {
auto Text_str = app::Text_get_text(reinterpret_cast<app::Text*>(TextComponent), nullptr);
auto ProficiencyStr = il2cppi_to_string(Text_str).erase(0, il2cppi_to_string(Text_str).find_first_of(" ."));
std::vector<std::string> FinalProficiency = split(ProficiencyStr, '/');
autoCook.CookCount = atoi(FinalProficiency[1].c_str()) - atoi(FinalProficiency[0].c_str());
}
if (autoCook.CookCount == 0)
autoCook.CookCount = 1;
if (autoCook.CookCount > autoCook.CookFoodMaxNum)
autoCook.CookCount = autoCook.CookFoodMaxNum;
for (int i = 1; i <= autoCook.CookCount; i++) {
CALL_ORIGIN(PlayerModule_RequestPlayerCook, __this, recipeId, avatarId, qteQuality, count, method);
}
}
}
else {
return CALL_ORIGIN(PlayerModule_RequestPlayerCook, __this, recipeId, avatarId, qteQuality, count, method);
}
}
static void PlayerModule_OnPlayerCookRsp(app::MoleMole_PlayerModule* __this, app::PlayerCookRsp* rsp, MethodInfo* method) {
static void PlayerModule_OnPlayerCookRsp(app::MoleMole_PlayerModule* __this, app::PlayerCookRsp* rsp, MethodInfo* method) {
AutoCook& autoCook = AutoCook::GetInstance();
if (autoCook.f_Enabled)
if (autoCook.f_Enabled || autoCook.f_FastProficiency)
{
rsp->fields.qteQuality_ = autoCook.f_Quality;
rsp->fields.cookCount_ = autoCook.f_Count;
// Unlock Quick Cooking, It will reset after a restart, so it is better to study the recipe in full at once.
if (rsp->fields.recipeData_ != nullptr)
rsp->fields.recipeData_->fields.proficiency_ = autoCook.CookCount;
rsp->fields.qteQuality_ = autoCook.f_QualityField;
rsp->fields.cookCount_ = autoCook.f_CountField;
if (autoCook.f_FastProficiency)
rsp->fields.cookCount_ = 1;
// if (rsp->fields.recipeData_ != nullptr)
// rsp->fields.recipeData_->fields.proficiency_ = autoCook.CookCount;
}
return CALL_ORIGIN(PlayerModule_OnPlayerCookRsp, __this, rsp, method);
}
static void CookingQtePageContext_UpdateProficiency(app::CookingQtePageContext* __this, MethodInfo* method) {
AutoCook& autoCook = AutoCook::GetInstance();
if (autoCook.f_Enabled)
if (autoCook.f_Enabled || autoCook.f_FastProficiency)
{
__this->fields._pageMono->fields._qteTime = 0;
__this->fields._pageMono->fields._autoQteTime = 0;
app::CookingQtePageContext_CloseItemGotPanel(__this, nullptr); // Auto Close Panel
}
return CALL_ORIGIN(CookingQtePageContext_UpdateProficiency, __this, method);
}
static uint32_t CookRecipeExcelConfig_get_maxProficiency(app::CookRecipeExcelConfig* __this, MethodInfo* method) {
AutoCook& autoCook = AutoCook::GetInstance();
if (autoCook.f_Enabled)
{
uint32_t maxCount = app::MoleMole_SimpleSafeUInt32_get_Value(__this->fields.maxProficiencyRawNum, nullptr);
autoCook.CookCount = maxCount;
}
return CALL_ORIGIN(CookRecipeExcelConfig_get_maxProficiency, __this, method);
}
}

View File

@ -9,10 +9,13 @@ namespace cheat::feature
{
public:
config::Field<config::Toggle<Hotkey>> f_Enabled;
config::Field<int> f_Count;
config::Field<int> f_Quality;
config::Field<config::Toggle<Hotkey>> f_FastProficiency;
uint32_t CookCount;
config::Field<int> f_CountField;
config::Field<int> f_QualityField;
int CookFoodMaxNum; // Maximum quantity at a time
int CookCount;
static AutoCook& GetInstance();