Jump to content
  • 0

@flooritem


Delta

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   0
  • Joined:  09/27/12
  • Last Seen:  


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

AZoRVEh.png

 

Thank you in advance!

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.   Paste as plain text instead

  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.

×
×
  • Create New...