减价不减量 新限时事件
This commit is contained in:
parent
f1b0f96c07
commit
0c979e7ff1
@ -24,6 +24,7 @@ const (
|
|||||||
CFG_LIMITED_TIME_EVENT_MONEY = "LimitedTimeEventMoney"
|
CFG_LIMITED_TIME_EVENT_MONEY = "LimitedTimeEventMoney"
|
||||||
CFG_LIMITED_TIME_EVENT_LUCKY = "LimitedTimeEventLucky"
|
CFG_LIMITED_TIME_EVENT_LUCKY = "LimitedTimeEventLucky"
|
||||||
CFG_LIMITED_TIME_EVENT_CAT_TRICK = "LimitedTimeEventCatTrick"
|
CFG_LIMITED_TIME_EVENT_CAT_TRICK = "LimitedTimeEventCatTrick"
|
||||||
|
CFG_LIMTTED_TIME_EVENT_DECORATE_OFF = "LimitedTimeEventDecorateOff"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -41,6 +42,7 @@ func init() {
|
|||||||
gamedata.InitCfg(CFG_LIMITED_TIME_EVENT_MONEY)
|
gamedata.InitCfg(CFG_LIMITED_TIME_EVENT_MONEY)
|
||||||
gamedata.InitCfg(CFG_LIMITED_TIME_EVENT_LUCKY)
|
gamedata.InitCfg(CFG_LIMITED_TIME_EVENT_LUCKY)
|
||||||
gamedata.InitCfg(CFG_LIMITED_TIME_EVENT_CAT_TRICK)
|
gamedata.InitCfg(CFG_LIMITED_TIME_EVENT_CAT_TRICK)
|
||||||
|
gamedata.InitCfg(CFG_LIMTTED_TIME_EVENT_DECORATE_OFF)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取限时事件触发列表
|
// 获取限时事件触发列表
|
||||||
@ -417,3 +419,21 @@ func GetCatTrickDiamond(Type int) (int, int) {
|
|||||||
}
|
}
|
||||||
return gamedata.GetIntValue(data, "Diamond"), gamedata.GetIntValue(data, "Energy")
|
return gamedata.GetIntValue(data, "Diamond"), gamedata.GetIntValue(data, "Energy")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetDecorateOffDiscount(AreaId, StepId int) int {
|
||||||
|
data, err := gamedata.GetData(CFG_LIMTTED_TIME_EVENT_DECORATE_OFF)
|
||||||
|
if err != nil {
|
||||||
|
log.Debug("GetDecorateOffDiscount err:%v", err)
|
||||||
|
return 100
|
||||||
|
}
|
||||||
|
for _, v := range data {
|
||||||
|
StartAreaId := gamedata.GetIntValue(v, "StartArea")
|
||||||
|
EndAreaId := gamedata.GetIntValue(v, "EndArea")
|
||||||
|
StartStepId := gamedata.GetIntValue(v, "StartStep")
|
||||||
|
EndStepId := gamedata.GetIntValue(v, "EndStep")
|
||||||
|
if AreaId >= StartAreaId && AreaId <= EndAreaId && StepId >= StartStepId && StepId <= EndStepId {
|
||||||
|
return gamedata.GetIntValue(v, "Off")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 100
|
||||||
|
}
|
||||||
|
|||||||
@ -471,7 +471,9 @@ func ReqDecorate(player *Player, buf []byte) error {
|
|||||||
DecorateMod := player.PlayMod.getDecorateMod()
|
DecorateMod := player.PlayMod.getDecorateMod()
|
||||||
DecorateId := int(req.DecorateId)
|
DecorateId := int(req.DecorateId)
|
||||||
AreaId := int(req.AreaId)
|
AreaId := int(req.AreaId)
|
||||||
CostItem, PetExp, PartItem := DecorateMod.GetDecorateCostItem(AreaId, DecorateId)
|
LimitEventMod := player.PlayMod.getLimitedTimeEventMod()
|
||||||
|
DecorateOffIsExist := LimitEventMod.CheckExist(limitedTimeEvent.EVENT_TYPE_DECORATE_OFF)
|
||||||
|
CostItem, PetExp, PartItem := DecorateMod.GetDecorateCostItem(AreaId, DecorateId, DecorateOffIsExist)
|
||||||
err := player.HandleLoseItem(CostItem, msg.ITEM_POP_LABEL_DecorateCost.String()) // 扣除道具
|
err := player.HandleLoseItem(CostItem, msg.ITEM_POP_LABEL_DecorateCost.String()) // 扣除道具
|
||||||
if err != nil {
|
if err != nil {
|
||||||
player.SendErrClienRes(&msg.ResDecorate{
|
player.SendErrClienRes(&msg.ResDecorate{
|
||||||
@ -562,7 +564,9 @@ func ReqDecorateAll(player *Player, buf []byte) error {
|
|||||||
return errors.New("等级不足")
|
return errors.New("等级不足")
|
||||||
}
|
}
|
||||||
PlayerBaseMod := player.GetPlayerBaseMod()
|
PlayerBaseMod := player.GetPlayerBaseMod()
|
||||||
CostItem, AddItem, DecorateNum, DecorateList, Log, PetExp := DecorateMod.DecorateAll(PlayerBaseMod.GetStar())
|
LimitEventMod := player.PlayMod.getLimitedTimeEventMod()
|
||||||
|
DecorateOffIsExist := LimitEventMod.CheckExist(limitedTimeEvent.EVENT_TYPE_DECORATE_OFF)
|
||||||
|
CostItem, AddItem, DecorateNum, DecorateList, Log, PetExp := DecorateMod.DecorateAll(PlayerBaseMod.GetStar(), DecorateOffIsExist)
|
||||||
err := player.HandleLoseItem(CostItem, msg.ITEM_POP_LABEL_DecorateCost.String()) // 扣除道具
|
err := player.HandleLoseItem(CostItem, msg.ITEM_POP_LABEL_DecorateCost.String()) // 扣除道具
|
||||||
if err != nil {
|
if err != nil {
|
||||||
player.SendErrClienRes(&msg.ResDecorateAll{
|
player.SendErrClienRes(&msg.ResDecorateAll{
|
||||||
|
|||||||
@ -332,7 +332,7 @@ func UnitDecoratePartCost(p *Player) error {
|
|||||||
DecorateMod.PartClassPool = []int{}
|
DecorateMod.PartClassPool = []int{}
|
||||||
DecorateMod.PartPool = make(map[int]int)
|
DecorateMod.PartPool = make(map[int]int)
|
||||||
DecorateMod.InitData()
|
DecorateMod.InitData()
|
||||||
Items, _, _ := DecorateMod.GetDecorateCostItem(1, 33)
|
Items, _, _ := DecorateMod.GetDecorateCostItem(1, 33, false)
|
||||||
err := p.HandleLoseItem(Items, "")
|
err := p.HandleLoseItem(Items, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Print(err)
|
fmt.Print(err)
|
||||||
|
|||||||
@ -2,8 +2,10 @@ package decorate
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"server/GoUtil"
|
"server/GoUtil"
|
||||||
decorateCfg "server/conf/decorate"
|
decorateCfg "server/conf/decorate"
|
||||||
|
limitedTimeEventCfg "server/conf/limitedTimeEvent"
|
||||||
"server/game/mod/item"
|
"server/game/mod/item"
|
||||||
"server/msg"
|
"server/msg"
|
||||||
"sort"
|
"sort"
|
||||||
@ -75,10 +77,14 @@ func (d *Decorate) GetDecorateAddEnergy(cnt int) []*item.Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取装饰消耗
|
// 获取装饰消耗
|
||||||
func (d *Decorate) GetDecorateCostItem(AreaId, DecorateId int) ([]*item.Item, int, []*item.Item) {
|
func (d *Decorate) GetDecorateCostItem(AreaId, DecorateId int, DecorateOffIsExist bool) ([]*item.Item, int, []*item.Item) {
|
||||||
Item := decorateCfg.GetStarCost(AreaId, DecorateId)
|
Item := decorateCfg.GetStarCost(AreaId, DecorateId)
|
||||||
PetExp := decorateCfg.GetDecoratePExp(AreaId, DecorateId)
|
PetExp := decorateCfg.GetDecoratePExp(AreaId, DecorateId)
|
||||||
Id := decorateCfg.GetIdBySenceAndLv(AreaId, DecorateId)
|
Id := decorateCfg.GetIdBySenceAndLv(AreaId, DecorateId)
|
||||||
|
if DecorateOffIsExist {
|
||||||
|
OffRate := limitedTimeEventCfg.GetDecorateOffDiscount(AreaId, DecorateId)
|
||||||
|
Item = int(math.Ceil(float64(Item) * float64(OffRate)))
|
||||||
|
}
|
||||||
Items := []*item.Item{item.NewItem(item.ITEM_STAR_ID, Item)}
|
Items := []*item.Item{item.NewItem(item.ITEM_STAR_ID, Item)}
|
||||||
PartItem := d.PartCost[Id]
|
PartItem := d.PartCost[Id]
|
||||||
PartItemList := make([]*item.Item, 0)
|
PartItemList := make([]*item.Item, 0)
|
||||||
@ -93,7 +99,7 @@ func (d *Decorate) GetDecorateCostItem(AreaId, DecorateId int) ([]*item.Item, in
|
|||||||
return Items, PetExp, PartItemList
|
return Items, PetExp, PartItemList
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Decorate) DecorateAll(Star int) ([]*item.Item, []*item.Item, int, []int, []interface{}, int) {
|
func (d *Decorate) DecorateAll(Star int, DecorateOffIsExist bool) ([]*item.Item, []*item.Item, int, []int, []interface{}, int) {
|
||||||
DecorateAll := decorateCfg.GetAllSortIdByAreaId(d.AreaId)
|
DecorateAll := decorateCfg.GetAllSortIdByAreaId(d.AreaId)
|
||||||
SubAlice := GoUtil.SubSlices(DecorateAll, GoUtil.MapIntToIntSlice(d.FinishList))
|
SubAlice := GoUtil.SubSlices(DecorateAll, GoUtil.MapIntToIntSlice(d.FinishList))
|
||||||
sort.Ints(SubAlice)
|
sort.Ints(SubAlice)
|
||||||
@ -111,6 +117,10 @@ func (d *Decorate) DecorateAll(Star int) ([]*item.Item, []*item.Item, int, []int
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
NeedStar := decorateCfg.GetStarCost(d.AreaId, v)
|
NeedStar := decorateCfg.GetStarCost(d.AreaId, v)
|
||||||
|
if DecorateOffIsExist {
|
||||||
|
OffRate := limitedTimeEventCfg.GetDecorateOffDiscount(d.AreaId, v)
|
||||||
|
NeedStar = int(math.Ceil(float64(NeedStar) * float64(OffRate)))
|
||||||
|
}
|
||||||
if Star < NeedStar {
|
if Star < NeedStar {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ const (
|
|||||||
EVENT_TYPE_PAYBACK_DAY = 15 // 回收日
|
EVENT_TYPE_PAYBACK_DAY = 15 // 回收日
|
||||||
EVENT_TYPE_LITTLE_APPRENTICE = 16 // 小学徒
|
EVENT_TYPE_LITTLE_APPRENTICE = 16 // 小学徒
|
||||||
EVENT_TYPE_CAT_DAY_SALE = 17 // 猫咪大甩卖
|
EVENT_TYPE_CAT_DAY_SALE = 17 // 猫咪大甩卖
|
||||||
|
EVENT_TYPE_DECORATE_OFF = 18 // 装饰打折
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user