Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
68687d5338
@ -48,8 +48,6 @@ type (
|
|||||||
//查询用户卡片数量
|
//查询用户卡片数量
|
||||||
QueryHeroAmount(uId string, heroCfgId string) (amount uint32)
|
QueryHeroAmount(uId string, heroCfgId string) (amount uint32)
|
||||||
|
|
||||||
//创建指定数量
|
|
||||||
CreateRepeatHero(session IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode)
|
|
||||||
// 批量创建英雄
|
// 批量创建英雄
|
||||||
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode)
|
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode)
|
||||||
// 获取英雄
|
// 获取英雄
|
||||||
@ -156,7 +154,7 @@ type (
|
|||||||
IReddot
|
IReddot
|
||||||
}
|
}
|
||||||
IMline interface {
|
IMline interface {
|
||||||
ModifyMlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode)
|
ModifyMlineDataByNanduID(session IUserSession, id int32) (code pb.ErrorCode)
|
||||||
/// 查询章节ID
|
/// 查询章节ID
|
||||||
GetUsermLineData(uid string, chapterType int32) (chapterId int32)
|
GetUsermLineData(uid string, chapterType int32) (chapterId int32)
|
||||||
///红点
|
///红点
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
9、bingo:season,10 赛季塔层数
|
9、bingo:season,10 赛季塔层数
|
||||||
10、bingo:viking // 解锁维京所有难度
|
10、bingo:viking // 解锁维京所有难度
|
||||||
11、bingo:hunting // 解锁狩猎所有难度
|
11、bingo:hunting // 解锁狩猎所有难度
|
||||||
12、bingo:mainline,1,101 // 难度 id
|
12、bingo:mainline,11001 // 难度 id
|
||||||
13、bingo:moon,1 // 触发月之秘境
|
13、bingo:moon,1 // 触发月之秘境
|
||||||
14、bingo:arena,100 // 设置竞技场用户积分
|
14、bingo:arena,100 // 设置竞技场用户积分
|
||||||
15、bingo:sociatyexp,100 // 设置工会经验
|
15、bingo:sociatyexp,100 // 设置工会经验
|
||||||
|
@ -194,8 +194,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
this.Debug("使用bingo命令:uid = %s ",
|
this.Debug("使用bingo命令:uid = %s ",
|
||||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||||
log.Field{Key: "0", Value: datas[0]})
|
log.Field{Key: "0", Value: datas[0]})
|
||||||
} else if len(datas) == 3 && (datas[0] == "mainline") {
|
} else if len(datas) == 2 && (datas[0] == "mainline") {
|
||||||
module1, err := this.service.GetModule(comm.ModuleMainline)
|
module1, err := this.service.GetModule(comm.ModuleMline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -204,12 +204,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
code = pb.ErrorCode_ReqParameterError
|
code = pb.ErrorCode_ReqParameterError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
num2, err := strconv.Atoi(datas[2])
|
|
||||||
if err != nil {
|
code = module1.(comm.IMline).ModifyMlineDataByNanduID(session, int32(num1))
|
||||||
code = pb.ErrorCode_ReqParameterError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
code = module1.(comm.IMainline).ModifyMainlineDataByNanduID(session.GetUserId(), int32(num1), int32(num2))
|
|
||||||
|
|
||||||
this.Debug("使用bingo命令",
|
this.Debug("使用bingo命令",
|
||||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||||
|
@ -276,12 +276,33 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
update["totalcount"] = heroRecord.Totalcount
|
update["totalcount"] = heroRecord.Totalcount
|
||||||
update["daycount"] = heroRecord.Daycount
|
update["daycount"] = heroRecord.Daycount
|
||||||
this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update)
|
this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update)
|
||||||
|
szNewCards := make([]*cfg.Gameatn, 0)
|
||||||
for _, heroId := range szCards {
|
for _, heroId := range szCards {
|
||||||
|
bFind := false
|
||||||
_mapAddHero[heroId]++
|
_mapAddHero[heroId]++
|
||||||
|
for _, v := range szNewCards {
|
||||||
|
if v.T == heroId {
|
||||||
|
v.N++
|
||||||
|
bFind = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
_, code = this.module.CreateRepeatHeros(session, _mapAddHero, true)
|
}
|
||||||
|
if !bFind {
|
||||||
|
res := &cfg.Gameatn{
|
||||||
|
A: "hero",
|
||||||
|
T: heroId,
|
||||||
|
N: 1,
|
||||||
|
}
|
||||||
|
szNewCards = append(szNewCards, res)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获得新卡
|
||||||
|
|
||||||
|
if code = this.module.DispenseRes(session, szNewCards, true); code != pb.ErrorCode_Success {
|
||||||
|
|
||||||
|
this.module.Errorf("err:%v,create heros:%v,uid,%s", code, szNewCards, session.GetUserId())
|
||||||
|
code = pb.ErrorCode_HeroCreate // 创建新英雄失败
|
||||||
|
}
|
||||||
///英雄招募 【玩家名称】在招募中获得了【英雄名称】!
|
///英雄招募 【玩家名称】在招募中获得了【英雄名称】!
|
||||||
this.module.SendChatMsg(session, _mapAddHero, szCards)
|
this.module.SendChatMsg(session, _mapAddHero, szCards)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package hero
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
@ -74,12 +75,14 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获得新卡
|
// 获得新卡
|
||||||
var new map[string]int32
|
res := &cfg.Gameatn{
|
||||||
new = make(map[string]int32)
|
A: "hero",
|
||||||
new[conf.Hero] = 1
|
T: conf.Hero,
|
||||||
if _, err := this.module.CreateRepeatHeros(session, new, false); err != pb.ErrorCode_Success {
|
N: 1,
|
||||||
|
}
|
||||||
|
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, false); code != pb.ErrorCode_Success {
|
||||||
|
|
||||||
this.module.Errorf("err:%v,create hero:%s,uid,%ss", err, conf.Hero, session.GetUserId())
|
this.module.Errorf("err:%v,create hero:%s,uid,%ss", code, conf.Hero, session.GetUserId())
|
||||||
code = pb.ErrorCode_HeroCreate // 创建新英雄失败
|
code = pb.ErrorCode_HeroCreate // 创建新英雄失败
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
|
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
|
||||||
|
@ -76,7 +76,7 @@ func (this *Hero) Start() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建单个叠加英雄
|
//创建单个叠加英雄
|
||||||
func (this *Hero) CreateRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode) {
|
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode) {
|
||||||
var err error
|
var err error
|
||||||
hero, err = this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num)
|
hero, err = this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -272,7 +272,7 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]
|
|||||||
if num == 0 { // 数量为0 不做处理
|
if num == 0 { // 数量为0 不做处理
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if hero, code = this.CreateRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success {
|
if hero, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success {
|
||||||
this.Errorf("create hero %s failed", heroCfgId)
|
this.Errorf("create hero %s failed", heroCfgId)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -42,16 +42,16 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if curChapter == nil { // 校验是不是新的数据
|
if curChapter == nil { // 校验是不是新的数据
|
||||||
preStage := this.module.configure.GetPreMainChapter(req.StageId) // 新章节数据校验
|
//preStage := this.module.configure.GetMainStageConf(stageConf.Previoustage) // 新章节数据校验
|
||||||
preStageConf := this.module.configure.GetMainStageConf(preStage)
|
preStageConf := this.module.configure.GetMainStageConf(stageConf.Previoustage)
|
||||||
if stageConf == nil { // 配置文件校验
|
if preStageConf == nil { // 配置文件校验
|
||||||
code = pb.ErrorCode_MainlineNotFindChapter
|
code = pb.ErrorCode_MainlineNotFindChapter
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range list {
|
for _, v := range list {
|
||||||
if preStageConf.CaptainId == v.ChapterId { // 有上一章节数据
|
if preStageConf.Chapterid == v.ChapterId { // 有上一章节数据
|
||||||
if _, ok := v.Star[v.StageId]; ok {
|
if _, ok := v.Star[preStageConf.Id]; ok {
|
||||||
newData := &pb.DBMline{
|
newData := &pb.DBMline{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: session.GetUserId(),
|
Uid: session.GetUserId(),
|
||||||
@ -62,22 +62,22 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
|||||||
Award: map[int32]bool{},
|
Award: map[int32]bool{},
|
||||||
Ps: map[int32]int32{},
|
Ps: map[int32]int32{},
|
||||||
}
|
}
|
||||||
|
curChapter = newData
|
||||||
this.module.modelMline.addNewChapter(session.GetUserId(), newData)
|
this.module.modelMline.addNewChapter(session.GetUserId(), newData)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if curChapter == nil {
|
||||||
code = pb.ErrorCode_MainlineNotFindChapter
|
code = pb.ErrorCode_MainlineNotFindChapter
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if v1, ok := curChapter.Ps[req.StageId]; ok && v1 == 0 {
|
||||||
|
|
||||||
if v, ok := curChapter.Ps[req.StageId]; ok && v > 0 {
|
|
||||||
if v != 0 { // 扣1点
|
|
||||||
if code = this.module.ConsumeRes(session, stageConf.PsMg, true); code != pb.ErrorCode_Success { // 扣1点
|
if code = this.module.ConsumeRes(session, stageConf.PsMg, true); code != pb.ErrorCode_Success { // 扣1点
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for _, v := range stageConf.PsConsume {
|
for _, v := range stageConf.PsConsume {
|
||||||
if v.A == "attr" && v.T == "ps" {
|
if v.A == "attr" && v.T == "ps" {
|
||||||
|
@ -140,24 +140,3 @@ func (this *configureComp) GetAllStageByChapterID(chapterID int32) (stage []int3
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// gm 专用
|
|
||||||
func (this *configureComp) GetGMChapter(chapterID, itype int32) (d map[int32][]int32) {
|
|
||||||
// var d map[int32][]int32
|
|
||||||
d = make(map[int32][]int32, 0)
|
|
||||||
if v, err := this.GetConfigure(game_mainstage); err == nil {
|
|
||||||
if configure, ok := v.(*cfg.GameMainStage); ok {
|
|
||||||
for _, v1 := range configure.GetDataList() {
|
|
||||||
if v1.Episodetype == itype && v1.Id <= chapterID {
|
|
||||||
//chapter = append(chapter, v1.Id)
|
|
||||||
stage := this.GetAllStageByChapterID(v1.Id)
|
|
||||||
if len(stage) > 0 {
|
|
||||||
d[v1.Id] = stage
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
@ -90,37 +90,44 @@ func (this *Mline) CheckPoint(uid string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 参数 难度 + 章节id
|
// 参数 难度 + 章节id
|
||||||
func (this *Mline) ModifyMlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode) {
|
func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) (code pb.ErrorCode) {
|
||||||
var del []string
|
var del []string
|
||||||
list, err := this.modelMline.getMainlineList(uid)
|
list, err := this.modelMline.getMainlineList(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, v := range list {
|
for _, v := range list {
|
||||||
if v.CType == nandu {
|
|
||||||
del = append(del, v.Id)
|
del = append(del, v.Id)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// 清除
|
// 清除
|
||||||
this.modelMline.cleanChapterDataById(uid, del...)
|
this.modelMline.cleanChapterDataById(session.GetUserId(), del...)
|
||||||
d := this.configure.GetGMChapter(id, nandu)
|
|
||||||
for k, v := range d {
|
connf := this.configure.GetMainStageConf(id)
|
||||||
|
if connf == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_data := this.configure.GetAllChapterID()
|
||||||
|
for _, v := range _data {
|
||||||
|
if v <= connf.Chapterid {
|
||||||
newData := &pb.DBMline{
|
newData := &pb.DBMline{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: uid,
|
Uid: session.GetUserId(),
|
||||||
CType: nandu,
|
CType: connf.Episodetype,
|
||||||
ChapterId: k,
|
ChapterId: v,
|
||||||
StageId: 0,
|
StageId: id,
|
||||||
Star: map[int32]int32{},
|
Star: map[int32]int32{},
|
||||||
Award: map[int32]bool{},
|
Award: map[int32]bool{},
|
||||||
Ps: map[int32]int32{},
|
Ps: map[int32]int32{},
|
||||||
}
|
}
|
||||||
for _, v1 := range v {
|
stageConf := this.configure.GetAllStageByChapterID(v)
|
||||||
newData.Star[v1] = 3 // gm 全给3星
|
for _, v := range stageConf {
|
||||||
|
newData.Star[v] = 3
|
||||||
}
|
}
|
||||||
this.modelMline.addNewChapter(uid, newData)
|
this.modelMline.addNewChapter(session.GetUserId(), newData)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (this *Mline) GetUsermLineData(uid string, chapterType int32) (chapterId int32) {
|
func (this *Mline) GetUsermLineData(uid string, chapterType int32) (chapterId int32) {
|
||||||
|
Loading…
Reference in New Issue
Block a user