Skip to content

Instantly share code, notes, and snippets.

@barncastle
Last active April 25, 2018 15:31
Show Gist options
  • Save barncastle/eef0782aa7469f33996bf4cd98ecd46f to your computer and use it in GitHub Desktop.
Save barncastle/eef0782aa7469f33996bf4cd98ecd46f to your computer and use it in GitHub Desktop.
const int CHARACTER_POINTS_PER_LEVEL[2] = { 10, 1 };
const int CHARACTER_POINTS_PER_BONUS[2] = { 0, 1 };
const int LEVELS_PER_CHARACTER_POINT_BONUS[2] = { 1, 5 };
const int CHARACTER_POINT_LEVEL_THRESHOLDS[2] = { 10, 1 };
const int CHARACTER_POINT_BONUS_PER_THRESHOLD[2] = { 5, 0 };
CGPlayer_C player = ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer());
if ( player )
{
bool ishuman = player->m_unit->race == 1;
int newlevel = result; // packet[0]
for(int i = 0; i < 2; i++) // 0 = Talent Points, 1 = Skill Points
{
player->characterPoints[i] += CHARACTER_POINTS_PER_LEVEL[i];
if ( ishuman && (newlevel % LEVELS_PER_CHARACTER_POINT_BONUS[i]) == 0 )
player->characterPoints[i] += CHARACTER_POINTS_PER_BONUS[i];
bonuspoints = CHARACTER_POINT_BONUS_PER_THRESHOLD[i];
if ( bonuspoints )
player->characterPoints[i] += bonuspoints * (newlevel / CHARACTER_POINT_LEVEL_THRESHOLDS[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment