• 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
Resource icon

Release MQ2RaidUtils (2 Viewers)

Joined
May 9, 2013
RedCents
6,290¢
Discussion for MQ2RaidUtils


Rich (BB code):
/***********************************************************************
**
** MQ2RaidUtils.cpp : Defines the entry point for the DLL application.
**
************************************************************************
**
** RaidUtils is inspired by the work Sorcier and the RaidManager macro
** posted in the www.macroquest2.com VIP forums.
**
** Purpose: The purpose of this plugin is to make leading raids a little
** easier by adding an "All" option dz/tasks add and remove commands.
**
** The secondary feature of this plugin is to take raid attendance.
**
** For Non-Raid leaders the option to automatically perform some related
** tasks such as joining chat channels or removing anon / role may be added
** later
**
************************************************************************
**
** Commands:
** /dzadd      <player1> ... <playerN> or "All" - Adds a list of players.
** /dzremove   <player1> ... <playerN> or "All" - Removes a list of players.
** /dzshow                                      - Shows players not in zone.
**
** /taskadd    <player1> ... <playerN> or "All" - Adds a list of players.
** /taskremove <player1> ... <playerN> or "All" - Removes a list of players.
** /taskshow                                    - Shows players not in zone.
**
** Configuration:
**
** /raidtools help                              - Show help
** /raidtools dump                              - Performs raid dump        
** /raidtools log on|off                        - Turns auto logging on/off
** /raidtools log File <name>  (1)            
** /raidtools log Times <str>   (2)
** /raidtools log Every <interval> (3)
**
** 1: The File name will be parsed using strftime the most common parameters are
**      %a   Abbreviated weekday name
**      %b   Abbreviated month name
**      %d    Day of month as decimal number (01 ? 31)
**      %H    Hour in 24-hour format (00 ? 23)
**      %m    Month as decimal number (01 ? 12)
**      %M    Minute as decimal number (00 ? 59)
**      %S    Seconds as decimal number (00 ? 61)
**      %Y    Year with century, as decimal number
**      %%    Percent sign
**    The name can also have the following
**      %G  Guild name
**      %V  Server name
**      %C  Character name
**      %P  Everquest path
**      %Q  Macroquest path
**  
** 2: The logTime format for exmpale Mon 20:00-23:00 | Tue 20:00-02:00 | Sun 11:00-15:00
**                            Tue 8pm-11pm, Wed 9pm-1am
**
** 3: The log interval is (1-60) and represents every N minutes dump the raid log.
**
************************************************************************/

#ifdef STUBIT
#include "MQ2Stub.h"
#define LOGTICKCOUNT  0
#else
#include "../MQ2Plugin.h"
#define LOGTICKCOUNT  110
#endif

PreSetup("MQ2RaidUtils");

int    IniLoaded = 0;

int    LogIsON = 0;
char   LogFileFormat[256];
char   LogFileName[1024];
char   LogTimes[256];
int    LogEvery = 30;

int    LogRaidStart[20];
int    LogRaidStop[20];
int    LogRaidTime[999];
int    LogRaidTimes = 0;
int    LogLastUpdated = 0;
time_t LogStartTime = 0;
struct tm *pTime;
int    LogTickCount = 0;

int    LogSaveChannel = 0;


char   RaidStartCmd[MAX_STRING];
char   RaidStopCmd[MAX_STRING];

static char rtLogFmt[] = "%P\\RaidRoster-%Y%m%d-%H%M%S.txt";      // default log format

typedef struct
{
   char *Name;
   int  inRaid;
   int  inDZ;
   int  inTask;
   int  inZone;
} trLIST, *tpLIST;

trLIST   RaidList[0x48];
char    *pTaskLeader = 0;
char     GroupList[6][0x40];



int cmpList (const void * a, const void * b)
{
   tpLIST pa = (tpLIST)a;
   tpLIST pb = (tpLIST)b;
   if (pa->Name == NULL && pb->Name == NULL)
      return 0;
   if (pa->Name == NULL)
      return 1;
   if (pb->Name == NULL)
      return -1;
   return stricmp( ((tpLIST)a)->Name, ((tpLIST)b)->Name );
}

static char OnStr[] = "On";
static char OffStr[] = "Off";

//                            0    1     2     3      4     5    6      7    8     9    10  11  12   13   14
static char *tokenList[] = { " ","am", "pm" , "sun","mon","tue","wed","thu","fri","sat","+","-","|",",", NULL};

