Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 09-05-2010, 07:41 AM
thepoetwarrior
Discordant
 
Join Date: Aug 2007
Posts: 307
Question Instance Code - Refresh Expire Time

I've taken code from several places to create instances that will be public for a charge. The instances (and their qglobals) expire after 24 hours. Some users noticed that they entered a public instance towards the end of the timer and after the instance expired, they got booted. Is there a way to refresh the timer each time a person enters a public instance without changing the instance ID? Or does that even matter? Does a server reboot (which I have every 24 hrs) affect instances? If so, that would put the qglobals and instance to expire at different times.

Anyways, I'd basically like the instances to stay up all the time (even after server reboots), and that players don't get booted when the instance expires. Here is copy of the code which I'm sure some people could make use of, and hopefully even build on it, and help me to fix these minor issues.

Code:
sub EVENT_SAY {

	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();

	my $npc_name = $npc->GetCleanName();
	my $zoneid1 = "Instance1$zonesn$zoneid";
	my $zoneid2 = "Instance2$zonesn$zoneid";
	
	my $Enter1Inst = quest::saylink("Enter Instance 1", 1);
	my $Enter2Inst = quest::saylink("Enter Instance 2", 1);
	my $ExitInst = quest::saylink("Exit Instance", 1);

    if ($text =~/hail/i) 
	{
		$client->Message(315, "$npc_name says, 'Please make a choice:'");
		$client->Message(315, "$Enter1Inst");
		$client->Message(315, "$Enter2Inst");
		$client->Message(315, "$ExitInst");
		
	} # End hail

	if ($text =~/Enter Instance 1/i) 
	{
		$client->Message(315, "$npc_name says, 'Give me 1000 platinum to enter $zonesn Instance Version (1)'");
	} # End Instance 1
	
	if ($text =~/Enter Instance 2/i) 
	{
		$client->Message(315, "$npc_name says, 'Give me 2000 platinum to enter $zonesn Instance Version (2)'");
	} # End Instance 2
	
	if ($text =~ /^Exit Instance$/i)
		{
			$client->Message(315, " " );
			$client->Message(315, "Moving player $name to a non-instance version of $zoneln.");
			quest::movepc($zoneid,$Cx,$Cy,$Cz); 
		}				

} # End sub EVENT_SAY


sub EVENT_ITEM
{
	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();
	my $npc_name = $npc->GetCleanName();
	my $zoneid1 = "Instance1$zonesn$zoneid";
	my $zoneid2 = "Instance2$zonesn$zoneid";
	
	if ($platinum == 1000) # IF 1k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
		
			if (defined($qglobals{"$zoneid1"}))
			{
				my $instance_1 = $qglobals{"$zoneid1"};
				quest::AssignToInstance($instance_1);
				quest::MovePCInstance($zoneid, $instance_1, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to $zonesn Instance (1) now.'");
			}
			else
			{
				$client->Message(315, "$npc_name says, 'No instance exist, creating one ...'");
				my $instanceID = quest::CreateInstance("$zonesn", 0, 86400);
				quest::AssignToInstance($instanceID); 
				quest::setglobal("$zoneid1",$instanceID,7,"H24");
				quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to $zonesn Instance (1) now.'");
			}
		} # End plat > 1000
		
	elsif ($platinum == 2000) # IF 2k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
		
			if (defined($qglobals{"$zoneid2"}))
			{
				my $instance_2 = $qglobals{"$zoneid2"};
				quest::AssignToInstance($instance_2);
				quest::MovePCInstance($zoneid, $instance_2, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to $zonesn Instance (2) now.'");
			}
			else
			{
				$client->Message(315, "$npc_name says, 'No instance exist, creating one ...'");
				my $instanceID = quest::CreateInstance("$zonesn", 0, 86400);
				quest::AssignToInstance($instanceID); 
				quest::setglobal("$zoneid2",$instanceID,7,"H24");
				quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to $zonesn Instance (2) now.'");
			}
		} # End plat > 2000		

	else # If not enough plat, return everything.
		{
			plugin::return_items(\%itemcount);
    	}		
		
} # End sub EVENT_ITEM
Reply With Quote
  #2  
Old 09-05-2010, 05:34 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by thepoetwarrior View Post
I've taken code from several places to create instances that will be public for a charge. The instances (and their qglobals) expire after 24 hours. Some users noticed that they entered a public instance towards the end of the timer and after the instance expired, they got booted. Is there a way to refresh the timer each time a person enters a public instance without changing the instance ID? Or does that even matter? Does a server reboot (which I have every 24 hrs) affect instances? If so, that would put the qglobals and instance to expire at different times.

Anyways, I'd basically like the instances to stay up all the time (even after server reboots), and that players don't get booted when the instance expires. Here is copy of the code which I'm sure some people could make use of, and hopefully even build on it, and help me to fix these minor issues.

Code:
sub EVENT_SAY {

	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();

	my $npc_name = $npc->GetCleanName();
	my $zoneid1 = "Instance1$zonesn$zoneid";
	my $zoneid2 = "Instance2$zonesn$zoneid";
	
	my $Enter1Inst = quest::saylink("Enter Instance 1", 1);
	my $Enter2Inst = quest::saylink("Enter Instance 2", 1);
	my $ExitInst = quest::saylink("Exit Instance", 1);

    if ($text =~/hail/i) 
	{
		$client->Message(315, "$npc_name says, 'Please make a choice:'");
		$client->Message(315, "$Enter1Inst");
		$client->Message(315, "$Enter2Inst");
		$client->Message(315, "$ExitInst");
		
	} # End hail

	if ($text =~/Enter Instance 1/i) 
	{
		$client->Message(315, "$npc_name says, 'Give me 1000 platinum to enter $zonesn Instance Version (1)'");
	} # End Instance 1
	
	if ($text =~/Enter Instance 2/i) 
	{
		$client->Message(315, "$npc_name says, 'Give me 2000 platinum to enter $zonesn Instance Version (2)'");
	} # End Instance 2
	
	if ($text =~ /^Exit Instance$/i)
		{
			$client->Message(315, " " );
			$client->Message(315, "Moving player $name to a non-instance version of $zoneln.");
			quest::movepc($zoneid,$Cx,$Cy,$Cz); 
		}				

} # End sub EVENT_SAY


sub EVENT_ITEM
{
	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();
	my $npc_name = $npc->GetCleanName();
	my $zoneid1 = "Instance1$zonesn$zoneid";
	my $zoneid2 = "Instance2$zonesn$zoneid";
	
	if ($platinum == 1000) # IF 1k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
		
			if (defined($qglobals{"$zoneid1"}))
			{
				my $instance_1 = $qglobals{"$zoneid1"};
				quest::AssignToInstance($instance_1);
				quest::MovePCInstance($zoneid, $instance_1, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to $zonesn Instance (1) now.'");
			}
			else
			{
				$client->Message(315, "$npc_name says, 'No instance exist, creating one ...'");
				my $instanceID = quest::CreateInstance("$zonesn", 0, 86400);
				quest::AssignToInstance($instanceID); 
				quest::setglobal("$zoneid1",$instanceID,7,"H24");
				quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to $zonesn Instance (1) now.'");
			}
		} # End plat > 1000
		
	elsif ($platinum == 2000) # IF 2k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
		
			if (defined($qglobals{"$zoneid2"}))
			{
				my $instance_2 = $qglobals{"$zoneid2"};
				quest::AssignToInstance($instance_2);
				quest::MovePCInstance($zoneid, $instance_2, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to $zonesn Instance (2) now.'");
			}
			else
			{
				$client->Message(315, "$npc_name says, 'No instance exist, creating one ...'");
				my $instanceID = quest::CreateInstance("$zonesn", 0, 86400);
				quest::AssignToInstance($instanceID); 
				quest::setglobal("$zoneid2",$instanceID,7,"H24");
				quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to $zonesn Instance (2) now.'");
			}
		} # End plat > 2000		

	else # If not enough plat, return everything.
		{
			plugin::return_items(\%itemcount);
    	}		
		
} # End sub EVENT_ITEM
I don't know why you didn't just e-mail me considering I built the base in which you used this from. Let me look at this when I get a chance, I have a few things going on and I can make it for you.
Reply With Quote
  #3  
