Ejemplo n.º 1
0
        public void AutoFeed()
        {
            if (UserCompanion.Hunger > 0)
            {
                return;
            }

            UserItem item = Equipment[(int)CompanionSlot.Food];

            if (item == null || !CanUseItem(item.Info))
            {
                return;
            }


            UserCompanion.Hunger = Math.Min(LevelInfo.MaxHunger, item.Info.Stats[Stat.CompanionHunger]);

            S.ItemChanged result = new S.ItemChanged
            {
                Link = new CellLinkInfo {
                    GridType = GridType.CompanionEquipment, Slot = (int)CompanionSlot.Food
                },
                Success = true,
            };

            CompanionOwner.Enqueue(result);
            if (item.Count > 1)
            {
                item.Count--;
                result.Link.Count = item.Count;
            }
            else
            {
                RemoveItem(item);
                Equipment[(int)CompanionSlot.Food] = null;
                item.Delete();

                result.Link.Count = 0;
            }
        }