PDA

View Full Version : Possible to add augment to loot items?


lordnivek1
10-17-2016, 09:01 AM
Can you have a perl script add augments to an item it is adding to a mob when it spawns? If have tried and repeatedly failed to get this to happen lol. I am to the point if someone more knowledge would want to write a quest to do the below please send me a message. I would be willing to work out a donation for the code and time spent.

Below obviously is just what I am looking for in layman’s terms not actual code:

When a mob spawns I want a perl quest that fires to add an item to the mob. I want the item added to have random augments inserted into the item. In the zone folder I will name the quest the mobs name but there are different variations of the mob so I need it to trigger different items for each unique npc type id.

sub EVENT_SPAWN
1 in 10 chance to trigger
if npc id = XXX
add random item from list (1, 4) to npc to loot
if 1
add random augment (69, 72, 81) to aug slot 1
add random augment (69, 72, 81) to aug slot 2
add random augment (69, 72, 81) to aug slot 3
add random augment (69, 72, 81) to aug slot 4
add random augment (91, 94, 96) to aug slot 5
add random augment (100, 142, 214) to aug slot 6
if 4
add random augment (45, 75, 81) to aug slot 1
add random augment (45, 75, 81) to aug slot 2
add random augment (45, 75, 81) to aug slot 3
add random augment (45, 75, 81) to aug slot 4
add random augment (45, 75, 81) to aug slot 5
add random augment (100, 142, 214) to aug slot 6
if npc id = XXX
add random item from list (6, 9) to npc to loot
**repeating as many times as needed**

lordnivek1
10-18-2016, 08:36 PM
So no one can even answer the question of if this is possible or not? :(

Maze_EQ
10-19-2016, 10:00 AM
With an attitude like that, ain't noone gonna help you.

lordnivek1
10-19-2016, 10:18 AM
With an attitude like that, ain't noone gonna help you.


lol how is that an attitude? please look through all my post and try and find me ever getting an attitude. Pro tip: see the sad face at the end. That helps you determine the emotion the text was written with.

ghanja
10-19-2016, 10:25 AM
Source change would be necessary (from what I recall from the last time I looked at the source which is currently unavailable to me) to accomplish what you want in the way that you want.

However, if you wanted to handle this at EVENT_LOOT level, then yes, it should be very well possible using Perl. The only immediate downside I can think of it, is, it may cause a "blip" of the item while on cursor, where it temporarily disappears, but then reappears. Hell it may not even be noticeable.

Basically, it would entail allowing the player to loot the item (and it would need to be LORE, more on this later), which kicks off EVENT_LOOT (player.pl in the zone this special circumstance belongs, or global_player.pl if it could be multiple zones for simplicity of code management), logical comparison of item looted, if qualifying item, nuke it, then

$client->SummonItem(item_id, charges, attune, aug1, aug2, aug3, aug4, aug5)


With the applicable augment itemid(s) being passed. However, the "tricky" part or at least involving more Perl code is, if they DONT loot with a "left click", thus placing it directly into their inventory. This is why I say, the item would need to be LORE, at least with currently available exported Perl commands. I -suppose- there is a way around that as well, handling the "LORE" type of features through Perl as well. That would involve looking at the players inventory (carried, bank, shared bank) for the item, then essentially checking to see if they already have that item, with the augment the randomization code (in Perl) wishes to place on the item, exists. Then, what do you do from there? Nuke it altogether and say "Sorry you already have that item." or have another go at the randomization until it settles on an augmentation scheme that doesn't already exist in inventory.

TBH, I think most would likely settle on simply modifying the loot tables, so that the NPC has the item (100%), then handle the randomization of the augment through the loot table as well. Then just let the player add the augments. If you want to force stats, then just create an item with those stats from the get go.

I know Kingly recently added (I think it was him, my apologies to the dev if it wasnt him that did it) IsAugment() or maybe it was IsAugmented() which the latter making a little more sense imo. However, I'm not sure a Perl/LUA export exists to find just WHICH augments are on an item. I'd have to look at the source, as http://wiki.eqemulator.org/p?Ultimate_Perl_Reference hasn't received an update in awhile.

TL;DR - With source code changes, yes. With just Perl, perhaps.

Maze_EQ
10-19-2016, 10:28 AM
Source change would be necessary (from what I recall from the last time I looked at the source which is currently unavailable to me) to accomplish what you want in the way that you want.

However, if you wanted to handle this at EVENT_LOOT level, then yes, it should be very well possible using Perl. The only immediate downside I can think of it, is, it may cause a "blip" of the item while on cursor, where it temporarily disappears, but then reappears. Hell it may not even be noticeable.

Basically, it would entail allowing the player to loot the item (and it would need to be LORE, more on this later), which kicks off EVENT_LOOT (player.pl in the zone this special circumstance belongs, or global_player.pl if it could be multiple zones for simplicity of code management), logical comparison of item looted, if qualifying item, nuke it, then

$client->SummonItem(item_id, charges, attune, aug1, aug2, aug3, aug4, aug5)


With the applicable augment itemid(s) being passed. However, the "tricky" part or at least involving more Perl code is, if they DONT loot with a "left click", thus placing it directly into their inventory. This is why I say, the item would need to be LORE, at least with currently available exported Perl commands. I -suppose- there is a way around that as well, handling the "LORE" type of features through Perl as well. That would involve looking at the players inventory (carried, bank, shared bank) for the item, then essentially checking to see if they already have that item, with the augment the randomization code (in Perl) wishes to place on the item, exists. Then, what do you do from there? Nuke it altogether and say "Sorry you already have that item." or have another go at the randomization until it settles on an augmentation scheme that doesn't already exist in inventory.

TBH, I think most would likely settle on simply modifying the loot tables, so that the NPC has the item (100%), then handle the randomization of the augment through the loot table as well. Then just let the player add the augments. If you want to force stats, then just create an item with those stats from the get go.

I know Kingly recently added (I think it was him, my apologies to the dev if it wasnt him that did it) IsAugment() or maybe it was IsAugmented() which the latter making a little more sense imo. However, I'm not sure a Perl/LUA export exists to find just WHICH augments are on an item. I'd have to look at the source, as http://wiki.eqemulator.org/p?Ultimate_Perl_Reference hasn't received an update in awhile.

TL;DR - With source code changes, yes. With just Perl, perhaps.

You took the words right out of my mouth, it must've been while you were kissing meeeeeee.

lordnivek1
10-19-2016, 10:42 AM
Source change would be necessary (from what I recall from the last time I looked at the source which is currently unavailable to me) to accomplish what you want in the way that you want.

However, if you wanted to handle this at EVENT_LOOT level, then yes, it should be very well possible using Perl. The only immediate downside I can think of it, is, it may cause a "blip" of the item while on cursor, where it temporarily disappears, but then reappears. Hell it may not even be noticeable.

Basically, it would entail allowing the player to loot the item (and it would need to be LORE, more on this later), which kicks off EVENT_LOOT (player.pl in the zone this special circumstance belongs, or global_player.pl if it could be multiple zones for simplicity of code management), logical comparison of item looted, if qualifying item, nuke it, then

$client->SummonItem(item_id, charges, attune, aug1, aug2, aug3, aug4, aug5)


With the applicable augment itemid(s) being passed. However, the "tricky" part or at least involving more Perl code is, if they DONT loot with a "left click", thus placing it directly into their inventory. This is why I say, the item would need to be LORE, at least with currently available exported Perl commands. I -suppose- there is a way around that as well, handling the "LORE" type of features through Perl as well. That would involve looking at the players inventory (carried, bank, shared bank) for the item, then essentially checking to see if they already have that item, with the augment the randomization code (in Perl) wishes to place on the item, exists. Then, what do you do from there? Nuke it altogether and say "Sorry you already have that item." or have another go at the randomization until it settles on an augmentation scheme that doesn't already exist in inventory.

TBH, I think most would likely settle on simply modifying the loot tables, so that the NPC has the item (100%), then handle the randomization of the augment through the loot table as well. Then just let the player add the augments. If you want to force stats, then just create an item with those stats from the get go.

I know Kingly recently added (I think it was him, my apologies to the dev if it wasnt him that did it) IsAugment() or maybe it was IsAugmented() which the latter making a little more sense imo. However, I'm not sure a Perl/LUA export exists to find just WHICH augments are on an item. I'd have to look at the source, as http://wiki.eqemulator.org/p?Ultimate_Perl_Reference hasn't received an update in awhile.

TL;DR - With source code changes, yes. With just Perl, perhaps.

I was afraid it would lean more toward source code. I probably should have figured this part out before I made 2,000 unique augments for a Diablo style loot server lol. Got excited before understanding how augments work. I assumed if there was code to make #augmentitem work then you could just some how make that fire in a perl quest. Which probably just shows my ignorance with the whole process as I try and learn and piece stuff together. Thank you very much for the reply and back to the drawing board. :)

Maze_EQ
10-19-2016, 10:53 AM
Can always add the item using $client->SummonItem though.

sub EVENT_LOOT{

if($itemid == x)

$client->NukeItem(itemnum)

$client->SummonItem($item_id, charges, attune, aug1, aug2, aug3, aug4, aug5)
}



Then add an array for each 5 augments with a random chance to apply by passing $aug1, $aug2, $aug3, $aug4, $aug5.


Note: This is just an example, but that's totes how i'd do it.

Or if you really want to make this "Diablo Style"

Add an NPC that will identify magic items and set tyhem from an NPC, and just provide the unidentified item as a shit item.

ghanja
10-19-2016, 11:03 AM
Then add an array for each 5 augments with a random chance to apply by passing $aug1, $aug2, $aug3, $aug4, $aug5.


Note: This is just an example, but that's totes how i'd do it.

Yep, pretty much as explained above. However, when coding, I always try to think of "what can the player do to screw this up?"

And the immediate one I can think of, as mentioned above, is if they do a right click (immediate) loot, making the item land in their inventory. But, this should be an issue if the item itself is LORE. That is likely the route I would go, rather than having Perl handle the traits of a "LORE" like item, as it just makes an already complex way to handle giving items/augments (in my humble opinion) more complex.

lordnivek1
10-19-2016, 11:07 AM
Can always add the item using $client->SummonItem though.

sub EVENT_LOOT{

if($itemid == x)

$client->NukeItem(itemnum)

$client->SummonItem($item_id, charges, attune, aug1, aug2, aug3, aug4, aug5)
}



Then add an array for each 5 augments with a random chance to apply by passing $aug1, $aug2, $aug3, $aug4, $aug5.


Note: This is just an example, but that's totes how i'd do it.

Or if you really want to make this "Diablo Style"

Add an NPC that will identify magic items and set tyhem from an NPC, and just provide the unidentified item as a shit item.

Awesome info. This may help me make what I am trying possible. Thank you very much

Maze_EQ
10-19-2016, 11:29 AM
In diablo, there were no lore items or lore augments ;) remove lore and gucci.

