- 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://svn.code.sf.net/p/rathena/svn/trunk@9767 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*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;
|
||||
if( strcmpi(item->jname,str)==0 )
|
||||
//Absolute priority to Aegis code name.
|
||||
if (*dst != NULL) return 0;
|
||||
if( strcmpi(item->name,str)==0 )
|
||||
*dst=item;
|
||||
|
||||
//Second priority to Client displayed name.
|
||||
if (*dst2 != NULL) return 0;
|
||||
if( strcmpi(item->jname,str)==0 )
|
||||
*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)
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user