• 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

MQ2HideDoors

TeachersPet

Well-known member
Joined
Jul 27, 2005
RedCents
71¢
This is a combination of randomguy's toggling and cronic's better (easier to find the offset) function

12/18: updated offset

Rich (BB code):
// MQ2Doors.cpp : Defines the entry point for the DLL application.
// MQ2Doors by cronic, uber leet toggle by randomguy_01

#include "../MQ2Plugin.h"

PreSetup("MQ2Doors");

#define EQSwitch__ChangeState 0x482F18

#ifdef EQSwitch__ChangeState
FUNCTION_AT_ADDRESS(void EQSwitch::ChangeState(unsigned char, class EQPlayer *, bool), EQSwitch__ChangeState);
#endif

bool gHidden = false;
BOOL gHideAlways = false;

bool ModDoors(float fMod)
{
	if (!pSwitchMgr || gGameState != GAMESTATE_INGAME) return false;

	for (unsigned int i = 0; i < ((PDOORTABLE)pSwitchMgr)->NumEntries; i++) 
	{
		PDOOR pDoor = ((PDOORTABLE)pSwitchMgr)->pDoor;
		pDoor->DefaultZ += fMod;
		pDoor->Z += fMod;

		((EQSwitch*)pDoor)->ChangeState(3, 0, 0);
	}

	return true;
}

void HideDoors()
{
	if (gHidden || !ModDoors(-1000000.00f)) return;
	gHidden = true;
}

void RevealDoors()
{
	if (!gHidden || !ModDoors(1000000.00f)) return;
	gHidden = false;
}


void DoorHelp()
{
	WriteChatColor("Hide Door Help:");
	WriteChatColor("/toggledoors on - Hide the doors in your current zone.");
	WriteChatColor("/toggledoors off - Shows all doors and disables the always feature");
	WriteChatColor("/toggledoors always - Hides all doors where ever you zone");
}


PLUGIN_API VOID ToggleDoorsCmd(PSPAWNINFO pChar, PCHAR szLine)
{
	CHAR szArg[MAX_STRING] = {0};
	GetArg(szArg, szLine, 1);

	if (szArg[0] == 0) DoorHelp();
	else if (!strcmp(szArg, "on")) {
		HideDoors();
		WriteChatColor("Hiding the doors");
	}
	else if (!strcmp(szArg, "off")) {
		gHideAlways = false;
		RevealDoors();
		WriteChatColor("Revealing the doors");
	}
	else if (!strcmp(szArg, "always")) {
		gHideAlways = true;
		WriteChatColor("Hiding doors in all zones after you zone");
	}
		
}
 
PLUGIN_API VOID OnEndZone(VOID)
{
	if (gHideAlways) {
		gHidden = false;
		HideDoors();
	}
	else return;
}

PLUGIN_API VOID InitializePlugin(VOID)
{
	AddCommand("/toggledoors", ToggleDoorsCmd);
}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
	RemoveCommand("/toggledoors");
	RevealDoors();
}


Since cronic's requires an offset and mine doesn't, I'll leave this here just in case there's a patch day and no one's able to find the offset for a while. Mine you have to cause the door to open before it works. (Went ahead and added /showdoors into it)

Rich (BB code):
// MQ2HideDoors by TeachersPet
// Syntax:
// /hidedoors and one click to remove a door until zone!
// /showdoors to bring them back!

#include "../MQ2Plugin.h"

PreSetup("MQ2HideDoors");

bool DoorsHidden = false;

VOID HideDoors(PSPAWNINFO pChar, PCHAR szLine) {
	if(!DoorsHidden) {
		for(unsigned long i = 0; i < ((PDOORTABLE)pSwitchMgr)->NumEntries; i++) {
			((PDOORTABLE)pSwitchMgr)->pDoor->DefaultZ += 10000;
			((PDOORTABLE)pSwitchMgr)->pDoor->Z += 10000;
		}
	}
}

VOID ShowDoors(PSPAWNINFO pChar, PCHAR szLine) {
	if(DoorsHidden) {
		for(unsigned long i = 0; i < ((PDOORTABLE)pSwitchMgr)->NumEntries; i++) {
			((PDOORTABLE)pSwitchMgr)->pDoor->DefaultZ -= 10000;
			((PDOORTABLE)pSwitchMgr)->pDoor->Z -= 10000;
		}
	}
}

PLUGIN_API VOID InitializePlugin(VOID)
{
	AddCommand("/hidedoors",HideDoors);
	AddCOmmand("/showdoors",ShowDoors);
}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
	RemoveCommand("/hidedoors");
	RemoveCommand("/showdoors");
}
 
Last edited:
any chance of a compiled plugin for those of us who are plugin illiterate? lol
 
rename it to /movedoorstoouterspace, that's more like it :)
 
heh, hopefully I can get this other exploit going so I can possibly not get 3rd place this month.
 
I can see the wonderful use with this to save time and trouble moving around, but I am curious to know what kind of big red flags this raises on the server if any at all. Am I correct that this only works for the person using it? What I mean is, does anyone else see them gone. I don't see how they could, but if that is the case, will people see you walk right through a door? I'm only curious to know cause and effect of this plugin is all. This plugin could be put to great use in zones like PoJ, etc....
 
They'll see you run through a door. Once the door is opened, clientside the door will shoot to the loc 10000,10000,10000. I'm going to see what I can do about making them instantly go up there. There's bound to be some sort of a way to do it.
 
/con makes the Server send an updated info packet on whatever you have targeted. Maybe you could use that somehow in conjuction with /doortarget to make it poof without actually opening it?
 
It's not an info packet that needs to be sent. What probably needs to be done is messing with the door's actor or better yet the door function (offset wise) and having it call a client side open. But the offset is sort of outside of my skillset, and I'm not sure of how to make it an "actor" either.
 
would be nice if say when you try to click a locked door that it would auto warp you to the other side of it.
 
Seems like I remember MQ2 having that feature included... Walking thru doors...

On the subject of killing every door in a zone, why don't you just get a list of doors on zone-in and do to each one individually whatever you do to them with this plugin? Would you not be able to use /doortarget next and just go down the line until you run out of doors, or am I missing something?

-CodeCaster
 
codecaster said:
Seems like I remember MQ2 having that feature included... Walking thru doors...

On the subject of killing every door in a zone, why don't you just get a list of doors on zone-in and do to each one individually whatever you do to them with this plugin? Would you not be able to use /doortarget next and just go down the line until you run out of doors, or am I missing something?

-CodeCaster

That's exactly what he does (not at zone in but by /hidedoors), he goes through a list of doors and assigns new y,x,z to them. After you moved the doors you have to 'update' the doors in a client, TP has the right idea there and I'm sure if he cares enough he'll figure it out, it's not hard.
 
odessa said:
That's exactly what he does (not at zone in but by /hidedoors), he goes through a list of doors and assigns new y,x,z to them. After you moved the doors you have to 'update' the doors in a client, TP has the right idea there and I'm sure if he cares enough he'll figure it out, it's not hard.

I don't think that's what's going on though... With this plugin you actually have to click the door and it disappears (well, according to the description anyway...) and I was thinking that if he is just assigning the door a new xyz, then he could probably do the same thing in a loop instead of doing it just once to kill the door you're standing at, resulting in the moving of every door in the zone at zone-in time.

If noone figures it out before I get a few days off of work, I'll take a look at it. I might not be explaining myself very well...

-CodeCaster
 
I've been playing around with it, you do need something to tell it to move from it's location. So far I'm to the point in getting an assload of You can't reach that, get closer messages on zone in.
 
codecaster said:
I don't think that's what's going on though... With this plugin you actually have to click the door and it disappears (well, according to the description anyway...) and I was thinking that if he is just assigning the door a new xyz, then he could probably do the same thing in a loop instead of doing it just once to kill the door you're standing at, resulting in the moving of every door in the zone at zone-in time.

If noone figures it out before I get a few days off of work, I'll take a look at it. I might not be explaining myself very well...

-CodeCaster

Read his code, it's exactly as I said it is. What do you think this means -
Rich (BB code):
for(unsigned long i = 0; i < TotalDoors; i++)

What happens when you click is 'update', it's not that his plugin kicks in when you click it's that the client updates the door at this point and sees the new coordinates. Seriously I would give more credit to TP, if it was that easy he'd figure it out.
 
Chill out man... No need to go on the defensive. I don't attack unless provoked. ;)

So what you're saying is that when you click one door, every door in the zone moves? Or is the client only updating the location of the door you are clicking?

If this is the case, perhaps there is a switch we can throw to cause the client to loop thru the doors, forcing client updates for each one on zone-in.

-CodeCaster

P.S. - RAR 200 POSTS$@^%^$
 
codecaster said:
Chill out man... No need to go on the defensive. I don't attack unless provoked. ;)

So what you're saying is that when you click one door, every door in the zone moves? Or is the client only updating the location of the door you are clicking?

If this is the case, perhaps there is a switch we can throw to cause the client to loop thru the doors, forcing client updates for each one on zone-in.

-CodeCaster

P.S. - RAR 200 POSTS$@^%^$

defensive? eh?

