diff --git a/resources/[Developer]/[Max]/Duck_new_wartung/config.lua b/resources/[Developer]/[Max]/Duck_new_wartung/config.lua index 9e577f4bc..97ea097bd 100644 --- a/resources/[Developer]/[Max]/Duck_new_wartung/config.lua +++ b/resources/[Developer]/[Max]/Duck_new_wartung/config.lua @@ -1,5 +1,5 @@ Config = { DiscordWebhook = "https://discord.com/api/webhooks/1383151445532086442/02u3NBPWov8pfKj8B-F-lyr-BH54hPgdCgROUqe6aZmVxLDChYCSSbyGkC7YPUtUYWzi", - WartungsNachricht = "🔧 Wartungsarbeiten 🔧\nDer Server wird jetzt gewartet!", + WartungsNachricht = "🔧 Wartungsarbeiten 🔧\nDer Server wird jetzt gewartet! >> Connect solange nicht Möglich!", ErlaubteRolle = "admin" } diff --git a/resources/[inventory]/qs-inventory/html/images/Ecola.png b/resources/[inventory]/qs-inventory/html/images/Ecola.png new file mode 100644 index 000000000..c8a1521f9 Binary files /dev/null and b/resources/[inventory]/qs-inventory/html/images/Ecola.png differ diff --git a/resources/[tools]/okokCrafting/.fxap b/resources/[test]/okokCrafting/.fxap similarity index 100% rename from resources/[tools]/okokCrafting/.fxap rename to resources/[test]/okokCrafting/.fxap diff --git a/resources/[tools]/okokCrafting/README.md b/resources/[test]/okokCrafting/README.md similarity index 94% rename from resources/[tools]/okokCrafting/README.md rename to resources/[test]/okokCrafting/README.md index 0bc65606b..7a9927879 100644 --- a/resources/[tools]/okokCrafting/README.md +++ b/resources/[test]/okokCrafting/README.md @@ -1,7 +1,7 @@ -Hi, thank you for buying okokCrafting! :) - -If you need help contact me on discord: okok#3488 -Discord server: https://discord.gg/okok -Docs: https://docs.okokscripts.io/ - +Hi, thank you for buying okokCrafting! :) + +If you need help contact me on discord: okok#3488 +Discord server: https://discord.gg/okok +Docs: https://docs.okokscripts.io/ + -> Installation Guide: https://docs.okokscripts.io/scripts/okokcrafting \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/cl_utils.lua b/resources/[test]/okokCrafting/cl_utils.lua similarity index 96% rename from resources/[tools]/okokCrafting/cl_utils.lua rename to resources/[test]/okokCrafting/cl_utils.lua index 9f1cab448..742c01a6c 100644 --- a/resources/[tools]/okokCrafting/cl_utils.lua +++ b/resources/[test]/okokCrafting/cl_utils.lua @@ -1,249 +1,249 @@ -QBCore = exports[Config.qbPrefix.."-core"]:GetCoreObject() - -RegisterNetEvent(Config.EventPrefix..":notification") -AddEventHandler(Config.EventPrefix..":notification", function(title, text, time, type) - exports['okokNotify']:Alert(title, text, time, type) -end) - -RegisterNetEvent(Config.EventPrefix..":openTextUI") -AddEventHandler(Config.EventPrefix..":openTextUI", function(text) - exports['qb-core']:DrawText(text, 'left') -end) - -RegisterNetEvent(Config.EventPrefix..":closeTextUI") -AddEventHandler(Config.EventPrefix..":closeTextUI", function() - exports['qb-core']:HideText() -end) - -function onOpenMenu() - -- Executed when the menu is opened -end - -function onCloseMenu() - -- Executed when the menu is closed -end - -function claimAll(workbench, CraftQueues) - TriggerServerEvent(Config.EventPrefix..':claimAll', workbench, CraftQueues) -end - -Citizen.CreateThread(function() - if Config.UseXP then - if Config.SameLevelForAllTables then - TriggerEvent('chat:addSuggestion', '/'..Config.SetXPCommand, _L('suggestion_xp').maintext, { - { name=_L('suggestion_xp').id, help=_L('suggestion_xp').idtext }, - { name=_L('suggestion_xp').xp, help=_L('suggestion_xp').xptext }, - }) - - TriggerEvent('chat:addSuggestion', '/'..Config.SetLevelCommand, _L('suggestion_level').maintext, { - { name=_L('suggestion_level').id, help=_L('suggestion_level').idtext }, - { name=_L('suggestion_level').level, help=_L('suggestion_level').leveltext }, - }) - else - TriggerEvent('chat:addSuggestion', '/'..Config.SetXPCommand, _L('suggestion_xp').maintext, { - { name=_L('suggestion_xp').id, help=_L('suggestion_xp').idtext }, - { name=_L('suggestion_xp').xp, help=_L('suggestion_xp').xptext }, - { name=_L('suggestion_xp').workbench, help=_L('suggestion_xp').workbenchtext }, - }) - - TriggerEvent('chat:addSuggestion', '/'..Config.SetLevelCommand, _L('suggestion_level').maintext, { - { name=_L('suggestion_level').id, help=_L('suggestion_level').idtext }, - { name=_L('suggestion_level').level, help=_L('suggestion_level').leveltext }, - { name=_L('suggestion_level').workbench, help=_L('suggestion_level').workbenchtext }, - }) - end - end -end) - -Citizen.CreateThread(function() - while PlayerData == nil do - PlayerData = QBCore.Functions.GetPlayerData() - Citizen.Wait(10) - end - while PlayerData.job == nil do - PlayerData.job = QBCore.Functions.GetPlayerData().job - Citizen.Wait(10) - end - while PlayerData.gang == nil do - PlayerData.gang = QBCore.Functions.GetPlayerData().gang - Citizen.Wait(10) - end - local inZone = false - local num = 0 - local nearZone = false - local enteredRange = false - local inWideRange = false - local ped = PlayerPedId() - - while true do - Citizen.Wait(0) - local playerExists = false - - if not playerExists then - if DoesEntityExist(ped) then - playerExists = true - else - ped = PlayerPedId() - end - end - local playerCoords = GetEntityCoords(ped) - - nearZone = false - inZone = false - - for k,v in pairs(Config.Crafting) do - if v.jobs['all'] ~= nil or checkJob(v.jobs) or checkGang(v.jobs) then - local distance = #(vector3(v.coordinates[1], v.coordinates[2], v.coordinates[3]) - playerCoords) - - if distance < Config.CraftRadius then - if closeWorkbench ~= v.tableID then - closeWorkbench = v.tableID - workbenchCoords = v.coordinates - end - - if not gotQueue then - gotQueue = true - QBCore.Functions.TriggerCallback(Config.EventPrefix..":getQueue", function(queue, queues) - CraftQueues = queues - WorkbenchCraft = queue - end, v.tableID) - end - end - - if distance < v.radius + 2 then - local zDistance = playerCoords.z - v.coordinates[3] - nearZone = true - if waitMore and not isCraftOpen then - waitMore = false - end - if not Config.NotInterectableTables then - if distance < v.radius and zDistance < 3 and zDistance > -3 then - inZone = true - - if IsControlJustReleased(0, Config.Key) and not IsEntityDead(ped) then - if GetVehiclePedIsUsing(ped) == 0 then - waitMore = true - if not isCraftOpen then - TriggerEvent(Config.EventPrefix..':openWorkbench', k) - end - else - TriggerEvent(Config.EventPrefix..':notification', _L('inside_vehicle').title, _L('inside_vehicle').text, _L('inside_vehicle').time, _L('inside_vehicle').type) - end - end - end - end - elseif not waitMore and not inWideRange then - waitMore = true - end - end - end - - if nearZone and not enteredRange then - enteredRange = true - inWideRange = true - elseif not nearZone and enteredRange then - enteredRange = false - inWideRange = false - end - - if inZone and not hasEntered then - if Config.UseOkokTextUI then - exports['okokTextUI']:Open(_L('textUI').text, _L('textUI').color, _L('textUI').side) - else - TriggerEvent(Config.EventPrefix..':openTextUI', _L('textUI').text) - end - hasEntered = true - elseif not inZone and hasEntered then - if Config.UseOkokTextUI then - exports['okokTextUI']:Close() - else - TriggerEvent(Config.EventPrefix..':closeTextUI') - end - hasEntered = false - end - - if waitMore then - Citizen.Wait(1000) - end - end -end) - -Citizen.CreateThread(function() - while true do - local canCraft = false - local queue = CraftQueues[closeWorkbench] - if CraftQueues[closeWorkbench] ~= nil and closeWorkbench ~= "" and workbenchCoords ~= nil then - local playerCoords = GetEntityCoords(PlayerPedId()) - local distance = #(vector3(workbenchCoords[1], workbenchCoords[2], workbenchCoords[3]) - playerCoords) - local zDistance = playerCoords.z - workbenchCoords[3] - - if distance < Config.CraftRadius then - local craftingItemID = 1 - for k,v in ipairs(CraftQueues[closeWorkbench]) do - if v.time >= 0 and not v.isDone then - craftingItemID = k - canCraft = true - break - end - end - if canCraft then - if not updateTable then - updateTable = true - end - local craftTime = CraftQueues[closeWorkbench][craftingItemID].time - CraftQueues[closeWorkbench][craftingItemID].isPending = false - SendNUIMessage({ - action = "ShowCraftCount", - time = CraftQueues[closeWorkbench][craftingItemID].time, - name = CraftQueues[closeWorkbench][craftingItemID].itemName, - }) - - if CraftQueues[closeWorkbench][craftingItemID].time <= 0 then - CraftQueues[closeWorkbench][craftingItemID].time = 0 - CraftQueues[closeWorkbench][craftingItemID].isDone = true - local randomNum = math.random(1, 100) - if randomNum <= tonumber(CraftQueues[closeWorkbench][craftingItemID].sucPC) then - SendNUIMessage({ - action = "CompleteCraftCount", - name = CraftQueues[closeWorkbench][craftingItemID].itemName, - }) - else - CraftQueues[closeWorkbench][craftingItemID].suc = false - SendNUIMessage({ - action = "FailedCraftCount", - name = CraftQueues[closeWorkbench][craftingItemID].itemName, - }) - end - SendNUIMessage({ - action = "updateCraftingItems", - queue = CraftQueues[closeWorkbench], - }) - SendNUIMessage({ - action = "HideCraftCount", - }) - Citizen.Wait(500) - else - SendNUIMessage({ - action = "updateCraftingItems", - queue = CraftQueues[closeWorkbench], - }) - CraftQueues[closeWorkbench][craftingItemID].time = craftTime - 1 - Citizen.Wait(1000) - end - else - if updateTable then - updateTable = false - QBCore.Functions.TriggerCallback(Config.EventPrefix..":updateQueue", function(cb) - - end, CraftQueues) - end - Citizen.Wait(2000) - end - else - Citizen.Wait(3000) - end - else - Citizen.Wait(5000) - end - end +QBCore = exports[Config.qbPrefix.."-core"]:GetCoreObject() + +RegisterNetEvent(Config.EventPrefix..":notification") +AddEventHandler(Config.EventPrefix..":notification", function(title, text, time, type) + exports['okokNotify']:Alert(title, text, time, type) +end) + +RegisterNetEvent(Config.EventPrefix..":openTextUI") +AddEventHandler(Config.EventPrefix..":openTextUI", function(text) + exports['qb-core']:DrawText(text, 'left') +end) + +RegisterNetEvent(Config.EventPrefix..":closeTextUI") +AddEventHandler(Config.EventPrefix..":closeTextUI", function() + exports['qb-core']:HideText() +end) + +function onOpenMenu() + -- Executed when the menu is opened +end + +function onCloseMenu() + -- Executed when the menu is closed +end + +function claimAll(workbench, CraftQueues) + TriggerServerEvent(Config.EventPrefix..':claimAll', workbench, CraftQueues) +end + +Citizen.CreateThread(function() + if Config.UseXP then + if Config.SameLevelForAllTables then + TriggerEvent('chat:addSuggestion', '/'..Config.SetXPCommand, _L('suggestion_xp').maintext, { + { name=_L('suggestion_xp').id, help=_L('suggestion_xp').idtext }, + { name=_L('suggestion_xp').xp, help=_L('suggestion_xp').xptext }, + }) + + TriggerEvent('chat:addSuggestion', '/'..Config.SetLevelCommand, _L('suggestion_level').maintext, { + { name=_L('suggestion_level').id, help=_L('suggestion_level').idtext }, + { name=_L('suggestion_level').level, help=_L('suggestion_level').leveltext }, + }) + else + TriggerEvent('chat:addSuggestion', '/'..Config.SetXPCommand, _L('suggestion_xp').maintext, { + { name=_L('suggestion_xp').id, help=_L('suggestion_xp').idtext }, + { name=_L('suggestion_xp').xp, help=_L('suggestion_xp').xptext }, + { name=_L('suggestion_xp').workbench, help=_L('suggestion_xp').workbenchtext }, + }) + + TriggerEvent('chat:addSuggestion', '/'..Config.SetLevelCommand, _L('suggestion_level').maintext, { + { name=_L('suggestion_level').id, help=_L('suggestion_level').idtext }, + { name=_L('suggestion_level').level, help=_L('suggestion_level').leveltext }, + { name=_L('suggestion_level').workbench, help=_L('suggestion_level').workbenchtext }, + }) + end + end +end) + +Citizen.CreateThread(function() + while PlayerData == nil do + PlayerData = QBCore.Functions.GetPlayerData() + Citizen.Wait(10) + end + while PlayerData.job == nil do + PlayerData.job = QBCore.Functions.GetPlayerData().job + Citizen.Wait(10) + end + while PlayerData.gang == nil do + PlayerData.gang = QBCore.Functions.GetPlayerData().gang + Citizen.Wait(10) + end + local inZone = false + local num = 0 + local nearZone = false + local enteredRange = false + local inWideRange = false + local ped = PlayerPedId() + + while true do + Citizen.Wait(0) + local playerExists = false + + if not playerExists then + if DoesEntityExist(ped) then + playerExists = true + else + ped = PlayerPedId() + end + end + local playerCoords = GetEntityCoords(ped) + + nearZone = false + inZone = false + + for k,v in pairs(Config.Crafting) do + if v.jobs['all'] ~= nil or checkJob(v.jobs) or checkGang(v.jobs) then + local distance = #(vector3(v.coordinates[1], v.coordinates[2], v.coordinates[3]) - playerCoords) + + if distance < Config.CraftRadius then + if closeWorkbench ~= v.tableID then + closeWorkbench = v.tableID + workbenchCoords = v.coordinates + end + + if not gotQueue then + gotQueue = true + QBCore.Functions.TriggerCallback(Config.EventPrefix..":getQueue", function(queue, queues) + CraftQueues = queues + WorkbenchCraft = queue + end, v.tableID) + end + end + + if distance < v.radius + 2 then + local zDistance = playerCoords.z - v.coordinates[3] + nearZone = true + if waitMore and not isCraftOpen then + waitMore = false + end + if not Config.NotInterectableTables then + if distance < v.radius and zDistance < 3 and zDistance > -3 then + inZone = true + + if IsControlJustReleased(0, Config.Key) and not IsEntityDead(ped) then + if GetVehiclePedIsUsing(ped) == 0 then + waitMore = true + if not isCraftOpen then + TriggerEvent(Config.EventPrefix..':openWorkbench', k) + end + else + TriggerEvent(Config.EventPrefix..':notification', _L('inside_vehicle').title, _L('inside_vehicle').text, _L('inside_vehicle').time, _L('inside_vehicle').type) + end + end + end + end + elseif not waitMore and not inWideRange then + waitMore = true + end + end + end + + if nearZone and not enteredRange then + enteredRange = true + inWideRange = true + elseif not nearZone and enteredRange then + enteredRange = false + inWideRange = false + end + + if inZone and not hasEntered then + if Config.UseOkokTextUI then + exports['okokTextUI']:Open(_L('textUI').text, _L('textUI').color, _L('textUI').side) + else + TriggerEvent(Config.EventPrefix..':openTextUI', _L('textUI').text) + end + hasEntered = true + elseif not inZone and hasEntered then + if Config.UseOkokTextUI then + exports['okokTextUI']:Close() + else + TriggerEvent(Config.EventPrefix..':closeTextUI') + end + hasEntered = false + end + + if waitMore then + Citizen.Wait(1000) + end + end +end) + +Citizen.CreateThread(function() + while true do + local canCraft = false + local queue = CraftQueues[closeWorkbench] + if CraftQueues[closeWorkbench] ~= nil and closeWorkbench ~= "" and workbenchCoords ~= nil then + local playerCoords = GetEntityCoords(PlayerPedId()) + local distance = #(vector3(workbenchCoords[1], workbenchCoords[2], workbenchCoords[3]) - playerCoords) + local zDistance = playerCoords.z - workbenchCoords[3] + + if distance < Config.CraftRadius then + local craftingItemID = 1 + for k,v in ipairs(CraftQueues[closeWorkbench]) do + if v.time >= 0 and not v.isDone then + craftingItemID = k + canCraft = true + break + end + end + if canCraft then + if not updateTable then + updateTable = true + end + local craftTime = CraftQueues[closeWorkbench][craftingItemID].time + CraftQueues[closeWorkbench][craftingItemID].isPending = false + SendNUIMessage({ + action = "ShowCraftCount", + time = CraftQueues[closeWorkbench][craftingItemID].time, + name = CraftQueues[closeWorkbench][craftingItemID].itemName, + }) + + if CraftQueues[closeWorkbench][craftingItemID].time <= 0 then + CraftQueues[closeWorkbench][craftingItemID].time = 0 + CraftQueues[closeWorkbench][craftingItemID].isDone = true + local randomNum = math.random(1, 100) + if randomNum <= tonumber(CraftQueues[closeWorkbench][craftingItemID].sucPC) then + SendNUIMessage({ + action = "CompleteCraftCount", + name = CraftQueues[closeWorkbench][craftingItemID].itemName, + }) + else + CraftQueues[closeWorkbench][craftingItemID].suc = false + SendNUIMessage({ + action = "FailedCraftCount", + name = CraftQueues[closeWorkbench][craftingItemID].itemName, + }) + end + SendNUIMessage({ + action = "updateCraftingItems", + queue = CraftQueues[closeWorkbench], + }) + SendNUIMessage({ + action = "HideCraftCount", + }) + Citizen.Wait(500) + else + SendNUIMessage({ + action = "updateCraftingItems", + queue = CraftQueues[closeWorkbench], + }) + CraftQueues[closeWorkbench][craftingItemID].time = craftTime - 1 + Citizen.Wait(1000) + end + else + if updateTable then + updateTable = false + QBCore.Functions.TriggerCallback(Config.EventPrefix..":updateQueue", function(cb) + + end, CraftQueues) + end + Citizen.Wait(2000) + end + else + Citizen.Wait(3000) + end + else + Citizen.Wait(5000) + end + end end) \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/client.lua b/resources/[test]/okokCrafting/client.lua similarity index 100% rename from resources/[tools]/okokCrafting/client.lua rename to resources/[test]/okokCrafting/client.lua diff --git a/resources/[tools]/okokCrafting/config.lua b/resources/[test]/okokCrafting/config.lua similarity index 100% rename from resources/[tools]/okokCrafting/config.lua rename to resources/[test]/okokCrafting/config.lua diff --git a/resources/[tools]/okokCrafting/fxmanifest.lua b/resources/[test]/okokCrafting/fxmanifest.lua similarity index 88% rename from resources/[tools]/okokCrafting/fxmanifest.lua rename to resources/[test]/okokCrafting/fxmanifest.lua index 82dc1e747..034a67ca3 100644 --- a/resources/[tools]/okokCrafting/fxmanifest.lua +++ b/resources/[test]/okokCrafting/fxmanifest.lua @@ -1,42 +1,42 @@ -fx_version 'cerulean' - -game 'gta5' - -author 'okok#3488' -description 'okokCrafting' -version '1.1.0' - -ui_page 'web/ui.html' - -files { - 'web/*.*', -} - -shared_script 'config.lua' - -client_scripts { - 'locales/*.lua', - 'cl_utils.lua', - 'client.lua', -} - -server_scripts { - '@oxmysql/lib/MySQL.lua', - 'locales/*.lua', - 'sv_utils.lua', - 'server.lua' -} - -lua54 'yes' - -escrow_ignore { - 'config.lua', - 'cl_utils.lua', - 'sv_utils.lua', - 'locales/*.lua', -} - -server_exports { - 'SetLevel' +fx_version 'cerulean' + +game 'gta5' + +author 'okok#3488' +description 'okokCrafting' +version '1.1.0' + +ui_page 'web/ui.html' + +files { + 'web/*.*', +} + +shared_script 'config.lua' + +client_scripts { + 'locales/*.lua', + 'cl_utils.lua', + 'client.lua', +} + +server_scripts { + '@oxmysql/lib/MySQL.lua', + 'locales/*.lua', + 'sv_utils.lua', + 'server.lua' +} + +lua54 'yes' + +escrow_ignore { + 'config.lua', + 'cl_utils.lua', + 'sv_utils.lua', + 'locales/*.lua', +} + +server_exports { + 'SetLevel' } dependency '/assetpacks' \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/locales/de.lua b/resources/[test]/okokCrafting/locales/de.lua similarity index 95% rename from resources/[tools]/okokCrafting/locales/de.lua rename to resources/[test]/okokCrafting/locales/de.lua index 7c65ed3cb..0383f3044 100644 --- a/resources/[tools]/okokCrafting/locales/de.lua +++ b/resources/[test]/okokCrafting/locales/de.lua @@ -1,133 +1,133 @@ -Locales['de'] = { - - -- Notifications - ['user_xp_set'] = { - title = 'WERKBANK', - text = 'Deine Erfahrungspunkte wurden auf ${s1} gesetzt', - time = 5000, - type = 'info' - }, - ['admin_xp_set'] = { - title = 'WERKBANK', - text = 'Du hast erfolgreich die Erfahrungspunkte von ${s1} zu ${s2} geändert', - time = 5000, - type = 'success' - }, - ['user_xp_set_workbench'] = { - title = 'WERKBANK', - text = 'Deine Erfahrungspunkte wurden in der Werkbank ${s2} auf ${s1} gesetzt', - time = 5000, - type = 'info' - }, - ['admin_xp_set_workbench'] = { - title = 'WERKBANK', - text = 'Du hast erfolgreich die Erfahrungspunkte von ${s1}, in der Werkbank ${s3}, auf ${s2} gesetzt', - time = 5000, - type = 'success' - }, - ['user_level_set'] = { - title = 'WERKBANK', - text = 'Dein Level wurde auf ${s1} geändert', - time = 5000, - type = 'info' - }, - ['admin_level_set'] = { - title = 'WERKBANK', - text = 'Du hast erfolgreich das Level von ${s1} auf ${s2} geändert', - time = 5000, - type = 'success' - }, - ['user_level_set_workbench'] = { - title = 'WERKBANK', - text = 'Dein Level wurde in der Werkbank ${s2} auf ${s1} geändert', - time = 5000, - type = 'info' - }, - ['admin_level_set_workbench'] = { - title = 'WERKBANK', - text = 'Du hast erfolgreich das Level von ${s1}, in der Werkbank ${s3}, auf ${s2} geändert', - time = 5000, - type = 'success' - }, - ['admin_level_no_exist'] = { - title = 'WERKBANK', - text = 'Dieses Level existiert nicht', - time = 5000, - type = 'error' - }, - ['cant_carry'] = { - title = 'WERKBANK', - text = "Du kannst diesen Gegenstand nicht bei dir tragen", - time = 5000, - type = 'error' - }, - ['added_to_queue'] = { - title = 'WERKBANK', - text = '${s1} wurde zur Warteschlange hinzugefügt', - time = 5000, - type = 'success' - }, - ['cant_craft'] = { - title = 'WERKBANK', - text = "Du kannst ${s1} nicht herstellen", - time = 5000, - type = 'error' - }, - ['inside_vehicle'] = { - title = 'WERKBANK', - text = "Du kannst nichts in einem Fahrzeug herstellen", - time = 5000, - type = 'error' - }, - ['queue_limit'] = { - title = 'WERKBANK', - text = 'Die Warteschlange ist bereits voll', - time = 5000, - type = 'error' - }, - ['claimed_item'] = { - title = 'WERKBANK', - text = 'Du hast ${s1} bekommen', - time = 5000, - type = 'success' - }, - ['claimed_all_items'] = { - title = 'WERKBANK', - text = 'Du hast alle Gegenstände bekommen', - time = 5000, - type = 'success' - }, - ['cancel_item'] = { - title = 'WERKBANK', - text = 'Du hast die Herstellung von ${s1} abgebrochen', - time = 5000, - type = 'error' - }, - - -- Chat suggestions - ['suggestion_xp'] = { - maintext = 'Ändere das XP eines Spieler', - id = 'ID', - idtext = "Ziel ID", - xp = 'XP', - xptext = 'XP menge', - workbench = 'Werkbank', - workbenchtext = "ID der Werkbank", - }, - ['suggestion_level'] = { - maintext = 'Ändere das Level eines Spielers', - id = 'ID', - idtext = "Ziel ID", - level = 'Level', - leveltext = 'Level', - workbench = 'Werkbank', - workbenchtext = "ID der Werkbank", - }, - - -- okokTextUI - ['textUI'] = { - text = '[E] Werkbank zu öffnen', - color = 'darkblue', - side = 'left' - }, +Locales['de'] = { + + -- Notifications + ['user_xp_set'] = { + title = 'WERKBANK', + text = 'Deine Erfahrungspunkte wurden auf ${s1} gesetzt', + time = 5000, + type = 'info' + }, + ['admin_xp_set'] = { + title = 'WERKBANK', + text = 'Du hast erfolgreich die Erfahrungspunkte von ${s1} zu ${s2} geändert', + time = 5000, + type = 'success' + }, + ['user_xp_set_workbench'] = { + title = 'WERKBANK', + text = 'Deine Erfahrungspunkte wurden in der Werkbank ${s2} auf ${s1} gesetzt', + time = 5000, + type = 'info' + }, + ['admin_xp_set_workbench'] = { + title = 'WERKBANK', + text = 'Du hast erfolgreich die Erfahrungspunkte von ${s1}, in der Werkbank ${s3}, auf ${s2} gesetzt', + time = 5000, + type = 'success' + }, + ['user_level_set'] = { + title = 'WERKBANK', + text = 'Dein Level wurde auf ${s1} geändert', + time = 5000, + type = 'info' + }, + ['admin_level_set'] = { + title = 'WERKBANK', + text = 'Du hast erfolgreich das Level von ${s1} auf ${s2} geändert', + time = 5000, + type = 'success' + }, + ['user_level_set_workbench'] = { + title = 'WERKBANK', + text = 'Dein Level wurde in der Werkbank ${s2} auf ${s1} geändert', + time = 5000, + type = 'info' + }, + ['admin_level_set_workbench'] = { + title = 'WERKBANK', + text = 'Du hast erfolgreich das Level von ${s1}, in der Werkbank ${s3}, auf ${s2} geändert', + time = 5000, + type = 'success' + }, + ['admin_level_no_exist'] = { + title = 'WERKBANK', + text = 'Dieses Level existiert nicht', + time = 5000, + type = 'error' + }, + ['cant_carry'] = { + title = 'WERKBANK', + text = "Du kannst diesen Gegenstand nicht bei dir tragen", + time = 5000, + type = 'error' + }, + ['added_to_queue'] = { + title = 'WERKBANK', + text = '${s1} wurde zur Warteschlange hinzugefügt', + time = 5000, + type = 'success' + }, + ['cant_craft'] = { + title = 'WERKBANK', + text = "Du kannst ${s1} nicht herstellen", + time = 5000, + type = 'error' + }, + ['inside_vehicle'] = { + title = 'WERKBANK', + text = "Du kannst nichts in einem Fahrzeug herstellen", + time = 5000, + type = 'error' + }, + ['queue_limit'] = { + title = 'WERKBANK', + text = 'Die Warteschlange ist bereits voll', + time = 5000, + type = 'error' + }, + ['claimed_item'] = { + title = 'WERKBANK', + text = 'Du hast ${s1} bekommen', + time = 5000, + type = 'success' + }, + ['claimed_all_items'] = { + title = 'WERKBANK', + text = 'Du hast alle Gegenstände bekommen', + time = 5000, + type = 'success' + }, + ['cancel_item'] = { + title = 'WERKBANK', + text = 'Du hast die Herstellung von ${s1} abgebrochen', + time = 5000, + type = 'error' + }, + + -- Chat suggestions + ['suggestion_xp'] = { + maintext = 'Ändere das XP eines Spieler', + id = 'ID', + idtext = "Ziel ID", + xp = 'XP', + xptext = 'XP menge', + workbench = 'Werkbank', + workbenchtext = "ID der Werkbank", + }, + ['suggestion_level'] = { + maintext = 'Ändere das Level eines Spielers', + id = 'ID', + idtext = "Ziel ID", + level = 'Level', + leveltext = 'Level', + workbench = 'Werkbank', + workbenchtext = "ID der Werkbank", + }, + + -- okokTextUI + ['textUI'] = { + text = '[E] Werkbank zu öffnen', + color = 'darkblue', + side = 'left' + }, } \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/locales/en.lua b/resources/[test]/okokCrafting/locales/en.lua similarity index 95% rename from resources/[tools]/okokCrafting/locales/en.lua rename to resources/[test]/okokCrafting/locales/en.lua index ced19755a..d1eb65461 100644 --- a/resources/[tools]/okokCrafting/locales/en.lua +++ b/resources/[test]/okokCrafting/locales/en.lua @@ -1,133 +1,133 @@ -Locales['en'] = { - - -- Notifications - ['user_xp_set'] = { - title = 'CRAFTING', - text = 'Your XP was set to ${s1}', - time = 5000, - type = 'info' - }, - ['admin_xp_set'] = { - title = 'CRAFTING', - text = 'You set the XP of ${s1} to ${s2} successfully', - time = 5000, - type = 'success' - }, - ['user_xp_set_workbench'] = { - title = 'CRAFTING', - text = 'Your XP was set to ${s1} in ${s2}', - time = 5000, - type = 'info' - }, - ['admin_xp_set_workbench'] = { - title = 'CRAFTING', - text = 'You set the XP of ${s1} to ${s2} in ${s3} successfully', - time = 5000, - type = 'success' - }, - ['user_level_set'] = { - title = 'CRAFTING', - text = 'Your level was set to ${s1}', - time = 5000, - type = 'info' - }, - ['admin_level_set'] = { - title = 'CRAFTING', - text = 'You set the level of ${s1} to ${s2} successfully', - time = 5000, - type = 'success' - }, - ['user_level_set_workbench'] = { - title = 'CRAFTING', - text = 'Your level was set to ${s1} in ${s2}', - time = 5000, - type = 'info' - }, - ['admin_level_set_workbench'] = { - title = 'CRAFTING', - text = 'You set the level of ${s1} to ${s2} in ${s3} successfully', - time = 5000, - type = 'success' - }, - ['admin_level_no_exist'] = { - title = 'CRAFTING', - text = 'That level does not exist', - time = 5000, - type = 'error' - }, - ['cant_carry'] = { - title = 'CRAFTING', - text = "You can't carry this item", - time = 5000, - type = 'error' - }, - ['added_to_queue'] = { - title = 'CRAFTING', - text = '${s1} added to the crafting queue', - time = 5000, - type = 'success' - }, - ['cant_craft'] = { - title = 'CRAFTING', - text = "You can't craft ${s1}", - time = 5000, - type = 'error' - }, - ['inside_vehicle'] = { - title = 'CRAFTING', - text = "You can't craft inside a vehicle", - time = 5000, - type = 'error' - }, - ['queue_limit'] = { - title = 'CRAFTING', - text = 'You have reached the queue limit', - time = 5000, - type = 'error' - }, - ['claimed_item'] = { - title = 'CRAFTING', - text = 'You have claimed ${s1}', - time = 5000, - type = 'success' - }, - ['claimed_all_items'] = { - title = 'CRAFTING', - text = 'You have claimed all items', - time = 5000, - type = 'success' - }, - ['cancel_item'] = { - title = 'CRAFTING', - text = 'You canceled a crafting of ${s1}', - time = 5000, - type = 'error' - }, - - -- Chat suggestions - ['suggestion_xp'] = { - maintext = 'Set a players crafting XP', - id = 'id', - idtext = "Target's id", - xp = 'XP', - xptext = 'XP amount', - workbench = 'workbench', - workbenchtext = "Workbenche's id", - }, - ['suggestion_level'] = { - maintext = 'Set a players crafting Level', - id = 'id', - idtext = "Target's id", - level = 'Level', - leveltext = 'Level', - workbench = 'workbench', - workbenchtext = "Workbenche's id", - }, - - -- okokTextUI - ['textUI'] = { - text = '[E] Open crafting table', - color = 'darkblue', - side = 'left' - }, +Locales['en'] = { + + -- Notifications + ['user_xp_set'] = { + title = 'CRAFTING', + text = 'Your XP was set to ${s1}', + time = 5000, + type = 'info' + }, + ['admin_xp_set'] = { + title = 'CRAFTING', + text = 'You set the XP of ${s1} to ${s2} successfully', + time = 5000, + type = 'success' + }, + ['user_xp_set_workbench'] = { + title = 'CRAFTING', + text = 'Your XP was set to ${s1} in ${s2}', + time = 5000, + type = 'info' + }, + ['admin_xp_set_workbench'] = { + title = 'CRAFTING', + text = 'You set the XP of ${s1} to ${s2} in ${s3} successfully', + time = 5000, + type = 'success' + }, + ['user_level_set'] = { + title = 'CRAFTING', + text = 'Your level was set to ${s1}', + time = 5000, + type = 'info' + }, + ['admin_level_set'] = { + title = 'CRAFTING', + text = 'You set the level of ${s1} to ${s2} successfully', + time = 5000, + type = 'success' + }, + ['user_level_set_workbench'] = { + title = 'CRAFTING', + text = 'Your level was set to ${s1} in ${s2}', + time = 5000, + type = 'info' + }, + ['admin_level_set_workbench'] = { + title = 'CRAFTING', + text = 'You set the level of ${s1} to ${s2} in ${s3} successfully', + time = 5000, + type = 'success' + }, + ['admin_level_no_exist'] = { + title = 'CRAFTING', + text = 'That level does not exist', + time = 5000, + type = 'error' + }, + ['cant_carry'] = { + title = 'CRAFTING', + text = "You can't carry this item", + time = 5000, + type = 'error' + }, + ['added_to_queue'] = { + title = 'CRAFTING', + text = '${s1} added to the crafting queue', + time = 5000, + type = 'success' + }, + ['cant_craft'] = { + title = 'CRAFTING', + text = "You can't craft ${s1}", + time = 5000, + type = 'error' + }, + ['inside_vehicle'] = { + title = 'CRAFTING', + text = "You can't craft inside a vehicle", + time = 5000, + type = 'error' + }, + ['queue_limit'] = { + title = 'CRAFTING', + text = 'You have reached the queue limit', + time = 5000, + type = 'error' + }, + ['claimed_item'] = { + title = 'CRAFTING', + text = 'You have claimed ${s1}', + time = 5000, + type = 'success' + }, + ['claimed_all_items'] = { + title = 'CRAFTING', + text = 'You have claimed all items', + time = 5000, + type = 'success' + }, + ['cancel_item'] = { + title = 'CRAFTING', + text = 'You canceled a crafting of ${s1}', + time = 5000, + type = 'error' + }, + + -- Chat suggestions + ['suggestion_xp'] = { + maintext = 'Set a players crafting XP', + id = 'id', + idtext = "Target's id", + xp = 'XP', + xptext = 'XP amount', + workbench = 'workbench', + workbenchtext = "Workbenche's id", + }, + ['suggestion_level'] = { + maintext = 'Set a players crafting Level', + id = 'id', + idtext = "Target's id", + level = 'Level', + leveltext = 'Level', + workbench = 'workbench', + workbenchtext = "Workbenche's id", + }, + + -- okokTextUI + ['textUI'] = { + text = '[E] Open crafting table', + color = 'darkblue', + side = 'left' + }, } \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/locales/fr.lua b/resources/[test]/okokCrafting/locales/fr.lua similarity index 95% rename from resources/[tools]/okokCrafting/locales/fr.lua rename to resources/[test]/okokCrafting/locales/fr.lua index 6f2ba266b..d2f39a177 100644 --- a/resources/[tools]/okokCrafting/locales/fr.lua +++ b/resources/[test]/okokCrafting/locales/fr.lua @@ -1,133 +1,133 @@ -Locales['fr'] = { - - -- Notifications - ['user_xp_set'] = { - title = 'CRAFTING', - text = 'Votre XP a été défini sur ${s1}', - time = 5000, - type = 'info' - }, - ['admin_xp_set'] = { - title = 'CRAFTING', - text = 'Vous avez défini XP de ${s1} sur ${s2} avec succès', - time = 5000, - type = 'success' - }, - ['user_xp_set_workbench'] = { - title = 'CRAFTING', - text = 'Votre XP a été défini de ${s1} en ${s2}', - time = 5000, - type = 'info' - }, - ['admin_xp_set_workbench'] = { - title = 'CRAFTING', - text = 'Vous avez défini XP de ${s1} sur ${s2} en ${s3} avec succès', - time = 5000, - type = 'success' - }, - ['user_level_set'] = { - title = 'CRAFTING', - text = 'Votre niveau a été défini sur ${s1}', - time = 5000, - type = 'info' - }, - ['admin_level_set'] = { - title = 'CRAFTING', - text = 'Vous avez défini le niveau de ${s1} sur ${s2} avec succès', - time = 5000, - type = 'success' - }, - ['user_level_set_workbench'] = { - title = 'CRAFTING', - text = 'Votre niveau a été défini sur ${s1} en ${s2}', - time = 5000, - type = 'info' - }, - ['admin_level_set_workbench'] = { - title = 'CRAFTING', - text = 'Vous avez défini le niveau de ${s1} sur ${s2} en ${s3} avec succès', - time = 5000, - type = 'success' - }, - ['admin_level_no_exist'] = { - title = 'CRAFTING', - text = 'Ce niveau n\'existe pas', - time = 5000, - type = 'error' - }, - ['cant_carry'] = { - title = 'CRAFTING', - text = "Cet objet est trop lourd ! Impossible de le porter", - time = 5000, - type = 'error' - }, - ['added_to_queue'] = { - title = 'CRAFTING', - text = '${s1} ajouté à la file de fabrication', - time = 5000, - type = 'success' - }, - ['cant_craft'] = { - title = 'CRAFTING', - text = "Vous ne pouvez pas fabriquer ${s1}", - time = 5000, - type = 'error' - }, - ['inside_vehicle'] = { - title = 'CRAFTING', - text = "Vous ne pouvez pas fabriquer à l\'intérieur d'un véhicule", - time = 5000, - type = 'error' - }, - ['queue_limit'] = { - title = 'CRAFTING', - text = 'Vous avez atteint la limite de la file de fabrication', - time = 5000, - type = 'error' - }, - ['claimed_item'] = { - title = 'CRAFTING', - text = 'Vous avez reçu ${s1}', - time = 5000, - type = 'success' - }, - ['claimed_all_items'] = { - title = 'CRAFTING', - text = 'Vous avez tout reçu', - time = 5000, - type = 'success' - }, - ['cancel_item'] = { - title = 'CRAFTING', - text = 'Vous avez annulé la fabrication de ${s1}', - time = 5000, - type = 'error' - }, - - -- Chat suggestions - ['suggestion_xp'] = { - maintext = 'Définissez un joueur fabriquant de l\'XP', - id = 'id', - idtext = "ID de la cible", - xp = 'XP', - xptext = 'Montant d\'XP', - workbench = 'workbench', - workbenchtext = "ID des établis", - }, - ['suggestion_level'] = { - maintext = 'Définissez le niveau de craft des joueurs', - id = 'id', - idtext = "ID de la cible", - level = 'Level', - leveltext = 'Niveau', - workbench = 'workbench', - workbenchtext = "ID des établis", - }, - - -- okokTextUI - ['textUI'] = { - text = '[E] Ouvrir l\'établi', - color = 'darkblue', - side = 'left' - }, +Locales['fr'] = { + + -- Notifications + ['user_xp_set'] = { + title = 'CRAFTING', + text = 'Votre XP a été défini sur ${s1}', + time = 5000, + type = 'info' + }, + ['admin_xp_set'] = { + title = 'CRAFTING', + text = 'Vous avez défini XP de ${s1} sur ${s2} avec succès', + time = 5000, + type = 'success' + }, + ['user_xp_set_workbench'] = { + title = 'CRAFTING', + text = 'Votre XP a été défini de ${s1} en ${s2}', + time = 5000, + type = 'info' + }, + ['admin_xp_set_workbench'] = { + title = 'CRAFTING', + text = 'Vous avez défini XP de ${s1} sur ${s2} en ${s3} avec succès', + time = 5000, + type = 'success' + }, + ['user_level_set'] = { + title = 'CRAFTING', + text = 'Votre niveau a été défini sur ${s1}', + time = 5000, + type = 'info' + }, + ['admin_level_set'] = { + title = 'CRAFTING', + text = 'Vous avez défini le niveau de ${s1} sur ${s2} avec succès', + time = 5000, + type = 'success' + }, + ['user_level_set_workbench'] = { + title = 'CRAFTING', + text = 'Votre niveau a été défini sur ${s1} en ${s2}', + time = 5000, + type = 'info' + }, + ['admin_level_set_workbench'] = { + title = 'CRAFTING', + text = 'Vous avez défini le niveau de ${s1} sur ${s2} en ${s3} avec succès', + time = 5000, + type = 'success' + }, + ['admin_level_no_exist'] = { + title = 'CRAFTING', + text = 'Ce niveau n\'existe pas', + time = 5000, + type = 'error' + }, + ['cant_carry'] = { + title = 'CRAFTING', + text = "Cet objet est trop lourd ! Impossible de le porter", + time = 5000, + type = 'error' + }, + ['added_to_queue'] = { + title = 'CRAFTING', + text = '${s1} ajouté à la file de fabrication', + time = 5000, + type = 'success' + }, + ['cant_craft'] = { + title = 'CRAFTING', + text = "Vous ne pouvez pas fabriquer ${s1}", + time = 5000, + type = 'error' + }, + ['inside_vehicle'] = { + title = 'CRAFTING', + text = "Vous ne pouvez pas fabriquer à l\'intérieur d'un véhicule", + time = 5000, + type = 'error' + }, + ['queue_limit'] = { + title = 'CRAFTING', + text = 'Vous avez atteint la limite de la file de fabrication', + time = 5000, + type = 'error' + }, + ['claimed_item'] = { + title = 'CRAFTING', + text = 'Vous avez reçu ${s1}', + time = 5000, + type = 'success' + }, + ['claimed_all_items'] = { + title = 'CRAFTING', + text = 'Vous avez tout reçu', + time = 5000, + type = 'success' + }, + ['cancel_item'] = { + title = 'CRAFTING', + text = 'Vous avez annulé la fabrication de ${s1}', + time = 5000, + type = 'error' + }, + + -- Chat suggestions + ['suggestion_xp'] = { + maintext = 'Définissez un joueur fabriquant de l\'XP', + id = 'id', + idtext = "ID de la cible", + xp = 'XP', + xptext = 'Montant d\'XP', + workbench = 'workbench', + workbenchtext = "ID des établis", + }, + ['suggestion_level'] = { + maintext = 'Définissez le niveau de craft des joueurs', + id = 'id', + idtext = "ID de la cible", + level = 'Level', + leveltext = 'Niveau', + workbench = 'workbench', + workbenchtext = "ID des établis", + }, + + -- okokTextUI + ['textUI'] = { + text = '[E] Ouvrir l\'établi', + color = 'darkblue', + side = 'left' + }, } \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/locales/gr.lua b/resources/[test]/okokCrafting/locales/gr.lua similarity index 96% rename from resources/[tools]/okokCrafting/locales/gr.lua rename to resources/[test]/okokCrafting/locales/gr.lua index 88e31170b..64ea4e162 100644 --- a/resources/[tools]/okokCrafting/locales/gr.lua +++ b/resources/[test]/okokCrafting/locales/gr.lua @@ -1,133 +1,133 @@ -Locales['gr'] = { - - -- Notifications - ['user_xp_set'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Το XP σας ορίστηκε σε ${s1}', - time = 5000, - type = 'info' - }, - ['admin_xp_set'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Ρυθμίζετε το XP του ${s1} σε ${s2} με επιτυχία', - time = 5000, - type = 'success' - }, - ['user_xp_set_workbench'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Το XP σας ορίστηκε σε ${s1} σε ${s2}', - time = 5000, - type = 'info' - }, - ['admin_xp_set_workbench'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Ρυθμίζετε το XP του ${s1} προς ${s2} σε ${s3} με επιτυχία', - time = 5000, - type = 'success' - }, - ['user_level_set'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Το επίπεδό σας ορίστηκε σε ${s1}', - time = 5000, - type = 'info' - }, - ['admin_level_set'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Ρυθμίσετε το επίπεδο του ${s1} προς ${s2} με επιτυχία', - time = 5000, - type = 'success' - }, - ['user_level_set_workbench'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Το επίπεδό σας ορίστηκε σε ${s1} in ${s2}', - time = 5000, - type = 'info' - }, - ['admin_level_set_workbench'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Ρυθμίσετε το επίπεδο του ${s1} προς ${s2} σε ${s3} με επιτυχία', - time = 5000, - type = 'success' - }, - ['admin_level_no_exist'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Αυτό το επίπεδο δεν υπάρχει', - time = 5000, - type = 'error' - }, - ['cant_carry'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = "Δεν μπορείτε να μεταφέρετε αυτό το αντικείμενο", - time = 5000, - type = 'error' - }, - ['added_to_queue'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = '${s1} προστέθηκε στην ουρά χειροτεχνίας', - time = 5000, - type = 'success' - }, - ['cant_craft'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = "Δεν μπορείς να χειροτεχνήσεις ${s1}", - time = 5000, - type = 'error' - }, - ['inside_vehicle'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = "Δεν μπορείτε να κάνετε χειροτεχνία μέσα σε ένα όχημα", - time = 5000, - type = 'error' - }, - ['queue_limit'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Έχετε φτάσει το όριο της ουράς', - time = 5000, - type = 'error' - }, - ['claimed_item'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Έχετε διεκδικήσει ${s1}', - time = 5000, - type = 'success' - }, - ['claimed_all_items'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Έχετε διεκδικήσει όλα τα στοιχεία', - time = 5000, - type = 'success' - }, - ['cancel_item'] = { - title = 'ΚΑΤΑΣΚΕΥΗ', - text = 'Ακυρώσατε μια δημιουργία του ${s1}', - time = 5000, - type = 'error' - }, - - -- Chat suggestions - ['suggestion_xp'] = { - maintext = 'Ρυθμίσετε το επίπεδο του παίκτη', - id = 'ταυτότητα', - idtext = "Ταυτότητα στόχου", - xp = 'XP', - xptext = 'XP ποσό', - workbench = 'πάγκος εργασίας', - workbenchtext = "Ταυτότητα πάγκων εργασίας", - }, - ['suggestion_level'] = { - maintext = 'Ρυθμίσετε το επίπεδο του παίκτη', - id = 'ταυτότητα', - idtext = "Ταυτότητα στόχου", - level = 'Επίπεδο', - leveltext = 'Επίπεδο', - workbench = 'πάγκος εργασίας', - workbenchtext = "Ταυτότητα πάγκων εργασίας", - }, - - -- okokTextUI - ['textUI'] = { - text = '[E] Να ανοίξω το τραπέζι χειροτεχνίας', - color = 'darkblue', - side = 'left' - }, +Locales['gr'] = { + + -- Notifications + ['user_xp_set'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Το XP σας ορίστηκε σε ${s1}', + time = 5000, + type = 'info' + }, + ['admin_xp_set'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Ρυθμίζετε το XP του ${s1} σε ${s2} με επιτυχία', + time = 5000, + type = 'success' + }, + ['user_xp_set_workbench'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Το XP σας ορίστηκε σε ${s1} σε ${s2}', + time = 5000, + type = 'info' + }, + ['admin_xp_set_workbench'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Ρυθμίζετε το XP του ${s1} προς ${s2} σε ${s3} με επιτυχία', + time = 5000, + type = 'success' + }, + ['user_level_set'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Το επίπεδό σας ορίστηκε σε ${s1}', + time = 5000, + type = 'info' + }, + ['admin_level_set'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Ρυθμίσετε το επίπεδο του ${s1} προς ${s2} με επιτυχία', + time = 5000, + type = 'success' + }, + ['user_level_set_workbench'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Το επίπεδό σας ορίστηκε σε ${s1} in ${s2}', + time = 5000, + type = 'info' + }, + ['admin_level_set_workbench'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Ρυθμίσετε το επίπεδο του ${s1} προς ${s2} σε ${s3} με επιτυχία', + time = 5000, + type = 'success' + }, + ['admin_level_no_exist'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Αυτό το επίπεδο δεν υπάρχει', + time = 5000, + type = 'error' + }, + ['cant_carry'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = "Δεν μπορείτε να μεταφέρετε αυτό το αντικείμενο", + time = 5000, + type = 'error' + }, + ['added_to_queue'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = '${s1} προστέθηκε στην ουρά χειροτεχνίας', + time = 5000, + type = 'success' + }, + ['cant_craft'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = "Δεν μπορείς να χειροτεχνήσεις ${s1}", + time = 5000, + type = 'error' + }, + ['inside_vehicle'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = "Δεν μπορείτε να κάνετε χειροτεχνία μέσα σε ένα όχημα", + time = 5000, + type = 'error' + }, + ['queue_limit'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Έχετε φτάσει το όριο της ουράς', + time = 5000, + type = 'error' + }, + ['claimed_item'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Έχετε διεκδικήσει ${s1}', + time = 5000, + type = 'success' + }, + ['claimed_all_items'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Έχετε διεκδικήσει όλα τα στοιχεία', + time = 5000, + type = 'success' + }, + ['cancel_item'] = { + title = 'ΚΑΤΑΣΚΕΥΗ', + text = 'Ακυρώσατε μια δημιουργία του ${s1}', + time = 5000, + type = 'error' + }, + + -- Chat suggestions + ['suggestion_xp'] = { + maintext = 'Ρυθμίσετε το επίπεδο του παίκτη', + id = 'ταυτότητα', + idtext = "Ταυτότητα στόχου", + xp = 'XP', + xptext = 'XP ποσό', + workbench = 'πάγκος εργασίας', + workbenchtext = "Ταυτότητα πάγκων εργασίας", + }, + ['suggestion_level'] = { + maintext = 'Ρυθμίσετε το επίπεδο του παίκτη', + id = 'ταυτότητα', + idtext = "Ταυτότητα στόχου", + level = 'Επίπεδο', + leveltext = 'Επίπεδο', + workbench = 'πάγκος εργασίας', + workbenchtext = "Ταυτότητα πάγκων εργασίας", + }, + + -- okokTextUI + ['textUI'] = { + text = '[E] Να ανοίξω το τραπέζι χειροτεχνίας', + color = 'darkblue', + side = 'left' + }, } \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/locales/pt.lua b/resources/[test]/okokCrafting/locales/pt.lua similarity index 95% rename from resources/[tools]/okokCrafting/locales/pt.lua rename to resources/[test]/okokCrafting/locales/pt.lua index 14f5b28b5..1e040783a 100644 --- a/resources/[tools]/okokCrafting/locales/pt.lua +++ b/resources/[test]/okokCrafting/locales/pt.lua @@ -1,133 +1,133 @@ -Locales['pt'] = { - - -- Notifications - ['user_xp_set'] = { - title = 'CRAFTING', - text = 'A tua XP foi alterada para ${s1}', - time = 5000, - type = 'info' - }, - ['admin_xp_set'] = { - title = 'CRAFTING', - text = 'Alteraste a XP de ${s1} para ${s2} com sucesso', - time = 5000, - type = 'success' - }, - ['user_xp_set_workbench'] = { - title = 'CRAFTING', - text = 'A tua XP foi alterada para ${s1} em ${s2}', - time = 5000, - type = 'info' - }, - ['admin_xp_set_workbench'] = { - title = 'CRAFTING', - text = 'Alteraste a XP de ${s1} para ${s2} em ${s3} com sucesso', - time = 5000, - type = 'success' - }, - ['user_level_set'] = { - title = 'CRAFTING', - text = 'O teu nível foi alterado para ${s1}', - time = 5000, - type = 'info' - }, - ['admin_level_set'] = { - title = 'CRAFTING', - text = 'Alteraste o nível de ${s1} em ${s2} com sucesso', - time = 5000, - type = 'success' - }, - ['user_level_set_workbench'] = { - title = 'CRAFTING', - text = 'O teu nível foi alterado para ${s1} em ${s2}', - time = 5000, - type = 'info' - }, - ['admin_level_set_workbench'] = { - title = 'CRAFTING', - text = 'Alteraste o nível de ${s1} para ${s2} em ${s3} com sucesso', - time = 5000, - type = 'success' - }, - ['admin_level_no_exist'] = { - title = 'CRAFTING', - text = 'Esse nível não existe', - time = 5000, - type = 'error' - }, - ['cant_carry'] = { - title = 'CRAFTING', - text = "Não tens espaço suficiente para carregar o item", - time = 5000, - type = 'error' - }, - ['added_to_queue'] = { - title = 'CRAFTING', - text = '${s1} foi adicionado à queue', - time = 5000, - type = 'success' - }, - ['cant_craft'] = { - title = 'CRAFTING', - text = "Não podes craftar ${s1}", - time = 5000, - type = 'error' - }, - ['inside_vehicle'] = { - title = 'CRAFTING', - text = "Não podes craftar dentro de um veículo", - time = 5000, - type = 'error' - }, - ['queue_limit'] = { - title = 'CRAFTING', - text = 'Atingiste o limite da queue', - time = 5000, - type = 'error' - }, - ['claimed_item'] = { - title = 'CRAFTING', - text = 'Resgataste ${s1}', - time = 5000, - type = 'success' - }, - ['claimed_all_items'] = { - title = 'CRAFTING', - text = 'Regataste todos os itens', - time = 5000, - type = 'success' - }, - ['cancel_item'] = { - title = 'CRAFTING', - text = 'Cancelaste o craft de ${s1}', - time = 5000, - type = 'error' - }, - - -- Chat suggestions - ['suggestion_xp'] = { - maintext = 'Define o XP de craft de um jogador', - id = 'id', - idtext = "ID do jogador", - xp = 'XP', - xptext = 'Quantidade de XP', - workbench = 'workbench', - workbenchtext = "ID da workbench", - }, - ['suggestion_level'] = { - maintext = 'Define o nível de craft de um jogador', - id = 'id', - idtext = "ID do jogador", - level = 'Nível', - leveltext = 'Nível', - workbench = 'workbench', - workbenchtext = "ID da workbench", - }, - - -- okokTextUI - ['textUI'] = { - text = '[E] Abrir crafting table', - color = 'darkblue', - side = 'left' - }, +Locales['pt'] = { + + -- Notifications + ['user_xp_set'] = { + title = 'CRAFTING', + text = 'A tua XP foi alterada para ${s1}', + time = 5000, + type = 'info' + }, + ['admin_xp_set'] = { + title = 'CRAFTING', + text = 'Alteraste a XP de ${s1} para ${s2} com sucesso', + time = 5000, + type = 'success' + }, + ['user_xp_set_workbench'] = { + title = 'CRAFTING', + text = 'A tua XP foi alterada para ${s1} em ${s2}', + time = 5000, + type = 'info' + }, + ['admin_xp_set_workbench'] = { + title = 'CRAFTING', + text = 'Alteraste a XP de ${s1} para ${s2} em ${s3} com sucesso', + time = 5000, + type = 'success' + }, + ['user_level_set'] = { + title = 'CRAFTING', + text = 'O teu nível foi alterado para ${s1}', + time = 5000, + type = 'info' + }, + ['admin_level_set'] = { + title = 'CRAFTING', + text = 'Alteraste o nível de ${s1} em ${s2} com sucesso', + time = 5000, + type = 'success' + }, + ['user_level_set_workbench'] = { + title = 'CRAFTING', + text = 'O teu nível foi alterado para ${s1} em ${s2}', + time = 5000, + type = 'info' + }, + ['admin_level_set_workbench'] = { + title = 'CRAFTING', + text = 'Alteraste o nível de ${s1} para ${s2} em ${s3} com sucesso', + time = 5000, + type = 'success' + }, + ['admin_level_no_exist'] = { + title = 'CRAFTING', + text = 'Esse nível não existe', + time = 5000, + type = 'error' + }, + ['cant_carry'] = { + title = 'CRAFTING', + text = "Não tens espaço suficiente para carregar o item", + time = 5000, + type = 'error' + }, + ['added_to_queue'] = { + title = 'CRAFTING', + text = '${s1} foi adicionado à queue', + time = 5000, + type = 'success' + }, + ['cant_craft'] = { + title = 'CRAFTING', + text = "Não podes craftar ${s1}", + time = 5000, + type = 'error' + }, + ['inside_vehicle'] = { + title = 'CRAFTING', + text = "Não podes craftar dentro de um veículo", + time = 5000, + type = 'error' + }, + ['queue_limit'] = { + title = 'CRAFTING', + text = 'Atingiste o limite da queue', + time = 5000, + type = 'error' + }, + ['claimed_item'] = { + title = 'CRAFTING', + text = 'Resgataste ${s1}', + time = 5000, + type = 'success' + }, + ['claimed_all_items'] = { + title = 'CRAFTING', + text = 'Regataste todos os itens', + time = 5000, + type = 'success' + }, + ['cancel_item'] = { + title = 'CRAFTING', + text = 'Cancelaste o craft de ${s1}', + time = 5000, + type = 'error' + }, + + -- Chat suggestions + ['suggestion_xp'] = { + maintext = 'Define o XP de craft de um jogador', + id = 'id', + idtext = "ID do jogador", + xp = 'XP', + xptext = 'Quantidade de XP', + workbench = 'workbench', + workbenchtext = "ID da workbench", + }, + ['suggestion_level'] = { + maintext = 'Define o nível de craft de um jogador', + id = 'id', + idtext = "ID do jogador", + level = 'Nível', + leveltext = 'Nível', + workbench = 'workbench', + workbenchtext = "ID da workbench", + }, + + -- okokTextUI + ['textUI'] = { + text = '[E] Abrir crafting table', + color = 'darkblue', + side = 'left' + }, } \ No newline at end of file diff --git a/resources/[test]/okokCrafting/okokcrafting.sql b/resources/[test]/okokCrafting/okokcrafting.sql new file mode 100644 index 000000000..ed47b157f --- /dev/null +++ b/resources/[test]/okokCrafting/okokcrafting.sql @@ -0,0 +1,2 @@ +ALTER TABLE players ADD COLUMN xp LONGTEXT NULL; +ALTER TABLE players ADD COLUMN okokcrafts LONGTEXT NULL; \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/server.lua b/resources/[test]/okokCrafting/server.lua similarity index 100% rename from resources/[tools]/okokCrafting/server.lua rename to resources/[test]/okokCrafting/server.lua diff --git a/resources/[tools]/okokCrafting/sv_utils.lua b/resources/[test]/okokCrafting/sv_utils.lua similarity index 96% rename from resources/[tools]/okokCrafting/sv_utils.lua rename to resources/[test]/okokCrafting/sv_utils.lua index 078f65f34..a9c6adf8b 100644 --- a/resources/[tools]/okokCrafting/sv_utils.lua +++ b/resources/[test]/okokCrafting/sv_utils.lua @@ -1,590 +1,590 @@ -QBCore = exports[Config.qbPrefix.."-core"]:GetCoreObject() - -Webhook = '' - -function getMoney(type, xPlayer) - local moneyCount = 0 - if type == "cash" then - moneyCount = xPlayer.PlayerData.money.cash - else - moneyCount = xPlayer.PlayerData.money.bank - end - - return moneyCount -end - -function addMoney(type, value, xPlayer) - xPlayer.Functions.AddMoney(type, value) -end - -function removeMoney(type, value, xPlayer) - xPlayer.Functions.RemoveMoney(type, value) -end - -function addItem(xPlayer, item, amount, data) - xPlayer.Functions.AddItem(item, tonumber(amount)) -end - -function removeItem(xPlayer, item, amount) - xPlayer.Functions.RemoveItem(item, tonumber(amount)) -end - -function canCarryIt(item, amount, xPlayer) - if Config.UseOx_inventory then - return exports.ox_inventory:CanCarryItem(xPlayer.PlayerData.source, item, amount) - end - - local totalWeight = QBCore.Player.GetTotalWeight(xPlayer.PlayerData.items) - local itemInfo = QBCore.Shared.Items[item:lower()] - if not itemInfo then - TriggerClientEvent('QBCore:Notify', xPlayer.PlayerData.source, 'This item doesn\'t exits', 'error') - return - end - amount = tonumber(amount) - if (totalWeight + (itemInfo['weight'] * amount)) <= 120000 then - return true - else - return false - end -end - -function hasPermission(source) - local staff = false - for k,v in ipairs(Config.AdminGroups) do - if QBCore.Functions.HasPermission(source, v) then - staff = true - break - end - end - - return staff -end - -function MySQLexecute(query, values, func) - return MySQL.query(query, values, func) -end - -function MySQLfetchAll(query, values, func) - return MySQL.query(query, values, func) -end - -function giveXP(xPlayer, xp, workbench) - if Config.SameLevelForAllTables then - MySQLexecute('UPDATE players SET '..Config.xpColumnsName..' = xp+@xp WHERE citizenid = @identifier', { - ['@identifier'] = xPlayer.PlayerData.citizenid, - ['@xp'] = Config.DoubleXP and xp*2 or xp, - }, function (result) - TriggerClientEvent(Config.EventPrefix..':updateXP', xPlayer.PlayerData.source) - end) - else - MySQLexecute('UPDATE players SET '..Config.xpColumnsName..' = JSON_SET(xp, @table, JSON_EXTRACT(xp, @table) + @xp) WHERE citizenid = @identifier', { - ['@identifier'] = xPlayer.PlayerData.citizenid, - ['@xp'] = Config.DoubleXP and xp*2 or xp, - ['@table'] = "$."..workbench, - }, function (result) - TriggerClientEvent(Config.EventPrefix..':updateXP', xPlayer.PlayerData.source) - end) - end -end - -QBCore.Functions.CreateCallback(Config.EventPrefix..":inv2", function(source, cb, item, isMoney) - local xPlayer = QBCore.Functions.GetPlayer(source) - local itemS = {} - if isMoney == "false" then - isMoney = false - elseif isMoney == "true" then - isMoney = true - end - - if isMoney then - local playerMoney = getMoney(item, xPlayer) - itemS.name = item - itemS.amount = playerMoney - else - itemS = xPlayer.Functions.GetItemByName(item) - if itemS == nil then - itemS = { - name = item, - amount = 0 - } - end - if itemS.count ~= nil then - itemS.amount = itemS.count - end - end - - cb(itemS) -end) - -QBCore.Functions.CreateCallback(Config.EventPrefix..":maxCraft", function(source, cb, recipe, maxCraftAmount, isDisassemble, itemC, itmNeeded) - local _source = source - local xPlayer = QBCore.Functions.GetPlayer(_source) - local maxCraft = maxCraftAmount - local itemAmt = 0 - - if not isDisassemble then - for k,v in ipairs(recipe) do - local item = {} - local itemCount = 0 - - if v[4] then - itemCount = getMoney(v[1], xPlayer) - else - item = xPlayer.Functions.GetItemByName(v[1]) - if item == nil then - item = { - name = v[1], - amount = 0 - } - end - if item.count ~= nil then - item.amount = item.count - end - itemCount = item.amount - end - - if itemCount > 0 then - local possibleToCraft = itemCount/tonumber(v[2]) - if possibleToCraft > 0 then - if maxCraft > possibleToCraft then - maxCraft = possibleToCraft - end - else - maxCraft = 0 - break - end - else - maxCraft = 0 - break - end - end - else - local item = xPlayer.Functions.GetItemByName(itemC) - if item == nil then - item = { - name = itemC, - amount = 0 - } - end - if item.count ~= nil then - item.amount = item.count - end - itemAmt = item.amount - - if itemAmt > 0 then - local possibleToCraft = itemAmt/tonumber(itmNeeded) - if possibleToCraft > 0 then - if maxCraft > possibleToCraft then - maxCraft = possibleToCraft - end - else - maxCraft = 0 - end - else - maxCraft = 0 - end - end - - cb(math.floor(maxCraft), itemAmt) -end) - -local function normalizeRecipe(recipe) - local normalized = {} - for _, item in ipairs(recipe) do - local normalizedItem = { item[1], tonumber(item[2]), item[3] == "true" or item[3] == true, item[4] == "true" or item[4] == true } - table.insert(normalized, normalizedItem) - end - return normalized -end - -local function compareRecipes(recipe1, recipe2) - if #recipe1 ~= #recipe2 then - return false - end - for i, item1 in ipairs(recipe1) do - local item2 = recipe2[i] - if item1[1] ~= item2[1] and item1[2] <= item2[2] then - return false - end - end - return true -end - -function craftExistsInWorkbench(workbenchID, itemID, recipe) - for _, workbench in pairs(Config.Crafting) do - if workbench.tableID == workbenchID then - for _, craft in pairs(workbench.crafts) do - if Config.Crafts[craft] == nil then - print("Craft "..craft.." does not exist in Config.Crafts") - return false - end - if Config.Crafts[craft].item == itemID then - local normalizedCraftRecipe = normalizeRecipe(Config.Crafts[craft].recipe) - local normalizedInputRecipe = normalizeRecipe(recipe) - if compareRecipes(normalizedCraftRecipe, normalizedInputRecipe) then - return true - end - end - end - end - end - return false -end - -QBCore.Functions.CreateCallback(Config.EventPrefix..":CanCraftItem", function(source, cb, itemID, recipe, itemName, amount, isItem, workbench, timeCraft, CraftQueues, xp, pc, isDis, itemData) - local xPlayer = QBCore.Functions.GetPlayer(source) - local canCraft = true - if not craftExistsInWorkbench(workbench, itemID, recipe) then - canCraft = false - end - - if not isDis then - for k,v in pairs(recipe) do - if v[4] == "false" then - local item = xPlayer.Functions.GetItemByName(v[1]) - if item == nil then - item = { - name = v[1], - amount = 0 - } - end - if item.count ~= nil then - item.amount = item.count - end - if item.amount < v[2] then - canCraft = false - end - else - local playerMoney = getMoney(v[1], xPlayer) - if playerMoney < v[2] then - canCraft = false - end - end - end - else - local item = xPlayer.Functions.GetItemByName(itemID) - if item == nil then - item = { - name = itemID, - amount = 0 - } - end - if item.count ~= nil then - item.amount = item.count - end - if tonumber(item.amount) < tonumber(amount) then - canCraft = false - end - end - - if canCraft then - if not isDis then - for k,v in pairs(recipe) do - if v[3] == "true" then - if v[4] == "true" then - removeMoney(v[1], v[2], xPlayer) - else - removeItem(xPlayer, v[1], v[2]) - end - end - end - else - removeItem(xPlayer, itemID, tonumber(amount)) - end - - local queue = CraftQueues - if queue ~= nil and queue[workbench] ~= nil then - queue[workbench][#queue[workbench]+1] = { - item = itemID, - recipe = recipe, - amount = amount, - isItem = isItem, - time = timeCraft, - itemName = itemName[itemID], - isDone = false, - isPending = true, - randomID = math.random(100000000, 999999999), - xp = xp, - sucPC = pc, - suc = true, - isDis = isDis, - data = itemData - } - - MySQLexecute('UPDATE players SET '..Config.craftQueryColumnName..' = @okokcrafts WHERE citizenid = @identifier', { - ['@identifier'] = xPlayer.PlayerData.citizenid, - ['@okokcrafts'] = json.encode(queue), - }, function (result) - TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('added_to_queue').title, interp(_L('added_to_queue').text, {s1 = itemName[itemID]}), _L('added_to_queue').time, _L('added_to_queue').type) - - if Webhook ~= "" then - data = { - playerid = xPlayer.PlayerData.source, - type = "start-craft", - item = itemName[itemID], - amount = amount, - } - - discordWebhook(data) - end - - cb(queue) - end) - else - if queue == nil then - queue = {} - end - queue[workbench] = {} - queue[workbench] = { - [1] = { - item = itemID, - recipe = recipe, - amount = amount, - isItem = isItem, - time = timeCraft, - itemName = itemName[itemID], - isDone = false, - isPending = true, - randomID = math.random(100000000, 999999999), - xp = xp, - sucPC = pc, - suc = true, - isDis = isDis, - data = itemData - } - } - - MySQLexecute('UPDATE players SET '..Config.craftQueryColumnName..' = @okokcrafts WHERE citizenid = @identifier', { - ['@identifier'] = xPlayer.PlayerData.citizenid, - ['@okokcrafts'] = json.encode(queue), - }, function (result) - TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('added_to_queue').title, interp(_L('added_to_queue').text, {s1 = itemName[itemID]}), _L('added_to_queue').time, _L('added_to_queue').type) - - if Webhook ~= "" then - data = { - playerid = xPlayer.PlayerData.source, - type = "start-craft", - item = itemName[itemID], - amount = amount, - } - discordWebhook(data) - end - - cb(queue) - end) - end - else - TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('cant_craft').title, interp(_L('cant_craft').text, {s1 = itemName[itemID]}), _L('cant_craft').time, _L('cant_craft').type) - cb(false) - end -end) - -RegisterServerEvent(Config.EventPrefix..':claimAll') -AddEventHandler(Config.EventPrefix..':claimAll', function(workbench, AllQueues) - local xPlayer = QBCore.Functions.GetPlayer(source) - local gotQueue = false - local CraftsQueue = {} - - MySQLfetchAll('SELECT okokcrafts FROM players WHERE citizenid = @identifier', { - ['@identifier'] = xPlayer.PlayerData.citizenid, - }, function (result) - if result[1] ~= nil then - local data = json.decode(result[1].okokcrafts) - if data ~= nil then - CraftsQueue = data - gotQueue = true - end - end - end) - - while not gotQueue do - Citizen.Wait(100) - end - - local queue = CraftsQueue[workbench] - local v = queue[1] - - if v ~= nil then - if v.isDone then - if v.suc then - if not v.isDis then - local canCarry = false - if v.isItem then - if canCarryIt(v.item, v.amount, xPlayer) then - addItem(xPlayer, v.item, v.amount, v.data) - canCarry = true - end - else - if canCarryIt(v.item, v.amount, xPlayer) then - addItem(xPlayer, v.item, v.amount) - canCarry = true - end - end - - if canCarry then - if Webhook ~= "" then - data = { - playerid = xPlayer.PlayerData.source, - type = "claim-craft", - item = v.itemName, - amount = v.amount, - } - - discordWebhook(data) - end - - if Config.UseXP then - giveXP(xPlayer, v.xp, workbench) - end - TriggerClientEvent(Config.EventPrefix..':removeItemsFromQueue', xPlayer.PlayerData.source, 1, workbench) - else - TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('cant_carry').title, _L('cant_carry').text, _L('cant_carry').time, _L('cant_carry').type) - TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('claimed_all_items').title, _L('claimed_all_items').text, _L('claimed_all_items').time, _L('claimed_all_items').type) - TriggerClientEvent(Config.EventPrefix..':resetClaimAllButton', xPlayer.PlayerData.source) - end - else - local canCarry = true - for k2,v2 in ipairs(v.recipe) do - if v2[4] == "false" or v2[4] == false then - if not canCarryIt(v2[1], v2[2], xPlayer) then - canCarry = false - end - end - end - - if canCarry then - for k2,v2 in ipairs(v.recipe) do - if v2[4] == "true" or v2[4] == true then - addMoney(v2[1], v2[2], xPlayer) - else - addItem(xPlayer, v2[1], v2[2]) - end - end - - if Webhook ~= "" then - data = { - playerid = xPlayer.PlayerData.source, - type = "claim-craft", - item = v.itemName, - amount = v.amount, - } - - discordWebhook(data) - end - - - if Config.UseXP then - giveXP(xPlayer, v.xp, workbench) - end - TriggerClientEvent(Config.EventPrefix..':removeItemsFromQueue', xPlayer.PlayerData.source, 1, workbench) - else - TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('cant_carry').title, _L('cant_carry').text, _L('cant_carry').time, _L('cant_carry').type) - TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('claimed_all_items').title, _L('claimed_all_items').text, _L('claimed_all_items').time, _L('claimed_all_items').type) - TriggerClientEvent(Config.EventPrefix..':resetClaimAllButton', xPlayer.PlayerData.source) - end - end - else - if Webhook ~= "" then - data = { - playerid = xPlayer.PlayerData.source, - type = "failed-craft", - item = v.itemName, - amount = v.amount, - } - - discordWebhook(data) - end - if Config.GiveXPOnCraftFailed and Config.UseXP then - if Config.UseXP then - giveXP(xPlayer, v.xp, workbench) - end - end - TriggerClientEvent(Config.EventPrefix..':removeItemsFromQueue', xPlayer.PlayerData.source, 1, workbench) - end - end - end -end) - --------------------------- IDENTIFIERS - -function ExtractIdentifiers(id) - local identifiers = { - steam = "", - ip = "", - discord = "", - license = "", - xbl = "", - live = "" - } - - for i = 0, GetNumPlayerIdentifiers(id) - 1 do - local playerID = GetPlayerIdentifier(id, i) - - if string.find(playerID, "steam") then - identifiers.steam = playerID - elseif string.find(playerID, "ip") then - identifiers.ip = playerID - elseif string.find(playerID, "discord") then - identifiers.discord = playerID - elseif string.find(playerID, "license") then - identifiers.license = playerID - elseif string.find(playerID, "xbl") then - identifiers.xbl = playerID - elseif string.find(playerID, "live") then - identifiers.live = playerID - end - end - - return identifiers -end - --------------------------- WEBHOOK - -function discordWebhook(data) - local color = '65352' - local category = 'default' - local item = '' - local amount = '' - local identifierlist = ExtractIdentifiers(data.playerid) - local identifier = identifierlist.license:gsub("license2:", "") - local discord = "<@"..identifierlist.discord:gsub("discord:", "")..">" - - if data.type == 'start-craft' then - color = Config.StartCraftWebhookColor - category = 'Started a craft' - item = data.item - amount = data.amount - elseif data.type == 'cancel-craft' then - color = Config.CancelWebhookColor - category = 'Canceled a craft' - item = data.item - amount = data.amount - elseif data.type == 'claim-craft' then - color = Config.ClaimCraftWebhookColor - category = 'Claimed' - item = data.item - amount = data.amount - elseif data.type == 'failed-craft' then - color = Config.FailedCraftWebhookColor - category = 'Failed a craft' - item = data.item - amount = data.amount - end - - local information = { - { - ["color"] = color, - ["author"] = { - ["icon_url"] = Config.IconURL, - ["name"] = Config.ServerName..' - Logs', - }, - ["title"] = 'CRAFTING', - ["description"] = '**Action:** '..category..'\n**Item:** '..item..'\n**Amount:** '..amount..'\n\n**ID:** '..data.playerid..'\n**Identifier:** '..identifier..'\n**Discord:** '..discord, - ["footer"] = { - ["text"] = os.date(Config.DateFormat), - } - } - } - - PerformHttpRequest(Webhook, function(err, text, headers) end, 'POST', json.encode({username = Config.BotName, embeds = information}), {['Content-Type'] = 'application/json'}) +QBCore = exports[Config.qbPrefix.."-core"]:GetCoreObject() + +Webhook = '' + +function getMoney(type, xPlayer) + local moneyCount = 0 + if type == "cash" then + moneyCount = xPlayer.PlayerData.money.cash + else + moneyCount = xPlayer.PlayerData.money.bank + end + + return moneyCount +end + +function addMoney(type, value, xPlayer) + xPlayer.Functions.AddMoney(type, value) +end + +function removeMoney(type, value, xPlayer) + xPlayer.Functions.RemoveMoney(type, value) +end + +function addItem(xPlayer, item, amount, data) + xPlayer.Functions.AddItem(item, tonumber(amount)) +end + +function removeItem(xPlayer, item, amount) + xPlayer.Functions.RemoveItem(item, tonumber(amount)) +end + +function canCarryIt(item, amount, xPlayer) + if Config.UseOx_inventory then + return exports.ox_inventory:CanCarryItem(xPlayer.PlayerData.source, item, amount) + end + + local totalWeight = QBCore.Player.GetTotalWeight(xPlayer.PlayerData.items) + local itemInfo = QBCore.Shared.Items[item:lower()] + if not itemInfo then + TriggerClientEvent('QBCore:Notify', xPlayer.PlayerData.source, 'This item doesn\'t exits', 'error') + return + end + amount = tonumber(amount) + if (totalWeight + (itemInfo['weight'] * amount)) <= 120000 then + return true + else + return false + end +end + +function hasPermission(source) + local staff = false + for k,v in ipairs(Config.AdminGroups) do + if QBCore.Functions.HasPermission(source, v) then + staff = true + break + end + end + + return staff +end + +function MySQLexecute(query, values, func) + return MySQL.query(query, values, func) +end + +function MySQLfetchAll(query, values, func) + return MySQL.query(query, values, func) +end + +function giveXP(xPlayer, xp, workbench) + if Config.SameLevelForAllTables then + MySQLexecute('UPDATE players SET '..Config.xpColumnsName..' = xp+@xp WHERE citizenid = @identifier', { + ['@identifier'] = xPlayer.PlayerData.citizenid, + ['@xp'] = Config.DoubleXP and xp*2 or xp, + }, function (result) + TriggerClientEvent(Config.EventPrefix..':updateXP', xPlayer.PlayerData.source) + end) + else + MySQLexecute('UPDATE players SET '..Config.xpColumnsName..' = JSON_SET(xp, @table, JSON_EXTRACT(xp, @table) + @xp) WHERE citizenid = @identifier', { + ['@identifier'] = xPlayer.PlayerData.citizenid, + ['@xp'] = Config.DoubleXP and xp*2 or xp, + ['@table'] = "$."..workbench, + }, function (result) + TriggerClientEvent(Config.EventPrefix..':updateXP', xPlayer.PlayerData.source) + end) + end +end + +QBCore.Functions.CreateCallback(Config.EventPrefix..":inv2", function(source, cb, item, isMoney) + local xPlayer = QBCore.Functions.GetPlayer(source) + local itemS = {} + if isMoney == "false" then + isMoney = false + elseif isMoney == "true" then + isMoney = true + end + + if isMoney then + local playerMoney = getMoney(item, xPlayer) + itemS.name = item + itemS.amount = playerMoney + else + itemS = xPlayer.Functions.GetItemByName(item) + if itemS == nil then + itemS = { + name = item, + amount = 0 + } + end + if itemS.count ~= nil then + itemS.amount = itemS.count + end + end + + cb(itemS) +end) + +QBCore.Functions.CreateCallback(Config.EventPrefix..":maxCraft", function(source, cb, recipe, maxCraftAmount, isDisassemble, itemC, itmNeeded) + local _source = source + local xPlayer = QBCore.Functions.GetPlayer(_source) + local maxCraft = maxCraftAmount + local itemAmt = 0 + + if not isDisassemble then + for k,v in ipairs(recipe) do + local item = {} + local itemCount = 0 + + if v[4] then + itemCount = getMoney(v[1], xPlayer) + else + item = xPlayer.Functions.GetItemByName(v[1]) + if item == nil then + item = { + name = v[1], + amount = 0 + } + end + if item.count ~= nil then + item.amount = item.count + end + itemCount = item.amount + end + + if itemCount > 0 then + local possibleToCraft = itemCount/tonumber(v[2]) + if possibleToCraft > 0 then + if maxCraft > possibleToCraft then + maxCraft = possibleToCraft + end + else + maxCraft = 0 + break + end + else + maxCraft = 0 + break + end + end + else + local item = xPlayer.Functions.GetItemByName(itemC) + if item == nil then + item = { + name = itemC, + amount = 0 + } + end + if item.count ~= nil then + item.amount = item.count + end + itemAmt = item.amount + + if itemAmt > 0 then + local possibleToCraft = itemAmt/tonumber(itmNeeded) + if possibleToCraft > 0 then + if maxCraft > possibleToCraft then + maxCraft = possibleToCraft + end + else + maxCraft = 0 + end + else + maxCraft = 0 + end + end + + cb(math.floor(maxCraft), itemAmt) +end) + +local function normalizeRecipe(recipe) + local normalized = {} + for _, item in ipairs(recipe) do + local normalizedItem = { item[1], tonumber(item[2]), item[3] == "true" or item[3] == true, item[4] == "true" or item[4] == true } + table.insert(normalized, normalizedItem) + end + return normalized +end + +local function compareRecipes(recipe1, recipe2) + if #recipe1 ~= #recipe2 then + return false + end + for i, item1 in ipairs(recipe1) do + local item2 = recipe2[i] + if item1[1] ~= item2[1] and item1[2] <= item2[2] then + return false + end + end + return true +end + +function craftExistsInWorkbench(workbenchID, itemID, recipe) + for _, workbench in pairs(Config.Crafting) do + if workbench.tableID == workbenchID then + for _, craft in pairs(workbench.crafts) do + if Config.Crafts[craft] == nil then + print("Craft "..craft.." does not exist in Config.Crafts") + return false + end + if Config.Crafts[craft].item == itemID then + local normalizedCraftRecipe = normalizeRecipe(Config.Crafts[craft].recipe) + local normalizedInputRecipe = normalizeRecipe(recipe) + if compareRecipes(normalizedCraftRecipe, normalizedInputRecipe) then + return true + end + end + end + end + end + return false +end + +QBCore.Functions.CreateCallback(Config.EventPrefix..":CanCraftItem", function(source, cb, itemID, recipe, itemName, amount, isItem, workbench, timeCraft, CraftQueues, xp, pc, isDis, itemData) + local xPlayer = QBCore.Functions.GetPlayer(source) + local canCraft = true + if not craftExistsInWorkbench(workbench, itemID, recipe) then + canCraft = false + end + + if not isDis then + for k,v in pairs(recipe) do + if v[4] == "false" then + local item = xPlayer.Functions.GetItemByName(v[1]) + if item == nil then + item = { + name = v[1], + amount = 0 + } + end + if item.count ~= nil then + item.amount = item.count + end + if item.amount < v[2] then + canCraft = false + end + else + local playerMoney = getMoney(v[1], xPlayer) + if playerMoney < v[2] then + canCraft = false + end + end + end + else + local item = xPlayer.Functions.GetItemByName(itemID) + if item == nil then + item = { + name = itemID, + amount = 0 + } + end + if item.count ~= nil then + item.amount = item.count + end + if tonumber(item.amount) < tonumber(amount) then + canCraft = false + end + end + + if canCraft then + if not isDis then + for k,v in pairs(recipe) do + if v[3] == "true" then + if v[4] == "true" then + removeMoney(v[1], v[2], xPlayer) + else + removeItem(xPlayer, v[1], v[2]) + end + end + end + else + removeItem(xPlayer, itemID, tonumber(amount)) + end + + local queue = CraftQueues + if queue ~= nil and queue[workbench] ~= nil then + queue[workbench][#queue[workbench]+1] = { + item = itemID, + recipe = recipe, + amount = amount, + isItem = isItem, + time = timeCraft, + itemName = itemName[itemID], + isDone = false, + isPending = true, + randomID = math.random(100000000, 999999999), + xp = xp, + sucPC = pc, + suc = true, + isDis = isDis, + data = itemData + } + + MySQLexecute('UPDATE players SET '..Config.craftQueryColumnName..' = @okokcrafts WHERE citizenid = @identifier', { + ['@identifier'] = xPlayer.PlayerData.citizenid, + ['@okokcrafts'] = json.encode(queue), + }, function (result) + TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('added_to_queue').title, interp(_L('added_to_queue').text, {s1 = itemName[itemID]}), _L('added_to_queue').time, _L('added_to_queue').type) + + if Webhook ~= "" then + data = { + playerid = xPlayer.PlayerData.source, + type = "start-craft", + item = itemName[itemID], + amount = amount, + } + + discordWebhook(data) + end + + cb(queue) + end) + else + if queue == nil then + queue = {} + end + queue[workbench] = {} + queue[workbench] = { + [1] = { + item = itemID, + recipe = recipe, + amount = amount, + isItem = isItem, + time = timeCraft, + itemName = itemName[itemID], + isDone = false, + isPending = true, + randomID = math.random(100000000, 999999999), + xp = xp, + sucPC = pc, + suc = true, + isDis = isDis, + data = itemData + } + } + + MySQLexecute('UPDATE players SET '..Config.craftQueryColumnName..' = @okokcrafts WHERE citizenid = @identifier', { + ['@identifier'] = xPlayer.PlayerData.citizenid, + ['@okokcrafts'] = json.encode(queue), + }, function (result) + TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('added_to_queue').title, interp(_L('added_to_queue').text, {s1 = itemName[itemID]}), _L('added_to_queue').time, _L('added_to_queue').type) + + if Webhook ~= "" then + data = { + playerid = xPlayer.PlayerData.source, + type = "start-craft", + item = itemName[itemID], + amount = amount, + } + discordWebhook(data) + end + + cb(queue) + end) + end + else + TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('cant_craft').title, interp(_L('cant_craft').text, {s1 = itemName[itemID]}), _L('cant_craft').time, _L('cant_craft').type) + cb(false) + end +end) + +RegisterServerEvent(Config.EventPrefix..':claimAll') +AddEventHandler(Config.EventPrefix..':claimAll', function(workbench, AllQueues) + local xPlayer = QBCore.Functions.GetPlayer(source) + local gotQueue = false + local CraftsQueue = {} + + MySQLfetchAll('SELECT okokcrafts FROM players WHERE citizenid = @identifier', { + ['@identifier'] = xPlayer.PlayerData.citizenid, + }, function (result) + if result[1] ~= nil then + local data = json.decode(result[1].okokcrafts) + if data ~= nil then + CraftsQueue = data + gotQueue = true + end + end + end) + + while not gotQueue do + Citizen.Wait(100) + end + + local queue = CraftsQueue[workbench] + local v = queue[1] + + if v ~= nil then + if v.isDone then + if v.suc then + if not v.isDis then + local canCarry = false + if v.isItem then + if canCarryIt(v.item, v.amount, xPlayer) then + addItem(xPlayer, v.item, v.amount, v.data) + canCarry = true + end + else + if canCarryIt(v.item, v.amount, xPlayer) then + addItem(xPlayer, v.item, v.amount) + canCarry = true + end + end + + if canCarry then + if Webhook ~= "" then + data = { + playerid = xPlayer.PlayerData.source, + type = "claim-craft", + item = v.itemName, + amount = v.amount, + } + + discordWebhook(data) + end + + if Config.UseXP then + giveXP(xPlayer, v.xp, workbench) + end + TriggerClientEvent(Config.EventPrefix..':removeItemsFromQueue', xPlayer.PlayerData.source, 1, workbench) + else + TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('cant_carry').title, _L('cant_carry').text, _L('cant_carry').time, _L('cant_carry').type) + TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('claimed_all_items').title, _L('claimed_all_items').text, _L('claimed_all_items').time, _L('claimed_all_items').type) + TriggerClientEvent(Config.EventPrefix..':resetClaimAllButton', xPlayer.PlayerData.source) + end + else + local canCarry = true + for k2,v2 in ipairs(v.recipe) do + if v2[4] == "false" or v2[4] == false then + if not canCarryIt(v2[1], v2[2], xPlayer) then + canCarry = false + end + end + end + + if canCarry then + for k2,v2 in ipairs(v.recipe) do + if v2[4] == "true" or v2[4] == true then + addMoney(v2[1], v2[2], xPlayer) + else + addItem(xPlayer, v2[1], v2[2]) + end + end + + if Webhook ~= "" then + data = { + playerid = xPlayer.PlayerData.source, + type = "claim-craft", + item = v.itemName, + amount = v.amount, + } + + discordWebhook(data) + end + + + if Config.UseXP then + giveXP(xPlayer, v.xp, workbench) + end + TriggerClientEvent(Config.EventPrefix..':removeItemsFromQueue', xPlayer.PlayerData.source, 1, workbench) + else + TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('cant_carry').title, _L('cant_carry').text, _L('cant_carry').time, _L('cant_carry').type) + TriggerClientEvent(Config.EventPrefix..':notification', xPlayer.PlayerData.source, _L('claimed_all_items').title, _L('claimed_all_items').text, _L('claimed_all_items').time, _L('claimed_all_items').type) + TriggerClientEvent(Config.EventPrefix..':resetClaimAllButton', xPlayer.PlayerData.source) + end + end + else + if Webhook ~= "" then + data = { + playerid = xPlayer.PlayerData.source, + type = "failed-craft", + item = v.itemName, + amount = v.amount, + } + + discordWebhook(data) + end + if Config.GiveXPOnCraftFailed and Config.UseXP then + if Config.UseXP then + giveXP(xPlayer, v.xp, workbench) + end + end + TriggerClientEvent(Config.EventPrefix..':removeItemsFromQueue', xPlayer.PlayerData.source, 1, workbench) + end + end + end +end) + +-------------------------- IDENTIFIERS + +function ExtractIdentifiers(id) + local identifiers = { + steam = "", + ip = "", + discord = "", + license = "", + xbl = "", + live = "" + } + + for i = 0, GetNumPlayerIdentifiers(id) - 1 do + local playerID = GetPlayerIdentifier(id, i) + + if string.find(playerID, "steam") then + identifiers.steam = playerID + elseif string.find(playerID, "ip") then + identifiers.ip = playerID + elseif string.find(playerID, "discord") then + identifiers.discord = playerID + elseif string.find(playerID, "license") then + identifiers.license = playerID + elseif string.find(playerID, "xbl") then + identifiers.xbl = playerID + elseif string.find(playerID, "live") then + identifiers.live = playerID + end + end + + return identifiers +end + +-------------------------- WEBHOOK + +function discordWebhook(data) + local color = '65352' + local category = 'default' + local item = '' + local amount = '' + local identifierlist = ExtractIdentifiers(data.playerid) + local identifier = identifierlist.license:gsub("license2:", "") + local discord = "<@"..identifierlist.discord:gsub("discord:", "")..">" + + if data.type == 'start-craft' then + color = Config.StartCraftWebhookColor + category = 'Started a craft' + item = data.item + amount = data.amount + elseif data.type == 'cancel-craft' then + color = Config.CancelWebhookColor + category = 'Canceled a craft' + item = data.item + amount = data.amount + elseif data.type == 'claim-craft' then + color = Config.ClaimCraftWebhookColor + category = 'Claimed' + item = data.item + amount = data.amount + elseif data.type == 'failed-craft' then + color = Config.FailedCraftWebhookColor + category = 'Failed a craft' + item = data.item + amount = data.amount + end + + local information = { + { + ["color"] = color, + ["author"] = { + ["icon_url"] = Config.IconURL, + ["name"] = Config.ServerName..' - Logs', + }, + ["title"] = 'CRAFTING', + ["description"] = '**Action:** '..category..'\n**Item:** '..item..'\n**Amount:** '..amount..'\n\n**ID:** '..data.playerid..'\n**Identifier:** '..identifier..'\n**Discord:** '..discord, + ["footer"] = { + ["text"] = os.date(Config.DateFormat), + } + } + } + + PerformHttpRequest(Webhook, function(err, text, headers) end, 'POST', json.encode({username = Config.BotName, embeds = information}), {['Content-Type'] = 'application/json'}) end \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/web/click.mp3 b/resources/[test]/okokCrafting/web/click.mp3 similarity index 100% rename from resources/[tools]/okokCrafting/web/click.mp3 rename to resources/[test]/okokCrafting/web/click.mp3 diff --git a/resources/[tools]/okokCrafting/web/scripts.js b/resources/[test]/okokCrafting/web/scripts.js similarity index 97% rename from resources/[tools]/okokCrafting/web/scripts.js rename to resources/[test]/okokCrafting/web/scripts.js index 3413b3e85..5fb637966 100644 --- a/resources/[tools]/okokCrafting/web/scripts.js +++ b/resources/[test]/okokCrafting/web/scripts.js @@ -1,998 +1,998 @@ -function addStr(str, index, stringToAdd){ - return str.substring(0, index) + stringToAdd + str.substring(index, str.length); -} - -var isTimerOn = false; -var lastTime; -var categories = []; -var selectedCategory = "general_cat"; -var craft2; -var job2; -var gang; -var craftData; -var sideCraftMenu; -var itemClaiming = 0; -var CraftQueue = []; -var maxCraft = 10; -var canCraftItem = true; -var showAllCrafts = false; -var canClaimAll = true; - -var canClaimItem = true; -var canOpenSideCraft = true; - -let Inventory = ''; - -window.addEventListener('message', function(event) { - switch (event.data.action) { - case 'openCraft': - selectedCategory = "general_cat"; - canOpenSideCraft = true; - canClaimItem = true; - itemClaiming = 0; - showAllCrafts = event.data.showAllCrafts; - Inventory = event.data.inventory; - var queue = event.data.queue; - craftData = event.data; - categories = event.data.categories; - var craft = event.data.craft; - craft2 = craft; - var num = craft.length; - var paragraph = ''; - var row = '
'; - var lastRowNum = 0; - var job = event.data.job; - job2 = event.data.job; - gang = event.data.gang; - var added = 0; - var useCategories = event.data.useCategories; - var categoriesButtonsHTML = ` - - - `; - document.querySelector('#claimall-button').disabled = false; - if(useCategories){ - for(let i = 0; i < categories.length; i++){ - categoriesButtonsHTML += ` - - - `; - } - $('#categories_btns').html(categoriesButtonsHTML); - $('#categories_box').show(); - } else { - $('#categories_box').hide(); - } - - if(num >= 13){ - $('.itemslist_window').css('padding', '0.3125rem 0.55rem 0.3125rem 0.625rem'); - } else { - $('.itemslist_window').css('padding', '0.3125rem 1.05rem 0.3125rem 0.625rem'); - } - - for(var i = 0; i < num; i++) { - for(var i1 = 0; i1 < craft[i].job.length; i1++){ - if(selectedCategory == "general_cat" || craft[i].category == selectedCategory){ - if(craft[i].job[i1] == job || craft[i].job[i1] == gang || craft[i].job[i1] == ''){ - if(!event.data.UseXP){ - var itemName = event.data.itemNames; - var itemId = craft[i].item; - var index = i; - added++ - row += ` -
-
-
- ${itemName[itemId]} - -
-
-
- `; - var myEle = document.getElementById(itemId+"wb_"+event.data.wb+"wb_"+index); - if(!myEle) { - $(document).on('click', "#"+itemId+"wb_"+event.data.wb+"wb_"+index, function() { - if(canOpenSideCraft) { - canOpenSideCraft = false; - allID = this.id; - id = allID.substring(0, allID.indexOf('wb_')); - index2 = allID.split("wb_"); - $('.item_card-body').css('background-color', 'rgba(220, 220, 220, 0.20)'); - $('#selected'+this.id).css('background-color', 'rgba(31, 94, 255, 1)'); - var sound = new Audio('click.mp3'); - sound.volume = 0.3; - sound.play(); - $.post('https://okokCrafting/action', JSON.stringify({ - action: "craft", - item: id, - crafts: craft, - itemName: itemName, - index: index2[2], - })); - } - }); - } - - if ((added) % 4 === 0) { - row = addStr(row, row.length, `
`); - lastRowNum = row.length+6; - } - } else { - if(craft[i].levelNeeded <= event.data.level || showAllCrafts){ - var itemName = event.data.itemNames; - var itemId = craft[i].item; - var index = i; - added++ - row += ` -
-
-
- ${itemName[itemId]} - -
-
-
- `; - var myEle = document.getElementById(itemId+"wb_"+event.data.wb+"wb_"+index); - if(!myEle) { - $(document).on('click', "#"+itemId+"wb_"+event.data.wb+"wb_"+index, function() { - if(canOpenSideCraft) { - canOpenSideCraft = false; - allID = this.id; - id = allID.substring(0, allID.indexOf('wb_')); - index2 = allID.split("wb_"); - $('.item_card-body').css('background-color', 'rgba(220, 220, 220, 0.20)'); - $('#selected'+this.id).css('background-color', 'rgba(31, 94, 255, 1)'); - var sound = new Audio('click.mp3'); - sound.volume = 0.3; - sound.play(); - $.post('https://okokCrafting/action', JSON.stringify({ - action: "craft", - item: id, - crafts: craft, - itemName: itemName, - index: index2[2], - level: event.data.level, - })); - } - }); - } - - if ((added) % 4 === 0) { - row = addStr(row, row.length, `
`); - lastRowNum = row.length+6; - } - } - } - } - } - } - } - row += `
`; - - if(event.data.UseXP) { - $('#currentlevel').html(event.data.level); - document.documentElement.style.setProperty('--percentage-width', event.data.percentage+"%"); - $('.xpbar-col').css('margin-top', '-1.8rem'); - } else { - $('.xpbar').hide(); - $('.xpbar-col').css('margin-top', '5.05rem'); - } - - var queueRow = ''; - CraftQueue = queue; - if(queue.length > 0){ - if(queue.length >= 6){ - $('.craftingq_window').css('padding-right', '0.35rem'); - } else { - $('.craftingq_window').css('padding-right', '0rem'); - } - for (var i = 0; i < queue.length; i++) { - if(queue[i].isDone == true) { - if(queue[i].suc){ - if(queue[i].isDis){ - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Concluded
-
-
-
-
-
-
- `; - } else { - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Concluded
-
-
-
-
-
-
- `; - } - } else { - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Failed to craft
-
-
-
-
-
-
- `; - } - } else { - if(queue[i].isPending){ - if(queue[i].isDis){ - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Pending
-
-
-
-
-
-
- `; - } else { - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Pending
-
-
-
-
-
-
- `; - } - } else { - if(queue[i].isDis){ - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Time left: ${queue[i].time}s
-
-
-
-
-
-
- `; - } else { - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Time left: ${queue[i].time}s
-
-
-
-
-
-
- `; - } - } - } - } - } else { - queueRow = `
The crafting queue is empty
` - } - - $('.craftingq_window').html(queueRow); - $('#craft-table').html(row); - $('.title-name').html(event.data.name); - - $('.title').fadeIn(); - $('.itemslist').fadeIn(); - $('.crafting-body').fadeIn(); - break - case 'openSideCraft': - sideCraftMenu = event.data; - canOpenSideCraft = true; - var useLevels = false; - if(sideCraftMenu.level != undefined){ - var levelNeeded = sideCraftMenu.crafts[sideCraftMenu.index].levelNeeded; - var level = sideCraftMenu.level; - useLevels = true; - } - - var isLevel = false; - $('#quantity').val(1); - maxCraft = sideCraftMenu.maxCraft; - if(canCraftItem == false){ - canCraftItem = true; - document.querySelector('#craft-button').disabled = false; - } - - var canCraft = true; - var isAvailable = false; - var num = event.data.recipe.length; - var recipe = ``; - var img = ` - - ${event.data.itemName} x${event.data.itemAmount} - `; - - if(sideCraftMenu.isDis){ - $('#top_text').html(`Requirements`); - $('#bot_text').html(`You will receive`); - img = ` - - ${event.data.itemName} x${event.data.itemAmount} (${event.data.isDisItemAmt}) - `; - } else { - $('#top_text').html(`You will receive`); - $('#bot_text').html(`Requirements`); - } - - $('#side-image').html(img); - $('#craft-time').html(event.data.time); - - if(useLevels){ - if(level >= levelNeeded){ - canCraft = true; - isAvailable = true; - isLevel = true; - } else { - isAvailable = false; - canCraft = false; - isLevel = true; - } - } - - for(var i = 0; i < num; i++){ - var idName = event.data.recipe[i][0]; - if(sideCraftMenu.isDis){ - recipe += ` -
- - ${event.data.itemNames[idName]} x${event.data.recipe[i][1]} -
- `; - if(event.data.itemAmount > event.data.isDisItemAmt){ - canCraft = false - } - } else { - recipe += ` -
- - ${event.data.itemNames[idName]} x${event.data.recipe[i][1]} (${event.data.inventory[i].key}) -
- `; - if(event.data.recipe[i][1] > event.data.inventory[i].key){ - canCraft = false - } - } - } - - - $('#craft-button-div').html(` - - `); - - if(canCraft) { - $('#craft-buttons-info').fadeIn(); - $('#craft-button-div').fadeIn(); - $('#craft-buttons-info-level').hide(); - } else { - $('#craft-buttons-info').hide(); - $('#craft-buttons-info-level').hide(); - } - - if(useLevels){ - if(!isAvailable && isLevel){ - $('#craft-button-div-level').html(` - LEVEL REQUIRED: ${levelNeeded} - `); - $('#craft-buttons-info-level').fadeIn(); - $('#craft-button-div-level').fadeIn(); - } - } - - $('#craft-percentage').html(event.data.percentage); - $('.components_window').html(recipe); - - $('.itemrequirements').fadeIn(); - break - case 'ShowCraftCount': - var time = event.data.time; - var itemName = event.data.name; - - $('#crafting-text').html(`Crafting`); - $('#item-name').html(`${itemName}`); - $('#item-timer').html(`${time}s`); - if(time == lastTime) { - $('#cog').removeClass('fa-spin'); - } else { - $('#cog').addClass('fa-spin'); - } - - - if(!isTimerOn){ - isTimerOn = true; - $('.timer').fadeIn(); - } - lastTime = time - break - case 'CompleteCraftCount': - var itemName = event.data.name; - - $('.timer_card-body').css('background-color', '#1fa34a'); - $('#crafting-text').html(`Crafted`); - $('#item-name').html(`${itemName}`); - $('#item-timer').html(`0s`); - - $('#cog').removeClass('fa-spin'); - $('#cog').removeClass('fa-cog'); - - $('#cog').addClass('fa-check'); - - break - case 'FailedCraftCount': - var itemName = event.data.name; - - $('.timer_card-body').css('background-color', '#990b0b'); - $('#crafting-text').html(`Failed to craft`); - $('#item-name').html(`${itemName}`); - $('#item-timer').html(`0s`); - - $('#cog').removeClass('fa-spin'); - $('#cog').removeClass('fa-cog'); - - $('#cog').addClass('fa-times'); - - break - case 'HideCraftCount': - isTimerOn = false; - $('.timer').fadeOut(); - setTimeout(function(){ - $('#cog').removeClass('fa-times'); - $('#cog').removeClass('fa-check'); - $('#cog').addClass('fa-spin'); - $('#cog').addClass('fa-cog'); - - $('.timer_card-body').css('background-color', 'rgba(31, 94, 255, 1)'); - }, 400); - break - case 'updateCraftingItems': - canClaimItem = true; - if(selectedCategory != ""){ - var queue = event.data.queue; - var queueRow = ''; - CraftQueue = queue; - if(queue.length > 0){ - if(queue.length >= 6){ - $('.craftingq_window').css('padding-right', '0.35rem'); - } else { - $('.craftingq_window').css('padding-right', '0rem'); - } - for (var i = 0; i < queue.length; i++) { - if(queue[i].isDone == true) { - if(queue[i].suc){ - if(queue[i].isDis){ - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Concluded
-
-
-
-
-
-
- `; - } else { - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Concluded
-
-
-
-
-
-
- `; - } - } else { - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Failed to craft
-
-
-
-
-
-
- `; - } - } else { - if(queue[i].isPending){ - if(queue[i].isDis){ - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Pending
-
-
-
-
-
-
- `; - } else { - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Pending
-
-
-
-
-
-
- `; - } - } else { - if(queue[i].isDis){ - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Time left: ${queue[i].time}s
-
-
-
-
-
-
- `; - } else { - queueRow += ` -
-
- -
-
${queue[i].itemName} x${queue[i].amount}
-
Time left: ${queue[i].time}s
-
-
-
-
-
-
- `; - } - } - } - } - } else { - queueRow = `
The crafting queue is empty
` - } - $('.craftingq_window').html(queueRow); - } - break - case 'resetItemNumber': - itemClaiming = 0; - break - case 'resetButton': - if(canCraftItem == false){ - canCraftItem = true; - document.querySelector('#craft-button').disabled = false; - } - break - case 'canClaimAll': - document.querySelector('#claimall-button').disabled = false; - break - case 'closeMenu': - closeMenu(); - break - } -}); - -$(document).on('click', ".cat_tab", function() { - selectedCategory = $("input[name='category']:checked").val(); - var num = craft2.length; - var paragraph = ''; - var row = '
'; - var lastRowNum = 0; - var added = 0 - for(var i = 0; i < num; i++) { - for(var i1 = 0; i1 < craft2[i].job.length; i1++){ - if(selectedCategory == "general_cat" || craft2[i].category == selectedCategory){ - if(craft2[i].job[i1] == job2 || craft2[i].job[i1] == gang || craft2[i].job[i1] == ''){ - if(!craftData.UseXP){ - var itemName = craftData.itemNames; - var itemId = craft2[i].item; - var index = i; - added++ - row += ` -
-
-
- ${itemName[itemId]} - -
-
-
- `; - if ((added) % 4 === 0) { - row = addStr(row, row.length, `
`); - lastRowNum = row.length+6; - } - } else { - if(craft2[i].levelNeeded <= craftData.level || showAllCrafts){ - var itemName = craftData.itemNames; - var itemId = craft2[i].item; - var index = i; - added++ - row += ` -
-
-
- ${itemName[itemId]} - -
-
-
- `; - - if ((added) % 4 === 0) { - row = addStr(row, row.length, `
`); - lastRowNum = row.length+6; - } - } - } - } - } - } - } - row += `
`; - - if(craftData.UseXP) { - $('#currentlevel').html(craftData.level); - document.documentElement.style.setProperty('--percentage-width', craftData.percentage+"%"); - $('.xpbar-col').css('margin-top', '-1.8rem'); - } else { - $('.xpbar').hide(); - $('.xpbar-col').css('margin-top', '5.05rem'); - } - - $('#craft-table').html(row); - $('.title-name').html(craftData.name); - - $('.title').fadeIn(); - $('.itemslist').fadeIn(); - $('.crafting-body').fadeIn(); -}); - -function restartCrafts(){ - selectedCategory = 'general_cat'; - var num = craft2.length; - var paragraph = ''; - var row = '
'; - var lastRowNum = 0; - var added = 0 - for(var i = 0; i < num; i++) { - for(var i1 = 0; i1 < craft2[i].job.length; i1++){ - if(selectedCategory == "general_cat" || craft2[i].category == selectedCategory){ - if(craft2[i].job[i1] == job2 || craft2[i].job[i1] == gang || craft2[i].job[i1] == ''){ - if(!craftData.UseXP){ - var itemName = craftData.itemNames; - var itemId = craft2[i].item; - var index = i; - added++ - row += ` -
-
-
- ${itemName[itemId]} - -
-
-
- `; - if ((added) % 4 === 0) { - row = addStr(row, row.length, `
`); - lastRowNum = row.length+6; - } - } else { - if(craft2[i].levelNeeded <= craftData.level || showAllCrafts){ - var itemName = craftData.itemNames; - var itemId = craft2[i].item; - var index = i; - added++ - row += ` -
-
-
- ${itemName[itemId]} - -
-
-
- `; - - if ((added) % 4 === 0) { - row = addStr(row, row.length, `
`); - lastRowNum = row.length+6; - } - } - } - } - } - } - } - row += `
`; - - if(craftData.UseXP) { - $('#currentlevel').html(craftData.level); - document.documentElement.style.setProperty('--percentage-width', craftData.percentage+"%"); - $('.xpbar-col').css('margin-top', '-1.8rem'); - } else { - $('.xpbar').hide(); - $('.xpbar-col').css('margin-top', '5.05rem'); - } - - $('#craft-table').html(row); - $('.title-name').html(craftData.name); -} - -$(document).ready(function() { - document.onkeyup = function(data) { - if (data.which == 27) { - closeMenu(); - } - }; -}); - -$(document).ready(function(){ - $('#plus').click(function(e) { - var quantity = parseInt($('#quantity').val()); - if(quantity < maxCraft){ - $('#quantity').val(quantity + 1); - updateSideMenu(quantity + 1); - } - }); - - $('#minus').click(function(e) { - var quantity = parseInt($('#quantity').val()); - - if(quantity > maxCraft){ - $('#quantity').val(maxCraft); - updateSideMenu(maxCraft); - } else { - if(quantity > 1) { - $('#quantity').val(quantity - 1); - updateSideMenu(quantity - 1); - } - } - }); - $('#max').click(function(e) { - var quantity = parseInt($('#quantity').val()); - - if(quantity != maxCraft){ - $('#quantity').val(maxCraft); - updateSideMenu(maxCraft); - } - }); -}); - -function quantity_change(t) { - var quantity = parseInt($('#quantity').val()); - - if(quantity > maxCraft){ - $('#quantity').val(maxCraft); - updateSideMenu(maxCraft); - } else if(quantity < 1) { - $('#quantity').val(1); - updateSideMenu(1); - } else { - updateSideMenu(quantity); - } -} - -function craft(t) { - if(canCraftItem){ - canCraftItem = false; - document.querySelector('#craft-button').disabled = true; - var itemId = t.dataset.item; - var recipe = t.dataset.recipe; - var amount = t.dataset.amount; - var xp = t.dataset.xp; - var isDis = t.dataset.isDis; - var index = t.dataset.index; - var level = t.dataset.level; - var quantity = document.getElementById("quantity").value; - if(quantity > maxCraft){ - quantity = maxCraft; - $('#quantity').val(quantity - 1); - updateSideMenu(quantity - 1); - } - $.post('https://okokCrafting/action', JSON.stringify({ - action: "craft-button", - itemID: itemId, - recipe: recipe, - amount: amount, - xp: xp, - quantity: quantity, - isDis: isDis, - index: index, - level: level, - })); - } -} - -function claim(t) { - var index = parseInt(t.dataset.id)+1; - var itemRndID = parseInt(CraftQueue[index-1].randomID); - if(itemClaiming != itemRndID && canClaimItem){ - canClaimItem = false; - itemClaiming = itemRndID; - $.post('https://okokCrafting/action', JSON.stringify({ - action: "claim-item", - index: index, - })); - } -} - -function claimall(t) { - if(CraftQueue[0] != undefined && CraftQueue[0].isDone && canClaimItem){ - canClaimItem = false; - document.querySelector('#claimall-button').disabled = true; - $.post('https://okokCrafting/action', JSON.stringify({ - action: "claim-all", - })); - } - -} - -function claimFail(t) { - var index = parseInt(t.dataset.id)+1; - var itemRndID = parseInt(CraftQueue[index-1].randomID); - if(itemClaiming != itemRndID && canClaimItem){ - canClaimItem = false; - itemClaiming = itemRndID; - $.post('https://okokCrafting/action', JSON.stringify({ - action: "fail-item", - index: index, - })); - } -} - -function cancel(t) { - var index = parseInt(t.dataset.id)+1; - var itemRndID = parseInt(CraftQueue[index-1].randomID); - if(itemClaiming != itemRndID && canClaimItem){ - canClaimItem = false; - itemClaiming = itemRndID; - $.post('https://okokCrafting/action', JSON.stringify({ - action: "cancel-item", - index: index, - })); - } -} - -function updateSideMenu(quantity){ - var canCraft = true - var num = sideCraftMenu.recipe.length; - var recipe = ``; - var img = ` - - ${sideCraftMenu.itemName} x${sideCraftMenu.itemAmount*quantity} - `; - - if(sideCraftMenu.isDis){ - img = ` - - ${sideCraftMenu.itemName} x${sideCraftMenu.itemAmount*quantity} (${sideCraftMenu.isDisItemAmt}) - `; - } - - $('#side-image').html(img); - $('#craft-time').html(sideCraftMenu.time*quantity); - - for(var i = 0; i < num; i++){ - var idName = sideCraftMenu.recipe[i][0]; - if(sideCraftMenu.isDis){ - recipe += ` -
- - ${sideCraftMenu.itemNames[idName]} x${sideCraftMenu.recipe[i][1]*quantity} -
- `; - if(sideCraftMenu.itemAmount > sideCraftMenu.isDisItemAmt){ - canCraft = false - } - } else { - recipe += ` -
- - ${sideCraftMenu.itemNames[idName]} x${sideCraftMenu.recipe[i][1]*quantity} (${sideCraftMenu.inventory[i].key}) -
- `; - if(sideCraftMenu.recipe[i][1] > sideCraftMenu.inventory[i].key){ - canCraft = false - } - } - } - - $('#craft-button-div').html(` - - `); - - if(canCraft) { - $('#craft-button-div').fadeIn(); - } else { - $('#craft-button-div').hide(); - } - - $('#craft-percentage').html(sideCraftMenu.percentage); - $('.components_window').html(recipe); - - $('.itemrequirements').fadeIn(); -} - -function closeMenu(){ - itemClaiming = 0; - selectedCategory = ""; - $('.crafting-body').fadeOut(); - $('.title').fadeOut(); - $('.itemslist').fadeOut(); - $('.itemrequirements').fadeOut(); - setTimeout(function(){ - restartCrafts(); - }, 400); - $.post('https://okokCrafting/action', JSON.stringify({ - action: "close", - })); +function addStr(str, index, stringToAdd){ + return str.substring(0, index) + stringToAdd + str.substring(index, str.length); +} + +var isTimerOn = false; +var lastTime; +var categories = []; +var selectedCategory = "general_cat"; +var craft2; +var job2; +var gang; +var craftData; +var sideCraftMenu; +var itemClaiming = 0; +var CraftQueue = []; +var maxCraft = 10; +var canCraftItem = true; +var showAllCrafts = false; +var canClaimAll = true; + +var canClaimItem = true; +var canOpenSideCraft = true; + +let Inventory = ''; + +window.addEventListener('message', function(event) { + switch (event.data.action) { + case 'openCraft': + selectedCategory = "general_cat"; + canOpenSideCraft = true; + canClaimItem = true; + itemClaiming = 0; + showAllCrafts = event.data.showAllCrafts; + Inventory = event.data.inventory; + var queue = event.data.queue; + craftData = event.data; + categories = event.data.categories; + var craft = event.data.craft; + craft2 = craft; + var num = craft.length; + var paragraph = ''; + var row = '
'; + var lastRowNum = 0; + var job = event.data.job; + job2 = event.data.job; + gang = event.data.gang; + var added = 0; + var useCategories = event.data.useCategories; + var categoriesButtonsHTML = ` + + + `; + document.querySelector('#claimall-button').disabled = false; + if(useCategories){ + for(let i = 0; i < categories.length; i++){ + categoriesButtonsHTML += ` + + + `; + } + $('#categories_btns').html(categoriesButtonsHTML); + $('#categories_box').show(); + } else { + $('#categories_box').hide(); + } + + if(num >= 13){ + $('.itemslist_window').css('padding', '0.3125rem 0.55rem 0.3125rem 0.625rem'); + } else { + $('.itemslist_window').css('padding', '0.3125rem 1.05rem 0.3125rem 0.625rem'); + } + + for(var i = 0; i < num; i++) { + for(var i1 = 0; i1 < craft[i].job.length; i1++){ + if(selectedCategory == "general_cat" || craft[i].category == selectedCategory){ + if(craft[i].job[i1] == job || craft[i].job[i1] == gang || craft[i].job[i1] == ''){ + if(!event.data.UseXP){ + var itemName = event.data.itemNames; + var itemId = craft[i].item; + var index = i; + added++ + row += ` +
+
+
+ ${itemName[itemId]} + +
+
+
+ `; + var myEle = document.getElementById(itemId+"wb_"+event.data.wb+"wb_"+index); + if(!myEle) { + $(document).on('click', "#"+itemId+"wb_"+event.data.wb+"wb_"+index, function() { + if(canOpenSideCraft) { + canOpenSideCraft = false; + allID = this.id; + id = allID.substring(0, allID.indexOf('wb_')); + index2 = allID.split("wb_"); + $('.item_card-body').css('background-color', 'rgba(220, 220, 220, 0.20)'); + $('#selected'+this.id).css('background-color', 'rgba(31, 94, 255, 1)'); + var sound = new Audio('click.mp3'); + sound.volume = 0.3; + sound.play(); + $.post('https://okokCrafting/action', JSON.stringify({ + action: "craft", + item: id, + crafts: craft, + itemName: itemName, + index: index2[2], + })); + } + }); + } + + if ((added) % 4 === 0) { + row = addStr(row, row.length, `
`); + lastRowNum = row.length+6; + } + } else { + if(craft[i].levelNeeded <= event.data.level || showAllCrafts){ + var itemName = event.data.itemNames; + var itemId = craft[i].item; + var index = i; + added++ + row += ` +
+
+
+ ${itemName[itemId]} + +
+
+
+ `; + var myEle = document.getElementById(itemId+"wb_"+event.data.wb+"wb_"+index); + if(!myEle) { + $(document).on('click', "#"+itemId+"wb_"+event.data.wb+"wb_"+index, function() { + if(canOpenSideCraft) { + canOpenSideCraft = false; + allID = this.id; + id = allID.substring(0, allID.indexOf('wb_')); + index2 = allID.split("wb_"); + $('.item_card-body').css('background-color', 'rgba(220, 220, 220, 0.20)'); + $('#selected'+this.id).css('background-color', 'rgba(31, 94, 255, 1)'); + var sound = new Audio('click.mp3'); + sound.volume = 0.3; + sound.play(); + $.post('https://okokCrafting/action', JSON.stringify({ + action: "craft", + item: id, + crafts: craft, + itemName: itemName, + index: index2[2], + level: event.data.level, + })); + } + }); + } + + if ((added) % 4 === 0) { + row = addStr(row, row.length, `
`); + lastRowNum = row.length+6; + } + } + } + } + } + } + } + row += `
`; + + if(event.data.UseXP) { + $('#currentlevel').html(event.data.level); + document.documentElement.style.setProperty('--percentage-width', event.data.percentage+"%"); + $('.xpbar-col').css('margin-top', '-1.8rem'); + } else { + $('.xpbar').hide(); + $('.xpbar-col').css('margin-top', '5.05rem'); + } + + var queueRow = ''; + CraftQueue = queue; + if(queue.length > 0){ + if(queue.length >= 6){ + $('.craftingq_window').css('padding-right', '0.35rem'); + } else { + $('.craftingq_window').css('padding-right', '0rem'); + } + for (var i = 0; i < queue.length; i++) { + if(queue[i].isDone == true) { + if(queue[i].suc){ + if(queue[i].isDis){ + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Concluded
+
+
+
+
+
+
+ `; + } else { + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Concluded
+
+
+
+
+
+
+ `; + } + } else { + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Failed to craft
+
+
+
+
+
+
+ `; + } + } else { + if(queue[i].isPending){ + if(queue[i].isDis){ + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Pending
+
+
+
+
+
+
+ `; + } else { + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Pending
+
+
+
+
+
+
+ `; + } + } else { + if(queue[i].isDis){ + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Time left: ${queue[i].time}s
+
+
+
+
+
+
+ `; + } else { + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Time left: ${queue[i].time}s
+
+
+
+
+
+
+ `; + } + } + } + } + } else { + queueRow = `
The crafting queue is empty
` + } + + $('.craftingq_window').html(queueRow); + $('#craft-table').html(row); + $('.title-name').html(event.data.name); + + $('.title').fadeIn(); + $('.itemslist').fadeIn(); + $('.crafting-body').fadeIn(); + break + case 'openSideCraft': + sideCraftMenu = event.data; + canOpenSideCraft = true; + var useLevels = false; + if(sideCraftMenu.level != undefined){ + var levelNeeded = sideCraftMenu.crafts[sideCraftMenu.index].levelNeeded; + var level = sideCraftMenu.level; + useLevels = true; + } + + var isLevel = false; + $('#quantity').val(1); + maxCraft = sideCraftMenu.maxCraft; + if(canCraftItem == false){ + canCraftItem = true; + document.querySelector('#craft-button').disabled = false; + } + + var canCraft = true; + var isAvailable = false; + var num = event.data.recipe.length; + var recipe = ``; + var img = ` + + ${event.data.itemName} x${event.data.itemAmount} + `; + + if(sideCraftMenu.isDis){ + $('#top_text').html(`Requirements`); + $('#bot_text').html(`You will receive`); + img = ` + + ${event.data.itemName} x${event.data.itemAmount} (${event.data.isDisItemAmt}) + `; + } else { + $('#top_text').html(`You will receive`); + $('#bot_text').html(`Requirements`); + } + + $('#side-image').html(img); + $('#craft-time').html(event.data.time); + + if(useLevels){ + if(level >= levelNeeded){ + canCraft = true; + isAvailable = true; + isLevel = true; + } else { + isAvailable = false; + canCraft = false; + isLevel = true; + } + } + + for(var i = 0; i < num; i++){ + var idName = event.data.recipe[i][0]; + if(sideCraftMenu.isDis){ + recipe += ` +
+ + ${event.data.itemNames[idName]} x${event.data.recipe[i][1]} +
+ `; + if(event.data.itemAmount > event.data.isDisItemAmt){ + canCraft = false + } + } else { + recipe += ` +
+ + ${event.data.itemNames[idName]} x${event.data.recipe[i][1]} (${event.data.inventory[i].key}) +
+ `; + if(event.data.recipe[i][1] > event.data.inventory[i].key){ + canCraft = false + } + } + } + + + $('#craft-button-div').html(` + + `); + + if(canCraft) { + $('#craft-buttons-info').fadeIn(); + $('#craft-button-div').fadeIn(); + $('#craft-buttons-info-level').hide(); + } else { + $('#craft-buttons-info').hide(); + $('#craft-buttons-info-level').hide(); + } + + if(useLevels){ + if(!isAvailable && isLevel){ + $('#craft-button-div-level').html(` + LEVEL REQUIRED: ${levelNeeded} + `); + $('#craft-buttons-info-level').fadeIn(); + $('#craft-button-div-level').fadeIn(); + } + } + + $('#craft-percentage').html(event.data.percentage); + $('.components_window').html(recipe); + + $('.itemrequirements').fadeIn(); + break + case 'ShowCraftCount': + var time = event.data.time; + var itemName = event.data.name; + + $('#crafting-text').html(`Crafting`); + $('#item-name').html(`${itemName}`); + $('#item-timer').html(`${time}s`); + if(time == lastTime) { + $('#cog').removeClass('fa-spin'); + } else { + $('#cog').addClass('fa-spin'); + } + + + if(!isTimerOn){ + isTimerOn = true; + $('.timer').fadeIn(); + } + lastTime = time + break + case 'CompleteCraftCount': + var itemName = event.data.name; + + $('.timer_card-body').css('background-color', '#1fa34a'); + $('#crafting-text').html(`Crafted`); + $('#item-name').html(`${itemName}`); + $('#item-timer').html(`0s`); + + $('#cog').removeClass('fa-spin'); + $('#cog').removeClass('fa-cog'); + + $('#cog').addClass('fa-check'); + + break + case 'FailedCraftCount': + var itemName = event.data.name; + + $('.timer_card-body').css('background-color', '#990b0b'); + $('#crafting-text').html(`Failed to craft`); + $('#item-name').html(`${itemName}`); + $('#item-timer').html(`0s`); + + $('#cog').removeClass('fa-spin'); + $('#cog').removeClass('fa-cog'); + + $('#cog').addClass('fa-times'); + + break + case 'HideCraftCount': + isTimerOn = false; + $('.timer').fadeOut(); + setTimeout(function(){ + $('#cog').removeClass('fa-times'); + $('#cog').removeClass('fa-check'); + $('#cog').addClass('fa-spin'); + $('#cog').addClass('fa-cog'); + + $('.timer_card-body').css('background-color', 'rgba(31, 94, 255, 1)'); + }, 400); + break + case 'updateCraftingItems': + canClaimItem = true; + if(selectedCategory != ""){ + var queue = event.data.queue; + var queueRow = ''; + CraftQueue = queue; + if(queue.length > 0){ + if(queue.length >= 6){ + $('.craftingq_window').css('padding-right', '0.35rem'); + } else { + $('.craftingq_window').css('padding-right', '0rem'); + } + for (var i = 0; i < queue.length; i++) { + if(queue[i].isDone == true) { + if(queue[i].suc){ + if(queue[i].isDis){ + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Concluded
+
+
+
+
+
+
+ `; + } else { + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Concluded
+
+
+
+
+
+
+ `; + } + } else { + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Failed to craft
+
+
+
+
+
+
+ `; + } + } else { + if(queue[i].isPending){ + if(queue[i].isDis){ + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Pending
+
+
+
+
+
+
+ `; + } else { + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Pending
+
+
+
+
+
+
+ `; + } + } else { + if(queue[i].isDis){ + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Time left: ${queue[i].time}s
+
+
+
+
+
+
+ `; + } else { + queueRow += ` +
+
+ +
+
${queue[i].itemName} x${queue[i].amount}
+
Time left: ${queue[i].time}s
+
+
+
+
+
+
+ `; + } + } + } + } + } else { + queueRow = `
The crafting queue is empty
` + } + $('.craftingq_window').html(queueRow); + } + break + case 'resetItemNumber': + itemClaiming = 0; + break + case 'resetButton': + if(canCraftItem == false){ + canCraftItem = true; + document.querySelector('#craft-button').disabled = false; + } + break + case 'canClaimAll': + document.querySelector('#claimall-button').disabled = false; + break + case 'closeMenu': + closeMenu(); + break + } +}); + +$(document).on('click', ".cat_tab", function() { + selectedCategory = $("input[name='category']:checked").val(); + var num = craft2.length; + var paragraph = ''; + var row = '
'; + var lastRowNum = 0; + var added = 0 + for(var i = 0; i < num; i++) { + for(var i1 = 0; i1 < craft2[i].job.length; i1++){ + if(selectedCategory == "general_cat" || craft2[i].category == selectedCategory){ + if(craft2[i].job[i1] == job2 || craft2[i].job[i1] == gang || craft2[i].job[i1] == ''){ + if(!craftData.UseXP){ + var itemName = craftData.itemNames; + var itemId = craft2[i].item; + var index = i; + added++ + row += ` +
+
+
+ ${itemName[itemId]} + +
+
+
+ `; + if ((added) % 4 === 0) { + row = addStr(row, row.length, `
`); + lastRowNum = row.length+6; + } + } else { + if(craft2[i].levelNeeded <= craftData.level || showAllCrafts){ + var itemName = craftData.itemNames; + var itemId = craft2[i].item; + var index = i; + added++ + row += ` +
+
+
+ ${itemName[itemId]} + +
+
+
+ `; + + if ((added) % 4 === 0) { + row = addStr(row, row.length, `
`); + lastRowNum = row.length+6; + } + } + } + } + } + } + } + row += `
`; + + if(craftData.UseXP) { + $('#currentlevel').html(craftData.level); + document.documentElement.style.setProperty('--percentage-width', craftData.percentage+"%"); + $('.xpbar-col').css('margin-top', '-1.8rem'); + } else { + $('.xpbar').hide(); + $('.xpbar-col').css('margin-top', '5.05rem'); + } + + $('#craft-table').html(row); + $('.title-name').html(craftData.name); + + $('.title').fadeIn(); + $('.itemslist').fadeIn(); + $('.crafting-body').fadeIn(); +}); + +function restartCrafts(){ + selectedCategory = 'general_cat'; + var num = craft2.length; + var paragraph = ''; + var row = '
'; + var lastRowNum = 0; + var added = 0 + for(var i = 0; i < num; i++) { + for(var i1 = 0; i1 < craft2[i].job.length; i1++){ + if(selectedCategory == "general_cat" || craft2[i].category == selectedCategory){ + if(craft2[i].job[i1] == job2 || craft2[i].job[i1] == gang || craft2[i].job[i1] == ''){ + if(!craftData.UseXP){ + var itemName = craftData.itemNames; + var itemId = craft2[i].item; + var index = i; + added++ + row += ` +
+
+
+ ${itemName[itemId]} + +
+
+
+ `; + if ((added) % 4 === 0) { + row = addStr(row, row.length, `
`); + lastRowNum = row.length+6; + } + } else { + if(craft2[i].levelNeeded <= craftData.level || showAllCrafts){ + var itemName = craftData.itemNames; + var itemId = craft2[i].item; + var index = i; + added++ + row += ` +
+
+
+ ${itemName[itemId]} + +
+
+
+ `; + + if ((added) % 4 === 0) { + row = addStr(row, row.length, `
`); + lastRowNum = row.length+6; + } + } + } + } + } + } + } + row += `
`; + + if(craftData.UseXP) { + $('#currentlevel').html(craftData.level); + document.documentElement.style.setProperty('--percentage-width', craftData.percentage+"%"); + $('.xpbar-col').css('margin-top', '-1.8rem'); + } else { + $('.xpbar').hide(); + $('.xpbar-col').css('margin-top', '5.05rem'); + } + + $('#craft-table').html(row); + $('.title-name').html(craftData.name); +} + +$(document).ready(function() { + document.onkeyup = function(data) { + if (data.which == 27) { + closeMenu(); + } + }; +}); + +$(document).ready(function(){ + $('#plus').click(function(e) { + var quantity = parseInt($('#quantity').val()); + if(quantity < maxCraft){ + $('#quantity').val(quantity + 1); + updateSideMenu(quantity + 1); + } + }); + + $('#minus').click(function(e) { + var quantity = parseInt($('#quantity').val()); + + if(quantity > maxCraft){ + $('#quantity').val(maxCraft); + updateSideMenu(maxCraft); + } else { + if(quantity > 1) { + $('#quantity').val(quantity - 1); + updateSideMenu(quantity - 1); + } + } + }); + $('#max').click(function(e) { + var quantity = parseInt($('#quantity').val()); + + if(quantity != maxCraft){ + $('#quantity').val(maxCraft); + updateSideMenu(maxCraft); + } + }); +}); + +function quantity_change(t) { + var quantity = parseInt($('#quantity').val()); + + if(quantity > maxCraft){ + $('#quantity').val(maxCraft); + updateSideMenu(maxCraft); + } else if(quantity < 1) { + $('#quantity').val(1); + updateSideMenu(1); + } else { + updateSideMenu(quantity); + } +} + +function craft(t) { + if(canCraftItem){ + canCraftItem = false; + document.querySelector('#craft-button').disabled = true; + var itemId = t.dataset.item; + var recipe = t.dataset.recipe; + var amount = t.dataset.amount; + var xp = t.dataset.xp; + var isDis = t.dataset.isDis; + var index = t.dataset.index; + var level = t.dataset.level; + var quantity = document.getElementById("quantity").value; + if(quantity > maxCraft){ + quantity = maxCraft; + $('#quantity').val(quantity - 1); + updateSideMenu(quantity - 1); + } + $.post('https://okokCrafting/action', JSON.stringify({ + action: "craft-button", + itemID: itemId, + recipe: recipe, + amount: amount, + xp: xp, + quantity: quantity, + isDis: isDis, + index: index, + level: level, + })); + } +} + +function claim(t) { + var index = parseInt(t.dataset.id)+1; + var itemRndID = parseInt(CraftQueue[index-1].randomID); + if(itemClaiming != itemRndID && canClaimItem){ + canClaimItem = false; + itemClaiming = itemRndID; + $.post('https://okokCrafting/action', JSON.stringify({ + action: "claim-item", + index: index, + })); + } +} + +function claimall(t) { + if(CraftQueue[0] != undefined && CraftQueue[0].isDone && canClaimItem){ + canClaimItem = false; + document.querySelector('#claimall-button').disabled = true; + $.post('https://okokCrafting/action', JSON.stringify({ + action: "claim-all", + })); + } + +} + +function claimFail(t) { + var index = parseInt(t.dataset.id)+1; + var itemRndID = parseInt(CraftQueue[index-1].randomID); + if(itemClaiming != itemRndID && canClaimItem){ + canClaimItem = false; + itemClaiming = itemRndID; + $.post('https://okokCrafting/action', JSON.stringify({ + action: "fail-item", + index: index, + })); + } +} + +function cancel(t) { + var index = parseInt(t.dataset.id)+1; + var itemRndID = parseInt(CraftQueue[index-1].randomID); + if(itemClaiming != itemRndID && canClaimItem){ + canClaimItem = false; + itemClaiming = itemRndID; + $.post('https://okokCrafting/action', JSON.stringify({ + action: "cancel-item", + index: index, + })); + } +} + +function updateSideMenu(quantity){ + var canCraft = true + var num = sideCraftMenu.recipe.length; + var recipe = ``; + var img = ` + + ${sideCraftMenu.itemName} x${sideCraftMenu.itemAmount*quantity} + `; + + if(sideCraftMenu.isDis){ + img = ` + + ${sideCraftMenu.itemName} x${sideCraftMenu.itemAmount*quantity} (${sideCraftMenu.isDisItemAmt}) + `; + } + + $('#side-image').html(img); + $('#craft-time').html(sideCraftMenu.time*quantity); + + for(var i = 0; i < num; i++){ + var idName = sideCraftMenu.recipe[i][0]; + if(sideCraftMenu.isDis){ + recipe += ` +
+ + ${sideCraftMenu.itemNames[idName]} x${sideCraftMenu.recipe[i][1]*quantity} +
+ `; + if(sideCraftMenu.itemAmount > sideCraftMenu.isDisItemAmt){ + canCraft = false + } + } else { + recipe += ` +
+ + ${sideCraftMenu.itemNames[idName]} x${sideCraftMenu.recipe[i][1]*quantity} (${sideCraftMenu.inventory[i].key}) +
+ `; + if(sideCraftMenu.recipe[i][1] > sideCraftMenu.inventory[i].key){ + canCraft = false + } + } + } + + $('#craft-button-div').html(` + + `); + + if(canCraft) { + $('#craft-button-div').fadeIn(); + } else { + $('#craft-button-div').hide(); + } + + $('#craft-percentage').html(sideCraftMenu.percentage); + $('.components_window').html(recipe); + + $('.itemrequirements').fadeIn(); +} + +function closeMenu(){ + itemClaiming = 0; + selectedCategory = ""; + $('.crafting-body').fadeOut(); + $('.title').fadeOut(); + $('.itemslist').fadeOut(); + $('.itemrequirements').fadeOut(); + setTimeout(function(){ + restartCrafts(); + }, 400); + $.post('https://okokCrafting/action', JSON.stringify({ + action: "close", + })); } \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/web/styles.css b/resources/[test]/okokCrafting/web/styles.css similarity index 94% rename from resources/[tools]/okokCrafting/web/styles.css rename to resources/[test]/okokCrafting/web/styles.css index e30aed3ca..b1ceea3af 100644 --- a/resources/[tools]/okokCrafting/web/styles.css +++ b/resources/[test]/okokCrafting/web/styles.css @@ -1,589 +1,589 @@ -@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;700;800;900&display=swap'); - -*,*:focus,*:hover{ - outline:none; -} - -html, body { - height: 100%; -} - -html { - font-size: calc(16 / 19.2 * 1vw); -} - -@media (min-aspect-ratio: 16 / 9) { - html { - font-size: calc(16 / 10.8 * 1vh); - } -} - -body { - font-family: 'Tajawal', sans-serif; - background: none; - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; - user-select: none; -} - -.crafting-body { - display: none; - height: 48rem; -} - -.title-main { - margin-top: -3.05rem; -} - -.title { - color: #fff; - font-size: 3.75rem; - line-height: 1; - text-transform: uppercase; - text-align: center; -} - -.title-name { - font-weight: 300; -} - -.title-name2 { - font-weight: 600; - margin-left: 0.938rem; -} - -.card { - border: none; - border-radius: 1.25rem; - background-color: transparent; -} - -.card-body { - background-color: #ffffff; - font-size: 0.938rem; - font-weight: 500; - border-radius: 1.25rem; -} - -.itemslist { - display: none; - margin-top: 2.9rem; -} - -.itemrequirements { - display: none; -} - -.xpbar-col { - margin-top: -1.8rem; - margin-left: -0.3rem; - width: 24.65rem; -} - -.xpbar { - margin-bottom: 1.35rem; -} - -.itemslist_card { - width: 50rem; -} - -.itemslist_card-body { - background: transparent; -} - -.itemslist_window { - overflow-x: hidden; - height: 35.2rem; - padding: 0.3125rem 1.05rem 0.3125rem 0.625rem; -} - -.item_card { - width: 10.625rem; - height: 10.625rem; -} - -.item_card:hover { - cursor: pointer; -} - -.item_card-body { - width: 10.625rem; - height: 10.625rem; - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); - transition: 0.25s; - background-color: rgba(220, 220, 220, 0.20); -} - -.item_card-body:hover { - background-color: rgba(31, 94, 255, 1) !important; - transition: 0.25s; - transform: scale(1.030); -} - -.item-title { - color: #fff; - font-weight: 600; - position: absolute; - top: 8%; -} - -.image { - height: 7.5rem; - position: absolute; - top: 22.5%; -} - -.image_itemselected { - height: 5rem; -} - -.text_itemselected { - color: #fff; - font-weight: 600; - font-size: 1.25rem; -} - -.image_components { - height: 3.75rem; -} - -::-webkit-scrollbar { - width: 0.5rem; -} - -::-webkit-scrollbar-track { - background-color: transparent; -} - -::-webkit-scrollbar-thumb { - background-color: #1f5eff; - border-radius: 0.625rem; - transition: .25s; -} - -::-webkit-scrollbar-thumb:hover { - cursor: pointer; - background-color: #0a4df9; - transition: .25s; -} - -.timer { - position: fixed; - right: 2rem; - bottom: 4rem; - font-size: 3.125rem; - display: none; -} - -.timer_card { - height: 1.875rem; -} - -.timer_card-body { - background-color: rgba(31, 94, 255, 1); - font-weight: 600 !important; - color: #fff !important; - font-size: 1.25rem !important; - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); - padding-right: 4.375rem; -} - -#crafting-text { - margin-left: 0.625rem; -} - -#item-timer { - position: absolute; - right: 0.938rem; -} - -#time { - position: absolute; - top: 0.625rem; - right: 0.625rem; - color: #fff; - background-color: rgba(31, 94, 255, 1); - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); - border-radius: 0.625rem; - padding: 0.313rem; -} - -#percentage { - position: absolute; - top: 3.1rem; - right: 0.625rem; - color: #fff; - background-color: rgba(31, 94, 255, 1); - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); - border-radius: 0.625rem; - padding: 0.313rem; -} - -#level-text { - color: #fff; - font-weight: 600; - font-size: 2rem; -} - -.progress { - background: rgba(220, 220, 220, 0.20); - justify-content: flex-start; - border-radius: 1.25rem; - align-items: center; - position: relative; - padding: 0 0.313rem; - display: flex; - height: 2.5rem; - width: 100%; - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); -} - -.progress-value { - width: var(--percentage-width); - transition: width .5s ease-in-out; - border-radius: 6.25rem; - background: #1f5eff; - height: 1.875rem; -} - -:root { - --percentage-width: 0%; -} - - -@keyframes load { - 0% { width: 0; } - 100% { width: var(--percentage-width); } -} - -.btn { - font-weight: 500; - font-size: 1.125rem; - padding: 0.8125rem 1.0625rem; - border: none; - transition: 0.25s; - letter-spacing: 0.0125rem; -} - -.btn-blue { - background-color: #1f5eff; - color: #e6e6e6; -} - -.btn-blue:hover { - background-color: #0a4df9; - color: #e6e6e6; -} - -.btn-blue-level { - font-size: 1.125rem; - padding: 0.8125rem 1.0625rem; - letter-spacing: 0.0125rem; - display: inline-block; - text-align: center; - background-color: #1f5eff; - color: #e6e6e6; - border-radius: 1rem; - width: 100%; - font-weight: 600; - box-shadow: 0rem 0rem 0.313rem 0rem rgb(10 10 10 / 30%); -} - -.btn:focus { - box-shadow: none; -} - -.btn-category { - background-color: #1f5eff; - border: none !important; - outline: none !important; - box-shadow: none !important; - transition: .25s; - font-weight: 600; - color: #fff; -} - -.btn-category:hover { - background-color: #0a4df9; - color: #fff; - transition: .25s; -} - -.btn:focus { - box-shadow: none; -} - -.btn-check:active+.btn-category:focus, .btn-check:checked+.btn-category:focus, .btn-category.active:focus, .btn-category:active:focus, .show>.btn-category.dropdown-toggle:focus { - box-shadow: none; - transition: .25s; -} - -.btn-check:active+.btn-category, .btn-check:checked+.btn-category, .btn-category.active, .btn-category:active, .show>.btn-category.dropdown-toggle { - background-color: #fcfcfc; - border-color: none; - transition: .25s; - color: #1f5eff; -} - -hr { - opacity: 1; - color: #fff; -} - -.queue-item { - background-color: #1f5eff; - border-radius: 0.625rem; - padding: 0.5rem; - transition: .25s; -} - -.queue-item:hover { - background-color: #0a4df9; - border-radius: 0.625rem; - padding: 0.5rem; - transition: .25s; -} - -.queue-item-concluded { - background-color: #25ba59; - border-radius: 0.625rem; - padding: 0.5rem; - transition: .25s; -} - -.queue-item-concluded:hover { - background-color: #20ab51; - border-radius: 0.625rem; - padding: 0.5rem; - transition: .25s; -} - -.queue-item-failed { - background-color: #ff2943; - border-radius: 0.625rem; - padding: 0.5rem; - transition: .25s; -} - -.queue-item-failed:hover { - background-color: #cd0032; - border-radius: 0.625rem; - padding: 0.5rem; - transition: .25s; -} - -.queue-cancelbutton { - font-size: 1.75rem; -} - -.queue-cancelbutton-bg { - width: 2.5rem; - height: 2.5rem; - background-color: #fff; - border-radius: 0.625rem; - color: #1f5eff; - transition: .25s; -} - -.queue-cancelbutton-bg:hover { - background-color: #e1e1e3; - transition: .25s; - cursor: pointer; -} - -.queue-claimbutton { - font-size: 1.75rem; -} - -.queue-claimbutton-bg { - width: 2.5rem; - height: 2.5rem; - background-color: #fff; - border-radius: 0.625rem; - color: #25ba59; - transition: .25s; -} - -.queue-claimbutton-bg:hover { - background-color: #e1e1e3; - transition: .25s; - cursor: pointer; -} - -.queue-failbutton-bg { - width: 2.5rem; - height: 2.5rem; - background-color: #fff; - border-radius: 0.625rem; - color: #ff2943; - transition: .25s; -} - -.queue-failbutton-bg:hover { - background-color: #e1e1e3; - transition: .25s; - cursor: pointer; -} - -.components_window { - max-height: 18.75rem; - overflow-x: hidden; -} - -.craftingq_window { - max-height: 27.3rem; - overflow-x: hidden; - padding-right: 0.35rem; -} - -.btn-group { - padding: 0.5rem; - background-color: rgba(220, 220, 220, 0.20); - border-radius: 1.25rem; - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); - margin-top: 2rem; -} - -.first-category { - border-top-left-radius: 1rem; - border-bottom-left-radius: 1rem; -} - -.last-category { - border-top-right-radius: 1rem; - border-bottom-right-radius: 1rem; -} - -#craft-button, #claimall-button { - border-radius: 1rem; - width: 100%; - font-weight: 600; - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); -} - -.component, .noitq { - color: #fff; - font-weight: 600; - font-size: 1.25rem; -} - -.row-h { - height: 43.8rem; -} - -.queue-itemname { - color: #fff; - font-weight: 600; - font-size: 1.25rem; - line-height: 1; -} - -.queue-itemstate { - line-height: 1; - color: #ededed; - margin-top: 0.2rem; - font-weight: 600; -} - -.queue-item-mr { - margin-right: 0.65rem; -} - -.itemslist_row-h { - margin-top: 1.35rem; -} - -.section-title { - color: #fff; - font-weight: 600; - font-size: 2rem; -} - -.craftingq_card { - width: 23.125rem; - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); - margin-top: 5.05rem; - height: 34.56rem; -} - -.craftingq_card-body { - background-color: rgba(220, 220, 220, 0.20); - min-height: 34.5625rem; -} - -.ywr { - color: #fff; - font-weight: 600; - font-size: 2rem; -} - -.itemr_card { - height: 34.56rem; - box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); -} - -.itemr_card-body { - background-color: rgba(220, 220, 220, 0.20); -} - -.craft-tp { - color: #fff; - font-weight: 600; -} - -.btn-group>.btn-group:not(:first-child), .btn-group>.btn:not(:first-child) { - margin-left: 0; -} - -.form-control { - border: none; - border-radius: 0; - padding: 0rem 0.75rem; -} - -.form-control:focus { - box-shadow: none; -} - -#minus { - border-radius: 0; - border-top-left-radius: 1rem; - border-bottom-left-radius: 1rem; -} - -#plus { - border-radius: 0; - border-top-right-radius: 1rem; - border-bottom-right-radius: 1rem; -} - -#quantity { - background-color: rgba(220, 220, 220, 0.20); - color: #fff; - font-size: 2rem; - font-weight: 600; -} - -#max { - box-shadow: 0rem 0rem 0.313rem 0rem rgb(10 10 10 / 30%); - border-radius: 1rem; - font-weight: 600; -} - -.mip { - box-shadow: 0rem 0rem 0.313rem 0rem rgb(10 10 10 / 30%); - border-radius: 1rem; -} - -input::-webkit-outer-spin-button, -input::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; -} - -.crafting { - height: 48rem; +@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;700;800;900&display=swap'); + +*,*:focus,*:hover{ + outline:none; +} + +html, body { + height: 100%; +} + +html { + font-size: calc(16 / 19.2 * 1vw); +} + +@media (min-aspect-ratio: 16 / 9) { + html { + font-size: calc(16 / 10.8 * 1vh); + } +} + +body { + font-family: 'Tajawal', sans-serif; + background: none; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + user-select: none; +} + +.crafting-body { + display: none; + height: 48rem; +} + +.title-main { + margin-top: -3.05rem; +} + +.title { + color: #fff; + font-size: 3.75rem; + line-height: 1; + text-transform: uppercase; + text-align: center; +} + +.title-name { + font-weight: 300; +} + +.title-name2 { + font-weight: 600; + margin-left: 0.938rem; +} + +.card { + border: none; + border-radius: 1.25rem; + background-color: transparent; +} + +.card-body { + background-color: #ffffff; + font-size: 0.938rem; + font-weight: 500; + border-radius: 1.25rem; +} + +.itemslist { + display: none; + margin-top: 2.9rem; +} + +.itemrequirements { + display: none; +} + +.xpbar-col { + margin-top: -1.8rem; + margin-left: -0.3rem; + width: 24.65rem; +} + +.xpbar { + margin-bottom: 1.35rem; +} + +.itemslist_card { + width: 50rem; +} + +.itemslist_card-body { + background: transparent; +} + +.itemslist_window { + overflow-x: hidden; + height: 35.2rem; + padding: 0.3125rem 1.05rem 0.3125rem 0.625rem; +} + +.item_card { + width: 10.625rem; + height: 10.625rem; +} + +.item_card:hover { + cursor: pointer; +} + +.item_card-body { + width: 10.625rem; + height: 10.625rem; + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); + transition: 0.25s; + background-color: rgba(220, 220, 220, 0.20); +} + +.item_card-body:hover { + background-color: rgba(31, 94, 255, 1) !important; + transition: 0.25s; + transform: scale(1.030); +} + +.item-title { + color: #fff; + font-weight: 600; + position: absolute; + top: 8%; +} + +.image { + height: 7.5rem; + position: absolute; + top: 22.5%; +} + +.image_itemselected { + height: 5rem; +} + +.text_itemselected { + color: #fff; + font-weight: 600; + font-size: 1.25rem; +} + +.image_components { + height: 3.75rem; +} + +::-webkit-scrollbar { + width: 0.5rem; +} + +::-webkit-scrollbar-track { + background-color: transparent; +} + +::-webkit-scrollbar-thumb { + background-color: #1f5eff; + border-radius: 0.625rem; + transition: .25s; +} + +::-webkit-scrollbar-thumb:hover { + cursor: pointer; + background-color: #0a4df9; + transition: .25s; +} + +.timer { + position: fixed; + right: 2rem; + bottom: 4rem; + font-size: 3.125rem; + display: none; +} + +.timer_card { + height: 1.875rem; +} + +.timer_card-body { + background-color: rgba(31, 94, 255, 1); + font-weight: 600 !important; + color: #fff !important; + font-size: 1.25rem !important; + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); + padding-right: 4.375rem; +} + +#crafting-text { + margin-left: 0.625rem; +} + +#item-timer { + position: absolute; + right: 0.938rem; +} + +#time { + position: absolute; + top: 0.625rem; + right: 0.625rem; + color: #fff; + background-color: rgba(31, 94, 255, 1); + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); + border-radius: 0.625rem; + padding: 0.313rem; +} + +#percentage { + position: absolute; + top: 3.1rem; + right: 0.625rem; + color: #fff; + background-color: rgba(31, 94, 255, 1); + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); + border-radius: 0.625rem; + padding: 0.313rem; +} + +#level-text { + color: #fff; + font-weight: 600; + font-size: 2rem; +} + +.progress { + background: rgba(220, 220, 220, 0.20); + justify-content: flex-start; + border-radius: 1.25rem; + align-items: center; + position: relative; + padding: 0 0.313rem; + display: flex; + height: 2.5rem; + width: 100%; + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); +} + +.progress-value { + width: var(--percentage-width); + transition: width .5s ease-in-out; + border-radius: 6.25rem; + background: #1f5eff; + height: 1.875rem; +} + +:root { + --percentage-width: 0%; +} + + +@keyframes load { + 0% { width: 0; } + 100% { width: var(--percentage-width); } +} + +.btn { + font-weight: 500; + font-size: 1.125rem; + padding: 0.8125rem 1.0625rem; + border: none; + transition: 0.25s; + letter-spacing: 0.0125rem; +} + +.btn-blue { + background-color: #1f5eff; + color: #e6e6e6; +} + +.btn-blue:hover { + background-color: #0a4df9; + color: #e6e6e6; +} + +.btn-blue-level { + font-size: 1.125rem; + padding: 0.8125rem 1.0625rem; + letter-spacing: 0.0125rem; + display: inline-block; + text-align: center; + background-color: #1f5eff; + color: #e6e6e6; + border-radius: 1rem; + width: 100%; + font-weight: 600; + box-shadow: 0rem 0rem 0.313rem 0rem rgb(10 10 10 / 30%); +} + +.btn:focus { + box-shadow: none; +} + +.btn-category { + background-color: #1f5eff; + border: none !important; + outline: none !important; + box-shadow: none !important; + transition: .25s; + font-weight: 600; + color: #fff; +} + +.btn-category:hover { + background-color: #0a4df9; + color: #fff; + transition: .25s; +} + +.btn:focus { + box-shadow: none; +} + +.btn-check:active+.btn-category:focus, .btn-check:checked+.btn-category:focus, .btn-category.active:focus, .btn-category:active:focus, .show>.btn-category.dropdown-toggle:focus { + box-shadow: none; + transition: .25s; +} + +.btn-check:active+.btn-category, .btn-check:checked+.btn-category, .btn-category.active, .btn-category:active, .show>.btn-category.dropdown-toggle { + background-color: #fcfcfc; + border-color: none; + transition: .25s; + color: #1f5eff; +} + +hr { + opacity: 1; + color: #fff; +} + +.queue-item { + background-color: #1f5eff; + border-radius: 0.625rem; + padding: 0.5rem; + transition: .25s; +} + +.queue-item:hover { + background-color: #0a4df9; + border-radius: 0.625rem; + padding: 0.5rem; + transition: .25s; +} + +.queue-item-concluded { + background-color: #25ba59; + border-radius: 0.625rem; + padding: 0.5rem; + transition: .25s; +} + +.queue-item-concluded:hover { + background-color: #20ab51; + border-radius: 0.625rem; + padding: 0.5rem; + transition: .25s; +} + +.queue-item-failed { + background-color: #ff2943; + border-radius: 0.625rem; + padding: 0.5rem; + transition: .25s; +} + +.queue-item-failed:hover { + background-color: #cd0032; + border-radius: 0.625rem; + padding: 0.5rem; + transition: .25s; +} + +.queue-cancelbutton { + font-size: 1.75rem; +} + +.queue-cancelbutton-bg { + width: 2.5rem; + height: 2.5rem; + background-color: #fff; + border-radius: 0.625rem; + color: #1f5eff; + transition: .25s; +} + +.queue-cancelbutton-bg:hover { + background-color: #e1e1e3; + transition: .25s; + cursor: pointer; +} + +.queue-claimbutton { + font-size: 1.75rem; +} + +.queue-claimbutton-bg { + width: 2.5rem; + height: 2.5rem; + background-color: #fff; + border-radius: 0.625rem; + color: #25ba59; + transition: .25s; +} + +.queue-claimbutton-bg:hover { + background-color: #e1e1e3; + transition: .25s; + cursor: pointer; +} + +.queue-failbutton-bg { + width: 2.5rem; + height: 2.5rem; + background-color: #fff; + border-radius: 0.625rem; + color: #ff2943; + transition: .25s; +} + +.queue-failbutton-bg:hover { + background-color: #e1e1e3; + transition: .25s; + cursor: pointer; +} + +.components_window { + max-height: 18.75rem; + overflow-x: hidden; +} + +.craftingq_window { + max-height: 27.3rem; + overflow-x: hidden; + padding-right: 0.35rem; +} + +.btn-group { + padding: 0.5rem; + background-color: rgba(220, 220, 220, 0.20); + border-radius: 1.25rem; + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); + margin-top: 2rem; +} + +.first-category { + border-top-left-radius: 1rem; + border-bottom-left-radius: 1rem; +} + +.last-category { + border-top-right-radius: 1rem; + border-bottom-right-radius: 1rem; +} + +#craft-button, #claimall-button { + border-radius: 1rem; + width: 100%; + font-weight: 600; + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); +} + +.component, .noitq { + color: #fff; + font-weight: 600; + font-size: 1.25rem; +} + +.row-h { + height: 43.8rem; +} + +.queue-itemname { + color: #fff; + font-weight: 600; + font-size: 1.25rem; + line-height: 1; +} + +.queue-itemstate { + line-height: 1; + color: #ededed; + margin-top: 0.2rem; + font-weight: 600; +} + +.queue-item-mr { + margin-right: 0.65rem; +} + +.itemslist_row-h { + margin-top: 1.35rem; +} + +.section-title { + color: #fff; + font-weight: 600; + font-size: 2rem; +} + +.craftingq_card { + width: 23.125rem; + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); + margin-top: 5.05rem; + height: 34.56rem; +} + +.craftingq_card-body { + background-color: rgba(220, 220, 220, 0.20); + min-height: 34.5625rem; +} + +.ywr { + color: #fff; + font-weight: 600; + font-size: 2rem; +} + +.itemr_card { + height: 34.56rem; + box-shadow: 0rem 0rem 0.313rem 0rem rgba(10, 10, 10, 0.3); +} + +.itemr_card-body { + background-color: rgba(220, 220, 220, 0.20); +} + +.craft-tp { + color: #fff; + font-weight: 600; +} + +.btn-group>.btn-group:not(:first-child), .btn-group>.btn:not(:first-child) { + margin-left: 0; +} + +.form-control { + border: none; + border-radius: 0; + padding: 0rem 0.75rem; +} + +.form-control:focus { + box-shadow: none; +} + +#minus { + border-radius: 0; + border-top-left-radius: 1rem; + border-bottom-left-radius: 1rem; +} + +#plus { + border-radius: 0; + border-top-right-radius: 1rem; + border-bottom-right-radius: 1rem; +} + +#quantity { + background-color: rgba(220, 220, 220, 0.20); + color: #fff; + font-size: 2rem; + font-weight: 600; +} + +#max { + box-shadow: 0rem 0rem 0.313rem 0rem rgb(10 10 10 / 30%); + border-radius: 1rem; + font-weight: 600; +} + +.mip { + box-shadow: 0rem 0rem 0.313rem 0rem rgb(10 10 10 / 30%); + border-radius: 1rem; +} + +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + +.crafting { + height: 48rem; } \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/web/ui.html b/resources/[test]/okokCrafting/web/ui.html similarity index 97% rename from resources/[tools]/okokCrafting/web/ui.html rename to resources/[test]/okokCrafting/web/ui.html index f50fbf722..e3a9abbf6 100644 --- a/resources/[tools]/okokCrafting/web/ui.html +++ b/resources/[test]/okokCrafting/web/ui.html @@ -1,125 +1,125 @@ - - - - - - - - - -
-
-
-
-
-
Crafting Queue
-
-
-
-
- -
-
Compact Rifle x1
-
Concluded
-
-
-
-
-
-
-
-
- -
-
Compact Rifle x1
-
Time left: 55s
-
-
-
-
-
-
-
-
-
- -
-
-
- -
-
-
- Crafting -
-
- -
-
-
-
-
-
-
-
-
-
-
- -
-
-
Current Level: 28
-
-
-
-
- -
-
-
- s - -
You will receive
-
- - -
-
-
Requirements
-
-
-
- -
-
-
- - - -
- -
-
-
-
-
-
-
-
-
-
- -
-
-
- -
-
-
- - - - - - + + + + + + + + + +
+
+
+
+
+
Crafting Queue
+
+
+
+
+ +
+
Compact Rifle x1
+
Concluded
+
+
+
+
+
+
+
+
+ +
+
Compact Rifle x1
+
Time left: 55s
+
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+
+
+ Crafting +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
Current Level: 28
+
+
+
+
+ +
+
+
+ s + +
You will receive
+
+ + +
+
+
Requirements
+
+
+
+ +
+
+
+ + + +
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+
+
+ + + + + + \ No newline at end of file diff --git a/resources/[tools]/okokCrafting/okokcrafting.sql b/resources/[tools]/okokCrafting/okokcrafting.sql deleted file mode 100644 index c7bff40e4..000000000 --- a/resources/[tools]/okokCrafting/okokcrafting.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE players ADD COLUMN xp LONGTEXT NULL; -ALTER TABLE players ADD COLUMN okokcrafts LONGTEXT NULL; \ No newline at end of file