polectron

Sistema Registro Ruby

Jan 11th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.98 KB | None | 0 0
  1. def pbSendStatus(type)
  2.   begin
  3.     id = $Trainer.id
  4.     name = Marshal.load(Marshal.dump($Trainer.name))
  5.    
  6.     data = {"player_id"=>id, "player_name"=>name, "type"=>type, "info"=>pbBuildInfo(), "equipo"=>pbGetTeam()}
  7.     response = pbPostData("http://midominio.com/registro.php", data, filename=nil, depth=0)
  8.   rescue => exception
  9.     Kernel.pbMessage("Vaya, ha habido un error.")
  10.   end
  11. end
  12.  
  13. def pbGetTeam()
  14.   aux = ""
  15.  
  16.   $Trainer.party().each{|pokemon|
  17.     aux += PBSpecies.getName(pokemon.species) + " Lvl. " + pokemon.level.to_s + "<br>"
  18.   }
  19.  
  20.     return aux
  21. end
  22.  
  23. def pbBuildInfo()
  24.   aux = ""
  25.   n_captured = $Trainer.pokedexOwned
  26.   played_time_h = (Graphics.frame_count / Graphics.frame_rate / 60)/60
  27.   played_time_m = (Graphics.frame_count / Graphics.frame_rate / 60)%60
  28.   n_badges = $Trainer.numbadges
  29.  
  30.   aux += "Tiempo jugado: #{played_time_h}h #{played_time_m}m"
  31.   aux += " Pokemon capturados: #{n_captured}"
  32.   aux += " Medallas: #{n_badges}"
  33.   return aux
  34. end
Advertisement
Add Comment
Please, Sign In to add comment