void AddRaidTime(int startday,int starthr,int startmin,int stopday,int stophr,int stopmin)
{
   int max;
   int min;

   min = startday*3600 + starthr * 60 + startmin;
   max = stopday*3600  + stophr * 60  + stopmin;
  
   while ( min <= max && LogRaidTimes < 999)
   {
      LogRaidTime[ LogRaidTimes++ ] = min;
      min += LogEvery;
   }
}

void ParseRaidTimeStr(void)
{
   char argv[32];
   char szTimes[256];
   char *p = LogTimes;
   char *q = szTimes;
   int  argc=0;
   int  i,t;
   int  v[4],n;
   int  ln;
   int  day = 0;
   int  start = 0;
   int  stop = 0;
  
   LogRaidTimes = 0;

   while (p && *p)
      *q++ = tolower(*p++);
   *q++ = '|';
   *q++ = 0;

   memset(argv,0,sizeof(argv));
  
   p = szTimes;
  
   while (p && (*p == ' ' || *p == '\t')) p++;
  
   q = p;
   day = 0;
   n = v[0] = v[1] = v[2] = v[3] =  0 ;
  
   while (p && *p)
   {
      t  = -1;
      ln = 0;
      for (i=0; tokenList; i++)
      {
         if (strncmp(p,tokenList,strlen(tokenList))==0)
         {
            ln = strlen(tokenList);
            t=i;
         }
      }
      
      if (t==-1 && p && *p >= '0' && *p <= '9')
      {
         while ( (*p >= '0' && *p <= '9') || *p==':' )
         {
            if (*p == ':' && n < 4)
               n++;
            else
               v[n] = v[n] * 10 + *p - '0';
            p++;
         }
         t = 14;
      }
      
      if (t== 11 && n < 4)
         n=2;
         
      
      if (t!=-1)
      {
         p+= ln;

         if (t>= 3 && t <= 9)    // Mon-Fri
            day = t;
         
         if (t== 2)            // PM
         {
            if ( (n == 0 || n==1 ) && v[0] <= 12)
               v[0] += 12;
            if ( (n == 1 || n==2 ) && v[2] <= 12)
               v[2] += 12;
         }
         
         if (t==12 || t == 13)    // | or ,
         {
            int d2 = day;
            if (v[2] < v[0])
               d2 = day+1;
            AddRaidTime(day,v[0],v[1],d2,v[2],v[3]);
            day = n = v[0] = v[1] = v[2] = v[3] = 0;
         }
      }
      else
         p++;
   }
}   

void BuildLogFileName(void)
{
   char   TempFileFormat[1024];
   char  *pName = GetCharInfo()->Name;
   char  *pServ = EQADDR_SERVERNAME;
   char  *pGuild = GetGuildByID( GetCharInfo()->GuildID );
   char  *pEQPath = gszEQPath;
   char  *pMQPath = gszINIPath;

   char  *p = LogFileFormat;
   char  *q = TempFileFormat;
   char  *s = NULL;
   
   LogStartTime = time(NULL);
   pTime = localtime(&LogStartTime);
   
   // First pass copy string and replace %S,%G,%C with EQ specific info
   while (p && *p)
   {
      if (*p=='%')
      {
         switch (p[1])
         {
            case 'V':   p+=2; s = pServ;   break;
            case 'G':   p+=2; s = pGuild;   break;
            case 'C':   p+=2; s = pName;   break;
            case 'P':   p+=2; s = pEQPath;   break;
            case 'Q':   p+=2; s = pMQPath;   break;
            case '%':   *q++ = *p++;       // fall through to default
             default:   *q++ = *p++;      break;
         }
         
         while (s && *s) *q++ = *s++;
      }
      else
      {
         *q++ = *p++;
      }
   }
   *q++ = NULL;
   
//   WriteChatf("LogFileName before strftime = [%s]\n",TempFileFormat);
   strftime(LogFileName,1024,TempFileFormat,pTime);
//   WriteChatf("LogFileName after strftime = [%s]\n",LogFileName);
}

char *OnOffStr(int status)
{
   if (status)
      return OnStr;
   else
      return OffStr;
}

