Deciphering the weap proficiency code

Posted by Lys on Sat 08 Oct 2005 09:04 AM — 2 posts, 10,035 views.

#0
This is the prof code:

int weapon_prof_bonus_check (CCharacter *ch, CObjData *wield, int *gsn_ptr)
{
    int bonus;

    bonus = 0;*gsn_ptr = -1;
    if (!ch->IsNpc () && ch->GetLevel () > 5 && wield)   
    {
switch (wield->value[3])
{
   default:*gsn_ptr = -1;break;
           case 0:
   case 12:
   case 10:
   case 6:*gsn_ptr = gsn_pugilism;break;
           case 3:
           case 1:*gsn_ptr = gsn_long_blades;break;
           case 11:
           case 2:*gsn_ptr = gsn_short_blades;break;
           case 4:*gsn_ptr = gsn_flexible_arms;break;
           case 5:*gsn_ptr = gsn_talonous_arms;break;
           case 7:
           case 8:*gsn_ptr = gsn_bludgeons;break;

}
if (*gsn_ptr != -1)
  bonus =  (int)  ((ch->GetPcData ()->learned[*gsn_ptr] -50)/10);

       /* Reduce weapon bonuses for misaligned clannies.
       if (ch->IsClanned ())
       {
          bonus = bonus / 
           (1 + abs (ch->alignment - ch->GetPcData ()->clan->alignment) / 1000);
       }*/

if (ch->IsDevoted ()) {
   bonus = bonus - abs (ch->GetPcData ()->favor) / -100 ;
}

    }
    return bonus;
}


What is learned[*gsn_ptr]?
USA #1
As you can tell in the function header:
int weapon_prof_bonus_check (CCharacter *ch, CObjData *wield, int *gsn_ptr)


It's called from backtrace. You'll have to find where the function is called.