mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
背包容量限制
This commit is contained in:
+10
-5
@@ -1,6 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"hk4e/common/constant"
|
||||
"hk4e/gdconf"
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
@@ -63,6 +64,15 @@ func (p *Player) GetReliquary(reliquaryId uint64) *Reliquary {
|
||||
}
|
||||
|
||||
func (p *Player) AddReliquary(itemId uint32, reliquaryId uint64, mainPropId uint32) {
|
||||
// 校验背包圣遗物容量
|
||||
if len(p.ReliquaryMap) > constant.STORE_PACK_LIMIT_RELIQUARY {
|
||||
return
|
||||
}
|
||||
itemDataConfig := gdconf.GetItemDataById(int32(itemId))
|
||||
if itemDataConfig == nil {
|
||||
logger.Error("reliquary config is nil, itemId: %v", itemId)
|
||||
return
|
||||
}
|
||||
reliquary := &Reliquary{
|
||||
ReliquaryId: reliquaryId,
|
||||
ItemId: itemId,
|
||||
@@ -75,11 +85,6 @@ func (p *Player) AddReliquary(itemId uint32, reliquaryId uint64, mainPropId uint
|
||||
AvatarId: 0,
|
||||
Guid: 0,
|
||||
}
|
||||
itemDataConfig := gdconf.GetItemDataById(int32(itemId))
|
||||
if itemDataConfig == nil {
|
||||
logger.Error("reliquary config is nil, itemId: %v", itemId)
|
||||
return
|
||||
}
|
||||
_ = itemDataConfig
|
||||
p.InitReliquary(reliquary)
|
||||
p.ReliquaryMap[reliquaryId] = reliquary
|
||||
|
||||
Reference in New Issue
Block a user