Jump to content

Legend

Banned
  • Posts

    150
  • Joined

  • Last visited

  • Days Won

    5
  • Feedback

    0%

Posts posted by Legend

  1. Hey,

    Today i will show you how you can fix easy the invisibility effect bug and the AFFECT_EUNHYEONG = sealth ninja skill from 17.5 Official update.

    InstanceBase.cpp (Is hiding the ninja from the minimap)

    Spoiler

    Search for:

    Spoiler

    BOOL CInstanceBase::IsInvisibility()

    {

        if (IsAffect(AFFECT_INVISIBILITY))
            return true;

        return false;

    }

     

    Replace with:

    Spoiler

    BOOL CInstanceBase::IsInvisibility()
    {
        if (IsAffect(AFFECT_INVISIBILITY) || IsAffect(AFFECT_EUNHYEONG))
            return true;

        return false;
    }

     

    Search for:

    Spoiler

    void CInstanceBase::Render()
    {

    Inside the function search for:

     m_GraphicThingInstance.Render();

    Add bellow:

    1.     CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance();
    2.  
    3.     for (auto ptr = rkChrMgr.CharacterInstanceBegin(); ptr != rkChrMgr.CharacterInstanceEnd(); ++ptr)
    4.     {
    5.         CInstanceBase * pkInstEach = *ptr;
    6.  
    7.         if (pkInstEach)
    8.         {
    9.             if (pkInstEach->IsAffect(AFFECT_EUNHYEONG) || pkInstEach->IsAffect(AFFECT_INVISIBILITY))
    10.             {
    11.                 if (CPythonPlayer::Instance().IsMainCharacterIndex(pkInstEach->GetVirtualID()))
    12.                     continue;
    13.  
    14.                 pkInstEach->m_GraphicThingInstance.HideAllAttachingEffect();
    15.             }
    16.         }
    17.     }

     

    InstanceBaseEffect.cpp

    Search for:

    Spoiler

    void CInstanceBase::__SetAffect(UINT eAffect, bool isVisible)
    {

    Inside the function search:

            case AFFECT_INVISIBILITY:
                if (isVisible)
                {
                    m_GraphicThingInstance.ClearAttachingEffect();
                    __EffectContainer_Destroy();
                    DetachTextTail();
                }
                else
                {
                    m_GraphicThingInstance.BlendAlphaValue(1.0f, 1.0f);
                    AttachTextTail();
                    RefreshTextTail();
                }
                return;
                break;

    }

    Replace with:

    Spoiler

            case AFFECT_INVISIBILITY:
                if (isVisible)
                {
                    // m_GraphicThingInstance.ClearAttachingEffect();
                    // __EffectContainer_Destroy();
                    // DetachTextTail();
                    m_GraphicThingInstance.HideAllAttachingEffect();
                }
                else
                {
                    m_GraphicThingInstance.BlendAlphaValue(1.0f, 1.0f);
                    m_GraphicThingInstance.ShowAllAttachingEffect();

                    // AttachTextTail();
                    // RefreshTextTail();
                }
                return;
                break;

     

    • Metin2 Dev 2
    • Love 18
  2. 2 minutes ago, ReFresh said:

    @Legend

      Reveal hidden contents
    
    
    void CHARACTER::AutoGiveItem(LPITEM item, bool longOwnerShip)
    {
    	if (NULL == item)
    	{
    		sys_err ("NULL point.");
    		return;
    	}
    	if (item->GetOwner())
    	{
    		sys_err ("item %d 's owner exists!",item->GetID());
    		return;
    	}
    	
    	int cell;
    	if (item->IsDragonSoul())
    	{
    		cell = GetEmptyDragonSoulInventory(item);
    	}
    	else
    	{
    		cell = GetEmptyInventory (item->GetSize());
    	}
    
    	if (cell != -1)
    	{
    		if (item->IsDragonSoul())
    			item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, cell));
    		else
    			item->AddToCharacter(this, TItemPos(INVENTORY, cell));
    
    		LogManager::instance().ItemLog(this, item, "SYSTEM", item->GetName());
    
    		if (item->GetType() == ITEM_USE && item->GetSubType() == USE_POTION)
    		{
    			TQuickslot * pSlot;
    
    			if (GetQuickslot(0, &pSlot) && pSlot->type == QUICKSLOT_TYPE_NONE)
    			{
    				TQuickslot slot;
    				slot.type = QUICKSLOT_TYPE_ITEM;
    				slot.pos = cell;
    				SetQuickslot(0, slot);
    			}
    		}
    	}
    	else
    	{
    		item->AddToGround (GetMapIndex(), GetXYZ());
    		item->StartDestroyEvent();
    
    		if (longOwnerShip)
    			item->SetOwnership (this, 300);
    		else
    			item->SetOwnership (this, 60);
    		LogManager::instance().ItemLog(this, item, "SYSTEM_DROP", item->GetName());
    	}
    }
    
    LPITEM CHARACTER::AutoGiveItem(DWORD dwItemVnum, BYTE bCount, int iRarePct, bool bMsg)
    {
    	TItemTable * p = ITEM_MANAGER::instance().GetTable(dwItemVnum);
    
    	if (!p)
    		return NULL;
    
    	DBManager::instance().SendMoneyLog(MONEY_LOG_DROP, dwItemVnum, bCount);
    
    	if (p->dwFlags & ITEM_FLAG_STACKABLE && p->bType != ITEM_BLEND) 
    	{
    		for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
    		{
    			LPITEM item = GetInventoryItem(i);
    
    			if (!item)
    				continue;
    
    			if (item->GetVnum() == dwItemVnum && FN_check_item_socket(item))
    			{
    				if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT))
    				{
    					if (bCount < p->alValues[1])
    						bCount = p->alValues[1];
    				}
    
    				BYTE bCount2 = MIN(200 - item->GetCount(), bCount);
    				bCount -= bCount2;
    
    				item->SetCount(item->GetCount() + bCount2);
    
    				if (bCount == 0)
    				{
    					if (bMsg)
    						ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ľĆŔĚĹŰ Čąµć: %s"), item->GetName());
    
    					return item;
    				}
    			}
    		}
    	}
    
    	LPITEM item = ITEM_MANAGER::instance().CreateItem(dwItemVnum, bCount, 0, true);
    
    	if (!item)
    	{
    		sys_err("cannot create item by vnum %u (name: %s)", dwItemVnum, GetName());
    		return NULL;
    	}
    
    	if (item->GetType() == ITEM_BLEND)
    	{
    		for (int i=0; i < INVENTORY_MAX_NUM; i++)
    		{
    			LPITEM inv_item = GetInventoryItem(i);
    
    			if (inv_item == NULL) continue;
    
    			if (inv_item->GetType() == ITEM_BLEND)
    			{
    				if (inv_item->GetVnum() == item->GetVnum())
    				{
    					if (inv_item->GetSocket(0) == item->GetSocket(0) &&
    							inv_item->GetSocket(1) == item->GetSocket(1) &&
    							inv_item->GetSocket(2) == item->GetSocket(2) &&
    							inv_item->GetCount() < ITEM_MAX_COUNT)
    					{
    						inv_item->SetCount(inv_item->GetCount() + item->GetCount());
    						return inv_item;
    					}
    				}
    			}
    		}
    	}
    
    	int iEmptyCell;
    	if (item->IsDragonSoul())
    	{
    		iEmptyCell = GetEmptyDragonSoulInventory(item);
    	}
    	else
    		iEmptyCell = GetEmptyInventory(item->GetSize());
    
    	if (iEmptyCell != -1)
    	{
    		if (bMsg)
    			ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ľĆŔĚĹŰ Čąµć: %s"), item->GetName());
    
    		if (item->IsDragonSoul())
    			item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
    		else
    			item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell));
    		LogManager::instance().ItemLog(this, item, "SYSTEM", item->GetName());
    
    		if (item->GetType() == ITEM_USE && item->GetSubType() == USE_POTION)
    		{
    			TQuickslot * pSlot;
    
    			if (GetQuickslot(0, &pSlot) && pSlot->type == QUICKSLOT_TYPE_NONE)
    			{
    				TQuickslot slot;
    				slot.type = QUICKSLOT_TYPE_ITEM;
    				slot.pos = iEmptyCell;
    				SetQuickslot(0, slot);
    			}
    		}
    	}
    	else
    	{
    		item->AddToGround(GetMapIndex(), GetXYZ());
    		item->StartDestroyEvent();
    		// ľČĆĽ µĺ¶ř flag°ˇ °É·ÁŔÖ´Â ľĆŔĚĹŰŔÇ °ćżě, 
    		// ŔÎşĄżˇ şó °ř°ŁŔĚ ľřľîĽ­ ľîÂż Ľö ľřŔĚ ¶łľîĆ®¸®°Ô µÇ¸é,
    		// ownershipŔ» ľĆŔĚĹŰŔĚ »ç¶óÁú ¶§±îÁö(300ĂĘ) ŔŻÁöÇŃ´Ů.
    		if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_DROP))
    			item->SetOwnership(this, 300);
    		else
    			item->SetOwnership(this, 60);
    		LogManager::instance().ItemLog(this, item, "SYSTEM_DROP", item->GetName());
    	}
    
    	sys_log(0, 
    		"7: %d %d", dwItemVnum, bCount);
    	return item;
    }

     

     

     

    The text phrase is not coming from the autogiveitem function as i can see. please find from where is comes and let me know.

  3. 14 minutes ago, ReFresh said:

    @Legend Thanks gonna to try it and can you tell me how can I delete: You recieved bla bla ... when I buy something from normal npc shop? 

    // Remove: You have received blabla. text.

    Spoiler

     

    Replace::

            item = ch->AutoGiveItem(item->GetVnum(), item->GetCount());

    With:

            item = ch->AutoGiveItem(item->GetVnum(), item->GetCount(), -1, false);

     

     

    • Love 1
  4. 16 minutes ago, ReFresh said:

    @Legend Any solution for this must exist because one server have it without the: You recieved.. bla bla

    And still need do a stacking items when I buy them from private shop.

    shopEx.cpp


    You have received blabla:

    Spoiler

     

    // Search for:

        LogManager::instance().ItemLog(ch, item, "BUY", item->GetName());

     

    // Add under:

        ch->ChatPacket(CHAT_TYPE_INFO, "You have bought: %s for %u yang.", item->GetName(), dwPrice);

     

     

    Auto Stack (privateshop):

    Spoiler

    File: shopEx.cpp 

    Search:

        if (item->IsDragonSoul())
            item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
        else
            item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));

    Replace with this.

     // if (item->IsDragonSoul())
            // item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
        // else
            // item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
        // AutoGiveItem ( Stack )
        item = ch->AutoGiveItem(item->GetVnum(), item->GetCount());
        // End

     

  5. I already finish that system, is very nice you can add a table which the player when use the mount for first time to select a bonus like 20% against monsters, 10% critical attack etc and you can see that bonus on the seal [tooltip], also a name like horse for the new mount which you can see on the seal [Name].

  6. On 3/14/2017 at 11:50 PM, Tasho said:

    Thanks for release, but why you create a new bool for what? to look like more tutorial code? need only 3 lines.

    
    	const TPixelPosition& c_rkPPosCur = NEW_GetCurPixelPositionRef();
    	if (CPythonBackground::Instance().isAttrOn(c_rkPPosCur.x, c_rkPPosCur.y, CTerrainImpl::ATTRIBUTE_BANPK))
    		return FALSE;

    Also the check is already exist, just need to copy-paste check from:

    
    bool CInstanceBase::IsInSafe() // InstanceBase.cpp

    Original idea is from: Rubinum2.

      Reveal hidden contents

     

     

    I create a new bool because in my source i use more code from that what i share here.

    I had coded this before a long time ago and i share it now, the idea is not coming from Rubinum2 but they have released a video and show this idea to the community before me.

    • Love 1
  7. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Today i release a code which you can walk through safezone without block

     

    Client Source:

     

    GameLib

    ActorInstance.h

    // Search for:
    		BOOL TestPhysicsBlendingCollision(CActorInstance & rVictim);
    
    // Add under:
    // #ifdef ENABLE_SAFEZONE_STOP_COLLISION
    		BOOL IsInSafe(CActorInstance & ptr);
    // #endif

     

    ActorInstanceCollisionDetection.cpp

    // Search for:
    BOOL CActorInstance::TestActorCollision(CActorInstance & rVictim)
    
    // Add before:
    // #ifdef ENABLE_SAFEZONE_STOP_COLLISION
    #include "../UserInterface/PythonBackground.h"
    
    BOOL CActorInstance::IsInSafe(CActorInstance & ptr)
    {
    	const TPixelPosition& c_rkPPosCur = ptr.NEW_GetCurPixelPositionRef();
    	if (CPythonBackground::Instance().isAttrOn(c_rkPPosCur.x, c_rkPPosCur.y, (1 << 2)))
    		return true;
    
    	return false;
    }
    // #endif
    
    // On CActorInstance::TestActorCollision
    // Search for:
    	if (rVictim.IsDead())
    		return false;
    
    // Add under:
    // #ifdef ENABLE_SAFEZONE_STOP_COLLISION
    	if (IsInSafe(rVictim))
    		return false;
    // #endif

     

    Enjoy.

     

     

    • Metin2 Dev 12
    • Good 2
    • Love 19
×
×
  • 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.