Brave

[Suggestion] Itembound Bug

Recommended Posts

 

Item Bound System

r17351 adds in a new feature which allows characters to have specific items bounded to their account, guild, or party.

Suggestion topic: http://rathena.org/board/topic/70372-item-account-bound-proposal/

 

Features:

  • Items can be bounded 3 different ways.
  • New script commands 'getitembound' and 'getitembound2' creates bounded items.
  • New script command 'countbound' counts number of bounded items, also placing them automatically into an array.

 

 

*getitembound <item id>,<amount>,<bound_type>{,<account ID>};
*getitembound "<item name>",<amount>,<bound_type>{,<account ID>};

This command will give an amount of specified items to the invoking character.
If an optional account ID is specified, and the target character is currently
online, items will be created in their inventory instead. If they are not
online, nothing will happen.

It works essentially the same as 'getitem', except that items created using
this command will bound the item to the player's account. Depending on the bound type issued,
the character may not be able to trade or store these items, however all bounded types
cannot be sold, vended, auctioned, or mailed.

Bound Types:
    1 - Account Bound
    2 - Guild Bound
    3 - Party Bound
    4 - Character Bound

---------------------------------------

*getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound_type>{,<account ID>};
*getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound_type>{,<account ID>};

This command will give an amount of specified items to the invoking character.
If an optional account ID is specified, and the target character is currently
online, items will be created in their inventory instead. If they are not
online, nothing will happen.

It works essentially the same as 'getitem2', except that items created using
this command will bound the item to the player's account. Depending on the bound type issued,
the character may not be able to trade or store these items, however all bounded types
cannot be sold, vended, auctioned, or mailed.

Bound Types:
    1 - Account Bound
    2 - Guild Bound
    3 - Party Bound
    4 - Character Bound

---------------------------------------

*countbound({<bound_type>})

This function will return a number of bounded items on the character.
Optionally, you may count a specific type of bounded item on the character.

countbound will also build an array of items in the form of @bound_items.
Using countbound without a type counts all types of bounded items.

Available types are:
    1 - Account Bound
    2 - Guild Bound
    3 - Party Bound
    4 - Character Bound

Example:
    mes "[bound Counter]";
    mes "I see you currently have "+countbound+" bounded items.";
    next;
    mes "The list of bounded items include:";
    for([email protected] = 0; [email protected]<getarraysize(@bound_items); [email protected]++)
        mes getitemname(@bound_items[[email protected]]);
    close;
 
  • New at commands @itembound and @itembound2 used to create bounded items on the fly.

 

 

@itembound <item name/ID> <amount> <bound_type>

Creates the specified item and bounds it to the account.
bound_type: 1 = Account, 2 = Guild, 3 = Party, 4 = Character

---------------------------------------

@itembound2 <item name/ID> <quantity> <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4> <bound_type>

Creates an item with the given parameters (the 'cards' can be any item) and bounds it to the account.
identify_flag: 0 = unidentified, 1 = identified
attribute: 0 = not broken, 1 = broken
bound_type: 1 = Account, 2 = Guild, 3 = Party, 4 = Character
  • Account bound items can be stored in account storage and in cart.
  • Guild bound items can be stored in guild storage and traded to other guild members.
    • When a character leaves or is expelled from the guild, these bounded items are automatically returned to guild storage.
  • Party bound items cannot be stored but only traded to other party members.  These are temporary and will be deleted on party deletion or when leaving the party.

 

Credits to Xantara for the initial diff and Lighta for helping with the guild bound system.

Please report all issues/bugs in the proper bug report section.

 

Don't forget to update your SQL tables with upgrade_svn17351.sql!

 

 

I have seen that the itembound is still working even though the entry of data is not complete

 

so i wish it would be change what i mean is this both works

 

@itembound Poring_coin 1 <====== THIS IS INCORRECT BUT WORKING

@itembound poring_coin 1 1 <==== THIS IS CORRECT and WORKING

 

so i am suggesting that it would be changed into something incomplete data should not work

 

the problem with this 

@itembound poring_coin 1 <==== it was like @item command doesn't make sense 

 

so i tried to make some configuration and it works!

 

src/map/atcommand.c

 

