Replaced Pairtwo Title Values for generic Values

This commit is contained in:
Jeroen De Meerleer 2019-03-19 16:30:59 +01:00
parent 7b6962843c
commit e0da8a71cd
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 56 additions and 14 deletions

View File

@ -12,17 +12,17 @@ use MyCLabs\Enum\Enum;
class Title extends Enum class Title extends Enum
{ {
const NONE = 0; const NONE = '*';
const ELO = 1; const ELO = 'Elo';
const NM = 2; // National Master const NM = 'National Master';
const WCM = 3; // Woman Candidate Master const WCM = 'Woman Candidate Master';
const WFM = 4; // Women Fide Master const WFM = 'Woman Fide Master';
const CM = 5; // Candidate Master const CM = 'Candidate Master';
const WIM = 6; // Woman International Master const WIM = 'Woman International Master';
const FM = 7; // Fide Master const FM = 'Fide Master';
const WGM = 8; // Woman Grand Master const WGM = 'Woman Grand Master';
const HM = 9; // Honorary International master const HM = 'Honorary International Master';
const IM = 10; // International Master const IM = 'International Master';
const HG = 11; // Honorary Grand Master const HG = 'Honorary Grand Master';
const GM = 12; // Grand Master const GM = 'Grand Master';
} }

View File

@ -299,7 +299,49 @@ class Sws extends SwsModel
$offset += $length; $offset += $length;
$length = 1; $length = 1;
$player->setTitle(new Title(self::ReadData('Int', substr($swscontents, $offset, $length)))); switch (self::ReadData('Int', substr($swscontents, $offset, $length))) {
case 1:
$title = Title::ELO;
break;
case 2:
$title = Title::NM;
break;
case 3:
$title = Title::WCM;
break;
case 4:
$title = Title::WFM;
break;
case 5:
$title = Title::CM;
break;
case 6:
$title = Title::WIM;
break;
case 7:
$title = Title::FM;
break;
case 8:
$title = Title::WGM;
break;
case 9:
$title = Title::HM;
break;
case 10:
$title = Title::IM;
break;
case 11:
$title = Title::HG;
break;
case 12:
$title = Title::GM;
break;
case 0:
default:
$title = Title::NONE;
break;
}
$player->setTitle(new Title($title));
$offset += $length; $offset += $length;
$length = 1; $length = 1;