fixed again

vending, trade....

git-svn-id: https://svn.code.sf.net/p/rathena/svn/athena@301 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
Lupus 2004-11-21 19:58:41 +00:00
parent a6379d05f6
commit fa8e5002f7
3 changed files with 59 additions and 63 deletions

View File

@ -1,5 +1,6 @@
Date Added
11/21
* Re-Fixed Trade/Vending exploit [Lupus]
* Fixed @whozeny. [Valaris]
* Added rest of mapflags to const.txt. [Valaris]
* Closed AFM files after reading, this fixed the improper char-server session #. [Valaris]

View File

@ -96,10 +96,12 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount)
sd->deal_zeny = amount;
clif_tradeadditem(sd, target_sd, 0, amount);
} else {
if (amount != 0) {
trade_tradecancel(sd);
return;
}
}
}
} else if (amount > 0 && amount <= sd->status.inventory[index-2].amount) {
for(trade_i = 0; trade_i < 10; trade_i++) {
if (sd->deal_item_amount[trade_i] == 0) {
@ -128,7 +130,6 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount)
}
}
/*==========================================
* (ok押し)
*------------------------------------------

View File

@ -65,9 +65,9 @@ void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned cha
for(i = 0, w = z = 0; 8 + 4 * i < len; i++) {
amount = *(short*)(p + 4 * i);
index = *(short*)(p + 2 + 4 * i) - 2;
/*
if(amount < 0) return; //add
for(j=0;j<vsd->vend_num;j++)
if (amount < 0) return; // exploit
/* for(j = 0; j < vsd->vend_num; j++)
if (0 < vsd->vending[j].amount && amount <= vsd->vending[j].amount && vsd->vending[j].index == index)
break;
*/
@ -117,14 +117,8 @@ void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned cha
for(i = 0; 8 + 4 * i < len; i++) {
amount = *(short*)(p + 4 *i);
index = *(short*)(p + 2 + 4 * i) - 2;
if(amount < 0) break; //add
//if (amount < 0) break; // tested at start of the function
pc_additem(sd,&vsd->status.cart[index],amount);
#ifndef TXT_ONLY
if(log_config.vend > 0)
log_vend(vsd,sd,index,amount,z);
#endif
vsd->vending[vend_list[i]].amount -= amount;
pc_cart_delitem(vsd, index, amount, 0);
clif_vendingreport(vsd, index, amount);