Jump to content
Sign in to follow this  
Kenshi Torres

Recoleccion de elementos rapidos del suelo (c++)

Recommended Posts

Hola chicos, sé que este tema está disponible en muchos foros, pero como quiero que esté a nuestra disposición, dejo aquí el bloque de código para que los amigos que lo necesiten puedan usarlo.


NOTA: Esto no recoge todos los elementos del suelo de una sola vez. Solo te permite recolectarlo rápidamente.
ClientSource / UserInterface / PythonPlayer.cpp

 

void CPythonPlayer::SendClickItemPacket(DWORD dwIID)
{
    if (IsObserverMode())
        return;

    static DWORD s_dwNextTCPTime = 0;

    DWORD dwCurTime=ELTimer_GetMSec();

    if (dwCurTime >= s_dwNextTCPTime)
    {
        s_dwNextTCPTime=dwCurTime + 500;

        const char * c_szOwnerName;
        if (!CPythonItem::Instance().GetOwnership(dwIID, &c_szOwnerName))
            return;

        if (strlen(c_szOwnerName) > 0)
        if (0 != strcmp(c_szOwnerName, GetName()))
        {
            CItemData * pItemData;
            if (!CItemManager::Instance().GetItemDataPointer(CPythonItem::Instance().GetVirtualNumberOfGroundItem(dwIID), &pItemData))
            {
                Tracenf("CPythonPlayer::SendClickItemPacket(dwIID=%d) : Non-exist item.", dwIID);
                return;
            }
            if (!IsPartyMemberByName(c_szOwnerName) || pItemData->IsAntiFlag(CItemData::ITEM_ANTIFLAG_DROP | CItemData::ITEM_ANTIFLAG_GIVE))
            {
                PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotPickItem", Py_BuildValue("()"));
                return;
            }
        }

        CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
        rkNetStream.SendItemPickUpPacket(dwIID);
    }
}

Si lo desea, cambie el bloque de código anterior a la línea de comentarios o reemplácelo con el bloque de código a continuación

 

ClientSource / UserInterface / PythonPlayer.cpp:

 

void CPythonPlayer::SendClickItemPacket(DWORD dwIID)
{
    if (IsObserverMode())
        return;

    const char * c_szOwnerName;
    if (!CPythonItem::Instance().GetOwnership(dwIID, &c_szOwnerName))
        return;

    if (strlen(c_szOwnerName) > 0)
    if (0 != strcmp(c_szOwnerName, GetName()))
    {
        CItemData * pItemData;
        if (!CItemManager::Instance().GetItemDataPointer(CPythonItem::Instance().GetVirtualNumberOfGroundItem(dwIID), &pItemData))
        {
            Tracenf("CPythonPlayer::SendClickItemPacket(dwIID=%d) : Non-exist item.", dwIID);
            return;
        }
        if (!IsPartyMemberByName(c_szOwnerName) || pItemData->IsAntiFlag(CItemData::ITEM_ANTIFLAG_DROP | CItemData::ITEM_ANTIFLAG_GIVE))
        {
            PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotPickItem", Py_BuildValue("()"));
            return;
        }
    }

    CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
    rkNetStream.SendItemPickUpPacket(dwIID);
}
ClientSource / UserInterface / PythonPlayer.cpp:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...