summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/script_commands.txt39
-rw-r--r--src/map/script.c17
2 files changed, 41 insertions, 15 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 380fa72f4..b184444cd 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -4848,36 +4848,63 @@ Example:
*checkbound(<item_id>{,<bound_type>{,<refine>{,<attribute>{,<card_1>{,<card_2>{,<card_3>{,<card_4>}}}}}}});
This command allows you to check whether or not the attached player has the specified bound item in their inventory.
+If a bound type is not specified or a bound type of 0 is used, it will search the player's inventory for a bound item
+of any type, so long as the other parameters match. In all cases, this command will return the bound type of the
+item found, or 0 if the specified item was not found.
Valid bound types are:
+ 0 - All Bound types.
1 - Account Bound
2 - Guild Bound
3 - Party Bound
4 - Character Bound
Optional Parameters:
+ bound_type - checks to see if the item has the specified bound type.
refine - checks to see if the item is refined to the given number.
- attribute - whether the item is broken (1) or not (0)
+ attribute - whether the item is broken (1) or not (0).
card 1,2,3,4 - checks to see if the specified cards are compounded on the item as well.
Example:
// This will check if you have a bound (any type) 1205 (Cutter).
if (checkbound(1205)) {
mes "You have a bound Cutter";
- close;
} else {
mes "You do not have a bound Cutter";
- close;
}
+ close;
+
+ // This will also check if you have a bound (any type) 1205 (Cutter).
+ if (checkbound(1205,0)) {
+ mes "You have a bound Cutter";
+ } else {
+ mes "You do not have a bound Cutter";
+ }
+ close;
+
+ // This will check if the player doesn't have a bound 1205 (Cutter).
+ if (!checkbound(1205)) {
+ mes "You do not have a bound Cutter";
+ } else {
+ mes "You do have a bound Cutter";
+ }
+ close;
+
+ // This will check if the item found, has a bound type of 2 (guild_bound)
+ if (checkbound(1205) == 2) {
+ mes "You have a guild_bound Cutter";
+ } else {
+ mes "You do not have a guild_bound Cutter.";
+ }
+ close;
// This will check if you have a 'guild_bound' +7 1205 (Cutter).
if (checkbound(1205, 2, 7)) {
mes "You have a +7 guild_bound Cutter.";
- close;
} else {
mes "You don't have the required item.";
- close;
}
+ close;
---------------------------------------
*getnameditem <item id>,<character name|character ID>;
@@ -5279,7 +5306,7 @@ like storage or cart.
---------------------------------------
*equip <item id>;
-*equip2 <item id>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
+*equip2 <item id>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
*autoequip <item id>,<option>;
These commands are to equip a equipment on the attached character.
diff --git a/src/map/script.c b/src/map/script.c
index 89bc74643..d8a2e297f 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13933,7 +13933,7 @@ BUILDIN(autoequip)
/*=======================================================
* Equip2
- * equip2 <item id>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
+ * equip2 <item id>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
*-------------------------------------------------------*/
BUILDIN(equip2)
{
@@ -13941,10 +13941,7 @@ BUILDIN(equip2)
struct item_data *item_data;
TBL_PC *sd;
- if ( script_hasdata(st,9) )
- sd = map->id2sd(script_getnum(st,9));
- else
- sd = script->rid2sd(st);
+ sd = script->rid2sd(st);
if ( sd == NULL ) {
script_pushint(st,0);
@@ -18687,7 +18684,7 @@ BUILDIN(countbound)
*------------------------------------------*/
BUILDIN(checkbound){
int i, nameid = script_getnum(st,2);
- int bound_type, ref, attr, c1, c2, c3, c4;
+ int bound_type = 0, ref, attr, c1, c2, c3, c4;
TBL_PC *sd;
sd = script->rid2sd(st);
@@ -18699,8 +18696,10 @@ BUILDIN(checkbound){
return false;
}
- bound_type = ( script_hasdata(st,3) ? script_getnum(st,3) : -1 );
- if( bound_type < -1 || bound_type > IBT_MAX ){
+ if (script_hasdata(st,3))
+ bound_type = script_getnum(st,3);
+
+ if( bound_type <= -1 || bound_type > IBT_MAX ){
ShowError("script_checkbound: Not a valid bind type! Type=%d\n", bound_type);
}
@@ -18711,7 +18710,7 @@ BUILDIN(checkbound){
( sd->status.inventory[i].card[1] == (script_hasdata(st,7)? (c2 = script_getnum(st,7)) : sd->status.inventory[i].card[1]) ) &&
( sd->status.inventory[i].card[2] == (script_hasdata(st,8)? (c3 = script_getnum(st,8)) : sd->status.inventory[i].card[2]) ) &&
( sd->status.inventory[i].card[3] == (script_hasdata(st,9)? (c4 = script_getnum(st,9)) : sd->status.inventory[i].card[3]) ) &&
- ( sd->status.inventory[i].bound > 0 && bound_type == -1 || sd->status.inventory[i].bound == bound_type )) );
+ ( sd->status.inventory[i].bound > 0 && !bound_type || sd->status.inventory[i].bound == bound_type )) );
if( i < MAX_INVENTORY ){
script_pushint(st, sd->status.inventory[i].bound);