Exemplo n.º 1
0
    public bool EatItem(Vector3 a_itemPos, ServerPlayer a_player)
    {
        bool result           = true;
        int  itemIndexFromPos = this.GetItemIndexFromPos(a_itemPos.x, a_itemPos.z);

        if (itemIndexFromPos > -1 && (Items.IsEatable(this.m_items[itemIndexFromPos].type) || Items.IsMedicine(this.m_items[itemIndexFromPos].type)))
        {
            a_player.ConsumeItem(this.m_items[itemIndexFromPos].type);
            result = (0 == this.DeclineItemAmount(itemIndexFromPos, 1));
        }
        return(result);
    }
Exemplo n.º 2
0
    public bool EatItem(Vector3 a_itemPos, ServerPlayer a_player)
    {
        bool result           = true;
        int  itemIndexFromPos = GetItemIndexFromPos(a_itemPos.x, a_itemPos.z);

        if (itemIndexFromPos > -1)
        {
            DatabaseItem databaseItem = m_items[itemIndexFromPos];
            if (!Items.IsEatable(databaseItem.type))
            {
                DatabaseItem databaseItem2 = m_items[itemIndexFromPos];
                if (!Items.IsMedicine(databaseItem2.type))
                {
                    goto IL_0081;
                }
            }
            DatabaseItem databaseItem3 = m_items[itemIndexFromPos];
            a_player.ConsumeItem(databaseItem3.type);
            result = (0 == DeclineItemAmount(itemIndexFromPos, 1));
        }
        goto IL_0081;
IL_0081:
        return(result);
    }