iw6-lui/lui/mp_menus/aliens.dec.lua
2024-09-12 17:25:45 +02:00

1238 lines
37 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
DebugPrint( "Registering " .. _NAME )
function InitGameTypeToAliens()
MatchRules.SetData( "gametype", "aliens" )
MatchRules.LoadMatchRulesDataDefault()
end
function AliensRunConfig( f2_arg0 )
assert( Engine.IsAliensMode(), "Running Aliens Config when not in aliens mode\n" )
if Engine.IsAliensMode() then
Engine.Exec( MPConfig.default_aliens, f2_arg0 )
end
end
function IsChaosMode()
assert( not Engine.InFrontend() )
return Game.GetOmnvar( "ui_alien_chaos" )
end
function FixGameModeTextForChaos( f4_arg0 )
if Engine.IsAliensMode() and LUI.mp_menus.Aliens.IsChaosEnabled() then
f4_arg0 = Engine.Localize( "@ALIENS_CHAOS_MODE" )
end
return f4_arg0
end
AliensMemberListSpacing = 34
AlienPerks = {
File = "mp/alien/perks_tree.csv",
Cols = {
Idx = 0,
Ref = 1,
UnlockedAtRank = 2,
PointCost = 3,
Name = 4,
Desc = 5,
Icon = 6,
IsUpgrade = 7,
Category = 8,
TokenUpgradeName = 9
},
MaxPerks = 100
}
AlienNerfs = {
File = "mp/alien/prestige_nerf.csv",
Cols = {
Idx = 0,
Ref = 1,
UnlockedAtRank = 2,
Name = 3,
Desc = 4,
Icon = 5,
IsUpgrade = 6
},
MaxNerfs = 100,
AlienNerfSlots = 5
}
AlienAbilities = {
File = "mp/alien/dpad_tree.csv",
FileAlt = "mp/alien/dpad_tree_beacon.csv",
Cols = {
Idx = 0,
Ref = 1,
UnlockedAtRank = 2,
PointCost = 3,
CurrencyCost = 4,
Name = 5,
Desc = 6,
Icon = 7,
DpadIcon = 8,
IsUpgrade = 9,
Category = 10
},
MaxAbilities = 100,
Up = 0,
Down = 100,
Left = 200,
Right = 300,
Types = {
"munition",
"support",
"offense",
"defense"
}
}
AlienCraftingItems = {
File = "mp/alien/crafting_items.csv",
Cols = {
Idx = 0,
Ref = 1,
Name = 2,
Icon = 3
},
MaxItems = 100
}
AlienCraftingRecipes = {
File = "mp/alien/crafting_items.csv",
Cols = {
Idx = 0,
Ref = 1,
Slot1Material = 2,
Slot2Material = 3,
Slot3Material = 4,
Slot4Material = 5
},
MaxItems = 100
}
AlienRanks = {
File = "mp/alien/rankTable.csv",
Cols = {
Idx = 0,
Rank = 1,
MinXP = 2,
XPToNext = 3,
ShortRank = 4,
FullRank = 5,
Icon = 6,
MaxXP = 7,
WeaponUnlock = 8,
PerkUnlock = 9,
Challenge = 10,
Camo = 11,
Attachment = 12,
Level = 13,
DisplayLevel = 14,
FeatureUnlock = 15,
IngameRank = 16,
UnlockString = 17
},
MaxLevel = 29,
MaxPrestige = 25,
SuperMaxLevel = 30
}
AlienRankIcons = {
File = "mp/alien/rankIconTable.csv",
Cols = {
PrestigeItems = 0,
PrestigeValues = 1
},
Rows = {
MaxPrestige = "maxprestige",
PrestigeDiscount = "prestigediscount"
}
}
function GetDataLabelForSlot( f5_arg0 )
if f5_arg0 == AlienAbilities.Up then
return "munition"
elseif f5_arg0 == AlienAbilities.Down then
return "support"
elseif f5_arg0 == AlienAbilities.Left then
return "defense"
elseif f5_arg0 == AlienAbilities.Right then
return "offense"
else
assert( false, "Invalid Action Slot: Valid options are AlienAbilities.Up, AlienAbilities.Down, AlienAbilities.Left, AlienAbilities.Right" )
end
end
function GetDataLabelForPerk( f6_arg0 )
return "perk_" .. f6_arg0
end
function GetBasePerkList( f7_arg0 )
local f7_local0 = assert
local f7_local1
if f7_arg0 ~= 0 and f7_arg0 ~= 1 then
f7_local1 = false
else
f7_local1 = true
end
f7_local0( f7_local1, "Invalid Perk Slot" )
if f7_arg0 == 0 then
f7_local0 = 0
if not f7_local0 then
else
f7_local1 = f7_local0 + AlienPerks.MaxPerks - 1
local f7_local2 = {}
for f7_local3 = f7_local0, f7_local1, 1 do
local f7_local6 = Engine.TableLookup( AlienPerks.File, AlienPerks.Cols.Idx, tostring( f7_local3 ), AlienPerks.Cols.Ref )
if f7_local6 == "" then
break
elseif GetFieldForPerk( f7_local6, AlienPerks.Cols.IsUpgrade ) == "0" then
f7_local2[#f7_local2 + 1] = f7_local6
end
end
return f7_local2
end
end
f7_local0 = 100
end
function GetBaseNerfList()
local f8_local0 = 0
local f8_local1 = 50
local f8_local2 = {}
for f8_local3 = f8_local0, f8_local1, 1 do
local f8_local6 = Engine.TableLookup( AlienNerfs.File, AlienNerfs.Cols.Idx, tostring( f8_local3 ), AlienNerfs.Cols.Ref )
if f8_local6 == "" then
break
end
f8_local2[#f8_local2 + 1] = f8_local6
end
return f8_local2
end
function GetBaseAbilityListForActionSlot( f9_arg0 )
local f9_local0 = assert
local f9_local1
if f9_arg0 ~= AlienAbilities.Up and f9_arg0 ~= AlienAbilities.Down and f9_arg0 ~= AlienAbilities.Left and f9_arg0 ~= AlienAbilities.Right then
f9_local1 = false
else
f9_local1 = true
end
f9_local0( f9_local1, "Invalid Action Slot: Valid options are AlienAbilities.Up, AlienAbilities.Down, AlienAbilities.Left, AlienAbilities.Right" )
f9_local0 = {}
f9_local1 = f9_arg0
local f9_local2 = f9_arg0 + AlienAbilities.MaxAbilities - 1
local f9_local3 = Engine.GetDvarString( "ui_mapname" )
for f9_local4 = f9_local1, f9_local2, 1 do
local f9_local7 = ""
if f9_local3 == "mp_alien_beacon" or f9_local3 == "mp_alien_dlc3" or f9_local3 == "mp_alien_last" then
f9_local7 = Engine.TableLookup( AlienAbilities.FileAlt, AlienAbilities.Cols.Idx, tostring( f9_local4 ), AlienAbilities.Cols.Ref )
else
f9_local7 = Engine.TableLookup( AlienAbilities.File, AlienAbilities.Cols.Idx, tostring( f9_local4 ), AlienAbilities.Cols.Ref )
end
if f9_local7 == "" then
break
elseif GetFieldForAbility( f9_local7, AlienAbilities.Cols.IsUpgrade ) == "0" then
f9_local0[#f9_local0 + 1] = f9_local7
end
end
return f9_local0
end
function GetFieldForPerk( f10_arg0, f10_arg1 )
local f10_local0 = assert
local f10_local1
if f10_arg1 < AlienPerks.Cols.Idx or f10_arg1 > AlienPerks.Cols.TokenUpgradeName then
f10_local1 = false
else
f10_local1 = true
end
f10_local0( f10_local1, "Invalid field_ref in GetFieldForPerk( perk_ref, field_ref )" )
return Engine.TableLookup( AlienPerks.File, AlienPerks.Cols.Ref, f10_arg0, f10_arg1 )
end
function GetFieldForNerf( f11_arg0, f11_arg1 )
local f11_local0 = assert
local f11_local1
if f11_arg1 < AlienNerfs.Cols.Idx or f11_arg1 > AlienNerfs.Cols.IsUpgrade then
f11_local1 = false
else
f11_local1 = true
end
f11_local0( f11_local1, "Invalid field_ref in GetFieldForNerf( nerf_ref, field_ref )" )
return Engine.TableLookup( AlienNerfs.File, AlienNerfs.Cols.Ref, f11_arg0, f11_arg1 )
end
function GetFieldForNerfFromIndex( f12_arg0, f12_arg1 )
local f12_local0 = assert
local f12_local1
if f12_arg1 < AlienNerfs.Cols.Idx or f12_arg1 > AlienNerfs.Cols.IsUpgrade then
f12_local1 = false
else
f12_local1 = true
end
f12_local0( f12_local1, "Invalid field_ref in GetFieldForNerf( nerf_ref, field_ref )" )
return Engine.TableLookup( AlienNerfs.File, AlienNerfs.Cols.Idx, f12_arg0, f12_arg1 )
end
function GetFieldForAbility( f13_arg0, f13_arg1 )
local f13_local0 = assert
local f13_local1
if f13_arg1 < AlienAbilities.Cols.Idx or f13_arg1 > AlienAbilities.Cols.Category then
f13_local1 = false
else
f13_local1 = true
end
f13_local0( f13_local1, "Invalid field_ref in GetFieldForAbility( ability_ref, field_ref )" )
f13_local0 = Engine.GetDvarString( "ui_mapname" )
if f13_local0 == "mp_alien_beacon" or f13_local0 == "mp_alien_dlc3" or f13_local0 == "mp_alien_last" then
return Engine.TableLookup( AlienAbilities.FileAlt, AlienAbilities.Cols.Ref, f13_arg0, f13_arg1 )
else
return Engine.TableLookup( AlienAbilities.File, AlienAbilities.Cols.Ref, f13_arg0, f13_arg1 )
end
end
function GetFieldForCraftingItemFromIndex( f14_arg0, f14_arg1 )
return Engine.TableLookup( AlienCraftingItems.File, AlienCraftingItems.Cols.Idx, f14_arg0, f14_arg1 )
end
function GetPerkRefFromBaseAndLevel( f15_arg0, f15_arg1 )
local f15_local0 = f15_arg0
local f15_local1
if 0 < f15_arg1 then
f15_local1 = "_" .. f15_arg1
if not f15_local1 then
else
return f15_local0 .. f15_local1
end
end
f15_local1 = ""
end
function GetAbilityRefFromBaseAndLevel( f16_arg0, f16_arg1 )
local f16_local0 = f16_arg0
local f16_local1
if 0 < f16_arg1 then
f16_local1 = "_" .. f16_arg1
if not f16_local1 then
else
return f16_local0 .. f16_local1
end
end
f16_local1 = ""
end
function SetRelicEnabled( f17_arg0, f17_arg1, f17_arg2 )
Engine.AliensSetIsRelicEnabled( f17_arg0, f17_arg1, f17_arg2 )
if f17_arg1 == "nerf_no_class" then
if f17_arg2 then
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "perks", 0, "perk_none" )
else
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "perks", 0, "perk_bullet_damage" )
end
setDefaultSecondaryClass( f17_arg0 )
end
if f17_arg1 == "nerf_no_abilities" then
if f17_arg2 then
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "defense", "dpad_placeholder_def_1" )
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "offense", "dpad_placeholder_off_1" )
else
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "defense", "dpad_minigun_turret" )
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "offense", "dpad_ims" )
end
end
if f17_arg1 == "nerf_no_deployables" then
if f17_arg2 then
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "munition", "dpad_placeholder_ammo_1" )
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "support", "dpad_placeholder_sup_1" )
else
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "munition", "dpad_team_ammo_reg" )
Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "support", "dpad_team_explosives" )
end
end
end
function GetAlienPerk( f18_arg0, f18_arg1 )
local f18_local0 = assert
local f18_local1
if f18_arg1 < 0 or f18_arg1 > 1 then
f18_local1 = false
else
f18_local1 = true
end
f18_local0( f18_local1, "Invalid Perk Slot" )
return Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "perks", f18_arg1 )
end
function SetAlienPerk( f19_arg0, f19_arg1, f19_arg2 )
local f19_local0 = assert
local f19_local1
if f19_arg1 < 0 or f19_arg1 > 1 then
f19_local1 = false
else
f19_local1 = true
end
f19_local0( f19_local1, "Invalid Perk Slot" )
if f19_arg1 == 0 and Engine.AliensCheckIsRelicEnabled( f19_arg0, "nerf_no_class" ) then
SetRelicEnabled( f19_arg0, "nerf_no_class", false )
setDefaultSecondaryClass( f19_arg0 )
end
return Engine.SetPlayerDataEx( f19_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "perks", f19_arg1, f19_arg2 )
end
function GetAlienPerkLevel( f20_arg0, f20_arg1 )
local f20_local0 = assert
local f20_local1
if f20_arg1 < 0 or f20_arg1 > 1 then
f20_local1 = false
else
f20_local1 = true
end
f20_local0( f20_local1, "Invalid Perk Slot" )
return Engine.GetPlayerDataEx( f20_arg0, CoD.StatsGroup.Coop, "alienSession", "perk_" .. f20_arg1 .. "_level" )
end
function ClearSecondaryClass( f21_arg0 )
SetSecondaryClass( f21_arg0, "perk_none" )
end
function setDefaultSecondaryClass( f22_arg0 )
if Engine.AliensCheckIsUpgradeEnabled( f22_arg0, "multi_class" ) then
local f22_local0 = GetAlienPerk( f22_arg0, 0 )
if f22_local0 == "perk_none" then
SetSecondaryClass( f22_arg0, "perk_none" )
elseif f22_local0 == "perk_bullet_damage" then
SetSecondaryClass( f22_arg0, "perk_health" )
else
SetSecondaryClass( f22_arg0, "perk_bullet_damage" )
end
else
SetSecondaryClass( f22_arg0, "perk_none" )
end
end
function SetSecondaryClass( f23_arg0, f23_arg1 )
DebugPrint( "Setting Secondary Class to " .. f23_arg1 )
Engine.SetPlayerDataReservedInt( f23_arg0, CoD.StatsGroup.Coop, "secondary_class", GetFieldForPerk( f23_arg1, AlienPerks.Cols.Idx ) )
end
function GetSecondaryClassRef( f24_arg0 )
return Engine.TableLookup( AlienPerks.File, AlienPerks.Cols.Idx, Engine.GetPlayerDataReservedInt( f24_arg0, CoD.StatsGroup.Coop, "secondary_class" ), AlienPerks.Cols.Ref )
end
function GetAlienSessionAbility( f25_arg0, f25_arg1 )
return GetAbilityRefFromBaseAndLevel( GetAlienAbility( f25_arg0, f25_arg1 ), GetAlienAbilityLevel( f25_arg0, f25_arg1 ) )
end
function GetAlienAbility( f26_arg0, f26_arg1 )
local f26_local0 = assert
local f26_local1
if f26_arg1 ~= "munition" and f26_arg1 ~= "support" and f26_arg1 ~= "offense" and f26_arg1 ~= "defense" then
f26_local1 = false
else
f26_local1 = true
end
f26_local0( f26_local1, "ability_type must be munition, support, offense, or, defense" )
return Engine.GetPlayerDataEx( f26_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", f26_arg1 )
end
function SetAlienAbility( f27_arg0, f27_arg1, f27_arg2 )
local f27_local0 = assert
local f27_local1
if f27_arg1 ~= "munition" and f27_arg1 ~= "support" and f27_arg1 ~= "offense" and f27_arg1 ~= "defense" then
f27_local1 = false
else
f27_local1 = true
end
f27_local0( f27_local1, "ability_type must be munition, support, offense, or, defense" )
if (f27_arg1 == "offense" or f27_arg1 == "defense") and Engine.AliensCheckIsRelicEnabled( f27_arg0, "nerf_no_abilities" ) then
SetRelicEnabled( f27_arg0, "nerf_no_abilities", false )
end
if (f27_arg1 == "munition" or f27_arg1 == "support") and Engine.AliensCheckIsRelicEnabled( f27_arg0, "nerf_no_deployables" ) then
SetRelicEnabled( f27_arg0, "nerf_no_deployables", false )
end
if f27_arg1 == "munition" and f27_arg2 ~= "dpad_placeholder_ammo_2" and Engine.AliensCheckIsUpgradeEnabled( f27_arg0, "combined_ammo_upgrade" ) then
LUI.mp_menus.AliensPurchasables.AliensSetIsUpgradeEnabledWrapper( f27_arg0, "combined_ammo_upgrade", false )
end
Engine.SetPlayerDataEx( f27_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", f27_arg1, f27_arg2 )
end
function GetAlienAbilityLevel( f28_arg0, f28_arg1 )
local f28_local0 = assert
local f28_local1
if f28_arg1 ~= "munition" and f28_arg1 ~= "support" and f28_arg1 ~= "offense" and f28_arg1 ~= "defense" then
f28_local1 = false
else
f28_local1 = true
end
f28_local0( f28_local1, "ability_type must be munition, support, offense, or, defense" )
return Engine.GetPlayerDataEx( f28_arg0, CoD.StatsGroup.Coop, "alienSession", f28_arg1 .. "_level" )
end
function GetAliensRankMaxXP( f29_arg0 )
return tonumber( Engine.TableLookup( AlienRanks.File, AlienRanks.Cols.Idx, f29_arg0, AlienRanks.Cols.MaxXP ) )
end
function GetAliensMaxRank()
return tonumber( Engine.TableLookup( AlienRanks.File, 0, "maxrank", 1 ) )
end
function getAliensNextRank( f31_arg0, f31_arg1 )
if AlienRanks.SuperMaxLevel <= f31_arg0 or f31_arg0 == AlienRanks.MaxLevel and AlienRanks.MaxPrestige <= f31_arg1 then
return AlienRanks.SuperMaxLevel
elseif f31_arg0 == AlienRanks.MaxLevel then
return 0
else
return f31_arg0 + 1
end
end
function getAliensRankData( f32_arg0 )
local f32_local0 = getAliensExperience( f32_arg0 )
local f32_local1 = Lobby.GetAlienRankForXP( f32_local0 )
local f32_local2 = getAliensPrestigeLevel( f32_arg0 )
local f32_local3
if f32_local1 < AlienRanks.SuperMaxLevel or f32_local2 < AlienRanks.MaxPrestige then
f32_local3 = false
else
f32_local3 = true
end
local f32_local4 = getAliensNextRank( f32_local1, f32_local2 )
local f32_local5 = f32_local0 - Engine.TableLookup( AlienRanks.File, AlienRanks.Cols.Idx, f32_local1, AlienRanks.Cols.MinXP )
local f32_local6 = Engine.TableLookup( AlienRanks.File, AlienRanks.Cols.Idx, f32_local1, AlienRanks.Cols.XPToNext )
local f32_local7
if f32_local3 then
f32_local7 = 1
if not f32_local7 then
else
local f32_local8 = Rank.GetRankDisplay( f32_local1, CoD.PlayMode.Aliens )
local f32_local9 = Rank.GetRankDisplay( f32_local4, CoD.PlayMode.Aliens )
local f32_local10
if f32_local2 >= AlienRanks.MaxPrestige or f32_local1 ~= AlienRanks.MaxLevel then
f32_local10 = false
else
f32_local10 = true
end
local f32_local11 = RegisterMaterial( Rank.GetRankIcon( f32_local1, f32_local2, Engine.GetCurrentCoDPlayMode() ) )
local f32_local12 = RegisterMaterial
local f32_local13 = Rank.GetRankIcon
local f32_local14 = f32_local4
local f32_local15
if f32_local10 then
f32_local15 = f32_local2 + 1
if not f32_local15 then
else
return f32_local8, f32_local11, f32_local9, f32_local12( f32_local13( f32_local14, f32_local15, Engine.GetCurrentCoDPlayMode() ) ), f32_local7, f32_local3
end
end
f32_local15 = f32_local2
end
end
f32_local7 = f32_local5 / f32_local6
end
function getAliensRank( f33_arg0 )
return Engine.GetPlayerDataEx( f33_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "rank" )
end
function getAliensCareerWeaponKills( f34_arg0 )
return Engine.GetPlayerDataEx( f34_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "kills" )
end
function getAliensCareerEscapes( f35_arg0 )
return Engine.GetPlayerDataEx( f35_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "escaped" )
end
function getAliensCareerRevives( f36_arg0 )
return Engine.GetPlayerDataEx( f36_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "revives" )
end
function getAliensExperience( f37_arg0 )
return Engine.GetPlayerDataEx( f37_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "experience" )
end
function getAliensPrestigeLevel( f38_arg0 )
return Engine.GetPlayerDataEx( f38_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "prestige" )
end
function getAliensDiscount()
return 1 - 0.01 * Engine.TableLookup( AlienRankIcons.File, AlienRankIcons.Cols.PrestigeItems, AlienRankIcons.Rows.PrestigeDiscount, AlienRankIcons.Cols.PrestigeValues )
end
function getAliensHasPlayerPrestiged( f40_arg0 )
if Engine.GetPlayerDataEx( f40_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "prestige" ) >= 1 then
return true
else
return false
end
end
function getAliensPrestigeLevel( f41_arg0 )
return Engine.GetPlayerDataEx( f41_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "prestige" )
end
function getNumEnabledNerfs( f42_arg0 )
local f42_local0 = 0
for f42_local4, f42_local5 in ipairs( GetBaseNerfList() ) do
if Engine.AliensCheckIsRelicEnabled( f42_arg0, f42_local5 ) then
f42_local0 = f42_local0 + 1
end
end
return f42_local0
end
function syncEggXP()
for f43_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do
if Engine.HasActiveLocalClient( f43_local0 ) then
local f43_local3 = Engine.GetPlayerDataReservedInt( f43_local0, CoD.StatsGroup.Ranked, "dlcEggStatus" )
if f43_local3 then
Engine.SetPlayerDataReservedInt( f43_local0, CoD.StatsGroup.Coop, "eggstra_state_flags", f43_local3 )
end
end
end
end
function GetSessionXP( f44_arg0 )
return Engine.GetPlayerDataEx( f44_arg0, CoD.StatsGroup.Coop, "alienSession", "experience" )
end
function GetSessionTokens( f45_arg0 )
return Engine.GetPlayerDataEx( f45_arg0, CoD.StatsGroup.Coop, "alienSession", "shots" )
end
function GetPlayerCash( f46_arg0 )
local f46_local0 = assert
local f46_local1
if f46_arg0 < 0 or f46_arg0 >= 4 then
f46_local1 = false
else
f46_local1 = true
end
f46_local0( f46_local1, "Invalid player num" )
return Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "EoGPlayer" .. f46_arg0, "currency" )
end
function GetAbilityFromClient( f47_arg0, f47_arg1 )
local f47_local0 = assert
local f47_local1
if f47_arg0 < 0 or f47_arg0 >= 4 then
f47_local1 = false
else
f47_local1 = true
end
f47_local0( f47_local1, "Invalid player num" )
f47_local0 = assert
if f47_arg1 ~= "munition" and f47_arg1 ~= "support" and f47_arg1 ~= "offense" and f47_arg1 ~= "defense" then
f47_local1 = false
else
f47_local1 = true
end
f47_local0( f47_local1, "ability_type must be munition, support, offense, or, defense" )
return Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "LoadoutPlayer" .. f47_arg0, f47_arg1 )
end
function GetPerkFromClient( f48_arg0, f48_arg1 )
local f48_local0 = assert
local f48_local1
if f48_arg0 < 0 or f48_arg0 >= 4 then
f48_local1 = false
else
f48_local1 = true
end
f48_local0( f48_local1, "Invalid player num" )
f48_local0 = assert
if f48_arg1 < 0 or f48_arg1 > 1 then
f48_local1 = false
else
f48_local1 = true
end
f48_local0( f48_local1, "Invalid Perk Slot" )
return Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "LoadoutPlayer" .. f48_arg0, "perks", f48_arg1 )
end
function GetEoGDataFromClient( f49_arg0, f49_arg1 )
local f49_local0 = assert
local f49_local1
if f49_arg0 < 0 or f49_arg0 >= 4 then
f49_local1 = false
else
f49_local1 = true
end
f49_local0( f49_local1, "Invalid player num" )
return Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "EoGPlayer" .. f49_arg0, f49_arg1 )
end
function GetGamerTagFromClient( f50_arg0 )
return GetEoGDataFromClient( f50_arg0, "name" )
end
function GetScoreFromClient( f51_arg0 )
return string.format( "%.0f", GetEoGDataFromClient( f51_arg0, "score" ) )
end
function GetKillsFromClient( f52_arg0 )
return GetEoGDataFromClient( f52_arg0, "kills" )
end
function GetAssistsFromClient( f53_arg0 )
return GetEoGDataFromClient( f53_arg0, "assists" )
end
function GetRevivesFromClient( f54_arg0 )
return GetEoGDataFromClient( f54_arg0, "revives" )
end
function GetDrillRestartsFromClient( f55_arg0 )
return GetEoGDataFromClient( f55_arg0, "drillrestarts" )
end
function GetDeathsFromClient( f56_arg0 )
return GetEoGDataFromClient( f56_arg0, "deaths" )
end
function GetDownsFromClient( f57_arg0 )
return GetEoGDataFromClient( f57_arg0, "downs" )
end
function ExtinctionHasMapSelection()
if Engine.GetDvarInt( "extinction_map_selection_enabled" ) == 1 and Engine.IsAliensMode() then
return true
elseif Engine.AnyoneHasAliensDLC() and Engine.IsAliensMode() then
return true
else
return false
end
end
function MapSelectionButton()
return {
type = "UIGenericButton",
id = "maps_button_id",
properties = {
button_text = Engine.Localize( "@MENU_CHOOSE_MAP_CAP" ),
button_action_func = function ( f60_arg0, f60_arg1 )
LUI.FlowManager.RequestAddMenu( f60_arg0, "mapsetup_menu_main", true, f60_arg1.controller, false, {
rotationAllowed = false
} )
end
,
desc_text = Engine.Localize( "@MENU_DESC_CHANGE_MAP" )
}
}
end
ExtinctionDifficluty = {
Regular = 0,
Easy = 1,
Hard = 2
}
function ExtinctionHasDifficultySelection()
if Engine.GetDvarInt( "extinction_hardcore_enabled" ) == 1 and Engine.IsAliensMode() then
return true
else
return false
end
end
function ExtinctionSetDifficlutyDvars( f62_arg0 )
if f62_arg0 == ExtinctionDifficluty.Easy then
Engine.ExecNow( "set scr_aliens_hardcore 0" )
Engine.ExecNow( "set scr_aliens_ricochet 0" )
Engine.ExecNow( "set scr_aliens_casual 1" )
elseif f62_arg0 == ExtinctionDifficluty.Hard then
Engine.ExecNow( "set scr_aliens_hardcore 1" )
Engine.ExecNow( "set scr_aliens_ricochet 1" )
Engine.ExecNow( "set scr_aliens_casual 0" )
else
Engine.ExecNow( "set scr_aliens_hardcore 0" )
Engine.ExecNow( "set scr_aliens_ricochet 0" )
Engine.ExecNow( "set scr_aliens_casual 0" )
end
if IsPrivateMatch() then
Lobby.SetExtinctionDifficulty( f62_arg0 )
end
end
function ExtinctionDetermineDifficulty()
local f63_local0 = ExtinctionDifficluty.Regular
if IsPrivateMatch() then
f63_local0 = Lobby.GetExtinctionDifficulty()
elseif Engine.GetDvarInt( "scr_aliens_hardcore" ) == 1 then
f63_local0 = ExtinctionDifficluty.Hard
elseif Engine.GetDvarInt( "scr_aliens_casual" ) == 1 then
f63_local0 = ExtinctionDifficluty.Easy
end
return f63_local0
end
function ExtinctionDifficultyDisplayText( f64_arg0 )
local f64_local0 = ""
if f64_arg0 == ExtinctionDifficluty.Easy then
f64_local0 = Engine.Localize( "LUA_MENU_MP_ALIENS_DIFF_CASUAL" )
elseif f64_arg0 == ExtinctionDifficluty.Hard then
f64_local0 = Engine.Localize( "LUA_MENU_MP_ALIENS_DIFF_HARD" )
else
f64_local0 = Engine.Localize( "LUA_MENU_MP_ALIENS_DIFF_NORMAL" )
end
return f64_local0
end
function extinctionDifficlutyFeeder( f65_arg0 )
local f65_local0 = {}
local f65_local1 = ExtinctionDetermineDifficulty()
local f65_local2 = {
[#f65_local2 + 1] = {
difficulty_val = ExtinctionDifficluty.Easy,
text = ExtinctionDifficultyDisplayText( ExtinctionDifficluty.Easy )
},
[#f65_local2 + 1] = {
difficulty_val = ExtinctionDifficluty.Regular,
text = ExtinctionDifficultyDisplayText( ExtinctionDifficluty.Regular )
},
[#f65_local2 + 1] = {
difficulty_val = ExtinctionDifficluty.Hard,
text = ExtinctionDifficultyDisplayText( ExtinctionDifficluty.Hard )
}
}
for f65_local3 = 1, #f65_local2, 1 do
local f65_local6 = f65_local3
f65_local0[#f65_local0 + 1] = {
type = "UIGenericButton",
listDefaultFocus = f65_local2[f65_local6].difficulty_val == f65_local1,
id = "difficulty_button_" .. f65_local6,
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = f65_local2[f65_local6].text,
button_action_func = function ( f66_arg0, f66_arg1 )
ExtinctionSetDifficlutyDvars( f65_local2[f65_local6].difficulty_val )
LUI.FlowManager.RequestLeaveMenu( f66_arg0, true )
if f65_local2[f65_local6].difficulty_val == ExtinctionDifficluty.Easy and IsOnlineMatch() then
LUI.FlowManager.RequestPopupMenu( f66_arg0, "extinction_casual_notice", true, f66_arg1.controller )
end
end
}
}
end
return f65_local0
end
function extinction_difficulty_menu()
return {
type = "generic_selectionList_popup",
id = "extinction_difficulty_menu_popup",
properties = {
popup_title = Engine.Localize( "@MENU_SELECT_DIFFICULTY" ),
popup_childfeeder = extinctionDifficlutyFeeder
}
}
end
function extinction_casual_notice()
return {
type = "generic_confirmation_popup",
id = "extinciont_casual_notice_id",
properties = {
popup_title = Engine.Localize( "@MENU_NOTICE" ),
message_text = Engine.Localize( "@PLATFORM_EXTINCTION_CASUAL_NOTICE" ),
button_text = Engine.Localize( "@MENU_OK" )
}
}
end
function getDifficultySetupButtonDescText( f69_arg0, f69_arg1 )
local f69_local0 = ""
if IsChaosEnabled() then
f69_local0 = Engine.Localize( "@ALIENS_CHAOS_DIFF_DESC" )
else
f69_local0 = Engine.Localize( "@LUA_MENU_MP_DIFFICULTY_DESC" )
end
return f69_local0
end
function DifficultySelectionButton()
local f70_local0 = {
type = "UIGenericButton",
id = "difficulty_button_id",
properties = {
button_text = Engine.Localize( "@LUA_MENU_MP_DIFFICULTY_CAPS" ),
button_action_func = function ( f71_arg0, f71_arg1 )
LUI.FlowManager.RequestPopupMenu( f71_arg0, "extinction_difficulty_menu", true, f71_arg1.controller )
end,
desc_text = getDifficultySetupButtonDescText
}
}
if not IsOnlineMatch() then
local f70_local1 = function ( f72_arg0, f72_arg1 )
local f72_local0 = IsChaosEnabled()
if f72_local0 and not f72_arg0.disabled then
f72_arg0:processEvent( {
name = "disable"
} )
elseif not f72_local0 and f72_arg0.disabled then
f72_arg0:processEvent( {
name = "enable"
} )
end
end
f70_local0.disabledFunc = function ()
return IsChaosEnabled()
end
f70_local0.properties.additional_handlers = {
update_chaos_enabled = f70_local1
}
end
return f70_local0
end
function ExtinctionHasModeSelection()
return true
end
function IsChaosEnabled()
local f75_local0 = false
if IsPrivateMatch() then
f75_local0 = Lobby.IsChaosEnabled()
else
f75_local0 = Engine.GetDvarInt( "scr_chaos_mode" ) == 1
end
return f75_local0
end
function SetEnableChaosMode( f76_arg0 )
if f76_arg0 then
if IsPrivateMatch() then
Lobby.SetChaosEnabled( true )
end
Engine.SetDvarInt( "scr_chaos_mode", 1 )
ExtinctionSetDifficlutyDvars( ExtinctionDifficluty.Regular )
else
if IsPrivateMatch() then
Lobby.SetChaosEnabled( false )
end
Engine.SetDvarInt( "scr_chaos_mode", 0 )
end
end
function extinctionModeFeeder( f77_arg0 )
local f77_local0 = {}
local f77_local1 = IsChaosEnabled()
f77_local0[#f77_local0 + 1] = {
type = "UIGenericButton",
listDefaultFocus = f77_local1 == false,
id = "mode_button_standard",
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Engine.Localize( "@MPUI_ALIENS" ),
button_action_func = function ( f78_arg0, f78_arg1 )
SetEnableChaosMode( false )
UpdateChaosEnabled( f78_arg0 )
LUI.FlowManager.RequestLeaveMenu( f78_arg0, true )
end
}
}
f77_local0[#f77_local0 + 1] = {
type = "UIGenericButton",
listDefaultFocus = f77_local1 == true,
id = "mode_button_chaos",
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Engine.Localize( "@ALIENS_CHAOS_MODE" ),
button_action_func = function ( f79_arg0, f79_arg1 )
SetEnableChaosMode( true )
UpdateChaosEnabled( f79_arg0 )
LUI.FlowManager.RequestLeaveMenu( f79_arg0, true )
end
}
}
return f77_local0
end
function extinction_mode_menu()
return {
type = "generic_selectionList_popup",
id = "extinction_mode_menu_popup",
properties = {
popup_title = Engine.Localize( "@ALIENS_SELECT_MODE" ),
popup_childfeeder = extinctionModeFeeder
}
}
end
function UpdateChaosEnabled( f81_arg0 )
f81_arg0:dispatchEventToRoot( {
name = "update_chaos_enabled",
immediate = true
} )
end
function ModeSelectionButton()
return {
type = "UIGenericButton",
id = "extinction_mode_button_id",
properties = {
button_text = Engine.Localize( "@MPUI_EVENT_PATCH_CATEGORY_NAME2" ),
button_action_func = function ( f83_arg0, f83_arg1 )
LUI.FlowManager.RequestPopupMenu( f83_arg0, "extinction_mode_menu", true, f83_arg1.controller )
end
,
desc_text = Engine.Localize( "@ALIENS_GAME_MODE_DESC" )
}
}
end
function GetNumIntelsForCurrentMap()
local f84_local0 = 0
local f84_local1 = Engine.GetDvarString( "ui_mapname" )
if f84_local1 == "mp_alien_armory" then
f84_local0 = 13
elseif f84_local1 == "mp_alien_beacon" then
f84_local0 = 9
elseif f84_local1 == "mp_alien_dlc3" then
f84_local0 = 6
elseif f84_local1 == "mp_alien_last" then
f84_local0 = 8
end
return f84_local0
end
function ExtinctionLobbyGetOutroVideo( f85_arg0 )
if not Engine.IsAliensMode() or IsChaosEnabled() then
return nil
elseif Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Coop, "alienSession", "escapedRank0" ) + Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Coop, "alienSession", "escapedRank1" ) + Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Coop, "alienSession", "escapedRank2" ) + Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Coop, "alienSession", "escapedRank3" ) > 0 then
local f85_local0 = Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Common, "round", "map" )
if f85_local0 == "mp_alien_armory" or f85_local0 == "mp_alien_beacon" or f85_local0 == "mp_alien_dlc3" or f85_local0 == "mp_alien_last" then
return f85_local0 .. "_outro"
end
end
return nil
end
function LobbyGetIntroVideo()
local f86_local0 = Engine.GetDvarString( "ui_mapname" )
if not IsChaosEnabled() and (f86_local0 == "mp_alien_armory" or f86_local0 == "mp_alien_beacon" or f86_local0 == "mp_alien_dlc3" or f86_local0 == "mp_alien_last") then
return f86_local0 .. "_intro"
else
return nil
end
end
function HasSeenVideo( f87_arg0, f87_arg1 )
if f87_arg1 == "mp_alien_armory_intro" then
return HasSeenIntroVideo( f87_arg0, 1 )
elseif f87_arg1 == "mp_alien_armory_outro" then
return HasSeenOutroVideo( f87_arg0, 1 )
elseif f87_arg1 == "mp_alien_beacon_intro" then
return HasSeenIntroVideo( f87_arg0, 2 )
elseif f87_arg1 == "mp_alien_beacon_outro" then
return HasSeenOutroVideo( f87_arg0, 2 )
elseif f87_arg1 == "mp_alien_dlc3_intro" then
return HasSeenIntroVideo( f87_arg0, 3 )
elseif f87_arg1 == "mp_alien_dlc3_outro" then
return HasSeenOutroVideo( f87_arg0, 3 )
elseif f87_arg1 == "mp_alien_last_intro" then
return HasSeenIntroVideo( f87_arg0, 4 )
elseif f87_arg1 == "mp_alien_last_outro" then
return HasSeenOutroVideo( f87_arg0, 4 )
else
return true
end
end
function SetHasSeenVideo( f88_arg0, f88_arg1 )
if f88_arg1 == "mp_alien_armory_intro" then
return SetHasSeenIntroVideo( f88_arg0, 1 )
elseif f88_arg1 == "mp_alien_armory_outro" then
return SetHasSeenOutroVideo( f88_arg0, 1 )
elseif f88_arg1 == "mp_alien_beacon_intro" then
return SetHasSeenIntroVideo( f88_arg0, 2 )
elseif f88_arg1 == "mp_alien_beacon_outro" then
return SetHasSeenOutroVideo( f88_arg0, 2 )
elseif f88_arg1 == "mp_alien_dlc3_intro" then
return SetHasSeenIntroVideo( f88_arg0, 3 )
elseif f88_arg1 == "mp_alien_dlc3_outro" then
return SetHasSeenOutroVideo( f88_arg0, 3 )
elseif f88_arg1 == "mp_alien_last_intro" then
return SetHasSeenIntroVideo( f88_arg0, 4 )
elseif f88_arg1 == "mp_alien_last_outro" then
return SetHasSeenOutroVideo( f88_arg0, 4 )
else
end
end
function AliensPlayVideo( f89_arg0, f89_arg1, f89_arg2 )
LUI.FlowManager.RequestPopupMenu( nil, "AliensVideoOverlay", true, f89_arg0, false, {
videoRef = f89_arg1,
endEvent = f89_arg2
} )
end
function HasSeenIntroVideo( f90_arg0, f90_arg1 )
return 1 == Engine.GetPlayerDataReservedInt( f90_arg0, CoD.StatsGroup.Coop, "has_seen_episode_" .. f90_arg1 .. "_intro" )
end
function HasSeenOutroVideo( f91_arg0, f91_arg1 )
return 1 == Engine.GetPlayerDataReservedInt( f91_arg0, CoD.StatsGroup.Coop, "has_seen_episode_" .. f91_arg1 .. "_outro" )
end
function SetHasSeenIntroVideo( f92_arg0, f92_arg1 )
Engine.SetPlayerDataReservedInt( f92_arg0, CoD.StatsGroup.Coop, "has_seen_episode_" .. f92_arg1 .. "_intro", 1 )
Engine.ExecNow( "uploadstats", f92_arg0 )
end
function SetHasSeenOutroVideo( f93_arg0, f93_arg1 )
Engine.SetPlayerDataReservedInt( f93_arg0, CoD.StatsGroup.Coop, "has_seen_episode_" .. f93_arg1 .. "_outro", 1 )
Engine.ExecNow( "uploadstats", f93_arg0 )
end
function IntroVideoUnlocked( f94_arg0, f94_arg1 )
return HasSeenIntroVideo( f94_arg0, f94_arg1 )
end
function OutroVideoUnlocked( f95_arg0, f95_arg1 )
return HasSeenOutroVideo( f95_arg0, f95_arg1 )
end
function CanAccessIntelMenu()
if Engine.GetDvarBool( "extinction_intel_enabled" ) and Engine.AnyoneHasAliensDLC() then
return true
elseif Engine.IsXbox360() and Engine.IsXenonDevTitle() then
return true
else
return false
end
end
function AliensVideoOverlay( f97_arg0, f97_arg1, f97_arg2 )
local f97_local0 = f97_arg1 or {}
local f97_local1 = f97_local0.videoRef or "mp_alien_armory_intro"
local f97_local2 = true
local f97_local3 = 4000
local f97_local4 = f97_local0.endEvent or nil
local self = LUI.UIImage.new()
self.id = "video_root_id"
self:registerAnimationState( "default", {
material = RegisterMaterial( "cinematic" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
} )
self:animateToState( "default" )
self:registerEventHandler( "exit_extinction_video", function ( element, event )
Engine.StopMenuVideo()
LUI.FlowManager.RequestLeaveMenu( element, true )
if f97_local4 then
if f97_local4.target then
f97_local4.target:processEvent( f97_local4 )
else
element:dispatchEventToRoot( f97_local4 )
end
end
end )
self:registerEventHandler( "check_exit_extinction_video", function ( element, event )
if Engine.IsVideoFinished() then
element:processEvent( {
name = "exit_extinction_video"
} )
end
end )
self:registerEventHandler( "menu_create", function ( element, event )
Engine.StopMusic( 200 )
Engine.PlayMenuVideo( f97_local1, 0, true )
local self = LUI.UITimer.new( 66, {
name = "check_exit_extinction_video"
}, nil, false, self, false )
self.id = "check_exit_timer_id"
element:addElement( self )
if f97_local2 == true then
local f100_local1 = LUI.UITimer.new( f97_local3, {
name = "allow_skip",
dispatchChildren = true
}, nil, true, self, false )
f100_local1.id = "add_skip_handler_id"
element:addElement( f100_local1 )
end
end )
local f97_local6 = LUI.UIButton.new()
f97_local6.id = "video_continue_button"
f97_local6.properties = {
allowSkip = false
}
f97_local6:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
} )
f97_local6:animateToState( "default", 0 )
f97_local6:registerEventHandler( "allow_skip", function ( element, event )
element.properties.allowSkip = true
end )
f97_local6:registerEventHandler( "button_action", function ( element, event )
if element.properties.allowSkip then
self:processEvent( {
name = "exit_extinction_video"
} )
end
end )
self:addElement( f97_local6 )
return self
end
function AliensVideoOverlayPop()
Engine.StopMenuVideo()
LUI.mp_menus.Aliens.SwapExtinctionMapMusic( LUI.mp_menus.Aliens.GetExtinctionMapMusic() )
end
function IsInLobby()
local f104_local0 = Engine.GetLuiRoot()
return LUI.FlowManager.IsInStack( f104_local0.flowManager, "menu_gamesetup_systemlink" ) or LUI.FlowManager.IsInStack( f104_local0.flowManager, "menu_xboxlive_privatelobby" ) or LUI.FlowManager.IsInStack( f104_local0.flowManager, "menu_xboxlive_lobby" ) or LUI.FlowManager.IsInStack( f104_local0.flowManager, "menu_gamesetup_splitscreen" )
end
function GetExtinctionMapMusic()
assert( Engine.IsAliensMode() )
local f105_local0 = CoD.Music.MainExtinctMusic
if LUI.mp_menus.Aliens.IsInLobby() then
local f105_local1 = Engine.GetDvarString( "ui_mapname" )
if f105_local1 ~= "mp_alien_town" then
if f105_local1 == "mp_alien_armory" then
f105_local0 = CoD.Music.MainExtinctMusic_DLC1
elseif f105_local1 == "mp_alien_beacon" then
f105_local0 = CoD.Music.MainExtinctMusic_DLC2
elseif f105_local1 == "mp_alien_dlc3" then
f105_local0 = CoD.Music.MainExtinctMusic_DLC3
else
f105_local0 = CoD.Music.MainExtinctMusic_DLC4
end
end
end
return f105_local0
end
function SwapExtinctionMapMusic( f106_arg0 )
assert( Engine.IsAliensMode() )
Engine.StopMusic( 200 )
Engine.PlayMusic( f106_arg0 )
end
LUI.MenuBuilder.registerType( "AliensVideoOverlay", AliensVideoOverlay )
LUI.FlowManager.RegisterStackPopBehaviour( "AliensVideoOverlay", AliensVideoOverlayPop )
LUI.MenuBuilder.registerDef( "extinction_difficulty_menu", extinction_difficulty_menu )
LUI.MenuBuilder.registerDef( "extinction_casual_notice", extinction_casual_notice )
LUI.MenuBuilder.registerDef( "extinction_mode_menu", extinction_mode_menu )
LockTable( _M )