From 15052c64e803d612f44854358727e67e567e6415 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 15 Oct 2007 23:26:28 +0000 Subject: - fixed Halo-Halo not being consumed on use. - Updated the item price/sell reading code to enable 'null' values. The difference between a blank value and 0 is that when the value is blank, it should automatically take half/double the other value. The previous behaviour did this automatically and didn't let you specify, for example, if you wanted a given item to sell for 0. - Also added a warning when an item in the db has an exploitable price (through overcharge/discount). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11482 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/itemdb.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/map/itemdb.c') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 9d533ad70..46caca0da 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -728,11 +728,28 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr } else //In case of an itemdb reload and the item type changed. id->flag.delay_consume = 0; - id->value_buy = atoi(str[4]); - id->value_sell = atoi(str[5]); - if (id->value_buy < id->value_sell * 2) id->value_buy = id->value_sell * 2; // prevent exploit - if (id->value_buy == 0 && id->value_sell > 0) id->value_buy = id->value_sell * 2; - if (id->value_sell == 0 && id->value_buy > 0) id->value_sell = id->value_buy / 2; + //When a particular price is not given, we should base it off the other one + //(it is important to make a distinction between 'no price' and 0z) + if ( str[4][0] ) + id->value_buy = atoi(str[4]); + else + id->value_buy = atoi(str[5]) * 2; + + if ( str[5][0] ) + id->value_sell = atoi(str[5]); + else + id->value_sell = id->value_buy / 2; + /* + if ( !str[4][0] && !str[5][0]) + { + ShowWarning("itemdb_parse_dbrow: No buying/selling price defined for item %d (%s), using 20/10z\n", nameid, id->jname); + id->value_buy = 20; + id->value_sell = 10; + } else + */ + if (id->value_buy/124. < id->value_sell/75.) + ShowWarning("itemdb_parse_dbrow: Buying/Selling [%d/%d] price of item %d (%s) allows Zeny making exploit through buying/selling at discounted/overcharged prices!\n", + id->value_buy, id->value_sell, nameid, id->jname); id->weight = atoi(str[6]); id->atk = atoi(str[7]); -- cgit v1.2.3-70-g09d2