Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Scalar::Util qw(looks_like_number);
- Xchat::register("FE Level Up","2014.06.25","Bot to level up FE characters");
- Xchat::print("Fire Emblem Level Up Script loaded!");
- Xchat::hook_print('Channel Message', "roll");
- Xchat::hook_print('Your Message', "roll");
- Xchat::hook_print('Private Message to Dialog', "roll");
- my @stats = ("HP", "STR", "MAG", "SKL", "LUK", "DEF", "RES", "SPD");
- sub roll {
- my @pubwords = split(/ /, Xchat::strip_code($_[0][1]));
- return Xchat::EAT_NONE if ($#pubwords eq -1);
- if ($pubwords[0] eq '!felp') {
- if (not $pubwords[1]) {
- return Xchat::EAT_NONE;
- } elsif ($pubwords[1] eq 'help') {
- Xchat::command("SAY Use ROLL after !felp to just roll 8 d100s or input PROG and your progression, separated by spaces, to have the bot compare each one. Use the order listed below: (Type !felp ORDER to check the order again.)");
- Xchat::command("SAY " . join(" ", @stats));
- return Xchat::EAT_PLUGIN;
- } elsif ($pubwords[1] eq 'order') {
- Xchat::command("SAY " . join(" ", @stats));
- return Xchat::EAT_PLUGIN;
- } elsif ($pubwords[1] eq 'roll' or $pubwords[1] eq 'prog') {
- my @results;
- for (my $i = 0; $i < 8; $i++) {
- $results[$i] = int(rand(100)) + 1;
- }
- my $output = join(" ", @results);
- Xchat::command("SAY ROLL results: " . $output);
- if ($pubwords[1] eq 'roll') {
- return Xchat::EAT_PLUGIN;
- } elsif ($pubwords[1] eq 'prog') {
- my $statresults = '';
- for (my $i = 0; $i < 8; $i++) {
- my $numstats = int($pubwords[$i+2] / 100);
- if ($pubwords[$i+2] % 100 > $results[$i]) {
- $numstats++;
- }
- if ($numstats > 1) {
- $statresults .= $stats[$i] . "x$numstats ";
- } elsif ($numstats == 1) {
- $statresults .= $stats[$i] . " ";
- }
- }
- if ($statresults) {
- chop $statresults;
- } else {
- $statresults = 'None';
- }
- my $charname = "";
- for (my $j = 10; $j <= $#pubwords; $j++) {
- $charname .= $pubwords[$j] . " ";
- }
- my $cmd;
- if ($charname) {
- chop $charname;
- $cmd = "SAY " . $charname . "'s STATS UP: " . $statresults;
- } else {
- $cmd = "SAY STATS UP: " . $statresults;
- } Xchat::command($cmd);
- return Xchat::EAT_PLUGIN;
- }
- }
- }
- return Xchat::EAT_NONE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement