Post Reply Home » Forums » EverQuest 1 » EQ1 EverQuest 1 Submissions

PLUGIN: MQ2AutoSize - Automatically resize PC's in range : EQ1 EverQuest 1 Submissions

Posted: March 26th, 2006
psycotick
This plugin for MQ2 will allow you to resize everyone within a certain radius from you, and once they're out of that range, they'll return to normal. This is mainly useful on tight quarter raids, as the NPC's are not shrunk. I hope soneone else out there finds this useful.

This has been posted elsewhere as well, but was 99% written by me. (The class SizeFunc was borrowed from MQ2Size, but I have no idea who originally authored it)

Attached is the compiled DLL file..

Code: Select all

// MQ2AutoSize.cpp : Automatically Shrink PC's within specific Range (Client Only!)
//
// version 0.9.4 (by Psycotic)
//
//////////////////////////////////////////////////////////////////////////////
// Usage:
//   This plugin will automatically shrink everyone within range down to minimum
//   allowed size.   They will automatically resize back to normal when they move
//   out of range.  (Current range is set at 50' - adjust with Range settings in INI)
//   NOTE:  These effects are CLIENT SIDE ONLY!
//
// Commands:
//  /autosize              - Toggles AutoSizing on/off 
//  /autosizeall           - Toggles AutoSizing for whole zone
//  /autosize -range ##    - Sets the range for AutoSize
//
// Known Issues/ToDo:
// 
//  - Add the ability to resize self (toggle)
//
//////////////////////////////////////////////////////////////////////////////


#include "../MQ2Plugin.h" 

PreSetup("MQ2AutoSize"); 

#define SKIP_PULSES 5

long SkipPulse = 0;
long RANGE = 50;

bool AutoSizeOn=true;
bool AutoSizeAllOn=false;
bool ShrinkPets=true;

char ShrinkSize[MAX_STRING]="1";
char PetSize[MAX_STRING]="1";
char GrowSize[MAX_STRING]="0";
char psyTemp[MAX_STRING];
class SizeClass 
{ 
    public: 
        void SizeFunc(float); 
}; 

// Offset: 3-15-06
FUNCTION_AT_ADDRESS(void SizeClass::SizeFunc(float), 0x4F2A90 );  

VOID LoadConfig(VOID)
{
    GetPrivateProfileString("Config","Range","NULL",psyTemp,MAX_STRING,INIFileName);
    RANGE = atol(psyTemp);
    GetPrivateProfileString("Config","Size","NULL",ShrinkSize,MAX_STRING,INIFileName);
    GetPrivateProfileString("Config","PetSize","NULL",PetSize,MAX_STRING,INIFileName);
    GetPrivateProfileString("Config","AutoSize",NULL,psyTemp,MAX_STRING,INIFileName);
    if (!strcmp(psyTemp, "on"))
    {
        AutoSizeOn = true;
    }
    else
    {
        AutoSizeOn = false;
    }
    GetPrivateProfileString("Config","AutoSizeAll",NULL,psyTemp,MAX_STRING,INIFileName);
    if (!strcmp(psyTemp, "on"))
    {
        AutoSizeAllOn = true;
    }
    else
    {
        AutoSizeAllOn = false;
    }
    GetPrivateProfileString("Config","ShrinkPets",NULL,psyTemp,MAX_STRING,INIFileName);
    if (!strcmp(psyTemp, "on"))
    {
        ShrinkPets = false;
    }
    else
    {
        ShrinkPets = true;
    }
}

VOID AutoSize(PSPAWNINFO pChar, PCHAR psyLine)
{
    CHAR Arg1[MAX_STRING] = {0}; GetArg(Arg1,psyLine,1);
    CHAR Arg2[MAX_STRING] = {0}; GetArg(Arg2,psyLine,2);
    if ((!strcmp(Arg1, "-range")) && (strcmp(Arg2,"")))
    {
        RANGE = atoi(Arg2);
        sprintf(psyTemp, "AutoSize: Range now set to %i", RANGE);
        WriteChatColor(psyTemp, CONCOLOR_YELLOW);
    }
    else
    if (AutoSizeOn) 
    {
        AutoSizeOn = false;
        WriteChatColor("AutoSize (Range) now disabled!", CONCOLOR_YELLOW);
    }
    else
    {
        AutoSizeOn = true;
        AutoSizeAllOn = false;
        WriteChatColor("AutoSize (Range) now enabled!", CONCOLOR_YELLOW);
        WriteChatColor("AutoSize (AllZone) now disabled!", CONCOLOR_YELLOW);
    }
}


