Auto Make Perin

Newbie Spellweaver
Joined
Apr 28, 2011
Messages
38
Reaction score
10
Hi is my first Post
First in Source

Code:
Firts Open User.cpp and Search

[CODE]void CUser::AddGoldText( int nPlus )
{
	char szPlus[64];
	char szGold[64];

	sprintf( szPlus, "%d", nPlus );
	sprintf( szGold, "%d", GetGold() );

	CString strPlus = GetNumberFormatEx( szPlus );
	CString strGold = GetNumberFormatEx( szGold );

	AddDefinedText( TID_GAME_REAPMONEY, "%s %s", strPlus, strGold );
}

And Remplace for
Code:
void CUser::AddGoldText( int nPlus )
{
	char szPlus[64];
	char szGold[64];

	sprintf( szPlus, "%d", nPlus );
	sprintf( szGold, "%d", GetGold() );

	CString strPlus = GetNumberFormatEx( szPlus );
	CString strGold = GetNumberFormatEx( szGold );

	if( GetGold() > 2100000000 &&  this->m_Inventory.GetEmptyCount() == 0 && CMover::GetPerinNum() > 0 )
	{
		CItemElem pItem;
		pItem.m_nItemNum = CMover::GetPerinNum() + 21;
		pItem.m_bCharged = TRUE;
		pItem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
		BYTE nID;
		CMover::RemovePerin( CMover::GetPerinNum() );
		CreateItem( &pItem, &nID );
		AddGold( -2100000000 );
		AddDefinedText( TID_GAME_MAKEPERIN );
	}
	else if (GetGold() > 2100000000 &&  this->m_Inventory.GetEmptyCount() > 0 && CMover::GetPerinNum() == 0)
	{
		CItemElem pItem;
		pItem.m_nItemNum = 21;
		pItem.m_bCharged = TRUE;
		pItem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
		BYTE nID;
		CreateItem( &pItem, &nID );
		AddGold( -2100000000 );
		AddDefinedText( TID_GAME_MAKEPERIN );
	}
	else if (GetGold() > 2100000000 &&  this->m_Inventory.GetEmptyCount() > 0 && CMover::GetPerinNum() > 1)
	{
		CItemElem pItem;
		pItem.m_nItemNum = 21;
		pItem.m_bCharged = TRUE;
		pItem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
		BYTE nID;
		CreateItem( &pItem, &nID );
		AddGold( -2100000000 );
		AddDefinedText( TID_GAME_MAKEPERIN );
	}
	else if (GetGold() > 2100000000 &&  this->m_Inventory.GetEmptyCount() == 0 && CMover::GetPerinNum() == 0)
	{
		AddDefinedText( TID_GAME_MAKEPERIN_FAILURE );
	}

	AddDefinedText( TID_GAME_REAPMONEY, "%s %s", strPlus, strGold );

}
[/CODE]
Ok now in Resource
Code:
First Open definetext.h and add
[CODE]#define TID_GAME_MAKEPERIN	 4702
#define TID_GAME_MAKEPERIN_FAILURE	 4703
now open textClient.inc and add
Code:
TID_GAME_MAKEPERIN	0xffbb00
{
	IDS_TEXTCLIENT_INC_100000
}
TID_GAME_MAKEPERIN_FAILURE	0xff0000
{
	IDS_TEXTCLIENT_INC_100001


}
And finally open textClient.txt.txt and add
Code:
IDS_TEXTCLIENT_INC_100000	21 perins have been created, penya has been reduced of your money.
IDS_TEXTCLIENT_INC_100001	the perins not been able to create, Please check your inventory / Penya deducted when your inventory, place, or perin´s stack is available. There is a  output message when the Perins were created, or a (red) output message when there is no room in the inventory
[/CODE]

Congratulation! you now have auto make perin in yours flyff any question comment in post and Sorry for my bad english ;)
Credits by Yakuzai
flyff00001 - Auto Make Perin - RaGEZONE Forums
 
Last edited:
Nice steal of the Yakuzai code..
if you want to post some things that is not you, write the credits.
 
