PDA

View Full Version : Zone Recommendations with Porting


ghanja
03-28-2017, 04:35 PM
I'll revisit this, as I whipped this together real quick before running out. But, I wanted to share for now to get it up on the board in the case I would forget later (which wouldn't be unlike me):


%recommendhash = (
1 => [[1..9],["crushbone","unrest"]],
2 => [[10..19],["crushbone","unrest"]],
3 => [[20..29],["crushbone","unrest"]],
4 => [[30..39],["crushbone","unrest"]],
5 => [[40..49],["crushbone","unrest"]],
6 => [[50..59],["crushbone","unrest"]],
7 => [[60..69],["crushbone","unrest"]],
9 => [[70..79],["crushbone","unrest"]],
);

sub EVENT_SAY
{
if ($text=~/Hail/i)
{
plugin::Whisper("Seeking our custom zones? I can ".quest::saylink("recommend",1)." zones based on your level.");
}
elsif ($text=~/recommend/i)
{
foreach $key (keys %recommendhash)
{
if ($ulevel ~~ @{$recommendhash{$key}[0]})
{
$formattedstring = undef;
for ($i = 0; $i <= ((scalar @{$recommendhash{$key}[1]}) - 1); $i++)
{
if ($i < ((scalar @{$recommendhash{$key}[1]}) - 1))
{
$formattedstring .= quest::saylink("xxxx".$recommendhash{$key}[1][$i],1,"[".plugin::Zone("LN",$recommendhash{$key}[1][$i])."], ");
} else {
$formattedstring .= " and ".quest::saylink("xxxx".$recommendhash{$key}[1][$i],1,"[".plugin::Zone("LN",$recommendhash{$key}[1][$i])."].");
}
}
$hashkey = $key;
plugin::Whisper("I recommend the following: ".$formattedstring);
}
}
plugin::Whisper("I have no recommended zones for you.") if (!defined $formattedstring);
}
elsif ($text=~/^xxxx/)
{
@portargument = split('xxxx', $text);
plugin::Whisper("$name, stand close to me while I take you there!");
quest::doanim(42);
quest::emote ("hands begin to move wildly.");
quest::zone ($portargument[1]);
}
}


Requires Kingly's Zone.pl plugin

Only checked for syntax atm and there is likely a more eloquent way to code it, but, was a quickie. Posted in discord figured I'd place here for prosperity.

*Edit: Feel free to modify the hash for whatever ranges of levels that apply to you, as well as the possible zone shortnames for said ranges. Doesn't matter what the keys are (i.e. 1 =>, 2=>, etc.) as they aren't used, I have them in order just because it happened that way while writing it.

javewow
08-20-2017, 11:50 PM
Can it be the same as poptime?

popttiem(223) zone is copy
A-palyer-inport--zone copy 223
B-palyer-inport--zone copy 223
C-palyer-inport--zone copy 223

zone name 223

Do you know the custom? zone copy