• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

MQ2MapItemTarget

vladus2000

Active member
Joined
Dec 1, 2006
RedCents
131¢
This plugin emulates a /itemtarget when you right click a ground spawn on the map. I noticed a few people were having issues with the Library Heist mission and /itemtarget, so I wrote this. Its pretty simple, I imagine its been done before, but here is my version.

Rich (BB code):
#include "../MQ2Plugin.h"

PreSetup("MQ2MapItemTarget");

PLUGIN_API VOID OnPulse(VOID)
{
	if( gGameState != GAMESTATE_INGAME )
	{
		return;
	}

	if ( ( pGroundTarget == NULL && EnviroTarget.Name[ 0 ] ) ||
		( pGroundTarget && EnviroTarget.Name[ 0 ] && pGroundTarget->DropID != EnviroTarget.Race ) )
	{
		PGROUNDITEM pItem = (PGROUNDITEM)pItemList;

		while ( pItem )
		{
			if ( pItem->DropID == EnviroTarget.Race )
			{
				pGroundTarget = pItem;
				WriteChatf( "Item '%s' targeted.", EnviroTarget.Name );
				break;
			}
			pItem = pItem->pNext;
		}
	}

}

PLUGIN_API VOID OnRemoveGroundItem(PGROUNDITEM pGroundItem)
{
	if ( pGroundItem == pGroundTarget )
	{
		pGroundTarget = NULL;
		WriteChatf( "Item no longer targeted." );
	}
}

// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
	DebugSpewAlways("Initializing MQ2MapItemTarget");
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
	DebugSpewAlways("Shutting down MQ2MapItemTarget");
}
 
Hah, Abyss is not goign to be happy with you posting this...
 
Anything deterring from Abyss's so-called success is a good thing.

Nice job on this. You have three hits in a row. Keep up the great work.
 
thez said:
Hah, Abyss is not goign to be happy with you posting this...
If I posted something I should not have feel free to delete it. I did not rip the code off from anywhere, and this is really simple, I did not think it was a big deal.
 
lol he better not get pissed, plugins that do the same as his have been posted before, you're fine (this doesn't even do the same as his)
 
If I posted something I should not have feel free to delete it. I did not rip the code off from anywhere, and this is really simple, I did not think it was a big deal.

Nope. Exactly the reverse:

MQ2GetItemMap: This plugin will allow you to just open up your map and click any ground spawn ANYWHERE on the map, and it will automatically be in your inventory. Price: $20.00
 
I said I didn't rip the code off, I didn't say I didn't rip the idea off. I state in my description that I believe this has been done before. It took me about an hour and a half of looking at /itemtarget, MQ2Map and /grabitem to figure out how to do it, code it and test it. This was done last night.
 
I didn't imply you ripped code off, lol.

Let me be more specific:

Bravo at figuring this out, and posting it. Bravo at taking away some of Abyss's business, especially for that plugin. And, oh yeah...great work, keep em coming!
 
for shits and giggles: does what abyss's plugin does. (add the red text to the source posted above)

edit: added the updatemovement and getitempacket opcodes(i have them in a seperate .h file)
Rich (BB code):
#include "../MQ2Plugin.h"

PreSetup("MQ2MapItemTarget");
 
#define PKT_UPDATE_POSITION 0x178A
#define PKT_GRAB_ITEM 0x76F0 

struct _MOVEPKT {
  unsigned short SpawnID;
unsigned short TimeStamp;
 int Heading:16;
 int unknown1:16;     //??
 float DeltaZ;        // ?? not sure
 int Animation:16;
 int padding014:16;   //??
 int DeltaHeading:16; //?? not sure
 int unknown2:16;     //??
 float Y;
 float DeltaY;        //?? not sure
 float DeltaX;        //?? not sure
 float Z;
 float X;
} P;

