5

In a World of Warcraft Vanilla Lua Addon Development, how can I issue an HTTP call to receive data back? If not, how can I get data from a web source into the game while playing?

I have a feeling the answer is tragically short, but would like the question asked and answered on Stack Overflow. My research came up lacking, and I recall doing some LUA in ~2007 and was disappointed.

user7393973
  • 2,270
  • 1
  • 20
  • 58
Suamere
  • 5,691
  • 2
  • 44
  • 58

2 Answers2

5

Well, tragically short is an understatement. You simply can't. There was never any APIs that interacted directly with connections, let alone create any, let alone to arbitrary URLs.

Most of them just broadcast game events that occur from the game's connection, and the closest thing you can get to a "data stream" is add-on chat channels. But since bots violate the ToS, you wouldn't be able to make an account that responds to your addon's inquiries.


The closest thing you can get is building an "asynchronous mesh network", but that's only good if your addon has a considerable user base, and it's not guaranteed you'll get information timely.

The general idea is that your addon will have a public key (as in encryption), and you (only you) will detain a private key. Your addon emits a message to any connected peers, which store it on cross-realm SavedVariables, and you hope that someone will have characters on more than one realm. Upon login, the client addon will broadcast its latest packet (still encrypted) to that realm's addon channel, and hopefully within a week or so you might get the updated information across all clients.

A disadvantage is that you'll only get "push" notifications, the client won't be able to send any data back to you*.

That, or you could release a patch for the addon on Curse :P


BUT WAIT!

You mention vanilla, so I can presume you're developing this for a private server. Private servers often have one or a very small amount of realms, making the above mesh network much simpler. Instead of a mesh, just have encryption and manually login&broadcast on each realm every time you want to update the information retrieved.

Plus, you might even be able to contact the server devs to allow you an API that sends messages to the appropriate ingame addon channel (you'd have to ask).

Of course, if you pretend to make your addon server-agnostic, instead of tailored to a specific server, you're back to square one.


 * Unless you are really dedicated to make that happen, because it's a ton of work.

Community
  • 1
  • 1
  • Thanks Kroltan. Atlas Loot allows you to "Query the Server" in order to pull information about an item, given some conditions. I looked all through that code and can't seem to find anything that actually calls to the server. If there were, I'd like to know where so I could intercept it on my private server and code a handler to hit some other endpoint. I'm guessing Atlas Loot is really just Querying some data that is built into the client, and never really leaves the User's PC. – Suamere Jan 31 '17 at 23:47
  • @Suamere I'm not particularly familiar with Atlas, but it does seem they just pack a database with the addon, in the form of a conveniently structured Lua table. As for the private server, you could have a special chat channel, and communicate with the addon via chat messages. Listen to messages in a specific format, and broadcast responses tagged with the destination. – This company is turning evil. Feb 01 '17 at 00:15
0

There is no web API in vanilla WoW. There is a web browser widget in the game currently though, albeit very limited in usage.

If you have access to the server software code, you may be able to hook listening on specific game channels for user messages in a defined format, and let the server respond in a way for the addon to parse it.

IS4
  • 11,945
  • 2
  • 47
  • 86
  • This doesn't answer the question, but I can't help but like the workaround idea. Though the goal would be to easily port the ability to other private servers if they are willing. The less server-side changes I need to make, the better. But I can easily imagine some basic changes I could test on my own server while developing this and that may be minimalistic. – Suamere Feb 07 '17 at 17:44