From 28dc696beb73a841b6575685f80cd63e56751741 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 May 2023 19:49:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=8E=E5=B8=82=E8=B4=AD=E4=B9=B0=E9=A5=B1?= =?UTF-8?q?=E5=92=8C=E7=B3=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/caravan/api_buyorsell.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/caravan/api_buyorsell.go b/modules/caravan/api_buyorsell.go index 4f15e9a38..026c032dd 100644 --- a/modules/caravan/api_buyorsell.go +++ b/modules/caravan/api_buyorsell.go @@ -50,15 +50,15 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe items := caravan.Items[k] var price int32 price = items.Price - if cityConf := this.module.configure.GetCaravanCity(req.City); cityConf != nil { - for _, v := range cityConf.Exspecial { - if v == k { - price = cityConf.Exspecialnum * items.Price / 1000 + // if cityConf := this.module.configure.GetCaravanCity(req.City); cityConf != nil { + // for _, v := range cityConf.Exspecial { + // if v == k { + // price = cityConf.Exspecialnum * items.Price / 1000 - break - } - } - } + // break + // } + // } + // } addScore += price * v // 卖出收益 } if this.module.ArrayBag(caravan, upperLimit) { // 背包满了 @@ -109,6 +109,14 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe code = pb.ErrorCode_TrollCityUnSellItem // 城市不卖这个物品 return } + if cityConf := this.module.configure.GetCaravanCity(req.City); cityConf != nil { + for _, v := range cityConf.Exspecial { + if v == k { + price = cityConf.Exspecialnum * caravan.Goods[k].Price / 1000 + break + } + } + } caravan.Items[k].Count += v totla += price * v