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; } } ?> }; };