Replaced Pairtwo Title Values for generic Values

This commit is contained in:
Jeroen De Meerleer 2019-03-19 16:30:59 +01:00
parent bbff18e64f
commit 34f0e592df
2 changed files with 56 additions and 14 deletions

View File

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

View File

@ -299,7 +299,49 @@ class Sws extends SwsModel
$offset += $length;
$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;
$length = 1;