Jump to content
×
×
  • Create New...

C++ | Allow Copy Bonus In Cube | Metin2


Recommended Posts

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( Internal )

Description:
When you craft a item the bonuses from the old item will be transferred(saved).

 

### Cube.cpp

//Search : 
	this->gold = 0;

//Add after : 
#ifdef ENABLE_CUBE_RENEWAL
	this->allowCopyAttr = false;
#endif


//Search:
		else TOKEN("gold")
		{
			cube_data->gold = value1;
		}


//Add after :

#ifdef ENABLE_CUBE_RENEWAL
		else TOKEN("allow_copy")
		{
			cube_data->allowCopyAttr = (value1 == 1 ? true : false);
		}
#endif

//Search in : bool Cube_make (LPCHARACTER ch)
	LPITEM	new_item;

Add after : 

#ifdef ENABLE_CUBE_RENEWAL
	DWORD copyAttr[ITEM_ATTRIBUTE_MAX_NUM][2];
#endif

//Search :
CUBE_VALUE	*reward_value = cube_proto->reward_value();

//Add after:
#ifdef ENABLE_CUBE_RENEWAL
	for (int i=0; i<CUBE_MAX_NUM; ++i)
	{
		if (NULL==items[i])	continue;

		if (items[i]->GetType() == ITEM_WEAPON || items[i]->GetType() == ITEM_ARMOR)
		{
			bool hasElement = false;
			for (int j = 0; j < cube_proto->item.size(); ++j)
			{
				if(cube_proto->item[j].vnum == items[i]->GetVnum())
				{
					hasElement = true;
					break;
				}
			}
			
			if(hasElement == false)
				continue;
			
			for (int a = 0; a < ITEM_ATTRIBUTE_MAX_NUM; a++)
			{
				copyAttr[a][0] = items[i]->GetAttributeType(a);
				copyAttr[a][1] = items[i]->GetAttributeValue(a);
			}

			break;
		}
		
		continue;
	}
#endif

//Search:
new_item = ch->AutoGiveItem(reward_value->vnum, reward_value->count);

//Add after:

#ifdef ENABLE_CUBE_RENEWAL
		if (cube_proto->allowCopyAttr == true && copyAttr != NULL)
		{
			new_item->ClearAttribute();
			
			for (int a = 0; a < ITEM_ATTRIBUTE_MAX_NUM; a++)
			{
				new_item->SetForceAttribute(a, copyAttr[a][0], copyAttr[a][1]);
			}
		}
#endif



###cube.h

//Search in : struct CUBE_DATA

	int						percent;
	unsigned int			gold;

//Add after :

#ifdef ENABLE_CUBE_RENEWAL
	bool					allowCopyAttr;
#endif


###service.h
/Add:

#define ENABLE_CUBE_RENEWAL


Example in cube.txt
section		
npc	20378	
item	11299	1
item	30509	10
item	30516	10
item	30514	10
allow_copy	1
reward	20000	1
gold	100000	
percent	60	
end

 

  • Metin2 Dev 2
  • Love 14
  • Love 1
Link to comment
  • 1 year later...
  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.