Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
4801227b2a
@ -125,6 +125,7 @@ type (
|
||||
CheckTujianHero(session IUserSession, heros []string) []bool
|
||||
// bingo设置玩家等级
|
||||
BingoSetUserLv(session IUserSession, lv int32) error
|
||||
BingoSetUserVipLv(session IUserSession, lv int32) error
|
||||
}
|
||||
//武器模块
|
||||
IEquipment interface {
|
||||
|
@ -332,3 +332,14 @@ func (this *MCompConfigure) GetVipConfigureData(lv int32) (item *cfg.GameVipData
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *MCompConfigure) GetItemConfigureByType(useType int32) (item []*cfg.GameItemData) {
|
||||
if v, err := this.GetConfigure(game_item); err == nil {
|
||||
for _, v1 := range v.(*cfg.GameItem).GetDataMap() {
|
||||
if v1.Usetype == useType {
|
||||
item = append(item, v1)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ import (
|
||||
20、bingo:cleanitem
|
||||
21、bingo:allequip
|
||||
21、bingo:chat,1
|
||||
22、bingo:itemtype,1,1 // 获取某种类型所有道具(道具类型,数量)
|
||||
18、bingo:viplv,50
|
||||
*/
|
||||
//参数校验
|
||||
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {
|
||||
|
@ -425,6 +425,50 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
)
|
||||
} else if len(datas) == 3 && (datas[0] == "itemtype") {
|
||||
num1, err := strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
num2, err := strconv.Atoi(datas[2])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
_data := this.configure.GetItemConfigureByType(int32(num1))
|
||||
for _, v := range _data {
|
||||
res := &cfg.Gameatn{
|
||||
A: "item",
|
||||
T: v.Id,
|
||||
N: int32(num2),
|
||||
}
|
||||
this.DispenseRes(session, []*cfg.Gameatn{res}, true)
|
||||
}
|
||||
this.Debug("使用bingo命令:uid = %s ",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
log.Field{Key: "1", Value: datas[1]},
|
||||
log.Field{Key: "2", Value: datas[2]},
|
||||
)
|
||||
} else if len(datas) == 2 && (datas[0] == "viplv") { // 玩家等级
|
||||
module1, err := this.service.GetModule(comm.ModuleUser)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
num, err := strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
if err = module1.(comm.IUser).BingoSetUserVipLv(session, int32(num)); err == nil {
|
||||
code = pb.ErrorCode_Success
|
||||
}
|
||||
this.Debug("使用bingo命令:uid = %s ",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
log.Field{Key: "N", Value: int32(num)},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -655,3 +655,24 @@ func (this *User) RecoverUserVit() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *User) BingoSetUserVipLv(session comm.IUserSession, lv int32) error {
|
||||
if lv <= 0 {
|
||||
return comm.NewCustomError(pb.ErrorCode_ReqParameterError)
|
||||
}
|
||||
update := map[string]interface{}{
|
||||
"vip": lv,
|
||||
"vipexp": 0,
|
||||
}
|
||||
if err := this.modelUser.Change(session.GetUserId(), update); err == nil {
|
||||
if err := session.SendMsg(string(this.GetType()), UserSubTypeLvChangedPush,
|
||||
&pb.UserVipChangedPush{Uid: session.GetUserId(), VipExp: 0, VipLv: lv}); err != nil {
|
||||
this.Error("Bingo玩家等级变化 UserVipChangedPush推送失败",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "vipexp", Value: 0},
|
||||
log.Field{Key: "viplv", Value: lv},
|
||||
)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user