Advertisement
Guest User

Level-based Teleporter.pl

a guest
Nov 18th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.26 KB | None | 0 0
  1. sub EVENT_SAY
  2. {
  3.     my %zonelist = (1 => [1, 5],
  4.     2 => [1, 10],
  5.     3 => [1, 15],
  6.     4 => [1, 20],
  7.     5 => [1, 25],
  8.     6 => [1, 30],
  9.     8 => [1, 35],
  10.     9 => [1, 40],
  11.     10 => [1, 45],
  12.     11 => [1, 50],
  13.     12 => [1, 55],
  14.     13 => [1, 60]);
  15.    
  16.     if($text=~/Hail/i)
  17.     {
  18.         plugin::Whisper("Hello, $name, would you like me to list " . quest::saylink("all", 1) . " the zones you can currently go to at level " . $ulevel . "?");
  19.     }
  20.    
  21.     if($text=~/^All$/i)
  22.     {  
  23.         foreach $key(sort {$a <=> $b} keys %zonelist)
  24.         {
  25.             if($ulevel >= $zonelist{$key}[0] && $ulevel <= $zonelist{$key}[1])
  26.             {
  27.                 plugin::Whisper("Level $zonelist{$key}[0] - Level $zonelist{$key}[1]: " . quest::saylink("zone $key", 1, plugin::Zone($key)));
  28.             }
  29.         }
  30.     }
  31.    
  32.     if($text=~/^Zone/i)
  33.     {
  34.         foreach $zone(keys %zonelist)
  35.         {
  36.             if(substr($text, 5) == $zone)
  37.             {
  38.                 if($ulevel >= $zonelist{substr($text, 5)}[0] && $ulevel <= $zonelist{substr($text, 5)}[1])
  39.                 {
  40.                     quest::zone(plugin::ZoneShortName(substr($text, 5)));
  41.                 }
  42.                
  43.                 elsif($ulevel < $zonelist{substr($text, 5)})
  44.                 {
  45.                     plugin::Whisper("You are not high enough level for this zone.");
  46.                 }
  47.                
  48.                 elsif($ulevel > $zonelist{substr($text, 5)})
  49.                 {
  50.                     plugin::Whisper("You are too high level for this zone.");
  51.                 }
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement