From 0c2b4fcd1cf3a069398b41ff31065da8e981097c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 18 Aug 2022 19:34:22 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 ++ modules/pagoda/api_challenge.go | 6 +++--- modules/pagoda/api_getlist.go | 2 +- modules/pagoda/api_ranklist.go | 6 +++--- modules/pagoda/model_rank.go | 4 ++-- pb/pagoda_db.pb.go | 24 +++++++++++++++++++++--- 6 files changed, 32 insertions(+), 12 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index 744db949a..c2da4755b 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -54,6 +54,8 @@ type ( GetSpecifiedHero(session IUserSession, heroConfId string, star, lv, amount int32) (code pb.ErrorCode) // 英雄加经验 AddHeroExp(session IUserSession, heroObjID string, exp int32) (code pb.ErrorCode) + // 英雄练功 + //KungFuHero(session IUserSession, heroObjID string) (code pb.ErrorCode) } //玩家 diff --git a/modules/pagoda/api_challenge.go b/modules/pagoda/api_challenge.go index fecf692fe..debe67f07 100644 --- a/modules/pagoda/api_challenge.go +++ b/modules/pagoda/api_challenge.go @@ -29,7 +29,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng code = pb.ErrorCode_PagodaNotFound return } - req.PagodaType = 101 cfg := this.module.configure.GetPagodaConfigData(req.PagodaType, req.LevelID) if cfg == nil { code = pb.ErrorCode_PagodaNotFound @@ -54,12 +53,13 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng rst.Uid = session.GetUserId() rst.Id = primitive.NewObjectID().Hex() rst.Type = req.PagodaType - rst.Nickname = "123" + rst.Nickname = this.module.ModuleUser.GetUser(session.GetUserId()).Name + rst.Lv = this.module.ModuleUser.GetUser(session.GetUserId()).Lv rst.PagodaId = pagoda.PagodaId this.module.modulerank.AddRank(session.GetUserId(), rst) } else { mapData := make(map[string]interface{}, 0) - mapData["pagodaId"] = pagoda.PagodaId + mapData["pagodaId"] = cfg.LayerNum mapData["type"] = pagoda.Type this.module.modulerank.ChangeUserRank(session.GetUserId(), mapData) diff --git a/modules/pagoda/api_getlist.go b/modules/pagoda/api_getlist.go index ff58f3f64..8f1ea808b 100644 --- a/modules/pagoda/api_getlist.go +++ b/modules/pagoda/api_getlist.go @@ -31,7 +31,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq //_mData := make(map[string]interface{}, 0) result.Uid = session.GetUserId() result.PagodaId = 1 // 初始数据1层 - //_mData[result.Id] = result + result.Type = 101 this.module.modelPagoda.addNewPagoda(session.GetUserId(), result) session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: result}) return diff --git a/modules/pagoda/api_ranklist.go b/modules/pagoda/api_ranklist.go index 6140b56ea..2510c5069 100644 --- a/modules/pagoda/api_ranklist.go +++ b/modules/pagoda/api_ranklist.go @@ -8,14 +8,14 @@ import ( ) //参数校验 -func (this *apiComp) RankLisCheck(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode) { +func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode) { return } -func (this *apiComp) RankLis(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode, data proto.Message) { +func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode, data proto.Message) { - code = this.RankLisCheck(session, req) + code = this.RankListCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } diff --git a/modules/pagoda/model_rank.go b/modules/pagoda/model_rank.go index ea4537bde..2a05d4567 100644 --- a/modules/pagoda/model_rank.go +++ b/modules/pagoda/model_rank.go @@ -62,7 +62,7 @@ func (this *ModelRank) ChangeUserRank(uid string, value map[string]interface{}) // 临时测试 func (this *ModelRank) GetRankData(floorId int32, pagodaType int32) (data []*pb.DBPagodaRank, err error) { if floorId == 0 { - if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"type": pagodaType}, options.Find().SetSort(bson.M{"pagodaId": 1})); err == nil { + if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"type": pagodaType}, options.Find().SetSort(bson.M{"pagodaId": -1})); err == nil { for _data.Next(context.TODO()) { temp := &pb.DBPagodaRank{} if err = _data.Decode(temp); err == nil { @@ -71,7 +71,7 @@ func (this *ModelRank) GetRankData(floorId int32, pagodaType int32) (data []*pb. } } } else { - if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"pagodaId": bson.M{"$gte": floorId}, "type": pagodaType}, options.Find().SetSort(bson.M{"pagodaId": 1})); err == nil { + if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"pagodaId": bson.M{"$gte": floorId}, "type": pagodaType}, options.Find().SetSort(bson.M{"pagodaId": -1})); err == nil { for _data.Next(context.TODO()) { temp := &pb.DBPagodaRank{} if err = _data.Decode(temp); err == nil { diff --git a/pb/pagoda_db.pb.go b/pb/pagoda_db.pb.go index 703d2fa4c..34a0f0717 100644 --- a/pb/pagoda_db.pb.go +++ b/pb/pagoda_db.pb.go @@ -110,6 +110,8 @@ type DBPagodaRank struct { Type int32 `protobuf:"varint,4,opt,name=type,proto3" json:"type"` // 塔类型 Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname"` // 昵称 Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon"` // 头像 + Lv int32 `protobuf:"varint,7,opt,name=lv,proto3" json:"lv"` // 等级 + CostTime int32 `protobuf:"varint,8,opt,name=costTime,proto3" json:"costTime" bson:"costTime"` //塔层 } func (x *DBPagodaRank) Reset() { @@ -186,6 +188,20 @@ func (x *DBPagodaRank) GetIcon() string { return "" } +func (x *DBPagodaRank) GetLv() int32 { + if x != nil { + return x.Lv + } + return 0 +} + +func (x *DBPagodaRank) GetCostTime() int32 { + if x != nil { + return x.CostTime + } + return 0 +} + var File_pagoda_pagoda_db_proto protoreflect.FileDescriptor var file_pagoda_pagoda_db_proto_rawDesc = []byte{ @@ -203,7 +219,7 @@ var file_pagoda_pagoda_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, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, + 0x01, 0x22, 0xbc, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e, 0x6b, 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, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, @@ -212,8 +228,10 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{ 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x69, 0x63, 0x6f, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x02, 0x6c, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From d45f5fdc8aa25bc43d4574aad00b9c16530edf71 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 18 Aug 2022 20:09:22 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/api_addblack.go | 8 ++++++-- modules/friend/api_blacklist.go | 1 + modules/friend/api_list.go | 11 +++++------ modules/friend/api_randlist.go | 22 +++++++++++++++++----- modules/friend/api_zan.go | 26 +++++++++++++------------- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/modules/friend/api_addblack.go b/modules/friend/api_addblack.go index f6e8dcdc2..06c0613cf 100644 --- a/modules/friend/api_addblack.go +++ b/modules/friend/api_addblack.go @@ -78,9 +78,13 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR //将目标加入黑名单 self.BlackIds = append(self.BlackIds, req.FriendId) - //更新黑名单 + // 将目标从好友列表中移除 + friendIds := utils.DeleteString(self.FriendIds, req.FriendId) + + //更新 err = this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{ - "blackIds": self.BlackIds, + "blackIds": self.BlackIds, + "friendIds": friendIds, }) if err != nil { code = pb.ErrorCode_DBError diff --git a/modules/friend/api_blacklist.go b/modules/friend/api_blacklist.go index 8cac9b6b8..cf8bb00ae 100644 --- a/modules/friend/api_blacklist.go +++ b/modules/friend/api_blacklist.go @@ -46,6 +46,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis list = append(list, &pb.FriendBase{ UserId: userId, NickName: user.Name, + Level: user.Lv, }) } diff --git a/modules/friend/api_list.go b/modules/friend/api_list.go index c241ba97c..45be5e6b9 100644 --- a/modules/friend/api_list.go +++ b/modules/friend/api_list.go @@ -62,13 +62,12 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (cod base.OfflineTime = user.Offlinetime //离线时间 } - // 判断是否在自己的申请列表中 - if _, ok := utils.Findx(self.ApplyIds, userId); ok { - base.IsApplied = true - } - // 判断是否已点赞 - if _, ok := utils.Findx(self.ZanIds, userId); ok { + target := this.moduleFriend.modelFriend.GetFriend(userId) + if target == nil { + continue + } + if _, ok := utils.Findx(target.ZanIds, self.Uid); ok { base.IsZaned = true } diff --git a/modules/friend/api_randlist.go b/modules/friend/api_randlist.go index 2a3319f45..74f029ce5 100644 --- a/modules/friend/api_randlist.go +++ b/modules/friend/api_randlist.go @@ -37,18 +37,30 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR if _, ok := utils.Findx(self.FriendIds, v.Uid); ok { continue } - if _, ok := utils.Findx(self.ApplyIds, v.Uid); ok { - continue - } + // if _, ok := utils.Findx(self.ApplyIds, v.Uid); ok { + // continue + // } user := this.moduleFriend.ModuleUser.GetUser(v.Uid) if user == nil { continue } - userList = append(userList, &pb.FriendBase{ + + base := &pb.FriendBase{ UserId: user.Uid, NickName: user.Name, Level: user.Lv, - }) + } + + // 判断是否在自己的申请列表中 + target := this.moduleFriend.modelFriend.GetFriend(v.Uid) + if target == nil { + continue + } + if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok { + base.IsApplied = true + } + + userList = append(userList, base) } rsp := &pb.FriendRandlistResp{ diff --git a/modules/friend/api_zan.go b/modules/friend/api_zan.go index f4c145c2c..630396200 100644 --- a/modules/friend/api_zan.go +++ b/modules/friend/api_zan.go @@ -38,8 +38,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code } var ( - pointTotal int32 //友情值累加 - optIds []string //本次操作的有效id + pointTotal int32 //友情值累加 ) // 是否已给好友点赞 for _, v := range req.FriendIds { @@ -48,18 +47,19 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code code = pb.ErrorCode_FriendSelfNoData return } - if _, ok := utils.Find(target.ZanIds, selfId); !ok { - optIds = append(optIds, v) - pointTotal += 1 - } - } - //设置被点赞玩家 - if err = this.moduleFriend.modelFriend.Change(target.GetUid(), map[string]interface{}{ - "zanIds": optIds, - }); err != nil { - code = pb.ErrorCode_DBError - return + if _, ok := utils.Find(target.ZanIds, selfId); !ok { + + pointTotal += 1 + target.ZanIds = append(target.ZanIds, selfId) + //设置被点赞玩家 + if err = this.moduleFriend.modelFriend.Change(target.GetUid(), map[string]interface{}{ + "zanIds": target.ZanIds, + }); err != nil { + code = pb.ErrorCode_DBError + return + } + } } //设置友情值 From 2b9711c2c7250ace76cd8d33876c06a940fcabf1 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 18 Aug 2022 20:43:34 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_global.json | 23 ++++++++++++----------- bin/json/game_initial.json | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/bin/json/game_global.json b/bin/json/game_global.json index 53a944206..ed7f0b2c4 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -56,52 +56,52 @@ "duplicate_removal": 1, "base_pool_cost": { "a": "item", - "t": "10001", + "t": "10018", "n": 1 }, "camp1_pool_cost": { "a": "item", - "t": "10002", + "t": "10017", "n": 1 }, "camp2_pool_cost": { "a": "item", - "t": "10003", + "t": "10017", "n": 1 }, "camp3_pool_cost": { "a": "item", - "t": "10004", + "t": "10017", "n": 1 }, "camp4_pool_cost": { "a": "item", - "t": "10005", + "t": "10017", "n": 1 }, "base_pool_10cost": { "a": "item", - "t": "10001", + "t": "10018", "n": 10 }, "camp1_pool_10cost": { "a": "item", - "t": "10002", + "t": "10017", "n": 10 }, "camp2_pool_10cost": { "a": "item", - "t": "10003", + "t": "10017", "n": 10 }, "camp3_pool_10cost": { "a": "item", - "t": "10004", + "t": "10017", "n": 10 }, "camp4_pool_10cost": { "a": "item", - "t": "10005", + "t": "10017", "n": 10 }, "camp1_pool1": "camp1_pool", @@ -139,6 +139,7 @@ "smithy_maxtime": 36000, "chat_expression_small": [ "lt_bq_icon001,lt_bq_icon002,lt_bq_icon003,lt_bq_icon004,lt_bq_icon005,lt_bq_icon006,lt_bq_icon007,lt_bq_icon008,lt_bq_icon009,lt_bq_icon010,lt_bq_icon011,lt_bq_icon012" - ] + ], + "viking_num": 10 } ] \ No newline at end of file diff --git a/bin/json/game_initial.json b/bin/json/game_initial.json index 8d252c886..e6186473c 100644 --- a/bin/json/game_initial.json +++ b/bin/json/game_initial.json @@ -348,5 +348,25 @@ "n": 200 } ] + }, + { + "index": "39", + "var": [ + { + "a": "item", + "t": "10018", + "n": 999 + } + ] + }, + { + "index": "40", + "var": [ + { + "a": "item", + "t": "10017", + "n": 999 + } + ] } ] \ No newline at end of file From 29e1cdac0a176c0e82ee0b270290f0a9e65ac705 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 18 Aug 2022 20:47:20 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A1=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_global.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/json/game_global.json b/bin/json/game_global.json index 045ab8264..ed7f0b2c4 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -56,52 +56,52 @@ "duplicate_removal": 1, "base_pool_cost": { "a": "item", - "t": "10001", + "t": "10018", "n": 1 }, "camp1_pool_cost": { "a": "item", - "t": "10002", + "t": "10017", "n": 1 }, "camp2_pool_cost": { "a": "item", - "t": "10003", + "t": "10017", "n": 1 }, "camp3_pool_cost": { "a": "item", - "t": "10004", + "t": "10017", "n": 1 }, "camp4_pool_cost": { "a": "item", - "t": "10005", + "t": "10017", "n": 1 }, "base_pool_10cost": { "a": "item", - "t": "10001", + "t": "10018", "n": 10 }, "camp1_pool_10cost": { "a": "item", - "t": "10002", + "t": "10017", "n": 10 }, "camp2_pool_10cost": { "a": "item", - "t": "10003", + "t": "10017", "n": 10 }, "camp3_pool_10cost": { "a": "item", - "t": "10004", + "t": "10017", "n": 10 }, "camp4_pool_10cost": { "a": "item", - "t": "10005", + "t": "10017", "n": 10 }, "camp1_pool1": "camp1_pool", @@ -140,6 +140,6 @@ "chat_expression_small": [ "lt_bq_icon001,lt_bq_icon002,lt_bq_icon003,lt_bq_icon004,lt_bq_icon005,lt_bq_icon006,lt_bq_icon007,lt_bq_icon008,lt_bq_icon009,lt_bq_icon010,lt_bq_icon011,lt_bq_icon012" ], - "kungfu_time": 30 + "viking_num": 10 } ] \ No newline at end of file From 5dabbeca17b3cac0cae25891ef5080e9b62442fb Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 18 Aug 2022 21:04:25 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0gui=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/v2/FyneApp.toml | 2 +- cmd/v2/readme.md | 2 +- cmd/v2/service/dbServer.go | 51 ++++++++++++++++++-------------- cmd/v2/ui/app_gen.go | 11 +++---- modules/friend/api_list.go | 2 +- modules/friend/api_zanreceive.go | 23 +++++++------- 6 files changed, 49 insertions(+), 42 deletions(-) diff --git a/cmd/v2/FyneApp.toml b/cmd/v2/FyneApp.toml index 442490eaf..2876f20fb 100644 --- a/cmd/v2/FyneApp.toml +++ b/cmd/v2/FyneApp.toml @@ -5,4 +5,4 @@ Website = "https://legu.com" Name = "RobotGUI" ID = "com.legu.app" Version = "1.0.1" - Build = 7 + Build = 8 diff --git a/cmd/v2/readme.md b/cmd/v2/readme.md index 26f763a91..751aa9add 100644 --- a/cmd/v2/readme.md +++ b/cmd/v2/readme.md @@ -27,7 +27,7 @@ a.SetIcon(resourceFavPng) ## package -fyne package --name robotGUI-1.0.1 -os windows -icon Icon.png +fyne package --name robotGUI-1.0.0 -os windows -icon Icon.png ## 开发协议参数表单 diff --git a/cmd/v2/service/dbServer.go b/cmd/v2/service/dbServer.go index 00386bf3d..7b75de9b5 100644 --- a/cmd/v2/service/dbServer.go +++ b/cmd/v2/service/dbServer.go @@ -16,7 +16,7 @@ import ( type DbService interface { Save(conf *model.GenTool) error Update() error - Get() *model.GenTool + Get(key string) *model.GenTool } type DbServiceImpl struct { @@ -36,17 +36,24 @@ func GetDbService() DbService { func (this *DbServiceImpl) Save(conf *model.GenTool) error { boltDb = GetBoltDb() defer boltDb.Close() - _ = boltDb.Update(func(tx *bolt.Tx) error { + if err := boltDb.Update(func(tx *bolt.Tx) error { b, err2 := json.Marshal(conf) if err2 != nil { return err } - return bucket.Put([]byte(common.BUCKET_CONF), b) - }) + c := tx.Bucket([]byte(common.BOLTDB_BUCKETNAME)) + if c == nil { + return fmt.Errorf("Bucket %s not found!", common.BOLTDB_BUCKETNAME) + } + return c.Put([]byte(common.BUCKET_CONF), b) + }); err != nil { + logrus.Errorf("save err: %v", err) + return err + } return nil } -func (this *DbServiceImpl) Get() *model.GenTool { +func (this *DbServiceImpl) Get(key string) *model.GenTool { boltDb = GetBoltDb() defer boltDb.Close() conf := &model.GenTool{} @@ -56,7 +63,7 @@ func (this *DbServiceImpl) Get() *model.GenTool { return fmt.Errorf("Bucket %s not found!", common.BOLTDB_BUCKETNAME) } - val := c.Get([]byte(common.BUCKET_CONF)) + val := c.Get([]byte(key)) if err := json.Unmarshal(val, conf); err != nil { logrus.Errorf("get gen conf err:%v", err) return err @@ -81,24 +88,24 @@ var ( ) func GetBoltDb() *bolt.DB { - once.Do(func() { - boltDb, err = bolt.Open(common.BOLTDB_NAME, 0600, &bolt.Options{Timeout: 1 * time.Second}) - if err != nil { - log.Fatal(err) - } + // once.Do(func() { + boltDb, err = bolt.Open(common.BOLTDB_NAME, 0600, &bolt.Options{Timeout: 5 * time.Second}) + if err != nil { + log.Fatal(err) + } - boltDb.Update(func(tx *bolt.Tx) error { - b := tx.Bucket([]byte(common.BOLTDB_BUCKETNAME)) - if b != nil { - bucket = b - } else { - bucket, err = tx.CreateBucket([]byte(common.BOLTDB_BUCKETNAME)) - if err != nil { - return fmt.Errorf("create bucket: %s", err) - } + boltDb.Update(func(tx *bolt.Tx) error { + b := tx.Bucket([]byte(common.BOLTDB_BUCKETNAME)) + if b != nil { + bucket = b + } else { + bucket, err = tx.CreateBucket([]byte(common.BOLTDB_BUCKETNAME)) + if err != nil { + return fmt.Errorf("create bucket: %s", err) } - return nil - }) + } + return nil }) + // }) return boltDb } diff --git a/cmd/v2/ui/app_gen.go b/cmd/v2/ui/app_gen.go index 63dc44950..283dfc847 100644 --- a/cmd/v2/ui/app_gen.go +++ b/cmd/v2/ui/app_gen.go @@ -30,7 +30,7 @@ func (this *appGen) LazyInit(obs observer.Observer) error { this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_GEN, theme.ContentCopyIcon(), nil) // load - gt := service.GetDbService().Get() + gt := service.GetDbService().Get(common.BUCKET_CONF) logrus.Debugf("%v", gt) content := container.NewMax() @@ -38,20 +38,20 @@ func (this *appGen) LazyInit(obs observer.Observer) error { serverAddr := widget.NewEntry() serverAddr.PlaceHolder = "服务器地址" - serverAddr.Text = "10.0.1.11" + serverAddr.Text = gt.ServerAddr projectDir := widget.NewEntry() projectDir.PlaceHolder = "项目目录" - projectDir.Text = "E:\\projects\\workspace\\go_dreamfactory" + projectDir.Text = gt.ProjectDir //"E:\\projects\\workspace\\go_dreamfactory" workDir := widget.NewEntry() workDir.PlaceHolder = "LuBan目录" - workDir.Text = "E:\\svn\\dreamworks\\client\\dreamworks\\ExcelFile" + workDir.Text = gt.WorkDir // "E:\\svn\\dreamworks\\client\\dreamworks\\ExcelFile" // client client := widget.NewEntry() client.PlaceHolder = "配置Luban Client.exe路径" - client.Text = "\\Luban.Client\\Luban.Client.exe" + client.Text = gt.Client //"\\Luban.Client\\Luban.Client.exe" //define define := widget.NewEntry() @@ -74,6 +74,7 @@ func (this *appGen) LazyInit(obs observer.Observer) error { genTypeText = s }) genType.PlaceHolder = "生成类型" + genType.Selected = gt.GenType form := widget.NewForm( widget.NewFormItem("服务地址", serverAddr), diff --git a/modules/friend/api_list.go b/modules/friend/api_list.go index 45be5e6b9..7b82e24e7 100644 --- a/modules/friend/api_list.go +++ b/modules/friend/api_list.go @@ -72,7 +72,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (cod } //判断是否已接收获赞 - if _, ok := utils.Findx(self.GetZandIds, userId); ok { + if _, ok := utils.Findx(self.ZanIds, userId); ok { base.IsGetZaned = true } diff --git a/modules/friend/api_zanreceive.go b/modules/friend/api_zanreceive.go index 2f72bdcf5..20fc771b0 100644 --- a/modules/friend/api_zanreceive.go +++ b/modules/friend/api_zanreceive.go @@ -34,26 +34,25 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece } var ( - pointTotal int32 // 累计友情值 - optIds []string //本次有效操作Ids + pointTotal int32 // 累计友情值 + ) // 是否已领取点赞 for _, v := range req.FriendIds { if _, ok := utils.Find(self.GetZandIds, v); !ok { - optIds = append(optIds, v) + + self.GetZandIds = append(self.GetZandIds, v) + pointTotal += 1 } } - for _, v := range optIds { - // 修改获赞Id - if err = this.moduleFriend.modelFriend.Change(v, map[string]interface{}{ - "getZandIds": v, - }); err != nil { - code = pb.ErrorCode_DBError - return - } - pointTotal += 1 + // 修改获赞Id + if err = this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{ + "getZandIds": self.GetZandIds, + }); err != nil { + code = pb.ErrorCode_DBError + return } //设置自己的友情值 From e047f4a8834f18b98f667da033f5a1c7db28f79a Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 Aug 2022 10:17:50 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E7=BB=83=E5=8A=9F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/hero/module.go | 53 +++++++++++++ pb/errorcode.pb.go | 159 +++++++++++++++++++------------------- pb/hero_db.pb.go | 171 ++++++++++++++++++++++++++++------------- 4 files changed, 253 insertions(+), 132 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index c2da4755b..fa30659f3 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -55,7 +55,7 @@ type ( // 英雄加经验 AddHeroExp(session IUserSession, heroObjID string, exp int32) (code pb.ErrorCode) // 英雄练功 - //KungFuHero(session IUserSession, heroObjID string) (code pb.ErrorCode) + KungFuHero(session IUserSession, heroObjID string, bKongfu bool) (code pb.ErrorCode) } //玩家 diff --git a/modules/hero/module.go b/modules/hero/module.go index 47c0bd99a..cb882b8d9 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -246,3 +246,56 @@ func (this *Hero) AddHeroExp(session comm.IUserSession, heroObjID string, exp in session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) return } + +// 英雄练功 +func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongfu bool) (code pb.ErrorCode) { + var ( + _hero *pb.DBHero + newhero *pb.DBHero + _changeHero []*pb.DBHero // 变化的英雄 + ) + _hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID) + if code != pb.ErrorCode_Success { + return + } + if bKongfu && _hero.Status != pb.HeroType_HeroTypeKongFu { + code = pb.ErrorCode_HeroAlreadyKongFuStatus // 已经是练功状态 + return + } + if !bKongfu { + _heroMap := map[string]interface{}{ + "status": pb.HeroType_HeroTypeNil, + } + err1 := this.modelHero.ChangeList(session.GetUserId(), heroObjID, _heroMap) // 修改英雄信息 + if err1 != nil { + this.Errorf("update hero skill failed:%v", err1) + code = pb.ErrorCode_DBError + return + } + return + } + if _hero.SameCount > 1 { + _hero.SameCount -= 1 + newHero := this.modelHero.CloneNewHero(_hero) + _changeHero = append(_changeHero, newHero) + } + _heroMap := map[string]interface{}{ + "status": pb.HeroType_HeroTypeKongFu, + "isOverlying": false, + "sameCount": 1, + } + _hero.SameCount = 1 + err1 := this.modelHero.ChangeList(session.GetUserId(), heroObjID, _heroMap) // 修改英雄信息 + if err1 != nil { + this.Errorf("update hero skill failed:%v", err1) + code = pb.ErrorCode_DBError + return + } + _changeHero = append(_changeHero, _hero) // 升级后的英雄 hero id 不变 + if newhero != nil { + _changeHero = append(_changeHero, newhero) // 原来的英雄 只是数量变化了 + } + _changeHero = append(_changeHero, _hero) + session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) + return +} diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 1c67f8477..d826f7260 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -84,30 +84,31 @@ const ( ErrorCode_ItemsGirdAmountUpper ErrorCode = 1203 //背包格子容量已达上限 ErrorCode_ItemsUseNotSupported ErrorCode = 1204 //暂不支持使用 // hero - ErrorCode_HeroNoExist ErrorCode = 1300 //英雄不存在 - ErrorCode_HeroNoEnough ErrorCode = 1301 //英雄数量不足 - ErrorCode_HeroMaxLv ErrorCode = 1302 //英雄达到最大等级 - ErrorCode_HeroInitCreat ErrorCode = 1303 //初始化英雄 - ErrorCode_HeroColorErr ErrorCode = 1304 // 品质不匹配 - ErrorCode_HeroSkillUpErr ErrorCode = 1305 // 技能升级失败 - ErrorCode_HeroMaxResonate ErrorCode = 1306 // 达到最大共鸣次数 - ErrorCode_HeroNoResonate ErrorCode = 1307 // 没有共鸣 - ErrorCode_HeroNotNeedResonate ErrorCode = 1308 // 不需要重置共鸣 - ErrorCode_HeroNoEnergy ErrorCode = 1309 // 没有能量点数 - ErrorCode_HeroCreate ErrorCode = 1310 // 创建卡失败 - ErrorCode_HeroEquipUpdate ErrorCode = 1311 // 更新装备失败 - ErrorCode_HeroMaxAwaken ErrorCode = 1312 // 达到最大觉醒等级 - ErrorCode_HeroIsLock ErrorCode = 1313 // 英雄被锁定不能被消耗 - ErrorCode_HeroMaxCount ErrorCode = 1314 // 英雄达到最大数量 - ErrorCode_HeroCostTypeErr ErrorCode = 1315 // 消耗英雄参数不匹配 - ErrorCode_HeroStarErr ErrorCode = 1316 // 不满足升星条件 - ErrorCode_HeroTypeErr ErrorCode = 1317 // 升级英雄类型不对 - ErrorCode_HeroExpTypeErr ErrorCode = 1318 // 技能升级卡类型不对 - ErrorCode_HeroAddMaxExp ErrorCode = 1319 // 升级经验卡溢出 检查传入的数量 - ErrorCode_HeroStarLvErr ErrorCode = 1320 // 升星等级不够 - ErrorCode_HeroMaxStarLv ErrorCode = 1321 // 达到最大升星等级 - ErrorCode_DrawCardTypeNotFound ErrorCode = 1322 // 抽卡类型不匹配 - ErrorCode_HeroMaxSkillLv ErrorCode = 1323 // 达到最大技能等级 + ErrorCode_HeroNoExist ErrorCode = 1300 //英雄不存在 + ErrorCode_HeroNoEnough ErrorCode = 1301 //英雄数量不足 + ErrorCode_HeroMaxLv ErrorCode = 1302 //英雄达到最大等级 + ErrorCode_HeroInitCreat ErrorCode = 1303 //初始化英雄 + ErrorCode_HeroColorErr ErrorCode = 1304 // 品质不匹配 + ErrorCode_HeroSkillUpErr ErrorCode = 1305 // 技能升级失败 + ErrorCode_HeroMaxResonate ErrorCode = 1306 // 达到最大共鸣次数 + ErrorCode_HeroNoResonate ErrorCode = 1307 // 没有共鸣 + ErrorCode_HeroNotNeedResonate ErrorCode = 1308 // 不需要重置共鸣 + ErrorCode_HeroNoEnergy ErrorCode = 1309 // 没有能量点数 + ErrorCode_HeroCreate ErrorCode = 1310 // 创建卡失败 + ErrorCode_HeroEquipUpdate ErrorCode = 1311 // 更新装备失败 + ErrorCode_HeroMaxAwaken ErrorCode = 1312 // 达到最大觉醒等级 + ErrorCode_HeroIsLock ErrorCode = 1313 // 英雄被锁定不能被消耗 + ErrorCode_HeroMaxCount ErrorCode = 1314 // 英雄达到最大数量 + ErrorCode_HeroCostTypeErr ErrorCode = 1315 // 消耗英雄参数不匹配 + ErrorCode_HeroStarErr ErrorCode = 1316 // 不满足升星条件 + ErrorCode_HeroTypeErr ErrorCode = 1317 // 升级英雄类型不对 + ErrorCode_HeroExpTypeErr ErrorCode = 1318 // 技能升级卡类型不对 + ErrorCode_HeroAddMaxExp ErrorCode = 1319 // 升级经验卡溢出 检查传入的数量 + ErrorCode_HeroStarLvErr ErrorCode = 1320 // 升星等级不够 + ErrorCode_HeroMaxStarLv ErrorCode = 1321 // 达到最大升星等级 + ErrorCode_DrawCardTypeNotFound ErrorCode = 1322 // 抽卡类型不匹配 + ErrorCode_HeroMaxSkillLv ErrorCode = 1323 // 达到最大技能等级 + ErrorCode_HeroAlreadyKongFuStatus ErrorCode = 1324 // 已经是练功状态 // equipment ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器 ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限 @@ -238,6 +239,7 @@ var ( 1321: "HeroMaxStarLv", 1322: "DrawCardTypeNotFound", 1323: "HeroMaxSkillLv", + 1324: "HeroAlreadyKongFuStatus", 1400: "EquipmentOnFoundEquipment", 1401: "EquipmentLvlimitReached", 1402: "EquipmentIsWorn", @@ -356,6 +358,7 @@ var ( "HeroMaxStarLv": 1321, "DrawCardTypeNotFound": 1322, "HeroMaxSkillLv": 1323, + "HeroAlreadyKongFuStatus": 1324, "EquipmentOnFoundEquipment": 1400, "EquipmentLvlimitReached": 1401, "EquipmentIsWorn": 1402, @@ -425,7 +428,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, 0xb6, 0x13, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xd4, 0x13, 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, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -530,58 +533,60 @@ var file_errorcode_proto_rawDesc = []byte{ 0x4c, 0x76, 0x10, 0xa9, 0x0a, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x72, 0x61, 0x77, 0x43, 0x61, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xaa, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x53, 0x6b, 0x69, 0x6c, 0x6c, - 0x4c, 0x76, 0x10, 0xab, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, - 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, - 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, - 0x10, 0xf9, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, - 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6e, 0x10, 0xfa, 0x0a, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x70, - 0x74, 0x65, 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, - 0x6e, 0x65, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12, 0x15, 0x0a, - 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, - 0x64, 0x10, 0xde, 0x0b, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x50, 0x72, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xdf, 0x0b, 0x12, 0x19, - 0x0a, 0x14, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, - 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe0, 0x0b, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x10, 0xe1, 0x0b, 0x12, 0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, - 0x69, 0x74, 0x10, 0xc0, 0x0c, 0x12, 0x0e, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, - 0x65, 0x74, 0x10, 0xc1, 0x0c, 0x12, 0x0f, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, - 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x10, 0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, - 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc4, 0x0c, 0x12, 0x16, - 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, - 0x75, 0x6e, 0x64, 0x10, 0xc5, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc6, 0x0c, 0x12, - 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, - 0x64, 0x10, 0xc7, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, - 0x73, 0x68, 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x54, - 0x61, 0x67, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xc9, 0x0c, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x61, - 0x73, 0x6b, 0x49, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xca, 0x0c, 0x12, 0x11, 0x0a, 0x0c, - 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xcb, 0x0c, 0x12, - 0x17, 0x0a, 0x12, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x73, 0x53, 0x6f, - 0x6c, 0x64, 0x4f, 0x75, 0x74, 0x10, 0xa4, 0x0d, 0x12, 0x1c, 0x0a, 0x17, 0x53, 0x68, 0x6f, 0x70, - 0x4e, 0x6f, 0x53, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, - 0x4e, 0x75, 0x6d, 0x10, 0xa5, 0x0d, 0x12, 0x0c, 0x0a, 0x07, 0x4d, 0x61, 0x69, 0x6c, 0x45, 0x72, - 0x72, 0x10, 0x88, 0x0e, 0x12, 0x13, 0x0a, 0x0e, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x4e, 0x6f, - 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xec, 0x0e, 0x12, 0x12, 0x0a, 0x0d, 0x50, 0x61, 0x67, - 0x6f, 0x64, 0x61, 0x4c, 0x65, 0x76, 0x6c, 0x45, 0x72, 0x72, 0x10, 0xed, 0x0e, 0x12, 0x17, 0x0a, - 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x45, 0x72, 0x72, 0x10, 0xee, 0x0e, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, - 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x10, 0xef, 0x0e, 0x12, - 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x4e, 0x6f, - 0x74, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xd0, 0x0f, 0x12, 0x15, 0x0a, 0x10, - 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x55, 0x73, 0x65, - 0x10, 0xd1, 0x0f, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, - 0x6c, 0x6c, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xd2, 0x0f, 0x12, 0x19, 0x0a, - 0x14, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x4d, 0x6f, 0x72, 0x65, 0x4f, 0x72, 0x64, 0x65, - 0x72, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xb5, 0x10, 0x12, 0x16, 0x0a, 0x11, 0x47, 0x6f, 0x75, 0x72, - 0x6d, 0x65, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0xb6, 0x10, - 0x12, 0x12, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, - 0x64, 0x10, 0x99, 0x11, 0x12, 0x14, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x55, 0x6e, 0x46, - 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0x9a, 0x11, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4c, 0x76, 0x10, 0xab, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x6c, 0x72, + 0x65, 0x61, 0x64, 0x79, 0x4b, 0x6f, 0x6e, 0x67, 0x46, 0x75, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x10, 0xac, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, + 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, + 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, + 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x73, + 0x57, 0x6f, 0x72, 0x6e, 0x10, 0xfa, 0x0a, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, + 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, + 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, + 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, + 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, + 0xde, 0x0b, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x72, + 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xdf, 0x0b, 0x12, 0x19, 0x0a, 0x14, + 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x52, 0x65, + 0x77, 0x61, 0x72, 0x64, 0x10, 0xe0, 0x0b, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, + 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, + 0x64, 0x10, 0xe1, 0x0b, 0x12, 0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, + 0x10, 0xc0, 0x0c, 0x12, 0x0e, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, + 0x10, 0xc1, 0x0c, 0x12, 0x0f, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, + 0x65, 0x10, 0xc2, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x64, 0x10, 0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc4, 0x0c, 0x12, 0x16, 0x0a, 0x11, + 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, + 0x64, 0x10, 0xc5, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x4e, 0x6f, 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc6, 0x0c, 0x12, 0x13, 0x0a, + 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, + 0xc7, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, + 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xc9, 0x0c, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, + 0x49, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xca, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, + 0x73, 0x6b, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xcb, 0x0c, 0x12, 0x17, 0x0a, + 0x12, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x73, 0x53, 0x6f, 0x6c, 0x64, + 0x4f, 0x75, 0x74, 0x10, 0xa4, 0x0d, 0x12, 0x1c, 0x0a, 0x17, 0x53, 0x68, 0x6f, 0x70, 0x4e, 0x6f, + 0x53, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75, + 0x6d, 0x10, 0xa5, 0x0d, 0x12, 0x0c, 0x0a, 0x07, 0x4d, 0x61, 0x69, 0x6c, 0x45, 0x72, 0x72, 0x10, + 0x88, 0x0e, 0x12, 0x13, 0x0a, 0x0e, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x4e, 0x6f, 0x74, 0x46, + 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xec, 0x0e, 0x12, 0x12, 0x0a, 0x0d, 0x50, 0x61, 0x67, 0x6f, 0x64, + 0x61, 0x4c, 0x65, 0x76, 0x6c, 0x45, 0x72, 0x72, 0x10, 0xed, 0x0e, 0x12, 0x17, 0x0a, 0x12, 0x50, + 0x61, 0x67, 0x6f, 0x64, 0x61, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x72, + 0x72, 0x10, 0xee, 0x0e, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x43, 0x6f, + 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x10, 0xef, 0x0e, 0x12, 0x1b, 0x0a, + 0x16, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x55, + 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xd0, 0x0f, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, + 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x55, 0x73, 0x65, 0x10, 0xd1, + 0x0f, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, + 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xd2, 0x0f, 0x12, 0x19, 0x0a, 0x14, 0x47, + 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x4d, 0x6f, 0x72, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, + 0x69, 0x6d, 0x65, 0x10, 0xb5, 0x10, 0x12, 0x16, 0x0a, 0x11, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, + 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0xb6, 0x10, 0x12, 0x12, + 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, + 0x99, 0x11, 0x12, 0x14, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x55, 0x6e, 0x46, 0x69, 0x6e, + 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0x9a, 0x11, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/hero_db.pb.go b/pb/hero_db.pb.go index 412337e60..372b05636 100644 --- a/pb/hero_db.pb.go +++ b/pb/hero_db.pb.go @@ -20,6 +20,52 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type HeroType int32 + +const ( + HeroType_HeroTypeNil HeroType = 0 + HeroType_HeroTypeKongFu HeroType = 1 +) + +// Enum value maps for HeroType. +var ( + HeroType_name = map[int32]string{ + 0: "HeroTypeNil", + 1: "HeroTypeKongFu", + } + HeroType_value = map[string]int32{ + "HeroTypeNil": 0, + "HeroTypeKongFu": 1, + } +) + +func (x HeroType) Enum() *HeroType { + p := new(HeroType) + *p = x + return p +} + +func (x HeroType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HeroType) Descriptor() protoreflect.EnumDescriptor { + return file_hero_hero_db_proto_enumTypes[0].Descriptor() +} + +func (HeroType) Type() protoreflect.EnumType { + return &file_hero_hero_db_proto_enumTypes[0] +} + +func (x HeroType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use HeroType.Descriptor instead. +func (HeroType) EnumDescriptor() ([]byte, []int) { + return file_hero_hero_db_proto_rawDescGZIP(), []int{0} +} + type SkillData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -105,6 +151,7 @@ type DBHero struct { IsOverlying bool `protobuf:"varint,23,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true EnergyProperty map[string]int32 `protobuf:"bytes,24,rep,name=energyProperty,proto3" json:"energyProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"energyProperty"` // JuexProperty map[string]int32 `protobuf:"bytes,25,rep,name=juexProperty,proto3" json:"juexProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"juexProperty"` ////hp + Status HeroType `protobuf:"varint,26,opt,name=status,proto3,enum=HeroType" json:"status"` // 状态 (1 练功) } func (x *DBHero) Reset() { @@ -314,6 +361,13 @@ func (x *DBHero) GetJuexProperty() map[string]int32 { return nil } +func (x *DBHero) GetStatus() HeroType { + if x != nil { + return x.Status + } + return HeroType_HeroTypeNil +} + type Floor struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -465,7 +519,7 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x61, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6b, - 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x22, 0x90, 0x09, 0x0a, 0x06, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, + 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x22, 0xb3, 0x09, 0x0a, 0x06, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 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, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, @@ -518,40 +572,45 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x0c, 0x6a, 0x75, 0x65, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x2e, 0x4a, 0x75, 0x65, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, - 0x6a, 0x75, 0x65, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65, - 0x72, 0x67, 0x79, 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, 0x41, 0x0a, 0x13, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x6a, 0x75, 0x65, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x21, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x48, + 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, + 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x3e, 0x0a, 0x10, + 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x39, 0x0a, 0x0b, + 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 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, 0x3f, 0x0a, 0x11, 0x4a, 0x75, 0x65, 0x78, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x22, 0x27, 0x0a, 0x05, 0x46, 0x6c, 0x6f, 0x6f, - 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x34, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x68, - 0x34, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x35, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x68, - 0x35, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x63, 0x6f, - 0x72, 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, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x34, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x34, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x35, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x35, - 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x72, 0x61, 0x77, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x72, 0x61, 0x77, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x41, 0x0a, 0x13, 0x45, 0x6e, 0x65, 0x72, 0x67, + 0x79, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x3f, 0x0a, 0x11, 0x4a, 0x75, + 0x65, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x22, 0x27, 0x0a, 0x05, 0x46, + 0x6c, 0x6f, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x34, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x02, 0x68, 0x34, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x35, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x02, 0x68, 0x35, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, + 0x65, 0x63, 0x6f, 0x72, 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, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x34, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x34, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x35, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x35, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x72, 0x61, + 0x77, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x72, + 0x61, 0x77, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x2f, 0x0a, 0x08, 0x48, 0x65, 0x72, 0x6f, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4e, + 0x69, 0x6c, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, + 0x4b, 0x6f, 0x6e, 0x67, 0x46, 0x75, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -566,30 +625,33 @@ func file_hero_hero_db_proto_rawDescGZIP() []byte { return file_hero_hero_db_proto_rawDescData } +var file_hero_hero_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_hero_hero_db_proto_goTypes = []interface{}{ - (*SkillData)(nil), // 0: SkillData - (*DBHero)(nil), // 1: DBHero - (*Floor)(nil), // 2: Floor - (*DBHeroRecord)(nil), // 3: DBHeroRecord - nil, // 4: DBHero.PropertyEntry - nil, // 5: DBHero.AddPropertyEntry - nil, // 6: DBHero.EnergyEntry - nil, // 7: DBHero.EnergyPropertyEntry - nil, // 8: DBHero.JuexPropertyEntry + (HeroType)(0), // 0: HeroType + (*SkillData)(nil), // 1: SkillData + (*DBHero)(nil), // 2: DBHero + (*Floor)(nil), // 3: Floor + (*DBHeroRecord)(nil), // 4: DBHeroRecord + nil, // 5: DBHero.PropertyEntry + nil, // 6: DBHero.AddPropertyEntry + nil, // 7: DBHero.EnergyEntry + nil, // 8: DBHero.EnergyPropertyEntry + nil, // 9: DBHero.JuexPropertyEntry } var file_hero_hero_db_proto_depIdxs = []int32{ - 0, // 0: DBHero.normalSkill:type_name -> SkillData - 4, // 1: DBHero.property:type_name -> DBHero.PropertyEntry - 5, // 2: DBHero.addProperty:type_name -> DBHero.AddPropertyEntry - 6, // 3: DBHero.energy:type_name -> DBHero.EnergyEntry - 7, // 4: DBHero.energyProperty:type_name -> DBHero.EnergyPropertyEntry - 8, // 5: DBHero.juexProperty:type_name -> DBHero.JuexPropertyEntry - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 1, // 0: DBHero.normalSkill:type_name -> SkillData + 5, // 1: DBHero.property:type_name -> DBHero.PropertyEntry + 6, // 2: DBHero.addProperty:type_name -> DBHero.AddPropertyEntry + 7, // 3: DBHero.energy:type_name -> DBHero.EnergyEntry + 8, // 4: DBHero.energyProperty:type_name -> DBHero.EnergyPropertyEntry + 9, // 5: DBHero.juexProperty:type_name -> DBHero.JuexPropertyEntry + 0, // 6: DBHero.status:type_name -> HeroType + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_hero_hero_db_proto_init() } @@ -652,13 +714,14 @@ func file_hero_hero_db_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_hero_hero_db_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 9, NumExtensions: 0, NumServices: 0, }, GoTypes: file_hero_hero_db_proto_goTypes, DependencyIndexes: file_hero_hero_db_proto_depIdxs, + EnumInfos: file_hero_hero_db_proto_enumTypes, MessageInfos: file_hero_hero_db_proto_msgTypes, }.Build() File_hero_hero_db_proto = out.File From 0f353172204d8c15f76f3018693e84bd9f3f5e08 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 Aug 2022 10:21:54 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E7=BB=83=E5=8A=9F=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index cb882b8d9..700b720f9 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -258,7 +258,7 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf if code != pb.ErrorCode_Success { return } - if bKongfu && _hero.Status != pb.HeroType_HeroTypeKongFu { + if bKongfu && _hero.Status == pb.HeroType_HeroTypeKongFu { code = pb.ErrorCode_HeroAlreadyKongFuStatus // 已经是练功状态 return } @@ -272,6 +272,9 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf code = pb.ErrorCode_DBError return } + _hero.Status = pb.HeroType_HeroTypeNil + _changeHero = append(_changeHero, _hero) + session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) return } if _hero.SameCount > 1 { From 703039326ef2e9ced2958ec8b5bb6a319d66902b Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 Aug 2022 12:04:30 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A1=A8=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sys/configure/structs/game.globalData.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/configure/structs/game.globalData.go b/sys/configure/structs/game.globalData.go index 083b33bfb..bfe394df0 100644 --- a/sys/configure/structs/game.globalData.go +++ b/sys/configure/structs/game.globalData.go @@ -72,7 +72,7 @@ type GameGlobalData struct { SmithyMaxplayer int32 SmithyMaxtime int32 ChatExpressionSmall []string - KungfuTime int32 + VikingNum int32 } const TypeId_GameGlobalData = 477542761 @@ -221,7 +221,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["kungfu_time"].(float64); !_ok_ { err = errors.New("kungfu_time error"); return }; _v.KungfuTime = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["viking_num"].(float64); !_ok_ { err = errors.New("viking_num error"); return }; _v.VikingNum = int32(_tempNum_) } return } From f05347cc2fabf8ce56c6949fa8f8a4b679128e6b Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Fri, 19 Aug 2022 12:06:04 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/v2/resources/config.yaml | 2 +- cmd/v2/ui/app_gen.go | 13 ++++++----- modules/comp_configure.go | 2 ++ modules/friend/api_addblack.go | 8 ++++++- modules/friend/api_apply.go | 10 +++++++-- modules/friend/api_randlist.go | 36 +++++++++++++++++++++---------- modules/friend/api_zan.go | 10 +++++++-- modules/friend/api_zanreceive.go | 9 ++++++-- utils/random.go | 37 ++++++++++++++++++++++++++++++++ utils/utils_test.go | 4 ++++ 10 files changed, 107 insertions(+), 24 deletions(-) diff --git a/cmd/v2/resources/config.yaml b/cmd/v2/resources/config.yaml index c53bb3846..7003e83e5 100644 --- a/cmd/v2/resources/config.yaml +++ b/cmd/v2/resources/config.yaml @@ -9,7 +9,7 @@ services: name: 赵长远 url: ws://10.0.0.238:7891/gateway - service: - sid: 3 + sid: "df01" name: 内网 url: ws://10.0.0.9:7891/gateway - service: diff --git a/cmd/v2/ui/app_gen.go b/cmd/v2/ui/app_gen.go index 283dfc847..f0b3a06ef 100644 --- a/cmd/v2/ui/app_gen.go +++ b/cmd/v2/ui/app_gen.go @@ -38,20 +38,16 @@ func (this *appGen) LazyInit(obs observer.Observer) error { serverAddr := widget.NewEntry() serverAddr.PlaceHolder = "服务器地址" - serverAddr.Text = gt.ServerAddr projectDir := widget.NewEntry() projectDir.PlaceHolder = "项目目录" - projectDir.Text = gt.ProjectDir //"E:\\projects\\workspace\\go_dreamfactory" workDir := widget.NewEntry() workDir.PlaceHolder = "LuBan目录" - workDir.Text = gt.WorkDir // "E:\\svn\\dreamworks\\client\\dreamworks\\ExcelFile" // client client := widget.NewEntry() client.PlaceHolder = "配置Luban Client.exe路径" - client.Text = gt.Client //"\\Luban.Client\\Luban.Client.exe" //define define := widget.NewEntry() @@ -74,7 +70,14 @@ func (this *appGen) LazyInit(obs observer.Observer) error { genTypeText = s }) genType.PlaceHolder = "生成类型" - genType.Selected = gt.GenType + + if gt != nil { + serverAddr.Text = gt.ServerAddr //10.0.1.11 + projectDir.Text = gt.ProjectDir //"E:\\projects\\workspace\\go_dreamfactory" + workDir.Text = gt.WorkDir // "E:\\svn\\dreamworks\\client\\dreamworks\\ExcelFile" + client.Text = gt.Client //"\\Luban.Client\\Luban.Client.exe" + genType.Selected = gt.GenType + } form := widget.NewForm( widget.NewFormItem("服务地址", serverAddr), diff --git a/modules/comp_configure.go b/modules/comp_configure.go index 6ec99b3df..9ecd17246 100644 --- a/modules/comp_configure.go +++ b/modules/comp_configure.go @@ -61,9 +61,11 @@ func (this *MCompConfigure) GetGlobalConf() *cfg.GameGlobalData { ) if v, err := this.GetConfigure(game_global); err != nil { log.Errorf("get global conf err:%v", err) + return nil } else { if configure, ok = v.(*cfg.GameGlobal); !ok { log.Errorf("%T no is *cfg.Game_global", v) + return nil } } return configure.GetDataList()[0] // 返回对象信息 diff --git a/modules/friend/api_addblack.go b/modules/friend/api_addblack.go index 06c0613cf..527f201eb 100644 --- a/modules/friend/api_addblack.go +++ b/modules/friend/api_addblack.go @@ -21,6 +21,12 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR return } + globalCnf := this.moduleFriend.configure.GetGlobalConf() + if globalCnf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + var ( err error self *pb.DBFriend @@ -70,7 +76,7 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR } // 判断是否黑名单人数已满 - if len(self.BlackIds) >= int(this.moduleFriend.configure.GetGlobalConf().FriendBlack) { + if len(self.BlackIds) >= int(globalCnf.FriendBlack) { code = pb.ErrorCode_FriendBlackMax return } diff --git a/modules/friend/api_apply.go b/modules/friend/api_apply.go index 388b3bf84..80e05d166 100644 --- a/modules/friend/api_apply.go +++ b/modules/friend/api_apply.go @@ -21,6 +21,12 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success { return } + + globalCnf := this.moduleFriend.configure.GetGlobalConf() + if globalCnf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } var ( err error @@ -63,13 +69,13 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c } //判断是否超过最大好友数量 - if len(self.FriendIds) >= int(this.moduleFriend.configure.GetGlobalConf().FriendMaxnum) { + if len(self.FriendIds) >= int(globalCnf.FriendMaxnum) { code = pb.ErrorCode_FriendSelfMax return } //判断对方是否也超过最大好友数量 - if len(target.FriendIds) >= int(this.moduleFriend.configure.GetGlobalConf().FriendMaxnum) { + if len(target.FriendIds) >= int(globalCnf.FriendMaxnum) { code = pb.ErrorCode_FriendTargetMax return } diff --git a/modules/friend/api_randlist.go b/modules/friend/api_randlist.go index 74f029ce5..230063655 100644 --- a/modules/friend/api_randlist.go +++ b/modules/friend/api_randlist.go @@ -1,6 +1,7 @@ package friend import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" "go_dreamfactory/utils" @@ -23,6 +24,14 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR return } + // 只随机选择5个在线玩家 + // var randOnlineUsers []string + if len(cu) > 5 { + fmt.Println(utils.Numbers(0, len(cu), 5)) + + } + + // 当前玩家好友数据 self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId()) if self == nil { code = pb.ErrorCode_FriendSelfNoData @@ -30,32 +39,37 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR } var userList []*pb.FriendBase + for _, v := range cu { + // 将自己从在线玩家中过滤掉 if v.Uid == session.GetUserId() { continue } + // 将自己的好友从在线玩家中过滤掉 if _, ok := utils.Findx(self.FriendIds, v.Uid); ok { continue } - // if _, ok := utils.Findx(self.ApplyIds, v.Uid); ok { - // continue - // } + + // 判断当前在线好友是否在自己的申请列表中,如果存在也过滤掉 + target := this.moduleFriend.modelFriend.GetFriend(v.Uid) + if target == nil { + continue + } + + // 获取在线好友的信息 user := this.moduleFriend.ModuleUser.GetUser(v.Uid) if user == nil { continue } base := &pb.FriendBase{ - UserId: user.Uid, - NickName: user.Name, - Level: user.Lv, + UserId: user.Uid, + NickName: user.Name, + Level: user.Lv, + OfflineTime: user.Offlinetime, } - // 判断是否在自己的申请列表中 - target := this.moduleFriend.modelFriend.GetFriend(v.Uid) - if target == nil { - continue - } + // 申请过的在线好友,设置申请状态 if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok { base.IsApplied = true } diff --git a/modules/friend/api_zan.go b/modules/friend/api_zan.go index 630396200..bf8fb332c 100644 --- a/modules/friend/api_zan.go +++ b/modules/friend/api_zan.go @@ -27,6 +27,12 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code selfId string ) + globalCnf := this.moduleFriend.configure.GetGlobalConf() + if globalCnf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + selfId = session.GetUserId() // 不能给自己点赞 @@ -49,7 +55,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code } if _, ok := utils.Find(target.ZanIds, selfId); !ok { - + pointTotal += 1 target.ZanIds = append(target.ZanIds, selfId) //设置被点赞玩家 @@ -70,7 +76,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code } // 今日送出的友情点是否达到上限 - if ue.FriendPointOD >= this.moduleFriend.configure.GetGlobalConf().FriendMaxsendnum { + if ue.FriendPointOD >= globalCnf.FriendMaxsendnum { code = pb.ErrorCode_FriendPointLimit return } diff --git a/modules/friend/api_zanreceive.go b/modules/friend/api_zanreceive.go index 20fc771b0..84a216162 100644 --- a/modules/friend/api_zanreceive.go +++ b/modules/friend/api_zanreceive.go @@ -22,6 +22,12 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece return } + globalCnf := this.moduleFriend.configure.GetGlobalConf() + if globalCnf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + var ( self *pb.DBFriend err error @@ -35,7 +41,6 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece var ( pointTotal int32 // 累计友情值 - ) // 是否已领取点赞 @@ -63,7 +68,7 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece } // 今日获赠的友情点是否达到上限 - if ue.FriendPointID >= int32(this.moduleFriend.configure.GetGlobalConf().FriendMaxgetnum) { + if ue.FriendPointID >= int32(globalCnf.FriendMaxgetnum) { code = pb.ErrorCode_FriendPointLimit return } diff --git a/utils/random.go b/utils/random.go index 4251724e6..ff865793d 100644 --- a/utils/random.go +++ b/utils/random.go @@ -5,6 +5,8 @@ import ( "math/rand" "strings" "time" + + "github.com/Pallinder/go-randomdata" ) func GenValidateCode(width int) string { @@ -18,3 +20,38 @@ func GenValidateCode(width int) string { } return sb.String() } + +// 随机一组随机数 +// number >= start and < end num 随机数个数 +func Numbers(start, end, num int) []int { + if end-start < 0 || num > (end-start) { + return nil + } + + if end-start == 1 { + n := randomdata.Number(start, end) + return []int{n} + } + + var i int + arr := make([]int, num) + boo := make(map[int]int) + for { + if i == num { + break + } + + var n int + n = randomdata.Number(start, end) + if _, ok := boo[n]; ok { + // 重新生成 + n = randomdata.Number(start, end) + continue + } + boo[n] = i + arr[i] = n + i++ + } + + return arr +} diff --git a/utils/utils_test.go b/utils/utils_test.go index 664150a53..954317870 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -20,3 +20,7 @@ func TestSubTime(t *testing.T) { func TestRandom(t *testing.T) { fmt.Println(utils.GenValidateCode(6)) } + +func TestNumber(t *testing.T) { + fmt.Println(utils.Numbers(5, 10, 5)) +} From 50408695ca1eec6972643716ba6989bc9c120221 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 Aug 2022 12:09:40 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_com.json | 23 ++++++++++++----------- bin/json/game_global.json | 5 +++-- sys/configure/structs/game.globalData.go | 2 ++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/bin/json/game_com.json b/bin/json/game_com.json index 045ab8264..93dac2336 100644 --- a/bin/json/game_com.json +++ b/bin/json/game_com.json @@ -56,52 +56,52 @@ "duplicate_removal": 1, "base_pool_cost": { "a": "item", - "t": "10001", + "t": "10018", "n": 1 }, "camp1_pool_cost": { "a": "item", - "t": "10002", + "t": "10017", "n": 1 }, "camp2_pool_cost": { "a": "item", - "t": "10003", + "t": "10017", "n": 1 }, "camp3_pool_cost": { "a": "item", - "t": "10004", + "t": "10017", "n": 1 }, "camp4_pool_cost": { "a": "item", - "t": "10005", + "t": "10017", "n": 1 }, "base_pool_10cost": { "a": "item", - "t": "10001", + "t": "10018", "n": 10 }, "camp1_pool_10cost": { "a": "item", - "t": "10002", + "t": "10017", "n": 10 }, "camp2_pool_10cost": { "a": "item", - "t": "10003", + "t": "10017", "n": 10 }, "camp3_pool_10cost": { "a": "item", - "t": "10004", + "t": "10017", "n": 10 }, "camp4_pool_10cost": { "a": "item", - "t": "10005", + "t": "10017", "n": 10 }, "camp1_pool1": "camp1_pool", @@ -134,12 +134,13 @@ "camp_pool_star3": 9000, "camp_pool_star4": 900, "camp_pool_star5": 100, - "gourmet": 500, + "gourmet": 3600, "smithy_maxplayer": 20, "smithy_maxtime": 36000, "chat_expression_small": [ "lt_bq_icon001,lt_bq_icon002,lt_bq_icon003,lt_bq_icon004,lt_bq_icon005,lt_bq_icon006,lt_bq_icon007,lt_bq_icon008,lt_bq_icon009,lt_bq_icon010,lt_bq_icon011,lt_bq_icon012" ], + "viking_num": 10, "kungfu_time": 30 } ] \ No newline at end of file diff --git a/bin/json/game_global.json b/bin/json/game_global.json index ed7f0b2c4..93dac2336 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -134,12 +134,13 @@ "camp_pool_star3": 9000, "camp_pool_star4": 900, "camp_pool_star5": 100, - "gourmet": 500, + "gourmet": 3600, "smithy_maxplayer": 20, "smithy_maxtime": 36000, "chat_expression_small": [ "lt_bq_icon001,lt_bq_icon002,lt_bq_icon003,lt_bq_icon004,lt_bq_icon005,lt_bq_icon006,lt_bq_icon007,lt_bq_icon008,lt_bq_icon009,lt_bq_icon010,lt_bq_icon011,lt_bq_icon012" ], - "viking_num": 10 + "viking_num": 10, + "kungfu_time": 30 } ] \ No newline at end of file diff --git a/sys/configure/structs/game.globalData.go b/sys/configure/structs/game.globalData.go index bfe394df0..035505745 100644 --- a/sys/configure/structs/game.globalData.go +++ b/sys/configure/structs/game.globalData.go @@ -73,6 +73,7 @@ type GameGlobalData struct { SmithyMaxtime int32 ChatExpressionSmall []string VikingNum int32 + KungfuTime int32 } const TypeId_GameGlobalData = 477542761 @@ -222,6 +223,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["viking_num"].(float64); !_ok_ { err = errors.New("viking_num error"); return }; _v.VikingNum = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["kungfu_time"].(float64); !_ok_ { err = errors.New("kungfu_time error"); return }; _v.KungfuTime = int32(_tempNum_) } return }