diff --git a/logic/controller/fight_base.go b/logic/controller/fight_base.go index 6dbc1f1d..e5158908 100644 --- a/logic/controller/fight_base.go +++ b/logic/controller/fight_base.go @@ -76,6 +76,11 @@ func (h Controller) UsePetItemInboundInfo(data *fight.UsePetItemInboundInfo, c * if err := h.checkFightStatus(c); err != 0 { return nil, err } + if c.GetSpace().IsTime { + if data.ItemId < 300009 { + return nil, errorcode.ErrorCodes.ErrCannotPerformAction + } + } defer c.FightC.UseItem(c, data.CatchTime, data.ItemId) return nil, -1 } diff --git a/logic/service/space/space.go b/logic/service/space/space.go index 674e774b..01d102a6 100644 --- a/logic/service/space/space.go +++ b/logic/service/space/space.go @@ -33,6 +33,7 @@ type Space struct { info.MapBossInfo TimeBoss info.S2C_2022 Weather uint32 + IsTime bool //CanWeather uint32 } @@ -40,36 +41,8 @@ type Space struct { func NewSpace() *Space { ret := &Space{ - User: csmap.New[uint32, common.PlayerI]( - // set the number of map shards. the default value is 32. - csmap.WithShardCount[uint32, common.PlayerI](32), - - // // if don't set custom hasher, use the built-in maphash. - csmap.WithCustomHasher[uint32, common.PlayerI](func(key uint32) uint64 { - - return uint64(key) - }), - - // set the total capacity, every shard map has total capacity/shard count capacity. the default value is 0. - // csmap.WithSize[string, int](1000), - ), - UserInfo: csmap.New[uint32, info.SimpleInfo]( - // set the number of map shards. the default value is 32. - csmap.WithShardCount[uint32, info.SimpleInfo](32), - csmap.WithCustomHasher[uint32, info.SimpleInfo](func(key uint32) uint64 { - - return uint64(key) - }), - // // if don't set custom hasher, use the built-in maphash. - // csmap.WithCustomHasher[string, int](func(key string) uint64 { - // hash := fnv.New64a() - // hash.Write([]byte(key)) - // return hash.Sum64() - // }), - - // set the total capacity, every shard map has total capacity/shard count capacity. the default value is 0. - // csmap.WithSize[string, int](1000), - ), + User: csmap.New[uint32, common.PlayerI](), + UserInfo: csmap.New[uint32, info.SimpleInfo](), } return ret @@ -111,6 +84,9 @@ func GetSpace(id uint32) *Space { r := service.NewMapService().GetData(ret.ID) if r != nil { + if r.IsTimeSpace != 0 { + ret.IsTime = true + } if len(r.WeatherType) > 1 { // ret.CanWeather = 1 cool.Cron.CustomFunc(ret, func() {