Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Auto Make Perin

Newbie Spellweaver
Joined
Apr 28, 2011
Messages
38
Reaction score
8
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
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
Oct 9, 2010
Messages
22
Reaction score
11
Nice steal of the Yakuzai code..
if you want to post some things that is not you, write the credits.
 
Newbie Spellweaver
Joined
Oct 7, 2010
Messages
70
Reaction score
24
It would be nice if you have the choice between "Auto-Convert" and "Not Auto-Convert" in the Neuz.ini
 
Junior Spellweaver
Joined
Jan 25, 2010
Messages
151
Reaction score
16
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:
Now you can tag me!
Loyal Member
Joined
May 26, 2009
Messages
1,649
Reaction score
796
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.
 
Junior Spellweaver
Joined
Sep 16, 2009
Messages
137
Reaction score
103
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;
}
 
~FlyFF DeV~
Joined
Mar 2, 2009
Messages
579
Reaction score
113
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....
 
Flyff Developer
Loyal Member
Joined
Apr 6, 2009
Messages
1,873
Reaction score
384
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).
 
Junior Spellweaver
Joined
Sep 16, 2009
Messages
137
Reaction score
103
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
 
Flyff Developer
Loyal Member
Joined
Apr 6, 2009
Messages
1,873
Reaction score
384
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.
 
Junior Spellweaver
Joined
Sep 16, 2009
Messages
137
Reaction score
103
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.
 
Junior Spellweaver
Joined
Jan 8, 2012
Messages
100
Reaction score
25
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
 
Flyff Developer
Loyal Member
Joined
Apr 6, 2009
Messages
1,873
Reaction score
384
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.

>.> I know that, I'm not stupid. That's exactly a problem with the coding that I ALREADY MENTIONED in a previous post.
 
Experienced Elementalist
Joined
Feb 2, 2012
Messages
241
Reaction score
17
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


}
 
Game Developer
Loyal Member
Joined
Jun 19, 2009
Messages
1,491
Reaction score
460
This topic is in the wrong section.

Also Converting penya to perin in addgoldtext sounds wrong.... And does not belong there :S
@Charles101 it is probably the text color not sure what it is or if it works....
 
  • Like
Reactions: 404
Initiate Mage
Joined
Nov 29, 2012
Messages
1
Reaction score
0
How dafuq am i gonna change this? sorry im not good at changing things but im good at playing :))
 
Back
Top