Except Wirt's leg, but let's be honest, Wirt was a jerkoff.

ghanja
10-19-2016, 12:07 PM
In diablo, there were no lore items or lore augments ;) remove lore and gucci.

Except Wirt's leg, but let's be honest, Wirt was a jerkoff.

Well, the implementation of making the item lore, is to make handling easier (dare I say possible, without source changes/additions). Otherwise, with NukeItem you could quite possibly/easily nuke the unintended item.

The following assumes the item is lore, has not been tested, as I don't have Perl on the computer I'm on atm:


sub EVENT_LOOT {
@eligibleitemidarray = (1,4); ## we could iterate through the keys of the hash each time but, technicaly more extensive load
if ($itemid ~~ @eligibleitemidarray) {
my %h = (
1 => [[69,72,81],[69,72,81],[69,72,81],[69,72,81],[91,94,96],[100,142,214]],
4 => [[45,75,81],[45,75,81],[45,75,81],[45,75,81],[45,75,81],[100,142,214]]
);
if (quest::ChooseRandom(1..10) < 10) {
$client->NukeItem($itemid);
$client->SummonItem($itemid, 0, 1, ($h{$itemid}[0][quest::ChooseRandom(0..((scalar @{$h{$itemid}}[0]) - 1 ))]),
($h{$itemid}[1][quest::ChooseRandom(0..((scalar @{$h{$itemid}}[1]) - 1 ))]),
($h{$itemid}[2][quest::ChooseRandom(0..((scalar @{$h{$itemid}}[2]) - 1 ))]),
($h{$itemid}[3][quest::ChooseRandom(0..((scalar @{$h{$itemid}}[3]) - 1 ))]),
($h{$itemid}[4][quest::ChooseRandom(0..((scalar @{$h{$itemid}}[4]) - 1 ))]),
($h{$itemid}[5][quest::ChooseRandom(0..((scalar @{$h{$itemid}}[5]) - 1 ))]));
}
}
}



@eligibleitemidarray


I choose to do a smart match on a predefined array/list of applicable item numbers, as iterating through the hash with every looting may be a little more taxing on the server. Who's to say though, and it would definitely depend on how far you may expand things in the future.

It's not clean (i.e. could use some clean up), but, should at the very least give you an idea of how you could go about things.

Now, if:


quest::addloot()


Could be expanded upon, to include augments, then what you want to do would be possible via scripting and would allow for universal "usage", that is to say, would/could be a useful change for everyone and not just your situation. (hint wink Kingly?)

lordnivek1
10-19-2016, 01:31 PM
so running with the idea that a generic sword named "unidentified sword" drops and they have to take it to an npc to get it identified. is this how you would set up your array to spit out an item with augments in it. .Hopefully I understood what you were trying to say was possible.


{
if($itemid == x)
{

$client->NukeItem(itemnum)

my @add_aug1 = ('1000', '1001', '1005', '1007')

my @add_aug2 = ('5000', '5001', '5005', '5007')

my $random = int(rand 4);

my $aug1 = $add_aug1[$random];

my $aug2 = $add_aug2[$random];

$client->SummonItem(XXX, 0, 1, $aug1, $aug2)
}
}

ghanja
10-19-2016, 01:47 PM
If you take to an NPC, I would just have the player trade the item, then summon it to the players cursor (the augmented version).

Maze_EQ
10-19-2016, 01:50 PM
That looks like a general concept.

Run with it!

lordnivek1
10-19-2016, 02:03 PM
Well thank you both for the help. I cant wait to get home from work and try some of this out. :grin:

ghanja
10-19-2016, 02:20 PM
Well thank you both for the help. I cant wait to get home from work and try some of this out. :grin:

Not entirely sure of the "modified" behavior you're looking for, since you've found it's almost surely not possible (at this time) to add an augmented item without source changes.

However, I would use quest::ChooseRandom in place of Perl's rand. Also, know, that rand(4) would produce fractions (i.e. 0.43456, 1.2235, etc.) so that conditional, while it -could- some year be true as you have it written, if you are insistent on using rand(), then:


my $random = int(rand(3));


Is what you'd be after. Why only 3? Because a pointer to an array element begins at 0, not 1. You have four elements listed, so, 0, 1, 2 and 3 would be valid pointers.

