Jump to content

Probleme with real time event


Recommended Posts

Hello, i use this fonction

	EVENTFUNC(real_time_expire_event)
{
    
    
    const item_vid_event_info* info = reinterpret_cast<const item_vid_event_info*>(event->info);
	    if (NULL == info)
        return 0;
	    const LPITEM item = ITEM_MANAGER::instance().FindByVID( info->item_vid );
	    if (NULL == item)
        return 0;
	    const time_t current = get_global_time();
	    if (item->GetType() == ITEM_RING && (current > item->GetSocket(0)))
        return 1;
    
    if (current > item->GetSocket(0))
    {
        switch (item->GetVnum())
        {
            if(item->IsNewMountItem())
            {
                if (item->GetSocket(2) != 0)
                    item->ClearMountAttributeAndAffect();
            }
            break;
        }
	        ITEM_MANAGER::instance().RemoveItem(item, "REAL_TIME_EXPIRE");
	        return 0;
    }
	    return PASSES_PER_SEC(1);
}
	

but item ring disppear after time is 0 and i dont know why.

 

Link to comment
Share on other sites

  • Replies 12
  • Created
  • Last Reply

Top Posters In This Topic

i use this fonction now

	EVENTFUNC(real_time_expire_event)
{
    const item_vid_event_info* info = reinterpret_cast<const item_vid_event_info*>(event->info);
    
    //LPCHARACTER pOwner = GetOwner();
    //m_pOwner = ch;
    
    int Cell;
    
    if (NULL == info)
        return 0;
	    const LPITEM item = ITEM_MANAGER::instance().FindByVID( info->item_vid );
	    if (NULL == item)
        return 0;
	    const time_t current = get_global_time();
    
    if (current > item->GetSocket(0))
    {
        switch (item->GetVnum())
        {
            if(item->IsNewMountItem())
            {
                if (item->GetSocket(2) != 0)
                    item->ClearMountAttributeAndAffect();
            }
            break;
        }
	        if (item->GetType() == ITEM_RING)
        {
            item->Unequip();
        }
        else if (item->GetType() != ITEM_RING)
        {
            ITEM_MANAGER::instance().RemoveItem(item, "REAL_TIME_EXPIRE");
        }
        
        return 0;
    }
	    return PASSES_PER_SEC(1);
}
	

item has desequipe but is invisible in inventory, I am forced to reboot the server to make it appear

Link to comment
Share on other sites

i have try this fonction in item_manageur,

	bool ITEM_MANAGER::AddItem(LPITEM item)
{
    LPCHARACTER owner = funcFindOwnership.owner;
    int pos;
	    if (item->GetWindow() == EQUIPMENT)
    {
        item->RemoveFromCharacter();
        item->AddToCharacter(owner, TItemPos(INVENTORY, pos));
    }
	    return true;
}
	

but game.core  with this error :

	#0  CItem::AddToCharacter (this=0x2c4bd000, ch=0x2c4bd000, Cell={window_type = 1 '\001', cell = 0}) at item.h:47
47                      const char *    GetName()               { return m_pProto ? m_pProto->szLocaleName : NULL; }
[New LWP 100580]
(gdb) bt full
#0  CItem::AddToCharacter (this=0x2940d090, ch=0x28d62198, Cell={window_type = 0 '\0', cell = 0}) at item.h:47
        pos = 35803
        window_type = 0 '\0'
        __FUNCTION__ = "AddToCharacter"
#1  0x28c5dbe6 in basename_r () from /usr/lib32/libc.so.7
No symbol table info available.
#2  0x083a9d3e in CSemaphore::Wait ()
No symbol table info available.
#3  0x083a8fad in CAsyncSQL::ChildLoop ()
No symbol table info available.
#4  0x083a980e in AsyncSQLThread ()
No symbol table info available.
#5  0x287abbbc in pthread_condattr_init () from /usr/lib32/libthr.so.3
No symbol table info available.
#6  0x00000000 in ?? ()

Link to comment
Share on other sites

  • 3 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      [Advice]Clever way to add just specific bonuse range from item_attr_rare?

    2. 28

      Experimental Renderer

    3. 80

      Ship Defense (Hydra Dungeon)

    4. 11

      Loyal Metin2 Homepage

    5. 0

      Metin2Hyperion PvM 120 easy

    6. 29

      Shiva.international | Finest Oldschool | Official Start 16.09.2022

    7. 3

      Auto Potion refill event

  • 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.