feat(gameplay): 实现空间掉落物品系统 - 在Space结构体中添加DropItemIds字段存储掉落物品配置 - 添加GetDrop方法用于随机获取掉落物品 - 将战斗怪物掉落逻辑从地图服务改为使用空间服务 - 修复屏幕会话中断信号配置为^C BREAKING CHANGE: 掉落物品逻辑从地图服务迁
This commit is contained in:
@@ -44,9 +44,9 @@ type Space struct {
|
||||
WeatherType []uint32
|
||||
TimeBoss info.S2C_2022
|
||||
//Weather uint32
|
||||
IsTime bool
|
||||
|
||||
PitS *csmap.CsMap[int, []model.MapPit]
|
||||
IsTime bool
|
||||
DropItemIds []uint32
|
||||
PitS *csmap.CsMap[int, []model.MapPit]
|
||||
}
|
||||
|
||||
// NewSyncMap 创建一个新的玩家同步map
|
||||
@@ -189,7 +189,7 @@ func (ret *Space) init() {
|
||||
|
||||
r := service.NewMapService().GetData(ret.ID)
|
||||
if r != nil {
|
||||
|
||||
ret.DropItemIds = r.DropItemIds
|
||||
if r.IsTimeSpace != 0 {
|
||||
ret.IsTime = true
|
||||
}
|
||||
@@ -278,3 +278,14 @@ func (ret *Space) GenWer() {
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
func (ret *Space) GetDrop() int64 {
|
||||
|
||||
if len(ret.DropItemIds) > 0 {
|
||||
|
||||
item := int64(ret.DropItemIds[grand.Intn(len(ret.DropItemIds))])
|
||||
|
||||
return int64(item)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user