Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9795cc50e | ||
|
|
dcf89d037a | ||
|
|
eabb45ca51 | ||
|
|
bea9df1ab8 | ||
|
|
15c64d9eb2 | ||
|
|
0972c05e3d | ||
|
|
6673d5b90d | ||
|
|
bae57661a9 | ||
|
|
b6f4ce020a | ||
|
|
73a2db8bb8 | ||
|
|
9fcbd8bc0b | ||
|
|
1ff7ef7e83 | ||
|
|
b48d1f68f6 | ||
|
|
e1459c9834 | ||
|
|
1ff2a46e1e | ||
|
|
134940f76d |
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"enabledMcpjsonServers": ["Roblox_Studio"]
|
||||||
|
}
|
||||||
@@ -6,3 +6,5 @@
|
|||||||
|
|
||||||
# Rojo / инструменты
|
# Rojo / инструменты
|
||||||
sourcemap.json
|
sourcemap.json
|
||||||
|
rojo.exe
|
||||||
|
backups/
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Developer Products
|
||||||
|
|
||||||
|
| Config key | Name | Description | Price (Robux) | Icon |
|
||||||
|
|---|---|---|---:|---|
|
||||||
|
| Coins1 | Мешок монет | Мгновенно получи 1 000 монет. Количество увеличивается с уровнем персонажа. | 49 | coins-pouch-1000.png |
|
||||||
|
| Coins2 | Сундук монет | Мгновенно получи 5 000 монет. Количество увеличивается с уровнем персонажа. | 199 | coins-chest-5000.png |
|
||||||
|
| Coins3 | Гора золота | Мгновенно получи 20 000 монет. Количество увеличивается с уровнем персонажа. | 599 | coins-mountain-20000.png |
|
||||||
|
| Luck | Супер-зелье удачи | Увеличивает удачу на 200% на 15 минут. | 99 | luck-potion.png |
|
||||||
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
@@ -0,0 +1,8 @@
|
|||||||
|
# Game Passes
|
||||||
|
|
||||||
|
| Config key | Name | Description | Price (Robux) | Icon |
|
||||||
|
|---|---|---|---:|---|
|
||||||
|
| VIP | VIP | Навсегда: +25% к удаче и монетам, корона над персонажем. | 199 | vip-crown.png |
|
||||||
|
| DoubleCoins | x2 Монеты | Навсегда: продажа каждой рыбы приносит в 2 раза больше монет. | 299 | double-coins.png |
|
||||||
|
| LuckyCharm | Талисман удачи | Навсегда: +50% к удаче при ловле рыбы. | 349 | lucky-charm.png |
|
||||||
|
| BigBag | Бездонная сумка | Навсегда: +100 мест к вместимости любой сумки. | 149 | big-bag.png |
|
||||||
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
@@ -0,0 +1,19 @@
|
|||||||
|
# Полный список платных предложений
|
||||||
|
|
||||||
|
## Game Passes
|
||||||
|
|
||||||
|
| Config key | Name | Description | Price (Robux) | Icon |
|
||||||
|
|---|---|---|---:|---|
|
||||||
|
| VIP | VIP | Навсегда: +25% к удаче и монетам, корона над персонажем. | 199 | GamePasses/vip-crown.png |
|
||||||
|
| DoubleCoins | x2 Монеты | Навсегда: продажа каждой рыбы приносит в 2 раза больше монет. | 299 | GamePasses/double-coins.png |
|
||||||
|
| LuckyCharm | Талисман удачи | Навсегда: +50% к удаче при ловле рыбы. | 349 | GamePasses/lucky-charm.png |
|
||||||
|
| BigBag | Бездонная сумка | Навсегда: +100 мест к вместимости любой сумки. | 149 | GamePasses/big-bag.png |
|
||||||
|
|
||||||
|
## Developer Products
|
||||||
|
|
||||||
|
| Config key | Name | Description | Price (Robux) | Icon |
|
||||||
|
|---|---|---|---:|---|
|
||||||
|
| Coins1 | Мешок монет | Мгновенно получи 1 000 монет. Количество увеличивается с уровнем персонажа. | 49 | DeveloperProducts/coins-pouch-1000.png |
|
||||||
|
| Coins2 | Сундук монет | Мгновенно получи 5 000 монет. Количество увеличивается с уровнем персонажа. | 199 | DeveloperProducts/coins-chest-5000.png |
|
||||||
|
| Coins3 | Гора золота | Мгновенно получи 20 000 монет. Количество увеличивается с уровнем персонажа. | 599 | DeveloperProducts/coins-mountain-20000.png |
|
||||||
|
| Luck | Супер-зелье удачи | Увеличивает удачу на 200% на 15 минут. | 99 | DeveloperProducts/luck-potion.png |
|
||||||
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
@@ -15,7 +15,8 @@ $scripts = @(
|
|||||||
@{ Name = 'GameServer'; Class = 'Script'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\GameServer.server.lua'; Rbxmx = '4_GameServer_ServerScriptService.rbxmx' },
|
@{ Name = 'GameServer'; Class = 'Script'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\GameServer.server.lua'; Rbxmx = '4_GameServer_ServerScriptService.rbxmx' },
|
||||||
@{ Name = 'World1Builder'; Class = 'ModuleScript'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\World1Builder.lua'; Rbxmx = '6_World1Builder_ServerScriptService.rbxmx' },
|
@{ Name = 'World1Builder'; Class = 'ModuleScript'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\World1Builder.lua'; Rbxmx = '6_World1Builder_ServerScriptService.rbxmx' },
|
||||||
@{ Name = 'WorldBuilder'; Class = 'ModuleScript'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\WorldBuilder.lua'; Rbxmx = '7_WorldBuilder_ServerScriptService.rbxmx' },
|
@{ Name = 'WorldBuilder'; Class = 'ModuleScript'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\WorldBuilder.lua'; Rbxmx = '7_WorldBuilder_ServerScriptService.rbxmx' },
|
||||||
@{ Name = 'FishingClient'; Class = 'LocalScript'; Service = 'StarterPlayerScripts'; Path = 'src\StarterPlayer\StarterPlayerScripts\FishingClient.client.lua'; Rbxmx = '5_FishingClient_StarterPlayerScripts.rbxmx' }
|
@{ Name = 'FishingClient'; Class = 'LocalScript'; Service = 'StarterPlayerScripts'; Path = 'src\StarterPlayer\StarterPlayerScripts\FishingClient.client.lua'; Rbxmx = '5_FishingClient_StarterPlayerScripts.rbxmx' },
|
||||||
|
@{ Name = 'Loading'; Class = 'LocalScript'; Service = 'ReplicatedFirst'; Path = 'src\ReplicatedFirst\Loading.client.lua'; Rbxmx = '8_Loading_ReplicatedFirst.rbxmx' }
|
||||||
)
|
)
|
||||||
|
|
||||||
$header = '<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">'
|
$header = '<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">'
|
||||||
@@ -36,8 +37,10 @@ function ServiceItem($class, $children) {
|
|||||||
$rs = ($scripts | Where-Object { $_.Service -eq 'ReplicatedStorage' } | ForEach-Object { ScriptItem $_ }) -join ''
|
$rs = ($scripts | Where-Object { $_.Service -eq 'ReplicatedStorage' } | ForEach-Object { ScriptItem $_ }) -join ''
|
||||||
$sss = ($scripts | Where-Object { $_.Service -eq 'ServerScriptService' } | ForEach-Object { ScriptItem $_ }) -join ''
|
$sss = ($scripts | Where-Object { $_.Service -eq 'ServerScriptService' } | ForEach-Object { ScriptItem $_ }) -join ''
|
||||||
$sps = ($scripts | Where-Object { $_.Service -eq 'StarterPlayerScripts' } | ForEach-Object { ScriptItem $_ }) -join ''
|
$sps = ($scripts | Where-Object { $_.Service -eq 'StarterPlayerScripts' } | ForEach-Object { ScriptItem $_ }) -join ''
|
||||||
|
$rf = ($scripts | Where-Object { $_.Service -eq 'ReplicatedFirst' } | ForEach-Object { ScriptItem $_ }) -join ''
|
||||||
|
|
||||||
$place = $header + "`n" +
|
$place = $header + "`n" +
|
||||||
|
(ServiceItem 'ReplicatedFirst' $rf) +
|
||||||
(ServiceItem 'ReplicatedStorage' $rs) +
|
(ServiceItem 'ReplicatedStorage' $rs) +
|
||||||
(ServiceItem 'ServerScriptService' $sss) +
|
(ServiceItem 'ServerScriptService' $sss) +
|
||||||
(ServiceItem 'StarterPlayer' (ServiceItem 'StarterPlayerScripts' $sps)) +
|
(ServiceItem 'StarterPlayer' (ServiceItem 'StarterPlayerScripts' $sps)) +
|
||||||
@@ -53,7 +56,7 @@ if ($Force -or -not (Test-Path $placePath)) {
|
|||||||
# --- install/*.rbxmx and install/INSTALL.lua ---
|
# --- install/*.rbxmx and install/INSTALL.lua ---
|
||||||
$installDir = Join-Path $root 'install'
|
$installDir = Join-Path $root 'install'
|
||||||
New-Item -ItemType Directory -Force $installDir | Out-Null
|
New-Item -ItemType Directory -Force $installDir | Out-Null
|
||||||
$parents = @{ ReplicatedStorage = 'game.ReplicatedStorage'; ServerScriptService = 'game.ServerScriptService'; StarterPlayerScripts = 'game.StarterPlayer.StarterPlayerScripts' }
|
$parents = @{ ReplicatedStorage = 'game.ReplicatedStorage'; ServerScriptService = 'game.ServerScriptService'; StarterPlayerScripts = 'game.StarterPlayer.StarterPlayerScripts'; ReplicatedFirst = 'game.ReplicatedFirst' }
|
||||||
$sb = New-Object System.Text.StringBuilder
|
$sb = New-Object System.Text.StringBuilder
|
||||||
[void]$sb.Append("local function make(class, name, parent, src)`n local old = parent:FindFirstChild(name)`n if old then old:Destroy() end`n local s = Instance.new(class)`n s.Name = name`n s.Source = src`n s.Parent = parent`nend`nlocal oldMap = workspace:FindFirstChild('FishingMap')`nif oldMap then oldMap:Destroy() end`n")
|
[void]$sb.Append("local function make(class, name, parent, src)`n local old = parent:FindFirstChild(name)`n if old then old:Destroy() end`n local s = Instance.new(class)`n s.Name = name`n s.Source = src`n s.Parent = parent`nend`nlocal oldMap = workspace:FindFirstChild('FishingMap')`nif oldMap then oldMap:Destroy() end`n")
|
||||||
foreach ($s in $scripts) {
|
foreach ($s in $scripts) {
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
"name": "Fishing",
|
"name": "Fishing",
|
||||||
"tree": {
|
"tree": {
|
||||||
"$className": "DataModel",
|
"$className": "DataModel",
|
||||||
|
"ReplicatedFirst": {
|
||||||
|
"$path": "src/ReplicatedFirst"
|
||||||
|
},
|
||||||
"ReplicatedStorage": {
|
"ReplicatedStorage": {
|
||||||
"$path": "src/ReplicatedStorage"
|
"$path": "src/ReplicatedStorage"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# Гильдия рыбаков, экономика и новый стиль интерфейса
|
||||||
|
|
||||||
|
Дизайн-документ. Утверждён пользователем 2026-11-04. Фокус — лобби и Мир 1 «Тихое озеро».
|
||||||
|
Цель: Мир 1 занимает **1,5–3 часа**, каждые 5–10 минут игрок что-то получает, игра не утомляет.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Валюты
|
||||||
|
|
||||||
|
| Валюта | Ключ в данных | Откуда | На что |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 🪙 **Серебро** (основная) | `coins` (не переименовывать в данных, только в интерфейсе) | продажа рыбы, заказы, задания | удочки, сумки, улучшения, наживка |
|
||||||
|
| 🦪 **Жемчуг** (редкая) | `pearls` | мутации (Блестящая 1, Золотая 3, Радужная 10), босс 5, ежедневка (7-й день 5), повышение ранга 10, иногда заказы | премиум-наживка, переброс заказов (2), слоты ловушек, позже — зачарования и косметика |
|
||||||
|
| 📜 **Печати гильдии** (репутация) | `seals` | только заказы гильдии и испытания | копятся для повышения ранга (не тратятся) |
|
||||||
|
|
||||||
|
Во всём интерфейсе «монеты/💰» → «серебро/🪙».
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Гильдия рыбаков (стержень прогрессии)
|
||||||
|
|
||||||
|
Атмосфера — гильдия авантюристов из аниме: ранги-буквы, доска заказов, испытание на ранг, жетон над головой.
|
||||||
|
|
||||||
|
### Ранги
|
||||||
|
|
||||||
|
| Буква | Ранг | Печатей (всего) | Испытание на ранг | Открывает |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| F | Ученик | 0 | — | Мир 1, доска заказов (3 заказа) |
|
||||||
|
| E | Подмастерье | 30 | Сдать 5 окуней | **автоловля**, 4-й заказ на доске |
|
||||||
|
| D | Рыбак | 120 | Поймать «Редкую» рыбу в дождь или грозу | **Мир 2** (+ уровень 8), **ловушки** (1 шт) |
|
||||||
|
| C | Опытный рыбак | 350 | Нанести урон боссу озера (участие в победе) | ловушки 2 шт, скидка у торговцев 5% |
|
||||||
|
| B | Мастер | 900 | Собрать коллекцию Мира 1 полностью | **Мир 3** (+ уровень 18), ловушки 3 шт |
|
||||||
|
| A | Магистр | 2000 | Поймать «Эпическую» ночью | титул «Магистр», скидка 10% |
|
||||||
|
| S | Легенда | 4500 | Поймать «Мифическую» рыбу | золотой жетон, автоловля без штрафа к редкости |
|
||||||
|
|
||||||
|
- Печати копятся → при достаточном количестве у **главы гильдии** берётся **испытание** → после выполнения — церемония: фанфары, конфетти, +10 жемчуга, объявление на сервер «⚔ Игрок X получил ранг D!».
|
||||||
|
- **Жетон ранга над головой** (BillboardGui): буква в щите цвета ранга (F серый, E зелёный, D синий, C фиолетовый, B красный, A золотой, S радужный).
|
||||||
|
- Миры теперь требуют **и уровень, и ранг**.
|
||||||
|
|
||||||
|
### Глава гильдии (NPC)
|
||||||
|
Имя: **Старейшина Ворон** — седой рыбак с повязкой на глазу. Реплики с характером (наставник из аниме). Стоит в здании гильдии в лобби.
|
||||||
|
|
||||||
|
### Здание гильдии в лобби
|
||||||
|
Средневековый дом с вывеской «⚓ ГИЛЬДИЯ РЫБАКОВ», знамёна гильдии, **доска заказов** (пергаменты на доске), стол главы. Карта лобби уже собрана в Studio (`Workspace.FishingMap`) — строить в плейсе и сохранить, не ломая существующее лобби (порталы, лавки, фонтан, точки появления).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Заказы гильдии (доска заказов)
|
||||||
|
|
||||||
|
- Личные для каждого игрока, **обновляются каждые 3 часа** (по серверному времени, окно `floor(os.time()/10800)`), можно перебросить один заказ за 2 жемчуга.
|
||||||
|
- 3 заказа на ранге F, 4 — начиная с E.
|
||||||
|
- Сложность и награда растут с рангом.
|
||||||
|
|
||||||
|
Типы заказов:
|
||||||
|
| Тип | Пример | Как засчитывается |
|
||||||
|
|---|---|---|
|
||||||
|
| deliver | «Сдай 5 карасей» | рыба **забирается из сумки** при сдаче у доски |
|
||||||
|
| heavy | «Принеси окуня тяжелее 1 кг» | забирается из сумки |
|
||||||
|
| weather | «Поймай 3 рыбы в дождь» | по ходу рыбалки |
|
||||||
|
| night | «Поймай 2 необычные рыбы ночью» | по ходу |
|
||||||
|
| combo | «Набери серию из 6» | по ходу |
|
||||||
|
| perfect | «5 забросов в зелёную зону» | по ходу |
|
||||||
|
|
||||||
|
Награда: печати 5–25 (по сложности), серебро, шанс 20% на 1–3 жемчуга.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Наживка
|
||||||
|
|
||||||
|
Лавка наживки — у рыбака на причале Мира 1 и в магазине лобби. Один слот наживки, 1 штука тратится на заброс.
|
||||||
|
|
||||||
|
| Наживка | Цена | Эффект |
|
||||||
|
|---|---|---|
|
||||||
|
| Червь | 🪙 40 за 10 шт | клюёт на 10% быстрее |
|
||||||
|
| Мотыль | 🪙 90 за 10 шт | удача +15% |
|
||||||
|
| Светлячок | 🪙 120 за 10 шт | ночью удача +30% (вместо +10%) |
|
||||||
|
| Кровавая приманка | 🪙 400 за 10 шт, ранг D | редкие и выше чаще (вес ×1.5) |
|
||||||
|
| Жемчужная блесна | 🦪 5 за 5 шт | шанс мутаций ×2 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Автоловля (ранг E)
|
||||||
|
|
||||||
|
- Кнопка «🎣 Автоловля» (вкл/выкл). Работает, если игрок стоит у воды с удочкой в руках.
|
||||||
|
- Сервер сам забрасывает и вытаскивает. Штрафы: удача ×0.6, не выше «Редкой», нет бонуса идеального заброса и серии, каждая поимка на 50% дольше.
|
||||||
|
- Останавливается при полной сумке, при отходе от воды, при смене мира.
|
||||||
|
- Ранг S снимает ограничение редкости. Позже — пропуск за робуксы «Опытный подмастерье» (без штрафов).
|
||||||
|
|
||||||
|
## 6. Ловушки-вентери (ранг D)
|
||||||
|
|
||||||
|
- В окне гильдии: 1–3 ловушки (по рангу, + слоты за жемчуг позже).
|
||||||
|
- Каждая ловушка приносит 1 рыбу Мира 1 (обычные/необычные) каждые 15 минут, максимум 16 рыб (4 часа). **Работает и офлайн.**
|
||||||
|
- «Забрать улов» переносит рыбу в сумку (сколько влезет).
|
||||||
|
|
||||||
|
## 7. Бонус отдыха
|
||||||
|
|
||||||
|
- Пока игрока нет, копится «отдых»: 1 минута двойного опыта за каждые 4 минуты офлайн, максимум 60 минут.
|
||||||
|
- Тратится, пока игрок ловит. Показывается в HUD («🛌 Отдых ×2 опыт: 23 мин»).
|
||||||
|
|
||||||
|
## 8. Кривая уровней
|
||||||
|
|
||||||
|
- `XPForLevel(level) = floor(50 * level ^ 1.6)` (было `60 + 60*level`).
|
||||||
|
- Опыт за рыбу не трогаем. До 8 уровня ≈ 3 600 опыта ≈ 1,5–2 часа вместе с заказами.
|
||||||
|
- Старые сохранения: уровень игрока не понижать.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. Новый стиль интерфейса — «средневековая гильдия»
|
||||||
|
|
||||||
|
Вайб — тёплое дерево, пергамент, золотые оковки, багровые ленты. Как в топовых рыболовных плейсах (тёмные панели с золотой рамкой), но **в нашем средневековом стиле**.
|
||||||
|
|
||||||
|
### Палитра
|
||||||
|
| Токен | Цвет | Где |
|
||||||
|
|---|---|---|
|
||||||
|
| woodDark | 40, 28, 20 | фон окон |
|
||||||
|
| wood | 66, 46, 30 | панели, карточки |
|
||||||
|
| woodLight | 98, 70, 44 | кнопки вкладок |
|
||||||
|
| parchment | 236, 220, 180 | вставки с текстом (свитки), текст на тёмном |
|
||||||
|
| ink | 52, 36, 24 | текст на пергаменте |
|
||||||
|
| gold | 218, 172, 92 | рамки, заголовки, цены |
|
||||||
|
| goldBright | 255, 214, 120 | акценты |
|
||||||
|
| crimson | 150, 40, 35 | ленты заголовков, «закрыть», опасные кнопки |
|
||||||
|
| forest | 64, 112, 62 | «купить», «забрать» |
|
||||||
|
|
||||||
|
### Элементы
|
||||||
|
- **Окно**: деревянная панель, золотая рамка в 2 слоя (тёмная + светлая), ромбики-заклёпки по углам, заголовок на **багровой ленте** с золотым текстом, кнопка закрытия — круглая багровая печать «✕».
|
||||||
|
- **Кнопки**: дерево с золотой окантовкой; основные действия — зелёные «сургучные», опасные — багровые.
|
||||||
|
- **Карточки**: тёмное дерево, редкость — цветной камень в углу и цветная полоса.
|
||||||
|
- **Шрифты**: заголовки — с засечками/каллиграфия (проверить, что есть **кириллица**: кандидаты `Merriweather`, `Oswald`, `Nunito`; декоративные — только если кириллица рендерится), текст — читаемый без засечек. Обязательно проверить русский текст в Studio.
|
||||||
|
- **Иконки** пока эмодзи; позже пользователь нарисует свои (Photopea/Blockbench).
|
||||||
|
|
||||||
|
### Телефон (обязательно)
|
||||||
|
- `UIScale` по размеру экрана (база 1280×720).
|
||||||
|
- На узком экране (ширина < 900 или TouchEnabled): боковые кнопки — компактная сетка 2×N у левого края или нижняя панель; окна — почти на весь экран; HUD компактнее; ничего не перекрывает кнопку прыжка (правый низ) и меню Roblox (левый верх).
|
||||||
|
- Проверить в Studio эмуляторе устройств (iPhone SE, Android 16:9) — ничего не наслаивается.
|
||||||
@@ -21,19 +21,23 @@ Config.Worlds = {
|
|||||||
-- свет и эффекты: свойства Lighting и его эффектов; чего здесь нет, остаётся как в MapBuilder
|
-- свет и эффекты: свойства Lighting и его эффектов; чего здесь нет, остаётся как в MapBuilder
|
||||||
look = {
|
look = {
|
||||||
lighting = {
|
lighting = {
|
||||||
Brightness = 2.6, ExposureCompensation = -0.15,
|
-- днём солнце не выжигает светлый песок и траву: яркость и экспозиция ниже
|
||||||
|
Brightness = 2.0, ExposureCompensation = -0.35,
|
||||||
Ambient = Color3.fromRGB(62, 66, 84), OutdoorAmbient = Color3.fromRGB(105, 112, 132),
|
Ambient = Color3.fromRGB(62, 66, 84), OutdoorAmbient = Color3.fromRGB(105, 112, 132),
|
||||||
ColorShift_Top = Color3.fromRGB(255, 232, 196),
|
ColorShift_Top = Color3.fromRGB(255, 232, 196),
|
||||||
EnvironmentDiffuseScale = 0.6, EnvironmentSpecularScale = 0.8,
|
EnvironmentDiffuseScale = 0.5, EnvironmentSpecularScale = 0.6,
|
||||||
},
|
},
|
||||||
-- дымка вдали: Density — сколько тумана, Haze — насколько он плотный у горизонта
|
-- дымка вдали: Density — сколько тумана, Haze — насколько он плотный у горизонта
|
||||||
atmosphere = {
|
atmosphere = {
|
||||||
Density = 0.38, Offset = 0.1, Haze = 1.2, Glare = 0.15,
|
Density = 0.38, Offset = 0.1, Haze = 1.2, Glare = 0.15,
|
||||||
Color = Color3.fromRGB(188, 204, 224), Decay = Color3.fromRGB(196, 176, 160),
|
Color = Color3.fromRGB(188, 204, 224), Decay = Color3.fromRGB(196, 176, 160),
|
||||||
},
|
},
|
||||||
color = { Saturation = 0.28, Contrast = 0.2, Brightness = -0.02 },
|
color = { Saturation = 0.16, Contrast = 0.12, Brightness = -0.04 },
|
||||||
bloom = { Intensity = 0.45, Size = 28, Threshold = 1.2 },
|
-- свечение только у по-настоящему ярких мест (огни ночью), без ореолов вокруг светлого днём
|
||||||
sunRays = { Intensity = 0.06, Spread = 0.6 },
|
bloom = { Intensity = 0.25, Size = 24, Threshold = 1.9 },
|
||||||
|
sunRays = { Intensity = 0.05, Spread = 0.6 },
|
||||||
|
-- мягкий тонмаппинг: светлое не выгорает в белое
|
||||||
|
grading = { TonemapperPreset = Enum.TonemapperPreset.Default },
|
||||||
-- лёгкое размытие дальнего плана
|
-- лёгкое размытие дальнего плана
|
||||||
dof = { Enabled = true, FarIntensity = 0.2, FocusDistance = 60, InFocusRadius = 120, NearIntensity = 0 },
|
dof = { Enabled = true, FarIntensity = 0.2, FocusDistance = 60, InFocusRadius = 120, NearIntensity = 0 },
|
||||||
},
|
},
|
||||||
@@ -76,6 +80,68 @@ Config.Worlds = {
|
|||||||
}
|
}
|
||||||
Config.WorldRadius = 260
|
Config.WorldRadius = 260
|
||||||
|
|
||||||
|
-- камера игрока: насколько близко и далеко можно отвести колесом (в studs);
|
||||||
|
-- maxZoom держит обзор внутри локаций — дальше видно край карты
|
||||||
|
Config.Camera = { minZoom = 0.5, maxZoom = 35 }
|
||||||
|
|
||||||
|
-- лента активности (слева внизу у всех игроков) и оповещения о редком улове
|
||||||
|
-- announceRank / announceMutations — крупный баннер со звуком у всех на сервере;
|
||||||
|
-- globalRank / globalMutations — улов уходит и на другие серверы игры (MessagingService);
|
||||||
|
-- lines — сколько строк в ленте, lineTime — сколько секунд строка остаётся видна
|
||||||
|
Config.Feed = {
|
||||||
|
announceRank = 4, announceMutations = { Golden = true, Rainbow = true },
|
||||||
|
globalRank = 5, globalMutations = { Rainbow = true },
|
||||||
|
lines = 6, lineTime = 30,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- доски лидеров в лобби (глобальные, по всем серверам; обновляются раз в refresh секунд).
|
||||||
|
-- attr — атрибут игрока, который считает сервер; store — имя OrderedDataStore (смена имени = новый топ с нуля)
|
||||||
|
Config.Leaderboards = {
|
||||||
|
refresh = 60, size = 10,
|
||||||
|
boards = {
|
||||||
|
{ id = "Donate", title = "💎 Топ донатеров", attr = "RobuxSpent", store = "TopRobux_v1", unit = "R$", color = Color3.fromRGB(205, 140, 255) },
|
||||||
|
{ id = "Earn", title = "⚪ Топ по заработку", attr = "CoinsEarned", store = "TopEarned_v1", unit = "⚪", color = Color3.fromRGB(255, 214, 90) },
|
||||||
|
{ id = "Catch", title = "🎣 Топ рыболовов", attr = "TotalCaught", store = "TopCaught_v1", unit = "🐟", color = Color3.fromRGB(120, 210, 255) },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- экран загрузки: при входе в игру и при каждом телепорте игрок уже стоит на месте, сцена прогружается
|
||||||
|
-- и свет локации ставится под ним; картинку видно только после этого (секунды — минимум показа)
|
||||||
|
Config.Loading = {
|
||||||
|
firstJoin = 3,
|
||||||
|
teleport = 2.5,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- лобби: те же поля внешнего вида, что у миров (clock, tint, look, terrainColors); клиент применяет их вне миров
|
||||||
|
Config.Lobby = {
|
||||||
|
id = "Lobby",
|
||||||
|
clock = 16.3, -- предвечернее солнце: тени длиннее, свет теплее
|
||||||
|
tint = Color3.fromRGB(255, 242, 228),
|
||||||
|
look = {
|
||||||
|
lighting = {
|
||||||
|
Brightness = 2.0, ExposureCompensation = -0.3,
|
||||||
|
Ambient = Color3.fromRGB(64, 60, 72), OutdoorAmbient = Color3.fromRGB(120, 114, 124),
|
||||||
|
ColorShift_Top = Color3.fromRGB(255, 224, 186),
|
||||||
|
EnvironmentDiffuseScale = 0.5, EnvironmentSpecularScale = 0.5,
|
||||||
|
GlobalShadows = true,
|
||||||
|
},
|
||||||
|
-- тёплая дымка: дальние холмы за скалами тонут в ней
|
||||||
|
atmosphere = {
|
||||||
|
Density = 0.4, Offset = 0.18, Haze = 1.6, Glare = 0.25,
|
||||||
|
Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150),
|
||||||
|
},
|
||||||
|
color = { Saturation = 0.18, Contrast = 0.14, Brightness = -0.04 },
|
||||||
|
bloom = { Intensity = 0.3, Size = 24, Threshold = 1.8 },
|
||||||
|
sunRays = { Intensity = 0.05, Spread = 0.7 },
|
||||||
|
dof = { Enabled = true, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 },
|
||||||
|
-- мягкий тонмаппинг вместо Retro: светлая плитка и вывески не выгорают в белое
|
||||||
|
grading = { TonemapperPreset = Enum.TonemapperPreset.Default },
|
||||||
|
},
|
||||||
|
terrainColors = {
|
||||||
|
Grass = Color3.fromRGB(104, 150, 72), Ground = Color3.fromRGB(120, 98, 74), Rock = Color3.fromRGB(140, 126, 130),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
function Config.WorldAt(pos)
|
function Config.WorldAt(pos)
|
||||||
for _, w in ipairs(Config.Worlds) do
|
for _, w in ipairs(Config.Worlds) do
|
||||||
if not w.soon then
|
if not w.soon then
|
||||||
@@ -328,7 +394,7 @@ Config.QuestKinds = {
|
|||||||
perfectCast = { text = "Забрось в зелёную зону %d %s", forms = TIMES, coins = 8, xp = 6 },
|
perfectCast = { text = "Забрось в зелёную зону %d %s", forms = TIMES, coins = 8, xp = 6 },
|
||||||
combo = { text = "Набери серию из %d рыб", coins = 12, xp = 10, max = 15 },
|
combo = { text = "Набери серию из %d рыб", coins = 12, xp = 10, max = 15 },
|
||||||
sell = { text = "Продай %d %s", forms = FISH, coins = 3, xp = 3 },
|
sell = { text = "Продай %d %s", forms = FISH, coins = 3, xp = 3 },
|
||||||
earn = { text = "Заработай %d 💰 на продаже", coins = 0.25, xp = 0.2, byLevel = true },
|
earn = { text = "Заработай %d ⚪ на продаже", coins = 0.25, xp = 0.2, byLevel = true },
|
||||||
buy = { text = "Купи что-нибудь в магазине", coins = 40, xp = 30, max = 1 },
|
buy = { text = "Купи что-нибудь в магазине", coins = 40, xp = 30, max = 1 },
|
||||||
boss = { text = "Нанеси боссу %d урона", coins = 15, xp = 12 },
|
boss = { text = "Нанеси боссу %d урона", coins = 15, xp = 12 },
|
||||||
}
|
}
|
||||||
@@ -361,7 +427,7 @@ Config.Boss = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ежедневная награда (7 дней по кругу), монеты растут с уровнем
|
-- ежедневная награда (7 дней по кругу), серебро растёт с уровнем
|
||||||
Config.DailyRewards = {
|
Config.DailyRewards = {
|
||||||
{ coins = 100 },
|
{ coins = 100 },
|
||||||
{ coins = 200 },
|
{ coins = 200 },
|
||||||
@@ -377,26 +443,129 @@ Config.Events = {
|
|||||||
{ id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 },
|
{ id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 },
|
||||||
{ id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 },
|
{ id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 },
|
||||||
{ id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 },
|
{ id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 },
|
||||||
{ id = "Fair", name = "💰 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 },
|
{ id = "Fair", name = "🐟 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 },
|
||||||
}
|
}
|
||||||
Config.EventFirstDelay = 120
|
Config.EventFirstDelay = 120
|
||||||
Config.EventGapMin = 420
|
Config.EventGapMin = 420
|
||||||
Config.EventGapMax = 720
|
Config.EventGapMax = 720
|
||||||
|
|
||||||
|
---------------------------------------------------------------- время суток
|
||||||
|
-- одни сутки длятся length секунд реального времени; время общее для всего сервера
|
||||||
|
Config.DayNight = {
|
||||||
|
enabled = true,
|
||||||
|
length = 1200, -- 20 минут на сутки
|
||||||
|
startClock = 9, -- во сколько начинается день при запуске сервера
|
||||||
|
nightLuck = 0.10, -- ночью удача +10%
|
||||||
|
}
|
||||||
|
|
||||||
|
-- время на часах в момент serverTime (workspace:GetServerTimeNow()), dayStart — атрибут workspace "DayStart"
|
||||||
|
function Config.ClockAt(serverTime, dayStart)
|
||||||
|
local d = Config.DayNight
|
||||||
|
return (d.startClock + (serverTime - (dayStart or serverTime)) / d.length * 24) % 24
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 0 днём, 1 глубокой ночью, плавно на рассвете и закате
|
||||||
|
function Config.Nightness(clock)
|
||||||
|
if clock >= 7 and clock <= 17.5 then
|
||||||
|
return 0
|
||||||
|
elseif clock > 17.5 and clock < 20 then
|
||||||
|
return (clock - 17.5) / 2.5
|
||||||
|
elseif clock >= 5 and clock < 7 then
|
||||||
|
return 1 - (clock - 5) / 2
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function Config.IsNight(clock)
|
||||||
|
return Config.Nightness(clock) >= 0.5
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- погода
|
||||||
|
-- меняется на всём сервере; weight — как часто выпадает, duration — сколько длится (секунды)
|
||||||
|
-- luck / speed / mutation — бонусы к рыбалке, пока погода держится
|
||||||
|
-- names — как погода называется в отдельных мирах (во фьорде вместо дождя снег)
|
||||||
|
Config.Weathers = {
|
||||||
|
{ id = "Clear", name = "Ясно", icon = "☀", weight = 40, duration = { 240, 420 } },
|
||||||
|
{ id = "Cloudy", name = "Пасмурно", icon = "☁", weight = 25, duration = { 180, 360 }, luck = 0.05, desc = "Удача +5%" },
|
||||||
|
{ id = "Rain", name = "Дождь", icon = "🌧", weight = 20, duration = { 150, 300 }, speed = 0.85, desc = "Клюёт на 15% быстрее",
|
||||||
|
names = { World3 = "Снегопад" } },
|
||||||
|
{ id = "Storm", name = "Гроза", icon = "⛈", weight = 8, duration = { 120, 240 }, luck = 0.25, speed = 0.9, desc = "Удача +25%",
|
||||||
|
names = { World3 = "Метель" } },
|
||||||
|
{ id = "Fog", name = "Туман", icon = "🌫", weight = 7, duration = { 150, 300 }, mutation = 1.5, desc = "Мутации ×1.5" },
|
||||||
|
}
|
||||||
|
|
||||||
|
function Config.WeatherById(id)
|
||||||
|
for _, w in ipairs(Config.Weathers) do
|
||||||
|
if w.id == id then
|
||||||
|
return w
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return Config.Weathers[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- звуки
|
||||||
|
-- ID из Creator Store: эффекты — Pro Sound Effects (официальная библиотека Roblox),
|
||||||
|
-- музыка — APM и DistroKid (лицензированы для Roblox). volume — громкость, pitch — разброс высоты
|
||||||
|
local function S(id, volume, extra)
|
||||||
|
local t = extra or {}
|
||||||
|
t.id = "rbxassetid://" .. id
|
||||||
|
t.volume = volume
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
Config.Sounds = {
|
||||||
|
-- музыка
|
||||||
|
musicLobby = S(137023744071437, 0.35), -- The Ancient Lutes | Medieval Tavern Music
|
||||||
|
musicLobby2 = S(116079409060113, 0.35), -- The Lute Lament | Medieval Tavern Music
|
||||||
|
musicLake = S(1838853377, 0.3), -- Harp Fantasy
|
||||||
|
musicLake2 = S(86472274853159, 0.3), -- Calm Fantasy Atmosphere
|
||||||
|
musicNight = S(140195397978848, 0.3), -- Moonlit Meadow Whisper
|
||||||
|
-- окружение (петли)
|
||||||
|
birdsLake = S(9112877174, 0.35), -- Squam Lake 1
|
||||||
|
birdsPark = S(9113444360, 0.25), -- Birds Park 2
|
||||||
|
birdsJungle = S(9114892930, 0.3), -- Jungle Birds Ambience 3
|
||||||
|
crickets = S(9112764573, 0.3), -- Crickets Night 3
|
||||||
|
lakeWater = S(9116203162, 0.25), -- Lake Lap Water Movement 2
|
||||||
|
wind = S(9113286782, 0.18), -- Barstow Wind Light Blustery Low Howl 1
|
||||||
|
rainLight = S(9112852668, 0.45), -- Rain Continuous Drizzle 1
|
||||||
|
rainHeavy = S(9112853287, 0.55), -- Rain Heavy 1
|
||||||
|
fire = S(9112780193, 0.6, { roll = 30 }), -- Fireplace Constant Burning Flame 1 (слышно у костра)
|
||||||
|
thunder = { "rbxassetid://9116282875", "rbxassetid://9116282646", "rbxassetid://9116282791", "rbxassetid://9116282544" },
|
||||||
|
-- рыбалка
|
||||||
|
cast = S(9120718279, 0.5, { pitch = { 0.9, 1.1 } }), -- Whoosh Fast Swish By 1
|
||||||
|
bite = S(9112751536, 0.7, { pitch = { 0.9, 1.15 } }), -- Bubble Bloop High Pitched Cute 1
|
||||||
|
reel = S(9114454019, 0.4), -- Fishing Reel 4 (петля, пока тянешь)
|
||||||
|
catchSplash = S(9119293555, 0.6), -- Small Splash Shallow Water
|
||||||
|
catch = S(9126073001, 0.5), -- Bell Tone Ding
|
||||||
|
fanfare = S(1836473422, 0.45), -- Victory Fanfare Sting (редкая рыба)
|
||||||
|
sparkle = S(9114369623, 0.5), -- Fairy Dust 1 (мутация)
|
||||||
|
escape = S(9117944976, 0.5), -- Puddle Splash 2 (сорвалась)
|
||||||
|
-- интерфейс
|
||||||
|
click = S(15675032796, 0.5), -- Roblox_UI_Small_Click
|
||||||
|
open = S(9117231552, 0.45), -- Paper Scroll Unroll Handle 4
|
||||||
|
coins = S(9113849306, 0.6), -- Coins Or Keys Jingle 1
|
||||||
|
chestHop = S(9120718279, 0.35, { pitch = { 0.7, 0.8 } }), -- Whoosh Fast Swish By 1 (сундук награды подпрыгивает)
|
||||||
|
chestLand = S(9113769181, 0.7, { pitch = { 0.95, 1.05 } }), -- Chair Drop 2: тяжёлый деревянный удар о землю
|
||||||
|
levelUp = S(1840525342, 0.5), -- Harp Glissando (A)
|
||||||
|
quest = S(9126073318, 0.5), -- Bell Tone Ding 2
|
||||||
|
}
|
||||||
|
Config.DefaultVolume = { music = 0.6, sfx = 0.8 }
|
||||||
|
|
||||||
---------------------------------------------------------------- донат (Robux)
|
---------------------------------------------------------------- донат (Robux)
|
||||||
-- ВАЖНО: впиши сюда ID своих пропусков и товаров с create.roblox.com.
|
-- Все товары — Developer Products игры (create.roblox.com → Monetization → Developer Products);
|
||||||
|
-- id — Product ID оттуда, robux — цена для кнопки (должна совпадать с ценой в Roblox).
|
||||||
|
-- Пропуска тоже Developer Products: покупаются один раз, сервер запоминает их в данных игрока навсегда.
|
||||||
-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен.
|
-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен.
|
||||||
Config.GamePasses = {
|
Config.GamePasses = {
|
||||||
{ key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и монет, корона над головой" },
|
{ key = "VIP", id = 3728143641, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и серебра, корона над головой" },
|
||||||
{ key = "DoubleCoins", id = 0, robux = 299, icon = "💰", name = "x2 Монеты", desc = "Вся рыба продаётся в 2 раза дороже" },
|
{ key = "DoubleCoins", id = 3728143692, robux = 299, icon = "⚪", name = "x2 Серебро", desc = "Вся рыба продаётся в 2 раза дороже" },
|
||||||
{ key = "LuckyCharm", id = 0, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" },
|
{ key = "LuckyCharm", id = 3728143735, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" },
|
||||||
{ key = "BigBag", id = 0, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" },
|
{ key = "BigBag", id = 3728143773, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" },
|
||||||
}
|
}
|
||||||
Config.Products = {
|
Config.Products = {
|
||||||
{ key = "Coins1", id = 0, robux = 49, icon = "🪙", name = "Мешок монет", desc = "+1 000 монет (больше с уровнем)", coins = 1000 },
|
{ key = "Coins1", id = 3728142264, robux = 49, icon = "👝", name = "Кошель серебра", desc = "+1 000 серебра (больше с уровнем)", coins = 1000 },
|
||||||
{ key = "Coins2", id = 0, robux = 199, icon = "💰", name = "Сундук монет", desc = "+5 000 монет (больше с уровнем)", coins = 5000 },
|
{ key = "Coins2", id = 3728142848, robux = 199, icon = "⚪", name = "Сундук серебра", desc = "+5 000 серебра (больше с уровнем)", coins = 5000 },
|
||||||
{ key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 монет (больше с уровнем)", coins = 20000 },
|
{ key = "Coins3", id = 3728142885, 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 },
|
{ key = "Luck", id = 3728142916, robux = 99, icon = "🧪", name = "Супер-зелье удачи", desc = "+200% удачи на 15 минут", boost = 2.0, duration = 900 },
|
||||||
}
|
}
|
||||||
|
|
||||||
---------------------------------------------------------------- рыбалка
|
---------------------------------------------------------------- рыбалка
|
||||||
@@ -417,8 +586,105 @@ Config.TutorialDone = 4
|
|||||||
function Config.HitsNeeded(rank)
|
function Config.HitsNeeded(rank)
|
||||||
return math.ceil(rank / 2)
|
return math.ceil(rank / 2)
|
||||||
end
|
end
|
||||||
|
-- опыт до следующего уровня: до 8-го ≈ 3 600 (1,5–2 часа вместе с заказами гильдии);
|
||||||
|
-- у старых сохранений уровень не понижается — копится только опыт внутри уровня
|
||||||
function Config.XPForLevel(level)
|
function Config.XPForLevel(level)
|
||||||
return 60 + level * 60
|
return math.floor(50 * level ^ 1.6)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- гильдия рыбаков
|
||||||
|
-- три валюты: серебро (coins в данных), жемчуг (pearls), печати гильдии (seals — копятся для ранга)
|
||||||
|
Config.Pearls = {
|
||||||
|
mutation = { Shiny = 1, Golden = 3, Rainbow = 10 }, -- за пойманную рыбу с мутацией
|
||||||
|
boss = 5, -- за победу над боссом
|
||||||
|
daily7 = 5, -- 7-й день ежедневной награды
|
||||||
|
rankUp = 10, -- за новый ранг
|
||||||
|
}
|
||||||
|
|
||||||
|
-- ранги: seals — сколько печатей нужно накопить, trial — испытание у Старейшины,
|
||||||
|
-- orders — заказов на доске, traps — ловушек, discount — скидка у торговцев
|
||||||
|
-- trial.kind: deliver (сдать рыбу из сумки), catch (поймать с условием), bossWin (участие в победе над боссом),
|
||||||
|
-- dex (собрать коллекцию мира)
|
||||||
|
Config.Guild = {
|
||||||
|
elder = "Старейшина Ворон",
|
||||||
|
ranks = {
|
||||||
|
{ id = "F", name = "Ученик", seals = 0, orders = 3, color = Color3.fromRGB(150, 150, 150),
|
||||||
|
unlocks = "Мир 1, доска заказов" },
|
||||||
|
{ id = "E", name = "Подмастерье", seals = 30, orders = 4, color = Color3.fromRGB(90, 190, 90), auto = true,
|
||||||
|
trial = { kind = "deliver", fish = "Okun", count = 5, text = "Сдать 5 окуней" },
|
||||||
|
unlocks = "🎣 Автоловля, 4-й заказ на доске" },
|
||||||
|
{ id = "D", name = "Рыбак", seals = 120, orders = 4, color = Color3.fromRGB(70, 130, 230), auto = true, traps = 1,
|
||||||
|
trial = { kind = "catch", minRank = 3, weathers = { Rain = true, Storm = true }, count = 1, text = "Поймать «Редкую» рыбу в дождь или грозу" },
|
||||||
|
unlocks = "🏝 Мир 2 (и ур. 8), 🧺 ловушка" },
|
||||||
|
{ id = "C", name = "Опытный рыбак", seals = 350, orders = 4, color = Color3.fromRGB(150, 80, 200), auto = true, traps = 2, discount = 0.05,
|
||||||
|
trial = { kind = "bossWin", count = 1, text = "Помочь одолеть босса озера" },
|
||||||
|
unlocks = "🧺 2 ловушки, скидка у торговцев 5%" },
|
||||||
|
{ id = "B", name = "Мастер", seals = 900, orders = 4, color = Color3.fromRGB(200, 50, 45), auto = true, traps = 3, discount = 0.05,
|
||||||
|
trial = { kind = "dex", world = "World1", text = "Собрать всю коллекцию «Тихого озера»" },
|
||||||
|
unlocks = "❄ Мир 3 (и ур. 18), 🧺 3 ловушки" },
|
||||||
|
{ id = "A", name = "Магистр", seals = 2000, orders = 4, color = Color3.fromRGB(230, 180, 60), auto = true, traps = 3, discount = 0.10,
|
||||||
|
trial = { kind = "catch", minRank = 4, night = true, count = 1, text = "Поймать «Эпическую» рыбу ночью" },
|
||||||
|
unlocks = "Титул «Магистр», скидка 10%" },
|
||||||
|
{ id = "S", name = "Легенда", seals = 4500, orders = 4, color = Color3.fromRGB(255, 120, 200), auto = true, traps = 3, discount = 0.10, autoNoCap = true,
|
||||||
|
trial = { kind = "catch", minRank = 6, count = 1, text = "Поймать «Мифическую» рыбу" },
|
||||||
|
unlocks = "Золотой жетон, автоловля без ограничения редкости" },
|
||||||
|
},
|
||||||
|
-- миры требуют и уровень, и ранг (номер в списке ranks)
|
||||||
|
worldRank = { World2 = 3, World3 = 5 },
|
||||||
|
elderDistance = 22, -- взять испытание / сдать рыбу — рядом со Старейшиной или доской
|
||||||
|
}
|
||||||
|
|
||||||
|
-- заказы гильдии: личные, обновляются каждые period секунд (окно floor(os.time()/period)),
|
||||||
|
-- один заказ можно перебросить за rerollPearls жемчуга. Награда растёт с рангом
|
||||||
|
Config.Orders = {
|
||||||
|
period = 10800,
|
||||||
|
rerollPearls = 2,
|
||||||
|
pearlChance = 0.2, pearlsMin = 1, pearlsMax = 3,
|
||||||
|
coinsPerSeal = 12, -- серебро за заказ = печати × это × (1 + 0.5 · (ранг − 1))
|
||||||
|
-- weight — как часто выпадает; seals — печати {мин, макс}
|
||||||
|
kinds = {
|
||||||
|
deliver = { weight = 3, seals = { 5, 12 } },
|
||||||
|
heavy = { weight = 2, seals = { 8, 16 } },
|
||||||
|
weather = { weight = 1, seals = { 10, 20 } },
|
||||||
|
night = { weight = 1, seals = { 10, 22 } },
|
||||||
|
combo = { weight = 2, seals = { 8, 18 } },
|
||||||
|
perfect = { weight = 2, seals = { 6, 14 } },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- наживка: 1 слот, 1 штука тратится на заброс. price — за пачку из pack штук; currency = "pearls" — за жемчуг
|
||||||
|
Config.Baits = {
|
||||||
|
{ id = "Worm", name = "Червь", icon = "🐛", price = 40, pack = 10, speed = 0.9, desc = "Клюёт на 10% быстрее" },
|
||||||
|
{ id = "Larva", name = "Мотыль", icon = "🦐", price = 90, pack = 10, luck = 0.15, desc = "Удача +15%" },
|
||||||
|
{ id = "Firefly", name = "Светлячок", icon = "✨", price = 120, pack = 10, nightLuck = 0.30, desc = "Ночью удача +30% (вместо +10%)" },
|
||||||
|
{ id = "Blood", name = "Кровавая приманка", icon = "🩸", price = 400, pack = 10, rareWeight = 1.5, rank = 3, desc = "Редкие и выше попадаются в 1,5 раза чаще" },
|
||||||
|
{ id = "Pearl", name = "Жемчужная блесна", icon = "🦪", price = 5, pack = 5, mutation = 2, currency = "pearls", desc = "Шанс мутаций ×2" },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- автоловля (с ранга E): сервер сам забрасывает и вытаскивает, но со штрафами
|
||||||
|
Config.AutoFish = {
|
||||||
|
luck = 0.6, -- удача ×0.6
|
||||||
|
maxRarity = 3, -- не выше «Редкой» (ранг S снимает)
|
||||||
|
slower = 1.5, -- каждая поимка на 50% дольше
|
||||||
|
reel = 2.5, -- секунд «вываживания» вместо мини-игры
|
||||||
|
}
|
||||||
|
|
||||||
|
-- ловушки-вентери (с ранга D): 1 рыба Мира 1 каждые every секунд, не больше max, копятся и офлайн
|
||||||
|
Config.Traps = {
|
||||||
|
every = 900, max = 16,
|
||||||
|
world = "World1", rarities = { Common = 3, Uncommon = 1 }, -- вес редкостей
|
||||||
|
}
|
||||||
|
|
||||||
|
-- отдых: пока игрока нет, копится двойной опыт — 1 минута за каждые perOffline минут офлайн, не больше max
|
||||||
|
Config.Rest = { perOffline = 4, max = 3600, mult = 2 }
|
||||||
|
|
||||||
|
function Config.RankById(id)
|
||||||
|
for i, r in ipairs(Config.Guild.ranks) do
|
||||||
|
if r.id == id then
|
||||||
|
return r, i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- помощники
|
---------------------------------------------------------------- помощники
|
||||||
|
|||||||
@@ -14,11 +14,57 @@ local Debris = game:GetService("Debris")
|
|||||||
|
|
||||||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
||||||
|
local Guild = require(script.Parent:WaitForChild("Guild"))
|
||||||
|
|
||||||
local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent")
|
local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent")
|
||||||
remote.Name = "GameEvent"
|
remote.Name = "GameEvent"
|
||||||
remote.Parent = ReplicatedStorage
|
remote.Parent = ReplicatedStorage
|
||||||
|
|
||||||
|
---------------------------------------------------------------- лента активности
|
||||||
|
-- события для всех игроков (FishingClient показывает их в ленте и крупным баннером для редкого улова);
|
||||||
|
-- самые редкие уловы уходят и на другие серверы игры через MessagingService (Config.Feed)
|
||||||
|
local MessagingService = game:GetService("MessagingService")
|
||||||
|
local FEED_TOPIC = "FishFeed"
|
||||||
|
|
||||||
|
local function feed(kind, info)
|
||||||
|
remote:FireAllClients("Feed", kind, info)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- подписка — в фоне: SubscribeAsync ждёт ответа сервиса (в неопубликованном плейсе — долго),
|
||||||
|
-- а скрипт должен сразу дойти до загрузки игроков, телепортов и остального
|
||||||
|
task.spawn(function()
|
||||||
|
pcall(function()
|
||||||
|
MessagingService:SubscribeAsync(FEED_TOPIC, function(msg)
|
||||||
|
local d = msg.Data
|
||||||
|
if type(d) == "table" and d.jobId ~= game.JobId then
|
||||||
|
d.remote = true -- улов на другом сервере
|
||||||
|
feed("catch", d)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- улов в ленту; big — крупный баннер со звуком у всех, global — ещё и на другие серверы
|
||||||
|
local function feedCatch(player, fish, world)
|
||||||
|
local r = Config.Rarities[fish.rarity]
|
||||||
|
local F = Config.Feed
|
||||||
|
local info = {
|
||||||
|
name = player.DisplayName, userId = player.UserId,
|
||||||
|
fish = fish.name, rarity = fish.rarity, mutation = fish.mutation, value = fish.value,
|
||||||
|
world = world and (world.icon .. " " .. world.name) or nil,
|
||||||
|
big = r.rank >= F.announceRank or F.announceMutations[fish.mutation or ""] == true,
|
||||||
|
}
|
||||||
|
feed("catch", info)
|
||||||
|
if r.rank >= F.globalRank or F.globalMutations[fish.mutation or ""] then
|
||||||
|
info.jobId = game.JobId
|
||||||
|
task.spawn(function()
|
||||||
|
pcall(function()
|
||||||
|
MessagingService:PublishAsync(FEED_TOPIC, info)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local rng = Random.new()
|
local rng = Random.new()
|
||||||
local GOLD = Color3.fromRGB(255, 220, 80)
|
local GOLD = Color3.fromRGB(255, 220, 80)
|
||||||
local RED = Color3.fromRGB(255, 120, 120)
|
local RED = Color3.fromRGB(255, 120, 120)
|
||||||
@@ -45,6 +91,11 @@ local function defaultData()
|
|||||||
chain = { index = 1, step = 1, progress = 0, tier = 0 }, daily = { last = 0, streak = 0 },
|
chain = { index = 1, step = 1, progress = 0, tier = 0 }, daily = { last = 0, streak = 0 },
|
||||||
boostUntil = 0, boostBonus = 0,
|
boostUntil = 0, boostBonus = 0,
|
||||||
totalCaught = 0, nextUid = 1, receipts = {},
|
totalCaught = 0, nextUid = 1, receipts = {},
|
||||||
|
passes = {}, -- купленные пропуска (Developer Products): [key] = true
|
||||||
|
coinsEarned = 0, robuxSpent = 0, -- для досок лидеров: всего выручено за рыбу и потрачено Robux
|
||||||
|
settings = { music = Config.DefaultVolume.music, sfx = Config.DefaultVolume.sfx },
|
||||||
|
-- гильдия: жемчуг, печати, отдых (ранг, заказы, наживку, ловушки дополняет Guild.defaults)
|
||||||
|
pearls = 0, seals = 0, rest = 0,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -87,16 +138,12 @@ local function hasPass(player, key)
|
|||||||
return passes[player] ~= nil and passes[player][key] == true
|
return passes[player] ~= nil and passes[player][key] == true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function loadPasses(player)
|
-- пропуска продаются как Developer Products, поэтому владение хранится в данных игрока, а не в Roblox
|
||||||
|
local function loadPasses(player, data)
|
||||||
passes[player] = {}
|
passes[player] = {}
|
||||||
for _, gp in ipairs(Config.GamePasses) do
|
for _, gp in ipairs(Config.GamePasses) do
|
||||||
if gp.id and gp.id > 0 then
|
if data.passes[gp.key] then
|
||||||
local ok, owns = pcall(function()
|
passes[player][gp.key] = true
|
||||||
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gp.id)
|
|
||||||
end)
|
|
||||||
if ok and owns then
|
|
||||||
passes[player][gp.key] = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -106,6 +153,17 @@ local function ev(field, default)
|
|||||||
return (currentEvent and currentEvent[field]) or default
|
return (currentEvent and currentEvent[field]) or default
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- погода и время суток (их ведёт WeatherServer через атрибуты workspace)
|
||||||
|
local function weather()
|
||||||
|
return Config.WeatherById(workspace:GetAttribute("Weather"))
|
||||||
|
end
|
||||||
|
local function isNight()
|
||||||
|
if not Config.DayNight.enabled then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return Config.IsNight(Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart")))
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- расчёты
|
---------------------------------------------------------------- расчёты
|
||||||
|
|
||||||
local function rodLevel(data, rodId)
|
local function rodLevel(data, rodId)
|
||||||
@@ -135,7 +193,7 @@ local function totalLuck(player, data)
|
|||||||
if hasPass(player, "LuckyCharm") then
|
if hasPass(player, "LuckyCharm") then
|
||||||
l += 0.5
|
l += 0.5
|
||||||
end
|
end
|
||||||
return l + ev("luck", 0)
|
return l + ev("luck", 0) + (weather().luck or 0) + (isNight() and Config.DayNight.nightLuck or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function bagCapacity(player, data)
|
local function bagCapacity(player, data)
|
||||||
@@ -265,14 +323,20 @@ local function updateStats(player)
|
|||||||
player:SetAttribute("BoostBonus", boostActive(data))
|
player:SetAttribute("BoostBonus", boostActive(data))
|
||||||
player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time()))
|
player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time()))
|
||||||
player:SetAttribute("TotalCaught", data.totalCaught)
|
player:SetAttribute("TotalCaught", data.totalCaught)
|
||||||
|
player:SetAttribute("CoinsEarned", data.coinsEarned)
|
||||||
|
-- когда откроется следующая ежедневная награда (0 — уже доступна); по ней сундук в лобби прыгает только для тех,
|
||||||
|
-- кому есть что забрать
|
||||||
|
player:SetAttribute("DailyNextAt", data.daily.last >= today() and (data.daily.last + 1) * 86400 or 0)
|
||||||
|
player:SetAttribute("RobuxSpent", data.robuxSpent)
|
||||||
-- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено
|
-- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено
|
||||||
player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0))
|
player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0))
|
||||||
player:SetAttribute("Mastery", masteryCount(data))
|
player:SetAttribute("Mastery", masteryCount(data))
|
||||||
player:SetAttribute("Passes", table.concat(ps, ","))
|
player:SetAttribute("Passes", table.concat(ps, ","))
|
||||||
|
Guild.attrs(player, data)
|
||||||
|
|
||||||
local ls = player:FindFirstChild("leaderstats")
|
local ls = player:FindFirstChild("leaderstats")
|
||||||
if ls then
|
if ls then
|
||||||
ls["Монеты"].Value = data.coins
|
ls["Серебро"].Value = data.coins
|
||||||
ls["Уровень"].Value = data.level
|
ls["Уровень"].Value = data.level
|
||||||
ls["Улов"].Value = data.totalCaught
|
ls["Улов"].Value = data.totalCaught
|
||||||
end
|
end
|
||||||
@@ -288,6 +352,7 @@ local function addXp(player, data, amount)
|
|||||||
end
|
end
|
||||||
if leveled then
|
if leveled then
|
||||||
notify(player, "⭐ Уровень " .. data.level .. "!", GOLD)
|
notify(player, "⭐ Уровень " .. data.level .. "!", GOLD)
|
||||||
|
feed("level", { name = player.DisplayName, userId = player.UserId, level = data.level })
|
||||||
for _, w in ipairs(Config.Worlds) do
|
for _, w in ipairs(Config.Worlds) do
|
||||||
if w.level == data.level and not w.soon then
|
if w.level == data.level and not w.soon then
|
||||||
notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color)
|
notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color)
|
||||||
@@ -296,6 +361,11 @@ local function addXp(player, data, amount)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Guild.init({
|
||||||
|
profiles = profiles, notify = notify, updateStats = updateStats, addXp = addXp, sendInventory = sendInventory,
|
||||||
|
bagCapacity = bagCapacity, isNight = isNight, weather = weather, remote = remote,
|
||||||
|
})
|
||||||
|
|
||||||
local function applyPotion(data, bonus, duration)
|
local function applyPotion(data, bonus, duration)
|
||||||
data.boostBonus = math.max(boostActive(data), bonus)
|
data.boostBonus = math.max(boostActive(data), bonus)
|
||||||
data.boostUntil = math.max(os.time(), data.boostUntil) + duration
|
data.boostUntil = math.max(os.time(), data.boostUntil) + duration
|
||||||
@@ -374,9 +444,13 @@ local function claimDaily(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
data.daily = { last = t, streak = streak }
|
data.daily = { last = t, streak = streak }
|
||||||
|
if streak == 7 then
|
||||||
|
data.pearls += Config.Pearls.daily7
|
||||||
|
extra ..= (" + %d 🦪"):format(Config.Pearls.daily7)
|
||||||
|
end
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendQuests(player)
|
sendQuests(player)
|
||||||
notify(player, ("🎁 День %d: +%d 💰%s"):format(streak, coins, extra), GOLD)
|
notify(player, ("🎁 День %d: +%d ⚪%s"):format(streak, coins, extra), GOLD)
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- коллекция
|
---------------------------------------------------------------- коллекция
|
||||||
@@ -402,7 +476,7 @@ local function claimCollection(player, worldId, rarity)
|
|||||||
if rarity == "Master" then
|
if rarity == "Master" then
|
||||||
local coins = Config.MasteryCoins * world.mult
|
local coins = Config.MasteryCoins * world.mult
|
||||||
data.coins += coins
|
data.coins += coins
|
||||||
notify(player, ("🏆 «%s» собран! +%d 💰"):format(world.name, coins), GOLD)
|
notify(player, ("🏆 «%s» собран! +%d ⚪"):format(world.name, coins), GOLD)
|
||||||
else
|
else
|
||||||
local r = Config.CollectionRewards[rarity]
|
local r = Config.CollectionRewards[rarity]
|
||||||
if not r then
|
if not r then
|
||||||
@@ -410,7 +484,7 @@ local function claimCollection(player, worldId, rarity)
|
|||||||
end
|
end
|
||||||
data.coins += r.coins * world.mult
|
data.coins += r.coins * world.mult
|
||||||
addXp(player, data, r.xp * world.mult)
|
addXp(player, data, r.xp * world.mult)
|
||||||
notify(player, ("📖 +%d 💰 +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN)
|
notify(player, ("📖 +%d ⚪ +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN)
|
||||||
end
|
end
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
@@ -734,12 +808,19 @@ local function stopFishing(player, tellClient)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function rollFish(player, data, worldId, luckMult)
|
-- mods: { bait = наживка из Config.Baits, maxRank = потолок редкости (автоловля) }
|
||||||
|
local function rollFish(player, data, worldId, luckMult, mods)
|
||||||
local zone = Config.Zones[worldId]
|
local zone = Config.Zones[worldId]
|
||||||
if not zone then
|
if not zone then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local luck = totalLuck(player, data) * (luckMult or 1)
|
mods = mods or {}
|
||||||
|
local bait = mods.bait
|
||||||
|
local base = totalLuck(player, data) + (bait and bait.luck or 0)
|
||||||
|
if bait and bait.nightLuck and isNight() then
|
||||||
|
base += bait.nightLuck - Config.DayNight.nightLuck -- светлячок: ночью +30% вместо обычных +10%
|
||||||
|
end
|
||||||
|
local luck = base * (luckMult or 1)
|
||||||
local bonus = luck - 1
|
local bonus = luck - 1
|
||||||
local weights, total = {}, 0
|
local weights, total = {}, 0
|
||||||
for i, f in ipairs(zone.fish) do
|
for i, f in ipairs(zone.fish) do
|
||||||
@@ -748,6 +829,12 @@ local function rollFish(player, data, worldId, luckMult)
|
|||||||
if r.rank == 1 then
|
if r.rank == 1 then
|
||||||
w = r.weight / math.max(1, luck)
|
w = r.weight / math.max(1, luck)
|
||||||
end
|
end
|
||||||
|
if bait and bait.rareWeight and r.rank >= 3 then
|
||||||
|
w *= bait.rareWeight
|
||||||
|
end
|
||||||
|
if mods.maxRank and r.rank > mods.maxRank then
|
||||||
|
w = 0
|
||||||
|
end
|
||||||
weights[i] = w
|
weights[i] = w
|
||||||
total += w
|
total += w
|
||||||
end
|
end
|
||||||
@@ -762,7 +849,7 @@ local function rollFish(player, data, worldId, luckMult)
|
|||||||
end
|
end
|
||||||
local mutation = nil
|
local mutation = nil
|
||||||
for _, m in ipairs(Config.Mutations) do
|
for _, m in ipairs(Config.Mutations) do
|
||||||
if rng:NextNumber() < m.chance * luck * ev("mutation", 1) then
|
if rng:NextNumber() < m.chance * luck * ev("mutation", 1) * (weather().mutation or 1) * (bait and bait.mutation or 1) then
|
||||||
mutation = m
|
mutation = m
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -818,12 +905,21 @@ local function flyBobber(s, tool, target, dur, arc)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local autoFishing = {} -- [player] = токен работающей автоловли
|
||||||
|
local setAutoFish, grantFish -- объявлены ниже
|
||||||
|
|
||||||
local function onCast(player, power)
|
local function onCast(player, power)
|
||||||
power = math.clamp(tonumber(power) or 0.6, 0, 1)
|
power = math.clamp(tonumber(power) or 0.6, 0, 1)
|
||||||
local data = profiles[player]
|
local data = profiles[player]
|
||||||
if not data then
|
if not data then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if autoFishing[player] then
|
||||||
|
-- клик удочкой во время автоловли — выключить её
|
||||||
|
setAutoFish(player, false)
|
||||||
|
remote:FireClient(player, "CastFail")
|
||||||
|
return
|
||||||
|
end
|
||||||
if fishing[player] then
|
if fishing[player] then
|
||||||
stopFishing(player, true)
|
stopFishing(player, true)
|
||||||
return
|
return
|
||||||
@@ -856,7 +952,8 @@ local function onCast(player, power)
|
|||||||
|
|
||||||
local stats = Config.RodStats(data.rod, rodLevel(data))
|
local stats = Config.RodStats(data.rod, rodLevel(data))
|
||||||
local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2]
|
local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2]
|
||||||
local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1)
|
local bait = Guild.useBait(player, data) -- 1 штука наживки на заброс
|
||||||
|
local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1, { bait = bait })
|
||||||
if not fish then
|
if not fish then
|
||||||
remote:FireClient(player, "CastFail")
|
remote:FireClient(player, "CastFail")
|
||||||
return
|
return
|
||||||
@@ -886,7 +983,7 @@ local function onCast(player, power)
|
|||||||
end
|
end
|
||||||
s.stage = "waiting"
|
s.stage = "waiting"
|
||||||
|
|
||||||
local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1)
|
local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) * (weather().speed or 1) * (bait and bait.speed or 1)
|
||||||
task.wait(waitTime)
|
task.wait(waitTime)
|
||||||
if fishing[player] ~= s then
|
if fishing[player] ~= s then
|
||||||
return
|
return
|
||||||
@@ -957,14 +1054,22 @@ local function onCatch(player, success, misses)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } })
|
gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } })
|
||||||
|
grantFish(player, data, s.fish, { perfect = s.perfect, misses = misses, fromPos = fromPos })
|
||||||
|
end
|
||||||
|
|
||||||
-- серия: каждая рыба подряд дороже и даёт больше опыта
|
-- рыба поймана (руками или автоловлей): в сумку, опыт, коллекция, задания, гильдия, босс.
|
||||||
local fish = s.fish
|
-- ctx: { perfect, misses, fromPos, auto }; у автоловли нет серии и бонусов за точность
|
||||||
|
grantFish = function(player, data, fish, ctx)
|
||||||
local streak = combo[player] or 0
|
local streak = combo[player] or 0
|
||||||
local comboMult = math.min(Config.Combo.max, 1 + Config.Combo.step * streak)
|
local comboMult = 1
|
||||||
fish.value = math.floor(fish.value * comboMult + 0.5)
|
if not ctx.auto then
|
||||||
fish.xp = math.floor(fish.xp * comboMult + 0.5)
|
-- серия: каждая рыба подряд дороже и даёт больше опыта
|
||||||
setCombo(player, streak + 1)
|
comboMult = math.min(Config.Combo.max, 1 + Config.Combo.step * streak)
|
||||||
|
fish.value = math.floor(fish.value * comboMult + 0.5)
|
||||||
|
fish.xp = math.floor(fish.xp * comboMult + 0.5)
|
||||||
|
setCombo(player, streak + 1)
|
||||||
|
end
|
||||||
|
fish.xp = math.floor(fish.xp * Guild.xpMult(data)) -- бонус отдыха: двойной опыт
|
||||||
table.insert(data.items, {
|
table.insert(data.items, {
|
||||||
uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity,
|
uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity,
|
||||||
weight = fish.weight, value = fish.value, mutation = fish.mutation,
|
weight = fish.weight, value = fish.value, mutation = fish.mutation,
|
||||||
@@ -987,10 +1092,14 @@ local function onCatch(player, success, misses)
|
|||||||
addXp(player, data, fish.xp * (isNew and 2 or 1))
|
addXp(player, data, fish.xp * (isNew and 2 or 1))
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
if fromPos then
|
if ctx.fromPos then
|
||||||
showFishFlight(player, fish, fromPos)
|
showFishFlight(player, fish, ctx.fromPos)
|
||||||
|
end
|
||||||
|
remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord, combo = comboMult, streak = ctx.auto and 0 or streak + 1, auto = ctx.auto })
|
||||||
|
do
|
||||||
|
local h = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
feedCatch(player, fish, h and Config.WorldAt(h.Position))
|
||||||
end
|
end
|
||||||
remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord, combo = comboMult, streak = streak + 1 })
|
|
||||||
|
|
||||||
local rank = Config.Rarities[fish.rarity].rank
|
local rank = Config.Rarities[fish.rarity].rank
|
||||||
questProgress(player, "catch", 1)
|
questProgress(player, "catch", 1)
|
||||||
@@ -1000,16 +1109,160 @@ local function onCatch(player, success, misses)
|
|||||||
if rank >= 3 then
|
if rank >= 3 then
|
||||||
questProgress(player, "rare", 1)
|
questProgress(player, "rare", 1)
|
||||||
end
|
end
|
||||||
if misses == 0 then
|
if not ctx.auto then
|
||||||
questProgress(player, "perfect", 1)
|
if ctx.misses == 0 then
|
||||||
|
questProgress(player, "perfect", 1)
|
||||||
|
end
|
||||||
|
if ctx.perfect then
|
||||||
|
questProgress(player, "perfectCast", 1)
|
||||||
|
end
|
||||||
|
questProgress(player, "combo", streak + 1, true)
|
||||||
end
|
end
|
||||||
if s.perfect then
|
Guild.onCatch(player, data, fish, {
|
||||||
questProgress(player, "perfectCast", 1)
|
weather = workspace:GetAttribute("Weather"), night = isNight(),
|
||||||
end
|
perfect = ctx.perfect and not ctx.auto, streak = (not ctx.auto) and streak + 1 or 0,
|
||||||
questProgress(player, "combo", streak + 1, true)
|
})
|
||||||
|
|
||||||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
bossHit(player, hrp and Config.WorldAt(hrp.Position), rank + (misses == 0 and 1 or 0))
|
bossHit(player, hrp and Config.WorldAt(hrp.Position), rank + (ctx.misses == 0 and 1 or 0))
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- автоловля (с ранга E)
|
||||||
|
-- сервер сам забрасывает и вытаскивает: удача ×0.6, не выше «Редкой», без серии и бонуса заброса,
|
||||||
|
-- каждая поимка на 50% дольше. Стоп — полная сумка, отошёл от места, сменил мир, убрал удочку
|
||||||
|
|
||||||
|
local function autoFishLoop(player, token)
|
||||||
|
local A = Config.AutoFish
|
||||||
|
local home = nil -- где включили: отошёл дальше 10 studs или сменил мир — стоп
|
||||||
|
local function stop(reason)
|
||||||
|
if autoFishing[player] == token then
|
||||||
|
setAutoFish(player, false, reason)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
while autoFishing[player] == token do
|
||||||
|
local data = profiles[player]
|
||||||
|
local char = player.Character
|
||||||
|
local hrp = char and char:FindFirstChild("HumanoidRootPart")
|
||||||
|
local tool = char and char:FindFirstChildOfClass("Tool")
|
||||||
|
if not data or not hrp then
|
||||||
|
return stop(nil)
|
||||||
|
end
|
||||||
|
if not tool or not tool:GetAttribute("IsRod") then
|
||||||
|
return stop("🎣 Автоловля: возьми удочку в руки")
|
||||||
|
end
|
||||||
|
local world = Config.WorldAt(hrp.Position)
|
||||||
|
if not world or Config.CanCastFrom(world, hrp.Position) ~= true then
|
||||||
|
return stop("🌊 Автоловля: встань у воды")
|
||||||
|
end
|
||||||
|
home = home or { pos = hrp.Position, world = world.id }
|
||||||
|
if world.id ~= home.world or (hrp.Position - home.pos).Magnitude > 10 then
|
||||||
|
return stop("🎣 Автоловля остановлена: ты отошёл")
|
||||||
|
end
|
||||||
|
if #data.items >= bagCapacity(player, data) then
|
||||||
|
return stop("🎒 Сумка полна — автоловля остановлена")
|
||||||
|
end
|
||||||
|
local target, dist = findWater(hrp, world, 0.6)
|
||||||
|
if not target then
|
||||||
|
return stop("🌊 Автоловля: встань у воды")
|
||||||
|
end
|
||||||
|
if fishing[player] then
|
||||||
|
task.wait(0.5)
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
|
local bait = Guild.useBait(player, data)
|
||||||
|
local fish = rollFish(player, data, world.id, A.luck, { bait = bait, maxRank = (not Guild.rank(data).autoNoCap) and A.maxRarity or nil })
|
||||||
|
local s = { stage = "casting", fish = fish, tool = tool, auto = true }
|
||||||
|
fishing[player] = s
|
||||||
|
local splashAt = target + Vector3.new(0, 0.15, 0)
|
||||||
|
local tw = tweenGrip(tool, 8, 0.15)
|
||||||
|
if tw then
|
||||||
|
tw.Completed:Wait()
|
||||||
|
end
|
||||||
|
if fishing[player] == s then
|
||||||
|
flyBobber(s, tool, splashAt, 0.35 + dist * 0.018, 2 + dist * 0.3)
|
||||||
|
tweenGrip(tool, REST_ANGLE - 5, 0.4)
|
||||||
|
end
|
||||||
|
if fishing[player] ~= s then
|
||||||
|
if s.bobber then
|
||||||
|
s.bobber:Destroy()
|
||||||
|
end
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
s.stage = "waiting"
|
||||||
|
local stats = Config.RodStats(data.rod, rodLevel(data))
|
||||||
|
local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1)
|
||||||
|
* (weather().speed or 1) * (bait and bait.speed or 1) * A.slower
|
||||||
|
local t0, bit = os.clock(), false
|
||||||
|
while fishing[player] == s and autoFishing[player] == token and os.clock() - t0 < waitTime + A.reel do
|
||||||
|
local h = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
if not h or (h.Position - home.pos).Magnitude > 10 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if not bit and os.clock() - t0 >= waitTime then
|
||||||
|
-- клюёт: всплеск и удочка дёргается до конца «вываживания»
|
||||||
|
bit = true
|
||||||
|
if s.bobber and s.bobber.PrimaryPart then
|
||||||
|
splash(s.bobber.PrimaryPart, 25)
|
||||||
|
playSound(s.bobber.PrimaryPart, SPLASH_SOUND, 0.35)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if bit then
|
||||||
|
tweenGrip(tool, (math.floor(os.clock() * 8) % 2 == 0) and 38 or 18, 0.12)
|
||||||
|
end
|
||||||
|
task.wait(0.13)
|
||||||
|
end
|
||||||
|
if fishing[player] ~= s or autoFishing[player] ~= token or not bit or os.clock() - t0 < waitTime + A.reel - 0.05 then
|
||||||
|
if fishing[player] == s then
|
||||||
|
stopFishing(player, false)
|
||||||
|
end
|
||||||
|
continue -- наверху цикла проверим, почему прервались (отошёл, выключил)
|
||||||
|
end
|
||||||
|
fishing[player] = nil
|
||||||
|
local fromPos = s.bobber and s.bobber.PrimaryPart and s.bobber.PrimaryPart.Position
|
||||||
|
if s.bobber then
|
||||||
|
s.bobber:Destroy()
|
||||||
|
end
|
||||||
|
gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } })
|
||||||
|
grantFish(player, data, fish, { auto = true, fromPos = fromPos })
|
||||||
|
task.wait(1.2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
setAutoFish = function(player, on, reason)
|
||||||
|
local data = profiles[player]
|
||||||
|
if on then
|
||||||
|
if not data then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not Guild.rank(data).auto then
|
||||||
|
notify(player, "🔒 Автоловля — с ранга гильдии E", RED)
|
||||||
|
player:SetAttribute("AutoFish", false)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if autoFishing[player] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if fishing[player] then
|
||||||
|
stopFishing(player, true)
|
||||||
|
end
|
||||||
|
local token = {}
|
||||||
|
autoFishing[player] = token
|
||||||
|
player:SetAttribute("AutoFish", true)
|
||||||
|
notify(player, "🎣 Автоловля включена", GREEN)
|
||||||
|
task.spawn(autoFishLoop, player, token)
|
||||||
|
else
|
||||||
|
player:SetAttribute("AutoFish", false)
|
||||||
|
if not autoFishing[player] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
autoFishing[player] = nil
|
||||||
|
local s = fishing[player]
|
||||||
|
if s and s.auto then
|
||||||
|
stopFishing(player, false)
|
||||||
|
end
|
||||||
|
notify(player, reason or "🎣 Автоловля выключена", Color3.fromRGB(255, 200, 120))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- скупка
|
---------------------------------------------------------------- скупка
|
||||||
@@ -1062,6 +1315,7 @@ local function sellItems(player, filterUid)
|
|||||||
end
|
end
|
||||||
data.items = keep
|
data.items = keep
|
||||||
data.coins += total
|
data.coins += total
|
||||||
|
data.coinsEarned += total
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
remote:FireClient(player, "Sold", total, count)
|
remote:FireClient(player, "Sold", total, count)
|
||||||
@@ -1086,9 +1340,9 @@ local function buy(player, kind, id)
|
|||||||
notify(player, "★★★★★ Максимум", GOLD)
|
notify(player, "★★★★★ Максимум", GOLD)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local cost = Config.UpgradeCost(rod, lvl)
|
local cost = Guild.price(data, Config.UpgradeCost(rod, lvl)) -- скидка ранга гильдии
|
||||||
if data.coins < cost then
|
if data.coins < cost then
|
||||||
notify(player, "Нужно " .. cost .. " 💰", RED)
|
notify(player, "Нужно " .. cost .. " ⚪", RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
data.coins -= cost
|
data.coins -= cost
|
||||||
@@ -1111,11 +1365,12 @@ local function buy(player, kind, id)
|
|||||||
notify(player, "🔒 Нужен ур. " .. potion.level, RED)
|
notify(player, "🔒 Нужен ур. " .. potion.level, RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if data.coins < potion.price then
|
local price = Guild.price(data, potion.price)
|
||||||
notify(player, "Нужно " .. potion.price .. " 💰", RED)
|
if data.coins < price then
|
||||||
|
notify(player, "Нужно " .. price .. " ⚪", RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
data.coins -= potion.price
|
data.coins -= price
|
||||||
applyPotion(data, potion.bonus, potion.duration)
|
applyPotion(data, potion.bonus, potion.duration)
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN)
|
notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN)
|
||||||
@@ -1140,11 +1395,12 @@ local function buy(player, kind, id)
|
|||||||
notify(player, "🔒 Нужен ур. " .. item.level, RED)
|
notify(player, "🔒 Нужен ур. " .. item.level, RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if data.coins < item.price then
|
local price = Guild.price(data, item.price)
|
||||||
notify(player, "Нужно " .. item.price .. " 💰", RED)
|
if data.coins < price then
|
||||||
|
notify(player, "Нужно " .. price .. " ⚪", RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
data.coins -= item.price
|
data.coins -= price
|
||||||
owned[id] = true
|
owned[id] = true
|
||||||
bought = true
|
bought = true
|
||||||
notify(player, "✅ " .. item.name, GREEN)
|
notify(player, "✅ " .. item.name, GREEN)
|
||||||
@@ -1165,6 +1421,12 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------- телепорт
|
---------------------------------------------------------------- телепорт
|
||||||
|
|
||||||
|
local TELEPORT_FADE = 0.3 -- сколько клиент затемняет экран перед переносом
|
||||||
|
local teleporting = {}
|
||||||
|
Players.PlayerRemoving:Connect(function(p)
|
||||||
|
teleporting[p] = nil
|
||||||
|
end)
|
||||||
|
|
||||||
local function teleportTo(player, worldId)
|
local function teleportTo(player, worldId)
|
||||||
local data = profiles[player]
|
local data = profiles[player]
|
||||||
local char = player.Character
|
local char = player.Character
|
||||||
@@ -1187,13 +1449,26 @@ local function teleportTo(player, worldId)
|
|||||||
notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED)
|
notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local okRank, why = Guild.canEnter(data, world.id)
|
||||||
|
if not okRank then
|
||||||
|
notify(player, why, RED)
|
||||||
|
return
|
||||||
|
end
|
||||||
markerName = world.id .. "Spawn"
|
markerName = world.id .. "Spawn"
|
||||||
end
|
end
|
||||||
local map = workspace:FindFirstChild("FishingMap")
|
local map = workspace:FindFirstChild("FishingMap")
|
||||||
local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map)
|
local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map)
|
||||||
if m then
|
if m and not teleporting[player] then
|
||||||
|
-- клиент затемняет экран, переносим уже в темноте: свет новой локации ставится до того, как её видно
|
||||||
|
teleporting[player] = true
|
||||||
stopFishing(player, true)
|
stopFishing(player, true)
|
||||||
char:PivotTo(m.CFrame + Vector3.new(0, 3, 0))
|
remote:FireClient(player, "TeleportFade", worldId, TELEPORT_FADE)
|
||||||
|
task.wait(TELEPORT_FADE)
|
||||||
|
teleporting[player] = nil
|
||||||
|
char = player.Character
|
||||||
|
if char and char.Parent then
|
||||||
|
char:PivotTo(m.CFrame + Vector3.new(0, 3, 0))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1242,6 +1517,10 @@ ProximityPromptService.PromptTriggered:Connect(function(prompt, player)
|
|||||||
remote:FireClient(player, "OpenRobux", "passes")
|
remote:FireClient(player, "OpenRobux", "passes")
|
||||||
elseif action == "RobuxProducts" then
|
elseif action == "RobuxProducts" then
|
||||||
remote:FireClient(player, "OpenRobux", "products")
|
remote:FireClient(player, "OpenRobux", "products")
|
||||||
|
elseif action == "Guild" or action == "Orders" or action == "Bait" or action == "Traps" then
|
||||||
|
-- Старейшина, доска заказов, лавка наживки: окно гильдии на нужной вкладке
|
||||||
|
Guild.sendState(player)
|
||||||
|
remote:FireClient(player, "OpenGuild", ({ Guild = "rank", Orders = "orders", Bait = "bait", Traps = "traps" })[action])
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -1271,13 +1550,13 @@ remote.OnServerEvent:Connect(function(player, action, a, b)
|
|||||||
if nearSeller(player) then
|
if nearSeller(player) then
|
||||||
sellItems(player, a)
|
sellItems(player, a)
|
||||||
else
|
else
|
||||||
notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120))
|
notify(player, "⚪ Только у скупщика", Color3.fromRGB(255, 200, 120))
|
||||||
end
|
end
|
||||||
elseif action == "SellAll" then
|
elseif action == "SellAll" then
|
||||||
if nearSeller(player) then
|
if nearSeller(player) then
|
||||||
sellItems(player, nil)
|
sellItems(player, nil)
|
||||||
else
|
else
|
||||||
notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120))
|
notify(player, "⚪ Только у скупщика", Color3.fromRGB(255, 200, 120))
|
||||||
end
|
end
|
||||||
elseif action == "Teleport" then
|
elseif action == "Teleport" then
|
||||||
teleportTo(player, a)
|
teleportTo(player, a)
|
||||||
@@ -1288,27 +1567,38 @@ remote.OnServerEvent:Connect(function(player, action, a, b)
|
|||||||
elseif action == "RequestInventory" then
|
elseif action == "RequestInventory" then
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
sendQuests(player)
|
sendQuests(player)
|
||||||
|
elseif action == "Settings" then
|
||||||
|
-- громкость музыки и эффектов (0..1), сохраняется вместе с прогрессом
|
||||||
|
local data = profiles[player]
|
||||||
|
local music, sfx = tonumber(a), tonumber(b)
|
||||||
|
if data and music and sfx then
|
||||||
|
data.settings = { music = math.clamp(music, 0, 1), sfx = math.clamp(sfx, 0, 1) }
|
||||||
|
player:SetAttribute("VolMusic", data.settings.music)
|
||||||
|
player:SetAttribute("VolSfx", data.settings.sfx)
|
||||||
|
end
|
||||||
|
elseif action == "AutoFish" then
|
||||||
|
setAutoFish(player, a == true)
|
||||||
|
else
|
||||||
|
Guild.onAction(player, action, a, b)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
---------------------------------------------------------------- донат
|
---------------------------------------------------------------- донат
|
||||||
|
|
||||||
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased)
|
-- все покупки — Developer Products: и наборы (Config.Products), и пропуска навсегда (Config.GamePasses)
|
||||||
if not purchased then
|
local function findProduct(productId)
|
||||||
return
|
for _, p in ipairs(Config.Products) do
|
||||||
end
|
if p.id == productId then
|
||||||
for _, gp in ipairs(Config.GamePasses) do
|
return p, false
|
||||||
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
|
end
|
||||||
end)
|
for _, gp in ipairs(Config.GamePasses) do
|
||||||
|
if gp.id == productId then
|
||||||
|
return gp, true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
MarketplaceService.ProcessReceipt = function(info)
|
MarketplaceService.ProcessReceipt = function(info)
|
||||||
local player = Players:GetPlayerByUserId(info.PlayerId)
|
local player = Players:GetPlayerByUserId(info.PlayerId)
|
||||||
@@ -1321,19 +1611,26 @@ MarketplaceService.ProcessReceipt = function(info)
|
|||||||
return Enum.ProductPurchaseDecision.PurchaseGranted
|
return Enum.ProductPurchaseDecision.PurchaseGranted
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local product
|
local product, isPass = findProduct(info.ProductId)
|
||||||
for _, p in ipairs(Config.Products) do
|
|
||||||
if p.id == info.ProductId then
|
|
||||||
product = p
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not product then
|
if not product then
|
||||||
|
warn("ProcessReceipt: неизвестный товар " .. tostring(info.ProductId))
|
||||||
return Enum.ProductPurchaseDecision.NotProcessedYet
|
return Enum.ProductPurchaseDecision.NotProcessedYet
|
||||||
end
|
end
|
||||||
|
data.robuxSpent += info.CurrencySpent or product.robux or 0
|
||||||
|
feed("buy", { name = player.DisplayName, userId = player.UserId, item = product.icon .. " " .. product.name })
|
||||||
|
if isPass then
|
||||||
|
data.passes[product.key] = true
|
||||||
|
passes[player] = passes[player] or {}
|
||||||
|
passes[player][product.key] = true
|
||||||
|
notify(player, "✅ " .. product.icon .. " " .. product.name .. " — навсегда!", GOLD)
|
||||||
|
if product.key == "VIP" then
|
||||||
|
vipTag(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
if product.coins then
|
if product.coins then
|
||||||
local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15))
|
local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15))
|
||||||
data.coins += coins
|
data.coins += coins
|
||||||
notify(player, ("Спасибо! +%d 💰"):format(coins), GOLD)
|
notify(player, ("Спасибо! +%d ⚪"):format(coins), GOLD)
|
||||||
end
|
end
|
||||||
if product.boost then
|
if product.boost then
|
||||||
applyPotion(data, product.boost, product.duration)
|
applyPotion(data, product.boost, product.duration)
|
||||||
@@ -1418,6 +1715,7 @@ local function finishBoss(won)
|
|||||||
if potion then
|
if potion then
|
||||||
applyPotion(data, potion.bonus, potion.duration)
|
applyPotion(data, potion.bonus, potion.duration)
|
||||||
end
|
end
|
||||||
|
Guild.onBossWin(p, data)
|
||||||
updateStats(p)
|
updateStats(p)
|
||||||
remote:FireClient(p, "BossReward", coins, xp, potion and potion.name)
|
remote:FireClient(p, "BossReward", coins, xp, potion and potion.name)
|
||||||
end
|
end
|
||||||
@@ -1472,10 +1770,13 @@ end)
|
|||||||
---------------------------------------------------------------- игроки
|
---------------------------------------------------------------- игроки
|
||||||
|
|
||||||
local function onPlayerAdded(player)
|
local function onPlayerAdded(player)
|
||||||
|
-- камеру нельзя отвести так далеко, чтобы заглянуть за скалы и край карты
|
||||||
|
player.CameraMinZoomDistance = Config.Camera.minZoom
|
||||||
|
player.CameraMaxZoomDistance = Config.Camera.maxZoom
|
||||||
local ls = Instance.new("Folder")
|
local ls = Instance.new("Folder")
|
||||||
ls.Name = "leaderstats"
|
ls.Name = "leaderstats"
|
||||||
ls.Parent = player
|
ls.Parent = player
|
||||||
for _, name in ipairs({ "Монеты", "Уровень", "Улов" }) do
|
for _, name in ipairs({ "Серебро", "Уровень", "Улов" }) do
|
||||||
local v = Instance.new("IntValue")
|
local v = Instance.new("IntValue")
|
||||||
v.Name = name
|
v.Name = name
|
||||||
v.Parent = ls
|
v.Parent = ls
|
||||||
@@ -1485,13 +1786,19 @@ local function onPlayerAdded(player)
|
|||||||
if not player.Parent then
|
if not player.Parent then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
loadPasses(player)
|
loadPasses(player, data)
|
||||||
ensureChain(data)
|
ensureChain(data)
|
||||||
|
Guild.defaults(data)
|
||||||
|
Guild.onJoin(player, data)
|
||||||
profiles[player] = data
|
profiles[player] = data
|
||||||
loadedOk[player] = ok
|
loadedOk[player] = ok
|
||||||
|
local settings = type(data.settings) == "table" and data.settings or {}
|
||||||
|
player:SetAttribute("VolMusic", tonumber(settings.music) or Config.DefaultVolume.music)
|
||||||
|
player:SetAttribute("VolSfx", tonumber(settings.sfx) or Config.DefaultVolume.sfx)
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
sendQuests(player)
|
sendQuests(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
|
||||||
local function onCharacter()
|
local function onCharacter()
|
||||||
stopFishing(player, false)
|
stopFishing(player, false)
|
||||||
@@ -1499,6 +1806,7 @@ local function onPlayerAdded(player)
|
|||||||
giveRodTool(player)
|
giveRodTool(player)
|
||||||
attachBag(player)
|
attachBag(player)
|
||||||
vipTag(player)
|
vipTag(player)
|
||||||
|
Guild.badge(player)
|
||||||
end
|
end
|
||||||
player.CharacterAdded:Connect(onCharacter)
|
player.CharacterAdded:Connect(onCharacter)
|
||||||
if player.Character then
|
if player.Character then
|
||||||
@@ -1514,6 +1822,10 @@ end
|
|||||||
Players.PlayerRemoving:Connect(function(player)
|
Players.PlayerRemoving:Connect(function(player)
|
||||||
stopFishing(player, false)
|
stopFishing(player, false)
|
||||||
combo[player], comboUntil[player] = nil, nil
|
combo[player], comboUntil[player] = nil, nil
|
||||||
|
autoFishing[player] = nil
|
||||||
|
if profiles[player] then
|
||||||
|
Guild.onLeave(profiles[player])
|
||||||
|
end
|
||||||
saveData(player)
|
saveData(player)
|
||||||
profiles[player] = nil
|
profiles[player] = nil
|
||||||
loadedOk[player] = nil
|
loadedOk[player] = nil
|
||||||
@@ -1522,21 +1834,42 @@ end)
|
|||||||
|
|
||||||
game:BindToClose(function()
|
game:BindToClose(function()
|
||||||
for _, p in ipairs(Players:GetPlayers()) do
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
|
if profiles[p] then
|
||||||
|
Guild.onLeave(profiles[p])
|
||||||
|
end
|
||||||
saveData(p)
|
saveData(p)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- погода и ночь меняют удачу: пересчитываем её у всех, когда они меняются
|
||||||
|
local function refreshAllStats()
|
||||||
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
|
updateStats(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
workspace:GetAttributeChangedSignal("Weather"):Connect(refreshAllStats)
|
||||||
|
|
||||||
-- таймер зелий + автосохранение
|
-- таймер зелий + автосохранение
|
||||||
task.spawn(function()
|
task.spawn(function()
|
||||||
local t = 0
|
local t = 0
|
||||||
|
local wasNight = isNight()
|
||||||
while true do
|
while true do
|
||||||
task.wait(1)
|
task.wait(1)
|
||||||
t += 1
|
t += 1
|
||||||
|
local night = isNight()
|
||||||
|
if night ~= wasNight then
|
||||||
|
wasNight = night
|
||||||
|
refreshAllStats()
|
||||||
|
end
|
||||||
for _, p in ipairs(Players:GetPlayers()) do
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
local data = profiles[p]
|
local data = profiles[p]
|
||||||
if data and data.boostUntil > os.time() - 2 then
|
if data and data.boostUntil > os.time() - 2 then
|
||||||
updateStats(p)
|
updateStats(p)
|
||||||
end
|
end
|
||||||
|
-- бонус отдыха тратится, пока игрок рыбачит
|
||||||
|
if data and (fishing[p] or autoFishing[p]) then
|
||||||
|
Guild.spendRest(p, data, 1)
|
||||||
|
end
|
||||||
-- серия сгорает, если долго нет улова (пока рыба на крючке — ждём)
|
-- серия сгорает, если долго нет улова (пока рыба на крючке — ждём)
|
||||||
if comboUntil[p] and os.time() > comboUntil[p] and not fishing[p] then
|
if comboUntil[p] and os.time() > comboUntil[p] and not fishing[p] then
|
||||||
breakCombo(p)
|
breakCombo(p)
|
||||||
|
|||||||
@@ -132,7 +132,8 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------- детали
|
---------------------------------------------------------------- детали
|
||||||
-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры)
|
-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры)
|
||||||
function Builder.build(parent)
|
-- makePortal — WorldBuilder.portalModel: ставит модель портала из шаблона (без него строится старое кольцо)
|
||||||
|
function Builder.build(parent, makePortal)
|
||||||
buildTerrain()
|
buildTerrain()
|
||||||
|
|
||||||
local rng = Random.new(7)
|
local rng = Random.new(7)
|
||||||
@@ -541,20 +542,30 @@ function Builder.build(parent)
|
|||||||
portalModel.Name = "PortalToLobby"
|
portalModel.Name = "PortalToLobby"
|
||||||
portalModel.Parent = map
|
portalModel.Parent = map
|
||||||
local center = baseCF * CFrame.new(0, 10, 0)
|
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), Parent = portalModel })
|
local fancy = makePortal and makePortal(baseCF, color, "PortalModel_Lobby", portalModel)
|
||||||
P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel })
|
local disc
|
||||||
local R, n = 7, 20
|
if fancy then
|
||||||
for i = 0, n - 1 do
|
-- модель из шаблона; невидимый якорь держит подсказку, подпись и искры
|
||||||
local a = (i + 0.5) / n * math.pi * 2
|
disc = P({
|
||||||
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), Parent = portalModel })
|
Name = "Portal_Lobby", Size = V(1, 1, 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0),
|
||||||
if i % 2 == 0 then
|
Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false, Parent = portalModel,
|
||||||
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, Parent = portalModel })
|
})
|
||||||
|
else
|
||||||
|
P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115), Parent = portalModel })
|
||||||
|
P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel })
|
||||||
|
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), Parent = portalModel })
|
||||||
|
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, Parent = portalModel })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
disc = P({
|
||||||
|
Name = "Portal_Lobby", 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, Parent = portalModel,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
local disc = P({
|
|
||||||
Name = "Portal_Lobby", 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, Parent = portalModel,
|
|
||||||
})
|
|
||||||
local pe = Instance.new("ParticleEmitter")
|
local pe = Instance.new("ParticleEmitter")
|
||||||
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||||||
pe.LightEmission = 1
|
pe.LightEmission = 1
|
||||||
@@ -567,7 +578,7 @@ function Builder.build(parent)
|
|||||||
pe.Parent = disc
|
pe.Parent = disc
|
||||||
local bb = Instance.new("BillboardGui")
|
local bb = Instance.new("BillboardGui")
|
||||||
bb.Size = UDim2.fromOffset(250, 64)
|
bb.Size = UDim2.fromOffset(250, 64)
|
||||||
bb.StudsOffset = V(0, 10, 0)
|
bb.StudsOffset = V(0, fancy and 7 or 10, 0)
|
||||||
bb.MaxDistance = 160
|
bb.MaxDistance = 160
|
||||||
bb.LightInfluence = 0
|
bb.LightInfluence = 0
|
||||||
bb.Parent = disc
|
bb.Parent = disc
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
-- ProximityPrompt с атрибутом Action (Shop, Sell, Portal, Daily, Talk, ...).
|
-- ProximityPrompt с атрибутом Action (Shop, Sell, Portal, Daily, Talk, ...).
|
||||||
|
|
||||||
local Workspace = game:GetService("Workspace")
|
local Workspace = game:GetService("Workspace")
|
||||||
|
local ServerStorage = game:GetService("ServerStorage")
|
||||||
local Lighting = game:GetService("Lighting")
|
local Lighting = game:GetService("Lighting")
|
||||||
local Players = game:GetService("Players")
|
local Players = game:GetService("Players")
|
||||||
local RunService = game:GetService("RunService")
|
local RunService = game:GetService("RunService")
|
||||||
@@ -61,20 +62,29 @@ local function ensure(class, parent, props)
|
|||||||
return obj
|
return obj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Базовый свет при запуске игры (совпадает со светом лобби). Под каждую локацию его меняет клиент
|
||||||
|
-- по полям look из FishConfig, пока игрок за экраном загрузки.
|
||||||
function Builder.applyLighting()
|
function Builder.applyLighting()
|
||||||
Lighting.ClockTime = 14.5
|
Lighting.ClockTime = 16.3
|
||||||
Lighting.Brightness = 2.3
|
Lighting.Brightness = 2.0
|
||||||
Lighting.Ambient = Color3.fromRGB(70, 70, 85)
|
Lighting.ExposureCompensation = -0.3
|
||||||
Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160)
|
Lighting.Ambient = Color3.fromRGB(64, 60, 72)
|
||||||
Lighting.EnvironmentDiffuseScale = 0.6
|
Lighting.OutdoorAmbient = Color3.fromRGB(120, 114, 124)
|
||||||
Lighting.EnvironmentSpecularScale = 0.8
|
Lighting.ColorShift_Top = Color3.fromRGB(255, 224, 186)
|
||||||
|
Lighting.EnvironmentDiffuseScale = 0.5
|
||||||
|
Lighting.EnvironmentSpecularScale = 0.5
|
||||||
|
Lighting.GlobalShadows = true
|
||||||
ensure("Atmosphere", Lighting, {
|
ensure("Atmosphere", Lighting, {
|
||||||
Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6,
|
Density = 0.4, Offset = 0.18, Glare = 0.25, Haze = 1.6,
|
||||||
Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175),
|
Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150),
|
||||||
})
|
})
|
||||||
ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 })
|
ensure("BloomEffect", Lighting, { Intensity = 0.3, Size = 24, Threshold = 1.8 })
|
||||||
ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 })
|
ensure("ColorCorrectionEffect", Lighting, {
|
||||||
ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 })
|
Saturation = 0.18, Contrast = 0.14, Brightness = -0.04, TintColor = Color3.fromRGB(255, 242, 228),
|
||||||
|
})
|
||||||
|
ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.7 })
|
||||||
|
-- размытие дальнего плана включают миры и лобби через look.dof
|
||||||
|
ensure("DepthOfFieldEffect", Lighting, { Enabled = false, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 })
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- помощники
|
---------------------------------------------------------------- помощники
|
||||||
@@ -174,6 +184,303 @@ local function marker(name, cf)
|
|||||||
return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false })
|
return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function lobbyCliffs()
|
||||||
|
local template = ServerStorage:FindFirstChild("FishingCliffTemplate")
|
||||||
|
if not template or not template:IsA("Model") then
|
||||||
|
warn("FishingCliffTemplate отсутствует; используем низкую изгородь лобби")
|
||||||
|
for deg = 0, 359, 7 do
|
||||||
|
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
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local ring = Instance.new("Folder")
|
||||||
|
ring.Name = "LobbyCliffs"
|
||||||
|
ring.Parent = map
|
||||||
|
local count = 24
|
||||||
|
local tiers = {
|
||||||
|
{ name = "LobbyCliff", radius = 88, scale = 1.4, baseY = FLOOR },
|
||||||
|
{ name = "LobbyCliffUpper", radius = 104, scale = 2.2, baseY = FLOOR + 10 },
|
||||||
|
}
|
||||||
|
for _, tier in ipairs(tiers) do
|
||||||
|
for i = 1, count do
|
||||||
|
local angle = (i - 1) * 2 * math.pi / count
|
||||||
|
local radial = V(math.cos(angle), 0, math.sin(angle))
|
||||||
|
local center = V(radial.X * tier.radius, tier.baseY, radial.Z * tier.radius)
|
||||||
|
local model = template:Clone()
|
||||||
|
model.Name = string.format("%s_%02d", tier.name, i)
|
||||||
|
model:ScaleTo(tier.scale)
|
||||||
|
local facing = CFrame.lookAt(center, center + radial)
|
||||||
|
local rotation = facing - facing.Position
|
||||||
|
model:PivotTo(CFrame.new(center) * rotation)
|
||||||
|
local boxCF, boxSize = model:GetBoundingBox()
|
||||||
|
local targetBoxCenter = V(center.X, tier.baseY + boxSize.Y / 2, center.Z)
|
||||||
|
model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position))
|
||||||
|
model.Parent = ring
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function rockTopPosition(cliffs, radial, desiredRadius, radiusOffsets)
|
||||||
|
local params = RaycastParams.new()
|
||||||
|
params.FilterType = Enum.RaycastFilterType.Include
|
||||||
|
params.FilterDescendantsInstances = { cliffs }
|
||||||
|
for _, offset in ipairs(radiusOffsets) do
|
||||||
|
local radius = desiredRadius + offset
|
||||||
|
local origin = V(radial.X * radius, 128, radial.Z * radius)
|
||||||
|
local hit = Workspace:Raycast(origin, V(0, -180, 0), params)
|
||||||
|
if hit then
|
||||||
|
return hit.Position
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return V(radial.X * desiredRadius, FLOOR, radial.Z * desiredRadius)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function placeModelOnRock(model, position, yaw)
|
||||||
|
local rotation = CFrame.Angles(0, yaw, 0)
|
||||||
|
model:PivotTo(CFrame.new(position) * rotation)
|
||||||
|
local boxCF, boxSize = model:GetBoundingBox()
|
||||||
|
local targetBoxCenter = V(position.X, position.Y + boxSize.Y / 2, position.Z)
|
||||||
|
model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lobbyTrees()
|
||||||
|
local templates = ServerStorage:FindFirstChild("LobbyTreeTemplates")
|
||||||
|
local cliffs = map:FindFirstChild("LobbyCliffs")
|
||||||
|
if not templates or not cliffs then
|
||||||
|
warn("LobbyTreeTemplates или LobbyCliffs отсутствует; деревья лобби пропущены")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local treeTypes = { "LargeCanopy", "Pine", "RoundCanopy" }
|
||||||
|
local treeScale = { LargeCanopy = 1, Pine = 1.25, RoundCanopy = 1.2 }
|
||||||
|
local folder = Instance.new("Folder")
|
||||||
|
folder.Name = "LobbyTrees"
|
||||||
|
folder.Parent = map
|
||||||
|
for layer = 1, 2 do
|
||||||
|
local baseRadius = layer == 1 and 84 or 96
|
||||||
|
local radiusOffsets = { 0, -2, 2, -4, 4, -6, 6 }
|
||||||
|
for i = 1, 18 do
|
||||||
|
local degrees = (i - 1) * 20 + 10 + (layer == 2 and 10 or 0)
|
||||||
|
local angle = math.rad(degrees)
|
||||||
|
local radial = V(math.cos(angle), 0, math.sin(angle))
|
||||||
|
local position = rockTopPosition(cliffs, radial, baseRadius, radiusOffsets)
|
||||||
|
local kind = treeTypes[(i + layer - 2) % #treeTypes + 1]
|
||||||
|
local template = templates:FindFirstChild(kind)
|
||||||
|
if template and template:IsA("Model") then
|
||||||
|
local model = template:Clone()
|
||||||
|
model.Name = string.format("LobbyTree_L%d_%02d_%s", layer, i, kind)
|
||||||
|
model:ScaleTo(treeScale[kind])
|
||||||
|
placeModelOnRock(model, position, math.rad((i * 47 + layer * 23) % 360))
|
||||||
|
for _, part in ipairs(model:GetDescendants()) do
|
||||||
|
if part:IsA("BasePart") then part.Anchored = true end
|
||||||
|
end
|
||||||
|
model.Parent = folder
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lobbyRockPlants()
|
||||||
|
local templates = ServerStorage:FindFirstChild("LobbyRockPlantTemplates")
|
||||||
|
local cliffs = map:FindFirstChild("LobbyCliffs")
|
||||||
|
if not templates or not cliffs then
|
||||||
|
warn("LobbyRockPlantTemplates или LobbyCliffs отсутствует; растительность скал пропущена")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local folder = Instance.new("Folder")
|
||||||
|
folder.Name = "LobbyRockPlants"
|
||||||
|
folder.Parent = map
|
||||||
|
local clusterAngles = {
|
||||||
|
{ layer = 1, degrees = 45 }, { layer = 1, degrees = 135 },
|
||||||
|
{ layer = 1, degrees = 225 }, { layer = 1, degrees = 315 },
|
||||||
|
{ layer = 2, degrees = 0 }, { layer = 2, degrees = 90 },
|
||||||
|
{ layer = 2, degrees = 180 }, { layer = 2, degrees = 270 },
|
||||||
|
}
|
||||||
|
local tuftKinds = { "GrassTuft", "BladeGrass", "GrassTuft", "FlowerPatch", "GrassTuft", "WideGrass" }
|
||||||
|
local tuftScales = { GrassTuft = 1.15, BladeGrass = 1.45, FlowerPatch = 1.1, WideGrass = 0.55 }
|
||||||
|
local offsets = { { 0, 0 }, { -2.2, 0 }, { 2.2, 0 }, { 0, -2.2 }, { 0, 2.2 }, { 1.6, 1.6 } }
|
||||||
|
local rayParams = RaycastParams.new()
|
||||||
|
rayParams.FilterType = Enum.RaycastFilterType.Include
|
||||||
|
rayParams.FilterDescendantsInstances = { cliffs }
|
||||||
|
for clusterIndex, cluster in ipairs(clusterAngles) do
|
||||||
|
local baseRadius = cluster.layer == 1 and 84 or 96
|
||||||
|
local baseAngle = math.rad(cluster.degrees)
|
||||||
|
local radial = V(math.cos(baseAngle), 0, math.sin(baseAngle))
|
||||||
|
local tangent = V(-radial.Z, 0, radial.X)
|
||||||
|
local basePos = rockTopPosition(cliffs, radial, baseRadius, { 0, -2, 2, -4, 4, -6, 6 })
|
||||||
|
local bush = Instance.new("Model")
|
||||||
|
bush.Name = string.format("GrassBush_%02d_L%d", clusterIndex, cluster.layer)
|
||||||
|
for i, offset in ipairs(offsets) do
|
||||||
|
local xz = basePos + radial * offset[1] + tangent * offset[2]
|
||||||
|
local plantPos
|
||||||
|
for _, correction in ipairs({ 0, -2, 2, -4, 4 }) do
|
||||||
|
local candidate = xz + radial * correction
|
||||||
|
local hit = Workspace:Raycast(V(candidate.X, 128, candidate.Z), V(0, -180, 0), rayParams)
|
||||||
|
if hit then plantPos = hit.Position; break end
|
||||||
|
end
|
||||||
|
if plantPos then
|
||||||
|
local kind = tuftKinds[i]
|
||||||
|
local template = templates:FindFirstChild(kind)
|
||||||
|
if template and template:IsA("Model") then
|
||||||
|
local plant = template:Clone()
|
||||||
|
plant.Name = kind .. "_" .. i
|
||||||
|
plant:ScaleTo(tuftScales[kind])
|
||||||
|
placeModelOnRock(plant, plantPos, math.rad((clusterIndex * 37 + i * 53) % 360))
|
||||||
|
for _, part in ipairs(plant:GetDescendants()) do
|
||||||
|
if part:IsA("BasePart") then part.Anchored = true end
|
||||||
|
end
|
||||||
|
plant.Parent = bush
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
bush.Parent = folder
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- холмы и горы за скалами лобби (террейн), ельники на склонах и кольцо тумана за горами.
|
||||||
|
-- К горизонту холмы выше, чтобы из лобби было видно не пустоту, а гряду в дымке.
|
||||||
|
local function lobbyHillHeight(x, z)
|
||||||
|
local r = math.sqrt(x * x + z * z)
|
||||||
|
if r < 120 then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local t = math.clamp((r - 120) / 220, 0, 1)
|
||||||
|
local base = 22 + 90 * t ^ 0.85
|
||||||
|
local n = math.noise(x / 95, z / 95, 1.7) * 30 + math.noise(x / 38, z / 38, 5.1) * 9
|
||||||
|
local peak = math.max(0, math.noise(x / 150, z / 150, 9.3)) * 70 * t
|
||||||
|
local edge = math.clamp((r - 120) / 12, 0, 1)
|
||||||
|
return (base + n * (0.35 + 0.65 * t) + peak) * edge
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lobbyHills()
|
||||||
|
local R, Y0, Y1, CH = 384, -8, 232, 64
|
||||||
|
for cx = -R, R - CH, CH do
|
||||||
|
for cz = -R, R - CH, CH do
|
||||||
|
-- чанк целиком внутри лобби пропускаем
|
||||||
|
local far = math.sqrt(math.max(cx * cx, (cx + CH) ^ 2) + math.max(cz * cz, (cz + CH) ^ 2))
|
||||||
|
if far >= 120 then
|
||||||
|
local region = Region3.new(V(cx, Y0, cz), V(cx + CH, Y1, cz + CH))
|
||||||
|
local nx, ny, nz = CH / 4, (Y1 - Y0) / 4, CH / 4
|
||||||
|
local mats, occs = {}, {}
|
||||||
|
for i = 1, nx do
|
||||||
|
mats[i], occs[i] = {}, {}
|
||||||
|
for j = 1, ny do
|
||||||
|
mats[i][j], occs[i][j] = {}, {}
|
||||||
|
end
|
||||||
|
for k = 1, nz do
|
||||||
|
local x, z = cx + (i - 0.5) * 4, cz + (k - 0.5) * 4
|
||||||
|
local h = (math.sqrt(x * x + z * z) <= R) and lobbyHillHeight(x, z) or nil
|
||||||
|
for j = 1, ny do
|
||||||
|
local yb = Y0 + (j - 1) * 4
|
||||||
|
local occ = h and math.clamp((h - yb) / 4, 0, 1) or 0
|
||||||
|
local m = Enum.Material.Air
|
||||||
|
if occ > 0 then
|
||||||
|
if yb > h - 6 then
|
||||||
|
m = h > 118 and Enum.Material.Rock or Enum.Material.Grass
|
||||||
|
else
|
||||||
|
m = Enum.Material.Ground
|
||||||
|
end
|
||||||
|
end
|
||||||
|
mats[i][j][k], occs[i][j][k] = m, occ
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
terrain:WriteVoxels(region, 4, mats, occs)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ельники пятнами на склонах
|
||||||
|
local pines = ServerStorage:FindFirstChild("OldPines")
|
||||||
|
local forest = Instance.new("Folder")
|
||||||
|
forest.Name = "LobbyHillForest"
|
||||||
|
forest.Parent = map
|
||||||
|
if pines and #pines:GetChildren() > 0 then
|
||||||
|
local templates = pines:GetChildren()
|
||||||
|
local frng = Random.new(1104)
|
||||||
|
local placed = {}
|
||||||
|
for _ = 1, 4000 do
|
||||||
|
if #placed >= 170 then break end
|
||||||
|
local a = frng:NextNumber(0, math.pi * 2)
|
||||||
|
local r = frng:NextNumber(132, 300)
|
||||||
|
local x, z = math.cos(a) * r, math.sin(a) * r
|
||||||
|
-- высоту берём из той же формулы: лучи по только что залитому террейну в редакторе ненадёжны
|
||||||
|
local h = lobbyHillHeight(x, z)
|
||||||
|
local slope = h and math.max(math.abs((lobbyHillHeight(x + 4, z) or h) - h), math.abs((lobbyHillHeight(x, z + 4) or h) - h)) / 4
|
||||||
|
if h and h <= 118 and slope < 0.8 and math.noise(x / 60, z / 60, 3.3) > -0.05 then
|
||||||
|
local ground = V(x, h, z)
|
||||||
|
local ok = true
|
||||||
|
for _, q in ipairs(placed) do
|
||||||
|
if (q - ground).Magnitude < 9 then ok = false break end
|
||||||
|
end
|
||||||
|
if ok then
|
||||||
|
local m = templates[frng:NextInteger(1, #templates)]:Clone()
|
||||||
|
for _, d in ipairs(m:GetDescendants()) do
|
||||||
|
if d:IsA("LuaSourceContainer") then
|
||||||
|
d:Destroy()
|
||||||
|
elseif d:IsA("BasePart") then
|
||||||
|
d.Anchored = true
|
||||||
|
d.CanCollide = false
|
||||||
|
d.CastShadow = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
m:ScaleTo(m:GetScale() * frng:NextNumber(0.8, 1.5))
|
||||||
|
m:PivotTo(CFrame.new(ground) * CFrame.Angles(0, frng:NextNumber(0, math.pi * 2), 0))
|
||||||
|
local bcf, bsz = m:GetBoundingBox()
|
||||||
|
m:PivotTo(m:GetPivot() + V(0, ground.Y - (bcf.Position.Y - bsz.Y / 2) - 1, 0))
|
||||||
|
m.Parent = forest
|
||||||
|
table.insert(placed, ground)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- туман за горами: медленные крупные клубы по двум кольцам
|
||||||
|
local haze = Instance.new("Folder")
|
||||||
|
haze.Name = "LobbyHaze"
|
||||||
|
haze.Parent = map
|
||||||
|
for ring, cfg in ipairs({ { r = 150, n = 28, y = 18, size = 45 }, { r = 250, n = 36, y = 40, size = 70 } }) do
|
||||||
|
for i = 1, cfg.n do
|
||||||
|
local a = (i - 1) / cfg.n * math.pi * 2
|
||||||
|
local x, z = math.cos(a) * cfg.r, math.sin(a) * cfg.r
|
||||||
|
local h = lobbyHillHeight(x, z) or 0
|
||||||
|
local anchor = Instance.new("Part")
|
||||||
|
anchor.Name = "HazeAnchor"
|
||||||
|
anchor.Anchored = true
|
||||||
|
anchor.CanCollide = false
|
||||||
|
anchor.CanQuery = false
|
||||||
|
anchor.CanTouch = false
|
||||||
|
anchor.Transparency = 1
|
||||||
|
anchor.Size = V(30, 4, 30)
|
||||||
|
anchor.CFrame = CFrame.new(x, h + cfg.y, z)
|
||||||
|
anchor.Parent = haze
|
||||||
|
local pe = Instance.new("ParticleEmitter")
|
||||||
|
pe.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||||||
|
pe.Color = ColorSequence.new(Color3.fromRGB(236, 228, 220))
|
||||||
|
pe.LightEmission = 0.15
|
||||||
|
pe.LightInfluence = 0.6
|
||||||
|
pe.Rate = ring == 1 and 0.5 or 0.35
|
||||||
|
pe.Lifetime = NumberRange.new(16, 22)
|
||||||
|
pe.Speed = NumberRange.new(0.3, 0.8)
|
||||||
|
pe.SpreadAngle = Vector2.new(60, 60)
|
||||||
|
pe.Rotation = NumberRange.new(0, 360)
|
||||||
|
pe.RotSpeed = NumberRange.new(-4, 4)
|
||||||
|
pe.Size = NumberSequence.new({
|
||||||
|
NumberSequenceKeypoint.new(0, cfg.size * 0.7),
|
||||||
|
NumberSequenceKeypoint.new(1, cfg.size * 1.2),
|
||||||
|
})
|
||||||
|
pe.Transparency = NumberSequence.new({
|
||||||
|
NumberSequenceKeypoint.new(0, 1),
|
||||||
|
NumberSequenceKeypoint.new(0.3, 0.8),
|
||||||
|
NumberSequenceKeypoint.new(0.7, 0.82),
|
||||||
|
NumberSequenceKeypoint.new(1, 1),
|
||||||
|
})
|
||||||
|
pe.Parent = anchor
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе)
|
-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе)
|
||||||
local function groundY(x, z)
|
local function groundY(x, z)
|
||||||
local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4)
|
local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4)
|
||||||
@@ -301,6 +608,218 @@ local function setBestiary(board, zoneId, title, titleHex)
|
|||||||
writeBestiary(board)
|
writeBestiary(board)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Лавки в стиле low poly: без фотореалистичных текстур (доски, ткань), плоские цвета с разбросом оттенков.
|
||||||
|
-- Большие дощатые панели (стены, пол, крыша) режутся на отдельные доски, шарики-гирлянды становятся
|
||||||
|
-- ромбиками-флажками, неоновая рамка вывески — матовой золотой. frame — CFrame лавки (для флажков), может быть nil.
|
||||||
|
local LOWPOLY_FLAT = {
|
||||||
|
[Enum.Material.WoodPlanks] = true, [Enum.Material.Wood] = true, [Enum.Material.Fabric] = true,
|
||||||
|
[Enum.Material.Metal] = true, [Enum.Material.Brick] = true, [Enum.Material.Plastic] = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local function lowPolyShade(c, lrng, spread)
|
||||||
|
local k = 1 + lrng:NextNumber(-spread, spread)
|
||||||
|
return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lowPolyPlanks(p, lrng)
|
||||||
|
local s = p.Size
|
||||||
|
local dims = { s.X, s.Y, s.Z }
|
||||||
|
local thin = 1
|
||||||
|
for i = 2, 3 do
|
||||||
|
if dims[i] < dims[thin] then thin = i end
|
||||||
|
end
|
||||||
|
-- режем вдоль самой длинной горизонтальной оси (кроме тонкой): стены — вертикальные доски, пол — продольные
|
||||||
|
local axis = (thin ~= 1 and (thin == 3 or s.X >= s.Z)) and 1 or 3
|
||||||
|
local len = dims[axis]
|
||||||
|
local n = math.max(2, math.floor(len / 1.8 + 0.5))
|
||||||
|
local w = len / n
|
||||||
|
for i = 1, n do
|
||||||
|
local off = -len / 2 + w * (i - 0.5)
|
||||||
|
local depth = lrng:NextNumber(-0.06, 0.06)
|
||||||
|
local o = { 0, 0, 0 }
|
||||||
|
o[axis] = off
|
||||||
|
o[thin] = depth
|
||||||
|
local size = { s.X, s.Y, s.Z }
|
||||||
|
size[axis] = w
|
||||||
|
local plank = Instance.new("Part")
|
||||||
|
plank.Name = "Plank"
|
||||||
|
plank.Anchored = true
|
||||||
|
plank.TopSurface, plank.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||||||
|
plank.Material = Enum.Material.SmoothPlastic
|
||||||
|
plank.Size = V(size[1], size[2], size[3])
|
||||||
|
plank.CFrame = p.CFrame * CFrame.new(o[1], o[2], o[3])
|
||||||
|
plank.Color = lowPolyShade(p.Color, lrng, 0.09)
|
||||||
|
plank.CanCollide, plank.CastShadow, plank.CanQuery = p.CanCollide, p.CastShadow, p.CanQuery
|
||||||
|
plank.Parent = p.Parent
|
||||||
|
end
|
||||||
|
p:Destroy()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Builder.lowPolyParts(parts, frame, seed)
|
||||||
|
local lrng = Random.new(seed or 5)
|
||||||
|
for _, p in ipairs(parts) do
|
||||||
|
if p:IsA("BasePart") and p.Parent and p.Transparency < 0.5 and not p.Name:find("Npc") then
|
||||||
|
local isBlock = p.ClassName == "Part" and p.Shape == Enum.PartType.Block
|
||||||
|
if p.Material == Enum.Material.Fabric and p.ClassName == "Part" and p.Shape == Enum.PartType.Ball and frame then
|
||||||
|
-- шарик гирлянды → ромбик-флажок, повёрнутый к покупателям
|
||||||
|
local d = p.Size.X
|
||||||
|
local flag = Instance.new("Part")
|
||||||
|
flag.Name = "Pennant"
|
||||||
|
flag.Anchored = true
|
||||||
|
flag.CanCollide = false
|
||||||
|
flag.Material = Enum.Material.SmoothPlastic
|
||||||
|
flag.Size = V(d * 1.15, d * 1.15, 0.25)
|
||||||
|
flag.CFrame = CFrame.new(p.Position) * (frame - frame.Position) * CFrame.Angles(0, 0, math.rad(45))
|
||||||
|
flag.Color = p.Color
|
||||||
|
flag.Parent = p.Parent
|
||||||
|
p:Destroy()
|
||||||
|
elseif p.Material == Enum.Material.Neon and math.max(p.Size.X, p.Size.Y, p.Size.Z) > 4 then
|
||||||
|
p.Material = Enum.Material.SmoothPlastic -- рамка вывески: без свечения
|
||||||
|
p.Color = Color3.fromRGB(214, 160, 70)
|
||||||
|
elseif p.Material == Enum.Material.WoodPlanks and isBlock and #p:GetChildren() == 0
|
||||||
|
and math.min(p.Size.X, p.Size.Y, p.Size.Z) <= 1.2 and math.max(p.Size.X, p.Size.Z) >= 4 then
|
||||||
|
lowPolyPlanks(p, lrng)
|
||||||
|
elseif LOWPOLY_FLAT[p.Material] then
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
p.Color = lowPolyShade(p.Color, lrng, 0.06)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- детали лавки, построенной stall(cf): всё, что лежит в её габаритах прямо в папке parent
|
||||||
|
function Builder.stallParts(cf, parent)
|
||||||
|
local list = {}
|
||||||
|
for _, p in ipairs(parent:GetChildren()) do
|
||||||
|
if p:IsA("BasePart") then
|
||||||
|
local l = cf:PointToObjectSpace(p.Position)
|
||||||
|
if math.abs(l.X) <= 15.5 and l.Y >= -0.5 and l.Y <= 21 and l.Z >= -14.5 and l.Z <= 9.5 then
|
||||||
|
table.insert(list, p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return list
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Доска лидеров (low poly): два столба, двускатная крыша, табличка с названием, фонарики и экран на rows строк.
|
||||||
|
-- cf стоит на полу и смотрит LookVector на зрителей. Строки Row1…RowN заполняет Leaderboards.server.lua.
|
||||||
|
function Builder.leaderboard(cf, board, rows, parent)
|
||||||
|
local model = Instance.new("Model")
|
||||||
|
model.Name = "Leaderboard_" .. board.id
|
||||||
|
model:SetAttribute("Leaderboard", board.id)
|
||||||
|
local function part(props)
|
||||||
|
local p = Instance.new(props.Class or "Part")
|
||||||
|
p.Anchored = true
|
||||||
|
p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
if k ~= "Class" and k ~= "At" then
|
||||||
|
p[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
p.CFrame = cf * props.At
|
||||||
|
p.Parent = model
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
local WOOD, DARK, TRIM = Color3.fromRGB(122, 82, 50), Color3.fromRGB(58, 38, 26), Color3.fromRGB(176, 122, 66)
|
||||||
|
for _, s in ipairs({ -1, 1 }) do
|
||||||
|
part({ Name = "Foot", Size = V(2.2, 1, 2.2), At = CFrame.new(s * 6.6, 0.5, 0), Color = Color3.fromRGB(128, 118, 122) })
|
||||||
|
part({ Name = "Post", Size = V(1.3, 16.5, 1.3), At = CFrame.new(s * 6.6, 8.25, 0), Color = WOOD })
|
||||||
|
-- фонарик на столбе
|
||||||
|
local lamp = part({ Name = "Lantern", Size = V(0.9, 1.2, 0.9), At = CFrame.new(s * 6.6, 14.2, -0.95),
|
||||||
|
Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 196, 110), CanCollide = false })
|
||||||
|
part({ Name = "LanternCap", Size = V(1.2, 0.3, 1.2), At = CFrame.new(s * 6.6, 14.95, -0.95), Color = DARK, CanCollide = false })
|
||||||
|
local light = Instance.new("PointLight")
|
||||||
|
light.Range, light.Brightness, light.Color = 12, 0.9, Color3.fromRGB(255, 190, 110)
|
||||||
|
light.Parent = lamp
|
||||||
|
end
|
||||||
|
local screen = part({ Name = "Screen", Size = V(12, 9.6, 0.5), At = CFrame.new(0, 9.4, 0), Color = DARK })
|
||||||
|
part({ Name = "Trim", Size = V(13.4, 0.6, 0.8), At = CFrame.new(0, 14.5, 0), Color = TRIM })
|
||||||
|
part({ Name = "Trim", Size = V(13.4, 0.6, 0.8), At = CFrame.new(0, 4.3, 0), Color = TRIM })
|
||||||
|
local plaque = part({ Name = "Plaque", Size = V(11, 2.3, 0.7), At = CFrame.new(0, 16.2, -0.1), Color = WOOD })
|
||||||
|
part({ Name = "PlaqueTrim", Size = V(11.6, 2.8, 0.5), At = CFrame.new(0, 16.2, 0.15), Color = TRIM })
|
||||||
|
-- двускатная крыша
|
||||||
|
for _, s in ipairs({ -1, 1 }) do
|
||||||
|
part({ Name = "Roof", Size = V(8, 0.5, 2.6), At = CFrame.new(s * 3.55, 18.35, 0) * CFrame.Angles(0, 0, math.rad(-s * 17)),
|
||||||
|
Color = Color3.fromRGB(150, 70, 52) })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- заголовок
|
||||||
|
local titleGui = Instance.new("SurfaceGui")
|
||||||
|
titleGui.Face = Enum.NormalId.Front
|
||||||
|
titleGui.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||||||
|
titleGui.PixelsPerStud = 40
|
||||||
|
titleGui.LightInfluence = 0
|
||||||
|
titleGui.Parent = plaque
|
||||||
|
local title = Instance.new("TextLabel")
|
||||||
|
title.Size = UDim2.new(1, -16, 1, -8)
|
||||||
|
title.Position = UDim2.fromOffset(8, 4)
|
||||||
|
title.BackgroundTransparency = 1
|
||||||
|
title.Font = Enum.Font.FredokaOne
|
||||||
|
title.TextScaled = true
|
||||||
|
title.Text = board.title
|
||||||
|
title.TextColor3 = board.color
|
||||||
|
title.Parent = titleGui
|
||||||
|
local ts = Instance.new("UIStroke")
|
||||||
|
ts.Color, ts.Thickness = Color3.fromRGB(40, 22, 10), 3
|
||||||
|
ts.Parent = title
|
||||||
|
|
||||||
|
-- строки топа
|
||||||
|
local gui = Instance.new("SurfaceGui")
|
||||||
|
gui.Name = "Rows"
|
||||||
|
gui.Face = Enum.NormalId.Front
|
||||||
|
gui.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||||||
|
gui.PixelsPerStud = 40
|
||||||
|
gui.LightInfluence = 0.2
|
||||||
|
gui.Parent = screen
|
||||||
|
local list = Instance.new("Frame")
|
||||||
|
list.Size = UDim2.new(1, -24, 1, -20)
|
||||||
|
list.Position = UDim2.fromOffset(12, 10)
|
||||||
|
list.BackgroundTransparency = 1
|
||||||
|
list.Parent = gui
|
||||||
|
local layout = Instance.new("UIListLayout")
|
||||||
|
layout.Padding = UDim.new(0, 3)
|
||||||
|
layout.SortOrder = Enum.SortOrder.LayoutOrder
|
||||||
|
layout.Parent = list
|
||||||
|
local RANK_COLOR = { Color3.fromRGB(255, 210, 80), Color3.fromRGB(215, 225, 235), Color3.fromRGB(230, 150, 90) }
|
||||||
|
for i = 1, rows do
|
||||||
|
local row = Instance.new("Frame")
|
||||||
|
row.Name = "Row" .. i
|
||||||
|
row.LayoutOrder = i
|
||||||
|
row.Size = UDim2.new(1, 0, 1 / rows, -3)
|
||||||
|
row.BackgroundColor3 = Color3.fromRGB(255, 240, 210)
|
||||||
|
row.BackgroundTransparency = (i % 2 == 0) and 0.94 or 0.88
|
||||||
|
row.BorderSizePixel = 0
|
||||||
|
row.Parent = list
|
||||||
|
local corner = Instance.new("UICorner")
|
||||||
|
corner.CornerRadius = UDim.new(0, 6)
|
||||||
|
corner.Parent = row
|
||||||
|
local color = RANK_COLOR[i] or Color3.fromRGB(245, 232, 205)
|
||||||
|
local function label(name, pos, size, align, text)
|
||||||
|
local t = Instance.new("TextLabel")
|
||||||
|
t.Name = name
|
||||||
|
t.Position, t.Size = pos, size
|
||||||
|
t.BackgroundTransparency = 1
|
||||||
|
t.Font = Enum.Font.FredokaOne
|
||||||
|
t.TextScaled = true
|
||||||
|
t.TextXAlignment = align
|
||||||
|
t.TextColor3 = color
|
||||||
|
t.Text = text
|
||||||
|
t.Parent = row
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
label("Rank", UDim2.new(0, 6, 0.1, 0), UDim2.new(0, 46, 0.8, 0), Enum.TextXAlignment.Center, ({ "🥇", "🥈", "🥉" })[i] or (i .. "."))
|
||||||
|
label("PlayerName", UDim2.new(0, 58, 0.12, 0), UDim2.new(0.58, -58, 0.76, 0), Enum.TextXAlignment.Left, "—")
|
||||||
|
label("Value", UDim2.new(0.58, 0, 0.12, 0), UDim2.new(0.42, -8, 0.76, 0), Enum.TextXAlignment.Right, "")
|
||||||
|
end
|
||||||
|
-- опора модели — экран, точка опоры на земле под центром доски и без наклона:
|
||||||
|
-- иначе Studio берёт поворот случайной детали (ската крыши) и стрелки инструментов встают наискосок
|
||||||
|
model.PrimaryPart = screen
|
||||||
|
screen.PivotOffset = CFrame.new(0, -9.4, 0)
|
||||||
|
model.Parent = parent
|
||||||
|
return model
|
||||||
|
end
|
||||||
|
|
||||||
-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей
|
-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей
|
||||||
local function stall(cf, opt)
|
local function stall(cf, opt)
|
||||||
local function at(x, y, z)
|
local function at(x, y, z)
|
||||||
@@ -357,10 +876,81 @@ local function stall(cf, opt)
|
|||||||
if opt.decor then
|
if opt.decor then
|
||||||
opt.decor(at)
|
opt.decor(at)
|
||||||
end
|
end
|
||||||
|
Builder.lowPolyParts(Builder.stallParts(cf, map), cf, math.floor(cf.Position.X + cf.Position.Z))
|
||||||
return counter
|
return counter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Модель портала из ServerStorage.FishingPortalTemplate, перекрашенная в цвет мира и
|
||||||
|
-- поставленная основанием на baseCF. Без шаблона возвращает nil (тогда строится старое кольцо).
|
||||||
|
function Builder.portalModel(baseCF, color, name, parent)
|
||||||
|
local template = ServerStorage:FindFirstChild("FishingPortalTemplate")
|
||||||
|
if not (template and template:IsA("Model")) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local model = template:Clone()
|
||||||
|
model.Name = name
|
||||||
|
for _, part in ipairs(model:GetDescendants()) do
|
||||||
|
if part:IsA("BasePart") then
|
||||||
|
local c = part.Color
|
||||||
|
local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25
|
||||||
|
if part.Material == Enum.Material.Neon then
|
||||||
|
part.Color = color
|
||||||
|
elseif isGreen then
|
||||||
|
part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30)
|
||||||
|
part.Material = Enum.Material.SmoothPlastic
|
||||||
|
end
|
||||||
|
elseif part:IsA("ParticleEmitter") then
|
||||||
|
part.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local pivot = template:GetPivot()
|
||||||
|
local boxCFrame, boxSize = template:GetBoundingBox()
|
||||||
|
local boxBottom = pivot:PointToObjectSpace(Vector3.new(
|
||||||
|
boxCFrame.Position.X,
|
||||||
|
boxCFrame.Position.Y - boxSize.Y / 2,
|
||||||
|
boxCFrame.Position.Z
|
||||||
|
)).Y
|
||||||
|
model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0))
|
||||||
|
model.Parent = parent
|
||||||
|
return model
|
||||||
|
end
|
||||||
|
|
||||||
local function portal(baseCF, title, color, worldId, locked)
|
local function portal(baseCF, title, color, worldId, locked)
|
||||||
|
-- Все порталы, и в лобби, и возвратные в мирах, используют модель автора из ServerStorage.
|
||||||
|
do
|
||||||
|
local model = Builder.portalModel(baseCF, color, "PortalModel_" .. worldId, map)
|
||||||
|
if model then
|
||||||
|
-- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира.
|
||||||
|
local disc = P({
|
||||||
|
Name = "Portal_" .. worldId,
|
||||||
|
Size = V(1, 1, 1),
|
||||||
|
CFrame = baseCF * CFrame.new(0, 10, 0),
|
||||||
|
Transparency = 1,
|
||||||
|
CanCollide = false,
|
||||||
|
CanQuery = false,
|
||||||
|
CanTouch = 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), 7, 200)
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
local center = baseCF * CFrame.new(0, 10, 0)
|
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(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) })
|
P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) })
|
||||||
@@ -541,14 +1131,16 @@ function Builder.build()
|
|||||||
banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4])
|
banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4])
|
||||||
end
|
end
|
||||||
|
|
||||||
-- живая изгородь по краю (с проходами)
|
-- высокий скальный контур закрывает горизонт и удерживает игроков в лобби
|
||||||
for deg = 0, 359, 7 do
|
lobbyCliffs()
|
||||||
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)
|
lobbyTrees()
|
||||||
if not skip then
|
lobbyRockPlants()
|
||||||
local a = math.rad(deg)
|
lobbyHills()
|
||||||
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) })
|
for i, b in ipairs(Config.Leaderboards.boards) do
|
||||||
end
|
local a = math.rad(({ 220, 270, 320 })[i] or 270)
|
||||||
|
local p = V(math.cos(a) * 71, FLOOR, math.sin(a) * 71)
|
||||||
|
Builder.leaderboard(CFrame.lookAt(p, V(0, FLOOR, 0)), b, Config.Leaderboards.size, map)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- магазин (запад) и скупка (восток)
|
-- магазин (запад) и скупка (восток)
|
||||||
@@ -686,12 +1278,31 @@ function Builder.build()
|
|||||||
-- сундук с ежедневной наградой
|
-- сундук с ежедневной наградой
|
||||||
do
|
do
|
||||||
local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50))
|
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) })
|
local template = ServerStorage:FindFirstChild("DailyChestTemplate")
|
||||||
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) })
|
local base
|
||||||
for _, x in ipairs({ -1.8, 1.8 }) do
|
if template and template:IsA("Model") then
|
||||||
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) })
|
-- low poly сундук (Base, Lid, Coins, Lock; замок по +Z модели, опора — низ по центру);
|
||||||
|
-- его анимирует ChestAnimation.client.lua, подсказка и подпись — на невидимой детали
|
||||||
|
local chest = template:Clone()
|
||||||
|
chest.Name = "DailyChest"
|
||||||
|
chest:SetAttribute("DailyChest", true)
|
||||||
|
chest:PivotTo(cf * CFrame.Angles(0, math.pi, 0))
|
||||||
|
for _, p in ipairs(chest:GetDescendants()) do
|
||||||
|
if p:IsA("BasePart") then
|
||||||
|
p.Anchored = true
|
||||||
|
p.CanCollide = p.Name == "Base"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
chest.Parent = map
|
||||||
|
base = P({ Name = "DailyChestPrompt", Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Transparency = 1, CanCollide = false })
|
||||||
|
else
|
||||||
|
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) })
|
||||||
end
|
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")
|
local sp = Instance.new("ParticleEmitter")
|
||||||
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||||||
sp.Rate = 8
|
sp.Rate = 8
|
||||||
@@ -723,8 +1334,12 @@ function Builder.build()
|
|||||||
---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО
|
---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО
|
||||||
do
|
do
|
||||||
-- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново
|
-- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново
|
||||||
local w1map = world1Prebuilt or World1Builder.build(map)
|
local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel)
|
||||||
w1map.Parent = map
|
w1map.Parent = map
|
||||||
|
local baitShop = not world1Prebuilt and w1map:FindFirstChild("BaitShop", true)
|
||||||
|
if baitShop then
|
||||||
|
Builder.lowPolyParts(baitShop:GetDescendants(), baitShop:GetPivot(), 11)
|
||||||
|
end
|
||||||
-- NPC встают на маркеры — их можно двигать в Studio
|
-- NPC встают на маркеры — их можно двигать в Studio
|
||||||
local seller = w1map:FindFirstChild("World1NpcSeller", true)
|
local seller = w1map:FindFirstChild("World1NpcSeller", true)
|
||||||
if seller and not seller:GetAttribute("NpcName") then
|
if seller and not seller:GetAttribute("NpcName") then
|
||||||
@@ -1324,6 +1939,7 @@ local function spawnNpc(spot, parent)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
rig.Name = name
|
rig.Name = name
|
||||||
|
rig:SetAttribute("Npc", true) -- по нему клиент находит NPC (взгляд на игрока, приветствие), сервер — включает idle
|
||||||
local hum = rig:FindFirstChildOfClass("Humanoid")
|
local hum = rig:FindFirstChildOfClass("Humanoid")
|
||||||
hum.DisplayName = name
|
hum.DisplayName = name
|
||||||
hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
|
hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
|
||||||
@@ -1357,9 +1973,29 @@ local function spawnNpc(spot, parent)
|
|||||||
w.C0 = head.CFrame:Inverse() * p.CFrame
|
w.C0 = head.CFrame:Inverse() * p.CFrame
|
||||||
w.Parent = p
|
w.Parent = p
|
||||||
p.Parent = rig
|
p.Parent = rig
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
if spot:GetAttribute("Look") == "Elder" then
|
||||||
|
-- Старейшина Ворон: седые волосы и борода (цвет HatColor), чёрная повязка на глазу
|
||||||
|
local function elderPart(size, offset, color, shape)
|
||||||
|
local p = hatPart(size, offset, shape or Enum.PartType.Block)
|
||||||
|
p.Color = color
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
end
|
||||||
|
elderPart(V(1.25, 0.35, 1.25), CFrame.new(0, 0.55, 0.05), colors.hat)
|
||||||
|
elderPart(V(1.0, 0.75, 0.35), CFrame.new(0, -0.55, -0.5), colors.hat)
|
||||||
|
elderPart(V(0.32, 0.3, 0.08), CFrame.new(0.22, 0.12, -0.6), Color3.fromRGB(20, 20, 22))
|
||||||
|
elderPart(V(1.24, 0.08, 1.24), CFrame.new(0, 0.18, 0) * CFrame.Angles(0, 0, math.rad(-12)), Color3.fromRGB(20, 20, 22))
|
||||||
|
elseif spot:GetAttribute("Look") == "Scarf" then
|
||||||
|
-- платок (цвет HatColor): макушка и узелок сзади
|
||||||
|
local s = hatPart(V(1.3, 0.5, 1.3), CFrame.new(0, 0.42, 0.05), Enum.PartType.Block)
|
||||||
|
s.Material = Enum.Material.SmoothPlastic
|
||||||
|
local k = hatPart(V(0.4, 0.4, 0.3), CFrame.new(0, 0.05, 0.62), Enum.PartType.Block)
|
||||||
|
k.Material = Enum.Material.SmoothPlastic
|
||||||
|
else
|
||||||
|
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
|
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
|
end
|
||||||
local action = spot:GetAttribute("NpcAction")
|
local action = spot:GetAttribute("NpcAction")
|
||||||
if action then
|
if action then
|
||||||
@@ -1367,6 +2003,7 @@ local function spawnNpc(spot, parent)
|
|||||||
end
|
end
|
||||||
return rig
|
return rig
|
||||||
end
|
end
|
||||||
|
Builder.spawnNpc = spawnNpc -- жители лобби (LobbyLife.server.lua) создаются так же
|
||||||
|
|
||||||
-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб
|
-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб
|
||||||
function Builder.prepareRuntime(root)
|
function Builder.prepareRuntime(root)
|
||||||
@@ -1384,6 +2021,23 @@ function Builder.prepareRuntime(root)
|
|||||||
spot.Transparency = 1
|
spot.Transparency = 1
|
||||||
spawnNpc(spot, root)
|
spawnNpc(spot, root)
|
||||||
end
|
end
|
||||||
|
-- порталы лобби двигают в Studio за модель (PortalModel_WorldN); невидимый якорь с подсказкой и подписью
|
||||||
|
-- (Portal_WorldN) и маркер стрелки обучения (GuidePortal, перед порталом в мир 1) встают к модели
|
||||||
|
for _, model in ipairs(root:GetChildren()) do
|
||||||
|
local id = model.Name:match("^PortalModel_(World%d)$")
|
||||||
|
local anchor = id and root:FindFirstChild("Portal_" .. id)
|
||||||
|
if model:IsA("Model") and anchor then
|
||||||
|
local cf, size = model:GetBoundingBox()
|
||||||
|
anchor.CFrame = CFrame.new(cf.Position.X, cf.Position.Y - size.Y / 2 + 10, cf.Position.Z) * (anchor.CFrame - anchor.Position)
|
||||||
|
local marker = id == "World1" and root:FindFirstChild("GuidePortal", true)
|
||||||
|
if marker then
|
||||||
|
local flat = V(cf.Position.X, 0, cf.Position.Z)
|
||||||
|
local outward = flat.Magnitude > 0.1 and flat.Unit or V(0, 0, 1)
|
||||||
|
local p = flat + outward * 5.7
|
||||||
|
marker.CFrame = CFrame.new(p.X, marker.Position.Y, p.Z) * (marker.CFrame - marker.Position)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
for _, board in ipairs(boards) do
|
for _, board in ipairs(boards) do
|
||||||
writeBestiary(board)
|
writeBestiary(board)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,240 @@
|
|||||||
|
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
||||||
|
<Item class="LocalScript" referent="RBX1"><Properties><string name="Name">Loading</string><ProtectedString name="Source"><![CDATA[-- Loading (LocalScript) -> ReplicatedFirst
|
||||||
|
-- Экран загрузки. Закрывает картинку при входе в игру и при каждом телепорте: игрок уже стоит на месте,
|
||||||
|
-- сцена прогружается, клиент ставит свет локации — и только потом экран плавно уходит.
|
||||||
|
--
|
||||||
|
-- FishingClient управляет экраном через атрибуты ScreenGui «LoadingScreen»:
|
||||||
|
-- Visible = true — показать (при телепорте);
|
||||||
|
-- Ready = true — свет и террейн локации выставлены;
|
||||||
|
-- StartAt / MinUntil — os.clock() начала и минимального конца показа (полоска заполняется за это время);
|
||||||
|
-- Title — подпись под названием игры (куда идём).
|
||||||
|
-- Экран уходит, когда Ready = true и минимальное время прошло.
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local ReplicatedFirst = game:GetService("ReplicatedFirst")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
local TweenService = game:GetService("TweenService")
|
||||||
|
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
pcall(function() ReplicatedFirst:RemoveDefaultLoadingScreen() end)
|
||||||
|
|
||||||
|
local GOLD = Color3.fromRGB(255, 205, 90)
|
||||||
|
local TIPS = {
|
||||||
|
"Чем реже рыба, тем быстрее бегает метка — нужна точность!",
|
||||||
|
"Улучшай удочку в магазине: рыба клюёт быстрее, удача выше.",
|
||||||
|
"Собери все виды одной редкости — получишь награду в коллекции (C).",
|
||||||
|
"Каждый день заходи за наградой из сундука в лобби.",
|
||||||
|
"Новые миры открываются с уровнем: следи за опытом!",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function new(class, props)
|
||||||
|
local o = Instance.new(class)
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
if k ~= "Parent" then
|
||||||
|
o[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
o.Parent = props.Parent
|
||||||
|
return o
|
||||||
|
end
|
||||||
|
|
||||||
|
local gui = new("ScreenGui", {
|
||||||
|
Name = "LoadingScreen", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 200,
|
||||||
|
ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"),
|
||||||
|
})
|
||||||
|
-- фон: заставка «Рыболовная лихорадка»; пока картинка грузится, виден голубой градиент.
|
||||||
|
-- Градиент — на отдельной подложке: UIGradient на самой CanvasGroup тонирует всё содержимое и затемнял картинку.
|
||||||
|
-- Свет и цветокоррекция сцены на экранный интерфейс не действуют, их не трогаем.
|
||||||
|
local BG_IMAGE = "rbxassetid://82266337853896" -- осветлённая и более насыщенная версия заставки
|
||||||
|
-- обычный Frame, а не CanvasGroup: CanvasGroup рендерит содержимое в текстуру пониженного разрешения — картинка мылится.
|
||||||
|
-- Плавное появление/исчезновение делаем сами (setFade ниже).
|
||||||
|
local root = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, BorderSizePixel = 0, Parent = gui })
|
||||||
|
local backdrop = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(1, 1, 1), BorderSizePixel = 0, Parent = root })
|
||||||
|
new("UIGradient", {
|
||||||
|
Rotation = 90,
|
||||||
|
Color = ColorSequence.new(Color3.fromRGB(70, 140, 230), Color3.fromRGB(40, 70, 150)),
|
||||||
|
Parent = backdrop,
|
||||||
|
})
|
||||||
|
local bg = new("ImageLabel", {
|
||||||
|
Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = BG_IMAGE,
|
||||||
|
ScaleType = Enum.ScaleType.Crop, Parent = root,
|
||||||
|
})
|
||||||
|
task.spawn(function()
|
||||||
|
pcall(function() game:GetService("ContentProvider"):PreloadAsync({ bg }) end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- плашка снизу: куда идём, полоска загрузки, совет
|
||||||
|
local panel = new("Frame", {
|
||||||
|
AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -28), Size = UDim2.fromOffset(560, 118),
|
||||||
|
BackgroundColor3 = Color3.new(1, 1, 1), BackgroundTransparency = 0.12, BorderSizePixel = 0, Parent = root,
|
||||||
|
})
|
||||||
|
new("UICorner", { CornerRadius = UDim.new(0, 18), Parent = panel })
|
||||||
|
new("UIStroke", { Color = GOLD, Thickness = 3, Transparency = 0.1, Parent = panel })
|
||||||
|
-- тёмно-синяя плашка под ночное небо заставки, золотая обводка — как у заголовка
|
||||||
|
new("UIGradient", {
|
||||||
|
Rotation = 90,
|
||||||
|
Color = ColorSequence.new(Color3.fromRGB(40, 66, 140), Color3.fromRGB(20, 32, 78)),
|
||||||
|
Parent = panel,
|
||||||
|
})
|
||||||
|
local float = new("TextLabel", {
|
||||||
|
AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(44, 32), Size = UDim2.fromOffset(46, 46),
|
||||||
|
BackgroundTransparency = 1, Text = "🎣", TextScaled = true, Font = Enum.Font.FredokaOne, Parent = panel,
|
||||||
|
})
|
||||||
|
local title = new("TextLabel", {
|
||||||
|
Position = UDim2.fromOffset(78, 12), Size = UDim2.new(1, -96, 0, 38), BackgroundTransparency = 1,
|
||||||
|
Text = "", TextColor3 = Color3.fromRGB(255, 240, 200), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
|
Font = Enum.Font.FredokaOne, Parent = panel,
|
||||||
|
})
|
||||||
|
new("UIStroke", { Color = Color3.fromRGB(15, 22, 55), Thickness = 2, Parent = title })
|
||||||
|
local barBack = new("Frame", {
|
||||||
|
AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 62), Size = UDim2.new(1, -36, 0, 16),
|
||||||
|
BackgroundColor3 = Color3.fromRGB(10, 16, 40), BackgroundTransparency = 0.15, BorderSizePixel = 0, Parent = panel,
|
||||||
|
})
|
||||||
|
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = barBack })
|
||||||
|
local bar = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = GOLD, BorderSizePixel = 0, Parent = barBack })
|
||||||
|
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = bar })
|
||||||
|
new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 230, 120), Color3.fromRGB(255, 160, 60)), Parent = bar })
|
||||||
|
local tip = new("TextLabel", {
|
||||||
|
Position = UDim2.fromOffset(18, 86), Size = UDim2.new(1, -36, 0, 22), BackgroundTransparency = 1,
|
||||||
|
Text = "", TextColor3 = Color3.fromRGB(205, 222, 255), TextScaled = true,
|
||||||
|
Font = Enum.Font.GothamMedium, Parent = panel,
|
||||||
|
})
|
||||||
|
|
||||||
|
local rng = Random.new()
|
||||||
|
local function showTip()
|
||||||
|
tip.Text = "💡 " .. TIPS[rng:NextInteger(1, #TIPS)]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- плавность без CanvasGroup: запоминаем исходную прозрачность каждого элемента и смешиваем её с 1
|
||||||
|
local fadeProps = { "BackgroundTransparency", "ImageTransparency", "TextTransparency", "TextStrokeTransparency" }
|
||||||
|
local fadeItems = {}
|
||||||
|
for _, o in ipairs(root:GetDescendants()) do
|
||||||
|
local orig = {}
|
||||||
|
for _, prop in ipairs(o:IsA("UIStroke") and { "Transparency" } or fadeProps) do
|
||||||
|
local ok, v = pcall(function() return o[prop] end)
|
||||||
|
if ok and type(v) == "number" then
|
||||||
|
orig[prop] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if next(orig) then
|
||||||
|
fadeItems[o] = orig
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local fadeValue = Instance.new("NumberValue") -- 0 — экран виден, 1 — прозрачен
|
||||||
|
local function setFade(a)
|
||||||
|
for o, orig in pairs(fadeItems) do
|
||||||
|
for prop, v in pairs(orig) do
|
||||||
|
o[prop] = v + (1 - v) * a
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fadeValue.Changed:Connect(setFade)
|
||||||
|
local function fadeTo(a, time)
|
||||||
|
local tw = TweenService:Create(fadeValue, TweenInfo.new(time), { Value = a })
|
||||||
|
tw:Play()
|
||||||
|
return tw
|
||||||
|
end
|
||||||
|
|
||||||
|
-- HUD Roblox (хотбар, чат, список игроков, верхняя панель) рисуется поверх любых ScreenGui — прячем на время загрузки
|
||||||
|
-- и возвращаем как было (FishingClient сам выключает его у таблички, поэтому сохраняем состояние каждого типа)
|
||||||
|
local StarterGui = game:GetService("StarterGui")
|
||||||
|
local savedCore = nil -- [CoreGuiType] = было ли включено до загрузки; nil — HUD сейчас не спрятан
|
||||||
|
local coreGen = 0
|
||||||
|
local function setCoreHidden(hidden)
|
||||||
|
if hidden == (savedCore ~= nil) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local snapshot
|
||||||
|
if hidden then
|
||||||
|
savedCore = {}
|
||||||
|
for _, t in ipairs(Enum.CoreGuiType:GetEnumItems()) do
|
||||||
|
local ok, on = pcall(function() return StarterGui:GetCoreGuiEnabled(t) end)
|
||||||
|
if t ~= Enum.CoreGuiType.All and ok then
|
||||||
|
savedCore[t] = on
|
||||||
|
end
|
||||||
|
end
|
||||||
|
snapshot = savedCore
|
||||||
|
else
|
||||||
|
snapshot, savedCore = savedCore, nil
|
||||||
|
end
|
||||||
|
coreGen += 1
|
||||||
|
local gen = coreGen
|
||||||
|
-- верхняя панель (меню Roblox); в новых версиях может не поддерживаться — тогда просто пропускаем
|
||||||
|
task.spawn(function()
|
||||||
|
for _ = 1, 20 do
|
||||||
|
if gen ~= coreGen or pcall(function() StarterGui:SetCore("TopbarEnabled", not hidden) end) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
task.wait(0.25) -- в первые кадры CoreScripts ещё не готовы и SetCore падает
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
for t, on in pairs(snapshot) do
|
||||||
|
pcall(function() StarterGui:SetCoreGuiEnabled(t, (not hidden) and on) end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- при входе: экран виден сразу, минимум — из FishConfig, когда он загрузится
|
||||||
|
local now = os.clock()
|
||||||
|
gui:SetAttribute("Visible", true)
|
||||||
|
gui:SetAttribute("Ready", false)
|
||||||
|
gui:SetAttribute("StartAt", now)
|
||||||
|
gui:SetAttribute("MinUntil", now + 3)
|
||||||
|
gui:SetAttribute("Title", "Загрузка…")
|
||||||
|
showTip()
|
||||||
|
setCoreHidden(true)
|
||||||
|
|
||||||
|
task.spawn(function()
|
||||||
|
if not game:IsLoaded() then
|
||||||
|
game.Loaded:Wait()
|
||||||
|
end
|
||||||
|
local ok, Config = pcall(require, ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
if ok and Config.Loading then
|
||||||
|
gui:SetAttribute("MinUntil", gui:GetAttribute("StartAt") + Config.Loading.firstJoin)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local hiding = false
|
||||||
|
gui:GetAttributeChangedSignal("Visible"):Connect(function()
|
||||||
|
-- новый телепорт мог прийти, пока экран ещё уходил: тогда возвращаем его
|
||||||
|
if gui:GetAttribute("Visible") then
|
||||||
|
hiding = false
|
||||||
|
showTip()
|
||||||
|
gui.Enabled = true
|
||||||
|
setCoreHidden(true)
|
||||||
|
fadeTo(0, 0.25)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
gui:GetAttributeChangedSignal("Title"):Connect(function()
|
||||||
|
title.Text = gui:GetAttribute("Title") or ""
|
||||||
|
end)
|
||||||
|
title.Text = gui:GetAttribute("Title")
|
||||||
|
|
||||||
|
RunService.RenderStepped:Connect(function()
|
||||||
|
if not gui.Enabled then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local t = os.clock()
|
||||||
|
float.Rotation = math.sin(t * 2.2) * 12
|
||||||
|
float.Position = UDim2.fromOffset(44, 32 + math.sin(t * 3) * 3)
|
||||||
|
local startAt, minUntil = gui:GetAttribute("StartAt") or t, gui:GetAttribute("MinUntil") or t
|
||||||
|
local p = math.clamp((t - startAt) / math.max(0.01, minUntil - startAt), 0, 1)
|
||||||
|
local ready = gui:GetAttribute("Ready") == true
|
||||||
|
if not ready then
|
||||||
|
p = math.min(p, 0.95) -- пока локация не готова, полоска не доходит до конца
|
||||||
|
end
|
||||||
|
bar.Size = UDim2.fromScale(p, 1)
|
||||||
|
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
if ready and hrp and t >= minUntil and not hiding then
|
||||||
|
hiding = true
|
||||||
|
fadeTo(1, 0.6).Completed:Connect(function(state)
|
||||||
|
if hiding and state == Enum.PlaybackState.Completed then
|
||||||
|
gui.Enabled = false
|
||||||
|
gui:SetAttribute("Visible", false)
|
||||||
|
setCoreHidden(false)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
]]></ProtectedString></Properties></Item>
|
||||||
|
</roblox>
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
-- Loading (LocalScript) -> ReplicatedFirst
|
||||||
|
-- Экран загрузки. Закрывает картинку при входе в игру и при каждом телепорте: игрок уже стоит на месте,
|
||||||
|
-- сцена прогружается, клиент ставит свет локации — и только потом экран плавно уходит.
|
||||||
|
--
|
||||||
|
-- FishingClient управляет экраном через атрибуты ScreenGui «LoadingScreen»:
|
||||||
|
-- Visible = true — показать (при телепорте);
|
||||||
|
-- Ready = true — свет и террейн локации выставлены;
|
||||||
|
-- StartAt / MinUntil — os.clock() начала и минимального конца показа (полоска заполняется за это время);
|
||||||
|
-- Title — подпись под названием игры (куда идём).
|
||||||
|
-- Экран уходит, когда Ready = true и минимальное время прошло.
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local ReplicatedFirst = game:GetService("ReplicatedFirst")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
local TweenService = game:GetService("TweenService")
|
||||||
|
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
pcall(function() ReplicatedFirst:RemoveDefaultLoadingScreen() end)
|
||||||
|
|
||||||
|
local GOLD = Color3.fromRGB(255, 205, 90)
|
||||||
|
local TIPS = {
|
||||||
|
"Чем реже рыба, тем быстрее бегает метка — нужна точность!",
|
||||||
|
"Улучшай удочку в магазине: рыба клюёт быстрее, удача выше.",
|
||||||
|
"Собери все виды одной редкости — получишь награду в коллекции (C).",
|
||||||
|
"Каждый день заходи за наградой из сундука в лобби.",
|
||||||
|
"Новые миры открываются с уровнем: следи за опытом!",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function new(class, props)
|
||||||
|
local o = Instance.new(class)
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
if k ~= "Parent" then
|
||||||
|
o[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
o.Parent = props.Parent
|
||||||
|
return o
|
||||||
|
end
|
||||||
|
|
||||||
|
local gui = new("ScreenGui", {
|
||||||
|
Name = "LoadingScreen", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 200,
|
||||||
|
ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"),
|
||||||
|
})
|
||||||
|
-- фон: заставка «Рыболовная лихорадка»; пока картинка грузится, виден голубой градиент.
|
||||||
|
-- Градиент — на отдельной подложке: UIGradient на самой CanvasGroup тонирует всё содержимое и затемнял картинку.
|
||||||
|
-- Свет и цветокоррекция сцены на экранный интерфейс не действуют, их не трогаем.
|
||||||
|
local BG_IMAGE = "rbxassetid://82266337853896" -- осветлённая и более насыщенная версия заставки
|
||||||
|
-- обычный Frame, а не CanvasGroup: CanvasGroup рендерит содержимое в текстуру пониженного разрешения — картинка мылится.
|
||||||
|
-- Плавное появление/исчезновение делаем сами (setFade ниже).
|
||||||
|
local root = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, BorderSizePixel = 0, Parent = gui })
|
||||||
|
local backdrop = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(1, 1, 1), BorderSizePixel = 0, Parent = root })
|
||||||
|
new("UIGradient", {
|
||||||
|
Rotation = 90,
|
||||||
|
Color = ColorSequence.new(Color3.fromRGB(70, 140, 230), Color3.fromRGB(40, 70, 150)),
|
||||||
|
Parent = backdrop,
|
||||||
|
})
|
||||||
|
local bg = new("ImageLabel", {
|
||||||
|
Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = BG_IMAGE,
|
||||||
|
ScaleType = Enum.ScaleType.Crop, Parent = root,
|
||||||
|
})
|
||||||
|
task.spawn(function()
|
||||||
|
pcall(function() game:GetService("ContentProvider"):PreloadAsync({ bg }) end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- плашка снизу: куда идём, полоска загрузки, совет
|
||||||
|
local panel = new("Frame", {
|
||||||
|
AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -28), Size = UDim2.fromOffset(560, 118),
|
||||||
|
BackgroundColor3 = Color3.new(1, 1, 1), BackgroundTransparency = 0.12, BorderSizePixel = 0, Parent = root,
|
||||||
|
})
|
||||||
|
new("UICorner", { CornerRadius = UDim.new(0, 18), Parent = panel })
|
||||||
|
new("UIStroke", { Color = GOLD, Thickness = 3, Transparency = 0.1, Parent = panel })
|
||||||
|
-- тёмно-синяя плашка под ночное небо заставки, золотая обводка — как у заголовка
|
||||||
|
new("UIGradient", {
|
||||||
|
Rotation = 90,
|
||||||
|
Color = ColorSequence.new(Color3.fromRGB(40, 66, 140), Color3.fromRGB(20, 32, 78)),
|
||||||
|
Parent = panel,
|
||||||
|
})
|
||||||
|
local float = new("TextLabel", {
|
||||||
|
AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(44, 32), Size = UDim2.fromOffset(46, 46),
|
||||||
|
BackgroundTransparency = 1, Text = "🎣", TextScaled = true, Font = Enum.Font.FredokaOne, Parent = panel,
|
||||||
|
})
|
||||||
|
local title = new("TextLabel", {
|
||||||
|
Position = UDim2.fromOffset(78, 12), Size = UDim2.new(1, -96, 0, 38), BackgroundTransparency = 1,
|
||||||
|
Text = "", TextColor3 = Color3.fromRGB(255, 240, 200), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
|
Font = Enum.Font.FredokaOne, Parent = panel,
|
||||||
|
})
|
||||||
|
new("UIStroke", { Color = Color3.fromRGB(15, 22, 55), Thickness = 2, Parent = title })
|
||||||
|
local barBack = new("Frame", {
|
||||||
|
AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 62), Size = UDim2.new(1, -36, 0, 16),
|
||||||
|
BackgroundColor3 = Color3.fromRGB(10, 16, 40), BackgroundTransparency = 0.15, BorderSizePixel = 0, Parent = panel,
|
||||||
|
})
|
||||||
|
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = barBack })
|
||||||
|
local bar = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = GOLD, BorderSizePixel = 0, Parent = barBack })
|
||||||
|
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = bar })
|
||||||
|
new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 230, 120), Color3.fromRGB(255, 160, 60)), Parent = bar })
|
||||||
|
local tip = new("TextLabel", {
|
||||||
|
Position = UDim2.fromOffset(18, 86), Size = UDim2.new(1, -36, 0, 22), BackgroundTransparency = 1,
|
||||||
|
Text = "", TextColor3 = Color3.fromRGB(205, 222, 255), TextScaled = true,
|
||||||
|
Font = Enum.Font.GothamMedium, Parent = panel,
|
||||||
|
})
|
||||||
|
|
||||||
|
local rng = Random.new()
|
||||||
|
local function showTip()
|
||||||
|
tip.Text = "💡 " .. TIPS[rng:NextInteger(1, #TIPS)]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- плавность без CanvasGroup: запоминаем исходную прозрачность каждого элемента и смешиваем её с 1
|
||||||
|
local fadeProps = { "BackgroundTransparency", "ImageTransparency", "TextTransparency", "TextStrokeTransparency" }
|
||||||
|
local fadeItems = {}
|
||||||
|
for _, o in ipairs(root:GetDescendants()) do
|
||||||
|
local orig = {}
|
||||||
|
for _, prop in ipairs(o:IsA("UIStroke") and { "Transparency" } or fadeProps) do
|
||||||
|
local ok, v = pcall(function() return o[prop] end)
|
||||||
|
if ok and type(v) == "number" then
|
||||||
|
orig[prop] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if next(orig) then
|
||||||
|
fadeItems[o] = orig
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local fadeValue = Instance.new("NumberValue") -- 0 — экран виден, 1 — прозрачен
|
||||||
|
local function setFade(a)
|
||||||
|
for o, orig in pairs(fadeItems) do
|
||||||
|
for prop, v in pairs(orig) do
|
||||||
|
o[prop] = v + (1 - v) * a
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fadeValue.Changed:Connect(setFade)
|
||||||
|
local function fadeTo(a, time)
|
||||||
|
local tw = TweenService:Create(fadeValue, TweenInfo.new(time), { Value = a })
|
||||||
|
tw:Play()
|
||||||
|
return tw
|
||||||
|
end
|
||||||
|
|
||||||
|
-- HUD Roblox (хотбар, чат, список игроков, верхняя панель) рисуется поверх любых ScreenGui — прячем на время загрузки
|
||||||
|
-- и возвращаем как было (FishingClient сам выключает его у таблички, поэтому сохраняем состояние каждого типа)
|
||||||
|
local StarterGui = game:GetService("StarterGui")
|
||||||
|
local savedCore = nil -- [CoreGuiType] = было ли включено до загрузки; nil — HUD сейчас не спрятан
|
||||||
|
local coreGen = 0
|
||||||
|
local function setCoreHidden(hidden)
|
||||||
|
if hidden == (savedCore ~= nil) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local snapshot
|
||||||
|
if hidden then
|
||||||
|
savedCore = {}
|
||||||
|
for _, t in ipairs(Enum.CoreGuiType:GetEnumItems()) do
|
||||||
|
local ok, on = pcall(function() return StarterGui:GetCoreGuiEnabled(t) end)
|
||||||
|
if t ~= Enum.CoreGuiType.All and ok then
|
||||||
|
savedCore[t] = on
|
||||||
|
end
|
||||||
|
end
|
||||||
|
snapshot = savedCore
|
||||||
|
else
|
||||||
|
snapshot, savedCore = savedCore, nil
|
||||||
|
end
|
||||||
|
coreGen += 1
|
||||||
|
local gen = coreGen
|
||||||
|
-- верхняя панель (меню Roblox); в новых версиях может не поддерживаться — тогда просто пропускаем
|
||||||
|
task.spawn(function()
|
||||||
|
for _ = 1, 20 do
|
||||||
|
if gen ~= coreGen or pcall(function() StarterGui:SetCore("TopbarEnabled", not hidden) end) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
task.wait(0.25) -- в первые кадры CoreScripts ещё не готовы и SetCore падает
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
for t, on in pairs(snapshot) do
|
||||||
|
pcall(function() StarterGui:SetCoreGuiEnabled(t, (not hidden) and on) end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- при входе: экран виден сразу, минимум — из FishConfig, когда он загрузится
|
||||||
|
local now = os.clock()
|
||||||
|
gui:SetAttribute("Visible", true)
|
||||||
|
gui:SetAttribute("Ready", false)
|
||||||
|
gui:SetAttribute("StartAt", now)
|
||||||
|
gui:SetAttribute("MinUntil", now + 3)
|
||||||
|
gui:SetAttribute("Title", "Загрузка…")
|
||||||
|
showTip()
|
||||||
|
setCoreHidden(true)
|
||||||
|
|
||||||
|
task.spawn(function()
|
||||||
|
if not game:IsLoaded() then
|
||||||
|
game.Loaded:Wait()
|
||||||
|
end
|
||||||
|
local ok, Config = pcall(require, ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
if ok and Config.Loading then
|
||||||
|
gui:SetAttribute("MinUntil", gui:GetAttribute("StartAt") + Config.Loading.firstJoin)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local hiding = false
|
||||||
|
gui:GetAttributeChangedSignal("Visible"):Connect(function()
|
||||||
|
-- новый телепорт мог прийти, пока экран ещё уходил: тогда возвращаем его
|
||||||
|
if gui:GetAttribute("Visible") then
|
||||||
|
hiding = false
|
||||||
|
showTip()
|
||||||
|
gui.Enabled = true
|
||||||
|
setCoreHidden(true)
|
||||||
|
fadeTo(0, 0.25)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
gui:GetAttributeChangedSignal("Title"):Connect(function()
|
||||||
|
title.Text = gui:GetAttribute("Title") or ""
|
||||||
|
end)
|
||||||
|
title.Text = gui:GetAttribute("Title")
|
||||||
|
|
||||||
|
RunService.RenderStepped:Connect(function()
|
||||||
|
if not gui.Enabled then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local t = os.clock()
|
||||||
|
float.Rotation = math.sin(t * 2.2) * 12
|
||||||
|
float.Position = UDim2.fromOffset(44, 32 + math.sin(t * 3) * 3)
|
||||||
|
local startAt, minUntil = gui:GetAttribute("StartAt") or t, gui:GetAttribute("MinUntil") or t
|
||||||
|
local p = math.clamp((t - startAt) / math.max(0.01, minUntil - startAt), 0, 1)
|
||||||
|
local ready = gui:GetAttribute("Ready") == true
|
||||||
|
if not ready then
|
||||||
|
p = math.min(p, 0.95) -- пока локация не готова, полоска не доходит до конца
|
||||||
|
end
|
||||||
|
bar.Size = UDim2.fromScale(p, 1)
|
||||||
|
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
if ready and hrp and t >= minUntil and not hiding then
|
||||||
|
hiding = true
|
||||||
|
fadeTo(1, 0.6).Completed:Connect(function(state)
|
||||||
|
if hiding and state == Enum.PlaybackState.Completed then
|
||||||
|
gui.Enabled = false
|
||||||
|
gui:SetAttribute("Visible", false)
|
||||||
|
setCoreHidden(false)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
@@ -20,19 +20,23 @@ Config.Worlds = {
|
|||||||
-- свет и эффекты: свойства Lighting и его эффектов; чего здесь нет, остаётся как в MapBuilder
|
-- свет и эффекты: свойства Lighting и его эффектов; чего здесь нет, остаётся как в MapBuilder
|
||||||
look = {
|
look = {
|
||||||
lighting = {
|
lighting = {
|
||||||
Brightness = 2.6, ExposureCompensation = -0.15,
|
-- днём солнце не выжигает светлый песок и траву: яркость и экспозиция ниже
|
||||||
|
Brightness = 2.0, ExposureCompensation = -0.35,
|
||||||
Ambient = Color3.fromRGB(62, 66, 84), OutdoorAmbient = Color3.fromRGB(105, 112, 132),
|
Ambient = Color3.fromRGB(62, 66, 84), OutdoorAmbient = Color3.fromRGB(105, 112, 132),
|
||||||
ColorShift_Top = Color3.fromRGB(255, 232, 196),
|
ColorShift_Top = Color3.fromRGB(255, 232, 196),
|
||||||
EnvironmentDiffuseScale = 0.6, EnvironmentSpecularScale = 0.8,
|
EnvironmentDiffuseScale = 0.5, EnvironmentSpecularScale = 0.6,
|
||||||
},
|
},
|
||||||
-- дымка вдали: Density — сколько тумана, Haze — насколько он плотный у горизонта
|
-- дымка вдали: Density — сколько тумана, Haze — насколько он плотный у горизонта
|
||||||
atmosphere = {
|
atmosphere = {
|
||||||
Density = 0.38, Offset = 0.1, Haze = 1.2, Glare = 0.15,
|
Density = 0.38, Offset = 0.1, Haze = 1.2, Glare = 0.15,
|
||||||
Color = Color3.fromRGB(188, 204, 224), Decay = Color3.fromRGB(196, 176, 160),
|
Color = Color3.fromRGB(188, 204, 224), Decay = Color3.fromRGB(196, 176, 160),
|
||||||
},
|
},
|
||||||
color = { Saturation = 0.28, Contrast = 0.2, Brightness = -0.02 },
|
color = { Saturation = 0.16, Contrast = 0.12, Brightness = -0.04 },
|
||||||
bloom = { Intensity = 0.45, Size = 28, Threshold = 1.2 },
|
-- свечение только у по-настоящему ярких мест (огни ночью), без ореолов вокруг светлого днём
|
||||||
sunRays = { Intensity = 0.06, Spread = 0.6 },
|
bloom = { Intensity = 0.25, Size = 24, Threshold = 1.9 },
|
||||||
|
sunRays = { Intensity = 0.05, Spread = 0.6 },
|
||||||
|
-- мягкий тонмаппинг: светлое не выгорает в белое
|
||||||
|
grading = { TonemapperPreset = Enum.TonemapperPreset.Default },
|
||||||
-- лёгкое размытие дальнего плана
|
-- лёгкое размытие дальнего плана
|
||||||
dof = { Enabled = true, FarIntensity = 0.2, FocusDistance = 60, InFocusRadius = 120, NearIntensity = 0 },
|
dof = { Enabled = true, FarIntensity = 0.2, FocusDistance = 60, InFocusRadius = 120, NearIntensity = 0 },
|
||||||
},
|
},
|
||||||
@@ -75,6 +79,68 @@ Config.Worlds = {
|
|||||||
}
|
}
|
||||||
Config.WorldRadius = 260
|
Config.WorldRadius = 260
|
||||||
|
|
||||||
|
-- камера игрока: насколько близко и далеко можно отвести колесом (в studs);
|
||||||
|
-- maxZoom держит обзор внутри локаций — дальше видно край карты
|
||||||
|
Config.Camera = { minZoom = 0.5, maxZoom = 35 }
|
||||||
|
|
||||||
|
-- лента активности (слева внизу у всех игроков) и оповещения о редком улове
|
||||||
|
-- announceRank / announceMutations — крупный баннер со звуком у всех на сервере;
|
||||||
|
-- globalRank / globalMutations — улов уходит и на другие серверы игры (MessagingService);
|
||||||
|
-- lines — сколько строк в ленте, lineTime — сколько секунд строка остаётся видна
|
||||||
|
Config.Feed = {
|
||||||
|
announceRank = 4, announceMutations = { Golden = true, Rainbow = true },
|
||||||
|
globalRank = 5, globalMutations = { Rainbow = true },
|
||||||
|
lines = 6, lineTime = 30,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- доски лидеров в лобби (глобальные, по всем серверам; обновляются раз в refresh секунд).
|
||||||
|
-- attr — атрибут игрока, который считает сервер; store — имя OrderedDataStore (смена имени = новый топ с нуля)
|
||||||
|
Config.Leaderboards = {
|
||||||
|
refresh = 60, size = 10,
|
||||||
|
boards = {
|
||||||
|
{ id = "Donate", title = "💎 Топ донатеров", attr = "RobuxSpent", store = "TopRobux_v1", unit = "R$", color = Color3.fromRGB(205, 140, 255) },
|
||||||
|
{ id = "Earn", title = "⚪ Топ по заработку", attr = "CoinsEarned", store = "TopEarned_v1", unit = "⚪", color = Color3.fromRGB(255, 214, 90) },
|
||||||
|
{ id = "Catch", title = "🎣 Топ рыболовов", attr = "TotalCaught", store = "TopCaught_v1", unit = "🐟", color = Color3.fromRGB(120, 210, 255) },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- экран загрузки: при входе в игру и при каждом телепорте игрок уже стоит на месте, сцена прогружается
|
||||||
|
-- и свет локации ставится под ним; картинку видно только после этого (секунды — минимум показа)
|
||||||
|
Config.Loading = {
|
||||||
|
firstJoin = 3,
|
||||||
|
teleport = 2.5,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- лобби: те же поля внешнего вида, что у миров (clock, tint, look, terrainColors); клиент применяет их вне миров
|
||||||
|
Config.Lobby = {
|
||||||
|
id = "Lobby",
|
||||||
|
clock = 16.3, -- предвечернее солнце: тени длиннее, свет теплее
|
||||||
|
tint = Color3.fromRGB(255, 242, 228),
|
||||||
|
look = {
|
||||||
|
lighting = {
|
||||||
|
Brightness = 2.0, ExposureCompensation = -0.3,
|
||||||
|
Ambient = Color3.fromRGB(64, 60, 72), OutdoorAmbient = Color3.fromRGB(120, 114, 124),
|
||||||
|
ColorShift_Top = Color3.fromRGB(255, 224, 186),
|
||||||
|
EnvironmentDiffuseScale = 0.5, EnvironmentSpecularScale = 0.5,
|
||||||
|
GlobalShadows = true,
|
||||||
|
},
|
||||||
|
-- тёплая дымка: дальние холмы за скалами тонут в ней
|
||||||
|
atmosphere = {
|
||||||
|
Density = 0.4, Offset = 0.18, Haze = 1.6, Glare = 0.25,
|
||||||
|
Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150),
|
||||||
|
},
|
||||||
|
color = { Saturation = 0.18, Contrast = 0.14, Brightness = -0.04 },
|
||||||
|
bloom = { Intensity = 0.3, Size = 24, Threshold = 1.8 },
|
||||||
|
sunRays = { Intensity = 0.05, Spread = 0.7 },
|
||||||
|
dof = { Enabled = true, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 },
|
||||||
|
-- мягкий тонмаппинг вместо Retro: светлая плитка и вывески не выгорают в белое
|
||||||
|
grading = { TonemapperPreset = Enum.TonemapperPreset.Default },
|
||||||
|
},
|
||||||
|
terrainColors = {
|
||||||
|
Grass = Color3.fromRGB(104, 150, 72), Ground = Color3.fromRGB(120, 98, 74), Rock = Color3.fromRGB(140, 126, 130),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
function Config.WorldAt(pos)
|
function Config.WorldAt(pos)
|
||||||
for _, w in ipairs(Config.Worlds) do
|
for _, w in ipairs(Config.Worlds) do
|
||||||
if not w.soon then
|
if not w.soon then
|
||||||
@@ -264,16 +330,17 @@ Config.Zones = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
---------------------------------------------------------------- удочки
|
---------------------------------------------------------------- удочки
|
||||||
-- luck = бонус удачи, speed = множитель ожидания клёва (меньше = быстрее), zone = ширина зелёной зоны
|
-- luck = бонус удачи, speed = множитель ожидания клёва (меньше = быстрее), zone = ширина зелёной зоны,
|
||||||
|
-- icon = картинка удочки в хотбаре (Tool.TextureId)
|
||||||
Config.Rods = {
|
Config.Rods = {
|
||||||
{ id = "Basic", name = "Старая удочка", price = 0, level = 1, luck = 0.00, speed = 1.00, zone = 0.22, upgradeCost = 40, style = "wood" },
|
{ id = "Basic", name = "Старая удочка", price = 0, level = 1, luck = 0.00, speed = 1.00, zone = 0.22, upgradeCost = 40, style = "wood", icon = "rbxassetid://83350883185349" },
|
||||||
{ id = "Bamboo", name = "Бамбуковая удочка", price = 150, level = 3, luck = 0.15, speed = 0.88, zone = 0.25, upgradeCost = 120, style = "bamboo" },
|
{ id = "Bamboo", name = "Бамбуковая удочка", price = 150, level = 3, luck = 0.15, speed = 0.88, zone = 0.25, upgradeCost = 120, style = "bamboo", icon = "rbxassetid://98615001898640" },
|
||||||
{ id = "Fiberglass", name = "Стеклопластиковая", price = 600, level = 5, luck = 0.30, speed = 0.78, zone = 0.27, upgradeCost = 300, style = "glass" },
|
{ id = "Fiberglass", name = "Стеклопластиковая", price = 600, level = 5, luck = 0.30, speed = 0.78, zone = 0.27, upgradeCost = 300, style = "glass", icon = "rbxassetid://100031752289540" },
|
||||||
{ id = "Carbon", name = "Карбоновая удочка", price = 1800, level = 8, luck = 0.55, speed = 0.68, zone = 0.29, upgradeCost = 700, style = "carbon" },
|
{ id = "Carbon", name = "Карбоновая удочка", price = 1800, level = 8, luck = 0.55, speed = 0.68, zone = 0.29, upgradeCost = 700, style = "carbon", icon = "rbxassetid://71788597596034" },
|
||||||
{ id = "Coral", name = "Коралловая удочка", price = 4500, level = 10, luck = 0.80, speed = 0.62, zone = 0.31, upgradeCost = 1300, style = "coral" },
|
{ id = "Coral", name = "Коралловая удочка", price = 4500, level = 10, luck = 0.80, speed = 0.62, zone = 0.31, upgradeCost = 1300, style = "coral", icon = "rbxassetid://139114393074237" },
|
||||||
{ id = "Golden", name = "Золотая удочка", price = 9000, level = 13, luck = 1.00, speed = 0.56, zone = 0.33, upgradeCost = 2200, style = "gold" },
|
{ id = "Golden", name = "Золотая удочка", price = 9000, level = 13, luck = 1.00, speed = 0.56, zone = 0.33, upgradeCost = 2200, style = "gold", icon = "rbxassetid://83212298735071" },
|
||||||
{ id = "Frost", name = "Ледяная удочка", price = 25000, level = 18, luck = 1.40, speed = 0.50, zone = 0.35, upgradeCost = 5000, style = "frost" },
|
{ id = "Frost", name = "Ледяная удочка", price = 25000, level = 18, luck = 1.40, speed = 0.50, zone = 0.35, upgradeCost = 5000, style = "frost", icon = "rbxassetid://134579643216329" },
|
||||||
{ id = "Legend", name = "Удочка Легенды", price = 75000, level = 25, luck = 2.00, speed = 0.42, zone = 0.38, upgradeCost = 12000, style = "legend" },
|
{ id = "Legend", name = "Удочка Легенды", price = 75000, level = 25, luck = 2.00, speed = 0.42, zone = 0.38, upgradeCost = 12000, style = "legend", icon = "rbxassetid://84863811378769" },
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.RodUpgrade = { maxLevel = 5, luckPerLevel = 0.08, zonePerLevel = 0.012, speedPerLevel = 0.96 }
|
Config.RodUpgrade = { maxLevel = 5, luckPerLevel = 0.08, zonePerLevel = 0.012, speedPerLevel = 0.96 }
|
||||||
@@ -327,7 +394,7 @@ Config.QuestKinds = {
|
|||||||
perfectCast = { text = "Забрось в зелёную зону %d %s", forms = TIMES, coins = 8, xp = 6 },
|
perfectCast = { text = "Забрось в зелёную зону %d %s", forms = TIMES, coins = 8, xp = 6 },
|
||||||
combo = { text = "Набери серию из %d рыб", coins = 12, xp = 10, max = 15 },
|
combo = { text = "Набери серию из %d рыб", coins = 12, xp = 10, max = 15 },
|
||||||
sell = { text = "Продай %d %s", forms = FISH, coins = 3, xp = 3 },
|
sell = { text = "Продай %d %s", forms = FISH, coins = 3, xp = 3 },
|
||||||
earn = { text = "Заработай %d 💰 на продаже", coins = 0.25, xp = 0.2, byLevel = true },
|
earn = { text = "Заработай %d ⚪ на продаже", coins = 0.25, xp = 0.2, byLevel = true },
|
||||||
buy = { text = "Купи что-нибудь в магазине", coins = 40, xp = 30, max = 1 },
|
buy = { text = "Купи что-нибудь в магазине", coins = 40, xp = 30, max = 1 },
|
||||||
boss = { text = "Нанеси боссу %d урона", coins = 15, xp = 12 },
|
boss = { text = "Нанеси боссу %d урона", coins = 15, xp = 12 },
|
||||||
}
|
}
|
||||||
@@ -360,7 +427,7 @@ Config.Boss = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ежедневная награда (7 дней по кругу), монеты растут с уровнем
|
-- ежедневная награда (7 дней по кругу), серебро растёт с уровнем
|
||||||
Config.DailyRewards = {
|
Config.DailyRewards = {
|
||||||
{ coins = 100 },
|
{ coins = 100 },
|
||||||
{ coins = 200 },
|
{ coins = 200 },
|
||||||
@@ -376,26 +443,129 @@ Config.Events = {
|
|||||||
{ id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 },
|
{ id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 },
|
||||||
{ id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 },
|
{ id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 },
|
||||||
{ id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 },
|
{ id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 },
|
||||||
{ id = "Fair", name = "💰 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 },
|
{ id = "Fair", name = "🐟 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 },
|
||||||
}
|
}
|
||||||
Config.EventFirstDelay = 120
|
Config.EventFirstDelay = 120
|
||||||
Config.EventGapMin = 420
|
Config.EventGapMin = 420
|
||||||
Config.EventGapMax = 720
|
Config.EventGapMax = 720
|
||||||
|
|
||||||
|
---------------------------------------------------------------- время суток
|
||||||
|
-- одни сутки длятся length секунд реального времени; время общее для всего сервера
|
||||||
|
Config.DayNight = {
|
||||||
|
enabled = true,
|
||||||
|
length = 1200, -- 20 минут на сутки
|
||||||
|
startClock = 9, -- во сколько начинается день при запуске сервера
|
||||||
|
nightLuck = 0.10, -- ночью удача +10%
|
||||||
|
}
|
||||||
|
|
||||||
|
-- время на часах в момент serverTime (workspace:GetServerTimeNow()), dayStart — атрибут workspace "DayStart"
|
||||||
|
function Config.ClockAt(serverTime, dayStart)
|
||||||
|
local d = Config.DayNight
|
||||||
|
return (d.startClock + (serverTime - (dayStart or serverTime)) / d.length * 24) % 24
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 0 днём, 1 глубокой ночью, плавно на рассвете и закате
|
||||||
|
function Config.Nightness(clock)
|
||||||
|
if clock >= 7 and clock <= 17.5 then
|
||||||
|
return 0
|
||||||
|
elseif clock > 17.5 and clock < 20 then
|
||||||
|
return (clock - 17.5) / 2.5
|
||||||
|
elseif clock >= 5 and clock < 7 then
|
||||||
|
return 1 - (clock - 5) / 2
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function Config.IsNight(clock)
|
||||||
|
return Config.Nightness(clock) >= 0.5
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- погода
|
||||||
|
-- меняется на всём сервере; weight — как часто выпадает, duration — сколько длится (секунды)
|
||||||
|
-- luck / speed / mutation — бонусы к рыбалке, пока погода держится
|
||||||
|
-- names — как погода называется в отдельных мирах (во фьорде вместо дождя снег)
|
||||||
|
Config.Weathers = {
|
||||||
|
{ id = "Clear", name = "Ясно", icon = "☀", weight = 40, duration = { 240, 420 } },
|
||||||
|
{ id = "Cloudy", name = "Пасмурно", icon = "☁", weight = 25, duration = { 180, 360 }, luck = 0.05, desc = "Удача +5%" },
|
||||||
|
{ id = "Rain", name = "Дождь", icon = "🌧", weight = 20, duration = { 150, 300 }, speed = 0.85, desc = "Клюёт на 15% быстрее",
|
||||||
|
names = { World3 = "Снегопад" } },
|
||||||
|
{ id = "Storm", name = "Гроза", icon = "⛈", weight = 8, duration = { 120, 240 }, luck = 0.25, speed = 0.9, desc = "Удача +25%",
|
||||||
|
names = { World3 = "Метель" } },
|
||||||
|
{ id = "Fog", name = "Туман", icon = "🌫", weight = 7, duration = { 150, 300 }, mutation = 1.5, desc = "Мутации ×1.5" },
|
||||||
|
}
|
||||||
|
|
||||||
|
function Config.WeatherById(id)
|
||||||
|
for _, w in ipairs(Config.Weathers) do
|
||||||
|
if w.id == id then
|
||||||
|
return w
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return Config.Weathers[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- звуки
|
||||||
|
-- ID из Creator Store: эффекты — Pro Sound Effects (официальная библиотека Roblox),
|
||||||
|
-- музыка — APM и DistroKid (лицензированы для Roblox). volume — громкость, pitch — разброс высоты
|
||||||
|
local function S(id, volume, extra)
|
||||||
|
local t = extra or {}
|
||||||
|
t.id = "rbxassetid://" .. id
|
||||||
|
t.volume = volume
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
Config.Sounds = {
|
||||||
|
-- музыка
|
||||||
|
musicLobby = S(137023744071437, 0.35), -- The Ancient Lutes | Medieval Tavern Music
|
||||||
|
musicLobby2 = S(116079409060113, 0.35), -- The Lute Lament | Medieval Tavern Music
|
||||||
|
musicLake = S(1838853377, 0.3), -- Harp Fantasy
|
||||||
|
musicLake2 = S(86472274853159, 0.3), -- Calm Fantasy Atmosphere
|
||||||
|
musicNight = S(140195397978848, 0.3), -- Moonlit Meadow Whisper
|
||||||
|
-- окружение (петли)
|
||||||
|
birdsLake = S(9112877174, 0.35), -- Squam Lake 1
|
||||||
|
birdsPark = S(9113444360, 0.25), -- Birds Park 2
|
||||||
|
birdsJungle = S(9114892930, 0.3), -- Jungle Birds Ambience 3
|
||||||
|
crickets = S(9112764573, 0.3), -- Crickets Night 3
|
||||||
|
lakeWater = S(9116203162, 0.25), -- Lake Lap Water Movement 2
|
||||||
|
wind = S(9113286782, 0.18), -- Barstow Wind Light Blustery Low Howl 1
|
||||||
|
rainLight = S(9112852668, 0.45), -- Rain Continuous Drizzle 1
|
||||||
|
rainHeavy = S(9112853287, 0.55), -- Rain Heavy 1
|
||||||
|
fire = S(9112780193, 0.6, { roll = 30 }), -- Fireplace Constant Burning Flame 1 (слышно у костра)
|
||||||
|
thunder = { "rbxassetid://9116282875", "rbxassetid://9116282646", "rbxassetid://9116282791", "rbxassetid://9116282544" },
|
||||||
|
-- рыбалка
|
||||||
|
cast = S(9120718279, 0.5, { pitch = { 0.9, 1.1 } }), -- Whoosh Fast Swish By 1
|
||||||
|
bite = S(9112751536, 0.7, { pitch = { 0.9, 1.15 } }), -- Bubble Bloop High Pitched Cute 1
|
||||||
|
reel = S(9114454019, 0.4), -- Fishing Reel 4 (петля, пока тянешь)
|
||||||
|
catchSplash = S(9119293555, 0.6), -- Small Splash Shallow Water
|
||||||
|
catch = S(9126073001, 0.5), -- Bell Tone Ding
|
||||||
|
fanfare = S(1836473422, 0.45), -- Victory Fanfare Sting (редкая рыба)
|
||||||
|
sparkle = S(9114369623, 0.5), -- Fairy Dust 1 (мутация)
|
||||||
|
escape = S(9117944976, 0.5), -- Puddle Splash 2 (сорвалась)
|
||||||
|
-- интерфейс
|
||||||
|
click = S(15675032796, 0.5), -- Roblox_UI_Small_Click
|
||||||
|
open = S(9117231552, 0.45), -- Paper Scroll Unroll Handle 4
|
||||||
|
coins = S(9113849306, 0.6), -- Coins Or Keys Jingle 1
|
||||||
|
chestHop = S(9120718279, 0.35, { pitch = { 0.7, 0.8 } }), -- Whoosh Fast Swish By 1 (сундук награды подпрыгивает)
|
||||||
|
chestLand = S(9113769181, 0.7, { pitch = { 0.95, 1.05 } }), -- Chair Drop 2: тяжёлый деревянный удар о землю
|
||||||
|
levelUp = S(1840525342, 0.5), -- Harp Glissando (A)
|
||||||
|
quest = S(9126073318, 0.5), -- Bell Tone Ding 2
|
||||||
|
}
|
||||||
|
Config.DefaultVolume = { music = 0.6, sfx = 0.8 }
|
||||||
|
|
||||||
---------------------------------------------------------------- донат (Robux)
|
---------------------------------------------------------------- донат (Robux)
|
||||||
-- ВАЖНО: впиши сюда ID своих пропусков и товаров с create.roblox.com.
|
-- Все товары — Developer Products игры (create.roblox.com → Monetization → Developer Products);
|
||||||
|
-- id — Product ID оттуда, robux — цена для кнопки (должна совпадать с ценой в Roblox).
|
||||||
|
-- Пропуска тоже Developer Products: покупаются один раз, сервер запоминает их в данных игрока навсегда.
|
||||||
-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен.
|
-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен.
|
||||||
Config.GamePasses = {
|
Config.GamePasses = {
|
||||||
{ key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и монет, корона над головой" },
|
{ key = "VIP", id = 3728143641, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и серебра, корона над головой" },
|
||||||
{ key = "DoubleCoins", id = 0, robux = 299, icon = "💰", name = "x2 Монеты", desc = "Вся рыба продаётся в 2 раза дороже" },
|
{ key = "DoubleCoins", id = 3728143692, robux = 299, icon = "⚪", name = "x2 Серебро", desc = "Вся рыба продаётся в 2 раза дороже" },
|
||||||
{ key = "LuckyCharm", id = 0, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" },
|
{ key = "LuckyCharm", id = 3728143735, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" },
|
||||||
{ key = "BigBag", id = 0, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" },
|
{ key = "BigBag", id = 3728143773, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" },
|
||||||
}
|
}
|
||||||
Config.Products = {
|
Config.Products = {
|
||||||
{ key = "Coins1", id = 0, robux = 49, icon = "🪙", name = "Мешок монет", desc = "+1 000 монет (больше с уровнем)", coins = 1000 },
|
{ key = "Coins1", id = 3728142264, robux = 49, icon = "👝", name = "Кошель серебра", desc = "+1 000 серебра (больше с уровнем)", coins = 1000 },
|
||||||
{ key = "Coins2", id = 0, robux = 199, icon = "💰", name = "Сундук монет", desc = "+5 000 монет (больше с уровнем)", coins = 5000 },
|
{ key = "Coins2", id = 3728142848, robux = 199, icon = "⚪", name = "Сундук серебра", desc = "+5 000 серебра (больше с уровнем)", coins = 5000 },
|
||||||
{ key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 монет (больше с уровнем)", coins = 20000 },
|
{ key = "Coins3", id = 3728142885, 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 },
|
{ key = "Luck", id = 3728142916, robux = 99, icon = "🧪", name = "Супер-зелье удачи", desc = "+200% удачи на 15 минут", boost = 2.0, duration = 900 },
|
||||||
}
|
}
|
||||||
|
|
||||||
---------------------------------------------------------------- рыбалка
|
---------------------------------------------------------------- рыбалка
|
||||||
@@ -416,8 +586,105 @@ Config.TutorialDone = 4
|
|||||||
function Config.HitsNeeded(rank)
|
function Config.HitsNeeded(rank)
|
||||||
return math.ceil(rank / 2)
|
return math.ceil(rank / 2)
|
||||||
end
|
end
|
||||||
|
-- опыт до следующего уровня: до 8-го ≈ 3 600 (1,5–2 часа вместе с заказами гильдии);
|
||||||
|
-- у старых сохранений уровень не понижается — копится только опыт внутри уровня
|
||||||
function Config.XPForLevel(level)
|
function Config.XPForLevel(level)
|
||||||
return 60 + level * 60
|
return math.floor(50 * level ^ 1.6)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- гильдия рыбаков
|
||||||
|
-- три валюты: серебро (coins в данных), жемчуг (pearls), печати гильдии (seals — копятся для ранга)
|
||||||
|
Config.Pearls = {
|
||||||
|
mutation = { Shiny = 1, Golden = 3, Rainbow = 10 }, -- за пойманную рыбу с мутацией
|
||||||
|
boss = 5, -- за победу над боссом
|
||||||
|
daily7 = 5, -- 7-й день ежедневной награды
|
||||||
|
rankUp = 10, -- за новый ранг
|
||||||
|
}
|
||||||
|
|
||||||
|
-- ранги: seals — сколько печатей нужно накопить, trial — испытание у Старейшины,
|
||||||
|
-- orders — заказов на доске, traps — ловушек, discount — скидка у торговцев
|
||||||
|
-- trial.kind: deliver (сдать рыбу из сумки), catch (поймать с условием), bossWin (участие в победе над боссом),
|
||||||
|
-- dex (собрать коллекцию мира)
|
||||||
|
Config.Guild = {
|
||||||
|
elder = "Старейшина Ворон",
|
||||||
|
ranks = {
|
||||||
|
{ id = "F", name = "Ученик", seals = 0, orders = 3, color = Color3.fromRGB(150, 150, 150),
|
||||||
|
unlocks = "Мир 1, доска заказов" },
|
||||||
|
{ id = "E", name = "Подмастерье", seals = 30, orders = 4, color = Color3.fromRGB(90, 190, 90), auto = true,
|
||||||
|
trial = { kind = "deliver", fish = "Okun", count = 5, text = "Сдать 5 окуней" },
|
||||||
|
unlocks = "🎣 Автоловля, 4-й заказ на доске" },
|
||||||
|
{ id = "D", name = "Рыбак", seals = 120, orders = 4, color = Color3.fromRGB(70, 130, 230), auto = true, traps = 1,
|
||||||
|
trial = { kind = "catch", minRank = 3, weathers = { Rain = true, Storm = true }, count = 1, text = "Поймать «Редкую» рыбу в дождь или грозу" },
|
||||||
|
unlocks = "🏝 Мир 2 (и ур. 8), 🧺 ловушка" },
|
||||||
|
{ id = "C", name = "Опытный рыбак", seals = 350, orders = 4, color = Color3.fromRGB(150, 80, 200), auto = true, traps = 2, discount = 0.05,
|
||||||
|
trial = { kind = "bossWin", count = 1, text = "Помочь одолеть босса озера" },
|
||||||
|
unlocks = "🧺 2 ловушки, скидка у торговцев 5%" },
|
||||||
|
{ id = "B", name = "Мастер", seals = 900, orders = 4, color = Color3.fromRGB(200, 50, 45), auto = true, traps = 3, discount = 0.05,
|
||||||
|
trial = { kind = "dex", world = "World1", text = "Собрать всю коллекцию «Тихого озера»" },
|
||||||
|
unlocks = "❄ Мир 3 (и ур. 18), 🧺 3 ловушки" },
|
||||||
|
{ id = "A", name = "Магистр", seals = 2000, orders = 4, color = Color3.fromRGB(230, 180, 60), auto = true, traps = 3, discount = 0.10,
|
||||||
|
trial = { kind = "catch", minRank = 4, night = true, count = 1, text = "Поймать «Эпическую» рыбу ночью" },
|
||||||
|
unlocks = "Титул «Магистр», скидка 10%" },
|
||||||
|
{ id = "S", name = "Легенда", seals = 4500, orders = 4, color = Color3.fromRGB(255, 120, 200), auto = true, traps = 3, discount = 0.10, autoNoCap = true,
|
||||||
|
trial = { kind = "catch", minRank = 6, count = 1, text = "Поймать «Мифическую» рыбу" },
|
||||||
|
unlocks = "Золотой жетон, автоловля без ограничения редкости" },
|
||||||
|
},
|
||||||
|
-- миры требуют и уровень, и ранг (номер в списке ranks)
|
||||||
|
worldRank = { World2 = 3, World3 = 5 },
|
||||||
|
elderDistance = 22, -- взять испытание / сдать рыбу — рядом со Старейшиной или доской
|
||||||
|
}
|
||||||
|
|
||||||
|
-- заказы гильдии: личные, обновляются каждые period секунд (окно floor(os.time()/period)),
|
||||||
|
-- один заказ можно перебросить за rerollPearls жемчуга. Награда растёт с рангом
|
||||||
|
Config.Orders = {
|
||||||
|
period = 10800,
|
||||||
|
rerollPearls = 2,
|
||||||
|
pearlChance = 0.2, pearlsMin = 1, pearlsMax = 3,
|
||||||
|
coinsPerSeal = 12, -- серебро за заказ = печати × это × (1 + 0.5 · (ранг − 1))
|
||||||
|
-- weight — как часто выпадает; seals — печати {мин, макс}
|
||||||
|
kinds = {
|
||||||
|
deliver = { weight = 3, seals = { 5, 12 } },
|
||||||
|
heavy = { weight = 2, seals = { 8, 16 } },
|
||||||
|
weather = { weight = 1, seals = { 10, 20 } },
|
||||||
|
night = { weight = 1, seals = { 10, 22 } },
|
||||||
|
combo = { weight = 2, seals = { 8, 18 } },
|
||||||
|
perfect = { weight = 2, seals = { 6, 14 } },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- наживка: 1 слот, 1 штука тратится на заброс. price — за пачку из pack штук; currency = "pearls" — за жемчуг
|
||||||
|
Config.Baits = {
|
||||||
|
{ id = "Worm", name = "Червь", icon = "🐛", price = 40, pack = 10, speed = 0.9, desc = "Клюёт на 10% быстрее" },
|
||||||
|
{ id = "Larva", name = "Мотыль", icon = "🦐", price = 90, pack = 10, luck = 0.15, desc = "Удача +15%" },
|
||||||
|
{ id = "Firefly", name = "Светлячок", icon = "✨", price = 120, pack = 10, nightLuck = 0.30, desc = "Ночью удача +30% (вместо +10%)" },
|
||||||
|
{ id = "Blood", name = "Кровавая приманка", icon = "🩸", price = 400, pack = 10, rareWeight = 1.5, rank = 3, desc = "Редкие и выше попадаются в 1,5 раза чаще" },
|
||||||
|
{ id = "Pearl", name = "Жемчужная блесна", icon = "🦪", price = 5, pack = 5, mutation = 2, currency = "pearls", desc = "Шанс мутаций ×2" },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- автоловля (с ранга E): сервер сам забрасывает и вытаскивает, но со штрафами
|
||||||
|
Config.AutoFish = {
|
||||||
|
luck = 0.6, -- удача ×0.6
|
||||||
|
maxRarity = 3, -- не выше «Редкой» (ранг S снимает)
|
||||||
|
slower = 1.5, -- каждая поимка на 50% дольше
|
||||||
|
reel = 2.5, -- секунд «вываживания» вместо мини-игры
|
||||||
|
}
|
||||||
|
|
||||||
|
-- ловушки-вентери (с ранга D): 1 рыба Мира 1 каждые every секунд, не больше max, копятся и офлайн
|
||||||
|
Config.Traps = {
|
||||||
|
every = 900, max = 16,
|
||||||
|
world = "World1", rarities = { Common = 3, Uncommon = 1 }, -- вес редкостей
|
||||||
|
}
|
||||||
|
|
||||||
|
-- отдых: пока игрока нет, копится двойной опыт — 1 минута за каждые perOffline минут офлайн, не больше max
|
||||||
|
Config.Rest = { perOffline = 4, max = 3600, mult = 2 }
|
||||||
|
|
||||||
|
function Config.RankById(id)
|
||||||
|
for i, r in ipairs(Config.Guild.ranks) do
|
||||||
|
if r.id == id then
|
||||||
|
return r, i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- помощники
|
---------------------------------------------------------------- помощники
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ local function sparkles(parent, color, rate)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- удочки
|
---------------------------------------------------------------- удочки
|
||||||
-- Рука в (0,0,0), удочка смотрит в -Z и изгибается вверх (+Y).
|
-- Рука в (0,0,0), удочка смотрит в -Z почти прямо, кончик слегка провисает вниз (-Y).
|
||||||
|
|
||||||
local STYLES = {
|
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) },
|
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) },
|
||||||
@@ -176,8 +176,8 @@ function M.buildRod(rodId, upgradeLevel, anchored)
|
|||||||
cyl(model, V(0.24, -0.68, -0.58), V(0.5, -0.86, -0.58), 0.07, { Color = st.reel, Material = METAL })
|
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 })
|
ball(model, V(0.54, -0.9, -0.5), 0.19, { Color = st.grip, Material = SP })
|
||||||
|
|
||||||
-- бланк: 8 колен с плавным изгибом и шарами на стыках
|
-- бланк: 8 колен, почти прямой, к кончику плавно провисает; шары на стыках
|
||||||
local angles = { 6, 9, 12, 16, 20, 25, 30, 36 }
|
local angles = { 0, -1, -2, -3, -5, -7, -9, -12 }
|
||||||
local lengths = { 1.2, 1.15, 1.1, 1.0, 0.95, 0.9, 0.85, 0.8 }
|
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 p = V(0, 0, -1.55)
|
||||||
local lastSeg
|
local lastSeg
|
||||||
|
|||||||
@@ -13,11 +13,57 @@ local Debris = game:GetService("Debris")
|
|||||||
|
|
||||||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
||||||
|
local Guild = require(script.Parent:WaitForChild("Guild"))
|
||||||
|
|
||||||
local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent")
|
local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent")
|
||||||
remote.Name = "GameEvent"
|
remote.Name = "GameEvent"
|
||||||
remote.Parent = ReplicatedStorage
|
remote.Parent = ReplicatedStorage
|
||||||
|
|
||||||
|
---------------------------------------------------------------- лента активности
|
||||||
|
-- события для всех игроков (FishingClient показывает их в ленте и крупным баннером для редкого улова);
|
||||||
|
-- самые редкие уловы уходят и на другие серверы игры через MessagingService (Config.Feed)
|
||||||
|
local MessagingService = game:GetService("MessagingService")
|
||||||
|
local FEED_TOPIC = "FishFeed"
|
||||||
|
|
||||||
|
local function feed(kind, info)
|
||||||
|
remote:FireAllClients("Feed", kind, info)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- подписка — в фоне: SubscribeAsync ждёт ответа сервиса (в неопубликованном плейсе — долго),
|
||||||
|
-- а скрипт должен сразу дойти до загрузки игроков, телепортов и остального
|
||||||
|
task.spawn(function()
|
||||||
|
pcall(function()
|
||||||
|
MessagingService:SubscribeAsync(FEED_TOPIC, function(msg)
|
||||||
|
local d = msg.Data
|
||||||
|
if type(d) == "table" and d.jobId ~= game.JobId then
|
||||||
|
d.remote = true -- улов на другом сервере
|
||||||
|
feed("catch", d)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- улов в ленту; big — крупный баннер со звуком у всех, global — ещё и на другие серверы
|
||||||
|
local function feedCatch(player, fish, world)
|
||||||
|
local r = Config.Rarities[fish.rarity]
|
||||||
|
local F = Config.Feed
|
||||||
|
local info = {
|
||||||
|
name = player.DisplayName, userId = player.UserId,
|
||||||
|
fish = fish.name, rarity = fish.rarity, mutation = fish.mutation, value = fish.value,
|
||||||
|
world = world and (world.icon .. " " .. world.name) or nil,
|
||||||
|
big = r.rank >= F.announceRank or F.announceMutations[fish.mutation or ""] == true,
|
||||||
|
}
|
||||||
|
feed("catch", info)
|
||||||
|
if r.rank >= F.globalRank or F.globalMutations[fish.mutation or ""] then
|
||||||
|
info.jobId = game.JobId
|
||||||
|
task.spawn(function()
|
||||||
|
pcall(function()
|
||||||
|
MessagingService:PublishAsync(FEED_TOPIC, info)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local rng = Random.new()
|
local rng = Random.new()
|
||||||
local GOLD = Color3.fromRGB(255, 220, 80)
|
local GOLD = Color3.fromRGB(255, 220, 80)
|
||||||
local RED = Color3.fromRGB(255, 120, 120)
|
local RED = Color3.fromRGB(255, 120, 120)
|
||||||
@@ -44,6 +90,11 @@ local function defaultData()
|
|||||||
chain = { index = 1, step = 1, progress = 0, tier = 0 }, daily = { last = 0, streak = 0 },
|
chain = { index = 1, step = 1, progress = 0, tier = 0 }, daily = { last = 0, streak = 0 },
|
||||||
boostUntil = 0, boostBonus = 0,
|
boostUntil = 0, boostBonus = 0,
|
||||||
totalCaught = 0, nextUid = 1, receipts = {},
|
totalCaught = 0, nextUid = 1, receipts = {},
|
||||||
|
passes = {}, -- купленные пропуска (Developer Products): [key] = true
|
||||||
|
coinsEarned = 0, robuxSpent = 0, -- для досок лидеров: всего выручено за рыбу и потрачено Robux
|
||||||
|
settings = { music = Config.DefaultVolume.music, sfx = Config.DefaultVolume.sfx },
|
||||||
|
-- гильдия: жемчуг, печати, отдых (ранг, заказы, наживку, ловушки дополняет Guild.defaults)
|
||||||
|
pearls = 0, seals = 0, rest = 0,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -86,16 +137,12 @@ local function hasPass(player, key)
|
|||||||
return passes[player] ~= nil and passes[player][key] == true
|
return passes[player] ~= nil and passes[player][key] == true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function loadPasses(player)
|
-- пропуска продаются как Developer Products, поэтому владение хранится в данных игрока, а не в Roblox
|
||||||
|
local function loadPasses(player, data)
|
||||||
passes[player] = {}
|
passes[player] = {}
|
||||||
for _, gp in ipairs(Config.GamePasses) do
|
for _, gp in ipairs(Config.GamePasses) do
|
||||||
if gp.id and gp.id > 0 then
|
if data.passes[gp.key] then
|
||||||
local ok, owns = pcall(function()
|
passes[player][gp.key] = true
|
||||||
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gp.id)
|
|
||||||
end)
|
|
||||||
if ok and owns then
|
|
||||||
passes[player][gp.key] = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -105,6 +152,17 @@ local function ev(field, default)
|
|||||||
return (currentEvent and currentEvent[field]) or default
|
return (currentEvent and currentEvent[field]) or default
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- погода и время суток (их ведёт WeatherServer через атрибуты workspace)
|
||||||
|
local function weather()
|
||||||
|
return Config.WeatherById(workspace:GetAttribute("Weather"))
|
||||||
|
end
|
||||||
|
local function isNight()
|
||||||
|
if not Config.DayNight.enabled then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return Config.IsNight(Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart")))
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- расчёты
|
---------------------------------------------------------------- расчёты
|
||||||
|
|
||||||
local function rodLevel(data, rodId)
|
local function rodLevel(data, rodId)
|
||||||
@@ -134,7 +192,7 @@ local function totalLuck(player, data)
|
|||||||
if hasPass(player, "LuckyCharm") then
|
if hasPass(player, "LuckyCharm") then
|
||||||
l += 0.5
|
l += 0.5
|
||||||
end
|
end
|
||||||
return l + ev("luck", 0)
|
return l + ev("luck", 0) + (weather().luck or 0) + (isNight() and Config.DayNight.nightLuck or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function bagCapacity(player, data)
|
local function bagCapacity(player, data)
|
||||||
@@ -264,14 +322,20 @@ local function updateStats(player)
|
|||||||
player:SetAttribute("BoostBonus", boostActive(data))
|
player:SetAttribute("BoostBonus", boostActive(data))
|
||||||
player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time()))
|
player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time()))
|
||||||
player:SetAttribute("TotalCaught", data.totalCaught)
|
player:SetAttribute("TotalCaught", data.totalCaught)
|
||||||
|
player:SetAttribute("CoinsEarned", data.coinsEarned)
|
||||||
|
-- когда откроется следующая ежедневная награда (0 — уже доступна); по ней сундук в лобби прыгает только для тех,
|
||||||
|
-- кому есть что забрать
|
||||||
|
player:SetAttribute("DailyNextAt", data.daily.last >= today() and (data.daily.last + 1) * 86400 or 0)
|
||||||
|
player:SetAttribute("RobuxSpent", data.robuxSpent)
|
||||||
-- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено
|
-- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено
|
||||||
player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0))
|
player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0))
|
||||||
player:SetAttribute("Mastery", masteryCount(data))
|
player:SetAttribute("Mastery", masteryCount(data))
|
||||||
player:SetAttribute("Passes", table.concat(ps, ","))
|
player:SetAttribute("Passes", table.concat(ps, ","))
|
||||||
|
Guild.attrs(player, data)
|
||||||
|
|
||||||
local ls = player:FindFirstChild("leaderstats")
|
local ls = player:FindFirstChild("leaderstats")
|
||||||
if ls then
|
if ls then
|
||||||
ls["Монеты"].Value = data.coins
|
ls["Серебро"].Value = data.coins
|
||||||
ls["Уровень"].Value = data.level
|
ls["Уровень"].Value = data.level
|
||||||
ls["Улов"].Value = data.totalCaught
|
ls["Улов"].Value = data.totalCaught
|
||||||
end
|
end
|
||||||
@@ -287,6 +351,7 @@ local function addXp(player, data, amount)
|
|||||||
end
|
end
|
||||||
if leveled then
|
if leveled then
|
||||||
notify(player, "⭐ Уровень " .. data.level .. "!", GOLD)
|
notify(player, "⭐ Уровень " .. data.level .. "!", GOLD)
|
||||||
|
feed("level", { name = player.DisplayName, userId = player.UserId, level = data.level })
|
||||||
for _, w in ipairs(Config.Worlds) do
|
for _, w in ipairs(Config.Worlds) do
|
||||||
if w.level == data.level and not w.soon then
|
if w.level == data.level and not w.soon then
|
||||||
notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color)
|
notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color)
|
||||||
@@ -295,6 +360,11 @@ local function addXp(player, data, amount)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Guild.init({
|
||||||
|
profiles = profiles, notify = notify, updateStats = updateStats, addXp = addXp, sendInventory = sendInventory,
|
||||||
|
bagCapacity = bagCapacity, isNight = isNight, weather = weather, remote = remote,
|
||||||
|
})
|
||||||
|
|
||||||
local function applyPotion(data, bonus, duration)
|
local function applyPotion(data, bonus, duration)
|
||||||
data.boostBonus = math.max(boostActive(data), bonus)
|
data.boostBonus = math.max(boostActive(data), bonus)
|
||||||
data.boostUntil = math.max(os.time(), data.boostUntil) + duration
|
data.boostUntil = math.max(os.time(), data.boostUntil) + duration
|
||||||
@@ -373,9 +443,13 @@ local function claimDaily(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
data.daily = { last = t, streak = streak }
|
data.daily = { last = t, streak = streak }
|
||||||
|
if streak == 7 then
|
||||||
|
data.pearls += Config.Pearls.daily7
|
||||||
|
extra ..= (" + %d 🦪"):format(Config.Pearls.daily7)
|
||||||
|
end
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendQuests(player)
|
sendQuests(player)
|
||||||
notify(player, ("🎁 День %d: +%d 💰%s"):format(streak, coins, extra), GOLD)
|
notify(player, ("🎁 День %d: +%d ⚪%s"):format(streak, coins, extra), GOLD)
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- коллекция
|
---------------------------------------------------------------- коллекция
|
||||||
@@ -401,7 +475,7 @@ local function claimCollection(player, worldId, rarity)
|
|||||||
if rarity == "Master" then
|
if rarity == "Master" then
|
||||||
local coins = Config.MasteryCoins * world.mult
|
local coins = Config.MasteryCoins * world.mult
|
||||||
data.coins += coins
|
data.coins += coins
|
||||||
notify(player, ("🏆 «%s» собран! +%d 💰"):format(world.name, coins), GOLD)
|
notify(player, ("🏆 «%s» собран! +%d ⚪"):format(world.name, coins), GOLD)
|
||||||
else
|
else
|
||||||
local r = Config.CollectionRewards[rarity]
|
local r = Config.CollectionRewards[rarity]
|
||||||
if not r then
|
if not r then
|
||||||
@@ -409,7 +483,7 @@ local function claimCollection(player, worldId, rarity)
|
|||||||
end
|
end
|
||||||
data.coins += r.coins * world.mult
|
data.coins += r.coins * world.mult
|
||||||
addXp(player, data, r.xp * world.mult)
|
addXp(player, data, r.xp * world.mult)
|
||||||
notify(player, ("📖 +%d 💰 +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN)
|
notify(player, ("📖 +%d ⚪ +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN)
|
||||||
end
|
end
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
@@ -417,7 +491,7 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------- удочка, сумка, VIP на персонаже
|
---------------------------------------------------------------- удочка, сумка, VIP на персонаже
|
||||||
|
|
||||||
local REST_ANGLE = 30
|
local REST_ANGLE = 42 -- удочка в покое: рукоять под ~42° вверх-вперёд, кончик провисает до ~30°
|
||||||
local function gripCF(angle)
|
local function gripCF(angle)
|
||||||
return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse()
|
return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse()
|
||||||
end
|
end
|
||||||
@@ -471,6 +545,7 @@ local function giveRodTool(player)
|
|||||||
local tool = Instance.new("Tool")
|
local tool = Instance.new("Tool")
|
||||||
tool.Name = rod.name .. (lvl > 0 and (" +" .. lvl) or "")
|
tool.Name = rod.name .. (lvl > 0 and (" +" .. lvl) or "")
|
||||||
tool.ToolTip = "Кликни у воды, чтобы закинуть"
|
tool.ToolTip = "Кликни у воды, чтобы закинуть"
|
||||||
|
tool.TextureId = rod.icon or ""
|
||||||
tool.CanBeDropped = false
|
tool.CanBeDropped = false
|
||||||
tool.Grip = gripCF(REST_ANGLE)
|
tool.Grip = gripCF(REST_ANGLE)
|
||||||
tool:SetAttribute("IsRod", true)
|
tool:SetAttribute("IsRod", true)
|
||||||
@@ -733,12 +808,19 @@ local function stopFishing(player, tellClient)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function rollFish(player, data, worldId, luckMult)
|
-- mods: { bait = наживка из Config.Baits, maxRank = потолок редкости (автоловля) }
|
||||||
|
local function rollFish(player, data, worldId, luckMult, mods)
|
||||||
local zone = Config.Zones[worldId]
|
local zone = Config.Zones[worldId]
|
||||||
if not zone then
|
if not zone then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local luck = totalLuck(player, data) * (luckMult or 1)
|
mods = mods or {}
|
||||||
|
local bait = mods.bait
|
||||||
|
local base = totalLuck(player, data) + (bait and bait.luck or 0)
|
||||||
|
if bait and bait.nightLuck and isNight() then
|
||||||
|
base += bait.nightLuck - Config.DayNight.nightLuck -- светлячок: ночью +30% вместо обычных +10%
|
||||||
|
end
|
||||||
|
local luck = base * (luckMult or 1)
|
||||||
local bonus = luck - 1
|
local bonus = luck - 1
|
||||||
local weights, total = {}, 0
|
local weights, total = {}, 0
|
||||||
for i, f in ipairs(zone.fish) do
|
for i, f in ipairs(zone.fish) do
|
||||||
@@ -747,6 +829,12 @@ local function rollFish(player, data, worldId, luckMult)
|
|||||||
if r.rank == 1 then
|
if r.rank == 1 then
|
||||||
w = r.weight / math.max(1, luck)
|
w = r.weight / math.max(1, luck)
|
||||||
end
|
end
|
||||||
|
if bait and bait.rareWeight and r.rank >= 3 then
|
||||||
|
w *= bait.rareWeight
|
||||||
|
end
|
||||||
|
if mods.maxRank and r.rank > mods.maxRank then
|
||||||
|
w = 0
|
||||||
|
end
|
||||||
weights[i] = w
|
weights[i] = w
|
||||||
total += w
|
total += w
|
||||||
end
|
end
|
||||||
@@ -761,7 +849,7 @@ local function rollFish(player, data, worldId, luckMult)
|
|||||||
end
|
end
|
||||||
local mutation = nil
|
local mutation = nil
|
||||||
for _, m in ipairs(Config.Mutations) do
|
for _, m in ipairs(Config.Mutations) do
|
||||||
if rng:NextNumber() < m.chance * luck * ev("mutation", 1) then
|
if rng:NextNumber() < m.chance * luck * ev("mutation", 1) * (weather().mutation or 1) * (bait and bait.mutation or 1) then
|
||||||
mutation = m
|
mutation = m
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -817,12 +905,21 @@ local function flyBobber(s, tool, target, dur, arc)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local autoFishing = {} -- [player] = токен работающей автоловли
|
||||||
|
local setAutoFish, grantFish -- объявлены ниже
|
||||||
|
|
||||||
local function onCast(player, power)
|
local function onCast(player, power)
|
||||||
power = math.clamp(tonumber(power) or 0.6, 0, 1)
|
power = math.clamp(tonumber(power) or 0.6, 0, 1)
|
||||||
local data = profiles[player]
|
local data = profiles[player]
|
||||||
if not data then
|
if not data then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if autoFishing[player] then
|
||||||
|
-- клик удочкой во время автоловли — выключить её
|
||||||
|
setAutoFish(player, false)
|
||||||
|
remote:FireClient(player, "CastFail")
|
||||||
|
return
|
||||||
|
end
|
||||||
if fishing[player] then
|
if fishing[player] then
|
||||||
stopFishing(player, true)
|
stopFishing(player, true)
|
||||||
return
|
return
|
||||||
@@ -855,7 +952,8 @@ local function onCast(player, power)
|
|||||||
|
|
||||||
local stats = Config.RodStats(data.rod, rodLevel(data))
|
local stats = Config.RodStats(data.rod, rodLevel(data))
|
||||||
local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2]
|
local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2]
|
||||||
local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1)
|
local bait = Guild.useBait(player, data) -- 1 штука наживки на заброс
|
||||||
|
local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1, { bait = bait })
|
||||||
if not fish then
|
if not fish then
|
||||||
remote:FireClient(player, "CastFail")
|
remote:FireClient(player, "CastFail")
|
||||||
return
|
return
|
||||||
@@ -885,7 +983,7 @@ local function onCast(player, power)
|
|||||||
end
|
end
|
||||||
s.stage = "waiting"
|
s.stage = "waiting"
|
||||||
|
|
||||||
local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1)
|
local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) * (weather().speed or 1) * (bait and bait.speed or 1)
|
||||||
task.wait(waitTime)
|
task.wait(waitTime)
|
||||||
if fishing[player] ~= s then
|
if fishing[player] ~= s then
|
||||||
return
|
return
|
||||||
@@ -956,14 +1054,22 @@ local function onCatch(player, success, misses)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } })
|
gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } })
|
||||||
|
grantFish(player, data, s.fish, { perfect = s.perfect, misses = misses, fromPos = fromPos })
|
||||||
|
end
|
||||||
|
|
||||||
-- серия: каждая рыба подряд дороже и даёт больше опыта
|
-- рыба поймана (руками или автоловлей): в сумку, опыт, коллекция, задания, гильдия, босс.
|
||||||
local fish = s.fish
|
-- ctx: { perfect, misses, fromPos, auto }; у автоловли нет серии и бонусов за точность
|
||||||
|
grantFish = function(player, data, fish, ctx)
|
||||||
local streak = combo[player] or 0
|
local streak = combo[player] or 0
|
||||||
local comboMult = math.min(Config.Combo.max, 1 + Config.Combo.step * streak)
|
local comboMult = 1
|
||||||
fish.value = math.floor(fish.value * comboMult + 0.5)
|
if not ctx.auto then
|
||||||
fish.xp = math.floor(fish.xp * comboMult + 0.5)
|
-- серия: каждая рыба подряд дороже и даёт больше опыта
|
||||||
setCombo(player, streak + 1)
|
comboMult = math.min(Config.Combo.max, 1 + Config.Combo.step * streak)
|
||||||
|
fish.value = math.floor(fish.value * comboMult + 0.5)
|
||||||
|
fish.xp = math.floor(fish.xp * comboMult + 0.5)
|
||||||
|
setCombo(player, streak + 1)
|
||||||
|
end
|
||||||
|
fish.xp = math.floor(fish.xp * Guild.xpMult(data)) -- бонус отдыха: двойной опыт
|
||||||
table.insert(data.items, {
|
table.insert(data.items, {
|
||||||
uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity,
|
uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity,
|
||||||
weight = fish.weight, value = fish.value, mutation = fish.mutation,
|
weight = fish.weight, value = fish.value, mutation = fish.mutation,
|
||||||
@@ -986,10 +1092,14 @@ local function onCatch(player, success, misses)
|
|||||||
addXp(player, data, fish.xp * (isNew and 2 or 1))
|
addXp(player, data, fish.xp * (isNew and 2 or 1))
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
if fromPos then
|
if ctx.fromPos then
|
||||||
showFishFlight(player, fish, fromPos)
|
showFishFlight(player, fish, ctx.fromPos)
|
||||||
|
end
|
||||||
|
remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord, combo = comboMult, streak = ctx.auto and 0 or streak + 1, auto = ctx.auto })
|
||||||
|
do
|
||||||
|
local h = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
feedCatch(player, fish, h and Config.WorldAt(h.Position))
|
||||||
end
|
end
|
||||||
remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord, combo = comboMult, streak = streak + 1 })
|
|
||||||
|
|
||||||
local rank = Config.Rarities[fish.rarity].rank
|
local rank = Config.Rarities[fish.rarity].rank
|
||||||
questProgress(player, "catch", 1)
|
questProgress(player, "catch", 1)
|
||||||
@@ -999,16 +1109,160 @@ local function onCatch(player, success, misses)
|
|||||||
if rank >= 3 then
|
if rank >= 3 then
|
||||||
questProgress(player, "rare", 1)
|
questProgress(player, "rare", 1)
|
||||||
end
|
end
|
||||||
if misses == 0 then
|
if not ctx.auto then
|
||||||
questProgress(player, "perfect", 1)
|
if ctx.misses == 0 then
|
||||||
|
questProgress(player, "perfect", 1)
|
||||||
|
end
|
||||||
|
if ctx.perfect then
|
||||||
|
questProgress(player, "perfectCast", 1)
|
||||||
|
end
|
||||||
|
questProgress(player, "combo", streak + 1, true)
|
||||||
end
|
end
|
||||||
if s.perfect then
|
Guild.onCatch(player, data, fish, {
|
||||||
questProgress(player, "perfectCast", 1)
|
weather = workspace:GetAttribute("Weather"), night = isNight(),
|
||||||
end
|
perfect = ctx.perfect and not ctx.auto, streak = (not ctx.auto) and streak + 1 or 0,
|
||||||
questProgress(player, "combo", streak + 1, true)
|
})
|
||||||
|
|
||||||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
bossHit(player, hrp and Config.WorldAt(hrp.Position), rank + (misses == 0 and 1 or 0))
|
bossHit(player, hrp and Config.WorldAt(hrp.Position), rank + (ctx.misses == 0 and 1 or 0))
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- автоловля (с ранга E)
|
||||||
|
-- сервер сам забрасывает и вытаскивает: удача ×0.6, не выше «Редкой», без серии и бонуса заброса,
|
||||||
|
-- каждая поимка на 50% дольше. Стоп — полная сумка, отошёл от места, сменил мир, убрал удочку
|
||||||
|
|
||||||
|
local function autoFishLoop(player, token)
|
||||||
|
local A = Config.AutoFish
|
||||||
|
local home = nil -- где включили: отошёл дальше 10 studs или сменил мир — стоп
|
||||||
|
local function stop(reason)
|
||||||
|
if autoFishing[player] == token then
|
||||||
|
setAutoFish(player, false, reason)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
while autoFishing[player] == token do
|
||||||
|
local data = profiles[player]
|
||||||
|
local char = player.Character
|
||||||
|
local hrp = char and char:FindFirstChild("HumanoidRootPart")
|
||||||
|
local tool = char and char:FindFirstChildOfClass("Tool")
|
||||||
|
if not data or not hrp then
|
||||||
|
return stop(nil)
|
||||||
|
end
|
||||||
|
if not tool or not tool:GetAttribute("IsRod") then
|
||||||
|
return stop("🎣 Автоловля: возьми удочку в руки")
|
||||||
|
end
|
||||||
|
local world = Config.WorldAt(hrp.Position)
|
||||||
|
if not world or Config.CanCastFrom(world, hrp.Position) ~= true then
|
||||||
|
return stop("🌊 Автоловля: встань у воды")
|
||||||
|
end
|
||||||
|
home = home or { pos = hrp.Position, world = world.id }
|
||||||
|
if world.id ~= home.world or (hrp.Position - home.pos).Magnitude > 10 then
|
||||||
|
return stop("🎣 Автоловля остановлена: ты отошёл")
|
||||||
|
end
|
||||||
|
if #data.items >= bagCapacity(player, data) then
|
||||||
|
return stop("🎒 Сумка полна — автоловля остановлена")
|
||||||
|
end
|
||||||
|
local target, dist = findWater(hrp, world, 0.6)
|
||||||
|
if not target then
|
||||||
|
return stop("🌊 Автоловля: встань у воды")
|
||||||
|
end
|
||||||
|
if fishing[player] then
|
||||||
|
task.wait(0.5)
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
|
local bait = Guild.useBait(player, data)
|
||||||
|
local fish = rollFish(player, data, world.id, A.luck, { bait = bait, maxRank = (not Guild.rank(data).autoNoCap) and A.maxRarity or nil })
|
||||||
|
local s = { stage = "casting", fish = fish, tool = tool, auto = true }
|
||||||
|
fishing[player] = s
|
||||||
|
local splashAt = target + Vector3.new(0, 0.15, 0)
|
||||||
|
local tw = tweenGrip(tool, 8, 0.15)
|
||||||
|
if tw then
|
||||||
|
tw.Completed:Wait()
|
||||||
|
end
|
||||||
|
if fishing[player] == s then
|
||||||
|
flyBobber(s, tool, splashAt, 0.35 + dist * 0.018, 2 + dist * 0.3)
|
||||||
|
tweenGrip(tool, REST_ANGLE - 5, 0.4)
|
||||||
|
end
|
||||||
|
if fishing[player] ~= s then
|
||||||
|
if s.bobber then
|
||||||
|
s.bobber:Destroy()
|
||||||
|
end
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
s.stage = "waiting"
|
||||||
|
local stats = Config.RodStats(data.rod, rodLevel(data))
|
||||||
|
local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1)
|
||||||
|
* (weather().speed or 1) * (bait and bait.speed or 1) * A.slower
|
||||||
|
local t0, bit = os.clock(), false
|
||||||
|
while fishing[player] == s and autoFishing[player] == token and os.clock() - t0 < waitTime + A.reel do
|
||||||
|
local h = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
if not h or (h.Position - home.pos).Magnitude > 10 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if not bit and os.clock() - t0 >= waitTime then
|
||||||
|
-- клюёт: всплеск и удочка дёргается до конца «вываживания»
|
||||||
|
bit = true
|
||||||
|
if s.bobber and s.bobber.PrimaryPart then
|
||||||
|
splash(s.bobber.PrimaryPart, 25)
|
||||||
|
playSound(s.bobber.PrimaryPart, SPLASH_SOUND, 0.35)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if bit then
|
||||||
|
tweenGrip(tool, (math.floor(os.clock() * 8) % 2 == 0) and 38 or 18, 0.12)
|
||||||
|
end
|
||||||
|
task.wait(0.13)
|
||||||
|
end
|
||||||
|
if fishing[player] ~= s or autoFishing[player] ~= token or not bit or os.clock() - t0 < waitTime + A.reel - 0.05 then
|
||||||
|
if fishing[player] == s then
|
||||||
|
stopFishing(player, false)
|
||||||
|
end
|
||||||
|
continue -- наверху цикла проверим, почему прервались (отошёл, выключил)
|
||||||
|
end
|
||||||
|
fishing[player] = nil
|
||||||
|
local fromPos = s.bobber and s.bobber.PrimaryPart and s.bobber.PrimaryPart.Position
|
||||||
|
if s.bobber then
|
||||||
|
s.bobber:Destroy()
|
||||||
|
end
|
||||||
|
gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } })
|
||||||
|
grantFish(player, data, fish, { auto = true, fromPos = fromPos })
|
||||||
|
task.wait(1.2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
setAutoFish = function(player, on, reason)
|
||||||
|
local data = profiles[player]
|
||||||
|
if on then
|
||||||
|
if not data then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not Guild.rank(data).auto then
|
||||||
|
notify(player, "🔒 Автоловля — с ранга гильдии E", RED)
|
||||||
|
player:SetAttribute("AutoFish", false)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if autoFishing[player] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if fishing[player] then
|
||||||
|
stopFishing(player, true)
|
||||||
|
end
|
||||||
|
local token = {}
|
||||||
|
autoFishing[player] = token
|
||||||
|
player:SetAttribute("AutoFish", true)
|
||||||
|
notify(player, "🎣 Автоловля включена", GREEN)
|
||||||
|
task.spawn(autoFishLoop, player, token)
|
||||||
|
else
|
||||||
|
player:SetAttribute("AutoFish", false)
|
||||||
|
if not autoFishing[player] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
autoFishing[player] = nil
|
||||||
|
local s = fishing[player]
|
||||||
|
if s and s.auto then
|
||||||
|
stopFishing(player, false)
|
||||||
|
end
|
||||||
|
notify(player, reason or "🎣 Автоловля выключена", Color3.fromRGB(255, 200, 120))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- скупка
|
---------------------------------------------------------------- скупка
|
||||||
@@ -1061,6 +1315,7 @@ local function sellItems(player, filterUid)
|
|||||||
end
|
end
|
||||||
data.items = keep
|
data.items = keep
|
||||||
data.coins += total
|
data.coins += total
|
||||||
|
data.coinsEarned += total
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
remote:FireClient(player, "Sold", total, count)
|
remote:FireClient(player, "Sold", total, count)
|
||||||
@@ -1085,9 +1340,9 @@ local function buy(player, kind, id)
|
|||||||
notify(player, "★★★★★ Максимум", GOLD)
|
notify(player, "★★★★★ Максимум", GOLD)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local cost = Config.UpgradeCost(rod, lvl)
|
local cost = Guild.price(data, Config.UpgradeCost(rod, lvl)) -- скидка ранга гильдии
|
||||||
if data.coins < cost then
|
if data.coins < cost then
|
||||||
notify(player, "Нужно " .. cost .. " 💰", RED)
|
notify(player, "Нужно " .. cost .. " ⚪", RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
data.coins -= cost
|
data.coins -= cost
|
||||||
@@ -1110,11 +1365,12 @@ local function buy(player, kind, id)
|
|||||||
notify(player, "🔒 Нужен ур. " .. potion.level, RED)
|
notify(player, "🔒 Нужен ур. " .. potion.level, RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if data.coins < potion.price then
|
local price = Guild.price(data, potion.price)
|
||||||
notify(player, "Нужно " .. potion.price .. " 💰", RED)
|
if data.coins < price then
|
||||||
|
notify(player, "Нужно " .. price .. " ⚪", RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
data.coins -= potion.price
|
data.coins -= price
|
||||||
applyPotion(data, potion.bonus, potion.duration)
|
applyPotion(data, potion.bonus, potion.duration)
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN)
|
notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN)
|
||||||
@@ -1139,11 +1395,12 @@ local function buy(player, kind, id)
|
|||||||
notify(player, "🔒 Нужен ур. " .. item.level, RED)
|
notify(player, "🔒 Нужен ур. " .. item.level, RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if data.coins < item.price then
|
local price = Guild.price(data, item.price)
|
||||||
notify(player, "Нужно " .. item.price .. " 💰", RED)
|
if data.coins < price then
|
||||||
|
notify(player, "Нужно " .. price .. " ⚪", RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
data.coins -= item.price
|
data.coins -= price
|
||||||
owned[id] = true
|
owned[id] = true
|
||||||
bought = true
|
bought = true
|
||||||
notify(player, "✅ " .. item.name, GREEN)
|
notify(player, "✅ " .. item.name, GREEN)
|
||||||
@@ -1164,6 +1421,12 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------- телепорт
|
---------------------------------------------------------------- телепорт
|
||||||
|
|
||||||
|
local TELEPORT_FADE = 0.3 -- сколько клиент затемняет экран перед переносом
|
||||||
|
local teleporting = {}
|
||||||
|
Players.PlayerRemoving:Connect(function(p)
|
||||||
|
teleporting[p] = nil
|
||||||
|
end)
|
||||||
|
|
||||||
local function teleportTo(player, worldId)
|
local function teleportTo(player, worldId)
|
||||||
local data = profiles[player]
|
local data = profiles[player]
|
||||||
local char = player.Character
|
local char = player.Character
|
||||||
@@ -1186,13 +1449,26 @@ local function teleportTo(player, worldId)
|
|||||||
notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED)
|
notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local okRank, why = Guild.canEnter(data, world.id)
|
||||||
|
if not okRank then
|
||||||
|
notify(player, why, RED)
|
||||||
|
return
|
||||||
|
end
|
||||||
markerName = world.id .. "Spawn"
|
markerName = world.id .. "Spawn"
|
||||||
end
|
end
|
||||||
local map = workspace:FindFirstChild("FishingMap")
|
local map = workspace:FindFirstChild("FishingMap")
|
||||||
local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map)
|
local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map)
|
||||||
if m then
|
if m and not teleporting[player] then
|
||||||
|
-- клиент затемняет экран, переносим уже в темноте: свет новой локации ставится до того, как её видно
|
||||||
|
teleporting[player] = true
|
||||||
stopFishing(player, true)
|
stopFishing(player, true)
|
||||||
char:PivotTo(m.CFrame + Vector3.new(0, 3, 0))
|
remote:FireClient(player, "TeleportFade", worldId, TELEPORT_FADE)
|
||||||
|
task.wait(TELEPORT_FADE)
|
||||||
|
teleporting[player] = nil
|
||||||
|
char = player.Character
|
||||||
|
if char and char.Parent then
|
||||||
|
char:PivotTo(m.CFrame + Vector3.new(0, 3, 0))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1241,6 +1517,10 @@ ProximityPromptService.PromptTriggered:Connect(function(prompt, player)
|
|||||||
remote:FireClient(player, "OpenRobux", "passes")
|
remote:FireClient(player, "OpenRobux", "passes")
|
||||||
elseif action == "RobuxProducts" then
|
elseif action == "RobuxProducts" then
|
||||||
remote:FireClient(player, "OpenRobux", "products")
|
remote:FireClient(player, "OpenRobux", "products")
|
||||||
|
elseif action == "Guild" or action == "Orders" or action == "Bait" or action == "Traps" then
|
||||||
|
-- Старейшина, доска заказов, лавка наживки: окно гильдии на нужной вкладке
|
||||||
|
Guild.sendState(player)
|
||||||
|
remote:FireClient(player, "OpenGuild", ({ Guild = "rank", Orders = "orders", Bait = "bait", Traps = "traps" })[action])
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -1270,13 +1550,13 @@ remote.OnServerEvent:Connect(function(player, action, a, b)
|
|||||||
if nearSeller(player) then
|
if nearSeller(player) then
|
||||||
sellItems(player, a)
|
sellItems(player, a)
|
||||||
else
|
else
|
||||||
notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120))
|
notify(player, "⚪ Только у скупщика", Color3.fromRGB(255, 200, 120))
|
||||||
end
|
end
|
||||||
elseif action == "SellAll" then
|
elseif action == "SellAll" then
|
||||||
if nearSeller(player) then
|
if nearSeller(player) then
|
||||||
sellItems(player, nil)
|
sellItems(player, nil)
|
||||||
else
|
else
|
||||||
notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120))
|
notify(player, "⚪ Только у скупщика", Color3.fromRGB(255, 200, 120))
|
||||||
end
|
end
|
||||||
elseif action == "Teleport" then
|
elseif action == "Teleport" then
|
||||||
teleportTo(player, a)
|
teleportTo(player, a)
|
||||||
@@ -1287,27 +1567,38 @@ remote.OnServerEvent:Connect(function(player, action, a, b)
|
|||||||
elseif action == "RequestInventory" then
|
elseif action == "RequestInventory" then
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
sendQuests(player)
|
sendQuests(player)
|
||||||
|
elseif action == "Settings" then
|
||||||
|
-- громкость музыки и эффектов (0..1), сохраняется вместе с прогрессом
|
||||||
|
local data = profiles[player]
|
||||||
|
local music, sfx = tonumber(a), tonumber(b)
|
||||||
|
if data and music and sfx then
|
||||||
|
data.settings = { music = math.clamp(music, 0, 1), sfx = math.clamp(sfx, 0, 1) }
|
||||||
|
player:SetAttribute("VolMusic", data.settings.music)
|
||||||
|
player:SetAttribute("VolSfx", data.settings.sfx)
|
||||||
|
end
|
||||||
|
elseif action == "AutoFish" then
|
||||||
|
setAutoFish(player, a == true)
|
||||||
|
else
|
||||||
|
Guild.onAction(player, action, a, b)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
---------------------------------------------------------------- донат
|
---------------------------------------------------------------- донат
|
||||||
|
|
||||||
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased)
|
-- все покупки — Developer Products: и наборы (Config.Products), и пропуска навсегда (Config.GamePasses)
|
||||||
if not purchased then
|
local function findProduct(productId)
|
||||||
return
|
for _, p in ipairs(Config.Products) do
|
||||||
end
|
if p.id == productId then
|
||||||
for _, gp in ipairs(Config.GamePasses) do
|
return p, false
|
||||||
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
|
end
|
||||||
end)
|
for _, gp in ipairs(Config.GamePasses) do
|
||||||
|
if gp.id == productId then
|
||||||
|
return gp, true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
MarketplaceService.ProcessReceipt = function(info)
|
MarketplaceService.ProcessReceipt = function(info)
|
||||||
local player = Players:GetPlayerByUserId(info.PlayerId)
|
local player = Players:GetPlayerByUserId(info.PlayerId)
|
||||||
@@ -1320,19 +1611,26 @@ MarketplaceService.ProcessReceipt = function(info)
|
|||||||
return Enum.ProductPurchaseDecision.PurchaseGranted
|
return Enum.ProductPurchaseDecision.PurchaseGranted
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local product
|
local product, isPass = findProduct(info.ProductId)
|
||||||
for _, p in ipairs(Config.Products) do
|
|
||||||
if p.id == info.ProductId then
|
|
||||||
product = p
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not product then
|
if not product then
|
||||||
|
warn("ProcessReceipt: неизвестный товар " .. tostring(info.ProductId))
|
||||||
return Enum.ProductPurchaseDecision.NotProcessedYet
|
return Enum.ProductPurchaseDecision.NotProcessedYet
|
||||||
end
|
end
|
||||||
|
data.robuxSpent += info.CurrencySpent or product.robux or 0
|
||||||
|
feed("buy", { name = player.DisplayName, userId = player.UserId, item = product.icon .. " " .. product.name })
|
||||||
|
if isPass then
|
||||||
|
data.passes[product.key] = true
|
||||||
|
passes[player] = passes[player] or {}
|
||||||
|
passes[player][product.key] = true
|
||||||
|
notify(player, "✅ " .. product.icon .. " " .. product.name .. " — навсегда!", GOLD)
|
||||||
|
if product.key == "VIP" then
|
||||||
|
vipTag(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
if product.coins then
|
if product.coins then
|
||||||
local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15))
|
local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15))
|
||||||
data.coins += coins
|
data.coins += coins
|
||||||
notify(player, ("Спасибо! +%d 💰"):format(coins), GOLD)
|
notify(player, ("Спасибо! +%d ⚪"):format(coins), GOLD)
|
||||||
end
|
end
|
||||||
if product.boost then
|
if product.boost then
|
||||||
applyPotion(data, product.boost, product.duration)
|
applyPotion(data, product.boost, product.duration)
|
||||||
@@ -1417,6 +1715,7 @@ local function finishBoss(won)
|
|||||||
if potion then
|
if potion then
|
||||||
applyPotion(data, potion.bonus, potion.duration)
|
applyPotion(data, potion.bonus, potion.duration)
|
||||||
end
|
end
|
||||||
|
Guild.onBossWin(p, data)
|
||||||
updateStats(p)
|
updateStats(p)
|
||||||
remote:FireClient(p, "BossReward", coins, xp, potion and potion.name)
|
remote:FireClient(p, "BossReward", coins, xp, potion and potion.name)
|
||||||
end
|
end
|
||||||
@@ -1471,10 +1770,13 @@ end)
|
|||||||
---------------------------------------------------------------- игроки
|
---------------------------------------------------------------- игроки
|
||||||
|
|
||||||
local function onPlayerAdded(player)
|
local function onPlayerAdded(player)
|
||||||
|
-- камеру нельзя отвести так далеко, чтобы заглянуть за скалы и край карты
|
||||||
|
player.CameraMinZoomDistance = Config.Camera.minZoom
|
||||||
|
player.CameraMaxZoomDistance = Config.Camera.maxZoom
|
||||||
local ls = Instance.new("Folder")
|
local ls = Instance.new("Folder")
|
||||||
ls.Name = "leaderstats"
|
ls.Name = "leaderstats"
|
||||||
ls.Parent = player
|
ls.Parent = player
|
||||||
for _, name in ipairs({ "Монеты", "Уровень", "Улов" }) do
|
for _, name in ipairs({ "Серебро", "Уровень", "Улов" }) do
|
||||||
local v = Instance.new("IntValue")
|
local v = Instance.new("IntValue")
|
||||||
v.Name = name
|
v.Name = name
|
||||||
v.Parent = ls
|
v.Parent = ls
|
||||||
@@ -1484,13 +1786,19 @@ local function onPlayerAdded(player)
|
|||||||
if not player.Parent then
|
if not player.Parent then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
loadPasses(player)
|
loadPasses(player, data)
|
||||||
ensureChain(data)
|
ensureChain(data)
|
||||||
|
Guild.defaults(data)
|
||||||
|
Guild.onJoin(player, data)
|
||||||
profiles[player] = data
|
profiles[player] = data
|
||||||
loadedOk[player] = ok
|
loadedOk[player] = ok
|
||||||
|
local settings = type(data.settings) == "table" and data.settings or {}
|
||||||
|
player:SetAttribute("VolMusic", tonumber(settings.music) or Config.DefaultVolume.music)
|
||||||
|
player:SetAttribute("VolSfx", tonumber(settings.sfx) or Config.DefaultVolume.sfx)
|
||||||
updateStats(player)
|
updateStats(player)
|
||||||
sendInventory(player)
|
sendInventory(player)
|
||||||
sendQuests(player)
|
sendQuests(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
|
||||||
local function onCharacter()
|
local function onCharacter()
|
||||||
stopFishing(player, false)
|
stopFishing(player, false)
|
||||||
@@ -1498,6 +1806,7 @@ local function onPlayerAdded(player)
|
|||||||
giveRodTool(player)
|
giveRodTool(player)
|
||||||
attachBag(player)
|
attachBag(player)
|
||||||
vipTag(player)
|
vipTag(player)
|
||||||
|
Guild.badge(player)
|
||||||
end
|
end
|
||||||
player.CharacterAdded:Connect(onCharacter)
|
player.CharacterAdded:Connect(onCharacter)
|
||||||
if player.Character then
|
if player.Character then
|
||||||
@@ -1513,6 +1822,10 @@ end
|
|||||||
Players.PlayerRemoving:Connect(function(player)
|
Players.PlayerRemoving:Connect(function(player)
|
||||||
stopFishing(player, false)
|
stopFishing(player, false)
|
||||||
combo[player], comboUntil[player] = nil, nil
|
combo[player], comboUntil[player] = nil, nil
|
||||||
|
autoFishing[player] = nil
|
||||||
|
if profiles[player] then
|
||||||
|
Guild.onLeave(profiles[player])
|
||||||
|
end
|
||||||
saveData(player)
|
saveData(player)
|
||||||
profiles[player] = nil
|
profiles[player] = nil
|
||||||
loadedOk[player] = nil
|
loadedOk[player] = nil
|
||||||
@@ -1521,21 +1834,42 @@ end)
|
|||||||
|
|
||||||
game:BindToClose(function()
|
game:BindToClose(function()
|
||||||
for _, p in ipairs(Players:GetPlayers()) do
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
|
if profiles[p] then
|
||||||
|
Guild.onLeave(profiles[p])
|
||||||
|
end
|
||||||
saveData(p)
|
saveData(p)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- погода и ночь меняют удачу: пересчитываем её у всех, когда они меняются
|
||||||
|
local function refreshAllStats()
|
||||||
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
|
updateStats(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
workspace:GetAttributeChangedSignal("Weather"):Connect(refreshAllStats)
|
||||||
|
|
||||||
-- таймер зелий + автосохранение
|
-- таймер зелий + автосохранение
|
||||||
task.spawn(function()
|
task.spawn(function()
|
||||||
local t = 0
|
local t = 0
|
||||||
|
local wasNight = isNight()
|
||||||
while true do
|
while true do
|
||||||
task.wait(1)
|
task.wait(1)
|
||||||
t += 1
|
t += 1
|
||||||
|
local night = isNight()
|
||||||
|
if night ~= wasNight then
|
||||||
|
wasNight = night
|
||||||
|
refreshAllStats()
|
||||||
|
end
|
||||||
for _, p in ipairs(Players:GetPlayers()) do
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
local data = profiles[p]
|
local data = profiles[p]
|
||||||
if data and data.boostUntil > os.time() - 2 then
|
if data and data.boostUntil > os.time() - 2 then
|
||||||
updateStats(p)
|
updateStats(p)
|
||||||
end
|
end
|
||||||
|
-- бонус отдыха тратится, пока игрок рыбачит
|
||||||
|
if data and (fishing[p] or autoFishing[p]) then
|
||||||
|
Guild.spendRest(p, data, 1)
|
||||||
|
end
|
||||||
-- серия сгорает, если долго нет улова (пока рыба на крючке — ждём)
|
-- серия сгорает, если долго нет улова (пока рыба на крючке — ждём)
|
||||||
if comboUntil[p] and os.time() > comboUntil[p] and not fishing[p] then
|
if comboUntil[p] and os.time() > comboUntil[p] and not fishing[p] then
|
||||||
breakCombo(p)
|
breakCombo(p)
|
||||||
|
|||||||
@@ -0,0 +1,838 @@
|
|||||||
|
-- Guild (ModuleScript) -> ServerScriptService
|
||||||
|
-- Гильдия рыбаков: ранги F–S, печати и жемчуг, испытания у Старейшины, личные заказы на доске,
|
||||||
|
-- наживка, ловушки-вентери, бонус отдыха и жетон ранга над головой.
|
||||||
|
-- Данные игрока хранит GameServer (profiles); он же вызывает отсюда хуки (улов, вход, статы).
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
|
||||||
|
local Guild = {}
|
||||||
|
local api -- функции GameServer: profiles, notify, updateStats, addXp, sendInventory, bagCapacity, isNight, weather, remote
|
||||||
|
local RANKS = Config.Guild.ranks
|
||||||
|
local GOLD = Color3.fromRGB(255, 214, 120)
|
||||||
|
local RED = Color3.fromRGB(255, 120, 120)
|
||||||
|
local GREEN = Color3.fromRGB(150, 230, 130)
|
||||||
|
|
||||||
|
function Guild.init(a)
|
||||||
|
api = a
|
||||||
|
-- только в Studio: проверки из командной строки/MCP (ServerStorage.GuildDebug:Invoke("get", player, "seals"))
|
||||||
|
if game:GetService("RunService"):IsStudio() then
|
||||||
|
local f = Instance.new("BindableFunction")
|
||||||
|
f.Name = "GuildDebug"
|
||||||
|
f.OnInvoke = function(op, player, key, value, extra)
|
||||||
|
local data = api.profiles[player]
|
||||||
|
if not data then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if op == "get" then
|
||||||
|
return data[key]
|
||||||
|
elseif op == "set" then
|
||||||
|
data[key] = value
|
||||||
|
api.updateStats(player)
|
||||||
|
elseif op == "addItem" then
|
||||||
|
key.uid = data.nextUid
|
||||||
|
data.nextUid += 1
|
||||||
|
table.insert(data.items, key)
|
||||||
|
api.sendInventory(player)
|
||||||
|
api.updateStats(player)
|
||||||
|
elseif op == "action" then
|
||||||
|
Guild.onAction(player, key, value, extra)
|
||||||
|
elseif op == "orders" then
|
||||||
|
Guild.refreshOrders(data, player)
|
||||||
|
return data.orders.list
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
f.Parent = game:GetService("ServerStorage")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- данные
|
||||||
|
|
||||||
|
-- новые поля (старые сохранения грузятся: чего нет — дополняем)
|
||||||
|
function Guild.defaults(data)
|
||||||
|
data.pearls = data.pearls or 0
|
||||||
|
data.seals = data.seals or 0
|
||||||
|
data.trial = data.trial -- { rank = номер ранга, progress = n } или nil
|
||||||
|
if type(data.orders) ~= "table" then
|
||||||
|
data.orders = { window = -1, list = {} }
|
||||||
|
end
|
||||||
|
if type(data.bait) ~= "table" then
|
||||||
|
data.bait = { equipped = nil, counts = {} }
|
||||||
|
end
|
||||||
|
data.bait.counts = data.bait.counts or {}
|
||||||
|
if type(data.traps) ~= "table" then
|
||||||
|
data.traps = {}
|
||||||
|
end
|
||||||
|
data.rest = data.rest or 0
|
||||||
|
if not data.rank then
|
||||||
|
-- сохранение до гильдии: кто уже дошёл до дальних миров, сохраняет к ним доступ
|
||||||
|
local lvl = data.level or 1
|
||||||
|
data.rank = (lvl >= 18 and 5) or (lvl >= 8 and 3) or 1
|
||||||
|
if data.rank > 1 then
|
||||||
|
data.seals = math.max(data.seals, RANKS[data.rank].seals)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- данные игрока (для проверок из Studio)
|
||||||
|
function Guild.profile(player)
|
||||||
|
return api.profiles[player]
|
||||||
|
end
|
||||||
|
|
||||||
|
function Guild.rank(data)
|
||||||
|
return RANKS[math.clamp(data.rank or 1, 1, #RANKS)], data.rank or 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local function nearSpot(player, attr)
|
||||||
|
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
local map = workspace:FindFirstChild("FishingMap")
|
||||||
|
if not hrp or not map then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
for _, d in ipairs(map:GetDescendants()) do
|
||||||
|
if d:IsA("BasePart") and d:GetAttribute(attr) then
|
||||||
|
if (d.Position - hrp.Position).Magnitude <= Config.Guild.elderDistance then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- жетон ранга над головой
|
||||||
|
|
||||||
|
function Guild.badge(player)
|
||||||
|
local data = api.profiles[player]
|
||||||
|
local head = player.Character and player.Character:FindFirstChild("Head")
|
||||||
|
if not data or not head then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local r = Guild.rank(data)
|
||||||
|
local bb = head:FindFirstChild("RankBadge")
|
||||||
|
if not bb then
|
||||||
|
bb = Instance.new("BillboardGui")
|
||||||
|
bb.Name = "RankBadge"
|
||||||
|
bb.Size = UDim2.fromOffset(46, 52)
|
||||||
|
bb.StudsOffset = Vector3.new(0, 2.4, 0)
|
||||||
|
bb.MaxDistance = 70
|
||||||
|
bb.LightInfluence = 0
|
||||||
|
bb.Parent = head
|
||||||
|
-- щит: ромб с золотой каймой и буквой
|
||||||
|
local shield = Instance.new("Frame")
|
||||||
|
shield.Name = "Shield"
|
||||||
|
shield.Size = UDim2.fromOffset(34, 34)
|
||||||
|
shield.AnchorPoint = Vector2.new(0.5, 0.5)
|
||||||
|
shield.Position = UDim2.fromScale(0.5, 0.5)
|
||||||
|
shield.Rotation = 45
|
||||||
|
shield.Parent = bb
|
||||||
|
local c = Instance.new("UICorner")
|
||||||
|
c.CornerRadius = UDim.new(0, 6)
|
||||||
|
c.Parent = shield
|
||||||
|
local s = Instance.new("UIStroke")
|
||||||
|
s.Color = Color3.fromRGB(218, 172, 92)
|
||||||
|
s.Thickness = 3
|
||||||
|
s.Parent = shield
|
||||||
|
local g = Instance.new("UIGradient")
|
||||||
|
g.Color = ColorSequence.new(Color3.new(1, 1, 1), Color3.fromRGB(150, 150, 150))
|
||||||
|
g.Rotation = 45
|
||||||
|
g.Parent = shield
|
||||||
|
local t = Instance.new("TextLabel")
|
||||||
|
t.Name = "Letter"
|
||||||
|
t.Size = UDim2.fromScale(1, 1)
|
||||||
|
t.BackgroundTransparency = 1
|
||||||
|
t.FontFace = Font.new("rbxasset://fonts/families/Merriweather.json", Enum.FontWeight.Heavy)
|
||||||
|
t.TextScaled = true
|
||||||
|
t.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
t.TextStrokeTransparency = 0.2
|
||||||
|
t.TextStrokeColor3 = Color3.fromRGB(40, 28, 20)
|
||||||
|
t.ZIndex = 2
|
||||||
|
t.Parent = bb
|
||||||
|
end
|
||||||
|
bb.Shield.BackgroundColor3 = r.color
|
||||||
|
bb.Shield.UIGradient.Color = r.id == "S"
|
||||||
|
and ColorSequence.new({
|
||||||
|
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 120, 120)), ColorSequenceKeypoint.new(0.35, Color3.fromRGB(255, 230, 120)),
|
||||||
|
ColorSequenceKeypoint.new(0.7, Color3.fromRGB(120, 230, 255)), ColorSequenceKeypoint.new(1, Color3.fromRGB(220, 130, 255)),
|
||||||
|
})
|
||||||
|
or ColorSequence.new(Color3.new(1, 1, 1), Color3.fromRGB(150, 150, 150))
|
||||||
|
bb.Shield.UIStroke.Color = (r.id == "S" or r.id == "A") and Color3.fromRGB(255, 225, 130) or Color3.fromRGB(218, 172, 92)
|
||||||
|
bb.Letter.Text = r.id
|
||||||
|
-- корона VIP — над жетоном
|
||||||
|
local vip = head:FindFirstChild("VipTag")
|
||||||
|
if vip then
|
||||||
|
vip.StudsOffset = Vector3.new(0, 4, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- состояние для клиента
|
||||||
|
|
||||||
|
local function orderText(o)
|
||||||
|
local f = o.fish and Config.FindFish(o.fish)
|
||||||
|
if o.kind == "deliver" then
|
||||||
|
return ("Сдай %d × %s"):format(o.count, f and f.name or "?")
|
||||||
|
elseif o.kind == "heavy" then
|
||||||
|
return ("Принеси %s тяжелее %.1f кг"):format(f and f.name or "?", o.minW)
|
||||||
|
elseif o.kind == "weather" then
|
||||||
|
return ("Поймай %d рыб в дождь или грозу"):format(o.count)
|
||||||
|
elseif o.kind == "night" then
|
||||||
|
return ("Поймай %d «Необычных» или реже ночью"):format(o.count)
|
||||||
|
elseif o.kind == "combo" then
|
||||||
|
return ("Набери серию из %d рыб"):format(o.count)
|
||||||
|
elseif o.kind == "perfect" then
|
||||||
|
return ("Сделай %d забросов в зелёную зону"):format(o.count)
|
||||||
|
end
|
||||||
|
return o.kind
|
||||||
|
end
|
||||||
|
Guild.orderText = orderText
|
||||||
|
|
||||||
|
local function trialState(data)
|
||||||
|
local nextRank = RANKS[(data.rank or 1) + 1]
|
||||||
|
if not nextRank then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local active = data.trial and data.trial.rank == data.rank + 1
|
||||||
|
local t = nextRank.trial
|
||||||
|
local goal = t.count or 1
|
||||||
|
local progress = active and data.trial.progress or 0
|
||||||
|
if t.kind == "dex" then
|
||||||
|
local zone = Config.Zones[t.world]
|
||||||
|
goal, progress = #zone.fish, 0
|
||||||
|
for _, f in ipairs(zone.fish) do
|
||||||
|
if data.discovered[f.id] then
|
||||||
|
progress += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
rank = data.rank + 1, text = t.text, active = active, progress = progress, goal = goal,
|
||||||
|
ready = data.seals >= nextRank.seals,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function Guild.sendState(player)
|
||||||
|
local data = api.profiles[player]
|
||||||
|
if not data then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
Guild.refreshOrders(data, player)
|
||||||
|
local list = {}
|
||||||
|
for i, o in ipairs(data.orders.list) do
|
||||||
|
list[i] = {
|
||||||
|
kind = o.kind, text = orderText(o), progress = o.progress, count = o.count, done = o.done,
|
||||||
|
seals = o.seals, coins = o.coins, pearls = o.pearls, deliver = (o.kind == "deliver" or o.kind == "heavy"),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
local now = os.time()
|
||||||
|
local traps = {}
|
||||||
|
for i, t0 in ipairs(data.traps) do
|
||||||
|
traps[i] = math.min(Config.Traps.max, math.floor((now - t0) / Config.Traps.every))
|
||||||
|
end
|
||||||
|
api.remote:FireClient(player, "Guild", {
|
||||||
|
trial = trialState(data),
|
||||||
|
orders = list,
|
||||||
|
ordersEnd = (data.orders.window + 1) * Config.Orders.period,
|
||||||
|
traps = traps, trapSlots = Guild.rank(data).traps or 0, trapEvery = Config.Traps.every, trapMax = Config.Traps.max,
|
||||||
|
baits = data.bait.counts, bait = data.bait.equipped,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- атрибуты игрока (HUD и окна читают их)
|
||||||
|
function Guild.attrs(player, data)
|
||||||
|
local r, idx = Guild.rank(data)
|
||||||
|
player:SetAttribute("Pearls", data.pearls)
|
||||||
|
player:SetAttribute("Seals", data.seals)
|
||||||
|
player:SetAttribute("GuildRank", r.id)
|
||||||
|
player:SetAttribute("RankIdx", idx)
|
||||||
|
local nextRank = RANKS[idx + 1]
|
||||||
|
player:SetAttribute("SealsNext", nextRank and nextRank.seals or nil)
|
||||||
|
player:SetAttribute("RestLeft", math.floor(data.rest))
|
||||||
|
player:SetAttribute("Bait", data.bait.equipped)
|
||||||
|
player:SetAttribute("BaitCount", data.bait.equipped and (data.bait.counts[data.bait.equipped] or 0) or 0)
|
||||||
|
local ready = 0
|
||||||
|
for _, t0 in ipairs(data.traps) do
|
||||||
|
ready += math.min(Config.Traps.max, math.floor((os.time() - t0) / Config.Traps.every))
|
||||||
|
end
|
||||||
|
player:SetAttribute("TrapFish", ready)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- ранги и испытания
|
||||||
|
|
||||||
|
local function rankUp(player, data)
|
||||||
|
data.rank += 1
|
||||||
|
data.trial = nil
|
||||||
|
data.pearls += Config.Pearls.rankUp
|
||||||
|
local r = RANKS[data.rank]
|
||||||
|
-- новые ловушки начинают копить с этого момента
|
||||||
|
while #data.traps < (r.traps or 0) do
|
||||||
|
table.insert(data.traps, os.time())
|
||||||
|
end
|
||||||
|
api.remote:FireClient(player, "RankUp", r.id, r.name, r.unlocks, Config.Pearls.rankUp)
|
||||||
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
|
api.notify(p, ("⚔ %s получил ранг %s — «%s»!"):format(player.DisplayName, r.id, r.name), GOLD)
|
||||||
|
end
|
||||||
|
Guild.badge(player)
|
||||||
|
api.updateStats(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function trialProgress(player, data, amount)
|
||||||
|
local st = data.trial
|
||||||
|
local nextRank = RANKS[data.rank + 1]
|
||||||
|
if not st or not nextRank or st.rank ~= data.rank + 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
st.progress = (st.progress or 0) + amount
|
||||||
|
if st.progress >= (nextRank.trial.count or 1) then
|
||||||
|
rankUp(player, data)
|
||||||
|
else
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function checkDexTrial(player, data)
|
||||||
|
local st = data.trial
|
||||||
|
local nextRank = RANKS[data.rank + 1]
|
||||||
|
if st and nextRank and st.rank == data.rank + 1 and nextRank.trial.kind == "dex" then
|
||||||
|
local s = trialState(data)
|
||||||
|
if s.progress >= s.goal then
|
||||||
|
rankUp(player, data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function takeTrial(player, data)
|
||||||
|
local nextRank = RANKS[data.rank + 1]
|
||||||
|
if not nextRank then
|
||||||
|
api.notify(player, "👑 Ты уже Легенда гильдии!", GOLD)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if data.seals < nextRank.seals then
|
||||||
|
api.notify(player, ("📜 Нужно %d печатей (у тебя %d)"):format(nextRank.seals, data.seals), RED)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not nearSpot(player, "GuildElder") then
|
||||||
|
api.notify(player, "⚔ Испытание выдаёт " .. Config.Guild.elder .. " — он в здании гильдии в лобби", Color3.fromRGB(255, 200, 120))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local t = nextRank.trial
|
||||||
|
if t.kind == "deliver" then
|
||||||
|
-- сдать рыбу из сумки сразу, если она есть
|
||||||
|
local have, keep = 0, {}
|
||||||
|
for _, item in ipairs(data.items) do
|
||||||
|
if item.id == t.fish and have < t.count then
|
||||||
|
have += 1
|
||||||
|
else
|
||||||
|
table.insert(keep, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if have < t.count then
|
||||||
|
local f = Config.FindFish(t.fish)
|
||||||
|
api.notify(player, ("🐟 Принеси %d × %s (в сумке %d)"):format(t.count, f and f.name or t.fish, have), RED)
|
||||||
|
data.trial = { rank = data.rank + 1, progress = 0 }
|
||||||
|
Guild.sendState(player)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
data.items = keep
|
||||||
|
api.sendInventory(player)
|
||||||
|
data.trial = { rank = data.rank + 1, progress = 0 }
|
||||||
|
trialProgress(player, data, t.count)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not (data.trial and data.trial.rank == data.rank + 1) then
|
||||||
|
data.trial = { rank = data.rank + 1, progress = 0 }
|
||||||
|
api.notify(player, "⚔ Испытание принято: " .. t.text, GOLD)
|
||||||
|
end
|
||||||
|
if t.kind == "dex" then
|
||||||
|
checkDexTrial(player, data)
|
||||||
|
end
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- заказы
|
||||||
|
|
||||||
|
local function pick(rng, weights)
|
||||||
|
local total = 0
|
||||||
|
for _, w in pairs(weights) do
|
||||||
|
total += w
|
||||||
|
end
|
||||||
|
local roll = rng:NextNumber() * total
|
||||||
|
for k, w in pairs(weights) do
|
||||||
|
roll -= w
|
||||||
|
if roll <= 0 then
|
||||||
|
return k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return next(weights)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- рыба для заказов: из миров, куда игрок уже может попасть
|
||||||
|
local function fishPool(data, rarities)
|
||||||
|
local pool = {}
|
||||||
|
for _, w in ipairs(Config.Worlds) do
|
||||||
|
local zone = Config.Zones[w.id]
|
||||||
|
local needRank = Config.Guild.worldRank[w.id] or 1
|
||||||
|
if zone and not w.soon and data.level >= w.level and data.rank >= needRank then
|
||||||
|
for _, f in ipairs(zone.fish) do
|
||||||
|
if rarities[f.rarity] then
|
||||||
|
table.insert(pool, f)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return pool
|
||||||
|
end
|
||||||
|
|
||||||
|
local function makeOrder(data, rng)
|
||||||
|
local O = Config.Orders
|
||||||
|
local weights = {}
|
||||||
|
for k, v in pairs(O.kinds) do
|
||||||
|
weights[k] = v.weight
|
||||||
|
end
|
||||||
|
-- порядок ключей в pairs не задан: сортируем, чтобы при одном зерне выпадало одно и то же
|
||||||
|
local kind
|
||||||
|
do
|
||||||
|
local keys = {}
|
||||||
|
for k in pairs(weights) do
|
||||||
|
table.insert(keys, k)
|
||||||
|
end
|
||||||
|
table.sort(keys)
|
||||||
|
local total = 0
|
||||||
|
for _, k in ipairs(keys) do
|
||||||
|
total += weights[k]
|
||||||
|
end
|
||||||
|
local roll = rng:NextNumber() * total
|
||||||
|
for _, k in ipairs(keys) do
|
||||||
|
roll -= weights[k]
|
||||||
|
if roll <= 0 then
|
||||||
|
kind = k
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
kind = kind or keys[1]
|
||||||
|
end
|
||||||
|
local r = data.rank or 1
|
||||||
|
local hard = rng:NextNumber() -- сложность заказа 0..1
|
||||||
|
local o = { kind = kind, progress = 0, done = false }
|
||||||
|
if kind == "deliver" then
|
||||||
|
local pool = fishPool(data, r >= 3 and { Common = true, Uncommon = true, Rare = true } or { Common = true, Uncommon = true })
|
||||||
|
local f = pool[rng:NextInteger(1, #pool)]
|
||||||
|
local rank = Config.Rarities[f.rarity].rank
|
||||||
|
o.fish = f.id
|
||||||
|
o.count = math.max(1, math.floor((rank == 1 and 5 or (rank == 2 and 3 or 1)) * (0.7 + hard * 0.8) + 0.5))
|
||||||
|
elseif kind == "heavy" then
|
||||||
|
local pool = fishPool(data, { Uncommon = true, Rare = true })
|
||||||
|
local f = pool[rng:NextInteger(1, #pool)]
|
||||||
|
o.fish = f.id
|
||||||
|
o.count = 1
|
||||||
|
o.minW = math.floor((f.minW + (f.maxW - f.minW) * (0.25 + hard * 0.3)) * 10) / 10
|
||||||
|
elseif kind == "weather" then
|
||||||
|
o.count = 2 + math.floor(hard * 3) + r
|
||||||
|
elseif kind == "night" then
|
||||||
|
o.count = 1 + math.floor(hard * 2) + math.floor(r / 2)
|
||||||
|
elseif kind == "combo" then
|
||||||
|
o.count = math.min(15, 4 + math.floor(hard * 4) + r)
|
||||||
|
elseif kind == "perfect" then
|
||||||
|
o.count = 3 + math.floor(hard * 4) + r
|
||||||
|
end
|
||||||
|
local s = O.kinds[kind].seals
|
||||||
|
o.seals = math.floor(s[1] + (s[2] - s[1]) * hard + 0.5) + (r - 1) * 2
|
||||||
|
o.coins = math.floor(o.seals * O.coinsPerSeal * (1 + 0.5 * (r - 1)))
|
||||||
|
o.pearls = rng:NextNumber() < O.pearlChance and rng:NextInteger(O.pearlsMin, O.pearlsMax) or 0
|
||||||
|
return o
|
||||||
|
end
|
||||||
|
|
||||||
|
-- новое окно (каждые 3 часа) — новые заказы; на ранге E и выше их 4
|
||||||
|
function Guild.refreshOrders(data, player)
|
||||||
|
local window = math.floor(os.time() / Config.Orders.period)
|
||||||
|
local want = Guild.rank(data).orders
|
||||||
|
if data.orders.window ~= window then
|
||||||
|
local seed = ((player and player.UserId or 0) % 100000) * 7919 + window
|
||||||
|
local rng = Random.new(seed)
|
||||||
|
data.orders = { window = window, list = {} }
|
||||||
|
local seen = {}
|
||||||
|
for i = 1, want do
|
||||||
|
-- без повторов: один и тот же тип с той же рыбой не выпадает дважды
|
||||||
|
local o
|
||||||
|
for _ = 1, 6 do
|
||||||
|
o = makeOrder(data, rng)
|
||||||
|
if not seen[o.kind .. (o.fish or "")] then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
seen[o.kind .. (o.fish or "")] = true
|
||||||
|
data.orders.list[i] = o
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- ранг вырос посреди окна: добавляем недостающий заказ
|
||||||
|
local seen = {}
|
||||||
|
for _, o in ipairs(data.orders.list) do
|
||||||
|
seen[o.kind .. (o.fish or "")] = true
|
||||||
|
end
|
||||||
|
while #data.orders.list < want do
|
||||||
|
local o
|
||||||
|
for _ = 1, 6 do
|
||||||
|
o = makeOrder(data, Random.new())
|
||||||
|
if not seen[o.kind .. (o.fish or "")] then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
seen[o.kind .. (o.fish or "")] = true
|
||||||
|
table.insert(data.orders.list, o)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function finishOrder(player, data, o)
|
||||||
|
o.done = true
|
||||||
|
data.seals += o.seals
|
||||||
|
data.coins += o.coins
|
||||||
|
data.pearls += o.pearls
|
||||||
|
api.notify(player, ("📜 Заказ выполнен! +%d печатей +%d ⚪%s"):format(o.seals, o.coins, o.pearls > 0 and (" +" .. o.pearls .. " 🦪") or ""), GOLD)
|
||||||
|
api.remote:FireClient(player, "OrderDone")
|
||||||
|
local nextRank = RANKS[data.rank + 1]
|
||||||
|
if nextRank and data.seals >= nextRank.seals and data.seals - o.seals < nextRank.seals then
|
||||||
|
api.notify(player, ("⚔ Печатей хватает на ранг %s! Иди к Старейшине за испытанием"):format(nextRank.id), GOLD)
|
||||||
|
end
|
||||||
|
api.updateStats(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function deliverOrder(player, data, i)
|
||||||
|
Guild.refreshOrders(data, player)
|
||||||
|
local o = data.orders.list[i]
|
||||||
|
if not o or o.done or (o.kind ~= "deliver" and o.kind ~= "heavy") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not nearSpot(player, "OrderBoard") then
|
||||||
|
api.notify(player, "📜 Рыбу сдают у доски заказов в здании гильдии", Color3.fromRGB(255, 200, 120))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local need = o.count - o.progress
|
||||||
|
local keep = {}
|
||||||
|
-- сдаём сначала самую дешёвую подходящую рыбу
|
||||||
|
local fit = {}
|
||||||
|
for _, item in ipairs(data.items) do
|
||||||
|
if item.id == o.fish and (not o.minW or item.weight >= o.minW) then
|
||||||
|
table.insert(fit, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(fit, function(a, b)
|
||||||
|
return a.value < b.value
|
||||||
|
end)
|
||||||
|
local take = {}
|
||||||
|
for k = 1, math.min(need, #fit) do
|
||||||
|
take[fit[k].uid] = true
|
||||||
|
end
|
||||||
|
local given = 0
|
||||||
|
for _, item in ipairs(data.items) do
|
||||||
|
if take[item.uid] then
|
||||||
|
given += 1
|
||||||
|
else
|
||||||
|
table.insert(keep, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if given == 0 then
|
||||||
|
local f = Config.FindFish(o.fish)
|
||||||
|
api.notify(player, ("🎒 В сумке нет подходящей рыбы: %s"):format(f and f.name or o.fish), RED)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
data.items = keep
|
||||||
|
o.progress += given
|
||||||
|
api.sendInventory(player)
|
||||||
|
if o.progress >= o.count then
|
||||||
|
finishOrder(player, data, o)
|
||||||
|
else
|
||||||
|
api.updateStats(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function rerollOrder(player, data, i)
|
||||||
|
Guild.refreshOrders(data, player)
|
||||||
|
local o = data.orders.list[i]
|
||||||
|
if not o or o.done then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local cost = Config.Orders.rerollPearls
|
||||||
|
if data.pearls < cost then
|
||||||
|
api.notify(player, ("🦪 Нужно %d жемчуга"):format(cost), RED)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
data.pearls -= cost
|
||||||
|
data.orders.list[i] = makeOrder(data, Random.new())
|
||||||
|
api.updateStats(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- улов: заказы, испытания, жемчуг
|
||||||
|
|
||||||
|
-- ctx: { weather = id, night = bool, perfect = bool (заброс в зелёную зону), streak = n, auto = bool }
|
||||||
|
function Guild.onCatch(player, data, fish, ctx)
|
||||||
|
local rank = Config.Rarities[fish.rarity].rank
|
||||||
|
-- жемчуг за мутацию
|
||||||
|
local pearls = fish.mutation and Config.Pearls.mutation[fish.mutation] or 0
|
||||||
|
if pearls > 0 then
|
||||||
|
data.pearls += pearls
|
||||||
|
api.notify(player, ("🦪 +%d жемчуга за мутацию!"):format(pearls), Color3.fromRGB(235, 225, 245))
|
||||||
|
end
|
||||||
|
local rainy = ctx.weather == "Rain" or ctx.weather == "Storm"
|
||||||
|
-- заказы «по ходу»
|
||||||
|
Guild.refreshOrders(data, player)
|
||||||
|
local changed = false
|
||||||
|
for _, o in ipairs(data.orders.list) do
|
||||||
|
if not o.done then
|
||||||
|
local add = 0
|
||||||
|
if o.kind == "weather" and rainy then
|
||||||
|
add = 1
|
||||||
|
elseif o.kind == "night" and ctx.night and rank >= 2 then
|
||||||
|
add = 1
|
||||||
|
elseif o.kind == "perfect" and ctx.perfect then
|
||||||
|
add = 1
|
||||||
|
elseif o.kind == "combo" and (ctx.streak or 0) > o.progress then
|
||||||
|
o.progress = math.min(o.count, ctx.streak)
|
||||||
|
changed = true
|
||||||
|
if o.progress >= o.count then
|
||||||
|
finishOrder(player, data, o)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if add > 0 then
|
||||||
|
o.progress = math.min(o.count, o.progress + add)
|
||||||
|
changed = true
|
||||||
|
if o.progress >= o.count then
|
||||||
|
finishOrder(player, data, o)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- испытание
|
||||||
|
local nextRank = RANKS[data.rank + 1]
|
||||||
|
if data.trial and nextRank and data.trial.rank == data.rank + 1 then
|
||||||
|
local t = nextRank.trial
|
||||||
|
if t.kind == "catch" and rank >= (t.minRank or 1)
|
||||||
|
and (not t.weathers or t.weathers[ctx.weather])
|
||||||
|
and (not t.night or ctx.night) then
|
||||||
|
trialProgress(player, data, 1)
|
||||||
|
elseif t.kind == "dex" then
|
||||||
|
checkDexTrial(player, data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if changed or pearls > 0 then
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- победа над боссом: испытание ранга C и жемчуг
|
||||||
|
function Guild.onBossWin(player, data)
|
||||||
|
data.pearls += Config.Pearls.boss
|
||||||
|
api.notify(player, ("🦪 +%d жемчуга за босса!"):format(Config.Pearls.boss), Color3.fromRGB(235, 225, 245))
|
||||||
|
local nextRank = RANKS[data.rank + 1]
|
||||||
|
if data.trial and nextRank and data.trial.rank == data.rank + 1 and nextRank.trial.kind == "bossWin" then
|
||||||
|
trialProgress(player, data, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- миры, скидки
|
||||||
|
|
||||||
|
function Guild.canEnter(data, worldId)
|
||||||
|
local need = Config.Guild.worldRank[worldId]
|
||||||
|
if need and (data.rank or 1) < need then
|
||||||
|
return false, ("🔒 Нужен ранг гильдии %s"):format(RANKS[need].id)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function Guild.price(data, price)
|
||||||
|
local d = Guild.rank(data).discount or 0
|
||||||
|
return math.floor(price * (1 - d) + 0.5)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- наживка
|
||||||
|
|
||||||
|
function Guild.bait(data)
|
||||||
|
local id = data.bait.equipped
|
||||||
|
if id and (data.bait.counts[id] or 0) > 0 then
|
||||||
|
return Config.Find(Config.Baits, id)
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- тратим 1 штуку на заброс; кончилась — слот пустеет
|
||||||
|
function Guild.useBait(player, data)
|
||||||
|
local b = Guild.bait(data)
|
||||||
|
if not b then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
data.bait.counts[b.id] -= 1
|
||||||
|
if data.bait.counts[b.id] <= 0 then
|
||||||
|
data.bait.counts[b.id] = nil
|
||||||
|
data.bait.equipped = nil
|
||||||
|
api.notify(player, b.icon .. " " .. b.name .. " закончился", Color3.fromRGB(255, 200, 120))
|
||||||
|
end
|
||||||
|
player:SetAttribute("BaitCount", data.bait.equipped and (data.bait.counts[data.bait.equipped] or 0) or 0)
|
||||||
|
player:SetAttribute("Bait", data.bait.equipped)
|
||||||
|
return b
|
||||||
|
end
|
||||||
|
|
||||||
|
local function buyBait(player, data, id)
|
||||||
|
local b = Config.Find(Config.Baits, id)
|
||||||
|
if not b then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if b.rank and data.rank < b.rank then
|
||||||
|
api.notify(player, ("🔒 Нужен ранг гильдии %s"):format(RANKS[b.rank].id), RED)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if b.currency == "pearls" then
|
||||||
|
if data.pearls < b.price then
|
||||||
|
api.notify(player, ("Нужно %d 🦪"):format(b.price), RED)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
data.pearls -= b.price
|
||||||
|
else
|
||||||
|
local price = Guild.price(data, b.price)
|
||||||
|
if data.coins < price then
|
||||||
|
api.notify(player, ("Нужно %d ⚪"):format(price), RED)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
data.coins -= price
|
||||||
|
end
|
||||||
|
data.bait.counts[b.id] = (data.bait.counts[b.id] or 0) + b.pack
|
||||||
|
if not Guild.bait(data) then
|
||||||
|
data.bait.equipped = b.id
|
||||||
|
end
|
||||||
|
api.notify(player, ("%s +%d × %s"):format(b.icon, b.pack, b.name), GREEN)
|
||||||
|
api.updateStats(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function equipBait(player, data, id)
|
||||||
|
if id == nil or id == "" then
|
||||||
|
data.bait.equipped = nil
|
||||||
|
elseif (data.bait.counts[id] or 0) > 0 then
|
||||||
|
data.bait.equipped = id
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
api.updateStats(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- ловушки
|
||||||
|
|
||||||
|
local function rollTrapFish(rng)
|
||||||
|
local T = Config.Traps
|
||||||
|
local rarity = pick(rng, T.rarities)
|
||||||
|
local pool = {}
|
||||||
|
for _, f in ipairs(Config.Zones[T.world].fish) do
|
||||||
|
if f.rarity == rarity then
|
||||||
|
table.insert(pool, f)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local f = pool[rng:NextInteger(1, #pool)]
|
||||||
|
local wf = rng:NextNumber() ^ 2.2
|
||||||
|
return {
|
||||||
|
id = f.id, name = f.name, rarity = f.rarity,
|
||||||
|
weight = math.floor((f.minW + (f.maxW - f.minW) * wf) * 100) / 100,
|
||||||
|
value = math.floor(f.price * (0.75 + 0.9 * wf) + 0.5),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function collectTraps(player, data)
|
||||||
|
local T = Config.Traps
|
||||||
|
local now = os.time()
|
||||||
|
local cap = api.bagCapacity(player, data)
|
||||||
|
local rng = Random.new()
|
||||||
|
local got = 0
|
||||||
|
for i, t0 in ipairs(data.traps) do
|
||||||
|
local ready = math.min(T.max, math.floor((now - t0) / T.every))
|
||||||
|
local take = math.min(ready, cap - #data.items)
|
||||||
|
for _ = 1, take do
|
||||||
|
local f = rollTrapFish(rng)
|
||||||
|
f.uid = data.nextUid
|
||||||
|
data.nextUid += 1
|
||||||
|
table.insert(data.items, f)
|
||||||
|
local rec = data.discovered[f.id]
|
||||||
|
if not rec then
|
||||||
|
data.discovered[f.id] = { count = 1, best = f.weight }
|
||||||
|
else
|
||||||
|
rec.count += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
got += take
|
||||||
|
-- что не влезло, остаётся в ловушке; полная ловушка дальше не копит
|
||||||
|
local left = ready - take
|
||||||
|
data.traps[i] = now - left * T.every
|
||||||
|
end
|
||||||
|
if got == 0 then
|
||||||
|
api.notify(player, #data.traps == 0 and "🧺 Ловушки — с ранга D" or ((#data.items >= cap) and "🎒 Сумка полна!" or "🧺 В ловушках пока пусто"), Color3.fromRGB(255, 200, 120))
|
||||||
|
else
|
||||||
|
data.totalCaught += got
|
||||||
|
api.notify(player, ("🧺 Из ловушек: +%d рыб"):format(got), GREEN)
|
||||||
|
api.sendInventory(player)
|
||||||
|
end
|
||||||
|
api.updateStats(player)
|
||||||
|
Guild.sendState(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- отдых
|
||||||
|
|
||||||
|
function Guild.onJoin(player, data)
|
||||||
|
local last = data.lastOnline
|
||||||
|
if last and last > 0 then
|
||||||
|
local away = os.time() - last
|
||||||
|
data.rest = math.min(Config.Rest.max, (data.rest or 0) + away / Config.Rest.perOffline)
|
||||||
|
end
|
||||||
|
-- ловушки по рангу (старые сохранения, ранг выдан миграцией)
|
||||||
|
while #data.traps < (Guild.rank(data).traps or 0) do
|
||||||
|
table.insert(data.traps, os.time())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Guild.onLeave(data)
|
||||||
|
data.lastOnline = os.time()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- множитель опыта: двойной, пока есть отдых
|
||||||
|
function Guild.xpMult(data)
|
||||||
|
return (data.rest or 0) > 0 and Config.Rest.mult or 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- отдых тратится секундами, пока игрок рыбачит
|
||||||
|
function Guild.spendRest(player, data, seconds)
|
||||||
|
if (data.rest or 0) > 0 then
|
||||||
|
data.rest = math.max(0, data.rest - seconds)
|
||||||
|
player:SetAttribute("RestLeft", math.floor(data.rest))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- события от клиента
|
||||||
|
|
||||||
|
function Guild.onAction(player, action, a, b)
|
||||||
|
local data = api.profiles[player]
|
||||||
|
if not data then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if action == "GuildState" then
|
||||||
|
Guild.sendState(player)
|
||||||
|
elseif action == "TakeTrial" then
|
||||||
|
takeTrial(player, data)
|
||||||
|
elseif action == "DeliverOrder" then
|
||||||
|
deliverOrder(player, data, tonumber(a))
|
||||||
|
elseif action == "RerollOrder" then
|
||||||
|
rerollOrder(player, data, tonumber(a))
|
||||||
|
elseif action == "BuyBait" then
|
||||||
|
buyBait(player, data, a)
|
||||||
|
elseif action == "EquipBait" then
|
||||||
|
equipBait(player, data, a)
|
||||||
|
elseif action == "CollectTraps" then
|
||||||
|
collectTraps(player, data)
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return Guild
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
-- Leaderboards (Script) -> ServerScriptService
|
||||||
|
-- Доски лидеров в лобби: топ донатеров, по заработку и по улову (Config.Leaderboards).
|
||||||
|
-- Значения берутся из атрибутов игроков (их ведёт GameServer) и раз в refresh секунд пишутся в OrderedDataStore,
|
||||||
|
-- оттуда же читается глобальный топ. Игроки, которые сейчас на сервере, показываются со свежими значениями сразу;
|
||||||
|
-- без доступа к DataStore (Studio без API) доски показывают только их.
|
||||||
|
-- Доски на карте — модели с атрибутом Leaderboard = id и строками Row1…RowN (их строит WorldBuilder.leaderboard).
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local DataStoreService = game:GetService("DataStoreService")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
local L = Config.Leaderboards
|
||||||
|
|
||||||
|
local stores = {}
|
||||||
|
for _, b in ipairs(L.boards) do
|
||||||
|
pcall(function()
|
||||||
|
stores[b.id] = DataStoreService:GetOrderedDataStore(b.store)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
local written = {} -- [userId][boardId] = последнее записанное значение (не пишем без изменений)
|
||||||
|
local names = {} -- [userId] = имя
|
||||||
|
|
||||||
|
local function nameOf(userId)
|
||||||
|
if names[userId] then
|
||||||
|
return names[userId]
|
||||||
|
end
|
||||||
|
local ok, name = pcall(function()
|
||||||
|
return Players:GetNameFromUserIdAsync(userId)
|
||||||
|
end)
|
||||||
|
names[userId] = ok and name or ("Игрок " .. userId)
|
||||||
|
return names[userId]
|
||||||
|
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 writePlayer(player)
|
||||||
|
for _, b in ipairs(L.boards) do
|
||||||
|
local store = stores[b.id]
|
||||||
|
local value = math.floor(tonumber(player:GetAttribute(b.attr)) or 0)
|
||||||
|
written[player.UserId] = written[player.UserId] or {}
|
||||||
|
if store and value > 0 and written[player.UserId][b.id] ~= value then
|
||||||
|
local ok = pcall(function()
|
||||||
|
store:SetAsync(tostring(player.UserId), value)
|
||||||
|
end)
|
||||||
|
if ok then
|
||||||
|
written[player.UserId][b.id] = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function readTop(b)
|
||||||
|
local list = {}
|
||||||
|
local store = stores[b.id]
|
||||||
|
if store then
|
||||||
|
pcall(function()
|
||||||
|
local page = store:GetSortedAsync(false, L.size):GetCurrentPage()
|
||||||
|
for _, e in ipairs(page) do
|
||||||
|
table.insert(list, { userId = tonumber(e.key), value = e.value })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
-- игроки на сервере: их значения свежее записанных
|
||||||
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
|
local value = math.floor(tonumber(p:GetAttribute(b.attr)) or 0)
|
||||||
|
if value > 0 then
|
||||||
|
local found = false
|
||||||
|
for _, e in ipairs(list) do
|
||||||
|
if e.userId == p.UserId then
|
||||||
|
e.value = math.max(e.value, value)
|
||||||
|
found = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not found then
|
||||||
|
table.insert(list, { userId = p.UserId, value = value })
|
||||||
|
end
|
||||||
|
names[p.UserId] = p.Name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(list, function(a, c) return a.value > c.value end)
|
||||||
|
return list
|
||||||
|
end
|
||||||
|
|
||||||
|
local MEDAL = { "🥇", "🥈", "🥉" }
|
||||||
|
local function render(b, list)
|
||||||
|
local map = workspace:FindFirstChild("FishingMap")
|
||||||
|
if not map then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, model in ipairs(map:GetDescendants()) do
|
||||||
|
if model:GetAttribute("Leaderboard") == b.id then
|
||||||
|
for i = 1, L.size do
|
||||||
|
local row = model:FindFirstChild("Row" .. i, true)
|
||||||
|
if row then
|
||||||
|
local e = list[i]
|
||||||
|
row.Rank.Text = MEDAL[i] or (i .. ".")
|
||||||
|
row.PlayerName.Text = e and nameOf(e.userId) or "—"
|
||||||
|
row.Value.Text = e and (fmt(e.value) .. " " .. b.unit) or ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function refresh()
|
||||||
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
|
writePlayer(p)
|
||||||
|
end
|
||||||
|
for _, b in ipairs(L.boards) do
|
||||||
|
render(b, readTop(b))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Players.PlayerRemoving:Connect(function(p)
|
||||||
|
writePlayer(p)
|
||||||
|
written[p.UserId] = nil
|
||||||
|
end)
|
||||||
|
|
||||||
|
game:BindToClose(function()
|
||||||
|
for _, p in ipairs(Players:GetPlayers()) do
|
||||||
|
writePlayer(p)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
task.spawn(function()
|
||||||
|
task.wait(5) -- дать GameServer загрузить данные игроков
|
||||||
|
while true do
|
||||||
|
refresh()
|
||||||
|
task.wait(L.refresh)
|
||||||
|
end
|
||||||
|
end)
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
-- LobbyLife (Script) -> ServerScriptService
|
||||||
|
-- Живое лобби (общее для всех игроков): у всех NPC играет idle-анимация, по площади гуляют жители —
|
||||||
|
-- рыбак с удочкой на плече и бабушка с корзинкой. Маршруты считает PathfindingService, поэтому
|
||||||
|
-- жители обходят лавки, фонтан и порталы. Остальное оживление — на клиенте (LobbyLife.client.lua).
|
||||||
|
|
||||||
|
local PathfindingService = game:GetService("PathfindingService")
|
||||||
|
local ServerScriptService = game:GetService("ServerScriptService")
|
||||||
|
|
||||||
|
local WorldBuilder = require(ServerScriptService:WaitForChild("WorldBuilder"))
|
||||||
|
|
||||||
|
local ANIM = {
|
||||||
|
idle = "rbxassetid://507766666", -- стандартные R15-анимации Roblox
|
||||||
|
walk = "rbxassetid://507777826",
|
||||||
|
}
|
||||||
|
local FLOOR = 1
|
||||||
|
-- куда ходят жители (x, z на площади лобби); между точками путь ищет PathfindingService
|
||||||
|
local POINTS = {
|
||||||
|
{ 28, 8 }, { -28, -8 }, { 0, 32 }, { 0, -32 }, { 30, 25 }, { -30, 25 }, { 30, -24 }, { -30, -24 },
|
||||||
|
{ 45, 12 }, { -45, -12 }, { 12, 45 }, { -22, 40 }, { 22, -42 }, { -42, 20 },
|
||||||
|
}
|
||||||
|
local WALKERS = {
|
||||||
|
{ name = "Рыбак Фёдор", skin = Color3.fromRGB(226, 176, 140), shirt = Color3.fromRGB(70, 110, 150), pants = Color3.fromRGB(60, 62, 70),
|
||||||
|
hat = Color3.fromRGB(110, 120, 70), look = nil, prop = "rod", speed = 7 },
|
||||||
|
{ name = "Бабушка Нюра", skin = Color3.fromRGB(240, 200, 170), shirt = Color3.fromRGB(170, 70, 90), pants = Color3.fromRGB(90, 60, 80),
|
||||||
|
hat = Color3.fromRGB(235, 220, 120), look = "Scarf", prop = "basket", speed = 5 },
|
||||||
|
}
|
||||||
|
|
||||||
|
local rng = Random.new()
|
||||||
|
|
||||||
|
---------------------------------------------------------------- куда жителям нельзя
|
||||||
|
-- Поиск пути Roblox забирается на низкие препятствия (чаша фонтана, скамейки, основания порталов)
|
||||||
|
-- и ведёт жителей поверху. Поэтому вокруг всего, что стоит на площади на уровне роста, ставим невидимые
|
||||||
|
-- «стены»: CanCollide = true, но в своей группе столкновений, которая ни с чем не сталкивается —
|
||||||
|
-- поиск пути видит в них препятствие, а игроки, жители и лучи (CanQuery = false) проходят насквозь.
|
||||||
|
local LOBBY_R = 76 -- зоны — только на площади лобби
|
||||||
|
local noWalk = {} -- { center, half } по мировым осям — чтобы выкинуть точки маршрута, попавшие внутрь
|
||||||
|
|
||||||
|
local function inside(pos)
|
||||||
|
for _, z in ipairs(noWalk) do
|
||||||
|
if math.abs(pos.X - z.center.X) <= z.half.X and math.abs(pos.Z - z.center.Z) <= z.half.Z then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- габариты повёрнутой коробки по мировым осям (половины): у лежащих цилиндров и повёрнутых лавок
|
||||||
|
-- локальные оси не совпадают с мировыми, поэтому зону строим по проекции на пол
|
||||||
|
local function worldHalf(cf, size)
|
||||||
|
local r, u, b = cf.RightVector, cf.UpVector, cf.LookVector
|
||||||
|
local h = size / 2
|
||||||
|
return Vector3.new(
|
||||||
|
math.abs(r.X) * h.X + math.abs(u.X) * h.Y + math.abs(b.X) * h.Z,
|
||||||
|
math.abs(r.Y) * h.X + math.abs(u.Y) * h.Y + math.abs(b.Y) * h.Z,
|
||||||
|
math.abs(r.Z) * h.X + math.abs(u.Z) * h.Y + math.abs(b.Z) * h.Z)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function buildNoWalk(map)
|
||||||
|
local PhysicsService = game:GetService("PhysicsService")
|
||||||
|
pcall(function()
|
||||||
|
PhysicsService:RegisterCollisionGroup("NpcNoWalk")
|
||||||
|
end)
|
||||||
|
for _, g in ipairs(PhysicsService:GetRegisteredCollisionGroups()) do
|
||||||
|
PhysicsService:CollisionGroupSetCollidable("NpcNoWalk", g.name, false)
|
||||||
|
end
|
||||||
|
local folder = Instance.new("Folder")
|
||||||
|
folder.Name = "NpcNoWalk"
|
||||||
|
local function block(cf, size)
|
||||||
|
local c, e = cf.Position, worldHalf(cf, size)
|
||||||
|
-- только то, что стоит на полу на уровне роста и на самой площади
|
||||||
|
if c.Y - e.Y > FLOOR + 6 or c.Y + e.Y < FLOOR + 0.6 or Vector3.new(c.X, 0, c.Z).Magnitude > LOBBY_R then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local size2 = Vector3.new(e.X * 2 + 1.5, 10, e.Z * 2 + 1.5) -- небольшой запас: жители не трутся о края
|
||||||
|
local p = Instance.new("Part")
|
||||||
|
p.Name = "NoWalk"
|
||||||
|
p.Anchored, p.CanCollide, p.CanQuery, p.CanTouch = true, true, false, false
|
||||||
|
p.CollisionGroup = "NpcNoWalk" -- ни с чем не сталкивается, но поиск пути её видит
|
||||||
|
p.Transparency = 1
|
||||||
|
p.Size = size2
|
||||||
|
p.CFrame = CFrame.new(c.X, FLOOR + 5, c.Z)
|
||||||
|
p.Parent = folder
|
||||||
|
table.insert(noWalk, { center = p.Position, half = size2 / 2 })
|
||||||
|
end
|
||||||
|
local skip = {
|
||||||
|
LobbyCliffs = true, LobbyCliffDecor = true, LobbyCliffFoot = true, LobbyForest = true, LobbyTrees = true,
|
||||||
|
LobbyRockPlants = true, LobbyHillForest = true, LobbyHaze = true, FishingZones = true, World1Map = true,
|
||||||
|
}
|
||||||
|
local function consider(inst)
|
||||||
|
if inst:IsA("Model") then
|
||||||
|
if inst:FindFirstChildOfClass("Humanoid") or inst:GetAttribute("Npc") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local cf, size = inst:GetBoundingBox()
|
||||||
|
block(cf, size)
|
||||||
|
elseif inst:IsA("BasePart") and inst.Transparency < 0.95 then
|
||||||
|
block(inst.CFrame, inst.Size)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, c in ipairs(map:GetChildren()) do
|
||||||
|
if not skip[c.Name] and not c:IsA("Folder") then
|
||||||
|
consider(c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- модели, поставленные на площадь руками (фонтан, декор из Toolbox)
|
||||||
|
for _, c in ipairs(workspace:GetChildren()) do
|
||||||
|
if c ~= map and (c:IsA("Model") or c:IsA("BasePart")) and not c:IsA("Terrain") then
|
||||||
|
consider(c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
folder.Parent = workspace
|
||||||
|
end
|
||||||
|
|
||||||
|
local function loadAnim(hum, id)
|
||||||
|
local animator = hum:FindFirstChildOfClass("Animator")
|
||||||
|
if not animator then
|
||||||
|
animator = Instance.new("Animator")
|
||||||
|
animator.Parent = hum
|
||||||
|
end
|
||||||
|
local a = Instance.new("Animation")
|
||||||
|
a.AnimationId = id
|
||||||
|
return animator:LoadAnimation(a)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function startIdle(rig)
|
||||||
|
local hum = rig:FindFirstChildOfClass("Humanoid")
|
||||||
|
if hum and not rig:GetAttribute("IdleOn") then
|
||||||
|
rig:SetAttribute("IdleOn", true)
|
||||||
|
local ok, track = pcall(loadAnim, hum, ANIM.idle)
|
||||||
|
if ok then
|
||||||
|
track.Looped = true
|
||||||
|
track:Play(0.3, 1, rng:NextNumber(0.85, 1.1))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- реквизит в руках / за спиной: приваривается к части тела
|
||||||
|
local function prop(rig, kind)
|
||||||
|
local function piece(partName, size, color, offset, shape)
|
||||||
|
local body = rig:FindFirstChild(partName)
|
||||||
|
if not body then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local p = Instance.new("Part")
|
||||||
|
p.Shape = shape or Enum.PartType.Block
|
||||||
|
p.Size = size
|
||||||
|
p.Color = color
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
p.CanCollide, p.CanQuery, p.CanTouch, p.Massless = false, false, false, true
|
||||||
|
p.CFrame = body.CFrame * offset
|
||||||
|
local w = Instance.new("WeldConstraint")
|
||||||
|
w.Part0, w.Part1 = body, p
|
||||||
|
w.Parent = p
|
||||||
|
p.Parent = rig
|
||||||
|
end
|
||||||
|
if kind == "rod" then
|
||||||
|
-- удочка на плече: длинное удилище наискосок за спиной и катушка
|
||||||
|
piece("UpperTorso", Vector3.new(0.18, 7, 0.18), Color3.fromRGB(120, 80, 45),
|
||||||
|
CFrame.new(0.4, 1.2, 0.65) * CFrame.Angles(math.rad(-25), 0, math.rad(-30)), Enum.PartType.Block)
|
||||||
|
piece("UpperTorso", Vector3.new(0.5, 0.5, 0.35), Color3.fromRGB(60, 60, 66), CFrame.new(0.9, 0.2, 0.75))
|
||||||
|
elseif kind == "basket" then
|
||||||
|
-- корзинка в руке: короб и ручка
|
||||||
|
piece("RightHand", Vector3.new(1.1, 0.7, 0.8), Color3.fromRGB(170, 120, 60), CFrame.new(0, -0.7, 0))
|
||||||
|
piece("RightHand", Vector3.new(0.12, 0.6, 0.6), Color3.fromRGB(140, 95, 45), CFrame.new(0, -0.15, 0))
|
||||||
|
piece("RightHand", Vector3.new(0.9, 0.18, 0.6), Color3.fromRGB(240, 120, 90), CFrame.new(0, -0.28, 0)) -- яблоки сверху
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function walker(def, map)
|
||||||
|
if #POINTS < 2 then
|
||||||
|
warn("LobbyLife: свободных точек маршрута меньше двух, жители не гуляют")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local start = POINTS[rng:NextInteger(1, #POINTS)]
|
||||||
|
local spot = Instance.new("Part")
|
||||||
|
spot.CFrame = CFrame.new(start[1], FLOOR + 3, start[2])
|
||||||
|
spot:SetAttribute("NpcName", def.name)
|
||||||
|
spot:SetAttribute("SkinColor", def.skin)
|
||||||
|
spot:SetAttribute("ShirtColor", def.shirt)
|
||||||
|
spot:SetAttribute("PantsColor", def.pants)
|
||||||
|
spot:SetAttribute("HatColor", def.hat)
|
||||||
|
if def.look then
|
||||||
|
spot:SetAttribute("Look", def.look)
|
||||||
|
end
|
||||||
|
local rig = WorldBuilder.spawnNpc(spot, map)
|
||||||
|
spot:Destroy()
|
||||||
|
if not rig then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
rig:SetAttribute("Walker", true)
|
||||||
|
prop(rig, def.prop)
|
||||||
|
local hum = rig:FindFirstChildOfClass("Humanoid")
|
||||||
|
local root = rig:FindFirstChild("HumanoidRootPart")
|
||||||
|
hum.WalkSpeed = def.speed
|
||||||
|
hum.NameDisplayDistance = 35
|
||||||
|
root.Anchored = false
|
||||||
|
pcall(function() root:SetNetworkOwner(nil) end) -- двигает сервер, у всех одинаково
|
||||||
|
startIdle(rig)
|
||||||
|
local walk = loadAnim(hum, ANIM.walk)
|
||||||
|
walk.Looped = true
|
||||||
|
|
||||||
|
task.spawn(function()
|
||||||
|
while rig.Parent do
|
||||||
|
local p = POINTS[rng:NextInteger(1, #POINTS)]
|
||||||
|
local target = Vector3.new(p[1], FLOOR + 2, p[2])
|
||||||
|
if (target - root.Position).Magnitude > 8 then
|
||||||
|
local path = PathfindingService:CreatePath({ AgentRadius = 2, AgentHeight = 5, AgentCanJump = false })
|
||||||
|
local ok = pcall(function()
|
||||||
|
path:ComputeAsync(root.Position, target)
|
||||||
|
end)
|
||||||
|
if ok and path.Status == Enum.PathStatus.Success then
|
||||||
|
walk:Play(0.25, 1, def.speed / 8)
|
||||||
|
for _, wp in ipairs(path:GetWaypoints()) do
|
||||||
|
if not rig.Parent then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
hum:MoveTo(wp.Position)
|
||||||
|
local reached = hum.MoveToFinished:Wait()
|
||||||
|
if not reached then
|
||||||
|
break -- застрял: выберем другую точку
|
||||||
|
end
|
||||||
|
end
|
||||||
|
walk:Stop(0.3)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
task.wait(rng:NextNumber(3, 8)) -- постоял, посмотрел по сторонам
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
local map = workspace:WaitForChild("FishingMap")
|
||||||
|
task.wait(2) -- MapBuilder расставляет NPC
|
||||||
|
for _, d in ipairs(map:GetDescendants()) do
|
||||||
|
if d:IsA("Model") and d:GetAttribute("Npc") then
|
||||||
|
startIdle(d)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
map.DescendantAdded:Connect(function(d)
|
||||||
|
if d:IsA("Model") then
|
||||||
|
task.defer(function()
|
||||||
|
if d:GetAttribute("Npc") then
|
||||||
|
startIdle(d)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
buildNoWalk(map)
|
||||||
|
-- точки маршрута, оказавшиеся внутри препятствий (например, на месте передвинутой лавки), не используем
|
||||||
|
for i = #POINTS, 1, -1 do
|
||||||
|
if inside(Vector3.new(POINTS[i][1], FLOOR, POINTS[i][2])) then
|
||||||
|
table.remove(POINTS, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, def in ipairs(WALKERS) do
|
||||||
|
walker(def, map)
|
||||||
|
end
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
-- WeatherServer (Script) -> ServerScriptService
|
||||||
|
-- Общие для всего сервера время суток и погода. Ничего не рисует — только выставляет атрибуты workspace:
|
||||||
|
-- DayStart — серверное время начала суток (часы считает Config.ClockAt)
|
||||||
|
-- Weather — id погоды из Config.Weathers
|
||||||
|
-- WeatherEnds — когда сменится (workspace:GetServerTimeNow())
|
||||||
|
-- Небо, дождь, звуки и свет делает клиент (Ambience), бонусы к рыбалке учитывает GameServer.
|
||||||
|
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
|
||||||
|
local rng = Random.new()
|
||||||
|
|
||||||
|
if Config.DayNight.enabled then
|
||||||
|
workspace:SetAttribute("DayStart", workspace:GetServerTimeNow())
|
||||||
|
end
|
||||||
|
|
||||||
|
local function pickWeather(previous)
|
||||||
|
local total = 0
|
||||||
|
for _, w in ipairs(Config.Weathers) do
|
||||||
|
if w.id ~= previous then
|
||||||
|
total += w.weight
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local roll = rng:NextNumber() * total
|
||||||
|
for _, w in ipairs(Config.Weathers) do
|
||||||
|
if w.id ~= previous then
|
||||||
|
roll -= w.weight
|
||||||
|
if roll <= 0 then
|
||||||
|
return w
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return Config.Weathers[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
task.spawn(function()
|
||||||
|
-- первая погода всегда ясная: новичок видит мир чистым
|
||||||
|
local current = Config.Weathers[1]
|
||||||
|
while true do
|
||||||
|
local duration = rng:NextInteger(current.duration[1], current.duration[2])
|
||||||
|
workspace:SetAttribute("Weather", current.id)
|
||||||
|
workspace:SetAttribute("WeatherEnds", workspace:GetServerTimeNow() + duration)
|
||||||
|
task.wait(duration)
|
||||||
|
current = pickWeather(current.id)
|
||||||
|
end
|
||||||
|
end)
|
||||||
@@ -131,7 +131,8 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------- детали
|
---------------------------------------------------------------- детали
|
||||||
-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры)
|
-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры)
|
||||||
function Builder.build(parent)
|
-- makePortal — WorldBuilder.portalModel: ставит модель портала из шаблона (без него строится старое кольцо)
|
||||||
|
function Builder.build(parent, makePortal)
|
||||||
buildTerrain()
|
buildTerrain()
|
||||||
|
|
||||||
local rng = Random.new(7)
|
local rng = Random.new(7)
|
||||||
@@ -540,20 +541,30 @@ function Builder.build(parent)
|
|||||||
portalModel.Name = "PortalToLobby"
|
portalModel.Name = "PortalToLobby"
|
||||||
portalModel.Parent = map
|
portalModel.Parent = map
|
||||||
local center = baseCF * CFrame.new(0, 10, 0)
|
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), Parent = portalModel })
|
local fancy = makePortal and makePortal(baseCF, color, "PortalModel_Lobby", portalModel)
|
||||||
P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel })
|
local disc
|
||||||
local R, n = 7, 20
|
if fancy then
|
||||||
for i = 0, n - 1 do
|
-- модель из шаблона; невидимый якорь держит подсказку, подпись и искры
|
||||||
local a = (i + 0.5) / n * math.pi * 2
|
disc = P({
|
||||||
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), Parent = portalModel })
|
Name = "Portal_Lobby", Size = V(1, 1, 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0),
|
||||||
if i % 2 == 0 then
|
Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false, Parent = portalModel,
|
||||||
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, Parent = portalModel })
|
})
|
||||||
|
else
|
||||||
|
P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115), Parent = portalModel })
|
||||||
|
P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel })
|
||||||
|
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), Parent = portalModel })
|
||||||
|
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, Parent = portalModel })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
disc = P({
|
||||||
|
Name = "Portal_Lobby", 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, Parent = portalModel,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
local disc = P({
|
|
||||||
Name = "Portal_Lobby", 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, Parent = portalModel,
|
|
||||||
})
|
|
||||||
local pe = Instance.new("ParticleEmitter")
|
local pe = Instance.new("ParticleEmitter")
|
||||||
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||||||
pe.LightEmission = 1
|
pe.LightEmission = 1
|
||||||
@@ -566,7 +577,7 @@ function Builder.build(parent)
|
|||||||
pe.Parent = disc
|
pe.Parent = disc
|
||||||
local bb = Instance.new("BillboardGui")
|
local bb = Instance.new("BillboardGui")
|
||||||
bb.Size = UDim2.fromOffset(250, 64)
|
bb.Size = UDim2.fromOffset(250, 64)
|
||||||
bb.StudsOffset = V(0, 10, 0)
|
bb.StudsOffset = V(0, fancy and 7 or 10, 0)
|
||||||
bb.MaxDistance = 160
|
bb.MaxDistance = 160
|
||||||
bb.LightInfluence = 0
|
bb.LightInfluence = 0
|
||||||
bb.Parent = disc
|
bb.Parent = disc
|
||||||
|
|||||||
@@ -61,20 +61,29 @@ local function ensure(class, parent, props)
|
|||||||
return obj
|
return obj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Базовый свет при запуске игры (совпадает со светом лобби). Под каждую локацию его меняет клиент
|
||||||
|
-- по полям look из FishConfig, пока игрок за экраном загрузки.
|
||||||
function Builder.applyLighting()
|
function Builder.applyLighting()
|
||||||
Lighting.ClockTime = 14.5
|
Lighting.ClockTime = 16.3
|
||||||
Lighting.Brightness = 2.3
|
Lighting.Brightness = 2.0
|
||||||
Lighting.Ambient = Color3.fromRGB(70, 70, 85)
|
Lighting.ExposureCompensation = -0.3
|
||||||
Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160)
|
Lighting.Ambient = Color3.fromRGB(64, 60, 72)
|
||||||
Lighting.EnvironmentDiffuseScale = 0.6
|
Lighting.OutdoorAmbient = Color3.fromRGB(120, 114, 124)
|
||||||
Lighting.EnvironmentSpecularScale = 0.8
|
Lighting.ColorShift_Top = Color3.fromRGB(255, 224, 186)
|
||||||
|
Lighting.EnvironmentDiffuseScale = 0.5
|
||||||
|
Lighting.EnvironmentSpecularScale = 0.5
|
||||||
|
Lighting.GlobalShadows = true
|
||||||
ensure("Atmosphere", Lighting, {
|
ensure("Atmosphere", Lighting, {
|
||||||
Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6,
|
Density = 0.4, Offset = 0.18, Glare = 0.25, Haze = 1.6,
|
||||||
Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175),
|
Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150),
|
||||||
})
|
})
|
||||||
ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 })
|
ensure("BloomEffect", Lighting, { Intensity = 0.3, Size = 24, Threshold = 1.8 })
|
||||||
ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 })
|
ensure("ColorCorrectionEffect", Lighting, {
|
||||||
ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 })
|
Saturation = 0.18, Contrast = 0.14, Brightness = -0.04, TintColor = Color3.fromRGB(255, 242, 228),
|
||||||
|
})
|
||||||
|
ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.7 })
|
||||||
|
-- размытие дальнего плана включают миры и лобби через look.dof
|
||||||
|
ensure("DepthOfFieldEffect", Lighting, { Enabled = false, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 })
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------- помощники
|
---------------------------------------------------------------- помощники
|
||||||
@@ -328,6 +337,149 @@ local function lobbyRockPlants()
|
|||||||
bush.Parent = folder
|
bush.Parent = folder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- холмы и горы за скалами лобби (террейн), ельники на склонах и кольцо тумана за горами.
|
||||||
|
-- К горизонту холмы выше, чтобы из лобби было видно не пустоту, а гряду в дымке.
|
||||||
|
local function lobbyHillHeight(x, z)
|
||||||
|
local r = math.sqrt(x * x + z * z)
|
||||||
|
if r < 120 then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local t = math.clamp((r - 120) / 220, 0, 1)
|
||||||
|
local base = 22 + 90 * t ^ 0.85
|
||||||
|
local n = math.noise(x / 95, z / 95, 1.7) * 30 + math.noise(x / 38, z / 38, 5.1) * 9
|
||||||
|
local peak = math.max(0, math.noise(x / 150, z / 150, 9.3)) * 70 * t
|
||||||
|
local edge = math.clamp((r - 120) / 12, 0, 1)
|
||||||
|
return (base + n * (0.35 + 0.65 * t) + peak) * edge
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lobbyHills()
|
||||||
|
local R, Y0, Y1, CH = 384, -8, 232, 64
|
||||||
|
for cx = -R, R - CH, CH do
|
||||||
|
for cz = -R, R - CH, CH do
|
||||||
|
-- чанк целиком внутри лобби пропускаем
|
||||||
|
local far = math.sqrt(math.max(cx * cx, (cx + CH) ^ 2) + math.max(cz * cz, (cz + CH) ^ 2))
|
||||||
|
if far >= 120 then
|
||||||
|
local region = Region3.new(V(cx, Y0, cz), V(cx + CH, Y1, cz + CH))
|
||||||
|
local nx, ny, nz = CH / 4, (Y1 - Y0) / 4, CH / 4
|
||||||
|
local mats, occs = {}, {}
|
||||||
|
for i = 1, nx do
|
||||||
|
mats[i], occs[i] = {}, {}
|
||||||
|
for j = 1, ny do
|
||||||
|
mats[i][j], occs[i][j] = {}, {}
|
||||||
|
end
|
||||||
|
for k = 1, nz do
|
||||||
|
local x, z = cx + (i - 0.5) * 4, cz + (k - 0.5) * 4
|
||||||
|
local h = (math.sqrt(x * x + z * z) <= R) and lobbyHillHeight(x, z) or nil
|
||||||
|
for j = 1, ny do
|
||||||
|
local yb = Y0 + (j - 1) * 4
|
||||||
|
local occ = h and math.clamp((h - yb) / 4, 0, 1) or 0
|
||||||
|
local m = Enum.Material.Air
|
||||||
|
if occ > 0 then
|
||||||
|
if yb > h - 6 then
|
||||||
|
m = h > 118 and Enum.Material.Rock or Enum.Material.Grass
|
||||||
|
else
|
||||||
|
m = Enum.Material.Ground
|
||||||
|
end
|
||||||
|
end
|
||||||
|
mats[i][j][k], occs[i][j][k] = m, occ
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
terrain:WriteVoxels(region, 4, mats, occs)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ельники пятнами на склонах
|
||||||
|
local pines = ServerStorage:FindFirstChild("OldPines")
|
||||||
|
local forest = Instance.new("Folder")
|
||||||
|
forest.Name = "LobbyHillForest"
|
||||||
|
forest.Parent = map
|
||||||
|
if pines and #pines:GetChildren() > 0 then
|
||||||
|
local templates = pines:GetChildren()
|
||||||
|
local frng = Random.new(1104)
|
||||||
|
local placed = {}
|
||||||
|
for _ = 1, 4000 do
|
||||||
|
if #placed >= 170 then break end
|
||||||
|
local a = frng:NextNumber(0, math.pi * 2)
|
||||||
|
local r = frng:NextNumber(132, 300)
|
||||||
|
local x, z = math.cos(a) * r, math.sin(a) * r
|
||||||
|
-- высоту берём из той же формулы: лучи по только что залитому террейну в редакторе ненадёжны
|
||||||
|
local h = lobbyHillHeight(x, z)
|
||||||
|
local slope = h and math.max(math.abs((lobbyHillHeight(x + 4, z) or h) - h), math.abs((lobbyHillHeight(x, z + 4) or h) - h)) / 4
|
||||||
|
if h and h <= 118 and slope < 0.8 and math.noise(x / 60, z / 60, 3.3) > -0.05 then
|
||||||
|
local ground = V(x, h, z)
|
||||||
|
local ok = true
|
||||||
|
for _, q in ipairs(placed) do
|
||||||
|
if (q - ground).Magnitude < 9 then ok = false break end
|
||||||
|
end
|
||||||
|
if ok then
|
||||||
|
local m = templates[frng:NextInteger(1, #templates)]:Clone()
|
||||||
|
for _, d in ipairs(m:GetDescendants()) do
|
||||||
|
if d:IsA("LuaSourceContainer") then
|
||||||
|
d:Destroy()
|
||||||
|
elseif d:IsA("BasePart") then
|
||||||
|
d.Anchored = true
|
||||||
|
d.CanCollide = false
|
||||||
|
d.CastShadow = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
m:ScaleTo(m:GetScale() * frng:NextNumber(0.8, 1.5))
|
||||||
|
m:PivotTo(CFrame.new(ground) * CFrame.Angles(0, frng:NextNumber(0, math.pi * 2), 0))
|
||||||
|
local bcf, bsz = m:GetBoundingBox()
|
||||||
|
m:PivotTo(m:GetPivot() + V(0, ground.Y - (bcf.Position.Y - bsz.Y / 2) - 1, 0))
|
||||||
|
m.Parent = forest
|
||||||
|
table.insert(placed, ground)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- туман за горами: медленные крупные клубы по двум кольцам
|
||||||
|
local haze = Instance.new("Folder")
|
||||||
|
haze.Name = "LobbyHaze"
|
||||||
|
haze.Parent = map
|
||||||
|
for ring, cfg in ipairs({ { r = 150, n = 28, y = 18, size = 45 }, { r = 250, n = 36, y = 40, size = 70 } }) do
|
||||||
|
for i = 1, cfg.n do
|
||||||
|
local a = (i - 1) / cfg.n * math.pi * 2
|
||||||
|
local x, z = math.cos(a) * cfg.r, math.sin(a) * cfg.r
|
||||||
|
local h = lobbyHillHeight(x, z) or 0
|
||||||
|
local anchor = Instance.new("Part")
|
||||||
|
anchor.Name = "HazeAnchor"
|
||||||
|
anchor.Anchored = true
|
||||||
|
anchor.CanCollide = false
|
||||||
|
anchor.CanQuery = false
|
||||||
|
anchor.CanTouch = false
|
||||||
|
anchor.Transparency = 1
|
||||||
|
anchor.Size = V(30, 4, 30)
|
||||||
|
anchor.CFrame = CFrame.new(x, h + cfg.y, z)
|
||||||
|
anchor.Parent = haze
|
||||||
|
local pe = Instance.new("ParticleEmitter")
|
||||||
|
pe.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||||||
|
pe.Color = ColorSequence.new(Color3.fromRGB(236, 228, 220))
|
||||||
|
pe.LightEmission = 0.15
|
||||||
|
pe.LightInfluence = 0.6
|
||||||
|
pe.Rate = ring == 1 and 0.5 or 0.35
|
||||||
|
pe.Lifetime = NumberRange.new(16, 22)
|
||||||
|
pe.Speed = NumberRange.new(0.3, 0.8)
|
||||||
|
pe.SpreadAngle = Vector2.new(60, 60)
|
||||||
|
pe.Rotation = NumberRange.new(0, 360)
|
||||||
|
pe.RotSpeed = NumberRange.new(-4, 4)
|
||||||
|
pe.Size = NumberSequence.new({
|
||||||
|
NumberSequenceKeypoint.new(0, cfg.size * 0.7),
|
||||||
|
NumberSequenceKeypoint.new(1, cfg.size * 1.2),
|
||||||
|
})
|
||||||
|
pe.Transparency = NumberSequence.new({
|
||||||
|
NumberSequenceKeypoint.new(0, 1),
|
||||||
|
NumberSequenceKeypoint.new(0.3, 0.8),
|
||||||
|
NumberSequenceKeypoint.new(0.7, 0.82),
|
||||||
|
NumberSequenceKeypoint.new(1, 1),
|
||||||
|
})
|
||||||
|
pe.Parent = anchor
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе)
|
-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе)
|
||||||
local function groundY(x, z)
|
local function groundY(x, z)
|
||||||
local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4)
|
local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4)
|
||||||
@@ -455,6 +607,218 @@ local function setBestiary(board, zoneId, title, titleHex)
|
|||||||
writeBestiary(board)
|
writeBestiary(board)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Лавки в стиле low poly: без фотореалистичных текстур (доски, ткань), плоские цвета с разбросом оттенков.
|
||||||
|
-- Большие дощатые панели (стены, пол, крыша) режутся на отдельные доски, шарики-гирлянды становятся
|
||||||
|
-- ромбиками-флажками, неоновая рамка вывески — матовой золотой. frame — CFrame лавки (для флажков), может быть nil.
|
||||||
|
local LOWPOLY_FLAT = {
|
||||||
|
[Enum.Material.WoodPlanks] = true, [Enum.Material.Wood] = true, [Enum.Material.Fabric] = true,
|
||||||
|
[Enum.Material.Metal] = true, [Enum.Material.Brick] = true, [Enum.Material.Plastic] = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local function lowPolyShade(c, lrng, spread)
|
||||||
|
local k = 1 + lrng:NextNumber(-spread, spread)
|
||||||
|
return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lowPolyPlanks(p, lrng)
|
||||||
|
local s = p.Size
|
||||||
|
local dims = { s.X, s.Y, s.Z }
|
||||||
|
local thin = 1
|
||||||
|
for i = 2, 3 do
|
||||||
|
if dims[i] < dims[thin] then thin = i end
|
||||||
|
end
|
||||||
|
-- режем вдоль самой длинной горизонтальной оси (кроме тонкой): стены — вертикальные доски, пол — продольные
|
||||||
|
local axis = (thin ~= 1 and (thin == 3 or s.X >= s.Z)) and 1 or 3
|
||||||
|
local len = dims[axis]
|
||||||
|
local n = math.max(2, math.floor(len / 1.8 + 0.5))
|
||||||
|
local w = len / n
|
||||||
|
for i = 1, n do
|
||||||
|
local off = -len / 2 + w * (i - 0.5)
|
||||||
|
local depth = lrng:NextNumber(-0.06, 0.06)
|
||||||
|
local o = { 0, 0, 0 }
|
||||||
|
o[axis] = off
|
||||||
|
o[thin] = depth
|
||||||
|
local size = { s.X, s.Y, s.Z }
|
||||||
|
size[axis] = w
|
||||||
|
local plank = Instance.new("Part")
|
||||||
|
plank.Name = "Plank"
|
||||||
|
plank.Anchored = true
|
||||||
|
plank.TopSurface, plank.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||||||
|
plank.Material = Enum.Material.SmoothPlastic
|
||||||
|
plank.Size = V(size[1], size[2], size[3])
|
||||||
|
plank.CFrame = p.CFrame * CFrame.new(o[1], o[2], o[3])
|
||||||
|
plank.Color = lowPolyShade(p.Color, lrng, 0.09)
|
||||||
|
plank.CanCollide, plank.CastShadow, plank.CanQuery = p.CanCollide, p.CastShadow, p.CanQuery
|
||||||
|
plank.Parent = p.Parent
|
||||||
|
end
|
||||||
|
p:Destroy()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Builder.lowPolyParts(parts, frame, seed)
|
||||||
|
local lrng = Random.new(seed or 5)
|
||||||
|
for _, p in ipairs(parts) do
|
||||||
|
if p:IsA("BasePart") and p.Parent and p.Transparency < 0.5 and not p.Name:find("Npc") then
|
||||||
|
local isBlock = p.ClassName == "Part" and p.Shape == Enum.PartType.Block
|
||||||
|
if p.Material == Enum.Material.Fabric and p.ClassName == "Part" and p.Shape == Enum.PartType.Ball and frame then
|
||||||
|
-- шарик гирлянды → ромбик-флажок, повёрнутый к покупателям
|
||||||
|
local d = p.Size.X
|
||||||
|
local flag = Instance.new("Part")
|
||||||
|
flag.Name = "Pennant"
|
||||||
|
flag.Anchored = true
|
||||||
|
flag.CanCollide = false
|
||||||
|
flag.Material = Enum.Material.SmoothPlastic
|
||||||
|
flag.Size = V(d * 1.15, d * 1.15, 0.25)
|
||||||
|
flag.CFrame = CFrame.new(p.Position) * (frame - frame.Position) * CFrame.Angles(0, 0, math.rad(45))
|
||||||
|
flag.Color = p.Color
|
||||||
|
flag.Parent = p.Parent
|
||||||
|
p:Destroy()
|
||||||
|
elseif p.Material == Enum.Material.Neon and math.max(p.Size.X, p.Size.Y, p.Size.Z) > 4 then
|
||||||
|
p.Material = Enum.Material.SmoothPlastic -- рамка вывески: без свечения
|
||||||
|
p.Color = Color3.fromRGB(214, 160, 70)
|
||||||
|
elseif p.Material == Enum.Material.WoodPlanks and isBlock and #p:GetChildren() == 0
|
||||||
|
and math.min(p.Size.X, p.Size.Y, p.Size.Z) <= 1.2 and math.max(p.Size.X, p.Size.Z) >= 4 then
|
||||||
|
lowPolyPlanks(p, lrng)
|
||||||
|
elseif LOWPOLY_FLAT[p.Material] then
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
p.Color = lowPolyShade(p.Color, lrng, 0.06)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- детали лавки, построенной stall(cf): всё, что лежит в её габаритах прямо в папке parent
|
||||||
|
function Builder.stallParts(cf, parent)
|
||||||
|
local list = {}
|
||||||
|
for _, p in ipairs(parent:GetChildren()) do
|
||||||
|
if p:IsA("BasePart") then
|
||||||
|
local l = cf:PointToObjectSpace(p.Position)
|
||||||
|
if math.abs(l.X) <= 15.5 and l.Y >= -0.5 and l.Y <= 21 and l.Z >= -14.5 and l.Z <= 9.5 then
|
||||||
|
table.insert(list, p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return list
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Доска лидеров (low poly): два столба, двускатная крыша, табличка с названием, фонарики и экран на rows строк.
|
||||||
|
-- cf стоит на полу и смотрит LookVector на зрителей. Строки Row1…RowN заполняет Leaderboards.server.lua.
|
||||||
|
function Builder.leaderboard(cf, board, rows, parent)
|
||||||
|
local model = Instance.new("Model")
|
||||||
|
model.Name = "Leaderboard_" .. board.id
|
||||||
|
model:SetAttribute("Leaderboard", board.id)
|
||||||
|
local function part(props)
|
||||||
|
local p = Instance.new(props.Class or "Part")
|
||||||
|
p.Anchored = true
|
||||||
|
p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
if k ~= "Class" and k ~= "At" then
|
||||||
|
p[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
p.CFrame = cf * props.At
|
||||||
|
p.Parent = model
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
local WOOD, DARK, TRIM = Color3.fromRGB(122, 82, 50), Color3.fromRGB(58, 38, 26), Color3.fromRGB(176, 122, 66)
|
||||||
|
for _, s in ipairs({ -1, 1 }) do
|
||||||
|
part({ Name = "Foot", Size = V(2.2, 1, 2.2), At = CFrame.new(s * 6.6, 0.5, 0), Color = Color3.fromRGB(128, 118, 122) })
|
||||||
|
part({ Name = "Post", Size = V(1.3, 16.5, 1.3), At = CFrame.new(s * 6.6, 8.25, 0), Color = WOOD })
|
||||||
|
-- фонарик на столбе
|
||||||
|
local lamp = part({ Name = "Lantern", Size = V(0.9, 1.2, 0.9), At = CFrame.new(s * 6.6, 14.2, -0.95),
|
||||||
|
Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 196, 110), CanCollide = false })
|
||||||
|
part({ Name = "LanternCap", Size = V(1.2, 0.3, 1.2), At = CFrame.new(s * 6.6, 14.95, -0.95), Color = DARK, CanCollide = false })
|
||||||
|
local light = Instance.new("PointLight")
|
||||||
|
light.Range, light.Brightness, light.Color = 12, 0.9, Color3.fromRGB(255, 190, 110)
|
||||||
|
light.Parent = lamp
|
||||||
|
end
|
||||||
|
local screen = part({ Name = "Screen", Size = V(12, 9.6, 0.5), At = CFrame.new(0, 9.4, 0), Color = DARK })
|
||||||
|
part({ Name = "Trim", Size = V(13.4, 0.6, 0.8), At = CFrame.new(0, 14.5, 0), Color = TRIM })
|
||||||
|
part({ Name = "Trim", Size = V(13.4, 0.6, 0.8), At = CFrame.new(0, 4.3, 0), Color = TRIM })
|
||||||
|
local plaque = part({ Name = "Plaque", Size = V(11, 2.3, 0.7), At = CFrame.new(0, 16.2, -0.1), Color = WOOD })
|
||||||
|
part({ Name = "PlaqueTrim", Size = V(11.6, 2.8, 0.5), At = CFrame.new(0, 16.2, 0.15), Color = TRIM })
|
||||||
|
-- двускатная крыша
|
||||||
|
for _, s in ipairs({ -1, 1 }) do
|
||||||
|
part({ Name = "Roof", Size = V(8, 0.5, 2.6), At = CFrame.new(s * 3.55, 18.35, 0) * CFrame.Angles(0, 0, math.rad(-s * 17)),
|
||||||
|
Color = Color3.fromRGB(150, 70, 52) })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- заголовок
|
||||||
|
local titleGui = Instance.new("SurfaceGui")
|
||||||
|
titleGui.Face = Enum.NormalId.Front
|
||||||
|
titleGui.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||||||
|
titleGui.PixelsPerStud = 40
|
||||||
|
titleGui.LightInfluence = 0
|
||||||
|
titleGui.Parent = plaque
|
||||||
|
local title = Instance.new("TextLabel")
|
||||||
|
title.Size = UDim2.new(1, -16, 1, -8)
|
||||||
|
title.Position = UDim2.fromOffset(8, 4)
|
||||||
|
title.BackgroundTransparency = 1
|
||||||
|
title.Font = Enum.Font.FredokaOne
|
||||||
|
title.TextScaled = true
|
||||||
|
title.Text = board.title
|
||||||
|
title.TextColor3 = board.color
|
||||||
|
title.Parent = titleGui
|
||||||
|
local ts = Instance.new("UIStroke")
|
||||||
|
ts.Color, ts.Thickness = Color3.fromRGB(40, 22, 10), 3
|
||||||
|
ts.Parent = title
|
||||||
|
|
||||||
|
-- строки топа
|
||||||
|
local gui = Instance.new("SurfaceGui")
|
||||||
|
gui.Name = "Rows"
|
||||||
|
gui.Face = Enum.NormalId.Front
|
||||||
|
gui.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||||||
|
gui.PixelsPerStud = 40
|
||||||
|
gui.LightInfluence = 0.2
|
||||||
|
gui.Parent = screen
|
||||||
|
local list = Instance.new("Frame")
|
||||||
|
list.Size = UDim2.new(1, -24, 1, -20)
|
||||||
|
list.Position = UDim2.fromOffset(12, 10)
|
||||||
|
list.BackgroundTransparency = 1
|
||||||
|
list.Parent = gui
|
||||||
|
local layout = Instance.new("UIListLayout")
|
||||||
|
layout.Padding = UDim.new(0, 3)
|
||||||
|
layout.SortOrder = Enum.SortOrder.LayoutOrder
|
||||||
|
layout.Parent = list
|
||||||
|
local RANK_COLOR = { Color3.fromRGB(255, 210, 80), Color3.fromRGB(215, 225, 235), Color3.fromRGB(230, 150, 90) }
|
||||||
|
for i = 1, rows do
|
||||||
|
local row = Instance.new("Frame")
|
||||||
|
row.Name = "Row" .. i
|
||||||
|
row.LayoutOrder = i
|
||||||
|
row.Size = UDim2.new(1, 0, 1 / rows, -3)
|
||||||
|
row.BackgroundColor3 = Color3.fromRGB(255, 240, 210)
|
||||||
|
row.BackgroundTransparency = (i % 2 == 0) and 0.94 or 0.88
|
||||||
|
row.BorderSizePixel = 0
|
||||||
|
row.Parent = list
|
||||||
|
local corner = Instance.new("UICorner")
|
||||||
|
corner.CornerRadius = UDim.new(0, 6)
|
||||||
|
corner.Parent = row
|
||||||
|
local color = RANK_COLOR[i] or Color3.fromRGB(245, 232, 205)
|
||||||
|
local function label(name, pos, size, align, text)
|
||||||
|
local t = Instance.new("TextLabel")
|
||||||
|
t.Name = name
|
||||||
|
t.Position, t.Size = pos, size
|
||||||
|
t.BackgroundTransparency = 1
|
||||||
|
t.Font = Enum.Font.FredokaOne
|
||||||
|
t.TextScaled = true
|
||||||
|
t.TextXAlignment = align
|
||||||
|
t.TextColor3 = color
|
||||||
|
t.Text = text
|
||||||
|
t.Parent = row
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
label("Rank", UDim2.new(0, 6, 0.1, 0), UDim2.new(0, 46, 0.8, 0), Enum.TextXAlignment.Center, ({ "🥇", "🥈", "🥉" })[i] or (i .. "."))
|
||||||
|
label("PlayerName", UDim2.new(0, 58, 0.12, 0), UDim2.new(0.58, -58, 0.76, 0), Enum.TextXAlignment.Left, "—")
|
||||||
|
label("Value", UDim2.new(0.58, 0, 0.12, 0), UDim2.new(0.42, -8, 0.76, 0), Enum.TextXAlignment.Right, "")
|
||||||
|
end
|
||||||
|
-- опора модели — экран, точка опоры на земле под центром доски и без наклона:
|
||||||
|
-- иначе Studio берёт поворот случайной детали (ската крыши) и стрелки инструментов встают наискосок
|
||||||
|
model.PrimaryPart = screen
|
||||||
|
screen.PivotOffset = CFrame.new(0, -9.4, 0)
|
||||||
|
model.Parent = parent
|
||||||
|
return model
|
||||||
|
end
|
||||||
|
|
||||||
-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей
|
-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей
|
||||||
local function stall(cf, opt)
|
local function stall(cf, opt)
|
||||||
local function at(x, y, z)
|
local function at(x, y, z)
|
||||||
@@ -511,42 +875,51 @@ local function stall(cf, opt)
|
|||||||
if opt.decor then
|
if opt.decor then
|
||||||
opt.decor(at)
|
opt.decor(at)
|
||||||
end
|
end
|
||||||
|
Builder.lowPolyParts(Builder.stallParts(cf, map), cf, math.floor(cf.Position.X + cf.Position.Z))
|
||||||
return counter
|
return counter
|
||||||
end
|
end
|
||||||
|
|
||||||
local function portal(baseCF, title, color, worldId, locked)
|
-- Модель портала из ServerStorage.FishingPortalTemplate, перекрашенная в цвет мира и
|
||||||
-- Центральные порталы используют модель, добавленную автором в ServerStorage.
|
-- поставленная основанием на baseCF. Без шаблона возвращает nil (тогда строится старое кольцо).
|
||||||
-- Возвратные порталы в мирах (worldId == "Lobby") сохраняют прежний вид.
|
function Builder.portalModel(baseCF, color, name, parent)
|
||||||
if worldId ~= "Lobby" then
|
local template = ServerStorage:FindFirstChild("FishingPortalTemplate")
|
||||||
local template = ServerStorage:FindFirstChild("FishingPortalTemplate")
|
if not (template and template:IsA("Model")) then
|
||||||
if template and template:IsA("Model") then
|
return nil
|
||||||
local model = template:Clone()
|
end
|
||||||
model.Name = "PortalModel_" .. worldId
|
local model = template:Clone()
|
||||||
for _, part in ipairs(model:GetDescendants()) do
|
model.Name = name
|
||||||
if part:IsA("BasePart") then
|
for _, part in ipairs(model:GetDescendants()) do
|
||||||
local c = part.Color
|
if part:IsA("BasePart") then
|
||||||
local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25
|
local c = part.Color
|
||||||
if part.Material == Enum.Material.Neon then
|
local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25
|
||||||
part.Color = color
|
if part.Material == Enum.Material.Neon then
|
||||||
elseif isGreen then
|
part.Color = color
|
||||||
part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30)
|
elseif isGreen then
|
||||||
part.Material = Enum.Material.SmoothPlastic
|
part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30)
|
||||||
end
|
part.Material = Enum.Material.SmoothPlastic
|
||||||
elseif part:IsA("ParticleEmitter") then
|
|
||||||
part.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
elseif part:IsA("ParticleEmitter") then
|
||||||
|
part.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local pivot = template:GetPivot()
|
local pivot = template:GetPivot()
|
||||||
local boxCFrame, boxSize = template:GetBoundingBox()
|
local boxCFrame, boxSize = template:GetBoundingBox()
|
||||||
local boxBottom = pivot:PointToObjectSpace(Vector3.new(
|
local boxBottom = pivot:PointToObjectSpace(Vector3.new(
|
||||||
boxCFrame.Position.X,
|
boxCFrame.Position.X,
|
||||||
boxCFrame.Position.Y - boxSize.Y / 2,
|
boxCFrame.Position.Y - boxSize.Y / 2,
|
||||||
boxCFrame.Position.Z
|
boxCFrame.Position.Z
|
||||||
)).Y
|
)).Y
|
||||||
model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0))
|
model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0))
|
||||||
model.Parent = map
|
model.Parent = parent
|
||||||
|
return model
|
||||||
|
end
|
||||||
|
|
||||||
|
local function portal(baseCF, title, color, worldId, locked)
|
||||||
|
-- Все порталы, и в лобби, и возвратные в мирах, используют модель автора из ServerStorage.
|
||||||
|
do
|
||||||
|
local model = Builder.portalModel(baseCF, color, "PortalModel_" .. worldId, map)
|
||||||
|
if model then
|
||||||
-- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира.
|
-- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира.
|
||||||
local disc = P({
|
local disc = P({
|
||||||
Name = "Portal_" .. worldId,
|
Name = "Portal_" .. worldId,
|
||||||
@@ -761,6 +1134,13 @@ function Builder.build()
|
|||||||
lobbyCliffs()
|
lobbyCliffs()
|
||||||
lobbyTrees()
|
lobbyTrees()
|
||||||
lobbyRockPlants()
|
lobbyRockPlants()
|
||||||
|
lobbyHills()
|
||||||
|
-- доски лидеров у подножия скал напротив точки появления
|
||||||
|
for i, b in ipairs(Config.Leaderboards.boards) do
|
||||||
|
local a = math.rad(({ 220, 270, 320 })[i] or 270)
|
||||||
|
local p = V(math.cos(a) * 71, FLOOR, math.sin(a) * 71)
|
||||||
|
Builder.leaderboard(CFrame.lookAt(p, V(0, FLOOR, 0)), b, Config.Leaderboards.size, map)
|
||||||
|
end
|
||||||
|
|
||||||
-- магазин (запад) и скупка (восток)
|
-- магазин (запад) и скупка (восток)
|
||||||
stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), {
|
stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), {
|
||||||
@@ -897,12 +1277,31 @@ function Builder.build()
|
|||||||
-- сундук с ежедневной наградой
|
-- сундук с ежедневной наградой
|
||||||
do
|
do
|
||||||
local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50))
|
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) })
|
local template = ServerStorage:FindFirstChild("DailyChestTemplate")
|
||||||
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) })
|
local base
|
||||||
for _, x in ipairs({ -1.8, 1.8 }) do
|
if template and template:IsA("Model") then
|
||||||
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) })
|
-- low poly сундук (Base, Lid, Coins, Lock; замок по +Z модели, опора — низ по центру);
|
||||||
|
-- его анимирует ChestAnimation.client.lua, подсказка и подпись — на невидимой детали
|
||||||
|
local chest = template:Clone()
|
||||||
|
chest.Name = "DailyChest"
|
||||||
|
chest:SetAttribute("DailyChest", true)
|
||||||
|
chest:PivotTo(cf * CFrame.Angles(0, math.pi, 0))
|
||||||
|
for _, p in ipairs(chest:GetDescendants()) do
|
||||||
|
if p:IsA("BasePart") then
|
||||||
|
p.Anchored = true
|
||||||
|
p.CanCollide = p.Name == "Base"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
chest.Parent = map
|
||||||
|
base = P({ Name = "DailyChestPrompt", Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Transparency = 1, CanCollide = false })
|
||||||
|
else
|
||||||
|
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) })
|
||||||
end
|
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")
|
local sp = Instance.new("ParticleEmitter")
|
||||||
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||||||
sp.Rate = 8
|
sp.Rate = 8
|
||||||
@@ -934,8 +1333,12 @@ function Builder.build()
|
|||||||
---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО
|
---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО
|
||||||
do
|
do
|
||||||
-- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново
|
-- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново
|
||||||
local w1map = world1Prebuilt or World1Builder.build(map)
|
local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel)
|
||||||
w1map.Parent = map
|
w1map.Parent = map
|
||||||
|
local baitShop = not world1Prebuilt and w1map:FindFirstChild("BaitShop", true)
|
||||||
|
if baitShop then
|
||||||
|
Builder.lowPolyParts(baitShop:GetDescendants(), baitShop:GetPivot(), 11)
|
||||||
|
end
|
||||||
-- NPC встают на маркеры — их можно двигать в Studio
|
-- NPC встают на маркеры — их можно двигать в Studio
|
||||||
local seller = w1map:FindFirstChild("World1NpcSeller", true)
|
local seller = w1map:FindFirstChild("World1NpcSeller", true)
|
||||||
if seller and not seller:GetAttribute("NpcName") then
|
if seller and not seller:GetAttribute("NpcName") then
|
||||||
@@ -1535,6 +1938,7 @@ local function spawnNpc(spot, parent)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
rig.Name = name
|
rig.Name = name
|
||||||
|
rig:SetAttribute("Npc", true) -- по нему клиент находит NPC (взгляд на игрока, приветствие), сервер — включает idle
|
||||||
local hum = rig:FindFirstChildOfClass("Humanoid")
|
local hum = rig:FindFirstChildOfClass("Humanoid")
|
||||||
hum.DisplayName = name
|
hum.DisplayName = name
|
||||||
hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
|
hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
|
||||||
@@ -1568,9 +1972,29 @@ local function spawnNpc(spot, parent)
|
|||||||
w.C0 = head.CFrame:Inverse() * p.CFrame
|
w.C0 = head.CFrame:Inverse() * p.CFrame
|
||||||
w.Parent = p
|
w.Parent = p
|
||||||
p.Parent = rig
|
p.Parent = rig
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
if spot:GetAttribute("Look") == "Elder" then
|
||||||
|
-- Старейшина Ворон: седые волосы и борода (цвет HatColor), чёрная повязка на глазу
|
||||||
|
local function elderPart(size, offset, color, shape)
|
||||||
|
local p = hatPart(size, offset, shape or Enum.PartType.Block)
|
||||||
|
p.Color = color
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
end
|
||||||
|
elderPart(V(1.25, 0.35, 1.25), CFrame.new(0, 0.55, 0.05), colors.hat)
|
||||||
|
elderPart(V(1.0, 0.75, 0.35), CFrame.new(0, -0.55, -0.5), colors.hat)
|
||||||
|
elderPart(V(0.32, 0.3, 0.08), CFrame.new(0.22, 0.12, -0.6), Color3.fromRGB(20, 20, 22))
|
||||||
|
elderPart(V(1.24, 0.08, 1.24), CFrame.new(0, 0.18, 0) * CFrame.Angles(0, 0, math.rad(-12)), Color3.fromRGB(20, 20, 22))
|
||||||
|
elseif spot:GetAttribute("Look") == "Scarf" then
|
||||||
|
-- платок (цвет HatColor): макушка и узелок сзади
|
||||||
|
local s = hatPart(V(1.3, 0.5, 1.3), CFrame.new(0, 0.42, 0.05), Enum.PartType.Block)
|
||||||
|
s.Material = Enum.Material.SmoothPlastic
|
||||||
|
local k = hatPart(V(0.4, 0.4, 0.3), CFrame.new(0, 0.05, 0.62), Enum.PartType.Block)
|
||||||
|
k.Material = Enum.Material.SmoothPlastic
|
||||||
|
else
|
||||||
|
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
|
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
|
end
|
||||||
local action = spot:GetAttribute("NpcAction")
|
local action = spot:GetAttribute("NpcAction")
|
||||||
if action then
|
if action then
|
||||||
@@ -1578,6 +2002,7 @@ local function spawnNpc(spot, parent)
|
|||||||
end
|
end
|
||||||
return rig
|
return rig
|
||||||
end
|
end
|
||||||
|
Builder.spawnNpc = spawnNpc -- жители лобби (LobbyLife.server.lua) создаются так же
|
||||||
|
|
||||||
-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб
|
-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб
|
||||||
function Builder.prepareRuntime(root)
|
function Builder.prepareRuntime(root)
|
||||||
@@ -1595,6 +2020,23 @@ function Builder.prepareRuntime(root)
|
|||||||
spot.Transparency = 1
|
spot.Transparency = 1
|
||||||
spawnNpc(spot, root)
|
spawnNpc(spot, root)
|
||||||
end
|
end
|
||||||
|
-- порталы лобби двигают в Studio за модель (PortalModel_WorldN); невидимый якорь с подсказкой и подписью
|
||||||
|
-- (Portal_WorldN) и маркер стрелки обучения (GuidePortal, перед порталом в мир 1) встают к модели
|
||||||
|
for _, model in ipairs(root:GetChildren()) do
|
||||||
|
local id = model.Name:match("^PortalModel_(World%d)$")
|
||||||
|
local anchor = id and root:FindFirstChild("Portal_" .. id)
|
||||||
|
if model:IsA("Model") and anchor then
|
||||||
|
local cf, size = model:GetBoundingBox()
|
||||||
|
anchor.CFrame = CFrame.new(cf.Position.X, cf.Position.Y - size.Y / 2 + 10, cf.Position.Z) * (anchor.CFrame - anchor.Position)
|
||||||
|
local marker = id == "World1" and root:FindFirstChild("GuidePortal", true)
|
||||||
|
if marker then
|
||||||
|
local flat = V(cf.Position.X, 0, cf.Position.Z)
|
||||||
|
local outward = flat.Magnitude > 0.1 and flat.Unit or V(0, 0, 1)
|
||||||
|
local p = flat + outward * 5.7
|
||||||
|
marker.CFrame = CFrame.new(p.X, marker.Position.Y, p.Z) * (marker.CFrame - marker.Position)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
for _, board in ipairs(boards) do
|
for _, board in ipairs(boards) do
|
||||||
writeBestiary(board)
|
writeBestiary(board)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,195 @@
|
|||||||
|
-- ActivityFeed (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||||
|
-- Постоянная активность на экране: лента событий игроков (уловы, уровни, покупки) и крупный баннер
|
||||||
|
-- со звуком, когда кто-то ловит редкую или мутировавшую рыбу. События шлёт GameServer: remote "Feed".
|
||||||
|
-- Самые редкие уловы приходят и с других серверов (помечены 🌍). Настройки — Config.Feed.
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local TweenService = game:GetService("TweenService")
|
||||||
|
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
local Audio = require(script.Parent:WaitForChild("Audio"))
|
||||||
|
local Theme = require(script.Parent:WaitForChild("UiTheme"))
|
||||||
|
local C = Theme.C
|
||||||
|
local F = Config.Feed
|
||||||
|
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
local remote = ReplicatedStorage:WaitForChild("GameEvent")
|
||||||
|
|
||||||
|
local function new(class, props, children)
|
||||||
|
local o = Instance.new(class)
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
if k ~= "Parent" then
|
||||||
|
o[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, c in ipairs(children or {}) do
|
||||||
|
c.Parent = o
|
||||||
|
end
|
||||||
|
o.Parent = props.Parent
|
||||||
|
return o
|
||||||
|
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 hex(c)
|
||||||
|
return string.format("#%02X%02X%02X", c.R * 255, c.G * 255, c.B * 255)
|
||||||
|
end
|
||||||
|
local function esc(s)
|
||||||
|
return (tostring(s):gsub("&", "&"):gsub("<", "<"):gsub(">", ">"))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gui = new("ScreenGui", { Name = "ActivityFeed", ResetOnSpawn = false, DisplayOrder = 5, Parent = player:WaitForChild("PlayerGui") })
|
||||||
|
local root = Theme.followScale(gui)
|
||||||
|
|
||||||
|
---------------------------------------------------------------- лента
|
||||||
|
|
||||||
|
local list = new("Frame", { BackgroundTransparency = 1, Parent = root }, {
|
||||||
|
new("UIListLayout", { Padding = UDim.new(0, 4), SortOrder = Enum.SortOrder.LayoutOrder, VerticalAlignment = Enum.VerticalAlignment.Bottom }),
|
||||||
|
})
|
||||||
|
local maxLines = F.lines
|
||||||
|
Theme.onLayout(function(compact)
|
||||||
|
if compact then
|
||||||
|
-- телефон: справа под плашкой погоды (слева внизу — джойстик)
|
||||||
|
list.AnchorPoint = Vector2.new(1, 0)
|
||||||
|
list.Position = UDim2.new(1, -12, 0, 130)
|
||||||
|
list.Size = UDim2.fromOffset(300, 4 * 30)
|
||||||
|
maxLines = 4
|
||||||
|
else
|
||||||
|
list.AnchorPoint = Vector2.new(0, 1)
|
||||||
|
list.Position = UDim2.new(0, 12, 1, -14)
|
||||||
|
list.Size = UDim2.fromOffset(420, F.lines * 30)
|
||||||
|
maxLines = F.lines
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local order = 0
|
||||||
|
local function line(richText)
|
||||||
|
order += 1
|
||||||
|
local rows = {}
|
||||||
|
for _, c in ipairs(list:GetChildren()) do
|
||||||
|
if c:IsA("Frame") then
|
||||||
|
table.insert(rows, c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(rows, function(a, b) return a.LayoutOrder < b.LayoutOrder end)
|
||||||
|
while #rows >= maxLines do
|
||||||
|
table.remove(rows, 1):Destroy()
|
||||||
|
end
|
||||||
|
local row = new("Frame", {
|
||||||
|
Size = UDim2.fromOffset(0, 26), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.woodDark,
|
||||||
|
BackgroundTransparency = 0.25, LayoutOrder = order, Parent = list,
|
||||||
|
}, {
|
||||||
|
new("UICorner", { CornerRadius = UDim.new(0, 8) }),
|
||||||
|
new("UIStroke", { Color = C.goldDark, Thickness = 1, Transparency = 0.5 }),
|
||||||
|
new("UIPadding", { PaddingLeft = UDim.new(0, 10), PaddingRight = UDim.new(0, 10) }),
|
||||||
|
})
|
||||||
|
local label = new("TextLabel", {
|
||||||
|
Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, BackgroundTransparency = 1,
|
||||||
|
FontFace = Theme.BODY2_FACE, TextSize = 15, TextColor3 = C.text, RichText = true, Text = richText,
|
||||||
|
TextXAlignment = Enum.TextXAlignment.Left, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.6, Parent = row,
|
||||||
|
})
|
||||||
|
-- появляется плавно, через lineTime так же уходит
|
||||||
|
row.BackgroundTransparency, label.TextTransparency = 1, 1
|
||||||
|
TweenService:Create(row, TweenInfo.new(0.3), { BackgroundTransparency = 0.25 }):Play()
|
||||||
|
TweenService:Create(label, TweenInfo.new(0.3), { TextTransparency = 0 }):Play()
|
||||||
|
task.delay(F.lineTime, function()
|
||||||
|
if row.Parent then
|
||||||
|
TweenService:Create(row, TweenInfo.new(0.6), { BackgroundTransparency = 1 }):Play()
|
||||||
|
TweenService:Create(label, TweenInfo.new(0.6), { TextTransparency = 1, TextStrokeTransparency = 1 }):Play()
|
||||||
|
task.wait(0.65)
|
||||||
|
row:Destroy()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- баннер редкого улова
|
||||||
|
|
||||||
|
local banner = new("Frame", {
|
||||||
|
-- внизу над полосой подсечки (она занимает 100…224 px от низа): верх экрана — для своих уведомлений и карточки улова
|
||||||
|
Size = UDim2.fromOffset(560, 92), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -240),
|
||||||
|
BackgroundColor3 = Color3.new(1, 1, 1), Visible = false, ZIndex = 20, Parent = root,
|
||||||
|
}, { new("UICorner", { CornerRadius = UDim.new(0, 12) }), Theme.woodGradient(C.wood, C.woodDark) })
|
||||||
|
local bannerStroke = new("UIStroke", { Thickness = 3, Color = C.gold, Parent = banner })
|
||||||
|
Theme.innerBorder(banner, 5, 8, C.gold, 0.45)
|
||||||
|
Theme.rivets(banner, 8, 6)
|
||||||
|
local bannerScale = new("UIScale", { Parent = banner })
|
||||||
|
local bTop = new("TextLabel", {
|
||||||
|
Size = UDim2.new(1, -30, 0, 20), Position = UDim2.fromOffset(15, 8), BackgroundTransparency = 1, ZIndex = 21,
|
||||||
|
FontFace = Theme.BODY_FACE, TextSize = 15, TextColor3 = C.muted, Text = "", Parent = banner,
|
||||||
|
})
|
||||||
|
local bMain = new("TextLabel", {
|
||||||
|
Size = UDim2.new(1, -30, 0, 34), Position = UDim2.fromOffset(15, 28), BackgroundTransparency = 1, ZIndex = 21,
|
||||||
|
FontFace = Theme.TITLE_FACE, TextSize = 26, TextColor3 = C.text, RichText = true, TextScaled = true, Text = "",
|
||||||
|
TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.4, Parent = banner,
|
||||||
|
})
|
||||||
|
new("UITextSizeConstraint", { MaxTextSize = 26, Parent = bMain })
|
||||||
|
local bSub = new("TextLabel", {
|
||||||
|
Size = UDim2.new(1, -30, 0, 20), Position = UDim2.fromOffset(15, 64), BackgroundTransparency = 1, ZIndex = 21,
|
||||||
|
FontFace = Theme.BODY2_FACE, TextSize = 15, TextColor3 = C.text, RichText = true, Text = "", Parent = banner,
|
||||||
|
})
|
||||||
|
|
||||||
|
local queue, showing = {}, false
|
||||||
|
local function showNext()
|
||||||
|
local info = table.remove(queue, 1)
|
||||||
|
if not info then
|
||||||
|
showing = false
|
||||||
|
return
|
||||||
|
end
|
||||||
|
showing = true
|
||||||
|
local r = Config.Rarities[info.rarity] or Config.Rarities.Common
|
||||||
|
local mut = info.mutation and Config.Find(Config.Mutations, info.mutation)
|
||||||
|
local color = mut and mut.color or r.color
|
||||||
|
bannerStroke.Color = color
|
||||||
|
bTop.Text = info.remote and "🌍 УЛОВ НА ДРУГОМ СЕРВЕРЕ" or "🌟 РЕДКИЙ УЛОВ"
|
||||||
|
bTop.TextColor3 = color
|
||||||
|
-- мутация — отдельной меткой: её название в женском роде («Золотая» рыба), а у рыбы может быть любой
|
||||||
|
bMain.Text = ("<b>%s</b> поймал <font color=\"%s\">%s</font>%s!"):format(esc(info.name), hex(color),
|
||||||
|
esc(info.fish), mut and (" <font color=\"%s\">✦ %s</font>"):format(hex(mut.color), mut.name) or "")
|
||||||
|
bSub.Text = ("<font color=\"%s\">%s</font> · %s %s%s"):format(hex(r.color), r.name, fmt(info.value or 0), Theme.SILVER,
|
||||||
|
info.world and (" · " .. info.world) or "")
|
||||||
|
banner.Visible = true
|
||||||
|
bannerScale.Scale = 0.4
|
||||||
|
TweenService:Create(bannerScale, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
|
||||||
|
-- звук: легендарная, мифическая и радужная — фанфары, остальное — искристый звон
|
||||||
|
local grand = r.rank >= 5 or info.mutation == "Rainbow"
|
||||||
|
Audio.play(grand and "fanfare" or "sparkle")
|
||||||
|
task.delay(4.2, function()
|
||||||
|
TweenService:Create(bannerScale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.In), { Scale = 0 }):Play()
|
||||||
|
task.wait(0.3)
|
||||||
|
banner.Visible = false
|
||||||
|
showNext()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- события
|
||||||
|
|
||||||
|
local RANK_ICON = { "🎣", "🎣", "🐟", "✨", "🌟", "💫" }
|
||||||
|
remote.OnClientEvent:Connect(function(action, kind, info)
|
||||||
|
if action ~= "Feed" or type(info) ~= "table" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local who = ("<b>%s</b>"):format(esc(info.name or "?"))
|
||||||
|
if kind == "catch" then
|
||||||
|
local r = Config.Rarities[info.rarity] or Config.Rarities.Common
|
||||||
|
local mut = info.mutation and Config.Find(Config.Mutations, info.mutation)
|
||||||
|
local color = mut and mut.color or r.color
|
||||||
|
line(("%s%s %s поймал <font color=\"%s\">%s</font>%s%s"):format(
|
||||||
|
info.remote and "🌍 " or "", RANK_ICON[r.rank] or "🎣", who, hex(color), esc(info.fish),
|
||||||
|
mut and (" <font color=\"%s\">✦ %s</font>"):format(hex(mut.color), mut.name) or "",
|
||||||
|
r.rank >= 3 and (" <font color=\"%s\">· %s</font>"):format(hex(r.color), r.name) or ""))
|
||||||
|
-- свой улов игрок и так видит крупно — баннер только про других
|
||||||
|
if info.big and info.userId ~= player.UserId then
|
||||||
|
table.insert(queue, info)
|
||||||
|
if not showing then
|
||||||
|
showNext()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif kind == "level" then
|
||||||
|
line(("⭐ %s достиг уровня <font color=\"%s\">%d</font>"):format(who, Theme.HEX.gold, info.level or 0))
|
||||||
|
elseif kind == "buy" then
|
||||||
|
line(("💎 %s купил %s"):format(who, esc(info.item or "")))
|
||||||
|
end
|
||||||
|
end)
|
||||||
@@ -0,0 +1,395 @@
|
|||||||
|
-- Ambience (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||||
|
-- Атмосфера у этого игрока: время суток, ночной свет, тучи, дождь/снег, молнии, музыка и звуки окружения,
|
||||||
|
-- плашка «погода и время» на экране. Время и погоду задаёт сервер (WeatherServer) атрибутами workspace.
|
||||||
|
-- Свет локации (Config.Worlds[*].look) ставит FishingClient; здесь всё накладывается поверх:
|
||||||
|
-- свои эффекты цвета живут в камере, поэтому не мешают настройкам локаций.
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
local TweenService = game:GetService("TweenService")
|
||||||
|
local Lighting = game:GetService("Lighting")
|
||||||
|
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
local Audio = require(script.Parent:WaitForChild("Audio"))
|
||||||
|
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
local terrain = workspace.Terrain
|
||||||
|
local rng = Random.new()
|
||||||
|
local WHITE = Color3.new(1, 1, 1)
|
||||||
|
|
||||||
|
local function new(class, props)
|
||||||
|
local o = Instance.new(class)
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
if k ~= "Parent" then
|
||||||
|
o[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
o.Parent = props.Parent
|
||||||
|
return o
|
||||||
|
end
|
||||||
|
|
||||||
|
local function clockNow()
|
||||||
|
return Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart"))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function currentPlace()
|
||||||
|
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
if not hrp then
|
||||||
|
return nil, "Lobby"
|
||||||
|
end
|
||||||
|
local w = Config.WorldAt(hrp.Position)
|
||||||
|
return w, w and w.id or "Lobby"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function currentWeather()
|
||||||
|
return Config.WeatherById(workspace:GetAttribute("Weather"))
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- вид погоды
|
||||||
|
|
||||||
|
-- cc — поправка цвета поверх света локации; cover/density/cloud — облака; rain — частиц в секунду
|
||||||
|
local LOOK = {
|
||||||
|
Clear = { cover = 0.4, density = 0.45, cloud = Color3.fromRGB(255, 255, 255), rain = 0,
|
||||||
|
cc = { Brightness = 0, Saturation = 0, Contrast = 0, TintColor = WHITE } },
|
||||||
|
Cloudy = { cover = 0.78, density = 0.6, cloud = Color3.fromRGB(215, 218, 226), rain = 0,
|
||||||
|
cc = { Brightness = -0.03, Saturation = -0.1, Contrast = 0, TintColor = Color3.fromRGB(236, 239, 246) } },
|
||||||
|
Rain = { cover = 0.88, density = 0.75, cloud = Color3.fromRGB(165, 170, 182), rain = 350, rainSound = "rainLight",
|
||||||
|
cc = { Brightness = -0.06, Saturation = -0.18, Contrast = 0.02, TintColor = Color3.fromRGB(214, 224, 240) } },
|
||||||
|
Storm = { cover = 0.96, density = 0.9, cloud = Color3.fromRGB(105, 110, 124), rain = 900, rainSound = "rainHeavy", lightning = true,
|
||||||
|
cc = { Brightness = -0.12, Saturation = -0.3, Contrast = 0.06, TintColor = Color3.fromRGB(190, 200, 226) } },
|
||||||
|
Fog = { cover = 0.6, density = 0.5, cloud = Color3.fromRGB(232, 232, 238), rain = 0,
|
||||||
|
cc = { Brightness = 0.02, Saturation = -0.22, Contrast = -0.05, TintColor = Color3.fromRGB(234, 238, 242) } },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- эффекты в камере: действуют только у этого игрока и не путаются с эффектами Lighting
|
||||||
|
local camera = workspace.CurrentCamera
|
||||||
|
local weatherCC = new("ColorCorrectionEffect", { Name = "WeatherCC", Parent = camera })
|
||||||
|
local nightCC = new("ColorCorrectionEffect", { Name = "NightCC", Parent = camera })
|
||||||
|
-- цветокоррекция действует только на 3D-сцену, экран загрузки она не затемняет — выключать её на время загрузки не нужно
|
||||||
|
workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
|
||||||
|
camera = workspace.CurrentCamera
|
||||||
|
weatherCC.Parent = camera
|
||||||
|
nightCC.Parent = camera
|
||||||
|
end)
|
||||||
|
|
||||||
|
local clouds = terrain:FindFirstChildOfClass("Clouds") or new("Clouds", { Parent = terrain })
|
||||||
|
|
||||||
|
-- дождь (а во фьорде — снег) сыплется из невидимой плиты над камерой
|
||||||
|
local rainPart = new("Part", {
|
||||||
|
Name = "RainFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false,
|
||||||
|
Transparency = 1, Size = Vector3.new(110, 1, 110), Parent = workspace,
|
||||||
|
})
|
||||||
|
local rain = new("ParticleEmitter", {
|
||||||
|
Texture = "rbxasset://textures/SelfView/whiteRect.png",
|
||||||
|
Rate = 0, Lifetime = NumberRange.new(1.1, 1.4), Speed = NumberRange.new(55, 70),
|
||||||
|
EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(4, 4),
|
||||||
|
Orientation = Enum.ParticleOrientation.VelocityParallel,
|
||||||
|
Size = NumberSequence.new(0.07), Squash = NumberSequence.new(2.5),
|
||||||
|
Color = ColorSequence.new(Color3.fromRGB(200, 215, 235)), Transparency = NumberSequence.new(0.45),
|
||||||
|
LightInfluence = 1,
|
||||||
|
Parent = rainPart,
|
||||||
|
})
|
||||||
|
|
||||||
|
local function rainStyle(snowy)
|
||||||
|
if snowy then
|
||||||
|
rain.Speed = NumberRange.new(6, 10)
|
||||||
|
rain.Lifetime = NumberRange.new(5, 7)
|
||||||
|
rain.Size = NumberSequence.new(0.22)
|
||||||
|
rain.Squash = NumberSequence.new(0)
|
||||||
|
rain.SpreadAngle = Vector2.new(25, 25)
|
||||||
|
rain.Orientation = Enum.ParticleOrientation.FacingCamera
|
||||||
|
rain.Color = ColorSequence.new(WHITE)
|
||||||
|
rain.Transparency = NumberSequence.new(0.1)
|
||||||
|
else
|
||||||
|
rain.Speed = NumberRange.new(55, 70)
|
||||||
|
rain.Lifetime = NumberRange.new(1.1, 1.4)
|
||||||
|
rain.Size = NumberSequence.new(0.07)
|
||||||
|
rain.Squash = NumberSequence.new(2.5)
|
||||||
|
rain.SpreadAngle = Vector2.new(4, 4)
|
||||||
|
rain.Orientation = Enum.ParticleOrientation.VelocityParallel
|
||||||
|
rain.Color = ColorSequence.new(Color3.fromRGB(200, 215, 235))
|
||||||
|
rain.Transparency = NumberSequence.new(0.45)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local appliedWeather, appliedPlace = nil, nil
|
||||||
|
local function applyWeather(instant)
|
||||||
|
local w = currentWeather()
|
||||||
|
local _, placeId = currentPlace()
|
||||||
|
if appliedWeather == w.id and appliedPlace == placeId and not instant then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
appliedWeather, appliedPlace = w.id, placeId
|
||||||
|
local look = LOOK[w.id] or LOOK.Clear
|
||||||
|
local info = TweenInfo.new(instant and 0 or 6)
|
||||||
|
TweenService:Create(weatherCC, info, look.cc):Play()
|
||||||
|
TweenService:Create(clouds, info, { Cover = look.cover, Density = look.density }):Play() -- цвет туч ставит главный цикл (с учётом ночи)
|
||||||
|
local snowy = placeId == "World3"
|
||||||
|
rainStyle(snowy)
|
||||||
|
rain.Rate = snowy and look.rain * 0.35 or look.rain
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- молнии
|
||||||
|
|
||||||
|
task.spawn(function()
|
||||||
|
while true do
|
||||||
|
task.wait(rng:NextNumber(6, 16))
|
||||||
|
local w = currentWeather()
|
||||||
|
local _, placeId = currentPlace()
|
||||||
|
if LOOK[w.id] and LOOK[w.id].lightning and placeId ~= "World3" then
|
||||||
|
-- двойная вспышка, гром приходит чуть позже (молния далеко)
|
||||||
|
local base = weatherCC.Brightness
|
||||||
|
for _ = 1, 2 do
|
||||||
|
weatherCC.Brightness = base + 0.45
|
||||||
|
task.wait(0.06)
|
||||||
|
weatherCC.Brightness = base
|
||||||
|
task.wait(0.09)
|
||||||
|
end
|
||||||
|
local far = rng:NextNumber()
|
||||||
|
task.delay(0.2 + far * 1.4, function()
|
||||||
|
local list = Config.Sounds.thunder
|
||||||
|
Audio.playId(list[rng:NextInteger(1, #list)], 0.9 - far * 0.5, "ambient")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
---------------------------------------------------------------- музыка
|
||||||
|
|
||||||
|
local tracks = {}
|
||||||
|
local function track(name)
|
||||||
|
if not tracks[name] then
|
||||||
|
tracks[name] = Audio.loop(name, "music")
|
||||||
|
end
|
||||||
|
return tracks[name]
|
||||||
|
end
|
||||||
|
|
||||||
|
local currentTrack = nil
|
||||||
|
local function musicFor(placeId, night)
|
||||||
|
if night and placeId ~= "World2" then
|
||||||
|
return "musicNight"
|
||||||
|
end
|
||||||
|
if placeId == "Lobby" then
|
||||||
|
return (math.floor(workspace:GetServerTimeNow() / 600) % 2 == 0) and "musicLobby" or "musicLobby2"
|
||||||
|
elseif placeId == "World1" then
|
||||||
|
return (math.floor(workspace:GetServerTimeNow() / 600) % 2 == 0) and "musicLake" or "musicLake2"
|
||||||
|
elseif placeId == "World3" then
|
||||||
|
return "musicNight"
|
||||||
|
end
|
||||||
|
return "musicLake2"
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- звуки окружения
|
||||||
|
|
||||||
|
local ambient = {}
|
||||||
|
for _, name in ipairs({ "birdsLake", "birdsPark", "birdsJungle", "crickets", "lakeWater", "wind", "rainLight", "rainHeavy" }) do
|
||||||
|
ambient[name] = Audio.loop(name, "ambient")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- какие петли и насколько громко звучат сейчас
|
||||||
|
local function ambientMix(placeId, night, w)
|
||||||
|
local mix = {}
|
||||||
|
local day = not night
|
||||||
|
mix.birdsLake = (day and placeId == "World1") and 1 or 0
|
||||||
|
mix.birdsPark = (day and placeId == "Lobby") and 1 or 0
|
||||||
|
mix.birdsJungle = (day and placeId == "World2") and 1 or 0
|
||||||
|
mix.crickets = (night and placeId ~= "World3") and 1 or 0
|
||||||
|
mix.lakeWater = (placeId == "World1" or placeId == "World2") and 1 or 0
|
||||||
|
local wind = 1
|
||||||
|
if placeId == "World3" then
|
||||||
|
wind = 2.5
|
||||||
|
end
|
||||||
|
if w.id == "Storm" then
|
||||||
|
wind *= 2
|
||||||
|
end
|
||||||
|
mix.wind = wind
|
||||||
|
local wet = placeId ~= "World3"
|
||||||
|
mix.rainLight = (wet and w.id == "Rain") and 1 or 0
|
||||||
|
mix.rainHeavy = (wet and w.id == "Storm") and 1 or 0
|
||||||
|
-- в дождь птицы прячутся
|
||||||
|
if w.id == "Rain" or w.id == "Storm" then
|
||||||
|
mix.birdsLake, mix.birdsPark, mix.birdsJungle = 0, 0, 0
|
||||||
|
end
|
||||||
|
return mix
|
||||||
|
end
|
||||||
|
|
||||||
|
-- треск у каждого костра на карте (звук в самом костре: слышно только рядом)
|
||||||
|
task.spawn(function()
|
||||||
|
local map = workspace:WaitForChild("FishingMap", 60)
|
||||||
|
if not map then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
task.wait(3)
|
||||||
|
local def = Config.Sounds.fire
|
||||||
|
for _, d in ipairs(map:GetDescendants()) do
|
||||||
|
if d:IsA("Fire") and d.Parent and d.Parent:IsA("BasePart") then
|
||||||
|
new("Sound", {
|
||||||
|
Name = "FireCrackle", SoundId = def.id, Volume = def.volume, Looped = true, Playing = true,
|
||||||
|
RollOffMode = Enum.RollOffMode.InverseTapered, RollOffMinDistance = 6, RollOffMaxDistance = def.roll or 30,
|
||||||
|
SoundGroup = Audio.groups.ambient, Parent = d.Parent,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
---------------------------------------------------------------- плашка «погода и время»
|
||||||
|
|
||||||
|
-- в стиле интерфейса (UiTheme): тёмное дерево с золотой рамкой; масштаб — как у основного интерфейса
|
||||||
|
local Theme = require(script.Parent:WaitForChild("UiTheme"))
|
||||||
|
local hud = new("ScreenGui", { Name = "WeatherHud", ResetOnSpawn = false, IgnoreGuiInset = false, Parent = player:WaitForChild("PlayerGui") })
|
||||||
|
local pill = new("Frame", {
|
||||||
|
Size = UDim2.fromOffset(230, 48), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 74),
|
||||||
|
BackgroundColor3 = Theme.C.woodDark, BackgroundTransparency = 0.08, Parent = Theme.followScale(hud),
|
||||||
|
})
|
||||||
|
new("UICorner", { CornerRadius = UDim.new(0, 8), Parent = pill })
|
||||||
|
local pillStroke = new("UIStroke", { Color = Theme.C.goldDark, Thickness = 2, Transparency = 0, Parent = pill })
|
||||||
|
local line1 = new("TextLabel", {
|
||||||
|
Size = UDim2.new(1, -16, 0, 24), Position = UDim2.fromOffset(10, 3), BackgroundTransparency = 1,
|
||||||
|
FontFace = Theme.TITLE_FACE, TextSize = 16, TextColor3 = Theme.C.parchment, TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
|
Text = "", Parent = pill,
|
||||||
|
})
|
||||||
|
local line2 = new("TextLabel", {
|
||||||
|
Size = UDim2.new(1, -16, 0, 16), Position = UDim2.fromOffset(10, 27), BackgroundTransparency = 1,
|
||||||
|
FontFace = Theme.BODY2_FACE, TextSize = 12, TextColor3 = Color3.fromRGB(170, 215, 140), TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
|
Text = "", Parent = pill,
|
||||||
|
})
|
||||||
|
|
||||||
|
local function weatherName(w, placeId)
|
||||||
|
return (w.names and w.names[placeId]) or w.name
|
||||||
|
end
|
||||||
|
|
||||||
|
local lastShownWeather = nil
|
||||||
|
local function refreshPill(clock, night, w, placeId)
|
||||||
|
local h = math.floor(clock)
|
||||||
|
local m = math.floor((clock - h) * 60)
|
||||||
|
line1.Text = ("%s %s · %s %02d:%02d"):format(w.icon, weatherName(w, placeId), night and "🌙" or "☀", h, m)
|
||||||
|
local bonus = {}
|
||||||
|
if w.desc then
|
||||||
|
table.insert(bonus, w.desc)
|
||||||
|
end
|
||||||
|
if night then
|
||||||
|
table.insert(bonus, ("Ночь: удача +%d%%"):format(math.floor(Config.DayNight.nightLuck * 100 + 0.5)))
|
||||||
|
end
|
||||||
|
line2.Text = #bonus > 0 and table.concat(bonus, " · ") or "Спокойная погода"
|
||||||
|
if lastShownWeather ~= w.id then
|
||||||
|
-- погода сменилась: плашка вспыхивает
|
||||||
|
if lastShownWeather ~= nil then
|
||||||
|
pillStroke.Color = Color3.fromRGB(255, 220, 120)
|
||||||
|
pillStroke.Transparency = 0
|
||||||
|
TweenService:Create(pillStroke, TweenInfo.new(2.5), { Color = Theme.C.goldDark, Transparency = 0 }):Play()
|
||||||
|
end
|
||||||
|
lastShownWeather = w.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- фонари: днём погашены, к ночи зажигаются
|
||||||
|
-- лампа — небольшая неоновая деталь со светом внутри (фонари площади, лавок, досок лидеров, домиков).
|
||||||
|
-- Днём неон и свет дают пересвет и ореолы, поэтому лампа становится матовым тёплым стеклом без света.
|
||||||
|
-- Порталы и прочее крупное свечение не трогаем.
|
||||||
|
|
||||||
|
local LAMP_ON_AT = 0.3 -- с какой «ночности» (0 — день, 1 — ночь) фонари зажигаются
|
||||||
|
local lamps, lampScanAt, lampsLit = {}, -math.huge, nil
|
||||||
|
|
||||||
|
local function scanLamps()
|
||||||
|
local map = workspace:FindFirstChild("FishingMap")
|
||||||
|
if not map then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, d in ipairs(map:GetDescendants()) do
|
||||||
|
if d:IsA("Light") and d.Parent:IsA("BasePart") and not lamps[d.Parent] then
|
||||||
|
local bulb = d.Parent
|
||||||
|
local s = bulb.Size
|
||||||
|
if bulb.Material == Enum.Material.Neon and math.max(s.X, s.Y, s.Z) <= 2.5 then
|
||||||
|
lamps[bulb] = { color = bulb.Color, lights = {} }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for bulb, l in pairs(lamps) do
|
||||||
|
table.clear(l.lights)
|
||||||
|
for _, c in ipairs(bulb:GetChildren()) do
|
||||||
|
if c:IsA("Light") then
|
||||||
|
table.insert(l.lights, c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function updateLamps(nightness)
|
||||||
|
if os.clock() - lampScanAt > 10 then
|
||||||
|
lampScanAt = os.clock()
|
||||||
|
scanLamps()
|
||||||
|
lampsLit = nil -- новые лампы — применить ещё раз
|
||||||
|
end
|
||||||
|
local lit = nightness >= LAMP_ON_AT
|
||||||
|
if lit == lampsLit then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
lampsLit = lit
|
||||||
|
for bulb, l in pairs(lamps) do
|
||||||
|
if bulb.Parent then
|
||||||
|
bulb.Material = lit and Enum.Material.Neon or Enum.Material.SmoothPlastic
|
||||||
|
-- погашенная лампа — тёплое матовое стекло чуть темнее горящей
|
||||||
|
bulb.Color = lit and l.color or l.color:Lerp(Color3.fromRGB(150, 120, 90), 0.35)
|
||||||
|
for _, light in ipairs(l.lights) do
|
||||||
|
light.Enabled = lit
|
||||||
|
end
|
||||||
|
else
|
||||||
|
lamps[bulb] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- главный цикл
|
||||||
|
|
||||||
|
-- часы двигаются каждый кадр (плавно), остальное проверяется раз в полсекунды
|
||||||
|
RunService.RenderStepped:Connect(function()
|
||||||
|
if Config.DayNight.enabled then
|
||||||
|
Lighting.ClockTime = clockNow()
|
||||||
|
end
|
||||||
|
if camera then
|
||||||
|
rainPart.CFrame = CFrame.new(camera.CFrame.Position + Vector3.new(0, 35, 0))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
workspace:GetAttributeChangedSignal("Weather"):Connect(function()
|
||||||
|
applyWeather(false)
|
||||||
|
end)
|
||||||
|
applyWeather(true)
|
||||||
|
|
||||||
|
task.spawn(function()
|
||||||
|
while true do
|
||||||
|
local clock = clockNow()
|
||||||
|
local nightness = Config.DayNight.enabled and Config.Nightness(clock) or 0
|
||||||
|
local night = nightness >= 0.5
|
||||||
|
updateLamps(nightness)
|
||||||
|
local w = currentWeather()
|
||||||
|
local _, placeId = currentPlace()
|
||||||
|
|
||||||
|
-- ночь: темнее, холоднее, менее насыщенно
|
||||||
|
nightCC.Brightness = -0.1 * nightness
|
||||||
|
nightCC.Saturation = -0.18 * nightness
|
||||||
|
nightCC.TintColor = WHITE:Lerp(Color3.fromRGB(165, 185, 255), nightness)
|
||||||
|
clouds.Color = (LOOK[w.id] or LOOK.Clear).cloud:Lerp(Color3.fromRGB(40, 45, 60), nightness * 0.8)
|
||||||
|
|
||||||
|
applyWeather(false) -- смена локации меняет дождь на снег и обратно
|
||||||
|
|
||||||
|
-- музыка: плавная смена трека, в грозу тише
|
||||||
|
local want = musicFor(placeId, night)
|
||||||
|
local duck = (w.id == "Storm") and 0.5 or 1
|
||||||
|
if currentTrack ~= want then
|
||||||
|
if currentTrack then
|
||||||
|
Audio.fade(track(currentTrack), 0, 3)
|
||||||
|
end
|
||||||
|
currentTrack = want
|
||||||
|
end
|
||||||
|
Audio.fade(track(want), duck, 3)
|
||||||
|
|
||||||
|
for name, factor in pairs(ambientMix(placeId, night, w)) do
|
||||||
|
Audio.fade(ambient[name], factor, 3)
|
||||||
|
end
|
||||||
|
|
||||||
|
refreshPill(clock, night, w, placeId)
|
||||||
|
task.wait(0.5)
|
||||||
|
end
|
||||||
|
end)
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
-- Audio (ModuleScript) -> StarterPlayer > StarterPlayerScripts
|
||||||
|
-- Звуки у этого игрока. Три группы громкости: музыка, эффекты и окружение (окружение — по громкости эффектов).
|
||||||
|
-- Громкость берётся из атрибутов игрока VolMusic / VolSfx (их выставляет и сохраняет сервер).
|
||||||
|
-- Audio.play(name) — разовый звук из Config.Sounds
|
||||||
|
-- Audio.loop(name, group) — петля (молчит, пока не вызвать Audio.fade)
|
||||||
|
-- Audio.fade(sound, factor) — плавно к громкости «базовая × factor» (0 — тишина, звук ставится на паузу)
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local SoundService = game:GetService("SoundService")
|
||||||
|
local TweenService = game:GetService("TweenService")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
local rng = Random.new()
|
||||||
|
|
||||||
|
local Audio = {}
|
||||||
|
|
||||||
|
local function group(name)
|
||||||
|
local g = SoundService:FindFirstChild(name)
|
||||||
|
if not g then
|
||||||
|
g = Instance.new("SoundGroup")
|
||||||
|
g.Name = name
|
||||||
|
g.Parent = SoundService
|
||||||
|
end
|
||||||
|
return g
|
||||||
|
end
|
||||||
|
Audio.groups = {
|
||||||
|
music = group("MusicGroup"),
|
||||||
|
sfx = group("SfxGroup"),
|
||||||
|
ambient = group("AmbientGroup"),
|
||||||
|
}
|
||||||
|
|
||||||
|
local function applyVolumes()
|
||||||
|
local music = player:GetAttribute("VolMusic") or Config.DefaultVolume.music
|
||||||
|
local sfx = player:GetAttribute("VolSfx") or Config.DefaultVolume.sfx
|
||||||
|
Audio.groups.music.Volume = music
|
||||||
|
Audio.groups.sfx.Volume = sfx
|
||||||
|
Audio.groups.ambient.Volume = sfx
|
||||||
|
end
|
||||||
|
applyVolumes()
|
||||||
|
player:GetAttributeChangedSignal("VolMusic"):Connect(applyVolumes)
|
||||||
|
player:GetAttributeChangedSignal("VolSfx"):Connect(applyVolumes)
|
||||||
|
|
||||||
|
function Audio.play(name, volumeMult)
|
||||||
|
local def = Config.Sounds[name]
|
||||||
|
if not def or not def.id then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local s = Instance.new("Sound")
|
||||||
|
s.SoundId = def.id
|
||||||
|
s.Volume = (def.volume or 0.5) * (volumeMult or 1)
|
||||||
|
if def.pitch then
|
||||||
|
s.PlaybackSpeed = rng:NextNumber(def.pitch[1], def.pitch[2])
|
||||||
|
end
|
||||||
|
s.SoundGroup = Audio.groups.sfx
|
||||||
|
s.Parent = SoundService
|
||||||
|
s:Play()
|
||||||
|
s.Ended:Connect(function()
|
||||||
|
s:Destroy()
|
||||||
|
end)
|
||||||
|
task.delay(30, function()
|
||||||
|
if s.Parent then
|
||||||
|
s:Destroy()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
-- разовый звук по прямому id (например, случайный раскат грома из списка)
|
||||||
|
function Audio.playId(id, volume, groupName)
|
||||||
|
local s = Instance.new("Sound")
|
||||||
|
s.SoundId = id
|
||||||
|
s.Volume = volume or 0.5
|
||||||
|
s.SoundGroup = Audio.groups[groupName or "sfx"]
|
||||||
|
s.Parent = SoundService
|
||||||
|
s:Play()
|
||||||
|
s.Ended:Connect(function()
|
||||||
|
s:Destroy()
|
||||||
|
end)
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
function Audio.loop(name, groupName)
|
||||||
|
local def = Config.Sounds[name]
|
||||||
|
if not def then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local s = Instance.new("Sound")
|
||||||
|
s.Name = name
|
||||||
|
s.SoundId = def.id
|
||||||
|
s.Looped = true
|
||||||
|
s.Volume = 0
|
||||||
|
s.SoundGroup = Audio.groups[groupName or "ambient"]
|
||||||
|
s:SetAttribute("BaseVolume", def.volume or 0.5)
|
||||||
|
s.Parent = SoundService
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
local fades = {}
|
||||||
|
function Audio.fade(s, factor, time)
|
||||||
|
if not s then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local target = (s:GetAttribute("BaseVolume") or 0.5) * (factor or 0)
|
||||||
|
if fades[s] and fades[s].target == target then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if fades[s] then
|
||||||
|
fades[s].tween:Cancel()
|
||||||
|
end
|
||||||
|
if target > 0 and not s.IsPlaying then
|
||||||
|
s:Resume()
|
||||||
|
if not s.IsPlaying then
|
||||||
|
s:Play()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local tw = TweenService:Create(s, TweenInfo.new(time or 2), { Volume = target })
|
||||||
|
fades[s] = { tween = tw, target = target }
|
||||||
|
tw.Completed:Connect(function(state)
|
||||||
|
if state == Enum.PlaybackState.Completed and target <= 0.001 then
|
||||||
|
s:Pause()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
tw:Play()
|
||||||
|
end
|
||||||
|
|
||||||
|
return Audio
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
-- ChestAnimation (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||||
|
-- Сундук ежедневной награды (модель с атрибутом DailyChest: Base, Lid, Coins, Lock) оживает у каждого игрока:
|
||||||
|
-- подпрыгивает, на падении крышка откидывается, после удара о землю монеты подскакивают, крышка остаётся
|
||||||
|
-- приоткрытой, потом плавно возвращается. На ударе — глухой стук, звон монет и облачко пыли.
|
||||||
|
-- Анимация только на клиенте: сервер сундук не двигает.
|
||||||
|
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
local Audio = require(script.Parent:WaitForChild("Audio"))
|
||||||
|
|
||||||
|
local HOP = 2.1 -- высота прыжка, studs
|
||||||
|
local LID_FALL = 32 -- на сколько градусов откидывается крышка в падении
|
||||||
|
local LID_REST = 14 -- приоткрыта после приземления
|
||||||
|
local COIN_HOP = 0.55 -- подскок монет
|
||||||
|
local PERIOD = 5 -- секунд на весь цикл (прыжок + пауза)
|
||||||
|
local VIEW_DIST = 150 -- дальше камеры не анимируем
|
||||||
|
|
||||||
|
-- 0..1: прыжок вверх, падение, приземление, удержание, закрытие крышки
|
||||||
|
local T_UP, T_DOWN, T_LAND, T_HOLD, T_CLOSE = 0.34, 0.3, 0.5, 2.3, 0.7
|
||||||
|
local T_IMPACT = T_UP + T_DOWN -- момент удара о землю
|
||||||
|
|
||||||
|
local function easeOut(x) return 1 - (1 - x) ^ 2 end
|
||||||
|
local function easeIn(x) return x * x end
|
||||||
|
local function smooth(x) return x * x * (3 - 2 * x) end
|
||||||
|
|
||||||
|
local chest, rest, fx
|
||||||
|
|
||||||
|
-- звуки идут от самого сундука (слышно рядом), громкость — по настройке «Звуки»
|
||||||
|
local function sound(name, parent)
|
||||||
|
local def = Config.Sounds[name]
|
||||||
|
local s = Instance.new("Sound")
|
||||||
|
s.Name = name
|
||||||
|
s.SoundId = def.id
|
||||||
|
s.Volume = def.volume or 0.5
|
||||||
|
s.RollOffMode = Enum.RollOffMode.InverseTapered
|
||||||
|
s.RollOffMinDistance, s.RollOffMaxDistance = 10, 70
|
||||||
|
s.SoundGroup = Audio.groups.sfx
|
||||||
|
s.Parent = parent
|
||||||
|
return s, def.pitch
|
||||||
|
end
|
||||||
|
|
||||||
|
local rng = Random.new()
|
||||||
|
local function play(entry)
|
||||||
|
local s, pitch = entry[1], entry[2]
|
||||||
|
if pitch then
|
||||||
|
s.PlaybackSpeed = rng:NextNumber(pitch[1], pitch[2])
|
||||||
|
end
|
||||||
|
s:Play()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- пыль от удара: низкое облачко, разлетается в стороны и быстро оседает
|
||||||
|
local function makeDust(base)
|
||||||
|
local att = Instance.new("Attachment")
|
||||||
|
att.Name = "ChestDust"
|
||||||
|
att.Position = Vector3.new(0, -base.Size.Y / 2 + 0.15, 0)
|
||||||
|
att.Parent = base
|
||||||
|
local pe = Instance.new("ParticleEmitter")
|
||||||
|
pe.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||||||
|
pe.Rate = 0
|
||||||
|
pe.Color = ColorSequence.new(Color3.fromRGB(222, 202, 168), Color3.fromRGB(196, 176, 146))
|
||||||
|
pe.LightInfluence = 0.8
|
||||||
|
pe.Lifetime = NumberRange.new(0.6, 1.1)
|
||||||
|
pe.Speed = NumberRange.new(7, 11)
|
||||||
|
pe.Drag = 6
|
||||||
|
pe.SpreadAngle = Vector2.new(86, 86) -- почти горизонтально во все стороны
|
||||||
|
pe.Acceleration = Vector3.new(0, 1.2, 0)
|
||||||
|
pe.Rotation = NumberRange.new(0, 360)
|
||||||
|
pe.RotSpeed = NumberRange.new(-60, 60)
|
||||||
|
pe.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.7), NumberSequenceKeypoint.new(0.4, 1.8), NumberSequenceKeypoint.new(1, 2.6) })
|
||||||
|
pe.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.35), NumberSequenceKeypoint.new(0.6, 0.7), NumberSequenceKeypoint.new(1, 1) })
|
||||||
|
pe.EmissionDirection = Enum.NormalId.Top
|
||||||
|
pe.Parent = att
|
||||||
|
return pe
|
||||||
|
end
|
||||||
|
|
||||||
|
local function bind(model)
|
||||||
|
local base, lid = model:FindFirstChild("Base"), model:FindFirstChild("Lid")
|
||||||
|
if not (base and lid) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local pivot = model:GetPivot()
|
||||||
|
local function rel(name)
|
||||||
|
local p = model:FindFirstChild(name)
|
||||||
|
return p and { part = p, cf = pivot:ToObjectSpace(p.CFrame) }
|
||||||
|
end
|
||||||
|
-- петли крышки — задняя верхняя кромка корпуса (замок спереди, по +Z модели)
|
||||||
|
local hinge = pivot:ToObjectSpace(base.CFrame * CFrame.new(0, base.Size.Y / 2, -base.Size.Z / 2))
|
||||||
|
chest = model
|
||||||
|
fx = {
|
||||||
|
hop = { sound("chestHop", base) },
|
||||||
|
land = { sound("chestLand", base) },
|
||||||
|
coins = { sound("coins", base) },
|
||||||
|
dust = makeDust(base),
|
||||||
|
}
|
||||||
|
rest = {
|
||||||
|
pivot = pivot, hinge = CFrame.new(hinge.Position),
|
||||||
|
base = rel("Base"), lid = rel("Lid"), lock = rel("Lock"), coins = rel("Coins"),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function findChest()
|
||||||
|
local map = workspace:FindFirstChild("FishingMap")
|
||||||
|
if not map then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, d in ipairs(map:GetDescendants()) do
|
||||||
|
if d:IsA("Model") and d:GetAttribute("DailyChest") then
|
||||||
|
bind(d)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- поза в момент t цикла: подъём корпуса, угол крышки (градусы), подскок монет
|
||||||
|
local function pose(t)
|
||||||
|
local h, lid, coin = 0, 0, 0
|
||||||
|
if t < T_UP then
|
||||||
|
h = HOP * easeOut(t / T_UP)
|
||||||
|
elseif t < T_UP + T_DOWN then
|
||||||
|
local u = (t - T_UP) / T_DOWN
|
||||||
|
h = HOP * (1 - easeIn(u))
|
||||||
|
lid = LID_FALL * easeOut(u) -- крышку подбрасывает воздухом
|
||||||
|
else
|
||||||
|
local t2 = t - T_UP - T_DOWN
|
||||||
|
if t2 < T_LAND then
|
||||||
|
local u = t2 / T_LAND
|
||||||
|
coin = COIN_HOP * math.sin(math.pi * u) -- монеты подскакивают от удара
|
||||||
|
-- крышка с лёгким «отскоком» оседает в приоткрытое положение
|
||||||
|
lid = LID_REST + (LID_FALL - LID_REST) * (1 - smooth(u)) + 4 * math.sin(math.pi * u * 2) * (1 - u)
|
||||||
|
h = 0.12 * math.sin(math.pi * math.min(1, u * 2)) -- маленький отскок корпуса
|
||||||
|
elseif t2 < T_LAND + T_HOLD then
|
||||||
|
lid = LID_REST
|
||||||
|
elseif t2 < T_LAND + T_HOLD + T_CLOSE then
|
||||||
|
lid = LID_REST * (1 - smooth((t2 - T_LAND - T_HOLD) / T_CLOSE))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return h, lid, coin
|
||||||
|
end
|
||||||
|
|
||||||
|
local function apply(h, lidDeg, coin)
|
||||||
|
local r = rest
|
||||||
|
local p = r.pivot * CFrame.new(0, h, 0)
|
||||||
|
r.base.part.CFrame = p * r.base.cf
|
||||||
|
-- крышка и замок поворачиваются вокруг петель (минус — передняя кромка идёт вверх)
|
||||||
|
local open = r.hinge * CFrame.Angles(-math.rad(lidDeg), 0, 0) * r.hinge:Inverse()
|
||||||
|
r.lid.part.CFrame = p * open * r.lid.cf
|
||||||
|
if r.lock then
|
||||||
|
r.lock.part.CFrame = p * open * r.lock.cf
|
||||||
|
end
|
||||||
|
if r.coins then
|
||||||
|
r.coins.part.CFrame = p * CFrame.new(0, coin, 0) * r.coins.cf
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- прыгает только для тех, кому есть что забрать: DailyNextAt (ставит сервер) — когда откроется следующая
|
||||||
|
-- награда, 0 — уже доступна. Забрал — сундук доигрывает текущий прыжок и замирает до следующего дня.
|
||||||
|
local player = game:GetService("Players").LocalPlayer
|
||||||
|
local function rewardReady()
|
||||||
|
local nextAt = player:GetAttribute("DailyNextAt")
|
||||||
|
return nextAt ~= nil and workspace:GetServerTimeNow() >= nextAt
|
||||||
|
end
|
||||||
|
|
||||||
|
local scanAt = -math.huge
|
||||||
|
local cycleT = nil -- время внутри текущего цикла; nil — сундук стоит
|
||||||
|
local resting = false
|
||||||
|
RunService.RenderStepped:Connect(function(dt)
|
||||||
|
if not chest or not chest.Parent then
|
||||||
|
chest = nil
|
||||||
|
if os.clock() - scanAt > 3 then
|
||||||
|
scanAt = os.clock()
|
||||||
|
findChest()
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local cam = workspace.CurrentCamera
|
||||||
|
if cam and (cam.CFrame.Position - rest.pivot.Position).Magnitude > VIEW_DIST then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not cycleT then
|
||||||
|
if not rewardReady() then
|
||||||
|
if not resting then
|
||||||
|
resting = true
|
||||||
|
apply(0, 0, 0) -- стоит закрытый, как в редакторе
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
cycleT, resting = 0, false
|
||||||
|
play(fx.hop)
|
||||||
|
end
|
||||||
|
local prev = cycleT
|
||||||
|
cycleT += dt
|
||||||
|
-- удар о землю
|
||||||
|
if prev < T_IMPACT and cycleT >= T_IMPACT then
|
||||||
|
play(fx.land)
|
||||||
|
task.delay(0.08, play, fx.coins) -- монеты звенят чуть позже удара, когда подпрыгивают
|
||||||
|
fx.dust:Emit(26)
|
||||||
|
end
|
||||||
|
if cycleT >= PERIOD then
|
||||||
|
cycleT = nil -- цикл закончен; следующий начнётся, только если награда всё ещё доступна
|
||||||
|
apply(0, 0, 0)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
apply(pose(cycleT))
|
||||||
|
end)
|
||||||
@@ -0,0 +1,412 @@
|
|||||||
|
-- GuildClient (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||||
|
-- Окно гильдии рыбаков (ранг и испытание, заказы, наживка, ловушки), строка жемчуга и печатей в HUD,
|
||||||
|
-- кнопки наживки и автоловли, церемония нового ранга. Стиль и помощники — из FishingClient (Theme.kit).
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local TweenService = game:GetService("TweenService")
|
||||||
|
local UserInputService = game:GetService("UserInputService")
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
local Theme = require(script.Parent:WaitForChild("UiTheme"))
|
||||||
|
local Audio = require(script.Parent:WaitForChild("Audio"))
|
||||||
|
local remote = ReplicatedStorage:WaitForChild("GameEvent")
|
||||||
|
|
||||||
|
while not Theme.kit do
|
||||||
|
task.wait(0.1)
|
||||||
|
end
|
||||||
|
local K = Theme.kit
|
||||||
|
local C = Theme.C
|
||||||
|
local new, text, btn, corner, stroke, gradient = K.new, K.text, K.btn, K.corner, K.stroke, K.gradient
|
||||||
|
local fmt = K.fmt
|
||||||
|
local TITLE, BODY2 = K.TITLE, K.BODY2
|
||||||
|
local RANKS = Config.Guild.ranks
|
||||||
|
local CENTER, RIGHT = Enum.TextXAlignment.Center, Enum.TextXAlignment.Right
|
||||||
|
local WHITE = Color3.new(1, 1, 1)
|
||||||
|
|
||||||
|
local state = nil -- последнее состояние гильдии от сервера
|
||||||
|
|
||||||
|
local function rankOf(idx)
|
||||||
|
return RANKS[math.clamp(idx or 1, 1, #RANKS)]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- щит ранга: ромб цвета ранга с буквой
|
||||||
|
local function shield(parent, size, idx, props)
|
||||||
|
local r = rankOf(idx)
|
||||||
|
local f = new("Frame", { Size = UDim2.fromOffset(size, size), Rotation = 45, BackgroundColor3 = r.color, Parent = parent },
|
||||||
|
{ corner(math.floor(size / 6)), stroke(C.gold, math.max(2, size / 14), 0), gradient(WHITE, Color3.fromRGB(150, 150, 150), 45) })
|
||||||
|
for k, v in pairs(props or {}) do
|
||||||
|
f[k] = v
|
||||||
|
end
|
||||||
|
text({ Size = UDim2.fromScale(1, 1), Rotation = -45, Font = TITLE, TextScaled = true, TextXAlignment = CENTER, Text = r.id,
|
||||||
|
TextColor3 = WHITE, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.2, Parent = f })
|
||||||
|
return f
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- окно гильдии
|
||||||
|
|
||||||
|
local win = K.makeWindow("⚔ Гильдия рыбаков", C.crimson, {
|
||||||
|
{ id = "rank", label = "⚔ Ранг" },
|
||||||
|
{ id = "orders", label = "📜 Заказы" },
|
||||||
|
{ id = "bait", label = "🐛 Наживка" },
|
||||||
|
{ id = "traps", label = "🧺 Ловушки" },
|
||||||
|
})
|
||||||
|
local lists = {
|
||||||
|
rank = K.scrollArea(win.pages.rank),
|
||||||
|
orders = K.scrollArea(win.pages.orders),
|
||||||
|
bait = K.scrollArea(win.pages.bait),
|
||||||
|
traps = K.scrollArea(win.pages.traps),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- деревянная карточка-строка
|
||||||
|
local function card(parent, order, height, strokeColor)
|
||||||
|
return new("Frame", { Size = UDim2.new(1, -4, 0, height), BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent },
|
||||||
|
{ corner(8), stroke(strokeColor or C.goldDark, 2, 0), gradient(C.woodLight, C.wood, 90) })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function rewardText(o)
|
||||||
|
return ("+%d %s +%s %s%s"):format(o.seals, Theme.SEAL, fmt(o.coins), Theme.SILVER, (o.pearls or 0) > 0 and (" +" .. o.pearls .. " " .. Theme.PEARL) or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function renderRank(list)
|
||||||
|
local idx = player:GetAttribute("RankIdx") or 1
|
||||||
|
local r = rankOf(idx)
|
||||||
|
local seals = player:GetAttribute("Seals") or 0
|
||||||
|
local nextR = RANKS[idx + 1]
|
||||||
|
|
||||||
|
-- шапка: щит, звание, печати
|
||||||
|
local head = card(list, 0, 120, C.gold)
|
||||||
|
shield(head, 64, idx, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(62, 60) })
|
||||||
|
text({ Size = UDim2.new(1, -140, 0, 30), Position = UDim2.fromOffset(122, 10), Font = TITLE, TextSize = 24, TextColor3 = r.color:Lerp(WHITE, 0.35),
|
||||||
|
Text = ("Ранг %s — %s"):format(r.id, r.name), Parent = head })
|
||||||
|
text({ Size = UDim2.new(1, -140, 0, 22), Position = UDim2.fromOffset(122, 42), Font = BODY2, TextSize = 15, TextColor3 = C.muted, RichText = true,
|
||||||
|
Text = ("%s Печати: <b>%s</b>%s %s Жемчуг: <b>%s</b>"):format(Theme.SEAL, fmt(seals), nextR and (" / " .. fmt(nextR.seals)) or "", Theme.PEARL, fmt(player:GetAttribute("Pearls") or 0)),
|
||||||
|
Parent = head })
|
||||||
|
if nextR then
|
||||||
|
K.progressBar(head, UDim2.fromOffset(122, 74), UDim2.new(1, -140, 0, 14), (seals - r.seals) / math.max(1, nextR.seals - r.seals), C.gold)
|
||||||
|
text({ Size = UDim2.new(1, -140, 0, 18), Position = UDim2.fromOffset(122, 92), Font = BODY2, TextSize = 13, TextColor3 = C.muted,
|
||||||
|
Text = "Печати дают только заказы гильдии и испытания", Parent = head })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- испытание на следующий ранг
|
||||||
|
local t = state and state.trial
|
||||||
|
if t and nextR then
|
||||||
|
local box = card(list, 1, 96, t.ready and C.goldBright or C.goldDark)
|
||||||
|
text({ Size = UDim2.new(1, -220, 0, 26), Position = UDim2.fromOffset(16, 10), Font = TITLE, TextSize = 19, TextColor3 = C.goldBright,
|
||||||
|
Text = ("⚔ Испытание на ранг %s"):format(nextR.id), Parent = box })
|
||||||
|
text({ Size = UDim2.new(1, -220, 0, 40), Position = UDim2.fromOffset(16, 38), Font = BODY2, TextSize = 15, TextWrapped = true, RichText = true,
|
||||||
|
TextYAlignment = Enum.TextYAlignment.Top,
|
||||||
|
Text = t.text .. (t.active and (" <font color=\"" .. Theme.HEX.gold .. "\">" .. t.progress .. " / " .. t.goal .. "</font>") or "")
|
||||||
|
.. (t.ready and "" or ("\n<font color=\"" .. Theme.HEX.muted .. "\">Сначала накопи " .. fmt(nextR.seals) .. " печатей</font>")),
|
||||||
|
Parent = box })
|
||||||
|
local label, color, active
|
||||||
|
if not t.ready then
|
||||||
|
label, color, active = "🔒 " .. fmt(nextR.seals) .. " " .. Theme.SEAL, C.grey, false
|
||||||
|
elseif t.active and nextR.trial.kind == "deliver" then
|
||||||
|
label, color, active = "🐟 Сдать рыбу", C.green, true
|
||||||
|
elseif t.active then
|
||||||
|
label, color, active = "Идёт…", C.grey, false
|
||||||
|
else
|
||||||
|
label, color, active = "⚔ Взять", C.crimson, true
|
||||||
|
end
|
||||||
|
btn({ Size = UDim2.fromOffset(180, 50), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = color,
|
||||||
|
AutoButtonColor = active, Text = label, TextSize = 18, Parent = box }, active and function()
|
||||||
|
remote:FireServer("TakeTrial")
|
||||||
|
end or nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- лестница рангов
|
||||||
|
for i, rr in ipairs(RANKS) do
|
||||||
|
local here = i == idx
|
||||||
|
local row = card(list, 10 + i, 58, here and C.gold or nil)
|
||||||
|
if i > idx then
|
||||||
|
row.BackgroundTransparency = 0.35
|
||||||
|
end
|
||||||
|
shield(row, 30, i, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(34, 29) })
|
||||||
|
text({ Size = UDim2.fromOffset(230, 24), Position = UDim2.fromOffset(64, 6), Font = TITLE, TextSize = 17,
|
||||||
|
TextColor3 = i <= idx and C.text or C.muted, Text = ("%s — %s"):format(rr.id, rr.name), Parent = row })
|
||||||
|
text({ Size = UDim2.new(1, -200, 0, 20), Position = UDim2.fromOffset(64, 31), Font = BODY2, TextSize = 13, TextColor3 = C.muted,
|
||||||
|
TextTruncate = Enum.TextTruncate.AtEnd, Text = rr.unlocks, Parent = row })
|
||||||
|
text({ Size = UDim2.fromOffset(120, 24), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -14, 0, 17), Font = TITLE, TextSize = 16,
|
||||||
|
TextXAlignment = RIGHT, TextColor3 = i <= idx and C.green:Lerp(WHITE, 0.4) or C.gold,
|
||||||
|
Text = i <= idx and "✓" or (fmt(rr.seals) .. " " .. Theme.SEAL), Parent = row })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function renderOrders(list)
|
||||||
|
if not state then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local left = (state.ordersEnd or 0) - workspace:GetServerTimeNow()
|
||||||
|
local h = math.floor(math.max(0, left) / 3600)
|
||||||
|
local m = math.floor(math.max(0, left) % 3600 / 60)
|
||||||
|
text({ Size = UDim2.new(1, -4, 0, 26), LayoutOrder = 0, Font = BODY2, TextSize = 15, TextColor3 = C.muted, RichText = true,
|
||||||
|
Text = ("Личные заказы гильдии. Новые через <b>%d ч %02d мин</b>. Рыбу сдают у доски заказов в лобби."):format(h, m), Parent = list })
|
||||||
|
for i, o in ipairs(state.orders) do
|
||||||
|
local row = card(list, i, 92, o.done and C.green or nil)
|
||||||
|
text({ Size = UDim2.new(1, -230, 0, 26), Position = UDim2.fromOffset(16, 8), Font = TITLE, TextSize = 18,
|
||||||
|
TextColor3 = o.done and C.muted or C.text, TextTruncate = Enum.TextTruncate.AtEnd, Text = (o.done and "✅ " or "📜 ") .. o.text, Parent = row })
|
||||||
|
text({ Size = UDim2.new(1, -230, 0, 20), Position = UDim2.fromOffset(16, 36), Font = BODY2, TextSize = 14, TextColor3 = C.gold,
|
||||||
|
Text = rewardText(o), Parent = row })
|
||||||
|
K.progressBar(row, UDim2.fromOffset(16, 64), UDim2.new(1, -310, 0, 12), o.progress / math.max(1, o.count), o.done and C.green or C.gold)
|
||||||
|
text({ Size = UDim2.fromOffset(70, 18), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -224, 0, 61), Font = TITLE, TextSize = 14,
|
||||||
|
TextXAlignment = RIGHT, Text = ("%d / %d"):format(o.progress, o.count), Parent = row })
|
||||||
|
if not o.done then
|
||||||
|
if o.deliver then
|
||||||
|
btn({ Size = UDim2.fromOffset(120, 40), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -86, 0, 10), BackgroundColor3 = C.green,
|
||||||
|
Text = "🐟 Сдать", TextSize = 17, Parent = row }, function()
|
||||||
|
remote:FireServer("DeliverOrder", i)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
btn({ Size = UDim2.fromOffset(66, 40), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10), BackgroundColor3 = C.woodLight,
|
||||||
|
Text = "🎲 " .. Config.Orders.rerollPearls .. Theme.PEARL, TextSize = 14, Parent = row }, function()
|
||||||
|
remote:FireServer("RerollOrder", i)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
text({ Size = UDim2.new(1, -4, 0, 24), LayoutOrder = 99, Font = BODY2, TextSize = 13, TextColor3 = C.muted,
|
||||||
|
Text = ("🎲 — заменить заказ другим за %d %s"):format(Config.Orders.rerollPearls, Theme.PEARL), Parent = list })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function renderBait(list)
|
||||||
|
local idx = player:GetAttribute("RankIdx") or 1
|
||||||
|
local coins = player:GetAttribute("Coins") or 0
|
||||||
|
local pearls = player:GetAttribute("Pearls") or 0
|
||||||
|
local counts = state and state.baits or {}
|
||||||
|
local equipped = player:GetAttribute("Bait")
|
||||||
|
text({ Size = UDim2.new(1, -4, 0, 26), LayoutOrder = 0, Font = BODY2, TextSize = 15, TextColor3 = C.muted,
|
||||||
|
Text = "Один слот наживки: 1 штука тратится на каждый заброс.", Parent = list })
|
||||||
|
for i, b in ipairs(Config.Baits) do
|
||||||
|
local have = counts[b.id] or 0
|
||||||
|
local locked = b.rank and idx < b.rank
|
||||||
|
local pearl = b.currency == "pearls"
|
||||||
|
local row = card(list, i, 84, equipped == b.id and C.goldBright or nil)
|
||||||
|
text({ Size = UDim2.fromOffset(60, 60), Position = UDim2.fromOffset(10, 12), TextSize = 40, TextXAlignment = CENTER, Text = b.icon, Parent = row })
|
||||||
|
text({ Size = UDim2.new(1, -330, 0, 26), Position = UDim2.fromOffset(78, 10), Font = TITLE, TextSize = 18,
|
||||||
|
Text = b.name .. (have > 0 and (" ×" .. have) or ""), Parent = row })
|
||||||
|
text({ Size = UDim2.new(1, -330, 0, 36), Position = UDim2.fromOffset(78, 38), Font = BODY2, TextSize = 14, TextColor3 = C.muted, TextWrapped = true,
|
||||||
|
TextYAlignment = Enum.TextYAlignment.Top, Text = b.desc, Parent = row })
|
||||||
|
local can = (pearl and pearls >= b.price) or (not pearl and coins >= b.price)
|
||||||
|
btn({
|
||||||
|
Size = UDim2.fromOffset(130, 42), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0),
|
||||||
|
BackgroundColor3 = locked and C.grey or (can and C.green or C.woodLight), AutoButtonColor = not locked,
|
||||||
|
Text = locked and ("🔒 Ранг " .. RANKS[b.rank].id) or (("%s %d · ×%d"):format(pearl and Theme.PEARL or Theme.SILVER, b.price, b.pack)), TextSize = 15, Parent = row,
|
||||||
|
}, (not locked) and function()
|
||||||
|
remote:FireServer("BuyBait", b.id)
|
||||||
|
end or nil)
|
||||||
|
if have > 0 then
|
||||||
|
local on = equipped == b.id
|
||||||
|
btn({
|
||||||
|
Size = UDim2.fromOffset(100, 42), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -150, 0.5, 0),
|
||||||
|
BackgroundColor3 = on and C.gold or C.blue, TextColor3 = on and C.ink or C.text, Text = on and "✓ В слоте" or "Взять", TextSize = 15, Parent = row,
|
||||||
|
}, function()
|
||||||
|
remote:FireServer("EquipBait", on and "" or b.id)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function renderTraps(list)
|
||||||
|
if not state then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if (state.trapSlots or 0) == 0 then
|
||||||
|
local box = card(list, 0, 90)
|
||||||
|
text({ Size = UDim2.new(1, -32, 1, 0), Position = UDim2.fromOffset(16, 0), Font = TITLE, TextSize = 18, TextWrapped = true, TextColor3 = C.muted,
|
||||||
|
Text = "🔒 Ловушки-вентери открываются с ранга D.\nКаждая сама ловит рыбу «Тихого озера», даже когда ты не в игре.", Parent = box })
|
||||||
|
return
|
||||||
|
end
|
||||||
|
text({ Size = UDim2.new(1, -4, 0, 26), LayoutOrder = 0, Font = BODY2, TextSize = 15, TextColor3 = C.muted,
|
||||||
|
Text = ("Каждая ловушка: 1 рыба за %d мин, не больше %d. Работает и офлайн."):format(state.trapEvery / 60, state.trapMax), Parent = list })
|
||||||
|
local total = 0
|
||||||
|
for i = 1, state.trapSlots do
|
||||||
|
local n = state.traps[i] or 0
|
||||||
|
total += n
|
||||||
|
local row = card(list, i, 64, n >= state.trapMax and C.goldBright or nil)
|
||||||
|
text({ Size = UDim2.new(1, -40, 0, 26), Position = UDim2.fromOffset(16, 6), Font = TITLE, TextSize = 18,
|
||||||
|
Text = ("🧺 Ловушка %d: %d / %d рыб%s"):format(i, n, state.trapMax, n >= state.trapMax and " · полная!" or ""), Parent = row })
|
||||||
|
K.progressBar(row, UDim2.fromOffset(16, 38), UDim2.new(1, -32, 0, 12), n / state.trapMax, C.gold)
|
||||||
|
end
|
||||||
|
local b = btn({
|
||||||
|
Size = UDim2.fromOffset(260, 52), BackgroundColor3 = total > 0 and C.green or C.grey, AutoButtonColor = total > 0,
|
||||||
|
Text = ("🧺 Забрать улов (%d)"):format(total), TextSize = 19, LayoutOrder = 50, Parent = list,
|
||||||
|
}, total > 0 and function()
|
||||||
|
remote:FireServer("CollectTraps")
|
||||||
|
end or nil)
|
||||||
|
b.AnchorPoint = Vector2.new(0, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
win.render = function(tab)
|
||||||
|
local list = lists[tab]
|
||||||
|
if not list then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
K.clear(list)
|
||||||
|
if tab == "rank" then
|
||||||
|
renderRank(list)
|
||||||
|
elseif tab == "orders" then
|
||||||
|
renderOrders(list)
|
||||||
|
elseif tab == "bait" then
|
||||||
|
renderBait(list)
|
||||||
|
elseif tab == "traps" then
|
||||||
|
renderTraps(list)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function openGuild(tab)
|
||||||
|
remote:FireServer("GuildState")
|
||||||
|
win.open(tab)
|
||||||
|
end
|
||||||
|
|
||||||
|
K.sideButton(7, "⚔", "Гильдия", "G", C.crimson, function()
|
||||||
|
if win.isOpen() then
|
||||||
|
win.close()
|
||||||
|
else
|
||||||
|
openGuild()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
UserInputService.InputBegan:Connect(function(input, processed)
|
||||||
|
if not processed and input.KeyCode == Enum.KeyCode.G then
|
||||||
|
if win.isOpen() then
|
||||||
|
win.close()
|
||||||
|
else
|
||||||
|
openGuild()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
---------------------------------------------------------------- HUD: жемчуг, печати, ранг, отдых
|
||||||
|
|
||||||
|
local hud = K.hud
|
||||||
|
hud.Parent.Size = UDim2.fromOffset(290, 198)
|
||||||
|
local guildLine = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 149), TextSize = 14, Font = BODY2, RichText = true, Text = "", Parent = hud })
|
||||||
|
-- отдых: строка видна, только пока есть двойной опыт
|
||||||
|
local restText = text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 169), Font = BODY2, TextSize = 13, TextColor3 = Color3.fromRGB(170, 215, 255), Text = "", Parent = hud })
|
||||||
|
local restPlate = restText
|
||||||
|
|
||||||
|
local function refreshHud()
|
||||||
|
local idx = player:GetAttribute("RankIdx") or 1
|
||||||
|
local r = rankOf(idx)
|
||||||
|
local nextSeals = player:GetAttribute("SealsNext")
|
||||||
|
guildLine.Text = ("<font color=\"#%s\"><b>⚔ %s</b></font> %s %s%s %s %s"):format(r.color:Lerp(WHITE, 0.3):ToHex(), r.id,
|
||||||
|
Theme.SEAL, fmt(player:GetAttribute("Seals") or 0), nextSeals and ("/" .. fmt(nextSeals)) or "", Theme.PEARL, fmt(player:GetAttribute("Pearls") or 0))
|
||||||
|
local rest = player:GetAttribute("RestLeft") or 0
|
||||||
|
restPlate.Visible = rest > 0
|
||||||
|
restText.Text = ("🛌 Отдых: опыт ×2 ещё %d мин"):format(math.ceil(rest / 60))
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- наживка и автоловля (правый низ, над кнопкой прыжка на телефоне)
|
||||||
|
|
||||||
|
local bar = new("Frame", {
|
||||||
|
Size = UDim2.fromOffset(250, 56), AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -12, 1, -12), BackgroundTransparency = 1, Parent = K.screen,
|
||||||
|
}, { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, HorizontalAlignment = Enum.HorizontalAlignment.Right, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||||||
|
local baitBtn = btn({ Size = UDim2.fromOffset(110, 52), BackgroundColor3 = C.woodLight, Text = "", TextSize = 16, LayoutOrder = 1, Parent = bar }, function()
|
||||||
|
openGuild("bait")
|
||||||
|
end)
|
||||||
|
local autoBtn = btn({ Size = UDim2.fromOffset(130, 52), BackgroundColor3 = C.woodLight, Text = "", TextSize = 15, LayoutOrder = 2, Visible = false, Parent = bar }, function()
|
||||||
|
remote:FireServer("AutoFish", not player:GetAttribute("AutoFish"))
|
||||||
|
end)
|
||||||
|
Theme.onLayout(function(compact)
|
||||||
|
-- на телефоне — внизу, левее кнопки прыжка (над ней — панель целей)
|
||||||
|
bar.Position = compact and UDim2.new(1, -140, 1, -8) or UDim2.new(1, -12, 1, -12)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function refreshBar()
|
||||||
|
local id = player:GetAttribute("Bait")
|
||||||
|
local b = id and Config.Find(Config.Baits, id)
|
||||||
|
baitBtn.Text = b and ("%s ×%d"):format(b.icon, player:GetAttribute("BaitCount") or 0) or "🐛 Наживка"
|
||||||
|
baitBtn.BackgroundColor3 = b and C.woodLight or C.wood
|
||||||
|
local idx = player:GetAttribute("RankIdx") or 1
|
||||||
|
autoBtn.Visible = rankOf(idx).auto == true
|
||||||
|
local on = player:GetAttribute("AutoFish") == true
|
||||||
|
autoBtn.Text = on and "🎣 Авто: ВКЛ" or "🎣 Автоловля"
|
||||||
|
autoBtn.BackgroundColor3 = on and C.green or C.woodLight
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- церемония нового ранга
|
||||||
|
|
||||||
|
local ceremonyGui = new("ScreenGui", { Name = "RankCeremony", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 40, Enabled = false, Parent = player:WaitForChild("PlayerGui") })
|
||||||
|
local function ceremony(letter, name, unlocks, pearls)
|
||||||
|
ceremonyGui.Enabled = true
|
||||||
|
local root = Theme.followScale(ceremonyGui)
|
||||||
|
local dim = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.45, Parent = root })
|
||||||
|
local _, idx = Config.RankById(letter)
|
||||||
|
local panel = new("Frame", {
|
||||||
|
Size = UDim2.fromOffset(520, 300), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), BackgroundColor3 = WHITE, Parent = root,
|
||||||
|
}, { corner(12), stroke(C.goldDark, 4, 0), Theme.woodGradient(C.wood, C.woodDark) })
|
||||||
|
Theme.innerBorder(panel, 7, 8, C.gold, 0.2)
|
||||||
|
Theme.rivets(panel, 12, 8)
|
||||||
|
text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 16), Font = TITLE, TextSize = 26, TextXAlignment = CENTER, TextColor3 = C.goldBright,
|
||||||
|
TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.2, Text = "⚔ НОВЫЙ РАНГ ГИЛЬДИИ ⚔", Parent = panel })
|
||||||
|
local sh = shield(panel, 96, idx, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(260, 118) })
|
||||||
|
text({ Size = UDim2.new(1, -40, 0, 30), Position = UDim2.fromOffset(20, 180), Font = TITLE, TextSize = 24, TextXAlignment = CENTER,
|
||||||
|
Text = ("%s — «%s»"):format(letter, name), Parent = panel })
|
||||||
|
text({ Size = UDim2.new(1, -40, 0, 40), Position = UDim2.fromOffset(20, 212), Font = BODY2, TextSize = 15, TextXAlignment = CENTER, TextWrapped = true,
|
||||||
|
TextColor3 = C.muted, Text = "Открыто: " .. unlocks, Parent = panel })
|
||||||
|
text({ Size = UDim2.new(1, -40, 0, 26), Position = UDim2.fromOffset(20, 256), Font = TITLE, TextSize = 19, TextXAlignment = CENTER,
|
||||||
|
TextColor3 = C.pearl, Text = ("+%d %s"):format(pearls or 0, Theme.PEARL), Parent = panel })
|
||||||
|
K.popIn(panel, 0.3)
|
||||||
|
TweenService:Create(sh, TweenInfo.new(1.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Rotation = 405 }):Play()
|
||||||
|
Audio.play("fanfare")
|
||||||
|
-- конфетти
|
||||||
|
local colors = { C.goldBright, C.crimson, C.forest, C.parchment, Color3.fromRGB(120, 200, 255) }
|
||||||
|
for i = 1, 70 do
|
||||||
|
local p = new("Frame", {
|
||||||
|
Size = UDim2.fromOffset(math.random(6, 12), math.random(10, 18)), Position = UDim2.new(math.random(), 0, 0, -30),
|
||||||
|
Rotation = math.random(0, 360), BackgroundColor3 = colors[(i % #colors) + 1], BorderSizePixel = 0, Parent = root,
|
||||||
|
})
|
||||||
|
local t = math.random(18, 34) / 10
|
||||||
|
TweenService:Create(p, TweenInfo.new(t, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
|
||||||
|
Position = UDim2.new(p.Position.X.Scale + (math.random() - 0.5) * 0.2, 0, 1.1, 0), Rotation = p.Rotation + math.random(-360, 360),
|
||||||
|
}):Play()
|
||||||
|
end
|
||||||
|
task.delay(5, function()
|
||||||
|
TweenService:Create(dim, TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play()
|
||||||
|
task.wait(0.4)
|
||||||
|
root:Destroy()
|
||||||
|
ceremonyGui.Enabled = false
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- события
|
||||||
|
|
||||||
|
remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||||||
|
if action == "Guild" then
|
||||||
|
state = a
|
||||||
|
win.refresh()
|
||||||
|
elseif action == "OpenGuild" then
|
||||||
|
openGuild(a)
|
||||||
|
elseif action == "RankUp" then
|
||||||
|
win.close()
|
||||||
|
ceremony(a, b, c, d)
|
||||||
|
elseif action == "OrderDone" then
|
||||||
|
Audio.play("quest")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
player.AttributeChanged:Connect(function(name)
|
||||||
|
if name == "Seals" or name == "Pearls" or name == "RankIdx" or name == "SealsNext" or name == "RestLeft" then
|
||||||
|
refreshHud()
|
||||||
|
end
|
||||||
|
if name == "Bait" or name == "BaitCount" or name == "AutoFish" or name == "RankIdx" then
|
||||||
|
refreshBar()
|
||||||
|
end
|
||||||
|
if (name == "Coins" or name == "Pearls" or name == "Bait") and win.isOpen() and win.current == "bait" then
|
||||||
|
win.refresh()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
refreshHud()
|
||||||
|
refreshBar()
|
||||||
|
|
||||||
|
-- таймер заказов и ловушки тикают, пока окно открыто
|
||||||
|
task.spawn(function()
|
||||||
|
while true do
|
||||||
|
task.wait(30)
|
||||||
|
if win.isOpen() and (win.current == "orders" or win.current == "traps") then
|
||||||
|
remote:FireServer("GuildState")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
remote:FireServer("GuildState")
|
||||||
@@ -0,0 +1,479 @@
|
|||||||
|
-- LobbyLife (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||||
|
-- Живое лобби у этого игрока (всё — на клиенте, сервер не нагружается):
|
||||||
|
-- NPC поворачивают голову к игроку и машут, когда он подходит;
|
||||||
|
-- кот ходит за игроком по площади, а один — ложится у фонтана;
|
||||||
|
-- чайки над скалами, бабочки у цветов, ночью — светлячки у фонарей и клумб;
|
||||||
|
-- деревья, трава, цветы и кусты колышутся от ветра (только рядом с камерой), с деревьев падают листья.
|
||||||
|
-- Общие для всех вещи (idle NPC, гуляющие жители) — в LobbyLife.server.lua.
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||||
|
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
local V = Vector3.new
|
||||||
|
local rng = Random.new()
|
||||||
|
local LOBBY = V(0, 1, 0) -- центр лобби, пол на высоте 1
|
||||||
|
local LOBBY_VIEW = 170 -- дальше камеры от центра лобби — ничего не анимируем
|
||||||
|
local WAVE_ANIM = "rbxassetid://507770239"
|
||||||
|
local LEAF_TEXTURE = "rbxassetid://138319345672122"
|
||||||
|
|
||||||
|
local map = workspace:WaitForChild("FishingMap")
|
||||||
|
local fx = Instance.new("Folder")
|
||||||
|
fx.Name = "LobbyLifeFX"
|
||||||
|
fx.Parent = workspace
|
||||||
|
|
||||||
|
local function part(props)
|
||||||
|
local p = Instance.new(props.Class or "Part")
|
||||||
|
p.Anchored = true
|
||||||
|
p.CanCollide, p.CanQuery, p.CanTouch, p.CastShadow = false, false, false, false
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
if k ~= "Class" then
|
||||||
|
p[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
p.Parent = props.Parent or fx
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
|
||||||
|
local function camPos()
|
||||||
|
local cam = workspace.CurrentCamera
|
||||||
|
return cam and cam.CFrame.Position or LOBBY
|
||||||
|
end
|
||||||
|
local function myRoot()
|
||||||
|
return player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- NPC: взгляд и приветствие
|
||||||
|
|
||||||
|
local npcs = {}
|
||||||
|
local function scanNpcs()
|
||||||
|
for _, d in ipairs(map:GetDescendants()) do
|
||||||
|
if d:IsA("Model") and d:GetAttribute("Npc") and not npcs[d] then
|
||||||
|
local head = d:FindFirstChild("Head")
|
||||||
|
local neck = head and head:FindFirstChild("Neck")
|
||||||
|
local torso = d:FindFirstChild("UpperTorso")
|
||||||
|
if neck and neck:IsA("Motor6D") and torso then
|
||||||
|
npcs[d] = { neck = neck, c0 = neck.C0, torso = torso, head = head, yaw = 0, pitch = 0, waveAt = -math.huge }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function wave(rig, info)
|
||||||
|
local hum = rig:FindFirstChildOfClass("Humanoid")
|
||||||
|
local animator = hum and hum:FindFirstChildOfClass("Animator")
|
||||||
|
if not animator then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not info.waveTrack then
|
||||||
|
local a = Instance.new("Animation")
|
||||||
|
a.AnimationId = WAVE_ANIM
|
||||||
|
local ok, track = pcall(function() return animator:LoadAnimation(a) end)
|
||||||
|
info.waveTrack = ok and track or false
|
||||||
|
end
|
||||||
|
if info.waveTrack then
|
||||||
|
info.waveTrack.Priority = Enum.AnimationPriority.Action
|
||||||
|
info.waveTrack:Play(0.2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function updateNpcs(dt)
|
||||||
|
local root = myRoot()
|
||||||
|
local myHead = player.Character and player.Character:FindFirstChild("Head")
|
||||||
|
local now = os.clock()
|
||||||
|
for rig, n in pairs(npcs) do
|
||||||
|
if not rig.Parent then
|
||||||
|
npcs[rig] = nil
|
||||||
|
else
|
||||||
|
local wantYaw, wantPitch = 0, 0
|
||||||
|
local dist = root and (root.Position - n.head.Position).Magnitude or math.huge
|
||||||
|
if myHead and dist < 24 then
|
||||||
|
-- куда смотреть: в системе координат торса, лицо — по -Z
|
||||||
|
local rel = n.torso.CFrame:PointToObjectSpace(myHead.Position)
|
||||||
|
local headRel = n.torso.CFrame:PointToObjectSpace(n.head.Position)
|
||||||
|
local d = rel - headRel
|
||||||
|
wantYaw = math.clamp(math.atan2(-d.X, -d.Z), math.rad(-70), math.rad(70))
|
||||||
|
wantPitch = math.clamp(math.atan2(d.Y, math.sqrt(d.X * d.X + d.Z * d.Z)), math.rad(-20), math.rad(30))
|
||||||
|
-- голову к игроку, только если он перед NPC, а не за спиной
|
||||||
|
if math.abs(math.atan2(-d.X, -d.Z)) > math.rad(110) then
|
||||||
|
wantYaw, wantPitch = 0, 0
|
||||||
|
end
|
||||||
|
-- подошёл близко — помахать (не чаще раза в 25 секунд)
|
||||||
|
if dist < 11 and now - n.waveAt > 25 then
|
||||||
|
n.waveAt = now
|
||||||
|
wave(rig, n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local k = math.min(1, dt * 4)
|
||||||
|
n.yaw += (wantYaw - n.yaw) * k
|
||||||
|
n.pitch += (wantPitch - n.pitch) * k
|
||||||
|
n.neck.C0 = n.c0 * CFrame.Angles(0, n.yaw, 0) * CFrame.Angles(n.pitch, 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- кот
|
||||||
|
|
||||||
|
local cat = {}
|
||||||
|
do
|
||||||
|
local GINGER, WHITE, PINK = Color3.fromRGB(232, 150, 70), Color3.fromRGB(245, 238, 228), Color3.fromRGB(240, 150, 160)
|
||||||
|
cat.body = part({ Size = V(1.3, 1.0, 2.3), Color = GINGER })
|
||||||
|
cat.belly = part({ Size = V(1.0, 0.3, 1.9), Color = WHITE })
|
||||||
|
cat.head = part({ Size = V(1.15, 1.0, 1.0), Color = GINGER })
|
||||||
|
cat.muzzle = part({ Size = V(0.6, 0.35, 0.25), Color = WHITE })
|
||||||
|
cat.nose = part({ Size = V(0.18, 0.12, 0.08), Color = PINK })
|
||||||
|
cat.eyes = {
|
||||||
|
part({ Size = V(0.16, 0.2, 0.05), Color = Color3.fromRGB(40, 40, 30) }),
|
||||||
|
part({ Size = V(0.16, 0.2, 0.05), Color = Color3.fromRGB(40, 40, 30) }),
|
||||||
|
}
|
||||||
|
cat.ears = {
|
||||||
|
part({ Class = "WedgePart", Size = V(0.3, 0.45, 0.35), Color = GINGER }),
|
||||||
|
part({ Class = "WedgePart", Size = V(0.3, 0.45, 0.35), Color = GINGER }),
|
||||||
|
}
|
||||||
|
cat.legs = {}
|
||||||
|
for i = 1, 4 do
|
||||||
|
cat.legs[i] = part({ Size = V(0.32, 0.7, 0.32), Color = (i <= 2) and WHITE or GINGER })
|
||||||
|
end
|
||||||
|
cat.tail = {}
|
||||||
|
for i = 1, 5 do
|
||||||
|
cat.tail[i] = part({ Size = V(0.24, 0.24, 0.42), Color = (i == 5) and WHITE or GINGER })
|
||||||
|
end
|
||||||
|
cat.pos = LOBBY + V(10, 0, 12)
|
||||||
|
cat.dir = V(0, 0, -1)
|
||||||
|
cat.speed = 0
|
||||||
|
cat.lying = 0 -- 0 стоит … 1 лежит
|
||||||
|
cat.walk = 0 -- фаза шага
|
||||||
|
cat.home = LOBBY + V(-9, 0, 13) -- лежанка у фонтана
|
||||||
|
end
|
||||||
|
|
||||||
|
local function catTarget(root)
|
||||||
|
if root and (root.Position - LOBBY).Magnitude < 70 and (root.Position - cat.pos).Magnitude < 40 then
|
||||||
|
-- за игроком: держится чуть сбоку и позади
|
||||||
|
local look = root.CFrame.LookVector
|
||||||
|
local side = root.CFrame.RightVector
|
||||||
|
return V(root.Position.X, LOBBY.Y, root.Position.Z) - look * 3 + side * 2.2, 3.5, true
|
||||||
|
end
|
||||||
|
return cat.home, 0.5, false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function updateCat(dt, t)
|
||||||
|
local root = myRoot()
|
||||||
|
local target, stopDist, following = catTarget(root)
|
||||||
|
local flat = V(target.X - cat.pos.X, 0, target.Z - cat.pos.Z)
|
||||||
|
local dist = flat.Magnitude
|
||||||
|
local want = 0
|
||||||
|
if dist > stopDist then
|
||||||
|
want = math.clamp(dist * 1.2, 4, following and 15 or 6) -- догоняет бегом, домой идёт шагом
|
||||||
|
end
|
||||||
|
cat.speed += (want - cat.speed) * math.min(1, dt * 5)
|
||||||
|
if dist > 0.05 and cat.speed > 0.2 then
|
||||||
|
cat.dir = cat.dir:Lerp(flat.Unit, math.min(1, dt * 6)).Unit
|
||||||
|
local step = math.min(dist, cat.speed * dt)
|
||||||
|
cat.pos += cat.dir * step
|
||||||
|
end
|
||||||
|
-- не заходим в чашу фонтана и на прилавки
|
||||||
|
local r = V(cat.pos.X, 0, cat.pos.Z).Magnitude
|
||||||
|
if r < 14 then
|
||||||
|
cat.pos = LOBBY + V(cat.pos.X, 0, cat.pos.Z).Unit * 14
|
||||||
|
elseif r > 54 then
|
||||||
|
cat.pos = LOBBY + V(cat.pos.X, 0, cat.pos.Z).Unit * 54
|
||||||
|
end
|
||||||
|
local resting = not following and dist <= 0.6 and cat.speed < 0.5
|
||||||
|
cat.lying += ((resting and 1 or 0) - cat.lying) * math.min(1, dt * 2)
|
||||||
|
cat.walk += cat.speed * dt * 2.2
|
||||||
|
|
||||||
|
local L = cat.lying
|
||||||
|
local base = CFrame.lookAt(cat.pos, cat.pos + cat.dir) -- -Z — нос
|
||||||
|
local bob = math.abs(math.sin(cat.walk)) * 0.08 * math.min(1, cat.speed / 4)
|
||||||
|
local bodyY = 1.05 - 0.55 * L + bob
|
||||||
|
local body = base * CFrame.new(0, bodyY, 0)
|
||||||
|
cat.body.CFrame = body
|
||||||
|
cat.belly.CFrame = body * CFrame.new(0, -0.4, 0)
|
||||||
|
local headTurn = L > 0.5 and math.sin(t * 0.4) * 0.3 or 0
|
||||||
|
local head = body * CFrame.new(0, 0.55 - 0.25 * L, -1.35) * CFrame.Angles(0, headTurn, 0)
|
||||||
|
cat.head.CFrame = head
|
||||||
|
cat.muzzle.CFrame = head * CFrame.new(0, -0.18, -0.55)
|
||||||
|
cat.nose.CFrame = head * CFrame.new(0, -0.02, -0.66)
|
||||||
|
cat.eyes[1].CFrame = head * CFrame.new(-0.25, 0.12, -0.51)
|
||||||
|
cat.eyes[2].CFrame = head * CFrame.new(0.25, 0.12, -0.51)
|
||||||
|
cat.ears[1].CFrame = head * CFrame.new(-0.35, 0.68, 0.05) * CFrame.Angles(0, math.pi, 0)
|
||||||
|
cat.ears[2].CFrame = head * CFrame.new(0.35, 0.68, 0.05) * CFrame.Angles(0, math.pi, 0)
|
||||||
|
-- лапы: шагают попеременно, лёжа прячутся под корпус
|
||||||
|
local swing = math.sin(cat.walk) * 0.6 * math.min(1, cat.speed / 3)
|
||||||
|
local legPos = { { -0.42, -0.85 }, { 0.42, -0.85 }, { -0.42, 0.85 }, { 0.42, 0.85 } }
|
||||||
|
for i, lp in ipairs(legPos) do
|
||||||
|
local s = ((i == 1 or i == 4) and swing or -swing)
|
||||||
|
cat.legs[i].CFrame = body * CFrame.new(lp[1], -0.5 - 0.15 * (1 - L) + 0.25 * L, lp[2]) * CFrame.Angles(s, 0, 0)
|
||||||
|
* CFrame.new(0, -0.25 * (1 - L), 0)
|
||||||
|
end
|
||||||
|
-- хвост: цепочка сегментов, кончик покачивается
|
||||||
|
local tcf = body * CFrame.new(0, 0.3, 1.15) * CFrame.Angles(math.rad(35 - 25 * L), 0, 0)
|
||||||
|
for i, seg in ipairs(cat.tail) do
|
||||||
|
local sway = math.sin(t * 2.2 - i * 0.6) * (0.18 + 0.05 * i)
|
||||||
|
tcf = tcf * CFrame.Angles(math.rad(10), sway, 0) * CFrame.new(0, 0, 0.38)
|
||||||
|
seg.CFrame = tcf
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- чайки
|
||||||
|
|
||||||
|
local gulls = {}
|
||||||
|
for i = 1, 4 do
|
||||||
|
local g = {
|
||||||
|
body = part({ Size = V(0.7, 0.6, 1.9), Color = Color3.fromRGB(245, 245, 248) }),
|
||||||
|
head = part({ Size = V(0.5, 0.5, 0.55), Color = Color3.fromRGB(250, 250, 252) }),
|
||||||
|
beak = part({ Size = V(0.15, 0.15, 0.45), Color = Color3.fromRGB(245, 180, 60) }),
|
||||||
|
wings = { part({ Size = V(2.4, 0.1, 0.9), Color = Color3.fromRGB(205, 210, 220) }), part({ Size = V(2.4, 0.1, 0.9), Color = Color3.fromRGB(205, 210, 220) }) },
|
||||||
|
tips = { part({ Size = V(0.8, 0.1, 0.7), Color = Color3.fromRGB(60, 62, 70) }), part({ Size = V(0.8, 0.1, 0.7), Color = Color3.fromRGB(60, 62, 70) }) },
|
||||||
|
r = rng:NextNumber(70, 115), h = rng:NextNumber(52, 78), w = rng:NextNumber(0.1, 0.17) * (i % 2 == 0 and 1 or -1),
|
||||||
|
a = rng:NextNumber(0, math.pi * 2), flap = rng:NextNumber(0, 10),
|
||||||
|
}
|
||||||
|
gulls[i] = g
|
||||||
|
end
|
||||||
|
|
||||||
|
local function updateGulls(dt, t)
|
||||||
|
for _, g in ipairs(gulls) do
|
||||||
|
g.a += g.w * dt
|
||||||
|
local r = g.r + math.sin(t * 0.13 + g.a) * 12
|
||||||
|
local pos = V(math.cos(g.a) * r, g.h + math.sin(t * 0.4 + g.r) * 4, math.sin(g.a) * r)
|
||||||
|
local ahead = V(math.cos(g.a + 0.05 * math.sign(g.w)) * r, pos.Y, math.sin(g.a + 0.05 * math.sign(g.w)) * r)
|
||||||
|
local bank = -math.sign(g.w) * math.rad(18)
|
||||||
|
local cf = CFrame.lookAt(pos, ahead) * CFrame.Angles(0, 0, bank)
|
||||||
|
-- машет крыльями урывками, потом планирует
|
||||||
|
local flapping = math.sin(t * 0.5 + g.flap) > 0.2
|
||||||
|
local wing = flapping and math.sin(t * 9 + g.flap) * math.rad(35) or math.rad(4)
|
||||||
|
g.body.CFrame = cf
|
||||||
|
g.head.CFrame = cf * CFrame.new(0, 0.25, -1.05)
|
||||||
|
g.beak.CFrame = cf * CFrame.new(0, 0.2, -1.5)
|
||||||
|
for s = 1, 2 do
|
||||||
|
local side = (s == 1) and -1 or 1
|
||||||
|
local hinge = cf * CFrame.new(side * 0.35, 0.15, -0.1) * CFrame.Angles(0, 0, side * wing)
|
||||||
|
g.wings[s].CFrame = hinge * CFrame.new(side * 1.2, 0, 0)
|
||||||
|
g.tips[s].CFrame = hinge * CFrame.new(side * 2.4, 0, 0.05) * CFrame.Angles(0, 0, side * wing * 0.5) * CFrame.new(side * 0.35, 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- бабочки и светлячки
|
||||||
|
|
||||||
|
local butterflies = {}
|
||||||
|
local fireflyEmitters = {}
|
||||||
|
local function setupFlowersFX()
|
||||||
|
local anchors = {}
|
||||||
|
local foot = map:FindFirstChild("LobbyCliffFoot")
|
||||||
|
local flowers = foot and foot:FindFirstChild("Flowers")
|
||||||
|
if flowers then
|
||||||
|
for _, f in ipairs(flowers:GetChildren()) do
|
||||||
|
table.insert(anchors, f:GetPivot().Position)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #anchors == 0 then
|
||||||
|
for i = 1, 12 do
|
||||||
|
local a = i / 12 * math.pi * 2
|
||||||
|
table.insert(anchors, LOBBY + V(math.cos(a) * 70, 0, math.sin(a) * 70))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local COLORS = { Color3.fromRGB(255, 200, 80), Color3.fromRGB(255, 255, 255), Color3.fromRGB(150, 200, 255), Color3.fromRGB(255, 150, 200), Color3.fromRGB(255, 160, 70) }
|
||||||
|
for i = 1, 16 do
|
||||||
|
local anchor = anchors[rng:NextInteger(1, #anchors)]
|
||||||
|
local c = COLORS[rng:NextInteger(1, #COLORS)]
|
||||||
|
table.insert(butterflies, {
|
||||||
|
anchor = V(anchor.X, LOBBY.Y, anchor.Z), seed = rng:NextNumber(0, 100),
|
||||||
|
body = part({ Size = V(0.08, 0.08, 0.4), Color = Color3.fromRGB(50, 40, 35) }),
|
||||||
|
wings = { part({ Size = V(0.45, 0.04, 0.4), Color = c }), part({ Size = V(0.45, 0.04, 0.4), Color = c }) },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
-- светлячки: у фонарей лобби и у клумб, светятся только ночью
|
||||||
|
local spots = {}
|
||||||
|
for _, d in ipairs(map:GetDescendants()) do
|
||||||
|
if d:IsA("PointLight") and d.Parent:IsA("BasePart") then
|
||||||
|
local p = d.Parent.Position
|
||||||
|
if (V(p.X, 0, p.Z)).Magnitude < 80 and p.Y < 20 then
|
||||||
|
table.insert(spots, p - V(0, 3, 0))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i = 1, math.min(10, #anchors) do
|
||||||
|
table.insert(spots, anchors[rng:NextInteger(1, #anchors)] + V(0, 1.5, 0))
|
||||||
|
end
|
||||||
|
for _, p in ipairs(spots) do
|
||||||
|
local box = part({ Size = V(6, 3, 6), Transparency = 1, CFrame = CFrame.new(p) })
|
||||||
|
local pe = Instance.new("ParticleEmitter")
|
||||||
|
pe.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||||||
|
pe.Color = ColorSequence.new(Color3.fromRGB(220, 255, 120))
|
||||||
|
pe.LightEmission = 1
|
||||||
|
pe.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(0.2, 0.22), NumberSequenceKeypoint.new(0.8, 0.22), NumberSequenceKeypoint.new(1, 0) })
|
||||||
|
pe.Lifetime = NumberRange.new(3, 5)
|
||||||
|
pe.Rate = 1.5
|
||||||
|
pe.Speed = NumberRange.new(0.3, 0.8)
|
||||||
|
pe.SpreadAngle = Vector2.new(180, 180)
|
||||||
|
pe.Acceleration = V(0, 0.15, 0)
|
||||||
|
pe.Shape = Enum.ParticleEmitterShape.Box
|
||||||
|
pe.Enabled = false
|
||||||
|
pe.Parent = box
|
||||||
|
table.insert(fireflyEmitters, pe)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function updateButterflies(dt, t)
|
||||||
|
for _, b in ipairs(butterflies) do
|
||||||
|
local s = b.seed
|
||||||
|
local off = V(math.sin(t * 0.37 + s) * 2.6 + math.sin(t * 0.9 + s * 2) * 0.8, 1.6 + math.sin(t * 0.7 + s) * 0.9 + 0.5,
|
||||||
|
math.cos(t * 0.31 + s) * 2.6 + math.cos(t * 1.1 + s) * 0.8)
|
||||||
|
local pos = b.anchor + off
|
||||||
|
local vel = V(math.cos(t * 0.37 + s) * 0.37 * 2.6, 0, -math.sin(t * 0.31 + s) * 0.31 * 2.6)
|
||||||
|
local cf = CFrame.lookAt(pos, pos + (vel.Magnitude > 0.01 and vel or V(0, 0, -1)))
|
||||||
|
local flap = math.sin(t * 17 + s) * math.rad(60) + math.rad(15)
|
||||||
|
b.body.CFrame = cf
|
||||||
|
b.wings[1].CFrame = cf * CFrame.Angles(0, 0, flap) * CFrame.new(-0.24, 0, 0)
|
||||||
|
b.wings[2].CFrame = cf * CFrame.Angles(0, 0, -flap) * CFrame.new(0.24, 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local nightCheckAt = 0
|
||||||
|
local function updateFireflies(t)
|
||||||
|
if t - nightCheckAt < 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
nightCheckAt = t
|
||||||
|
local night = false
|
||||||
|
if Config.DayNight and Config.DayNight.enabled and Config.Nightness and Config.ClockAt then
|
||||||
|
local clock = Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart"))
|
||||||
|
night = Config.Nightness(clock) > 0.4
|
||||||
|
end
|
||||||
|
for _, pe in ipairs(fireflyEmitters) do
|
||||||
|
pe.Enabled = night
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- ветер: деревья, трава, цветы, кусты
|
||||||
|
|
||||||
|
local swayers = {}
|
||||||
|
local function addSway(model, amp, freq, range)
|
||||||
|
local parts, rel = {}, {}
|
||||||
|
local cf, size = model:GetBoundingBox()
|
||||||
|
local base = CFrame.new(cf.Position.X, cf.Position.Y - size.Y / 2, cf.Position.Z)
|
||||||
|
for _, p in ipairs(model:GetDescendants()) do
|
||||||
|
if p:IsA("BasePart") then
|
||||||
|
table.insert(parts, p)
|
||||||
|
table.insert(rel, base:ToObjectSpace(p.CFrame))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #parts > 0 then
|
||||||
|
table.insert(swayers, {
|
||||||
|
parts = parts, rel = rel, base = base, amp = math.rad(amp) * rng:NextNumber(0.8, 1.2),
|
||||||
|
freq = freq * rng:NextNumber(0.85, 1.15), phase = rng:NextNumber(0, math.pi * 2), range = range,
|
||||||
|
height = size.Y,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local leafTrees = {}
|
||||||
|
local function setupSway()
|
||||||
|
local function each(folder, amp, freq, range, leaves)
|
||||||
|
if not folder then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, m in ipairs(folder:GetChildren()) do
|
||||||
|
if m:IsA("Model") then
|
||||||
|
addSway(m, amp, freq, range)
|
||||||
|
if leaves then
|
||||||
|
table.insert(leafTrees, m)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- амплитуда (градусы) и частота (качаний в секунду): деревья — чуть заметно и медленно, трава — живее
|
||||||
|
each(map:FindFirstChild("LobbyTrees"), 0.6, 0.32, 130, true)
|
||||||
|
each(map:FindFirstChild("LobbyForest"), 0.6, 0.32, 130, true)
|
||||||
|
local foot = map:FindFirstChild("LobbyCliffFoot")
|
||||||
|
if foot then
|
||||||
|
each(foot:FindFirstChild("Grass"), 2.8, 0.8, 50)
|
||||||
|
each(foot:FindFirstChild("Flowers"), 3.2, 0.85, 50)
|
||||||
|
each(foot:FindFirstChild("Bushes"), 1, 0.5, 60)
|
||||||
|
end
|
||||||
|
-- падающие листья: у ближайших к площади деревьев, из объёма кроны
|
||||||
|
table.sort(leafTrees, function(a, b)
|
||||||
|
return V(a:GetPivot().Position.X, 0, a:GetPivot().Position.Z).Magnitude < V(b:GetPivot().Position.X, 0, b:GetPivot().Position.Z).Magnitude
|
||||||
|
end)
|
||||||
|
for i = 1, math.min(24, #leafTrees) do
|
||||||
|
local cf, size = leafTrees[i]:GetBoundingBox()
|
||||||
|
local crown = part({ Size = V(size.X * 0.8, size.Y * 0.35, size.Z * 0.8), Transparency = 1, CFrame = cf * CFrame.new(0, size.Y * 0.2, 0) })
|
||||||
|
local pe = Instance.new("ParticleEmitter")
|
||||||
|
pe.Texture = LEAF_TEXTURE
|
||||||
|
pe.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255), Color3.fromRGB(255, 235, 170))
|
||||||
|
pe.Size = NumberSequence.new(0.45)
|
||||||
|
pe.Lifetime = NumberRange.new(6, 9)
|
||||||
|
pe.Rate = 0.15
|
||||||
|
pe.Speed = NumberRange.new(0.2, 0.6)
|
||||||
|
pe.Acceleration = V(0.6, -1.1, 0.2)
|
||||||
|
pe.Drag = 0.6
|
||||||
|
pe.Rotation = NumberRange.new(0, 360)
|
||||||
|
pe.RotSpeed = NumberRange.new(-140, 140)
|
||||||
|
pe.Orientation = Enum.ParticleOrientation.VelocityPerpendicular
|
||||||
|
pe.Shape = Enum.ParticleEmitterShape.Box
|
||||||
|
pe.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.08, 0), NumberSequenceKeypoint.new(0.85, 0), NumberSequenceKeypoint.new(1, 1) })
|
||||||
|
pe.LightInfluence = 1
|
||||||
|
pe.Parent = crown
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local swayAcc = 0
|
||||||
|
local bulkParts, bulkCFrames = {}, {}
|
||||||
|
local function updateSway(dt, t)
|
||||||
|
swayAcc += dt
|
||||||
|
if swayAcc < 1 / 30 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
swayAcc = 0
|
||||||
|
local cam = camPos()
|
||||||
|
-- порывы: ветер то стихает, то усиливается
|
||||||
|
local gust = 0.75 + 0.2 * math.sin(t * 0.23) + 0.08 * math.sin(t * 0.71)
|
||||||
|
table.clear(bulkParts)
|
||||||
|
table.clear(bulkCFrames)
|
||||||
|
for _, s in ipairs(swayers) do
|
||||||
|
if (s.base.Position - cam).Magnitude < s.range then
|
||||||
|
local a = s.amp * gust
|
||||||
|
local ax = a * math.sin(t * s.freq * math.pi * 2 + s.phase)
|
||||||
|
local az = a * 0.6 * math.sin(t * s.freq * math.pi * 1.3 + s.phase * 1.7) + a * 0.2 -- лёгкий наклон по ветру
|
||||||
|
local pose = s.base * CFrame.Angles(ax, 0, az)
|
||||||
|
for i, p in ipairs(s.parts) do
|
||||||
|
table.insert(bulkParts, p)
|
||||||
|
table.insert(bulkCFrames, pose * s.rel[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #bulkParts > 0 then
|
||||||
|
workspace:BulkMoveTo(bulkParts, bulkCFrames, Enum.BulkMoveMode.FireCFrameChanged)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- запуск
|
||||||
|
|
||||||
|
task.wait(3) -- карта и NPC успевают появиться
|
||||||
|
scanNpcs()
|
||||||
|
setupFlowersFX()
|
||||||
|
setupSway()
|
||||||
|
local scanAt = os.clock()
|
||||||
|
local t0 = os.clock()
|
||||||
|
RunService.RenderStepped:Connect(function(dt)
|
||||||
|
local t = os.clock() - t0
|
||||||
|
if os.clock() - scanAt > 5 then
|
||||||
|
scanAt = os.clock()
|
||||||
|
scanNpcs()
|
||||||
|
end
|
||||||
|
updateNpcs(dt)
|
||||||
|
if (camPos() - LOBBY).Magnitude > LOBBY_VIEW then
|
||||||
|
return -- игрок в другом мире: лобби не анимируем
|
||||||
|
end
|
||||||
|
updateCat(dt, t)
|
||||||
|
updateGulls(dt, t)
|
||||||
|
updateButterflies(dt, t)
|
||||||
|
updateFireflies(t)
|
||||||
|
updateSway(dt, t)
|
||||||
|
end)
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
-- UiTheme (ModuleScript) -> StarterPlayer > StarterPlayerScripts
|
||||||
|
-- Общий стиль интерфейса «средневековая гильдия»: палитра, шрифты с кириллицей,
|
||||||
|
-- украшения окон (золотая рамка, заклёпки, багровая лента) и масштаб под размер экрана.
|
||||||
|
|
||||||
|
local UserInputService = game:GetService("UserInputService")
|
||||||
|
|
||||||
|
local Theme = {}
|
||||||
|
|
||||||
|
---------------------------------------------------------------- палитра
|
||||||
|
-- старые ключи (bg, panel, blue…) оставлены, чтобы весь интерфейс перекрасился сразу
|
||||||
|
|
||||||
|
local C = {
|
||||||
|
woodDark = Color3.fromRGB(40, 28, 20),
|
||||||
|
wood = Color3.fromRGB(66, 46, 30),
|
||||||
|
woodLight = Color3.fromRGB(98, 70, 44),
|
||||||
|
parchment = Color3.fromRGB(236, 220, 180),
|
||||||
|
ink = Color3.fromRGB(52, 36, 24),
|
||||||
|
gold = Color3.fromRGB(218, 172, 92),
|
||||||
|
goldBright = Color3.fromRGB(255, 214, 120),
|
||||||
|
goldDark = Color3.fromRGB(140, 102, 52),
|
||||||
|
crimson = Color3.fromRGB(150, 40, 35),
|
||||||
|
forest = Color3.fromRGB(64, 112, 62),
|
||||||
|
silver = Color3.fromRGB(214, 220, 228),
|
||||||
|
pearl = Color3.fromRGB(235, 225, 245),
|
||||||
|
}
|
||||||
|
C.bg = C.woodDark
|
||||||
|
C.panel = C.wood
|
||||||
|
C.panel2 = C.woodLight
|
||||||
|
C.green = C.forest
|
||||||
|
C.red = C.crimson
|
||||||
|
C.blue = Color3.fromRGB(70, 92, 112) -- «сталь»: телепорт, надеть
|
||||||
|
C.purple = Color3.fromRGB(110, 62, 118)
|
||||||
|
C.grey = Color3.fromRGB(84, 72, 60)
|
||||||
|
C.text = C.parchment
|
||||||
|
C.muted = Color3.fromRGB(192, 172, 136)
|
||||||
|
C.line = C.goldDark
|
||||||
|
C.dark = Color3.fromRGB(24, 16, 11) -- подложка полосок прогресса
|
||||||
|
Theme.C = C
|
||||||
|
|
||||||
|
-- цвета для RichText
|
||||||
|
Theme.HEX = {
|
||||||
|
gold = "#FFD678",
|
||||||
|
muted = "#C0AC88",
|
||||||
|
green = "#9BE08C",
|
||||||
|
red = "#FF8A7A",
|
||||||
|
silver = "#DCE2EA",
|
||||||
|
}
|
||||||
|
|
||||||
|
---------------------------------------------------------------- значки валют
|
||||||
|
-- 🪙 в Roblox не рисуется (квадратик), поэтому серебро — светлый кружок
|
||||||
|
Theme.SILVER = "⚪"
|
||||||
|
Theme.PEARL = "🦪"
|
||||||
|
Theme.SEAL = "📜"
|
||||||
|
|
||||||
|
---------------------------------------------------------------- шрифты
|
||||||
|
-- проверено в Studio: у Merriweather и Nunito есть кириллица (у FredokaOne и Gotham — нет)
|
||||||
|
|
||||||
|
local function family(name, weight)
|
||||||
|
return Font.new("rbxasset://fonts/families/" .. name .. ".json", weight)
|
||||||
|
end
|
||||||
|
Theme.TITLE_FACE = family("Merriweather", Enum.FontWeight.Heavy)
|
||||||
|
Theme.BODY_FACE = family("Nunito", Enum.FontWeight.ExtraBold)
|
||||||
|
Theme.BODY2_FACE = family("Nunito", Enum.FontWeight.Bold)
|
||||||
|
Theme.HINT_FACE = family("Nunito", Enum.FontWeight.Heavy)
|
||||||
|
-- старые Enum.Font в коде подменяются на эти шрифты
|
||||||
|
Theme.FACES = {
|
||||||
|
[Enum.Font.FredokaOne] = Theme.TITLE_FACE,
|
||||||
|
[Enum.Font.GothamBold] = Theme.BODY_FACE,
|
||||||
|
[Enum.Font.GothamMedium] = Theme.BODY2_FACE,
|
||||||
|
[Enum.Font.GothamBlack] = Theme.TITLE_FACE,
|
||||||
|
}
|
||||||
|
|
||||||
|
---------------------------------------------------------------- украшения
|
||||||
|
|
||||||
|
local function make(class, props)
|
||||||
|
local o = Instance.new(class)
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
if k ~= "Parent" then
|
||||||
|
o[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
o.Parent = props.Parent
|
||||||
|
return o
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ромбики-заклёпки по углам
|
||||||
|
function Theme.rivets(frame, size, inset, color)
|
||||||
|
size = size or 10
|
||||||
|
inset = inset or 6
|
||||||
|
for _, a in ipairs({ Vector2.new(0, 0), Vector2.new(1, 0), Vector2.new(0, 1), Vector2.new(1, 1) }) do
|
||||||
|
local r = make("Frame", {
|
||||||
|
Name = "Rivet", Size = UDim2.fromOffset(size, size), AnchorPoint = Vector2.new(0.5, 0.5), Rotation = 45,
|
||||||
|
Position = UDim2.new(a.X, a.X == 0 and inset or -inset, a.Y, a.Y == 0 and inset or -inset),
|
||||||
|
BackgroundColor3 = color or C.gold, BorderSizePixel = 0, ZIndex = 6, Parent = frame,
|
||||||
|
})
|
||||||
|
make("UIStroke", { Color = C.ink, Thickness = 1.5, Parent = r })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- рамка в 2 слоя: снаружи тёмное золото (UIStroke у самого окна), внутри — светлая тонкая линия
|
||||||
|
function Theme.innerBorder(frame, inset, radius, color, transparency)
|
||||||
|
inset = inset or 5
|
||||||
|
local b = make("Frame", {
|
||||||
|
Name = "InnerBorder", Size = UDim2.new(1, -inset * 2, 1, -inset * 2), Position = UDim2.fromOffset(inset, inset),
|
||||||
|
BackgroundTransparency = 1, ZIndex = 1, Parent = frame,
|
||||||
|
})
|
||||||
|
make("UICorner", { CornerRadius = UDim.new(0, radius or 8), Parent = b })
|
||||||
|
make("UIStroke", { Color = color or C.gold, Thickness = 1.5, Transparency = transparency or 0.25, Parent = b })
|
||||||
|
return b
|
||||||
|
end
|
||||||
|
|
||||||
|
-- деревянная панель: тёплый градиент сверху вниз
|
||||||
|
function Theme.woodGradient(top, bottom)
|
||||||
|
return make("UIGradient", { Color = ColorSequence.new(top or C.wood, bottom or C.woodDark), Rotation = 90 })
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- масштаб под экран
|
||||||
|
-- Весь интерфейс лежит в «холсте» Root: он во столько же раз больше экрана, во сколько уменьшен
|
||||||
|
-- UIScale. Поэтому вёрстка в пикселях одинакова на любом экране, а на телефоне всё меньше и плотнее.
|
||||||
|
-- compact — узкий/сенсорный экран: другая раскладка (сетка кнопок, окна на весь экран).
|
||||||
|
|
||||||
|
local BASE = Vector2.new(1280, 720)
|
||||||
|
local BASE_COMPACT = Vector2.new(780, 430)
|
||||||
|
local listeners = {}
|
||||||
|
Theme.compact = false
|
||||||
|
Theme.scale = 1
|
||||||
|
|
||||||
|
local function isCompact(size)
|
||||||
|
return size.X < 900 or UserInputService.TouchEnabled
|
||||||
|
end
|
||||||
|
|
||||||
|
function Theme.onLayout(fn)
|
||||||
|
table.insert(listeners, fn)
|
||||||
|
fn(Theme.compact, Theme.scale)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Theme.scaleRoot(screenGui, name)
|
||||||
|
local root = make("Frame", { Name = name or "Root", BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), Parent = screenGui })
|
||||||
|
local uiScale = make("UIScale", { Parent = root })
|
||||||
|
local function update()
|
||||||
|
local size = screenGui.AbsoluteSize
|
||||||
|
if size.X < 2 or size.Y < 2 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local compact = isCompact(size)
|
||||||
|
local base = compact and BASE_COMPACT or BASE
|
||||||
|
local s = math.clamp(math.min(size.X / base.X, size.Y / base.Y), 0.45, 1)
|
||||||
|
uiScale.Scale = s
|
||||||
|
root.Size = UDim2.fromScale(1 / s, 1 / s)
|
||||||
|
if compact ~= Theme.compact or s ~= Theme.scale then
|
||||||
|
Theme.compact, Theme.scale = compact, s
|
||||||
|
for _, fn in ipairs(listeners) do
|
||||||
|
task.spawn(fn, compact, s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
screenGui:GetPropertyChangedSignal("AbsoluteSize"):Connect(update)
|
||||||
|
update()
|
||||||
|
return root
|
||||||
|
end
|
||||||
|
|
||||||
|
-- второй ScreenGui (погода и т.п.) — тот же масштаб, но без своей раскладки
|
||||||
|
function Theme.followScale(screenGui)
|
||||||
|
local root = make("Frame", { Name = "Root", BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), Parent = screenGui })
|
||||||
|
local uiScale = make("UIScale", { Parent = root })
|
||||||
|
local function apply(_, s)
|
||||||
|
uiScale.Scale = s
|
||||||
|
root.Size = UDim2.fromScale(1 / s, 1 / s)
|
||||||
|
end
|
||||||
|
local function update()
|
||||||
|
local size = screenGui.AbsoluteSize
|
||||||
|
if size.X < 2 or size.Y < 2 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local compact = isCompact(size)
|
||||||
|
local base = compact and BASE_COMPACT or BASE
|
||||||
|
apply(compact, math.clamp(math.min(size.X / base.X, size.Y / base.Y), 0.45, 1))
|
||||||
|
end
|
||||||
|
screenGui:GetPropertyChangedSignal("AbsoluteSize"):Connect(update)
|
||||||
|
update()
|
||||||
|
return root
|
||||||
|
end
|
||||||
|
|
||||||
|
return Theme
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
-- Дом гильдии рыбаков в лобби + лавки наживки. Запускать в Studio в режиме редактирования
|
||||||
|
-- (Command Bar или Studio MCP), потом сохранить плейс (Ctrl+S). Повторный запуск пересобирает только
|
||||||
|
-- то, что строит этот скрипт (папки FishingMap.GuildHall и FishingMap.BaitShops), остальная карта не трогается.
|
||||||
|
--
|
||||||
|
-- Гильдия занимает правый из двух домиков на севере лобби (Workspace.GuildHouse — тот же дом из набора,
|
||||||
|
-- что и левый). Перед его фасадом: вывеска «⚓ ГИЛЬДИЯ РЫБАКОВ», знамёна, фонари, стойка и место
|
||||||
|
-- Старейшины Ворона (NpcSpot с атрибутами, GuildElder, Look=Elder, Action=Guild) и доска заказов
|
||||||
|
-- (атрибут OrderBoard + подсказка Action=Orders).
|
||||||
|
|
||||||
|
local map = workspace:FindFirstChild("FishingMap")
|
||||||
|
assert(map, "Нет Workspace.FishingMap")
|
||||||
|
|
||||||
|
local V = Vector3.new
|
||||||
|
local FLOOR = 1.02 -- верх дорожки лобби
|
||||||
|
|
||||||
|
-- правый домик: при первом запуске это безымянная Workspace.Model справа от прохода
|
||||||
|
local house = workspace:FindFirstChild("GuildHouse")
|
||||||
|
if not house then
|
||||||
|
for _, c in ipairs(workspace:GetChildren()) do
|
||||||
|
if c:IsA("Model") and c.Name == "Model" then
|
||||||
|
local cf, size = c:GetBoundingBox()
|
||||||
|
if cf.X > 10 and cf.X < 40 and cf.Z < -40 and cf.Z > -70 and size.X > 30 then
|
||||||
|
house = c
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert(house, "Не найден правый домик лобби")
|
||||||
|
house.Name = "GuildHouse"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- фасад, смотрящий на площадь (+Z): ищем лучом
|
||||||
|
local houseCF = house:GetBoundingBox()
|
||||||
|
local X0 = houseCF.X - 1.7 -- середина стены (без крыльца)
|
||||||
|
local probe = RaycastParams.new()
|
||||||
|
probe.FilterType = Enum.RaycastFilterType.Include
|
||||||
|
probe.FilterDescendantsInstances = { house }
|
||||||
|
local facadeHit = workspace:Raycast(V(X0, FLOOR + 6, -20), V(0, 0, -40), probe)
|
||||||
|
assert(facadeHit, "Не найден фасад домика гильдии")
|
||||||
|
local FZ = facadeHit.Position.Z -- плоскость фасада
|
||||||
|
|
||||||
|
local WOOD = Color3.fromRGB(110, 72, 44)
|
||||||
|
local DARK = Color3.fromRGB(66, 42, 26)
|
||||||
|
local GOLD = Color3.fromRGB(214, 160, 70)
|
||||||
|
local CRIMSON = Color3.fromRGB(150, 40, 35)
|
||||||
|
local PARCH = Color3.fromRGB(236, 220, 180)
|
||||||
|
local TITLE_FONT = Font.new("rbxasset://fonts/families/Merriweather.json", Enum.FontWeight.Heavy)
|
||||||
|
|
||||||
|
for _, name in ipairs({ "GuildHall", "BaitShops" }) do
|
||||||
|
local old = map:FindFirstChild(name)
|
||||||
|
if old then
|
||||||
|
old:Destroy()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local hall = Instance.new("Folder")
|
||||||
|
hall.Name = "GuildHall"
|
||||||
|
hall.Parent = map
|
||||||
|
|
||||||
|
local rng = Random.new(42)
|
||||||
|
local function shade(c, k)
|
||||||
|
k = 1 + rng:NextNumber(-k, k)
|
||||||
|
return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function P(props, parent)
|
||||||
|
local p = Instance.new(props.ClassName or "Part")
|
||||||
|
props.ClassName = nil
|
||||||
|
p.Anchored = true
|
||||||
|
p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||||||
|
p.Material = Enum.Material.SmoothPlastic
|
||||||
|
for k, v in pairs(props) do
|
||||||
|
p[k] = v
|
||||||
|
end
|
||||||
|
p.Parent = parent or hall
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
|
||||||
|
local function surfaceText(part, face, text, color, size)
|
||||||
|
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.FontFace = TITLE_FONT
|
||||||
|
t.TextScaled = true
|
||||||
|
t.TextColor3 = color
|
||||||
|
t.TextStrokeTransparency = 0.35
|
||||||
|
t.TextStrokeColor3 = Color3.fromRGB(40, 28, 20)
|
||||||
|
t.Text = text
|
||||||
|
t.Parent = sg
|
||||||
|
local pad = Instance.new("UIPadding")
|
||||||
|
pad.PaddingLeft, pad.PaddingRight = UDim.new(0.05, 0), UDim.new(0.05, 0)
|
||||||
|
pad.PaddingTop, pad.PaddingBottom = UDim.new(size or 0.1, 0), UDim.new(size or 0.1, 0)
|
||||||
|
pad.Parent = t
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
local function billboard(target, text, color, offsetY, width)
|
||||||
|
local bb = Instance.new("BillboardGui")
|
||||||
|
bb.Size = UDim2.fromOffset(width or 300, 56)
|
||||||
|
bb.StudsOffset = V(0, offsetY, 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.FontFace = TITLE_FONT
|
||||||
|
t.TextScaled = true
|
||||||
|
t.TextColor3 = color
|
||||||
|
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 12
|
||||||
|
pp.RequiresLineOfSight = false
|
||||||
|
pp:SetAttribute("Action", action)
|
||||||
|
pp.Parent = target
|
||||||
|
return pp
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lantern(pos, parent)
|
||||||
|
P({ Name = "LanternCap", Size = V(1.1, 0.3, 1.1), CFrame = CFrame.new(pos + V(0, 0.75, 0)), Color = DARK }, parent)
|
||||||
|
local l = P({ Name = "GuildLantern", Size = V(0.8, 1.1, 0.8), CFrame = CFrame.new(pos), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 205, 130) }, parent)
|
||||||
|
local light = Instance.new("PointLight")
|
||||||
|
light.Range = 16
|
||||||
|
light.Brightness = 1.2
|
||||||
|
light.Color = Color3.fromRGB(255, 205, 150)
|
||||||
|
light.Parent = l
|
||||||
|
end
|
||||||
|
|
||||||
|
-- большой куст из набора домика стоит там, где стойка: сдвигаем его левее (один раз)
|
||||||
|
local bush = house:FindFirstChild("Object.5989")
|
||||||
|
if bush and bush.Position.X > houseCF.X - 9 then
|
||||||
|
bush.CFrame = bush.CFrame - V(4, 0, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- знамёна по углам фасада
|
||||||
|
|
||||||
|
for _, x in ipairs({ X0 - 9.2, X0 + 9.2 }) do
|
||||||
|
P({ Name = "BannerRod", Size = V(3.2, 0.25, 0.25), CFrame = CFrame.new(x, FLOOR + 13.4, FZ + 0.5), Color = GOLD })
|
||||||
|
local banner = P({ Name = "GuildBanner", Size = V(2.6, 6.8, 0.2), CFrame = CFrame.new(x, FLOOR + 9.9, FZ + 0.5), Color = CRIMSON, Material = Enum.Material.Fabric, CanCollide = false })
|
||||||
|
P({ Name = "BannerTrim", Size = V(2.6, 0.3, 0.22), CFrame = CFrame.new(x, FLOOR + 6.6, FZ + 0.51), Color = GOLD, CanCollide = false })
|
||||||
|
surfaceText(banner, Enum.NormalId.Back, "⚓", Color3.fromRGB(255, 214, 120), 0.25)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- стойка Старейшины перед фасадом
|
||||||
|
|
||||||
|
local DZ = FZ + 5.6 -- стойка
|
||||||
|
local EZ = FZ + 2.8 -- Старейшина за стойкой
|
||||||
|
P({ Name = "GuildDesk", Size = V(9, 3.4, 1.8), CFrame = CFrame.new(X0, FLOOR + 1.7, DZ), Color = DARK })
|
||||||
|
P({ Name = "DeskTop", Size = V(9.6, 0.3, 2.4), CFrame = CFrame.new(X0, FLOOR + 3.55, DZ), Color = WOOD })
|
||||||
|
P({ Name = "DeskTrim", Size = V(9.1, 0.35, 1.9), CFrame = CFrame.new(X0, FLOOR + 0.6, DZ), Color = GOLD })
|
||||||
|
local front = P({ Name = "DeskFront", Size = V(6, 1.6, 0.15), CFrame = CFrame.new(X0, FLOOR + 2, DZ + 0.95), Color = CRIMSON, Material = Enum.Material.Fabric })
|
||||||
|
surfaceText(front, Enum.NormalId.Back, "⚓ F·E·D·C·B·A·S", Color3.fromRGB(255, 214, 120), 0.18)
|
||||||
|
P({ Name = "GuildBook", Size = V(1.6, 0.25, 1.1), CFrame = CFrame.new(X0 - 1.6, FLOOR + 3.85, DZ) * CFrame.Angles(0, math.rad(12), 0), Color = Color3.fromRGB(110, 30, 30) })
|
||||||
|
P({ Name = "BookPages", Size = V(1.5, 0.27, 1.0), CFrame = CFrame.new(X0 - 1.6, FLOOR + 3.87, DZ) * CFrame.Angles(0, math.rad(12), 0), Color = PARCH })
|
||||||
|
P({ Name = "SealBox", Size = V(1.2, 0.7, 0.9), CFrame = CFrame.new(X0 + 2.2, FLOOR + 4.05, DZ), Color = GOLD })
|
||||||
|
P({ Name = "Inkwell", Size = V(0.45, 0.5, 0.45), CFrame = CFrame.new(X0 + 0.4, FLOOR + 3.95, DZ - 0.3), Color = Color3.fromRGB(30, 30, 35) })
|
||||||
|
P({ Name = "Quill", Size = V(0.1, 1.3, 0.1), CFrame = CFrame.new(X0 + 0.5, FLOOR + 4.4, DZ - 0.3) * CFrame.Angles(0, 0, math.rad(-20)), Color = Color3.fromRGB(240, 240, 235), CanCollide = false })
|
||||||
|
-- ворота над стойкой с вывеской: её видно с площади, а не из-под свеса крыши
|
||||||
|
local GATE_H = 11
|
||||||
|
for _, x in ipairs({ X0 - 5.2, X0 + 5.2 }) do
|
||||||
|
P({ Name = "GatePost", Size = V(0.8, GATE_H, 0.8), CFrame = CFrame.new(x, FLOOR + GATE_H / 2, DZ - 0.3), Color = DARK })
|
||||||
|
P({ Name = "GateFoot", Size = V(1.4, 0.8, 1.4), CFrame = CFrame.new(x, FLOOR + 0.4, DZ - 0.3), Color = Color3.fromRGB(120, 112, 104), Material = Enum.Material.Slate })
|
||||||
|
end
|
||||||
|
P({ Name = "GateBeam", Size = V(12, 0.9, 1.2), CFrame = CFrame.new(X0, FLOOR + GATE_H - 0.2, DZ - 0.3), Color = DARK })
|
||||||
|
P({ Name = "SignFrame", Size = V(12.6, 3.9, 0.3), CFrame = CFrame.new(X0, FLOOR + GATE_H + 2, DZ - 0.45), Color = GOLD })
|
||||||
|
local sign = P({ Name = "GuildSign", Size = V(12, 3.3, 0.5), CFrame = CFrame.new(X0, FLOOR + GATE_H + 2, DZ - 0.2), Color = Color3.fromRGB(70, 45, 30) })
|
||||||
|
surfaceText(sign, Enum.NormalId.Back, "⚓ ГИЛЬДИЯ РЫБАКОВ", Color3.fromRGB(255, 214, 120), 0.14)
|
||||||
|
billboard(sign, "⚔ Гильдия рыбаков", Color3.fromRGB(255, 214, 120), 3.6, 320)
|
||||||
|
for _, x in ipairs({ X0 - 3.6, X0 + 3.6 }) do
|
||||||
|
P({ Name = "Chain", Size = V(0.15, 1.2, 0.15), CFrame = CFrame.new(x, FLOOR + GATE_H - 1.2, DZ - 0.3), Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal })
|
||||||
|
lantern(V(x, FLOOR + GATE_H - 2.3, DZ - 0.3), hall)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ковровая дорожка от площади к стойке
|
||||||
|
P({ Name = "GuildRug", Size = V(4, 0.1, 9), CFrame = CFrame.new(X0, FLOOR + 0.05, DZ + 5.6), Color = shade(CRIMSON, 0.03), Material = Enum.Material.Fabric, CanCollide = false })
|
||||||
|
for _, x in ipairs({ X0 - 2.05, X0 + 2.05 }) do
|
||||||
|
P({ Name = "RugTrim", Size = V(0.15, 0.11, 9), CFrame = CFrame.new(x, FLOOR + 0.05, DZ + 5.6), Color = GOLD, CanCollide = false })
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------- доска заказов (справа от стойки, лицом к площади)
|
||||||
|
|
||||||
|
local BX, BZ = X0 + 9.2, FZ + 4.4
|
||||||
|
local boardCF = CFrame.new(BX, FLOOR, BZ) * CFrame.Angles(0, math.rad(-18), 0) -- чуть повёрнута к центру площади
|
||||||
|
local function at(x, y, z)
|
||||||
|
return boardCF * CFrame.new(x, y, z)
|
||||||
|
end
|
||||||
|
for _, x in ipairs({ -3.4, 3.4 }) do
|
||||||
|
P({ Name = "BoardLeg", Size = V(0.5, 8.6, 0.5), CFrame = at(x, 4.3, -0.1), Color = DARK })
|
||||||
|
end
|
||||||
|
local board = P({ Name = "OrderBoard", Size = V(6.4, 4.6, 0.4), CFrame = at(0, 5, 0), Color = Color3.fromRGB(112, 80, 52) })
|
||||||
|
board:SetAttribute("OrderBoard", true)
|
||||||
|
P({ Name = "BoardFrame", Size = V(6.9, 5.1, 0.35), CFrame = at(0, 5, -0.1), Color = DARK })
|
||||||
|
P({ Name = "BoardRoof", Size = V(7.6, 0.3, 1.8), CFrame = at(0, 8.9, 0.2) * CFrame.Angles(math.rad(14), 0, 0), Color = Color3.fromRGB(110, 34, 30) })
|
||||||
|
local header = P({ Name = "BoardHeader", Size = V(6.4, 1.1, 0.3), CFrame = at(0, 8, 0.15), Color = Color3.fromRGB(70, 45, 30) })
|
||||||
|
surfaceText(header, Enum.NormalId.Back, "📜 ДОСКА ЗАКАЗОВ", Color3.fromRGB(255, 214, 120), 0.12)
|
||||||
|
-- пергаменты-заказы, приколотые к доске
|
||||||
|
for i, spot in ipairs({ { 6.2, -2.1 }, { 6.0, 0.1 }, { 6.3, 2.2 }, { 4.0, -1.2 }, { 3.8, 1.1 }, { 3.9, 2.6 } }) do
|
||||||
|
local note = P({
|
||||||
|
Name = "OrderNote", Size = V(1.35, 1.7, 0.06), Color = shade(PARCH, 0.05), CanCollide = false,
|
||||||
|
CFrame = at(spot[2], spot[1] - 0.6, 0.23) * CFrame.Angles(0, 0, math.rad(rng:NextNumber(-8, 8))),
|
||||||
|
})
|
||||||
|
P({ Name = "Pin", Size = V(0.2, 0.2, 0.12), CFrame = note.CFrame * CFrame.new(0, 0.65, 0.05), Color = (i % 2 == 0) and CRIMSON or GOLD, CanCollide = false })
|
||||||
|
end
|
||||||
|
prompt(board, "Заказы гильдии", "Доска заказов", "Orders", 12)
|
||||||
|
-- бочка у доски
|
||||||
|
P({ Name = "Barrel", ClassName = "Part", Shape = Enum.PartType.Cylinder, Size = V(3, 2.4, 2.4), CFrame = at(4.7, 1.5, 0.4) * CFrame.Angles(0, 0, math.rad(90)), Color = shade(WOOD, 0.08) })
|
||||||
|
P({ Name = "BarrelBand", ClassName = "Part", Shape = Enum.PartType.Cylinder, Size = V(0.3, 2.55, 2.55), CFrame = at(4.7, 1.5, 0.4) * CFrame.Angles(0, 0, math.rad(90)), Color = DARK })
|
||||||
|
|
||||||
|
---------------------------------------------------------------- Старейшина Ворон
|
||||||
|
|
||||||
|
local elder = P({ Name = "NpcSpot", Size = V(2, 5, 1), CFrame = CFrame.new(X0, FLOOR + 3, EZ) * CFrame.Angles(0, math.pi, 0),
|
||||||
|
Color = Color3.fromRGB(60, 50, 70), Transparency = 0.5, CanCollide = false, CanQuery = false, CanTouch = false })
|
||||||
|
elder:SetAttribute("NpcName", "Старейшина Ворон")
|
||||||
|
elder:SetAttribute("SkinColor", Color3.fromRGB(222, 176, 140))
|
||||||
|
elder:SetAttribute("ShirtColor", Color3.fromRGB(58, 46, 70))
|
||||||
|
elder:SetAttribute("PantsColor", Color3.fromRGB(48, 40, 34))
|
||||||
|
elder:SetAttribute("HatColor", Color3.fromRGB(150, 150, 152))
|
||||||
|
elder:SetAttribute("NpcAction", "Guild")
|
||||||
|
elder:SetAttribute("NpcActionText", "Гильдия")
|
||||||
|
elder:SetAttribute("Look", "Elder")
|
||||||
|
elder:SetAttribute("GuildElder", true)
|
||||||
|
|
||||||
|
---------------------------------------------------------------- лавки наживки: у магазина в лобби и у деда на причале Мира 1
|
||||||
|
|
||||||
|
local shops = Instance.new("Folder")
|
||||||
|
shops.Name = "BaitShops"
|
||||||
|
shops.Parent = map
|
||||||
|
|
||||||
|
local function baitCrate(pos, objectText)
|
||||||
|
local crate = P({ Name = "BaitCrate", Size = V(2.6, 2.2, 2.2), CFrame = CFrame.new(pos + V(0, 1.1, 0)), Color = shade(WOOD, 0.06) }, shops)
|
||||||
|
P({ Name = "CrateBand", Size = V(2.7, 0.3, 2.3), CFrame = CFrame.new(pos + V(0, 1.6, 0)), Color = DARK }, shops)
|
||||||
|
P({ Name = "Worms", Size = V(2.3, 0.2, 1.9), CFrame = CFrame.new(pos + V(0, 2.25, 0)), Color = Color3.fromRGB(96, 66, 46), Material = Enum.Material.Ground }, shops)
|
||||||
|
for i = 1, 4 do
|
||||||
|
P({ Name = "Worm", ClassName = "Part", Shape = Enum.PartType.Cylinder, Size = V(0.9, 0.25, 0.25), CanCollide = false,
|
||||||
|
CFrame = CFrame.new(pos + V(rng:NextNumber(-0.8, 0.8), 2.4, rng:NextNumber(-0.6, 0.6))) * CFrame.Angles(0, rng:NextNumber(0, 6.28), 0),
|
||||||
|
Color = Color3.fromRGB(210, 120, 120) }, shops)
|
||||||
|
end
|
||||||
|
billboard(crate, "🐛 Наживка", Color3.fromRGB(255, 214, 120), 3.2, 180)
|
||||||
|
prompt(crate, "Наживка", objectText, "Bait", 11)
|
||||||
|
return crate
|
||||||
|
end
|
||||||
|
|
||||||
|
local function groundAt(x, z)
|
||||||
|
local params = RaycastParams.new()
|
||||||
|
params.FilterType = Enum.RaycastFilterType.Exclude
|
||||||
|
params.FilterDescendantsInstances = { shops, hall }
|
||||||
|
local hit = workspace:Raycast(V(x, 80, z), V(0, -160, 0), params)
|
||||||
|
return hit and hit.Position.Y or FLOOR
|
||||||
|
end
|
||||||
|
|
||||||
|
baitCrate(V(-49.5, groundAt(-49.5, 15), 15), "Лавка Михалыча")
|
||||||
|
-- у Деда Петровича на причале «Тихого озера»
|
||||||
|
local grandpa = map:FindFirstChild("World1NpcGrandpa", true)
|
||||||
|
if grandpa then
|
||||||
|
local p = grandpa.Position + grandpa.CFrame.RightVector * 3.2
|
||||||
|
baitCrate(V(p.X, groundAt(p.X, p.Z), p.Z), "Дед Петрович")
|
||||||
|
end
|
||||||
|
|
||||||
|
return ("Двор гильдии: %d деталей, лавок наживки: %d"):format(#hall:GetDescendants(), #shops:GetChildren())
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
-- Заготовка terrain для локации «Тропический остров». Запускать в Studio в режиме редактирования
|
||||||
|
-- (Command Bar или Studio MCP), потом сохранить плейс (Ctrl+S).
|
||||||
|
-- Сначала очищает весь terrain в квадрате локации (вода и земля), потом строит заново.
|
||||||
|
-- Остальные миры (лобби, другие острова) лежат в 1500 studs отсюда и не затрагиваются.
|
||||||
|
--
|
||||||
|
-- Схема (вид сверху, пропорции как на референсе):
|
||||||
|
-- центр — скалистый остров с плато под вышку и песчаной кромкой;
|
||||||
|
-- лагуна — бирюзовая вода, мелкая у берегов, глубже к середине;
|
||||||
|
-- кольцо по краям — песчаный пляж → трава → скалы-обрывы по периметру;
|
||||||
|
-- на мелководье — несколько каменных островков.
|
||||||
|
|
||||||
|
local Terrain = workspace.Terrain
|
||||||
|
|
||||||
|
local CENTER = Vector3.new(1500, 0, 0) -- FishConfig.Worlds[2].center; CENTER.Y — уровень воды
|
||||||
|
local R_OUTER = 320 -- полуразмер квадрата карты
|
||||||
|
|
||||||
|
-- радиусы зон (в долях от R_OUTER, подобраны под картинку)
|
||||||
|
local R_ISLAND = 0.17 * R_OUTER -- скала центрального острова
|
||||||
|
local R_ISLAND_BEACH = 0.21 * R_OUTER -- песчаная кромка острова
|
||||||
|
local R_SHORE = 0.62 * R_OUTER -- линия берега внешнего кольца
|
||||||
|
local R_GRASS = 0.70 * R_OUTER -- где пляж переходит в траву
|
||||||
|
local R_CLIFF = 0.80 * R_OUTER -- подножие скал по краю
|
||||||
|
|
||||||
|
local ISLAND_TOP = 34 -- высота плато острова над водой
|
||||||
|
local CLIFF_TOP = 70 -- высота обрывов по краю
|
||||||
|
local LAGOON_DEPTH = 14
|
||||||
|
local BOTTOM = -24
|
||||||
|
local CELL = 4
|
||||||
|
|
||||||
|
local ISLETS = { -- {угол°, доля радиуса лагуны, радиус, высота}
|
||||||
|
{ 20, 0.55, 9, 5 },
|
||||||
|
{ 75, 0.70, 7, 4 },
|
||||||
|
{ 140, 0.60, 11, 6 },
|
||||||
|
{ 215, 0.50, 6, 3 },
|
||||||
|
{ 300, 0.65, 10, 5 },
|
||||||
|
{ 330, 0.45, 5, 3 },
|
||||||
|
}
|
||||||
|
|
||||||
|
local function smooth(t)
|
||||||
|
t = math.clamp(t, 0, 1)
|
||||||
|
return t * t * (3 - 2 * t)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- неровные края: радиус «дышит» по углу
|
||||||
|
local function wobble(angle, seed, amp)
|
||||||
|
return 1 + amp * math.noise(math.cos(angle) * 1.7 + seed, math.sin(angle) * 1.7 + seed, seed * 0.37)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- высота поверхности (относительно воды) и материал верхнего слоя
|
||||||
|
local function sample(x, z)
|
||||||
|
local dx, dz = x - CENTER.X, z - CENTER.Z
|
||||||
|
local r = math.sqrt(dx * dx + dz * dz)
|
||||||
|
local a = math.atan2(dz, dx)
|
||||||
|
local detail = math.noise(x / 40, z / 40, 3.1) * 2
|
||||||
|
|
||||||
|
local rIsland = R_ISLAND * wobble(a, 1.3, 0.35)
|
||||||
|
local rIslandBeach = R_ISLAND_BEACH * wobble(a, 1.3, 0.3)
|
||||||
|
local rShore = R_SHORE * wobble(a, 5.7, 0.12)
|
||||||
|
local rGrass = R_GRASS * wobble(a, 5.7, 0.12)
|
||||||
|
local rCliff = R_CLIFF * wobble(a, 9.1, 0.10)
|
||||||
|
|
||||||
|
if r < rIsland then
|
||||||
|
-- плато с крутыми скальными боками
|
||||||
|
local edge = smooth((rIsland - r) / (rIsland * 0.35))
|
||||||
|
local h = 2 + (ISLAND_TOP - 2) * edge + detail
|
||||||
|
return h, (edge > 0.95 and Enum.Material.Grass or Enum.Material.Rock), Enum.Material.Rock
|
||||||
|
elseif r < rIslandBeach then
|
||||||
|
local t = (r - rIsland) / (rIslandBeach - rIsland)
|
||||||
|
return 2 - 4 * t, Enum.Material.Sand, Enum.Material.Sand
|
||||||
|
elseif r < rShore then
|
||||||
|
-- дно лагуны: мелко у берегов, глубже к середине
|
||||||
|
local t = (r - rIslandBeach) / (rShore - rIslandBeach)
|
||||||
|
local depth = LAGOON_DEPTH * math.sin(t * math.pi) ^ 0.6
|
||||||
|
local h = -2 - depth + detail
|
||||||
|
-- каменные островки
|
||||||
|
for _, isl in ipairs(ISLETS) do
|
||||||
|
local ang = math.rad(isl[1])
|
||||||
|
local ir = rIslandBeach + (rShore - rIslandBeach) * isl[2]
|
||||||
|
local ix, iz = math.cos(ang) * ir, math.sin(ang) * ir
|
||||||
|
local d = math.sqrt((dx - ix) ^ 2 + (dz - iz) ^ 2)
|
||||||
|
if d < isl[3] then
|
||||||
|
local k = smooth(1 - d / isl[3])
|
||||||
|
local ih = isl[4] * k + h * (1 - k)
|
||||||
|
if ih > h then
|
||||||
|
return ih, Enum.Material.Rock, Enum.Material.Rock
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return h, Enum.Material.Sand, Enum.Material.Sand
|
||||||
|
elseif r < rGrass then
|
||||||
|
local t = (r - rShore) / (rGrass - rShore)
|
||||||
|
return -2 + 5 * smooth(t), Enum.Material.Sand, Enum.Material.Sand
|
||||||
|
elseif r < rCliff then
|
||||||
|
local t = (r - rGrass) / (rCliff - rGrass)
|
||||||
|
return 3 + 4 * t + detail, Enum.Material.Grass, Enum.Material.Ground
|
||||||
|
else
|
||||||
|
local t = smooth((r - rCliff) / (R_OUTER * 0.06))
|
||||||
|
local h = 7 + (CLIFF_TOP - 7) * t + detail * 3
|
||||||
|
return h, (t > 0.97 and Enum.Material.Grass or Enum.Material.Rock), Enum.Material.Rock
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- очистка: весь старый terrain локации (с запасом по краям и по высоте)
|
||||||
|
local CLEAR = R_OUTER + 80
|
||||||
|
Terrain:FillBlock(CFrame.new(CENTER + Vector3.new(0, 60, 0)), Vector3.new(CLEAR * 2, 320, CLEAR * 2), Enum.Material.Air)
|
||||||
|
task.wait()
|
||||||
|
|
||||||
|
local water = Enum.Material.Water
|
||||||
|
local rows = 0
|
||||||
|
for x = CENTER.X - R_OUTER, CENTER.X + R_OUTER - CELL, CELL do
|
||||||
|
for z = CENTER.Z - R_OUTER, CENTER.Z + R_OUTER - CELL, CELL do
|
||||||
|
local cx, cz = x + CELL / 2, z + CELL / 2
|
||||||
|
local h, top, under = sample(cx, cz)
|
||||||
|
local yTop = CENTER.Y + h
|
||||||
|
local yBottom = CENTER.Y + BOTTOM
|
||||||
|
-- основание
|
||||||
|
local mid = math.max(yBottom, yTop - 3)
|
||||||
|
if mid > yBottom then
|
||||||
|
Terrain:FillBlock(
|
||||||
|
CFrame.new(cx, (yBottom + mid) / 2, cz),
|
||||||
|
Vector3.new(CELL, mid - yBottom, CELL),
|
||||||
|
under
|
||||||
|
)
|
||||||
|
end
|
||||||
|
-- верхний слой
|
||||||
|
Terrain:FillBlock(CFrame.new(cx, (mid + yTop) / 2, cz), Vector3.new(CELL, math.max(yTop - mid, 1), CELL), top)
|
||||||
|
-- вода до уровня CENTER.Y
|
||||||
|
if yTop < CENTER.Y then
|
||||||
|
Terrain:FillBlock(
|
||||||
|
CFrame.new(cx, (yTop + CENTER.Y) / 2, cz),
|
||||||
|
Vector3.new(CELL, CENTER.Y - yTop, CELL),
|
||||||
|
water
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rows += 1
|
||||||
|
if rows % 8 == 0 then
|
||||||
|
task.wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- цвет воды (Terrain.WaterColor и т.п.) общий для всех миров, поэтому здесь не меняется
|
||||||
|
|
||||||
|
print("Тропический остров: terrain готов")
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
# Updates the scripts inside Fishing.rbxlx from src/ WITHOUT touching the map.
|
||||||
|
# Studio must be closed. A backup is saved to backups\ first.
|
||||||
|
# Run: powershell -ExecutionPolicy Bypass -File update-place.ps1
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$root = $PSScriptRoot
|
||||||
|
$enc = New-Object System.Text.UTF8Encoding($false)
|
||||||
|
$placePath = Join-Path $root 'Fishing.rbxlx'
|
||||||
|
|
||||||
|
if (Test-Path "$placePath.lock") { throw "Roblox Studio has Fishing.rbxlx open. Close Studio first." }
|
||||||
|
|
||||||
|
# src folder -> service class in the place
|
||||||
|
$services = [ordered]@{
|
||||||
|
'ReplicatedFirst' = 'ReplicatedFirst'
|
||||||
|
'ReplicatedStorage' = 'ReplicatedStorage'
|
||||||
|
'ServerScriptService' = 'ServerScriptService'
|
||||||
|
'StarterPlayer\StarterPlayerScripts' = 'StarterPlayerScripts'
|
||||||
|
}
|
||||||
|
|
||||||
|
$scripts = @()
|
||||||
|
foreach ($rel in $services.Keys) {
|
||||||
|
$dir = Join-Path "$root\src" $rel
|
||||||
|
if (-not (Test-Path $dir)) { continue }
|
||||||
|
Get-ChildItem $dir -File -Filter *.lua | ForEach-Object {
|
||||||
|
$n = $_.Name
|
||||||
|
if ($n -like '*.server.lua') { $class = 'Script'; $name = $n -replace '\.server\.lua$', '' }
|
||||||
|
elseif ($n -like '*.client.lua') { $class = 'LocalScript'; $name = $n -replace '\.client\.lua$', '' }
|
||||||
|
else { $class = 'ModuleScript'; $name = $n -replace '\.lua$', '' }
|
||||||
|
$src = [System.IO.File]::ReadAllText($_.FullName, $enc)
|
||||||
|
if ($src.Contains(']]>') -or $src.Contains('</Properties>')) { throw "Unsupported text in $n" }
|
||||||
|
$scripts += @{ Name = $name; Class = $class; Service = $services[$rel]; Source = $src }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# backup
|
||||||
|
$backupDir = Join-Path $root 'backups'
|
||||||
|
New-Item -ItemType Directory -Force $backupDir | Out-Null
|
||||||
|
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
||||||
|
Copy-Item $placePath (Join-Path $backupDir "Fishing-$stamp.rbxlx")
|
||||||
|
|
||||||
|
$xml = [System.IO.File]::ReadAllText($placePath, $enc)
|
||||||
|
|
||||||
|
foreach ($s in $scripts) {
|
||||||
|
# all items of this class with this exact name
|
||||||
|
$pattern = '<Item class="' + $s.Class + '" referent="[^"]+">\s*<Properties>'
|
||||||
|
$found = @()
|
||||||
|
foreach ($m in [regex]::Matches($xml, $pattern)) {
|
||||||
|
$propsEnd = $xml.IndexOf('</Properties>', $m.Index)
|
||||||
|
$seg = $xml.Substring($m.Index, $propsEnd - $m.Index)
|
||||||
|
if ($seg -match '<string name="Name">([^<]*)</string>' -and $Matches[1] -eq $s.Name) {
|
||||||
|
$found += @{ Start = $m.Index; PropsEnd = $propsEnd }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($found.Count -gt 1) { throw "Several $($s.Class) named $($s.Name) in the place - not touching it." }
|
||||||
|
|
||||||
|
$cdata = '<![CDATA[' + $s.Source + ']]>'
|
||||||
|
if ($found.Count -eq 1) {
|
||||||
|
$f = $found[0]
|
||||||
|
$seg = $xml.Substring($f.Start, $f.PropsEnd - $f.Start)
|
||||||
|
$srcTag = [regex]::Match($seg, '<ProtectedString name="Source">[\s\S]*?</ProtectedString>')
|
||||||
|
$newTag = '<ProtectedString name="Source">' + $cdata + '</ProtectedString>'
|
||||||
|
if ($srcTag.Success) {
|
||||||
|
$absStart = $f.Start + $srcTag.Index
|
||||||
|
$xml = $xml.Substring(0, $absStart) + $newTag + $xml.Substring($absStart + $srcTag.Length)
|
||||||
|
} else {
|
||||||
|
$xml = $xml.Substring(0, $f.PropsEnd) + $newTag + $xml.Substring($f.PropsEnd)
|
||||||
|
}
|
||||||
|
Write-Host "updated $($s.Service)/$($s.Name)"
|
||||||
|
} else {
|
||||||
|
# new script: put it right after the service's own <Properties> block
|
||||||
|
$svc = [regex]::Match($xml, '<Item class="' + $s.Service + '" referent="[^"]+">\s*<Properties>')
|
||||||
|
if (-not $svc.Success) { throw "Service $($s.Service) not found in the place." }
|
||||||
|
$insertAt = $xml.IndexOf('</Properties>', $svc.Index) + '</Properties>'.Length
|
||||||
|
$ref = 'RBX' + ([guid]::NewGuid().ToString('N').ToUpper())
|
||||||
|
$item = "`n<Item class=`"$($s.Class)`" referent=`"$ref`"><Properties><string name=`"Name`">$($s.Name)</string><ProtectedString name=`"Source`">$cdata</ProtectedString></Properties></Item>"
|
||||||
|
$xml = $xml.Substring(0, $insertAt) + $item + $xml.Substring($insertAt)
|
||||||
|
Write-Host "added $($s.Service)/$($s.Name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.IO.File]::WriteAllText($placePath, $xml, $enc)
|
||||||
|
Write-Host "Done. Backup: backups\Fishing-$stamp.rbxlx"
|
||||||