示例#1
0
文件: index.php 项目: sonicmaster/RPG
            }
            if ($planetrow['planet_type'] == 3) {
                $parse['headerimg'] = $parse['type'] . '_' . $parse['subtype'] . '.jpg';
            } else {
                $parse['headerimg'] = 'header_' . $parse['type'] . '.jpg';
            }
            $parse['total_points'] = pretty_number(floor($user['total_points'] / $game_config['stat_settings']));
            $parse['user_rank'] = USER_RANK;
            //print_r($StatRecord);
            $parse['players'] = $game_config['users_amount'];
            $parse['planet_id'] = $user['current_planet'];
            $parse['qbuilding'] = $queueinfo;
            $parse['qresearch'] = $queueinforl;
            $parse['qshipyard'] = $queueinfosy;
            $parse['date_time'] = date("D M n H:i:s");
            //Show planet remove/rename
            if ($_GET['mode'] == 'removepl') {
                $parse['plrem_disp'] = 'display:block;';
            }
            $page = parsetemplate(gettemplate('redesigned/overview'), $parse);
            if ($_GET['axah']) {
                makeAXAH($page);
            } else {
                displaypage($page, $lang['Overview']);
            }
            break;
    }
}
// -----------------------------------------------------------------------------------------------------------
// Changelog
// 1.0 - First version by MadnessRed
示例#2
0
文件: admin.php 项目: sonicmaster/RPG
    case 'errors':
        //------------------------------------
        include_once ROOT_PATH . "admin/errors.php";
        break;
    case 'config':
        //------------------------------------
        include_once ROOT_PATH . "admin/settings.php";
        break;
    case 'supp':
        //------------------------------------
        include_once ROOT_PATH . "admin/support.php";
        break;
    case 'edit':
        //------------------------------------
        include_once ROOT_PATH . "admin/edit.php";
        break;
    case 'addmoon':
        //------------------------------------
        include_once ROOT_PATH . "admin/addmoon.php";
        break;
    default:
        //------------------------------------
        include_once ROOT_PATH . "admin/overview.php";
        break;
}
$page = parsetemplate(gettemplate('redesigned/admin'), $bloc);
if ($_GET['axah']) {
    makeAXAH($page, 'Admin: ' . $bloc['title']);
} else {
    displaypage($page, 'Admin: ' . $bloc['title']);
}
示例#3
0
文件: notes.php 项目: sonicmaster/RPG
                $pri = '';
            }
            //Parse the row
            $parse['page'] .= '
			<tr class="' . $class . '">
				<th class="spacer"/>					
				<th class="subject">
				<a href="#" onclick="getAXAH(\'./?page=notes&mode=read&note=' . $row['id'] . '\',\'notesbody\');">
					<spam class="' . $pri . '">' . $row['title'] . '</span>
				</a>
				</th>
				<th class="date">' . date("jS F H:i", $row['time']) . '</td>
				<th class="spacer"/>
			</tr>';
        }
        makeAXAH(parsetemplate(gettemplate('network/notes'), $parse));
        break;
}
die;
$lang['PHP_SELF'] = './?page=notes';
if ($_POST["s"] == 1 || $_POST["s"] == 2) {
    //Edicion y agregar notas
    $time = time();
    $priority = $_POST["u"];
    $title = $_POST["title"] ? mysql_escape_string(strip_tags($_POST["title"])) : $lang['NoTitle'];
    $text = $_POST["text"] ? mysql_escape_string(strip_tags($_POST["text"])) : $lang['NoText'];
    if ($_POST["s"] == 1) {
        doquery("INSERT INTO {{table}} SET owner={$user['id']}, time={$time}, priority={$priority}, title='{$title}', text='{$text}'", "notes");
        message($lang['NoteAdded'], $lang['Please_Wait'], 'notes.' . $phpEx, "3");
    } elseif ($_POST["s"] == 2) {
        /*
示例#4
0
/**
 * BuildingPage.php
 *
 * @version 1.0
 * @copyright 2009 by MadnessRed for XNova Redesigned
 */
function BuildingPage($a = 0, $b = 0)
{
    global $lang, $resource, $reslist, $pricelist, $dpath, $game_config, $_GET, $user, $planetrow;
    CheckPlanetUsedFields($planetrow);
    if (!$_GET['page']) {
        return false;
        die;
    }
    // Tables des batiments possibles par type de planete
    if ($_GET['page'] == 'station') {
        $Allowed[1] = array(14, 15, 21, 31, 33, 34, 44);
        $Allowed[3] = array(14, 21, 34, 41, 42, 43);
    } elseif ($_GET['page'] == 'resources') {
        $Allowed[1] = array(1, 2, 3, 4, 12, 212, 22, 23, 24);
        $Allowed[3] = array(212, 22, 23, 24);
    } else {
        die("Hacking attempt");
    }
    //Right, lets see what he has an generate him an image.
    $imgnum = '';
    if ($planetrow[$resource[1]] > 0) {
        $imgnum .= "_1";
    }
    if ($planetrow[$resource[2]] > 0) {
        $imgnum .= "_2";
    }
    if ($planetrow[$resource[3]] > 0) {
        $imgnum .= "_3";
    }
    if ($planetrow[$resource[4]] > 0) {
        $imgnum .= "_4";
    }
    // Boucle d'interpretation des eventuelles commandes
    if (isset($_GET['cmd'])) {
        // On passe une commande
        $bThisIsCheated = false;
        $bDoItNow = false;
        $TheCommand = $_GET['cmd'];
        $Element = $_GET['building'];
        $ListID = $_GET['listid'];
        if (isset($Element)) {
            if (!strchr($Element, " ")) {
                if (!strchr($Element, ",")) {
                    if (in_array(trim($Element), $Allowed[$planetrow['planet_type']])) {
                        $bDoItNow = true;
                    } else {
                        //$bThisIsCheated = true;
                        $bDoItNow = true;
                    }
                } else {
                    $bThisIsCheated = true;
                }
            } else {
                $bThisIsCheated = true;
            }
        } elseif (isset($ListID)) {
            $bDoItNow = true;
        }
        if ($bDoItNow == true) {
            switch ($TheCommand) {
                case 'cancel':
                    //Remove last queue item
                    RemoveFromQueue();
                    break;
                case 'remove':
                    //Remove a specific queue item
                    RemoveFromQueue($ListID);
                    break;
                case 'insert':
                    //Insert into the queue a build
                    $fields_rem = $planetrow['field_max'] - $planetrow['field_current'] + $planetrow[$resource[33]] * 5;
                    if ($fields_rem >= 0) {
                        AddToQueue($Element, 1);
                    } else {
                        echo $fields_rem . " < 0";
                        die("Hacking Attempt!");
                    }
                    break;
                case 'destroy':
                    //Add a deconstrction to the queue
                    AddToQueue($Element, -1);
                    break;
            }
            // switch
        } elseif ($bThisIsCheated == true) {
            //ResetThisFuckingCheater ( $user['id'] );
        }
        //If they want axah_section
        if ($_GET['axah_box']) {
            $q = ShowQueue(false);
            makeAXAH($q['buildlist']);
            die;
        }
    }
    $Queue = ShowQueue(true);
    // On enregistre ce que l'on a modifi� dans planet !
    BuildingSavePlanetRecord($planetrow);
    // On enregistre ce que l'on a eventuellement modifi� dans users
    BuildingSaveUserRecord($user);
    $max_qs = MAX_BUILDING_QUEUE_SIZE;
    if ($max_qs > 0) {
        //fine :)
    } else {
        $max_qs = 10;
    }
    if ($Queue['length'] < $max_qs) {
        $CanBuildElement = true;
    } else {
        $CanBuildElement = false;
    }
    if ($_GET['page'] == 'station') {
        if ($planetrow['planet_type'] == 3) {
            $SubTemplate = gettemplate('buildings/station-moon_buttonz');
        } else {
            $SubTemplate = gettemplate('buildings/station_buttonz');
        }
    } elseif ($_GET['page'] == 'resources') {
        $SubTemplate = gettemplate('buildings/resources_buttonz');
    } else {
        die("Hacking attempt");
    }
    $parse = array();
    $infopg = array();
    foreach ($lang['names'] as $Element => $ElementName) {
        if (!$planetrow['planet_type']) {
            die("no planet type");
        }
        if (in_array($Element, $Allowed[$planetrow['planet_type']]) || $_GET['page'] == 'station') {
            if (@in_array($Element, $Allowed[$planetrow['planet_type']])) {
                if (!IsTechnologieAccessible($user, $planetrow, $Element)) {
                    $parse['state_' . $Element] = "off";
                    $parse['mes_' . $Element] = "Requirements are not met";
                    $parse['canbuild_' . $Element] = "";
                } elseif (!IsElementBuyable($user, $planetrow, $Element, true, false) && $Queue['length'] == 0) {
                    $parse['state_' . $Element] = "disabled";
                    $parse['mes_' . $Element] = "Not enough resources!";
                    $parse['canbuild_' . $Element] = "";
                } elseif (!$CanBuildElement) {
                    $parse['state_' . $Element] = "disabled";
                    $parse['mes_' . $Element] = "Queue is full!";
                    $parse['canbuild_' . $Element] = "";
                } else {
                    $parse['state_' . $Element] = "on";
                    $parse['mes_' . $Element] = "";
                    $parse['canbuild_' . $Element] = "\n\t\t\t\t\t\t<a class=\"fastBuild tips\" href=\"#\" onclick=\"loadpage('./?page=" . $_GET['page'] . "&cmd=insert&building={$Element}&id={$Element}',document.title,document.body.id);\">\n\t\t\t\t\t\t\t<img src=\"" . GAME_SKIN . "/img/layout/sofort_bauen.gif\" height=\"14\" width=\"22\">\n\t\t\t\t\t\t</a>";
                }
            } else {
                $parse['state_' . $Element] = "off";
                $parse['mes_' . $Element] = "Not availble";
                $parse['canbuild_' . $Element] = "";
            }
            $parse['name_' . $Element] = $ElementName;
            $parse['count_' . $Element] = $planetrow[$resource[$Element]];
        }
    }
    //Countdowns
    if ($planetrow['b_building'] > 0) {
        $BuildQueue = explode(";", $planetrow['b_building_id']);
        $CurrBuild = explode(",", $BuildQueue[0]);
        $parse['countdown_' . $CurrBuild[0]] = "\n\t\t\t\t\t\t\t\t\t<div class=\"construction\">\n\n\t\t\t\t\t\t\t\t\t\t<div class=\"pusher\" style=\"height: 80px; margin-bottom: -80px;\">\n\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"time\" id=\"resource\">" . parsecountdown($planetrow['b_building']) . "</span>\n\n\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t</div>\n";
    }
    $BuildingPage = parsetemplate($SubTemplate, $parse);
    $parse = $lang;
    $Element = idstring($_GET['id']);
    $ElementName = $lang['names'][$Element];
    // Faut il afficher la liste de construction ??
    if ($Queue['length'] > 0) {
        $parse['BuildList'] = $Queue['buildlist'];
    } else {
        $parse['BuildList'] = "";
    }
    $de_planettype = PlanetType($planetrow['image']);
    $parse['type'] = $de_planettype['type'];
    if ($_GET['page'] == 'station') {
        $parse['bg'] = HEADER_CACHE . "station/" . $parse['type'] . ".png";
    } elseif ($_GET['page'] == 'resources') {
        if (url_exists(HEADER_CACHE . "resources/" . $parse['type'] . $imgnum . ".png")) {
            $parse['bg'] = HEADER_CACHE . "resources/" . $parse['type'] . $imgnum . ".png";
        } else {
            $parse['bg'] = HEADER_CACHE . "resources/default.png";
        }
    } else {
        die("Hacking attempt");
    }
    $parse['hideres'] = "display:none;";
    $parse['hidenorm'] = "";
    $parse['planetname'] = $planetrow['name'];
    if (!$Element) {
        if ($_GET['mode'] == "resources") {
            $parse['hideres'] = "";
            $parse['hidenorm'] = "display:none;";
        }
    } else {
        if (!is_array($Allowed[$planetrow['planet_type']])) {
            $message = $user['username'] . " (" . intval($user['id']) . ") does not have a propper planet_type, so \$Allowed[\$planetrow['planet_type']] was not an array, causing the error which is most likely directly below this.";
            trigger_error($message, E_USER_NOTICE);
        }
        if (in_array($Element, $Allowed[$planetrow['planet_type']])) {
            //Something else
            $HaveRessources = IsElementBuyable($user, $planetrow, $Element, true, false);
            $parse['i'] = $Element;
            $parse['dpath'] = $dpath;
            $BuildingLevel = $planetrow[$resource[$Element]];
            $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")";
            $parse['n'] = $ElementName;
            $parse['descriptions'] = $lang['res']['descriptions'][$Element];
            $ElementBuildTime = BuildingTime($Element, $BuildingLevel + 1, $planetrow);
            $parse['time'] = ShowBuildTime($ElementBuildTime);
            $parse['price'] = GetElementPrice($user, $planetrow, $Element);
            $parse['rest_price'] = GetRestPrice($user, $planetrow, $Element);
            $parse['click'] = '';
            $NextBuildLevel = $planetrow[$resource[$Element]] + 1;
            $CurrentMaxFields = CalculateMaxPlanetFields($planetrow);
            if ($planetrow["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
                $RoomIsOk = true;
            } else {
                $RoomIsOk = false;
            }
            if ($Element == 31) {
                // Sp�cial Laboratoire
                if ($user["b_tech_planet"] != 0 && $game_config['BuildLabWhileRun'] != 1) {
                    // Variable qui contient le parametre
                    // On verifie si on a le droit d'evoluer pendant les recherches (Setting dans config)
                    $parse['click'] = "<font color=#FF0000>" . $lang['in_working'] . "</font>";
                }
            }
            if (IsTechnologieAccessible($user, $planetrow, $Element)) {
                if ($parse['click'] != '') {
                    // Bin on ne fait rien, vu que l'on l'a deja fait au dessus !!
                } elseif ($RoomIsOk && $CanBuildElement) {
                    if ($Queue['lenght'] == 0) {
                        if ($NextBuildLevel == 1) {
                            if ($HaveRessources == true) {
                                $parse['click'] = "<a href=\"./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element . "\"><font color=#00FF00>" . $lang['BuildFirstLevel'] . "</font></a>";
                                $infopg['build_link'] = "./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element;
                                $infopg['build_text'] = $lang['BuildFirstLevel'];
                            } else {
                                $parse['click'] = "<font color=#FF0000>4" . $lang['BuildFirstLevel'] . "</font>";
                                $infopg['build_text'] = $lang['BuildFirstLevel'];
                            }
                        } else {
                            if ($HaveRessources == true) {
                                $parse['click'] = "<a href=\"./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element . "\"><font color=#00FF00>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font></a>";
                                $infopg['build_link'] = "./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element;
                                $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel;
                            } else {
                                $parse['click'] = "<font color=#FF0000>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font>";
                                $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel;
                            }
                        }
                    } else {
                        $parse['click'] = "<a href=\"./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element . "\"><font color=#00FF00>" . $lang['InBuildQueue'] . "</font></a>";
                        $infopg['build_link'] = "./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element;
                        $infopg['build_text'] = $lang['InBuildQueue'];
                    }
                } elseif ($RoomIsOk && !$CanBuildElement) {
                    if ($NextBuildLevel == 1) {
                        $parse['click'] = "<font color=#FF0000>2" . $lang['BuildFirstLevel'] . "</font>";
                        $infopg['build_text'] = $lang['BuildFirstLevel'];
                    } else {
                        $parse['click'] = "<font color=#FF0000>1" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font>";
                        $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel;
                    }
                } else {
                    $parse['click'] = "<font color=#FF0000>" . $lang['NoMoreSpace'] . "</font>";
                    $infopg['build_text'] = $lang['NoMoreSpace'];
                }
            } else {
                $parse['click'] = "<font color=#FF0000>" . $lang['NotAccessible'] . "</font>";
                $infopg['build_text'] = $lang['NotAccessible'];
            }
            //Building Info
            if ($infopg['build_link']) {
                $infopg['buildit_class'] = "build-it";
                $infopg['build_text'] = "Improve";
            } else {
                $infopg['buildit_class'] = "build-it_disabled";
                $infopg['build_text'] = "In queue";
            }
            $infopg['id'] = $Element;
            $infopg['name'] = $ElementName;
            $infopg['level'] = $planetrow[$resource[$Element]];
            if ($planetrow[$resource[$Element]] < 1) {
                $infopg['display_destroy'] = "style=\"display:none;\"";
            }
            $infopg['td_url'] = "./?page=" . $_GET['page'] . "&cmd=destroy&id=" . $Element . "&building=" . $Element;
            $infopg['title'] = "Tear down";
            $infopg['level1'] = $infopg['level'] + 1;
            $infopg['duration'] = pretty_time($ElementBuildTime);
            $infopg['shortdesc'] = $lang['sdesc'][$Element];
            $infopg['skin'] = $user['skin'];
            $infopg['cost_m'] = 1 * floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $planetrow[$resource[$Element]]));
            $infopg['cost_c'] = 1 * floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $planetrow[$resource[$Element]]));
            $infopg['cost_d'] = 1 * floor($pricelist[$Element]['deuterium'] * pow($pricelist[$Element]['factor'], $planetrow[$resource[$Element]]));
            if ($infopg['cost_m'] > $planetrow['metal'] && $infopg['cost_m'] > 0) {
                $infopg['missing_resource_m'] = "missing_resource";
            }
            if ($infopg['cost_c'] > $planetrow['crystal'] && $infopg['cost_c'] > 0) {
                $infopg['missing_resource_c'] = "missing_resource";
            }
            if ($infopg['cost_d'] > $planetrow['deuterium'] && $infopg['cost_d'] > 0) {
                $infopg['missing_resource_d'] = "missing_resource";
            }
            $infopg['sh_cost_m'] = KMnumber($infopg['cost_m'], 0, 'up');
            $infopg['sh_cost_c'] = KMnumber($infopg['cost_c'], 0, 'up');
            $infopg['sh_cost_d'] = KMnumber($infopg['cost_d'], 0, 'up');
            $infopg['cost_m'] = pretty_number($infopg['cost_m']);
            $infopg['cost_c'] = pretty_number($infopg['cost_c']);
            $infopg['cost_d'] = pretty_number($infopg['cost_d']);
            $infopg['page'] = $_GET['page'];
            $parse['info'] = parsetemplate(gettemplate('buildings/info'), $infopg);
            $parse['extra'] = "style=\"display:none\"";
            if ($_GET['axah_section'] == '1') {
                makeAXAH($parse['info']);
                die;
            }
        }
    }
    $parse['planet_field_current'] = $planetrow["field_current"];
    $parse['planet_field_max'] = $planetrow['field_max'] + $planetrow[$resource[33]] * 5;
    $parse['field_libre'] = $parse['planet_field_max'] - $planetrow['field_current'];
    $parse['buttonz'] = $BuildingPage;
    $parse['BuildingsList'] = $BuildingPage;
    if ($_GET['page'] == 'station') {
        $page = parsetemplate(gettemplate('buildings/station'), $parse);
        $title = $lang['Facilities'];
    } elseif ($_GET['page'] == 'resources') {
        //Resources screen
        $parse['resources_section'] = BuildRessourcePage($user, $planetrow, $parse['hideres']);
        $page = parsetemplate(gettemplate('buildings/resources'), $parse);
        $title = $lang['Resources'];
    } else {
        die("Hacking attempt");
    }
    if ($_GET['axah']) {
        makeAXAH($page);
    } else {
        displaypage($page, $title);
    }
}
示例#5
0
                } elseif ($lastclick > 20) {
                    $activeon = 'Off';
                    $activeover = 'overmark';
                } else {
                    $activeon = 'On';
                    $activeover = 'undermark';
                }
                if ($user['permisions'][32] && $row['id'] != $user['id']) {
                    $kick = "<a title=\"Kick user\" class=\"tips thickbox\" onclick=\"loadpage('./?page=network&mode=kick&id=" . $row['id'] . "','{Alliance}','network'); document.getElementById('memberlist_contentz').innerHTML = '<p align=center><img src=\\'{{skin}}/img/ajax-loader.gif\\' /> {Loading}</p>'; return false;\" href=\"#\">\r\n\t\t\t\t\t\t\t<img alt=\"Kick user\" src=\"" . GAME_SKIN . "/img/icons/against.gif\" />\r\n\t\t\t\t\t\t</a>";
                }
                if ($row['id'] == $user['id']) {
                    $hideselfactions = "display:none;";
                } else {
                    $hideselfactions = "";
                }
                $members['rows'] .= "\r\n\t\t\t<tr class=\"\">\r\n\t\t\t\t<td>" . $n . "</td>\r\n\t\t\t\t<td>" . $row['username'] . "</td>\r\n\t\t\t\t<td></td>\r\n\t\t\t\t<td>" . $row['ally_rank_name'] . "</td>\r\n\t\t\t\t<td>" . pretty_number($row["total_points"] / $game_config['stat_settings']) . "</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<a href=\"./?page=galaxy&galaxy=" . $row['galaxy'] . "&system=" . $row['system'] . "\" >\r\n\t\t\t\t\t\t[" . $row['galaxy'] . ":" . $row['system'] . ":" . $row['planet'] . "]\r\n\t\t\t\t\t</a>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>" . date("j<\\s\\up>S</\\s\\up> F Y", $row['ally_register_time']) . "</td>\r\n\t\t\t\t<td><span class=\"" . $activeover . "\">" . $activeon . "</span></td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<span style=\"" . $hideselfactions . "\">\r\n\t\t\t\t\t\t<a title=\"Write Message\" class=\"tips thickbox\" onclick=\"mrbox(\\'./?page=write&to=" . $row['id'] . "&iframe=1&iheight=800\\',800); return false;\" href=\"#\">\r\n\t\t\t\t\t\t\t<img alt=\"Write Message\" src=\"" . GAME_SKIN . "/img/icons/mail.gif\" />\r\n\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t" . $kick . "\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t";
            }
            if ($user['permisions'][1]) {
                $parse['memberlist'] = parsetemplate(gettemplate('alliance/memberlist'), $members);
            }
            if ($user['id'] == $allyrow['ally_owner']) {
                $parse['leave_style'] = 'display:none;';
            }
            if ($_GET['axah']) {
                makeAXAH(parsetemplate(gettemplate('alliance/main'), $parse));
            } else {
                displaypage(parsetemplate(gettemplate('alliance/main'), $parse), $lang['title']);
            }
            break;
    }
}
示例#6
0
    $search = doquery("SELECT * FROM {{table}} WHERE ally_tag LIKE '%{$term}%' OR ally_name LIKE '%{$term}%' LIMIT " . $n . ",100;", 'alliance');
    while ($row = mysql_fetch_assoc($search)) {
        //Row number
        $n++;
        //Alternating rows
        if ($n % 2 == 1) {
            $row['alt'] = 'alt';
        } else {
            $row['alt'] = '';
        }
        $row['n'] = $n;
        $parse['data'] .= parsetemplate($allyrowstpl, $row);
    }
    if (strlen($parse['data']) == 0) {
        $parse['data'] = '<td colspan="6" class="noResult textCenter textBeefy">{no_alliances}</td>';
    }
    $allyresult = parsetemplate(gettemplate('search/results'), $parse);
    $return = '
								<div id="player_results">
