diff --git a/resources/[inventory]/cs_shops/config/config.lua b/resources/[inventory]/cs_shops/config/config.lua index 065258f88..efc24055b 100644 --- a/resources/[inventory]/cs_shops/config/config.lua +++ b/resources/[inventory]/cs_shops/config/config.lua @@ -496,7 +496,43 @@ CodeStudio.Products = { } }, + ['magnet_fishing'] = { + categoryName = "Magnetfischen", + categoryLogo = "fa-tools", + items = { + ['basic_magnet'] = { + itemName = "Standard Magnet", + itemStock = 50, + itemPrice = 100, + itemInfo = "", + }, + ['strong_magnet'] = { + itemName = "Starker Magnet", + itemStock = 50, + itemPrice = 150, + itemInfo = "", + }, + ['neodymium_magnet'] = { + itemName = "Neodymium Magnet", + itemStock = 50, + itemPrice = 200, + itemInfo = "", + }, + ['rare_earth_magnet'] = { + itemName = "Großer Neodymium Magnet", + itemStock = 50, + itemPrice = 250, + itemInfo = "", + }, + ['magnet_rope'] = { + itemName = "Magnetangel Seil", + itemStock = 150, + itemPrice = 400, + itemInfo = "", + }, + } + }, ['hardware'] = { @@ -2987,6 +3023,7 @@ CodeStudio.Shops = { }, }, + [14] = { ShopName = 'Millars Fishery', Category = { @@ -3007,7 +3044,7 @@ CodeStudio.Shops = { }, - [14] = { + [15] = { ShopName = 'Whitewater Adventures', Category = { [1] = 'freizeit', @@ -3027,11 +3064,25 @@ CodeStudio.Shops = { }, + [16] = { + ShopName = 'John', + Category = { + [1] = 'magnet_fishing', + }, + Locations = { + vector4(-1512.7101, 1503.2269, 115.2890, 340.4643), + }, + Interaction = { + targetIcon = 'fas fa-shopping-basket', + targetLabel = 'Mit John reden', + spawnPed = 'S_M_Y_WareTech_01', -- Put false if you dont need ped + scenario = 'WORLD_HUMAN_STAND_MOBILE', --Ped Scenario Animation put false if you dont need + radius = 2.5, + }, + }, } - - - + \ No newline at end of file diff --git a/resources/[inventory]/cs_shops/ui/image/basic_magnet.png b/resources/[inventory]/cs_shops/ui/image/basic_magnet.png new file mode 100644 index 000000000..dc262c5b8 Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/basic_magnet.png differ diff --git a/resources/[inventory]/cs_shops/ui/image/bicycle.png b/resources/[inventory]/cs_shops/ui/image/bicycle.png new file mode 100644 index 000000000..43c7c71bb Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/bicycle.png differ diff --git a/resources/[inventory]/cs_shops/ui/image/escooter.png b/resources/[inventory]/cs_shops/ui/image/escooter.png new file mode 100644 index 000000000..7e57ebd87 Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/escooter.png differ diff --git a/resources/[inventory]/cs_shops/ui/image/magnet_rope.png b/resources/[inventory]/cs_shops/ui/image/magnet_rope.png new file mode 100644 index 000000000..ee3614d2f Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/magnet_rope.png differ diff --git a/resources/[inventory]/cs_shops/ui/image/neodymium_magnet.png b/resources/[inventory]/cs_shops/ui/image/neodymium_magnet.png new file mode 100644 index 000000000..47ad47b4c Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/neodymium_magnet.png differ diff --git a/resources/[inventory]/cs_shops/ui/image/old_ammunition.png b/resources/[inventory]/cs_shops/ui/image/old_ammunition.png new file mode 100644 index 000000000..085ad9375 Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/old_ammunition.png differ diff --git a/resources/[inventory]/cs_shops/ui/image/rare_earth_magnet.png b/resources/[inventory]/cs_shops/ui/image/rare_earth_magnet.png new file mode 100644 index 000000000..38df5ef7f Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/rare_earth_magnet.png differ diff --git a/resources/[inventory]/cs_shops/ui/image/safe.png b/resources/[inventory]/cs_shops/ui/image/safe.png new file mode 100644 index 000000000..811f259e9 Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/safe.png differ diff --git a/resources/[inventory]/cs_shops/ui/image/strong_magnet.png b/resources/[inventory]/cs_shops/ui/image/strong_magnet.png new file mode 100644 index 000000000..126e3da56 Binary files /dev/null and b/resources/[inventory]/cs_shops/ui/image/strong_magnet.png differ diff --git a/resources/[inventory]/inventory_images/images/basic_magnet.png b/resources/[inventory]/inventory_images/images/basic_magnet.png new file mode 100644 index 000000000..dc262c5b8 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/basic_magnet.png differ diff --git a/resources/[inventory]/inventory_images/images/bicycle.png b/resources/[inventory]/inventory_images/images/bicycle.png new file mode 100644 index 000000000..43c7c71bb Binary files /dev/null and b/resources/[inventory]/inventory_images/images/bicycle.png differ diff --git a/resources/[inventory]/inventory_images/images/escooter.png b/resources/[inventory]/inventory_images/images/escooter.png new file mode 100644 index 000000000..7e57ebd87 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/escooter.png differ diff --git a/resources/[inventory]/inventory_images/images/magnet_rope.png b/resources/[inventory]/inventory_images/images/magnet_rope.png new file mode 100644 index 000000000..ee3614d2f Binary files /dev/null and b/resources/[inventory]/inventory_images/images/magnet_rope.png differ diff --git a/resources/[inventory]/inventory_images/images/neodymium_magnet.png b/resources/[inventory]/inventory_images/images/neodymium_magnet.png new file mode 100644 index 000000000..47ad47b4c Binary files /dev/null and b/resources/[inventory]/inventory_images/images/neodymium_magnet.png differ diff --git a/resources/[inventory]/inventory_images/images/old_ammunition.png b/resources/[inventory]/inventory_images/images/old_ammunition.png new file mode 100644 index 000000000..085ad9375 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/old_ammunition.png differ diff --git a/resources/[inventory]/inventory_images/images/old_coin.png b/resources/[inventory]/inventory_images/images/old_coin.png new file mode 100644 index 000000000..f18cfaf76 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/old_coin.png differ diff --git a/resources/[inventory]/inventory_images/images/old_gun.png b/resources/[inventory]/inventory_images/images/old_gun.png new file mode 100644 index 000000000..84aaec895 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/old_gun.png differ diff --git a/resources/[inventory]/inventory_images/images/old_knife.png b/resources/[inventory]/inventory_images/images/old_knife.png new file mode 100644 index 000000000..4e0a8b768 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/old_knife.png differ diff --git a/resources/[inventory]/inventory_images/images/rare_earth_magnet.png b/resources/[inventory]/inventory_images/images/rare_earth_magnet.png new file mode 100644 index 000000000..38df5ef7f Binary files /dev/null and b/resources/[inventory]/inventory_images/images/rare_earth_magnet.png differ diff --git a/resources/[inventory]/inventory_images/images/safe.png b/resources/[inventory]/inventory_images/images/safe.png new file mode 100644 index 000000000..811f259e9 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/safe.png differ diff --git a/resources/[inventory]/inventory_images/images/strong_magnet.png b/resources/[inventory]/inventory_images/images/strong_magnet.png new file mode 100644 index 000000000..126e3da56 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/strong_magnet.png differ diff --git a/resources/[inventory]/tgiann-inventory/items/items.lua b/resources/[inventory]/tgiann-inventory/items/items.lua index 6520317f5..2a60def03 100644 --- a/resources/[inventory]/tgiann-inventory/items/items.lua +++ b/resources/[inventory]/tgiann-inventory/items/items.lua @@ -10214,16 +10214,150 @@ itemsData = { image = 'food_bag.png', name = 'food_bag', }, - keys = { + scrap_metal = { shouldClose = true, type = 'item', description = '', - weight = 2, - label = 'Motelschlüssel', + weight = 1000, + label = 'scrap_metal', unique = true, useable = true, - image = 'keys.png', - name = 'keys', + image = 'scrap_metal.png', + name = 'scrap_metal', + }, + old_coin = { + shouldClose = true, + type = 'item', + description = '', + weight = 400, + label = 'old_coin', + unique = true, + useable = true, + image = 'old_coin.png', + name = 'old_coin', + }, + rusty_knife = { + shouldClose = true, + type = 'item', + description = '', + weight = 600, + label = 'rusty_knife', + unique = true, + useable = true, + image = 'rusty_knife.png', + name = 'rusty_knife', + }, + old_knife = { + shouldClose = true, + type = 'item', + description = '', + weight = 600, + label = 'altes Messer', + unique = true, + useable = true, + image = 'old_knife.png', + name = 'old_knife', + }, + bicycle = { + shouldClose = true, + type = 'item', + description = '', + weight = 4000, + label = 'rusty_knife', + unique = true, + useable = true, + image = 'rusty_knife.png', + name = 'rusty_knife', + }, + old_ammunition = { + shouldClose = true, + type = 'item', + description = '', + weight = 200, + label = 'old_ammunition', + unique = true, + useable = true, + image = 'old_ammunition.png', + name = 'old_ammunition', + }, + old_gun = { + shouldClose = true, + type = 'item', + description = '', + weight = 1000, + label = 'alte Pistole', + unique = true, + useable = true, + image = 'old_gun.png', + name = 'old_gun', + }, + escooter = { + shouldClose = true, + type = 'item', + description = '', + weight = 10000, + label = 'E-Scooter', + unique = true, + useable = true, + image = 'escooter.png', + name = 'escooter', + }, + safe = { + shouldClose = true, + type = 'item', + description = '', + weight = 20000, + label = 'Tresor', + unique = true, + useable = true, + image = 'safe.png', + name = 'safe', + }, + magnet_rope = { + shouldClose = true, + type = 'item', + description = '', + weight = 800, + label = 'Magnetangel Seil', + unique = true, + useable = true, + image = 'magnet_rope.png', + name = 'magnet_rope', + }, + basic_magnet = { + shouldClose = true, + type = 'item', + description = '', + weight = 1000, + label = 'Standard Magnet', + unique = true, + useable = true, + image = 'basic_magnet.png', + name = 'basic_magnet', + }, + strong_magnet = { + shouldClose = true, + type = 'item', + description = '', + weight = 1000, + label = 'Starker Magnet', + unique = true, + useable = true, + image = 'strong_magnet.png', + name = 'strong_magnet', + }, + neodymium_magnet = { + shouldClose = true, + type = 'item', + description = '', + weight = 1500, + label = 'Neodymium Magnet', + unique = true, + useable = true, + image = 'neodymium_magnet.png', + name = 'neodymium_magnet', }, + + } diff --git a/resources/[jobs]/[civ]/nordi_magentfishing/client/client.lua b/resources/[jobs]/[civ]/nordi_magentfishing/client/client.lua index 16c6a71ea..93897eebb 100644 --- a/resources/[jobs]/[civ]/nordi_magentfishing/client/client.lua +++ b/resources/[jobs]/[civ]/nordi_magentfishing/client/client.lua @@ -1,7 +1,7 @@ -----------------For support, scripts, and more---------------- --------------- https://discord.gg/wasabiscripts ------------- --------------------------------------------------------------- -local fishing = false +local magnetFishing = false if Config.sellShop.enabled then CreateThread(function() @@ -25,11 +25,11 @@ if Config.sellShop.enabled then end if self.currentDistance <= 1.8 then if not textUI then - lib.showTextUI(Strings.sell_fish) + lib.showTextUI(Strings.sell_finds) textUI = true end if IsControlJustReleased(0, 38) then - FishingSellItems() + MagnetSellItems() end elseif self.currentDistance >= 1.9 and textUI then lib.hideTextUI() @@ -51,40 +51,40 @@ if Config.sellShop.enabled then end) end --- Function to check for available baits and select the best one -local function GetBestAvailableBait() - local availableBaits = {} +-- Function to check for available magnets and select the best one +local function GetBestAvailableMagnet() + local availableMagnets = {} - -- Check all bait types - for _, bait in pairs(Config.bait.types) do - local hasItem = lib.callback.await('wasabi_fishing:checkItem', 100, bait.itemName) + -- Check all magnet types + for _, magnet in pairs(Config.magnets.types) do + local hasItem = lib.callback.await('wasabi_magnet:checkItem', 100, magnet.itemName) if hasItem then - table.insert(availableBaits, bait) + table.insert(availableMagnets, magnet) end end - if #availableBaits == 0 then + if #availableMagnets == 0 then return nil end - -- Sort baits by catch bonus (highest first) - table.sort(availableBaits, function(a, b) + -- Sort magnets by catch bonus (highest first) + table.sort(availableMagnets, function(a, b) return (a.catchBonus or 0) > (b.catchBonus or 0) end) - -- Return the best bait - return availableBaits[1] + -- Return the best magnet + return availableMagnets[1] end --- Function to handle the fishing process -local function StartFishingProcess(selectedBait, waterLoc) - fishing = true +-- Function to handle the magnet fishing process +local function StartMagnetFishingProcess(selectedMagnet, waterLoc) + magnetFishing = true - -- Create fishing rod prop - local model = `prop_fishing_rod_01` + -- Create magnet rope prop + local model = `prop_fishing_rod_01` -- Using fishing rod as placeholder, ideally would be replaced with a magnet rope model lib.requestModel(model, 100) - local pole = CreateObject(model, GetEntityCoords(cache.ped), true, false, false) - AttachEntityToEntity(pole, cache.ped, GetPedBoneIndex(cache.ped, 18905), 0.1, 0.05, 0, 80.0, 120.0, 160.0, true, true, false, true, 1, true) + local magnetRope = CreateObject(model, GetEntityCoords(cache.ped), true, false, false) + AttachEntityToEntity(magnetRope, cache.ped, GetPedBoneIndex(cache.ped, 18905), 0.1, 0.05, 0, 80.0, 120.0, 160.0, true, true, false, true, 1, true) SetModelAsNoLongerNeeded(model) -- Load animations @@ -96,168 +96,126 @@ local function StartFishingProcess(selectedBait, waterLoc) Wait(3000) TaskPlayAnim(cache.ped, 'amb@world_human_stand_fishing@idle_a', 'idle_c', 1.0, -1.0, 1.0, 11, 0, 0, 0, 0) - -- Main fishing loop - while fishing do + -- Main magnet fishing loop + while magnetFishing do Wait(0) local unarmed = `WEAPON_UNARMED` SetCurrentPedWeapon(cache.ped, unarmed) ShowHelp(Strings.intro_instruction) DisableControlAction(0, 24, true) - -- Cast line + -- Cast magnet if IsDisabledControlJustReleased(0, 24) then -- Casting animation TaskPlayAnim(cache.ped, 'mini@tennis', 'forehand_ts_md_far', 1.0, -1.0, 1.0, 48, 0, 0, 0, 0) - TriggerEvent('wasabi_fishing:notify', Strings.waiting_bite, Strings.waiting_bite_desc, 'inform') + TriggerEvent('wasabi_magnet:notify', Strings.waiting_find, Strings.waiting_find_desc, 'inform') - -- Wait for fish to bite - local waitTime = math.random(Config.timeForBite.min, Config.timeForBite.max) + -- Wait for magnet to find something + local waitTime = math.random(Config.timeForFind.min, Config.timeForFind.max) Wait(waitTime) - -- Check if player is still fishing - if not fishing then + -- Check if player is still magnet fishing + if not magnetFishing then break end - TriggerEvent('wasabi_fishing:notify', Strings.got_bite, Strings.got_bite_desc, 'inform') + TriggerEvent('wasabi_magnet:notify', Strings.got_pull, Strings.got_pull_desc, 'inform') Wait(1000) - -- Get fish data based on selected bait - local fishData = lib.callback.await('wasabi_fishing:getFishData', 100, selectedBait.itemName) + -- Get find data based on selected magnet + local findData = lib.callback.await('wasabi_magnet:getFindData', 100, selectedMagnet.itemName) - -- Skill check to catch fish - if lib.skillCheck(fishData.difficulty) then + -- Skill check to retrieve find + if lib.skillCheck(findData.difficulty) then ClearPedTasks(cache.ped) - TryFish(fishData) + TryMagnetFind(findData) TaskPlayAnim(cache.ped, 'amb@world_human_stand_fishing@idle_a', 'idle_c', 1.0, -1.0, 1.0, 11, 0, 0, 0, 0) - -- Check for bait loss + -- Check for magnet loss local loseChance = math.random(1,100) - if loseChance <= selectedBait.loseChance then - TriggerServerEvent('wasabi_fishing:loseBait', selectedBait.itemName) - TriggerEvent('wasabi_fishing:notify', Strings.bait_lost, Strings.bait_lost_desc, 'error') + if loseChance <= selectedMagnet.loseChance then + TriggerServerEvent('wasabi_magnet:loseMagnet', selectedMagnet.itemName) + TriggerEvent('wasabi_magnet:notify', Strings.magnet_lost, Strings.magnet_lost_desc, 'error') - -- 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() - if newBait then - selectedBait = newBait - TriggerEvent('wasabi_fishing:notify', 'New Bait', 'Using ' .. selectedBait.label .. ' as bait', 'inform') + -- Check if we still have this magnet + local hasMagnet = lib.callback.await('wasabi_magnet:checkItem', 100, selectedMagnet.itemName) + if not hasMagnet then + -- Try to get a new magnet + local newMagnet = GetBestAvailableMagnet() + if newMagnet then + selectedMagnet = newMagnet + TriggerEvent('wasabi_magnet:notify', 'New Magnet', 'Using ' .. selectedMagnet.label .. ' as magnet', 'inform') else - TriggerEvent('wasabi_fishing:notify', Strings.no_bait, Strings.no_bait_desc, 'error') - fishing = false + TriggerEvent('wasabi_magnet:notify', Strings.no_magnet, Strings.no_magnet_desc, 'error') + magnetFishing = false break end end end else - -- Failed to catch fish + -- Failed to retrieve find local breakChance = math.random(1,100) - if breakChance < Config.fishingRod.breakChance then - TriggerServerEvent('wasabi_fishing:rodBroke') - TriggerEvent('wasabi_fishing:notify', Strings.rod_broke, Strings.rod_broke_desc, 'error') + if breakChance < Config.magnetRope.breakChance then + TriggerServerEvent('wasabi_magnet:ropeBroke') + TriggerEvent('wasabi_magnet:notify', Strings.rope_broke, Strings.rope_broke_desc, 'error') ClearPedTasks(cache.ped) - fishing = false + magnetFishing = false break end - TriggerEvent('wasabi_fishing:notify', Strings.failed_fish, Strings.failed_fish_desc, 'error') + TriggerEvent('wasabi_magnet:notify', Strings.failed_find, Strings.failed_find_desc, 'error') end elseif IsControlJustReleased(0, 194) then - -- Cancel fishing with backspace + -- Cancel magnet fishing with backspace ClearPedTasks(cache.ped) - TriggerEvent('wasabi_fishing:notify', 'Fishing Canceled', 'You stopped fishing', 'inform') + TriggerEvent('wasabi_magnet:notify', 'Magnet Fishing Canceled', 'You stopped magnet fishing', 'inform') break elseif #(GetEntityCoords(cache.ped) - waterLoc) > 30 then -- Too far from water - TriggerEvent('wasabi_fishing:notify', 'Too Far', 'You moved too far from the water', 'error') + TriggerEvent('wasabi_magnet:notify', 'Too Far', 'You moved too far from the water', 'error') break end end -- Clean up - fishing = false - DeleteObject(pole) + magnetFishing = false + DeleteObject(magnetRope) RemoveAnimDict('mini@tennis') RemoveAnimDict('amb@world_human_stand_fishing@idle_a') end -RegisterNetEvent('wasabi_fishing:startFishing', function() - -- Check if player is in a valid state to fish +RegisterNetEvent('wasabi_magnet:startMagnetFishing', function() + -- Check if player is in a valid state to magnet fish if IsPedInAnyVehicle(cache.ped) or IsPedSwimming(cache.ped) then - TriggerEvent('wasabi_fishing:notify', Strings.cannot_perform, Strings.cannot_perform_desc, 'error') + TriggerEvent('wasabi_magnet:notify', Strings.cannot_perform, Strings.cannot_perform_desc, 'error') return end - -- Check if already fishing - if fishing then - TriggerEvent('wasabi_fishing:notify', 'Already Fishing', 'You are already fishing', 'error') + -- Check if already magnet fishing + if magnetFishing then + TriggerEvent('wasabi_magnet:notify', 'Already Magnet Fishing', 'You are already magnet fishing', 'error') return end -- Check for water local water, waterLoc = WaterCheck() if not water then - TriggerEvent('wasabi_fishing:notify', Strings.no_water, Strings.no_water_desc, 'error') + TriggerEvent('wasabi_magnet:notify', Strings.no_water, Strings.no_water_desc, 'error') return end - -- Select bait - local selectedBait = GetBestAvailableBait() - if not selectedBait then - TriggerEvent('wasabi_fishing:notify', Strings.no_bait, Strings.no_bait_desc, 'error') + -- Select magnet + local selectedMagnet = GetBestAvailableMagnet() + if not selectedMagnet then + TriggerEvent('wasabi_magnet:notify', Strings.no_magnet, Strings.no_magnet_desc, 'error') return end - -- Start fishing process - TriggerEvent('wasabi_fishing:notify', 'Bait Selected', 'Using ' .. selectedBait.label .. ' as bait', 'inform') - StartFishingProcess(selectedBait, waterLoc) + -- Start magnet fishing process + TriggerEvent('wasabi_magnet:notify', 'Magnet Selected', 'Using ' .. selectedMagnet.label, 'inform') + StartMagnetFishingProcess(selectedMagnet, waterLoc) end) --- Process fish with knife -RegisterNetEvent('wasabi_fishing:processFish', function(fishItem) - -- Check if player has knife - local hasKnife = lib.callback.await('wasabi_fishing:checkItem', 100, Config.processing.knifeItem) - if not hasKnife then - TriggerEvent('wasabi_fishing:notify', 'No Knife', 'You need a knife to process fish', 'error') - return - end - - -- Start processing animation - local playerPed = cache.ped - - lib.requestAnimDict('anim@amb@business@coc@coc_unpack_cut@', 100) - TaskPlayAnim(playerPed, 'anim@amb@business@coc@coc_unpack_cut@', 'fullcut_cycle_v6_cokecutter', 8.0, -8.0, -1, 1, 0, false, false, false) - - -- Processing progress bar - if lib.progressBar({ - duration = 5000, - label = 'Processing Fish', - useWhileDead = false, - canCancel = true, - disable = { - car = true, - move = true, - combat = true - }, - anim = { - dict = 'anim@amb@business@coc@coc_unpack_cut@', - clip = 'fullcut_cycle_v6_cokecutter' - }, - }) then - -- Success - server handles the actual item processing - TriggerServerEvent('wasabi_fishing:processItem', fishItem) - else - -- Cancelled - TriggerEvent('wasabi_fishing:notify', 'Canceled', 'Fish processing canceled', 'error') - end - - ClearPedTasks(playerPed) - RemoveAnimDict('anim@amb@business@coc@coc_unpack_cut@') -end) - -RegisterNetEvent('wasabi_fishing:interupt', function() - fishing = false +RegisterNetEvent('wasabi_magnet:interupt', function() + magnetFishing = false ClearPedTasks(cache.ped) end) diff --git a/resources/[jobs]/[civ]/nordi_magentfishing/client/functions.lua b/resources/[jobs]/[civ]/nordi_magentfishing/client/functions.lua index 351213a56..3c5c0bbe6 100644 --- a/resources/[jobs]/[civ]/nordi_magentfishing/client/functions.lua +++ b/resources/[jobs]/[civ]/nordi_magentfishing/client/functions.lua @@ -27,10 +27,10 @@ CreateBlip = function(coords, sprite, colour, text, scale) return blip end -TryFish = function(data) - TriggerServerEvent('wasabi_fishing:tryFish', data) +TryMagnetFind = function(data) + TriggerServerEvent('wasabi_magnet:tryFind', data) end -FishingSellItems = function() - TriggerServerEvent('wasabi_fishing:sellFish') +MagnetSellItems = function() + TriggerServerEvent('wasabi_magnet:sellFinds') end diff --git a/resources/[jobs]/[civ]/nordi_magentfishing/configuration/config.lua b/resources/[jobs]/[civ]/nordi_magentfishing/configuration/config.lua index e16ba716b..b13b4fb49 100644 --- a/resources/[jobs]/[civ]/nordi_magentfishing/configuration/config.lua +++ b/resources/[jobs]/[civ]/nordi_magentfishing/configuration/config.lua @@ -19,13 +19,13 @@ Config.magnets = { types = { { itemName = 'basic_magnet', - label = 'Basic Magnet', + label = 'Standard Magnet', loseChance = 25, catchBonus = 0 -- base chance }, { itemName = 'strong_magnet', - label = 'Strong Magnet', + label = 'Starker Magnet', loseChance = 15, catchBonus = 15 -- 15% better catch chance }, @@ -37,7 +37,7 @@ Config.magnets = { }, { itemName = 'rare_earth_magnet', - label = 'Rare Earth Magnet', + label = 'Großer Neodymium Magnet', loseChance = 5, -- very hard to lose catchBonus = 35, -- 35% better catch chance exclusive = {'treasure'} -- can only catch treasure with this @@ -57,13 +57,14 @@ Config.timeForFind = { -- Set min and max random range of time it takes for some } Config.finds = { - { item = 'scrap_metal', label = 'Scrap Metal', price = {50, 100}, difficulty = {'easy'} }, - { item = 'old_coin', label = 'Old Coin', price = {100, 200}, difficulty = {'easy', 'easy'} }, - { item = 'rusty_knife', label = 'Rusty Knife', price = {150, 250}, difficulty = {'medium', 'easy'} }, - { item = 'bicycle_parts', label = 'Bicycle Parts', price = {200, 300}, difficulty = {'medium'} }, - { item = 'metal_debris', label = 'Metal Debris', price = {75, 150}, difficulty = {'easy'} }, - { item = 'antique_item', label = 'Antique Item', price = {300, 600}, difficulty = {'medium', 'hard'} }, - { item = 'safe', label = 'Safe', price = {500, 1000}, difficulty = {'hard', 'hard', 'medium'} }, + { item = 'scrap_metal', label = 'Altmetall', price = {50, 100}, difficulty = {'easy'} }, + { item = 'old_coin', label = 'alte Münze', price = {100, 200}, difficulty = {'easy', 'easy'} }, + { item = 'rusty_knife', label = 'altes Messer', price = {150, 250}, difficulty = {'medium', 'easy'} }, + { item = 'bicycle', label = 'Fahrrad', price = {200, 300}, difficulty = {'medium'} }, + { item = 'old_ammunition', label = 'alte Munition', price = {75, 150}, difficulty = {'easy'} }, + { item = 'old_gun', label = 'alte Pistole', price = {75, 150}, difficulty = {'easy'} }, + { item = 'escooter', label = 'E-Scooter', price = {300, 600}, difficulty = {'medium', 'hard'} }, + { item = 'safe', label = 'Tresor', price = {500, 1000}, difficulty = {'hard', 'hard', 'medium'} }, } diff --git a/resources/[jobs]/[civ]/nordi_magentfishing/configuration/strings.lua b/resources/[jobs]/[civ]/nordi_magentfishing/configuration/strings.lua index a7f84c9c3..93e378f85 100644 --- a/resources/[jobs]/[civ]/nordi_magentfishing/configuration/strings.lua +++ b/resources/[jobs]/[civ]/nordi_magentfishing/configuration/strings.lua @@ -2,36 +2,30 @@ --------------- https://discord.gg/wasabiscripts ------------- --------------------------------------------------------------- Strings = { - intro_instruction = 'Drücke ~INPUT_ATTACK~ zu auswerfen, ~INPUT_FRONTEND_RRIGHT~ um abzubrechen.', - rod_broke = 'Kaputt.', - rod_broke_desc = 'Oha, zu fest gezogen! Die Angel ist kaputt.', + intro_instruction = 'Drücke ~INPUT_ATTACK~ zum Auswerfen, ~INPUT_FRONTEND_RRIGHT~ zum Abbrechen.', + rope_broke = 'Kaputt.', + rope_broke_desc = 'Oha, zu fest gezogen! Das Seil ist gerissen.', cannot_perform = 'Nope.', - cannot_perform_desc = 'Das geht gerade nicht – der Fisch macht Pause.', + cannot_perform_desc = 'Das geht gerade nicht – hier kannst du nicht magnet-fischen.', failed = 'Oops, das war nix.', - failed_fish = 'Nix gefangen – der Fisch war schneller.', + failed_find = 'Nichts gefunden – der Magnet hat nichts angezogen.', no_water = 'Error 404: Wasser nicht gefunden.', - no_water_desc = 'Deine Angel verheddert sich im trockenen Gras. Bravo.', - no_bait = 'Kein Köder.', - no_bait_desc = 'Ohne Köder bist du nur ein sehr geduldiger Spaziergänger am Wasser.', - bait_lost = 'Köder abgehauen.', - bait_lost_desc = 'Der Köder hat sich selbstständig gemacht..', - fish_success = 'Fisch im Kasten – das Abendessen ist gesichert.', - fish_success_desc = 'Du hast eine/n %s!', - sell_shop_blip = 'Fish Market', - sell_fish = '[E] - Fisch verkaufen', - kicked = 'Du kannst’s versuchen, aber das klappt hier nicht.', - sold_for = 'Fisch verkauft.', + no_water_desc = 'Dein Magnet braucht Wasser, um effektiv zu sein.', + no_magnet = 'Kein Magnet.', + no_magnet_desc = 'Ohne Magnet kannst du nichts anziehen.', + magnet_lost = 'Magnet verloren.', + magnet_lost_desc = 'Dein Magnet hat sich vom Seil gelöst.', + find_success = 'Fund gesichert!', + find_success_desc = 'Du hast eine/n %s gefunden!', + sell_shop_blip = 'Schrotthändler', + sell_finds = '[E] - Funde verkaufen', + kicked = 'Du kannst's versuchen, aber das klappt hier nicht.', + sold_for = 'Fund verkauft.', sold_for_desc = 'Du hast %sx %s für $%s verkauft.', - got_bite = 'Achtung, da zappelt was!', - got_bite_desc = 'Der Fisch ist am Haken, gleich wird’s sportlich!', - waiting_bite = 'Geduld, der Fisch überlegt noch.', - waiting_bite_desc = 'Ein bisschen Geduld – der Fisch ist gleich da.', + got_pull = 'Achtung, da zieht was!', + got_pull_desc = 'Der Magnet hat etwas gefunden, zieh ihn hoch!', + waiting_find = 'Geduld, der Magnet sucht noch.', + waiting_find_desc = 'Ein bisschen Geduld – gleich findest du etwas.', cannot_carry = 'Kein Platz!', - cannot_carry_desc = 'Du schleppst schon genug – mehr passt nicht rein!', - no_knife = 'Kein Messer', - no_knife_desc = 'Ohne Messer ist der Fisch nur Deko.', - processing_success = 'Fang verarbeitet – nächster Schritt: Grill an!', - processing_success_desc = '%d %s – frisch aus der Fischverarbeitung!', - caviar_found = 'Kaviar entdeckt – Fisch deluxe!', - caviar_found_desc = 'Wow, wertvoller Kaviar im Fisch – das hat sich gelohnt!' + cannot_carry_desc = 'Du schleppst schon genug – mehr passt nicht rein!' } diff --git a/resources/[jobs]/[civ]/nordi_magentfishing/server/server.lua b/resources/[jobs]/[civ]/nordi_magentfishing/server/server.lua index 38e211d39..8c2836196 100644 --- a/resources/[jobs]/[civ]/nordi_magentfishing/server/server.lua +++ b/resources/[jobs]/[civ]/nordi_magentfishing/server/server.lua @@ -6,7 +6,7 @@ local addCommas = function(n) :gsub(",(%-?)$","%1"):reverse() end -lib.callback.register('wasabi_fishing:checkItem', function(source, itemname) +lib.callback.register('wasabi_magnet:checkItem', function(source, itemname) local item = HasItem(source, itemname) if item >= 1 then return true @@ -15,46 +15,46 @@ lib.callback.register('wasabi_fishing:checkItem', function(source, itemname) end end) -lib.callback.register('wasabi_fishing:getFishData', function(source, baitType) - -- Find the bait data - local baitData = nil - for _, bait in pairs(Config.bait.types) do - if bait.itemName == baitType then - baitData = bait +lib.callback.register('wasabi_magnet:getFindData', function(source, magnetType) + -- Find the magnet data + local magnetData = nil + for _, magnet in pairs(Config.magnets.types) do + if magnet.itemName == magnetType then + magnetData = magnet break end end - if not baitData then - -- Use default bait data if the provided bait type is not found - for _, bait in pairs(Config.bait.types) do - if bait.itemName == Config.bait.defaultBait then - baitData = bait + if not magnetData then + -- Use default magnet data if the provided magnet type is not found + for _, magnet in pairs(Config.magnets.types) do + if magnet.itemName == Config.magnets.defaultMagnet then + magnetData = magnet break end end end - -- If using illegal bait, only catch pufferfish - if baitData.exclusive then - for _, fishType in pairs(baitData.exclusive) do - for _, fish in pairs(Config.fish) do - if fish.item == fishType then - return fish + -- If using exclusive magnet, only find specific items + if magnetData.exclusive then + for _, findType in pairs(magnetData.exclusive) do + for _, find in pairs(Config.finds) do + if find.item == findType then + return find end end end end - -- Otherwise, random fish with catch bonus - local availableFish = {} - for _, fish in pairs(Config.fish) do - -- Don't include exclusive fish types unless using the right bait + -- Otherwise, random find with catch bonus + local availableFinds = {} + for _, find in pairs(Config.finds) do + -- Don't include exclusive find types unless using the right magnet local isExclusive = false - for _, bait in pairs(Config.bait.types) do - if bait.exclusive then - for _, exclusiveFish in pairs(bait.exclusive) do - if fish.item == exclusiveFish then + for _, magnet in pairs(Config.magnets.types) do + if magnet.exclusive then + for _, exclusiveFind in pairs(magnet.exclusive) do + if find.item == exclusiveFind then isExclusive = true break end @@ -64,127 +64,57 @@ lib.callback.register('wasabi_fishing:getFishData', function(source, baitType) end if not isExclusive then - table.insert(availableFish, fish) + table.insert(availableFinds, find) end end -- Apply catch bonus logic here if needed - return availableFish[math.random(#availableFish)] + return availableFinds[math.random(#availableFinds)] end) -RegisterNetEvent('wasabi_fishing:rodBroke', function() - RemoveItem(source, Config.fishingRod.itemName, 1) - TriggerClientEvent('wasabi_fishing:interupt', source) +RegisterNetEvent('wasabi_magnet:ropeBroke', function() + RemoveItem(source, Config.magnetRope.itemName, 1) + TriggerClientEvent('wasabi_magnet:interupt', source) end) -RegisterNetEvent('wasabi_fishing:loseBait', function(baitType) - RemoveItem(source, baitType, 1) +RegisterNetEvent('wasabi_magnet:loseMagnet', function(magnetType) + RemoveItem(source, magnetType, 1) end) -RegisterNetEvent('wasabi_fishing:tryFish', function(data) - local xPole = HasItem(source, Config.fishingRod.itemName) - local xBait = false +RegisterNetEvent('wasabi_magnet:tryFind', function(data) + local xRope = HasItem(source, Config.magnetRope.itemName) + local xMagnet = false - -- Check if player has any type of bait - for _, bait in pairs(Config.bait.types) do - if HasItem(source, bait.itemName) > 0 then - xBait = true + -- Check if player has any type of magnet + for _, magnet in pairs(Config.magnets.types) do + if HasItem(source, magnet.itemName) > 0 then + xMagnet = true break end end - if xPole > 0 and xBait then + if xRope > 0 and xMagnet then if Framework == 'esx' and not Config.oldESX then local player = GetPlayer(source) if player.canCarryItem(data.item, 1) then AddItem(source, data.item, 1) - TriggerClientEvent('wasabi_fishing:notify', source, Strings.fish_success, string.format(Strings.fish_success_desc, data.label), 'success') + TriggerClientEvent('wasabi_magnet:notify', source, Strings.find_success, string.format(Strings.find_success_desc, data.label), 'success') else - TriggerClientEvent('wasabi_fishing:notify', source, Strings.cannot_carry, Strings.cannot_carry_desc, 'error') + TriggerClientEvent('wasabi_magnet:notify', source, Strings.cannot_carry, Strings.cannot_carry_desc, 'error') end else AddItem(source, data.item, 1) - TriggerClientEvent('wasabi_fishing:notify', source, Strings.fish_success, string.format(Strings.fish_success_desc, data.label), 'success') + TriggerClientEvent('wasabi_magnet:notify', source, Strings.find_success, string.format(Strings.find_success_desc, data.label), 'success') end - elseif xPole > 0 and not xBait then - TriggerClientEvent('wasabi_fishing:interupt', source) - TriggerClientEvent('wasabi_fishing:notify', source, Strings.no_bait, Strings.no_bait_desc, 'error') - elseif xPole < 1 then + elseif xRope > 0 and not xMagnet then + TriggerClientEvent('wasabi_magnet:interupt', source) + TriggerClientEvent('wasabi_magnet:notify', source, Strings.no_magnet, Strings.no_magnet_desc, 'error') + elseif xRope < 1 then KickPlayer(source, Strings.kicked) end end) -RegisterNetEvent('wasabi_fishing:processItem', function(fishItem) - -- Find processing data for this fish - local processData = nil - for _, data in pairs(Config.processing.products) do - if data.sourceItem == fishItem then - processData = data - break - end - end - - if not processData then - TriggerClientEvent('wasabi_fishing:notify', source, 'Cannot Process', 'This fish cannot be processed', 'error') - return - end - - -- Check if player has the fish and knife - local hasFish = HasItem(source, fishItem) - local hasKnife = HasItem(source, Config.processing.knifeItem) - - if hasFish < 1 or hasKnife < 1 then - TriggerClientEvent('wasabi_fishing:notify', source, 'Missing Items', 'You need both the fish and a knife', 'error') - return - end - - -- Remove the fish - RemoveItem(source, fishItem, 1) - - -- Add fish fillets - local filletYield = processData.yield[1] - local filletAmount = math.random(filletYield.amount[1], filletYield.amount[2]) - - if Framework == 'esx' and not Config.oldESX then - local player = GetPlayer(source) - if player.canCarryItem(filletYield.item, filletAmount) then - AddItem(source, filletYield.item, filletAmount) - TriggerClientEvent('wasabi_fishing:notify', source, 'Processing Success', - 'You obtained ' .. filletAmount .. ' fish fillets', 'success') - else - TriggerClientEvent('wasabi_fishing:notify', source, Strings.cannot_carry, Strings.cannot_carry_desc, 'error') - -- Give back the fish if they can't carry the fillets - AddItem(source, fishItem, 1) - return - end - else - AddItem(source, filletYield.item, filletAmount) - TriggerClientEvent('wasabi_fishing:notify', source, 'Processing Success', - 'You obtained ' .. filletAmount .. ' fish fillets', 'success') - end - - -- Check for caviar - for i=2, #processData.yield do - local extraYield = processData.yield[i] - if extraYield.item == 'caviar' and extraYield.chance then - local chance = math.random(1, 100) - if chance <= extraYield.chance then - if Framework == 'esx' and not Config.oldESX then - local player = GetPlayer(source) - if player.canCarryItem(extraYield.item, 1) then - AddItem(source, extraYield.item, 1) - TriggerClientEvent('wasabi_fishing:notify', source, 'Caviar Found', 'You found some valuable caviar!', 'success') - end - else - AddItem(source, extraYield.item, 1) - TriggerClientEvent('wasabi_fishing:notify', source, 'Caviar Found', 'You found some valuable caviar!', 'success') - end - end - end - end -end) - -RegisterNetEvent('wasabi_fishing:sellFish', function() +RegisterNetEvent('wasabi_magnet:sellFinds', function() local playerPed = GetPlayerPed(source) local playerCoord = GetEntityCoords(playerPed) local distance = #(playerCoord - Config.sellShop.coords) @@ -197,14 +127,9 @@ RegisterNetEvent('wasabi_fishing:sellFish', function() return end - -- Sell fish - for i=1, #Config.fish do - SellItem(source, Config.fish[i]) - end - - -- Sell processed items - for i=1, #Config.processedItems do - SellItem(source, Config.processedItems[i]) + -- Sell finds + for i=1, #Config.finds do + SellItem(source, Config.finds[i]) end end) @@ -217,20 +142,13 @@ function SellItem(source, itemData) end if rewardAmount > 0 then AddMoney(source, 'money', rewardAmount) - TriggerClientEvent('wasabi_fishing:notify', source, Strings.sold_for, + TriggerClientEvent('wasabi_magnet:notify', source, Strings.sold_for, (Strings.sold_for_desc):format(HasItem(source, itemData.item), itemData.label, addCommas(rewardAmount)), 'success') RemoveItem(source, itemData.item, HasItem(source, itemData.item)) end end end --- Register usable items for all fish types for processing -for _, fish in pairs(Config.fish) do - RegisterUsableItem(fish.item, function(source) - TriggerClientEvent('wasabi_fishing:processFish', source, fish.item) - end) -end - -RegisterUsableItem(Config.fishingRod.itemName, function(source) - TriggerClientEvent('wasabi_fishing:startFishing', source) +RegisterUsableItem(Config.magnetRope.itemName, function(source) + TriggerClientEvent('wasabi_magnet:startMagnetFishing', source) end) diff --git a/resources/[jobs]/[civ]/nordi_magentfishing/server/updater.lua b/resources/[jobs]/[civ]/nordi_magentfishing/server/updater.lua index 4ccf173fe..5e0620978 100644 --- a/resources/[jobs]/[civ]/nordi_magentfishing/server/updater.lua +++ b/resources/[jobs]/[civ]/nordi_magentfishing/server/updater.lua @@ -3,12 +3,12 @@ --------------------------------------------------------------- local curVersion = GetResourceMetadata(GetCurrentResourceName(), "version") -local resourceName = "wasabi_fishing" +local resourceName = "wasabi_magnet" if Config.checkForUpdates then CreateThread(function() - if GetCurrentResourceName() ~= "wasabi_fishing" then - resourceName = "wasabi_fishing (" .. GetCurrentResourceName() .. ")" + if GetCurrentResourceName() ~= "wasabi_magnet" then + resourceName = "wasabi_magnet (" .. GetCurrentResourceName() .. ")" end end) @@ -60,4 +60,4 @@ if Config.checkForUpdates then return repoVersion, repoURL, repoBody end -end \ No newline at end of file +end