Old 09-05-2010, 08:41 PM
thepoetwarrior
Discordant
 
Join Date: Aug 2007
Posts: 307
Default

I haven't talked to you in a while, plus figured I'd see what everyone thought about the instance thing, multiple opinions.

Half the code was from example that Trevius posted here, and half from your example as well.

Do these zones take up a dynamic zone? Users complaining they can't enter a new zone that isn't already booted.
Reply With Quote
  #4  
Old 09-07-2010, 01:53 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by thepoetwarrior View Post
I haven't talked to you in a while, plus figured I'd see what everyone thought about the instance thing, multiple opinions.

Half the code was from example that Trevius posted here, and half from your example as well.

Do these zones take up a dynamic zone? Users complaining they can't enter a new zone that isn't already booted.
Yes, they take up a dynamic. Here is the script you are looking for, I haven't tested it but it should do what you want it to do. I cleaned up some parts of it and also added the ability to use the Waypoint credit system that I made for you as well, but not add to the NPC for credits.

You also were using objects that you made that were conflicting with the perl objects in the source. I made this just as flexible as you desired it to be before, and the qglobals and instances should not expire... Period.

You should be able to see the instances in your qglobals table up after they become populated by players, and will never go away unless you manually deleted them yourself. The qglobals get created and read by everyone for Instance 1 and 2 for all players.

Code:
sub EVENT_SAY {
	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();
	my $npc_name = $npc->GetCleanName();
	my $Enter1Inst = quest::saylink("Enter Instance 1", 1);
	my $Enter2Inst = quest::saylink("Enter Instance 2", 1);
	my $Waypoint1Inst = quest::saylink("Waypoint Credit Instance 1", 1);
	my $Waypoint2Inst = quest::saylink("Waypoint Credit Instance 2", 1);
	my $ExitInst = quest::saylink("Exit Instance", 1);
	my $accountname1 = $client->AccountName();
	my $accountname = "<c \"#FBB117\">$accountname1</c>";
	my $accountid = $client->AccountID();
	my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
    if ($text =~/hail/i) 
		{
			$client->Message(315, "$npc_name says, 'Please make a choice:'");
			$client->Message(315, "..::[LDON Instance: $zonln]::..");
			$client->Message(315, "[$Enter1Inst]");
			$client->Message(315, "[$Enter2Inst]");
			$client->Message(315, "[$ExitInst]");
			
		} # End hail
	if ($text =~/Enter Instance 1/i) 
		{
			$client->Message(315, "$npc_name says, 'Give me 1000 platinum to enter $zonesn Instance Version (1)'");
			$client->Message(315, "Or enter with [$Waypoint1Inst]");
		} 	# End Instance 1
	if ($text =~/Enter Instance 2/i) 
		{
			$client->Message(315, "$npc_name says, 'Give me 2000 platinum to enter $zonesn Instance Version (2)'");
			$client->Message(315, "Or enter with [$Waypoint2Inst]");
		} 	# End Instance 2
	if ($text =~ /^Exit Instance$/i)
		{
			$client->Message(315, " " );
			$client->Message(315, "Moving player $name to a non-instance version of $zoneln.");
			quest::movepc($zoneid, $Cx, $Cy, $Cz); 
		}	
	if ($text =~ /Waypoint Credit Instance 1/i){
		my $InstanceCost = 1000; ###1,000 Entry Fee
					if ($bankcredit < $InstanceCost)
						{
							$client->Message(315,"You need "
								. ($InstanceCost - $bankcredit) . " more plat!");
						}
						else {
							$bankcredit -= $InstanceCost;
							quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
							my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
							$client->Message(15, "[ACCOUNT BALANCE]: [$accountname] You now have $bankcredit platinum in [$accountname]");
							$timestamp = localtime(time);
							my $npc_name = $npc->GetCleanName(); 
							my $accountname1 = $client->AccountName();
							quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
							$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
							if (defined($qglobals{"Inst1$zonesn"}))
								{
									my $instance_1 = $qglobals{"Inst1$zonesn"};
									quest::AssignToInstance($instance_1);
									quest::MovePCInstance($zoneid, $instance_1, $Cx, $Cy, $Cz);
									$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
								}
							else
								{
									$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
									my $instanceID = quest::CreateInstance("$zonesn", 0, 0);
									quest::AssignToInstance($instanceID); 
									quest::setglobal("Inst1$zonesn",$instanceID, 7, 0);
									quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
									$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
								}
							}		
				}
				if ($text =~ /Waypoint Credit Instance 2/i){
					my $InstanceCost = 2000; ###2,000 Entry Fee
					if ($bankcredit < $InstanceCost)
						{
							$client->Message(315,"You need "
								. ($InstanceCost - $bankcredit) . " more plat!");
						}
						else {
							$bankcredit -= $InstanceCost;
							quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
							my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
							$client->Message(15, "[ACCOUNT BALANCE]: [$accountname] You now have $bankcredit platinum in [$accountname]");
							$timestamp = localtime(time);
							my $npc_name = $npc->GetCleanName(); 
							my $accountname1 = $client->AccountName();
							quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
							$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
							if (defined($qglobals{"Inst2$zonesn"}))
								{
									my $instance_2 = $qglobals{"Inst2$zonesn"};
									quest::AssignToInstance($instance_2);
									quest::MovePCInstance($zoneid, $instance_2, $Cx, $Cy, $Cz);
									$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
								}
							else
								{
									$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
									my $instanceID = quest::CreateInstance("Inst2$zonesn", 0, 0);
									quest::AssignToInstance($instanceID); 
									quest::setglobal("Inst2$zonesn", $instanceID, 7, 0);
									quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
									$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
								}
							}		
				}
}



