Plugin: MQ2Rez

Yeah, it was the text addition. It's removed, and Vlad has been sent the updated source. It should be in the next update of the zip.
 
Is there any way to get the looting speed back to where it used to be? Since sony fucked it up and the loot process as well. Or is that a packet thing and we have to live with it?
 
Err...is the /lootall command not fast enough?

One command to loot them all! Sauron said that it was good enough...
 
They nerfed the speed of the /lootall command. SOE did at least. No biggie, they will eventually get back to changing it again.

I was looking at the code we had tried for the caster message, and the strtok and other functions were returning pointers, which was the main issue with the code I believe. the function could not handle the pointer conversion, and kept crashing.

I figured out the code for doing the messaging on who is casting the rez on you. It ain't pretty, but it works :) Here is the modified source code:

Code:
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
// Project: MQ2Rez.cpp
// Author: TheZ, made from an amalgamation of dewey and s0rcier's code
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//

#include "../MQ2Plugin.h"
PreSetup("MQ2Rez");
#include <map>

long       SetBOOL(long Cur, PCHAR Val, PCHAR Sec="", PCHAR Key="");
long       SetLONG(long Cur, PCHAR Val, PCHAR Sec="", PCHAR Key="", bool ZeroIsOff=false);
void       WinClick(CXWnd *Wnd, PCHAR ScreenID, PCHAR ClickNotification, DWORD KeyState=0);
int        AutoRezPct     = 0;        // Take Rez %
int        ClickWait      = 0;
int        LootWait       = 0;
DWORD      Initialized    = false;             // Plugin Initialized?
long       LootMeHandle   = false;    // LootMe Handle?
long       AutoRezAccept  = false;    // Take Rez box?
long       AutoRezSpawn   = false;    // Let respawn window time out or port to bind.
long       RezDone        = false;
long       RezClicked     = false;
long       RezCommandOn   = false;
char       szCommand[MAX_STRING];

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//

void WinClick(CXWnd *Wnd, PCHAR ScreenID, PCHAR ClickNotification, DWORD KeyState) {
  if(Wnd) if(CXWnd *Child=Wnd->GetChildItem(ScreenID)) {
    BOOL KeyboardFlags[4];
    *(DWORD*)&KeyboardFlags=*(DWORD*)&((PCXWNDMGR)pWndMgr)->KeyboardFlags;
    *(DWORD*)&((PCXWNDMGR)pWndMgr)->KeyboardFlags=KeyState;
    SendWndClick2(Child,ClickNotification);
    *(DWORD*)&((PCXWNDMGR)pWndMgr)->KeyboardFlags=*(DWORD*)&KeyboardFlags;
  }
}

long SetLONG(long Cur,PCHAR Val, PCHAR Sec, PCHAR Key, bool ZeroIsOff,long Maxi) {
  char ToStr[16]; char Buffer[128]; long Result=atol(Val);
  if(Result && Result>Maxi) Result=Maxi; itoa(Result,ToStr,10);
  if(Sec[0] && Key[0]) WritePrivateProfileString(Sec,Key,ToStr,INIFileName);
  sprintf(Buffer,"%s::%s (\ag%s\ax)",Sec,Key,(ZeroIsOff && !Result)?"\aroff":ToStr);
  WriteChatColor(Buffer);
  return Result;
}

