by Jake "rannmann" Forrester
This library provides Team Fortress 2 item tooltips to any item, based off a name search. Tooltips include the following data
- Image of item
- Item Name
- Item quality color (both in tooltip, and replaced within the span tags)
- Effect name if applicable
- Crate series number if applicable
- Item description
- Backpack.tf estimated value
- Holiday restriction information
Here is an example page which is included with this repo.
- PHP cron to retrieve item schema from steampowered.com and create/update MySQL tables with data
- PHP cron to retrieve price data from backpack.tf and create/update MySQL tables with data
- Javascript mouseover tooltips with item data (fetched via PHP & AJAX)
- 128x128 and 512x512 images of all current paint cans
- A sample page
Wrap an item name in a <span class="tfPrice"> tag, and the rest is taken care of for you. Vintage, strange, unusual, etc. items will display as the proper item color, and all items will have [brackets] around them.
####Examples:
<span class="tfPrice">Vintage Gunslinger</span> <-- Works!
<span class="tfPrice">V. Gunslinger</span> <-- Also works!
<span class="tfPrice">V Gunslinger</span> <-- Doesn't work. Needs either "V." or "Vintage"
<span class="tfPrice">Crate #42</span> <-- Works!
<span class="tfPrice">Unusual Carouser's Capotain (Circling Heart)</span> <-- Works!
<span class="tfPrice">U. Circling Heart Carouser's Capotain</span> <-- Also works!
<span class="tfPrice">Circling Heart Carouser's Capotain</span> <-- Doesn't work. Must prefix with "U." or "Unusual"
The config.php file is pretty self-explanatory. There is, however, one more change that may need to be made. The javascript file tftips.js uses the following line:
url: './tftips.php', // Grab price data from script...
Since this path is relative, it may or may not work for you. If you install in a subdirectory, don't forget to edit this line!
Data provided by backpack.tf and steampowered.com.
A special thanks to the DrunkenBombers community for helping me debug.
Questions? Comments? Open an issue or send me an email at rannmann@rannmann.com. I'd love to hear any feedback, good or bad!
- Item parsing no longer requires a price to be set on backpack.tf. Will show "N/A" if no price found
- Improved item lookup efficiency, especially with Unusuals
- Refactored searching to be more readable and editable
The way searching works has changed considerably, so please open a ticket if an item isn't displaying correctly anymore.
- Rewrote backpack.tf cronjob to be compatible with v4 of the API. Database table structure changed a bit due to this.
- Added four new columns
currency
- The currency the item's price is in (ex: metal, keys, earbuds, usd)value_raw
- The item's value in metal without rounding. If a price range exists, this is the average between the high and low value.tradable
- An enum denoting "Tradable" or "Non-Tradable"craftable
- An enum denoting "Craftable" or "Non-Craftable"
- Changed
value
column units tocurrency
rather than the default refined metal
- Added four new columns
Added Collector's items
Added support for jQuery's noConflict mode. This means tooltips can work on IPB now.
js/tftips.js
- Changed instances of $ to jQuery, and pass $ as a parameter to qTip2
Bug fixes
tftips.php
- Fixed Strange Bacon Grease showing up as a strange-quality itemtftips.php
- Fixed Strange Parts showing up as strange-quality itemsjs/tftips.js
- Fixed display of Strange Parts and Strange Bacon Greaseindex.html
- Added examples of non-strage strange-prefixed items
tftips.php
- Fixed Scorching Flames unusuals returning Burning Flames- Marginally increased efficiency of unusual searching
Mostly bug fixes and some upgrades to support jQuery 1.9.0+.
backpack_db.php
- New error checking added to relay backpack.tf API errors.- Fixed unusual effect "Orbiting Fire" from always attempting to find hats with "Eerie Orbiting Fire".
- Fixed items with "Vintage" as part of the unique item name only showing vintage quality of items.
- Fixed some line-wrap issues with tooltips
index.html
- Updated example page to describe some features, and made it look a lot prettier.jquery.qtip.min.js
- Updated to support newer versions of jQuery.- Changed default width on tooltips to 410px
- Changed default opacity of tooltips so they're more readable
- Added the word "Series" before crate numbers
- Added proper GPL headers.
The following files should be updated:
cron/backpack_db.php
- For error handlingcss/tftips.css
- For new formattingjs/jquery.qtip.min.js
- New qTip version to support jQuery versions 1.9.0+js/tftips.js
- Fix vintage parsing on Vintage Merryweather and Vintage Tyrolean (which aren't vintage-quality!)tftips.php
- Many bug fixes.
First release.