local HORDE_CAMPAIGN_ACHIEVEMENT_ID = 12509
local ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID = 12510

BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION, {
    name = BTWQUESTS_INTRODUCTION,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    prerequisites = {
        {
            type = "level",
            level = 110,
        },
        {
            type = "time",
            time = 1534197600,
            visible = BtWQuestsItem_Active,
        },
    },
    active = {
        {
            type = "quest",
            id = 53370,
            restrictions = {
                type = "faction",
                id = BTWQUESTS_FACTION_ID_ALLIANCE,
            },
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 53372,
            restrictions = {
                type = "faction",
                id = BTWQUESTS_FACTION_ID_HORDE,
            },
            status = {'active', 'completed'},
        },
    },
    completed = {
        {
            type = "quest",
            id = 47189,
            restrictions = {
                type = "faction",
                id = BTWQUESTS_FACTION_ID_ALLIANCE,
            },
        },
        {
            type = "quest",
            id = 47332,
            restrictions = {
                type = "faction",
                id = BTWQUESTS_FACTION_ID_HORDE,
            },
        },
    },
    items = {
        {
            type = "time",
            time = 1534197600,
            visible = BtWQuestsItem_Active,
            x = 3,
            y = -1,
            connections = {
                1,
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 53370,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 53372,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 0,
            connections = {
                1, 
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 51795,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 51796,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 1,
            connections = {
                1, 
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 52946,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 53028,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 2,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 51211,
            x = 3,
            y = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 52428,
            x = 3,
            y = 4,
            connections = {
                1, 
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 51403,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 53031,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 5,
            connections = {
                1, 
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 46727,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 51443,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 6,
            connections = {
                1, 
            },
        }, -- 51766
        {
            variations = {
                {
                    type = "quest",
                    id = 46728,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 50769,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 7,
            connections = {
                1, 
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 51341,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 46957,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 8,
            connections = {
                1, 
            },
        },


        {
            variations = {
                {
                    type = "quest",
                    id = 47098,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 46930,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 9,
            connections = {
                1, 
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 47099,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 46931,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 10,
            connections = {
                1, 
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 46729,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 52139,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 11,
            connections = {
                1, 2,
            },
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 47186,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                    x = 2,
                },
                {
                    type = "quest",
                    id = 52131,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                    x = 3,
                },
            },
            y = 12,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 52128,
            restrictions = {
                type = "faction",
                id = BTWQUESTS_FACTION_ID_ALLIANCE,
            },
            x = 4,
            y = 12,
        },
        {
            variations = {
                {
                    type = "quest",
                    id = 47189,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_ALLIANCE,
                    },
                },
                {
                    type = "quest",
                    id = 47332,
                    restrictions = {
                        type = "faction",
                        id = BTWQUESTS_FACTION_ID_HORDE,
                    },
                },
            },
            x = 3,
            y = 13,
            connections = {
                1, 
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN,
            aside = true,
            x = 3,
            y = 14,
        },
    },
})

BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN, {
    name = BTWQUESTS_THE_WAR_CAMPAIGN,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    buttonImage = 1778893,
    major = true,
    range = {110,120},
    prerequisites = {
        {
            type = "level",
            level = 110,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
    },
    active = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
    },
    completed = BtWQuestsItem_GetItems,
    items = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_ALLIANCE,
            embed = true,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_HORDE,
            embed = true,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_ALLIANCE, {
    name = BTWQUESTS_THE_WAR_CAMPAIGN,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    buttonImage = 1778893,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "level",
            level = 110,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
    },
    active = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
    },
    completed = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_THE_STRIKE_ON_ZULDAZAR,
    },
    items = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
            x = 3,
            y = 0,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 52654,
            x = 3,
            y = 1,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 52544,
            x = 3,
            y = 2,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53332,
            x = 3,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51714,
            x = 3,
            y = 4,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 51715,
            x = 2,
            y = 5,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51569,
            x = 4,
            y = 5,
            connections = {
                2,
            },
        },

        {
            type = "quest",
            id = 53074,
            x = 2,
            y = 6,
        },
        {
            variations = {
                {
                    name = "An Alliance Foothold",
                    breadcrumb = true,
                    restrictions = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD) and 1 or 0) ~= 0
                    end,
                    completed = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD) and 1 or 0) >= 1
                    end,
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    name = "An Alliance Foothold",
                },
            },
            x = 4,
            y = 6,
            connections = {
                2, 3,
            },
        },
        {
            type = "level",
            level = 114,
            x = 6,
            y = 6.5,
            connections = {
                2,
            },
        },

        {
            type = "quest",
            id = 53583,
            x = 2,
            y = 7,
            connections = {
                3,
            },
        },
        { -- If you are already past level 116 this isnt offered
            type = "quest",
            id = 53052,
            breadcrumb = true,
            x = 4,
            y = 7,
            connections = {
                3,
            },
        },
        
        {
            type = "level",
            level = 116,
            x = 0,
            y = 7.5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 53061,
            breadcrumb = true,
            x = 2,
            y = 8,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51961,
            x = 4,
            y = 8,
            connections = {
                2,
            },
        },
        
        {
            type = "quest",
            id = 51903,
            breadcrumb = true,
            x = 2,
            y = 9,
            connections = {
                3,
            },
        },
        {
            variations = {
                {
                    name = "An Alliance Foothold",
                    breadcrumb = true,
                    restrictions = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD) and 1 or 0) ~= 1
                    end,
                    completed = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD) and 1 or 0) >= 2
                    end,
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    name = "An Alliance Foothold",
                },
            },
            x = 4,
            y = 9,
            connections = {
                3,
            },
        },
        {
            type = "level",
            level = 118,
            x = 6,
            y = 9.5,
            connections = {
                2,
            },
        },

        {
            type = "quest",
            id = 51904,
            completed = {
                type = "quest",
                id = 51994,
            },
            x = 2,
            y = 10,
        },
        { -- Requires [51904] Island Expedition
            type = "quest",
            id = 53055,
            breadcrumb = true,
            x = 4,
            y = 10,
            connections = {
                1,
            },
        },


        {
            type = "quest",
            id = 52443,
            x = 4,
            y = 11,
            connections = {
                1,
            },
        },


        {
            variations = {
                {
                    name = "An Alliance Foothold",
                    breadcrumb = true,
                    restrictions = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD) and 1 or 0) ~= 2
                    end,
                    completed = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD) and 1 or 0) >= 3
                    end,
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    name = "An Alliance Foothold",
                },
            },
            x = 4,
            y = 12,
            connections = {
                2,
            },
        },
        

        {
            type = "level",
            level = 120,
            x = 6,
            y = 12.5,
            connections = {
                1,
            },
        },
        -- { -- Might be either this or the next one, depending on if you were at the ship when they became available
        --     type = "quest",
        --     id = 53063,
        --     breadcrumb = true,
        --     x = 4,
        --     y = 13,
        --     connections = {
        --         1,
        --     },
        -- },
        {
            type = "quest",
            id = 51918, -- 53064
            completed = function (item, character)
                return character:IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD) and 
                character:IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD) and
                character:IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD) and
                character:IsQuestCompleted(51918)
            end,
            x = 4,
            y = 13,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 53194,
            aside = true,
            breadcrumb = true,
            x = 2,
            y = 14,
            connections = {
                3,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_BLOOD_ON_THE_SAND,
            x = 4,
            y = 14,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 53185,
            aside = true,
            visible = false,
            x = 6,
            y = 14,
        },
        {
            type = "quest",
            id = 53197,
            aside = true,
            breadcrumb = true,
            x = 2,
            y = 15,
            connections = {
                2,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_CHASING_DARKNESS,
            x = 4,
            y = 15,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 53198,
            aside = true,
            completed = {
                type = "quest",
                id = 53206,
            },
            x = 2,
            y = 16,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_A_GOLDEN_OPPORTUNITY,
            x = 4,
            y = 16,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_BLOOD_IN_THE_WATER,
            x = 4,
            y = 17,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_THE_STRIKE_ON_ZULDAZAR,
            x = 4,
            y = 18,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_8_1,
            aside = true,
            x = 4,
            y = 19,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_HORDE, {
    name = BTWQUESTS_THE_WAR_CAMPAIGN,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    buttonImage = 1778893,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "level",
            level = 110,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
    },
    active = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
    },
    completed = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_STRIKE_ON_BORALAS,
    },
    items = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
            x = 3,
            y = 0,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 52749,
            x = 3,
            y = 1,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 52746,
            x = 3,
            y = 2,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53333,
            x = 3,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51770,
            x = 3,
            y = 4,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 51771,
            x = 2,
            y = 5,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51803,
            x = 4,
            y = 5,
            connections = {
                2,
            },
        },

        {
            type = "quest",
            id = 53079,
            x = 2,
            y = 6,
        },
        {
            variations = {
                {
                    name = "A Horde Foothold",
                    breadcrumb = true,
                    restrictions = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD) and 1 or 0) ~= 0
                    end,
                    completed = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD) and 1 or 0) >= 1
                    end,
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    name = "A Horde Foothold",
                },
            },
            x = 4,
            y = 6,
            connections = {
                2, 3,
            },
        },
        {
            type = "level",
            level = 114,
            x = 6,
            y = 6.5,
            connections = {
                2,
            },
        },

        {
            type = "quest",
            id = 53602,
            x = 2,
            y = 7,
            connections = {
                3,
            },
        },
        { -- If you are already past level 116 this isnt offered
            type = "quest",
            id = 53050,
            breadcrumb = true,
            x = 4,
            y = 7,
            connections = {
                3,
            },
        },
        
        {
            type = "level",
            level = 116,
            x = 0,
            y = 7.5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 53062,
            breadcrumb = true,
            x = 2,
            y = 8,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51979,
            x = 4,
            y = 8,
            connections = {
                2,
            },
        },
        
        {
            type = "quest",
            id = 51870,
            breadcrumb = true,
            x = 2,
            y = 9,
            connections = {
                3,
            },
        },
        {
            variations = {
                {
                    name = "A Horde Foothold",
                    breadcrumb = true,
                    restrictions = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD) and 1 or 0) ~= 1
                    end,
                    completed = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD) and 1 or 0) >= 2
                    end,
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    name = "A Horde Foothold",
                },
            },
            x = 4,
            y = 9,
            connections = {
                3,
            },
        },
        {
            type = "level",
            level = 118,
            x = 6,
            y = 9.5,
            connections = {
                2,
            },
        },

        {
            type = "quest",
            id = 51888,
            completed = {
                type = "quest",
                id = 51994,
            },
            x = 2,
            y = 10,
        },
        {
            type = "quest",
            id = 53056,
            breadcrumb = true,
            x = 4,
            y = 10,
            connections = {
                1,
            },
        },


        {
            type = "quest",
            id = 52444,
            x = 4,
            y = 11,
            connections = {
                1,
            },
        },


        {
            variations = {
                {
                    name = "A Horde Foothold",
                    breadcrumb = true,
                    restrictions = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD) and 1 or 0) ~= 2
                    end,
                    completed = function ()
                        return (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD) and 1 or 0) + (BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD) and 1 or 0) >= 3
                    end,
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    type = "chain",
                    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD,
                    restrictions = {
                        {
                            type = "chain",
                            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD,
                            status = {'active'},
                        },
                    },
                },
                {
                    name = "A Horde Foothold",
                },
            },
            x = 4,
            y = 12,
            connections = {
                2,
            },
        },
        

        {
            type = "level",
            level = 120,
            x = 6,
            y = 12.5,
            connections = {
                1,
            },
        },
        -- { -- Might be either this or the next one, depending on if you were at the ship when they became available
        --     type = "quest",
        --     id = 53064,
        --     breadcrumb = true,
        --     x = 4,
        --     y = 13,
        --     connections = {
        --         1,
        --     },
        -- },
        {
            type = "quest",
            id = 51916, -- 52451
            completed = function (item, character)
                return BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD) and 
                BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD) and
                BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD) and
                BtWQuests_IsQuestCompleted(51916)
            end,
            x = 4,
            y = 13,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 53208,
            aside = true,
            breadcrumb = true,
            x = 2,
            y = 14,
            connections = {
                3,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_FIRST_ASSAULT,
            x = 4,
            y = 14,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 53209,
            aside = true,
            visible = false,
            x = 6,
            y = 14,
        },
        {
            type = "quest",
            id = 53210,
            aside = true,
            breadcrumb = true,
            x = 2,
            y = 15,
            connections = {
                2,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_MARSHALS_GRAVE,
            x = 4,
            y = 15,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 53212,
            aside = true,
            completed = {
                type = "quest",
                id = 53220,
            },
            x = 2,
            y = 16,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DEATH_OF_A_TIDESAGE,
            x = 4,
            y = 16,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_AT_THE_BOTTOM_OF_THE_SEA,
            x = 4,
            y = 17,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_STRIKE_ON_BORALAS,
            x = 4,
            y = 18,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_8_1,
            aside = true,
            x = 4,
            y = 19,
        },
    },
})

BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_8_1, {
    name = BTWQUESTS_THE_WAR_CAMPAIGN_8_1,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    buttonImage = 2482729,
    major = true,
    range = {120,120},
    prerequisites = {
        {
            type = "level",
            level = 120,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN,
        },
    },
    active = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN,
    },
    completed = BtWQuestsItem_GetItems,
    items = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_ALLIANCE_8_1,
            embed = true,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_HORDE_8_1,
            embed = true,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_ALLIANCE_8_1, {
    name = BTWQUESTS_THE_WAR_CAMPAIGN_8_1,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    buttonImage = 2482729,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "level",
            level = 120,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_ALLIANCE,
        },
    },
    active = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_ALLIANCE,
    },
    completed = {
        type = "quest",
        id = 54183,
    },
    items = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_1,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_2,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_3,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_4,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 54163,
            visible = false,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 54183,
            visible = false,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_HORDE_8_1, {
    name = BTWQUESTS_THE_WAR_CAMPAIGN_8_1,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    buttonImage = 2482729,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "level",
            level = 120,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN,
        },
    },
    active = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
    },
    completed = {
        type = "quest",
        id = 54165,
    },
    items = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_1,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_2,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_3,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_4,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 54164,
            visible = false,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 54165,
            visible = false,
            x = 3,
        },
    },
})

BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD, {
    name = function ()
        return GetAchievementCriteriaInfo(ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID, 3)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_ZULDAZAR,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            -- completed = {
            --     {
            --         type = "quest",
            --         id = 51570,
            --     },
            --     {
            --         type = "quest",
            --         id = 51569,
            --         status = {'notactive'},
            --     },
            --     {
            --         type = "quest",
            --         id = 51961,
            --         status = {'notactive'},
            --     },
            --     {
            --         type = "quest",
            --         id = 52443,
            --         status = {'notactive'},
            --     },
            -- },
            onEval = function ()
                return BtWQuests_IsQuestCompleted(51570) and not BtWQuests_IsQuestActive(51569) and not BtWQuests_IsQuestActive(51961) and not BtWQuests_IsQuestActive(52443)
            end
        },
    },
    active = {
        type = "quest",
        id = 51570,
        status = {'active', 'completed'},
    },
    completed = {
        type = "quest",
        id = 51968,
    },
    items = {
        {
            type = "quest",
            id = 51308,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51201,
            x = 3,
            y = 1,
            connections = {
                1, 2, 3, 4, 5,
            },
        },
        {
            type = "quest",
            id = 51191,
            x = 0,
            y = 2,
            connections = {
                5,
            },
        },
        {
            type = "quest",
            id = 51190,
            x = 2,
            y = 2,
            connections = {
                4,
            },
        },
        {
            type = "quest",
            id = 51544,
            x = 3,
            y = 3,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 51192,
            x = 4,
            y = 2,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51193,
            x = 6,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51418,
            x = 3,
            y = 4,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 51331,
            x = 2,
            y = 5,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51309,
            x = 4,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51359,
            x = 3,
            y = 6,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52003,
            x = 3,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51968,
            x = 3,
            y = 8,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD, {
    name = function ()
        return GetAchievementCriteriaInfo(ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID, 2)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_VOLDUN,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            onEval = function ()
                return BtWQuests_IsQuestCompleted(51572) and not BtWQuests_IsQuestActive(51569) and not BtWQuests_IsQuestActive(51961) and not BtWQuests_IsQuestActive(52443)
            end
        },
    },
    active = {
        type = "quest",
        id = 51572,
        status = {'active', 'completed'},
    },
    completed = {
        type = "quest",
        id = 51969,
    },
    items = {
        {
            type = "quest",
            id = 51283,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51170,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51229,
            x = 3,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51349,
            x = 3,
            y = 3,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 51350,
            x = 2,
            y = 4,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51351,
            x = 4,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51366,
            x = 3,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51369,
            x = 3,
            y = 6,
            connections = {
                1, 2, 3,
            },
        },

        {
            type = "quest",
            id = 51391,
            x = 1,
            y = 7,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 51394,
            x = 3,
            y = 7,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51389,
            x = 5,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51395,
            x = 3,
            y = 8,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51402,
            x = 3,
            y = 9,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52008,
            x = 3,
            y = 10,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51969,
            x = 3,
            y = 11,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD, {
    name = function ()
        return GetAchievementCriteriaInfo(ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID, 1)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_NAZMIR,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            onEval = function ()
                return BtWQuests_IsQuestCompleted(51571) and not BtWQuests_IsQuestActive(51569) and not BtWQuests_IsQuestActive(51961) and not BtWQuests_IsQuestActive(52443)
            end
        },
    },
    active = {
        type = "quest",
        id = 51571,
        status = {'active', 'completed'},
    },
    completed = {
        type = "quest",
        id = 51967,
    },
    items = {
        {
            type = "quest",
            id = 51088,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51129,
            x = 3,
            y = 1,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 51167,
            x = 2,
            y = 2,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51150,
            x = 4,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51168,
            x = 3,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51169,
            x = 3,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51281,
            x = 3,
            y = 5,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 51279,
            x = 2,
            y = 6,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51280,
            x = 4,
            y = 6,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51282,
            x = 3,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51177,
            x = 3,
            y = 8,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52013,
            x = 3,
            y = 9,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51967,
            x = 3,
            y = 10,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_BLOOD_ON_THE_SAND, {
    name = function ()
        return GetAchievementCriteriaInfo(ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID, 4)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_VOLDUN,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            onEval = function (item, character)
                return BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_ZULDAZAR_FOOTHOLD) and 
                BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_VOLDUN_FOOTHOLD) and
                BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_NAZMIR_FOOTHOLD) and
                BtWQuests_IsQuestCompleted(51918)
            end,
        },
        {
            type = "level",
            level = 120,
        },
        -- {
        --     type = "reputation",
        --     id = 2159,
        --     standing = 5,
        -- },
    },
    active = {
        type = "quest",
        id = 52026,
        status = {'active', 'completed'},
    },
    completed = {
        type = "quest",
        id = 52146,
    },
    items = {
        {
            type = "quest",
            id = 52026,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52027,
            x = 3,
            y = 1,
            connections = {
                2,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_VOLDUN_CHAIN14,
            embed = true,
            aside = true,
            x = 5,
            y = 1,
        },
        {
            type = "quest",
            id = 52028,
            x = 3,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52029,
            x = 3,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52030,
            x = 3,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52031,
            x = 3,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52032,
            x = 3,
            y = 6,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 52034,
            x = 1,
            y = 7,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 52035,
            x = 3,
            y = 7,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52036,
            x = 5,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52038,
            x = 3,
            y = 8,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 52039,
            x = 2,
            y = 9,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52040,
            x = 4,
            y = 9,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52041,
            x = 3,
            y = 10,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52042,
            x = 3,
            y = 11,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52146,
            x = 3,
            y = 12,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_CHASING_DARKNESS, {
    name = function ()
        return GetAchievementCriteriaInfo(ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID, 5)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_NAZMIR,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_BLOOD_ON_THE_SAND,
        },
        {
            type = "reputation",
            id = 2159,
            standing = 5,
            amount = 4500,
        },
    },
    active = {
        {
            type = "quest",
            id = 53069,
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 52147,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 52219,
    },
    items = {
        {
            type = "quest",
            id = 53069,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52147,
            x = 3,
            y = 1,
            connections = {
                2,
            },
        },
        
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_NAZMIR_CHAIN12,
            embed = true,
            aside = true,
            x = 0,
            y = 2,
        },
        {
            type = "quest",
            id = 52150,
            x = 3,
            y = 2,
            connections = {
                2, 3,
            },
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_NAZMIR_CHAIN13,
            embed = true,
            aside = true,
            x = 6,
            y = 2,
        },

        {
            type = "quest",
            id = 52156,
            x = 2,
            y = 3,
            connections = {
                2, 3, 4,
            },
        },
        {
            type = "quest",
            id = 52158,
            x = 4,
            y = 3,
            connections = {
                1, 2, 3,
            },
        },

        {
            type = "quest",
            id = 52170,
            x = 1,
            y = 4,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 52171,
            x = 3,
            y = 4,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52172,
            x = 5,
            y = 4,
            connections = {
                1,
            },
        },

        {
            type = "quest",
            id = 52208,
            x = 3,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52219,
            x = 3,
            y = 6,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_A_GOLDEN_OPPORTUNITY, {
    name = function ()
        return GetAchievementCriteriaInfo(ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID, 6)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_ZULDAZAR,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_CHASING_DARKNESS,
        },
        {
            type = "reputation",
            id = 2159,
            standing = 6,
            amount = 3000,
        },
    },
    active = {
        {
            type = "quest",
            id = 53070,
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 52154,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 52261,
    },
    items = {
        {
            type = "quest",
            id = 53070,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52154,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52173,
            x = 3,
            y = 2,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 52205,
            x = 1,
            y = 3,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 52204,
            x = 3,
            y = 3,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52203,
            x = 5,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52241,
            x = 3,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52247,
            x = 3,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52259,
            x = 3,
            y = 6,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52260,
            x = 3,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52261,
            x = 3,
            y = 8,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_BLOOD_IN_THE_WATER, {
    name = function ()
        return GetAchievementCriteriaInfo(ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID, 7)
    end,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_A_GOLDEN_OPPORTUNITY,
        },
        {
            type = "reputation",
            id = 2159,
            standing = 6,
            amount = 7500,
        },
    },
    active = {
        {
            type = "quest",
            id = 53071,
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 52308,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 52496,
    },
    rewards = {
        {
            type = "reputation",
            id = 2160,
            amount = 10,
        },
        {
            name = "King's Rest Dungeon Unlocked"
        },
    },
    items = {
        {
            type = "quest",
            id = 53071,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52308,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52489,
            x = 3,
            y = 2,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 52490,
            x = 2,
            y = 3,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52491,
            x = 4,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52492,
            x = 3,
            y = 4,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 52493,
            x = 1,
            y = 5,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 52494,
            x = 3,
            y = 5,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 53131,
            x = 5,
            y = 5,
        },
        {
            type = "quest",
            id = 52495,
            x = 3,
            y = 6,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52496,
            x = 3,
            y = 7,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_THE_STRIKE_ON_ZULDAZAR, {
    name = function ()
        return GetAchievementCriteriaInfo(ALLIANCE_CAMPAIGN_ACHIEVEMENT_ID, 8)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_ZULDAZAR,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_BLOOD_IN_THE_WATER,
        },
        {
            type = "reputation",
            id = 2159,
            standing = 7,
        },
    },
    active = {
        {
            type = "quest",
            id = 53072,
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 52473,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 52790,
    },
    items = {
        {
            type = "quest",
            id = 53072,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52473,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52282,
            x = 3,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52281,
            x = 3,
            y = 3,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 52283,
            x = 2,
            y = 4,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52284,
            x = 4,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52285,
            x = 3,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52290,
            x = 3,
            y = 6,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 52286,
            x = 1,
            y = 7,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 52287,
            x = 3,
            y = 7,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52288,
            x = 5,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52289,
            x = 3,
            y = 8,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52291,
            x = 3,
            y = 9,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52788,
            x = 3,
            y = 10,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52789,
            x = 3,
            y = 11,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52790,
            x = 3,
            y = 12,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 53098,
            aside = true,
            x = 3,
            y = 13,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD, {
    name = function ()
        return GetAchievementCriteriaInfo(HORDE_CAMPAIGN_ACHIEVEMENT_ID, 2)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            onEval = function ()
                return BtWQuests_IsQuestCompleted(51803) and not BtWQuests_IsQuestActive(51979) and not BtWQuests_IsQuestActive(51961) and not BtWQuests_IsQuestActive(52443)
            end
        },
    },
    active = {
        {
            type = "quest",
            id = 51421,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 51984,
    },
    items = {
        {
            type = "quest",
            id = 51421,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51435,
            x = 3,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51436,
            x = 3,
            y = 3,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 51437,
            x = 2,
            y = 4,
            connections = {
                2, 3,
            },
        },
        {
            type = "quest",
            id = 51439,
            x = 4,
            y = 4,
            connections = {
                1, 2,
            },
        },

        {
            type = "quest",
            id = 51440,
            x = 2,
            y = 5,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51441,
            x = 4,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51442,
            x = 3,
            y = 6,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51438,
            x = 3,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51975,
            x = 3,
            y = 8,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51984,
            x = 3,
            y = 9,
            connections = {
                1,
            },
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD, {
    name = function ()
        return GetAchievementCriteriaInfo(HORDE_CAMPAIGN_ACHIEVEMENT_ID, 1)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_DRUSTVAR,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            onEval = function ()
                return BtWQuests_IsQuestCompleted(51801) and not BtWQuests_IsQuestActive(51979) and not BtWQuests_IsQuestActive(51961) and not BtWQuests_IsQuestActive(52443)
            end
        },
    },
    active = {
        {
            type = "quest",
            id = 51332,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 51985,
    },
    items = {
        {
            type = "quest",
            id = 51332,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51340,
            x = 3,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51224,
            x = 3,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51231,
            x = 3,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51233,
            x = 3,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51234,
            x = 3,
            y = 6,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 53456,
            x = 0,
            y = 7,
        },
        {
            type = "quest",
            id = 51987,
            x = 2,
            y = 7,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 53458,
            x = 4,
            y = 7,
        },
        {
            type = "quest",
            id = 53459,
            x = 6,
            y = 7,
        },
        {
            type = "quest",
            id = 51985,
            x = 3,
            y = 8,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD, {
    name = function ()
        return GetAchievementCriteriaInfo(HORDE_CAMPAIGN_ACHIEVEMENT_ID, 3)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_STORMSONG_VALLEY,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            onEval = function ()
                return BtWQuests_IsQuestCompleted(51802) and not BtWQuests_IsQuestActive(51979) and not BtWQuests_IsQuestActive(51961) and not BtWQuests_IsQuestActive(52443)
            end
        },
    },
    active = {
        {
            type = "quest",
            id = 51526,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 51986,
    },
    items = {
        {
            type = "quest",
            id = 51526,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51532,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51643,
            x = 3,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51536,
            x = 3,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51587,
            x = 3,
            y = 4,
            connections = {
                1, 2, 3,
            },
        },

        
        {
            type = "quest",
            id = 51675,
            x = 1,
            y = 5,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 51691,
            x = 3,
            y = 5,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51674,
            x = 5,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51696,
            x = 3,
            y = 6,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51753,
            x = 3,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51986,
            x = 3,
            y = 8,
        },
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_STORMSONG_VALLEY_CHAIN13,
            embed = true,
            aside = true,
            x = 0,
            y = 10,
        }
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_FIRST_ASSAULT, {
    name = function ()
        return GetAchievementCriteriaInfo(HORDE_CAMPAIGN_ACHIEVEMENT_ID, 4)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            onEval = function (item, character)
                return BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_TIRAGARDE_SOUND_FOOTHOLD) and 
                BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DRUSTVAR_FOOTHOLD) and
                BtWQuests_IsChainCompleted(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_STORMSONG_VALLEY_FOOTHOLD) and
                BtWQuests_IsQuestCompleted(51916)
            end,
        },
        {
            type = "level",
            level = 120,
        },
        -- {
        --     type = "reputation",
        --     id = 2157,
        --     standing = 5,
        -- },
    },
    active = {
        {
            type = "quest",
            id = 51589,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 51601,
    },
    items = {
        {
            type = "quest",
            id = 51589,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51590,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51591,
            x = 3,
            y = 2,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 51592,
            x = 2,
            y = 3,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51593,
            x = 4,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51594,
            x = 3,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51595,
            x = 3,
            y = 5,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 51596,
            x = 1,
            y = 6,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 51597,
            x = 3,
            y = 6,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51598,
            x = 5,
            y = 6,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51599,
            x = 3,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51601,
            x = 3,
            y = 8,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_MARSHALS_GRAVE, {
    name = function ()
        return GetAchievementCriteriaInfo(HORDE_CAMPAIGN_ACHIEVEMENT_ID, 5)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_DRUSTVAR,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_FIRST_ASSAULT,
        },
        {
            type = "reputation",
            id = 2157,
            standing = 5,
            amount = 4500,
        },
    },
    active = {
        {
            type = "quest",
            id = 53065,
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 51784,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 51789,
    },
    items = {
        {
            type = "quest",
            id = 53065,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51784,
            x = 3,
            y = 1,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 51785,
            x = 1,
            y = 2,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 51786,
            x = 3,
            y = 2,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51787,
            x = 5,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51788,
            x = 3,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51789,
            x = 3,
            y = 4,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DEATH_OF_A_TIDESAGE, {
    name = function ()
        return GetAchievementCriteriaInfo(HORDE_CAMPAIGN_ACHIEVEMENT_ID, 6)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_STORMSONG_VALLEY,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_MARSHALS_GRAVE,
        },
        {
            type = "reputation",
            id = 2157,
            standing = 6,
            amount = 3000,
        },
    },
    active = {
        {
            type = "quest",
            id = 53066,
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 51797,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 52122,
    },
    items = {
        {
            type = "quest",
            id = 53066,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51797,
            x = 3,
            y = 1,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51798,
            x = 3,
            y = 2,
            connections = {
                1, 2, 3,
            },
        },

        
        {
            type = "quest",
            id = 51805,
            x = 1,
            y = 3,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 51818,
            x = 3,
            y = 3,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 51819,
            x = 5,
            y = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51830,
            x = 3,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 51837,
            x = 3,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52122,
            x = 3,
            y = 6,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_AT_THE_BOTTOM_OF_THE_SEA, {
    name = function ()
        return GetAchievementCriteriaInfo(HORDE_CAMPAIGN_ACHIEVEMENT_ID, 7)
    end,
    category = nil,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_DEATH_OF_A_TIDESAGE,
        },
        {
            type = "reputation",
            id = 2157,
            standing = 6,
            amount = 7500,
        },
    },
    active = {
        {
            type = "quest",
            id = 53067,
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 52764,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 52978,
    },
    rewards = {
        {
            type = "reputation",
            id = 2157,
            amount = 75,
        },
        {
            name = "Siege of Boralus Dungeon Unlocked"
        },
    },
    items = {
        {
            type = "quest",
            id = 53067,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52764,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52765,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52766,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52767,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52768,
            x = 3,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 52769,
            x = 2,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52770,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52772,
            x = 3,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52773,
            x = 3,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 52774,
            x = 2,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 53121,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52978,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_STRIKE_ON_BORALAS, {
    name = function ()
        return GetAchievementCriteriaInfo(HORDE_CAMPAIGN_ACHIEVEMENT_ID, 8)
    end,
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {110,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_AT_THE_BOTTOM_OF_THE_SEA,
        },
        {
            type = "reputation",
            id = 2157,
            standing = 7,
        },
    },
    active = {
        {
            type = "quest",
            id = 53068,
            status = {'active', 'completed'},
        },
        {
            type = "quest",
            id = 52183,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 53003,
    },
    items = {
        {
            type = "quest",
            id = 53068,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52183,
            x = 3,
            y = 1,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 52186,
            x = 2,
            y = 2,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52187,
            x = 4,
            y = 2,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52185,
            x = 3,
            y = 3,
            connections = {
                1, 2, 3,
            },
        },
        {
            type = "quest",
            id = 52184,
            x = 1,
            y = 4,
            connections = {
                3,
            },
        },
        {
            type = "quest",
            id = 52189,
            x = 3,
            y = 4,
            connections = {
                2,
            },
        },
        {
            type = "quest",
            id = 52188,
            x = 5,
            y = 4,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52190,
            x = 3,
            y = 5,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52190,
            x = 3,
            y = 6,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52191,
            x = 3,
            y = 7,
            connections = {
                1,
            },
        },
        {
            type = "quest",
            id = 52192,
            x = 3,
            y = 8,
            connections = {
                1, 2,
            },
        },
        {
            type = "quest",
            id = 53003,
            x = 2,
            y = 9,
        },
        {
            type = "quest",
            id = 52861,
            aside = true,
            x = 4,
            y = 9,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_1, {
    name = BtWQuests_GetAchievementNameDelayed(13384), -- Kul Tirans Don't Look at Explosions
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_THE_STRIKE_ON_ZULDAZAR,
        },
    },
    active = {
        {
            type = "quest",
            id = 53986,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 53887,
    },
    items = {
        {
            type = "quest",
            id = 53986,
            x = 3,
            y = 0,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53888,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53896,
            x = 3,
            connections = {
                1, 3, 4, 5, 
            },
        },
        {
            type = "quest",
            id = 53909,
            x = 0,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53916,
            x = 0,
            connections = {
                4, 5, 
            },
        },
        {
            type = "quest",
            id = 53910,
            x = 2,
            connections = {
                3, 4, 
            },
        },
        {
            type = "quest",
            id = 54519,
            x = 4,
            connections = {
                2, 3, 
            },
        },
        {
            type = "quest",
            id = 54518,
            x = 6,
            connections = {
                3, 
            },
        },
        {
            type = "quest",
            id = 53978,
            x = 1,
            connections = {
                3, 
            },
        },
        {
            type = "quest",
            id = 54787,
            x = 3,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54559,
            x = 5,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53919,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53936,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54703,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53887,
            aside = true,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_2, {
    name = { -- The Embiggining
        type = "quest",
        id = 54203,
    },
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_1,
        },
    },
    active = {
        {
            type = "quest",
            ids = {54191, 54192},
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 54206,
    },
    items = {
        {
            type = "quest",
            id = 54191,
            breadcrumb = true,
            x = 3,
            y = 0,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54192,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54193,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54194,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54195,
            x = 3,
            connections = {
                1, 2, 
            },
        },
        {
            type = "quest",
            id = 54196,
            x = 2,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54197,
            x = 4,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54198,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54199,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54200,
            x = 3,
            connections = {
                1, 2, 
            },
        },
        {
            type = "quest",
            id = 54201,
            x = 2,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54202,
            x = 4,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54203,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54204,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54205,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54206,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_3, {
    name = { -- The Abyssal Scepter
        type = "quest",
        id = 54171,
    },
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_2,
        },
    },
    active = {
        {
            type = "quest",
            id = 54171,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 54169,
    },
    items = {
        {
            type = "quest",
            id = 54171,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54169,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54510,
            aside = true,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_4, {
    name = {
        type = "quest",
        id = 54302,
    },
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_ALLIANCE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_ALLIANCE_8_1_PART_3,
        },
    },
    active = {
        {
            type = "quest",
            id = 54302,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 54485,
    },
    items = {
        {
            type = "quest",
            id = 54302,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54303,
            x = 3,
            connections = {
                1, 2, 
            },
        },
        {
            type = "quest",
            id = 54310,
            x = 2,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54404,
            x = 4,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54312,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54407,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54412,
            x = 3,
            connections = {
                1, 2, 3, 
            },
        },
        {
            type = "quest",
            id = 54417,
            x = 1,
            connections = {
                3, 
            },
        },
        {
            type = "quest",
            id = 54421,
            x = 3,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54418,
            x = 5,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54441,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54459,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54485,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_1, {
    name = { -- Our War Continues
        type = "quest",
        id = 53850,
    },
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_THE_STRIKE_ON_BORALAS,
        },
    },
    active = {
        {
            type = "quest",
            ids = {
                53850, 53851,
            },
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 53981,
    },
    items = {
        {
            type = "quest",
            ids = {
                53850, 53851, 
            },
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53852,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53856,
            x = 3,
            connections = {
                1, 2, 
            },
        },
        {
            type = "quest",
            id = 53879,
            x = 2,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 53880,
            x = 4,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53913,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53912,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53973,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53981,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_2, {
    name = { -- A Mech for a Goblin
        type = "quest",
        id = 53941,
    },
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_1,
        },
    },
    active = {
        {
            type = "quest",
            id = 53941,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 54094,
    },
    items = {
        {
            type = "quest",
            id = 53941,
            x = 3,
            connections = {
                1, 2, 
            },
        },
        {
            type = "quest",
            id = 54123,
            x = 2,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54124,
            x = 4,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 53942,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54128,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54004,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54007,
            x = 3,
            connections = {
                1, 2, 3, 
            },
        },
        {
            type = "quest",
            id = 54008,
            x = 1,
            connections = {
                3, 
            },
        },
        {
            type = "quest",
            id = 54009,
            x = 3,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54022,
            x = 5,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54028,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54094,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_3, {
    name = { -- Breaking Out Ashvane
        type = "quest",
        id = 54121,
    },
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_2,
        },
    },
    active = {
        {
            type = "quest",
            id = 54121,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 54179,
    },
    items = {
        {
            type = "quest",
            id = 54121,
            x = 3,
            connections = {
                1, 2, 3, 
            },
        },
        {
            type = "quest",
            id = 54175,
            x = 1,
            connections = {
                3, 
            },
        },
        {
            type = "quest",
            id = 54176,
            x = 3,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54177,
            x = 5,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54178,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54179,
            x = 3,
        },
    },
})
BtWQuestsDatabase:AddChain(BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_4, {
    name = { -- The Fall of Zuldazar
        type = "quest",
        id = 54302,
    },
    category = BTWQUESTS_CATEGORY_BATTLE_FOR_AZEROTH_TIRAGARDE_SOUND,
    expansion = BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH,
    major = true,
    range = {120,120},
    restrictions = {
        type = "faction",
        id = BTWQUESTS_FACTION_ID_HORDE,
    },
    prerequisites = {
        {
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        },
        {
            name = BTWQUESTS_PROGRESS_THE_WAR_CAMPAIGN,
            type = "chain",
            id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_HORDE_8_1_PART_3,
        },
    },
    active = {
        {
            type = "quest",
            id = 54139,
            status = {'active', 'completed'},
        },
    },
    completed = {
        type = "quest",
        id = 54282,
    },
    items = {
        {
            type = "quest",
            id = 54139,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54140,
            x = 3,
            connections = {
                1, 2, 
            },
        },
        {
            type = "quest",
            id = 54157,
            x = 2,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54156,
            x = 4,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54207,
            x = 3,
            connections = {
                1, 2, 
            },
        },
        {
            type = "quest",
            id = 54211,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54213,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54224,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54244,
            x = 3,
            connections = {
                1, 2, 3, 
            },
        },
        {
            type = "quest",
            id = 54249,
            x = 1,
            connections = {
                3, 
            },
        },
        {
            type = "quest",
            id = 54269,
            x = 3,
            connections = {
                2, 
            },
        },
        {
            type = "quest",
            id = 54270,
            x = 5,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54271,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54275,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54280,
            x = 3,
            connections = {
                1, 
            },
        },
        {
            type = "quest",
            id = 54282,
            x = 3,
        },
    },
})

BtWQuestsDatabase:AddExpansionItems(BTWQUESTS_EXPANSION_BATTLE_FOR_AZEROTH, {
    {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
    },
    {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN,
    },
    
    {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_CAMPAIGN_8_1,
    },
})

BtWQuestsDatabase:AddMap(1161, {
    type = "chain",
    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
    restrictions = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        status = {'active'},
    },
})
BtWQuestsDatabase:AddMap(1165, {
    type = "chain",
    id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
    restrictions = {
        type = "chain",
        id = BTWQUESTS_CHAIN_BATTLE_FOR_AZEROTH_INTRODUCTION,
        status = {'active'},
    },
})