Jump to content

Enchant Item with time


Recommended Posts

Hi all, this is a simple and silly code for those who want to enchant objects with countdown.
I used real_time, so I put the objects inside a chest.
The time will start running when you open the chest.

I hope something similar has not already been shared, in case I apologize.

If I have forgotten something in creating the code please let me know.

 


This is the hidden content, please
 or 
This is the hidden content, please


This is the hidden content, please

  • Metin2 Dev 19
  • Good 5
  • Love 10
Link to comment
Share on other sites

if (item->GetVnum() != 71231 && item->GetVnum() != 71232 && item->GetVnum() != 71233 && item->GetVnum() != 71234 
&& item->GetVnum() != 71235 && item->GetVnum() != 71236 && item->GetVnum() != 71237)

//Change


if (item->GetVnum() < 71231 || item->GetVnum() > 71237)

 

Edited by BadRomani
  • Good 1
Link to comment
Share on other sites

8 hours ago, BadRomani said:
if (item->GetVnum() != 71231 && item->GetVnum() != 71232 && item->GetVnum() != 71233 && item->GetVnum() != 71234 
&& item->GetVnum() != 71235 && item->GetVnum() != 71236 && item->GetVnum() != 71237)

//Change


if (item->GetVnum() < 71231 || item->GetVnum() > 71237)

 

That way it's easier, I hadn't thought of that.
Thank you

But maybe it is right in this way?

if (item->GetVnum() < 71231 && item-> GetVnum() > 71237)

Edited by Nuzzo
Link to comment
Share on other sites

4 hours ago, Nuzzo said:

That way it's easier, I hadn't thought of that.
Thank you

But maybe it is right in this way?

if (item->GetVnum() < 71231 && item-> GetVnum() > 71237)

if (item->GetVnum() < 71231 && item-> GetVnum() > 71237)

if (item->GetVnum() < 71231 || item->GetVnum() > 71237)

 

Try both and see which one you like 🙂

  • Good 1
Link to comment
Share on other sites

UPDATE FOR BETTER CODE:

char_item.cpp

//SEARCH:
#ifdef __CHANGE_BONUS_WITH_TIME__
									if (item->GetVnum() != 71231 && item->GetVnum() != 71232 && item->GetVnum() != 71233 && item->GetVnum() != 71234 
									&& item->GetVnum() != 71235 && item->GetVnum() != 71236 && item->GetVnum() != 71237)
										item->SetCount(item->GetCount() - 1);
#else
										item->SetCount(item->GetCount() - 1);
#endif


////CHANGE:

#ifdef __CHANGE_BONUS_WITH_TIME__
									if (item->GetVnum() < 71231 || item->GetVnum() > 71237) 
										item->SetCount(item->GetCount() - 1);
#else
										item->SetCount(item->GetCount() - 1);
#endif

 

uitooltip.py

#SEARCH:
if constInfo.CHANGE_BONUS_WITH_TIME:
			if 71231 == itemVnum:
				self.AppendSpace(5)
				if 0 != metinSlot:
					bHasRealtimeFlag = 0
					
				for i in xrange(item.LIMIT_MAX_NUM):
					(limitType, limitValue) = item.GetLimit(i)

					if item.LIMIT_REAL_TIME == limitType:
						bHasRealtimeFlag = 1
					
				if 1 == bHasRealtimeFlag:
					self.AppendMallItemLastTime(metinSlot[0])		
				else:
					time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]

					if 1 == item.GetValue(2):
						self.AppendMallItemLastTime(time)
					else:
						self.AppendUniqueItemLastTime(time)

			elif 71232 == itemVnum:
				self.AppendSpace(5)
				if 0 != metinSlot:
					bHasRealtimeFlag = 0
					
				for i in xrange(item.LIMIT_MAX_NUM):
					(limitType, limitValue) = item.GetLimit(i)

					if item.LIMIT_REAL_TIME == limitType:
						bHasRealtimeFlag = 1
					
				if 1 == bHasRealtimeFlag:
					self.AppendMallItemLastTime(metinSlot[0])		
				else:
					time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]

					if 1 == item.GetValue(2):
						self.AppendMallItemLastTime(time)
					else:
						self.AppendUniqueItemLastTime(time)

			elif 71233 == itemVnum:
				self.AppendSpace(5)
				if 0 != metinSlot:
					bHasRealtimeFlag = 0
					
				for i in xrange(item.LIMIT_MAX_NUM):
					(limitType, limitValue) = item.GetLimit(i)

					if item.LIMIT_REAL_TIME == limitType:
						bHasRealtimeFlag = 1
					
				if 1 == bHasRealtimeFlag:
					self.AppendMallItemLastTime(metinSlot[0])		
				else:
					time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]

					if 1 == item.GetValue(2):
						self.AppendMallItemLastTime(time)
					else:
						self.AppendUniqueItemLastTime(time)

			elif 71234 == itemVnum:
				self.AppendSpace(5)
				if 0 != metinSlot:
					bHasRealtimeFlag = 0
					
				for i in xrange(item.LIMIT_MAX_NUM):
					(limitType, limitValue) = item.GetLimit(i)

					if item.LIMIT_REAL_TIME == limitType:
						bHasRealtimeFlag = 1
					
				if 1 == bHasRealtimeFlag:
					self.AppendMallItemLastTime(metinSlot[0])		
				else:
					time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]

					if 1 == item.GetValue(2):
						self.AppendMallItemLastTime(time)
					else:
						self.AppendUniqueItemLastTime(time)

			elif 71235 == itemVnum:
				self.AppendSpace(5)
				if 0 != metinSlot:
					bHasRealtimeFlag = 0
					
				for i in xrange(item.LIMIT_MAX_NUM):
					(limitType, limitValue) = item.GetLimit(i)

					if item.LIMIT_REAL_TIME == limitType:
						bHasRealtimeFlag = 1
					
				if 1 == bHasRealtimeFlag:
					self.AppendMallItemLastTime(metinSlot[0])		
				else:
					time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]

					if 1 == item.GetValue(2):
						self.AppendMallItemLastTime(time)
					else:
						self.AppendUniqueItemLastTime(time)

			elif 71236 == itemVnum:
				self.AppendSpace(5)
				if 0 != metinSlot:
					bHasRealtimeFlag = 0
					
				for i in xrange(item.LIMIT_MAX_NUM):
					(limitType, limitValue) = item.GetLimit(i)

					if item.LIMIT_REAL_TIME == limitType:
						bHasRealtimeFlag = 1
					
				if 1 == bHasRealtimeFlag:
					self.AppendMallItemLastTime(metinSlot[0])		
				else:
					time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]

					if 1 == item.GetValue(2):
						self.AppendMallItemLastTime(time)
					else:
						self.AppendUniqueItemLastTime(time)

			elif 71237 == itemVnum:
				self.AppendSpace(5)
				if 0 != metinSlot:
					bHasRealtimeFlag = 0
					
				for i in xrange(item.LIMIT_MAX_NUM):
					(limitType, limitValue) = item.GetLimit(i)

					if item.LIMIT_REAL_TIME == limitType:
						bHasRealtimeFlag = 1
					
				if 1 == bHasRealtimeFlag:
					self.AppendMallItemLastTime(metinSlot[0])		
				else:
					time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]

					if 1 == item.GetValue(2):
						self.AppendMallItemLastTime(time)
					else:
						self.AppendUniqueItemLastTime(time)

###CHANGE ALL WITH:

		if constInfo.CHANGE_BONUS_WITH_TIME:
			if itemVnum >= 71231 and itemVnum <= 71237:
				self.AppendSpace(5)
				if 0 != metinSlot:
					bHasRealtimeFlag = 0
					
				for i in xrange(item.LIMIT_MAX_NUM):
					(limitType, limitValue) = item.GetLimit(i)

					if item.LIMIT_REAL_TIME == limitType:
						bHasRealtimeFlag = 1
					
				if 1 == bHasRealtimeFlag:
					self.AppendMallItemLastTime(metinSlot[0])		
				else:
					time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]

					if 1 == item.GetValue(2):
						self.AppendMallItemLastTime(time)
					else:
						self.AppendUniqueItemLastTime(time)

 

  • Love 1
Link to comment
Share on other sites

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.