Exemplo n.º 1
0
$res = $db->query($getClassQuery);
//execute query
$ClassTableData = "['Class', 'Population'],";
while ($obj = $res->fetchObject()) {
    $HeroClass = HeroClass::loadHeroClass($obj->Class);
    $ClassTableData .= "['" . $HeroClass->Name . "', " . $obj->count . "],";
}
$ClassTableData = rtrim($ClassTableData, ",");
$smarty->assign("ClassTableData", $ClassTableData);
//get Race count
$getRaceQuery = "SELECT Race,COUNT(*) as count FROM Hero Where OwnerID <> 146 AND CurrentHP > 0 GROUP BY Race ORDER BY count DESC;";
$res = $db->query($getRaceQuery);
//execute query
$RaceTableData = "['Race', 'Population'],";
while ($obj = $res->fetchObject()) {
    $HeroRace = Race::loadRace($obj->Race);
    $RaceTableData .= "['" . $HeroRace->Name . "', " . $obj->count . "],";
}
$RaceTableData = rtrim($RaceTableData, ",");
$smarty->assign("RaceTableData", $RaceTableData);
//Get Level Count
$getLevelQuery = "SELECT Level,COUNT(*) as count FROM Hero Where OwnerID <> 146 AND CurrentHP > 0 GROUP BY Level ORDER BY Level ASC;";
$res = $db->query($getLevelQuery);
//execute query
$LevelTableData = "";
$i = 1;
$obj = $res->fetchObject();
while ($i <= 50) {
    if ($obj != false) {
        if ($obj->Level == $i) {
            $LevelTableData .= "[" . $obj->Level . ", " . $obj->count . "],";
Exemplo n.º 2
0
 function GenerateRace()
 {
     //This is pretty terrible but it matches the DB for now
     $human = Race::loadRace(1);
     $dwarf = Race::loadRace(2);
     $elf = Race::loadRace(3);
     $halfling = Race::loadRace(4);
     $races = array($human, $dwarf, $elf, $halfling);
     $newRace = $races[rand(0, 3)];
     return $newRace;
 }
Exemplo n.º 3
0
 function GenerateRace()
 {
     //@TODO:Load all StarterRaces from race table and pick a random one.
     $human = Race::loadRace(1);
     $dwarf = Race::loadRace(2);
     $elf = Race::loadRace(3);
     $halfling = Race::loadRace(4);
     $races = array($human, $human, $dwarf, $elf, $halfling);
     $newRace = $races[rand(0, 4)];
     return $newRace;
 }