This commit is contained in:
meixiongfeng 2023-02-24 20:24:08 +08:00
commit 593af9dbfe
24 changed files with 1873 additions and 172 deletions

View File

@ -14,12 +14,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -51,12 +55,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -88,12 +96,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -125,12 +137,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -162,12 +178,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -199,12 +219,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -236,12 +260,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -273,12 +301,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -310,12 +342,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -347,12 +383,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -384,12 +424,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -421,12 +465,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -458,12 +506,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -495,12 +547,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -532,12 +588,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -569,12 +629,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -606,12 +670,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -643,12 +711,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -680,12 +752,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -717,12 +793,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -754,12 +834,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -791,12 +875,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{
@ -828,12 +916,16 @@
},
"taskneed": 2,
"taskreq": [
"lv",
"1"
{
"key": 1,
"param": 1
}
],
"taskreqex": [
"star",
"5"
{
"key": 2,
"param": 5
}
],
"reward": [
{

View File

@ -34,7 +34,21 @@ func (s *SmithyView) CreateView(t *model.TestCase) fyne.CanvasObject {
t.MainType,
"jiaoyi",
&pb.SmithySellReq{
EquipIds: []string{},
EquipIds: []string{},
CustomerId: 1,
},
); err != nil {
logrus.Error(err)
return
}
}
//拒绝
refuse := func() {
if err := service.GetPttService().SendToClient(
t.MainType,
"refuse",
&pb.SmithyRefuseReq{
CustomerId: 1,
},
); err != nil {
@ -43,9 +57,10 @@ func (s *SmithyView) CreateView(t *model.TestCase) fyne.CanvasObject {
}
}
customerBtn := widget.NewButton("顾客", loadCustomer)
refuseBtn := widget.NewButton("拒绝", refuse)
jiaoyiBtn := widget.NewButton("交易", jiaoyi)
btns := container.NewHBox(customerBtn, jiaoyiBtn)
btns := container.NewHBox(customerBtn, jiaoyiBtn, refuseBtn)
c := container.NewBorder(btns, nil, nil, nil)
return c
}

36
comm/weight.go Normal file
View File

@ -0,0 +1,36 @@
package comm
import "math/rand"
type WeightItem struct {
Id interface{}
Weight int
}
// 权重项目
type WeightedRandom struct {
items []*WeightItem
totalWeight int
}
func NewWeightedRandom(items []*WeightItem) *WeightedRandom {
wr := &WeightedRandom{items: items}
for _, item := range wr.items {
wr.totalWeight += int(item.Weight)
}
return wr
}
func (wr *WeightedRandom) Pick() *WeightItem {
if wr.totalWeight <= 0 {
return nil
}
randomNumber := rand.Intn(wr.totalWeight)
for _, item := range wr.items {
if randomNumber < int(item.Weight) {
return item
}
randomNumber -= int(item.Weight)
}
return nil
}

View File

@ -0,0 +1,32 @@
package dispatch
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"github.com/golang/protobuf/proto"
)
// 派遣
func (a *apiComp) DoCheck(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode) {
if len(req.HeroId) == 0 || req.TaskId == 0 {
return
}
return
}
func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode, data proto.Message) {
if code = a.DoCheck(session, req); code != pb.ErrorCode_Success {
return
}
if err := a.module.modelDispatch.dispatch(session.GetUserId(), req.TaskId, req.HeroId); err != nil {
code = pb.ErrorCode_DBError
return
}
rsp := &pb.DispatchDoResp{}
session.SendMsg(string(a.module.GetType()), "do", rsp)
return
}

View File

@ -0,0 +1,29 @@
package dispatch
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公告板信息
func (a *apiComp) NoticeCheck(session comm.IUserSession, req *pb.DispatchNoticeReq) (code pb.ErrorCode) {
return
}
func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (code pb.ErrorCode, data proto.Message) {
d := a.module.modelDispatch.getDBDispatch(session.GetUserId())
if d == nil {
d = a.module.modelDispatch.initDispatch(session.GetUserId())
return
}
rsp := &pb.DispatchNoticeResp{
Dispatch: d,
}
session.SendMsg(string(a.module.GetType()), "notice", rsp)
return
}

View File

@ -0,0 +1,30 @@
package dispatch
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 领取派遣奖励
func (a *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.DispatchReceiveReq) (code pb.ErrorCode) {
return
}
func (a *apiComp) Receive(session comm.IUserSession, req *pb.DispatchReceiveReq) (code pb.ErrorCode, data proto.Message) {
d := a.module.modelDispatch.getDBDispatch(session.GetUserId())
if d == nil {
code = pb.ErrorCode_DBError
return
}
a.module.modelDispatch.taskRandom(session.GetUserId(), d.Nb.Lv)
rsp := &pb.DispatchReceiveResp{}
session.SendMsg(string(a.module.GetType()), "receive", rsp)
return
}

View File

@ -0,0 +1,21 @@
package dispatch
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 刷新
func (a *apiComp) RefreshCheck(session comm.IUserSession, req *pb.DispatchRefreshReq) (code pb.ErrorCode) {
return
}
func (a *apiComp) Refresh(session comm.IUserSession, req *pb.DispatchRefreshReq) (code pb.ErrorCode, data proto.Message) {
rsp := &pb.DispatchRefreshResp{}
session.SendMsg(string(a.module.GetType()), "refresh", rsp)
return
}

View File

@ -0,0 +1,84 @@
package dispatch
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
gameDispatchLv = "game_dispatch_lv.json"
gameDispatchTask = "game_dispatch_task.json"
)
type configureComp struct {
modules.MCompConfigure
}
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.LoadMultiConfigure(map[string]interface{}{
gameDispatchLv: cfg.NewGameDispatch_Lv,
gameDispatchTask: cfg.NewGameDispatch_Task,
})
return
}
// 公告栏配置
func (this *configureComp) getDispatchLvConf(lv int32) (data *cfg.GameDispatch_LvData, err error) {
var v interface{}
if v, err = this.GetConfigure(gameDispatchLv); err != nil {
err = fmt.Errorf("%T no is *cfg.GameDispatchLv", v)
return
} else {
d, ok := v.(*cfg.GameDispatch_Lv)
if !ok {
err = fmt.Errorf("%T is not *cfg.GameDispatchLv", v)
return
}
if data, ok = d.GetDataMap()[lv]; ok {
return
}
}
return
}
//任务配置
func(this *configureComp) getDispatchTaskConf(taskId int32) (data *cfg.GameDispatch_TaskData,err error) {
var v interface{}
if v, err = this.GetConfigure(gameDispatchTask); err != nil {
err = fmt.Errorf("%T no is *cfg.GameDispatchTask", v)
return
} else {
d, ok := v.(*cfg.GameDispatch_Task)
if !ok {
err = fmt.Errorf("%T is not *cfg.GameDispatchTask", v)
return
}
if data, ok = d.GetDataMap()[taskId]; ok {
return
}
}
return
}
// 任务列表
func (this *configureComp) getDispatchListConf() (list []*cfg.GameDispatch_TaskData) {
if v, err := this.GetConfigure(gameDispatchTask); err != nil {
return
} else {
d, ok := v.(*cfg.GameDispatch_Task)
if !ok {
err = fmt.Errorf("%T is not *cfg.GameDispatch_Task", v)
return
}
list = d.GetDataList()
}
return
}

View File

