EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Plugins & Mods (https://www.eqemulator.org/forums/forumdisplay.php?f=678)
-   -   Plugin to obtain class ID (https://www.eqemulator.org/forums/showthread.php?t=32244)

abooble24 10-06-2010 07:36 PM

Plugin to obtain class ID
 
I couldn't believe there wasn't a global $classid, so I had to make a plugin to pull it. I am using it to assign a class specific start task to a character as they are created without having to compare class string names over and over. I am sure there will be other uses for it that someone out there can come up with.

The Plugin:
Code:

sub getClassId{
        my $class = $_[0];
        %classes = (          'Warrior', 1,
                                  'Cleric', 2,
                                  'Paladin', 3,
                                      'Ranger', 4,
                                  'Shadowknight', 5,
                                  'Druid', 6,
                                  'Monk', 7,
                                  'Bard', 8,
                                  'Rogue', 9,
                                  'Shaman', 10,
                                  'Necromancer', 11,
                                  'Wizard', 12,
                                  'Mage', 13,
                                  'Enchanter', 14,
                                  'Beastlord', 15,
                                  'Berserker', 16
        );
        return $classes{$class};
}

Example Usage: (Player enters zone and is assigned task if not on/completed)
Code:

sub EVENT_ENTERZONE{
        my $ClassID = plugin::getClassId($class);
       
        if(!quest::istaskactive($ClassID) && !quest::istaskcompleted($ClassID)){
                quest::assigntask($ClassID);
        }
}



All times are GMT -4. The time now is 11:03 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.