Guest User

genderboy.php

a guest
Apr 15th, 2017
33
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $admin=true;
  3. function generateFigure($club=null,$gender=null){
  4. //generateFigure function
  5. //Generates a valid Habbo figure
  6. //Copyright ® 2009 - Yifan Lu (www.yifanlu.com)
  7. //Please do not remove this :-)
  8. if($gender == null){ if(rand(0,1) == 0){ $gender = "M"; }else{ $gender = "M"; } }
  9. if($club == null){ $club = (bool) rand(0,1); }
  10. $xml = simplexml_load_file('./register/figuredata.xml');
  11. $figure = "";
  12. foreach($xml->sets->settype as $settype){
  13. if((string) $settype['mandatory'] == "1" || rand(0,1) == 1){
  14. $item['settype'] = $settype['type'];
  15. $palette = (int) $settype['paletteid'];
  16. $possible = array();
  17. foreach($settype->set as $xset){
  18. if($xset['gender'] != "U" && $xset['gender'] != $gender){ $fail = true; }
  19. if($xset['selectable'] == "0"){ $fail = true; }
  20. if($xset['colorable'] == "0"){ $color = false; }else{ $color = true; }
  21. if($xset['club'] == "1" && $club == false){ $fail = true; }
  22. if(isset($fail) && $fail != true){ $possible[] = array($xset['id'],$color); }
  23. $fail = false; $color = false;
  24. }
  25. $count = count($possible);
  26. $num = rand(0,$count-1);
  27. if(isset($possible[$num][1]))
  28. $item['set'] = $possible[$num][0];
  29. if(isset($possible[$num][1]) && $possible[$num][1] == false){ $item['color'] = ""; }else{
  30. $possible = array();
  31. foreach($xml->colors->palette[$palette-1]->color as $color){
  32. if($color['club'] == "1" && $club == false){ $fail = true; }
  33. if($color['selectable'] == "0"){ $fail = true; }
  34. if($fail != true){ $possible[] = $color['id']; }
  35. $fail = false;
  36. }
  37. $count = count($possible);
  38. $num = rand(0,$count-1);
  39. $item['color'] = $possible[$num];
  40. }
  41. $figure .= $item['settype']."-".$item['set']."-".$item['color'].".";
  42. }
  43. }
  44. $figure = substr($figure, 0, -1);
  45. return array($figure,$gender);
  46. }
  47. ?>
RAW Paste Data Copied