' . $userresult . '
								</div>
								<div id="planet_results" style="display:none;">
' . $planetresult . '
								</div>
								<div id="alliance_results" style="display:none;">
' . $allyresult . '
								</div>';
    makeAXAH($return);
} else {
    makeAXAH(parsetemplate(gettemplate('search/page'), $lang));
}
示例#7
0
文件: edit.php 项目: sonicmaster/RPG
	" />
	
<input name="p" type="text" id="p" size="2" value="1" onkeyup="
	getAXAH(\'./check.php?check={up}&g=\'+document.getElementById(\'g\').value+\'&s=\'+document.getElementById(\'s\').value+\'&p=\'+document.getElementById(\'p\').value+\'&t=\'+document.getElementById(\'t\').options[document.getElementById(\'t\').options.selectedIndex].value,\'usercheck\');
	" />
	
<select name="t" id="t" onchange="
	getAXAH(\'./check.php?check={up}&g=\'+document.getElementById(\'g\').value+\'&s=\'+document.getElementById(\'s\').value+\'&p=\'+document.getElementById(\'p\').value+\'&t=\'+document.getElementById(\'t\').options[document.getElementById(\'t\').options.selectedIndex].value,\'usercheck\');
	">
	<option value="1" selected>Planet</option>
	<option value="3">Moon</option>
</select>
<span id="usercheck"><image src="./check/ok.gif" width="16" height="14" /></span><br />

<input type="button" class="button188" value="Go" onclick="getAXAH(\'./?page=admin&link=edit&section={section}&g=\'+document.getElementById(\'g\').value+\'&s=\'+document.getElementById(\'s\').value+\'&p=\'+document.getElementById(\'p\').value+\'&t=\'+document.getElementById(\'t\').options[document.getElementById(\'t\').options.selectedIndex].value,\'section\');" />';
            makeAXAH(parsetemplate($template, $parse));
        }
        break;
    case "submit":
        $count = 0;
        $query = "UPDATE {{table}} SET ";
        foreach ($_POST as $key => $val) {
            if (is_numeric($key)) {
                if (is_numeric($val)) {
                    if (strlen($resource[$key]) > 0) {
                        $count++;
                        $query .= "`" . $resource[$key] . "` = '" . idstring($val) . "' , ";
                    }
                }
            }
        }
示例#8
0
    $parse['opt_probe_data'] = $user['spio_anz'];
    $parse['opt_toolt_data'] = $user['settings_tooltiptime'];
    $parse['opt_fleet_data'] = $user['settings_fleetactions'];
    $parse['opt_sskin_data'] = $user['design'] == 1 ? " checked='checked'" : '';
    $parse['opt_noipc_data'] = $user['noipcheck'] == 1 ? " checked='checked'" : '';
    $parse['opt_allyl_data'] = $user['settings_allylogo'] == 1 ? " checked='checked'/" : '';
    $parse['opt_delac_data'] = $user['db_deaktjava'] == 1 ? " checked='checked'/" : '';
    $parse['opt_modev_data'] = $user['urlaubs_modus'] == 1 ? " checked='checked'/" : '';
    $parse['opt_modev_exit'] = $user['urlaubs_modus'] == 0 ? " checked='1'/" : '';
    $parse['Vaccation_mode'] = $lang['Vaccation_mode'];
    $parse['vacation_until'] = date("d.m.Y G:i:s", $user['urlaubs_until']);
    $parse['user_settings_rep'] = $user['settings_rep'] == 1 ? " checked='checked'/" : '';
    $parse['user_settings_esp'] = $user['settings_esp'] == 1 ? " checked='checked'/" : '';
    $parse['user_settings_wri'] = $user['settings_wri'] == 1 ? " checked='checked'/" : '';
    $parse['user_settings_mis'] = $user['settings_mis'] == 1 ? " checked='checked'/" : '';
    $parse['user_settings_bud'] = $user['settings_bud'] == 1 ? " checked='checked'/" : '';
    $parse['kolorminus'] = $user['kolorminus'];
    $parse['kolorplus'] = $user['kolorplus'];
    $parse['kolorpoziom'] = $user['kolorpoziom'];
    $parse['get_ip'] = $_SERVER['REMOTE_ADDR'];
    if ($user['urlaubs_modus']) {
        displaypage(parsetemplate(gettemplate('options_body_vmode'), $parse), 'Options', false);
    } else {
        if ($_GET['axah']) {
            makeAXAH(parsetemplate(gettemplate('options'), $parse));
        } else {
            displaypage(parsetemplate(gettemplate('options'), $parse), 'Options');
        }
    }
    die;
}
示例#9
0
                    $parse['storage_ap'] = pretty_number($parse['storage_a']);
                    $parse['storage_bp'] = pretty_number($parse['storage_b']);
                    $parse['storage_cp'] = pretty_number($parse['storage_c']);
                    $parse['ResourceA'] = $lang['Deuterium'];
                    $parse['ResourceB'] = $lang['Metal'];
                    $parse['ResourceC'] = $lang['Crystal'];
                    $parse['resa'] = 'deuterium';
                    $parse['resb'] = 'metal';
                    $parse['resc'] = 'crystal';
                    $parse['tradec'] = $trade['d'];
                    $parse['tradeb'] = $trade['m'];
                    $parse['tradea'] = $trade['c'];
                    break;
            }
        }
    }
    $parse['planet'] = $CurrentPlanet['name'];
    $Page = parsetemplate($PageTPL, $parse);
    return $Page;
}
$Page = ModuleMarchand($user, $planetrow);
if ($_GET['axah']) {
    makeAXAH($Page, $lang['Marchand']);
} else {
    displaypage($Page, $lang['Marchand'], true, '', false);
}
// -----------------------------------------------------------------------------------------------------------
// History version
// 1.0 - Version originelle (Tom1991)
// 1.1 - Version 2.0 de Tom1991 ajout java
// 1.2 - R��criture Chlorel passage aux template, optimisation des appels et des requetes SQL
示例#10
0
            $usermessages[$messcat] = 0;
            foreach ($usermessages as $type => $count) {
                if ($type < 0 || $type > 5 || intval($type) != $type || idstring($type) != $type) {
                    unset($usermessages[$type]);
                }
            }
            doquery("UPDATE {{table}} SET `messages` = '" . implode(",", $usermessages) . "', `menus_update` = '" . time() . "' WHERE `id` = '" . $user['id'] . "' LIMIT 1 ;", 'users');
        }
        if (mysql_num_rows($messages) > 0) {
            $parse['content'] = "\r\n\t\t\t\t\t<form action=\"./?page=messages&mode=delete&messcat=" . $_GET['messcat'] . "\" method=\"GET\" id=\"messagesform\" name=\"messagesform\">\n\r\n\t\t\t\t\t\t<input type=\"hidden\" name=\"page\" value=\"messages\" />\n\r\n\t\t\t\t\t\t<input type=\"hidden\" name=\"mode\" value=\"delete\" />\n\r\n\t\t\t\t\t\t<input type=\"hidden\" name=\"messcat\" value=\"" . $_GET['messcat'] . "\" />\n\r\n\t\t\t\t\t\t<table class=\"list\" id=\"mailz\" cellpadding=\"0\" cellspacing=\"0\">\n\r\n\t\t\t\t\t\t<tbody>\n\r\n\t\t\t\t\t\t<tr class=\"first alt\">\n\r\n\t\t\t\t\t\t\t<th class=\"check\">\n\r\n\t\t\t\t\t\t\t\t<input class=\"checker\" id=\"checkAll\"onclick=\"likenAll(document.messagesform,'checkAll');\" type=\"checkbox\">\n\r\n\t\t\t\t\t\t\t</th>\n\r\n\t\t\t\t\t\t\t\t<th class=\"from\">Sender</th>\n\r\n\t\t\t\t\t\t\t\t<th class=\"subject\">Subject</th>\n\r\n\t\t\t\t\t\t\t<th class=\"date\">Date</th>\n\r\n\t\t\t\t\t\t\t<th class=\"action\"></th>\n\r\n\t\t\t\t\t\t</tr>\n";
            $n = 0;
            while ($row = mysql_fetch_array($messages)) {
                $n++;
                $parse['content'] .= "\r\n\t\t\t\t\t\t\t<input name=\"showmes" . $row['message_id'] . "\" type=\"hidden\" value=\"1\" />\r\n\t\t\t\t\t\t\t<tr class=\"trigger alt new\" id=\"" . $row['message_id'] . "TR\">\n\r\n\t\t\t\t\t\t\t\t<td class=\"check\">\n\r\n\t\t\t\t\t\t\t\t\t<input class=\"checker\" name=\"delmes" . $row['message_id'] . "\" id=\"delmes" . $row['message_id'] . "\" type=\"checkbox\">\n\r\n\t\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t\t\t<td class=\"from\">" . $row['message_from'] . "</td>\n\r\n\t\t\t\t\t\t\t\t<td class=\"subject\">\n\r\n\t\t\t\t\t\t\t\t\t<a class=\"ajax_thickbox\" id=\"" . $row['message_id'] . "\" href=\"#\" onclick=\"mrbox('./?page=showmessage&id=" . $row['message_id'] . "&cat=" . idstring($messcat) . "&n=" . $n . "&count=" . mysql_num_rows($messages) . "&iframe=1&iheight=800',800)\">\n\r\n\t\t\t\t\t\t\t\t\t\t" . $row['message_subject'] . "\n\r\n\t\t\t\t\t\t\t\t\t</a>\n\r\n\t\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t\t\t<td class=\"date\">" . date("jS F H:i", $row['message_time']) . "</td>\n\r\n\t\t\t\t\t\t\t\t<td class=\"actions\" id=\"test\">\n\r\n\t\t\t\t\t\t\t\t\t<a href=\"#\" rel=\"" . $row['message_id'] . "\" class=\"del tips deleteIt\" onmouseover=\"mr_tooltip('Delete this message');\" onclick=\"document.getElementById('delmes" . $row['message_id'] . "').checked=true;document.getElementById('delmethod').value='marked';document.getElementById('okbutton').style.display='inline';\" id=\"2\">\n\r\n\t\t\t\t\t\t\t\t\t\t<img src=\"" . GAME_SKIN . "/img/icons/" . $trash . ".gif\">\n\r\n\t\t\t\t\t\t\t\t\t</a>\n\r\n\t\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t\t</tr>\n";
            }
            $parse['content'] .= "\r\n\t\t\t\t\t\t</tr>\n\r\n\t\t\t\t\t\t<tr class=\"last alt\">\n\r\n\t\t\t\t\t\t\t<td colspan=\"3\" align=\"left\">\n\r\n\t\t\t\t\t\t\t\t<select class=\"choose\" id=\"delmethod\" name=\"delete\" onchange=\"document.getElementById('okbutton').style.display='inline';\">\n\r\n\t\t\t\t\t\t\t\t\t<option class=\"underlined\">" . $lang['DelAktion'] . "</option>\n\r\n\t\t\t\t\t\t\t\t\t<option class=\"method\" value=\"marked\">" . $lang[$Del . 'Mark'] . "</option>\n\r\n\t\t\t\t\t\t\t\t\t<option class=\"method\" value=\"unmarked\">" . $lang[$Del . 'Unmark'] . "</option>\n\r\n\t\t\t\t\t\t\t\t\t<option class=\"method\" value=\"shown\">" . $lang[$Del . 'Shown'] . "</option>\n\r\n\t\t\t\t\t\t\t\t\t<option class=\"method\" value=\"all\">" . $lang[$Del . 'All'] . "</option>\n\r\n\t\t\t\t\t\t\t\t\t</select>\n\r\n\t\t\t\t\t\t\t\t\t<!--<input name=\"submit\" value=\"OK2\" class=\"buttonOK deleteIt\" id=\"okbutton\" style=\"display: none;\" type=\"submit\">-->\n\n\t\t\t\t\t\t\t\t\t<input type=\"button\" class=\"buttonOK deleteIt\" id=\"okbutton\" value=\"OK\" onclick=\"mr_alert('<img height=16 width=16 src=\\'{{skin}}/img/ajax-loader.gif\\' /> {Loading}...'); getAXAH(form2get('messagesform'),'errorBoxNotifyContent');\" style=\"display: none;\" />\n\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t\t<td colspan=\"2\">\n\r\n\t\t\t\t\t\t\t\t<div class=\"selectContainer\">\n\r\n\t\t\t\t\t\t\t\t</div>\n\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t</tr>\n\r\n\t\t\t\t\t\t</tbody>\n\r\n\t\t\t\t\t\t</table>\n\r\n\t\t\t\t\t</form>\n";
        } else {
            $parse['content'] .= "No messages found";
        }
}
if ($_GET['axah_section']) {
    echo $parse['catag'];
    echo '<div id="messageContent" class="msg_content textBeefy textCenter">';
    echo $parse['content'];
    echo '</div>';
    die;
} elseif ($_GET['axah']) {
    makeAXAH(parsetemplate(gettemplate('network/messages'), $parse));
} else {
    displaypage(parsetemplate(gettemplate('network/messages'), $parse), $lang['mess_pagetitle']);
}
示例#11
0
文件: stats.php 项目: sonicmaster/RPG
						<td class="sendmsg">
							<a title="' . $lang['send_message'] . '" class="tips thickbox" href="./?page=write&to=' . $statrow['id'] . '&close=1"  onClick="window.open(this.href, this.target, \'width=770,height=475\');return false;">
								<img title="' . $lang['send_message'] . '" src="' . GAME_SKIN . '/img/icons/mail.gif" />
							</a>
						</td>
						
						<!-- points -->
						<td class="score">' . pretty_number(floor($statrow[$sort . "_points"] / $game_config['stat_settings'])) . '</td>
					</tr>';
        //$updaterank .= "UPDATE {{table}} SET `".$sort."_rank` = '".$p."' WHERE `username` = '".$statrow[$disp.'name']."' ;  ";
        unset($statrow);
    }
    //$updaterank .= "UPDATE {{table}} SET `".$sort."_rank` = '".$p."' WHERE `username` = '".$statrow[$disp.'name']."' ;  ";
}
$parse['pages'] = '';
for ($p = 1; $p <= ceil($game_config['users_amount'] / 100); $p++) {
    $st = ($p - 1) * 100;
    if ($p == $_GET['p']) {
        $selected = "SELECTED";
    } else {
        $selected = "";
    }
    $parse['pages'] .= "\t\t\t\t\t\t<option value=\"" . $p . "\" " . $selected . ">" . ($st + 1) . "-" . ($st + 100) . "</option>\n";
}
//Update
//if($who == 'player'){ doquery($updaterank,'users'); }
if ($_GET['axah']) {
    makeAXAH(parsetemplate(gettemplate('stats'), $parse));
} else {
    displaypage(parsetemplate(gettemplate('stats'), $parse), $lang['Statistics']);
}
示例#12
0
function ResearchPage(&$CurrentPlanet, $CurrentUser, $InResearch, $ThePlanet)
{
    global $lang, $resource, $reslist, $pricelist, $phpEx, $dpath, $game_config, $_GET;
    CheckPlanetUsedFields($CurrentPlanet);
    // Boucle d'interpretation des eventuelles commandes
    if (isset($_GET['cmd'])) {
        $TheCommand = $_GET['cmd'];
        $Techno = idstring($_GET['tech']);
        if (is_numeric($Techno)) {
            if (in_array($Techno, $reslist['tech'])) {
                // Bon quand on arrive ici ... On sait deja qu'on a une technologie valide
                if (is_array($ThePlanet)) {
                    $WorkingPlanet = $ThePlanet;
                } else {
                    $WorkingPlanet = $CurrentPlanet;
                }
                switch ($TheCommand) {
                    case 'cancel':
                        if ($ThePlanet['b_tech_id'] == $Techno) {
                            $costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
                            $WorkingPlanet['metal'] += $costs['metal'];
                            $WorkingPlanet['crystal'] += $costs['crystal'];
                            $WorkingPlanet['deuterium'] += $costs['deuterium'];
                            $WorkingPlanet['b_tech_id'] = 0;
                            $WorkingPlanet["b_tech"] = 0;
                            $CurrentUser['b_tech_planet'] = 0;
                            $UpdateData = true;
                            $InResearch = false;
                        }
                        break;
                    case 'search':
                        if (IsTechnologieAccessible($CurrentUser, $WorkingPlanet, $Techno) && IsElementBuyable($CurrentUser, $WorkingPlanet, $Techno) && !$InResearch) {
                            $costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
                            $WorkingPlanet['metal'] -= $costs['metal'];
                            $WorkingPlanet['crystal'] -= $costs['crystal'];
                            $WorkingPlanet['deuterium'] -= $costs['deuterium'];
                            $WorkingPlanet["b_tech_id"] = $Techno;
                            $WorkingPlanet["b_tech"] = time() + GetBuildingTime($CurrentUser, $WorkingPlanet, $Techno);
                            $CurrentUser["b_tech_planet"] = $WorkingPlanet["id"];
                            $UpdateData = true;
                            $InResearch = true;
                        }
                        break;
                }
                if ($UpdateData == true) {
                    $QryUpdatePlanet = "UPDATE {{table}} SET ";
                    $QryUpdatePlanet .= "`b_tech_id` = '" . $WorkingPlanet['b_tech_id'] . "', ";
                    $QryUpdatePlanet .= "`b_tech` = '" . $WorkingPlanet['b_tech'] . "', ";
                    $QryUpdatePlanet .= "`metal` = '" . $WorkingPlanet['metal'] . "', ";
                    $QryUpdatePlanet .= "`crystal` = '" . $WorkingPlanet['crystal'] . "', ";
                    $QryUpdatePlanet .= "`deuterium` = '" . $WorkingPlanet['deuterium'] . "' ";
                    $QryUpdatePlanet .= "WHERE ";
                    $QryUpdatePlanet .= "`id` = '" . $WorkingPlanet['id'] . "';";
                    doquery($QryUpdatePlanet, 'planets');
                    $QryUpdateUser = "******";
                    $QryUpdateUser .= "`b_tech_planet` = '" . $CurrentUser['b_tech_planet'] . "' ";
                    $QryUpdateUser .= "WHERE ";
                    $QryUpdateUser .= "`id` = '" . $CurrentUser['id'] . "';";
                    doquery($QryUpdateUser, 'users');
                }
                if (is_array($ThePlanet)) {
                    $ThePlanet = $WorkingPlanet;
                } else {
                    $CurrentPlanet = $WorkingPlanet;
                    if ($TheCommand == 'search') {
                        $ThePlanet = $CurrentPlanet;
                    }
                }
            }
        } else {
            $bContinue = false;
        }
    }
    $TechScrTPL = gettemplate('buildings_research_script');
    $SubTemplate = gettemplate('buildings/research_buttonz');
    $parse = array();
    $infopg = array();
    foreach ($lang['names'] as $Tech => $TechName) {
        if ($Tech > 105 && $Tech <= 199) {
            if (!IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
                $parse['state_' . $Tech] = "off";
                $parse['mes_' . $Tech] = "Requirements are not met";
            } elseif (!IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech)) {
                $parse['state_' . $Tech] = "disabled";
                $parse['mes_' . $Tech] = "Not enough resources!";
            } else {
                $parse['state_' . $Tech] = "on";
                $parse['mes_' . $Tech] = "";
            }
        } else {
            $parse['state_' . $Tech] = "off";
            $parse['mes_' . $Tech] = "Not availble";
        }
        $parse['name_' . $Tech] = $TechName;
        $parse['count_' . $Tech] = $CurrentUser[$resource[$Tech]];
    }
    //Anything currently building?
    if ($CurrentUser['b_tech_planet']) {
        $WorkingPlanet = doquery("SELECT `id`,`name`,`b_tech_id`,`b_tech` FROM {{table}} WHERE `id` = '" . $CurrentUser['b_tech_planet'] . "';", 'planets', true);
        //Whats currently building
        $curbuild = $WorkingPlanet['b_tech_id'];
        $parse['countdown_' . $curbuild] = "\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"pusher\" id=\"b_research" . $curbuild . "\" style=\"height:80px;margin-bottom:-80px;\">\n\r\n\t\t\t\t\t\t\t\t\t\t\t<a><span class=\"time\" id=\"test\" name=\"zeit\">" . parsecountdown($WorkingPlanet['b_tech']) . "</span></a>\n\r\n\t\t\t\t\t\t\t\t\t\t</div>\n";
    } else {
        $curbuild = 0;
    }
    $Buttonz = parsetemplate($SubTemplate, $parse);
    $parse = $lang;
    $Element = idstring($_GET['id']);
    $ElementName = $lang['names'][$Element];
    $de_planettype = PlanetType($CurrentPlanet['image']);
    $parse['type'] = $de_planettype['type'];
    if ($Element) {
        if (in_array($Element, $reslist['tech'])) {
            /*
            $RowParse['dpath']       = $dpath;
            $RowParse['tech_id']     = $Tech;
            $building_level          = $CurrentUser[$resource[$Tech]];
            $RowParse['tech_level']  = ($building_level == 0) ? "" : "( ". $lang['level']. " ".$building_level." )";
            $RowParse['tech_name']   = $TechName;
            $RowParse['tech_descr']  = $lang['res']['descriptions'][$Tech];
            $RowParse['tech_price']  = GetElementPrice($CurrentUser, $CurrentPlanet, $Tech);
            $SearchTime              = GetBuildingTime($CurrentUser, $CurrentPlanet, $Tech);
            $RowParse['search_time'] = ShowBuildTime($SearchTime);
            $RowParse['tech_restp']  = $lang['Rest_ress'] ." ". GetRestPrice ($CurrentUser, $CurrentPlanet, $Tech, true);
            $CanBeDone               = IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech);
            */
            $HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element);
            $parse['i'] = $Element;
            $BuildingLevel = $CurrentPlanet[$resource[$Element]];
            $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")";
            $parse['n'] = $ElementName;
            $parse['descriptions'] = $lang['res']['descriptions'][$Element];
            $ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
            $parse['time'] = ShowBuildTime($ElementBuildTime);
            $parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
            $parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element);
            $parse['click'] = '';
            $buildlink = "./?page=research&cmd=search&id=" . $Element . "&tech=" . $Element;
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                if ($NextBuildLevel == 1) {
                    if ($HaveRessources == true) {
                        $infopg['build_link'] = $buildlink;
                        $infopg['build_text'] = $lang['BuildFirstLevel'];
                    } else {
                        $infopg['build_text'] = $lang['BuildFirstLevel'];
                    }
                } else {
                    if ($HaveRessources == true) {
                        $infopg['build_link'] = $buildlink;
                        $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel;
                    } else {
                        $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel;
                    }
                }
            } elseif ($InResearch) {
                $parse['click'] = "<font color=#FF0000>" . $lang['InResearch'] . "</font>";
                $infopg['build_text'] = $lang['InResearch'];
            } else {
                $parse['click'] = "<font color=#FF0000>" . $lang['NotAccessible'] . "</font>";
                $infopg['build_text'] = $lang['NotAccessible'];
            }
            //Building Info
            if ($infopg['build_link']) {
                $infopg['buildit_class'] = "build-it";
                $infopg['build_text'] = $lang['Improve'];
            } elseif ($InResearch) {
                $infopg['buildit_class'] = "build-it_disabled";
                $infopg['build_text'] = $lang['InResearch'];
            } else {
                $infopg['buildit_class'] = "build-it_disabled";
                $infopg['build_text'] = $lang['NotAccessible'];
            }
            $infopg['id'] = $Element;
            $infopg['name'] = $ElementName;
            $infopg['level'] = $CurrentUser[$resource[$Element]];
            //Current research
            if ($curbuild == $Element) {
                $infopg['td_url'] = "./?page=" . $_GET['page'] . "&cmd=cancel&id=" . $Element . "&tech=" . $Element;
                if ($WorkingPlanet['id'] == $CurrentPlanet['id']) {
                    $infopg['title'] = "Cancel";
                } else {
                    //$infopg['title'] = "Cancel on ".$WorkingPlanet['name'];
                    $infopg['title'] = "Cancel";
                }
            } else {
                $infopg['display_destroy'] = "style=\"display:none;\"";
            }
            $infopg['level1'] = $infopg['level'] + 1;
            $infopg['duration'] = pretty_time($ElementBuildTime);
            $infopg['shortdesc'] = $lang['sdesc'][$Element];
            $infopg['skin'] = $CurrentUser['skin'];
            $infopg['cost_m'] = 1 * floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $CurrentUser[$resource[$Element]]));
            $infopg['cost_c'] = 1 * floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $CurrentUser[$resource[$Element]]));
            $infopg['cost_d'] = 1 * floor($pricelist[$Element]['deuterium'] * pow($pricelist[$Element]['factor'], $CurrentUser[$resource[$Element]]));
            if ($infopg['cost_m'] > $CurrentPlanet['metal'] && $infopg['cost_m'] > 0) {
                $infopg['missing_resource_m'] = "missing_resource";
            }
            if ($infopg['cost_c'] > $CurrentPlanet['crystal'] && $infopg['cost_c'] > 0) {
                $infopg['missing_resource_c'] = "missing_resource";
            }
            if ($infopg['cost_d'] > $CurrentPlanet['deuterium'] && $infopg['cost_d'] > 0) {
                $infopg['missing_resource_d'] = "missing_resource";
            }
            $infopg['sh_cost_m'] = KMnumber($infopg['cost_m'], 0, 'up');
            $infopg['sh_cost_c'] = KMnumber($infopg['cost_c'], 0, 'up');
            $infopg['sh_cost_d'] = KMnumber($infopg['cost_d'], 0, 'up');
            $infopg['cost_m'] = pretty_number($infopg['cost_m']);
            $infopg['cost_c'] = pretty_number($infopg['cost_c']);
            $infopg['cost_d'] = pretty_number($infopg['cost_d']);
            $infopg['page'] = $_GET['page'];
            $parse['info'] = parsetemplate(gettemplate('buildings/info'), $infopg);
            $parse['extra'] = "style=\"display:none\"";
            if ($_GET['axah_section'] == '1') {
                makeAXAH($parse['info']);
                die;
            }
        }
    }
    $parse['buttonz'] = $Buttonz;
    $parse['planetname'] = $CurrentPlanet['name'];
    $page .= parsetemplate(gettemplate('buildings/research'), $parse);
    if ($_GET['axah']) {
        makeAXAH($page);
    } else {
        displaypage($page, $lang['Research']);
    }
}
示例#13
0
/**
 * ShipyardBuildingPage.php
 *
 * @version 1.0
 * @copyright 2009 By MadnessRed for XNova Redesigned
 */
