From c5f7ff602d865fc4d477bb71d8e3457d994f9db1 Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Wed, 25 Dec 2024 17:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E6=97=B6=E4=BA=8B=E4=BB=B6bounes?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/GoUtil/GoUtil.go | 9 +++++++ .../limitedTimeEvent/LimitedTimeEventCfg.go | 10 ++++++-- src/server/game/UnitTest.go | 4 ++-- src/server/game/mod/card/Card.go | 16 ++++++------- .../mod/limitedTimeEvent/LimitedTimeEvent.go | 15 +++++++----- src/server/msg/Gameapi.pb.go | 24 +++++++++---------- 6 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/server/GoUtil/GoUtil.go b/src/server/GoUtil/GoUtil.go index 5826154c..2b5d4536 100644 --- a/src/server/GoUtil/GoUtil.go +++ b/src/server/GoUtil/GoUtil.go @@ -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 +} diff --git a/src/server/conf/limitedTimeEvent/LimitedTimeEventCfg.go b/src/server/conf/limitedTimeEvent/LimitedTimeEventCfg.go index 30df3ccb..6bc19d4c 100644 --- a/src/server/conf/limitedTimeEvent/LimitedTimeEventCfg.go +++ b/src/server/conf/limitedTimeEvent/LimitedTimeEventCfg.go @@ -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 diff --git a/src/server/game/UnitTest.go b/src/server/game/UnitTest.go index a88603ec..1bd5a207 100644 --- a/src/server/game/UnitTest.go +++ b/src/server/game/UnitTest.go @@ -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 } diff --git a/src/server/game/mod/card/Card.go b/src/server/game/mod/card/Card.go index 31f568e0..ad975650 100644 --- a/src/server/game/mod/card/Card.go +++ b/src/server/game/mod/card/Card.go @@ -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), diff --git a/src/server/game/mod/limitedTimeEvent/LimitedTimeEvent.go b/src/server/game/mod/limitedTimeEvent/LimitedTimeEvent.go index 7c4029bd..e2140b1e 100644 --- a/src/server/game/mod/limitedTimeEvent/LimitedTimeEvent.go +++ b/src/server/game/mod/limitedTimeEvent/LimitedTimeEvent.go @@ -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 } diff --git a/src/server/msg/Gameapi.pb.go b/src/server/msg/Gameapi.pb.go index 403556a6..b899372f 100644 --- a/src/server/msg/Gameapi.pb.go +++ b/src/server/msg/Gameapi.pb.go @@ -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,