- Joined
- Apr 1, 2006
- Messages
- 6
- Reaction score
- 0
- Points
- 0
I originally posted this on RedGuides.com but I wanted to post it here cause it didn't get too much attention (and I also want free access )
This plugin will cure the DT that Vish casts (Creeping Doom). It works pretty much like MQ2Zone with Translocators but instead says "shoulder my burden" instead of a zone name.
This plugin will cure the DT that Vish casts (Creeping Doom). It works pretty much like MQ2Zone with Translocators but instead says "shoulder my burden" instead of a zone name.
Code:
// MQ2Vish.cpp : This plugin automatically cures the Vish Death-touch ae
// by moving you to the NPC that cures it and saying the expression
// 'shoulder my burden'
// This will NOT work if there are no curing NPC's (mournful spirits) up
// Author: randomguy_01, an idea based off a macro by everdead
// ************************************************** ********************
// Syntax:
// /vish - Enables/Disables the automatic curing
#include "../MQ2Plugin.h"
PreSetup("MQ2Vish");
PLUGIN_VERSION(1.0);
#ifdef PKT_UPDATE_POSITION
#undef PKT_UPDATE_POSITION
#endif
#define PKT_UPDATE_POSITION 0x3813
#define PKT_CHANNEL_MESSAGE 0x2C2D
DWORD OverlayColor = CONCOLOR_RED; // can modify this
DWORD OverlayHold = 6000; // in milliseconds
bool bVish = false;
VOID VishCmd(PSPAWNINFO pChar);
CHAR szTriggerMsg[MAX_STRING] = {0};
struct _MOVEPKT {
/*0000*/ unsigned short SpawnID;
/*0002*/ unsigned short TimeStamp;
/*0004*/ int DeltaHeading:16;
/*0006*/ int padding0020:16;
/*0008*/ float DeltaZ;
/*0012*/ float Y;
/*0016*/ int Animation:16;
/*0018*/ int Heading:16;
/*0020*/ float X;
/*0024*/ float DeltaY;
/*0028*/ float DeltaX;
/*0032*/ float Z;
} MovePkt;
struct _MSGPACKET {
/*0000*/ char target[64];
/*0064*/ char sender[64];
/*0128*/ unsigned int language;
/*0132*/ unsigned int channel;
/*0136*/ char padding136[8];
/*0144*/ unsigned int languageskill;
/*0148*/ char message[100];
} MsgPkt;
VOID VishCmd(PSPAWNINFO pChar, PCHAR szLine)
{
if(bVish) {
WriteChatColor("No longer curing Creeping Doom",CONCOLOR_RED);
bVish = false;
}
else {
WriteChatColor("Automatically curing Creeping Doom",CONCOLOR_GREEN);
bVish = true;
}
}
PLUGIN_API DWORD OnWriteChatColor(PCHAR Line, DWORD Color, DWORD Filter)
{
DebugSpewAlways("MQ2Vish::OnWriteChatColor(%s)",Line);
if(bVish)
{
if (strstr(Line, " sense your doom "))
{
PSPAWNINFO pChar = GetCharInfo()->pSpawn;
ZeroMemory(&MovePkt, sizeof(MovePkt));
ZeroMemory(&MsgPkt, sizeof(MsgPkt));
MovePkt.SpawnID = (unsigned short)pChar->SpawnID;
MovePkt.Heading = (unsigned int)(pChar->Heading * 4);
// clear target
pTarget = NULL;
PSPAWNINFO psTarget = NULL;
// /squelch won't show MQ2 default /target faulure.
DoCommand(pChar->pSpawn,"/squelch /target mournful npc");
if (ppTarget && pTarget) {
psTarget = (PSPAWNINFO)pTarget;
}
if (!psTarget)
{
WriteChatf("You have been hit with Creeping Doom!");
MacroError("There are no mournful spirits up.");
DisplayOverlayText("NO MOURNFUL SPIRITS UP!",OverlayColor,100,500,500,OverlayHold);
return 0;
}
WriteChatf("You have been hit with Creeping Doom!");
sprintf(szTriggerMsg,"Using %s to shoulder your burden!",psTarget->DisplayedName);
DisplayOverlayText(szTriggerMsg,OverlayColor,100,500,500,OverlayHold);
strcpy(MsgPkt.target,psTarget->Name);
strcpy(MsgPkt.sender,pChar->Name);
MsgPkt.channel=8;
MsgPkt.languageskill=100;
MovePkt.Z = psTarget->Z;
MovePkt.Y = psTarget->Y;
MovePkt.X = psTarget->X;
SendEQMessage(PKT_UPDATE_POSITION, &MovePkt, sizeof(MovePkt));
sprintf(MsgPkt.message,"shoulder my burden");
SendEQMessage(PKT_CHANNEL_MESSAGE,&MsgPkt,sizeof(MsgPkt));
WriteChatf("Using %s at %3.2f, %3.2f, %3.2f to shoulder your burden.",psTarget->Name,psTarget->Y,psTarget->X,psTarget->Z);
}
}
return 0;
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/vish",VishCmd);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/vish"); }
Attachments
Last edited by a moderator: