皮肤加成

This commit is contained in:
sk 2024-08-05 17:05:03 +08:00
parent d3c40dde03
commit fe1e66fec2
5 changed files with 52 additions and 3 deletions

View File

@ -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

View File

@ -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)

View File

@ -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
}

View File

@ -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]
// 皮肤技能加成

View File

@ -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)