示例#1
0
        bool IsMetalItem(TF2BackpackItem asset)
        {
            if (!ShouldCraftAsset(asset))
                return false;

            var item = GetItemFromDefIndex(asset.DefIndex);
            if (item == null) return false;

            if (!ShouldCraftItem(item, TF2CraftClass.CraftBar))
                return false;

            if (item.DefIndex == 5000) // Scrap Metal
                return true;

            if (item.DefIndex == 5001) // Reclaimed Metal
                return true;

            return false;
        }
示例#2
0
        bool ShouldCraftAsset(TF2BackpackItem asset)
        {
            if (asset.CannotTrade || asset.CannotCraft)
                return false;

            if (asset.CustomName != null)
                return false;

            if (asset.CustomDescription != null)
                return false;

            return true;
        }
示例#3
0
        bool IsWeaponItem(TF2BackpackItem asset, TF2Class @class)
        {
            if (!ShouldCraftAsset(asset))
                return false;

            var item = GetItemFromDefIndex(asset.DefIndex);
            if (item == null) return false;

            if (!ShouldCraftItem(item, TF2CraftClass.Weapon))
                return false;

            if ((@class != TF2Class.Any) && !item.UsedByClasses.Contains(@class))
                return false;

            return true;
        }