sub EVENT_ITEM
{
	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();
	my $npc_name = $npc->GetCleanName();
	if ($platinum == 1000) # IF 1k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
		
			if (defined($qglobals{"Inst1$zonesn"}))
			{
				my $instance_1 = $qglobals{"Inst1$zonesn"};
				quest::AssignToInstance($instance_1);
				quest::MovePCInstance($zoneid, $instance_1, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
			}
			else
			{
				$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
				my $instanceID = quest::CreateInstance("$zonesn", 0, 0);
				quest::AssignToInstance($instanceID); 
				quest::setglobal("Inst1$zonesn",$instanceID, 7, 0);
				quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
			}
		} # End plat > 1000
		
	elsif ($platinum == 2000) # IF 2k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
		
			if (defined($qglobals{"Inst2$zonesn"}))
			{
				my $instance_2 = $qglobals{"Inst2$zonesn"};
				quest::AssignToInstance($instance_2);
				quest::MovePCInstance($zoneid, $instance_2, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
			}
			else
			{
				$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
				my $instanceID = quest::CreateInstance("Inst2$zonesn", 0, 0);
				quest::AssignToInstance($instanceID); 
				quest::setglobal("Inst2$zonesn", $instanceID, 7, 0);
				quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
			}
		} # End plat > 2000		

	else # If not enough plat, return everything.
		{
			plugin::return_items(\%itemcount);
    	}		
		
} # End sub EVENT_ITEM
Here's this too lol
Code:
UPDATE `items` SET `idfile` = 'IT166', `icon` = `588` WHERE NAME LIKE '%Sword of the Eternal Power Epic 4.0%';
Reply With Quote
  #5  
Old 09-08-2010, 11:56 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Okay senior chief, this is tested and confirmed working between both instances across all zones...

Enjoy bro, if you need anything else let me know.

Code:
sub EVENT_SAY {
	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();
	my $npc_name = $npc->GetCleanName();
	my $Enter1Inst = quest::saylink("Enter Instance 1", 1);
	my $Enter2Inst = quest::saylink("Enter Instance 2", 1);
	my $Waypoint1Inst = quest::saylink("Waypoint Credit Instance 1", 1);
	my $Waypoint2Inst = quest::saylink("Waypoint Credit Instance 2", 1);
	my $ExitInst = quest::saylink("Exit Instance", 1);
	my $accountname = $client->AccountName();
	my $accountid = $client->AccountID();
	my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
    if ($text =~/hail/i) 
		{
			$client->Message(315, "$npc_name says, 'Please make a choice:'");
			$client->Message(315, "..::[LDON Instance: $zoneln]::..");
			$client->Message(315, "[$Enter1Inst]");
			$client->Message(315, "[$Enter2Inst]");
			$client->Message(315, "[$ExitInst]");
			
		} # End hail
	if ($text =~/Enter Instance 1/i) 
		{
			$client->Message(315, "$npc_name says, 'Give me 1000 platinum to enter [$zoneln] Instance Version (1)'");
			$client->Message(315, "Or enter with [$Waypoint1Inst]");
		} 	# End Instance 1
	if ($text =~/Enter Instance 2/i) 
		{
			$client->Message(315, "$npc_name says, 'Give me 2000 platinum to enter [$zoneln] Instance Version (2)'");
			$client->Message(315, "Or enter with [$Waypoint2Inst]");
		} 	# End Instance 2
	if ($text =~ /^Exit Instance$/i)
		{
			$client->Message(315, " " );
			$client->Message(315, "Moving player $name to a non-instance version of [$zoneln].");
			quest::movepc($zoneid, $Cx, $Cy, $Cz); 
		}	
	if ($text =~ /Waypoint Credit Instance 1/i){
		my $InstanceCost = 1000; ###1,000 Entry Fee
					if ($bankcredit < $InstanceCost)
						{
							$client->Message(315,"You need "
								. ($InstanceCost - $bankcredit) . " more plat!");
						}
						else {
							$bankcredit -= $InstanceCost;
							quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
							my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
							$client->Message(15, "[ACCOUNT BALANCE]: [$name] You now have $bankcredit platinum in account: [$accountname]");
							$timestamp = localtime(time);
							my $npc_name = $npc->GetCleanName(); 
							my $accountname1 = $client->AccountName();
							quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
							$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
							if (defined($qglobals{"LDONInsta1$zonesn"})) { ### IF THERE IS AN INSTANCE ASSIGNED!
										$LDONInst1 = $qglobals{"LDONInsta1$zonesn"};
										quest::AssignToInstance($LDONInst1);
										quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
										$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
									}
									else { ### IF THERE ISN'T AN INSTANCE ASSIGNED, ASSIGN IT!
										$LDONInst1 = quest::CreateInstance("$zonesn", 0, 604800); ### Set to 7 day IN SECONDS
										quest::AssignToInstance($LDONInst1); 
										quest::setglobal("LDONInsta1$zonesn",$LDONInst1,7,"D7"); ### Set to 7 day QGLOBAL
										quest::write("InstanceLogs/LDONInst1$zonesn.txt","[$timestamp] : $name has created instance $zoneln");
										quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
										$client->Message(315, "$npc_name says, 'Instance not created, creating and moving you to [$zoneln Instance] (1) now.'");
									}	
							}
				}
				if ($text =~ /Waypoint Credit Instance 2/i){
					my $InstanceCost = 2000; ###2,000 Entry Fee
					if ($bankcredit < $InstanceCost)
						{
							$client->Message(315,"You need "
								. ($InstanceCost - $bankcredit) . " more plat!");
						}
						else {
							$bankcredit -= $InstanceCost;
							quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
							my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
							$client->Message(15, "[ACCOUNT BALANCE]: [$accountname] You now have $bankcredit platinum in [$accountname]");
							$timestamp = localtime(time);
							my $npc_name = $npc->GetCleanName(); 
							my $accountname1 = $client->AccountName();
							quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
							$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
							if (defined($qglobals{"LDONInsta2$zonesn"})) { ### IF THERE IS AN INSTANCE ASSIGNED!
										$LDONInst1 = $qglobals{"LDONInsta2$zonesn"};
										quest::AssignToInstance($LDONInst1);
										quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
										$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
									}
									else { ### IF THERE ISN'T AN INSTANCE ASSIGNED, ASSIGN IT!
										$LDONInst1 = quest::CreateInstance("$zonesn", 0, 604800); ### Set to 7 day IN SECONDS
										quest::AssignToInstance($LDONInst1); 
										quest::setglobal("LDONInsta2$zonesn",$LDONInst1,7,"D7"); ### Set to 7 day QGLOBAL
										quest::write("InstanceLogs/LDONInst1$zonesn.txt","[$timestamp] : $name has created instance $zoneln");
										quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
										$client->Message(315, "$npc_name says, 'Instance not created, creating and moving you to [$zoneln Instance] (2) now.'");
									}	
							}		
				}
}