Here is an example of something (without iterating through the %itemcount hash for simplicity, as I'm not sure your comfort level of hashes) utilizing an EVENT_ITEM (i.e. trade) event:


sub EVENT_ITEM {
@eligibleitemidarray = (100,200,300,400);
if (($item1 ~~ @eligibleitemidarray) ||
($item2 ~~ @eligibleitemidarray) ||
($item3 ~~ @eligibleitemidarray) ||
($item4 ~~ @eligibleitemidarray)) {
my @add_aug1 = ('1000', '1001', '1005', '1007');
my @add_aug2 = ('5000', '5001', '5005', '5007');
my $random = quest::ChooseRandom(0..3);
$client->SummonItem(XXX, 0, 1, $add_aug1[$random], $add_aug2[$random])
}
else {
plugin::return_items(\%itemcount);
}
}

lordnivek1
10-19-2016, 02:54 PM
all my knowledge and familiarity with any of this comes from the wiki introduction to perl scripting, ulitmate perl reference and what I can copy and past from code I find searching the forums/quest folder haha.

ghanja
10-19-2016, 03:29 PM
I'm going a little beyond my comfort level without having at least Perl installed on this PC, but this may do the trick:


sub EVENT_LOOT {
if (quest::ChooseRandom(1..10) < 10) {
my %h = (
1 => [[69,72,81],[69,72,81],[69,72,81],[69,72,81],[91,94,96],[100,142,214]],
4 => [[45,75,81],[45,75,81],[45,75,81],[45,75,81],[45,75,81],[100,142,214]]
);
if ($itemid ~~ keys %h) {
@augments;
$unaugmenteditemslot;
@slots_to_check = (0..30,251..340);
foreach my $a_s (0..4) {
$augments[$a_s] = ($h{$itemid}[$a_s][quest::ChooseRandom(0..((scalar @{$h{$itemid}}[$a_s]) - 1 ))]);
}
foreach my $slot_check ($slots_to_check) {
$dupe_check = 0;
$slot_item_id = $client->GetItemIDAt($slot_check);
if ($itemid == $slot_item_id) {
for ($augment_check = 0; $augment_check < 5; $augment_check++) {
$augment_item_id = $client->GetAugmentIDAt($slot_item_id, $augment_check);
$unaugmenteditemslot = $slot_check if ($augment_item_id = 0);
++$dupe_check if ($augment_item_id == $augments[$augment_check]);
}
}
}
$client->RemoveItem($itemid, 1, $unaugmentedslot);
if ($dupe_check = 5) {
$client->Message(7, "That item has poofed into the abyss as you already have one just like it!");
} else {
$client->SummonItem($itemid,0,1,$augments[0],$augments[1],$augments[2],$augments[3],$augments[4],$unaugmentedslot);
}
}
}
}


It will need to be checked for logic (heading out of town so no time). It appears sound.

I -think- it will function as closely as what you were after. I used the augment item ID's of what you originally provided for reference of what is going on in the hash of arrays. The key values (ie. 1 and 4) are the item ID's of the main item you're dealing with.

Gotta run, good luck.

Darkscis
10-19-2016, 10:47 PM
$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.

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 :)

ghanja
10-19-2016, 11:03 PM
$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.

Darkscis
10-19-2016, 11:05 PM
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.

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...

ghanja
10-19-2016, 11:12 PM
I'm finalizing packing before heading out of state. I have NPC::AddLootDrop open now (as a result of revisiting this thread due to your initial post) and, yeah, I see that as well. Actually not much involved, append parameters to the function's existing parameters, if null/undef default to 0 as they are now already so it doesn't break anything, then as you said modify the questmanager calls and Perl/LUA parser.

If this preparing doesn't take too much longer, I'll have a dig at it, otherwise, I'm sure someone else may jump in (which is fine, I need to get back to what I was doing but ADD kicked in, actually it was getting monotonous).

Darkscis
10-19-2016, 11:15 PM
I'm finalizing packing before heading out of state. I have NPC::AddLootDrop open now (as a result of revisiting this thread due to your initial post) and, yeah, I see that as well. Actually not much involved, append parameters to the function's existing parameters, if null/undef default to 0 as they are now already so it doesn't break anything, then as you said modify the questmanager calls and Perl/LUA parser.

If this preparing doesn't take too much longer, I'll have a dig at it, otherwise, I'm sure someone else may jump in (which is fine, I need to get back to what I was doing but ADD kicked in, actually it was getting monotonous).

My only concern would be if it was intentionally left that way as adding augments breaks something further down the line. Doesn't hurt to give it a go though, easily reversible.

EDIT: Also I love your script. Do you mind if I shamelessly copy a chunk of it to use for finding empty inventory slots for my NPC barter system? At the moment I just summon all the items traded to cursor and let the client handle placing them but with your slot finder section I could find empty slots and summon to those instead.

lordnivek1
10-20-2016, 10:38 AM
Thanks to everyone that replied to this. this is all great stuff.

