diff options
author | shennetsind <ind@henn.et> | 2013-11-06 22:40:57 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-11-06 22:40:57 -0200 |
commit | b1f7e524a79ce3e7afd64becaa7657c71d59f18f (patch) | |
tree | 3d0f808a23cb1ead6cc0811542ac4263643203dc /src/map/atcommand.c | |
parent | 47401a4195c58e14f12200f1ba6aeb34ecd87df7 (diff) | |
parent | 6be40f56a21e48505baa4ff69acc198aa6206bf1 (diff) | |
download | hercules-b1f7e524a79ce3e7afd64becaa7657c71d59f18f.tar.gz hercules-b1f7e524a79ce3e7afd64becaa7657c71d59f18f.tar.bz2 hercules-b1f7e524a79ce3e7afd64becaa7657c71d59f18f.tar.xz hercules-b1f7e524a79ce3e7afd64becaa7657c71d59f18f.zip |
Merge remote-tracking branch 'origin/master'
Signed-off-by: shennetsind <ind@henn.et>
Conflicts:
conf/messages.conf
src/common/mmo.h
src/map/pc_groups.c
src/map/pc_groups.h
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 78 |
1 files changed, 61 insertions, 17 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 20fcdd79c..3f3e9679e 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1087,22 +1087,29 @@ ACMD(heal) /*========================================== * @item command (usage: @item <name/id_of_item> <quantity>) (modified by [Yor] for pet_egg) + * @itembound command (usage: @itembound <name/id_of_item> <quantity> <bound type>) (revised by [Mhalicot]) *------------------------------------------*/ ACMD(item) { char item_name[100]; - int number = 0, item_id, flag = 0; + int number = 0, item_id, flag = 0, bound = 0; struct item item_tmp; struct item_data *item_data; int get_count, i; 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->message(fd, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>). + + 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 + ))) { + clif->message(fd, msg_txt(295)); // Please enter an item name or ID (usage: @itembound <item name/ID> <quantity> <bound_type>). + return -1; + } else if (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 && + sscanf(message, "%99s %d", item_name, &number) < 1 )) + { + clif->message(fd, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>). return false; } @@ -1116,11 +1123,24 @@ ACMD(item) return false; } + if( bound < 0 || bound > 4 ) { + clif->message(fd, msg_txt(298)); // Invalid bound type + return false; + } + item_id = item_data->nameid; get_count = number; //Check if it's stackable. - if (!itemdb->isstackable2(item_data)) - get_count = 1; + if (!itemdb->isstackable2(item_data)) { + if( bound && (item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) ) { + clif->message(fd, msg_txt(498)); // Cannot create bounded pet eggs or pet armors. + return false; + } + get_count = 1; + } else if( bound ) { + clif->message(fd, msg_txt(499)); // Cannot create bounded stackable items. + return false; + } for (i = 0; i < number; i += get_count) { // if not pet egg @@ -1128,6 +1148,7 @@ ACMD(item) 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); @@ -1140,21 +1161,27 @@ ACMD(item) } /*========================================== - * + * @item2 and @itembound2 command (revised by [Mhalicot]) *------------------------------------------*/ ACMD(item2) { struct item item_tmp; struct item_data *item_data; char item_name[100]; - int item_id, number = 0; + int item_id, number = 0, bound = 0; int identify = 0, refine = 0, attr = 0; int c1 = 0, c2 = 0, c3 = 0, c4 = 0; memset(item_name, '\0', sizeof(item_name)); - if (!message || !*message || ( - sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 && + if (!strcmpi(command+1,"itembound2") && (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 && + sscanf(message, "%99s %d %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 ))) { + clif->message(fd, msg_txt(296)); // Please enter all parameters (usage: @itembound2 <item name/ID> <quantity> + clif->message(fd, msg_txt(297)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4> <bound_type>). + return false; + } else if ( !message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 && sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 )) { clif->message(fd, msg_txt(984)); // Please enter all parameters (usage: @item2 <item name/ID> <quantity> @@ -1164,7 +1191,12 @@ ACMD(item2) if (number <= 0) number = 1; - + + if( bound < 0 || bound > 4 ) { + clif->message(fd, msg_txt(298)); // Invalid bound type + return -1; + } + item_id = 0; if ((item_data = itemdb->search_name(item_name)) != NULL || (item_data = itemdb->exists(atoi(item_name))) != NULL) @@ -1175,9 +1207,14 @@ ACMD(item2) int loop, get_count, i; loop = 1; get_count = number; - if (item_data->type == IT_WEAPON || item_data->type == IT_ARMOR || - item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) { - loop = number; + if( !strcmpi(command+1,"itembound2") ) + bound = 1; + if( !itemdb->isstackable2(item_data) ) { + if( bound && (item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) ) { + clif->message(fd, msg_txt(498)); // Cannot create bounded pet eggs or pet armors. + return false; + } + loop = number; get_count = 1; if (item_data->type == IT_PETEGG) { identify = 1; @@ -1188,6 +1225,10 @@ ACMD(item2) if (refine > MAX_REFINE) refine = MAX_REFINE; } else { + if( bound ) { + clif->message(fd, msg_txt(499)); // Cannot create bounded stackable items. + return false; + } identify = 1; refine = attr = 0; } @@ -1201,6 +1242,7 @@ ACMD(item2) item_tmp.card[1] = c2; item_tmp.card[2] = c3; item_tmp.card[3] = c4; + item_tmp.bound = bound; if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND))) clif->additem(sd, 0, 0, flag); } @@ -9334,6 +9376,8 @@ void atcommand_basecommands(void) { ACMD_DEF(heal), ACMD_DEF(item), ACMD_DEF(item2), + ACMD_DEF2("itembound", item), + ACMD_DEF2("itembound2", item2), ACMD_DEF(itemreset), ACMD_DEF(clearstorage), ACMD_DEF(cleargstorage), |