diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dbcd4e3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Файлы плейса Roblox +*.rbxl +*.rbxlx +*.rbxl.lock +*.rbxlx.lock + +# Rojo / инструменты +sourcemap.json diff --git a/README.md b/README.md index e9c1025..6e13359 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,55 @@ -# Fishing +# Клёвое место: рыбалка в Roblox +## Структура + +``` +src/ + ReplicatedStorage/ FishConfig.lua, GameModels.lua (ModuleScript) + ServerScriptService/ MapBuilder.server.lua, GameServer.server.lua (Script) + StarterPlayer/StarterPlayerScripts/ FishingClient.client.lua (LocalScript) +install/ INSTALL.lua и .rbxmx — установка без Rojo +default.project.json проект Rojo +``` + +С Rojo: `rojo serve` и подключиться плагином Rojo в Studio. + +## Установка без Rojo + +1. Откройте плейс в Roblox Studio (например, шаблон **Baseplate**). +2. Откройте `install/INSTALL.lua` Блокнотом → **Ctrl+A** → **Ctrl+C**. +3. Вставьте код в **Command Bar** (строка внизу Studio) → **Ctrl+Enter**. +4. В **Output** появится «ГОТОВО!». Нажмите **Play** (F5). + +Запасной способ: правой кнопкой по папке в Explorer → **Insert from File…** → файлы из `install/` (в названии файла указано, в какую папку его вставлять). + +## Что есть в игре + +- **Лобби** за невидимой стеной: фонтан, баннеры, магазин удочек, скупка, две донат-лавки, сундук с ежедневной наградой, 4 портала. +- **Миры** (тоже закрыты стенами), телепорт кнопкой 🌍 (M) или через порталы: + - 🌊 Тихое озеро (ур. 1) + - 🏝 Тропический остров (ур. 8): пальмы, кораллы, тики-хижины, мелководье + - ❄ Ледяной фьорд (ур. 18): рыбалка в лунках, иглу, северное сияние, снег + - 🌋 Вулкан: «скоро» +- **36 видов рыбы** с моделями 12 форм: акула, скат, мурена, рыба-меч, иглобрюх, удильщик со светящейся приманкой, медуза, камбала и др. Мутации: Блестящая, Золотая, Радужная. +- **8 удочек** (дерево → Легенда), улучшение до ★★★★★, анимация заброса, поклёвки и подсечки. +- **Удача:** удочка + улучшения + уровень + зелья + мастерство миров + пропуска + события. +- **Коллекция (C):** по мирам и редкостям; за каждую собранную редкость монеты и опыт, за весь мир +10% удачи навсегда. +- **Задания (Q):** 3 задания одновременно, после награды появляется новое. Ежедневная награда на 7 дней. +- **События на сервере** каждые 7–12 минут: Клёвый час, Удачный ветер, Звездопад, Рыбная ярмарка. +- **Донат (💎):** 4 пропуска и 4 набора. + +## Настройка доната (Robux) + +1. Опубликуйте игру: **File → Publish to Roblox**. +2. Откройте **create.roblox.com → Creations → ваша игра → Monetization**. +3. **Passes:** создайте 4 пропуска (VIP, x2 Монеты, Талисман удачи, Бездонная сумка), включите продажу и задайте цену. +4. **Developer Products:** создайте 4 товара (Мешок монет, Сундук монет, Гора золота, Супер-зелье удачи). +5. Скопируйте ID каждого и впишите в `FishConfig` → `Config.GamePasses` и `Config.Products` вместо `id = 0`. + +Пока ID = 0, кнопка покупки показывает подсказку и ничего не продаёт. + +## Сохранение +**Game Settings → Security → Enable Studio Access to API Services** (плейс должен быть опубликован). + +## Если что-то не так +**View → Output**: пришлите скриншот красных строк. diff --git a/default.project.json b/default.project.json new file mode 100644 index 0000000..cfa9b42 --- /dev/null +++ b/default.project.json @@ -0,0 +1,17 @@ +{ + "name": "Fishing", + "tree": { + "$className": "DataModel", + "ReplicatedStorage": { + "$path": "src/ReplicatedStorage" + }, + "ServerScriptService": { + "$path": "src/ServerScriptService" + }, + "StarterPlayer": { + "StarterPlayerScripts": { + "$path": "src/StarterPlayer/StarterPlayerScripts" + } + } + } +} diff --git a/install/1_FishConfig_ReplicatedStorage.rbxmx b/install/1_FishConfig_ReplicatedStorage.rbxmx new file mode 100644 index 0000000..e762c2a --- /dev/null +++ b/install/1_FishConfig_ReplicatedStorage.rbxmx @@ -0,0 +1,313 @@ + + + +FishConfig + ReplicatedStorage +-- Все настройки игры. Меняй цифры здесь, чтобы настроить баланс. + +local Config = {} + +Config.GameName = "Клёвое место" + +---------------------------------------------------------------- миры +-- center = центр мира на карте; mult = множитель наград коллекции +Config.Worlds = { + { + id = "World1", name = "Тихое озеро", icon = "🌊", level = 1, mult = 1, + center = Vector3.new(0, 0, 1500), color = Color3.fromRGB(60, 200, 255), + desc = "Спокойное лесное озеро. Отличное место, чтобы начать.", + clock = 14.5, water = Color3.fromRGB(20, 95, 115), + waterY = 0, + lakes = { { 0, 0, 55 }, { -45, 15, 40 }, { 45, -10, 42 }, { 10, -42, 34 }, { -22, 40, 28 } }, -- { x, z, радиус } от центра + }, + { + id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4, + center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70), + desc = "Бирюзовое море, пальмы и яркая рифовая рыба.", + clock = 13, water = Color3.fromRGB(35, 175, 185), + waterY = 0, + sea = 119, -- всё дальше этого радиуса от центра — море + }, + { + id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12, + center = Vector3.new(-1500, 0, 0), color = Color3.fromRGB(150, 220, 255), + desc = "Рыбалка в лунках среди льдов и северного сияния.", + clock = 18.3, water = Color3.fromRGB(25, 70, 100), + waterY = 1, + lakes = { { 0, 0, 70 }, { -55, 30, 45 }, { 55, -25, 50 }, { 5, -70, 40 } }, -- подо льдом + holes = { + { 0, 40 }, { -22, 18 }, { 22, 12 }, { 0, -12 }, { -30, -30 }, { 30, 40 }, { -60, 35 }, + { -45, 15 }, { 55, -25 }, { 75, -5 }, { 40, -50 }, { 5, -75 }, { -15, -60 }, { 25, -80 }, + }, + holeRadius = 6, + }, + { + id = "World4", name = "Вулкан", icon = "🌋", level = 30, mult = 30, soon = true, + center = Vector3.new(0, 0, -1500), color = Color3.fromRGB(255, 90, 40), + desc = "Рыбалка в лаве. Скоро!", + }, +} +Config.WorldRadius = 260 + +function Config.WorldAt(pos) + for _, w in ipairs(Config.Worlds) do + if not w.soon then + local d = Vector3.new(pos.X - w.center.X, 0, pos.Z - w.center.Z).Magnitude + if d < Config.WorldRadius then + return w + end + end + end + return nil +end + +-- есть ли вода в этой точке мира (озеро, море или лунка) +function Config.IsWater(world, pos) + if not world then + return false + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + if world.holes then + local r = world.holeRadius or 6 + for _, h in ipairs(world.holes) do + if (x - h[1]) ^ 2 + (z - h[2]) ^ 2 <= r * r then + return true + end + end + return false + end + if world.sea and math.sqrt(x * x + z * z) >= world.sea then + return true + end + for _, l in ipairs(world.lakes or {}) do + if (x - l[1]) ^ 2 + (z - l[2]) ^ 2 <= (l[3] - 1) ^ 2 then + return true + end + end + return false +end + +---------------------------------------------------------------- редкости +Config.Rarities = { + Common = { name = "Обычная", rank = 1, weight = 55, color = Color3.fromRGB(215, 220, 225) }, + Uncommon = { name = "Необычная", rank = 2, weight = 27, color = Color3.fromRGB(95, 225, 115) }, + Rare = { name = "Редкая", rank = 3, weight = 11, color = Color3.fromRGB(70, 160, 255) }, + Epic = { name = "Эпическая", rank = 4, weight = 4.5, color = Color3.fromRGB(185, 90, 255) }, + Legendary = { name = "Легендарная", rank = 5, weight = 1.2, color = Color3.fromRGB(255, 185, 35) }, + Mythic = { name = "Мифическая", rank = 6, weight = 0.25, color = Color3.fromRGB(255, 80, 150) }, +} +Config.RarityOrder = { "Common", "Uncommon", "Rare", "Epic", "Legendary", "Mythic" } + +---------------------------------------------------------------- мутации +Config.Mutations = { + { id = "Rainbow", name = "Радужная", chance = 0.002, mult = 10, color = Color3.fromRGB(255, 120, 230) }, + { id = "Golden", name = "Золотая", chance = 0.010, mult = 5, color = Color3.fromRGB(255, 205, 60) }, + { id = "Shiny", name = "Блестящая", chance = 0.040, mult = 2, color = Color3.fromRGB(170, 240, 255) }, +} + +---------------------------------------------------------------- рыба +-- shape: classic, long, tall, flat, ray, puffer, shark, eel, sword, angler, jelly, sturgeon +-- color2 = второй цвет (плавники/узор); stripes/spots/whiskers/spikes/glow — украшения модели +local function F(t) + return t +end + +Config.Zones = { + World1 = { + fish = { + F({ id = "Karas", name = "Карась", rarity = "Common", price = 5, xp = 8, minW = 0.2, maxW = 1.2, size = 1.0, shape = "tall", color = Color3.fromRGB(205, 170, 75), color2 = Color3.fromRGB(170, 120, 50) }), + F({ id = "Plotva", name = "Плотва", rarity = "Common", price = 6, xp = 8, minW = 0.1, maxW = 0.8, size = 0.9, shape = "classic", color = Color3.fromRGB(195, 200, 210), color2 = Color3.fromRGB(220, 80, 60) }), + F({ id = "Ersh", name = "Ёрш", rarity = "Common", price = 7, xp = 9, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(135, 125, 75), color2 = Color3.fromRGB(95, 85, 50), spikes = true, spots = 6 }), + F({ id = "Okun", name = "Окунь", rarity = "Uncommon", price = 15, xp = 18, minW = 0.3, maxW = 1.5, size = 1.0, shape = "classic", color = Color3.fromRGB(150, 180, 70), color2 = Color3.fromRGB(230, 90, 40), stripes = 5, spikes = true }), + F({ id = "Lesh", name = "Лещ", rarity = "Uncommon", price = 18, xp = 20, minW = 0.5, maxW = 3.0, size = 1.2, shape = "tall", color = Color3.fromRGB(175, 145, 95), color2 = Color3.fromRGB(120, 95, 60) }), + F({ id = "Lin", name = "Линь", rarity = "Uncommon", price = 20, xp = 22, minW = 0.4, maxW = 2.5, size = 1.1, shape = "classic", color = Color3.fromRGB(95, 125, 55), color2 = Color3.fromRGB(60, 85, 35) }), + F({ id = "Shuka", name = "Щука", rarity = "Rare", price = 45, xp = 45, minW = 1.0, maxW = 8.0, size = 1.5, shape = "long", color = Color3.fromRGB(110, 140, 85), color2 = Color3.fromRGB(200, 210, 150), spots = 12 }), + F({ id = "Sudak", name = "Судак", rarity = "Rare", price = 50, xp = 48, minW = 1.0, maxW = 6.0, size = 1.4, shape = "long", color = Color3.fromRGB(165, 165, 135), color2 = Color3.fromRGB(80, 80, 70), stripes = 6, spikes = true }), + F({ id = "Som", name = "Сом", rarity = "Epic", price = 130, xp = 110, minW = 5.0, maxW = 40, size = 2.0, shape = "long", color = Color3.fromRGB(75, 75, 90), color2 = Color3.fromRGB(180, 175, 160), whiskers = true }), + F({ id = "Koi", name = "Карп кои", rarity = "Epic", price = 150, xp = 120, minW = 2.0, maxW = 9.0, size = 1.4, shape = "classic", color = Color3.fromRGB(250, 245, 240), color2 = Color3.fromRGB(240, 110, 40), spots = 7, whiskers = true }), + F({ id = "Gold", name = "Золотая рыбка", rarity = "Legendary", price = 500, xp = 350, minW = 0.1, maxW = 0.5, size = 0.9, shape = "classic", color = Color3.fromRGB(255, 195, 40), color2 = Color3.fromRGB(255, 120, 30), glow = true, bigTail = true }), + F({ id = "Crystal", name = "Хрустальный осётр", rarity = "Mythic", price = 2000, xp = 900, minW = 10, maxW = 60, size = 2.0, shape = "sturgeon", color = Color3.fromRGB(150, 230, 255), color2 = Color3.fromRGB(230, 250, 255), glow = true, glass = true }), + }, + }, + World2 = { + fish = { + F({ id = "Clown", name = "Рыба-клоун", rarity = "Common", price = 18, xp = 18, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(255, 120, 30), color2 = Color3.fromRGB(255, 255, 255), stripes = 3 }), + F({ id = "Sergeant", name = "Рыба-сержант", rarity = "Common", price = 20, xp = 18, minW = 0.2, maxW = 0.9, size = 0.9, shape = "tall", color = Color3.fromRGB(240, 230, 110), color2 = Color3.fromRGB(40, 40, 45), stripes = 5 }), + F({ id = "Mullet", name = "Барабулька", rarity = "Common", price = 22, xp = 20, minW = 0.1, maxW = 0.6, size = 0.9, shape = "classic", color = Color3.fromRGB(235, 110, 100), color2 = Color3.fromRGB(255, 220, 120), whiskers = true }), + F({ id = "Angel", name = "Рыба-ангел", rarity = "Uncommon", price = 45, xp = 40, minW = 0.3, maxW = 1.5, size = 1.0, shape = "tall", color = Color3.fromRGB(60, 120, 230), color2 = Color3.fromRGB(255, 220, 40), stripes = 4, bigFins = true }), + F({ id = "Puffer", name = "Иглобрюх", rarity = "Uncommon", price = 50, xp = 42, minW = 0.3, maxW = 2.0, size = 1.0, shape = "puffer", color = Color3.fromRGB(230, 205, 140), color2 = Color3.fromRGB(110, 90, 60), spots = 10 }), + F({ id = "Parrot", name = "Рыба-попугай", rarity = "Uncommon", price = 55, xp = 45, minW = 1.0, maxW = 5.0, size = 1.2, shape = "classic", color = Color3.fromRGB(60, 210, 190), color2 = Color3.fromRGB(240, 90, 180), spots = 5 }), + F({ id = "Ray", name = "Скат", rarity = "Rare", price = 120, xp = 90, minW = 3.0, maxW = 25, size = 1.6, shape = "ray", color = Color3.fromRGB(110, 115, 140), color2 = Color3.fromRGB(230, 230, 240), spots = 14 }), + F({ id = "Barracuda", name = "Барракуда", rarity = "Rare", price = 130, xp = 95, minW = 2.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(175, 185, 200), color2 = Color3.fromRGB(60, 70, 85), stripes = 8 }), + F({ id = "Swordfish", name = "Рыба-меч", rarity = "Epic", price = 350, xp = 220, minW = 30, maxW = 200, size = 2.0, shape = "sword", color = Color3.fromRGB(55, 75, 130), color2 = Color3.fromRGB(200, 210, 230) }), + F({ id = "Moray", name = "Мурена", rarity = "Epic", price = 320, xp = 210, minW = 2.0, maxW = 15, size = 1.8, shape = "eel", color = Color3.fromRGB(80, 140, 60), color2 = Color3.fromRGB(230, 220, 90), spots = 12 }), + F({ id = "Shark", name = "Рифовая акула", rarity = "Legendary", price = 1200, xp = 700, minW = 40, maxW = 180, size = 2.4, shape = "shark", color = Color3.fromRGB(110, 125, 145), color2 = Color3.fromRGB(235, 235, 240) }), + F({ id = "SunJelly", name = "Солнечная медуза", rarity = "Mythic", price = 5000, xp = 2000, minW = 1.0, maxW = 8.0, size = 1.8, shape = "jelly", color = Color3.fromRGB(255, 200, 80), color2 = Color3.fromRGB(255, 120, 200), glow = true, glass = true }), + }, + }, + World3 = { + fish = { + F({ id = "Cod", name = "Треска", rarity = "Common", price = 55, xp = 40, minW = 1.0, maxW = 10, size = 1.2, shape = "classic", color = Color3.fromRGB(150, 150, 110), color2 = Color3.fromRGB(230, 225, 200), spots = 14, whiskers = true }), + F({ id = "Herring", name = "Сельдь", rarity = "Common", price = 50, xp = 38, minW = 0.2, maxW = 0.8, size = 0.9, shape = "long", color = Color3.fromRGB(150, 175, 205), color2 = Color3.fromRGB(70, 100, 140) }), + F({ id = "Capelin", name = "Мойва", rarity = "Common", price = 48, xp = 36, minW = 0.05, maxW = 0.2, size = 0.7, shape = "classic", color = Color3.fromRGB(170, 200, 190), color2 = Color3.fromRGB(80, 120, 110) }), + F({ id = "Flounder", name = "Камбала", rarity = "Uncommon", price = 140, xp = 90, minW = 0.5, maxW = 4.0, size = 1.2, shape = "flat", color = Color3.fromRGB(150, 125, 90), color2 = Color3.fromRGB(230, 120, 60), spots = 10 }), + F({ id = "Redfish", name = "Морской окунь", rarity = "Uncommon", price = 150, xp = 92, minW = 0.5, maxW = 5.0, size = 1.1, shape = "classic", color = Color3.fromRGB(225, 70, 60), color2 = Color3.fromRGB(255, 160, 120), spikes = true }), + F({ id = "Char", name = "Арктический голец", rarity = "Uncommon", price = 160, xp = 95, minW = 0.5, maxW = 6.0, size = 1.2, shape = "long", color = Color3.fromRGB(120, 130, 150), color2 = Color3.fromRGB(255, 130, 150), spots = 12 }), + F({ id = "Halibut", name = "Палтус", rarity = "Rare", price = 380, xp = 200, minW = 5.0, maxW = 90, size = 1.9, shape = "flat", color = Color3.fromRGB(90, 95, 80), color2 = Color3.fromRGB(150, 150, 130), spots = 16 }), + F({ id = "Wolffish", name = "Морской волк", rarity = "Rare", price = 400, xp = 210, minW = 3.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(110, 120, 140), color2 = Color3.fromRGB(60, 65, 80), stripes = 7, teeth = true }), + F({ id = "Angler", name = "Удильщик", rarity = "Epic", price = 1100, xp = 500, minW = 5.0, maxW = 50, size = 1.6, shape = "angler", color = Color3.fromRGB(60, 50, 70), color2 = Color3.fromRGB(120, 255, 230), glow = true }), + F({ id = "IceEel", name = "Ледяная мурена", rarity = "Epic", price = 1000, xp = 480, minW = 3.0, maxW = 25, size = 1.9, shape = "eel", color = Color3.fromRGB(150, 210, 245), color2 = Color3.fromRGB(240, 250, 255), glass = true }), + F({ id = "Greenland", name = "Полярная акула", rarity = "Legendary", price = 3500, xp = 1500, minW = 200, maxW = 900, size = 2.6, shape = "shark", color = Color3.fromRGB(80, 90, 100), color2 = Color3.fromRGB(160, 170, 180) }), + F({ id = "Leviathan", name = "Ледяной левиафан", rarity = "Mythic", price = 15000, xp = 4000, minW = 500, maxW = 3000, size = 2.4, shape = "eel", color = Color3.fromRGB(110, 230, 255), color2 = Color3.fromRGB(200, 120, 255), glow = true, spikes = true }), + }, + }, +} + +---------------------------------------------------------------- удочки +-- luck = бонус удачи, speed = множитель ожидания клёва (меньше = быстрее), zone = ширина зелёной зоны +Config.Rods = { + { id = "Basic", name = "Старая удочка", price = 0, level = 1, luck = 0.00, speed = 1.00, zone = 0.22, upgradeCost = 40, style = "wood" }, + { id = "Bamboo", name = "Бамбуковая удочка", price = 150, level = 3, luck = 0.15, speed = 0.88, zone = 0.25, upgradeCost = 120, style = "bamboo" }, + { id = "Fiberglass", name = "Стеклопластиковая", price = 600, level = 5, luck = 0.30, speed = 0.78, zone = 0.27, upgradeCost = 300, style = "glass" }, + { id = "Carbon", name = "Карбоновая удочка", price = 1800, level = 8, luck = 0.55, speed = 0.68, zone = 0.29, upgradeCost = 700, style = "carbon" }, + { id = "Coral", name = "Коралловая удочка", price = 4500, level = 10, luck = 0.80, speed = 0.62, zone = 0.31, upgradeCost = 1300, style = "coral" }, + { id = "Golden", name = "Золотая удочка", price = 9000, level = 13, luck = 1.00, speed = 0.56, zone = 0.33, upgradeCost = 2200, style = "gold" }, + { id = "Frost", name = "Ледяная удочка", price = 25000, level = 18, luck = 1.40, speed = 0.50, zone = 0.35, upgradeCost = 5000, style = "frost" }, + { id = "Legend", name = "Удочка Легенды", price = 75000, level = 25, luck = 2.00, speed = 0.42, zone = 0.38, upgradeCost = 12000, style = "legend" }, +} + +Config.RodUpgrade = { maxLevel = 5, luckPerLevel = 0.08, zonePerLevel = 0.012, speedPerLevel = 0.96 } +function Config.UpgradeCost(rod, currentLevel) + return math.floor(rod.upgradeCost * (currentLevel + 1) ^ 1.5) +end + +---------------------------------------------------------------- сумки +Config.Bags = { + { id = "Pouch", name = "Холщовая сумка", price = 0, level = 1, capacity = 12, color = Color3.fromRGB(170, 140, 95) }, + { id = "Satchel", name = "Сумка рыбака", price = 150, level = 2, capacity = 25, color = Color3.fromRGB(110, 140, 80) }, + { id = "Backpack", name = "Туристический рюкзак", price = 700, level = 4, capacity = 45, color = Color3.fromRGB(60, 110, 180) }, + { id = "BigNet", name = "Огромный садок", price = 2500, level = 7, capacity = 80, color = Color3.fromRGB(200, 80, 50) }, + { id = "Chest", name = "Сундук за спиной", price = 9000, level = 12, capacity = 140, color = Color3.fromRGB(140, 90, 50) }, + { id = "Magic", name = "Магический мешок", price = 30000, level = 20, capacity = 250, color = Color3.fromRGB(120, 60, 200) }, +} + +---------------------------------------------------------------- удача +Config.LuckPerPlayerLevel = 0.02 -- +2% за уровень игрока +Config.MasteryLuck = 0.10 -- +10% навсегда за полностью собранный мир +Config.Potions = { + { id = "Luck1", name = "Зелье удачи", price = 120, bonus = 0.5, duration = 300, color = Color3.fromRGB(90, 230, 120) }, + { id = "Luck2", name = "Большое зелье удачи", price = 450, bonus = 1.0, duration = 600, color = Color3.fromRGB(255, 200, 60), level = 5 }, + { id = "Luck3", name = "Эликсир фортуны", price = 2500, bonus = 2.0, duration = 600, color = Color3.fromRGB(200, 120, 255), level = 12 }, +} + +---------------------------------------------------------------- коллекция +-- награда за то, что поймал ВСЕ виды одной редкости в мире (умножается на mult мира) +Config.CollectionRewards = { + Common = { coins = 50, xp = 40 }, + Uncommon = { coins = 120, xp = 100 }, + Rare = { coins = 300, xp = 250 }, + Epic = { coins = 800, xp = 600 }, + Legendary = { coins = 2000, xp = 1500 }, + Mythic = { coins = 6000, xp = 4000 }, +} +Config.MasteryCoins = 5000 -- за весь мир (тоже умножается на mult) + +---------------------------------------------------------------- задания +-- coins/xp = награда за 1 единицу цели (умножается на цель и уровень игрока) +Config.Quests = { + { kind = "catch", text = "Поймай %d рыб", goals = { 10, 20, 35 }, coins = 6, xp = 5 }, + { kind = "rare", text = "Поймай %d рыб редкости «Редкая» и выше", goals = { 1, 2, 3 }, coins = 60, xp = 50 }, + { kind = "epic", text = "Поймай эпическую рыбу или реже", goals = { 1 }, coins = 250, xp = 200 }, + { kind = "mutation", text = "Поймай рыбу с мутацией", goals = { 1 }, coins = 200, xp = 150 }, + { kind = "earn", text = "Заработай %d монет на продаже", goals = { 200, 600, 1500 }, coins = 0.25, xp = 0.2 }, + { kind = "perfect", text = "Сделай %d идеальных подсечек (без промаха)", goals = { 5, 10, 15 }, coins = 15, xp = 12 }, +} +Config.QuestSlots = 3 + +-- ежедневная награда (7 дней по кругу), монеты растут с уровнем +Config.DailyRewards = { + { coins = 100 }, + { coins = 200 }, + { coins = 300, potion = "Luck1" }, + { coins = 450 }, + { coins = 600, potion = "Luck1" }, + { coins = 800 }, + { coins = 1500, potion = "Luck2" }, +} + +---------------------------------------------------------------- события на сервере +Config.Events = { + { id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 }, + { id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 }, + { id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 }, + { id = "Fair", name = "💰 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 }, +} +Config.EventFirstDelay = 120 +Config.EventGapMin = 420 +Config.EventGapMax = 720 + +---------------------------------------------------------------- донат (Robux) +-- ВАЖНО: впиши сюда ID своих пропусков и товаров с create.roblox.com. +-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен. +Config.GamePasses = { + { key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и монет, корона над головой" }, + { key = "DoubleCoins", id = 0, robux = 299, icon = "💰", name = "x2 Монеты", desc = "Вся рыба продаётся в 2 раза дороже" }, + { key = "LuckyCharm", id = 0, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" }, + { key = "BigBag", id = 0, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" }, +} +Config.Products = { + { key = "Coins1", id = 0, robux = 49, icon = "🪙", name = "Мешок монет", desc = "+1 000 монет (больше с уровнем)", coins = 1000 }, + { key = "Coins2", id = 0, robux = 199, icon = "💰", name = "Сундук монет", desc = "+5 000 монет (больше с уровнем)", coins = 5000 }, + { key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 монет (больше с уровнем)", coins = 20000 }, + { key = "Luck", id = 0, robux = 99, icon = "🧪", name = "Супер-зелье удачи", desc = "+200% удачи на 15 минут", boost = 2.0, duration = 900 }, +} + +---------------------------------------------------------------- рыбалка +Config.BiteTimeMin = 3 +Config.BiteTimeMax = 7 +Config.BiteTimeout = 12 +Config.MaxMisses = 2 +function Config.HitsNeeded(rank) + return math.ceil(rank / 2) +end +function Config.XPForLevel(level) + return 60 + level * 60 +end + +---------------------------------------------------------------- помощники +function Config.Find(list, id) + for _, item in ipairs(list) do + if item.id == id or item.key == id then + return item + end + end + return nil +end + +function Config.FindFish(fishId) + for zoneId, zone in pairs(Config.Zones) do + for _, f in ipairs(zone.fish) do + if f.id == fishId then + return f, zoneId + end + end + end + return nil +end + +function Config.RodStats(rodId, upgradeLevel) + local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1] + local u = Config.RodUpgrade + upgradeLevel = upgradeLevel or 0 + return { + luck = rod.luck + u.luckPerLevel * upgradeLevel, + speed = rod.speed * (u.speedPerLevel ^ upgradeLevel), + zone = rod.zone + u.zonePerLevel * upgradeLevel, + } +end + +return Config +]]> + + + \ No newline at end of file diff --git a/install/2_GameModels_ReplicatedStorage.rbxmx b/install/2_GameModels_ReplicatedStorage.rbxmx new file mode 100644 index 0000000..12aa9b9 --- /dev/null +++ b/install/2_GameModels_ReplicatedStorage.rbxmx @@ -0,0 +1,567 @@ + + + +GameModels + ReplicatedStorage +-- Строит 3D-модели из деталей: удочки, сумки, рыбу, поплавок. +-- Используется сервером (инструмент, витрины, рыба в руках) и клиентом (иконки). + +local Config = require(script.Parent:WaitForChild("FishConfig")) + +local M = {} +local V = Vector3.new +local SP, NEON, METAL, GLASS = Enum.Material.SmoothPlastic, Enum.Material.Neon, Enum.Material.Metal, Enum.Material.Glass + +---------------------------------------------------------------- помощники + +local function newPart(parent, props, class) + local p = Instance.new(class or "Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = false + p.CanCollide = false + p.CanQuery = false + p.CanTouch = false + p.Massless = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + p.Material = SP + for k, v in pairs(props) do + if k ~= "Shape" then + p[k] = v + end + end + p.Parent = parent + return p +end + +local function cyl(parent, a, b, dia, props) + props = props or {} + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.02, (b - a).Magnitude), dia, dia) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return newPart(parent, props) +end + +local function ball(parent, pos, dia, props) + props = props or {} + props.Shape = Enum.PartType.Ball + props.Size = V(dia, dia, dia) + props.CFrame = CFrame.new(pos) + return newPart(parent, props) +end + +local function oval(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + local p = newPart(parent, props) + local mesh = Instance.new("SpecialMesh") + mesh.MeshType = Enum.MeshType.Sphere + mesh.Parent = p + return p +end + +local function block(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + return newPart(parent, props) +end + +local function wedge(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + return newPart(parent, props, "WedgePart") +end + +local function finish(model, root, anchored) + for _, p in ipairs(model:GetDescendants()) do + if p:IsA("BasePart") and p ~= root then + local w = Instance.new("Weld") + w.Part0 = root + w.Part1 = p + w.C0 = root.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Anchored = anchored and true or false + end + end + root.Anchored = anchored and true or false + model.PrimaryPart = root + return model +end + +local function lighten(c, t) + return c:Lerp(Color3.new(1, 1, 1), t) +end +local function darken(c, t) + return c:Lerp(Color3.new(0, 0, 0), t) +end +local function C(r, g, b) + return Color3.fromRGB(r, g, b) +end + +local function sparkles(parent, color, rate) + local att = Instance.new("Attachment") + att.Parent = parent + local pe = Instance.new("ParticleEmitter") + pe.Texture = "rbxasset://textures/particles/sparkles_main.dds" + pe.Rate = rate or 6 + pe.Lifetime = NumberRange.new(0.6, 1.0) + pe.Speed = NumberRange.new(0.5, 1) + pe.Size = NumberSequence.new(0.25, 0) + pe.LightEmission = 1 + pe.Color = ColorSequence.new(color) + pe.Parent = att + return pe +end + +---------------------------------------------------------------- удочки +-- Рука в (0,0,0), удочка смотрит в -Z и изгибается вверх (+Y). + +local STYLES = { + wood = { blank = C(125, 90, 60), mat = Enum.Material.Wood, grip = C(80, 55, 35), gripMat = Enum.Material.Fabric, wrap = C(175, 175, 175), reel = C(95, 95, 100) }, + bamboo = { blank = C(215, 190, 105), mat = Enum.Material.Wood, grip = C(120, 90, 50), gripMat = Enum.Material.Fabric, wrap = C(70, 120, 60), reel = C(85, 85, 90), nodes = C(150, 120, 60) }, + glass = { blank = C(60, 130, 215), mat = SP, grip = C(35, 35, 40), gripMat = Enum.Material.Fabric, wrap = C(240, 240, 245), reel = C(60, 60, 70) }, + carbon = { blank = C(30, 30, 35), mat = SP, grip = C(195, 155, 105), gripMat = Enum.Material.Sand, wrap = C(220, 50, 50), reel = C(45, 45, 50) }, + coral = { blank = C(255, 130, 110), blank2 = C(255, 225, 210), mat = SP, grip = C(40, 170, 170), gripMat = Enum.Material.Fabric, wrap = C(40, 200, 200), reel = C(240, 240, 235), gem = C(255, 120, 160) }, + gold = { blank = C(255, 200, 50), mat = METAL, grip = C(120, 30, 30), gripMat = Enum.Material.Fabric, wrap = C(255, 255, 255), reel = C(230, 180, 50), gem = C(255, 40, 60), sparkle = C(255, 220, 90) }, + frost = { blank = C(170, 225, 255), mat = GLASS, grip = C(230, 240, 250), gripMat = Enum.Material.Fabric, wrap = C(90, 170, 255), reel = C(200, 230, 250), gem = C(120, 240, 255), sparkle = C(170, 240, 255) }, + legend = { blank = C(60, 25, 90), blank2 = C(110, 50, 170), mat = SP, grip = C(25, 20, 35), gripMat = Enum.Material.Fabric, wrap = C(255, 200, 60), wrapNeon = true, reel = C(40, 30, 60), gem = C(255, 90, 220), sparkle = C(255, 150, 240) }, +} + +function M.buildRod(rodId, upgradeLevel, anchored) + local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1] + local st = STYLES[rod.style] or STYLES.wood + upgradeLevel = upgradeLevel or 0 + local model = Instance.new("Model") + model.Name = rod.name + + local handle = newPart(model, { Name = "Handle", Size = V(0.3, 0.3, 1.8), CFrame = CFrame.new(), Transparency = 1 }) + local wrapMat = (st.wrapNeon or upgradeLevel >= 5) and NEON or METAL + local back = V(0, 0, 1) + + -- торец и камень + ball(model, V(0, 0, 1.05), 0.42, { Color = st.reel, Material = METAL }) + if st.gem then + ball(model, V(0, 0, 1.25), 0.26, { Color = st.gem, Material = NEON }) + end + -- задняя рукоять: кольца (пробка/обмотка) + for i = 0, 6 do + local z0 = 1.0 - i * 0.185 + cyl(model, V(0, 0, z0), V(0, 0, z0 - 0.185), i % 2 == 0 and 0.34 or 0.33, { + Color = i % 2 == 0 and st.grip or darken(st.grip, 0.12), Material = st.gripMat, + }) + end + -- катушкодержатель + cyl(model, V(0, 0, -0.3), V(0, 0, -0.95), 0.27, { Color = st.reel, Material = METAL }) + cyl(model, V(0, 0, -0.3), V(0, 0, -0.42), 0.32, { Color = st.wrap, Material = wrapMat }) + cyl(model, V(0, 0, -0.83), V(0, 0, -0.95), 0.32, { Color = st.wrap, Material = wrapMat }) + -- передняя рукоять + cyl(model, V(0, 0, -0.95), V(0, 0, -1.45), 0.29, { Color = st.grip, Material = st.gripMat }) + cyl(model, V(0, 0, -1.45), V(0, 0, -1.55), 0.25, { Color = st.wrap, Material = wrapMat }) + + -- катушка (безынерционная): ножка, корпус, шпуля, дужка, ручка + block(model, V(0.1, 0.42, 0.22), CFrame.new(0, -0.3, -0.62), { Color = st.reel, Material = METAL }) + oval(model, V(0.46, 0.5, 0.7), CFrame.new(0, -0.68, -0.58), { Color = st.reel, Material = METAL }) + local spoolCF = CFrame.new(0, -0.68, -1.02) * CFrame.Angles(0, math.rad(90), 0) + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.34, 0.44, 0.44), CFrame = spoolCF, Color = C(235, 235, 230), Material = SP }) + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.06, 0.5, 0.5), CFrame = spoolCF * CFrame.new(0.18, 0, 0), Color = st.wrap, Material = wrapMat }) + local bail = {} + for i = 0, 6 do + local a = math.rad(200 + i * 23) + table.insert(bail, V(math.cos(a) * 0.3, -0.68 + math.sin(a) * 0.3, -1.2)) + end + for i = 1, #bail - 1 do + cyl(model, bail[i], bail[i + 1], 0.04, { Color = C(200, 200, 205), Material = METAL }) + end + cyl(model, V(0.24, -0.68, -0.58), V(0.5, -0.86, -0.58), 0.07, { Color = st.reel, Material = METAL }) + ball(model, V(0.54, -0.9, -0.5), 0.19, { Color = st.grip, Material = SP }) + + -- бланк: 8 колен с плавным изгибом и шарами на стыках + local angles = { 6, 9, 12, 16, 20, 25, 30, 36 } + local lengths = { 1.2, 1.15, 1.1, 1.0, 0.95, 0.9, 0.85, 0.8 } + local p = V(0, 0, -1.55) + local lastSeg + for i = 1, #angles do + local a = math.rad(angles[i]) + local d = V(0, math.sin(a), -math.cos(a)) + local q = p + d * lengths[i] + local dia = 0.2 - (i - 1) * 0.019 + local color = (st.blank2 and i % 2 == 0) and st.blank2 or st.blank + lastSeg = cyl(model, p, q, dia, { Color = color, Material = st.mat }) + ball(model, q, dia * 0.97, { Color = color, Material = st.mat }) + if st.nodes then + cyl(model, q - d * 0.04, q + d * 0.04, dia + 0.05, { Color = st.nodes, Material = Enum.Material.Wood }) + end + -- полоски улучшений на первых коленах + if i <= 2 then + for s = 1, upgradeLevel do + if (s <= 3 and i == 1) or (s > 3 and i == 2) then + local t = 0.25 + ((s - 1) % 3) * 0.22 + local c = p:Lerp(q, t) + cyl(model, c - d * 0.035, c + d * 0.035, dia + 0.045, { Color = C(255, 215, 80), Material = NEON }) + end + end + end + -- пропускные кольца на чётных стыках + if i % 2 == 0 then + local n = V(0, d.Z, -d.Y) -- вниз, перпендикулярно бланку + local ringD = 0.24 - i * 0.017 + cyl(model, q - d * 0.06, q + d * 0.06, dia + 0.05, { Color = st.wrap, Material = wrapMat }) + cyl(model, q, q + n * 0.12, 0.035, { Color = C(200, 200, 205), Material = METAL }) + local c = q + n * (0.12 + ringD / 2) + newPart(model, { + Shape = Enum.PartType.Cylinder, Size = V(0.03, ringD, ringD), + CFrame = CFrame.lookAt(c, c + d) * CFrame.Angles(0, math.rad(90), 0), + Color = C(205, 205, 210), Material = METAL, + }) + end + p = q + end + ball(model, p, 0.09, { Color = st.wrap, Material = wrapMat }) + + local tip = Instance.new("Attachment") + tip.Name = "Tip" + tip.Position = p + tip.Parent = handle + local lineStart = Instance.new("Attachment") + lineStart.Name = "LineStart" + lineStart.Position = V(0, -0.68, -1.2) + lineStart.Parent = handle + local line = Instance.new("Beam") + line.Attachment0 = lineStart + line.Attachment1 = tip + line.Width0 = 0.025 + line.Width1 = 0.02 + line.FaceCamera = true + line.Color = ColorSequence.new(C(245, 245, 245)) + line.Parent = handle + + if upgradeLevel >= 3 or st.sparkle then + sparkles(lastSeg, st.sparkle or st.wrap, 6) + end + return finish(model, handle, anchored) +end + +---------------------------------------------------------------- сумки на спину +-- Корень "Root" у спины; +Z = от спины назад. + +local BAG_SIZES = { + Pouch = V(1.3, 1.3, 0.6), + Satchel = V(1.5, 1.5, 0.7), + Backpack = V(1.7, 2.0, 0.9), + BigNet = V(1.9, 2.2, 1.0), + Chest = V(2.0, 1.6, 1.2), + Magic = V(1.8, 2.2, 1.1), +} + +function M.buildBag(bagId, anchored) + local bag = Config.Find(Config.Bags, bagId) or Config.Bags[1] + local s = BAG_SIZES[bag.id] or BAG_SIZES.Pouch + local model = Instance.new("Model") + model.Name = "BackBag" + local root = newPart(model, { Name = "Root", Size = V(0.2, 0.2, 0.2), CFrame = CFrame.new(), Transparency = 1 }) + + if bag.id == "Chest" then + block(model, V(s.X, s.Y * 0.7, s.Z), CFrame.new(0, -s.Y * 0.15, s.Z / 2), { Color = bag.color, Material = Enum.Material.WoodPlanks }) + oval(model, V(s.X, s.Y * 0.6, s.Z), CFrame.new(0, s.Y * 0.2, s.Z / 2), { Color = darken(bag.color, 0.15), Material = Enum.Material.WoodPlanks }) + for _, x in ipairs({ -s.X * 0.35, s.X * 0.35 }) do + block(model, V(0.15, s.Y * 1.02, s.Z + 0.06), CFrame.new(x, 0, s.Z / 2), { Color = C(200, 170, 70), Material = METAL }) + end + block(model, V(0.35, 0.4, 0.1), CFrame.new(0, 0, s.Z + 0.05), { Color = C(230, 190, 70), Material = METAL }) + sparkles(root, C(255, 220, 90), 3) + return finish(model, root, anchored) + end + + oval(model, V(s.X, s.Y, s.Z * 1.1), CFrame.new(0, 0, s.Z / 2), { Color = bag.color, Material = Enum.Material.Fabric }) + block(model, V(s.X * 0.95, s.Y * 0.3, s.Z * 0.9), CFrame.new(0, s.Y * 0.33, s.Z / 2), { Color = darken(bag.color, 0.25), Material = Enum.Material.Fabric }) + block(model, V(s.X * 0.6, s.Y * 0.32, 0.16), CFrame.new(0, -s.Y * 0.15, s.Z + 0.04), { Color = darken(bag.color, 0.12), Material = Enum.Material.Fabric }) + block(model, V(0.26, 0.2, 0.06), CFrame.new(0, s.Y * 0.2, s.Z * 0.98), { Color = C(230, 190, 70), Material = METAL }) + for _, x in ipairs({ -1, 1 }) do + block(model, V(0.16, s.Y * 0.9, 0.06), CFrame.new(x * s.X * 0.3, 0, s.Z * 0.95), { Color = darken(bag.color, 0.35), Material = Enum.Material.Fabric }) + end + if bag.id == "Backpack" or bag.id == "BigNet" then + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(s.X + 0.1, 0.55, 0.55), CFrame = CFrame.new(0, s.Y / 2 + 0.15, s.Z / 2), Color = C(70, 120, 70), Material = Enum.Material.Fabric }) + end + if bag.id == "BigNet" then + oval(model, V(0.15, 0.7, 0.5), CFrame.new(0.4, s.Y / 2 + 0.5, s.Z * 0.6) * CFrame.Angles(0, 0, math.rad(15)), { Color = C(255, 190, 50) }) + end + if bag.id == "Magic" then + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.05, 0.7, 0.7), CFrame = CFrame.new(0, -0.1, s.Z + 0.06) * CFrame.Angles(0, math.rad(90), 0), Color = C(255, 150, 255), Material = NEON }) + sparkles(root, C(220, 150, 255), 5) + end + return finish(model, root, anchored) +end + +---------------------------------------------------------------- рыба +-- Голова смотрит в +X, спина в +Y, бок к зрителю в +Z. + +local function seededRng(id) + local n = 0 + for i = 1, #id do + n += string.byte(id, i) * i + end + return Random.new(n) +end + +-- полуширина эллипсоида (L,H,W) в точке x,y +local function halfWidth(L, H, W, x, y) + local k = 1 - (2 * x / L) ^ 2 - (2 * y / H) ^ 2 + return k > 0 and (W / 2) * math.sqrt(k) or 0 +end + +local function addEyes(model, x, y, zHalf, size) + for _, sgn in ipairs({ -1, 1 }) do + ball(model, V(x, y, sgn * zHalf), size, { Color = C(250, 250, 250) }) + ball(model, V(x + size * 0.12, y, sgn * (zHalf + size * 0.3)), size * 0.55, { Color = C(15, 15, 20) }) + end +end + +function M.buildFish(fishId, mutationId, scale, anchored) + local fish = Config.FindFish(fishId) or Config.Zones.World1.fish[1] + local s = (scale or 1) * fish.size + local c1, c2 = fish.color, fish.color2 or darken(fish.color, 0.3) + local mat = SP + local glow = fish.glow + if mutationId == "Golden" then + c1, c2, mat = C(255, 205, 60), C(230, 150, 30), METAL + elseif mutationId == "Shiny" then + c1, c2, glow = lighten(c1, 0.35), lighten(c2, 0.35), true + elseif mutationId == "Rainbow" then + c1, c2, glow = C(255, 120, 220), C(90, 230, 255), true + end + if fish.glass and not mutationId then + mat = GLASS + end + local finMat = glow and NEON or mat + local rng = seededRng(fish.id) + local model = Instance.new("Model") + model.Name = fish.name + local shape = fish.shape or "classic" + local root + + if shape == "flat" then + -- камбала: плоская, «верх» смотрит на зрителя (+Z) + root = oval(model, V(2 * s, 1.3 * s, 0.22 * s), CFrame.new(), { Name = "Body", Color = c1, Material = mat }) + oval(model, V(2.2 * s, 1.5 * s, 0.08 * s), CFrame.new(0, 0, -0.02 * s), { Color = darken(c1, 0.2), Material = finMat }) + oval(model, V(0.45 * s, 0.6 * s, 0.06 * s), CFrame.new(-1.15 * s, 0, 0), { Color = darken(c1, 0.2), Material = finMat }) + for i = 1, fish.spots or 0 do + local x, y = rng:NextNumber(-0.7, 0.7) * s, rng:NextNumber(-0.45, 0.45) * s + oval(model, V(0.14 * s, 0.14 * s, 0.05 * s), CFrame.new(x, y, 0.1 * s), { Color = c2 }) + end + ball(model, V(0.62 * s, 0.14 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) }) + ball(model, V(0.5 * s, -0.05 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) }) + ball(model, V(0.62 * s, 0.14 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) }) + ball(model, V(0.5 * s, -0.05 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) }) + return finish(model, root, anchored) + end + + if shape == "ray" then + root = block(model, V(1.5 * s, 1.5 * s, 0.14 * s), CFrame.Angles(0, 0, math.rad(45)), { Name = "Body", Color = c1, Material = mat }) + oval(model, V(1.4 * s, 0.9 * s, 0.32 * s), CFrame.new(0.1 * s, 0, 0.02 * s), { Color = c1, Material = mat }) + cyl(model, V(-0.9 * s, 0, 0), V(-2.4 * s, 0.1 * s, 0), 0.08 * s, { Color = darken(c1, 0.2), Material = mat }) + for i = 1, fish.spots or 0 do + ball(model, V(rng:NextNumber(-0.6, 0.6) * s, rng:NextNumber(-0.6, 0.6) * s, 0.12 * s), 0.1 * s, { Color = c2 }) + end + ball(model, V(0.45 * s, 0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) }) + ball(model, V(0.45 * s, -0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) }) + return finish(model, root, anchored) + end + + if shape == "eel" then + local n, L = 10, 3.4 * s + local seg = L / n + local prev + for i = 0, n - 1 do + local x = L / 2 - i * seg + local y = math.sin(i * 0.8) * 0.22 * s + local d = (0.5 - i * 0.035) * s + local part = oval(model, V(seg * 1.7, d, d * 0.85), CFrame.new(x, y, 0), { Color = c1, Material = mat, Name = i == 0 and "Body" or "Seg" }) + if i == 0 then + root = part + end + if i > 0 then + oval(model, V(seg * 1.4, d * 0.5, d * 0.2), CFrame.new(x, y + d * 0.45, 0), { Color = c2, Material = finMat }) + if fish.spikes and i % 2 == 0 then + block(model, V(0.06 * s, d * 0.6, 0.06 * s), CFrame.new(x, y + d * 0.75, 0), { Color = c2, Material = NEON }) + end + end + if fish.spots and i > 0 and i % 2 == 1 then + ball(model, V(x, y + d * 0.1, d * 0.4), d * 0.25, { Color = c2 }) + end + prev = part + end + addEyes(model, L / 2 + seg * 0.3, 0.12 * s, 0.17 * s, 0.13 * s) + oval(model, V(0.1 * s, 0.08 * s, 0.3 * s), CFrame.new(L / 2 + seg * 0.75, -0.08 * s, 0), { Color = C(30, 20, 20) }) + return finish(model, root, anchored) + end + + if shape == "jelly" then + root = oval(model, V(1.6 * s, 1.1 * s, 1.6 * s), CFrame.new(0, 0.35 * s, 0), { Name = "Body", Color = c1, Material = GLASS, Transparency = 0.2 }) + oval(model, V(0.8 * s, 0.5 * s, 0.8 * s), CFrame.new(0, 0.3 * s, 0), { Color = c2, Material = NEON }) + oval(model, V(1.75 * s, 0.14 * s, 1.75 * s), CFrame.new(0, -0.15 * s, 0), { Color = c2, Material = finMat }) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + local base = V(math.cos(a) * 0.6 * s, -0.15 * s, math.sin(a) * 0.6 * s) + local p1 = base + V(math.sin(i) * 0.15 * s, -0.7 * s, 0) + local p2 = p1 + V(-math.sin(i) * 0.2 * s, -0.7 * s, math.cos(i) * 0.1 * s) + cyl(model, base, p1, 0.07 * s, { Color = c2, Material = NEON }) + cyl(model, p1, p2, 0.05 * s, { Color = c1, Material = NEON }) + end + return finish(model, root, anchored) + end + + -- тело-эллипсоид для остальных форм + local L, H, W = 2 * s, 0.9 * s, 0.45 * s + if shape == "long" or shape == "sturgeon" then + L, H, W = 2.6 * s, 0.6 * s, 0.5 * s + elseif shape == "tall" then + L, H, W = 1.7 * s, 1.25 * s, 0.38 * s + elseif shape == "shark" then + L, H, W = 3 * s, 0.75 * s, 0.7 * s + elseif shape == "sword" then + L, H, W = 2.4 * s, 0.75 * s, 0.5 * s + elseif shape == "puffer" then + L, H, W = 1.4 * s, 1.3 * s, 1.3 * s + elseif shape == "angler" then + L, H, W = 1.6 * s, 1.3 * s, 1.1 * s + end + + root = oval(model, V(L, H, W), CFrame.new(), { Name = "Body", Color = c1, Material = mat }) + if shape ~= "puffer" and shape ~= "angler" then + oval(model, V(L * 0.82, H * 0.55, W * 1.03), CFrame.new(L * 0.03, -H * 0.2, 0), { Color = lighten(c1, 0.45), Material = mat }) + end + + -- хвост + if shape == "shark" then + oval(model, V(L * 0.25, H * 1.0, W * 0.12), CFrame.new(-L * 0.56, H * 0.32, 0) * CFrame.Angles(0, 0, math.rad(-35)), { Color = c1, Material = mat }) + oval(model, V(L * 0.17, H * 0.6, W * 0.12), CFrame.new(-L * 0.54, -H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(35)), { Color = c1, Material = mat }) + else + local th = fish.bigTail and 0.95 or 0.62 + oval(model, V(L * 0.22, H * 0.36, W * 0.5), CFrame.new(-L * 0.44, 0, 0), { Color = c1, Material = mat }) + for _, sgn in ipairs({ 1, -1 }) do + oval(model, V(L * 0.28, H * th, W * 0.14), CFrame.new(-L * 0.58, sgn * H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(-sgn * 32)), { Color = c2, Material = finMat }) + end + end + + -- спинной плавник + if shape == "shark" then + wedge(model, V(W * 0.14, H * 0.95, L * 0.2), CFrame.new(-L * 0.02, H * 0.78, 0) * CFrame.Angles(0, math.rad(-90), 0), { Color = c1, Material = mat }) + elseif shape == "sword" then + oval(model, V(L * 0.5, H * 1.2, W * 0.1), CFrame.new(L * 0.05, H * 0.65, 0), { Color = c2, Material = finMat }) + elseif shape ~= "puffer" then + local big = fish.bigFins and 1.8 or 1 + oval(model, V(L * 0.42, H * 0.45 * big, W * 0.12), CFrame.new(-L * 0.06, H * 0.4 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat }) + oval(model, V(L * 0.22, H * 0.3 * big, W * 0.1), CFrame.new(-L * 0.2, -H * 0.42 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat }) + end + if fish.spikes and shape ~= "puffer" then + for i = 0, 4 do + local x = -L * 0.2 + i * L * 0.08 + block(model, V(0.05 * s, H * 0.3, 0.05 * s), CFrame.new(x, H * 0.55, 0) * CFrame.Angles(0, 0, math.rad(-15)), { Color = darken(c2, 0.3) }) + end + end + -- грудные плавники + for _, sgn in ipairs({ -1, 1 }) do + oval(model, V(L * 0.2, H * 0.14, W * 0.06), CFrame.new(L * 0.12, -H * 0.15, sgn * W * 0.48) * CFrame.Angles(0, math.rad(sgn * 25), math.rad(-20)), { Color = c2, Material = finMat }) + end + + -- узоры + if fish.stripes then + for i = 1, fish.stripes do + local x = -L * 0.3 + (i - 0.5) * (L * 0.6 / fish.stripes) + local hh = (H / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2)) + local hw = (W / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2)) + oval(model, V(L * 0.06, hh * 2.04, hw * 2.08), CFrame.new(x, 0, 0), { Color = c2, Material = mat }) + end + end + if fish.spots then + for i = 1, fish.spots do + local x = rng:NextNumber(-0.35, 0.3) * L + local y = rng:NextNumber(-0.1, 0.35) * H + local z = halfWidth(L, H, W, x, y) + if z > 0 then + local sgn = (i % 2 == 0) and 1 or -1 + ball(model, V(x, y, sgn * z * 0.96), 0.13 * s, { Color = c2 }) + end + end + end + + -- глаза и рот + local ex, ey = L * 0.32, H * 0.12 + local ez = halfWidth(L, H, W, ex, ey) + local eyeSize = (shape == "puffer") and H * 0.3 or ((shape == "angler") and H * 0.14 or math.max(0.12 * s, H * 0.22)) + addEyes(model, ex, ey, ez * 0.92, eyeSize) + if shape == "angler" then + oval(model, V(L * 0.12, H * 0.5, W * 0.85), CFrame.new(L * 0.46, -H * 0.12, 0), { Color = C(25, 15, 20) }) + for i = -2, 2 do + wedge(model, V(0.05 * s, 0.16 * s, 0.06 * s), CFrame.new(L * 0.5, H * 0.08, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) }) + end + local a, b, c = V(L * 0.3, H * 0.48, 0), V(L * 0.55, H * 0.95, 0), V(L * 0.78, H * 0.85, 0) + cyl(model, a, b, 0.05 * s, { Color = c1 }) + cyl(model, b, c, 0.045 * s, { Color = c1 }) + local lure = ball(model, c, 0.26 * s, { Color = c2, Material = NEON }) + local light = Instance.new("PointLight") + light.Color = c2 + light.Range = 8 + light.Brightness = 2 + light.Parent = lure + else + oval(model, V(L * 0.05, H * 0.12, W * 0.35), CFrame.new(L * 0.49, -H * 0.08, 0), { Color = C(40, 25, 25) }) + end + if fish.teeth then + for i = -1, 1 do + wedge(model, V(0.05 * s, 0.12 * s, 0.05 * s), CFrame.new(L * 0.5, -H * 0.02, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) }) + end + end + if fish.whiskers then + for _, sgn in ipairs({ -1, 1 }) do + cyl(model, V(L * 0.46, -H * 0.12, sgn * W * 0.15), V(L * 0.62, -H * 0.42, sgn * W * 0.45), 0.04 * s, { Color = c2 }) + end + end + if shape == "sword" then + cyl(model, V(L * 0.45, 0, 0), V(L * 0.45 + L * 0.7, H * 0.03, 0), H * 0.08, { Color = c2, Material = mat }) + elseif shape == "sturgeon" then + oval(model, V(L * 0.22, H * 0.45, W * 0.45), CFrame.new(L * 0.52, -H * 0.08, 0), { Color = c1, Material = mat }) + for i = 0, 6 do + block(model, V(0.16 * s, 0.16 * s, 0.1 * s), CFrame.new(L * 0.3 - i * L * 0.11, H * 0.47, 0) * CFrame.Angles(0, 0, math.rad(45)), { Color = c2, Material = finMat }) + end + for _, sgn in ipairs({ -1, 1 }) do + cyl(model, V(L * 0.55, -H * 0.25, sgn * W * 0.1), V(L * 0.6, -H * 0.55, sgn * W * 0.15), 0.035 * s, { Color = c2 }) + end + elseif shape == "puffer" then + for i = 1, 30 do + local y = 1 - (i - 0.5) / 30 * 2 + local r = math.sqrt(1 - y * y) + local th = i * 2.4 + local dir = V(math.cos(th) * r, y, math.sin(th) * r) + local base = V(dir.X * L / 2, dir.Y * H / 2, dir.Z * W / 2) + cyl(model, base, base + dir * 0.28 * s, 0.05 * s, { Color = darken(c2, 0.1) }) + end + end + if glow then + sparkles(root, c2, 4) + end + return finish(model, root, anchored) +end + +---------------------------------------------------------------- поплавок + +function M.buildBobber() + local model = Instance.new("Model") + model.Name = "Bobber" + local root = newPart(model, { Name = "Root", Shape = Enum.PartType.Ball, Size = V(0.7, 0.7, 0.7), CFrame = CFrame.new(), Color = C(255, 255, 255) }) + newPart(model, { Shape = Enum.PartType.Ball, Size = V(0.72, 0.72, 0.72), CFrame = CFrame.new(0, 0.2, 0), Color = C(230, 40, 40) }) + newPart(model, { Size = V(0.07, 0.6, 0.07), CFrame = CFrame.new(0, 0.75, 0), Color = C(230, 40, 40) }) + finish(model, root, false) + root.Anchored = true + return model +end + +return M +]]> + + + \ No newline at end of file diff --git a/install/3_MapBuilder_ServerScriptService.rbxmx b/install/3_MapBuilder_ServerScriptService.rbxmx new file mode 100644 index 0000000..f2b622d --- /dev/null +++ b/install/3_MapBuilder_ServerScriptService.rbxmx @@ -0,0 +1,1413 @@ + + + +MapBuilder + ServerScriptService +-- Строит лобби и Мир 1 «Тихое озеро» при запуске игры, настраивает свет и воду. +-- Если в Workspace уже есть папка "FishingMap", детали не строятся заново +-- (террейн, свет и точка появления настраиваются всегда). + +local Workspace = game:GetService("Workspace") +local Lighting = game:GetService("Lighting") +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) + +local V = Vector3.new +local rng = Random.new(7) + +---------------------------------------------------------------- свет и атмосфера + +local function ensure(class, parent, props) + local obj = parent:FindFirstChildOfClass(class) or Instance.new(class) + for k, v in pairs(props) do + obj[k] = v + end + obj.Parent = parent + return obj +end + +Lighting.ClockTime = 14.5 +Lighting.Brightness = 2.3 +Lighting.Ambient = Color3.fromRGB(70, 70, 85) +Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) +Lighting.EnvironmentDiffuseScale = 0.6 +Lighting.EnvironmentSpecularScale = 0.8 +ensure("Atmosphere", Lighting, { + Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, + Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), +}) +ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) +ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) +ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) + +---------------------------------------------------------------- вода + +local terrain = Workspace.Terrain +-- низкое отражение, иначе вода «засвечивается» небом и выглядит белой +terrain.WaterColor = Color3.fromRGB(20, 95, 115) +terrain.WaterTransparency = 0.2 +terrain.WaterReflectance = 0.08 +terrain.WaterWaveSize = 0.1 +terrain.WaterWaveSpeed = 8 + +---------------------------------------------------------------- МИР 1: террейн (строится всегда) + +local W = V(0, 0, 1500) -- центр Мира 1 +local GROUND_Y = 4 -- верх земли +local WATER_Y = 0 -- поверхность воды + +-- озеро из нескольких кругов: { x, z, радиус } +local LAKES = Config.Worlds[1].lakes + +terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Grass) +-- холмы по краям +for _, h in ipairs({ { -190, 160, 50 }, { 185, 175, 45 }, { -175, -175, 60 }, { 190, -150, 55 }, { 0, -215, 50 }, { -215, 0, 40 }, { 215, 30, 42 } }) do + terrain:FillBall(W + V(h[1], -14, h[2]), h[3], Enum.Material.Grass) +end +-- порядок важен: песок → выемка → ил → вода +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 11, Enum.Material.Sand) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 7, Enum.Material.Air) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 2, Enum.Material.Air) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) +end +-- дорожка от точки прибытия к причалу и площадка +terrain:FillBlock(CFrame.new(W + V(0, 2, 100)), V(8, 4, 44), Enum.Material.Ground) +terrain:FillCylinder(CFrame.new(W + V(0, 2, 130)), 4, 17, Enum.Material.Cobblestone) + +---------------------------------------------------------------- точка появления в лобби + +local spawn = Workspace:FindFirstChildOfClass("SpawnLocation") +if not spawn then + spawn = Instance.new("SpawnLocation") + spawn.Parent = Workspace +end +spawn.Anchored = true +spawn.Size = V(8, 0.2, 8) +spawn.CFrame = CFrame.new(0, 1.15, 50) +spawn.Transparency = 1 +spawn.Duration = 0 +for _, d in ipairs(spawn:GetChildren()) do + if d:IsA("Decal") or d:IsA("Texture") then + d.Transparency = 1 + end +end + +if Workspace:FindFirstChild("FishingMap") then + return +end + +local map = Instance.new("Folder") +map.Name = "FishingMap" +map.Parent = Workspace +local zonesFolder = Instance.new("Folder") +zonesFolder.Name = "FishingZones" +zonesFolder.Parent = map + +---------------------------------------------------------------- помощники + +local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p +end + +local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) +end + +local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) +end + +local function surfaceText(part, face, text, color, extra) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.RichText = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.4 + t.Text = text + t.Parent = sg + local pad = Instance.new("UIPadding") + pad.PaddingLeft = UDim.new(0.05, 0) + pad.PaddingRight = UDim.new(0.05, 0) + pad.PaddingTop = UDim.new(0.06, 0) + pad.PaddingBottom = UDim.new(0.06, 0) + pad.Parent = t + for k, v in pairs(extra or {}) do + t[k] = v + end + return t +end + +local function billboard(target, text, color, offsetY, width) + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(width or 300, 64) + bb.StudsOffset = V(0, offsetY or 5, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = target + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.15 + t.Text = text + t.Parent = bb + return bb +end + +local function prompt(target, actionText, objectText, action, dist) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = dist or 13 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp +end + +local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) +end + +local function groundY(x, z) + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Include + params.FilterDescendantsInstances = { terrain } + params.IgnoreWater = true + local hit = Workspace:Raycast(V(x, 150, z), V(0, -300, 0), params) + return hit and hit.Position.Y or GROUND_Y, hit and hit.Material +end + +local function lamp(pos, color) + vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) }) + P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local light = Instance.new("PointLight") + light.Range = 16 + light.Brightness = 1.2 + light.Color = color or Color3.fromRGB(255, 210, 150) + light.Parent = bulb +end + +local function tree(pos, kind) + if kind == "pine" then + local h = rng:NextNumber(8, 12) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass }) + end + else + local birch = kind == "birch" + local h = rng:NextNumber(7, 10) + vcyl(pos + V(0, h / 2, 0), h, 1.5, { + Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45), + Material = Enum.Material.Wood, + }) + local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60) + local s = rng:NextNumber(9, 12) + ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass }) + end +end + +local function bush(pos) + local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55) + for i = 1, 3 do + ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass }) + end + if rng:NextNumber() < 0.5 then + for i = 1, 4 do + ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)], + CanCollide = false, + }) + end + end +end + +local function bench(cf) + local seat = Instance.new("Seat") + seat.Anchored = true + seat.Size = V(5, 0.4, 1.6) + seat.CFrame = cf * CFrame.new(0, 1.6, 0) + seat.Material = Enum.Material.WoodPlanks + seat.Color = Color3.fromRGB(150, 105, 65) + seat.TopSurface = Enum.SurfaceType.Smooth + seat.Parent = map + for _, x in ipairs({ -2.1, 2.1 }) do + P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal }) + end + P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) }) +end + +local function npc(name, cf, colors, action, actionText) + local ok, rig = pcall(function() + local d = Instance.new("HumanoidDescription") + d.HeadColor = colors.skin + d.LeftArmColor = colors.skin + d.RightArmColor = colors.skin + d.TorsoColor = colors.shirt + d.LeftLegColor = colors.pants + d.RightLegColor = colors.pants + return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15) + end) + if not ok or not rig then + warn("NPC не создан: " .. tostring(rig)) + return nil + end + rig.Name = name + local hum = rig:FindFirstChildOfClass("Humanoid") + hum.DisplayName = name + hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff + hum.NameDisplayDistance = 60 + local root = rig:FindFirstChild("HumanoidRootPart") + root.Anchored = true + rig:PivotTo(cf) + rig.Parent = map + + local head = rig:FindFirstChild("Head") + if head then + if not head:FindFirstChildOfClass("Decal") then + local face = Instance.new("Decal") + face.Name = "face" + face.Texture = "rbxasset://textures/face.png" + face.Parent = head + end + -- панама рыбака + local function hatPart(size, offset, shape) + local p = Instance.new("Part") + p.Shape = shape + p.Size = size + p.CanCollide = false + p.Massless = true + p.Color = colors.hat + p.Material = Enum.Material.Fabric + p.CFrame = head.CFrame * offset + local w = Instance.new("Weld") + w.Part0 = head + w.Part1 = p + w.C0 = head.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Parent = rig + end + hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + end + if action then + prompt(root, actionText, name, action, 14) + end + return rig +end + +-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей +local function stall(cf, opt) + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local wall, dark = opt.wall, opt.wall:Lerp(Color3.new(0, 0, 0), 0.3) + + P({ Size = V(24, 1, 17), CFrame = at(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 80) }) + P({ Size = V(24, 13, 1), CFrame = at(0, 7.5, 8), Material = Enum.Material.WoodPlanks, Color = wall }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 13, 17), CFrame = at(s * 11.5, 7.5, 0), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(1.5, 14.5, 1.5), CFrame = at(s * 11.6, 7.25, -8.3), Material = Enum.Material.Wood, Color = dark }) + end + P({ Size = V(26, 1, 19), CFrame = at(0, 14.5, 0), Material = Enum.Material.WoodPlanks, Color = dark }) + -- полосатый навес + for i = 0, 7 do + P({ + Size = V(3, 0.35, 6), + CFrame = at(-10.5 + i * 3, 13.1, -10.6) * CFrame.Angles(math.rad(-22), 0, 0), + Material = Enum.Material.Fabric, + Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, + }) + ball(at(-10.5 + i * 3, 11.9, -13.3).Position, 0.9, { Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, Material = Enum.Material.Fabric }) + end + -- прилавок + local counter = P({ Size = V(18, 4, 3), CFrame = at(0, 3, -4), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(19, 0.5, 3.8), CFrame = at(0, 5.25, -4), Material = Enum.Material.Wood, Color = dark }) + -- вывеска + local board = P({ Size = V(20, 4.5, 0.6), CFrame = at(0, 17.6, -9.2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 45, 30) }) + P({ Size = V(20.8, 5.3, 0.3), CFrame = at(0, 17.6, -8.9), Material = Enum.Material.Neon, Color = opt.glow }) + for _, x in ipairs({ -8, 8 }) do + P({ Size = V(0.6, 3, 0.6), CFrame = at(x, 15.5, -9.2), Material = Enum.Material.Wood, Color = dark }) + end + surfaceText(board, Enum.NormalId.Front, opt.title, opt.titleColor) + -- фонарики + for _, x in ipairs({ -9.5, 9.5 }) do + local l = P({ Size = V(0.8, 1.1, 0.8), CFrame = at(x, 11.2, -9.4), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 210, 140) }) + local light = Instance.new("PointLight") + light.Range = 14 + light.Brightness = 1 + light.Color = Color3.fromRGB(255, 210, 150) + light.Parent = l + end + -- бочки по бокам + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * 14.5, 2.6, -5).Position, 3.2, 2.6, { Color = Color3.fromRGB(130, 85, 50), Material = Enum.Material.Wood }) + vcyl(at(s * 14.5, 2.6, -5).Position, 0.3, 2.75, { Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal }) + end + + prompt(counter, opt.promptText, opt.promptObject, opt.action, 14) + if opt.npcName then + npc(opt.npcName, at(0, 4, 1.5), opt.npcColors) + end + if opt.decor then + opt.decor(at) + end + return counter +end + +local function portal(baseCF, title, color, worldId, locked) + local center = baseCF * CFrame.new(0, 10, 0) + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ + Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), + Material = Enum.Material.Slate, + Color = Color3.fromRGB(80, 85, 100), + }) + if i % 2 == 0 then + P({ + Size = V(0.6, 0.6, 1.9), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), + Material = Enum.Material.Neon, + Color = color, + }) + end + end + local disc = P({ + Name = "Portal_" .. worldId, + Shape = Enum.PartType.Cylinder, + Size = V(0.3, 2 * R - 1, 2 * R - 1), + CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, + Color = color, + Transparency = 0.3, + CanCollide = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc +end + +local function banner(pos, color, icon, text) + local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби + vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false }) + P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + local label = icon .. "\n" .. text + surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1)) +end + +local function arch(cf, span, height, title, color) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) }) + end + local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) }) + P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color }) + surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120)) + surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120)) +end + +---------------------------------------------------------------- ЛОББИ + +local FLOOR = 1 -- верх пола лобби + +P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) }) +P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) }) +P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) }) +-- дорожки-лучи к лавкам и порталам +for _, a in ipairs({ 0, 90, 180, 270 }) do + local r = math.rad(a) + P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) }) +end + +marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 50)) + +-- фонтан со статуей золотой рыбы +vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) +vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) +vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) }) +local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) +vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) +do + local statue = Models.buildFish("Gold", "Golden", 3.2, true) + statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40))) + statue.Parent = map + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 12 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.6, 0) + sp.Lifetime = NumberRange.new(1, 1.5) + sp.SpreadAngle = Vector2.new(180, 180) + sp.Speed = NumberRange.new(1, 2) + sp.Parent = statue.PrimaryPart + -- струи воды + local att = Instance.new("Attachment") + att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх + att.Orientation = V(0, 0, -90) -- направить струю вверх + att.Parent = bowl + local water = Instance.new("ParticleEmitter") + water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255)) + water.Transparency = NumberSequence.new(0.3, 1) + water.Size = NumberSequence.new(0.6, 1.2) + water.Rate = 60 + water.Lifetime = NumberRange.new(1.2, 1.5) + water.Speed = NumberRange.new(10, 12) + water.SpreadAngle = Vector2.new(25, 25) + water.Acceleration = V(0, -25, 0) + water.Parent = att +end +for i = 0, 5 do + local a = math.rad(i * 60 + 30) + bench(CFrame.lookAt(V(math.cos(a) * 17, FLOOR, math.sin(a) * 17), V(math.cos(a) * 30, FLOOR, math.sin(a) * 30))) +end + +-- фонари по кругу +for i = 0, 7 do + local a = math.rad(i * 45 + 22.5) + lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) +end + +-- клумбы с деревьями +for _, deg in ipairs({ 225, 315 }) do + local a = math.rad(deg) + local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58) + vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) }) + vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) }) + tree(p + V(0, 2, 0), "round") + for j = 1, 5 do + local b = rng:NextNumber(0, math.pi * 2) + ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] }) + end +end + +-- баннеры +local bannerData = { + { 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" }, + { 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" }, + { 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" }, + { 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" }, + { 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" }, + { 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" }, +} +for _, b in ipairs(bannerData) do + local a = math.rad(b[1]) + banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4]) +end + +-- живая изгородь по краю (с проходами) +for deg = 0, 359, 7 do + local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) + if not skip then + local a = math.rad(deg) + local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82) + P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) }) + end +end + +-- магазин (запад) и скупка (восток) +stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ", + titleColor = Color3.fromRGB(255, 230, 120), + wall = Color3.fromRGB(185, 130, 85), + stripeA = Color3.fromRGB(215, 55, 55), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(255, 170, 60), + action = "Shop", + promptText = "Открыть магазин", + promptObject = "Магазин", + npcName = "Продавец Михалыч", + npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) }, + decor = function(at) + -- витрина удочек на задней стене + for i, rod in ipairs(Config.Rods) do + local x = -8 + (i - 1) * 4 + local m = Models.buildRod(rod.id, 0, true) + m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0)) + m.Parent = map + local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) }) + surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180)) + end + end, +}) + +stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "💰 СКУПКА РЫБЫ", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(110, 150, 175), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Зина", + npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) }, + decor = function(at) + -- лёд с рыбой на прилавке + P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 }) + for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do + local f = Models.buildFish(id, nil, 0.9, true) + f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90))) + f.Parent = map + end + -- весы + P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) }) + -- ящики с уловом + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true) + f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0)) + f.Parent = map + end + end, +}) + +-- порталы во все миры и арка с названием +local portalCF = CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)) +arch(portalCF, 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) +for i, w in ipairs(Config.Worlds) do + local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") + portal(portalCF * CFrame.new(-27 + (i - 1) * 18, 0, 0), title, w.color, w.id, w.soon) +end + +-- невидимая стена по кругу: из лобби не уйти +for deg = 0, 359, 5 do + local a = math.rad(deg) + local p = V(math.cos(a) * 86, 30, math.sin(a) * 86) + P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false }) +end + +-- донат-лавки +stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "💎 ПРЕМИУМ", + titleColor = Color3.fromRGB(255, 220, 120), + wall = Color3.fromRGB(120, 70, 170), + stripeA = Color3.fromRGB(255, 200, 60), + stripeB = Color3.fromRGB(150, 80, 210), + glow = Color3.fromRGB(255, 200, 60), + action = "RobuxPasses", + promptText = "Открыть", + promptObject = "Премиум-пропуска", + npcName = "Барон Злотов", + npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) }, + decor = function(at) + -- сундук с самоцветами + P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) }) + P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do + P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c }) + end + P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) }) + end, +}) +stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "🪙 СОКРОВИЩНИЦА", + titleColor = Color3.fromRGB(255, 235, 140), + wall = Color3.fromRGB(200, 160, 70), + stripeA = Color3.fromRGB(230, 180, 40), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(255, 220, 90), + action = "RobuxProducts", + promptText = "Открыть", + promptObject = "Наборы монет", + npcName = "Купчиха Злата", + npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) }, + decor = function(at) + -- горки монет + for i = 0, 4 do + for j = 0, 3 - (i % 3) do + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) }) + end + end + for _, s in ipairs({ -1, 1 }) do + ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric }) + ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal }) + end + end, +}) + +-- сундук с ежедневной наградой +do + local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50)) + local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) }) + for _, x in ipairs({ -1.8, 1.8 }) do + P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + end + P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) }) + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 8 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.5, 0) + sp.Parent = base + billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260) + prompt(base, "Забрать", "Сундук", "Daily", 12) +end + +-- табличка «Как играть» +do + local pos = V(-14, FLOOR, 34) + local cf = CFrame.lookAt(pos, V(0, FLOOR, 50)) + for _, x in ipairs({ -6.5, 6.5 }) do + P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + surfaceText(board, Enum.NormalId.Front, + "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, клик у воды\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", + Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) +end + +---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО (детали) + +local function inLake(x, z, extra) + for _, l in ipairs(LAKES) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then + return true + end + end + return false +end + +-- прибытие +local arrive = W + V(0, GROUND_Y, 128) +marker("World1Spawn", CFrame.lookAt(arrive + V(0, 1, 0), arrive + V(0, 1, -10))) +arch(CFrame.new(W + V(0, GROUND_Y, 112)), 14, 11, "🌊 ТИХОЕ ОЗЕРО", Color3.fromRGB(80, 200, 255)) +portal(CFrame.lookAt(W + V(-26, GROUND_Y, 140), arrive), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") +stall(CFrame.lookAt(W + V(30, GROUND_Y, 140), arrive), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(150, 115, 80), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Гриша", + npcColors = { skin = Color3.fromRGB(200, 150, 110), shirt = Color3.fromRGB(70, 130, 80), pants = Color3.fromRGB(60, 50, 40), hat = Color3.fromRGB(200, 170, 110) }, +}) + +-- доска «Кто водится в озере» +do + local pos = W + V(-16, GROUND_Y, 104) + local cf = CFrame.lookAt(pos, W + V(0, GROUND_Y, 120)) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + local lines = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } + for _, f in ipairs(Config.Zones.World1.fish) do + local r = Config.Rarities[f.rarity] + table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) + end + surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) +end + +-- костёр с брёвнами +do + local c = W + V(14, GROUND_Y, 118) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local fireBase = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = fireBase + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = fireBase + for _, a in ipairs({ 0, 2.1, 4.2 }) do + local p = c + V(math.cos(a) * 6, 0.6, math.sin(a) * 6) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 1.4, 1.4), CFrame = CFrame.lookAt(p, c) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(115, 80, 50) }) + end +end + +-- дед-рыбак с подсказками +npc("Дед Петрович", CFrame.lookAt(W + V(-7, GROUND_Y + 3, 80), W + V(0, GROUND_Y + 3, 95)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(110, 120, 80), pants = Color3.fromRGB(70, 60, 45), hat = Color3.fromRGB(90, 110, 60), +}, "Talk", "Поговорить") + +-- домик рыбака +do + local cf = CFrame.lookAt(W + V(-34, GROUND_Y, 100), W + V(0, GROUND_Y, 100)) + local logC = Color3.fromRGB(130, 90, 55) + P({ Size = V(14, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(110, 80, 50) }) + P({ Size = V(14, 8, 1), CFrame = cf * CFrame.new(0, 5, 5.5), Material = Enum.Material.Wood, Color = logC }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 8, 12), CFrame = cf * CFrame.new(s * 6.5, 5, 0), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(5, 8, 1), CFrame = cf * CFrame.new(s * 4.5, 5, -5.5), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(16, 1, 8.8), CFrame = cf * CFrame.new(0, 11.2, s * 3.4) * CFrame.Angles(math.rad(-s * 38), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 60, 45) }) + end + P({ Size = V(4, 2, 1), CFrame = cf * CFrame.new(0, 8, -5.5), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(2.2, 2, 0.3), CFrame = cf * CFrame.new(-4.5, 5.5, -6.05), Material = Enum.Material.Glass, Color = Color3.fromRGB(255, 225, 150), Transparency = 0.2 }) + P({ Size = V(14, 3, 1), CFrame = cf * CFrame.new(0, 10.5, 5.5), Material = Enum.Material.Wood, Color = logC }) +end + +-- причалы +local function pier(center, size) + P({ Size = size, Position = center, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local alongZ = size.Z > size.X + local len = alongZ and size.Z or size.X + local wid = alongZ and size.X or size.Z + for d = -len / 2 + 1, len / 2 - 1, 6 do + for _, s in ipairs({ -1, 1 }) do + local off = alongZ and V(s * (wid / 2 - 0.4), 0, d) or V(d, 0, s * (wid / 2 - 0.4)) + vcyl(center + off + V(0, -6, 0), 13, 0.9, { Color = Color3.fromRGB(100, 70, 45), Material = Enum.Material.Wood }) + end + end +end +pier(W + V(0, GROUND_Y + 0.2, 58), V(8, 0.6, 42)) +pier(W + V(-86, GROUND_Y + 0.2, 15), V(34, 0.6, 7)) +pier(W + V(86, GROUND_Y + 0.2, -10), V(34, 0.6, 7)) +lamp(W + V(-3.5, GROUND_Y + 0.5, 40), Color3.fromRGB(255, 220, 160)) +lamp(W + V(-70, GROUND_Y + 0.5, 18), Color3.fromRGB(255, 220, 160)) +lamp(W + V(70, GROUND_Y + 0.5, -13), Color3.fromRGB(255, 220, 160)) + +-- лодка у западного причала +do + local cf = CFrame.new(W + V(-74, WATER_Y + 0.3, 24)) * CFrame.Angles(0, math.rad(15), 0) + local hull = Color3.fromRGB(170, 70, 50) + P({ Size = V(4, 0.5, 9), CFrame = cf, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.4, 1.4, 9), CFrame = cf * CFrame.new(s * 2, 0.7, 0), Material = Enum.Material.Wood, Color = hull }) + P({ Size = V(4.4, 1.4, 0.4), CFrame = cf * CFrame.new(0, 0.7, s * 4.5), Material = Enum.Material.Wood, Color = hull }) + end + P({ Size = V(4, 0.3, 1.2), CFrame = cf * CFrame.new(0, 1, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) +end + +-- кувшинки и камыши +for _, l in ipairs(LAKES) do + for _ = 1, 7 do + local a, d = rng:NextNumber(0, math.pi * 2), rng:NextNumber(6, l[3] - 5) + local x, z = l[1] + math.cos(a) * d, l[2] + math.sin(a) * d + local size = rng:NextNumber(2, 3.5) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.28, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(70, 150, 60), CanCollide = false }) + if rng:NextNumber() < 0.4 then + ball(W + V(x + 0.3, WATER_Y + 0.55, z), 0.7, { Color = Color3.fromRGB(255, 150, 190), CanCollide = false }) + end + end + for _ = 1, 9 do + local a = rng:NextNumber(0, math.pi * 2) + local x, z = l[1] + math.cos(a) * (l[3] + 1.2), l[2] + math.sin(a) * (l[3] + 1.2) + local inOther = false + for _, o in ipairs(LAKES) do + if o ~= l and (V(x, 0, z) - V(o[1], 0, o[2])).Magnitude < o[3] + 1 then + inOther = true + end + end + if not inOther and not (math.abs(x) < 6 and z > 30) then + for _ = 1, 5 do + local h = rng:NextNumber(3, 5) + local p = W + V(x + rng:NextNumber(-1.2, 1.2), WATER_Y + h / 2 - 0.5, z + rng:NextNumber(-1.2, 1.2)) + P({ Size = V(0.18, h, 0.18), Position = p, Color = Color3.fromRGB(85, 130, 50), CanCollide = false }) + P({ Size = V(0.35, 0.9, 0.35), Position = p + V(0, h / 2 - 0.3, 0), Color = Color3.fromRGB(110, 70, 40), CanCollide = false }) + end + end + end +end + +-- деревья, кусты, камни +local function freeSpot(x, z) + if inLake(x, z, 14) then + return false + end + if (V(x, 0, z) - V(0, 0, 128)).Magnitude < 34 then + return false + end + if math.abs(x) < 9 and z > 70 and z < 125 then + return false + end + if (V(x, 0, z) - V(-34, 0, 100)).Magnitude < 14 then + return false + end + return true +end + +local placed = 0 +for _ = 1, 400 do + if placed >= 110 then + break + end + local x, z = rng:NextNumber(-230, 230), rng:NextNumber(-230, 230) + if freeSpot(x, z) then + local y = groundY(W.X + x, W.Z + z) + local roll = rng:NextNumber() + tree(W + V(x, y - 0.5, z), roll < 0.35 and "pine" or (roll < 0.5 and "birch" or "round")) + placed += 1 + end +end +for _ = 1, 60 do + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if freeSpot(x, z) then + bush(W + V(x, groundY(W.X + x, W.Z + z) - 0.6, z)) + end +end +for _, l in ipairs(LAKES) do + for _ = 1, 4 do + local a = rng:NextNumber(0, math.pi * 2) + local x, z = l[1] + math.cos(a) * (l[3] + 8), l[2] + math.sin(a) * (l[3] + 8) + if not inLake(x, z, 3) and not (math.abs(x) < 8 and z > 30) then + local s = rng:NextNumber(2.5, 5) + P({ Size = V(s, s * 0.7, s * 0.9), CFrame = CFrame.new(W + V(x, groundY(W.X + x, W.Z + z), z)) * CFrame.Angles(rng:NextNumber(0, 1), rng:NextNumber(0, 6), rng:NextNumber(0, 1)), Material = Enum.Material.Rock, Color = Color3.fromRGB(125, 125, 130) }) + end + end +end + +-- фонари вдоль дорожки +for _, z in ipairs({ 84, 100 }) do + lamp(W + V(6, GROUND_Y, z)) + lamp(W + V(-6, GROUND_Y, z)) +end + +-- невидимые стены по краю мира +for _, w in ipairs({ + { V(0, 0, 245), V(500, 120, 2) }, + { V(0, 0, -245), V(500, 120, 2) }, + { V(245, 0, 0), V(2, 120, 500) }, + { V(-245, 0, 0), V(2, 120, 500) }, +}) do + P({ Size = w[2], Position = W + w[1] + V(0, 40, 0), Transparency = 1 }) +end + +---------------------------------------------------------------- помощники для новых миров + +local function cylA(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) +end + +local function worldWalls(center) + for _, w in ipairs({ + { V(0, 0, 245), V(500, 160, 2) }, + { V(0, 0, -245), V(500, 160, 2) }, + { V(245, 0, 0), V(2, 160, 500) }, + { V(-245, 0, 0), V(2, 160, 500) }, + }) do + P({ Size = w[2], Position = center + w[1] + V(0, 60, 0), Transparency = 1, CanQuery = false }) + end +end + +local function bestiary(pos, lookAt, worldId, title, titleHex) + local cf = CFrame.lookAt(pos, lookAt) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + local lines = { ("%s"):format(titleHex, title) } + for _, f in ipairs(Config.Zones[worldId].fish) do + local r = Config.Rarities[f.rarity] + table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) + end + surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) +end + +local function campfire(c) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local base = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = base + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = base +end + +local function torch(pos) + cylA(pos, pos + V(0, 5, 0), 0.35, { Color = Color3.fromRGB(170, 130, 70), Material = Enum.Material.Wood }) + local top = P({ Size = V(0.8, 0.8, 0.8), Position = pos + V(0, 5.3, 0), Color = Color3.fromRGB(90, 60, 30), Material = Enum.Material.Wood }) + local fire = Instance.new("Fire") + fire.Size = 3 + fire.Heat = 6 + fire.Parent = top + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 170, 90) + light.Range = 14 + light.Parent = top +end + +---------------------------------------------------------------- МИР 2: ТРОПИЧЕСКИЙ ОСТРОВ + +do + local W2 = Config.Worlds[2].center + local leafColors = { Color3.fromRGB(60, 160, 60), Color3.fromRGB(85, 185, 70) } + + -- море, мелководье уступами, песчаный пляж, зелёный остров, холм + terrain:FillBlock(CFrame.new(W2 + V(0, -34, 0)), V(520, 8, 520), Enum.Material.Sand) + terrain:FillBlock(CFrame.new(W2 + V(0, -15, 0)), V(520, 30, 520), Enum.Material.Water) + terrain:FillCylinder(CFrame.new(W2 + V(0, -17, 0)), 28, 140, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -15, 0)), 32, 118, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -14, 0)), 34, 106, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -13.5, 0)), 35, 88, Enum.Material.Grass) + terrain:FillBall(W2 + V(20, -20, -30), 32, Enum.Material.Grass) + terrain:FillCylinder(CFrame.new(W2 + V(0, 2, 40)), 4, 14, Enum.Material.Sandstone) + + local function palm(pos) + local h = rng:NextNumber(12, 18) + local a = rng:NextNumber(0, math.pi * 2) + local dir = V(math.cos(a), 0, math.sin(a)) + local p = pos + for i = 1, 6 do + local t = i / 6 + local q = pos + V(0, h * t, 0) + dir * (t * t * h * 0.3) + local d = 1.4 - t * 0.45 + cylA(p, q, d, { Color = Color3.fromRGB(150, 115, 70), Material = Enum.Material.Wood }) + ball(q, d, { Color = Color3.fromRGB(130, 100, 60), Material = Enum.Material.Wood }) + p = q + end + for k = 0, 7 do + local b = k / 8 * math.pi * 2 + rng:NextNumber(-0.2, 0.2) + local ld = V(math.cos(b), 0, math.sin(b)) + local mid = p + ld * 3.5 + V(0, 0.8, 0) + local tipP = p + ld * 7 + V(0, -2.2, 0) + for _, seg in ipairs({ { p, mid }, { mid, tipP } }) do + P({ Size = V(2, 0.15, (seg[2] - seg[1]).Magnitude), CFrame = CFrame.lookAt((seg[1] + seg[2]) / 2, seg[2]), Material = Enum.Material.Grass, Color = leafColors[k % 2 + 1], CanCollide = false }) + end + end + for _ = 1, 3 do + ball(p + V(rng:NextNumber(-0.7, 0.7), -0.7, rng:NextNumber(-0.7, 0.7)), 0.9, { Color = Color3.fromRGB(110, 75, 40) }) + end + end + + local function tikiHut(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Size = V(12, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 75) }) + for _, c in ipairs({ { -5, -5 }, { 5, -5 }, { -5, 5 }, { 5, 5 } }) do + vcyl((cf * CFrame.new(c[1], 4.5, c[2])).Position, 8, 0.8, { Color = Color3.fromRGB(200, 175, 100), Material = Enum.Material.Wood }) + end + for i = 0, 4 do + vcyl((cf * CFrame.new(0, 8.8 + i * 1.2, 0)).Position, 1.4, 16 - i * 3.2, { Color = Color3.fromRGB(205, 170, 95), Material = Enum.Material.Grass }) + end + local bar = P({ Size = V(7, 3, 1.5), CFrame = cf * CFrame.new(0, 2.5, -3), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 95, 55) }) + billboard(bar, "🍹", Color3.new(1, 1, 1), 3, 60) + end + + local function umbrella(pos, color) + cylA(pos, pos + V(0, 7, 0), 0.25, { Color = Color3.fromRGB(235, 235, 235), Material = Enum.Material.Metal }) + vcyl(pos + V(0, 7, 0), 0.6, 9, { Color = color, Material = Enum.Material.Fabric }) + vcyl(pos + V(0, 7.5, 0), 0.6, 4.5, { Color = Color3.new(1, 1, 1), Material = Enum.Material.Fabric }) + P({ Size = V(2.2, 0.5, 6), CFrame = CFrame.new(pos + V(3.5, 0.6, 0)) * CFrame.Angles(0, rng:NextNumber(-0.5, 0.5), 0), Color = Color3.fromRGB(245, 245, 240), Material = Enum.Material.Fabric }) + P({ Size = V(2.25, 0.52, 1.2), CFrame = CFrame.new(pos + V(3.5, 0.62, 1.5)), Color = color, Material = Enum.Material.Fabric }) + end + + local coralColors = { Color3.fromRGB(255, 110, 150), Color3.fromRGB(255, 150, 60), Color3.fromRGB(170, 90, 255), Color3.fromRGB(255, 220, 80), Color3.fromRGB(80, 220, 200) } + local function coral(pos) + local c = coralColors[rng:NextInteger(1, #coralColors)] + for _ = 1, rng:NextInteger(3, 5) do + local dir = V(rng:NextNumber(-0.5, 0.5), 1, rng:NextNumber(-0.5, 0.5)).Unit + local h = rng:NextNumber(1.5, 3.5) + cylA(pos, pos + dir * h, 0.45, { Color = c, CanCollide = false }) + ball(pos + dir * h, 0.75, { Color = c:Lerp(Color3.new(1, 1, 1), 0.3), CanCollide = false }) + end + end + + local function starfish(pos) + local c = Color3.fromRGB(255, rng:NextInteger(90, 150), 60) + ball(pos, 0.7, { Color = c, CanCollide = false }) + for k = 0, 4 do + local a = k / 5 * math.pi * 2 + P({ Size = V(0.35, 0.2, 1.1), CFrame = CFrame.new(pos) * CFrame.Angles(0, a, 0) * CFrame.new(0, 0, -0.6), Color = c, CanCollide = false }) + end + end + + local spawn2 = W2 + V(0, 4, 40) + marker("World2Spawn", CFrame.lookAt(spawn2 + V(0, 1, 0), spawn2 + V(0, 1, -10))) + arch(CFrame.new(W2 + V(0, 4, 24)), 14, 11, "🏝 ТРОПИЧЕСКИЙ ОСТРОВ", Color3.fromRGB(255, 190, 70)) + portal(CFrame.lookAt(W2 + V(-32, 4, 60), spawn2), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W2 + V(32, 4, 62), spawn2), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 220), + wall = Color3.fromRGB(200, 170, 110), + stripeA = Color3.fromRGB(40, 180, 170), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(80, 230, 200), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Мигель", + npcColors = { skin = Color3.fromRGB(190, 140, 100), shirt = Color3.fromRGB(240, 120, 60), pants = Color3.fromRGB(240, 230, 200), hat = Color3.fromRGB(230, 210, 150) }, + }) + bestiary(W2 + V(-18, 4, 22), spawn2, "World2", "🐠 КТО ВОДИТСЯ У ОСТРОВА", "#FFD27A") + npc("Капитан Боря", CFrame.lookAt(W2 + V(10, 6, 100), W2 + V(0, 6, 120)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(240, 240, 240), pants = Color3.fromRGB(30, 40, 80), hat = Color3.fromRGB(30, 30, 60), + }, "Talk", "Поговорить") + + pier(W2 + V(0, 3.2, 125), V(8, 0.6, 50)) + pier(W2 + V(125, 3.2, -10), V(50, 0.6, 8)) + for _, z in ipairs({ 105, 125, 145 }) do + torch(W2 + V(4.5, 3.5, z)) + end + for _, x in ipairs({ 110, 140 }) do + torch(W2 + V(x, 3.5, -14.5)) + end + tikiHut(W2 + V(-50, groundY(W2.X - 50, W2.Z - 20), -20), W2) + tikiHut(W2 + V(-20, groundY(W2.X - 20, W2.Z - 65), -65), W2) + campfire(W2 + V(-10, 4, 55)) + for _, deg in ipairs({ 200, 222, 318, 340 }) do + local a = math.rad(deg) + local x, z = math.cos(a) * 99, math.sin(a) * 99 + umbrella(W2 + V(x, groundY(W2.X + x, W2.Z + z), z), coralColors[rng:NextInteger(1, #coralColors)]) + end + + local function free2(x, z) + local r = math.sqrt(x * x + z * z) + if r > 100 then + return false + end + if (V(x, 0, z) - V(0, 0, 45)).Magnitude < 28 then + return false + end + for _, p in ipairs({ { 32, 62 }, { -32, 60 }, { -50, -20 }, { -20, -65 }, { -18, 22 }, { -10, 55 } }) do + if (V(x, 0, z) - V(p[1], 0, p[2])).Magnitude < 16 then + return false + end + end + return true + end + local count = 0 + for _ = 1, 300 do + if count >= 40 then + break + end + local x, z = rng:NextNumber(-100, 100), rng:NextNumber(-100, 100) + if free2(x, z) then + palm(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.5, z)) + count += 1 + end + end + for _ = 1, 35 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(121, 138) + local x, z = math.cos(a) * r, math.sin(a) * r + if not (math.abs(x) < 8 and z > 0) and not (math.abs(z + 10) < 8 and x > 0) then + coral(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.3, z)) + end + end + for _ = 1, 12 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(107, 115) + local x, z = math.cos(a) * r, math.sin(a) * r + starfish(W2 + V(x, groundY(W2.X + x, W2.Z + z) + 0.1, z)) + end + worldWalls(W2) +end + +---------------------------------------------------------------- МИР 3: ЛЕДЯНОЙ ФЬОРД + +do + local W3 = Config.Worlds[3].center + local LAKES3 = Config.Worlds[3].lakes + local HOLES = Config.Worlds[3].holes + + terrain:FillBlock(CFrame.new(W3 + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Snow) + for i = 0, 13 do + local a = i / 14 * math.pi * 2 + local r = rng:NextNumber(215, 235) + local rad = rng:NextNumber(50, 70) + local c = W3 + V(math.cos(a) * r, -15, math.sin(a) * r) + terrain:FillBall(c, rad, Enum.Material.Rock) + terrain:FillBall(c + V(0, rad * 0.35, 0), rad * 0.7, Enum.Material.Snow) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], 16, l[2])), 30, l[3] + 4, Enum.Material.Air) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -19, l[2])), 10, l[3], Enum.Material.Mud) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -1, l[2])), 4, l[3], Enum.Material.Glacier) + end + for _, h in ipairs(HOLES) do + terrain:FillCylinder(CFrame.new(W3 + V(h[1], -1, h[2])), 4, 6, Enum.Material.Water) + end + + local function snowPine(pos) + local h = rng:NextNumber(8, 13) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(90, 62, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + local s = 10 - i * 2.2 + local y = h * 0.4 + i * 2.8 + ball(pos + V(0, y, 0), s, { Color = Color3.fromRGB(35, 85 + i * 8, 60), Material = Enum.Material.Grass }) + ball(pos + V(0, y + s * 0.3, 0), s * 0.75, { Color = Color3.fromRGB(240, 245, 255), Material = Enum.Material.Snow }) + end + end + + local function igloo(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Shape = Enum.PartType.Ball, Size = V(14, 14, 14), CFrame = cf, Material = Enum.Material.Snow, Color = Color3.fromRGB(240, 245, 255) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 5, 5), CFrame = cf * CFrame.new(0, 1.2, -7) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Snow, Color = Color3.fromRGB(235, 240, 250) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 3.6, 3.6), CFrame = cf * CFrame.new(0, 1.2, -9.55) * CFrame.Angles(0, math.rad(90), 0), Color = Color3.fromRGB(20, 25, 35) }) + end + + local function tent(pos, look) + local cf = CFrame.lookAt(pos, look) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.2, 5, 6), CFrame = cf * CFrame.new(s * 1.6, 2.2, 0) * CFrame.Angles(0, 0, math.rad(s * 35)), Material = Enum.Material.Fabric, Color = Color3.fromRGB(230, 110, 40) }) + end + vcyl((cf * CFrame.new(0, 0.9, -4.5)).Position, 1.6, 1.4, { Color = Color3.fromRGB(110, 80, 50), Material = Enum.Material.Wood }) + end + + local function crystal(pos) + for _ = 1, 5 do + local h = rng:NextNumber(3, 8) + P({ + Size = V(1.2, h, 1.2), + CFrame = CFrame.new(pos + V(rng:NextNumber(-2, 2), h / 2 - 0.5, rng:NextNumber(-2, 2))) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 3), rng:NextNumber(-0.4, 0.4)), + Material = Enum.Material.Neon, Color = Color3.fromRGB(140, 230, 255), Transparency = 0.15, + }) + end + end + + local function snowman(pos) + ball(pos + V(0, 2, 0), 4, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 5, 0), 3, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 7.3, 0), 2.2, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + cylA(pos + V(0, 7.3, -1), pos + V(0, 7.2, -2), 0.3, { Color = Color3.fromRGB(255, 130, 30) }) + for _, x in ipairs({ -0.4, 0.4 }) do + ball(pos + V(x, 7.7, -0.95), 0.3, { Color = Color3.fromRGB(20, 20, 20) }) + end + vcyl(pos + V(0, 8.6, 0), 1.2, 1.4, { Color = Color3.fromRGB(30, 30, 35) }) + vcyl(pos + V(0, 8.1, 0), 0.2, 2.2, { Color = Color3.fromRGB(30, 30, 35) }) + end + + -- лунки: льдинки по краю и флажки + for i, h in ipairs(HOLES) do + local c = W3 + V(h[1], 1.2, h[2]) + for k = 0, 7 do + local a = k / 8 * math.pi * 2 + P({ Size = V(1.2, 0.6, 1.2), CFrame = CFrame.new(c + V(math.cos(a) * 6.6, 0, math.sin(a) * 6.6)) * CFrame.Angles(0, a, 0.2), Material = Enum.Material.Ice, Color = Color3.fromRGB(200, 235, 255) }) + end + if i % 3 == 1 then + cylA(c + V(6, -0.2, 6), c + V(6, 4, 6), 0.15, { Color = Color3.fromRGB(80, 60, 40) }) + P({ Size = V(1.4, 0.9, 0.1), Position = c + V(6.75, 3.5, 6), Material = Enum.Material.Fabric, Color = Color3.fromRGB(220, 40, 40) }) + end + if i % 4 == 0 then + tent(c + V(-9, -0.2, 0), c) + end + end + + local spawn3 = W3 + V(0, 4, 120) + marker("World3Spawn", CFrame.lookAt(spawn3 + V(0, 1, 0), spawn3 + V(0, 1, -10))) + arch(CFrame.new(W3 + V(0, 4, 104)), 14, 11, "❄ ЛЕДЯНОЙ ФЬОРД", Color3.fromRGB(150, 220, 255)) + portal(CFrame.lookAt(W3 + V(-32, 4, 140), spawn3), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W3 + V(32, 4, 138), spawn3), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(180, 230, 255), + wall = Color3.fromRGB(120, 95, 75), + stripeA = Color3.fromRGB(60, 120, 200), + stripeB = Color3.fromRGB(245, 250, 255), + glow = Color3.fromRGB(140, 210, 255), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Нина", + npcColors = { skin = Color3.fromRGB(240, 205, 175), shirt = Color3.fromRGB(180, 40, 50), pants = Color3.fromRGB(40, 40, 60), hat = Color3.fromRGB(240, 240, 250) }, + }) + bestiary(W3 + V(-20, 4, 100), spawn3, "World3", "❄ КТО ВОДИТСЯ ПОДО ЛЬДОМ", "#BFEAFF") + npc("Полярник Саша", CFrame.lookAt(W3 + V(12, 7, 88), W3 + V(0, 7, 60)), { + skin = Color3.fromRGB(230, 190, 160), shirt = Color3.fromRGB(230, 120, 30), pants = Color3.fromRGB(50, 55, 70), hat = Color3.fromRGB(200, 40, 40), + }, "Talk", "Поговорить") + igloo(W3 + V(-45, 4, 95), W3 + V(0, 4, 110)) + campfire(W3 + V(20, 4, 108)) + snowman(W3 + V(42, 4, 100)) + for _, p in ipairs({ { -85, -45 }, { 90, 30 }, { -25, -110 }, { 70, -90 }, { -95, 60 } }) do + crystal(W3 + V(p[1], groundY(W3.X + p[1], W3.Z + p[2]), p[2])) + end + + local function free3(x, z) + for _, l in ipairs(LAKES3) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + 12 then + return false + end + end + if (V(x, 0, z) - V(0, 0, 120)).Magnitude < 40 then + return false + end + if (V(x, 0, z) - V(-45, 0, 95)).Magnitude < 14 then + return false + end + return true + end + local count = 0 + for _ = 1, 400 do + if count >= 80 then + break + end + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if free3(x, z) then + snowPine(W3 + V(x, groundY(W3.X + x, W3.Z + z) - 0.5, z)) + count += 1 + end + end + + -- северное сияние + for i = 0, 7 do + P({ + Size = V(55, 26, 0.6), + CFrame = CFrame.new(W3 + V(-175 + i * 50, 150 + math.sin(i * 1.3) * 10, -150 + math.cos(i * 0.9) * 25)) * CFrame.Angles(math.rad(10), math.rad(i * 8 - 28), 0), + Material = Enum.Material.Neon, + Color = (i % 3 == 0) and Color3.fromRGB(170, 90, 255) or Color3.fromRGB(80, 255, 170), + Transparency = 0.6, CanCollide = false, CanQuery = false, CastShadow = false, + }) + end + worldWalls(W3) +end + +---------------------------------------------------------------- проверка воды +-- Если вода в террейне не создалась (бывает в некоторых плейсах/настройках), +-- ставим поверхность воды из деталей, чтобы озёра и море точно были видны. + +local function terrainHasWater(pos) + local region = Region3.new(pos - V(2, 2, 2), pos + V(2, 2, 2)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + if not ok then + return true + end + for _, plane in ipairs(mats) do + for _, column in ipairs(plane) do + for _, m in ipairs(column) do + if m == Enum.Material.Water then + return true + end + end + end + end + return false +end + +local function waterPlane(pos, diameter, color) + return P({ + Name = "WaterSurface", + Shape = Enum.PartType.Cylinder, + Size = V(0.4, diameter, diameter), + CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)), + Color = color, + Material = Enum.Material.SmoothPlastic, + Reflectance = 0.08, + CanCollide = false, + CanQuery = false, + CanTouch = false, + CastShadow = false, + }) +end + +do + local w1, w2, w3 = Config.Worlds[1], Config.Worlds[2], Config.Worlds[3] + if not terrainHasWater(w1.center + V(0, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 1 не создалась — ставлю запасную поверхность воды") + waterPlane(w1.center + V(0, w1.waterY, 0), 490, Color3.fromRGB(30, 120, 150)) + end + if not terrainHasWater(w2.center + V(180, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 2 не создалась — ставлю запасную поверхность воды") + waterPlane(w2.center + V(0, w2.waterY, 0), 500, Color3.fromRGB(40, 180, 190)) + end + local h = w3.holes[1] + if not terrainHasWater(w3.center + V(h[1], -1, h[2])) then + warn("[MapBuilder] Вода в лунках Мира 3 не создалась — ставлю запасную поверхность воды") + for _, hole in ipairs(w3.holes) do + waterPlane(w3.center + V(hole[1], w3.waterY + 0.05, hole[2]), w3.holeRadius * 2, Color3.fromRGB(25, 75, 110)) + end + end +end +]]> + + + \ No newline at end of file diff --git a/install/4_GameServer_ServerScriptService.rbxmx b/install/4_GameServer_ServerScriptService.rbxmx new file mode 100644 index 0000000..715beb6 --- /dev/null +++ b/install/4_GameServer_ServerScriptService.rbxmx @@ -0,0 +1,1294 @@ + + + +GameServer + ServerScriptService +-- Логика игры: данные, удача, рыбалка с анимацией, сумка, магазин, улучшения, +-- коллекция с наградами, задания, ежедневная награда, события, миры, донат. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local DataStoreService = game:GetService("DataStoreService") +local ProximityPromptService = game:GetService("ProximityPromptService") +local TweenService = game:GetService("TweenService") +local RunService = game:GetService("RunService") +local MarketplaceService = game:GetService("MarketplaceService") +local Debris = game:GetService("Debris") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) + +local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent") +remote.Name = "GameEvent" +remote.Parent = ReplicatedStorage + +local rng = Random.new() +local GOLD = Color3.fromRGB(255, 220, 80) +local RED = Color3.fromRGB(255, 120, 120) +local GREEN = Color3.fromRGB(120, 255, 140) +local SPLASH_SOUND = "rbxasset://sounds/impact_water.mp3" + +---------------------------------------------------------------- данные + +local store = nil +pcall(function() + store = DataStoreService:GetDataStore("FishingGame_v2") +end) + +local profiles = {} +local loadedOk = {} +local passes = {} + +local function defaultData() + return { + coins = 0, level = 1, xp = 0, + rod = "Basic", rods = { Basic = true }, rodLevels = {}, + bag = "Pouch", bags = { Pouch = true }, + items = {}, discovered = {}, claimed = {}, + quests = {}, daily = { last = 0, streak = 0 }, + boostUntil = 0, boostBonus = 0, + totalCaught = 0, nextUid = 1, receipts = {}, + } +end + +local function loadData(player) + local data = defaultData() + if not store then + return data, false + end + local ok, saved = pcall(function() + return store:GetAsync("player_" .. player.UserId) + end) + if not ok then + warn("Не удалось загрузить данные " .. player.Name .. ": " .. tostring(saved)) + return data, false + end + if type(saved) == "table" then + for k, v in pairs(saved) do + data[k] = v + end + end + return data, true +end + +local function saveData(player) + local data = profiles[player] + if not store or not data or not loadedOk[player] then + return + end + local ok, err = pcall(function() + store:SetAsync("player_" .. player.UserId, data) + end) + if not ok then + warn("Не удалось сохранить данные " .. player.Name .. ": " .. tostring(err)) + end +end + +---------------------------------------------------------------- пропуска и события + +local function hasPass(player, key) + return passes[player] ~= nil and passes[player][key] == true +end + +local function loadPasses(player) + passes[player] = {} + for _, gp in ipairs(Config.GamePasses) do + if gp.id and gp.id > 0 then + local ok, owns = pcall(function() + return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gp.id) + end) + if ok and owns then + passes[player][gp.key] = true + end + end + end +end + +local currentEvent = nil +local function ev(field, default) + return (currentEvent and currentEvent[field]) or default +end + +---------------------------------------------------------------- расчёты + +local function rodLevel(data, rodId) + return data.rodLevels[rodId or data.rod] or 0 +end + +local function boostActive(data) + return data.boostUntil > os.time() and data.boostBonus or 0 +end + +local function masteryCount(data) + local n = 0 + for key in pairs(data.claimed) do + if string.find(key, ":Master", 1, true) then + n += 1 + end + end + return n +end + +local function totalLuck(player, data) + local stats = Config.RodStats(data.rod, rodLevel(data)) + local l = 1 + stats.luck + (data.level - 1) * Config.LuckPerPlayerLevel + boostActive(data) + masteryCount(data) * Config.MasteryLuck + if hasPass(player, "VIP") then + l += 0.25 + end + if hasPass(player, "LuckyCharm") then + l += 0.5 + end + return l + ev("luck", 0) +end + +local function bagCapacity(player, data) + local bag = Config.Find(Config.Bags, data.bag) or Config.Bags[1] + return bag.capacity + (hasPass(player, "BigBag") and 100 or 0) +end + +local function sellMult(player) + local m = ev("sell", 1) + if hasPass(player, "VIP") then + m *= 1.25 + end + if hasPass(player, "DoubleCoins") then + m *= 2 + end + return m +end + +local function notify(player, text, color) + remote:FireClient(player, "Notify", text, color or Color3.new(1, 1, 1)) +end + +local function today() + return math.floor(os.time() / 86400) +end + +local function sendInventory(player) + local data = profiles[player] + if data then + remote:FireClient(player, "Inventory", data.items, data.discovered, data.claimed) + end +end + +local function sendQuests(player) + local data = profiles[player] + if not data then + return + end + local t = today() + remote:FireClient(player, "Quests", data.quests, { + available = data.daily.last < t, + streak = data.daily.streak, + nextStreak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or ((data.daily.last < t) and 1 or data.daily.streak), + }) +end + +local function updateStats(player) + local data = profiles[player] + if not data then + return + end + local bagValue = 0 + for _, item in ipairs(data.items) do + bagValue += item.value + end + local owned, lv, bags, ps = {}, {}, {}, {} + for id in pairs(data.rods) do + table.insert(owned, id) + table.insert(lv, id .. ":" .. rodLevel(data, id)) + end + for id in pairs(data.bags) do + table.insert(bags, id) + end + for key in pairs(passes[player] or {}) do + table.insert(ps, key) + end + + player:SetAttribute("Coins", data.coins) + player:SetAttribute("Level", data.level) + player:SetAttribute("XP", data.xp) + player:SetAttribute("XPNeed", Config.XPForLevel(data.level)) + player:SetAttribute("Rod", data.rod) + player:SetAttribute("RodLevel", rodLevel(data)) + player:SetAttribute("RodLevels", table.concat(lv, ",")) + player:SetAttribute("OwnedRods", table.concat(owned, ",")) + player:SetAttribute("Bag", data.bag) + player:SetAttribute("OwnedBags", table.concat(bags, ",")) + player:SetAttribute("BagCount", #data.items) + player:SetAttribute("BagCap", bagCapacity(player, data)) + player:SetAttribute("BagValue", math.floor(bagValue * sellMult(player))) + player:SetAttribute("Luck", math.floor(totalLuck(player, data) * 100 + 0.5)) + player:SetAttribute("BoostBonus", boostActive(data)) + player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time())) + player:SetAttribute("TotalCaught", data.totalCaught) + player:SetAttribute("Mastery", masteryCount(data)) + player:SetAttribute("Passes", table.concat(ps, ",")) + + local ls = player:FindFirstChild("leaderstats") + if ls then + ls["Монеты"].Value = data.coins + ls["Уровень"].Value = data.level + ls["Улов"].Value = data.totalCaught + end +end + +local function addXp(player, data, amount) + data.xp += amount + local leveled = false + while data.xp >= Config.XPForLevel(data.level) do + data.xp -= Config.XPForLevel(data.level) + data.level += 1 + leveled = true + end + if leveled then + notify(player, "⭐ Новый уровень: " .. data.level .. "! Удача +" .. math.floor(Config.LuckPerPlayerLevel * 100) .. "%", GOLD) + for _, w in ipairs(Config.Worlds) do + if w.level == data.level and not w.soon then + notify(player, "🌍 Открыт новый мир: " .. w.icon .. " " .. w.name .. "!", w.color) + end + end + end +end + +local function applyPotion(data, bonus, duration) + data.boostBonus = math.max(boostActive(data), bonus) + data.boostUntil = math.max(os.time(), data.boostUntil) + duration +end + +---------------------------------------------------------------- задания + +local function makeQuest(data, exclude) + local pool = {} + for _, q in ipairs(Config.Quests) do + if not exclude[q.kind] then + table.insert(pool, q) + end + end + if #pool == 0 then + pool = Config.Quests + end + local t = pool[rng:NextInteger(1, #pool)] + local goal = t.goals[rng:NextInteger(1, #t.goals)] + local mult = 1 + (data.level - 1) * 0.25 + return { + kind = t.kind, goal = goal, progress = 0, + coins = math.max(10, math.floor(t.coins * goal * mult)), + xp = math.max(10, math.floor(t.xp * goal * mult)), + } +end + +local function ensureQuests(data) + local kinds = {} + for _, q in ipairs(data.quests) do + kinds[q.kind] = true + end + while #data.quests < Config.QuestSlots do + local q = makeQuest(data, kinds) + kinds[q.kind] = true + table.insert(data.quests, q) + end +end + +local function questProgress(player, kind, amount) + local data = profiles[player] + if not data then + return + end + local changed = false + for _, q in ipairs(data.quests) do + if q.kind == kind and q.progress < q.goal then + q.progress = math.min(q.goal, q.progress + amount) + changed = true + if q.progress >= q.goal then + notify(player, "📜 Задание выполнено! Забери награду (клавиша Q)", GOLD) + end + end + end + if changed then + sendQuests(player) + end +end + +local function claimQuest(player, index) + local data = profiles[player] + local q = data and type(index) == "number" and data.quests[index] + if not q or q.progress < q.goal then + return + end + data.coins += q.coins + addXp(player, data, q.xp) + local kinds = {} + for i, other in ipairs(data.quests) do + if i ~= index then + kinds[other.kind] = true + end + end + kinds[q.kind] = true + data.quests[index] = makeQuest(data, kinds) + updateStats(player) + sendQuests(player) + notify(player, ("📜 Награда: +%d 💰 +%d XP"):format(q.coins, q.xp), GREEN) +end + +local function claimDaily(player) + local data = profiles[player] + if not data then + return + end + local t = today() + if data.daily.last >= t then + notify(player, "🎁 Сегодня награда уже получена. Приходи завтра!", Color3.fromRGB(255, 200, 120)) + return + end + local streak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or 1 + local r = Config.DailyRewards[streak] + local coins = math.floor(r.coins * (1 + (data.level - 1) * 0.2)) + data.coins += coins + local extra = "" + if r.potion then + local p = Config.Find(Config.Potions, r.potion) + if p then + applyPotion(data, p.bonus, p.duration) + extra = " + " .. p.name + end + end + data.daily = { last = t, streak = streak } + updateStats(player) + sendQuests(player) + notify(player, ("🎁 День %d: +%d 💰%s"):format(streak, coins, extra), GOLD) +end + +---------------------------------------------------------------- коллекция + +local function claimCollection(player, worldId, rarity) + local data = profiles[player] + local world = data and Config.Find(Config.Worlds, worldId) + local zone = world and Config.Zones[worldId] + if not zone or type(rarity) ~= "string" then + return + end + local key = worldId .. ":" .. rarity + if data.claimed[key] then + return + end + for _, f in ipairs(zone.fish) do + if (rarity == "Master" or f.rarity == rarity) and not data.discovered[f.id] then + notify(player, "Сначала поймай всех рыб этой группы!", RED) + return + end + end + data.claimed[key] = true + if rarity == "Master" then + local coins = Config.MasteryCoins * world.mult + data.coins += coins + notify(player, ("🏆 Мир «%s» собран! +%d 💰 и +%d%% удачи навсегда"):format(world.name, coins, math.floor(Config.MasteryLuck * 100 + 0.5)), GOLD) + else + local r = Config.CollectionRewards[rarity] + if not r then + return + end + data.coins += r.coins * world.mult + addXp(player, data, r.xp * world.mult) + notify(player, ("📖 Коллекция «%s»: +%d 💰 +%d XP"):format(Config.Rarities[rarity].name, r.coins * world.mult, r.xp * world.mult), GREEN) + end + updateStats(player) + sendInventory(player) +end + +---------------------------------------------------------------- удочка, сумка, VIP на персонаже + +local REST_ANGLE = 30 +local function gripCF(angle) + return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse() +end +local function tweenGrip(tool, angle, t) + if not tool or not tool.Parent then + return nil + end + local tw = TweenService:Create(tool, TweenInfo.new(t, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Grip = gripCF(angle) }) + tw:Play() + return tw +end +local function gripSequence(tool, steps) + task.spawn(function() + for _, s in ipairs(steps) do + local tw = tweenGrip(tool, s[1], s[2]) + if not tw then + return + end + tw.Completed:Wait() + end + end) +end + +local function findRodTool(player) + for _, container in ipairs({ player.Character, player:FindFirstChild("Backpack") }) do + if container then + for _, child in ipairs(container:GetChildren()) do + if child:IsA("Tool") and child:GetAttribute("IsRod") then + return child + end + end + end + end + return nil +end + +local function giveRodTool(player) + local data = profiles[player] + local backpack = player:FindFirstChild("Backpack") + if not data or not backpack then + return + end + local old = findRodTool(player) + local wasEquipped = old ~= nil and old.Parent == player.Character + if old then + old:Destroy() + end + local rod = Config.Find(Config.Rods, data.rod) or Config.Rods[1] + local lvl = rodLevel(data) + local model = Models.buildRod(rod.id, lvl, false) + local tool = Instance.new("Tool") + tool.Name = rod.name .. (lvl > 0 and (" +" .. lvl) or "") + tool.ToolTip = "Кликни у воды, чтобы закинуть" + tool.CanBeDropped = false + tool.Grip = gripCF(REST_ANGLE) + tool:SetAttribute("IsRod", true) + for _, child in ipairs(model:GetChildren()) do + child.Parent = tool + end + model:Destroy() + tool.Parent = backpack + if wasEquipped then + local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid") + if hum then + hum:EquipTool(tool) + end + end +end + +local function attachBag(player) + local data = profiles[player] + local char = player.Character + if not data or not char then + return + end + local old = char:FindFirstChild("BackBag") + if old then + old:Destroy() + end + local torso = char:FindFirstChild("UpperTorso") or char:FindFirstChild("Torso") + if not torso then + return + end + local bag = Models.buildBag(data.bag, false) + local offset = CFrame.new(0, 0.1, torso.Size.Z / 2) + bag:PivotTo(torso.CFrame * offset) + local w = Instance.new("Weld") + w.Part0 = torso + w.Part1 = bag.PrimaryPart + w.C0 = offset + w.Parent = bag.PrimaryPart + bag.Parent = char +end + +local function vipTag(player) + local head = player.Character and player.Character:FindFirstChild("Head") + if not head or not hasPass(player, "VIP") or head:FindFirstChild("VipTag") then + return + end + local bb = Instance.new("BillboardGui") + bb.Name = "VipTag" + bb.Size = UDim2.fromOffset(120, 30) + bb.StudsOffset = Vector3.new(0, 2.6, 0) + bb.MaxDistance = 80 + bb.Parent = head + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = Color3.fromRGB(255, 210, 60) + t.TextStrokeTransparency = 0.2 + t.Text = "👑 VIP" + t.Parent = bb +end + +---------------------------------------------------------------- эффекты + +local function playSound(parent, id, volume) + local snd = Instance.new("Sound") + snd.SoundId = id + snd.Volume = volume or 0.6 + snd.Parent = parent + snd:Play() + Debris:AddItem(snd, 3) +end + +local function splash(part, count) + local att = Instance.new("Attachment") + att.Parent = part + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(Color3.fromRGB(220, 240, 255)) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Size = NumberSequence.new(0.4, 0.1) + pe.Lifetime = NumberRange.new(0.4, 0.7) + pe.Speed = NumberRange.new(6, 10) + pe.SpreadAngle = Vector2.new(40, 40) + pe.Acceleration = Vector3.new(0, -35, 0) + pe.Enabled = false + pe.Parent = att + pe:Emit(count or 20) + Debris:AddItem(att, 2) +end + +-- рыба вылетает из воды, летит к игроку и показывается над головой +local function showFishFlight(player, fish, fromPos) + local head = player.Character and player.Character:FindFirstChild("Head") + if not head then + return + end + local model = Models.buildFish(fish.id, fish.mutation, 0.9, true) + model:PivotTo(CFrame.new(fromPos)) + model.Parent = workspace + task.spawn(function() + local t0, dur = os.clock(), 0.55 + while head.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + local target = head.Position + Vector3.new(0, 2.8, 0) + local p = fromPos:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 8, 0) + model:PivotTo(CFrame.new(p) * CFrame.Angles(0, 0, a * math.pi * 2)) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + local t1 = os.clock() + while head.Parent and os.clock() - t1 < 1.8 do + model:PivotTo(CFrame.new(head.Position + Vector3.new(0, 2.8, 0)) * CFrame.Angles(0, os.clock() * 3, math.rad(-15))) + RunService.Heartbeat:Wait() + end + model:Destroy() + end) +end + +---------------------------------------------------------------- рыбалка + +local fishing = {} + +-- ищем воду перед игроком по карте мира из FishConfig (не зависит от террейна) +local function findWater(hrp, world) + local look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + if look.Magnitude < 0.01 then + look = Vector3.new(0, 0, -1) + end + look = look.Unit + for _, d in ipairs({ 14, 11, 17, 8, 20, 6, 24, 4 }) do + local p = hrp.Position + look * d + if Config.IsWater(world, p) then + return Vector3.new(p.X, world.waterY or 0, p.Z) + end + end + return nil +end + +local function stopFishing(player, tellClient) + local s = fishing[player] + if not s then + return + end + fishing[player] = nil + if s.tween then + s.tween:Cancel() + end + if s.bobber then + s.bobber:Destroy() + end + if s.tool then + tweenGrip(s.tool, REST_ANGLE, 0.3) + end + if tellClient then + remote:FireClient(player, "Cancel") + end +end + +local function rollFish(player, data, worldId) + local zone = Config.Zones[worldId] + if not zone then + return nil + end + local luck = totalLuck(player, data) + local bonus = luck - 1 + local weights, total = {}, 0 + for i, f in ipairs(zone.fish) do + local r = Config.Rarities[f.rarity] + local w = r.weight * math.max(0.2, 1 + bonus * (r.rank - 1)) + if r.rank == 1 then + w = r.weight / math.max(1, luck) + end + weights[i] = w + total += w + end + local roll = rng:NextNumber() * total + local chosen = zone.fish[1] + for i, f in ipairs(zone.fish) do + roll -= weights[i] + if roll <= 0 then + chosen = f + break + end + end + local mutation = nil + for _, m in ipairs(Config.Mutations) do + if rng:NextNumber() < m.chance * luck * ev("mutation", 1) then + mutation = m + break + end + end + local wf = rng:NextNumber() ^ 2.2 + local weight = chosen.minW + (chosen.maxW - chosen.minW) * wf + return { + id = chosen.id, + name = chosen.name, + rarity = chosen.rarity, + weight = math.floor(weight * 100) / 100, + value = math.floor(chosen.price * (0.75 + 0.9 * wf) * (mutation and mutation.mult or 1) + 0.5), + xp = chosen.xp * (mutation and 2 or 1), + mutation = mutation and mutation.id or nil, + world = worldId, + } +end + +local function flyBobber(s, tool, target) + local tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") + local start = tip and tip.WorldPosition or (target + Vector3.new(0, 6, 0)) + local bobber = Models.buildBobber() + bobber:PivotTo(CFrame.new(start)) + bobber.Parent = workspace + s.bobber = bobber + if tip then + local a1 = Instance.new("Attachment") + a1.Position = Vector3.new(0, 0.9, 0) + a1.Parent = bobber.PrimaryPart + local line = Instance.new("Beam") + line.Attachment0 = tip + line.Attachment1 = a1 + line.Width0 = 0.035 + line.Width1 = 0.035 + line.FaceCamera = true + line.Color = ColorSequence.new(Color3.fromRGB(245, 245, 245)) + line.Parent = bobber + end + local t0, dur = os.clock(), 0.55 + while bobber.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 6, 0))) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + if bobber.Parent then + splash(bobber.PrimaryPart, 18) + playSound(bobber.PrimaryPart, SPLASH_SOUND, 0.5) + end +end + +local function onCast(player) + local data = profiles[player] + if not data then + return + end + if fishing[player] then + stopFishing(player, true) + return + end + local char = player.Character + local hrp = char and char:FindFirstChild("HumanoidRootPart") + local tool = char and char:FindFirstChildOfClass("Tool") + if not hrp or not tool or not tool:GetAttribute("IsRod") then + remote:FireClient(player, "CastFail") + return + end + local world = Config.WorldAt(hrp.Position) + local target = world and findWater(hrp, world) + if not target then + remote:FireClient(player, "CastFail") + notify(player, world and "Повернись лицом к воде (или к лунке)!" or "Здесь нет рыбы — иди в один из миров 🌍", Color3.fromRGB(255, 200, 120)) + return + end + if #data.items >= bagCapacity(player, data) then + remote:FireClient(player, "CastFail") + notify(player, "🎒 Сумка полна! Продай рыбу в скупке.", RED) + return + end + + local stats = Config.RodStats(data.rod, rodLevel(data)) + local fish = rollFish(player, data, world.id) + if not fish then + remote:FireClient(player, "CastFail") + return + end + local s = { stage = "casting", fish = fish, tool = tool } + fishing[player] = s + remote:FireClient(player, "Cast") + + task.spawn(function() + -- замах назад и бросок вперёд + local tw = tweenGrip(tool, 100, 0.25) + if tw then + tw.Completed:Wait() + end + tw = tweenGrip(tool, 8, 0.15) + if tw then + tw.Completed:Wait() + end + if fishing[player] ~= s then + return + end + flyBobber(s, tool, target + Vector3.new(0, 0.15, 0)) + tweenGrip(tool, REST_ANGLE - 5, 0.4) + if fishing[player] ~= s then + if s.bobber then + s.bobber:Destroy() + end + return + end + s.stage = "waiting" + + local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) + task.wait(waitTime) + if fishing[player] ~= s then + return + end + s.stage = "bite" + s.biteAt = os.clock() + if s.bobber and s.bobber.PrimaryPart then + local root = s.bobber.PrimaryPart + splash(root, 25) + playSound(root, SPLASH_SOUND, 0.35) + s.tween = TweenService:Create(root, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, -1, true), { + CFrame = root.CFrame - Vector3.new(0, 0.55, 0), + }) + s.tween:Play() + end + -- удочка дёргается, пока идёт вываживание + task.spawn(function() + local up = true + while fishing[player] == s and s.stage == "bite" do + tweenGrip(tool, up and 38 or 18, 0.12) + up = not up + task.wait(0.13) + end + end) + local rank = Config.Rarities[fish.rarity].rank + remote:FireClient(player, "Bite", { + speed = 0.55 + 0.22 * (rank - 1), + zoneWidth = math.max(0.07, stats.zone - 0.02 * (rank - 1)), + hits = Config.HitsNeeded(rank), + misses = Config.MaxMisses, + timeout = Config.BiteTimeout, + }) + task.wait(Config.BiteTimeout + 0.5) + if fishing[player] == s and s.stage == "bite" then + stopFishing(player, false) + remote:FireClient(player, "Escaped") + notify(player, "Рыба ушла… не успел вытащить.", RED) + end + end) +end + +local function onCatch(player, success, misses) + local s = fishing[player] + local data = profiles[player] + if not s or not data or s.stage ~= "bite" then + return + end + local fromPos = s.bobber and s.bobber.PrimaryPart and s.bobber.PrimaryPart.Position + s.stage = "done" + local tool = s.tool + fishing[player] = nil + if s.tween then + s.tween:Cancel() + end + if s.bobber then + s.bobber:Destroy() + end + + if success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 then + gripSequence(tool, { { REST_ANGLE, 0.3 } }) + remote:FireClient(player, "Escaped") + notify(player, "Рыба сорвалась!", RED) + return + end + gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } }) + + local fish = s.fish + table.insert(data.items, { + uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity, + weight = fish.weight, value = fish.value, mutation = fish.mutation, + }) + data.nextUid += 1 + data.totalCaught += 1 + + local rec = data.discovered[fish.id] + local isNew, isRecord = rec == nil, false + if not rec then + rec = { count = 0, best = 0 } + data.discovered[fish.id] = rec + end + rec.count += 1 + if fish.weight > rec.best then + isRecord = not isNew + rec.best = fish.weight + end + + addXp(player, data, fish.xp * (isNew and 2 or 1)) + updateStats(player) + sendInventory(player) + if fromPos then + showFishFlight(player, fish, fromPos) + end + remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord }) + + local rank = Config.Rarities[fish.rarity].rank + questProgress(player, "catch", 1) + if rank >= 3 then + questProgress(player, "rare", 1) + end + if rank >= 4 then + questProgress(player, "epic", 1) + end + if fish.mutation then + questProgress(player, "mutation", 1) + end + if misses == 0 then + questProgress(player, "perfect", 1) + end +end + +---------------------------------------------------------------- скупка + +local sellPoints = nil +local function nearSeller(player) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return false + end + if not sellPoints then + sellPoints = {} + local map = workspace:FindFirstChild("FishingMap") + if map then + for _, d in ipairs(map:GetDescendants()) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + table.insert(sellPoints, d.Parent) + end + end + end + end + for _, p in ipairs(sellPoints) do + if (p.Position - hrp.Position).Magnitude < 28 then + return true + end + end + return false +end + +local function sellItems(player, filterUid) + local data = profiles[player] + if not data then + return + end + local mult = sellMult(player) + local total, count, keep = 0, 0, {} + for _, item in ipairs(data.items) do + if filterUid == nil or item.uid == filterUid then + total += math.floor(item.value * mult) + count += 1 + else + table.insert(keep, item) + end + end + if count == 0 then + if filterUid == nil then + notify(player, "Нечего продавать — сначала поймай рыбу!", Color3.fromRGB(255, 200, 120)) + end + return + end + data.items = keep + data.coins += total + updateStats(player) + sendInventory(player) + remote:FireClient(player, "Sold", total, count) + questProgress(player, "earn", total) +end + +---------------------------------------------------------------- магазин + +local function buy(player, kind, id) + local data = profiles[player] + if not data or type(id) ~= "string" then + return + end + if kind == "Upgrade" then + local rod = Config.Find(Config.Rods, id) + if not rod or not data.rods[id] then + return + end + local lvl = rodLevel(data, id) + if lvl >= Config.RodUpgrade.maxLevel then + notify(player, "Удочка уже улучшена до максимума ★★★★★", GOLD) + return + end + local cost = Config.UpgradeCost(rod, lvl) + if data.coins < cost then + notify(player, "Не хватает монет: нужно " .. cost .. " 💰", RED) + return + end + data.coins -= cost + data.rodLevels[id] = lvl + 1 + if data.rod == id then + stopFishing(player, true) + giveRodTool(player) + end + updateStats(player) + notify(player, ("✨ %s улучшена до +%d!"):format(rod.name, lvl + 1), GOLD) + return + end + if kind == "Potion" then + local potion = Config.Find(Config.Potions, id) + if not potion then + return + end + if potion.level and data.level < potion.level then + notify(player, "Нужен уровень " .. potion.level .. "!", RED) + return + end + if data.coins < potion.price then + notify(player, "Не хватает монет: нужно " .. potion.price .. " 💰", RED) + return + end + data.coins -= potion.price + applyPotion(data, potion.bonus, potion.duration) + updateStats(player) + notify(player, ("🍀 %s: удача +%d%% на %d мин"):format(potion.name, potion.bonus * 100, potion.duration / 60), GREEN) + return + end + local list, owned + if kind == "Rod" then + list, owned = Config.Rods, data.rods + elseif kind == "Bag" then + list, owned = Config.Bags, data.bags + else + return + end + local item = Config.Find(list, id) + if not item then + return + end + if not owned[id] then + if data.level < item.level then + notify(player, "Нужен уровень " .. item.level .. "!", RED) + return + end + if data.coins < item.price then + notify(player, "Не хватает монет: нужно " .. item.price .. " 💰", RED) + return + end + data.coins -= item.price + owned[id] = true + notify(player, "Куплено: " .. item.name .. "!", GREEN) + end + if kind == "Rod" then + data.rod = id + stopFishing(player, true) + giveRodTool(player) + else + data.bag = id + attachBag(player) + end + updateStats(player) +end + +---------------------------------------------------------------- телепорт + +local function teleportTo(player, worldId) + local data = profiles[player] + local char = player.Character + if not data or not char or type(worldId) ~= "string" then + return + end + local markerName + if worldId == "Lobby" then + markerName = "LobbySpawn" + else + local world = Config.Find(Config.Worlds, worldId) + if not world then + return + end + if world.soon then + notify(player, world.icon .. " " .. world.name .. " скоро откроется! Следи за обновлениями.", world.color) + return + end + if data.level < world.level then + notify(player, ("🔒 %s откроется на %d уровне"):format(world.name, world.level), RED) + return + end + markerName = world.id .. "Spawn" + end + local map = workspace:FindFirstChild("FishingMap") + local m = map and map:FindFirstChild(markerName) + if m then + stopFishing(player, true) + char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + end +end + +---------------------------------------------------------------- подсказки NPC + +local TIPS = { + World1 = { + "Рыба клюёт быстрее с хорошей удочкой. Улучшай её в магазине!", + "Говорят, в этом озере живёт хрустальный осётр… Мифическая рыба!", + "Собери всех рыб одной редкости — получишь награду в коллекции (клавиша C).", + "Чем реже рыба, тем быстрее бегает метка. Нужна точность!", + }, + World2 = { + "Скаты любят мелководье, а акулы — глубину за причалом.", + "Солнечная медуза светится по ночам… Если поймаешь — ты легенда!", + "Блестящая рыба стоит вдвое дороже, золотая — в пять раз, радужная — в десять!", + }, + World3 = { + "Ищи лунки во льду — только там можно рыбачить.", + "Ледяной левиафан… Я видел его тень подо льдом. Один раз.", + "Удильщик светится в темноте. Смотри внимательно!", + }, +} + +local function talk(player) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local world = hrp and Config.WorldAt(hrp.Position) + local list = TIPS[world and world.id or "World1"] or TIPS.World1 + notify(player, "💬 «" .. list[rng:NextInteger(1, #list)] .. "»", Color3.fromRGB(255, 235, 190)) +end + +ProximityPromptService.PromptTriggered:Connect(function(prompt, player) + local action = prompt:GetAttribute("Action") + if action == "Shop" then + remote:FireClient(player, "OpenShop") + elseif action == "Sell" then + sellItems(player, nil) + elseif action == "Portal" then + teleportTo(player, prompt:GetAttribute("World")) + elseif action == "Talk" then + talk(player) + elseif action == "Daily" then + claimDaily(player) + remote:FireClient(player, "OpenQuests") + elseif action == "RobuxPasses" then + remote:FireClient(player, "OpenRobux", "passes") + elseif action == "RobuxProducts" then + remote:FireClient(player, "OpenRobux", "products") + end +end) + +---------------------------------------------------------------- события от клиента + +remote.OnServerEvent:Connect(function(player, action, a, b) + if action == "Cast" then + onCast(player) + elseif action == "Catch" then + onCatch(player, a, b) + elseif action == "Cancel" then + stopFishing(player, false) + elseif action == "Buy" then + buy(player, a, b) + elseif action == "SellOne" then + if type(a) ~= "number" then + return + end + if nearSeller(player) then + sellItems(player, a) + else + notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + end + elseif action == "SellAll" then + if nearSeller(player) then + sellItems(player, nil) + else + notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + end + elseif action == "Teleport" then + teleportTo(player, a) + elseif action == "ClaimCollection" then + claimCollection(player, a, b) + elseif action == "ClaimQuest" then + claimQuest(player, a) + elseif action == "ClaimDaily" then + claimDaily(player) + elseif action == "RequestInventory" then + sendInventory(player) + sendQuests(player) + end +end) + +---------------------------------------------------------------- донат + +MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased) + if not purchased then + return + end + for _, gp in ipairs(Config.GamePasses) do + if gp.id == passId then + passes[player] = passes[player] or {} + passes[player][gp.key] = true + notify(player, "Спасибо за покупку! " .. gp.icon .. " " .. gp.name .. " активирован", GOLD) + if gp.key == "VIP" then + vipTag(player) + end + updateStats(player) + end + end +end) + +MarketplaceService.ProcessReceipt = function(info) + local player = Players:GetPlayerByUserId(info.PlayerId) + local data = player and profiles[player] + if not data then + return Enum.ProductPurchaseDecision.NotProcessedYet + end + for _, id in ipairs(data.receipts) do + if id == info.PurchaseId then + return Enum.ProductPurchaseDecision.PurchaseGranted + end + end + local product + for _, p in ipairs(Config.Products) do + if p.id == info.ProductId then + product = p + end + end + if not product then + return Enum.ProductPurchaseDecision.NotProcessedYet + end + if product.coins then + local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15)) + data.coins += coins + notify(player, ("Спасибо! +%d 💰"):format(coins), GOLD) + end + if product.boost then + applyPotion(data, product.boost, product.duration) + notify(player, ("Спасибо! Удача +%d%% на %d мин"):format(product.boost * 100, product.duration / 60), GOLD) + end + table.insert(data.receipts, info.PurchaseId) + if #data.receipts > 50 then + table.remove(data.receipts, 1) + end + updateStats(player) + saveData(player) + return Enum.ProductPurchaseDecision.PurchaseGranted +end + +---------------------------------------------------------------- события на сервере + +task.spawn(function() + task.wait(Config.EventFirstDelay) + while true do + currentEvent = Config.Events[rng:NextInteger(1, #Config.Events)] + workspace:SetAttribute("Event", currentEvent.id) + workspace:SetAttribute("EventEnds", workspace:GetServerTimeNow() + currentEvent.duration) + for _, p in ipairs(Players:GetPlayers()) do + notify(p, "🎉 Событие: " .. currentEvent.name .. " — " .. currentEvent.desc, GOLD) + updateStats(p) + end + task.wait(currentEvent.duration) + currentEvent = nil + workspace:SetAttribute("Event", nil) + for _, p in ipairs(Players:GetPlayers()) do + updateStats(p) + end + task.wait(rng:NextInteger(Config.EventGapMin, Config.EventGapMax)) + end +end) + +---------------------------------------------------------------- игроки + +local function onPlayerAdded(player) + local ls = Instance.new("Folder") + ls.Name = "leaderstats" + ls.Parent = player + for _, name in ipairs({ "Монеты", "Уровень", "Улов" }) do + local v = Instance.new("IntValue") + v.Name = name + v.Parent = ls + end + + local data, ok = loadData(player) + if not player.Parent then + return + end + loadPasses(player) + ensureQuests(data) + profiles[player] = data + loadedOk[player] = ok + updateStats(player) + sendInventory(player) + sendQuests(player) + + local function onCharacter() + stopFishing(player, false) + task.wait(0.3) + giveRodTool(player) + attachBag(player) + vipTag(player) + end + player.CharacterAdded:Connect(onCharacter) + if player.Character then + task.spawn(onCharacter) + end +end + +Players.PlayerAdded:Connect(onPlayerAdded) +for _, p in ipairs(Players:GetPlayers()) do + task.spawn(onPlayerAdded, p) +end + +Players.PlayerRemoving:Connect(function(player) + stopFishing(player, false) + saveData(player) + profiles[player] = nil + loadedOk[player] = nil + passes[player] = nil +end) + +game:BindToClose(function() + for _, p in ipairs(Players:GetPlayers()) do + saveData(p) + end +end) + +-- таймер зелий + автосохранение +task.spawn(function() + local t = 0 + while true do + task.wait(1) + t += 1 + for _, p in ipairs(Players:GetPlayers()) do + local data = profiles[p] + if data and data.boostUntil > os.time() - 2 then + updateStats(p) + end + end + if t % 60 == 0 then + for _, p in ipairs(Players:GetPlayers()) do + saveData(p) + end + end + end +end) +]]> + + + \ No newline at end of file diff --git a/install/5_FishingClient_StarterPlayerScripts.rbxmx b/install/5_FishingClient_StarterPlayerScripts.rbxmx new file mode 100644 index 0000000..41fb996 --- /dev/null +++ b/install/5_FishingClient_StarterPlayerScripts.rbxmx @@ -0,0 +1,1287 @@ + + + +FishingClient + StarterPlayer > StarterPlayerScripts +-- Интерфейс: HUD, сумка, коллекция с наградами, миры, задания, ежедневная награда, +-- магазин, улучшения, удача, донат, событие, мини-игра, атмосфера миров. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") +local UserInputService = game:GetService("UserInputService") +local MarketplaceService = game:GetService("MarketplaceService") +local Lighting = game:GetService("Lighting") + +local player = Players.LocalPlayer +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local remote = ReplicatedStorage:WaitForChild("GameEvent") + +---------------------------------------------------------------- стиль + +local C = { + bg = Color3.fromRGB(18, 24, 40), + panel = Color3.fromRGB(30, 38, 62), + panel2 = Color3.fromRGB(44, 56, 90), + gold = Color3.fromRGB(255, 200, 70), + green = Color3.fromRGB(60, 190, 95), + blue = Color3.fromRGB(60, 135, 230), + red = Color3.fromRGB(215, 65, 65), + purple = Color3.fromRGB(150, 90, 220), + grey = Color3.fromRGB(75, 82, 102), + text = Color3.new(1, 1, 1), + muted = Color3.fromRGB(170, 180, 205), + line = Color3.fromRGB(90, 110, 165), +} +local TITLE = Enum.Font.FredokaOne +local BODY = Enum.Font.GothamBold +local BODY2 = Enum.Font.GothamMedium +local WHITE, BLACK = Color3.new(1, 1, 1), Color3.new(0, 0, 0) +local DING = "rbxasset://sounds/electronicpingshort.wav" + +---------------------------------------------------------------- помощники UI + +local function new(class, props, children) + local obj = Instance.new(class) + local parent + for k, v in pairs(props or {}) do + if k == "Parent" then + parent = v + else + obj[k] = v + end + end + for _, c in ipairs(children or {}) do + c.Parent = obj + end + if parent then + obj.Parent = parent + end + return obj +end +local function corner(r) + return new("UICorner", { CornerRadius = UDim.new(0, r or 10) }) +end +local function stroke(color, th, tr) + return new("UIStroke", { Color = color, Thickness = th or 2, Transparency = tr or 0, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }) +end +local function gradient(a, b, rot) + return new("UIGradient", { Color = ColorSequence.new(a, b), Rotation = rot or 90 }) +end +local function text(props) + local d = { + BackgroundTransparency = 1, Font = BODY, TextColor3 = C.text, TextSize = 16, + TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Center, + } + for k, v in pairs(props) do + d[k] = v + end + return new("TextLabel", d) +end +local function btn(props, onClick) + local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "" } + for k, v in pairs(props) do + d[k] = v + end + local b = new("TextButton", d, { corner(10), new("UIGradient", { Color = ColorSequence.new(WHITE, Color3.fromRGB(195, 195, 195)), Rotation = 90 }) }) + if onClick then + b.MouseButton1Click:Connect(onClick) + end + return b +end +local function clear(container) + for _, c in ipairs(container:GetChildren()) do + if c:IsA("GuiObject") then + c:Destroy() + end + end +end +local function fmt(n) + local s = tostring(math.floor(n)) + local out = s:reverse():gsub("(%d%d%d)", "%1 "):reverse() + return (out:gsub("^ ", "")) +end +local function stars(n) + return string.rep("★", n) .. string.rep("☆", Config.RodUpgrade.maxLevel - n) +end +local function hex(c) + return "#" .. c:ToHex() +end +local function timeStr(sec) + sec = math.max(0, math.floor(sec)) + return ("%d:%02d"):format(math.floor(sec / 60), sec % 60) +end +local function attrSet(name) + local set = {} + for id in string.gmatch(player:GetAttribute(name) or "", "[^,]+") do + set[id] = true + end + return set +end +local function rodLevels() + local t = {} + for id, lv in string.gmatch(player:GetAttribute("RodLevels") or "", "([^,:]+):(%d+)") do + t[id] = tonumber(lv) + end + return t +end +local function playUiSound(id, vol) + local s = Instance.new("Sound") + s.SoundId = id + s.Volume = vol or 0.5 + s.Parent = workspace.CurrentCamera + s:Play() + game:GetService("Debris"):AddItem(s, 3) +end + +local function viewport(parent, model, dir, zoom) + local vf = new("ViewportFrame", { + Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, + Ambient = Color3.fromRGB(175, 175, 185), LightColor = WHITE, LightDirection = Vector3.new(-0.4, -1, -0.6), + Parent = parent, + }) + model.Parent = vf + local cf, size = model:GetBoundingBox() + local cam = Instance.new("Camera") + cam.FieldOfView = 30 + local dist = (size.Magnitude / 2) / math.tan(math.rad(15)) * (zoom or 0.9) + cam.CFrame = CFrame.lookAt(cf.Position + dir.Unit * dist, cf.Position) + cam.Parent = vf + vf.CurrentCamera = cam + return vf +end +local FISH_VIEW = Vector3.new(0.12, 0.15, 1) +local ROD_VIEW = Vector3.new(1, 0.1, 0.05) +local BAG_VIEW = Vector3.new(0.6, 0.25, 1) + +local function silhouette(model) + for _, p in ipairs(model:GetDescendants()) do + if p:IsA("BasePart") then + p.Color = Color3.fromRGB(10, 12, 20) + p.Material = Enum.Material.SmoothPlastic + elseif p:IsA("ParticleEmitter") or p:IsA("PointLight") then + p:Destroy() + end + end + return model +end + +---------------------------------------------------------------- корень + +local gui = new("ScreenGui", { + Name = "FishingUI", ResetOnSpawn = false, IgnoreGuiInset = false, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), +}) + +---------------------------------------------------------------- HUD + +local hud = new("Frame", { + Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = gui, +}, { corner(16), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90), + new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14), PaddingTop = UDim.new(0, 10) }) }) +local coinsText = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 30, TextColor3 = C.gold, Text = "💰 0", TextStrokeTransparency = 0.6, Parent = hud }) +local lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Parent = hud }, + { corner(18), gradient(Color3.fromRGB(255, 225, 110), Color3.fromRGB(235, 145, 30), 90), stroke(Color3.fromRGB(120, 70, 10), 2, 0.2) }) +local lvlText = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = Color3.fromRGB(70, 40, 0), Text = "1", Parent = lvlBadge }) +local xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = hud }, { corner(9) }) +local xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = xpBack }, { corner(9), gradient(Color3.fromRGB(110, 225, 255), Color3.fromRGB(60, 110, 255), 0) }) +local xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = xpBack }) +local luckText = text({ Size = UDim2.new(1, 0, 0, 22), Position = UDim2.fromOffset(0, 82), TextSize = 16, RichText = true, TextColor3 = Color3.fromRGB(130, 255, 150), Text = "", Parent = hud }) +local bagText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud }) +local rodText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128), TextSize = 14, Font = BODY2, TextColor3 = C.muted, RichText = true, Text = "", Parent = hud }) + +-- баннер события (справа сверху) +local eventBanner = new("Frame", { + Size = UDim2.fromOffset(280, 58), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(14), stroke(C.gold, 2, 0.1), gradient(Color3.fromRGB(90, 60, 20), C.bg, 90) }) +local eventTitle = text({ Size = UDim2.new(1, -20, 0, 26), Position = UDim2.fromOffset(12, 4), Font = TITLE, TextSize = 19, TextColor3 = C.gold, Text = "", Parent = eventBanner }) +local eventDesc = text({ Size = UDim2.new(1, -20, 0, 20), Position = UDim2.fromOffset(12, 30), Font = BODY2, TextSize = 13, TextColor3 = C.text, Text = "", Parent = eventBanner }) + +-- кнопки слева +local side = new("Frame", { + Size = UDim2.fromOffset(70, 380), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 12, 0.5, 60), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + +local sideDots = {} +local function sideButton(order, icon, label, key, color, onClick) + local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = color, LayoutOrder = order, Parent = side }, onClick) + stroke(color:Lerp(BLACK, 0.45), 3).Parent = b + text({ Size = UDim2.new(1, 0, 0, 36), Position = UDim2.fromOffset(0, 3), TextSize = 28, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b }) + text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 44), Font = TITLE, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeTransparency = 0.5, Parent = b }) + if key and not UserInputService.TouchEnabled then + local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.new(1, -14, 0, -6), BackgroundColor3 = C.bg, Parent = b }, { corner(6), stroke(C.gold, 1.5) }) + text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = key, Parent = tag }) + end + local dot = new("Frame", { Size = UDim2.fromOffset(16, 16), Position = UDim2.new(0, -5, 0, -5), BackgroundColor3 = C.red, Visible = false, ZIndex = 3, Parent = b }, { corner(8), stroke(WHITE, 2) }) + sideDots[label] = dot + return b +end + +---------------------------------------------------------------- уведомления + +local toasts = new("Frame", { + Size = UDim2.new(0, 560, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) }) +local toastOrder = 0 +local toastTimers = {} + +local function notify(msg, color) + -- такое же сообщение уже на экране — не дублируем, а продлеваем его + for _, c in ipairs(toasts:GetChildren()) do + if c:IsA("Frame") and c:GetAttribute("Msg") == msg then + toastTimers[c] = (toastTimers[c] or 0) + 1 + local my = toastTimers[c] + task.delay(3.2, function() + if c.Parent and toastTimers[c] == my then + c:Destroy() + end + end) + return + end + end + toastOrder += 1 + local items = {} + for _, c in ipairs(toasts:GetChildren()) do + if c:IsA("Frame") then + table.insert(items, c) + end + end + if #items >= 3 then + items[1]:Destroy() + end + local t = new("Frame", { + Size = UDim2.new(0, 0, 0, 38), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.bg, + BackgroundTransparency = 0.15, LayoutOrder = toastOrder, Parent = toasts, + }, { corner(12), stroke(color or WHITE, 2, 0.2), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingRight = UDim.new(0, 16) }) }) + local l = text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 19, TextColor3 = color or WHITE, Text = msg, Parent = t }) + t:SetAttribute("Msg", msg) + toastTimers[t] = 0 + task.delay(3.2, function() + if t.Parent and toastTimers[t] == 0 then + TweenService:Create(t, TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play() + TweenService:Create(l, TweenInfo.new(0.4), { TextTransparency = 1 }):Play() + task.wait(0.45) + t:Destroy() + end + end) +end + +-- карточка пойманной рыбы +local catchCard = new("Frame", { + Size = UDim2.fromOffset(400, 128), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, -220), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(18) }) +local catchStroke = stroke(WHITE, 3) +catchStroke.Parent = catchCard +local catchGrad = gradient(C.panel2, C.bg, 90) +catchGrad.Parent = catchCard +local catchView = new("Frame", { Size = UDim2.fromOffset(130, 108), Position = UDim2.fromOffset(10, 10), BackgroundColor3 = C.bg, BackgroundTransparency = 0.3, Parent = catchCard }, { corner(14) }) +local catchHeader = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 10), Font = TITLE, TextSize = 15, TextColor3 = C.muted, Text = "", Parent = catchCard }) +local catchName = text({ Size = UDim2.new(1, -160, 0, 30), Position = UDim2.fromOffset(152, 30), Font = TITLE, TextSize = 26, Text = "", TextStrokeTransparency = 0.6, Parent = catchCard }) +local catchInfo = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 64), TextSize = 15, RichText = true, Text = "", Parent = catchCard }) +local catchValue = text({ Size = UDim2.new(1, -160, 0, 26), Position = UDim2.fromOffset(152, 90), Font = TITLE, TextSize = 21, TextColor3 = C.gold, Text = "", Parent = catchCard }) +local catchToken = 0 + +local function showCatch(fish, extra) + catchToken += 1 + local my = catchToken + local r = Config.Rarities[fish.rarity] + local mut = fish.mutation and Config.Find(Config.Mutations, fish.mutation) + clear(catchView) + viewport(catchView, Models.buildFish(fish.id, fish.mutation, 1, true), FISH_VIEW, 0.75) + catchStroke.Color = mut and mut.color or r.color + catchGrad.Color = ColorSequence.new(r.color:Lerp(C.bg, 0.55), C.bg) + catchHeader.Text = extra and extra.new and "🆕 НОВЫЙ ВИД! Опыт x2" or (extra and extra.record and "🏆 НОВЫЙ РЕКОРД!" or "ПОЙМАНА РЫБА") + catchHeader.TextColor3 = (extra and (extra.new or extra.record)) and C.gold or C.muted + catchName.Text = fish.name + catchName.TextColor3 = r.color + catchInfo.Text = ("%s%s · %.2f кг"):format( + hex(r.color), r.name, mut and (" · " .. mut.name .. " x" .. mut.mult .. "") or "", fish.weight) + catchValue.Text = ("💰 %s ⭐ +%d XP"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1)) + catchCard.Visible = true + TweenService:Create(catchCard, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Position = UDim2.new(0.5, 0, 0, 120) }):Play() + task.delay(3.4, function() + if my == catchToken then + local tw = TweenService:Create(catchCard, TweenInfo.new(0.35, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Position = UDim2.new(0.5, 0, 0, -220) }) + tw:Play() + tw.Completed:Wait() + if my == catchToken then + catchCard.Visible = false + end + end + end) +end + +local function floatText(msg, color) + local l = text({ + Size = UDim2.fromOffset(400, 60), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.42), + Font = TITLE, TextSize = 46, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = color, + TextStrokeTransparency = 0.2, Text = msg, Parent = gui, + }) + TweenService:Create(l, TweenInfo.new(1.4, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, 0.3), TextTransparency = 1, TextStrokeTransparency = 1 }):Play() + task.delay(1.5, function() + l:Destroy() + end) +end + +---------------------------------------------------------------- статус и мини-игра + +local statusLabel = text({ + Size = UDim2.fromOffset(460, 34), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110), + Font = TITLE, TextSize = 22, TextXAlignment = Enum.TextXAlignment.Center, TextStrokeTransparency = 0.3, + Text = "🎣 Ждём поклёвку… (клик — смотать)", Visible = false, Parent = gui, +}) +local mgFrame = new("Frame", { + Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(16), stroke(C.gold, 2.5, 0.1), gradient(C.panel2, C.bg, 90) }) +text({ + Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 24, + TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, TextStrokeTransparency = 0.5, + Text = "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame, +}) +local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = Color3.fromRGB(22, 28, 46), ClipsDescendants = true, Parent = mgFrame }, { corner(9), stroke(BLACK, 1.5, 0.4) }) +local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(130, 245, 150), Color3.fromRGB(35, 165, 75), 90) }) +local markerF = new("Frame", { Size = UDim2.new(0, 8, 1, 4), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0, 0.5), BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar }, { corner(4), stroke(BLACK, 2) }) +local pipsText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.fromOffset(15, 84), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = mgFrame }) +local missText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.new(0.5, 0, 0, 84), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = "", Parent = mgFrame }) +local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.fromOffset(15, 112), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = mgFrame }, { corner(3) }) + +---------------------------------------------------------------- окна + +local openWindow = nil + +local function makeWindow(title, accent, tabs) + local w = { pages = {}, tabButtons = {}, current = nil } + local frame = new("Frame", { + Size = UDim2.fromScale(0.92, 0.82), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.53), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, + }, { corner(20), stroke(accent, 3, 0.05), gradient(C.panel, C.bg, 90), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) }) + local scale = new("UIScale", { Parent = frame }) + local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundColor3 = WHITE, Parent = frame }, { corner(20), gradient(accent, accent:Lerp(BLACK, 0.35), 90) }) + new("Frame", { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 1, -20), BackgroundColor3 = accent:Lerp(BLACK, 0.3), BorderSizePixel = 0, Parent = header }) + text({ Size = UDim2.new(1, -80, 1, 0), Position = UDim2.fromOffset(20, 0), Font = TITLE, TextSize = 30, Text = title, TextStrokeTransparency = 0.5, ZIndex = 2, Parent = header }) + btn({ Size = UDim2.fromOffset(42, 42), Position = UDim2.new(1, -52, 0, 7), BackgroundColor3 = C.red, Text = "✕", TextSize = 22, ZIndex = 3, Parent = header }, function() + w.close() + end) + local hasTabs = #tabs > 1 + local tabBar = new("Frame", { Size = UDim2.new(1, -28, 0, 42), Position = UDim2.fromOffset(14, 66), BackgroundTransparency = 1, Visible = hasTabs, Parent = frame }, + { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + local top = hasTabs and 116 or 68 + local body = new("Frame", { Size = UDim2.new(1, -28, 1, -(top + 12)), Position = UDim2.fromOffset(14, top), BackgroundTransparency = 1, Parent = frame }) + w.frame = frame + + function w.setTab(id) + w.current = id + for k, page in pairs(w.pages) do + page.Visible = (k == id) + end + for k, b in pairs(w.tabButtons) do + b.BackgroundColor3 = (k == id) and accent or C.panel2 + end + if w.render then + w.render(id) + end + end + for i, t in ipairs(tabs) do + w.pages[t.id] = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Visible = false, Parent = body }) + w.tabButtons[t.id] = btn({ Size = UDim2.new(1 / #tabs, -8, 1, 0), Text = t.label, TextSize = 18, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = tabBar }, function() + w.setTab(t.id) + end) + end + function w.open(tab) + if openWindow and openWindow ~= w then + openWindow.close() + end + openWindow = w + frame.Visible = true + scale.Scale = 0.85 + TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() + w.setTab(tab or w.current or tabs[1].id) + end + function w.close() + frame.Visible = false + if openWindow == w then + openWindow = nil + end + end + function w.isOpen() + return frame.Visible + end + function w.toggle(tab) + if frame.Visible and (tab == nil or w.current == tab) then + w.close() + else + w.open(tab) + end + end + function w.refresh() + if frame.Visible and w.render then + w.render(w.current) + end + end + return w +end + +local function scrollArea(parent, cell, topOffset) + local sf = new("ScrollingFrame", { + Size = UDim2.new(1, 0, 1, -(topOffset or 0)), Position = UDim2.fromOffset(0, topOffset or 0), + BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 6, ScrollBarImageColor3 = C.muted, + AutomaticCanvasSize = Enum.AutomaticSize.Y, CanvasSize = UDim2.new(), Parent = parent, + }, { new("UIPadding", { PaddingRight = UDim.new(0, 10), PaddingTop = UDim.new(0, 4), PaddingLeft = UDim.new(0, 2), PaddingBottom = UDim.new(0, 8) }) }) + if cell then + new("UIGridLayout", { CellSize = cell, CellPadding = UDim2.fromOffset(10, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf }) + else + new("UIListLayout", { Padding = UDim.new(0, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf }) + end + return sf +end + +local function itemRow(parent, order, o) + local row = new("Frame", { Size = UDim2.new(1, -4, 0, 100), BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(14), stroke(o.strokeColor or C.line, 2, o.strokeColor and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) + local view = new("Frame", { Size = UDim2.fromOffset(124, 84), Position = UDim2.fromOffset(8, 8), BackgroundColor3 = o.iconBg or C.bg, Parent = row }, { corner(10) }) + if o.model then + viewport(view, o.model, o.dir, o.zoom) + elseif o.icon then + text({ Size = UDim2.fromScale(1, 1), TextSize = 48, TextXAlignment = Enum.TextXAlignment.Center, Text = o.icon, Parent = view }) + end + text({ Size = UDim2.new(1, -300, 0, 28), Position = UDim2.fromOffset(144, 8), Font = TITLE, TextSize = 22, Text = o.title, TextColor3 = o.titleColor or C.text, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) + text({ + Size = UDim2.new(1, -300, 0, 56), Position = UDim2.fromOffset(144, 38), Font = BODY2, TextSize = 14, TextColor3 = C.muted, + RichText = true, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = o.lines, Parent = row, + }) + btn({ + Size = UDim2.fromOffset(140, 50), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), + Text = o.buttonText, BackgroundColor3 = o.buttonColor, AutoButtonColor = o.active, TextSize = 19, Parent = row, + }, o.active and o.onClick or nil) + return row +end + +local function progressBar(parent, pos, size, frac, color) + local back = new("Frame", { Size = size, Position = pos, BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = parent }, { corner(7) }) + new("Frame", { Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1), BackgroundColor3 = color, Parent = back }, { corner(7) }) + return back +end + +---------------------------------------------------------------- данные с сервера + +local inventory, discovered, claimed = {}, {}, {} +local quests, daily = {}, { available = false, streak = 0, nextStreak = 1 } + +---------------------------------------------------------------- магазин + +local shopWin = makeWindow("🎣 Магазин Михалыча", Color3.fromRGB(215, 120, 40), { + { id = "rods", label = "🎣 Удочки" }, + { id = "upgrade", label = "✨ Улучшение" }, + { id = "bags", label = "🎒 Сумки" }, + { id = "luck", label = "🍀 Удача" }, +}) +local shopLists = { + rods = scrollArea(shopWin.pages.rods), + upgrade = scrollArea(shopWin.pages.upgrade), + bags = scrollArea(shopWin.pages.bags), + luck = scrollArea(shopWin.pages.luck), +} + +local function statLine(s) + return ("🍀 Удача +%d%% ⏱ Клёв x%.2f 🎯 Зона %d%%"):format(math.floor(s.luck * 100 + 0.5), s.speed, math.floor(s.zone * 100 + 0.5)) +end +local function buyButton(price, level, myLevel, coins) + if myLevel < level then + return "🔒 Ур. " .. level, C.grey, false + end + return "💰 " .. fmt(price), coins >= price and C.green or Color3.fromRGB(150, 95, 60), true +end + +shopWin.render = function(tab) + local list = shopLists[tab] + if not list then + return + end + clear(list) + local myLevel = player:GetAttribute("Level") or 1 + local coins = player:GetAttribute("Coins") or 0 + local levels = rodLevels() + + if tab == "rods" then + local owned = attrSet("OwnedRods") + for i, rod in ipairs(Config.Rods) do + local lv = levels[rod.id] or 0 + local equipped = player:GetAttribute("Rod") == rod.id + local bText, bColor, active + if equipped then + bText, bColor, active = "Надето ✓", C.grey, false + elseif owned[rod.id] then + bText, bColor, active = "Надеть", C.blue, true + else + bText, bColor, active = buyButton(rod.price, rod.level, myLevel, coins) + end + itemRow(list, i, { + model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + title = rod.name .. (owned[rod.id] and (" " .. stars(lv) .. "") or ""), + lines = statLine(Config.RodStats(rod.id, lv)) .. "\n" .. (owned[rod.id] and "Куплена" or ("Нужен уровень " .. rod.level)), + strokeColor = equipped and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Rod", rod.id) + end, + }) + end + elseif tab == "upgrade" then + text({ + Size = UDim2.new(1, -4, 0, 40), LayoutOrder = 0, TextSize = 14, Font = BODY2, TextColor3 = C.muted, TextWrapped = true, + Text = "Каждое улучшение даёт +" .. math.floor(Config.RodUpgrade.luckPerLevel * 100) .. "% удачи, ускоряет клёв и расширяет зелёную зону. Максимум — " .. stars(Config.RodUpgrade.maxLevel), + Parent = list, + }) + local owned = attrSet("OwnedRods") + local order = 0 + for _, rod in ipairs(Config.Rods) do + if owned[rod.id] then + order += 1 + local lv = levels[rod.id] or 0 + local now = Config.RodStats(rod.id, lv) + local maxed = lv >= Config.RodUpgrade.maxLevel + local lines + if maxed then + lines = statLine(now) .. "\nМаксимальное улучшение!" + else + local nxt = Config.RodStats(rod.id, lv + 1) + lines = ("🍀 +%d%% → +%d%% ⏱ x%.2f → x%.2f\n🎯 %d%% → %d%%"):format( + math.floor(now.luck * 100 + 0.5), math.floor(nxt.luck * 100 + 0.5), now.speed, nxt.speed, + math.floor(now.zone * 100 + 0.5), math.floor(nxt.zone * 100 + 0.5)) + end + local cost = Config.UpgradeCost(rod, lv) + itemRow(list, order, { + model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + title = rod.name .. " " .. stars(lv) .. "", + lines = lines, + strokeColor = player:GetAttribute("Rod") == rod.id and C.gold or nil, + buttonText = maxed and "MAX ★" or ("✨ " .. fmt(cost)), + buttonColor = maxed and C.grey or (coins >= cost and Color3.fromRGB(190, 120, 255) or Color3.fromRGB(110, 80, 140)), + active = not maxed, + onClick = function() + remote:FireServer("Buy", "Upgrade", rod.id) + end, + }) + end + end + elseif tab == "bags" then + local owned = attrSet("OwnedBags") + local bonus = attrSet("Passes").BigBag and 100 or 0 + for i, bag in ipairs(Config.Bags) do + local equipped = player:GetAttribute("Bag") == bag.id + local bText, bColor, active + if equipped then + bText, bColor, active = "Надето ✓", C.grey, false + elseif owned[bag.id] then + bText, bColor, active = "Надеть", C.blue, true + else + bText, bColor, active = buyButton(bag.price, bag.level, myLevel, coins) + end + itemRow(list, i, { + model = Models.buildBag(bag.id, true), dir = BAG_VIEW, zoom = 0.8, + title = bag.name, + lines = ("🎒 Вмещает %d рыб%s\n%s"):format(bag.capacity + bonus, bonus > 0 and " (с пропуском)" or "", owned[bag.id] and "Куплена" or ("Нужен уровень " .. bag.level)), + strokeColor = equipped and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Bag", bag.id) + end, + }) + end + elseif tab == "luck" then + local lv = levels[player:GetAttribute("Rod") or "Basic"] or 0 + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") or Config.Rods[1] + local boost = player:GetAttribute("BoostBonus") or 0 + local total = player:GetAttribute("Luck") or 100 + local ps = attrSet("Passes") + local evId = workspace:GetAttribute("Event") + local event = evId and Config.Find(Config.Events, evId) + local mutLine = {} + for _, m in ipairs(Config.Mutations) do + table.insert(mutLine, ("%s %.1f%%"):format(hex(m.color), m.name, math.min(100, m.chance * total / 100 * ((event and event.mutation) or 1) * 100))) + end + local lines = { + ("🍀 Твоя удача: %d%%"):format(total), + ("Базовая 100%% · 🎣 Удочка +%d%% · ✨ Улучшения +%d%%"):format(math.floor(rod.luck * 100 + 0.5), math.floor(lv * Config.RodUpgrade.luckPerLevel * 100 + 0.5)), + ("⭐ Уровень +%d%% · 🏆 Мастерство миров +%d%%"):format(math.floor(((player:GetAttribute("Level") or 1) - 1) * Config.LuckPerPlayerLevel * 100 + 0.5), math.floor((player:GetAttribute("Mastery") or 0) * Config.MasteryLuck * 100 + 0.5)), + ("🧪 Зелье +%d%%%s · 👑 Пропуска +%d%%%s"):format(math.floor(boost * 100 + 0.5), boost > 0 and (" (" .. timeStr(player:GetAttribute("BoostLeft") or 0) .. ")") or "", + (ps.VIP and 25 or 0) + (ps.LuckyCharm and 50 or 0), (event and event.luck) and (" · 🎉 Событие +" .. event.luck * 100 .. "%") or ""), + "Шанс мутаций: " .. table.concat(mutLine, " · "), + } + local info = new("Frame", { Size = UDim2.new(1, -4, 0, 160), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = list }, + { corner(14), stroke(Color3.fromRGB(90, 220, 120), 2, 0.2), gradient(Color3.fromRGB(35, 70, 55), C.panel, 90), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingTop = UDim.new(0, 10), PaddingRight = UDim.new(0, 16) }) }) + text({ Size = UDim2.fromScale(1, 1), TextSize = 15, RichText = true, TextYAlignment = Enum.TextYAlignment.Top, TextWrapped = true, Text = table.concat(lines, "\n"), Parent = info }) + for i, p in ipairs(Config.Potions) do + local bText, bColor, active = buyButton(p.price, p.level or 1, myLevel, coins) + itemRow(list, i, { + icon = "🧪", iconBg = p.color:Lerp(C.bg, 0.6), + title = p.name, titleColor = p.color, + lines = ("Удача +%d%% на %d мин.\nРедкая рыба и мутации попадаются чаще!"):format(p.bonus * 100, p.duration / 60), + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Potion", p.id) + end, + }) + end + end +end + +---------------------------------------------------------------- сумка и коллекция + +local bagWin = makeWindow("🎒 Сумка", Color3.fromRGB(60, 140, 220), { + { id = "fish", label = "🐟 Улов" }, + { id = "dex", label = "📖 Коллекция" }, +}) + +local fishHeader = new("Frame", { Size = UDim2.new(1, 0, 0, 50), BackgroundColor3 = WHITE, Parent = bagWin.pages.fish }, { corner(12), gradient(C.panel2, C.panel, 90) }) +local fishSummary = text({ Size = UDim2.new(1, -200, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = fishHeader }) +btn({ Size = UDim2.fromOffset(170, 38), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.green, Text = "💰 Продать всё", TextSize = 18, Parent = fishHeader }, function() + remote:FireServer("SellAll") +end) +local fishGrid = scrollArea(bagWin.pages.fish, UDim2.fromOffset(132, 176), 60) + +local dexWorld = "World1" +local dexTabs = new("Frame", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, Parent = bagWin.pages.dex }, + { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8) }) }) +local dexList = scrollArea(bagWin.pages.dex, nil, 46) +local dexTabButtons = {} + +local function fishCard(parent, order, rarityColor, strokeColor) + return new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(14), stroke(strokeColor or rarityColor, 2.5, 0.05), gradient(rarityColor:Lerp(C.bg, 0.55), C.panel, 90) }) +end + +local function rewardButton(parent, state, label, onClick) + local color = (state == "ready") and C.green or C.grey + return btn({ + Size = UDim2.fromOffset(150, 34), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), + BackgroundColor3 = color, AutoButtonColor = state == "ready", Text = label, TextSize = 16, Parent = parent, + }, state == "ready" and onClick or nil) +end + +local function renderDex() + clear(dexList) + for id, b in pairs(dexTabButtons) do + b.BackgroundColor3 = (id == dexWorld) and C.purple or C.panel2 + end + local world = Config.Find(Config.Worlds, dexWorld) + local all = Config.Zones[dexWorld].fish + local found = 0 + for _, f in ipairs(all) do + if discovered[f.id] then + found += 1 + end + end + + -- мастерство мира + local head = new("Frame", { Size = UDim2.new(1, -4, 0, 56), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = dexList }, + { corner(12), stroke(C.gold, 2, 0.3), gradient(Color3.fromRGB(70, 55, 20), C.panel, 90) }) + text({ + Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 17, RichText = true, TextWrapped = true, + Text = ("%s %s — %d / %d\nСобери всех: +%s 💰 и +%d%% удачи навсегда"):format( + world.icon, world.name, found, #all, fmt(Config.MasteryCoins * world.mult), math.floor(Config.MasteryLuck * 100 + 0.5)), + Parent = head, + }) + local mKey = dexWorld .. ":Master" + rewardButton(head, claimed[mKey] and "done" or (found == #all and "ready" or "locked"), + claimed[mKey] and "Получено ✓" or (found == #all and "🏆 Забрать" or "🔒 Не собрано"), function() + remote:FireServer("ClaimCollection", dexWorld, "Master") + end) + + for ri, rarity in ipairs(Config.RarityOrder) do + local group = {} + for _, f in ipairs(all) do + if f.rarity == rarity then + table.insert(group, f) + end + end + if #group > 0 then + local r = Config.Rarities[rarity] + local have = 0 + for _, f in ipairs(group) do + if discovered[f.id] then + have += 1 + end + end + local section = new("Frame", { Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = ri, Parent = dexList }, + { new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }) }) + local hdr = new("Frame", { Size = UDim2.new(1, 0, 0, 44), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = section }, + { corner(10), gradient(r.color:Lerp(C.bg, 0.5), C.panel, 0) }) + local reward = Config.CollectionRewards[rarity] + text({ + Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(12, 0), Font = TITLE, TextSize = 17, RichText = true, + Text = ("%s %d/%d +%s 💰 +%s XP"):format( + hex(r.color), r.name, have, #group, fmt(reward.coins * world.mult), fmt(reward.xp * world.mult)), + Parent = hdr, + }) + local key = dexWorld .. ":" .. rarity + rewardButton(hdr, claimed[key] and "done" or (have == #group and "ready" or "locked"), + claimed[key] and "Получено ✓" or (have == #group and "🎁 Забрать" or ("🔒 " .. have .. "/" .. #group)), function() + remote:FireServer("ClaimCollection", dexWorld, rarity) + end) + local grid = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 1, Parent = section }, + { new("UIGridLayout", { CellSize = UDim2.fromOffset(124, 150), CellPadding = UDim2.fromOffset(8, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + for i, f in ipairs(group) do + local rec = discovered[f.id] + local card = fishCard(grid, i, rec and r.color or C.grey) + local view = new("Frame", { Size = UDim2.new(1, -12, 0, 76), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) + local model = Models.buildFish(f.id, nil, 1, true) + viewport(view, rec and model or silhouette(model), FISH_VIEW, 0.72) + text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 84), Font = TITLE, TextSize = 15, TextColor3 = rec and r.color or C.muted, Text = rec and f.name or "???", TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) + text({ + Size = UDim2.new(1, -10, 0, 40), Position = UDim2.fromOffset(6, 104), Font = BODY2, TextSize = 12, TextColor3 = C.muted, TextWrapped = true, + TextYAlignment = Enum.TextYAlignment.Top, + Text = rec and ("Поймано: %d\nРекорд: %.2f кг"):format(rec.count, rec.best) or "Ещё не поймана", Parent = card, + }) + end + end + end +end + +for i, w in ipairs(Config.Worlds) do + if not w.soon then + dexTabButtons[w.id] = btn({ Size = UDim2.new(0, 170, 1, 0), Text = w.icon .. " " .. w.name, TextSize = 15, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = dexTabs }, function() + dexWorld = w.id + renderDex() + end) + end +end + +bagWin.render = function(tab) + if tab == "fish" then + clear(fishGrid) + local total = 0 + for _, it in ipairs(inventory) do + total += it.value + end + fishSummary.Text = ("🐟 %d / %d · 💰 ≈%s"):format(#inventory, player:GetAttribute("BagCap") or 0, fmt(player:GetAttribute("BagValue") or total)) + if #inventory == 0 then + text({ Size = UDim2.fromOffset(400, 60), Font = TITLE, TextSize = 20, TextColor3 = C.muted, TextWrapped = true, Text = "Сумка пуста. Иди к воде и поймай рыбу! 🎣", Parent = fishGrid }) + return + end + local sorted = table.clone(inventory) + table.sort(sorted, function(a, b) + return a.value > b.value + end) + for i, it in ipairs(sorted) do + local r = Config.Rarities[it.rarity] or Config.Rarities.Common + local mut = it.mutation and Config.Find(Config.Mutations, it.mutation) + local card = fishCard(fishGrid, i, r.color, mut and mut.color) + local view = new("Frame", { Size = UDim2.new(1, -12, 0, 84), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) + viewport(view, Models.buildFish(it.id, it.mutation, 1, true), FISH_VIEW, 0.72) + if mut then + local tag = new("Frame", { Size = UDim2.fromOffset(0, 20), AutomaticSize = Enum.AutomaticSize.X, Position = UDim2.fromOffset(6, 6), BackgroundColor3 = mut.color, ZIndex = 3, Parent = card }, + { corner(6), new("UIPadding", { PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }) }) + text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 13, TextColor3 = C.bg, Text = mut.name, ZIndex = 4, Parent = tag }) + end + text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 92), Font = TITLE, TextSize = 16, TextColor3 = r.color, Text = it.name, TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) + text({ Size = UDim2.new(1, -10, 0, 16), Position = UDim2.fromOffset(6, 112), Font = BODY2, TextSize = 13, TextColor3 = C.muted, Text = ("%.2f кг · %s"):format(it.weight, r.name), Parent = card }) + btn({ Size = UDim2.new(1, -12, 0, 32), Position = UDim2.fromOffset(6, 136), BackgroundColor3 = C.green, Text = "💰 " .. fmt(it.value), TextSize = 17, Parent = card }, function() + remote:FireServer("SellOne", it.uid) + end) + end + elseif tab == "dex" then + renderDex() + end +end + +---------------------------------------------------------------- миры + +local worldsWin = makeWindow("🌍 Миры", Color3.fromRGB(40, 160, 200), { { id = "list", label = "Миры" } }) +local worldsList = scrollArea(worldsWin.pages.list) + +local function currentWorld() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + return hrp and Config.WorldAt(hrp.Position) +end + +worldsWin.render = function() + clear(worldsList) + local myLevel = player:GetAttribute("Level") or 1 + local here = currentWorld() + itemRow(worldsList, 0, { + icon = "🏠", iconBg = Color3.fromRGB(90, 70, 30), + title = "Лобби", titleColor = C.gold, + lines = "Магазин удочек, скупка, донат-лавки и ежедневный сундук.", + buttonText = here == nil and "Вы здесь" or "🌀 Телепорт", buttonColor = here == nil and C.grey or C.blue, active = here ~= nil, + onClick = function() + remote:FireServer("Teleport", "Lobby") + worldsWin.close() + end, + }) + for i, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + local total, found = 0, 0 + if zone then + for _, f in ipairs(zone.fish) do + total += 1 + if discovered[f.id] then + found += 1 + end + end + end + local bText, bColor, active + if w.soon then + bText, bColor, active = "Скоро…", C.grey, false + elseif myLevel < w.level then + bText, bColor, active = "🔒 Ур. " .. w.level, C.grey, false + elseif here and here.id == w.id then + bText, bColor, active = "Вы здесь", C.grey, false + else + bText, bColor, active = "🌀 Телепорт", C.blue, true + end + itemRow(worldsList, i, { + icon = w.icon, iconBg = w.color:Lerp(C.bg, 0.6), + title = w.name, titleColor = w.color, + lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d · Рыб поймано: %d / %d · Награды x%d"):format(w.level, found, total, w.mult)), + strokeColor = (here and here.id == w.id) and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Teleport", w.id) + worldsWin.close() + end, + }) + end +end + +---------------------------------------------------------------- задания и ежедневная награда + +local questWin = makeWindow("📜 Задания", Color3.fromRGB(200, 140, 40), { + { id = "quests", label = "📜 Задания" }, + { id = "daily", label = "🎁 Ежедневно" }, +}) +local questList = scrollArea(questWin.pages.quests) +local dailyPage = questWin.pages.daily + +local function questText(q) + local t = Config.Quests[1] + for _, def in ipairs(Config.Quests) do + if def.kind == q.kind then + t = def + end + end + return string.find(t.text, "%%d") and t.text:format(q.goal) or t.text +end + +questWin.render = function(tab) + if tab == "quests" then + clear(questList) + text({ Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = BODY2, TextSize = 14, TextColor3 = C.muted, Text = "Выполняй задания — после награды появится новое.", Parent = questList }) + for i, q in ipairs(quests) do + local done = q.progress >= q.goal + local row = new("Frame", { Size = UDim2.new(1, -4, 0, 92), BackgroundColor3 = WHITE, LayoutOrder = i, Parent = questList }, + { corner(14), stroke(done and C.green or C.line, 2, done and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, -190, 0, 28), Position = UDim2.fromOffset(16, 8), Font = TITLE, TextSize = 19, Text = questText(q), TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) + progressBar(row, UDim2.fromOffset(16, 42), UDim2.new(1, -200, 0, 14), q.progress / q.goal, done and C.green or C.gold) + text({ Size = UDim2.new(1, -190, 0, 20), Position = UDim2.fromOffset(16, 62), Font = BODY2, TextSize = 13, TextColor3 = C.muted, RichText = true, + Text = ("%s / %s · +%s 💰 +%s XP"):format(fmt(q.progress), fmt(q.goal), fmt(q.coins), fmt(q.xp)), Parent = row }) + btn({ + Size = UDim2.fromOffset(150, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), + BackgroundColor3 = done and C.green or C.grey, AutoButtonColor = done, Text = done and "🎁 Забрать" or "В процессе", TextSize = 18, Parent = row, + }, done and function() + remote:FireServer("ClaimQuest", i) + end or nil) + end + elseif tab == "daily" then + clear(dailyPage) + local myLevel = player:GetAttribute("Level") or 1 + text({ + Size = UDim2.new(1, 0, 0, 30), Font = TITLE, TextSize = 20, RichText = true, + Text = ("🔥 Серия: %d дн. Заходи каждый день — награда растёт!"):format(daily.streak), Parent = dailyPage, + }) + local row = new("Frame", { Size = UDim2.new(1, 0, 0, 150), Position = UDim2.fromOffset(0, 40), BackgroundTransparency = 1, Parent = dailyPage }, + { new("UIGridLayout", { CellSize = UDim2.new(1 / 7, -8, 1, 0), CellPadding = UDim2.fromOffset(8, 0) }) }) + for d, r in ipairs(Config.DailyRewards) do + local isNext = d == daily.nextStreak and daily.available + local passed = d <= daily.streak and not (daily.available and daily.nextStreak == 1) + local cell = new("Frame", { BackgroundColor3 = WHITE, Parent = row }, + { corner(12), stroke(isNext and C.gold or C.line, isNext and 3 or 2, isNext and 0 or 0.4), gradient(isNext and Color3.fromRGB(90, 70, 20) or C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, 0, 0, 24), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Center, Text = "День " .. d, Parent = cell }) + text({ Size = UDim2.new(1, 0, 0, 44), Position = UDim2.fromOffset(0, 32), TextSize = 32, TextXAlignment = Enum.TextXAlignment.Center, Text = passed and "✅" or (r.potion and "🧪" or "💰"), Parent = cell }) + text({ + Size = UDim2.new(1, -6, 0, 50), Position = UDim2.fromOffset(3, 80), Font = BODY2, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = true, TextColor3 = C.gold, + Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. " 💰" .. (r.potion and "\n+ зелье" or ""), Parent = cell, + }) + end + btn({ + Size = UDim2.fromOffset(260, 54), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 210), + BackgroundColor3 = daily.available and C.green or C.grey, AutoButtonColor = daily.available, + Text = daily.available and "🎁 Забрать награду" or "Приходи завтра!", TextSize = 22, Parent = dailyPage, + }, daily.available and function() + remote:FireServer("ClaimDaily") + end or nil) + end +end + +---------------------------------------------------------------- донат + +local robuxWin = makeWindow("💎 Премиум", Color3.fromRGB(150, 80, 210), { + { id = "passes", label = "👑 Пропуска" }, + { id = "products", label = "🪙 Наборы" }, +}) +local robuxLists = { passes = scrollArea(robuxWin.pages.passes), products = scrollArea(robuxWin.pages.products) } + +robuxWin.render = function(tab) + local list = robuxLists[tab] + clear(list) + local owned = attrSet("Passes") + local items = tab == "passes" and Config.GamePasses or Config.Products + for i, it in ipairs(items) do + local has = tab == "passes" and owned[it.key] + itemRow(list, i, { + icon = it.icon, iconBg = Color3.fromRGB(70, 40, 100), + title = it.name, titleColor = C.gold, + lines = it.desc .. (tab == "passes" and "\nДействует навсегда" or ""), + strokeColor = has and C.gold or nil, + buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has, + onClick = function() + if not it.id or it.id == 0 then + notify("Товар ещё не настроен: впиши его ID в FishConfig", Color3.fromRGB(255, 200, 120)) + return + end + if tab == "passes" then + MarketplaceService:PromptGamePassPurchase(player, it.id) + else + MarketplaceService:PromptProductPurchase(player, it.id) + end + end, + }) + end +end + +---------------------------------------------------------------- боковые кнопки + +sideButton(1, "🎒", "Сумка", "B", Color3.fromRGB(60, 140, 220), function() + bagWin.toggle("fish") +end) +sideButton(2, "📖", "Рыбы", "C", Color3.fromRGB(150, 90, 220), function() + bagWin.toggle("dex") +end) +sideButton(3, "🌍", "Миры", "M", Color3.fromRGB(40, 160, 200), function() + worldsWin.toggle() +end) +sideButton(4, "📜", "Задания", "Q", Color3.fromRGB(210, 150, 40), function() + questWin.toggle() +end) +sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function() + robuxWin.toggle() +end) + +local function refreshDots() + local q = false + for _, quest in ipairs(quests) do + if quest.progress >= quest.goal then + q = true + end + end + sideDots["Задания"].Visible = q or daily.available + local c = false + for _, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + if zone then + for _, rarity in ipairs(Config.RarityOrder) do + local any, all = false, true + for _, f in ipairs(zone.fish) do + if f.rarity == rarity then + any = true + if not discovered[f.id] then + all = false + end + end + end + if any and all and not claimed[w.id .. ":" .. rarity] then + c = true + end + end + end + end + sideDots["Рыбы"].Visible = c +end + +---------------------------------------------------------------- HUD: обновление + +local function refreshHud() + local xp = player:GetAttribute("XP") or 0 + local need = player:GetAttribute("XPNeed") or 100 + coinsText.Text = "💰 " .. fmt(player:GetAttribute("Coins") or 0) + lvlText.Text = tostring(player:GetAttribute("Level") or 1) + xpText.Text = ("%d / %d XP"):format(xp, need) + TweenService:Create(xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play() + local boost = player:GetAttribute("BoostBonus") or 0 + luckText.Text = ("🍀 Удача %d%%%s"):format(player:GetAttribute("Luck") or 100, + boost > 0 and (" 🧪 +%d%% %s"):format(boost * 100, timeStr(player:GetAttribute("BoostLeft") or 0)) or "") + local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10 + bagText.Text = ("🎒 %d / %d · ≈ %s 💰"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0)) + bagText.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") + rodText.Text = ("🎣 %s %s"):format(rod and rod.name or "", stars(player:GetAttribute("RodLevel") or 0)) +end + +local pending = false +player.AttributeChanged:Connect(function(name) + refreshHud() + if name == "BoostLeft" and not (shopWin.isOpen() and shopWin.current == "luck") then + return + end + if not pending then + pending = true + task.defer(function() + pending = false + shopWin.refresh() + robuxWin.refresh() + if worldsWin.isOpen() then + worldsWin.refresh() + end + end) + end +end) +refreshHud() + +---------------------------------------------------------------- рыбалка + +local state = "idle" +local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 } + +local function setState(s) + state = s + statusLabel.Visible = (s == "waiting") + mgFrame.Visible = (s == "bite") +end +local function updatePips() + pipsText.Text = "🎯 " .. string.rep("●", mg.hits) .. string.rep("●", mg.need - mg.hits) + missText.Text = string.rep("✖", mg.misses) .. string.rep("❤️", mg.maxMisses - mg.misses) +end +local function flash(color) + bar.BackgroundColor3 = color + TweenService:Create(bar, TweenInfo.new(0.35), { BackgroundColor3 = Color3.fromRGB(22, 28, 46) }):Play() +end +local function placeZone() + mg.zoneStart = math.random() * (1 - mg.zoneWidth) + zoneF.Size = UDim2.fromScale(mg.zoneWidth, 1) + zoneF.Position = UDim2.fromScale(mg.zoneStart, 0) +end + +local function onActivate() + if state == "idle" then + setState("casting") + remote:FireServer("Cast") + elseif state == "waiting" then + remote:FireServer("Cancel") + setState("idle") + elseif state == "bite" then + local inZone = mg.pos >= mg.zoneStart and mg.pos <= mg.zoneStart + mg.zoneWidth + if inZone then + mg.hits += 1 + flash(Color3.fromRGB(60, 160, 80)) + if mg.hits >= mg.need then + setState("reeling") + remote:FireServer("Catch", true, mg.misses) + return + end + mg.speed *= 1.12 + placeZone() + else + mg.misses += 1 + flash(Color3.fromRGB(170, 50, 50)) + if mg.misses >= mg.maxMisses then + setState("reeling") + remote:FireServer("Catch", false, mg.misses) + return + end + end + updatePips() + end +end + +local hooked = setmetatable({}, { __mode = "k" }) +local function hookTool(tool) + if hooked[tool] or not tool:IsA("Tool") or not tool:GetAttribute("IsRod") then + return + end + hooked[tool] = true + tool.Activated:Connect(onActivate) + tool.Unequipped:Connect(function() + if state == "waiting" or state == "bite" or state == "casting" then + remote:FireServer("Cancel") + end + setState("idle") + end) +end +local function watch(container) + for _, c in ipairs(container:GetChildren()) do + hookTool(c) + end + container.ChildAdded:Connect(hookTool) +end +player.ChildAdded:Connect(function(c) + if c:IsA("Backpack") then + watch(c) + end +end) +if player:FindFirstChild("Backpack") then + watch(player.Backpack) +end +player.CharacterAdded:Connect(function(char) + setState("idle") + watch(char) +end) +if player.Character then + watch(player.Character) +end + +RunService.RenderStepped:Connect(function(dt) + if state ~= "bite" then + return + end + mg.pos += mg.dir * mg.speed * dt + if mg.pos >= 1 then + mg.pos, mg.dir = 1, -1 + elseif mg.pos <= 0 then + mg.pos, mg.dir = 0, 1 + end + markerF.Position = UDim2.fromScale(mg.pos, 0.5) + local left = math.max(0, mg.deadline - os.clock()) + timeBar.Size = UDim2.new(left / mg.timeout, -30 * left / mg.timeout, 0, 5) + if left <= 0 then + setState("reeling") + remote:FireServer("Catch", false, mg.misses) + end +end) + +UserInputService.InputBegan:Connect(function(input, processed) + if processed then + return + end + local k = input.KeyCode + if k == Enum.KeyCode.B then + bagWin.toggle("fish") + elseif k == Enum.KeyCode.C then + bagWin.toggle("dex") + elseif k == Enum.KeyCode.M then + worldsWin.toggle() + elseif k == Enum.KeyCode.Q then + questWin.toggle() + end +end) + +---------------------------------------------------------------- атмосфера миров (только у этого игрока) + +local snowPart = new("Part", { + Name = "SnowFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, + Transparency = 1, Size = Vector3.new(90, 1, 90), Parent = workspace, +}) +local snow = new("ParticleEmitter", { + Rate = 0, Lifetime = NumberRange.new(5, 7), Speed = NumberRange.new(4, 7), + EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(15, 15), + Size = NumberSequence.new(0.25), Color = ColorSequence.new(WHITE), LightEmission = 0.3, + Parent = snowPart, +}) +local lastWorldId = "none" +local terrain = workspace.Terrain +local defaultWater = Color3.fromRGB(20, 95, 115) + +local function applyAmbience(world) + local clock = (world and world.clock) or 14.5 + TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play() + terrain.WaterColor = (world and world.water) or defaultWater + local atm = Lighting:FindFirstChildOfClass("Atmosphere") + if atm then + local frost = world and world.id == "World3" + TweenService:Create(atm, TweenInfo.new(2), { + Density = frost and 0.38 or 0.25, + Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), + }):Play() + end + snow.Rate = (world and world.id == "World3") and 140 or 0 +end + +task.spawn(function() + while true do + local w = currentWorld() + local id = w and w.id or "lobby" + if id ~= lastWorldId then + lastWorldId = id + applyAmbience(w) + if w then + notify(w.icon .. " " .. w.name, w.color) + end + end + local cam = workspace.CurrentCamera + if cam then + snowPart.CFrame = CFrame.new(cam.CFrame.Position + Vector3.new(0, 25, 0)) + end + -- баннер события + local evId = workspace:GetAttribute("Event") + local event = evId and Config.Find(Config.Events, evId) + if event then + eventBanner.Visible = true + eventTitle.Text = event.name .. " " .. timeStr((workspace:GetAttribute("EventEnds") or 0) - workspace:GetServerTimeNow()) + eventDesc.Text = event.desc + else + eventBanner.Visible = false + end + task.wait(0.5) + end +end) + +---------------------------------------------------------------- события от сервера + +remote.OnClientEvent:Connect(function(action, a, b, c) + if action == "Notify" then + notify(a, b) + elseif action == "Cast" then + setState("waiting") + elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then + setState("idle") + elseif action == "Bite" then + mg.speed = a.speed + mg.zoneWidth = a.zoneWidth + mg.need = a.hits + mg.hits = 0 + mg.misses = 0 + mg.maxMisses = a.misses + mg.timeout = a.timeout + mg.deadline = os.clock() + a.timeout + mg.pos, mg.dir = 0, 1 + placeZone() + updatePips() + setState("bite") + elseif action == "Caught" then + setState("idle") + showCatch(a, b) + playUiSound(DING, 0.5) + elseif action == "Sold" then + floatText("+" .. fmt(a) .. " 💰", C.gold) + notify(("Продано рыб: %d → +%s 💰"):format(b, fmt(a)), Color3.fromRGB(120, 255, 140)) + elseif action == "Inventory" then + inventory = a or {} + discovered = b or {} + claimed = c or {} + bagWin.refresh() + refreshDots() + elseif action == "Quests" then + quests = a or {} + daily = b or daily + questWin.refresh() + refreshDots() + elseif action == "OpenShop" then + shopWin.open("rods") + elseif action == "OpenQuests" then + questWin.open("daily") + elseif action == "OpenRobux" then + robuxWin.open(a) + end +end) + +remote:FireServer("RequestInventory") +]]> + + + \ No newline at end of file diff --git a/install/INSTALL.lua b/install/INSTALL.lua new file mode 100644 index 0000000..f4e72a0 --- /dev/null +++ b/install/INSTALL.lua @@ -0,0 +1,4850 @@ +local function make(class, name, parent, src) + local old = parent:FindFirstChild(name) + if old then old:Destroy() end + local s = Instance.new(class) + s.Name = name + s.Source = src + s.Parent = parent +end +local oldMap = workspace:FindFirstChild('FishingMap') +if oldMap then oldMap:Destroy() end +make('ModuleScript', 'FishConfig', game.ReplicatedStorage, [=====[-- FishConfig (ModuleScript) -> ReplicatedStorage +-- Все настройки игры. Меняй цифры здесь, чтобы настроить баланс. + +local Config = {} + +Config.GameName = "Клёвое место" + +---------------------------------------------------------------- миры +-- center = центр мира на карте; mult = множитель наград коллекции +Config.Worlds = { + { + id = "World1", name = "Тихое озеро", icon = "🌊", level = 1, mult = 1, + center = Vector3.new(0, 0, 1500), color = Color3.fromRGB(60, 200, 255), + desc = "Спокойное лесное озеро. Отличное место, чтобы начать.", + clock = 14.5, water = Color3.fromRGB(20, 95, 115), + waterY = 0, + lakes = { { 0, 0, 55 }, { -45, 15, 40 }, { 45, -10, 42 }, { 10, -42, 34 }, { -22, 40, 28 } }, -- { x, z, радиус } от центра + }, + { + id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4, + center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70), + desc = "Бирюзовое море, пальмы и яркая рифовая рыба.", + clock = 13, water = Color3.fromRGB(35, 175, 185), + waterY = 0, + sea = 119, -- всё дальше этого радиуса от центра — море + }, + { + id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12, + center = Vector3.new(-1500, 0, 0), color = Color3.fromRGB(150, 220, 255), + desc = "Рыбалка в лунках среди льдов и северного сияния.", + clock = 18.3, water = Color3.fromRGB(25, 70, 100), + waterY = 1, + lakes = { { 0, 0, 70 }, { -55, 30, 45 }, { 55, -25, 50 }, { 5, -70, 40 } }, -- подо льдом + holes = { + { 0, 40 }, { -22, 18 }, { 22, 12 }, { 0, -12 }, { -30, -30 }, { 30, 40 }, { -60, 35 }, + { -45, 15 }, { 55, -25 }, { 75, -5 }, { 40, -50 }, { 5, -75 }, { -15, -60 }, { 25, -80 }, + }, + holeRadius = 6, + }, + { + id = "World4", name = "Вулкан", icon = "🌋", level = 30, mult = 30, soon = true, + center = Vector3.new(0, 0, -1500), color = Color3.fromRGB(255, 90, 40), + desc = "Рыбалка в лаве. Скоро!", + }, +} +Config.WorldRadius = 260 + +function Config.WorldAt(pos) + for _, w in ipairs(Config.Worlds) do + if not w.soon then + local d = Vector3.new(pos.X - w.center.X, 0, pos.Z - w.center.Z).Magnitude + if d < Config.WorldRadius then + return w + end + end + end + return nil +end + +-- есть ли вода в этой точке мира (озеро, море или лунка) +function Config.IsWater(world, pos) + if not world then + return false + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + if world.holes then + local r = world.holeRadius or 6 + for _, h in ipairs(world.holes) do + if (x - h[1]) ^ 2 + (z - h[2]) ^ 2 <= r * r then + return true + end + end + return false + end + if world.sea and math.sqrt(x * x + z * z) >= world.sea then + return true + end + for _, l in ipairs(world.lakes or {}) do + if (x - l[1]) ^ 2 + (z - l[2]) ^ 2 <= (l[3] - 1) ^ 2 then + return true + end + end + return false +end + +---------------------------------------------------------------- редкости +Config.Rarities = { + Common = { name = "Обычная", rank = 1, weight = 55, color = Color3.fromRGB(215, 220, 225) }, + Uncommon = { name = "Необычная", rank = 2, weight = 27, color = Color3.fromRGB(95, 225, 115) }, + Rare = { name = "Редкая", rank = 3, weight = 11, color = Color3.fromRGB(70, 160, 255) }, + Epic = { name = "Эпическая", rank = 4, weight = 4.5, color = Color3.fromRGB(185, 90, 255) }, + Legendary = { name = "Легендарная", rank = 5, weight = 1.2, color = Color3.fromRGB(255, 185, 35) }, + Mythic = { name = "Мифическая", rank = 6, weight = 0.25, color = Color3.fromRGB(255, 80, 150) }, +} +Config.RarityOrder = { "Common", "Uncommon", "Rare", "Epic", "Legendary", "Mythic" } + +---------------------------------------------------------------- мутации +Config.Mutations = { + { id = "Rainbow", name = "Радужная", chance = 0.002, mult = 10, color = Color3.fromRGB(255, 120, 230) }, + { id = "Golden", name = "Золотая", chance = 0.010, mult = 5, color = Color3.fromRGB(255, 205, 60) }, + { id = "Shiny", name = "Блестящая", chance = 0.040, mult = 2, color = Color3.fromRGB(170, 240, 255) }, +} + +---------------------------------------------------------------- рыба +-- shape: classic, long, tall, flat, ray, puffer, shark, eel, sword, angler, jelly, sturgeon +-- color2 = второй цвет (плавники/узор); stripes/spots/whiskers/spikes/glow — украшения модели +local function F(t) + return t +end + +Config.Zones = { + World1 = { + fish = { + F({ id = "Karas", name = "Карась", rarity = "Common", price = 5, xp = 8, minW = 0.2, maxW = 1.2, size = 1.0, shape = "tall", color = Color3.fromRGB(205, 170, 75), color2 = Color3.fromRGB(170, 120, 50) }), + F({ id = "Plotva", name = "Плотва", rarity = "Common", price = 6, xp = 8, minW = 0.1, maxW = 0.8, size = 0.9, shape = "classic", color = Color3.fromRGB(195, 200, 210), color2 = Color3.fromRGB(220, 80, 60) }), + F({ id = "Ersh", name = "Ёрш", rarity = "Common", price = 7, xp = 9, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(135, 125, 75), color2 = Color3.fromRGB(95, 85, 50), spikes = true, spots = 6 }), + F({ id = "Okun", name = "Окунь", rarity = "Uncommon", price = 15, xp = 18, minW = 0.3, maxW = 1.5, size = 1.0, shape = "classic", color = Color3.fromRGB(150, 180, 70), color2 = Color3.fromRGB(230, 90, 40), stripes = 5, spikes = true }), + F({ id = "Lesh", name = "Лещ", rarity = "Uncommon", price = 18, xp = 20, minW = 0.5, maxW = 3.0, size = 1.2, shape = "tall", color = Color3.fromRGB(175, 145, 95), color2 = Color3.fromRGB(120, 95, 60) }), + F({ id = "Lin", name = "Линь", rarity = "Uncommon", price = 20, xp = 22, minW = 0.4, maxW = 2.5, size = 1.1, shape = "classic", color = Color3.fromRGB(95, 125, 55), color2 = Color3.fromRGB(60, 85, 35) }), + F({ id = "Shuka", name = "Щука", rarity = "Rare", price = 45, xp = 45, minW = 1.0, maxW = 8.0, size = 1.5, shape = "long", color = Color3.fromRGB(110, 140, 85), color2 = Color3.fromRGB(200, 210, 150), spots = 12 }), + F({ id = "Sudak", name = "Судак", rarity = "Rare", price = 50, xp = 48, minW = 1.0, maxW = 6.0, size = 1.4, shape = "long", color = Color3.fromRGB(165, 165, 135), color2 = Color3.fromRGB(80, 80, 70), stripes = 6, spikes = true }), + F({ id = "Som", name = "Сом", rarity = "Epic", price = 130, xp = 110, minW = 5.0, maxW = 40, size = 2.0, shape = "long", color = Color3.fromRGB(75, 75, 90), color2 = Color3.fromRGB(180, 175, 160), whiskers = true }), + F({ id = "Koi", name = "Карп кои", rarity = "Epic", price = 150, xp = 120, minW = 2.0, maxW = 9.0, size = 1.4, shape = "classic", color = Color3.fromRGB(250, 245, 240), color2 = Color3.fromRGB(240, 110, 40), spots = 7, whiskers = true }), + F({ id = "Gold", name = "Золотая рыбка", rarity = "Legendary", price = 500, xp = 350, minW = 0.1, maxW = 0.5, size = 0.9, shape = "classic", color = Color3.fromRGB(255, 195, 40), color2 = Color3.fromRGB(255, 120, 30), glow = true, bigTail = true }), + F({ id = "Crystal", name = "Хрустальный осётр", rarity = "Mythic", price = 2000, xp = 900, minW = 10, maxW = 60, size = 2.0, shape = "sturgeon", color = Color3.fromRGB(150, 230, 255), color2 = Color3.fromRGB(230, 250, 255), glow = true, glass = true }), + }, + }, + World2 = { + fish = { + F({ id = "Clown", name = "Рыба-клоун", rarity = "Common", price = 18, xp = 18, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(255, 120, 30), color2 = Color3.fromRGB(255, 255, 255), stripes = 3 }), + F({ id = "Sergeant", name = "Рыба-сержант", rarity = "Common", price = 20, xp = 18, minW = 0.2, maxW = 0.9, size = 0.9, shape = "tall", color = Color3.fromRGB(240, 230, 110), color2 = Color3.fromRGB(40, 40, 45), stripes = 5 }), + F({ id = "Mullet", name = "Барабулька", rarity = "Common", price = 22, xp = 20, minW = 0.1, maxW = 0.6, size = 0.9, shape = "classic", color = Color3.fromRGB(235, 110, 100), color2 = Color3.fromRGB(255, 220, 120), whiskers = true }), + F({ id = "Angel", name = "Рыба-ангел", rarity = "Uncommon", price = 45, xp = 40, minW = 0.3, maxW = 1.5, size = 1.0, shape = "tall", color = Color3.fromRGB(60, 120, 230), color2 = Color3.fromRGB(255, 220, 40), stripes = 4, bigFins = true }), + F({ id = "Puffer", name = "Иглобрюх", rarity = "Uncommon", price = 50, xp = 42, minW = 0.3, maxW = 2.0, size = 1.0, shape = "puffer", color = Color3.fromRGB(230, 205, 140), color2 = Color3.fromRGB(110, 90, 60), spots = 10 }), + F({ id = "Parrot", name = "Рыба-попугай", rarity = "Uncommon", price = 55, xp = 45, minW = 1.0, maxW = 5.0, size = 1.2, shape = "classic", color = Color3.fromRGB(60, 210, 190), color2 = Color3.fromRGB(240, 90, 180), spots = 5 }), + F({ id = "Ray", name = "Скат", rarity = "Rare", price = 120, xp = 90, minW = 3.0, maxW = 25, size = 1.6, shape = "ray", color = Color3.fromRGB(110, 115, 140), color2 = Color3.fromRGB(230, 230, 240), spots = 14 }), + F({ id = "Barracuda", name = "Барракуда", rarity = "Rare", price = 130, xp = 95, minW = 2.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(175, 185, 200), color2 = Color3.fromRGB(60, 70, 85), stripes = 8 }), + F({ id = "Swordfish", name = "Рыба-меч", rarity = "Epic", price = 350, xp = 220, minW = 30, maxW = 200, size = 2.0, shape = "sword", color = Color3.fromRGB(55, 75, 130), color2 = Color3.fromRGB(200, 210, 230) }), + F({ id = "Moray", name = "Мурена", rarity = "Epic", price = 320, xp = 210, minW = 2.0, maxW = 15, size = 1.8, shape = "eel", color = Color3.fromRGB(80, 140, 60), color2 = Color3.fromRGB(230, 220, 90), spots = 12 }), + F({ id = "Shark", name = "Рифовая акула", rarity = "Legendary", price = 1200, xp = 700, minW = 40, maxW = 180, size = 2.4, shape = "shark", color = Color3.fromRGB(110, 125, 145), color2 = Color3.fromRGB(235, 235, 240) }), + F({ id = "SunJelly", name = "Солнечная медуза", rarity = "Mythic", price = 5000, xp = 2000, minW = 1.0, maxW = 8.0, size = 1.8, shape = "jelly", color = Color3.fromRGB(255, 200, 80), color2 = Color3.fromRGB(255, 120, 200), glow = true, glass = true }), + }, + }, + World3 = { + fish = { + F({ id = "Cod", name = "Треска", rarity = "Common", price = 55, xp = 40, minW = 1.0, maxW = 10, size = 1.2, shape = "classic", color = Color3.fromRGB(150, 150, 110), color2 = Color3.fromRGB(230, 225, 200), spots = 14, whiskers = true }), + F({ id = "Herring", name = "Сельдь", rarity = "Common", price = 50, xp = 38, minW = 0.2, maxW = 0.8, size = 0.9, shape = "long", color = Color3.fromRGB(150, 175, 205), color2 = Color3.fromRGB(70, 100, 140) }), + F({ id = "Capelin", name = "Мойва", rarity = "Common", price = 48, xp = 36, minW = 0.05, maxW = 0.2, size = 0.7, shape = "classic", color = Color3.fromRGB(170, 200, 190), color2 = Color3.fromRGB(80, 120, 110) }), + F({ id = "Flounder", name = "Камбала", rarity = "Uncommon", price = 140, xp = 90, minW = 0.5, maxW = 4.0, size = 1.2, shape = "flat", color = Color3.fromRGB(150, 125, 90), color2 = Color3.fromRGB(230, 120, 60), spots = 10 }), + F({ id = "Redfish", name = "Морской окунь", rarity = "Uncommon", price = 150, xp = 92, minW = 0.5, maxW = 5.0, size = 1.1, shape = "classic", color = Color3.fromRGB(225, 70, 60), color2 = Color3.fromRGB(255, 160, 120), spikes = true }), + F({ id = "Char", name = "Арктический голец", rarity = "Uncommon", price = 160, xp = 95, minW = 0.5, maxW = 6.0, size = 1.2, shape = "long", color = Color3.fromRGB(120, 130, 150), color2 = Color3.fromRGB(255, 130, 150), spots = 12 }), + F({ id = "Halibut", name = "Палтус", rarity = "Rare", price = 380, xp = 200, minW = 5.0, maxW = 90, size = 1.9, shape = "flat", color = Color3.fromRGB(90, 95, 80), color2 = Color3.fromRGB(150, 150, 130), spots = 16 }), + F({ id = "Wolffish", name = "Морской волк", rarity = "Rare", price = 400, xp = 210, minW = 3.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(110, 120, 140), color2 = Color3.fromRGB(60, 65, 80), stripes = 7, teeth = true }), + F({ id = "Angler", name = "Удильщик", rarity = "Epic", price = 1100, xp = 500, minW = 5.0, maxW = 50, size = 1.6, shape = "angler", color = Color3.fromRGB(60, 50, 70), color2 = Color3.fromRGB(120, 255, 230), glow = true }), + F({ id = "IceEel", name = "Ледяная мурена", rarity = "Epic", price = 1000, xp = 480, minW = 3.0, maxW = 25, size = 1.9, shape = "eel", color = Color3.fromRGB(150, 210, 245), color2 = Color3.fromRGB(240, 250, 255), glass = true }), + F({ id = "Greenland", name = "Полярная акула", rarity = "Legendary", price = 3500, xp = 1500, minW = 200, maxW = 900, size = 2.6, shape = "shark", color = Color3.fromRGB(80, 90, 100), color2 = Color3.fromRGB(160, 170, 180) }), + F({ id = "Leviathan", name = "Ледяной левиафан", rarity = "Mythic", price = 15000, xp = 4000, minW = 500, maxW = 3000, size = 2.4, shape = "eel", color = Color3.fromRGB(110, 230, 255), color2 = Color3.fromRGB(200, 120, 255), glow = true, spikes = true }), + }, + }, +} + +---------------------------------------------------------------- удочки +-- luck = бонус удачи, speed = множитель ожидания клёва (меньше = быстрее), zone = ширина зелёной зоны +Config.Rods = { + { id = "Basic", name = "Старая удочка", price = 0, level = 1, luck = 0.00, speed = 1.00, zone = 0.22, upgradeCost = 40, style = "wood" }, + { id = "Bamboo", name = "Бамбуковая удочка", price = 150, level = 3, luck = 0.15, speed = 0.88, zone = 0.25, upgradeCost = 120, style = "bamboo" }, + { id = "Fiberglass", name = "Стеклопластиковая", price = 600, level = 5, luck = 0.30, speed = 0.78, zone = 0.27, upgradeCost = 300, style = "glass" }, + { id = "Carbon", name = "Карбоновая удочка", price = 1800, level = 8, luck = 0.55, speed = 0.68, zone = 0.29, upgradeCost = 700, style = "carbon" }, + { id = "Coral", name = "Коралловая удочка", price = 4500, level = 10, luck = 0.80, speed = 0.62, zone = 0.31, upgradeCost = 1300, style = "coral" }, + { id = "Golden", name = "Золотая удочка", price = 9000, level = 13, luck = 1.00, speed = 0.56, zone = 0.33, upgradeCost = 2200, style = "gold" }, + { id = "Frost", name = "Ледяная удочка", price = 25000, level = 18, luck = 1.40, speed = 0.50, zone = 0.35, upgradeCost = 5000, style = "frost" }, + { id = "Legend", name = "Удочка Легенды", price = 75000, level = 25, luck = 2.00, speed = 0.42, zone = 0.38, upgradeCost = 12000, style = "legend" }, +} + +Config.RodUpgrade = { maxLevel = 5, luckPerLevel = 0.08, zonePerLevel = 0.012, speedPerLevel = 0.96 } +function Config.UpgradeCost(rod, currentLevel) + return math.floor(rod.upgradeCost * (currentLevel + 1) ^ 1.5) +end + +---------------------------------------------------------------- сумки +Config.Bags = { + { id = "Pouch", name = "Холщовая сумка", price = 0, level = 1, capacity = 12, color = Color3.fromRGB(170, 140, 95) }, + { id = "Satchel", name = "Сумка рыбака", price = 150, level = 2, capacity = 25, color = Color3.fromRGB(110, 140, 80) }, + { id = "Backpack", name = "Туристический рюкзак", price = 700, level = 4, capacity = 45, color = Color3.fromRGB(60, 110, 180) }, + { id = "BigNet", name = "Огромный садок", price = 2500, level = 7, capacity = 80, color = Color3.fromRGB(200, 80, 50) }, + { id = "Chest", name = "Сундук за спиной", price = 9000, level = 12, capacity = 140, color = Color3.fromRGB(140, 90, 50) }, + { id = "Magic", name = "Магический мешок", price = 30000, level = 20, capacity = 250, color = Color3.fromRGB(120, 60, 200) }, +} + +---------------------------------------------------------------- удача +Config.LuckPerPlayerLevel = 0.02 -- +2% за уровень игрока +Config.MasteryLuck = 0.10 -- +10% навсегда за полностью собранный мир +Config.Potions = { + { id = "Luck1", name = "Зелье удачи", price = 120, bonus = 0.5, duration = 300, color = Color3.fromRGB(90, 230, 120) }, + { id = "Luck2", name = "Большое зелье удачи", price = 450, bonus = 1.0, duration = 600, color = Color3.fromRGB(255, 200, 60), level = 5 }, + { id = "Luck3", name = "Эликсир фортуны", price = 2500, bonus = 2.0, duration = 600, color = Color3.fromRGB(200, 120, 255), level = 12 }, +} + +---------------------------------------------------------------- коллекция +-- награда за то, что поймал ВСЕ виды одной редкости в мире (умножается на mult мира) +Config.CollectionRewards = { + Common = { coins = 50, xp = 40 }, + Uncommon = { coins = 120, xp = 100 }, + Rare = { coins = 300, xp = 250 }, + Epic = { coins = 800, xp = 600 }, + Legendary = { coins = 2000, xp = 1500 }, + Mythic = { coins = 6000, xp = 4000 }, +} +Config.MasteryCoins = 5000 -- за весь мир (тоже умножается на mult) + +---------------------------------------------------------------- задания +-- coins/xp = награда за 1 единицу цели (умножается на цель и уровень игрока) +Config.Quests = { + { kind = "catch", text = "Поймай %d рыб", goals = { 10, 20, 35 }, coins = 6, xp = 5 }, + { kind = "rare", text = "Поймай %d рыб редкости «Редкая» и выше", goals = { 1, 2, 3 }, coins = 60, xp = 50 }, + { kind = "epic", text = "Поймай эпическую рыбу или реже", goals = { 1 }, coins = 250, xp = 200 }, + { kind = "mutation", text = "Поймай рыбу с мутацией", goals = { 1 }, coins = 200, xp = 150 }, + { kind = "earn", text = "Заработай %d монет на продаже", goals = { 200, 600, 1500 }, coins = 0.25, xp = 0.2 }, + { kind = "perfect", text = "Сделай %d идеальных подсечек (без промаха)", goals = { 5, 10, 15 }, coins = 15, xp = 12 }, +} +Config.QuestSlots = 3 + +-- ежедневная награда (7 дней по кругу), монеты растут с уровнем +Config.DailyRewards = { + { coins = 100 }, + { coins = 200 }, + { coins = 300, potion = "Luck1" }, + { coins = 450 }, + { coins = 600, potion = "Luck1" }, + { coins = 800 }, + { coins = 1500, potion = "Luck2" }, +} + +---------------------------------------------------------------- события на сервере +Config.Events = { + { id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 }, + { id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 }, + { id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 }, + { id = "Fair", name = "💰 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 }, +} +Config.EventFirstDelay = 120 +Config.EventGapMin = 420 +Config.EventGapMax = 720 + +---------------------------------------------------------------- донат (Robux) +-- ВАЖНО: впиши сюда ID своих пропусков и товаров с create.roblox.com. +-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен. +Config.GamePasses = { + { key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и монет, корона над головой" }, + { key = "DoubleCoins", id = 0, robux = 299, icon = "💰", name = "x2 Монеты", desc = "Вся рыба продаётся в 2 раза дороже" }, + { key = "LuckyCharm", id = 0, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" }, + { key = "BigBag", id = 0, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" }, +} +Config.Products = { + { key = "Coins1", id = 0, robux = 49, icon = "🪙", name = "Мешок монет", desc = "+1 000 монет (больше с уровнем)", coins = 1000 }, + { key = "Coins2", id = 0, robux = 199, icon = "💰", name = "Сундук монет", desc = "+5 000 монет (больше с уровнем)", coins = 5000 }, + { key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 монет (больше с уровнем)", coins = 20000 }, + { key = "Luck", id = 0, robux = 99, icon = "🧪", name = "Супер-зелье удачи", desc = "+200% удачи на 15 минут", boost = 2.0, duration = 900 }, +} + +---------------------------------------------------------------- рыбалка +Config.BiteTimeMin = 3 +Config.BiteTimeMax = 7 +Config.BiteTimeout = 12 +Config.MaxMisses = 2 +function Config.HitsNeeded(rank) + return math.ceil(rank / 2) +end +function Config.XPForLevel(level) + return 60 + level * 60 +end + +---------------------------------------------------------------- помощники +function Config.Find(list, id) + for _, item in ipairs(list) do + if item.id == id or item.key == id then + return item + end + end + return nil +end + +function Config.FindFish(fishId) + for zoneId, zone in pairs(Config.Zones) do + for _, f in ipairs(zone.fish) do + if f.id == fishId then + return f, zoneId + end + end + end + return nil +end + +function Config.RodStats(rodId, upgradeLevel) + local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1] + local u = Config.RodUpgrade + upgradeLevel = upgradeLevel or 0 + return { + luck = rod.luck + u.luckPerLevel * upgradeLevel, + speed = rod.speed * (u.speedPerLevel ^ upgradeLevel), + zone = rod.zone + u.zonePerLevel * upgradeLevel, + } +end + +return Config +]=====]) +make('ModuleScript', 'GameModels', game.ReplicatedStorage, [=====[-- GameModels (ModuleScript) -> ReplicatedStorage +-- Строит 3D-модели из деталей: удочки, сумки, рыбу, поплавок. +-- Используется сервером (инструмент, витрины, рыба в руках) и клиентом (иконки). + +local Config = require(script.Parent:WaitForChild("FishConfig")) + +local M = {} +local V = Vector3.new +local SP, NEON, METAL, GLASS = Enum.Material.SmoothPlastic, Enum.Material.Neon, Enum.Material.Metal, Enum.Material.Glass + +---------------------------------------------------------------- помощники + +local function newPart(parent, props, class) + local p = Instance.new(class or "Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = false + p.CanCollide = false + p.CanQuery = false + p.CanTouch = false + p.Massless = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + p.Material = SP + for k, v in pairs(props) do + if k ~= "Shape" then + p[k] = v + end + end + p.Parent = parent + return p +end + +local function cyl(parent, a, b, dia, props) + props = props or {} + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.02, (b - a).Magnitude), dia, dia) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return newPart(parent, props) +end + +local function ball(parent, pos, dia, props) + props = props or {} + props.Shape = Enum.PartType.Ball + props.Size = V(dia, dia, dia) + props.CFrame = CFrame.new(pos) + return newPart(parent, props) +end + +local function oval(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + local p = newPart(parent, props) + local mesh = Instance.new("SpecialMesh") + mesh.MeshType = Enum.MeshType.Sphere + mesh.Parent = p + return p +end + +local function block(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + return newPart(parent, props) +end + +local function wedge(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + return newPart(parent, props, "WedgePart") +end + +local function finish(model, root, anchored) + for _, p in ipairs(model:GetDescendants()) do + if p:IsA("BasePart") and p ~= root then + local w = Instance.new("Weld") + w.Part0 = root + w.Part1 = p + w.C0 = root.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Anchored = anchored and true or false + end + end + root.Anchored = anchored and true or false + model.PrimaryPart = root + return model +end + +local function lighten(c, t) + return c:Lerp(Color3.new(1, 1, 1), t) +end +local function darken(c, t) + return c:Lerp(Color3.new(0, 0, 0), t) +end +local function C(r, g, b) + return Color3.fromRGB(r, g, b) +end + +local function sparkles(parent, color, rate) + local att = Instance.new("Attachment") + att.Parent = parent + local pe = Instance.new("ParticleEmitter") + pe.Texture = "rbxasset://textures/particles/sparkles_main.dds" + pe.Rate = rate or 6 + pe.Lifetime = NumberRange.new(0.6, 1.0) + pe.Speed = NumberRange.new(0.5, 1) + pe.Size = NumberSequence.new(0.25, 0) + pe.LightEmission = 1 + pe.Color = ColorSequence.new(color) + pe.Parent = att + return pe +end + +---------------------------------------------------------------- удочки +-- Рука в (0,0,0), удочка смотрит в -Z и изгибается вверх (+Y). + +local STYLES = { + wood = { blank = C(125, 90, 60), mat = Enum.Material.Wood, grip = C(80, 55, 35), gripMat = Enum.Material.Fabric, wrap = C(175, 175, 175), reel = C(95, 95, 100) }, + bamboo = { blank = C(215, 190, 105), mat = Enum.Material.Wood, grip = C(120, 90, 50), gripMat = Enum.Material.Fabric, wrap = C(70, 120, 60), reel = C(85, 85, 90), nodes = C(150, 120, 60) }, + glass = { blank = C(60, 130, 215), mat = SP, grip = C(35, 35, 40), gripMat = Enum.Material.Fabric, wrap = C(240, 240, 245), reel = C(60, 60, 70) }, + carbon = { blank = C(30, 30, 35), mat = SP, grip = C(195, 155, 105), gripMat = Enum.Material.Sand, wrap = C(220, 50, 50), reel = C(45, 45, 50) }, + coral = { blank = C(255, 130, 110), blank2 = C(255, 225, 210), mat = SP, grip = C(40, 170, 170), gripMat = Enum.Material.Fabric, wrap = C(40, 200, 200), reel = C(240, 240, 235), gem = C(255, 120, 160) }, + gold = { blank = C(255, 200, 50), mat = METAL, grip = C(120, 30, 30), gripMat = Enum.Material.Fabric, wrap = C(255, 255, 255), reel = C(230, 180, 50), gem = C(255, 40, 60), sparkle = C(255, 220, 90) }, + frost = { blank = C(170, 225, 255), mat = GLASS, grip = C(230, 240, 250), gripMat = Enum.Material.Fabric, wrap = C(90, 170, 255), reel = C(200, 230, 250), gem = C(120, 240, 255), sparkle = C(170, 240, 255) }, + legend = { blank = C(60, 25, 90), blank2 = C(110, 50, 170), mat = SP, grip = C(25, 20, 35), gripMat = Enum.Material.Fabric, wrap = C(255, 200, 60), wrapNeon = true, reel = C(40, 30, 60), gem = C(255, 90, 220), sparkle = C(255, 150, 240) }, +} + +function M.buildRod(rodId, upgradeLevel, anchored) + local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1] + local st = STYLES[rod.style] or STYLES.wood + upgradeLevel = upgradeLevel or 0 + local model = Instance.new("Model") + model.Name = rod.name + + local handle = newPart(model, { Name = "Handle", Size = V(0.3, 0.3, 1.8), CFrame = CFrame.new(), Transparency = 1 }) + local wrapMat = (st.wrapNeon or upgradeLevel >= 5) and NEON or METAL + local back = V(0, 0, 1) + + -- торец и камень + ball(model, V(0, 0, 1.05), 0.42, { Color = st.reel, Material = METAL }) + if st.gem then + ball(model, V(0, 0, 1.25), 0.26, { Color = st.gem, Material = NEON }) + end + -- задняя рукоять: кольца (пробка/обмотка) + for i = 0, 6 do + local z0 = 1.0 - i * 0.185 + cyl(model, V(0, 0, z0), V(0, 0, z0 - 0.185), i % 2 == 0 and 0.34 or 0.33, { + Color = i % 2 == 0 and st.grip or darken(st.grip, 0.12), Material = st.gripMat, + }) + end + -- катушкодержатель + cyl(model, V(0, 0, -0.3), V(0, 0, -0.95), 0.27, { Color = st.reel, Material = METAL }) + cyl(model, V(0, 0, -0.3), V(0, 0, -0.42), 0.32, { Color = st.wrap, Material = wrapMat }) + cyl(model, V(0, 0, -0.83), V(0, 0, -0.95), 0.32, { Color = st.wrap, Material = wrapMat }) + -- передняя рукоять + cyl(model, V(0, 0, -0.95), V(0, 0, -1.45), 0.29, { Color = st.grip, Material = st.gripMat }) + cyl(model, V(0, 0, -1.45), V(0, 0, -1.55), 0.25, { Color = st.wrap, Material = wrapMat }) + + -- катушка (безынерционная): ножка, корпус, шпуля, дужка, ручка + block(model, V(0.1, 0.42, 0.22), CFrame.new(0, -0.3, -0.62), { Color = st.reel, Material = METAL }) + oval(model, V(0.46, 0.5, 0.7), CFrame.new(0, -0.68, -0.58), { Color = st.reel, Material = METAL }) + local spoolCF = CFrame.new(0, -0.68, -1.02) * CFrame.Angles(0, math.rad(90), 0) + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.34, 0.44, 0.44), CFrame = spoolCF, Color = C(235, 235, 230), Material = SP }) + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.06, 0.5, 0.5), CFrame = spoolCF * CFrame.new(0.18, 0, 0), Color = st.wrap, Material = wrapMat }) + local bail = {} + for i = 0, 6 do + local a = math.rad(200 + i * 23) + table.insert(bail, V(math.cos(a) * 0.3, -0.68 + math.sin(a) * 0.3, -1.2)) + end + for i = 1, #bail - 1 do + cyl(model, bail[i], bail[i + 1], 0.04, { Color = C(200, 200, 205), Material = METAL }) + end + cyl(model, V(0.24, -0.68, -0.58), V(0.5, -0.86, -0.58), 0.07, { Color = st.reel, Material = METAL }) + ball(model, V(0.54, -0.9, -0.5), 0.19, { Color = st.grip, Material = SP }) + + -- бланк: 8 колен с плавным изгибом и шарами на стыках + local angles = { 6, 9, 12, 16, 20, 25, 30, 36 } + local lengths = { 1.2, 1.15, 1.1, 1.0, 0.95, 0.9, 0.85, 0.8 } + local p = V(0, 0, -1.55) + local lastSeg + for i = 1, #angles do + local a = math.rad(angles[i]) + local d = V(0, math.sin(a), -math.cos(a)) + local q = p + d * lengths[i] + local dia = 0.2 - (i - 1) * 0.019 + local color = (st.blank2 and i % 2 == 0) and st.blank2 or st.blank + lastSeg = cyl(model, p, q, dia, { Color = color, Material = st.mat }) + ball(model, q, dia * 0.97, { Color = color, Material = st.mat }) + if st.nodes then + cyl(model, q - d * 0.04, q + d * 0.04, dia + 0.05, { Color = st.nodes, Material = Enum.Material.Wood }) + end + -- полоски улучшений на первых коленах + if i <= 2 then + for s = 1, upgradeLevel do + if (s <= 3 and i == 1) or (s > 3 and i == 2) then + local t = 0.25 + ((s - 1) % 3) * 0.22 + local c = p:Lerp(q, t) + cyl(model, c - d * 0.035, c + d * 0.035, dia + 0.045, { Color = C(255, 215, 80), Material = NEON }) + end + end + end + -- пропускные кольца на чётных стыках + if i % 2 == 0 then + local n = V(0, d.Z, -d.Y) -- вниз, перпендикулярно бланку + local ringD = 0.24 - i * 0.017 + cyl(model, q - d * 0.06, q + d * 0.06, dia + 0.05, { Color = st.wrap, Material = wrapMat }) + cyl(model, q, q + n * 0.12, 0.035, { Color = C(200, 200, 205), Material = METAL }) + local c = q + n * (0.12 + ringD / 2) + newPart(model, { + Shape = Enum.PartType.Cylinder, Size = V(0.03, ringD, ringD), + CFrame = CFrame.lookAt(c, c + d) * CFrame.Angles(0, math.rad(90), 0), + Color = C(205, 205, 210), Material = METAL, + }) + end + p = q + end + ball(model, p, 0.09, { Color = st.wrap, Material = wrapMat }) + + local tip = Instance.new("Attachment") + tip.Name = "Tip" + tip.Position = p + tip.Parent = handle + local lineStart = Instance.new("Attachment") + lineStart.Name = "LineStart" + lineStart.Position = V(0, -0.68, -1.2) + lineStart.Parent = handle + local line = Instance.new("Beam") + line.Attachment0 = lineStart + line.Attachment1 = tip + line.Width0 = 0.025 + line.Width1 = 0.02 + line.FaceCamera = true + line.Color = ColorSequence.new(C(245, 245, 245)) + line.Parent = handle + + if upgradeLevel >= 3 or st.sparkle then + sparkles(lastSeg, st.sparkle or st.wrap, 6) + end + return finish(model, handle, anchored) +end + +---------------------------------------------------------------- сумки на спину +-- Корень "Root" у спины; +Z = от спины назад. + +local BAG_SIZES = { + Pouch = V(1.3, 1.3, 0.6), + Satchel = V(1.5, 1.5, 0.7), + Backpack = V(1.7, 2.0, 0.9), + BigNet = V(1.9, 2.2, 1.0), + Chest = V(2.0, 1.6, 1.2), + Magic = V(1.8, 2.2, 1.1), +} + +function M.buildBag(bagId, anchored) + local bag = Config.Find(Config.Bags, bagId) or Config.Bags[1] + local s = BAG_SIZES[bag.id] or BAG_SIZES.Pouch + local model = Instance.new("Model") + model.Name = "BackBag" + local root = newPart(model, { Name = "Root", Size = V(0.2, 0.2, 0.2), CFrame = CFrame.new(), Transparency = 1 }) + + if bag.id == "Chest" then + block(model, V(s.X, s.Y * 0.7, s.Z), CFrame.new(0, -s.Y * 0.15, s.Z / 2), { Color = bag.color, Material = Enum.Material.WoodPlanks }) + oval(model, V(s.X, s.Y * 0.6, s.Z), CFrame.new(0, s.Y * 0.2, s.Z / 2), { Color = darken(bag.color, 0.15), Material = Enum.Material.WoodPlanks }) + for _, x in ipairs({ -s.X * 0.35, s.X * 0.35 }) do + block(model, V(0.15, s.Y * 1.02, s.Z + 0.06), CFrame.new(x, 0, s.Z / 2), { Color = C(200, 170, 70), Material = METAL }) + end + block(model, V(0.35, 0.4, 0.1), CFrame.new(0, 0, s.Z + 0.05), { Color = C(230, 190, 70), Material = METAL }) + sparkles(root, C(255, 220, 90), 3) + return finish(model, root, anchored) + end + + oval(model, V(s.X, s.Y, s.Z * 1.1), CFrame.new(0, 0, s.Z / 2), { Color = bag.color, Material = Enum.Material.Fabric }) + block(model, V(s.X * 0.95, s.Y * 0.3, s.Z * 0.9), CFrame.new(0, s.Y * 0.33, s.Z / 2), { Color = darken(bag.color, 0.25), Material = Enum.Material.Fabric }) + block(model, V(s.X * 0.6, s.Y * 0.32, 0.16), CFrame.new(0, -s.Y * 0.15, s.Z + 0.04), { Color = darken(bag.color, 0.12), Material = Enum.Material.Fabric }) + block(model, V(0.26, 0.2, 0.06), CFrame.new(0, s.Y * 0.2, s.Z * 0.98), { Color = C(230, 190, 70), Material = METAL }) + for _, x in ipairs({ -1, 1 }) do + block(model, V(0.16, s.Y * 0.9, 0.06), CFrame.new(x * s.X * 0.3, 0, s.Z * 0.95), { Color = darken(bag.color, 0.35), Material = Enum.Material.Fabric }) + end + if bag.id == "Backpack" or bag.id == "BigNet" then + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(s.X + 0.1, 0.55, 0.55), CFrame = CFrame.new(0, s.Y / 2 + 0.15, s.Z / 2), Color = C(70, 120, 70), Material = Enum.Material.Fabric }) + end + if bag.id == "BigNet" then + oval(model, V(0.15, 0.7, 0.5), CFrame.new(0.4, s.Y / 2 + 0.5, s.Z * 0.6) * CFrame.Angles(0, 0, math.rad(15)), { Color = C(255, 190, 50) }) + end + if bag.id == "Magic" then + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.05, 0.7, 0.7), CFrame = CFrame.new(0, -0.1, s.Z + 0.06) * CFrame.Angles(0, math.rad(90), 0), Color = C(255, 150, 255), Material = NEON }) + sparkles(root, C(220, 150, 255), 5) + end + return finish(model, root, anchored) +end + +---------------------------------------------------------------- рыба +-- Голова смотрит в +X, спина в +Y, бок к зрителю в +Z. + +local function seededRng(id) + local n = 0 + for i = 1, #id do + n += string.byte(id, i) * i + end + return Random.new(n) +end + +-- полуширина эллипсоида (L,H,W) в точке x,y +local function halfWidth(L, H, W, x, y) + local k = 1 - (2 * x / L) ^ 2 - (2 * y / H) ^ 2 + return k > 0 and (W / 2) * math.sqrt(k) or 0 +end + +local function addEyes(model, x, y, zHalf, size) + for _, sgn in ipairs({ -1, 1 }) do + ball(model, V(x, y, sgn * zHalf), size, { Color = C(250, 250, 250) }) + ball(model, V(x + size * 0.12, y, sgn * (zHalf + size * 0.3)), size * 0.55, { Color = C(15, 15, 20) }) + end +end + +function M.buildFish(fishId, mutationId, scale, anchored) + local fish = Config.FindFish(fishId) or Config.Zones.World1.fish[1] + local s = (scale or 1) * fish.size + local c1, c2 = fish.color, fish.color2 or darken(fish.color, 0.3) + local mat = SP + local glow = fish.glow + if mutationId == "Golden" then + c1, c2, mat = C(255, 205, 60), C(230, 150, 30), METAL + elseif mutationId == "Shiny" then + c1, c2, glow = lighten(c1, 0.35), lighten(c2, 0.35), true + elseif mutationId == "Rainbow" then + c1, c2, glow = C(255, 120, 220), C(90, 230, 255), true + end + if fish.glass and not mutationId then + mat = GLASS + end + local finMat = glow and NEON or mat + local rng = seededRng(fish.id) + local model = Instance.new("Model") + model.Name = fish.name + local shape = fish.shape or "classic" + local root + + if shape == "flat" then + -- камбала: плоская, «верх» смотрит на зрителя (+Z) + root = oval(model, V(2 * s, 1.3 * s, 0.22 * s), CFrame.new(), { Name = "Body", Color = c1, Material = mat }) + oval(model, V(2.2 * s, 1.5 * s, 0.08 * s), CFrame.new(0, 0, -0.02 * s), { Color = darken(c1, 0.2), Material = finMat }) + oval(model, V(0.45 * s, 0.6 * s, 0.06 * s), CFrame.new(-1.15 * s, 0, 0), { Color = darken(c1, 0.2), Material = finMat }) + for i = 1, fish.spots or 0 do + local x, y = rng:NextNumber(-0.7, 0.7) * s, rng:NextNumber(-0.45, 0.45) * s + oval(model, V(0.14 * s, 0.14 * s, 0.05 * s), CFrame.new(x, y, 0.1 * s), { Color = c2 }) + end + ball(model, V(0.62 * s, 0.14 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) }) + ball(model, V(0.5 * s, -0.05 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) }) + ball(model, V(0.62 * s, 0.14 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) }) + ball(model, V(0.5 * s, -0.05 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) }) + return finish(model, root, anchored) + end + + if shape == "ray" then + root = block(model, V(1.5 * s, 1.5 * s, 0.14 * s), CFrame.Angles(0, 0, math.rad(45)), { Name = "Body", Color = c1, Material = mat }) + oval(model, V(1.4 * s, 0.9 * s, 0.32 * s), CFrame.new(0.1 * s, 0, 0.02 * s), { Color = c1, Material = mat }) + cyl(model, V(-0.9 * s, 0, 0), V(-2.4 * s, 0.1 * s, 0), 0.08 * s, { Color = darken(c1, 0.2), Material = mat }) + for i = 1, fish.spots or 0 do + ball(model, V(rng:NextNumber(-0.6, 0.6) * s, rng:NextNumber(-0.6, 0.6) * s, 0.12 * s), 0.1 * s, { Color = c2 }) + end + ball(model, V(0.45 * s, 0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) }) + ball(model, V(0.45 * s, -0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) }) + return finish(model, root, anchored) + end + + if shape == "eel" then + local n, L = 10, 3.4 * s + local seg = L / n + local prev + for i = 0, n - 1 do + local x = L / 2 - i * seg + local y = math.sin(i * 0.8) * 0.22 * s + local d = (0.5 - i * 0.035) * s + local part = oval(model, V(seg * 1.7, d, d * 0.85), CFrame.new(x, y, 0), { Color = c1, Material = mat, Name = i == 0 and "Body" or "Seg" }) + if i == 0 then + root = part + end + if i > 0 then + oval(model, V(seg * 1.4, d * 0.5, d * 0.2), CFrame.new(x, y + d * 0.45, 0), { Color = c2, Material = finMat }) + if fish.spikes and i % 2 == 0 then + block(model, V(0.06 * s, d * 0.6, 0.06 * s), CFrame.new(x, y + d * 0.75, 0), { Color = c2, Material = NEON }) + end + end + if fish.spots and i > 0 and i % 2 == 1 then + ball(model, V(x, y + d * 0.1, d * 0.4), d * 0.25, { Color = c2 }) + end + prev = part + end + addEyes(model, L / 2 + seg * 0.3, 0.12 * s, 0.17 * s, 0.13 * s) + oval(model, V(0.1 * s, 0.08 * s, 0.3 * s), CFrame.new(L / 2 + seg * 0.75, -0.08 * s, 0), { Color = C(30, 20, 20) }) + return finish(model, root, anchored) + end + + if shape == "jelly" then + root = oval(model, V(1.6 * s, 1.1 * s, 1.6 * s), CFrame.new(0, 0.35 * s, 0), { Name = "Body", Color = c1, Material = GLASS, Transparency = 0.2 }) + oval(model, V(0.8 * s, 0.5 * s, 0.8 * s), CFrame.new(0, 0.3 * s, 0), { Color = c2, Material = NEON }) + oval(model, V(1.75 * s, 0.14 * s, 1.75 * s), CFrame.new(0, -0.15 * s, 0), { Color = c2, Material = finMat }) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + local base = V(math.cos(a) * 0.6 * s, -0.15 * s, math.sin(a) * 0.6 * s) + local p1 = base + V(math.sin(i) * 0.15 * s, -0.7 * s, 0) + local p2 = p1 + V(-math.sin(i) * 0.2 * s, -0.7 * s, math.cos(i) * 0.1 * s) + cyl(model, base, p1, 0.07 * s, { Color = c2, Material = NEON }) + cyl(model, p1, p2, 0.05 * s, { Color = c1, Material = NEON }) + end + return finish(model, root, anchored) + end + + -- тело-эллипсоид для остальных форм + local L, H, W = 2 * s, 0.9 * s, 0.45 * s + if shape == "long" or shape == "sturgeon" then + L, H, W = 2.6 * s, 0.6 * s, 0.5 * s + elseif shape == "tall" then + L, H, W = 1.7 * s, 1.25 * s, 0.38 * s + elseif shape == "shark" then + L, H, W = 3 * s, 0.75 * s, 0.7 * s + elseif shape == "sword" then + L, H, W = 2.4 * s, 0.75 * s, 0.5 * s + elseif shape == "puffer" then + L, H, W = 1.4 * s, 1.3 * s, 1.3 * s + elseif shape == "angler" then + L, H, W = 1.6 * s, 1.3 * s, 1.1 * s + end + + root = oval(model, V(L, H, W), CFrame.new(), { Name = "Body", Color = c1, Material = mat }) + if shape ~= "puffer" and shape ~= "angler" then + oval(model, V(L * 0.82, H * 0.55, W * 1.03), CFrame.new(L * 0.03, -H * 0.2, 0), { Color = lighten(c1, 0.45), Material = mat }) + end + + -- хвост + if shape == "shark" then + oval(model, V(L * 0.25, H * 1.0, W * 0.12), CFrame.new(-L * 0.56, H * 0.32, 0) * CFrame.Angles(0, 0, math.rad(-35)), { Color = c1, Material = mat }) + oval(model, V(L * 0.17, H * 0.6, W * 0.12), CFrame.new(-L * 0.54, -H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(35)), { Color = c1, Material = mat }) + else + local th = fish.bigTail and 0.95 or 0.62 + oval(model, V(L * 0.22, H * 0.36, W * 0.5), CFrame.new(-L * 0.44, 0, 0), { Color = c1, Material = mat }) + for _, sgn in ipairs({ 1, -1 }) do + oval(model, V(L * 0.28, H * th, W * 0.14), CFrame.new(-L * 0.58, sgn * H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(-sgn * 32)), { Color = c2, Material = finMat }) + end + end + + -- спинной плавник + if shape == "shark" then + wedge(model, V(W * 0.14, H * 0.95, L * 0.2), CFrame.new(-L * 0.02, H * 0.78, 0) * CFrame.Angles(0, math.rad(-90), 0), { Color = c1, Material = mat }) + elseif shape == "sword" then + oval(model, V(L * 0.5, H * 1.2, W * 0.1), CFrame.new(L * 0.05, H * 0.65, 0), { Color = c2, Material = finMat }) + elseif shape ~= "puffer" then + local big = fish.bigFins and 1.8 or 1 + oval(model, V(L * 0.42, H * 0.45 * big, W * 0.12), CFrame.new(-L * 0.06, H * 0.4 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat }) + oval(model, V(L * 0.22, H * 0.3 * big, W * 0.1), CFrame.new(-L * 0.2, -H * 0.42 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat }) + end + if fish.spikes and shape ~= "puffer" then + for i = 0, 4 do + local x = -L * 0.2 + i * L * 0.08 + block(model, V(0.05 * s, H * 0.3, 0.05 * s), CFrame.new(x, H * 0.55, 0) * CFrame.Angles(0, 0, math.rad(-15)), { Color = darken(c2, 0.3) }) + end + end + -- грудные плавники + for _, sgn in ipairs({ -1, 1 }) do + oval(model, V(L * 0.2, H * 0.14, W * 0.06), CFrame.new(L * 0.12, -H * 0.15, sgn * W * 0.48) * CFrame.Angles(0, math.rad(sgn * 25), math.rad(-20)), { Color = c2, Material = finMat }) + end + + -- узоры + if fish.stripes then + for i = 1, fish.stripes do + local x = -L * 0.3 + (i - 0.5) * (L * 0.6 / fish.stripes) + local hh = (H / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2)) + local hw = (W / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2)) + oval(model, V(L * 0.06, hh * 2.04, hw * 2.08), CFrame.new(x, 0, 0), { Color = c2, Material = mat }) + end + end + if fish.spots then + for i = 1, fish.spots do + local x = rng:NextNumber(-0.35, 0.3) * L + local y = rng:NextNumber(-0.1, 0.35) * H + local z = halfWidth(L, H, W, x, y) + if z > 0 then + local sgn = (i % 2 == 0) and 1 or -1 + ball(model, V(x, y, sgn * z * 0.96), 0.13 * s, { Color = c2 }) + end + end + end + + -- глаза и рот + local ex, ey = L * 0.32, H * 0.12 + local ez = halfWidth(L, H, W, ex, ey) + local eyeSize = (shape == "puffer") and H * 0.3 or ((shape == "angler") and H * 0.14 or math.max(0.12 * s, H * 0.22)) + addEyes(model, ex, ey, ez * 0.92, eyeSize) + if shape == "angler" then + oval(model, V(L * 0.12, H * 0.5, W * 0.85), CFrame.new(L * 0.46, -H * 0.12, 0), { Color = C(25, 15, 20) }) + for i = -2, 2 do + wedge(model, V(0.05 * s, 0.16 * s, 0.06 * s), CFrame.new(L * 0.5, H * 0.08, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) }) + end + local a, b, c = V(L * 0.3, H * 0.48, 0), V(L * 0.55, H * 0.95, 0), V(L * 0.78, H * 0.85, 0) + cyl(model, a, b, 0.05 * s, { Color = c1 }) + cyl(model, b, c, 0.045 * s, { Color = c1 }) + local lure = ball(model, c, 0.26 * s, { Color = c2, Material = NEON }) + local light = Instance.new("PointLight") + light.Color = c2 + light.Range = 8 + light.Brightness = 2 + light.Parent = lure + else + oval(model, V(L * 0.05, H * 0.12, W * 0.35), CFrame.new(L * 0.49, -H * 0.08, 0), { Color = C(40, 25, 25) }) + end + if fish.teeth then + for i = -1, 1 do + wedge(model, V(0.05 * s, 0.12 * s, 0.05 * s), CFrame.new(L * 0.5, -H * 0.02, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) }) + end + end + if fish.whiskers then + for _, sgn in ipairs({ -1, 1 }) do + cyl(model, V(L * 0.46, -H * 0.12, sgn * W * 0.15), V(L * 0.62, -H * 0.42, sgn * W * 0.45), 0.04 * s, { Color = c2 }) + end + end + if shape == "sword" then + cyl(model, V(L * 0.45, 0, 0), V(L * 0.45 + L * 0.7, H * 0.03, 0), H * 0.08, { Color = c2, Material = mat }) + elseif shape == "sturgeon" then + oval(model, V(L * 0.22, H * 0.45, W * 0.45), CFrame.new(L * 0.52, -H * 0.08, 0), { Color = c1, Material = mat }) + for i = 0, 6 do + block(model, V(0.16 * s, 0.16 * s, 0.1 * s), CFrame.new(L * 0.3 - i * L * 0.11, H * 0.47, 0) * CFrame.Angles(0, 0, math.rad(45)), { Color = c2, Material = finMat }) + end + for _, sgn in ipairs({ -1, 1 }) do + cyl(model, V(L * 0.55, -H * 0.25, sgn * W * 0.1), V(L * 0.6, -H * 0.55, sgn * W * 0.15), 0.035 * s, { Color = c2 }) + end + elseif shape == "puffer" then + for i = 1, 30 do + local y = 1 - (i - 0.5) / 30 * 2 + local r = math.sqrt(1 - y * y) + local th = i * 2.4 + local dir = V(math.cos(th) * r, y, math.sin(th) * r) + local base = V(dir.X * L / 2, dir.Y * H / 2, dir.Z * W / 2) + cyl(model, base, base + dir * 0.28 * s, 0.05 * s, { Color = darken(c2, 0.1) }) + end + end + if glow then + sparkles(root, c2, 4) + end + return finish(model, root, anchored) +end + +---------------------------------------------------------------- поплавок + +function M.buildBobber() + local model = Instance.new("Model") + model.Name = "Bobber" + local root = newPart(model, { Name = "Root", Shape = Enum.PartType.Ball, Size = V(0.7, 0.7, 0.7), CFrame = CFrame.new(), Color = C(255, 255, 255) }) + newPart(model, { Shape = Enum.PartType.Ball, Size = V(0.72, 0.72, 0.72), CFrame = CFrame.new(0, 0.2, 0), Color = C(230, 40, 40) }) + newPart(model, { Size = V(0.07, 0.6, 0.07), CFrame = CFrame.new(0, 0.75, 0), Color = C(230, 40, 40) }) + finish(model, root, false) + root.Anchored = true + return model +end + +return M +]=====]) +make('Script', 'MapBuilder', game.ServerScriptService, [=====[-- MapBuilder (Script) -> ServerScriptService +-- Строит лобби и Мир 1 «Тихое озеро» при запуске игры, настраивает свет и воду. +-- Если в Workspace уже есть папка "FishingMap", детали не строятся заново +-- (террейн, свет и точка появления настраиваются всегда). + +local Workspace = game:GetService("Workspace") +local Lighting = game:GetService("Lighting") +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) + +local V = Vector3.new +local rng = Random.new(7) + +---------------------------------------------------------------- свет и атмосфера + +local function ensure(class, parent, props) + local obj = parent:FindFirstChildOfClass(class) or Instance.new(class) + for k, v in pairs(props) do + obj[k] = v + end + obj.Parent = parent + return obj +end + +Lighting.ClockTime = 14.5 +Lighting.Brightness = 2.3 +Lighting.Ambient = Color3.fromRGB(70, 70, 85) +Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) +Lighting.EnvironmentDiffuseScale = 0.6 +Lighting.EnvironmentSpecularScale = 0.8 +ensure("Atmosphere", Lighting, { + Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, + Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), +}) +ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) +ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) +ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) + +---------------------------------------------------------------- вода + +local terrain = Workspace.Terrain +-- низкое отражение, иначе вода «засвечивается» небом и выглядит белой +terrain.WaterColor = Color3.fromRGB(20, 95, 115) +terrain.WaterTransparency = 0.2 +terrain.WaterReflectance = 0.08 +terrain.WaterWaveSize = 0.1 +terrain.WaterWaveSpeed = 8 + +---------------------------------------------------------------- МИР 1: террейн (строится всегда) + +local W = V(0, 0, 1500) -- центр Мира 1 +local GROUND_Y = 4 -- верх земли +local WATER_Y = 0 -- поверхность воды + +-- озеро из нескольких кругов: { x, z, радиус } +local LAKES = Config.Worlds[1].lakes + +terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Grass) +-- холмы по краям +for _, h in ipairs({ { -190, 160, 50 }, { 185, 175, 45 }, { -175, -175, 60 }, { 190, -150, 55 }, { 0, -215, 50 }, { -215, 0, 40 }, { 215, 30, 42 } }) do + terrain:FillBall(W + V(h[1], -14, h[2]), h[3], Enum.Material.Grass) +end +-- порядок важен: песок → выемка → ил → вода +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 11, Enum.Material.Sand) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 7, Enum.Material.Air) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 2, Enum.Material.Air) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) +end +-- дорожка от точки прибытия к причалу и площадка +terrain:FillBlock(CFrame.new(W + V(0, 2, 100)), V(8, 4, 44), Enum.Material.Ground) +terrain:FillCylinder(CFrame.new(W + V(0, 2, 130)), 4, 17, Enum.Material.Cobblestone) + +---------------------------------------------------------------- точка появления в лобби + +local spawn = Workspace:FindFirstChildOfClass("SpawnLocation") +if not spawn then + spawn = Instance.new("SpawnLocation") + spawn.Parent = Workspace +end +spawn.Anchored = true +spawn.Size = V(8, 0.2, 8) +spawn.CFrame = CFrame.new(0, 1.15, 50) +spawn.Transparency = 1 +spawn.Duration = 0 +for _, d in ipairs(spawn:GetChildren()) do + if d:IsA("Decal") or d:IsA("Texture") then + d.Transparency = 1 + end +end + +if Workspace:FindFirstChild("FishingMap") then + return +end + +local map = Instance.new("Folder") +map.Name = "FishingMap" +map.Parent = Workspace +local zonesFolder = Instance.new("Folder") +zonesFolder.Name = "FishingZones" +zonesFolder.Parent = map + +---------------------------------------------------------------- помощники + +local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p +end + +local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) +end + +local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) +end + +local function surfaceText(part, face, text, color, extra) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.RichText = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.4 + t.Text = text + t.Parent = sg + local pad = Instance.new("UIPadding") + pad.PaddingLeft = UDim.new(0.05, 0) + pad.PaddingRight = UDim.new(0.05, 0) + pad.PaddingTop = UDim.new(0.06, 0) + pad.PaddingBottom = UDim.new(0.06, 0) + pad.Parent = t + for k, v in pairs(extra or {}) do + t[k] = v + end + return t +end + +local function billboard(target, text, color, offsetY, width) + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(width or 300, 64) + bb.StudsOffset = V(0, offsetY or 5, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = target + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.15 + t.Text = text + t.Parent = bb + return bb +end + +local function prompt(target, actionText, objectText, action, dist) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = dist or 13 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp +end + +local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) +end + +local function groundY(x, z) + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Include + params.FilterDescendantsInstances = { terrain } + params.IgnoreWater = true + local hit = Workspace:Raycast(V(x, 150, z), V(0, -300, 0), params) + return hit and hit.Position.Y or GROUND_Y, hit and hit.Material +end + +local function lamp(pos, color) + vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) }) + P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local light = Instance.new("PointLight") + light.Range = 16 + light.Brightness = 1.2 + light.Color = color or Color3.fromRGB(255, 210, 150) + light.Parent = bulb +end + +local function tree(pos, kind) + if kind == "pine" then + local h = rng:NextNumber(8, 12) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass }) + end + else + local birch = kind == "birch" + local h = rng:NextNumber(7, 10) + vcyl(pos + V(0, h / 2, 0), h, 1.5, { + Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45), + Material = Enum.Material.Wood, + }) + local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60) + local s = rng:NextNumber(9, 12) + ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass }) + end +end + +local function bush(pos) + local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55) + for i = 1, 3 do + ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass }) + end + if rng:NextNumber() < 0.5 then + for i = 1, 4 do + ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)], + CanCollide = false, + }) + end + end +end + +local function bench(cf) + local seat = Instance.new("Seat") + seat.Anchored = true + seat.Size = V(5, 0.4, 1.6) + seat.CFrame = cf * CFrame.new(0, 1.6, 0) + seat.Material = Enum.Material.WoodPlanks + seat.Color = Color3.fromRGB(150, 105, 65) + seat.TopSurface = Enum.SurfaceType.Smooth + seat.Parent = map + for _, x in ipairs({ -2.1, 2.1 }) do + P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal }) + end + P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) }) +end + +local function npc(name, cf, colors, action, actionText) + local ok, rig = pcall(function() + local d = Instance.new("HumanoidDescription") + d.HeadColor = colors.skin + d.LeftArmColor = colors.skin + d.RightArmColor = colors.skin + d.TorsoColor = colors.shirt + d.LeftLegColor = colors.pants + d.RightLegColor = colors.pants + return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15) + end) + if not ok or not rig then + warn("NPC не создан: " .. tostring(rig)) + return nil + end + rig.Name = name + local hum = rig:FindFirstChildOfClass("Humanoid") + hum.DisplayName = name + hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff + hum.NameDisplayDistance = 60 + local root = rig:FindFirstChild("HumanoidRootPart") + root.Anchored = true + rig:PivotTo(cf) + rig.Parent = map + + local head = rig:FindFirstChild("Head") + if head then + if not head:FindFirstChildOfClass("Decal") then + local face = Instance.new("Decal") + face.Name = "face" + face.Texture = "rbxasset://textures/face.png" + face.Parent = head + end + -- панама рыбака + local function hatPart(size, offset, shape) + local p = Instance.new("Part") + p.Shape = shape + p.Size = size + p.CanCollide = false + p.Massless = true + p.Color = colors.hat + p.Material = Enum.Material.Fabric + p.CFrame = head.CFrame * offset + local w = Instance.new("Weld") + w.Part0 = head + w.Part1 = p + w.C0 = head.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Parent = rig + end + hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + end + if action then + prompt(root, actionText, name, action, 14) + end + return rig +end + +-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей +local function stall(cf, opt) + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local wall, dark = opt.wall, opt.wall:Lerp(Color3.new(0, 0, 0), 0.3) + + P({ Size = V(24, 1, 17), CFrame = at(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 80) }) + P({ Size = V(24, 13, 1), CFrame = at(0, 7.5, 8), Material = Enum.Material.WoodPlanks, Color = wall }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 13, 17), CFrame = at(s * 11.5, 7.5, 0), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(1.5, 14.5, 1.5), CFrame = at(s * 11.6, 7.25, -8.3), Material = Enum.Material.Wood, Color = dark }) + end + P({ Size = V(26, 1, 19), CFrame = at(0, 14.5, 0), Material = Enum.Material.WoodPlanks, Color = dark }) + -- полосатый навес + for i = 0, 7 do + P({ + Size = V(3, 0.35, 6), + CFrame = at(-10.5 + i * 3, 13.1, -10.6) * CFrame.Angles(math.rad(-22), 0, 0), + Material = Enum.Material.Fabric, + Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, + }) + ball(at(-10.5 + i * 3, 11.9, -13.3).Position, 0.9, { Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, Material = Enum.Material.Fabric }) + end + -- прилавок + local counter = P({ Size = V(18, 4, 3), CFrame = at(0, 3, -4), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(19, 0.5, 3.8), CFrame = at(0, 5.25, -4), Material = Enum.Material.Wood, Color = dark }) + -- вывеска + local board = P({ Size = V(20, 4.5, 0.6), CFrame = at(0, 17.6, -9.2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 45, 30) }) + P({ Size = V(20.8, 5.3, 0.3), CFrame = at(0, 17.6, -8.9), Material = Enum.Material.Neon, Color = opt.glow }) + for _, x in ipairs({ -8, 8 }) do + P({ Size = V(0.6, 3, 0.6), CFrame = at(x, 15.5, -9.2), Material = Enum.Material.Wood, Color = dark }) + end + surfaceText(board, Enum.NormalId.Front, opt.title, opt.titleColor) + -- фонарики + for _, x in ipairs({ -9.5, 9.5 }) do + local l = P({ Size = V(0.8, 1.1, 0.8), CFrame = at(x, 11.2, -9.4), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 210, 140) }) + local light = Instance.new("PointLight") + light.Range = 14 + light.Brightness = 1 + light.Color = Color3.fromRGB(255, 210, 150) + light.Parent = l + end + -- бочки по бокам + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * 14.5, 2.6, -5).Position, 3.2, 2.6, { Color = Color3.fromRGB(130, 85, 50), Material = Enum.Material.Wood }) + vcyl(at(s * 14.5, 2.6, -5).Position, 0.3, 2.75, { Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal }) + end + + prompt(counter, opt.promptText, opt.promptObject, opt.action, 14) + if opt.npcName then + npc(opt.npcName, at(0, 4, 1.5), opt.npcColors) + end + if opt.decor then + opt.decor(at) + end + return counter +end + +local function portal(baseCF, title, color, worldId, locked) + local center = baseCF * CFrame.new(0, 10, 0) + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ + Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), + Material = Enum.Material.Slate, + Color = Color3.fromRGB(80, 85, 100), + }) + if i % 2 == 0 then + P({ + Size = V(0.6, 0.6, 1.9), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), + Material = Enum.Material.Neon, + Color = color, + }) + end + end + local disc = P({ + Name = "Portal_" .. worldId, + Shape = Enum.PartType.Cylinder, + Size = V(0.3, 2 * R - 1, 2 * R - 1), + CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, + Color = color, + Transparency = 0.3, + CanCollide = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc +end + +local function banner(pos, color, icon, text) + local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби + vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false }) + P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + local label = icon .. "\n" .. text + surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1)) +end + +local function arch(cf, span, height, title, color) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) }) + end + local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) }) + P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color }) + surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120)) + surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120)) +end + +---------------------------------------------------------------- ЛОББИ + +local FLOOR = 1 -- верх пола лобби + +P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) }) +P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) }) +P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) }) +-- дорожки-лучи к лавкам и порталам +for _, a in ipairs({ 0, 90, 180, 270 }) do + local r = math.rad(a) + P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) }) +end + +marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 50)) + +-- фонтан со статуей золотой рыбы +vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) +vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) +vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) }) +local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) +vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) +do + local statue = Models.buildFish("Gold", "Golden", 3.2, true) + statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40))) + statue.Parent = map + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 12 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.6, 0) + sp.Lifetime = NumberRange.new(1, 1.5) + sp.SpreadAngle = Vector2.new(180, 180) + sp.Speed = NumberRange.new(1, 2) + sp.Parent = statue.PrimaryPart + -- струи воды + local att = Instance.new("Attachment") + att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх + att.Orientation = V(0, 0, -90) -- направить струю вверх + att.Parent = bowl + local water = Instance.new("ParticleEmitter") + water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255)) + water.Transparency = NumberSequence.new(0.3, 1) + water.Size = NumberSequence.new(0.6, 1.2) + water.Rate = 60 + water.Lifetime = NumberRange.new(1.2, 1.5) + water.Speed = NumberRange.new(10, 12) + water.SpreadAngle = Vector2.new(25, 25) + water.Acceleration = V(0, -25, 0) + water.Parent = att +end +for i = 0, 5 do + local a = math.rad(i * 60 + 30) + bench(CFrame.lookAt(V(math.cos(a) * 17, FLOOR, math.sin(a) * 17), V(math.cos(a) * 30, FLOOR, math.sin(a) * 30))) +end + +-- фонари по кругу +for i = 0, 7 do + local a = math.rad(i * 45 + 22.5) + lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) +end + +-- клумбы с деревьями +for _, deg in ipairs({ 225, 315 }) do + local a = math.rad(deg) + local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58) + vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) }) + vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) }) + tree(p + V(0, 2, 0), "round") + for j = 1, 5 do + local b = rng:NextNumber(0, math.pi * 2) + ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] }) + end +end + +-- баннеры +local bannerData = { + { 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" }, + { 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" }, + { 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" }, + { 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" }, + { 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" }, + { 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" }, +} +for _, b in ipairs(bannerData) do + local a = math.rad(b[1]) + banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4]) +end + +-- живая изгородь по краю (с проходами) +for deg = 0, 359, 7 do + local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) + if not skip then + local a = math.rad(deg) + local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82) + P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) }) + end +end + +-- магазин (запад) и скупка (восток) +stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ", + titleColor = Color3.fromRGB(255, 230, 120), + wall = Color3.fromRGB(185, 130, 85), + stripeA = Color3.fromRGB(215, 55, 55), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(255, 170, 60), + action = "Shop", + promptText = "Открыть магазин", + promptObject = "Магазин", + npcName = "Продавец Михалыч", + npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) }, + decor = function(at) + -- витрина удочек на задней стене + for i, rod in ipairs(Config.Rods) do + local x = -8 + (i - 1) * 4 + local m = Models.buildRod(rod.id, 0, true) + m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0)) + m.Parent = map + local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) }) + surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180)) + end + end, +}) + +stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "💰 СКУПКА РЫБЫ", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(110, 150, 175), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Зина", + npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) }, + decor = function(at) + -- лёд с рыбой на прилавке + P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 }) + for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do + local f = Models.buildFish(id, nil, 0.9, true) + f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90))) + f.Parent = map + end + -- весы + P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) }) + -- ящики с уловом + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true) + f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0)) + f.Parent = map + end + end, +}) + +-- порталы во все миры и арка с названием +local portalCF = CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)) +arch(portalCF, 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) +for i, w in ipairs(Config.Worlds) do + local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") + portal(portalCF * CFrame.new(-27 + (i - 1) * 18, 0, 0), title, w.color, w.id, w.soon) +end + +-- невидимая стена по кругу: из лобби не уйти +for deg = 0, 359, 5 do + local a = math.rad(deg) + local p = V(math.cos(a) * 86, 30, math.sin(a) * 86) + P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false }) +end + +-- донат-лавки +stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "💎 ПРЕМИУМ", + titleColor = Color3.fromRGB(255, 220, 120), + wall = Color3.fromRGB(120, 70, 170), + stripeA = Color3.fromRGB(255, 200, 60), + stripeB = Color3.fromRGB(150, 80, 210), + glow = Color3.fromRGB(255, 200, 60), + action = "RobuxPasses", + promptText = "Открыть", + promptObject = "Премиум-пропуска", + npcName = "Барон Злотов", + npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) }, + decor = function(at) + -- сундук с самоцветами + P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) }) + P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do + P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c }) + end + P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) }) + end, +}) +stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "🪙 СОКРОВИЩНИЦА", + titleColor = Color3.fromRGB(255, 235, 140), + wall = Color3.fromRGB(200, 160, 70), + stripeA = Color3.fromRGB(230, 180, 40), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(255, 220, 90), + action = "RobuxProducts", + promptText = "Открыть", + promptObject = "Наборы монет", + npcName = "Купчиха Злата", + npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) }, + decor = function(at) + -- горки монет + for i = 0, 4 do + for j = 0, 3 - (i % 3) do + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) }) + end + end + for _, s in ipairs({ -1, 1 }) do + ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric }) + ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal }) + end + end, +}) + +-- сундук с ежедневной наградой +do + local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50)) + local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) }) + for _, x in ipairs({ -1.8, 1.8 }) do + P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + end + P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) }) + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 8 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.5, 0) + sp.Parent = base + billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260) + prompt(base, "Забрать", "Сундук", "Daily", 12) +end + +-- табличка «Как играть» +do + local pos = V(-14, FLOOR, 34) + local cf = CFrame.lookAt(pos, V(0, FLOOR, 50)) + for _, x in ipairs({ -6.5, 6.5 }) do + P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + surfaceText(board, Enum.NormalId.Front, + "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, клик у воды\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", + Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) +end + +---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО (детали) + +local function inLake(x, z, extra) + for _, l in ipairs(LAKES) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then + return true + end + end + return false +end + +-- прибытие +local arrive = W + V(0, GROUND_Y, 128) +marker("World1Spawn", CFrame.lookAt(arrive + V(0, 1, 0), arrive + V(0, 1, -10))) +arch(CFrame.new(W + V(0, GROUND_Y, 112)), 14, 11, "🌊 ТИХОЕ ОЗЕРО", Color3.fromRGB(80, 200, 255)) +portal(CFrame.lookAt(W + V(-26, GROUND_Y, 140), arrive), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") +stall(CFrame.lookAt(W + V(30, GROUND_Y, 140), arrive), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(150, 115, 80), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Гриша", + npcColors = { skin = Color3.fromRGB(200, 150, 110), shirt = Color3.fromRGB(70, 130, 80), pants = Color3.fromRGB(60, 50, 40), hat = Color3.fromRGB(200, 170, 110) }, +}) + +-- доска «Кто водится в озере» +do + local pos = W + V(-16, GROUND_Y, 104) + local cf = CFrame.lookAt(pos, W + V(0, GROUND_Y, 120)) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + local lines = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } + for _, f in ipairs(Config.Zones.World1.fish) do + local r = Config.Rarities[f.rarity] + table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) + end + surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) +end + +-- костёр с брёвнами +do + local c = W + V(14, GROUND_Y, 118) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local fireBase = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = fireBase + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = fireBase + for _, a in ipairs({ 0, 2.1, 4.2 }) do + local p = c + V(math.cos(a) * 6, 0.6, math.sin(a) * 6) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 1.4, 1.4), CFrame = CFrame.lookAt(p, c) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(115, 80, 50) }) + end +end + +-- дед-рыбак с подсказками +npc("Дед Петрович", CFrame.lookAt(W + V(-7, GROUND_Y + 3, 80), W + V(0, GROUND_Y + 3, 95)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(110, 120, 80), pants = Color3.fromRGB(70, 60, 45), hat = Color3.fromRGB(90, 110, 60), +}, "Talk", "Поговорить") + +-- домик рыбака +do + local cf = CFrame.lookAt(W + V(-34, GROUND_Y, 100), W + V(0, GROUND_Y, 100)) + local logC = Color3.fromRGB(130, 90, 55) + P({ Size = V(14, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(110, 80, 50) }) + P({ Size = V(14, 8, 1), CFrame = cf * CFrame.new(0, 5, 5.5), Material = Enum.Material.Wood, Color = logC }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 8, 12), CFrame = cf * CFrame.new(s * 6.5, 5, 0), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(5, 8, 1), CFrame = cf * CFrame.new(s * 4.5, 5, -5.5), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(16, 1, 8.8), CFrame = cf * CFrame.new(0, 11.2, s * 3.4) * CFrame.Angles(math.rad(-s * 38), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 60, 45) }) + end + P({ Size = V(4, 2, 1), CFrame = cf * CFrame.new(0, 8, -5.5), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(2.2, 2, 0.3), CFrame = cf * CFrame.new(-4.5, 5.5, -6.05), Material = Enum.Material.Glass, Color = Color3.fromRGB(255, 225, 150), Transparency = 0.2 }) + P({ Size = V(14, 3, 1), CFrame = cf * CFrame.new(0, 10.5, 5.5), Material = Enum.Material.Wood, Color = logC }) +end + +-- причалы +local function pier(center, size) + P({ Size = size, Position = center, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local alongZ = size.Z > size.X + local len = alongZ and size.Z or size.X + local wid = alongZ and size.X or size.Z + for d = -len / 2 + 1, len / 2 - 1, 6 do + for _, s in ipairs({ -1, 1 }) do + local off = alongZ and V(s * (wid / 2 - 0.4), 0, d) or V(d, 0, s * (wid / 2 - 0.4)) + vcyl(center + off + V(0, -6, 0), 13, 0.9, { Color = Color3.fromRGB(100, 70, 45), Material = Enum.Material.Wood }) + end + end +end +pier(W + V(0, GROUND_Y + 0.2, 58), V(8, 0.6, 42)) +pier(W + V(-86, GROUND_Y + 0.2, 15), V(34, 0.6, 7)) +pier(W + V(86, GROUND_Y + 0.2, -10), V(34, 0.6, 7)) +lamp(W + V(-3.5, GROUND_Y + 0.5, 40), Color3.fromRGB(255, 220, 160)) +lamp(W + V(-70, GROUND_Y + 0.5, 18), Color3.fromRGB(255, 220, 160)) +lamp(W + V(70, GROUND_Y + 0.5, -13), Color3.fromRGB(255, 220, 160)) + +-- лодка у западного причала +do + local cf = CFrame.new(W + V(-74, WATER_Y + 0.3, 24)) * CFrame.Angles(0, math.rad(15), 0) + local hull = Color3.fromRGB(170, 70, 50) + P({ Size = V(4, 0.5, 9), CFrame = cf, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.4, 1.4, 9), CFrame = cf * CFrame.new(s * 2, 0.7, 0), Material = Enum.Material.Wood, Color = hull }) + P({ Size = V(4.4, 1.4, 0.4), CFrame = cf * CFrame.new(0, 0.7, s * 4.5), Material = Enum.Material.Wood, Color = hull }) + end + P({ Size = V(4, 0.3, 1.2), CFrame = cf * CFrame.new(0, 1, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) +end + +-- кувшинки и камыши +for _, l in ipairs(LAKES) do + for _ = 1, 7 do + local a, d = rng:NextNumber(0, math.pi * 2), rng:NextNumber(6, l[3] - 5) + local x, z = l[1] + math.cos(a) * d, l[2] + math.sin(a) * d + local size = rng:NextNumber(2, 3.5) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.28, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(70, 150, 60), CanCollide = false }) + if rng:NextNumber() < 0.4 then + ball(W + V(x + 0.3, WATER_Y + 0.55, z), 0.7, { Color = Color3.fromRGB(255, 150, 190), CanCollide = false }) + end + end + for _ = 1, 9 do + local a = rng:NextNumber(0, math.pi * 2) + local x, z = l[1] + math.cos(a) * (l[3] + 1.2), l[2] + math.sin(a) * (l[3] + 1.2) + local inOther = false + for _, o in ipairs(LAKES) do + if o ~= l and (V(x, 0, z) - V(o[1], 0, o[2])).Magnitude < o[3] + 1 then + inOther = true + end + end + if not inOther and not (math.abs(x) < 6 and z > 30) then + for _ = 1, 5 do + local h = rng:NextNumber(3, 5) + local p = W + V(x + rng:NextNumber(-1.2, 1.2), WATER_Y + h / 2 - 0.5, z + rng:NextNumber(-1.2, 1.2)) + P({ Size = V(0.18, h, 0.18), Position = p, Color = Color3.fromRGB(85, 130, 50), CanCollide = false }) + P({ Size = V(0.35, 0.9, 0.35), Position = p + V(0, h / 2 - 0.3, 0), Color = Color3.fromRGB(110, 70, 40), CanCollide = false }) + end + end + end +end + +-- деревья, кусты, камни +local function freeSpot(x, z) + if inLake(x, z, 14) then + return false + end + if (V(x, 0, z) - V(0, 0, 128)).Magnitude < 34 then + return false + end + if math.abs(x) < 9 and z > 70 and z < 125 then + return false + end + if (V(x, 0, z) - V(-34, 0, 100)).Magnitude < 14 then + return false + end + return true +end + +local placed = 0 +for _ = 1, 400 do + if placed >= 110 then + break + end + local x, z = rng:NextNumber(-230, 230), rng:NextNumber(-230, 230) + if freeSpot(x, z) then + local y = groundY(W.X + x, W.Z + z) + local roll = rng:NextNumber() + tree(W + V(x, y - 0.5, z), roll < 0.35 and "pine" or (roll < 0.5 and "birch" or "round")) + placed += 1 + end +end +for _ = 1, 60 do + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if freeSpot(x, z) then + bush(W + V(x, groundY(W.X + x, W.Z + z) - 0.6, z)) + end +end +for _, l in ipairs(LAKES) do + for _ = 1, 4 do + local a = rng:NextNumber(0, math.pi * 2) + local x, z = l[1] + math.cos(a) * (l[3] + 8), l[2] + math.sin(a) * (l[3] + 8) + if not inLake(x, z, 3) and not (math.abs(x) < 8 and z > 30) then + local s = rng:NextNumber(2.5, 5) + P({ Size = V(s, s * 0.7, s * 0.9), CFrame = CFrame.new(W + V(x, groundY(W.X + x, W.Z + z), z)) * CFrame.Angles(rng:NextNumber(0, 1), rng:NextNumber(0, 6), rng:NextNumber(0, 1)), Material = Enum.Material.Rock, Color = Color3.fromRGB(125, 125, 130) }) + end + end +end + +-- фонари вдоль дорожки +for _, z in ipairs({ 84, 100 }) do + lamp(W + V(6, GROUND_Y, z)) + lamp(W + V(-6, GROUND_Y, z)) +end + +-- невидимые стены по краю мира +for _, w in ipairs({ + { V(0, 0, 245), V(500, 120, 2) }, + { V(0, 0, -245), V(500, 120, 2) }, + { V(245, 0, 0), V(2, 120, 500) }, + { V(-245, 0, 0), V(2, 120, 500) }, +}) do + P({ Size = w[2], Position = W + w[1] + V(0, 40, 0), Transparency = 1 }) +end + +---------------------------------------------------------------- помощники для новых миров + +local function cylA(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) +end + +local function worldWalls(center) + for _, w in ipairs({ + { V(0, 0, 245), V(500, 160, 2) }, + { V(0, 0, -245), V(500, 160, 2) }, + { V(245, 0, 0), V(2, 160, 500) }, + { V(-245, 0, 0), V(2, 160, 500) }, + }) do + P({ Size = w[2], Position = center + w[1] + V(0, 60, 0), Transparency = 1, CanQuery = false }) + end +end + +local function bestiary(pos, lookAt, worldId, title, titleHex) + local cf = CFrame.lookAt(pos, lookAt) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + local lines = { ("%s"):format(titleHex, title) } + for _, f in ipairs(Config.Zones[worldId].fish) do + local r = Config.Rarities[f.rarity] + table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) + end + surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) +end + +local function campfire(c) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local base = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = base + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = base +end + +local function torch(pos) + cylA(pos, pos + V(0, 5, 0), 0.35, { Color = Color3.fromRGB(170, 130, 70), Material = Enum.Material.Wood }) + local top = P({ Size = V(0.8, 0.8, 0.8), Position = pos + V(0, 5.3, 0), Color = Color3.fromRGB(90, 60, 30), Material = Enum.Material.Wood }) + local fire = Instance.new("Fire") + fire.Size = 3 + fire.Heat = 6 + fire.Parent = top + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 170, 90) + light.Range = 14 + light.Parent = top +end + +---------------------------------------------------------------- МИР 2: ТРОПИЧЕСКИЙ ОСТРОВ + +do + local W2 = Config.Worlds[2].center + local leafColors = { Color3.fromRGB(60, 160, 60), Color3.fromRGB(85, 185, 70) } + + -- море, мелководье уступами, песчаный пляж, зелёный остров, холм + terrain:FillBlock(CFrame.new(W2 + V(0, -34, 0)), V(520, 8, 520), Enum.Material.Sand) + terrain:FillBlock(CFrame.new(W2 + V(0, -15, 0)), V(520, 30, 520), Enum.Material.Water) + terrain:FillCylinder(CFrame.new(W2 + V(0, -17, 0)), 28, 140, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -15, 0)), 32, 118, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -14, 0)), 34, 106, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -13.5, 0)), 35, 88, Enum.Material.Grass) + terrain:FillBall(W2 + V(20, -20, -30), 32, Enum.Material.Grass) + terrain:FillCylinder(CFrame.new(W2 + V(0, 2, 40)), 4, 14, Enum.Material.Sandstone) + + local function palm(pos) + local h = rng:NextNumber(12, 18) + local a = rng:NextNumber(0, math.pi * 2) + local dir = V(math.cos(a), 0, math.sin(a)) + local p = pos + for i = 1, 6 do + local t = i / 6 + local q = pos + V(0, h * t, 0) + dir * (t * t * h * 0.3) + local d = 1.4 - t * 0.45 + cylA(p, q, d, { Color = Color3.fromRGB(150, 115, 70), Material = Enum.Material.Wood }) + ball(q, d, { Color = Color3.fromRGB(130, 100, 60), Material = Enum.Material.Wood }) + p = q + end + for k = 0, 7 do + local b = k / 8 * math.pi * 2 + rng:NextNumber(-0.2, 0.2) + local ld = V(math.cos(b), 0, math.sin(b)) + local mid = p + ld * 3.5 + V(0, 0.8, 0) + local tipP = p + ld * 7 + V(0, -2.2, 0) + for _, seg in ipairs({ { p, mid }, { mid, tipP } }) do + P({ Size = V(2, 0.15, (seg[2] - seg[1]).Magnitude), CFrame = CFrame.lookAt((seg[1] + seg[2]) / 2, seg[2]), Material = Enum.Material.Grass, Color = leafColors[k % 2 + 1], CanCollide = false }) + end + end + for _ = 1, 3 do + ball(p + V(rng:NextNumber(-0.7, 0.7), -0.7, rng:NextNumber(-0.7, 0.7)), 0.9, { Color = Color3.fromRGB(110, 75, 40) }) + end + end + + local function tikiHut(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Size = V(12, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 75) }) + for _, c in ipairs({ { -5, -5 }, { 5, -5 }, { -5, 5 }, { 5, 5 } }) do + vcyl((cf * CFrame.new(c[1], 4.5, c[2])).Position, 8, 0.8, { Color = Color3.fromRGB(200, 175, 100), Material = Enum.Material.Wood }) + end + for i = 0, 4 do + vcyl((cf * CFrame.new(0, 8.8 + i * 1.2, 0)).Position, 1.4, 16 - i * 3.2, { Color = Color3.fromRGB(205, 170, 95), Material = Enum.Material.Grass }) + end + local bar = P({ Size = V(7, 3, 1.5), CFrame = cf * CFrame.new(0, 2.5, -3), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 95, 55) }) + billboard(bar, "🍹", Color3.new(1, 1, 1), 3, 60) + end + + local function umbrella(pos, color) + cylA(pos, pos + V(0, 7, 0), 0.25, { Color = Color3.fromRGB(235, 235, 235), Material = Enum.Material.Metal }) + vcyl(pos + V(0, 7, 0), 0.6, 9, { Color = color, Material = Enum.Material.Fabric }) + vcyl(pos + V(0, 7.5, 0), 0.6, 4.5, { Color = Color3.new(1, 1, 1), Material = Enum.Material.Fabric }) + P({ Size = V(2.2, 0.5, 6), CFrame = CFrame.new(pos + V(3.5, 0.6, 0)) * CFrame.Angles(0, rng:NextNumber(-0.5, 0.5), 0), Color = Color3.fromRGB(245, 245, 240), Material = Enum.Material.Fabric }) + P({ Size = V(2.25, 0.52, 1.2), CFrame = CFrame.new(pos + V(3.5, 0.62, 1.5)), Color = color, Material = Enum.Material.Fabric }) + end + + local coralColors = { Color3.fromRGB(255, 110, 150), Color3.fromRGB(255, 150, 60), Color3.fromRGB(170, 90, 255), Color3.fromRGB(255, 220, 80), Color3.fromRGB(80, 220, 200) } + local function coral(pos) + local c = coralColors[rng:NextInteger(1, #coralColors)] + for _ = 1, rng:NextInteger(3, 5) do + local dir = V(rng:NextNumber(-0.5, 0.5), 1, rng:NextNumber(-0.5, 0.5)).Unit + local h = rng:NextNumber(1.5, 3.5) + cylA(pos, pos + dir * h, 0.45, { Color = c, CanCollide = false }) + ball(pos + dir * h, 0.75, { Color = c:Lerp(Color3.new(1, 1, 1), 0.3), CanCollide = false }) + end + end + + local function starfish(pos) + local c = Color3.fromRGB(255, rng:NextInteger(90, 150), 60) + ball(pos, 0.7, { Color = c, CanCollide = false }) + for k = 0, 4 do + local a = k / 5 * math.pi * 2 + P({ Size = V(0.35, 0.2, 1.1), CFrame = CFrame.new(pos) * CFrame.Angles(0, a, 0) * CFrame.new(0, 0, -0.6), Color = c, CanCollide = false }) + end + end + + local spawn2 = W2 + V(0, 4, 40) + marker("World2Spawn", CFrame.lookAt(spawn2 + V(0, 1, 0), spawn2 + V(0, 1, -10))) + arch(CFrame.new(W2 + V(0, 4, 24)), 14, 11, "🏝 ТРОПИЧЕСКИЙ ОСТРОВ", Color3.fromRGB(255, 190, 70)) + portal(CFrame.lookAt(W2 + V(-32, 4, 60), spawn2), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W2 + V(32, 4, 62), spawn2), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 220), + wall = Color3.fromRGB(200, 170, 110), + stripeA = Color3.fromRGB(40, 180, 170), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(80, 230, 200), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Мигель", + npcColors = { skin = Color3.fromRGB(190, 140, 100), shirt = Color3.fromRGB(240, 120, 60), pants = Color3.fromRGB(240, 230, 200), hat = Color3.fromRGB(230, 210, 150) }, + }) + bestiary(W2 + V(-18, 4, 22), spawn2, "World2", "🐠 КТО ВОДИТСЯ У ОСТРОВА", "#FFD27A") + npc("Капитан Боря", CFrame.lookAt(W2 + V(10, 6, 100), W2 + V(0, 6, 120)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(240, 240, 240), pants = Color3.fromRGB(30, 40, 80), hat = Color3.fromRGB(30, 30, 60), + }, "Talk", "Поговорить") + + pier(W2 + V(0, 3.2, 125), V(8, 0.6, 50)) + pier(W2 + V(125, 3.2, -10), V(50, 0.6, 8)) + for _, z in ipairs({ 105, 125, 145 }) do + torch(W2 + V(4.5, 3.5, z)) + end + for _, x in ipairs({ 110, 140 }) do + torch(W2 + V(x, 3.5, -14.5)) + end + tikiHut(W2 + V(-50, groundY(W2.X - 50, W2.Z - 20), -20), W2) + tikiHut(W2 + V(-20, groundY(W2.X - 20, W2.Z - 65), -65), W2) + campfire(W2 + V(-10, 4, 55)) + for _, deg in ipairs({ 200, 222, 318, 340 }) do + local a = math.rad(deg) + local x, z = math.cos(a) * 99, math.sin(a) * 99 + umbrella(W2 + V(x, groundY(W2.X + x, W2.Z + z), z), coralColors[rng:NextInteger(1, #coralColors)]) + end + + local function free2(x, z) + local r = math.sqrt(x * x + z * z) + if r > 100 then + return false + end + if (V(x, 0, z) - V(0, 0, 45)).Magnitude < 28 then + return false + end + for _, p in ipairs({ { 32, 62 }, { -32, 60 }, { -50, -20 }, { -20, -65 }, { -18, 22 }, { -10, 55 } }) do + if (V(x, 0, z) - V(p[1], 0, p[2])).Magnitude < 16 then + return false + end + end + return true + end + local count = 0 + for _ = 1, 300 do + if count >= 40 then + break + end + local x, z = rng:NextNumber(-100, 100), rng:NextNumber(-100, 100) + if free2(x, z) then + palm(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.5, z)) + count += 1 + end + end + for _ = 1, 35 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(121, 138) + local x, z = math.cos(a) * r, math.sin(a) * r + if not (math.abs(x) < 8 and z > 0) and not (math.abs(z + 10) < 8 and x > 0) then + coral(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.3, z)) + end + end + for _ = 1, 12 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(107, 115) + local x, z = math.cos(a) * r, math.sin(a) * r + starfish(W2 + V(x, groundY(W2.X + x, W2.Z + z) + 0.1, z)) + end + worldWalls(W2) +end + +---------------------------------------------------------------- МИР 3: ЛЕДЯНОЙ ФЬОРД + +do + local W3 = Config.Worlds[3].center + local LAKES3 = Config.Worlds[3].lakes + local HOLES = Config.Worlds[3].holes + + terrain:FillBlock(CFrame.new(W3 + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Snow) + for i = 0, 13 do + local a = i / 14 * math.pi * 2 + local r = rng:NextNumber(215, 235) + local rad = rng:NextNumber(50, 70) + local c = W3 + V(math.cos(a) * r, -15, math.sin(a) * r) + terrain:FillBall(c, rad, Enum.Material.Rock) + terrain:FillBall(c + V(0, rad * 0.35, 0), rad * 0.7, Enum.Material.Snow) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], 16, l[2])), 30, l[3] + 4, Enum.Material.Air) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -19, l[2])), 10, l[3], Enum.Material.Mud) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -1, l[2])), 4, l[3], Enum.Material.Glacier) + end + for _, h in ipairs(HOLES) do + terrain:FillCylinder(CFrame.new(W3 + V(h[1], -1, h[2])), 4, 6, Enum.Material.Water) + end + + local function snowPine(pos) + local h = rng:NextNumber(8, 13) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(90, 62, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + local s = 10 - i * 2.2 + local y = h * 0.4 + i * 2.8 + ball(pos + V(0, y, 0), s, { Color = Color3.fromRGB(35, 85 + i * 8, 60), Material = Enum.Material.Grass }) + ball(pos + V(0, y + s * 0.3, 0), s * 0.75, { Color = Color3.fromRGB(240, 245, 255), Material = Enum.Material.Snow }) + end + end + + local function igloo(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Shape = Enum.PartType.Ball, Size = V(14, 14, 14), CFrame = cf, Material = Enum.Material.Snow, Color = Color3.fromRGB(240, 245, 255) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 5, 5), CFrame = cf * CFrame.new(0, 1.2, -7) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Snow, Color = Color3.fromRGB(235, 240, 250) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 3.6, 3.6), CFrame = cf * CFrame.new(0, 1.2, -9.55) * CFrame.Angles(0, math.rad(90), 0), Color = Color3.fromRGB(20, 25, 35) }) + end + + local function tent(pos, look) + local cf = CFrame.lookAt(pos, look) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.2, 5, 6), CFrame = cf * CFrame.new(s * 1.6, 2.2, 0) * CFrame.Angles(0, 0, math.rad(s * 35)), Material = Enum.Material.Fabric, Color = Color3.fromRGB(230, 110, 40) }) + end + vcyl((cf * CFrame.new(0, 0.9, -4.5)).Position, 1.6, 1.4, { Color = Color3.fromRGB(110, 80, 50), Material = Enum.Material.Wood }) + end + + local function crystal(pos) + for _ = 1, 5 do + local h = rng:NextNumber(3, 8) + P({ + Size = V(1.2, h, 1.2), + CFrame = CFrame.new(pos + V(rng:NextNumber(-2, 2), h / 2 - 0.5, rng:NextNumber(-2, 2))) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 3), rng:NextNumber(-0.4, 0.4)), + Material = Enum.Material.Neon, Color = Color3.fromRGB(140, 230, 255), Transparency = 0.15, + }) + end + end + + local function snowman(pos) + ball(pos + V(0, 2, 0), 4, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 5, 0), 3, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 7.3, 0), 2.2, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + cylA(pos + V(0, 7.3, -1), pos + V(0, 7.2, -2), 0.3, { Color = Color3.fromRGB(255, 130, 30) }) + for _, x in ipairs({ -0.4, 0.4 }) do + ball(pos + V(x, 7.7, -0.95), 0.3, { Color = Color3.fromRGB(20, 20, 20) }) + end + vcyl(pos + V(0, 8.6, 0), 1.2, 1.4, { Color = Color3.fromRGB(30, 30, 35) }) + vcyl(pos + V(0, 8.1, 0), 0.2, 2.2, { Color = Color3.fromRGB(30, 30, 35) }) + end + + -- лунки: льдинки по краю и флажки + for i, h in ipairs(HOLES) do + local c = W3 + V(h[1], 1.2, h[2]) + for k = 0, 7 do + local a = k / 8 * math.pi * 2 + P({ Size = V(1.2, 0.6, 1.2), CFrame = CFrame.new(c + V(math.cos(a) * 6.6, 0, math.sin(a) * 6.6)) * CFrame.Angles(0, a, 0.2), Material = Enum.Material.Ice, Color = Color3.fromRGB(200, 235, 255) }) + end + if i % 3 == 1 then + cylA(c + V(6, -0.2, 6), c + V(6, 4, 6), 0.15, { Color = Color3.fromRGB(80, 60, 40) }) + P({ Size = V(1.4, 0.9, 0.1), Position = c + V(6.75, 3.5, 6), Material = Enum.Material.Fabric, Color = Color3.fromRGB(220, 40, 40) }) + end + if i % 4 == 0 then + tent(c + V(-9, -0.2, 0), c) + end + end + + local spawn3 = W3 + V(0, 4, 120) + marker("World3Spawn", CFrame.lookAt(spawn3 + V(0, 1, 0), spawn3 + V(0, 1, -10))) + arch(CFrame.new(W3 + V(0, 4, 104)), 14, 11, "❄ ЛЕДЯНОЙ ФЬОРД", Color3.fromRGB(150, 220, 255)) + portal(CFrame.lookAt(W3 + V(-32, 4, 140), spawn3), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W3 + V(32, 4, 138), spawn3), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(180, 230, 255), + wall = Color3.fromRGB(120, 95, 75), + stripeA = Color3.fromRGB(60, 120, 200), + stripeB = Color3.fromRGB(245, 250, 255), + glow = Color3.fromRGB(140, 210, 255), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Нина", + npcColors = { skin = Color3.fromRGB(240, 205, 175), shirt = Color3.fromRGB(180, 40, 50), pants = Color3.fromRGB(40, 40, 60), hat = Color3.fromRGB(240, 240, 250) }, + }) + bestiary(W3 + V(-20, 4, 100), spawn3, "World3", "❄ КТО ВОДИТСЯ ПОДО ЛЬДОМ", "#BFEAFF") + npc("Полярник Саша", CFrame.lookAt(W3 + V(12, 7, 88), W3 + V(0, 7, 60)), { + skin = Color3.fromRGB(230, 190, 160), shirt = Color3.fromRGB(230, 120, 30), pants = Color3.fromRGB(50, 55, 70), hat = Color3.fromRGB(200, 40, 40), + }, "Talk", "Поговорить") + igloo(W3 + V(-45, 4, 95), W3 + V(0, 4, 110)) + campfire(W3 + V(20, 4, 108)) + snowman(W3 + V(42, 4, 100)) + for _, p in ipairs({ { -85, -45 }, { 90, 30 }, { -25, -110 }, { 70, -90 }, { -95, 60 } }) do + crystal(W3 + V(p[1], groundY(W3.X + p[1], W3.Z + p[2]), p[2])) + end + + local function free3(x, z) + for _, l in ipairs(LAKES3) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + 12 then + return false + end + end + if (V(x, 0, z) - V(0, 0, 120)).Magnitude < 40 then + return false + end + if (V(x, 0, z) - V(-45, 0, 95)).Magnitude < 14 then + return false + end + return true + end + local count = 0 + for _ = 1, 400 do + if count >= 80 then + break + end + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if free3(x, z) then + snowPine(W3 + V(x, groundY(W3.X + x, W3.Z + z) - 0.5, z)) + count += 1 + end + end + + -- северное сияние + for i = 0, 7 do + P({ + Size = V(55, 26, 0.6), + CFrame = CFrame.new(W3 + V(-175 + i * 50, 150 + math.sin(i * 1.3) * 10, -150 + math.cos(i * 0.9) * 25)) * CFrame.Angles(math.rad(10), math.rad(i * 8 - 28), 0), + Material = Enum.Material.Neon, + Color = (i % 3 == 0) and Color3.fromRGB(170, 90, 255) or Color3.fromRGB(80, 255, 170), + Transparency = 0.6, CanCollide = false, CanQuery = false, CastShadow = false, + }) + end + worldWalls(W3) +end + +---------------------------------------------------------------- проверка воды +-- Если вода в террейне не создалась (бывает в некоторых плейсах/настройках), +-- ставим поверхность воды из деталей, чтобы озёра и море точно были видны. + +local function terrainHasWater(pos) + local region = Region3.new(pos - V(2, 2, 2), pos + V(2, 2, 2)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + if not ok then + return true + end + for _, plane in ipairs(mats) do + for _, column in ipairs(plane) do + for _, m in ipairs(column) do + if m == Enum.Material.Water then + return true + end + end + end + end + return false +end + +local function waterPlane(pos, diameter, color) + return P({ + Name = "WaterSurface", + Shape = Enum.PartType.Cylinder, + Size = V(0.4, diameter, diameter), + CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)), + Color = color, + Material = Enum.Material.SmoothPlastic, + Reflectance = 0.08, + CanCollide = false, + CanQuery = false, + CanTouch = false, + CastShadow = false, + }) +end + +do + local w1, w2, w3 = Config.Worlds[1], Config.Worlds[2], Config.Worlds[3] + if not terrainHasWater(w1.center + V(0, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 1 не создалась — ставлю запасную поверхность воды") + waterPlane(w1.center + V(0, w1.waterY, 0), 490, Color3.fromRGB(30, 120, 150)) + end + if not terrainHasWater(w2.center + V(180, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 2 не создалась — ставлю запасную поверхность воды") + waterPlane(w2.center + V(0, w2.waterY, 0), 500, Color3.fromRGB(40, 180, 190)) + end + local h = w3.holes[1] + if not terrainHasWater(w3.center + V(h[1], -1, h[2])) then + warn("[MapBuilder] Вода в лунках Мира 3 не создалась — ставлю запасную поверхность воды") + for _, hole in ipairs(w3.holes) do + waterPlane(w3.center + V(hole[1], w3.waterY + 0.05, hole[2]), w3.holeRadius * 2, Color3.fromRGB(25, 75, 110)) + end + end +end +]=====]) +make('Script', 'GameServer', game.ServerScriptService, [=====[-- GameServer (Script) -> ServerScriptService +-- Логика игры: данные, удача, рыбалка с анимацией, сумка, магазин, улучшения, +-- коллекция с наградами, задания, ежедневная награда, события, миры, донат. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local DataStoreService = game:GetService("DataStoreService") +local ProximityPromptService = game:GetService("ProximityPromptService") +local TweenService = game:GetService("TweenService") +local RunService = game:GetService("RunService") +local MarketplaceService = game:GetService("MarketplaceService") +local Debris = game:GetService("Debris") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) + +local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent") +remote.Name = "GameEvent" +remote.Parent = ReplicatedStorage + +local rng = Random.new() +local GOLD = Color3.fromRGB(255, 220, 80) +local RED = Color3.fromRGB(255, 120, 120) +local GREEN = Color3.fromRGB(120, 255, 140) +local SPLASH_SOUND = "rbxasset://sounds/impact_water.mp3" + +---------------------------------------------------------------- данные + +local store = nil +pcall(function() + store = DataStoreService:GetDataStore("FishingGame_v2") +end) + +local profiles = {} +local loadedOk = {} +local passes = {} + +local function defaultData() + return { + coins = 0, level = 1, xp = 0, + rod = "Basic", rods = { Basic = true }, rodLevels = {}, + bag = "Pouch", bags = { Pouch = true }, + items = {}, discovered = {}, claimed = {}, + quests = {}, daily = { last = 0, streak = 0 }, + boostUntil = 0, boostBonus = 0, + totalCaught = 0, nextUid = 1, receipts = {}, + } +end + +local function loadData(player) + local data = defaultData() + if not store then + return data, false + end + local ok, saved = pcall(function() + return store:GetAsync("player_" .. player.UserId) + end) + if not ok then + warn("Не удалось загрузить данные " .. player.Name .. ": " .. tostring(saved)) + return data, false + end + if type(saved) == "table" then + for k, v in pairs(saved) do + data[k] = v + end + end + return data, true +end + +local function saveData(player) + local data = profiles[player] + if not store or not data or not loadedOk[player] then + return + end + local ok, err = pcall(function() + store:SetAsync("player_" .. player.UserId, data) + end) + if not ok then + warn("Не удалось сохранить данные " .. player.Name .. ": " .. tostring(err)) + end +end + +---------------------------------------------------------------- пропуска и события + +local function hasPass(player, key) + return passes[player] ~= nil and passes[player][key] == true +end + +local function loadPasses(player) + passes[player] = {} + for _, gp in ipairs(Config.GamePasses) do + if gp.id and gp.id > 0 then + local ok, owns = pcall(function() + return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gp.id) + end) + if ok and owns then + passes[player][gp.key] = true + end + end + end +end + +local currentEvent = nil +local function ev(field, default) + return (currentEvent and currentEvent[field]) or default +end + +---------------------------------------------------------------- расчёты + +local function rodLevel(data, rodId) + return data.rodLevels[rodId or data.rod] or 0 +end + +local function boostActive(data) + return data.boostUntil > os.time() and data.boostBonus or 0 +end + +local function masteryCount(data) + local n = 0 + for key in pairs(data.claimed) do + if string.find(key, ":Master", 1, true) then + n += 1 + end + end + return n +end + +local function totalLuck(player, data) + local stats = Config.RodStats(data.rod, rodLevel(data)) + local l = 1 + stats.luck + (data.level - 1) * Config.LuckPerPlayerLevel + boostActive(data) + masteryCount(data) * Config.MasteryLuck + if hasPass(player, "VIP") then + l += 0.25 + end + if hasPass(player, "LuckyCharm") then + l += 0.5 + end + return l + ev("luck", 0) +end + +local function bagCapacity(player, data) + local bag = Config.Find(Config.Bags, data.bag) or Config.Bags[1] + return bag.capacity + (hasPass(player, "BigBag") and 100 or 0) +end + +local function sellMult(player) + local m = ev("sell", 1) + if hasPass(player, "VIP") then + m *= 1.25 + end + if hasPass(player, "DoubleCoins") then + m *= 2 + end + return m +end + +local function notify(player, text, color) + remote:FireClient(player, "Notify", text, color or Color3.new(1, 1, 1)) +end + +local function today() + return math.floor(os.time() / 86400) +end + +local function sendInventory(player) + local data = profiles[player] + if data then + remote:FireClient(player, "Inventory", data.items, data.discovered, data.claimed) + end +end + +local function sendQuests(player) + local data = profiles[player] + if not data then + return + end + local t = today() + remote:FireClient(player, "Quests", data.quests, { + available = data.daily.last < t, + streak = data.daily.streak, + nextStreak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or ((data.daily.last < t) and 1 or data.daily.streak), + }) +end + +local function updateStats(player) + local data = profiles[player] + if not data then + return + end + local bagValue = 0 + for _, item in ipairs(data.items) do + bagValue += item.value + end + local owned, lv, bags, ps = {}, {}, {}, {} + for id in pairs(data.rods) do + table.insert(owned, id) + table.insert(lv, id .. ":" .. rodLevel(data, id)) + end + for id in pairs(data.bags) do + table.insert(bags, id) + end + for key in pairs(passes[player] or {}) do + table.insert(ps, key) + end + + player:SetAttribute("Coins", data.coins) + player:SetAttribute("Level", data.level) + player:SetAttribute("XP", data.xp) + player:SetAttribute("XPNeed", Config.XPForLevel(data.level)) + player:SetAttribute("Rod", data.rod) + player:SetAttribute("RodLevel", rodLevel(data)) + player:SetAttribute("RodLevels", table.concat(lv, ",")) + player:SetAttribute("OwnedRods", table.concat(owned, ",")) + player:SetAttribute("Bag", data.bag) + player:SetAttribute("OwnedBags", table.concat(bags, ",")) + player:SetAttribute("BagCount", #data.items) + player:SetAttribute("BagCap", bagCapacity(player, data)) + player:SetAttribute("BagValue", math.floor(bagValue * sellMult(player))) + player:SetAttribute("Luck", math.floor(totalLuck(player, data) * 100 + 0.5)) + player:SetAttribute("BoostBonus", boostActive(data)) + player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time())) + player:SetAttribute("TotalCaught", data.totalCaught) + player:SetAttribute("Mastery", masteryCount(data)) + player:SetAttribute("Passes", table.concat(ps, ",")) + + local ls = player:FindFirstChild("leaderstats") + if ls then + ls["Монеты"].Value = data.coins + ls["Уровень"].Value = data.level + ls["Улов"].Value = data.totalCaught + end +end + +local function addXp(player, data, amount) + data.xp += amount + local leveled = false + while data.xp >= Config.XPForLevel(data.level) do + data.xp -= Config.XPForLevel(data.level) + data.level += 1 + leveled = true + end + if leveled then + notify(player, "⭐ Новый уровень: " .. data.level .. "! Удача +" .. math.floor(Config.LuckPerPlayerLevel * 100) .. "%", GOLD) + for _, w in ipairs(Config.Worlds) do + if w.level == data.level and not w.soon then + notify(player, "🌍 Открыт новый мир: " .. w.icon .. " " .. w.name .. "!", w.color) + end + end + end +end + +local function applyPotion(data, bonus, duration) + data.boostBonus = math.max(boostActive(data), bonus) + data.boostUntil = math.max(os.time(), data.boostUntil) + duration +end + +---------------------------------------------------------------- задания + +local function makeQuest(data, exclude) + local pool = {} + for _, q in ipairs(Config.Quests) do + if not exclude[q.kind] then + table.insert(pool, q) + end + end + if #pool == 0 then + pool = Config.Quests + end + local t = pool[rng:NextInteger(1, #pool)] + local goal = t.goals[rng:NextInteger(1, #t.goals)] + local mult = 1 + (data.level - 1) * 0.25 + return { + kind = t.kind, goal = goal, progress = 0, + coins = math.max(10, math.floor(t.coins * goal * mult)), + xp = math.max(10, math.floor(t.xp * goal * mult)), + } +end + +local function ensureQuests(data) + local kinds = {} + for _, q in ipairs(data.quests) do + kinds[q.kind] = true + end + while #data.quests < Config.QuestSlots do + local q = makeQuest(data, kinds) + kinds[q.kind] = true + table.insert(data.quests, q) + end +end + +local function questProgress(player, kind, amount) + local data = profiles[player] + if not data then + return + end + local changed = false + for _, q in ipairs(data.quests) do + if q.kind == kind and q.progress < q.goal then + q.progress = math.min(q.goal, q.progress + amount) + changed = true + if q.progress >= q.goal then + notify(player, "📜 Задание выполнено! Забери награду (клавиша Q)", GOLD) + end + end + end + if changed then + sendQuests(player) + end +end + +local function claimQuest(player, index) + local data = profiles[player] + local q = data and type(index) == "number" and data.quests[index] + if not q or q.progress < q.goal then + return + end + data.coins += q.coins + addXp(player, data, q.xp) + local kinds = {} + for i, other in ipairs(data.quests) do + if i ~= index then + kinds[other.kind] = true + end + end + kinds[q.kind] = true + data.quests[index] = makeQuest(data, kinds) + updateStats(player) + sendQuests(player) + notify(player, ("📜 Награда: +%d 💰 +%d XP"):format(q.coins, q.xp), GREEN) +end + +local function claimDaily(player) + local data = profiles[player] + if not data then + return + end + local t = today() + if data.daily.last >= t then + notify(player, "🎁 Сегодня награда уже получена. Приходи завтра!", Color3.fromRGB(255, 200, 120)) + return + end + local streak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or 1 + local r = Config.DailyRewards[streak] + local coins = math.floor(r.coins * (1 + (data.level - 1) * 0.2)) + data.coins += coins + local extra = "" + if r.potion then + local p = Config.Find(Config.Potions, r.potion) + if p then + applyPotion(data, p.bonus, p.duration) + extra = " + " .. p.name + end + end + data.daily = { last = t, streak = streak } + updateStats(player) + sendQuests(player) + notify(player, ("🎁 День %d: +%d 💰%s"):format(streak, coins, extra), GOLD) +end + +---------------------------------------------------------------- коллекция + +local function claimCollection(player, worldId, rarity) + local data = profiles[player] + local world = data and Config.Find(Config.Worlds, worldId) + local zone = world and Config.Zones[worldId] + if not zone or type(rarity) ~= "string" then + return + end + local key = worldId .. ":" .. rarity + if data.claimed[key] then + return + end + for _, f in ipairs(zone.fish) do + if (rarity == "Master" or f.rarity == rarity) and not data.discovered[f.id] then + notify(player, "Сначала поймай всех рыб этой группы!", RED) + return + end + end + data.claimed[key] = true + if rarity == "Master" then + local coins = Config.MasteryCoins * world.mult + data.coins += coins + notify(player, ("🏆 Мир «%s» собран! +%d 💰 и +%d%% удачи навсегда"):format(world.name, coins, math.floor(Config.MasteryLuck * 100 + 0.5)), GOLD) + else + local r = Config.CollectionRewards[rarity] + if not r then + return + end + data.coins += r.coins * world.mult + addXp(player, data, r.xp * world.mult) + notify(player, ("📖 Коллекция «%s»: +%d 💰 +%d XP"):format(Config.Rarities[rarity].name, r.coins * world.mult, r.xp * world.mult), GREEN) + end + updateStats(player) + sendInventory(player) +end + +---------------------------------------------------------------- удочка, сумка, VIP на персонаже + +local REST_ANGLE = 30 +local function gripCF(angle) + return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse() +end +local function tweenGrip(tool, angle, t) + if not tool or not tool.Parent then + return nil + end + local tw = TweenService:Create(tool, TweenInfo.new(t, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Grip = gripCF(angle) }) + tw:Play() + return tw +end +local function gripSequence(tool, steps) + task.spawn(function() + for _, s in ipairs(steps) do + local tw = tweenGrip(tool, s[1], s[2]) + if not tw then + return + end + tw.Completed:Wait() + end + end) +end + +local function findRodTool(player) + for _, container in ipairs({ player.Character, player:FindFirstChild("Backpack") }) do + if container then + for _, child in ipairs(container:GetChildren()) do + if child:IsA("Tool") and child:GetAttribute("IsRod") then + return child + end + end + end + end + return nil +end + +local function giveRodTool(player) + local data = profiles[player] + local backpack = player:FindFirstChild("Backpack") + if not data or not backpack then + return + end + local old = findRodTool(player) + local wasEquipped = old ~= nil and old.Parent == player.Character + if old then + old:Destroy() + end + local rod = Config.Find(Config.Rods, data.rod) or Config.Rods[1] + local lvl = rodLevel(data) + local model = Models.buildRod(rod.id, lvl, false) + local tool = Instance.new("Tool") + tool.Name = rod.name .. (lvl > 0 and (" +" .. lvl) or "") + tool.ToolTip = "Кликни у воды, чтобы закинуть" + tool.CanBeDropped = false + tool.Grip = gripCF(REST_ANGLE) + tool:SetAttribute("IsRod", true) + for _, child in ipairs(model:GetChildren()) do + child.Parent = tool + end + model:Destroy() + tool.Parent = backpack + if wasEquipped then + local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid") + if hum then + hum:EquipTool(tool) + end + end +end + +local function attachBag(player) + local data = profiles[player] + local char = player.Character + if not data or not char then + return + end + local old = char:FindFirstChild("BackBag") + if old then + old:Destroy() + end + local torso = char:FindFirstChild("UpperTorso") or char:FindFirstChild("Torso") + if not torso then + return + end + local bag = Models.buildBag(data.bag, false) + local offset = CFrame.new(0, 0.1, torso.Size.Z / 2) + bag:PivotTo(torso.CFrame * offset) + local w = Instance.new("Weld") + w.Part0 = torso + w.Part1 = bag.PrimaryPart + w.C0 = offset + w.Parent = bag.PrimaryPart + bag.Parent = char +end + +local function vipTag(player) + local head = player.Character and player.Character:FindFirstChild("Head") + if not head or not hasPass(player, "VIP") or head:FindFirstChild("VipTag") then + return + end + local bb = Instance.new("BillboardGui") + bb.Name = "VipTag" + bb.Size = UDim2.fromOffset(120, 30) + bb.StudsOffset = Vector3.new(0, 2.6, 0) + bb.MaxDistance = 80 + bb.Parent = head + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = Color3.fromRGB(255, 210, 60) + t.TextStrokeTransparency = 0.2 + t.Text = "👑 VIP" + t.Parent = bb +end + +---------------------------------------------------------------- эффекты + +local function playSound(parent, id, volume) + local snd = Instance.new("Sound") + snd.SoundId = id + snd.Volume = volume or 0.6 + snd.Parent = parent + snd:Play() + Debris:AddItem(snd, 3) +end + +local function splash(part, count) + local att = Instance.new("Attachment") + att.Parent = part + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(Color3.fromRGB(220, 240, 255)) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Size = NumberSequence.new(0.4, 0.1) + pe.Lifetime = NumberRange.new(0.4, 0.7) + pe.Speed = NumberRange.new(6, 10) + pe.SpreadAngle = Vector2.new(40, 40) + pe.Acceleration = Vector3.new(0, -35, 0) + pe.Enabled = false + pe.Parent = att + pe:Emit(count or 20) + Debris:AddItem(att, 2) +end + +-- рыба вылетает из воды, летит к игроку и показывается над головой +local function showFishFlight(player, fish, fromPos) + local head = player.Character and player.Character:FindFirstChild("Head") + if not head then + return + end + local model = Models.buildFish(fish.id, fish.mutation, 0.9, true) + model:PivotTo(CFrame.new(fromPos)) + model.Parent = workspace + task.spawn(function() + local t0, dur = os.clock(), 0.55 + while head.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + local target = head.Position + Vector3.new(0, 2.8, 0) + local p = fromPos:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 8, 0) + model:PivotTo(CFrame.new(p) * CFrame.Angles(0, 0, a * math.pi * 2)) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + local t1 = os.clock() + while head.Parent and os.clock() - t1 < 1.8 do + model:PivotTo(CFrame.new(head.Position + Vector3.new(0, 2.8, 0)) * CFrame.Angles(0, os.clock() * 3, math.rad(-15))) + RunService.Heartbeat:Wait() + end + model:Destroy() + end) +end + +---------------------------------------------------------------- рыбалка + +local fishing = {} + +-- ищем воду перед игроком по карте мира из FishConfig (не зависит от террейна) +local function findWater(hrp, world) + local look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + if look.Magnitude < 0.01 then + look = Vector3.new(0, 0, -1) + end + look = look.Unit + for _, d in ipairs({ 14, 11, 17, 8, 20, 6, 24, 4 }) do + local p = hrp.Position + look * d + if Config.IsWater(world, p) then + return Vector3.new(p.X, world.waterY or 0, p.Z) + end + end + return nil +end + +local function stopFishing(player, tellClient) + local s = fishing[player] + if not s then + return + end + fishing[player] = nil + if s.tween then + s.tween:Cancel() + end + if s.bobber then + s.bobber:Destroy() + end + if s.tool then + tweenGrip(s.tool, REST_ANGLE, 0.3) + end + if tellClient then + remote:FireClient(player, "Cancel") + end +end + +local function rollFish(player, data, worldId) + local zone = Config.Zones[worldId] + if not zone then + return nil + end + local luck = totalLuck(player, data) + local bonus = luck - 1 + local weights, total = {}, 0 + for i, f in ipairs(zone.fish) do + local r = Config.Rarities[f.rarity] + local w = r.weight * math.max(0.2, 1 + bonus * (r.rank - 1)) + if r.rank == 1 then + w = r.weight / math.max(1, luck) + end + weights[i] = w + total += w + end + local roll = rng:NextNumber() * total + local chosen = zone.fish[1] + for i, f in ipairs(zone.fish) do + roll -= weights[i] + if roll <= 0 then + chosen = f + break + end + end + local mutation = nil + for _, m in ipairs(Config.Mutations) do + if rng:NextNumber() < m.chance * luck * ev("mutation", 1) then + mutation = m + break + end + end + local wf = rng:NextNumber() ^ 2.2 + local weight = chosen.minW + (chosen.maxW - chosen.minW) * wf + return { + id = chosen.id, + name = chosen.name, + rarity = chosen.rarity, + weight = math.floor(weight * 100) / 100, + value = math.floor(chosen.price * (0.75 + 0.9 * wf) * (mutation and mutation.mult or 1) + 0.5), + xp = chosen.xp * (mutation and 2 or 1), + mutation = mutation and mutation.id or nil, + world = worldId, + } +end + +local function flyBobber(s, tool, target) + local tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") + local start = tip and tip.WorldPosition or (target + Vector3.new(0, 6, 0)) + local bobber = Models.buildBobber() + bobber:PivotTo(CFrame.new(start)) + bobber.Parent = workspace + s.bobber = bobber + if tip then + local a1 = Instance.new("Attachment") + a1.Position = Vector3.new(0, 0.9, 0) + a1.Parent = bobber.PrimaryPart + local line = Instance.new("Beam") + line.Attachment0 = tip + line.Attachment1 = a1 + line.Width0 = 0.035 + line.Width1 = 0.035 + line.FaceCamera = true + line.Color = ColorSequence.new(Color3.fromRGB(245, 245, 245)) + line.Parent = bobber + end + local t0, dur = os.clock(), 0.55 + while bobber.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 6, 0))) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + if bobber.Parent then + splash(bobber.PrimaryPart, 18) + playSound(bobber.PrimaryPart, SPLASH_SOUND, 0.5) + end +end + +local function onCast(player) + local data = profiles[player] + if not data then + return + end + if fishing[player] then + stopFishing(player, true) + return + end + local char = player.Character + local hrp = char and char:FindFirstChild("HumanoidRootPart") + local tool = char and char:FindFirstChildOfClass("Tool") + if not hrp or not tool or not tool:GetAttribute("IsRod") then + remote:FireClient(player, "CastFail") + return + end + local world = Config.WorldAt(hrp.Position) + local target = world and findWater(hrp, world) + if not target then + remote:FireClient(player, "CastFail") + notify(player, world and "Повернись лицом к воде (или к лунке)!" or "Здесь нет рыбы — иди в один из миров 🌍", Color3.fromRGB(255, 200, 120)) + return + end + if #data.items >= bagCapacity(player, data) then + remote:FireClient(player, "CastFail") + notify(player, "🎒 Сумка полна! Продай рыбу в скупке.", RED) + return + end + + local stats = Config.RodStats(data.rod, rodLevel(data)) + local fish = rollFish(player, data, world.id) + if not fish then + remote:FireClient(player, "CastFail") + return + end + local s = { stage = "casting", fish = fish, tool = tool } + fishing[player] = s + remote:FireClient(player, "Cast") + + task.spawn(function() + -- замах назад и бросок вперёд + local tw = tweenGrip(tool, 100, 0.25) + if tw then + tw.Completed:Wait() + end + tw = tweenGrip(tool, 8, 0.15) + if tw then + tw.Completed:Wait() + end + if fishing[player] ~= s then + return + end + flyBobber(s, tool, target + Vector3.new(0, 0.15, 0)) + tweenGrip(tool, REST_ANGLE - 5, 0.4) + if fishing[player] ~= s then + if s.bobber then + s.bobber:Destroy() + end + return + end + s.stage = "waiting" + + local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) + task.wait(waitTime) + if fishing[player] ~= s then + return + end + s.stage = "bite" + s.biteAt = os.clock() + if s.bobber and s.bobber.PrimaryPart then + local root = s.bobber.PrimaryPart + splash(root, 25) + playSound(root, SPLASH_SOUND, 0.35) + s.tween = TweenService:Create(root, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, -1, true), { + CFrame = root.CFrame - Vector3.new(0, 0.55, 0), + }) + s.tween:Play() + end + -- удочка дёргается, пока идёт вываживание + task.spawn(function() + local up = true + while fishing[player] == s and s.stage == "bite" do + tweenGrip(tool, up and 38 or 18, 0.12) + up = not up + task.wait(0.13) + end + end) + local rank = Config.Rarities[fish.rarity].rank + remote:FireClient(player, "Bite", { + speed = 0.55 + 0.22 * (rank - 1), + zoneWidth = math.max(0.07, stats.zone - 0.02 * (rank - 1)), + hits = Config.HitsNeeded(rank), + misses = Config.MaxMisses, + timeout = Config.BiteTimeout, + }) + task.wait(Config.BiteTimeout + 0.5) + if fishing[player] == s and s.stage == "bite" then + stopFishing(player, false) + remote:FireClient(player, "Escaped") + notify(player, "Рыба ушла… не успел вытащить.", RED) + end + end) +end + +local function onCatch(player, success, misses) + local s = fishing[player] + local data = profiles[player] + if not s or not data or s.stage ~= "bite" then + return + end + local fromPos = s.bobber and s.bobber.PrimaryPart and s.bobber.PrimaryPart.Position + s.stage = "done" + local tool = s.tool + fishing[player] = nil + if s.tween then + s.tween:Cancel() + end + if s.bobber then + s.bobber:Destroy() + end + + if success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 then + gripSequence(tool, { { REST_ANGLE, 0.3 } }) + remote:FireClient(player, "Escaped") + notify(player, "Рыба сорвалась!", RED) + return + end + gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } }) + + local fish = s.fish + table.insert(data.items, { + uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity, + weight = fish.weight, value = fish.value, mutation = fish.mutation, + }) + data.nextUid += 1 + data.totalCaught += 1 + + local rec = data.discovered[fish.id] + local isNew, isRecord = rec == nil, false + if not rec then + rec = { count = 0, best = 0 } + data.discovered[fish.id] = rec + end + rec.count += 1 + if fish.weight > rec.best then + isRecord = not isNew + rec.best = fish.weight + end + + addXp(player, data, fish.xp * (isNew and 2 or 1)) + updateStats(player) + sendInventory(player) + if fromPos then + showFishFlight(player, fish, fromPos) + end + remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord }) + + local rank = Config.Rarities[fish.rarity].rank + questProgress(player, "catch", 1) + if rank >= 3 then + questProgress(player, "rare", 1) + end + if rank >= 4 then + questProgress(player, "epic", 1) + end + if fish.mutation then + questProgress(player, "mutation", 1) + end + if misses == 0 then + questProgress(player, "perfect", 1) + end +end + +---------------------------------------------------------------- скупка + +local sellPoints = nil +local function nearSeller(player) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return false + end + if not sellPoints then + sellPoints = {} + local map = workspace:FindFirstChild("FishingMap") + if map then + for _, d in ipairs(map:GetDescendants()) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + table.insert(sellPoints, d.Parent) + end + end + end + end + for _, p in ipairs(sellPoints) do + if (p.Position - hrp.Position).Magnitude < 28 then + return true + end + end + return false +end + +local function sellItems(player, filterUid) + local data = profiles[player] + if not data then + return + end + local mult = sellMult(player) + local total, count, keep = 0, 0, {} + for _, item in ipairs(data.items) do + if filterUid == nil or item.uid == filterUid then + total += math.floor(item.value * mult) + count += 1 + else + table.insert(keep, item) + end + end + if count == 0 then + if filterUid == nil then + notify(player, "Нечего продавать — сначала поймай рыбу!", Color3.fromRGB(255, 200, 120)) + end + return + end + data.items = keep + data.coins += total + updateStats(player) + sendInventory(player) + remote:FireClient(player, "Sold", total, count) + questProgress(player, "earn", total) +end + +---------------------------------------------------------------- магазин + +local function buy(player, kind, id) + local data = profiles[player] + if not data or type(id) ~= "string" then + return + end + if kind == "Upgrade" then + local rod = Config.Find(Config.Rods, id) + if not rod or not data.rods[id] then + return + end + local lvl = rodLevel(data, id) + if lvl >= Config.RodUpgrade.maxLevel then + notify(player, "Удочка уже улучшена до максимума ★★★★★", GOLD) + return + end + local cost = Config.UpgradeCost(rod, lvl) + if data.coins < cost then + notify(player, "Не хватает монет: нужно " .. cost .. " 💰", RED) + return + end + data.coins -= cost + data.rodLevels[id] = lvl + 1 + if data.rod == id then + stopFishing(player, true) + giveRodTool(player) + end + updateStats(player) + notify(player, ("✨ %s улучшена до +%d!"):format(rod.name, lvl + 1), GOLD) + return + end + if kind == "Potion" then + local potion = Config.Find(Config.Potions, id) + if not potion then + return + end + if potion.level and data.level < potion.level then + notify(player, "Нужен уровень " .. potion.level .. "!", RED) + return + end + if data.coins < potion.price then + notify(player, "Не хватает монет: нужно " .. potion.price .. " 💰", RED) + return + end + data.coins -= potion.price + applyPotion(data, potion.bonus, potion.duration) + updateStats(player) + notify(player, ("🍀 %s: удача +%d%% на %d мин"):format(potion.name, potion.bonus * 100, potion.duration / 60), GREEN) + return + end + local list, owned + if kind == "Rod" then + list, owned = Config.Rods, data.rods + elseif kind == "Bag" then + list, owned = Config.Bags, data.bags + else + return + end + local item = Config.Find(list, id) + if not item then + return + end + if not owned[id] then + if data.level < item.level then + notify(player, "Нужен уровень " .. item.level .. "!", RED) + return + end + if data.coins < item.price then + notify(player, "Не хватает монет: нужно " .. item.price .. " 💰", RED) + return + end + data.coins -= item.price + owned[id] = true + notify(player, "Куплено: " .. item.name .. "!", GREEN) + end + if kind == "Rod" then + data.rod = id + stopFishing(player, true) + giveRodTool(player) + else + data.bag = id + attachBag(player) + end + updateStats(player) +end + +---------------------------------------------------------------- телепорт + +local function teleportTo(player, worldId) + local data = profiles[player] + local char = player.Character + if not data or not char or type(worldId) ~= "string" then + return + end + local markerName + if worldId == "Lobby" then + markerName = "LobbySpawn" + else + local world = Config.Find(Config.Worlds, worldId) + if not world then + return + end + if world.soon then + notify(player, world.icon .. " " .. world.name .. " скоро откроется! Следи за обновлениями.", world.color) + return + end + if data.level < world.level then + notify(player, ("🔒 %s откроется на %d уровне"):format(world.name, world.level), RED) + return + end + markerName = world.id .. "Spawn" + end + local map = workspace:FindFirstChild("FishingMap") + local m = map and map:FindFirstChild(markerName) + if m then + stopFishing(player, true) + char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + end +end + +---------------------------------------------------------------- подсказки NPC + +local TIPS = { + World1 = { + "Рыба клюёт быстрее с хорошей удочкой. Улучшай её в магазине!", + "Говорят, в этом озере живёт хрустальный осётр… Мифическая рыба!", + "Собери всех рыб одной редкости — получишь награду в коллекции (клавиша C).", + "Чем реже рыба, тем быстрее бегает метка. Нужна точность!", + }, + World2 = { + "Скаты любят мелководье, а акулы — глубину за причалом.", + "Солнечная медуза светится по ночам… Если поймаешь — ты легенда!", + "Блестящая рыба стоит вдвое дороже, золотая — в пять раз, радужная — в десять!", + }, + World3 = { + "Ищи лунки во льду — только там можно рыбачить.", + "Ледяной левиафан… Я видел его тень подо льдом. Один раз.", + "Удильщик светится в темноте. Смотри внимательно!", + }, +} + +local function talk(player) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local world = hrp and Config.WorldAt(hrp.Position) + local list = TIPS[world and world.id or "World1"] or TIPS.World1 + notify(player, "💬 «" .. list[rng:NextInteger(1, #list)] .. "»", Color3.fromRGB(255, 235, 190)) +end + +ProximityPromptService.PromptTriggered:Connect(function(prompt, player) + local action = prompt:GetAttribute("Action") + if action == "Shop" then + remote:FireClient(player, "OpenShop") + elseif action == "Sell" then + sellItems(player, nil) + elseif action == "Portal" then + teleportTo(player, prompt:GetAttribute("World")) + elseif action == "Talk" then + talk(player) + elseif action == "Daily" then + claimDaily(player) + remote:FireClient(player, "OpenQuests") + elseif action == "RobuxPasses" then + remote:FireClient(player, "OpenRobux", "passes") + elseif action == "RobuxProducts" then + remote:FireClient(player, "OpenRobux", "products") + end +end) + +---------------------------------------------------------------- события от клиента + +remote.OnServerEvent:Connect(function(player, action, a, b) + if action == "Cast" then + onCast(player) + elseif action == "Catch" then + onCatch(player, a, b) + elseif action == "Cancel" then + stopFishing(player, false) + elseif action == "Buy" then + buy(player, a, b) + elseif action == "SellOne" then + if type(a) ~= "number" then + return + end + if nearSeller(player) then + sellItems(player, a) + else + notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + end + elseif action == "SellAll" then + if nearSeller(player) then + sellItems(player, nil) + else + notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + end + elseif action == "Teleport" then + teleportTo(player, a) + elseif action == "ClaimCollection" then + claimCollection(player, a, b) + elseif action == "ClaimQuest" then + claimQuest(player, a) + elseif action == "ClaimDaily" then + claimDaily(player) + elseif action == "RequestInventory" then + sendInventory(player) + sendQuests(player) + end +end) + +---------------------------------------------------------------- донат + +MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased) + if not purchased then + return + end + for _, gp in ipairs(Config.GamePasses) do + if gp.id == passId then + passes[player] = passes[player] or {} + passes[player][gp.key] = true + notify(player, "Спасибо за покупку! " .. gp.icon .. " " .. gp.name .. " активирован", GOLD) + if gp.key == "VIP" then + vipTag(player) + end + updateStats(player) + end + end +end) + +MarketplaceService.ProcessReceipt = function(info) + local player = Players:GetPlayerByUserId(info.PlayerId) + local data = player and profiles[player] + if not data then + return Enum.ProductPurchaseDecision.NotProcessedYet + end + for _, id in ipairs(data.receipts) do + if id == info.PurchaseId then + return Enum.ProductPurchaseDecision.PurchaseGranted + end + end + local product + for _, p in ipairs(Config.Products) do + if p.id == info.ProductId then + product = p + end + end + if not product then + return Enum.ProductPurchaseDecision.NotProcessedYet + end + if product.coins then + local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15)) + data.coins += coins + notify(player, ("Спасибо! +%d 💰"):format(coins), GOLD) + end + if product.boost then + applyPotion(data, product.boost, product.duration) + notify(player, ("Спасибо! Удача +%d%% на %d мин"):format(product.boost * 100, product.duration / 60), GOLD) + end + table.insert(data.receipts, info.PurchaseId) + if #data.receipts > 50 then + table.remove(data.receipts, 1) + end + updateStats(player) + saveData(player) + return Enum.ProductPurchaseDecision.PurchaseGranted +end + +---------------------------------------------------------------- события на сервере + +task.spawn(function() + task.wait(Config.EventFirstDelay) + while true do + currentEvent = Config.Events[rng:NextInteger(1, #Config.Events)] + workspace:SetAttribute("Event", currentEvent.id) + workspace:SetAttribute("EventEnds", workspace:GetServerTimeNow() + currentEvent.duration) + for _, p in ipairs(Players:GetPlayers()) do + notify(p, "🎉 Событие: " .. currentEvent.name .. " — " .. currentEvent.desc, GOLD) + updateStats(p) + end + task.wait(currentEvent.duration) + currentEvent = nil + workspace:SetAttribute("Event", nil) + for _, p in ipairs(Players:GetPlayers()) do + updateStats(p) + end + task.wait(rng:NextInteger(Config.EventGapMin, Config.EventGapMax)) + end +end) + +---------------------------------------------------------------- игроки + +local function onPlayerAdded(player) + local ls = Instance.new("Folder") + ls.Name = "leaderstats" + ls.Parent = player + for _, name in ipairs({ "Монеты", "Уровень", "Улов" }) do + local v = Instance.new("IntValue") + v.Name = name + v.Parent = ls + end + + local data, ok = loadData(player) + if not player.Parent then + return + end + loadPasses(player) + ensureQuests(data) + profiles[player] = data + loadedOk[player] = ok + updateStats(player) + sendInventory(player) + sendQuests(player) + + local function onCharacter() + stopFishing(player, false) + task.wait(0.3) + giveRodTool(player) + attachBag(player) + vipTag(player) + end + player.CharacterAdded:Connect(onCharacter) + if player.Character then + task.spawn(onCharacter) + end +end + +Players.PlayerAdded:Connect(onPlayerAdded) +for _, p in ipairs(Players:GetPlayers()) do + task.spawn(onPlayerAdded, p) +end + +Players.PlayerRemoving:Connect(function(player) + stopFishing(player, false) + saveData(player) + profiles[player] = nil + loadedOk[player] = nil + passes[player] = nil +end) + +game:BindToClose(function() + for _, p in ipairs(Players:GetPlayers()) do + saveData(p) + end +end) + +-- таймер зелий + автосохранение +task.spawn(function() + local t = 0 + while true do + task.wait(1) + t += 1 + for _, p in ipairs(Players:GetPlayers()) do + local data = profiles[p] + if data and data.boostUntil > os.time() - 2 then + updateStats(p) + end + end + if t % 60 == 0 then + for _, p in ipairs(Players:GetPlayers()) do + saveData(p) + end + end + end +end) +]=====]) +make('LocalScript', 'FishingClient', game.StarterPlayer.StarterPlayerScripts, [=====[-- FishingClient (LocalScript) -> StarterPlayer > StarterPlayerScripts +-- Интерфейс: HUD, сумка, коллекция с наградами, миры, задания, ежедневная награда, +-- магазин, улучшения, удача, донат, событие, мини-игра, атмосфера миров. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") +local UserInputService = game:GetService("UserInputService") +local MarketplaceService = game:GetService("MarketplaceService") +local Lighting = game:GetService("Lighting") + +local player = Players.LocalPlayer +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local remote = ReplicatedStorage:WaitForChild("GameEvent") + +---------------------------------------------------------------- стиль + +local C = { + bg = Color3.fromRGB(18, 24, 40), + panel = Color3.fromRGB(30, 38, 62), + panel2 = Color3.fromRGB(44, 56, 90), + gold = Color3.fromRGB(255, 200, 70), + green = Color3.fromRGB(60, 190, 95), + blue = Color3.fromRGB(60, 135, 230), + red = Color3.fromRGB(215, 65, 65), + purple = Color3.fromRGB(150, 90, 220), + grey = Color3.fromRGB(75, 82, 102), + text = Color3.new(1, 1, 1), + muted = Color3.fromRGB(170, 180, 205), + line = Color3.fromRGB(90, 110, 165), +} +local TITLE = Enum.Font.FredokaOne +local BODY = Enum.Font.GothamBold +local BODY2 = Enum.Font.GothamMedium +local WHITE, BLACK = Color3.new(1, 1, 1), Color3.new(0, 0, 0) +local DING = "rbxasset://sounds/electronicpingshort.wav" + +---------------------------------------------------------------- помощники UI + +local function new(class, props, children) + local obj = Instance.new(class) + local parent + for k, v in pairs(props or {}) do + if k == "Parent" then + parent = v + else + obj[k] = v + end + end + for _, c in ipairs(children or {}) do + c.Parent = obj + end + if parent then + obj.Parent = parent + end + return obj +end +local function corner(r) + return new("UICorner", { CornerRadius = UDim.new(0, r or 10) }) +end +local function stroke(color, th, tr) + return new("UIStroke", { Color = color, Thickness = th or 2, Transparency = tr or 0, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }) +end +local function gradient(a, b, rot) + return new("UIGradient", { Color = ColorSequence.new(a, b), Rotation = rot or 90 }) +end +local function text(props) + local d = { + BackgroundTransparency = 1, Font = BODY, TextColor3 = C.text, TextSize = 16, + TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Center, + } + for k, v in pairs(props) do + d[k] = v + end + return new("TextLabel", d) +end +local function btn(props, onClick) + local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "" } + for k, v in pairs(props) do + d[k] = v + end + local b = new("TextButton", d, { corner(10), new("UIGradient", { Color = ColorSequence.new(WHITE, Color3.fromRGB(195, 195, 195)), Rotation = 90 }) }) + if onClick then + b.MouseButton1Click:Connect(onClick) + end + return b +end +local function clear(container) + for _, c in ipairs(container:GetChildren()) do + if c:IsA("GuiObject") then + c:Destroy() + end + end +end +local function fmt(n) + local s = tostring(math.floor(n)) + local out = s:reverse():gsub("(%d%d%d)", "%1 "):reverse() + return (out:gsub("^ ", "")) +end +local function stars(n) + return string.rep("★", n) .. string.rep("☆", Config.RodUpgrade.maxLevel - n) +end +local function hex(c) + return "#" .. c:ToHex() +end +local function timeStr(sec) + sec = math.max(0, math.floor(sec)) + return ("%d:%02d"):format(math.floor(sec / 60), sec % 60) +end +local function attrSet(name) + local set = {} + for id in string.gmatch(player:GetAttribute(name) or "", "[^,]+") do + set[id] = true + end + return set +end +local function rodLevels() + local t = {} + for id, lv in string.gmatch(player:GetAttribute("RodLevels") or "", "([^,:]+):(%d+)") do + t[id] = tonumber(lv) + end + return t +end +local function playUiSound(id, vol) + local s = Instance.new("Sound") + s.SoundId = id + s.Volume = vol or 0.5 + s.Parent = workspace.CurrentCamera + s:Play() + game:GetService("Debris"):AddItem(s, 3) +end + +local function viewport(parent, model, dir, zoom) + local vf = new("ViewportFrame", { + Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, + Ambient = Color3.fromRGB(175, 175, 185), LightColor = WHITE, LightDirection = Vector3.new(-0.4, -1, -0.6), + Parent = parent, + }) + model.Parent = vf + local cf, size = model:GetBoundingBox() + local cam = Instance.new("Camera") + cam.FieldOfView = 30 + local dist = (size.Magnitude / 2) / math.tan(math.rad(15)) * (zoom or 0.9) + cam.CFrame = CFrame.lookAt(cf.Position + dir.Unit * dist, cf.Position) + cam.Parent = vf + vf.CurrentCamera = cam + return vf +end +local FISH_VIEW = Vector3.new(0.12, 0.15, 1) +local ROD_VIEW = Vector3.new(1, 0.1, 0.05) +local BAG_VIEW = Vector3.new(0.6, 0.25, 1) + +local function silhouette(model) + for _, p in ipairs(model:GetDescendants()) do + if p:IsA("BasePart") then + p.Color = Color3.fromRGB(10, 12, 20) + p.Material = Enum.Material.SmoothPlastic + elseif p:IsA("ParticleEmitter") or p:IsA("PointLight") then + p:Destroy() + end + end + return model +end + +---------------------------------------------------------------- корень + +local gui = new("ScreenGui", { + Name = "FishingUI", ResetOnSpawn = false, IgnoreGuiInset = false, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), +}) + +---------------------------------------------------------------- HUD + +local hud = new("Frame", { + Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = gui, +}, { corner(16), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90), + new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14), PaddingTop = UDim.new(0, 10) }) }) +local coinsText = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 30, TextColor3 = C.gold, Text = "💰 0", TextStrokeTransparency = 0.6, Parent = hud }) +local lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Parent = hud }, + { corner(18), gradient(Color3.fromRGB(255, 225, 110), Color3.fromRGB(235, 145, 30), 90), stroke(Color3.fromRGB(120, 70, 10), 2, 0.2) }) +local lvlText = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = Color3.fromRGB(70, 40, 0), Text = "1", Parent = lvlBadge }) +local xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = hud }, { corner(9) }) +local xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = xpBack }, { corner(9), gradient(Color3.fromRGB(110, 225, 255), Color3.fromRGB(60, 110, 255), 0) }) +local xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = xpBack }) +local luckText = text({ Size = UDim2.new(1, 0, 0, 22), Position = UDim2.fromOffset(0, 82), TextSize = 16, RichText = true, TextColor3 = Color3.fromRGB(130, 255, 150), Text = "", Parent = hud }) +local bagText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud }) +local rodText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128), TextSize = 14, Font = BODY2, TextColor3 = C.muted, RichText = true, Text = "", Parent = hud }) + +-- баннер события (справа сверху) +local eventBanner = new("Frame", { + Size = UDim2.fromOffset(280, 58), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(14), stroke(C.gold, 2, 0.1), gradient(Color3.fromRGB(90, 60, 20), C.bg, 90) }) +local eventTitle = text({ Size = UDim2.new(1, -20, 0, 26), Position = UDim2.fromOffset(12, 4), Font = TITLE, TextSize = 19, TextColor3 = C.gold, Text = "", Parent = eventBanner }) +local eventDesc = text({ Size = UDim2.new(1, -20, 0, 20), Position = UDim2.fromOffset(12, 30), Font = BODY2, TextSize = 13, TextColor3 = C.text, Text = "", Parent = eventBanner }) + +-- кнопки слева +local side = new("Frame", { + Size = UDim2.fromOffset(70, 380), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 12, 0.5, 60), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + +local sideDots = {} +local function sideButton(order, icon, label, key, color, onClick) + local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = color, LayoutOrder = order, Parent = side }, onClick) + stroke(color:Lerp(BLACK, 0.45), 3).Parent = b + text({ Size = UDim2.new(1, 0, 0, 36), Position = UDim2.fromOffset(0, 3), TextSize = 28, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b }) + text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 44), Font = TITLE, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeTransparency = 0.5, Parent = b }) + if key and not UserInputService.TouchEnabled then + local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.new(1, -14, 0, -6), BackgroundColor3 = C.bg, Parent = b }, { corner(6), stroke(C.gold, 1.5) }) + text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = key, Parent = tag }) + end + local dot = new("Frame", { Size = UDim2.fromOffset(16, 16), Position = UDim2.new(0, -5, 0, -5), BackgroundColor3 = C.red, Visible = false, ZIndex = 3, Parent = b }, { corner(8), stroke(WHITE, 2) }) + sideDots[label] = dot + return b +end + +---------------------------------------------------------------- уведомления + +local toasts = new("Frame", { + Size = UDim2.new(0, 560, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) }) +local toastOrder = 0 +local toastTimers = {} + +local function notify(msg, color) + -- такое же сообщение уже на экране — не дублируем, а продлеваем его + for _, c in ipairs(toasts:GetChildren()) do + if c:IsA("Frame") and c:GetAttribute("Msg") == msg then + toastTimers[c] = (toastTimers[c] or 0) + 1 + local my = toastTimers[c] + task.delay(3.2, function() + if c.Parent and toastTimers[c] == my then + c:Destroy() + end + end) + return + end + end + toastOrder += 1 + local items = {} + for _, c in ipairs(toasts:GetChildren()) do + if c:IsA("Frame") then + table.insert(items, c) + end + end + if #items >= 3 then + items[1]:Destroy() + end + local t = new("Frame", { + Size = UDim2.new(0, 0, 0, 38), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.bg, + BackgroundTransparency = 0.15, LayoutOrder = toastOrder, Parent = toasts, + }, { corner(12), stroke(color or WHITE, 2, 0.2), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingRight = UDim.new(0, 16) }) }) + local l = text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 19, TextColor3 = color or WHITE, Text = msg, Parent = t }) + t:SetAttribute("Msg", msg) + toastTimers[t] = 0 + task.delay(3.2, function() + if t.Parent and toastTimers[t] == 0 then + TweenService:Create(t, TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play() + TweenService:Create(l, TweenInfo.new(0.4), { TextTransparency = 1 }):Play() + task.wait(0.45) + t:Destroy() + end + end) +end + +-- карточка пойманной рыбы +local catchCard = new("Frame", { + Size = UDim2.fromOffset(400, 128), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, -220), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(18) }) +local catchStroke = stroke(WHITE, 3) +catchStroke.Parent = catchCard +local catchGrad = gradient(C.panel2, C.bg, 90) +catchGrad.Parent = catchCard +local catchView = new("Frame", { Size = UDim2.fromOffset(130, 108), Position = UDim2.fromOffset(10, 10), BackgroundColor3 = C.bg, BackgroundTransparency = 0.3, Parent = catchCard }, { corner(14) }) +local catchHeader = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 10), Font = TITLE, TextSize = 15, TextColor3 = C.muted, Text = "", Parent = catchCard }) +local catchName = text({ Size = UDim2.new(1, -160, 0, 30), Position = UDim2.fromOffset(152, 30), Font = TITLE, TextSize = 26, Text = "", TextStrokeTransparency = 0.6, Parent = catchCard }) +local catchInfo = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 64), TextSize = 15, RichText = true, Text = "", Parent = catchCard }) +local catchValue = text({ Size = UDim2.new(1, -160, 0, 26), Position = UDim2.fromOffset(152, 90), Font = TITLE, TextSize = 21, TextColor3 = C.gold, Text = "", Parent = catchCard }) +local catchToken = 0 + +local function showCatch(fish, extra) + catchToken += 1 + local my = catchToken + local r = Config.Rarities[fish.rarity] + local mut = fish.mutation and Config.Find(Config.Mutations, fish.mutation) + clear(catchView) + viewport(catchView, Models.buildFish(fish.id, fish.mutation, 1, true), FISH_VIEW, 0.75) + catchStroke.Color = mut and mut.color or r.color + catchGrad.Color = ColorSequence.new(r.color:Lerp(C.bg, 0.55), C.bg) + catchHeader.Text = extra and extra.new and "🆕 НОВЫЙ ВИД! Опыт x2" or (extra and extra.record and "🏆 НОВЫЙ РЕКОРД!" or "ПОЙМАНА РЫБА") + catchHeader.TextColor3 = (extra and (extra.new or extra.record)) and C.gold or C.muted + catchName.Text = fish.name + catchName.TextColor3 = r.color + catchInfo.Text = ("%s%s · %.2f кг"):format( + hex(r.color), r.name, mut and (" · " .. mut.name .. " x" .. mut.mult .. "") or "", fish.weight) + catchValue.Text = ("💰 %s ⭐ +%d XP"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1)) + catchCard.Visible = true + TweenService:Create(catchCard, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Position = UDim2.new(0.5, 0, 0, 120) }):Play() + task.delay(3.4, function() + if my == catchToken then + local tw = TweenService:Create(catchCard, TweenInfo.new(0.35, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Position = UDim2.new(0.5, 0, 0, -220) }) + tw:Play() + tw.Completed:Wait() + if my == catchToken then + catchCard.Visible = false + end + end + end) +end + +local function floatText(msg, color) + local l = text({ + Size = UDim2.fromOffset(400, 60), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.42), + Font = TITLE, TextSize = 46, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = color, + TextStrokeTransparency = 0.2, Text = msg, Parent = gui, + }) + TweenService:Create(l, TweenInfo.new(1.4, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, 0.3), TextTransparency = 1, TextStrokeTransparency = 1 }):Play() + task.delay(1.5, function() + l:Destroy() + end) +end + +---------------------------------------------------------------- статус и мини-игра + +local statusLabel = text({ + Size = UDim2.fromOffset(460, 34), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110), + Font = TITLE, TextSize = 22, TextXAlignment = Enum.TextXAlignment.Center, TextStrokeTransparency = 0.3, + Text = "🎣 Ждём поклёвку… (клик — смотать)", Visible = false, Parent = gui, +}) +local mgFrame = new("Frame", { + Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(16), stroke(C.gold, 2.5, 0.1), gradient(C.panel2, C.bg, 90) }) +text({ + Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 24, + TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, TextStrokeTransparency = 0.5, + Text = "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame, +}) +local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = Color3.fromRGB(22, 28, 46), ClipsDescendants = true, Parent = mgFrame }, { corner(9), stroke(BLACK, 1.5, 0.4) }) +local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(130, 245, 150), Color3.fromRGB(35, 165, 75), 90) }) +local markerF = new("Frame", { Size = UDim2.new(0, 8, 1, 4), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0, 0.5), BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar }, { corner(4), stroke(BLACK, 2) }) +local pipsText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.fromOffset(15, 84), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = mgFrame }) +local missText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.new(0.5, 0, 0, 84), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = "", Parent = mgFrame }) +local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.fromOffset(15, 112), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = mgFrame }, { corner(3) }) + +---------------------------------------------------------------- окна + +local openWindow = nil + +local function makeWindow(title, accent, tabs) + local w = { pages = {}, tabButtons = {}, current = nil } + local frame = new("Frame", { + Size = UDim2.fromScale(0.92, 0.82), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.53), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, + }, { corner(20), stroke(accent, 3, 0.05), gradient(C.panel, C.bg, 90), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) }) + local scale = new("UIScale", { Parent = frame }) + local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundColor3 = WHITE, Parent = frame }, { corner(20), gradient(accent, accent:Lerp(BLACK, 0.35), 90) }) + new("Frame", { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 1, -20), BackgroundColor3 = accent:Lerp(BLACK, 0.3), BorderSizePixel = 0, Parent = header }) + text({ Size = UDim2.new(1, -80, 1, 0), Position = UDim2.fromOffset(20, 0), Font = TITLE, TextSize = 30, Text = title, TextStrokeTransparency = 0.5, ZIndex = 2, Parent = header }) + btn({ Size = UDim2.fromOffset(42, 42), Position = UDim2.new(1, -52, 0, 7), BackgroundColor3 = C.red, Text = "✕", TextSize = 22, ZIndex = 3, Parent = header }, function() + w.close() + end) + local hasTabs = #tabs > 1 + local tabBar = new("Frame", { Size = UDim2.new(1, -28, 0, 42), Position = UDim2.fromOffset(14, 66), BackgroundTransparency = 1, Visible = hasTabs, Parent = frame }, + { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + local top = hasTabs and 116 or 68 + local body = new("Frame", { Size = UDim2.new(1, -28, 1, -(top + 12)), Position = UDim2.fromOffset(14, top), BackgroundTransparency = 1, Parent = frame }) + w.frame = frame + + function w.setTab(id) + w.current = id + for k, page in pairs(w.pages) do + page.Visible = (k == id) + end + for k, b in pairs(w.tabButtons) do + b.BackgroundColor3 = (k == id) and accent or C.panel2 + end + if w.render then + w.render(id) + end + end + for i, t in ipairs(tabs) do + w.pages[t.id] = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Visible = false, Parent = body }) + w.tabButtons[t.id] = btn({ Size = UDim2.new(1 / #tabs, -8, 1, 0), Text = t.label, TextSize = 18, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = tabBar }, function() + w.setTab(t.id) + end) + end + function w.open(tab) + if openWindow and openWindow ~= w then + openWindow.close() + end + openWindow = w + frame.Visible = true + scale.Scale = 0.85 + TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() + w.setTab(tab or w.current or tabs[1].id) + end + function w.close() + frame.Visible = false + if openWindow == w then + openWindow = nil + end + end + function w.isOpen() + return frame.Visible + end + function w.toggle(tab) + if frame.Visible and (tab == nil or w.current == tab) then + w.close() + else + w.open(tab) + end + end + function w.refresh() + if frame.Visible and w.render then + w.render(w.current) + end + end + return w +end + +local function scrollArea(parent, cell, topOffset) + local sf = new("ScrollingFrame", { + Size = UDim2.new(1, 0, 1, -(topOffset or 0)), Position = UDim2.fromOffset(0, topOffset or 0), + BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 6, ScrollBarImageColor3 = C.muted, + AutomaticCanvasSize = Enum.AutomaticSize.Y, CanvasSize = UDim2.new(), Parent = parent, + }, { new("UIPadding", { PaddingRight = UDim.new(0, 10), PaddingTop = UDim.new(0, 4), PaddingLeft = UDim.new(0, 2), PaddingBottom = UDim.new(0, 8) }) }) + if cell then + new("UIGridLayout", { CellSize = cell, CellPadding = UDim2.fromOffset(10, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf }) + else + new("UIListLayout", { Padding = UDim.new(0, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf }) + end + return sf +end + +local function itemRow(parent, order, o) + local row = new("Frame", { Size = UDim2.new(1, -4, 0, 100), BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(14), stroke(o.strokeColor or C.line, 2, o.strokeColor and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) + local view = new("Frame", { Size = UDim2.fromOffset(124, 84), Position = UDim2.fromOffset(8, 8), BackgroundColor3 = o.iconBg or C.bg, Parent = row }, { corner(10) }) + if o.model then + viewport(view, o.model, o.dir, o.zoom) + elseif o.icon then + text({ Size = UDim2.fromScale(1, 1), TextSize = 48, TextXAlignment = Enum.TextXAlignment.Center, Text = o.icon, Parent = view }) + end + text({ Size = UDim2.new(1, -300, 0, 28), Position = UDim2.fromOffset(144, 8), Font = TITLE, TextSize = 22, Text = o.title, TextColor3 = o.titleColor or C.text, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) + text({ + Size = UDim2.new(1, -300, 0, 56), Position = UDim2.fromOffset(144, 38), Font = BODY2, TextSize = 14, TextColor3 = C.muted, + RichText = true, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = o.lines, Parent = row, + }) + btn({ + Size = UDim2.fromOffset(140, 50), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), + Text = o.buttonText, BackgroundColor3 = o.buttonColor, AutoButtonColor = o.active, TextSize = 19, Parent = row, + }, o.active and o.onClick or nil) + return row +end + +local function progressBar(parent, pos, size, frac, color) + local back = new("Frame", { Size = size, Position = pos, BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = parent }, { corner(7) }) + new("Frame", { Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1), BackgroundColor3 = color, Parent = back }, { corner(7) }) + return back +end + +---------------------------------------------------------------- данные с сервера + +local inventory, discovered, claimed = {}, {}, {} +local quests, daily = {}, { available = false, streak = 0, nextStreak = 1 } + +---------------------------------------------------------------- магазин + +local shopWin = makeWindow("🎣 Магазин Михалыча", Color3.fromRGB(215, 120, 40), { + { id = "rods", label = "🎣 Удочки" }, + { id = "upgrade", label = "✨ Улучшение" }, + { id = "bags", label = "🎒 Сумки" }, + { id = "luck", label = "🍀 Удача" }, +}) +local shopLists = { + rods = scrollArea(shopWin.pages.rods), + upgrade = scrollArea(shopWin.pages.upgrade), + bags = scrollArea(shopWin.pages.bags), + luck = scrollArea(shopWin.pages.luck), +} + +local function statLine(s) + return ("🍀 Удача +%d%% ⏱ Клёв x%.2f 🎯 Зона %d%%"):format(math.floor(s.luck * 100 + 0.5), s.speed, math.floor(s.zone * 100 + 0.5)) +end +local function buyButton(price, level, myLevel, coins) + if myLevel < level then + return "🔒 Ур. " .. level, C.grey, false + end + return "💰 " .. fmt(price), coins >= price and C.green or Color3.fromRGB(150, 95, 60), true +end + +shopWin.render = function(tab) + local list = shopLists[tab] + if not list then + return + end + clear(list) + local myLevel = player:GetAttribute("Level") or 1 + local coins = player:GetAttribute("Coins") or 0 + local levels = rodLevels() + + if tab == "rods" then + local owned = attrSet("OwnedRods") + for i, rod in ipairs(Config.Rods) do + local lv = levels[rod.id] or 0 + local equipped = player:GetAttribute("Rod") == rod.id + local bText, bColor, active + if equipped then + bText, bColor, active = "Надето ✓", C.grey, false + elseif owned[rod.id] then + bText, bColor, active = "Надеть", C.blue, true + else + bText, bColor, active = buyButton(rod.price, rod.level, myLevel, coins) + end + itemRow(list, i, { + model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + title = rod.name .. (owned[rod.id] and (" " .. stars(lv) .. "") or ""), + lines = statLine(Config.RodStats(rod.id, lv)) .. "\n" .. (owned[rod.id] and "Куплена" or ("Нужен уровень " .. rod.level)), + strokeColor = equipped and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Rod", rod.id) + end, + }) + end + elseif tab == "upgrade" then + text({ + Size = UDim2.new(1, -4, 0, 40), LayoutOrder = 0, TextSize = 14, Font = BODY2, TextColor3 = C.muted, TextWrapped = true, + Text = "Каждое улучшение даёт +" .. math.floor(Config.RodUpgrade.luckPerLevel * 100) .. "% удачи, ускоряет клёв и расширяет зелёную зону. Максимум — " .. stars(Config.RodUpgrade.maxLevel), + Parent = list, + }) + local owned = attrSet("OwnedRods") + local order = 0 + for _, rod in ipairs(Config.Rods) do + if owned[rod.id] then + order += 1 + local lv = levels[rod.id] or 0 + local now = Config.RodStats(rod.id, lv) + local maxed = lv >= Config.RodUpgrade.maxLevel + local lines + if maxed then + lines = statLine(now) .. "\nМаксимальное улучшение!" + else + local nxt = Config.RodStats(rod.id, lv + 1) + lines = ("🍀 +%d%% → +%d%% ⏱ x%.2f → x%.2f\n🎯 %d%% → %d%%"):format( + math.floor(now.luck * 100 + 0.5), math.floor(nxt.luck * 100 + 0.5), now.speed, nxt.speed, + math.floor(now.zone * 100 + 0.5), math.floor(nxt.zone * 100 + 0.5)) + end + local cost = Config.UpgradeCost(rod, lv) + itemRow(list, order, { + model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + title = rod.name .. " " .. stars(lv) .. "", + lines = lines, + strokeColor = player:GetAttribute("Rod") == rod.id and C.gold or nil, + buttonText = maxed and "MAX ★" or ("✨ " .. fmt(cost)), + buttonColor = maxed and C.grey or (coins >= cost and Color3.fromRGB(190, 120, 255) or Color3.fromRGB(110, 80, 140)), + active = not maxed, + onClick = function() + remote:FireServer("Buy", "Upgrade", rod.id) + end, + }) + end + end + elseif tab == "bags" then + local owned = attrSet("OwnedBags") + local bonus = attrSet("Passes").BigBag and 100 or 0 + for i, bag in ipairs(Config.Bags) do + local equipped = player:GetAttribute("Bag") == bag.id + local bText, bColor, active + if equipped then + bText, bColor, active = "Надето ✓", C.grey, false + elseif owned[bag.id] then + bText, bColor, active = "Надеть", C.blue, true + else + bText, bColor, active = buyButton(bag.price, bag.level, myLevel, coins) + end + itemRow(list, i, { + model = Models.buildBag(bag.id, true), dir = BAG_VIEW, zoom = 0.8, + title = bag.name, + lines = ("🎒 Вмещает %d рыб%s\n%s"):format(bag.capacity + bonus, bonus > 0 and " (с пропуском)" or "", owned[bag.id] and "Куплена" or ("Нужен уровень " .. bag.level)), + strokeColor = equipped and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Bag", bag.id) + end, + }) + end + elseif tab == "luck" then + local lv = levels[player:GetAttribute("Rod") or "Basic"] or 0 + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") or Config.Rods[1] + local boost = player:GetAttribute("BoostBonus") or 0 + local total = player:GetAttribute("Luck") or 100 + local ps = attrSet("Passes") + local evId = workspace:GetAttribute("Event") + local event = evId and Config.Find(Config.Events, evId) + local mutLine = {} + for _, m in ipairs(Config.Mutations) do + table.insert(mutLine, ("%s %.1f%%"):format(hex(m.color), m.name, math.min(100, m.chance * total / 100 * ((event and event.mutation) or 1) * 100))) + end + local lines = { + ("🍀 Твоя удача: %d%%"):format(total), + ("Базовая 100%% · 🎣 Удочка +%d%% · ✨ Улучшения +%d%%"):format(math.floor(rod.luck * 100 + 0.5), math.floor(lv * Config.RodUpgrade.luckPerLevel * 100 + 0.5)), + ("⭐ Уровень +%d%% · 🏆 Мастерство миров +%d%%"):format(math.floor(((player:GetAttribute("Level") or 1) - 1) * Config.LuckPerPlayerLevel * 100 + 0.5), math.floor((player:GetAttribute("Mastery") or 0) * Config.MasteryLuck * 100 + 0.5)), + ("🧪 Зелье +%d%%%s · 👑 Пропуска +%d%%%s"):format(math.floor(boost * 100 + 0.5), boost > 0 and (" (" .. timeStr(player:GetAttribute("BoostLeft") or 0) .. ")") or "", + (ps.VIP and 25 or 0) + (ps.LuckyCharm and 50 or 0), (event and event.luck) and (" · 🎉 Событие +" .. event.luck * 100 .. "%") or ""), + "Шанс мутаций: " .. table.concat(mutLine, " · "), + } + local info = new("Frame", { Size = UDim2.new(1, -4, 0, 160), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = list }, + { corner(14), stroke(Color3.fromRGB(90, 220, 120), 2, 0.2), gradient(Color3.fromRGB(35, 70, 55), C.panel, 90), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingTop = UDim.new(0, 10), PaddingRight = UDim.new(0, 16) }) }) + text({ Size = UDim2.fromScale(1, 1), TextSize = 15, RichText = true, TextYAlignment = Enum.TextYAlignment.Top, TextWrapped = true, Text = table.concat(lines, "\n"), Parent = info }) + for i, p in ipairs(Config.Potions) do + local bText, bColor, active = buyButton(p.price, p.level or 1, myLevel, coins) + itemRow(list, i, { + icon = "🧪", iconBg = p.color:Lerp(C.bg, 0.6), + title = p.name, titleColor = p.color, + lines = ("Удача +%d%% на %d мин.\nРедкая рыба и мутации попадаются чаще!"):format(p.bonus * 100, p.duration / 60), + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Potion", p.id) + end, + }) + end + end +end + +---------------------------------------------------------------- сумка и коллекция + +local bagWin = makeWindow("🎒 Сумка", Color3.fromRGB(60, 140, 220), { + { id = "fish", label = "🐟 Улов" }, + { id = "dex", label = "📖 Коллекция" }, +}) + +local fishHeader = new("Frame", { Size = UDim2.new(1, 0, 0, 50), BackgroundColor3 = WHITE, Parent = bagWin.pages.fish }, { corner(12), gradient(C.panel2, C.panel, 90) }) +local fishSummary = text({ Size = UDim2.new(1, -200, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = fishHeader }) +btn({ Size = UDim2.fromOffset(170, 38), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.green, Text = "💰 Продать всё", TextSize = 18, Parent = fishHeader }, function() + remote:FireServer("SellAll") +end) +local fishGrid = scrollArea(bagWin.pages.fish, UDim2.fromOffset(132, 176), 60) + +local dexWorld = "World1" +local dexTabs = new("Frame", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, Parent = bagWin.pages.dex }, + { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8) }) }) +local dexList = scrollArea(bagWin.pages.dex, nil, 46) +local dexTabButtons = {} + +local function fishCard(parent, order, rarityColor, strokeColor) + return new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(14), stroke(strokeColor or rarityColor, 2.5, 0.05), gradient(rarityColor:Lerp(C.bg, 0.55), C.panel, 90) }) +end + +local function rewardButton(parent, state, label, onClick) + local color = (state == "ready") and C.green or C.grey + return btn({ + Size = UDim2.fromOffset(150, 34), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), + BackgroundColor3 = color, AutoButtonColor = state == "ready", Text = label, TextSize = 16, Parent = parent, + }, state == "ready" and onClick or nil) +end + +local function renderDex() + clear(dexList) + for id, b in pairs(dexTabButtons) do + b.BackgroundColor3 = (id == dexWorld) and C.purple or C.panel2 + end + local world = Config.Find(Config.Worlds, dexWorld) + local all = Config.Zones[dexWorld].fish + local found = 0 + for _, f in ipairs(all) do + if discovered[f.id] then + found += 1 + end + end + + -- мастерство мира + local head = new("Frame", { Size = UDim2.new(1, -4, 0, 56), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = dexList }, + { corner(12), stroke(C.gold, 2, 0.3), gradient(Color3.fromRGB(70, 55, 20), C.panel, 90) }) + text({ + Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 17, RichText = true, TextWrapped = true, + Text = ("%s %s — %d / %d\nСобери всех: +%s 💰 и +%d%% удачи навсегда"):format( + world.icon, world.name, found, #all, fmt(Config.MasteryCoins * world.mult), math.floor(Config.MasteryLuck * 100 + 0.5)), + Parent = head, + }) + local mKey = dexWorld .. ":Master" + rewardButton(head, claimed[mKey] and "done" or (found == #all and "ready" or "locked"), + claimed[mKey] and "Получено ✓" or (found == #all and "🏆 Забрать" or "🔒 Не собрано"), function() + remote:FireServer("ClaimCollection", dexWorld, "Master") + end) + + for ri, rarity in ipairs(Config.RarityOrder) do + local group = {} + for _, f in ipairs(all) do + if f.rarity == rarity then + table.insert(group, f) + end + end + if #group > 0 then + local r = Config.Rarities[rarity] + local have = 0 + for _, f in ipairs(group) do + if discovered[f.id] then + have += 1 + end + end + local section = new("Frame", { Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = ri, Parent = dexList }, + { new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }) }) + local hdr = new("Frame", { Size = UDim2.new(1, 0, 0, 44), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = section }, + { corner(10), gradient(r.color:Lerp(C.bg, 0.5), C.panel, 0) }) + local reward = Config.CollectionRewards[rarity] + text({ + Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(12, 0), Font = TITLE, TextSize = 17, RichText = true, + Text = ("%s %d/%d +%s 💰 +%s XP"):format( + hex(r.color), r.name, have, #group, fmt(reward.coins * world.mult), fmt(reward.xp * world.mult)), + Parent = hdr, + }) + local key = dexWorld .. ":" .. rarity + rewardButton(hdr, claimed[key] and "done" or (have == #group and "ready" or "locked"), + claimed[key] and "Получено ✓" or (have == #group and "🎁 Забрать" or ("🔒 " .. have .. "/" .. #group)), function() + remote:FireServer("ClaimCollection", dexWorld, rarity) + end) + local grid = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 1, Parent = section }, + { new("UIGridLayout", { CellSize = UDim2.fromOffset(124, 150), CellPadding = UDim2.fromOffset(8, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + for i, f in ipairs(group) do + local rec = discovered[f.id] + local card = fishCard(grid, i, rec and r.color or C.grey) + local view = new("Frame", { Size = UDim2.new(1, -12, 0, 76), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) + local model = Models.buildFish(f.id, nil, 1, true) + viewport(view, rec and model or silhouette(model), FISH_VIEW, 0.72) + text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 84), Font = TITLE, TextSize = 15, TextColor3 = rec and r.color or C.muted, Text = rec and f.name or "???", TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) + text({ + Size = UDim2.new(1, -10, 0, 40), Position = UDim2.fromOffset(6, 104), Font = BODY2, TextSize = 12, TextColor3 = C.muted, TextWrapped = true, + TextYAlignment = Enum.TextYAlignment.Top, + Text = rec and ("Поймано: %d\nРекорд: %.2f кг"):format(rec.count, rec.best) or "Ещё не поймана", Parent = card, + }) + end + end + end +end + +for i, w in ipairs(Config.Worlds) do + if not w.soon then + dexTabButtons[w.id] = btn({ Size = UDim2.new(0, 170, 1, 0), Text = w.icon .. " " .. w.name, TextSize = 15, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = dexTabs }, function() + dexWorld = w.id + renderDex() + end) + end +end + +bagWin.render = function(tab) + if tab == "fish" then + clear(fishGrid) + local total = 0 + for _, it in ipairs(inventory) do + total += it.value + end + fishSummary.Text = ("🐟 %d / %d · 💰 ≈%s"):format(#inventory, player:GetAttribute("BagCap") or 0, fmt(player:GetAttribute("BagValue") or total)) + if #inventory == 0 then + text({ Size = UDim2.fromOffset(400, 60), Font = TITLE, TextSize = 20, TextColor3 = C.muted, TextWrapped = true, Text = "Сумка пуста. Иди к воде и поймай рыбу! 🎣", Parent = fishGrid }) + return + end + local sorted = table.clone(inventory) + table.sort(sorted, function(a, b) + return a.value > b.value + end) + for i, it in ipairs(sorted) do + local r = Config.Rarities[it.rarity] or Config.Rarities.Common + local mut = it.mutation and Config.Find(Config.Mutations, it.mutation) + local card = fishCard(fishGrid, i, r.color, mut and mut.color) + local view = new("Frame", { Size = UDim2.new(1, -12, 0, 84), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) + viewport(view, Models.buildFish(it.id, it.mutation, 1, true), FISH_VIEW, 0.72) + if mut then + local tag = new("Frame", { Size = UDim2.fromOffset(0, 20), AutomaticSize = Enum.AutomaticSize.X, Position = UDim2.fromOffset(6, 6), BackgroundColor3 = mut.color, ZIndex = 3, Parent = card }, + { corner(6), new("UIPadding", { PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }) }) + text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 13, TextColor3 = C.bg, Text = mut.name, ZIndex = 4, Parent = tag }) + end + text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 92), Font = TITLE, TextSize = 16, TextColor3 = r.color, Text = it.name, TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) + text({ Size = UDim2.new(1, -10, 0, 16), Position = UDim2.fromOffset(6, 112), Font = BODY2, TextSize = 13, TextColor3 = C.muted, Text = ("%.2f кг · %s"):format(it.weight, r.name), Parent = card }) + btn({ Size = UDim2.new(1, -12, 0, 32), Position = UDim2.fromOffset(6, 136), BackgroundColor3 = C.green, Text = "💰 " .. fmt(it.value), TextSize = 17, Parent = card }, function() + remote:FireServer("SellOne", it.uid) + end) + end + elseif tab == "dex" then + renderDex() + end +end + +---------------------------------------------------------------- миры + +local worldsWin = makeWindow("🌍 Миры", Color3.fromRGB(40, 160, 200), { { id = "list", label = "Миры" } }) +local worldsList = scrollArea(worldsWin.pages.list) + +local function currentWorld() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + return hrp and Config.WorldAt(hrp.Position) +end + +worldsWin.render = function() + clear(worldsList) + local myLevel = player:GetAttribute("Level") or 1 + local here = currentWorld() + itemRow(worldsList, 0, { + icon = "🏠", iconBg = Color3.fromRGB(90, 70, 30), + title = "Лобби", titleColor = C.gold, + lines = "Магазин удочек, скупка, донат-лавки и ежедневный сундук.", + buttonText = here == nil and "Вы здесь" or "🌀 Телепорт", buttonColor = here == nil and C.grey or C.blue, active = here ~= nil, + onClick = function() + remote:FireServer("Teleport", "Lobby") + worldsWin.close() + end, + }) + for i, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + local total, found = 0, 0 + if zone then + for _, f in ipairs(zone.fish) do + total += 1 + if discovered[f.id] then + found += 1 + end + end + end + local bText, bColor, active + if w.soon then + bText, bColor, active = "Скоро…", C.grey, false + elseif myLevel < w.level then + bText, bColor, active = "🔒 Ур. " .. w.level, C.grey, false + elseif here and here.id == w.id then + bText, bColor, active = "Вы здесь", C.grey, false + else + bText, bColor, active = "🌀 Телепорт", C.blue, true + end + itemRow(worldsList, i, { + icon = w.icon, iconBg = w.color:Lerp(C.bg, 0.6), + title = w.name, titleColor = w.color, + lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d · Рыб поймано: %d / %d · Награды x%d"):format(w.level, found, total, w.mult)), + strokeColor = (here and here.id == w.id) and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Teleport", w.id) + worldsWin.close() + end, + }) + end +end + +---------------------------------------------------------------- задания и ежедневная награда + +local questWin = makeWindow("📜 Задания", Color3.fromRGB(200, 140, 40), { + { id = "quests", label = "📜 Задания" }, + { id = "daily", label = "🎁 Ежедневно" }, +}) +local questList = scrollArea(questWin.pages.quests) +local dailyPage = questWin.pages.daily + +local function questText(q) + local t = Config.Quests[1] + for _, def in ipairs(Config.Quests) do + if def.kind == q.kind then + t = def + end + end + return string.find(t.text, "%%d") and t.text:format(q.goal) or t.text +end + +questWin.render = function(tab) + if tab == "quests" then + clear(questList) + text({ Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = BODY2, TextSize = 14, TextColor3 = C.muted, Text = "Выполняй задания — после награды появится новое.", Parent = questList }) + for i, q in ipairs(quests) do + local done = q.progress >= q.goal + local row = new("Frame", { Size = UDim2.new(1, -4, 0, 92), BackgroundColor3 = WHITE, LayoutOrder = i, Parent = questList }, + { corner(14), stroke(done and C.green or C.line, 2, done and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, -190, 0, 28), Position = UDim2.fromOffset(16, 8), Font = TITLE, TextSize = 19, Text = questText(q), TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) + progressBar(row, UDim2.fromOffset(16, 42), UDim2.new(1, -200, 0, 14), q.progress / q.goal, done and C.green or C.gold) + text({ Size = UDim2.new(1, -190, 0, 20), Position = UDim2.fromOffset(16, 62), Font = BODY2, TextSize = 13, TextColor3 = C.muted, RichText = true, + Text = ("%s / %s · +%s 💰 +%s XP"):format(fmt(q.progress), fmt(q.goal), fmt(q.coins), fmt(q.xp)), Parent = row }) + btn({ + Size = UDim2.fromOffset(150, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), + BackgroundColor3 = done and C.green or C.grey, AutoButtonColor = done, Text = done and "🎁 Забрать" or "В процессе", TextSize = 18, Parent = row, + }, done and function() + remote:FireServer("ClaimQuest", i) + end or nil) + end + elseif tab == "daily" then + clear(dailyPage) + local myLevel = player:GetAttribute("Level") or 1 + text({ + Size = UDim2.new(1, 0, 0, 30), Font = TITLE, TextSize = 20, RichText = true, + Text = ("🔥 Серия: %d дн. Заходи каждый день — награда растёт!"):format(daily.streak), Parent = dailyPage, + }) + local row = new("Frame", { Size = UDim2.new(1, 0, 0, 150), Position = UDim2.fromOffset(0, 40), BackgroundTransparency = 1, Parent = dailyPage }, + { new("UIGridLayout", { CellSize = UDim2.new(1 / 7, -8, 1, 0), CellPadding = UDim2.fromOffset(8, 0) }) }) + for d, r in ipairs(Config.DailyRewards) do + local isNext = d == daily.nextStreak and daily.available + local passed = d <= daily.streak and not (daily.available and daily.nextStreak == 1) + local cell = new("Frame", { BackgroundColor3 = WHITE, Parent = row }, + { corner(12), stroke(isNext and C.gold or C.line, isNext and 3 or 2, isNext and 0 or 0.4), gradient(isNext and Color3.fromRGB(90, 70, 20) or C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, 0, 0, 24), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Center, Text = "День " .. d, Parent = cell }) + text({ Size = UDim2.new(1, 0, 0, 44), Position = UDim2.fromOffset(0, 32), TextSize = 32, TextXAlignment = Enum.TextXAlignment.Center, Text = passed and "✅" or (r.potion and "🧪" or "💰"), Parent = cell }) + text({ + Size = UDim2.new(1, -6, 0, 50), Position = UDim2.fromOffset(3, 80), Font = BODY2, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = true, TextColor3 = C.gold, + Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. " 💰" .. (r.potion and "\n+ зелье" or ""), Parent = cell, + }) + end + btn({ + Size = UDim2.fromOffset(260, 54), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 210), + BackgroundColor3 = daily.available and C.green or C.grey, AutoButtonColor = daily.available, + Text = daily.available and "🎁 Забрать награду" or "Приходи завтра!", TextSize = 22, Parent = dailyPage, + }, daily.available and function() + remote:FireServer("ClaimDaily") + end or nil) + end +end + +---------------------------------------------------------------- донат + +local robuxWin = makeWindow("💎 Премиум", Color3.fromRGB(150, 80, 210), { + { id = "passes", label = "👑 Пропуска" }, + { id = "products", label = "🪙 Наборы" }, +}) +local robuxLists = { passes = scrollArea(robuxWin.pages.passes), products = scrollArea(robuxWin.pages.products) } + +robuxWin.render = function(tab) + local list = robuxLists[tab] + clear(list) + local owned = attrSet("Passes") + local items = tab == "passes" and Config.GamePasses or Config.Products + for i, it in ipairs(items) do + local has = tab == "passes" and owned[it.key] + itemRow(list, i, { + icon = it.icon, iconBg = Color3.fromRGB(70, 40, 100), + title = it.name, titleColor = C.gold, + lines = it.desc .. (tab == "passes" and "\nДействует навсегда" or ""), + strokeColor = has and C.gold or nil, + buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has, + onClick = function() + if not it.id or it.id == 0 then + notify("Товар ещё не настроен: впиши его ID в FishConfig", Color3.fromRGB(255, 200, 120)) + return + end + if tab == "passes" then + MarketplaceService:PromptGamePassPurchase(player, it.id) + else + MarketplaceService:PromptProductPurchase(player, it.id) + end + end, + }) + end +end + +---------------------------------------------------------------- боковые кнопки + +sideButton(1, "🎒", "Сумка", "B", Color3.fromRGB(60, 140, 220), function() + bagWin.toggle("fish") +end) +sideButton(2, "📖", "Рыбы", "C", Color3.fromRGB(150, 90, 220), function() + bagWin.toggle("dex") +end) +sideButton(3, "🌍", "Миры", "M", Color3.fromRGB(40, 160, 200), function() + worldsWin.toggle() +end) +sideButton(4, "📜", "Задания", "Q", Color3.fromRGB(210, 150, 40), function() + questWin.toggle() +end) +sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function() + robuxWin.toggle() +end) + +local function refreshDots() + local q = false + for _, quest in ipairs(quests) do + if quest.progress >= quest.goal then + q = true + end + end + sideDots["Задания"].Visible = q or daily.available + local c = false + for _, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + if zone then + for _, rarity in ipairs(Config.RarityOrder) do + local any, all = false, true + for _, f in ipairs(zone.fish) do + if f.rarity == rarity then + any = true + if not discovered[f.id] then + all = false + end + end + end + if any and all and not claimed[w.id .. ":" .. rarity] then + c = true + end + end + end + end + sideDots["Рыбы"].Visible = c +end + +---------------------------------------------------------------- HUD: обновление + +local function refreshHud() + local xp = player:GetAttribute("XP") or 0 + local need = player:GetAttribute("XPNeed") or 100 + coinsText.Text = "💰 " .. fmt(player:GetAttribute("Coins") or 0) + lvlText.Text = tostring(player:GetAttribute("Level") or 1) + xpText.Text = ("%d / %d XP"):format(xp, need) + TweenService:Create(xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play() + local boost = player:GetAttribute("BoostBonus") or 0 + luckText.Text = ("🍀 Удача %d%%%s"):format(player:GetAttribute("Luck") or 100, + boost > 0 and (" 🧪 +%d%% %s"):format(boost * 100, timeStr(player:GetAttribute("BoostLeft") or 0)) or "") + local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10 + bagText.Text = ("🎒 %d / %d · ≈ %s 💰"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0)) + bagText.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") + rodText.Text = ("🎣 %s %s"):format(rod and rod.name or "", stars(player:GetAttribute("RodLevel") or 0)) +end + +local pending = false +player.AttributeChanged:Connect(function(name) + refreshHud() + if name == "BoostLeft" and not (shopWin.isOpen() and shopWin.current == "luck") then + return + end + if not pending then + pending = true + task.defer(function() + pending = false + shopWin.refresh() + robuxWin.refresh() + if worldsWin.isOpen() then + worldsWin.refresh() + end + end) + end +end) +refreshHud() + +---------------------------------------------------------------- рыбалка + +local state = "idle" +local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 } + +local function setState(s) + state = s + statusLabel.Visible = (s == "waiting") + mgFrame.Visible = (s == "bite") +end +local function updatePips() + pipsText.Text = "🎯 " .. string.rep("●", mg.hits) .. string.rep("●", mg.need - mg.hits) + missText.Text = string.rep("✖", mg.misses) .. string.rep("❤️", mg.maxMisses - mg.misses) +end +local function flash(color) + bar.BackgroundColor3 = color + TweenService:Create(bar, TweenInfo.new(0.35), { BackgroundColor3 = Color3.fromRGB(22, 28, 46) }):Play() +end +local function placeZone() + mg.zoneStart = math.random() * (1 - mg.zoneWidth) + zoneF.Size = UDim2.fromScale(mg.zoneWidth, 1) + zoneF.Position = UDim2.fromScale(mg.zoneStart, 0) +end + +local function onActivate() + if state == "idle" then + setState("casting") + remote:FireServer("Cast") + elseif state == "waiting" then + remote:FireServer("Cancel") + setState("idle") + elseif state == "bite" then + local inZone = mg.pos >= mg.zoneStart and mg.pos <= mg.zoneStart + mg.zoneWidth + if inZone then + mg.hits += 1 + flash(Color3.fromRGB(60, 160, 80)) + if mg.hits >= mg.need then + setState("reeling") + remote:FireServer("Catch", true, mg.misses) + return + end + mg.speed *= 1.12 + placeZone() + else + mg.misses += 1 + flash(Color3.fromRGB(170, 50, 50)) + if mg.misses >= mg.maxMisses then + setState("reeling") + remote:FireServer("Catch", false, mg.misses) + return + end + end + updatePips() + end +end + +local hooked = setmetatable({}, { __mode = "k" }) +local function hookTool(tool) + if hooked[tool] or not tool:IsA("Tool") or not tool:GetAttribute("IsRod") then + return + end + hooked[tool] = true + tool.Activated:Connect(onActivate) + tool.Unequipped:Connect(function() + if state == "waiting" or state == "bite" or state == "casting" then + remote:FireServer("Cancel") + end + setState("idle") + end) +end +local function watch(container) + for _, c in ipairs(container:GetChildren()) do + hookTool(c) + end + container.ChildAdded:Connect(hookTool) +end +player.ChildAdded:Connect(function(c) + if c:IsA("Backpack") then + watch(c) + end +end) +if player:FindFirstChild("Backpack") then + watch(player.Backpack) +end +player.CharacterAdded:Connect(function(char) + setState("idle") + watch(char) +end) +if player.Character then + watch(player.Character) +end + +RunService.RenderStepped:Connect(function(dt) + if state ~= "bite" then + return + end + mg.pos += mg.dir * mg.speed * dt + if mg.pos >= 1 then + mg.pos, mg.dir = 1, -1 + elseif mg.pos <= 0 then + mg.pos, mg.dir = 0, 1 + end + markerF.Position = UDim2.fromScale(mg.pos, 0.5) + local left = math.max(0, mg.deadline - os.clock()) + timeBar.Size = UDim2.new(left / mg.timeout, -30 * left / mg.timeout, 0, 5) + if left <= 0 then + setState("reeling") + remote:FireServer("Catch", false, mg.misses) + end +end) + +UserInputService.InputBegan:Connect(function(input, processed) + if processed then + return + end + local k = input.KeyCode + if k == Enum.KeyCode.B then + bagWin.toggle("fish") + elseif k == Enum.KeyCode.C then + bagWin.toggle("dex") + elseif k == Enum.KeyCode.M then + worldsWin.toggle() + elseif k == Enum.KeyCode.Q then + questWin.toggle() + end +end) + +---------------------------------------------------------------- атмосфера миров (только у этого игрока) + +local snowPart = new("Part", { + Name = "SnowFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, + Transparency = 1, Size = Vector3.new(90, 1, 90), Parent = workspace, +}) +local snow = new("ParticleEmitter", { + Rate = 0, Lifetime = NumberRange.new(5, 7), Speed = NumberRange.new(4, 7), + EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(15, 15), + Size = NumberSequence.new(0.25), Color = ColorSequence.new(WHITE), LightEmission = 0.3, + Parent = snowPart, +}) +local lastWorldId = "none" +local terrain = workspace.Terrain +local defaultWater = Color3.fromRGB(20, 95, 115) + +local function applyAmbience(world) + local clock = (world and world.clock) or 14.5 + TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play() + terrain.WaterColor = (world and world.water) or defaultWater + local atm = Lighting:FindFirstChildOfClass("Atmosphere") + if atm then + local frost = world and world.id == "World3" + TweenService:Create(atm, TweenInfo.new(2), { + Density = frost and 0.38 or 0.25, + Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), + }):Play() + end + snow.Rate = (world and world.id == "World3") and 140 or 0 +end + +task.spawn(function() + while true do + local w = currentWorld() + local id = w and w.id or "lobby" + if id ~= lastWorldId then + lastWorldId = id + applyAmbience(w) + if w then + notify(w.icon .. " " .. w.name, w.color) + end + end + local cam = workspace.CurrentCamera + if cam then + snowPart.CFrame = CFrame.new(cam.CFrame.Position + Vector3.new(0, 25, 0)) + end + -- баннер события + local evId = workspace:GetAttribute("Event") + local event = evId and Config.Find(Config.Events, evId) + if event then + eventBanner.Visible = true + eventTitle.Text = event.name .. " " .. timeStr((workspace:GetAttribute("EventEnds") or 0) - workspace:GetServerTimeNow()) + eventDesc.Text = event.desc + else + eventBanner.Visible = false + end + task.wait(0.5) + end +end) + +---------------------------------------------------------------- события от сервера + +remote.OnClientEvent:Connect(function(action, a, b, c) + if action == "Notify" then + notify(a, b) + elseif action == "Cast" then + setState("waiting") + elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then + setState("idle") + elseif action == "Bite" then + mg.speed = a.speed + mg.zoneWidth = a.zoneWidth + mg.need = a.hits + mg.hits = 0 + mg.misses = 0 + mg.maxMisses = a.misses + mg.timeout = a.timeout + mg.deadline = os.clock() + a.timeout + mg.pos, mg.dir = 0, 1 + placeZone() + updatePips() + setState("bite") + elseif action == "Caught" then + setState("idle") + showCatch(a, b) + playUiSound(DING, 0.5) + elseif action == "Sold" then + floatText("+" .. fmt(a) .. " 💰", C.gold) + notify(("Продано рыб: %d → +%s 💰"):format(b, fmt(a)), Color3.fromRGB(120, 255, 140)) + elseif action == "Inventory" then + inventory = a or {} + discovered = b or {} + claimed = c or {} + bagWin.refresh() + refreshDots() + elseif action == "Quests" then + quests = a or {} + daily = b or daily + questWin.refresh() + refreshDots() + elseif action == "OpenShop" then + shopWin.open("rods") + elseif action == "OpenQuests" then + questWin.open("daily") + elseif action == "OpenRobux" then + robuxWin.open(a) + end +end) + +remote:FireServer("RequestInventory") +]=====]) +print('ГОТОВО! Все 5 скриптов установлены. Нажми Play (F5).') diff --git a/src/ReplicatedStorage/FishConfig.lua b/src/ReplicatedStorage/FishConfig.lua new file mode 100644 index 0000000..901ae13 --- /dev/null +++ b/src/ReplicatedStorage/FishConfig.lua @@ -0,0 +1,305 @@ +-- FishConfig (ModuleScript) -> ReplicatedStorage +-- Все настройки игры. Меняй цифры здесь, чтобы настроить баланс. + +local Config = {} + +Config.GameName = "Клёвое место" + +---------------------------------------------------------------- миры +-- center = центр мира на карте; mult = множитель наград коллекции +Config.Worlds = { + { + id = "World1", name = "Тихое озеро", icon = "🌊", level = 1, mult = 1, + center = Vector3.new(0, 0, 1500), color = Color3.fromRGB(60, 200, 255), + desc = "Спокойное лесное озеро. Отличное место, чтобы начать.", + clock = 14.5, water = Color3.fromRGB(20, 95, 115), + waterY = 0, + lakes = { { 0, 0, 55 }, { -45, 15, 40 }, { 45, -10, 42 }, { 10, -42, 34 }, { -22, 40, 28 } }, -- { x, z, радиус } от центра + }, + { + id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4, + center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70), + desc = "Бирюзовое море, пальмы и яркая рифовая рыба.", + clock = 13, water = Color3.fromRGB(35, 175, 185), + waterY = 0, + sea = 119, -- всё дальше этого радиуса от центра — море + }, + { + id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12, + center = Vector3.new(-1500, 0, 0), color = Color3.fromRGB(150, 220, 255), + desc = "Рыбалка в лунках среди льдов и северного сияния.", + clock = 18.3, water = Color3.fromRGB(25, 70, 100), + waterY = 1, + lakes = { { 0, 0, 70 }, { -55, 30, 45 }, { 55, -25, 50 }, { 5, -70, 40 } }, -- подо льдом + holes = { + { 0, 40 }, { -22, 18 }, { 22, 12 }, { 0, -12 }, { -30, -30 }, { 30, 40 }, { -60, 35 }, + { -45, 15 }, { 55, -25 }, { 75, -5 }, { 40, -50 }, { 5, -75 }, { -15, -60 }, { 25, -80 }, + }, + holeRadius = 6, + }, + { + id = "World4", name = "Вулкан", icon = "🌋", level = 30, mult = 30, soon = true, + center = Vector3.new(0, 0, -1500), color = Color3.fromRGB(255, 90, 40), + desc = "Рыбалка в лаве. Скоро!", + }, +} +Config.WorldRadius = 260 + +function Config.WorldAt(pos) + for _, w in ipairs(Config.Worlds) do + if not w.soon then + local d = Vector3.new(pos.X - w.center.X, 0, pos.Z - w.center.Z).Magnitude + if d < Config.WorldRadius then + return w + end + end + end + return nil +end + +-- есть ли вода в этой точке мира (озеро, море или лунка) +function Config.IsWater(world, pos) + if not world then + return false + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + if world.holes then + local r = world.holeRadius or 6 + for _, h in ipairs(world.holes) do + if (x - h[1]) ^ 2 + (z - h[2]) ^ 2 <= r * r then + return true + end + end + return false + end + if world.sea and math.sqrt(x * x + z * z) >= world.sea then + return true + end + for _, l in ipairs(world.lakes or {}) do + if (x - l[1]) ^ 2 + (z - l[2]) ^ 2 <= (l[3] - 1) ^ 2 then + return true + end + end + return false +end + +---------------------------------------------------------------- редкости +Config.Rarities = { + Common = { name = "Обычная", rank = 1, weight = 55, color = Color3.fromRGB(215, 220, 225) }, + Uncommon = { name = "Необычная", rank = 2, weight = 27, color = Color3.fromRGB(95, 225, 115) }, + Rare = { name = "Редкая", rank = 3, weight = 11, color = Color3.fromRGB(70, 160, 255) }, + Epic = { name = "Эпическая", rank = 4, weight = 4.5, color = Color3.fromRGB(185, 90, 255) }, + Legendary = { name = "Легендарная", rank = 5, weight = 1.2, color = Color3.fromRGB(255, 185, 35) }, + Mythic = { name = "Мифическая", rank = 6, weight = 0.25, color = Color3.fromRGB(255, 80, 150) }, +} +Config.RarityOrder = { "Common", "Uncommon", "Rare", "Epic", "Legendary", "Mythic" } + +---------------------------------------------------------------- мутации +Config.Mutations = { + { id = "Rainbow", name = "Радужная", chance = 0.002, mult = 10, color = Color3.fromRGB(255, 120, 230) }, + { id = "Golden", name = "Золотая", chance = 0.010, mult = 5, color = Color3.fromRGB(255, 205, 60) }, + { id = "Shiny", name = "Блестящая", chance = 0.040, mult = 2, color = Color3.fromRGB(170, 240, 255) }, +} + +---------------------------------------------------------------- рыба +-- shape: classic, long, tall, flat, ray, puffer, shark, eel, sword, angler, jelly, sturgeon +-- color2 = второй цвет (плавники/узор); stripes/spots/whiskers/spikes/glow — украшения модели +local function F(t) + return t +end + +Config.Zones = { + World1 = { + fish = { + F({ id = "Karas", name = "Карась", rarity = "Common", price = 5, xp = 8, minW = 0.2, maxW = 1.2, size = 1.0, shape = "tall", color = Color3.fromRGB(205, 170, 75), color2 = Color3.fromRGB(170, 120, 50) }), + F({ id = "Plotva", name = "Плотва", rarity = "Common", price = 6, xp = 8, minW = 0.1, maxW = 0.8, size = 0.9, shape = "classic", color = Color3.fromRGB(195, 200, 210), color2 = Color3.fromRGB(220, 80, 60) }), + F({ id = "Ersh", name = "Ёрш", rarity = "Common", price = 7, xp = 9, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(135, 125, 75), color2 = Color3.fromRGB(95, 85, 50), spikes = true, spots = 6 }), + F({ id = "Okun", name = "Окунь", rarity = "Uncommon", price = 15, xp = 18, minW = 0.3, maxW = 1.5, size = 1.0, shape = "classic", color = Color3.fromRGB(150, 180, 70), color2 = Color3.fromRGB(230, 90, 40), stripes = 5, spikes = true }), + F({ id = "Lesh", name = "Лещ", rarity = "Uncommon", price = 18, xp = 20, minW = 0.5, maxW = 3.0, size = 1.2, shape = "tall", color = Color3.fromRGB(175, 145, 95), color2 = Color3.fromRGB(120, 95, 60) }), + F({ id = "Lin", name = "Линь", rarity = "Uncommon", price = 20, xp = 22, minW = 0.4, maxW = 2.5, size = 1.1, shape = "classic", color = Color3.fromRGB(95, 125, 55), color2 = Color3.fromRGB(60, 85, 35) }), + F({ id = "Shuka", name = "Щука", rarity = "Rare", price = 45, xp = 45, minW = 1.0, maxW = 8.0, size = 1.5, shape = "long", color = Color3.fromRGB(110, 140, 85), color2 = Color3.fromRGB(200, 210, 150), spots = 12 }), + F({ id = "Sudak", name = "Судак", rarity = "Rare", price = 50, xp = 48, minW = 1.0, maxW = 6.0, size = 1.4, shape = "long", color = Color3.fromRGB(165, 165, 135), color2 = Color3.fromRGB(80, 80, 70), stripes = 6, spikes = true }), + F({ id = "Som", name = "Сом", rarity = "Epic", price = 130, xp = 110, minW = 5.0, maxW = 40, size = 2.0, shape = "long", color = Color3.fromRGB(75, 75, 90), color2 = Color3.fromRGB(180, 175, 160), whiskers = true }), + F({ id = "Koi", name = "Карп кои", rarity = "Epic", price = 150, xp = 120, minW = 2.0, maxW = 9.0, size = 1.4, shape = "classic", color = Color3.fromRGB(250, 245, 240), color2 = Color3.fromRGB(240, 110, 40), spots = 7, whiskers = true }), + F({ id = "Gold", name = "Золотая рыбка", rarity = "Legendary", price = 500, xp = 350, minW = 0.1, maxW = 0.5, size = 0.9, shape = "classic", color = Color3.fromRGB(255, 195, 40), color2 = Color3.fromRGB(255, 120, 30), glow = true, bigTail = true }), + F({ id = "Crystal", name = "Хрустальный осётр", rarity = "Mythic", price = 2000, xp = 900, minW = 10, maxW = 60, size = 2.0, shape = "sturgeon", color = Color3.fromRGB(150, 230, 255), color2 = Color3.fromRGB(230, 250, 255), glow = true, glass = true }), + }, + }, + World2 = { + fish = { + F({ id = "Clown", name = "Рыба-клоун", rarity = "Common", price = 18, xp = 18, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(255, 120, 30), color2 = Color3.fromRGB(255, 255, 255), stripes = 3 }), + F({ id = "Sergeant", name = "Рыба-сержант", rarity = "Common", price = 20, xp = 18, minW = 0.2, maxW = 0.9, size = 0.9, shape = "tall", color = Color3.fromRGB(240, 230, 110), color2 = Color3.fromRGB(40, 40, 45), stripes = 5 }), + F({ id = "Mullet", name = "Барабулька", rarity = "Common", price = 22, xp = 20, minW = 0.1, maxW = 0.6, size = 0.9, shape = "classic", color = Color3.fromRGB(235, 110, 100), color2 = Color3.fromRGB(255, 220, 120), whiskers = true }), + F({ id = "Angel", name = "Рыба-ангел", rarity = "Uncommon", price = 45, xp = 40, minW = 0.3, maxW = 1.5, size = 1.0, shape = "tall", color = Color3.fromRGB(60, 120, 230), color2 = Color3.fromRGB(255, 220, 40), stripes = 4, bigFins = true }), + F({ id = "Puffer", name = "Иглобрюх", rarity = "Uncommon", price = 50, xp = 42, minW = 0.3, maxW = 2.0, size = 1.0, shape = "puffer", color = Color3.fromRGB(230, 205, 140), color2 = Color3.fromRGB(110, 90, 60), spots = 10 }), + F({ id = "Parrot", name = "Рыба-попугай", rarity = "Uncommon", price = 55, xp = 45, minW = 1.0, maxW = 5.0, size = 1.2, shape = "classic", color = Color3.fromRGB(60, 210, 190), color2 = Color3.fromRGB(240, 90, 180), spots = 5 }), + F({ id = "Ray", name = "Скат", rarity = "Rare", price = 120, xp = 90, minW = 3.0, maxW = 25, size = 1.6, shape = "ray", color = Color3.fromRGB(110, 115, 140), color2 = Color3.fromRGB(230, 230, 240), spots = 14 }), + F({ id = "Barracuda", name = "Барракуда", rarity = "Rare", price = 130, xp = 95, minW = 2.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(175, 185, 200), color2 = Color3.fromRGB(60, 70, 85), stripes = 8 }), + F({ id = "Swordfish", name = "Рыба-меч", rarity = "Epic", price = 350, xp = 220, minW = 30, maxW = 200, size = 2.0, shape = "sword", color = Color3.fromRGB(55, 75, 130), color2 = Color3.fromRGB(200, 210, 230) }), + F({ id = "Moray", name = "Мурена", rarity = "Epic", price = 320, xp = 210, minW = 2.0, maxW = 15, size = 1.8, shape = "eel", color = Color3.fromRGB(80, 140, 60), color2 = Color3.fromRGB(230, 220, 90), spots = 12 }), + F({ id = "Shark", name = "Рифовая акула", rarity = "Legendary", price = 1200, xp = 700, minW = 40, maxW = 180, size = 2.4, shape = "shark", color = Color3.fromRGB(110, 125, 145), color2 = Color3.fromRGB(235, 235, 240) }), + F({ id = "SunJelly", name = "Солнечная медуза", rarity = "Mythic", price = 5000, xp = 2000, minW = 1.0, maxW = 8.0, size = 1.8, shape = "jelly", color = Color3.fromRGB(255, 200, 80), color2 = Color3.fromRGB(255, 120, 200), glow = true, glass = true }), + }, + }, + World3 = { + fish = { + F({ id = "Cod", name = "Треска", rarity = "Common", price = 55, xp = 40, minW = 1.0, maxW = 10, size = 1.2, shape = "classic", color = Color3.fromRGB(150, 150, 110), color2 = Color3.fromRGB(230, 225, 200), spots = 14, whiskers = true }), + F({ id = "Herring", name = "Сельдь", rarity = "Common", price = 50, xp = 38, minW = 0.2, maxW = 0.8, size = 0.9, shape = "long", color = Color3.fromRGB(150, 175, 205), color2 = Color3.fromRGB(70, 100, 140) }), + F({ id = "Capelin", name = "Мойва", rarity = "Common", price = 48, xp = 36, minW = 0.05, maxW = 0.2, size = 0.7, shape = "classic", color = Color3.fromRGB(170, 200, 190), color2 = Color3.fromRGB(80, 120, 110) }), + F({ id = "Flounder", name = "Камбала", rarity = "Uncommon", price = 140, xp = 90, minW = 0.5, maxW = 4.0, size = 1.2, shape = "flat", color = Color3.fromRGB(150, 125, 90), color2 = Color3.fromRGB(230, 120, 60), spots = 10 }), + F({ id = "Redfish", name = "Морской окунь", rarity = "Uncommon", price = 150, xp = 92, minW = 0.5, maxW = 5.0, size = 1.1, shape = "classic", color = Color3.fromRGB(225, 70, 60), color2 = Color3.fromRGB(255, 160, 120), spikes = true }), + F({ id = "Char", name = "Арктический голец", rarity = "Uncommon", price = 160, xp = 95, minW = 0.5, maxW = 6.0, size = 1.2, shape = "long", color = Color3.fromRGB(120, 130, 150), color2 = Color3.fromRGB(255, 130, 150), spots = 12 }), + F({ id = "Halibut", name = "Палтус", rarity = "Rare", price = 380, xp = 200, minW = 5.0, maxW = 90, size = 1.9, shape = "flat", color = Color3.fromRGB(90, 95, 80), color2 = Color3.fromRGB(150, 150, 130), spots = 16 }), + F({ id = "Wolffish", name = "Морской волк", rarity = "Rare", price = 400, xp = 210, minW = 3.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(110, 120, 140), color2 = Color3.fromRGB(60, 65, 80), stripes = 7, teeth = true }), + F({ id = "Angler", name = "Удильщик", rarity = "Epic", price = 1100, xp = 500, minW = 5.0, maxW = 50, size = 1.6, shape = "angler", color = Color3.fromRGB(60, 50, 70), color2 = Color3.fromRGB(120, 255, 230), glow = true }), + F({ id = "IceEel", name = "Ледяная мурена", rarity = "Epic", price = 1000, xp = 480, minW = 3.0, maxW = 25, size = 1.9, shape = "eel", color = Color3.fromRGB(150, 210, 245), color2 = Color3.fromRGB(240, 250, 255), glass = true }), + F({ id = "Greenland", name = "Полярная акула", rarity = "Legendary", price = 3500, xp = 1500, minW = 200, maxW = 900, size = 2.6, shape = "shark", color = Color3.fromRGB(80, 90, 100), color2 = Color3.fromRGB(160, 170, 180) }), + F({ id = "Leviathan", name = "Ледяной левиафан", rarity = "Mythic", price = 15000, xp = 4000, minW = 500, maxW = 3000, size = 2.4, shape = "eel", color = Color3.fromRGB(110, 230, 255), color2 = Color3.fromRGB(200, 120, 255), glow = true, spikes = true }), + }, + }, +} + +---------------------------------------------------------------- удочки +-- luck = бонус удачи, speed = множитель ожидания клёва (меньше = быстрее), zone = ширина зелёной зоны +Config.Rods = { + { id = "Basic", name = "Старая удочка", price = 0, level = 1, luck = 0.00, speed = 1.00, zone = 0.22, upgradeCost = 40, style = "wood" }, + { id = "Bamboo", name = "Бамбуковая удочка", price = 150, level = 3, luck = 0.15, speed = 0.88, zone = 0.25, upgradeCost = 120, style = "bamboo" }, + { id = "Fiberglass", name = "Стеклопластиковая", price = 600, level = 5, luck = 0.30, speed = 0.78, zone = 0.27, upgradeCost = 300, style = "glass" }, + { id = "Carbon", name = "Карбоновая удочка", price = 1800, level = 8, luck = 0.55, speed = 0.68, zone = 0.29, upgradeCost = 700, style = "carbon" }, + { id = "Coral", name = "Коралловая удочка", price = 4500, level = 10, luck = 0.80, speed = 0.62, zone = 0.31, upgradeCost = 1300, style = "coral" }, + { id = "Golden", name = "Золотая удочка", price = 9000, level = 13, luck = 1.00, speed = 0.56, zone = 0.33, upgradeCost = 2200, style = "gold" }, + { id = "Frost", name = "Ледяная удочка", price = 25000, level = 18, luck = 1.40, speed = 0.50, zone = 0.35, upgradeCost = 5000, style = "frost" }, + { id = "Legend", name = "Удочка Легенды", price = 75000, level = 25, luck = 2.00, speed = 0.42, zone = 0.38, upgradeCost = 12000, style = "legend" }, +} + +Config.RodUpgrade = { maxLevel = 5, luckPerLevel = 0.08, zonePerLevel = 0.012, speedPerLevel = 0.96 } +function Config.UpgradeCost(rod, currentLevel) + return math.floor(rod.upgradeCost * (currentLevel + 1) ^ 1.5) +end + +---------------------------------------------------------------- сумки +Config.Bags = { + { id = "Pouch", name = "Холщовая сумка", price = 0, level = 1, capacity = 12, color = Color3.fromRGB(170, 140, 95) }, + { id = "Satchel", name = "Сумка рыбака", price = 150, level = 2, capacity = 25, color = Color3.fromRGB(110, 140, 80) }, + { id = "Backpack", name = "Туристический рюкзак", price = 700, level = 4, capacity = 45, color = Color3.fromRGB(60, 110, 180) }, + { id = "BigNet", name = "Огромный садок", price = 2500, level = 7, capacity = 80, color = Color3.fromRGB(200, 80, 50) }, + { id = "Chest", name = "Сундук за спиной", price = 9000, level = 12, capacity = 140, color = Color3.fromRGB(140, 90, 50) }, + { id = "Magic", name = "Магический мешок", price = 30000, level = 20, capacity = 250, color = Color3.fromRGB(120, 60, 200) }, +} + +---------------------------------------------------------------- удача +Config.LuckPerPlayerLevel = 0.02 -- +2% за уровень игрока +Config.MasteryLuck = 0.10 -- +10% навсегда за полностью собранный мир +Config.Potions = { + { id = "Luck1", name = "Зелье удачи", price = 120, bonus = 0.5, duration = 300, color = Color3.fromRGB(90, 230, 120) }, + { id = "Luck2", name = "Большое зелье удачи", price = 450, bonus = 1.0, duration = 600, color = Color3.fromRGB(255, 200, 60), level = 5 }, + { id = "Luck3", name = "Эликсир фортуны", price = 2500, bonus = 2.0, duration = 600, color = Color3.fromRGB(200, 120, 255), level = 12 }, +} + +---------------------------------------------------------------- коллекция +-- награда за то, что поймал ВСЕ виды одной редкости в мире (умножается на mult мира) +Config.CollectionRewards = { + Common = { coins = 50, xp = 40 }, + Uncommon = { coins = 120, xp = 100 }, + Rare = { coins = 300, xp = 250 }, + Epic = { coins = 800, xp = 600 }, + Legendary = { coins = 2000, xp = 1500 }, + Mythic = { coins = 6000, xp = 4000 }, +} +Config.MasteryCoins = 5000 -- за весь мир (тоже умножается на mult) + +---------------------------------------------------------------- задания +-- coins/xp = награда за 1 единицу цели (умножается на цель и уровень игрока) +Config.Quests = { + { kind = "catch", text = "Поймай %d рыб", goals = { 10, 20, 35 }, coins = 6, xp = 5 }, + { kind = "rare", text = "Поймай %d рыб редкости «Редкая» и выше", goals = { 1, 2, 3 }, coins = 60, xp = 50 }, + { kind = "epic", text = "Поймай эпическую рыбу или реже", goals = { 1 }, coins = 250, xp = 200 }, + { kind = "mutation", text = "Поймай рыбу с мутацией", goals = { 1 }, coins = 200, xp = 150 }, + { kind = "earn", text = "Заработай %d монет на продаже", goals = { 200, 600, 1500 }, coins = 0.25, xp = 0.2 }, + { kind = "perfect", text = "Сделай %d идеальных подсечек (без промаха)", goals = { 5, 10, 15 }, coins = 15, xp = 12 }, +} +Config.QuestSlots = 3 + +-- ежедневная награда (7 дней по кругу), монеты растут с уровнем +Config.DailyRewards = { + { coins = 100 }, + { coins = 200 }, + { coins = 300, potion = "Luck1" }, + { coins = 450 }, + { coins = 600, potion = "Luck1" }, + { coins = 800 }, + { coins = 1500, potion = "Luck2" }, +} + +---------------------------------------------------------------- события на сервере +Config.Events = { + { id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 }, + { id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 }, + { id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 }, + { id = "Fair", name = "💰 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 }, +} +Config.EventFirstDelay = 120 +Config.EventGapMin = 420 +Config.EventGapMax = 720 + +---------------------------------------------------------------- донат (Robux) +-- ВАЖНО: впиши сюда ID своих пропусков и товаров с create.roblox.com. +-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен. +Config.GamePasses = { + { key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и монет, корона над головой" }, + { key = "DoubleCoins", id = 0, robux = 299, icon = "💰", name = "x2 Монеты", desc = "Вся рыба продаётся в 2 раза дороже" }, + { key = "LuckyCharm", id = 0, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" }, + { key = "BigBag", id = 0, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" }, +} +Config.Products = { + { key = "Coins1", id = 0, robux = 49, icon = "🪙", name = "Мешок монет", desc = "+1 000 монет (больше с уровнем)", coins = 1000 }, + { key = "Coins2", id = 0, robux = 199, icon = "💰", name = "Сундук монет", desc = "+5 000 монет (больше с уровнем)", coins = 5000 }, + { key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 монет (больше с уровнем)", coins = 20000 }, + { key = "Luck", id = 0, robux = 99, icon = "🧪", name = "Супер-зелье удачи", desc = "+200% удачи на 15 минут", boost = 2.0, duration = 900 }, +} + +---------------------------------------------------------------- рыбалка +Config.BiteTimeMin = 3 +Config.BiteTimeMax = 7 +Config.BiteTimeout = 12 +Config.MaxMisses = 2 +function Config.HitsNeeded(rank) + return math.ceil(rank / 2) +end +function Config.XPForLevel(level) + return 60 + level * 60 +end + +---------------------------------------------------------------- помощники +function Config.Find(list, id) + for _, item in ipairs(list) do + if item.id == id or item.key == id then + return item + end + end + return nil +end + +function Config.FindFish(fishId) + for zoneId, zone in pairs(Config.Zones) do + for _, f in ipairs(zone.fish) do + if f.id == fishId then + return f, zoneId + end + end + end + return nil +end + +function Config.RodStats(rodId, upgradeLevel) + local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1] + local u = Config.RodUpgrade + upgradeLevel = upgradeLevel or 0 + return { + luck = rod.luck + u.luckPerLevel * upgradeLevel, + speed = rod.speed * (u.speedPerLevel ^ upgradeLevel), + zone = rod.zone + u.zonePerLevel * upgradeLevel, + } +end + +return Config diff --git a/src/ReplicatedStorage/GameModels.lua b/src/ReplicatedStorage/GameModels.lua new file mode 100644 index 0000000..65feee0 --- /dev/null +++ b/src/ReplicatedStorage/GameModels.lua @@ -0,0 +1,559 @@ +-- GameModels (ModuleScript) -> ReplicatedStorage +-- Строит 3D-модели из деталей: удочки, сумки, рыбу, поплавок. +-- Используется сервером (инструмент, витрины, рыба в руках) и клиентом (иконки). + +local Config = require(script.Parent:WaitForChild("FishConfig")) + +local M = {} +local V = Vector3.new +local SP, NEON, METAL, GLASS = Enum.Material.SmoothPlastic, Enum.Material.Neon, Enum.Material.Metal, Enum.Material.Glass + +---------------------------------------------------------------- помощники + +local function newPart(parent, props, class) + local p = Instance.new(class or "Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = false + p.CanCollide = false + p.CanQuery = false + p.CanTouch = false + p.Massless = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + p.Material = SP + for k, v in pairs(props) do + if k ~= "Shape" then + p[k] = v + end + end + p.Parent = parent + return p +end + +local function cyl(parent, a, b, dia, props) + props = props or {} + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.02, (b - a).Magnitude), dia, dia) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return newPart(parent, props) +end + +local function ball(parent, pos, dia, props) + props = props or {} + props.Shape = Enum.PartType.Ball + props.Size = V(dia, dia, dia) + props.CFrame = CFrame.new(pos) + return newPart(parent, props) +end + +local function oval(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + local p = newPart(parent, props) + local mesh = Instance.new("SpecialMesh") + mesh.MeshType = Enum.MeshType.Sphere + mesh.Parent = p + return p +end + +local function block(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + return newPart(parent, props) +end + +local function wedge(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + return newPart(parent, props, "WedgePart") +end + +local function finish(model, root, anchored) + for _, p in ipairs(model:GetDescendants()) do + if p:IsA("BasePart") and p ~= root then + local w = Instance.new("Weld") + w.Part0 = root + w.Part1 = p + w.C0 = root.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Anchored = anchored and true or false + end + end + root.Anchored = anchored and true or false + model.PrimaryPart = root + return model +end + +local function lighten(c, t) + return c:Lerp(Color3.new(1, 1, 1), t) +end +local function darken(c, t) + return c:Lerp(Color3.new(0, 0, 0), t) +end +local function C(r, g, b) + return Color3.fromRGB(r, g, b) +end + +local function sparkles(parent, color, rate) + local att = Instance.new("Attachment") + att.Parent = parent + local pe = Instance.new("ParticleEmitter") + pe.Texture = "rbxasset://textures/particles/sparkles_main.dds" + pe.Rate = rate or 6 + pe.Lifetime = NumberRange.new(0.6, 1.0) + pe.Speed = NumberRange.new(0.5, 1) + pe.Size = NumberSequence.new(0.25, 0) + pe.LightEmission = 1 + pe.Color = ColorSequence.new(color) + pe.Parent = att + return pe +end + +---------------------------------------------------------------- удочки +-- Рука в (0,0,0), удочка смотрит в -Z и изгибается вверх (+Y). + +local STYLES = { + wood = { blank = C(125, 90, 60), mat = Enum.Material.Wood, grip = C(80, 55, 35), gripMat = Enum.Material.Fabric, wrap = C(175, 175, 175), reel = C(95, 95, 100) }, + bamboo = { blank = C(215, 190, 105), mat = Enum.Material.Wood, grip = C(120, 90, 50), gripMat = Enum.Material.Fabric, wrap = C(70, 120, 60), reel = C(85, 85, 90), nodes = C(150, 120, 60) }, + glass = { blank = C(60, 130, 215), mat = SP, grip = C(35, 35, 40), gripMat = Enum.Material.Fabric, wrap = C(240, 240, 245), reel = C(60, 60, 70) }, + carbon = { blank = C(30, 30, 35), mat = SP, grip = C(195, 155, 105), gripMat = Enum.Material.Sand, wrap = C(220, 50, 50), reel = C(45, 45, 50) }, + coral = { blank = C(255, 130, 110), blank2 = C(255, 225, 210), mat = SP, grip = C(40, 170, 170), gripMat = Enum.Material.Fabric, wrap = C(40, 200, 200), reel = C(240, 240, 235), gem = C(255, 120, 160) }, + gold = { blank = C(255, 200, 50), mat = METAL, grip = C(120, 30, 30), gripMat = Enum.Material.Fabric, wrap = C(255, 255, 255), reel = C(230, 180, 50), gem = C(255, 40, 60), sparkle = C(255, 220, 90) }, + frost = { blank = C(170, 225, 255), mat = GLASS, grip = C(230, 240, 250), gripMat = Enum.Material.Fabric, wrap = C(90, 170, 255), reel = C(200, 230, 250), gem = C(120, 240, 255), sparkle = C(170, 240, 255) }, + legend = { blank = C(60, 25, 90), blank2 = C(110, 50, 170), mat = SP, grip = C(25, 20, 35), gripMat = Enum.Material.Fabric, wrap = C(255, 200, 60), wrapNeon = true, reel = C(40, 30, 60), gem = C(255, 90, 220), sparkle = C(255, 150, 240) }, +} + +function M.buildRod(rodId, upgradeLevel, anchored) + local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1] + local st = STYLES[rod.style] or STYLES.wood + upgradeLevel = upgradeLevel or 0 + local model = Instance.new("Model") + model.Name = rod.name + + local handle = newPart(model, { Name = "Handle", Size = V(0.3, 0.3, 1.8), CFrame = CFrame.new(), Transparency = 1 }) + local wrapMat = (st.wrapNeon or upgradeLevel >= 5) and NEON or METAL + local back = V(0, 0, 1) + + -- торец и камень + ball(model, V(0, 0, 1.05), 0.42, { Color = st.reel, Material = METAL }) + if st.gem then + ball(model, V(0, 0, 1.25), 0.26, { Color = st.gem, Material = NEON }) + end + -- задняя рукоять: кольца (пробка/обмотка) + for i = 0, 6 do + local z0 = 1.0 - i * 0.185 + cyl(model, V(0, 0, z0), V(0, 0, z0 - 0.185), i % 2 == 0 and 0.34 or 0.33, { + Color = i % 2 == 0 and st.grip or darken(st.grip, 0.12), Material = st.gripMat, + }) + end + -- катушкодержатель + cyl(model, V(0, 0, -0.3), V(0, 0, -0.95), 0.27, { Color = st.reel, Material = METAL }) + cyl(model, V(0, 0, -0.3), V(0, 0, -0.42), 0.32, { Color = st.wrap, Material = wrapMat }) + cyl(model, V(0, 0, -0.83), V(0, 0, -0.95), 0.32, { Color = st.wrap, Material = wrapMat }) + -- передняя рукоять + cyl(model, V(0, 0, -0.95), V(0, 0, -1.45), 0.29, { Color = st.grip, Material = st.gripMat }) + cyl(model, V(0, 0, -1.45), V(0, 0, -1.55), 0.25, { Color = st.wrap, Material = wrapMat }) + + -- катушка (безынерционная): ножка, корпус, шпуля, дужка, ручка + block(model, V(0.1, 0.42, 0.22), CFrame.new(0, -0.3, -0.62), { Color = st.reel, Material = METAL }) + oval(model, V(0.46, 0.5, 0.7), CFrame.new(0, -0.68, -0.58), { Color = st.reel, Material = METAL }) + local spoolCF = CFrame.new(0, -0.68, -1.02) * CFrame.Angles(0, math.rad(90), 0) + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.34, 0.44, 0.44), CFrame = spoolCF, Color = C(235, 235, 230), Material = SP }) + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.06, 0.5, 0.5), CFrame = spoolCF * CFrame.new(0.18, 0, 0), Color = st.wrap, Material = wrapMat }) + local bail = {} + for i = 0, 6 do + local a = math.rad(200 + i * 23) + table.insert(bail, V(math.cos(a) * 0.3, -0.68 + math.sin(a) * 0.3, -1.2)) + end + for i = 1, #bail - 1 do + cyl(model, bail[i], bail[i + 1], 0.04, { Color = C(200, 200, 205), Material = METAL }) + end + cyl(model, V(0.24, -0.68, -0.58), V(0.5, -0.86, -0.58), 0.07, { Color = st.reel, Material = METAL }) + ball(model, V(0.54, -0.9, -0.5), 0.19, { Color = st.grip, Material = SP }) + + -- бланк: 8 колен с плавным изгибом и шарами на стыках + local angles = { 6, 9, 12, 16, 20, 25, 30, 36 } + local lengths = { 1.2, 1.15, 1.1, 1.0, 0.95, 0.9, 0.85, 0.8 } + local p = V(0, 0, -1.55) + local lastSeg + for i = 1, #angles do + local a = math.rad(angles[i]) + local d = V(0, math.sin(a), -math.cos(a)) + local q = p + d * lengths[i] + local dia = 0.2 - (i - 1) * 0.019 + local color = (st.blank2 and i % 2 == 0) and st.blank2 or st.blank + lastSeg = cyl(model, p, q, dia, { Color = color, Material = st.mat }) + ball(model, q, dia * 0.97, { Color = color, Material = st.mat }) + if st.nodes then + cyl(model, q - d * 0.04, q + d * 0.04, dia + 0.05, { Color = st.nodes, Material = Enum.Material.Wood }) + end + -- полоски улучшений на первых коленах + if i <= 2 then + for s = 1, upgradeLevel do + if (s <= 3 and i == 1) or (s > 3 and i == 2) then + local t = 0.25 + ((s - 1) % 3) * 0.22 + local c = p:Lerp(q, t) + cyl(model, c - d * 0.035, c + d * 0.035, dia + 0.045, { Color = C(255, 215, 80), Material = NEON }) + end + end + end + -- пропускные кольца на чётных стыках + if i % 2 == 0 then + local n = V(0, d.Z, -d.Y) -- вниз, перпендикулярно бланку + local ringD = 0.24 - i * 0.017 + cyl(model, q - d * 0.06, q + d * 0.06, dia + 0.05, { Color = st.wrap, Material = wrapMat }) + cyl(model, q, q + n * 0.12, 0.035, { Color = C(200, 200, 205), Material = METAL }) + local c = q + n * (0.12 + ringD / 2) + newPart(model, { + Shape = Enum.PartType.Cylinder, Size = V(0.03, ringD, ringD), + CFrame = CFrame.lookAt(c, c + d) * CFrame.Angles(0, math.rad(90), 0), + Color = C(205, 205, 210), Material = METAL, + }) + end + p = q + end + ball(model, p, 0.09, { Color = st.wrap, Material = wrapMat }) + + local tip = Instance.new("Attachment") + tip.Name = "Tip" + tip.Position = p + tip.Parent = handle + local lineStart = Instance.new("Attachment") + lineStart.Name = "LineStart" + lineStart.Position = V(0, -0.68, -1.2) + lineStart.Parent = handle + local line = Instance.new("Beam") + line.Attachment0 = lineStart + line.Attachment1 = tip + line.Width0 = 0.025 + line.Width1 = 0.02 + line.FaceCamera = true + line.Color = ColorSequence.new(C(245, 245, 245)) + line.Parent = handle + + if upgradeLevel >= 3 or st.sparkle then + sparkles(lastSeg, st.sparkle or st.wrap, 6) + end + return finish(model, handle, anchored) +end + +---------------------------------------------------------------- сумки на спину +-- Корень "Root" у спины; +Z = от спины назад. + +local BAG_SIZES = { + Pouch = V(1.3, 1.3, 0.6), + Satchel = V(1.5, 1.5, 0.7), + Backpack = V(1.7, 2.0, 0.9), + BigNet = V(1.9, 2.2, 1.0), + Chest = V(2.0, 1.6, 1.2), + Magic = V(1.8, 2.2, 1.1), +} + +function M.buildBag(bagId, anchored) + local bag = Config.Find(Config.Bags, bagId) or Config.Bags[1] + local s = BAG_SIZES[bag.id] or BAG_SIZES.Pouch + local model = Instance.new("Model") + model.Name = "BackBag" + local root = newPart(model, { Name = "Root", Size = V(0.2, 0.2, 0.2), CFrame = CFrame.new(), Transparency = 1 }) + + if bag.id == "Chest" then + block(model, V(s.X, s.Y * 0.7, s.Z), CFrame.new(0, -s.Y * 0.15, s.Z / 2), { Color = bag.color, Material = Enum.Material.WoodPlanks }) + oval(model, V(s.X, s.Y * 0.6, s.Z), CFrame.new(0, s.Y * 0.2, s.Z / 2), { Color = darken(bag.color, 0.15), Material = Enum.Material.WoodPlanks }) + for _, x in ipairs({ -s.X * 0.35, s.X * 0.35 }) do + block(model, V(0.15, s.Y * 1.02, s.Z + 0.06), CFrame.new(x, 0, s.Z / 2), { Color = C(200, 170, 70), Material = METAL }) + end + block(model, V(0.35, 0.4, 0.1), CFrame.new(0, 0, s.Z + 0.05), { Color = C(230, 190, 70), Material = METAL }) + sparkles(root, C(255, 220, 90), 3) + return finish(model, root, anchored) + end + + oval(model, V(s.X, s.Y, s.Z * 1.1), CFrame.new(0, 0, s.Z / 2), { Color = bag.color, Material = Enum.Material.Fabric }) + block(model, V(s.X * 0.95, s.Y * 0.3, s.Z * 0.9), CFrame.new(0, s.Y * 0.33, s.Z / 2), { Color = darken(bag.color, 0.25), Material = Enum.Material.Fabric }) + block(model, V(s.X * 0.6, s.Y * 0.32, 0.16), CFrame.new(0, -s.Y * 0.15, s.Z + 0.04), { Color = darken(bag.color, 0.12), Material = Enum.Material.Fabric }) + block(model, V(0.26, 0.2, 0.06), CFrame.new(0, s.Y * 0.2, s.Z * 0.98), { Color = C(230, 190, 70), Material = METAL }) + for _, x in ipairs({ -1, 1 }) do + block(model, V(0.16, s.Y * 0.9, 0.06), CFrame.new(x * s.X * 0.3, 0, s.Z * 0.95), { Color = darken(bag.color, 0.35), Material = Enum.Material.Fabric }) + end + if bag.id == "Backpack" or bag.id == "BigNet" then + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(s.X + 0.1, 0.55, 0.55), CFrame = CFrame.new(0, s.Y / 2 + 0.15, s.Z / 2), Color = C(70, 120, 70), Material = Enum.Material.Fabric }) + end + if bag.id == "BigNet" then + oval(model, V(0.15, 0.7, 0.5), CFrame.new(0.4, s.Y / 2 + 0.5, s.Z * 0.6) * CFrame.Angles(0, 0, math.rad(15)), { Color = C(255, 190, 50) }) + end + if bag.id == "Magic" then + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.05, 0.7, 0.7), CFrame = CFrame.new(0, -0.1, s.Z + 0.06) * CFrame.Angles(0, math.rad(90), 0), Color = C(255, 150, 255), Material = NEON }) + sparkles(root, C(220, 150, 255), 5) + end + return finish(model, root, anchored) +end + +---------------------------------------------------------------- рыба +-- Голова смотрит в +X, спина в +Y, бок к зрителю в +Z. + +local function seededRng(id) + local n = 0 + for i = 1, #id do + n += string.byte(id, i) * i + end + return Random.new(n) +end + +-- полуширина эллипсоида (L,H,W) в точке x,y +local function halfWidth(L, H, W, x, y) + local k = 1 - (2 * x / L) ^ 2 - (2 * y / H) ^ 2 + return k > 0 and (W / 2) * math.sqrt(k) or 0 +end + +local function addEyes(model, x, y, zHalf, size) + for _, sgn in ipairs({ -1, 1 }) do + ball(model, V(x, y, sgn * zHalf), size, { Color = C(250, 250, 250) }) + ball(model, V(x + size * 0.12, y, sgn * (zHalf + size * 0.3)), size * 0.55, { Color = C(15, 15, 20) }) + end +end + +function M.buildFish(fishId, mutationId, scale, anchored) + local fish = Config.FindFish(fishId) or Config.Zones.World1.fish[1] + local s = (scale or 1) * fish.size + local c1, c2 = fish.color, fish.color2 or darken(fish.color, 0.3) + local mat = SP + local glow = fish.glow + if mutationId == "Golden" then + c1, c2, mat = C(255, 205, 60), C(230, 150, 30), METAL + elseif mutationId == "Shiny" then + c1, c2, glow = lighten(c1, 0.35), lighten(c2, 0.35), true + elseif mutationId == "Rainbow" then + c1, c2, glow = C(255, 120, 220), C(90, 230, 255), true + end + if fish.glass and not mutationId then + mat = GLASS + end + local finMat = glow and NEON or mat + local rng = seededRng(fish.id) + local model = Instance.new("Model") + model.Name = fish.name + local shape = fish.shape or "classic" + local root + + if shape == "flat" then + -- камбала: плоская, «верх» смотрит на зрителя (+Z) + root = oval(model, V(2 * s, 1.3 * s, 0.22 * s), CFrame.new(), { Name = "Body", Color = c1, Material = mat }) + oval(model, V(2.2 * s, 1.5 * s, 0.08 * s), CFrame.new(0, 0, -0.02 * s), { Color = darken(c1, 0.2), Material = finMat }) + oval(model, V(0.45 * s, 0.6 * s, 0.06 * s), CFrame.new(-1.15 * s, 0, 0), { Color = darken(c1, 0.2), Material = finMat }) + for i = 1, fish.spots or 0 do + local x, y = rng:NextNumber(-0.7, 0.7) * s, rng:NextNumber(-0.45, 0.45) * s + oval(model, V(0.14 * s, 0.14 * s, 0.05 * s), CFrame.new(x, y, 0.1 * s), { Color = c2 }) + end + ball(model, V(0.62 * s, 0.14 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) }) + ball(model, V(0.5 * s, -0.05 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) }) + ball(model, V(0.62 * s, 0.14 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) }) + ball(model, V(0.5 * s, -0.05 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) }) + return finish(model, root, anchored) + end + + if shape == "ray" then + root = block(model, V(1.5 * s, 1.5 * s, 0.14 * s), CFrame.Angles(0, 0, math.rad(45)), { Name = "Body", Color = c1, Material = mat }) + oval(model, V(1.4 * s, 0.9 * s, 0.32 * s), CFrame.new(0.1 * s, 0, 0.02 * s), { Color = c1, Material = mat }) + cyl(model, V(-0.9 * s, 0, 0), V(-2.4 * s, 0.1 * s, 0), 0.08 * s, { Color = darken(c1, 0.2), Material = mat }) + for i = 1, fish.spots or 0 do + ball(model, V(rng:NextNumber(-0.6, 0.6) * s, rng:NextNumber(-0.6, 0.6) * s, 0.12 * s), 0.1 * s, { Color = c2 }) + end + ball(model, V(0.45 * s, 0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) }) + ball(model, V(0.45 * s, -0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) }) + return finish(model, root, anchored) + end + + if shape == "eel" then + local n, L = 10, 3.4 * s + local seg = L / n + local prev + for i = 0, n - 1 do + local x = L / 2 - i * seg + local y = math.sin(i * 0.8) * 0.22 * s + local d = (0.5 - i * 0.035) * s + local part = oval(model, V(seg * 1.7, d, d * 0.85), CFrame.new(x, y, 0), { Color = c1, Material = mat, Name = i == 0 and "Body" or "Seg" }) + if i == 0 then + root = part + end + if i > 0 then + oval(model, V(seg * 1.4, d * 0.5, d * 0.2), CFrame.new(x, y + d * 0.45, 0), { Color = c2, Material = finMat }) + if fish.spikes and i % 2 == 0 then + block(model, V(0.06 * s, d * 0.6, 0.06 * s), CFrame.new(x, y + d * 0.75, 0), { Color = c2, Material = NEON }) + end + end + if fish.spots and i > 0 and i % 2 == 1 then + ball(model, V(x, y + d * 0.1, d * 0.4), d * 0.25, { Color = c2 }) + end + prev = part + end + addEyes(model, L / 2 + seg * 0.3, 0.12 * s, 0.17 * s, 0.13 * s) + oval(model, V(0.1 * s, 0.08 * s, 0.3 * s), CFrame.new(L / 2 + seg * 0.75, -0.08 * s, 0), { Color = C(30, 20, 20) }) + return finish(model, root, anchored) + end + + if shape == "jelly" then + root = oval(model, V(1.6 * s, 1.1 * s, 1.6 * s), CFrame.new(0, 0.35 * s, 0), { Name = "Body", Color = c1, Material = GLASS, Transparency = 0.2 }) + oval(model, V(0.8 * s, 0.5 * s, 0.8 * s), CFrame.new(0, 0.3 * s, 0), { Color = c2, Material = NEON }) + oval(model, V(1.75 * s, 0.14 * s, 1.75 * s), CFrame.new(0, -0.15 * s, 0), { Color = c2, Material = finMat }) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + local base = V(math.cos(a) * 0.6 * s, -0.15 * s, math.sin(a) * 0.6 * s) + local p1 = base + V(math.sin(i) * 0.15 * s, -0.7 * s, 0) + local p2 = p1 + V(-math.sin(i) * 0.2 * s, -0.7 * s, math.cos(i) * 0.1 * s) + cyl(model, base, p1, 0.07 * s, { Color = c2, Material = NEON }) + cyl(model, p1, p2, 0.05 * s, { Color = c1, Material = NEON }) + end + return finish(model, root, anchored) + end + + -- тело-эллипсоид для остальных форм + local L, H, W = 2 * s, 0.9 * s, 0.45 * s + if shape == "long" or shape == "sturgeon" then + L, H, W = 2.6 * s, 0.6 * s, 0.5 * s + elseif shape == "tall" then + L, H, W = 1.7 * s, 1.25 * s, 0.38 * s + elseif shape == "shark" then + L, H, W = 3 * s, 0.75 * s, 0.7 * s + elseif shape == "sword" then + L, H, W = 2.4 * s, 0.75 * s, 0.5 * s + elseif shape == "puffer" then + L, H, W = 1.4 * s, 1.3 * s, 1.3 * s + elseif shape == "angler" then + L, H, W = 1.6 * s, 1.3 * s, 1.1 * s + end + + root = oval(model, V(L, H, W), CFrame.new(), { Name = "Body", Color = c1, Material = mat }) + if shape ~= "puffer" and shape ~= "angler" then + oval(model, V(L * 0.82, H * 0.55, W * 1.03), CFrame.new(L * 0.03, -H * 0.2, 0), { Color = lighten(c1, 0.45), Material = mat }) + end + + -- хвост + if shape == "shark" then + oval(model, V(L * 0.25, H * 1.0, W * 0.12), CFrame.new(-L * 0.56, H * 0.32, 0) * CFrame.Angles(0, 0, math.rad(-35)), { Color = c1, Material = mat }) + oval(model, V(L * 0.17, H * 0.6, W * 0.12), CFrame.new(-L * 0.54, -H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(35)), { Color = c1, Material = mat }) + else + local th = fish.bigTail and 0.95 or 0.62 + oval(model, V(L * 0.22, H * 0.36, W * 0.5), CFrame.new(-L * 0.44, 0, 0), { Color = c1, Material = mat }) + for _, sgn in ipairs({ 1, -1 }) do + oval(model, V(L * 0.28, H * th, W * 0.14), CFrame.new(-L * 0.58, sgn * H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(-sgn * 32)), { Color = c2, Material = finMat }) + end + end + + -- спинной плавник + if shape == "shark" then + wedge(model, V(W * 0.14, H * 0.95, L * 0.2), CFrame.new(-L * 0.02, H * 0.78, 0) * CFrame.Angles(0, math.rad(-90), 0), { Color = c1, Material = mat }) + elseif shape == "sword" then + oval(model, V(L * 0.5, H * 1.2, W * 0.1), CFrame.new(L * 0.05, H * 0.65, 0), { Color = c2, Material = finMat }) + elseif shape ~= "puffer" then + local big = fish.bigFins and 1.8 or 1 + oval(model, V(L * 0.42, H * 0.45 * big, W * 0.12), CFrame.new(-L * 0.06, H * 0.4 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat }) + oval(model, V(L * 0.22, H * 0.3 * big, W * 0.1), CFrame.new(-L * 0.2, -H * 0.42 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat }) + end + if fish.spikes and shape ~= "puffer" then + for i = 0, 4 do + local x = -L * 0.2 + i * L * 0.08 + block(model, V(0.05 * s, H * 0.3, 0.05 * s), CFrame.new(x, H * 0.55, 0) * CFrame.Angles(0, 0, math.rad(-15)), { Color = darken(c2, 0.3) }) + end + end + -- грудные плавники + for _, sgn in ipairs({ -1, 1 }) do + oval(model, V(L * 0.2, H * 0.14, W * 0.06), CFrame.new(L * 0.12, -H * 0.15, sgn * W * 0.48) * CFrame.Angles(0, math.rad(sgn * 25), math.rad(-20)), { Color = c2, Material = finMat }) + end + + -- узоры + if fish.stripes then + for i = 1, fish.stripes do + local x = -L * 0.3 + (i - 0.5) * (L * 0.6 / fish.stripes) + local hh = (H / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2)) + local hw = (W / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2)) + oval(model, V(L * 0.06, hh * 2.04, hw * 2.08), CFrame.new(x, 0, 0), { Color = c2, Material = mat }) + end + end + if fish.spots then + for i = 1, fish.spots do + local x = rng:NextNumber(-0.35, 0.3) * L + local y = rng:NextNumber(-0.1, 0.35) * H + local z = halfWidth(L, H, W, x, y) + if z > 0 then + local sgn = (i % 2 == 0) and 1 or -1 + ball(model, V(x, y, sgn * z * 0.96), 0.13 * s, { Color = c2 }) + end + end + end + + -- глаза и рот + local ex, ey = L * 0.32, H * 0.12 + local ez = halfWidth(L, H, W, ex, ey) + local eyeSize = (shape == "puffer") and H * 0.3 or ((shape == "angler") and H * 0.14 or math.max(0.12 * s, H * 0.22)) + addEyes(model, ex, ey, ez * 0.92, eyeSize) + if shape == "angler" then + oval(model, V(L * 0.12, H * 0.5, W * 0.85), CFrame.new(L * 0.46, -H * 0.12, 0), { Color = C(25, 15, 20) }) + for i = -2, 2 do + wedge(model, V(0.05 * s, 0.16 * s, 0.06 * s), CFrame.new(L * 0.5, H * 0.08, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) }) + end + local a, b, c = V(L * 0.3, H * 0.48, 0), V(L * 0.55, H * 0.95, 0), V(L * 0.78, H * 0.85, 0) + cyl(model, a, b, 0.05 * s, { Color = c1 }) + cyl(model, b, c, 0.045 * s, { Color = c1 }) + local lure = ball(model, c, 0.26 * s, { Color = c2, Material = NEON }) + local light = Instance.new("PointLight") + light.Color = c2 + light.Range = 8 + light.Brightness = 2 + light.Parent = lure + else + oval(model, V(L * 0.05, H * 0.12, W * 0.35), CFrame.new(L * 0.49, -H * 0.08, 0), { Color = C(40, 25, 25) }) + end + if fish.teeth then + for i = -1, 1 do + wedge(model, V(0.05 * s, 0.12 * s, 0.05 * s), CFrame.new(L * 0.5, -H * 0.02, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) }) + end + end + if fish.whiskers then + for _, sgn in ipairs({ -1, 1 }) do + cyl(model, V(L * 0.46, -H * 0.12, sgn * W * 0.15), V(L * 0.62, -H * 0.42, sgn * W * 0.45), 0.04 * s, { Color = c2 }) + end + end + if shape == "sword" then + cyl(model, V(L * 0.45, 0, 0), V(L * 0.45 + L * 0.7, H * 0.03, 0), H * 0.08, { Color = c2, Material = mat }) + elseif shape == "sturgeon" then + oval(model, V(L * 0.22, H * 0.45, W * 0.45), CFrame.new(L * 0.52, -H * 0.08, 0), { Color = c1, Material = mat }) + for i = 0, 6 do + block(model, V(0.16 * s, 0.16 * s, 0.1 * s), CFrame.new(L * 0.3 - i * L * 0.11, H * 0.47, 0) * CFrame.Angles(0, 0, math.rad(45)), { Color = c2, Material = finMat }) + end + for _, sgn in ipairs({ -1, 1 }) do + cyl(model, V(L * 0.55, -H * 0.25, sgn * W * 0.1), V(L * 0.6, -H * 0.55, sgn * W * 0.15), 0.035 * s, { Color = c2 }) + end + elseif shape == "puffer" then + for i = 1, 30 do + local y = 1 - (i - 0.5) / 30 * 2 + local r = math.sqrt(1 - y * y) + local th = i * 2.4 + local dir = V(math.cos(th) * r, y, math.sin(th) * r) + local base = V(dir.X * L / 2, dir.Y * H / 2, dir.Z * W / 2) + cyl(model, base, base + dir * 0.28 * s, 0.05 * s, { Color = darken(c2, 0.1) }) + end + end + if glow then + sparkles(root, c2, 4) + end + return finish(model, root, anchored) +end + +---------------------------------------------------------------- поплавок + +function M.buildBobber() + local model = Instance.new("Model") + model.Name = "Bobber" + local root = newPart(model, { Name = "Root", Shape = Enum.PartType.Ball, Size = V(0.7, 0.7, 0.7), CFrame = CFrame.new(), Color = C(255, 255, 255) }) + newPart(model, { Shape = Enum.PartType.Ball, Size = V(0.72, 0.72, 0.72), CFrame = CFrame.new(0, 0.2, 0), Color = C(230, 40, 40) }) + newPart(model, { Size = V(0.07, 0.6, 0.07), CFrame = CFrame.new(0, 0.75, 0), Color = C(230, 40, 40) }) + finish(model, root, false) + root.Anchored = true + return model +end + +return M diff --git a/src/ServerScriptService/GameServer.server.lua b/src/ServerScriptService/GameServer.server.lua new file mode 100644 index 0000000..49b933f --- /dev/null +++ b/src/ServerScriptService/GameServer.server.lua @@ -0,0 +1,1286 @@ +-- GameServer (Script) -> ServerScriptService +-- Логика игры: данные, удача, рыбалка с анимацией, сумка, магазин, улучшения, +-- коллекция с наградами, задания, ежедневная награда, события, миры, донат. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local DataStoreService = game:GetService("DataStoreService") +local ProximityPromptService = game:GetService("ProximityPromptService") +local TweenService = game:GetService("TweenService") +local RunService = game:GetService("RunService") +local MarketplaceService = game:GetService("MarketplaceService") +local Debris = game:GetService("Debris") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) + +local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent") +remote.Name = "GameEvent" +remote.Parent = ReplicatedStorage + +local rng = Random.new() +local GOLD = Color3.fromRGB(255, 220, 80) +local RED = Color3.fromRGB(255, 120, 120) +local GREEN = Color3.fromRGB(120, 255, 140) +local SPLASH_SOUND = "rbxasset://sounds/impact_water.mp3" + +---------------------------------------------------------------- данные + +local store = nil +pcall(function() + store = DataStoreService:GetDataStore("FishingGame_v2") +end) + +local profiles = {} +local loadedOk = {} +local passes = {} + +local function defaultData() + return { + coins = 0, level = 1, xp = 0, + rod = "Basic", rods = { Basic = true }, rodLevels = {}, + bag = "Pouch", bags = { Pouch = true }, + items = {}, discovered = {}, claimed = {}, + quests = {}, daily = { last = 0, streak = 0 }, + boostUntil = 0, boostBonus = 0, + totalCaught = 0, nextUid = 1, receipts = {}, + } +end + +local function loadData(player) + local data = defaultData() + if not store then + return data, false + end + local ok, saved = pcall(function() + return store:GetAsync("player_" .. player.UserId) + end) + if not ok then + warn("Не удалось загрузить данные " .. player.Name .. ": " .. tostring(saved)) + return data, false + end + if type(saved) == "table" then + for k, v in pairs(saved) do + data[k] = v + end + end + return data, true +end + +local function saveData(player) + local data = profiles[player] + if not store or not data or not loadedOk[player] then + return + end + local ok, err = pcall(function() + store:SetAsync("player_" .. player.UserId, data) + end) + if not ok then + warn("Не удалось сохранить данные " .. player.Name .. ": " .. tostring(err)) + end +end + +---------------------------------------------------------------- пропуска и события + +local function hasPass(player, key) + return passes[player] ~= nil and passes[player][key] == true +end + +local function loadPasses(player) + passes[player] = {} + for _, gp in ipairs(Config.GamePasses) do + if gp.id and gp.id > 0 then + local ok, owns = pcall(function() + return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gp.id) + end) + if ok and owns then + passes[player][gp.key] = true + end + end + end +end + +local currentEvent = nil +local function ev(field, default) + return (currentEvent and currentEvent[field]) or default +end + +---------------------------------------------------------------- расчёты + +local function rodLevel(data, rodId) + return data.rodLevels[rodId or data.rod] or 0 +end + +local function boostActive(data) + return data.boostUntil > os.time() and data.boostBonus or 0 +end + +local function masteryCount(data) + local n = 0 + for key in pairs(data.claimed) do + if string.find(key, ":Master", 1, true) then + n += 1 + end + end + return n +end + +local function totalLuck(player, data) + local stats = Config.RodStats(data.rod, rodLevel(data)) + local l = 1 + stats.luck + (data.level - 1) * Config.LuckPerPlayerLevel + boostActive(data) + masteryCount(data) * Config.MasteryLuck + if hasPass(player, "VIP") then + l += 0.25 + end + if hasPass(player, "LuckyCharm") then + l += 0.5 + end + return l + ev("luck", 0) +end + +local function bagCapacity(player, data) + local bag = Config.Find(Config.Bags, data.bag) or Config.Bags[1] + return bag.capacity + (hasPass(player, "BigBag") and 100 or 0) +end + +local function sellMult(player) + local m = ev("sell", 1) + if hasPass(player, "VIP") then + m *= 1.25 + end + if hasPass(player, "DoubleCoins") then + m *= 2 + end + return m +end + +local function notify(player, text, color) + remote:FireClient(player, "Notify", text, color or Color3.new(1, 1, 1)) +end + +local function today() + return math.floor(os.time() / 86400) +end + +local function sendInventory(player) + local data = profiles[player] + if data then + remote:FireClient(player, "Inventory", data.items, data.discovered, data.claimed) + end +end + +local function sendQuests(player) + local data = profiles[player] + if not data then + return + end + local t = today() + remote:FireClient(player, "Quests", data.quests, { + available = data.daily.last < t, + streak = data.daily.streak, + nextStreak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or ((data.daily.last < t) and 1 or data.daily.streak), + }) +end + +local function updateStats(player) + local data = profiles[player] + if not data then + return + end + local bagValue = 0 + for _, item in ipairs(data.items) do + bagValue += item.value + end + local owned, lv, bags, ps = {}, {}, {}, {} + for id in pairs(data.rods) do + table.insert(owned, id) + table.insert(lv, id .. ":" .. rodLevel(data, id)) + end + for id in pairs(data.bags) do + table.insert(bags, id) + end + for key in pairs(passes[player] or {}) do + table.insert(ps, key) + end + + player:SetAttribute("Coins", data.coins) + player:SetAttribute("Level", data.level) + player:SetAttribute("XP", data.xp) + player:SetAttribute("XPNeed", Config.XPForLevel(data.level)) + player:SetAttribute("Rod", data.rod) + player:SetAttribute("RodLevel", rodLevel(data)) + player:SetAttribute("RodLevels", table.concat(lv, ",")) + player:SetAttribute("OwnedRods", table.concat(owned, ",")) + player:SetAttribute("Bag", data.bag) + player:SetAttribute("OwnedBags", table.concat(bags, ",")) + player:SetAttribute("BagCount", #data.items) + player:SetAttribute("BagCap", bagCapacity(player, data)) + player:SetAttribute("BagValue", math.floor(bagValue * sellMult(player))) + player:SetAttribute("Luck", math.floor(totalLuck(player, data) * 100 + 0.5)) + player:SetAttribute("BoostBonus", boostActive(data)) + player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time())) + player:SetAttribute("TotalCaught", data.totalCaught) + player:SetAttribute("Mastery", masteryCount(data)) + player:SetAttribute("Passes", table.concat(ps, ",")) + + local ls = player:FindFirstChild("leaderstats") + if ls then + ls["Монеты"].Value = data.coins + ls["Уровень"].Value = data.level + ls["Улов"].Value = data.totalCaught + end +end + +local function addXp(player, data, amount) + data.xp += amount + local leveled = false + while data.xp >= Config.XPForLevel(data.level) do + data.xp -= Config.XPForLevel(data.level) + data.level += 1 + leveled = true + end + if leveled then + notify(player, "⭐ Новый уровень: " .. data.level .. "! Удача +" .. math.floor(Config.LuckPerPlayerLevel * 100) .. "%", GOLD) + for _, w in ipairs(Config.Worlds) do + if w.level == data.level and not w.soon then + notify(player, "🌍 Открыт новый мир: " .. w.icon .. " " .. w.name .. "!", w.color) + end + end + end +end + +local function applyPotion(data, bonus, duration) + data.boostBonus = math.max(boostActive(data), bonus) + data.boostUntil = math.max(os.time(), data.boostUntil) + duration +end + +---------------------------------------------------------------- задания + +local function makeQuest(data, exclude) + local pool = {} + for _, q in ipairs(Config.Quests) do + if not exclude[q.kind] then + table.insert(pool, q) + end + end + if #pool == 0 then + pool = Config.Quests + end + local t = pool[rng:NextInteger(1, #pool)] + local goal = t.goals[rng:NextInteger(1, #t.goals)] + local mult = 1 + (data.level - 1) * 0.25 + return { + kind = t.kind, goal = goal, progress = 0, + coins = math.max(10, math.floor(t.coins * goal * mult)), + xp = math.max(10, math.floor(t.xp * goal * mult)), + } +end + +local function ensureQuests(data) + local kinds = {} + for _, q in ipairs(data.quests) do + kinds[q.kind] = true + end + while #data.quests < Config.QuestSlots do + local q = makeQuest(data, kinds) + kinds[q.kind] = true + table.insert(data.quests, q) + end +end + +local function questProgress(player, kind, amount) + local data = profiles[player] + if not data then + return + end + local changed = false + for _, q in ipairs(data.quests) do + if q.kind == kind and q.progress < q.goal then + q.progress = math.min(q.goal, q.progress + amount) + changed = true + if q.progress >= q.goal then + notify(player, "📜 Задание выполнено! Забери награду (клавиша Q)", GOLD) + end + end + end + if changed then + sendQuests(player) + end +end + +local function claimQuest(player, index) + local data = profiles[player] + local q = data and type(index) == "number" and data.quests[index] + if not q or q.progress < q.goal then + return + end + data.coins += q.coins + addXp(player, data, q.xp) + local kinds = {} + for i, other in ipairs(data.quests) do + if i ~= index then + kinds[other.kind] = true + end + end + kinds[q.kind] = true + data.quests[index] = makeQuest(data, kinds) + updateStats(player) + sendQuests(player) + notify(player, ("📜 Награда: +%d 💰 +%d XP"):format(q.coins, q.xp), GREEN) +end + +local function claimDaily(player) + local data = profiles[player] + if not data then + return + end + local t = today() + if data.daily.last >= t then + notify(player, "🎁 Сегодня награда уже получена. Приходи завтра!", Color3.fromRGB(255, 200, 120)) + return + end + local streak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or 1 + local r = Config.DailyRewards[streak] + local coins = math.floor(r.coins * (1 + (data.level - 1) * 0.2)) + data.coins += coins + local extra = "" + if r.potion then + local p = Config.Find(Config.Potions, r.potion) + if p then + applyPotion(data, p.bonus, p.duration) + extra = " + " .. p.name + end + end + data.daily = { last = t, streak = streak } + updateStats(player) + sendQuests(player) + notify(player, ("🎁 День %d: +%d 💰%s"):format(streak, coins, extra), GOLD) +end + +---------------------------------------------------------------- коллекция + +local function claimCollection(player, worldId, rarity) + local data = profiles[player] + local world = data and Config.Find(Config.Worlds, worldId) + local zone = world and Config.Zones[worldId] + if not zone or type(rarity) ~= "string" then + return + end + local key = worldId .. ":" .. rarity + if data.claimed[key] then + return + end + for _, f in ipairs(zone.fish) do + if (rarity == "Master" or f.rarity == rarity) and not data.discovered[f.id] then + notify(player, "Сначала поймай всех рыб этой группы!", RED) + return + end + end + data.claimed[key] = true + if rarity == "Master" then + local coins = Config.MasteryCoins * world.mult + data.coins += coins + notify(player, ("🏆 Мир «%s» собран! +%d 💰 и +%d%% удачи навсегда"):format(world.name, coins, math.floor(Config.MasteryLuck * 100 + 0.5)), GOLD) + else + local r = Config.CollectionRewards[rarity] + if not r then + return + end + data.coins += r.coins * world.mult + addXp(player, data, r.xp * world.mult) + notify(player, ("📖 Коллекция «%s»: +%d 💰 +%d XP"):format(Config.Rarities[rarity].name, r.coins * world.mult, r.xp * world.mult), GREEN) + end + updateStats(player) + sendInventory(player) +end + +---------------------------------------------------------------- удочка, сумка, VIP на персонаже + +local REST_ANGLE = 30 +local function gripCF(angle) + return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse() +end +local function tweenGrip(tool, angle, t) + if not tool or not tool.Parent then + return nil + end + local tw = TweenService:Create(tool, TweenInfo.new(t, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Grip = gripCF(angle) }) + tw:Play() + return tw +end +local function gripSequence(tool, steps) + task.spawn(function() + for _, s in ipairs(steps) do + local tw = tweenGrip(tool, s[1], s[2]) + if not tw then + return + end + tw.Completed:Wait() + end + end) +end + +local function findRodTool(player) + for _, container in ipairs({ player.Character, player:FindFirstChild("Backpack") }) do + if container then + for _, child in ipairs(container:GetChildren()) do + if child:IsA("Tool") and child:GetAttribute("IsRod") then + return child + end + end + end + end + return nil +end + +local function giveRodTool(player) + local data = profiles[player] + local backpack = player:FindFirstChild("Backpack") + if not data or not backpack then + return + end + local old = findRodTool(player) + local wasEquipped = old ~= nil and old.Parent == player.Character + if old then + old:Destroy() + end + local rod = Config.Find(Config.Rods, data.rod) or Config.Rods[1] + local lvl = rodLevel(data) + local model = Models.buildRod(rod.id, lvl, false) + local tool = Instance.new("Tool") + tool.Name = rod.name .. (lvl > 0 and (" +" .. lvl) or "") + tool.ToolTip = "Кликни у воды, чтобы закинуть" + tool.CanBeDropped = false + tool.Grip = gripCF(REST_ANGLE) + tool:SetAttribute("IsRod", true) + for _, child in ipairs(model:GetChildren()) do + child.Parent = tool + end + model:Destroy() + tool.Parent = backpack + if wasEquipped then + local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid") + if hum then + hum:EquipTool(tool) + end + end +end + +local function attachBag(player) + local data = profiles[player] + local char = player.Character + if not data or not char then + return + end + local old = char:FindFirstChild("BackBag") + if old then + old:Destroy() + end + local torso = char:FindFirstChild("UpperTorso") or char:FindFirstChild("Torso") + if not torso then + return + end + local bag = Models.buildBag(data.bag, false) + local offset = CFrame.new(0, 0.1, torso.Size.Z / 2) + bag:PivotTo(torso.CFrame * offset) + local w = Instance.new("Weld") + w.Part0 = torso + w.Part1 = bag.PrimaryPart + w.C0 = offset + w.Parent = bag.PrimaryPart + bag.Parent = char +end + +local function vipTag(player) + local head = player.Character and player.Character:FindFirstChild("Head") + if not head or not hasPass(player, "VIP") or head:FindFirstChild("VipTag") then + return + end + local bb = Instance.new("BillboardGui") + bb.Name = "VipTag" + bb.Size = UDim2.fromOffset(120, 30) + bb.StudsOffset = Vector3.new(0, 2.6, 0) + bb.MaxDistance = 80 + bb.Parent = head + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = Color3.fromRGB(255, 210, 60) + t.TextStrokeTransparency = 0.2 + t.Text = "👑 VIP" + t.Parent = bb +end + +---------------------------------------------------------------- эффекты + +local function playSound(parent, id, volume) + local snd = Instance.new("Sound") + snd.SoundId = id + snd.Volume = volume or 0.6 + snd.Parent = parent + snd:Play() + Debris:AddItem(snd, 3) +end + +local function splash(part, count) + local att = Instance.new("Attachment") + att.Parent = part + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(Color3.fromRGB(220, 240, 255)) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Size = NumberSequence.new(0.4, 0.1) + pe.Lifetime = NumberRange.new(0.4, 0.7) + pe.Speed = NumberRange.new(6, 10) + pe.SpreadAngle = Vector2.new(40, 40) + pe.Acceleration = Vector3.new(0, -35, 0) + pe.Enabled = false + pe.Parent = att + pe:Emit(count or 20) + Debris:AddItem(att, 2) +end + +-- рыба вылетает из воды, летит к игроку и показывается над головой +local function showFishFlight(player, fish, fromPos) + local head = player.Character and player.Character:FindFirstChild("Head") + if not head then + return + end + local model = Models.buildFish(fish.id, fish.mutation, 0.9, true) + model:PivotTo(CFrame.new(fromPos)) + model.Parent = workspace + task.spawn(function() + local t0, dur = os.clock(), 0.55 + while head.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + local target = head.Position + Vector3.new(0, 2.8, 0) + local p = fromPos:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 8, 0) + model:PivotTo(CFrame.new(p) * CFrame.Angles(0, 0, a * math.pi * 2)) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + local t1 = os.clock() + while head.Parent and os.clock() - t1 < 1.8 do + model:PivotTo(CFrame.new(head.Position + Vector3.new(0, 2.8, 0)) * CFrame.Angles(0, os.clock() * 3, math.rad(-15))) + RunService.Heartbeat:Wait() + end + model:Destroy() + end) +end + +---------------------------------------------------------------- рыбалка + +local fishing = {} + +-- ищем воду перед игроком по карте мира из FishConfig (не зависит от террейна) +local function findWater(hrp, world) + local look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + if look.Magnitude < 0.01 then + look = Vector3.new(0, 0, -1) + end + look = look.Unit + for _, d in ipairs({ 14, 11, 17, 8, 20, 6, 24, 4 }) do + local p = hrp.Position + look * d + if Config.IsWater(world, p) then + return Vector3.new(p.X, world.waterY or 0, p.Z) + end + end + return nil +end + +local function stopFishing(player, tellClient) + local s = fishing[player] + if not s then + return + end + fishing[player] = nil + if s.tween then + s.tween:Cancel() + end + if s.bobber then + s.bobber:Destroy() + end + if s.tool then + tweenGrip(s.tool, REST_ANGLE, 0.3) + end + if tellClient then + remote:FireClient(player, "Cancel") + end +end + +local function rollFish(player, data, worldId) + local zone = Config.Zones[worldId] + if not zone then + return nil + end + local luck = totalLuck(player, data) + local bonus = luck - 1 + local weights, total = {}, 0 + for i, f in ipairs(zone.fish) do + local r = Config.Rarities[f.rarity] + local w = r.weight * math.max(0.2, 1 + bonus * (r.rank - 1)) + if r.rank == 1 then + w = r.weight / math.max(1, luck) + end + weights[i] = w + total += w + end + local roll = rng:NextNumber() * total + local chosen = zone.fish[1] + for i, f in ipairs(zone.fish) do + roll -= weights[i] + if roll <= 0 then + chosen = f + break + end + end + local mutation = nil + for _, m in ipairs(Config.Mutations) do + if rng:NextNumber() < m.chance * luck * ev("mutation", 1) then + mutation = m + break + end + end + local wf = rng:NextNumber() ^ 2.2 + local weight = chosen.minW + (chosen.maxW - chosen.minW) * wf + return { + id = chosen.id, + name = chosen.name, + rarity = chosen.rarity, + weight = math.floor(weight * 100) / 100, + value = math.floor(chosen.price * (0.75 + 0.9 * wf) * (mutation and mutation.mult or 1) + 0.5), + xp = chosen.xp * (mutation and 2 or 1), + mutation = mutation and mutation.id or nil, + world = worldId, + } +end + +local function flyBobber(s, tool, target) + local tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") + local start = tip and tip.WorldPosition or (target + Vector3.new(0, 6, 0)) + local bobber = Models.buildBobber() + bobber:PivotTo(CFrame.new(start)) + bobber.Parent = workspace + s.bobber = bobber + if tip then + local a1 = Instance.new("Attachment") + a1.Position = Vector3.new(0, 0.9, 0) + a1.Parent = bobber.PrimaryPart + local line = Instance.new("Beam") + line.Attachment0 = tip + line.Attachment1 = a1 + line.Width0 = 0.035 + line.Width1 = 0.035 + line.FaceCamera = true + line.Color = ColorSequence.new(Color3.fromRGB(245, 245, 245)) + line.Parent = bobber + end + local t0, dur = os.clock(), 0.55 + while bobber.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 6, 0))) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + if bobber.Parent then + splash(bobber.PrimaryPart, 18) + playSound(bobber.PrimaryPart, SPLASH_SOUND, 0.5) + end +end + +local function onCast(player) + local data = profiles[player] + if not data then + return + end + if fishing[player] then + stopFishing(player, true) + return + end + local char = player.Character + local hrp = char and char:FindFirstChild("HumanoidRootPart") + local tool = char and char:FindFirstChildOfClass("Tool") + if not hrp or not tool or not tool:GetAttribute("IsRod") then + remote:FireClient(player, "CastFail") + return + end + local world = Config.WorldAt(hrp.Position) + local target = world and findWater(hrp, world) + if not target then + remote:FireClient(player, "CastFail") + notify(player, world and "Повернись лицом к воде (или к лунке)!" or "Здесь нет рыбы — иди в один из миров 🌍", Color3.fromRGB(255, 200, 120)) + return + end + if #data.items >= bagCapacity(player, data) then + remote:FireClient(player, "CastFail") + notify(player, "🎒 Сумка полна! Продай рыбу в скупке.", RED) + return + end + + local stats = Config.RodStats(data.rod, rodLevel(data)) + local fish = rollFish(player, data, world.id) + if not fish then + remote:FireClient(player, "CastFail") + return + end + local s = { stage = "casting", fish = fish, tool = tool } + fishing[player] = s + remote:FireClient(player, "Cast") + + task.spawn(function() + -- замах назад и бросок вперёд + local tw = tweenGrip(tool, 100, 0.25) + if tw then + tw.Completed:Wait() + end + tw = tweenGrip(tool, 8, 0.15) + if tw then + tw.Completed:Wait() + end + if fishing[player] ~= s then + return + end + flyBobber(s, tool, target + Vector3.new(0, 0.15, 0)) + tweenGrip(tool, REST_ANGLE - 5, 0.4) + if fishing[player] ~= s then + if s.bobber then + s.bobber:Destroy() + end + return + end + s.stage = "waiting" + + local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) + task.wait(waitTime) + if fishing[player] ~= s then + return + end + s.stage = "bite" + s.biteAt = os.clock() + if s.bobber and s.bobber.PrimaryPart then + local root = s.bobber.PrimaryPart + splash(root, 25) + playSound(root, SPLASH_SOUND, 0.35) + s.tween = TweenService:Create(root, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, -1, true), { + CFrame = root.CFrame - Vector3.new(0, 0.55, 0), + }) + s.tween:Play() + end + -- удочка дёргается, пока идёт вываживание + task.spawn(function() + local up = true + while fishing[player] == s and s.stage == "bite" do + tweenGrip(tool, up and 38 or 18, 0.12) + up = not up + task.wait(0.13) + end + end) + local rank = Config.Rarities[fish.rarity].rank + remote:FireClient(player, "Bite", { + speed = 0.55 + 0.22 * (rank - 1), + zoneWidth = math.max(0.07, stats.zone - 0.02 * (rank - 1)), + hits = Config.HitsNeeded(rank), + misses = Config.MaxMisses, + timeout = Config.BiteTimeout, + }) + task.wait(Config.BiteTimeout + 0.5) + if fishing[player] == s and s.stage == "bite" then + stopFishing(player, false) + remote:FireClient(player, "Escaped") + notify(player, "Рыба ушла… не успел вытащить.", RED) + end + end) +end + +local function onCatch(player, success, misses) + local s = fishing[player] + local data = profiles[player] + if not s or not data or s.stage ~= "bite" then + return + end + local fromPos = s.bobber and s.bobber.PrimaryPart and s.bobber.PrimaryPart.Position + s.stage = "done" + local tool = s.tool + fishing[player] = nil + if s.tween then + s.tween:Cancel() + end + if s.bobber then + s.bobber:Destroy() + end + + if success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 then + gripSequence(tool, { { REST_ANGLE, 0.3 } }) + remote:FireClient(player, "Escaped") + notify(player, "Рыба сорвалась!", RED) + return + end + gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } }) + + local fish = s.fish + table.insert(data.items, { + uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity, + weight = fish.weight, value = fish.value, mutation = fish.mutation, + }) + data.nextUid += 1 + data.totalCaught += 1 + + local rec = data.discovered[fish.id] + local isNew, isRecord = rec == nil, false + if not rec then + rec = { count = 0, best = 0 } + data.discovered[fish.id] = rec + end + rec.count += 1 + if fish.weight > rec.best then + isRecord = not isNew + rec.best = fish.weight + end + + addXp(player, data, fish.xp * (isNew and 2 or 1)) + updateStats(player) + sendInventory(player) + if fromPos then + showFishFlight(player, fish, fromPos) + end + remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord }) + + local rank = Config.Rarities[fish.rarity].rank + questProgress(player, "catch", 1) + if rank >= 3 then + questProgress(player, "rare", 1) + end + if rank >= 4 then + questProgress(player, "epic", 1) + end + if fish.mutation then + questProgress(player, "mutation", 1) + end + if misses == 0 then + questProgress(player, "perfect", 1) + end +end + +---------------------------------------------------------------- скупка + +local sellPoints = nil +local function nearSeller(player) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return false + end + if not sellPoints then + sellPoints = {} + local map = workspace:FindFirstChild("FishingMap") + if map then + for _, d in ipairs(map:GetDescendants()) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + table.insert(sellPoints, d.Parent) + end + end + end + end + for _, p in ipairs(sellPoints) do + if (p.Position - hrp.Position).Magnitude < 28 then + return true + end + end + return false +end + +local function sellItems(player, filterUid) + local data = profiles[player] + if not data then + return + end + local mult = sellMult(player) + local total, count, keep = 0, 0, {} + for _, item in ipairs(data.items) do + if filterUid == nil or item.uid == filterUid then + total += math.floor(item.value * mult) + count += 1 + else + table.insert(keep, item) + end + end + if count == 0 then + if filterUid == nil then + notify(player, "Нечего продавать — сначала поймай рыбу!", Color3.fromRGB(255, 200, 120)) + end + return + end + data.items = keep + data.coins += total + updateStats(player) + sendInventory(player) + remote:FireClient(player, "Sold", total, count) + questProgress(player, "earn", total) +end + +---------------------------------------------------------------- магазин + +local function buy(player, kind, id) + local data = profiles[player] + if not data or type(id) ~= "string" then + return + end + if kind == "Upgrade" then + local rod = Config.Find(Config.Rods, id) + if not rod or not data.rods[id] then + return + end + local lvl = rodLevel(data, id) + if lvl >= Config.RodUpgrade.maxLevel then + notify(player, "Удочка уже улучшена до максимума ★★★★★", GOLD) + return + end + local cost = Config.UpgradeCost(rod, lvl) + if data.coins < cost then + notify(player, "Не хватает монет: нужно " .. cost .. " 💰", RED) + return + end + data.coins -= cost + data.rodLevels[id] = lvl + 1 + if data.rod == id then + stopFishing(player, true) + giveRodTool(player) + end + updateStats(player) + notify(player, ("✨ %s улучшена до +%d!"):format(rod.name, lvl + 1), GOLD) + return + end + if kind == "Potion" then + local potion = Config.Find(Config.Potions, id) + if not potion then + return + end + if potion.level and data.level < potion.level then + notify(player, "Нужен уровень " .. potion.level .. "!", RED) + return + end + if data.coins < potion.price then + notify(player, "Не хватает монет: нужно " .. potion.price .. " 💰", RED) + return + end + data.coins -= potion.price + applyPotion(data, potion.bonus, potion.duration) + updateStats(player) + notify(player, ("🍀 %s: удача +%d%% на %d мин"):format(potion.name, potion.bonus * 100, potion.duration / 60), GREEN) + return + end + local list, owned + if kind == "Rod" then + list, owned = Config.Rods, data.rods + elseif kind == "Bag" then + list, owned = Config.Bags, data.bags + else + return + end + local item = Config.Find(list, id) + if not item then + return + end + if not owned[id] then + if data.level < item.level then + notify(player, "Нужен уровень " .. item.level .. "!", RED) + return + end + if data.coins < item.price then + notify(player, "Не хватает монет: нужно " .. item.price .. " 💰", RED) + return + end + data.coins -= item.price + owned[id] = true + notify(player, "Куплено: " .. item.name .. "!", GREEN) + end + if kind == "Rod" then + data.rod = id + stopFishing(player, true) + giveRodTool(player) + else + data.bag = id + attachBag(player) + end + updateStats(player) +end + +---------------------------------------------------------------- телепорт + +local function teleportTo(player, worldId) + local data = profiles[player] + local char = player.Character + if not data or not char or type(worldId) ~= "string" then + return + end + local markerName + if worldId == "Lobby" then + markerName = "LobbySpawn" + else + local world = Config.Find(Config.Worlds, worldId) + if not world then + return + end + if world.soon then + notify(player, world.icon .. " " .. world.name .. " скоро откроется! Следи за обновлениями.", world.color) + return + end + if data.level < world.level then + notify(player, ("🔒 %s откроется на %d уровне"):format(world.name, world.level), RED) + return + end + markerName = world.id .. "Spawn" + end + local map = workspace:FindFirstChild("FishingMap") + local m = map and map:FindFirstChild(markerName) + if m then + stopFishing(player, true) + char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + end +end + +---------------------------------------------------------------- подсказки NPC + +local TIPS = { + World1 = { + "Рыба клюёт быстрее с хорошей удочкой. Улучшай её в магазине!", + "Говорят, в этом озере живёт хрустальный осётр… Мифическая рыба!", + "Собери всех рыб одной редкости — получишь награду в коллекции (клавиша C).", + "Чем реже рыба, тем быстрее бегает метка. Нужна точность!", + }, + World2 = { + "Скаты любят мелководье, а акулы — глубину за причалом.", + "Солнечная медуза светится по ночам… Если поймаешь — ты легенда!", + "Блестящая рыба стоит вдвое дороже, золотая — в пять раз, радужная — в десять!", + }, + World3 = { + "Ищи лунки во льду — только там можно рыбачить.", + "Ледяной левиафан… Я видел его тень подо льдом. Один раз.", + "Удильщик светится в темноте. Смотри внимательно!", + }, +} + +local function talk(player) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local world = hrp and Config.WorldAt(hrp.Position) + local list = TIPS[world and world.id or "World1"] or TIPS.World1 + notify(player, "💬 «" .. list[rng:NextInteger(1, #list)] .. "»", Color3.fromRGB(255, 235, 190)) +end + +ProximityPromptService.PromptTriggered:Connect(function(prompt, player) + local action = prompt:GetAttribute("Action") + if action == "Shop" then + remote:FireClient(player, "OpenShop") + elseif action == "Sell" then + sellItems(player, nil) + elseif action == "Portal" then + teleportTo(player, prompt:GetAttribute("World")) + elseif action == "Talk" then + talk(player) + elseif action == "Daily" then + claimDaily(player) + remote:FireClient(player, "OpenQuests") + elseif action == "RobuxPasses" then + remote:FireClient(player, "OpenRobux", "passes") + elseif action == "RobuxProducts" then + remote:FireClient(player, "OpenRobux", "products") + end +end) + +---------------------------------------------------------------- события от клиента + +remote.OnServerEvent:Connect(function(player, action, a, b) + if action == "Cast" then + onCast(player) + elseif action == "Catch" then + onCatch(player, a, b) + elseif action == "Cancel" then + stopFishing(player, false) + elseif action == "Buy" then + buy(player, a, b) + elseif action == "SellOne" then + if type(a) ~= "number" then + return + end + if nearSeller(player) then + sellItems(player, a) + else + notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + end + elseif action == "SellAll" then + if nearSeller(player) then + sellItems(player, nil) + else + notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + end + elseif action == "Teleport" then + teleportTo(player, a) + elseif action == "ClaimCollection" then + claimCollection(player, a, b) + elseif action == "ClaimQuest" then + claimQuest(player, a) + elseif action == "ClaimDaily" then + claimDaily(player) + elseif action == "RequestInventory" then + sendInventory(player) + sendQuests(player) + end +end) + +---------------------------------------------------------------- донат + +MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased) + if not purchased then + return + end + for _, gp in ipairs(Config.GamePasses) do + if gp.id == passId then + passes[player] = passes[player] or {} + passes[player][gp.key] = true + notify(player, "Спасибо за покупку! " .. gp.icon .. " " .. gp.name .. " активирован", GOLD) + if gp.key == "VIP" then + vipTag(player) + end + updateStats(player) + end + end +end) + +MarketplaceService.ProcessReceipt = function(info) + local player = Players:GetPlayerByUserId(info.PlayerId) + local data = player and profiles[player] + if not data then + return Enum.ProductPurchaseDecision.NotProcessedYet + end + for _, id in ipairs(data.receipts) do + if id == info.PurchaseId then + return Enum.ProductPurchaseDecision.PurchaseGranted + end + end + local product + for _, p in ipairs(Config.Products) do + if p.id == info.ProductId then + product = p + end + end + if not product then + return Enum.ProductPurchaseDecision.NotProcessedYet + end + if product.coins then + local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15)) + data.coins += coins + notify(player, ("Спасибо! +%d 💰"):format(coins), GOLD) + end + if product.boost then + applyPotion(data, product.boost, product.duration) + notify(player, ("Спасибо! Удача +%d%% на %d мин"):format(product.boost * 100, product.duration / 60), GOLD) + end + table.insert(data.receipts, info.PurchaseId) + if #data.receipts > 50 then + table.remove(data.receipts, 1) + end + updateStats(player) + saveData(player) + return Enum.ProductPurchaseDecision.PurchaseGranted +end + +---------------------------------------------------------------- события на сервере + +task.spawn(function() + task.wait(Config.EventFirstDelay) + while true do + currentEvent = Config.Events[rng:NextInteger(1, #Config.Events)] + workspace:SetAttribute("Event", currentEvent.id) + workspace:SetAttribute("EventEnds", workspace:GetServerTimeNow() + currentEvent.duration) + for _, p in ipairs(Players:GetPlayers()) do + notify(p, "🎉 Событие: " .. currentEvent.name .. " — " .. currentEvent.desc, GOLD) + updateStats(p) + end + task.wait(currentEvent.duration) + currentEvent = nil + workspace:SetAttribute("Event", nil) + for _, p in ipairs(Players:GetPlayers()) do + updateStats(p) + end + task.wait(rng:NextInteger(Config.EventGapMin, Config.EventGapMax)) + end +end) + +---------------------------------------------------------------- игроки + +local function onPlayerAdded(player) + local ls = Instance.new("Folder") + ls.Name = "leaderstats" + ls.Parent = player + for _, name in ipairs({ "Монеты", "Уровень", "Улов" }) do + local v = Instance.new("IntValue") + v.Name = name + v.Parent = ls + end + + local data, ok = loadData(player) + if not player.Parent then + return + end + loadPasses(player) + ensureQuests(data) + profiles[player] = data + loadedOk[player] = ok + updateStats(player) + sendInventory(player) + sendQuests(player) + + local function onCharacter() + stopFishing(player, false) + task.wait(0.3) + giveRodTool(player) + attachBag(player) + vipTag(player) + end + player.CharacterAdded:Connect(onCharacter) + if player.Character then + task.spawn(onCharacter) + end +end + +Players.PlayerAdded:Connect(onPlayerAdded) +for _, p in ipairs(Players:GetPlayers()) do + task.spawn(onPlayerAdded, p) +end + +Players.PlayerRemoving:Connect(function(player) + stopFishing(player, false) + saveData(player) + profiles[player] = nil + loadedOk[player] = nil + passes[player] = nil +end) + +game:BindToClose(function() + for _, p in ipairs(Players:GetPlayers()) do + saveData(p) + end +end) + +-- таймер зелий + автосохранение +task.spawn(function() + local t = 0 + while true do + task.wait(1) + t += 1 + for _, p in ipairs(Players:GetPlayers()) do + local data = profiles[p] + if data and data.boostUntil > os.time() - 2 then + updateStats(p) + end + end + if t % 60 == 0 then + for _, p in ipairs(Players:GetPlayers()) do + saveData(p) + end + end + end +end) diff --git a/src/ServerScriptService/MapBuilder.server.lua b/src/ServerScriptService/MapBuilder.server.lua new file mode 100644 index 0000000..fcf9e41 --- /dev/null +++ b/src/ServerScriptService/MapBuilder.server.lua @@ -0,0 +1,1405 @@ +-- MapBuilder (Script) -> ServerScriptService +-- Строит лобби и Мир 1 «Тихое озеро» при запуске игры, настраивает свет и воду. +-- Если в Workspace уже есть папка "FishingMap", детали не строятся заново +-- (террейн, свет и точка появления настраиваются всегда). + +local Workspace = game:GetService("Workspace") +local Lighting = game:GetService("Lighting") +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) + +local V = Vector3.new +local rng = Random.new(7) + +---------------------------------------------------------------- свет и атмосфера + +local function ensure(class, parent, props) + local obj = parent:FindFirstChildOfClass(class) or Instance.new(class) + for k, v in pairs(props) do + obj[k] = v + end + obj.Parent = parent + return obj +end + +Lighting.ClockTime = 14.5 +Lighting.Brightness = 2.3 +Lighting.Ambient = Color3.fromRGB(70, 70, 85) +Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) +Lighting.EnvironmentDiffuseScale = 0.6 +Lighting.EnvironmentSpecularScale = 0.8 +ensure("Atmosphere", Lighting, { + Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, + Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), +}) +ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) +ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) +ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) + +---------------------------------------------------------------- вода + +local terrain = Workspace.Terrain +-- низкое отражение, иначе вода «засвечивается» небом и выглядит белой +terrain.WaterColor = Color3.fromRGB(20, 95, 115) +terrain.WaterTransparency = 0.2 +terrain.WaterReflectance = 0.08 +terrain.WaterWaveSize = 0.1 +terrain.WaterWaveSpeed = 8 + +---------------------------------------------------------------- МИР 1: террейн (строится всегда) + +local W = V(0, 0, 1500) -- центр Мира 1 +local GROUND_Y = 4 -- верх земли +local WATER_Y = 0 -- поверхность воды + +-- озеро из нескольких кругов: { x, z, радиус } +local LAKES = Config.Worlds[1].lakes + +terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Grass) +-- холмы по краям +for _, h in ipairs({ { -190, 160, 50 }, { 185, 175, 45 }, { -175, -175, 60 }, { 190, -150, 55 }, { 0, -215, 50 }, { -215, 0, 40 }, { 215, 30, 42 } }) do + terrain:FillBall(W + V(h[1], -14, h[2]), h[3], Enum.Material.Grass) +end +-- порядок важен: песок → выемка → ил → вода +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 11, Enum.Material.Sand) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 7, Enum.Material.Air) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 2, Enum.Material.Air) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) +end +-- дорожка от точки прибытия к причалу и площадка +terrain:FillBlock(CFrame.new(W + V(0, 2, 100)), V(8, 4, 44), Enum.Material.Ground) +terrain:FillCylinder(CFrame.new(W + V(0, 2, 130)), 4, 17, Enum.Material.Cobblestone) + +---------------------------------------------------------------- точка появления в лобби + +local spawn = Workspace:FindFirstChildOfClass("SpawnLocation") +if not spawn then + spawn = Instance.new("SpawnLocation") + spawn.Parent = Workspace +end +spawn.Anchored = true +spawn.Size = V(8, 0.2, 8) +spawn.CFrame = CFrame.new(0, 1.15, 50) +spawn.Transparency = 1 +spawn.Duration = 0 +for _, d in ipairs(spawn:GetChildren()) do + if d:IsA("Decal") or d:IsA("Texture") then + d.Transparency = 1 + end +end + +if Workspace:FindFirstChild("FishingMap") then + return +end + +local map = Instance.new("Folder") +map.Name = "FishingMap" +map.Parent = Workspace +local zonesFolder = Instance.new("Folder") +zonesFolder.Name = "FishingZones" +zonesFolder.Parent = map + +---------------------------------------------------------------- помощники + +local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p +end + +local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) +end + +local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) +end + +local function surfaceText(part, face, text, color, extra) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.RichText = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.4 + t.Text = text + t.Parent = sg + local pad = Instance.new("UIPadding") + pad.PaddingLeft = UDim.new(0.05, 0) + pad.PaddingRight = UDim.new(0.05, 0) + pad.PaddingTop = UDim.new(0.06, 0) + pad.PaddingBottom = UDim.new(0.06, 0) + pad.Parent = t + for k, v in pairs(extra or {}) do + t[k] = v + end + return t +end + +local function billboard(target, text, color, offsetY, width) + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(width or 300, 64) + bb.StudsOffset = V(0, offsetY or 5, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = target + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.15 + t.Text = text + t.Parent = bb + return bb +end + +local function prompt(target, actionText, objectText, action, dist) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = dist or 13 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp +end + +local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) +end + +local function groundY(x, z) + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Include + params.FilterDescendantsInstances = { terrain } + params.IgnoreWater = true + local hit = Workspace:Raycast(V(x, 150, z), V(0, -300, 0), params) + return hit and hit.Position.Y or GROUND_Y, hit and hit.Material +end + +local function lamp(pos, color) + vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) }) + P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local light = Instance.new("PointLight") + light.Range = 16 + light.Brightness = 1.2 + light.Color = color or Color3.fromRGB(255, 210, 150) + light.Parent = bulb +end + +local function tree(pos, kind) + if kind == "pine" then + local h = rng:NextNumber(8, 12) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass }) + end + else + local birch = kind == "birch" + local h = rng:NextNumber(7, 10) + vcyl(pos + V(0, h / 2, 0), h, 1.5, { + Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45), + Material = Enum.Material.Wood, + }) + local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60) + local s = rng:NextNumber(9, 12) + ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass }) + end +end + +local function bush(pos) + local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55) + for i = 1, 3 do + ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass }) + end + if rng:NextNumber() < 0.5 then + for i = 1, 4 do + ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)], + CanCollide = false, + }) + end + end +end + +local function bench(cf) + local seat = Instance.new("Seat") + seat.Anchored = true + seat.Size = V(5, 0.4, 1.6) + seat.CFrame = cf * CFrame.new(0, 1.6, 0) + seat.Material = Enum.Material.WoodPlanks + seat.Color = Color3.fromRGB(150, 105, 65) + seat.TopSurface = Enum.SurfaceType.Smooth + seat.Parent = map + for _, x in ipairs({ -2.1, 2.1 }) do + P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal }) + end + P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) }) +end + +local function npc(name, cf, colors, action, actionText) + local ok, rig = pcall(function() + local d = Instance.new("HumanoidDescription") + d.HeadColor = colors.skin + d.LeftArmColor = colors.skin + d.RightArmColor = colors.skin + d.TorsoColor = colors.shirt + d.LeftLegColor = colors.pants + d.RightLegColor = colors.pants + return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15) + end) + if not ok or not rig then + warn("NPC не создан: " .. tostring(rig)) + return nil + end + rig.Name = name + local hum = rig:FindFirstChildOfClass("Humanoid") + hum.DisplayName = name + hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff + hum.NameDisplayDistance = 60 + local root = rig:FindFirstChild("HumanoidRootPart") + root.Anchored = true + rig:PivotTo(cf) + rig.Parent = map + + local head = rig:FindFirstChild("Head") + if head then + if not head:FindFirstChildOfClass("Decal") then + local face = Instance.new("Decal") + face.Name = "face" + face.Texture = "rbxasset://textures/face.png" + face.Parent = head + end + -- панама рыбака + local function hatPart(size, offset, shape) + local p = Instance.new("Part") + p.Shape = shape + p.Size = size + p.CanCollide = false + p.Massless = true + p.Color = colors.hat + p.Material = Enum.Material.Fabric + p.CFrame = head.CFrame * offset + local w = Instance.new("Weld") + w.Part0 = head + w.Part1 = p + w.C0 = head.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Parent = rig + end + hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + end + if action then + prompt(root, actionText, name, action, 14) + end + return rig +end + +-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей +local function stall(cf, opt) + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local wall, dark = opt.wall, opt.wall:Lerp(Color3.new(0, 0, 0), 0.3) + + P({ Size = V(24, 1, 17), CFrame = at(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 80) }) + P({ Size = V(24, 13, 1), CFrame = at(0, 7.5, 8), Material = Enum.Material.WoodPlanks, Color = wall }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 13, 17), CFrame = at(s * 11.5, 7.5, 0), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(1.5, 14.5, 1.5), CFrame = at(s * 11.6, 7.25, -8.3), Material = Enum.Material.Wood, Color = dark }) + end + P({ Size = V(26, 1, 19), CFrame = at(0, 14.5, 0), Material = Enum.Material.WoodPlanks, Color = dark }) + -- полосатый навес + for i = 0, 7 do + P({ + Size = V(3, 0.35, 6), + CFrame = at(-10.5 + i * 3, 13.1, -10.6) * CFrame.Angles(math.rad(-22), 0, 0), + Material = Enum.Material.Fabric, + Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, + }) + ball(at(-10.5 + i * 3, 11.9, -13.3).Position, 0.9, { Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, Material = Enum.Material.Fabric }) + end + -- прилавок + local counter = P({ Size = V(18, 4, 3), CFrame = at(0, 3, -4), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(19, 0.5, 3.8), CFrame = at(0, 5.25, -4), Material = Enum.Material.Wood, Color = dark }) + -- вывеска + local board = P({ Size = V(20, 4.5, 0.6), CFrame = at(0, 17.6, -9.2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 45, 30) }) + P({ Size = V(20.8, 5.3, 0.3), CFrame = at(0, 17.6, -8.9), Material = Enum.Material.Neon, Color = opt.glow }) + for _, x in ipairs({ -8, 8 }) do + P({ Size = V(0.6, 3, 0.6), CFrame = at(x, 15.5, -9.2), Material = Enum.Material.Wood, Color = dark }) + end + surfaceText(board, Enum.NormalId.Front, opt.title, opt.titleColor) + -- фонарики + for _, x in ipairs({ -9.5, 9.5 }) do + local l = P({ Size = V(0.8, 1.1, 0.8), CFrame = at(x, 11.2, -9.4), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 210, 140) }) + local light = Instance.new("PointLight") + light.Range = 14 + light.Brightness = 1 + light.Color = Color3.fromRGB(255, 210, 150) + light.Parent = l + end + -- бочки по бокам + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * 14.5, 2.6, -5).Position, 3.2, 2.6, { Color = Color3.fromRGB(130, 85, 50), Material = Enum.Material.Wood }) + vcyl(at(s * 14.5, 2.6, -5).Position, 0.3, 2.75, { Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal }) + end + + prompt(counter, opt.promptText, opt.promptObject, opt.action, 14) + if opt.npcName then + npc(opt.npcName, at(0, 4, 1.5), opt.npcColors) + end + if opt.decor then + opt.decor(at) + end + return counter +end + +local function portal(baseCF, title, color, worldId, locked) + local center = baseCF * CFrame.new(0, 10, 0) + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ + Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), + Material = Enum.Material.Slate, + Color = Color3.fromRGB(80, 85, 100), + }) + if i % 2 == 0 then + P({ + Size = V(0.6, 0.6, 1.9), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), + Material = Enum.Material.Neon, + Color = color, + }) + end + end + local disc = P({ + Name = "Portal_" .. worldId, + Shape = Enum.PartType.Cylinder, + Size = V(0.3, 2 * R - 1, 2 * R - 1), + CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, + Color = color, + Transparency = 0.3, + CanCollide = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc +end + +local function banner(pos, color, icon, text) + local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби + vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false }) + P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + local label = icon .. "\n" .. text + surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1)) +end + +local function arch(cf, span, height, title, color) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) }) + end + local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) }) + P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color }) + surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120)) + surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120)) +end + +---------------------------------------------------------------- ЛОББИ + +local FLOOR = 1 -- верх пола лобби + +P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) }) +P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) }) +P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) }) +-- дорожки-лучи к лавкам и порталам +for _, a in ipairs({ 0, 90, 180, 270 }) do + local r = math.rad(a) + P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) }) +end + +marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 50)) + +-- фонтан со статуей золотой рыбы +vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) +vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) +vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) }) +local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) +vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) +do + local statue = Models.buildFish("Gold", "Golden", 3.2, true) + statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40))) + statue.Parent = map + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 12 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.6, 0) + sp.Lifetime = NumberRange.new(1, 1.5) + sp.SpreadAngle = Vector2.new(180, 180) + sp.Speed = NumberRange.new(1, 2) + sp.Parent = statue.PrimaryPart + -- струи воды + local att = Instance.new("Attachment") + att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх + att.Orientation = V(0, 0, -90) -- направить струю вверх + att.Parent = bowl + local water = Instance.new("ParticleEmitter") + water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255)) + water.Transparency = NumberSequence.new(0.3, 1) + water.Size = NumberSequence.new(0.6, 1.2) + water.Rate = 60 + water.Lifetime = NumberRange.new(1.2, 1.5) + water.Speed = NumberRange.new(10, 12) + water.SpreadAngle = Vector2.new(25, 25) + water.Acceleration = V(0, -25, 0) + water.Parent = att +end +for i = 0, 5 do + local a = math.rad(i * 60 + 30) + bench(CFrame.lookAt(V(math.cos(a) * 17, FLOOR, math.sin(a) * 17), V(math.cos(a) * 30, FLOOR, math.sin(a) * 30))) +end + +-- фонари по кругу +for i = 0, 7 do + local a = math.rad(i * 45 + 22.5) + lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) +end + +-- клумбы с деревьями +for _, deg in ipairs({ 225, 315 }) do + local a = math.rad(deg) + local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58) + vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) }) + vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) }) + tree(p + V(0, 2, 0), "round") + for j = 1, 5 do + local b = rng:NextNumber(0, math.pi * 2) + ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] }) + end +end + +-- баннеры +local bannerData = { + { 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" }, + { 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" }, + { 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" }, + { 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" }, + { 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" }, + { 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" }, +} +for _, b in ipairs(bannerData) do + local a = math.rad(b[1]) + banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4]) +end + +-- живая изгородь по краю (с проходами) +for deg = 0, 359, 7 do + local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) + if not skip then + local a = math.rad(deg) + local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82) + P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) }) + end +end + +-- магазин (запад) и скупка (восток) +stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ", + titleColor = Color3.fromRGB(255, 230, 120), + wall = Color3.fromRGB(185, 130, 85), + stripeA = Color3.fromRGB(215, 55, 55), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(255, 170, 60), + action = "Shop", + promptText = "Открыть магазин", + promptObject = "Магазин", + npcName = "Продавец Михалыч", + npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) }, + decor = function(at) + -- витрина удочек на задней стене + for i, rod in ipairs(Config.Rods) do + local x = -8 + (i - 1) * 4 + local m = Models.buildRod(rod.id, 0, true) + m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0)) + m.Parent = map + local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) }) + surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180)) + end + end, +}) + +stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "💰 СКУПКА РЫБЫ", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(110, 150, 175), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Зина", + npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) }, + decor = function(at) + -- лёд с рыбой на прилавке + P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 }) + for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do + local f = Models.buildFish(id, nil, 0.9, true) + f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90))) + f.Parent = map + end + -- весы + P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) }) + -- ящики с уловом + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true) + f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0)) + f.Parent = map + end + end, +}) + +-- порталы во все миры и арка с названием +local portalCF = CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)) +arch(portalCF, 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) +for i, w in ipairs(Config.Worlds) do + local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") + portal(portalCF * CFrame.new(-27 + (i - 1) * 18, 0, 0), title, w.color, w.id, w.soon) +end + +-- невидимая стена по кругу: из лобби не уйти +for deg = 0, 359, 5 do + local a = math.rad(deg) + local p = V(math.cos(a) * 86, 30, math.sin(a) * 86) + P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false }) +end + +-- донат-лавки +stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "💎 ПРЕМИУМ", + titleColor = Color3.fromRGB(255, 220, 120), + wall = Color3.fromRGB(120, 70, 170), + stripeA = Color3.fromRGB(255, 200, 60), + stripeB = Color3.fromRGB(150, 80, 210), + glow = Color3.fromRGB(255, 200, 60), + action = "RobuxPasses", + promptText = "Открыть", + promptObject = "Премиум-пропуска", + npcName = "Барон Злотов", + npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) }, + decor = function(at) + -- сундук с самоцветами + P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) }) + P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do + P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c }) + end + P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) }) + end, +}) +stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "🪙 СОКРОВИЩНИЦА", + titleColor = Color3.fromRGB(255, 235, 140), + wall = Color3.fromRGB(200, 160, 70), + stripeA = Color3.fromRGB(230, 180, 40), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(255, 220, 90), + action = "RobuxProducts", + promptText = "Открыть", + promptObject = "Наборы монет", + npcName = "Купчиха Злата", + npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) }, + decor = function(at) + -- горки монет + for i = 0, 4 do + for j = 0, 3 - (i % 3) do + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) }) + end + end + for _, s in ipairs({ -1, 1 }) do + ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric }) + ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal }) + end + end, +}) + +-- сундук с ежедневной наградой +do + local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50)) + local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) }) + for _, x in ipairs({ -1.8, 1.8 }) do + P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + end + P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) }) + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 8 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.5, 0) + sp.Parent = base + billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260) + prompt(base, "Забрать", "Сундук", "Daily", 12) +end + +-- табличка «Как играть» +do + local pos = V(-14, FLOOR, 34) + local cf = CFrame.lookAt(pos, V(0, FLOOR, 50)) + for _, x in ipairs({ -6.5, 6.5 }) do + P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + surfaceText(board, Enum.NormalId.Front, + "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, клик у воды\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", + Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) +end + +---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО (детали) + +local function inLake(x, z, extra) + for _, l in ipairs(LAKES) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then + return true + end + end + return false +end + +-- прибытие +local arrive = W + V(0, GROUND_Y, 128) +marker("World1Spawn", CFrame.lookAt(arrive + V(0, 1, 0), arrive + V(0, 1, -10))) +arch(CFrame.new(W + V(0, GROUND_Y, 112)), 14, 11, "🌊 ТИХОЕ ОЗЕРО", Color3.fromRGB(80, 200, 255)) +portal(CFrame.lookAt(W + V(-26, GROUND_Y, 140), arrive), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") +stall(CFrame.lookAt(W + V(30, GROUND_Y, 140), arrive), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(150, 115, 80), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Гриша", + npcColors = { skin = Color3.fromRGB(200, 150, 110), shirt = Color3.fromRGB(70, 130, 80), pants = Color3.fromRGB(60, 50, 40), hat = Color3.fromRGB(200, 170, 110) }, +}) + +-- доска «Кто водится в озере» +do + local pos = W + V(-16, GROUND_Y, 104) + local cf = CFrame.lookAt(pos, W + V(0, GROUND_Y, 120)) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + local lines = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } + for _, f in ipairs(Config.Zones.World1.fish) do + local r = Config.Rarities[f.rarity] + table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) + end + surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) +end + +-- костёр с брёвнами +do + local c = W + V(14, GROUND_Y, 118) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local fireBase = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = fireBase + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = fireBase + for _, a in ipairs({ 0, 2.1, 4.2 }) do + local p = c + V(math.cos(a) * 6, 0.6, math.sin(a) * 6) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 1.4, 1.4), CFrame = CFrame.lookAt(p, c) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(115, 80, 50) }) + end +end + +-- дед-рыбак с подсказками +npc("Дед Петрович", CFrame.lookAt(W + V(-7, GROUND_Y + 3, 80), W + V(0, GROUND_Y + 3, 95)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(110, 120, 80), pants = Color3.fromRGB(70, 60, 45), hat = Color3.fromRGB(90, 110, 60), +}, "Talk", "Поговорить") + +-- домик рыбака +do + local cf = CFrame.lookAt(W + V(-34, GROUND_Y, 100), W + V(0, GROUND_Y, 100)) + local logC = Color3.fromRGB(130, 90, 55) + P({ Size = V(14, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(110, 80, 50) }) + P({ Size = V(14, 8, 1), CFrame = cf * CFrame.new(0, 5, 5.5), Material = Enum.Material.Wood, Color = logC }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 8, 12), CFrame = cf * CFrame.new(s * 6.5, 5, 0), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(5, 8, 1), CFrame = cf * CFrame.new(s * 4.5, 5, -5.5), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(16, 1, 8.8), CFrame = cf * CFrame.new(0, 11.2, s * 3.4) * CFrame.Angles(math.rad(-s * 38), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 60, 45) }) + end + P({ Size = V(4, 2, 1), CFrame = cf * CFrame.new(0, 8, -5.5), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(2.2, 2, 0.3), CFrame = cf * CFrame.new(-4.5, 5.5, -6.05), Material = Enum.Material.Glass, Color = Color3.fromRGB(255, 225, 150), Transparency = 0.2 }) + P({ Size = V(14, 3, 1), CFrame = cf * CFrame.new(0, 10.5, 5.5), Material = Enum.Material.Wood, Color = logC }) +end + +-- причалы +local function pier(center, size) + P({ Size = size, Position = center, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local alongZ = size.Z > size.X + local len = alongZ and size.Z or size.X + local wid = alongZ and size.X or size.Z + for d = -len / 2 + 1, len / 2 - 1, 6 do + for _, s in ipairs({ -1, 1 }) do + local off = alongZ and V(s * (wid / 2 - 0.4), 0, d) or V(d, 0, s * (wid / 2 - 0.4)) + vcyl(center + off + V(0, -6, 0), 13, 0.9, { Color = Color3.fromRGB(100, 70, 45), Material = Enum.Material.Wood }) + end + end +end +pier(W + V(0, GROUND_Y + 0.2, 58), V(8, 0.6, 42)) +pier(W + V(-86, GROUND_Y + 0.2, 15), V(34, 0.6, 7)) +pier(W + V(86, GROUND_Y + 0.2, -10), V(34, 0.6, 7)) +lamp(W + V(-3.5, GROUND_Y + 0.5, 40), Color3.fromRGB(255, 220, 160)) +lamp(W + V(-70, GROUND_Y + 0.5, 18), Color3.fromRGB(255, 220, 160)) +lamp(W + V(70, GROUND_Y + 0.5, -13), Color3.fromRGB(255, 220, 160)) + +-- лодка у западного причала +do + local cf = CFrame.new(W + V(-74, WATER_Y + 0.3, 24)) * CFrame.Angles(0, math.rad(15), 0) + local hull = Color3.fromRGB(170, 70, 50) + P({ Size = V(4, 0.5, 9), CFrame = cf, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.4, 1.4, 9), CFrame = cf * CFrame.new(s * 2, 0.7, 0), Material = Enum.Material.Wood, Color = hull }) + P({ Size = V(4.4, 1.4, 0.4), CFrame = cf * CFrame.new(0, 0.7, s * 4.5), Material = Enum.Material.Wood, Color = hull }) + end + P({ Size = V(4, 0.3, 1.2), CFrame = cf * CFrame.new(0, 1, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) +end + +-- кувшинки и камыши +for _, l in ipairs(LAKES) do + for _ = 1, 7 do + local a, d = rng:NextNumber(0, math.pi * 2), rng:NextNumber(6, l[3] - 5) + local x, z = l[1] + math.cos(a) * d, l[2] + math.sin(a) * d + local size = rng:NextNumber(2, 3.5) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.28, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(70, 150, 60), CanCollide = false }) + if rng:NextNumber() < 0.4 then + ball(W + V(x + 0.3, WATER_Y + 0.55, z), 0.7, { Color = Color3.fromRGB(255, 150, 190), CanCollide = false }) + end + end + for _ = 1, 9 do + local a = rng:NextNumber(0, math.pi * 2) + local x, z = l[1] + math.cos(a) * (l[3] + 1.2), l[2] + math.sin(a) * (l[3] + 1.2) + local inOther = false + for _, o in ipairs(LAKES) do + if o ~= l and (V(x, 0, z) - V(o[1], 0, o[2])).Magnitude < o[3] + 1 then + inOther = true + end + end + if not inOther and not (math.abs(x) < 6 and z > 30) then + for _ = 1, 5 do + local h = rng:NextNumber(3, 5) + local p = W + V(x + rng:NextNumber(-1.2, 1.2), WATER_Y + h / 2 - 0.5, z + rng:NextNumber(-1.2, 1.2)) + P({ Size = V(0.18, h, 0.18), Position = p, Color = Color3.fromRGB(85, 130, 50), CanCollide = false }) + P({ Size = V(0.35, 0.9, 0.35), Position = p + V(0, h / 2 - 0.3, 0), Color = Color3.fromRGB(110, 70, 40), CanCollide = false }) + end + end + end +end + +-- деревья, кусты, камни +local function freeSpot(x, z) + if inLake(x, z, 14) then + return false + end + if (V(x, 0, z) - V(0, 0, 128)).Magnitude < 34 then + return false + end + if math.abs(x) < 9 and z > 70 and z < 125 then + return false + end + if (V(x, 0, z) - V(-34, 0, 100)).Magnitude < 14 then + return false + end + return true +end + +local placed = 0 +for _ = 1, 400 do + if placed >= 110 then + break + end + local x, z = rng:NextNumber(-230, 230), rng:NextNumber(-230, 230) + if freeSpot(x, z) then + local y = groundY(W.X + x, W.Z + z) + local roll = rng:NextNumber() + tree(W + V(x, y - 0.5, z), roll < 0.35 and "pine" or (roll < 0.5 and "birch" or "round")) + placed += 1 + end +end +for _ = 1, 60 do + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if freeSpot(x, z) then + bush(W + V(x, groundY(W.X + x, W.Z + z) - 0.6, z)) + end +end +for _, l in ipairs(LAKES) do + for _ = 1, 4 do + local a = rng:NextNumber(0, math.pi * 2) + local x, z = l[1] + math.cos(a) * (l[3] + 8), l[2] + math.sin(a) * (l[3] + 8) + if not inLake(x, z, 3) and not (math.abs(x) < 8 and z > 30) then + local s = rng:NextNumber(2.5, 5) + P({ Size = V(s, s * 0.7, s * 0.9), CFrame = CFrame.new(W + V(x, groundY(W.X + x, W.Z + z), z)) * CFrame.Angles(rng:NextNumber(0, 1), rng:NextNumber(0, 6), rng:NextNumber(0, 1)), Material = Enum.Material.Rock, Color = Color3.fromRGB(125, 125, 130) }) + end + end +end + +-- фонари вдоль дорожки +for _, z in ipairs({ 84, 100 }) do + lamp(W + V(6, GROUND_Y, z)) + lamp(W + V(-6, GROUND_Y, z)) +end + +-- невидимые стены по краю мира +for _, w in ipairs({ + { V(0, 0, 245), V(500, 120, 2) }, + { V(0, 0, -245), V(500, 120, 2) }, + { V(245, 0, 0), V(2, 120, 500) }, + { V(-245, 0, 0), V(2, 120, 500) }, +}) do + P({ Size = w[2], Position = W + w[1] + V(0, 40, 0), Transparency = 1 }) +end + +---------------------------------------------------------------- помощники для новых миров + +local function cylA(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) +end + +local function worldWalls(center) + for _, w in ipairs({ + { V(0, 0, 245), V(500, 160, 2) }, + { V(0, 0, -245), V(500, 160, 2) }, + { V(245, 0, 0), V(2, 160, 500) }, + { V(-245, 0, 0), V(2, 160, 500) }, + }) do + P({ Size = w[2], Position = center + w[1] + V(0, 60, 0), Transparency = 1, CanQuery = false }) + end +end + +local function bestiary(pos, lookAt, worldId, title, titleHex) + local cf = CFrame.lookAt(pos, lookAt) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + local lines = { ("%s"):format(titleHex, title) } + for _, f in ipairs(Config.Zones[worldId].fish) do + local r = Config.Rarities[f.rarity] + table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) + end + surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) +end + +local function campfire(c) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local base = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = base + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = base +end + +local function torch(pos) + cylA(pos, pos + V(0, 5, 0), 0.35, { Color = Color3.fromRGB(170, 130, 70), Material = Enum.Material.Wood }) + local top = P({ Size = V(0.8, 0.8, 0.8), Position = pos + V(0, 5.3, 0), Color = Color3.fromRGB(90, 60, 30), Material = Enum.Material.Wood }) + local fire = Instance.new("Fire") + fire.Size = 3 + fire.Heat = 6 + fire.Parent = top + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 170, 90) + light.Range = 14 + light.Parent = top +end + +---------------------------------------------------------------- МИР 2: ТРОПИЧЕСКИЙ ОСТРОВ + +do + local W2 = Config.Worlds[2].center + local leafColors = { Color3.fromRGB(60, 160, 60), Color3.fromRGB(85, 185, 70) } + + -- море, мелководье уступами, песчаный пляж, зелёный остров, холм + terrain:FillBlock(CFrame.new(W2 + V(0, -34, 0)), V(520, 8, 520), Enum.Material.Sand) + terrain:FillBlock(CFrame.new(W2 + V(0, -15, 0)), V(520, 30, 520), Enum.Material.Water) + terrain:FillCylinder(CFrame.new(W2 + V(0, -17, 0)), 28, 140, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -15, 0)), 32, 118, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -14, 0)), 34, 106, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -13.5, 0)), 35, 88, Enum.Material.Grass) + terrain:FillBall(W2 + V(20, -20, -30), 32, Enum.Material.Grass) + terrain:FillCylinder(CFrame.new(W2 + V(0, 2, 40)), 4, 14, Enum.Material.Sandstone) + + local function palm(pos) + local h = rng:NextNumber(12, 18) + local a = rng:NextNumber(0, math.pi * 2) + local dir = V(math.cos(a), 0, math.sin(a)) + local p = pos + for i = 1, 6 do + local t = i / 6 + local q = pos + V(0, h * t, 0) + dir * (t * t * h * 0.3) + local d = 1.4 - t * 0.45 + cylA(p, q, d, { Color = Color3.fromRGB(150, 115, 70), Material = Enum.Material.Wood }) + ball(q, d, { Color = Color3.fromRGB(130, 100, 60), Material = Enum.Material.Wood }) + p = q + end + for k = 0, 7 do + local b = k / 8 * math.pi * 2 + rng:NextNumber(-0.2, 0.2) + local ld = V(math.cos(b), 0, math.sin(b)) + local mid = p + ld * 3.5 + V(0, 0.8, 0) + local tipP = p + ld * 7 + V(0, -2.2, 0) + for _, seg in ipairs({ { p, mid }, { mid, tipP } }) do + P({ Size = V(2, 0.15, (seg[2] - seg[1]).Magnitude), CFrame = CFrame.lookAt((seg[1] + seg[2]) / 2, seg[2]), Material = Enum.Material.Grass, Color = leafColors[k % 2 + 1], CanCollide = false }) + end + end + for _ = 1, 3 do + ball(p + V(rng:NextNumber(-0.7, 0.7), -0.7, rng:NextNumber(-0.7, 0.7)), 0.9, { Color = Color3.fromRGB(110, 75, 40) }) + end + end + + local function tikiHut(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Size = V(12, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 75) }) + for _, c in ipairs({ { -5, -5 }, { 5, -5 }, { -5, 5 }, { 5, 5 } }) do + vcyl((cf * CFrame.new(c[1], 4.5, c[2])).Position, 8, 0.8, { Color = Color3.fromRGB(200, 175, 100), Material = Enum.Material.Wood }) + end + for i = 0, 4 do + vcyl((cf * CFrame.new(0, 8.8 + i * 1.2, 0)).Position, 1.4, 16 - i * 3.2, { Color = Color3.fromRGB(205, 170, 95), Material = Enum.Material.Grass }) + end + local bar = P({ Size = V(7, 3, 1.5), CFrame = cf * CFrame.new(0, 2.5, -3), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 95, 55) }) + billboard(bar, "🍹", Color3.new(1, 1, 1), 3, 60) + end + + local function umbrella(pos, color) + cylA(pos, pos + V(0, 7, 0), 0.25, { Color = Color3.fromRGB(235, 235, 235), Material = Enum.Material.Metal }) + vcyl(pos + V(0, 7, 0), 0.6, 9, { Color = color, Material = Enum.Material.Fabric }) + vcyl(pos + V(0, 7.5, 0), 0.6, 4.5, { Color = Color3.new(1, 1, 1), Material = Enum.Material.Fabric }) + P({ Size = V(2.2, 0.5, 6), CFrame = CFrame.new(pos + V(3.5, 0.6, 0)) * CFrame.Angles(0, rng:NextNumber(-0.5, 0.5), 0), Color = Color3.fromRGB(245, 245, 240), Material = Enum.Material.Fabric }) + P({ Size = V(2.25, 0.52, 1.2), CFrame = CFrame.new(pos + V(3.5, 0.62, 1.5)), Color = color, Material = Enum.Material.Fabric }) + end + + local coralColors = { Color3.fromRGB(255, 110, 150), Color3.fromRGB(255, 150, 60), Color3.fromRGB(170, 90, 255), Color3.fromRGB(255, 220, 80), Color3.fromRGB(80, 220, 200) } + local function coral(pos) + local c = coralColors[rng:NextInteger(1, #coralColors)] + for _ = 1, rng:NextInteger(3, 5) do + local dir = V(rng:NextNumber(-0.5, 0.5), 1, rng:NextNumber(-0.5, 0.5)).Unit + local h = rng:NextNumber(1.5, 3.5) + cylA(pos, pos + dir * h, 0.45, { Color = c, CanCollide = false }) + ball(pos + dir * h, 0.75, { Color = c:Lerp(Color3.new(1, 1, 1), 0.3), CanCollide = false }) + end + end + + local function starfish(pos) + local c = Color3.fromRGB(255, rng:NextInteger(90, 150), 60) + ball(pos, 0.7, { Color = c, CanCollide = false }) + for k = 0, 4 do + local a = k / 5 * math.pi * 2 + P({ Size = V(0.35, 0.2, 1.1), CFrame = CFrame.new(pos) * CFrame.Angles(0, a, 0) * CFrame.new(0, 0, -0.6), Color = c, CanCollide = false }) + end + end + + local spawn2 = W2 + V(0, 4, 40) + marker("World2Spawn", CFrame.lookAt(spawn2 + V(0, 1, 0), spawn2 + V(0, 1, -10))) + arch(CFrame.new(W2 + V(0, 4, 24)), 14, 11, "🏝 ТРОПИЧЕСКИЙ ОСТРОВ", Color3.fromRGB(255, 190, 70)) + portal(CFrame.lookAt(W2 + V(-32, 4, 60), spawn2), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W2 + V(32, 4, 62), spawn2), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 220), + wall = Color3.fromRGB(200, 170, 110), + stripeA = Color3.fromRGB(40, 180, 170), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(80, 230, 200), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Мигель", + npcColors = { skin = Color3.fromRGB(190, 140, 100), shirt = Color3.fromRGB(240, 120, 60), pants = Color3.fromRGB(240, 230, 200), hat = Color3.fromRGB(230, 210, 150) }, + }) + bestiary(W2 + V(-18, 4, 22), spawn2, "World2", "🐠 КТО ВОДИТСЯ У ОСТРОВА", "#FFD27A") + npc("Капитан Боря", CFrame.lookAt(W2 + V(10, 6, 100), W2 + V(0, 6, 120)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(240, 240, 240), pants = Color3.fromRGB(30, 40, 80), hat = Color3.fromRGB(30, 30, 60), + }, "Talk", "Поговорить") + + pier(W2 + V(0, 3.2, 125), V(8, 0.6, 50)) + pier(W2 + V(125, 3.2, -10), V(50, 0.6, 8)) + for _, z in ipairs({ 105, 125, 145 }) do + torch(W2 + V(4.5, 3.5, z)) + end + for _, x in ipairs({ 110, 140 }) do + torch(W2 + V(x, 3.5, -14.5)) + end + tikiHut(W2 + V(-50, groundY(W2.X - 50, W2.Z - 20), -20), W2) + tikiHut(W2 + V(-20, groundY(W2.X - 20, W2.Z - 65), -65), W2) + campfire(W2 + V(-10, 4, 55)) + for _, deg in ipairs({ 200, 222, 318, 340 }) do + local a = math.rad(deg) + local x, z = math.cos(a) * 99, math.sin(a) * 99 + umbrella(W2 + V(x, groundY(W2.X + x, W2.Z + z), z), coralColors[rng:NextInteger(1, #coralColors)]) + end + + local function free2(x, z) + local r = math.sqrt(x * x + z * z) + if r > 100 then + return false + end + if (V(x, 0, z) - V(0, 0, 45)).Magnitude < 28 then + return false + end + for _, p in ipairs({ { 32, 62 }, { -32, 60 }, { -50, -20 }, { -20, -65 }, { -18, 22 }, { -10, 55 } }) do + if (V(x, 0, z) - V(p[1], 0, p[2])).Magnitude < 16 then + return false + end + end + return true + end + local count = 0 + for _ = 1, 300 do + if count >= 40 then + break + end + local x, z = rng:NextNumber(-100, 100), rng:NextNumber(-100, 100) + if free2(x, z) then + palm(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.5, z)) + count += 1 + end + end + for _ = 1, 35 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(121, 138) + local x, z = math.cos(a) * r, math.sin(a) * r + if not (math.abs(x) < 8 and z > 0) and not (math.abs(z + 10) < 8 and x > 0) then + coral(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.3, z)) + end + end + for _ = 1, 12 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(107, 115) + local x, z = math.cos(a) * r, math.sin(a) * r + starfish(W2 + V(x, groundY(W2.X + x, W2.Z + z) + 0.1, z)) + end + worldWalls(W2) +end + +---------------------------------------------------------------- МИР 3: ЛЕДЯНОЙ ФЬОРД + +do + local W3 = Config.Worlds[3].center + local LAKES3 = Config.Worlds[3].lakes + local HOLES = Config.Worlds[3].holes + + terrain:FillBlock(CFrame.new(W3 + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Snow) + for i = 0, 13 do + local a = i / 14 * math.pi * 2 + local r = rng:NextNumber(215, 235) + local rad = rng:NextNumber(50, 70) + local c = W3 + V(math.cos(a) * r, -15, math.sin(a) * r) + terrain:FillBall(c, rad, Enum.Material.Rock) + terrain:FillBall(c + V(0, rad * 0.35, 0), rad * 0.7, Enum.Material.Snow) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], 16, l[2])), 30, l[3] + 4, Enum.Material.Air) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -19, l[2])), 10, l[3], Enum.Material.Mud) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -1, l[2])), 4, l[3], Enum.Material.Glacier) + end + for _, h in ipairs(HOLES) do + terrain:FillCylinder(CFrame.new(W3 + V(h[1], -1, h[2])), 4, 6, Enum.Material.Water) + end + + local function snowPine(pos) + local h = rng:NextNumber(8, 13) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(90, 62, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + local s = 10 - i * 2.2 + local y = h * 0.4 + i * 2.8 + ball(pos + V(0, y, 0), s, { Color = Color3.fromRGB(35, 85 + i * 8, 60), Material = Enum.Material.Grass }) + ball(pos + V(0, y + s * 0.3, 0), s * 0.75, { Color = Color3.fromRGB(240, 245, 255), Material = Enum.Material.Snow }) + end + end + + local function igloo(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Shape = Enum.PartType.Ball, Size = V(14, 14, 14), CFrame = cf, Material = Enum.Material.Snow, Color = Color3.fromRGB(240, 245, 255) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 5, 5), CFrame = cf * CFrame.new(0, 1.2, -7) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Snow, Color = Color3.fromRGB(235, 240, 250) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 3.6, 3.6), CFrame = cf * CFrame.new(0, 1.2, -9.55) * CFrame.Angles(0, math.rad(90), 0), Color = Color3.fromRGB(20, 25, 35) }) + end + + local function tent(pos, look) + local cf = CFrame.lookAt(pos, look) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.2, 5, 6), CFrame = cf * CFrame.new(s * 1.6, 2.2, 0) * CFrame.Angles(0, 0, math.rad(s * 35)), Material = Enum.Material.Fabric, Color = Color3.fromRGB(230, 110, 40) }) + end + vcyl((cf * CFrame.new(0, 0.9, -4.5)).Position, 1.6, 1.4, { Color = Color3.fromRGB(110, 80, 50), Material = Enum.Material.Wood }) + end + + local function crystal(pos) + for _ = 1, 5 do + local h = rng:NextNumber(3, 8) + P({ + Size = V(1.2, h, 1.2), + CFrame = CFrame.new(pos + V(rng:NextNumber(-2, 2), h / 2 - 0.5, rng:NextNumber(-2, 2))) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 3), rng:NextNumber(-0.4, 0.4)), + Material = Enum.Material.Neon, Color = Color3.fromRGB(140, 230, 255), Transparency = 0.15, + }) + end + end + + local function snowman(pos) + ball(pos + V(0, 2, 0), 4, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 5, 0), 3, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 7.3, 0), 2.2, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + cylA(pos + V(0, 7.3, -1), pos + V(0, 7.2, -2), 0.3, { Color = Color3.fromRGB(255, 130, 30) }) + for _, x in ipairs({ -0.4, 0.4 }) do + ball(pos + V(x, 7.7, -0.95), 0.3, { Color = Color3.fromRGB(20, 20, 20) }) + end + vcyl(pos + V(0, 8.6, 0), 1.2, 1.4, { Color = Color3.fromRGB(30, 30, 35) }) + vcyl(pos + V(0, 8.1, 0), 0.2, 2.2, { Color = Color3.fromRGB(30, 30, 35) }) + end + + -- лунки: льдинки по краю и флажки + for i, h in ipairs(HOLES) do + local c = W3 + V(h[1], 1.2, h[2]) + for k = 0, 7 do + local a = k / 8 * math.pi * 2 + P({ Size = V(1.2, 0.6, 1.2), CFrame = CFrame.new(c + V(math.cos(a) * 6.6, 0, math.sin(a) * 6.6)) * CFrame.Angles(0, a, 0.2), Material = Enum.Material.Ice, Color = Color3.fromRGB(200, 235, 255) }) + end + if i % 3 == 1 then + cylA(c + V(6, -0.2, 6), c + V(6, 4, 6), 0.15, { Color = Color3.fromRGB(80, 60, 40) }) + P({ Size = V(1.4, 0.9, 0.1), Position = c + V(6.75, 3.5, 6), Material = Enum.Material.Fabric, Color = Color3.fromRGB(220, 40, 40) }) + end + if i % 4 == 0 then + tent(c + V(-9, -0.2, 0), c) + end + end + + local spawn3 = W3 + V(0, 4, 120) + marker("World3Spawn", CFrame.lookAt(spawn3 + V(0, 1, 0), spawn3 + V(0, 1, -10))) + arch(CFrame.new(W3 + V(0, 4, 104)), 14, 11, "❄ ЛЕДЯНОЙ ФЬОРД", Color3.fromRGB(150, 220, 255)) + portal(CFrame.lookAt(W3 + V(-32, 4, 140), spawn3), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W3 + V(32, 4, 138), spawn3), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(180, 230, 255), + wall = Color3.fromRGB(120, 95, 75), + stripeA = Color3.fromRGB(60, 120, 200), + stripeB = Color3.fromRGB(245, 250, 255), + glow = Color3.fromRGB(140, 210, 255), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Нина", + npcColors = { skin = Color3.fromRGB(240, 205, 175), shirt = Color3.fromRGB(180, 40, 50), pants = Color3.fromRGB(40, 40, 60), hat = Color3.fromRGB(240, 240, 250) }, + }) + bestiary(W3 + V(-20, 4, 100), spawn3, "World3", "❄ КТО ВОДИТСЯ ПОДО ЛЬДОМ", "#BFEAFF") + npc("Полярник Саша", CFrame.lookAt(W3 + V(12, 7, 88), W3 + V(0, 7, 60)), { + skin = Color3.fromRGB(230, 190, 160), shirt = Color3.fromRGB(230, 120, 30), pants = Color3.fromRGB(50, 55, 70), hat = Color3.fromRGB(200, 40, 40), + }, "Talk", "Поговорить") + igloo(W3 + V(-45, 4, 95), W3 + V(0, 4, 110)) + campfire(W3 + V(20, 4, 108)) + snowman(W3 + V(42, 4, 100)) + for _, p in ipairs({ { -85, -45 }, { 90, 30 }, { -25, -110 }, { 70, -90 }, { -95, 60 } }) do + crystal(W3 + V(p[1], groundY(W3.X + p[1], W3.Z + p[2]), p[2])) + end + + local function free3(x, z) + for _, l in ipairs(LAKES3) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + 12 then + return false + end + end + if (V(x, 0, z) - V(0, 0, 120)).Magnitude < 40 then + return false + end + if (V(x, 0, z) - V(-45, 0, 95)).Magnitude < 14 then + return false + end + return true + end + local count = 0 + for _ = 1, 400 do + if count >= 80 then + break + end + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if free3(x, z) then + snowPine(W3 + V(x, groundY(W3.X + x, W3.Z + z) - 0.5, z)) + count += 1 + end + end + + -- северное сияние + for i = 0, 7 do + P({ + Size = V(55, 26, 0.6), + CFrame = CFrame.new(W3 + V(-175 + i * 50, 150 + math.sin(i * 1.3) * 10, -150 + math.cos(i * 0.9) * 25)) * CFrame.Angles(math.rad(10), math.rad(i * 8 - 28), 0), + Material = Enum.Material.Neon, + Color = (i % 3 == 0) and Color3.fromRGB(170, 90, 255) or Color3.fromRGB(80, 255, 170), + Transparency = 0.6, CanCollide = false, CanQuery = false, CastShadow = false, + }) + end + worldWalls(W3) +end + +---------------------------------------------------------------- проверка воды +-- Если вода в террейне не создалась (бывает в некоторых плейсах/настройках), +-- ставим поверхность воды из деталей, чтобы озёра и море точно были видны. + +local function terrainHasWater(pos) + local region = Region3.new(pos - V(2, 2, 2), pos + V(2, 2, 2)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + if not ok then + return true + end + for _, plane in ipairs(mats) do + for _, column in ipairs(plane) do + for _, m in ipairs(column) do + if m == Enum.Material.Water then + return true + end + end + end + end + return false +end + +local function waterPlane(pos, diameter, color) + return P({ + Name = "WaterSurface", + Shape = Enum.PartType.Cylinder, + Size = V(0.4, diameter, diameter), + CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)), + Color = color, + Material = Enum.Material.SmoothPlastic, + Reflectance = 0.08, + CanCollide = false, + CanQuery = false, + CanTouch = false, + CastShadow = false, + }) +end + +do + local w1, w2, w3 = Config.Worlds[1], Config.Worlds[2], Config.Worlds[3] + if not terrainHasWater(w1.center + V(0, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 1 не создалась — ставлю запасную поверхность воды") + waterPlane(w1.center + V(0, w1.waterY, 0), 490, Color3.fromRGB(30, 120, 150)) + end + if not terrainHasWater(w2.center + V(180, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 2 не создалась — ставлю запасную поверхность воды") + waterPlane(w2.center + V(0, w2.waterY, 0), 500, Color3.fromRGB(40, 180, 190)) + end + local h = w3.holes[1] + if not terrainHasWater(w3.center + V(h[1], -1, h[2])) then + warn("[MapBuilder] Вода в лунках Мира 3 не создалась — ставлю запасную поверхность воды") + for _, hole in ipairs(w3.holes) do + waterPlane(w3.center + V(hole[1], w3.waterY + 0.05, hole[2]), w3.holeRadius * 2, Color3.fromRGB(25, 75, 110)) + end + end +end diff --git a/src/StarterPlayer/StarterPlayerScripts/FishingClient.client.lua b/src/StarterPlayer/StarterPlayerScripts/FishingClient.client.lua new file mode 100644 index 0000000..7ed6e80 --- /dev/null +++ b/src/StarterPlayer/StarterPlayerScripts/FishingClient.client.lua @@ -0,0 +1,1279 @@ +-- FishingClient (LocalScript) -> StarterPlayer > StarterPlayerScripts +-- Интерфейс: HUD, сумка, коллекция с наградами, миры, задания, ежедневная награда, +-- магазин, улучшения, удача, донат, событие, мини-игра, атмосфера миров. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") +local UserInputService = game:GetService("UserInputService") +local MarketplaceService = game:GetService("MarketplaceService") +local Lighting = game:GetService("Lighting") + +local player = Players.LocalPlayer +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local remote = ReplicatedStorage:WaitForChild("GameEvent") + +---------------------------------------------------------------- стиль + +local C = { + bg = Color3.fromRGB(18, 24, 40), + panel = Color3.fromRGB(30, 38, 62), + panel2 = Color3.fromRGB(44, 56, 90), + gold = Color3.fromRGB(255, 200, 70), + green = Color3.fromRGB(60, 190, 95), + blue = Color3.fromRGB(60, 135, 230), + red = Color3.fromRGB(215, 65, 65), + purple = Color3.fromRGB(150, 90, 220), + grey = Color3.fromRGB(75, 82, 102), + text = Color3.new(1, 1, 1), + muted = Color3.fromRGB(170, 180, 205), + line = Color3.fromRGB(90, 110, 165), +} +local TITLE = Enum.Font.FredokaOne +local BODY = Enum.Font.GothamBold +local BODY2 = Enum.Font.GothamMedium +local WHITE, BLACK = Color3.new(1, 1, 1), Color3.new(0, 0, 0) +local DING = "rbxasset://sounds/electronicpingshort.wav" + +---------------------------------------------------------------- помощники UI + +local function new(class, props, children) + local obj = Instance.new(class) + local parent + for k, v in pairs(props or {}) do + if k == "Parent" then + parent = v + else + obj[k] = v + end + end + for _, c in ipairs(children or {}) do + c.Parent = obj + end + if parent then + obj.Parent = parent + end + return obj +end +local function corner(r) + return new("UICorner", { CornerRadius = UDim.new(0, r or 10) }) +end +local function stroke(color, th, tr) + return new("UIStroke", { Color = color, Thickness = th or 2, Transparency = tr or 0, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }) +end +local function gradient(a, b, rot) + return new("UIGradient", { Color = ColorSequence.new(a, b), Rotation = rot or 90 }) +end +local function text(props) + local d = { + BackgroundTransparency = 1, Font = BODY, TextColor3 = C.text, TextSize = 16, + TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Center, + } + for k, v in pairs(props) do + d[k] = v + end + return new("TextLabel", d) +end +local function btn(props, onClick) + local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "" } + for k, v in pairs(props) do + d[k] = v + end + local b = new("TextButton", d, { corner(10), new("UIGradient", { Color = ColorSequence.new(WHITE, Color3.fromRGB(195, 195, 195)), Rotation = 90 }) }) + if onClick then + b.MouseButton1Click:Connect(onClick) + end + return b +end +local function clear(container) + for _, c in ipairs(container:GetChildren()) do + if c:IsA("GuiObject") then + c:Destroy() + end + end +end +local function fmt(n) + local s = tostring(math.floor(n)) + local out = s:reverse():gsub("(%d%d%d)", "%1 "):reverse() + return (out:gsub("^ ", "")) +end +local function stars(n) + return string.rep("★", n) .. string.rep("☆", Config.RodUpgrade.maxLevel - n) +end +local function hex(c) + return "#" .. c:ToHex() +end +local function timeStr(sec) + sec = math.max(0, math.floor(sec)) + return ("%d:%02d"):format(math.floor(sec / 60), sec % 60) +end +local function attrSet(name) + local set = {} + for id in string.gmatch(player:GetAttribute(name) or "", "[^,]+") do + set[id] = true + end + return set +end +local function rodLevels() + local t = {} + for id, lv in string.gmatch(player:GetAttribute("RodLevels") or "", "([^,:]+):(%d+)") do + t[id] = tonumber(lv) + end + return t +end +local function playUiSound(id, vol) + local s = Instance.new("Sound") + s.SoundId = id + s.Volume = vol or 0.5 + s.Parent = workspace.CurrentCamera + s:Play() + game:GetService("Debris"):AddItem(s, 3) +end + +local function viewport(parent, model, dir, zoom) + local vf = new("ViewportFrame", { + Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, + Ambient = Color3.fromRGB(175, 175, 185), LightColor = WHITE, LightDirection = Vector3.new(-0.4, -1, -0.6), + Parent = parent, + }) + model.Parent = vf + local cf, size = model:GetBoundingBox() + local cam = Instance.new("Camera") + cam.FieldOfView = 30 + local dist = (size.Magnitude / 2) / math.tan(math.rad(15)) * (zoom or 0.9) + cam.CFrame = CFrame.lookAt(cf.Position + dir.Unit * dist, cf.Position) + cam.Parent = vf + vf.CurrentCamera = cam + return vf +end +local FISH_VIEW = Vector3.new(0.12, 0.15, 1) +local ROD_VIEW = Vector3.new(1, 0.1, 0.05) +local BAG_VIEW = Vector3.new(0.6, 0.25, 1) + +local function silhouette(model) + for _, p in ipairs(model:GetDescendants()) do + if p:IsA("BasePart") then + p.Color = Color3.fromRGB(10, 12, 20) + p.Material = Enum.Material.SmoothPlastic + elseif p:IsA("ParticleEmitter") or p:IsA("PointLight") then + p:Destroy() + end + end + return model +end + +---------------------------------------------------------------- корень + +local gui = new("ScreenGui", { + Name = "FishingUI", ResetOnSpawn = false, IgnoreGuiInset = false, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), +}) + +---------------------------------------------------------------- HUD + +local hud = new("Frame", { + Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = gui, +}, { corner(16), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90), + new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14), PaddingTop = UDim.new(0, 10) }) }) +local coinsText = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 30, TextColor3 = C.gold, Text = "💰 0", TextStrokeTransparency = 0.6, Parent = hud }) +local lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Parent = hud }, + { corner(18), gradient(Color3.fromRGB(255, 225, 110), Color3.fromRGB(235, 145, 30), 90), stroke(Color3.fromRGB(120, 70, 10), 2, 0.2) }) +local lvlText = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = Color3.fromRGB(70, 40, 0), Text = "1", Parent = lvlBadge }) +local xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = hud }, { corner(9) }) +local xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = xpBack }, { corner(9), gradient(Color3.fromRGB(110, 225, 255), Color3.fromRGB(60, 110, 255), 0) }) +local xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = xpBack }) +local luckText = text({ Size = UDim2.new(1, 0, 0, 22), Position = UDim2.fromOffset(0, 82), TextSize = 16, RichText = true, TextColor3 = Color3.fromRGB(130, 255, 150), Text = "", Parent = hud }) +local bagText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud }) +local rodText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128), TextSize = 14, Font = BODY2, TextColor3 = C.muted, RichText = true, Text = "", Parent = hud }) + +-- баннер события (справа сверху) +local eventBanner = new("Frame", { + Size = UDim2.fromOffset(280, 58), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(14), stroke(C.gold, 2, 0.1), gradient(Color3.fromRGB(90, 60, 20), C.bg, 90) }) +local eventTitle = text({ Size = UDim2.new(1, -20, 0, 26), Position = UDim2.fromOffset(12, 4), Font = TITLE, TextSize = 19, TextColor3 = C.gold, Text = "", Parent = eventBanner }) +local eventDesc = text({ Size = UDim2.new(1, -20, 0, 20), Position = UDim2.fromOffset(12, 30), Font = BODY2, TextSize = 13, TextColor3 = C.text, Text = "", Parent = eventBanner }) + +-- кнопки слева +local side = new("Frame", { + Size = UDim2.fromOffset(70, 380), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 12, 0.5, 60), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + +local sideDots = {} +local function sideButton(order, icon, label, key, color, onClick) + local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = color, LayoutOrder = order, Parent = side }, onClick) + stroke(color:Lerp(BLACK, 0.45), 3).Parent = b + text({ Size = UDim2.new(1, 0, 0, 36), Position = UDim2.fromOffset(0, 3), TextSize = 28, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b }) + text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 44), Font = TITLE, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeTransparency = 0.5, Parent = b }) + if key and not UserInputService.TouchEnabled then + local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.new(1, -14, 0, -6), BackgroundColor3 = C.bg, Parent = b }, { corner(6), stroke(C.gold, 1.5) }) + text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = key, Parent = tag }) + end + local dot = new("Frame", { Size = UDim2.fromOffset(16, 16), Position = UDim2.new(0, -5, 0, -5), BackgroundColor3 = C.red, Visible = false, ZIndex = 3, Parent = b }, { corner(8), stroke(WHITE, 2) }) + sideDots[label] = dot + return b +end + +---------------------------------------------------------------- уведомления + +local toasts = new("Frame", { + Size = UDim2.new(0, 560, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) }) +local toastOrder = 0 +local toastTimers = {} + +local function notify(msg, color) + -- такое же сообщение уже на экране — не дублируем, а продлеваем его + for _, c in ipairs(toasts:GetChildren()) do + if c:IsA("Frame") and c:GetAttribute("Msg") == msg then + toastTimers[c] = (toastTimers[c] or 0) + 1 + local my = toastTimers[c] + task.delay(3.2, function() + if c.Parent and toastTimers[c] == my then + c:Destroy() + end + end) + return + end + end + toastOrder += 1 + local items = {} + for _, c in ipairs(toasts:GetChildren()) do + if c:IsA("Frame") then + table.insert(items, c) + end + end + if #items >= 3 then + items[1]:Destroy() + end + local t = new("Frame", { + Size = UDim2.new(0, 0, 0, 38), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.bg, + BackgroundTransparency = 0.15, LayoutOrder = toastOrder, Parent = toasts, + }, { corner(12), stroke(color or WHITE, 2, 0.2), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingRight = UDim.new(0, 16) }) }) + local l = text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 19, TextColor3 = color or WHITE, Text = msg, Parent = t }) + t:SetAttribute("Msg", msg) + toastTimers[t] = 0 + task.delay(3.2, function() + if t.Parent and toastTimers[t] == 0 then + TweenService:Create(t, TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play() + TweenService:Create(l, TweenInfo.new(0.4), { TextTransparency = 1 }):Play() + task.wait(0.45) + t:Destroy() + end + end) +end + +-- карточка пойманной рыбы +local catchCard = new("Frame", { + Size = UDim2.fromOffset(400, 128), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, -220), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(18) }) +local catchStroke = stroke(WHITE, 3) +catchStroke.Parent = catchCard +local catchGrad = gradient(C.panel2, C.bg, 90) +catchGrad.Parent = catchCard +local catchView = new("Frame", { Size = UDim2.fromOffset(130, 108), Position = UDim2.fromOffset(10, 10), BackgroundColor3 = C.bg, BackgroundTransparency = 0.3, Parent = catchCard }, { corner(14) }) +local catchHeader = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 10), Font = TITLE, TextSize = 15, TextColor3 = C.muted, Text = "", Parent = catchCard }) +local catchName = text({ Size = UDim2.new(1, -160, 0, 30), Position = UDim2.fromOffset(152, 30), Font = TITLE, TextSize = 26, Text = "", TextStrokeTransparency = 0.6, Parent = catchCard }) +local catchInfo = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 64), TextSize = 15, RichText = true, Text = "", Parent = catchCard }) +local catchValue = text({ Size = UDim2.new(1, -160, 0, 26), Position = UDim2.fromOffset(152, 90), Font = TITLE, TextSize = 21, TextColor3 = C.gold, Text = "", Parent = catchCard }) +local catchToken = 0 + +local function showCatch(fish, extra) + catchToken += 1 + local my = catchToken + local r = Config.Rarities[fish.rarity] + local mut = fish.mutation and Config.Find(Config.Mutations, fish.mutation) + clear(catchView) + viewport(catchView, Models.buildFish(fish.id, fish.mutation, 1, true), FISH_VIEW, 0.75) + catchStroke.Color = mut and mut.color or r.color + catchGrad.Color = ColorSequence.new(r.color:Lerp(C.bg, 0.55), C.bg) + catchHeader.Text = extra and extra.new and "🆕 НОВЫЙ ВИД! Опыт x2" or (extra and extra.record and "🏆 НОВЫЙ РЕКОРД!" or "ПОЙМАНА РЫБА") + catchHeader.TextColor3 = (extra and (extra.new or extra.record)) and C.gold or C.muted + catchName.Text = fish.name + catchName.TextColor3 = r.color + catchInfo.Text = ("%s%s · %.2f кг"):format( + hex(r.color), r.name, mut and (" · " .. mut.name .. " x" .. mut.mult .. "") or "", fish.weight) + catchValue.Text = ("💰 %s ⭐ +%d XP"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1)) + catchCard.Visible = true + TweenService:Create(catchCard, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Position = UDim2.new(0.5, 0, 0, 120) }):Play() + task.delay(3.4, function() + if my == catchToken then + local tw = TweenService:Create(catchCard, TweenInfo.new(0.35, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Position = UDim2.new(0.5, 0, 0, -220) }) + tw:Play() + tw.Completed:Wait() + if my == catchToken then + catchCard.Visible = false + end + end + end) +end + +local function floatText(msg, color) + local l = text({ + Size = UDim2.fromOffset(400, 60), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.42), + Font = TITLE, TextSize = 46, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = color, + TextStrokeTransparency = 0.2, Text = msg, Parent = gui, + }) + TweenService:Create(l, TweenInfo.new(1.4, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, 0.3), TextTransparency = 1, TextStrokeTransparency = 1 }):Play() + task.delay(1.5, function() + l:Destroy() + end) +end + +---------------------------------------------------------------- статус и мини-игра + +local statusLabel = text({ + Size = UDim2.fromOffset(460, 34), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110), + Font = TITLE, TextSize = 22, TextXAlignment = Enum.TextXAlignment.Center, TextStrokeTransparency = 0.3, + Text = "🎣 Ждём поклёвку… (клик — смотать)", Visible = false, Parent = gui, +}) +local mgFrame = new("Frame", { + Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(16), stroke(C.gold, 2.5, 0.1), gradient(C.panel2, C.bg, 90) }) +text({ + Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 24, + TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, TextStrokeTransparency = 0.5, + Text = "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame, +}) +local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = Color3.fromRGB(22, 28, 46), ClipsDescendants = true, Parent = mgFrame }, { corner(9), stroke(BLACK, 1.5, 0.4) }) +local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(130, 245, 150), Color3.fromRGB(35, 165, 75), 90) }) +local markerF = new("Frame", { Size = UDim2.new(0, 8, 1, 4), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0, 0.5), BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar }, { corner(4), stroke(BLACK, 2) }) +local pipsText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.fromOffset(15, 84), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = mgFrame }) +local missText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.new(0.5, 0, 0, 84), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = "", Parent = mgFrame }) +local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.fromOffset(15, 112), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = mgFrame }, { corner(3) }) + +---------------------------------------------------------------- окна + +local openWindow = nil + +local function makeWindow(title, accent, tabs) + local w = { pages = {}, tabButtons = {}, current = nil } + local frame = new("Frame", { + Size = UDim2.fromScale(0.92, 0.82), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.53), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, + }, { corner(20), stroke(accent, 3, 0.05), gradient(C.panel, C.bg, 90), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) }) + local scale = new("UIScale", { Parent = frame }) + local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundColor3 = WHITE, Parent = frame }, { corner(20), gradient(accent, accent:Lerp(BLACK, 0.35), 90) }) + new("Frame", { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 1, -20), BackgroundColor3 = accent:Lerp(BLACK, 0.3), BorderSizePixel = 0, Parent = header }) + text({ Size = UDim2.new(1, -80, 1, 0), Position = UDim2.fromOffset(20, 0), Font = TITLE, TextSize = 30, Text = title, TextStrokeTransparency = 0.5, ZIndex = 2, Parent = header }) + btn({ Size = UDim2.fromOffset(42, 42), Position = UDim2.new(1, -52, 0, 7), BackgroundColor3 = C.red, Text = "✕", TextSize = 22, ZIndex = 3, Parent = header }, function() + w.close() + end) + local hasTabs = #tabs > 1 + local tabBar = new("Frame", { Size = UDim2.new(1, -28, 0, 42), Position = UDim2.fromOffset(14, 66), BackgroundTransparency = 1, Visible = hasTabs, Parent = frame }, + { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + local top = hasTabs and 116 or 68 + local body = new("Frame", { Size = UDim2.new(1, -28, 1, -(top + 12)), Position = UDim2.fromOffset(14, top), BackgroundTransparency = 1, Parent = frame }) + w.frame = frame + + function w.setTab(id) + w.current = id + for k, page in pairs(w.pages) do + page.Visible = (k == id) + end + for k, b in pairs(w.tabButtons) do + b.BackgroundColor3 = (k == id) and accent or C.panel2 + end + if w.render then + w.render(id) + end + end + for i, t in ipairs(tabs) do + w.pages[t.id] = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Visible = false, Parent = body }) + w.tabButtons[t.id] = btn({ Size = UDim2.new(1 / #tabs, -8, 1, 0), Text = t.label, TextSize = 18, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = tabBar }, function() + w.setTab(t.id) + end) + end + function w.open(tab) + if openWindow and openWindow ~= w then + openWindow.close() + end + openWindow = w + frame.Visible = true + scale.Scale = 0.85 + TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() + w.setTab(tab or w.current or tabs[1].id) + end + function w.close() + frame.Visible = false + if openWindow == w then + openWindow = nil + end + end + function w.isOpen() + return frame.Visible + end + function w.toggle(tab) + if frame.Visible and (tab == nil or w.current == tab) then + w.close() + else + w.open(tab) + end + end + function w.refresh() + if frame.Visible and w.render then + w.render(w.current) + end + end + return w +end + +local function scrollArea(parent, cell, topOffset) + local sf = new("ScrollingFrame", { + Size = UDim2.new(1, 0, 1, -(topOffset or 0)), Position = UDim2.fromOffset(0, topOffset or 0), + BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 6, ScrollBarImageColor3 = C.muted, + AutomaticCanvasSize = Enum.AutomaticSize.Y, CanvasSize = UDim2.new(), Parent = parent, + }, { new("UIPadding", { PaddingRight = UDim.new(0, 10), PaddingTop = UDim.new(0, 4), PaddingLeft = UDim.new(0, 2), PaddingBottom = UDim.new(0, 8) }) }) + if cell then + new("UIGridLayout", { CellSize = cell, CellPadding = UDim2.fromOffset(10, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf }) + else + new("UIListLayout", { Padding = UDim.new(0, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf }) + end + return sf +end + +local function itemRow(parent, order, o) + local row = new("Frame", { Size = UDim2.new(1, -4, 0, 100), BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(14), stroke(o.strokeColor or C.line, 2, o.strokeColor and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) + local view = new("Frame", { Size = UDim2.fromOffset(124, 84), Position = UDim2.fromOffset(8, 8), BackgroundColor3 = o.iconBg or C.bg, Parent = row }, { corner(10) }) + if o.model then + viewport(view, o.model, o.dir, o.zoom) + elseif o.icon then + text({ Size = UDim2.fromScale(1, 1), TextSize = 48, TextXAlignment = Enum.TextXAlignment.Center, Text = o.icon, Parent = view }) + end + text({ Size = UDim2.new(1, -300, 0, 28), Position = UDim2.fromOffset(144, 8), Font = TITLE, TextSize = 22, Text = o.title, TextColor3 = o.titleColor or C.text, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) + text({ + Size = UDim2.new(1, -300, 0, 56), Position = UDim2.fromOffset(144, 38), Font = BODY2, TextSize = 14, TextColor3 = C.muted, + RichText = true, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = o.lines, Parent = row, + }) + btn({ + Size = UDim2.fromOffset(140, 50), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), + Text = o.buttonText, BackgroundColor3 = o.buttonColor, AutoButtonColor = o.active, TextSize = 19, Parent = row, + }, o.active and o.onClick or nil) + return row +end + +local function progressBar(parent, pos, size, frac, color) + local back = new("Frame", { Size = size, Position = pos, BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = parent }, { corner(7) }) + new("Frame", { Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1), BackgroundColor3 = color, Parent = back }, { corner(7) }) + return back +end + +---------------------------------------------------------------- данные с сервера + +local inventory, discovered, claimed = {}, {}, {} +local quests, daily = {}, { available = false, streak = 0, nextStreak = 1 } + +---------------------------------------------------------------- магазин + +local shopWin = makeWindow("🎣 Магазин Михалыча", Color3.fromRGB(215, 120, 40), { + { id = "rods", label = "🎣 Удочки" }, + { id = "upgrade", label = "✨ Улучшение" }, + { id = "bags", label = "🎒 Сумки" }, + { id = "luck", label = "🍀 Удача" }, +}) +local shopLists = { + rods = scrollArea(shopWin.pages.rods), + upgrade = scrollArea(shopWin.pages.upgrade), + bags = scrollArea(shopWin.pages.bags), + luck = scrollArea(shopWin.pages.luck), +} + +local function statLine(s) + return ("🍀 Удача +%d%% ⏱ Клёв x%.2f 🎯 Зона %d%%"):format(math.floor(s.luck * 100 + 0.5), s.speed, math.floor(s.zone * 100 + 0.5)) +end +local function buyButton(price, level, myLevel, coins) + if myLevel < level then + return "🔒 Ур. " .. level, C.grey, false + end + return "💰 " .. fmt(price), coins >= price and C.green or Color3.fromRGB(150, 95, 60), true +end + +shopWin.render = function(tab) + local list = shopLists[tab] + if not list then + return + end + clear(list) + local myLevel = player:GetAttribute("Level") or 1 + local coins = player:GetAttribute("Coins") or 0 + local levels = rodLevels() + + if tab == "rods" then + local owned = attrSet("OwnedRods") + for i, rod in ipairs(Config.Rods) do + local lv = levels[rod.id] or 0 + local equipped = player:GetAttribute("Rod") == rod.id + local bText, bColor, active + if equipped then + bText, bColor, active = "Надето ✓", C.grey, false + elseif owned[rod.id] then + bText, bColor, active = "Надеть", C.blue, true + else + bText, bColor, active = buyButton(rod.price, rod.level, myLevel, coins) + end + itemRow(list, i, { + model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + title = rod.name .. (owned[rod.id] and (" " .. stars(lv) .. "") or ""), + lines = statLine(Config.RodStats(rod.id, lv)) .. "\n" .. (owned[rod.id] and "Куплена" or ("Нужен уровень " .. rod.level)), + strokeColor = equipped and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Rod", rod.id) + end, + }) + end + elseif tab == "upgrade" then + text({ + Size = UDim2.new(1, -4, 0, 40), LayoutOrder = 0, TextSize = 14, Font = BODY2, TextColor3 = C.muted, TextWrapped = true, + Text = "Каждое улучшение даёт +" .. math.floor(Config.RodUpgrade.luckPerLevel * 100) .. "% удачи, ускоряет клёв и расширяет зелёную зону. Максимум — " .. stars(Config.RodUpgrade.maxLevel), + Parent = list, + }) + local owned = attrSet("OwnedRods") + local order = 0 + for _, rod in ipairs(Config.Rods) do + if owned[rod.id] then + order += 1 + local lv = levels[rod.id] or 0 + local now = Config.RodStats(rod.id, lv) + local maxed = lv >= Config.RodUpgrade.maxLevel + local lines + if maxed then + lines = statLine(now) .. "\nМаксимальное улучшение!" + else + local nxt = Config.RodStats(rod.id, lv + 1) + lines = ("🍀 +%d%% → +%d%% ⏱ x%.2f → x%.2f\n🎯 %d%% → %d%%"):format( + math.floor(now.luck * 100 + 0.5), math.floor(nxt.luck * 100 + 0.5), now.speed, nxt.speed, + math.floor(now.zone * 100 + 0.5), math.floor(nxt.zone * 100 + 0.5)) + end + local cost = Config.UpgradeCost(rod, lv) + itemRow(list, order, { + model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + title = rod.name .. " " .. stars(lv) .. "", + lines = lines, + strokeColor = player:GetAttribute("Rod") == rod.id and C.gold or nil, + buttonText = maxed and "MAX ★" or ("✨ " .. fmt(cost)), + buttonColor = maxed and C.grey or (coins >= cost and Color3.fromRGB(190, 120, 255) or Color3.fromRGB(110, 80, 140)), + active = not maxed, + onClick = function() + remote:FireServer("Buy", "Upgrade", rod.id) + end, + }) + end + end + elseif tab == "bags" then + local owned = attrSet("OwnedBags") + local bonus = attrSet("Passes").BigBag and 100 or 0 + for i, bag in ipairs(Config.Bags) do + local equipped = player:GetAttribute("Bag") == bag.id + local bText, bColor, active + if equipped then + bText, bColor, active = "Надето ✓", C.grey, false + elseif owned[bag.id] then + bText, bColor, active = "Надеть", C.blue, true + else + bText, bColor, active = buyButton(bag.price, bag.level, myLevel, coins) + end + itemRow(list, i, { + model = Models.buildBag(bag.id, true), dir = BAG_VIEW, zoom = 0.8, + title = bag.name, + lines = ("🎒 Вмещает %d рыб%s\n%s"):format(bag.capacity + bonus, bonus > 0 and " (с пропуском)" or "", owned[bag.id] and "Куплена" or ("Нужен уровень " .. bag.level)), + strokeColor = equipped and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Bag", bag.id) + end, + }) + end + elseif tab == "luck" then + local lv = levels[player:GetAttribute("Rod") or "Basic"] or 0 + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") or Config.Rods[1] + local boost = player:GetAttribute("BoostBonus") or 0 + local total = player:GetAttribute("Luck") or 100 + local ps = attrSet("Passes") + local evId = workspace:GetAttribute("Event") + local event = evId and Config.Find(Config.Events, evId) + local mutLine = {} + for _, m in ipairs(Config.Mutations) do + table.insert(mutLine, ("%s %.1f%%"):format(hex(m.color), m.name, math.min(100, m.chance * total / 100 * ((event and event.mutation) or 1) * 100))) + end + local lines = { + ("🍀 Твоя удача: %d%%"):format(total), + ("Базовая 100%% · 🎣 Удочка +%d%% · ✨ Улучшения +%d%%"):format(math.floor(rod.luck * 100 + 0.5), math.floor(lv * Config.RodUpgrade.luckPerLevel * 100 + 0.5)), + ("⭐ Уровень +%d%% · 🏆 Мастерство миров +%d%%"):format(math.floor(((player:GetAttribute("Level") or 1) - 1) * Config.LuckPerPlayerLevel * 100 + 0.5), math.floor((player:GetAttribute("Mastery") or 0) * Config.MasteryLuck * 100 + 0.5)), + ("🧪 Зелье +%d%%%s · 👑 Пропуска +%d%%%s"):format(math.floor(boost * 100 + 0.5), boost > 0 and (" (" .. timeStr(player:GetAttribute("BoostLeft") or 0) .. ")") or "", + (ps.VIP and 25 or 0) + (ps.LuckyCharm and 50 or 0), (event and event.luck) and (" · 🎉 Событие +" .. event.luck * 100 .. "%") or ""), + "Шанс мутаций: " .. table.concat(mutLine, " · "), + } + local info = new("Frame", { Size = UDim2.new(1, -4, 0, 160), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = list }, + { corner(14), stroke(Color3.fromRGB(90, 220, 120), 2, 0.2), gradient(Color3.fromRGB(35, 70, 55), C.panel, 90), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingTop = UDim.new(0, 10), PaddingRight = UDim.new(0, 16) }) }) + text({ Size = UDim2.fromScale(1, 1), TextSize = 15, RichText = true, TextYAlignment = Enum.TextYAlignment.Top, TextWrapped = true, Text = table.concat(lines, "\n"), Parent = info }) + for i, p in ipairs(Config.Potions) do + local bText, bColor, active = buyButton(p.price, p.level or 1, myLevel, coins) + itemRow(list, i, { + icon = "🧪", iconBg = p.color:Lerp(C.bg, 0.6), + title = p.name, titleColor = p.color, + lines = ("Удача +%d%% на %d мин.\nРедкая рыба и мутации попадаются чаще!"):format(p.bonus * 100, p.duration / 60), + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Potion", p.id) + end, + }) + end + end +end + +---------------------------------------------------------------- сумка и коллекция + +local bagWin = makeWindow("🎒 Сумка", Color3.fromRGB(60, 140, 220), { + { id = "fish", label = "🐟 Улов" }, + { id = "dex", label = "📖 Коллекция" }, +}) + +local fishHeader = new("Frame", { Size = UDim2.new(1, 0, 0, 50), BackgroundColor3 = WHITE, Parent = bagWin.pages.fish }, { corner(12), gradient(C.panel2, C.panel, 90) }) +local fishSummary = text({ Size = UDim2.new(1, -200, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = fishHeader }) +btn({ Size = UDim2.fromOffset(170, 38), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.green, Text = "💰 Продать всё", TextSize = 18, Parent = fishHeader }, function() + remote:FireServer("SellAll") +end) +local fishGrid = scrollArea(bagWin.pages.fish, UDim2.fromOffset(132, 176), 60) + +local dexWorld = "World1" +local dexTabs = new("Frame", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, Parent = bagWin.pages.dex }, + { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8) }) }) +local dexList = scrollArea(bagWin.pages.dex, nil, 46) +local dexTabButtons = {} + +local function fishCard(parent, order, rarityColor, strokeColor) + return new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(14), stroke(strokeColor or rarityColor, 2.5, 0.05), gradient(rarityColor:Lerp(C.bg, 0.55), C.panel, 90) }) +end + +local function rewardButton(parent, state, label, onClick) + local color = (state == "ready") and C.green or C.grey + return btn({ + Size = UDim2.fromOffset(150, 34), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), + BackgroundColor3 = color, AutoButtonColor = state == "ready", Text = label, TextSize = 16, Parent = parent, + }, state == "ready" and onClick or nil) +end + +local function renderDex() + clear(dexList) + for id, b in pairs(dexTabButtons) do + b.BackgroundColor3 = (id == dexWorld) and C.purple or C.panel2 + end + local world = Config.Find(Config.Worlds, dexWorld) + local all = Config.Zones[dexWorld].fish + local found = 0 + for _, f in ipairs(all) do + if discovered[f.id] then + found += 1 + end + end + + -- мастерство мира + local head = new("Frame", { Size = UDim2.new(1, -4, 0, 56), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = dexList }, + { corner(12), stroke(C.gold, 2, 0.3), gradient(Color3.fromRGB(70, 55, 20), C.panel, 90) }) + text({ + Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 17, RichText = true, TextWrapped = true, + Text = ("%s %s — %d / %d\nСобери всех: +%s 💰 и +%d%% удачи навсегда"):format( + world.icon, world.name, found, #all, fmt(Config.MasteryCoins * world.mult), math.floor(Config.MasteryLuck * 100 + 0.5)), + Parent = head, + }) + local mKey = dexWorld .. ":Master" + rewardButton(head, claimed[mKey] and "done" or (found == #all and "ready" or "locked"), + claimed[mKey] and "Получено ✓" or (found == #all and "🏆 Забрать" or "🔒 Не собрано"), function() + remote:FireServer("ClaimCollection", dexWorld, "Master") + end) + + for ri, rarity in ipairs(Config.RarityOrder) do + local group = {} + for _, f in ipairs(all) do + if f.rarity == rarity then + table.insert(group, f) + end + end + if #group > 0 then + local r = Config.Rarities[rarity] + local have = 0 + for _, f in ipairs(group) do + if discovered[f.id] then + have += 1 + end + end + local section = new("Frame", { Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = ri, Parent = dexList }, + { new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }) }) + local hdr = new("Frame", { Size = UDim2.new(1, 0, 0, 44), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = section }, + { corner(10), gradient(r.color:Lerp(C.bg, 0.5), C.panel, 0) }) + local reward = Config.CollectionRewards[rarity] + text({ + Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(12, 0), Font = TITLE, TextSize = 17, RichText = true, + Text = ("%s %d/%d +%s 💰 +%s XP"):format( + hex(r.color), r.name, have, #group, fmt(reward.coins * world.mult), fmt(reward.xp * world.mult)), + Parent = hdr, + }) + local key = dexWorld .. ":" .. rarity + rewardButton(hdr, claimed[key] and "done" or (have == #group and "ready" or "locked"), + claimed[key] and "Получено ✓" or (have == #group and "🎁 Забрать" or ("🔒 " .. have .. "/" .. #group)), function() + remote:FireServer("ClaimCollection", dexWorld, rarity) + end) + local grid = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 1, Parent = section }, + { new("UIGridLayout", { CellSize = UDim2.fromOffset(124, 150), CellPadding = UDim2.fromOffset(8, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + for i, f in ipairs(group) do + local rec = discovered[f.id] + local card = fishCard(grid, i, rec and r.color or C.grey) + local view = new("Frame", { Size = UDim2.new(1, -12, 0, 76), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) + local model = Models.buildFish(f.id, nil, 1, true) + viewport(view, rec and model or silhouette(model), FISH_VIEW, 0.72) + text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 84), Font = TITLE, TextSize = 15, TextColor3 = rec and r.color or C.muted, Text = rec and f.name or "???", TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) + text({ + Size = UDim2.new(1, -10, 0, 40), Position = UDim2.fromOffset(6, 104), Font = BODY2, TextSize = 12, TextColor3 = C.muted, TextWrapped = true, + TextYAlignment = Enum.TextYAlignment.Top, + Text = rec and ("Поймано: %d\nРекорд: %.2f кг"):format(rec.count, rec.best) or "Ещё не поймана", Parent = card, + }) + end + end + end +end + +for i, w in ipairs(Config.Worlds) do + if not w.soon then + dexTabButtons[w.id] = btn({ Size = UDim2.new(0, 170, 1, 0), Text = w.icon .. " " .. w.name, TextSize = 15, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = dexTabs }, function() + dexWorld = w.id + renderDex() + end) + end +end + +bagWin.render = function(tab) + if tab == "fish" then + clear(fishGrid) + local total = 0 + for _, it in ipairs(inventory) do + total += it.value + end + fishSummary.Text = ("🐟 %d / %d · 💰 ≈%s"):format(#inventory, player:GetAttribute("BagCap") or 0, fmt(player:GetAttribute("BagValue") or total)) + if #inventory == 0 then + text({ Size = UDim2.fromOffset(400, 60), Font = TITLE, TextSize = 20, TextColor3 = C.muted, TextWrapped = true, Text = "Сумка пуста. Иди к воде и поймай рыбу! 🎣", Parent = fishGrid }) + return + end + local sorted = table.clone(inventory) + table.sort(sorted, function(a, b) + return a.value > b.value + end) + for i, it in ipairs(sorted) do + local r = Config.Rarities[it.rarity] or Config.Rarities.Common + local mut = it.mutation and Config.Find(Config.Mutations, it.mutation) + local card = fishCard(fishGrid, i, r.color, mut and mut.color) + local view = new("Frame", { Size = UDim2.new(1, -12, 0, 84), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) + viewport(view, Models.buildFish(it.id, it.mutation, 1, true), FISH_VIEW, 0.72) + if mut then + local tag = new("Frame", { Size = UDim2.fromOffset(0, 20), AutomaticSize = Enum.AutomaticSize.X, Position = UDim2.fromOffset(6, 6), BackgroundColor3 = mut.color, ZIndex = 3, Parent = card }, + { corner(6), new("UIPadding", { PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }) }) + text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 13, TextColor3 = C.bg, Text = mut.name, ZIndex = 4, Parent = tag }) + end + text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 92), Font = TITLE, TextSize = 16, TextColor3 = r.color, Text = it.name, TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) + text({ Size = UDim2.new(1, -10, 0, 16), Position = UDim2.fromOffset(6, 112), Font = BODY2, TextSize = 13, TextColor3 = C.muted, Text = ("%.2f кг · %s"):format(it.weight, r.name), Parent = card }) + btn({ Size = UDim2.new(1, -12, 0, 32), Position = UDim2.fromOffset(6, 136), BackgroundColor3 = C.green, Text = "💰 " .. fmt(it.value), TextSize = 17, Parent = card }, function() + remote:FireServer("SellOne", it.uid) + end) + end + elseif tab == "dex" then + renderDex() + end +end + +---------------------------------------------------------------- миры + +local worldsWin = makeWindow("🌍 Миры", Color3.fromRGB(40, 160, 200), { { id = "list", label = "Миры" } }) +local worldsList = scrollArea(worldsWin.pages.list) + +local function currentWorld() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + return hrp and Config.WorldAt(hrp.Position) +end + +worldsWin.render = function() + clear(worldsList) + local myLevel = player:GetAttribute("Level") or 1 + local here = currentWorld() + itemRow(worldsList, 0, { + icon = "🏠", iconBg = Color3.fromRGB(90, 70, 30), + title = "Лобби", titleColor = C.gold, + lines = "Магазин удочек, скупка, донат-лавки и ежедневный сундук.", + buttonText = here == nil and "Вы здесь" or "🌀 Телепорт", buttonColor = here == nil and C.grey or C.blue, active = here ~= nil, + onClick = function() + remote:FireServer("Teleport", "Lobby") + worldsWin.close() + end, + }) + for i, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + local total, found = 0, 0 + if zone then + for _, f in ipairs(zone.fish) do + total += 1 + if discovered[f.id] then + found += 1 + end + end + end + local bText, bColor, active + if w.soon then + bText, bColor, active = "Скоро…", C.grey, false + elseif myLevel < w.level then + bText, bColor, active = "🔒 Ур. " .. w.level, C.grey, false + elseif here and here.id == w.id then + bText, bColor, active = "Вы здесь", C.grey, false + else + bText, bColor, active = "🌀 Телепорт", C.blue, true + end + itemRow(worldsList, i, { + icon = w.icon, iconBg = w.color:Lerp(C.bg, 0.6), + title = w.name, titleColor = w.color, + lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d · Рыб поймано: %d / %d · Награды x%d"):format(w.level, found, total, w.mult)), + strokeColor = (here and here.id == w.id) and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Teleport", w.id) + worldsWin.close() + end, + }) + end +end + +---------------------------------------------------------------- задания и ежедневная награда + +local questWin = makeWindow("📜 Задания", Color3.fromRGB(200, 140, 40), { + { id = "quests", label = "📜 Задания" }, + { id = "daily", label = "🎁 Ежедневно" }, +}) +local questList = scrollArea(questWin.pages.quests) +local dailyPage = questWin.pages.daily + +local function questText(q) + local t = Config.Quests[1] + for _, def in ipairs(Config.Quests) do + if def.kind == q.kind then + t = def + end + end + return string.find(t.text, "%%d") and t.text:format(q.goal) or t.text +end + +questWin.render = function(tab) + if tab == "quests" then + clear(questList) + text({ Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = BODY2, TextSize = 14, TextColor3 = C.muted, Text = "Выполняй задания — после награды появится новое.", Parent = questList }) + for i, q in ipairs(quests) do + local done = q.progress >= q.goal + local row = new("Frame", { Size = UDim2.new(1, -4, 0, 92), BackgroundColor3 = WHITE, LayoutOrder = i, Parent = questList }, + { corner(14), stroke(done and C.green or C.line, 2, done and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, -190, 0, 28), Position = UDim2.fromOffset(16, 8), Font = TITLE, TextSize = 19, Text = questText(q), TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) + progressBar(row, UDim2.fromOffset(16, 42), UDim2.new(1, -200, 0, 14), q.progress / q.goal, done and C.green or C.gold) + text({ Size = UDim2.new(1, -190, 0, 20), Position = UDim2.fromOffset(16, 62), Font = BODY2, TextSize = 13, TextColor3 = C.muted, RichText = true, + Text = ("%s / %s · +%s 💰 +%s XP"):format(fmt(q.progress), fmt(q.goal), fmt(q.coins), fmt(q.xp)), Parent = row }) + btn({ + Size = UDim2.fromOffset(150, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), + BackgroundColor3 = done and C.green or C.grey, AutoButtonColor = done, Text = done and "🎁 Забрать" or "В процессе", TextSize = 18, Parent = row, + }, done and function() + remote:FireServer("ClaimQuest", i) + end or nil) + end + elseif tab == "daily" then + clear(dailyPage) + local myLevel = player:GetAttribute("Level") or 1 + text({ + Size = UDim2.new(1, 0, 0, 30), Font = TITLE, TextSize = 20, RichText = true, + Text = ("🔥 Серия: %d дн. Заходи каждый день — награда растёт!"):format(daily.streak), Parent = dailyPage, + }) + local row = new("Frame", { Size = UDim2.new(1, 0, 0, 150), Position = UDim2.fromOffset(0, 40), BackgroundTransparency = 1, Parent = dailyPage }, + { new("UIGridLayout", { CellSize = UDim2.new(1 / 7, -8, 1, 0), CellPadding = UDim2.fromOffset(8, 0) }) }) + for d, r in ipairs(Config.DailyRewards) do + local isNext = d == daily.nextStreak and daily.available + local passed = d <= daily.streak and not (daily.available and daily.nextStreak == 1) + local cell = new("Frame", { BackgroundColor3 = WHITE, Parent = row }, + { corner(12), stroke(isNext and C.gold or C.line, isNext and 3 or 2, isNext and 0 or 0.4), gradient(isNext and Color3.fromRGB(90, 70, 20) or C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, 0, 0, 24), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Center, Text = "День " .. d, Parent = cell }) + text({ Size = UDim2.new(1, 0, 0, 44), Position = UDim2.fromOffset(0, 32), TextSize = 32, TextXAlignment = Enum.TextXAlignment.Center, Text = passed and "✅" or (r.potion and "🧪" or "💰"), Parent = cell }) + text({ + Size = UDim2.new(1, -6, 0, 50), Position = UDim2.fromOffset(3, 80), Font = BODY2, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = true, TextColor3 = C.gold, + Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. " 💰" .. (r.potion and "\n+ зелье" or ""), Parent = cell, + }) + end + btn({ + Size = UDim2.fromOffset(260, 54), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 210), + BackgroundColor3 = daily.available and C.green or C.grey, AutoButtonColor = daily.available, + Text = daily.available and "🎁 Забрать награду" or "Приходи завтра!", TextSize = 22, Parent = dailyPage, + }, daily.available and function() + remote:FireServer("ClaimDaily") + end or nil) + end +end + +---------------------------------------------------------------- донат + +local robuxWin = makeWindow("💎 Премиум", Color3.fromRGB(150, 80, 210), { + { id = "passes", label = "👑 Пропуска" }, + { id = "products", label = "🪙 Наборы" }, +}) +local robuxLists = { passes = scrollArea(robuxWin.pages.passes), products = scrollArea(robuxWin.pages.products) } + +robuxWin.render = function(tab) + local list = robuxLists[tab] + clear(list) + local owned = attrSet("Passes") + local items = tab == "passes" and Config.GamePasses or Config.Products + for i, it in ipairs(items) do + local has = tab == "passes" and owned[it.key] + itemRow(list, i, { + icon = it.icon, iconBg = Color3.fromRGB(70, 40, 100), + title = it.name, titleColor = C.gold, + lines = it.desc .. (tab == "passes" and "\nДействует навсегда" or ""), + strokeColor = has and C.gold or nil, + buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has, + onClick = function() + if not it.id or it.id == 0 then + notify("Товар ещё не настроен: впиши его ID в FishConfig", Color3.fromRGB(255, 200, 120)) + return + end + if tab == "passes" then + MarketplaceService:PromptGamePassPurchase(player, it.id) + else + MarketplaceService:PromptProductPurchase(player, it.id) + end + end, + }) + end +end + +---------------------------------------------------------------- боковые кнопки + +sideButton(1, "🎒", "Сумка", "B", Color3.fromRGB(60, 140, 220), function() + bagWin.toggle("fish") +end) +sideButton(2, "📖", "Рыбы", "C", Color3.fromRGB(150, 90, 220), function() + bagWin.toggle("dex") +end) +sideButton(3, "🌍", "Миры", "M", Color3.fromRGB(40, 160, 200), function() + worldsWin.toggle() +end) +sideButton(4, "📜", "Задания", "Q", Color3.fromRGB(210, 150, 40), function() + questWin.toggle() +end) +sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function() + robuxWin.toggle() +end) + +local function refreshDots() + local q = false + for _, quest in ipairs(quests) do + if quest.progress >= quest.goal then + q = true + end + end + sideDots["Задания"].Visible = q or daily.available + local c = false + for _, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + if zone then + for _, rarity in ipairs(Config.RarityOrder) do + local any, all = false, true + for _, f in ipairs(zone.fish) do + if f.rarity == rarity then + any = true + if not discovered[f.id] then + all = false + end + end + end + if any and all and not claimed[w.id .. ":" .. rarity] then + c = true + end + end + end + end + sideDots["Рыбы"].Visible = c +end + +---------------------------------------------------------------- HUD: обновление + +local function refreshHud() + local xp = player:GetAttribute("XP") or 0 + local need = player:GetAttribute("XPNeed") or 100 + coinsText.Text = "💰 " .. fmt(player:GetAttribute("Coins") or 0) + lvlText.Text = tostring(player:GetAttribute("Level") or 1) + xpText.Text = ("%d / %d XP"):format(xp, need) + TweenService:Create(xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play() + local boost = player:GetAttribute("BoostBonus") or 0 + luckText.Text = ("🍀 Удача %d%%%s"):format(player:GetAttribute("Luck") or 100, + boost > 0 and (" 🧪 +%d%% %s"):format(boost * 100, timeStr(player:GetAttribute("BoostLeft") or 0)) or "") + local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10 + bagText.Text = ("🎒 %d / %d · ≈ %s 💰"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0)) + bagText.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") + rodText.Text = ("🎣 %s %s"):format(rod and rod.name or "", stars(player:GetAttribute("RodLevel") or 0)) +end + +local pending = false +player.AttributeChanged:Connect(function(name) + refreshHud() + if name == "BoostLeft" and not (shopWin.isOpen() and shopWin.current == "luck") then + return + end + if not pending then + pending = true + task.defer(function() + pending = false + shopWin.refresh() + robuxWin.refresh() + if worldsWin.isOpen() then + worldsWin.refresh() + end + end) + end +end) +refreshHud() + +---------------------------------------------------------------- рыбалка + +local state = "idle" +local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 } + +local function setState(s) + state = s + statusLabel.Visible = (s == "waiting") + mgFrame.Visible = (s == "bite") +end +local function updatePips() + pipsText.Text = "🎯 " .. string.rep("●", mg.hits) .. string.rep("●", mg.need - mg.hits) + missText.Text = string.rep("✖", mg.misses) .. string.rep("❤️", mg.maxMisses - mg.misses) +end +local function flash(color) + bar.BackgroundColor3 = color + TweenService:Create(bar, TweenInfo.new(0.35), { BackgroundColor3 = Color3.fromRGB(22, 28, 46) }):Play() +end +local function placeZone() + mg.zoneStart = math.random() * (1 - mg.zoneWidth) + zoneF.Size = UDim2.fromScale(mg.zoneWidth, 1) + zoneF.Position = UDim2.fromScale(mg.zoneStart, 0) +end + +local function onActivate() + if state == "idle" then + setState("casting") + remote:FireServer("Cast") + elseif state == "waiting" then + remote:FireServer("Cancel") + setState("idle") + elseif state == "bite" then + local inZone = mg.pos >= mg.zoneStart and mg.pos <= mg.zoneStart + mg.zoneWidth + if inZone then + mg.hits += 1 + flash(Color3.fromRGB(60, 160, 80)) + if mg.hits >= mg.need then + setState("reeling") + remote:FireServer("Catch", true, mg.misses) + return + end + mg.speed *= 1.12 + placeZone() + else + mg.misses += 1 + flash(Color3.fromRGB(170, 50, 50)) + if mg.misses >= mg.maxMisses then + setState("reeling") + remote:FireServer("Catch", false, mg.misses) + return + end + end + updatePips() + end +end + +local hooked = setmetatable({}, { __mode = "k" }) +local function hookTool(tool) + if hooked[tool] or not tool:IsA("Tool") or not tool:GetAttribute("IsRod") then + return + end + hooked[tool] = true + tool.Activated:Connect(onActivate) + tool.Unequipped:Connect(function() + if state == "waiting" or state == "bite" or state == "casting" then + remote:FireServer("Cancel") + end + setState("idle") + end) +end +local function watch(container) + for _, c in ipairs(container:GetChildren()) do + hookTool(c) + end + container.ChildAdded:Connect(hookTool) +end +player.ChildAdded:Connect(function(c) + if c:IsA("Backpack") then + watch(c) + end +end) +if player:FindFirstChild("Backpack") then + watch(player.Backpack) +end +player.CharacterAdded:Connect(function(char) + setState("idle") + watch(char) +end) +if player.Character then + watch(player.Character) +end + +RunService.RenderStepped:Connect(function(dt) + if state ~= "bite" then + return + end + mg.pos += mg.dir * mg.speed * dt + if mg.pos >= 1 then + mg.pos, mg.dir = 1, -1 + elseif mg.pos <= 0 then + mg.pos, mg.dir = 0, 1 + end + markerF.Position = UDim2.fromScale(mg.pos, 0.5) + local left = math.max(0, mg.deadline - os.clock()) + timeBar.Size = UDim2.new(left / mg.timeout, -30 * left / mg.timeout, 0, 5) + if left <= 0 then + setState("reeling") + remote:FireServer("Catch", false, mg.misses) + end +end) + +UserInputService.InputBegan:Connect(function(input, processed) + if processed then + return + end + local k = input.KeyCode + if k == Enum.KeyCode.B then + bagWin.toggle("fish") + elseif k == Enum.KeyCode.C then + bagWin.toggle("dex") + elseif k == Enum.KeyCode.M then + worldsWin.toggle() + elseif k == Enum.KeyCode.Q then + questWin.toggle() + end +end) + +---------------------------------------------------------------- атмосфера миров (только у этого игрока) + +local snowPart = new("Part", { + Name = "SnowFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, + Transparency = 1, Size = Vector3.new(90, 1, 90), Parent = workspace, +}) +local snow = new("ParticleEmitter", { + Rate = 0, Lifetime = NumberRange.new(5, 7), Speed = NumberRange.new(4, 7), + EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(15, 15), + Size = NumberSequence.new(0.25), Color = ColorSequence.new(WHITE), LightEmission = 0.3, + Parent = snowPart, +}) +local lastWorldId = "none" +local terrain = workspace.Terrain +local defaultWater = Color3.fromRGB(20, 95, 115) + +local function applyAmbience(world) + local clock = (world and world.clock) or 14.5 + TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play() + terrain.WaterColor = (world and world.water) or defaultWater + local atm = Lighting:FindFirstChildOfClass("Atmosphere") + if atm then + local frost = world and world.id == "World3" + TweenService:Create(atm, TweenInfo.new(2), { + Density = frost and 0.38 or 0.25, + Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), + }):Play() + end + snow.Rate = (world and world.id == "World3") and 140 or 0 +end + +task.spawn(function() + while true do + local w = currentWorld() + local id = w and w.id or "lobby" + if id ~= lastWorldId then + lastWorldId = id + applyAmbience(w) + if w then + notify(w.icon .. " " .. w.name, w.color) + end + end + local cam = workspace.CurrentCamera + if cam then + snowPart.CFrame = CFrame.new(cam.CFrame.Position + Vector3.new(0, 25, 0)) + end + -- баннер события + local evId = workspace:GetAttribute("Event") + local event = evId and Config.Find(Config.Events, evId) + if event then + eventBanner.Visible = true + eventTitle.Text = event.name .. " " .. timeStr((workspace:GetAttribute("EventEnds") or 0) - workspace:GetServerTimeNow()) + eventDesc.Text = event.desc + else + eventBanner.Visible = false + end + task.wait(0.5) + end +end) + +---------------------------------------------------------------- события от сервера + +remote.OnClientEvent:Connect(function(action, a, b, c) + if action == "Notify" then + notify(a, b) + elseif action == "Cast" then + setState("waiting") + elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then + setState("idle") + elseif action == "Bite" then + mg.speed = a.speed + mg.zoneWidth = a.zoneWidth + mg.need = a.hits + mg.hits = 0 + mg.misses = 0 + mg.maxMisses = a.misses + mg.timeout = a.timeout + mg.deadline = os.clock() + a.timeout + mg.pos, mg.dir = 0, 1 + placeZone() + updatePips() + setState("bite") + elseif action == "Caught" then + setState("idle") + showCatch(a, b) + playUiSound(DING, 0.5) + elseif action == "Sold" then + floatText("+" .. fmt(a) .. " 💰", C.gold) + notify(("Продано рыб: %d → +%s 💰"):format(b, fmt(a)), Color3.fromRGB(120, 255, 140)) + elseif action == "Inventory" then + inventory = a or {} + discovered = b or {} + claimed = c or {} + bagWin.refresh() + refreshDots() + elseif action == "Quests" then + quests = a or {} + daily = b or daily + questWin.refresh() + refreshDots() + elseif action == "OpenShop" then + shopWin.open("rods") + elseif action == "OpenQuests" then + questWin.open("daily") + elseif action == "OpenRobux" then + robuxWin.open(a) + end +end) + +remote:FireServer("RequestInventory")