-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOTLScript.lua
1031 lines (987 loc) · 44.2 KB
/
OTLScript.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
gs = _G or _ENV
pageMemory = pageMemory or 0
math.randomseed(os.time())
lang = {
['ru'] = {
'ОГРОМНЫЙ УРОН',
'БЕССМЕРТИЕ',
'ИЗМЕНИТЬ ОРУЖИЕ',
'УБРАТЬ ПЕРЕЗАРЯДКУ НАВЫКОВ',
'УСТАНОВИТЬ КОЛИЧЕСТВО МОНЕТ',
'СЛОМАТЬ ПРЕДМЕТЫ В МАГАЗИНЕ',
'РАЗБЛОКИРОВАТЬ ВСЕ СТИЛИ ЛОББИ',
'СДЕЛАТЬ ВСЕХ ПИТОМЦЕВ ДРУЖЕЛЮБНЫМИ',
'(ОПАСНО) ИЗМЕНИТЬ КОЛИЧЕСТВО ФРАГМЕНТОВ СТИЛЯ',
'ЗАВЕРШИТЕ ВСЕ ДОСТИЖЕНИЯ',
'ПОЛУЧИТЬ НАГРАДУ ЗА ДОСТИЖЕНИЯ',
'ВЫПОЛНИТЬ ВСЕ ДНЕВНЫЕ ПОРУЧЕНИЯ',
'ДНЕВНЫЕ НАГРАДЫ X5',
'(ОПАСНО) УСТАНОВИТЬ ОЧКИ АСУРЫ',
'(ОПАСНО) ИЗМЕНИТЬ СТАТИСТИКУ АСУРЫ',
'ВЫХОД'
},
['en_US'] = {
'HUGE DAMAGE',
'IMMORTALITY',
'CHANGE WEAPON',
'REMOVE SKILL COOLDOWN',
'SET COIN COUNT',
'BREAK ITEMS IN THE STORE',
'UNLOCK ALL STYLE LOBBY',
'MAKE ALL PETS FRIENDLY',
'(DANGEROUS) CHANGE THE NUMBER OF STYLE FRAGMENTS',
'COMPLETE ALL ACHIEVEMENTS',
'GET A REWARD FOR ACHIEVEMENTS',
'COMPLETE ALL DAILY ERRANDS',
'DAILY REWARDS X5',
'(DANGEROUS) SET ASURA POINTS',
'(DANGEROUS) CHANGE ASURA STAT',
'EXIT'
},
}
langClass = {
['ru'] = {
GameProcess = 'Игровой процесс найден',
PlayerArchive = 'Данные игрока найдены',
DailyActivityComponent = 'Дневыне задачи найдены',
DailyActivityView = 'Дневыне задачи найдены',
DataManager = 'Менеджер данных найден',
ProductPrice = "Цены предметов найдены",
Weapon = 'Оружие было найдено',
UnitSpawn = 'Средства спавна были найдены',
PropertiesSystemLib = 'Свойства найдены',
Hero = "Герой найден",
AchievementManager = "Достижения были найдены",
MenuSkinUI = "Меню было найдено",
AppNoSK = 'Выбранный процесс не является игрой Soul knight',
ErrorData = 'Скрипт будет работать некорректно',
ManualSK = 'Прочтите инструкцию по установке VMOS Pro для корректной работы скрипта',
Emtry = 'Пусто',
ErrorLib = 'Game Guardian не нашёл нужную библиотеку. Скрипт запустится, но будет работать частично некорректно',
ErrorAlert = 'При выполнении функции произошла ошибка',
ChoosePages = 'Выберите страницу',
ChooseProperty = 'Выберите свойство'
},
['en_US'] = {
GameProcess = 'Game Process found',
PlayerArchive = 'Player data found',
DailyActivityComponent = 'Daily tasks found',
DailyActivityView = 'Daily tasks found',
DataManager = 'Data manager found',
Weapon = 'The weapon was found',
UnitSpawn = 'Spawn funds have been found',
PropertiesSystemLib = 'Properties found',
Hero = "The hero is found",
AchievementManager ="Achievements have been found",
MenuSkinUI = "Menu was found",
AppNoSK = 'The selected process is not a Soul knight game',
ErrorData = 'The script will not work correctly',
ManualSK = 'Read the instructions for installing VMOS Pro for the script to work correctly',
Emtry = 'Emtry',
ErrorLib = "Game Guardian didn't find the right library. The script will run, but it will work partially incorrectly",
ErrorAlert = 'An error occurred while executing the function',
ChoosePages = 'Select a page',
ChooseProperty = 'Select a property'
},
}
lang_main = setmetatable(lang[gg.getLocale()] or lang['en_US'], {__index = langClass[gg.getLocale()] or langClass['en_US']})
Utf16 = {}
for s in string.gmatch('АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя', "..") do
local char = gg.bytes(s,'UTF-16LE')
Utf16[char[1] + (char[2] * 256)] = s
end
for s in string.gmatch("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_/0123456789-'", ".") do
local char = gg.bytes(s,'UTF-16LE')
Utf16[char[1] + (char[2] * 256)] = s
end
function switch(check, table, e, ...)
return ({
xpcall(
table[check],
function ()
return table[check] or (
function()
if type(e) ~= 'function' then return e end
return e()
end
)()
end,
...
)
})[2]
end
Protect = {
ErrorHandler = function(err)
gg.alert(lang_main['ErrorAlert'])
print(err)
end,
Call = function(self, fun, ...)
return ({xpcall(fun, self.ErrorHandler, ...)})[2]
end
}
function CheckTableIsNil(t)
if (not t) or type(t) ~= 'table' or #t == 0 then return true end
for k,v in pairs(t) do
if (not v) or v == '' then return true end
end
return false
end
function GetNameTableInGlobalSpace(table)
for k,v in pairs(gs) do
if v == table then return k end
end
return ""
end
function GetInfoFropApps()
local data = gg.getRangesList('global-metadata.dat')
local il2cpp = gg.getRangesList('libil2cpp.so')
local info = gg.getTargetInfo()
if info then return info.x64, data end
if #il2cpp ~= 0 then
local check = string.gsub(il2cpp[1].internalName,'%/.-%/lib/','')
check = switch(check,{
['arm64/libil2cpp.so'] = true,
['arm/libil2cpp.so'] = false
})
if check ~= nil then return data, check, il2cpp end
end
return nil, nil, nil
end
function GetAppData()
local info = gg.getTargetInfo()
if not info then
info = gg.alert(lang_main.ErrorData .. "\n" .. lang_main.ManualSK, 'OK', 'COPY LINK')
if info == 2 then gg.copyText('http://crusher.ucoz.net/index/manual/0-6') end
return GetInfoFropApps()
end
return gg.getRangesList('global-metadata.dat'), info.x64, gg.getRangesList('libil2cpp.so')
end
data, platform, libil = GetAppData()
if #libil == 0 then
local splitconf = gg.getRangesList('split_config.')
gg.setRanges(gg.REGION_CODE_APP | gg.REGION_OTHER)
for k,v in ipairs(splitconf) do
if (v.state == 'Xa' or v.state == 'O') then
gg.searchNumber(':il2cpp',gg.TYPE_BYTE,false,gg.SIGN_EQUAL,v.start,v['end'])
if (gg.getResultsCount() > 0) then
libil[#libil + 1] = v
end
gg.clearResults()
end
end
end
function setupValues(gf,gm,typeset)
gg.setValues({{address = gf,flags = typeset or gg.TYPE_DWORD,value = gm:gsub('.', function (c) return string.format('%02X', string.byte(c)) end)..'r'}})
end
function Il2CppName(NameFucntion)
local FinalMethods, name = {}, "00 " .. NameFucntion:gsub('.', function (c) return string.format('%02X', string.byte(c)) .. " " end) .. "00"
gg.clearResults()
gg.setRanges(gg.REGION_C_HEAP | gg.REGION_C_ALLOC | gg.REGION_ANONYMOUS | gg.REGION_C_BSS | gg.REGION_C_DATA | gg.REGION_OTHER)
gg.searchNumber('h ' .. name, gg.TYPE_BYTE, false, gg.SIGN_EQUAL, data[1].start, data[#data]['end'])
if gg.getResultsCount() == 0 then error('the "' .. NameFucntion .. '" function was not found') end
gg.searchNumber('h ' .. string.sub(name,4,5))
local r = gg.getResults(gg.getResultsCount())
gg.clearResults()
for key, value in ipairs(r) do
if gg.BUILD < 16126 then
gg.searchNumber(string.format("%8.8X", fixvalue32(value.address)) .. 'h', Unity.MainType)
else
gg.loadResults({value})
gg.searchPointer(0)
end
local MethodsInfo = gg.getResults(gg.getResultsCount())
gg.clearResults()
for k, v in ipairs(MethodsInfo) do
v.address = v.address - Unity.MethodNameOffset
local FinalAddress = fixvalue32(gg.getValues({v})[1].value)
if (FinalAddress > libil[1].start and FinalAddress < libil[#libil]['end']) then
FinalMethods[#FinalMethods + 1] = {
AddressMethod = FinalAddress,
Address = v.address
}
end
end
end
if (#FinalMethods == 0) then error('the "' .. NameFucntion .. '" function pointer was not found') end
return FinalMethods
end
function addresspath(StartAddress, ...)
args = {...}
for i = 1,#args do
StartAddress = i ~= 1 and StartAddress + 0x4 or StartAddress
setupValues(StartAddress,args[i])
end
end
function GetAddressMemory(startAddress, add)
local localPageMemory = ((pageMemory == 0) or (((pageMemory & 0xFFF) + add) > 3500)) and gg.allocatePage(gg.PROT_READ | gg.PROT_WRITE, startAddress) or pageMemory
pageMemory = localPageMemory + add
return localPageMemory
end
function fixvalue32(value)
return platform and value or value & 0xFFFFFFFF
end
function MyLenTable(t)
local ret = 0
for k,v in pairs(t) do ret = ret + 1 end
return ret
end
Unity = {
ClassNameOffset = platform and 0x10 or 0x8,
StaticFieldsOffset = platform and 0xB8 or 0x5C,
ParentOffset = platform and 0x58 or 0x2C,
NumFields = platform and 0x120 or 0xA8,
FieldsLink = platform and 0x80 or 0x40,
FieldsStep = platform and 0x20 or 0x14,
FieldsOffset = platform and 0x18 or 0xC,
MethodClassOffset = platform and 0x18 or 0xC,
MethodNameOffset = platform and 0x10 or 0x8,
MainType = platform and gg.TYPE_QWORD or gg.TYPE_DWORD,
GetClass = function(self, ClassName)
gg.clearResults()
gg.setRanges(0)
gg.setRanges(gg.REGION_C_HEAP | gg.REGION_C_HEAP | gg.REGION_ANONYMOUS | gg.REGION_C_BSS | gg.REGION_C_DATA | gg.REGION_OTHER | gg.REGION_C_ALLOC)
gg.searchNumber("Q 00 '" .. ClassName .. "' 00",gg.TYPE_BYTE,false,gg.SIGN_EQUAL,data[1].start,data[1]['end'])
gg.searchNumber("Q '" .. ClassName .. "' ")
gg.searchPointer(0)
local res = gg.getResults(gg.getResultsCount())
gg.clearResults()
if (#res > 1) then
for k,v in ipairs(res) do
local assembly = gg.getValues({{address = v.address - Unity.ClassNameOffset,flags = v.flags}})[1].value
if (self.Utf8ToString(gg.getValues({{address = assembly,flags = v.flags}})[1].value):find(".dll")) then res[1] = v end
end
end
if not self.ClassLoad then self:SetFields(res[1].address - Unity.ClassNameOffset) end
return res[1]
end,
GetStartLibAddress = function(Address)
local start = 0
for k,v in ipairs(libil) do
if (fixvalue32(Address) > fixvalue32(v.start) and fixvalue32(Address) < fixvalue32(v['end'])) then start = v.start end
end
return start
end,
FilterObject = function (Instances)
gg.clearResults()
gg.loadResults(Instances)
gg.searchPointer(0)
local r, FilterInstances = gg.getResults(gg.getResultsCount()), {}
for k,v in ipairs(gg.getValuesRange(r)) do
FilterInstances[#FilterInstances + 1] = v == 'A' and {address = r[k].value, flags = r[k].flags} or nil
end
gg.clearResults()
gg.loadResults(FilterInstances)
FilterInstances = gg.getResults(gg.getResultsCount())
gg.clearResults()
return FilterInstances
end,
GetInstance = function(self)
local Instances, ClassName = {}, GetNameTableInGlobalSpace(self)
local MemClass = self:GetClass(ClassName)
gg.loadResults({MemClass})
gg.searchPointer(self.ClassNameOffset)
local r = gg.getResults(gg.getResultsCount())
for k,v in ipairs(gg.getValuesRange(r)) do
Instances[#Instances + 1] = v == 'A' and r[k] or nil
end
Instances = self.FilterObject(Instances)
gg.toast(lang_main[ClassName] or "")
gg.clearResults()
return Instances
end,
GetLocalInstance = function(self)
local Instances, ClassName = {}, GetNameTableInGlobalSpace(self)
local MemClass = self:GetClass(ClassName)
local tmp = gg.getValues({{address = MemClass.address - self.ClassNameOffset + self.StaticFieldsOffset,flags = MemClass.flags}})
table.move(gg.getValues({{address = tmp[1].value,flags = tmp[1].flags}}),1,1,#Instances + 1,Instances)
gg.toast(lang_main[ClassName] or "")
gg.clearResults()
return Instances
end,
GetParentLocalInstance = function(self)
local Instances, ClassName = {}, GetNameTableInGlobalSpace(self)
local MemClass = self:GetClass(ClassName)
local tmp = gg.getValues({{address = MemClass.address - self.ClassNameOffset + self.ParentOffset,flags = MemClass.flags}})[1].value
tmp = gg.getValues({{address = tmp + self.StaticFieldsOffset,flags = MemClass.flags}})
table.move(gg.getValues({{address = tmp[1].value,flags = tmp[1].flags}}),1,1,#Instances + 1,Instances)
gg.toast(lang_main[ClassName] or "")
gg.clearResults()
return Instances
end,
Utf8ToString = function(Address)
local bytes, char = {}, {address = fixvalue32(Address), flags = gg.TYPE_BYTE}
while gg.getValues({char})[1].value > 0 do
bytes[#bytes + 1] = {address = char.address, flags = char.flags}
char.address = char.address + 0x1
end
return tostring(setmetatable(gg.getValues(bytes), {
__tostring = function(self)
for k,v in ipairs(self) do
self[k] = string.char(v.value)
end
return table.concat(self)
end
}))
end,
Utf16ToString = function(Address)
local bytes, strAddress = {}, fixvalue32(Address) + (platform and 0x10 or 0x8)
local num = gg.getValues({{address = strAddress,flags = gg.TYPE_DWORD}})[1].value
if num > 0 and num < 200 then
for i = 1, num + 1 do
bytes[#bytes + 1] = {address = strAddress + (i << 1), flags = gg.TYPE_WORD}
end
end
return #bytes > 0 and tostring(setmetatable(gg.getValues(bytes), {
__tostring = function(self)
for k,v in ipairs(self) do
self[k] = v.value == 32 and " " or (Utf16[v.value] or "")
end
return table.concat(self)
end
})) or ""
end,
GetIl2cppFunc = function(...)
local args, RetIl2CppFuncs = {...}, {}
if args[1] == nil or args[1] == "" or args[1] == " " then return {},"you didn't enter the function" end
for keyname,namefucntion in ipairs(args) do
local finaladdres = Il2CppName(namefucntion)
for k,v in pairs(finaladdres) do
if (k ~= 'Error') then
local AddressClass = fixvalue32(gg.getValues({{address = v.Address + Unity.MethodClassOffset,flags = Unity.MainType}})[1].value)
RetIl2CppFuncs[#RetIl2CppFuncs + 1] = {
NameFucntion = namefucntion,
Offset = string.format("%X",v.AddressMethod - Unity.GetStartLibAddress(v.AddressMethod)),
AddressInMemory = string.format("%X",v.AddressMethod),
AddressOffset = v.Address,
Class = Unity.Utf8ToString(gg.getValues({{address = AddressClass + Unity.ClassNameOffset,flags = Unity.MainType}})[1].value),
ClassAddress = string.format('%X', AddressClass)
}
else
RetIl2CppFuncs[#RetIl2CppFuncs + 1] = {
NameFucntion = namefucntion,
Error = v
}
end
end
end
return RetIl2CppFuncs,'true'
end,
From = function (self, a)
if not self.ClassLoad then self:SetFields(gg.getValues({{address = fixvalue32(a), flags = Unity.MainType}})[1].value) end
return setmetatable({address = a, mClass = self}, {
__index = function(self, key)
local check = switch((self.address and self.mClass) and (self.mClass[key] and 1 or -1) or 0 , {[0] = 'Не все поля заполнены', [-1] = 'В таблице нет поля ' .. key})
return check and error(check) or ((type(self.mClass[key]) == 'function')
and (function(self, ...) return self.mClass[key](self.mClass, self.address, ...) end)
or self.mClass[key])
end
})
end,
GetNumFields = function(self, ClassAddress)
return gg.getValues({{address = ClassAddress + self.NumFields, flags = gg.TYPE_WORD}})[1].value
end,
GetLinkFields = function(self, ClassAddress)
return gg.getValues({{address = ClassAddress + self.FieldsLink, flags = Unity.MainType}})[1].value
end,
SetFields = function(self, AddressClass)
AddressClass = fixvalue32(AddressClass)
self.ClassLoad = true
local FieldsCount, FieldsLink = self:GetNumFields(AddressClass), fixvalue32(self:GetLinkFields(AddressClass))
for i = 0, FieldsCount - 1 do
local field = FieldsLink + (i * self.FieldsStep)
local fieldInfo = gg.getValues({
{--NameField
address = field,
flags = Unity.MainType
},
{--Offset
address = field + self.FieldsOffset,
flags = gg.TYPE_WORD
},
})
self.Fields[self.Utf8ToString(fixvalue32(fieldInfo[1].value))] = fieldInfo[2].value
end
end,
}
function SetUnityClass(t)
t.ClassLoad = false
t.Fields = {}
return setmetatable(t,{__index = Unity})
end
function SetSubClass(SubClass, MainClass)
return setmetatable(SubClass, {__index = MainClass})
end
EnumClass = {
From = function (self, a)
return setmetatable({address = a, mClass = self}, {
__index = function(self, key)
local check = switch((self.address and self.mClass) and (self.mClass[key] and 1 or -1) or 0 , {[0] = 'Не все поля заполнены', [-1] = 'В таблице нет поля ' .. key})
return check and error(check) or ((type(self.mClass[key]) == 'function')
and (function(self, ...) return self.mClass[key](self.mClass, self.address, ...) end)
or self.mClass[key])
end
})
end
}
function SetEnumClass(t)
return setmetatable(t, {__index = EnumClass})
end
Dictionary = SetEnumClass({
num = platform and 0x20 or 0x10,
link = platform and 0x18 or 0xC,
GetNum = function(self, dic)
return gg.getValues({{address = dic + self.num, flags = gg.TYPE_DWORD}})[1].value
end,
GetLink = function(self, dic)
return gg.getValues({{address = dic + self.link, flags = Unity.MainType}})[1].value
end,
int = {
int = {
firstStepKey = platform and 0x28 or 0x18,
base = platform and 0x2C or 0x1C,
SetAllItems = function(dic, val)
local items, link, lenght = {}, fixvalue32(Dictionary:GetLink(dic)), Dictionary:GetNum(dic)
for i = 0, lenght - 1 do
items[#items + 1] = {
address = link + Dictionary.int.int.base + (i << 4),
flags = gg.TYPE_DWORD,
value = val
}
end
gg.setValues(items)
end,
SetItem = function(dic, key, val)
dic = fixvalue32(dic)
local link, lenght = fixvalue32(Dictionary:GetLink(dic)), Dictionary:GetNum(dic)
for i = 0, lenght - 1 do
local Element = gg.getValues({
{
address = link + Dictionary.int.int.firstStepKey + (i << 4),
flags = gg.TYPE_DWORD
}
})
if (Element[1].value == key) then
gg.setValues({{
address = link + Dictionary.int.int.base + (i << 4),
flags = gg.TYPE_DWORD,
value = val
}})
end
end
end
},
object = {
firstStepValue = platform and 0x30 or 0x1C,
firstStepKey = platform and 0x28 or 0x18,
step = platform and 0x18 or 0x10,
GetAllItems = function(dic)
dic = fixvalue32(dic)
local items, link, lenght = {}, fixvalue32(Dictionary:GetLink(dic)), Dictionary:GetNum(dic)
for i = 0, lenght - 1 do
local Element = gg.getValues({
{
address = link + Dictionary.int.object.firstStepKey + (i * Dictionary.int.object.step),
flags = gg.TYPE_DWORD
},
{
address = link + Dictionary.int.object.firstStepValue + (i * Dictionary.int.object.step),
flags = Unity.MainType
}
})
items[Element[1].value] = fixvalue32(Element[2].value)
end
return items
end
},
struct = {
SetAllItems = function(dic, firstStep, step, typeValue, val)
local items, link, lenght = {}, fixvalue32(Dictionary:GetLink(dic)), Dictionary:GetNum(dic)
for i = 0, lenght - 1 do
items[#items + 1] = {
address = link + firstStep + (i << step),
flags = typeValue,
value = val
}
end
gg.setValues(items)
end
}
},
string = {
object = {
firstStepValue = platform and 0x30 or 0x1C,
firstStepKey = platform and 0x28 or 0x18,
step = platform and 0x18 or 0x10,
GetAllItems = function(dic)
dic = fixvalue32(dic)
local items, link, lenght = {}, fixvalue32(Dictionary:GetLink(dic)), Dictionary:GetNum(dic)
for i = 0, lenght - 1 do
local Element = gg.getValues({
{
address = link + Dictionary.string.object.firstStepKey + (i * Dictionary.string.object.step),
flags = Unity.MainType
},
{
address = link + Dictionary.string.object.firstStepValue + (i * Dictionary.string.object.step),
flags = Unity.MainType
}
})
items[Unity.Utf16ToString(Element[1].value)] = fixvalue32(Element[2].value)
end
return items
end
},
float = {
firstStepValue = platform and 0x30 or 0x1C,
firstStepKey = platform and 0x28 or 0x18,
step = platform and 0x18 or 0x10,
SetItemKey = function(dic, key, val)
dic = fixvalue32(dic)
local link, lenght = fixvalue32(Dictionary:GetLink(dic)), Dictionary:GetNum(dic)
for i = 0, lenght - 1 do
local Element = gg.getValues({
{
address = link + Dictionary.string.float.firstStepKey + (i * Dictionary.string.float.step),
flags = Unity.MainType
}
})
if (Unity.Utf16ToString(Element[1].value) == key) then
gg.setValues({{
address = link + Dictionary.string.float.firstStepValue + (i * Dictionary.string.float.step),
flags = gg.TYPE_FLOAT,
value = val
}})
end
end
end
},
int = {
firstStepValue = platform and 0x30 or 0x1C,
step = platform and 0x18 or 0x10,
MulItems = function(dic, mul)
dic = fixvalue32(dic)
local items, link, lenght = {}, fixvalue32(Dictionary:GetLink(dic)), Dictionary:GetNum(dic)
for i = 0, lenght - 1 do
local Element = gg.getValues({
{
address = link + Dictionary.string.int.firstStepValue + (i * Dictionary.string.int.step),
flags = gg.TYPE_DWORD
}
})
items[#items + 1] = {
address = Element[1].address,
flags = gg.TYPE_DWORD,
value = Element[1].value * mul
}
end
if #items > 0 then gg.setValues(items) end
end
}
}
})
List = SetEnumClass({
num = platform and 0x18 or 0xC,
link = platform and 0x10 or 0x8,
GetNum = function(self, list)
return gg.getValues({{address = list + self.num, flags = gg.TYPE_DWORD}})[1].value
end,
GetLink = function(self, list)
return gg.getValues({{address = list + self.link, flags = Unity.MainType}})[1].value
end,
object = {
firstStep = platform and 0x20 or 0x10,
step = platform and 3 or 2,
GetAllItems = function(list)
local items, link, lenght = {}, fixvalue32(List:GetLink(list)), List:GetNum(list)
for i = 0, lenght - 1 do
items[#items + 1] = {
address = link + List.object.firstStep + (i << List.object.step),
flags = Unity.MainType
}
end
return lenght > 0 and gg.getValues(items) or items
end
}
})
ProductPrice = SetUnityClass({
FREEITEMS = function(self)
local items = {}
for k,v in ipairs(self:GetInstance()) do
items[#items + 1] = {
address = v.address + self.Fields.type,
value = 1,
flags = gg.TYPE_DWORD
}
items[#items + 1] = {
address = v.address + self.Fields.gameResourcesPrice,
value = 0,
flags = gg.TYPE_FLOAT
}
end
gg.setValues(items)
end
})
MenuSkinUI = SetUnityClass({
UnlockAllSkin = function(self)
local items = {}
for k, v in ipairs(self:GetLocalInstance()) do
Dictionary.int.int.SetAllItems(gg.getValues({{address = v.value + self.Fields.allSkinState, flags = Unity.MainType}})[1].value, 0)
end
end
})
AchievementData = SetUnityClass({
GetTableForComlite = function(self, add)
return {address = add + self.Fields.isComplete, flags = gg.TYPE_BYTE, value = 1}
end,
GetTableForRecesive = function(self, add)
return {address = add + self.Fields.hasReceiveAward, flags = gg.TYPE_BYTE, value = 0}
end,
})
Manager = SetUnityClass({
get_dataList = function(self, add)
return fixvalue32(gg.getValues({{address = add + self.Fields._dataList, flags = Unity.MainType}})[1].value)
end
})
AchievementManager = SetUnityClass({
CompliteAllAchievement = function (self)
local achiv = {}
for k, v in pairs(self:GetLocalInstance()) do
local manager = Manager:From(v.value)
for key, value in pairs(List.object.GetAllItems(manager:get_dataList())) do
achiv[#achiv + 1] = AchievementData:From(value.value):GetTableForComlite()
end
end
gg.setValues(achiv)
end,
GetRewardAchievments = function(self)
local achiv = {}
for k, v in pairs(self:GetLocalInstance()) do
local manager = Manager:From(v.value)
for key, value in pairs(List.object.GetAllItems(manager:get_dataList())) do
achiv[#achiv + 1] = AchievementData:From(value.value):GetTableForRecesive()
end
end
gg.setValues(achiv)
end
})
Properties = SetUnityClass({
HackProp = function(self, add, key, val)
Dictionary.string.float.SetItemKey(gg.getValues({{address = add + self.Fields.baseProperty, flags = Unity.MainType}})[1].value, key, val)
end
})
Character = SetUnityClass({
BlockDamage = function(self, add)
gg.setValues({{address = add + self.Fields._isBlockDamage, flags = gg.TYPE_BYTE, value = 1}})
end,
HackDamage = function(self, add)
Properties:From(gg.getValues({{address = add + self.Fields.properties, flags = Unity.MainType}})[1].value):HackProp('Damage', 100000)
end
})
UnitSpawn = SetUnityClass({
GodMode = function(self)
for k, v in ipairs(self:GetLocalInstance()) do
local dic = Dictionary.int.object.GetAllItems(gg.getValues({{address = v.value + self.Fields.unitDic, flags = Unity.MainType}})[1].value)
if dic[1] then
for key, value in ipairs(List.object.GetAllItems(dic[1])) do
Character:From(fixvalue32(value.value)):BlockDamage()
end
end
end
end,
HackDamage = function(self)
for k,v in ipairs(self:GetLocalInstance()) do
local dic = Dictionary.int.object.GetAllItems(gg.getValues({{address = v.value + self.Fields.unitDic, flags = Unity.MainType}})[1].value)
if (dic[1]) then
for key, value in ipairs(List.object.GetAllItems(dic[1])) do
Character:From(fixvalue32(value.value)):HackDamage()
end
end
end
end,
})
PropertiesSystemLib = SetUnityClass({
HackCooldown = function(self)
for k,v in ipairs(self:GetLocalInstance()) do
local charDic = Dictionary.string.object.GetAllItems(v.value)
for key, value in pairs(charDic) do
if string.find(string.lower(key), 'hero') then
Dictionary.string.float.SetItemKey(value, 'Cooldown', 0)
end
end
end
end
})
HeroRunningData = SetUnityClass({
SetCoin = function(self, add, num)
Dictionary.int.int.SetItem(gg.getValues({{address = add + self.Fields.heroBackpack, flags = Unity.MainType}})[1].value, 0, num) -- coin_base
end
})
GameProcess = SetUnityClass({
SetCoin = function(self, num)
for k, v in ipairs(self:GetLocalInstance()) do
HeroRunningData:From(gg.getValues({{address = v.address + self.Fields['<heroRunningData>k__BackingField'], flags = Unity.MainType}})[1].value):SetCoin(num)
end
end
})
Weapon = SetUnityClass({
MaxIdEffects = 201,
ChangeWeapon = function(self)
local weapons = {}
for k,v in ipairs(self:GetInstance()) do
local data = v.address + self.Fields['<data>k__BackingField']
table.move({
{
address = data + 0x4, -- quality
flags = gg.TYPE_DWORD,
value = 4
},
{
address = data + 0x18, -- characterEffect0
flags = gg.TYPE_DWORD,
value = math.random(0, self.MaxIdEffects)
},
{
address = data + 0x1C, -- characterEffect1
flags = gg.TYPE_DWORD,
value = math.random(0, self.MaxIdEffects)
},
{
address = data + 0x20, -- characterEffect2
flags = gg.TYPE_DWORD,
value = math.random(0, self.MaxIdEffects)
},
{
address = data + 0x24, -- characterEffect3
flags = gg.TYPE_DWORD,
value = math.random(0, self.MaxIdEffects)
},
}, 1, 5, #weapons + 1, weapons)
end
gg.setValues(weapons)
end
})
DailyActivityView = SetUnityClass({
x5Activity = function(self)
for k, v in ipairs(self:GetLocalInstance()) do
for key, val in ipairs(List.object.GetAllItems(fixvalue32(gg.getValues({{address = v.address + self.Fields.rewardContent, flags = Unity.MainType}})[1].value))) do
Dictionary.string.int.MulItems(val.value, 5)
end
end
end
})
DailyActivityComponent = SetUnityClass({
CompliteActivity = function(self)
for k, v in ipairs(self:GetLocalInstance()) do
Dictionary.int.int.SetAllItems(fixvalue32(gg.getValues({{address = v.address + self.Fields.eventCompleteCount, flags = Unity.MainType}})[1].value), 400)
end
end
})
DataManager = SetUnityClass({
FrendlyPets = function(self)
for k, v in ipairs(self:GetLocalInstance()) do
local dic = fixvalue32(gg.getValues({{address = v.address + self.Fields.PetConfigData, flags = Unity.MainType}})[1].value)
Dictionary.int.struct.SetAllItems(dic, platform and 0x30 or 0x20, 6, gg.TYPE_DWORD, 0) -- <UnlockMode>k__BackingField
Dictionary.int.struct.SetAllItems(dic, platform and 0x40 or 0x30, 6, gg.TYPE_FLOAT, 1000) -- <friendlinessPerSatiety_NotUnlock>k__BackingField
Dictionary.int.struct.SetAllItems(dic, platform and 0x44 or 0x34, 6, gg.TYPE_FLOAT, 1000) -- <friendlinessPerSatiety_HasUnlock>k__BackingField
end
end,
})
EncryptValue = SetUnityClass({
SetEncryptValue = function(self, add, num)
local key = gg.getValues({{address = add + self.Fields.encryptKey, flags = gg.TYPE_DWORD}})[1].value
return {
{
address = add + self.Fields._showValue,
value = num,
flags = gg.TYPE_DWORD
},
{
address = add + self.Fields.mValue,
value = num ~ key,
flags = gg.TYPE_DWORD
}
}
end,
GetShowValue = function(self, add)
return {
address = add + self.Fields._showValue,
flags = gg.TYPE_DWORD
}
end
})
PlayerArchive = SetUnityClass({
ChangeMenuSkin = function(self)
for k, v in ipairs(self.GetIl2cppFunc('IsMenuSkinUnlock')) do
local patch = platform and "\x20\x00\x80\x52\xc0\x03\x5f\xd6" or "\x01\x00\xa0\xe3\x1e\xff\x2f\xe1"
setupValues(tonumber(v.AddressInMemory,16), patch, gg.TYPE_QWORD)
end
end,
ChangeFloorCount = function(self)
local floorItems = {}
for k, v in ipairs(self:GetLocalInstance()) do
local resursDic = gg.getValues({{address = v.address + self.Fields._resourceDic, flags = Unity.MainType}})[1].value
local items = Dictionary.int.object.GetAllItems(resursDic)
if (items[19]) then -- FloorSkinPiece
for key, encVal in pairs(Dictionary.string.object.GetAllItems(items[19])) do
table.move(EncryptValue:From(encVal):SetEncryptValue(500), 1, 2, #floorItems + 1, floorItems)
end
end
end
gg.setValues(floorItems)
end,
ChangeAsuraPowerPoint = function(self, value)
local powerTable = {}
for k,v in ipairs(self:GetLocalInstance()) do
local _exAsuraPowerPointMax = gg.getValues({{address = v.address + self.Fields._exAsuraPowerPointMax, flags = Unity.MainType}})[1].value
table.move(EncryptValue:From(_exAsuraPowerPointMax):SetEncryptValue(value), 1, 2, #powerTable + 1, powerTable)
end
gg.setValues(powerTable)
end,
AddAsuraPowerPoint = function(self, delta, investPoints)
for k,v in ipairs(self:GetLocalInstance()) do
local _exAsuraPowerPointMax = gg.getValues({{address = v.address + self.Fields._exAsuraPowerPointMax, flags = Unity.MainType}})[1].value
local encVal = EncryptValue:From(_exAsuraPowerPointMax)
delta = gg.getValues({encVal:GetShowValue()})[1].value - investPoints - delta
if delta < 0 then
gg.setValues(encVal:SetEncryptValue(gg.getValues({encVal:GetShowValue()})[1].value + math.abs(delta)))
end
end
end,
GetSumInvestPoint = function(asuraPower, page, pageProperties)
local sum = 0
local EncryptValues = {}
for indexTable, propertyIndex in pairs(pageProperties) do
local id = string.format("scheme_%i_%i", page, propertyIndex)
EncryptValues[#EncryptValues + 1] = EncryptValue:From(asuraPower[id]):GetShowValue()
end
EncryptValues = gg.getValues(EncryptValues)
for indexTable = 1, #EncryptValues do
sum = sum + EncryptValues[indexTable].value
end
return sum
end,
ChangeStatAsura = function(self)
for k, v in ipairs(self:GetLocalInstance()) do
local resursDic = gg.getValues({{address = v.address + self.Fields._resourceDic, flags = Unity.MainType}})[1].value
local items = Dictionary.int.object.GetAllItems(resursDic)
if (items[34]) then
local asuraPower = Dictionary.string.object.GetAllItems(items[34])
local asuraPagePower = {}
local asuraProperties = {}
for key, value in pairs(asuraPower) do
if string.find(key, "scheme_(%d+)_(%d+)") then
local page, propertiesIndex = string.match(key, "scheme_(%d+)_(%d+)")
if not (asuraProperties[page]) then
asuraProperties[page] = {propertiesIndex}
asuraPagePower[#asuraPagePower + 1] = page
else
asuraProperties[page][#(asuraProperties[page]) + 1] = propertiesIndex
table.sort(asuraProperties[page])
end
end
end
table.sort(asuraPagePower)
local chosenPage = gg.choice(asuraPagePower, nil, lang_main.ChoosePages)
if chosenPage then
chosenPage = asuraPagePower[chosenPage]
local chosenProperty = gg.choice(asuraProperties[chosenPage], nil, lang_main.ChooseProperty)
if chosenProperty then
chosenProperty = asuraProperties[chosenPage][chosenProperty]
local num = gg.prompt({'ВВЕДИТЕ НУЖНОЕ КОЛИЧЕСТВО\nENTER THE REQUIRED AMOUNT'},{[1] = 5},{'number'})
local newValue = (not CheckTableIsNil(num)) and tonumber(num[1]) or -1
if newValue >= 0 then
local sumInvestPoints = self.GetSumInvestPoint(asuraPower, chosenPage, asuraProperties[chosenPage])
local selectId = string.format("scheme_%i_%i", chosenPage, chosenProperty)
if asuraPower[selectId] then
local property = EncryptValue:From(asuraPower[selectId])
local delta = newValue - gg.getValues({property:GetShowValue()})[1].value
self:AddAsuraPowerPoint(delta, sumInvestPoints)
gg.setValues(EncryptValue:From(asuraPower[selectId]):SetEncryptValue(newValue))
end
end
end
end
end
end
end
})
functions = {
['EXIT'] = function()
if not pcall(dropboxfile,"MainMenu.lua") then os.exit() end
end,
['BREAK ITEMS IN THE STORE'] = function()
Protect:Call(ProductPrice.FREEITEMS, ProductPrice)
end,
['UNLOCK ALL STYLE LOBBY'] = function()
Protect:Call(MenuSkinUI.UnlockAllSkin, MenuSkinUI)
Protect:Call(PlayerArchive.ChangeMenuSkin, PlayerArchive)
end,
['COMPLETE ALL ACHIEVEMENTS'] = function()
Protect:Call(AchievementManager.CompliteAllAchievement, AchievementManager)
end,
['GET A REWARD FOR ACHIEVEMENTS'] = function()
Protect:Call(AchievementManager.GetRewardAchievments, AchievementManager)
end,
['IMMORTALITY'] = function()
Protect:Call(UnitSpawn.GodMode, UnitSpawn)
end,
['REMOVE SKILL COOLDOWN'] = function()
Protect:Call(PropertiesSystemLib.HackCooldown, PropertiesSystemLib)
end,
['HUGE DAMAGE'] = function()
Protect:Call(UnitSpawn.HackDamage, UnitSpawn)
end,
['CHANGE WEAPON'] = function()
Protect:Call(Weapon.ChangeWeapon, Weapon)
end,
['MAKE ALL PETS FRIENDLY'] = function()
Protect:Call(DataManager.FrendlyPets, DataManager)
end,
['COMPLETE ALL DAILY ERRANDS'] = function()
Protect:Call(DailyActivityComponent.CompliteActivity, DailyActivityComponent)
end,
['DAILY REWARDS X5'] = function()
Protect:Call(DailyActivityView.x5Activity, DailyActivityView)
end,
['(DANGEROUS) CHANGE THE NUMBER OF STYLE FRAGMENTS'] = function()
local attemt = gg.alert("ФУНКЦИЯ 'ИЗМЕНИТЬ КОЛИЧЕСТВО ФРАГМЕНТОВ СТИЛЯ' ОПАСНА, ТАК КАК МОЖЕТ ВЫЗВАТЬ БЛОКИРОВКУ АККАУНТА, ВЫ СОГЛАСНЫ С ИСПОЛЬЗОВАНИЕМ ДАННОЙ ФУНКЦИИ ?\nTHE FUNCTION 'CHANGE THE NUMBER OF STYLE FRAGMENTS' IS DANGEROUS, AS IT CAN CAUSE ACCOUNT BLOCKING, DO YOU AGREE WITH THE USE OF THIS FUNCTION?", "YES", "NO")
if (attemt == 1) then Protect:Call(PlayerArchive.ChangeFloorCount, PlayerArchive) end
end,
['SET COIN COUNT'] = function()
local num = gg.prompt({'ВВЕДИТЕ НУЖНОЕ КОЛИЧЕСТВО (ФУНКЦИЯ: УСТАНОВИТЬ КОЛИЧЕСТВО МОНЕТ)\nENTER THE REQUIRED AMOUNT (FUNCTION: SET COIN COUNT)'},{[1] = 5},{'number'})
if CheckTableIsNil(num) then
gg.alert("ВЫ НЕ ВВЕЛИ КОЛИЧЕСТВО\nYOU DIDN'T ENTER THE QUANTITY")
else
Protect:Call(GameProcess.SetCoin, GameProcess, num[1])
end
end,