Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2021, 12:00 PM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default Listing class spells with NPC and plugin

I'm working on a plugin to read spells from a table (by class) and report data in a table. Basically I've taken Akkadius' Leaderboards plugin and hacked it up to accomplish this.

Code:
sub ShowSpellList {
  my $class = $_[0];
  $connect = plugin::LoadMysql();

  $query = "SELECT
    `Name`,
    `class`,
    `level`,
    `expansion`,
    `spell_id`
      FROM
    `va_spells`
      WHERE class = ? ORDER BY level";
  $query_handle = $connect->prepare($query);

  $query_handle->execute($class);
  quest::debug("$DBI::errstr") if $DBI::errstr;
  my $Result = "";
  while (@row = $query_handle->fetchrow_array()){
    my ($spell_name, $spell_class, $spell_level, $spell_expansion, $spell_id) = $query_handle->fetchrow();
    $count++;
    quest::debug("Name: $spell_name");
    quest::debug("Class $spell_class");
    quest::debug("Level $spell_level");
    quest::debug("Expansion $spell_expansion");
    quest::debug("ID $spell_id");

  $Result .= "
    <tr>
      <td><c \"#FFFF66\">$count~</td>
      <td><c \"#FFFF66\">" . $spell_name . "~</td>
      <td><c \"#DF7401\">" . $spell_class . "~ </td>
      <td><c \"#00FF00\">" . $spell_level . "~ </td>
      <td><c \"#FF0000\">" . $spell_expansion . "~ </td>
      <td><c \"#3366FF\">" . $spell_id . "~ </td>
    </tr>";
  }

  $count = 0;
  plugin::DiaWind(
    "{linebreak}
    <br>
    Spells ~
    <br>
    {linebreak}
    <br>
    <table>
      <tr>
        <th></th>
        <th>Name</th>
        <th>Class</th>
        <th>Level</th>
        <th>Expansion</th>
        <th>Spell ID</th>
      </tr>
      " . $Result . "
    </table>
    noquotes
  ");
}
The query works, and the debug messages report things correctly. Just doesn't pop up a window with a table in it.



I don't see anything obvious, but it probably is
__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/

Last edited by N0ctrnl; 06-09-2021 at 12:03 PM.. Reason: added image
Reply With Quote
  #2  
Old 06-09-2021, 02:57 PM
Splose's Avatar
Splose
Discordant
 
Join Date: Apr 2014
Posts: 279
Default

Quote:
Originally Posted by N0ctrnl View Post
I'm working on a plugin to read spells from a table (by class) and report data in a table. Basically I've taken Akkadius' Leaderboards plugin and hacked it up to accomplish this.

Code:
sub ShowSpellList {
  my $class = $_[0];
  $connect = plugin::LoadMysql();

  $query = "SELECT
    `Name`,
    `class`,
    `level`,
    `expansion`,
    `spell_id`
      FROM
    `va_spells`
      WHERE class = ? ORDER BY level";
  $query_handle = $connect->prepare($query);

  $query_handle->execute($class);
  quest::debug("$DBI::errstr") if $DBI::errstr;
  my $Result = "";
  while (@row = $query_handle->fetchrow_array()){
    my ($spell_name, $spell_class, $spell_level, $spell_expansion, $spell_id) = $query_handle->fetchrow();
    $count++;
    quest::debug("Name: $spell_name");
    quest::debug("Class $spell_class");
    quest::debug("Level $spell_level");
    quest::debug("Expansion $spell_expansion");
    quest::debug("ID $spell_id");

  $Result .= "
    <tr>
      <td><c \"#FFFF66\">$count~</td>
      <td><c \"#FFFF66\">" . $spell_name . "~</td>
      <td><c \"#DF7401\">" . $spell_class . "~ </td>
      <td><c \"#00FF00\">" . $spell_level . "~ </td>
      <td><c \"#FF0000\">" . $spell_expansion . "~ </td>
      <td><c \"#3366FF\">" . $spell_id . "~ </td>
    </tr>";
  }

  $count = 0;
  plugin::DiaWind(
    "{linebreak}
    <br>
    Spells ~
    <br>
    {linebreak}
    <br>
    <table>
      <tr>
        <th></th>
        <th>Name</th>
        <th>Class</th>
        <th>Level</th>
        <th>Expansion</th>
        <th>Spell ID</th>
      </tr>
      " . $Result . "
    </table>
    noquotes
  ");
}
The query works, and the debug messages report things correctly. Just doesn't pop up a window with a table in it.



I don't see anything obvious, but it probably is
I'm gonna guess its the colors.. using <c> and then ~ at the end? Honestly no clue.

I would decouple this from DiaWind and just have it use it's own dedicated popup window. I am moving today and tomorrow but once I get settled I don't mind taking a look I used DiaWind for years lol.

Edit:

I almost forgot there are a few functions in that may be useful I know fo at least getspelllevel that I added and getspellname that kingly added may not need to use dbi idk.

Last edited by Splose; 06-09-2021 at 03:07 PM..
Reply With Quote
  #3  
Old 06-09-2021, 03:01 PM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default

I had that thought too, but the Leaderboards plugin uses it the same way.

https://github.com/N0ctrnl/VAPlugins...eaderboards.pl

And yeah, popup might be the way to go. Just a little frustrating. I just can't find it...
__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/
Reply With Quote
  #4  
Old 06-09-2021, 03:34 PM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default

Got it. Was just returning too many results. Looks like 10 is the max(?)

__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/
Reply With Quote
  #5  
Old 06-09-2021, 08:24 PM
Splose's Avatar
Splose
Discordant
 
Join Date: Apr 2014
Posts: 279
Default

Quote:
Originally Posted by N0ctrnl View Post
Got it. Was just returning too many results. Looks like 10 is the max(?)

Nice.. It looks great using the table.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:42 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3