Advertisement
Guest User

Waypoint Code 1.8.4

a guest
Apr 2nd, 2013
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 112.67 KB | None | 0 0
  1. #####################################################################################################################################################
  2. #####################################################################################################################################################
  3. ### FILE NAME           : global_player.pl
  4. ### VERSION             : 1.8.4
  5. ### UPDATED             : April 2, 2013
  6. ### QUEST               : Create Solo, Raid, and Guild instances with custom invites
  7. ### REQURIED PLUGIN 1   : globals.pl (plugin::var, plugin::val) for subs to get variable values (Might copy plugins to a sub later)
  8. ### REQURIED PLUGIN 2   : check_hasitem.pl (plugin::check_hasitem) to determine prices via item
  9. ### ITEM IDS            : 119998 = Waypoint, 120003 = Free Waypoint
  10. ### QGLOBAL VARIABLE    : XXX = Instance ID, YYY = Auto Increment ID
  11. ### QGLOBAL SOLO        : $name_Solo_$zonesn_$zoneid
  12. ### QGLOBAL RAID        : $name_Raid_$zonesn_$zoneid, XXX_RaidI_Leader, XXX__RaidI_Time, XXX_RaidI_$zonesn_$zoneid, XXX_RaidI_Status_YYY
  13. ### QGLOBAL GUILD       : $name_Guild_$zonesn_$zoneid, XXX_Guild_$zonesn_$zoneid, XXX_GuildI_Leader, XXX__GuildI_Time, XXX_GuildI_$zonesn_$zoneid, XXX_GuildI_Status_YYY
  14. ### QGLOBAL SPAM DELAY  : SPAM_SOLO_$zonesn_$name, SPAM_GUILD_$zonesn_$name, SPAM_RAID_$zonesn_$name (Set to 3600 seconds to re-create instances)
  15. ### Special Thanks      : Used code from Bamron, Hateborne, Natedog, Trevius, Akkadius, Secrets, and a few other people
  16. ###
  17. ### STUFF TO DO         :
  18. ###                       ** Change Hunter_Raid_cshome_26 to Hunter_RaidI_cshome_26
  19. ###                       ** Change Hunter_Guild_cshome_26 to Hunter_GuildI_cshome_26
  20. ###                       ** Change SPAM_RAID_cshome_Hunter to SPAM_RaidI_cshome_Hunter
  21. ###                       ** Change SPAM_GUILD_cshome_Hunter to SPAM_GuildI_cshome_Hunter
  22. ###                       ** Change 5_Guild_cshome_26 to 5_GuildI_cshome_26
  23. ###                       ** Change solo to SoloI
  24. ###                       Add: Time Remaining of instance on Popup window info when creating instance
  25. ###                       Edit: change syntax to have symbol ("#" or ".") in front of commands
  26. ###                       Maybe Use: my $GuildName = $client->GuildID(); my $GuildName = quest::getguildnamebyid($guildID);
  27. ###                       Maybe Use: my $RaidGroup = $client->GetRaid(); my $raidID = $RaidGroup->GetID();
  28. ###                       Add: One command from leader to invite/teleport entire guild/raid into the instance
  29. ###
  30. ### OTHER NOTES         : This code was revamped to use DBI for reading QGlobals
  31. ###
  32. ### CHANGES             :
  33. ###                         04/02/2013
  34. ###                         Changed method for getting user/password for DBI
  35. ###                         Prevent non-guilded players from making guild instance for id -1
  36. ###                         Fixed the ability to invite and remove players into an instance from ANY zone.
  37. ###                         Revamped to use DBI to read qglobals since zones don't always refresh memory
  38. ###                         Created function with DBI to check for expired qglobals
  39. ###                         Updated DBI for GM tools to read user name and password from config file
  40. ###                         Make instances all free for now to test new code
  41. ###                         Made commons and overthere (pvp zones) to be 999999999 cost as a way of disable instances from those zones
  42. ###                         Added quest::AssignToInstance(); to a few more locations
  43. ###
  44. ###                         04/01/2013
  45. ###                         Added ability to invite Raid/Guild members all on one line separated by comma
  46. ###                         Added GM commands to "find" and "goto" player which helps to find players and teleport to them in an intstance
  47. ###                         Added ListZoneSNToID2() for find and goto GM commands
  48. ###                         Added 15 minute delay to delete instances so that player don't delete instance before they can re-create it
  49. ###                         Updated Waypoint.pl for adding funds to account, but no menu or instances.
  50. ###
  51. ###                         03/31/2013
  52. ###                         Added Qglobal $name_Guild_$zonesn_$zoneid
  53. ###                         guild join and raid join now use <name> instead of <id>
  54. ###                         Player gets message of being BANNED when getting banned, or trying to join when banned
  55. ###                         Player gets message that you were not invited if trying to join before getting invited
  56. ###                         Added command Waypoint to bring up the menu in addition to Instance or Instances
  57. ###                         Added Spam Delay Global for Creating Instances in same zone and tell player how many seconds left to create again
  58. ###
  59. ###                         03/30/2013
  60. ###                         Changed menu system, put some commands under the "More Options" saylink to reduce menu size
  61. ###                         Changed instance durations from 14400 to 259200 (4 hrs to 72 hrs)
  62. ###                         Updated prices and per zone and per type
  63. ###                         Created sub zone id to zone name (Hope I didn't re-create something that already exist lol)
  64. ###                         Added $zoneid to $zonesn in qglobal name and passed to $signal, telling players in a different zone which zone to be used
  65. ###                         $signal remove - greater than 1000000000 (1 billion) = remove player from instance
  66. ###                         $signal zone id - has $zoneid * 1000000 (1 million) for $zoneid to pass through signal via int ($signal / 1000000)
  67. ###                         $signal instance id - has instance id passed by int ($signal % 1000000) to get the value under 1 million for instance id
  68. ###                         Updated signal to give message to player that was invited regardless of any status (pending, joined, removed)
  69. ###                         Added with the above update, players can re-invite players that did not receive the message or was zoning at the time, etc.
  70. ###                         Updated Popup window info when being invited, removed, or choosing to leave instance
  71. #####################################################################################################################################################
  72. #####################################################################################################################################################
  73.  
  74. sub EVENT_SAY
  75. {
  76.  
  77.     ###############################################################################################
  78.     # START GM COMMAND ############################################################################
  79.     # Find if player is in an instance, other info, etc before trying to goto them
  80.     if ($text=~/^find/i && $status > 150)
  81.     {
  82.         my $lostperson = substr($text, 5);
  83.         FIND_PLAYER_INSTANCE($lostperson);
  84.     }
  85.     # Can goto player last known zone/instance and XYZ position via DBI and character_ table
  86.     # Useful for finding players when they belong to many instances
  87.     if ($text=~/^goto/i && $status > 150)
  88.     {
  89.         my $lostperson = substr($text, 5);
  90.         GOTO_PLAYER_INSTANCE($lostperson);
  91.     }
  92.     # END GM COMMAND ##############################################################################
  93.     ###############################################################################################
  94.  
  95.     my $SoloStatus      = 1;
  96.     my $GuildStatus     = 1;
  97.     my $RaidStatus      = 1;
  98.  
  99.     if ($text=~/^Instance$/i || $text=~/^Instances$/i || $text=~/^Waypoint$/i)
  100.     {
  101.         my $freeinstance = plugin::check_hasitem($client, 120003);  #EDIT item ID for FREE instance item
  102.         my $paidinstance = plugin::check_hasitem($client, 119998);  #EDIT item ID for PAID instance item
  103.         $client->Message(315," ");
  104.         if ($freeinstance)
  105.         {
  106.             $client->Message(315,"Free Waypoint Menu");
  107.             $client->Message(315,"------------------------------");
  108.         }
  109.         elsif ($paidinstance)
  110.         {
  111.             $client->Message(315,"Reglar Waypoint Menu");
  112.             $client->Message(315,"---------------------------------");
  113.         }
  114.         else
  115.         {
  116.             $client->Message(315,"Non Discount Waypoint Menu");
  117.             $client->Message(315,"-------------------------------------------");
  118.         }
  119.     }
  120.  
  121.     ###############################################################################################
  122.     ### START SOLO INSTANCES ######################################################################
  123.     if ($SoloStatus == 1)
  124.     {
  125.         if ($text=~/^Instance$/i || $text=~/^Instances$/i || $text=~/^Waypoint$/i)
  126.         {
  127.             my $SoloInstanceID  = "$name" . "_Solo_" . "$zonesn" . "_" . "$zoneid";
  128.             if (GET_QGLOBAL_VALUE("$SoloInstanceID"))
  129.             {
  130.                 my $EnterSoloInstance = quest::saylink("Enter Solo", 1);
  131.                 my $DeleteSoloInstance = quest::saylink("Delete Solo", 1);
  132.                 $client->Message(315,"[$EnterSoloInstance] [$DeleteSoloInstance]");
  133.             }
  134.             else
  135.             {
  136.                 my $SoloCreate = quest::saylink("Create Solo Instance", 1);
  137.                 my $SoloCost = SOLO_PRICE();
  138.                 $client->Message(315,"[$SoloCreate] : $SoloCost Platinum");
  139.             }
  140.             $qglobals{"$SoloInstanceID"} = undef;
  141.         }
  142.  
  143.         if($text=~/^Create Solo Instance$/i)
  144.         {
  145.             my $SoloInstanceID  = "$name" . "_Solo_" . "$zonesn" . "_" . "$zoneid";
  146.             if (GET_QGLOBAL_VALUE("$SoloInstanceID"))
  147.             {
  148.                 $client->Message(315,"You already have a Solo instance for $zonesn.");
  149.             }
  150.             else
  151.             {
  152.                 my $accountid = $client->AccountID();
  153.                 my $bankcredit = GET_QGLOBAL_VALUE("BankCredit_$accountid");
  154.                 my $SoloCost = SOLO_PRICE();
  155.                 my $cost = $SoloCost;
  156.                 my $SPAM_NAME = "SPAM_SOLO_" . $zonesn . "_$name";
  157.                 my $SPAM_TIME = 600; # Make 3600 / 1 HR
  158.                 if ($bankcredit < $cost)
  159.                 {
  160.                     $client->Message(315,"You need ". ($cost - $bankcredit) . " more plat!");
  161.                 }
  162.                 elsif (GET_QGLOBAL_VALUE_EXPIRE("$SPAM_NAME"))
  163.                 {
  164.                     my $SPAM_VALUE  = GET_QGLOBAL_VALUE("$SPAM_NAME");
  165.                     my $TIME_LEFT   = $SPAM_TIME + $SPAM_VALUE - time();
  166.                     $client->Message(315,"You can create another Solo Instance in $TIME_LEFT seconds.");
  167.                 }
  168.                 else
  169.                 {
  170.                     quest::setglobal("$SPAM_NAME",time(),"7","S$SPAM_TIME"); # PREVENT CREATE SPAM FOR THIS ZONE
  171.                     PayInstance("BankCredit", $cost, "Solo Instance");
  172.                     my $InstVersion = 0;            # Must be 0 to load NPCs into an instance
  173.                     my $InstanceDuration = 259200;
  174.                     my $EnterSoloInstance = quest::saylink("Enter Solo", 1);
  175.                     my $InstID = quest::CreateInstance("$zonesn", $InstVersion, $InstanceDuration);
  176.                     quest::setglobal("$SoloInstanceID","$InstID","7","S$InstanceDuration");
  177.                     quest::AssignToInstance($InstID);
  178.                     # $client->Message(315," ");
  179.                     $client->Message(315,"You created a solo instance ($InstID) for $zonesn.");
  180.                     $client->Message(315,"Would you like to $EnterSoloInstance instance?");
  181.                 } # create instance then send
  182.                 $qglobals{"$SPAM_NAME"}  = undef;
  183.             }
  184.             $qglobals{"$SoloInstanceID"} = undef;
  185.         }
  186.  
  187.         if($text=~/^Enter Solo$/i)
  188.         {
  189.             my $SoloInstanceID = "$name" . "_Solo_" . "$zonesn" . "_" . "$zoneid";
  190.             if (GET_QGLOBAL_VALUE("$SoloInstanceID"))
  191.             {
  192.                 my $timestamp = localtime(time);
  193.                 my $InstID = GET_QGLOBAL_VALUE("$SoloInstanceID");
  194.                 my $Cx = $client->GetX();
  195.                 my $Cy = $client->GetY();
  196.                 my $Cz = $client->GetZ();
  197.                 quest::popup("ENTER SOLO INSTANCE","<br>
  198.                             <c \"#FE2E2E\">Moving you to SOLO instance!<br>
  199.                             <br>
  200.                             <c \"#FFFF49\">Time : &nbsp;&nbsp;&nbsp;<c \"#00FF00\">$timestamp<br>
  201.                             <c \"#FFFF49\">Name : &nbsp; <c \"#00FF00\">$name<br>
  202.                             <c \"#FFFF49\">Zone : &nbsp;&nbsp;&nbsp; <c \"#00FF00\">$zonesn<br>
  203.                             <c \"#FFFF49\">Type : &nbsp;&nbsp;&nbsp;&nbsp; <c \"#00FF00\">Solo<br>
  204.                             <br>
  205.                             <c \"#00BFFF\">ENJOY!<br>
  206.                             <br>
  207.                             <br>
  208.                             ",1050,0);
  209.                 $client->Message(315, " ");
  210.                 $client->Message(315, "Moving you to solo instance ($InstID) for $zonesn.");
  211.                 quest::AssignToInstance($InstID);
  212.                 quest::MovePCInstance($zoneid, $InstID, $Cx, $Cy, $Cz);
  213.             }
  214.             else
  215.             {
  216.                 $client->Message(315,"You do not have a solo instance for $zonesn.");
  217.             } # create instance then send
  218.             $qglobals{"$SoloInstanceID"} = undef;
  219.         }
  220.  
  221.         if ($text=~/^Delete Solo$/i)
  222.         {
  223.             my $SoloInstanceID  = "$name" . "_Solo_" . "$zonesn" . "_" . "$zoneid";
  224.             if (GET_QGLOBAL_VALUE("$SoloInstanceID"))
  225.             {
  226.                 $client->Message(315," ");
  227.                 my $SPAM_NAME = "SPAM_SOLO_" . $zonesn . "_$name";
  228.                 my $SPAM_TIME = 600; # Make 3600 / 1 HR
  229.                 if (GET_QGLOBAL_VALUE_EXPIRE("$SPAM_NAME"))
  230.                 {
  231.                     my $SPAM_VALUE  = GET_QGLOBAL_VALUE("$SPAM_NAME");
  232.                     my $TIME_LEFT   = $SPAM_TIME + $SPAM_VALUE - time();
  233.                     $client->Message(315,"You can't delete Solo Instance for $TIME_LEFT more seconds.");
  234.                 }
  235.                 else
  236.                 {
  237.                     my $InstID = GET_QGLOBAL_VALUE("$SoloInstanceID");
  238.                     quest::DestroyInstance($InstID);
  239.                     quest::delglobal($SoloInstanceID);
  240.                     $client->Message(315, "Solo Instance ($InstID) Deleted!");
  241.                 }
  242.             }
  243.             else
  244.             {
  245.                 $client->Message(315, "You do not have a solo instance to delete!");
  246.             }
  247.             $qglobals{"$SoloInstanceID"} = undef;
  248.         }
  249.     }
  250.     ###  END SOLO INSTANCES #######################################################################
  251.     ###############################################################################################
  252.  
  253.  
  254.     ###############################################################################################
  255.     ### START RAID INSTANCES #####################################################################
  256.     if ($RaidStatus == 1)
  257.     {
  258.         if ($text=~/^Instance$/i || $text=~/^Instances$/i || $text=~/^Waypoint$/i)
  259.         {
  260.             my $RaidID = $name;
  261.             my $RaidInstanceID = "$RaidID" . "_Raid_" . "$zonesn" . "_" . "$zoneid";
  262.             if (GET_QGLOBAL_VALUE("$RaidInstanceID"))
  263.             {
  264.                 my $EnterRaidInstance       = quest::saylink("Enter Raid", 1);
  265.                 my $DeleteRaidInstance      = quest::saylink("Delete Raid", 1);
  266.                 my $RaidList                = quest::saylink("Raid List", 1);
  267.                 $client->Message(315,"[$EnterRaidInstance] [$DeleteRaidInstance] [$RaidList]");
  268.             }
  269.             else
  270.             {
  271.                 my $RaidCreate = quest::saylink("Create Raid Instance", 1);
  272.                 my $RaidCost = RAID_PRICE();
  273.                 $client->Message(315,"[$RaidCreate] : $RaidCost Platinum");
  274.             }
  275.             $qglobals{"$RaidInstanceID"} = undef;
  276.         }
  277.  
  278.         if($text=~/^Create Raid Instance$/i)
  279.         {
  280.             my $RaidID = $name;
  281.             my $RaidInstanceID = "$RaidID" . "_Raid_" . "$zonesn" . "_" . "$zoneid";
  282.             if (GET_QGLOBAL_VALUE("$RaidInstanceID"))
  283.             {
  284.                 $client->Message(315,"You already have a Raid Instance for $zonesn.");
  285.             }
  286.             else
  287.             {
  288.                 my $accountid = $client->AccountID();
  289.                 my $bankcredit = GET_QGLOBAL_VALUE("BankCredit_$accountid");
  290.                 my $RaidCost = RAID_PRICE();
  291.                 my $cost = $RaidCost;
  292.                 my $SPAM_NAME = "SPAM_RAID_" . $zonesn . "_$name";
  293.                 my $SPAM_TIME = 600; # Make 3600 / 1 HR
  294.                 if ($bankcredit < $cost)
  295.                 {
  296.                     $client->Message(315,"You need ". ($cost - $bankcredit) . " more plat!");
  297.                 }
  298.                 elsif (GET_QGLOBAL_VALUE_EXPIRE("$SPAM_NAME"))
  299.                 {
  300.                     my $SPAM_VALUE  = GET_QGLOBAL_VALUE("$SPAM_NAME");
  301.                     my $TIME_LEFT   = $SPAM_TIME + $SPAM_VALUE - time();
  302.                     $client->Message(315,"You can create another Raid Instance in $TIME_LEFT seconds.");
  303.                 }
  304.                 else
  305.                 {
  306.                     quest::setglobal("$SPAM_NAME",time(),"7","S$SPAM_TIME"); # PREVENT CREATE SPAM FOR THIS ZONE
  307.  
  308.                     PayInstance("BankCredit", $cost, "Raid Instance");
  309.                     my $InstVersion = 0; # Must be 0 to load NPCs in an instance
  310.                     my $InstanceDuration = 259200;
  311.                     my $EnterRaidInstance = quest::saylink("Enter Raid", 1);
  312.                     my $InstID = quest::CreateInstance("$zonesn", $InstVersion, $InstanceDuration);
  313.  
  314.                     my $LeaderZone = $InstID . "_RaidI_" . $zonesn . "_" . "$zoneid";               # Qglobal name for Raid Instance ID + zone to do raid invites
  315.                     quest::setglobal("$LeaderZone","$InstID","7","S$InstanceDuration");             # Qglobal name for Raid Instance ID + zone to do raid invites
  316.  
  317.                     my $LeaderName = $InstID . "_RaidI_Leader";                                     # Qglobal Instance/Zone ID to Leaders Name
  318.                     quest::setglobal("$LeaderName","$name","7","S$InstanceDuration");               # Qglobal Instance/Zone ID to Leaders Name
  319.  
  320.                     my $LeaderTime = $InstID . "_RaidI_Time";                                       # Qglobal Raid Instance Timer
  321.                     my $Expire_Time = time() + $InstanceDuration;                                   # Qglobal Raid Instance Timer
  322.                     quest::setglobal("$LeaderTime","$Expire_Time","7","S$InstanceDuration");        # Qglobal Raid Instance Timer
  323.  
  324.                     quest::setglobal("$RaidInstanceID","$InstID","7","S$InstanceDuration");         # Qglobal Set Raid Instance ID
  325.                     quest::AssignToInstance($InstID);
  326.                     # $client->Message(315," ");
  327.                     $client->Message(315,"You created a Raid Instance ($InstID) for $zonesn.");
  328.                     $client->Message(315,"Would you like to $EnterRaidInstance instance?");
  329.                     $qglobals{"$LeaderZone"} = undef;
  330.                     $qglobals{"$LeaderName"} = undef;
  331.                 } # create instance then send
  332.                 $qglobals{"$SPAM_NAME"}  = undef;
  333.             }
  334.             $qglobals{"$RaidInstanceID"} = undef;
  335.         }
  336.  
  337.         if($text=~/^Enter Raid$/i)
  338.         {
  339.             my $RaidID = $name;
  340.             my $RaidInstanceID = "$RaidID" . "_Raid_" . "$zonesn" . "_" . "$zoneid";
  341.             if (GET_QGLOBAL_VALUE("$RaidInstanceID"))
  342.             {
  343.                 my $timestamp = localtime(time);
  344.                 my $InstID = GET_QGLOBAL_VALUE("$RaidInstanceID");
  345.                 my $Cx = $client->GetX();
  346.                 my $Cy = $client->GetY();
  347.                 my $Cz = $client->GetZ();
  348.                 quest::popup("ENTER RAID INSTANCE","<br>
  349.                             <c \"#FE2E2E\">Moving you to a RAID instance!<br>
  350.                             <br>
  351.                             <c \"#FFFF49\">Time : &nbsp;&nbsp;&nbsp;<c \"#00FF00\">$timestamp<br>
  352.                             <c \"#FFFF49\">Name : &nbsp; <c \"#00FF00\">$name<br>
  353.                             <c \"#FFFF49\">Zone : &nbsp;&nbsp;&nbsp; <c \"#00FF00\">$zonesn<br>
  354.                             <c \"#FFFF49\">Type : &nbsp;&nbsp;&nbsp;&nbsp; <c \"#00FF00\">Raid<br>
  355.                             <br>
  356.                             <c \"#00BFFF\">ENJOY!<br>
  357.                             <br>
  358.                             ",1050,0);
  359.                 $client->Message(315, " ");
  360.                 $client->Message(315, "Moving you to Raid Instance ($InstID) for $zonesn.");
  361.                 quest::AssignToInstance($InstID);
  362.                 quest::MovePCInstance($zoneid, $InstID, $Cx, $Cy, $Cz);
  363.             }
  364.             else
  365.             {
  366.                 $client->Message(315,"You do not have a Raid Instance for $zonesn.");
  367.             }   # create instance then send
  368.             $qglobals{"$RaidInstanceID"} = undef;
  369.         }
  370.  
  371.         if ($text=~/^Delete Raid$/i)
  372.         {
  373.             $client->Message(315, " ");
  374.             my $RaidID = $name;
  375.             my $RaidInstanceID = "$RaidID" . "_Raid_" . "$zonesn" . "_" . "$zoneid";
  376.             if (GET_QGLOBAL_VALUE("$RaidInstanceID"))
  377.             {
  378.                 my $SPAM_NAME = "SPAM_RAID_" . $zonesn . "_$name";
  379.                 my $SPAM_TIME = 600; # Make 3600 / 1 HR
  380.                 if (GET_QGLOBAL_VALUE_EXPIRE("$SPAM_NAME"))
  381.                 {
  382.                     my $SPAM_VALUE  = GET_QGLOBAL_VALUE("$SPAM_NAME");
  383.                     my $TIME_LEFT   = $SPAM_TIME + $SPAM_VALUE - time();
  384.                     $client->Message(315,"You can't delete Raid Instance for $TIME_LEFT more seconds.");
  385.                 }
  386.                 else
  387.                 {
  388.                     my $InstID = GET_QGLOBAL_VALUE("$RaidInstanceID");
  389.                     my $LeaderZone = $InstID . "_RaidI_" . $zonesn . "_" . "$zoneid";       # Qglobal name for charid + zonesn to invite raid
  390.                     my $LeaderName = $InstID . "_RaidI_Leader";                             # Qglobal ID to Name
  391.                     my $LeaderTime = $InstID . "_RaidI_Time";                               # Qglobal Time
  392.  
  393.                     # DELETE Raid Player Invited List
  394.                     my $count = 1;
  395.                     my $raid_invite_name = $InstID . "_RaidI_Status_";
  396.                     my $temp_del = "";
  397.                     while ($count > 0)
  398.                     {
  399.                         if (GET_QGLOBAL_VALUE("$raid_invite_name$count"))
  400.                         {
  401.                             $temp_del = $raid_invite_name . $count;
  402.                             quest::delglobal($temp_del);
  403.                             $count ++;
  404.                         }
  405.                         else
  406.                         {
  407.                             $count = $count - 1;
  408.                             # quest::gmsay("GM: Deleted $count Invited Players!", 18, 0);
  409.                             $count = 0;
  410.                         }
  411.                     }
  412.                     # END DELETE Raid Player Invited List
  413.  
  414.                     quest::DestroyInstance($InstID);
  415.                     quest::delglobal($RaidInstanceID);
  416.                     quest::delglobal($LeaderZone);
  417.                     quest::delglobal($LeaderName);
  418.                     quest::delglobal($LeaderTime);
  419.                     $client->Message(315, "Raid Instance ($InstID) Deleted!");
  420.                     $qglobals{"$LeaderZone"} = undef;
  421.                     $qglobals{"$LeaderName"} = undef;
  422.                     $qglobals{"$LeaderTime"} = undef;
  423.                 }
  424.             }
  425.             else
  426.             {
  427.                 $client->Message(315, "You do not have a Raid Instance to delete!");
  428.             }
  429.             $qglobals{"$RaidInstanceID"} = undef;
  430.         }
  431.     }
  432.     ###  END RAID INSTANCES ######################################################################
  433.     ###############################################################################################
  434.  
  435.  
  436.     ###############################################################################################
  437.     ### START GUILD INSTANCES #####################################################################
  438.     if ($GuildStatus == 1)
  439.     {
  440.         if ($text=~/^Instance$/i || $text=~/^Instances$/i || $text=~/^Waypoint$/i)
  441.         {
  442.             my $GuildID = $uguild_id;
  443.             my $GuildInstanceID = "$GuildID" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";
  444.             if (GET_QGLOBAL_VALUE("$GuildInstanceID"))
  445.             {
  446.                 my $EnterGuildInstance      = quest::saylink("Enter Guild", 1);
  447.                 my $DeleteGuildInstance     = quest::saylink("Delete Guild", 1);
  448.                 my $GuildList               = quest::saylink("Guild List", 1);
  449.                 $client->Message(315,"[$EnterGuildInstance] [$DeleteGuildInstance] [$GuildList]");
  450.             }
  451.             else
  452.             {
  453.                 my $GuildCreate = quest::saylink("Create Guild Instance", 1);
  454.                 my $GuildCost = GUILD_PRICE();
  455.                 $client->Message(315,"[$GuildCreate] : $GuildCost Platinum");
  456.             }
  457.             $qglobals{"$GuildInstanceID"} = undef;
  458.         }
  459.  
  460.         if($text=~/^Create Guild Instance$/i && $uguild_id < 1)
  461.         {
  462.             $client->Message(315,"You do not belong to any guild!");
  463.         }
  464.         if($text=~/^Create Guild Instance$/i && $uguild_id > 0)
  465.         {
  466.             my $GuildID = $uguild_id;
  467.             my $GuildInstanceID = "$GuildID" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";    # Unique Guild Instance via Guild ID
  468.             my $GuildInstanceID2 = "$name" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";      # Who created Guild Instance, used for Invites
  469.             if (GET_QGLOBAL_VALUE("$GuildInstanceID"))
  470.             {
  471.                 $client->Message(315,"You already have a Guild Instance for $zonesn.");
  472.             }
  473.             else
  474.             {
  475.                 my $accountid = $client->AccountID();
  476.                 my $bankcredit = GET_QGLOBAL_VALUE("BankCredit_$accountid");
  477.                 my $GuildCost = GUILD_PRICE();
  478.                 my $cost = $GuildCost;
  479.                 my $SPAM_NAME = "SPAM_GUILD_" . $zonesn . "_$name";
  480.                 my $SPAM_TIME = 600; # Make 3600 / 1 HR
  481.                 if ($bankcredit < $cost)
  482.                 {
  483.                     $client->Message(315,"You need ". ($cost - $bankcredit) . " more plat!");
  484.                 }
  485.                 elsif (GET_QGLOBAL_VALUE_EXPIRE("$SPAM_NAME"))
  486.                 {
  487.                     my $SPAM_VALUE  = GET_QGLOBAL_VALUE("$SPAM_NAME");
  488.                     my $TIME_LEFT   = $SPAM_TIME + $SPAM_VALUE - time();
  489.                     $client->Message(315,"You can create another Guild Instance in $TIME_LEFT seconds.");
  490.                 }
  491.                 else
  492.                 {
  493.                     quest::setglobal("$SPAM_NAME",time(),"7","S$SPAM_TIME"); # PREVENT CREATE SPAM FOR THIS ZONE
  494.  
  495.                     PayInstance("BankCredit", $cost, "Guild Instance");
  496.                     my $InstVersion = 0;            # MUST be 0 to load NPCs in an instance!
  497.                     my $InstanceDuration = 259200;
  498.                     my $EnterGuildInstance = quest::saylink("Enter Guild", 1);
  499.                     my $InstID = quest::CreateInstance("$zonesn", $InstVersion, $InstanceDuration);
  500.  
  501.                     my $LeaderZone = $InstID . "_GuildI_" . $zonesn . "_" . "$zoneid";              # Qglobal name for Guild Instance ID + zone to do guild invites
  502.                     quest::setglobal("$LeaderZone","$InstID","7","S$InstanceDuration");             # Qglobal name for Guild Instance ID + zone to do guild invites
  503.  
  504.                     my $LeaderName = $InstID . "_GuildI_Leader";                                    # Qglobal Instance/Zone ID to Leaders Name
  505.                     quest::setglobal("$LeaderName","$name","7","S$InstanceDuration");               # Qglobal Instance/Zone ID to Leaders Name
  506.  
  507.                     my $LeaderTime = $InstID . "_GuildI_Time";                                      # Qglobal Guild Instance Timer
  508.                     my $Expire_Time = time() + $InstanceDuration;                                   # Qglobal Guild Instance Timer
  509.                     quest::setglobal("$LeaderTime","$Expire_Time","7","S$InstanceDuration");        # Qglobal Guild Instance Timer
  510.  
  511.                     quest::setglobal("$GuildInstanceID","$InstID","7","S$InstanceDuration");        # Qglobal Set Guild Instance ID
  512.                     quest::setglobal("$GuildInstanceID2","$InstID","7","S$InstanceDuration");       # Qglobal Set Guild Instance ID 2
  513.                     quest::AssignToInstance($InstID);
  514.                     # $client->Message(315," ");
  515.                     $client->Message(315,"You created a Guild Instance ($InstID) for $zonesn.");
  516.                     $client->Message(315,"Would you like to $EnterGuildInstance instance?");
  517.                     $qglobals{"$LeaderZone"} = undef;
  518.                     $qglobals{"$LeaderName"} = undef;
  519.                 } # create instance then send
  520.                 $qglobals{"$SPAM_NAME"}  = undef;
  521.             }
  522.             $qglobals{"$GuildInstanceID"} = undef;
  523.             $qglobals{"$GuildInstanceID2"} = undef;
  524.         }
  525.  
  526.         if($text=~/^Enter Guild$/i)
  527.         {
  528.             my $GuildID = $uguild_id;
  529.             my $GuildInstanceID = "$GuildID" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";
  530.             if (GET_QGLOBAL_VALUE("$GuildInstanceID"))
  531.             {
  532.                 my $timestamp = localtime(time);
  533.                 my $InstID = GET_QGLOBAL_VALUE("$GuildInstanceID");
  534.                 my $Cx = $client->GetX();
  535.                 my $Cy = $client->GetY();
  536.                 my $Cz = $client->GetZ();
  537.                 quest::popup("ENTER GUILD INSTANCE","<br>
  538.                             <c \"#FE2E2E\">Moving you to a GUILD instance!<br>
  539.                             <br>
  540.                             <c \"#FFFF49\">Time : &nbsp;&nbsp;&nbsp;<c \"#00FF00\">$timestamp<br>
  541.                             <c \"#FFFF49\">Name : &nbsp; <c \"#00FF00\">$name<br>
  542.                             <c \"#FFFF49\">Zone : &nbsp;&nbsp;&nbsp; <c \"#00FF00\">$zonesn<br>
  543.                             <c \"#FFFF49\">Type : &nbsp;&nbsp;&nbsp;&nbsp; <c \"#00FF00\">Guild<br>
  544.                             <br>
  545.                             <c \"#00BFFF\">ENJOY!<br>
  546.                             <br>
  547.                             ",1050,0);
  548.                 $client->Message(315, " ");
  549.                 $client->Message(315, "Moving you to Guild Instance ($InstID) for $zonesn.");
  550.                 quest::AssignToInstance($InstID);
  551.                 quest::MovePCInstance($zoneid, $InstID, $Cx, $Cy, $Cz);
  552.             }
  553.             else
  554.             {
  555.                 $client->Message(315,"You do not have a Guild Instance for $zonesn.");
  556.             }   # create instance then send
  557.             $qglobals{"$GuildInstanceID"} = undef;
  558.         }
  559.  
  560.         if ($text=~/^Delete Guild$/i)
  561.         {
  562.             $client->Message(315, " ");
  563.             my $GuildID = $uguild_id;
  564.             my $GuildInstanceID = "$GuildID" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";
  565.             my $GuildInstanceID2 = "$name" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";
  566.             if (GET_QGLOBAL_VALUE("$GuildInstanceID"))
  567.             {
  568.                 my $SPAM_NAME = "SPAM_GUILD_" . $zonesn . "_$name";
  569.                 my $SPAM_TIME = 600; # Make 3600 / 1 HR
  570.                 if (GET_QGLOBAL_VALUE_EXPIRE("$SPAM_NAME"))
  571.                 {
  572.                     my $SPAM_VALUE  = GET_QGLOBAL_VALUE("$SPAM_NAME");
  573.                     my $TIME_LEFT   = $SPAM_TIME + $SPAM_VALUE - time();
  574.                     $client->Message(315,"You can't delete Guild Instance for $TIME_LEFT more seconds.");
  575.                 }
  576.                 else
  577.                 {
  578.                     my $InstID = GET_QGLOBAL_VALUE("$GuildInstanceID");
  579.                     my $LeaderZone = $InstID . "_GuildI_" . $zonesn . "_" . "$zoneid";
  580.                     my $LeaderName = $InstID . "_GuildI_Leader";
  581.                     my $LeaderTime = $InstID . "_GuildI_Time";
  582.                     # DELETE List of Players Invited to Guild Instance
  583.                     my $count = 1;
  584.                     my $guild_invite_name = $InstID . "_GuildI_Status_";
  585.                     my $temp_del = "";
  586.                     while ($count > 0)
  587.                     {
  588.                         if (GET_QGLOBAL_VALUE("$guild_invite_name$count"))
  589.                         {
  590.                             $temp_del = $guild_invite_name . $count;
  591.                             quest::delglobal($temp_del);
  592.                             $count ++;
  593.                         }
  594.                         else
  595.                         {
  596.                             $count = $count - 1;
  597.                             # quest::gmsay("GM: Deleted $count Invited Players!", 18, 0);
  598.                             $count = 0;
  599.                         }
  600.                     }
  601.                     # END DELETE List of Players Invited to Guild Instance
  602.                     quest::DestroyInstance($InstID);
  603.                     quest::delglobal($GuildInstanceID);
  604.                     quest::delglobal($GuildInstanceID2);
  605.                     quest::delglobal($LeaderZone);
  606.                     quest::delglobal($LeaderName);
  607.                     quest::delglobal($LeaderTime);
  608.                     $client->Message(315, "Guild Instance ($InstID) Deleted!");
  609.  
  610.                     $qglobals{"$LeaderZone"} = undef;
  611.                     $qglobals{"$LeaderName"} = undef;
  612.                     $qglobals{"$LeaderTime"} = undef;
  613.                 }
  614.             }
  615.             else
  616.             {
  617.                 $client->Message(315, "You do not have a Guild Instance to delete!");
  618.             }
  619.             $qglobals{"$GuildInstanceID"} = undef;
  620.             $qglobals{"$GuildInstanceID2"} = undef;
  621.         }
  622.     }
  623.     ###  END GUILD INSTANCES ######################################################################
  624.     ###############################################################################################
  625.  
  626.  
  627.     if ($text=~/^Instance$/i || $text=~/^Instances$/i || $text=~/^Waypoint$/i)
  628.     {
  629.         my $LeaveInstance   = quest::saylink("Leave Instance", 1);
  630.         my $MoreOptions     = quest::saylink("More Options", 1);
  631.         $client->Message(315, "[$LeaveInstance] [$MoreOptions]");
  632.     }
  633.  
  634.  
  635.     if($text=~/^Guild Invite$/i)
  636.     {
  637.         $client->Message(315, " ");
  638.         $client->Message(315, "Syntax: guild invite <Player Name>");
  639.     }
  640.  
  641.  
  642.     if($text=~/^Raid Invite$/i)
  643.     {
  644.         $client->Message(315, " ");
  645.         $client->Message(315, "Syntax: raid invite <Player Name>");
  646.     }
  647.  
  648.  
  649.     # INVITE Guild Member
  650.     if($text=~/^Guild Invite /i && $text ne "Guild Invite")
  651.     {
  652.         my $GuildID = $uguild_id;
  653.         my $GuildInstanceID = "$GuildID" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";
  654.  
  655.         ##########################################################################################################################
  656.         ### OLD INVITE CODE - TO BE DELETED AFTER TESTING NEW CODE
  657.         ##########################################################################################################################
  658.         # if (GET_QGLOBAL_VALUE("$GuildInstanceID"))
  659.         # {
  660.         #   my $GetFriendName = substr($text, 13);
  661.         #   my $Instance_Invite = 0 + GET_QGLOBAL_VALUE("$GuildInstanceID");
  662.         #   $client->Message(315, " ");
  663.         #   $client->Message(315, "You sent an invite to $GetFriendName to join Guild Instance ($Instance_Invite) in $zonesn.");
  664.         #   my $ZoneConvert = $zoneid * 1000000; # Include Zone ID in the Signal, multiple of 1 million (1-999 Million)
  665.         #   $Instance_Invite = $Instance_Invite + $ZoneConvert;
  666.         #   quest::crosszonesignalclientbyname($GetFriendName, $Instance_Invite);
  667.         # }
  668.         ##########################################################################################################################
  669.         ### NEW INVITE CODE MULTIPLE NAME INVITE SPLIT BY COMMON
  670.         ##########################################################################################################################
  671.         if (GET_QGLOBAL_VALUE("$GuildInstanceID"))
  672.         {
  673.             my $GetFriendName = substr($text, 13);
  674.             my @FriendNames = split(',', $GetFriendName); #Split the names into an array by comma
  675.             my $Instance_Invite = 0 + GET_QGLOBAL_VALUE("$GuildInstanceID");
  676.             my $ZoneConvert = $zoneid * 1000000; # Include Zone ID in the Signal, multiple of 1 million (1-999 Million)
  677.             my $Instance_Invite_Convert = $Instance_Invite + $ZoneConvert;
  678.             #Loop through the array of Names to invite
  679.             foreach my $FriendName (@FriendNames)
  680.             {
  681.                 $FriendName =~ s/^\s+|\s+$//g; #Strip spaces from the beginning or end of the name
  682.                 quest::crosszonesignalclientbyname($FriendName, $Instance_Invite_Convert);
  683.                 $client->Message(315, " ");
  684.                 $client->Message(315, "You sent an invite to $FriendName to join Guild Instance ($Instance_Invite) in $zonesn.");
  685.                 # $client->Message(315, "You sent an invite to $FriendName to join instance ($Instance_Invite) in $zonesn.");
  686.             }
  687.         }
  688.         ##########################################################################################################################
  689.  
  690.         else
  691.         {
  692.             $client->Message(315, " ");
  693.             $client->Message(315, "You do not have a Guild Instance for inviting.");
  694.         }
  695.         $qglobals{"$GuildInstanceID"} = undef;
  696.     }
  697.  
  698.  
  699.     # INVITE Raid Member
  700.     if($text=~/^Raid Invite /i && $text ne "Raid Invite")
  701.     {
  702.         my $RaidID = $name;
  703.         my $RaidInstanceID = "$RaidID" . "_Raid_" . "$zonesn" . "_" . "$zoneid";
  704.  
  705.         ##########################################################################################################################
  706.         ### OLD INVITE CODE - TO BE DELETED AFTER TESTING
  707.         ##########################################################################################################################
  708.         # if (GET_QGLOBAL_VALUE("$RaidInstanceID"))
  709.         # {
  710.         #   my $GetFriendName = substr($text, 12);
  711.         #   my $Instance_Invite = 0 + GET_QGLOBAL_VALUE("$RaidInstanceID");
  712.         #   $client->Message(315, " ");
  713.         #   $client->Message(315, "You sent an invite to $GetFriendName to join Raid Instance ($Instance_Invite) in $zonesn.");
  714.         #   my $ZoneConvert = $zoneid * 1000000; # Include Zone ID in the Signal, multiple of 1 million (1-999 Million)
  715.         #   $Instance_Invite = $Instance_Invite + $ZoneConvert;
  716.         #   quest::crosszonesignalclientbyname($GetFriendName, $Instance_Invite);
  717.         # }
  718.         ##########################################################################################################################
  719.         ### NEW INVITE CODE MULTIPLE NAME INVITE SPLIT BY COMMON
  720.         ##########################################################################################################################
  721.         if (GET_QGLOBAL_VALUE("$RaidInstanceID"))
  722.         {
  723.             my $GetFriendName = substr($text, 12);
  724.             my @FriendNames = split(',', $GetFriendName); #Split the names into an array by comma
  725.             my $Instance_Invite = 0 + GET_QGLOBAL_VALUE("$RaidInstanceID");
  726.             my $ZoneConvert = $zoneid * 1000000; # Include Zone ID in the Signal, multiple of 1 million (1-999 Million)
  727.             my $Instance_Invite_Convert = $Instance_Invite + $ZoneConvert;
  728.             #Loop through the array of Names to invite
  729.             foreach my $FriendName (@FriendNames)
  730.             {
  731.                 $FriendName =~ s/^\s+|\s+$//g; #Strip spaces from the beginning or end of the name
  732.                 quest::crosszonesignalclientbyname($FriendName, $Instance_Invite_Convert);
  733.                 $client->Message(315, " ");
  734.                 $client->Message(315, "You sent an invite to $FriendName to join Raid Instance ($Instance_Invite) in $zonesn.");
  735.                 # $client->Message(315, "You sent an invite to $FriendName to join instance ($Instance_Invite) in $zonesn.");
  736.             }
  737.         }
  738.         ##########################################################################################################################
  739.  
  740.         else
  741.         {
  742.             $client->Message(315, " ");
  743.             $client->Message(315, "You do not have a Raid Instance for inviting.");
  744.         }
  745.         $qglobals{"$RaidInstanceID"} = undef;
  746.     }
  747.  
  748.  
  749.     # REMOVE Guild Member
  750.     if($text=~/^Guild Remove /i && $text ne "Guild Remove")
  751.     {
  752.         my $GuildID = $uguild_id;
  753.         my $GuildInstanceID = "$GuildID" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";
  754.         if (GET_QGLOBAL_VALUE("$GuildInstanceID"))
  755.         {
  756.             my $GetFriendName = substr($text, 13);
  757.             my $Instance_Remove = 0 + GET_QGLOBAL_VALUE("$GuildInstanceID");
  758.             my $Instance_Remove2 =  $Instance_Remove + 1000000000 + ($zoneid * 1000000); # 1,000,000,000
  759.             quest::crosszonesignalclientbyname($GetFriendName, $Instance_Remove2);
  760.             $client->Message(315, " ");
  761.             $client->Message(315, "You removed $GetFriendName from Guild Instance ($Instance_Remove) in $zonesn.");
  762.         }
  763.         else
  764.         {
  765.             $client->Message(315, " ");
  766.             $client->Message(315, "You do not have a Guild Instance for removing.");
  767.         }
  768.         $qglobals{"$GuildInstanceID"} = undef;
  769.     }
  770.  
  771.  
  772.     # REMOVE Raid Member
  773.     if($text=~/^Raid Remove /i && $text ne "Raid Remove")
  774.     {
  775.         my $RaidID = $name;
  776.         my $RaidInstanceID = "$RaidID" . "_Raid_" . "$zonesn" . "_" . "$zoneid";
  777.         if (GET_QGLOBAL_VALUE("$RaidInstanceID"))
  778.         {
  779.             my $GetFriendName = substr($text, 12);
  780.             my $Instance_Remove = 0 + GET_QGLOBAL_VALUE("$RaidInstanceID");
  781.             my $Instance_Remove2 =  $Instance_Remove + 1000000000 + ($zoneid * 1000000); # 1,000,000,000
  782.             quest::crosszonesignalclientbyname($GetFriendName, $Instance_Remove2);
  783.             $client->Message(315, " ");
  784.             $client->Message(315, "You removed $GetFriendName from Raid Instance ($Instance_Remove) in $zonesn.");
  785.         }
  786.         else
  787.         {
  788.             $client->Message(315, " ");
  789.             $client->Message(315, "You do not have a Raid Instance for removing.");
  790.         }
  791.         $qglobals{"$RaidInstanceID"} = undef;
  792.     }
  793.  
  794.  
  795.     if($text=~/^guild join$/i)
  796.     {
  797.         $client->Message(315, " ");
  798.         $client->Message(315,"Syntax: guild join <Player Name>");
  799.     }
  800.  
  801.  
  802.     if($text=~/^raid join$/i)
  803.     {
  804.         $client->Message(315, " ");
  805.         $client->Message(315,"Syntax: raid join <Player Name>");
  806.     }
  807.  
  808.     if($text=~/^guild remove$/i)
  809.     {
  810.         $client->Message(315, " ");
  811.         $client->Message(315,"Syntax: guild remove <Player Name>");
  812.     }
  813.  
  814.  
  815.     if($text=~/^raid remove$/i)
  816.     {
  817.         $client->Message(315, " ");
  818.         $client->Message(315,"Syntax: raid remove <Player Name>");
  819.     }
  820.  
  821.  
  822.  
  823.     ###############################################################################################
  824.     ### JOIN JOIN GUILD INSTANCE ##################################################################
  825.     if($text=~/^guild join /i)
  826.     {
  827.         my $Check_G_Leader = substr($text, 11);
  828.         my $Check_G_Invite = "_GuildI_" . $zonesn . "_" . "$zoneid";
  829.         my $GetGuildInstanceGlobal = $Check_G_Leader . "_Guild_" . $zonesn . "_" . $zoneid;
  830.         my $GetJoinID = 0;
  831.  
  832.         if (GET_QGLOBAL_VALUE("$GetGuildInstanceGlobal"))
  833.         {
  834.             $GetJoinID = GET_QGLOBAL_VALUE("$GetGuildInstanceGlobal");
  835.             $Check_G_Invite = $GetJoinID . $Check_G_Invite;
  836.         }
  837.  
  838.         if (GET_QGLOBAL_VALUE("$Check_G_Invite"))
  839.         {
  840.             # Find Player Qglobal to change status
  841.             my $count                   = 1;
  842.             my $guild_invite_name       = $GetJoinID . "_GuildI_Status_";
  843.             my $guild_invite_pending    = $name . "_pending";
  844.             my $guild_invite_joined     = $name . "_joined";
  845.             my $guild_invite_removed    = $name . "_removed";
  846.             my $compare_name            = "";
  847.             my $Leader = $Check_G_Leader;
  848.             while ($count > 0)
  849.             {
  850.                 if (GET_QGLOBAL_VALUE("$guild_invite_name$count"))
  851.                 {
  852.                     $compare_name = GET_QGLOBAL_VALUE("$guild_invite_name$count");
  853.                     if ($compare_name eq $guild_invite_pending || $compare_name eq $guild_invite_joined)
  854.                     {
  855.                         # When pending or joined qglobal name found, change value from pending to joined, then enter.
  856.                         my $GetSeconds = GET_TIME_LEFT("GUILD", $GetJoinID);
  857.                         quest::setglobal("$guild_invite_name$count","$guild_invite_joined","7","S$GetSeconds");
  858.                         my $timestamp = localtime(time);
  859.                         my $Cx = $client->GetX();
  860.                         my $Cy = $client->GetY();
  861.                         my $Cz = $client->GetZ();
  862.                         quest::popup("ENTERING INVITED GUILD INSTANCE","<br>
  863.                             <c \"#FE2E2E\">Moving you to a INVITED Guild Instance ($GetJoinID)!<br>
  864.                             <br>
  865.                             <c \"#FFFF49\">Time : &nbsp;&nbsp;&nbsp;<c \"#00FF00\">$timestamp<br>
  866.                             <c \"#FFFF49\">Name : &nbsp; <c \"#00FF00\">$name<br>
  867.                             <c \"#FFFF49\">Zone : &nbsp;&nbsp;&nbsp; <c \"#00FF00\">$zonesn<br>
  868.                             <c \"#FFFF49\">Type : &nbsp;&nbsp;&nbsp;&nbsp; <c \"#00FF00\">$Leader Guild Instance<br>
  869.                             <br>
  870.                             <c \"#00BFFF\">ENJOY!<br>
  871.                             <br>
  872.                             ",1050,0);
  873.                         $client->Message(315, " ");
  874.                         $client->Message(315, "Moving you to $Leader Guild Instance ($GetJoinID) for $zonesn.");
  875.                         $qglobals{"$guild_invite_name"} = undef;
  876.                         quest::AssignToInstance($GetJoinID);
  877.                         quest::MovePCInstance($zoneid, $GetJoinID, $Cx, $Cy, $Cz);
  878.                         $count = 0;
  879.                     }
  880.                     elsif ($compare_name eq $guild_invite_removed)
  881.                     {
  882.                         $client->Message(315, " ");
  883.                         $client->Message(315, "You were BANNED from $Leader Guild Instance ($GetJoinID) for $zonesn.");
  884.                         $count = 0;
  885.                     }
  886.                     else
  887.                     {
  888.                         $count ++;
  889.                     }
  890.                 }
  891.                 else
  892.                 {
  893.                     $client->Message(315,"You were not invited to $Leader Guild Instance $GetJoinID in $zonesn!");
  894.                     $count = 0;
  895.                 }
  896.             }
  897.         }
  898.         else
  899.         {
  900.             $client->Message(315,"Guild Instance $Check_G_Leader in $zonesn does not exist!");
  901.         }
  902.         $qglobals{"$Check_G_Invite"} = undef;
  903.         $qglobals{"$Check_G_Leader"} = undef;
  904.     }
  905.     ###  END JOIN GUILD INSTANCE ##################################################################
  906.     ###############################################################################################
  907.  
  908.  
  909.     ###############################################################################################
  910.     ### JOIN RAID INSTANCE ########################################################################
  911.     ### $name_Raid_$zonesn_$zoneid, XXX_RaidI_Leader, XXX__RaidI_Time, XXX_RaidI_$zonesn_$zoneid, XXX_RaidI_Status_YYY
  912.     if($text=~/^raid join /i)
  913.     {
  914.         my $Check_R_Leader = substr($text, 10);
  915.         my $Check_R_Invite = "_RaidI_" . $zonesn . "_" . "$zoneid";
  916.         my $GetRaidInstanceGlobal = $Check_R_Leader . "_Raid_" . $zonesn . "_" . $zoneid;
  917.         my $GetJoinID = 0;
  918.         if (GET_QGLOBAL_VALUE("$GetRaidInstanceGlobal"))
  919.         {
  920.             $GetJoinID = GET_QGLOBAL_VALUE("$GetRaidInstanceGlobal");
  921.             $Check_R_Invite = $GetJoinID . $Check_R_Invite;
  922.         }
  923.  
  924.         if (GET_QGLOBAL_VALUE("$Check_R_Invite"))
  925.         {
  926.             # Find Player Qglobal to change status
  927.             my $count                   = 1;
  928.             my $raid_invite_name        = $GetJoinID . "_RaidI_Status_";
  929.             my $raid_invite_pending     = $name . "_pending";
  930.             my $raid_invite_joined      = $name . "_joined";
  931.             my $raid_invite_removed     = $name . "_removed";
  932.             my $compare_name            = "";
  933.             my $Leader = $Check_R_Leader;
  934.             while ($count > 0)
  935.             {
  936.                 if (GET_QGLOBAL_VALUE("$raid_invite_name$count"))
  937.                 {
  938.                     $compare_name = GET_QGLOBAL_VALUE("$raid_invite_name$count");
  939.                     if ($compare_name eq $raid_invite_pending || $compare_name eq $raid_invite_joined)
  940.                     {
  941.                         # When qglobal name found, change value from pending to joined, then enter
  942.                         my $GetSeconds = GET_TIME_LEFT("RAID", $GetJoinID);
  943.                         quest::setglobal("$raid_invite_name$count","$raid_invite_joined","7","S$GetSeconds");
  944.  
  945.                         my $timestamp = localtime(time);
  946.                         my $Cx = $client->GetX();
  947.                         my $Cy = $client->GetY();
  948.                         my $Cz = $client->GetZ();
  949.                         quest::popup("ENTERING INVITED RAID INSTANCE","<br>
  950.                             <c \"#FE2E2E\">Moving you to a INVITED Raid Instance ($GetJoinID)!<br>
  951.                             <br>
  952.                             <c \"#FFFF49\">Time : &nbsp;&nbsp;&nbsp;<c \"#00FF00\">$timestamp<br>
  953.                             <c \"#FFFF49\">Name : &nbsp; <c \"#00FF00\">$name<br>
  954.                             <c \"#FFFF49\">Zone : &nbsp;&nbsp;&nbsp; <c \"#00FF00\">$zonesn<br>
  955.                             <c \"#FFFF49\">Type : &nbsp;&nbsp;&nbsp;&nbsp; <c \"#00FF00\">$Leader Raid Instance<br>
  956.                             <br>
  957.                             <c \"#00BFFF\">ENJOY!<br>
  958.                             <br>
  959.                             ",1050,0);
  960.                         $client->Message(315, " ");
  961.                         $client->Message(315, "Moving you to $Leader Raid Instance ($GetJoinID) for $zonesn.");
  962.                         $qglobals{"$raid_invite_name"} = undef;
  963.                         quest::AssignToInstance($GetJoinID);
  964.                         quest::MovePCInstance($zoneid, $GetJoinID, $Cx, $Cy, $Cz);
  965.                         $count = 0;
  966.                     }
  967.                     elsif ($compare_name eq $raid_invite_removed)
  968.                     {
  969.                         $client->Message(315, " ");
  970.                         $client->Message(315, "You were BANNED from $Leader Raid Instance ($GetJoinID) for $zonesn.");
  971.                         $count = 0;
  972.                     }
  973.                     else
  974.                     {
  975.                         $count ++;
  976.                     }
  977.                 }
  978.                 else
  979.                 {
  980.                     $client->Message(315,"You were not invited to $Leader Raid Instance $GetJoinID in $zonesn!");
  981.                     $count = 0;
  982.                 }
  983.             }
  984.         }
  985.         else
  986.         {
  987.             $client->Message(315,"Raid Instance for $Check_R_Leader in $zonesn does not exist!");
  988.         }
  989.         $qglobals{"$Check_R_Invite"} = undef;
  990.         $qglobals{"$Check_R_Leader"} = undef;
  991.     }
  992.     ###  END JOIN RAID INSTANCE ###################################################################
  993.     ###############################################################################################
  994.  
  995.  
  996.     #################################################################################################################################################
  997.     # LIST of players invited/assigned to Guild Instance
  998.     if($text=~/^Guild List$/i)
  999.     {
  1000.         my $timestamp = localtime(time);
  1001.         $client->Message(315," ");
  1002.         my $GuildID = $uguild_id;
  1003.         my $GuildInstanceID = "$GuildID" . "_Guild_"  . "$zonesn" . "_" . "$zoneid";
  1004.         if (GET_QGLOBAL_VALUE("$GuildInstanceID"))
  1005.         {
  1006.             my $Check_G_Invite = GET_QGLOBAL_VALUE("$GuildInstanceID") . "_GuildI_" . $zonesn . "_" . "$zoneid";
  1007.             my $Check_G_Leader = GET_QGLOBAL_VALUE("$GuildInstanceID") . "_GuildI_Leader";
  1008.             my $GID = GET_QGLOBAL_VALUE("$GuildInstanceID");
  1009.  
  1010.             # GET TIME LEFT UNTIL INSTANCE EXPIRES
  1011.             my $LeaderTime  = $GID . "_GuildI_Time";
  1012.             my $ExpireTime  = GET_QGLOBAL_VALUE("$LeaderTime");
  1013.             my $TimeLeft    = $ExpireTime - time();
  1014.             my $GetDays     = int($TimeLeft/(24*60*60));
  1015.             my $GetHours    = ($TimeLeft/(60*60))%24;
  1016.             my $GetMins     = ($TimeLeft/60)%60;
  1017.             my $GetSecs     = $TimeLeft%60;
  1018.  
  1019.             $client->Message(315,"Expires: $GetDays Day, $GetHours Hr, $GetMins Min, $GetSecs Sec");
  1020.             $client->Message(315,"List of players in your Guild Instance ($GID) in $zonesn!");
  1021.             my $names_list = "";
  1022.             my $temp_name = "";
  1023.             my $guild_invite_name = $GID . "_GuildI_Status_";
  1024.             my $count = 1;
  1025.             my $player_count = 0;
  1026.             while ($count > 0)
  1027.             {
  1028.                 if (GET_QGLOBAL_VALUE("$guild_invite_name$count"))
  1029.                 {
  1030.                     $player_count = $count;
  1031.                     $temp_name = GET_QGLOBAL_VALUE("$guild_invite_name$count");
  1032.                     if ($temp_name=~/pending$/i)
  1033.                     {
  1034.                         my $player_name = $temp_name;
  1035.                         $player_name =~ s/_pending//; # string substitute flag
  1036.                         my $player_status = " - Pending";
  1037.                         my $yellow = "<c \"#AEB404\">";
  1038.                         my $white = "<c \"#FFFFFF\">";
  1039.                         my $player_space = "&nbsp;";
  1040.                         my $BR = "<br>";
  1041.                         my $player_number = "<c \"#0489B1\">$count : "; # Teal Color
  1042.                         $names_list = $names_list . $player_number . $white . $player_name . $yellow . $player_status . $BR;
  1043.                     }
  1044.                     elsif ($temp_name=~/joined$/i)
  1045.                     {
  1046.                         my $player_name = $temp_name;
  1047.                         $player_name =~ s/_joined//;
  1048.                         my $player_status = " - Joined";
  1049.                         my $green = "<c \"#298A08\">";
  1050.                         my $white = "<c \"#FFFFFF\">";
  1051.                         my $player_space = "&nbsp;";
  1052.                         my $BR = "<br>";
  1053.                         my $player_number = "<c \"#0489B1\">$count : "; # Teal Color
  1054.                         $names_list = $names_list . $player_number . $white . $player_name . $green . $player_status . $BR;
  1055.                     }
  1056.                     elsif ($temp_name=~/removed$/i)
  1057.                     {
  1058.                         my $player_name = $temp_name;
  1059.                         $player_name =~ s/_removed//;
  1060.                         my $player_status = " - Removed";
  1061.                         my $red = "<c \"#FE2E2E\">";
  1062.                         my $white = "<c \"#FFFFFF\">";
  1063.                         my $player_space = "&nbsp;";
  1064.                         my $BR = "<br>";
  1065.                         my $player_number = "<c \"#0489B1\">$count : "; # Teal Color
  1066.                         $names_list = $names_list . $player_number . $white . $player_name . $red . $player_status . $BR;
  1067.                     }
  1068.                     else
  1069.                     {
  1070.                         quest::gmsay("GM: GUILD LIST ADD NAME ERROR.", 18, 0);
  1071.                     }
  1072.                     # quest::gmsay("GM: $temp_name added to List", 18, 0);
  1073.                     $count ++;
  1074.                 }
  1075.                 else
  1076.                 {
  1077.                     # quest::gmsay("GM: End of List", 18, 0);
  1078.                     $count = 0;
  1079.                 }
  1080.             }
  1081.             quest::popup("GUILD INSTANCE LIST","
  1082.                             Expires: $GetDays Day, $GetHours Hr, $GetMins Min, $GetSecs Sec <br>
  1083.                             <c \"#FE2E2E\">List of ($player_count) players in Guild Instance ($GID) in $zonesn<br>
  1084.                             &nbsp;<br>
  1085.                             $names_list
  1086.                             <br>
  1087.                             ",1050,0);
  1088.             $qglobals{"$Check_G_Invite"} = undef;
  1089.             $qglobals{"$Check_G_Leader"} = undef;
  1090.         }
  1091.         else { $client->Message(315,"You do not have a Guild Instance in $zonesn!"); }
  1092.         $qglobals{"$GuildInstanceID"} = undef;
  1093.     }
  1094.     # End Guild Instance LIST
  1095.     #################################################################################################################################################
  1096.  
  1097.  
  1098.     #################################################################################################################################################
  1099.     # List of players invited/assigned to Raid Instance
  1100.     if($text=~/^Raid List$/i)
  1101.     {
  1102.         # my $timestamp = localtime(time);
  1103.         $client->Message(315," ");
  1104.  
  1105.         my $RaidID = $name;
  1106.         my $RaidInstanceID = "$RaidID" . "_Raid_" . "$zonesn" . "_" . "$zoneid";
  1107.         if (GET_QGLOBAL_VALUE("$RaidInstanceID"))
  1108.         {
  1109.             my $Check_G_Invite = GET_QGLOBAL_VALUE("$RaidInstanceID") . "_RaidI_" . $zonesn . "_" . "$zoneid";
  1110.             my $Check_G_Leader = GET_QGLOBAL_VALUE("$RaidInstanceID") . "_RaidI_Leader";
  1111.             my $GID = GET_QGLOBAL_VALUE("$RaidInstanceID");
  1112.  
  1113.             # GET TIME LEFT UNTIL INSTANCE EXPIRES
  1114.             my $LeaderTime  = $GID . "_RaidI_Time";
  1115.             my $ExpireTime  = GET_QGLOBAL_VALUE("$LeaderTime");
  1116.             my $TimeLeft    = $ExpireTime - time();
  1117.             my $GetDays     = int($TimeLeft/(24*60*60));
  1118.             my $GetHours    = ($TimeLeft/(60*60))%24;
  1119.             my $GetMins     = ($TimeLeft/60)%60;
  1120.             my $GetSecs     = $TimeLeft%60;
  1121.  
  1122.             $client->Message(315,"Expires: $GetDays Day, $GetHours Hr, $GetMins Min, $GetSecs Sec");
  1123.             $client->Message(315,"List of players in your Raid Instance ($GID) in $zonesn!");
  1124.             my $names_list = "";
  1125.             my $temp_name = "";
  1126.             my $raid_invite_name = $GID . "_RaidI_Status_";
  1127.             my $count = 1;
  1128.             my $player_count = 0;
  1129.             while ($count > 0)
  1130.             {
  1131.                 if (GET_QGLOBAL_VALUE("$raid_invite_name$count"))
  1132.                 {
  1133.                     $player_count = $count;
  1134.                     $temp_name = GET_QGLOBAL_VALUE("$raid_invite_name$count");
  1135.                     if ($temp_name=~/pending$/i)
  1136.                     {
  1137.                         my $player_name = $temp_name;
  1138.                         $player_name =~ s/_pending//; # string substitute flag
  1139.                         my $player_status = " - Pending";
  1140.                         my $yellow = "<c \"#AEB404\">";
  1141.                         my $white = "<c \"#FFFFFF\">";
  1142.                         my $player_space = "&nbsp;";
  1143.                         my $BR = "<br>";
  1144.                         my $player_number = "<c \"#0489B1\">$count : "; # Teal Color
  1145.                         $names_list = $names_list . $player_number . $white . $player_name . $yellow . $player_status . $BR;
  1146.                     }
  1147.                     elsif ($temp_name=~/joined$/i)
  1148.                     {
  1149.  
  1150.                         my $player_name = $temp_name;
  1151.                         $player_name =~ s/_joined//;
  1152.  
  1153.                         my $player_status = " - Joined";
  1154.                         my $green = "<c \"#298A08\">";
  1155.                         my $white = "<c \"#FFFFFF\">";
  1156.                         my $player_space = "&nbsp;";
  1157.                         my $BR = "<br>";
  1158.                         my $player_number = "<c \"#0489B1\">$count : "; # Teal Color
  1159.                         $names_list = $names_list . $player_number . $white . $player_name . $green . $player_status . $BR;
  1160.                     }
  1161.                     elsif ($temp_name=~/removed$/i)
  1162.                     {
  1163.                         my $player_name = $temp_name;
  1164.                         $player_name =~ s/_removed//;
  1165.                         my $player_status = " - Removed";
  1166.                         my $red = "<c \"#FE2E2E\">";
  1167.                         my $white = "<c \"#FFFFFF\">";
  1168.                         my $player_space = "&nbsp;";
  1169.                         my $BR = "<br>";
  1170.                         my $player_number = "<c \"#0489B1\">$count : "; # Teal Color
  1171.                         $names_list = $names_list . $player_number . $white . $player_name . $red . $player_status . $BR;
  1172.                     }
  1173.                     else
  1174.                     {
  1175.                         quest::gmsay("GM: RAID LIST ADD NAME ERROR.", 18, 0);
  1176.                     }
  1177.                     # quest::gmsay("GM: $temp_name added to List", 18, 0);
  1178.                     $count ++;
  1179.                 }
  1180.                 else
  1181.                 {
  1182.                     # quest::gmsay("GM: End of List", 18, 0);
  1183.                     $count = 0;
  1184.                 }
  1185.             }
  1186.             quest::popup("RAID INSTANCE LIST","
  1187.                             Expires: $GetDays Day, $GetHours Hr, $GetMins Min, $GetSecs Sec <br>
  1188.                             <c \"#FE2E2E\">List of ($player_count) players in Raid Instance ($GID) in $zonesn<br>
  1189.                             &nbsp;<br>
  1190.                             $names_list
  1191.                             <br>
  1192.                             ",1050,0);
  1193.             $qglobals{"$Check_G_Invite"} = undef;
  1194.             $qglobals{"$Check_G_Leader"} = undef;
  1195.         }
  1196.         else { $client->Message(315,"You do not have a Raid Instance in $zonesn!"); }
  1197.         $qglobals{"$RaidInstanceID"} = undef;
  1198.     }
  1199.     # End Raid Instance LIST
  1200.     #################################################################################################################################################
  1201.  
  1202.  
  1203.     if($text=~/^More Options$/i)
  1204.     {
  1205.         # $client->Message(315, " ");
  1206.         my $GuildInvite     = quest::saylink("Guild Invite", 1);
  1207.         my $GuildJoin       = quest::saylink("Guild Join", 1);
  1208.         my $GuildRemove     = quest::saylink("Guild Remove", 1);
  1209.         my $RaidInvite      = quest::saylink("Raid Invite", 1);
  1210.         my $RaidJoin        = quest::saylink("Raid Join", 1);
  1211.         my $RaidRemove      = quest::saylink("Raid Remove", 1);
  1212.         my $Deposit = quest::saylink("Deposit",1);
  1213.         my $Withdraw = quest::saylink("Withdraw",1);
  1214.         my $Balance = quest::saylink("Balance",1);
  1215.         $client->Message(315, "More Waypoint Options ...");
  1216.         $client->Message(315, "[$RaidInvite] [$RaidJoin] [$RaidRemove]");
  1217.         $client->Message(315, "[$GuildInvite] [$GuildJoin] [$GuildRemove]");
  1218.         $client->Message(315, "[$Balance] [$Deposit] [$Withdraw]");
  1219.     }
  1220.  
  1221.  
  1222.     if($text =~ /^Balance$/i)
  1223.     {
  1224.         # plugin::CreditStatusAccount("BankCredit");
  1225.         Check_Balance("BankCredit");
  1226.     }
  1227.  
  1228.  
  1229.     if($text =~ /^Deposit$/i)
  1230.     {
  1231.         $client->Message(315," ");
  1232.         $client->Message(315,"Just give a Waypoint any amount of platinum you'd like to deposit!");
  1233.     }
  1234.  
  1235.     if($text =~ /^Withdraw$/i)
  1236.     {
  1237.         $client->Message(315," ");
  1238.         $client->Message(315,"Withdraw not available.");
  1239.     }
  1240.  
  1241.  
  1242.     if($text=~/^Leave Instance$/i)
  1243.     {
  1244.         my $Cx = $client->GetX();
  1245.         my $Cy = $client->GetY();
  1246.         my $Cz = $client->GetZ();
  1247.         my $Ch = $client->GetHeading();
  1248.         my $timestamp = localtime(time);
  1249.         $client->Message(315," ");
  1250.         $client->Message(315,"Moving you back to public zone in $zonesn!");
  1251.         quest::popup("LEAVE INSTANCE","<br>
  1252.                             <c \"#FE2E2E\">You choose to leave instance.<br>
  1253.                             <c \"#FE2E2E\">Moving you to a PUBLIC zone!<br>
  1254.                             <br>
  1255.                             <c \"#FFFF49\">Time : &nbsp;&nbsp;&nbsp;<c \"#00FF00\">$timestamp<br>
  1256.                             <c \"#FFFF49\">Name : &nbsp; <c \"#00FF00\">$name<br>
  1257.                             <c \"#FFFF49\">Zone : &nbsp;&nbsp;&nbsp; <c \"#00FF00\">$zonesn<br>
  1258.                             <c \"#FFFF49\">Type : &nbsp;&nbsp;&nbsp;&nbsp; <c \"#00FF00\">Public<br>
  1259.                             <br>
  1260.                             <c \"#00BFFF\">ENJOY!<br>
  1261.                             <br>
  1262.                             ",1050,0);
  1263.         quest::movepc($zoneid, $Cx, $Cy, $Cz, $Ch);
  1264.     }
  1265.  
  1266.     # $qglobals{"$SoloInstanceID"} = undef;
  1267.     # $qglobals{"$GuildInstanceID"} = undef;
  1268.     # $qglobals{"$Check_G_Invite"}  = undef;
  1269.     # $qglobals{"$Check_G_Leader"}  = undef;
  1270.  
  1271. } # End EVENT_SAY
  1272.  
  1273.  
  1274. sub EVENT_SIGNAL
  1275. {
  1276.  
  1277.     quest::gmsay("GM: $signal", 18, 0);
  1278.  
  1279.     # 1000000000 is to remove player from Guild and Raid Instances (1,000,000,000)
  1280.     my $signal_ID = 0;
  1281.     my $signal_zone_ID = 0;
  1282.     my $signal_instance_ID = 0;
  1283.     if ($signal > 1000000000)
  1284.     {
  1285.         $signal_ID = $signal - 1000000000;              # If remove flag, use signal - 1 million
  1286.     }
  1287.     else
  1288.     {
  1289.         $signal_ID = $signal;                           # else no remove flag, just use signal
  1290.     }
  1291.     $signal_zone_ID = int ($signal_ID / 1000000);       # $ZoneConvert = $zoneid * 1000000;
  1292.     $signal_instance_ID = int ($signal_ID % 1000000);
  1293.    
  1294.     my $zone_name = GET_ZONE_NAME_BY_ID($signal_zone_ID);
  1295.    
  1296.     # if ($signal_zone_ID == 0) { $zone_name = $zonesn; $signal_zone_ID = $zoneid; }
  1297.     # if ($signal_zone_ID == 0) { $signal_zone_ID = $zoneid; }
  1298.    
  1299.     # quest::gmsay("GM: signal_zone_ID = $signal_zone_ID", 18, 0);
  1300.     # quest::gmsay("GM: signal_instance_ID = $signal_instance_ID", 18, 0);
  1301.     # quest::gmsay("GM: zone_name = $zone_name", 18, 0);
  1302.  
  1303.     my $Check_G_Invite = $signal_instance_ID . "_GuildI_" . $zone_name . "_" . "$signal_zone_ID";
  1304.     my $Check_G_Leader = $signal_instance_ID . "_GuildI_Leader";
  1305.     my $Check_R_Invite = $signal_instance_ID . "_RaidI_" . $zone_name . "_" . "$signal_zone_ID";
  1306.     my $Check_R_Leader = $signal_instance_ID . "_RaidI_Leader";
  1307.    
  1308.     # OLD = $zoneid $zonesn
  1309.  
  1310.     # quest::gmsay("GM: signal_ID = $signal_ID / signal_zone_ID = $signal_zone_ID / signal_instance_ID = $signal_instance_ID", 18, 0);
  1311.  
  1312.     #############################################################################################################################
  1313.     # IF GUILD INVITE ###########################################################################################################
  1314.     if (GET_QGLOBAL_VALUE("$Check_G_Invite"))
  1315.     {
  1316.         # quest::gmsay("GM: GUILD INVITE TEST", 18, 0);
  1317.         my $Leader = GET_QGLOBAL_VALUE("$Check_G_Leader");
  1318.         quest::AssignToInstance($signal_instance_ID);
  1319.  
  1320.         # Create a qglobal list of players invited/assigned to Guild Instance
  1321.         my $count = 1;
  1322.         my $guild_invite_name       = $signal_instance_ID . "_GuildI_Status_";
  1323.         my $guild_invite_pending    = $name . "_pending";
  1324.         my $guild_invite_joined     = $name . "_joined";
  1325.         my $guild_invite_removed    = $name . "_removed";
  1326.         while ($count > 0)
  1327.         {
  1328.             if (GET_QGLOBAL_VALUE("$guild_invite_name$count"))
  1329.             {
  1330.                 if (GET_QGLOBAL_VALUE("$guild_invite_name$count") eq $guild_invite_pending ||
  1331.                     GET_QGLOBAL_VALUE("$guild_invite_name$count") eq $guild_invite_joined)
  1332.                 {
  1333.                     if ($signal > 1000000000)
  1334.                     {
  1335.                         my $Cx = $client->GetX();
  1336.                         my $Cy = $client->GetY();
  1337.                         my $Cz = $client->GetZ();
  1338.                         my $Ch = $client->GetHeading();
  1339.                         my $timestamp = localtime(time);
  1340.                         $client->Message(315," ");
  1341.                         $client->Message(315,"You have been removed from $Leader Guild Instance ($signal_instance_ID) in $zone_name!");
  1342.                         quest::popup("YOU HAVE BEEN REMOVED","<br>
  1343.                             <c \"#FE2E2E\">You have been removed from $Leader Guild Instance.<br>
  1344.                             <c \"#FE2E2E\">Moving you to a PUBLIC zone!<br>
  1345.                             <br>
  1346.                             <c \"#FFFF49\">Time : &nbsp;&nbsp;&nbsp;<c \"#00FF00\">$timestamp<br>
  1347.                             <c \"#FFFF49\">Name : &nbsp; <c \"#00FF00\">$name<br>
  1348.                             <c \"#FFFF49\">Zone : &nbsp;&nbsp;&nbsp; <c \"#00FF00\">$zone_name<br>
  1349.                             <c \"#FFFF49\">Type : &nbsp;&nbsp;&nbsp;&nbsp; <c \"#00FF00\">Public<br>
  1350.                             <br>
  1351.                             <c \"#00BFFF\">You have been removed from Guild Instance ($signal_instance_ID) in $zone_name!<br>
  1352.                             <br>
  1353.                             ",1050,0);
  1354.                         my $GetSeconds = GET_TIME_LEFT("GUILD", $signal_instance_ID);
  1355.                         quest::setglobal("$guild_invite_name$count","$guild_invite_removed","7","S$GetSeconds");
  1356.                         $count = 0;
  1357.                         if ($signal_zone_ID == $zoneid)
  1358.                         {
  1359.                             $client->Message(315,"Zoning you out of $zonesn.");
  1360.                             quest::movepc($zoneid, $Cx, $Cy, $Cz, $Ch); # If current zone = same name for instance, then move to public
  1361.                         }
  1362.                         else
  1363.                         {
  1364.                             $client->Message(315,"You have already zoned out of $zone_name.");
  1365.                         }
  1366.                     }
  1367.                     else
  1368.                     {
  1369.                         my $GetSeconds = GET_TIME_LEFT("GUILD", $signal_instance_ID);
  1370.                         my $correct_zone = GET_ZONE_NAME_BY_ID($signal_zone_ID);
  1371.                         quest::setglobal("$guild_invite_name$count","$guild_invite_pending","7","S$GetSeconds");
  1372.                         $client->Message(315," ");
  1373.                         $client->Message(315,"$Leader has re-invited you to join a Guild Instance in $correct_zone.");
  1374.                         $client->Message(315,"Type: guild join $Leader (when you are in $correct_zone)");
  1375.                         # quest::gmsay("GM: $signal_zone_ID = $correct_zone", 18, 0);
  1376.                     }
  1377.                     $count = 0;
  1378.                 }
  1379.                 elsif (GET_QGLOBAL_VALUE("$guild_invite_name$count") eq $guild_invite_removed)
  1380.                 {
  1381.                     if ($signal < 1000000000)
  1382.                     {
  1383.                         my $GetSeconds = GET_TIME_LEFT("GUILD", $signal_instance_ID);
  1384.                         my $correct_zone = GET_ZONE_NAME_BY_ID($signal_zone_ID);
  1385.                         quest::setglobal("$guild_invite_name$count","$guild_invite_pending","7","S$GetSeconds");
  1386.                         $client->Message(315," ");
  1387.                         $client->Message(315,"$Leader has re-invited you to join a Guild Instance in $correct_zone.");
  1388.                         $client->Message(315,"Type: guild join $Leader (when you are in $correct_zone)");
  1389.                         # quest::gmsay("GM: $signal_zone_ID = $correct_zone", 18, 0);
  1390.                     }
  1391.                     $count = 0;
  1392.                 }
  1393.                 else
  1394.                 {
  1395.                     $count ++;
  1396.                 }
  1397.             }
  1398.             else
  1399.             {
  1400.                 ###############################################################################
  1401.                 my $GetSeconds = GET_TIME_LEFT("GUILD", $signal_instance_ID);
  1402.                 my $correct_zone = GET_ZONE_NAME_BY_ID($signal_zone_ID);
  1403.                 quest::setglobal("$guild_invite_name$count","$guild_invite_pending","7","S$GetSeconds");
  1404.                 $client->Message(315," ");
  1405.                 $client->Message(315,"$Leader has invited you to join a Guild Instance in $correct_zone.");
  1406.                 $client->Message(315,"Type: guild join $Leader (when you are in $correct_zone)");
  1407.                 # quest::gmsay("GM: $signal_zone_ID = $correct_zone", 18, 0);
  1408.                 $count = 0;
  1409.             }
  1410.         }
  1411.         $qglobals{"$Check_G_Invite"} = undef;
  1412.         $qglobals{"$Check_G_Leader"} = undef;
  1413.     }
  1414.     # END IF GUILD INVITE #######################################################################################################
  1415.     #############################################################################################################################
  1416.  
  1417.  
  1418.     #############################################################################################################################
  1419.     # IF RAID INVITE ############################################################################################################
  1420.     # quest::gmsay("GM: RAID INFO: " . GET_QGLOBAL_VALUE("$Check_R_Invite"), 18, 0);
  1421.     # quest::gmsay("GM: RAID TEST 1", 18, 0);
  1422.     if (GET_QGLOBAL_VALUE("$Check_R_Invite"))
  1423.     {
  1424.         # quest::gmsay("GM: RAID TEST 2", 18, 0);
  1425.         # quest::gmsay("GM: RAID INVITE TEST", 18, 0);
  1426.         my $Leader = GET_QGLOBAL_VALUE("$Check_R_Leader");
  1427.         quest::AssignToInstance($signal_instance_ID);
  1428.  
  1429.         # Create a qglobal list of players invited/assigned to Raid Instance
  1430.         my $count = 1;
  1431.         my $raid_invite_name        = $signal_instance_ID . "_RaidI_Status_";
  1432.         my $raid_invite_pending     = $name . "_pending";
  1433.         my $raid_invite_joined      = $name . "_joined";
  1434.         my $raid_invite_removed     = $name . "_removed";
  1435.         while ($count > 0)
  1436.         {
  1437.             # quest::gmsay("GM: RAID TEST 3", 18, 0);
  1438.             if (GET_QGLOBAL_VALUE("$raid_invite_name$count"))
  1439.             {
  1440.                 # quest::gmsay("GM: RAID TEST 4", 18, 0);
  1441.                 if (GET_QGLOBAL_VALUE("$raid_invite_name$count") eq $raid_invite_pending ||
  1442.                     GET_QGLOBAL_VALUE("$raid_invite_name$count") eq $raid_invite_joined)
  1443.                 {
  1444.                     # quest::gmsay("GM: RAID TEST 5", 18, 0);
  1445.                     if ($signal > 1000000000)
  1446.                     {
  1447.                         # quest::gmsay("GM: RAID TEST 6", 18, 0);
  1448.                         my $Cx = $client->GetX();
  1449.                         my $Cy = $client->GetY();
  1450.                         my $Cz = $client->GetZ();
  1451.                         my $Ch = $client->GetHeading();
  1452.                         my $timestamp = localtime(time);
  1453.                         $client->Message(315," ");
  1454.                         $client->Message(315,"You have been removed from $Leader Raid Instance ($signal_instance_ID) in $zone_name!");
  1455.                         quest::popup("YOU HAVE BEEN REMOVED","<br>
  1456.                             <c \"#FE2E2E\">You have been removed from $Leader Raid Instance.<br>
  1457.                             <c \"#FE2E2E\">Moving you to a PUBLIC zone!<br>
  1458.                             <br>
  1459.                             <c \"#FFFF49\">Time : &nbsp;&nbsp;&nbsp;<c \"#00FF00\">$timestamp<br>
  1460.                             <c \"#FFFF49\">Name : &nbsp; <c \"#00FF00\">$name<br>
  1461.                             <c \"#FFFF49\">Zone : &nbsp;&nbsp;&nbsp; <c \"#00FF00\">$zone_name<br>
  1462.                             <c \"#FFFF49\">Type : &nbsp;&nbsp;&nbsp;&nbsp; <c \"#00FF00\">Public<br>
  1463.                             <br>
  1464.                             <c \"#00BFFF\">You have been removed from Raid Instance ($signal_instance_ID) in $zone_name!<br>
  1465.                             <br>
  1466.                             ",1050,0);
  1467.                         my $GetSeconds = GET_TIME_LEFT("RAID", $signal_instance_ID);
  1468.                         quest::setglobal("$raid_invite_name$count","$raid_invite_removed","7","S$GetSeconds");
  1469.                         $count = 0;
  1470.                         if ($signal_zone_ID == $zoneid)
  1471.                         {
  1472.                             $client->Message(315,"Zoning you out of $zonesn.");
  1473.                             quest::movepc($zoneid, $Cx, $Cy, $Cz, $Ch); # If current zone = same name for instance, then move to public
  1474.                         }
  1475.                         else
  1476.                         {
  1477.                             $client->Message(315,"You have already zoned out of $zone_name.");
  1478.                         }
  1479.                     }
  1480.                     else
  1481.                     {
  1482.                         my $GetSeconds = GET_TIME_LEFT("RAID", $signal_instance_ID);
  1483.                         my $correct_zone = GET_ZONE_NAME_BY_ID($signal_zone_ID);
  1484.                         quest::setglobal("$raid_invite_name$count","$raid_invite_pending","7","S$GetSeconds");
  1485.                         $client->Message(315," ");
  1486.                         $client->Message(315,"$Leader has re-invited you to join a Raid Instance in $zone_name.");
  1487.                         $client->Message(315,"Type: raid join $Leader (when you are in $correct_zone)");
  1488.                         # quest::gmsay("GM: $signal_zone_ID = $correct_zone", 18, 0);
  1489.                     }
  1490.                     $count = 0;
  1491.                 }
  1492.                 elsif (GET_QGLOBAL_VALUE("$raid_invite_name$count") eq $raid_invite_removed)
  1493.                 {
  1494.                     if ($signal < 1000000000)
  1495.                     {
  1496.                         my $GetSeconds = GET_TIME_LEFT("RAID", $signal_instance_ID);
  1497.                         my $correct_zone = GET_ZONE_NAME_BY_ID($signal_zone_ID);
  1498.                         quest::setglobal("$raid_invite_name$count","$raid_invite_pending","7","S$GetSeconds");
  1499.                         $client->Message(315," ");
  1500.                         $client->Message(315,"$Leader has re-invited you to join a Raid Instance in $zone_name.");
  1501.                         $client->Message(315,"Type: raid join $Leader (when you are in $correct_zone)");
  1502.                         # quest::gmsay("GM: $signal_zone_ID = $correct_zone", 18, 0);
  1503.                     }
  1504.                     $count = 0;
  1505.                 }
  1506.                 else
  1507.                 {
  1508.                     $count ++;
  1509.                 }
  1510.             }
  1511.             else
  1512.             {
  1513.                 ###############################################################################
  1514.                 my $GetSeconds = GET_TIME_LEFT("RAID", $signal_instance_ID);
  1515.                 my $correct_zone = GET_ZONE_NAME_BY_ID($signal_zone_ID);
  1516.                 quest::setglobal("$raid_invite_name$count","$raid_invite_pending","7","S$GetSeconds");
  1517.                 $client->Message(315," ");
  1518.                 $client->Message(315,"$Leader has invited you to join a Raid Instance in $zone_name.");
  1519.                 $client->Message(315,"Type: raid join $Leader (when you are in $correct_zone)");
  1520.                 # quest::gmsay("GM: $signal_zone_ID = $correct_zone", 18, 0);
  1521.                 $count = 0;
  1522.             }
  1523.         }
  1524.         $qglobals{"$Check_R_Invite"} = undef;
  1525.         $qglobals{"$Check_R_Leader"} = undef;
  1526.     }
  1527.     # END IF RAID INVITE ########################################################################################################
  1528.     #############################################################################################################################
  1529.  
  1530. } # End EVENT_SIGNAL
  1531.  
  1532.  
  1533. #################################################################################################################################
  1534. ####   CUSTOM SUBS   ############################################################################################################
  1535. #################################################################################################################################
  1536.  
  1537.  
  1538. ### Usage: PayInstance("Creditname", Cost, "Solo/Guild/Raid");
  1539. ### This will take into account the whole account of the player
  1540. sub PayInstance
  1541. {
  1542.     my $CreditName = $_[0];
  1543.     my $Cost = $_[1];
  1544.     my $Instance_Type = $_[2]; # Solo, Guild, or Raid
  1545.     my $client = plugin::val('$client');
  1546.     my $name = plugin::val('$name');
  1547.     my $zonesn = plugin::val('$zonesn');
  1548.     my $qglobals = plugin::var('qglobals');
  1549.     my $space = "_";
  1550.     my $accountid = $client->AccountID();
  1551.     my $accountname = $client->AccountName();
  1552.     # my $CreditAmnt = GET_QGLOBAL_VALUE("$CreditName$space$accountid");
  1553.     my $CreditAmnt = GET_QGLOBAL_VALUE("$CreditName$space$accountid");
  1554.     my $CreditAmnt2 = commify2($CreditAmnt - $Cost);
  1555.     my $CostCommify = commify2($Cost);
  1556.     if ($CreditAmnt < $Cost)
  1557.     {
  1558.         $client->Message(315,"Insuffient funds... You need " . ($Cost - $CreditAmnt) . " more Platinum pieces.");
  1559.     }
  1560.     else
  1561.     {
  1562.         $CreditAmnt -= $Cost;
  1563.         $client->SetGlobal("$CreditName$space$accountid", "$CreditAmnt", 7, 'F');
  1564.         $client->Message(315," ");
  1565.         $client->Message(315,"You now have $CreditAmnt2 platinum left.");
  1566.         my $ClientCheck = PlayerClientCheck();
  1567.         my $timestamp = localtime(time);
  1568.         quest::popup("Account Balance","
  1569.             <c \"#FFFF66\">Time : </c> $timestamp </c> <br>
  1570.             <c \"#FFFF66\">Client : </c> $ClientCheck </c> <br>
  1571.             <c \"#FFFF66\">Account : </c> $accountname <br>
  1572.             <c \"#FFFF66\">Character : </c>$name <br>
  1573.             <c \"#FFFF66\">Zone Name : </c>$zonesn <br>
  1574.             <c \"#FFFF66\">Instance Type : </c>$Instance_Type <br>
  1575.             <c \"#FFFF66\">Cost from Account : </c>  <c \"#FE2E2E</c> - $CostCommify </c> <br>
  1576.             <c \"#FFFF66\">Remaining Balance : </c> <c \"#33FF99\"> $CreditAmnt2 </c> <br>
  1577.             <br>
  1578.             <c \"#FE2E2E\">WARNING:  </c> Like other <c \"#FFFF66\">Qglobals</c>, sometimes the zone will bug out
  1579.             and not see the current values. If your balance or instance has disappeared, try going to a public zone
  1580.             or different zone to see if it gets refresh.
  1581.             We apologize for the inconvenience as it will reappear in time.
  1582.             ");
  1583.     }
  1584.     $qglobals{"$CreditName$space$accountid"} = undef;
  1585. } # End PayInstance
  1586.  
  1587.  
  1588. ### POP UP TO DISPLAY WAYPOINT BALANCE
  1589. sub Check_Balance
  1590. {
  1591.     my $CreditName = $_[0];
  1592.     my $client = plugin::val('$client');
  1593.     my $name = plugin::val('$name');
  1594.     my $zonesn = plugin::val('$zonesn');
  1595.     my $qglobals = plugin::var('qglobals');
  1596.     my $space = "_";
  1597.     my $accountid = $client->AccountID();
  1598.     my $accountname = $client->AccountName();
  1599.     # my $CreditAmnt = GET_QGLOBAL_VALUE("$CreditName$space$accountid");
  1600.     my $CreditAmnt = GET_QGLOBAL_VALUE("$CreditName$space$accountid");
  1601.     my $CreditAmnt2 = commify2($CreditAmnt);
  1602.     # my $CreditAmnt2 = $CreditAmnt - $Cost;
  1603.     my $ClientCheck = PlayerClientCheck();
  1604.     my $timestamp = localtime(time);
  1605.     quest::popup("Account Balance","
  1606.             <c \"#FFFF66\">Time : </c> $timestamp </c> <br>
  1607.             <c \"#FFFF66\">Client : </c> $ClientCheck </c> <br>
  1608.             <c \"#FFFF66\">Account : </c> $accountname <br>
  1609.             <c \"#FFFF66\">Character : </c>$name <br>
  1610.             <c \"#FFFF66\">Zone Name : </c>$zonesn <br>
  1611.             <c \"#FFFF66\">Remaining Balance : </c> <c \"#33FF99\"> $CreditAmnt2 </c> <br>
  1612.             <br>
  1613.             <c \"#FE2E2E\">WARNING:  </c> Like other <c \"#FFFF66\">Qglobals</c> , sometimes the zone will bug out
  1614.             and not see the current values. If your balance or instance has disappeared, try going to a public zone
  1615.             or different zone to see if it gets refresh.
  1616.             We apologize for the inconvenience as it will reappear in time.
  1617.             ");
  1618.     $client->Message(315," ");
  1619.     $client->Message(315,"You now have $CreditAmnt2 platinum left.");
  1620.     $qglobals{"$CreditName$space$accountid"} = undef;
  1621. } # End Check_Balance
  1622.  
  1623.  
  1624. ### Check Expansion Name
  1625. sub PlayerClientCheck
  1626. {
  1627.     my $client = plugin::val('$client');
  1628.     my $clientver = $client->GetClientVersion();
  1629.     my $ShowClient = "";
  1630.     if      ($clientver == 2)   { $ShowClient = "Titanium"; }
  1631.     elsif   ($clientver == 3)   { $ShowClient = "Secrets of Faydwer"; }
  1632.     elsif   ($clientver == 4)   { $ShowClient = "Seeds of Destruction"; }
  1633.     elsif   ($clientver == 5)   { $ShowClient = "Underfoot"; }
  1634.     else                        { $ShowClient = "Other"; }
  1635.     return "$ShowClient";
  1636. }
  1637.  
  1638.  
  1639. ### Change 1000000 to 1,000,000
  1640. sub commify2
  1641. {
  1642.    local $_  = shift;
  1643.    s{(?<!\d|\.)(\d{4,})}
  1644.     {my $n = $1;
  1645.      $n=~s/(?<=.)(?=(?:.{3})+$)/,/g;
  1646.      $n;
  1647.     }eg;
  1648.    return $_;
  1649. }
  1650.  
  1651.  
  1652. sub SOLO_PRICE
  1653. {
  1654.     my $client = plugin::val('$client');
  1655.     my $freeinstance = plugin::check_hasitem($client, 120003);  #EDIT item ID for FREE instance item
  1656.     my $paidinstance = plugin::check_hasitem($client, 119998);  #EDIT item ID for PAID instance item
  1657.     my $new_price = 5000;
  1658.  
  1659.     if      ($freeinstance) { $new_price = 0; }
  1660.     elsif   ($paidinstance) {
  1661.                                 # $new_price = 1000;
  1662.                                 if ($zonesn eq "trakanon" ||
  1663.                                     $zonesn eq "permafrost" ||
  1664.                                     $zonesn eq "dalnir" ||
  1665.                                     $zonesn eq "velketor" ||
  1666.                                     $zonesn eq "eastkarana" ||
  1667.                                     $zonesn eq "highpasshold" ||
  1668.                                     $zonesn eq "highpass" ||
  1669.                                     $zonesn eq "unrest" ||
  1670.                                     $zonesn eq "crushbone" ||
  1671.                                     $zonesn eq "sebilis" ||
  1672.                                     $zonesn eq "lakerathe" ||
  1673.                                     $zonesn eq "soldungb" ||
  1674.                                     $zonesn eq "citymist" ||
  1675.                                     $zonesn eq "qeytoqrg" ||
  1676.                                     $zonesn eq "mistmoore" ||
  1677.                                     $zonesn eq "steamfont" ||
  1678.                                     $zonesn eq "gukbottom" ||
  1679.                                     $zonesn eq "oot" ||
  1680.                                     $zonesn eq "najena" ||
  1681.                                     $zonesn eq "befallen")
  1682.                                                                 { $new_price  = 25000; }
  1683.                                 if ($zonesn eq "postorms")      { $new_price  = 75000; }
  1684.                                 if ($zonesn eq "hohonora")      { $new_price  = 125000; }
  1685.                                 if ($zonesn eq "illsalin")      { $new_price  = 175000; }
  1686.                                 if ($zonesn eq "anguish")       { $new_price  = 275000; }
  1687.                                 if ($zonesn eq "lopingplains")  { $new_price  = 425000; }
  1688.                                 if ($zonesn eq "frozenshadow")  { $new_price  = 6000000; }
  1689.                             }
  1690.     else                    { $new_price = 50000000; } # 50 Million Plat for not having a 1 Million Plat Waypoint Clickie
  1691.  
  1692.     $new_price = 0; # Temp while testing
  1693.  
  1694.     # DISABLED ZONES
  1695.     if ($zonesn eq "overthere")     { $new_price  = 999999999; } # Due to Custom PvP Area
  1696.     if ($zonesn eq "commons")       { $new_price  = 999999999; } # Due to Custom PvP Area
  1697.  
  1698.     return $new_price;
  1699. }
  1700.  
  1701.  
  1702. sub GUILD_PRICE
  1703. {
  1704.     my $freeinstance = plugin::check_hasitem($client, 120003);  #EDIT item ID for FREE instance item
  1705.     my $paidinstance = plugin::check_hasitem($client, 119998);  #EDIT item ID for PAID instance item
  1706.     my $new_price = 20000;
  1707.  
  1708.     if      ($freeinstance) { $new_price = 0; }
  1709.     elsif   ($paidinstance) {
  1710.                                 # $new_price = 3000;
  1711.                                 if ($zonesn eq "trakanon" ||
  1712.                                     $zonesn eq "permafrost" ||
  1713.                                     $zonesn eq "dalnir" ||
  1714.                                     $zonesn eq "velketor" ||
  1715.                                     $zonesn eq "eastkarana" ||
  1716.                                     $zonesn eq "highpasshold" ||
  1717.                                     $zonesn eq "highpass" ||
  1718.                                     $zonesn eq "unrest" ||
  1719.                                     $zonesn eq "crushbone" ||
  1720.                                     $zonesn eq "sebilis" ||
  1721.                                     $zonesn eq "lakerathe" ||
  1722.                                     $zonesn eq "soldungb" ||
  1723.                                     $zonesn eq "citymist" ||
  1724.                                     $zonesn eq "qeytoqrg" ||
  1725.                                     $zonesn eq "mistmoore" ||
  1726.                                     $zonesn eq "steamfont" ||
  1727.                                     $zonesn eq "gukbottom" ||
  1728.                                     $zonesn eq "oot" ||
  1729.                                     $zonesn eq "najena" ||
  1730.                                     $zonesn eq "befallen")
  1731.                                                                 { $new_price  = 50000; }
  1732.                                 if ($zonesn eq "postorms")      { $new_price  = 100000; }
  1733.                                 if ($zonesn eq "hohonora")      { $new_price  = 150000; }
  1734.                                 if ($zonesn eq "illsalin")      { $new_price  = 250000; }
  1735.                                 if ($zonesn eq "anguish")       { $new_price  = 350000; }
  1736.                                 if ($zonesn eq "lopingplains")  { $new_price  = 500000; }
  1737.                                 if ($zonesn eq "frozenshadow")  { $new_price  = 9000000; }
  1738.                             }
  1739.     else                    { $new_price = 50000000; } # 50 Million Plat for not having a 1 Million Plat Waypoint Clickie
  1740.  
  1741.     $new_price = 0; # Temp while testing
  1742.  
  1743.     # DISABLED ZONES
  1744.     if ($zonesn eq "overthere")     { $new_price  = 999999999; } # Due to Custom PvP Area
  1745.     if ($zonesn eq "commons")       { $new_price  = 999999999; } # Due to Custom PvP Area
  1746.  
  1747.     return $new_price;
  1748. }
  1749.  
  1750.  
  1751. sub RAID_PRICE
  1752. {
  1753.     my $freeinstance = plugin::check_hasitem($client, 120003);  #EDIT item ID for FREE instance item
  1754.     my $paidinstance = plugin::check_hasitem($client, 119998);  #EDIT item ID for PAID instance item
  1755.     my $new_price = 20000;
  1756.  
  1757.     if      ($freeinstance) { $new_price = 0; }
  1758.     elsif   ($paidinstance) {
  1759.                                 # $new_price = 5000;
  1760.                                 if ($zonesn eq "trakanon" ||
  1761.                                     $zonesn eq "permafrost" ||
  1762.                                     $zonesn eq "dalnir" ||
  1763.                                     $zonesn eq "velketor" ||
  1764.                                     $zonesn eq "eastkarana" ||
  1765.                                     $zonesn eq "highpasshold" ||
  1766.                                     $zonesn eq "highpass" ||
  1767.                                     $zonesn eq "unrest" ||
  1768.                                     $zonesn eq "crushbone" ||
  1769.                                     $zonesn eq "sebilis" ||
  1770.                                     $zonesn eq "lakerathe" ||
  1771.                                     $zonesn eq "soldungb" ||
  1772.                                     $zonesn eq "citymist" ||
  1773.                                     $zonesn eq "qeytoqrg" ||
  1774.                                     $zonesn eq "mistmoore" ||
  1775.                                     $zonesn eq "steamfont" ||
  1776.                                     $zonesn eq "gukbottom" ||
  1777.                                     $zonesn eq "oot" ||
  1778.                                     $zonesn eq "najena" ||
  1779.                                     $zonesn eq "befallen")
  1780.                                                                 { $new_price  = 50000; }
  1781.                                 if ($zonesn eq "postorms")      { $new_price  = 100000; }
  1782.                                 if ($zonesn eq "hohonora")      { $new_price  = 150000; }
  1783.                                 if ($zonesn eq "illsalin")      { $new_price  = 250000; }
  1784.                                 if ($zonesn eq "anguish")       { $new_price  = 350000; }
  1785.                                 if ($zonesn eq "lopingplains")  { $new_price  = 500000; }
  1786.                                 if ($zonesn eq "frozenshadow")  { $new_price  = 9000000; }
  1787.                             }
  1788.     else                    { $new_price = 50000000; } # 50 Million Plat for not having a 1 Million Plat Waypoint Clickie
  1789.  
  1790.     $new_price = 0; # Temp while testing
  1791.  
  1792.     # DISABLED ZONES
  1793.     if ($zonesn eq "overthere")     { $new_price  = 999999999; } # Due to Custom PvP Area
  1794.     if ($zonesn eq "commons")       { $new_price  = 999999999; } # Due to Custom PvP Area
  1795.  
  1796.     return $new_price;
  1797. }
  1798.  
  1799.  
  1800. ### Gets the amount of time left for the instance so we can sync/set qglobal expire times
  1801. ### for invited player (on list) qglobal and leader created instance qglobal to expire at same time
  1802. sub GET_TIME_LEFT
  1803. {
  1804.     my $instance_type   = $_[0]; # GUILD / RAID
  1805.     my $InstID          = $_[1]; # ID OF INSTANCE
  1806.     my $TimeName        = "";
  1807.     my $qglobals        = plugin::var('qglobals');
  1808.     my $LeaderTime      = "";
  1809.     my $ExpireTime      = 0;
  1810.     my $TimeLeft        = 0;
  1811.  
  1812.     if ($instance_type eq "RAID")   { $TimeName = "_RaidI_Time"; }
  1813.     if ($instance_type eq "GUILD")  { $TimeName = "_GuildI_Time"; }
  1814.     $LeaderTime = $InstID . $TimeName;
  1815.     if (GET_QGLOBAL_VALUE("$LeaderTime"))
  1816.     {
  1817.         $ExpireTime = GET_QGLOBAL_VALUE("$LeaderTime");
  1818.         $TimeLeft = $ExpireTime - time();
  1819.     }
  1820.  
  1821.     return $TimeLeft
  1822. }
  1823.  
  1824.  
  1825. sub GET_ZONE_NAME_BY_ID
  1826. {
  1827.     if ($_[0] == 0) { return("Invalid Zone"); }
  1828.     elsif ($_[0] == 1) { return("qeynos"); }
  1829.     elsif ($_[0] == 2) { return("qeynos2"); }
  1830.     elsif ($_[0] == 3) { return("qrg"); }
  1831.     elsif ($_[0] == 4) { return("qeytoqrg"); }
  1832.     elsif ($_[0] == 5) { return("highpass"); }
  1833.     elsif ($_[0] == 6) { return("highkeep"); }
  1834.     elsif ($_[0] == 8) { return("freportn"); }
  1835.     elsif ($_[0] == 9) { return("freportw"); }
  1836.     elsif ($_[0] == 10) { return("freporte"); }
  1837.     elsif ($_[0] == 11) { return("runnyeye"); }
  1838.     elsif ($_[0] == 12) { return("qey2hh1"); }
  1839.     elsif ($_[0] == 13) { return("northkarana"); }
  1840.     elsif ($_[0] == 14) { return("southkarana"); }
  1841.     elsif ($_[0] == 15) { return("eastkarana"); }
  1842.     elsif ($_[0] == 16) { return("beholder"); }
  1843.     elsif ($_[0] == 17) { return("blackburrow"); }
  1844.     elsif ($_[0] == 18) { return("paw"); }
  1845.     elsif ($_[0] == 19) { return("rivervale"); }
  1846.     elsif ($_[0] == 20) { return("kithicor"); }
  1847.     elsif ($_[0] == 21) { return("commons"); }
  1848.     elsif ($_[0] == 22) { return("ecommons"); }
  1849.     elsif ($_[0] == 23) { return("erudnint"); }
  1850.     elsif ($_[0] == 24) { return("erudnext"); }
  1851.     elsif ($_[0] == 25) { return("nektulos"); }
  1852.     elsif ($_[0] == 25) { return("nektulos"); }
  1853.     elsif ($_[0] == 26) { return("cshome"); }
  1854.     elsif ($_[0] == 27) { return("lavastorm"); }
  1855.     elsif ($_[0] == 28) { return("nektropos"); }
  1856.     elsif ($_[0] == 29) { return("halas"); }
  1857.     elsif ($_[0] == 30) { return("everfrost"); }
  1858.     elsif ($_[0] == 31) { return("soldunga"); }
  1859.     elsif ($_[0] == 32) { return("soldungb"); }
  1860.     elsif ($_[0] == 33) { return("misty"); }
  1861.     elsif ($_[0] == 34) { return("nro"); }
  1862.     elsif ($_[0] == 35) { return("sro"); }
  1863.     elsif ($_[0] == 36) { return("befallen"); }
  1864.     elsif ($_[0] == 37) { return("oasis"); }
  1865.     elsif ($_[0] == 38) { return("tox"); }
  1866.     elsif ($_[0] == 39) { return("hole"); }
  1867.     elsif ($_[0] == 40) { return("neriaka"); }
  1868.     elsif ($_[0] == 41) { return("neriakb"); }
  1869.     elsif ($_[0] == 42) { return("neriakc"); }
  1870.     elsif ($_[0] == 43) { return("neriakd"); }
  1871.     elsif ($_[0] == 44) { return("najena"); }
  1872.     elsif ($_[0] == 45) { return("qcat"); }
  1873.     elsif ($_[0] == 46) { return("innothule"); }
  1874.     elsif ($_[0] == 47) { return("feerrott"); }
  1875.     elsif ($_[0] == 48) { return("cazicthule"); }
  1876.     elsif ($_[0] == 49) { return("oggok"); }
  1877.     elsif ($_[0] == 50) { return("rathemtn"); }
  1878.     elsif ($_[0] == 51) { return("lakerathe"); }
  1879.     elsif ($_[0] == 52) { return("grobb"); }
  1880.     elsif ($_[0] == 53) { return("aviak"); }
  1881.     elsif ($_[0] == 54) { return("gfaydark"); }
  1882.     elsif ($_[0] == 55) { return("akanon"); }
  1883.     elsif ($_[0] == 56) { return("steamfont"); }
  1884.     elsif ($_[0] == 57) { return("lfaydark"); }
  1885.     elsif ($_[0] == 58) { return("crushbone"); }
  1886.     elsif ($_[0] == 59) { return("mistmoore"); }
  1887.     elsif ($_[0] == 60) { return("kaladima"); }
  1888.     elsif ($_[0] == 61) { return("felwithea"); }
  1889.     elsif ($_[0] == 62) { return("felwitheb"); }
  1890.     elsif ($_[0] == 63) { return("unrest"); }
  1891.     elsif ($_[0] == 64) { return("kedge"); }
  1892.     elsif ($_[0] == 65) { return("guktop"); }
  1893.     elsif ($_[0] == 66) { return("gukbottom"); }
  1894.     elsif ($_[0] == 67) { return("kaladimb"); }
  1895.     elsif ($_[0] == 68) { return("butcher"); }
  1896.     elsif ($_[0] == 69) { return("oot"); }
  1897.     elsif ($_[0] == 70) { return("cauldron"); }
  1898.     elsif ($_[0] == 71) { return("airplane"); }
  1899.     elsif ($_[0] == 72) { return("fearplane"); }
  1900.     elsif ($_[0] == 73) { return("permafrost"); }
  1901.     elsif ($_[0] == 74) { return("kerraridge"); }
  1902.     elsif ($_[0] == 75) { return("paineel"); }
  1903.     elsif ($_[0] == 76) { return("hateplane"); }
  1904.     elsif ($_[0] == 77) { return("arena"); }
  1905.     elsif ($_[0] == 78) { return("fieldofbone"); }
  1906.     elsif ($_[0] == 79) { return("warslikswood"); }
  1907.     elsif ($_[0] == 80) { return("soltemple"); }
  1908.     elsif ($_[0] == 81) { return("droga"); }
  1909.     elsif ($_[0] == 82) { return("cabwest"); }
  1910.     elsif ($_[0] == 83) { return("swampofnohope"); }
  1911.     elsif ($_[0] == 84) { return("firiona"); }
  1912.     elsif ($_[0] == 85) { return("lakeofillomen"); }
  1913.     elsif ($_[0] == 86) { return("dreadlands"); }
  1914.     elsif ($_[0] == 87) { return("burningwood"); }
  1915.     elsif ($_[0] == 88) { return("kaesora"); }
  1916.     elsif ($_[0] == 89) { return("sebilis"); }
  1917.     elsif ($_[0] == 90) { return("citymist"); }
  1918.     elsif ($_[0] == 91) { return("skyfire"); }
  1919.     elsif ($_[0] == 92) { return("frontiermtns"); }
  1920.     elsif ($_[0] == 93) { return("overthere"); }
  1921.     elsif ($_[0] == 94) { return("emeraldjungle"); }
  1922.     elsif ($_[0] == 95) { return("trakanon"); }
  1923.     elsif ($_[0] == 96) { return("timorous"); }
  1924.     elsif ($_[0] == 97) { return("kurn"); }
  1925.     elsif ($_[0] == 98) { return("erudsxing"); }
  1926.     elsif ($_[0] == 100) { return("stonebrunt"); }
  1927.     elsif ($_[0] == 101) { return("warrens"); }
  1928.     elsif ($_[0] == 102) { return("karnor"); }
  1929.     elsif ($_[0] == 103) { return("chardok"); }
  1930.     elsif ($_[0] == 104) { return("dalnir"); }
  1931.     elsif ($_[0] == 105) { return("charasis"); }
  1932.     elsif ($_[0] == 106) { return("cabeast"); }
  1933.     elsif ($_[0] == 107) { return("nurga"); }
  1934.     elsif ($_[0] == 108) { return("veeshan"); }
  1935.     elsif ($_[0] == 109) { return("veksar"); }
  1936.     elsif ($_[0] == 110) { return("iceclad"); }
  1937.     elsif ($_[0] == 111) { return("frozenshadow"); }
  1938.     elsif ($_[0] == 112) { return("velketor"); }
  1939.     elsif ($_[0] == 113) { return("kael"); }
  1940.     elsif ($_[0] == 114) { return("skyshrine"); }
  1941.     elsif ($_[0] == 114) { return("skyshrine"); }
  1942.     elsif ($_[0] == 115) { return("thurgadina"); }
  1943.     elsif ($_[0] == 116) { return("eastwastes"); }
  1944.     elsif ($_[0] == 117) { return("cobaltscar"); }
  1945.     elsif ($_[0] == 118) { return("greatdivide"); }
  1946.     elsif ($_[0] == 119) { return("wakening"); }
  1947.     elsif ($_[0] == 120) { return("westwastes"); }
  1948.     elsif ($_[0] == 121) { return("crystal"); }
  1949.     elsif ($_[0] == 123) { return("necropolis"); }
  1950.     elsif ($_[0] == 124) { return("templeveeshan"); }
  1951.     elsif ($_[0] == 125) { return("sirens"); }
  1952.     elsif ($_[0] == 126) { return("mischiefplane"); }
  1953.     elsif ($_[0] == 127) { return("growthplane"); }
  1954.     elsif ($_[0] == 128) { return("sleeper"); }
  1955.     elsif ($_[0] == 129) { return("thurgadinb"); }
  1956.     elsif ($_[0] == 130) { return("erudsxing2"); }
  1957.     elsif ($_[0] == 150) { return("shadowhaven"); }
  1958.     elsif ($_[0] == 151) { return("bazaar"); }
  1959.     elsif ($_[0] == 151) { return("bazaar"); }
  1960.     elsif ($_[0] == 152) { return("nexus"); }
  1961.     elsif ($_[0] == 153) { return("echo"); }
  1962.     elsif ($_[0] == 154) { return("acrylia"); }
  1963.     elsif ($_[0] == 155) { return("sharvahl"); }
  1964.     elsif ($_[0] == 156) { return("paludal"); }
  1965.     elsif ($_[0] == 157) { return("fungusgrove"); }
  1966.     elsif ($_[0] == 158) { return("vexthal"); }
  1967.     elsif ($_[0] == 159) { return("sseru"); }
  1968.     elsif ($_[0] == 160) { return("katta"); }
  1969.     elsif ($_[0] == 161) { return("netherbian"); }
  1970.     elsif ($_[0] == 162) { return("ssratemple"); }
  1971.     elsif ($_[0] == 163) { return("griegsend"); }
  1972.     elsif ($_[0] == 164) { return("thedeep"); }
  1973.     elsif ($_[0] == 165) { return("shadeweaver"); }
  1974.     elsif ($_[0] == 166) { return("hollowshade"); }
  1975.     elsif ($_[0] == 167) { return("grimling"); }
  1976.     elsif ($_[0] == 168) { return("mseru"); }
  1977.     elsif ($_[0] == 169) { return("letalis"); }
  1978.     elsif ($_[0] == 170) { return("twilight"); }
  1979.     elsif ($_[0] == 171) { return("thegrey"); }
  1980.     elsif ($_[0] == 172) { return("tenebrous"); }
  1981.     elsif ($_[0] == 173) { return("maiden"); }
  1982.     elsif ($_[0] == 174) { return("dawnshroud"); }
  1983.     elsif ($_[0] == 175) { return("scarlet"); }
  1984.     elsif ($_[0] == 176) { return("umbral"); }
  1985.     elsif ($_[0] == 179) { return("akheva"); }
  1986.     elsif ($_[0] == 180) { return("arena2"); }
  1987.     elsif ($_[0] == 181) { return("jaggedpine"); }
  1988.     elsif ($_[0] == 182) { return("nedaria"); }
  1989.     elsif ($_[0] == 183) { return("tutorial"); }
  1990.     elsif ($_[0] == 184) { return("load"); }
  1991.     elsif ($_[0] == 185) { return("load2"); }
  1992.     elsif ($_[0] == 186) { return("hateplaneb"); }
  1993.     elsif ($_[0] == 187) { return("shadowrest"); }
  1994.     elsif ($_[0] == 188) { return("tutoriala"); }
  1995.     elsif ($_[0] == 189) { return("tutorialb"); }
  1996.     elsif ($_[0] == 190) { return("clz"); }
  1997.     elsif ($_[0] == 200) { return("codecay"); }
  1998.     elsif ($_[0] == 201) { return("pojustice"); }
  1999.     elsif ($_[0] == 202) { return("poknowledge"); }
  2000.     elsif ($_[0] == 203) { return("potranquility"); }
  2001.     elsif ($_[0] == 204) { return("ponightmare"); }
  2002.     elsif ($_[0] == 205) { return("podisease"); }
  2003.     elsif ($_[0] == 206) { return("poinnovation"); }
  2004.     elsif ($_[0] == 207) { return("potorment"); }
  2005.     elsif ($_[0] == 208) { return("povalor"); }
  2006.     elsif ($_[0] == 209) { return("bothunder"); }
  2007.     elsif ($_[0] == 210) { return("postorms"); }
  2008.     elsif ($_[0] == 211) { return("hohonora"); }
  2009.     elsif ($_[0] == 212) { return("solrotower"); }
  2010.     elsif ($_[0] == 213) { return("powar"); }
  2011.     elsif ($_[0] == 214) { return("potactics"); }
  2012.     elsif ($_[0] == 215) { return("poair"); }
  2013.     elsif ($_[0] == 216) { return("powater"); }
  2014.     elsif ($_[0] == 217) { return("pofire"); }
  2015.     elsif ($_[0] == 218) { return("poeartha"); }
  2016.     elsif ($_[0] == 219) { return("potimea"); }
  2017.     elsif ($_[0] == 220) { return("hohonorb"); }
  2018.     elsif ($_[0] == 221) { return("nightmareb"); }
  2019.     elsif ($_[0] == 222) { return("poearthb"); }
  2020.     elsif ($_[0] == 223) { return("potimeb"); }
  2021.     elsif ($_[0] == 224) { return("gunthak"); }
  2022.     elsif ($_[0] == 225) { return("dulak"); }
  2023.     elsif ($_[0] == 226) { return("torgiran"); }
  2024.     elsif ($_[0] == 227) { return("nadox"); }
  2025.     elsif ($_[0] == 228) { return("hatesfury"); }
  2026.     elsif ($_[0] == 229) { return("guka"); }
  2027.     elsif ($_[0] == 230) { return("ruja"); }
  2028.     elsif ($_[0] == 231) { return("taka"); }
  2029.     elsif ($_[0] == 232) { return("mira"); }
  2030.     elsif ($_[0] == 233) { return("mmca"); }
  2031.     elsif ($_[0] == 234) { return("gukb"); }
  2032.     elsif ($_[0] == 235) { return("rujb"); }
  2033.     elsif ($_[0] == 236) { return("takb"); }
  2034.     elsif ($_[0] == 237) { return("mirb"); }
  2035.     elsif ($_[0] == 238) { return("mmcb"); }
  2036.     elsif ($_[0] == 239) { return("gukc"); }
  2037.     elsif ($_[0] == 240) { return("rujc"); }
  2038.     elsif ($_[0] == 241) { return("takc"); }
  2039.     elsif ($_[0] == 242) { return("mirc"); }
  2040.     elsif ($_[0] == 243) { return("mmcc"); }
  2041.     elsif ($_[0] == 244) { return("gukd"); }
  2042.     elsif ($_[0] == 245) { return("rujd"); }
  2043.     elsif ($_[0] == 246) { return("takd"); }
  2044.     elsif ($_[0] == 247) { return("mird"); }
  2045.     elsif ($_[0] == 248) { return("mmcd"); }
  2046.     elsif ($_[0] == 249) { return("guke"); }
  2047.     elsif ($_[0] == 250) { return("ruje"); }
  2048.     elsif ($_[0] == 251) { return("take"); }
  2049.     elsif ($_[0] == 252) { return("mire"); }
  2050.     elsif ($_[0] == 253) { return("mmce"); }
  2051.     elsif ($_[0] == 254) { return("gukf"); }
  2052.     elsif ($_[0] == 255) { return("rujf"); }
  2053.     elsif ($_[0] == 256) { return("takf"); }
  2054.     elsif ($_[0] == 257) { return("mirf"); }
  2055.     elsif ($_[0] == 258) { return("mmcf"); }
  2056.     elsif ($_[0] == 259) { return("gukg"); }
  2057.     elsif ($_[0] == 260) { return("rujg"); }
  2058.     elsif ($_[0] == 261) { return("takg"); }
  2059.     elsif ($_[0] == 262) { return("mirg"); }
  2060.     elsif ($_[0] == 263) { return("mmcg"); }
  2061.     elsif ($_[0] == 264) { return("gukh"); }
  2062.     elsif ($_[0] == 265) { return("rujh"); }
  2063.     elsif ($_[0] == 266) { return("takh"); }
  2064.     elsif ($_[0] == 267) { return("mirh"); }
  2065.     elsif ($_[0] == 268) { return("mmch"); }
  2066.     elsif ($_[0] == 269) { return("ruji"); }
  2067.     elsif ($_[0] == 270) { return("taki"); }
  2068.     elsif ($_[0] == 271) { return("miri"); }
  2069.     elsif ($_[0] == 272) { return("mmci"); }
  2070.     elsif ($_[0] == 273) { return("rujj"); }
  2071.     elsif ($_[0] == 274) { return("takj"); }
  2072.     elsif ($_[0] == 275) { return("mirj"); }
  2073.     elsif ($_[0] == 276) { return("mmcj"); }
  2074.     elsif ($_[0] == 277) { return("chardokb"); }
  2075.     elsif ($_[0] == 278) { return("soldungc"); }
  2076.     elsif ($_[0] == 279) { return("abysmal"); }
  2077.     elsif ($_[0] == 280) { return("natimbi"); }
  2078.     elsif ($_[0] == 281) { return("qinimi"); }
  2079.     elsif ($_[0] == 282) { return("riwwi"); }
  2080.     elsif ($_[0] == 283) { return("barindu"); }
  2081.     elsif ($_[0] == 284) { return("ferubi"); }
  2082.     elsif ($_[0] == 285) { return("snpool"); }
  2083.     elsif ($_[0] == 286) { return("snlair"); }
  2084.     elsif ($_[0] == 287) { return("snplant"); }
  2085.     elsif ($_[0] == 288) { return("sncrematory"); }
  2086.     elsif ($_[0] == 289) { return("tipt"); }
  2087.     elsif ($_[0] == 290) { return("vxed"); }
  2088.     elsif ($_[0] == 291) { return("yxtta"); }
  2089.     elsif ($_[0] == 292) { return("uqua"); }
  2090.     elsif ($_[0] == 293) { return("kodtaz"); }
  2091.     elsif ($_[0] == 294) { return("ikkinz"); }
  2092.     elsif ($_[0] == 295) { return("qvic"); }
  2093.     elsif ($_[0] == 296) { return("inktuta"); }
  2094.     elsif ($_[0] == 297) { return("txevu"); }
  2095.     elsif ($_[0] == 298) { return("tacvi"); }
  2096.     elsif ($_[0] == 299) { return("qvicb"); }
  2097.     elsif ($_[0] == 300) { return("wallofslaughter"); }
  2098.     elsif ($_[0] == 301) { return("bloodfields"); }
  2099.     elsif ($_[0] == 302) { return("draniksscar"); }
  2100.     elsif ($_[0] == 303) { return("causeway"); }
  2101.     elsif ($_[0] == 304) { return("chambersa"); }
  2102.     elsif ($_[0] == 305) { return("chambersb"); }
  2103.     elsif ($_[0] == 306) { return("chambersc"); }
  2104.     elsif ($_[0] == 307) { return("chambersd"); }
  2105.     elsif ($_[0] == 308) { return("chamberse"); }
  2106.     elsif ($_[0] == 309) { return("chambersf"); }
  2107.     elsif ($_[0] == 316) { return("provinggrounds"); }
  2108.     elsif ($_[0] == 317) { return("anguish"); }
  2109.     elsif ($_[0] == 318) { return("dranikhollowsa"); }
  2110.     elsif ($_[0] == 319) { return("dranikhollowsb"); }
  2111.     elsif ($_[0] == 320) { return("dranikhollowsc"); }
  2112.     elsif ($_[0] == 328) { return("dranikcatacombsa"); }
  2113.     elsif ($_[0] == 329) { return("dranikcatacombsb"); }
  2114.     elsif ($_[0] == 330) { return("dranikcatacombsc"); }
  2115.     elsif ($_[0] == 331) { return("draniksewersa"); }
  2116.     elsif ($_[0] == 332) { return("draniksewersb"); }
  2117.     elsif ($_[0] == 333) { return("draniksewersc"); }
  2118.     elsif ($_[0] == 334) { return("riftseekers"); }
  2119.     elsif ($_[0] == 335) { return("harbingers"); }
  2120.     elsif ($_[0] == 336) { return("dranik"); }
  2121.     elsif ($_[0] == 337) { return("broodlands"); }
  2122.     elsif ($_[0] == 338) { return("stillmoona"); }
  2123.     elsif ($_[0] == 339) { return("stillmoonb"); }
  2124.     elsif ($_[0] == 340) { return("thundercrest"); }
  2125.     elsif ($_[0] == 341) { return("delvea"); }
  2126.     elsif ($_[0] == 342) { return("delveb"); }
  2127.     elsif ($_[0] == 343) { return("thenest"); }
  2128.     elsif ($_[0] == 344) { return("guildlobby"); }
  2129.     elsif ($_[0] == 345) { return("guildhall"); }
  2130.     elsif ($_[0] == 346) { return("barter"); }
  2131.     elsif ($_[0] == 347) { return("illsalin"); }
  2132.     elsif ($_[0] == 348) { return("illsalina"); }
  2133.     elsif ($_[0] == 349) { return("illsalinb"); }
  2134.     elsif ($_[0] == 350) { return("illsalinc"); }
  2135.     elsif ($_[0] == 351) { return("dreadspire"); }
  2136.     elsif ($_[0] == 354) { return("drachnidhive"); }
  2137.     elsif ($_[0] == 355) { return("drachnidhivea"); }
  2138.     elsif ($_[0] == 356) { return("drachnidhiveb"); }
  2139.     elsif ($_[0] == 357) { return("drachnidhivec"); }
  2140.     elsif ($_[0] == 358) { return("westkorlach"); }
  2141.     elsif ($_[0] == 359) { return("westkorlacha"); }
  2142.     elsif ($_[0] == 360) { return("westkorlachb"); }
  2143.     elsif ($_[0] == 361) { return("westkorlachc"); }
  2144.     elsif ($_[0] == 362) { return("eastkorlach"); }
  2145.     elsif ($_[0] == 363) { return("eastkorlacha"); }
  2146.     elsif ($_[0] == 364) { return("shadowspine"); }
  2147.     elsif ($_[0] == 365) { return("corathus"); }
  2148.     elsif ($_[0] == 366) { return("corathusa"); }
  2149.     elsif ($_[0] == 367) { return("corathusb"); }
  2150.     elsif ($_[0] == 368) { return("nektulosa"); }
  2151.     elsif ($_[0] == 369) { return("arcstone"); }
  2152.     elsif ($_[0] == 370) { return("relic"); }
  2153.     elsif ($_[0] == 371) { return("skylance"); }
  2154.     elsif ($_[0] == 372) { return("devastation"); }
  2155.     elsif ($_[0] == 373) { return("devastationa"); }
  2156.     elsif ($_[0] == 374) { return("rage"); }
  2157.     elsif ($_[0] == 375) { return("ragea"); }
  2158.     elsif ($_[0] == 376) { return("takishruins"); }
  2159.     elsif ($_[0] == 377) { return("takishruinsa"); }
  2160.     elsif ($_[0] == 378) { return("elddar"); }
  2161.     elsif ($_[0] == 379) { return("elddara"); }
  2162.     elsif ($_[0] == 380) { return("theater"); }
  2163.     elsif ($_[0] == 381) { return("theatera"); }
  2164.     elsif ($_[0] == 382) { return("freeporteast"); }
  2165.     elsif ($_[0] == 383) { return("freeportwest"); }
  2166.     elsif ($_[0] == 384) { return("freeportsewers"); }
  2167.     elsif ($_[0] == 385) { return("freeportacademy"); }
  2168.     elsif ($_[0] == 386) { return("freeporttemple"); }
  2169.     elsif ($_[0] == 387) { return("freeportmilitia"); }
  2170.     elsif ($_[0] == 388) { return("freeportarena"); }
  2171.     elsif ($_[0] == 389) { return("freeportcityhall"); }
  2172.     elsif ($_[0] == 390) { return("freeporttheater"); }
  2173.     elsif ($_[0] == 391) { return("freeporthall"); }
  2174.     elsif ($_[0] == 392) { return("northro"); }
  2175.     elsif ($_[0] == 393) { return("southro"); }
  2176.     elsif ($_[0] == 394) { return("crescent"); }
  2177.     elsif ($_[0] == 395) { return("moors"); }
  2178.     elsif ($_[0] == 396) { return("stonehive"); }
  2179.     elsif ($_[0] == 397) { return("mesa"); }
  2180.     elsif ($_[0] == 398) { return("roost"); }
  2181.     elsif ($_[0] == 399) { return("steppes"); }
  2182.     elsif ($_[0] == 400) { return("icefall"); }
  2183.     elsif ($_[0] == 401) { return("valdeholm"); }
  2184.     elsif ($_[0] == 402) { return("frostcrypt"); }
  2185.     elsif ($_[0] == 403) { return("sunderock"); }
  2186.     elsif ($_[0] == 404) { return("vergalid"); }
  2187.     elsif ($_[0] == 405) { return("direwind"); }
  2188.     elsif ($_[0] == 406) { return("ashengate"); }
  2189.     elsif ($_[0] == 407) { return("highpasshold"); }
  2190.     elsif ($_[0] == 408) { return("commonlands"); }
  2191.     elsif ($_[0] == 409) { return("oceanoftears"); }
  2192.     elsif ($_[0] == 410) { return("kithforest"); }
  2193.     elsif ($_[0] == 411) { return("befallenb"); }
  2194.     elsif ($_[0] == 412) { return("highpasskeep"); }
  2195.     elsif ($_[0] == 413) { return("innothuleb"); }
  2196.     elsif ($_[0] == 414) { return("toxxulia"); }
  2197.     elsif ($_[0] == 415) { return("mistythicket"); }
  2198.     elsif ($_[0] == 416) { return("kattacastrum"); }
  2199.     elsif ($_[0] == 417) { return("thalassius"); }
  2200.     elsif ($_[0] == 418) { return("atiiki"); }
  2201.     elsif ($_[0] == 419) { return("zhisza"); }
  2202.     elsif ($_[0] == 420) { return("silyssar"); }
  2203.     elsif ($_[0] == 421) { return("solteris"); }
  2204.     elsif ($_[0] == 422) { return("barren"); }
  2205.     elsif ($_[0] == 423) { return("buriedsea"); }
  2206.     elsif ($_[0] == 424) { return("jardelshook"); }
  2207.     elsif ($_[0] == 425) { return("monkeyrock"); }
  2208.     elsif ($_[0] == 426) { return("suncrest"); }
  2209.     elsif ($_[0] == 427) { return("deadbone"); }
  2210.     elsif ($_[0] == 428) { return("blacksail"); }
  2211.     elsif ($_[0] == 429) { return("maidensgrave"); }
  2212.     elsif ($_[0] == 430) { return("redfeather"); }
  2213.     elsif ($_[0] == 431) { return("shipmvp"); }
  2214.     elsif ($_[0] == 432) { return("shipmvu"); }
  2215.     elsif ($_[0] == 433) { return("shippvu"); }
  2216.     elsif ($_[0] == 434) { return("shipuvu"); }
  2217.     elsif ($_[0] == 435) { return("shipmvm"); }
  2218.     elsif ($_[0] == 436) { return("mechanotus"); }
  2219.     elsif ($_[0] == 437) { return("mansion"); }
  2220.     elsif ($_[0] == 438) { return("steamfactory"); }
  2221.     elsif ($_[0] == 439) { return("shipworkshop"); }
  2222.     elsif ($_[0] == 440) { return("gyrospireb"); }
  2223.     elsif ($_[0] == 441) { return("gyrospirez"); }
  2224.     elsif ($_[0] == 442) { return("dragonscale"); }
  2225.     elsif ($_[0] == 443) { return("lopingplains"); }
  2226.     elsif ($_[0] == 444) { return("hillsofshade"); }
  2227.     elsif ($_[0] == 445) { return("bloodmoon"); }
  2228.     elsif ($_[0] == 446) { return("crystallos"); }
  2229.     elsif ($_[0] == 447) { return("guardian"); }
  2230.     elsif ($_[0] == 448) { return("steamfontmts"); }
  2231.     elsif ($_[0] == 449) { return("cryptofshade"); }
  2232.     elsif ($_[0] == 451) { return("dragonscaleb"); }
  2233.     elsif ($_[0] == 452) { return("oldfieldofbone"); }
  2234.     elsif ($_[0] == 453) { return("oldkaesoraa"); }
  2235.     elsif ($_[0] == 454) { return("oldkaesorab"); }
  2236.     elsif ($_[0] == 455) { return("oldkurn"); }
  2237.     elsif ($_[0] == 456) { return("oldkithicor"); }
  2238.     elsif ($_[0] == 457) { return("oldcommons"); }
  2239.     elsif ($_[0] == 458) { return("oldhighpass"); }
  2240.     elsif ($_[0] == 459) { return("thevoida"); }
  2241.     elsif ($_[0] == 460) { return("thevoidb"); }
  2242.     elsif ($_[0] == 461) { return("thevoidc"); }
  2243.     elsif ($_[0] == 462) { return("thevoidd"); }
  2244.     elsif ($_[0] == 463) { return("thevoide"); }
  2245.     elsif ($_[0] == 464) { return("thevoidf"); }
  2246.     elsif ($_[0] == 465) { return("thevoidg"); }
  2247.     elsif ($_[0] == 466) { return("oceangreenhills"); }
  2248.     elsif ($_[0] == 467) { return("oceangreenvillage"); }
  2249.     elsif ($_[0] == 468) { return("oldblackburrow"); }
  2250.     elsif ($_[0] == 469) { return("bertoxtemple"); }
  2251.     elsif ($_[0] == 470) { return("discord"); }
  2252.     elsif ($_[0] == 471) { return("discordtower"); }
  2253.     elsif ($_[0] == 472) { return("oldbloodfield"); }
  2254.     elsif ($_[0] == 473) { return("precipiceofwar"); }
  2255.     elsif ($_[0] == 474) { return("olddranik"); }
  2256.     elsif ($_[0] == 475) { return("toskirakk"); }
  2257.     elsif ($_[0] == 476) { return("korascian"); }
  2258.     elsif ($_[0] == 477) { return("rathechamber"); }
  2259.     elsif ($_[0] == 480) { return("brellsrest"); }
  2260.     elsif ($_[0] == 481) { return("fungalforest"); }
  2261.     elsif ($_[0] == 482) { return("underquarry"); }
  2262.     elsif ($_[0] == 483) { return("coolingchamber"); }
  2263.     elsif ($_[0] == 484) { return("shiningcity"); }
  2264.     elsif ($_[0] == 485) { return("arthicrex"); }
  2265.     elsif ($_[0] == 486) { return("foundation"); }
  2266.     elsif ($_[0] == 487) { return("lichencreep"); }
  2267.     elsif ($_[0] == 488) { return("pellucid"); }
  2268.     elsif ($_[0] == 489) { return("stonesnake"); }
  2269.     elsif ($_[0] == 490) { return("brellstemple"); }
  2270.     elsif ($_[0] == 491) { return("convorteum"); }
  2271.     elsif ($_[0] == 492) { return("brellsarena"); }
  2272.     elsif ($_[0] == 493) { return("weddingchapel"); }
  2273.     elsif ($_[0] == 494) { return("weddingchapeldark"); }
  2274.     elsif ($_[0] == 495) { return("dragoncrypt"); }
  2275.     elsif ($_[0] == 700) { return("feerrott2"); }
  2276.     elsif ($_[0] == 701) { return("thulehouse1"); }
  2277.     elsif ($_[0] == 702) { return("thulehouse2"); }
  2278.     elsif ($_[0] == 703) { return("housegarden"); }
  2279.     elsif ($_[0] == 704) { return("thulelibrary"); }
  2280.     elsif ($_[0] == 705) { return("well"); }
  2281.     elsif ($_[0] == 706) { return("fallen"); }
  2282.     elsif ($_[0] == 707) { return("morellcastle"); }
  2283.     elsif ($_[0] == 708) { return("somnium"); }
  2284.     elsif ($_[0] == 709) { return("alkabormare"); }
  2285.     elsif ($_[0] == 710) { return("miragulmare"); }
  2286.     elsif ($_[0] == 711) { return("thuledream"); }
  2287.     elsif ($_[0] == 712) { return("neighborhood"); }
  2288.     elsif ($_[0] == 724) { return("argath"); }
  2289.     elsif ($_[0] == 725) { return("arelis"); }
  2290.     elsif ($_[0] == 726) { return("sarithcity"); }
  2291.     elsif ($_[0] == 727) { return("rubak"); }
  2292.     elsif ($_[0] == 728) { return("beastdomain"); }
  2293.     elsif ($_[0] == 729) { return("resplendent"); }
  2294.     elsif ($_[0] == 730) { return("pillarsalra"); }
  2295.     elsif ($_[0] == 731) { return("windsong"); }
  2296.     elsif ($_[0] == 732) { return("cityofbronze"); }
  2297.     elsif ($_[0] == 733) { return("sepulcher"); }
  2298.     elsif ($_[0] == 734) { return("eastsepulcher"); }
  2299.     elsif ($_[0] == 735) { return("westsepulcher"); }
  2300.     elsif ($_[0] == 996) { return("arttest"); }
  2301.     elsif ($_[0] == 998) { return("fhalls"); }
  2302.     elsif ($_[0] == 999) { return("apprentice"); }
  2303.     else { return("ELSE ERROR ZONE ID TO NAME"); }
  2304. } # End GET_ZONE_NAME_BY_ID()
  2305.  
  2306.  
  2307. ### Copy from Akkadius Plugin
  2308. sub ListZoneSNToID2
  2309. {
  2310.     my $ZoneSN = $_[0];
  2311.     my $text = plugin::val('$text');
  2312.     %ZoneList = (
  2313.         "qeynos" => 1,
  2314.         "qeynos2" => 2,
  2315.         "qrg" => 3,
  2316.         "qeytoqrg" => 4,
  2317.         "highpass" => 5,
  2318.         "highkeep" => 6,
  2319.         "freportn" => 8,
  2320.         "freportw" => 9,
  2321.         "freporte" => 10,
  2322.         "runnyeye" => 11,
  2323.         "qey2hh1" => 12,
  2324.         "northkarana" => 13,
  2325.         "southkarana" => 14,
  2326.         "eastkarana" => 15,
  2327.         "beholder" => 16,
  2328.         "blackburrow" => 17,
  2329.         "paw" => 18,
  2330.         "rivervale" => 19,
  2331.         "kithicor" => 20,
  2332.         "commons" => 21,
  2333.         "ecommons" => 22,
  2334.         "erudnint" => 23,
  2335.         "erudnext" => 24,
  2336.         "nektulos" => 25,
  2337.         "cshome" => 26,
  2338.         "lavastorm" => 27,
  2339.         "nektropos" => 28,
  2340.         "halas" => 29,
  2341.         "everfrost" => 30,
  2342.         "soldunga" => 31,
  2343.         "soldungb" => 32,
  2344.         "misty" => 33,
  2345.         "nro" => 34,
  2346.         "sro" => 35,
  2347.         "befallen" => 36,
  2348.         "oasis" => 37,
  2349.         "tox" => 38,
  2350.         "hole" => 39,
  2351.         "neriaka" => 40,
  2352.         "neriakb" => 41,
  2353.         "neriakc" => 42,
  2354.         "neriakd" => 43,
  2355.         "najena" => 44,
  2356.         "qcat" => 45,
  2357.         "innothule" => 46,
  2358.         "feerrott" => 47,
  2359.         "cazicthule" => 48,
  2360.         "oggok" => 49,
  2361.         "rathemtn" => 50,
  2362.         "lakerathe" => 51,
  2363.         "grobb" => 52,
  2364.         "aviak" => 53,
  2365.         "gfaydark" => 54,
  2366.         "akanon" => 55,
  2367.         "steamfont" => 56,
  2368.         "lfaydark" => 57,
  2369.         "crushbone" => 58,
  2370.         "mistmoore" => 59,
  2371.         "kaladima" => 60,
  2372.         "felwithea" => 61,
  2373.         "felwitheb" => 62,
  2374.         "unrest" => 63,
  2375.         "kedge" => 64,
  2376.         "guktop" => 65,
  2377.         "gukbottom" => 66,
  2378.         "kaladimb" => 67,
  2379.         "butcher" => 68,
  2380.         "oot" => 69,
  2381.         "cauldron" => 70,
  2382.         "airplane" => 71,
  2383.         "fearplane" => 72,
  2384.         "permafrost" => 73,
  2385.         "kerraridge" => 74,
  2386.         "paineel" => 75,
  2387.         "hateplane" => 76,
  2388.         "arena" => 77,
  2389.         "fieldofbone" => 78,
  2390.         "warslikswood" => 79,
  2391.         "soltemple" => 80,
  2392.         "droga" => 81,
  2393.         "cabwest" => 82,
  2394.         "swampofnohope" => 83,
  2395.         "firiona" => 84,
  2396.         "lakeofillomen" => 85,
  2397.         "dreadlands" => 86,
  2398.         "burningwood" => 87,
  2399.         "kaesora" => 88,
  2400.         "sebilis" => 89,
  2401.         "citymist" => 90,
  2402.         "skyfire" => 91,
  2403.         "frontiermtns" => 92,
  2404.         "overthere" => 93,
  2405.         "emeraldjungle" => 94,
  2406.         "trakanon" => 95,
  2407.         "timorous" => 96,
  2408.         "kurn" => 97,
  2409.         "erudsxing" => 98,
  2410.         "stonebrunt" => 100,
  2411.         "warrens" => 101,
  2412.         "karnor" => 102,
  2413.         "chardok" => 103,
  2414.         "dalnir" => 104,
  2415.         "charasis" => 105,
  2416.         "cabeast" => 106,
  2417.         "nurga" => 107,
  2418.         "veeshan" => 108,
  2419.         "veksar" => 109,
  2420.         "iceclad" => 110,
  2421.         "frozenshadow" => 111,
  2422.         "velketor" => 112,
  2423.         "kael" => 113,
  2424.         "skyshrine" => 114,
  2425.         "thurgadina" => 115,
  2426.         "eastwastes" => 116,
  2427.         "cobaltscar" => 117,
  2428.         "greatdivide" => 118,
  2429.         "wakening" => 119,
  2430.         "westwastes" => 120,
  2431.         "crystal" => 121,
  2432.         "necropolis" => 123,
  2433.         "templeveeshan" => 124,
  2434.         "sirens" => 125,
  2435.         "mischiefplane" => 126,
  2436.         "growthplane" => 127,
  2437.         "sleeper" => 128,
  2438.         "thurgadinb" => 129,
  2439.         "erudsxing2" => 130,
  2440.         "shadowhaven" => 150,
  2441.         "bazaar" => 151,
  2442.         "nexus" => 152,
  2443.         "echo" => 153,
  2444.         "acrylia" => 154,
  2445.         "sharvahl" => 155,
  2446.         "paludal" => 156,
  2447.         "fungusgrove" => 157,
  2448.         "vexthal" => 158,
  2449.         "sseru" => 159,
  2450.         "katta" => 160,
  2451.         "netherbian" => 161,
  2452.         "ssratemple" => 162,
  2453.         "griegsend" => 163,
  2454.         "thedeep" => 164,
  2455.         "shadeweaver" => 165,
  2456.         "hollowshade" => 166,
  2457.         "grimling" => 167,
  2458.         "mseru" => 168,
  2459.         "letalis" => 169,
  2460.         "twilight" => 170,
  2461.         "thegrey" => 171,
  2462.         "tenebrous" => 172,
  2463.         "maiden" => 173,
  2464.         "dawnshroud" => 174,
  2465.         "scarlet" => 175,
  2466.         "umbral" => 176,
  2467.         "akheva" => 179,
  2468.         "arena2" => 180,
  2469.         "jaggedpine" => 181,
  2470.         "nedaria" => 182,
  2471.         "tutorial" => 183,
  2472.         "load" => 184,
  2473.         "load2" => 185,
  2474.         "hateplaneb" => 186,
  2475.         "shadowrest" => 187,
  2476.         "tutoriala" => 188,
  2477.         "tutorialb" => 189,
  2478.         "clz" => 190,
  2479.         "codecay" => 200,
  2480.         "pojustice" => 201,
  2481.         "poknowledge" => 202,
  2482.         "potranquility" => 203,
  2483.         "ponightmare" => 204,
  2484.         "podisease" => 205,
  2485.         "poinnovation" => 206,
  2486.         "potorment" => 207,
  2487.         "povalor" => 208,
  2488.         "bothunder" => 209,
  2489.         "postorms" => 210,
  2490.         "hohonora" => 211,
  2491.         "solrotower" => 212,
  2492.         "powar" => 213,
  2493.         "potactics" => 214,
  2494.         "poair" => 215,
  2495.         "powater" => 216,
  2496.         "pofire" => 217,
  2497.         "poeartha" => 218,
  2498.         "potimea" => 219,
  2499.         "hohonorb" => 220,
  2500.         "nightmareb" => 221,
  2501.         "poearthb" => 222,
  2502.         "potimeb" => 223,
  2503.         "gunthak" => 224,
  2504.         "dulak" => 225,
  2505.         "torgiran" => 226,
  2506.         "nadox" => 227,
  2507.         "hatesfury" => 228,
  2508.         "guka" => 229,
  2509.         "ruja" => 230,
  2510.         "taka" => 231,
  2511.         "mira" => 232,
  2512.         "mmca" => 233,
  2513.         "gukb" => 234,
  2514.         "rujb" => 235,
  2515.         "takb" => 236,
  2516.         "mirb" => 237,
  2517.         "mmcb" => 238,
  2518.         "gukc" => 239,
  2519.         "rujc" => 240,
  2520.         "takc" => 241,
  2521.         "mirc" => 242,
  2522.         "mmcc" => 243,
  2523.         "gukd" => 244,
  2524.         "rujd" => 245,
  2525.         "takd" => 246,
  2526.         "mird" => 247,
  2527.         "mmcd" => 248,
  2528.         "guke" => 249,
  2529.         "ruje" => 250,
  2530.         "take" => 251,
  2531.         "mire" => 252,
  2532.         "mmce" => 253,
  2533.         "gukf" => 254,
  2534.         "rujf" => 255,
  2535.         "takf" => 256,
  2536.         "mirf" => 257,
  2537.         "mmcf" => 258,
  2538.         "gukg" => 259,
  2539.         "rujg" => 260,
  2540.         "takg" => 261,
  2541.         "mirg" => 262,
  2542.         "mmcg" => 263,
  2543.         "gukh" => 264,
  2544.         "rujh" => 265,
  2545.         "takh" => 266,
  2546.         "mirh" => 267,
  2547.         "mmch" => 268,
  2548.         "ruji" => 269,
  2549.         "taki" => 270,
  2550.         "miri" => 271,
  2551.         "mmci" => 272,
  2552.         "rujj" => 273,
  2553.         "takj" => 274,
  2554.         "mirj" => 275,
  2555.         "mmcj" => 276,
  2556.         "chardokb" => 277,
  2557.         "soldungc" => 278,
  2558.         "abysmal" => 279,
  2559.         "natimbi" => 280,
  2560.         "qinimi" => 281,
  2561.         "riwwi" => 282,
  2562.         "barindu" => 283,
  2563.         "ferubi" => 284,
  2564.         "snpool" => 285,
  2565.         "snlair" => 286,
  2566.         "snplant" => 287,
  2567.         "sncrematory" => 288,
  2568.         "tipt" => 289,
  2569.         "vxed" => 290,
  2570.         "yxtta" => 291,
  2571.         "uqua" => 292,
  2572.         "kodtaz" => 293,
  2573.         "ikkinz" => 294,
  2574.         "qvic" => 295,
  2575.         "inktuta" => 296,
  2576.         "txevu" => 297,
  2577.         "tacvi" => 298,
  2578.         "qvicb" => 299,
  2579.         "wallofslaughter" => 300,
  2580.         "bloodfields" => 301,
  2581.         "draniksscar" => 302,
  2582.         "causeway" => 303,
  2583.         "chambersa" => 304,
  2584.         "chambersb" => 305,
  2585.         "chambersc" => 306,
  2586.         "chambersd" => 307,
  2587.         "chamberse" => 308,
  2588.         "chambersf" => 309,
  2589.         "provinggrounds" => 316,
  2590.         "anguish" => 317,
  2591.         "dranikhollowsa" => 318,
  2592.         "dranikhollowsb" => 319,
  2593.         "dranikhollowsc" => 320,
  2594.         "dranikhollowsd" => 321,
  2595.         "dranikhollowse" => 322,
  2596.         "dranikhollowsf" => 323,
  2597.         "dranikhollowsg" => 324,
  2598.         "dranikhollowsh" => 325,
  2599.         "dranikhollowsi" => 326,
  2600.         "dranikhollowsj" => 327,
  2601.         "dranikcatacombsa" => 328,
  2602.         "dranikcatacombsb" => 329,
  2603.         "dranikcatacombsc" => 330,
  2604.         "draniksewersa" => 331,
  2605.         "draniksewersb" => 332,
  2606.         "draniksewersc" => 333,
  2607.         "riftseekers" => 334,
  2608.         "harbingers" => 335,
  2609.         "dranik" => 336,
  2610.         "broodlands" => 337,
  2611.         "stillmoona" => 338,
  2612.         "stillmoonb" => 339,
  2613.         "thundercrest" => 340,
  2614.         "delvea" => 341,
  2615.         "delveb" => 342,
  2616.         "thenest" => 343,
  2617.         "guildlobby" => 344,
  2618.         "guildhall" => 345,
  2619.         "barter" => 346,
  2620.         "illsalin" => 347,
  2621.         "illsalina" => 348,
  2622.         "illsalinb" => 349,
  2623.         "illsalinc" => 350,
  2624.         "dreadspire" => 351,
  2625.         "drachnidhive" => 354,
  2626.         "drachnidhivea" => 355,
  2627.         "drachnidhiveb" => 356,
  2628.         "drachnidhivec" => 357,
  2629.         "westkorlach" => 358,
  2630.         "westkorlacha" => 359,
  2631.         "westkorlachb" => 360,
  2632.         "westkorlachc" => 361,
  2633.         "eastkorlach" => 362,
  2634.         "eastkorlacha" => 363,
  2635.         "shadowspine" => 364,
  2636.         "corathus" => 365,
  2637.         "corathusa" => 366,
  2638.         "corathusb" => 367,
  2639.         "nektulosa" => 368,
  2640.         "arcstone" => 369,
  2641.         "relic" => 370,
  2642.         "skylance" => 371,
  2643.         "devastation" => 372,
  2644.         "devastationa" => 373,
  2645.         "rage" => 374,
  2646.         "ragea" => 375,
  2647.         "takishruins" => 376,
  2648.         "takishruinsa" => 377,
  2649.         "elddar" => 378,
  2650.         "elddara" => 379,
  2651.         "theater" => 380,
  2652.         "theatera" => 381,
  2653.         "freeporteast" => 382,
  2654.         "freeportwest" => 383,
  2655.         "freeportsewers" => 384,
  2656.         "freeportacademy" => 385,
  2657.         "freeporttemple" => 386,
  2658.         "freeportmilitia" => 387,
  2659.         "freeportarena" => 388,
  2660.         "freeportcityhall" => 389,
  2661.         "freeporttheater" => 390,
  2662.         "freeporthall" => 391,
  2663.         "northro" => 392,
  2664.         "southro" => 393,
  2665.         "crescent" => 394,
  2666.         "moors" => 395,
  2667.         "stonehive" => 396,
  2668.         "mesa" => 397,
  2669.         "roost" => 398,
  2670.         "steppes" => 399,
  2671.         "icefall" => 400,
  2672.         "valdeholm" => 401,
  2673.         "frostcrypt" => 402,
  2674.         "sunderock" => 403,
  2675.         "vergalid" => 404,
  2676.         "direwind" => 405,
  2677.         "ashengate" => 406,
  2678.         "highpasshold" => 407,
  2679.         "commonlands" => 408,
  2680.         "oceanoftears" => 409,
  2681.         "kithforest" => 410,
  2682.         "befallenb" => 411,
  2683.         "highpasskeep" => 412,
  2684.         "innothuleb" => 413,
  2685.         "toxxulia" => 414,
  2686.         "mistythicket" => 415,
  2687.         "kattacastrum" => 416,
  2688.         "thalassius" => 417,
  2689.         "atiiki" => 418,
  2690.         "zhisza" => 419,
  2691.         "silyssar" => 420,
  2692.         "solteris" => 421,
  2693.         "barren" => 422,
  2694.         "buriedsea" => 423,
  2695.         "jardelshook" => 424,
  2696.         "monkeyrock" => 425,
  2697.         "suncrest" => 426,
  2698.         "deadbone" => 427,
  2699.         "blacksail" => 428,
  2700.         "maidensgrave" => 429,
  2701.         "redfeather" => 430,
  2702.         "shipmvp" => 431,
  2703.         "shipmvu" => 432,
  2704.         "shippvu" => 433,
  2705.         "shipuvu" => 434,
  2706.         "shipmvm" => 435,
  2707.         "mechanotus" => 436,
  2708.         "mansion" => 437,
  2709.         "steamfactory" => 438,
  2710.         "shipworkshop" => 439,
  2711.         "gyrospireb" => 440,
  2712.         "gyrospirez" => 441,
  2713.         "dragonscale" => 442,
  2714.         "lopingplains" => 443,
  2715.         "hillsofshade" => 444,
  2716.         "bloodmoon" => 445,
  2717.         "crystallos" => 446,
  2718.         "guardian" => 447,
  2719.         "steamfontmts" => 448,
  2720.         "cryptofshade" => 449,
  2721.         "dragonscaleb" => 451,
  2722.         "oldfieldofbone" => 452,
  2723.         "oldkaesoraa" => 453,
  2724.         "oldkaesorab" => 454,
  2725.         "oldkurn" => 455,
  2726.         "oldkithicor" => 456,
  2727.         "oldcommons" => 457,
  2728.         "oldhighpass" => 458,
  2729.         "thevoida" => 459,
  2730.         "thevoidb" => 460,
  2731.         "thevoidc" => 461,
  2732.         "thevoidd" => 462,
  2733.         "thevoide" => 463,
  2734.         "thevoidf" => 464,
  2735.         "thevoidg" => 465,
  2736.         "oceangreenhills" => 466,
  2737.         "oceangreenvillag" => 467,
  2738.         "oldblackburrow" => 468,
  2739.         "bertoxtemple" => 469,
  2740.         "discord" => 470,
  2741.         "discordtower" => 471,
  2742.         "oldbloodfield" => 472,
  2743.         "precipiceofwar" => 473,
  2744.         "olddranik" => 474,
  2745.         "toskirakk" => 475,
  2746.         "korascian" => 476,
  2747.         "rathechamber" => 477,
  2748.         "arttest" => 996,
  2749.         "fhalls" => 998,
  2750.         "apprentice" => 999,
  2751.         );
  2752.     $ZoneList{$ZoneSN};
  2753. } # End ListZoneSNToID2
  2754.  
  2755.  
  2756. ### Establish a Connection with password from Config File
  2757. sub LoadMySQLConnection_Alternative_Method
  2758. {
  2759.     use DBI;
  2760.     use DBD::mysql;
  2761.     # GET DB, USER, AND PASS FROM CONFIG FILE
  2762.     my $confile = "eqemu_config.xml"; #default config file
  2763.     open(F, "<$confile") or die "Unable to open config: $confile\n";
  2764.     my $indb = 0;
  2765.  
  2766.     while(<F>)
  2767.     {
  2768.         s/\r//g;
  2769.         if(/<database>/i)                       { $indb = 1; }
  2770.         next unless($indb == 1);
  2771.         if(/<\/database>/i)                     { $indb = 0; last; }
  2772.         if(/<host>(.*)<\/host>/i)               { $host = $1; }
  2773.         elsif(/<username>(.*)<\/username>/i)    { $user = $1; }
  2774.         elsif(/<password>(.*)<\/password>/i)    { $pass = $1; }
  2775.         elsif(/<db>(.*)<\/db>/i)                { $db   = $1; }
  2776.     }
  2777.  
  2778.     # DATA SOURCE NAME
  2779.     $dsn = "dbi:mysql:$db:localhost:3306";
  2780.     # PERL DBI CONNECT
  2781.     my $connect = DBI->connect($dsn, $user, $pass);
  2782.     return $connect;
  2783. } # End LoadMySQLConnection()
  2784.  
  2785.  
  2786.  
  2787. ### Establish a Connection with password from Config File
  2788. sub LoadMySQLConnection
  2789. {
  2790.     use DBI;
  2791.     use DBD::mysql;
  2792.     my $DATABASE_NAME       = "XXXXXXXXXXXX";
  2793.     my $DATABASE_USER       = "XXXXXXXXXXXX";
  2794.     my $DATABASE_PASSWORD   = "XXXXXXXXXXXX";
  2795.     my $dsn = "DBI:mysql:database=$DATABASE_NAME;host=localhost";
  2796.     my $connect = DBI->connect($dsn, $DATABASE_USER, $DATABASE_PASSWORD);
  2797.     return $connect;
  2798. } # End LoadMySQLConnection()
  2799.  
  2800.  
  2801. ### Very Simple: Get Qglobal Value and Return it
  2802. sub GET_QGLOBAL_VALUE
  2803. {
  2804.     # if(!$connect) { $connect = LoadMySQLConnection(); } # THIS LINE DID NOT WORK FOR ME
  2805.     my $connect = LoadMySQLConnection();
  2806.     my $qglobal_name    = $_[0];
  2807.     my $a_name          = "NULL";
  2808.     my $b_value         = "0";
  2809.     my $query           = "SELECT name, value FROM quest_globals WHERE name = '$qglobal_name' LIMIT 1";
  2810.     my $query_handle    = $connect->prepare($query);
  2811.     $query_handle->execute();
  2812.     if ($query_handle->rows)
  2813.     {   # START GET 1 RECORD
  2814.         my $ref     = $query_handle->fetchrow_hashref();
  2815.         $a_name     = $ref->{'name'};
  2816.         $b_value    = $ref->{'value'};
  2817.     }   # END GET 1 RECORD
  2818.     $query_handle->finish();
  2819.     $connect->disconnect();
  2820.     return $b_value;
  2821. } # End GET_QGLOBAL_VALUE()
  2822.  
  2823.  
  2824. ### Check if Qglobal is expired, return 0 for expired, and return 1 for not expired
  2825. ### This is required for SPAM timer to create/delete instances
  2826. sub GET_QGLOBAL_VALUE_EXPIRE
  2827. {
  2828.     # if(!$connect) { $connect = LoadMySQLConnection(); }
  2829.     my $connect = LoadMySQLConnection();
  2830.     my $qglobal_name    = $_[0];
  2831.     my $a_name          = "NULL";
  2832.     my $b_value         = "0";
  2833.     my $c_expdate       = 0;
  2834.     my $query           = "SELECT name, value, expdate FROM quest_globals WHERE name = '$qglobal_name' LIMIT 1";
  2835.     my $query_handle    = $connect->prepare($query);
  2836.     $query_handle->execute();
  2837.  
  2838.     ### EITHER GET RECORD OR RETURN 0 FOR EXPIRED
  2839.     if ($query_handle->rows)
  2840.     {   # START GET 1 RECORD
  2841.         my $ref     = $query_handle->fetchrow_hashref();
  2842.         $a_name     = $ref->{'name'};
  2843.         $b_value    = $ref->{'value'};
  2844.         $c_expdate  = $ref->{'expdate'};
  2845.         $query_handle->finish();
  2846.         $connect->disconnect(); # After getting 1 record, go ahead finish and disconnect, then compare time if expired
  2847.     }   # END GET 1 RECORD
  2848.     else # else no records are retrieved, therefore it doesn't exist and/or expired, return 0
  2849.     {
  2850.         # quest::gmsay("GET_QGLOBAL_VALUE_EXPIRE -1: DOES NOT EXIST!", 18, 0);
  2851.         $query_handle->finish();
  2852.         $connect->disconnect(); # If no record, then finish and disconnect before return
  2853.         return 0;
  2854.     }
  2855.  
  2856.     ### IF RECORD THEN FIND OUT IF THE TIME IS EXPIRED
  2857.     if ($c_expdate > time())
  2858.     {
  2859.         # quest::gmsay("GET_QGLOBAL_VALUE_EXPIRE 1: NOT EXPIRED", 18, 0);
  2860.         return 1;
  2861.     }
  2862.     else
  2863.     {
  2864.         # quest::gmsay("GET_QGLOBAL_VALUE_EXPIRE 0: EXPIRED", 18, 0);
  2865.         return 0;
  2866.     }
  2867. } # End GET_QGLOBAL_VALUE_EXPIRE()
  2868.  
  2869.  
  2870. #################################################################################################################################
  2871. ### START GM ONLY ###############################################################################################################
  2872. sub FIND_PLAYER_INSTANCE
  2873. {
  2874.     my $connect = LoadMySQLConnection(); # Connect to DB
  2875.     my $temp_id = 0;;
  2876.     my $temp_name = "NA";
  2877.     my $temp_x = 0;
  2878.     my $temp_y = 0;
  2879.     my $temp_z = 0;
  2880.     my $temp_zonename = "NA";
  2881.     my $temp_instanceid = 0;
  2882.     my $ZoneSNTOID = 0;
  2883.     my $query           = "SELECT id, name, x, y, z, zonename, instanceid FROM character_ WHERE name = '$_[0]' ORDER BY id DESC LIMIT 1";
  2884.     my $query_handle    = $connect->prepare($query);
  2885.     $query_handle->execute();
  2886.  
  2887.     # GET 1 RECORD
  2888.     if($query_handle->rows)
  2889.     {
  2890.         my $ref             = $query_handle->fetchrow_hashref();
  2891.         $temp_id            = $ref->{'id'};
  2892.         $temp_name          = $ref->{'name'};
  2893.         $temp_x             = $ref->{'x'};
  2894.         $temp_y             = $ref->{'y'};
  2895.         $temp_z             = $ref->{'z'};
  2896.         $temp_zonename      = $ref->{'zonename'};
  2897.         $temp_instanceid    = $ref->{'instanceid'};
  2898.         $ZoneSNTOID         = ListZoneSNToID2($temp_zonename);
  2899.     }
  2900.  
  2901.     $query_handle->finish();
  2902.     $connect->disconnect();
  2903.  
  2904.     if ($temp_name eq "NA")
  2905.     {
  2906.         $client->Message(7, "$_[0] not found!");
  2907.     }
  2908.     else
  2909.     {
  2910.         my $GOTO_PLAYER_LINK = quest::saylink("goto " . $temp_name, 1);
  2911.         $client->Message(7, " ");
  2912.         $client->Message(7, "Info for: $temp_name");
  2913.         $client->Message(7, "Char ID = $temp_id");
  2914.         $client->Message(7, "Char X = $temp_y");
  2915.         $client->Message(7, "Char Y = $temp_x");
  2916.         $client->Message(7, "Char Z = $temp_z");
  2917.         $client->Message(7, "Zone Name = $temp_zonename");
  2918.         $client->Message(7, "Instance ID = $temp_instanceid");
  2919.         $client->Message(7, "$GOTO_PLAYER_LINK");
  2920.     }
  2921. } # End FIND_PLAYER_INSTANCE()
  2922. #################################################################################################################################
  2923. #################################################################################################################################
  2924. sub GOTO_PLAYER_INSTANCE
  2925. {
  2926.     my $connect = LoadMySQLConnection(); # Connect to DB
  2927.     my $temp_id = 0;;
  2928.     my $temp_name = "NA";
  2929.     my $temp_x = 0;
  2930.     my $temp_y = 0;
  2931.     my $temp_z = 0;
  2932.     my $temp_zonename = "NA";
  2933.     my $temp_instanceid = 0;
  2934.     my $ZoneSNTOID = 0;
  2935.     my $query           = "SELECT id, name, x, y, z, zonename, instanceid FROM character_ WHERE name = '$_[0]' ORDER BY id DESC LIMIT 1";
  2936.     my $query_handle    = $connect->prepare($query);
  2937.     $query_handle->execute();
  2938.  
  2939.     # GET 1 RECORD
  2940.     if($query_handle->rows)
  2941.     {
  2942.         my $ref             = $query_handle->fetchrow_hashref();
  2943.         $temp_id            = $ref->{'id'};
  2944.         $temp_name          = $ref->{'name'};
  2945.         $temp_x             = $ref->{'x'};
  2946.         $temp_y             = $ref->{'y'};
  2947.         $temp_z             = $ref->{'z'};
  2948.         $temp_zonename      = $ref->{'zonename'};
  2949.         $temp_instanceid    = $ref->{'instanceid'};
  2950.         $ZoneSNTOID         = ListZoneSNToID2($temp_zonename);
  2951.     }
  2952.  
  2953.     $query_handle->finish();
  2954.     $connect->disconnect();
  2955.  
  2956.     $client->Message(7, " ");
  2957.  
  2958.     if ($temp_instanceid > 0)
  2959.     {
  2960.         $client->Message(7, "$temp_name is in instance id $temp_instanceid.");
  2961.         $client->Message(7, "Zoning to $temp_zonename.");
  2962.         quest::AssignToInstance($temp_instanceid);
  2963.         quest::MovePCInstance($ZoneSNTOID, $temp_instanceid, $temp_x, $temp_y, $temp_z);
  2964.     }
  2965.     elsif ($temp_id > 0)
  2966.     {
  2967.         $client->Message(7, "$temp_name does not have instance.");
  2968.         $client->Message(7, "Zoning to $temp_zonename.");
  2969.         quest::movepc($ZoneSNTOID,$temp_x,$temp_y,$temp_z);
  2970.     }
  2971.     else
  2972.     {
  2973.         $client->Message(7, "Character $_[0] does not exist!");
  2974.     }
  2975.  
  2976. } # End GOTO_PLAYER_INSTANCE()
  2977. ### END GM ONLY #################################################################################################################
  2978. #################################################################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement