bool Transmogrification::CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* proto2, ItemTemplate const* proto1)
{
    if (!proto2 || !proto1)
        return false;
    //if (!transmogrifier || !transmogrified)
    //    return false;

    //ItemTemplate const* proto1 = transmogrifier->GetTemplate(); // source
    //ItemTemplate const* proto2 = transmogrified->GetTemplate(); // dest

    if (proto1->ItemId == proto2->ItemId)
        return false;

    if (!SuitableForTransmogrification(player, proto2) || !SuitableForTransmogrification(player, proto1)) // if (!transmogrified->CanTransmogrify() || !transmogrifier->CanBeTransmogrified())
        return false;

    if (proto1->InventoryType == INVTYPE_BAG ||
        proto1->InventoryType == INVTYPE_RELIC ||
        // proto1->InventoryType == INVTYPE_BODY ||
        proto1->InventoryType == INVTYPE_FINGER ||
        proto1->InventoryType == INVTYPE_TRINKET ||
        proto1->InventoryType == INVTYPE_AMMO ||
        proto1->InventoryType == INVTYPE_QUIVER)
        return false;

    //custom, TC doesnt check this? Checked by Inventory type check.
    if (proto1->Class != proto2->Class)
        return false;

    if (proto1->SubClass != proto2->SubClass)
    {
        if (proto1->Class == ITEM_CLASS_ARMOR && !AllowMixedArmorTypes)
            return false;
        if (proto1->Class == ITEM_CLASS_WEAPON && !(IsRangedWeapon(proto2->Class, proto2->SubClass) && IsRangedWeapon(proto1->Class, proto1->SubClass)) && !AllowMixedWeaponTypes)
            return false;
    }

    if (proto1->InventoryType != proto2->InventoryType)
    {
        if (proto1->Class == ITEM_CLASS_WEAPON &&
            !(proto2->InventoryType != INVTYPE_WEAPONMAINHAND && proto2->InventoryType != INVTYPE_WEAPONOFFHAND) &&
            !(IsRangedWeapon(proto2->Class, proto2->SubClass) && IsRangedWeapon(proto1->Class, proto1->SubClass)))
            return false;
        if (proto1->Class == ITEM_CLASS_ARMOR &&
            !((proto1->InventoryType == INVTYPE_CHEST && proto2->InventoryType == INVTYPE_ROBE) ||
            (proto1->InventoryType == INVTYPE_ROBE && proto2->InventoryType == INVTYPE_CHEST)))
            return false;
    }

    return true;
}
示例#2
0
bool Transmogrification::CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* target, ItemTemplate const* source) const
{
    TC_LOG_DEBUG("custom.transmog", "Transmogrification::CanTransmogrifyItemWithItem");

    if (!target || !source)
        return false;

    if (source->ItemId == target->ItemId)
        return false;

    if (!SuitableForTransmogrification(player, target) || !SuitableForTransmogrification(player, source)) // if (!transmogrified->CanTransmogrify() || !transmogrifier->CanBeTransmogrified())
        return false;

    if (source->InventoryType == INVTYPE_BAG ||
        source->InventoryType == INVTYPE_RELIC ||
        // source->InventoryType == INVTYPE_BODY ||
        source->InventoryType == INVTYPE_FINGER ||
        source->InventoryType == INVTYPE_TRINKET ||
        source->InventoryType == INVTYPE_AMMO ||
        source->InventoryType == INVTYPE_QUIVER)
        return false;

    // TC doesnt check this? Checked by Inventory type check.
    if (source->Class != target->Class)
        return false;

    if (source->SubClass != target->SubClass && !IsRangedWeapon(target->Class, target->SubClass))
    {
        if (source->Class == ITEM_CLASS_ARMOR && !AllowMixedArmorTypes)
            return false;
        if (source->Class == ITEM_CLASS_WEAPON && !AllowMixedWeaponTypes)
            return false;
    }

    if (source->InventoryType != target->InventoryType)
    {
        if (source->Class == ITEM_CLASS_WEAPON &&
            (IsRangedWeapon(target->Class, target->SubClass) != IsRangedWeapon(source->Class, source->SubClass) ||
            source->InventoryType == INVTYPE_WEAPONMAINHAND ||
            source->InventoryType == INVTYPE_WEAPONOFFHAND))
            return false;
        if (source->Class == ITEM_CLASS_ARMOR &&
            !((source->InventoryType == INVTYPE_CHEST && target->InventoryType == INVTYPE_ROBE) ||
            (source->InventoryType == INVTYPE_ROBE && target->InventoryType == INVTYPE_CHEST)))
            return false;
    }

    return true;
}
bool TransmogDisplayVendorMgr::CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* target, ItemTemplate const* source)
{
    TC_LOG_DEBUG("custom.transmog", "TransmogDisplayVendorMgr::CanTransmogrifyItemWithItem");

    if (!target || !source)
        return false;

    if (source->ItemId == target->ItemId)
        return false;

    if (source->DisplayInfoID == target->DisplayInfoID)
        return false;

    if (source->Class != target->Class)
        return false;

    if (source->InventoryType == INVTYPE_BAG ||
        source->InventoryType == INVTYPE_RELIC ||
        // source->InventoryType == INVTYPE_BODY ||
        source->InventoryType == INVTYPE_FINGER ||
        source->InventoryType == INVTYPE_TRINKET ||
        source->InventoryType == INVTYPE_AMMO ||
        source->InventoryType == INVTYPE_QUIVER)
        return false;

    if (target->InventoryType == INVTYPE_BAG ||
        target->InventoryType == INVTYPE_RELIC ||
        // target->InventoryType == INVTYPE_BODY ||
        target->InventoryType == INVTYPE_FINGER ||
        target->InventoryType == INVTYPE_TRINKET ||
        target->InventoryType == INVTYPE_AMMO ||
        target->InventoryType == INVTYPE_QUIVER)
        return false;

    if (!SuitableForTransmogrification(player, target) || !SuitableForTransmogrification(player, source)) // if (!transmogrified->CanTransmogrify() || !transmogrifier->CanBeTransmogrified())
        return false;

    if (IsRangedWeapon(source->Class, source->SubClass) != IsRangedWeapon(target->Class, target->SubClass))
        return false;

    if (source->SubClass != target->SubClass && !IsRangedWeapon(target->Class, target->SubClass))
    {
        if (source->Class == ITEM_CLASS_ARMOR && !AllowMixedArmorTypes)
            return false;
        if (source->Class == ITEM_CLASS_WEAPON && !AllowMixedWeaponTypes)
            return false;
    }

    if (source->InventoryType != target->InventoryType)
    {
        if (source->Class == ITEM_CLASS_WEAPON && !((IsRangedWeapon(target->Class, target->SubClass) ||
            ((target->InventoryType == INVTYPE_WEAPON || target->InventoryType == INVTYPE_2HWEAPON) &&
                (source->InventoryType == INVTYPE_WEAPON || source->InventoryType == INVTYPE_2HWEAPON)) ||
            ((target->InventoryType == INVTYPE_WEAPONMAINHAND || target->InventoryType == INVTYPE_WEAPONOFFHAND) &&
                (source->InventoryType == INVTYPE_WEAPON || source->InventoryType == INVTYPE_2HWEAPON)))))
            return false;
        if (source->Class == ITEM_CLASS_ARMOR &&
            !((source->InventoryType == INVTYPE_CHEST || source->InventoryType == INVTYPE_ROBE) &&
                (target->InventoryType == INVTYPE_CHEST || target->InventoryType == INVTYPE_ROBE)))
            return false;
    }

    return true;
}
示例#4
0
bool Transmogrification::CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* proto2, ItemTemplate const* proto1)
{
    //if (!transmogrifier || !transmogrified)
    //    return false;

    //ItemTemplate const* proto1 = transmogrifier->GetTemplate(); // source
    //ItemTemplate const* proto2 = transmogrified->GetTemplate(); // dest

    if (proto1->ItemId == proto2->ItemId)
        return false;

    if (!SuitableForTransmogrification(player, proto2) || !SuitableForTransmogrification(player, proto1)) // if (!transmogrified->CanTransmogrify() || !transmogrifier->CanBeTransmogrified())
        return false;

    if (proto1->InventoryType == INVTYPE_BAG ||
        proto1->InventoryType == INVTYPE_RELIC ||
        proto1->InventoryType == INVTYPE_BODY ||
        proto1->InventoryType == INVTYPE_FINGER ||
        proto1->InventoryType == INVTYPE_TRINKET ||
        proto1->InventoryType == INVTYPE_AMMO ||
        proto1->InventoryType == INVTYPE_QUIVER)
        return false;

    //custom, TC doesnt check this? Checked by Inventory type check.
    if (proto1->Class != proto2->Class)
        return false;

    uint32 Class = proto1->Class; // they're assured to be the same by this point
    bool res = true;

    // if subclasses mismatch we can't proceed unless ranged or unless told to do so in the config
    if (proto1->SubClass != proto2->SubClass)
    {
        res = false;
        if (Class == ITEM_CLASS_WEAPON)
        {
            if (IsRangedWeapon(Class, proto2->SubClass) && IsRangedWeapon(Class, proto1->SubClass))
                res = true;
            else if (GetAllowMixedWeaponTypes() && !IsRangedWeapon(Class, proto2->SubClass) && !IsRangedWeapon(Class, proto1->SubClass))
                res = true;

        }
        else if(GetAllowMixedArmorTypes())
            res = true;
    }

    // if inv type mismatches we cant proceed unless it's a wep (then exceptions apply) or robe/chest pair
    if (proto1->InventoryType != proto2->InventoryType && res)
    {
        res = false;
        if (Class == ITEM_CLASS_WEAPON)
        {
            if (GetAllowMixedWeaponInvTypes()) // 2h into 1h etc
                res = true;
            else if (proto2->InventoryType == INVTYPE_WEAPONMAINHAND || proto2->InventoryType == INVTYPE_WEAPONOFFHAND)
                res = true;
        }
        else if (Class == ITEM_CLASS_ARMOR && ((proto1->InventoryType == INVTYPE_CHEST && proto2->InventoryType == INVTYPE_ROBE) || ((proto1->InventoryType == INVTYPE_ROBE && proto2->InventoryType == INVTYPE_CHEST))))
            res = true;
    }

    return res;
}