void ShowHelpStatus(int ShowHelp,int ShowStatus)
{
   if (ShowHelp) {
      WriteChatf("MQ2RaidUtils:: Task Command list");
      WriteChatf("  /dzAdd      [player|all]    : Adds group/raid members to dz");
      WriteChatf("  /taskAdd    [player|all]    : Adds group/raid members to task");
      WriteChatf("  /dzRemove   [player|all]    : Removes members of group/raid from dz");
      WriteChatf("  /taskRemove [player|all]    : Removes members of group/raid from task");
      WriteChatf("  /dzShow                     : Shows members who are not in zone");
      WriteChatf("  /taskShow                   : Shows members who are not in zone");
      WriteChatf("");
      WriteChatf("MQ2RaidUtils:: Raid Log Command list");
      WriteChatf("  /raidtools Log (on/off)      : turn on automatic raid dumps");
      WriteChatf("  /raidtools Log File <Format> : describe the log file name where:");
      WriteChatf("         %%G   Guild name");
      WriteChatf("         %%V   serVer name");
      WriteChatf("         %%C   Character name");
      WriteChatf("         %%P   Everquest Path");
      WriteChatf("         %%Q   MacroQuest path");
      WriteChatf("         %%a   Abbreviated weekday name");
      WriteChatf("         %%b   Abbreviated month name");
      WriteChatf("         %%d   Day of month as decimal number (01 - 31)");
      WriteChatf("         %%H   Hour in 24-hour format (00 - 23)");
      WriteChatf("         %%m   Month as decimal number (01 - 12)");
      WriteChatf("         %%M   Minute as decimal number (00 - 59)");
      WriteChatf("         %%S   Seconds as decimal number (00 - 59)");
      WriteChatf("         %%Y   Year with century, as decimal number");
      WriteChatf("  /raidtools Log Times <Format> : describes when to log");
      WriteChatf("            example: Mon 20:00-23:00 | Tue 20:00-02:00");
      WriteChatf("  /raidtools Log Every <Min>    : take raid dumps every M minutes");
      WriteChatf("-----------------------------------------------------------------------");
   }

   if (ShowStatus) {
      WriteChatf("MQ2RaidUtils:: Log Status");
      WriteChatf("  /raidtools Log (on/off) = [%s].",OnOffStr(LogIsON));   
      WriteChatf("  /raidtools Log File     = [%s]",LogFileFormat,LogFileName);   
      WriteChatf("             Actual File  = [%s]",LogFileName);   
      WriteChatf("  /raidtools Log Times    = [%s]",LogTimes);   
      WriteChatf("  /raidtools Log Every    = [%d] min",LogEvery);
   }
}

void LoadINIFile(void)
{
   char szTemp[256];
   char  *pName = GetCharInfo()->Name;
   
   LogFileName[0] = 0;
   GetPrivateProfileString(pName,"LogIsON"         ,"0"      ,szTemp         ,256,INIFileName);      LogIsON=atoi(szTemp);
   GetPrivateProfileString(pName,"LogEvery"      ,"30"      ,szTemp         ,256,INIFileName);      LogEvery=atoi(szTemp);
   GetPrivateProfileString(pName,"LogFileFormat"   ,rtLogFmt   ,LogFileFormat   ,256,INIFileName);   
   GetPrivateProfileString(pName,"LogTimes"      ,"none"      ,LogTimes      ,256,INIFileName);   
   BuildLogFileName();
   ParseRaidTimeStr();
   IniLoaded = TRUE;
}

int SaveINIFile(void)
{
   char  *pName = GetCharInfo()->Name;
   char  szTemp1[256];
   char  szTemp2[256];
   
   sprintf(szTemp1,"%d",LogIsON);
   sprintf(szTemp2,"%d",LogEvery);

   WritePrivateProfileString(pName, "LogIsON"      , szTemp1      , INIFileName);
   WritePrivateProfileString(pName, "LogEvery"      , szTemp2      , INIFileName);
   WritePrivateProfileString(pName, "LogFileFormat", LogFileFormat   , INIFileName);
   WritePrivateProfileString(pName, "LogTimes"      , LogTimes      , INIFileName);
   
   return 1;
}

int SetLog(int on)
{
   LogIsON = on;
   WriteChatf("  /raidtools Log (on/off) = [%s].",OnOffStr(LogIsON));   
   return (SaveINIFile());
}

int SetLogEvery(char *s)
{
   int t;
   if (!s) return 0;
   
   t = atoi(s);
   if (t >= 1 && t<=60)
   {
      LogEvery = t;
      ParseRaidTimeStr();
      WriteChatf("  /raidtools Log Every    = [%d] min",LogEvery);
      return (SaveINIFile());
   }
   return 0;
}      
   
int SetTimes(char *s)
{
   if (!s) return 0;
   strcpy(LogTimes,s);
   ParseRaidTimeStr();
   WriteChatf("  /raidtools Log Times    = [%s]",LogTimes);   
   return (SaveINIFile());
}

