diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-02-01 21:04:46 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-02-01 21:04:46 +0000 |
commit | 5de3852d0e203ad08e4bdd748a49f8dba2e028c2 (patch) | |
tree | e4a1fce223b40e891fc5395c749d47b4de1fcd41 /src | |
parent | ca0aa0f7e55896730f6470a7dec81e6293b305ff (diff) | |
download | hercules-5de3852d0e203ad08e4bdd748a49f8dba2e028c2.tar.gz hercules-5de3852d0e203ad08e4bdd748a49f8dba2e028c2.tar.bz2 hercules-5de3852d0e203ad08e4bdd748a49f8dba2e028c2.tar.xz hercules-5de3852d0e203ad08e4bdd748a49f8dba2e028c2.zip |
- Item search is now a bit smarter. When no item is found with the same 'aegis name', then the 'normal' name is used instead.
- Updated the @/# commands that take an item name so that you can use quotes when specifying item names with spaces in them. For example, @item "poring card" 1 will work now. Note that only the commands that work on ONE item have been updated, those that do an item list need to be updated as well.
- Removed some garbage from the item_data structure.
- Improved a bit the description of the mvp item get time config settings.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9767 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 20 | ||||
-rw-r--r-- | src/map/charcommand.c | 5 | ||||
-rw-r--r-- | src/map/itemdb.c | 32 | ||||
-rw-r--r-- | src/map/itemdb.h | 2 |
4 files changed, 33 insertions, 26 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 0c4809b3a..d11b898e8 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2549,7 +2549,10 @@ int atcommand_item(const int fd, struct map_session_data* sd, const char* comman memset(item_name, '\0', sizeof(item_name)); - if (!message || !*message || sscanf(message, "%99s %d", item_name, &number) < 1) { + if (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 && + sscanf(message, "%99s %d", item_name, &number) < 1 + )) { clif_displaymessage(fd, "Please, enter an item name/id (usage: @item <item name or ID> [quantity])."); return -1; } @@ -2608,7 +2611,10 @@ int atcommand_item2(const int fd, struct map_session_data* sd, const char* comma memset(item_name, '\0', sizeof(item_name)); - if (!message || !*message || sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9) { + 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_displaymessage(fd, "Please, enter all informations (usage: @item2 <item name or ID> <quantity>"); clif_displaymessage(fd, " <Identify_flag> <refine> <attribut> <Card1> <Card2> <Card3> <Card4>)."); return -1; @@ -3752,7 +3758,10 @@ int atcommand_produce(const int fd, struct map_session_data* sd, const char* com memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(item_name, '\0', sizeof(item_name)); - if (!message || !*message || sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1) { + if (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d %d", item_name, &attribute, &star) < 1 && + sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1 + )) { clif_displaymessage(fd, "Please, enter at least an item name/id (usage: @produce <equip name or equip ID> <element> <# of very's>)."); return -1; } @@ -6125,7 +6134,10 @@ int atcommand_chardelitem(const int fd, struct map_session_data* sd, const char* memset(item_name, '\0', sizeof(item_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - if (!message || !*message || sscanf(message, "%s %d %99[^\n]", item_name, &number, atcmd_player_name) < 3 || number < 1) { + if (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d %99[^\n]", item_name, &number, atcmd_player_name) < 3 && + sscanf(message, "%s %d %99[^\n]", item_name, &number, atcmd_player_name) < 3 + ) || number < 1) { clif_displaymessage(fd, "Please, enter an item name/id, a quantity and a player name (usage: @chardelitem <item_name_or_ID> <quantity> <player>)."); return -1; } diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 2c6942c4e..27a80a986 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -1043,7 +1043,10 @@ int charcommand_item( memset(item_name, '\0', sizeof(item_name)); - if (!message || !*message || sscanf(message, "%99s %d %23[^\n]", item_name, &number, character) < 3) { + if (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d %23[^\n]", item_name, &number, character) < 3 && + sscanf(message, "%99s %d %23[^\n]", item_name, &number, character) < 3 + )) { clif_displaymessage(fd, "Please, enter an item name/id (usage: #item <item name or ID> <quantity> <char name>)."); return -1; } diff --git a/src/map/itemdb.c b/src/map/itemdb.c index c2c98f42b..f39e3d809 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -28,29 +28,22 @@ struct item_data dummy_item; //This is the default dummy item used for non-exist // name = item alias, so we should find items aliases first. if not found then look for "jname" (full name) int itemdb_searchname_sub(DBKey key,void *data,va_list ap) { - struct item_data *item=(struct item_data *)data,**dst; + struct item_data *item=(struct item_data *)data,**dst,**dst2; char *str; str=va_arg(ap,char *); dst=va_arg(ap,struct item_data **); + dst2=va_arg(ap,struct item_data **); if(item == &dummy_item) return 0; - if( strcmpi(item->name,str)==0 ) //by lupus + + //Absolute priority to Aegis code name. + if (*dst != NULL) return 0; + if( strcmpi(item->name,str)==0 ) *dst=item; - return 0; -} -/*========================================== - * 名前で検索用 - *------------------------------------------ - */ -int itemdb_searchjname_sub(int key,void *data,va_list ap) -{ - struct item_data *item=(struct item_data *)data,**dst; - char *str; - str=va_arg(ap,char *); - dst=va_arg(ap,struct item_data **); - if(item == &dummy_item) return 0; + //Second priority to Client displayed name. + if (*dst2 != NULL) return 0; if( strcmpi(item->jname,str)==0 ) - *dst=item; + *dst2=item; return 0; } @@ -60,9 +53,10 @@ int itemdb_searchjname_sub(int key,void *data,va_list ap) */ struct item_data* itemdb_searchname(const char *str) { - struct item_data *item=NULL; - item_db->foreach(item_db,itemdb_searchname_sub,str,&item); - return item; + struct item_data *item=NULL, *item2=NULL; + + item_db->foreach(item_db,itemdb_searchname_sub,str,&item,&item2); + return item?item:item2; } static int itemdb_searchname_array_sub(DBKey key,void * data,va_list ap) diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 85a0cdb21..0b9e2a466 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -36,7 +36,6 @@ enum { struct item_data { int nameid; char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH]; - char prefix[NAME_LENGTH],suffix[NAME_LENGTH]; //Do not add stuff between value_buy and wlv (see how getiteminfo works) int value_buy; int value_sell; @@ -68,7 +67,6 @@ struct item_data { unsigned value_notdc : 1; unsigned value_notoc : 1; short no_equip; - unsigned no_use : 1; unsigned no_refine : 1; // [celest] unsigned delay_consume : 1; // Signifies items that are not consumed inmediately upon double-click [Skotlex] unsigned trade_restriction : 7; //Item restrictions mask [Skotlex] |