Skip to content

Commit 8899a8e

Browse files
committed
wet-wealth
1 parent f5f4d27 commit 8899a8e

3 files changed

Lines changed: 77 additions & 24 deletions

File tree

.idea/deploymentTargetSelector.xml

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Sets the minimum CMake version required for this project.
66
cmake_minimum_required(VERSION 4.0)
7-
set(CMAKE_CXX_STANDARD 20)
7+
set(CMAKE_CXX_STANDARD 23)
88

99
# Declares the project name. The project name can be accessed via ${ PROJECT_NAME},
1010
# Since this is the top level CMakeLists.txt, the project name is also accessible

app/src/main/cpp/wet-wealth.cpp

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <BNM/Method.hpp>
1111
#include <BNM/Loading.hpp>
1212
#include <BNM/Property.hpp>
13+
#include <algorithm>
1314
#include "utils.h"
1415

1516

@@ -71,7 +72,12 @@ Java_com_android_support_Menu_valueChange(
7172
void (*old_AddItem)(void *instance, void *item, int count);
7273

7374
void new_AddItem(void *instance, void *item, int count) {
74-
return old_AddItem(instance, item, count * feature.reward);
75+
std::vector<int> ids = {550, 551, 1270, 1253, 10267, 10432, 12131, 12307, 14633, 16708};
76+
auto unnyId = GetProperty<int>(item, "IntUnnyId");
77+
if (std::ranges::contains(ids, unnyId)) {
78+
count *= feature.reward;
79+
}
80+
old_AddItem(instance, item, count);
7581
}
7682

7783
void (*old_AddCharacterTemptation)(void *instance, void *character, int added);
@@ -85,30 +91,40 @@ void (*old_Load)(void *instance);
8591
void new_Load(BNM::IL2CPP::Il2CppObject *instance) {
8692
old_Load(instance);
8793
if (feature.characters) {
88-
auto characters = GetMethod<BNM::IL2CPP::Il2CppObject *>(instance, "get_Characters")();
94+
auto userCharacterFactory = GetField<void *>(instance, "userCharacterFactory");
95+
auto characterStaticUsecase = GetField<void *>(userCharacterFactory,
96+
"characterStaticUsecase");
97+
auto characters = GetProperty<void *>(characterStaticUsecase,
98+
"Characters");
8999
auto count = GetMethod<int>(characters, "get_Count")();
90100
for (int i = 0; i < count; i++) {
91-
auto character = GetMethod<BNM::IL2CPP::Il2CppObject *>(characters, "get_Item")(i);
92-
GetMethod<void>(instance, "AddCharacterExp")(character, 100);
101+
auto character = GetMethod<void *>(characters, "get_Item")(i);
102+
auto id = GetProperty<int>(character, "Id");
103+
GetMethod<void>(instance, "AddCharacterOrExperience")(id, 100);
93104
}
94105
}
95106
}
96107

108+
bool (*old_TryBuyVip)(void *instance);
97109

98-
int (*old_GetLocationCurrentLevel)(void *instance, void *config);
110+
bool new_TryBuyVip(void *instance) {
111+
auto monthlyVipUsecase = GetField<void *>(instance, "monthlyVipUsecase");
112+
auto userInventoryUsecase = GetField<void *>(monthlyVipUsecase, "userInventoryUsecase");
113+
auto vipAccessKey = GetMethod<void *>(instance, "GetVipAccessKey")();
114+
GetMethod<void>(userInventoryUsecase, "AddItem")(vipAccessKey, 1);
115+
return true;
116+
}
99117

100-
int new_GetLocationCurrentLevel(BNM::IL2CPP::Il2CppObject *instance,
101-
BNM::IL2CPP::Il2CppObject *config) {
102-
int level = old_GetLocationCurrentLevel(instance, config);
103-
if (level > 5) {
104-
auto staticItems = GetProperty<BNM::IL2CPP::Il2CppObject *>(config, "LocationKey");
105-
auto userInventoryUsecase = GetField<BNM::IL2CPP::Il2CppObject *>(instance,
106-
"userInventoryUsecase");
107-
auto RemoveItem = GetMethod<void>(userInventoryUsecase, "RemoveItem");
108-
RemoveItem(staticItems, level - 5);
109-
level = 5;
110-
}
111-
return level;
118+
void (*old_TryBuy)(void *instance, void *config);
119+
120+
void new_TryBuy(void *instance, void *config) {
121+
auto key = GetProperty<void *>(config, "Key");
122+
auto usecase = GetField<void *>(instance, "usecase");
123+
auto inventoryUsecase = GetField<void *>(usecase, "inventoryUsecase");
124+
GetMethod<void>(inventoryUsecase, "AddItem")(key, 1);
125+
126+
auto OnPurchased = GetField<void *>(instance, "OnPurchased");
127+
GetMethod<void>(OnPurchased, "Invoke")(config);
112128
}
113129

114130

@@ -126,15 +142,19 @@ void OnLoaded() {
126142
auto Load = UserCharactersUsecase.GetMethod("Load");
127143
auto AddCharacterTemptation = UserCharactersUsecase.GetMethod("AddCharacterTemptation");
128144

129-
auto CityPaidLocationsUsecase = BNM::Class("WetWealth.PaidLocations",
130-
"CityPaidLocationsUsecase",
131-
AssemblyCSharp);
132-
auto GetLocationCurrentLevel = CityPaidLocationsUsecase.GetMethod("GetLocationCurrentLevel");
145+
auto MonthlyVipPresenter = BNM::Class("WetWealth.SlotMachine",
146+
"MonthlyVipPresenter",
147+
AssemblyCSharp);
148+
auto TryBuyVip = MonthlyVipPresenter.GetMethod("TryBuyVip");
133149

150+
auto BuildingRepairPresenter = BNM::Class("WetWealth.BuildingRepair",
151+
"BuildingRepairPresenter",
152+
AssemblyCSharp);
153+
auto TryBuy = BuildingRepairPresenter.GetMethod("TryBuy");
134154

135155
BNM::BasicHook(AddItem, new_AddItem, old_AddItem);
136156
BNM::BasicHook(Load, new_Load, old_Load);
137157
BNM::BasicHook(AddCharacterTemptation, new_AddCharacterTemptation, old_AddCharacterTemptation);
138-
BNM::BasicHook(GetLocationCurrentLevel, new_GetLocationCurrentLevel,
139-
old_GetLocationCurrentLevel);
158+
BNM::BasicHook(TryBuyVip, new_TryBuyVip, old_TryBuyVip);
159+
BNM::BasicHook(TryBuy, new_TryBuy, old_TryBuy);
140160
}

0 commit comments

Comments
 (0)