获得三选一buff 的时候需重置buff 三选一次数

This commit is contained in:
meixiongfeng 2023-08-17 09:53:40 +08:00
parent f595e78333
commit a15be334b0
5 changed files with 41 additions and 36 deletions

View File

@ -349,6 +349,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
if eventConf.Probability >= comm.GetRandNum(0, 1000) { // 命中
newEvent = eventConf.PostEvent
this.module.modelStonehenge.AddNewEvent([]int32{eventConf.PostEvent}, stone)
} else { // 没有后置事件的事件处理特权事件
// 查特权
for _, v := range stone.Privilege {
@ -357,7 +358,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
v == pb.StonehengePrivilege_StonehengePrivilege_6 { // 4 5 6 特权
if p, err := this.module.configure.getGameStonePrivilegeData(int32(v)); err != nil {
if stone.Selectcount > p.Value2 { // 达到指定次数
if _, ok := stone.PrivilegeEvent[int32(v)]; !ok {
if _, ok := stone.Privilegeevent[int32(v)]; !ok {
// 记录buff 三选一的次数
if stone.Selectcount == p.Value2 { //可额外触发一次随机buff三选一事件
if c, err := this.module.configure.getGameStonePrivilegeData(3); err != nil {

View File

@ -154,6 +154,9 @@ func (this *apiComp) GotoRoom(session comm.IUserSession, req *pb.StonehengeGotoR
}
}
// 重置一些信息
stone.Privilegeevent = map[int32]int32{}
update["privilegeevent"] = stone.Privilegeevent
update["rooms"] = stone.Rooms
this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update)
session.SendMsg(string(this.module.GetType()), "gotoroom", &pb.StonehengeGotoRoomResp{

View File

@ -32,7 +32,7 @@ func (this *apiComp) ResetBuff(session comm.IUserSession, req *pb.StonehengeRese
return
}
// 检查特权
if stone.Resetcount == 0 {
if stone.Rooms.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 {
@ -43,11 +43,11 @@ func (this *apiComp) ResetBuff(session comm.IUserSession, req *pb.StonehengeRese
ownerbuff[k] = struct{}{}
}
stone.Rooms.Selectbuff = this.module.configure.GetBuffGroupDataByLottery(eventConf.Value1, v, ownerbuff)
stone.Resetcount += 1
stone.Rooms.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,

View File

@ -68,7 +68,7 @@ func (this *MStonehenge) GetStonehengeData(uid string) (info *pb.DBStonehenge, e
Talentproperty: make(map[string]int32),
Privilege: make([]pb.StonehengePrivilege, 0),
Task: make(map[int32]bool),
PrivilegeEvent: make(map[int32]int32),
Privilegeevent: make(map[int32]int32),
}
err = this.Add(uid, info)
}
@ -127,6 +127,7 @@ func (this *MStonehenge) AddNewEvent(event []int32, stone *pb.DBStonehenge) {
ownerbuff[k] = struct{}{}
}
stone.Rooms.Selectbuff = this.module.configure.GetBuffGroupDataByLottery(newEventConf.Value1, v, ownerbuff)
stone.Rooms.Resetcount = 0 // 重置buff 三选一次数
}
case EventType10: // 宝箱事件
if _, ok := stone.Rooms.Box[newEventConf.EventId]; !ok {

View File

@ -106,6 +106,7 @@ type RoomData struct {
Story int32 `protobuf:"varint,10,opt,name=story,proto3" json:"story"` // 剧情id
Shop map[int32]int32 `protobuf:"bytes,11,rep,name=shop,proto3" json:"shop" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 商店
Passive map[int32]int32 `protobuf:"bytes,12,rep,name=passive,proto3" json:"passive" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 被动事件
Resetcount int32 `protobuf:"varint,13,opt,name=resetcount,proto3" json:"resetcount"` //三选一事件重置次数
}
func (x *RoomData) Reset() {
@ -217,6 +218,13 @@ func (x *RoomData) GetPassive() map[int32]int32 {
return nil
}
func (x *RoomData) GetResetcount() int32 {
if x != nil {
return x.Resetcount
}
return 0
}
type DBStonehenge struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -240,9 +248,8 @@ type DBStonehenge struct {
Integral int32 `protobuf:"varint,16,opt,name=integral,proto3" json:"integral"` //积分
Weeklyreward map[int32]bool `protobuf:"bytes,17,rep,name=weeklyreward,proto3" json:"weeklyreward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //周长奖励领取
Task map[int32]bool `protobuf:"bytes,18,rep,name=task,proto3" json:"task" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //已领取的任务
PrivilegeEvent map[int32]int32 `protobuf:"bytes,19,rep,name=privilegeEvent,proto3" json:"privilegeEvent" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 记录特权完成情况
Privilegeevent map[int32]int32 `protobuf:"bytes,19,rep,name=privilegeevent,proto3" json:"privilegeevent" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 记录特权完成情况
Selectcount int32 `protobuf:"varint,20,opt,name=selectcount,proto3" json:"selectcount"` //三选一事件次数
Resetcount int32 `protobuf:"varint,21,opt,name=resetcount,proto3" json:"resetcount"` //三选一事件重置次数
}
func (x *DBStonehenge) Reset() {
@ -403,9 +410,9 @@ func (x *DBStonehenge) GetTask() map[int32]bool {
return nil
}
func (x *DBStonehenge) GetPrivilegeEvent() map[int32]int32 {
func (x *DBStonehenge) GetPrivilegeevent() map[int32]int32 {
if x != nil {
return x.PrivilegeEvent
return x.Privilegeevent
}
return nil
}
@ -417,13 +424,6 @@ func (x *DBStonehenge) GetSelectcount() int32 {
return 0
}
func (x *DBStonehenge) GetResetcount() int32 {
if x != nil {
return x.Resetcount
}
return 0
}
type StageData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -676,7 +676,7 @@ var file_stonehenge_stonehenge_db_proto_rawDesc = []byte{
0x0a, 0x1e, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x68, 0x65, 0x6e, 0x67, 0x65, 0x2f, 0x73, 0x74, 0x6f,
0x6e, 0x65, 0x68, 0x65, 0x6e, 0x67, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x16, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x2f, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x5f,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2, 0x04, 0x0a, 0x08, 0x52, 0x6f, 0x6f,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x04, 0x0a, 0x08, 0x52, 0x6f, 0x6f,
0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x30, 0x0a, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x61, 0x74,
0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07,
@ -699,7 +699,9 @@ var file_stonehenge_stonehenge_db_proto_rawDesc = []byte{
0x6f, 0x70, 0x12, 0x30, 0x0a, 0x07, 0x70, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x18, 0x0c, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x50,
0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x70, 0x61, 0x73,
0x73, 0x69, 0x76, 0x65, 0x1a, 0x3a, 0x0a, 0x0c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x45,
0x73, 0x69, 0x76, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3a, 0x0a, 0x0c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 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, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
@ -713,7 +715,7 @@ var file_stonehenge_stonehenge_db_proto_rawDesc = []byte{
0x01, 0x1a, 0x3a, 0x0a, 0x0c, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 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, 0x22, 0xb4, 0x0b,
0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x94, 0x0b,
0x0a, 0x0c, 0x44, 0x42, 0x53, 0x74, 0x6f, 0x6e, 0x65, 0x68, 0x65, 0x6e, 0x67, 0x65, 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,
@ -761,15 +763,13 @@ var file_stonehenge_stonehenge_db_proto_rawDesc = []byte{
0x61, 0x72, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x12, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x53, 0x74, 0x6f, 0x6e, 0x65, 0x68, 0x65, 0x6e, 0x67, 0x65,
0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x73, 0x6b,
0x12, 0x49, 0x0a, 0x0e, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x45, 0x76, 0x65,
0x12, 0x49, 0x0a, 0x0e, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x65, 0x76, 0x65,
0x6e, 0x74, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x44, 0x42, 0x53, 0x74, 0x6f,
0x6e, 0x65, 0x68, 0x65, 0x6e, 0x67, 0x65, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67,
0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x70, 0x72, 0x69,
0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x73,
0x65, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x70, 0x72, 0x69,
0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x73,
0x65, 0x6c, 0x65, 0x63, 0x74, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05,
0x52, 0x0b, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x0a,
0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28,
0x05, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3b, 0x0a,
0x52, 0x0b, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3b, 0x0a,
0x0d, 0x55, 0x73, 0x65, 0x72, 0x62, 0x75, 0x66, 0x66, 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,
@ -801,7 +801,7 @@ var file_stonehenge_stonehenge_db_proto_rawDesc = []byte{
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, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x1a, 0x41, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x45, 0x76,
0x01, 0x1a, 0x41, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x65, 0x76,
0x65, 0x6e, 0x74, 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,
@ -900,7 +900,7 @@ var file_stonehenge_stonehenge_db_proto_goTypes = []interface{}{
nil, // 16: DBStonehenge.TalentpropertyEntry
nil, // 17: DBStonehenge.WeeklyrewardEntry
nil, // 18: DBStonehenge.TaskEntry
nil, // 19: DBStonehenge.PrivilegeEventEntry
nil, // 19: DBStonehenge.PrivilegeeventEntry
nil, // 20: DBStoneBoss.BossstageEntry
nil, // 21: DBStonehengeBook.AwardEntry
nil, // 22: DBStonehengeBookAward.StageEntry
@ -921,7 +921,7 @@ var file_stonehenge_stonehenge_db_proto_depIdxs = []int32{
0, // 11: DBStonehenge.privilege:type_name -> StonehengePrivilege
17, // 12: DBStonehenge.weeklyreward:type_name -> DBStonehenge.WeeklyrewardEntry
18, // 13: DBStonehenge.task:type_name -> DBStonehenge.TaskEntry
19, // 14: DBStonehenge.privilegeEvent:type_name -> DBStonehenge.PrivilegeEventEntry
19, // 14: DBStonehenge.privilegeevent:type_name -> DBStonehenge.PrivilegeeventEntry
20, // 15: DBStoneBoss.bossstage:type_name -> DBStoneBoss.BossstageEntry
21, // 16: DBStonehengeBook.award:type_name -> DBStonehengeBook.AwardEntry
22, // 17: DBStonehengeBookAward.stage:type_name -> DBStonehengeBookAward.StageEntry