When you click on a door it gets 'updated', if you want to hide all doors you have to find an entry point to that 'update' subroutine and execute it on every door. Another way is to /switch every door but that's a ton of warping :)
 
Its best left as is currently. This way you know there are barriers, and you know if people are around you probably shouldn't sprint through a solid door. Also, its not like clicking a door is too troublesome.~
 
Well, of course you are aware of the ever-present drive to maximize laziness...

;)

-CodeCaster
 
This should do the trick (/toggledoors):

Rich (BB code):
// MQ2Doors.cpp : Defines the entry point for the DLL application.

#include "../MQ2Plugin.h"

PreSetup("MQ2Doors");

class CDoorHelper
{
private:
	bool ModDoors(float fMod);

public:
	void ProcMsg(void*, int, void*, int);
	void HideDoors();
	void RevealDoors();
	void ToggleDoors();
};

CDoorHelper* pDoorHelper = *(CDoorHelper**)pinstCEverQuest;
bool gHidden = false;

bool CDoorHelper::ModDoors(float fMod)
{
	if (!pSwitchMgr || gGameState != GAMESTATE_INGAME) return false;

	for (unsigned int i = 0; i < ((PDOORTABLE)pSwitchMgr)->NumEntries; i++) 
	{
		PDOOR pDoor = ((PDOORTABLE)pSwitchMgr)->pDoor;
		pDoor->DefaultZ += fMod;
		pDoor->Z += fMod;

		unsigned char b[2] = {pDoor->ID, 0x03};
		ProcMsg(0, 0x700D, &b, 2);
	}

	return true;
}

__declspec(naked) void CDoorHelper::ProcMsg(void*, int, void*, int)
{
	__asm{mov eax, 0x45C0B1};
	__asm{jmp eax};
}

void CDoorHelper::HideDoors()
{
	if (gHidden || !ModDoors(-1000000.00f)) return;
	gHidden = true;
}

void CDoorHelper::RevealDoors()
{
	if (!gHidden || !ModDoors(1000000.00f)) return;
	gHidden = false;
}

void CDoorHelper::ToggleDoors()
{
	gHidden ? RevealDoors() : HideDoors();
}

PLUGIN_API VOID ToggleDoorsCmd(PSPAWNINFO pChar, PCHAR szLine)
{
	pDoorHelper->ToggleDoors();
}

PLUGIN_API VOID InitializePlugin(VOID)
{
	AddCommand("/toggledoors", ToggleDoorsCmd);
}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
	RemoveCommand("/toggledoors");
	pDoorHelper->RevealDoors();
}


*flex*
 
small addon to the toggle :D

Usage: /toggledoors on|off|always

/toggledoors always hides all doors when you zone

all credit to cronic :)

Rich (BB code):
// MQ2Doors.cpp : Defines the entry point for the DLL application.

#include "../MQ2Plugin.h"

PreSetup("MQ2Doors");

class CDoorHelper
{
private:
	bool ModDoors(float fMod);

public:
	void ProcMsg(void*, int, void*, int);
	void HideDoors();
	void RevealDoors();
	void ToggleDoors();
};

BOOL bHideAlways = FALSE;

CDoorHelper* pDoorHelper = *(CDoorHelper**)pinstCEverQuest;
bool gHidden = false;

bool CDoorHelper::ModDoors(float fMod)
{
	if (!pSwitchMgr || gGameState != GAMESTATE_INGAME) return false;

	for (unsigned int i = 0; i < ((PDOORTABLE)pSwitchMgr)->NumEntries; i++) 
	{
		PDOOR pDoor = ((PDOORTABLE)pSwitchMgr)->pDoor;
		pDoor->DefaultZ += fMod;
		pDoor->Z += fMod;

		unsigned char b[2] = {pDoor->ID, 0x03};
		ProcMsg(0, 0x700D, &b, 2);
	}

	return true;
}

__declspec(naked) void CDoorHelper::ProcMsg(void*, int, void*, int)
{
	__asm{mov eax, 0x45C0B1};
	__asm{jmp eax};
}

void CDoorHelper::HideDoors()
{
	if (gHidden || !ModDoors(-1000000.00f)) return;
	gHidden = true;
}

void CDoorHelper::RevealDoors()
{
	if (!gHidden || !ModDoors(1000000.00f)) return;
	gHidden = false;
}

void CDoorHelper::ToggleDoors()
{
	gHidden ? RevealDoors() : HideDoors();
}

void DoorHelp()
{
	WriteChatColor("Hide Door Help:");
	WriteChatColor("/toggledoors on - Hide the doors in your current zone.");
	WriteChatColor("/toggledoors off - Shows all doors and disables the always feature");
	WriteChatColor("/toggledoors always - Hides all doors where ever you zone");
}


