Delta Posted March 12, 2015 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 43 Reputation: 0 Joined: 09/27/12 Last Seen: April 10, 2015 Share Posted March 12, 2015 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.c Line 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.h Line 854: int map_addflooritem_area(struct block_list* bl, int16 m, int16 x, int16 y, int nameid, int amount); --------------------------------------------- mob.c Line 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.c Line 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; } I use this source code then I'll apply the code in correct line. but sad to say I encounter errors Thank you in advance! Quote Link to comment Share on other sites More sharing options...
Question
Delta
I use this source code then I'll apply the code in correct line. but sad to say I encounter errors
Thank you in advance!
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.