From 39fa612612c3aa7e669679da9fd1a99f8b2a37ff Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 4 Jan 2023 10:36:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=B2=BE=E7=AE=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 21 ++++++++++----------- comm/imodule.go | 3 ++- modules/privilege/module.go | 23 ++++++++++------------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/comm/const.go b/comm/const.go index 3f52107d6..049662455 100644 --- a/comm/const.go +++ b/comm/const.go @@ -669,16 +669,15 @@ const ( Sign = "sign" ) -// 特权类型 const ( - PrivilegeType1 int32 = iota + 1 //每日获得 - PrivilegeType2 //金币商店每日免费刷新次数 - PrivilegeType3 //维京远征每日可购买挑战次数 - PrivilegeType4 //狩猎每日可购买挑战次数 - PrivilegeType5 //竞技场每日可购买挑战次数 - PrivilegeType6 //梦境每日可购买挑战次数 - PrivilegeType7 //巨怪商队背包容量 - PrivilegeType8 //美食馆每日最大制作时间 - PrivilegeType9 //武馆每日最大练功时间 - PrivilegeType10 //铁匠铺每日最大锻造时间 + PrivilegeType1 = iota + 1 //每日获得 + PrivilegeType2 //金币商店每日免费刷新次数 + PrivilegeType3 //维京远征每日可购买挑战次数 + PrivilegeType4 //狩猎每日可购买挑战次数 + PrivilegeType5 //竞技场每日可购买挑战次数 + PrivilegeType6 //梦境每日可购买挑战次数 + PrivilegeType7 //巨怪商队背包容量 + PrivilegeType8 //美食馆每日最大制作时间 + PrivilegeType9 //武馆每日最大练功时间 + PrivilegeType10 //铁匠铺每日最大锻造时间 ) diff --git a/comm/imodule.go b/comm/imodule.go index f66976a3e..a574be6d7 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -306,7 +306,8 @@ type ( // 查询所有特权 key 对应comm.PrivilegeType1类型 CheckAllPrivilege(session IUserSession) map[int32]*pb.PrivilegeList // 通过特权类型获取特权对应的增加数量 - GetCountByPrivilegeId(uid string, pId int32) (count int32) + + GetCountByPrivilegeId(uid string, pType int32) (count int32) } //武馆 IMartialhall interface { diff --git a/modules/privilege/module.go b/modules/privilege/module.go index f693a0dfe..8248e3c31 100644 --- a/modules/privilege/module.go +++ b/modules/privilege/module.go @@ -410,13 +410,13 @@ func (this *Privilege) SendDailyPrivilegeMail(session comm.IUserSession, cId []i this.mail.SendMailByCid(session, comm.VipDaily, res) } } -func (this *Privilege) GetCountByPrivilegeId(uid string, pId int32) (count int32) { +func (this *Privilege) GetCountByPrivilegeId(uid string, pType int32) (count int32) { if this.IsCross() { // 跨服情况 if model, err := this.GetDBModuleByUid(uid, comm.TableVip, time.Hour); err == nil { vip := &pb.DBVip{} if err = model.Get(uid, vip); err == nil { - if v, ok := vip.Privilege[pId]; ok { - data := this.configure.GetPrivilegeByType(pId) + if v, ok := vip.Privilege[pType]; ok { + data := this.configure.GetPrivilegeByType(pType) for _, v1 := range v.PrivilegeID { if c, ok1 := data[v1]; ok1 { count += c @@ -426,19 +426,16 @@ func (this *Privilege) GetCountByPrivilegeId(uid string, pId int32) (count int32 } } } else { - vip, err := this.modelVip.getVipList(uid) - if err != nil { - return - } - if v, ok := vip.Privilege[pId]; ok { - data := this.configure.GetPrivilegeByType(pId) - for _, v1 := range v.PrivilegeID { - if c, ok1 := data[v1]; ok1 { - count += c + if vip, err := this.modelVip.getVipList(uid); err == nil { + if v, ok := vip.Privilege[pType]; ok { + data := this.configure.GetPrivilegeByType(pType) + for _, v1 := range v.PrivilegeID { + if c, ok1 := data[v1]; ok1 { + count += c + } } } } } - return } From 7ee714a4dbd70c05590451d5dba03f20e2acbd83 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 4 Jan 2023 19:08:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_drawCard.go | 5 +++-- modules/privilege/api_buygift.go | 6 +++--- modules/privilege/module.go | 9 +++++---- modules/viking/api_challenge.go | 2 -- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index fa41ba563..dd287e780 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -250,10 +250,11 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq if int32(len(v)) > randomIndex { if star == 5 { // 抽出5星英雄后A次抽奖内不会再抽到5星英雄(普通卡池+阵营卡池) curDrawCount := drawCount - req.DrawCount - if curDrawCount <= 10 { // 首次十连不计算 + if drawCount <= 10 { // 前10次不计算(连续抽卡最多连续出A个相同阵营的英雄) + szCards = append(szCards, v[randomIndex].Id) continue } - newID := this.module.ContinuousRestriction(session.GetUserId(), v[randomIndex].Id, curDrawCount+int32(index), strPool[index]) + newID := this.module.ContinuousRestriction(session.GetUserId(), v[randomIndex].Id, curDrawCount+int32(index+1), strPool[index]) szCards = append(szCards, newID) continue } diff --git a/modules/privilege/api_buygift.go b/modules/privilege/api_buygift.go index fde416306..584ce6cec 100644 --- a/modules/privilege/api_buygift.go +++ b/modules/privilege/api_buygift.go @@ -53,10 +53,10 @@ func (this *apiComp) BuyGift(session comm.IUserSession, req *pb.PrivilegeBuyGift return } vip.Reward[req.VipLv] = true - update := map[string]interface{}{ + + this.module.modelVip.modifyVipData(session.GetUserId(), map[string]interface{}{ "reward": vip.Reward, - } - this.module.modelVip.modifyVipData(session.GetUserId(), update) + }) // 推送 session.SendMsg(string(this.module.GetType()), PrivilegeBuyGiftResp, &pb.PrivilegeBuyGiftResp{Data: vip}) return diff --git a/modules/privilege/module.go b/modules/privilege/module.go index 8248e3c31..e9e4e5e25 100644 --- a/modules/privilege/module.go +++ b/modules/privilege/module.go @@ -353,7 +353,7 @@ func (this *Privilege) AddVipData(session comm.IUserSession, oldVip, newVip int3 return } } - update := map[string]interface{}{} + for i := oldVip + 1; i <= newVip; i++ { conf := this.configure.GetVipConfigureData(i) if conf != nil { @@ -381,11 +381,12 @@ func (this *Privilege) AddVipData(session comm.IUserSession, oldVip, newVip int3 this.mail.SendMailByCid(session, comm.VipDaily, res) } } - update["privilege"] = vip.Privilege - this.modelVip.modifyVipData(session.GetUserId(), update) + + this.modelVip.modifyVipData(session.GetUserId(), map[string]interface{}{ + "privilege": vip.Privilege, + }) session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeVipListResp{Data: vip}) - } // 发送特权每日奖励 diff --git a/modules/viking/api_challenge.go b/modules/viking/api_challenge.go index 469bc2800..7c3728faf 100644 --- a/modules/viking/api_challenge.go +++ b/modules/viking/api_challenge.go @@ -40,7 +40,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng } if code = this.module.CheckRes(session, []*cfg.Gameatn{costRes}); code != pb.ErrorCode_Success { - // if req.AutoBuy { // 不够的时候看是否能自动购买 if code = this.module.AutoBuyTicket(session); code != pb.ErrorCode_Success { return @@ -49,7 +48,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng code = pb.ErrorCode_VikingMaxChallengeCount return } - //return } cfgData := this.module.configure.GetVikingBossConfigData(req.BossId, req.Difficulty)