Jump to content

Ikarus_

Developer
  • Posts

    404
  • Joined

  • Last visited

  • Days Won

    20
  • Feedback

    0%

Posts posted by Ikarus_

  1. On 10/25/2020 at 1:57 AM, ZumbaCafew said:

    linking ../db_r40414_64....
    ld: error: unable to find library -lmysqlclient
    clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
    gmake: *** [Makefile:56: ../db_r40414_64] Error 1

     

    Are you compiling on a i386 machine? or an amd64?
    Amd64 machines will install you the lib built in 64bit which are incompatible with your game and db executables (which you are building in 32bit).

     

     

    On 11/3/2020 at 10:54 PM, ZumbaCafew said:

    ifeq ($(BSD_VERSION), 7) INCDIR += -I../../libmysql/7.x-5.1.35 LIBDIR += -L../../libmysql/7.x-5.1.35 else INCDIR += -I../../libmysql/mysql_8_0_20 LIBDIR += -L../../libmysql/mysql_8_0_20 endif

    Here you changed the -I and -L paths you are adding to LIBDIR and INCDIR, but can u find the lib in the directory you moved to?

  2. On 10/28/2020 at 4:55 PM, TokiSan said:

    char.cpp:8086: error: request for member 'reset' in 'pkMsg', which is of non-class type 'SQLMsg*' char.cpp:8086: error: 'nullptr' was not declared in this scope

    Uhm, yep, nullptr is not declared means you are not using c++11(+) and pkMsg is of non-class type SQLMsg* means you are using .reset on a raw pointer (and .reset is not needed even for smart ptr).

    You solved differently but maybe someone is interested in knowing why errors are received when they are received, as well as knowing how to fix it.

     

     

     

      

    On 11/7/2020 at 2:21 PM, developerares said:

    Is there a problem with this code? I have smart ptr. 

     

    No it is correct. std::unique_ptr<SQLMsg> will delete the memory from heap when its destructor is called. 

    smart pointers have the overload of the operator -> and this help to use them as classic (raw) pointers. (e.g. where you used Msg->Get())

  3. please test it and report here the result. I'v not the time to test it for you.

     

     

    into the function

    void CHARACTER::AutoRecoveryItemProcess(const EAffectTypes type)

     

     

    search for

    					if (avail > amount)
    					{
    						const int pct_of_used = amount_of_used * 100 / amount_of_full;
    						const int pct_of_will_used = (amount_of_used + amount) * 100 / amount_of_full;
    
    						bool bLog = false;
    						
    						
    						if ((pct_of_will_used / 10) - (pct_of_used / 10) >= 1)
    							bLog = true;
    						pItem->SetSocket(idx_of_amount_of_used, amount_of_used + amount, bLog);
    					}
    					else
    					{
    						amount = avail;
    
    						ITEM_MANAGER::instance().RemoveItem( pItem );
    					}

     

     

    replace it with:
     

    					if (avail > amount)
    					{
    						const int pct_of_used = amount_of_used * 100 / amount_of_full;
    						const int pct_of_will_used = (amount_of_used + amount) * 100 / amount_of_full;
    
    						bool bLog = false;
    						
    						
    						if ((pct_of_will_used / 10) - (pct_of_used / 10) >= 1)
    							bLog = true;
    						pItem->SetSocket(idx_of_amount_of_used, amount_of_used + amount, bLog);
    					}
    					else
    					{
    						amount = avail;
    
    						if(pItem->GetCount() <= 1)
    							ITEM_MANAGER::instance().RemoveItem( pItem );
    
    						else
    						{
    							pItem->SetCount(pItem->GetCount() - 1);
    							pItem->SetSocket(1, 0);
    						}
    					}

     

  4. On 10/28/2020 at 4:55 PM, TokiSan said:


    I try This and have this error:

    
    
    compile char.cpp
    char.cpp: In member function 'void CHARACTER::OpenShop(DWORD, const char*, bool)':
    
    char.cpp:8086: error: request for member 'reset' in 'pkMsg', which is of non-class type 'SQLMsg*'
    char.cpp:8086: error: 'nullptr' was not declared in this scope


     

     

    nullptr is defined since c++11 and i guess you are using reset on a raw pointer (the reset wasn't really needed btw)

  5. I think you are trying to read a stripped file. 

    When game and db are linked they got all debug information used from gdb to read where is it crashing.

    The process called stripping remove the debug symbols from the executable (and so reduce its size).

    Unfortunately doesn't give any information try to read a db.core using a stripped db file.

    You have to find the unstripped file and to read its symbol table.


    You might have a "-s" flag to your linking commands in your makefile that strip the output file automatically.

  6. double AttBonusMin = static_cast<double>(pkItemAbsorbed->alValues[3] + pkItemAbsorbed->alValues[5]);
    AttBonusMin *= acceItem->GetSocket(ACCE_ABSORPTION_SOCKET);
    AttBonusMin /= 100;
    AttBonusMin += 0.5;
    
    //todebug
    if(ch->IsPhase(PHASE_GAME))
    	ch->ChatPacket(CHAT_TYPE_INFO, "Going to add to your attack : min(%0.2f) max(%0.2f) ", AttBonusMin, AttBonusMax);
    
    *pdamMax += static_cast<int>(AttBonusMax);
    *pdamMin += static_cast<int>(AttBonusMin);

     

     

    They are just rounded to integer (throught static_cast<int>) after the chat packet, that's why you are getting them as float in your chat.

    but the way you may add more chat packets in this function to check step by step how it is calculating the values

    • Love 3
  7. In my code i ve used the identical formula client-side and server-side, so the result values are equal.

    Also in python the formula is identical, so why are u trying to change the formula?

     

      

    16 hours ago, Shahin said:

    With normal round it should be : 20 and 27 & 45 and 53

     

    Also you can't define what is a 'normal round' and what isn't.

    for example a number like 15.5 can be consider in many cases as 15 and in other cases as 16. Doesn't exists a standard to apply in this case, that's why we have to add a + 0.5 every where, in order to round always to the upper integer number, both python and c++.

    without the +0.5 we may find different values on python rouding and on c++ rounding.

    • Love 1
  8. On 11/2/2020 at 12:54 AM, Ikarus_ said:
    
    double AttBonusMax = static_cast<double>(pkItemAbsorbed->alValues[4] + pkItemAbsorbed->alValues[5]);
    AttBonusMax *= acceItem->GetSocket(ACCE_ABSORPTION_SOCKET);
    AttBonusMax /= 100;
    AttBonusMax += 0.5;
    
    double AttBonusMin = static_cast<double>(pkItemAbsorbed->alValues[3] + pkItemAbsorbed->alValues[5]);
    AttBonusMin *= acceItem->GetSocket(ACCE_ABSORPTION_SOCKET);
    AttBonusMin /= 100; 
    AttBonusMin += 0.5;

     

     

    check how it is calculated and you will know why.

    I ve just used the identical formula on c++ (serverside and clientside) and in python so all values now should be aligned.

     

    • Love 1
  9. Ok so the bug is just a visual bug.

    You have to wear a sash with att min and max and to read the client syserr.txt

    Let's debug it. (look at //todebug comment)

     

    void CPythonPlayer::__UpdateBattleStatus()
    {
    	m_playerStatus.SetPoint(POINT_NONE, 0);
    	m_playerStatus.SetPoint(POINT_EVADE_RATE, __GetEvadeRate());
    	m_playerStatus.SetPoint(POINT_HIT_RATE, __GetHitRate());
    	m_playerStatus.SetPoint(POINT_MIN_WEP, m_dwWeaponMinPower+m_dwWeaponAddPower);
    	m_playerStatus.SetPoint(POINT_MAX_WEP, m_dwWeaponMaxPower+m_dwWeaponAddPower);
    	m_playerStatus.SetPoint(POINT_MIN_MAGIC_WEP, m_dwWeaponMinMagicPower+m_dwWeaponAddPower);
    	m_playerStatus.SetPoint(POINT_MAX_MAGIC_WEP, m_dwWeaponMaxMagicPower+m_dwWeaponAddPower);
    	m_playerStatus.SetPoint(POINT_MIN_ATK, __GetTotalAtk(m_dwWeaponMinPower, m_dwWeaponAddPower));
    	m_playerStatus.SetPoint(POINT_MAX_ATK, __GetTotalAtk(m_dwWeaponMaxPower, m_dwWeaponAddPower));
    
    #ifdef ENABLE_ACCE_SYSTEM //change it with your sash define
    	auto ItemData = GetItemData({INVENTORY, c_Costume_Slot_Acce});
    	if (ItemData)
    	{
    		auto AbsorbedVnum = ItemData->alSockets[1];
    		if (AbsorbedVnum != 0 && CItemManager::Instance().SelectItemData(AbsorbedVnum))
    		{
    			auto SelectedItemData = CItemManager::Instance().GetSelectedItemDataPointer();
    			if (SelectedItemData->GetType() == CItemData::ITEM_TYPE_WEAPON)
    			{
    				auto oldMinWep = m_playerStatus.GetPoint(POINT_MIN_WEP);
    				auto oldMaxWep = m_playerStatus.GetPoint(POINT_MAX_WEP);
    				auto oldMinMag = m_playerStatus.GetPoint(POINT_MIN_MAGIC_WEP);
    				auto oldMaxMag = m_playerStatus.GetPoint(POINT_MAX_MAGIC_WEP);
    
    				double sashAbsorbPerc = static_cast<double>(ItemData->alSockets[0]);
    				auto sashMinWep = static_cast<double>(SelectedItemData->GetValue(3) + SelectedItemData->GetValue(5)) * (sashAbsorbPerc/100.0);
    				auto sashMaxWep = static_cast<double>(SelectedItemData->GetValue(4) + SelectedItemData->GetValue(5)) * (sashAbsorbPerc/100.0);
    				auto sashMinMag = static_cast<double>(SelectedItemData->GetValue(1) + SelectedItemData->GetValue(5)) * (sashAbsorbPerc/100.0);
    				auto sashMaxMag = static_cast<double>(SelectedItemData->GetValue(2) + SelectedItemData->GetValue(5)) * (sashAbsorbPerc/100.0);
    				
    				//todebug
    				TraceError("Going to add to your points : wep(min %f  max %f)  mag(min %f  max%f)", sashMinWep, sashMaxWep, sashMinMag, sashMaxMag);
    
    				m_playerStatus.SetPoint(POINT_MIN_WEP, oldMinWep + sashMinWep);
    				m_playerStatus.SetPoint(POINT_MAX_WEP, oldMaxWep + sashMaxWep);
    				m_playerStatus.SetPoint(POINT_MIN_MAGIC_WEP, oldMinMag + sashMinMag);
    				m_playerStatus.SetPoint(POINT_MAX_MAGIC_WEP, oldMaxMag + sashMaxMag);
    			}
    		}
    	}
    #endif
    }

     

     

    We should replace the if statement with this:
     

    			if (SelectedItemData->GetType() == CItemData::ITEM_TYPE_WEAPON || (SelectedItemData->GetType() == CItemData::ITEM_TYPE_COSTUME && SelectedItemData->GetSubType() == CItemData::COSTUME_WEAPON))

     

    • Love 1
  10. 2 hours ago, Shahin said:

    JtDjgJJ.png

    with the code:

    
    
        //todebug
        if(ch->GetDesc()->IsPhase)
            ch->ChatPacket(CHAT_TYPE_INFO, "Going to add to your attack : min(%0.2f) max(%0.2f) ", AttBonusMin, AttBonusMax);

     

     

    I ve confused you i think.

    here the complete ifstatement

    if(ch->GetDesc()->IsPhase(PHASE_GAME))

     

    • Love 1
  11. Let's debug it one by one.

    At first, the hit damage adjustments.

     

    //todebug help you to find where i ve added debug

     

    
    
    #ifdef ENABLE_ACCE_SYSTEM //replace it with your define for sash
    static void ApplyAcceAttackValue(LPITEM pkItem, int* pdamMin, int* pdamMax) 
    {
    	LPCHARACTER ch = pkItem ? pkItem->GetOwner() : NULL;
    	if (!ch)
    		return;
    
    	LPITEM acceItem = ch->GetWear(WEAR_COSTUME_ACCE);
    	if (!acceItem)
    		return;
    
    	TItemTable* pkItemAbsorbed = ITEM_MANAGER::instance().GetTable(acceItem->GetSocket(ACCE_ABSORBED_SOCKET));
    	if (!pkItemAbsorbed)
    		return;
    
    	if (pkItemAbsorbed->bType != ITEM_WEAPON)
    		return;
    
    	double AttBonusMax = static_cast<double>(pkItemAbsorbed->alValues[4] + pkItemAbsorbed->alValues[5]);
    	AttBonusMax *= acceItem->GetSocket(ACCE_ABSORPTION_SOCKET);
    	AttBonusMax /= 100;
    	AttBonusMax += 0.5;
    
    	double AttBonusMin = static_cast<double>(pkItemAbsorbed->alValues[3] + pkItemAbsorbed->alValues[5]);
    	AttBonusMin *= acceItem->GetSocket(ACCE_ABSORPTION_SOCKET);
    	AttBonusMin /= 100;
    	AttBonusMin += 0.5;
          
        //todebug
        if(ch->IsPhase(PHASE_GAME))
        	ch->ChatPacket(CHAT_TYPE_INFO, "Going to add to your attack : min(%0.2f) max(%0.2f) ", AttBonusMin, AttBonusMax);
          
    	*pdamMax += static_cast<int>(AttBonusMax);
    	*pdamMin += static_cast<int>(AttBonusMin);
    }

     

     

    You may need to add #include "desc.h" at the beginning of the file if you got errors on IsPhase line

     

    In order to debug the code you need to use a sash with attack min and max as bonuses and to hit a mob

     

    • Love 1
  12. 2 minutes ago, Shahin said:

    The values for Magic attack for min and max are good now, but i don't get Normal Attack bonuses at all...

     

    Can you please show me your void CPythonPlayer::__UpdateBattleStatus()

     

    Can you please try to hit a mob with and without the sash to check if server-side the bonus are applied?

     

    And last question, can you tell me if you changed the define with your one?

    • Love 1
  13. 19 hours ago, Ikarus_ said:

    It's impossible to me to give you an exact cause of why your cache looks corrupted.

    You can read more about dangling pointers here.

     

    I ve already said that we don't have enoght information to know where the problem is.

    I guess you might check all the parts where the m_map_itemCache is used and try to debug your code by adding sys_log and analyze what the code do.

  14. Here it looks to be correct. It must work permanently.

    I suspect the problem would be how you are 'stopping' the db core.

    The changes (e.g. ch->SetRealPoint) are not immediatly saved into the player table, the db core has a cache which is flushed (and so saved) every X seconds (Where x is a variable number).

     

    The value X is defined here:

    CPlayerTableCache::CPlayerTableCache()
    {
    	m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds);
    }

     

    so it is a number between 0, and 1800.

    By default this value of seconds is defined here :
     

    int g_iPlayerCacheFlushSeconds = 60*7;

     

    and it's 7 minutes (you may set it by defining it in the conf.txt by using the key PLAYER_CACHE_FLUSH_SECONDS)


    Why i m explaning all about this?
    Because i want to give you way to get what my theory consists.

     

    My theory is that you are killing the db process by using killall -9 db or some other command which interrupt the db process, instead of sending a normal stop signal that gives the db time to save changes (currently cached) to the table.

    My suggestion is to check how your kill script of the channels/db  is stopping them.

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