int SetFileName(char *s)
{
   if (!s) return 0;
   strcpy(LogFileFormat,s);
   BuildLogFileName();
   WriteChatf("  /raidtools Log File     = [%s]",LogFileFormat,LogFileName);   
   WriteChatf("             Actual File  = [%s]",LogFileName);   
   return (SaveINIFile());
}

void DoRaidDump(void);

void rtCommand(PSPAWNINFO pCHAR, PCHAR zLine)
{
   int  OK = 0;
   int  ShowHelp = 0;
   int  ShowStat = 0;

   char Arg1[MAX_STRING]; GetArg(Arg1,zLine,1);
   char Arg2[MAX_STRING]; GetArg(Arg2,zLine,2);
   char Arg3[MAX_STRING]; GetArg(Arg3,zLine,3);
   char *pArg3 = strstr(zLine,Arg3);
   
   if (stricmp(Arg1,"")==0)      ShowHelp = 1;
   if (stricmp(Arg1,"Help")==0)   ShowHelp = 1;
   if (stricmp(Arg1,"Status")==0)   ShowStat = 1;
   if (stricmp(Arg1,"Dump")==0)   DoRaidDump();
   
   if (stricmp(Arg1,"Log")==0)
   {
      if (stricmp(Arg2,"On")==0)      OK = SetLog(1);
      if (stricmp(Arg2,"Off")==0)      OK = SetLog(0);
      if (stricmp(Arg2,"Every")==0)    OK = SetLogEvery(pArg3);
      if (stricmp(Arg2,"Times")==0)   OK = SetTimes(pArg3);
      if (stricmp(Arg2,"File")==0)   OK = SetFileName(pArg3);
      if (!OK)                  ShowStat = 1;
   }
   ShowHelpStatus(ShowHelp ,ShowStat);
}      

void DoRaidDump(void)
{
   int i,m;
   char cmd[256];
   FILE *fp;
   EQRAIDMEMBER *p;
   BuildLogFileName();
   WriteChatf("RaidTools:: Taking raid attendance: %s",LogFileName);
   EzCommand("/popup Taking raid attendance");
   fp = fopen(LogFileName,"a");
   if (!fp)
   {
      WriteChatf("Failed to open %s , aborting log.",LogFileName);
      return;
   }
   if (pRaid && pRaid->RaidMemberCount>0)
      for (int m=0; m<72; m++)
         if (pRaid->RaidMemberUsed[m])
         {
            p = &pRaid->RaidMember[m];
            fprintf(fp,"%d\t%s\t%d\t%s\t%s\n",p->GroupNumber,p->Name,p->nLevel,ClassInfo[p->nClass].Name,p->RaidNote);
         }
   fprintf(fp,"------------------------\n");
   fclose(fp);
   LogSaveChannel = GetTickCount();

   m = 0;
   if(((PEVERQUEST)pEverQuest)->ChatService) m = ((PEVERQUEST)pEverQuest)->ChatService->ActiveChannels;

   for (i=1; i<=m; i++)
   {
      sprintf(cmd,"/timed 1 /list %d",i);
      EzCommand(cmd);
   }
   EzCommand("/timed 20 /");
}

