8000 Suggestion: Add config to allow unlocks regardless of item bonding type · Issue #132 · azerothcore/mod-transmog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Suggestion: Add config to allow unlocks regardless of item bonding type #132
Open
@atrapalis

Description

@atrapalis

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);
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0