View Single Post
07/08/20, 02:13 PM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Originally Posted by mikra View Post
Thats what I had in mind

Has noone done that before?
No as there exists an addon which does the same for you ingame?
No need to check the prices via a small popup dialog showing you the TOTAL length of the URL like
https://eu.tamrieltradecentre.com/pc...asc&lang=de-DE
-> And not even sure if it would be able to accept this total length of the string...

How to do such an addon:
You can build such an addon by just using LibCustomMenu to add a context menu entry to the inventory items,
let a function parse the item at the slot you are using the context menu on, using API function like local name = GetItemName(bag, slotIndex) and then parse the name:
-strip stuff like gender ^m ^s ^np via local nameClean = ZO_CachedStrFormat("<<c:1>>", name) (French, German and maybe other languages contain these characters as asuffix to the name!)
-replace spaces and other special characters with URL conform "ESCAPED" values like %27 for the ' in Mother's and + for a space
and store it in variable lcoal itemNameCleanAndEscaped
-get the client language and create a TTC compatible variable for the URL

local TTClang = "en-EN" --Fallback language English
local clientLang = GetCVar("language.2")
if clientLang == "de" then
TTClang = "de-DE"
elseif clientLang == "fr" then
TTClang = "fr-FR"
end

-And then use string.format to replace the placeholders in your defined URL template for TTC, e.g.
local templateTTCEUItemSearch = "https://eu.tamrieltradecentre.com/pc/Trade/SearchResult?SearchType=Sell&ItemNamePattern=%s&lang=%s
> I've shortened the URL. It seems to work witrh the search as well.
You only need the other stuff like
Code:
&ItemCategory1ID=&ItemTraitID=2&ItemQualityID=&IsChampionPoint=false&LevelMin=160&LevelMax=&MasterWritVoucherMin=&MasterWritVoucherMax=&AmountMin=&AmountMax=&PriceMin=&PriceMax=&SortBy=Price&Order=asc
if you want to add the item level, quality, trait and other values to your search.

local urlToCall = string.format(templateTTCEUItemSearch, itemNameCleanAndEscaped, TTClang )

And then call it via the API function to open a HTTP request via RequestOpenUnsafeUrl(urlToCall)


But again:
This is ALL in the given addon Tamriel Trade Center so why would one create another addon for it?
  Reply With Quote