重置buff 三选一事件处理
This commit is contained in:
parent
b77b4d8025
commit
9fce1aa3f2
67
modules/stonehenge/api_resetbuff.go
Normal file
67
modules/stonehenge/api_resetbuff.go
Normal file
@ -0,0 +1,67 @@
|
||||
package stonehenge
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) ResetBuffCheck(session comm.IUserSession, req *pb.StonehengeResetBuffReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 结算房间
|
||||
func (this *apiComp) ResetBuff(session comm.IUserSession, req *pb.StonehengeResetBuffReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
stone *pb.DBStonehenge
|
||||
update map[string]interface{}
|
||||
err error
|
||||
)
|
||||
update = make(map[string]interface{})
|
||||
if errdata = this.ResetBuffCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if stone, err = this.module.modelStonehenge.GetStonehengeData(session.GetUserId()); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.String(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// 检查特权
|
||||
if stone.Resetcount == 0 {
|
||||
for _, v := range stone.Privilege {
|
||||
if v == pb.StonehengePrivilege_StonehengePrivilege_7 { //随机buff三选一事件,新增重置功能
|
||||
if eventConf, err := this.module.configure.GetStoneEventDataById(req.Eventid); err != nil {
|
||||
//if p, err := this.module.configure.getGameStonePrivilegeData(int32(v)); err != nil {
|
||||
for _, v := range stone.Addweight { // 这个map 目前只会存在一条数据
|
||||
ownerbuff := make(map[int32]struct{}, 0)
|
||||
for k := range stone.Userbuff {
|
||||
ownerbuff[k] = struct{}{}
|
||||
}
|
||||
stone.Rooms.Selectbuff = this.module.configure.GetBuffGroupDataByLottery(eventConf.Value1, v, ownerbuff)
|
||||
stone.Resetcount += 1
|
||||
|
||||
// 更新数据
|
||||
update["rooms"] = stone.Rooms
|
||||
update["resetcount"] = stone.Resetcount
|
||||
this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update)
|
||||
session.SendMsg(string(this.module.GetType()), "resetbuff", &pb.StonehengeResetBuffResp{
|
||||
Selectbuff: stone.Rooms.Selectbuff,
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_StonehengebuffResetErr,
|
||||
Title: pb.ErrorCode_StonehengebuffResetErr.String(),
|
||||
}
|
||||
return
|
||||
}
|
@ -429,6 +429,7 @@ const (
|
||||
ErrorCode_StonehengeStoreMax ErrorCode = 4909 // 购买上限
|
||||
ErrorCode_StonehengeCantBuy ErrorCode = 4910 // 已有事件不能重复购买
|
||||
ErrorCode_StonehengeHeroRepeated ErrorCode = 4911 // 重复英雄
|
||||
ErrorCode_StonehengebuffResetErr ErrorCode = 4912 // 三选一重置失败
|
||||
// 活动错误码
|
||||
ErrorCode_ActivityOver ErrorCode = 5001 //活动结束
|
||||
ErrorCode_ActivityUnOpened ErrorCode = 5002 // 活动未开启
|
||||
@ -805,6 +806,7 @@ var (
|
||||
4909: "StonehengeStoreMax",
|
||||
4910: "StonehengeCantBuy",
|
||||
4911: "StonehengeHeroRepeated",
|
||||
4912: "StonehengebuffResetErr",
|
||||
5001: "ActivityOver",
|
||||
5002: "ActivityUnOpened",
|
||||
5003: "ActivityRepatReward",
|
||||
@ -1177,6 +1179,7 @@ var (
|
||||
"StonehengeStoreMax": 4909,
|
||||
"StonehengeCantBuy": 4910,
|
||||
"StonehengeHeroRepeated": 4911,
|
||||
"StonehengebuffResetErr": 4912,
|
||||
"ActivityOver": 5001,
|
||||
"ActivityUnOpened": 5002,
|
||||
"ActivityRepatReward": 5003,
|
||||
@ -1217,7 +1220,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_errorcode_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2a, 0xc8, 0x44, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x6f, 0x2a, 0xe5, 0x44, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10,
|
||||
0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76,
|
||||
@ -1757,16 +1760,18 @@ var file_errorcode_proto_rawDesc = []byte{
|
||||
0x53, 0x74, 0x6f, 0x6e, 0x65, 0x68, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x61, 0x6e, 0x74, 0x42, 0x75,
|
||||
0x79, 0x10, 0xae, 0x26, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x74, 0x6f, 0x6e, 0x65, 0x68, 0x65, 0x6e,
|
||||
0x67, 0x65, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x10, 0xaf,
|
||||
0x26, 0x12, 0x11, 0x0a, 0x0c, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x4f, 0x76, 0x65,
|
||||
0x72, 0x10, 0x89, 0x27, 0x12, 0x15, 0x0a, 0x10, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79,
|
||||
0x55, 0x6e, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x10, 0x8a, 0x27, 0x12, 0x18, 0x0a, 0x13, 0x41,
|
||||
0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x70, 0x61, 0x74, 0x52, 0x65, 0x77, 0x61,
|
||||
0x72, 0x64, 0x10, 0x8b, 0x27, 0x12, 0x16, 0x0a, 0x11, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
|
||||
0x79, 0x4e, 0x6f, 0x74, 0x49, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x10, 0x8c, 0x27, 0x12, 0x14, 0x0a,
|
||||
0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x10, 0x8d, 0x27, 0x12, 0x17, 0x0a, 0x12, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x43,
|
||||
0x61, 0x6e, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0x8e, 0x27, 0x42, 0x06, 0x5a, 0x04,
|
||||
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x26, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x74, 0x6f, 0x6e, 0x65, 0x68, 0x65, 0x6e, 0x67, 0x65, 0x62,
|
||||
0x75, 0x66, 0x66, 0x52, 0x65, 0x73, 0x65, 0x74, 0x45, 0x72, 0x72, 0x10, 0xb0, 0x26, 0x12, 0x11,
|
||||
0x0a, 0x0c, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x4f, 0x76, 0x65, 0x72, 0x10, 0x89,
|
||||
0x27, 0x12, 0x15, 0x0a, 0x10, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x55, 0x6e, 0x4f,
|
||||
0x70, 0x65, 0x6e, 0x65, 0x64, 0x10, 0x8a, 0x27, 0x12, 0x18, 0x0a, 0x13, 0x41, 0x63, 0x74, 0x69,
|
||||
0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x70, 0x61, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10,
|
||||
0x8b, 0x27, 0x12, 0x16, 0x0a, 0x11, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x4e, 0x6f,
|
||||
0x74, 0x49, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x10, 0x8c, 0x27, 0x12, 0x14, 0x0a, 0x0f, 0x41, 0x63,
|
||||
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x10, 0x8d, 0x27,
|
||||
0x12, 0x17, 0x0a, 0x12, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x43, 0x61, 0x6e, 0x74,
|
||||
0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0x8e, 0x27, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user