экономика
This commit is contained in:
1 parent
296988b199
commit
58ae93f9e6
28 files changed
+6503
-299
No files matched your search
@@ -322,7 +322,7 @@ local function takeTrial(player, data)
|
||||
-- сдать рыбу из сумки сразу, если она есть
|
||||
local have, keep = 0, {}
|
||||
for _, item in ipairs(data.items) do
|
||||
if item.id == t.fish and have < t.count then
|
||||
if item.id == t.fish and not item.bought and have < t.count then -- испытание — только своим уловом
|
||||
have += 1
|
||||
else
|
||||
table.insert(keep, item)
|
||||
@@ -439,7 +439,7 @@ local function makeOrder(data, rng)
|
||||
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.coins = math.floor(o.seals * O.coinsPerSeal * (api.tierOf and api.tierOf(data) or 1))
|
||||
o.pearls = rng:NextNumber() < O.pearlChance and rng:NextInteger(O.pearlsMin, O.pearlsMax) or 0
|
||||
return o
|
||||
end
|
||||
@@ -488,7 +488,7 @@ end
|
||||
local function finishOrder(player, data, o)
|
||||
o.done = true
|
||||
data.seals += o.seals
|
||||
data.coins += o.coins
|
||||
api.addCoins(player, data, o.coins, "Order")
|
||||
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")
|
||||
@@ -515,7 +515,8 @@ local function deliverOrder(player, data, i)
|
||||
-- сдаём сначала самую дешёвую подходящую рыбу
|
||||
local fit = {}
|
||||
for _, item in ipairs(data.items) do
|
||||
if item.id == o.fish and (not o.minW or item.weight >= o.minW) then
|
||||
-- купленная на рынке рыба в заказы не идёт: заказ — про свой улов
|
||||
if item.id == o.fish and not item.bought and (not o.minW or item.weight >= o.minW) then
|
||||
table.insert(fit, item)
|
||||
end
|
||||
end
|
||||
@@ -693,11 +694,10 @@ local function buyBait(player, data, id)
|
||||
data.pearls -= b.price
|
||||
else
|
||||
local price = Guild.price(data, b.price)
|
||||
if data.coins < price then
|
||||
if not api.spendCoins(player, data, price, "Bait", b.id) 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
|
||||
@@ -752,6 +752,8 @@ local function collectTraps(player, data)
|
||||
for _ = 1, take do
|
||||
local f = rollTrapFish(rng)
|
||||
f.uid = data.nextUid
|
||||
f.gid = ("%d-%d"):format(player.UserId, f.uid)
|
||||
f.origin = { by = player.UserId, name = player.DisplayName, world = T.world, t = now, trap = true }
|
||||
data.nextUid += 1
|
||||
table.insert(data.items, f)
|
||||
local rec = data.discovered[f.id]
|
||||
@@ -795,10 +797,7 @@ 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
|
||||
-- экономика v2: отдых даёт +25% серебра за пойманную рыбу (GameServer.grantFish), а не опыт
|
||||
|
||||
-- отдых тратится секундами, пока игрок рыбачит
|
||||
function Guild.spendRest(player, data, seconds)
|
||||
|
||||
Reference in new issue
Block a user