PLUGIN_API VOID OnPulse(VOID)
{
	if( gGameState != GAMESTATE_INGAME )
	{
		return;
	}

	if ( ( pGroundTarget == NULL && EnviroTarget.Name[ 0 ] ) ||
		( pGroundTarget && EnviroTarget.Name[ 0 ] && pGroundTarget->DropID != EnviroTarget.Race ) )
	{
		PGROUNDITEM pItem = (PGROUNDITEM)pItemList;

		while ( pItem )
		{
			if ( pItem->DropID == EnviroTarget.Race )
			{
				pGroundTarget = pItem;
				WriteChatf( "Item '%s' targeted.", EnviroTarget.Name );
				PCHARINFO pChar;
                                PGROUNDITEM pItem = (PGROUNDITEM)pGroundTarget;
				PSPAWNINFO Target = (PSPAWNINFO)pTarget;
				ZeroMemory(&P, sizeof(P));
				P.SpawnID = (unsigned short)pChar->SpawnID;
				P.Heading = (unsigned int)(pChar->Heading * 4);
				P.Z = pItem->Z;
				P.Y = pItem->Y;
				P.X = pItem->X;
				SendEQMessage(PKT_UPDATE_POSITION, &P, sizeof(P));
				struct _GRABITEMPKT {
					unsigned long DropID;
					unsigned long SpawnID;
				} GP;
				GP.DropID = pItem->DropID;
				GP.SpawnID = pChar->SpawnID;
				SendEQMessage(PKT_GRAB_ITEM, &GP, sizeof(GP));
				P.Z = pChar->Z;
				P.Y = pChar->Y;
				P.X = pChar->X;
				SendEQMessage(PKT_UPDATE_POSITION, &P, sizeof(P));
				pTarget = 0;
				pGroundTarget = 0;
				break;
			}
			pItem = pItem->pNext;
		}
	}

}

PLUGIN_API VOID OnRemoveGroundItem(PGROUNDITEM pGroundItem)
{
	if ( pGroundItem == pGroundTarget )
	{
		pGroundTarget = NULL;
		WriteChatf( "Item no longer targeted." );
	}
}

// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
	DebugSpewAlways("Initializing MQ2MapItemTarget");
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
	DebugSpewAlways("Shutting down MQ2MapItemTarget");
}

note: i'm not compiling it so don't ask.
 
Last edited:
Note: I am not going to include that in mine either, dont ask. I get a kick out of the fact it was posted tho :) I personally think its not as safe. I'd hate to be trying to target a mob in a public zone, accidentally right click a drop infront of a GM or something. Right click then running a command is not a big deal, and is a good error validation step. And thanks Z, I sometimes misinterpret posts, I tend to assume the worst unless other information available.

I can't write good macro's worth a damn, but I can program C++ quite well, I'll try to keep plugins flowing as I come up with ideas. Suggestions always welcome, but if I personally wont use it, I probably will not code it. And no "hack" requests either.

On yet another side note, what does it take to get a plugin included in the pre-compile? If I keep writing plugins at this rate, I'm gunna have a lot of posts to update.
 
Just send RedQuest a PM. If you want it in there, I'm sure he'll put it in.
 
Tried Raistlin1898 Code that he posted and got the following errors and won't compile. I changed the name to Ground Spawn to make it different then original before someone asks why i posted errors from a different plugin. Am going to look at trying to fix from something I saw on MQ2VIP if I can find the post again but letting you know it didn't work.

g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(46): error C2065: 'pChar' : undeclared identifier
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(46): error C2227: left of '->SpawnID' must point to class/struct/union
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(47): error C2227: left of '->Heading' must point to class/struct/union
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(47): error C3861: 'pChar': identifier not found, even with argument-dependent lookup
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(57): error C2227: left of '->SpawnID' must point to class/struct/union
type is ''unknown-type''
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(57): error C3861: 'pChar': identifier not found, even with argument-dependent lookup
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(59): error C2227: left of '->Z' must point to class/struct/union
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(59): error C3861: 'pChar': identifier not found, even with argument-dependent lookup
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(60): error C2227: left of '->Y' must point to class/struct/union
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(60): error C3861: 'pChar': identifier not found, even with argument-dependent lookup
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(61): error C2227: left of '->X' must point to class/struct/union
g:\Mq2Hacks\MQ2Groundspawn\MQ2Groundspawn.cpp(61): error C3861: 'pChar': identifier not found, even with argument-dependent lookup
 
MQ2MapItemTarget

Users who are viewing this thread

Back
Top
Cart