void GetRaidList(PSPAWNINFO pCHAR, int ShowList)
{
   int m,n=0;
   int max=0;
   trLIST pKey[1],*pList;
   memset(RaidList,0,sizeof(RaidList));
   if (pRaid && pRaid->RaidMemberCount>0)
   {
      for (m=0; m<72; m++)
         if (pRaid->RaidMemberUsed[m])
         {
            RaidList[m].Name = pRaid->RaidMember[m].Name;
            RaidList[m].inRaid = 1;
            max++;
         }
   }
   else
   {
      PCHARINFO pChar=GetCharInfo();
      memset(GroupList,0,sizeof(GroupList));
      
      for (unsigned long i=0; i<6; i++)
      {
         if (pChar->pGroupInfo && pChar->pGroupInfo->pMember)
         {
            GetCXStr(pChar->pGroupInfo->pMember->pName,GroupList,MAX_STRING);
            RaidList.Name = (char *)GroupList;
         }
      }
   }
   
   
   qsort(RaidList,72, sizeof(trLIST), (int(*)(const void*,const void*)) cmpList);
   
   PDZMEMBER pDZList=(PDZMEMBER)pDZMember;
   while(pDZList)
   {
      pKey->Name = pDZList->Name;
      pList = (trLIST *)bsearch(pKey,RaidList, max, sizeof(trLIST) , (int(*)(const void*,const void*)) cmpList);
      if (pList)
         pList->inDZ = 1;
      else
      {
         RaidList[max+n].Name = pDZList->Name;
         RaidList[max+n].inDZ = 1;
         n++;
      }
      pDZList=pDZList->pNext;
   }
   max += n;
   n = 0;
   qsort(RaidList,72, sizeof(trLIST), (int(*)(const void*,const void*)) cmpList);

   pTaskLeader = 0;
   PTASKMEMBER pTaskList=(PTASKMEMBER)pTaskMember;
   while(pTaskList)
   {
      pKey->Name = pTaskList->Name;
      pList = (trLIST *)bsearch(pKey,RaidList, max, sizeof(trLIST) , (int(*)(const void*,const void*)) cmpList);
      if (pList)
         pList->inTask = 1;
      else
      {
         RaidList[max+n].Name = pTaskList->Name;
         RaidList[max+n].inTask = 1;
         n++;
      }
      if (pTaskList->IsLeader)
         pTaskLeader = pTaskList->Name;

      pTaskList=pTaskList->pNext;
   }
   max += n;
   n = 0;
   qsort(RaidList,72, sizeof(trLIST), (int(*)(const void*,const void*)) cmpList);
   
    PSPAWNINFO pSpawn=(PSPAWNINFO)pSpawnList;
    while(pSpawn)
    {
      if(pSpawn->Type==SPAWN_PLAYER)
      {
         pKey->Name = pSpawn->Name;
         pList = (trLIST *)bsearch(pKey,RaidList, max, sizeof(trLIST) , (int(*)(const void*,const void*)) cmpList);
         if (pList)
            pList->inZone = 1;
      }
      pSpawn=pSpawn->pNext;
    }
   
   if (ShowList)
   {
      WriteChatf("Raid Dz Task Zone Name ");
      for (m=0; m<72; m++)
         if (RaidList[m].Name)
            WriteChatf("%3d %3d %3d %4d  %s",RaidList[m].inRaid,RaidList[m].inDZ,RaidList[m].inTask,RaidList[m].inZone,RaidList[m].Name);
   }
}

// Stub for /dzAddPlayer <>
void rtDZAdd(PSPAWNINFO pCHAR, PCHAR zLine)
{
   int i;
   char arg[MAX_STRING];
   char cmd[MAX_STRING];

   if (strcmp((char*)instExpeditionLeader,pCHAR->Name)!=0)
   {
      WriteChatf("You are not the DZ Leader");
      return;
   }

   i = 1;
   GetArg(arg,zLine,i++);

   if (stricmp(arg,"all")==0 || stricmp(arg,"raid")==0)
   {
      GetRaidList(pCHAR,FALSE);
      for (i=0; i<72; i++)
      {
         if (RaidList.Name && !RaidList.inDZ)
         {
            sprintf(cmd,"/dzaddplayer %s",RaidList.Name);
            EzCommand(cmd);
         }
      }
      return;
   }

   while (arg[0]!=0)
   {
      sprintf(cmd,"/dzaddplayer %s",arg);
      EzCommand(cmd);
      GetArg(arg,zLine,i++);
   }
}

void rtDZRemove(PSPAWNINFO pCHAR, PCHAR zLine)
{
   int i;
   char arg[MAX_STRING];
   char cmd[MAX_STRING];

   if (strcmp((char*)instExpeditionLeader,pCHAR->Name)!=0)
   {
      WriteChatf("You are not the DZ Leader");
      return;
   }

   i = 1;
   GetArg(arg,zLine,i++);

   if (stricmp(arg,"all")==0 || stricmp(arg,"raid")==0)
   {
      GetRaidList(pCHAR,FALSE);
      for (i=0; i<72; i++)
      {
         if (RaidList.Name && RaidList.inDZ && stricmp(pCHAR->Name,RaidList.Name)!=0)
         {
            sprintf(cmd,"/dzremoveplayer %s",RaidList.Name);
            EzCommand(cmd);
         }
      }
      EzCommand("/dzquit");
      return;
   }

   while (arg[0]!=0)
   {
      sprintf(cmd,"/dzremoveplayer %s",arg);
      EzCommand(cmd);
      GetArg(arg,zLine,i++);
   }
}

