Jump to content

REAL_TIME_FIRST_USE items not being expired in the safe-box


Sonitex

Recommended Posts

  • Premium

Yo!

If you have an item with a limit type LIMIT_REAL_TIME_START_FIRST_USE that has been used at one point and put it inside the safe-box, it will not be removed from the game until you pull it out of the safe-box and perform a teleport.

item.h

// Search:
	protected:
		friend class CInputDB;


// Add below:
		friend class CHARACTER;

char.cpp

// Search:
void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem * pItems)
{
	[...]

			if (!m_pkSafebox->Add(pItems->pos, item))
			{
				M2_DESTROY_ITEM(item);
			}
			else
				item->SetSkipSave(false);

// Modify to:
			if (!m_pkSafebox->Add(pItems->pos, item))
			{
				M2_DESTROY_ITEM(item);
			}
			else
			{
				item->OnAfterCreatedItem();
				item->SetSkipSave(false);
			}

 

Edited by Sonitex
  • Metin2 Dev 8
  • Good 2
  • Love 1
  • Love 8
Link to comment
Share on other sites

  • Active Member

Thanks, but I'm not sure, if the bool should be there twice, but in another class. Is that correct?

	protected:
		friend class CInputDB;
		bool		OnAfterCreatedItem();

		//FIX REAL TIME FIRST USE
		friend class CHARACTER;
		bool		OnAfterCreatedItem();
		//FIX REAL TIME FIRST USE

Ah, as I can see, the way above will cause error with overloaded variable.

So, this way is correct?

	protected:
		friend class CInputDB;

		//FIX REAL TIME FIRST USE
		friend class CHARACTER;
		bool		OnAfterCreatedItem();
		//FIX REAL TIME FIRST USE

But then I can remove the friend class CInputDB; or not? It will be used in both classes at the same time? Yeah, maybe dumb question, but for me it's not really clear from your tut.

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Premium
22 minutes ago, ReFresh said:

Thanks, but I'm not sure, if the bool should be there twice, but in another class. Is that correct?

 

Hidden Content

 

	protected:
		friend class CInputDB;
		bool		OnAfterCreatedItem();

		//FIX REAL TIME FIRST USE
		friend class CHARACTER;
		bool		OnAfterCreatedItem();
		//FIX REAL TIME FIRST USE

Ah, as I can see, the way above will cause error with overloaded variable.

So, this way is correct?

	protected:
		friend class CInputDB;

		//FIX REAL TIME FIRST USE
		friend class CHARACTER;
		bool		OnAfterCreatedItem();
		//FIX REAL TIME FIRST USE

But then I can remove the friend class CInputDB; or not? It will be used in both classes at the same time? Yeah, maybe dumb question, but for me it's not really clear from your tut.

 

 

That is correct but do not remove the other friend class as it is used for the same purpose just at a different item loading phase.

Usually, I use [...] to indicate before/after code.

  • Metin2 Dev 1
Link to comment
Share on other sites

protected:
	friend class CInputDB;
	bool		OnAfterCreatedItem();

	//FIX REAL TIME FIRST USE		m2dev>1
	friend class CHARACTER;
	bool		OnAfterCreatedItem();
	//FIX REAL TIME FIRST USE		m2dev>1

 

It throws an error while compiling.

It has been stated here before.

330 Line :     friend class CInputDB;
    bool        OnAfterCreatedItem();

 

334 Line:     friend class CHARACTER;
    bool        OnAfterCreatedItem();

2 different classes, but it gives an error because it is used 2 times.

 

  • Lmao 1
Link to comment
Share on other sites

  • Premium
5 minutes ago, BadGrecee said:
protected:
	friend class CInputDB;
	bool		OnAfterCreatedItem();

	//FIX REAL TIME FIRST USE		m2dev>1
	friend class CHARACTER;
	bool		OnAfterCreatedItem();
	//FIX REAL TIME FIRST USE		m2dev>1

 

It throws an error while compiling.

It has been stated here before.

330 Line :     friend class CInputDB;
    bool        OnAfterCreatedItem();

 

334 Line:     friend class CHARACTER;
    bool        OnAfterCreatedItem();

2 different classes, but it gives an error because it is used 2 times.

 

	protected:
		friend class CInputDB;
		bool		OnAfterCreatedItem();

		friend class CHARACTER;
		bool		OnAfterCreatedItem();

 


 

Link to comment
Share on other sites

26 minutes ago, TAUMP said:
	protected:
		friend class CInputDB;
		bool		OnAfterCreatedItem();

		friend class CHARACTER;
		bool		OnAfterCreatedItem();

 

What is the difference between what I added and what you changed?

I sincerely apologize. I'm not saying that as a bad person. Same as the one I added.

 

or i have a problem with my eyes 🙂

Not: The same error continues.

item.h:333:9: error: 'bool CItem::OnAfterCreatedItem()' cannot be overloaded wit                                                                                        h 'bool CItem::OnAfterCreatedItem()'
   bool  OnAfterCreatedItem();
         ^~~~~~~~~~~~~~~~~~
item.h:330:9: note: previous declaration 'bool CItem::OnAfterCreatedItem()'
   bool  OnAfterCreatedItem();
         ^~~~~~~~~~~~~~~~~~
gmake: *** [Makefile:198: .obj/char_item.o] Error 1
 

Edited by BadGrecee
or i have a problem with my eyes :)
Link to comment
Share on other sites

  • Premium
3 minutes ago, BadGrecee said:

What is the difference between what I added and what you changed?

I sincerely apologize. I'm not saying that as a bad person. Same as the one I added.

 

or i have a problem with my eyes 🙂

Not: The same error continues.

item.h:333:9: error: 'bool CItem::OnAfterCreatedItem()' cannot be overloaded wit                                                                                        h 'bool CItem::OnAfterCreatedItem()'
   bool  OnAfterCreatedItem();
         ^~~~~~~~~~~~~~~~~~
item.h:330:9: note: previous declaration 'bool CItem::OnAfterCreatedItem()'
   bool  OnAfterCreatedItem();
         ^~~~~~~~~~~~~~~~~~
gmake: *** [Makefile:198: .obj/char_item.o] Error 1
 

My bad then

 

	protected:
		friend class CInputDB;
		friend class CHARACTER;
		bool		OnAfterCreatedItem();

 


 

Link to comment
Share on other sites

  • 1 month later...
  • Active Member
On 9/25/2022 at 1:42 PM, Sonitex said:

Yo!

If you have an item with a limit type LIMIT_REAL_TIME_START_FIRST_USE that has been used at one point and put it inside the safe-box, it will not be removed from the game until you pull it out of the safe-box and perform a teleport.

item.h

// Search:
	protected:
		friend class CInputDB;


// Add below:
		friend class CHARACTER;

char.cpp

// Search:
void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem * pItems)
{
	[...]

			if (!m_pkSafebox->Add(pItems->pos, item))
			{
				M2_DESTROY_ITEM(item);
			}
			else
				item->SetSkipSave(false);

// Modify to:
			if (!m_pkSafebox->Add(pItems->pos, item))
			{
				M2_DESTROY_ITEM(item);
			}
			else
			{
				item->OnAfterCreatedItem();
				item->SetSkipSave(false);
			}

 

Can you add video before/after please.

Link to comment
Share on other sites

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 0

      Metin2 effect script files (MSE and MSA file) how can convert

    2. 10

      Multi Language System

    3. 0

      We are looking for a C++ and Python programmer

    4. 0

      [Quest Scheduler Request] Is there a way to make a quest run independet of player events? Lets say start quest automatically at server startup?

    5. 111

      Ulthar SF V2 (TMP4 Base)

    6. 0

      Quest function when 102.kill definition whereabouts help

    7. 5

      [M2 FILTER] Customized Client Filter

    8. 0

      [INGAME] RGB Color on chat broken

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.