Purpose:
To display an in-game leaderboards for players to see where they rank.
------------------------
I've had this code written for ages so the quality is so-so. But it definitely does what it needs to do. Feel free to modify if want.
------------------------
Required: Perl DBI - See Google for installing Perl DBI/DBD for Mysql, until I create an article explaining otherwise.
Required: plugin::LoadMysql(); -
See thread HERE
Required: Popup Window plugin utils
Required: Mysql table `cust_ext_leaderboards`
http://wiki.eqemulator.org/i?Module=...Paste=BgtI3fWi
Source Table:
Code:
-- ----------------------------
-- Table structure for cust_ext_leaderboards
-- ----------------------------
DROP TABLE IF EXISTS `cust_ext_leaderboards`;
CREATE TABLE `cust_ext_leaderboards` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`class` varchar(255) NOT NULL,
`race` varchar(255) NOT NULL,
`hp` int(11) NOT NULL,
`mana` int(11) NOT NULL,
`ac` int(11) NOT NULL,
`status` int(11) NOT NULL,
`aa` int(11) NOT NULL,
`level` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Usage Example:
Code:
sub EVENT_SAY{
if($text=~/hail/i){
quest::say("What do you want?");
quest::say(quest::saylink("I want to check my player leaderboards man!", 1));
}
if($text=~/leaderboards/i){
quest::say("Fine!");
}
# Plugin will match for 'player leaderboards' and display menu options, it will also respond to further saylinks
plugin::LeaderBoardsMenu($text);
}
Note: In order to actually have the players info collected, you have to insert the collection routine somewhere. I usually trigger it in EVENT_ENTERZONE of global_player.pl but you can do it however you want:
Code:
plugin::LeaderBoardsUpdate();
Plugin File: (Goes under /plugins folder)
Name: Leaderboards.pl
Options: You can set your website Magelo Path under LoadMageloPath, or you can put in javascript
:; or # if you don't have a site.
Enjoy, let me know if you experience issues.