function ShipyardPage(&$CurrentPlanet, $CurrentUser, $area)
{
    global $lang, $resource, $phpEx, $dpath, $_GET, $reslist, $pricelist;
    if ($_GET['fmenge'] > 0) {
        // On vient de Cliquer ' Construire '
        // Et y a une liste de dol�ances
        $AddedInQueue = false;
        // What an how much are they making?
        $Element = intval(idstring($_GET['fmenge']));
        $Count = intval(idstring($_GET[$Element]));
        if (in_array($Element, $reslist[$area])) {
            //Check if it exaceeds the max amount we allow them to build in one go (XNova code)
            if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
                $Count = MAX_FLEET_OR_DEFS_PER_ROW;
            }
            $InQueue = 0;
            $QueueSize = 0;
            foreach (explode(";", $CurrentPlanet['b_hangar_id']) as $temp) {
                if (strlen($temp) > 0) {
                    $q = explode(",", $temp);
                    $QueueSize += $q[1];
                    if ($q[0] = $Element) {
                        $InQueue += $q[1];
                    }
                }
            }
            //If there is a maximum allowed
            if ($pricelist[$Element]['max'] > 0) {
                if ($Count + $InQueue + $CurrentPlanet[$resource[$Element]] > $pricelist[$Element]['max']) {
                    $Count = $pricelist[$Element]['max'] - $CurrentPlanet[$resource[$Element]] - $InQueue;
                }
            }
            //And missiles...
            if ($Element == 502 || $Element == 503) {
            }
            if ($Count > 0) {
                // On verifie si on a les technologies necessaires a la construction de l'element
                if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                    // On verifie combien on sait faire de cet element au max
                    $MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
                    // Si pas assez de ressources, on ajuste le nombre d'elements
                    if ($Count > $MaxElements) {
                        $Count = $MaxElements;
                    }
                    $Ressource = GetElementRessources($Element, $Count);
                    $BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                    if ($Count >= 1) {
                        //echo "". $Element .",". $Count .";";
                        $CurrentPlanet['metal'] -= $Ressource['metal'];
                        $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                        $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                        $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
                    }
                }
            }
        }
        if ($QueueSize == 0) {
            $CurrentPlanet['b_hangar_lastupdate'] = time();
            $CurrentPlanet['b_hangar'] = 0;
        }
        //now do those changes...
        doquery("UPDATE {{table}} SET `metal` = '" . $CurrentPlanet['metal'] . "', `crystal` = '" . $CurrentPlanet['crystal'] . "', `deuterium` = '" . $CurrentPlanet['deuterium'] . "', `b_hangar_id` = '" . $CurrentPlanet['b_hangar_id'] . "', `b_hangar` = '" . $CurrentPlanet['b_hangar'] . "', `b_hangar_lastupdate` = '" . $CurrentPlanet['b_hangar_lastupdate'] . "' WHERE `id` = '" . $CurrentPlanet['id'] . "' ;", 'planets');
    }
    // -------------------------------------------------------------------------------------------------------
    // S'il n'y a pas de Chantier ...
    if ($CurrentPlanet[$resource[21]] == 0) {
        $shipyard = false;
    } else {
        $shipyard = true;
    }
    // -------------------------------------------------------------------------------------------------------
    // Now for the building part.
    $TabIndex = 0;
    if ($area == 'fleet') {
        $SubTemplate = gettemplate('buildings/shipyard_buttonz');
        $Template = gettemplate('buildings/shipyard');
        $Title = $lang['Shipyard'];
    } elseif ($area == 'defense') {
        $SubTemplate = gettemplate('buildings/defense_buttonz');
        $Template = gettemplate('buildings/defense');
        $Title = $lang['Defense'];
    }
    $parse = array();
    $infopg = array();
    if (!in_array($Element, $reslist[$area]) || $_GET['axah_section'] != '1') {
        foreach ($lang['tech'] as $Element => $ElementName) {
            if (in_array($Element, $reslist[$area])) {
                if (!IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                    $parse['state_' . $Element] = "off";
                    $parse['mes_' . $Element] = "Requirements are not met";
                } elseif (!IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false)) {
                    $parse['state_' . $Element] = "disabled";
                    $parse['mes_' . $Element] = "Not enough resources!";
                } else {
                    $parse['state_' . $Element] = "on";
                    $parse['mes_' . $Element] = "";
                }
                $parse['name_' . $Element] = $ElementName;
                $parse['count_' . $Element] = $CurrentPlanet[$resource[$Element]];
            } else {
                $parse['state_' . $Element] = "off";
                $parse['mes_' . $Element] = "Not availble";
            }
        }
        $Buttonz = parsetemplate($SubTemplate, $parse);
    }
    $parse = $lang;
    $Element = idstring($_GET['id']);
    $ElementName = $lang['tech'][$Element];
    if (in_array($Element, $reslist[$area])) {
        if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element) && IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false)) {
            $infopg['build_link'] = './?page=' . $_GET['page'] . '&id=' . $Element . '&fmenge=' . $Element . '&' . $Element . '=';
            //$infopg['build_link'] = '#" onclick="document.forms.shipyard.submit()';
        }
        //Building Info
        if ($infopg['build_link']) {
            $infopg['buildit_class'] = "build-it";
            $infopg['build_text'] = "Build";
        } else {
            $infopg['buildit_class'] = "build-it_disabled";
            $infopg['build_text'] = "Build";
        }
        $infopg['id'] = $Element;
        $infopg['name'] = $ElementName;
        $infopg['level'] = $CurrentPlanet[$resource[$Element]];
        $infopg['duration'] = pretty_time(GetBuildingTime($CurrentUser, $CurrentPlanet, $Element));
        $infopg['shortdesc'] = $lang['res']['descriptions'][$Element];
        $infopg['skin'] = $CurrentUser['skin'];
        $infopg['cost_m'] = $pricelist[$Element]['metal'];
        $infopg['cost_c'] = $pricelist[$Element]['crystal'];
        $infopg['cost_d'] = $pricelist[$Element]['deuterium'];
        if ($infopg['cost_m'] > $CurrentPlanet['metal'] && $infopg['cost_m'] > 0) {
            $infopg['missing_resource_m'] = "missing_resource";
        }
        if ($infopg['cost_c'] > $CurrentPlanet['crystal'] && $infopg['cost_c'] > 0) {
            $infopg['missing_resource_c'] = "missing_resource";
        }
        if ($infopg['cost_d'] > $CurrentPlanet['deuterium'] && $infopg['cost_d'] > 0) {
            $infopg['missing_resource_d'] = "missing_resource";
        }
        $infopg['sh_cost_m'] = KMnumber($infopg['cost_m'], 0, 'up');
        $infopg['sh_cost_c'] = KMnumber($infopg['cost_c'], 0, 'up');
        $infopg['sh_cost_d'] = KMnumber($infopg['cost_d'], 0, 'up');
        $infopg['cost_m'] = pretty_number($infopg['cost_m']);
        $infopg['cost_c'] = pretty_number($infopg['cost_c']);
        $infopg['cost_d'] = pretty_number($infopg['cost_d']);
        $infopg['page'] = $_GET['page'];
        $parse['info'] = parsetemplate(gettemplate('buildings/sy_info'), $infopg);
        $parse['extra'] = "style=\"display:none\"";
        if ($_GET['axah_section'] == '1') {
            makeAXAH($parse['info']);
            die;
        }
    }
    $parse['buttonz'] = $Buttonz;
    $parse['planetname'] = $CurrentPlanet['name'];
    $page = parsetemplate($Template, $parse);
    if ($_GET['axah']) {
        makeAXAH($page);
    } else {
        displaypage($page, $Title);
    }
}