Lord Event Perin?

05/23/2018 17:52 Minotaurr#1
Hey guys !

What do I have to change in this piece of source to change the lord event price from Penya to Perin?

Code:
namespace	lordevent
{
	int	CreateRequirements( CUser* pUser, int iEEvent, int iIEvent )
	{
		ILordEvent* pEvent		= CSLord::Instance()->GetEvent();
		if (!pUser->IsAuthHigher(AUTH_GENERAL))
		{
			if (!CSLord::Instance()->IsLord(pUser->m_idPlayer))
			{
				return TID_GAME_L_EVENT_CREATE_E001;
			}
		}
		if( pEvent->GetComponent( pUser->m_idPlayer ) )
			return TID_GAME_L_EVENT_CREATE_E002;
		if( pUser->IsQuerying() )
			return TID_GAME_LORD_IS_QUERYING;
		
		__int64 iCost	= pEvent->GetCost( iEEvent, iIEvent );
		if( iCost == 0 )
			return TID_GAME_L_EVENT_CREATE_E004;
		if( iCost > pUser->GetTotalGold() )
			return TID_GAME_L_EVENT_CREATE_E003;

		pUser->SetQuerying( TRUE );
		return 0;
	}
};
I found this, but unfortunately this does not work

Code:
	int nPerin	= pUser->RemoveTotalGold( pEvent->GetCost( iEEvent, iIEvent ) );
	if( nPerin == 0 )
		return TID_GAME_L_EVENT_CREATE_E004;
	if( nPerin > pUser->GetTotalGold() )
		return TID_GAME_L_EVENT_CREATE_E003;

Thanks!
Minotaurr
05/23/2018 18:50 Dr. Peacock#2
Why you want to change it to Perin ? :0
The highest Penya size is 2.147.483.647, this is the maximum for a int32.

If you Start a Event and i speak currently from a 50/50 you are over the maximum Penya size, so you automaticly use the Perin(s)...
You are also able to recode it for a int64 with a maximum Penya size of 9.223.372.036.854.775.807
so you can Delete the Useless Perins :kappa:
05/24/2018 02:57 Flogolo#3
Better reduce the Price to an amount of penya that fits to a good value... e.g. Drop 1.5B EXP 0.5B together 2B?
05/24/2018 20:00 Minotaurr#4
Quote:
Originally Posted by Dr. Peacock View Post
Why you want to change it to Perin ? :0
The highest Penya size is 2.147.483.647, this is the maximum for a int32.

If you Start a Event and i speak currently from a 50/50 you are over the maximum Penya size, so you automaticly use the Perin(s)...
You are also able to recode it for a int64 with a maximum Penya size of 9.223.372.036.854.775.807
so you can Delete the Useless Perins :kappa:
I'm not sure how to change that, I just prefer changing it to perins...
05/25/2018 08:10 alfredico#5
Only need to change this line
if( iCost > pUser->GetTotalGold() )

by
if( iCost > pUser->GetPerinNum() )
05/25/2018 17:21 Minotaurr#6
Quote:
Originally Posted by alfredico View Post
Only need to change this line
if( iCost > pUser->GetTotalGold() )

by
if( iCost > pUser->GetPerinNum() )
Nice tyty!

One more problem, this only checks if the user has enough perin in the inventory, but it still takes penya out of inventory when starting.
05/25/2018 20:32 alfredico#7
WORLDSERVER/DPSrvr.cpp - CDPSrvr::OnLEventCreate()

int nPerin = pUser->RemoveTotalGold( pEvent->GetCost( iEEvent, iIEvent ) );

by
int nPerin = pUser->RemovePerin( pEvent->GetCost( iEEvent, iIEvent ) );
05/26/2018 09:31 Minotaurr#8
Quote:
Originally Posted by alfredico View Post
WORLDSERVER/DPSrvr.cpp - CDPSrvr::OnLEventCreate()

int nPerin = pUser->RemoveTotalGold( pEvent->GetCost( iEEvent, iIEvent ) );

by
int nPerin = pUser->RemovePerin( pEvent->GetCost( iEEvent, iIEvent ) );
Thank you so much ! Works perfectly
05/27/2018 08:12 Flogolo#9
Maybe i will add this too, but without increasing the price like hell lol