Jump to content
  • 0

Shining system Sanii - removeRefineEffect


Cunoo

Question

Hi,

I have a problem with these files on this forum.
I think problem is not with me but in code itself.
Why? Because we have tested it in several peoples and the error is manifested in all of them..
The paradox is that maybe it has not been detected yet, because many peoples do not even use this feature.

Problem is here with that feature

bool removeRefineEffect = true;


In short, if you add new shining for example sword+9 you cant see normal refine effect its hidden.. But this working only for weapon and costume weapon..Armor and costume armor is ignored... You take double effect (normal refine + new custom set in shining_table)
Here is all code from InstanceBase.cpp

Spoiler
void CInstanceBase::__GetShiningEffect(CItemData* pItem)
{
    bool removeRefineEffect = true;
 
    CItemData::TItemShiningTable shiningTable = pItem->GetItemShiningTable();
 
    if (pItem->GetType() == CItemData::ITEM_TYPE_WEAPON || (pItem->GetType() == CItemData::ITEM_TYPE_COSTUME && pItem->GetSubType() == CItemData::COSTUME_WEAPON))
    {
        BYTE bSubType = pItem->GetType() == CItemData::ITEM_TYPE_COSTUME && pItem->GetSubType() == CItemData::COSTUME_WEAPON ? pItem->GetValue(3) : pItem->GetSubType();
 
        __ClearWeaponShiningEffect();
 
        if (shiningTable.Any() && removeRefineEffect)
        {
            __ClearWeaponRefineEffect();
        }
 
        for (int i = 0; i < CItemData::ITEM_SHINING_MAX_COUNT; i++)
        {
            if (strcmp(shiningTable.szShinings[i], ""))
            {
                if (bSubType == CItemData::WEAPON_BOW)
                {
                    __AttachWeaponShiningEffect(i, shiningTable.szShinings[i], "PART_WEAPON_LEFT");
                }
                else
                {
                    bool twoSidedWeapon = bSubType == CItemData::WEAPON_DAGGER || (IsMountingHorse() && bSubType == CItemData::WEAPON_FAN);
 
                    if (twoSidedWeapon)
                    {
                        __AttachWeaponShiningEffect(i, shiningTable.szShinings[i], "PART_WEAPON_LEFT");
                    }
 
                    __AttachWeaponShiningEffect(i, shiningTable.szShinings[i], "PART_WEAPON");
                }
            }
        }
    }
 
    if ((pItem->GetType() == CItemData::ITEM_TYPE_ARMOR && pItem->GetSubType() == CItemData::ARMOR_BODY) || (pItem->GetType() == CItemData::ITEM_TYPE_COSTUME && pItem->GetSubType() == CItemData::COSTUME_BODY))
    {
        __ClearArmorShiningEffect();
 
        if (shiningTable.Any() && removeRefineEffect)
        {
            __ClearArmorRefineEffect();
        }
 
        for (int i = 0; i < CItemData::ITEM_SHINING_MAX_COUNT; i++)
        {
            if (strcmp(shiningTable.szShinings[i], ""))
            {
                __AttachArmorShiningEffect(i, shiningTable.szShinings[i]);
            }
        }
    }
}
 
void CInstanceBase::__AttachWeaponShiningEffect(int effectIndex, const char* effectFileName, const char* boneName)
{
    if (IsAffect(AFFECT_INVISIBILITY))
    {
        return;
    }
 
    if (effectIndex >= CItemData::ITEM_SHINING_MAX_COUNT)
    {
        return;
    }
 
    CEffectManager::Instance().RegisterEffect(effectFileName, false, false);
 
    if (!strcmp(boneName, "PART_WEAPON"))
    {
        const char* c_szRightBoneName;
 
        m_GraphicThingInstance.GetAttachingBoneName(CRaceData::PART_WEAPON, &c_szRightBoneName);
 
        if (strcmp(c_szRightBoneName, ""))
        {
            m_weaponShiningEffects[0][effectIndex] = m_GraphicThingInstance.AttachEffectByName(0, c_szRightBoneName, effectFileName);
        }
    }
    else if (!strcmp(boneName, "PART_WEAPON_LEFT"))
    {
        const char* c_szLeftBoneName;
 
        m_GraphicThingInstance.GetAttachingBoneName(CRaceData::PART_WEAPON_LEFT, &c_szLeftBoneName);
 
        if (strcmp(c_szLeftBoneName, ""))
        {
            m_weaponShiningEffects[1][effectIndex] = m_GraphicThingInstance.AttachEffectByName(0, c_szLeftBoneName, effectFileName);
        }
    }
    else
    {
        Tracef("Invalid partname for getting attaching bone name. %s - %s", effectFileName, boneName);
    }
}
 
