diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-10-15 23:26:28 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-10-15 23:26:28 +0000 |
commit | 15052c64e803d612f44854358727e67e567e6415 (patch) | |
tree | 072aa79cf5831a85580ea38ef941d1d758aecbec /src/map/itemdb.c | |
parent | 553899621efd63495753b80e046a78a409d3eec7 (diff) | |
download | hercules-15052c64e803d612f44854358727e67e567e6415.tar.gz hercules-15052c64e803d612f44854358727e67e567e6415.tar.bz2 hercules-15052c64e803d612f44854358727e67e567e6415.tar.xz hercules-15052c64e803d612f44854358727e67e567e6415.zip |
- 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
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 27 |
1 files changed, 22 insertions, 5 deletions
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]); |