RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Web Vendor view - list vendor items and location

AlphaDragon

Sorceror
Just an idea. Simular to the Webstatus but to list all the player vendors and quardanates of where they are city/map ect. When click on the vendor in the list would show you a list of the items that that vendor is selling. Seen it before but not sure if here in runuo... Just an idea to throw around..

If there is such a webstatus close to that idea?
 

_Epila_

Sorceror
I guess that no one have ever released somethink like that here in runuo forums.

You can export every npc data to a MySQL then read it from web, its not a easy task
 

aralith

Sorceror
I built a prototype of doing this awhile ago, but there was no use in releasing it on the RunUO forum because my solution required a core modification to use .NET 4.0. The easiest implementation (for me) was to host a WCF service inside RunUO. That bypassed needing an external data store and negated the need for syncing information or anything more complex than the code required to manage vendor inventory.
 

_Epila_

Sorceror
There is no need of WCF, just link the MySQL dlls to your scripts then export your data.

If you want something similar to the web status file, just write the files then move it to your web folder
 

Tissemand

Squire
You could just have a timer update every few minutes, and have it saved to a file, just like the web status -- that is the most basic idea. Have a loop that goes through all the vendors, then save the name, location, owner, items, and so forth.

You could alternatively use a database, and attempt to try synchronizing the vendors with the database when a vendor is created/deleted, but that seems like a pain to do.
 

aralith

Sorceror
If you're simply wanting to list all of the vendors and all of their items, another solution could be a very simple web server hosted within RunUO. It doesn't have to be as complex/featured as Vorspire's. All you need is to be able to make an ajax request to a simple path and return a JSON result to the client.

Here is a sample of how to write a very simple tcp server.
http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server

You could use something like Json.NET to serialize your result in .NET 2.0. If you have the choice to build the server in 3.5+ you can just use JavaScriptSerializer or DataContractJsonSerializer.
http://json.codeplex.com/

You could also avoid using any 3rd party dlls at all by just sending an XML response, but JSON is easier to work with ;/

The benefit of doing it this way is you'll be sure that your website's users are always seeing the most up to date results from the server. There's no need to worry about syncing, and you'll never have to worry about a server crash making the information in SQL different than what's actually on the server.

The only benefit of my WCF service mentioned above was my web application had 2-way communication with the server. It was a prototype of a entire vendor portal. (because nobody wants to log in to play UO anymore ;/ )
 

daat99

Moderator
Staff member
Please keep in mind that using the "integrated web server" means more strain on the RunUO server and more lag to the players.
If you do decide to go this route you'll need to implement some kind of multi-threading in order to avoid the lag and that would be even bigger pain.

My recommendation is that you save the data to HTML file that you can copy to your server from outside RunUO during world save and let the users know that the data is only updated when the world saves.

This will remove all the lag associated with the web requests and will only cost you the time it takes to save the data.
 

Vorspire

Knight
Please keep in mind that using the "integrated web server" means more strain on the RunUO server and more lag to the players.
If you do decide to go this route you'll need to implement some kind of multi-threading in order to avoid the lag and that would be even bigger pain.

My recommendation is that you save the data to HTML file that you can copy to your server from outside RunUO during world save and let the users know that the data is only updated when the world saves.

This will remove all the lag associated with the web requests and will only cost you the time it takes to save the data.

Not really, it's already totally multi-threaded and at best serves a mere couple of KB per page view, compared to the hundreds of Movement acknowledgement packets sent on every single step made by players.
It really doesn't impact performance at all and also serves physical files as well as programmed objects.
 

miroxian

Squire
If you could populate a database with vendor information, I would just use Django for this (reading databases is super easy). There aren't that many requests that would be going through to it, so I doubt it would scratch server performance.
 
Top