Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
e68bbbe2d8
@ -97,7 +97,7 @@ type (
|
||||
}
|
||||
IMainline interface {
|
||||
// 修改章节信息
|
||||
ModifyMainlineData(uid string, objId string, data interface{}) (code pb.ErrorCode)
|
||||
ModifyMainlineData(uid string, id int32) (code pb.ErrorCode)
|
||||
/// 查询章节ID
|
||||
GetUsermainLineData(uid string) (mainlineId int32)
|
||||
}
|
||||
@ -160,4 +160,8 @@ type (
|
||||
IGm interface {
|
||||
CreateCmd(session IUserSession, cmd string) (code pb.ErrorCode)
|
||||
}
|
||||
// 修改爬塔
|
||||
IPagoda interface {
|
||||
ModifyPagodaFloor(session IUserSession, level int32) (code pb.ErrorCode)
|
||||
}
|
||||
)
|
||||
|
@ -13,6 +13,11 @@ import (
|
||||
/* GM 在控制台输入的字符串类型
|
||||
//bingo:item,10001,1
|
||||
//bingo:attr,gold,1000000
|
||||
2、修改主线关卡进度:bingo:mapid,102(102代表关卡位置)
|
||||
|
||||
3、修改心魔塔进度:bingo:pataid,10(10代表层数)
|
||||
|
||||
4、修改玩家经验值:bingo:exp,1000(1000代表新增的经验值 //
|
||||
*/
|
||||
//参数校验
|
||||
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {
|
||||
@ -31,7 +36,8 @@ func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (code pb.E
|
||||
if len(keys) == 2 {
|
||||
if keys[0] == "bingo" {
|
||||
datas := strings.Split(keys[1], ",")
|
||||
if len(datas) == 3 {
|
||||
if len(datas) == 3 && (datas[0] == comm.AttrType || datas[0] == comm.ItemType ||
|
||||
datas[0] == comm.HeroType || datas[0] == comm.EquipmentType) {
|
||||
num, err := strconv.Atoi(datas[2])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
@ -48,6 +54,28 @@ func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (code pb.E
|
||||
session.SendMsg(string(this.module.GetType()), "cmd", &pb.GMCmdResp{IsSucc: true})
|
||||
return
|
||||
}
|
||||
} else if len(datas) == 2 && (datas[0] == "mapid") {
|
||||
module1, err := this.service.GetModule(comm.ModuleMainline)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
num, err := strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
code = module1.(comm.IMainline).ModifyMainlineData(session.GetUserId(), int32(num))
|
||||
} else if len(datas) == 2 && (datas[0] == "pataid") {
|
||||
module1, err := this.service.GetModule(comm.ModulePagoda)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
num, err := strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
code = module1.(comm.IPagoda).ModifyPagodaFloor(session, int32(num))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
||||
|
||||
_data := this.module.configure.GetHeroLv(curLv)
|
||||
if _data != nil {
|
||||
if maxLv == _hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级
|
||||
if maxLv == curLv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级
|
||||
code = pb.ErrorCode_HeroMaxLv
|
||||
return
|
||||
}
|
||||
@ -123,7 +123,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
||||
if len(_data.Heroexp) == 0 {
|
||||
break
|
||||
}
|
||||
if maxLv <= _hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级
|
||||
if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级
|
||||
// 超过的经验值
|
||||
leftExp := curExp - _data.Heroexp[0].N
|
||||
this.module.Debugf("经验溢出%d", leftExp)
|
||||
|
@ -490,7 +490,7 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe
|
||||
maxLv = hero.Star * comm.HeroStarLvRatio
|
||||
_data := this.moduleHero.configure.GetHeroLv(curLv)
|
||||
if _data != nil {
|
||||
if maxLv <= hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级
|
||||
if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级
|
||||
code = pb.ErrorCode_HeroMaxLv
|
||||
return
|
||||
}
|
||||
@ -499,7 +499,7 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe
|
||||
if len(_data.Heroexp) == 0 {
|
||||
break
|
||||
}
|
||||
if maxLv <= hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级
|
||||
if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级
|
||||
curLv = maxLv
|
||||
curExp = _data.Heroexp[0].N
|
||||
break
|
||||
|
@ -6,6 +6,8 @@ import (
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"sort"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type Mainline struct {
|
||||
@ -39,11 +41,38 @@ func (this *Mainline) OnInstallComp() {
|
||||
}
|
||||
|
||||
// 接口信息 给其他模块调用 用来修改主线关卡信息
|
||||
func (this *Mainline) ModifyMainlineData(uid string, objId string, data map[string]interface{}) (code pb.ErrorCode) {
|
||||
err := this.modelMainline.modifyMainlineData(uid, objId, data)
|
||||
func (this *Mainline) ModifyMainlineData(uid string, id int32) (code pb.ErrorCode) {
|
||||
|
||||
conf := this.configure.GetMainlineConfigData(id, 1)
|
||||
list, err := this.modelMainline.getMainlineList(uid)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
for _, v := range list {
|
||||
if v.ChapterId == conf.Chapter {
|
||||
data := make(map[string]interface{}, 0)
|
||||
data["mainlineId"] = id
|
||||
data["chapterId"] = v.ChapterId
|
||||
this.modelMainline.modifyMainlineData(uid, v.Id, data)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
//add
|
||||
_data := &pb.DBMainline{}
|
||||
_data.Id = primitive.NewObjectID().Hex()
|
||||
_data.ChapterId = conf.Chapter
|
||||
_data.MainlineId = conf.Id
|
||||
_mData := make(map[string]interface{}, 0)
|
||||
_data.Uid = uid
|
||||
_data.Intensity = 1 // 难度1
|
||||
_mData[_data.Id] = _data
|
||||
|
||||
this.modelMainline.addNewChapter(uid, _mData)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -68,3 +68,17 @@ func (this *Pagoda) Start() (err error) {
|
||||
this.battle = module.(comm.IBattle)
|
||||
return
|
||||
}
|
||||
|
||||
// 给gm 调用修改爬塔层数
|
||||
func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, level int32) (code pb.ErrorCode) {
|
||||
list, _ := this.modelPagoda.getPagodaList(session.GetUserId())
|
||||
if list != nil {
|
||||
|
||||
list.PagodaId = level
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["pagodaId"] = level
|
||||
code = this.ModifyPagodaData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -139,8 +139,8 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
mail := &pb.DBMailData{
|
||||
ObjId: primitive.NewObjectID().Hex(),
|
||||
Uid: user.Uid,
|
||||
Title: "系统邮件",
|
||||
Contex: "恭喜获得登录专属礼包一份",
|
||||
Title: "system mail",
|
||||
Contex: "Congratulations on getting a login exclusive gift pack",
|
||||
CreateTime: uint64(time.Now().Unix()),
|
||||
DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件
|
||||
Check: false,
|
||||
|
Loading…
Reference in New Issue
Block a user