Exemplo n.º 1
0
 private function __construct()
 {
     $data = DataTable::constructFromCsvFile(new CsvFile('data/updates.csv'))->get();
     foreach ($data as $row) {
         $year = $row['year'];
         $month = $row['month'];
         $day = $row['day'];
         $version = $year . '-' . $month . '-' . $day;
         $change = $row['change'];
         if (!isset($this->updates[$version])) {
             $update = new Update($year, $month, $day);
             $this->updates[$version] = $update;
             $this->latest_version = $update->getVersion();
         }
         $this->updates[$version]->addChange($change);
     }
 }
Exemplo n.º 2
0
function artifactOptionList($type)
{
    $artifacts_data = DataTable::constructFromCsvFile(new CsvFile('data/artifacts.csv'));
    $sets = array("dwarf" => "trpaslík", "elf" => "elf", "knight" => "rytíř", "legionnaire" => "legionář", "mage" => "mág", "necromant" => "nekromant", "orc" => "skřet", "royal" => "královský set", "dark elf" => "dark elf", "squire" => "zbrojnoš");
    $artifacts = $artifacts_data->get(array('type' => $type));
    foreach ($artifacts as $artifact_array) {
        $artifact = Artifact::constructFromArray($artifact_array);
        ?>
<option value="<?php 
        echo $artifact->getId();
        ?>
"><?php 
        echo $artifact->getName();
        echo !empty($sets[$artifact->getSet()]) ? " (" . $sets[$artifact->getSet()] . ")" : "";
        ?>
</option>
    <?php 
    }
}
Exemplo n.º 3
0
	var A = function(ab, db, a, d, sp, md, es, s, t, des, ef, set) {
		this.attack_bonus = ab;
		this.defence_bonus = db;
		this.attack = a;
		this.defence = d;
		this.spell_power = sp;
		this.magical_defence = md;
		this.escape = es;
		this.survival = s;
		this.thieving = t;
		this.destruction = des;
		this.efficiency = ef;
		this.set = set;
	};

	this['nothing'] = new A(0,0,0,0,0,0,0,0,0,0,0,'');
<?php 
$artifacts_data = DataTable::constructFromCsvFile(new CsvFile('data/artifacts.csv'));
foreach (ArtifactType::values() as $artifact_type) {
    $artifacts = $artifacts_data->get(array('type' => $artifact_type));
    foreach ($artifacts as $artifact_array) {
        $artifact = Artifact::constructFromArray($artifact_array);
        echo "\t" . 'this[\'' . $artifact->getId() . '\'] = new A(' . $artifact->getAttack_bonus() . ',' . $artifact->getDefence_bonus() . ',' . $artifact->getAttack() . ',' . $artifact->getDefence() . ',' . $artifact->getSpell_power() . ',' . $artifact->getMagical_defence() . ',' . $artifact->getEscape() . ',' . $artifact->getSurvival() . ',' . $artifact->getThieving() . ',' . $artifact->getDestruction() . ',' . $artifact->getEfficiency() . ',' . '\'' . $artifact->getSet() . '\');' . PHP_EOL;
    }
}
?>
};

};