Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2013, 04:53 AM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default AA Vendor Fairly easy to use!

Was writing this for someone else and I decided to share with anyone who wanted to use.

Instructions inside the script on how to add items to the vendor.

Any questions or bugs just send me a PM.


Code:
#############################
####### AA Merchant #########
### Created by : NatedogEZ ##
#############################
sub ITEMLIST {
# ItemID -> Cost -> TXT REMINDER OF ITEM -> Slot type -> Stack Size (1 default higher number for items with charges or stackables)
# Slot type //1 = Plate // 2= Cloth // 3 = Leather // 4 = Chain // 5 = Accessory // 6 = Novelty // 7 = Expendable // 8 = Weapons
	%IL = (
	1 => [4201, 5, "Bronze Helm", 1, 1],
	2 => [4202, 5, "Bronze Mask", 5, 1],
	3 => [4203, 5, "Bronze Collar", 5, 1],
	4 => [4204, 5, "Bronze Breastplate", 1, 1],
	5 => [4205, 5, "Bronze Pauldron", 5, 1],
	6 => [9662, 2, "Misty Thicket Picnic", 7, 20],
	7 => [61993, 2, "Honeyed Qeynos Afternoon Tea", 7, 20],
	8 => [2956, 5888, "Short Sword of Flame", 8, 1]
	);
}

