diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 8fd2c19cbe..8a6feb8d18 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -5060,18 +5060,19 @@ See 'getitem2' for an explanation of the expanded parameters. *countbound({{,}}) -This function will return the number of bounded items in the character's -inventory, and sets an array @bound_items[] containing all item IDs of the -counted items. If a bound type is specified, only those items will be counted. +This function will return the number of different bounded items in the character's +inventory, and sets the arrays @bound_items[] and @bound_amount[] containing all item IDs of the +counted items and their respective amount. If a bound type is specified, only those items will be counted. For a list of bound types see 'getitembound'. Example: - mes "You currently have " + countbound() + " bounded items."; + .@total_type = countbound(); + mes "You currently have " + .@total_type + " different type of bounded items."; next; mes "The list of bounded items include:"; - for(.@i = 0; .@i < getarraysize(@bound_items); .@i++) - mes getitemname(@bound_items[.@i]); + for(.@i = 0; .@i < .@total_type; .@i++) + mes "x" + @bound_amount[.@i] + " " + getitemname(@bound_items[.@i]); close; --------------------------------------- diff --git a/src/map/script.cpp b/src/map/script.cpp index 0ac8f88d2a..25c607fff2 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -21821,17 +21821,17 @@ BUILDIN_FUNC(stand) /** Creates an array of bounded item IDs * countbound {{,}}; * @param type: 0 - All bound items; 1 - Account Bound; 2 - Guild Bound; 3 - Party Bound - * @return amt: Amount of items found + * @return amt: Total number of different items type found */ BUILDIN_FUNC(countbound) { - int i, type, j = 0, k = 0; TBL_PC *sd; if (!script_charid2sd(3,sd)) return SCRIPT_CMD_FAILURE; - type = script_getnum(st,2); + int i, k = 0; + int type = script_getnum(st,2); for( i = 0; i < MAX_INVENTORY; i ++ ) { if( sd->inventory.u.items_inventory[i].nameid > 0 && ( @@ -21839,12 +21839,12 @@ BUILDIN_FUNC(countbound) )) { pc_setreg(sd,reference_uid(add_str("@bound_items"), k),sd->inventory.u.items_inventory[i].nameid); + pc_setreg(sd,reference_uid(add_str("@bound_amount"), k),sd->inventory.u.items_inventory[i].amount); k++; - j += sd->inventory.u.items_inventory[i].amount; } } - script_pushint(st,j); + script_pushint(st,k); return SCRIPT_CMD_SUCCESS; }