| 1 | package Bot::BasicBot::Pluggable::Module::WoWPVP; | ||
| 2 | |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use Bot::BasicBot::Pluggable::Module; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 2 | ▶ | use base qw(Bot::BasicBot::Pluggable::Module); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 0 | ▶ | use Games::WoW::PVP; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | Bot::BasicBot::Pluggable::Module::WoWPVP - Fetch information about pvp grades for World Of Warcraft | ||
| 13 | |||
| 14 | =head1 VERSION | ||
| 15 | |||
| 16 | Version 0.01 | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | our $VERSION = '0.02'; | ||
| 21 | |||
| 22 | =head1 SYNOPSIS | ||
| 23 | |||
| 24 | Quick summary of what the module does. | ||
| 25 | |||
| 26 | Perhaps a little code snippet. | ||
| 27 | |||
| 28 | use Bot::BasicBot::Pluggable::Module::WoWPVP; | ||
| 29 | |||
| 30 | my $foo = Bot::BasicBot::Pluggable::Module::WoWPVP->new(); | ||
| 31 | ... | ||
| 32 | |||
| 33 | will display the information like this: | ||
| 34 | Adygma <Cercle De L Anneau Rond> # Night Elf Priestlevel 60 # Position 44 (Grade 10 Lieutenant Commander) | ||
| 35 | HK/DK 14564/37 rating 40470 (Progression 89%) | ||
| 36 | |||
| 37 | =cut | ||
| 38 | |||
| 39 | =head1 FUNCTIONS | ||
| 40 | |||
| 41 | =head2 init | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | sub init { | ||
| 46 | my ($self) = @_; | ||
| 47 | } | ||
| 48 | |||
| 49 | sub help { | ||
| 50 | my ($self) = @_; | ||
| 51 | my $mess; | ||
| 52 | $mess = "pouet pouet"; | ||
| 53 | return $mess; | ||
| 54 | } | ||
| 55 | |||
| 56 | sub said { | ||
| 57 | my ( $self, $mess, $pri ) = @_; | ||
| 58 | |||
| 59 | return unless $pri == 2; | ||
| 60 | return unless $mess->{body} =~ /^!pvp/; | ||
| 61 | |||
| 62 | my $body = $mess->{body}; | ||
| 63 | my $who = $mess->{who}; | ||
| 64 | my $channel = $mess->{channel}; | ||
| 65 | |||
| 66 | $body =~ /^!pvp (\w+)/; | ||
| 67 | my $character = $1; | ||
| 68 | |||
| 69 | my ($realm) = $body =~ /-r (\w.+) (-\w|$)/; | ||
| 70 | my ($country) = $body =~ /-c (EU|US)/; | ||
| 71 | my ($faction) = $body =~ /-f (h|a)/i; | ||
| 72 | |||
| 73 | $realm ||= 'conseil des ombres'; | ||
| 74 | $country ||= 'EU'; | ||
| 75 | $faction ||= 'h'; | ||
| 76 | |||
| 77 | $character = ucfirst $character; | ||
| 78 | $realm =~ s/\s/+/g; | ||
| 79 | |||
| 80 | my $WoW = Games::WoW::PVP->new(); | ||
| 81 | |||
| 82 | my %hash = $WoW->search_player( | ||
| 83 | { country => $country, | ||
| 84 | realm => $realm, | ||
| 85 | faction => $faction, | ||
| 86 | character => $character, | ||
| 87 | } | ||
| 88 | ); | ||
| 89 | |||
| 90 | if ( !defined $hash{characterName} ) { | ||
| 91 | $self->tell( $channel, $who . ": no informations for $character" ); | ||
| 92 | return; | ||
| 93 | } | ||
| 94 | |||
| 95 | my $text = chr(3) . "9" . $hash{characterName}; | ||
| 96 | $text .= " <" . $hash{guildName} . ">" if defined $hash{guildName}; | ||
| 97 | $text .= chr(3) . "0 # " | ||
| 98 | . $hash{raceLabel} . " " | ||
| 99 | . $hash{classLabel} . "level" | ||
| 100 | . chr(3) . "9 " | ||
| 101 | . $hash{level} | ||
| 102 | . chr(3) . "0"; | ||
| 103 | $text .= " # Position " | ||
| 104 | . $hash{position} | ||
| 105 | . " (Grade " | ||
| 106 | . $hash{rank} . " " | ||
| 107 | . $hash{rankLabel} . ")"; | ||
| 108 | $self->tell( $channel, $text ); | ||
| 109 | |||
| 110 | $text = "HK/DK " . $hash{lhk} . "/" . $hash{ldk}; | ||
| 111 | $text .= " rating " | ||
| 112 | . $hash{rating} | ||
| 113 | . " (Progression" | ||
| 114 | . chr(3) . "9 " | ||
| 115 | . $hash{percent} . "%" | ||
| 116 | . chr(3) . "0) "; | ||
| 117 | |||
| 118 | $self->tell( $channel, $text ); | ||
| 119 | |||
| 120 | } | ||
| 121 | |||
| 122 | =head1 AUTHOR | ||
| 123 | |||
| 124 | Franck CUNY, C<< <franck at breizhdev.net> >> | ||
| 125 | |||
| 126 | =head1 BUGS | ||
| 127 | |||
| 128 | Please report any bugs or feature requests to | ||
| 129 | C<bug-bot-basicbot-pluggable-module-wowpvp at rt.cpan.org>, or through the web interface at | ||
| 130 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bot-BasicBot-Pluggable-Module-WoWPVP>. | ||
| 131 | I will be notified, and then you'll automatically be notified of progress on | ||
| 132 | your bug as I make changes. | ||
| 133 | |||
| 134 | =head1 SUPPORT | ||
| 135 | |||
| 136 | You can find documentation for this module with the perldoc command. | ||
| 137 | |||
| 138 | perldoc Bot::BasicBot::Pluggable::Module::WoWPVP | ||
| 139 | |||
| 140 | You can also look for information at: | ||
| 141 | |||
| 142 | =over 4 | ||
| 143 | |||
| 144 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 145 | |||
| 146 | L<http://annocpan.org/dist/Bot-BasicBot-Pluggable-Module-WoWPVP> | ||
| 147 | |||
| 148 | =item * CPAN Ratings | ||
| 149 | |||
| 150 | L<http://cpanratings.perl.org/d/Bot-BasicBot-Pluggable-Module-WoWPVP> | ||
| 151 | |||
| 152 | =item * RT: CPAN's request tracker | ||
| 153 | |||
| 154 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Bot-BasicBot-Pluggable-Module-WoWPVP> | ||
| 155 | |||
| 156 | =item * Search CPAN | ||
| 157 | |||
| 158 | L<http://search.cpan.org/dist/Bot-BasicBot-Pluggable-Module-WoWPVP> | ||
| 159 | |||
| 160 | =back | ||
| 161 | |||
| 162 | =head1 ACKNOWLEDGEMENTS | ||
| 163 | |||
| 164 | =head1 COPYRIGHT & LICENSE | ||
| 165 | |||
| 166 | Copyright 2006 Franck CUNY, all rights reserved. | ||
| 167 | |||
| 168 | This program is free software; you can redistribute it and/or modify it | ||
| 169 | under the same terms as Perl itself. | ||
| 170 | |||
| 171 | =cut | ||
| 172 | |||
| 173 | 1; # End of Bot::BasicBot::Pluggable::Module::WoWPVP | ||