void rtTaskAdd(PSPAWNINFO pCHAR, PCHAR zLine)
{
   int i;
   char arg[MAX_STRING];
   char cmd[MAX_STRING];

   GetRaidList(pCHAR,FALSE);

   if (!pTaskLeader || strcmp(pTaskLeader,pCHAR->Name)!=0)
   {
      WriteChatf("You are not the Task Leader");
      return;
   }

   i = 1;
   GetArg(arg,zLine,i++);

   if (stricmp(arg,"all")==0 || stricmp(arg,"raid")==0)
   {
      for (i=0; i<72; i++)
      {
         if (RaidList.Name && !RaidList.inTask)
         {
            sprintf(cmd,"/taskaddplayer %s",RaidList.Name);
            EzCommand(cmd);
            WriteChatf(cmd);
         }
      }
      return;
   }

   while (arg[0]!=0)
   {
      sprintf(cmd,"/taskaddplayer %s",arg);
      EzCommand(cmd);
      WriteChatf(cmd);
      GetArg(arg,zLine,i++);
   }
}

void rtTaskRemove(PSPAWNINFO pCHAR, PCHAR zLine)
{
   int i;
   char arg[MAX_STRING];
   char cmd[MAX_STRING];

   GetRaidList(pCHAR,FALSE);

   if (!pTaskLeader || strcmp(pTaskLeader,pCHAR->Name)!=0)
   {
      WriteChatf("You are not the Task Leader");
      return;
   }

   i = 1;
   GetArg(arg,zLine,i++);

   if (stricmp(arg,"all")==0 || stricmp(arg,"raid")==0)
   {
      for (i=0; i<72; i++)
      {
         if (RaidList.inTask && stricmp(pCHAR->Name,RaidList.Name)!=0)
         {
            sprintf(cmd,"/taskremoveplayer %s",RaidList.Name);
            EzCommand(cmd);
            WriteChatf(cmd);
         }
      }
      EzCommand("/taskquit");
      return;
   }

   while (arg[0]!=0)
   {
      sprintf(cmd,"/taskremoveplayer %s",arg);
      EzCommand(cmd);
      WriteChatf(cmd);
      GetArg(arg,zLine,i++);
   }
}

void rtShowMissing(PSPAWNINFO pCHAR, PCHAR zLine)
{
   int i;
   GetRaidList(pCHAR,TRUE);
   WriteChatf("------------------------");
   WriteChatf("Players not in Zone:");
   WriteChatf("Raid Dz Task Zone Name ");
   for (i=0; i<72; i++)
   {
      if (RaidList.Name && (RaidList.inDZ || RaidList.inTask) && !RaidList.inZone)
         WriteChatf("%3d %3d %3d %4d  %s",RaidList.inRaid,RaidList.inDZ,RaidList.inTask,RaidList.inZone,RaidList.Name);
   }
   WriteChatf("------------------------");
}





// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
   DebugSpewAlways("Initializing MQ2RaidUtils");
   
   AddCommand("/raidtools",rtCommand);
   AddCommand("/dzadd",rtDZAdd);
   AddCommand("/dzRemove",rtDZRemove);
   AddCommand("/dzShow",rtShowMissing);
   
   AddCommand("/taskAdd",rtTaskAdd);
   AddCommand("/taskRemove",rtTaskRemove);
   AddCommand("/taskShow",rtShowMissing);

   if (gGameState == GAMESTATE_INGAME)
      LoadINIFile();
}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
   DebugSpewAlways("Shutting down MQ2RaidUtils");

   RemoveCommand("/raidtools");
   RemoveCommand("/dzAdd");
   RemoveCommand("/dzRemove");
   RemoveCommand("/dzList");
   RemoveCommand("/taskAdd");
   RemoveCommand("/taskRemove");
   RemoveCommand("/taskList");

   RemoveCommand("/rtest");
}

PLUGIN_API VOID SetGameState(DWORD GameState)
{
   if(GameState==GAMESTATE_INGAME && IniLoaded==0)
      LoadINIFile();
}



// This is called every time MQ pulses
PLUGIN_API VOID OnPulse(VOID)
{
   int    n,t;
   static char cmd[256];

   LogTickCount++;
   if (LogTickCount < LOGTICKCOUNT)   
      return;

   LogTickCount=0;
   LogStartTime = time(NULL);
   pTime = localtime(&LogStartTime);
   // pTime->tm_wday (0=sun,1=mon,..) vs (3=sun,4=mon...
   
   t = (pTime->tm_wday + 3)*3600 + (pTime->tm_hour)*60 + (pTime->tm_min);
   for (n=0; n<LogRaidTimes; n++)
   {
      if ( t==LogRaidTime[n] && LogLastUpdated != t )
      {
         DoRaidDump();
         LogLastUpdated = t;
         return;
      }
   }
}

PLUGIN_API DWORD OnIncomingChat(PCHAR Line, DWORD Color)
{
   static int flag = 0;
   static int flag2 = 0;
   FILE *fp;
   char szTime[256];



   DebugSpewAlways("MQ2ChatFilter::OnIncomingChat(%s)",Line);

   if (gGameState==GAMESTATE_INGAME)
   {
      if (GetTickCount() - LogSaveChannel > 60000 )
         LogSaveChannel = 0;

      if (LogSaveChannel == 0) return NULL;



      if (strncmp(Line,"Players in EverQuest",10)==0 || flag2 )
      {
//         WriteChatf("[RT] (%s)",Line);

         fp = fopen(LogFileName,"a");
         if (fp)
         {
            if (flag2==0)   fprintf(fp,"\n");
            strftime(szTime,256,"[%a %b %d %H:%M:%S]",pTime);
            if (Line[0]=='-')
               fprintf(fp,"%s %s\n",szTime,"-------------------");
            else
               fprintf(fp,"%s %s\n",szTime,Line);
            fclose(fp);
         }

         flag2 = 1;
         if (strncmp(Line,"There are ",8)==0)
            flag2 = 0;
         return 1;
      }

      if (strncmp(Line,"Channel ",8)==0 || (flag && Line[0]==' ') )
      {
         flag++;

//         WriteChatf("[RT] (%s)",Line);

         fp = fopen(LogFileName,"a");
         if (fp)
         {
            if (Line[0]!=' ') fprintf(fp,"\n");
            strftime(szTime,256,"[%a %b %d %H:%M:%S]",pTime);
            fprintf(fp,"%s %s\n",szTime,Line);
            fclose(fp);
         }

         return 1;
      }
      else
         flag = 0;

   }
   return NULL;
}

#ifdef STUBIT

int main(int argc,char **argv)
{
   InitStub();
   InitializePlugin();
   SetGameState(GAMESTATE_INGAME);
   rtCommand(pCHAR,"help");
   rtCommand(pCHAR,"status");
//   rtCommand(pCHAR,"log on");

//   rtCommand(pCHAR,"log file %P\\RaidRoster-%Y%m%d-%H%M%S.txt");
//   rtCommand(pCHAR,"log every 1");
//   rtCommand(pCHAR,"log times fri 11am-2pm");
//   ParseRaidTimeStr();
//   OnPulse();
//   rtDZAdd(pCHAR,"all");
//   rtTaskAdd(pCHAR,"all");
   rtShowMissing(pCHAR,"all");

   ShutdownPlugin();
   return 0;
}

   
#endif 
 
Last edited by a moderator:
Hi Dewey and welcome. Redcented thanks for sharing.

Rich (BB code):
RaidUtils - this plugin is to make leading raids a little easier by adding an "All" option dz/tasks add and remove commands.

The secondary feature of this plugin is to take raid attendance.

For Non-Raid leaders the option to automatically perform some related tasks such as joining chat channels or removing anon / role may be added later

Commands:
/dzadd      <player1> ... <playerN> or "All" - Adds a list of players.
/dzremove   <player1> ... <playerN> or "All" - Removes a list of players.
/dzshow                                      - Shows players not in zone.

/taskadd    <player1> ... <playerN> or "All" - Adds a list of players.
/taskremove <player1> ... <playerN> or "All" - Removes a list of players.
/taskshow                                    - Sh${}ows players not in zone.

Configuration:

/raidtools help                              - Show help
/raidtools dump                              - Performs raid dump         
/raidtools log on|off                        - Turns auto logging on/off
/raidtools log File <name>  (1)             
/raidtools log Times <str>   (2)
/raidtools log Every <interval> (3)

1: The File name will be parsed using strftime the most common parameters are
     %a   Abbreviated weekday name
     %b   Abbreviated month name
     %d    Day of month as decimal number (01 ? 31)
     %H    Hour in 24-hour format (00 ? 23)
     %m    Month as decimal number (01 ? 12)
     %M    Minute as decimal number (00 ? 59)
     %S    Seconds as decimal number (00 ? 61)
     %Y    Year with century, as decimal number
     %%    Percent sign
   The name can also have the following
     %G  Guild name
     %V  Server name
     %C  Character name
     %P  Everquest path
     %Q  Macroquest path 
  
2: The logTime format for exmpale Mon 20:00-23:00 | Tue 20:00-02:00 | Sun 11:00-15:00
                           Tue 8pm-11pm, Wed 9pm-1am

3: The log interval is (1-60) and represents every N minutes dump the raid log.
 
