Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[SHARE] Money Potion. Happy New Year

Banned
Banned
Joined
May 22, 2020
Messages
226
Reaction score
72
Header: s_NetGlobal.h
C++:
NET_MSG_GCTRL_INVEN_MONEYPOTION                    = (NET_MSG_GCTRL + 3078), //change to yours
NET_MSG_GCTRL_INVEN_MONEYPOTION_FB                = (NET_MSG_GCTRL + 3079), //change to yours

Header: GLItemDef.h
Find: EMITEM_TYPE
Add:
Code:
ITEM_MONEYPOTION        = 89,    /*money potion, Jeey-, 23/12/27*/ change to yours

Header: GLContrlInvenMsg.h
Find: EMNPCSHOP_PURCHASE_FB
Add below or above 'EMNPCSHOP_PURCHASE_FB'
Code:
/*money potion, Jeey- 23/12/27*/
enum EMCONSUME_MONEYPOTION_FB
{
    EMCONSUME_MONEYPOTION_FB_FAIL        = 0,
    EMCONSUME_MONEYPOTION_FB_SUCCESS    = 1,
    EMCONSUME_MONEYPOTION_FB_NOITEM        = 2,
    EMCONSUME_MONEYPOTION_FB_COOLTIME    = 3,
};

same header: GLContrlInvenMsg.h
scroll down til you reach the bottom, and add
Code:
/*money potion, Jeey- 23/12/27*/
    struct SNET_INVEN_MONEYPOTION
    {
        NET_MSG_GENERIC            nmg;
        WORD                    wPosX;
        WORD                    wPosY;
        LONGLONG                lnMoney;

        SNET_INVEN_MONEYPOTION()
            : wPosX(0)
            , wPosY(0)
            , lnMoney(0)
        {
            nmg.dwSize = sizeof(SNET_INVEN_MONEYPOTION);
            nmg.nType = NET_MSG_GCTRL_INVEN_MONEYPOTION;
            GASSERT(nmg.dwSize <= NET_DATA_BUFSIZE);
        }
    };

    /*money potion, Jeey- 23/12/27*/
    struct SNET_INVEN_MONEYPOTION_FB
    {
        NET_MSG_GENERIC            nmg;
        EMCONSUME_MONEYPOTION_FB emFB;

        SNET_INVEN_MONEYPOTION_FB() :
            emFB(EMCONSUME_MONEYPOTION_FB_FAIL)
        {
            nmg.dwSize = sizeof(SNET_INVEN_MONEYPOTION_FB);
            nmg.nType = NET_MSG_GCTRL_INVEN_MONEYPOTION_FB;
            GASSERT(nmg.dwSize <= NET_DATA_BUFSIZE);
        }
    };

Header: GLCharacter.h
Find: ReqInvenToWear
Add above or below 'ReqInvenToWear'
Code:
/*money potion, Jeey-, 23/12/27*/
    HRESULT ReqMoneyPotion( WORD wPosX, WORD wPosY );

CPP: GLCharactorReq2.cpp
Find: HRESULT GLCharacter::ReqInvenToWear ( WORD wPosX, WORD wPosY )
Add above or below 'HRESULT GLCharacter::ReqInvenToWear ( WORD wPosX, WORD wPosY )'
Code:
/*money potion, Jeey-, 23/12/27*/
HRESULT GLCharacter::ReqMoneyPotion( WORD wPosX, WORD wPosY )
{
    SINVENITEM* pInvenItem = m_cInventory.FindPosItem(wPosX, wPosY);
    if ( !pInvenItem )    return E_FAIL;

    wPosX = pInvenItem->wPosX;
    wPosY = pInvenItem->wPosY;

    SITEM* pItem = GLItemMan::GetInstance().GetItem(pInvenItem->sItemCustom.sNativeID);
    if ( !pItem )    return E_FAIL;

    LONGLONG llnMoney = (LONGLONG)pItem->sBasicOp.dwSellPrice;

    GLMSG::SNET_INVEN_MONEYPOTION NetMsg;
    NetMsg.wPosX = wPosX;
    NetMsg.wPosY = wPosY;
    NetMsg.lnMoney = llnMoney;
    NETSENDTOFIELD(&NetMsg);
    return S_OK;
}

