护月等级 作为功能条件开启条件

This commit is contained in:
meixiongfeng 2023-11-15 11:04:55 +08:00
parent 9f486c4528
commit 396bd29052
5 changed files with 49 additions and 27 deletions

View File

@ -123,7 +123,7 @@ const (
ModuleIsLand core.M_Modules = "island" //海岛探险
ModuleEgghunt core.M_Modules = "egghunt" //彩蛋
ModuleCatchbugs core.M_Modules = "catchbugs" //捉虫子
ModuleMoonlv core.M_Modules = "monnlv" //护月等级
ModuleMoonlv core.M_Modules = "moonlv" //护月等级
)
// 数据表名定义处
@ -1135,6 +1135,7 @@ const (
OpencondTypeFriend OpencondType = 4 //好友数量
OpencondTypePagoda OpencondType = 5 //爬塔
OpencondTypeSociaty OpencondType = 6 //工会等级
OpencondTypeMoonLv OpencondType = 7 //护月等级
)
const (

View File

@ -91,6 +91,8 @@ func (this *apiComp) Award(session comm.IUserSession, req *pb.MoonlvAwardReq) (e
Data: &pb.DBMoonLv{},
Res: []*pb.UserAssets{},
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypeMoonLv, list.Lv)
})
return
}

View File

@ -40,6 +40,7 @@ func (this *ModelSys) GetOpenCondList(uid string) (result *pb.DBOpenCond, err er
Wtask: map[int32]int32{},
Pagoda: map[int32]int32{},
Sociaty: 1,
Moonlv: 1,
}
this.Add(uid, result)
err = nil
@ -58,32 +59,36 @@ func (this *ModelSys) ChangeOpenCondData(uid string, value map[string]interface{
func (this *ModelSys) CheckValidCond(uid string, condData *cfg.GameOpencondData, open *pb.DBOpenCond) string {
for _, conf := range condData.Main {
switch conf.Key {
case 1: //等级
switch comm.OpencondType(conf.Key) {
case comm.OpencondTypePlatlv: //等级
if open.Lv < conf.Param {
return ""
}
case 2: //关卡ID
case comm.OpencondTypeMaxmapid: //关卡ID
if _, ok := open.Mline[conf.Param]; !ok {
return ""
}
case 3: //世界任务ID
case comm.OpencondTypeWorldtaskid: //世界任务ID
if _, ok := open.Wtask[conf.Param]; !ok {
return ""
}
case 4: // 好友数量
case comm.OpencondTypeFriend: // 好友数量
if open.Friend < conf.Param {
return ""
}
case 5:
case comm.OpencondTypePagoda:
if _, ok := open.Pagoda[conf.Param]; !ok {
return ""
}
case 6: // 查询工会等级
case comm.OpencondTypeSociaty: // 查询工会等级
if open.Sociaty < conf.Param {
return ""
}
case comm.OpencondTypeMoonLv:
if open.Moonlv < conf.Param {
return ""
}
}
}
return condData.Id

View File

@ -93,6 +93,11 @@ func (this *ModuleSys) CheckOpenCond(session comm.IUserSession, itype comm.Openc
list.Sociaty = value
update["friend"] = list.Friend
}
case comm.OpencondTypeMoonLv:
if list.Moonlv != value {
list.Moonlv = value
update["moonlv"] = list.Moonlv
}
default:
return
}

View File

@ -34,6 +34,7 @@ type DBOpenCond struct {
Wtask map[int32]int32 `protobuf:"bytes,7,rep,name=wtask,proto3" json:"wtask" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 任务进度
Pagoda map[int32]int32 `protobuf:"bytes,8,rep,name=pagoda,proto3" json:"pagoda" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //
Sociaty int32 `protobuf:"varint,9,opt,name=sociaty,proto3" json:"sociaty"`
Moonlv int32 `protobuf:"varint,10,opt,name=moonlv,proto3" json:"moonlv"` // 护月等级
}
func (x *DBOpenCond) Reset() {
@ -131,11 +132,18 @@ func (x *DBOpenCond) GetSociaty() int32 {
return 0
}
func (x *DBOpenCond) GetMoonlv() int32 {
if x != nil {
return x.Moonlv
}
return 0
}
var File_sys_sys_db_proto protoreflect.FileDescriptor
var file_sys_sys_db_proto_rawDesc = []byte{
0x0a, 0x10, 0x73, 0x79, 0x73, 0x2f, 0x73, 0x79, 0x73, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x90, 0x04, 0x0a, 0x0a, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e,
0x74, 0x6f, 0x22, 0xa8, 0x04, 0x0a, 0x0a, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e,
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 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, 0x29, 0x0a, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28,
@ -153,23 +161,24 @@ var file_sys_sys_db_proto_rawDesc = []byte{
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x2e,
0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x70, 0x61, 0x67,
0x6f, 0x64, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x18, 0x09,
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x1a, 0x37, 0x0a,
0x09, 0x43, 0x6f, 0x6e, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x1a, 0x38, 0x0a, 0x0a, 0x57, 0x74, 0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x61,
0x67, 0x6f, 0x64, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x12, 0x16, 0x0a,
0x06, 0x6d, 0x6f, 0x6f, 0x6e, 0x6c, 0x76, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6d,
0x6f, 0x6f, 0x6e, 0x6c, 0x76, 0x1a, 0x37, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38,
0x0a, 0x0a, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x57, 0x74, 0x61, 0x73,
0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (