Skip to content

Commit 2eee788

Browse files
committed
1.33 ( Patched Premium checking in all apps )
Now premium will work wherever there is a subscription through Overwolf
1 parent 7bd8b60 commit 2eee788

File tree

3 files changed

+381
-194
lines changed

3 files changed

+381
-194
lines changed
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
using Mono.Cecil;
2+
using Mono.Cecil.Cil;
3+
using Mono.Cecil.Rocks;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
10+
11+
namespace OverwolfInsiderPatcher
12+
{
13+
internal class InjectMethods
14+
{
15+
public static MethodDefinition OverwolfCoreGetExtensionSubscriptions(ref AssemblyDefinition overwolfCore, MethodDefinition overwolfCoreGES)
16+
{
17+
overwolfCoreGES.Body.ExceptionHandlers.Clear();
18+
overwolfCoreGES.Body.Variables.Clear();
19+
overwolfCoreGES.Body.Instructions.Clear();
20+
GenericInstanceType list = new GenericInstanceType(overwolfCore.MainModule.ImportReference(typeof(List<>))); //overwolfCore.MainModule.Import();
21+
TypeReference DetailedActivePlan;
22+
23+
if (overwolfCore.MainModule.TryGetTypeReference("ODKv2API.DetailedActivePlan", out DetailedActivePlan)) // Get already imported class instead of import Overwolf.ODK.Common
24+
{
25+
TypeDefinition DetailedActivePlanDef = DetailedActivePlan.Resolve();
26+
list.GenericArguments.Add(DetailedActivePlan);
27+
VariableDefinition dapV = new VariableDefinition(list); // List<DetailedActivePlan>
28+
VariableDefinition iV = new VariableDefinition(overwolfCore.MainModule.ImportReference(typeof(int)));
29+
overwolfCoreGES.Body.Variables.Add(dapV);
30+
overwolfCoreGES.Body.Variables.Add(iV);
31+
32+
{
33+
34+
TypeReference List = overwolfCore.MainModule.ImportReference(overwolfCore.MainModule.ImportReference(Type.GetType("System.Collections.Generic.List`1")).MakeGenericInstanceType(new TypeReference[] { DetailedActivePlan }));
35+
36+
37+
MethodDefinition listCtor = List.Resolve().Methods.First(x => x.Name == ".ctor");
38+
var listCtorRef = overwolfCore.MainModule.ImportReference(listCtor, List);
39+
listCtorRef.DeclaringType = List;
40+
MethodDefinition listToArray = List.Resolve().Methods.First(x => x.Name == "ToArray");
41+
var listToArrayRef = overwolfCore.MainModule.ImportReference(listToArray);
42+
listToArrayRef.DeclaringType = List;
43+
MethodDefinition listAdd = List.Resolve().Methods.First(x => x.Name == "Add");
44+
var listlistAddRef = overwolfCore.MainModule.ImportReference(listAdd);
45+
listlistAddRef.DeclaringType = List;
46+
47+
48+
49+
50+
overwolfCoreGES.Body.SimplifyMacros();
51+
for (int i = 0; i < 39; i++)
52+
{
53+
overwolfCoreGES.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
54+
}
55+
overwolfCoreGES.Body.Instructions[0] = (Instruction.Create(OpCodes.Newobj, listCtorRef));
56+
overwolfCoreGES.Body.Instructions[1] = (Instruction.Create(OpCodes.Stloc_0));
57+
overwolfCoreGES.Body.Instructions[2] = (Instruction.Create(OpCodes.Ldc_I4_0));
58+
overwolfCoreGES.Body.Instructions[3] = (Instruction.Create(OpCodes.Stloc_1));
59+
overwolfCoreGES.Body.Instructions[5] = (Instruction.Create(OpCodes.Ldloc_0));
60+
overwolfCoreGES.Body.Instructions[6] = (Instruction.Create(OpCodes.Newobj, overwolfCore.MainModule.ImportReference(DetailedActivePlanDef.Methods.First(x => x.Name == ".ctor")))); // DetailedActivePlanR constructor
61+
overwolfCoreGES.Body.Instructions[7] = (Instruction.Create(OpCodes.Dup));
62+
overwolfCoreGES.Body.Instructions[8] = (Instruction.Create(OpCodes.Ldc_R4, 1.0f));
63+
overwolfCoreGES.Body.Instructions[9] = (Instruction.Create(OpCodes.Callvirt, overwolfCore.MainModule.ImportReference(DetailedActivePlanDef.Methods.First(x => x.Name == "set_Price"))));
64+
overwolfCoreGES.Body.Instructions[10] = (Instruction.Create(OpCodes.Dup));
65+
overwolfCoreGES.Body.Instructions[11] = (Instruction.Create(OpCodes.Ldloc_1));
66+
overwolfCoreGES.Body.Instructions[12] = (Instruction.Create(OpCodes.Callvirt, overwolfCore.MainModule.ImportReference(DetailedActivePlanDef.Methods.First(x => x.Name == "set_PlanId"))));
67+
overwolfCoreGES.Body.Instructions[13] = (Instruction.Create(OpCodes.Dup));
68+
overwolfCoreGES.Body.Instructions[14] = (Instruction.Create(OpCodes.Ldstr, "All questions -> https://t.me/DecoderCoder"));
69+
overwolfCoreGES.Body.Instructions[15] = (Instruction.Create(OpCodes.Callvirt, overwolfCore.MainModule.ImportReference(DetailedActivePlanDef.Methods.First(x => x.Name == "set_Description"))));
70+
overwolfCoreGES.Body.Instructions[16] = (Instruction.Create(OpCodes.Dup));
71+
overwolfCoreGES.Body.Instructions[17] = (Instruction.Create(OpCodes.Ldc_I4_0));
72+
overwolfCoreGES.Body.Instructions[18] = (Instruction.Create(OpCodes.Callvirt, overwolfCore.MainModule.ImportReference(DetailedActivePlanDef.Methods.First(x => x.Name == "set_State"))));
73+
overwolfCoreGES.Body.Instructions[19] = (Instruction.Create(OpCodes.Dup));
74+
overwolfCoreGES.Body.Instructions[20] = (Instruction.Create(OpCodes.Ldstr, "cracked by Decode"));
75+
overwolfCoreGES.Body.Instructions[21] = (Instruction.Create(OpCodes.Callvirt, overwolfCore.MainModule.ImportReference(DetailedActivePlanDef.Methods.First(x => x.Name == "set_Title"))));
76+
overwolfCoreGES.Body.Instructions[22] = (Instruction.Create(OpCodes.Dup));
77+
overwolfCoreGES.Body.Instructions[23] = (Instruction.Create(OpCodes.Ldc_I4, 9999));
78+
overwolfCoreGES.Body.Instructions[24] = (Instruction.Create(OpCodes.Callvirt, overwolfCore.MainModule.ImportReference(DetailedActivePlanDef.Methods.First(x => x.Name == "set_PeriodMonths"))));
79+
overwolfCoreGES.Body.Instructions[25] = (Instruction.Create(OpCodes.Dup));
80+
overwolfCoreGES.Body.Instructions[26] = (Instruction.Create(OpCodes.Ldc_I8, 32511218423000));
81+
overwolfCoreGES.Body.Instructions[27] = (Instruction.Create(OpCodes.Callvirt, overwolfCore.MainModule.ImportReference(DetailedActivePlanDef.Methods.First(x => x.Name == "set_ExpiryDate"))));
82+
overwolfCoreGES.Body.Instructions[28] = (Instruction.Create(OpCodes.Callvirt, listlistAddRef));
83+
overwolfCoreGES.Body.Instructions[29] = (Instruction.Create(OpCodes.Ldloc_1));
84+
overwolfCoreGES.Body.Instructions[30] = (Instruction.Create(OpCodes.Ldc_I4_1));
85+
overwolfCoreGES.Body.Instructions[31] = (Instruction.Create(OpCodes.Add));
86+
overwolfCoreGES.Body.Instructions[32] = (Instruction.Create(OpCodes.Stloc_1));
87+
overwolfCoreGES.Body.Instructions[33] = (Instruction.Create(OpCodes.Ldloc_1));
88+
overwolfCoreGES.Body.Instructions[34] = (Instruction.Create(OpCodes.Ldc_I4, 9999));
89+
overwolfCoreGES.Body.Instructions[35] = (Instruction.Create(OpCodes.Blt_S, overwolfCoreGES.Body.Instructions[5]));
90+
overwolfCoreGES.Body.Instructions[36] = (Instruction.Create(OpCodes.Ldloc_0));
91+
overwolfCoreGES.Body.Instructions[37] = (Instruction.Create(OpCodes.Callvirt, listToArrayRef));
92+
overwolfCoreGES.Body.Instructions[38] = (Instruction.Create(OpCodes.Ret));
93+
94+
overwolfCoreGES.Body.Instructions[4] = (Instruction.Create(OpCodes.Br_S, overwolfCoreGES.Body.Instructions[33]));
95+
overwolfCoreGES.Body.OptimizeMacros();
96+
}
97+
}
98+
99+
return overwolfCoreGES;
100+
}
101+
102+
103+
public static MethodDefinition OverwolfSubscriptionsGetExtensionSubscriptions(ref AssemblyDefinition overwolfSubscriptions, MethodDefinition overwolfCoreGES)
104+
{
105+
overwolfCoreGES.Body.ExceptionHandlers.Clear();
106+
overwolfCoreGES.Body.Variables.Clear();
107+
overwolfCoreGES.Body.Instructions.Clear();
108+
GenericInstanceType list = new GenericInstanceType(overwolfSubscriptions.MainModule.ImportReference(typeof(List<>))); //overwolfCore.MainModule.Import();
109+
TypeReference SubscriptionRef = overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription");
110+
if (SubscriptionRef != null) // Get already imported class instead of import Overwolf.ODK.Common
111+
{
112+
list.GenericArguments.Add(SubscriptionRef);
113+
VariableDefinition iV = new VariableDefinition(overwolfSubscriptions.MainModule.ImportReference(typeof(int)));
114+
VariableDefinition dapV = new VariableDefinition(SubscriptionRef); // List<DetailedActivePlan>
115+
overwolfCoreGES.Body.Variables.Add(iV);
116+
overwolfCoreGES.Body.Variables.Add(dapV);
117+
118+
TypeReference List = overwolfSubscriptions.MainModule.ImportReference(overwolfSubscriptions.MainModule.ImportReference(Type.GetType("System.Collections.Generic.List`1")).MakeGenericInstanceType(new TypeReference[] { SubscriptionRef }));
119+
MethodDefinition listCtor = List.Resolve().Methods.First(x => x.Name == ".ctor");
120+
var listCtorRef = overwolfSubscriptions.MainModule.ImportReference(listCtor, List);
121+
listCtorRef.DeclaringType = List;
122+
MethodDefinition listAdd = List.Resolve().Methods.First(x => x.Name == "Add");
123+
var listAddRef = overwolfSubscriptions.MainModule.ImportReference(listAdd, List);
124+
listAddRef.DeclaringType = List;
125+
126+
127+
overwolfCoreGES.Body.SimplifyMacros();
128+
for (int i = 0; i < 73; i++)
129+
{
130+
overwolfCoreGES.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
131+
}
132+
overwolfCoreGES.Body.Instructions[0] = Instruction.Create(OpCodes.Ldarg_S, overwolfCoreGES.Parameters[3]);
133+
overwolfCoreGES.Body.Instructions[1] = Instruction.Create(OpCodes.Ldnull);
134+
overwolfCoreGES.Body.Instructions[2] = Instruction.Create(OpCodes.Stind_Ref);
135+
overwolfCoreGES.Body.Instructions[3] = Instruction.Create(OpCodes.Ldarg_0);
136+
overwolfCoreGES.Body.Instructions[4] = Instruction.Create(OpCodes.Call, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Settings.SubscriptionRepository").Methods.First(x => x.Name == "IsRequiredServiceUnavailable"));
137+
//
138+
overwolfCoreGES.Body.Instructions[6] = Instruction.Create(OpCodes.Ldc_I4_0);
139+
overwolfCoreGES.Body.Instructions[7] = Instruction.Create(OpCodes.Ret);
140+
overwolfCoreGES.Body.Instructions[8] = Instruction.Create(OpCodes.Ldarg_1);
141+
overwolfCoreGES.Body.Instructions[9] = Instruction.Create(OpCodes.Call, overwolfSubscriptions.MainModule.ImportReference(typeof(String).GetMethod("IsNullOrEmpty")));
142+
overwolfCoreGES.Body.Instructions[11] = Instruction.Create(OpCodes.Ldc_I4_0);
143+
overwolfCoreGES.Body.Instructions[12] = Instruction.Create(OpCodes.Ret);
144+
overwolfCoreGES.Body.Instructions[13] = Instruction.Create(OpCodes.Ldarg_S, overwolfCoreGES.Parameters[3]);
145+
overwolfCoreGES.Body.Instructions[14] = Instruction.Create(OpCodes.Newobj, listCtorRef);
146+
overwolfCoreGES.Body.Instructions[15] = Instruction.Create(OpCodes.Stind_Ref);
147+
overwolfCoreGES.Body.Instructions[16] = Instruction.Create(OpCodes.Ldc_I4_0);
148+
overwolfCoreGES.Body.Instructions[17] = Instruction.Create(OpCodes.Stloc_0);
149+
150+
151+
overwolfCoreGES.Body.Instructions[19] = Instruction.Create(OpCodes.Newobj, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == ".ctor"));
152+
overwolfCoreGES.Body.Instructions[20] = Instruction.Create(OpCodes.Stloc_1);
153+
overwolfCoreGES.Body.Instructions[21] = Instruction.Create(OpCodes.Ldloc_1);
154+
overwolfCoreGES.Body.Instructions[22] = Instruction.Create(OpCodes.Ldc_I4_0);
155+
overwolfCoreGES.Body.Instructions[23] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_Expired"));
156+
overwolfCoreGES.Body.Instructions[24] = Instruction.Create(OpCodes.Ldloc_1);
157+
overwolfCoreGES.Body.Instructions[25] = Instruction.Create(OpCodes.Ldloc_0);
158+
overwolfCoreGES.Body.Instructions[26] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_PlanId"));
159+
overwolfCoreGES.Body.Instructions[27] = Instruction.Create(OpCodes.Ldloc_1);
160+
overwolfCoreGES.Body.Instructions[28] = Instruction.Create(OpCodes.Ldc_I8, 1735682400000);
161+
overwolfCoreGES.Body.Instructions[29] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_Expiry"));
162+
overwolfCoreGES.Body.Instructions[30] = Instruction.Create(OpCodes.Ldloc_1);
163+
overwolfCoreGES.Body.Instructions[31] = Instruction.Create(OpCodes.Newobj, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription/Info").Methods.First(x => x.Name == ".ctor"));
164+
overwolfCoreGES.Body.Instructions[32] = Instruction.Create(OpCodes.Dup);
165+
overwolfCoreGES.Body.Instructions[33] = Instruction.Create(OpCodes.Ldstr, "all questions -> https://t.me/DecoderCoder");
166+
overwolfCoreGES.Body.Instructions[34] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription/Info").Methods.First(x => x.Name == "set_Description"));
167+
overwolfCoreGES.Body.Instructions[35] = Instruction.Create(OpCodes.Dup);
168+
overwolfCoreGES.Body.Instructions[36] = Instruction.Create(OpCodes.Ldstr, "Decode");
169+
overwolfCoreGES.Body.Instructions[37] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription/Info").Methods.First(x => x.Name == "set_Title"));
170+
overwolfCoreGES.Body.Instructions[38] = Instruction.Create(OpCodes.Dup);
171+
overwolfCoreGES.Body.Instructions[39] = Instruction.Create(OpCodes.Ldc_I4, 999);
172+
overwolfCoreGES.Body.Instructions[40] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription/Info").Methods.First(x => x.Name == "set_PeriodMonths"));
173+
overwolfCoreGES.Body.Instructions[41] = Instruction.Create(OpCodes.Dup);
174+
overwolfCoreGES.Body.Instructions[42] = Instruction.Create(OpCodes.Ldc_I4, 1);
175+
overwolfCoreGES.Body.Instructions[43] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription/Info").Methods.First(x => x.Name == "set_Price"));
176+
overwolfCoreGES.Body.Instructions[44] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_Plan"));
177+
overwolfCoreGES.Body.Instructions[45] = Instruction.Create(OpCodes.Ldloc_1);
178+
overwolfCoreGES.Body.Instructions[46] = Instruction.Create(OpCodes.Ldc_I4_0);
179+
overwolfCoreGES.Body.Instructions[47] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_State"));
180+
181+
overwolfCoreGES.Body.Instructions[48] = Instruction.Create(OpCodes.Ldloc_1);
182+
overwolfCoreGES.Body.Instructions[49] = Instruction.Create(OpCodes.Ldarg_2);
183+
overwolfCoreGES.Body.Instructions[50] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_ExtensionId"));
184+
overwolfCoreGES.Body.Instructions[51] = Instruction.Create(OpCodes.Ldloc_1);
185+
overwolfCoreGES.Body.Instructions[52] = Instruction.Create(OpCodes.Ldstr, "---");
186+
overwolfCoreGES.Body.Instructions[53] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_MUID"));
187+
overwolfCoreGES.Body.Instructions[54] = Instruction.Create(OpCodes.Ldloc_1);
188+
overwolfCoreGES.Body.Instructions[55] = Instruction.Create(OpCodes.Ldstr, "---");
189+
overwolfCoreGES.Body.Instructions[56] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_Token"));
190+
191+
overwolfCoreGES.Body.Instructions[57] = Instruction.Create(OpCodes.Ldloc_1);
192+
overwolfCoreGES.Body.Instructions[58] = Instruction.Create(OpCodes.Ldarg_1);
193+
overwolfCoreGES.Body.Instructions[59] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_Username"));
194+
overwolfCoreGES.Body.Instructions[60] = Instruction.Create(OpCodes.Ldarg_S, overwolfCoreGES.Parameters[3]);
195+
overwolfCoreGES.Body.Instructions[61] = Instruction.Create(OpCodes.Ldind_Ref);
196+
overwolfCoreGES.Body.Instructions[62] = Instruction.Create(OpCodes.Ldloc_1);
197+
overwolfCoreGES.Body.Instructions[63] = Instruction.Create(OpCodes.Callvirt, listAddRef);
198+
overwolfCoreGES.Body.Instructions[64] = Instruction.Create(OpCodes.Ldloc_0);
199+
overwolfCoreGES.Body.Instructions[65] = Instruction.Create(OpCodes.Ldc_I4_1);
200+
overwolfCoreGES.Body.Instructions[66] = Instruction.Create(OpCodes.Add);
201+
overwolfCoreGES.Body.Instructions[67] = Instruction.Create(OpCodes.Stloc_0);
202+
overwolfCoreGES.Body.Instructions[68] = Instruction.Create(OpCodes.Ldloc_0);
203+
overwolfCoreGES.Body.Instructions[69] = Instruction.Create(OpCodes.Ldc_I4, 9999);
204+
overwolfCoreGES.Body.Instructions[70] = Instruction.Create(OpCodes.Blt, overwolfCoreGES.Body.Instructions[19]);
205+
206+
overwolfCoreGES.Body.Instructions[71] = Instruction.Create(OpCodes.Ldc_I4_1);
207+
overwolfCoreGES.Body.Instructions[72] = Instruction.Create(OpCodes.Ret);
208+
209+
210+
overwolfCoreGES.Body.Instructions[5] = Instruction.Create(OpCodes.Brfalse_S, overwolfCoreGES.Body.Instructions[8]);
211+
overwolfCoreGES.Body.Instructions[10] = Instruction.Create(OpCodes.Brfalse_S, overwolfCoreGES.Body.Instructions[13]);
212+
overwolfCoreGES.Body.Instructions[18] = Instruction.Create(OpCodes.Br, overwolfCoreGES.Body.Instructions[68]); //
213+
overwolfCoreGES.Body.OptimizeMacros();
214+
}
215+
return overwolfCoreGES;
216+
}
217+
218+
}
219+
}

0 commit comments

Comments
 (0)