Logo
live-news-icon

Noticias

Tema: Premiar com Coins por tempo online - MUEMU

Applayo

  • *
Premiar com Coins por tempo online - MUEMU | en: Abril 25, 2021, 12:28:49 am »

Opa!

    Resolvi postar esse código que será de boa utilidade para muitos, tem ele na internet porém fiz pequenas modificações para deixar o código com uma funcionalidade melhor.

    Bom, no seu projeto GameServer, abra o arquivo CashShop.cpp, procure pela função void CCashShop::MainProc e dentro da função pesquise por:

Código: [Seleccionar]
    if((GetTickCount()-lpObj->CashShopGoblinPointTime) >= ((DWORD)gServerInfo.m_CashShopCoinsDelay*60000))   
Selecione essa linha e substitua por:


Código: [Seleccionar]
    if(gServerInfo.m_CashShopCoinsDelay >= 1)
    {
    if((GetTickCount()-lpObj->CashShopGoblinPointTime) >= ((DWORD)gServerInfo.m_CashShopCoinsDelay*60000))
    {


    lpObj->CashShopGoblinPointTime = GetTickCount();
    this->GDCashShopAddPointSaveSend(lpObj->Index,0,gBonusManager.GetBonusValue(lpObj,BONUS_I NDEX_GLOBIN_POINT,gServerInfo.m_CashShopWCoinCValu e[lpObj->AccountLevel],-1,-1,-1,-1),
    gBonusManager.GetBonusValue(lpObj,BONUS_INDEX_GLOB IN_POINT,gServerInfo.m_CashShopWCoinPValue[lpObj->AccountLevel],-1,-1,-1,-1),
    gBonusManager.GetBonusValue(lpObj,BONUS_INDEX_GLOB IN_POINT,gServerInfo.m_CashShopGoblinPointValue[lpObj->AccountLevel],-1,-1,-1,-1));
    this->CGCashShopPointRecv(lpObj->Index);


    if(gServerInfo.m_CashShopWCoinCValue[lpObj->AccountLevel] >= 1)
    {
    gNotice.GCNoticeSend(lpObj->Index,1,0,0,0,0,0,gMessage.GetMessage(862),gServe rInfo.m_CashShopWCoinCValue[lpObj->AccountLevel]);
    }


    if(gServerInfo.m_CashShopWCoinPValue[lpObj->AccountLevel] >= 1)
    {
    gNotice.GCNoticeSend(lpObj->Index,1,0,0,0,0,0,gMessage.GetMessage(863),gServe rInfo.m_CashShopWCoinPValue[lpObj->AccountLevel]);
    }

    if(gServerInfo.m_CashShopGoblinPointValue[lpObj->AccountLevel] >= 1)
    {
    gNotice.GCNoticeSend(lpObj->Index,1,0,0,0,0,0,gMessage.GetMessage(864),gServe rInfo.m_CashShopGoblinPointValue[lpObj->AccountLevel]);
    }
    }

    }


    em ServerInfo.h, em public, adicione as seguintes linhas:


Código: [Seleccionar]
    int m_CashShopCoinsDelay;
    int m_CashShopWCoinCValue[MAX_ACCOUNT_LEVEL];
    int m_CashShopWCoinPValue[MAX_ACCOUNT_LEVEL];
    int m_CashShopGoblinPointValue[MAX_ACCOUNT_LEVEL];


    em ServerInfo.cpp procure por CServerInfo::ReadCashShopInfo(char* section,char* path) e adicione as linhas:


