remove item from list

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

remove item from list

Post by Ememjr » Fri Apr 14, 2017 8:03 am

in this routine in client.cpp

Code: Select all

void Client::Loot(int32 total_coins, vector<Item*>* items, Entity* entity)
the items list which contains the loot items which will be displayed to the player in the loot window i added this bit of code in order to detect if an item is lore or not

Code: Select all

LogWrite(PLAYER__DEBUG, 0, "Robert Lore", "Checking for Lore:%i Result: %i", item->generic_info.item_flags, item->generic_info.item_flags & LORE);
		if ((item->generic_info.item_flags & LORE) >0){
			LogWrite(PLAYER__DEBUG, 0, "Robert Lore", "Found a Lore Item    Flag %i  result: %i", item->generic_info.item_flags, item->generic_info.item_flags & LORE );
			code to remove item from the list
		}
what is the proper way/command to remove a specific item from the loot list, so it will not be included in the packet that in generate later in the code

** i do realize my code is not complete but i am trying to learn the system implemented. i will be adding checks the following checks and removeing item from list if neccessary

1. lore and you already have the item
2. lore, quest starter and you already started or finished the quest
3. room to grow if there are quest items in the spawn loot that a player should not receive

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: remove item from list

Post by Jabantiz » Fri Apr 14, 2017 4:31 pm

As it is a vector you can use erase to remove it from the vector, this will invalidate the iterator if used in a loop, however it will also return a valid iterator though I think there was issues with that on Linux.

If you want to remove just for a single player then you will not want to delete it from the vector as that will remove it for every one, instead while building the packet I believe you would just skip the item.

Side note, doesn't live show lore items when you loot, it just won't let you loot them? I know some quest items will drop and only show for those on the quest step while others not on it get a message along the lines of "there is nothing for you to loot" if that is the only thing left to loot.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: remove item from list

Post by Ememjr » Fri Apr 14, 2017 5:16 pm

Jabantiz wrote: Fri Apr 14, 2017 4:31 pm Side note, doesn't live show lore items when you loot, it just won't let you loot them? I know some quest items will drop and only show for those on the quest step while others not on it get a message along the lines of "there is nothing for you to loot" if that is the only thing left to loot.
typicale quest starters wont show in loot if you already started or finished it, or have it in you inventory

lore armour/weapon loot etc, does show up and just wont let you loot it

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests