countbound script command update (#5200)
* the command now returns the number of differents type of item found * the amount by item ID is now save in bound_amount array Thanks to @Daegaladh
This commit is contained in:
parent
42f24866ae
commit
43ea987ba7
@ -5060,18 +5060,19 @@ See 'getitem2' for an explanation of the expanded parameters.
|
||||
|
||||
*countbound({<bound type>{,<char_id>}})
|
||||
|
||||
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;
|
||||
|
||||
---------------------------------------
|
||||
|
@ -21821,17 +21821,17 @@ BUILDIN_FUNC(stand)
|
||||
/** Creates an array of bounded item IDs
|
||||
* countbound {<type>{,<char_id>}};
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user