示例#1
0
function get_unit_power($race)
{
    global $unit_offence, $unit_defence;
    // Reducing redundancy, as you can see, it is still awfully ugly,
    //         so just don't use this function - AI 10/02/2007
    require_once 'inc/races/clsRace.php';
    $objRace = clsRace::getRace($race);
    $unit_offence = array_merge(array(''), $objRace->getUnitOffences(), array(''));
    $unit_defence = array_merge(array(''), $objRace->getUnitDefences(), array(''));
    $unit_offence = implode("|", $unit_offence);
    $unit_defence = implode("|", $unit_defence);
    $total = array("offence" => $unit_offence, "defence" => $unit_defence);
    return $total;
}
示例#2
0
function include_test_text()
{
    require_once 'inc/races/clsRace.php';
    $objUruk = clsRace::getRace('Uruk Hai');
    test_race($objUruk);
    test_race(clsRace::getRace('Oleg Hai'));
    test_race(clsRace::getRace('Mori Hai'));
    test_race(clsRace::getRace('Dark Elf'));
    test_race(clsRace::getRace('Wood Elf'));
    test_race(clsRace::getRace('High Elf'));
    test_race(clsRace::getRace('Dwarf'));
    test_race(clsRace::getRace('Viking'));
    test_race(clsRace::getRace('Brittonian'));
    test_race(clsRace::getRace('Raven'));
    test_race(clsRace::getRace('Dragon'));
    test_race(clsRace::getRace('Eagle'));
    test_race(clsRace::getRace('Nazgul'));
    test_race(clsRace::getRace('Undead'));
    test_race(clsRace::getRace('Spirit'));
}
示例#3
0
function getUnitVariables($strRace)
{
    /*
    
    ****************** same here, use the objects ***************
        switch ($strRace) 
        {
    case "Uruk Hai":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);            
        $arrUnitNames     = array(1 => 'Citizen', 'Gnome', 'Brute', 'Shaman', 
        'Half-Giant', 'Black Guard');
        $arrUnitCost      = array(2 => 50, 500, 625, 1360, 550);
        $arrUnitOffence   = array(2 => 0, 7, 0, 16, 0);
        $arrUnitDefence   = array(2 => 0, 2, 6, 1, 0);
        
    break;
    case "Oleg Hai":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Gnome', 'Wolfrider', 
        'White Skull', 'Harpie', 'Thief');
        $arrUnitCost      = array(2 => 50, 550, 700, 80, 440);
        $arrUnitOffence   = array(2 => 0, 7, 0, 4, 0);
        $arrUnitDefence   = array(2 => 1, 0, 6, 1, 0);
        
    break;
    case "Mori Hai":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Gnome', 'Goblin', 
        'Axethrower', 'Ogre', 'Assassin');
        $arrUnitCost      = array(2 => 60, 300, 425, 650, 800);
        $arrUnitOffence   = array(2 => 0, 3, 0, 4, 6);
        $arrUnitDefence   = array(2 => 0, 0, 4, 5, 0);
        
    break;
    case "Dark Elf":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Slinger', 'Nightstalker', 
        'Sorcerer', 'Nightrider', 'Assassin');
        $arrUnitCost      = array(2 => 50, 200, 350, 810, 330);
        $arrUnitOffence   = array(2 => 0, 2, 0, 3, 0);
        $arrUnitDefence   = array(2 => 1, 0, 4, 7, 0);
        
    break;
    case "Wood Elf":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Slinger', 'Woodrider', 
        'Druid', 'Tree Ent', 'Grassrunner');
        $arrUnitCost      = array(2 => 20, 440, 330, 1400, 300);
        $arrUnitOffence   = array(2 => 0, 4, 0, 0, 0);
        $arrUnitDefence   = array(2 => 0, 0, 4, 9, 0);
        
    break;
    case "High Elf":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Slinger', 'Sage', 
        'Longbowmen', 'Priestess', 'Rogue');
        $arrUnitCost      = array(2 => 85, 700, 820, 350, 275);
        $arrUnitOffence   = array(2 => 0, 6, 0, 3, 0);
        $arrUnitDefence   = array(2 => 0, 0, 6, 3, 0);
        
    break;
    case "Dwarf":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Grunt', 'Hammer Smasher', 
        'Stone Thrower', 'Grey Beard', 'Short Cloak');
        $arrUnitCost      = array(2 => 60, 520, 350, 660, 350);
        $arrUnitOffence   = array(2 => 0, 6, 0, 4, 0);
        $arrUnitDefence   = array(2 => 1, 1, 4, 6, 0);
        
    break;
    case "Viking":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Soldier', 'Swordmen', 
        'Archer', 'Berserker', 'Looter');
        $arrUnitCost      = array(2 => 120, 180, 530, 850, 330);
        $arrUnitOffence   = array(2 => 1, 3, 2, 8, 0);
        $arrUnitDefence   = array(2 => 1, 1, 6, 6, 0);
        
    break;
    case "Brittonian":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Soldier', 'Pikemen', 
        'Crossbowmen', 'Knight', 'Rogue');
        $arrUnitCost      = array(2 => 100, 200, 900, 500, 500);
        $arrUnitOffence   = array(2 => 1, 2, 0, 3, 0);
        $arrUnitDefence   = array(2 => 0, 0, 4, 1, 0);
        
    break;
    case "Raven":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Nester', 'Blackclaw', 
        'Razorwing', 'Blackwing', 'Screecher');
        $arrUnitCost      = array(2 => 10, 150, 700, 800, 350);
        $arrUnitOffence   = array(2 => 0, 2, 0, 5, 0);
        $arrUnitDefence   = array(2 => 0, 0, 5, 5, 0);
        
    break;
    case "Dragon":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Baby Dragon', 'Green Dragon', 
        'Yellow Dragon', 'Red Dragon', 'White Dragon');
        $arrUnitCost      = array(2 => 50, 550, 800, 1350, 440);
        $arrUnitOffence   = array(2 => 1, 25, 0, 50, 0);
        $arrUnitDefence   = array(2 => 1, 0, 32, 15, 0);
        
    break;
    case "Eagle":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Nester', 'Emesen', 'Vendo', 
        'Anekonian', 'Razorbeak');
        $arrUnitCost      = array(2 => 35, 10, 380, 1200, 300);
        $arrUnitOffence   = array(2 => 0, 1, 0, 2, 0);
        $arrUnitDefence   = array(2 => 0, 0, 4, 8, 0);
        
    break;
    case "Nazgul":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Mortal', 'Blackrider', 
        'Bloodpet', 'Wraith', 'Gollum');
        $arrUnitCost      = array(2 => 40, 666, 666, 1375, 660);
        $arrUnitOffence   = array(2 => 0, 2, 0, 9, 0);
        $arrUnitDefence   = array(2 => 0, 0, 2, 9, 0);
        
    break;
    case "Undead":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Skeleton', 'Zombie', 
        'Mummy', 'Vampire', 'Imp');
        $arrUnitCost      = array(2 => 120, 700, 400, 1130, 460);
        $arrUnitOffence   = array(2 => 0, 7, 0, 7, 0);
        $arrUnitDefence   = array(2 => 0, 0, 4, 9, 0);
        
    break;
    case "Spirit":
        
        $arrUnitVariables = array(1 => CITIZEN, UNIT1, UNIT2, UNIT3, UNIT4, 
        UNIT5);        
        $arrUnitNames     = array(1 => 'Citizen', 'Ghost', 'Phantom', 
        'Poltergeist', 'Ghoul', 'Apparition');
        $arrUnitCost      = array(2 => 50, 250, 810, 600, 275);
        $arrUnitOffence   = array(2 => 0, 2, 2, 6, 0);
        $arrUnitDefence   = array(2 => 0, 0, 7, 3, 0);
        
    break;
    default:
    */
    $objRace = clsRace::getRace($strRace);
    $arrUnitVariables = $objRace->getUnitVariables();
    $arrUnitNames = $objRace->getUnitNames();
    $arrUnitCost = $objRace->getUnitCosts();
    $arrUnitOffence = $objRace->getUnitOffences();
    $arrUnitDefence = $objRace->getUnitDefences();
    /*
        break;
    }
    */
    $arrUnits['variables'] = $arrUnitVariables;
    $arrUnits['output'] = $arrUnitNames;
    $arrUnits['gold'] = $arrUnitCost;
    $arrUnits['offence'] = $arrUnitOffence;
    $arrUnits['defence'] = $arrUnitDefence;
    return $arrUnits;
}
示例#4
0
function include_uberdev_text()
{
    global $building_count, $building_output, $building_variables;
    if ($_SERVER['SERVER_NAME'] != DEV_SERVER_NAME) {
        echo "EVIL!!!! HOW DID YOU GET HERE?!";
        include_game_down();
        exit;
    }
    $objSrcUser =& $GLOBALS['objSrcUser'];
    $userid = $objSrcUser->get_userid();
    // if stuff is posted, do that first
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        if (!array_empty($_POST['building'])) {
            var_dump($_POST['building']);
            //debug
            foreach ($_POST['building'] as $strToBuild => $strNumber) {
                if ($strNumber == '') {
                    continue;
                }
                if (get_magic_quotes_gpc()) {
                    $strToBuild = stripslashes($strToBuild);
                    $strNumber = stripslashes($strNumber);
                }
                $strToBuild = mysql_real_escape_string($strToBuild);
                $strNumber = mysql_real_escape_string($strNumber);
                //print("<br />" . "UPDATE build SET $strToBuild = $strNumber WHERE id = $userid" . "<br />"); //debug
                var_dump(mysql_query("UPDATE build SET {$strToBuild} = {$strNumber} WHERE id = {$userid}"));
                echo '<br />' . mysql_error();
            }
        }
        if (!array_empty($_POST['population'])) {
            var_dump($_POST['population']);
            //debug
            foreach ($_POST['population'] as $strToTrain => $strNumber) {
                if ($strNumber == '') {
                    continue;
                }
                if (get_magic_quotes_gpc()) {
                    $strToTrain = stripslashes($strToTrain);
                    $strNumber = stripslashes($strNumber);
                }
                $strToTrain = mysql_real_escape_string($strToTrain);
                $strNumber = mysql_real_escape_string($strNumber);
                if ($strToTrain == "citizen") {
                    $objSrcUser->set_pop(CITIZENS, $strNumber);
                    print "<br />true";
                } else {
                    //print("<br />" . "UPDATE army SET $strToTrain = $strNumber WHERE id = $userid" . "<br />"); //debug
                    var_dump(mysql_query("UPDATE army SET {$strToTrain} = {$strNumber} WHERE id = {$userid}"));
                    echo '<br />' . mysql_error();
                }
            }
        }
        if (!empty($_POST['SQL'])) {
            $strSQL = $_POST['SQL'];
            if (get_magic_quotes_gpc()) {
                $strSQL = stripslashes($strSQL);
            }
            var_dump($strSQL);
            //debug
            $res = mysql_query($strSQL);
            if (!$res) {
                echo '<br />' . mysql_error();
            } elseif ($res === true) {
                echo '<br />Success! ' . mysql_affected_rows() . ' rows updated.';
            } else {
                $rows = mysql_num_rows($res);
                echo "{$rows} rows returned<br />";
                if ($rows) {
                    echo "<table class='medium'><tr class='subheader'>";
                    $line = mysql_fetch_assoc($res);
                    foreach (array_keys($line) as $label) {
                        echo "<th>{$label}</th>";
                    }
                    echo "</tr>";
                    do {
                        echo "<tr class='data'>";
                        foreach ($line as $item) {
                            echo '<td>' . $item . '</td>';
                        }
                        echo '</tr>';
                    } while ($line = mysql_fetch_assoc($res));
                    echo '</table>';
                }
            }
        }
    }
    //now for the actual form
    ?>
<form action="<? echo $_SERVER['REQUEST_URI']; ?>" method="post">
    <table class="medium">
        <tr class="header">
            <th>Data</th>
            <th class="right">Value</th>
        </tr>
<?php 
    $objUser =& $GLOBALS["objSrcUser"];
    $arrSrcStats = $objUser->get_stats();
    $level = $arrSrcStats['level'];
    if ($level >= 5) {
        ?>
        <tr class="subheader">
            <th>raw SQL</th>
        </tr>
        <tr class="data">
            <th>SQL</th>
            <td><input type="text" name="SQL" size="50" /></td>
        </tr>
<?php 
    }
    ?>
        <tr class="subheader">
            <th>Buildings</th>
        </tr>
        <tr class="data">
            <th>Total acres</th>
            <td><input type="text" name="building[land]" /></td>
        </tr>

<?php 
    include_once "inc/functions/build.php";
    $arrBuild = $objSrcUser->get_builds();
    $arrStat = $objSrcUser->get_stats();
    //mysql_grab($userid, 'local', 'goods', 'build', 'pop');
    build_cost();
    building_names();
    //general_build();
    for ($i = 1; $i <= $building_count; $i++) {
        echo "<tr class=\"data\">" . "<th>{$building_output[$i]}</th>" . "<td><input type=\"text\" name=\"building[{$building_variables[$i]}]\" /></td>" . "</tr>";
    }
    ?>
        <tr class="subheader">
            <th>Population</th>
        </tr>
