Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Add config to allow unlocks regardless of item bonding type #132

Open
atrapalis opened this issue Sep 20, 2023 · 0 comments
Open

Comments

@atrapalis
Copy link

It would be nice to have the option to unlock looted items regardless of whether they are soulbound / bind when picked up.

This seems relatively easy to implement. Just need to create a new setting and add it to the conditions on loot/create/store item. Some pseudo code / examples below:

Transmogrification.cpp

void Transmogrification::LoadConfig(bool reload)
{
...
    alwaysUnlock = sConfigMgr->GetOption<bool>("Transmogrification.AlwaysUnlock", false);
...
}

bool Transmogrification::GetAlwaysUnlock() const
{
    return alwaysUnlock;
}

transmog_scripts.cpp

    void OnLootItem(Player* player, Item* item, uint32 /*count*/, ObjectGuid /*lootguid*/) override
    {
        if (!sT->GetUseCollectionSystem() || !item)
            return;
        if (sT->GetAlwaysUnlock() || item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
        {
            AddToDatabase(player, item);
        }
    }

    void OnCreateItem(Player* player, Item* item, uint32 /*count*/) override
    {
        if (!sT->GetUseCollectionSystem())
            return;
        if (sT->GetAlwaysUnlock() || item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
        {
            AddToDatabase(player, item);
        }
    }

    void OnAfterStoreOrEquipNewItem(Player* player, uint32 /*vendorslot*/, Item* item, uint8 /*count*/, uint8 /*bag*/, uint8 /*slot*/, ItemTemplate const* /*pProto*/, Creature* /*pVendor*/, VendorItem const* /*crItem*/, bool /*bStore*/) override
    {
        if (!sT->GetUseCollectionSystem())
            return;
        if (sT->GetAlwaysUnlock() || item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
        {
            AddToDatabase(player, item);
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant