1 #using scripts\codescripts\struct;
3 #using scripts\shared\array_shared;
4 #using scripts\shared\callbacks_shared;
5 #using scripts\shared\gameobjects_shared;
6 #using scripts\shared\killstreaks_shared;
7 #using scripts\shared\system_shared;
8 #using scripts\shared\util_shared;
9 #using scripts\shared\weapons_shared;
10 #using scripts\shared\weapons\_weapons;
12 #insert scripts\shared\shared.gsh;
14 #using scripts\mp\gametypes\_globallogic_utils;
15 #using scripts\mp\gametypes\_loadout;
16 #using scripts\mp\gametypes\_shellshock;
17 #using scripts\mp\gametypes\_weapon_utils;
18 #using scripts\mp\gametypes\_weaponobjects;
20 #using scripts\mp\_challenges;
21 #using scripts\mp\_scoreevents;
22 #using scripts\mp\_util;
23 #using scripts\mp\killstreaks\_dogs;
24 #using scripts\mp\killstreaks\_killstreaks;
25 #using scripts\mp\killstreaks\_killstreak_weapons;
26 #using scripts\mp\killstreaks\_supplydrop;
51 weapon_data[
"weapon"] = weapon;
52 weapon_data[
"options"] = options;
53 weapon_data[
"acvi"] = acvi;
54 weapon_data[
"kill_count"] = 0;
55 weapon_data[
"spawned_with"] = 0;
56 key =
self.pers[
"bestWeapon"][weapon.name].size;
57 self.pers[
"bestWeapon"][weapon.name][key] = weapon_data;
64 if ( !isDefined(
self.pers[
"bestWeapon"] ) )
66 self.pers[
"bestWeapon"] = [];
68 if ( !IsDefined(
self.pers[
"bestWeapon"][weapon.name] ) )
70 self.pers[
"bestWeapon"][weapon.name] = [];
74 size =
self.pers[
"bestWeapon"][
name].size;
75 for( index = 0; index < size; index++ )
77 if (
self.pers[
"bestWeapon"][
name][index][
"weapon"] == weapon
78 &&
self.pers[
"bestWeapon"][
name][index][
"options"] == options &&
79 self.pers[
"bestWeapon"][
name][index][
"acvi"] == acvi )
94 if ( !IsDefined(
self.pers[
"bestWeapon"] ) )
101 weapon_keys = GetArrayKeys(
self.pers[
"bestWeapon"] );
102 for( key_index = 0; key_index < weapon_keys.size; key_index++ )
104 key = weapon_keys[key_index];
105 size =
self.pers[
"bestWeapon"][key].size;
106 for( index = 0; index < size; index++ )
108 kill_count =
self.pers[
"bestWeapon"][key][index][
"kill_count"];
109 spawned_with =
self.pers[
"bestWeapon"][key][index][
"spawned_with"];
111 if ( kill_count > most_kills )
115 most_kills = kill_count;
116 most_spawns = spawned_with;
118 else if ( kill_count == most_kills && spawned_with > most_spawns )
122 most_kills = kill_count;
123 most_spawns = spawned_with;
128 return self.pers[
"bestWeapon"][best_key][best_index];
133 showcaseWeaponData =
self GetPlayerShowcaseWeapon();
135 if ( !isdefined( showcaseWeaponData ) )
140 showcase_weapon = [];
142 showcase_weapon[
"weapon"] = showcaseWeaponData.weapon;
144 attachmentNames = [];
145 attachmentIndices = [];
146 tokenizedAttachmentInfo = strtok( showcaseWeaponData.attachmentInfo,
"," );
147 for ( index = 0; index + 1 < tokenizedAttachmentInfo.size; index += 2 )
149 attachmentNames[ attachmentNames.size ] = tokenizedAttachmentInfo[ index ];
150 attachmentIndices[ attachmentIndices.size ] = int( tokenizedAttachmentInfo[ index + 1 ] );
152 for ( index = tokenizedAttachmentInfo.size; index + 1 < 16; index += 2 )
154 attachmentNames[ attachmentNames.size ] =
"none";
155 attachmentIndices[ attachmentIndices.size ] = 0;
157 showcase_weapon[
"acvi"] = GetAttachmentCosmeticVariantIndexes( showcaseWeaponData.weapon,
158 attachmentNames[ 0 ], attachmentIndices[ 0 ],
159 attachmentNames[ 1 ], attachmentIndices[ 1 ],
160 attachmentNames[ 2 ], attachmentIndices[ 2 ],
161 attachmentNames[ 3 ], attachmentIndices[ 3 ],
162 attachmentNames[ 4 ], attachmentIndices[ 4 ],
163 attachmentNames[ 5 ], attachmentIndices[ 5 ],
164 attachmentNames[ 6 ], attachmentIndices[ 6 ],
165 attachmentNames[ 7 ], attachmentIndices[ 7 ] );
170 showPaintshop =
false;
171 tokenizedWeaponRenderOptions = strtok( showcaseWeaponData.weaponRenderOptions,
"," );
172 if ( tokenizedWeaponRenderOptions.size > 2 )
174 camoIndex = int( tokenizedWeaponRenderOptions[ 0 ] );
175 paintjobSlot = int( tokenizedWeaponRenderOptions[ 1 ] );
176 paintjobIndex = int( tokenizedWeaponRenderOptions[ 2 ] );
180 showcase_weapon[
"options"] =
self CalcWeaponOptions( camoIndex, 0, 0,
false,
false, showPaintshop,
true );
182 return showcase_weapon;