<?php 
    $objRace = clsRace::getRace($objSrcUser->get_stat(RACE));
    $arrUnitVar = $objRace->getUnitVariables();
    $arrUnitNames = $objRace->getUnitNames();
    for ($i = 1; $i < 7; $i++) {
        echo "<tr class=\"data\">" . "<th>{$arrUnitNames[$i]}</th>" . "<td><input type=\"text\" name=\"population[{$arrUnitVar[$i]}]\" /></td>" . "</tr>";
    }
    ?>
    </table>
    <input type="submit" value="do crazy stuff" />
</form>
<?php 
}
示例#5
0
function military_cost($race)
{
    global $unit_var, $unit_names, $gold_unit;
    // 10/02/2007 AI
    //    Retrofitting this function to use clsRace
    require_once 'inc/races/clsRace.php';
    $objRace = clsRace::getRace($race);
    $gold_unit = $objRace->getUnitCosts();
    $gold_unit = array_merge(array(''), $gold_unit);
    // ---------------------------------------------------------
    //
    // 19/02/2006 es: race changes
    //
    //    Set the numbers to match the manual (age 23).
    //    Changed dwarves, vikings, undeads, ravens as age changed required
    //
    // 15/04/2002 thalura     race changes for round x
    //
    //    Dark Elves elites cost 500 (instead of 450)
    //    Wood Elves defspecs 0/2 (instead of 0/4) and cost 250 (instead of 425)
    //    High Elves homes +50 people, elites 1/2 (instead of 0/2)
    //    Harpies - defspecs 0/4, cost 500, thieves cost 600, suffers double losses when attacking
    //    Spirit thieves cost 450
    //    Mori Hai +5% homes (instead of +10%), defspecs cost 300 (instead of 150)
    //
}
示例#6
0
function get_unit_names($i_strRace)
{
    $unit_names = "";
    //switch to using clsRace - AI 10/02/2007
    $unit_var = "citizen|unit1|unit2|unit3|unit4|unit5";
    $unit_var = explode("|", $unit_var);
    require_once 'inc/races/clsRace.php';
    $objRace = clsRace::getRace($i_strRace);
    $unit_names = $objRace->getUnitNames();
    return array($unit_var, $unit_names);
}
示例#7
0
 function get_race()
 {
     if (empty($this->_objRace)) {
         $strRace = $this->get_stat(RACE);
         require_once "inc/races/clsRace.php";
         $_objRace = clsRace::getRace($strRace);
     }
     return $_objRace;
 }