lordnivek1
10-20-2016, 08:57 PM
So I finally got some time to play around with this and here is what I have. I went with having a NPC identifing the item as it fits my server even better then the item just dropping plus by adding a fee it adds a small money sink. And its not hard to just make a dummy (unidentified) item for each item. One thing I could not get to work was aug6. I could only ever get it to work up to aug5. It would leave the slot blank and then eventually just stop working. I also found if i didnt set up a random for each aug it would pick the same number for all 5.


sub EVENT_ITEM{
if(plugin::check_handin(\%itemcount, 5001 => 1)) {
my @add_aug1 = ('1', '9', '25', '33', '41', '49', '65', '81', '89', '97', '105' ,'113', '121', '129', '137');
my $random1 = quest::ChooseRandom(0..14);
my @add_aug2 = ('1', '9', '25', '33', '41', '49', '65', '81', '89', '97', '105' ,'113', '121', '129', '137');
my $random2 = quest::ChooseRandom(0..14);
my @add_aug3 = ('1', '9', '25', '33', '41', '49', '65', '81', '89', '97', '105' ,'113', '121', '129', '137');
my $random3 = quest::ChooseRandom(0..14);
my @add_aug4 = ('1', '9', '25', '33', '41', '49', '65', '81', '89', '97', '105' ,'113', '121', '129', '137');
my $random4 = quest::ChooseRandom(0..14);
my @add_aug5 = ('1', '9', '25', '33', '41', '49', '65', '81', '89', '97', '105' ,'113', '121', '129', '137');
my $random5 = quest::ChooseRandom(0..14);
$client->SummonItem(5000, 0, 1, $add_aug1[$random1], $add_aug2[$random2], $add_aug3[$random3], $add_aug4[$random4], $add_aug5[$random5])
}
plugin::return_items(\%itemcount);
}



Thanks again for all the input. This works great. :)

Kingly_Krab
10-20-2016, 09:17 PM
I added augment support to $npc->AddItem() and quest::addloo0,, I never thought of something like this, so I'm glad you brought this up. Hopefully you can make use of it, but you'll have to wait until this (https://github.com/EQEmu/Server/pull/568) pull request is merged so you can pull the code down and use augments in these functions.

Uleat
10-20-2016, 09:19 PM
"Usage: Client::SummonItem(THIS, item_id, charges=0, attune=0, aug1=0, aug2=0, aug3=0, aug4=0, aug5=0, slot_id=30)"

The perl api isn't coded to handle the extra aug slot.

Not easy to change since it would break any pre-existing scripts based on the 5-augment code.

Maze_EQ
10-24-2016, 12:52 PM
Kinglay Karab for duh wein

Darkscis
10-27-2016, 09:09 PM
Not quite the original intended purpose but I can confirm $client->SummonItem works great when supplying a slot id. I used ghanja's code to iterate through inventory slots and then summon items direct to a free one in my trading system. Kind of moot now that KK has fixed the loot ones, but good to know nevertheless!

Kingly_Krab
10-28-2016, 12:11 PM
As far as I saw, he wanted something like this to be possible. sub EVENT_SPAWN {
if (quest::ChooseRandom(1..100) <= 10) {
if ($npc->GetNPCTypeID() == #) {
$random_item = quest::ChooseRandom(1, 4);
if ($random_item == 1) {
quest::addloot($random_item, 1, 0, quest::ChooseRandom(69, 72, 81), quest::ChooseRandom(69, 72, 81), quest::ChooseRandom(69, 72, 81), quest::ChooseRandom(69, 72, 81), quest::ChooseRandom(69, 72, 81), quest::ChooseRandom(100, 142, 214));
} elsif ($random_item == 4) {
quest::addloot($random_item, 1, 0, quest::ChooseRandom(45, 75, 81), quest::ChooseRandom(45, 75, 81), quest::ChooseRandom(45, 75, 81), quest::ChooseRandom(45, 75, 81), quest::ChooseRandom(45, 75, 81), quest::ChooseRandom(100, 142, 214));
}
} elsif ($npc->GetNPCTypeID() == #) {
$random_item = quest::ChooseRandom(6, 9);
##blah blah blah;
}
}
}