my code stock.com

Snippet options

Download: Download snippet as sell-via-dowhen-2.cpp.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<CustomBehavior File="RunCode" Type="Definition"><![CDATA[     
    // Items that always need to be sold
    HashSet<uint> RubbishItems = new HashSet<uint>(new uint[]
    {
        117, 118, 159, 
				805, 828, 856, 858, 1179, 
				2287, 2455, 2835, 2836, 
				4496, 4537, 4541, 4540, 4592, 4593, 4604, 4605, 
				5572, 
				6290, 6299, 6532,
				7755,   
				12223,   
				20406, 20407, 20408, 
				22710, 23389, 27668, 27669, 
				57247, 57542, 73209, 108330
    }); 
			 
    async Task SellRubbishItems()
    {
        Logging.Write("Selling items in RubbishItems");
				foreach (var item in Me.BagItems.Where(i => RubbishItems.Contains(i.Entry)))
				{
            Logging.Write("Selling {0}.", item.Name);                       
            item.UseContainerItem();
            await Coroutine.Sleep(1337);
				}
    }
]]></CustomBehavior>  

<CustomBehavior File="Hooks\DoWhen" AllowExecutionWhileNotAlive="false"  AllowUseWhileMounted="true" ActivityName="SellRubbish" UseWhen="MerchantFrame.Instance.IsVisible &amp;&amp; Me.BagItems.Any(i => 	RubbishItems.Contains(i.Entry))" >
    <CustomBehavior File="RunCode" Code="await SellRubbishItems();"/>  
</CustomBehavior>

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.