This commit is contained in:
meixiongfeng 2022-11-03 15:06:25 +08:00
parent 6d6e99606d
commit e5f3ee1c8b

View File

@ -93,8 +93,8 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
if coefficient == nil { if coefficient == nil {
return return
} }
if troll.Sell >= coefficient.Coefficient { // 可以出售 if troll.Sell <= coefficient.Coefficient { // 可以出售
var preGold int32 var preGold int32 // 成本价
for _, v := range goods { for _, v := range goods {
sellPrice[v.Id] = v.Goodsprice * coefficient.Coefficient / 1000 sellPrice[v.Id] = v.Goodsprice * coefficient.Coefficient / 1000
preGold += troll.Price[v.Id] * troll.Items[v.Id] preGold += troll.Price[v.Id] * troll.Items[v.Id]
@ -112,8 +112,7 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
break break
} }
} }
} } else if troll.Buy >= coefficient.Coefficient { // 可以购买
if troll.Buy >= coefficient.Coefficient { // 可以购买
for _, v := range goods { for _, v := range goods {
sellPrice[v.Id] = v.Goodsprice * coefficient.Coefficient / 1000 sellPrice[v.Id] = v.Goodsprice * coefficient.Coefficient / 1000
} }
@ -180,7 +179,6 @@ func (this *Troll) BuyAllItem(uid string, troll *pb.DBTrollTrain, price map[int3
break break
} }
} }
// 检查该位置的格子没有补满 // 检查该位置的格子没有补满
full := (troll.Items[v.Id] + box[v.Id]) % maxgoods full := (troll.Items[v.Id] + box[v.Id]) % maxgoods
if full != 0 { if full != 0 {