diff --git a/common/constant.go b/common/constant.go index 5e3398b..8e09429 100644 --- a/common/constant.go +++ b/common/constant.go @@ -816,3 +816,11 @@ const ( SkinGetAuto = 1 SkinGetItem = 2 ) + +const ( + SkillIdRankScore = 30002 // 排位积分加成百分比 + SkillIdVipTimes = 30003 // VIP赛每日免费报名次数 + SkillIdVipGift = 30004 // VIP每日礼包金币奖励提升百分比 + SkillIdTask = 30005 // 每日任务金币奖励提升百分比 + SkillIdDiamondLottery = 30007 // 每次钻石抽奖幸运值提升百分比 +) diff --git a/gamesrv/base/etcd.go b/gamesrv/base/etcd.go index 39b3593..bce9a3e 100644 --- a/gamesrv/base/etcd.go +++ b/gamesrv/base/etcd.go @@ -22,6 +22,8 @@ func init() { etcd.Register(etcd.ETCDKEY_ACT_Collect, webapi.WelfareCollectConfig{}, platformConfigEtcd) // 渠道开关 etcd.Register(etcd.ETCDKEY_ChannelSwitch, webapi.ChannelSwitchConfig{}, platformConfigEtcd) + // 皮肤配置 + etcd.Register(etcd.ETCDKEY_SKin, webapi.SkinConfig{}, platformConfigEtcd) } func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) { @@ -37,6 +39,8 @@ func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, ev ConfigMgrInst.GetConfig(d.Platform).WelfareCollectConfig = d case *webapi.ChannelSwitchConfig: ConfigMgrInst.GetConfig(d.Platform).ChannelSwitch[d.GetTp()] = d + case *webapi.SkinConfig: + ConfigMgrInst.GetConfig(d.Platform).SkinConfig = d default: logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey) } diff --git a/gamesrv/base/player.go b/gamesrv/base/player.go index 2682034..550d490 100644 --- a/gamesrv/base/player.go +++ b/gamesrv/base/player.go @@ -1389,3 +1389,9 @@ func (this *Player) PetUseSkill() bool { } return false } + +// GetSkillAdd 获取技能加成 +// id 技能id +func (this *Player) GetSkillAdd(id int32) int32 { + return this.GetSkillAdd2(id, ConfigMgrInst) +} diff --git a/gamesrv/tienlen/scenepolicy_tienlen.go b/gamesrv/tienlen/scenepolicy_tienlen.go index 1a0b801..bdeb1c4 100644 --- a/gamesrv/tienlen/scenepolicy_tienlen.go +++ b/gamesrv/tienlen/scenepolicy_tienlen.go @@ -1569,7 +1569,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { //在这里执行结算 if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok { - addItems := func(billData *tienlen.TienLenPlayerGameBilled, sceneTypeScore, vipAdd, vipScore, roleAdd, roleScore, weekCardScore int64) { + addItems := func(billData *tienlen.TienLenPlayerGameBilled, sceneTypeScore, vipAdd, vipScore, roleAdd, roleScore, weekCardScore, skinAdd, skinScore int64) { // 场次加成配置 if sceneTypeScore > 0 { billData.AddItems = append(billData.AddItems, &tienlen.AddItem{ @@ -1606,6 +1606,15 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { Score: weekCardScore, }) } + // 皮肤加成 + if skinScore > 0 { + billData.AddItems = append(billData.AddItems, &tienlen.AddItem{ + ItemType: 7, + ItemId: 0, + Addition: int32(skinAdd), + Score: skinScore, + }) + } } winScore := int64(0) @@ -1728,7 +1737,8 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { var vipScore int64 // vip加成 var roleScore int64 // 角色加成 var weekCardScore int64 // 周卡加成 - var roleAdd int32 + var skinScore int64 // 皮肤技能加成 + var roleAdd, skinAdd int32 var otherScore int64 // 额外总加分 oldRankScore := losePlayer.GetRankScore(sceneEx.GetDBGameFree().GetRankType()) playerLoseScore := rule.GetLoseScore(losePlayer.cards, true) @@ -1768,8 +1778,13 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { if losePlayer.GetWeekCardPrivilege(2) { weekCardScore = int64(math.Ceil(float64(rankScore) * float64(5) / 100.0)) } + // 皮肤技能加成 + skinAdd = losePlayer.GetSkillAdd(common.SkillIdRankScore) + if skinAdd > 0 { + skinScore = int64(math.Ceil(float64(rankScore) * float64(skinAdd) / 100.0)) + } } - otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + skinScore losePlayer.AddRankScore(sceneEx.GetDBGameFree().GetRankType(), rankScore+otherScore) // 炸弹分一起算 } losePlayer.winCoin -= gainScore @@ -1784,7 +1799,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { } billData.WinRankScore = billData.RankScore - oldRankScore if otherScore > 0 { - addItems(billData, sceneTypeScore, int64(losePlayer.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore) + addItems(billData, sceneTypeScore, int64(losePlayer.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore, int64(skinAdd), skinScore) } isWin := int32(0) billCoin := losePlayer.bombScore - gainScore @@ -1862,8 +1877,11 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { var rankScore int64 // 排位积分 var sceneTypeScore int64 // 场次额外积分 var vipScore int64 // vip加成 + var roleScore int64 // 角色加成 var weekCardScore int64 // 周卡加成 - var otherScore int64 // 额外总加分 + var skinScore int64 // 皮肤技能加成 + var roleAdd, skinAdd int32 + var otherScore int64 // 额外总加分 oldRankScore := lastWinPlayer.GetRankScore(sceneEx.GetDBGameFree().GetRankType()) lastWinScore := rule.GetLoseScore(lastWinPlayer.cards, true) rankScore = int64(lastWinScore) + 50 @@ -1897,14 +1915,18 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { vipScore = int64(math.Ceil(float64(rankScore) * float64(lastWinPlayer.VipExtra) / 100.0)) // 角色加成分 _, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(&lastWinPlayer.PlayerData, common.RoleAddRankScore) + roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0)) //周卡加成 if lastWinPlayer.GetWeekCardPrivilege(2) { weekCardScore = int64(math.Ceil(float64(rankScore) * float64(5) / 100.0)) } - - roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0)) + // 皮肤技能加成 + skinAdd = lastWinPlayer.GetSkillAdd(common.SkillIdRankScore) + if skinAdd > 0 { + skinScore = int64(math.Ceil(float64(rankScore) * float64(skinAdd) / 100.0)) + } } - otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + skinScore lastWinPlayer.AddRankScore(sceneEx.GetDBGameFree().GetRankType(), rankScore+otherScore) // 炸弹分一起算 } lastWinPlayer.winCoin -= astWinGainScore @@ -1919,7 +1941,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { } billData.WinRankScore = billData.RankScore - oldRankScore if otherScore > 0 { - addItems(billData, sceneTypeScore, int64(lastWinPlayer.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore) + addItems(billData, sceneTypeScore, int64(lastWinPlayer.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore, int64(skinAdd), skinScore) } isWin := int32(0) billCoin := lastWinPlayer.bombScore - astWinGainScore @@ -1975,8 +1997,11 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { var rankScore int64 // 排位积分 var sceneTypeScore int64 // 场次额外积分 var vipScore int64 // vip加成 + var roleScore int64 // 角色加成 var weekCardScore int64 // 周卡加成 - var otherScore int64 // 额外总加分 + var skinScore int64 // 皮肤技能加成 + var roleAdd, skinAdd int32 + var otherScore int64 // 额外总加分 oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType()) rankScore = loseRankScore taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比 @@ -2006,8 +2031,13 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { if playerEx.GetWeekCardPrivilege(2) { weekCardScore = int64(math.Ceil(float64(rankScore) * float64(5) / 100.0)) } + // 皮肤技能加成 + skinAdd = playerEx.GetSkillAdd(common.SkillIdRankScore) + if skinAdd > 0 { + skinScore = int64(math.Ceil(float64(rankScore) * float64(skinAdd) / 100.0)) + } } - otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + skinScore playerEx.AddRankScore(sceneEx.GetDBGameFree().GetRankType(), rankScore+otherScore) // 炸弹分一起算 } playerEx.winCoin += gainScore @@ -2022,7 +2052,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { } billData.WinRankScore = billData.RankScore - oldRankScore if otherScore > 0 { - addItems(billData, sceneTypeScore, int64(playerEx.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore) + addItems(billData, sceneTypeScore, int64(playerEx.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore, int64(skinAdd), skinScore) } isWin := int32(0) billCoin := playerEx.bombScore + gainScore @@ -2077,8 +2107,11 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { var rankScore int64 // 排位积分 var sceneTypeScore int64 // 场次额外积分 var vipScore int64 // vip加成 + var roleScore int64 // 角色加成 var weekCardScore int64 // 周卡加成 - var otherScore int64 // 额外总加分 + var skinScore int64 // 皮肤技能加成 + var roleAdd, skinAdd int32 + var otherScore int64 // 额外总加分 oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType()) rankScore = lastWinPlayerRankScore taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比 @@ -2103,8 +2136,13 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { if playerEx.GetWeekCardPrivilege(2) { weekCardScore = int64(math.Ceil(float64(rankScore) * float64(5) / 100.0)) } + // 皮肤技能加成 + skinAdd = playerEx.GetSkillAdd(common.SkillIdRankScore) + if skinAdd > 0 { + skinScore = int64(math.Ceil(float64(rankScore) * float64(skinAdd) / 100.0)) + } } - otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + skinScore playerEx.AddRankScore(sceneEx.GetDBGameFree().GetRankType(), rankScore+otherScore) // 炸弹分一起算 } playerEx.winCoin += gainScore @@ -2119,7 +2157,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { } billData.WinRankScore = billData.RankScore - oldRankScore if otherScore > 0 { - addItems(billData, sceneTypeScore, int64(playerEx.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore) + addItems(billData, sceneTypeScore, int64(playerEx.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore, int64(skinAdd), skinScore) } isWin := int32(0) billCoin := playerEx.bombScore + gainScore @@ -2175,9 +2213,10 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { var rankScore int64 // 排位积分 var sceneTypeScore int64 // 场次额外积分 var vipScore int64 // vip加成 - var weekCardScore int64 // 周卡加成 var roleScore int64 // 角色加成 - var roleAdd int32 + var weekCardScore int64 // 周卡加成 + var skinScore int64 // 皮肤技能加成 + var roleAdd, skinAdd int32 var otherScore int64 // 额外总加分 playerEx := sceneEx.seats[i] if playerEx == nil { @@ -2246,8 +2285,13 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { if playerEx.GetWeekCardPrivilege(2) { weekCardScore = int64(math.Ceil(float64(rankScore) * float64(5) / 100.0)) } + // 皮肤技能加成 + skinAdd = playerEx.GetSkillAdd(common.SkillIdRankScore) + if skinAdd > 0 { + skinScore = int64(math.Ceil(float64(rankScore) * float64(skinAdd) / 100.0)) + } } - otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + skinScore playerEx.AddRankScore(sceneEx.GetDBGameFree().GetRankType(), rankScore+otherScore) // 炸弹分一起算 } playerEx.winCoin -= gainScore @@ -2263,7 +2307,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { } billData.WinRankScore = billData.RankScore - oldRankScore if otherScore > 0 { - addItems(billData, sceneTypeScore, int64(playerEx.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore) + addItems(billData, sceneTypeScore, int64(playerEx.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore, int64(skinAdd), skinScore) } isWin := int32(0) @@ -2346,7 +2390,8 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { var vipScore int64 // vip加成 var roleScore int64 // 角色加成 var weekCardScore int64 // 周卡加成 - var roleAdd int32 + var skinScore int64 // 皮肤技能加成 + var roleAdd, skinAdd int32 var otherScore int64 // 额外总加分 playerEx := sceneEx.players[winSnid] if playerEx != nil { @@ -2372,7 +2417,12 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { if playerEx.GetWeekCardPrivilege(2) { weekCardScore = int64(math.Ceil(float64(rankScore) * float64(5) / 100.0)) } - otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + // 皮肤技能加成 + skinAdd = playerEx.GetSkillAdd(common.SkillIdRankScore) + if skinAdd > 0 { + skinScore = int64(math.Ceil(float64(rankScore) * float64(skinAdd) / 100.0)) + } + otherScore = sceneTypeScore + vipScore + roleScore + weekCardScore + skinScore playerEx.AddRankScore(sceneEx.GetDBGameFree().GetRankType(), rankScore+otherScore) } playerEx.winCoin += gainScore @@ -2387,7 +2437,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { TianHu: playerEx.tianHu, } if otherScore > 0 { - addItems(billData, sceneTypeScore, int64(playerEx.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore) + addItems(billData, sceneTypeScore, int64(playerEx.VipExtra), vipScore, int64(roleAdd), roleScore, weekCardScore, int64(skinAdd), skinScore) } isWin := int32(0) diff --git a/model/player.go b/model/player.go index 47124b0..125a238 100644 --- a/model/player.go +++ b/model/player.go @@ -3115,6 +3115,22 @@ func (this *PlayerData) GetRoleId() int32 { return common.DefaultRoleId } +// GetSkillAdd2 获取技能加成 +// id 技能id +func (this *PlayerData) GetSkillAdd2(id int32, cfg *ConfigMgr) int32 { + if cfg == nil { + return 0 + } + for k, v := range this.Skin.ModUnlock { + levelCfg := cfg.GetSkinLevel(this.Platform, k, v) + skinCfg := cfg.GetSkinInfo(this.Platform, k) + if v > 0 && levelCfg.GetSkillId() == id && (skinCfg.GetSkillType() == 0 || this.Skin.ModId == k) { + return levelCfg.GetSkillValue() + } + } + return 0 +} + type BindArgs struct { Platform string PSnId, SnId int32 diff --git a/worldsrv/action_player.go b/worldsrv/action_player.go index 64ce684..26d2819 100644 --- a/worldsrv/action_player.go +++ b/worldsrv/action_player.go @@ -1779,7 +1779,7 @@ func (this *CSVIPPrivilegeInfoHandler) Process(s *netlib.Session, packetid int, } switch code { case 1: //1.VIP比赛场免费次数 - pack.Value = p.GetMatchFreeTimes() + pack.Value = p.GetMatchFreeTimes() + p.GetSkillAdd(common.SkillIdVipTimes) pack.NowValue = p.VipMatchTimes } p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_VIPPrivilegeInfo), pack) diff --git a/worldsrv/action_task.go b/worldsrv/action_task.go index d572a02..c978a49 100644 --- a/worldsrv/action_task.go +++ b/worldsrv/action_task.go @@ -81,11 +81,16 @@ func IsTaskReward(p *Player, id int32) bool { func SendReward(p *Player, m map[int64]int64, tp int32) { isPermit := p.GetIsPermit() + add := p.GetSkillAdd(common.SkillIdTask) var items []*Item for k, v := range m { if k == common.ItemIDPermit && isPermit { v += int64(float64(v) * common.PermitAdd) } + // 皮肤技能每日任务金币加成 + if tp == common.TaskActivityTypeEveryDay && add > 0 && k == common.ItemIDCoin { + v += int64((float64(v) * float64(add)) / 100.0) + } items = append(items, &Item{ ItemId: int32(k), ItemNum: v, @@ -178,6 +183,7 @@ func CSTaskReward(s *netlib.Session, packetId int, data interface{}, sid int64) return nil } + add := p.GetSkillAdd(common.SkillIdTask) now := time.Now() ret := &taskproto.SCTaskReward{ @@ -205,6 +211,10 @@ func CSTaskReward(s *netlib.Session, packetId int, data interface{}, sid int64) if k == common.ItemIDPermit && isPermit { vv += int64(float64(vv) * common.PermitAdd) } + // 皮肤技能每日任务金币加成 + if data.GetActivityType() == common.TaskActivityTypeEveryDay && add > 0 && k == common.ItemIDCoin { + vv += int64((float64(vv) * float64(add)) / 100.0) + } ret.Reward[k] = ret.Reward[k] + vv } for k, v := range ret.Reward { diff --git a/worldsrv/petmgr.go b/worldsrv/petmgr.go index e38b406..3a5142b 100644 --- a/worldsrv/petmgr.go +++ b/worldsrv/petmgr.go @@ -273,7 +273,7 @@ func (this *PetMgr) GetSkinInfo(p *Player, id int32) *pets.SkinInfo { if level == 0 { cost = unLockCost } else { - for k, v := range PlatformMgrSingleton.GetSkinLevel(p.Platform, id, level).GetUpItem() { + for k, v := range PlatformMgrSingleton.GetSkinLevel(p.Platform, id, level+1).GetUpItem() { cost = append(cost, &pets.Item{ Id: k, N: v, @@ -306,8 +306,8 @@ func (this *PetMgr) GetSkinInfo(p *Player, id int32) *pets.SkinInfo { IsUpgrade: cfg.GetIsUpgrade() == 1, SkillType: cfg.GetSkillType(), } - curLevel := PlatformMgrSingleton.GetSkinLevel(p.Platform, id, level-1) - nextLevel := PlatformMgrSingleton.GetSkinLevel(p.Platform, id, level) + curLevel := PlatformMgrSingleton.GetSkinLevel(p.Platform, id, level) + nextLevel := PlatformMgrSingleton.GetSkinLevel(p.Platform, id, level+1) if curLevel != nil { ret.SkillId = curLevel.GetSkillId() } diff --git a/worldsrv/player.go b/worldsrv/player.go index a18a755..65a1edd 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -3803,6 +3803,11 @@ func (this *Player) VIPDraw(id int32) { this.WelfData.VIPBag[this.VIP][0] = 1 //金币数量 money := data.Privilege1[0] + // 皮肤技能加成 + add := this.GetSkillAdd(common.SkillIdVipGift) + if add > 0 { + money += int32((float64(money) * float64(add)) / 100.00) + } //vip经验 addVipExp := int64(float64(data.Privilege1[1]) / vips.MoneyRatio) this.AddCoin(int64(money), 0, common.GainWay_VIPGift, "sys", "VIP每日礼包") @@ -4808,3 +4813,9 @@ func (this *Player) AutoSkinUnlock() { SkinUnLock(this, v.GetId()) } } + +// GetSkillAdd 获取技能加成 +// id 技能id +func (this *Player) GetSkillAdd(id int32) int32 { + return this.GetSkillAdd2(id, PlatformMgrSingleton.ConfigMgr) +} diff --git a/worldsrv/tournament.go b/worldsrv/tournament.go index a728291..0d91122 100644 --- a/worldsrv/tournament.go +++ b/worldsrv/tournament.go @@ -435,7 +435,8 @@ func (this *Tournament) signUpCost(p *Player, tmId int32, cost bool) (bool, int3 // VIP比赛场 if gmd.MatchType == MatchTypeVIP { - freeTimes := p.GetMatchFreeTimes() // VIP比赛场免费次数 + freeTimes := p.GetMatchFreeTimes() // VIP比赛场免费次数 + freeTimes += p.GetSkillAdd(common.SkillIdVipTimes) // 皮肤技能加成次数 logger.Logger.Trace("报名费用免费次数: freeTimes: ", freeTimes, " p.VipMatchTimes: ", p.VipMatchTimes) if freeTimes > 0 { if cost {