EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Changes for setinstflag and setinstflagmanually (https://www.eqemulator.org/forums/showthread.php?t=26506)

Rocker8956 10-13-2008 04:40 PM

Changes for setinstflag and setinstflagmanually
 
Sorry for all the changes to the quest code but I want to standardize the ones I wrote with the ones that are already in the code. Also, the below changes will allow me to rewrite some code later (when I have time) to reduce database access without changing the Perl syntax (again).

Below are the changes to the two quest commands
setinstflag and setinstflagmanually

The new quest syntax is
setinstflagmanually(orginalZoneID, instFlag, type)
or
setinstflag(orginalZoneID, type)

Zone\questmgr.h
Change
Code:

       
void setinstflag(int charID, int orgZoneID, int type);
void setinstflagmanually(int charID, int orgZoneID, int instFlag, int type);

To
Code:

           
void setinstflag(int orgZoneID, int type);
void setinstflagmanually(int orgZoneID, int instFlag, int type);

zone\questmgr.cpp
Replace QuestManager::setinstflag with
Code:

void QuestManager::setinstflag(int orgZoneID, int type)
{
        int instFlag = database.getCurInstFlagNum();

        if (type == 0)
        {
                database.setCharInstFlag(initiator->CharacterID(), orgZoneID, instFlag);
                database.incrCurInstFlagNum(instFlag); // Increment the curInstFlagNum
        }
        else if(type == 1)
        {
                database.setGroupInstFlagNum(initiator->CharacterID(), orgZoneID, instFlag);
                database.incrCurInstFlagNum(instFlag); // Increment the curInstFlagNum
        }
        else if(type == 2)
        {
                database.setRaidInstFlagNum(initiator->CharacterID(), orgZoneID, instFlag);
                database.incrCurInstFlagNum(instFlag); // Increment the curInstFlagNum
        }
        else if(type == 3)
        {
                database.setCharInstFlag(initiator->CharacterID(), orgZoneID, instFlag);
                database.setGroupInstFlagNum(initiator->CharacterID(), orgZoneID, instFlag);
                database.setRaidInstFlagNum(initiator->CharacterID(), orgZoneID, instFlag);
                database.incrCurInstFlagNum(instFlag); // Increment the curInstFlagNum
        }
}

zone\questmgr.cpp
Replace setinstflagmanually function with

Code:

void QuestManager::setinstflagmanually(int orgZoneID, int instFlag, int type)
{
        if (type == 0)
        {
                database.setCharInstFlag(initiator->CharacterID(), orgZoneID, instFlag);
        }
        else if(type == 1)
        {
                database.setGroupInstFlagNum(initiator->CharacterID(), orgZoneID, instFlag);
        }
        else if(type == 2)
        {
                database.setRaidInstFlagNum(initiator->CharacterID(), orgZoneID, instFlag);
        }
        else if(type == 3)
        {
                database.setCharInstFlag(initiator->CharacterID(), orgZoneID, instFlag);
                database.setGroupInstFlagNum(initiator->CharacterID(), orgZoneID, instFlag);
                database.setRaidInstFlagNum(initiator->CharacterID(), orgZoneID, instFlag);
        }
}

Zone\perlparser.cpp
Replace XS(XS__setinstflag) function with

Code:

XS(XS__setinstflag);
XS(XS__setinstflag)
{
        dXSARGS;
        if (items != 3)
                Perl_croak(aTHX_ "Usage: setinstflag(orginalZoneID, type)");

        int                orgZoneID = (int)SvIV(ST(0));
        int                type = (int)SvIV(ST(1));

        quest_manager.setinstflag(orgZoneID, type);

        XSRETURN_EMPTY;
}

Zone\perlparser.cpp
Replace XS(XS__setinstflagmanually) function with

Code:

XS(XS__setinstflagmanually);
XS(XS__setinstflagmanually)
{
        dXSARGS;
        if (items != 3)
                Perl_croak(aTHX_ "Usage: setinstflagmanually(orginalZoneID, instFlag, type)");

        int                orgZoneID = (int)SvIV(ST(0));
        int                instFlag = (int)SvIV(ST(1));
        int                type = (int)SvIV(ST(2));

        quest_manager.setinstflagmanually(orgZoneID, instFlag, type);

        XSRETURN_EMPTY;
}



All times are GMT -4. The time now is 09:28 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.