Step 1
In eqgame.ini correct the doors offset:
Doors=006023c0
Step 2
In mq.h, modify the doors structure and add the new table structure:
Code: Select all
typedef struct _DOOR {
/*0x00*/ BYTE Unknown0x00;
/*0x01*/ BYTE ID;
/*0x02*/ CHAR Name[11];
/*0x0d*/ BYTE Unknown0x0d[7];
/*0x14*/ FLOAT DefaultY;
/*0x18*/ FLOAT DefaultX;
/*0x1c*/ FLOAT DefaultZ;
/*0x20*/ FLOAT DefaultHeading;
/*0x24*/ FLOAT DoorAngle;
/*0x28*/ FLOAT Y;
/*0x2c*/ FLOAT X;
/*0x30*/ FLOAT Z;
/*0x34*/ FLOAT Heading;
} DOOR, *PDOOR;
typedef struct _DOORTABLE {
DWORD NumEntries;
PDOOR pDoor[255];
} DOORTABLE, *PDOORTABLE;
Step 3
Replace the /doors and /doortarget commands in EQLib_Commands.cpp:
Code: Select all
// ***************************************************************************
// Function: Doors
// Description: Our '/doors' command
// Lists door info
// Usage: /doors <filter>
// ***************************************************************************
VOID Doors(PSPAWNINFO pChar, PCHAR szLine)
{
bRunNextCommand = TRUE;
if (!EQADDR_DOORS) return;
if (!*EQADDR_DOORS) return;
PDOORTABLE pDoorTable = *EQADDR_DOORS;
DWORD Count;
DWORD ActualCount=0;
CHAR szBuffer[MAX_STRING] = {0};
WriteChatColor("Doors:", USERCOLOR_DEFAULT);
WriteChatColor("---------------------------", USERCOLOR_DEFAULT);
size_t slen = strlen(szLine);
for (Count=0; Count<pDoorTable->NumEntries; Count++) {
if ((szLine[0]==0) || (!strnicmp(pDoorTable->pDoor[Count]->Name,szLine,slen))) {
SPAWNINFO TempSpawn;
FLOAT Distance;
ZeroMemory(&TempSpawn,sizeof(TempSpawn));
strcpy(TempSpawn.Name,pDoorTable->pDoor[Count]->Name);
TempSpawn.Y=pDoorTable->pDoor[Count]->Y;
TempSpawn.X=pDoorTable->pDoor[Count]->X;
TempSpawn.Z=pDoorTable->pDoor[Count]->Z;
TempSpawn.Heading=pDoorTable->pDoor[Count]->Heading;
Distance = DistanceToSpawn(pChar,&TempSpawn);
INT Angle = (INT)((atan2f(pChar->X - pDoorTable->pDoor[Count]->X, pChar->Y - pDoorTable->pDoor[Count]->Y) * 180.0f / PI + 360.0f) / 22.5f + 0.5f) % 16;
sprintf(szBuffer,"%d: %s: %1.2f away to the %s",pDoorTable->pDoor[Count]->ID, pDoorTable->pDoor[Count]->Name, Distance, szHeading[Angle]);
WriteChatColor(szBuffer,USERCOLOR_DEFAULT);
ActualCount++;
}
}
if (ActualCount==0) {
WriteChatColor("No Doors found.",USERCOLOR_DEFAULT);
} else {
sprintf(szBuffer,"%d door%s found.",ActualCount,(ActualCount==1)?"":"s");
WriteChatColor(szBuffer,USERCOLOR_DEFAULT);
}
}
// ***************************************************************************
// Function: DoorTarget
// Description: Our '/doortarget' command
// Targets the nearest specified door
// Usage: /doortarget <text>
// ***************************************************************************
VOID DoorTarget(PSPAWNINFO pChar, PCHAR szLine)
{
bRunNextCommand = TRUE;
if (!EQADDR_DOORS) return;
if (!*EQADDR_DOORS) return;
PDOORTABLE pDoorTable = *EQADDR_DOORS;
DWORD Count;
CHAR szBuffer[MAX_STRING] = {0};
CHAR szSearch[MAX_STRING] = {0};
CHAR Arg1[MAX_STRING] = {0};
PCHAR Arg2 = szLine;
FLOAT cDistance = 100000.0f;
BYTE ID = -1;
ZeroMemory(&DoorEnviroTarget,sizeof(DoorEnviroTarget));
pDoorTarget = NULL;
GetArg(Arg1,Arg2,1);
Arg2 = GetNextArg(Arg2, 1);
if (!stricmp(Arg1, "id")) {
if (Arg2[0]==0) {
WriteChatBuffer("DoorTarget: id specified but no number provided.", CONCOLOR_RED);
strcpy(gLastError, "DOORTARGET_BADCOMMAND");
return;
}
ID = atoi(Arg2);
for (Count=0; Count<pDoorTable->NumEntries; Count++) {
if (pDoorTable->pDoor[Count]->ID == ID) {
strcpy(DoorEnviroTarget.Name, pDoorTable->pDoor[Count]->Name);
DoorEnviroTarget.Y = pDoorTable->pDoor[Count]->Y;
DoorEnviroTarget.X = pDoorTable->pDoor[Count]->X;
DoorEnviroTarget.Z = pDoorTable->pDoor[Count]->Z;
DoorEnviroTarget.Heading = pDoorTable->pDoor[Count]->Heading;
pDoorTarget = pDoorTable->pDoor[Count];
break;
}
}
} else {
strcpy(szSearch, Arg1);
for (Count=0; Count<pDoorTable->NumEntries; Count++) {
if (((szSearch[0]==0) ||
(!strnicmp(pDoorTable->pDoor[Count]->Name,szSearch,strlen(szSearch)))) &&
((gZFilter >=10000.0f) ||
((pDoorTable->pDoor[Count]->Z <= pChar->Z + gZFilter) &&
(pDoorTable->pDoor[Count]->Z >= pChar->Z - gZFilter)))) {
SPAWNINFO tSpawn;
ZeroMemory(&tSpawn,sizeof(tSpawn));
strcpy(tSpawn.Name,pDoorTable->pDoor[Count]->Name);
tSpawn.Y=pDoorTable->pDoor[Count]->Y;
tSpawn.X=pDoorTable->pDoor[Count]->X;
tSpawn.Z=pDoorTable->pDoor[Count]->Z;
tSpawn.Heading=pDoorTable->pDoor[Count]->Heading;
FLOAT Distance = DistanceToSpawn(pChar,&tSpawn);
if (Distance<cDistance) {
CopyMemory(&DoorEnviroTarget,&tSpawn,sizeof(DoorEnviroTarget));
pDoorTarget = pDoorTable->pDoor[Count];
cDistance=Distance;
}
}
}
}
if (DoorEnviroTarget.Name[0]!=0) {
sprintf(szBuffer,"Door %d '%s' targeted.", pDoorTarget->ID, DoorEnviroTarget.Name);
gLastError[0]=0;
WriteChatBuffer(szBuffer,USERCOLOR_DEFAULT);
} else {
sprintf(szBuffer,"Couldn't find door '%s'.",szLine);
strcpy(gLastError,"ITEM_NOTFOUND");
WriteChatBuffer(szBuffer,CONCOLOR_RED);
}
}
Step 4
Correct any door references in EQLib_Main.cpp:
Code: Select all
PDOORTABLE *EQADDR_DOORS=0;
Code: Select all
GetPrivateProfileString("Memory Locations","Doors","0",szBuffer,MAX_STRING,ClientINI); EQADDR_DOORS = (PDOORTABLE*)strtoul(szBuffer,NULL,16);
Correct the external reference in EQLib.h:
Code: Select all
extern PDOORTABLE *EQADDR_DOORS;
Step 6
Correct the pdoor debug information in exts2.cpp:
Code: Select all
DECLARE_API ( pdoor )
{
DOOR *p, *pnull=NULL, ci;
DWORD cb;
// read param from command line
p = (DOOR *)GetExpression(args);
ReadMemory((PARAM1)p,&ci,sizeof(ci),&cb);
dprintf("\n\n\n");
KP(Unknown0x00);
KP(ID);
KPs(Name);
KP(Unknown0x0d);
KPf(DefaultY);
KPf(DefaultX);
KPf(DefaultZ);
KPf(DefaultHeading);
KPf(DoorAngle);
KPf(Y);
KPf(X);
KPf(Z);
KPf(Heading);
}



donations for this month's patches.