It would be nice if you have the choice between "Auto-Convert" and "Not Auto-Convert" in the Neuz.ini
 
Hi is my first Post
First in Source

Code:
Firts Open User.cpp and Search

[CODE]void CUser::AddGoldText( int nPlus )
{
	char szPlus[64];
	char szGold[64];

	sprintf( szPlus, "%d", nPlus );
	sprintf( szGold, "%d", GetGold() );

	CString strPlus = GetNumberFormatEx( szPlus );
	CString strGold = GetNumberFormatEx( szGold );

	AddDefinedText( TID_GAME_REAPMONEY, "%s %s", strPlus, strGold );
}

And Remplace for
Code:
void CUser::AddGoldText( int nPlus )
{
	char szPlus[64];
	char szGold[64];

	sprintf( szPlus, "%d", nPlus );
	sprintf( szGold, "%d", GetGold() );

	CString strPlus = GetNumberFormatEx( szPlus );
	CString strGold = GetNumberFormatEx( szGold );

	if( GetGold() > 2100000000 &&  this->m_Inventory.GetEmptyCount() == 0 && CMover::GetPerinNum() > 0 )
	{
		CItemElem pItem;
		pItem.m_nItemNum = CMover::GetPerinNum() + 21;
		pItem.m_bCharged = TRUE;
		pItem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
		BYTE nID;
		CMover::RemovePerin( CMover::GetPerinNum() );
		CreateItem( &pItem, &nID );
		AddGold( -2100000000 );
		AddDefinedText( TID_GAME_MAKEPERIN );
	}
	else if (GetGold() > 2100000000 &&  this->m_Inventory.GetEmptyCount() > 0 && CMover::GetPerinNum() == 0)
	{
		CItemElem pItem;
		pItem.m_nItemNum = 21;
		pItem.m_bCharged = TRUE;
		pItem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
		BYTE nID;
		CreateItem( &pItem, &nID );
		AddGold( -2100000000 );
		AddDefinedText( TID_GAME_MAKEPERIN );
	}
	else if (GetGold() > 2100000000 &&  this->m_Inventory.GetEmptyCount() > 0 && CMover::GetPerinNum() > 1)
	{
		CItemElem pItem;
		pItem.m_nItemNum = 21;
		pItem.m_bCharged = TRUE;
		pItem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
		BYTE nID;
		CreateItem( &pItem, &nID );
		AddGold( -2100000000 );
		AddDefinedText( TID_GAME_MAKEPERIN );
	}
	else if (GetGold() > 2100000000 &&  this->m_Inventory.GetEmptyCount() == 0 && CMover::GetPerinNum() == 0)
	{
		AddDefinedText( TID_GAME_MAKEPERIN_FAILURE );
	}

	AddDefinedText( TID_GAME_REAPMONEY, "%s %s", strPlus, strGold );

}
[/CODE]
Ok now in Resource
Code:
First Open definetext.h and add
[CODE]#define TID_GAME_MAKEPERIN	 4702
#define TID_GAME_MAKEPERIN_FAILURE	 4703
now open textClient.inc and add
Code:
TID_GAME_MAKEPERIN	0xffbb00
{
	IDS_TEXTCLIENT_INC_100000
}
TID_GAME_MAKEPERIN_FAILURE	0xff0000
{
	IDS_TEXTCLIENT_INC_100001


}
And finally open textClient.txt.txt and add
Code:
IDS_TEXTCLIENT_INC_100000	21 perins have been created, penya has been reduced of your money.
IDS_TEXTCLIENT_INC_100001	the perins not been able to create, Please check your inventory / Penya deducted when your inventory, place, or perin´s stack is available. There is a  output message when the Perins were created, or a (red) output message when there is no room in the inventory
[/CODE]

Congratulation! you now have auto make perin in yours flyff any question comment in post and Sorry for my bad english ;)
View attachment 106450

automatic gain when you kill a monster or by time??
 
Last edited:
automatic gain when you kill a monster or by time??

It gives you perins automatically as soon as you get 2,1b I believe.