void CInstanceBase::__AttachArmorShiningEffect(int effectIndex, const char* effectFileName, const char* boneName)
{
    if (IsAffect(AFFECT_INVISIBILITY))
    {
        return;
    }
 
    if (effectIndex >= CItemData::ITEM_SHINING_MAX_COUNT)
    {
        return;
    }
 
    if (!strcmp(boneName, ""))
    {
        Tracef("Empty bone name for attaching armor shining. Effect Index: %i, EffectFileName: %s", effectIndex, effectFileName);
        return;
    }
 
    CEffectManager::Instance().RegisterEffect(effectFileName, false, false);
    m_armorShiningEffects[effectIndex] = m_GraphicThingInstance.AttachEffectByName(0, boneName, effectFileName);
}
 
void CInstanceBase::__ClearWeaponShiningEffect(bool detaching)
{
    if (detaching)
    {
        for (int i = 0; i < CItemData::ITEM_SHINING_MAX_COUNT; i++)
        {
            if (m_weaponShiningEffects[0][i])
            {
                __DetachEffect(m_weaponShiningEffects[0][i]);
            }
            if (m_weaponShiningEffects[1][i])
            {
                __DetachEffect(m_weaponShiningEffects[1][i]);
            }
        }
    }
 
    memset(&m_weaponShiningEffects, 0, sizeof(m_weaponShiningEffects));
}
 
void CInstanceBase::__ClearArmorShiningEffect(bool detaching)
{
    if (detaching)
    {
        for (int i = 0; i < CItemData::ITEM_SHINING_MAX_COUNT; i++)
        {
            if (m_armorShiningEffects[i])
            {
                __DetachEffect(m_armorShiningEffects[i]);
            }
        }
    }
 
    memset(&m_armorShiningEffects, 0, sizeof(m_armorShiningEffects));
}

 

And these member functions

Spoiler
bool CInstanceBase::SetWeapon(DWORD eWeapon)
{
    if (IsPoly())
        return false;
 
    if (__IsShapeAnimalWear())
        return false;
 
    if (__IsChangableWeapon(eWeapon) == false)
        eWeapon = 0;
 
    m_GraphicThingInstance.AttachWeapon(eWeapon);
    m_awPart[CRaceData::PART_WEAPON] = eWeapon;
 
    //Weapon Effect
    CItemData * pItemData;
    if (CItemManager::Instance().GetItemDataPointer(eWeapon, &pItemData))
    {
        if (pItemData->GetType() == CItemData::ITEM_TYPE_COSTUME)
        {
            __ClearWeaponRefineEffect();
            __ClearWeaponShiningEffect();
        }
 
        __GetRefinedEffect(pItemData);
        __GetShiningEffect(pItemData);
    }
    else
    {
        __ClearWeaponRefineEffect();
        __ClearWeaponShiningEffect();
    }
 
    return true;
}
 
void CInstanceBase::SetArmor(DWORD dwArmor)
{
    DWORD dwShape;
    if (__ArmorVnumToShape(dwArmor, &dwShape))
    {
        CItemData * pItemData;
        if (CItemManager::Instance().GetItemDataPointer(dwArmor, &pItemData))
        {
            float fSpecularPower=pItemData->GetSpecularPowerf();
            SetShape(dwShape, fSpecularPower);
            __GetRefinedEffect(pItemData);
            __GetShiningEffect(pItemData);
            return;
        }
        else
        {
            __ClearArmorRefineEffect();
            __ClearArmorShiningEffect();
        }
    }
 
    SetShape(dwArmor);
}

 

I tried to detect problem but no matter what I tried and dug whole code, I came back to the beginning..

Someone has an idea how to repair it? Because this can help too much peoples.

Thanks anyway!

Edited by Cunoo
Link to comment
  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.