EQData.H Question

lionsman

Lifetimer
Joined
Sep 10, 2007
Messages
79
Reaction score
0
Points
0
I use to have a plugin I used all the time I went to compile it and it gave me a message that GuildName was not defined in Guilds in EQData.h



I pulled an old EQData.H file and this is what use to be in there its not there any more.


#define MAX_GUILDS 0x5DC
typedef struct _GUILDS {
/*0x0000*/ PVOID pOneEntryVTable;
/*0x0004*/ BYTE UnknownByte0x0005;
/*0x0005*/ BYTE Unknown0x0005[0x3f];
/*0x0044*/ DWORD UnknownValue0x0044;
/*0x0048*/ struct _GUILDMEMBER *pMember;
/*0x004c*/ CHAR GuildName[MAX_GUILDS][0x40];


I put #define MAX_GUILDS 0x5DC
and /*0x004c*/ CHAR GuildName[MAX_GUILDS][0x40];
in the new compile and it compiled for me but I am guessing the reason it is not working is that these are offsets and they are old.

Can anyone offer assistance so that I can compile and have it detect guildnames again. I am thinking the Hex numbers are wrong

Thanks
 
Not needed any more (max). There are functions to pull / look up guild names. It would help to know how you need to use it, for example, looking for a guild by name? Or looking up a guild name by ID? If you show the few lines of code that use the old struct / define, I can tell you how to change it to work.

htw
 
Code

Here is the plugi.CPP file that looks for a guild by name and alerts me if it comes in zone.

When I try to compile it now it errors out because GuildName is not defined in EQData.H anymore
Thanks for helping me fix it

Code:
#include "../MQ2Plugin.h"
#include <iostream>
#include <string>
#include <vector>

using namespace std;

std::vector <std::string> friends;
std::vector <std::string> enemies;
std::vector <std::string> guilds;
int igSkipPulses = 10;
int igSkipPulse = 0;
int warningRadius = 200;
int playerCount;
bool pauseOnPlayerCount;
bool pauseOnGM;
bool pauseOnRadius;
bool pauseOnEnemy;
bool pauseOnGuild;
bool verbose = false;
bool paused = false;
bool beeped = false;

PreSetup("MQ2Warning");

VOID Tokenize(const string& str, vector<string>& tokens, const string& delimiters = ",")
{
	// Skip delimiters at beginning.
	string::size_type lastPos = str.find_first_not_of(delimiters, 0);
	// Find first "non-delimiter".
	string::size_type pos = str.find_first_of(delimiters, lastPos);
	while (string::npos != pos || string::npos != lastPos)
	{
		// Found a token, add it to the vector.
		tokens.push_back(str.substr(lastPos, pos - lastPos));
		// Skip delimiters.  Note the "not_of"
		lastPos = str.find_first_not_of(delimiters, pos);
		// Find next "non-delimiter"
		pos = str.find_first_of(delimiters, lastPos);
	}
}

VOID Update_INIFileName() { 
	sprintf(INIFileName,"%s\\MQ2Warning.ini",gszINIPath); 
} 

VOID Load_MQ2Radar_INI()
{ 
	std::string _friends;
	std::string _enemies;
	std::string _guilds;

	CHAR szTemp[MAX_STRING]={0}; 

	Update_INIFileName(); 

	GetPrivateProfileString("MQ2Warning","Friends","",&szTemp[0],sizeof(szTemp),INIFileName);
	_friends = string(szTemp);
	Tokenize(_friends, friends);
	WritePrivateProfileString("MQ2Warning","Friends",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","Enemies","",&szTemp[0],sizeof(szTemp),INIFileName);
	_enemies = string(szTemp);
	Tokenize(_enemies, enemies);
	WritePrivateProfileString("MQ2Warning","Enemies",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","Guilds","",&szTemp[0],sizeof(szTemp),INIFileName);
	_guilds = string(szTemp);
	Tokenize(_guilds, guilds);
	WritePrivateProfileString("MQ2Warning","Guilds",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","PlayerCount","0",&szTemp[0],sizeof(szTemp),INIFileName);
	playerCount = atoi(&szTemp[0]);
	sprintf(szTemp, "%d", playerCount); 
	WritePrivateProfileString("MQ2Warning","PlayerCount",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","PauseOnPlayerCount","1",&szTemp[0],sizeof(szTemp),INIFileName);
	pauseOnPlayerCount = atoi(&szTemp[0]);
	sprintf(szTemp, "%d", pauseOnPlayerCount); 
	WritePrivateProfileString("MQ2Warning","PauseOnPlayerCount",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","WarningRadius","200",&szTemp[0],sizeof(szTemp),INIFileName);
	warningRadius = atoi(&szTemp[0]);
	sprintf(szTemp, "%d", warningRadius); 
	WritePrivateProfileString("MQ2Warning","WarningRadius",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","PauseOnRadius","1",&szTemp[0],sizeof(szTemp),INIFileName);
	pauseOnRadius = atoi(&szTemp[0]);
	sprintf(szTemp, "%d", pauseOnRadius); 
	WritePrivateProfileString("MQ2Warning","PauseOnRadius",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","PauseOnEnemy","1",&szTemp[0],sizeof(szTemp),INIFileName);
	pauseOnEnemy = atoi(&szTemp[0]);
	sprintf(szTemp, "%d", pauseOnEnemy); 
	WritePrivateProfileString("MQ2Warning","PauseOnEnemy",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","PauseOnGuild","1",&szTemp[0],sizeof(szTemp),INIFileName);
	pauseOnGuild = atoi(&szTemp[0]);
	sprintf(szTemp, "%d", pauseOnGuild); 
	WritePrivateProfileString("MQ2Warning","PauseOnGuild",szTemp,INIFileName);

	GetPrivateProfileString("MQ2Warning","PauseOnGM","1",&szTemp[0],sizeof(szTemp),INIFileName);
	pauseOnGM = atoi(&szTemp[0]);
	sprintf(szTemp, "%d", pauseOnGM); 
	WritePrivateProfileString("MQ2Warning","PauseOnGM",szTemp,INIFileName);	
} 

BOOL Friend(PSPAWNINFO pSpawn) {
	for (int i=0;i<friends.size();i++) {
		if (!stricmp(pSpawn->Name,friends[i].c_str())) return true;
	}
	return false;
}

BOOL Enemy(PSPAWNINFO pSpawn) {
	for (int i=0;i<enemies.size();i++) {
		if (!stricmp(pSpawn->Name,enemies[i].c_str())) return true;
	}
	return false;
}

BOOL Guild(PSPAWNINFO pSpawn) {
	for (int i=0;i<guilds.size();i++) {
		if (!stricmp(pGuildList->GuildName[pSpawn->GuildID],guilds[i].c_str())) return true;
	}
	return false;
}

VOID ResetBeep(PSPAWNINFO pChar, PCHAR szLine) {
	beeped = false;
}

VOID Reset(PSPAWNINFO pChar, PCHAR szLine) {
	beeped = false;
	paused = false;
	DoCommand(pChar,"/mqpause off");
}

VOID Verbose(PSPAWNINFO pChar, PCHAR szLine) {
	if (verbose) {
		verbose = false;
	} else {
		verbose = true;
	}
}

BOOL InGame() { 
	return(gGameState == GAMESTATE_INGAME && GetCharInfo2() && GetCharInfo()); 
} 

// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
	DebugSpewAlways("Initializing MQ2Warning");
	Load_MQ2Radar_INI();
	AddCommand("/rtone",ResetBeep);
	AddCommand("/wreset",Reset);
	AddCommand("/wverbose",Verbose);
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
	DebugSpewAlways("Shutting down MQ2Warning");
	RemoveCommand("/rtone");
	RemoveCommand("/wverbose");
	RemoveCommand("/wreset");
}

PLUGIN_API VOID OnPulse(VOID)
{
	PSPAWNINFO pSpawn = (PSPAWNINFO)pSpawnList;
	PSPAWNINFO pChar = GetCharInfo()->pSpawn;
	int beeptype = 0, count = 0;
	//HWND EQhWnd = *(HWND*)EQADDR_HWND;
	if (InGame()) {// && GetForegroundWindow()==EQhWnd) {
		if (igSkipPulse == igSkipPulses) {
			igSkipPulse = 0;
			while (pSpawn) 
			{ 	
				if (GetSpawnType(pSpawn)==PC) {
					count++;
					if (pSpawn!=pChar && !Friend(pSpawn)) {
						// check radius
						if (pauseOnRadius && GetDistance(pChar,pSpawn)<warningRadius) 
						{
							if (verbose) WriteChatf("WARNING: %s within Radius!", pSpawn->Name);
							beeptype = 3; // play 1 times
						}
												// check guilds
						if (pauseOnGuild && Guild(pSpawn)) {
							if (verbose) WriteChatf("WARNING: Guild %s, player %s in zone!", GetGuildByID(pSpawn->GuildID), pSpawn->Name);
							beeptype = 1;
						}
 
Change
Code:
pGuildList->GuildName[pSpawn->GuildID]
into
Code:
GetGuildByID(pSpawn->GuildID)
 
That worked

Thanks guys for all the help that fixed it :)