Example #1
0
        srand(microtime() * 1000000);
        $Zufall_x = rand(1, $size);
        $zufall_y = rand(1, $size);
        $gefunden = 0;
        while ($gefunden == 0) {
            $result = $db->query("SELECT * FROM cc" . $n . "_crand where used = '0' and element_type ='0' and x={$Zufall_x} and y={$zufall_y}");
            $land = $db->fetch_array($result);
            $land_x = $land['x'];
            $land_y = $land['y'];
            if ($land['used'] == '0') {
                $gefunden = 1;
            } else {
                $gefunden = 0;
            }
        }
        $landkoord = "{$land_x}:{$land_y}";
        trace_msg("Admin map change change User Pos county:{$countrie_id} new pos -> {$land_x}:{$land_y}", 112);
        $sql = "update cc" . $n . "_countries set x='{$Zufall_x}',y='{$zufall_y}' where islandid='{$countrie_id}' ";
        $update = $db->query($sql);
        $sql = "update cc" . $n . "_crand set used ='1' where x='{$Zufall_x}' and y='{$zufall_y}' ";
        $update = $db->query($sql);
    }
    trace_msg("Admin map change write Options", 112);
    $sql = "update cc" . $n . "_menu_admin_opt set value ='{$size}' where varname='op_map_size'";
    $update = $db->query($sql);
    require LITO_ROOT_PATH . "includes/class_options.php";
    $option = new option(LITO_ROOT_PATH . "options/");
    $option->write();
    header("LOCATION: map.php");
    exit;
}
Example #2
0
                $bad_found = 1;
            }
        }
        if ($bad_found == 1) {
            show_error("BADWORD_FOUND", $modul_name);
            exit;
        }
    }
    /** create an account with all things **/
    $password = password(8);
    $result = $db->query("SELECT * FROM cc" . $n . "_crand  WHERE `used`=0 ORDER BY rand()");
    $land = $db->fetch_array($result);
    $x_pos = $land['x'];
    $y_pos = $land['y'];
    $md5_pw = md5($password);
    trace_msg("User {$username} registriert ", 1);
    $db->query("INSERT INTO cc" . $n . "_users (username,email,password,register_date) VALUES ('{$username}','{$email}','{$md5_pw}','" . time() . "')");
    $userid_r = $db->insert_id();
    $db->query("INSERT INTO cc" . $n . "_countries (res1,res2,res3,res4,userid,lastressources,picid,x,y,size) VALUES ('{$op_reg_res1}','{$op_reg_res2}','{$op_reg_res3}','{$op_reg_res4}','{$userid_r}','" . time() . "','1','{$x_pos}','{$y_pos}','" . rand($op_min_c_size, $op_max_c_size) . "')");
    $islandid_r = $db->insert_id();
    $db->query("UPDATE cc" . $n . "_crand SET used='1' WHERE x='" . $x_pos . "' AND y='" . $y_pos . "'");
    $db->query("UPDATE cc" . $n . "_users SET activeid='{$islandid_r}' WHERE userid='{$userid_r}'");
    send_register_mail($email, "mail_register.html", $modul_name, $username, $password, $x_pos, $y_pos);
    show_error("REGISTER_SUBMIT_OK", $modul_name);
    exit;
}
if ($action == "forgott") {
    template_out('register_forgott.html', $modul_name);
    exit;
}
if ($action == "submit_forgott") {
Example #3
0
function resreload($countryid)
{
    global $db, $n, $userdata, $op_store_mulit, $op_set_store_max, $op_res_reload_time, $op_set_res1, $op_set_res2, $op_set_res3, $op_set_res4, $op_mup_res1, $op_mup_res2, $op_mup_res3, $op_mup_res4;
    if (intval($op_res_reload_type == 1) || $countryid <= 0) {
        return;
    }
    $result = $db->query("SELECT * FROM cc" . $n . "_countries WHERE islandid  ='" . $countryid . "'");
    $row = $db->fetch_array($result);
    $time4ressources = time() - $row['lastressources'];
    $numOfRessources = abs($time4ressources / $op_res_reload_time);
    $numOfRessources1 = floor($time4ressources / $op_res_reload_time);
    if ($numOfRessources1 >= 1) {
        $store_max = $op_set_store_max * (($row['store'] + 1) * $op_store_mulit);
        $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;
        }
        $SetRes1 = round($SetRes1, 0);
        $SetRes2 = round($SetRes2, 0);
        $SetRes3 = round($SetRes3, 0);
        $SetRes4 = round($SetRes4, 0);
        $new_last_res_time = $row['lastressources'] + $numOfRessources1 * $op_res_reload_time;
        trace_msg("Function resreload ({$countryid}) res1:{$SetRes1} res2:{$SetRes2} res3:{$SetRes3} res4:{$SetRes4} storemax:{$store_max}", 77);
        $db->query("UPDATE cc" . $n . "_countries SET res1='{$SetRes1}', res2='{$SetRes2}', res3='{$SetRes3}', res4='{$SetRes4}', lastressources='" . $new_last_res_time . "' WHERE islandid='" . $countryid . "'");
        if ($countryid == $userdata['islandid']) {
            $userdata['res1'] = $SetRes1;
            $userdata['res2'] = $SetRes2;
            $userdata['res3'] = $SetRes3;
            $userdata['res4'] = $SetRes4;
            $userdata['lastressources'] = $new_last_res_time;
        }
    }
}
Example #4
0
                 $db->query("UPDATE cc" . $n . "_crand SET used='1' WHERE x='{$map['x']}' AND y='{$map['y']}'");
                 make_ingamemail(0, $userdata['userid'], $newland11, $newland12);
             } else {
                 $die = rand(1, 10);
                 //set the die value $die=rand(1,xx);
                 trace_msg("landgr�ndung {$die} 1 <> 1  come back", 113);
                 if ($die != 1) {
                     $db->query("UPDATE cc" . $n . "_countries SET sol_kolo=sol_kolo+'1' WHERE islandid='{$userdata['islandid']}'");
                 } else {
                     $add_mes = $newland13;
                 }
                 make_ingamemail(0, $userdata['userid'], $newland14, $newland16);
             }
         } else {
             $die = rand(1, 10);
             trace_msg("landgr�ndung no land found {$die} 1 <> 1  come back", 113);
             if ($die != 1) {
                 $db->query("UPDATE cc" . $n . "_countries SET sol_kolo=sol_kolo+'1' WHERE islandid='{$userdata['islandid']}'");
             } else {
                 $add_mes = $newland13;
             }
             make_ingamemail(0, $userdata['userid'], $newland14, $newland15);
         }
         $db->query("DELETE FROM cc" . $n . "_new_land WHERE koloid='{$row['koloid']}'");
         header("LOCATION: new_land.php");
     }
     $new_found_inhalt = array($sol_name, $row['x'], $row['y'], $timebanner);
     array_push($new_found, $new_found_inhalt);
 }
 $tpl->assign('daten', $new_found);
 $tpl->assign('daten2', $new_found_2);
Example #5
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}";
Example #6
0
    $result = $db->query("SELECT * FROM cc" . $n . "_users WHERE username='******'");
    $row = $db->fetch_array($result);
    if (strtolower($row['username']) != $username) {
        trace_msg("login ERROR '{$username}' wrong username", 2);
        login_error($ln_login_e_2);
        exit;
    }
    if ($row['password'] != md5($password)) {
        trace_msg("login ERROR '{$username}' wrong password", 2);
        login_error($ln_login_e_2);
        exit;
    }
    if (!$row['serveradmin']) {
        $grp_q = $db->query("SELECT `perm_lvl`, `id` FROM `cc" . $n . "_user_groups` WHERE `id` = '" . $row['group'] . "'");
        $grp = $db->fetch_array($grp_q);
        if (!$grp) {
            login_error('Schwerer Fehler! Die Usergruppe konnte nicht gefunden werden! Sie haben keine Berechtigungen f&uuml;r diesen Bereich!');
            exit;
        }
        if ($grp['perm_lvl'] <= 0) {
            login_error('Sie haben keine Berechtigungen f&uuml;r diesen Bereich!');
            exit;
        }
    }
    $userid = intval($row['userid']);
    $_SESSION['userid'] = $userid;
    trace_msg("login OK '{$username}' ", 2);
    $db->unbuffered_query("UPDATE cc" . $n . "_users SET lastlogin='******', ip='" . getenv("REMOTE_ADDR") . "' WHERE username='******'");
    header("LOCATION: " . LITO_MODUL_PATH_URL . 'acp_core/admin.php');
    exit;
}
Example #7
0
function ks_battle($group_id, $land_id, $fromadmin)
{
    global $db, $n, $userdata, $tpl, $header, $footer, $op_res_steal, $op_battle_trace;
    include LITO_MODUL_PATH . "battle/battlescript.php";
    $modul_name = "battle";
    $stime = mtime();
    $verteidiger_user_id = get_userid_from_countrie($land_id);
    $angreifer_race = get_race_id_from_group($group_id);
    $vert_race = get_race_id_from_countrie($land_id);
    $angreifer_name = $userdata['username'];
    $verteidiger_name = username($verteidiger_user_id);
    $angreifer_land = get_countrie_name_from_group_id($group_id, 1);
    $verteidiger_land = get_countrie_name_from_id($land_id, 1);
    $angreifer_user_id = get_user_id_from_group_id($group_id);
    trace_msg("angreifer group id:{$group_id} race id:{$angreifer_race}", 90);
    trace_msg("verteidiger land id:{$land_id} race id:{$vert_race}", 90);
    $kampfscript = new kampfs();
    $sql = "SELECT cc" . $n . "_groups_inhalt . * , cc" . $n . "_soldiers . * FROM cc" . $n . "_groups_inhalt INNER JOIN cc" . $n . "_soldiers ON cc" . $n . "_groups_inhalt.type = cc" . $n . "_soldiers.tabless WHERE cc" . $n . "_soldiers.race ='" . $angreifer_race . "' AND cc" . $n . "_groups_inhalt.group_id ='" . $group_id . "'";
    $result_g = $db->query($sql);
    $count_ang = 0;
    while ($row_g = $db->fetch_array($result_g)) {
        $g_id = $row_g['groups_inhalt_id'];
        $AP = $row_g['AP'];
        $VP = $row_g['VP'];
        $count_ang = $row_g['anzahl'];
        $unit_type = $row_g['type'];
        $kampfscript->setunits_angreifer($g_id, $AP * $count_ang, $VP * $count_ang, $AP, $VP, $count_ang, $unit_type);
    }
    $count_vert = 0;
    $result_sol_verteidiger = $db->query("SELECT * FROM cc" . $n . "_soldiers where race='{$vert_race}'");
    while ($row_sol_vert = $db->fetch_array($result_sol_verteidiger)) {
        $name = $row_sol_vert['tabless'];
        $id_vert = $row_sol_vert['sid'];
        $AP = $row_sol_vert['AP'];
        $VP = $row_sol_vert['VP'];
        $result_l = $db->query("SELECT {$name} FROM cc" . $n . "_countries where islandid='{$land_id}'");
        $row_l = $db->fetch_array($result_l);
        $anzahl_einheiten = $row_l[$name];
        $count_vert += $anzahl_einheiten;
        if ($anzahl_einheiten > 0) {
            $unit_type = $row_sol_vert['tabless'];
            $kampfscript->setunits_verteidiger($id_vert, $AP * $anzahl_einheiten, $VP * $anzahl_einheiten, $AP, $VP, $anzahl_einheiten, $unit_type);
        }
    }
    $all_einheiten_angr_count = 0;
    $all_einheiten_vert_count = 0;
    $verlust_angreifer = 0;
    $verlust_verteidiger = 0;
    if (intval($op_battle_trace) > 0) {
        $trace_fname = LITO_CACHE_PATH . "battle_kr/" . $land_id . "_" . time() . ".txt";
        $kampfscript->set_trace($trace_fname);
    }
    $kampfscript->calc();
    $all_einheiten_angr_count = $kampfscript->anzahl_angreifer_vor;
    $all_einheiten_vert_count = $kampfscript->anzahl_verteidiger_vor;
    $verlust_angreifer = $kampfscript->anzahl_angreifer - $kampfscript->anzahl_angreifer_end;
    $verlust_verteidiger = $kampfscript->anzahl_verteidiger - $kampfscript->anzahl_verteidiger_end;
    $all_einheiten = $kampfscript->anzahl_angreifer_vor + $kampfscript->anzahl_verteidiger_vor;
    $attack_msg = "";
    $einheit_ang = "";
    $einheiten_ang_ap = 0;
    $einheiten_ang_vp = 0;
    foreach ($kampfscript->angreifer as $name => $value) {
        $einheiten_name = $kampfscript->angreifer[$name]["unit_type"];
        $einheiten_name_org = $einheiten_name;
        $einheiten_new_count = $kampfscript->angreifer[$name]["new_units_count"];
        $einheiten_anzahl = $kampfscript->angreifer[$name]["unit_count"];
        $einheiten_name = get_soldiers_name($einheiten_name, $angreifer_race);
        $einheit_ang .= $einheiten_name . "<br>";
        $einheit_ang_count .= intval($einheiten_anzahl) . "<br>";
        $einheiten_ang_ap += $kampfscript->angreifer[$name]["ap_single"] * $einheiten_anzahl;
        $einheiten_ang_vp += $kampfscript->angreifer[$name]["vp_single"] * $einheiten_anzahl;
        if ($fromadmin == 0) {
            $db->query("update cc" . $n . "_groups_inhalt set anzahl='" . $einheiten_new_count . "' where group_id='" . $group_id . "' and type='" . $einheiten_name_org . "'");
        }
    }
    if ($fromadmin == 0) {
        $db->query("delete from cc" . $n . "_groups_inhalt where group_id='" . $group_id . "' and anzahl <='0'");
        $result_sum_group = $db->query("SELECT sum(anzahl)as all_i_groups FROM cc" . $n . "_groups_inhalt where group_id='" . $group_id . "'");
        $rowsum_group = $db->fetch_array($result_sum_group);
        $anz_goup_inhalt = $rowsum_group['all_i_groups'];
        if ($anz_goup_inhalt <= 0) {
            $db->query("delete from cc" . $n . "_groups where groupid='" . $group_id . "'");
        }
    }
    $einheiten_vert_ap = 0;
    $einheiten_vert_vp = 0;
    if ($count_vert > 0) {
        foreach ($kampfscript->verteidiger as $name => $value) {
            $einheiten_name = $kampfscript->verteidiger[$name]["unit_type"];
            $einheiten_name_org = $einheiten_name;
            $einheiten_anzahl = $kampfscript->verteidiger[$name]["unit_count"];
            $einheiten_new_count = $kampfscript->verteidiger[$name]["new_units_count"];
            $einheiten_name = get_soldiers_name($einheiten_name, $vert_race);
            $einheit_vert .= $einheiten_name . "<br>";
            $einheit_vert_count .= intval($einheiten_anzahl) . "<br>";
            $einheiten_vert_ap += $kampfscript->verteidiger[$name]["ap_single"] * $einheiten_anzahl;
            $einheiten_vert_vp += $kampfscript->verteidiger[$name]["vp_single"] * $einheiten_anzahl;
            if ($fromadmin == 0) {
                $db->query("update cc" . $n . "_countries set " . $einheiten_name_org . " ='" . $einheiten_new_count . "' where islandid='" . $land_id . "'");
                $db->query("update cc" . $n . "_countries set " . $einheiten_name_org . " ='0' where islandid='" . $land_id . "' and " . $einheiten_name_org . " <'0'");
            }
        }
    }
    $dauer_berechnung = sprintf("%.05f", ntime($stime, mtime()));
    $last_msg = "Es wurden " . intval($all_einheiten) . " Einheiten in " . $dauer_berechnung . " Sekunden berechnet.";
    unset($kampfscript);
    $date = date("d.m.Y H:i:s", time());
    $last_archive_id = 0;
    $result = $db->query("SELECT archive_id FROM cc" . $n . "_battle_archiv order by archive_id  DESC limit 1");
    $row = $db->fetch_array($result);
    $last_archive_id = $row['archive_id'];
    $kr_number = $last_archive_id + 1;
    $random = password(5);
    $random1 = time();
    $battle_url = "battle_id_" . $random . "_" . $random1 . ".html";
    $db->query("INSERT INTO cc" . $n . "_battle_archiv(ang_username,ang_land,vert_username,vert_land,battle_time,battle_url) VALUES ('{$angreifer_name}','{$angreifer_land}','{$verteidiger_name}','{$verteidiger_land}','" . time() . "','{$battle_url}')");
    $message_topic = "Kampfreport vom : " . date("d.m.Y H:i:s", time());
    $tpl->assign('date', $date);
    $tpl->assign('angreifer_name', $angreifer_name);
    $tpl->assign('angreifer_land', $angreifer_land);
    $tpl->assign('verteidiger_name', $verteidiger_name);
    $tpl->assign('verteidiger_land', $verteidiger_land);
    $tpl->assign('einheit_ang', $einheit_ang);
    $tpl->assign('einheit_ang_count', $einheit_ang_count);
    $tpl->assign('einheit_vert', $einheit_vert);
    $tpl->assign('einheit_vert_count', $einheit_vert_count);
    $tpl->assign('all_einheiten_angr_count', $all_einheiten_angr_count);
    $tpl->assign('einheiten_ang_ap', $einheiten_ang_ap);
    $tpl->assign('all_einheiten_vert_count', $all_einheiten_vert_count);
    $tpl->assign('einheiten_vert_ap', $einheiten_vert_ap);
    $tpl->assign('einheiten_ang_vp', $einheiten_ang_vp);
    $tpl->assign('einheiten_vert_vp', $einheiten_vert_vp);
    $tpl->assign('verlust_angreifer', $verlust_angreifer);
    $tpl->assign('verlust_verteidiger', $verlust_verteidiger);
    $tpl->assign('last_msg', $last_msg);
    $tpl->assign('kr_number', $kr_number);
    $k_report = $tpl->fetch(LITO_THEMES_PATH . 'battle/battle_ks_web.html');
    $Datei = LITO_ROOT_PATH . "battle_kr/{$battle_url}";
    $Datei_url = LITO_ROOT_PATH_URL . "battle_kr/{$battle_url}";
    $message_text = "Du wurdest angegriffen.<br>Den Kampfreport findest du hier:<br> [url=" . $Datei_url . "]Kampfreport Nr.:" . $kr_number . "[/url]";
    if ($fromadmin == 0) {
        make_ingamemail(0, $angreifer_user_id, $message_topic, $message_text);
        make_ingamemail(0, $verteidiger_user_id, $message_topic, $message_text);
    }
    $erstellen = fopen($Datei, "w");
    fwrite($erstellen, $k_report);
    fclose($erstellen);
    if ($all_einheiten_vert_count <= 0) {
        $max_steal = intval($op_res_steal);
        if ($max_steal > 0) {
            resreload($land_id);
            $result = $db->query("SELECT res1,res2,res3,res4,islandid FROM cc" . $n . "_countries WHERE islandid='" . $land_id . "'");
            $row = $db->fetch_array($result);
            $land_res1 = $row['res1'];
            $land_res2 = $row['res2'];
            $land_res3 = $row['res3'];
            $land_res4 = $row['res4'];
            $per_res1 = round($land_res1 * ($max_steal / 100), 0);
            $per_res2 = round($land_res2 * ($max_steal / 100), 0);
            $per_res3 = round($land_res3 * ($max_steal / 100), 0);
            $per_res4 = round($land_res4 * ($max_steal / 100), 0);
            if ($per_res1 < 0) {
                $per_res1 = 0;
            }
            if ($per_res2 < 0) {
                $per_res2 = 0;
            }
            if ($per_res3 < 0) {
                $per_res3 = 0;
            }
            if ($per_res4 < 0) {
                $per_res4 = 0;
            }
            $result = $db->query("update cc" . $n . "_countries  set res1=res1-'" . $per_res1 . "',res2=res2-'" . $per_res2 . "',res3=res3-'" . $per_res3 . "',res4=res4-'" . $per_res4 . "' WHERE islandid='" . $land_id . "'");
            $result = $db->query("update cc" . $n . "_groups  set res1=res1+'" . $per_res1 . "',res2=res2+'" . $per_res2 . "',res3=res3+'" . $per_res3 . "',res4=res4+'" . $per_res4 . "' WHERE groupid='" . $group_id . "'");
        }
        // group back
        $result = $db->query("SELECT * FROM cc" . $n . "_groups WHERE islandid = '{$userdata['activeid']}' AND groupid = {$group_id}");
        $row = $db->fetch_array($result);
        $old_traveltime = get_duration_time($userdata['x'], $userdata['y'], $row['endx'], $row['endy'], $row['speed']);
        $requesttime = $row['traveltime'] - time();
        if ($requesttime < 0) {
            $requesttime = 0;
        }
        $back_traveltime = $old_traveltime - $requesttime;
        $starttime = time();
        $db->query("UPDATE cc" . $n . "_groups SET group_status = 2, starttime={$starttime},traveltime = {$back_traveltime}, endx = {$userdata['x']}, endy = {$userdata['y']} WHERE groupid='{$group_id}'");
    }
    template_out('battle_ks.html', $modul_name);
}
Example #8
0
if ($action == "del") {
    $eid = intval($_GET['eid']);
    $result_b = $db->query("SELECT eid FROM cc" . $n . "_countries WHERE islandid='" . $userdata['activeid'] . "' ");
    $row_in_b = $db->fetch_array($result_b);
    $in_bau = intval($row_in_b['eid']);
    if ($in_bau <= 0) {
        show_error('EXPLORING_ERROR_4', $modul_name);
        exit;
    }
    if ($in_bau != $eid) {
        show_error('EXPLORING_ERROR_5', $modul_name);
        exit;
    }
    $result = $db->query("SELECT * FROM cc" . $n . "_explore WHERE eid='{$eid}'");
    $row = $db->fetch_array($result);
    $us_size = $userdata[$row['tabless']] + 1;
    $size = $userdata[$row['tabless']];
    $res1 = $row['res1'] * $us_size * ($op_credit_cancel / 100);
    $res2 = $row['res2'] * $us_size * ($op_credit_cancel / 100);
    $res3 = $row['res3'] * $us_size * ($op_credit_cancel / 100);
    $res4 = $row['res4'] * $us_size * ($op_credit_cancel / 100);
    $a_user_id = $userdata['userid'];
    $u_db_name = username($a_user_id);
    $bauname = $row['name'];
    $bau_land = get_island($userdata['activeid']);
    $new_size = $size;
    trace_msg("User {$u_db_name} bricht Forschung {$bauname} auf Land {$bau_land} ab", 4);
    $db->query("UPDATE cc" . $n . "_countries SET eid='0', res1=res1+'{$res1}', res2=res2+'{$res2}', res3=res3+'{$res3}', res4=res4+'{$res4}', endexploretime='0', startexploretime='0', isexploring='0' WHERE islandid='" . $userdata['activeid'] . "'");
    header("LOCATION: exploring.php");
    exit;
}
Example #9
0
    $row_p = $db->fetch_array($result_points);
    $ret_all = $row_p['point_all'];
    $db->unbuffered_query("UPDATE cc" . $n . "_users SET points='" . $ret_all . "' WHERE userid='" . $cur_uid . "' and serveradmin='0'");
}
// eintragen der punkte bei ally
$result = $db->query("SELECT * FROM cc" . $n . "_allianz");
while ($row = $db->fetch_array($result)) {
    $cur_aid = $row['aid'];
    $result_points = $db->query("SELECT sum(points) as point_all FROM cc" . $n . "_users WHERE allianzid='" . $cur_aid . "'");
    $row_p = $db->fetch_array($result_points);
    $ret_all = $row_p['point_all'];
    $db->unbuffered_query("UPDATE cc" . $n . "_allianz SET points='" . $ret_all . "' WHERE aid='" . $cur_aid . "'");
}
$end_time = time();
$dauer = $end_time - $time_start;
trace_msg("point update done with {$dauer} sec", 999);
print "point update done with {$dauer} sec ({$update_counter} calculations)";
//***************************
//MINIMAP
//***************************
$resultx = $db->query("SELECT max(x) AS x FROM cc" . $n . "_crand");
$map_x = $db->fetch_array($resultx);
$resulty = $db->query("SELECT max(y) AS y FROM cc" . $n . "_crand");
$map_y = $db->fetch_array($resulty);
$x_size = $map_x['x'];
// games size x
$y_size = $map_y['y'];
// games size y
$pixelsize = 5;
// wide per country
$grid = 1;
Example #10
0
     if ($change > $max_gegner / 2) {
         $spio_ok = 1;
         $change = rand(0, $max_gegner);
         $change = $change + $anzahl_spions;
         trace_msg("Spionage zufall 2 :{$change} win:>" . $max_gegner / 2, 114);
         if ($change > $max_gegner / 2) {
             $spio_ok = 1;
         } else {
             $spio_ok = 0;
         }
     } else {
         $spio_ok = 0;
     }
 }
 if ($spio_ok == 1) {
     trace_msg("Spionage OK", 114);
     $tabless_name = "";
     $out_buildings = "";
     $result_s = $db->query("SELECT * FROM cc" . $n . "_buildings  WHERE  race='{$target_race}'");
     while ($row_s = $db->fetch_array($result_s)) {
         $name = c_trim($row_s['name']);
         $tabless_name = $row_s['tabless'];
         $out_buildings .= $name . "  [" . $row2[$tabless_name] . "]\n";
     }
     $explore_infos = "";
     $result_s = $db->query("SELECT * FROM cc" . $n . "_explore  WHERE  race='{$target_race}'");
     while ($row_s = $db->fetch_array($result_s)) {
         $name = c_trim($row_s['name']);
         $tabless_name = $row_s['tabless'];
         $explore_infos .= $name . "  [" . $row2[$tabless_name] . "]\n";
     }