├── wearfinder.exe ├── .gitattributes ├── README.md └── wearfinder.py /wearfinder.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/high-voltage/wearfinder/HEAD/wearfinder.exe -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CS:GO Item Wear Finder 2 | by high voltage (http://steamcommunity.com/profiles/76561197982482557/) 3 | 4 | 5 | This program simplifies the process of getting the wear float values of items. 6 | 7 | How To run this without launching the exe (if you don't want to): 8 | 9 | 1. Download wearfinder.py 10 | 2. Install Python 2.7.8: https://www.python.org/downloads/release/python-278/ 11 | 3. Run IDLE (Python GUI) 12 | 4. Press File > Open > browse to wearfinder.py and open it 13 | 5. Enter your API Key in the script (ex. API_KEY = "4AK8793AJ23423KLS2347") 14 | 15 | Obtain your API Key here: https://steamcommunity.com/dev/apikey 16 | 6. Press F5 to run the script 17 | 18 | 19 | 20 | Usage: 21 | 22 | The programm will ask you to enter the Steamid64 of the user's profile. 23 | 24 | To get it, go to steamidfinder.com and follow their instructions. 25 | 26 | Note: A Steamid64 always starts with '765' 27 | 28 | 29 | 30 | After entering the Steamid64, press ENTER to list all items, or insert a specific Item ID (useful if a user has multiple items of the same type). 31 | 32 | 33 | Notes: 34 | 35 | The steam API Server is known to be very bad and often gives an empty response. Don't expect to have success every time... :( 36 | 37 | 38 | Preview Images: 39 | 40 | Paste a Steamid64 when running the exe: http://i.imgur.com/rqvI9ai.jpg 41 | 42 | List all items: http://i.imgur.com/wjwJt3o.jpg 43 | 44 | Get the wear value by a specific Item ID: http://i.imgur.com/lkMoQHM.jpg 45 | -------------------------------------------------------------------------------- /wearfinder.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | import time 4 | import json 5 | import string 6 | import urllib2 7 | from operator import itemgetter 8 | 9 | 10 | 11 | # enter your API Key here 12 | API_KEY = "XXXXXXXXXXXXXXXXXXXXXX" 13 | 14 | 15 | 16 | class User(object): 17 | def __init__(self, steamid, itemid=None): 18 | self.steamid = steamid 19 | self.PUBLIC_URL = "http://steamcommunity.com/profiles/%s/inventory/json/730/2/?l=english"%self.steamid 20 | self.API_URL = "http://api.steampowered.com/IEconItems_730/GetPlayerItems/v0001/?key=%s&SteamID=%s"%(API_KEY, self.steamid) 21 | self.public_contents = None 22 | self.api_contents = None 23 | self.items = {} 24 | self.itemid = itemid 25 | 26 | if self.itemid: 27 | self.get_api_contents() 28 | self.get_single_item(self.itemid) 29 | else: 30 | self.get_public_contents() 31 | self.get_api_contents() 32 | self.get_items() 33 | 34 | def get_public_contents(self): 35 | try: 36 | self.public_contents = json.loads(urllib2.urlopen(self.PUBLIC_URL).read()) 37 | except: 38 | print "Error gettings items from public API server. Retrying..." 39 | time.sleep(1) 40 | return self.get_public_contents() 41 | 42 | def get_api_contents(self): 43 | try: 44 | self.api_contents = json.loads(urllib2.urlopen(self.API_URL).read()) 45 | except: 46 | print "Error getting items from API Server. Retrying..." 47 | time.sleep(1) 48 | return self.get_api_contents() 49 | 50 | def get_items(self): 51 | try: 52 | print " " 53 | print "Listing all items..." 54 | print " " 55 | time.sleep(0.5) 56 | path = os.getcwd().replace('\\', '/') 57 | file = open(path + '/%s.txt'%self.steamid, 'w') 58 | for item in self.public_contents['rgInventory']: 59 | index = "%s_%s"%(self.public_contents['rgInventory'][item]['classid'], self.public_contents['rgInventory'][item]['instanceid']) 60 | self.items[index] = {} 61 | self.items[index]['id'] = self.public_contents['rgInventory'][item]['id'] 62 | 63 | for item in self.sort_items(self.public_contents['rgDescriptions']): 64 | if item[0] in self.items: 65 | self.items[item[0]]['name'] = "".join(c for c in self.public_contents['rgDescriptions'][item[0]]['market_hash_name'] if c in string.printable) 66 | nametag = "" 67 | if 'fraudwarnings' in self.public_contents['rgDescriptions'][item[0]]: 68 | self.items[item[0]]['nametag'] = self.public_contents['rgDescriptions'][item[0]]['fraudwarnings'][0] 69 | nametag = "(%s) "%self.items[item[0]]['nametag'] 70 | 71 | id = self.items[item[0]]['id'] 72 | name = self.items[item[0]]['name'] 73 | wear = self.get_wear(id) 74 | file.write("%s\n%sID: %s Wear: %s\n\n"%(name, nametag, id, wear)) 75 | print "%s\n%sID: %s Wear: %s\n"%(name, nametag, id, wear) 76 | file.close() 77 | print "Log file created: %s/%s.txt"%(path, self.steamid) 78 | 79 | print " " 80 | self.next() 81 | 82 | except: 83 | print "Error getting items. Possible reasons: Profile is private, Backpack is emtpy, Server is unresponsive." 84 | print "Retrying..." 85 | return self.get_items() 86 | 87 | def get_single_item(self, id): 88 | wear = self.get_wear(id) 89 | print " " 90 | print "Wear of %s: %s"%(id, wear) 91 | print " " 92 | self.next() 93 | 94 | def get_wear(self, id): 95 | try: 96 | for item in self.api_contents['result']['items']: 97 | if str(item['id']) == str(id): 98 | for attribute in item['attributes']: 99 | if attribute['defindex'] == 8: 100 | return attribute['float_value'] 101 | except: 102 | print "Failed to get the wear value. Something went wrong.. :(" 103 | time.sleep(3) 104 | 105 | def next(self): 106 | input = raw_input("Enter another Steamid64:\n") 107 | if not input.startswith('765'): 108 | print "You entered an invalid Steamid64. Please try again." 109 | return self.next() 110 | try: 111 | steamid = int(input) 112 | print " " 113 | print "Listing all items..." 114 | print " " 115 | self.__init__(steamid) 116 | except: 117 | print "You entered an invalid Steamid64. Please try again." 118 | return self.next() 119 | 120 | def sort_items(self, contents): 121 | sorted_items = {} 122 | for item in contents: 123 | if contents[item]['tradable'] == 0: 124 | continue 125 | if contents[item]['type'] in ('Base Grade Key', 'Base Grade Container'): 126 | continue 127 | if 'Sticker' in contents[item]['type']: 128 | continue 129 | sorted_items[item] = contents[item]['market_hash_name'] 130 | return sorted(sorted_items.items(), key=itemgetter(1)) 131 | 132 | 133 | 134 | 135 | def get_steamid(): 136 | steamid = raw_input("Enter the Steamid64: ") 137 | if not steamid.startswith("765"): 138 | print "You entered an invalid Steamid64. Please try again." 139 | return get_steamid() 140 | 141 | try: 142 | steamid = int(steamid) 143 | get_itemid(steamid) 144 | except: 145 | print "You entered an invalid Steamid64. Please try again." 146 | return get_steamid() 147 | 148 | def get_itemid(steamid): 149 | itemid = raw_input("\nPress ENTER to list all items or insert a specific Item ID: \n") 150 | if not itemid: 151 | print " " 152 | print "Connecting..." 153 | print " " 154 | print " " 155 | time.sleep(1) 156 | return User(steamid) 157 | else: 158 | try: 159 | itemid = int(itemid) 160 | User(steamid, itemid) 161 | except: 162 | print "You entered an invalid Item ID. Please try again." 163 | return get_itemid(steamid) 164 | 165 | def start(): 166 | if not API_KEY: 167 | print "API Key not defined. Get your api key here: https://steamcommunity.com/dev/apikey" 168 | time.sleep(3) 169 | return 170 | print " " 171 | print "-----------------------------------------------------" 172 | print "CS:GO ITEM WEAR-FINDER WRITTEN BY H!GH VOLTAGE" 173 | print "http://steamcommunity.com/profiles/76561197982482557/" 174 | print "-----------------------------------------------------" 175 | print " " 176 | print "General Wear Values:" 177 | print "0.00 - 0.06 : Factory New" 178 | print "0.06 - 0.15 : Minimal Wear" 179 | print "0.15 - 0.37 : Field Tested" 180 | print "0.37 - 0.44 : Well-Worn" 181 | print "0.44 - 1.00 : Battle-Scarred" 182 | print " " 183 | print "Note: For some items the minimum and maximum wear values are different" 184 | print "Read them up here: http://i-am-fat.org/csgo-skins/#rifles" 185 | print " " 186 | get_steamid() 187 | 188 | start() 189 | --------------------------------------------------------------------------------