Just a web script to help track when, where, and what you got from the free treasures scattered about Nightfall in the game Guild Wars.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

98 line
3.7 KiB

  1. <TITLE>What Dropped?</TITLE>
  2. <?php
  3. include_once 'gw-connect.php';
  4. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  5. #$toonid = mysqli_real_escape_string($con, $_POST['playerid']); //enable this after character selection is working
  6. $toonid = 'Chrissi Chan';
  7. #$location = mysqli_real_escape_string($con, $_POST['locationid']); //enable this after location selection is working
  8. $location = 4;
  9. $whatdropped = mysqli_real_escape_string($con, $_POST['gwdrop']);
  10. if ($con->connect_errno > 0){
  11. die ('Unable to connect to database [' . $db->connect_errno . ']');
  12. }
  13. echo 'At ';
  14. $sqlmaplocation = "SELECT `location`, `wikilink` FROM `treasurelocation` WHERE `treasureid` = $location";
  15. if (!$result = $con->query($sqlmaplocation)){
  16. die ('There was an error running the query [' . $con->error . ']');
  17. }
  18. while ($row = $result->fetch_array()){
  19. $locname = $row['location'];
  20. $loclink = $row['wikilink'];
  21. echo '<A HREF="' . $loclink . '">' . $locname . '</A>';
  22. }
  23. echo ' a ';
  24. #experimental stuff
  25. if ($whatdropped == "1"){
  26. echo 'run weapon code';
  27. } else if ($whatdropped == "2"){
  28. echo 'run material code';
  29. } else if ($whatdropped == "3"){
  30. echo 'run rune code';
  31. } else {
  32. echo '<FORM><SELECT NAME="gwdrop" METHOD="POST" onchange="this.form.submit()">';
  33. echo '<OPTION SELECTED DISABLED>choose one</OPTION>';
  34. echo '<OPTION VALUE="1">weapon</OPTION>';
  35. echo '<OPTION VALUE="2">material</OPTION>';
  36. echo '<OPTION VALUE="3">rune</OPTION></SELECT>';
  37. echo '<NOSCRIPT><INPUT TYPE="SUBMIT" VALUE="SUBMIT"></NOSCRIPT></FORM>';
  38. }
  39. //code for white blue purple etc
  40. $sqlweaprare = "SELECT * FROM `listrarity` ORDER BY `rareid` ASC";
  41. if (!$result = $con->query($sqlweaprare)){
  42. die ('There was an error running the query [' . $con->error . ']');
  43. }
  44. echo '<SELECT NAME="rare">';
  45. while ($row = $result->fetch_array()){
  46. $rareid = $row['rareid'];
  47. $rarity = $row['rarity'];
  48. echo '<OPTION VALUE="' . $rareid . '">' . $rarity . '</OPTION>';
  49. }
  50. echo '</SELECT>, ';
  51. //code for weapon attribute requirment
  52. $sqlweapreq = "SELECT * FROM `listreq` ORDER BY `req` ASC";
  53. if (!$result = $con->query($sqlweapreq)){
  54. die ('There was an error running the query [' . $con->error . ']');
  55. }
  56. echo 'req<SELECT NAME="requirement">';
  57. while ($row = $result->fetch_array()){
  58. $reqid = $row['req'];
  59. echo '<OPTION VALUE="' . $reqid . '">' . $reqid . '</OPTION>';
  60. }
  61. echo '</SELECT>';
  62. //code for what attribute the weapon is (command, axe mastery, energy storage, etc
  63. $sqlweapattr = "SELECT * FROM `listattribute` ORDER BY `weapattrid` ASC";
  64. if (!$result = $con->query($sqlweapattr)){
  65. die ('There was an error running the query [' . $con->error . ']');
  66. }
  67. echo '<SELECT NAME="attribute">';
  68. while ($row = $result->fetch_array()){
  69. $attrid = $row['weapattrid'];
  70. $weapattr = $row['weaponattribute'];
  71. echo '<OPTION VALUE="' . $attrid . '">' . $weapattr . '</OPTION>';
  72. //need to add a nested while loop, to preselect the weapon with the attribute, or somehow java it? An r9 Axe of Energy Storage combo doesn't exist.
  73. }
  74. echo '</SELECT>';
  75. //code for what the weapon is - staff, dagger, scythe, wand, sword, etc
  76. $sqlweaptype = "SELECT * FROM `listtype` ORDER BY `weaponid` ASC";
  77. if (!$result = $con->query($sqlweaptype)){
  78. die ('There was an error running the query [' . $con->error . ']');
  79. }
  80. echo '<SELECT NAME="weapon">';
  81. while ($row = $result->fetch_array()){
  82. $typeid = $row['weaponid'];
  83. $weapon = $row['weapontype'];
  84. echo '<OPTION VALUE="' . $typeid . '">' . $weapon . '</OPTION>';
  85. //need to figure out how to display the options for weapon, material, or rune
  86. }
  87. echo '</SELECT>';
  88. echo ' and |code for gold dropped here| gold pieces';
  89. echo ' <BR /><BR />';
  90. echo 'End result: a Gold r9 Swordsmanship Sword'; //need to arrange code blocks around to achieve this
  91. ?>