FindItemCount doesnt seem to be working correctly.

A forum for reporting bugs NOT related to custom plugins.

Moderator: MacroQuest Developers

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Mon Dec 20, 2004 4:01 pm

I've got a working fix (I believe) which adds an offset and a new EQ_Items func, diffs have been sent to Amadeus. I'll include them here as well I suppose... line numbers may be a bit off cuz I had a few extra things in my copy :twisted:

EQClasses.cpp

Code: Select all

@@ -4377,6 +4377,9 @@
 #ifdef EQ_Item__IsSpecialNoDrop
 FUNCTION_AT_ADDRESS(bool  EQ_Item::IsSpecialNoDrop(void),EQ_Item__IsSpecialNoDrop);
 #endif
+#ifdef EQ_Item__IsStackable
+FUNCTION_AT_ADDRESS(bool  EQ_Item::IsStackable(void),EQ_Item__IsStackable);
+#endif
 #ifdef EQ_LoadingS__EQ_LoadingS
 FUNCTION_AT_ADDRESS( EQ_LoadingS::EQ_LoadingS(void),EQ_LoadingS__EQ_LoadingS);
 #endif

EQClasses.h

Code: Select all

@@ -5535,6 +5535,7 @@
 EQLIB_OBJECT int EQ_Item::Platinum(void);
 EQLIB_OBJECT int EQ_Item::Silver(void);
 EQLIB_OBJECT long EQ_Item::ValueSellMerchant(float,long);
+EQLIB_OBJECT bool EQ_Item::IsStackable(void); // Valerian 12-20-2004
 
 EQLIB_OBJECT char * EQ_Item::GetItemLinkHash(char *); // Lax 11-14-2003
 EQLIB_OBJECT int EQ_Item::CanDrop(int); // Lax 04-22-2004

eqgame.h

Code: Select all

@@ -328,6 +330,7 @@
 // EQ_Item 
 #define EQ_Item__GetItemLinkHash                           0x49BFB7 
 #define EQ_Item__CanDrop                                   0x49C3BE 
+#define EQ_Item__IsStackable                               0x49C562
 
 // CBankWnd 
 #define CBankWnd__GetNumBankSlots                          0x40B4DD 

MQ2Commands.cpp

Code: Select all

@@ -1261,7 +1261,7 @@
 				sprintf(szTmp,"%dSvC ",pCharInfo->Cursor->Item->SvCold);
                 strcat(szMsg,szTmp);
             }
-			if (pCharInfo->Cursor->Item->Stackable==1) {
+			if (((EQ_Item*)pCharInfo->Cursor)->IsStackable()==1) {
 				sprintf(szTmp,"Stack size = %d ",pCharInfo->Cursor->StackCount);
                 strcat(szMsg,szTmp);
             }

MQ2Data.cpp

Code: Select all

@@ -831,7 +831,7 @@
 				if (!stricmp(Name,pItem->Item->Name))
 				{
                     if ((pItem->Item->Type != ITEMTYPE_NORMAL) ||
-                        (pItem->Item->Stackable != 1))
+						(((EQ_Item*)pItem)->IsStackable() != 1))
 						Count++;
                     else
                         Count+=pItem->StackCount;
@@ -842,7 +842,7 @@
 				if(strstr(strlwr(strcpy(Temp,pItem->Item->Name)),Name))
 				{
                     if ((pItem->Item->Type != ITEMTYPE_NORMAL) ||
-                        (pItem->Item->Stackable != 1))
+						(((EQ_Item*)pItem)->IsStackable() != 1))
 						Count++;
                     else
                         Count+=pItem->StackCount;
@@ -866,7 +866,7 @@
 							if (!stricmp(Name,pItem->Item->Name))
 							{
                                 if ((pItem->Item->Type != ITEMTYPE_NORMAL) ||
-                                    (pItem->Item->Stackable != 1))
+                                    (((EQ_Item*)pItem)->IsStackable() != 1))
 								    Count++;
                                 else
                                     Count+=pItem->StackCount;
@@ -877,7 +877,7 @@
 							if(strstr(strlwr(strcpy(Temp,pItem->Item->Name)),Name))
 							{
                                 if ((pItem->Item->Type != ITEMTYPE_NORMAL) ||
-                                    (pItem->Item->Stackable != 1))
+                                    (((EQ_Item*)pItem)->IsStackable() != 1))
 								    Count++;
                                 else
                                     Count+=pItem->StackCount;
@@ -925,7 +925,7 @@
 				if (!stricmp(Name,pPack->Item->Name))
 				{
                     if ((pPack->Item->Type != ITEMTYPE_NORMAL) ||
-                        (pPack->Item->Stackable != 1))
+                        (((EQ_Item*)pPack)->IsStackable() != 1))
 						Count++;
                     else
                         Count+=pPack->StackCount;
@@ -936,7 +936,7 @@
 				if(strstr(strlwr(strcpy(Temp,pPack->Item->Name)),Name))
 				{
                     if ((pPack->Item->Type != ITEMTYPE_NORMAL) ||
-                        (pPack->Item->Stackable != 1))
+                        (((EQ_Item*)pPack)->IsStackable() != 1))
 						Count++;
                     else
                         Count+=pPack->StackCount;
@@ -953,7 +953,7 @@
 							if (!stricmp(Name,pItem->Item->Name))
 							{
                                 if ((pItem->Item->Type != ITEMTYPE_NORMAL) ||
-                                    (pItem->Item->Stackable != 1))
+                                    (((EQ_Item*)pItem)->IsStackable() != 1))
 								    Count++;
                                 else
                                     Count+=pItem->StackCount;
@@ -964,7 +964,7 @@
 							if(strstr(strlwr(strcpy(Temp,pItem->Item->Name)),Name))
 							{
                                 if ((pItem->Item->Type != ITEMTYPE_NORMAL) ||
-                                    (pItem->Item->Stackable != 1))
+                                    (((EQ_Item*)pItem)->IsStackable() != 1))
 								    Count++;
                                 else
                                     Count+=pItem->StackCount;

MQ2DataTypes.cpp

Code: Select all

@@ -2453,7 +2453,7 @@
 		Dest.Type=pIntType;
 		return true;
 	case Stack:
-		if ((pItem->Item->Type != ITEMTYPE_NORMAL) || (pItem->Item->Stackable!=1))
+		if ((pItem->Item->Type != ITEMTYPE_NORMAL) || (((EQ_Item*)pItem)->IsStackable()!=1))
 			Dest.DWord=1;
 		else
 			Dest.DWord=pItem->StackCount;
@@ -2541,7 +2541,7 @@
 		}
 		return false;
 	case Stackable:
