ServersMU - Comunidad
Zona Programadores => Sources => Mensaje iniciado por: Applayo 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:
if((GetTickCount()-lpObj->CashShopGoblinPointTime) >= ((DWORD)gServerInfo.m_CashShopCoinsDelay*60000))
Selecione essa linha e substitua por:
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:
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:
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:
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:
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)
-
There is an extension shopcoins
-
Very helpful, thanks for sharing.