Beispiel #1
0
function updatePaints()
{
    $dir = json_directory();
    //file_put_contents( $dir . '/paint_time.txt', 0);
    $old = db_load('440_paint_time');
    if ($old == false || time() - $old >= 172800) {
        $allSchema = localSchema();
        $allSchema = $allSchema['items'];
        $marketMasterList = json_decode(get_data('http://api.steampowered.com/ISteamEconomy/GetAssetPrices/v0001/?appid=440&key=' . AKey()), true);
        if (!isset($marketMasterList['result']['success']) || $marketMasterList['result']['success'] != true) {
            $marketMasterList = json_decode(get_data('http://api.steampowered.com/ISteamEconomy/GetAssetPrices/v0001/?appid=440&key=' . AKey()), true);
            if (!isset($marketMasterList['result']['success']) || $marketMasterList['result']['success'] != true) {
                return false;
            }
        }
        //print_r_html( $marketMasterList );
        foreach ($allSchema as $item) {
            if (isset($item['item_type_name']) && $item['item_type_name'] == 'Tool' && $item['tool']['type'] == 'paint_can') {
                //this is a paint can. Let's get its TRUE IMAGE.
                $paint_can_ids[$item['defindex']] = $item;
            }
        }
        foreach ($marketMasterList['result']['assets'] as $asset) {
            if (isset($paint_can_ids[$asset['name']]['defindex'])) {
                $data = json_decode(get_data('http://api.steampowered.com/ISteamEconomy/GetAssetClassInfo/v0001/?appid=440&classid0=' . $asset['classid'] . '&class_count=3&key=' . AKey()), true);
                $paint_can_ids[$asset['name']]['image_url'] = (string) 'http://cdn.steamcommunity.com/economy/image/' . $data['result'][$asset['classid']]['icon_url'] . '=/50fx50f';
                $paint_can_ids[$asset['name']]['image_url_large'] = (string) 'http://cdn.steamcommunity.com/economy/image/' . $data['result'][$asset['classid']]['icon_url'] . '=/512fx512f';
            }
        }
        file_put_contents($dir . "/schema_addon.json", json_encode($paint_can_ids));
        db_save('440_paint_time', time());
    }
}
Beispiel #2
0
function globalSchemas($gid)
{
    if ($gid == 440 && !isset($GLOBALS['schemas_440'])) {
        $GLOBALS['schemas_440'] = array('schema' => localSchema(), 'prices' => localPriceList(), 'est' => local_global_whitelist());
    }
    if ($gid == 730 && !isset($GLOBALS['schemas_730'])) {
        $GLOBALS['schemas_730'] = schema_730();
    }
    if ($gid == 570 && !isset($GLOBALS['schemas_570'])) {
        $GLOBALS['schemas_570']['schema'] = schema_570();
    }
}
function ItemNameToDefindex($itemName)
{
    $schema = localSchema();
    $schemaItems = $schema['result']['items'];
    $itemND = array();
    foreach ($schemaItems as $defindex => $defitem) {
        $itemND[$defindex] = strtoupper($defitem['item_name']);
    }
    $result = array();
    foreach ($itemND as $key => $color) {
        // if it starts with 'part' add to results
        if (!empty($_POST['defindex']) && strpos($color, strtoupper($_POST['defindex'])) === 0) {
            return $key;
        }
    }
}