Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public function getLevelPrice( $desired, $current ) {
  2.  
  3. $price_calc = 0;
  4.  
  5. if ( $desired > 20 ) {
  6.  
  7. if ( $current >= 20 ) {
  8.  
  9. $price_calc = $price_calc + ( ( $desired - $current ) * 0.80 );
  10. $desired = 0;
  11.  
  12. } else {
  13.  
  14. $price_calc = $price_calc + ( ( $desired - 20 ) * 0.80 );
  15. $desired = 20;
  16.  
  17. }
  18.  
  19. }
  20.  
  21. if ( $desired > 10 ) {
  22.  
  23. if ( $current >= 10 ) {
  24.  
  25. $price_calc = $price_calc + ( ( $desired - $current ) * 0.65 );
  26. $desired = 0;
  27.  
  28. } else {
  29.  
  30. $price_calc = $price_calc + ( ( $desired - 10 ) * 0.65 );
  31. $desired = 10;
  32.  
  33. }
  34.  
  35. }
  36.  
  37. if ( $desired > 0 ) {
  38.  
  39. $price_calc = ( $price_calc + ( ( $desired - $current ) * 0.12 ) ) + 0.15;
  40. $desired = 0;
  41.  
  42. }
  43.  
  44. return $price_calc;
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement