Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
eb2034d8ae
@ -100,6 +100,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (errdat
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "MoonfantasyBuyReq", []*cfg.Gameatn{{A: ticketitem.A, T: ticketitem.T, N: req.BuyNum}})
|
||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "MoonfantasyBuyReq", need) // 消耗资源
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -54,6 +54,9 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
|
||||
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.ModuleTools.GetGlobalConf().ArenaTicketCos}, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "ArenaChallengeReq", this.module.ModuleTools.GetGlobalConf().ArenaTicketCos) // 消耗资源
|
||||
})
|
||||
if red.Attack != nil {
|
||||
for i, v := range req.Battle.Format {
|
||||
if red.Attack.Formt[i].Id != v {
|
||||
@ -164,5 +167,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
|
||||
Buleflist: record.Buleflist,
|
||||
Tasks: record.Tasks,
|
||||
}})
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -44,18 +44,10 @@ func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (errd
|
||||
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.ModuleTools.GetGlobalConf().ArenaTicketCos}, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "ArenaPlotReq", this.module.ModuleTools.GetGlobalConf().ArenaTicketCos) // 消耗资源
|
||||
})
|
||||
|
||||
// if info.Npc[req.Pid] != nil {
|
||||
// ndata := info.Npc[req.Pid]
|
||||
// if !configure.Now().After(time.Unix(ndata.Cd, 0)) { //已经过了cd时间
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ArenaTicketNpcInCd,
|
||||
// Title: pb.ErrorCode_ArenaTicketNpcInCd.ToString(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// index = ndata.Index
|
||||
// }
|
||||
if errdata, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: npc.BattleReadyID,
|
||||
Ptype: pb.PlayType_arena,
|
||||
|
@ -133,6 +133,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "CaravanGotoCityReq", res) // 消耗资源
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -338,6 +338,9 @@ func (this *Caravan) CheckCaravanTask(session comm.IUserSession, data *pb.DBCara
|
||||
N: -list.Unreword[1], // 扣除虚拟币
|
||||
O: "",
|
||||
})
|
||||
go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.WriteUserLog(session.GetUserId(), comm.GMResDelType, "CheckCaravanTask", resp.Reward) // 消耗资源
|
||||
})
|
||||
}
|
||||
session.SendMsg(string(this.GetType()), "taskcomplete", resp)
|
||||
}
|
||||
|
@ -29,11 +29,28 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (errda
|
||||
msg *pb.DBChat
|
||||
userexpand *pb.DBUserExpand
|
||||
max_chat int32
|
||||
user *pb.DBUser
|
||||
)
|
||||
if errdata = this.SendCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 禁言校验
|
||||
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_UserNofound,
|
||||
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if user.Prohibition > 0 { // 封号不能发言
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_UserAccountProhibition,
|
||||
Title: pb.ErrorCode_UserAccountProhibition.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
msg = &pb.DBChat{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Channel: req.Channel,
|
||||
|
@ -521,6 +521,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
||||
if this.curPower == this.player2.Userinfo.Uid {
|
||||
this.AiOperator()
|
||||
}
|
||||
|
||||
} else {
|
||||
if this.rd1 && this.rd2 { // 两个玩家都准备好了 那么就开始游戏
|
||||
this.rd1 = false
|
||||
@ -585,9 +586,8 @@ func (this *Room) GameOver() (errdata *pb.ErrorData) {
|
||||
if errdata, atno = this.module.DispenseAtno(this.szSession[winindex], res, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
go this.module.AsynHandleSession(this.szSession[winindex], func(session comm.IUserSession) {
|
||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "xxlGame", atno)
|
||||
})
|
||||
go this.module.WriteUserLog(winner.Userinfo.Uid, comm.GMResAddType, "xxlGameReward", atno)
|
||||
|
||||
this.szSession[winindex].Push()
|
||||
}
|
||||
}
|
||||
@ -634,7 +634,6 @@ func (this *Room) GameOver() (errdata *pb.ErrorData) {
|
||||
|
||||
// 修改房间状态
|
||||
this.Status = 2
|
||||
this.module.Debugf("=====三消 gameover")
|
||||
this.module.SendMsgSyncToSession(string(this.module.GetType()), "gameover", &pb.EntertainGameOverPush{
|
||||
User1: this.player1,
|
||||
User2: this.player2,
|
||||
@ -728,3 +727,79 @@ func (this *Room) ModifyUserRoomInfoData() {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 自动操作
|
||||
func (this *Room) AutoOperator(p *pb.PlayerData) {
|
||||
var (
|
||||
curScore int32
|
||||
szMap []*pb.MapData
|
||||
bAddPs bool
|
||||
oid1 int32
|
||||
oid2 int32
|
||||
)
|
||||
|
||||
// 交换元素
|
||||
szMap, oid1, oid2, bAddPs = this.chessboard.AiSwapGirde()
|
||||
p.Ps--
|
||||
if p.Ps <= 0 { // 权限给下一个人
|
||||
if p == this.player2 {
|
||||
this.NexPower = this.player1.Userinfo.Uid
|
||||
this.player1.Ps = MaxPs
|
||||
} else {
|
||||
this.NexPower = this.player2.Userinfo.Uid
|
||||
this.player2.Ps = MaxPs
|
||||
}
|
||||
|
||||
this.round++
|
||||
}
|
||||
if bAddPs {
|
||||
p.Ps++
|
||||
if p.Ps > MaxPs {
|
||||
p.Ps = MaxPs
|
||||
}
|
||||
}
|
||||
// 校验下次是不是消除
|
||||
if !this.chessboard.CheckAndRefreshPlat() {
|
||||
this.chessboard.RedsetPlatData()
|
||||
szMap = append(szMap, &pb.MapData{
|
||||
Data: this.chessboard.GetPalatData(),
|
||||
ChangeType: 1,
|
||||
})
|
||||
}
|
||||
for _, v := range szMap {
|
||||
curScore += v.CurSocre
|
||||
p.Score += v.CurSocre
|
||||
v.CurSocre = p.Score
|
||||
p.Energy += v.CurEnergy
|
||||
v.CurEnergy = p.Energy
|
||||
}
|
||||
|
||||
// 广播消息
|
||||
if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{
|
||||
Mpadata: szMap,
|
||||
Power: this.NexPower,
|
||||
Curpower: this.curPower,
|
||||
Score: curScore,
|
||||
Round: this.round,
|
||||
User1: this.player1,
|
||||
User2: this.player2,
|
||||
Itype: 0,
|
||||
Curid: oid1,
|
||||
Targetid: oid2,
|
||||
}, this.szSession...); err != nil {
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
|
||||
if this.round > this.MaxRound { // 游戏结束
|
||||
if this.player1.Score == this.player2.Score {
|
||||
this.MaxRound += 1 // 增加一回合
|
||||
} else {
|
||||
this.GameOver()
|
||||
}
|
||||
return
|
||||
}
|
||||
this.curPower = this.NexPower
|
||||
if this.RoomType == 2 && this.curPower == this.player2.Userinfo.Uid {
|
||||
this.AutoOperator(this.player2)
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,6 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype122, _hero.JuexingLv, _hero.Star))
|
||||
cfg, err := this.module.configure.GetHeroConfig(_hero.HeroID)
|
||||
if err == nil {
|
||||
|
||||
// 校验共鸣满级
|
||||
var _l int32
|
||||
talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId())
|
||||
|
@ -1,99 +0,0 @@
|
||||
package hero
|
||||
|
||||
// //参数校验
|
||||
// func (this *apiComp) FusionCheck(session comm.IUserSession, req *pb.HeroFusionReq) (errdata *pb.ErrorData) {
|
||||
// if req.HeroId == "" {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ReqParameterError,
|
||||
// Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
// }
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
// func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (errdata *pb.ErrorData) {
|
||||
// var (
|
||||
// totalCount int32
|
||||
// mapHero map[string]int32
|
||||
// _costMaphero map[string]*pb.DBHero
|
||||
// ChangeList []*pb.DBHero // 变化的英雄数据
|
||||
// )
|
||||
// ChangeList = make([]*pb.DBHero, 0)
|
||||
// _costMaphero = make(map[string]*pb.DBHero, 0)
|
||||
// mapHero = make(map[string]int32)
|
||||
// if errdata = this.FusionCheck(session, req); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
// conf, err := this.module.configure.GetHeroFucionConfig(req.HeroId)
|
||||
// if err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ConfigNoFound, // 配置没找到
|
||||
// Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// for _, v := range req.Heros {
|
||||
// totalCount += v
|
||||
// }
|
||||
// if totalCount != int32(len(conf.Pointhero)) { // 校验数量
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ReqParameterError,
|
||||
// Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// for k, v := range req.Heros {
|
||||
// // 校验英雄是否存在
|
||||
// _obj, c := this.module.GetHeroByObjID(session.GetUserId(), k)
|
||||
// if c != nil {
|
||||
// errdata = c
|
||||
// return
|
||||
// }
|
||||
// mapHero[_obj.HeroID] += v
|
||||
// _costMaphero[k] = _obj
|
||||
// }
|
||||
// for _, v := range conf.Pointhero {
|
||||
// if _, ok := mapHero[v]; ok {
|
||||
// mapHero[v] -= 1
|
||||
// } else {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ReqParameterError,
|
||||
// Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// for _, v := range mapHero {
|
||||
// if v != 0 {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ReqParameterError,
|
||||
// Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// for k, _ := range req.Heros {
|
||||
// //mapHero[_costMaphero[k].HeroID]
|
||||
// if errdata = this.module.DelCard(session.GetUserId(), _costMaphero[k]); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
// ChangeList = append(ChangeList, _costMaphero[k])
|
||||
// }
|
||||
|
||||
// // 获得新卡
|
||||
// res := &cfg.Gameatn{
|
||||
// A: "hero",
|
||||
// T: conf.Hero,
|
||||
// N: 1,
|
||||
// }
|
||||
// if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{res}, false); errdata != nil {
|
||||
// this.module.Errorf("err:%v,create hero:%s,uid,%ss", errdata, conf.Hero, session.GetUserId())
|
||||
// return
|
||||
// }
|
||||
// session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
|
||||
// // 通过融合获得指定英雄
|
||||
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype139, utils.ToInt32(conf.Hero))
|
||||
// go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype139, utils.ToInt32(conf.Hero)))
|
||||
// return
|
||||
// }
|
@ -13,9 +13,7 @@ func (this *apiComp) LockCheck(session comm.IUserSession, req *pb.HeroLockReq) (
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -31,12 +29,10 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.HeroLockReq) (errda
|
||||
return
|
||||
}
|
||||
_hero.Block = !_hero.Block // 修改是否锁定状态
|
||||
_heroMap := map[string]interface{}{
|
||||
"block": _hero.Block,
|
||||
}
|
||||
// 保存数据
|
||||
err := this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap)
|
||||
if err != nil {
|
||||
if err := this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, map[string]interface{}{
|
||||
"block": _hero.Block,
|
||||
}); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
|
@ -1393,17 +1393,16 @@ func (this *User) AddTitle(session comm.IUserSession, titles map[string]int32, b
|
||||
|
||||
return
|
||||
}
|
||||
func (this *User) Rpc_AccountBan(ctx context.Context, req *pb.RPCRTaskReq, reply *pb.UserDataListResp) error {
|
||||
func (this *User) Rpc_AccountBan(ctx context.Context, req *pb.RPCAccountBan, reply *pb.UserDataListResp) error {
|
||||
var (
|
||||
err error
|
||||
// user *pb.User
|
||||
)
|
||||
if _, err = this.GetUser(req.Uid); err != nil {
|
||||
return err
|
||||
}
|
||||
if req.TaskType == 0 { // 封号
|
||||
if req.Key == 0 { // 封号
|
||||
bBan := false
|
||||
if req.Param[0] > 0 {
|
||||
if req.Value > 0 {
|
||||
bBan = true
|
||||
}
|
||||
update := map[string]interface{}{
|
||||
@ -1413,9 +1412,9 @@ func (this *User) Rpc_AccountBan(ctx context.Context, req *pb.RPCRTaskReq, reply
|
||||
if err := this.modelUser.Change(req.Uid, update); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if req.TaskType == 1 { // 禁言
|
||||
} else if req.Key == 1 { // 禁言
|
||||
update := map[string]interface{}{
|
||||
"prohibition": req.Param[0],
|
||||
"prohibition": req.Value,
|
||||
}
|
||||
if err := this.modelUser.Change(req.Uid, update); err != nil {
|
||||
return err
|
||||
|
@ -15,7 +15,7 @@ type AccountBanReq struct {
|
||||
iValue int32 // 类型对应的值
|
||||
}
|
||||
|
||||
//创建邮件
|
||||
//禁封消息
|
||||
func (this *Api_Comp) AccountBanNotify(c *engine.Context) {
|
||||
|
||||
req := &AccountBanReq{}
|
||||
@ -30,10 +30,10 @@ func (this *Api_Comp) AccountBanNotify(c *engine.Context) {
|
||||
c.JSON(http.StatusOK, &Respond{Code: errdata.Code, Message: errdata.Message, Data: data})
|
||||
}()
|
||||
|
||||
rpcMsg := &pb.RPCRTaskReq{
|
||||
rpcMsg := &pb.RPCAccountBan{
|
||||
Uid: req.Uid,
|
||||
TaskType: req.iType,
|
||||
Param: []int32{req.iValue},
|
||||
Key: req.iType,
|
||||
Value: req.iValue,
|
||||
}
|
||||
if _, err = this.module.service.RpcGo(
|
||||
context.Background(),
|
||||
|
Loading…
Reference in New Issue
Block a user