From 91a9c65d03c57b6079da63c7edd143fe29935499 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 28 Nov 2022 14:29:24 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/comm/const.go b/comm/const.go index 0d95dc788..cf9706701 100644 --- a/comm/const.go +++ b/comm/const.go @@ -546,16 +546,16 @@ const ( ChatSystem3 ChatSystemType = 3 ///装备升级公告 ChatSystem4 ChatSystemType = 4 ///爬塔公告 ChatSystem5 ChatSystemType = 5 ///停机维护公告 - ChatSystem10 ChatSystemType = 6 ///通关了赛季塔 【玩家名称】通关了赛季塔50层! - ChatSystem11 ChatSystemType = 7 ///英雄升级 【玩家名称】已将【英雄名称】培养至60级! - ChatSystem12 ChatSystemType = 8 ///英雄升星 【玩家名称】已将【英雄名称】培养至6星! - ChatSystem13 ChatSystemType = 9 ///英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级! - ChatSystem14 ChatSystemType = 10 ///英雄共鸣 【玩家名称】已将【英雄名称】共鸣至满级! - ChatSystem15 ChatSystemType = 11 ///英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级! - ChatSystem16 ChatSystemType = 12 ///玩家升级 【玩家名称】达到了60级! - ChatSystem17 ChatSystemType = 13 ///英雄招募 【玩家名称】在招募中获得了【英雄名称】! - ChatSystem18 ChatSystemType = 14 ///维京远征 【玩家名称】通关了火焰泰坦难度16! - ChatSystem24 ChatSystemType = 15 ///狩猎 【玩家名称】通关了巨型猩猩难度8! + ChatSystem6 ChatSystemType = 6 ///通关了赛季塔 【玩家名称】通关了赛季塔50层! + ChatSystem7 ChatSystemType = 7 ///英雄升级 【玩家名称】已将【英雄名称】培养至60级! + ChatSystem8 ChatSystemType = 8 ///英雄升星 【玩家名称】已将【英雄名称】培养至6星! + ChatSystem9 ChatSystemType = 9 ///英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级! + ChatSystem10 ChatSystemType = 10 ///英雄共鸣 【玩家名称】已将【英雄名称】共鸣至满级! + ChatSystem11 ChatSystemType = 11 ///英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级! + ChatSystem12 ChatSystemType = 12 ///玩家升级 【玩家名称】达到了60级! + ChatSystem13 ChatSystemType = 13 ///英雄招募 【玩家名称】在招募中获得了【英雄名称】! + ChatSystem14 ChatSystemType = 14 ///维京远征 【玩家名称】通关了火焰泰坦难度16! + ChatSystem15 ChatSystemType = 15 ///狩猎 【玩家名称】通关了巨型猩猩难度8! ) // 巨兽列车 From 60d8ec19b2e366c123d869f0096d3c6f48df0acd Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Mon, 28 Nov 2022 14:50:44 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E7=AD=89=E7=BA=A7?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E5=85=AC=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/user/model_user.go | 10 ++++++++++ modules/user/module.go | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/user/model_user.go b/modules/user/model_user.go index 9151b522c..2e50439ce 100644 --- a/modules/user/model_user.go +++ b/modules/user/model_user.go @@ -192,6 +192,15 @@ func (this *ModelUser) ChangeLevel(event interface{}, next func(event interface{ ul.session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush, &pb.UserLvChangedPush{Uid: ul.session.GetUserId(), Exp: ul.exp, Lv: ul.lv}) this.module.DispenseRes(ul.session, rewards, true) + + mc, err := this.module.service.GetModule(comm.ModuleChat) + if err != nil { + return + } + if chat, ok := mc.(comm.IChat); ok { + chat.SendSysChatToUser(ul.session, comm.ChatSystem12, ul.lv, 0, ul.name) + } + } } @@ -202,4 +211,5 @@ type UserListen struct { session comm.IUserSession exp int64 lv int32 + name string } diff --git a/modules/user/module.go b/modules/user/module.go index 1d6727efa..2eac87352 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -246,7 +246,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha userEx *pb.DBUserExpand err error ) - + user = this.GetUser(uid) userEx, err = this.GetUserExpand(uid) if err != nil { @@ -409,6 +409,7 @@ func (this *User) EventUserChanged(session comm.IUserSession) { ul.session = session ul.exp = user.Exp ul.lv = user.Lv + ul.name = user.Name } this.modelUser.EventApp.Dispatch(comm.EventUserChanged, ul) } From 016124983bf37232cdbab828dafdf0e90fa4ff6d Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 28 Nov 2022 15:26:39 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=88=98=E6=96=97?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=A4=9A=E8=8A=82=E7=82=B9=E8=B4=9F=E8=BD=BD?= =?UTF-8?q?=E5=9D=87=E8=A1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/battle/{client.go => clients.go} | 58 +++++++++++++++++------- modules/battle/options.go | 4 +- 2 files changed, 43 insertions(+), 19 deletions(-) rename modules/battle/{client.go => clients.go} (68%) diff --git a/modules/battle/client.go b/modules/battle/clients.go similarity index 68% rename from modules/battle/client.go rename to modules/battle/clients.go index d9905a80d..52c45c181 100644 --- a/modules/battle/client.go +++ b/modules/battle/clients.go @@ -7,6 +7,7 @@ import ( "sync" "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "github.com/gorilla/websocket" "google.golang.org/protobuf/proto" @@ -18,13 +19,11 @@ import ( */ type clientComp struct { modules.MCompGate - options *Options - service core.IService - module *Battle - conn *websocket.Conn - seq uint64 - pendingmutex sync.Mutex - pending map[uint64]*MessageCall //高并发回调 + options *Options + service core.IService + module *Battle + clinets []*client + i int } //组件初始化接口 @@ -32,19 +31,44 @@ func (this *clientComp) Init(service core.IService, module core.IModule, comp co this.MCompGate.Init(service, module, comp, options) this.options = options.(*Options) this.module = module.(*Battle) - this.pending = make(map[uint64]*MessageCall) + this.clinets = make([]*client, len(this.options.BattleServerAddr)) return } func (this *clientComp) Start() (err error) { err = this.MCompGate.Start() - dialer := websocket.Dialer{} - this.conn, _, err = dialer.Dial(this.options.BattleServerAddr, nil) + for i, v := range this.options.BattleServerAddr { + if this.clinets[i], err = newClient(v, this.options.Log); err != nil { + return + } + } return } -//校验战斗过程 func (this *clientComp) callBattle(ctx context.Context, method string, req proto.Message, reply proto.Message) (err error) { + i := this.i % len(this.clinets) + this.i += 1 + err = this.clinets[i].callBattle(ctx, method, req, reply) + return +} + +func newClient(addr string, log log.ILogger) (c *client, err error) { + c = &client{log: log, pending: make(map[uint64]*MessageCall)} + dialer := websocket.Dialer{} + c.conn, _, err = dialer.Dial(addr, nil) + return +} + +type client struct { + log log.ILogger + conn *websocket.Conn + seq uint64 + pendingmutex sync.Mutex + pending map[uint64]*MessageCall //高并发回调 +} + +//校验战斗过程 +func (this *client) callBattle(ctx context.Context, method string, req proto.Message, reply proto.Message) (err error) { call := new(MessageCall) call.Done = make(chan *MessageCall, 10) call.Args = req @@ -74,7 +98,7 @@ func (this *clientComp) callBattle(ctx context.Context, method string, req proto this.pendingmutex.Unlock() if call != nil { call.Error = ctx.Err() - call.done(this.options.Log) + call.done(this.log) } return ctx.Err() case call := <-call.Done: @@ -83,7 +107,7 @@ func (this *clientComp) callBattle(ctx context.Context, method string, req proto return } -func (this *clientComp) run() { +func (this *client) run() { var ( data []byte msg *pb.BattleRpcMessage = &pb.BattleRpcMessage{} @@ -92,23 +116,23 @@ func (this *clientComp) run() { locp: for { if _, data, err = this.conn.ReadMessage(); err != nil { - this.module.Errorf("client err:%v", err) + this.log.Errorf("client err:%v", err) break locp } if err = proto.Unmarshal(data, msg); err != nil { - this.module.Errorf("client Unmarshal err:%v", err) + this.log.Errorf("client Unmarshal err:%v", err) break locp } go this.handleresponse(msg) } } -func (this *clientComp) handleresponse(resp *pb.BattleRpcMessage) { +func (this *client) handleresponse(resp *pb.BattleRpcMessage) { var call *MessageCall this.pendingmutex.Lock() call = this.pending[resp.Rid] delete(this.pending, resp.Rid) this.pendingmutex.Unlock() call.Error = resp.Data.UnmarshalTo(call.Reply) - call.done(this.options.Log) + call.done(this.log) } diff --git a/modules/battle/options.go b/modules/battle/options.go index 334bc85cd..5ec21b43c 100644 --- a/modules/battle/options.go +++ b/modules/battle/options.go @@ -13,7 +13,7 @@ type ( } Options struct { modules.Options - BattleServerAddr string + BattleServerAddr []string } ) @@ -25,7 +25,7 @@ func (this *Options) GetLog() log.ILogger { return this.Log } -func (this *Options) GetBattleServerAddr() string { +func (this *Options) GetBattleServerAddr() []string { return this.BattleServerAddr } From 3ae9372f52a5382cfb15e708c484cf253c665c41 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 28 Nov 2022 15:32:36 +0800 Subject: [PATCH 4/7] =?UTF-8?q?1.=E5=85=AC=E5=91=8A=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81=202.=E7=BB=B4=E4=BA=AC=E7=BA=A2=E7=82=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 1 + comm/imodule.go | 2 ++ modules/hero/api.go | 8 +++++++- modules/hero/api_awaken.go | 8 ++++++++ modules/hero/api_drawCard.go | 8 ++++++++ modules/hero/api_resonance.go | 6 ++++++ modules/hero/api_strengthenUpSkill.go | 8 +++++++- modules/hero/api_strengthenUpStar.go | 6 ++++++ modules/hero/api_strengthenUplv.go | 6 ++++++ modules/hunting/api.go | 5 +++++ modules/hunting/api_challenge.go | 6 +++++- modules/pagoda/api_challengeover.go | 5 +++++ modules/viking/api.go | 6 ++++++ modules/viking/api_challengeover.go | 6 +++++- modules/viking/model_viking.go | 12 ++++++++++++ modules/viking/module.go | 14 ++++++++++++++ 16 files changed, 103 insertions(+), 4 deletions(-) diff --git a/comm/const.go b/comm/const.go index cf9706701..87a56cf4a 100644 --- a/comm/const.go +++ b/comm/const.go @@ -336,6 +336,7 @@ const ( Reddot28 ReddotType = 10028 //任务----周常活跃奖励红点 Reddot29 ReddotType = 10029 //公会----申请红点 Reddot30 ReddotType = 10030 //邮件-----未读邮件红点 + Reddot31 ReddotType = 10031 //维京远征 有挑战次数 ) type TaskType int32 diff --git a/comm/imodule.go b/comm/imodule.go index 5a6229c19..f135aa9bf 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -240,9 +240,11 @@ type ( } IViking interface { CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank) // 查询玩家最佳通关记录 + IReddot } IHunting interface { CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) // 查询玩家最佳通关记录 + IReddot } // 公会 ISociaty interface { diff --git a/modules/hero/api.go b/modules/hero/api.go index 05c4e9467..8f40595a2 100644 --- a/modules/hero/api.go +++ b/modules/hero/api.go @@ -1,6 +1,7 @@ package hero import ( + "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" ) @@ -10,6 +11,7 @@ type apiComp struct { modules.MCompGate service core.IService module *Hero + chat comm.IChat } const ( //消息回复的头名称 @@ -42,6 +44,10 @@ func (this *apiComp) Init(service core.IService, module core.IModule, comp core. func (this *apiComp) Start() (err error) { err = this.MCompGate.Start() - + var module core.IModule + if module, err = this.service.GetModule(comm.ModuleChat); err != nil { + return + } + this.chat = module.(comm.IChat) return } diff --git a/modules/hero/api_awaken.go b/modules/hero/api_awaken.go index 8750fd3e9..3bcee9c12 100644 --- a/modules/hero/api_awaken.go +++ b/modules/hero/api_awaken.go @@ -104,6 +104,14 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c chanegCard = append(chanegCard, _hero) session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard}) session.SendMsg(string(this.module.GetType()), Awaken, &pb.HeroAwakenResp{Hero: _hero}) + + //英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级! + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem11, nil, _hero.JuexingLv, 0, user.Name, _hero.HeroID) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } + //任务相关 this.module.ModuleRtask.SendToRtask(session, comm.Rtype34, 1, _hero.JuexingLv) this.module.ModuleRtask.SendToRtask(session, comm.Rtype119, _hero.JuexingLv) diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 3279500eb..08a5db2c8 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -230,6 +230,14 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq } code = this.module.CreateRepeatHeros(session, _mapAddHero, true) + ///英雄招募 【玩家名称】在招募中获得了【英雄名称】! + for hid := range _mapAddHero { + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, hid) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } + } rsp.Heroes = szCards session.SendMsg(string(this.module.GetType()), DrawCard, rsp) diff --git a/modules/hero/api_resonance.go b/modules/hero/api_resonance.go index 1a294aa0a..e2366f73d 100644 --- a/modules/hero/api_resonance.go +++ b/modules/hero/api_resonance.go @@ -149,6 +149,12 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR this.module.DispenseRes(session, resonConfig.Prize, true) session.SendMsg(string(this.module.GetType()), Resonance, &pb.HeroResonanceResp{Hero: _hero}) + //英雄共鸣 【玩家名称】已将【英雄名称】共鸣至满级! + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem10, nil, _hero.ResonateNum, 0, user.Name, _hero.HeroID) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } // 任务相关 this.module.ModuleRtask.SendToRtask(session, comm.Rtype39, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype127, _hero.Star, utils.ToInt32(_hero.HeroID), _hero.ResonateNum) //A星英雄共鸣N级 diff --git a/modules/hero/api_strengthenUpSkill.go b/modules/hero/api_strengthenUpSkill.go index d6f6cb4b6..15301253b 100644 --- a/modules/hero/api_strengthenUpSkill.go +++ b/modules/hero/api_strengthenUpSkill.go @@ -163,7 +163,12 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt ChangeList = append(ChangeList, _hero) session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: ChangeList}) session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero}) - + //英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级! + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem9, nil, _hero.Lv, 0, user.Name, _hero.HeroID) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } this.module.ModuleRtask.SendToRtask(session, comm.Rtype52, utils.ToInt32(_hero.HeroID), 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype53, 1) // 检查是不是满级技能 @@ -175,6 +180,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt } } if maxLv { + this.module.ModuleRtask.SendToRtask(session, comm.Rtype54, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype57, 1) } diff --git a/modules/hero/api_strengthenUpStar.go b/modules/hero/api_strengthenUpStar.go index 4bf466003..3a340e64d 100644 --- a/modules/hero/api_strengthenUpStar.go +++ b/modules/hero/api_strengthenUpStar.go @@ -169,6 +169,12 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard}) session.SendMsg(string(this.module.GetType()), StrengthenUpStar, &pb.HeroStrengthenUpStarResp{Hero: _hero}) + //英雄升星 【玩家名称】已将【英雄名称】培养至6星! + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem8, nil, _hero.Lv, 0, user.Name, _hero.HeroID) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } this.module.ModuleRtask.SendToRtask(session, comm.Rtype6, utils.ToInt32(_hero.HeroID), _hero.Star) this.module.ModuleRtask.SendToRtask(session, comm.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star) if _hero.Star == 4 { diff --git a/modules/hero/api_strengthenUplv.go b/modules/hero/api_strengthenUplv.go index d8122d5c3..d618174bf 100644 --- a/modules/hero/api_strengthenUplv.go +++ b/modules/hero/api_strengthenUplv.go @@ -136,6 +136,12 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren if newhero != nil { _changeHero = append(_changeHero, newhero) // 原来的英雄 只是数量变化了 } + //英雄升级 【玩家名称】已将【英雄名称】培养至60级! + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem7, nil, _hero.Lv, 0, user.Name, _hero.HeroID) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{Hero: _hero}) return diff --git a/modules/hunting/api.go b/modules/hunting/api.go index ebfd15d1d..792c310bd 100644 --- a/modules/hunting/api.go +++ b/modules/hunting/api.go @@ -22,6 +22,7 @@ type apiComp struct { configure *configureComp module *Hunting friend comm.IFriend + chat comm.IChat } //组件初始化接口 @@ -40,5 +41,9 @@ func (this *apiComp) Start() (err error) { return } this.friend = module.(comm.IFriend) + if module, err = this.service.GetModule(comm.ModuleChat); err != nil { + return + } + this.chat = module.(comm.IChat) return } diff --git a/modules/hunting/api_challenge.go b/modules/hunting/api_challenge.go index 2cf19e1a8..86fc9b2d3 100644 --- a/modules/hunting/api_challenge.go +++ b/modules/hunting/api_challenge.go @@ -66,6 +66,10 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen BossType: req.BossType, Difficulty: req.Difficulty, }) - + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem15, nil, req.BossType, req.Difficulty, user.Name) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } return } diff --git a/modules/pagoda/api_challengeover.go b/modules/pagoda/api_challengeover.go index 264876d34..62802cd74 100644 --- a/modules/pagoda/api_challengeover.go +++ b/modules/pagoda/api_challengeover.go @@ -147,6 +147,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal } } code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData) + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem6, nil, pagoda.PagodaId, 0, user.Name) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda}) } diff --git a/modules/viking/api.go b/modules/viking/api.go index f109dea1a..58c34b2f7 100644 --- a/modules/viking/api.go +++ b/modules/viking/api.go @@ -22,6 +22,7 @@ type apiComp struct { configure *configureComp module *Viking friend comm.IFriend + chat comm.IChat } //组件初始化接口 @@ -40,5 +41,10 @@ func (this *apiComp) Start() (err error) { return } this.friend = module.(comm.IFriend) + + if module, err = this.service.GetModule(comm.ModuleChat); err != nil { + return + } + this.chat = module.(comm.IChat) return } diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go index 87e535241..18e4a5f0c 100644 --- a/modules/viking/api_challengeover.go +++ b/modules/viking/api_challengeover.go @@ -121,7 +121,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal Data: viking, Asset: asset, }) - + if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { + this.chat.SendSysChatToWorld(comm.ChatSystem14, nil, req.BossId, req.Difficulty, user.Name) + } else { + this.module.Errorf("no found userdata uid:%s", session.GetUserId()) + } // 随机任务统计 this.module.ModuleRtask.SendToRtask(session, comm.Rtype73, req.Difficulty, req.BossId, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype74, req.Difficulty, req.BossId) diff --git a/modules/viking/model_viking.go b/modules/viking/model_viking.go index f30749b36..a043a8020 100644 --- a/modules/viking/model_viking.go +++ b/modules/viking/model_viking.go @@ -63,3 +63,15 @@ func (this *modelViking) getVikingList(uid string) (result *pb.DBViking, err err func (this *modelViking) modifyVikingDataByObjId(uid string, data map[string]interface{}) error { return this.Change(uid, data) } + +// 红点检测 +func (this *modelViking) checkReddot31(uid string) bool { + list, err := this.module.modelViking.getVikingList(uid) + if err != nil { + return false + } + if list.LeftCount > 0 { + return true + } + return false +} diff --git a/modules/viking/module.go b/modules/viking/module.go index 36941e947..89b2b0418 100644 --- a/modules/viking/module.go +++ b/modules/viking/module.go @@ -144,3 +144,17 @@ func (this *Viking) CheckRank(uid string, boosID int32, difficulty int32, viking this.modulerank.SetRankListData("vikingRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID) } } + +//红点查询 +func (this *Viking) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { + reddot = make(map[comm.ReddotType]bool) + for _, v := range rid { + switch v { + case comm.Reddot31: + reddot[comm.Reddot31] = this.modelViking.checkReddot31(session.GetUserId()) + break + + } + } + return +} From 2e9027c655ddcc14d8f87386a0be21e6e5845e78 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 28 Nov 2022 15:56:24 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sys/module.go | 3 +-- modules/user/api_sign.go | 4 ++- modules/user/model_sign.go | 55 -------------------------------------- 3 files changed, 4 insertions(+), 58 deletions(-) diff --git a/modules/sys/module.go b/modules/sys/module.go index 28bf966c5..a2f12427a 100644 --- a/modules/sys/module.go +++ b/modules/sys/module.go @@ -33,6 +33,5 @@ func (this *ModuleSys) GetType() core.M_Modules { } func (this *ModuleSys) IsAccess(funcName string, userId string) (code pb.ErrorCode) { - // return this.modelSys.IsAccess(funcName, userId) - return pb.ErrorCode_Success + return this.modelSys.IsAccess(funcName, userId) } diff --git a/modules/user/api_sign.go b/modules/user/api_sign.go index 196823197..3a99cd44a 100644 --- a/modules/user/api_sign.go +++ b/modules/user/api_sign.go @@ -22,7 +22,9 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.UserSignReq) (code update map[string]interface{} bReward bool ) - + if code = this.module.ModuleSys.IsAccess(comm.Sign, session.GetUserId()); code != pb.ErrorCode_Success { + return + } update = make(map[string]interface{}, 0) if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil { start, _ := utils.GetMonthStartEnd() diff --git a/modules/user/model_sign.go b/modules/user/model_sign.go index 80c3a7ff9..15d462c76 100644 --- a/modules/user/model_sign.go +++ b/modules/user/model_sign.go @@ -69,58 +69,3 @@ func (this *ModelSign) updateSignData(uid string, sign *pb.DBSign) (err error) { } return } - -// 检测是否达到重置日期 -func (this *ModelSign) checkResetSignData(session comm.IUserSession) (code pb.ErrorCode) { - var ( - update map[string]interface{} - bReward bool - ) - - update = make(map[string]interface{}, 0) - if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil { - start, _ := utils.GetMonthStartEnd() - if sign.RTime < start { // 重置 - sign.RTime = configure.Now().Unix() - sign.SignTime = sign.RTime - sign.SignCount = 1 - if newGroup := this.module.configure.GetSignResetConf(sign.Cid + 1); newGroup != -1 { // 获取当前的组id - sign.Cid += 1 - sign.Group = newGroup - update["cid"] = sign.Cid - update["group"] = sign.Group - } - update["rTime"] = sign.RTime - update["signTime"] = sign.SignTime - update["signCount"] = sign.SignCount - this.Change(session.GetUserId(), update) - bReward = true - } else { - if !utils.IsToday(sign.SignTime) { - sign.SignCount += 1 - update["signCount"] = sign.SignCount - sign.SignTime = configure.Now().Unix() - update["signTime"] = sign.SignTime - sign.RTime = sign.SignTime - update["rTime"] = sign.RTime - this.Change(session.GetUserId(), update) - bReward = true - } - } - _data := this.module.configure.GetSignConf(sign.Cid, sign.Group) - if _data != nil { // 发奖 - if bReward { - this.module.DispenseRes(session, _data.Loopgift, true) - } - } else { - if bReward { - this.module.DispenseRes(session, this.module.globalConf.UnifiedReward, true) // 发放通用奖励 - } - } - session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{ - Data: sign, - Reward: bReward, - }) - } - return -} From 1ea1d5fed1369c0945741c8740b87ba43fe0c6ea Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Mon, 28 Nov 2022 17:12:47 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_worldbattle.json | 98 ++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 28 deletions(-) diff --git a/bin/json/game_worldbattle.json b/bin/json/game_worldbattle.json index 626966804..bd5da51c0 100644 --- a/bin/json/game_worldbattle.json +++ b/bin/json/game_worldbattle.json @@ -9,8 +9,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 102, @@ -22,8 +25,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 103, @@ -35,8 +41,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 104, @@ -48,8 +57,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 105, @@ -61,8 +73,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 106, @@ -74,8 +89,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 107, @@ -87,8 +105,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 108, @@ -100,8 +121,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 109, @@ -113,8 +137,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 110, @@ -126,8 +153,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 111, @@ -139,8 +169,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 112, @@ -152,8 +185,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 113, @@ -165,8 +201,11 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } }, { "id": 114, @@ -178,7 +217,10 @@ "LockSlots": [], "AssistTeam": 0, "EventList": [], - "playexp": 1000, - "NoMidwayExit": 0 + "playexp": { + "a": "attr", + "t": "exp", + "n": 1000 + } } ] \ No newline at end of file From ad4d20682033953847ee4c0d397ba86054908841 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 28 Nov 2022 17:26:00 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=8C=89=E7=AD=89=E7=BA=A7=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_opencond.json | 17 +++++++++++++++++ modules/user/api_login.go | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/bin/json/game_opencond.json b/bin/json/game_opencond.json index 0b59bc2ae..28af15278 100644 --- a/bin/json/game_opencond.json +++ b/bin/json/game_opencond.json @@ -644,5 +644,22 @@ "text": "功能暂未开启" }, "uiid": 0 + }, + { + "id": "sign", + "name": { + "key": "num_2028", + "text": "签到" + }, + "main": 5, + "optional": "", + "wkqbx": 2, + "kqbx": 0, + "img": "zc_icon_01", + "prompt": { + "key": "opencond_prompt_sign", + "text": "功能暂未开启" + }, + "uiid": 0 } ] \ No newline at end of file diff --git a/modules/user/api_login.go b/modules/user/api_login.go index 52fa79c28..f4f8c15c2 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -144,7 +144,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod // 初始化随机任务数据 // this.module.ModuleRtask.InitCondiData(user.Uid) - + //this.Sign(session, &pb.UserSignReq{}) // 日常登录任务 this.module.ModuleRtask.SendToRtask(session, comm.Rtype7, 1)