上传武馆npc踢馆条件管理
This commit is contained in:
parent
03fd5d2018
commit
18a9c8ab66
@ -17,6 +17,7 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.PracticeInfoRe
|
||||
func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
err error
|
||||
open bool
|
||||
room *pb.DBPracticeRoom
|
||||
update map[string]interface{} = make(map[string]interface{})
|
||||
)
|
||||
@ -45,6 +46,29 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (e
|
||||
}
|
||||
}
|
||||
|
||||
if room.Npcstate == -1 { //未开启 检查是否开启
|
||||
if open, errdata = this.module.ModuleSys.CheckOpenCondCfgById(session.GetUserId(), "pavilion_kick"); errdata != nil {
|
||||
return
|
||||
}
|
||||
if open {
|
||||
if err = this.module.modelPandata.refreshnpc(room); err != nil {
|
||||
this.module.Errorln(err)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
Title: pb.ErrorCode_SystemError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
update["currnpc"] = room.Currnpc
|
||||
update["npcstate"] = room.Npcstate
|
||||
update["refresh"] = room.Refresh
|
||||
update["battlenum"] = room.Battlenum
|
||||
update["captain"] = room.Captain
|
||||
update["formation"] = room.Formation
|
||||
}
|
||||
}
|
||||
|
||||
if room.Npcstate == 3 { //CD中
|
||||
cd := int32(configure.Now().Sub(time.Unix(room.Refresh, 0)).Seconds())
|
||||
if cd >= this.module.ModuleTools.GetGlobalConf().PandamasChallengeCd {
|
||||
|
@ -52,13 +52,13 @@ func (this *modelPandata) queryUserMartialhall(uid string) (result *pb.DBPractic
|
||||
Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1},
|
||||
Pillarf: &pb.DBPracticePillar{Index: 4, Isunlock: 0, Lv: 1},
|
||||
Statuers: make([]*pb.DBPracticeStatuer, 0),
|
||||
Npcstate: 3,
|
||||
Npcstate: -1,
|
||||
Refresh: configure.Now().Unix(),
|
||||
}
|
||||
if err = this.refreshnpc(result); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
// if err = this.refreshnpc(result); err != nil {
|
||||
// this.module.Errorln(err)
|
||||
// return
|
||||
// }
|
||||
if err = this.Add(uid, result); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
|
@ -144,7 +144,7 @@ func (this *Practice) AddItems(session comm.IUserSession, items map[string]int32
|
||||
Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1},
|
||||
Pillarf: &pb.DBPracticePillar{Index: 4, Isunlock: 0, Lv: 1},
|
||||
Statuers: make([]*pb.DBPracticeStatuer, 0),
|
||||
Npcstate: 3,
|
||||
Npcstate: -1,
|
||||
Refresh: configure.Now().Unix(),
|
||||
}
|
||||
id = make([]string, 0)
|
||||
|
@ -303,7 +303,7 @@ type DBPracticeRoom struct {
|
||||
Pillarf *DBPracticePillar `protobuf:"bytes,11,opt,name=pillarf,proto3" json:"pillarf"` //好友柱子
|
||||
Statuers []*DBPracticeStatuer `protobuf:"bytes,12,rep,name=statuers,proto3" json:"statuers"` //武馆雕像
|
||||
Currnpc int32 `protobuf:"varint,13,opt,name=currnpc,proto3" json:"currnpc"` //当前npc
|
||||
Npcstate int32 `protobuf:"varint,14,opt,name=npcstate,proto3" json:"npcstate"` //npc状态 0 未挑战 1 挑战失败 2挑战成功 3 CD中
|
||||
Npcstate int32 `protobuf:"varint,14,opt,name=npcstate,proto3" json:"npcstate"` //npc状态 -1未开启 0 未挑战 1 挑战失败 2挑战成功 3 CD中
|
||||
Refresh int64 `protobuf:"varint,15,opt,name=refresh,proto3" json:"refresh"` //刷新时间
|
||||
Battlenum int32 `protobuf:"varint,16,opt,name=battlenum,proto3" json:"battlenum"` //战斗次数
|
||||
Captain int32 `protobuf:"varint,17,opt,name=captain,proto3" json:"captain"` //战斗征信队长位
|
||||
|
Loading…
Reference in New Issue
Block a user