34e0309dca428b0dc212bc1ba4a2f95fb604ce05
[rock.divinelegy.git] / Domain / VOs / StepMania / DanceMode.php
1 <?php
2
3 namespace Domain\VOs\StepMania;
4
5 use Domain\Exception\InvalidDanceModeException;
6
7 class DanceMode implements IDanceMode
8 {
9 protected $stepManiaName;
10 protected $prettyName;
11
12 //XXX: Known step types, taken from https://github.com/stepmania/stepmania/blob/master/src/GameManager.cpp
13 private $_nameMap = array(
14 'dance-single' => 'Single',
15 'dance-double' => 'Double',
16 'dance-couple' => 'Couple',
17 'dance-solo' => 'Solo',
18 'dance-threepanel' => 'Three Panel',
19 'dance-routine' => 'Routine',
20 'pump-single' => 'Single',
21 'pump-double' => 'Double',
22 'pump-couple' => 'Couple',
23 'pump-halfdouble' => 'Half Double',
24 'pump-routine' => 'Routine',
25 'kb7-single' => 'Single',
26 'ez2-single' => 'Single',
27 'ez2-double' => 'Double',
28 'ez2-real' => 'Real',
29 'para-single' => 'Single',
30 'para-versus' => 'Versus', //Not in the list but I have seen it in files
31 'ds3ddx-single' => 'Single',
32 'bm-single' => 'Single', //Not in the list but I have seen it in files
33 'bm-single5' => 'Single 5 Key',
34 'bm-single7' => 'Single 7 Key',
35 'bm-double' => 'Double', //Not in the list, and I haven't seen it, but I feel like it must exist lol
36 'bm-double5' => 'Double 5 Key',
37 'bm-double7' => 'Double 7 Key',
38 'bm-versus5' => 'Versus 5 Key',
39 'bm-versus7' => 'Versus 7 Key',
40 //Seems like bm may have been called iidx or was changed to iidx at some point so...
41 'iidx-single' => 'Single', //Not in the list but I have seen it in files
42 'iidx-single5' => 'Single 5 Key',
43 'iidx-single7' => 'Single 7 Key',
44 'iidx-double' => 'Double', //Not in the list, and I haven't seen it, but I feel like it must exist lol
45 'iidx-double5' => 'Double 5 Key',
46 'iidx-double7' => 'Double 7 Key',
47 'iidx-versus5' => 'Versus 5 Key',
48 'iidx-versus7' => 'Versus 7 Key',
49 'maniax-single' => 'Single',
50 'maniax-double' => 'Double',
51 'techno-single4' => 'Single 4 Panel',
52 'techno-single5' => 'Single 5 Panel',
53 'techno-single8' => 'Single 8 Panel',
54 'techno-double4' => 'Double 4 Panel',
55 'techno-double5' => 'Double 5 Panel',
56 'techno-double8' => 'Double 8 Panel',
57 'pnm-five' => 'Five Key',
58 'pnm-nine' => 'Nine Key',
59 'lights-cabinet' => 'Cabinet Lights'
60 );
61
62 private $_smGameNameToNiceName = array(
63 'dance' => 'In The Groove',
64 'pump' => 'Pump It Up',
65 'ez2' => 'EZ2Dancer',
66 'para' => 'ParaParaParadise',
67 'bm' => 'Beatmania',
68 'iidx' => 'Beatmania',
69 'maniax' => 'Dance Maniax',
70 'techno' => 'TechnoMotion',
71 'pnm' => 'Pop\'n Music',
72 'ds3ddx' => 'Dance Station 3DDX',
73 'kb7' => 'Keybeat',
74 'lights' => false
75 );
76
77 public function __construct($stepManiaName)
78 {
79 if(array_key_exists($stepManiaName, $this->_nameMap)) {
80 $this->stepManiaName = $stepManiaName;
81 $this->prettyName = $this->_nameMap[$stepManiaName];
82 } else {
83 throw new InvalidDanceModeException(sprintf('Invalid dance mode %s', $stepManiaName));
84 }
85 }
86
87 public function getStepManiaName()
88 {
89 return $this->stepManiaName;
90 }
91
92 public function getPrettyName()
93 {
94 return $this->prettyName;
95 }
96
97 public function getGame()
98 {
99 $game = explode('-', $this->stepManiaName)[0];
100 return $this->_smGameNameToNiceName[$game];
101 }
102 }