sub EVENT_SAY
{
ITEMLIST(); #Load itemlist
my %typetext = (
		1 => "Plate",
		2 => "Cloth",
		3 => "Leather",
		4 => "Chain",
		5 => "Accessory",
		6 => "Novelty",
		7 => "Expendable",
		8 => "Weapons"
		);
my $empty = $client->GetItemIDAt(quest::getinventoryslotid("cursor"));   #Check cursor for an itemID will be HUGE number if INVALID or no item
my $total = $client->GetAAPoints();
my $plate = quest::saylink("Type 1",1,"Plate"); #1
my $cloth = quest::saylink("Type 2",1, "Cloth"); #2
my $leather = quest::saylink("Type 3",1,"Leather"); #3
my $chain = quest::saylink("Type 4",1,"Chain"); #4
my $accessory = quest::saylink("Type 5",1,"Accessory"); #5
my $novelty = quest::saylink("Type 6",1,"Novelty");#6
my $expendable = quest::saylink("Type 7",1,"Expendable");  #7
my $weapons = quest::saylink("Type 8",1,"Weapons");  #8

	if($text=~/Hail/i)
    {
		#$itemsid = undef;
		#$itemcost = undef;
		plugin::Whisper("Hi there $name do you want to browse my items?");
		$client->Message(315, "[$plate] || [$cloth] || [$leather] || [$chain] || [$accessory] || [$novelty] || [$expendable] || [$weapons]");
	}
	elsif($text=~/^Type /i)
	{
		my $n = 1;
		my $TYPE = substr($text, 5);
		if($TYPE == 0 || $TYPE > 8) {$client->Message(13, "Invalid type!"); return;}
		$client->Message(315, "==== $typetext{$TYPE} items ===");
		$client->Message(315, " ");	
			while ($IL{$n}[0])
			{
				my $typeslot = $IL{$n}[3];
				if($typeslot==$TYPE)
				{
					my $itemlink = quest::varlink($IL{$n}[0]);
					my $saylink = quest::saylink("Buy $n",1,"Buy");
					my $cost = int($IL{$n}[1]);
					my $stack = int($IL{$n}[4]);
					$client->Message(315, "$saylink >for $cost AA points > $itemlink x $stack");
					$client->Message(315, " ");				
				}
				$n++;
			}
		$client->Message(315, "=============");
		$client->Message(315, "[$plate] || [$cloth] || [$leather] || [$chain] || [$accessory] || [$novelty] || [$expendable] || [$weapons]");
		$client->Message(315, " ");	
	}
	######## Item Saylink Start
	elsif($text=~/^buy /i)
	{
		my $Indent = plugin::PWIndent();
		my @BUY =  split / /, substr($text, 4);
		if(!$IL{$BUY[0]}[0]) {$client->Message(13, "Invalid buy request!"); return;}
		if($client->GetItemStat($IL{$BUY[0]}[0], "loregroup") != 0 && plugin::check_hasitem($client, $IL{$BUY[0]}[0])) {$client->Message(13, "ERROR: Lore conflict you may not buy a Lore item you already possess!"); return;}
		my $cost = int($IL{$BUY[0]}[1]);
		my $createitem = $IL{$BUY[0]}[0];
		my $itemlink = quest::varlink($IL{$BUY[0]}[0]);
		my $stack = int($IL{$BUY[0]}[4]);
		if($empty == -1)   #Checks the cursor itemID to see if its valid returns a huge number for invalid
		{
			if($total >= $cost)         #Cost of the item
			{
				$client->SetEntityVariable("BUYID", $BUY[0]);
				quest::popup("Buy $IL{$BUY[0]}[2]?",                     
                                "<br>$Indent Item:<c \"#00FFFF\"> $IL{$BUY[0]}[2] </c> QTY $IL{$BUY[0]}[4]<br>
                               
                               &nbsp;&nbsp;&nbsp;&nbsp; [ <c \"#FFFF00\">Yes</c> ] to confirm
                                $Indent [ <c \"#FFFF00\">No</c> ] to choose again ", 10002, 1, 0);
			}
			else 
			{
				plugin::Whisper("You need " . ($cost-$total) . " more AA points for $itemlink.");  #Player did not have enough AA
			}
		}
		else
		{
			plugin::Whisper("You are holding an item please put it in your bags before you buy something."); #Player is holding an item already
		}		
	}
}

sub EVENT_POPUPRESPONSE {
	if($popupid == 10002)
	{
		ITEMLIST(); #Load itemlist
		my $empty = $client->GetItemIDAt(quest::getinventoryslotid("cursor"));
		my $total = $client->GetAAPoints();	
		my $BUY = $client->GetEntityVariable("BUYID");
		
		if(!$IL{$BUY}[0]) {$client->Message(13, "Invalid buy request!"); return;}
		my $cost = int($IL{$BUY}[1]);
		my $createitem = $IL{$BUY}[0];
		my $itemlink = quest::varlink($IL{$BUY}[0]);
		my $stack = int($IL{$BUY}[4]);
		if($empty == -1)   #Checks the cursor itemID to see if its valid returns a huge number for invalid
		{
			if($total >= $cost)         #Cost of the item
			{
				$total = int($total-$cost);     
				$client->SetAAPoints($total); 
				#Itemname
				quest::summonitem($createitem,$stack);  
				$client->Message(315, "You now have $total AA points to spend.");
			}
			else 
			{
				plugin::Whisper("You need more AA points for $itemlink.");  #Player did not have enough AA
			}
		}
		else
		{
			plugin::Whisper("You are holding an item please put it in your bags before you buy something."); #Player is holding an item already
		}
	}
}

Last edited by NatedogEZ; 04-10-2019 at 06:30 PM..
Reply With Quote
  #2  
Old 03-17-2013, 10:33 AM
vkrr
Sarnak
 
Join Date: Mar 2013
Posts: 65
Default

Nevermind, I am an idiot! Great script nate
Reply With Quote
  #3  
Old 03-20-2013, 03:04 AM
Soulcold
Sarnak
 
Join Date: Mar 2009
Posts: 60
Default

Awesome script man, works pretty well dude.
Reply With Quote
  #4  
Old 03-20-2013, 03:06 AM
BlackSunGM
Fire Beetle
 
Join Date: Aug 2012
Posts: 19
Default

Soulcold your signature is disturbing, please dont tell me that is from an actual server
Reply With Quote
  #5  
Old 11-14-2013, 04:52 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

UPDATE ...
  • Added Popup window confirmation
  • Added field Quantity -- add to your hash if you use the old one
  • Added Lore conflict support no more accidentally wasting AA







Code:
#############################
####### AA Merchant #########
### Created by : NatedogEZ ##
#############################
sub ITEMLIST {
# ItemID -> Cost -> TXT REMINDER OF ITEM -> Slot type -> Stack Size (1 default higher number for items with charges or stackables)
# Slot type //1 = Plate // 2= Cloth // 3 = Leather // 4 = Chain // 5 = Accessory // 6 = Novelty // 7 = Expendable // 8 = Weapons
	%IL = (
	1 => [4201, 5, "Bronze Helm", 1, 1],
	2 => [4202, 5, "Bronze Mask", 5, 1],
	3 => [4203, 5, "Bronze Collar", 5, 1],
	4 => [4204, 5, "Bronze Breastplate", 1, 1],
	5 => [4205, 5, "Bronze Pauldron", 5, 1],
	6 => [9662, 2, "Misty Thicket Picnic", 7, 20],
	7 => [61993, 2, "Honeyed Qeynos Afternoon Tea", 7, 20],
	8 => [2956, 5888, "Short Sword of Flame", 8, 1]
	);
}

sub EVENT_SAY
{
ITEMLIST(); #Load itemlist
my %typetext = (
		1 => "Plate",
		2 => "Cloth",
		3 => "Leather",
		4 => "Chain",
		5 => "Accessory",
		6 => "Novelty",
		7 => "Expendable",
		8 => "Weapons"
		);
my $empty = $client->GetItemIDAt(quest::getinventoryslotid("cursor"));   #Check cursor for an itemID will be HUGE number if INVALID or no item
my $total = $client->GetAAPoints();
my $plate = quest::saylink("Type 1",1,"Plate"); #1
my $cloth = quest::saylink("Type 2",1, "Cloth"); #2
my $leather = quest::saylink("Type 3",1,"Leather"); #3
my $chain = quest::saylink("Type 4",1,"Chain"); #4
my $accessory = quest::saylink("Type 5",1,"Accessory"); #5
my $novelty = quest::saylink("Type 6",1,"Novelty");#6
my $expendable = quest::saylink("Type 7",1,"Expendable");  #7
my $weapons = quest::saylink("Type 8",1,"Weapons");  #8

	if($text=~/Hail/i)
    {
		#$itemsid = undef;
		#$itemcost = undef;
		plugin::Whisper("Hi there $name do you want to browse my items?");
		$client->Message(315, "[$plate] || [$cloth] || [$leather] || [$chain] || [$accessory] || [$novelty] || [$expendable] || [$weapons]");
	}
	elsif($text=~/^Type /i)
	{
		my $n = 1;
		my $TYPE = substr($text, 5);
		if($TYPE == 0 || $TYPE > 8) {$client->Message(13, "Invalid type!"); return;}
		$client->Message(315, "==== $typetext{$TYPE} items ===");
		$client->Message(315, " ");	
			while ($IL{$n}[0])
			{
				my $typeslot = $IL{$n}[3];
				if($typeslot==$TYPE)
				{
					my $itemlink = quest::varlink($IL{$n}[0]);
					my $saylink = quest::saylink("Buy $n",1,"Buy");
					my $cost = int($IL{$n}[1]);
					my $stack = int($IL{$n}[4]);
					$client->Message(315, "$saylink >for $cost AA points > $itemlink x $stack");
					$client->Message(315, " ");				
				}
				$n++;
			}
		$client->Message(315, "=============");
		$client->Message(315, "[$plate] || [$cloth] || [$leather] || [$chain] || [$accessory] || [$novelty] || [$expendable] || [$weapons]");
		$client->Message(315, " ");	
	}
	######## Item Saylink Start
	elsif($text=~/^buy /i)
	{
		my $Indent = plugin::PWIndent();
		my @BUY =  split / /, substr($text, 4);
		if(!$IL{$BUY[0]}[0]) {$client->Message(13, "Invalid buy request!"); return;}
		if($client->GetItemStat($IL{$BUY[0]}[0], "loregroup") != 0 && plugin::check_hasitem($client, $IL{$BUY[0]}[0])) {$client->Message(13, "ERROR: Lore conflict you may not buy a Lore item you already possess!"); return;}
		my $cost = int($IL{$BUY[0]}[1]);
		my $createitem = $IL{$BUY[0]}[0];
		my $itemlink = quest::varlink($IL{$BUY[0]}[0]);
		my $stack = int($IL{$BUY[0]}[4]);
		if($empty == -1)   #Checks the cursor itemID to see if its valid returns a huge number for invalid
		{
			if($total >= $cost)         #Cost of the item
			{
				$client->SetEntityVariable("BUYID", $BUY[0]);
				quest::popup("Buy $IL{$BUY[0]}[2]?",                     
                                "<br>$Indent Item:<c \"#00FFFF\"> $IL{$BUY[0]}[2] </c> QTY $IL{$BUY[0]}[4]<br>
                               
                               &nbsp;&nbsp;&nbsp;&nbsp; [ <c \"#FFFF00\">Yes</c> ] to confirm
                                $Indent [ <c \"#FFFF00\">No</c> ] to choose again ", 10002, 1, 0);
			}
			else 
			{
				plugin::Whisper("You need " . ($cost-$total) . " more AA points for $itemlink.");  #Player did not have enough AA
			}
		}
		else
		{
			plugin::Whisper("You are holding an item please put it in your bags before you buy something."); #Player is holding an item already
		}		
	}
}

sub EVENT_POPUPRESPONSE {
	if($popupid == 10002)
	{
		ITEMLIST(); #Load itemlist
		my $empty = $client->GetItemIDAt(quest::getinventoryslotid("cursor"));
		my $total = $client->GetAAPoints();	
		my $BUY = $client->GetEntityVariable("BUYID");
		
		if(!$IL{$BUY}[0]) {$client->Message(13, "Invalid buy request!"); return;}
		my $cost = int($IL{$BUY}[1]);
		my $createitem = $IL{$BUY}[0];
		my $itemlink = quest::varlink($IL{$BUY}[0]);
		my $stack = int($IL{$BUY}[4]);
		if($empty == -1)   #Checks the cursor itemID to see if its valid returns a huge number for invalid
		{
			if($total >= $cost)         #Cost of the item
			{
				$total = int($total-$cost);     
				$client->SetAAPoints($total); 
				#Itemname
				quest::summonitem($createitem,$stack);  
				$client->Message(315, "You now have $total AA points to spend.");
			}
			else 
			{
				plugin::Whisper("You need more AA points for $itemlink.");  #Player did not have enough AA
			}
		}
		else
		{
			plugin::Whisper("You are holding an item please put it in your bags before you buy something."); #Player is holding an item already
		}
	}
}

Last edited by NatedogEZ; 04-10-2019 at 06:29 PM..
Reply With Quote
  #6  
Old 04-07-2018, 04:43 AM
Mistmaker's Avatar
Mistmaker
Sarnak
 
Join Date: Feb 2014
Posts: 77
Default

Tried using the first script here, but it keeps saying something is already on the curser when you purchase something. Anyone have a working AA vendor script they don't mind sharing or help me with modifying this one?

Thanks!
__________________
~ Mr. Gold ~ Pillage and Plunder ~
Reply With Quote
  #7  
Old 04-08-2018, 10:44 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
Default

Not sure if this will fix the issue, but the EVENT_POPUPRESPONSE was using $client->GetItemIDAt(30) to get the cursor item id instead of just using $client->GetItemAt(30) to see if there was no item. The change I made was to the $empty variable the conditional used for $empty.
Code:
sub EVENT_POPUPRESPONSE {
	if($popupid == 10002) {
		ITEMLIST(); #Load itemlist
		my $empty = $client->GetItemAt(30);
		my $total = $client->GetAAPoints();	
		my $BUY = $client->GetEntityVariable("BUYID");		
		if(!$IL{$BUY}[0]) {
			$client->Message(13, "Invalid buy request!");
			return;
		}
		my $cost = int($IL{$BUY}[1]);
		my $createitem = $IL{$BUY}[0];
		my $itemlink = quest::varlink($IL{$BUY}[0]);
		my $stack = int($IL{$BUY}[4]);
		if(!$empty) {
			if($total >= $cost) {
				$total = int($total-$cost);     
				$client->SetAAPoints($total); 
				quest::summonitem($createitem,$stack);  
				$client->Message(315, "You now have $total AA points to spend.");
			} else {
				plugin::Whisper("You need more AA points for $itemlink.");  #Player did not have enough AA
			}
		} else {
			plugin::Whisper("You are holding an item please put it in your bags before you buy something."); #Player is holding an item already
		}
	}
}
Reply With Quote
  #8  
Old 04-09-2018, 01:42 AM
Mistmaker's Avatar
Mistmaker
Sarnak
 
Join Date: Feb 2014
Posts: 77
Default

Thanks for looking at this. I will give this a try tonight.
__________________
~ Mr. Gold ~ Pillage and Plunder ~
Reply With Quote
  #9  
Old 11-27-2018, 12:40 AM
rjk83
Fire Beetle
 
Join Date: Nov 2009
Posts: 3
Default

This is a bit older but just FYI for others as I found this script really useful so far. My RoF2 client seemed to return $empty here as -1. I didn't have a Titanium of UF client to test other versions but changing if($empty > 400000) to if($empty > 400000 || $empty == -1) resolves the cursor check and seems to operate as expected from my limited testing.

Thanks for sharing this!
Reply With Quote
  #10  
Old 11-27-2018, 01:38 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Hard-coded inventory slot checks are a no-no now.

I need to update the wikis for perl/lua on this..but, for now:

https://github.com/EQEmu/Server/blob...ngelog.txt#L22 (look for 09/18/2018 entries)

Code:
my $empty = $client->GetItemAt(quest::getinventoryslotid("cursor"));
__________________
Uleat of Bertoxxulous

Compilin' Dirty
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 04:48 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3