/**
* a = Attached player rating
* b = killed / killer rating
* k = coeficient
* r = rating
*
* return: r = rating.
*/
BUILDIN(calc_rank)
{
struct map_session_data *sd = script->rid2sd(st);
int a, b, k, r;
if (sd == NULL)
return true;
a = script_getnum(st, 2);
b = script_getnum(st, 3);
if( a > b )
{
k = ( a / ( b == 0? 2:b ) );
r = 1 + ( k > 0? k:1 );
}
else if( a < b )
{
k = ( b / ( a == 0? 2:a ) );
r = 2 + ( k > 0? k:2 );
}
else r = 2;
script_pushint( st, r );
return true;
}
BUILDIN_DEF(calc_rank,"ii"),