Jessecar96 / SteamBot

Automated bot software for interacting with Steam Trade
http://scrap.tf
MIT License
1.33k stars 910 forks source link

Calculating total items to be given (not one-by-one) #388

Closed ghost closed 11 years ago

ghost commented 11 years ago

Right now, the method I've been using is similar to this;

public override void OnTradeAddItem(Schema.Item schemaItem, Inventory.Item inventoryItem)
{
    foreach (ulong id in Trade.OtherOfferedItems)
    {
    var item = Trade.CurrentSchema.GetItem(schemaItem.Defindex);
    if (item.Defindex == 5021)
    {
        Keys++;
        // CALCULATE METAL TO BE GIVEN HERE //
    }
    }
}

But the problem with this is that the bot adds metal for the key as if it's been given individual keys. If I'm buying keys for 5.88 and the user wants to give 2 keys to me, I want the bot to be able to receive 11 ref., 2 rec., and 1 scrap, and not 5 ref., 2 rec., 1 scrap, 5 ref., 2 rec., 1 scrap. Any suggestions on how this should get carried out? I've tried a fair bit but it's not working out too well for me.

iMagooo commented 11 years ago

Yeah, not an issue. #307 mate.

waylaidwanderer commented 11 years ago

All I can suggest is to make an add metal function that takes the number of how many scrap it needs to give, and starts at the highest denominations, add until it can't add anymore, then goes down to the next type of metal. AddItemByDefindex returns a bool value to let you know if it was successful or not, which is useful. But really, this is a "how to program" question and this repository is for actual issues with SteamBot itself. Thus, #307

Jessecar96 commented 11 years ago

Do not reply to "issues" like this. It only encourages them. Leave them be and I will close them.