Jump to content

Yiv

Inactive Member
  • Posts

    160
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Posts posted by Yiv

  1. As a quest function this release is not really necessary. You can do this using the quest functions provided by the core by default.

    function checkItem(index, count)
    	local partyMemberPids = table.pack(party.get_member_pids())
    	
    	local invalid = false
    	for _, pid in ipairs(partyMemberPids) do
    		q.begin_other_pc_block(pid)
    		
    		if pc.count_item(index) < count then
    			invalid = true
    		end
    		
    		q.end_other_pc_block()
    		
    		if invalid then
    			break
    		end
    	end
    	
    	return not invalid
    end
    
    function removeItem(index, count)
    	local partyMemberPids = table.pack(party.get_member_pids())
    	
    	for _, pid in ipairs(partyMemberPids) do
    		q.begin_other_pc_block(pid)
    		
    		pc.remove_item(index, count)
    		
    		q.end_other_pc_block()
    	end
    end

     

     

    By the way:

    vor 39 Minuten schrieb metin2-factory:

    @ProfDrBielefeld

    We're talking here about iterators increment not integers.

    for iterators, ++it will always have a better performance than it++.

    Here's a good read:

    https://stackoverflow.com/questions/1303899/performance-difference-between-iterator-and-iterator

    The code optimization during compile time should know wether it's needed that the value returned by the operator is needed or not. If not the optimization should be aware of that and optimize the code in a way that both ways behave the same and therefore have no performance difference. Otherwise if it's needed, you're right of course and the pre-increment operator is better talking of performance but if you need it you won't have another way anyway and this does not matter.

     

    Regards

    • Love 2
  2. vor 20 Stunden schrieb .NyanCat:

    Hey thanks for your help!

    Do you think that i can implement it right into the live system?
    The problem is that it only occures on the live server. The test server does not have this problems. The files are 1:1 the same except the database (much more players on live)

    I cant figure out the excact problem are these timers saved somewhere in the database?

    Greetings and thanks for your help!

    Both solutions should work fine. I think the solution posted by Socialized using the returned iterator by the erase method should be better. I at least would change my code posted above to this:

    	void CQuestManager::CancelServerTimers(DWORD arg)
    	{
    		for (auto it = m_mapServerTimer.begin(); it != m_mapServerTimer.end(); /**/)
    		{
    			if (it->first.second != arg)
    			{
    				++it;
    			}
    			else
    			{
    				auto event = it->second;
    				event_cancel(&event);
    				it = m_mapServerTimer.erase(it);
    			}
    		}
    	}

     

    Regards

    • Love 2
  3. Am 4.7.2017 um 16:04 schrieb .NyanCat:

    Hello everybody!

    My channel cores randomly crash with this error.

    
    #0  0x081d7a53 in quest::CQuestManager::CancelServerTimers ()
    #1  0x08104e07 in CDungeonManager::Destroy ()
    #2  0x08104bc9 in dungeon_dead_event ()
    #3  0x081587eb in event_process ()
    #4  0x08172c2c in heartbeat ()
    #5  0x08174b73 in idle ()
    #6  0x08173655 in main ()

    Any Ideas?

    Try to replace the CQuestManager::CancelServerTimers method in questmanager.cpp with this one:

    	void CQuestManager::CancelServerTimers(DWORD arg)
    	{
    		for (auto it = m_mapServerTimer.begin(); it != m_mapServerTimer.end(); /**/)
    		{
    			if (it->first.second != arg)
    			{
    				++it;
    			}
    			else
    			{
    				auto event = it->second;
    				event_cancel(&event);
    				m_mapServerTimer.erase(it++);
    			}
    		}
    	}

     

    Regards

  4. Hello LeNnT,

    I told you, that I wrote to ChuckNorris, and he deactivated your topic until the conflict of stealing parts of my code and selling as yours is solved.
    You can place your statement for this in a private message to me and Chuck.

    By the way, the system we're talking about is now released on elitepvpers by me: http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/3994360-rls-markierung-neu-gedroppter-items.html#post33936069

    Regards

    • Love 2
  5. At client src:

    Change this(InstanceBase.cpp):

    m_dwLevel = c_rkCreateData.m_dwLevel

    To this:

    	BYTE level_mob = CPythonNonPlayer::Instance().GetMobLevel(c_rkCreateData.m_dwRace);
    
    	m_dwLevel = ((c_rkCreateData.m_dwRace > 8 && c_rkCreateData.m_bType == CActorInstance::TYPE_ENEMY) ? level_mob : c_rkCreateData.m_dwLevel);

    Ah and don't forget to include PythonNonPlayer.h

    After that open PythonNonPlayer.h and add this:

    		std::map<DWORD, BYTE> LevelByVnum;

    After that find:

            const TMobTable *	GetTable(DWORD dwVnum);

    And add this:

            BYTE				GetMobLevel(DWORD dwVnum);

    Next we need to open PythonNonPlayer.cpp:

    Find this line:

    m_NonPlayerDataMap.insert(TNonPlayerDataMap::value_type(pNonPlayerData->dwVnum, pNonPlayerData));

    Under that line add this:

    LevelByVnum[pNonPlayerData->dwVnum] = pNonPlayerData->bLevel;

    And finally add this event:

    BYTE CPythonNonPlayer::GetMobLevel(DWORD dwVnum)
    {
    	map<DWORD, BYTE>::iterator it;
    	it = LevelByVnum.find(dwVnum);
    	if (it != LevelByVnum.end()) {
    		return it->second;
    	}
    	return 0;
    }

    It's untested but it will probably work.

    ​Why did you add the new map LevelByVnum and not just implemented the CPythonNonPlayer::GetMobLevel(DWORD dwVnum) like this:

    BYTE CPythonNonPlayer::GetMobLevel(DWORD dwVnum)
    {
    	const CPythonNonPlayer::TMobTable * c_pTable = GetTable(dwVnum);
    	if (!c_pTable)
    		return 0;
    
    	return c_pTable->bLevel;
    }

    Regards

  6. There's no quest function for that, you'd have to make your own, something like this:

    // Syntax: npc.move(map_index, local x, local y)
    int npc_move(lua_State* L)
    {
        if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))
        {
            lua_pushboolean(L, FALSE);
            return 1;
        }
    
        LPCHARACTER pkNPC = CQuestManager::instance().GetCurrentNPCCharacterPtr();
        if (!pkNPC)
        {
            lua_pushboolean(L, FALSE);
            return 1;
        }
    
        long lMapIndex = lua_tonumber(L, 1);
        long lX = lua_tonumber(L, 2);
        long lY = lua_tonumber(L, 3);
    
        LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(lMapIndex);
        if (!pkSectreeMap)
            return 0;
    
        if (pkNPC->Goto(pkSectreeMap->m_setting.iBaseX + lX, pkSectreeMap->m_setting.iBaseY + lY))
        {
            pkNPC->SendMovePacket(FUNC_WAIT, 0, 0, 0, 0);
            lua_pushboolean(L, TRUE);
        }
        else
        {
            lua_pushboolean(L, FALSE);
        }
    
        return 1;
    }
    

    IT'S UNTESTED!

     

    Regards

  7. Dear community,

     

    since some days we're noticing that our database core is crashing from time to time.

    The last relevant messages in syslog are these:

    Apr  8 11:59:33.728741 :: ITEM_AWARD: load id 0 login  vnum 1966080000 count 6553600 socket 0
    Apr  8 11:59:33.728788 :: SIGNAL: SIGSEGV
    

    Somebody knows where the problem is?

     

    Btw.: I checked player.item_award but there's no item with such a vnum...

     

    Regards

  8. Dear community,

     

    as I found out that there's an error in player.item_award (or not directly in it but the function of it) I wanted to ask if someone already fixed it?

    The error works as following:

    - Itemshop writes the item into player.item_award with a socket2 value (e.g. 300 for a unique item as 5 hours using time)

    - Player takes item but the socket2 is not written into player.item so the item doesn't have a use time (0 minutes)

    - Item purges

     

    If nobody fixed it maybe someone could fix it?

     

    Regards

    • Love 1
  9. Dear community,

     

    from one day to an other (I didn't changed something related to that :o) I receive a multiple definition error of functions/variables defined in the main.cpp.

    I don't know why :S

    OBJDIR/test.o: In function `ContinueOnFatalError()':
    /eos_src/game/src/test.cpp:66: multiple definition of `ContinueOnFatalError()'
    OBJDIR/main.o:/eos_src/game/src/main.cpp:159: first defined here
    OBJDIR/test.o: In function `ShutdownOnFatalError()':
    /eos_src/game/src/test.cpp:70: multiple definition of `ShutdownOnFatalError()'
    OBJDIR/main.o:/eos_src/game/src/main.cpp:183: first defined here
    OBJDIR/test.o: In function `heartbeat(heart*, int)':
    /eos_src/game/src/test.cpp:74: multiple definition of `heartbeat(heart*, int)'
    OBJDIR/main.o:/eos_src/game/src/main.cpp:242: first defined here
    OBJDIR/test.o: In function `Metin2Server_IsInvalid()':
    /eos_src/game/src/test.cpp:78: multiple definition of `Metin2Server_IsInvalid()'
    OBJDIR/main.o:/eos_src/game/src/main.cpp:364: first defined here
    OBJDIR/test.o: In function `start(int, char**)':
    /eos_src/game/src/test.cpp:102: multiple definition of `start(int, char**)'
    OBJDIR/main.o:/eos_src/game/src/main.cpp:699: first defined here
    OBJDIR/test.o: In function `main':
    /eos_src/game/src/test.cpp:118: multiple definition of `main'
    OBJDIR/main.o:/eos_src/game/src/main.cpp:444: first defined here
    OBJDIR/test.o: In function `__gthread_trigger':
    /usr/include/c++/4.2/bits/gthr-default.h:165: multiple definition of `max_bytes_written'
    OBJDIR/main.o:/usr/include/c++/4.2/bits/gthr-default.h:165: first defined here
    OBJDIR/test.o: In function `__gthread_trigger':
    /eos_src/game/src/arena.h:106: multiple definition of `total_bytes_written'
    OBJDIR/main.o:/usr/include/c++/4.2/bits/stl_tree.h:1335: first defined here
    OBJDIR/test.o: In function `__gthread_trigger':
    /usr/include/c++/4.2/bits/stl_tree.h:1335: multiple definition of `current_bytes_written'
    OBJDIR/main.o:/usr/include/c++/4.2/bits/stl_algo.h:2885: first defined here
    OBJDIR/test.o: In function `__gthread_trigger':
    /eos_src/game/src/arena.h:106: multiple definition of `main_fdw'
    OBJDIR/main.o:/usr/include/c++/4.2/tr1/hashtable_policy.h:346: first defined here
    OBJDIR/test.o: In function `__gthread_trigger':
    /usr/include/c++/4.2/bits/gthr-default.h:168: multiple definition of `udp_socket'
    OBJDIR/main.o:/usr/include/c++/4.2/tr1/hashtable_policy.h:346: first defined here
    OBJDIR/test.o: In function `__gthread_trigger':
    /usr/include/c++/4.2/bits/stl_tree.h:1340: multiple definition of `g_bShutdown'
    OBJDIR/main.o:/eos_src/game/src/main.cpp:364: first defined here
    

    Who can help?

     

    Regards

    • Love 1
  10. Dear community,

     

    I'd like to know if someone could tell me how to call a function over ui.__mem_func__ (used in e.g. mouse over) with parameters?

     

    So if I have the function funcWithParams(self, par1, par2) and I know want to call it with ui.__mem_func__(self.funcWithParams) I want to give some parameters.

     

    I already tried this:

    ui.__mem_func__(self.funcWithParams, 1, 2)
    ui.__mem_func__(self.funcWithParams(1, 2))

    ui.__mem_func__(self.funcWithParams, (1, 2))

     

    Nothing works (except my workaround which is not really good!).

     

    Someone knows a solution?

     

    Regards

    • Love 1
  11. Well, I'm having respect on this step but 2 questions were left:

    - What's going to happen with World of Metin2?

    - What's going to happen with Eterhost?

    Questions are anwsered!

     

    Have a nice time without Metin2 and I wish you good luck in your life!

     

    Regards

    • Love 1
  12. Yeah, I already thought about that and I know that. Since there's no compiling error in visual studio (windows) everything's fine with the cpp's. I also checked the Makefile if there's the error but for me it looks okay (compared with some others but nothing important is different just the version management I mean the thing with rXXX). The main.cpp is compiling (I mean I just get the error at the end at linking things and I can see that it's compiled).

     

    Regards

    • Love 1
  13. Dear community,

     

    I'm actually having some trouble compiling my gamecore.

    I changed nothing important just added some features (but even without I'm now receiving these errors!) and I get these at compiling on FreeBSD:

    linking ../game_r126_dev_PET....
    linking ../test
    /usr/lib/crt1.o: In function `_start1':
    crt1_c.c:(.text+0xa6): undefined reference to `main'
    /usr/lib/crt1.o: In function `_start1':
    crt1_c.c:(.text+0xa6): undefined reference to `main'
    OBJDIR/desc.o: In function `DESC::ProcessOutput()':
    /eos_src/game/src/desc.cpp:406: undefined reference to `max_bytes_written'
    /eos_src/game/src/desc.cpp:408: undefined reference to `total_bytes_written'
    /eos_src/game/src/desc.cpp:409: undefined reference to `current_bytes_written'
    /eos_src/game/src/desc.cpp:406: undefined reference to `max_bytes_written'
    OBJDIR/desc.o: In function `DESC::ProcessOutput()':
    /eos_src/game/src/desc.cpp:406: undefined reference to `max_bytes_written'
    /eos_src/game/src/desc.cpp:408: undefined reference to `total_bytes_written'
    /eos_src/game/src/desc.cpp:409: undefined reference to `current_bytes_written'
    /eos_src/game/src/desc.cpp:406: undefined reference to `max_bytes_written'
    OBJDIR/event.o: In function `event_process(int)':
    /eos_src/game/src/event.cpp:135: undefined reference to `ContinueOnFatalError()'
    OBJDIR/event.o: In function `event_process(int)':
    /eos_src/game/src/event.cpp:135: undefined reference to `ContinueOnFatalError()'
    OBJDIR/input.o: In function `CInputProcessor::Pong(DESC*)':
    /eos_src/game/src/input.cpp:187: undefined reference to `Metin2Server_IsInvalid()'
    /eos_src/game/src/input.cpp:190: undefined reference to `g_bShutdown'
    OBJDIR/input.o: In function `CInputProcessor::Pong(DESC*)':
    /eos_src/game/src/input.cpp:187: undefined reference to `Metin2Server_IsInvalid()'
    /eos_src/game/src/input.cpp:190: undefined reference OBJDIR/input_auth.o: In function `CInputAuth::LoginOpenID(DESC*, char const*)':
    /eos_src/game/src/input_auth.cpp:246: undefined reference to `Metin2Server_IsInvalid()'
    OBJDIR/input_auth.o: In function `CInputAuth::Login(DESC*, char const*)':
    /eos_src/game/src/input_auth.cpp:115: undefined reference to `Metin2Server_IsInvalid()'
    to `g_bShutdown'
    OBJDIR/input_auth.o: In function `CInputAuth::LoginOpenID(DESC*, char const*)':
    /eos_src/game/src/input_auth.cpp:246: undefined reference to `Metin2Server_IsInvalid()'
    OBJDIR/input_auth.o: In function `CInputAuth::Login(DESC*, char const*)':
    /eos_src/game/src/input_auth.cpp:115: undefined reference to `Metin2Server_IsInvalid()'
    OBJDIR/input_db.o: In function `CInputDB::P2P(char const*)':
    /eos_src/game/src/input_db.cpp:1356: undefined reference to `main_fdw'
    OBJDIR/input_db.o: In function `CInputDB::P2P(char const*)':
    /eos_src/game/src/input_db.cpp:1356: undefined reference to `main_fdw'
    OBJDIR/marriage.o: In function `marriage::TMarriage::Logout(unsigned int)':
    /eos_src/game/src/marriage.cpp:299: undefined reference to `g_bShutdown'
    /eos_src/game/src/marriage.cpp:316: undefined reference to `g_bShutdown'
    /eos_src/game/src/marriage.cpp:316: undefined reference to `g_bShutdown'
    OBJDIR/marriage.o: In function `marriage::TMarriage::Logout(unsigned int)':
    /eos_src/game/src/marriage.cpp:299: undefined reference to `g_bShutdown'
    /eos_src/game/src/marriage.cpp:316: undefined reference to `g_bShutdown'
    /eos_src/game/src/marriage.cpp:316: undefined reference to `g_bShutdown'
    gmake: *** [../test] Error 1
    gmake: *** Waiting for unfinished jobs....
    gmake: *** [../game_r126_dev_PET] Error 1
    

    I returned my changes and I did them again (step by step always checking if I really did it right!).

     

    On windows I can compile without any problems.

     

    Someone can help me out?

     

    Regards

  14. Dear community,

     

    because I need to change something in the archiver I wanted to use the Metin2PackMaker but now my problem is that I don't know how I have to use it.

     

    With the old archiver (metin2dev archiver) I got this structure:

    c55d357322.png

     

    For example, the structure of NPC:

    archiver_folder/NPC/d_/ymir_work/npc

     

    Who can help me? :)

    Thanks in advance!

     

    Regards

  15. Dear community,

     

    I think this topic has been treated several times but I still have problems.

    If I want to start my database it's working the first time. But if I know e.g. want to restart it, it doesn't start.

    Real Server
    Log OffAsyncSQL: connected to localhost (reconnect 1)
    Success PLAYER
    AsyncSQL: connected to localhost (reconnect 1)
    Success ACCOUNT
    AsyncSQL: connected to localhost (reconnect 1)
    Success COMMON
    

    I already tried this guide, which didn't work for me (I checked if I did everything correctly): http://metin2dev.org/board/topic/2705-c-db-fix-startup-error/

    Then, as you can see, I removed HOTBACKUP because it's not used, it doesn't change anything.

     

    If I check with GDB, I get this:

    (gdb) core db.core
    Core was generated by `db'.
    Program terminated with signal 11, Segmentation fault.
    #0  0x28613930 in ?? ()
    (gdb) bt
    #0  0x28613930 in ?? ()
    #1  0xfffffffa in ?? ()
    #2  0xffffffff in ?? ()
    #3  0x00000000 in ?? ()
    (gdb)
    

    Who knows what I should do?

     

    Regards

  16. Dear community,

     

    due I'm currently using a very large lib folder in my client (1609 files - I think I took it from the source but it was long time ago) I'd like to clean the folder so I'd like to delete all unneeded files. Because this is a huge amount of work I wanted to ask if someone could upload his lib folder.

     

    I'm using Python-2.2 (I have trouble if I update it :S).

     

    Thanks in advance!

     

    Regards

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