背包容量限制

This commit is contained in:
UnKownOwO
2023-02-13 19:01:42 +08:00
parent ddecfdea12
commit c23a75b802
7 changed files with 81 additions and 52 deletions

View File

@@ -62,6 +62,11 @@ func (p *Player) GetItemCount(itemId uint32) uint32 {
func (p *Player) AddItem(itemId uint32, count uint32) {
itemInfo := p.ItemMap[itemId]
if itemInfo == nil {
// 该物品为新物品时校验背包物品容量
// 目前物品包括材料和家具
if len(p.ItemMap) > constant.STORE_PACK_LIMIT_MATERIAL+constant.STORE_PACK_LIMIT_FURNITURE {
return
}
itemInfo = &Item{
ItemId: itemId,
Count: 0,