Yardım Otomatik Toplama Ek Envanter Uyarlaması Yardım

  • Konuyu açan Konuyu açan layers
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 6
  • Gösterim Gösterim 117
Konu sahibi bu konuda soru soruyor. Sorusu ile ilgili bilgisi olanların yanıtlamasını bekliyor.

layers

layerswork.com.tr
MT Üye
Mesaj
285
Çözümler
22
Beğeni
211
Puan
414
Ticaret Puanı
0
Merhaba arkadaşlar oto toplama açıkken yere düşen bk veya yükseltme itemleri envantere geliyor. Bunu nasıl ek envantere gelmesini yapabilirim?

Kod:
Genişlet Daralt Kopyala
#ifdef RENEWAL_PICKUP_AFFECT
void CHARACTER::AutoGiveItemNew(LPITEM item, bool printMsg)
{
    if (!item)
        return;

    const DWORD itemVnum = item->GetVnum();
    const WORD realCount = item->GetCount();

    WORD wCount = item->GetCount();

    if (item->IsStackable() && item->GetType() != ITEM_BLEND)
    {
        for (WORD i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
        {
            LPITEM invItem = GetInventoryItem(i);
            if (!invItem)
                continue;

            if (invItem->GetVnum() == itemVnum)
            {
                BYTE j;
                for (j = 0; j < ITEM_SOCKET_MAX_NUM; ++j)
                    if (invItem->GetSocket(j) != item->GetSocket(j))
                        break;
                if (j != ITEM_SOCKET_MAX_NUM)
                    continue;
                const WORD bCount2 = MIN(ITEM_MAX_COUNT - invItem->GetCount(), wCount);
                if (bCount2 > 0)
                {
                    wCount -= bCount2;
                    invItem->SetCount(invItem->GetCount() + bCount2);
                    if (wCount == 0)
                    {
                        if (printMsg)
                        {
                            if (realCount > 1)
                                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
                            else
                                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
                        }
                        M2_DESTROY_ITEM(item);
                        return;
                    }
                }
            }
        }
        item->SetCount(wCount);
    }

    const int cell = item->IsDragonSoul() ? GetEmptyDragonSoulInventory(item) : GetEmptyInventory(item->GetSize());
    if (cell != -1)
    {
        item->AddToCharacter(this, TItemPos(item->IsDragonSoul() ? DRAGON_SOUL_INVENTORY : INVENTORY, cell));
        if (printMsg)
        {
            if (realCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
            else
                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
        }
    }
    else
    {
        if (printMsg && realCount != wCount)
        {
            if (realCount-wCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
        }

        item->AddToGround(GetMapIndex(), GetXYZ());
        item->StartDestroyEvent();
        item->SetOwnership(this, 300);
    }
}
bool CHARACTER::CanPickupDirectly()
{
    return FindAffect(AFFECT_PICKUP_ENABLE) != NULL;
}
#endif
 

Dosya Eklentileri

Çözüm
şunu denermisin

char_item.cpp:
Genişlet Daralt Kopyala
#ifdef RENEWAL_PICKUP_AFFECT
void CHARACTER::AutoGiveItemNew(LPITEM item, bool printMsg)
{
    if (NULL == item)
    {
        sys_err ("NULL point.");
        return;
    }
    if (item->GetOwner())
    {
        sys_err ("item %d 's owner exists!",item->GetID());
        return;
    }

    const DWORD itemVnum = item->GetVnum();
    const WORD realCount = item->GetCount();

    WORD wCount = item->GetCount();

    if (item->IsStackable() && item->GetType() != ITEM_BLEND)
    {
        for (WORD i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
        {
            LPITEM invItem = GetInventoryItem(i);
            if (!invItem)
                continue;

            if (invItem->GetVnum() == itemVnum)
            {...
C++:
Genişlet Daralt Kopyala
const int cell = item->IsDragonSoul() ? GetEmptyDragonSoulInventory(item) : GetEmptyInventory(item->GetSize());
    if (cell != -1)
    {
        item->AddToCharacter(this, TItemPos(item->IsDragonSoul() ? DRAGON_SOUL_INVENTORY : INVENTORY, cell));
        if (printMsg)
        {
            if (realCount > 1)

                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);

                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
            else
                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
        }
    }
    else
    {
        if (printMsg && realCount != wCount)
        {
            if (realCount-wCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
        }
        item->AddToGround(GetMapIndex(), GetXYZ());
        item->StartDestroyEvent();
        item->SetOwnership(this, 300);
    }
}
bool CHARACTER::CanPickupDirectly()
{
    return FindAffect(AFFECT_PICKUP_ENABLE) != NULL;
}

#endif


bu kısmı
diğer pickup dan al yerden manuel toplamadan altına ekle
 
En son bir moderatör tarafından düzenlenmiş:
Merhaba arkadaşlar oto toplama açıkken yere düşen bk veya yükseltme itemleri envantere geliyor. Bunu nasıl ek envantere gelmesini yapabilirim?

Kod:
Genişlet Daralt Kopyala
#ifdef RENEWAL_PICKUP_AFFECT
void CHARACTER::AutoGiveItemNew(LPITEM item, bool printMsg)
{
    if (!item)
        return;

    const DWORD itemVnum = item->GetVnum();
    const WORD realCount = item->GetCount();

    WORD wCount = item->GetCount();

    if (item->IsStackable() && item->GetType() != ITEM_BLEND)
    {
        for (WORD i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
        {
            LPITEM invItem = GetInventoryItem(i);
            if (!invItem)
                continue;

            if (invItem->GetVnum() == itemVnum)
            {
                BYTE j;
                for (j = 0; j < ITEM_SOCKET_MAX_NUM; ++j)
                    if (invItem->GetSocket(j) != item->GetSocket(j))
                        break;
                if (j != ITEM_SOCKET_MAX_NUM)
                    continue;
                const WORD bCount2 = MIN(ITEM_MAX_COUNT - invItem->GetCount(), wCount);
                if (bCount2 > 0)
                {
                    wCount -= bCount2;
                    invItem->SetCount(invItem->GetCount() + bCount2);
                    if (wCount == 0)
                    {
                        if (printMsg)
                        {
                            if (realCount > 1)
                                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
                            else
                                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
                        }
                        M2_DESTROY_ITEM(item);
                        return;
                    }
                }
            }
        }
        item->SetCount(wCount);
    }

    const int cell = item->IsDragonSoul() ? GetEmptyDragonSoulInventory(item) : GetEmptyInventory(item->GetSize());
    if (cell != -1)
    {
        item->AddToCharacter(this, TItemPos(item->IsDragonSoul() ? DRAGON_SOUL_INVENTORY : INVENTORY, cell));
        if (printMsg)
        {
            if (realCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
            else
                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
        }
    }
    else
    {
        if (printMsg && realCount != wCount)
        {
            if (realCount-wCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
        }

        item->AddToGround(GetMapIndex(), GetXYZ());
        item->StartDestroyEvent();
        item->SetOwnership(this, 300);
    }
}
bool CHARACTER::CanPickupDirectly()
{
    return FindAffect(AFFECT_PICKUP_ENABLE) != NULL;
}
#endif
Dracarys ın sistemi mi bu?
 
şunu denermisin

char_item.cpp:
Genişlet Daralt Kopyala
#ifdef RENEWAL_PICKUP_AFFECT
void CHARACTER::AutoGiveItemNew(LPITEM item, bool printMsg)
{
    if (NULL == item)
    {
        sys_err ("NULL point.");
        return;
    }
    if (item->GetOwner())
    {
        sys_err ("item %d 's owner exists!",item->GetID());
        return;
    }

    const DWORD itemVnum = item->GetVnum();
    const WORD realCount = item->GetCount();

    WORD wCount = item->GetCount();

    if (item->IsStackable() && item->GetType() != ITEM_BLEND)
    {
        for (WORD i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
        {
            LPITEM invItem = GetInventoryItem(i);
            if (!invItem)
                continue;

            if (invItem->GetVnum() == itemVnum)
            {
                BYTE j;
                for (j = 0; j < ITEM_SOCKET_MAX_NUM; ++j)
                    if (invItem->GetSocket(j) != item->GetSocket(j))
                        break;
                if (j != ITEM_SOCKET_MAX_NUM)
                    continue;
                const WORD bCount2 = MIN(ITEM_MAX_COUNT - invItem->GetCount(), wCount);
                if (bCount2 > 0)
                {
                    wCount -= bCount2;
                    invItem->SetCount(invItem->GetCount() + bCount2);
                    if (wCount == 0)
                    {
                        if (printMsg)
                        {
                            if (realCount > 1)
                                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
                            else
                                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
                        }
                        M2_DESTROY_ITEM(item);
                        return;
                    }
                }
            }
        }
        item->SetCount(wCount);
    }

    const int cell = GetEmptyInventoryEx(item);
    if (cell != -1)
    {
        item->AddToCharacter(this, TItemPos(item->GetWindowInventoryEx(), cell));
        if (printMsg)
        {
            if (realCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
            else
                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
        }
    }
    else
    {
        if (printMsg && realCount != wCount)
        {
            if (realCount-wCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
        }

        item->AddToGround(GetMapIndex(), GetXYZ());
        item->StartDestroyEvent();
        item->SetOwnership(this, 300);
    }
}
bool CHARACTER::CanPickupDirectly()
{
    return FindAffect(AFFECT_PICKUP_ENABLE) != NULL;
}
#endif
 
Son düzenleme:
Çözüm
süpersin knk :)
şunu denermisin

char_item.cpp:
Genişlet Daralt Kopyala
#ifdef RENEWAL_PICKUP_AFFECT
void CHARACTER::AutoGiveItemNew(LPITEM item, bool printMsg)
{
    if (NULL == item)
    {
        sys_err ("NULL point.");
        return;
    }
    if (item->GetOwner())
    {
        sys_err ("item %d 's owner exists!",item->GetID());
        return;
    }

    const DWORD itemVnum = item->GetVnum();
    const WORD realCount = item->GetCount();

    WORD wCount = item->GetCount();

    if (item->IsStackable() && item->GetType() != ITEM_BLEND)
    {
        for (WORD i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
        {
            LPITEM invItem = GetInventoryItem(i);
            if (!invItem)
                continue;

            if (invItem->GetVnum() == itemVnum)
            {
                BYTE j;
                for (j = 0; j < ITEM_SOCKET_MAX_NUM; ++j)
                    if (invItem->GetSocket(j) != item->GetSocket(j))
                        break;
                if (j != ITEM_SOCKET_MAX_NUM)
                    continue;
                const WORD bCount2 = MIN(ITEM_MAX_COUNT - invItem->GetCount(), wCount);
                if (bCount2 > 0)
                {
                    wCount -= bCount2;
                    invItem->SetCount(invItem->GetCount() + bCount2);
                    if (wCount == 0)
                    {
                        if (printMsg)
                        {
                            if (realCount > 1)
                                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
                            else
                                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
                        }
                        M2_DESTROY_ITEM(item);
                        return;
                    }
                }
            }
        }
        item->SetCount(wCount);
    }

    const int cell = GetEmptyInventoryEx(item);
    if (cell != -1)
    {
        item->AddToCharacter(this, TItemPos(item->GetWindowInventoryEx(), cell));
        if (printMsg)
        {
            if (realCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
            else
                //ChatPacket(CHAT_TYPE_INFO, "112 %s", item->GetName());
                ChatPacket(CHAT_TYPE_INFO, "[LS;2039;%s]", item->GetName());
        }
    }
    else
    {
        if (printMsg && realCount != wCount)
        {
            if (realCount-wCount > 1)
                //ChatPacket(CHAT_TYPE_INFO, "111 %s %d", item->GetName(), realCount);
                ChatPacket(CHAT_TYPE_INFO, "[LS;2038;%d;%s]", realCount, item->GetName());
        }

        item->AddToGround(GetMapIndex(), GetXYZ());
        item->StartDestroyEvent();
        item->SetOwnership(this, 300);
    }
}
bool CHARACTER::CanPickupDirectly()
{
    return FindAffect(AFFECT_PICKUP_ENABLE) != NULL;
}
#endif
 
Geri
Üst