VOID Size(PSPAWNINFO pChar, CHAR Size[MAX_STRING]) 
{
PSPAWNINFO Char = (PSPAWNINFO)pChar; 
PSPAWNINFO pSpawn = (PSPAWNINFO)pSpawnList;

    if ((strcmp(pChar->DisplayedName, GetCharInfo()->pSpawn->DisplayedName) != 0))
    {
            ((SizeClass*)Char)->SizeFunc((float)atof(Size)); 
    }

}

VOID ReSizeAll(CHAR DoSize[MAX_STRING], CHAR DoPetSize[MAX_STRING])
{
    PSPAWNINFO pSpawn = (PSPAWNINFO)pSpawnList;
        while (pSpawn) 
        {
            if ((pSpawn->Type == SPAWN_PLAYER) && (pSpawn->Type != SPAWN_CORPSE))
            {
                    Size(pSpawn, DoSize);
            }
            if ((GetSpawnType(pSpawn)==PET) && (!ShrinkPets))
            {
                Size(pSpawn, DoPetSize);
            }
            pSpawn = pSpawn->pNext;
        }
    
}

VOID AutoSizeAll(PSPAWNINFO pChar, PCHAR psyLine)
{
    if (AutoSizeAllOn) 
    {
        AutoSizeAllOn = false;
        ReSizeAll("0", "0");
        WriteChatColor("AutoSize (AllZone) now disabled!", CONCOLOR_YELLOW);
    }
    else
    {
        AutoSizeAllOn = true;
        AutoSizeOn = false;
        WriteChatColor("AutoSize (AllZone) now enabled!", CONCOLOR_YELLOW);
        WriteChatColor("AutoSize (Range) now disabled!", CONCOLOR_YELLOW);
        ReSizeAll(ShrinkSize, PetSize);
    }
}

PLUGIN_API VOID OnPulse(PSPAWNINFO pChar, PCHAR psyLine)
{
float Dist;
    if (SkipPulse == SKIP_PULSES)
    if ((!AutoSizeAllOn) && (gGameState==GAMESTATE_INGAME))
    {
        SkipPulse = 0;
        PSPAWNINFO pSpawn = (PSPAWNINFO)pSpawnList;
        while (pSpawn) 
        {
            if ((pSpawn->Type == SPAWN_PLAYER) && (pSpawn->Type != SPAWN_CORPSE))
            {
                Dist = GetDistance(GetCharInfo()->pSpawn,pSpawn);                
                if ((Dist <= RANGE) && (AutoSizeOn))
                {
                    Size(pSpawn, ShrinkSize);
                } 
                else
                {
                    if (Dist <= (RANGE+50))
                    {
                        Size(pSpawn, "0");
                    }
                }
            }
            if ((GetSpawnType(pSpawn)==PET) && (!ShrinkPets))
            {
                Dist = GetDistance(GetCharInfo()->pSpawn,pSpawn);                
                if ((Dist <= RANGE) && (AutoSizeOn))
                {
                    Size(pSpawn, PetSize);
                } 
                else
                {
                    if (Dist <= (RANGE+50))
                    {
                        Size(pSpawn, "0");
                    }
                }
            }

            pSpawn = pSpawn->pNext;
        }
    }
    SkipPulse++;
}

PLUGIN_API VOID InitializePlugin(VOID) 
{ 
    AddCommand("/autosize",AutoSize);
    AddCommand("/autosizeall",AutoSizeAll);
    sprintf(psyTemp, "AutoSize Loaded");
    WriteChatColor(psyTemp, CONCOLOR_YELLOW);
    LoadConfig();
} 


PLUGIN_API VOID ShutdownPlugin(VOID) 
{ 
    RemoveCommand("/autosize"); 
    RemoveCommand("/autosizeall");
    ReSizeAll("0", "0");
}
And the MQ2AutoSize.ini

Code: Select all

# "Range" is the radius in feet that will be shrunk
# "Size" is the size they will be shrunk down to
# "AutoSize"  on = will shrink everyone within "Range"
# "AutoSizeAll"  on = will shrink everyone in zone upon zone-in
# "ShrinkPets" = Toggle to shrink pets along with PC's

[Config]
Range=50
Size=2
PetSize=1
AutoSize=on
AutoSizeAll=off
ShrinkPets=on


You do not have the required permissions to view the files attached to this post.
Ready to join the community? Click here and see all of the benefits!
blue large dotWho is online
Users browsing this forum: No registered users and 16 guests