-		Dest.DWord=pItem->Item->Stackable;
+		Dest.DWord=((EQ_Item*)pItem)->IsStackable();
 		Dest.Type=pBoolType;
 		return true;
 	case InvSlot:
I haven't tested EVERYTHING, so be aware that it may have some bugs.

Many many thanks to ksmith for the offset for that function :D
Last edited by Valerian on Thu Dec 23, 2004 10:36 am, edited 1 time in total.

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Mon Dec 20, 2004 4:39 pm

I'll integrate what's in this thread later this week and do some testing and we should have it fixed in its entirety soon.

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Tue Dec 21, 2004 1:51 pm

Tested all the functions changed by Valerians code above, all datatypes and functions working well with a wide array of items. I think the "Item->Type != ITEMTYPE_NORMAL" stuff is redundant now, as IsStackable() handles that case as well.

I'd go with ONLY Valerian's patch (ignore all the crap I did), and in ITEMINFO I'd get rid of that union altogether and just do something like

Code: Select all

/*0x204*/ DWORD MaxCharges;  // Also has something to do with item stacking
because it doesn't *quite* work like you'd expect an UnStackable flag to work. Val's changes cover all the places MQ2 itself used Stackable, and the only other place I've seen it is in hacks...they can damn well figure out their own check or use the function we kindly provide. ;)

ownagejoo
orc pawn
orc pawn
Posts: 26
Joined: Mon Jul 19, 2004 4:12 pm

Post by ownagejoo » Tue Dec 21, 2004 2:37 pm

Same here Crazy, tested this morning with latest patch and Val's code, Tradeskilling working fine again along with all other stuff

OAJ

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Tue Dec 21, 2004 4:02 pm

wow, glad to hear that I didn't fubar one of those changes, to be honest I only tested ${Cursor.Stackable} before posting the diffs :lol:

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Tue Dec 21, 2004 4:34 pm

Good...glad to see the testing, saves a lot of time :) ....I'll integrate all this sometime this week when I release another zip with quite a few user submitted things in it.

mq2user77
a hill giant
a hill giant
Posts: 160
Joined: Thu Dec 16, 2004 11:31 am
Contact:

Post by mq2user77 » Thu Dec 23, 2004 6:05 am

Valerian wrote:EQCommands.cpp
Just a quick pointer that this should be mq2commands.cpp as it's the only place I could find text that matched what you had under this section.

Please correct me if I'm wrong.

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Thu Dec 23, 2004 10:36 am

You're wrong. No, seriously, you're right about that, I guess I got stupid or something, original patch post edited

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Fri Dec 24, 2004 10:54 am

I've been testing Valerian's fix also. Works great for me. Good job man.

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Fri Dec 24, 2004 2:57 pm

Added to zip. Thanks.

dark2phoenix
a hill giant
a hill giant
Posts: 218
Joined: Wed Dec 22, 2004 9:42 am

Does this mean fixed in next release?

Post by dark2phoenix » Mon Dec 27, 2004 8:53 am

Amadeus wrote:Added to zip. Thanks.
New to MQ2. Does this mean that will be in the next release of MQ2 or that the Dec 19th release was repatched to include this fix? Is there a place to download BETA MQ2's?

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Mon Dec 27, 2004 11:07 am

It means it wil be in the next Zip, dated for whenever Ama puts it up.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]