3 namespace Domain\VOs\StepMania
;
5 use Domain\Exception\InvalidDifficultyException
;
7 class Difficulty
implements IDifficulty
9 protected $stepManiaName;
12 //XXX: Common names used in simfiles. We'll map them to standard names.
13 //Taken from https://github.com/openitg/openitg/blob/master/src/Difficulty.cpp
14 private $_namesToSmNames = array(
15 "Beginner" => 'Beginner',
20 "Another" => 'Medium',
22 "Standard" => 'Medium',
23 "Difficult" => 'Medium',
28 "Smaniac" => 'Challenge',
29 "Challenge" => 'Challenge',
30 "Expert" => 'Challenge',
35 private $_smNamesToItgNames = array(
36 'Beginner' => 'Novice',
40 'Challenge' => 'Expert',
44 public function __construct($name) {
45 $ucName = ucfirst(strtolower($name));
46 if(array_key_exists($ucName, $this->_namesToSmNames
)) {
47 $this->stepManiaName
= $this->_namesToSmNames
[$ucName];
48 $this->itgName
= $this->_smNamesToItgNames
[$this->stepManiaName
];
50 throw new InvalidDifficultyException(sprintf('Invalid difficulty: %s', $name));
54 public function getITGName() {
55 return $this->itgName
;
58 public function getStepManiaName() {
59 return $this->stepManiaName
;