示例#1
0
    public override bool CanDoAction(Item item, BasePlayer player)
    {
        bool flag;

        if (!player.metabolism.CanConsume())
        {
            return(false);
        }
        if (item.contents == null)
        {
            return(false);
        }
        List <Item> .Enumerator enumerator = item.contents.itemList.GetEnumerator();
        try
        {
            while (enumerator.MoveNext())
            {
                Item           current   = enumerator.Current;
                ItemModConsume component = current.info.GetComponent <ItemModConsume>();
                if (component == null || !component.CanDoAction(current, player))
                {
                    continue;
                }
                flag = true;
                return(flag);
            }
            return(false);
        }
        finally
        {
            ((IDisposable)enumerator).Dispose();
        }
        return(flag);
    }
示例#2
0
    private void DoDrink(BaseEntity.RPCMessage msg)
    {
        if (!msg.player.CanInteract())
        {
            return;
        }
        Item item = this.GetItem();

        if (item == null)
        {
            return;
        }
        if (item.contents == null)
        {
            return;
        }
        if (!msg.player.metabolism.CanConsume())
        {
            return;
        }
        foreach (Item content in item.contents.itemList)
        {
            ItemModConsume component = content.info.GetComponent <ItemModConsume>();
            if (component == null || !component.CanDoAction(content, msg.player))
            {
                continue;
            }
            component.DoAction(content, msg.player);
            return;
        }
    }
示例#3
0
 public override void DoAction(Item item, BasePlayer player)
 {
     foreach (Item obj in item.contents.itemList)
     {
         ItemModConsume component = (ItemModConsume)((Component)obj.info).GetComponent <ItemModConsume>();
         if (!Object.op_Equality((Object)component, (Object)null) && component.CanDoAction(obj, player))
         {
             component.DoAction(obj, player);
             break;
         }
     }
 }
示例#4
0
 public override void DoAction(Item item, BasePlayer player)
 {
     foreach (Item item2 in item.contents.itemList)
     {
         ItemModConsume component = item2.info.GetComponent <ItemModConsume>();
         if (!(component == null) && component.CanDoAction(item2, player))
         {
             component.DoAction(item2, player);
             break;
         }
     }
 }
示例#5
0
 public override void DoAction(Item item, BasePlayer player)
 {
     foreach (Item content in item.contents.itemList)
     {
         ItemModConsume component = content.info.GetComponent <ItemModConsume>();
         if (component == null || !component.CanDoAction(content, player))
         {
             continue;
         }
         component.DoAction(content, player);
         return;
     }
 }
示例#6
0
 public void SVDrink(BaseEntity.RPCMessage rpc)
 {
     if (!rpc.player.metabolism.CanConsume())
     {
         return;
     }
     foreach (Item obj in this.inventory.itemList)
     {
         ItemModConsume component = (ItemModConsume)((Component)obj.info).GetComponent <ItemModConsume>();
         if (!Object.op_Equality((Object)component, (Object)null) && component.CanDoAction(obj, rpc.player))
         {
             component.DoAction(obj, rpc.player);
             break;
         }
     }
 }
示例#7
0
 public override bool CanDoAction(Item item, BasePlayer player)
 {
     if (!player.metabolism.CanConsume() || item.contents == null)
     {
         return(false);
     }
     foreach (Item obj in item.contents.itemList)
     {
         ItemModConsume component = (ItemModConsume)((Component)obj.info).GetComponent <ItemModConsume>();
         if (!Object.op_Equality((Object)component, (Object)null) && component.CanDoAction(obj, player))
         {
             return(true);
         }
     }
     return(false);
 }
示例#8
0
 public void SVDrink(RPCMessage rpc)
 {
     if (!rpc.player.metabolism.CanConsume())
     {
         return;
     }
     foreach (Item item in base.inventory.itemList)
     {
         ItemModConsume component = item.info.GetComponent <ItemModConsume>();
         if (!(component == null) && component.CanDoAction(item, rpc.player))
         {
             component.DoAction(item, rpc.player);
             break;
         }
     }
 }
 public void SVDrink(BaseEntity.RPCMessage rpc)
 {
     if (!rpc.player.metabolism.CanConsume())
     {
         return;
     }
     foreach (Item item in this.inventory.itemList)
     {
         ItemModConsume component = item.info.GetComponent <ItemModConsume>();
         if (component == null || !component.CanDoAction(item, rpc.player))
         {
             continue;
         }
         component.DoAction(item, rpc.player);
         return;
     }
 }
示例#10
0
 public override bool CanDoAction(Item item, BasePlayer player)
 {
     if (!player.metabolism.CanConsume())
     {
         return(false);
     }
     if (item.contents == null)
     {
         return(false);
     }
     foreach (Item item2 in item.contents.itemList)
     {
         ItemModConsume component = item2.info.GetComponent <ItemModConsume>();
         if (!(component == null) && component.CanDoAction(item2, player))
         {
             return(true);
         }
     }
     return(false);
 }
示例#11
0
    private void DoDrink(RPCMessage msg)
    {
        if (!msg.player.CanInteract())
        {
            return;
        }
        Item item = GetItem();

        if (item == null || item.contents == null || !msg.player.metabolism.CanConsume())
        {
            return;
        }
        foreach (Item item2 in item.contents.itemList)
        {
            ItemModConsume component = item2.info.GetComponent <ItemModConsume>();
            if (!(component == null) && component.CanDoAction(item2, msg.player))
            {
                component.DoAction(item2, msg.player);
                break;
            }
        }
    }
    private void DoDrink(BaseEntity.RPCMessage msg)
    {
        if (!msg.player.CanInteract())
        {
            return;
        }
        Item obj1 = this.GetItem();

        if (obj1 == null || obj1.contents == null || !msg.player.metabolism.CanConsume())
        {
            return;
        }
        foreach (Item obj2 in obj1.contents.itemList)
        {
            ItemModConsume component = (ItemModConsume)((Component)obj2.info).GetComponent <ItemModConsume>();
            if (!Object.op_Equality((Object)component, (Object)null) && component.CanDoAction(obj2, msg.player))
            {
                component.DoAction(obj2, msg.player);
                break;
            }
        }
    }