Code:
sub castdelay{
$delayOver = (time + @_[0]);
while (time < $delayOver){}
1;
}
sub EVENT_SPAWN {
quest::settimer("portershout",90);
}
sub EVENT_TIMER {
if($timer eq "portershout") {
quest::shout("Porting to all druid locations! Hail me near tunnel to Qeynos Hills!");
$random_number = int(rand(100))+30; ## Randomizes porter shout after initial 90 second delay but no less than 30 seconds between shouts
quest::settimer("portershout", $random_number);
}
}
sub EVENT_SAY{
if ($text=~/Hail/i) {
plugin::Whisper("Hail! Where would you like to go? [Surefall] Glade, [Butcherblock] Mountains, The [Feerrott], North [Karana], [Lavastorm] Mountains, [Misty] Thicket, [South Ro], [Steamfont] Mountains, West [Commonlands] or [Toxxulia] Forest?");
}
elsif ($text=~/Commonlands/i) {
quest::say("Off to West Commonlands!");
$npc->DoAnim(43); #Cast animation
$client->SpellEffect(43,10); #Cast spell effect
castdelay(5); #invoke delay subroutine
quest::selfcast(34); #selfcast superior camo
quest::movepc(21, 1427, 479, -51, 0); #move PC to (zoneid, x, y, z, heading)
}
elsif ($text=~/Surefall/i) {
quest::say("Off to Surefall Glade!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(3, -391, -209, 4.75, 0);
}
elsif ($text=~/butcherblock/i) {
quest::say("Off to Butcherblock Mountains!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(68, 1984, -2135, 0);
}
elsif ($text=~/feerrott/i) {
quest::say("Off to The Feerrott!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(47, -1885, 367, 13.57, 0);
}
elsif ($text=~/karana/i) {
quest::say("Off to North Karana!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(13, -1494, -2706, -7.5, 0);
}
elsif ($text=~/lavastorm/i) {
quest::say("Off to Lavastorm Mountains!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(27, 460, 460, -84.88, 0);
}
elsif ($text=~/misty/i) {
quest::say("Off to Misty Thicket!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(33, -1896, -490, 120.34, 0);
}
elsif ($text=~/south ro/i) {
quest::say("Off to South Ro!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(35, 317, -2034, -22.64, 0);
}
elsif ($text=~/steamfont/i) {
quest::say("Off to Steamfont Mountains!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(56, 1668, -1779, -108.07, 0);
}
elsif ($text=~/toxxulia/i) {
quest::say("Off to Toxxulia Forest!");
$npc->DoAnim(43);
$client->SpellEffect(43,10);
castdelay(5);
quest::selfcast(34);
quest::movepc(56, -357, 1099, -57.93, 0);
}
}
Any optimization tips are more than welcome. Functionality-wise I think I'm there.