148 lines
5.0 KiB
Lua
148 lines
5.0 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
ItemStatsTable = {
|
|
"deaths",
|
|
"headShots",
|
|
"hits",
|
|
"kills",
|
|
"shots"
|
|
}
|
|
PrestigeResetTable = {
|
|
File = "mp/PrestigeResetTable.csv",
|
|
MaxRows = 1000,
|
|
Cols = {
|
|
Index = 0,
|
|
Purchases = 1,
|
|
WeaponStats = 2,
|
|
PlayerStats = 3
|
|
}
|
|
}
|
|
function prestigeresetaction( f1_arg0, f1_arg1 )
|
|
if Engine.IsAliensMode() then
|
|
Lobby.ExecAliensPrestigeReset( f1_arg1.controller, LUI.mp_menus.Aliens.getAliensRank( f1_arg1.controller ) )
|
|
else
|
|
PlayerStatsReset( f1_arg1 )
|
|
SquadMemXPReset( f1_arg1 )
|
|
WeaponStatsReset( f1_arg1 )
|
|
SquadMemPurchasesReset( f1_arg1 )
|
|
SquadMemUnlockReset( f1_arg1 )
|
|
ValidateLoadoutsAfterReset( f1_arg1 )
|
|
Engine.ExecNow( "uploadstats", f1_arg1.controller )
|
|
end
|
|
f1_arg0:dispatchEventToRoot( {
|
|
name = "prestige_mode_reset",
|
|
controller = f1_arg1.controller,
|
|
immediate = true
|
|
} )
|
|
end
|
|
|
|
function prestigereset3()
|
|
return {
|
|
type = "generic_yesno_popup",
|
|
id = "prestige_reset_popup_3",
|
|
properties = {
|
|
message_text = Engine.Localize( "@MENU_PRESTIGE_RESET_WARNING3" ),
|
|
popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE3" ),
|
|
yes_action = prestigeresetaction,
|
|
yes_text = Engine.Localize( "@LUA_MENU_MP_RESET_STATS" ),
|
|
no_text = Engine.Localize( "@LUA_MENU_CANCEL" )
|
|
}
|
|
}
|
|
end
|
|
|
|
function prestigereset2()
|
|
return {
|
|
type = "generic_yesno_popup",
|
|
id = "prestige_reset_popup_2",
|
|
properties = {
|
|
message_text = Engine.Localize( "@MENU_RESET_STATS_WARNING2" ),
|
|
popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE2" ),
|
|
yes_action = MBh.PopupMenu( "prestige_reset3", true ),
|
|
yes_text = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE3" ),
|
|
no_text = Engine.Localize( "@LUA_MENU_CANCEL" )
|
|
}
|
|
}
|
|
end
|
|
|
|
function prestigereset()
|
|
return {
|
|
type = "generic_yesno_popup",
|
|
id = "prestige_reset_popup",
|
|
properties = {
|
|
message_text = Engine.Localize( "@MENU_RESET_STATS_WARNING1" ),
|
|
popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE1" ),
|
|
yes_action = MBh.PopupMenu( "prestige_reset2", true ),
|
|
yes_text = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE2" ),
|
|
no_text = Engine.Localize( "@LUA_MENU_CANCEL" )
|
|
}
|
|
}
|
|
end
|
|
|
|
function PlayerStatsReset( f5_arg0 )
|
|
for f5_local0 = 0, PrestigeResetTable.MaxRows, 1 do
|
|
local f5_local3 = Engine.TableLookupByRow( PrestigeResetTable.File, f5_local0, PrestigeResetTable.Cols.PlayerStats )
|
|
if f5_local3 ~= "" then
|
|
Engine.SetPlayerDataEx( f5_arg0.controller, CoD.StatsGroup.Ranked, f5_local3, 0 )
|
|
end
|
|
end
|
|
for f5_local4, f5_local3 in pairs( ItemStatsTable ) do
|
|
Engine.SetPlayerDataEx( f5_arg0.controller, CoD.StatsGroup.Ranked, "bestWeapon", f5_local3, 0 )
|
|
end
|
|
end
|
|
|
|
function SquadMemXPReset( f6_arg0 )
|
|
for f6_local0 = 0, 9, 1 do
|
|
Engine.SetPlayerDataEx( f6_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f6_local0, "squadMemXP", 0 )
|
|
Engine.SetPlayerDataEx( f6_arg0.controller, CoD.StatsGroup.Ranked, "characterXP", f6_local0, 0 )
|
|
Engine.SetPlayerDataEx( f6_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f6_local0, "experienceToPrestige", 0 )
|
|
end
|
|
Engine.SetPlayerDataReservedInt( f6_arg0.controller, CoD.StatsGroup.Ranked, "prestigeLevel", 0 )
|
|
end
|
|
|
|
function WeaponStatsReset( f7_arg0 )
|
|
for f7_local0 = 0, PrestigeResetTable.MaxRows, 1 do
|
|
local f7_local3 = Engine.TableLookupByRow( PrestigeResetTable.File, f7_local0, PrestigeResetTable.Cols.WeaponStats )
|
|
if f7_local3 ~= "" then
|
|
for f7_local7, f7_local8 in pairs( ItemStatsTable ) do
|
|
Engine.SetPlayerDataEx( f7_arg0.controller, CoD.StatsGroup.Ranked, "weaponStats", f7_local3, f7_local8, 0 )
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function SquadMemPurchasesReset( f8_arg0 )
|
|
for f8_local0 = 0, PrestigeResetTable.MaxRows, 1 do
|
|
local f8_local3 = Engine.TableLookupByRow( PrestigeResetTable.File, f8_local0, PrestigeResetTable.Cols.Purchases )
|
|
if f8_local3 ~= "" then
|
|
for f8_local4 = 0, 9, 1 do
|
|
Engine.SetPlayerDataEx( f8_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f8_local4, "challengeState", f8_local3, 0 )
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function SquadMemUnlockReset( f9_arg0 )
|
|
for f9_local0 = 0, 9, 1 do
|
|
Engine.SetPlayerDataEx( f9_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f9_local0, "inUse", false )
|
|
Engine.SetPlayerDataEx( f9_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f9_local0, "defaultSet", false )
|
|
end
|
|
Engine.SetPlayerDataEx( f9_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", 0, "inUse", true )
|
|
Engine.SetPlayerDataEx( f9_arg0.controller, CoD.StatsGroup.Ranked, "challengeState", "ch_squad_member1_purchase", 2 )
|
|
Cac.SetActiveSquadMember( f9_arg0.controller, 0 )
|
|
end
|
|
|
|
function ValidateLoadoutsAfterReset( f10_arg0 )
|
|
local f10_local0 = Cac.GetSquadLoc()
|
|
local f10_local1 = f10_arg0.controller
|
|
for f10_local2 = 0, Cac.MaxSquadMemberCount( f10_local0 ) - 1, 1 do
|
|
Cac.ValidateCustomizationItems( f10_local1, f10_local0, f10_local2 )
|
|
end
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "prestige_reset", prestigereset )
|
|
LUI.MenuBuilder.registerDef( "prestige_reset2", prestigereset2 )
|
|
LUI.MenuBuilder.registerDef( "prestige_reset3", prestigereset3 )
|
|
LockTable( _M )
|