Plugin: MQ2Languages

htw

Developer
Joined
Aug 27, 2006
Messages
13,193
Reaction score
374
Points
83
Location
Albuquerque, NM
Just something I putzed together when bored. Doesn't require an offset update (ala docrack).

Code:
// MQ2Languages.cpp : Defines the entry point for the DLL application. 

#include "../MQ2Plugin.h" 

PreSetup("MQ2Languages"); 

CHAR szSettingINISection[MAX_STRING] = {0}; 
BOOL       LangInit = FALSE, LAutoLoad, GlobalSettings;
BYTE       languages[MAX_LANGUAGES];
INT        LMaxLanguages;
char *LanguageNames[MAX_LANGUAGES] = { "Common", "Barbarian", "Erudian", "Elvish", "Dark Elvish", "Dwarvish", "Troll", "Ogre",
									   "Gnomish", "Halfling", "Thieves Cant", "Old Erudian", "Elder Elvish", "Froglok", "Goblin",
									   "Gnoll", "Combine Tongue", "Elder Tier'Dal", "Lizardman", "Orcish", "Faerie", "Dragon",
									   "Elder Dragon", "Dark Speech", "Vah Shir", "Unknown", "Unknown", "Unknown", "Unknown",
									   "Unknown", "Unknown", "Unknown" };

void ReadINI() 
{ 
   CHAR Buffer[MAX_STRING] = {0}; 

   if(!pCharData)
	   return;
   strcpy(szSettingINISection,"Settings");
   GlobalSettings = 0x00000001 & GetPrivateProfileInt(szSettingINISection,"UseGlobalSettings", 1,INIFileName);
   if (!GlobalSettings)
      sprintf(szSettingINISection,"Settings_%s_%s",EQADDR_SERVERNAME,((PCHARINFO)pCharData)->Name); 
   LAutoLoad = 0x00000001 & GetPrivateProfileInt(szSettingINISection,"AutoLoad", 1, INIFileName);
   LMaxLanguages = GetPrivateProfileInt(szSettingINISection,"MaxLanguages", MAX_LANGUAGES, INIFileName);
} 

void WriteINI()
{
   CHAR szBuffer[MAX_STRING] = {0}; 

   if(!pCharData)
	   return;
   strcpy(szSettingINISection,"Settings");
   WritePrivateProfileString(szSettingINISection,"UseGlobalSettings", itoa(GlobalSettings, szBuffer, 10),INIFileName); 
   if(!GlobalSettings)
      sprintf(szSettingINISection,"Settings_%s_%s",EQADDR_SERVERNAME,((PCHARINFO)pCharData)->Name); 
   WritePrivateProfileString(szSettingINISection,"AutoLoad", itoa(LAutoLoad, szBuffer, 10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"MaxLanguages", itoa(LMaxLanguages, szBuffer, 10),INIFileName); 
}

VOID SetLanguages(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   DebugSpewAlways("MQ2Languages::SetLanguages()"); 
   CHAR Arg1[MAX_STRING] = {0};
   GetArg(Arg1,szLine,1); 
   CHAR szDebug[MAX_STRING] = {0}; 
   int MaxLang, i; 

   if (Arg1[0]==0) { 
	   WriteChatf("MQ2Languages Usage:");
	   WriteChatf("       /setlang max       Sets all languages to 100 skill");
	   WriteChatf("       /setlang reset     Resets back to character known langauges array");
	   WriteChatf("       /setlang global    Toggles whether to use per-char settings, or global settings");
	   WriteChatf("       /setlang show      Displays current settings and language skills");
	   WriteChatf("       /setlang save      Saves current settings to ini file");
	   WriteChatf("       /setlang ##        Sets first ## of languages to 100 skill");
       WriteChatf("       Ex: /setlang 10 (current max is # of languages is %u)", MAX_LANGUAGES);
       return; 
   } 
   if(!stricmp(Arg1, "reset")) {
	   if (gGameState==GAMESTATE_INGAME && LangInit && pCharData) {
           memcpy(((PCHARINFO)pCharData)->languages, &languages, sizeof(languages));
	       WriteChatf("Language skills reset to char defaults.");
	   }
	   else
		   WriteChatf("Language array not initialized (char not in game?).");
   }
   else if(!stricmp(Arg1, "auto")) {
	   LAutoLoad = 1 & ~LAutoLoad;
	   WriteChatf("Auto loading of language skills is now: %s", LAutoLoad?"ON":"OFF");
   }
   else if(!stricmp(Arg1, "global")) {
	   GlobalSettings = 1 & ~GlobalSettings;
	   WriteChatf("MQ2Languages is %s using global settings for character languages.", GlobalSettings?"now":"not");
   }
   else if(!stricmp(Arg1, "show")) {
	   WriteChatf("MQ2Languages settings:");
	   WriteChatf("    Global Settings: %s", GlobalSettings?"ON":"OFF");
	   WriteChatf("    Auto Load:       %s", LAutoLoad?"ON":"OFF");
	   WriteChatf("    Max Languages:   %u", LMaxLanguages);
	   WriteChatf("");
	   WriteChatf("    Current Language Skills:");
	   for(i=0;i<MAX_LANGUAGES;i++)
		   WriteChatf("        #%u: %s (%u)", i+1, LanguageNames[i], ((PCHARINFO)pCharData)->languages[i]);
   }
   else if(!stricmp(Arg1, "save")) {
	   WriteINI();
	   WriteChatf("MQ2Languages settings saved.");
   }
   else {
	  if(!stricmp(Arg1, "max"))
	     MaxLang=MAX_LANGUAGES;
	  else if(!stricmp(Arg1, "ini"))
		  MaxLang=LMaxLanguages;
      else
	     MaxLang=atoi(Arg1); 
      if (MaxLang<2 || MaxLang>MAX_LANGUAGES) { 
	     sprintf(szDebug, "Parameter not within limits. (2-%d)", MAX_LANGUAGES);
         WriteChatColor(szDebug, USERCOLOR_DEFAULT); 
         return; 
      }
      for (i=0; i<MaxLang; i++)
          ((PCHARINFO)pCharData)->languages[i] = 100; 
	  for (i=MaxLang; i<MAX_LANGUAGES; i++)
		  ((PCHARINFO)pCharData)->languages[i] = 0;
	  WriteChatf("Language skills set:  %u languages to skill 100.", MaxLang);
	  LMaxLanguages = MaxLang;
   }
} 

PLUGIN_API VOID InitializePlugin(VOID) 
{ 
	DebugSpewAlways("MQ2Languages::InitializePlugin(): Initializing MQ2Languages"); 
	AddCommand("/setlang",SetLanguages);
    if (gGameState==GAMESTATE_INGAME && !LangInit && pCharData) {
       memcpy(&languages, ((PCHARINFO)pCharData)->languages, sizeof(languages));
	   LangInit = TRUE;
	   ReadINI();
	   if(LAutoLoad)
		   SetLanguages(NULL, "ini");
	}
} 

PLUGIN_API VOID ShutdownPlugin(VOID) 
{ 
	DebugSpewAlways("MQ2Languages::ShutdownPlugin(): Shutting Down MQ2Languages"); 
	if (gGameState==GAMESTATE_INGAME && LangInit && pCharData) {
		SetLanguages(NULL, "reset");
		WriteINI();
	}
	RemoveCommand("/setlang");
} 

PLUGIN_API VOID OnEndZone(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	DebugSpewAlways("MQ2Languages::OnEndZone()"); 
    if (gGameState==GAMESTATE_INGAME && !LangInit && pCharData) {
       memcpy(&languages, ((PCHARINFO)pCharData)->languages, sizeof(languages));
	   LangInit = TRUE;
	   ReadINI();
	   if(LAutoLoad)
		   SetLanguages(NULL, "ini");
	}
}

Note: Attached .dll compiled against MQ2-MMOBugs20060910c-Source
 
Last edited by a moderator:
Hmm
Using this plus the language trainer, I am not seeing skill ups for the languages beyond the base 25 I already knew. It seems to stop on the additional ones up to the 32 max.

I also dont see any indication that the additional 7 are there. :confused:

I am running the MQ2Language.dll and it loaded successfully, as well as modified the language macro to have 32.

#turbo also doesnt seem to be working :( (Also wasnt working before the Aug 9 patch)

Tips? Ideas?
 
Are you trying to learn languages? If so, a simple macro would help. Just have a box toon or a friend that already has mq2 run it.
 
I already have all 25 main languages maxxed on my main and alt, but I am trying to get the additional ones beyond 25.

I am running this plugin, as well as the Army spam mac.
http://www.mmobugs.com/forums/everquest-macroquest2-macros-huds-uis/1740-lang-mac.html

In essence using this plugin it shows 32 enabled, but when it gets to 26-32, it stays on 25, and then returns to the start languages. I get no training and or skillups in the additional languages.

I was thinking if I ran the plugin, that would give me the basic skill to get the languages started on one of the three toons I am running.
 
There are 25, I think FV has a 26th.
 
I'd swear Psychotic wrote something like this a few years ago. I like the way you did it though. Nice. Now I see it was HTW.
 
Last edited:
WOW, 3 years ago I posted it... time flies! When I first saw title, I was like wtf, I did not make any such post... ;)

htw
 
Alzheimers settling in lol.
Just get some viagra and hold your......... you'll be alright hehe. :D
 
What exactly does this plugin do? I've searched the FAQ and it's not in it. Please enlighten me oh great coders!
 
From a quick look at the code, it seems like it allows you to set your language skills (client side only) so that you are able to understand chat from different in-game languages that you don't know.
 
It's almost the same as the one I put in compile, but I made a few changes to it. The source is in the source dist if anyone wants.

It allows you to speak/understand all available languages.

htw
 
a quick read through, i think it basically lets you read any language, regardless of whether or not you have the skill to read it. since that information is done client side.

*EDIT* i posted without realised was a second page... N00b?
 
Last edited: