WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Tainted code and Purchase in C_AuctionHouse (patch 8.3) (https://www.wowinterface.com/forums/showthread.php?t=57922)

GreenCoyote 04-10-20 06:11 AM

Tainted code and Purchase in C_AuctionHouse (patch 8.3)
 
Hello! Im very new in wow addons, so may be my problem would look silly. Sorry about that.
Im trying to make purchase by addon. But I have a problem. My code is:
Code:

        itemKey = {};
        itemKey.itemID = 14047; -- Runecloth

        sorts = {};
        sorts.sortOrder = 0;
        sorts.reverseSort = false;
       
        C_AuctionHouse.SendSearchQuery(itemKey, sorts, false);
        C_AuctionHouse.StartCommoditiesPurchase(14047, 1);

But wow said this is bad, to call StartCommoditiesPurchase from tainted code.
Well. I read some articles about taint and started to call StartCommoditiesPurchase from secure button. But whole SearchQuersResult was tainted. So I moved all this code to /script of secure button. But according to taint.log, then Im creating table in macro – its taint too: “Global variable itemKey tainted by MACRO_TAINT - itemKey = {}”.

Im sure there is a way to make purchasing by lua code – TSM is doing this. But its code is to sophisticated for my LUA level to understand how it made.
So can someone share simple snippet, or give hint? I tried to google, but there is no good answers.
Sorry for my poor English, and thanks for reading.

GreenCoyote 04-10-20 11:58 PM

It is that simple
 
After day of experiments, I realized that there is no need for secure functions. I just did it the wrong way. Code to buy something is:
Code:

C_AuctionHouse.StartCommoditiesPurchase(itemId, qty, unitPrice);
C_AuctionHouse.ConfirmCommoditiesPurchase(itemId, qty);

And, that’s it. You do not need anything else. Thanks for reading.


All times are GMT -6. The time now is 12:18 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI