Item link code

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

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

Item link code

Post by Lax » Fri Oct 31, 2003 2:26 pm

EQLib_Utilities.cpp

Code: Select all

VOID GetItemLink(PCONTENTS Item, PCHAR Buffer)
{
	char hash[256];
	DWORD haddr=(DWORD)&hash[0];
	__asm {
		push eax;
		push ecx;
		push haddr;
		mov ecx, Item;
		call [EQADDR_GETITEMLINKHASH];
		pop ecx;
		pop eax;
	};
	sprintf(Buffer,"%c0%s%s%c",0x12,hash,Item->Item->Name,0x12);
}
EQLib.h

Code: Select all

extern DWORD EQADDR_GETITEMLINKHASH;
.
.
.
extern VOID GetItemLink(PCONTENTS Item, PCHAR Buffer);
EQLib_Main.h

Code: Select all

DWORD EQADDR_GETITEMLINKHASH=0;
.
.
.
    GetPrivateProfileString("Function Locations","GetItemLinkHash","0",szBuffer,MAX_STRING,ClientINI);   EQADDR_GETITEMLINKHASH = (DWORD)strtoul(szBuffer,NULL,16);
Then anywhere that PCONTENTS->Item->Name is used in chat display, we can use the item link instead by doing this:

Code: Select all

char Link[256];
PCONTENTS something;
GetItemLink(something,Link);
sprintf(out,"Some item %s",Link);
WriteChatColor(out,USERCOLOR_DEFAULT); // or Chat(out)
Example in BankList:

Code: Select all

    WriteChatBuffer("Listing of Bank Inventory",USERCOLOR_DEFAULT);
    WriteChatBuffer("-------------------------",USERCOLOR_DEFAULT);
[color=red]	char Link[256];[/color]
    for (int a=0;a<18;a++) {
		pContainer=pCharInfo->Bank[a];
        if (pContainer) {
[color=red]			GetItemLink(pContainer,&Link[0]);
			sprintf(szTemp,"Slot %d: %dx %s (%s)",a,pContainer->StackCount ? pContainer->StackCount : 1,Link,pContainer->Item->LoreName);[/color]
            WriteChatBuffer(szTemp,USERCOLOR_DEFAULT);
            for (int b=0;b<10;b++) {
                if (pContainer->Contents[b]) {
[color=red]					GetItemLink(pContainer->Contents[b],&Link[0]);
                    sprintf(szTemp,"- Slot %d: %dx %s (%s)",b,pContainer->Contents[b]->StackCount ? pContainer->Contents[b]->StackCount : 1,Link,pContainer->Contents[b]->Item->LoreName);[/color]
                    WriteChatBuffer(szTemp,USERCOLOR_DEFAULT);
                }
            }
        }
    }
Oh.. yeah I like to see the stack count and item lore in the list, that's in there too. Just for example, I could see what VT shards are in the bank even though they all have the same name ;)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0