Explorar el Código

* Fixed items, that get dropped at 100% chance, being reported in @iteminfo as 'available in the shops only' (since/replaces r3482).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14627 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei hace 14 años
padre
commit
226fa32b4c
Se han modificado 7 ficheros con 12 adiciones y 11 borrados
  1. 1 0
      Changelog-Trunk.txt
  2. 3 3
      src/map/atcommand.c
  3. 1 1
      src/map/itemdb.h
  4. 1 1
      src/map/log.c
  5. 2 2
      src/map/mob.c
  6. 2 2
      src/map/npc.c
  7. 2 2
      src/map/script.c

+ 1 - 0
Changelog-Trunk.txt

@@ -1,6 +1,7 @@
 Date	Added
 
 2010/12/26
+	* Fixed items, that get dropped at 100% chance, being reported in @iteminfo as 'available in the shops only' (since/replaces r3482). [Ai4rei]
 	* Updated commands @delitem/#delitem. [Ai4rei]
 	- No longer deletes stackable items one by one (bugreport:1914).
 	- Fixed pets not getting deleted when a pet egg was deleted.

+ 3 - 3
src/map/atcommand.c

@@ -7432,12 +7432,12 @@ ACMD_FUNC(iteminfo)
 		sprintf(atcmd_output, "NPC Buy:%dz, Sell:%dz | Weight: %.1f ", item_data->value_buy, item_data->value_sell, item_data->weight/10. );
 		clif_displaymessage(fd, atcmd_output);
 
-		if (item_data->maxchance == 10000)
-			strcpy(atcmd_output, " - Available in the shops only");
+		if (item_data->maxchance == -1)
+			strcpy(atcmd_output, " - Available in the shops only.");
 		else if (item_data->maxchance)
 			sprintf(atcmd_output, " - Maximal monsters drop chance: %02.02f%%", (float)item_data->maxchance / 100 );
 		else
-			strcpy(atcmd_output, " - Monsters don't drop this item");
+			strcpy(atcmd_output, " - Monsters don't drop this item.");
 		clif_displaymessage(fd, atcmd_output);
 
 	}

+ 1 - 1
src/map/itemdb.h

@@ -45,7 +45,7 @@ struct item_data {
 	int value_buy;
 	int value_sell;
 	int type;
-	int maxchance; //For logs, for external game info, for scripts: Max drop chance of this item (e.g. 0.01% , etc.. if it = 0, then monsters don't drop it) [Lupus]
+	int maxchance; //For logs, for external game info, for scripts: Max drop chance of this item (e.g. 0.01% , etc.. if it = 0, then monsters don't drop it, -1 denotes items sold in shops only) [Lupus]
 	int sex;
 	int equip;
 	int weight;

+ 1 - 1
src/map/log.c

@@ -52,7 +52,7 @@ int should_log_item(int filter, int nameid, int amount)
 		(filter&128 && (item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) ) ||
 		(filter&256 && item_data->value_buy >= log_config.price_items_log ) ||		//expensive items
 		(filter&512 && abs(amount) >= log_config.amount_items_log ) ||			//big amount of items
-		(filter&2048 && ((item_data->maxchance <= log_config.rare_items_log) || item_data->nameid == 714) ) //Rare items or Emperium
+		(filter&2048 && ((item_data->maxchance != -1 && item_data->maxchance <= log_config.rare_items_log) || item_data->nameid == 714) ) //Rare items or Emperium
 	) return item_data->nameid;
 
 	return 0;

+ 2 - 2
src/map/mob.c

@@ -3556,7 +3556,7 @@ static bool mob_parse_dbrow(char** str)
 		//calculate and store Max available drop chance of the MVP item
 		if (db->mvpitem[i].p) {
 			id = itemdb_search(db->mvpitem[i].nameid);
-			if (id->maxchance == 10000 || (id->maxchance < db->mvpitem[i].p/10 + 1) ) {
+			if (id->maxchance == -1 || (id->maxchance < db->mvpitem[i].p/10 + 1) ) {
 				//item has bigger drop chance or sold in shops
 				id->maxchance = db->mvpitem[i].p/10 + 1; //reduce MVP drop info to not spoil common drop rate
 			}
@@ -3618,7 +3618,7 @@ static bool mob_parse_dbrow(char** str)
 		if( db->dropitem[i].p && (class_ < 1324 || class_ > 1363) && (class_ < 1938 || class_ > 1946) )
 		{ //Skip treasure chests.
 			id = itemdb_search(db->dropitem[i].nameid);
-			if (id->maxchance == 10000 || (id->maxchance < db->dropitem[i].p) ) {
+			if (id->maxchance == -1 || (id->maxchance < db->dropitem[i].p) ) {
 				id->maxchance = db->dropitem[i].p; //item has bigger drop chance or sold in shops
 			}
 			for (k = 0; k< MAX_SEARCH; k++) {

+ 2 - 2
src/map/npc.c

@@ -1939,8 +1939,8 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 				id->name, nameid, value, (int)(value*0.75), id->value_sell, (int)(id->value_sell*1.24), filepath, strline(buffer,start-buffer));
 		}
 		//for logs filters, atcommands and iteminfo script command
-		if( id->maxchance <= 0 )
-			id->maxchance = 10000; //10000 (100% drop chance)would show that the item's sold in NPC Shop
+		if( id->maxchance == 0 )
+			id->maxchance = -1; // -1 would show that the item's sold in NPC Shop
 
 		items[i].nameid = nameid;
 		items[i].value = value;

+ 2 - 2
src/map/script.c

@@ -10655,7 +10655,7 @@ BUILDIN_FUNC(getitemslots)
 		2 type;
 		3 maxchance = Max drop chance of this item e.g. 1 = 0.01% , etc..
 				if = 0, then monsters don't drop it at all (rare or a quest item)
-				if = 10000, then this item is sold in NPC shops only
+				if = -1, then this item is sold in NPC shops only
 		4 sex;
 		5 equip;
 		6 weight;
@@ -10695,7 +10695,7 @@ BUILDIN_FUNC(getiteminfo)
 		2 type;
 		3 maxchance = Max drop chance of this item e.g. 1 = 0.01% , etc..
 				if = 0, then monsters don't drop it at all (rare or a quest item)
-				if = 10000, then this item is sold in NPC shops only
+				if = -1, then this item is sold in NPC shops only
 		4 sex;
 		5 equip;
 		6 weight;