Jump to content
  • 0
Sign in to follow this  
rans

@Flooritem Plugin Request :)

Question

Hi
Can i ask help with making a plugins? and i am new to hercules. i have a src code for @flooritem (working in rAthena. not tested in hercules) if you could help me to make this plugin. that would be very helpful :)

atcommand.c ACMD_FUNC(flooritem){	char item_name[100];	int number = 0, count;	struct item_data *item_data;	nullpo_retr(-1, sd);	 memset(item_name, '0', sizeof(item_name));	 if( !message || !*message || (		sscanf(message, ""%99[^"]" %d", item_name, &number) < 1 &&		sscanf(message, "%99s %d", item_name, &number) < 1	)) {		clif_displaymessage(fd, "Usage: @flooritem <itemname/itemid> [quantity]");		return -1;	}	 if( number <= 0 )		number = 1;	 if ((item_data = itemdb_searchname(item_name)) == NULL &&	    (item_data = itemdb_exists(atoi(item_name))) == NULL)	{		clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name.		return -1;	}	 count = map_addflooritem_area(&sd->bl, 0, 0, 0, item_data->nameid, number);	 if( count != 0 )		if( number == count )			clif_displaymessage(fd, "All items created.");		else		{			sprintf(atcmd_output, "%d item(s) created.", count);			clif_displaymessage(fd, atcmd_output);		}	else {		clif_displaymessage(fd, "No items created!!.");		return -1;	}	 return 0;}------------------------------------		ACMD_DEF(flooritem),-------------------------------------map.cLine 1501: int map_addflooritem_area(struct block_list* bl, int16 m, int16 x, int16 y, int nameid, int amount){	struct item item_tmp;	int count, range, i;	short mx, my;	 memset(&item_tmp, 0, sizeof(item_tmp));	item_tmp.nameid = nameid;	item_tmp.identify = 1;	 if( bl != NULL ) m = bl->m;	 count = 0;	range = (int)sqrt(amount) +2;	for( i = 0; i < amount; i++ )	{		if( bl != NULL )			map_search_freecell(bl, 0, &mx, &my, range, range, 0);		else		{			mx = x; my = y;			map_search_freecell(NULL, m, &mx, &my, range, range, 1);		}		 count += (map_addflooritem(&item_tmp, 1, m, mx, my, 0, 0, 0, 0, 4) != 0) ? 1 : 0;	}	 return count;}  --------------------------------------------map.hLine 854: int map_addflooritem_area(struct block_list* bl, int16 m, int16 x, int16 y, int nameid, int amount); --------------------------------------------- mob.cLine 2872:			 if( md->option.item_drop > 0 && itemdb_exists(md->option.item_drop) && md->option.item_amount > 0 )			{				map_addflooritem_area(&md->bl, 0, 0, 0, md->option.item_drop, md->option.item_amount);				clif_misceffect(&md->bl,10);				md->option.item_drop = 0;				md->option.item_amount = 0;			}  ----------------------------------------------script.cLine 17850: BUILDIN_FUNC(flooritem){	struct map_session_data *sd = script_rid2sd(st);	struct item_data *item_data;	int nameid, amount;	 if( sd == NULL ) return 0;	 nameid = script_getnum(st,2);	if( (item_data = itemdb_search(nameid)) == NULL )		return 0;	 amount = script_getnum(st,3);	if( amount <= 0 )		return 0;	 map_addflooritem_area(&sd->bl, 0, 0, 0, nameid, amount);	return 0;} BUILDIN_FUNC(flooritem2xy){	struct item_data *item_data;	int nameid, amount, m, x, y;	const char *mapname;	 mapname = script_getstr(st,2);	if( (m = map_mapname2mapid(mapname)) < 0 )		return 0;	 x = script_getnum(st,3);	y = script_getnum(st,4);	nameid = script_getnum(st,5);	if( (item_data = itemdb_search(nameid)) == NULL )		return 0;	 amount = script_getnum(st,6);	if( amount < 1 )		return 0;	 map_addflooritem_area(NULL, m, x, y, nameid, amount);	return 0;} -------------------------------  



Thank you very much /no1

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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