Code:
private uint GetCurrentPower(WoWPowerType power)
{
switch (power)
{
case WoWPowerType.Health:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_HEALTH);
case WoWPowerType.Mana:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_POWER1);
case WoWPowerType.Rage:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_POWER2);
case WoWPowerType.Energy:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_POWER3);
case WoWPowerType.Focus:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_POWER4);
case WoWPowerType.Happiness:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_POWER5);
//case WoWPowerType.Runes: // TODO: What the hell is this one?
// return GetStorageField<uint>(UnitFields.UNIT_FIELD_POWER6);
case WoWPowerType.RunicPower:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_POWER7);
default:
throw new ArgumentOutOfRangeException("power");
}
}
private uint GetMaxPower(WoWPowerType power)
{
switch (power)
{
case WoWPowerType.Health:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_MAXHEALTH);
case WoWPowerType.Mana:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_MAXPOWER1);
case WoWPowerType.Rage:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_MAXPOWER2);
case WoWPowerType.Energy:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_MAXPOWER3);
case WoWPowerType.Focus:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_MAXPOWER4);
case WoWPowerType.Happiness:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_MAXPOWER5);
//case WoWPowerType.Runes: // TODO: What the hell is this one?
// return GetStorageField<uint>(UnitFields.UNIT_FIELD_MAXPOWER6);
case WoWPowerType.RunicPower:
return GetStorageField<uint>(UnitFields.UNIT_FIELD_MAXPOWER7);
default:
throw new ArgumentOutOfRangeException("power");
}
}