From e5336d313f7db326a59cec589df02138e7c33800 Mon Sep 17 00:00:00 2001 From: Denis Ranneft Date: Mon, 6 Apr 2026 02:21:36 +0300 Subject: [PATCH] fix prices --- backend/internal/changelog/data/changelog.json | 11 +++++++++++ backend/internal/game/town_merchant_gear.go | 13 ++++--------- backend/internal/handler/npc.go | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/backend/internal/changelog/data/changelog.json b/backend/internal/changelog/data/changelog.json index 48894b4..6cf4147 100644 --- a/backend/internal/changelog/data/changelog.json +++ b/backend/internal/changelog/data/changelog.json @@ -1,5 +1,16 @@ { "releases": [ + { + "version": "0.3.1-dev", + "title": "AutoHero — 0.3.1", + "items": [ + "Graphics optimization! We've found a bastard. Minimap was causing huge recalc.", + "Auto potions (now hero will use them even in the online battle", + "Formulae for atk reworked", + "Reduced merchant and monster meet chance", + "Something else" + ] + }, { "version": "0.3.0-dev", "title": "AutoHero — 0.3.0", diff --git a/backend/internal/game/town_merchant_gear.go b/backend/internal/game/town_merchant_gear.go index 3efe495..53c826d 100644 --- a/backend/internal/game/town_merchant_gear.go +++ b/backend/internal/game/town_merchant_gear.go @@ -78,15 +78,10 @@ func RollTownMerchantOfferGold(ilvl int, rarity model.Rarity, townLevel int) int perIlvl := tuning.EffectiveMerchantTownGearPricePerIlvl() variance := tuning.EffectiveMerchantTownGearPriceVariancePct() ilvlPart := float64(ilvl) * float64(perIlvl) * townMerchantRarityPriceMul(rarity) - curve := float64(ilvl*ilvl) / 6.0 - mean := float64(anchor) + ilvlPart + curve - if mean < 1 { - mean = 1 - } + mean := float64(anchor) + ilvlPart + v := float64(variance) / 100.0 - if v < 0 { - v = 0 - } + if v > 0.45 { v = 0.45 } @@ -94,7 +89,7 @@ func RollTownMerchantOfferGold(ilvl int, rarity model.Rarity, townLevel int) int factor := (1.0 - v) + rand.Float64()*(2*v) cost := int64(mean*factor + 0.5) if cost < 1 { - cost = 1 + cost = int64(mean) } return cost } diff --git a/backend/internal/handler/npc.go b/backend/internal/handler/npc.go index 8f508e6..c9f81cf 100644 --- a/backend/internal/handler/npc.go +++ b/backend/internal/handler/npc.go @@ -962,7 +962,7 @@ func (h *NPCHandler) MerchantStock(w http.ResponseWriter, r *http.Request) { townLv := game.TownEffectiveLevel(town) n := tuning.EffectiveMerchantTownStockCount() slots := model.GearVendorSlots(npc.Type) - items := game.RollTownMerchantStockItemsForSlots(townLv, n, slots) + items := game.RollTownMerchantStockItemsForSlots(int(float64(hero.Level) * float64(1 + hero.Level / townLv)), n, slots) costs := make([]int64, len(items)) for i, it := range items { if it == nil {