fix for embedded json, and move save to h1-mod folder
This commit is contained in:
parent
9d1f7fb1b6
commit
fb2611fa8d
@ -1,28 +1,24 @@
|
|||||||
local json = require("dkjson")
|
|
||||||
|
|
||||||
custom_depot = {
|
custom_depot = {
|
||||||
collection_details_menu = nil,
|
collection_details_menu = nil,
|
||||||
data = {
|
data = {
|
||||||
currencies = {
|
currencies = {
|
||||||
[1] = 0, -- LaunchCredits
|
["1"] = 0, -- LaunchCredits
|
||||||
[2] = 0, -- Credits
|
["2"] = 0, -- Credits
|
||||||
[3] = 0, -- Parts
|
["3"] = 0, -- Parts
|
||||||
[4] = 0, -- CoDPoints
|
["4"] = 0, -- CoDPoints
|
||||||
[5] = 0 -- Bonus
|
["5"] = 0 -- Bonus
|
||||||
},
|
},
|
||||||
items = {},
|
items = {},
|
||||||
reward_splashes = {},
|
reward_splashes = {},
|
||||||
has_accepted_mod_eula = false,
|
has_accepted_mod_eula = false,
|
||||||
has_seen_mod_eula = false,
|
has_seen_mod_eula = false,
|
||||||
},
|
},
|
||||||
directory_path = "data/ui_scripts",
|
directory_path = "h1-mod",
|
||||||
file_name = "depot_save.json",
|
file_name = "depot_save.json",
|
||||||
file_path = nil,
|
file_path = nil,
|
||||||
functions = {},
|
functions = {}
|
||||||
mod_name = "custom_depot"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
custom_depot.directory_path = string.format("%s/%s", custom_depot.directory_path, custom_depot.mod_name)
|
|
||||||
custom_depot.file_path = string.format("%s/%s", custom_depot.directory_path, custom_depot.file_name)
|
custom_depot.file_path = string.format("%s/%s", custom_depot.directory_path, custom_depot.file_name)
|
||||||
|
|
||||||
custom_depot.get_function = function(function_name)
|
custom_depot.get_function = function(function_name)
|
||||||
@ -52,19 +48,19 @@ custom_depot.functions["load_depot_data"] = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
custom_depot.functions["add_currency"] = function(currency_type, amount)
|
custom_depot.functions["add_currency"] = function(currency_type, amount)
|
||||||
custom_depot.data.currencies[currency_type] = custom_depot.data.currencies[currency_type] + amount
|
custom_depot.data.currencies[tostring(currency_type)] = custom_depot.data.currencies[tostring(currency_type)] + amount
|
||||||
end
|
end
|
||||||
|
|
||||||
custom_depot.functions["remove_currency"] = function(currency_type, amount)
|
custom_depot.functions["remove_currency"] = function(currency_type, amount)
|
||||||
custom_depot.data.currencies[currency_type] = custom_depot.data.currencies[currency_type] - amount
|
custom_depot.data.currencies[tostring(currency_type)] = custom_depot.data.currencies[tostring(currency_type)] - amount
|
||||||
end
|
end
|
||||||
|
|
||||||
custom_depot.functions["get_currency"] = function(currency_type)
|
custom_depot.functions["get_currency"] = function(currency_type)
|
||||||
if not currency_type or not custom_depot.data.currencies[currency_type] then
|
if not currency_type or not custom_depot.data.currencies[tostring(currency_type)] then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return custom_depot.data.currencies[currency_type]
|
return custom_depot.data.currencies[tostring(currency_type)]
|
||||||
end
|
end
|
||||||
|
|
||||||
custom_depot.functions["add_item"] = function(item, value)
|
custom_depot.functions["add_item"] = function(item, value)
|
||||||
|
@ -211,8 +211,6 @@ MPDepotOpenLootMenu = function(unk1, unk2)
|
|||||||
.SuppyDropLootStream[unk2.crateType]].lootTableColName)
|
.SuppyDropLootStream[unk2.crateType]].lootTableColName)
|
||||||
local random_item = items_list[math.random(#items_list)]
|
local random_item = items_list[math.random(#items_list)]
|
||||||
|
|
||||||
print(random_item.inventoryItemType ~= Cac.InventoryItemType.Loot)
|
|
||||||
print(random_item.inventoryItemType)
|
|
||||||
while random_item.inventoryItemType ~= Cac.InventoryItemType.Loot do
|
while random_item.inventoryItemType ~= Cac.InventoryItemType.Loot do
|
||||||
random_item = items_list[math.random(#items_list)]
|
random_item = items_list[math.random(#items_list)]
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user