function update_schema() { $schema = json_decode(get_data('http://api.steampowered.com/IEconItems_570/GetSchema/v0001/?key=' . AKey() . '&language=en_us', 12), true); if (isset($schema['result']['status']) && $schema['result']['status'] == 1 && isset($schema['result']['items'][1]['defindex'])) { $schema = $schema['result']; } else { return 0; } $res = array(); foreach ($schema['originNames'] as $key => $val) { $schema['origin'][$val['origin']] = $val['name']; } //insert all items by defindex. foreach ($schema['items'] as $key => $item) { unset($item['item_description']); unset($item['proper_name']); unset($item['image_inventory']); unset($item['capabilities']); unset($item['tool']); unset($item['attributes']); $res[$item['defindex']] = $item; } $schema['items'] = $res; unset($res); //put all effects into the effect key. foreach ($schema['attribute_controlled_attached_particles'] as $key => $effect) { $schema['effect'][$effect['id']]['name'] = $effect['name']; $schema['effect'][$effect['id']]['id'] = $effect['id']; } foreach ($schema['qualities'] as $qual => $val) { $schema['quality'][$val]['name'] = $qual; $schema['quality'][$val]['display_name'] = $schema['qualityNames'][$qual]; } unset($schema['attribute_controlled_attached_particles']); $result = json_encode($schema); $dir = json_directory(); file_put_contents($dir . "/570_schema.json", $result); file_put_contents($dir . "/570_schema_time.txt", time()); }
if (isset($item['valve_avg']) && $item['valve_avg'] != -1 && $item['valve_avg'] != 0) { $price = sprintf("%.2f", $item['valve_avg'] / 100); } else { if (isset($price) && $price != 0 && $price != -1) { $price = sprintf("%.2f", cs_price($item['name']) / 100); } else { $price = 0; $num_unpriced++; } } echo '<tr><td><img src="' . $item['img_url'] . '"></td><td data-sort-value="' . $price . '">' . ($price != 0 ? $price : 'N/A') . '</td><td>' . $item['name'] . '</td></tr>'; $pricelist[$item['name']] = array('img' => $item['img_url'], 'price' => $price, 'classid' => isset($item['classid']) ? $item['classid'] : ''); } echo '</table>'; echo $num_unpriced, ' Unpriced items remain.'; file_put_contents(json_directory() . '/cs_schema.json', json_encode($pricelist)); db_save('730_schemalist_time', array('time' => time(), 'priced' => $num_priced)); //echo '<br><br>'; //echo cs_price( 'Nova | Tempest (Minimal Wear)' ); function cs_price($itemName) { $col = db_init('market_730', 'item_prices'); //old query that worked: array( array( '$match' => array( 'name' =>$itemName ) ), array( '$group' => array( '_id'=>null, 'avgPrice' => array( '$avg'=> '$price' ) ) ) ); $count = $col->count(array("name" => "{$itemName}")); if ($count == 0) { //$res = json_decode( get_data( 'http://steamcommunity.com/market/priceoverview/?appid=730&market_hash_name=' . urlencode( $itemName ) ), true ); //if(isset($res['success'] ) && $res['success'] == true && (isset($res['lowest_price']) || isset($res['median_price']) ) ){ // if (isset($res['median_price'])) // return substr($res['median_price'], 1); // if (isset($res['lowest_price'])) // return substr($res['lowest_price'], 1);
function schema_730() { return json_decode(file_get_contents(json_directory() . '/cs_schema.json'), true); }
echo '</select><br>'; echo 'Backpack <img src ="img/BPIcon.png" alt="Viewer" height="16" width="16"> 2: ' . '<select name="numeric[bp][2]">'; foreach ($viewers as $key => $val) { echo '<option value="' . $key . '"'; if (isset($_SESSION['pref']['numeric']['bp'][2]) && $_SESSION['pref']['numeric']['bp'][2] === $key) { echo ' selected="selected"'; } echo '>' . $val . '</option>'; } echo '</select><br><br>'; //echo 'clicking an item will copy the following to your clipboard:<br><input type="text" style="width: 304px;" name="string[itemnote]" value="Would you be willing to trade your ##itemname##?"><br><br>'; echo 'Show warnings for hard-to-trade-for items: '; echo '<select name="numeric[warn]">' . '<option value="1"' . (!isset($_SESSION['pref']['numeric']['warn']) || $_SESSION['pref']['numeric']['warn'] == 1 ? ' selected="selected"' : '') . '>On</option>' . '<option value="0"' . (isset($_SESSION['pref']['numeric']['warn']) && $_SESSION['pref']['numeric']['warn'] == 0 ? ' selected="selected"' : '') . '>Off</option></select><br>'; echo '<img src="/img/w3.png">Traded for/painted/named/described/gifted.<br><img src="/img/w2.png">Equipped.'; echo '</div>'; echo '<div class="col2 rt">'; $quality_colours = quality_colours_prefs(1); echo '<h2 class="cf">Colour settings</h2>'; echo 'These colour settings will be used in all scans.<br>Colours can be reset to their original values with the "Delete Preferences" button.'; echo '<table class="preftable"><tr><th>quality</th><th>colour</th><th>border</th></tr>'; $x = 0; $qualityNames = json_decode(file_get_contents(json_directory() . '/qualities.json'), true); foreach ($quality_colours as $colour => $value) { $name = $qualityNames[$x]['display_name']; echo '<tr><td>' . $name . '</td><td><input class="color" name="css[' . $colour . '][bg]" maxlength="6" size="6" value="' . (isset($_SESSION['pref']['css'][$colour]['bg']) ? $_SESSION['pref']['css'][$colour]['bg'] : $quality_colours[$colour]['bg']) . '"/></td><td>' . '<input type="text" class="color" name="css[' . $colour . '][border]" maxlength="6" size="6" value="' . (isset($_SESSION['pref']['css'][$colour]['border']) ? $_SESSION['pref']['css'][$colour]['border'] : $quality_colours[$colour]['border']) . '"/></td></tr>'; $x++; } echo '</table>'; echo '</div>'; echo '<div class="col2 lt"><h2 class="cf">Update/Delete</h2><input name="Update" value="Update Preferences" type="submit"><input name="Delete" value="Delete Preferences" type="submit"></form><br></div>'; createFooter(440);
function updateListOfAllSteamGames() { $dir = json_directory(); $old = db_load('753_list_time'); if ($old == false || time() - $old >= 28800) { $listOfAllGamesOnSteam = json_decode(get_data('http://api.steampowered.com/ISteamApps/GetAppList/v2'), true); $listOfAllGamesOnSteam = $listOfAllGamesOnSteam['applist']['apps']; foreach ($listOfAllGamesOnSteam as $key => $game) { $OrderedList[$game['appid']] = $game['name']; } if ($OrderedList[5] === 'Dedicated Server') { $results = json_encode($OrderedList); file_put_contents($dir . "/753_games.json", $results); db_save('753_list_time', time()); } } }
function loadgames() { $dir = json_directory(); $gameList = $dir . "/753_games.json"; return json_decode(file_get_contents($gameList), true); }