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 10-19-2016, 10:47 PM
Darkscis
Sarnak
 
Join Date: Mar 2015
Posts: 62
Default

$client->SummonItem technically can be passed a slot_id, it's just unlisted on the Perl Ultimate reference page and defaults to 30 (cursor). What you would have to do in the case of a "right click auto loot" instead of a left click on cursor is determine what slot the loot landed in, and then Nuke->SummonItem.

Code:
XS(XS_Client_SummonItem)
{
	dXSARGS;
	if (items < 2 || items > 10)
		Perl_croak(aTHX_ "Usage: Client::SummonItem(THIS, item_id, charges=0, attune=0, aug1=0, aug2=0, aug3=0, aug4=0, aug5=0, slot_id=30)");
	{
		Client *		THIS;
		uint32		item_id = (uint32)SvUV(ST(1));
		int16		charges = -1;
		bool		attune = false;
		uint32		aug1 = 0;
		uint32		aug2 = 0;
		uint32		aug3 = 0;
		uint32		aug4 = 0;
		uint32		aug5 = 0;
		uint16		slot_id = 30;

		if (sv_derived_from(ST(0), "Client")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(Client *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type Client");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		if (items > 2) {
			charges = (int16)SvIV(ST(2));
		}
		if (items > 3) {
			attune = (bool)SvTRUE(ST(3));
		}
		if (items > 4) {
			aug1 = (uint32)SvUV(ST(4));
		}
		if (items > 5) {
			aug2 = (uint32)SvUV(ST(5));
		}
		if (items > 6) {
			aug3 = (uint32)SvUV(ST(6));
		}
		if (items > 7) {
			aug4 = (uint32)SvUV(ST(7));
		}
		if (items > 8) {
			aug5 = (uint32)SvUV(ST(8));
		}
		if (items > 9) {
			slot_id = (uint16)SvUV(ST(9));
		}

		THIS->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attune, slot_id);
	}
	XSRETURN_EMPTY;
}
Disclaimer: I have not actually used it in this way so experiment at your own peril
Reply With Quote
  #2  
Old 10-19-2016, 11:03 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by Darkscis View Post
$client->SummonItem technically can be passed a slot_id, it's just unlisted on the Perl Ultimate reference page and defaults to 30 (cursor). What you would have to do in the case of a "right click auto loot" instead of a left click on cursor is determine what slot the loot landed in, and then Nuke->SummonItem.


Disclaimer: I have not actually used it in this way so experiment at your own peril
Appreciate that bud, I didn't have access to the source where I was at the time, so that's definitely useful information (because, even though I can view it now, I didn't bother to, my bad).

(*ninja edit) Updated so that the SummonItem places the newly augmented item where it found the unaugmented (freshly looted) one.
Reply With Quote
  #3  
Old 10-19-2016, 11:05 PM
Darkscis
Sarnak
 
Join Date: Mar 2015
Posts: 62
Default

Sorry for double post - but I also looked into quest::addloot and it *looks* like a fairly simple code change if you are comfortable modifying source. If not, use SummonItem.

Code:
void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange) {

...

item->item_id = item2->ID;
item->charges = charges;
item->aug_1 = 0;
item->aug_2 = 0;
item->aug_3 = 0;
item->aug_4 = 0;
item->aug_5 = 0;
item->aug_6 = 0;
item->attuned = 0;
item->min_level = minlevel;
item->max_level = maxlevel;

...
So quest::addloot eventually calls NPC::AddItem which in turn calls NPC::AddLootDrop. The above is a snippet of AddLootDrop which shows that it does set the item augs, it just defaults them to 0 and doesn't allow any input from anywhere. Without further investigation I don't know if this is specifically to prevent a bug or something but you could try modifying it so it accepts augment arguments, then modify the questmanager calls and Perl parser respectively. That would be more advanced than you may like though...
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:17 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