PLUGIN_API VOID ToggleDoorsCmd(PSPAWNINFO pChar, PCHAR szLine)
{
	CHAR szArg[MAX_STRING] = {0};

	GetArg(szArg, szLine, 1);
	if (szArg[0] == 0) DoorHelp();
	else if (!strcmp(szArg, "on")) {
		pDoorHelper->ToggleDoors();
		WriteChatColor("Hiding the doors");
	}
	else if (!strcmp(szArg, "off")) {
		bHideAlways = FALSE;
		pDoorHelper->RevealDoors();
		WriteChatColor("Revealing the doors");
	}

	else if (!strcmp(szArg, "always")) {
		bHideAlways = TRUE;
		WriteChatColor("Hiding doors in all zones after you zone");
	}
		
}

PLUGIN_API VOID OnZoned(VOID)
{
	if (bHideAlways) {
		pDoorHelper->ToggleDoors();
	}
	else return;
}

PLUGIN_API VOID InitializePlugin(VOID)
{
	AddCommand("/toggledoors", ToggleDoorsCmd);
}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
	RemoveCommand("/toggledoors");
	pDoorHelper->RevealDoors();
}
 
I suggest the following code in lieu of my previous, as it is much more easily maintained:

Rich (BB code):
// MQ2Doors.cpp : Defines the entry point for the DLL application.

#include "../MQ2Plugin.h"

PreSetup("MQ2Doors");

#define EQSwitch__ChangeState 0x49035D
FUNCTION_AT_ADDRESS(void EQSwitch::ChangeState(unsigned char, class EQPlayer *, bool), EQSwitch__ChangeState);

bool gHidden = false;

bool ModDoors(float fMod)
{
	if (!pSwitchMgr || gGameState != GAMESTATE_INGAME) return false;

	for (unsigned int i = 0; i < ((PDOORTABLE)pSwitchMgr)->NumEntries; i++) 
	{
		PDOOR pDoor = ((PDOORTABLE)pSwitchMgr)->pDoor;
		pDoor->DefaultZ += fMod;
		pDoor->Z += fMod;

		((EQSwitch*)pDoor)->ChangeState(3, 0, 0);
	}

	return true;
}

void HideDoors()
{
	if (gHidden || !ModDoors(-1000000.00f)) return;
	gHidden = true;
}

void RevealDoors()
{
	if (!gHidden || !ModDoors(1000000.00f)) return;
	gHidden = false;
}

PLUGIN_API VOID ToggleDoorsCmd(PSPAWNINFO pChar, PCHAR szLine)
{
	gHidden ? RevealDoors() : HideDoors();
}

PLUGIN_API VOID InitializePlugin(VOID)
{
	AddCommand("/toggledoors", ToggleDoorsCmd);
}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
	RemoveCommand("/toggledoors");
	RevealDoors();
}


cronic
 
Last edited:
On cronic's source just prior to this post I get a warning

"MQ2Doors.cpp(8) : warning C4273: 'EQClasses::EQSwitch::ChangeState' : inconsitant dll linkage

but then it compiles anyway. I didn't have that problem with the first one.
 
I'm trying to understand these besides just compiling them.

Am I correct that cronic's first source was similar to TP's in that it adjusted the location of the door and called a subroutine that caused the client to update it's location (some sort of refresh function?).

Am I correct that cronic's second source took a different approach and changed the nature of the door (like an npc changes to corpse when you kill it) then called a different routine which caused the state change to take place also changing the location at the same time?
 
JoeK said:
On cronic's source just prior to this post I get a warning

"MQ2Doors.cpp(8) : warning C4273: 'EQClasses::EQSwitch::ChangeState' : inconsitant dll linkage

but then it compiles anyway. I didn't have that problem with the first one.

Two options. You can either move that #define to your eqgame.h/eqgame-private.h and delete the following line, or you can disable that warning with a #pragma. Or the third option is to just ignore it - it won't hurt anything. The first option is what I suggest.

cronic
 
Am I correct that cronic's first source was similar to TP's in that it adjusted the location of the door and called a subroutine that caused the client to update it's location (some sort of refresh function?).

Yes sir.

Am I correct that cronic's second source took a different approach and changed the nature of the door (like an npc changes to corpse when you kill it) then called a different routine which caused the state change to take place also changing the location at the same time?

Not quite. Like the first, the second changes the location of the door and then forces the client to update and reflect the changes. The only difference between the first and the second (aside from code cleanup) is that the first uses a sort of roundabout means of forcing the update, where the second takes a more direct approach.

cronic
 
MQ2HideDoors

Users who are viewing this thread

Back
Top
Cart