Jump to content

c++ ring problem source


Recommended Posts

Hi I have a problem with ring in src. Namely, when the creatures make it up the ring and the item does not have time but continues to write 0. In what could be the problem?
My function is as follows. Thanks in advance for your help

 

59888637846562931728.jpg

 

 

bool CHARACTER::EquipItem(LPITEM item, int iCandidateCell)
{
    if (item->IsExchanging())
        return false;

    if (false == item->IsEquipable())
        return false;

    if (false == CanEquipNow(item))
        return false;

    int iWearCell = item->FindEquipCell(this, iCandidateCell);

    if (iWearCell < 0)
        return false;

    // ???? ? ???? ??? ?? ??
    if (iWearCell == WEAR_BODY && IsRiding() && (item->GetVnum() >= 11901 && item->GetVnum() <= 11904))
    {
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("?? ? ???? ??? ?? ? ????."));
        return false;
    }

    if (iWearCell != WEAR_ARROW && IsPolymorphed())
    {
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("?? ??? ???? ??? ??? ? ????."));
        return false;
    }

    if (FN_check_item_sex(this, item) == false)
    {
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("??? ???? ? ???? ??? ? ????."));
        return false;
    }

    //?? ?? ??? ?? ? ???? ??
    if(item->IsRideItem() && IsRiding())
    {
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("?? ??? ??????."));
        return false;
    }

    // ?? ???? ??? ?? ?? ?? ?? ?? 1.5 ?? ?? ??? ??
    DWORD dwCurTime = get_dword_time();

    if (iWearCell != WEAR_ARROW 
        && (dwCurTime - GetLastAttackTime() <= 1500 || dwCurTime - m_dwLastSkillTime <= 1500))
    {
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("??? ?? ?? ??? ? ????."));
        return false;
    }

    // ??? ?? ??
    if (item->IsDragonSoul())
    {
        // ?? ??? ???? ?? ??? ??? ??? ? ??.
        // ???? swap? ???? ??.
        if(GetInventoryItem(INVENTORY_MAX_NUM + iWearCell))
        {
            ChatPacket(CHAT_TYPE_INFO, "?? ?? ??? ???? ???? ????.");
            return false;
        }
        
        if (!item->EquipTo(this, iWearCell))
        {
            return false;
        }
    }
    // ???? ??.
    else
    {
        // ??? ?? ???? ???,
        if (GetWear(iWearCell) && !IS_SET(GetWear(iWearCell)->GetFlag(), ITEM_FLAG_IRREMOVABLE))
        {
            // ? ???? ?? ??? ?? ??. swap ?? ?? ??
            if (item->GetWearFlag() == WEARABLE_ABILITY) 
                return false;

            if (false == SwapItem(item->GetCell(), INVENTORY_MAX_NUM + iWearCell))
            {
                return false;
            }
        }
        else
        {
            BYTE bOldCell = item->GetCell();

            if (item->EquipTo(this, iWearCell))
            {
                SyncQuickslot(QUICKSLOT_TYPE_ITEM, bOldCell, iWearCell);
            }
        }
    }

    if (true == item->IsEquipped())
    {
        // ??? ?? ?? ????? ???? ??? ??? ???? ?? ??. 
        if (-1 != item->GetProto()->cLimitRealTimeFirstUseIndex)
        {
            // ? ???? ??? ????? ??? Socket1? ?? ????. (Socket1? ???? ??)
            if (0 == item->GetSocket(1))
            {
                // ??????? Default ??? Limit Value ?? ????, Socket0? ?? ??? ? ?? ????? ??. (??? ?)
                long duration = (0 != item->GetSocket(0)) ? item->GetSocket(0) : item->GetProto()->aLimits[item->GetProto()->cLimitRealTimeFirstUseIndex].lValue;

                if (0 == duration)
                    duration = 60 * 60 * 24 * 7;

                //item->SetSocket(0, time(0) + duration);
                item->SetSocket(ITEM_SOCKET_UNIQUE_REMAIN_TIME, time(0) + duration);
                item->StartRealTimeExpireEvent();
            }

            item->SetSocket(1, item->GetSocket(1) + 1);
        }
        
        //if (-1 != iLimitRealtimeStartFirstUseFlagIndex)

        if (item->GetVnum() == UNIQUE_ITEM_HIDE_ALIGNMENT_TITLE)
            ShowAlignment(false);

        const DWORD& dwVnum = item->GetVnum();

        // ??? ??? ???? ??(71135) ??? ??? ??
        if (true == CItemVnumHelper::IsRamadanMoonRing(dwVnum))
        {
            this->EffectPacket(SE_EQUIP_RAMADAN_RING);
        }
        // ??? ??(71136) ??? ??? ??
        else if (true == CItemVnumHelper::IsHalloweenCandy(dwVnum))
        {
            this->EffectPacket(SE_EQUIP_HALLOWEEN_CANDY);
        }
        // ??? ??(71143) ??? ??? ??
        else if (true == CItemVnumHelper::IsHappinessRing(dwVnum))
        {
            this->EffectPacket(SE_EQUIP_HAPPINESS_RING);
        }
        // ??? ???(71145) ??? ??? ??
        else if (true == CItemVnumHelper::IsLovePendant(dwVnum))
        {
            this->EffectPacket(SE_EQUIP_LOVE_PENDANT);
        }
        // ITEM_UNIQUE? ??, SpecialItemGroup? ???? ??, (item->GetSIGVnum() != NULL)
        // 
        else if (ITEM_UNIQUE == item->GetType() && 0 != item->GetSIGVnum())
        {
            const CSpecialItemGroup* pGroup = ITEM_MANAGER::instance().GetSpecialItemGroup(item->GetSIGVnum());
            if (NULL != pGroup)
            {
                const CSpecialAttrGroup* pAttrGroup = ITEM_MANAGER::instance().GetSpecialAttrGroup(pGroup->GetAttrVnum(item->GetVnum()));
                if (NULL != pAttrGroup)
                {
                    const std::string& std = pAttrGroup->m_stEffectFileName;
                    SpecificEffectPacket(std.c_str());
                }
            }
        }

        if (UNIQUE_SPECIAL_RIDE == item->GetSubType() && IS_SET(item->GetFlag(), ITEM_FLAG_QUEST_USE))
        {
            quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false);
        }
    }

    return true;
}

 

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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

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.