-
-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathweapontype.cpp
691 lines (634 loc) · 30.5 KB
/
weapontype.cpp
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
#include "precompiled.h"
WeaponStruct g_weaponStruct[MAX_WEAPONS] =
{
{ 0, 0, 0, 0, 0 },
{ WEAPON_P228, P228_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_357SIG_PRICE },
{ WEAPON_SCOUT, SCOUT_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_XM1014, XM1014_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_BUCKSHOT_PRICE },
{ WEAPON_MAC10, MAC10_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_45ACP_PRICE },
{ WEAPON_AUG, AUG_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_ELITE, ELITE_PRICE, CT, AUTOBUYCLASS_SECONDARY, AMMO_9MM_PRICE },
{ WEAPON_FIVESEVEN, FIVESEVEN_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_57MM_PRICE },
{ WEAPON_UMP45, UMP45_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_45ACP_PRICE },
{ WEAPON_SG550, SG550_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_USP, USP_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_45ACP_PRICE },
{ WEAPON_GLOCK18, GLOCK18_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_9MM_PRICE },
{ WEAPON_MP5N, MP5NAVY_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_9MM_PRICE },
{ WEAPON_AWP, AWP_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_338MAG_PRICE },
{ WEAPON_M249, M249_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_M3, M3_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_BUCKSHOT_PRICE },
{ WEAPON_M4A1, M4A1_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_TMP, TMP_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_9MM_PRICE },
{ WEAPON_G3SG1, G3SG1_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_DEAGLE, DEAGLE_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_50AE_PRICE },
{ WEAPON_SG552, SG552_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_AK47, AK47_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_P90, P90_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_57MM_PRICE },
{ WEAPON_FAMAS, FAMAS_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_GALIL, GALIL_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
// FIX: there is a bug, the cost of galil $2000 instead $2250
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
};
AutoBuyInfoStruct g_autoBuyInfo[] =
{
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_RIFLE, "galil", "weapon_galil" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_RIFLE, "ak47", "weapon_ak47" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SNIPERRIFLE,"scout", "weapon_scout" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_RIFLE, "sg552", "weapon_sg552" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SNIPERRIFLE,"awp", "weapon_awp" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SNIPERRIFLE,"g3sg1", "weapon_g3sg1" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_RIFLE, "famas", "weapon_famas" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_RIFLE, "m4a1", "weapon_m4a1" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_RIFLE, "aug", "weapon_aug" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SNIPERRIFLE,"sg550", "weapon_sg550" },
{ AUTOBUYCLASS_SECONDARY|AUTOBUYCLASS_PISTOL, "glock", "weapon_glock18" },
{ AUTOBUYCLASS_SECONDARY|AUTOBUYCLASS_PISTOL, "usp", "weapon_usp" },
{ AUTOBUYCLASS_SECONDARY|AUTOBUYCLASS_PISTOL, "p228", "weapon_p228" },
{ AUTOBUYCLASS_SECONDARY|AUTOBUYCLASS_PISTOL, "deagle", "weapon_deagle" },
{ AUTOBUYCLASS_SECONDARY|AUTOBUYCLASS_PISTOL, "elites", "weapon_elite" },
{ AUTOBUYCLASS_SECONDARY|AUTOBUYCLASS_PISTOL, "fn57", "weapon_fiveseven" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SHOTGUN, "m3", "weapon_m3" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SHOTGUN, "xm1014", "weapon_xm1014" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SMG, "mac10", "weapon_mac10" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SMG, "tmp", "weapon_tmp" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SMG, "mp5", "weapon_mp5navy" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SMG, "ump45", "weapon_ump45" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SMG, "p90", "weapon_p90" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_MACHINEGUN, "m249", "weapon_m249" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_AMMO, "primammo", "primammo" },
{ AUTOBUYCLASS_SECONDARY|AUTOBUYCLASS_AMMO, "secammo", "secammo" },
{ AUTOBUYCLASS_ARMOR, "vest", "item_kevlar" },
{ AUTOBUYCLASS_ARMOR, "vesthelm", "item_assaultsuit" },
{ AUTOBUYCLASS_GRENADE, "flash", "weapon_flashbang" },
{ AUTOBUYCLASS_GRENADE, "hegren", "weapon_hegrenade" },
{ AUTOBUYCLASS_GRENADE, "sgren", "weapon_smokegrenade" },
{ AUTOBUYCLASS_NIGHTVISION, "nvgs", "nvgs" },
{ AUTOBUYCLASS_DEFUSER, "defuser", "defuser" },
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_SHIELD, "shield", "shield" },
{ AUTOBUYCLASS_NONE, nullptr, nullptr },
};
WeaponAliasInfo g_weaponAliasInfo[] =
{
{ "p228", WEAPON_P228 },
{ "???", WEAPON_GLOCK },
{ "scout", WEAPON_SCOUT },
{ "hegren", WEAPON_HEGRENADE },
{ "xm1014", WEAPON_XM1014 },
{ "c4", WEAPON_C4 },
{ "mac10", WEAPON_MAC10 },
{ "aug", WEAPON_AUG },
{ "sgren", WEAPON_SMOKEGRENADE },
{ "elites", WEAPON_ELITE },
{ "fn57", WEAPON_FIVESEVEN },
{ "ump45", WEAPON_UMP45 },
{ "sg550", WEAPON_SG550 },
{ "galil", WEAPON_GALIL },
{ "famas", WEAPON_FAMAS },
{ "usp", WEAPON_USP },
{ "glock", WEAPON_GLOCK18 },
{ "awp", WEAPON_AWP },
{ "mp5", WEAPON_MP5N },
{ "m249", WEAPON_M249 },
{ "m3", WEAPON_M3 },
{ "m4a1", WEAPON_M4A1 },
{ "tmp", WEAPON_TMP },
{ "g3sg1", WEAPON_G3SG1 },
{ "flash", WEAPON_FLASHBANG },
{ "deagle", WEAPON_DEAGLE },
{ "sg552", WEAPON_SG552 },
{ "ak47", WEAPON_AK47 },
{ "knife", WEAPON_KNIFE },
{ "p90", WEAPON_P90 },
{ "shield", WEAPON_SHIELDGUN },
{ "none", WEAPON_NONE },
{ "grenade", WEAPON_HEGRENADE },
{ "hegrenade", WEAPON_HEGRENADE },
{ "glock18", WEAPON_GLOCK18 },
{ "elite", WEAPON_ELITE },
{ "fiveseven", WEAPON_FIVESEVEN },
{ "mp5navy", WEAPON_MP5N },
{ nullptr, WEAPON_NONE },
};
WeaponBuyAliasInfo g_weaponBuyAliasInfo[] =
{
{ "galil", WEAPON_GALIL, "#Galil" },
{ "defender", WEAPON_GALIL, "#Galil" },
{ "ak47", WEAPON_AK47, "#AK47" },
{ "cv47", WEAPON_AK47, "#AK47" },
{ "scout", WEAPON_SCOUT, "#Scout" },
{ "sg552", WEAPON_SG552, "#SG552" },
{ "krieg552", WEAPON_SG552, "#SG552" },
{ "awp", WEAPON_AWP, "#ArcticWarfareMagnum" },
{ "magnum", WEAPON_AWP, "#ArcticWarfareMagnum" },
{ "g3sg1", WEAPON_G3SG1, "#G3SG1" },
{ "d3au1", WEAPON_G3SG1, "#G3SG1" },
{ "famas", WEAPON_FAMAS, "#Famas" },
{ "clarion", WEAPON_FAMAS, "#Famas" },
{ "m4a1", WEAPON_M4A1, "#M4A1" },
{ "aug", WEAPON_AUG, "#Aug" },
{ "bullpup", WEAPON_AUG, "#Aug" },
{ "sg550", WEAPON_SG550, "#SG550" },
{ "krieg550", WEAPON_SG550, "#SG550" },
{ "glock", WEAPON_GLOCK18, "#Glock18" },
{ "9x19mm", WEAPON_GLOCK18, "#Glock18" },
{ "usp", WEAPON_USP, "#USP45" },
{ "km45", WEAPON_USP, "#USP45" },
{ "p228", WEAPON_P228, "#P228" },
{ "228compact", WEAPON_P228, "#P228" },
{ "deagle", WEAPON_DEAGLE, "#DesertEagle" },
{ "nighthaw", WEAPON_DEAGLE, "#DesertEagle" },
{ "elites", WEAPON_ELITE, "#Beretta96G" },
{ "fn57", WEAPON_FIVESEVEN, "#FiveSeven" },
{ "fiveseven", WEAPON_FIVESEVEN, "#FiveSeven" },
{ "m3", WEAPON_M3, "#Super90" },
{ "12gauge", WEAPON_M3, "#Super90" },
{ "xm1014", WEAPON_XM1014, "#XM1014" },
{ "autoshotgun",WEAPON_XM1014, "#XM1014" },
{ "mac10", WEAPON_MAC10, "#Mac10" },
{ "tmp", WEAPON_TMP, "#tmp" },
{ "mp", WEAPON_TMP, "#tmp" },
{ "mp5", WEAPON_MP5N, "#mp5navy" },
{ "smg", WEAPON_MP5N, "#mp5navy" },
{ "ump45", WEAPON_UMP45, "#UMP45" },
{ "p90", WEAPON_P90, "#FNP90" },
{ "c90", WEAPON_P90, "#FNP90" },
{ "m249", WEAPON_M249, "#M249" },
{ nullptr, WEAPON_NONE, nullptr },
};
WeaponClassAliasInfo g_weaponClassAliasInfo[] =
{
{ "p228", WEAPONCLASS_PISTOL },
{ "???", WEAPONCLASS_PISTOL },
{ "scout", WEAPONCLASS_SNIPERRIFLE },
{ "hegren", WEAPONCLASS_GRENADE },
{ "xm1014", WEAPONCLASS_SHOTGUN },
{ "c4", WEAPONCLASS_GRENADE },
{ "mac10", WEAPONCLASS_SUBMACHINEGUN },
{ "aug", WEAPONCLASS_RIFLE },
{ "sgren", WEAPONCLASS_GRENADE },
{ "elites", WEAPONCLASS_PISTOL },
{ "fn57", WEAPONCLASS_PISTOL },
{ "ump45", WEAPONCLASS_SUBMACHINEGUN },
{ "sg550", WEAPONCLASS_SNIPERRIFLE },
{ "galil", WEAPONCLASS_RIFLE },
{ "famas", WEAPONCLASS_RIFLE },
{ "usp", WEAPONCLASS_PISTOL },
{ "glock", WEAPONCLASS_PISTOL },
{ "awp", WEAPONCLASS_SNIPERRIFLE },
{ "mp5", WEAPONCLASS_SUBMACHINEGUN },
{ "m249", WEAPONCLASS_MACHINEGUN },
{ "m3", WEAPONCLASS_SHOTGUN },
{ "m4a1", WEAPONCLASS_RIFLE },
{ "tmp", WEAPONCLASS_SUBMACHINEGUN },
{ "g3sg1", WEAPONCLASS_SNIPERRIFLE },
{ "flash", WEAPONCLASS_GRENADE },
{ "deagle", WEAPONCLASS_PISTOL },
{ "sg552", WEAPONCLASS_RIFLE },
{ "ak47", WEAPONCLASS_RIFLE },
{ "knife", WEAPONCLASS_KNIFE },
{ "p90", WEAPONCLASS_SUBMACHINEGUN },
{ "shield", WEAPONCLASS_PISTOL },
{ "grenade", WEAPONCLASS_GRENADE },
{ "hegrenade", WEAPONCLASS_GRENADE },
{ "glock18", WEAPONCLASS_PISTOL },
{ "elite", WEAPONCLASS_PISTOL },
{ "fiveseven", WEAPONCLASS_PISTOL },
{ "mp5navy", WEAPONCLASS_SUBMACHINEGUN },
{ "grenade", WEAPONCLASS_GRENADE },
{ "pistol", WEAPONCLASS_PISTOL },
{ "SMG", WEAPONCLASS_SUBMACHINEGUN },
{ "machinegun", WEAPONCLASS_MACHINEGUN },
{ "shotgun", WEAPONCLASS_SHOTGUN },
{ "rifle", WEAPONCLASS_RIFLE },
{ "sniper", WEAPONCLASS_SNIPERRIFLE },
{ "none", WEAPONCLASS_NONE },
{ nullptr, WEAPONCLASS_NONE },
};
WeaponInfoStruct g_weaponInfo_default[] =
{
{ WEAPON_P228, P228_PRICE, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, P228_MAX_CLIP, MAX_AMMO_357SIG, AMMO_357SIG, "weapon_p228", "ammo_357sig", "357SIG" },
// fix collision with glock18
#ifdef REGAMEDLL_FIXES
{ WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock", "ammo_9mm", "9mm" },
#else
{ WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18", "ammo_9mm", "9mm" },
#endif
{ WEAPON_GLOCK18, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18", "ammo_9mm", "9mm" },
{ WEAPON_SCOUT, SCOUT_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, SCOUT_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_scout", "ammo_762nato", "762Nato" },
{ WEAPON_XM1014, XM1014_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, XM1014_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_xm1014", "ammo_buckshot", "buckshot" },
{ WEAPON_MAC10, MAC10_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, MAC10_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_mac10", "ammo_45acp", "45acp" },
{ WEAPON_AUG, AUG_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, AUG_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_aug", "ammo_556nato", "556Nato" },
{ WEAPON_ELITE, ELITE_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, ELITE_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_elite", "ammo_9mm", "9mm" },
{ WEAPON_FIVESEVEN, FIVESEVEN_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, FIVESEVEN_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_fiveseven", "ammo_57mm", "57mm" },
{ WEAPON_UMP45, UMP45_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, UMP45_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_ump45", "ammo_45acp", "45acp" },
{ WEAPON_SG550, SG550_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG550_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg550", "ammo_556nato", "556Nato" },
{ WEAPON_GALIL, GALIL_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, GALIL_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_galil", "ammo_556nato", "556Nato" },
{ WEAPON_FAMAS, FAMAS_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, FAMAS_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_famas", "ammo_556nato", "556Nato" },
{ WEAPON_USP, USP_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, USP_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_usp", "ammo_45acp", "45acp" },
{ WEAPON_AWP, AWP_PRICE, AMMO_338MAG_PRICE, AMMO_338MAG_BUY, AWP_MAX_CLIP, MAX_AMMO_338MAGNUM, AMMO_338MAGNUM, "weapon_awp", "ammo_338magnum", "338Magnum" },
{ WEAPON_MP5N, MP5NAVY_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, MP5N_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_mp5navy", "ammo_9mm", "9mm" },
{ WEAPON_M249, M249_PRICE, AMMO_556MM_PRICE, AMMO_556NATOBOX_BUY, M249_MAX_CLIP, MAX_AMMO_556NATOBOX, AMMO_556NATOBOX, "weapon_m249", "ammo_556natobox", "556NatoBox" },
{ WEAPON_M3, M3_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, M3_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_m3", "ammo_buckshot", "buckshot" },
{ WEAPON_M4A1, M4A1_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, M4A1_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_m4a1", "ammo_556nato", "556Nato" },
{ WEAPON_TMP, TMP_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, TMP_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_tmp", "ammo_9mm", "9mm" },
{ WEAPON_G3SG1, G3SG1_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, G3SG1_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_g3sg1", "ammo_762nato", "762Nato" },
{ WEAPON_DEAGLE, DEAGLE_PRICE, AMMO_50AE_PRICE, AMMO_50AE_BUY, DEAGLE_MAX_CLIP, MAX_AMMO_50AE, AMMO_50AE, "weapon_deagle", "ammo_50ae", "50AE" },
{ WEAPON_SG552, SG552_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG552_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg552", "ammo_556nato", "556Nato" },
{ WEAPON_AK47, AK47_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, AK47_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_ak47", "ammo_762nato", "762Nato" },
{ WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm", "57mm" },
#ifdef REGAMEDLL_FIXES
{ WEAPON_C4, 0, 0, 0, 0, MAX_AMMO_C4, AMMO_C4, "weapon_c4", nullptr, "C4" },
{ WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr, nullptr },
{ WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, AMMO_HEGRENADE_PRICE, AMMO_HEGRENADE_BUY, 0, MAX_AMMO_HEGRENADE, AMMO_HEGRENADE, "weapon_hegrenade", nullptr, "HEGrenade" },
{ WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_BUY, 0, MAX_AMMO_SMOKEGRENADE, AMMO_SMOKEGRENADE, "weapon_smokegrenade", nullptr, "SmokeGrenade" },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, AMMO_FLASHBANG_PRICE, AMMO_FLASHBANG_BUY, 0, MAX_AMMO_FLASHBANG, AMMO_FLASHBANG, "weapon_flashbang", nullptr, "Flashbang" },
#endif
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr, nullptr },
#ifndef REGAMEDLL_FIXES
{ 0, 0, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr, nullptr },
#endif
};
WeaponInfoStruct g_weaponInfo[ARRAYSIZE(g_weaponInfo_default)];
AmmoInfoStruct g_ammoInfo_default[] =
{
{ AMMO_338MAGNUM, AMMO_338MAG_PRICE, AMMO_338MAG_BUY, MAX_AMMO_338MAGNUM, "ammo_338magnum", "338Magnum" },
{ AMMO_762NATO, AMMO_762MM_PRICE, AMMO_762NATO_BUY, MAX_AMMO_762NATO, "ammo_762nato", "762Nato" },
{ AMMO_556NATOBOX, AMMO_556MM_PRICE, AMMO_556NATOBOX_BUY, MAX_AMMO_556NATOBOX, "ammo_556natobox", "556NatoBox" },
{ AMMO_556NATO, AMMO_556MM_PRICE, AMMO_556NATO_BUY, MAX_AMMO_556NATO, "ammo_556nato", "556Nato" },
{ AMMO_BUCKSHOT, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, MAX_AMMO_BUCKSHOT, "ammo_buckshot", "buckshot" },
{ AMMO_45ACP, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, MAX_AMMO_45ACP, "ammo_45acp", "45acp" },
{ AMMO_57MM, AMMO_57MM_PRICE, AMMO_57MM_BUY, MAX_AMMO_57MM, "ammo_57mm", "57mm" },
{ AMMO_50AE, AMMO_50AE_PRICE, AMMO_50AE_BUY, MAX_AMMO_50AE, "ammo_50ae", "50AE" },
{ AMMO_357SIG, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, MAX_AMMO_357SIG, "ammo_357sig", "357SIG" },
{ AMMO_9MM, AMMO_9MM_PRICE, AMMO_9MM_BUY, MAX_AMMO_9MM, "ammo_9mm", "9mm" },
{ AMMO_FLASHBANG, AMMO_FLASHBANG_PRICE, AMMO_FLASHBANG_BUY, MAX_AMMO_FLASHBANG, nullptr, "Flashbang" },
{ AMMO_HEGRENADE, AMMO_HEGRENADE_PRICE, AMMO_HEGRENADE_BUY, MAX_AMMO_HEGRENADE, nullptr, "HEGrenade" },
{ AMMO_SMOKEGRENADE, AMMO_SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_BUY, MAX_AMMO_SMOKEGRENADE, nullptr, "SmokeGrenade" },
{ AMMO_C4, 0, 0, MAX_AMMO_C4, nullptr, "C4" },
};
AmmoInfoStruct g_ammoInfo[ARRAYSIZE(g_ammoInfo_default)];
WeaponSlotInfo g_weaponSlotInfo[] = {
{ WEAPON_C4, C4_SLOT, "weapon_c4" },
{ WEAPON_KNIFE, KNIFE_SLOT, "weapon_knife" },
{ WEAPON_P228, PISTOL_SLOT, "weapon_p228" },
{ WEAPON_GLOCK, PISTOL_SLOT, "weapon_glock" },
{ WEAPON_ELITE, PISTOL_SLOT, "weapon_elite" },
{ WEAPON_FIVESEVEN, PISTOL_SLOT, "weapon_fiveseven" },
{ WEAPON_USP, PISTOL_SLOT, "weapon_usp" },
{ WEAPON_GLOCK18, PISTOL_SLOT, "weapon_glock18" },
{ WEAPON_DEAGLE, PISTOL_SLOT, "weapon_deagle" },
{ WEAPON_HEGRENADE, GRENADE_SLOT, "weapon_hegrenade" },
{ WEAPON_SMOKEGRENADE, GRENADE_SLOT, "weapon_smokegrenade" },
{ WEAPON_FLASHBANG, GRENADE_SLOT, "weapon_flashbang" },
{ WEAPON_SCOUT, PRIMARY_WEAPON_SLOT, "weapon_scout" },
{ WEAPON_XM1014, PRIMARY_WEAPON_SLOT, "weapon_xm1014" },
{ WEAPON_MAC10, PRIMARY_WEAPON_SLOT, "weapon_mac10" },
{ WEAPON_AUG, PRIMARY_WEAPON_SLOT, "weapon_aug" },
{ WEAPON_UMP45, PRIMARY_WEAPON_SLOT, "weapon_ump45" },
{ WEAPON_SG550, PRIMARY_WEAPON_SLOT, "weapon_sg550" },
{ WEAPON_GALIL, PRIMARY_WEAPON_SLOT, "weapon_galil" },
{ WEAPON_FAMAS, PRIMARY_WEAPON_SLOT, "weapon_famas" },
{ WEAPON_AWP, PRIMARY_WEAPON_SLOT, "weapon_awp" },
{ WEAPON_MP5N, PRIMARY_WEAPON_SLOT, "weapon_mp5navy" },
{ WEAPON_M249, PRIMARY_WEAPON_SLOT, "weapon_m249" },
{ WEAPON_M3, PRIMARY_WEAPON_SLOT, "weapon_m3" },
{ WEAPON_M4A1, PRIMARY_WEAPON_SLOT, "weapon_m4a1" },
{ WEAPON_TMP, PRIMARY_WEAPON_SLOT, "weapon_tmp" },
{ WEAPON_G3SG1, PRIMARY_WEAPON_SLOT, "weapon_g3sg1" },
{ WEAPON_SG552, PRIMARY_WEAPON_SLOT, "weapon_sg552" },
{ WEAPON_AK47, PRIMARY_WEAPON_SLOT, "weapon_ak47" },
{ WEAPON_P90, PRIMARY_WEAPON_SLOT, "weapon_p90" },
{ WEAPON_SHIELDGUN, NONE_SLOT, "weapon_shield" },
};
// Given an alias, return the associated weapon ID
WeaponIdType AliasToWeaponID(const char *alias)
{
if (alias)
{
for (int i = 0; g_weaponAliasInfo[i].alias; i++)
{
if (!Q_stricmp(g_weaponAliasInfo[i].alias, alias))
return g_weaponAliasInfo[i].id;
}
}
return WEAPON_NONE;
}
const char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id)
{
if (alias)
{
for (int i = 0; g_weaponBuyAliasInfo[i].alias; i++)
{
if (!Q_stricmp(g_weaponBuyAliasInfo[i].alias, alias))
{
id = g_weaponBuyAliasInfo[i].id;
return g_weaponBuyAliasInfo[i].failName;
}
}
}
id = WEAPON_NONE;
return nullptr;
}
// Given a weapon ID, return its alias
const char *WeaponIDToAlias(int id)
{
for (int i = 0; g_weaponAliasInfo[i].alias; i++)
{
if (g_weaponAliasInfo[i].id == id)
return g_weaponAliasInfo[i].alias;
}
return nullptr;
}
WeaponClassType AliasToWeaponClass(const char *alias)
{
if (alias)
{
for (int i = 0; g_weaponClassAliasInfo[i].alias; i++)
{
if (!Q_stricmp(g_weaponClassAliasInfo[i].alias, alias))
return g_weaponClassAliasInfo[i].id;
}
}
return WEAPONCLASS_NONE;
}
WeaponClassType WeaponIDToWeaponClass(int id)
{
return AliasToWeaponClass(WeaponIDToAlias(id));
}
WeaponClassType WeaponIDToWeaponClass(ArmouryItemPack id)
{
switch (id)
{
case ARMOURY_AUG:
case ARMOURY_GALIL:
case ARMOURY_M4A1:
case ARMOURY_SG552:
case ARMOURY_AK47:
case ARMOURY_FAMAS:
return WEAPONCLASS_RIFLE;
case ARMOURY_GLOCK18:
case ARMOURY_USP:
case ARMOURY_ELITE:
case ARMOURY_FIVESEVEN:
case ARMOURY_P228:
case ARMOURY_DEAGLE:
return WEAPONCLASS_PISTOL;
case ARMOURY_MP5NAVY:
case ARMOURY_MAC10:
case ARMOURY_TMP:
case ARMOURY_UMP45:
case ARMOURY_P90:
return WEAPONCLASS_SUBMACHINEGUN;
case ARMOURY_SCOUT:
case ARMOURY_SG550:
case ARMOURY_AWP:
case ARMOURY_G3SG1:
return WEAPONCLASS_SNIPERRIFLE;
case ARMOURY_FLASHBANG:
case ARMOURY_HEGRENADE:
case ARMOURY_SMOKEGRENADE:
return WEAPONCLASS_GRENADE;
case ARMOURY_M3:
case ARMOURY_XM1014:
return WEAPONCLASS_SHOTGUN;
case ARMOURY_M249:
return WEAPONCLASS_MACHINEGUN;
default:
break;
}
return WEAPONCLASS_NONE;
}
// Return true if given weapon ID is a primary weapon
bool IsPrimaryWeapon(int id)
{
switch (id)
{
case WEAPON_SCOUT:
case WEAPON_XM1014:
case WEAPON_MAC10:
case WEAPON_AUG:
case WEAPON_UMP45:
case WEAPON_SG550:
case WEAPON_GALIL:
case WEAPON_FAMAS:
case WEAPON_AWP:
case WEAPON_MP5N:
case WEAPON_M249:
case WEAPON_M3:
case WEAPON_M4A1:
case WEAPON_TMP:
case WEAPON_G3SG1:
case WEAPON_SG552:
case WEAPON_AK47:
case WEAPON_P90:
case WEAPON_SHIELDGUN:
return true;
default:
break;
}
return false;
}
// Return true if given weapon ID is a secondary weapon
bool IsSecondaryWeapon(int id)
{
switch (id)
{
case WEAPON_P228:
case WEAPON_ELITE:
case WEAPON_FIVESEVEN:
case WEAPON_USP:
case WEAPON_GLOCK18:
case WEAPON_DEAGLE:
return true;
default:
break;
}
return false;
}
// Return true if given weapon ID is a grenade
bool IsGrenadeWeapon(int id)
{
switch (id)
{
case WEAPON_HEGRENADE:
case WEAPON_FLASHBANG:
case WEAPON_SMOKEGRENADE:
return true;
default:
break;
}
return false;
}
WeaponInfoStruct *GetWeaponInfo(int weaponID)
{
for (auto& info : g_weaponInfo) {
if (info.id == weaponID) {
return &info;
}
}
return nullptr;
}
WeaponInfoStruct *GetWeaponInfo(const char *weaponName)
{
for (auto& info : g_weaponInfo) {
if (!Q_stricmp(info.entityName, weaponName)) {
return &info;
}
}
return nullptr;
}
AmmoInfoStruct *GetAmmoInfo(const char *ammoName)
{
for (auto& info : g_ammoInfo) {
if (!Q_stricmp(info.ammoName1, ammoName)) {
return &info;
}
}
return nullptr;
}
AmmoInfoStruct *GetAmmoInfo(AmmoType ammoID)
{
for (auto& info : g_ammoInfo) {
if (info.ammoType == ammoID) {
return &info;
}
}
return nullptr;
}
void WeaponInfoReset()
{
Q_memcpy(g_weaponInfo, g_weaponInfo_default, sizeof(g_weaponInfo));
Q_memcpy(g_ammoInfo, g_ammoInfo_default, sizeof(g_ammoInfo));
}
WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID)
{
for (auto& infoSlot : g_weaponSlotInfo) {
if (infoSlot.id == weaponID) {
return &infoSlot;
}
}
return nullptr;
}
WeaponSlotInfo *GetWeaponSlot(const char *weaponName)
{
for (auto& infoSlot : g_weaponSlotInfo) {
if (!Q_stricmp(infoSlot.weaponName, weaponName)) {
return &infoSlot;
}
}
return nullptr;
}
bool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions)
{
if (useAssasinationRestrictions)
{
if (playerTeam == CT)
{
switch (weaponID)
{
case WEAPON_P228:
case WEAPON_XM1014:
case WEAPON_AUG:
case WEAPON_FIVESEVEN:
case WEAPON_UMP45:
case WEAPON_SG550:
case WEAPON_FAMAS:
case WEAPON_USP:
case WEAPON_GLOCK18:
case WEAPON_MP5N:
case WEAPON_M249:
case WEAPON_M3:
case WEAPON_M4A1:
case WEAPON_TMP:
case WEAPON_DEAGLE:
case WEAPON_P90:
case WEAPON_SHIELDGUN:
return true;
default:
return false;
}
}
else if (playerTeam == TERRORIST)
{
switch (weaponID)
{
case WEAPON_P228:
case WEAPON_MAC10:
case WEAPON_ELITE:
case WEAPON_UMP45:
case WEAPON_GALIL:
case WEAPON_USP:
case WEAPON_GLOCK18:
case WEAPON_AWP:
case WEAPON_DEAGLE:
case WEAPON_AK47:
return true;
default:
return false;
}
}
return false;
}
if (playerTeam == CT)
{
switch (weaponID)
{
case WEAPON_P228:
case WEAPON_SCOUT:
case WEAPON_XM1014:
case WEAPON_AUG:
case WEAPON_FIVESEVEN:
case WEAPON_UMP45:
case WEAPON_SG550:
case WEAPON_FAMAS:
case WEAPON_USP:
case WEAPON_GLOCK18:
case WEAPON_AWP:
case WEAPON_MP5N:
case WEAPON_M249:
case WEAPON_M3:
case WEAPON_M4A1:
case WEAPON_TMP:
case WEAPON_DEAGLE:
case WEAPON_P90:
case WEAPON_SHIELDGUN:
return true;
default:
return false;
}
}
else if (playerTeam == TERRORIST)
{
switch (weaponID)
{
case WEAPON_P228:
case WEAPON_SCOUT:
case WEAPON_XM1014:
case WEAPON_MAC10:
case WEAPON_ELITE:
case WEAPON_UMP45:
case WEAPON_GALIL:
case WEAPON_USP:
case WEAPON_GLOCK18:
case WEAPON_AWP:
case WEAPON_MP5N:
case WEAPON_M249:
case WEAPON_M3:
case WEAPON_G3SG1:
case WEAPON_DEAGLE:
case WEAPON_SG552:
case WEAPON_AK47:
case WEAPON_P90:
return true;
default:
return false;
}
}
return false;
}