@On topic

Obviously this is a re-posted script that Yaku created, but it's still a nice contribute to RaGEZONE as this haven't been posted before. Will most likely be useful to those who don't use other forums. When that's said, you should credit the respective owners.
 
I would recommend the following as a command:
PHP:
	ON_TEXTCMDFUNC( TextCmd_PenyaToPerin,          "PenyaToPerin",      "ptp",					"±Ó¼Ó¸»",         "±Ó",      TCM_SERVER, AUTH_GENERAL      , "±Ó¼Ó¸» [/¸í·É ¾ÆÀ̵𠳻¿ë]" )
PHP:
BOOL TextCmd_PenyaToPerin( CScanner& scanner )
{
#ifdef __WORLDSERVER
	CUser* pUser = (CUser*)scanner.dwValue;
	CWorld* pWorld = pUser->GetWorld();
/*
	if( GetTickCount() - pUser->GetLastBuffTick() <= 1000 ){
		pUser->AddText( "Du musst eine Sekunden warten!" );
		return TRUE;
	}
	
	pUser->SetLastBuffTick( GetTickCount() );
*/
	CItemElem itemElem;
	itemElem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
	itemElem.m_nItemNum = 0;
	BYTE nId;

	int MaxPenya = pUser->GetGold();
	int Count = 0;
	while( MaxPenya >= 100000000 ){
		Count += 1;
		MaxPenya -= 100000000;
	}

	itemElem.m_nItemNum = Count;
	pUser->AddGold( (Count*100000000) * (-1) );

	DWORD dwRetVal = pUser->CreateItem( &itemElem, &nId );

	char message[255];
	if( dwRetVal ){
		sprintf( message, "You received %d %s", Count, itemElem.GetName() );
	}else{
		sprintf( message, "%d %s has been send to your PostBox", Count, itemElem.GetName() );
		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 = "PenyaToPerin";
		g_DPSrvr.OnLogItem( aLogItem, &itemElem, itemElem.m_nItemNum );
	}
	pUser->AddText( message );
	g_dpDBClient.SavePlayer( pUser, pWorld->GetID(), pUser->GetPos(), pUser->GetLayer() );
#endif //__WORLDSERVER
	return TRUE;
}
 
I would recommend the following as a command:
PHP:
    ON_TEXTCMDFUNC( TextCmd_PenyaToPerin,          "PenyaToPerin",      "ptp",                    "±Ó¼Ó¸»",         "±Ó",      TCM_SERVER, AUTH_GENERAL      , "±Ó¼Ó¸» [/¸í·É ¾ÆÀ̵𠳻¿ë]" )
PHP:
BOOL TextCmd_PenyaToPerin( CScanner& scanner )
{
#ifdef __WORLDSERVER
    CUser* pUser = (CUser*)scanner.dwValue;
    CWorld* pWorld = pUser->GetWorld();
/*
    if( GetTickCount() - pUser->GetLastBuffTick() <= 1000 ){
        pUser->AddText( "Du musst eine Sekunden warten!" );
        return TRUE;
    }
    
    pUser->SetLastBuffTick( GetTickCount() );
*/
    CItemElem itemElem;
    itemElem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
    itemElem.m_nItemNum = 0;
    BYTE nId;

    int MaxPenya = pUser->GetGold();
    int Count = 0;
    while( MaxPenya >= 100000000 ){
        Count += 1;
        MaxPenya -= 100000000;
    }

    itemElem.m_nItemNum = Count;
    pUser->AddGold( (Count*100000000) * (-1) );

    DWORD dwRetVal = pUser->CreateItem( &itemElem, &nId );

    char message[255];
    if( dwRetVal ){
        sprintf( message, "You received %d %s", Count, itemElem.GetName() );
    }else{
        sprintf( message, "%d %s has been send to your PostBox", Count, itemElem.GetName() );
        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 = "PenyaToPerin";
        g_DPSrvr.OnLogItem( aLogItem, &itemElem, itemElem.m_nItemNum );
    }
    pUser->AddText( message );
    g_dpDBClient.SavePlayer( pUser, pWorld->GetID(), pUser->GetPos(), pUser->GetLayer() );
#endif //__WORLDSERVER
    return TRUE;
}
Sedrika the thing is that it is not mentioned for admins but for normal players to not make them go back to town from exp area....
 
