View Single Post
  #1  
Old 07-26-2017, 07:57 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default Custom Zone Teleporter

This script is basically one of many scripts in what I call my "Cluster Fuck" folder. The idea behind this script is to allow you to establish a chain of progression using a teleporter. I wrote some super noob-friendly comments in the code if you need them to explain.

To use this script you will need the plugins from this post.

Code:
sub EVENT_SAY {
    ## Zones Hash: Key => ["zone short name", "zone long name", required level, required zone flag]
    my %zones = (0 => ["guildlobby", "Guild Lobby", 0, 0],
    1 => ["guildhall", "Guild Hall", 65, 0],
    2 => ["kurn", "Kurn's Tower", 0, 0],
    3 => ["blackburrow", "Blackburrow", 10, 0],
    4 => ["warrens", "The Warrens", 20, 0],
    5 => ["dulak", "Dulak's Harbor", 35, 0],
    6 => ["runnyeye", "The Liberated Citadel of Runny Eye", 35, 0],
    7 => ["pofire", "Plane of Fire", 47, 0],
    8 => ["bothunder", "Bastion of Thunder", 60, 0],
    9 => ["potimea", "[Pre Tier 1] Plane of Time A", 70, 0],
    10 => ["kodtaz", "[Pre Tier 1] Kod`Taz", 70, 0],
    11 => ["tipt", "[Tier 1] Tipt, Treacherous Crags", 70, 289],
    12 => ["veeshan", "[Tier 2] Hall of Serpents", 70, 210],
    13 => ["solteris", "[Tier 3] Stronghold of Gods", 70, 211],
    14 => ["necropolis", "[Tier 4] Lucifer's Nightmare", 70, 211]);
    ## Checks flag for Tier 3 and higher zones
    if (!quest::has_zone_flag(211)) {
        ## Flag Items Array: List of items to flag for the next zone
        my @flag_items = (2383, 121084, 121129, 121153, 121242, 122017, 122085, 122100, 122112, 122126, 122130, 122141, 122166, 122184, 122199, 122212, 122221, 122236, 122240, 122266, 122277, 122281, 122289, 122295, 122313, 122345, 122359, 122372, 122410, 122427, 122438, 122444, 122451, 122470, 122485, 122487, 122501, 122588);
        ## Checks if the client has any of the items within @flag_items
        if (plugin::check_hasitem_array($client, @flag_items)) {
            quest::set_zone_flag(211);
        }
    }
    
    if ($text=~/Hail/i) {
        plugin::Whisper("Would you like me to " . quest::saylink("list", 1) . " the custom zones available to you?");
    } elsif ($text=~/List/i) {
        plugin::Whisper("You may go to the following zones.");
        ## Loops through each key of the %zones hash and sorts them ascendingly them based on their numerical value
        foreach my $key (sort {$a <=> $b} keys %zones) {
            ## Checks if the client is high enough level
            if ($ulevel >= $zones{$key}[2]) {
                ## Checks if the zone has a flag requirement
                if ($zones{$key}[3] == 0) {
                    plugin::Whisper(quest::saylink($key, 1, $zones{$key}[1]));
                } elsif ($zones{$key}[3] != 0 && quest::has_zone_flag($zones{$key}[3])) {
                    plugin::Whisper(quest::saylink($key, 1, $zones{$key}[1]));
                }
            }
        }
    } elsif ($text!~/Hail|List/i) {
        ## Checks if the text is within %zones keys and if the client is high enough level
        if (defined $zones{$text} && $ulevel >= $zones{$text}[2]) {
            ## Checks if the zone has a flag requirement
            if ($zones{$text}[3] == 0) {
                quest::zone($zones{$text}[0]);
            } elsif ($zones{$text}[3] != 0 && quest::has_zone_flag($zones{$text}[3])) {
                quest::zone($zones{$text}[0]);
            }
        }
    }
}
Reply With Quote