forked from lvyin555/wildsLongSword
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LuaScript.h
1687 lines (1675 loc) · 67.8 KB
/
LuaScript.h
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
#pragma once
#include <lua.hpp>
#include "loader.h"
lua_State* L;
static string Nowlua;
static string Sublua;
#pragma region GameFun
static int Game_Player_GetPlayerCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Coordinate::Entity.x);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Entity.y);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Entity.z);
return 3;
}
static int Game_Player_SetPlayerCoordinate(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Component::MovePlayerToPoint(Base::Vector3( x,y,z ));
return 0;
}
static int Game_Player_GetPlayerCollimatorCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Coordinate::Collimator.x);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Collimator.y);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Collimator.z);
return 3;
}
static int Game_Player_GetPlayerParabolaCollimatorCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Coordinate::Parabola.x);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Parabola.y);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Parabola.z);
return 3;
}
static int Game_Player_GetPlayerWeaponCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Coordinate::Weapon.x);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Weapon.y);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Weapon.z);
return 3;
}
static int Game_Player_CheckAimingStatus(lua_State* pL) {
lua_pushboolean(pL, Base::PlayerData::AimingState);
return 1;
}
static int Game_Player_AddEffect(lua_State* pL) {
int group = (int)lua_tointeger(pL, 1);
int record = (int)lua_tointeger(pL, 2);
Base::PlayerData::Effects::GenerateSpecialEffects(group, record);
return 0;
}
static int Game_Player_GetPlayerIncrementCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Coordinate::Increment.x);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Increment.y);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Increment.z);
return 3;
}
static int Game_Player_GetPlayerNavigationCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Coordinate::Navigation.x);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Navigation.y);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Navigation.z);
return 3;
}
static int Game_Player_GetPlayerVisualCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Coordinate::Visual.x);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Visual.y);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Visual.z);
return 3;
}
static int Game_Player_SetPlayerVisualCoordinate(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Base::PlayerData::SetVisual(x,y,z);
return 0;
}
static int Game_Player_UnbindPlayerVisualCoordinate(lua_State* pL) {
Base::PlayerData::UnbindVisual();
return 0;
}
static int Game_Player_GetPlayerActionId(lua_State* pL) {
lua_pushinteger(pL, Base::PlayerData::ActionId);
return 1;
}
static int Game_Player_GetPlayerAngle(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Angle);
return 1;
}
static int Game_Player_Weapon_GetWeaponId(lua_State* pL) {
lua_pushinteger(pL, Base::PlayerData::Weapons::WeaponId);
return 1;
}
static int Game_Player_Weapon_GetWeaponType(lua_State* pL) {
lua_pushinteger(pL, Base::PlayerData::Weapons::WeaponType);
return 1;
}
static int Game_Player_Weapon_ChangeWeapons(lua_State* pL) {
int type = (int)lua_tointeger(pL, 1);
int id = (int)lua_tointeger(pL, 2);
Base::PlayerData::Weapons::ChangeWeapons(type, id, false);
return 0;
}
static int Game_Player_Weapon_CompleteChangeWeapons(lua_State* pL) {
int type = (int)lua_tointeger(pL, 1);
int id = (int)lua_tointeger(pL, 2);
Base::PlayerData::Weapons::ChangeWeapons(type, id);
return 0;
}
static int Game_Player_Weapon_GetOrnamentsCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::WeaponOrnaments::OrnamentsCoordinate.x);
lua_pushnumber(pL, Base::PlayerData::WeaponOrnaments::OrnamentsCoordinate.y);
lua_pushnumber(pL, Base::PlayerData::WeaponOrnaments::OrnamentsCoordinate.z);
return 3;
}
static int Game_Player_Weapon_GetOrnamentsSize(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::WeaponOrnaments::OrnamentsSize.x);
lua_pushnumber(pL, Base::PlayerData::WeaponOrnaments::OrnamentsSize.y);
lua_pushnumber(pL, Base::PlayerData::WeaponOrnaments::OrnamentsSize.z);
return 3;
}
static int Game_Player_Weapon_SetOrnamentsCoordinate(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Base::PlayerData::WeaponOrnaments::SetOrnamentsCoordinate(x, y, z);
return 0;
}
static int Game_Player_Weapon_SetOrnamentsSize(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Base::PlayerData::WeaponOrnaments::SetOrnamentsSize(x, y, z);
return 0;
}
static int Game_Player_Weapon_DecontrolOrnamentsCoordinate(lua_State* pL) {
Base::PlayerData::WeaponOrnaments::DecontrolOrnamentsCoordinate();
return 0;
}
static int Game_Player_Weapon_DecontrolOrnamentsSize(lua_State* pL) {
Base::PlayerData::WeaponOrnaments::DecontrolOrnamentsSize();
return 0;
}
static int Game_Player_Weapon_GetMainWeaponCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Weapons::MainWeaponCoordinate.x);
lua_pushnumber(pL, Base::PlayerData::Weapons::MainWeaponCoordinate.y);
lua_pushnumber(pL, Base::PlayerData::Weapons::MainWeaponCoordinate.z);
return 3;
}
static int Game_Player_Weapon_GetMainWeaponSize(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Weapons::MainWeaponSize.x);
lua_pushnumber(pL, Base::PlayerData::Weapons::MainWeaponSize.y);
lua_pushnumber(pL, Base::PlayerData::Weapons::MainWeaponSize.z);
return 3;
}
static int Game_Player_Weapon_SetMainWeaponCoordinate(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Base::PlayerData::Weapons::SetMainWeaponCoordinate(x, y, z);
return 0;
}
static int Game_Player_Weapon_SetMainWeaponSize(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Base::PlayerData::Weapons::SetMainWeaponSize(x, y, z);
return 0;
}
static int Game_Player_Weapon_DecontrolMainWeaponCoordinate(lua_State* pL) {
Base::PlayerData::Weapons::DecontrolMainWeaponCoordinate();
return 0;
}
static int Game_Player_Weapon_DecontrolMainWeaponSize(lua_State* pL) {
Base::PlayerData::Weapons::DecontrolMainWeaponSize();
return 0;
}
static int Game_Player_Weapon_GetSecondaryWeaponCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Weapons::SecondaryWeaponCoordinate.x);
lua_pushnumber(pL, Base::PlayerData::Weapons::SecondaryWeaponCoordinate.y);
lua_pushnumber(pL, Base::PlayerData::Weapons::SecondaryWeaponCoordinate.z);
return 3;
}
static int Game_Player_Weapon_GetSecondaryWeaponSize(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Weapons::SecondaryWeaponSize.x);
lua_pushnumber(pL, Base::PlayerData::Weapons::SecondaryWeaponSize.y);
lua_pushnumber(pL, Base::PlayerData::Weapons::SecondaryWeaponSize.z);
return 3;
}
static int Game_Player_Weapon_SetSecondaryWeaponCoordinate(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Base::PlayerData::Weapons::SetSecondaryWeaponCoordinate(x, y, z);
return 0;
}
static int Game_Player_Weapon_SetSecondaryWeaponSize(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Base::PlayerData::Weapons::SetSecondaryWeaponSize(x, y, z);
return 0;
}
static int Game_Player_Weapon_DecontrolSecondaryWeaponCoordinate(lua_State* pL) {
Base::PlayerData::Weapons::DecontrolSecondaryWeaponCoordinate();
return 0;
}
static int Game_Player_Weapon_DecontrolSecondaryWeaponSize(lua_State* pL) {
Base::PlayerData::Weapons::DecontrolSecondaryWeaponSize();
return 0;
}
static int Game_Player_Weapon_CharacteristicIntValue(lua_State* pL) {
string ptr = "0x" + (string)lua_tostring(pL, 1);
lua_pushinteger(pL, Component::GetWeaponCharacteristicIntValue(ptr));
return 1;
}
static int Game_Player_Weapon_CharacteristicFloatValue(lua_State* pL) {
string ptr = "0x" + (string)lua_tostring(pL, 1);
lua_pushnumber(pL, Component::GetWeaponCharacteristicFloatValue(ptr));
return 1;
}
static int Game_Player_Weapon_CharacteristicByteValue(lua_State* pL) {
string ptr = "0x" + (string)lua_tostring(pL, 1);
lua_pushinteger(pL, Component::GetWeaponCharacteristicByteValue(ptr));
return 1;
}
static int Game_Player_Weapon_GetHitCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Weapons::HitCoordinate.x);
lua_pushnumber(pL, Base::PlayerData::Weapons::HitCoordinate.y);
lua_pushnumber(pL, Base::PlayerData::Weapons::HitCoordinate.z);
return 3;
}
static int Game_Player_GetFsmData(lua_State* pL) {
lua_pushinteger(pL, Base::PlayerData::NowFsm.Target);
lua_pushinteger(pL, Base::PlayerData::NowFsm.Id);
return 2;
}
static int Game_Player_RunFsmAction(lua_State* pL) {
int type = (int)lua_tonumber(pL, 1);
int id = (int)lua_tonumber(pL, 2);
Base::PlayerData::RunDerivedAction(type, id);
return 0;
}
static int Game_Player_CheckRunFsmActionOver(lua_State* pL) {
lua_pushboolean(pL, Base::PlayerData::CheckDerivedAction());
return 1;
}
static int Game_Player_GetPlayerHealth(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::BasicHealth);
lua_pushnumber(pL, Base::PlayerData::MaxHealth);
lua_pushnumber(pL, Base::PlayerData::CurrentHealth);
return 3;
}
static int Game_Player_SetPlayerCurrentHealth(lua_State* pL) {
float health = (float)lua_tonumber(pL, 1);
Component::SetPlayerHealth(health);
return 0;
}
static int Game_Player_SetPlayerBasicHealth(lua_State* pL) {
float health = (float)lua_tonumber(pL, 1);
Component::SetPlayerBasicHealth(health);
return 0;
}
static int Game_Player_GetPlayerEndurance(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::MaxEndurance);
lua_pushnumber(pL, Base::PlayerData::CurrentEndurance);
return 2;
}
static int Game_Player_SetPlayerCurrentEndurance(lua_State* pL) {
float endurance = (float)lua_tonumber(pL, 1);
Component::SetPlayerEndurance(endurance);
return 0;
}
static int Game_Player_SetPlayerMaxEndurance(lua_State* pL) {
float endurance = (float)lua_tonumber(pL, 1);
Component::SetPlayerMaxEndurance(endurance);
return 0;
}
static int Game_Player_GetPlayerRoleInfo(lua_State* pL) {
//lua_pushstring(pL, Base::PlayerData::Name.c_str());
lua_pushinteger(pL, Base::PlayerData::Hr);
lua_pushinteger(pL, Base::PlayerData::Mr);
return 2;
}
static int Game_World_GetMapId(lua_State* pL) {
lua_pushinteger(pL, Base::World::MapId);
return 1;
}
static int Game_Monster_SetFilter(lua_State* pL) {
int id = (int)lua_tointeger(pL, 1);
int subId = (int)lua_tointeger(pL, 2);
Component::SetMonsterFilter(id,subId);
return 0;
}
static int Game_Monster_DisableFilter(lua_State* pL) {
Component::DisableMonsterFilter();
return 0;
}
static int Game_Monster_SetBehaviorOfNavigationMonsters(lua_State* pL) {
int fsmId = (int)lua_tointeger(pL, -1);
lua_pushboolean(pL, Component::NavigationMonsterBehaviorControl(fsmId));
return 1;
}
static int Game_Monster_KillNavigationMarkMonster(lua_State* pL) {
lua_pushboolean(pL, Component::KillNavigationMonster());
return 1;
}
static int Game_Monster_SetBehaviorOfNearestMonsters(lua_State* pL) {
int fsmId = (int)lua_tointeger(pL, -1);
lua_pushboolean(pL, Component::NearestMonsterBehaviorControl(fsmId));
return 1;
}
static int Game_Monster_KillNearestMonster(lua_State* pL) {
lua_pushboolean(pL, Component::KillNearestMonster());
return 1;
}
static int Game_Monster_KillNearestMonsterInRange(lua_State* pL) {
float min = (float)lua_tonumber(pL, 1);
float max = (float)lua_tonumber(pL, 2);
lua_pushboolean(pL, Component::KillNearestMonster(min, max));
return 1;
}
static int Game_Monster_SetBehaviorOfLastHitMonsters(lua_State* pL) {
int fsmId = (int)lua_tointeger(pL, -1);
lua_pushboolean(pL, Component::LastHitMonsterBehaviorControl(fsmId));
return 1;
}
static int Game_Monster_KillLastHitMonster(lua_State* pL) {
lua_pushboolean(pL, Component::KillLastHitMonster());
return 1;
}
static int Game_Monster_KillAllMonsterInRange(lua_State* pL) {
float min = (float)lua_tonumber(pL, 1);
float max = (float)lua_tonumber(pL, 2);
Component::KillAllMonster(min, max);
return 0;
}
static int Game_Monster_AddDebuffToNavigationMarkMonster(lua_State* pL) {
string buff = (string)lua_tostring(pL, -1);
lua_pushboolean(pL, Component::SetNavigationMonsterBuff(buff));
return 1;
}
static int Game_Monster_AddDebuffNearestMonster(lua_State* pL) {
string buff = (string)lua_tostring(pL, -1);
lua_pushboolean(pL, Component::SetNearestMonsterBuff(buff));
return 1;
}
static int Game_Monster_AddDebuffNearestMonsterInRange(lua_State* pL) {
string buff = (string)lua_tostring(pL, 1);
float min = (float)lua_tonumber(pL, 2);
float max = (float)lua_tonumber(pL, 3);
lua_pushboolean(pL, Component::SetNearestMonsterBuff(buff, min, max));
return 1;
}
static int Game_Monster_AddDebuffLastHitMonster(lua_State* pL) {
string buff = (string)lua_tostring(pL, -1);
lua_pushboolean(pL, Component::SetLastHitMonsterBuff(buff));
return 1;
}
static int Game_Monster_AddDebuffToAllMonsterInRange(lua_State* pL) {
string buff = (string)lua_tostring(pL, 1);
float min = (float)lua_tonumber(pL, 2);
float max = (float)lua_tonumber(pL, 3);
Component::SetAllMonsterBuff(buff, min, max);
return 0;
}
static int Game_Monster_GetNavigationMonsterCoordinates(lua_State* pL) {
Base::Vector3 Coordinate = Component::GetNavigationMonsterCoordinates();
lua_pushnumber(pL, Coordinate.x);
lua_pushnumber(pL, Coordinate.y);
lua_pushnumber(pL, Coordinate.z);
return 3;
}
static int Game_Monster_GetNearestMonsterCoordinates(lua_State* pL) {
Base::Vector3 Coordinate = Component::GetNearestMonsterCoordinates();
lua_pushnumber(pL, Coordinate.x);
lua_pushnumber(pL, Coordinate.y);
lua_pushnumber(pL, Coordinate.z);
return 3;
}
static int Game_Monster_GetLastHitMonsterCoordinates(lua_State* pL) {
Base::Vector3 Coordinate = Component::GetLastHitMonsterCoordinates();
lua_pushnumber(pL, Coordinate.x);
lua_pushnumber(pL, Coordinate.y);
lua_pushnumber(pL, Coordinate.z);
return 3;
}
static int Game_Monster_GetMonsterCNName(lua_State* pL) {
int monsterId = (int)lua_tointeger(pL, -1);
lua_pushstring(pL, Component::GetMonstersName_CN(monsterId).c_str());
return 1;
}
static int Game_Environmental_SetFilter(lua_State* pL) {
int id = (int)lua_tointeger(pL, 1);
int subId = (int)lua_tointeger(pL, 2);
Component::SetEnvironmentalFilter(id, subId);
return 0;
}
static int Game_Environmental_DisableFilter(lua_State* pL) {
Component::DisableEnvironmentalFilter();
return 0;
}
static int Game_Environmental_SetAllEnvironmentalCoordinatesInRange(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
float min = (float)lua_tonumber(pL, 4);
float max = (float)lua_tonumber(pL, 5);
Component::SetAllEnvironmentalCoordinates(Base::Vector3(x,y,z), min, max);
return 0;
}
static int Game_Player_CreateWeaponProjectiles(lua_State* pL) {
int id = (int)lua_tointeger(pL, 1);
float startx = (float)lua_tonumber(pL, 2);
float starty = (float)lua_tonumber(pL, 3);
float startz = (float)lua_tonumber(pL, 4);
float endx = (float)lua_tonumber(pL, 5);
float endy = (float)lua_tonumber(pL, 6);
float endz = (float)lua_tonumber(pL, 7);
lua_pushboolean(pL, Base::ProjectilesOperation::CreateProjectiles(
id, Base::Vector3(startx, starty, startz), Base::Vector3(endx, endy, endz),0
));
return 1;
}
static int Game_Player_CreateBowgunProjectiles(lua_State* pL) {
int id = (int)lua_tointeger(pL, 1);
float startx = (float)lua_tonumber(pL, 2);
float starty = (float)lua_tonumber(pL, 3);
float startz = (float)lua_tonumber(pL, 4);
float endx = (float)lua_tonumber(pL, 5);
float endy = (float)lua_tonumber(pL, 6);
float endz = (float)lua_tonumber(pL, 7);
lua_pushboolean(pL, Base::ProjectilesOperation::CreateProjectiles(
id, Base::Vector3(startx, starty, startz), Base::Vector3(endx, endy, endz),1
));
return 1;
}
static int Game_Monster_GetAllMonsterCoordinates(lua_State* pL)
{
lua_newtable(pL);//创建一个表格,放在栈顶
for (auto [id, monsterData] : Component::GetAllMonsterCoordinates()) {
lua_pushinteger(pL, id);//压入编号
lua_newtable(pL);//压入编号信息表
lua_pushstring(pL, "X");//X坐标
lua_pushnumber(pL, monsterData.CoordinatesX);//value
lua_settable(pL, -3);//弹出X坐标
lua_pushstring(pL, "Y");//Y坐标
lua_pushnumber(pL, monsterData.CoordinatesY);
lua_settable(pL, -3);
lua_pushstring(pL, "Z");//Z坐标
lua_pushnumber(pL, monsterData.CoordinatesZ);
lua_settable(pL, -3);
lua_pushstring(pL, "Id");//怪物Id
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");//怪物SubId
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);//弹出到顶层
}
return 1;
}
static int Game_Monster_GetAllMonsterHealth(lua_State* pL)
{
lua_newtable(pL);
for (auto [id, monsterData] : Component::GetAllMonsterHealth()) {
lua_pushinteger(pL, id);
lua_newtable(pL);
lua_pushstring(pL, "Health");
lua_pushnumber(pL, monsterData.Health);
lua_settable(pL, -3);
lua_pushstring(pL, "MaxHealth");
lua_pushnumber(pL, monsterData.MaxHealth);
lua_settable(pL, -3);
lua_pushstring(pL, "Id");
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);
}
return 1;
}
static int Game_Monster_GetAllMonsterDebuff(lua_State* pL)
{
lua_newtable(pL);
for (auto [id, monsterData] : Component::GetAllMonsterDeBuff()) {
lua_pushinteger(pL, id);
lua_newtable(pL);
lua_pushstring(pL, "Debuff");
lua_newtable(pL);
for (string debuff : vector<string>{ "Covet","Dizziness","Paralysis","Sleep","Poisoning","Ride","Ridedowna","Reducebreath","Explode","Flicker","FlickerG","Smoke","Traphole","Stasistrap" }) {
lua_pushstring(pL, debuff.c_str());
lua_newtable(pL);
lua_pushstring(pL, "State");
lua_pushnumber(pL, monsterData.DeBuff[debuff].StateValue / monsterData.DeBuff[debuff].MaxStateValue);
lua_settable(pL, -3);
lua_pushstring(pL, "Recovery");
lua_pushnumber(pL, monsterData.DeBuff[debuff].RecoveryValue / monsterData.DeBuff[debuff].MaxRecoveryValue);
lua_settable(pL, -3);
lua_settable(pL, -3);
}
lua_settable(pL, -3);
lua_pushstring(pL, "Id");
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);
}
return 1;
}
static int Game_Monster_GetAllMonsterCoordinatesInRange(lua_State* pL)
{
float min = (float)lua_tonumber(pL, 1);
float max = (float)lua_tonumber(pL, 2);
lua_newtable(pL);//创建一个表格,放在栈顶
for (auto [id, monsterData] : Component::GetAllMonsterCoordinatesRelativeToPlayers(min, max)) {
lua_pushinteger(pL, id);//压入编号
lua_newtable(pL);//压入编号信息表
lua_pushstring(pL, "X");//X坐标
lua_pushnumber(pL, monsterData.CoordinatesX);//value
lua_settable(pL, -3);//弹出X坐标
lua_pushstring(pL, "Y");//Y坐标
lua_pushnumber(pL, monsterData.CoordinatesY);
lua_settable(pL, -3);
lua_pushstring(pL, "Z");//Z坐标
lua_pushnumber(pL, monsterData.CoordinatesZ);
lua_settable(pL, -3);
lua_pushstring(pL, "Id");//怪物Id
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");//怪物SubId
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);//弹出到顶层
}
return 1;
}
static int Game_Monster_GetAllMonsterHealthInRange(lua_State* pL)
{
float min = (float)lua_tonumber(pL, 1);
float max = (float)lua_tonumber(pL, 2);
lua_newtable(pL);
for (auto [id, monsterData] : Component::GetAllMonsterHealthRelativeToPlayers(min, max)) {
lua_pushinteger(pL, id);
lua_newtable(pL);
lua_pushstring(pL, "Health");
lua_pushnumber(pL, monsterData.Health);
lua_settable(pL, -3);
lua_pushstring(pL, "MaxHealth");
lua_pushnumber(pL, monsterData.MaxHealth);
lua_settable(pL, -3);
lua_pushstring(pL, "Id");
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);
}
return 1;
}
static int Game_Monster_GetAllMonsterDebuffInRange(lua_State* pL)
{
float min = (float)lua_tonumber(pL, 1);
float max = (float)lua_tonumber(pL, 2);
lua_newtable(pL);
for (auto [id, monsterData] : Component::GetAllMonsterDeBuffRelativeToTarget(min, max)) {
lua_pushinteger(pL, id);
lua_newtable(pL);
lua_pushstring(pL, "Debuff");
lua_newtable(pL);
for (string debuff : vector<string>{ "Covet","Dizziness","Paralysis","Sleep","Poisoning","Ride","Ridedowna","Reducebreath","Explode","Flicker","FlickerG","Smoke","Traphole","Stasistrap" }) {
lua_pushstring(pL, debuff.c_str());
lua_newtable(pL);
lua_pushstring(pL, "State");
lua_pushnumber(pL, monsterData.DeBuff[debuff].StateValue / monsterData.DeBuff[debuff].MaxStateValue);
lua_settable(pL, -3);
lua_pushstring(pL, "Recovery");
lua_pushnumber(pL, monsterData.DeBuff[debuff].RecoveryValue / monsterData.DeBuff[debuff].MaxRecoveryValue);
lua_settable(pL, -3);
lua_settable(pL, -3);
}
lua_settable(pL, -3);
lua_pushstring(pL, "Id");
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);
}
return 1;
}
static int Game_Monster_GetAllMonsterCoordinatesInTargetPointRange(lua_State* pL)
{
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
float min = (float)lua_tonumber(pL, 4);
float max = (float)lua_tonumber(pL, 5);
lua_newtable(pL);//创建一个表格,放在栈顶
for (auto [id, monsterData] : Component::GetAllMonsterCoordinatesRelativeToTarget(Base::Vector3(x,y,z),min, max)) {
lua_pushinteger(pL, id);//压入编号
lua_newtable(pL);//压入编号信息表
lua_pushstring(pL, "X");//X坐标
lua_pushnumber(pL, monsterData.CoordinatesX);//value
lua_settable(pL, -3);//弹出X坐标
lua_pushstring(pL, "Y");//Y坐标
lua_pushnumber(pL, monsterData.CoordinatesY);
lua_settable(pL, -3);
lua_pushstring(pL, "Z");//Z坐标
lua_pushnumber(pL, monsterData.CoordinatesZ);
lua_settable(pL, -3);
lua_pushstring(pL, "Id");//怪物Id
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");//怪物SubId
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);//弹出到顶层
}
return 1;
}
static int Game_Monster_GetAllMonsterHealthInTargetPointRange(lua_State* pL)
{
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
float min = (float)lua_tonumber(pL, 4);
float max = (float)lua_tonumber(pL, 5);
lua_newtable(pL);
for (auto [id, monsterData] : Component::GetAllMonsterHealthRelativeToTarget(Base::Vector3(x, y, z), min, max)) {
lua_pushinteger(pL, id);
lua_newtable(pL);
lua_pushstring(pL, "Health");
lua_pushnumber(pL, monsterData.Health);
lua_settable(pL, -3);
lua_pushstring(pL, "MaxHealth");
lua_pushnumber(pL, monsterData.MaxHealth);
lua_settable(pL, -3);
lua_pushstring(pL, "Id");
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);
}
return 1;
}
static int Game_Monster_GetAllMonsterDebuffInTargetPointRange(lua_State* pL)
{
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
float min = (float)lua_tonumber(pL, 4);
float max = (float)lua_tonumber(pL, 5);
lua_newtable(pL);
for (auto [id, monsterData] : Component::GetAllMonsterDeBuffRelativeToTarget(Base::Vector3(x, y, z), min, max)) {
lua_pushinteger(pL, id);
lua_newtable(pL);
lua_pushstring(pL, "Debuff");
lua_newtable(pL);
for (string debuff : vector<string>{ "Covet","Dizziness","Paralysis","Sleep","Poisoning","Ride","Ridedowna","Reducebreath","Explode","Flicker","FlickerG","Smoke","Traphole","Stasistrap" }) {
lua_pushstring(pL, debuff.c_str());
lua_newtable(pL);
lua_pushstring(pL, "State");
lua_pushnumber(pL, monsterData.DeBuff[debuff].StateValue / monsterData.DeBuff[debuff].MaxStateValue);
lua_settable(pL, -3);
lua_pushstring(pL, "Recovery");
lua_pushnumber(pL, monsterData.DeBuff[debuff].RecoveryValue / monsterData.DeBuff[debuff].MaxRecoveryValue);
lua_settable(pL, -3);
lua_settable(pL, -3);
}
lua_settable(pL, -3);
lua_pushstring(pL, "Id");
lua_pushinteger(pL, monsterData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");
lua_pushinteger(pL, monsterData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << monsterData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);
}
return 1;
}
static int Game_Environmental_GetAllEnvironmentalCoordinatesInRange(lua_State* pL)
{
float min = (float)lua_tonumber(pL, 1);
float max = (float)lua_tonumber(pL, 2);
lua_newtable(pL);//创建一个表格,放在栈顶
for (auto [id, environmentalData] : Component::GetAllEnvironmentalCoordinates(min, max)) {
lua_pushinteger(pL, id);//压入编号
lua_newtable(pL);//压入编号信息表
lua_pushstring(pL, "X");//X坐标
lua_pushnumber(pL, environmentalData.CoordinatesX);//value
lua_settable(pL, -3);//弹出X坐标
lua_pushstring(pL, "Y");//Y坐标
lua_pushnumber(pL, environmentalData.CoordinatesY);
lua_settable(pL, -3);
lua_pushstring(pL, "Z");//Z坐标
lua_pushnumber(pL, environmentalData.CoordinatesZ);
lua_settable(pL, -3);
lua_pushstring(pL, "Id");//怪物Id
lua_pushinteger(pL, environmentalData.Id);
lua_settable(pL, -3);
lua_pushstring(pL, "SubId");//怪物SubId
lua_pushinteger(pL, environmentalData.SubId);
lua_settable(pL, -3);
lua_pushstring(pL, "Ptr");//怪物指针
ostringstream ptr;
ptr << environmentalData.Plot;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
lua_settable(pL, -3);
lua_settable(pL, -3);//弹出到顶层
}
return 1;
}
static int Game_Player_GetPlayerBuffDuration(lua_State* pL) {
string buff = (string)lua_tostring(pL, -1);
lua_pushnumber(pL, Base::PlayerData::GetPlayerBuff(buff));
return 1;
}
static int Game_Player_SetPlayerBuffDuration(lua_State* pL) {
string buff = (string)lua_tostring(pL, 1);
float duration = (float)lua_tonumber(pL, 2);
Base::PlayerData::SetPlayerBuff(buff, duration);
return 0;
}
static int Game_Player_GetPlayerHookCoordinate(lua_State* pL) {
lua_pushnumber(pL, Base::PlayerData::Coordinate::Hook.x);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Hook.y);
lua_pushnumber(pL, Base::PlayerData::Coordinate::Hook.z);
return 3;
}
static int Game_Player_GetMonstersHateToPlayers(lua_State* pL) {
lua_newtable(pL);
vector<void*> Monster = Component::GetMonstersHateToPlayers();
vector<void*>::iterator it = Monster.begin();
for (; it != Monster.end(); ++it)
{
ostringstream ptr;
ptr << *it;
string ptrstr = ptr.str();
lua_pushstring(pL, ptrstr.c_str());
}
lua_settable(pL, -3);
return 1;
}
static int Game_Player_SetHookCoordinateChange(lua_State* pL) {
float x = (float)lua_tonumber(pL, 1);
float y = (float)lua_tonumber(pL, 2);
float z = (float)lua_tonumber(pL, 3);
Base::PlayerData::HookCoordinateChange = Base::Vector3(x, y, z);
Base::PlayerData::HookChange = true;
return 0;
}
static int Game_Player_CancelHookCoordinateChange(lua_State* pL) {
Base::PlayerData::HookChange = false;
return 0;
}
static int Game_Player_GetPlayerVisualDistance(lua_State* pL) {
void* VisualOffset = *offsetPtr<undefined**>((undefined(*)())Base::BasicGameData::PlayerPlot, 0x7690);
lua_pushnumber(pL, *offsetPtr<float>(VisualOffset, 0x5E8));
return 1;
}
static int Game_Player_GetPlayerVisualHeight(lua_State* pL) {
void* VisualOffset = *offsetPtr<undefined**>((undefined(*)())Base::BasicGameData::PlayerPlot, 0x7690);
lua_pushnumber(pL, *offsetPtr<float>(VisualOffset, 0x5E4));
return 1;
}
static int Game_Player_SetPlayerVisualDistance(lua_State* pL) {
float distance = (float)lua_tonumber(pL, -1);
void* VisualOffset = *offsetPtr<undefined**>((undefined(*)())Base::BasicGameData::PlayerPlot, 0x7690);
*offsetPtr<float>(VisualOffset, 0x5E8) = distance;
return 0;
}
static int Game_Player_SetPlayerVisualHeight(lua_State* pL) {
float height = (float)lua_tonumber(pL, -1);
void* VisualOffset = *offsetPtr<undefined**>((undefined(*)())Base::BasicGameData::PlayerPlot, 0x7690);
*offsetPtr<float>(VisualOffset, 0x5E4) = height;
return 0;
}
static int Game_Entity_GetEntityProperties(lua_State* pL) {
string entity = "0x" + (string)lua_tostring(pL, -1);
Component::EntityProperties entityProperties = Component::GetEntityProperties(entity);
lua_newtable(pL);
lua_pushstring(pL, "Coordinate");
lua_newtable(pL);
lua_pushstring(pL, "x");
lua_pushnumber(pL, entityProperties.Coordinate.x);
lua_settable(pL, -3);
lua_pushstring(pL, "y");
lua_pushnumber(pL, entityProperties.Coordinate.y);
lua_settable(pL, -3);
lua_pushstring(pL, "z");
lua_pushnumber(pL, entityProperties.Coordinate.z);
lua_settable(pL, -3);
lua_settable(pL, -3);
lua_pushstring(pL, "Size");
lua_newtable(pL);
lua_pushstring(pL, "x");
lua_pushnumber(pL, entityProperties.Size.x);
lua_settable(pL, -3);
lua_pushstring(pL, "y");
lua_pushnumber(pL, entityProperties.Size.y);
lua_settable(pL, -3);
lua_pushstring(pL, "z");
lua_pushnumber(pL, entityProperties.Size.z);
lua_settable(pL, -3);
lua_settable(pL, -3);
return 1;
}
static int Game_Entity_SetEntityCoordinate(lua_State* pL) {
string entity = "0x" + (string)lua_tostring(pL, 1);
float x = (float)lua_tonumber(pL, 2);
float y = (float)lua_tonumber(pL, 3);
float z = (float)lua_tonumber(pL, 4);
Component::SetEntityCoordinate(entity, Base::Vector3(x, y, z));
return 0;
}
static int Game_Entity_SetEntitySize(lua_State* pL) {
string entity = "0x" + (string)lua_tostring(pL, 1);
float x = (float)lua_tonumber(pL, 2);
float y = (float)lua_tonumber(pL, 3);
float z = (float)lua_tonumber(pL, 4);
Component::SetEntitySize(entity, Base::Vector3(x, y, z));
return 0;
}
#pragma endregion
#pragma region SystemFun
static int System_Keyboard_CheckKey(lua_State* pL) {
int key = (int)lua_tointeger(pL, -1);
lua_pushboolean(pL, Base::Keyboard::CheckKey(key));
return 1;
}
static int System_Keyboard_CheckDoubleKey(lua_State* pL) {
int key = (int)lua_tointeger(pL, -1);
lua_pushboolean(pL, Base::Keyboard::CheckKey(key, 2));
return 1;
}
static int System_Keyboard_CheckKeyIsPressed(lua_State* pL) {
int key = (int)lua_tointeger(pL, -1);
bool ret = GetKeyState(key) < 0;
if (!Base::Keyboard::CheckWindows())
ret = false;
lua_pushboolean(pL, ret);
return 1;
}
static int System_HotKey_AddHotKey(lua_State* pL) {
string name = (string)lua_tostring(pL, 1);
string describe = (string)lua_tostring(pL, 2);
unsigned int key = (unsigned int)lua_tointeger(pL, 3);
ImHotKey::AddHotKey(name.c_str(), describe.c_str(), key);
return 0;
}
static int System_HotKey_CheckKey(lua_State* pL) {
string name = (string)lua_tostring(pL, -1);
if (ControlProgram::Checkhotkey.find(name) != ControlProgram::Checkhotkey.end()) {
lua_pushboolean(pL, ControlProgram::Checkhotkey[name]);
ControlProgram::Checkhotkey[name] = false;
} else
lua_pushboolean(pL, false);
return 1;
}
static int System_Chronoscope_AddChronoscope(lua_State* pL) {
float time = (float)lua_tonumber(pL, 1);
string name = (string)lua_tostring(pL, 2);
Base::Chronoscope::AddChronoscope(time, name, true);
return 0;
}
static int System_Chronoscope_CheckPresenceChronoscope(lua_State* pL) {
string name = (string)lua_tostring(pL, -1);
lua_pushboolean(pL, Base::Chronoscope::CheckPresenceChronoscope(name));
return 1;
}
static int System_Chronoscope_DelChronoscope(lua_State* pL) {
string name = (string)lua_tostring(pL, -1);
Base::Chronoscope::DelChronoscope(name);
return 0;
}
static int System_Chronoscope_CheckChronoscope(lua_State* pL) {
string name = (string)lua_tostring(pL, -1);
lua_pushboolean(pL, Base::Chronoscope::CheckChronoscope(name));
return 1;
}
static int System_Message_ShowMessage(lua_State* pL) {
string message = (string)lua_tostring(pL, -1);
Component::ShowMessage(message);
return 0;
}
static int System_Console_Info(lua_State* pL) {
string message = (string)lua_tostring(pL, -1);
LOG(INFO) << Base::ModConfig::ModName << " LUA INFO:" << message;
return 0;
}
static int System_Console_Error(lua_State* pL) {
string message = (string)lua_tostring(pL, -1);
LOG(ERR) << Base::ModConfig::ModName << " LUA ERR:"<< message;
return 0;
}
static int System_XboxPad_CheckKey(lua_State* pL) {
int key = (int)lua_tointeger(pL, -1);
lua_pushboolean(pL, Base::XboxPad::CheckKey(key));
return 1;
}
static int System_XboxPad_CheckDoubleKey(lua_State* pL) {
int key = (int)lua_tointeger(pL, -1);
lua_pushboolean(pL, Base::XboxPad::CheckKey(key, 2));
return 1;
}
static int System_XboxPad_CheckKeyIsPressed(lua_State* pL) {
int key = (int)lua_tointeger(pL, -1);
bool ret = Base::XboxPad::KeyIdHandle(key);
lua_pushboolean(pL, ret);
return 1;
}
static int System_LuaScript_Build(lua_State* pL) {
lua_pushnumber(pL, Base::ModConfig::ModBuild);
return 1;
}
static int System_LuaScript_Version(lua_State* pL) {
lua_pushstring(pL, Base::ModConfig::ModVersion.c_str());
return 1;
}
static int System_GetUUID(lua_State* pL) {
lua_pushstring(pL, Base::Calculation::GetUUID().c_str());
return 1;
}
static int System_DeBug_OpenDeBugConsole(lua_State* pL) {
Base::ModConfig::ModConsole = true;
return 0;
}
static int System_DeBug_CloseDeBugConsole(lua_State* pL) {
Base::ModConfig::ModConsole = false;
return 0;
}
static int System_Memory_GetOffsetAddress(lua_State* pL) {
string ptr = "0x" + (string)lua_tostring(pL, 1);
string offset = "0x" + (string)lua_tostring(pL, 2);
//ptr处理
long long Ptr = 0;
sscanf_s(ptr.c_str(), "%p", &Ptr, sizeof(long long));
void* ptrAddress = (void*)Ptr;