sub EVENT_ITEM
{
	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();
	my $npc_name = $npc->GetCleanName();
	if ($platinum == 1000) # IF 1k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
		if (defined($qglobals{"LDONInsta1$zonesn"})) { ### IF THERE IS AN INSTANCE ASSIGNED!
										$LDONInst1 = $qglobals{"LDONInsta1$zonesn"};
										quest::AssignToInstance($LDONInst1);
										quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
										$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
									}
									else { ### IF THERE ISN'T AN INSTANCE ASSIGNED, ASSIGN IT!
										$LDONInst1 = quest::CreateInstance("$zonesn", 0, 604800); ### Set to 7 day IN SECONDS
										quest::AssignToInstance($LDONInst1); 
										quest::setglobal("LDONInsta1$zonesn",$LDONInst1,7,"D7"); ### Set to 7 day QGLOBAL
										quest::write("InstanceLogs/LDONInst1$zonesn.txt","[$timestamp] : $name has created instance $zoneln");
										quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
										$client->Message(315, "$npc_name says, 'Instance not created, creating and moving you to [$zoneln Instance] (1) now.'");
									}	
							}
		} # End plat > 1000
		
	elsif ($platinum == 2000) # IF 2k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
		
			if (defined($qglobals{"LDONInsta2$zonesn"})) { ### IF THERE IS AN INSTANCE ASSIGNED!
										$LDONInst1 = $qglobals{"LDONInsta2$zonesn"};
										quest::AssignToInstance($LDONInst1);
										quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
										$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
									}
									else { ### IF THERE ISN'T AN INSTANCE ASSIGNED, ASSIGN IT!
										$LDONInst1 = quest::CreateInstance("$zonesn", 0, 604800); ### Set to 7 day IN SECONDS
										quest::AssignToInstance($LDONInst1); 
										quest::setglobal("LDONInsta2$zonesn",$LDONInst1,7,"D7"); ### Set to 7 day QGLOBAL
										quest::write("InstanceLogs/LDONInst1$zonesn.txt","[$timestamp] : $name has created instance $zoneln");
										quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
										$client->Message(315, "$npc_name says, 'Instance not created, creating and moving you to [$zoneln Instance] (2) now.'");
									}	
							}
		} # End plat > 2000		

	else # If not enough plat, return everything.
		{
			plugin::return_items(\%itemcount);
    	}		
		
} # End sub EVENT_ITEM
Reply With Quote
  #6  
Old 09-09-2010, 01:43 PM
thepoetwarrior
Discordant
 
Join Date: Aug 2007
Posts: 307
Default

Just got home, will test soon. Thanks in advance!
Reply With Quote
  #7  
Old 09-09-2010, 03:10 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

No problem man, I will actually have a plugin coming out for this soonish. I just got qglobal based credit systems to work via a plugin. So all you have to do is name your credit, there are two types, per person, and per account.

It's rather quite slick.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:40 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3