Sfoglia il codice sorgente

- 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

skotlex 18 anni fa
parent
commit
c848fd71d2

+ 7 - 0
Changelog-Trunk.txt

@@ -4,6 +4,13 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2007/02/01
+	* 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. [Skotlex]
 	* Updated the old vs6 files to latest, thanks to k3dt for contributing them
 	* Reorganized the vs6 project files (update will follow)
 	* Fixed an accidental change in r9758 (edit&continue) [ultramage]

+ 2 - 0
conf-tmpl/Changelog.txt

@@ -1,5 +1,7 @@
 Date	Added
 
+2007/02/01
+	* Improved a bit the description of the mvp item get time config settings.
 2007/01/29
 	* Collapsed config settings produce_item_name_input,
 	  produce_potion_name_input, making_arrow_name_input, holywater_name_input,

+ 3 - 3
conf-tmpl/battle/drops.conf

@@ -44,14 +44,14 @@ item_second_get_time: 1000
 // (Takes effect after the item_second_get_time elapses)
 item_third_get_time: 1000
 
-// Grace time during which only the person who did the most damage to a MVP can get the item? (in milliseconds) (Note 3)
+// Grace time to apply to MvP reward items when the Most Valuable Player can't get the prize item and it drops on the ground? (in milliseconds) (Note 3)
 mvp_item_first_get_time: 10000
 
-// Grace time during which only the first and second person who did the most damage to a MVP can get the item? (in milliseconds) (Note 3)
+// Grace time for the first and second MvP so they can get the item? (in milliseconds) (Note 3)
 // (Takes effect after mvp_item_first_get_time elapses)
 mvp_item_second_get_time: 10000
 
-// Grace time during which only the first, second and third person who did the most damage to a MVP can get the item  (Note 3)
+// Grace time for the first, second and third MvP so they can get the item? (in milliseconds) (Note 3)
 // (Takes effect after mvp_item_second_get_time elapses)
 mvp_item_third_get_time: 2000
 

+ 16 - 4
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;
 	}

+ 4 - 1
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;
 	}

+ 13 - 19
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;
-}
 
-/*==========================================
- * –¼‘O‚ÅŒŸ�õ—p
- *------------------------------------------
- */
-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)

+ 0 - 2
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]