Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

53 righe
2.6 KiB

  1. <?php
  2. if (isset($_SESSION['userid'])){
  3. echo '<table border="1"><caption>Titles progress</caption>';
  4. echo '<tr><th>Title</th><th>Title Rank</th><th>Title Points</th><th>Current Rank</th><th>Points Remaining</th><th>Max Title %</th><th>Next Rank</th></tr>';
  5. if ($_SESSION['prefcharid'] == "0") {
  6. // $gcc = Get Current Character stats
  7. $gcc = $con->prepare("SELECT * FROM gwstats WHERE charid = 0 AND accid = ? AND userid = ? ORDER BY percent DESC, currentstrank DESC, percent ASC");
  8. $gcc->bind_param("ii", $_SESSION['prefaccid'], $_SESSION['userid']);
  9. } else {
  10. // $gcc = Get Current Character stats
  11. $gcc = $con->prepare("SELECT * FROM gwstats WHERE charid = 0 AND accid = ? AND userid = ? UNION ALL SELECT * FROM gwstats WHERE charid = ? AND accid = ? AND userid = ? ORDER BY percent DESC, currentstrank DESC, percent ASC");
  12. $gcc->bind_param("iiiii", $_SESSION['prefaccid'], $_SESSION['userid'], $_SESSION['prefcharid'], $_SESSION['prefaccid'], $_SESSION['userid']);
  13. }
  14. $gcc->execute();
  15. $gccres = $gcc->get_result();
  16. while ($row = $gccres->fetch_assoc()) {
  17. // $gnr = Get Next Rank
  18. $gnr = $con->prepare("SELECT stpoints, stname FROM gwsubtitles WHERE titlenameid = ? AND stpoints >= ? ORDER BY stpoints ASC LIMIT 1");
  19. $gnr->bind_param("ii", $row['titlenameid'], $row['titlepoints']);
  20. $gnr->execute();
  21. $gnr->bind_result($stpoints, $stname);
  22. $gnr->fetch();
  23. $gnr->close();
  24. // $gt = Get Title
  25. $gt = $con->prepare("SELECT titlename FROM gwtitles WHERE titlenameid = ?");
  26. $gt->bind_param("i", $row['titlenameid']);
  27. $gt->execute();
  28. $gt->bind_result($titlename);
  29. $gt->fetch();
  30. $gt->close();
  31. $pr = number_format(($stpoints - $row['titlepoints']));
  32. if ($pr <= 0) {
  33. $pr = "Highest rank achieved!";
  34. $stname = "Highest rank achieved!";
  35. }
  36. if ($row['currentstrankname'] === NULL) {
  37. $row['currentstrankname'] = "No title earned yet!";
  38. $row['currentstrank'] = "0";
  39. }
  40. if ($row['percent'] >= 100) {
  41. $ohp = 100;
  42. } else {
  43. $ohp = $row['percent'];
  44. }
  45. echo '<tr><td style="width:175px;">' . $titlename . '</td><td style="width:210px;">' . $row['currentstrankname'] . '</td><td style="width:100px;">' . number_format($row['titlepoints']) . '</td><td style="width:70px;">' . $row['currentstrank'] . '</td>';
  46. echo '<td style="width:100px;">' . $pr . '</td><td><div class="percentbar" style="width:100px;"><div style="width:' . $ohp . 'px;"></div></div>';
  47. echo $ohp;
  48. echo '% completed</td><td>' . $stname . '</td></tr>';
  49. }
  50. $gccres->close();
  51. echo '</table><br />';
  52. }
  53. ?>