@ -1,9 +1,13 @@
package dispatch
import (
"errors"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
"go_dreamfactory/utils"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
@ -26,3 +30,177 @@ func (this *modelDispatch) Init(service core.IService, module core.IModule, comp
return
}
func (this *modelDispatch) initDispatch(uid string) (dis *pb.DBDispatch) {
taskIds, err := this.taskRandom(uid, 1)
if err != nil {
return
}
if len(taskIds) == 0 {
return
}
dis = &pb.DBDispatch{
Uid: uid,
Ticket: 6,
Nb: &pb.Noticeboard{
Lv: 1,
},
}
for _, v := range taskIds {
taskConf, err := this.module.configure.getDispatchTaskConf(v)
if err != nil {
continue
}
//接续截至时间
duration := configure.Now().Unix() + int64(taskConf.Taskcd)
dis.Nb.Tasks = append(dis.Nb.Tasks, &pb.DispatchTask{
TaskId: v,
Duration: duration,
})
}
if err := this.Add(uid, dis); err != nil {
return
}
return
}
// 获取派遣数据
func (this *modelDispatch) getDBDispatch(uid string) *pb.DBDispatch {
dis := &pb.DBDispatch{}
if err := this.Get(uid, dis); err != nil {
return nil
}
return nil
}
// 随机任务
func (this *modelDispatch) taskRandom(uid string, noticeLv int32) (taskIds []int32, err error) {
d := this.getDBDispatch(uid)
if d == nil {
return nil, errors.New("no data")
}
if d.Nb == nil {
return nil, errors.New("notice is nil")
}
conf, err := this.module.configure.getDispatchLvConf(noticeLv)
if err != nil {
return nil, err
}
var items []*comm.WeightItem
for i, v := range conf.Probability {
items = append(items, &comm.WeightItem{Id: (i + 1), Weight: int(v)})
}
wr := comm.NewWeightedRandom(items)
//任务类型
var taskType int
if c := wr.Pick(); c != nil {
taskType = c.Id.(int)
}
confList := this.module.configure.getDispatchListConf()
var tIds []int32
for _, v := range confList {
if int(v.Type) == taskType {
tIds = append(tIds, v.Id)
}
}
//判断随机数量
var n int
n = len(d.Nb.Tasks)
if len(taskIds) > 0 {
ids := utils.RandomNumbers(0, len(tIds), n)
for i := 0; i < len(ids); i++ {
taskIds = append(taskIds, tIds[i])
}
}
return
}
// 验证英雄的条件
func (this *modelDispatch) validHeroCond(uid string, taskId int32, heroId string) (ok bool, err error) {
//taskConf
gd, err := this.module.configure.getDispatchTaskConf(taskId)
if err != nil {
return
}
//获取英雄信息
hero, code := this.module.ModuleHero.GetHeroByObjID(uid, heroId)
//校验英雄的条件
if code == pb.ErrorCode_Success && hero != nil {
for _, v := range gd.Taskreq {
switch v.Key {
case 1: //lv
if hero.Lv >= v.Param {
ok = true
return
}
case 2: //star
if hero.Star >= v.Param {
ok = true
return
}
}
}
}
//校验英雄是否已被派遣
dispatch := this.getDBDispatch(uid)
if dispatch == nil {
return
}
for _, v := range dispatch.Nb.Tasks {
for _, h := range v.HeroIds {
if h == heroId {
ok = false
return
}
}
}
return
}
// 派遣
func (this *modelDispatch) dispatch(uid string, taskId int32, heroIds []string) error {
for _, heroId := range heroIds {
if ok, err := this.validHeroCond(uid, taskId, heroId); err == nil {
if !ok {
return comm.NewCustomError(pb.ErrorCode_DispatchHeroNoReached)
}
} else {
return err
}
}
d := this.getDBDispatch(uid)
if d == nil {
return errors.New("no data")
}
for _, v := range d.Nb.Tasks {
if v.TaskId == taskId && v.Status == 0 {
v.HeroIds = heroIds
}
}
update := map[string]interface{}{
"nb": d.Nb.Tasks,
}
if err := this.Change(uid, update); err != nil {
return err
}
return nil
}

View File

@ -9,19 +9,27 @@ import (
// 派遣
type Dispatch struct {
modules.ModuleBase
api *apiComp
api *apiComp
configure *configureComp
modelDispatch *modelDispatch
}
func NewModule() core.IModule {
return &Dispatch{}
}
func (this *Dispatch) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error){
func (this *Dispatch) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
func (this *Dispatch) GetType() core.M_Modules {
return comm.ModuleDispatch
}
func (this *Dispatch) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.modelDispatch = this.RegisterComp(new(modelDispatch)).(*modelDispatch)
}

View File

@ -141,6 +141,7 @@ func (this *ModuleBase) GetCrossTag() string {
func (this *ModuleBase) GetUserSession(uid string) (session comm.IUserSession, ok bool) {
var udata *pb.CacheUser
if udata = this.ModuleUser.GetUserSession(uid); udata == nil {
session = this.scomp.GetUserSession(&pb.CacheUser{Uid: uid})
ok = false
return
}

View File

@ -3,6 +3,11 @@ package practice
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"math"
"math/rand"
"time"
"google.golang.org/protobuf/proto"
)
@ -15,7 +20,164 @@ func (this *apiComp) ExpulsionCheck(session comm.IUserSession, req *pb.PracticeE
///练功请求 驱逐
func (this *apiComp) Expulsion(session comm.IUserSession, req *pb.PracticeExpulsionReq) (code pb.ErrorCode, data proto.Message) {
var (
err error
ok bool
room *pb.DBPracticeRoom
pillar *pb.DBPracticePillar
pillarconfigure *cfg.GamePandamasMzData
tconfigure *cfg.GamePandamasJxData
pconfigure *cfg.GamePandamasJxData
_session comm.IUserSession
filed string
exp int32
exp1 int32
ants1 []*cfg.Gameatn
ants2 []*cfg.Gameatn
)
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError
return
}
pillar = room.Pillarf
filed = "pillarf"
if pillarconfigure, err = this.module.configure.getGamePandamasMz(pillar.Lv); err != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
if pillar.Teacher != "" {
if tconfigure, err = this.module.configure.getGamePandamasJx(pillar.Teacher); err != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
}
if pillar.Prop != "" {
if pconfigure, err = this.module.configure.getGamePandamasJx(pillar.Prop); err != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
}
//计算经验收益
if configure.Now().After(time.Unix(pillar.Expend, 0)) {
minutes := int32(time.Unix(pillar.Expend, 0).Sub(time.Unix(pillar.Start, 0)).Minutes())
exp = minutes * pillarconfigure.MinExp
} else {
minutes := int32(configure.Now().Sub(time.Unix(pillar.Start, 0)).Minutes())
exp = minutes * pillarconfigure.MinExp
}
exp1 += exp
//是否可以获得额外收益
if configure.Now().After(time.Unix(pillar.End, 0)) {
if tconfigure != nil {
if tconfigure.Exp > 0 { //经验加成
exp1 += int32(math.Floor(float64(exp) * (float64(tconfigure.Exp) / float64(100))))
}
if len(tconfigure.Ants) > 0 { //额外道具加成
ants1 = make([]*cfg.Gameatn, 0)
r := rand.New(rand.NewSource(time.Now().Unix()))
num := r.Int31n(tconfigure.Num[1]-tconfigure.Num[0]) + tconfigure.Num[0]
if r.Int31n(100) < tconfigure.Probability { //随机一个道具
total := 0
for _, v := range tconfigure.Wget {
total += int(v)
}
n := rand.Intn(total)
for i, v := range tconfigure.Wget {
if int32(n) <= v {
ants1 = append(ants1, &cfg.Gameatn{
A: tconfigure.Ants[i].A,
T: tconfigure.Ants[i].T,
N: num,
})
break
}
}
} else { //全部要
for _, v := range tconfigure.Ants {
ants1 = append(ants1, &cfg.Gameatn{
A: v.A,
T: v.T,
N: 0,
})
}
for i := int32(0); i < num; i++ {
index := i % int32(len(ants1))
ants1[index].N++
}
}
}
}
if pconfigure != nil {
if pconfigure.Exp > 0 { //经验加成
exp1 += int32(math.Floor(float64(exp) * (float64(pconfigure.Exp) / float64(100))))
}
if len(pconfigure.Ants) > 0 { //额外道具加成
ants2 = make([]*cfg.Gameatn, 0)
r := rand.New(rand.NewSource(time.Now().Unix()))
num := r.Int31n(pconfigure.Num[1]-pconfigure.Num[0]) + pconfigure.Num[0]
if r.Int31n(100) < pconfigure.Probability { //随机一个道具
total := 0
for _, v := range pconfigure.Wget {
total += int(v)
}
n := rand.Intn(total)
for i, v := range pconfigure.Wget {
if int32(n) <= v {
ants2 = append(ants2, &cfg.Gameatn{
A: pconfigure.Ants[i].A,
T: pconfigure.Ants[i].T,
N: num,
})
break
}
}
} else { //全部要
for _, v := range pconfigure.Ants {
ants2 = append(ants2, &cfg.Gameatn{
A: v.A,
T: v.T,
N: 0,
})
}
for i := int32(0); i < num; i++ {
index := i % int32(len(ants2))
ants2[index].N++
}
}
}
}
}
if _session, ok = this.module.GetUserSession(pillar.Uid); ok {
if _, code = this.module.ModuleHero.AddHeroExp(_session, pillar.Hero, exp); code != pb.ErrorCode_Success {
return
}
if code = this.module.DispenseRes(_session, append(ants1, ants2...), true); code != pb.ErrorCode_Success {
return
}
} else {
}
room.Knapsack[pillar.Teacher] = 0
room.Knapsack[pillar.Prop] = 0
pillar.Hero = ""
pillar.Teacher = ""
pillar.Prop = ""
pillar.Start = 0
pillar.End = 0
pillar.Expend = 0
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
filed: pillar,
})
this.module.modelPandata.Change(pillar.Uid, map[string]interface{}{
"knapsack": room.Knapsack,
})
session.SendMsg(string(this.module.GetType()), "expulsion", &pb.PracticeExpulsionResp{})
return
}

View File

@ -192,10 +192,20 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
pillar.Start = 0
pillar.End = 0
pillar.Expend = 0
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
"knapsack": room.Knapsack,
filed: pillar,
})
if req.Friend == "" {
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
"knapsack": room.Knapsack,
filed: pillar,
})
} else {
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
"knapsack": room.Knapsack,
})
this.module.modelPandata.Change(req.Friend, map[string]interface{}{
filed: pillar,
})
}
session.SendMsg(string(this.module.GetType()), "receive", &pb.PracticeReceiveResp{})
return
}

View File

@ -38,14 +38,14 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (cod
return
}
conf := this.module.configure.GetSmithyCustomerConf(req.CustomerId)
if conf == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
// conf := this.module.configure.GetSmithyCustomerConf(req.CustomerId)
// if conf == nil {
// code = pb.ErrorCode_ConfigNoFound
// return
// }
// 发奖励
this.module.DispenseRes(session, conf.Reword, true)
// // 发奖励
// this.module.DispenseRes(session, conf.Reword, true)
rsp := &pb.SmithySellResp{
CustomerId: req.CustomerId,

349
pb/dispatch_db.pb.go Normal file
View File

@ -0,0 +1,349 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: dispatch/dispatch_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 DBDispatch struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //
Ticket int32 `protobuf:"varint,2,opt,name=ticket,proto3" json:"ticket" bson:"ticket"` //门票
Nb *Noticeboard `protobuf:"bytes,3,opt,name=nb,proto3" json:"nb" bson:"nb"` //公告栏
}
func (x *DBDispatch) Reset() {
*x = DBDispatch{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBDispatch) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBDispatch) ProtoMessage() {}
func (x *DBDispatch) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_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 DBDispatch.ProtoReflect.Descriptor instead.
func (*DBDispatch) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBDispatch) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBDispatch) GetTicket() int32 {
if x != nil {
return x.Ticket
}
return 0
}
func (x *DBDispatch) GetNb() *Noticeboard {
if x != nil {
return x.Nb
}
return nil
}
// 公告栏
type Noticeboard struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Lv int32 `protobuf:"varint,1,opt,name=lv,proto3" json:"lv" bson:"lv"` // 公告栏等级
NoticeType int32 `protobuf:"varint,2,opt,name=noticeType,proto3" json:"noticeType" bson:"noticeType"` // 公告栏类型
Tasks []*DispatchTask `protobuf:"bytes,3,rep,name=tasks,proto3" json:"tasks" bson:"tasks"` //当前公告任务
}
func (x *Noticeboard) Reset() {
*x = Noticeboard{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Noticeboard) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Noticeboard) ProtoMessage() {}
func (x *Noticeboard) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_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 Noticeboard.ProtoReflect.Descriptor instead.
func (*Noticeboard) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_db_proto_rawDescGZIP(), []int{1}
}
func (x *Noticeboard) GetLv() int32 {
if x != nil {
return x.Lv
}
return 0
}
func (x *Noticeboard) GetNoticeType() int32 {
if x != nil {
return x.NoticeType
}
return 0
}
func (x *Noticeboard) GetTasks() []*DispatchTask {
if x != nil {
return x.Tasks
}
return nil
}
// 派遣任务
type DispatchTask struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //任务ID
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //任务状态 默认0 1任务中 2任务完成
Duration int64 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration" bson:"duration"` //持续截至时间
LeftTime int64 `protobuf:"varint,4,opt,name=leftTime,proto3" json:"leftTime" bson:"leftTime"` //任务截至时间
HeroIds []string `protobuf:"bytes,5,rep,name=heroIds,proto3" json:"heroIds"` //go_tags(`bson:"heroIds"`) 派遣的英雄
}
func (x *DispatchTask) Reset() {
*x = DispatchTask{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_db_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchTask) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchTask) ProtoMessage() {}
func (x *DispatchTask) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_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 DispatchTask.ProtoReflect.Descriptor instead.
func (*DispatchTask) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_db_proto_rawDescGZIP(), []int{2}
}
func (x *DispatchTask) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
func (x *DispatchTask) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *DispatchTask) GetDuration() int64 {
if x != nil {
return x.Duration
}
return 0
}
func (x *DispatchTask) GetLeftTime() int64 {
if x != nil {
return x.LeftTime
}
return 0
}
func (x *DispatchTask) GetHeroIds() []string {
if x != nil {
return x.HeroIds
}
return nil
}
var File_dispatch_dispatch_db_proto protoreflect.FileDescriptor
var file_dispatch_dispatch_db_proto_rawDesc = []byte{
0x0a, 0x1a, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61,
0x74, 0x63, 0x68, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x54, 0x0a, 0x0a,
0x44, 0x42, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06,
0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x69,
0x63, 0x6b, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x02, 0x6e, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0c, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x02,
0x6e, 0x62, 0x22, 0x62, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62, 0x6f, 0x61, 0x72,
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c,
0x76, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x0d, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x52,
0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x69, 0x73, 0x70, 0x61,
0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12,
0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09,
0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_dispatch_dispatch_db_proto_rawDescOnce sync.Once
file_dispatch_dispatch_db_proto_rawDescData = file_dispatch_dispatch_db_proto_rawDesc
)
func file_dispatch_dispatch_db_proto_rawDescGZIP() []byte {
file_dispatch_dispatch_db_proto_rawDescOnce.Do(func() {
file_dispatch_dispatch_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_dispatch_dispatch_db_proto_rawDescData)
})
return file_dispatch_dispatch_db_proto_rawDescData
}
var file_dispatch_dispatch_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_dispatch_dispatch_db_proto_goTypes = []interface{}{
(*DBDispatch)(nil), // 0: DBDispatch
(*Noticeboard)(nil), // 1: Noticeboard
(*DispatchTask)(nil), // 2: DispatchTask
}
var file_dispatch_dispatch_db_proto_depIdxs = []int32{
1, // 0: DBDispatch.nb:type_name -> Noticeboard
2, // 1: Noticeboard.tasks:type_name -> DispatchTask
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_dispatch_dispatch_db_proto_init() }
func file_dispatch_dispatch_db_proto_init() {
if File_dispatch_dispatch_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_dispatch_dispatch_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBDispatch); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Noticeboard); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchTask); 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_dispatch_dispatch_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_dispatch_dispatch_db_proto_goTypes,
DependencyIndexes: file_dispatch_dispatch_db_proto_depIdxs,
MessageInfos: file_dispatch_dispatch_db_proto_msgTypes,
}.Build()
File_dispatch_dispatch_db_proto = out.File
file_dispatch_dispatch_db_proto_rawDesc = nil
file_dispatch_dispatch_db_proto_goTypes = nil
file_dispatch_dispatch_db_proto_depIdxs = nil
}

538
pb/dispatch_msg.pb.go Normal file
View File

@ -0,0 +1,538 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: dispatch/dispatch_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 DispatchNoticeReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DispatchNoticeReq) Reset() {
*x = DispatchNoticeReq{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchNoticeReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchNoticeReq) ProtoMessage() {}
func (x *DispatchNoticeReq) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_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 DispatchNoticeReq.ProtoReflect.Descriptor instead.
func (*DispatchNoticeReq) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{0}
}
type DispatchNoticeResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Dispatch *DBDispatch `protobuf:"bytes,1,opt,name=dispatch,proto3" json:"dispatch"`
}
func (x *DispatchNoticeResp) Reset() {
*x = DispatchNoticeResp{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchNoticeResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchNoticeResp) ProtoMessage() {}
func (x *DispatchNoticeResp) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_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 DispatchNoticeResp.ProtoReflect.Descriptor instead.
func (*DispatchNoticeResp) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{1}
}
func (x *DispatchNoticeResp) GetDispatch() *DBDispatch {
if x != nil {
return x.Dispatch
}
return nil
}
//刷新公告
type DispatchRefreshReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DispatchRefreshReq) Reset() {
*x = DispatchRefreshReq{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchRefreshReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchRefreshReq) ProtoMessage() {}
func (x *DispatchRefreshReq) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_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 DispatchRefreshReq.ProtoReflect.Descriptor instead.
func (*DispatchRefreshReq) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{2}
}
type DispatchRefreshResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DispatchRefreshResp) Reset() {
*x = DispatchRefreshResp{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchRefreshResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchRefreshResp) ProtoMessage() {}
func (x *DispatchRefreshResp) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_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 DispatchRefreshResp.ProtoReflect.Descriptor instead.
func (*DispatchRefreshResp) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{3}
}
//一键领取奖励
type DispatchReceiveReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DispatchReceiveReq) Reset() {
*x = DispatchReceiveReq{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchReceiveReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchReceiveReq) ProtoMessage() {}
func (x *DispatchReceiveReq) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[4]
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 DispatchReceiveReq.ProtoReflect.Descriptor instead.
func (*DispatchReceiveReq) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{4}
}
type DispatchReceiveResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DispatchReceiveResp) Reset() {
*x = DispatchReceiveResp{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchReceiveResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchReceiveResp) ProtoMessage() {}
func (x *DispatchReceiveResp) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[5]
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 DispatchReceiveResp.ProtoReflect.Descriptor instead.
func (*DispatchReceiveResp) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{5}
}
// 派遣
type DispatchDoReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"`
HeroId []string `protobuf:"bytes,2,rep,name=heroId,proto3" json:"heroId"`
}
func (x *DispatchDoReq) Reset() {
*x = DispatchDoReq{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchDoReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchDoReq) ProtoMessage() {}
func (x *DispatchDoReq) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[6]
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 DispatchDoReq.ProtoReflect.Descriptor instead.
func (*DispatchDoReq) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{6}
}
func (x *DispatchDoReq) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
func (x *DispatchDoReq) GetHeroId() []string {
if x != nil {
return x.HeroId
}
return nil
}
type DispatchDoResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DispatchDoResp) Reset() {
*x = DispatchDoResp{}
if protoimpl.UnsafeEnabled {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchDoResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchDoResp) ProtoMessage() {}
func (x *DispatchDoResp) ProtoReflect() protoreflect.Message {
mi := &file_dispatch_dispatch_msg_proto_msgTypes[7]
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 DispatchDoResp.ProtoReflect.Descriptor instead.
func (*DispatchDoResp) Descriptor() ([]byte, []int) {
return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{7}
}
var File_dispatch_dispatch_msg_proto protoreflect.FileDescriptor
var file_dispatch_dispatch_msg_proto_rawDesc = []byte{
0x0a, 0x1b, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61,
0x74, 0x63, 0x68, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x64,
0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68,
0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x69, 0x73,
0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3d,
0x0a, 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65,
0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x44, 0x69, 0x73, 0x70, 0x61,
0x74, 0x63, 0x68, 0x52, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x22, 0x14, 0x0a,
0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68,
0x52, 0x65, 0x71, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52,
0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x69,
0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71,
0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65,
0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x3f, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x61,
0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,
0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x69, 0x73, 0x70,
0x61, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_dispatch_dispatch_msg_proto_rawDescOnce sync.Once
file_dispatch_dispatch_msg_proto_rawDescData = file_dispatch_dispatch_msg_proto_rawDesc
)
func file_dispatch_dispatch_msg_proto_rawDescGZIP() []byte {
file_dispatch_dispatch_msg_proto_rawDescOnce.Do(func() {
file_dispatch_dispatch_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_dispatch_dispatch_msg_proto_rawDescData)
})
return file_dispatch_dispatch_msg_proto_rawDescData
}
var file_dispatch_dispatch_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_dispatch_dispatch_msg_proto_goTypes = []interface{}{
(*DispatchNoticeReq)(nil), // 0: DispatchNoticeReq
(*DispatchNoticeResp)(nil), // 1: DispatchNoticeResp
(*DispatchRefreshReq)(nil), // 2: DispatchRefreshReq
(*DispatchRefreshResp)(nil), // 3: DispatchRefreshResp
(*DispatchReceiveReq)(nil), // 4: DispatchReceiveReq
(*DispatchReceiveResp)(nil), // 5: DispatchReceiveResp
(*DispatchDoReq)(nil), // 6: DispatchDoReq
(*DispatchDoResp)(nil), // 7: DispatchDoResp
(*DBDispatch)(nil), // 8: DBDispatch
}
var file_dispatch_dispatch_msg_proto_depIdxs = []int32{
8, // 0: DispatchNoticeResp.dispatch:type_name -> DBDispatch
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_dispatch_dispatch_msg_proto_init() }
func file_dispatch_dispatch_msg_proto_init() {
if File_dispatch_dispatch_msg_proto != nil {
return
}
file_dispatch_dispatch_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_dispatch_dispatch_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchNoticeReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchNoticeResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchRefreshReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchRefreshResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchReceiveReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchReceiveResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchDoReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dispatch_dispatch_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchDoResp); 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_dispatch_dispatch_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_dispatch_dispatch_msg_proto_goTypes,
DependencyIndexes: file_dispatch_dispatch_msg_proto_depIdxs,
MessageInfos: file_dispatch_dispatch_msg_proto_msgTypes,
}.Build()
File_dispatch_dispatch_msg_proto = out.File
file_dispatch_dispatch_msg_proto_rawDesc = nil
file_dispatch_dispatch_msg_proto_goTypes = nil
file_dispatch_dispatch_msg_proto_depIdxs = nil
}

