动态获取bossstage 中boss buff 状态

This commit is contained in:
meixiongfeng 2023-12-06 10:04:46 +08:00
parent 4a1c96d49f
commit 38bff611b6
5 changed files with 123 additions and 33 deletions

View File

@ -27,12 +27,14 @@ import (
"testing"
"time"
"crypto/md5"
"encoding/hex"
"github.com/golang/protobuf/ptypes"
flag "github.com/spf13/pflag"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo/options"
flag "github.com/spf13/pflag"
)
var service core.IService
@ -335,11 +337,29 @@ func wordSepNormalizeFunc(f *flag.FlagSet, name string) flag.NormalizedName {
}
return flag.NormalizedName(name)
}
const Salt = "kTlufeTSjD33xSMPXGrkmzITxzFrScob"
func EncodeMD5(value, salt string) string {
m := md5.New()
m.Write([]byte(value))
m.Write([]byte(salt))
return hex.EncodeToString(m.Sum(nil))
}
func GetMd5String(str string) string {
salt := Salt
return EncodeMD5(str, salt)
}
func Test_Modules(t *testing.T) {
var iMax int64
iMax = 1 << 32
//fmt.Printf("%d", iMax)
salt := GetMd5String("admin")
passwordMd5 := EncodeMD5("admin123", salt)
fmt.Printf("%s", passwordMd5)
fmt.Printf("%d", (iMax << 30))
var cliName = flag.StringP("name", "n", "nick", "Input Your Name")
var cliAge = flag.IntP("age", "a", 22, "Input Your Age")

View File

@ -453,6 +453,7 @@ func (this *configureComp) LoadGameStoneStage() {
}
}
this.module.ReloadStageData()
return
}

View File

