Jump to content

Allow Copy Bonus In Cube


Recommended Posts

M2 Download Center

This is the hidden content, please
( 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 15
  • Good 6
  • Love 1
  • Love 20
Link to comment
Share on other sites

  • 1 year later...
  • 6 months later...

Announcements



×
×
  • Create New...

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.