rendered paste bodyIndex: pscharacter.cpp===================================================================--- pscharacter.cpp (revision 557)+++ pscharacter.cpp (working copy)@@ -3354,16 +3354,110 @@ inventory.CalculateLimits(); } -unsigned int psCharacter::GetCharLevel()+unsigned int SkillSet::GetBestSkillValue() {+ unsigned int max=0;+ for (int i=0; i<PSSKILL_COUNT; i++)+ {+ PSSKILL skill = skills[i].info->id;+ if( skill == PSSKILL_AGI ||+ skill == PSSKILL_CHA ||+ skill == PSSKILL_END ||+ skill == PSSKILL_INT ||+ skill == PSSKILL_WILL ||+ skill == PSSKILL_STR )+ continue; // Jump past the stats, we only want the skills++ unsigned int rank = skills[i].rank;+ if (rank > max)+ max = rank;+ }+ return max;+}++unsigned int SkillSet::GetBestMagicSkillValue()+{+ unsigned int max=0;+ for (int i=0; i<PSSKILL_COUNT; i++)+ {+ PSSKILL skill = skills[i].info->id;+ if( skill != PSSKILL_CRYSTALWAY ||+ skill != PSSKILL_BLUEWAY ||+ skill != PSSKILL_AZUREWAY ||+ skill != PSSKILL_DARKWAY ||+ skill != PSSKILL_REDWAY ||+ skill != PSSKILL_BROWNWAY )+ continue; // We only need the highest magic skill.++ unsigned int rank = skills[i].rank;+ if (rank > max)+ max = rank;+ }+ return max;+}++unsigned int SkillSet::GetBestCombatSkillValue()+{+ unsigned int max=0;+ for (int i=0; i<PSSKILL_COUNT; i++)+ {+ PSSKILL skill = skills[i].info->id;+ if( skill != PSSKILL_SWORD ||+ skill != PSSKILL_AXE+ // skill != PSSKILL_DAGGER ||+ // skill != PSSKILL_KNIFE + )+ continue; // We only need the highest combat skill.++ unsigned int rank = skills[i].rank;+ if (rank > max)+ max = rank;+ }+ return max;+}++unsigned int SkillSet::GetBestSkillSlot( bool withBuffer )+{+ unsigned int max = 0;+ unsigned int i = 0;+ for (; i<PSSKILL_COUNT; i++)+ {+ unsigned int rank = skills[i].rank + withBuffer ? skills[i].rankBuff : 0;+ if (rank > max)+ max = rank;+ }++ if (i == PSSKILL_COUNT)+ return (unsigned int)~0;+ else+ return i;+}++unsigned int psCharacter::GetStatsLevel()+{ return ( attributes.GetStat(PSITEMSTATS_STAT_STRENGTH) + attributes.GetStat(PSITEMSTATS_STAT_ENDURANCE) + attributes.GetStat(PSITEMSTATS_STAT_AGILITY) + attributes.GetStat(PSITEMSTATS_STAT_INTELLIGENCE) + attributes.GetStat(PSITEMSTATS_STAT_WILL) + attributes.GetStat(PSITEMSTATS_STAT_CHARISMA) ) / 6;+} ++unsigned int psCharacter::GetMagicLevel()+{+ return &SkillSet::GetBestMagicSkillValue; } +unsigned int psCharacter::GetCombatLevel()+{+ return &SkillSet::GetBestCombatSkillValue;+}++unsigned int psCharacter::GetCharLevel()+{+ return ( ((&psCharacter::GetStatsLevel) + (&psCharacter::GetMagicLevel) + (&psCharacter::GetCombatLevel)) / 3 );+} + //This function recalculates Hp, Mana, and Stamina when needed (char creation, combats, training sessions) void psCharacter::RecalculateStats() {@@ -3712,44 +3806,6 @@ return & skills[which]; } -unsigned int SkillSet::GetBestSkillValue( bool withBuffer )-{- unsigned int max=0;- for (int i=0; i<PSSKILL_COUNT; i++)- {- PSSKILL skill = skills[i].info->id;- if( skill == PSSKILL_AGI ||- skill == PSSKILL_CHA ||- skill == PSSKILL_END ||- skill == PSSKILL_INT ||- skill == PSSKILL_WILL ||- skill == PSSKILL_STR )- continue; // Jump past the stats, we only want the skills-- unsigned int rank = skills[i].rank + (withBuffer?skills[i].rankBuff:0);- if (rank > max)- max = rank;- }- return max;-}--unsigned int SkillSet::GetBestSkillSlot( bool withBuffer )-{- unsigned int max = 0;- unsigned int i = 0;- for (; i<PSSKILL_COUNT; i++)- {- unsigned int rank = skills[i].rank + withBuffer ? skills[i].rankBuff : 0;- if (rank > max)- max = rank;- }-- if (i == PSSKILL_COUNT)- return (unsigned int)~0;- else- return i;-}- void SkillSet::Calculate() { for ( int z = 0; z < PSSKILL_COUNT; z++ )Index: pscharacter.h===================================================================--- pscharacter.h (revision 557)+++ pscharacter.h (working copy)@@ -479,7 +479,9 @@ int AddSkillPractice(PSSKILL skill, unsigned int val); /** Gets a players best skill rank **/- unsigned int GetBestSkillValue( bool withBuff );+ unsigned int GetBestSkillValue();+ unsigned int GetBestCombatSkillValue();+ unsigned int GetBestMagicSkillValue(); /** Get the slot that is the best skill in the set. * @param withBuff Apply any skill buffs?@@ -1010,6 +1012,9 @@ /// Returns a level of character based on his 6 base stats. unsigned int GetCharLevel();+ unsigned int GetMagicLevel();+ unsigned int GetCombatLevel();+ unsigned int GetStatsLevel(); bool IsMerchant() { return (merchantInfo != NULL); } psMerchantInfo *GetMerchantInfo() { return merchantInfo; }