ACMD_FUNC(item)
{
    char item_name[100];
    int number = 0, flag = 0, bound = 0;
    struct item item_tmp;
    struct item_data *item_data[10];
    int get_count, i, j=0;
    char *itemlist;

    nullpo_retr(-1, sd);
    memset(item_name, '\0', sizeof(item_name));

    if (!strcmpi(command+1,"itembound") && (!message || !*message || (
---      sscanf(message, "\"%99[^\"]\" %d %d", item_name, &number, &bound) < 2 &&
---      sscanf(message, "%99s %d %d", item_name, &number, &bound) < 2
+++        sscanf(message, "\"%99[^\"]\" %d %d", item_name, &bound, &number) < 2 &&
+++        sscanf(message, "%99s %d %d", item_name, &bound, &number) < 2
    ))) {
---      clif_displaymessage(fd, msg_txt(sd,295)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity> <bound_type>).
+++        clif_displaymessage(fd, msg_txt(sd,295)); // Please enter an item name or ID (usage: @item <item name/ID> <bound_type> <quantity>).
        return -1;
    } else if (!message || !*message || (
        sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 &&
        sscanf(message, "%99s %d", item_name, &number) < 1
    )) {
        clif_displaymessage(fd, msg_txt(sd,983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>).
        return -1;
    }
    itemlist = strtok(item_name, ":");
    while (itemlist != NULL && j<10) {
        if ((item_data[j] = itemdb_searchname(itemlist)) == NULL &&
         (item_data[j] = itemdb_exists(atoi(itemlist))) == NULL){
            clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name.
            return -1;
        }
        itemlist = strtok(NULL, ":"); //next itemline
        j++;
    }

    if( bound < 0 || bound > 4 ) {
        clif_displaymessage(fd, msg_txt(sd,298)); // Invalid bound type
        return -1;
    }

    if (number <= 0)
        number = 1;
    get_count = number;

    for(j--; j>=0; j--){ //produce items in list
        int16 item_id = item_data[j]->nameid;
        //Check if it's stackable.
        if (!itemdb_isstackable2(item_data[j]))
            get_count = 1;

        for (i = 0; i < number; i += get_count) {
            // if not pet egg
            if (!pet_create_egg(sd, item_id)) {
                memset(&item_tmp, 0, sizeof(item_tmp));
                item_tmp.nameid = item_id;
                item_tmp.identify = 1;
                item_tmp.bound = bound;

                if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
                    clif_additem(sd, 0, 0, flag);
            }
        }
    }

    if (flag == 0)
        clif_displaymessage(fd, msg_txt(sd,18)); // Item created.
    return 0;
}

JUST A SUGGESTION

 

  • Upvote 1

Share this post


Link to post
Share on other sites

lol ...is this a suggestion ?? or a bug ... O__O

 

[suggestion] Itembound Bug ?? lol

Share this post


Link to post
Share on other sites

lol ...is this a suggestion ?? or a bug ... O__O

 

[suggestion] Itembound Bug ?? lol

 

what i mean is to fix the bug of the itembound LOL 

Share this post


Link to post
Share on other sites

i don't know how to make pull request can you do it for me?

Share this post


Link to post
Share on other sites

i don't know how to make pull request can you do it for me?

didn't I give the link?

well, I'll apply this in my next commit. :D

thank you. /no1

Share this post


Link to post
Share on other sites

 

i don't know how to make pull request can you do it for me?

didn't I give the link?

well, I'll apply this in my next commit. :D

thank you. /no1

 

 

yeah sure just don't forget to mention me LOL

 

i don't know how to make pull request can you do it for me?

didn't I give the link?

well, I'll apply this in my next commit. :D

thank you. /no1

 

 

there's a little error in that in itembounding you cannot exceed 4 but i know you can fix it LOL

Share this post


Link to post
Share on other sites

I am starting to work on this now.

Share this post


Link to post
Share on other sites

I am starting to work on this now.

 

alright thank you :P please send me the link commit thank you very much!

Share this post


Link to post
Share on other sites

 

I am starting to work on this now.

 

alright thank you :P please send me the link commit thank you very much!

 

 

 

Here you go, 794c1a8

/thx

Share this post


Link to post
Share on other sites