All pastes #386119 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2007-03-08 11:34 UTC
rendered paste body
int32 HonorHandler::CalculateHonorPointsForKill(Player *pPlayer, Unit* pVictim){    /*// this sucks.. ;p    if(pVictim != pPlayer)    {        int pts = rand() % 100 + 100;        return pts;    }    return 0;*/    if(pVictim != pPlayer)    {        uint32 k_level =  pPlayer->GetUInt32Value(UNIT_FIELD_LEVEL);        uint32 v_level =  pVictim->GetUInt32Value(UNIT_FIELD_LEVEL);        uint32 total_kills = pPlayer->m_killsToday;        uint32 k_grey = 0;        if (k_level > 5 && k_level < 40) {            k_grey = k_level - (5 + floor(float(float(k_level) / 10.0f)));        } else {            k_grey = k_level - (1 + floor(float(float(k_level) / 5.0f)));        }        float f;        if(total_kills < 10) f = (10 - (float)total_kills) * 0.1;        else f= 0.0;        float diff_level = ((float)(v_level-k_grey))/((float)(k_level - k_grey));        if(diff_level > 2) diff_level = 2.0;        if(diff_level < 0) diff_level = 0.0;        float honor_points = (f * diff_level * 330);        honor_points *= ((float)k_level) / 70.0;        honor_points *= World::getSingleton().getRate(RATE_HONOR);        return honor_points;    }    return 0;}