Guest User

Untitled

a guest
Jun 16th, 2019
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. sub EVENT_SAY {
  2. if ($text=~/#MemmedInfo/i) {
  3. MemmedCountList();
  4. }
  5. }
  6.  
  7. sub MemmedCountList {
  8. my $client = plugin::val('client');
  9. my $memmed_count = $client->MemmedCount();
  10. my $message = "You currently have $memmed_count memmed spells.<br>
  11. <table>
  12. <tr>
  13. <td>" . plugin::PWColor("Slot", "Yellow") . "</td>
  14. <td>" . plugin::PWColor("Spell ID", "Royal Blue") . "</td>
  15. <td>" . plugin::PWColor("Spell Name", "Royal Blue") . "</td>
  16. </tr>";
  17. for (my $i = 0; $i < 13; $i++) {
  18. if ($client->FindMemmedSpellBySlot($i) != 0) {
  19. my $spell_id = $client->FindMemmedSpellBySlot($i);
  20. my $spell_name = plugin::GetSpellName($spell_id);
  21. $message .= "<tr>";
  22. $message .= "<td>" . plugin::PWColor($i, "Yellow") . "</td>";
  23. $message .= "<td>" . plugin::PWColor($spell_id, "Royal Blue") . "</td>";
  24. $message .= "<td>" . $spell_name . "</td>";
  25. $message .= "</tr>";
  26. }
  27. }
  28. $message .= "</table>";
  29. plugin::Popup("Memmed Info", $message, 0, 999);
  30. }
  31.  
  32. sub GetSpellName {
  33. my $spell_id = shift;
  34. my $dbh = plugin::LoadMysql();
  35. my $sth = $dbh->prepare("SELECT `name` FROM `spells_new` WHERE `id` = '$spell_id'");
  36. $sth->execute();
  37. if ($sth->rows() > 0) {
  38. my @data = $sth->fetchrow_array();
  39. return plugin::PWColor($data["name"], "Light Blue");
  40. } else {
  41. return plugin::PWColor("INVALID SPELL", "Light Blue");
  42. }
  43. $sth->finish();
  44. $dbh->disconnect();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment