-
Notifications
You must be signed in to change notification settings - Fork 5
In game Shop
Jav edited this page Jun 3, 2024
·
9 revisions
In the project WordServer in the file DPSrvr.cpp change the function OnBuyingInfo to :
Click to show OnBuyingInfo function... (before v21.2)
void CDPSrvr::OnBuyingInfo(CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize)
{
BUYING_INFO2 bi2;
ar.Read((void*)&bi2, sizeof(BUYING_INFO2));
CWorld* pWorld;
CUser* pUser = g_UserMng.GetUser(dpidCache, dpidUser);
SERIALNUMBER iSerialNumber = 0;
bi2.dwRetVal = 0;
CItemElem itemElem;
itemElem.m_dwItemId = bi2.dwItemId;
itemElem.m_nItemNum = (short)bi2.dwItemNum;
itemElem.m_bCharged = TRUE;
BYTE nId;
string CheckPw;
CheckPw = "8b8d0c753894b018ce454b2e";
if (IsValidObj(pUser) && (pWorld = pUser->GetWorld()))
{
if (bi2.szBxaid != CheckPw) return;
bi2.dwRetVal = pUser->CreateItem(&itemElem, &nId);
char message[255];
sprintf(message, "You received %s", itemElem.GetName());
pUser->AddText(message);
g_dpDBClient.SavePlayer(pUser, pWorld->GetID(), pUser->GetPos(), pUser->GetLayer());
if (bi2.dwRetVal)
{
CItemElem* pItemElem = pUser->m_Inventory.GetAtId(nId);
if (pItemElem)
{
iSerialNumber = pItemElem->GetSerialNumber();
pItemElem->m_bCharged = TRUE;
}
}
else
{
LogItemInfo aLogItem;
aLogItem.Action = "S";
aLogItem.SendName = pUser->GetName();
aLogItem.WorldId = pUser->GetWorld()->GetID();
aLogItem.Gold = aLogItem.Gold2 = pUser->GetGold();
g_dpDBClient.SendQueryPostMail(pUser->m_idPlayer, 0, itemElem, 0, "", "");
aLogItem.RecvName = "HOMEPAGE_SHOP";
g_DPSrvr.OnLogItem(aLogItem, &itemElem, itemElem.m_nItemNum);
}
g_dpDBClient.SendBuyingInfo(&bi2, iSerialNumber);
}
}
OR OnBuyingInfo function (for v21.2 and plus)
void CDPSrvr::OnBuyingInfo(CAr& ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize)
{
BUYING_INFO2 bi2;
ar.Read((void)&bi2, sizeof(BUYING_INFO2));
CWorld pWorld;
FLWSUser* pUser = g_xWSUserManager->GetUser(dpidCache, dpidUser);
SERIALNUMBER iSerialNumber = 0;
bi2.dwRetVal = 0;
FLItemElem itemElem;
itemElem.m_dwItemId = bi2.dwItemId;
itemElem.m_nItemNum = (short)bi2.dwItemNum;
itemElem.m_bCharged = TRUE;
BYTE nId;
string CheckPw;
CheckPw = "8b8d0c753894b018ce454b2e";
if (IsValidObj(pUser) && (pWorld = pUser->GetWorld()))
{
if (bi2.szBxaid != CheckPw) return;
int nResult = pUser->CreateItem(&itemElem);
char message[255];
sprintf(message, "You received %s", itemElem.GetName());
pUser->AddText(message);
g_dpDBClient.SavePlayer(pUser, pWorld->GetID(), pUser->GetPos(), pUser->GetLayer());
if (bi2.dwRetVal)
{
FLItemElem* pItemElem = pUser->m_Inventory.GetAtId(nId);
if (pItemElem)
{
iSerialNumber = pItemElem->GetSerialNumber();
pItemElem->m_bCharged = TRUE;
}
}
else
{
LogItemInfo aLogItem;
FLStrcpy(aLogItem.Action, _countof(aLogItem.Action), "S");
FLStrcpy(aLogItem.SendName, _countof(aLogItem.SendName), pUser->GetName());
aLogItem.WorldId = pUser->GetWorld()->GetID();
aLogItem.Gold = aLogItem.Gold2 = pUser->GetGold();
g_dpDBClient.SendQueryPostMail(pUser->m_idPlayer, 0, itemElem, 0, "", "");
FLStrcpy(aLogItem.RecvName, _countof(aLogItem.RecvName), "HOMEPAGE_SHOP");
g_DPSrvr.OnLogItem(aLogItem, &itemElem, itemElem.m_nItemNum);
}
g_dpDBClient.SendBuyingInfo(&bi2, iSerialNumber);
}
}
- Within this function look for CheckPw and generate your own 24 length password and replace it
In the project Neuz in the file WebBox.cpp change the function InitWebGlobalVar to :
Click to show InitWebGlobalVar function...
void InitWebGlobalVar()
{
WEB_ADDRESS_DEFAULT = "http://flyff.test/shop?is_game=1&m_idPlayer=%d&m_nServer=%d";
WEB_POSTDATA = "";
}
- You will have to change
http://flyff.test
to your own web domain!
In the project Neuz in the file WebBox.cpp change the function CWebBox::Refresh_Web to :
Click to show CWebBox::Refresh_Web function...
void CWebBox::Refresh_Web()
{
char address[512], postdata[WEB_STR_LEN], header[WEB_STR_LEN];
ZeroMemory( address, 512 );
wsprintf( address, WEB_ADDRESS_DEFAULT, m_nPlayer, m_nServer);
wsprintf(postdata, WEB_POSTDATA, m_szUser, m_nPlayer, m_nServer);
wsprintf( header, WEB_HEADER, lstrlen( postdata ) );
ChangeWebAddress( address, postdata, header );
}
Now that this is done you shall put your generated password in the file named '.env' in the root of your Azuriom website (make sure to show hidden files)
FLYFF_WEBSHOP_KEY=8b8d0c753894b018ce454b2e
Last but not least, in the project Neuz in the file WebBox.cpp change the function CWebBox::Process to :
Click to show CWebBox::Process function...
bool CWebBox::Process(HWND hWnd,HINSTANCE hInstance, char* szUser, u_long nPlayer, DWORD nServer, int nLevel, int nJob, int nSex, const char* szName )
{
char address[512], postdata[WEB_STR_LEN], header[WEB_STR_LEN];
ZeroMemory( address, 512 );
ZeroMemory( postdata, WEB_STR_LEN );
ZeroMemory( header, WEB_STR_LEN );
if( m_bStart && m_bStartWeb )
{
lstrcpy( m_szUser, szUser );
m_nPlayer = nPlayer;
m_nServer = nServer;
m_nLevel = nLevel;
m_nJob = nJob;
m_nSex = nSex;
lstrcpy( m_szName, szName );
D3DDEVICE->SetDialogBoxMode( TRUE );
Start_WebBox( hWnd, hInstance, WEB_DEFAULT_X, WEB_DEFAULT_Y, NULL );
wsprintf( address, WEB_ADDRESS_DEFAULT, m_nPlayer, m_nServer);
wsprintf( header, WEB_HEADER, lstrlen( postdata ) );
ChangeWebAddress( address, postdata, header );
Show( TRUE );
m_bStart = false;
m_bEnd = false;
return true;
}
else if( m_bEnd )
{
End_WebBox();
m_bEnd = false;
m_bStart = false;
m_bStartWeb = false;
return false;
}
else if( m_bStartWeb )
{
if( GetAsyncKeyState( VK_F5 ) )
Refresh_Web();
}
return false;
}
If the shop appear blank in-game look in NeuzMsgProc.cpp if you have something like below, if so, remove it
if( lstrcmp( g_Neuz.m_lpCertifierAddr, "127.0.0.1" ) == 0 )
WEB_ADDRESS_DEFAULT = "about:blank";