示例#1
0
        /// <summary>
        /// Add item to the inventory
        /// </summary>
        /// <param name="resultSet">Result</param>
        /// <param name="item">Item to add</param>
        public void AddItem(ResultSet resultSet, EntityID item)
        {
            int emptySlot = -1;

            for (int i = 0; i < items.Length; i++)
            {
                if (items[i].isEmpty)
                {
                    emptySlot = i;
                    break;
                }
            }

            if (emptySlot == -1)
            {
                if (resultSet != null)
                {
                    resultSet.AddMessage(C.FSTR.Set("You cannot carry any more, your inventory is full!"));
                }
            }
            else
            {
                if (resultSet != null)
                {
                    resultSet.AddMessage(C.FSTR.Set("You pickup the ").Append(C.STR_COLOR_NAME).Append(item.e.name).Append("@-!"));
                    resultSet.AddItemAdded(item);
                }

                items[emptySlot] = item;
            }
        }