예제 #1
0
$result = $db->query("SELECT * FROM cc" . $n . "_countries");
while ($row = $db->fetch_array($result)) {
    $store_max = $op_set_store_max * (($row['store'] + 1) * $op_store_mulit);
    $numOfRessources = 1;
    $SetRes1 = $row['res1'] + ($op_set_res1 + $row['res1mine'] * $op_mup_res1) * $numOfRessources;
    $SetRes2 = $row['res2'] + ($op_set_res2 + $row['res2mine'] * $op_mup_res2) * $numOfRessources;
    $SetRes3 = $row['res3'] + ($op_set_res3 + $row['res3mine'] * $op_mup_res3) * $numOfRessources;
    $SetRes4 = $row['res4'] + ($op_set_res4 + $row['res4mine'] * $op_mup_res4) * $numOfRessources;
    if ($SetRes1 > $store_max) {
        $SetRes1 = $store_max;
    }
    if ($SetRes2 > $store_max) {
        $SetRes2 = $store_max;
    }
    if ($SetRes3 > $store_max) {
        $SetRes3 = $store_max;
    }
    if ($SetRes4 > $store_max) {
        $SetRes4 = $store_max;
    }
    $tr_msg = "crontab country_id: " . $row['islandid'] . "  res1:{$SetRes1} res2:{$SetRes2} res3:{$SetRes3} res4:{$SetRes4} storemax:{$store_max}";
    trace_msg($tr_msg, 77);
    print "{$tr_msg} <br>";
    $db->query("UPDATE cc" . $n . "_countries SET res1='{$SetRes1}', res2='{$SetRes2}', res3='{$SetRes3}', res4='{$SetRes4}', lastressources='" . time() . "' WHERE islandid='" . $row['islandid'] . "'");
}
$time_end = explode(' ', substr(microtime(), 1));
$time_end = $time_end[1] + $time_end[0];
$run_time = $time_end - $time_start;
$end_msg = "ResourceReload DONE  time: " . number_format($run_time, 5, '.', '') . " sec. ";
Trace_msg("{$end_msg}", 888);
print "{$end_msg}";
예제 #2
0
function make_signature($id)
{
    global $db, $tpl, $userdata, $n;
    $modul_name = "usr_signature";
    if (is_modul_name_aktive($modul_name) == 0) {
        return;
    }
    $font = LITO_IMG_PATH . $modul_name . "/verdanab.ttf";
    $font1 = LITO_IMG_PATH . $modul_name . "/tahoma.ttf";
    $img_template = LITO_IMG_PATH . $modul_name . "/sig_vor.png";
    $time_start = explode(' ', substr(microtime(), 1));
    $time_start = $time_start[1] + $time_start[0];
    $img_count = 0;
    $sqlCode = "SELECT * FROM cc" . $n . "_users where lastlogin > 0 and serveradmin != 1";
    $sqlCode .= $id != 0 ? 'and userid=\'$id\'' : '';
    $result = $db->query(sqlCode);
    while ($sigdata = $db->fetch_array($result)) {
        $img_count++;
        $sig_user_id = $sigdata['userid'];
        $sig_username = $sigdata['username'];
        $sig_points = $sigdata['points'];
        $sig_ali_name = "keine";
        $ali_id = intval($sigdata['allianzid']);
        $ali_point_count = 0;
        if ($ali_id > 0) {
            $sig_ali_name = allianz(intval($sigdata['allianzid']));
            $flag_filename_flag = LITO_ROOT_PATH . "alli_flag/flag_" . $ali_id . ".png";
            $flag_filename_flag_url = LITO_ROOT_PATH_URL . "alli_flag/flag_" . $ali_id . ".png";
            $ali_point_count = get_allianz_points($ali_id);
        }
        $sig_country_count = 0;
        $signatur = imagecreatefrompng($img_template);
        imagecolorallocate($signatur, 0, 0, 0);
        $textfarbe = ImageColorAllocate($signatur, 255, 255, 255);
        $x1 = 12;
        $y1 = 20;
        $x2 = 130;
        $y2 = 20;
        $x3 = 12;
        $y3 = 50;
        $x4 = 130;
        $y4 = 50;
        $x5 = 310;
        $y5 = 55;
        imagettftext($signatur, 10, 0, $x1, $y1, $textfarbe, $font, urldecode($sig_username));
        //Spielername
        imagettftext($signatur, 10, 0, $x2, $y2, $textfarbe, $font, $sig_points);
        //Spielerpunkte
        imagettftext($signatur, 10, 0, $x3, $y3, $textfarbe, $font, urldecode($sig_ali_name));
        //Allyname
        imagettftext($signatur, 10, 0, $x4, $y4, $textfarbe, $font, $ali_point_count);
        //Allypunkte
        imagettftext($signatur, 8, 0, $x5, $y5, $textfarbe, $font, $op_set_game_url);
        //L�nder
        if ($ali_id > 0 && is_file($flag_filename_flag)) {
            $src = imagecreatefrompng($flag_filename_flag);
            imagecopy($signatur, $src, 430, 3, 0, 0, 15, 10);
        }
        $save_f_name = LITO_ROOT_PATH . "images_sig/game_sig_" . $sig_user_id . ".png";
        if (is_file($save_f_name)) {
            unlink($save_f_name);
        }
        ImagePNG($signatur, $save_f_name, 0);
    }
    $time_end = explode(' ', substr(microtime(), 1));
    $time_end = $time_end[1] + $time_end[0];
    $run_time = $time_end - $time_start;
    $end_msg = "Signature DONE  time: " . number_format($run_time, 5, '.', '') . " sec. {$img_count} operation";
    Trace_msg("{$end_msg}", 777);
}