Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.26 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * This is the script that will ensure that when a player works
  5.  * certain considerations will be taken into account and a final
  6.  * product output determined. The script also subtracts health
  7.  * from the player, gives stock points to the product bank,
  8.  * subtracts taxes and deposits the amount into the country account,
  9.  * pays the worker.
  10.  * ==============================================================
  11.  
  12.  
  13.  
  14.  
  15. if ($page == 'work')
  16. {
  17.                 //Get the stock divitions
  18.                 require_once ('brains/var.stock_divide.php');
  19.  
  20.                 if ($work = $mysqli->query("SELECT * FROM player WHERE id = '$player_id'"))
  21.                 {
  22.                                 while ($result_work = $work->fetch_assoc())
  23.                                 {
  24.                                                 //===================================================================
  25.                                                 //===========================DO==THE==MATH===========================
  26.                                                 //===================================================================
  27.                                                 $health_multi = 3 * ($health / 100);
  28.                                                 $level_multi = $level / 100;
  29.                                                 $skill_multi = $skill * $health_multi / 100;
  30.                                                 if ($skill < "150")
  31.                                                 {
  32.                                                                 $noob_boost = 100 - $skill;
  33.                                                                 $work_multi = (3.5 + ($skill_multi * 0.5)) * $health_multi * (1 + 1 + 1) * 8 + $noob_boost;
  34.                                                 } else
  35.                                                 {
  36.                                                                 $work_multi = (3.5 + ($skill_multi * 1)) * $health_multi * $level_multi * 8;
  37.                                                 }
  38.                                                 $new_health = $health - 2;
  39.                                                 $new_skill = $skill + 2;
  40.                                                 $new_level = $level + 1;
  41.                                                 $new_stock = $current_stock + $work_multi;
  42.                                                 $new_currency = $local_currency + $wage;
  43.                                                 //==================================================================
  44.                                                 //==================================================================
  45.                                                 //==================================================================
  46.  
  47.                         //==============================================================================================================================================================
  48.                         //==============================================================================================================================================================
  49.                         //==============================================================================================================================================================
  50.                         //================================================================DISPLAY==CODE=================================================================================
  51.                         //==============================================================================================================================================================
  52.                         //==============================================================================================================================================================
  53.                         //==============================================================================================================================================================
  54.                                                 print "<h3>Welcome to your work</h3>
  55.                                                                         <p>You have just worked for " .
  56.                                                                 $company_name . " and this is how well you did</p>
  57.                                                                         <table width=\"30%\" cellpadding=\"5\" border=\"0\">
  58.                                                                         <tr>
  59.                                                                             <td>Your Work Health</td>
  60.                                                                             <td>" .
  61.                                                                 $result_work['health'] . "</td>
  62.                                                                         </tr>
  63.                                                                         <tr>
  64.                                                                            
  65.                                                                             <td>Your Work result</td>
  66.                                                                             <td>" .
  67.                                                                 round($work_multi, 3) . "</td>
  68.                                                                         </tr>
  69.                                                                         <tr>
  70.                                                                            
  71.                                                                             <td>1 Star food Produced</td>
  72.                                                                             <td>" .
  73.                                                                 round($work_multi / $food_1star, 3) . "</td>
  74.                                                                         </tr>
  75.                                                                           <tr>
  76.                                                                            
  77.                                                                             <td>2 Star food Produced</td>
  78.                                                                             <td>" .
  79.                                                                 round($work_multi / $food_2star, 3) . "</td>
  80.                                                                         </tr>
  81.                                                                         <tr>
  82.                                                                            
  83.                                                                             <td>3 Star food Produced</td>
  84.                                                                             <td>" .
  85.                                                                 round($work_multi / $food_3star, 3) . "</td>
  86.                                                                         </tr>
  87.                                                                         <tr>
  88.                                                                            
  89.                                                                             <td>4 Star food Produced</td>
  90.                                                                             <td>" .
  91.                                                                 round($work_multi / $food_4star, 3) . "</td>
  92.                                                                         </tr>
  93.                                                                         <tr>
  94.                                                                            
  95.                                                                             <td>5 Star food Produced</td>
  96.                                                                             <td>" .
  97.                                                                 round($work_multi / $food_5star, 3) . "</td>
  98.                                                                         </tr>
  99.                                                                         <tr>
  100.                                                                            
  101.                                                                             <td>It has made you tired. You need food!. You health is now:</td>
  102.                                                                             <td>" .
  103.                                                                 $new_health . "</td>
  104.                                                                         </tr>
  105.                                                                         <tr>
  106.                                                                            
  107.                                                                             <td>You earned:</td>
  108.                                                                             <td>" .
  109.                                                                 round($wage) . "HAR</td>
  110.                                                                         </tr>
  111.                                                                         </table>";
  112.                         //==============================================================================================================================================================
  113.                         //==============================================================================================================================================================
  114.                         //==============================================================================================================================================================
  115.                         //=================================================================END==DISPLAY==CODE===========================================================================
  116.                         //==============================================================================================================================================================
  117.                         //==============================================================================================================================================================
  118.                         //==============================================================================================================================================================
  119.  
  120.                                                 //update the database
  121.  
  122.  
  123.                                                 $q_player = "UPDATE player SET health = '$new_health', skill = '$new_skill', level = '$new_level' WHERE id = '$player_id' ";
  124.                                                 $q_stock = "UPDATE stock_bank SET units = '$new_stock' WHERE company = '$employment' ";
  125.                                                 $q_work_log = "INSERT INTO work_log (player, round, day, health, units) VALUES ('$player_id', '$round', '$day', '$health', '$work_multi')";
  126.                                                 $q_wage = "UPDATE bank_citizen SET har='$new_currency'";
  127.                                                 $mysqli->query($q_player);
  128.                                                 $mysqli->query($q_stock);
  129.                                                 $mysqli->query($q_work_log);
  130.                                                 $mysqli->query($q_wage);
  131.  
  132.                                 }
  133.  
  134.                 }
  135.  
  136.  
  137. }
  138.  
  139. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement