Wuu Posted April 2, 2010 Report Share Posted April 2, 2010 function exptolvl($exp){ if ($exp > 10) { return ($exp/100)*10; } else { return 0; } } Esmu visu aizmirsis, ak dievs... Nepieciešama formula kas atgriež līmeņus. 1lv = 10 2lv = 20 3lv = 40 4lv = 80 5lv = 160 utt.. Es zinu ka tas ir stulbi, bet nevaru jau 30 minūtes iebraukti. Quote Link to comment Share on other sites More sharing options...
codez Posted April 2, 2010 Report Share Posted April 2, 2010 (edited) function exp2lvl($e){ if ($e<10) return 0; return floor(log($e/10,2))+1; } for ($i=1;$i<=100;$i++){ echo $i.' '.exp2lvl($i).'<br />'; } 2easystyle: function e2l($e){return $e<10?0:floor(log(($e/10),2))+1;} Edited April 2, 2010 by codez Quote Link to comment Share on other sites More sharing options...
Wuu Posted April 2, 2010 Author Report Share Posted April 2, 2010 Paldies :) Quote Link to comment Share on other sites More sharing options...
waplet Posted April 2, 2010 Report Share Posted April 2, 2010 lol visai ātri tie līmeņi paliks nesasniedzami.. piemēram jau 40. Quote Link to comment Share on other sites More sharing options...
Wuu Posted April 2, 2010 Author Report Share Posted April 2, 2010 codez, varbūt būsi tik laipns un samazināsi arī šis rindas :D function exptoprocents($e){ if ($e>=640) { return percent($e-640,640); } elseif ($e>=320) { return percent($e-320,320); } elseif ($e>=160) { return percent($e-160,160); } elseif ($e>=80) { return percent($e-80,80); } elseif ($e>=40) { return percent($e-40,40); } elseif ($e>=20) { return percent($e-20,20); } elseif ($e>=10) { return percent($e-10,10); } else { return $e; } } function percent($num_amount, $num_total) { $count1 = $num_amount / $num_total; $count2 = $count1 * 100; $count = number_format($count2, 0); return $count; } Atgriež procentos, cik līdz nākamajam līmenim palicis. Quote Link to comment Share on other sites More sharing options...
codez Posted April 2, 2010 Report Share Posted April 2, 2010 function e2l($e){return $e<10?0:floor(log(($e/10),2))+1;} function l2e($l){return $l<1?0:pow(2,$l-1)*10;} function nl($e){return ($e-($e1=l2e($l=e2l($e))))/(l2e($l+1)-$e1)*100;} for ($i=1;$i<=100;$i++){ echo $i.' '.e2l($i).' '.nl($i).'%<br />'; } Quote Link to comment Share on other sites More sharing options...
fest Posted April 3, 2010 Report Share Posted April 3, 2010 lol visai ātri tie līmeņi paliks nesasniedzami.. piemēram jau 40. Nekad nenovērtē par zemu geimeru izturību :> Quote Link to comment Share on other sites More sharing options...
waplet Posted April 3, 2010 Report Share Posted April 3, 2010 2^40* 10 :D būš 41lvl vane? nu apšaubu kurš tik daudz dabūs :D Quote Link to comment Share on other sites More sharing options...
Kaklz Posted April 3, 2010 Report Share Posted April 3, 2010 2^40* 10 :D būš 41lvl vane? nu apšaubu kurš tik daudz dabūs :D Parasti jau speelees naakamo liimenju uzdevumi dod lielaakus punktus, taa kaa ar sho nav tik traki Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.