Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * This is the script that will ensure that when a player works
- * certain considerations will be taken into account and a final
- * product output determined. The script also subtracts health
- * from the player, gives stock points to the product bank,
- * subtracts taxes and deposits the amount into the country account,
- * pays the worker.
- * ==============================================================
- */
- if ($page == 'work')
- {
- //Get the stock divitions
- require_once ('brains/var.stock_divide.php');
- if ($work = $mysqli->query("SELECT * FROM player WHERE id = '$player_id'"))
- {
- while ($result_work = $work->fetch_assoc())
- {
- //===================================================================
- //===========================DO==THE==MATH===========================
- //===================================================================
- $health_multi = 3 * ($health / 100);
- $level_multi = $level / 100;
- $skill_multi = $skill * $health_multi / 100;
- if ($skill < "150")
- {
- $noob_boost = 100 - $skill;
- $work_multi = (3.5 + ($skill_multi * 0.5)) * $health_multi * (1 + 1 + 1) * 8 + $noob_boost;
- } else
- {
- $work_multi = (3.5 + ($skill_multi * 1)) * $health_multi * $level_multi * 8;
- }
- $new_health = $health - 2;
- $new_skill = $skill + 2;
- $new_level = $level + 1;
- $new_stock = $current_stock + $work_multi;
- $new_currency = $local_currency + $wage;
- //==================================================================
- //==================================================================
- //==================================================================
- print "<h3>Welcome to your work</h3>
- <p>You have just worked for " .
- $company_name . " and this is how well you did</p>
- <table width=\"30%\" cellpadding=\"5\" border=\"0\">
- <tr>
- <td>Your Work Health</td>
- <td>" .
- $result_work['health'] . "</td>
- </tr>
- <tr>
- <td>Your Work result</td>
- <td>" .
- round($work_multi, 3) . "</td>
- </tr>
- <tr>
- <td>1 Star food Produced</td>
- <td>" .
- round($work_multi / $food[0], 3) . "</td>
- </tr>
- <tr>
- <td>2 Star food Produced</td>
- <td>" .
- round($work_multi / $food[1], 3) . "</td>
- </tr>
- <tr>
- <td>3 Star food Produced</td>
- <td>" .
- round($work_multi / $food[2], 3) . "</td>
- </tr>
- <tr>
- <td>4 Star food Produced</td>
- <td>" .
- round($work_multi / $food[3], 3) . "</td>
- </tr>
- <tr>
- <td>5 Star food Produced</td>
- <td>" .
- round($work_multi / $food[4], 3) . "</td>
- </tr>
- <tr>
- <td>It has made you tired. You need food!. You health is now:</td>
- <td>" .
- $new_health . "</td>
- </tr>
- <tr>
- <td>You earned:</td>
- <td>" .
- round($wage) . "HAR</td>
- </tr>
- </table>";
- //update the database
- $q_player = "UPDATE player SET health = '$new_health', skill = '$new_skill', level = '$new_level' WHERE id = '$player_id' ";
- $q_stock = "UPDATE stock_bank SET units = '$new_stock' WHERE company = '$employment' ";
- $q_work_log = "INSERT INTO work_log (player, round, day, health, units) VALUES ('$player_id', '$round', '$day', '$health', '$work_multi')";
- $q_wage = "UPDATE bank_citizen SET har='$new_currency'";
- $mysqli->query($q_player);
- $mysqli->query($q_stock);
- $mysqli->query($q_work_log);
- $mysqli->query($q_wage);
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement