2023-02-20 14:03:28 -05:00
|
|
|
if Engine.GetCurrentMap() ~= "core_frontend" then
|
2023-02-19 12:03:53 -05:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
DataSources.MPStatsSettings = DataSourceHelpers.ListSetup("MPStatsSettings", function(controller)
|
|
|
|
local optionsTable = {}
|
2023-02-02 17:28:48 -05:00
|
|
|
|
2023-03-10 17:58:57 -05:00
|
|
|
local updateDvar = function(f1_arg0, f1_arg1, f1_arg2, dvarName, f1_arg4)
|
2023-04-08 18:33:43 -04:00
|
|
|
local oldValue = Engine.DvarInt(nil, dvarName)
|
|
|
|
local newValue = f1_arg1.value
|
|
|
|
UpdateInfoModels(f1_arg1)
|
|
|
|
if oldValue == newValue then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
Engine.SetDvar(dvarName, f1_arg1.value)
|
2023-03-10 17:58:57 -05:00
|
|
|
if dvarName == "cg_unlockall_loot" then
|
2023-04-08 18:33:43 -04:00
|
|
|
Engine.SetDvar("ui_enableAllHeroes", f1_arg1.value)
|
2023-03-10 17:58:57 -05:00
|
|
|
end
|
2023-04-08 18:33:43 -04:00
|
|
|
end
|
2023-03-10 17:58:57 -05:00
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
table.insert(optionsTable,
|
|
|
|
CoD.OptionsUtility.CreateDvarSettings(controller, "Unlock All Loot",
|
2023-04-18 09:21:03 -04:00
|
|
|
"Unlocks all Black Market loot.", "MPStatsSettings_unlock_loot",
|
2023-04-08 18:33:43 -04:00
|
|
|
"cg_unlockall_loot", {
|
|
|
|
{
|
|
|
|
option = "MENU_DISABLED",
|
|
|
|
value = 0,
|
|
|
|
default = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
option = "MENU_ENABLED",
|
|
|
|
value = 1
|
|
|
|
},
|
|
|
|
}, nil, updateDvar))
|
2023-03-10 17:58:57 -05:00
|
|
|
if Engine.CurrentSessionMode() == Enum.eModes.MODE_MULTIPLAYER then
|
2023-04-08 18:33:43 -04:00
|
|
|
table.insert(optionsTable,
|
|
|
|
CoD.OptionsUtility.CreateDvarSettings(controller, "Unlock All Purchases",
|
|
|
|
"All items that need to be purchased with unlock tokens are unlocked.", "MPStatsSettings_purchase_all",
|
|
|
|
"cg_unlockall_purchases", {
|
|
|
|
{
|
|
|
|
option = "MENU_DISABLED",
|
|
|
|
value = 0,
|
|
|
|
default = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
option = "MENU_ENABLED",
|
|
|
|
value = 1
|
|
|
|
},
|
|
|
|
}, nil, updateDvar))
|
2023-04-18 09:21:03 -04:00
|
|
|
table.insert(optionsTable,
|
|
|
|
CoD.OptionsUtility.CreateDvarSettings(controller, "Unlock All Class Slots",
|
|
|
|
"Unlocks all create-a-class slots and sets.", "MPStatsSettings_unlockall_cac_slots",
|
|
|
|
"cg_unlockall_cac_slots", {
|
|
|
|
{
|
|
|
|
option = "MENU_DISABLED",
|
|
|
|
value = 0,
|
|
|
|
default = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
option = "MENU_ENABLED",
|
|
|
|
value = 1
|
|
|
|
},
|
|
|
|
}, nil, updateDvar))
|
2023-04-08 18:33:43 -04:00
|
|
|
end
|
|
|
|
table.insert(optionsTable,
|
|
|
|
CoD.OptionsUtility.CreateDvarSettings(controller, "Unlock All Attachments",
|
|
|
|
"All attachments on weapons are unlocked.",
|
|
|
|
"MPStatsSettings_unlockall_attachments", "cg_unlockall_attachments", {
|
|
|
|
{
|
|
|
|
option = "MENU_DISABLED",
|
|
|
|
value = 0,
|
|
|
|
default = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
option = "MENU_ENABLED",
|
|
|
|
value = 1
|
|
|
|
},
|
|
|
|
}, nil, updateDvar))
|
|
|
|
table.insert(optionsTable,
|
|
|
|
CoD.OptionsUtility.CreateDvarSettings(controller, "Unlock all Camos and Reticles",
|
|
|
|
"All camos and reticles on weapons are unlocked.", "MPStatsSettings_unlockall_camos_and_reticles",
|
|
|
|
"cg_unlockall_camos_and_reticles", {
|
|
|
|
{
|
|
|
|
option = "MENU_DISABLED",
|
|
|
|
value = 0,
|
|
|
|
default = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
option = "MENU_ENABLED",
|
|
|
|
value = 1
|
|
|
|
},
|
|
|
|
}, nil, updateDvar))
|
|
|
|
table.insert(optionsTable,
|
|
|
|
CoD.OptionsUtility.CreateDvarSettings(controller, "Unlock all Calling Cards", "All calling cards are unlocked.",
|
|
|
|
"MPStatsSettings_unlockall_calling_cards", "cg_unlockall_calling_cards", {
|
|
|
|
{
|
|
|
|
option = "MENU_DISABLED",
|
|
|
|
value = 0,
|
|
|
|
default = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
option = "MENU_ENABLED",
|
|
|
|
value = 1
|
|
|
|
},
|
|
|
|
}, nil, updateDvar))
|
|
|
|
table.insert(optionsTable,
|
|
|
|
CoD.OptionsUtility.CreateDvarSettings(controller, "Unlock all Specialists Outfits",
|
|
|
|
"All specialists outfits are unlocked.", "MPStatsSettings_unlockall_specialists_outfits",
|
|
|
|
"cg_unlockall_specialists_outfits", {
|
|
|
|
{
|
|
|
|
option = "MENU_DISABLED",
|
|
|
|
value = 0,
|
|
|
|
default = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
option = "MENU_ENABLED",
|
|
|
|
value = 1
|
|
|
|
},
|
|
|
|
}, nil, updateDvar))
|
2023-03-10 17:58:57 -05:00
|
|
|
|
|
|
|
local rankLevels = {}
|
|
|
|
if Engine.CurrentSessionMode() == Enum.eModes.MODE_MULTIPLAYER then
|
|
|
|
rankLevels = { 1, 10, 20, 30, 40, 50, 55 }
|
|
|
|
elseif Engine.CurrentSessionMode() == Enum.eModes.MODE_ZOMBIES then
|
|
|
|
rankLevels = { 1, 10, 20, 30, 35 }
|
|
|
|
end
|
|
|
|
local rankObjs = {}
|
|
|
|
local hasDefault = false
|
2023-04-08 18:33:43 -04:00
|
|
|
local currentRank = CoD.BlackMarketUtility.GetCurrentRank(controller) + 1
|
2023-03-10 17:58:57 -05:00
|
|
|
for index, value in ipairs(rankLevels) do
|
2023-04-08 18:33:43 -04:00
|
|
|
table.insert(rankObjs, {
|
2023-03-10 17:58:57 -05:00
|
|
|
name = value,
|
|
|
|
value = value - 1,
|
|
|
|
default = value == currentRank,
|
|
|
|
title = "Rank Level",
|
|
|
|
desc = ""
|
|
|
|
})
|
|
|
|
if not hasDefault then
|
|
|
|
hasDefault = value == currentRank
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if not hasDefault then
|
2023-04-08 18:33:43 -04:00
|
|
|
table.insert(rankObjs, {
|
2023-03-10 17:58:57 -05:00
|
|
|
name = currentRank,
|
|
|
|
value = currentRank - 1,
|
|
|
|
default = true,
|
|
|
|
title = "Rank Level",
|
|
|
|
desc = ""
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
local prestigeTable = {}
|
|
|
|
for i = 0, 10 do
|
2023-04-08 18:33:43 -04:00
|
|
|
table.insert(prestigeTable, {
|
2023-03-10 17:58:57 -05:00
|
|
|
name = i == 0 and "None" or i,
|
|
|
|
value = i,
|
2023-04-08 18:33:43 -04:00
|
|
|
default = i == CoD.PrestigeUtility.GetCurrentPLevel(controller),
|
2023-03-10 17:58:57 -05:00
|
|
|
title = "Prestige",
|
|
|
|
desc = ""
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
local createSettingsDatasource = function(controller, datasourceName, optionsTable, currentValue, loopEdges, action)
|
2023-03-10 17:58:57 -05:00
|
|
|
if currentValue == nil then
|
|
|
|
currentValue = 0
|
|
|
|
end
|
2023-04-08 18:33:43 -04:00
|
|
|
DataSources[datasourceName] = DataSourceHelpers.ListSetup(datasourceName, function(f47_arg0)
|
2023-03-10 17:58:57 -05:00
|
|
|
local f47_local0 = {}
|
2023-04-08 18:33:43 -04:00
|
|
|
for f47_local4, f47_local5 in ipairs(optionsTable) do
|
|
|
|
table.insert(f47_local0, {
|
2023-03-10 17:58:57 -05:00
|
|
|
models = {
|
|
|
|
text = optionsTable[f47_local4].name
|
|
|
|
},
|
|
|
|
properties = {
|
|
|
|
title = optionsTable[f47_local4].title,
|
|
|
|
desc = optionsTable[f47_local4].desc,
|
|
|
|
image = optionsTable[f47_local4].image,
|
|
|
|
value = optionsTable[f47_local4].value,
|
|
|
|
default = optionsTable[f47_local4].default,
|
|
|
|
action = action,
|
|
|
|
selectIndex = optionsTable[f47_local4].value == currentValue,
|
|
|
|
loopEdges = loopEdges,
|
2023-04-08 18:33:43 -04:00
|
|
|
showChangeIndicator = function(f48_arg0, f48_arg1, f48_arg2)
|
2023-03-10 17:58:57 -05:00
|
|
|
return f48_arg0.default ~= true
|
|
|
|
end
|
|
|
|
}
|
2023-04-08 18:33:43 -04:00
|
|
|
})
|
2023-03-10 17:58:57 -05:00
|
|
|
end
|
|
|
|
f47_local0[1].properties.first = true
|
|
|
|
f47_local0[#optionsTable].properties.last = true
|
|
|
|
return f47_local0
|
2023-04-08 18:33:43 -04:00
|
|
|
end, nil, nil, nil)
|
2023-03-10 17:58:57 -05:00
|
|
|
return datasourceName
|
|
|
|
end
|
2023-04-08 18:33:43 -04:00
|
|
|
|
|
|
|
table.insert(optionsTable, {
|
2023-03-10 17:58:57 -05:00
|
|
|
models = {
|
|
|
|
name = "Rank Level",
|
|
|
|
desc = "",
|
|
|
|
image = nil,
|
2023-04-08 18:33:43 -04:00
|
|
|
optionsDatasource = createSettingsDatasource(controller, "MPStatsSettings_rank_level", rankObjs,
|
|
|
|
CoD.BlackMarketUtility.GetCurrentRank(controller), false, function(f1_arg0, f1_arg1, f1_arg2, dvarName, f1_arg4)
|
|
|
|
UpdateInfoModels(f1_arg1)
|
|
|
|
local rankTable = nil
|
|
|
|
if Engine.CurrentSessionMode() == Enum.eModes.MODE_MULTIPLAYER then
|
|
|
|
rankTable = "gamedata/tables/mp/mp_ranktable.csv"
|
|
|
|
elseif Engine.CurrentSessionMode() == Enum.eModes.MODE_ZOMBIES then
|
|
|
|
rankTable = "gamedata/tables/zm/zm_ranktable.csv"
|
|
|
|
end
|
|
|
|
local skipLines = Engine.CurrentSessionMode() == Enum.eModes.MODE_MULTIPLAYER and 3 or 2
|
|
|
|
local maxXp = tonumber(Engine.TableLookupGetColumnValueForRow(rankTable, f1_arg1.value + skipLines, 7))
|
|
|
|
if maxXp == nil then
|
|
|
|
maxXp = 9999999999
|
|
|
|
end
|
|
|
|
Engine.ExecNow(f1_arg0, "statsetbyname rankxp " .. maxXp - 1)
|
|
|
|
Engine.ExecNow(f1_arg0, "statsetbyname rank " .. f1_arg1.value)
|
|
|
|
Engine.Exec(f1_arg0, "uploadstats " .. tostring(Engine.CurrentSessionMode()))
|
|
|
|
end)
|
2023-03-10 17:58:57 -05:00
|
|
|
},
|
|
|
|
properties = {
|
2023-04-08 18:33:43 -04:00
|
|
|
revert = function(f50_arg0)
|
|
|
|
end
|
2023-03-10 17:58:57 -05:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
table.insert(optionsTable, {
|
2023-03-10 17:58:57 -05:00
|
|
|
models = {
|
|
|
|
name = "Prestige",
|
|
|
|
desc = "",
|
|
|
|
image = nil,
|
2023-04-08 18:33:43 -04:00
|
|
|
optionsDatasource = createSettingsDatasource(controller, "MPStatsSettings_rank_prestige", prestigeTable,
|
|
|
|
CoD.PrestigeUtility.GetCurrentPLevel(controller), false, function(f1_arg0, f1_arg1, f1_arg2, dvarName, f1_arg4)
|
|
|
|
UpdateInfoModels(f1_arg1)
|
|
|
|
local newPrestige = f1_arg1.value
|
|
|
|
Engine.ExecNow(f1_arg0, "statsetbyname plevel " .. newPrestige)
|
|
|
|
Engine.ExecNow(f1_arg0, "statsetbyname hasprestiged " .. (newPrestige > 0 and 1 or 0))
|
|
|
|
Engine.Exec(f1_arg0, "uploadstats " .. tostring(Engine.CurrentSessionMode()))
|
|
|
|
end)
|
2023-03-10 17:58:57 -05:00
|
|
|
},
|
|
|
|
properties = {
|
2023-04-08 18:33:43 -04:00
|
|
|
revert = function(f50_arg0)
|
|
|
|
end
|
2023-03-10 17:58:57 -05:00
|
|
|
}
|
|
|
|
})
|
2023-04-08 18:33:43 -04:00
|
|
|
|
|
|
|
return optionsTable
|
2023-02-02 17:28:48 -05:00
|
|
|
end)
|
|
|
|
|
2023-02-11 14:40:26 -05:00
|
|
|
if Dvar.cg_unlockall_loot:get() == true then
|
2023-04-08 18:33:43 -04:00
|
|
|
Engine.SetDvar("ui_enableAllHeroes", 1)
|
2023-02-11 14:40:26 -05:00
|
|
|
end
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
LUI.createMenu.BoiiiStatsMenu = function(controller)
|
|
|
|
local self = CoD.Menu.NewForUIEditor("BoiiiStatsMenu")
|
2023-02-02 17:28:48 -05:00
|
|
|
if PreLoadFunc then
|
2023-04-08 18:33:43 -04:00
|
|
|
PreLoadFunc(self, controller)
|
2023-02-02 17:28:48 -05:00
|
|
|
end
|
|
|
|
self.soundSet = "ChooseDecal"
|
2023-04-08 18:33:43 -04:00
|
|
|
self:setOwner(controller)
|
|
|
|
self:setLeftRight(true, true, 0, 0)
|
|
|
|
self:setTopBottom(true, true, 0, 0)
|
|
|
|
self:playSound("menu_open", controller)
|
|
|
|
self.buttonModel = Engine.CreateModel(Engine.GetModelForController(controller), "BoiiiStatsMenu.buttonPrompts")
|
2023-02-02 17:28:48 -05:00
|
|
|
self.anyChildUsesUpdateState = true
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
local GameSettingsBackground = CoD.GameSettings_Background.new(self, controller)
|
|
|
|
GameSettingsBackground:setLeftRight(true, true, 0, 0)
|
|
|
|
GameSettingsBackground:setTopBottom(true, true, 0, 0)
|
|
|
|
GameSettingsBackground.MenuFrame.titleLabel:setText(Engine.Localize("STATS SETTINGS"))
|
|
|
|
GameSettingsBackground.MenuFrame.cac3dTitleIntermediary0.FE3dTitleContainer0.MenuTitle.TextBox1.Label0:setText(Engine
|
|
|
|
.Localize("STATS SETTINGS"))
|
|
|
|
GameSettingsBackground.GameSettingsSelectedItemInfo.GameModeInfo:setAlpha(0)
|
|
|
|
GameSettingsBackground.GameSettingsSelectedItemInfo.GameModeName:setAlpha(0)
|
|
|
|
self:addElement(GameSettingsBackground)
|
2023-02-02 17:28:48 -05:00
|
|
|
self.GameSettingsBackground = GameSettingsBackground
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
local Options = CoD.Competitive_SettingsList.new(self, controller)
|
|
|
|
Options:setLeftRight(true, false, 26, 741)
|
|
|
|
Options:setTopBottom(true, false, 135, 720)
|
|
|
|
Options.Title.DescTitle:setText(Engine.Localize("Stats"))
|
|
|
|
Options.ButtonList:setVerticalCount(15)
|
|
|
|
Options.ButtonList:setDataSource("MPStatsSettings")
|
|
|
|
self:addElement(Options)
|
2023-02-02 17:28:48 -05:00
|
|
|
self.Options = Options
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, nil,
|
|
|
|
function(element, menu, controller, model)
|
|
|
|
GoBack(self, controller)
|
|
|
|
SetPerControllerTableProperty(controller, "disableGameSettingsOptions", nil)
|
|
|
|
return true
|
|
|
|
end, function(element, menu, controller)
|
|
|
|
CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, "MENU_BACK")
|
|
|
|
return true
|
|
|
|
end, false)
|
2023-02-02 17:28:48 -05:00
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
GameSettingsBackground.MenuFrame:setModel(self.buttonModel, controller)
|
|
|
|
Options.id = "Options"
|
2023-02-02 17:28:48 -05:00
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
self:processEvent({
|
2023-02-02 17:28:48 -05:00
|
|
|
name = "menu_loaded",
|
|
|
|
controller = controller
|
2023-04-08 18:33:43 -04:00
|
|
|
})
|
|
|
|
self:processEvent({
|
2023-02-02 17:28:48 -05:00
|
|
|
name = "update_state",
|
|
|
|
menu = self
|
2023-04-08 18:33:43 -04:00
|
|
|
})
|
|
|
|
if not self:restoreState() then
|
|
|
|
self.Options:processEvent({
|
2023-02-02 17:28:48 -05:00
|
|
|
name = "gain_focus",
|
|
|
|
controller = controller
|
2023-04-08 18:33:43 -04:00
|
|
|
})
|
2023-02-02 17:28:48 -05:00
|
|
|
end
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
LUI.OverrideFunction_CallOriginalSecond(self, "close", function(element)
|
2023-02-02 17:28:48 -05:00
|
|
|
element.GameSettingsBackground:close()
|
|
|
|
element.Options:close()
|
2023-04-08 18:33:43 -04:00
|
|
|
Engine.UnsubscribeAndFreeModel(Engine.GetModel(Engine.GetModelForController(controller),
|
|
|
|
"BoiiiStatsMenu.buttonPrompts"))
|
|
|
|
end)
|
2023-02-02 17:28:48 -05:00
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
if PostLoadFunc then
|
|
|
|
PostLoadFunc(self, controller)
|
2023-02-02 17:28:48 -05:00
|
|
|
end
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
return self
|
2023-02-02 17:28:48 -05:00
|
|
|
end
|