How does this site work ?

As more people asked me on how I get all this data, here a “short” explanation on how this site works.

Website functionality:
(use Firefox for best graphical experience, especially for the Overview and Comparator pages)

Basic function:

  • HTTP-Authentication is done via database to be able to map website username against their characterprofile later
  • As long as there is no language cookie stored the browserlanguage is used for displaying the according website content language, language can be changed by clicking on the flag, which sets this cookie, and reloads the page.

Main PK Trader frontpage:

  • daily indicators for most traded items (displaying the difference in gold/food/amount based on current value compared to the value 24hours before,
  • trendcolors are used for +/- 0-2% 2-5% 5-x%, the highlighting of values is only random to imitate the appearance of a real stockmarket website 😉
  • hovering over each item, and also the goldprice on the right, shows a quick preview of the actual pricedevelopment

PK Trader Blog:

  • a simple blog about changes of the website and other PK related stuff

PK Trader Chat:

  • a website internal chat

PK Price Matrix Calculator:

  • This page offers a fast spreadsheet for buying or selling items in gold/food and with substracted tradepost-tax,
  • amounts can be given optional, common amounts are shown directly, the item name can be typed in followed by TAB and is automatically matched for the current language and found databaseitem. (Ajax)

PK Product Chain Browser:

  • Each category shows the needed ingredients for a special product, together with the actual price+profit in gold/food/pct as well if it is cheaper to buy at a tradepost for food or gold, or to do it yourself instead of buying.

PK Price Chart Overview:

  • A quick overview of pricegraphs for most common items showing a last 60 days curve for the goldprice. (precached images)
  • Further a table of tops and flops compared to the last week/month, items you better should have bought or sold in gold/food

PK Price Chart Analyzer:

  • This is basically the Chart Overview generator, but enabled for every single item in the database, this is realtime, so be patient.
  • A little translator is included on the page, since those items listed here are original english.

PK Advisor+Strategy – This links to various subpages:

  • Dungeons
  • – a google embedded map of some dragon lairs around the world as published on the forums
  • – and a quickview select box for the same location as embedded image
  • Strategy
  • – a selfwritten guide for kingdom defense strategy (not yet completed)
  • Weapon and Armor
  • – generates a table for every level of a selected weapon/armor and when it was last traded for which amount of gold/food
  • Damage Matrix
  • – Links to the original wiki pages of PK for damage values and best gear, and explains FAQ about upgrades/conversion/reforging/inscription
  • PK Advisor (under construction)
  • – WeaponArmorAdvisor shows how much gold you will need to upgrade your selected weapon/armor to the maximum possible level
  • – SpecializationAdvisor shows you which bonus each class will get, and which weapon armor combo is efficient against normal/PvP
  • Comparator
  • – This simply compares the amounts of a selected item to the actual worth amount of another item, to allow simple trades between players.
  • – Intratrade top 20 shows items with a profitmargin between 10-20% when bought in gold and sold in food or vice versa.

PK Links (external)

  • A few links to PK related content, videos and websites of friends

Kingdom and City maps:

  • those are google maps embedded pages, some with multilayers to show huge areas of kingdomland

Kingdom Treasures Erdinger Weissbier members only):

  • a kingdom only page, that does the bookkeeping of castlegold (who owns what amount of that gold/crystal/oil)

Some more ideas in the pipe, but not much time so far:

  • Buy for gold sell for food advisor and vice versa
  • List most common/active/cheapest tradeposts
  • and lots more …

Database functionality and background jobs:

On demand, only if embedded on a page and cached for subsequent requests for 10 minutes:

  • 5 latest PK Forum Hot Topics
  • current gold/food spent/earned from profile statistics

Every 1 hour:

  • Tradingdata is acquired hourly from the main website:
  • Data is then separated and parsed into a database again. (on PerBlue side this step would be easy by directly accessing the trading data)
  • To speed things up later for selection fields and other stuff, a unique item table is generated/updated.
  • Calculate and store pricechange+amount for each item in gold+food for the last 24h
  • Actual and yesterdays prices and amount will be held in a separate indexed table to speed things up when queried.
  • Calculate and store goldprice change by doing refinedgold-crudegold=goldprice for 1food and store the values into a seperate table to be able to plot a goldprice graph same as for any other item

Every 1 day:

  • A 30 day goldpricegraph for selected items + goldprice itself (frontpage+overviewpage) is plotted into image files with ChartDirector
  • Precache last traded date and price in gold and food for every weapon and armor in all possible combinations and levels into a separate unique indexed table, for fast queries later


  • As new items arrive in the tradedata, and as their name is often changed later, I need to take care of them manually within the database.
  • Further I’m holding a translation table for items, to be able to accept user-entered-queries in either german+english (Matrix Calculator)
  • New users need to be linked to their PK user profile$char (CHR-ID) to be able to show their gold/food status later

I stripped most of the technical details, if you want to build your own site and need some formulas and/or efficient database queries, don’t hesitate to ask me, I’m always willing to help.


Status April 2011

Only a short status update for this site:

  • invited lots of new players to PK trader
  • the item comparator is now working
  • lots of fixes behind the scenes, everything should be a lot fast now

Nur ein kurzer Statusupdate für diese Website:

  • viele neue Spieler zum PK Trader eingeladen
  • der Warenvergleicher ist nun fertig
  • viele Fixes hinter den Kulissen, sollte jetzt alles noch schneller sein