2099 lines
74 KiB
Lua
2099 lines
74 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
f0_local0 = {
|
|
Type = {
|
|
"TrackedOps",
|
|
"ProgressedOps",
|
|
"MostOps",
|
|
"Random"
|
|
},
|
|
TypeConfigs = {
|
|
TrackedOps = {
|
|
name = "lb_type_tracked",
|
|
text = Engine.Localize( "LUA_MENU_MP_LB_TYPE_TRACKED" ),
|
|
desc = Engine.Localize( "LUA_MENU_MP_LB_TYPE_DESC_TRACKED" ),
|
|
type = "TrackedOps"
|
|
},
|
|
ProgressedOps = {
|
|
name = "lb_type_progressed",
|
|
text = Engine.Localize( "LUA_MENU_MP_LB_TYPE_PROGRESSED" ),
|
|
desc = Engine.Localize( "LUA_MENU_MP_LB_TYPE_DESC_PROGRESSED" ),
|
|
type = "ProgressedOps"
|
|
},
|
|
MostOps = {
|
|
name = "lb_type_most",
|
|
text = Engine.Localize( "LUA_MENU_MP_LB_TYPE_MOST" ),
|
|
desc = Engine.Localize( "LUA_MENU_MP_LB_TYPE_DESC_MOST" ),
|
|
type = "MostOps"
|
|
},
|
|
Random = {
|
|
name = "lb_type_random",
|
|
text = Engine.Localize( "LUA_MENU_MP_LB_TYPE_RANDOM" ),
|
|
desc = Engine.Localize( "LUA_MENU_MP_LB_TYPE_DESC_RANDOM" ),
|
|
type = "Random"
|
|
}
|
|
},
|
|
LoadoutBuilderTable = {
|
|
File = "mp/loadoutBuilderTable.csv",
|
|
MaxItems = 3,
|
|
MaxRows = 1000,
|
|
Cols = {
|
|
ChallengeRef = 0,
|
|
Type1 = 1,
|
|
Item1 = 2,
|
|
Weight1 = 3
|
|
}
|
|
},
|
|
ScopedName = "cac_edit_main",
|
|
MinPerksForSpecialst = 7,
|
|
AttachmentSettings = {
|
|
UnderbarrelWeaponNames = {
|
|
"gl",
|
|
"shotgun"
|
|
}
|
|
},
|
|
WeaponSettings = {
|
|
Primary = {
|
|
MaxDefaultAttachments = 2,
|
|
DefaultWeapon = "iw6_knifeonly",
|
|
DefaultWeaponBaseName = "knifeonly"
|
|
},
|
|
Secondary = {
|
|
MaxDefaultAttachments = 1,
|
|
DefaultWeapon = "none",
|
|
DefaultWeaponBaseName = "none"
|
|
},
|
|
PrimaryGrenade = {
|
|
DefaultWeapon = "specialty_null"
|
|
},
|
|
SecondaryGrenade = {
|
|
DefaultWeapon = "specialty_null"
|
|
},
|
|
TypeLists = {
|
|
"primaryWeapons",
|
|
"secondaryWeapons"
|
|
}
|
|
},
|
|
KillstreakTypes = {
|
|
streaktype_assault = {
|
|
DataName = "assaultStreaks"
|
|
},
|
|
streaktype_support = {
|
|
DataName = "supportStreaks"
|
|
},
|
|
streaktype_specialist = {
|
|
DataName = "specialistStreaks"
|
|
}
|
|
},
|
|
Explosives = {
|
|
Weapons = {
|
|
"iw6_rgm",
|
|
"iw6_panzerfaust3",
|
|
"iw6_mk32"
|
|
},
|
|
Grenades = {
|
|
"frag_grenade_mp",
|
|
"semtex_mp",
|
|
"proximity_explosive_mp",
|
|
"c4_mp",
|
|
"mortar_shell_mp",
|
|
"flash_grenade_mp",
|
|
"concussion_grenade_mp",
|
|
"thermobaric_grenade_mp"
|
|
},
|
|
Attachments = {
|
|
"gl"
|
|
}
|
|
},
|
|
ChallengeItemsLists = {
|
|
"primaryWeapons",
|
|
"secondaryWeapons",
|
|
"primaryGrenades",
|
|
"secondaryGrenades",
|
|
"abilities",
|
|
"assaultStreaks",
|
|
"supportStreaks"
|
|
},
|
|
Layout = {
|
|
TypeButton = {
|
|
Height = CoD.TextSettings.NormalFont.Height * 2 + 10
|
|
}
|
|
}
|
|
}
|
|
function IsLoadoutBuilderButtonAnimEnabled()
|
|
return false
|
|
end
|
|
|
|
function IsLoadoutBuilderEnabled()
|
|
return Engine.GetDvarInt( "ui_lbDisable" ) ~= 1
|
|
end
|
|
|
|
function AbilityRule_RequiresPrimary( f3_arg0 )
|
|
local f3_local0 = Cac.GetWeapon( f3_arg0.controller, f3_arg0.squadLocation, f3_arg0.memberIndex, f3_arg0.classLocation, f3_arg0.loadoutSlot, Cac.Indices.Weapons.Primary )
|
|
local f3_local1 = f3_local0
|
|
local f3_local2
|
|
if f3_local0 == "" or f3_local0 == f0_local0.WeaponSettings.Primary.DefaultWeapon then
|
|
f3_local2 = false
|
|
else
|
|
f3_local2 = f3_local1 and true
|
|
end
|
|
return f3_local2
|
|
end
|
|
|
|
function AbilityRule_RequiresStandardPrimary( f4_arg0 )
|
|
local f4_local0 = Cac.GetWeapon( f4_arg0.controller, f4_arg0.squadLocation, f4_arg0.memberIndex, f4_arg0.classLocation, f4_arg0.loadoutSlot, Cac.Indices.Weapons.Primary )
|
|
local f4_local1 = f4_local0
|
|
local f4_local2
|
|
if f4_local0 == "" or f4_local0 == f0_local0.WeaponSettings.Primary.DefaultWeapon or f4_local0 == "iw6_riotshield" then
|
|
f4_local2 = false
|
|
else
|
|
f4_local2 = f4_local1 and true
|
|
end
|
|
return f4_local2
|
|
end
|
|
|
|
function AbilityRule_RequiresSecondary( f5_arg0 )
|
|
local f5_local0 = Cac.GetWeapon( f5_arg0.controller, f5_arg0.squadLocation, f5_arg0.memberIndex, f5_arg0.classLocation, f5_arg0.loadoutSlot, Cac.Indices.Weapons.Secondary )
|
|
local f5_local1 = f5_local0
|
|
local f5_local2
|
|
if f5_local0 == "" or f5_local0 == f0_local0.WeaponSettings.Secondary.DefaultWeapon then
|
|
f5_local2 = false
|
|
else
|
|
f5_local2 = f5_local1 and true
|
|
end
|
|
return f5_local2
|
|
end
|
|
|
|
function AbilityRule_RequiresGun( f6_arg0 )
|
|
local f6_local0 = AbilityRule_RequiresStandardPrimary( f6_arg0 )
|
|
if not f6_local0 then
|
|
f6_local0 = AbilityRule_RequiresSecondary( f6_arg0 )
|
|
end
|
|
return f6_local0
|
|
end
|
|
|
|
function AbilityRule_RequiresPrimaryGrenade( f7_arg0 )
|
|
local f7_local0 = Cac.GetGrenade( f7_arg0.controller, f7_arg0.squadLocation, f7_arg0.memberIndex, f7_arg0.classLocation, f7_arg0.loadoutSlot, Cac.Indices.Grenade.Primary )
|
|
local f7_local1 = f7_local0
|
|
local f7_local2
|
|
if f7_local0 == "" or f7_local0 == f0_local0.WeaponSettings.PrimaryGrenade.DefaultWeapon then
|
|
f7_local2 = false
|
|
else
|
|
f7_local2 = f7_local1 and true
|
|
end
|
|
return f7_local2
|
|
end
|
|
|
|
function AbilityRule_RequiresSecondaryGrenade( f8_arg0 )
|
|
local f8_local0 = Cac.GetGrenade( f8_arg0.controller, f8_arg0.squadLocation, f8_arg0.memberIndex, f8_arg0.classLocation, f8_arg0.loadoutSlot, Cac.Indices.Grenade.Secondary )
|
|
local f8_local1 = f8_local0
|
|
local f8_local2
|
|
if f8_local0 == "" or f8_local0 == f0_local0.WeaponSettings.SecondaryGrenade.DefaultWeapon then
|
|
f8_local2 = false
|
|
else
|
|
f8_local2 = f8_local1 and true
|
|
end
|
|
return f8_local2
|
|
end
|
|
|
|
function AbilityRule_RequiresGrenade( f9_arg0 )
|
|
local f9_local0 = AbilityRule_RequiresPrimaryGrenade( f9_arg0 )
|
|
if not f9_local0 then
|
|
f9_local0 = AbilityRule_RequiresSecondaryGrenade( f9_arg0 )
|
|
end
|
|
return f9_local0
|
|
end
|
|
|
|
function AbilityRule_RequiresAnyWeapon( f10_arg0 )
|
|
local f10_local0 = AbilityRule_RequiresGun( f10_arg0 )
|
|
if not f10_local0 then
|
|
f10_local0 = AbilityRule_RequiresGrenade( f10_arg0 )
|
|
end
|
|
return f10_local0
|
|
end
|
|
|
|
function AbilityRule_RequiresTwoPrimariesUnlocked( f11_arg0 )
|
|
return #f11_arg0.unlocks.primaryWeapons >= 3
|
|
end
|
|
|
|
function AbilityRule_RequiresExplosive( f12_arg0 )
|
|
if LUI.IsItemInArray( f0_local0.Explosives.Grenades, Cac.GetGrenade( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Grenade.Primary ) ) or LUI.IsItemInArray( Cac.GetGrenade( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Grenade.Secondary ), f0_local0.Explosives.Grenades ) then
|
|
return true
|
|
end
|
|
if LUI.IsItemInArray( f0_local0.Explosives.Weapons, Cac.GetWeapon( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Weapons.Primary ) ) or LUI.IsItemInArray( f0_local0.Explosives.Weapons, Cac.GetWeapon( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ) then
|
|
return true
|
|
end
|
|
local f12_local0 = Cac.GetAttachments( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Weapons.Primary )
|
|
LUI.ConcatenateToTable( f12_local0, Cac.GetAttachments( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Weapons.Secondary ) )
|
|
for f12_local4, f12_local5 in pairs( f12_local0 ) do
|
|
if LUI.IsItemInArray( f0_local0.Explosives.Attachments, f12_local5 ) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
AbilityRuleTable = {
|
|
specialty_fastsprintrecovery = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_fastreload = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_lightweight = nil,
|
|
specialty_marathon = nil,
|
|
specialty_stalker = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_pitcher = {
|
|
AbilityRule_RequiresGrenade
|
|
},
|
|
specialty_sprintreload = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_quickswap = {
|
|
AbilityRule_RequiresPrimary,
|
|
AbilityRule_RequiresSecondary
|
|
},
|
|
specialty_bulletaccuracy = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_quickdraw = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_silentkill = nil,
|
|
specialty_blindeye = nil,
|
|
specialty_quieter = nil,
|
|
specialty_incog = nil,
|
|
specialty_gpsjammer = nil,
|
|
specialty_paint = {
|
|
AbilityRule_RequiresExplosive
|
|
},
|
|
specialty_scavenger = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_detectexplosive = nil,
|
|
specialty_selectivehearing = nil,
|
|
specialty_comexp = nil,
|
|
specialty_falldamage = nil,
|
|
specialty_regenfaster = nil,
|
|
specialty_sharp_focus = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_stun_resistance = nil,
|
|
_specialty_blastshield = nil,
|
|
specialty_extra_equipment = {
|
|
AbilityRule_RequiresSecondaryGrenade
|
|
},
|
|
specialty_extra_deadly = {
|
|
AbilityRule_RequiresPrimaryGrenade
|
|
},
|
|
specialty_extraammo = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_extra_attachment = {
|
|
AbilityRule_RequiresGun
|
|
},
|
|
specialty_explosivedamage = {
|
|
AbilityRule_RequiresExplosive
|
|
},
|
|
specialty_gambler = nil,
|
|
specialty_hardline = nil,
|
|
specialty_boom = nil,
|
|
specialty_twoprimaries = {
|
|
AbilityRule_RequiresPrimary,
|
|
AbilityRule_RequiresSecondary,
|
|
AbilityRule_RequiresTwoPrimariesUnlocked
|
|
},
|
|
specialty_deadeye = {
|
|
AbilityRule_RequiresGun
|
|
}
|
|
}
|
|
function CheckAbilityRules( f13_arg0, f13_arg1, f13_arg2, f13_arg3, f13_arg4, f13_arg5, f13_arg6 )
|
|
local f13_local0 = {
|
|
controller = f13_arg0,
|
|
squadLocation = f13_arg3,
|
|
memberIndex = f13_arg4,
|
|
loadoutSlot = f13_arg6,
|
|
classLocation = f13_arg5,
|
|
unlocks = f13_arg2,
|
|
ability = f13_arg1
|
|
}
|
|
local f13_local1 = AbilityRuleTable[f13_arg1]
|
|
if f13_local1 then
|
|
for f13_local5, f13_local6 in pairs( f13_local1 ) do
|
|
if not f13_local6( f13_local0 ) then
|
|
return false
|
|
end
|
|
end
|
|
end
|
|
return true
|
|
end
|
|
|
|
function ApplyAbilityRulesToList( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 )
|
|
for f14_local0 = #f14_arg1, 1, -1 do
|
|
if not CheckAbilityRules( f14_arg0, f14_arg1[f14_local0], f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 ) then
|
|
table.remove( f14_arg1, f14_local0 )
|
|
end
|
|
end
|
|
end
|
|
|
|
function IsAttachmentAnUnderbarrelWeapon( f15_arg0 )
|
|
for f15_local3, f15_local4 in pairs( f0_local0.AttachmentSettings.UnderbarrelWeaponNames ) do
|
|
if f15_arg0 == f15_local4 then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectRandomUnlockedWeapon( f16_arg0, f16_arg1 )
|
|
local f16_local0 = math.random( 1, #f16_arg0 )
|
|
for f16_local1 = 0, #f16_arg0 - 1, 1 do
|
|
local f16_local4 = f16_local0 + f16_local1
|
|
if #f16_arg0 < f16_local4 then
|
|
f16_local4 = f16_local4 - #f16_arg0
|
|
end
|
|
local f16_local5 = f16_arg0[f16_local4]
|
|
local f16_local6 = false
|
|
for f16_local10, f16_local11 in pairs( f16_arg1 ) do
|
|
if f16_local5.name == f16_local11 then
|
|
f16_local6 = true
|
|
break
|
|
end
|
|
end
|
|
if not f16_local6 then
|
|
return f16_local5
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectRandomAbilityFromList( f17_arg0, f17_arg1 )
|
|
if #f17_arg0 < 1 then
|
|
return
|
|
end
|
|
local f17_local0 = math.random( 1, #f17_arg0 )
|
|
for f17_local1 = 0, #f17_arg0 - 1, 1 do
|
|
local f17_local4 = f17_local0 + f17_local1
|
|
if #f17_arg0 < f17_local4 then
|
|
f17_local4 = f17_local4 - #f17_arg0
|
|
end
|
|
local f17_local5 = f17_arg0[f17_local4]
|
|
local f17_local6 = tonumber( Cac.GetPerkCost( f17_local5 ) )
|
|
if f17_local6 <= f17_arg1 then
|
|
return f17_local5, f17_local6, f17_local4
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectRandomKillstreakFromList( f18_arg0, f18_arg1 )
|
|
local f18_local0 = math.random( 1, #f18_arg0 )
|
|
for f18_local1 = 0, #f18_arg0 - 1, 1 do
|
|
local f18_local4 = f18_local0 + f18_local1
|
|
if #f18_arg0 < f18_local4 then
|
|
f18_local4 = f18_local4 - #f18_arg0
|
|
end
|
|
local f18_local5 = false
|
|
local f18_local6 = f18_arg0[f18_local4]
|
|
local f18_local7 = Cac.GetStreakCost( f18_local6 )
|
|
for f18_local11, f18_local12 in pairs( f18_arg1 ) do
|
|
if f18_local6 == f18_local12 then
|
|
f18_local5 = true
|
|
break
|
|
end
|
|
if f18_local7 == Cac.GetStreakCost( f18_local12 ) then
|
|
f18_local5 = true
|
|
break
|
|
end
|
|
end
|
|
if not f18_local5 then
|
|
return f18_local6
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectRandomAttachmentFromList( f19_arg0, f19_arg1, f19_arg2 )
|
|
local f19_local0 = math.random( 1, #f19_arg0 )
|
|
for f19_local1 = 0, #f19_arg0 - 1, 1 do
|
|
local f19_local4 = f19_local0 + f19_local1
|
|
if #f19_arg0 < f19_local4 then
|
|
f19_local4 = f19_local4 - #f19_arg0
|
|
end
|
|
local f19_local5 = false
|
|
local f19_local6 = f19_arg0[f19_local4]
|
|
local f19_local7 = Cac.GetAttachmentType( f19_local6 )
|
|
for f19_local11, f19_local12 in pairs( f19_arg1 ) do
|
|
if f19_local7 == Cac.GetAttachmentType( f19_local12 ) then
|
|
f19_local5 = true
|
|
end
|
|
end
|
|
if not f19_local5 and f19_arg2 then
|
|
for f19_local11, f19_local12 in pairs( f19_arg2 ) do
|
|
if f19_local6 == f19_local12 then
|
|
f19_local5 = true
|
|
end
|
|
end
|
|
end
|
|
if not f19_local5 then
|
|
return f19_local6
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectRandomAttachmentsForWeapon( f20_arg0, f20_arg1, f20_arg2, f20_arg3 )
|
|
if not f20_arg0.unlockedAttachments or #f20_arg0.unlockedAttachments == 0 then
|
|
return
|
|
end
|
|
for f20_local0 = 1, f20_arg1, 1 do
|
|
local f20_local3 = f20_local0
|
|
local f20_local4 = SelectRandomAttachmentFromList( f20_arg0.unlockedAttachments, f20_arg2, f20_arg3 )
|
|
if f20_local4 then
|
|
f20_arg2[#f20_arg2 + 1] = f20_local4
|
|
end
|
|
end
|
|
end
|
|
|
|
function GetUnlockedItems()
|
|
local f21_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
return f21_local0.unlockedItems
|
|
end
|
|
|
|
function CacheWeapon( f22_arg0, f22_arg1 )
|
|
local f22_local0 = GetUnlockedItems()
|
|
if f22_arg1 == f0_local0.WeaponSettings.Primary.DefaultWeapon or f22_arg1 == f0_local0.WeaponSettings.Secondary.DefaultWeapon then
|
|
return
|
|
end
|
|
local f22_local1 = Cac.GetWeaponClass( f22_arg1 )
|
|
assert( f22_local1 )
|
|
if f22_local1 == "" then
|
|
local f22_local2 = Cac.IsPrimaryGrenade( f22_arg1 )
|
|
assert( f22_local2 or Cac.IsSecondaryGrenade( f22_arg1 ), "Weapon is not a primary/secondary weapon or lethal/tactical" )
|
|
local f22_local3
|
|
if f22_local2 then
|
|
f22_local3 = "primaryGrenades"
|
|
if not f22_local3 then
|
|
|
|
else
|
|
f22_local0[f22_local3][#f22_local0[f22_local3] + 1] = f22_arg1
|
|
end
|
|
end
|
|
f22_local3 = "secondaryGrenades"
|
|
else
|
|
local f22_local3
|
|
if Cac.IsWeaponClassPrimary( f22_local1 ) then
|
|
f22_local3 = "primaryWeapons"
|
|
if not f22_local3 then
|
|
|
|
else
|
|
f22_local0[f22_local3][#f22_local0[f22_local3] + 1] = {
|
|
name = f22_arg1,
|
|
baseName = string.sub( f22_arg1, string.len( "iw6_" ) + 1 ),
|
|
unlockedAttachments = {}
|
|
}
|
|
end
|
|
end
|
|
f22_local3 = "secondaryWeapons"
|
|
end
|
|
end
|
|
|
|
function CacheAttachment( f23_arg0, f23_arg1 )
|
|
local f23_local0 = GetUnlockedItems()
|
|
local f23_local1, f23_local2 = string.find( f23_arg1, ".+_" )
|
|
assert( f23_local2 and f23_local1 and f23_local2 > 1 )
|
|
local f23_local3 = string.sub( f23_arg1, f23_local1, f23_local2 - 1 )
|
|
local f23_local4 = string.sub( f23_arg1, f23_local2 + 1 )
|
|
local f23_local5 = Engine.TableLookupGetRowNum( StatsTable.File, StatsTable.Cols.WeaponRef, "iw6_" .. f23_local3 )
|
|
assert( f23_local5 and f23_local5 >= 0 )
|
|
local f23_local6 = false
|
|
for f23_local7 = StatsTable.Cols.WeaponAttachFirst, StatsTable.Cols.WeaponAttachLast, 1 do
|
|
local f23_local10 = Engine.TableLookupByRow( StatsTable.File, f23_local5, f23_local7 )
|
|
if f23_local10 and f23_local10 == f23_local4 then
|
|
f23_local6 = true
|
|
break
|
|
end
|
|
end
|
|
if not f23_local6 then
|
|
return
|
|
end
|
|
local f23_local7 = nil
|
|
for f23_local15, f23_local16 in pairs( {
|
|
f23_local0.primaryWeapons,
|
|
f23_local0.secondaryWeapons
|
|
} ) do
|
|
for f23_local12, f23_local13 in pairs( f23_local16 ) do
|
|
if f23_local13.baseName == f23_local3 then
|
|
f23_local7 = f23_local13
|
|
end
|
|
end
|
|
end
|
|
if f23_local7 then
|
|
f23_local7.unlockedAttachments[#f23_local7.unlockedAttachments + 1] = f23_local4
|
|
end
|
|
end
|
|
|
|
function CacheKillstreak( f24_arg0, f24_arg1 )
|
|
local f24_local0 = GetUnlockedItems()
|
|
local f24_local1 = Cac.GetKillstreakType( f24_arg1 )
|
|
assert( f24_local1 )
|
|
local f24_local2
|
|
if f24_local1 == "streaktype_assault" then
|
|
f24_local2 = "assaultStreaks"
|
|
if not f24_local2 then
|
|
|
|
else
|
|
f24_local0[f24_local2][#f24_local0[f24_local2] + 1] = f24_arg1
|
|
end
|
|
end
|
|
f24_local2 = "supportStreaks"
|
|
end
|
|
|
|
function CacheAbility( f25_arg0, f25_arg1 )
|
|
local f25_local0 = GetUnlockedItems()
|
|
f25_local0.abilities[#f25_local0.abilities + 1] = f25_arg1
|
|
end
|
|
|
|
f0_local1 = {
|
|
weapon = CacheWeapon,
|
|
killstreak = CacheKillstreak,
|
|
perk = CacheAbility,
|
|
attachment = CacheAttachment
|
|
}
|
|
function IsItemUnlocked( f26_arg0, f26_arg1, f26_arg2, f26_arg3, f26_arg4, f26_arg5, f26_arg6 )
|
|
if f26_arg6 == "weapon" then
|
|
if Cac.IsWeaponEntitlement( f26_arg5 ) then
|
|
if not Cac.IsWeaponEntitlementUnlocked( f26_arg0, f26_arg5 ) then
|
|
return false
|
|
elseif Cac.ShouldHideWeaponEntitlement( f26_arg0, f26_arg5 ) then
|
|
return false
|
|
end
|
|
end
|
|
elseif f26_arg6 == "perk" then
|
|
return Cac.IsPerkUnlocked( f26_arg0, f26_arg1, f26_arg2, f26_arg5 )
|
|
end
|
|
return Cac.IsItemUnlocked( f26_arg0, f26_arg1, f26_arg2, f26_arg5 )
|
|
end
|
|
|
|
function CacheUnlockedItems( f27_arg0 )
|
|
local f27_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
f27_local0.unlockedItems = {
|
|
primaryWeapons = {},
|
|
secondaryWeapons = {},
|
|
primaryGrenades = {},
|
|
secondaryGrenades = {},
|
|
assaultStreaks = {},
|
|
supportStreaks = {},
|
|
abilities = {}
|
|
}
|
|
local f27_local1 = 1500
|
|
for f27_local2 = 0, f27_local1 - 1, 1 do
|
|
local f27_local5 = Engine.TableLookupByRow( Cac.WeaponUnlockTable.File, f27_local2, Cac.WeaponUnlockTable.Cols.Type )
|
|
if f27_local5 and f27_local5 ~= "" then
|
|
local f27_local6 = Engine.TableLookupByRow( Cac.WeaponUnlockTable.File, f27_local2, Cac.WeaponUnlockTable.Cols.WeaponRef )
|
|
if f27_local6 and f27_local6 ~= "" and IsItemUnlocked( f27_arg0, f27_local0.squadLocation, f27_local0.memberIndex, f27_local0.classLocation, f27_local0.loadoutLocation, f27_local6, f27_local5 ) then
|
|
local f27_local7 = f0_local1[f27_local5]
|
|
if f27_local7 then
|
|
f27_local7( f27_arg0, f27_local6 )
|
|
end
|
|
end
|
|
end
|
|
end
|
|
f27_local0.unlockedItems.primaryWeapons[#f27_local0.unlockedItems.primaryWeapons + 1] = {
|
|
name = f0_local0.WeaponSettings.Primary.DefaultWeapon,
|
|
baseName = f0_local0.WeaponSettings.Primary.DefaultWeaponBaseName,
|
|
unlockedAttachments = {}
|
|
}
|
|
f27_local0.unlockedItems.secondaryWeapons[#f27_local0.unlockedItems.secondaryWeapons + 1] = {
|
|
name = f0_local0.WeaponSettings.Secondary.DefaultWeapon,
|
|
baseName = f0_local0.WeaponSettings.Secondary.DefaultWeaponBaseName,
|
|
unlockedAttachments = {}
|
|
}
|
|
f27_local0.unlockedItems.primaryGrenades[#f27_local0.unlockedItems.primaryGrenades + 1] = f0_local0.WeaponSettings.PrimaryGrenade.DefaultWeapon
|
|
f27_local0.unlockedItems.secondaryGrenades[#f27_local0.unlockedItems.secondaryGrenades + 1] = f0_local0.WeaponSettings.SecondaryGrenade.DefaultWeapon
|
|
return f27_local0.unlockedItems
|
|
end
|
|
|
|
function AddWeightForItemInList( f28_arg0, f28_arg1, f28_arg2 )
|
|
for f28_local3, f28_local4 in pairs( f28_arg0 ) do
|
|
if f28_local4.name == f28_arg1 then
|
|
f28_local4.weight = f28_local4.weight + f28_arg2
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function AddWeightForKillstreakType( f29_arg0, f29_arg1, f29_arg2 )
|
|
assert( Cac.Streaks[f29_arg1], "Invalid killstreak type " .. f29_arg1 .. " loaded from LoadoutBuilder.csv." )
|
|
f29_arg0.killstreakTypes[f29_arg1].weight = f29_arg0.killstreakTypes[f29_arg1].weight + f29_arg2
|
|
end
|
|
|
|
function AddWeightForPerk( f30_arg0, f30_arg1, f30_arg2 )
|
|
assert( f30_arg1 == 1, "Perk weights are assumed to be one. This could be changed, but when regular perks are picked, it has to lower the weight of the specialisttype by the appropriate amount." )
|
|
assert( Cac.GetPerkCost( f30_arg0 ), "Could not get perk cost for perk " .. f30_arg0 .. ". Is this a valid perk? (from LoadoutBuilder.csv)" )
|
|
if AddWeightForItemInList( f30_arg2.abilities, f30_arg0, f30_arg1 ) then
|
|
AddWeightForKillstreakType( f30_arg2, "streaktype_specialist", f30_arg1 )
|
|
end
|
|
end
|
|
|
|
f0_local2 = {
|
|
perk = function ( f31_arg0, f31_arg1, f31_arg2, f31_arg3 )
|
|
AddWeightForPerk( f31_arg1, f31_arg2, f31_arg3 )
|
|
end,
|
|
attachment = function ( f32_arg0, f32_arg1, f32_arg2, f32_arg3 )
|
|
if f32_arg1 == "no_attach" then
|
|
|
|
else
|
|
|
|
end
|
|
for f32_local6, f32_local7 in pairs( f0_local0.WeaponSettings.TypeLists ) do
|
|
for f32_local3, f32_local4 in pairs( f32_arg3[f32_local7] ) do
|
|
AddWeightForItemInList( f32_local4.attachments, f32_arg1, f32_arg2 )
|
|
end
|
|
end
|
|
end,
|
|
weaponclass = function ( f33_arg0, f33_arg1, f33_arg2, f33_arg3 )
|
|
assert( Cac.Weapons[f33_arg1], "Unknown weaponclass " .. f33_arg1 .. " loaded from LoadoutBuilder.csv." )
|
|
for f33_local6, f33_local7 in pairs( f0_local0.WeaponSettings.TypeLists ) do
|
|
for f33_local3, f33_local4 in pairs( f33_arg3[f33_local7] ) do
|
|
if f33_local4.weaponClass == f33_arg1 then
|
|
f33_local4.weight = f33_local4.weight + f33_arg2
|
|
end
|
|
end
|
|
end
|
|
end,
|
|
weapon = function ( f34_arg0, f34_arg1, f34_arg2, f34_arg3 )
|
|
assert( Cac.GetWeaponClass( f34_arg1 ), "Unknown weapon " .. f34_arg1 .. " loaded from LoadoutBuilder.csv." )
|
|
for f34_local3, f34_local4 in pairs( f0_local0.WeaponSettings.TypeLists ) do
|
|
AddWeightForItemInList( f34_arg3[f34_local4], f34_arg1, f34_arg2 )
|
|
end
|
|
end,
|
|
grenade = function ( f35_arg0, f35_arg1, f35_arg2, f35_arg3 )
|
|
assert( LUI.IsItemInArray( Cac.PrimaryGrenades, f35_arg1 ), "Unknown primary (lethal) grenade " .. f35_arg1 .. " loaded from LoadoutBuilder.csv." )
|
|
AddWeightForItemInList( f35_arg3.primaryGrenades, f35_arg1, f35_arg2 )
|
|
end,
|
|
tactical = function ( f36_arg0, f36_arg1, f36_arg2, f36_arg3 )
|
|
assert( LUI.IsItemInArray( Cac.SecondaryGrenades, f36_arg1 ), "Unknown secondary (tactical) grenade " .. f36_arg1 .. " loaded from LoadoutBuilder.csv." )
|
|
AddWeightForItemInList( f36_arg3.secondaryGrenades, f36_arg1, f36_arg2 )
|
|
end,
|
|
streaktype_assault = function ( f37_arg0, f37_arg1, f37_arg2, f37_arg3 )
|
|
assert( Cac.GetKillstreakType( f37_arg1 ) == "streaktype_assault", "Invalid assault killstreak " .. f37_arg1 .. " loaded from LoadoutBuilder.csv." )
|
|
if AddWeightForItemInList( f37_arg3.assaultStreaks, f37_arg1, f37_arg2 ) then
|
|
AddWeightForKillstreakType( f37_arg3, "streaktype_assault", f37_arg2 )
|
|
end
|
|
end,
|
|
streaktype_support = function ( f38_arg0, f38_arg1, f38_arg2, f38_arg3 )
|
|
assert( Cac.GetKillstreakType( f38_arg1 ) == "streaktype_support", "Invalid support killstreak " .. f38_arg1 .. " loaded from LoadoutBuilder.csv." )
|
|
if AddWeightForItemInList( f38_arg3.supportStreaks, f38_arg1, f38_arg2 ) then
|
|
AddWeightForKillstreakType( f38_arg3, "streaktype_support", f38_arg2 )
|
|
end
|
|
end,
|
|
killstreaktype = function ( f39_arg0, f39_arg1, f39_arg2, f39_arg3 )
|
|
AddWeightForKillstreakType( f39_arg3, f39_arg1, f39_arg2 )
|
|
end,
|
|
gamemode = function ( f40_arg0, f40_arg1, f40_arg2, f40_arg3 )
|
|
|
|
end,
|
|
playlist = function ( f41_arg0, f41_arg1, f41_arg2, f41_arg3 )
|
|
|
|
end,
|
|
special = function ( f42_arg0, f42_arg1, f42_arg2, f42_arg3 )
|
|
if f42_arg1 == "clueless" then
|
|
for f42_local3, f42_local4 in pairs( f42_arg3.secondaryWeapons ) do
|
|
if f42_local4.name == "iw6_magnum" then
|
|
f42_local4.weight = f42_local4.weight + f42_arg2
|
|
AddWeightForItemInList( f42_local4.attachments, "akimbo", f42_arg2 )
|
|
AddWeightForItemInList( f42_local4.attachments, "acog", f42_arg2 )
|
|
break
|
|
end
|
|
end
|
|
AddWeightForPerk( "specialty_extra_attachment", f42_arg2, f42_arg3 )
|
|
elseif f42_arg1 == "twoweapons" then
|
|
|
|
else
|
|
assert( nil, "Unhandled \"special\" item " .. f42_arg1 .. " from LoadoutBuilder.csv" )
|
|
end
|
|
end
|
|
}
|
|
function ProcessItemForChallenge( f43_arg0, f43_arg1, f43_arg2, f43_arg3, f43_arg4 )
|
|
local f43_local0 = f0_local2[f43_arg1]
|
|
assert( f43_local0 )
|
|
if f43_local0 then
|
|
f43_local0( f43_arg0, f43_arg2, f43_arg3, f43_arg4 )
|
|
end
|
|
end
|
|
|
|
function ProcessLoadoutBuilderTableRow( f44_arg0, f44_arg1, f44_arg2 )
|
|
for f44_local0 = 1, f0_local0.LoadoutBuilderTable.MaxItems, 1 do
|
|
local f44_local3 = f0_local0.LoadoutBuilderTable.Cols.Type1 + (f44_local0 - 1) * f0_local0.LoadoutBuilderTable.MaxItems
|
|
local f44_local4 = f0_local0.LoadoutBuilderTable.Cols.Item1 + (f44_local0 - 1) * f0_local0.LoadoutBuilderTable.MaxItems
|
|
local f44_local5 = f0_local0.LoadoutBuilderTable.Cols.Weight1 + (f44_local0 - 1) * f0_local0.LoadoutBuilderTable.MaxItems
|
|
local f44_local6 = Engine.TableLookupByRow( f0_local0.LoadoutBuilderTable.File, f44_arg1, f44_local3 )
|
|
local f44_local7 = Engine.TableLookupByRow( f0_local0.LoadoutBuilderTable.File, f44_arg1, f44_local4 )
|
|
local f44_local8 = Engine.TableLookupByRow( f0_local0.LoadoutBuilderTable.File, f44_arg1, f44_local5 )
|
|
if f44_local8 then
|
|
if f44_local8 == "" then
|
|
f44_local8 = 1
|
|
else
|
|
f44_local8 = tonumber( f44_local8 )
|
|
end
|
|
else
|
|
f44_local8 = 1
|
|
end
|
|
if f44_local6 and f44_local6 ~= "" and f44_local7 and f44_local7 ~= "" then
|
|
assert( f44_local8 )
|
|
ProcessItemForChallenge( f44_arg0, f44_local6, f44_local7, f44_local8, f44_arg2 )
|
|
end
|
|
local f44_local9 = assert
|
|
local f44_local10
|
|
if f44_local6 and f44_local6 ~= "" and f44_local7 and f44_local7 ~= "" then
|
|
f44_local10 = false
|
|
else
|
|
f44_local10 = true
|
|
end
|
|
f44_local9( f44_local10, "LoadoutBuilderTable.csv is malformed. Row " .. f44_arg1 .. " does not have correct type/item pairs" )
|
|
end
|
|
end
|
|
|
|
function ProcessItemsForChallenge( f45_arg0, f45_arg1, f45_arg2 )
|
|
local f45_local0 = Engine.TableLookupGetRowNum( f0_local0.LoadoutBuilderTable.File, f0_local0.LoadoutBuilderTable.Cols.ChallengeRef, f45_arg1 )
|
|
if not f45_local0 or f45_local0 < 0 then
|
|
return
|
|
else
|
|
ProcessLoadoutBuilderTableRow( f45_arg0, f45_local0, f45_arg2 )
|
|
end
|
|
end
|
|
|
|
function InitChallengeItemTable( f46_arg0 )
|
|
local f46_local0 = {
|
|
primaryWeapons = {},
|
|
secondaryWeapons = {},
|
|
primaryGrenades = {},
|
|
secondaryGrenades = {},
|
|
assaultStreaks = {},
|
|
supportStreaks = {},
|
|
abilities = {},
|
|
killstreakTypes = {
|
|
streaktype_assault = {
|
|
name = "streaktype_assault",
|
|
weight = 0
|
|
},
|
|
streaktype_support = {
|
|
name = "streaktype_support",
|
|
weight = 0
|
|
},
|
|
streaktype_specialist = {
|
|
name = "streaktype_specialist",
|
|
weight = 0
|
|
}
|
|
}
|
|
}
|
|
local f46_local1 = function ( f47_arg0 )
|
|
local f47_local0 = {}
|
|
for f47_local4, f47_local5 in ipairs( f47_arg0 ) do
|
|
f47_local0[f47_local4] = {
|
|
name = f47_local5,
|
|
weight = 0
|
|
}
|
|
end
|
|
return f47_local0
|
|
end
|
|
|
|
for f46_local8, f46_local9 in pairs( f0_local0.WeaponSettings.TypeLists ) do
|
|
for f46_local5, f46_local6 in pairs( f46_arg0[f46_local9] ) do
|
|
f46_local0[f46_local9][#f46_local0[f46_local9] + 1] = {
|
|
name = f46_local6.name,
|
|
attachments = f46_local1( f46_local6.unlockedAttachments ),
|
|
weaponClass = Cac.GetWeaponClass( f46_local6.name ),
|
|
weight = 0
|
|
}
|
|
end
|
|
end
|
|
f46_local0.primaryGrenades = f46_local1( f46_arg0.primaryGrenades )
|
|
f46_local0.secondaryGrenades = f46_local1( f46_arg0.secondaryGrenades )
|
|
f46_local0.abilities = f46_local1( f46_arg0.abilities )
|
|
f46_local0.assaultStreaks = f46_local1( f46_arg0.assaultStreaks )
|
|
f46_local0.supportStreaks = f46_local1( f46_arg0.supportStreaks )
|
|
return f46_local0
|
|
end
|
|
|
|
function SortChallengeItemTable( f48_arg0 )
|
|
local f48_local0 = function ( f49_arg0, f49_arg1 )
|
|
return f49_arg1.weight < f49_arg0.weight
|
|
end
|
|
|
|
for f48_local12, f48_local13 in pairs( f0_local0.WeaponSettings.TypeLists ) do
|
|
for f48_local9, f48_local10 in pairs( f48_arg0[f48_local13] ) do
|
|
if f48_local10.attachments then
|
|
table.sort( f48_local10.attachments, f48_local0 )
|
|
local f48_local4
|
|
if f48_local10.weaponClass and Cac.IsWeaponClassPrimary( f48_local10.weaponClass ) or false then
|
|
f48_local4 = f0_local0.WeaponSettings.Primary.MaxDefaultAttachments
|
|
if not f48_local4 then
|
|
|
|
else
|
|
f48_local4 = f48_local4 + 1
|
|
for f48_local5 = 1, f48_local4, 1 do
|
|
local f48_local8 = f48_local10.attachments[f48_local5]
|
|
if f48_local8 then
|
|
f48_local10.weight = f48_local10.weight + f48_local8.weight
|
|
end
|
|
end
|
|
end
|
|
end
|
|
f48_local4 = f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments
|
|
end
|
|
end
|
|
table.sort( f48_arg0[f48_local13], f48_local0 )
|
|
end
|
|
table.sort( f48_arg0.primaryGrenades, f48_local0 )
|
|
table.sort( f48_arg0.secondaryGrenades, f48_local0 )
|
|
table.sort( f48_arg0.abilities, f48_local0 )
|
|
table.sort( f48_arg0.assaultStreaks, f48_local0 )
|
|
table.sort( f48_arg0.supportStreaks, f48_local0 )
|
|
end
|
|
|
|
function ProcessItemsForChallengeList( f50_arg0, f50_arg1, f50_arg2 )
|
|
local f50_local0 = InitChallengeItemTable( f50_arg2 )
|
|
for f50_local4, f50_local5 in pairs( f50_arg1 ) do
|
|
ProcessItemsForChallenge( f50_arg0, f50_local5, f50_local0 )
|
|
end
|
|
SortChallengeItemTable( f50_local0 )
|
|
return f50_local0
|
|
end
|
|
|
|
function ProcessItemsForAllChallenges( f51_arg0, f51_arg1 )
|
|
local f51_local0 = InitChallengeItemTable( f51_arg1 )
|
|
for f51_local1 = 1, f0_local0.LoadoutBuilderTable.MaxRows, 1 do
|
|
local f51_local4 = Engine.TableLookupByRow( f0_local0.LoadoutBuilderTable.File, f51_local1, f0_local0.LoadoutBuilderTable.Cols.ChallengeRef )
|
|
if f51_local4 ~= "" then
|
|
if not f51_local4 then
|
|
break
|
|
end
|
|
ProcessLoadoutBuilderTableRow( f51_arg0, f51_local1, f51_local0 )
|
|
end
|
|
end
|
|
SortChallengeItemTable( f51_local0 )
|
|
return f51_local0
|
|
end
|
|
|
|
function RemoveChallengeItemAbility( f52_arg0, f52_arg1, f52_arg2 )
|
|
LUI.RemoveSingleItemFromArray( f52_arg1, f52_arg0 )
|
|
for f52_local4, f52_local5 in pairs( f52_arg2.abilities ) do
|
|
if f52_local5.name == f52_arg0 then
|
|
local f52_local3 = f52_local5.weight
|
|
if f52_local3 > 0 then
|
|
AddWeightForKillstreakType( f52_arg2, "streaktype_specialist", -f52_local3 )
|
|
assert( f52_arg2.killstreakTypes.streaktype_specialist.weight >= 0 )
|
|
end
|
|
return
|
|
end
|
|
end
|
|
assert( nil, "RemoveChallengeItemAbility attempted to remove an item that wasn't in the challengeItems list." )
|
|
end
|
|
|
|
function SelectChallengeItemAbility( f53_arg0, f53_arg1, f53_arg2 )
|
|
local f53_local0 = nil
|
|
for f53_local1 = 1, #f53_arg0, 1 do
|
|
f53_local0 = f53_arg0[f53_local1]
|
|
local f53_local4 = tonumber( Cac.GetPerkCost( f53_local0 ) )
|
|
if f53_local4 <= f53_arg1 then
|
|
RemoveChallengeItemAbility( f53_local0, f53_arg0, f53_arg2 )
|
|
return f53_local0, f53_arg1 - f53_local4
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectChallengeItem( f54_arg0, f54_arg1, f54_arg2 )
|
|
local f54_local0 = {}
|
|
local f54_local1 = nil
|
|
for f54_local2 = 1, #f54_arg0, 1 do
|
|
local f54_local5 = f54_arg0[f54_local2]
|
|
if f54_local5.weight <= 0 and not f54_arg1 then
|
|
break
|
|
end
|
|
local f54_local6 = false
|
|
if f54_arg2 then
|
|
for f54_local10, f54_local11 in pairs( f54_arg2 ) do
|
|
if f54_local5.name == f54_local11 then
|
|
f54_local6 = true
|
|
break
|
|
end
|
|
end
|
|
end
|
|
if not f54_local6 then
|
|
if not f54_local1 then
|
|
f54_local1 = f54_local5.weight
|
|
elseif f54_local5.weight ~= f54_local1 then
|
|
|
|
end
|
|
f54_local0[#f54_local0 + 1] = {
|
|
item = f54_local5,
|
|
index = f54_local2
|
|
}
|
|
end
|
|
end
|
|
if #f54_local0 == 0 then
|
|
return
|
|
else
|
|
local f54_local3 = f54_local0[math.random( 1, #f54_local0 )]
|
|
return f54_local3.item, f54_local3.index
|
|
end
|
|
end
|
|
|
|
function SelectAttachmentFromChallengeItems( f55_arg0, f55_arg1, f55_arg2 )
|
|
for f55_local7, f55_local8 in ipairs( f55_arg0 ) do
|
|
local f55_local9 = Cac.GetAttachmentType( f55_local8.name )
|
|
local f55_local3 = false
|
|
for f55_local4, f55_local5 in pairs( f55_arg1 ) do
|
|
if f55_local9 == Cac.GetAttachmentType( f55_local5 ) then
|
|
f55_local3 = true
|
|
break
|
|
end
|
|
end
|
|
if not f55_local3 and f55_arg2 and IsAttachmentAnUnderbarrelWeapon( f55_local8.name ) then
|
|
f55_local3 = true
|
|
end
|
|
if not f55_local3 then
|
|
f55_arg1[#f55_arg1 + 1] = f55_local8.name
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectWeaponAttachmentsFromChallengeItems( f56_arg0, f56_arg1, f56_arg2 )
|
|
if not f56_arg0.attachments or #f56_arg0.attachments == 0 then
|
|
return
|
|
end
|
|
for f56_local0 = 1, f56_arg1, 1 do
|
|
local f56_local3 = f56_local0
|
|
SelectAttachmentFromChallengeItems( f56_arg0.attachments, f56_arg2 )
|
|
end
|
|
end
|
|
|
|
function SelectKillstreakTypeFromChallengeItems( f57_arg0 )
|
|
local f57_local0 = nil
|
|
for f57_local4, f57_local5 in pairs( f57_arg0.killstreakTypes ) do
|
|
if f57_local5.weight > 0 and (not f57_local0 or f57_local0.weight < f57_local5.weight) then
|
|
f57_local0 = f57_local5
|
|
end
|
|
end
|
|
if f57_local0 then
|
|
return f57_local0.name
|
|
else
|
|
|
|
end
|
|
end
|
|
|
|
function SelectWeaponsFromChallengeItems( f58_arg0, f58_arg1 )
|
|
for f58_local3, f58_local4 in ipairs( {
|
|
{
|
|
listName = "primaryWeapons",
|
|
outputName = "primaryWeapon",
|
|
outputAttachmentList = "primaryAttachments",
|
|
maxAttachments = f0_local0.WeaponSettings.Primary.MaxDefaultAttachments,
|
|
isPrimary = true
|
|
},
|
|
{
|
|
listName = "secondaryWeapons",
|
|
outputName = "secondaryWeapon",
|
|
outputAttachmentList = "secondaryAttachments",
|
|
maxAttachments = f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments,
|
|
isPrimary = false
|
|
}
|
|
} ) do
|
|
local f58_local5 = SelectChallengeItem( f58_arg0[f58_local4.listName] )
|
|
if f58_local5 then
|
|
f58_arg1[f58_local4.outputName] = f58_local5.name
|
|
f58_arg1[f58_local4.outputAttachmentList] = {}
|
|
SelectWeaponAttachmentsFromChallengeItems( f58_local5, f58_local4.maxAttachments, f58_arg1[f58_local4.outputAttachmentList] )
|
|
end
|
|
end
|
|
end
|
|
|
|
function StoreOldAbilities( f59_arg0, f59_arg1, f59_arg2, f59_arg3, f59_arg4 )
|
|
local f59_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
for f59_local6, f59_local7 in pairs( Cac.Abilities.Types ) do
|
|
for f59_local5 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do
|
|
local f59_local4 = Cac.GetAbilitySlotRef( Cac.Abilities.Refs[f59_local6], f59_local5 )
|
|
if Cac.IsAbilityPicked( f59_arg0, f59_local0.squadLocation, f59_local0.memberIndex, f59_local0.classLocation, f59_local0.loadoutSlot, f59_local7, f59_local5 - 1, "abilitiesPicked" ) then
|
|
f59_arg1[#f59_arg1 + 1] = f59_local4
|
|
end
|
|
end
|
|
end
|
|
for f59_local1 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do
|
|
f59_local7 = Cac.GetKillstreak( f59_arg0, f59_local0.squadLocation, f59_local0.memberIndex, f59_local0.classLocation, f59_local0.loadoutSlot, "specialistStreaks", f59_local1 - 1 )
|
|
if f59_local7 and f59_local7 ~= "none" then
|
|
f59_local7 = Cac.StripSuffix( f59_local7, "_ks" )
|
|
f59_arg2[#f59_arg2 + 1] = f59_local7
|
|
f59_arg1[#f59_arg1 + 1] = f59_local7
|
|
end
|
|
end
|
|
for f59_local6, f59_local7 in pairs( Cac.Abilities.Types ) do
|
|
for f59_local5 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do
|
|
local f59_local4 = Cac.GetAbilitySlotRef( Cac.Abilities.Refs[f59_local6], f59_local5 )
|
|
if Cac.IsAbilityPicked( f59_arg0, f59_local0.squadLocation, f59_local0.memberIndex, f59_local0.classLocation, f59_local0.loadoutSlot, f59_local7, f59_local5 - 1, "specialistBonusStreaks" ) then
|
|
f59_arg3[#f59_arg3 + 1] = f59_local4
|
|
f59_arg1[#f59_arg1 + 1] = f59_local4
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectSpecialistAbilitiesFromChallengeItems( f60_arg0, f60_arg1, f60_arg2 )
|
|
f60_arg1.specialistAbilities = {}
|
|
for f60_local0 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do
|
|
local f60_local3 = f60_local0
|
|
local f60_local4, f60_local5 = SelectChallengeItemAbility( f60_arg0, Cac.Abilities.Settings.GrabBagCapacity, f60_arg2 )
|
|
if f60_local4 then
|
|
f60_arg1.specialistAbilities[#f60_arg1.specialistAbilities + 1] = f60_local4
|
|
end
|
|
end
|
|
f60_arg1.specialistBonusAbilities = {}
|
|
local f60_local0 = Cac.Abilities.Settings.SpecialistCapacity
|
|
for f60_local1 = 1, f60_local0, 1 do
|
|
local f60_local4 = f60_local1
|
|
local f60_local5, f60_local6 = SelectChallengeItemAbility( f60_arg0, f60_local0, f60_arg2 )
|
|
if f60_local5 then
|
|
f60_arg1.specialistBonusAbilities[#f60_arg1.specialistBonusAbilities + 1] = f60_local5
|
|
f60_local0 = f60_local6
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectKillstreaksFromChallengeItems( f61_arg0, f61_arg1, f61_arg2, f61_arg3 )
|
|
local f61_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
local f61_local1 = f0_local0.KillstreakTypes[f61_arg3].DataName
|
|
f61_arg2.killstreaks = {}
|
|
for f61_local2 = 1, 3, 1 do
|
|
local f61_local5 = f61_arg1[f61_local1][f61_local2]
|
|
if f61_local5 then
|
|
if f61_local5.weight <= 0 then
|
|
break
|
|
end
|
|
local f61_local6 = false
|
|
local f61_local7 = Cac.GetStreakCost( f61_local5.name )
|
|
for f61_local11, f61_local12 in pairs( f61_arg2.killstreaks ) do
|
|
if f61_local7 == Cac.GetStreakCost( f61_local12 ) then
|
|
f61_local6 = true
|
|
break
|
|
end
|
|
end
|
|
if not f61_local6 then
|
|
f61_arg2.killstreaks[#f61_arg2.killstreaks + 1] = f61_local5.name
|
|
end
|
|
end
|
|
end
|
|
local f61_local2 = 3 - #f61_arg2.killstreaks
|
|
assert( f61_local2 >= 0 )
|
|
for f61_local3 = 1, f61_local2, 1 do
|
|
local f61_local5 = f61_local3
|
|
for f61_local6 = 1, 3, 1 do
|
|
local f61_local10 = Cac.GetCacConfig( f61_arg0, f61_local0.squadLocation, f61_local0.memberIndex, f61_local0.loadoutLocation, f61_local0.loadoutSlot, f61_local1, f61_local6 - 1 )
|
|
local f61_local11 = Cac.GetStreakCost( f61_local10 )
|
|
local f61_local12 = false
|
|
for f61_local14 = 1, #f61_arg2.killstreaks, 1 do
|
|
if f61_local11 == Cac.GetStreakCost( f61_arg2.killstreaks[f61_local14] ) then
|
|
f61_local12 = true
|
|
break
|
|
end
|
|
end
|
|
if not f61_local12 then
|
|
f61_arg2.killstreaks[#f61_arg2.killstreaks + 1] = f61_local10
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function SelectExtraAttachment( f62_arg0, f62_arg1, f62_arg2, f62_arg3, f62_arg4, f62_arg5, f62_arg6, f62_arg7, f62_arg8 )
|
|
local f62_local0 = Cac.GetAttachments( f62_arg0, f62_arg5, f62_arg6, f62_arg7, f62_arg8, f62_arg2 )
|
|
for f62_local1 = #f62_local0, 1, -1 do
|
|
if f62_local0[f62_local1] == "none" or f62_local0[f62_local1] == "" then
|
|
table.remove( f62_local0, f62_local1 )
|
|
end
|
|
end
|
|
assert( #f62_local0 < (Cac.Indices.Weapons.Primary and f0_local0.WeaponSettings.Primary.MaxDefaultAttachments + 1 or f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments + 1) )
|
|
for f62_local10, f62_local11 in pairs( f0_local0.WeaponSettings.TypeLists ) do
|
|
for f62_local7, f62_local8 in pairs( f62_arg3[f62_local11] ) do
|
|
if f62_local8.name == f62_arg1 then
|
|
SelectAttachmentFromChallengeItems( f62_local8.attachments, f62_local0, true )
|
|
local f62_local5
|
|
if f62_arg2 == Cac.Indices.Weapons.Primary then
|
|
f62_local5 = "primaryWeapon"
|
|
if not f62_local5 then
|
|
|
|
else
|
|
local f62_local6
|
|
if f62_arg2 == Cac.Indices.Weapons.Primary then
|
|
f62_local6 = "primaryAttachments"
|
|
if not f62_local6 then
|
|
|
|
else
|
|
f62_arg4[f62_local5] = f62_arg1
|
|
f62_arg4[f62_local6] = f62_local0
|
|
return
|
|
end
|
|
end
|
|
f62_local6 = "secondaryAttachments"
|
|
end
|
|
end
|
|
f62_local5 = "secondaryWeapon"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function CreateAbilityListFromChallengeItems( f63_arg0, f63_arg1 )
|
|
local f63_local0 = {}
|
|
local f63_local1 = false
|
|
for f63_local10, f63_local11 in ipairs( f63_arg0.abilities ) do
|
|
if f63_local11.weight <= 0 and not f63_local1 then
|
|
for f63_local8, f63_local9 in pairs( f63_arg1 ) do
|
|
if not LUI.IsItemInArray( f63_local0, f63_local9 ) then
|
|
f63_local0[#f63_local0 + 1] = f63_local9
|
|
end
|
|
end
|
|
f63_local1 = true
|
|
end
|
|
if not LUI.IsItemInArray( f63_local0, f63_local11.name ) then
|
|
f63_local0[#f63_local0 + 1] = f63_local11.name
|
|
end
|
|
end
|
|
return f63_local0
|
|
end
|
|
|
|
function GetBestWeightForChallengeItemCategory( f64_arg0, f64_arg1 )
|
|
if f64_arg0[f64_arg1] and 0 < #f64_arg0[f64_arg1] then
|
|
return f64_arg0[f64_arg1][1].weight
|
|
else
|
|
return 0
|
|
end
|
|
end
|
|
|
|
function GetTotalBestWeightsForChallengeItems( f65_arg0 )
|
|
local f65_local0 = 0
|
|
for f65_local4, f65_local5 in pairs( f0_local0.ChallengeItemsLists ) do
|
|
f65_local0 = f65_local0 + GetBestWeightForChallengeItemCategory( f65_arg0, f65_local5 )
|
|
end
|
|
return f65_local0
|
|
end
|
|
|
|
function BuildLoadoutFromChallengeItems( f66_arg0, f66_arg1, f66_arg2 )
|
|
local f66_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
local f66_local1 = {}
|
|
local f66_local2 = {}
|
|
StoreOldAbilities( f66_arg0, f66_local1, f66_local2, {}, f66_arg1 )
|
|
local f66_local3 = CreateAbilityListFromChallengeItems( f66_arg1, f66_local1 )
|
|
local f66_local4 = {}
|
|
SelectWeaponsFromChallengeItems( f66_arg1, f66_local4, false, false )
|
|
local f66_local5 = SelectChallengeItem( f66_arg1.primaryGrenades )
|
|
if f66_local5 then
|
|
f66_local4.primaryGrenade = f66_local5.name
|
|
end
|
|
local f66_local6 = SelectChallengeItem( f66_arg1.secondaryGrenades )
|
|
if f66_local6 then
|
|
f66_local4.secondaryGrenade = f66_local6.name
|
|
end
|
|
Cac.ResetAbilities( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, "abilitiesPicked", false )
|
|
ApplyLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, f66_local4 )
|
|
f66_local4 = {}
|
|
for f66_local7 = #f66_local3, 1, -1 do
|
|
local f66_local10 = f66_local3[f66_local7]
|
|
if not CheckAbilityRules( f66_arg0, f66_local10, f66_arg2, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot ) then
|
|
RemoveChallengeItemAbility( f66_local10, f66_local3, f66_arg1 )
|
|
end
|
|
end
|
|
f66_local4.abilities = {}
|
|
local f66_local7 = Cac.CalculateAbilityCapacity( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot )
|
|
for f66_local8 = 1, f66_local7, 1 do
|
|
local f66_local10 = f66_local8
|
|
local f66_local12, f66_local13 = SelectChallengeItemAbility( f66_local3, f66_local7, f66_arg1 )
|
|
if f66_local12 then
|
|
f66_local4.abilities[#f66_local4.abilities + 1] = f66_local12
|
|
f66_local7 = f66_local13
|
|
end
|
|
end
|
|
for f66_local10, f66_local12 in pairs( Cac.Abilities.BlockedSpecialist ) do
|
|
for f66_local13 = 1, #f66_local3, 1 do
|
|
local f66_local14 = f66_local3[f66_local13]
|
|
if f66_local12 == f66_local14 then
|
|
RemoveChallengeItemAbility( f66_local14, f66_local3, f66_arg1 )
|
|
end
|
|
end
|
|
end
|
|
f66_local8 = SelectKillstreakTypeFromChallengeItems( f66_arg1 )
|
|
if f66_local8 then
|
|
f66_local4.killstreakType = f66_local8
|
|
if f66_local4.killstreakType == "streaktype_specialist" then
|
|
SelectSpecialistAbilitiesFromChallengeItems( f66_local3, f66_local4, f66_arg1 )
|
|
else
|
|
SelectKillstreaksFromChallengeItems( f66_arg0, f66_arg1, f66_local4, f66_local8 )
|
|
end
|
|
end
|
|
if f66_local8 ~= "streaktype_specialist" then
|
|
f66_local4.specialistAbilities = {}
|
|
for f66_local9 = 1, #f66_local2, 1 do
|
|
local f66_local13 = f66_local2[f66_local9]
|
|
if not LUI.IsItemInArray( f66_local4.abilities, f66_local13 ) then
|
|
f66_local4.specialistAbilities[#f66_local4.specialistAbilities + 1] = f66_local13
|
|
end
|
|
end
|
|
f66_local4.specialistBonusAbilities = {}
|
|
f66_local9 = Cac.Abilities.Settings.SpecialistCapacity
|
|
for f66_local11 = 1, f66_local9, 1 do
|
|
local f66_local13 = f66_local11
|
|
local f66_local15, f66_local16 = SelectChallengeItemAbility( f66_local3, f66_local9, f66_arg1 )
|
|
if f66_local15 and not LUI.IsItemInArray( f66_local4.abilities, curAbility ) then
|
|
f66_local4.specialistBonusAbilities[#f66_local4.specialistBonusAbilities + 1] = f66_local15
|
|
f66_local9 = f66_local16
|
|
end
|
|
end
|
|
end
|
|
ApplyLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, f66_local4 )
|
|
f66_local4 = {}
|
|
if Cac.IsAbilityInUseForLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, "specialty_twoprimaries" ) then
|
|
f66_local4 = {}
|
|
assert( #f66_arg1.primaryWeapons >= 3 )
|
|
f66_local11 = Cac.GetWeapon( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, Cac.Indices.Weapons.Primary )
|
|
assert( Cac.GetWeapon( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ~= f0_local0.WeaponSettings.Secondary.DefaultWeapon, "Somehow attempted to use the two-primaries perk without already using a secondary weapon. AbilityRules should stop this." )
|
|
f66_local10 = SelectChallengeItem( f66_arg1.primaryWeapons, true, {
|
|
f66_local11
|
|
} )
|
|
if f66_local10 then
|
|
f66_local4.secondaryWeapon = f66_local10.name
|
|
f66_local4.secondaryAttachments = {}
|
|
SelectWeaponAttachmentsFromChallengeItems( f66_local10, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, f66_local4.secondaryAttachments )
|
|
end
|
|
ApplyLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, f66_local4 )
|
|
end
|
|
if Cac.IsAbilityInUseForLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, "specialty_extra_attachment" ) then
|
|
f66_local4 = {}
|
|
SelectExtraAttachment( f66_arg0, Cac.GetWeapon( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, Cac.Indices.Weapons.Primary ), Cac.Indices.Weapons.Primary, f66_arg1, f66_local4, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot )
|
|
SelectExtraAttachment( f66_arg0, Cac.GetWeapon( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ), Cac.Indices.Weapons.Secondary, f66_arg1, f66_local4, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot )
|
|
ApplyLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, f66_local4 )
|
|
end
|
|
end
|
|
|
|
function BuildLoadout_TrackedOps( f67_arg0 )
|
|
local f67_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
local f67_local1 = CacheUnlockedItems( f67_arg0 )
|
|
local f67_local2 = {}
|
|
for f67_local3 = 1, MaxTrackedOperations, 1 do
|
|
f67_local2[#f67_local2 + 1] = GetTrackedOp( f67_arg0, f67_local3 - 1 )
|
|
end
|
|
local f67_local3 = ProcessItemsForChallengeList( f67_arg0, f67_local2, f67_local1 )
|
|
if GetTotalBestWeightsForChallengeItems( f67_local3 ) == 0 then
|
|
LUI.FlowManager.RequestPopupMenu( self, "generic_confirmation_popup", true, f67_arg0, false, {
|
|
popup_title = Engine.Localize( "MENU_NOTICE" ),
|
|
message_text = Engine.Localize( "LUA_MENU_MP_LB_NO_TRACKED_OPS" ),
|
|
button_text = Engine.Localize( "MENU_OK" )
|
|
} )
|
|
return
|
|
else
|
|
BuildLoadoutFromChallengeItems( f67_arg0, f67_local3, f67_local1 )
|
|
end
|
|
end
|
|
|
|
function BuildLoadout_MostOps( f68_arg0 )
|
|
local f68_local0 = CacheUnlockedItems( f68_arg0 )
|
|
BuildLoadoutFromChallengeItems( f68_arg0, ProcessItemsForAllChallenges( f68_arg0, f68_local0 ), f68_local0 )
|
|
end
|
|
|
|
function BuildLoadout_ProgressedOps( f69_arg0 )
|
|
local f69_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
local f69_local1 = CacheUnlockedItems( f69_arg0 )
|
|
local f69_local2 = {}
|
|
for f69_local3 = 1, 1000, 1 do
|
|
local f69_local6 = Engine.TableLookupByRow( AllChallengesTable.File, f69_local3, AllChallengesTable.Cols.Ref )
|
|
if f69_local6 then
|
|
if f69_local6 == "" then
|
|
break
|
|
end
|
|
local f69_local7 = getTierForActiveOperation( f69_arg0, f69_local6 )
|
|
if tonumber( f69_local7 ) ~= 0 then
|
|
f69_local2[#f69_local2 + 1] = {
|
|
challenge = f69_local6,
|
|
progress = operationGetProgress( f69_arg0, f69_local6 ) / tonumber( operationGetTargetForTier( f69_local6, f69_local7 ) )
|
|
}
|
|
end
|
|
end
|
|
end
|
|
table.sort( f69_local2, function ( f70_arg0, f70_arg1 )
|
|
return f70_arg1.progress < f70_arg0.progress
|
|
end )
|
|
local f69_local4 = {}
|
|
for f69_local7, f69_local9 in pairs( f69_local2 ) do
|
|
if f69_local9.progress >= 0.5 then
|
|
if #f69_local4 > 50 then
|
|
break
|
|
end
|
|
f69_local4[#f69_local4 + 1] = f69_local9.challenge
|
|
end
|
|
end
|
|
if #f69_local4 == 0 then
|
|
LUI.FlowManager.RequestPopupMenu( self, "generic_confirmation_popup", true, f69_arg0, false, {
|
|
popup_title = Engine.Localize( "MENU_NOTICE" ),
|
|
message_text = Engine.Localize( "LUA_MENU_MP_LB_NO_OP_PROGRESS" ),
|
|
button_text = Engine.Localize( "MENU_OK" )
|
|
} )
|
|
return
|
|
else
|
|
BuildLoadoutFromChallengeItems( f69_arg0, ProcessItemsForChallengeList( f69_arg0, f69_local4, f69_local1 ), f69_local1 )
|
|
end
|
|
end
|
|
|
|
function BuildLoadout_Random( f71_arg0 )
|
|
local f71_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
local f71_local1 = CacheUnlockedItems( f71_arg0 )
|
|
local f71_local2 = {}
|
|
for f71_local6, f71_local7 in pairs( f71_local1.abilities ) do
|
|
f71_local2[f71_local6] = f71_local7
|
|
end
|
|
f71_local3 = {}
|
|
assert( #f71_local1.primaryWeapons > 0 )
|
|
f71_local4 = math.random( 1, #f71_local1.primaryWeapons )
|
|
f71_local3.primaryWeapon = f71_local1.primaryWeapons[f71_local4].name
|
|
f71_local3.primaryAttachments = {}
|
|
SelectRandomAttachmentsForWeapon( f71_local1.primaryWeapons[f71_local4], f0_local0.WeaponSettings.Primary.MaxDefaultAttachments, f71_local3.primaryAttachments )
|
|
assert( #f71_local1.secondaryWeapons > 0 )
|
|
f71_local4 = math.random( 1, #f71_local1.secondaryWeapons )
|
|
f71_local3.secondaryWeapon = f71_local1.secondaryWeapons[f71_local4].name
|
|
f71_local3.secondaryAttachments = {}
|
|
SelectRandomAttachmentsForWeapon( f71_local1.secondaryWeapons[f71_local4], f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, f71_local3.secondaryAttachments )
|
|
f71_local5 = false
|
|
for f71_local9, f71_local10 in pairs( f71_local3.primaryAttachments ) do
|
|
if IsAttachmentAnUnderbarrelWeapon( f71_local10 ) then
|
|
f71_local5 = true
|
|
break
|
|
end
|
|
end
|
|
if not f71_local5 then
|
|
assert( #f71_local1.primaryGrenades > 0 )
|
|
f71_local3.primaryGrenade = f71_local1.primaryGrenades[math.random( 1, #f71_local1.primaryGrenades )]
|
|
else
|
|
f71_local3.primaryGrenade = f0_local0.WeaponSettings.PrimaryGrenade.DefaultWeapon
|
|
end
|
|
assert( #f71_local1.secondaryGrenades > 0 )
|
|
f71_local3.secondaryGrenade = f71_local1.secondaryGrenades[math.random( 1, #f71_local1.secondaryGrenades )]
|
|
Cac.ResetAbilities( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "abilitiesPicked", false )
|
|
ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 )
|
|
f71_local3 = {}
|
|
ApplyAbilityRulesToList( f71_arg0, f71_local2, f71_local1, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot )
|
|
assert( #f71_local2 > 0 )
|
|
f71_local6 = Cac.CalculateAbilityCapacity( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot )
|
|
f71_local7 = 0
|
|
for f71_local8 = 1, f71_local6, 1 do
|
|
local f71_local11 = f71_local8
|
|
if #f71_local2 <= 0 then
|
|
break
|
|
else
|
|
local f71_local12, f71_local13, f71_local14 = SelectRandomAbilityFromList( f71_local2, f71_local6 )
|
|
if f71_local12 and f71_local13 then
|
|
if not f71_local14 then
|
|
break
|
|
end
|
|
f71_local6 = f71_local6 - f71_local13
|
|
assert( f71_local6 >= 0 )
|
|
assert( f71_local7 <= Cac.CalculateAbilityCapacity( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot ) )
|
|
if not f71_local3.abilities then
|
|
f71_local3.abilities = {}
|
|
end
|
|
else
|
|
for f71_local11, f71_local12 in pairs( Cac.Abilities.BlockedSpecialist ) do
|
|
for f71_local13 = 1, #f71_local2, 1 do
|
|
if f71_local12 == f71_local2[f71_local13] then
|
|
table.remove( f71_local2, f71_local13 )
|
|
end
|
|
end
|
|
end
|
|
f71_local8 = {
|
|
"streaktype_assault",
|
|
"streaktype_support"
|
|
}
|
|
if f0_local0.MinPerksForSpecialst < #f71_local2 then
|
|
f71_local8[#f71_local8 + 1] = "streaktype_specialist"
|
|
end
|
|
f71_local3.killstreakType = f71_local8[math.random( 1, #f71_local8 )]
|
|
if f71_local3.killstreakType == "streaktype_specialist" then
|
|
f71_local3.specialistAbilities = {}
|
|
for f71_local9 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do
|
|
local f71_local13, f71_local14, f71_local15 = SelectRandomAbilityFromList( f71_local2, Cac.Abilities.Settings.GrabBagCapacity )
|
|
if f71_local13 then
|
|
if not f71_local14 then
|
|
break
|
|
end
|
|
f71_local3.specialistAbilities[f71_local9] = f71_local13
|
|
table.remove( f71_local2, f71_local15 )
|
|
end
|
|
end
|
|
f71_local3.specialistBonusAbilities = {}
|
|
f71_local9 = Cac.Abilities.Settings.SpecialistCapacity
|
|
for f71_local10 = 1, f71_local9, 1 do
|
|
local f71_local13 = f71_local10
|
|
local f71_local14, f71_local15, f71_local16 = SelectRandomAbilityFromList( f71_local2, f71_local9 )
|
|
if f71_local14 then
|
|
if not f71_local15 then
|
|
|
|
end
|
|
f71_local9 = f71_local9 - f71_local15
|
|
assert( f71_local9 >= 0 )
|
|
f71_local3.specialistBonusAbilities[#f71_local3.specialistBonusAbilities + 1] = f71_local14
|
|
table.remove( f71_local2, f71_local16 )
|
|
end
|
|
end
|
|
else
|
|
f71_local9 = f71_local1[f0_local0.KillstreakTypes[f71_local3.killstreakType].DataName]
|
|
f71_local3.killstreaks = {}
|
|
for f71_local10 = 1, 3, 1 do
|
|
local f71_local13 = f71_local10
|
|
f71_local3.killstreaks[#f71_local3.killstreaks + 1] = SelectRandomKillstreakFromList( f71_local9, f71_local3.killstreaks )
|
|
end
|
|
end
|
|
ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 )
|
|
if Cac.IsAbilityInUseForLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "specialty_twoprimaries" ) then
|
|
f71_local3 = {}
|
|
assert( #f71_local1.primaryWeapons >= 3 )
|
|
f71_local9 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Primary )
|
|
assert( Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ~= f0_local0.WeaponSettings.Secondary.DefaultWeapon, "Somehow attempted to use the two-primaries perk without already using a secondary weapon. AbilityRules should stop this." )
|
|
f71_local10 = SelectRandomUnlockedWeapon( f71_local1.primaryWeapons, {
|
|
f71_local9,
|
|
f0_local0.WeaponSettings.Primary.DefaultWeapon
|
|
} )
|
|
f71_local3.secondaryWeapon = f71_local10.name
|
|
f71_local3.secondaryAttachments = {}
|
|
SelectRandomAttachmentsForWeapon( f71_local10, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, f71_local3.secondaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames )
|
|
ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 )
|
|
end
|
|
if Cac.IsAbilityInUseForLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "specialty_extra_attachment" ) then
|
|
f71_local3 = {}
|
|
f71_local9 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Primary )
|
|
for f71_local13, f71_local14 in pairs( f71_local1.primaryWeapons ) do
|
|
if f71_local14.name == f71_local9 then
|
|
f71_local3.primaryWeapon = f71_local14.name
|
|
f71_local3.primaryAttachments = {}
|
|
SelectRandomAttachmentsForWeapon( f71_local14, f0_local0.WeaponSettings.Primary.MaxDefaultAttachments + 1, f71_local3.primaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames )
|
|
break
|
|
end
|
|
end
|
|
f71_local10 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Secondary )
|
|
for f71_local14, f71_local15 in pairs( {
|
|
f71_local1.primaryWeapons,
|
|
f71_local1.secondaryWeapons
|
|
} ) do
|
|
for f71_local17, f71_local18 in pairs( f71_local15 ) do
|
|
if f71_local18.name == f71_local10 then
|
|
f71_local3.secondaryWeapon = f71_local18.name
|
|
f71_local3.secondaryAttachments = {}
|
|
SelectRandomAttachmentsForWeapon( f71_local18, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments + 1, f71_local3.secondaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames )
|
|
end
|
|
end
|
|
end
|
|
ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 )
|
|
end
|
|
end
|
|
end
|
|
f71_local3.abilities[#f71_local3.abilities + 1] = f71_local12
|
|
table.remove( f71_local2, f71_local14 )
|
|
end
|
|
for f71_local11, f71_local12 in pairs( Cac.Abilities.BlockedSpecialist ) do
|
|
for f71_local13 = 1, #f71_local2, 1 do
|
|
if f71_local12 == f71_local2[f71_local13] then
|
|
table.remove( f71_local2, f71_local13 )
|
|
end
|
|
end
|
|
end
|
|
f71_local8 = {
|
|
"streaktype_assault",
|
|
"streaktype_support"
|
|
}
|
|
if f0_local0.MinPerksForSpecialst < #f71_local2 then
|
|
f71_local8[#f71_local8 + 1] = "streaktype_specialist"
|
|
end
|
|
f71_local3.killstreakType = f71_local8[math.random( 1, #f71_local8 )]
|
|
if f71_local3.killstreakType == "streaktype_specialist" then
|
|
f71_local3.specialistAbilities = {}
|
|
for f71_local9 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do
|
|
local f71_local13, f71_local14, f71_local15 = SelectRandomAbilityFromList( f71_local2, Cac.Abilities.Settings.GrabBagCapacity )
|
|
if f71_local13 then
|
|
if not f71_local14 then
|
|
break
|
|
end
|
|
f71_local3.specialistAbilities[f71_local9] = f71_local13
|
|
table.remove( f71_local2, f71_local15 )
|
|
end
|
|
end
|
|
f71_local3.specialistBonusAbilities = {}
|
|
f71_local9 = Cac.Abilities.Settings.SpecialistCapacity
|
|
for f71_local10 = 1, f71_local9, 1 do
|
|
local f71_local13 = f71_local10
|
|
local f71_local14, f71_local15, f71_local16 = SelectRandomAbilityFromList( f71_local2, f71_local9 )
|
|
if f71_local14 then
|
|
if not f71_local15 then
|
|
|
|
end
|
|
f71_local9 = f71_local9 - f71_local15
|
|
assert( f71_local9 >= 0 )
|
|
f71_local3.specialistBonusAbilities[#f71_local3.specialistBonusAbilities + 1] = f71_local14
|
|
table.remove( f71_local2, f71_local16 )
|
|
end
|
|
end
|
|
else
|
|
f71_local9 = f71_local1[f0_local0.KillstreakTypes[f71_local3.killstreakType].DataName]
|
|
f71_local3.killstreaks = {}
|
|
for f71_local10 = 1, 3, 1 do
|
|
local f71_local13 = f71_local10
|
|
f71_local3.killstreaks[#f71_local3.killstreaks + 1] = SelectRandomKillstreakFromList( f71_local9, f71_local3.killstreaks )
|
|
end
|
|
end
|
|
ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 )
|
|
if Cac.IsAbilityInUseForLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "specialty_twoprimaries" ) then
|
|
f71_local3 = {}
|
|
assert( #f71_local1.primaryWeapons >= 3 )
|
|
f71_local9 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Primary )
|
|
assert( Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ~= f0_local0.WeaponSettings.Secondary.DefaultWeapon, "Somehow attempted to use the two-primaries perk without already using a secondary weapon. AbilityRules should stop this." )
|
|
f71_local10 = SelectRandomUnlockedWeapon( f71_local1.primaryWeapons, {
|
|
f71_local9,
|
|
f0_local0.WeaponSettings.Primary.DefaultWeapon
|
|
} )
|
|
f71_local3.secondaryWeapon = f71_local10.name
|
|
f71_local3.secondaryAttachments = {}
|
|
SelectRandomAttachmentsForWeapon( f71_local10, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, f71_local3.secondaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames )
|
|
ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 )
|
|
end
|
|
if Cac.IsAbilityInUseForLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "specialty_extra_attachment" ) then
|
|
f71_local3 = {}
|
|
f71_local9 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Primary )
|
|
for f71_local13, f71_local14 in pairs( f71_local1.primaryWeapons ) do
|
|
if f71_local14.name == f71_local9 then
|
|
f71_local3.primaryWeapon = f71_local14.name
|
|
f71_local3.primaryAttachments = {}
|
|
SelectRandomAttachmentsForWeapon( f71_local14, f0_local0.WeaponSettings.Primary.MaxDefaultAttachments + 1, f71_local3.primaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames )
|
|
break
|
|
end
|
|
end
|
|
f71_local10 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Secondary )
|
|
for f71_local14, f71_local15 in pairs( {
|
|
f71_local1.primaryWeapons,
|
|
f71_local1.secondaryWeapons
|
|
} ) do
|
|
for f71_local17, f71_local18 in pairs( f71_local15 ) do
|
|
if f71_local18.name == f71_local10 then
|
|
f71_local3.secondaryWeapon = f71_local18.name
|
|
f71_local3.secondaryAttachments = {}
|
|
SelectRandomAttachmentsForWeapon( f71_local18, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments + 1, f71_local3.secondaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames )
|
|
end
|
|
end
|
|
end
|
|
ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 )
|
|
end
|
|
end
|
|
|
|
function ValidateLoadout( f72_arg0, f72_arg1, f72_arg2, f72_arg3, f72_arg4, f72_arg5 )
|
|
Cac.ValidateLoadoutItems( f72_arg0, f72_arg1, f72_arg2, f72_arg3 )
|
|
end
|
|
|
|
function ApplyLoadout( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_arg5 )
|
|
if f73_arg5.primaryWeapon then
|
|
Cac.SetWeapon( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Primary, f73_arg5.primaryWeapon )
|
|
if f73_arg5.primaryAttachments and #f73_arg5.primaryAttachments > 0 then
|
|
for f73_local3, f73_local4 in pairs( f73_arg5.primaryAttachments ) do
|
|
Cac.SetAttachment( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Primary, f73_local3 - 1, f73_local4 )
|
|
end
|
|
end
|
|
Cac.ValidateReticle( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Primary )
|
|
end
|
|
if f73_arg5.secondaryWeapon then
|
|
Cac.SetWeapon( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Secondary, f73_arg5.secondaryWeapon )
|
|
if f73_arg5.secondaryAttachments and #f73_arg5.secondaryAttachments > 0 then
|
|
for f73_local3, f73_local4 in pairs( f73_arg5.secondaryAttachments ) do
|
|
Cac.SetAttachment( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Secondary, f73_local3 - 1, f73_local4 )
|
|
end
|
|
end
|
|
end
|
|
if f73_arg5.primaryGrenade then
|
|
Cac.SetPerk( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Grenade.Primary, f73_arg5.primaryGrenade )
|
|
end
|
|
if f73_arg5.secondaryGrenade then
|
|
Cac.SetPerk( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Grenade.Secondary, f73_arg5.secondaryGrenade )
|
|
end
|
|
if f73_arg5.abilities then
|
|
Cac.ResetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistStreaks" )
|
|
Cac.ResetAbilities( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistBonusStreaks", false )
|
|
for f73_local3, f73_local4 in ipairs( f73_arg5.abilities ) do
|
|
local f73_local5, f73_local6 = Cac.GetPerkIndices( f73_local4 )
|
|
if not Cac.IsAbilityPicked( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local5 - 1, f73_local6 - 1, "abilitiesPicked" ) then
|
|
Cac.ToggleAbility( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local5 - 1, f73_local6 - 1, "abilitiesPicked", false, false, true )
|
|
end
|
|
end
|
|
end
|
|
if f73_arg5.specialistAbilities then
|
|
for f73_local0 = 1, #f73_arg5.specialistAbilities, 1 do
|
|
Cac.SetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistStreaks", f73_local0 - 1, f73_arg5.specialistAbilities[f73_local0] .. "_ks" )
|
|
end
|
|
Cac.UpdateSpecialistKillCounts( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4 )
|
|
end
|
|
if f73_arg5.specialistBonusAbilities then
|
|
Cac.ResetAbilities( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistBonusStreaks", false )
|
|
local f73_local0 = 0
|
|
for f73_local1 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do
|
|
local f73_local5 = Cac.GetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistStreaks", f73_local1 - 1 )
|
|
if f73_local5 and f73_local5 ~= "none" then
|
|
f73_local0 = f73_local0 + 1
|
|
end
|
|
end
|
|
if f73_local0 >= 2 then
|
|
for f73_local1 = 1, #f73_arg5.specialistBonusAbilities, 1 do
|
|
local f73_local6, f73_local7 = Cac.GetPerkIndices( f73_arg5.specialistBonusAbilities[f73_local1] )
|
|
assert( not Cac.IsAbilityPicked( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local6 - 1, f73_local7 - 1, "specialistBonusStreaks" ) )
|
|
Cac.ToggleAbility( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local6 - 1, f73_local7 - 1, "specialistBonusStreaks", false, true, true )
|
|
end
|
|
end
|
|
end
|
|
if f73_arg5.killstreakType then
|
|
Cac.SetPerk( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.StreakType, f73_arg5.killstreakType )
|
|
if f73_arg5.killstreakType ~= "streaktype_specialist" then
|
|
table.sort( f73_arg5.killstreaks, function ( f74_arg0, f74_arg1 )
|
|
local f74_local0
|
|
if f74_arg0 ~= "none" then
|
|
f74_local0 = tonumber( Cac.GetStreakCost( f74_arg0 ) )
|
|
if not f74_local0 then
|
|
|
|
else
|
|
local f74_local1
|
|
if f74_arg1 ~= "none" then
|
|
f74_local1 = tonumber( Cac.GetStreakCost( f74_arg1 ) )
|
|
if not f74_local1 then
|
|
|
|
else
|
|
return f74_local0 < f74_local1
|
|
end
|
|
end
|
|
f74_local1 = 1000
|
|
end
|
|
end
|
|
f74_local0 = 1000
|
|
end )
|
|
local f73_local1 = f0_local0.KillstreakTypes[f73_arg5.killstreakType].DataName
|
|
Cac.ResetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local1 )
|
|
for f73_local5, f73_local6 in ipairs( f73_arg5.killstreaks ) do
|
|
Cac.SetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local1, f73_local5 - 1, f73_local6 )
|
|
end
|
|
end
|
|
end
|
|
ValidateLoadout( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_arg5 )
|
|
end
|
|
|
|
local f0_local3 = {
|
|
TrackedOps = BuildLoadout_TrackedOps,
|
|
ProgressedOps = BuildLoadout_ProgressedOps,
|
|
MostOps = BuildLoadout_MostOps,
|
|
Random = BuildLoadout_Random
|
|
}
|
|
function BuildLoadoutAction( f75_arg0, f75_arg1 )
|
|
local f75_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
if f75_local0.currentType then
|
|
f0_local3[f75_local0.currentType]( f75_arg1.controller )
|
|
end
|
|
f75_arg0:dispatchEventToRoot( {
|
|
name = "update_cac_info_panel",
|
|
controller = f75_arg1.controller,
|
|
dispatchChildren = true,
|
|
classLocation = f75_local0.loadoutLocation,
|
|
attachConflict = false
|
|
} )
|
|
local f75_local1 = Cac.GetPerk( f75_arg1.controller, f75_local0.squadLocation, f75_local0.memberIndex, f75_local0.loadoutLocation, f75_local0.loadoutSlot, Cac.Indices.StreakType ) == "streaktype_specialist"
|
|
f75_arg0:dispatchEventToRoot( {
|
|
name = "refresh_abilities_recap",
|
|
controller = f75_arg1.controller,
|
|
specialistType = f75_local1,
|
|
selected = false,
|
|
immediate = true
|
|
} )
|
|
f75_arg0:dispatchEventToRoot( {
|
|
name = "refresh_specialist_abilities_recap",
|
|
controller = f75_arg1.controller,
|
|
specialistType = f75_local1,
|
|
selected = false,
|
|
immediate = true
|
|
} )
|
|
f75_arg0:dispatchEventToRoot( {
|
|
name = "cac_set_slot",
|
|
slot = f75_local0.loadoutSlot,
|
|
controller = f75_arg1.controller,
|
|
dispatchChildren = true,
|
|
classLocation = f75_local0.loadoutLocation,
|
|
immediate = true
|
|
} )
|
|
end
|
|
|
|
function popup_lb_button()
|
|
local f76_local0 = 5
|
|
local f76_local1 = 1
|
|
local f76_local2 = 20
|
|
local f76_local3 = 20
|
|
local f76_local4 = {
|
|
r = 1,
|
|
g = 1,
|
|
b = 1,
|
|
a = 0.3
|
|
}
|
|
return {
|
|
type = "UIButton",
|
|
id = "popup_lb_button_id",
|
|
properties = {},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
height = f0_local0.Layout.TypeButton.Height
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
id = "popup_lb_button_bg_fade_id",
|
|
states = {
|
|
default = CoD.ColorizeState( {
|
|
r = 1,
|
|
g = 1,
|
|
b = 1,
|
|
a = 0.08
|
|
}, {
|
|
material = RegisterMaterial( "box_white_gradient_top" ),
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = -f0_local0.Layout.TypeButton.Height * 0.4
|
|
} )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "popup_lb_button_bg_id",
|
|
states = {
|
|
default = {
|
|
material = RegisterMaterial( "white" ),
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = -f76_local1,
|
|
alpha = 0
|
|
},
|
|
focus = {
|
|
alpha = 0.8
|
|
},
|
|
focus_dim = {
|
|
alpha = 0.5
|
|
}
|
|
},
|
|
handlers = {
|
|
button_over = MBh.AnimateLoop( {
|
|
{
|
|
"focus",
|
|
0,
|
|
true,
|
|
true
|
|
},
|
|
{
|
|
"focus",
|
|
350,
|
|
true,
|
|
true
|
|
},
|
|
{
|
|
"focus_dim",
|
|
750,
|
|
true,
|
|
true
|
|
},
|
|
{
|
|
"focus",
|
|
750,
|
|
true,
|
|
true
|
|
}
|
|
} ),
|
|
button_up = MBh.AnimateToState( "default" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "popup_lb_button_corner_tick_id",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.white, {
|
|
material = RegisterMaterial( "widg_triangle" ),
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f76_local1,
|
|
width = 16,
|
|
top = f76_local1,
|
|
height = 16,
|
|
alpha = 0.5
|
|
} ),
|
|
focus = {
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
button_over = MBh.AnimateToState( "focus" ),
|
|
button_up = MBh.AnimateToState( "default" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "popup_lb_button_name_id",
|
|
properties = {
|
|
text = MBh.Property( "text" )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.primary_text_color, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f76_local2,
|
|
right = 0,
|
|
top = f76_local0,
|
|
bottom = f76_local0 + CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left
|
|
} ),
|
|
focus = CoD.ColorizeState( Colors.generic_button_text_focus_color, {} )
|
|
},
|
|
handlers = {
|
|
button_over = MBh.AnimateToState( "focus" ),
|
|
button_up = MBh.AnimateToState( "default" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIMarqueeText",
|
|
id = "popup_lb_button_desc_id",
|
|
properties = {
|
|
text = MBh.Property( "desc" ),
|
|
textStyle = CoD.TextStyle.None
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.secondary_text_color, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
left = f76_local3,
|
|
right = 0,
|
|
top = -f76_local0 - CoD.TextSettings.NormalFont.Height,
|
|
bottom = -f76_local0,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1
|
|
} )
|
|
},
|
|
handlers = {
|
|
button_over = function ( f77_arg0, f77_arg1 )
|
|
f77_arg0:SetColor( Colors.grey_14.r, Colors.grey_14.g, Colors.grey_14.b )
|
|
end
|
|
,
|
|
button_up = function ( f78_arg0, f78_arg1 )
|
|
f78_arg0:SetColor( Colors.secondary_text_color.r, Colors.secondary_text_color.g, Colors.secondary_text_color.b )
|
|
end
|
|
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "popup_lb_button_spacer_top_id",
|
|
states = {
|
|
default = CoD.ColorizeState( f76_local4, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = f76_local1
|
|
} ),
|
|
focus = CoD.ColorizeState( Colors.black, {} )
|
|
},
|
|
handlers = {
|
|
button_over = MBh.AnimateToState( "focus" ),
|
|
button_up = MBh.AnimateToState( "default" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "popup_lb_button_spacer_bottom_id",
|
|
states = {
|
|
default = CoD.ColorizeState( f76_local4, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = -f76_local1,
|
|
bottom = 0
|
|
} ),
|
|
focus = CoD.ColorizeState( Colors.black, {} )
|
|
},
|
|
handlers = {
|
|
button_over = MBh.AnimateToState( "focus" ),
|
|
button_up = MBh.AnimateToState( "default" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "popup_lb_button_spacer_left_id",
|
|
states = {
|
|
default = CoD.ColorizeState( f76_local4, {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = f76_local1,
|
|
top = f76_local1,
|
|
bottom = -f76_local1
|
|
} ),
|
|
focus = CoD.ColorizeState( Colors.black, {} )
|
|
},
|
|
handlers = {
|
|
button_over = MBh.AnimateToState( "focus" ),
|
|
button_up = MBh.AnimateToState( "default" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "popup_lb_button_spacer_right_id",
|
|
states = {
|
|
default = CoD.ColorizeState( f76_local4, {
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = -f76_local1,
|
|
right = 0,
|
|
top = f76_local1,
|
|
bottom = -f76_local1
|
|
} ),
|
|
focus = CoD.ColorizeState( Colors.black, {} )
|
|
},
|
|
handlers = {
|
|
button_over = MBh.AnimateToState( "focus" ),
|
|
button_up = MBh.AnimateToState( "default" )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function RequestBuildLoadout( f79_arg0, f79_arg1, f79_arg2 )
|
|
local f79_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
f79_local0.currentType = f79_arg1
|
|
LUI.FlowManager.RequestPopupMenu( self, "generic_yesno_popup", true, f79_arg0, f79_arg2, {
|
|
popup_title = Engine.Localize( "MENU_WARNING" ),
|
|
message_text = Engine.Localize( "LUA_MENU_MP_LB_OVERWRITE_WARNING" ),
|
|
yes_action = BuildLoadoutAction
|
|
} )
|
|
end
|
|
|
|
function LBTypeButtonAction( f80_arg0, f80_arg1 )
|
|
RequestBuildLoadout( f80_arg1.controller, f80_arg0.properties.loadoutBuilderType, true )
|
|
end
|
|
|
|
function GetLoadoutBuilderTypeList()
|
|
local f81_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName )
|
|
if f81_local0.squadLocation == "squadMembers" then
|
|
return {
|
|
f0_local0.TypeConfigs.TrackedOps,
|
|
f0_local0.TypeConfigs.ProgressedOps,
|
|
f0_local0.TypeConfigs.MostOps,
|
|
f0_local0.TypeConfigs.Random
|
|
}
|
|
else
|
|
return {
|
|
f0_local0.TypeConfigs.Random
|
|
}
|
|
end
|
|
end
|
|
|
|
function GetButtonPopupContentHeight()
|
|
return #GetLoadoutBuilderTypeList() * (f0_local0.Layout.TypeButton.Height + 5)
|
|
end
|
|
|
|
function LBTypeButtonChildrenFeeder( f83_arg0 )
|
|
local f83_local0 = f83_arg0.exclusiveController
|
|
local f83_local1 = {}
|
|
local f83_local2 = GetLoadoutBuilderTypeList()
|
|
for f83_local3 = 1, #f83_local2, 1 do
|
|
local f83_local6 = f83_local2[f83_local3]
|
|
f83_local1[#f83_local1 + 1] = {
|
|
type = "popup_lb_button",
|
|
id = f83_local6.name,
|
|
properties = {
|
|
text = f83_local6.text,
|
|
desc = f83_local6.desc,
|
|
loadoutBuilderType = f83_local6.type
|
|
},
|
|
handlers = {
|
|
button_action = LBTypeButtonAction
|
|
}
|
|
}
|
|
end
|
|
return f83_local1
|
|
end
|
|
|
|
function LBTypePopupChildrenFeeder( f84_arg0 )
|
|
local f84_local0 = f84_arg0.exclusiveController
|
|
local f84_local1 = {
|
|
[#f84_local1 + 1] = {
|
|
type = "UIVerticalList",
|
|
id = "ops_list",
|
|
focusable = true,
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
height = GetButtonPopupContentHeight( f84_arg0.squadLocation ),
|
|
spacing = 5
|
|
}
|
|
},
|
|
childrenFeeder = LBTypeButtonChildrenFeeder
|
|
}
|
|
}
|
|
return f84_local1
|
|
end
|
|
|
|
function popup_lb_type()
|
|
return {
|
|
type = "generic_selectionList_popup",
|
|
id = "popup_lb_type_id",
|
|
properties = {
|
|
popup_title = Engine.Localize( "LUA_MENU_MP_LB_TYPE_TITLE" ),
|
|
popup_width = 575,
|
|
popup_childfeeder = LBTypePopupChildrenFeeder
|
|
}
|
|
}
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "popup_lb_type", popup_lb_type )
|
|
LUI.MenuBuilder.registerDef( "popup_lb_button", popup_lb_button )
|
|
LockTable( _M )
|