From d3792bfc47c5d3a0d3aa24c40d2e20af151ba99f Mon Sep 17 00:00:00 2001 From: Nordi98 Date: Tue, 1 Jul 2025 12:59:20 +0200 Subject: [PATCH] ed --- .../[civ]/wasabi_fishing/client/client.lua | 57 +++++++++++++++---- .../wasabi_fishing/configuration/config.lua | 2 +- .../wasabi_fishing/configuration/strings.lua | 14 ++--- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/resources/[jobs]/[civ]/wasabi_fishing/client/client.lua b/resources/[jobs]/[civ]/wasabi_fishing/client/client.lua index bf6dc2db5..f32f5b244 100644 --- a/resources/[jobs]/[civ]/wasabi_fishing/client/client.lua +++ b/resources/[jobs]/[civ]/wasabi_fishing/client/client.lua @@ -51,8 +51,8 @@ if Config.sellShop.enabled then end) end --- Function to check for available baits and select the best one -local function GetBestAvailableBait() +-- Function to select bait using ox_lib menu +local function SelectBait() local availableBaits = {} -- Check all bait types @@ -67,13 +67,48 @@ local function GetBestAvailableBait() return nil end - -- Sort baits by catch bonus (highest first) - table.sort(availableBaits, function(a, b) - return (a.catchBonus or 0) > (b.catchBonus or 0) - end) + -- If only one bait type is available, use it directly + if #availableBaits == 1 then + return availableBaits[1] + end - -- Return the best bait - return availableBaits[1] + -- Create menu options for bait selection + local options = {} + for i, bait in ipairs(availableBaits) do + table.insert(options, { + title = bait.label, + description = 'Catch Bonus: +' .. bait.catchBonus .. '% | Loss Chance: ' .. bait.loseChance .. '%', + icon = 'fish', + onSelect = function() + -- This will be handled by the menu's onClose callback + end + }) + end + + -- Create a variable to store the selected bait + local selectedIndex = 1 + + -- Register the menu + lib.registerMenu({ + id = 'bait_selection_menu', + title = 'Select Fishing Bait', + position = 'top-right', + options = options, + onClose = function(selected) + selectedIndex = selected or 1 + end + }) + + -- Show the menu + lib.showMenu('bait_selection_menu') + + -- Wait for menu to close + while lib.getOpenMenu() == 'bait_selection_menu' do + Wait(100) + end + + -- Return the selected bait + return availableBaits[selectedIndex] end -- Function to handle the fishing process @@ -140,8 +175,8 @@ local function StartFishingProcess(selectedBait, waterLoc) -- Check if we still have this bait local hasBait = lib.callback.await('wasabi_fishing:checkItem', 100, selectedBait.itemName) if not hasBait then - -- Try to get a new bait - local newBait = GetBestAvailableBait() + -- Try to select a new bait + local newBait = SelectBait() if newBait then selectedBait = newBait TriggerEvent('wasabi_fishing:notify', 'New Bait', 'Using ' .. selectedBait.label .. ' as bait', 'inform') @@ -204,7 +239,7 @@ RegisterNetEvent('wasabi_fishing:startFishing', function() end -- Select bait - local selectedBait = GetBestAvailableBait() + local selectedBait = SelectBait() if not selectedBait then TriggerEvent('wasabi_fishing:notify', Strings.no_bait, Strings.no_bait_desc, 'error') return diff --git a/resources/[jobs]/[civ]/wasabi_fishing/configuration/config.lua b/resources/[jobs]/[civ]/wasabi_fishing/configuration/config.lua index 3d4f3445a..dadc6289e 100644 --- a/resources/[jobs]/[civ]/wasabi_fishing/configuration/config.lua +++ b/resources/[jobs]/[civ]/wasabi_fishing/configuration/config.lua @@ -62,7 +62,7 @@ Config.bait = { Config.fishingRod = { itemName = 'fishingrod', -- Item name of fishing rod - breakChance = 25 --Chance of breaking pole when failing skillbar (Setting to 0 means never break) + breakChance = 0 --Chance of breaking pole when failing skillbar (Setting to 0 means never break) } Config.timeForBite = { -- Set min and max random range of time it takes for fish to be on the line. diff --git a/resources/[jobs]/[civ]/wasabi_fishing/configuration/strings.lua b/resources/[jobs]/[civ]/wasabi_fishing/configuration/strings.lua index a0f257075..51ac27957 100644 --- a/resources/[jobs]/[civ]/wasabi_fishing/configuration/strings.lua +++ b/resources/[jobs]/[civ]/wasabi_fishing/configuration/strings.lua @@ -2,13 +2,13 @@ --------------- https://discord.gg/wasabiscripts ------------- --------------------------------------------------------------- Strings = { - intro_instruction = 'Press ~INPUT_ATTACK~ to cast line, ~INPUT_FRONTEND_RRIGHT~ to cancel.', - rod_broke = 'Rod Snapped', - rod_broke_desc = 'You pulled to hard and your fishing rod snapped!', - cannot_perform = 'Action Incomplete', - cannot_perform_desc = 'You cannot do this right now.', - failed = 'Failed', - failed_fish = 'You failed to catch fish!', + intro_instruction = 'Drücke ~INPUT_ATTACK~ zu auswerfen, ~INPUT_FRONTEND_RRIGHT~ um abzubrechen.', + rod_broke = 'Deine Angel hat den Geist aufgegeben.', + rod_broke_desc = 'Oha, zu fest gezogen! Die Angel ist kaputt.', + cannot_perform = 'Fast, aber nicht ganz.', + cannot_perform_desc = 'Das geht gerade nicht – der Fisch macht Pause.', + failed = 'Oops, das war nix.', + failed_fish = 'Nix gefangen – der Fisch war schneller.', no_water = 'Error 404: Wasser nicht gefunden.', no_water_desc = 'Deine Angel verheddert sich im trockenen Gras. Bravo.', no_bait = 'Vielleicht versuchst Du es mal mit Köder.',