MQ2RaidUtils -by dewey2461. This plugin is to make leading raids a little easier by adding an "All" option dz/tasks add and remove commands.

The secondary feature of this plugin is to take raid attendance.

For Non-Raid leaders the option to automatically perform some related tasks such as joining chat channels or removing anon / role may be added later

Commands:
/dzadd <player1> ... <playerN> or "All" - Adds a list of players.
/dzremove <player1> ... <playerN> or "All" - Removes a list of players.
/dzshow - Shows players not in zone.

/taskadd <player1> ... <playerN> or "All" - Adds a list of players.
/taskremove <player1> ... <playerN> or "All" - Removes a list of players.
/taskshow - Sh${}ows players not in zone.

Configuration:

/raidtools help - Show help
/raidtools dump - Performs raid dump
/raidtools log on|off - Turns auto logging on/off
/raidtools log File <name> (1)
/raidtools log Times <str> (2)
/raidtools log Every <interval> (3)

1: The File name will be parsed using strftime the most common parameters are
%a Abbreviated weekday name
%b Abbreviated month name
%d Day of month as decimal number (01 ? 31)
%H Hour in 24-hour format (00 ? 23)
%m Month as decimal number (01 ? 12)
%M Minute as decimal number (00 ? 59)
%S Seconds as decimal number (00 ? 61)
%Y Year with century, as decimal number
%% Percent sign
The name can also have the following
%G Guild name
%V Server name
%C Character name
%P Everquest path
%Q Macroquest path

2: The logTime format for exmpale Mon 20:00-23:00 | Tue 20:00-02:00 | Sun 11:00-15:00
Tue 8pm-11pm, Wed 9pm-1am

3: The log interval is (1-60) and represents every N minutes dump the raid log.

Updates for this plugin can be found in Macroquest2's VIP section, right here:
http://www.macroquest2.com/phpBB3/viewtopic.php?f=31&t=15899

If you don't have VIP on Macroquest2, you should donate immediately:
http://www.macroquest2.com/main.php?p=donate
 
Very cool plugin Dewey, thanks for sharing! I have been using it, and it works great. I had one question regarding the auto raid dump feature. Currently, it dumps a list of who is in raid, who is in each channel i am in, and who is in zone. Are there settings to disable some of this reporting? Thank you!
 
ChatWithThisName submitted a new resource:

MQ2RaidUtils - Makes leading raids a little easier by adding an "All" option dz/tasks add and remove commands.

MQ2RaidUtils -by dewey2461. This plugin is to make leading raids a little easier by adding an "All" option dz/tasks add and remove commands.

The secondary feature of this plugin is to take raid attendance.

For Non-Raid leaders the option to automatically perform some related tasks such as joining chat channels or removing anon / role may be added later

Commands:
/dzadd <player1> ... <playerN> or "All" - Adds a list of...

Read more about this resource...
 
Is that a old command? /kickp task /kickp exp are EQ commands (for over a decade) that do that as @Szazor pointed out...
 
@durango773 Looks like that's an MQ command, not an EQ one.

I'm also not familiar with it, but as others have said, I would do /kickp exp (from the dz leader) if you're trying to kick everyone from a raid dz as a workaround
 
@durango773 Looks like that's an MQ command, not an EQ one.

I'm also not familiar with it, but as others have said, I would do /kickp exp (from the dz leader) if you're trying to kick everyone from a raid dz as a workaround
I was asking if the one crashing him is a old MQ command...
 
Anyone reproducing this with mq2raidutils? Or has everyone stopped using that plugin?
 
it is crashing in pcClient.cpp at GetGroupMember

when being called with "GetGroupMember(0)"

C++:
CGroupMember* CGroupBase::GetGroupMember(int index) const
{
    if (index >= 0 && index < MAX_GROUP_SIZE)
        return m_groupMembers[index];

    return nullptr;
}

Exception thrown at 0x00007FF8EA15B9A8 (eqlib.dll) in eqgame.exe: 0xC0000005: Access violation reading location 0x0000000000000008.
 
Sic updated MQ2RaidUtils with a new update entry:

06/06/2026

〰️Commits​


PR # [1](https://github.com/RedGuides/MQ2RaidUtils/pull/1): to using the game's class description
(c0f7693) ~Sic
Switch to using the game's class description
- Instead of using the ClassInfo table, get the class description from the game
- This will hae the downstream impact of changing "Mage" to "Magician" and "Shadowknight" to "Shadow...

Read the rest of this update entry...
 
Release MQ2RaidUtils

Users who are viewing this thread

Back
Top
Cart