@ -84,14 +84,15 @@ func (this *MStonehenge) ChangeStonehengeData(uid string, update map[string]inte
}
func (this *MStonehenge) reLoadStoneBoos() (err error) {
if this.module.ModuleTools == nil {
return
}
s := &pb.DBStoneBoss{}
this.module.ModuleTools.GetGlobalData(StoneBossKey, s)
if len(s.Bossstage) == 0 || utils.WeekIntervalTime() != s.Rtime {
this.lock.Lock()
this.bossStage = this.module.configure.CheckStage()
this.lock.Unlock()
this.lock.Lock()
this.bossStage = this.module.configure.CheckStage()
this.lock.Unlock()
if len(s.Bossstage) != len(this.bossStage) || utils.WeekIntervalTime() != s.Rtime {
this.module.ModuleTools.UpdateGlobalData(StoneBossKey, map[string]interface{}{
"BossStage": this.bossStage,
"rtime": utils.WeekIntervalTime(),

View File

@ -86,3 +86,7 @@ func (this *Stonehenge) GmAddStoneEvent(uid string, eventid int32) {
}
return
}
func (this *Stonehenge) ReloadStageData() {
this.modelStonehenge.reLoadStoneBoos()
return
}

View File

@ -25,13 +25,19 @@ type DBIntegralBoss struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
Boss map[int32]int64 `protobuf:"bytes,3,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分
Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count"` // 今日挑战次数
CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间
BossTime map[int32]int32 `protobuf:"bytes,6,rep,name=bossTime,proto3" json:"bossTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"bossTime"` //
Etime int64 `protobuf:"varint,7,opt,name=etime,proto3" json:"etime"` // 活动结束时间
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
Boss map[int32]int64 `protobuf:"bytes,3,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分
Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count"` // 今日挑战次数
CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间
BossTime map[int32]int32 `protobuf:"bytes,6,rep,name=bossTime,proto3" json:"bossTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"bossTime"` //
Etime int64 `protobuf:"varint,7,opt,name=etime,proto3" json:"etime"` // 活动结束时间
Hid int32 `protobuf:"varint,8,opt,name=hid,proto3" json:"hid"` // 活动id
Maxscore int64 `protobuf:"varint,9,opt,name=maxscore,proto3" json:"maxscore"` // 最大积分
Totalscore int64 `protobuf:"varint,10,opt,name=totalscore,proto3" json:"totalscore"` // 累计积分
Reward1 int32 `protobuf:"varint,11,opt,name=reward1,proto3" json:"reward1"` // 类型1 奖励( Integralreward cid )
Reward2 int32 `protobuf:"varint,12,opt,name=reward2,proto3" json:"reward2"` // 类型2 奖励( Integralreward cid )
Buff map[int32]int32 `protobuf:"bytes,13,rep,name=buff,proto3" json:"buff" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 激活的buff (key Integralcondition value :0 未激活)
}
func (x *DBIntegralBoss) Reset() {
@ -115,11 +121,53 @@ func (x *DBIntegralBoss) GetEtime() int64 {
return 0
}
func (x *DBIntegralBoss) GetHid() int32 {
if x != nil {
return x.Hid
}
return 0
}
func (x *DBIntegralBoss) GetMaxscore() int64 {
if x != nil {
return x.Maxscore
}
return 0
}
func (x *DBIntegralBoss) GetTotalscore() int64 {
if x != nil {
return x.Totalscore
}
return 0
}
func (x *DBIntegralBoss) GetReward1() int32 {
if x != nil {
return x.Reward1
}
return 0
}
func (x *DBIntegralBoss) GetReward2() int32 {
if x != nil {
return x.Reward2
}
return 0
}
func (x *DBIntegralBoss) GetBuff() map[int32]int32 {
if x != nil {
return x.Buff
}
return nil
}
var File_integral_integral_db_proto protoreflect.FileDescriptor
var file_integral_integral_db_proto_rawDesc = []byte{
0x0a, 0x1a, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67,
0x72, 0x61, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd4, 0x02, 0x0a,
0x72, 0x61, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x04, 0x0a,
0x0e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 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,
@ -133,16 +181,30 @@ var file_integral_integral_db_proto_rawDesc = []byte{
0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x2e,
0x42, 0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x62,
0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65,
0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x37, 0x0a,
0x09, 0x42, 0x6f, 0x73, 0x73, 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, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x42, 0x6f, 0x73, 0x73, 0x54, 0x69,
0x6d, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a,
0x03, 0x68, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x68, 0x69, 0x64, 0x12,
0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28,
0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74,
0x6f, 0x74, 0x61, 0x6c, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72,
0x65, 0x77, 0x61, 0x72, 0x64, 0x31, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65,
0x77, 0x61, 0x72, 0x64, 0x31, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32,
0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x12,
0x2d, 0x0a, 0x04, 0x62, 0x75, 0x66, 0x66, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e,
0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x2e, 0x42,
0x75, 0x66, 0x66, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x62, 0x75, 0x66, 0x66, 0x1a, 0x37,
0x0a, 0x09, 0x42, 0x6f, 0x73, 0x73, 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, 0x03, 0x52, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x42, 0x6f, 0x73, 0x73, 0x54,
0x69, 0x6d, 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, 0x37, 0x0a, 0x09, 0x42, 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, 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 (
@ -157,20 +219,22 @@ func file_integral_integral_db_proto_rawDescGZIP() []byte {
return file_integral_integral_db_proto_rawDescData
}
var file_integral_integral_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_integral_integral_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_integral_integral_db_proto_goTypes = []interface{}{
(*DBIntegralBoss)(nil), // 0: DBIntegralBoss
nil, // 1: DBIntegralBoss.BossEntry
nil, // 2: DBIntegralBoss.BossTimeEntry
nil, // 3: DBIntegralBoss.BuffEntry
}
var file_integral_integral_db_proto_depIdxs = []int32{
1, // 0: DBIntegralBoss.boss:type_name -> DBIntegralBoss.BossEntry
2, // 1: DBIntegralBoss.bossTime:type_name -> DBIntegralBoss.BossTimeEntry
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
3, // 2: DBIntegralBoss.buff:type_name -> DBIntegralBoss.BuffEntry
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_integral_integral_db_proto_init() }
@ -198,7 +262,7 @@ func file_integral_integral_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_integral_integral_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},