1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-02-24 00:12:50 +08:00
committed by cnb
parent 25c9ecdad6
commit 467890a60b
2 changed files with 11 additions and 30 deletions

View File

@@ -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
}

View File

@@ -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() {