[Help] Restrict Shops to Saint Morning

04/29/2020 11:22 Leese#1
Hi, this part of code is not working for me? Can anyone help me?

Code:
#ifdef __ALLOW_VENDING_AREA
        switch (CContinent::GetInstance()->GetContinent(pUser))
        {
        case TOWN_SAINCITY:
        case CONT_SAINTMORNING:
            break;
        default:
            pUser->AddText("You must be in Saint City to open a shop!");
            return;
            break;
        }
#endif //__ALLOW_VENDING_AREA
I added it under CDPSrvr::OnPVendorOpen
I can still open a shop, but the shop title doesn't appear.
Also the pUser->AddText is not appearing
04/29/2020 11:35 Hyellow#2
Try this one. If you want to restrict player to vend from Faris.

Under:
Code:
		if( !( pUser->HasBuff( BUFF_ITEM, II_SYS_SYS_SCR_FONTEDIT ) ) )
			ParsingEffect(szPVendor, strlen(szPVendor) );
Add this:
Code:
		//__DISABLE_VEND
		switch (CContinent::GetInstance()->GetContinent(pUser))
		{
		case TOWN_FLARINENOSPLE:
		case CONT_FLARIS:
		{
			pUser->AddText("You're not allowed to vend here!");
			return;
			break;
		}
		}
		//__DISABLE_VEND
04/29/2020 11:39 Ecrypter#3
Define it in your versioncomon.h Worldserver
04/29/2020 15:01 Leese#4
Quote:
Originally Posted by Hyellow View Post
Try this one. If you want to restrict player to vend from Faris.

Under:
Code:
		if( !( pUser->HasBuff( BUFF_ITEM, II_SYS_SYS_SCR_FONTEDIT ) ) )
			ParsingEffect(szPVendor, strlen(szPVendor) );
Add this:
Code:
		//__DISABLE_VEND
		switch (CContinent::GetInstance()->GetContinent(pUser))
		{
		case TOWN_FLARINENOSPLE:
		case CONT_FLARIS:
		{
			pUser->AddText("You're not allowed to vend here!");
			return;
			break;
		}
		}
		//__DISABLE_VEND
Thank you! will try this soon.

Quote:
Originally Posted by Ecrypter View Post
Define it in your versioncomon.h Worldserver
Ofcourse did this ^^
04/29/2020 15:01 Hyellow#5
Quote:
Originally Posted by Leese View Post
Thank you! will try this soon.
Np, lemme know if it works. ^_^
04/29/2020 15:48 Ecrypter#6
Quote:
Originally Posted by Leese View Post
Hi, this part of code is not working for me? Can anyone help me?

Code:
#ifdef __ALLOW_VENDING_AREA
        switch (CContinent::GetInstance()->GetContinent(pUser))
        {
        case TOWN_SAINCITY:
        case CONT_SAINTMORNING:
            break;
        default:
            pUser->AddText("You must be in Saint City to open a shop!");
            return;
            break;
        }
#endif //__ALLOW_VENDING_AREA
Actually your code is allowing to create private shop in saint morning

I added it under CDPSrvr::OnPVendorOpen
I can still open a shop, but the shop title doesn't appear.
Also the pUser->AddText is not appearing

find this:
Add this below
PHP Code:
#ifdef __ALLOW_VENDING_AREA
  
switch( CContinent::GetInstance()->GetContinent( pUser ) )
  {
   case 
TOWN_FLARINENOSPLE:
   case 
CONT_FLARIS:
    break;
   default:
    
pUser->AddText("You must be in Flaris to open a shop!");
    return;
    break;
  }
