Jump to content
  • 0
WhiteEagle

Item drop with random refine level/card

Question

Greetings,
I would like to add the feature that monsters can also drop items with random refine level and / or cards.
But when I run it over OnPCPickUpEvent (a Plugin by AnnieRuru <3), it can be abused by drop item and pick up again.
So, may I ask for a src edit to make possible?
 

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0

the cards can be done by retrieve the card ID from `item_db` SQL table, its not that hard to do

https://github.com/AnnieRuru/Release/blob/master/plugins/addrefinedrop/addrefinedrop_0.2.c

btw, this is simple stuffs ....
PS: when testing, I turned on autoloot and using custom identifier script

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 1

update plugin -> https://github.com/AnnieRuru/Release/blob/master/plugins/addrefinedrop/addrefinedrop_0.3.c

along with healer script for testing -> https://github.com/AnnieRuru/Release/blob/master/scripts/Utility/healer/healer_1.2.txt

 

2 hours ago, evilpuncker said:

sorry for the necropost, but just a small doubt, does the source already check if item is refineable (flag.no_refine) somewhere else or should we add the check too?

nope, but we can just struct item_data of the nameid to get the data of that item

1.4 - https://github.com/AnnieRuru/Release/blob/master/plugins/addrefinedrop/addrefinedrop_0.4.c

- if the item is non-refine-able, it doesn't drop refined items

Share this post


Link to post
Share on other sites
  • 0

just use OnNPCKillEvent and makeitem2 script command, shouldn't very hard to do

 

Spoiler

..... or maybe needs *mobevent script command ...
well if you needs the monster's coordinate when monster dead ...

 

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
Quote

just use OnNPCKillEvent and makeitem2 script command, shouldn't very hard to do

At first thanks for your response and yes it isnt hard to do like this,
but the problem with makeitem is, it can happen it drop twice. (1x normal and 1x from makeitem)
As example: Poring get killed and drop a knife and with some "luck" prog the makeitem, so he get 2 knifes.
I would have to switch off the normal drop completely and just let makeitem run.
 

Edit:
If i understand this correct, could this added here.

/*==========================================
 * item drop with delay (timer function)
 *------------------------------------------*/
static int mob_delay_item_drop(int tid, int64 tick, int id, intptr_t data)
{
	struct item_drop_list *list;
	struct item_drop *ditem;
	list=(struct item_drop_list *)data;
	ditem = list->item;
	while (ditem) {
		struct item_drop *ditem_prev;
		map->addflooritem(NULL, &ditem->item_data,ditem->item_data.amount,
		    list->m,list->x,list->y,
		    list->first_charid,list->second_charid,list->third_charid,0,
		    ditem->showdropeffect);
		ditem_prev = ditem;
		ditem = ditem->next;
		ers_free(item_drop_ers, ditem_prev);
	}
	ers_free(item_drop_list_ers, list);
	return 0;
}

 

Edited by WhiteEagle

Share this post


Link to post
Share on other sites
  • 0
5 hours ago, WhiteEagle said:

I would have to switch off the normal drop completely and just let makeitem run.

exactly the point, I assumed this is use in events, so you already have mf_nomobloot enabled
disable monster drop on the map, and use makeitem2 script command to make monster drop items instead

so you mean this is use on normal monster drop as well ?

#include "common/hercules.h"
#include "map/mob.h"
#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"addrefinedrop",
	SERVER_TYPE_MAP,
	"x.x",
	HPM_VERSION,
};

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) {
	if ( retVal->item_data.nameid == 1202 )
		retVal->item_data.refine = 2;
	return retVal;
}

HPExport void plugin_init( void ) {
	addHookPost( mob, setdropitem, mob_setdropitem_post );
}

tested with killing poring repeatedly, "@monster 1002 100" and go for item Knife_ drop

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
Quote

so you mean this is use on normal monster drop as well ?

Spoiler


#include "common/hercules.h"
#include "map/mob.h"
#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"addrefinedrop",
	SERVER_TYPE_MAP,
	"x.x",
	HPM_VERSION,
};

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) {
	if ( retVal->item_data.nameid == 1202 )
		retVal->item_data.refine = 2;
	return retVal;
}

HPExport void plugin_init( void ) {
	addHookPost( mob, setdropitem, mob_setdropitem_post );
}

 

 

Yea awesome, that's what i mean!
But not only for one or few items, for all armor and weapons.
Like:

 if ( retVal->item_data.type == IT_ARMOR && retVal->item_data.type == IT_WEAPON )
        retVal->item_data.refine = rand(1,9);

The stuff with cards is not much important. The function for the refine is good enough.

Thanks AnnieRuru for your time.
 

Edited by WhiteEagle

Share this post


Link to post
Share on other sites
  • 0

Hey AnnieRuru, may I can ask your help again.
After adding the random option system, the refine drop dont work anymore.

I changed this:

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) {

to

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, struct optdrop_group *options, int qty, struct item_data *data ) {

to get no errors. But no items are droped with refine level :(
Can you please fix this? 
Thanks in advance <3

Share this post


Link to post
Share on other sites
  • 0
On 3/30/2019 at 6:53 AM, WhiteEagle said:

After adding the random option system, the refine drop dont work anymore.

curious, you mean you apply this https://github.com/HerculesWS/Hercules/pull/2309 modification ?

if what you said is real ... then there's bug on that pull request ...

hopefully that PR will get merge ... well we have inactive admin... means our current development is very very ... very slow ...

Share this post


Link to post
Share on other sites
  • 0

The Item random option system works fine. But your plugin for the refine drop will not work anymore because the structure has changed.
This line here:

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) {

That's why I asked you if you know what needs to be changed to make the refine drop work again.

 

 

The error says that something is wrong here:

HPExport void plugin_init( void ) {
	addHookPost( mob, setdropitem, mob_setdropitem_post );

 

Share this post


Link to post
Share on other sites
  • 0

Hey Annie, 

could I request to update this Plugin?
The Option Drop Groups was merged and now this Plugin don't work anymore. :(

 

Share this post


Link to post
Share on other sites
  • 0
On 3/27/2019 at 12:38 AM, AnnieRuru said:

the cards can be done by retrieve the card ID from `item_db` SQL table, its not that hard to do

https://github.com/AnnieRuru/Release/blob/master/plugins/addrefinedrop/addrefinedrop_0.2.c

btw, this is simple stuffs ....
PS: when testing, I turned on autoloot and using custom identifier script

 

sorry for the necropost, but just a small doubt, does the source already check if item is refineable (flag.no_refine) somewhere else or should we add the check too? (asking this because there are items that shouldn't be refineable and I didn't see a check)

Edited by evilpuncker

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.