商队相关
This commit is contained in:
parent
124e869e05
commit
19f286b1e2
@ -5,16 +5,6 @@ import (
|
|||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
TrollGetListResp = "getlist"
|
|
||||||
TrollBuyOrSellResp = "buyorsell"
|
|
||||||
TrollNpcRewardResp = "npcreward"
|
|
||||||
TrollRankListResp = "ranklist"
|
|
||||||
TrollRecordListResp = "recordlist"
|
|
||||||
TrollAfkSetResp = "afkset"
|
|
||||||
TrollSurpriseIdResp = "surpriseid"
|
|
||||||
)
|
|
||||||
|
|
||||||
type apiComp struct {
|
type apiComp struct {
|
||||||
modules.MCompGate
|
modules.MCompGate
|
||||||
service core.IService
|
service core.IService
|
||||||
|
@ -17,17 +17,18 @@ func (this *apiComp) BuyOrSellCheck(session comm.IUserSession, req *pb.TrollBuyO
|
|||||||
|
|
||||||
func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSellReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSellReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
bSell bool // 是否有出售
|
bSell bool // 是否有出售
|
||||||
gold int32 // 当次交易 获得的金币
|
gold int32 // 当次交易 获得的金币
|
||||||
earn int32 // 只统计赚的金币
|
earn int32 // 只统计赚的金币
|
||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
gridNum int32 // 格子数量
|
gridNum int32 // 格子数量
|
||||||
|
trolltrain *pb.DBTrollTrain
|
||||||
)
|
)
|
||||||
update = make(map[string]interface{})
|
update = make(map[string]interface{})
|
||||||
if code = this.BuyOrSellCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.BuyOrSellCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
trolltrain, err := this.module.modelTroll.getTrollList(session.GetUserId())
|
_, err := this.module.modelCaravan.getCaravanList(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
@ -161,7 +162,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
|||||||
|
|
||||||
update["gridNum"] = trolltrain.GridNum
|
update["gridNum"] = trolltrain.GridNum
|
||||||
update["shop"] = trolltrain.Shop
|
update["shop"] = trolltrain.Shop
|
||||||
this.module.ModifyTrollData(session.GetUserId(), update)
|
//this.module.ModifyTrollData(session.GetUserId(), update)
|
||||||
|
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype153, 1)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype153, 1)
|
||||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
|
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
|
||||||
|
@ -1,111 +1,29 @@
|
|||||||
package caravan
|
package caravan
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
|
||||||
"go_dreamfactory/utils"
|
|
||||||
"math/big"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.TrollGetListReq) (code pb.ErrorCode) {
|
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.CaravanGetListReq) (code pb.ErrorCode) {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
update map[string]interface{}
|
resp *pb.CaravanGetListResp
|
||||||
maxCoefficient int32
|
|
||||||
)
|
)
|
||||||
|
|
||||||
update = make(map[string]interface{})
|
|
||||||
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
trolltrain, err := this.module.modelTroll.getTrollList(session.GetUserId())
|
list, err := this.module.api.module.modelCaravan.getCaravanList(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 自动交易
|
resp.Data = list
|
||||||
this.module.TrollAI(session, trolltrain)
|
session.SendMsg(string(this.module.GetType()), "getlist", resp)
|
||||||
|
|
||||||
maxCoefficient = this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
|
|
||||||
if maxCoefficient == 0 {
|
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 跨天 则清除 每日交易次数
|
|
||||||
if !utils.IsToday(trolltrain.ResetTime) {
|
|
||||||
trolltrain.ResetTime = configure.Now().Unix()
|
|
||||||
update["resetTime"] = trolltrain.ResetTime
|
|
||||||
trolltrain.SellCount = 0
|
|
||||||
update["sellCount"] = trolltrain.SellCount // 重置每日交易次数
|
|
||||||
trolltrain.AiCount = 0
|
|
||||||
update["aiCount"] = trolltrain.AiCount // 重置ai 交易次数
|
|
||||||
this.module.ModifyTrollData(session.GetUserId(), update)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 计算经过了多少个周期
|
|
||||||
szTrain := this.configure.GetTrollAllTrain()
|
|
||||||
var (
|
|
||||||
circletime int32 // 循环一个周期的时间
|
|
||||||
circleCount int32 // 循环的次数
|
|
||||||
leftTime int32 // 离到达最后一站剩余的时间
|
|
||||||
index int32 // 总共经过了多少次车站
|
|
||||||
)
|
|
||||||
for _, v := range szTrain {
|
|
||||||
circletime += v
|
|
||||||
}
|
|
||||||
if int32(len(szTrain)) < trolltrain.TarinPos {
|
|
||||||
this.module.Errorf("TarinPos error: TarinPos:%d,maxLen:%d", trolltrain.TarinPos, len(szTrain))
|
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if configure.Now().Unix()-trolltrain.RefreshTime < int64(szTrain[trolltrain.TarinPos-1]) {
|
|
||||||
session.SendMsg(string(this.module.GetType()), TrollGetListResp, &pb.TrollGetListResp{Data: trolltrain})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
trainNum := this.configure.GetTrollMaxTraintNum()
|
|
||||||
trolltrain.Shop = make(map[int32]int32) // 清空商人的购买数据
|
|
||||||
update["shop"] = trolltrain.Shop
|
|
||||||
t := int32(configure.Now().Unix() - trolltrain.Ctime)
|
|
||||||
circleCount = t / circletime // 经过的周期数
|
|
||||||
leftTime = t % circletime
|
|
||||||
if trolltrain.Circle != circleCount {
|
|
||||||
trolltrain.SurpriseID = make(map[int32]int32, 0)
|
|
||||||
n, _ := rand.Int(rand.Reader, big.NewInt(int64(trainNum)))
|
|
||||||
// 只算当前商人所属的货物
|
|
||||||
g := this.configure.GetTrollGoodsFor(int32(n.Int64()) + 1)
|
|
||||||
n2, _ := rand.Int(rand.Reader, big.NewInt(int64(len(g))))
|
|
||||||
trolltrain.SurpriseID[int32(n.Int64())+1] = g[int32(n2.Int64())]
|
|
||||||
update["surpriseID"] = trolltrain.SurpriseID
|
|
||||||
trolltrain.Circle = circleCount
|
|
||||||
update["circle"] = trolltrain.Circle
|
|
||||||
}
|
|
||||||
|
|
||||||
index = circleCount * trainNum // 计算火车的位置信息
|
|
||||||
for _, v := range szTrain {
|
|
||||||
if leftTime <= v {
|
|
||||||
trolltrain.RefreshTime = configure.Now().Unix() - int64(leftTime) //trolltrain.Ctime + int64(circleCount*circletime+leftTime)
|
|
||||||
trolltrain.RangeId = (index % maxCoefficient) + 1
|
|
||||||
trolltrain.TarinPos = (index % trainNum) + 1
|
|
||||||
break
|
|
||||||
}
|
|
||||||
index += 1
|
|
||||||
leftTime -= v
|
|
||||||
}
|
|
||||||
update["aiCount"] = trolltrain.AiCount
|
|
||||||
update["refreshTime"] = trolltrain.RefreshTime
|
|
||||||
update["tarinPos"] = trolltrain.TarinPos
|
|
||||||
update["rangeId"] = trolltrain.RangeId
|
|
||||||
update["shop"] = trolltrain.Shop
|
|
||||||
update["items"] = trolltrain.Items
|
|
||||||
update["price"] = trolltrain.Price
|
|
||||||
this.module.ModifyTrollData(session.GetUserId(), update)
|
|
||||||
session.SendMsg(string(this.module.GetType()), TrollGetListResp, &pb.TrollGetListResp{Data: trolltrain})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
game_caravan = "game_itinerant_city.json"
|
||||||
|
game_caravan_lv = "game_itinerant_lv.json"
|
||||||
|
game_caravan_reward = "game_itinerant_reward.json"
|
||||||
|
game_caravan_thing = "game_itinerant_thing.json"
|
||||||
|
|
||||||
game_trollgoods = "game_trollgoods.json"
|
game_trollgoods = "game_trollgoods.json"
|
||||||
game_trollcoefficient = "game_trollcoefficient.json"
|
game_trollcoefficient = "game_trollcoefficient.json"
|
||||||
game_trolltrain = "game_trolltrain.json"
|
game_trolltrain = "game_trolltrain.json"
|
||||||
@ -26,11 +31,6 @@ type configureComp struct {
|
|||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
err = this.MCompConfigure.Init(service, module, comp, options)
|
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||||
this.LoadConfigure(game_trollgoods, cfg.NewGameTrollGoods)
|
|
||||||
this.LoadConfigure(game_trollcoefficient, cfg.NewGameTrollCoefficient)
|
|
||||||
this.LoadConfigure(game_trolltrain, cfg.NewGameTrollTrain)
|
|
||||||
this.LoadConfigure(game_trollrule, cfg.NewGameTrollRule)
|
|
||||||
this.LoadConfigure(game_trolllv, cfg.NewGameTrollLv)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -29,37 +29,28 @@ func (this *modelCaravan) Init(service core.IService, module core.IModule, comp
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *modelCaravan) getTrollList(uid string) (result *pb.DBTrollTrain, err error) {
|
func (this *modelCaravan) getCaravanList(uid string) (result *pb.DBCaravan, err error) {
|
||||||
result = &pb.DBTrollTrain{
|
result = &pb.DBCaravan{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
Items: map[int32]int32{},
|
UseCount: 0,
|
||||||
Price: map[int32]int32{},
|
Goods: map[int32]*pb.Goods{},
|
||||||
GridNum: 0,
|
City: map[int32]*pb.CityGoods{},
|
||||||
TarinPos: 1,
|
Lv: 0,
|
||||||
RangeId: 0,
|
Num: 0,
|
||||||
Buy: 0,
|
Profit: 0,
|
||||||
Sell: 0,
|
Resettime: 0,
|
||||||
NpcLv: 0,
|
|
||||||
NpcReward: map[int32]int32{},
|
|
||||||
TotalEarn: 0,
|
|
||||||
SellCount: 0,
|
|
||||||
RefreshTime: configure.Now().Unix(),
|
|
||||||
AiCount: 0,
|
|
||||||
Shop: map[int32]int32{},
|
|
||||||
Ctime: configure.Now().Unix(),
|
|
||||||
Circle: 0,
|
|
||||||
SurpriseID: map[int32]int32{},
|
|
||||||
ResetTime: configure.Now().Unix(),
|
|
||||||
}
|
}
|
||||||
if err = this.Get(uid, result); err != nil && mgo.MongodbNil == err {
|
if err = this.Get(uid, result); err != nil && mgo.MongodbNil == err {
|
||||||
// 创建一条数据
|
// 创建一条数据
|
||||||
|
result.Resettime = configure.Now().Unix() // 设置起始刷新时间
|
||||||
|
result.Lv = 1 // 初始1级
|
||||||
err = this.Add(uid, result)
|
err = this.Add(uid, result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = nil
|
err = nil
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
func (this *modelCaravan) modifyTrollDataByObjId(uid string, data map[string]interface{}) error {
|
func (this *modelCaravan) modifyCaravanDataByObjId(uid string, data map[string]interface{}) error {
|
||||||
return this.Change(uid, data)
|
return this.Change(uid, data)
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,13 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
|
||||||
"math"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Caravan struct {
|
type Caravan struct {
|
||||||
modules.ModuleBase
|
modules.ModuleBase
|
||||||
modelTroll *modelCaravan
|
modelCaravan *modelCaravan
|
||||||
api *apiComp
|
api *apiComp
|
||||||
configure *configureComp
|
configure *configureComp
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewModule() core.IModule {
|
func NewModule() core.IModule {
|
||||||
@ -33,238 +31,15 @@ func (this *Caravan) Init(service core.IService, module core.IModule, options co
|
|||||||
func (this *Caravan) OnInstallComp() {
|
func (this *Caravan) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
this.modelTroll = this.RegisterComp(new(modelCaravan)).(*modelCaravan)
|
this.modelCaravan = this.RegisterComp(new(modelCaravan)).(*modelCaravan)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 接口信息
|
// 接口信息 修改数据
|
||||||
func (this *Caravan) ModifyTrollData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
|
func (this *Caravan) ModifyCaravanData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
|
||||||
err := this.modelTroll.modifyTrollDataByObjId(uid, data)
|
err := this.modelCaravan.modifyCaravanDataByObjId(uid, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Caravan) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain) (code pb.ErrorCode) {
|
|
||||||
var (
|
|
||||||
sellPrice map[int32]int32 // 出售货物价格
|
|
||||||
totalGold int32
|
|
||||||
index int32
|
|
||||||
update map[string]interface{}
|
|
||||||
rangeId int32 // 增幅ID
|
|
||||||
tarinPos int32 // 火车位置
|
|
||||||
refreshTime int64 // 刷新时间
|
|
||||||
)
|
|
||||||
if troll.Buy == 0 && troll.Sell == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
update = make(map[string]interface{})
|
|
||||||
sellPrice = make(map[int32]int32)
|
|
||||||
now := configure.Now().Unix()
|
|
||||||
trainNum := this.configure.GetTrollMaxTraintNum()
|
|
||||||
maxCoefficient := this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
|
|
||||||
if maxCoefficient == 0 {
|
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rangeId = troll.RangeId
|
|
||||||
tarinPos = troll.TarinPos
|
|
||||||
refreshTime = troll.RefreshTime
|
|
||||||
|
|
||||||
goods := this.configure.GetTrollAllGoods()
|
|
||||||
for _, v := range goods {
|
|
||||||
sellPrice[v.Id] = v.Goodsprice
|
|
||||||
}
|
|
||||||
sz := this.configure.GetTrollAllTrain()
|
|
||||||
if len(sz) == 0 {
|
|
||||||
this.Errorf("GetTrollAllTrain configure err") // 配置异常 打个日志
|
|
||||||
return
|
|
||||||
}
|
|
||||||
iCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
|
||||||
for index = 0; ; index++ {
|
|
||||||
if index < tarinPos-1 { // 起始位置
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
index := int32(index) % trainNum
|
|
||||||
refreshTime += int64(sz[index])
|
|
||||||
|
|
||||||
if now >= refreshTime {
|
|
||||||
rangeId = (rangeId % maxCoefficient) + 1
|
|
||||||
tarinPos = (tarinPos % trainNum) + 1
|
|
||||||
|
|
||||||
coefficient := this.configure.GetTrollCoefficient(rangeId) // 获取当前级别的涨幅数据
|
|
||||||
if coefficient == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if troll.Sell <= coefficient.Coefficient { // 可以出售
|
|
||||||
var preGold int32 // 成本价
|
|
||||||
for _, v := range goods {
|
|
||||||
sellPrice[v.Id] = v.Goodsprice * coefficient.Coefficient / 1000
|
|
||||||
preGold += troll.Price[v.Id] * troll.Items[v.Id]
|
|
||||||
}
|
|
||||||
// 出售之前算成本
|
|
||||||
if len(troll.Items) > 0 {
|
|
||||||
sellGold := this.SellAllItem(session.GetUserId(), troll, sellPrice, tarinPos)
|
|
||||||
if sellGold != 0 {
|
|
||||||
if code = this.ModuleUser.AddAttributeValue(session, comm.ResGold, sellGold, true); code != pb.ErrorCode_Success {
|
|
||||||
this.Errorf("玩家 uid:%s 金币不足,获得金币%d", session.GetUserId(), sellGold)
|
|
||||||
} // 一次交易完成做一次结算
|
|
||||||
}
|
|
||||||
totalGold += sellGold
|
|
||||||
// 计算本次出售赚的金币
|
|
||||||
if sellGold-preGold > 0 {
|
|
||||||
troll.TotalEarn += int64(sellGold - preGold)
|
|
||||||
}
|
|
||||||
|
|
||||||
troll.AiCount++
|
|
||||||
aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
|
||||||
if troll.AiCount+troll.SellCount > aiMaxCount { //达到最大交易次数
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if troll.Buy >= coefficient.Coefficient { // 可以购买
|
|
||||||
for _, v := range goods {
|
|
||||||
sellPrice[v.Id] = v.Goodsprice * coefficient.Coefficient / 1000
|
|
||||||
}
|
|
||||||
troll.Shop = make(map[int32]int32) // 买之前清除购买上限
|
|
||||||
buyGold := this.BuyAllItem(session.GetUserId(), troll, sellPrice, tarinPos)
|
|
||||||
if buyGold != 0 {
|
|
||||||
if code = this.ModuleUser.AddAttributeValue(session, comm.ResGold, buyGold, true); code != pb.ErrorCode_Success {
|
|
||||||
this.Errorf("玩家 uid:%s 金币不足,获得金币%d", session.GetUserId(), buyGold)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
totalGold += buyGold
|
|
||||||
}
|
|
||||||
} else { // 超过当前时间
|
|
||||||
refreshTime -= int64(sz[index])
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if index > iCount*maxCoefficient { // ai挂机最大限制
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
update["shop"] = troll.Shop
|
|
||||||
update["items"] = troll.Items
|
|
||||||
update["price"] = troll.Price
|
|
||||||
update["aiCount"] = troll.AiCount
|
|
||||||
update["gridNum"] = troll.GridNum
|
|
||||||
update["totalEarn"] = troll.TotalEarn
|
|
||||||
if confLv := this.configure.GetTrollLv(troll.GetNpcLv() + 1); confLv != nil {
|
|
||||||
if troll.TotalEarn >= int64(confLv.Money) {
|
|
||||||
troll.NpcLv += 1 // npc levelUp
|
|
||||||
update["npcLv"] = troll.NpcLv
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.ModifyTrollData(session.GetUserId(), update)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 出售所有货物
|
|
||||||
func (this *Caravan) SellAllItem(uid string, troll *pb.DBTrollTrain, price map[int32]int32, tarinPos int32) (gold int32) {
|
|
||||||
for k, v := range troll.Items {
|
|
||||||
if _, ok := price[k]; ok {
|
|
||||||
gold += price[k] * v
|
|
||||||
}
|
|
||||||
delete(troll.Items, k) // 清除数据
|
|
||||||
}
|
|
||||||
troll.Price = make(map[int32]int32, 0) // 原来的价格也清除
|
|
||||||
troll.GridNum = 0 // 清空格子
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 可以购买商品
|
|
||||||
func (this *Caravan) BuyAllItem(uid string, troll *pb.DBTrollTrain, price map[int32]int32, tarinPos int32) (gold int32) {
|
|
||||||
var (
|
|
||||||
box map[int32]int32 // 盒子 存放可购买的物品
|
|
||||||
leftGirdNum int32 // 剩余可购买格子数量
|
|
||||||
costGold int32
|
|
||||||
buyBox map[int32]int32 // 盒子 存放可购买的物品
|
|
||||||
)
|
|
||||||
|
|
||||||
maxGirdNum := this.configure.GetTrollRule(comm.TrollGridCount) // 获取背包最大格子数量
|
|
||||||
maxgoods := this.configure.GetTrollRule(comm.TrollItemCount) // 获取单个物品最大上限 20个
|
|
||||||
|
|
||||||
leftGirdNum = maxGirdNum - troll.GridNum
|
|
||||||
box = make(map[int32]int32, 0)
|
|
||||||
buyBox = make(map[int32]int32, 0)
|
|
||||||
goods := this.configure.GetTrollAllGoods()
|
|
||||||
for _, v := range goods {
|
|
||||||
for {
|
|
||||||
if leftGirdNum > 0 && troll.Shop[v.Id] < v.Max {
|
|
||||||
leftGirdNum--
|
|
||||||
troll.Shop[v.Id] += maxgoods
|
|
||||||
box[v.Id] += maxgoods // 加入篮子
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 检查该位置的格子没有补满
|
|
||||||
full := (troll.Items[v.Id] + box[v.Id]) % maxgoods
|
|
||||||
if full != 0 {
|
|
||||||
box[v.Id] += (maxgoods - full) // 格子补满
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 通过金币来校验哪些物品可以买
|
|
||||||
curGold := this.ModuleUser.QueryAttributeValue(uid, comm.ResGold)
|
|
||||||
for k, v := range box {
|
|
||||||
for i := 0; i < int(v); i++ { //0 1 2 3
|
|
||||||
curGold -= int64(price[k])
|
|
||||||
costGold -= price[k]
|
|
||||||
if curGold < 0 {
|
|
||||||
box[k] = int32(i)
|
|
||||||
costGold += price[k] // 返还之前扣的
|
|
||||||
break
|
|
||||||
}
|
|
||||||
buyBox[k]++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(buyBox) == 0 {
|
|
||||||
return // 没有可购买的直接返回
|
|
||||||
}
|
|
||||||
for _, v := range goods { // 计算购买后的平均价格
|
|
||||||
g := troll.Items[v.Id] * troll.Price[v.Id]
|
|
||||||
g += buyBox[v.Id] * price[v.Id]
|
|
||||||
troll.Items[v.Id] += buyBox[v.Id]
|
|
||||||
|
|
||||||
if troll.Items[v.Id] != 0 {
|
|
||||||
troll.Price[v.Id] = g / troll.Items[v.Id]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
gold = costGold
|
|
||||||
// 统计格子
|
|
||||||
troll.GridNum = 0
|
|
||||||
for _, v := range troll.Items {
|
|
||||||
if v > 0 {
|
|
||||||
troll.GridNum += int32(math.Ceil(float64(v) / float64(maxgoods)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *Caravan) QueryRankList() (ranks []string, gold []int64, err error) {
|
|
||||||
var (
|
|
||||||
result []string
|
|
||||||
)
|
|
||||||
tableName := "trollRank"
|
|
||||||
|
|
||||||
if result, err = this.modelTroll.Redis.ZRevRange(tableName, 0, comm.MaxRankList).Result(); err != nil {
|
|
||||||
this.Errorln(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ranks = make([]string, 0)
|
|
||||||
for i := 0; i < len(result); i++ {
|
|
||||||
if _d, err := this.modelTroll.Redis.ZScore(tableName, result[i]); err == nil {
|
|
||||||
gold = append(gold, int64(_d))
|
|
||||||
ranks = append(ranks, result[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
406
pb/caravan_db.pb.go
Normal file
406
pb/caravan_db.pb.go
Normal file
@ -0,0 +1,406 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.28.0
|
||||||
|
// protoc v3.20.0
|
||||||
|
// source: caravan/caravan_db.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type Goods struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count"` //
|
||||||
|
Period int32 `protobuf:"varint,2,opt,name=period,proto3" json:"period"` // 变动周期
|
||||||
|
CurPeriod int32 `protobuf:"varint,3,opt,name=curPeriod,proto3" json:"curPeriod"` // 当前变动周期
|
||||||
|
Price int32 `protobuf:"varint,4,opt,name=price,proto3" json:"price"` // 当前价格
|
||||||
|
Time int32 `protobuf:"varint,5,opt,name=time,proto3" json:"time"` // 刷新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Goods) Reset() {
|
||||||
|
*x = Goods{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_caravan_caravan_db_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Goods) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Goods) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Goods) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_caravan_caravan_db_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Goods.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Goods) Descriptor() ([]byte, []int) {
|
||||||
|
return file_caravan_caravan_db_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Goods) GetCount() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Count
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Goods) GetPeriod() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Period
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Goods) GetCurPeriod() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CurPeriod
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Goods) GetPrice() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Price
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Goods) GetTime() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Time
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type CityGoods struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Like []string `protobuf:"bytes,1,rep,name=like,proto3" json:"like"` // 习惯的货物
|
||||||
|
Unlike []string `protobuf:"bytes,2,rep,name=unlike,proto3" json:"unlike"` // 不喜欢的货物
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CityGoods) Reset() {
|
||||||
|
*x = CityGoods{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_caravan_caravan_db_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CityGoods) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CityGoods) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CityGoods) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_caravan_caravan_db_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CityGoods.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CityGoods) Descriptor() ([]byte, []int) {
|
||||||
|
return file_caravan_caravan_db_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CityGoods) GetLike() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Like
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CityGoods) GetUnlike() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Unlike
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DBCaravan struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||||
|
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||||
|
UseCount int32 `protobuf:"varint,3,opt,name=useCount,proto3" json:"useCount"` // 当前背包使用的数量
|
||||||
|
//map<int32,int32> items = 4; // 背包数据
|
||||||
|
Goods map[int32]*Goods `protobuf:"bytes,5,rep,name=goods,proto3" json:"goods" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // key 货物ID
|
||||||
|
City map[int32]*CityGoods `protobuf:"bytes,6,rep,name=city,proto3" json:"city" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 城市信息
|
||||||
|
Lv int32 `protobuf:"varint,7,opt,name=lv,proto3" json:"lv"` // 商队等级
|
||||||
|
Num int64 `protobuf:"varint,8,opt,name=num,proto3" json:"num"` // 虚拟货币数量
|
||||||
|
Profit int64 `protobuf:"varint,9,opt,name=profit,proto3" json:"profit"` // 虚拟货利润
|
||||||
|
Resettime int64 `protobuf:"varint,10,opt,name=resettime,proto3" json:"resettime"` // 最后一次重置时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) Reset() {
|
||||||
|
*x = DBCaravan{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_caravan_caravan_db_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DBCaravan) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DBCaravan) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_caravan_caravan_db_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DBCaravan.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DBCaravan) Descriptor() ([]byte, []int) {
|
||||||
|
return file_caravan_caravan_db_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetUid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Uid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetUseCount() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UseCount
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetGoods() map[int32]*Goods {
|
||||||
|
if x != nil {
|
||||||
|
return x.Goods
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetCity() map[int32]*CityGoods {
|
||||||
|
if x != nil {
|
||||||
|
return x.City
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetLv() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Lv
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetNum() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Num
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetProfit() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Profit
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBCaravan) GetResettime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Resettime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_caravan_caravan_db_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_caravan_caravan_db_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x18, 0x63, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x2f, 0x63, 0x61, 0x72, 0x61, 0x76, 0x61,
|
||||||
|
0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7d, 0x0a, 0x05, 0x47, 0x6f,
|
||||||
|
0x6f, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,
|
||||||
|
0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x65, 0x72,
|
||||||
|
0x69, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x70, 0x65, 0x72, 0x69, 0x6f,
|
||||||
|
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x75, 0x72, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x03,
|
||||||
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x75, 0x72, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12,
|
||||||
|
0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
|
||||||
|
0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20,
|
||||||
|
0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x37, 0x0a, 0x09, 0x43, 0x69, 0x74,
|
||||||
|
0x79, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6b, 0x65, 0x18, 0x01,
|
||||||
|
0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6b, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e,
|
||||||
|
0x6c, 0x69, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x75, 0x6e, 0x6c, 0x69,
|
||||||
|
0x6b, 0x65, 0x22, 0xff, 0x02, 0x0a, 0x09, 0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e,
|
||||||
|
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||||
|
0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
|
||||||
|
0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03,
|
||||||
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2b,
|
||||||
|
0x0a, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e,
|
||||||
|
0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x2e, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x45,
|
||||||
|
0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x63,
|
||||||
|
0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x43, 0x61,
|
||||||
|
0x72, 0x61, 0x76, 0x61, 0x6e, 0x2e, 0x43, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
|
||||||
|
0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28,
|
||||||
|
0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01,
|
||||||
|
0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x66, 0x69,
|
||||||
|
0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x12,
|
||||||
|
0x1c, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01,
|
||||||
|
0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x40, 0x0a,
|
||||||
|
0x0a, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||||
|
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a,
|
||||||
|
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47,
|
||||||
|
0x6f, 0x6f, 0x64, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
|
||||||
|
0x43, 0x0a, 0x09, 0x43, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
|
||||||
|
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x20,
|
||||||
|
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e,
|
||||||
|
0x43, 0x69, 0x74, 0x79, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||||
|
0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||||
|
0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_caravan_caravan_db_proto_rawDescOnce sync.Once
|
||||||
|
file_caravan_caravan_db_proto_rawDescData = file_caravan_caravan_db_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_caravan_caravan_db_proto_rawDescGZIP() []byte {
|
||||||
|
file_caravan_caravan_db_proto_rawDescOnce.Do(func() {
|
||||||
|
file_caravan_caravan_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_caravan_caravan_db_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_caravan_caravan_db_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_caravan_caravan_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||||
|
var file_caravan_caravan_db_proto_goTypes = []interface{}{
|
||||||
|
(*Goods)(nil), // 0: Goods
|
||||||
|
(*CityGoods)(nil), // 1: CityGoods
|
||||||
|
(*DBCaravan)(nil), // 2: DBCaravan
|
||||||
|
nil, // 3: DBCaravan.GoodsEntry
|
||||||
|
nil, // 4: DBCaravan.CityEntry
|
||||||
|
}
|
||||||
|
var file_caravan_caravan_db_proto_depIdxs = []int32{
|
||||||
|
3, // 0: DBCaravan.goods:type_name -> DBCaravan.GoodsEntry
|
||||||
|
4, // 1: DBCaravan.city:type_name -> DBCaravan.CityEntry
|
||||||
|
0, // 2: DBCaravan.GoodsEntry.value:type_name -> Goods
|
||||||
|
1, // 3: DBCaravan.CityEntry.value:type_name -> CityGoods
|
||||||
|
4, // [4:4] is the sub-list for method output_type
|
||||||
|
4, // [4:4] is the sub-list for method input_type
|
||||||
|
4, // [4:4] is the sub-list for extension type_name
|
||||||
|
4, // [4:4] is the sub-list for extension extendee
|
||||||
|
0, // [0:4] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_caravan_caravan_db_proto_init() }
|
||||||
|
func file_caravan_caravan_db_proto_init() {
|
||||||
|
if File_caravan_caravan_db_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_caravan_caravan_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Goods); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_caravan_caravan_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*CityGoods); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_caravan_caravan_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*DBCaravan); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_caravan_caravan_db_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 5,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_caravan_caravan_db_proto_goTypes,
|
||||||
|
DependencyIndexes: file_caravan_caravan_db_proto_depIdxs,
|
||||||
|
MessageInfos: file_caravan_caravan_db_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_caravan_caravan_db_proto = out.File
|
||||||
|
file_caravan_caravan_db_proto_rawDesc = nil
|
||||||
|
file_caravan_caravan_db_proto_goTypes = nil
|
||||||
|
file_caravan_caravan_db_proto_depIdxs = nil
|
||||||
|
}
|
337
pb/caravan_msg.pb.go
Normal file
337
pb/caravan_msg.pb.go
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.28.0
|
||||||
|
// protoc v3.20.0
|
||||||
|
// source: caravan/caravan_msg.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 查询进度
|
||||||
|
type CaravanGetListReq struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanGetListReq) Reset() {
|
||||||
|
*x = CaravanGetListReq{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_caravan_caravan_msg_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanGetListReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CaravanGetListReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CaravanGetListReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_caravan_caravan_msg_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CaravanGetListReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CaravanGetListReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_caravan_caravan_msg_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回进度信息
|
||||||
|
type CaravanGetListResp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Data *DBCaravan `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanGetListResp) Reset() {
|
||||||
|
*x = CaravanGetListResp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_caravan_caravan_msg_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanGetListResp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CaravanGetListResp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CaravanGetListResp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_caravan_caravan_msg_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CaravanGetListResp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CaravanGetListResp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_caravan_caravan_msg_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanGetListResp) GetData() *DBCaravan {
|
||||||
|
if x != nil {
|
||||||
|
return x.Data
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type CaravanBuyOrSellReq struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Items map[int32]int32 `protobuf:"bytes,1,rep,name=items,proto3" json:"items" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //买入货物的数量(负数为卖)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanBuyOrSellReq) Reset() {
|
||||||
|
*x = CaravanBuyOrSellReq{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_caravan_caravan_msg_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanBuyOrSellReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CaravanBuyOrSellReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CaravanBuyOrSellReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_caravan_caravan_msg_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CaravanBuyOrSellReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CaravanBuyOrSellReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_caravan_caravan_msg_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanBuyOrSellReq) GetItems() map[int32]int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Items
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type CaravanBuyOrSellResp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Data *DBCaravan `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanBuyOrSellResp) Reset() {
|
||||||
|
*x = CaravanBuyOrSellResp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_caravan_caravan_msg_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanBuyOrSellResp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CaravanBuyOrSellResp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CaravanBuyOrSellResp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_caravan_caravan_msg_proto_msgTypes[3]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CaravanBuyOrSellResp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CaravanBuyOrSellResp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_caravan_caravan_msg_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CaravanBuyOrSellResp) GetData() *DBCaravan {
|
||||||
|
if x != nil {
|
||||||
|
return x.Data
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_caravan_caravan_msg_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_caravan_caravan_msg_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x19, 0x63, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x2f, 0x63, 0x61, 0x72, 0x61, 0x76, 0x61,
|
||||||
|
0x6e, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x63, 0x61, 0x72,
|
||||||
|
0x61, 0x76, 0x61, 0x6e, 0x2f, 0x63, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x5f, 0x64, 0x62, 0x2e,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e,
|
||||||
|
0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x12, 0x43, 0x61,
|
||||||
|
0x72, 0x61, 0x76, 0x61, 0x6e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
|
||||||
|
0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a,
|
||||||
|
0x2e, 0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
||||||
|
0x22, 0x86, 0x01, 0x0a, 0x13, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x42, 0x75, 0x79, 0x4f,
|
||||||
|
0x72, 0x53, 0x65, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x35, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d,
|
||||||
|
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61,
|
||||||
|
0x6e, 0x42, 0x75, 0x79, 0x4f, 0x72, 0x53, 0x65, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x2e, 0x49, 0x74,
|
||||||
|
0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a,
|
||||||
|
0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
||||||
|
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
||||||
|
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
|
||||||
|
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x36, 0x0a, 0x14, 0x43, 0x61, 0x72,
|
||||||
|
0x61, 0x76, 0x61, 0x6e, 0x42, 0x75, 0x79, 0x4f, 0x72, 0x53, 0x65, 0x6c, 0x6c, 0x52, 0x65, 0x73,
|
||||||
|
0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||||
|
0x0a, 0x2e, 0x44, 0x42, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74,
|
||||||
|
0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_caravan_caravan_msg_proto_rawDescOnce sync.Once
|
||||||
|
file_caravan_caravan_msg_proto_rawDescData = file_caravan_caravan_msg_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_caravan_caravan_msg_proto_rawDescGZIP() []byte {
|
||||||
|
file_caravan_caravan_msg_proto_rawDescOnce.Do(func() {
|
||||||
|
file_caravan_caravan_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_caravan_caravan_msg_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_caravan_caravan_msg_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_caravan_caravan_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||||
|
var file_caravan_caravan_msg_proto_goTypes = []interface{}{
|
||||||
|
(*CaravanGetListReq)(nil), // 0: CaravanGetListReq
|
||||||
|
(*CaravanGetListResp)(nil), // 1: CaravanGetListResp
|
||||||
|
(*CaravanBuyOrSellReq)(nil), // 2: CaravanBuyOrSellReq
|
||||||
|
(*CaravanBuyOrSellResp)(nil), // 3: CaravanBuyOrSellResp
|
||||||
|
nil, // 4: CaravanBuyOrSellReq.ItemsEntry
|
||||||
|
(*DBCaravan)(nil), // 5: DBCaravan
|
||||||
|
}
|
||||||
|
var file_caravan_caravan_msg_proto_depIdxs = []int32{
|
||||||
|
5, // 0: CaravanGetListResp.data:type_name -> DBCaravan
|
||||||
|
4, // 1: CaravanBuyOrSellReq.items:type_name -> CaravanBuyOrSellReq.ItemsEntry
|
||||||
|
5, // 2: CaravanBuyOrSellResp.data:type_name -> DBCaravan
|
||||||
|
3, // [3:3] is the sub-list for method output_type
|
||||||
|
3, // [3:3] is the sub-list for method input_type
|
||||||
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_caravan_caravan_msg_proto_init() }
|
||||||
|
func file_caravan_caravan_msg_proto_init() {
|
||||||
|
if File_caravan_caravan_msg_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
file_caravan_caravan_db_proto_init()
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_caravan_caravan_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*CaravanGetListReq); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_caravan_caravan_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*CaravanGetListResp); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_caravan_caravan_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*CaravanBuyOrSellReq); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_caravan_caravan_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*CaravanBuyOrSellResp); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_caravan_caravan_msg_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 5,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_caravan_caravan_msg_proto_goTypes,
|
||||||
|
DependencyIndexes: file_caravan_caravan_msg_proto_depIdxs,
|
||||||
|
MessageInfos: file_caravan_caravan_msg_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_caravan_caravan_msg_proto = out.File
|
||||||
|
file_caravan_caravan_msg_proto_rawDesc = nil
|
||||||
|
file_caravan_caravan_msg_proto_goTypes = nil
|
||||||
|
file_caravan_caravan_msg_proto_depIdxs = nil
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user