Header: GLChar.h
Find: HRESULT MsgAllVehicleEnableBooster( NET_MSG_GENERIC* nmg );
Add below or above 'HRESULT MsgAllVehicleEnableBooster( NET_MSG_GENERIC* nmg );'
Code:
/*money potion, Jeey-, 23/12/27*/
    HRESULT MsgReqMoneyPotion(NET_MSG_GENERIC* nmg);

CPP: GLCharInvenMsg2.cpp
Find: HRESULT GLChar::MsgReqInvenToWear ( NET_MSG_GENERIC* nmg )
Add below or above 'HRESULT GLChar::MsgReqInvenToWear ( NET_MSG_GENERIC* nmg )'
Code:
/*money potion, Jeey-, 23/12/27*/
HRESULT GLChar::MsgReqMoneyPotion(NET_MSG_GENERIC* nmg)
{
    GLMSG::SNET_INVEN_MONEYPOTION* pNetMsg = (GLMSG::SNET_INVEN_MONEYPOTION*)nmg;
    GLMSG::SNET_INVEN_MONEYPOTION_FB pNetMsgFB;

    SINVENITEM* pINVENITEM = m_cInventory.GetItem(pNetMsg->wPosX, pNetMsg->wPosY);
    if ( !pINVENITEM )
    {
        pNetMsgFB.emFB = EMCONSUME_MONEYPOTION_FB_NOITEM;
        GLGaeaServer::GetInstance().SENDTOCLIENT(m_dwClientID, &pNetMsgFB);
        return E_FAIL;
    }

    if ( CheckCoolTime(pINVENITEM->sItemCustom.sNativeID) )
    {
        pNetMsgFB.emFB = EMCONSUME_MONEYPOTION_FB_COOLTIME;
        GLGaeaServer::GetInstance().SENDTOCLIENT(m_dwClientID, &pNetMsgFB);
        return E_FAIL;
    }

    SITEM* pITEM = GLItemMan::GetInstance().GetItem(pINVENITEM->sItemCustom.sNativeID);
    if ( pITEM->sBasicOp.emItemType != ITEM_MONEYPOTION )
    {
        pNetMsgFB.emFB = EMCONSUME_MONEYPOTION_FB_NOITEM;
        GLGaeaServer::GetInstance().SENDTOCLIENT(m_dwClientID, &pNetMsgFB);
        return E_FAIL;
    }

    DoDrugInvenItem( pNetMsg->wPosX, pNetMsg->wPosY );

    CheckMoneyUpdate(m_lnMoney, pNetMsg->lnMoney, TRUE, "Money Potion Money Update");
    m_bMoneyUpdate = TRUE;

    m_lnMoney += pNetMsg->lnMoney;

    GLMSG::SNETPC_UPDATE_MONEY NetMsgMoney;
    NetMsgMoney.lnMoney = m_lnMoney;
    GLGaeaServer::GetInstance().SENDTOCLIENT(m_dwClientID, &NetMsgMoney);

    pNetMsgFB.emFB = EMCONSUME_MONEYPOTION_FB_SUCCESS;
    GLGaeaServer::GetInstance().SENDTOCLIENT(m_dwClientID, &pNetMsgFB);

    return S_OK;
}

CPP: GLCharMsg.cpp
Find: case NET_MSG_GCTRL_INVEN_UNLOCK_FOOD: MsgReqUnlockFood( nmg ); break;
Add below
Code:
/*money potion, Jeey-, 23/12/27*/
    case NET_MSG_GCTRL_INVEN_MONEYPOTION:        MsgReqMoneyPotion( nmg );            break;

CPP: GLGaeaClient.cpp and DxGlobalStage.cpp
Find: NET_MSG_GCTRL_PKCOMBO_BRD
Add below or above 'NET_MSG_GCTRL_PKCOMBO_BRD'
Code:
/*money potion, Jeey-, 23/12/27*/
    case NET_MSG_GCTRL_INVEN_MONEYPOTION:
    case NET_MSG_GCTRL_INVEN_MONEYPOTION_FB:

CPP: GLGaeaServerMsg.cpp
Find: case NET_MSG_GCTRL_PING_PACKET:
Add below or above 'case NET_MSG_GCTRL_PING_PACKET: '

Code:
/*money potion, Jeey-, 23/12/27*/
    case NET_MSG_GCTRL_INVEN_MONEYPOTION:

NOTE: Don't forget to declare the ITEM_MONEYPOTION in comment.ini

CPP: GLCharactorReq.cpp
Find: else if ( pItem->sBasicOp.emItemType == ITEM_CARD_BIKECOLOR )
Add below or above 'else if ( pItem->sBasicOp.emItemType == ITEM_CARD_BIKECOLOR )'

Code:
else if ( pItem->sBasicOp.emItemType == ITEM_MONEYPOTION )
        {
            ReqMoneyPotion( wPosX, wPosY );
        }

GUI: Gameintext

Code:
<SENTENSE Ver="1" Id="EMCONSUME_MONEYPOTION_FB_FAIL">
        <VALUE Lang="Common">Money Potion Consume Failed</VALUE>
    </SENTENSE>
    <SENTENSE Ver="1" Id="EMCONSUME_MONEYPOTION_FB_SUCCESS">
        <VALUE Lang="Common">Money Potion Consume Success</VALUE>
    </SENTENSE>
    <SENTENSE Ver="1" Id="EMCONSUME_MONEYPOTION_FB_NOITEM">
        <VALUE Lang="Common">Money Potion Consume Failed. Invalid Item</VALUE>
    </SENTENSE>
    <SENTENSE Ver="1" Id="EMCONSUME_MONEYPOTION_FB_COOLTIME">
        <VALUE Lang="Common">Money Potion Consume Failed. Cool down time</VALUE>
    </SENTENSE>

CPP: GLCharacterMsg.cpp
Find: case NET_MSG_GCTRL_UPDATE_CP:
Add above or below 'case NET_MSG_GCTRL_UPDATE_CP:'

Code:
/*money potion, Jeey-, 23/12/27*/
    case NET_MSG_GCTRL_INVEN_MONEYPOTION_FB:
    {
        GLMSG::SNET_INVEN_MONEYPOTION_FB* pNetMsgFB = (GLMSG::SNET_INVEN_MONEYPOTION_FB*)nmg;

        switch (pNetMsgFB->emFB)
        {
        case EMCONSUME_MONEYPOTION_FB_FAIL:
            CInnerInterface::GetInstance().PrintMsgText(NS_UITEXTCOLOR::DISABLE, ID2GAMEINTEXT("EMCONSUME_MONEYPOTION_FB_FAIL"));
            break;
        case EMCONSUME_MONEYPOTION_FB_SUCCESS:
            CInnerInterface::GetInstance().PrintMsgText(NS_UITEXTCOLOR::DISABLE, ID2GAMEINTEXT("EMCONSUME_MONEYPOTION_FB_SUCCESS"));
            break;
        case EMCONSUME_MONEYPOTION_FB_NOITEM:
            CInnerInterface::GetInstance().PrintMsgText(NS_UITEXTCOLOR::DISABLE, ID2GAMEINTEXT("EMCONSUME_MONEYPOTION_FB_NOITEM"));
            break;
        case EMCONSUME_MONEYPOTION_FB_COOLTIME:
            CInnerInterface::GetInstance().PrintMsgText(NS_UITEXTCOLOR::DISABLE, ID2GAMEINTEXT("EMCONSUME_MONEYPOTION_FB_COOLTIME"));
            break;
        default:
            break;
        }
    }break;
 
Last edited:
Banned
Banned
Joined
May 22, 2020
Messages
226
Reaction score
72
Use Case: It's a gold coin, rather than only selling it gives another option whether sell it or use it(using right click)
 
Back
Top