预扣体力

This commit is contained in:
meixiongfeng 2022-12-31 11:48:36 +08:00
parent a9964388cf
commit e97b35ed32
6 changed files with 2537 additions and 24 deletions

File diff suppressed because it is too large Load Diff

View File

@ -48,10 +48,20 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle
break break
} }
} }
// 消耗 if curChapter.Ps != 0 {
if code = this.module.CheckRes(session, node.PsMg); code != pb.ErrorCode_Success { // 扣1点
return
}
} else {
if code = this.module.CheckRes(session, node.PsConsume); code != pb.ErrorCode_Success { if code = this.module.CheckRes(session, node.PsConsume); code != pb.ErrorCode_Success {
return return
} }
if code = this.module.CheckRes(session, node.PsMg); code != pb.ErrorCode_Success {
return
}
}
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_mainline, Ptype: pb.PlayType_mainline,
Title: "", Title: "",

View File

@ -49,9 +49,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
return return
} }
// 消耗 // 消耗
if code = this.module.ConsumeRes(session, node.PsConsume, true); code != pb.ErrorCode_Success { // if code = this.module.ConsumeRes(session, node.PsConsume, true); code != pb.ErrorCode_Success {
return // return
} // }
// 校验通过 // 校验通过
code, isWin = this.module.battle.CheckBattleReport(session, req.Report) code, isWin = this.module.battle.CheckBattleReport(session, req.Report)
if code != pb.ErrorCode_Success { if code != pb.ErrorCode_Success {
@ -61,6 +61,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
code = pb.ErrorCode_BattleNoWin code = pb.ErrorCode_BattleNoWin
return return
} }
// 胜利返回
if code = this.module.DispenseRes(session, node.PsConsume, true); code != pb.ErrorCode_Success { // 扣1点
return
}
for _, v := range mainline.BranchID { for _, v := range mainline.BranchID {
if v == int32(req.MainlineId) { // 重复挑战 if v == int32(req.MainlineId) { // 重复挑战
code = pb.ErrorCode_MainlineNotFindChapter code = pb.ErrorCode_MainlineNotFindChapter
@ -87,10 +92,12 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
user = this.module.ModuleUser.GetUser(session.GetUserId()) user = this.module.ModuleUser.GetUser(session.GetUserId())
mainline.MainlineId = int32(req.MainlineId) mainline.MainlineId = int32(req.MainlineId)
mainline.BranchID = append(mainline.BranchID, int32(req.MainlineId)) mainline.BranchID = append(mainline.BranchID, int32(req.MainlineId))
mainline.Ps = 0 // 重置预扣体力
update := map[string]interface{}{ update := map[string]interface{}{
"mainlineId": req.MainlineId, "mainlineId": req.MainlineId,
"chapterId": mainline.ChapterId, "chapterId": mainline.ChapterId,
"branchID": mainline.BranchID, "branchID": mainline.BranchID,
"ps": 0,
} }
if node.Episodetype == comm.MainLineBoss { // 打完boss 设置领奖状态 if node.Episodetype == comm.MainLineBoss { // 打完boss 设置领奖状态
update["awaredID"] = pb.AwaredType_TypeAvailable update["awaredID"] = pb.AwaredType_TypeAvailable

View File

@ -121,14 +121,14 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
} }
mapData["bossTime"] = viking.BossTime // 更新时间 mapData["bossTime"] = viking.BossTime // 更新时间
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { // if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
for _, v := range req.Report.Info.Redflist[0].Team { // for _, v := range req.Report.Info.Redflist[0].Team {
if !v.Ishelp { // 助战英雄不加经验 // if !v.Ishelp { // 助战英雄不加经验
addExp, _ := this.module.ModuleHero.AddHeroExp(session, v.Oid, 500) // // addExp, _ := this.module.ModuleHero.AddHeroExp(session, v.Oid, 500) //临时加500 后面等配置
changExp[v.Oid] = addExp // changExp[v.Oid] = addExp
} // }
} // }
} // }
code = this.module.ModifyVikingData(session.GetUserId(), mapData) code = this.module.ModifyVikingData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{ session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{
Data: viking, Data: viking,

View File

@ -81,6 +81,7 @@ type DBMainline struct {
AwaredID AwaredType `protobuf:"varint,5,opt,name=awaredID,proto3,enum=AwaredType" json:"awaredID" bson:"awaredID"` //是否领奖(设置int是考虑后续扩展有多个宝箱情况) AwaredID AwaredType `protobuf:"varint,5,opt,name=awaredID,proto3,enum=AwaredType" json:"awaredID" bson:"awaredID"` //是否领奖(设置int是考虑后续扩展有多个宝箱情况)
BranchID []int32 `protobuf:"varint,6,rep,packed,name=branchID,proto3" json:"branchID" bson:"branchID"` // 记录所有通关的关卡数据 BranchID []int32 `protobuf:"varint,6,rep,packed,name=branchID,proto3" json:"branchID" bson:"branchID"` // 记录所有通关的关卡数据
Intensity int32 `protobuf:"varint,7,opt,name=intensity,proto3" json:"intensity"` // 难度 Intensity int32 `protobuf:"varint,7,opt,name=intensity,proto3" json:"intensity"` // 难度
Ps int32 `protobuf:"varint,8,opt,name=ps,proto3" json:"ps"` // 预扣的体力
} }
func (x *DBMainline) Reset() { func (x *DBMainline) Reset() {
@ -164,11 +165,18 @@ func (x *DBMainline) GetIntensity() int32 {
return 0 return 0
} }
func (x *DBMainline) GetPs() int32 {
if x != nil {
return x.Ps
}
return 0
}
var File_mainline_mainline_db_proto protoreflect.FileDescriptor var File_mainline_mainline_db_proto protoreflect.FileDescriptor
var file_mainline_mainline_db_proto_rawDesc = []byte{ var file_mainline_mainline_db_proto_rawDesc = []byte{
0x0a, 0x1a, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x0a, 0x1a, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x6c,
0x69, 0x6e, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcf, 0x01, 0x0a, 0x69, 0x6e, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdf, 0x01, 0x0a,
0x0a, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x0a, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75,
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a,
@ -181,7 +189,8 @@ var file_mainline_mainline_db_proto_rawDesc = []byte{
0x65, 0x64, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44, 0x65, 0x64, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44,
0x18, 0x06, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44, 0x18, 0x06, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44,
0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20,
0x01, 0x28, 0x05, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x79, 0x2a, 0x3e, 0x01, 0x28, 0x05, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x79, 0x12, 0x0e,
0x0a, 0x02, 0x70, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x70, 0x73, 0x2a, 0x3e,
0x0a, 0x0a, 0x41, 0x77, 0x61, 0x72, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x0a, 0x0a, 0x41, 0x77, 0x61, 0x72, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07,
0x54, 0x79, 0x70, 0x65, 0x4e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x79, 0x70, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x79, 0x70,
0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c,

View File

@ -31,6 +31,7 @@ type GameMainlineData struct {
Stroyid []int32 Stroyid []int32
Condition []int32 Condition []int32
PsConsume []*Gameatn PsConsume []*Gameatn
PsMg []*Gameatn
} }
const TypeId_GameMainlineData = -79093005 const TypeId_GameMainlineData = -79093005
@ -130,6 +131,20 @@ func (_v *GameMainlineData)Deserialize(_buf map[string]interface{}) (err error)
} }
} }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["ps_mg"].([]interface{}); !_ok_ { err = errors.New("ps_mg error"); return }
_v.PsMg = make([]*Gameatn, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gameatn
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
_v.PsMg = append(_v.PsMg, _list_v_)
}
}
return return
} }