From fe1e66fec24fe3dad95c2062ac950e962b177328 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Mon, 5 Aug 2024 17:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9A=AE=E8=82=A4=E5=8A=A0=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mq/publisher.go | 2 +- worldsrv/action_pets.go | 10 ++++++++++ worldsrv/action_task.go | 10 +++++++++- worldsrv/player.go | 2 +- worldsrv/taskmgr.go | 31 +++++++++++++++++++++++++++++++ 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/mq/publisher.go b/mq/publisher.go index 36b1e38..666c0cc 100644 --- a/mq/publisher.go +++ b/mq/publisher.go @@ -96,7 +96,7 @@ func (p *RabbitMQPublisher) publish(topic string, msg interface{}, opts ...broke err = p.Publish(topic, &broker.Message{Body: buf}, opts...) if err != nil { - logger.Logger.Error("RabbitMQPublisher.publish() topic:%v message:%v err:%v", topic, msg, err) + logger.Logger.Errorf("RabbitMQPublisher.publish() topic:%v message:%v err:%v", topic, msg, err) return } return nil diff --git a/worldsrv/action_pets.go b/worldsrv/action_pets.go index c2aca90..0cd716c 100644 --- a/worldsrv/action_pets.go +++ b/worldsrv/action_pets.go @@ -561,6 +561,11 @@ func CSSkinUpgrade(s *netlib.Session, packetid int, data interface{}, sid int64) pack.RetCode = pets.OpResultCode_OPRC_Sucess pack.Info = PetMgrSington.GetSkinInfo(p, msg.GetId()) send() + + // 任务加成变更 + if info.GetSkillId() == common.SkillIdTask && p.GetSkillAdd(common.SkillIdTask) > 0 { + OnNotifyChange(p, common.TaskActivityTypeEveryDay) + } return nil } @@ -621,6 +626,11 @@ func SkinUnLock(p *Player, id int32) (*pets.SkinInfo, pets.OpResultCode) { p.SendToClient(int(pets.PetsPacketID_PACKET_SC_SKIN_UNLOCK), pack) logger.Logger.Tracef("SCSkinUnlock: %v", pack) + // 任务加成变更 + if info.GetSkillId() == common.SkillIdTask && p.GetSkillAdd(common.SkillIdTask) > 0 { + OnNotifyChange(p, common.TaskActivityTypeEveryDay) + } + // 自动使用 if cfg.GetUnlockType() == common.SkinGetAuto { CSSkinUse(p.gateSess, int(pets.PetsPacketID_PACKET_CS_SKIN_USE), &pets.CSSkinUse{Id: id}, p.sid) diff --git a/worldsrv/action_task.go b/worldsrv/action_task.go index c978a49..2671743 100644 --- a/worldsrv/action_task.go +++ b/worldsrv/action_task.go @@ -144,6 +144,7 @@ func CSTaskList(s *netlib.Session, packetId int, data interface{}, sid int64) er return nil } + add := p.GetSkillAdd(common.SkillIdTask) ret := &taskproto.SCTaskList{ Tp: msg.GetTp(), } @@ -154,9 +155,16 @@ func CSTaskList(s *netlib.Session, packetId int, data interface{}, sid int64) er N: GetTaskTimes(p, v.Id), TargetN: v.GetTargetTimes(), Status: 0, - Reward: v.GetAward(), + Reward: make(map[int64]int64), TaskType: v.GetTaskType(), } + // 皮肤技能每日任务金币加成 + for k, vv := range v.GetAward() { + if v.GetActivityType() == common.TaskActivityTypeEveryDay && add > 0 && k == common.ItemIDCoin { + vv += int64((float64(vv) * float64(add)) / 100.0) + } + item.Reward[k] = vv + } if item.N > item.TargetN { item.N = item.TargetN } diff --git a/worldsrv/player.go b/worldsrv/player.go index 0ad6015..afa0794 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -3766,7 +3766,7 @@ func (this *Player) SCVIPInfo() { LineId: cfg.RewardOutlineID, ShopId2: cfg.ShopId2, ShopId7: cfg.ShopId7, - MatchFreeTimes: cfg.MatchFreeTimes, + MatchFreeTimes: cfg.MatchFreeTimes + this.GetSkillAdd(common.SkillIdVipTimes), } money := cfg.Privilege1[0] // 皮肤技能加成 diff --git a/worldsrv/taskmgr.go b/worldsrv/taskmgr.go index 9ab7e46..ee42382 100644 --- a/worldsrv/taskmgr.go +++ b/worldsrv/taskmgr.go @@ -229,6 +229,37 @@ func (t *TaskHandle) AllTask(id int, data any) { } } +func OnNotifyChange(p *Player, activityType int32) { + add := p.GetSkillAdd(common.SkillIdTask) + var l []*taskproto.TaskData + for _, v := range srvdata.TaskMgr.GetActivityType(activityType) { + if !IsTaskReward(p, v.Id) { + // 皮肤技能每日任务金币加成 + item := &taskproto.TaskData{ + Id: v.Id, + N: GetTaskTimes(p, v.Id), + TargetN: v.GetTargetTimes(), + Status: 0, + Reward: make(map[int64]int64), + TaskType: v.GetTaskType(), + } + for k, vv := range v.GetAward() { + if v.GetActivityType() == common.TaskActivityTypeEveryDay && add > 0 && k == common.ItemIDCoin { + vv += int64((float64(vv) * float64(add)) / 100.0) + } + item.Reward[k] = vv + } + l = append(l, item) + } + } + pack := &taskproto.SCTaskChange{ + Tp: activityType, + List: l, + } + p.SendToClient(int(taskproto.TaskPacketID_PACKET_SCTaskChange), pack) + logger.Logger.Tracef("SCTaskChange %v", pack) +} + func init() { taskHandle := new(TaskHandle) TaskSubjectSingleton.Attach(common.TaskTypeAdv, taskHandle)