long SetBOOL(long Cur, PCHAR Val, PCHAR Sec, PCHAR Key) {
  char buffer[128]; long result=0;
  if(!strnicmp(Val,"false",5) || !strnicmp(Val,"off",3) || !strnicmp(Val,"0",1))    result=0;
  else if(!strnicmp(Val,"true",4) || !strnicmp(Val,"on",2) || !strnicmp(Val,"1",1)) result=1;
  else result=(!Cur)&1;
  if(Sec[0] && Key[0]) WritePrivateProfileString(Sec,Key,result?"1":"0",INIFileName);
  sprintf(buffer,"%s::%s (%s)",Sec,Key,result?"\agon\ax":"\agoff\ax");
  WriteChatColor(buffer);
  return result;
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//

BOOL IsWindowOpen(PCHAR WindowName){
   PCSIDLWND pWnd=(PCSIDLWND)FindMQ2Window(WindowName);
   if (!pWnd) return false;
   return (BOOL)pWnd->Show;
}

int ExpRezBox() {
   CXWnd *Child;
   CXWnd *pWnd;
   char InputCXStr[128],*p,CasterName[32];
   int v, i;

   pWnd=(CXWnd *)FindMQ2Window("ConfirmationDialogBox");
   if(pWnd) {
      if (((PCSIDLWND)(pWnd))->Show==0) return -1;
      Child=pWnd->GetChildItem("cd_textoutput");
      if(Child) {
         ZeroMemory(InputCXStr,sizeof(InputCXStr));
         GetCXStr(Child->SidlText,InputCXStr,sizeof(InputCXStr));
         p = strstr(InputCXStr,"attempting to return you");
		 if (p) {
			 for (i=0; i <= sizeof(InputCXStr); i++ ) {
				 if (InputCXStr[i] == ' ') break;
				 CasterName[i] = InputCXStr[i];
			 }
			 WriteChatf("Accepting Rez from %s", CasterName);
			 return 0;
		 }
         p = strstr(InputCXStr,"(");
         if (!p) return -1;
         v = atoi(p+1);
         p = strstr(p,"percent");
         if (!p) return -1;
		 for (i=0; i <= sizeof(InputCXStr); i++ ) {
			if (InputCXStr[i] == ' ') break;
			CasterName[i] = InputCXStr[i];
		 }
		 WriteChatf("Accepting Rez from %s", CasterName);
         return v;
      }
   }
   return -1;
}
void AutoRezCommand(PSPAWNINFO pCHAR, PCHAR zLine) {
   bool ShowInfo=false;
   bool NeedHelp=false;
  char Parm1[MAX_STRING];
  char Parm2[MAX_STRING];
  GetArg(Parm1,zLine,1);
  GetArg(Parm2,zLine,2);

  if(!stricmp("help",Parm1)) NeedHelp=true;
//Accept rez?
  else if(!stricmp("accept",Parm1) && (!stricmp("on",Parm2)))
     AutoRezAccept=SetBOOL(AutoRezAccept ,Parm2 ,"MQ2Rez","Accept");
  else if(!stricmp("accept",Parm1) && (!stricmp("off",Parm2)))
     AutoRezAccept=SetBOOL(AutoRezAccept ,Parm2,"MQ2Rez","Accept");
//What percent?
  else if(!stricmp("pct",Parm1)) {
     WritePrivateProfileString("MQ2Rez","RezPct",Parm2,INIFileName);
     AutoRezPct=atoi(Parm2);
  }
//Should I spawn first?
  else if(!stricmp("spawn",Parm1) && (!stricmp("on",Parm2)))
     AutoRezSpawn=SetBOOL(AutoRezSpawn ,Parm2 ,"MQ2Rez","Spawn");
  else if(!stricmp("spawn",Parm1) && (!stricmp("off",Parm2)))
     AutoRezSpawn=SetBOOL(AutoRezSpawn ,Parm2,"MQ2Rez","Spawn");
//Should I loot my corpse?
  else if(!stricmp("loot",Parm1) && (!stricmp("on",Parm2)))
        LootMeHandle=SetBOOL(LootMeHandle ,Parm2 ,"MQ2Rez","Active");
  else if(!stricmp("loot",Parm1) && !stricmp("off",Parm2))
        LootMeHandle=SetBOOL(LootMeHandle ,Parm2,"MQ2Rez","Active");
//Do I want a command executed after being rezed?
  else if(!stricmp("command",Parm1) && !stricmp("on",Parm2))
        RezCommandOn=SetBOOL(RezCommandOn ,Parm2,"MQ2Rez","RezCommandOn");
  else if(!stricmp("command",Parm1) && !stricmp("off",Parm2))
        RezCommandOn=SetBOOL(RezCommandOn ,Parm2,"MQ2Rez","RezCommandOn");
//What command should I execute?
 else if(!stricmp("setcommand",Parm1)) {
      WritePrivateProfileString("MQ2Rez","Command Line",Parm2,INIFileName);
      WriteChatf("Command set to: \ag%s\ax",Parm2);
  }
//Help??
  else if(!stricmp("",Parm1))
  {
     ShowInfo=TRUE;
     NeedHelp=TRUE;
  }
  if(NeedHelp) {
   WriteChatColor("Usage:");
   WriteChatColor("/rez -> displays settings");
   WriteChatColor("/rez accept on|off -> Toggle auto-accepting rezbox");
   WriteChatColor("/rez spawn  on|off -> Toggles going to bind point after death");
   WriteChatColor("/rez pct # -> Autoaccepts rezes only if they are higher than # percent");
   WriteChatColor("/rez loot on|off -> Toggle looting corpse when opened and when rezzed");
   WriteChatColor("/rez command on|off -> Toggle use of a command after looting out corpse");
   WriteChatColor("/rez setcommand mycommand -> Set the command that you want.");
   WriteChatColor("/rez help");
  }
  if (ShowInfo)
  {
     WriteChatf("MQ2Rez Accept(\ag%s\ax).",(AutoRezAccept?"on":"off"));
     WriteChatf("MQ2Rez Spawn(\ag%s\ax).",(AutoRezSpawn?"on":"off"));
     WriteChatf("MQ2Rez Loot(\ag%s\ax).",(LootMeHandle?"on":"off"));
     WriteChatf("MQ2Rez AcceptPct(\ag%d\ax).",AutoRezPct);
     WriteChatf("MQ2Rez Command(\ag%s\ax).",(RezCommandOn?"on":"off"));
     WriteChatf("Command line set to: \ag%s\ax",szCommand);
  }
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//

PLUGIN_API VOID SetGameState(DWORD GameState) {
  if(GameState==GAMESTATE_INGAME && !Initialized) {
      Initialized=true;
      sprintf(INIFileName,"%s\\%s_%s.ini",gszINIPath,EQADDR_SERVERNAME,GetCharInfo()->Name);
      LootMeHandle =GetPrivateProfileInt("MQ2Rez","Active" ,0,INIFileName);
      AutoRezAccept=GetPrivateProfileInt("MQ2Rez","Accept" ,0,INIFileName);
      AutoRezSpawn =GetPrivateProfileInt("MQ2Rez","Spawn"  ,0,INIFileName);
      AutoRezPct   =GetPrivateProfileInt("MQ2Rez","RezPct" ,0,INIFileName);
      RezCommandOn =GetPrivateProfileInt("MQ2Rez","RezCommandOn" ,0,INIFileName);
      GetPrivateProfileString("MQ2Rez","Command Line","DISABLED",szCommand,MAX_STRING,INIFileName);
      if(!strcmp(szCommand,"DISABLED")) RezCommandOn = false;
  } else if(GameState!=GAMESTATE_LOGGINGIN && Initialized) {
      LootMeHandle=0;
      Initialized=0;
  }
}

VOID Rezzy(PSPAWNINFO pChar, PCHAR szLine) {
    DoCommand(GetCharInfo()->pSpawn,"/squelch /notify RespawnWnd RW_OptionsList listselect 2");
    DoCommand(GetCharInfo()->pSpawn,"/squelch /notify RespawnWnd RW_SelectButton leftmouseup");
    RezClicked = false;
    ClickWait = 0;
    RezDone = true;
}

PLUGIN_API VOID InitializePlugin() {
  AddCommand("/rezzme",Rezzy);
  AddCommand("/rez",AutoRezCommand);
}

PLUGIN_API VOID ShutdownPlugin() {
  RemoveCommand("/rez");
  RemoveCommand("/rezzme");
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//

PLUGIN_API VOID OnPulse() {
    if (AutoRezSpawn && IsWindowOpen("RespawnWnd")) {
        WinClick(FindMQ2Window("RespawnWnd"),"RW_SelectButton","leftmouseup",1);
        return;
    }
    if (AutoRezAccept && ExpRezBox()>=AutoRezPct){
        WriteChatColor("Accepting Rez now");
        DoCommand(GetCharInfo()->pSpawn,"/notify ConfirmationDialogBox Yes_Button leftmouseup");
        RezClicked = true;
    }
    if (RezClicked && ClickWait>35) {
        DoCommand(GetCharInfo()->pSpawn,"/squelch /notify RespawnWnd RW_OptionsList listselect 2");
        DoCommand(GetCharInfo()->pSpawn,"/squelch /notify RespawnWnd RW_SelectButton leftmouseup");
        ClickWait=0;
        RezClicked=false;
        RezDone = true;
        return;
    } else if(RezClicked) {
        ClickWait++;
        return;
    }

    if (RezDone && LootWait>35) {
        DoCommand(GetCharInfo()->pSpawn,"/target mycorpse");
        DoCommand(GetCharInfo()->pSpawn,"/corpse");
        if(LootMeHandle)DoCommand(GetCharInfo()->pSpawn,"/lootall");
        LootWait=0;
        RezDone=false;
        if(RezCommandOn)HideDoCommand(GetCharInfo()->pSpawn, szCommand, FromPlugin);
        return;
    } else if(RezDone) {
        LootWait++;
        return;
    }
}
 

Attachments

  • MQ2Rez.dll
    132 KB · Views: 11
I posted on the official page for the compile but, MQ2rez is nto working with the 2 feb comile. it says out of date with respect to mq2main.
We are about to get another patch anyways just thought i'd note it.
 
They nerfed the speed of the /lootall command. SOE did at least. No biggie, they will eventually get back to changing it again.

I was looking at the code we had tried for the caster message, and the strtok and other functions were returning pointers, which was the main issue with the code I believe. the function could not handle the pointer conversion, and kept crashing.

I figured out the code for doing the messaging on who is casting the rez on you. It ain't pretty, but it works :) Here is the modified source code:

Sorry to resurrect an old post, but did this code work for getting who cast rez on you?
 
It work, but I am not sure if it has been merged into the MMO source. Let me see who we can talk to about that :)
 
for some reason I am crashing when I get a rez. Something i'm doing wrong? I am using mq2rez from the most recent compile. Here's what I have loaded.
And when I am setting up mq2rez I ctd. it's always /rez accept on = CTD
Any Ideas?

Edit: seems like if I /rez loot on .... Then /rez accept on ... it doesnt crash me. But when the rez lands I CTD, if that helps anything.
[Plugins]
mq2mmobugs=mq2mmobugs
mq2labels=mq2labels
mq2itemdisplay=mq2itemdisplay
mq2custombinds=mq2custombinds
mq2hud=mq2hud
mq2fps=mq2fps
mq2map=mq2map
mq2chatwnd=mq2chatwnd
mq2eqbugfix=mq2eqbugfix
mq2docrack=mq2docrack
mq2moveutils=mq2moveutils
mq2exchange=mq2exchange
mq2mmowarp=mq2mmowarp
mq2reachit=mq2reachit
mq2piggyzone=mq2piggyzone
mq2bzsrch=mq2bzsrch
mq2gmcheck=mq2gmcheck
mq2feedme=mq2feedme
mq2wickedspeed=mq2wickedspeed
mq2mmofastmem=mq2mmofastmem
mq2cast=mq2cast
mq2autoaccepttrades=mq2autoaccepttrades
mq2pop=mq2pop
mq2debuffs=mq2debuffs
mq2netheal=mq2netheal
mq2netbots=mq2netbots
mq2autogroup=mq2autogroup
mq2stealth=mq2stealth
mq2linkdb=mq2linkdb
mq2melee=mq2melee
mq2autodestroy=mq2autodestroy
mq2gzone=mq2gzone
mq2rez=mq2rez
 
Wish I could help, but you'll have to talk to WickedMofo or someone...I've got zero ability to test/work with this plugin, since I've been out of EQ for more than a year.
 
Is something broke with this plugin? When a toon autoaccepts a rez it warps the corpse to somewhere in the middle of the map and I cant /sum or warp to it and /loot. It gives me this corpse is to far away. I end up having to zone to the Guild Lobby and summon every time if it's plugged in. Any ideas?
 
am gone for the weekend but I will check this out when I get back
 
I thought we had traced it down to the delay on accepting rez - it was trying to corpsedrag before you actually were in the zone. So some check on actually either zoning in might be a fix for it. Usually from hover mode it works right, I mostly see it when I am zoning in during a rez.
 
if you use the alias /rezme you dont have that issue it just wont auto loot
 
I will look at it later. I have seen a few issues looting corpses lately (not just my own, but mobs I've killed, stood over and tried to loot and gave me that error). /Faded and tried to loot and it worked fine. Will try /rezme when I get home later though.
 
/rezme works fine, its when I come home and all are dead, I /zone to the spot with the cleric and rez people. The toons that have a rez accept incorporated into the macro do just fine, it's the ones that use autorez that I have to go to GL and summon.
 
are the ones that autoaccept using the PLUGIN or the Alias... They are 2 different functions that do same thing.


Also the corpse looting issue is annoying but I only notice it when more then 4 items on a corpse. anything after the 3rd/4th item doesn't get initially updated so it only does a loop grabbing first 3/4 items.
 
I am assuiming it is the plugin. It is loaded on all toons but the toons that have certain macros' running IE Cleric and Shaman never have a problem.
 
Update! Do *not* use the /rezzme command. I've edited it out of the copy of the source on the first page, and it will hopefully be removed from the compile soon. It causes a nasty bug that leaves an invalid corpse that can't be decayed and doesn't fade, and basically points a big fat finger at you that says, "Fuck my account, please!".