Here is the enumerated list of medals from the OP API
enum eMedals
{
kNoMedals = ( 0 << 0 ),
kMedalRankOne = ( 1 << 0 ),
kMedalRankTwo = ( 1 << 1 ),
kMedalRankThree = ( 1 << 2 ),
kMedalRankFour = ( 1 << 3 ),
kMedalRankFive = ( 1 << 4 ),
kMedalMissionOne = ( 1 << 5 ),
kMedalMissionTwo = ( 1 << 6 ),
kMedalMissionThree = ( 1 << 7 ),
kMedalMissionFour = ( 1 << 8 ),
kMedalSpecialOne = ( 1 << 9 ),
kMedalSpecialTwo = ( 1 << 10 ),
kMedalSpecialThree = ( 1 << 11 ),
kMedalSpecialFour = ( 1 << 12 )
};
As you can see, ranks, missions and special mission medals are all stored in the same place.
Combinations of the above are of course possible, so that if a character has a medal with a bit flag of a value of 128, a rank with a bit value of 1 (which is ceratinly possible as can be seen from above), then in the database, the decinal that is stored there will be 129 (128 + 1).
The value 1 << 3, for example is the value 1 bit wise shifted 3 places to the left.
So, in binary we have 0001, which is then bitwise shifted 3 places to become 0100. In decimal, these vaues are 1 and 8 respectively.
Now suppose we have a character that has a rank of captain, and has earned a medal for mission one. The value stored then will look like 0001 0010. The first 1 denotes the mission medal, and the second 1 denotes the character's ramk. These are called bit flags. The decimal value would be 18.