Code:
public int getPlayerItemLevel(Player player)
{
float AIL = 0;
String MainStat;
if(player.class == Class.healer())
{
MainStat = "Mind";
AIL = calculateItemLevel(player, MainStat);
AIL *= SomeNormalizationConstant;
/*The normalization constant would probably be picked such that the current numbers
*wouldn't change much around some number*/
}
else if(player.class == Class.DPS())
{
if(player.class.job == Class.Job.MNK() || player.class.job == Class.Job.DRG())
{
MainStat = "Strength"; // more realistically this would just be an integer.
AIL = calculateItemLevel(player, MainStat);
AIL *= SomeNormalizationConstant;
}
else if (player.class.job == Class.Job.BRD() || player.class.job == Class.Job.NIN())
{
MainStat = "Dexterity";
AIL = calculateItemLevel(player, MainStat);
AIL *= SomeNormalizationConstant;
}
else if (player.class.job == Class.Job.BLM() || player.class.job == Class.Job.SMN())
{
MainStat = "Dexterity";
AIL = calculateItemLevel(player, MainStat);
AIL *= SomeNormalizationConstant;
}
}
else if(player.class == Class.tank())
{
MainStat = "Vitality";
AIL = calculateItemLevel(player, MainStat);
AIL *= SomeOtherNormalizationConstant;
/*The normalization constant would probably be picked such that the current numbers
*wouldn't change much around some number, which would differ for tanks
*since VIT numbers are a bit higher*/
}
return AIL;
}
public int calculateItemLevel(Player player, String mainStat)
{
int AIL = 0;
//Where player.gear[i] from 0 to 10 represents the 11 gear slots
for(int i = 0; i<11; i++)
AIL += player.gear[i].getAttribute(Mainstat);
AIL += player.weapon.getAttribute(Mainstat);
AIL *= (0.1 + player.weapon.WD()*.0032);
AIL += player.weapon.WD()*.4162;
return AIL;
}