限时事件bounes优化
This commit is contained in:
parent
7e03391514
commit
c5f7ff602d
@ -7,6 +7,7 @@ import (
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -207,3 +208,11 @@ func PlayroomTrigger(Time int64, Num int) (int64, int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func SplitInt(str, sep string) []int {
|
||||
var ret []int
|
||||
for _, v := range strings.Split(str, sep) {
|
||||
ret = append(ret, Int(v))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ func GetFastProduceReward(Times, Energy int) []*item.Item {
|
||||
}
|
||||
|
||||
// 获取进度最大值
|
||||
func GetProgressMax(Lv int) int {
|
||||
func GetProgressMax(Lv, Num int) int {
|
||||
data, err := gamedata.GetData(CFG_LIMITED_TIME_EVENT_BOUNS)
|
||||
if err != nil {
|
||||
log.Debug("GetProgressMax err:%v", err)
|
||||
@ -148,7 +148,13 @@ func GetProgressMax(Lv int) int {
|
||||
Min := gamedata.GetIntValue(v, "Min")
|
||||
Max := gamedata.GetIntValue(v, "Max")
|
||||
if Lv >= Min && Lv <= Max {
|
||||
return gamedata.GetIntValue(v, "OrderNum")
|
||||
OrderNumStr := gamedata.GetStringValue(v, "OrderNum")
|
||||
OrderNum := GoUtil.SplitInt(OrderNumStr, ",")
|
||||
if Num >= len(OrderNum) {
|
||||
return OrderNum[len(OrderNum)-1]
|
||||
} else {
|
||||
return OrderNum[Num]
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0
|
||||
|
||||
@ -93,8 +93,8 @@ func UnitAllCard(p *Player) error {
|
||||
|
||||
func UnitLimitProgress(p *Player) error {
|
||||
LimitedTimeEventMod := p.PlayMod.getLimitedTimeEventMod()
|
||||
LimitedTimeEventMod.Progress = 7
|
||||
LimitedTimeEventMod.Progress = 5
|
||||
LimitedTimeEventMod.ZeroUpdate(7)
|
||||
LimitedTimeEventMod.AddProgress(4)
|
||||
LimitedTimeEventMod.AddProgress(6)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -182,21 +182,21 @@ func (c *CardMod) BackData() *msg.ResCardInfo {
|
||||
}
|
||||
cardList = append(cardList, &msg.Card{Id: int32(k), Count: int32(v)})
|
||||
}
|
||||
ReqUid := make([]int32, 0)
|
||||
ReqUid := make([]int64, 0)
|
||||
for _, v := range c.ReqFriend {
|
||||
if v.EndTime < GoUtil.Now() {
|
||||
delete(c.ReqFriend, v.BUid)
|
||||
continue
|
||||
}
|
||||
ReqUid = append(ReqUid, int32(v.BUid))
|
||||
ReqUid = append(ReqUid, int64(v.BUid))
|
||||
}
|
||||
ExUid := make([]int32, 0)
|
||||
ExUid := make([]int64, 0)
|
||||
for k, v := range c.ExCard {
|
||||
if v.EndTime < GoUtil.Now() {
|
||||
delete(c.ExCard, k)
|
||||
continue
|
||||
}
|
||||
ExUid = append(ExUid, int32(k))
|
||||
ExUid = append(ExUid, int64(k))
|
||||
}
|
||||
return &msg.ResCardInfo{
|
||||
CardList: cardList,
|
||||
@ -451,21 +451,21 @@ func (c *CardMod) NotifyCard() *msg.ResNotifyCard {
|
||||
}
|
||||
|
||||
func (c *CardMod) NotifyTimes() *msg.ResNotifyCardTimes {
|
||||
ReqUid := make([]int32, 0)
|
||||
ReqUid := make([]int64, 0)
|
||||
for k, v := range c.ReqFriend {
|
||||
if v.EndTime < GoUtil.Now() {
|
||||
delete(c.ReqFriend, k)
|
||||
continue
|
||||
}
|
||||
ReqUid = append(ReqUid, int32(k))
|
||||
ReqUid = append(ReqUid, int64(k))
|
||||
}
|
||||
ExUid := make([]int32, 0)
|
||||
ExUid := make([]int64, 0)
|
||||
for k, v := range c.ExCard {
|
||||
if v.EndTime < GoUtil.Now() {
|
||||
delete(c.ExCard, k)
|
||||
continue
|
||||
}
|
||||
ExUid = append(ExUid, int32(k))
|
||||
ExUid = append(ExUid, int64(k))
|
||||
}
|
||||
m := &msg.ResNotifyCardTimes{
|
||||
ExTimes: int32(c.ExTimes),
|
||||
|
||||
@ -33,9 +33,10 @@ type LimitedTimeEventMod struct {
|
||||
Progress int
|
||||
ProgressReward map[int]int
|
||||
LastSelect int
|
||||
Lv int
|
||||
Lv int // 玩家等级 零点更新
|
||||
ProgressMax int
|
||||
LastOption []int
|
||||
BounsNum int
|
||||
}
|
||||
|
||||
type LTEInfo struct {
|
||||
@ -56,13 +57,14 @@ func (l *LimitedTimeEventMod) InitData(Lv int) {
|
||||
}
|
||||
if l.ProgressMax == 0 {
|
||||
l.Lv = Lv
|
||||
l.ProgressMax = limitedTimeEventCfg.GetProgressMax(Lv)
|
||||
l.ProgressMax = limitedTimeEventCfg.GetProgressMax(Lv, l.BounsNum)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *LimitedTimeEventMod) ZeroUpdate(Lv int) {
|
||||
l.Lv = Lv
|
||||
l.ProgressMax = limitedTimeEventCfg.GetProgressMax(Lv)
|
||||
l.BounsNum = 0
|
||||
l.ProgressMax = limitedTimeEventCfg.GetProgressMax(Lv, l.BounsNum)
|
||||
}
|
||||
|
||||
// 判断限时事件是否存在
|
||||
@ -231,8 +233,8 @@ func (l *LimitedTimeEventMod) AddProgress(Lv int) {
|
||||
}
|
||||
l.Progress++
|
||||
if l.Progress == l.ProgressMax {
|
||||
SelectNum := limitedTimeEventCfg.GetProgressSelectNum(Lv)
|
||||
BounsLv := limitedTimeEventCfg.GetBounsLv(Lv)
|
||||
SelectNum := limitedTimeEventCfg.GetProgressSelectNum(l.Lv)
|
||||
BounsLv := limitedTimeEventCfg.GetBounsLv(l.Lv)
|
||||
RandMap := limitedTimeEventCfg.GetProgressRewardRand(BounsLv)
|
||||
n := 0
|
||||
r := make([]int, 0)
|
||||
@ -264,7 +266,8 @@ func (l *LimitedTimeEventMod) SelectProgressReward(Id int) ([]*item.Item, error)
|
||||
l.LastSelect = RewardId
|
||||
l.ProgressReward = make(map[int]int)
|
||||
l.Progress = 0
|
||||
l.ProgressMax = limitedTimeEventCfg.GetProgressMax(l.Lv)
|
||||
l.BounsNum++
|
||||
l.ProgressMax = limitedTimeEventCfg.GetProgressMax(l.Lv, l.BounsNum)
|
||||
return Item, nil
|
||||
}
|
||||
|
||||
|
||||
@ -5036,8 +5036,8 @@ type ResCardInfo struct {
|
||||
ReqTimes int32 `protobuf:"varint,6,opt,name=ReqTimes,proto3" json:"ReqTimes,omitempty"` //剩余请求次数
|
||||
AllCard map[int32]int32 `protobuf:"bytes,7,rep,name=AllCard,proto3" json:"AllCard,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 万能卡牌
|
||||
EndTime int32 `protobuf:"varint,8,opt,name=EndTime,proto3" json:"EndTime,omitempty"` //周期结束时间
|
||||
ReqUid []int32 `protobuf:"varint,9,rep,packed,name=ReqUid,proto3" json:"ReqUid,omitempty"` // 今日已请求的Uid
|
||||
ExUid []int32 `protobuf:"varint,10,rep,packed,name=ExUid,proto3" json:"ExUid,omitempty"` // 今日已置换的Uid
|
||||
ReqUid []int64 `protobuf:"varint,9,rep,packed,name=ReqUid,proto3" json:"ReqUid,omitempty"` // 今日已请求的Uid
|
||||
ExUid []int64 `protobuf:"varint,10,rep,packed,name=ExUid,proto3" json:"ExUid,omitempty"` // 今日已置换的Uid
|
||||
GoldTimes int32 `protobuf:"varint,11,opt,name=GoldTimes,proto3" json:"GoldTimes,omitempty"` //剩余金卡交换次数
|
||||
Round int32 `protobuf:"varint,12,opt,name=Round,proto3" json:"Round,omitempty"` // 轮次
|
||||
}
|
||||
@ -5128,14 +5128,14 @@ func (x *ResCardInfo) GetEndTime() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ResCardInfo) GetReqUid() []int32 {
|
||||
func (x *ResCardInfo) GetReqUid() []int64 {
|
||||
if x != nil {
|
||||
return x.ReqUid
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ResCardInfo) GetExUid() []int32 {
|
||||
func (x *ResCardInfo) GetExUid() []int64 {
|
||||
if x != nil {
|
||||
return x.ExUid
|
||||
}
|
||||
@ -5163,8 +5163,8 @@ type ResNotifyCardTimes struct {
|
||||
|
||||
ExTimes int32 `protobuf:"varint,1,opt,name=ExTimes,proto3" json:"ExTimes,omitempty"` //剩余兑换次数
|
||||
ReqTimes int32 `protobuf:"varint,2,opt,name=ReqTimes,proto3" json:"ReqTimes,omitempty"` //剩余请求次数
|
||||
ReqUid []int32 `protobuf:"varint,3,rep,packed,name=ReqUid,proto3" json:"ReqUid,omitempty"` // 今日已请求的Uid
|
||||
ExUid []int32 `protobuf:"varint,4,rep,packed,name=ExUid,proto3" json:"ExUid,omitempty"` // 今日已置换的Uid
|
||||
ReqUid []int64 `protobuf:"varint,3,rep,packed,name=ReqUid,proto3" json:"ReqUid,omitempty"` // 今日已请求的Uid
|
||||
ExUid []int64 `protobuf:"varint,4,rep,packed,name=ExUid,proto3" json:"ExUid,omitempty"` // 今日已置换的Uid
|
||||
GoldTimes int32 `protobuf:"varint,5,opt,name=GoldTimes,proto3" json:"GoldTimes,omitempty"` //剩余金卡交换次数
|
||||
}
|
||||
|
||||
@ -5212,14 +5212,14 @@ func (x *ResNotifyCardTimes) GetReqTimes() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ResNotifyCardTimes) GetReqUid() []int32 {
|
||||
func (x *ResNotifyCardTimes) GetReqUid() []int64 {
|
||||
if x != nil {
|
||||
return x.ReqUid
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ResNotifyCardTimes) GetExUid() []int32 {
|
||||
func (x *ResNotifyCardTimes) GetExUid() []int64 {
|
||||
if x != nil {
|
||||
return x.ExUid
|
||||
}
|
||||
@ -18517,8 +18517,8 @@ var file_proto_Gameapi_proto_rawDesc = []byte{
|
||||
0x41, 0x6c, 0x6c, 0x43, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x6e, 0x64, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x71, 0x55, 0x69, 0x64, 0x18, 0x09, 0x20, 0x03, 0x28,
|
||||
0x05, 0x52, 0x06, 0x52, 0x65, 0x71, 0x55, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x78, 0x55,
|
||||
0x69, 0x64, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x45, 0x78, 0x55, 0x69, 0x64, 0x12,
|
||||
0x03, 0x52, 0x06, 0x52, 0x65, 0x71, 0x55, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x78, 0x55,
|
||||
0x69, 0x64, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x45, 0x78, 0x55, 0x69, 0x64, 0x12,
|
||||
0x1c, 0x0a, 0x09, 0x47, 0x6f, 0x6c, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x09, 0x47, 0x6f, 0x6c, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x52, 0x6f,
|
||||
@ -18531,9 +18531,9 @@ var file_proto_Gameapi_proto_rawDesc = []byte{
|
||||
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x45, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x73,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x71, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x08, 0x52, 0x65, 0x71, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x52, 0x65, 0x71, 0x55, 0x69, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x52, 0x65,
|
||||
0x52, 0x65, 0x71, 0x55, 0x69, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x52, 0x65,
|
||||
0x71, 0x55, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x78, 0x55, 0x69, 0x64, 0x18, 0x04, 0x20,
|
||||
0x03, 0x28, 0x05, 0x52, 0x05, 0x45, 0x78, 0x55, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x47, 0x6f,
|
||||
0x03, 0x28, 0x03, 0x52, 0x05, 0x45, 0x78, 0x55, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x47, 0x6f,
|
||||
0x6c, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x47,
|
||||
0x6f, 0x6c, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x22, 0x37, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x4d,
|
||||
0x61, 0x73, 0x74, 0x65, 0x72, 0x43, 0x61, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user