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(
7172void (*old_AddItem)(void *instance, void *item, int count);
7273
7374void 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
7783void (*old_AddCharacterTemptation)(void *instance, void *character, int added);
@@ -85,30 +91,40 @@ void (*old_Load)(void *instance);
8591void 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