summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c72
1 files changed, 55 insertions, 17 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 20fcdd79c..316e5a39b 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 false;
+ } 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,21 @@ ACMD(item)
return false;
}
+ if(!strcmpi(command+1,"itembound") && !(bound >= IBT_MIN && bound <= IBT_MAX) ) {
+ 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;
+ }
for (i = 0; i < number; i += get_count) {
// if not pet egg
@@ -1128,6 +1145,7 @@ ACMD(item)
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_id;
item_tmp.identify = 1;
+ item_tmp.bound = (unsigned char)bound;
if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
@@ -1140,21 +1158,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 +1188,12 @@ ACMD(item2)
if (number <= 0)
number = 1;
-
+
+ if( !strcmpi(command+1,"itembound2") && !(bound >= IBT_MIN && bound <= IBT_MAX) ) {
+ clif->message(fd, msg_txt(298)); // Invalid bound type
+ return false;
+ }
+
item_id = 0;
if ((item_data = itemdb->search_name(item_name)) != NULL ||
(item_data = itemdb->exists(atoi(item_name))) != NULL)
@@ -1175,9 +1204,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;
@@ -1197,10 +1231,12 @@ ACMD(item2)
item_tmp.identify = identify;
item_tmp.refine = refine;
item_tmp.attribute = attr;
+ item_tmp.bound = (unsigned char)bound;
item_tmp.card[0] = c1;
item_tmp.card[1] = c2;
item_tmp.card[2] = c3;
item_tmp.card[3] = c4;
+
if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
@@ -9334,6 +9370,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),