-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinventory_oCNpc.d
2531 lines (1941 loc) · 74.8 KB
/
inventory_oCNpc.d
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
/*
* Hlp_GetOpenInventoryType
*
* - identifies type of opened inventory:
* - 0 none
* - 1 players inventory
* - 2 looting NPC
* - 3 looting chest
* - 4 trading inventory
* - 5 stealing
*/
/*
enum {
NPC_GAME_NORMAL,
NPC_GAME_PLUNDER,
NPC_GAME_STEAL
};
*/
/*
* Credits: functions Trade_SetBuyMultiplier & Trade_SetSellMultiplier originally created by OrcWarriorPL
* https://forum.worldofplayers.de/forum/threads/879891-Skriptpaket-Ikarus-2/page12?p=14836995&viewfull=1#post14836995
*
* They were modified to change multipliers for both inventory containers in case of both buying / selling containers.
*/
//Float
func void Trade_SetBuyMultiplier (var int mulF) {
var oCViewDialogTrade dialogTrade;
var oCViewDialogItemContainer itemCont;
if (MEM_InformationMan.DlgTrade) {
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
//G1
if (dialogTrade.dlgInventoryNpc) {
itemCont = _^ (dialogTrade.dlgInventoryNpc);
itemCont.valueMultiplier = mulF;
};
if (MEMINT_SwitchG1G2(1, 0)) {
var int ptr; ptr = _@(dialogTrade.dlgInventoryNpc) + 252;
if (ptr) {
itemCont = _^ (ptr);
itemCont.valueMultiplier = mulF;
};
};
};
};
//Float
func void Trade_SetSellMultiplier (var int mulF) {
var oCViewDialogTrade dialogTrade;
var oCViewDialogItemContainer itemCont;
if (MEM_InformationMan.DlgTrade) {
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
if (MEMINT_SwitchG1G2(1, 0)) {
var int ptr; ptr = _@(dialogTrade.dlgInventoryNpc) + 260;
if (ptr) {
itemCont = _^ (ptr);
itemCont.valueMultiplier = mulF;
};
};
if (dialogTrade.dlgInventoryPlayer) {
itemCont = _^ (dialogTrade.dlgInventoryPlayer);
itemCont.valueMultiplier = mulF;
};
};
};
//Float
func int Trade_GetBuyMultiplier () {
var oCViewDialogTrade dialogTrade;
var oCViewDialogItemContainer itemCont;
if (MEM_InformationMan.DlgTrade) {
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
if (dialogTrade.dlgInventoryNpc) {
itemCont = _^ (dialogTrade.dlgInventoryNpc);
return itemCont.valueMultiplier;
};
};
return FLOATNULL;
};
//Float
func int Trade_GetSellMultiplier () {
var oCViewDialogTrade dialogTrade;
var oCViewDialogItemContainer itemCont;
if (MEM_InformationMan.DlgTrade) {
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
if (dialogTrade.dlgInventoryPlayer) {
itemCont = _^ (dialogTrade.dlgInventoryPlayer);
return itemCont.valueMultiplier;
};
};
return FLOATNULL;
};
/*
* Function returns game_mode
*/
func int oCNpc_Get_Game_Mode () {
//0x008DBC24 public: static int oCNpc::game_mode
const int oCNpc__game_mode_G1 = 9288740;
//0x00AB27D0 public: static int oCNpc::game_mode
const int oCNpc__game_mode_G2 = 11216848;
return + MEM_ReadInt (MEMINT_SwitchG1G2 (oCNpc__game_mode_G1, oCNpc__game_mode_G2));
};
/*
* Function updates game_mode
*/
func void oCNpc_Set_Game_Mode (var int newMode) {
//0x008DBC24 public: static int oCNpc::game_mode
const int oCNpc__game_mode_G1 = 9288740;
//0x00AB27D0 public: static int oCNpc::game_mode
const int oCNpc__game_mode_G2 = 11216848;
MEM_WriteInt (MEMINT_SwitchG1G2 (oCNpc__game_mode_G1, oCNpc__game_mode_G2), newMode);
};
//0x008DBC24 public: static int oCNpc::game_mode
//0x008DBC28 class oCNpc * stealnpc
//0x008DBC2C float stealcheck_timer
const int OpenInvType_None = 0;
const int OpenInvType_Player = 1;
const int OpenInvType_NPC = 2;
const int OpenInvType_Chest = 3;
const int OpenInvType_Trading = 4;
const int OpenInvType_Stealing = 5;
func int Hlp_GetOpenInventoryType () {
//0x008DA998 class zCList<class oCItemContainer> s_openContainers
const int s_openContainers_G1 = 9283992;
//0x00AB0FD4 class zCList<class oCItemContainer> s_openContainers
const int s_openContainers_G2 = 11210708;
//0x007DCDFC const oCItemContainer::`vftable'
const int oCItemContainer_vtbl_G1 = 8244732;
//0x0083C4AC const oCItemContainer::`vftable'
const int oCItemContainer_vtbl_G2 = 8635564;
//0x007DCEA4 const oCStealContainer::`vftable'
const int oCStealContainer_vtbl_G1 = 8244900;
//0x0083C574 const oCStealContainer::`vftable'
const int oCStealContainer_vtbl_G2 = 8635764;
//0x007DCF54 const oCNpcContainer::`vftable'
const int oCNpcContainer_vtbl_G1 = 8245076;
//0x0083C644 const oCNpcContainer::`vftable'
const int oCNpcContainer_vtbl_G2 = 8635972;
//0x007DD004 const oCNpcInventory::`vftable'
const int oCNpcInventory_vtbl_G1 = 8245252;
//0x0083C714 const oCNpcInventory::`vftable'
const int oCNpcInventory_vtbl_G2 = 8636180;
//-- 1. check - game mode
var int game_mode; game_mode = oCNpc_Get_Game_Mode();
if (game_mode == NPC_GAME_PLUNDER) {
return OpenInvType_NPC;
};
if (game_mode == NPC_GAME_STEAL) {
return OpenInvType_Stealing;
};
//-- 2. check - dialog trade
if (MEM_InformationMan.DlgTrade) {
var oCViewDialogTrade dlgTrade; dlgTrade = _^(MEM_InformationMan.DlgTrade);
if (dlgTrade.isActivated) {
return OpenInvType_Trading;
};
};
//-- 3. check - determine based on open inventory types
var oCItemContainer container;
var int itemContainer; itemContainer = 0;
var int stealContainer; stealContainer = 0;
var int npcContainer; npcContainer = 0;
var int playerInventory; playerInventory = 0;
var zCList list;
var int ptr; ptr = MEMINT_SwitchG1G2(s_openContainers_G1, s_openContainers_G2);
while (ptr);
list = _^ (ptr);
ptr = list.data;
if (ptr) {
container = _^ (ptr);
if (container.inventory2_vtbl == MEMINT_SwitchG1G2(oCItemContainer_vtbl_G1, oCItemContainer_vtbl_G2)) { itemContainer = 1; };
if (container.inventory2_vtbl == MEMINT_SwitchG1G2(oCStealContainer_vtbl_G1, oCStealContainer_vtbl_G2)) { stealContainer = 1; };
if (container.inventory2_vtbl == MEMINT_SwitchG1G2(oCNpcContainer_vtbl_G1, oCStealContainer_vtbl_G2)) { npcContainer = 1; };
if (container.inventory2_vtbl == MEMINT_SwitchG1G2(oCNpcInventory_vtbl_G1, oCNpcInventory_vtbl_G2)) { playerInventory = 1; };
};
ptr = list.next;
end;
//-- TODO: check if this works with G2A
//With G2A we can probably use inventory2_oCItemContainer_invMode? For now this logic seems to be good enough :)
//Players inventory
if ((playerInventory) && (!itemContainer) && (!stealContainer) && (!npcContainer)) { return OpenInvType_Player; };
//Looting NPC
if ((playerInventory) && (!itemContainer) && (!stealContainer) && (npcContainer)) { return OpenInvType_NPC; };
//Looting chest
if ((playerInventory) && (itemContainer) && (!stealContainer) && (!npcContainer)) { return OpenInvType_Chest; };
//Trading inventory
if ((playerInventory) && (itemContainer) && (stealContainer) && (!npcContainer)) { return OpenInvType_Trading; };
//Stealing
if ((playerInventory) && (!itemContainer) && (stealContainer) && (!npcContainer)) { return OpenInvType_Stealing; };
return OpenInvType_None;
};
func int Hlp_Trade_GetInventoryNpcContainer () {
if (!MEM_InformationMan.DlgTrade) { return 0; };
var oCViewDialogTrade dialogTrade;
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
if (dialogTrade.dlgInventoryNpc) {
var oCViewDialogStealContainer dialogStealContainer;
dialogStealContainer = _^ (dialogTrade.dlgInventoryNpc);
//oCStealContainer
if (dialogStealContainer.stealContainer) {
return dialogStealContainer.stealContainer;
};
};
return 0;
};
func int Hlp_Trade_GetContainerNpcContainer () {
//G2A does not have containers!
if (MEMINT_SwitchG1G2 (0, 1)) { return 0; };
if (!MEM_InformationMan.DlgTrade) { return 0; };
var oCViewDialogTrade dialogTrade;
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
//G2A class oCViewDialogTrade does not have property dlgContainerNpc
//Therefore we cannot use it directly, but we have to use offset instead
//var int dlgContainerNpc; //oCViewDialogItemContainer* // sizeof 04h offset FCh
var int itemContainerPtr; itemContainerPtr = MEM_ReadInt (_@ (dialogTrade) + 252);
// if (dialogTrade.dlgContainerNpc) {
if (itemContainerPtr) {
var oCViewDialogItemContainer dialogItemContainer;
//dialogItemContainer = _^ (dialogTrade.dlgContainerNpc);
dialogItemContainer = _^ (itemContainerPtr);
//oCItemContainer
if (dialogItemContainer.itemContainer) {
return dialogItemContainer.itemContainer;
};
};
return 0;
};
func int Hlp_Trade_GetContainerPlayerContainer () {
//G2A does not have containers!
if (MEMINT_SwitchG1G2 (0, 1)) { return 0; };
if (!MEM_InformationMan.DlgTrade) { return 0; };
var oCViewDialogTrade dialogTrade;
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
//G2A class oCViewDialogTrade does not have property dlgContainerPlayer
//Therefore we cannot use it directly, but we have to use offset instead
//var int dlgContainerPlayer; //oCViewDialogItemContainer* // sizeof 04h offset 104h
var int itemContainerPtr; itemContainerPtr = MEM_ReadInt (_@ (dialogTrade) + 260);
//if (dialogTrade.dlgContainerPlayer) {
if (itemContainerPtr) {
var oCViewDialogItemContainer dialogItemContainer;
//dialogItemContainer = _^ (dialogTrade.dlgContainerPlayer);
dialogItemContainer = _^ (itemContainerPtr);
//oCItemContainer
if (dialogItemContainer.itemContainer) {
return dialogItemContainer.itemContainer;
};
};
return 0;
};
func int Hlp_Trade_GetInventoryPlayerContainer () {
if (!MEM_InformationMan.DlgTrade) { return 0; };
var oCViewDialogTrade dialogTrade;
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
if (dialogTrade.dlgInventoryPlayer) {
var oCViewDialogInventory dialogInventory;
dialogInventory = _^ (dialogTrade.dlgInventoryPlayer);
//oCNpcInventory
if (dialogInventory.inventory) {
return dialogInventory.inventory;
};
};
return 0;
};
/*
* Returns pointer to active oCItemContainer
*/
/*
Not required ... we can get same result using Hlp_GetActiveOpenInvContainer
func int Hlp_Trade_GetActiveTradeContainer () {
if (!MEM_InformationMan.DlgTrade) { return 0; };
var oCViewDialogTrade dialogTrade;
dialogTrade = _^ (MEM_InformationMan.DlgTrade);
if (dialogTrade.sectionTrade == TRADE_SECTION_LEFT_INVENTORY_G1) {
return +Hlp_Trade_GetInventoryNpcContainer ();
} else
if (dialogTrade.sectionTrade == TRADE_SECTION_LEFT_CONTAINER_G1) {
return +Hlp_Trade_GetContainerNpcContainer ();
} else
if (dialogTrade.sectionTrade == TRADE_SECTION_RIGHT_CONTAINER_G1) {
return +Hlp_Trade_GetContainerPlayerContainer ();
} else
if (dialogTrade.sectionTrade == TRADE_SECTION_RIGHT_INVENTORY_G1) {
return +Hlp_Trade_GetInventoryPlayerContainer ();
};
return 0;
};
*/
/*
* Returns pointer to active oCItemContainer
*/
func int Hlp_GetActiveOpenInvContainer () {
//0x008DA998 class zCList<class oCItemContainer> s_openContainers
const int s_openContainers_G1 = 9283992;
//0x00AB0FD4 class zCList<class oCItemContainer> s_openContainers
const int s_openContainers_G2 = 11210708;
var oCItemContainer container;
var int ptr; ptr = MEMINT_SwitchG1G2(s_openContainers_G1, s_openContainers_G2);
var zCList list;
while (ptr);
list = _^ (ptr);
ptr = list.data;
if (ptr) {
container = _^ (ptr);
if (container.inventory2_oCItemContainer_frame) {
return ptr;
};
};
ptr = list.next;
end;
return 0;
};
/*
* Returns pointer to open containers
*/
func int Hlp_GetOpenContainer (var int vtbl) {
//0x008DA998 class zCList<class oCItemContainer> s_openContainers
const int s_openContainers_G1 = 9283992;
//0x00AB0FD4 class zCList<class oCItemContainer> s_openContainers
const int s_openContainers_G2 = 11210708;
var oCItemContainer container;
var int ptr; ptr = MEMINT_SwitchG1G2(s_openContainers_G1, s_openContainers_G2);
var zCList list;
while (ptr);
list = _^ (ptr);
ptr = list.data;
if (ptr) {
container = _^ (ptr);
if (container.inventory2_vtbl == vtbl) {
return ptr;
};
};
ptr = list.next;
end;
return 0;
};
func int Hlp_GetOpenContainer_oCItemContainer () {
//0x007DCDFC const oCItemContainer::`vftable'
const int oCItemContainer_vtbl_G1 = 8244732;
//0x0083C4AC const oCItemContainer::`vftable'
const int oCItemContainer_vtbl_G2 = 8635564;
return +Hlp_GetOpenContainer(MEMINT_SwitchG1G2(oCItemContainer_vtbl_G1, oCItemContainer_vtbl_G2));
};
func int Hlp_GetOpenContainer_oCStealContainer () {
//0x007DCEA4 const oCStealContainer::`vftable'
const int oCStealContainer_vtbl_G1 = 8244900;
//0x0083C574 const oCStealContainer::`vftable'
const int oCStealContainer_vtbl_G2 = 8635764;
return +Hlp_GetOpenContainer(MEMINT_SwitchG1G2(oCStealContainer_vtbl_G1, oCStealContainer_vtbl_G2));
};
func int Hlp_GetOpenContainer_oCNpcContainer () {
//0x007DCF54 const oCNpcContainer::`vftable'
const int oCNpcContainer_vtbl_G1 = 8245076;
//0x0083C644 const oCNpcContainer::`vftable'
const int oCNpcContainer_vtbl_G2 = 8635972;
return +Hlp_GetOpenContainer(MEMINT_SwitchG1G2(oCNpcContainer_vtbl_G1, oCNpcContainer_vtbl_G2));
};
func int Hlp_GetOpenContainer_oCNpcInventory () {
//0x007DD004 const oCNpcInventory::`vftable'
const int oCNpcInventory_vtbl_G1 = 8245252;
//0x0083C714 const oCNpcInventory::`vftable'
const int oCNpcInventory_vtbl_G2 = 8636180;
return +Hlp_GetOpenContainer(MEMINT_SwitchG1G2(oCNpcInventory_vtbl_G1, oCNpcInventory_vtbl_G2));
};
//-- oCItemContainer functions
func int oCItemContainer_ActivateNextContainer (var int ptr, var int direction) {
//0x00669980 protected: int __thiscall oCItemContainer::ActivateNextContainer(int)
const int oCItemContainer__ActivateNextContainer_G1 = 6723968;
//0x0070A150 protected: int __thiscall oCItemContainer::ActivateNextContainer(int)
const int oCItemContainer__ActivateNextContainer_G2 = 7381328;
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_IntParam (_@ (direction));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__ActivateNextContainer_G1, oCItemContainer__ActivateNextContainer_G2));
call = CALL_End();
};
return + retVal;
};
func void oCItemContainer_Draw (var int ptr) {
//0x00667660 protected: virtual void __thiscall oCItemContainer::Draw(void)
const int oCItemContainer__Draw_G1 = 6714976;
//0x007076B0 protected: virtual void __thiscall oCItemContainer::Draw(void)
const int oCItemContainer__Draw_G2 = 7370416;
if (!ptr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__Draw_G1, oCItemContainer__Draw_G2));
call = CALL_End();
};
};
func int oCItemContainer_Insert (var int ptr, var int itemPtr) {
//0x00669250 public: virtual class oCItem * __thiscall oCItemContainer::Insert(class oCItem *)
const int oCItemContainer__Insert_G1 = 6722128;
//0x00709360 public: virtual class oCItem * __thiscall oCItemContainer::Insert(class oCItem *)
const int oCItemContainer__Insert_G2 = 7377760;
if (!itemPtr) { return 0; };
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_PtrParam (_@ (itemPtr));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__Insert_G1, oCItemContainer__Insert_G2));
call = CALL_End();
};
return +retVal;
};
func int oCItemContainer_IsEmpty (var int ptr) {
//0x00669750 public: virtual int __thiscall oCItemContainer::IsEmpty(void)
const int oCItemContainer__IsEmpty_G1 = 6723408;
//0x00709E10 public: virtual int __thiscall oCItemContainer::IsEmpty(void)
const int oCItemContainer__IsEmpty_G2 = 7380496;
//Hmmm, which one makes more sense in case pointer is invalid, is empty true or false? :)
if (!ptr) { return TRUE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__IsEmpty_G1, oCItemContainer__IsEmpty_G2));
call = CALL_End();
};
return +retVal;
};
func void oCItemContainer_Remove (var int ptr, var int itemPtr) {
//0x00669320 public: virtual void __thiscall oCItemContainer::Remove(class oCItem *)
const int oCItemContainer__Remove_G1 = 6722336;
//0x00709430 public: virtual void __thiscall oCItemContainer::Remove(class oCItem *)
const int oCItemContainer__Remove_G2 = 7377968;
if (!itemPtr) { return; };
if (!ptr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (itemPtr));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__Remove_G1, oCItemContainer__Remove_G2));
call = CALL_End();
};
};
func int oCItemContainer_RemoveByPtr (var int ptr, var int itemPtr, var int amount) {
//0x006693C0 public: virtual class oCItem * __thiscall oCItemContainer::RemoveByPtr(class oCItem *,int)
const int oCItemContainer__RemoveByPtr_G1 = 6722496;
//0x007094D0 public: virtual class oCItem * __thiscall oCItemContainer::RemoveByPtr(class oCItem *,int)
const int oCItemContainer__RemoveByPtr_G2 = 7378128;
if (!itemPtr) { return 0; };
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_IntParam (_@ (amount));
CALL_PtrParam (_@ (itemPtr));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__RemoveByPtr_G1, oCItemContainer__RemoveByPtr_G2));
call = CALL_End();
};
return +retVal;
};
//Same as oCItemContainer::RemoveByPtr ?
//0x006693D0 public: virtual class oCItem * __thiscall oCItemContainer::Remove(class oCItem *,int)
func void oCItemContainer_DeleteContents (var int ptr, var int force) {
//0x00669490 protected: virtual void __thiscall oCItemContainer::DeleteContents(void)
const int oCItemContainer__DeleteContents_G1 = 6722704;
//0x00709590 protected: virtual void __thiscall oCItemContainer::DeleteContents(void)
const int oCItemContainer__DeleteContents_G2 = 7378320;
if (!ptr) { return; };
//only inventory2_oCItemContainer_ownList can be deleted, adding force option
if (force) {
var oCItemContainer itemContainer;
itemContainer = _^ (ptr);
itemContainer.inventory2_oCItemContainer_ownList = 1;
};
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__DeleteContents_G1, oCItemContainer__DeleteContents_G2));
call = CALL_End();
};
};
func void oCItemContainer_SetContents (var int ptr, var int contents) {
//0x00667E60 public: virtual void __thiscall oCItemContainer::SetContents(class zCListSort<class oCItem> *)
const int oCItemContainer__SetContents_G1 = 6717024;
//0x007084F0 public: virtual void __thiscall oCItemContainer::SetContents(class zCListSort<class oCItem> *)
const int oCItemContainer__SetContents_G2 = 7374064;
if (!contents) { return; };
if (!ptr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (contents));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__SetContents_G1, oCItemContainer__SetContents_G2));
call = CALL_End();
};
};
/*
*
*/
func int oCItemContainer_TransferItem (var int ptr, var int dir, var int amount) {
//0x00669780 protected: virtual int __thiscall oCItemContainer::TransferItem(int,int)
const int oCItemContainer__TransferItem_G1 = 6723456;
//0x00709F40 protected: virtual int __thiscall oCItemContainer::TransferItem(int,int)
const int oCItemContainer__TransferItem_G2 = 7380800;
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_IntParam (_@ (amount));
CALL_IntParam (_@ (dir)); //dir -1 == left, 1 == right
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__TransferItem_G1, oCItemContainer__TransferItem_G2));
call = CALL_End();
};
return +retVal;
};
func void oCItemContainer_Activate (var int ptr) {
//0x00668F60 public: virtual void __thiscall oCItemContainer::Activate(void)
const int oCItemContainer__Activate_G1 = 6721376;
//0x00709230 public: virtual void __thiscall oCItemContainer::Activate(void)
const int oCItemContainer__Activate_G2 = 7377456;
if (!ptr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__Activate_G1, oCItemContainer__Activate_G2));
call = CALL_End();
};
};
func int oCItemContainer_IsActive (var int ptr) {
//0x006665A0 public: virtual int __thiscall oCItemContainer::IsActive(void)
const int oCItemContainer__IsActive_G1 = 6710688;
//0x007050D0 public: virtual int __thiscall oCItemContainer::IsActive(void)
const int oCItemContainer__IsActive_G2 = 7360720;
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__IsActive_G1, oCItemContainer__IsActive_G2));
call = CALL_End();
};
return +retVal;
};
func void oCItemContainer_Close (var int ptr) {
//0x00668C10 public: virtual void __thiscall oCItemContainer::Close(void)
const int oCItemContainer__Close_G1 = 6720528;
//0x00708F30 public: virtual void __thiscall oCItemContainer::Close(void)
const int oCItemContainer__Close_G2 = 7376688;
if (!ptr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__Close_G1, oCItemContainer__Close_G2));
call = CALL_End();
};
};
/*
* oCItemContainer_OpenPassive
* - G1 mode - item list mode
* - G2A inventory mode - INV_MODE_DEFAULT, INV_MODE_CONTAINER, INV_MODE_PLUNDER, INV_MODE_STEAL, INV_MODE_BUY, INV_MODE_SELL
*/
/*
//enum oTItemListMode { FULLSCREEN, HALFSCREEN, ONE };
enum {
INV_MODE_DEFAULT,
INV_MODE_CONTAINER,
INV_MODE_PLUNDER,
INV_MODE_STEAL,
INV_MODE_BUY,
INV_MODE_SELL,
INV_MODE_MAX
};
*/
func void oCItemContainer_OpenPassive (var int ptr, var int x, var int y, var int mode) {
//0x00668050 public: virtual void __thiscall oCItemContainer::OpenPassive(int,int,enum oCItemContainer::oTItemListMode)
const int oCItemContainer__OpenPassive_G1 = 6717520;
//0x007086D0 public: virtual void __thiscall oCItemContainer::OpenPassive(int,int,int)
const int oCItemContainer__OpenPassive_G2 = 7374544;
if (!ptr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (mode));
CALL_PtrParam (_@ (y));
CALL_PtrParam (_@ (x));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCItemContainer__OpenPassive_G1, oCItemContainer__OpenPassive_G2));
call = CALL_End();
};
};
//-- oCNpcContainer functions
func int oCNpcContainer_Insert (var int ptr, var int itemPtr) {
//0x0066B2D0 public: virtual class oCItem * __thiscall oCNpcContainer::Insert(class oCItem *)
const int oCNpcContainer__Insert_G1 = 6730448;
//0x0070B9F0 public: virtual class oCItem * __thiscall oCNpcContainer::Insert(class oCItem *)
const int oCNpcContainer__Insert_G2 = 7387632;
if (!itemPtr) { return 0; };
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_PtrParam (_@ (itemPtr));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCNpcContainer__Insert_G1, oCNpcContainer__Insert_G2));
call = CALL_End();
};
return +retVal;
};
func void oCNpcContainer_CreateList (var int ptr) {
//0x0066AB10 public: virtual void __thiscall oCNpcContainer::CreateList(void)
const int oCNpcContainer__CreateList_G1 = 6728464;
//0x0070B570 public: virtual void __thiscall oCNpcContainer::CreateList(void)
const int oCNpcContainer__CreateList_G2 = 7386480;
if (!ptr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCNpcContainer__CreateList_G1, oCNpcContainer__CreateList_G2));
call = CALL_End();
};
};
//-- oCNpcInventory functions
func int oCNpcInventory_GetNumItemsInCategory (var int ptr, var int invCat) {
//0x0066C4C0 public: int __thiscall oCNpcInventory::GetNumItemsInCategory(int)
const int oCNpcInventory__GetNumItemsInCategory_G1 = 6735040;
//0x0070C340 public: int __thiscall oCNpcInventory::GetNumItemsInCategory(void)
const int oCNpcInventory__GetNumItemsInCategory_G2 = 7390016;
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
if (MEMINT_SwitchG1G2 (1, 0)) {
CALL_IntParam (_@ (invCat));
};
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCNpcInventory__GetNumItemsInCategory_G1, oCNpcInventory__GetNumItemsInCategory_G2));
call = CALL_End();
};
return + retVal;
};
func int oCNpcInventory_GetCategory (var int ptr, var int itemPtr) {
//0x0066C430 public: int __thiscall oCNpcInventory::GetCategory(class oCItem *)
const int oCNpcInventory__GetCategory_G1 = 6734896;
//0x0070C690 public: int __thiscall oCNpcInventory::GetCategory(class oCItem *)
const int oCNpcInventory__GetCategory_G2 = 7390864;
if (!itemPtr) { return 0; };
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_PtrParam (_@ (itemPtr));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCNpcInventory__GetCategory_G1, oCNpcInventory__GetCategory_G2));
call = CALL_End();
};
return +retVal;
};
func int oCNpcInventory_RemoveByPtr (var int ptr, var int itemPtr, var int amount) {
//0x0066CF10 public: virtual class oCItem * __thiscall oCNpcInventory::RemoveByPtr(class oCItem *,int)
const int oCNpcInventory__RemoveByPtr_G1 = 6737680;
//0x0070CC70 public: virtual class oCItem * __thiscall oCNpcInventory::RemoveByPtr(class oCItem *,int)
const int oCNpcInventory__RemoveByPtr_G2 = 7392368;
if (!itemPtr) { return 0; };
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_IntParam (_@ (amount));
CALL_PtrParam (_@ (itemPtr));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCNpcInventory__RemoveByPtr_G1, oCNpcInventory__RemoveByPtr_G2));
call = CALL_End();
};
return +retVal;
};
func int oCNpcInventory_Insert (var int ptr, var int itemPtr) {
//0x0066C7D0 public: virtual class oCItem * __thiscall oCNpcInventory::Insert(class oCItem *)
const int oCNpcInventory__Insert_G1 = 6735824;
//0x0070C730 public: virtual class oCItem * __thiscall oCNpcInventory::Insert(class oCItem *)
const int oCNpcInventory__Insert_G2 = 7391024;
if (!itemPtr) { return 0; };
if (!ptr) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_PtrParam (_@ (itemPtr));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCNpcInventory__Insert_G1, oCNpcInventory__Insert_G2));
call = CALL_End();
};
return +retVal;
};
func void oCNpcInventory_Close (var int npcInventoryPtr) {
//0x0066C1E0 public: virtual void __thiscall oCNpcInventory::Close(void)
const int oCNpcInventory__Close_G1 = 6734304;
//0x0070C2F0 public: virtual void __thiscall oCNpcInventory::Close(void)
const int oCNpcInventory__Close_G2 = 7389936;
if (!npcInventoryPtr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall (_@ (npcInventoryPtr), MEMINT_SwitchG1G2 (oCNpcInventory__Close_G1, oCNpcInventory__Close_G2));
call = CALL_End();
};
};
func int Npc_GetNpcInventoryPtr (var int slfInstance) {
var oCNpc slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return 0; };
var int npcInventoryPtr; npcInventoryPtr = _@ (slf.inventory2_vtbl);
return + npcInventoryPtr;
};
//G1 only
func int oCNpcInventory_SwitchToCategory (var int npcInventoryPtr, var int invCat) {
//0x0066DE60 public: int __thiscall oCNpcInventory::SwitchToCategory(int)
const int oCNpcInventory__SwitchToCategory_G1 = 6741600;
//There is no G2A function
const int oCNpcInventory__SwitchToCategory_G2 = 0;
if (!npcInventoryPtr) { return 0; };
//return 0 in G2A
if (MEMINT_SwitchG1G2 (0, 1)) { return 0; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL_IntParam (_@ (invCat));
CALL__thiscall (_@ (npcInventoryPtr), oCNpcInventory__SwitchToCategory_G1);
call = CALL_End();
};
return +retVal;
};
/*
* oCNpcInventory_UnpackCategory
* - in case of G2A inventory category is redundant
*/
func void oCNpcInventory_UnpackCategory (var int npcInventoryPtr, var int invCat) {
//0x00670740 public: void __thiscall oCNpcInventory::UnpackItemsInCategory(int)
//0x00710A20 public: void __thiscall oCNpcInventory::UnpackItemsInCategory(void)
//0x0066FAD0 public: void __thiscall oCNpcInventory::UnpackCategory(int)
const int oCNpcInventory__UnpackCategory_G1 = 6748880;
//0x0070F620 public: void __thiscall oCNpcInventory::UnpackCategory(void)
const int oCNpcInventory__UnpackCategory_G2 = 7403040;
if (!npcInventoryPtr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
if (MEMINT_SwitchG1G2 (1, 0)) {
CALL_IntParam (_@ (invCat));
};
CALL__thiscall (_@ (npcInventoryPtr), MEMINT_SwitchG1G2 (oCNpcInventory__UnpackCategory_G1, oCNpcInventory__UnpackCategory_G2));
call = CALL_End();
};
};
func void oCNpc_UnpackInventory (var int slfInstance) {
//0x00670400 public: void __thiscall oCNpcInventory::UnpackAllItems(void)
const int oCNpcInventory__UnpackAllItems_G1 = 6751232;
//0x00710030 public: void __thiscall oCNpcInventory::UnpackAllItems(void)
const int oCNpcInventory__UnpackAllItems_G2 = 7405616;
var int npcInventoryPtr; npcInventoryPtr = Npc_GetNpcInventoryPtr (slfInstance);
if (!npcInventoryPtr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall (_@ (npcInventoryPtr), MEMINT_SwitchG1G2 (oCNpcInventory__UnpackAllItems_G1, oCNpcInventory__UnpackAllItems_G2));
call = CALL_End();
};
};
func void oCNpcInventory_SetOwner (var int npcInventoryPtr, var int npcPtr) {
//0x0066C290 public: void __thiscall oCNpcInventory::SetOwner(class oCNpc *)
const int oCNpcInventory__SetOwner_G1 = 6734480;