View File

@ -334,6 +334,8 @@ const (
ErrorCode_SmithyNoActivateAtlas ErrorCode = 4113 // 没有图鉴更新数据
ErrorCode_SmithyLvToolsFailed ErrorCode = 4114 //
ErrorCode_SmithyLvToolsPre ErrorCode = 4115 // 前置条件不足
// dispatch
ErrorCode_DispatchHeroNoReached ErrorCode = 4201 //英雄条件未达标
)
// Enum value maps for ErrorCode.
@ -618,6 +620,7 @@ var (
4113: "SmithyNoActivateAtlas",
4114: "SmithyLvToolsFailed",
4115: "SmithyLvToolsPre",
4201: "DispatchHeroNoReached",
}
ErrorCode_value = map[string]int32{
"Success": 0,
@ -899,6 +902,7 @@ var (
"SmithyNoActivateAtlas": 4113,
"SmithyLvToolsFailed": 4114,
"SmithyLvToolsPre": 4115,
"DispatchHeroNoReached": 4201,
}
)
@ -933,7 +937,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
var file_errorcode_proto_rawDesc = []byte{
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2a, 0xe3, 0x32, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x6f, 0x2a, 0xff, 0x32, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
@ -1339,8 +1343,10 @@ var file_errorcode_proto_rawDesc = []byte{
0x6c, 0x61, 0x73, 0x10, 0x91, 0x20, 0x12, 0x18, 0x0a, 0x13, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79,
0x4c, 0x76, 0x54, 0x6f, 0x6f, 0x6c, 0x73, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x92, 0x20,
0x12, 0x15, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x4c, 0x76, 0x54, 0x6f, 0x6f, 0x6c,
0x73, 0x50, 0x72, 0x65, 0x10, 0x93, 0x20, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x50, 0x72, 0x65, 0x10, 0x93, 0x20, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x69, 0x73, 0x70, 0x61,
0x74, 0x63, 0x68, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64,
0x10, 0xe9, 0x20, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (

View File

@ -29,12 +29,13 @@ type DBPracticePillar struct {
Index int32 `protobuf:"varint,1,opt,name=index,proto3" json:"index"` //柱子下标
Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"` //柱子等级
Isunlock bool `protobuf:"varint,3,opt,name=isunlock,proto3" json:"isunlock"` //是否解锁
Hero string `protobuf:"bytes,4,opt,name=hero,proto3" json:"hero"` //当前练功英雄
Teacher string `protobuf:"bytes,5,opt,name=teacher,proto3" json:"teacher"` //教习
Prop string `protobuf:"bytes,6,opt,name=prop,proto3" json:"prop"` //道具
Start int64 `protobuf:"varint,7,opt,name=start,proto3" json:"start"` //开始时间
End int64 `protobuf:"varint,8,opt,name=end,proto3" json:"end"` //结束时间
Expend int64 `protobuf:"varint,9,opt,name=expend,proto3" json:"expend"` //经验上限时间
Uid string `protobuf:"bytes,4,opt,name=uid,proto3" json:"uid"` //英雄uid
Hero string `protobuf:"bytes,5,opt,name=hero,proto3" json:"hero"` //当前练功英雄
Teacher string `protobuf:"bytes,6,opt,name=teacher,proto3" json:"teacher"` //教习
Prop string `protobuf:"bytes,7,opt,name=prop,proto3" json:"prop"` //道具
Start int64 `protobuf:"varint,8,opt,name=start,proto3" json:"start"` //开始时间
End int64 `protobuf:"varint,9,opt,name=end,proto3" json:"end"` //结束时间
Expend int64 `protobuf:"varint,10,opt,name=expend,proto3" json:"expend"` //经验上限时间
}
func (x *DBPracticePillar) Reset() {
@ -90,6 +91,13 @@ func (x *DBPracticePillar) GetIsunlock() bool {
return false
}
func (x *DBPracticePillar) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBPracticePillar) GetHero() string {
if x != nil {
return x.Hero
@ -296,49 +304,50 @@ var File_practice_practice_db_proto protoreflect.FileDescriptor
var file_practice_practice_db_proto_rawDesc = []byte{
0x0a, 0x1a, 0x70, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x72, 0x61, 0x63, 0x74,
0x69, 0x63, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x01, 0x0a,
0x69, 0x63, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x01, 0x0a,
0x10, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x50, 0x69, 0x6c, 0x6c, 0x61,
0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20,
0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x75, 0x6e, 0x6c,
0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x75, 0x6e, 0x6c,
0x6f, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x63, 0x68,
0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x65, 0x61, 0x63, 0x68, 0x65,
0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x70, 0x72, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x07,
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65,
0x6e, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x16, 0x0a,
0x06, 0x65, 0x78, 0x70, 0x65, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x65,
0x78, 0x70, 0x65, 0x6e, 0x64, 0x22, 0x4f, 0x0a, 0x11, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74,
0x69, 0x63, 0x65, 0x54, 0x65, 0x61, 0x63, 0x68, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07,
0x73, 0x74, 0x75, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
0x74, 0x75, 0x64, 0x65, 0x6e, 0x74, 0x22, 0xde, 0x02, 0x0a, 0x0e, 0x44, 0x42, 0x50, 0x72, 0x61,
0x63, 0x74, 0x69, 0x63, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 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, 0x39, 0x0a, 0x08, 0x6b,
0x6e, 0x61, 0x70, 0x73, 0x61, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e,
0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x2e, 0x4b,
0x6e, 0x61, 0x70, 0x73, 0x61, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6b, 0x6e,
0x61, 0x70, 0x73, 0x61, 0x63, 0x6b, 0x12, 0x2b, 0x0a, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72,
0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63,
0x74, 0x69, 0x63, 0x65, 0x50, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x52, 0x07, 0x70, 0x69, 0x6c, 0x6c,
0x61, 0x72, 0x31, 0x12, 0x2b, 0x0a, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x32, 0x18, 0x05,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63,
0x65, 0x50, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x52, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x32,
0x12, 0x2b, 0x0a, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x33, 0x18, 0x06, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x50, 0x69,
0x6c, 0x6c, 0x61, 0x72, 0x52, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x33, 0x12, 0x2b, 0x0a,
0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x66, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
0x2e, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x50, 0x69, 0x6c, 0x6c, 0x61,
0x72, 0x52, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x66, 0x1a, 0x3b, 0x0a, 0x0d, 0x4b, 0x6e,
0x61, 0x70, 0x73, 0x61, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x63, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x05, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x65, 0x61,
0x63, 0x68, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x65, 0x61, 0x63,
0x68, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74,
0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a,
0x03, 0x65, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12,
0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x65, 0x6e, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52,
0x06, 0x65, 0x78, 0x70, 0x65, 0x6e, 0x64, 0x22, 0x4f, 0x0a, 0x11, 0x44, 0x42, 0x50, 0x72, 0x61,
0x63, 0x74, 0x69, 0x63, 0x65, 0x54, 0x65, 0x61, 0x63, 0x68, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03,
0x63, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x18,
0x0a, 0x07, 0x73, 0x74, 0x75, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x73, 0x74, 0x75, 0x64, 0x65, 0x6e, 0x74, 0x22, 0xde, 0x02, 0x0a, 0x0e, 0x44, 0x42, 0x50,
0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 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, 0x39, 0x0a,
0x08, 0x6b, 0x6e, 0x61, 0x70, 0x73, 0x61, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x1d, 0x2e, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x52, 0x6f, 0x6f, 0x6d,
0x2e, 0x4b, 0x6e, 0x61, 0x70, 0x73, 0x61, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08,
0x6b, 0x6e, 0x61, 0x70, 0x73, 0x61, 0x63, 0x6b, 0x12, 0x2b, 0x0a, 0x07, 0x70, 0x69, 0x6c, 0x6c,
0x61, 0x72, 0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x50, 0x72,
0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x50, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x52, 0x07, 0x70, 0x69,
0x6c, 0x6c, 0x61, 0x72, 0x31, 0x12, 0x2b, 0x0a, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x32,
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74,
0x69, 0x63, 0x65, 0x50, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x52, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61,
0x72, 0x32, 0x12, 0x2b, 0x0a, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x33, 0x18, 0x06, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65,
0x50, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x52, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x33, 0x12,
0x2b, 0x0a, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x66, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x11, 0x2e, 0x44, 0x42, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x50, 0x69, 0x6c,
0x6c, 0x61, 0x72, 0x52, 0x07, 0x70, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x66, 0x1a, 0x3b, 0x0a, 0x0d,
0x4b, 0x6e, 0x61, 0x70, 0x73, 0x61, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameDispatchCond struct {
Key int32
Param int32
}
const TypeId_GameDispatchCond = -852261064
func (*GameDispatchCond) GetTypeId() int32 {
return -852261064
}
func (_v *GameDispatchCond)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["param"].(float64); !_ok_ { err = errors.New("param error"); return }; _v.Param = int32(_tempNum_) }
return
}
func DeserializeGameDispatchCond(_buf map[string]interface{}) (*GameDispatchCond, error) {
v := &GameDispatchCond{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -0,0 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
const (
GameDispatchCondType_Lv = 1
GameDispatchCondType_Star = 2
)

View File

@ -12,7 +12,7 @@ import "errors"
type GameDispatch_LvData struct {
Lv int32
Probability []float32
Probability []int32
Upgrade int32
}
@ -29,11 +29,11 @@ func (_v *GameDispatch_LvData)Deserialize(_buf map[string]interface{}) (err erro
var _ok_ bool
if _arr_, _ok_ = _buf["probability"].([]interface{}); !_ok_ { err = errors.New("probability error"); return }
_v.Probability = make([]float32, 0, len(_arr_))
_v.Probability = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ float32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = float32(_x_) }
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Probability = append(_v.Probability, _list_v_)
}
}

View File

@ -14,12 +14,12 @@ type GameDispatch_TaskData struct {
Id int32
Type int32
Taskname string
Taskcd float32
Tasktime float32
Taskcd int32
Tasktime int32
Tasktxt string
Taskneed int32
Taskreq []string
Taskreqex []string
Taskreq []*GameDispatchCond
Taskreqex []*GameDispatchCond
Reward []*Gameatn
Rewardex []*Gameatn
}
@ -34,8 +34,8 @@ func (_v *GameDispatch_TaskData)Deserialize(_buf map[string]interface{}) (err er
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["taskname"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Taskname error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Taskname, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskcd"].(float64); !_ok_ { err = errors.New("taskcd error"); return }; _v.Taskcd = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tasktime"].(float64); !_ok_ { err = errors.New("tasktime error"); return }; _v.Tasktime = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskcd"].(float64); !_ok_ { err = errors.New("taskcd error"); return }; _v.Taskcd = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tasktime"].(float64); !_ok_ { err = errors.New("tasktime error"); return }; _v.Tasktime = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["tasktxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Tasktxt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Tasktxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskneed"].(float64); !_ok_ { err = errors.New("taskneed error"); return }; _v.Taskneed = int32(_tempNum_) }
{
@ -43,11 +43,11 @@ func (_v *GameDispatch_TaskData)Deserialize(_buf map[string]interface{}) (err er
var _ok_ bool
if _arr_, _ok_ = _buf["taskreq"].([]interface{}); !_ok_ { err = errors.New("taskreq error"); return }
_v.Taskreq = make([]string, 0, len(_arr_))
_v.Taskreq = make([]*GameDispatchCond, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ string
{ if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } }
var _list_v_ *GameDispatchCond
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameDispatchCond(_x_); err != nil { return } }
_v.Taskreq = append(_v.Taskreq, _list_v_)
}
}
@ -57,11 +57,11 @@ func (_v *GameDispatch_TaskData)Deserialize(_buf map[string]interface{}) (err er
var _ok_ bool
if _arr_, _ok_ = _buf["taskreqex"].([]interface{}); !_ok_ { err = errors.New("taskreqex error"); return }
_v.Taskreqex = make([]string, 0, len(_arr_))
_v.Taskreqex = make([]*GameDispatchCond, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ string
{ if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } }
var _list_v_ *GameDispatchCond
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameDispatchCond(_x_); err != nil { return } }
_v.Taskreqex = append(_v.Taskreqex, _list_v_)
}
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type Gamedispatch struct {
N int32
G []*Gameatn
}
const TypeId_Gamedispatch = -1941607722
func (*Gamedispatch) GetTypeId() int32 {
return -1941607722
}
func (_v *Gamedispatch)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["n"].(float64); !_ok_ { err = errors.New("n error"); return }; _v.N = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["g"].([]interface{}); !_ok_ { err = errors.New("g error"); return }
_v.G = make([]*Gameatn, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gameatn
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
_v.G = append(_v.G, _list_v_)
}
}
return
}
func DeserializeGamedispatch(_buf map[string]interface{}) (*Gamedispatch, error) {
v := &Gamedispatch{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -36,7 +36,7 @@ func TestRandom(t *testing.T) {
func TestNumber(t *testing.T) {
for i := 0; i < 100; i++ {
fmt.Println(utils.RandomNumbers(0, 99, 10))
fmt.Println(utils.RandomNumbers(0, 4, 6))
}
}