Advertisement
Guest User

Untitled

a guest
May 29th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.27 KB | None | 0 0
  1. <?php
  2.      $event = mysql_fetch_object(mysql_query($q="select e_usr_id from events where e_usr_id = ".$player->p_usr_id.""));
  3.        
  4.      if(empty($event->e_usr_id)){
  5.        
  6.         $p_q = $player->p_quest + 1;
  7.        $data = mysql_fetch_object(mysql_query($q="select * from `quests_param` WHERE q_id = ".$p_q." and q_need_lvl <= ".$player->p_lvl.""));
  8.          
  9.         if(!empty($data)){
  10.        
  11.           echo ''.$data->q_name.' <br/> '.$data->q_content .' <br/> <a href="mw.php?action=quest&quest=1">Przyjmij zadanie</a>';
  12.        
  13.         }
  14.         else {
  15.            echo 'Nie ma aktualnie żadnych misji!';
  16.         }  
  17.        
  18.       if($_GET['quest'] == 1){
  19.        
  20.         $data = mysql_fetch_object(mysql_query("select * from `quests_param` WHERE q_id = ".$p_q." and q_need_lvl <= ".$player->p_lvl.""));
  21.          
  22.          if(!empty($data)){
  23.          
  24.            $time = time() + $data->q_time;
  25.            mysql_query($q="call add_event(".$player->p_usr_id.", 2, ".$data->q_id.", ".$time.")");
  26.             echo 'Przyjołe¶ zadanie!';
  27.            
  28.          
  29.          }
  30.        
  31.       }
  32.       }
  33.       else {
  34.        
  35.         $times = mysql_fetch_object(mysql_query("select * from events WHERE e_usr_id = ".$player->p_usr_id.""));
  36.         $time = $times->e_end - time();
  37.         $m = floor($time/60);  
  38.        $s = $time % 60;
  39.         echo 'Aktualnie co¶ robisz, wrócisz za '; ?>
  40. <span id="timer">a </span>
  41. <script type="text/javascript">
  42. function liczCzas2(span_id,ile) {
  43. godzin = Math.floor(ile / 3600);
  44. minut = Math.floor((ile - godzin * 3600) / 60);
  45. sekund = ile - minut * 60 - godzin * 3600;
  46. if (godzin < 10){godzin = "0"+ godzin; }
  47. if (minut < 10){minut = "0" + minut; }
  48. if (sekund < 10){sekund = "0" + sekund; }
  49. ile--;
  50. if (ile > 0) {
  51. document.getElementById(span_id).innerHTML = godzin + ':' + minut + ':' + sekund;
  52. setTimeout("liczCzas2('"+span_id+"',"+ile+" )", 1000);
  53. } else {
  54. document.getElementById(span_id).innerHTML = '00:00:00';
  55. }
  56. }
  57. liczCzas2('timer',<?php echo $time ?>);
  58. </script>
  59. <?php
  60.       }
  61.       $event = mysql_fetch_object(mysql_query($q="select * from events where e_usr_id = ".$player->p_usr_id.""));
  62.       if($event->e_type == 2 && $event->e_end <= time()){
  63.         $data = mysql_fetch_object(mysql_query("select * from quests_param where q_id = $event->e_subtype"));
  64.          switch($data->q_type){
  65.          
  66.            case '1':
  67.               $win = rand(1, $data->q_difficulty);
  68.               if($win == 1){
  69.            
  70.                 echo ''.$data->q_final_content.'';
  71.                  mysql_query("update players set gold = gold + $data->q_gold, exp = exp + $data->q_exp where p_usr_id = ".$player->p_usr_id."");
  72.                  $i_data = mysql_fetch_object(mysql_query("select * from items_param where i_id = ".$data->q_item.""));
  73.                  mysql_query("delete from events where e_usr_id = ".$player->p_usr_id."");
  74.                  if($data->q_item != 0){
  75.              mysql_query("INSERT INTO `items_player` (`ip_usr_id` ,`ip_name` ,`ip_cost` ,`ip_lvl` ,`ip_attack_min` , `ip_attack_max` ,`ip_defense` ,`ip_injuries_ice` ,`ip_injuries_fire` ,`ip_injuries_poision` ,`ip_info` ,`ip_image` ,`ip_type`) VALUES (".$player->p_usr_id.", ".$i_data->i_name.", ".$i_data->i_cost.", ".$i_data->i_lvl.",".$i_data->i_attack_min.", ".$i_data->i_attack_max.", ".$i_data->i_defense.", ".$i_data->i_injuries_ice.", ".$i_data->i_injuries_fire.", ".$i_data->i_poision.", ".$i_data->i_info.", ".$i_data->i_image.", ".$i_data->i_type.")");
  76.                  }
  77.                  
  78.            
  79.            }
  80.            
  81.          
  82.          }
  83.          
  84.          
  85.       }
  86. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement