出售加价计算错误

This commit is contained in:
meixiongfeng 2023-05-19 20:15:43 +08:00
parent 28dc696beb
commit a1f28a0ba6
3 changed files with 51 additions and 62 deletions

View File

@ -19,15 +19,15 @@
"citymainlock": 11001, "citymainlock": 11001,
"cityman": 34006, "cityman": 34006,
"cityname": { "cityname": {
"key": "asd", "key": "caravan_caravan_city_cityname_1",
"text": "死湾" "text": "死湾"
}, },
"cityinformation": { "cityinformation": {
"key": "asd", "key": "caravan_caravan_city_cityinformation_1",
"text": "常年游荡在死湾的商人,这一区域或许只有他才敢在这里做生意。" "text": "常年游荡在死湾的商人,这一区域或许只有他才敢在这里做生意。"
}, },
"citytxt": { "citytxt": {
"key": "asd", "key": "caravan_caravan_city_citytxt_1",
"text": "死湾长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。" "text": "死湾长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。"
}, },
"citytype": 1, "citytype": 1,
@ -40,12 +40,12 @@
], ],
"specialnum": 500, "specialnum": 500,
"exspecial": [ "exspecial": [
2, 3,
5 5
], ],
"exspecialnum": 1500, "exspecialnum": 1500,
"Orspecial": 1000, "Orspecial": 1000,
"checktime": 180, "checktime": 1800,
"cityeventpro": 50000, "cityeventpro": 50000,
"cityevent": [ "cityevent": [
1001 1001
@ -71,15 +71,15 @@
"citymainlock": 11001, "citymainlock": 11001,
"cityman": 24004, "cityman": 24004,
"cityname": { "cityname": {
"key": "asd", "key": "caravan_caravan_city_cityname_2",
"text": "乱冢" "text": "乱冢"
}, },
"cityinformation": { "cityinformation": {
"key": "asd", "key": "caravan_caravan_city_cityinformation_2",
"text": "常年游荡在乱冢的商人,这一区域或许只有他才敢在这里做生意。" "text": "常年游荡在乱冢的商人,这一区域或许只有他才敢在这里做生意。"
}, },
"citytxt": { "citytxt": {
"key": "asd", "key": "caravan_caravan_city_citytxt_2",
"text": "乱冢长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。" "text": "乱冢长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。"
}, },
"citytype": 1, "citytype": 1,
@ -97,7 +97,7 @@
], ],
"exspecialnum": 1600, "exspecialnum": 1600,
"Orspecial": 1000, "Orspecial": 1000,
"checktime": 180, "checktime": 1800,
"cityeventpro": 100000, "cityeventpro": 100000,
"cityevent": [ "cityevent": [
1001 1001
@ -124,15 +124,15 @@
"citymainlock": 11001, "citymainlock": 11001,
"cityman": 25001, "cityman": 25001,
"cityname": { "cityname": {
"key": "asd", "key": "caravan_caravan_city_cityname_3",
"text": "陌城" "text": "陌城"
}, },
"cityinformation": { "cityinformation": {
"key": "asd", "key": "caravan_caravan_city_cityinformation_3",
"text": "常年游荡在陌城的商人,这一区域或许只有他才敢在这里做生意。" "text": "常年游荡在陌城的商人,这一区域或许只有他才敢在这里做生意。"
}, },
"citytxt": { "citytxt": {
"key": "asd", "key": "caravan_caravan_city_citytxt_3",
"text": "陌城长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。" "text": "陌城长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。"
}, },
"citytype": 1, "citytype": 1,
@ -150,7 +150,7 @@
], ],
"exspecialnum": 1700, "exspecialnum": 1700,
"Orspecial": 1000, "Orspecial": 1000,
"checktime": 180, "checktime": 1800,
"cityeventpro": 50000, "cityeventpro": 50000,
"cityevent": [ "cityevent": [
1001 1001
@ -177,15 +177,15 @@
"citymainlock": 11001, "citymainlock": 11001,
"cityman": 45001, "cityman": 45001,
"cityname": { "cityname": {
"key": "asd", "key": "caravan_caravan_city_cityname_4",
"text": "暗窟" "text": "暗窟"
}, },
"cityinformation": { "cityinformation": {
"key": "asd", "key": "caravan_caravan_city_cityinformation_4",
"text": "常年游荡在暗窟的商人,这一区域或许只有他才敢在这里做生意。" "text": "常年游荡在暗窟的商人,这一区域或许只有他才敢在这里做生意。"
}, },
"citytxt": { "citytxt": {
"key": "asd", "key": "caravan_caravan_city_citytxt_4",
"text": "暗窟长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。" "text": "暗窟长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。"
}, },
"citytype": 1, "citytype": 1,
@ -203,7 +203,7 @@
], ],
"exspecialnum": 1800, "exspecialnum": 1800,
"Orspecial": 1000, "Orspecial": 1000,
"checktime": 180, "checktime": 1800,
"cityeventpro": 100000, "cityeventpro": 100000,
"cityevent": [ "cityevent": [
1001 1001
@ -229,15 +229,15 @@
"citymainlock": 11001, "citymainlock": 11001,
"cityman": 14007, "cityman": 14007,
"cityname": { "cityname": {
"key": "asd", "key": "caravan_caravan_city_cityname_5",
"text": "腐宴" "text": "腐宴"
}, },
"cityinformation": { "cityinformation": {
"key": "asd", "key": "caravan_caravan_city_cityinformation_5",
"text": "常年游荡在腐宴的商人,这一区域或许只有他才敢在这里做生意。" "text": "常年游荡在腐宴的商人,这一区域或许只有他才敢在这里做生意。"
}, },
"citytxt": { "citytxt": {
"key": "asd", "key": "caravan_caravan_city_citytxt_5",
"text": "腐宴长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。" "text": "腐宴长年被一股胀气笼罩,这里的人们长年吸入这些气息,不知不觉已经产生了异变,他们自己称之为兽化病,年长的居民,会随着兽化病的加重,变成熊猫的模样,他们的人性会逐渐的被兽性所代替,最后彻底沦为一只只知道吃包子的直立行走的熊猫。"
}, },
"citytype": 1, "citytype": 1,
@ -255,7 +255,7 @@
], ],
"exspecialnum": 1900, "exspecialnum": 1900,
"Orspecial": 1000, "Orspecial": 1000,
"checktime": 180, "checktime": 1800,
"cityeventpro": 50000, "cityeventpro": 50000,
"cityevent": [ "cityevent": [
1001 1001

View File

@ -2,14 +2,14 @@
{ {
"id": 1, "id": 1,
"goodsname": { "goodsname": {
"key": "asdsad", "key": "caravan_caravan_city_goodsname_1",
"text": "番茄" "text": "番茄"
}, },
"goodsinfor": { "goodsinfor": {
"key": "asdsad", "key": "caravan_caravan_city_goodsinfor_1",
"text": "这是一个番茄" "text": "这是一个番茄"
}, },
"goodsicon": "fanqie_c", "goodsicon": "clmsg_ll_01",
"goodsprice": 1000, "goodsprice": 1000,
"changeperiod": [ "changeperiod": [
5, 5,
@ -40,14 +40,14 @@
{ {
"id": 2, "id": 2,
"goodsname": { "goodsname": {
"key": "asdsad", "key": "caravan_caravan_city_goodsname_2",
"text": "苹果" "text": "苹果"
}, },
"goodsinfor": { "goodsinfor": {
"key": "asdsad", "key": "caravan_caravan_city_goodsinfor_2",
"text": "这是一个苹果" "text": "这是一个苹果"
}, },
"goodsicon": "fanqie_c", "goodsicon": "clmsg_ll_02",
"goodsprice": 900, "goodsprice": 900,
"changeperiod": [ "changeperiod": [
5, 5,
@ -78,14 +78,14 @@
{ {
"id": 3, "id": 3,
"goodsname": { "goodsname": {
"key": "asdsad", "key": "caravan_caravan_city_goodsname_3",
"text": "手机" "text": "手机"
}, },
"goodsinfor": { "goodsinfor": {
"key": "asdsad", "key": "caravan_caravan_city_goodsinfor_3",
"text": "这是一个手机" "text": "这是一个手机"
}, },
"goodsicon": "fanqie_c", "goodsicon": "clmsg_ll_03",
"goodsprice": 500, "goodsprice": 500,
"changeperiod": [ "changeperiod": [
5, 5,
@ -116,14 +116,14 @@
{ {
"id": 4, "id": 4,
"goodsname": { "goodsname": {
"key": "asdsad", "key": "caravan_caravan_city_goodsname_4",
"text": "干果" "text": "干果"
}, },
"goodsinfor": { "goodsinfor": {
"key": "asdsad", "key": "caravan_caravan_city_goodsinfor_4",
"text": "这是一个干果" "text": "这是一个干果"
}, },
"goodsicon": "fanqie_c", "goodsicon": "clmsg_ll_04",
"goodsprice": 1500, "goodsprice": 1500,
"changeperiod": [ "changeperiod": [
5, 5,
@ -154,14 +154,14 @@
{ {
"id": 5, "id": 5,
"goodsname": { "goodsname": {
"key": "asdsad", "key": "caravan_caravan_city_goodsname_5",
"text": "干果" "text": "矿石"
}, },
"goodsinfor": { "goodsinfor": {
"key": "asdsad", "key": "caravan_caravan_city_goodsinfor_5",
"text": "这是一个干果" "text": "这是一个矿石"
}, },
"goodsicon": "fanqie_c", "goodsicon": "clmsg_ll_05",
"goodsprice": 2300, "goodsprice": 2300,
"changeperiod": [ "changeperiod": [
5, 5,
@ -192,14 +192,14 @@
{ {
"id": 6, "id": 6,
"goodsname": { "goodsname": {
"key": "asdsad", "key": "caravan_caravan_city_goodsname_6",
"text": "" "text": "干"
}, },
"goodsinfor": { "goodsinfor": {
"key": "asdsad", "key": "caravan_caravan_city_goodsinfor_6",
"text": "这是一个" "text": "这是一个干"
}, },
"goodsicon": "fanqie_c", "goodsicon": "clmsg_ll_06",
"goodsprice": 1130, "goodsprice": 1130,
"changeperiod": [ "changeperiod": [
5, 5,

View File

@ -50,15 +50,15 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
items := caravan.Items[k] items := caravan.Items[k]
var price int32 var price int32
price = items.Price price = items.Price
// if cityConf := this.module.configure.GetCaravanCity(req.City); cityConf != nil { for _, v := range cityInfo.Special {
// for _, v := range cityConf.Exspecial { if v == k {
// if v == k { if cityConf := this.module.configure.GetCaravanCity(req.City); cityConf != nil {
// price = cityConf.Exspecialnum * items.Price / 1000 price = cityConf.Specialnum * price / 1000
}
break
}
}
// break
// }
// }
// }
addScore += price * v // 卖出收益 addScore += price * v // 卖出收益
} }
if this.module.ArrayBag(caravan, upperLimit) { // 背包满了 if this.module.ArrayBag(caravan, upperLimit) { // 背包满了
@ -98,9 +98,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
price = caravan.Goods[k].Price price = caravan.Goods[k].Price
for _, v := range cityInfo.Special { for _, v := range cityInfo.Special {
if v == k { if v == k {
if cityConf := this.module.configure.GetCaravanCity(req.City); cityConf != nil {
price = cityConf.Specialnum * price / 1000
}
bFound = true bFound = true
break break
} }
@ -109,14 +106,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
code = pb.ErrorCode_TrollCityUnSellItem // 城市不卖这个物品 code = pb.ErrorCode_TrollCityUnSellItem // 城市不卖这个物品
return 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 caravan.Items[k].Count += v
totla += price * v totla += price * v