Quote:
Originally Posted by CptSky
Code:
int Amount = 100 / Chance + 1;
The amount is related to the chance you have to upgrade at TC. I have the official algorithm somewhere, but I can't find it at the moment.
|
And this is where the chance comes from:
Code:
bool CUser::GetUpEpLevelInfo (CItem* pItem, int& nChance, OBJID& idNewType, bool bSendHint/*=false*/)
{
idNewType = this->ChkUpEqLevel(pItem, bSendHint);
if (ID_NONE == idNewType)
return false;
OBJID idType = pItem->GetInt(ITEMDATA_TYPE);
nChance = 100;
if (pItem->IsShield() || pItem->IsArmor() || pItem->IsHelmet())
{
int nLev = (idType%100)/10;
switch(nLev)
{
case 5:
nChance = 50;
break;
case 6:
nChance = 40;
break;
case 7:
nChance = 30;
break;
case 8:
case 9:
nChance = 20;
break;
default:
nChance = 500;
break;
}
int nQuality = idType%10;
switch(nQuality)
{
case 6:
nChance = nChance*90/100;
break;
case 7:
nChance = nChance*70/100;
break;
case 8:
nChance = nChance*30/100;
break;
case 9:
nChance = nChance*10/100;
break;
default:
break;
}
}
else
{
int nLev = (idType%1000)/10;
switch(nLev)
{
case 11:
nChance = 95;
break;
case 12:
nChance = 90;
break;
case 13:
nChance = 85;
break;
case 14:
nChance = 80;
break;
case 15:
nChance = 75;
break;
case 16:
nChance = 70;
break;
case 17:
nChance = 65;
break;
case 18:
nChance = 60;
break;
case 19:
nChance = 55;
break;
case 20:
nChance = 50;
break;
case 21:
nChance = 45;
break;
case 22:
nChance = 40;
break;
default:
nChance = 500;
break;
}
int nQuality = idType%10;
switch(nQuality)
{
case 6:
nChance = nChance*90/100;
break;
case 7:
nChance = nChance*70/100;
break;
case 8:
nChance = nChance*30/100;
break;
case 9:
nChance = nChance*10/100;
break;
default:
break;
}
}
// change range
nChance = __min(100, __max(1, nChance));
return true;
}