#endif //__ALLOW_VENDING_AREA 
// ´ëÀüÀå¿¡¼*´Â °³ÀλóÁ¡À» ¿*¼ö ¾ø½À´Ï´Ù.
CWorld* pWorld = pUser->GetWorld();
if( pWorld && pWorld->GetID() == WI_WORLD_GUILDWAR )
{
pUser->AddText( prj.GetText(TID_GAME_GUILDCOMBAT_CANNOT_TRADE) ); //±æµå´ëÀüÀå ¿¡¼*´Â °Å·¡¿¡ °üÇÑ ¸ðµç°ÍµéÀ» ÀÌ¿ë ÇÒ ¼ö ¾ø½À´Ï´Ù.
return;
}
#if __VER >= 11 // __GUILD_COMBAT_1TO1
if( g_GuildCombat1to1Mng.IsPossibleUser( pUser ) )
{
pUser->AddText( prj.GetText(TID_GAME_GUILDCOMBAT_CANNOT_TRADE) ); //±æµå´ëÀüÀå ¿¡¼*´Â °Å·¡¿¡ °üÇÑ ¸ðµç°ÍµéÀ» ÀÌ¿ë ÇÒ ¼ö ¾ø½À´Ï´Ù.
return;
}
#endif // __GUILD_COMBAT_1TO1
04/29/2020 17:07 Hyellow#7
According to ____ :D

TOWN Stuff is not necessary if it comes about this issue.

