Advertisement
polectron

Registro v2 Send Status

Dec 29th, 2020 (edited)
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.08 KB | None | 0 0
  1. def pbSendStatus(type)
  2.     begin  
  3.       Thread.new {
  4.         begin
  5.           id = $Trainer.id
  6.           name = pbGetUserName()
  7.           data = {"trainer_id"=>id, "player_name"=>name, "type"=>type, "info"=>pbBuildInfo(), "team"=>pbGetTeam(),
  8.             "play_time"=>(Graphics.frame_count / Graphics.frame_rate / 60)}
  9.           pbPostData("http://urldelsitio.com/api/registerData", data, filename=nil, depth=0)
  10.         rescue => exception
  11.             #p exception
  12.             #Kernel.pbMessage("Vaya, ha habido un error.")
  13.         end
  14.       }
  15.     end
  16. end
  17.  
  18. def pbBuildInfo()
  19.   aux = ""
  20.   played_time_h = (Graphics.frame_count / Graphics.frame_rate / 60)/60
  21.   played_time_m = (Graphics.frame_count / Graphics.frame_rate / 60)%60
  22.   n_badges = $Trainer.numbadges
  23.  
  24.   aux += "Tiempo jugado: #{played_time_h}h #{played_time_m}m<br>"
  25.   aux += "Medallas: #{n_badges}<br>"
  26.   return aux
  27. end
  28.  
  29. def pbGetTeam()
  30.   aux = []
  31.  
  32.   $Trainer.party().each{|pokemon|
  33.     aux.push(PBSpecies.getName(pokemon.species) + " Lvl. " + pokemon.level.to_s)
  34.   }
  35.  
  36.   return aux.join("<br>")
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement