${Merchant.Item[n].BuyPrice} Can be wrong sometimes

A forum for reporting bugs NOT related to custom plugins.

Moderator: MacroQuest Developers

mpmq
a lesser mummy
a lesser mummy
Posts: 30
Joined: Thu Mar 18, 2004 8:07 pm

${Merchant.Item[n].BuyPrice} Can be wrong sometimes

Post by mpmq » Thu May 13, 2004 7:00 am

When checking prices on merchant items, ${Merchant.Item[n].BuyPrice} will return the wrong price in some cases. I seem to recall something about a sellrate factor, and maybe only the merchant knows what that is.

Examples of items that will return the wrong result are Fine Steel weapons. They usually have a Merchant.Item[n].Value of around 5pp or so, but the vendor sells them for around 50pp or so.

The Price member in the _CONTENTS struct seems to return the correct value.

Suggested fix in MQ2DataTypes.cpp, change:

Code: Select all

       case BuyPrice:
                if (pActiveMerchant)
                {
                        [color=yellow]Dest.DWord=(DWORD)((FLOAT)pItem->Item->Cost*((PEQMERCHWINDOW)pMerchantWnd)->Markup);[/color]
                        Dest.Type=pIntType;
                        return true;
                }
                return false;
        case SellPrice:
To:


Code: Select all

        case BuyPrice:
                if (pActiveMerchant)
                {
                        [color=red]Dest.DWord=(DWORD)((FLOAT)pItem->Price);[/color]
                        Dest.Type=pIntType;
                        return true;
                }
                return false;
        case SellPrice:


(sorry in advance if the tabbing got hosed up in the code blocks_

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Thu May 13, 2004 12:39 pm

ahh, good catch thanks
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

JWWQ
a lesser mummy
a lesser mummy
Posts: 30
Joined: Sat Jun 19, 2004 4:58 pm

Lax

Post by JWWQ » Sat Jul 10, 2004 4:26 am

Could you tell me if this ever got repaired?

I have poured over the release notes and recompiled latest.

BuyPrice is still unreliable. I am hoping to add some macros to the Macro Depot which will allow quick-shopping with ini support.

Please let me know if there is something I can fix in my .dll pre-compile or post-compile to get Merchant.Item[n].BuyPrice running correctly.

Thanks and Thanks again...I spend more time playing with MQ2 than I do playing EQ. =)

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Post by ieatacid » Sat Jul 10, 2004 11:08 am

It works with the newest _CONTENTS struct at the bottom of this thread: http://macroquest2.com/phpBB2/viewtopic.php?t=8098

JWWQ
a lesser mummy
a lesser mummy
Posts: 30
Joined: Sat Jun 19, 2004 4:58 pm

Humor my incompetence

Post by JWWQ » Sat Jul 10, 2004 2:46 pm

ieatacid,

first, Thanks for your post and your link. I reviewed the post and without knowing much about how structs work, managed to find my EQUIstructs file in MQ2main.

I simply inserted your suggested code into the code and saved....like so

Code: Select all

} EQINVSLOT, *PEQINVSLOT;

// actual size 0x100C 2-18-2004 Lax
typedef struct _EQINVSLOTMGR {
/*0x0000*/	DWORD Unknown0x0000;
/*0x0004*/	struct _EQINVSLOT *SlotArray[0x400];
/*0x1004*/	DWORD TotalSlots;
/*0x1008*/	DWORD Unknown0x1008;
/*0x100C*/
} EQINVSLOTMGR, *PEQINVSLOTMGR;

