# CodeRanch - cFishing

A professional, feature-rich fishing system with progression, cooperative gameplay, missions, events, leaderboards, coop system and a fully localized modern UI.

## Features

### Leveling & Progression

* Unlimited level system with exponential XP scaling
* 3-tier fishing rod progression (Level 1 / 25 / 50)
* Each rod tier shifts rarity chances (common → rare → legendary)
* XP rewards scale by fish rarity (common, rare, legendary)

### Fish & Rarity

* **17 fish species** across 3 rarity tiers
* **Common** (7 species) — Bluegill, Perch, Rock Bass, etc.
* **Rare** (6 species) — Largemouth Bass, Lake Trout, Striped Bass, etc.
* **Legendary** (4 species) — Muskie, Lake Sturgeon, Chinook Salmon, etc.

### Minigames

* **Two selectable modes** via config:
  * Quick-time letter press (reaction-based)
  * Timing bar with SPACE press (precision-based)
* Progressive difficulty across 5 rounds
* 2 mistakes allowed per attempt

### Weekly Missions

* Configurable weekly missions with auto-reset every Monday
* Per-mission: target fish, required count, XP reward
* Progress tracked per player/character

### Scheduled Events

* Time-limited events with start/end dates
* Custom fish targets, counts, and XP rewards
* Real-time countdown timer in UI

### Cooperative System

* Up to 10 players per team
* 1.25x XP multiplier during coop tasks
* Random fish assignment with shared progress
* Configurable fishing zones with GPS navigation
* Owner can invite/kick, members can leave
* Real-time invite system with accept/reject

### Leaderboard

* Top 8 players ranked by level and XP
* Shows personal rank if outside top 8
* Highlighted current player

### Wiki / Encyclopedia

* 25 searchable entries (rods, bait, all fish)
* Rarity tags, level requirements, descriptions
* Real-time search filtering

## UI Pages

| Page        | Description                                        |
| ----------- | -------------------------------------------------- |
| Home        | Level progress, scheduled events, countdown timers |
| Missions    | Weekly mission list with progress bars             |
| Coop        | Team management, player search, invite system      |
| Leaderboard | Top 8 ranking with personal position               |
| Wiki        | Searchable item/fish encyclopedia                  |
| Minigame    | Fullscreen overlay (2 game modes)                  |

Built with **Vue 3** + **Pinia** + **TailwindCSS**. Smooth transitions and animations throughout.

## Configuration

All options in `config.lua` — no code changes needed.

| Section                  | What it controls                                                         |
| ------------------------ | ------------------------------------------------------------------------ |
| `Config.Debug`           | Console logging toggle                                                   |
| `Config.Interaction`     | NPC model, position, interaction type (`target` / `drawtext` / `prompt`) |
| `Config.Blips`           | Map blip name, sprite, toggle                                            |
| `Config.LevelSystem`     | BaseXP, Multiplier, Exponent for XP curve                                |
| `Config.Rods`            | Rod names, required levels, rarity percentages                           |
| `Config.Fish`            | Fish species per rarity tier                                             |
| `Config.CatchXP`         | Min/max XP per rarity                                                    |
| `Config.Missions`        | Weekly missions (fish, count, XP)                                        |
| `Config.ScheduledEvents` | Timed events (dates, fish, count, XP)                                    |
| `Config.Minigame`        | `"first"` or `"second"` game mode                                        |
| `Config.ReelTimer`       | Min/max seconds before fish bites                                        |
| `Config.Coop`            | Max members, XP multiplier, task fish count, task XP reward              |
| `Config.CoopZones`       | Zone names, coordinates, radius                                          |

## Localization

6 languages included out of the box:

* English (en)
* Turkish (tr)
* Arabic (ar)
* French (fr)
* Italian (it)
* Spanish (es)

Covers all UI text, notifications, wiki descriptions, and prompts. Language is pulled from player preference via `cBase`.

## Dependencies

* **oxmysql**
* **cBase**
* **ox\_target** *(optional, for target interaction mode)*

## Database

Tables are created automatically on first start:

* `cfishing` — Player level & XP
* `cfishing_missions` — Weekly mission progress
* `cfishing_events` — Scheduled event progress

## Installation

1. Drop `cFishing` into your resources folder
2. Add `ensure cFishing` to your `server.cfg`
3. Configure `config.lua` to your liking
4. Restart server — database tables are created automatically

#### ALERT FOR RSG CORE

To use the fishing rod properly, you need to update the code block at the very bottom of **rsg-essentials/client/weaponcheck.lua** with the following;\ <br>

```lua
CreateThread(function()   
    while true do
        Wait(1000)
        local player = PlayerPedId()
        local weapon = Citizen.InvokeNative(0x8425C5F057012DAB, player) -- GET_CURRENT_PED_WEAPON
        local WeaponData = RSGCore.Shared.Weapons[weapon]
        if WeaponData and WeaponData["name"] ~= "weapon_unarmed" then
            local weaponGroup = Citizen.InvokeNative(0xEDCA14CA5199FF25, weapon) -- GET_WEAPONTYPE_GROUP
            if weaponGroup ~= `group_thrown` and WeaponData["name"] ~= "weapon_fishingrod" then
                local hasItem = RSGCore.Functions.HasItem(WeaponData["name"])
                if not hasItem then
                    -- remove weapon that is not in the inventory of the player
                    SetCurrentPedWeapon(player, `WEAPON_UNARMED`, true)
                    RemoveWeaponFromPed(player, weapon)
                end
            end
        end
    end
end)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://coderanch-redm-store.gitbook.io/coderanch-redm-store-docs/coderanch-cfishing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
