当前位置: 首页>>代码示例>>PHP>>正文


PHP idstring函数代码示例

本文整理汇总了PHP中idstring函数的典型用法代码示例。如果您正苦于以下问题:PHP idstring函数的具体用法?PHP idstring怎么用?PHP idstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了idstring函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: RecallFleet

/**
 * RecallFleet.php
 *
 * @version 1.0
 * @copyright 2010 By MadnessRed for XNova Redesigned
 */
function RecallFleet($id, $key = 'x', $user = 'x')
{
    global $lang;
    //Get the lang strings
    getLang('fleet_management');
    //See what validation is needed
    $and = '';
    if ($key != 'x') {
        $and .= " AND `passkey` = '" . idstring($key) . "'";
    }
    if ($user != 'x') {
        $and .= " AND `owner_userid` = '" . idstring($user) . "'";
    }
    //First get said fleet:
    $fleetrow = doquery("SELECT *, COUNT('fleet_id') AS `count` FROM {{table}} WHERE `fleet_id` = '" . idstring($id) . "'" . $and . " AND `fleet_mess` = '0' AND `mission` <> '0' ;", 'fleets', true);
    //Check we found the fleet:
    if ($fleetrow['count'] == 1) {
        //Incase script takes over a second, lets keep now constant.
        $now = time();
        //Duration in flight
        $duration = $now - $fleetrow['departure'];
        //ok, lets update the fleet
        doquery("UPDATE {{table}} SET `departure` = '" . $now . "', `arrival` = '" . ($now + $duration) . "', `target_id` = '" . $fleetrow['owner_id'] . "', `target_userid` = '" . $fleetrow['owner_userid'] . "', `owner_id` = '" . $fleetrow['target_id'] . "', `owner_userid` = '" . $fleetrow['target_userid'] . "', `fleet_mess` = '1', `mission` = '0' WHERE `fleet_id` = '" . $fleetrow['fleet_id'] . "' ;", 'fleets', false);
        //Remove any partner fleets
        doquery("DELETE FROM {{table}} WHERE `partner_fleet` = '" . $fleetrow['fleet_id'] . "' ;", 'fleets', false);
        //Update menus
        doquery("UPDATE {{table}} SET `menus_update` = '" . time() . "' WHERE `id` = '" . $fleetrow['owner_userid'] . "' LIMIT 1 ;", 'users', false);
        doquery("UPDATE {{table}} SET `menus_update` = '" . time() . "' WHERE `id` = '" . $fleetrow['target_userid'] . "' LIMIT 1 ;", 'users', false);
        //Thats it
        return $lang['fleet_recall'];
    } else {
        return $lang['fleet_not_fnd'];
    }
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:40,代码来源:RecallFleet.php

示例2: PM

/**
 * PM.php
 *
 * @version 1.1
 * @copyright 2009 by MadnessRed for XNova Redeisgned
 */
function PM($to, $from, $message, $subject = '', $sender = '', $type = 0)
{
    //Add the message to the databas (xnova code) with a bit of security modification
    $QryInsertMessage = "INSERT INTO {{table}} SET ";
    $QryInsertMessage .= "`message_owner` = '" . idstring($to) . "', ";
    $QryInsertMessage .= "`message_sender` = '" . idstring($from) . "', ";
    $QryInsertMessage .= "`message_text` = '" . mysql_real_escape_string(addslashes($message)) . "', ";
    $QryInsertMessage .= "`message_subject` = '" . mysql_escape_string(addslashes($subject)) . "', ";
    $QryInsertMessage .= "`message_from` = '" . mysql_real_escape_string(addslashes($sender)) . "', ";
    $QryInsertMessage .= "`message_type` = '" . idstring($type) . "', ";
    $QryInsertMessage .= "`message_time` = '" . time() . "';";
    doquery($QryInsertMessage, 'messages');
    //Get the target
    $target = doquery("SELECT `id`,`messages` FROM {{table}} WHERE `id` = '" . idstring($to) . "' LIMIT 1 ;", 'users', true);
    //Set messages of this type to +1
    if (strlen($target['messages']) == 0) {
        $target['messages'] = '0,0,0,0,0,0';
    }
    $messages = explode(",", $target['messages'], 6);
    if ($type < 0 || $time > 5) {
        $type = 5;
    }
    $messages[$type] += 1;
    $newmessages = implode(",", $messages);
    //$newmessages = $messages[0].",".$messages[1].",".$messages[2].",".$messages[3].",".$messages[4].",".$messages[5];
    doquery("UPDATE {{table}} SET `messages` = '" . $newmessages . "', `menus_update` = '" . time() . "' WHERE `id` = '" . $target['id'] . "' LIMIT 1 ;", 'users');
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:33,代码来源:PM.php

示例3: AddMoon

function AddMoon($galaxy, $system, $planet, $chance = 20, $name = '_DEFAULT_', $CurrentPlanet = false, $num = 0)
{
    global $lang;
    if ($name == '_DEFAULT_') {
        $name = $lang['sys_moon'];
    }
    if (idstring($num) < 1 || idstring($num) < 5) {
        $num = mt_rand(1, 5);
    }
    $num = '0' . idstring($num);
    //Firsly is there already a moon here?
    $moons = mysql_num_rows(doquery("SELECT `id` FROM {{table}} WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND `planet_type` = '3' LIMIT 1 ;", 'planets', false));
    if ($moons > 0) {
        return "There is already a moon in orbit here.";
    } else {
        //First get the homeplanet
        if (!is_array($CurrentPlanet)) {
            $CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND `planet_type` = '1' LIMIT 1 ;", 'planets', true);
        }
        //Get min and max temps
        $tempmin = $CurrentPlanet['temp_min'] - rand(10, 45);
        $tempmax = $CurrentPlanet['temp_max'] - rand(10, 45);
        //It is possible that min temp becomes greater than max temp, if so just flip them
        if ($tempmin > $tempmax) {
            $temp = $tempmin;
            $tempmin = $tempmax;
            $tempmax = $temp;
        }
        //Now the long query...
        $qry = "INSERT INTO {{table}} SET ";
        $qry .= "`name` = '" . mysql_real_escape_string($name) . "', ";
        $qry .= "`id_owner` = '" . idstring($CurrentPlanet['id_owner']) . "', ";
        $qry .= "`galaxy` = '" . idstring($galaxy) . "', ";
        $qry .= "`system` = '" . idstring($system) . "', ";
        $qry .= "`planet` = '" . idstring($planet) . "', ";
        $qry .= "`planet_type` = '3', ";
        $qry .= "`last_update` = '" . time() . "', ";
        $qry .= "`image` = 'mond" . $num . "', ";
        $qry .= "`diameter` = '" . idstring(rand(2000 + $chance * 100, 6000 + $chance * 200)) . "', ";
        $qry .= "`field_max` = '1', ";
        $qry .= "`temp_min` = '" . idstring($tempmin) . "', ";
        $qry .= "`temp_max` = '" . idstring($tempmax) . "', ";
        $qry .= "`metal` = '0', ";
        $qry .= "`metal_perhour` = '0', ";
        $qry .= "`metal_max` = '" . BASE_STORAGE_SIZE . "', ";
        $qry .= "`crystal` = '0', ";
        $qry .= "`crystal_perhour` = '0', ";
        $qry .= "`crystal_max` = '" . BASE_STORAGE_SIZE . "', ";
        $qry .= "`deuterium` = '0', ";
        $qry .= "`deuterium_perhour` = '0', ";
        $qry .= "`deuterium_max` = '" . BASE_STORAGE_SIZE . "' ;";
        //Do the query and return the result.
        $temp = true;
        doquery($qry, 'planets') or write_to_temp(mysql_error());
        //Tell the user to update his planetlist
        doquery("UPDATE {{table}} SET `menus_update` = '" . time() . "' WHERE `id` = '" . idstring($CurrentPlanet['id_owner']) . "' LIMIT 1;", 'users');
        return $temp;
    }
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:59,代码来源:AddMoon.php

示例4: AddToPlanet

function AddToPlanet($CurrentPlanet, $element, $mode, $charge = false)
{
    global $resources, $resource, $reslist;
    //Well, we need to work out the cost for the points and edit the planets table
    //Standard construction
    //Get the cost
    $cost = BuildingCost($element, $CurrentPlanet[$resource[$element]] + $mode);
    $chargestr = '';
    if ($charge) {
        //If we are changine
        foreach ($resources as $res) {
            //loop through resources
            //Now add to query
            $chargestr .= ", `" . $res . "` = `" . $res . "` - '" . $cost[$res] . "' ";
        }
    }
    //And we will want a + in the query
    $p_sign = "+";
    //If its deconstruction though..
    if ($mode < 0) {
        //Deconstructon
        //Get the cost
        $cost = BuildingCost($element, $CurrentPlanet[$resource[$element]]);
        //And we will want a - in the query
        $p_sign = "-";
    }
    //start total cost
    $tcost = 0;
    //Now the resources which count towards points
    foreach ($resources as $res) {
        //Add them to the total
        $tcost += $cost[$res];
    }
    //Now update the table
    $qry = "UPDATE {{table}} SET `" . $resource[$element] . "` = `" . $resource[$element] . "` " . $p_sign . " " . idstring(abs($mode)) . " " . $chargestr . " WHERE `id` = '" . $CurrentPlanet['id'] . "' LIMIT 1 ;";
    $return = doquery($qry, 'planets', false);
    //If it is less than 100, update slots used
    if ($element < 100) {
        doquery("UPDATE {{table}} SET `field_current` = `field_current` " . $p_sign . " " . idstring(abs($mode)) . " WHERE `id` = '" . $CurrentPlanet['id'] . "' LIMIT 1 ;", 'planets', false);
    }
    //Now update the users stats
    //	Are we making fleet?
    $fleet_points = 0;
    if (in_array($element, $reslist['fleet'])) {
        $fleet_points += $mode;
    }
    //Update in database
    doquery("UPDATE {{table}} SET `total_points` = `total_points` + '" . $tcost . "', `fleet_points` = `fleet_points` + '" . $fleet_points . "' WHERE `id` = '" . $CurrentPlanet['id_owner'] . "' LIMIT 1 ;", 'users');
    //Return the result
    return $return;
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:51,代码来源:AddToPlanet.php

示例5: AddPoints

function AddPoints($points, $perma = false, $id = false)
{
    global $user;
    if (!$id) {
        $id = $user['id'];
    }
    //echo "Adding ".$points." to user ".$user['username']."<br />";
    if ($points < 0) {
        $sign = "-";
        $points = mod(idstring($points));
    } else {
        $sign = "+";
    }
    if ($perma) {
        $permapart = ", `perma_points` = `perma_points` " . $sign . " '" . idstring($points) . "'";
    }
    doquery("UPDATE {{table}} SET `total_points` = `total_points` " . $sign . " '" . idstring($points) . "'" . $permapart . " WHERE `id` = '" . idstring($id) . "' ;", 'users');
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:18,代码来源:StatFunctions.php

示例6: ProtectNoob

/**
 * ProtectNoob.php
 *
 * @version 1
 * @copyright 2009 By MadnessRed for XNova Redesigned
 */
function ProtectNoob($input, $currentuser = false)
{
    if ($currentuser) {
        global $game_config;
        //We need to get the current user.
        if (is_array($currentuser)) {
            //We have co-ords
            $qry = doquery("SELECT `id_owner` FROM {{table}} WHERE `galaxy` = '" . idstring($input[0]) . "' AND `galaxy` = '" . idstring($input[1]) . "' AND `galaxy` = '" . idstring($input[2]) . "' LIMIT 1 ;", 'planets', true);
            $uid = $qry['id_owner'];
        } else {
            //We have an id.
            $uid = $currentuser;
        }
        $user = doquery("SELECT `total_points` FROM {{table}} WHERE `id` = '" . idstring($uid) . "' LIMIT 1 ;", 'users', true);
    } else {
        global $user, $game_config;
    }
    if (is_array($input)) {
        //We have co-ords
        $qry = doquery("SELECT `id_owner` FROM {{table}} WHERE `galaxy` = '" . idstring($input[0]) . "' AND `galaxy` = '" . idstring($input[1]) . "' AND `galaxy` = '" . idstring($input[2]) . "' LIMIT 1 ;", 'planets', true);
        $id = $qry['id_owner'];
    } else {
        //We have an id.
        $id = $input;
    }
    //How many poitns does the attack have?
    $att_pts = $user['total_points'];
    //How many points does the defender have?
    $def_pts = doquery("SELECT `total_points` FROM {{table}} WHERE `id` = '" . idstring($id) . "' LIMIT 1 ;", 'users', true);
    $def_pts = $def_pts['total_points'];
    //Now what the the noob protection threshold?
    $th = $game_config['stat_settings'] * $game_config['noobprotectiontime'];
    if ($def_pts >= $th && $def_pts * $game_config['noobprotectionmulti'] <= $att_pts) {
        //The defender is under the threshold and is less than 20% of the attackers score
        return true;
    } elseif ($att_pts >= $th && $att_pts * $game_config['noobprotectionmulti'] <= $def_pts) {
        //The attacker is under the threshold and is less than 20% of the defenders score
        return true;
    } else {
        //Neither of hte above to, we are clear to attack.
        return false;
    }
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:49,代码来源:ProtectNoob.php

示例7: doquery

            doquery($QryUpdatemsg, "supp");
        }
        $parse['actionpage'] = 'admin&link=supp';
        displaypage(parsetemplate(gettemplate('supp_answ_send'), $parse), 'Support', true);
    }
} elseif ($_GET['schliessen'] == "1") {
    $QryUpdatemsg = "UPDATE {{table}} SET `status` = '0' WHERE `id` = '" . idstring($_GET['ticket']) . "' ";
    doquery($QryUpdatemsg, "supp");
    info($lang['close_t'], $lang['close_ticket'], "./?page=admin&link=supp");
} elseif ($_GET['open'] == "1") {
    $QryUpdatemsg = "UPDATE {{table}} SET `status` = '2' WHERE `id` = '" . idstring($_GET['ticket']) . "' ";
    doquery($QryUpdatemsg, "supp");
    info($lang['open_t'], $lang['open_ticket'], "./?page=admin&link=supp");
} else {
    /// Listenanzeige der eigenen tickets
    $query2 = doquery("SELECT * FROM {{table}} WHERE `ID` = '" . idstring($_GET['ticket']) . "'", "supp");
    while ($ticket2 = mysql_fetch_array($query2)) {
        if ($ticket2['status'] == 0) {
            $status = colourred($lang['statusc']);
            $parse['answer_new'] = $lang['close_t'];
        } elseif ($ticket2['status'] == 1) {
            $status = colourgreen($lang['statuso']);
            $parse['eintrag'] = '
			<textarea name="senden_antwort_text" class="textBox" rows="30" cols="20" onFocus="this.value=\'\'; this.onfocus=null;"></textarea>
			<center><input class="button188" type="submit" name="send" value="' . $lang['send'] . '"></center>';
        } else {
            $status = colourred($lang['statusa']);
            $parse['eintrag'] = '
			<textarea name="senden_antwort_text" class="textBox" rows="30" cols="20" onFocus="this.value=\'\'; this.onfocus=null;"></textarea>
			<center><input class="button188" type="submit" name="send" value="' . $lang['send'] . '"></center>';
        }
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:support.php

示例8: ProductionBuildingPage


//.........这里部分代码省略.........
        $max_qs = 10;
    }
    if ($Queue['lenght'] < $max_qs) {
        $CanBuildElement = true;
    } else {
        $CanBuildElement = false;
    }
    $SubTemplate = gettemplate('buildings_res_buttonz');
    $parse = array();
    $infopg = array();
    foreach ($lang['tech'] as $Element => $ElementName) {
        if (in_array($Element, $Allowed[1])) {
            if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
                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] = "";
                }
            } else {
                $parse['state_' . $Element] = "off";
                $parse['mes_' . $Element] = "Not availble";
            }
            $parse['name_' . $Element] = $ElementName;
            $parse['count_' . $Element] = $CurrentPlanet[$resource[$Element]];
        }
    }
    $BuildingPage = parsetemplate($SubTemplate, $parse);
    $parse = $lang;
    $Element = idstring($_GET['id']);
    $ElementName = $lang['tech'][$Element];
    // Faut il afficher la liste de construction ??
    if ($Queue['lenght'] > 0) {
        $parse['BuildListScript'] = '';
        //$parse['BuildListScript']  = InsertBuildListScript ( "buildings" );
        $parse['BuildList'] = $Queue['buildlist'];
    } else {
        $parse['BuildListScript'] = "";
        $parse['BuildList'] = "";
    }
    $de_planettype = PlanetType($CurrentPlanet['image']);
    $parse['type'] = $de_planettype['type'];
    $parse['bg'] = GAME_SKIN . "/img/header/resources/" . $parse['type'] . $imgnum . ".png";
    $parse['hideres'] = "display:none;";
    $parse['hidenorm'] = "";
    if (!$Element) {
        $parse['bg'] = GAME_SKIN . "/img/header/resources/" . $parse['type'] . $imgnum . ".png";
        if ($_GET['mode'] == "resources") {
            $parse['hideres'] = "";
            $parse['hidenorm'] = "display:none;";
            $parse['resources_section'] = BuildRessourcePage($CurrentUser, $CurrentPlanet);
        }
    } else {
        if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
            //Something else
            $HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
            $parse['i'] = $Element;
            $parse['dpath'] = $dpath;
            $BuildingLevel = $CurrentPlanet[$resource[$Element]];
            $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")";
            $parse['n'] = $ElementName;
            $parse['descriptions'] = $lang['res']['descriptions'][$Element];
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:ProductionBuildingPage.php

示例9: DefensesBuildingPage

function DefensesBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $lang, $resource, $phpEx, $dpath, $_POST, $reslist, $pricelist;
    if (isset($_POST['fmenge'])) {
        // On vient de Cliquer ' Construire '
        // Et y a une liste de doléances
        // Ici, on sait precisement ce qu'on aimerait bien construire ...
        // Gestion de la place disponible dans les silos !
        $Missiles[502] = $CurrentPlanet[$resource[502]];
        $Missiles[503] = $CurrentPlanet[$resource[503]];
        $SiloSize = $CurrentPlanet[$resource[44]];
        $MaxMissiles = $SiloSize * 10;
        // On prend les missiles deja dans la queue de fabrication aussi (ca aide)
        $BuildQueue = $CurrentPlanet['b_hangar_id'];
        $BuildArray = explode(";", $BuildQueue);
        for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
            $ElmentArray = explode(",", $BuildArray[$QElement]);
            if ($ElmentArray[502] != 0) {
                $Missiles[502] += $ElmentArray[502];
            } elseif ($ElmentArray[503] != 0) {
                $Missiles[503] += $ElmentArray[503];
            }
        }
        foreach ($_POST as $Element => $Count) {
            $Element = idstring($Element);
            if (in_array($Element, $reslist['fleet'])) {
                $Element = intval($Element);
                $Count = intval($Count);
                if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
                    $Count = MAX_FLEET_OR_DEFS_PER_ROW;
                }
                if ($Count != 0) {
                    // Cas particulier (Petit Bouclier et Grand Bouclier
                    // ne peuvent exister qu'une seule et unique fois
                    $InQueue = strpos($CurrentPlanet['b_hangar_id'], $Element . ",");
                    $IsBuild = $CurrentPlanet[$resource[407]] >= 1 ? true : false;
                    if ($Element == 407 || $Element == 408) {
                        if ($InQueue === false && !$IsBuild) {
                            $Count = 1;
                        }
                    }
                    // 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);
                        // Testons si on a de la place pour ces nouveaux missiles !
                        if ($Element == 502 || $Element == 503) {
                            // Cas particulier des missiles
                            $ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
                            $MissilesSpace = $MaxMissiles - $ActuMissiles;
                            if ($Element == 502) {
                                if ($Count > $MissilesSpace) {
                                    $Count = $MissilesSpace;
                                }
                            } else {
                                if ($Count > floor($MissilesSpace / 2)) {
                                    $Count = floor($MissilesSpace / 2);
                                }
                            }
                            if ($Count > $MaxElements) {
                                $Count = $MaxElements;
                            }
                            $Missiles[$Element] += $Count;
                        } else {
                            // 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) {
                            $CurrentPlanet['metal'] -= $Ressource['metal'];
                            $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                            $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                            $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
                        }
                    }
                }
            }
        }
    }
    // -------------------------------------------------------------------------------------------------------
    // S'il n'y a pas de Chantier ...
    if ($CurrentPlanet[$resource[21]] == 0) {
        $shipyard = false;
    } else {
        $shipyard = true;
    }
    // -------------------------------------------------------------------------------------------------------
    // Construction de la page du Chantier (car si j'arrive ici ... c'est que j'ai tout ce qu'il faut pour ...
    $TabIndex = 0;
    $PageTable = "";
    $SubTemplate = gettemplate('buildings/defense_buttonz');
    $parse = array();
    $infopg = array();
    foreach ($lang['tech'] as $Element => $ElementName) {
        if (in_array($Element, $reslist['defense'])) {
            if (!IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                $parse['state_' . $Element] = "off";
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:DefensesBuildingPage.php

示例10: MissionCaseDestroy

/**
 * MissionCaseDestroy.php
 *
 * @version 1.0
 * @copyright 2009 By MadnessRed for XNova Redesigned
 */
function MissionCaseDestroy($FleetRow, $CurrentPlanet)
{
    global $resource, $lang, $CombatCaps, $pricelist;
    //Get the fleet
    $fleet = array();
    foreach (explode(';', $FleetRow['array']) as $r) {
        $r = explode(',', $r);
        $fleet[$r[0]] = $r[1];
    }
    //Check we still have Deathstarts
    if ($fleet[214] > 0) {
        $destroyed = array(false, false);
        //Firstly is the moon destroyed:
        $chance_m = (100 - pow($moonsize, 0.5)) * pow($fleet[214], 0.5);
        if ($chance_m > mt_rand(0, 100)) {
            //Any fleet going to the moon should be recalled
            $tomoon = doquery("SELECT `fleet_id` FROM {{table}} WHERE `target_id` = '" . $CurrentPlanet['id'] . "' AND `fleet_mess` = '0' ;", 'fleets', false);
            while ($row = FetchArray($tomoon)) {
                $fleetrow = doquery("SELECT *, COUNT('fleet_id') AS `count` FROM {{table}} WHERE `fleet_id` = '" . idstring($row['fleet_id']) . "' AND `fleet_mess` = '0' AND `mission` <> '0' ;", 'fleets', true);
                //Check we found the fleet:
                if ($fleetrow['count'] == 1) {
                    //Incase script takes over a second, lets keep now constant.
                    $now = time();
                    //Duration in flight
                    $duration = $now - $fleetrow['departure'];
                    //ok, lets update the fleet
                    doquery("UPDATE {{table}} SET `departure` = '" . $now . "', `arrival` = '" . ($now + $duration) . "', `target_id` = '" . $fleetrow['owner_id'] . "', `target_userid` = '" . $fleetrow['owner_userid'] . "', `owner_id` = '" . $fleetrow['target_id'] . "', `owner_userid` = '" . $fleetrow['target_userid'] . "', `fleet_mess` = '1', `mission` = '0' WHERE `fleet_id` = '" . $fleetrow['fleet_id'] . "' ;", 'fleets', false);
                    //Remove any partner fleets
                    doquery("DELETE FROM {{table}} WHERE `partner_fleet` = '" . $fleetrow['fleet_id'] . "' ;", 'fleets', false);
                    //Update menus
                    doquery("UPDATE {{table}} SET `menus_update` = '" . time() . "' WHERE `id` = '" . $fleetrow['owner_userid'] . "' LIMIT 1 ;", 'users', false);
                }
            }
            //And fleets returning to the moon should go the planet
            $planet = doquery("SELECT `id` FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = '1' LIMIT 1 ;", 'planets', true);
            doquery("UPDATE {{table}} SET `target_id` = '" . $planet['id'] . "' WHERE `target_id` = '" . $CurrentPlanet['id'] . "' ;", 'fleets', false);
            doquery("UPDATE {{table}} SET `owner_id` = '" . $planet['id'] . "' WHERE `owner_id` = '" . $CurrentPlanet['id'] . "' ;", 'fleets', false);
            //Delete the moon
            doquery("DELETE FROM {{table}} WHERE `id` = '" . $CurrentPlanet['id'] . "' LIMIT 1 ;", 'planets', false);
            //Mark it as destroyed for the message
            $destroyed[0] = true;
        }
        //Secondly are the Deathstars destroyed.
        $chance_k = 0.5 * pow($moonsize, 0.5);
        if ($chance_k > mt_rand(0, 100)) {
            //Are there any other ships in the fleet?
            if (array_sum($fleet) > $fleet[214]) {
                //Remove rips from the fleet
                unset($fleet[214]);
                //Compile fleet array
                $array = array();
                foreach ($fleet as $id => $c) {
                    $array[] = $id . "," . $c;
                }
                $array = implode(";", $array);
                //Update row
                doquery("UPDATE {{table}} SET `array` = '" . $array . "', `count` = `count` - '" . array_sum($fleet) . "' WHERE `fleet_id` = '" . $FleetRow['fleet_id'] . "' LIMIT 1 ;", 'fleets', false);
            } else {
                //Just remove the fleet
                DeleteFleet($FleetRow['fleet_id']);
            }
            //Mark it as destroyed for the message
            $destroyed[1] = true;
        }
        //Start the message
        $HomePlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $row['target_id'] . "' LIMIT 1 ;", 'planets', true);
        $message = '';
        $message .= sprintf($lang['fleet_9_mess1'], $HomePlanet['name'] . " [" . $HomePlanet['galaxy'] . ":" . $HomePlanet['system'] . ":" . $HomePlanet['planet'] . "]", "[" . $CurrentPlanet['galaxy'] . ":" . $CurrentPlanet['system'] . ":" . $CurrentPlanet['planet'] . "]");
        $message .= sprintf($lang['fleet_9_moon'], $chance_m . '%') . "<br />";
        $message .= sprintf($lang['fleet_9_rips'], $chance_k . '%') . "<br />";
        $message .= $lang['fleet_9_mess2'];
        //So what happen (for the message?)
        if ($destroyed[0] && $destroyed[1]) {
            //Both moon and RIPs destroyed
            $message .= $lang['fleet_9_messD'];
            $message .= $lang['fleet_9_messK'];
        } elseif ($destroyed[0]) {
            //Moon Destroyed
            $message .= $lang['fleet_9_messD'];
        } elseif ($destroyed[1]) {
            //RIPs destroyed
            $message .= $lang['fleet_9_messK'];
        } else {
            //Nothing destroyed
            $message .= $lang['fleet_9_messN'];
        }
        PM($FleetRow['owner_userid'], 0, $message, sprintf($lang['fleet_9_tit'], $CurrentPlanet['name']), $lang['fleet_control'], 2);
        PM($FleetRow['target_userid'], 0, $message, sprintf($lang['fleet_9_tit'], $CurrentPlanet['name']), $lang['fleet_control'], 2);
    }
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:96,代码来源:MissionCaseDestroy.php

示例11: includeLang

includeLang('admin');
$parse = $lang;
//Server root?
$server_root = "/home/evo/public_html/new/";
// Supprimer les erreurs
extract($_GET);
if ($group == 1) {
    $query = doquery("SELECT error_page, error_text, COUNT(error_id) FROM {{table}} WHERE `error_type` = 'ANTI-CHEAT' GROUP BY error_page ;", 'errors');
    $parse['errors_list'] = "<tr>\r\n\t<th colspan=\"1\" style=\"border-width:1px;border-color:#888888;border-style:solid;width:25px;\">\r\n\t\tCount\r\n\t</th>\r\n\t<th colspan=\"4\" style=\"border-width:1px;border-color:#888888;border-style:solid;width:527px;\">\r\n\t\tError\r\n\t</th>\r\n</tr>";
    $parse['group_errors'] = '<a href="./?page=admin&link=errors&group=0">Ungroup Errors</a>';
    while ($u = mysql_fetch_array($query)) {
        $parse['errors_list'] .= "\r\n\t\t<tr>\r\n\t\t\t<td width=\"25\" style=\"border-width:1px;border-color:#888888;border-style:solid;\">" . $u['COUNT(error_id)'] . "</td>\r\n\t\t\t<td colspan=\"4\" style=\"border-width:1px;border-color:#888888;border-style:solid;\">" . str_replace($server_root, "./", $u['error_page']) . "</td>\r\n\t\t</tr>\r\n\t\t<tr><td colspan=\"5\" style=\"border-width:1px;border-color:#888888;border-style:solid;\">" . nl2br($u['error_text']) . "</td></tr>";
    }
} else {
    if (isset($delete)) {
        doquery("DELETE FROM {{table}} WHERE `error_id`='" . idstring($delete) . "'", 'errors');
    } elseif ($deleteall == 'yes') {
        doquery("TRUNCATE TABLE {{table}}", 'errors');
    }
    // Afficher les erreurs
    $sort = $_GET['sort'];
    if (strlen($sort) == 0) {
        $sort = "error_id";
    }
    if ($_GET['ord'] == 2) {
        $ord = "DESC";
        $parse['oth_ord'] = 1;
    } else {
        $ord = "ASC";
        $parse['oth_ord'] = 2;
    }
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:cheat.php

示例12: array

/**
* This file manages the output from the battle, it formats the cr, it makes the debris field, and then sends the fleets home.
* Here is the expected imput
	$results = array(
		[debrcry] => num
		[debrmet] => num
		[attlost] => num
		[deflost] => num
		[won]	 => char //(d)raw, (a)ttacker ,(v)defender
		[data] => array(
			[$roundno] => array(
				[attfires] => num
				[attpower] => num
				[attblock] => num
				[deffires] => num
				[defpower] => num
				[defblock] => num
				[attack_fleets] => array(
					[$fleetid] => array(
	either:				[$shiptype] => array('count' => num)
	or:					[$shiptype] => num
					)
				)
				[defend_fleets] => array(
					[$fleetid] => array(
	either:				[$shiptype] => array('count' => num)
	or:					[$shiptype] => num
					)
				)
			)
		)
	)
*/
function ManageCR($results, $CurrentPlanet)
{
    global $resource, $lang, $CombatCaps, $pricelist, $reslist;
    //The usual...
    $parse = $lang;
    //This will be poulated with planet and user data later.
    $fleets = array();
    $permafleets = array();
    //Loop through the rounds:
    $parse['rounds'] = '';
    foreach ($results['data'] as $roundno => $round) {
        $rparse = array();
        //List attackers and defenders fleets.
        $rparse['attackers'] = '';
        foreach ($round['attack_fleets'] as $id => $attacker) {
            //Lets get some info about this guy
            if ($roundno == 0) {
                $fleets[$id] = array();
                $fleets[$id]['side'] = 'a';
                if ($id > 0) {
                    $fleets[$id]['user'] = doquery("SELECT * FROM {{table}} WHERE `id` = (SELECT `owner_userid` FROM {{prefix}}fleets WHERE `fleet_id` = '" . idstring($id) . "') LIMIT 1 ;", 'users', true);
                } else {
                    $fleets[$id]['user'] = doquery("SELECT * FROM {{table}} WHERE `{{table}}`.`id` = '" . idstring($CurrentPlanet['id_owner']) . "' LIMIT 1 ;", 'users', true);
                }
            }
            $aparse = $lang;
            $aparse['td_types'] = '';
            $aparse['td_count'] = '';
            $aparse['td_weapons'] = '';
            $aparse['td_shields'] = '';
            $aparse['td_armour'] = '';
            $aparse['weap_pc'] = $fleets[$id]['user'][$resource[109]] * 10;
            $aparse['shield_pc'] = $fleets[$id]['user'][$resource[111]] * 10;
            $aparse['hull_pc'] = $fleets[$id]['user'][$resource[110]] * 10;
            $aparse['mode'] = 'attacker';
            $aparse['name'] = $lang['Attacker'] . " " . $fleets[$id]['user']['username'] . " <a>[" . $fleets[$id]['user']['galaxy'] . ":" . $fleets[$id]['user']['system'] . ":" . $fleets[$id]['user']['planet'] . "]</a>";
            foreach ($attacker as $id => $count) {
                if (is_array($count)) {
                    $count = $count['count'];
                }
                $aparse['td_types'] .= "\t\t\t\t\t\t\t\t\t\t<th class=\"textGrow\">" . $lang['cr_names'][$id] . "</th>\n";
                $aparse['td_count'] .= "\t\t\t\t\t\t\t\t\t\t<td>" . pretty_number($count) . "</td>\n";
                $aparse['td_weapons'] .= "\t\t\t\t\t\t\t\t\t\t<td>" . pretty_number($CombatCaps[$id]['attack']) . "</td>\n";
                $aparse['td_shields'] .= "\t\t\t\t\t\t\t\t\t\t<td>" . pretty_number($CombatCaps[$id]['shield']) . "</td>\n";
                $aparse['td_armour'] .= "\t\t\t\t\t\t\t\t\t\t<td>" . pretty_number($pricelist[$id]['metal'] + $pricelist[$id]['crystal']) . "</td>\n";
            }
            $rparse['attackers'] .= parsetemplate(gettemplate('fleet/combatattacker'), $aparse);
        }
        $rparse['defenders'] = '';
        foreach ($round['defend_fleets'] as $id => $defender) {
            //Lets get some info about this guy
            if ($roundno == 0) {
                $fleets[$id] = array();
                $fleets[$id]['side'] = 'd';
                if ($id > 0) {
                    $fleets[$id]['user'] = doquery("SELECT * FROM {{table}} WHERE `id` = (SELECT `owner_userid` FROM {{prefix}}fleets WHERE `fleet_id` = '" . idstring($id) . "') LIMIT 1 ;", 'users', true);
                } else {
                    $fleets[$id]['user'] = doquery("SELECT * FROM {{table}} WHERE `{{table}}`.`id` = '" . idstring($CurrentPlanet['id_owner']) . "' LIMIT 1 ;", 'users', true);
                }
            }
            $aparse = $lang;
            $aparse['td_types'] = '';
            $aparse['td_count'] = '';
            $aparse['td_weapons'] = '';
            $aparse['td_shields'] = '';
            $aparse['td_armour'] = '';
            $aparse['weap_pc'] = $fleets[$id]['user'][$resource[109]] * 10;
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ManageCR.php

示例13: ShowGalaxySelector

/**
 * ShowGalaxySelector.php
 *
 * @version 1.0
 * @copyright 2008 By Chlorel for XNova
 */
function ShowGalaxySelector($Galaxy, $System)
{
    global $lang;
    $Galaxy = idstring($Galaxy);
    $System = idstring($System);
    if ($Galaxy > MAX_GALAXY_IN_WORLD) {
        $Galaxy = MAX_GALAXY_IN_WORLD;
    }
    if ($Galaxy < 1) {
        $Galaxy = 1;
    }
    if ($System > MAX_SYSTEM_IN_GALAXY) {
        $System = MAX_SYSTEM_IN_GALAXY;
    }
    if ($System < 1) {
        $System = 1;
    }
    $parse = $lang;
    $parse['cur_gal'] = $Galaxy;
    $parse['cur_sys'] = $System;
    //Galaxy
    if ($Galaxy != 1) {
        $parse['agb'] = '<a href="#"
				onmouseover="image1.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_links-a.gif\';"
				onmouseout="image1.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_links.gif\';"
                onclick="loadpage(\'./?page=galaxy&mode=1&galaxy=' . ($Galaxy - 1) . '&system=' . $System . '\',document.title,\'galaxy\');">';
    } else {
        $parse['agb'] = '<a href="#"
                onmouseover="image1.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_links_inaktiv.gif\';"
                onmouseout="image1.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_links_inaktiv.gif\';">';
    }
    if ($Galaxy != MAX_GALAXY_IN_WORLD) {
        $parse['agn'] = '<a href="#"
				onmouseover="image2.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_rechts-a.gif\';"
				onmouseout="image2.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_rechts.gif\';"
                onclick="loadpage(\'./?page=galaxy&mode=1&galaxy=' . ($Galaxy + 1) . '&system=' . $System . '\',document.title,\'galaxy\');">';
    } else {
        $parse['agn'] = '<a href="#"
                onmouseover="image2.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_rechts_inaktiv.gif\';"
                onmouseout="image2.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_rechts_inaktiv.gif\';">';
    }
    //Now for system
    if ($System != 1) {
        $parse['asb'] = '<a href="#"
				onmouseover="image3.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_links-a.gif\';"
				onmouseout="image3.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_links.gif\';"
                onclick="loadpage(\'./?page=galaxy&mode=1&galaxy=' . $Galaxy . '&system=' . ($System - 1) . '\',document.title,\'galaxy\');">';
    } else {
        $parse['asb'] = '<a href="#"
                onmouseover="image3.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_links_inaktiv.gif\';"
                onmouseout="image3.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_links_inaktiv.gif\';">';
    }
    if ($System != MAX_SYSTEM_IN_WORLD) {
        $parse['asn'] = '<a href="#"
				onmouseover="image4.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_rechts-a.gif\';"
				onmouseout="image4.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_rechts.gif\';"
                onclick="loadpage(\'./?page=galaxy&mode=1&galaxy=' . $Galaxy . '&system=' . ($System + 1) . '\',document.title,\'galaxy\');">';
    } else {
        $parse['asn'] = '<a href="#"
                onmouseover="image4.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_rechts_inaktiv.gif\';"
                onmouseout="image4.src=\'' . GAME_SKIN . '/img/galaxy/pfeil_rechts_inaktiv.gif\';">';
    }
    return parsetemplate(gettemplate('galaxy/galaxy_head'), $parse);
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:70,代码来源:ShowGalaxySelector.php

示例14: doquery

 }
 // Si l'on verifiait que l'adresse email n'existe pas encore ???
 $ExistMail = doquery("SELECT `email` FROM {{table}} WHERE `email` = '" . mysql_escape_string($_POST['email']) . "' LIMIT 1;", 'users', true);
 if ($ExistMail) {
     $errorlist .= $lang['error_emailexist'];
     $errors++;
 }
 if ($_POST['avatar'] == '') {
     $avatar = "[X]";
 } else {
     $avatar = $_POST['avatar'];
 }
 if (preg_match("/[^A-z0-9]/", $_POST['ref_name']) == 1) {
     $errorlist .= $lang['bad_referal'];
 }
 $refid = idstring($_GET['refid']);
 $sec_qu = $_POST['sec_qu'];
 $sec_ans = $_POST['sec_ans'];
 if ($_POST['side'] == 'light') {
     $ally_id = "1";
     $ally_name = "Light";
 } else {
     $ally_id = "2";
     $ally_name = "Dark";
 }
 $ally_register_time = time();
 $ally_rank_id = 1;
 if ($errors != 0) {
     message($errorlist, $lang['Register']);
 } else {
     $newpass = $_POST['passwrd'];
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:reg.php

示例15: header

<?php

/**
 * fleetrecall.php
 *
 * @version 2.0
 * @copyright 2010 by MadnessRed for XNova Redesigned
 */
//Not really worth the file anymore, since its been moved to a function.
header('Content-Type: text/plain');
die(RecallFleet(idstring($_GET['fleet_id']), idstring($_GET['passkey']), $user['id']));
开发者ID:sonicmaster,项目名称:RPG,代码行数:11,代码来源:fleetrecall.php


注:本文中的idstring函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。