1137 lines
No EOL
35 KiB
Lua
1137 lines
No EOL
35 KiB
Lua
local cached = false
|
|
local lang = i18n.translations[i18n.language]
|
|
---------------------
|
|
-- Hunting Lodge Menu
|
|
---------------------
|
|
|
|
local cachedLevel = 0
|
|
|
|
function openLodgeMenu(data)
|
|
cachedLevel = data.level
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu',
|
|
title = 'Hunting Lodge Menü',
|
|
options = {
|
|
{
|
|
title = 'Level: '..data.level,
|
|
description = 'Jagd Level Fortschritt [ '..data.progress..'% ]',
|
|
progress = data.progress,
|
|
icon = 'user',
|
|
iconColor = '#00BFFF',
|
|
readOnly = true,
|
|
colorScheme = '#00BFFF',
|
|
},
|
|
{
|
|
title = 'Tier Waren verkaufen ',
|
|
description = 'Verkaufe alle von Tieren gesammelten Teile.',
|
|
onSelect = function()
|
|
openLodgeMenu_SellAnimal()
|
|
end,
|
|
icon = 'dollar-sign',
|
|
iconColor = '#17C964',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Jagdbedarf',
|
|
description = 'Gib ein bisschen Geld aus.',
|
|
onSelect = function()
|
|
openLodgeMenu_HuntingSupplies()
|
|
end,
|
|
icon = 'shop',
|
|
iconColor = '#375A75',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Tägliche Herausforderungen',
|
|
description = 'Schau dir die täglichen Herausforderungen an.',
|
|
onSelect = function()
|
|
openLodgeMenu_DailyChallanges()
|
|
end,
|
|
icon = 'list-check',
|
|
iconColor = '#FEB058',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Turniere',
|
|
description = 'Turnierinformationen anzeigen',
|
|
onSelect = function()
|
|
openLodgeMenu_Tournaments()
|
|
end,
|
|
icon = 'flag',
|
|
iconColor = '#FF2E2E',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Jagd-Bestenlisten',
|
|
description = 'Jagd-Bestenlisten anschauen.',
|
|
onSelect = function()
|
|
openLodgeMenu_HuntingLeaderboards()
|
|
end,
|
|
icon = 'trophy',
|
|
iconColor = '#DAA520',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Jagdfahrzeug mieten',
|
|
description = 'Miete ein Jagdfahrzeug um deine getöten Tiere zu transportieren.',
|
|
onSelect = function()
|
|
openLodgeMenu_RentVehicles()
|
|
end,
|
|
icon = 'truck-pickup',
|
|
iconColor = '#9C9797',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Top-Jagdgebiete',
|
|
description = 'Auf der Suche nach den besten Jagdgebieten?',
|
|
onSelect = function()
|
|
openLodgeMenu_HuntingLocations()
|
|
end,
|
|
icon = 'map',
|
|
iconColor = '#4CAF50',
|
|
arrow = true,
|
|
},
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu')
|
|
end
|
|
|
|
function openLodgeMenu_SellAnimal()
|
|
local dataSellItems = {}
|
|
local success = lib.callback.await("gg_hunting:server:getSellableItems", false, "hunting_menu")
|
|
if success then
|
|
for k,v in ipairs(success) do
|
|
local desc
|
|
table.insert(dataSellItems, {
|
|
title = v.label,
|
|
description = 'Sell Value: $'..v.value.. " ( Count: "..v.count.." )",
|
|
disabled = disable,
|
|
onSelect = function()
|
|
LodgeMenuSellItem(v.item, v.slot, "hunting_menu")
|
|
end,
|
|
icon = Inventory.getRootImg(v.item),
|
|
image = Inventory.getRootImg(v.item),
|
|
})
|
|
end
|
|
else
|
|
table.insert(dataSellItems, {
|
|
title = 'Du hast nichts was ich kaufen will.',
|
|
description = "Geh Jagen!",
|
|
icon = 'fa-square'
|
|
})
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_sellanimal',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(dataSellItems)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_sellanimal')
|
|
|
|
end
|
|
|
|
|
|
function openLodgeMenu_HuntingSupplies()
|
|
local datatest = {}
|
|
if Config.ShopHideLockedItems then
|
|
local levelDetection = 0
|
|
for k,v in ipairs(Config.Shop["hunting_menu"]) do
|
|
local desc, disable = '', false
|
|
local titleSrc = Framework.getItemName(v.item)
|
|
local iconSrc = Inventory.getRootImg(v.item)
|
|
local imageSrc = Inventory.getRootImg(v.item)
|
|
if cachedLevel < v.level then
|
|
desc = 'Price: $'..formatNumberWithCommas(v.cost).. " | Unlocks At Level "..v.level
|
|
disable = true
|
|
else
|
|
desc = 'Price: $'..formatNumberWithCommas(v.cost)
|
|
disable = false
|
|
end
|
|
if levelDetection >= 1 then
|
|
iconSrc = "fa-lock"
|
|
imageSrc = nil
|
|
desc = "Unlocks At Level "..v.level
|
|
disable = true
|
|
titleSrc = "Hidden"
|
|
end
|
|
table.insert(datatest, {
|
|
title = titleSrc,
|
|
description = desc,
|
|
disabled = disable,
|
|
onSelect = function()
|
|
purchaseShopItem(k, "hunting_menu")
|
|
|
|
end,
|
|
icon = iconSrc,
|
|
image = imageSrc,
|
|
})
|
|
if cachedLevel < v.level then
|
|
levelDetection += 1
|
|
end
|
|
end
|
|
else
|
|
for k,v in ipairs(Config.Shop["hunting_menu"]) do
|
|
local desc, disable = '', false
|
|
if cachedLevel < v.level then
|
|
desc = 'Price: $'..formatNumberWithCommas(v.cost).. " ( Requires Level: "..v.level.." )"
|
|
disable = true
|
|
else
|
|
desc = 'Price: $'..formatNumberWithCommas(v.cost)
|
|
disable = false
|
|
end
|
|
table.insert(datatest, {
|
|
title = v.item,
|
|
description = desc,
|
|
disabled = disable,
|
|
onSelect = function()
|
|
purchaseShopItem(k, "hunting_menu")
|
|
end,
|
|
icon = Inventory.getRootImg(v.item),
|
|
image = Inventory.getRootImg(v.item),
|
|
})
|
|
end
|
|
end
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_huntingsupplies',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(datatest)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_huntingsupplies')
|
|
end
|
|
|
|
function openLodgeMenu_DailyChallanges()
|
|
local dataDailyChallenges = {}
|
|
local success = lib.callback.await("gg_hunting:server:getDailyChallenges", false)
|
|
if success then
|
|
table.insert(dataDailyChallenges, {
|
|
title = "Heutige Herausforderungen",
|
|
description = "Neue Herausforderungen in: _"..success.countdown.."_",
|
|
icon = 'list-check',
|
|
iconColor = '#FEB058',
|
|
})
|
|
for k,v in ipairs(success.challenges) do
|
|
local schemeColor, iconSet, iconColorSet
|
|
|
|
if v.progress >= 100 then
|
|
iconSet = 'fa-regular fa-square-check'
|
|
iconColorSet = '#86efac'
|
|
schemeColor = '#86efac'
|
|
if not v.claimed then
|
|
iconSet = 'fa-regular fa-square'
|
|
iconColorSet = '#fca5a5'
|
|
end
|
|
else
|
|
iconSet = 'fa-regular fa-square'
|
|
iconColorSet = '#fca5a5'
|
|
schemeColor = '#fca5a5'
|
|
end
|
|
table.insert(dataDailyChallenges, {
|
|
title = v.title,
|
|
description = v.description,
|
|
progress = v.progress,
|
|
colorScheme = schemeColor,
|
|
disabled = v.claimed,
|
|
onSelect = function()
|
|
if v.claimed then return end
|
|
ClaimDailyChallenge(k)
|
|
end,
|
|
icon = iconSet,
|
|
iconColor = iconColorSet
|
|
})
|
|
end
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_dailychallanges',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(dataDailyChallenges)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_dailychallanges')
|
|
end
|
|
|
|
function openLodgeMenu_Tournaments()
|
|
local success = lib.callback.await("gg_hunting:server:getTournamentTimer", false)
|
|
local desc = 'Kein aktuelles Turnier'
|
|
if success then
|
|
desc = success.remaingTime
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_tournaments',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu',
|
|
onBack = function() end,
|
|
options = {
|
|
{
|
|
title = 'Laufendes Turnier',
|
|
description = desc,
|
|
icon = 'fa-flag-checkered',
|
|
iconColor = "#ffcc00",
|
|
arrow = true,
|
|
onSelect = function()
|
|
openLodgeMenu_Tournaments_CurrentTournament()
|
|
end,
|
|
},
|
|
{
|
|
title = 'Gewinn abholen',
|
|
description = 'Hole deine Gewinne aus vergangenen Turnieren an!',
|
|
icon = 'fa-gift',
|
|
iconColor = "#00ff00",
|
|
arrow = true,
|
|
onSelect = function()
|
|
openLodgeMenu_Tournaments_Claimables()
|
|
end,
|
|
},
|
|
{
|
|
title = 'Vorschau auf die Turnierpreise',
|
|
description = 'Schau dir an was Du gewinnen kannst!',
|
|
icon = 'fa-calendar-check',
|
|
iconColor = "#ff66ff",
|
|
arrow = true,
|
|
onSelect = function()
|
|
openLodgeMenu_Tournaments_Rewards()
|
|
end,
|
|
},
|
|
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_tournaments')
|
|
end
|
|
|
|
|
|
function openLodgeMenu_Tournaments_CurrentTournament()
|
|
local tournamentUsers = {}
|
|
local success = lib.callback.await("gg_hunting:server:getTournament", false)
|
|
if success then
|
|
local plyProgress = success.playersProgress
|
|
-- Insert Current Tournament
|
|
table.insert(tournamentUsers, {
|
|
title = success.currentTournament.title,
|
|
description = success.currentTournament.desc,
|
|
icon = 'fa-flag-checkered',
|
|
iconColor = "#ffcc00",
|
|
readOnly = true,
|
|
})
|
|
-- Insert Person Progression
|
|
if plyProgress then
|
|
table.insert(tournamentUsers, {
|
|
title = "Ihre aktuelle Platzierung",
|
|
description = "Platzierung:"..getOrdinal(success.playersProgress.placement).." Platz | "..success.typeTag..": "..success.playersProgress.progress,
|
|
icon = success.playersProgress.icon,
|
|
iconColor = success.playersProgress.iconColor,
|
|
readOnly = true,
|
|
})
|
|
else
|
|
table.insert(tournamentUsers, {
|
|
title = "Du bist nicht platziert",
|
|
description = "Holen Sie sich Ihre erste Nummer auf die Tafel!",
|
|
icon = "fa-circle-info",
|
|
readOnly = true,
|
|
})
|
|
end
|
|
if #success.contestants > 0 then
|
|
-- Insert Header
|
|
table.insert(tournamentUsers, {
|
|
title = "### Top-Teilnehmer",
|
|
icon = 'fa-users',
|
|
readOnly = true,
|
|
})
|
|
-- Insert Top x Amount
|
|
for k,v in pairs(success.contestants) do
|
|
local iconSet = ''
|
|
local iconColorSet = ''
|
|
if k <= #Config.TournamentRewards then
|
|
iconSet = Config.TournamentRewards[k].icon
|
|
iconColorSet = Config.TournamentRewards[k].iconColor
|
|
end
|
|
|
|
table.insert(tournamentUsers, {
|
|
title = getOrdinal(k).." - "..v.fullname,
|
|
description = "Gesamt "..success.typeTag..": "..v.tournamentProgress,
|
|
icon = iconSet,
|
|
iconColor = iconColorSet,
|
|
readOnly = true,
|
|
})
|
|
end
|
|
else
|
|
table.insert(tournamentUsers, {
|
|
title = "Keine Turnierteilnehmer",
|
|
description = "Die Teilnehmerliste ist leer",
|
|
icon = 'fa-users',
|
|
iconColor = '#FF4500',
|
|
readOnly = true,
|
|
})
|
|
end
|
|
else
|
|
table.insert(tournamentUsers, {
|
|
title = "Kein Turnier",
|
|
description = "Kein Turnier gestartet",
|
|
icon = "fa-ban",
|
|
iconColor = "red",
|
|
})
|
|
end
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_tournaments_currenttournament',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu_tournaments',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(tournamentUsers),
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_tournaments_currenttournament')
|
|
end
|
|
|
|
function openLodgeMenu_Tournaments_Claimables()
|
|
local tournamentWinnings = {}
|
|
local success = lib.callback.await("gg_hunting:server:getClaimables", false)
|
|
|
|
if success then
|
|
for k,v in pairs(success) do
|
|
table.insert(tournamentWinnings, {
|
|
title = "Turnier #"..v.id,
|
|
description = "Gewinne: $"..formatNumberWithCommas(v.reward).." | Dein Platz: "..Config.TournamentRewards[v.placement].title,
|
|
icon = Config.TournamentRewards[v.placement].icon,
|
|
iconColor = Config.TournamentRewards[v.placement].iconColor,
|
|
onSelect = function()
|
|
claimTournamentReward(k)
|
|
end,
|
|
})
|
|
end
|
|
else
|
|
table.insert(tournamentWinnings, {
|
|
title = "Keine Gewinne zum abholen da",
|
|
description = "Nimm an einem Turnier teil um Preise zu gewinnen.",
|
|
icon = "fa-ban",
|
|
iconColor = "red",
|
|
})
|
|
end
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_tournaments_claimables',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu_tournaments',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(tournamentWinnings),
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_tournaments_claimables')
|
|
end
|
|
|
|
local trewardsCached = false
|
|
local tournamentRewards = {}
|
|
function openLodgeMenu_Tournaments_Rewards()
|
|
if not trewardsCached then
|
|
for k,v in pairs(Config.TournamentRewards) do
|
|
table.insert(tournamentRewards, {
|
|
title = v.title,
|
|
description = "Gewinn: $"..formatNumberWithCommas(v.reward),
|
|
icon = v.icon,
|
|
iconColor = v.iconColor,
|
|
})
|
|
end
|
|
trewardsCached = true
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_tournaments_rewards',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu_tournaments',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(tournamentRewards),
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_tournaments_rewards')
|
|
end
|
|
|
|
local leaderboardCached = false
|
|
local leaderboardMenus = {}
|
|
function openLodgeMenu_HuntingLeaderboards()
|
|
if not leaderboardCached then
|
|
for k,v in pairs(Config.Leaderboard_Pages) do
|
|
table.insert(leaderboardMenus, {
|
|
title = Config.Animals[v.target].label.." Tötungen",
|
|
description = v.desc,
|
|
onSelect = function()
|
|
openLeaderboardType(getLeaderboardData(v.type), v)
|
|
end,
|
|
icon = v.icon,
|
|
iconColor = v.iconColor,
|
|
image = Config.Animals[v.target].image,
|
|
})
|
|
end
|
|
|
|
|
|
leaderboardCached = true
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_huntingleaderboards',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(leaderboardMenus),
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_huntingleaderboards')
|
|
end
|
|
|
|
|
|
function openLeaderboardType(data, configData)
|
|
local leaderboardData = {}
|
|
table.insert(leaderboardData, {
|
|
title = '### '..Config.Animals[configData.target].label,
|
|
description = configData.desc,
|
|
icon = configData.icon,
|
|
iconColor = configData.iconColor,
|
|
readOnly = true,
|
|
})
|
|
|
|
if data then
|
|
if data.personalData then
|
|
table.insert(leaderboardData, {
|
|
title = 'Ihre Platzierung in der Bestenliste',
|
|
description = data.personalDesc or 'Sehen Sie, welchen Rang Sie in dieser Kategorie haben.',
|
|
icon = 'fa-skull-crossbones',
|
|
readOnly = true,
|
|
})
|
|
else
|
|
table.insert(leaderboardData, {
|
|
title = 'Ihre Platzierung in der Bestenliste',
|
|
description = "Du hast es noch nicht in die Bestenliste geschafft. Versuche weiter, dich zu platzieren!",
|
|
icon = 'fa-skull-crossbones',
|
|
readOnly = true,
|
|
})
|
|
end
|
|
|
|
if #data.leaderboardData > 0 then
|
|
table.insert(leaderboardData, {
|
|
title = "### Top Jäger",
|
|
description = "Hier sind die besten Jäger in dieser Kategorie:",
|
|
icon = 'fa-users',
|
|
iconColor = '#50C878',
|
|
readOnly = true,
|
|
})
|
|
|
|
for k, v in pairs(data.leaderboardData) do
|
|
local iconSet = ''
|
|
local iconColorSet = ''
|
|
if k <= #Config.TournamentRewards then
|
|
iconSet = Config.TournamentRewards[k].icon or 'fa-medal'
|
|
iconColorSet = Config.TournamentRewards[k].iconColor or '#FFD700'
|
|
end
|
|
|
|
table.insert(leaderboardData, {
|
|
title = getOrdinal(k).." - "..v.fullname,
|
|
description = configData.prefix.forLoop..formatNumberWithCommas(tonumber(v[configData.type])).." kills",
|
|
icon = iconSet,
|
|
iconColor = iconColorSet,
|
|
readOnly = true,
|
|
})
|
|
end
|
|
else
|
|
table.insert(leaderboardData, {
|
|
title = "Bestenliste leer",
|
|
description = "Bisher hat sich niemand in diese Bestenliste eingetragen. Seien Sie der Erste!",
|
|
icon = 'fa-users',
|
|
iconColor = '#FF4500',
|
|
readOnly = true,
|
|
})
|
|
end
|
|
else
|
|
table.insert(leaderboardData, {
|
|
title = 'Keine Daten verfügbar.',
|
|
description = 'Für diese Bestenliste sind derzeit keine Daten verfügbar.',
|
|
icon = 'fa-truck-pickup',
|
|
iconColor = '#808080',
|
|
readOnly = true,
|
|
})
|
|
end
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_huntingleaderboards_type',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu_huntingleaderboards',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(leaderboardData),
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_huntingleaderboards_type')
|
|
end
|
|
|
|
function openLodgeMenu_RentVehicles()
|
|
local vehicleData, returnVehicle = {}, {}
|
|
for k,v in pairs(Config.HuntingVehicles) do
|
|
local desc, disable, iconSet = '', false, 'truck-pickup'
|
|
if cachedLevel < v.level then
|
|
desc = 'Rent Price: $'..formatNumberWithCommas(v.cost).." | Freigeschaltet auf Level "..v.level
|
|
disable = true
|
|
iconSet = "fa-lock"
|
|
else
|
|
desc = 'Rent Price: $'..formatNumberWithCommas(v.cost)
|
|
disable = false
|
|
|
|
end
|
|
table.insert(vehicleData, {
|
|
title = v.label,
|
|
description = desc,
|
|
disabled = disable,
|
|
image = v.image,
|
|
onSelect = function()
|
|
RentHuntingVehicle(k)
|
|
end,
|
|
icon = iconSet,
|
|
})
|
|
end
|
|
|
|
local success = lib.callback.await("gg_hunting:server:checkForRentedVehicle", false)
|
|
if success then
|
|
table.insert(vehicleData,{
|
|
title = "Rückgabe des Jagdfahrzeugs",
|
|
description = "Geld für die Rückgabe des Fahrzeugs erhalten",
|
|
onSelect = function()
|
|
returnRentedVehicle(success)
|
|
end,
|
|
icon = "fas fa-arrow-left",
|
|
iconColor = "#28a745",
|
|
})
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_rentvehicles',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(vehicleData),
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_huntinglodgemenu_rentvehicles')
|
|
end
|
|
|
|
|
|
local cacheLocations = false
|
|
local huntingLocations = {}
|
|
function openLodgeMenu_HuntingLocations()
|
|
if not cacheLocations then
|
|
for k,v in pairs(Config.HuntingLocations) do
|
|
table.insert(huntingLocations,{
|
|
title = v.label,
|
|
description = string.format("%.2f miles away", getDistanceLocation(v.coords)),
|
|
onSelect = function()
|
|
markHuntingLocation(v.coords)
|
|
end,
|
|
icon = "map-marker-alt",
|
|
})
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_huntinglodgemenu_huntinglocation',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_huntinglodgemenu',
|
|
onBack = function() end,
|
|
options = {
|
|
{
|
|
title = "Beliebte Jagdorte",
|
|
description = "Klicken Sie auf den Standort, um ihn auf Ihrem GPS zu markieren.",
|
|
icon = "map",
|
|
iconColor = "#4CAF50",
|
|
},
|
|
table.unpack(huntingLocations),
|
|
}
|
|
})
|
|
cacheLocations = true
|
|
end
|
|
lib.showContext('gg_hunting_huntinglodgemenu_huntinglocation')
|
|
end
|
|
|
|
---------------------
|
|
-- Meat Locker Menu
|
|
---------------------
|
|
|
|
function openMeatLocker(data)
|
|
cachedLevel = data.level
|
|
lib.registerContext({
|
|
id = 'gg_hunting_meatlocker',
|
|
title = 'Fleischkühlhaus Menü',
|
|
options = {
|
|
{
|
|
title = 'Tiere im Kühlhaus',
|
|
description = 'Sehen Sie sich Ihre Tiere im Fleischkühlhaus an',
|
|
onSelect = function()
|
|
openMeatLocker_MeatLocker()
|
|
end,
|
|
icon = 'warehouse',
|
|
iconColor = '#D3A030',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Tiere verabeiten',
|
|
description = 'Wählen Sie ein zu verarbeitendes Tier aus',
|
|
onSelect = function()
|
|
openMeatLocker_ProcessAnimals()
|
|
end,
|
|
icon = 'cut',
|
|
iconColor = '#FA3434',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Tiere sofort verkaufen',
|
|
description = 'Wählen Sie ein Tier aus, das Sie an die Fleischkühlhaus verkaufen möchten',
|
|
onSelect = function()
|
|
openMeatLocker_SellAnimals()
|
|
end,
|
|
icon = 'money-bill-wave',
|
|
iconColor = '#6ADF3F',
|
|
arrow = true,
|
|
},
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_meatlocker')
|
|
end
|
|
|
|
function openMeatLocker_MeatLocker()
|
|
local meatLockerAnimals = {}
|
|
local success = lib.callback.await("gg_hunting:server:getAllAnimalMeatLocker", false)
|
|
if success.result then
|
|
table.insert(meatLockerAnimals, {
|
|
title = "Platz im Kühlhaus",
|
|
description = 'Verfügbarer Platz: _'..success.tableCount..'/'..Config.MeatlockerSettings.meatlockerSlots..'_',
|
|
icon = 'warehouse',
|
|
iconColor = '#D3A030',
|
|
})
|
|
for k,v in pairs(success.result) do
|
|
local disable = true
|
|
local readOnly = true
|
|
local iconColorSet, description, iconSet
|
|
if v.remainingTime == true then
|
|
disable = false
|
|
description = 'Fertig zum beanspruchen'
|
|
iconSet = 'fa-regular fa-square-check'
|
|
iconColorSet = '#86efac'
|
|
readOnly = false
|
|
else
|
|
description = "__Verbleibdende Zeit__: _" .. v.remainingTime .. "_"
|
|
iconSet = 'fa-regular fa-square'
|
|
iconColorSet = '#fca5a5'
|
|
end
|
|
local metaData = {
|
|
[i18n.translations[i18n.language].MetaNames.animal] = Config.Animals[v.name].label,
|
|
[i18n.translations[i18n.language].MetaNames.weight] = v.weight,
|
|
}
|
|
table.insert(meatLockerAnimals, {
|
|
title = Config.Animals[v.name].label,
|
|
description = description,
|
|
metadata = metaData,
|
|
disabled = false,
|
|
onSelect = function()
|
|
if v.remainingTime ~= true then return end
|
|
meatlockerRemoveAnimal(k)
|
|
end,
|
|
icon = iconSet,
|
|
iconColor = iconColorSet,
|
|
readOnly = readOnly,
|
|
})
|
|
end
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_meatlocker_submeatlocker',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_meatlocker',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(meatLockerAnimals),
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_meatlocker_submeatlocker')
|
|
end
|
|
|
|
|
|
function openMeatLocker_ProcessAnimals()
|
|
local processableAnimals = {}
|
|
-- local success, isTrunkFull = lib.callback.await("gg_hunting:server:getTrunkAnimals", false)
|
|
local success = getTrunkAnimalsNearLocation(GetEntityCoords(PlayerPedId()))
|
|
|
|
if success then
|
|
for k, v in pairs(success) do
|
|
if v.inRange then
|
|
table.insert(processableAnimals, {
|
|
title = i18n.translations[i18n.language].ContextMenus.title_meatlocker_animal_process,
|
|
|
|
description = string.format(i18n.translations[i18n.language].ContextMenus.description_meatlocker_animal_process, Config.Animals[v.typeOfAnimal].label, v.weight),
|
|
onSelect = function()
|
|
meatlockerAddAnimal(v)
|
|
end,
|
|
icon = 'warehouse',
|
|
iconColor = '#17C964',
|
|
})
|
|
end
|
|
end
|
|
end
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_meatlocker_subprocessanimals',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_meatlocker',
|
|
onBack = function() end,
|
|
options = {
|
|
{
|
|
title = 'Verabeitungs Informationen',
|
|
description = 'Übergeben Sie das Tier dem Fleischkühlhaus, um einen höheren Ertrag zu erzielen. Hinweis: Bringen Sie das Tier in die Nähe der Person, die es übergeben soll..',
|
|
icon = 'fa-circle-info',
|
|
},
|
|
table.unpack(processableAnimals)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_meatlocker_subprocessanimals')
|
|
end
|
|
|
|
function openMeatLocker_SellAnimals()
|
|
local processableAnimals = {}
|
|
-- local success, isTrunkFull = lib.callback.await("gg_hunting:server:getTrunkAnimals", false)
|
|
local success = getTrunkAnimalsNearLocation(GetEntityCoords(PlayerPedId()))
|
|
if success then
|
|
for k, v in pairs(success) do
|
|
if v.inRange then
|
|
table.insert(processableAnimals, {
|
|
title = i18n.translations[i18n.language].ContextMenus.title_meatlocker_animal_instasell,
|
|
-- description = "Animal: _"..Config.Animals[v.typeOfAnimal].label.."_ | Weight: _"..v.weight.."_",
|
|
description = string.format(i18n.translations[i18n.language].ContextMenus.description_meatlocker_animal_process, Config.Animals[v.typeOfAnimal].label, v.weight),
|
|
disabled = disable,
|
|
onSelect = function()
|
|
meatlockerInstaSell(v)
|
|
end,
|
|
icon = 'dollar-sign',
|
|
iconColor = '#17C964',
|
|
})
|
|
else
|
|
end
|
|
end
|
|
end
|
|
if not success and isTrunkFull then
|
|
table.insert(processableAnimals, {
|
|
title = "Bringen das Fahrzeug näher",
|
|
description = "Ihr Jagdfahrzeug ist außerhalb der Reichweite",
|
|
icon = 'dollar-sign',
|
|
iconColor = '#fca5a5',
|
|
readOnly = true,
|
|
})
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_meatlocker_subsellanimals',
|
|
title = 'Hunting Lodge Menü',
|
|
menu = 'gg_hunting_meatlocker',
|
|
onBack = function() end,
|
|
options = {
|
|
{
|
|
title = 'Verkaufs Informationen',
|
|
description = 'Verkaufen Sie das Tier sofort gegen Bargeld. Hinweis: Bringen Sie das Tier zur Übergabe in die Nähe einer Person..',
|
|
icon = 'fa-circle-info',
|
|
},
|
|
table.unpack(processableAnimals)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_meatlocker_subsellanimals')
|
|
end
|
|
|
|
|
|
---------------------
|
|
-- Illegal Hunter Menu
|
|
---------------------
|
|
|
|
function openIllegalHunter(data)
|
|
cachedLevel = data.level
|
|
lib.registerContext({
|
|
id = 'gg_hunting_illegalhunter',
|
|
title = 'Wilderer',
|
|
options = {
|
|
{
|
|
title = 'Level: '..data.level,
|
|
description = 'Fortschritt im Jagdlevel [ '..data.progress..'% ]',
|
|
progress = data.progress,
|
|
icon = 'user',
|
|
iconColor = '#d00b0b',
|
|
readOnly = true,
|
|
colorScheme = '#d00b0b',
|
|
},
|
|
{
|
|
title = 'Verkaufen deine illegalen Sachen',
|
|
description = 'Ich zahle mehr und kaufe mehr',
|
|
onSelect = function()
|
|
openIllegalHunter_SellAnimal()
|
|
end,
|
|
icon = 'dollar-sign',
|
|
iconColor = '#17C964',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Illegales Jagdgeschäft',
|
|
description = 'Kauf dir nützliche Sachen',
|
|
onSelect = function()
|
|
openIllegalHunter_HuntingSupplies()
|
|
end,
|
|
icon = 'shop',
|
|
iconColor = '#375A75',
|
|
arrow = true,
|
|
},
|
|
{
|
|
title = 'Jagdprämien',
|
|
description = 'Hol dir Jagdprämien',
|
|
onSelect = function()
|
|
openIllegalHunter_Bounties()
|
|
end,
|
|
icon = 'fa-bullseye',
|
|
iconColor = "#FACC15",
|
|
arrow = true,
|
|
},
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_illegalhunter')
|
|
end
|
|
|
|
function openIllegalHunter_SellAnimal()
|
|
local dataSellItems = {}
|
|
local success = lib.callback.await("gg_hunting:server:getSellableItems", false, "illegalhunter_menu")
|
|
if success then
|
|
for k,v in ipairs(success) do
|
|
local desc
|
|
table.insert(dataSellItems, {
|
|
title = v.label,
|
|
description = 'Sell Value: $'..v.value.. " ( Count: "..v.count.." )",
|
|
disabled = disable,
|
|
onSelect = function()
|
|
LodgeMenuSellItem(v.item, v.slot, "illegalhunter_menu")
|
|
end,
|
|
icon = Inventory.getRootImg(v.item),
|
|
image = Inventory.getRootImg(v.item),
|
|
})
|
|
end
|
|
else
|
|
table.insert(dataSellItems, {
|
|
title = 'Du hast nichts was mich interssiert...',
|
|
description = "Geh Jagen, und besorg was!",
|
|
icon = 'fa-square'
|
|
})
|
|
end
|
|
lib.registerContext({
|
|
id = 'gg_hunting_illegalhunter_sellanimal',
|
|
title = 'Wilderer',
|
|
menu = 'gg_hunting_illegalhunter',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(dataSellItems)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_illegalhunter_sellanimal')
|
|
|
|
end
|
|
|
|
function openIllegalHunter_HuntingSupplies()
|
|
local illegalShopData = {}
|
|
if Config.ShopHideLockedItems then
|
|
local levelDetection = 0
|
|
for k,v in ipairs(Config.Shop["illegalhunter_menu"]) do
|
|
local desc, disable = '', false
|
|
local titleSrc = Framework.getItemName(v.item)
|
|
local iconSrc = Inventory.getRootImg(v.item)
|
|
local imageSrc = Inventory.getRootImg(v.item)
|
|
if cachedLevel < v.level then
|
|
desc = 'Price: $'..formatNumberWithCommas(v.cost).. " | Wird Freigeschaltet auf Level "..v.level
|
|
disable = true
|
|
else
|
|
desc = 'Price: $'..formatNumberWithCommas(v.cost)
|
|
disable = false
|
|
end
|
|
if levelDetection >= 1 then
|
|
iconSrc = "fa-lock"
|
|
imageSrc = nil
|
|
desc = "Unlocks At Level "..v.level
|
|
disable = true
|
|
titleSrc = "Hidden"
|
|
end
|
|
table.insert(illegalShopData, {
|
|
title = titleSrc,
|
|
description = desc,
|
|
disabled = disable,
|
|
onSelect = function()
|
|
purchaseShopItem(k, "illegalhunter_menu")
|
|
|
|
end,
|
|
icon = iconSrc,
|
|
image = imageSrc,
|
|
})
|
|
if cachedLevel < v.level then
|
|
levelDetection += 1
|
|
end
|
|
end
|
|
else
|
|
for k,v in ipairs(Config.Shop["illegalhunter_menu"]) do
|
|
local desc, disable = '', false
|
|
if cachedLevel < v.level then
|
|
desc = 'Price: $'..formatNumberWithCommas(v.cost).. " ( Benötigt Level: "..v.level.." )"
|
|
disable = true
|
|
else
|
|
desc = 'Price: $'..formatNumberWithCommas(v.cost)
|
|
disable = false
|
|
end
|
|
table.insert(illegalShopData, {
|
|
title = v.item,
|
|
description = desc,
|
|
disabled = disable,
|
|
onSelect = function()
|
|
purchaseShopItem(k, "illegalhunter_menu")
|
|
end,
|
|
icon = Inventory.getRootImg(v.item),
|
|
image = Inventory.getRootImg(v.item),
|
|
})
|
|
end
|
|
end
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_illegalhunter_huntingsupplies',
|
|
title = 'Wilderer',
|
|
menu = 'gg_hunting_illegalhunter',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(illegalShopData)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_illegalhunter_huntingsupplies')
|
|
end
|
|
|
|
function openIllegalHunter_Bounties()
|
|
local bountiesMenu = {}
|
|
|
|
table.insert(bountiesMenu, {
|
|
title = "Liste der Kopfgelder",
|
|
description = "Alle einforderbaren Kopfgelder anzeigen",
|
|
icon = "fas fa-scroll",
|
|
iconColor = "#3B82F6",
|
|
onSelect = function()
|
|
openIllegalHunter_Bounties_List()
|
|
end,
|
|
})
|
|
|
|
table.insert(bountiesMenu, {
|
|
title = "Aktive Kopfgelder",
|
|
description = "Alle einforderbaren Kopfgelder anzeigen",
|
|
icon = "fas fa-bullseye",
|
|
iconColor = "#FACC15",
|
|
onSelect = function()
|
|
openIllegalHunter_Bounties_Active()
|
|
end,
|
|
})
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_illegalhunter_bountiesmenu',
|
|
title = 'Wilderer',
|
|
menu = 'gg_hunting_illegalhunter',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(bountiesMenu)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_illegalhunter_bountiesmenu')
|
|
end
|
|
|
|
function openIllegalHunter_Bounties_List()
|
|
local bountyList = {}
|
|
for k,v in pairs(Config.BountyList) do
|
|
if cachedLevel >= v.levelReq then
|
|
table.insert(bountyList, {
|
|
title = lang.MetaNames[string.lower(v.bountyType)].." "..v.amount.."x "..Config.Animals[v.target].label,
|
|
description = "Money: $"..formatNumberWithCommas(v.moneyReward).." | Experience: "..formatNumberWithCommas(v.experienceReward),
|
|
onSelect = function()
|
|
startBounty(k)
|
|
end,
|
|
icon = "fa-skull-crossbones",
|
|
iconColor = Config.BountyDifficulties[v.difficulty].iconColor,
|
|
})
|
|
else
|
|
table.insert(bountyList, {
|
|
title = "Versteckt",
|
|
description = ">Kopfgelder gibt es ab Level ".. v.levelReq,
|
|
readOnly = true,
|
|
icon = "fa-lock",
|
|
-- iconColor = Config.BountyDifficulties[v.difficulty].iconColor,
|
|
})
|
|
end
|
|
end
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_illegalhunter_bountiesmenu_bountylist',
|
|
title = 'Wilderer',
|
|
menu = 'gg_hunting_illegalhunter_bountiesmenu',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(bountyList)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_illegalhunter_bountiesmenu_bountylist')
|
|
end
|
|
|
|
|
|
function openIllegalHunter_Bounties_Active()
|
|
local activeBounty = {}
|
|
local result = lib.callback.await("gg_hunting:server:getBounty", false, selectedBounty)
|
|
|
|
if result then
|
|
local cdata = Config.BountyList[result.bounty]
|
|
if result.progressPercent >= 100 then
|
|
table.insert(activeBounty, {
|
|
title = cdata.bountyType.." "..cdata.amount.."x "..Config.Animals[cdata.target].label,
|
|
description = "Bereit zum Anspruch",
|
|
progress = result.progressPercent,
|
|
colorScheme = '#86efac',
|
|
onSelect = function()
|
|
claimBounty(result.bounty)
|
|
end,
|
|
icon = "fa-skull-crossbones",
|
|
iconColor = Config.BountyDifficulties[cdata.difficulty].iconColor,
|
|
})
|
|
else
|
|
table.insert(activeBounty, {
|
|
title = cdata.bountyType.." "..cdata.amount.."x "..Config.Animals[cdata.target].label,
|
|
description = "Kopfgeldfortschritt: ["..result.progress.." / "..cdata.amount.."]",
|
|
progress = result.progressPercent,
|
|
colorScheme = '#fca5a5',
|
|
readyOnly = true,
|
|
icon = "fa-skull-crossbones",
|
|
iconColor = Config.BountyDifficulties[cdata.difficulty].iconColor,
|
|
})
|
|
end
|
|
else
|
|
table.insert(activeBounty, {
|
|
title = "Kein aktives Kopfgeld",
|
|
description = "Wählen Sie ein Kopfgeld aus der Kopfgeldliste.",
|
|
readOnly = true,
|
|
icon = "fa-skull-crossbones",
|
|
})
|
|
end
|
|
|
|
lib.registerContext({
|
|
id = 'gg_hunting_illegalhunter_bountiesmenu_active',
|
|
title = 'Wilderer',
|
|
menu = 'gg_hunting_illegalhunter_bountiesmenu',
|
|
onBack = function() end,
|
|
options = {
|
|
table.unpack(activeBounty)
|
|
}
|
|
})
|
|
lib.showContext('gg_hunting_illegalhunter_bountiesmenu_active')
|
|
end |