Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2010, 09:58 AM
Leere
Sarnak
 
Join Date: Sep 2008
Location: Home
Posts: 31
Default COMMITTED: Prices when buying stacks

Code:
zone\client_packet.cpp	(rev 1276)
@@ -4936,11 +4936,13 @@
 		}
 	}
 
+	int singleprice = 0;
 	if (RuleB(Merchant, UsePriceMod)){
-	mpo->price = (item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(tmp,false))*mp->quantity;
+		singleprice = (item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(tmp,false));
 	}
 	else
-		mpo->price = (item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate)*mp->quantity;
+		singleprice = (item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate);
+	mpo->price = singleprice*mp->quantity;
 	if(freeslotid == SLOT_INVALID || (mpo->price < 0 ) || !TakeMoneyFromPP(mpo->price))
 	{
 		safe_delete(outapp);
@@ -4976,7 +4978,7 @@
 		else {
 			// Update the charges/quantity in the merchant window
 			inst->SetCharges(new_charges);
-			inst->SetPrice(mpo->price);
+			inst->SetPrice(singleprice);
 			inst->SetMerchantSlot(mp->itemslot);
 			inst->SetMerchantCount(new_charges);

This addresses two issues. The first is how the client displays the wrong price for items from the temporary item list when not all of them were bought within one transaction. PEQ (link) has two reports of that issue.

The second issue is more of a side benefit of the first fix, it fixes the part where buying a stack of items leads to a price that is not equal to the displayed price times the quantity. (For example, buying a flask of water. Displayed price of 1 silver. Buying a stack of 20 them then leads to a price of 2g 3c, instead of the expected 2g.)
Reply With Quote
  #2  
Old 03-07-2010, 10:41 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

I saw the post on PEQ and put in a fix before I saw your post

I'll update it with your refinement to calculate the singleprice once (it did occur to me to do that, but I was being lazy and didn't realize it would fix the other issue you mention).
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:31 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3