wip agreement

This commit is contained in:
Arwent 2022-07-03 00:56:21 +02:00
parent 018e4c9a75
commit e3e1c77dfb
3 changed files with 78 additions and 2 deletions

View File

@ -11,7 +11,9 @@ custom_depot = {
[5] = 0 -- Bonus
},
items = {},
reward_splashes = {}
reward_splashes = {},
has_accepted_mod_eula = false,
has_seen_mod_eula = false,
},
directory_path = "data/ui_scripts",
file_name = "depot_save.json",
@ -81,6 +83,25 @@ custom_depot.functions["has_reward_splash"] = function(item)
return custom_depot.data.reward_splashes[item] ~= nil
end
custom_depot.functions["has_accepted_mod_eula"] = function()
return custom_depot.data.has_accepted_mod_eula
end
custom_depot.functions["set_has_accepted_mod_eula"] = function(value)
custom_depot.data.has_accepted_mod_eula = value
custom_depot.get_function("save_depot_data")()
end
custom_depot.functions["has_seen_mod_eula"] = function()
return custom_depot.data.has_seen_mod_eula
end
custom_depot.functions["set_has_seen_mod_eula"] = function(value)
custom_depot.data.has_seen_mod_eula = value
custom_depot.get_function("save_depot_data")()
end
custom_depot.get_function("load_depot_data")()
require("mod_eula")
require("depot_override")
require("scoreboard_override")

View File

@ -145,7 +145,7 @@ TryShowCollectionCompleted = function(controller, reward_data, unk1)
collectionData = reward_data
})
if collection_details_menu then
if custom_depot.collection_details_menu then
custom_depot.collection_details_menu:OnCompletedSet()
end
@ -281,3 +281,40 @@ MPDepotOpenLootMenu = function(unk1, unk2)
return open_loot_menu
end
LUI.MenuBuilder.m_types_build["MPDepotOpenLootMenu"] = MPDepotOpenLootMenu
AddLootDropTabSelector_orig = LUI.MPDepotBase.AddLootDropTabSelector
LUI.MPDepotBase.AddLootDropTabSelector = function(unk1, unk2)
if not custom_depot.get_function("has_accepted_mod_eula")() then
local item_sets = GetItemSets()
unk1:AddButtonWithInfo("depot_collections", "@DEPOT_COLLECTIONS", "MPDepotCollectionsMenu", nil, nil,
Engine.Localize("@MPUI_X_SLASH_Y", item_sets.completedSets, item_sets.numSets))
unk1:AddButtonWithInfo("depot_armory", "@DEPOT_ARMORY", "MPDepotArmoryMenu")
return
end
AddLootDropTabSelector_orig(unk1, unk2)
end
MPDepotMenu_orig = LUI.MenuBuilder.m_types_build["MPDepotMenu"]
MPDepotMenu = function(unk1, unk2)
local depot_menu = MPDepotMenu_orig(unk1, unk2)
if not custom_depot.get_function("has_seen_mod_eula")() then
LUI.FlowManager.RequestAddMenu(nil, "mod_eula", true, 0, false, {
acceptCallback = function()
custom_depot.get_function("set_has_accepted_mod_eula")(true)
custom_depot.get_function("set_has_seen_mod_eula")(true)
LUI.FlowManager.RequestLeaveMenu(depot_menu)
end,
declineCallback = function()
custom_depot.get_function("set_has_accepted_mod_eula")(false)
custom_depot.get_function("set_has_seen_mod_eula")(true)
end
})
end
return depot_menu
end
LUI.MenuBuilder.m_types_build["MPDepotMenu"] = MPDepotMenu

View File

@ -0,0 +1,18 @@
game:addlocalizedstring("MOD_EULA_1",
"SOMETHING TO WRITE HERE, HELLO WORLD, I GUESS I WILL NEED SOMEONE TO WRITE THIS TEXT BECAUSE MY ENGLISH IS SHITTY AS FUCK.")
game:addlocalizedstring("MOD_EULA_2",
"YEAH, WE HAVE NOW THIS \"EULA\" TO ACCEPT FOR SOME COUNTRIES, AND H1-MOD STAFF IS NOT RESPONSIBLE, OK? BYE NOW.")
local mod_eula = function(unk1, unk2)
return LUI.EULABase.new(CoD.CreateState(0, 0, 0, 0, CoD.AnchorTypes.All), {
textStrings = LUI.EULABase.CreateTextStrings("@MOD_EULA_", 2),
declineCallback = function(unk3)
unk2.declineCallback(unk3)
end,
acceptCallback = function(unk4)
unk2.acceptCallback(unk4)
end
})
end
LUI.MenuBuilder.registerPopupType("mod_eula", mod_eula)