Código: [Seleccionar]
    this->m_CashShopCoinsDelay = GetPrivateProfileInt(section,"CashShopCoinsDelay", 0,path);


    this->m_CashShopWCoinCValue[0] = GetPrivateProfileInt(section,"CashShopWCoinCValue_ AL0",0,path);


    this->m_CashShopWCoinCValue[1] = GetPrivateProfileInt(section,"CashShopWCoinCValue_ AL1",0,path);


    this->m_CashShopWCoinCValue[2] = GetPrivateProfileInt(section,"CashShopWCoinCValue_ AL2",0,path);


    this->m_CashShopWCoinCValue[3] = GetPrivateProfileInt(section,"CashShopWCoinCValue_ AL3",0,path);


    this->m_CashShopWCoinPValue[0] = GetPrivateProfileInt(section,"CashShopWCoinPValue_ AL0",0,path);


    this->m_CashShopWCoinPValue[1] = GetPrivateProfileInt(section,"CashShopWCoinPValue_ AL1",0,path);


    this->m_CashShopWCoinPValue[2] = GetPrivateProfileInt(section,"CashShopWCoinPValue_ AL2",0,path);


    this->m_CashShopWCoinPValue[3] = GetPrivateProfileInt(section,"CashShopWCoinPValue_ AL3",0,path);


    this->m_CashShopGoblinPointValue[0] = GetPrivateProfileInt(section,"CashShopGoblinPointV alue_AL0",0,path);


    this->m_CashShopGoblinPointValue[1] = GetPrivateProfileInt(section,"CashShopGoblinPointV alue_AL1",0,path);


    this->m_CashShopGoblinPointValue[2] = GetPrivateProfileInt(section,"CashShopGoblinPointV alue_AL2",0,path);


    this->m_CashShopGoblinPointValue[3] = GetPrivateProfileInt(section,"CashShopGoblinPointV alue_AL3",0,path);

    No arquivo GameServerInfo.dat - Common.dat, procure por Cash Shop Settings e substitua todas as linhas por:

Código: [Seleccionar]
    CashShopSwitch = 1
    CashShopScriptVersion1 = 512
    CashShopScriptVersion2 = 2011
    CashShopScriptVersion3 = 6
    CashShopBannerVersion1 = 583
    CashShopBannerVersion2 = 2010
    CashShopBannerVersion3 = 5
    CashShopCoinsDelay = 2 // Tempo (em minutos) para ser premiado
    CashShopWCoinCValue_AL0 = 0
    CashShopWCoinCValue_AL1 = 0
    CashShopWCoinCValue_AL2 = 0
    CashShopWCoinCValue_AL3 = 0
    CashShopWCoinPValue_AL0 = 0
    CashShopWCoinPValue_AL1 = 0
    CashShopWCoinPValue_AL2 = 0
    CashShopWCoinPValue_AL3 = 0
    CashShopGoblinPointValue_AL0 = 0
    CashShopGoblinPointValue_AL1 = 0
    CashShopGoblinPointValue_AL2 = 0
    CashShopGoblinPointValue_AL3 = 0


    No seu arquivo Message.txt, adicione as linhas:

Código: [Seleccionar]
    862 "[Online Reward Coin] Você ganhou WC: %d"
    863 "[Online Reward Coin] Você ganhou WP: %d"
    864 "[Online Reward Coin] Você ganhou GP: %d"


    E fim!

    Explicando melhor esse código:

    Se o usuário quiser premiar só com GoblinPoints, basta ele colocar qualquer valor igual ou acima de 1 nas linhas CashShopGoblinPointValue e deixar nas outras 0 (outras: CashShopWCoinPValue e CashShopWCoinCValue que nem a mensagem aparece e nem o usuário será premiado. E vice-versa
    Qualquer dúvida pode postar que responderei

Créditos: Almdar (código original), Denis (modificações básicas)

paofu

  • *
Re: Premiar com Coins por tempo online - MUEMU | Respuesta #1 en: Abril 30, 2021, 12:26:32 am »

There is an extension shopcoins

robins1998

  • *
Re: Premiar com Coins por tempo online - MUEMU | Respuesta #2 en: Mayo 27, 2021, 02:25:42 am »

Very helpful, thanks for sharing.


Responder Marcar No Leido Enviar Topic Print