WorldServer (VersionCommon.h)
Code:
#define  __SM_SHOPS_ONLY
DPSrver.cpp
Code:
void CDPSrvr::OnPVendorOpen( CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize )
{
	if( uBufSize > 55 )	// 4 + 4 + 48 - 1		= 55
		return;

	char szPVendor[MAX_VENDORNAME];	// °³ÀÎ »óÁ¡ À̸§( 48 )
	ar.ReadString( szPVendor, MAX_VENDORNAME );	

	CUser* pUser	= g_UserMng.GetUser( dpidCache, dpidUser );
	if( IsValidObj( pUser ) )
	{
/*		
#ifdef __Y_BEAUTY_SHOP_CHARGE
		if( ::GetLanguage() == LANG_TWN )
		{
			if( !(pUser->HasBuff( BUFF_ITEM, II_SYS_SYS_SCR_VENDOR ) ) )
			{
				return;
			}
		}
#endif //__Y_BEAUTY_SHOP_CHARGE
*/

#ifdef __RULE_0615
		if( prj.IsInvalidName( szPVendor ) || prj.IsAllowedLetter( szPVendor, TRUE ) == FALSE )
			pUser->AddDiagText( prj.GetText( TID_DIAG_0020 ) ); 
#endif	// __RULE_0615

		if( !( pUser->HasBuff( BUFF_ITEM, II_SYS_SYS_SCR_FONTEDIT ) ) )
			ParsingEffect(szPVendor, strlen(szPVendor) );
		
		// ´ëÀüÀå¿¡¼*´Â °³ÀλóÁ¡À» ¿*¼ö ¾ø½À´Ï´Ù.
		CWorld* pWorld = pUser->GetWorld();

#ifdef __SM_SHOPS_ONLY
		switch (CContinent::GetInstance()->GetContinent(pUser))
		{
		case CONT_SAINTMORNING:
			break;
		default:
			pUser->AddText("You can only open personal shops in saint morning.");
			return;
			break;
	}
#endif //__SM_SHOPS_ONLY

		if( pWorld && pWorld->GetID() == WI_WORLD_GUILDWAR )
		{			
			pUser->AddText( prj.GetText(TID_GAME_GUILDCOMBAT_CANNOT_TRADE) ); //±æµå´ëÀüÀå ¿¡¼*´Â °Å·¡¿¡ °üÇÑ ¸ðµç°ÍµéÀ» ÀÌ¿ë ÇÒ ¼ö ¾ø½À´Ï´Ù.
			return;
		}
05/01/2020 10:03 Leese#8
Quote:
Originally Posted by Hyellow View Post
According to ____ :D

TOWN Stuff is not necessary if it comes about this issue.

WorldServer (VersionCommon.h)
Code:
#define  __SM_SHOPS_ONLY
DPSrver.cpp
Code:
void CDPSrvr::OnPVendorOpen( CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize )
{
	if( uBufSize > 55 )	// 4 + 4 + 48 - 1		= 55
		return;

	char szPVendor[MAX_VENDORNAME];	// °³ÀÎ »óÁ¡ À̸§( 48 )
	ar.ReadString( szPVendor, MAX_VENDORNAME );	

	CUser* pUser	= g_UserMng.GetUser( dpidCache, dpidUser );
	if( IsValidObj( pUser ) )
	{
/*		
#ifdef __Y_BEAUTY_SHOP_CHARGE
		if( ::GetLanguage() == LANG_TWN )
		{
			if( !(pUser->HasBuff( BUFF_ITEM, II_SYS_SYS_SCR_VENDOR ) ) )
			{
				return;
			}
		}
#endif //__Y_BEAUTY_SHOP_CHARGE
*/

#ifdef __RULE_0615
		if( prj.IsInvalidName( szPVendor ) || prj.IsAllowedLetter( szPVendor, TRUE ) == FALSE )
			pUser->AddDiagText( prj.GetText( TID_DIAG_0020 ) ); 
#endif	// __RULE_0615

		if( !( pUser->HasBuff( BUFF_ITEM, II_SYS_SYS_SCR_FONTEDIT ) ) )
			ParsingEffect(szPVendor, strlen(szPVendor) );
		
		// ´ëÀüÀå¿¡¼*´Â °³ÀλóÁ¡À» ¿*¼ö ¾ø½À´Ï´Ù.
		CWorld* pWorld = pUser->GetWorld();

#ifdef __SM_SHOPS_ONLY
		switch (CContinent::GetInstance()->GetContinent(pUser))
		{
		case CONT_SAINTMORNING:
			break;
		default:
			pUser->AddText("You can only open personal shops in saint morning.");
			return;
			break;
	}
#endif //__SM_SHOPS_ONLY

		if( pWorld && pWorld->GetID() == WI_WORLD_GUILDWAR )
		{			
			pUser->AddText( prj.GetText(TID_GAME_GUILDCOMBAT_CANNOT_TRADE) ); //±æµå´ëÀüÀå ¿¡¼*´Â °Å·¡¿¡ °üÇÑ ¸ðµç°ÍµéÀ» ÀÌ¿ë ÇÒ ¼ö ¾ø½À´Ï´Ù.
			return;
		}
Okay so, it works right now. Made a mistake by tweaking the AddText function.

Problem right now is, a player has to press the button of opening the shop first before the error pops up.

Scenario I would love to have:
Player clicks "Private Shop" in Continent/Region -> Error or Window directly pops up.

Can I make this continent/region check client sided instead of server sided?
05/01/2020 11:51 Knusper02#9
Of course you can. Do it like I did. You put in DPSrvr.cpp CDPSrvr::OnPVendorOpen under:
Code:
if( IsValidObj( pUser ) )
{
This:
Code:
if( CContinent::GetInstance()->GetContinent(pUser) != CONT_SAINTMORNING )
	return;
In WndVendor.cpp under:
Code:
if( g_pPlayer->m_vtInfo.VendorIsVendor() == FALSE )
	return TRUE;
Put this:
Code:
if( CContinent::GetInstance()->GetMapNo(g_pPlayer) != 4 )
{
	g_WndMng.PutString( "Du kannst nur in Saint Morning einen Shop aufmachen." );
	return TRUE;
}
Dont forget to include Continent.h at the beginning of WndVendor.cpp otherwise you will get error
Code:
#include "Continent.h"
The message will come, once you press the button.
05/01/2020 12:05 Leese#10
Quote:
Originally Posted by Knusper02 View Post
Of course you can. Do it like I did. You put in DPSrvr.cpp CDPSrvr::OnPVendorOpen under:
Code:
if( IsValidObj( pUser ) )
{
This:
Code:
if( CContinent::GetInstance()->GetContinent(pUser) != CONT_SAINTMORNING )
	return;
In WndVendor.cpp under:
Code:
if( g_pPlayer->m_vtInfo.VendorIsVendor() == FALSE )
	return TRUE;
Put this:
Code:
if( CContinent::GetInstance()->GetMapNo(g_pPlayer) != 4 )
{
	g_WndMng.PutString( "Du kannst nur in Saint Morning einen Shop aufmachen." );
	return TRUE;
}
Dont forget to include Continent.h at the beginning of WndVendor.cpp otherwise you will get error
Code:
#include "Continent.h"
The message will come, once you press the button.
That was exactly what I needed, thank you so much <3

#closerequest