|
@@ -132,6 +132,9 @@ namespace GameLogic.Bag
|
|
public bool AddItem(int itemId, long count, string guid = "")
|
|
public bool AddItem(int itemId, long count, string guid = "")
|
|
{
|
|
{
|
|
string guidStr = string.IsNullOrEmpty(guid) ? itemId.ToString() : guid;
|
|
string guidStr = string.IsNullOrEmpty(guid) ? itemId.ToString() : guid;
|
|
|
|
+
|
|
|
|
+ if(count <= 0)
|
|
|
|
+ return false;
|
|
|
|
|
|
ItemInfo item = GetItemInfo(itemId, guidStr);
|
|
ItemInfo item = GetItemInfo(itemId, guidStr);
|
|
return AddItemCount(item, count);
|
|
return AddItemCount(item, count);
|
|
@@ -175,6 +178,8 @@ namespace GameLogic.Bag
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if( count <= 0 )
|
|
|
|
+ return false;
|
|
item.count += count;
|
|
item.count += count;
|
|
|
|
|
|
EventManager.Instance.Dispatch(CustomEventType.ItemUpdate, new ItemUpdateData() { ItemInfo = item, Count = (int)count });
|
|
EventManager.Instance.Dispatch(CustomEventType.ItemUpdate, new ItemUpdateData() { ItemInfo = item, Count = (int)count });
|