//==============================================[ added code ]=========
typedef struct _CONTENTS { 
/*0x00*/ struct _ITEMINFO *Item; 
   union { 
/*0x04*/ struct _CONTENTS *Contents[0x0a]; //addresses to whats inside the bag if its a bag 
/*0x04*/ struct _ITEMINFO *Augments[0x0a]; //Only 1-5 are actually used (for now) 
   }; 
/*0x2c*/  DWORD   StackCount; 
/*0x30*/  BYTE    Unknown0x30[0xc]; 
/*0x3c*/  DWORD   Charges; 
/*0x40*/  DWORD   ItemSlot;// slotid for Player Items 
/*0x44*/  BYTE    Unknown0x44[0x4]; 
/*0x48*/  DWORD   ItemSlot2;// slotid for Merchant Items 
/*0x4c*/  DWORD   Unknown0x4c; 
/*0x50*/  DWORD   Price; //price a player vendor set the item at 
/*0x54*/  DWORD   Open; 
/*0x58*/ 
} CONTENTS, *PCONTENTS: 
//==============================================[ end added code ]=======

// onetimehero 09-17-03
// ContainerWindow
// Actual Size 0x17C old
typedef struct _EQCONTAINERWINDOW {
/*0x000*/ struct _CSIDLWND Wnd;
/*0x148*/ struct _CONTENTS*   pContents;     // Pointer to the contents of the container;
                                                 // Matches the pointer in CHARINFO.Inventory/Bank/World
/*0x14c*/ struct _CSIDLWND*   pSlots[0x0a];
/*0x000*/ struct _CSIDLWND*   pCombine;
/*0x168*/ struct _CSIDLWND*   pDone;
/*0x16c*/ struct _CSIDLWND*   pIcon;
/*0x170*/ struct _CSIDLWND*   pUnknown;
/*0x174*/ struct _CSIDLWND*   pLabel;
/*0x178*/ BYTE Unknown0x178[4];
/*0x17c*/
} EQCONTAINERWINDOW, *PEQCONTAINERWINDOW;

// Actual Size 0x78  old
typedef struct _EQ_CONTAINERWND_MANAGER {
/*0x000*/   DWORD pvfTable; // NOT based on CXWnd.  Contains only destructor
/*0x004*/   PEQCONTAINERWINDOW pPCContainers[0x1a];  // All open containers, including World, in order of opening...
/*0x06c*/   PCONTENTS   pWorldContents;            // Pointer to the contents of the world   If NULL, world container isn't open;
/*0x070*/   DWORD dwWorldContainerID;            // ID of container in zone, starts at one (zero?) and goes up.
/*0x074*/   DWORD dwTimeSpentWithWorldContainerOpen;  // Cumulative counter?
/*0x078*/
} EQ_CONTAINERWND_MANAGER, *PEQ_CONTAINERWND_MANAGER;
After readint this original post, I also managed to locate my MQ2DataTypes.cpp file and insert/'fix' the suggested code like so:

Code: Select all

case InvSlot:
		Dest.Int=FindInvSlotForContents(pItem);
		if (Dest.Int>=0)
		{
			Dest.Type=pInvSlotType;
			return true;
		}
		return false;
	
//==============================================[ begin code change ]========
case BuyPrice:
		if (pActiveMerchant)
		{
			Dest.DWord=(DWORD)((FLOAT)pItem->Price); 
			Dest.Type=pIntType;
			return true;
		}
		return false;

//==============================================[ end code change ]=========

	case SellPrice:
		if (pActiveMerchant)
		{
			Dest.DWord=(DWORD)((FLOAT)pItem->Item->Cost*(1.0f/((PEQMERCHWINDOW)pMerchantWnd)->Markup));
			Dest.Type=pIntType;
			return true;
		}
		return false;
What am I doing wrong? I reloaded and reran EQ and MQ2, but somehow, I didn't think that was going to do anything. (It didn't)

A little more coaching would be awesome!

Thanks for your infinite patience.

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Post by ieatacid » Sat Jul 10, 2004 3:31 pm

The contents struct is in EQData.h. Just paste it right over the one that's already in there.

You shouldn't have had to change anything in MQ2DataTypes.cpp

Clean MQ2Main, build MQ2Main, done.

JWWQ
a lesser mummy
a lesser mummy
Posts: 30
Joined: Sat Jun 19, 2004 4:58 pm

YES YES YES!

Post by JWWQ » Sun Jul 11, 2004 1:58 am

THANK YOU
THANK YOU
THANK YOU!!!!