Closed HilliamT closed 3 years ago
I am pretty sure it is in that order to account for key banking. I think the key banking logic would break if it is the other way around.
Forgot about the differentiation (keys being used to buy an item vs key banking) - thanks! I've now just strengthened the first if statement to ensure that the item fetched from the pricelist has to be of the current intent that is being evaluated.
Key banking / trading should still fall through to the other cases as before.
this is broken
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
if (match !== null && (sku !== '5021;6' || !exchange.contains.items)) { .... } else if (sku === '5021;6' && exchange.contains.items) { { .... } if (match === null || match.intent === (buying ? 1 : 0)) { .... }
If a bot owner has populated their pricelist with buy and sell prices, then clearly match is non-null.
Even if the current intent of the bot to buy that item is set to the opposite of what is being performed (e.g a user sends a trade offer buying items off the bot when the bot is only buying), the first case will apply and perform item price calculating (previous lines 428 - 466) regardless, accepting if the user is able to guess the sell / buy price.
This also means that we don't 'throw' the INVALID_ITEMS error as item intent is checked after the first if statement case.
Commit is to swap the order of condition checks to make item buying/selling intent stricter.