Sedrika the thing is that it is not mentioned for admins but for normal players to not make them go back to town from exp area....

Jomex, read Sedrika's coding closer. The auth level for that command is AUTH_GENERAL, which means players can use it.

Here, I cleaned up your coding and made it less wasteful:
Code:
void CUser::AddGoldText( int nPlus )
{
	char szPlus[64];
	char szGold[64];

	sprintf( szPlus, "%d", nPlus );
	sprintf( szGold, "%d", GetGold() );

	CString strPlus = GetNumberFormatEx( szPlus );
	CString strGold = GetNumberFormatEx( szGold );

	//AddDefinedText( TID_GAME_REAPMONEY, "%s %s", strPlus, strGold );

	if( GetGold() > 2100000000 )
	{
		if( m_Inventory.GetEmptyCount() == 0 && GetPerinNum() > 0 )
		{
			CItemElem* pItem = m_Inventory.GetAtItemId( II_SYS_SYS_SCR_PERIN );
			pItem.m_nItemNum += 21;
			AddGold( -2100000000 );
			AddDefinedText( TID_GAME_MAKEPERIN );
		}
		else if ( m_Inventory.GetEmptyCount() > 0 && GetPerinNum() >= 0)
		{
			CItemElem pItem;
			pItem.m_nItemNum = 21;
			pItem.m_bCharged = TRUE;
			pItem.m_dwItemId = II_SYS_SYS_SCR_PERIN;
			BYTE nID;
			CreateItem( &pItem, &nID );
			AddGold( -2100000000 );
			AddDefinedText( TID_GAME_MAKEPERIN );
		}
		else if ( m_Inventory.GetEmptyCount() == 0 && GetPerinNum() == 0)
		{
			AddDefinedText( TID_GAME_MAKEPERIN_FAILURE );
		}
	}

	AddDefinedText( TID_GAME_REAPMONEY, "%s %s", strPlus, strGold );
}

Despite what I just posted, there are still bugs to be considered (in the original version as well).
When your inventory is full and the current penya stack gets filled up, there's no failsafe to make sure you get the rest of the perins (like via mail or something).
 
You should check if there is any free place in his inventory befor you create the item.

PHP:
CreateItem( &pItem, &nID );

Is returning a bool value.
If true the items has been created successful else there is no place or something wrong there.

Sry for my bad english xD
 
You should check if there is any free place in his inventory befor you create the item.

PHP:
CreateItem( &pItem, &nID );

Is returning a bool value.
If true the items has been created successful else there is no place or something wrong there.

Sry for my bad english xD

I've never used the function before, but from looking at it, the m_Inventory.GetEmptyCount() function returns the number of empty spaces in their inventory. So they're already doing that. The only bug I see, is the one I already mentioned.
 
I've never used the function before, but from looking at it, the m_Inventory.GetEmptyCount() function returns the number of empty spaces in their inventory. So they're already doing that. The only bug I see, is the one I already mentioned.

If there is no empty place in your inventory and you've for e.x. 95perin and 21 should be added there and the maximum is 99 then createitem would not work.
 
If there is no empty place in your inventory and you've for e.x. 95perin and 21 should be added there and the maximum is 99 then createitem would not work.

Hey Sedrika, if I have less than 100m and inventary full, I got a e-mail with perin (0 value)
[IMG]https://forum.ragezone.com/ima...ve less than 100m? :p Srry for bad english :l
 
Hi, im new to C++ or programming.
can you tell me how did you get this value?
the one in red fonts.

TID_GAME_MAKEPERIN 0xffbb00
{
IDS_TEXTCLIENT_INC_100000
}
TID_GAME_MAKEPERIN_FAILURE 0xff0000
{
IDS_TEXTCLIENT_INC_100001


}
 
Back