Jump to content

MeleyLiar Core Crash


Go to solution Solved by WeedHex,

Recommended Posts

Hello guys, i have a little problem with the Meley run. Once in a while one of my cores ( the one that is used by the run ) crashes and then i get this

 

https://metin2.download/picture/86iEM56V9EDRmaE5Q9YEX6HoxD2T9c5a/.png

MeleyLair.cpp

bool CMgrMap::IsPartecipant(DWORD dwPlayerID)
    {
        bool bCheck = std::find(v_Partecipants.begin(), v_Partecipants.end(), dwPlayerID) != v_Partecipants.end();
        return bCheck;
    }
void CMgr::OnKillCommon(LPCHARACTER pkMonster, LPCHARACTER pkChar, CGuild* pkGuild)
    {
        if ((!pkMonster) || (!pkChar) || (!pkGuild))
            return;
        
        CMgrMap* pMap = m_RegGuilds.find(pkGuild->GetID())->second;
        if (!pMap)
            return;
        else if (!pMap->IsPartecipant(pkChar->GetPlayerID()))
            return;
        else if (pMap->GetDungeonStep() < 3)
            return;
        
        int iChance = number(1, 100);
        if (iChance > 70)
        {
            LPITEM pkItem = ITEM_MANAGER::instance().CreateItem(SEAL_VNUM_KILL_STATUE);
            if (!pkItem)
                return;
            
            PIXEL_POSITION mPos;
            mPos.x = pkMonster->GetX();
            mPos.y = pkMonster->GetY();
            
            pkItem->AddToGround(pMap->GetMapIndex(), mPos);
            pkItem->StartDestroyEvent();
            pkItem->SetOwnership(pkChar, 60);
        }
    }

char_battle.cpp

    if ((IsStone()) || (IsMonster()))
    {
        if (pkKiller)
        {
            if (((GetMobTable().dwVnum == (DWORD)(MeleyLair::MOBVNUM_RESPAWN_STONE_STEP2)) || (GetMobTable().dwVnum == (DWORD)(MeleyLair::MOBVNUM_RESPAWN_BOSS_STEP3))) && (MeleyLair::CMgr::instance().IsMeleyMap(pkKiller->GetMapIndex())))
                MeleyLair::CMgr::instance().OnKill(GetMobTable().dwVnum, pkKiller->GetGuild());
            else if (MeleyLair::CMgr::instance().IsMeleyMap(pkKiller->GetMapIndex()))
                MeleyLair::CMgr::instance().OnKillCommon(this, pkKiller, pkKiller->GetGuild());
        }
    }

 

If any of you has any idea about what triggers that crash and/or what can i fix, i'd appreciate it. Thanks!

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

bool CMgrMap::IsPartecipant(DWORD dwPlayerID)     
{
         if (!dwPlayerID)             
                return false;
         itertype(v_Partecipants) it = std::find(v_Partecipants.begin(), v_Partecipants.end(), dwPlayerID);

         if (it != v_Partecipants.end())
             return true;         
         return false;
}

 

This refactor by WeedHex helped me. Seems like the problem is solved. Thanks :)

  • Confused 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.