diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-04-27 11:06:55 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-04-27 11:06:55 +0000 |
commit | af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8 (patch) | |
tree | 45c74210524f6069f3cb6750744cb59af5031c30 /src/map/pc.c | |
parent | 8dedf18e168afd90230af1997edb593431b36e03 (diff) | |
download | hercules-af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8.tar.gz hercules-af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8.tar.bz2 hercules-af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8.tar.xz hercules-af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8.zip |
Cleaning up the itemdb reload mess (see r12635, r12643, r12650, r12661, r12662, r12663)
* the player data inventory-itemdb index is now refreshed using pc_setinventorydata()
* mobdb will no longer initialize with nonexistent items, and mobs will no longer drop them in case of a reload
* the clif_buylist() function once again hides invalid npc shop items
* it is no longer possible to purchase nonexistent items from a npc shop
* npc shop loading will not abort if there is a nonexistent item entry, it will just skip over it
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12665 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 7d268a0f5..0557708cb 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2965,12 +2965,11 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type) { nullpo_retr(1, sd); - if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || (sd->inventory_data[n] == NULL && ~type&4)) + if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL) return 1; sd->status.inventory[n].amount -= amount; - if(~type&4) - sd->weight -= sd->inventory_data[n]->weight*amount ; + sd->weight -= sd->inventory_data[n]->weight*amount ; if(sd->status.inventory[n].amount<=0){ if(sd->status.inventory[n].equip) pc_unequipitem(sd,n,3); @@ -3458,7 +3457,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv) // Try dropping one item, in the order from first to last possible slot. // Droprate is affected by the skill success rate. for( i = 0; i < MAX_STEAL_DROP; i++ ) - if( md->db->dropitem[i].nameid > 0 && rand() % 10000 < md->db->dropitem[i].p * rate/100. ) + if( md->db->dropitem[i].nameid > 0 && itemdb_exists(md->db->dropitem[i].nameid) && rand() % 10000 < md->db->dropitem[i].p * rate/100. ) break; if( i == MAX_STEAL_DROP ) return 0; |