﻿#升级所有建筑 阈值10级
qing_htool_building_build_upgrade_all_to_max = {
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
    qing_htool_building_build_upgrade_all = yes
}

qing_htool_building_build_upgrade_all = {
    if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_castle_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 550 root.treasury >= 550 } }
        add_building = castle_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 550 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 550 }
                    root = { remove_long_term_gold = 550 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_castle_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 700 root.treasury >= 700 } }
        add_building = castle_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 700 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 700 }
                    root = { remove_long_term_gold = 700 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
                else = { root = { remove_long_term_gold = 700 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
                else = { root = { remove_long_term_gold = 700 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_castle_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 850 root.treasury >= 850 } }
        add_building = castle_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 850 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 850 }
                    root = { remove_long_term_gold = 850 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
                else = { root = { remove_long_term_gold = 850 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
                else = { root = { remove_long_term_gold = 850 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_city_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 550 root.treasury >= 550 } }
        add_building = city_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 550 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 550 }
                    root = { remove_long_term_gold = 550 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_city_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 700 root.treasury >= 700 } }
        add_building = city_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 700 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 700 }
                    root = { remove_long_term_gold = 700 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
                else = { root = { remove_long_term_gold = 700 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
                else = { root = { remove_long_term_gold = 700 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_city_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 850 root.treasury >= 850 } }
        add_building = city_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 850 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 850 }
                    root = { remove_long_term_gold = 850 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
                else = { root = { remove_long_term_gold = 850 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
                else = { root = { remove_long_term_gold = 850 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_temple_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 550 root.treasury >= 550 } }
        add_building = temple_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 550 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 550 }
                    root = { remove_long_term_gold = 550 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_temple_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 700 root.treasury >= 700 } }
        add_building = temple_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 700 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 700 }
                    root = { remove_long_term_gold = 700 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
                else = { root = { remove_long_term_gold = 700 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
                else = { root = { remove_long_term_gold = 700 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_temple_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 850 root.treasury >= 850 } }
        add_building = temple_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 850 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 850 }
                    root = { remove_long_term_gold = 850 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
                else = { root = { remove_long_term_gold = 850 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
                else = { root = { remove_long_term_gold = 850 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_tribe_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 550 root.treasury >= 550 } }
        add_building = tribe_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 550 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 550 }
                    root = { remove_long_term_gold = 550 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_temple_citadel_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 550 root.treasury >= 550 } }
        add_building = temple_citadel_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 550 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 550 }
                    root = { remove_long_term_gold = 550 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 550 }
                    root = { remove_treasury = 550 }
                }
                else = { root = { remove_long_term_gold = 550 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_temple_citadel_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 700 root.treasury >= 700 } }
        add_building = temple_citadel_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 700 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 700 }
                    root = { remove_long_term_gold = 700 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
                else = { root = { remove_long_term_gold = 700 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 700 }
                    root = { remove_treasury = 700 }
                }
                else = { root = { remove_long_term_gold = 700 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_holding_switch_trigger = yes qing_htool_building_build_upgrade_temple_citadel_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 850 root.treasury >= 850 } }
        add_building = temple_citadel_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 850 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 850 }
                    root = { remove_long_term_gold = 850 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
                else = { root = { remove_long_term_gold = 850 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 850 }
                    root = { remove_treasury = 850 }
                }
                else = { root = { remove_long_term_gold = 850 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_ramparts_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = ramparts_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_ramparts_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = ramparts_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_ramparts_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = ramparts_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_ramparts_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = ramparts_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_ramparts_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = ramparts_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_ramparts_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = ramparts_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_ramparts_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = ramparts_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_curtain_walls_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = curtain_walls_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_curtain_walls_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = curtain_walls_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_curtain_walls_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = curtain_walls_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_curtain_walls_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = curtain_walls_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_curtain_walls_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = curtain_walls_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_curtain_walls_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = curtain_walls_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_curtain_walls_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = curtain_walls_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_watchtowers_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = watchtowers_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watchtowers_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = watchtowers_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watchtowers_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = watchtowers_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watchtowers_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = watchtowers_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watchtowers_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = watchtowers_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watchtowers_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = watchtowers_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watchtowers_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = watchtowers_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_hill_forts_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = hill_forts_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_forts_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = hill_forts_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_forts_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = hill_forts_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_forts_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = hill_forts_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_forts_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = hill_forts_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_forts_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = hill_forts_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_forts_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = hill_forts_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_palisades_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = palisades_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_idjang_forts_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = idjang_forts_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_idjang_forts_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = idjang_forts_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_idjang_forts_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = idjang_forts_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_common_tradeport_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = common_tradeport_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_common_tradeport_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = common_tradeport_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_common_tradeport_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = common_tradeport_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_common_tradeport_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = common_tradeport_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_common_tradeport_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = common_tradeport_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_common_tradeport_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = common_tradeport_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_common_tradeport_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = common_tradeport_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_pastures_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = pastures_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_pastures_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = pastures_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_pastures_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = pastures_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_pastures_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = pastures_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_pastures_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = pastures_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_pastures_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = pastures_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_pastures_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = pastures_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_hunting_grounds_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = hunting_grounds_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hunting_grounds_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = hunting_grounds_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hunting_grounds_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = hunting_grounds_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hunting_grounds_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = hunting_grounds_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hunting_grounds_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = hunting_grounds_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hunting_grounds_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = hunting_grounds_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hunting_grounds_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = hunting_grounds_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_orchards_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = orchards_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_orchards_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = orchards_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_orchards_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = orchards_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_orchards_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = orchards_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_orchards_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = orchards_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_orchards_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = orchards_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_orchards_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = orchards_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_farm_estates_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = farm_estates_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_farm_estates_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = farm_estates_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_farm_estates_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = farm_estates_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_farm_estates_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = farm_estates_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_farm_estates_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = farm_estates_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_farm_estates_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = farm_estates_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_farm_estates_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = farm_estates_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_cereal_fields_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = cereal_fields_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_cereal_fields_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = cereal_fields_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_cereal_fields_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = cereal_fields_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_cereal_fields_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = cereal_fields_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_cereal_fields_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = cereal_fields_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_cereal_fields_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = cereal_fields_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_cereal_fields_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = cereal_fields_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_logging_camps_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = logging_camps_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_logging_camps_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = logging_camps_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_logging_camps_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = logging_camps_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_logging_camps_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = logging_camps_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_logging_camps_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = logging_camps_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_logging_camps_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = logging_camps_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_logging_camps_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = logging_camps_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_peat_quarries_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = peat_quarries_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_peat_quarries_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = peat_quarries_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_peat_quarries_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = peat_quarries_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_peat_quarries_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = peat_quarries_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_peat_quarries_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = peat_quarries_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_peat_quarries_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = peat_quarries_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_peat_quarries_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = peat_quarries_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_hill_farms_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = hill_farms_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_farms_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = hill_farms_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_farms_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = hill_farms_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_farms_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = hill_farms_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_farms_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = hill_farms_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_farms_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = hill_farms_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hill_farms_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = hill_farms_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_elephant_pens_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = elephant_pens_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_elephant_pens_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = elephant_pens_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_elephant_pens_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = elephant_pens_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_elephant_pens_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = elephant_pens_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_elephant_pens_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = elephant_pens_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_elephant_pens_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = elephant_pens_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_elephant_pens_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = elephant_pens_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_plantations_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = plantations_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_plantations_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = plantations_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_plantations_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = plantations_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_plantations_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = plantations_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_plantations_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = plantations_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_plantations_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = plantations_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_plantations_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = plantations_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_quarries_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = quarries_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_quarries_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = quarries_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_quarries_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = quarries_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_quarries_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = quarries_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_quarries_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = quarries_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_quarries_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = quarries_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_quarries_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = quarries_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_qanats_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = qanats_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_qanats_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = qanats_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_qanats_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = qanats_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_qanats_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = qanats_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_qanats_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = qanats_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_qanats_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = qanats_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_qanats_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = qanats_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_murex_farm_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = murex_farm_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_murex_farm_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = murex_farm_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_murex_farm_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = murex_farm_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_murex_farm_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = murex_farm_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_murex_farm_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = murex_farm_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_murex_farm_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = murex_farm_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_murex_farm_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = murex_farm_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_paddy_fields_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = paddy_fields_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_paddy_fields_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = paddy_fields_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_paddy_fields_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = paddy_fields_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_paddy_fields_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = paddy_fields_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_paddy_fields_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = paddy_fields_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_paddy_fields_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = paddy_fields_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_paddy_fields_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = paddy_fields_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_spice_plantation_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = spice_plantation_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_spice_plantation_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = spice_plantation_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_spice_plantation_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = spice_plantation_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_spice_plantation_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = spice_plantation_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_spice_plantation_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = spice_plantation_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_spice_plantation_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = spice_plantation_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_spice_plantation_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = spice_plantation_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_waterworks_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = waterworks_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_waterworks_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = waterworks_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_waterworks_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = waterworks_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_waterworks_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = waterworks_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_waterworks_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = waterworks_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_waterworks_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = waterworks_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_waterworks_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = waterworks_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_caravanserai_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 350 root.treasury >= 350 } }
        add_building = caravanserai_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 350 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 350 }
                    root = { remove_long_term_gold = 350 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_caravanserai_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 485 root.treasury >= 485 } }
        add_building = caravanserai_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 485 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 485 }
                    root = { remove_long_term_gold = 485 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_caravanserai_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 725 root.treasury >= 725 } }
        add_building = caravanserai_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 725 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 725 }
                    root = { remove_long_term_gold = 725 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_caravanserai_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1100 root.treasury >= 1100 } }
        add_building = caravanserai_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1100 }
                    root = { remove_long_term_gold = 1100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_caravanserai_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1640 root.treasury >= 1640 } }
        add_building = caravanserai_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1640 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1640 }
                    root = { remove_long_term_gold = 1640 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_caravanserai_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2375 root.treasury >= 2375 } }
        add_building = caravanserai_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2375 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2375 }
                    root = { remove_long_term_gold = 2375 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_caravanserai_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 3335 root.treasury >= 3335 } }
        add_building = caravanserai_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 3335 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 3335 }
                    root = { remove_long_term_gold = 3335 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_watermills_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 350 root.treasury >= 350 } }
        add_building = watermills_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 350 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 350 }
                    root = { remove_long_term_gold = 350 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watermills_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 485 root.treasury >= 485 } }
        add_building = watermills_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 485 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 485 }
                    root = { remove_long_term_gold = 485 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watermills_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 725 root.treasury >= 725 } }
        add_building = watermills_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 725 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 725 }
                    root = { remove_long_term_gold = 725 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watermills_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1100 root.treasury >= 1100 } }
        add_building = watermills_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1100 }
                    root = { remove_long_term_gold = 1100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watermills_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1640 root.treasury >= 1640 } }
        add_building = watermills_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1640 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1640 }
                    root = { remove_long_term_gold = 1640 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watermills_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2375 root.treasury >= 2375 } }
        add_building = watermills_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2375 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2375 }
                    root = { remove_long_term_gold = 2375 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_watermills_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 3335 root.treasury >= 3335 } }
        add_building = watermills_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 3335 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 3335 }
                    root = { remove_long_term_gold = 3335 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_windmills_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 350 root.treasury >= 350 } }
        add_building = windmills_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 350 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 350 }
                    root = { remove_long_term_gold = 350 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_windmills_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 485 root.treasury >= 485 } }
        add_building = windmills_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 485 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 485 }
                    root = { remove_long_term_gold = 485 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_windmills_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 725 root.treasury >= 725 } }
        add_building = windmills_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 725 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 725 }
                    root = { remove_long_term_gold = 725 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_windmills_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1100 root.treasury >= 1100 } }
        add_building = windmills_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1100 }
                    root = { remove_long_term_gold = 1100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_windmills_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1640 root.treasury >= 1640 } }
        add_building = windmills_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1640 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1640 }
                    root = { remove_long_term_gold = 1640 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_windmills_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2375 root.treasury >= 2375 } }
        add_building = windmills_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2375 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2375 }
                    root = { remove_long_term_gold = 2375 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_windmills_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 3335 root.treasury >= 3335 } }
        add_building = windmills_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 3335 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 3335 }
                    root = { remove_long_term_gold = 3335 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_guild_halls_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = guild_halls_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_guild_halls_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = guild_halls_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_guild_halls_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = guild_halls_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_guild_halls_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = guild_halls_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_guild_halls_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = guild_halls_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_guild_halls_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = guild_halls_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_guild_halls_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = guild_halls_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_market_villages_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = market_villages_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_stilted_granaries_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = stilted_granaries_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stilted_granaries_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = stilted_granaries_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stilted_granaries_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = stilted_granaries_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stilted_granaries_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = stilted_granaries_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stilted_granaries_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = stilted_granaries_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stilted_granaries_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = stilted_granaries_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stilted_granaries_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = stilted_granaries_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_capital_bureau_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = capital_bureau_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_capital_bureau_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = capital_bureau_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_capital_bureau_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = capital_bureau_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_capital_bureau_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = capital_bureau_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_capital_bureau_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = capital_bureau_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_capital_bureau_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = capital_bureau_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_capital_bureau_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = capital_bureau_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_breweries_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = breweries_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_breweries_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = breweries_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_breweries_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = breweries_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_breweries_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = breweries_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_breweries_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = breweries_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_breweries_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = breweries_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_breweries_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = breweries_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_military_camps_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = military_camps_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_military_camps_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = military_camps_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_military_camps_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = military_camps_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_military_camps_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = military_camps_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_military_camps_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = military_camps_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_military_camps_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = military_camps_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_military_camps_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = military_camps_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_regimental_grounds_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = regimental_grounds_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_regimental_grounds_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = regimental_grounds_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_regimental_grounds_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = regimental_grounds_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_regimental_grounds_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = regimental_grounds_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_regimental_grounds_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = regimental_grounds_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_regimental_grounds_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = regimental_grounds_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_regimental_grounds_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = regimental_grounds_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_barracks_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = barracks_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_barracks_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = barracks_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_barracks_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = barracks_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_barracks_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = barracks_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_barracks_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = barracks_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_barracks_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = barracks_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_barracks_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = barracks_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_warrior_lodges_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = warrior_lodges_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_warrior_lodges_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = warrior_lodges_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_warrior_lodges_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = warrior_lodges_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_warrior_lodges_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = warrior_lodges_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_warrior_lodges_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = warrior_lodges_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_warrior_lodges_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = warrior_lodges_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_warrior_lodges_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = warrior_lodges_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_hillside_grazing_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = hillside_grazing_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hillside_grazing_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = hillside_grazing_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hillside_grazing_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = hillside_grazing_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hillside_grazing_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = hillside_grazing_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hillside_grazing_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = hillside_grazing_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hillside_grazing_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = hillside_grazing_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hillside_grazing_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = hillside_grazing_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_outposts_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = outposts_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_outposts_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = outposts_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_outposts_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = outposts_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_outposts_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = outposts_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_outposts_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = outposts_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_outposts_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = outposts_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_outposts_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = outposts_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_camel_farms_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = camel_farms_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_camel_farms_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = camel_farms_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_camel_farms_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = camel_farms_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_camel_farms_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = camel_farms_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_camel_farms_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = camel_farms_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_camel_farms_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = camel_farms_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_camel_farms_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = camel_farms_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_horse_pastures_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = horse_pastures_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_horse_pastures_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = horse_pastures_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_horse_pastures_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = horse_pastures_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_horse_pastures_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = horse_pastures_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_horse_pastures_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = horse_pastures_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_horse_pastures_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = horse_pastures_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_horse_pastures_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = horse_pastures_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_stables_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = stables_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stables_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = stables_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stables_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = stables_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stables_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = stables_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stables_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = stables_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stables_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = stables_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_stables_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = stables_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_smiths_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = smiths_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_smiths_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = smiths_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_smiths_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = smiths_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_smiths_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = smiths_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_smiths_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = smiths_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_smiths_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = smiths_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_smiths_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = smiths_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_workshops_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 350 root.treasury >= 350 } }
        add_building = workshops_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 350 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 350 }
                    root = { remove_long_term_gold = 350 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_workshops_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 485 root.treasury >= 485 } }
        add_building = workshops_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 485 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 485 }
                    root = { remove_long_term_gold = 485 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_workshops_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 725 root.treasury >= 725 } }
        add_building = workshops_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 725 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 725 }
                    root = { remove_long_term_gold = 725 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_workshops_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1100 root.treasury >= 1100 } }
        add_building = workshops_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1100 }
                    root = { remove_long_term_gold = 1100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_workshops_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1640 root.treasury >= 1640 } }
        add_building = workshops_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1640 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1640 }
                    root = { remove_long_term_gold = 1640 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_workshops_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2375 root.treasury >= 2375 } }
        add_building = workshops_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2375 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2375 }
                    root = { remove_long_term_gold = 2375 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_workshops_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 3335 root.treasury >= 3335 } }
        add_building = workshops_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 3335 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 3335 }
                    root = { remove_long_term_gold = 3335 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_wind_furnace_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 350 root.treasury >= 350 } }
        add_building = wind_furnace_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 350 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 350 }
                    root = { remove_long_term_gold = 350 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_wind_furnace_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 485 root.treasury >= 485 } }
        add_building = wind_furnace_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 485 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 485 }
                    root = { remove_long_term_gold = 485 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_wind_furnace_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 725 root.treasury >= 725 } }
        add_building = wind_furnace_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 725 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 725 }
                    root = { remove_long_term_gold = 725 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_wind_furnace_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1100 root.treasury >= 1100 } }
        add_building = wind_furnace_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1100 }
                    root = { remove_long_term_gold = 1100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_wind_furnace_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1640 root.treasury >= 1640 } }
        add_building = wind_furnace_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1640 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1640 }
                    root = { remove_long_term_gold = 1640 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_wind_furnace_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2375 root.treasury >= 2375 } }
        add_building = wind_furnace_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2375 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2375 }
                    root = { remove_long_term_gold = 2375 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_wind_furnace_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 3335 root.treasury >= 3335 } }
        add_building = wind_furnace_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 3335 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 3335 }
                    root = { remove_long_term_gold = 3335 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_powder_magazine_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 350 root.treasury >= 350 } }
        add_building = powder_magazine_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 350 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 350 }
                    root = { remove_long_term_gold = 350 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 350 }
                    root = { remove_treasury = 350 }
                }
                else = { root = { remove_long_term_gold = 350 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_powder_magazine_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 485 root.treasury >= 485 } }
        add_building = powder_magazine_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 485 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 485 }
                    root = { remove_long_term_gold = 485 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 485 }
                    root = { remove_treasury = 485 }
                }
                else = { root = { remove_long_term_gold = 485 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_powder_magazine_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 725 root.treasury >= 725 } }
        add_building = powder_magazine_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 725 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 725 }
                    root = { remove_long_term_gold = 725 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 725 }
                    root = { remove_treasury = 725 }
                }
                else = { root = { remove_long_term_gold = 725 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_powder_magazine_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1100 root.treasury >= 1100 } }
        add_building = powder_magazine_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1100 }
                    root = { remove_long_term_gold = 1100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1100 }
                    root = { remove_treasury = 1100 }
                }
                else = { root = { remove_long_term_gold = 1100 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_powder_magazine_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1640 root.treasury >= 1640 } }
        add_building = powder_magazine_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1640 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1640 }
                    root = { remove_long_term_gold = 1640 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1640 }
                    root = { remove_treasury = 1640 }
                }
                else = { root = { remove_long_term_gold = 1640 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_powder_magazine_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2375 root.treasury >= 2375 } }
        add_building = powder_magazine_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2375 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2375 }
                    root = { remove_long_term_gold = 2375 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2375 }
                    root = { remove_treasury = 2375 }
                }
                else = { root = { remove_long_term_gold = 2375 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_powder_magazine_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 3335 root.treasury >= 3335 } }
        add_building = powder_magazine_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 3335 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 3335 }
                    root = { remove_long_term_gold = 3335 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 3335 }
                    root = { remove_treasury = 3335 }
                }
                else = { root = { remove_long_term_gold = 3335 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_war_camps_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = war_camps_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_kora_kora_yards_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = kora_kora_yards_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_kora_kora_yards_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = kora_kora_yards_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_kora_kora_yards_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = kora_kora_yards_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_wantilan_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = wantilan_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_wantilan_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = wantilan_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_wantilan_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = wantilan_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_hospices_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = hospices_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hospices_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = hospices_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hospices_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = hospices_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hospices_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = hospices_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hospices_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = hospices_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hospices_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = hospices_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_hospices_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = hospices_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_scriptorium_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = scriptorium_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_scriptorium_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = scriptorium_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_scriptorium_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = scriptorium_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_scriptorium_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = scriptorium_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_scriptorium_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = scriptorium_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_scriptorium_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = scriptorium_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_scriptorium_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = scriptorium_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_monastic_schools_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = monastic_schools_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_monastic_schools_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = monastic_schools_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_monastic_schools_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = monastic_schools_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_monastic_schools_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = monastic_schools_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_monastic_schools_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = monastic_schools_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_monastic_schools_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = monastic_schools_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_monastic_schools_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = monastic_schools_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_megalith_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 250 root.treasury >= 250 } }
        add_building = megalith_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 250 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 250 }
                    root = { remove_long_term_gold = 250 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 250 }
                    root = { remove_treasury = 250 }
                }
                else = { root = { remove_long_term_gold = 250 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_megalith_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 340 root.treasury >= 340 } }
        add_building = megalith_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 340 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 340 }
                    root = { remove_long_term_gold = 340 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 340 }
                    root = { remove_treasury = 340 }
                }
                else = { root = { remove_long_term_gold = 340 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_megalith_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 500 root.treasury >= 500 } }
        add_building = megalith_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 500 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 500 }
                    root = { remove_long_term_gold = 500 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 500 }
                    root = { remove_treasury = 500 }
                }
                else = { root = { remove_long_term_gold = 500 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_megalith_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 750 root.treasury >= 750 } }
        add_building = megalith_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 750 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 750 }
                    root = { remove_long_term_gold = 750 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 750 }
                    root = { remove_treasury = 750 }
                }
                else = { root = { remove_long_term_gold = 750 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_megalith_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1110 root.treasury >= 1110 } }
        add_building = megalith_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1110 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1110 }
                    root = { remove_long_term_gold = 1110 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1110 }
                    root = { remove_treasury = 1110 }
                }
                else = { root = { remove_long_term_gold = 1110 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_megalith_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1600 root.treasury >= 1600 } }
        add_building = megalith_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1600 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1600 }
                    root = { remove_long_term_gold = 1600 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1600 }
                    root = { remove_treasury = 1600 }
                }
                else = { root = { remove_long_term_gold = 1600 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_megalith_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 2240 root.treasury >= 2240 } }
        add_building = megalith_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 2240 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 2240 }
                    root = { remove_long_term_gold = 2240 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 2240 }
                    root = { remove_treasury = 2240 }
                }
                else = { root = { remove_long_term_gold = 2240 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_longhouses_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = longhouses_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_water_temples_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = water_temples_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_water_temples_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = water_temples_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_water_temples_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = water_temples_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_citadel_shrine_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = citadel_shrine_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_citadel_shrine_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = citadel_shrine_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_citadel_shrine_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = citadel_shrine_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_citadel_shrine_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = citadel_shrine_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_citadel_shrine_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = citadel_shrine_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_citadel_shrine_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = citadel_shrine_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_citadel_shrine_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = citadel_shrine_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_sacred_pool_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = sacred_pool_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_sacred_pool_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = sacred_pool_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_sacred_pool_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = sacred_pool_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_sacred_pool_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = sacred_pool_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_sacred_pool_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = sacred_pool_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_sacred_pool_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = sacred_pool_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_sacred_pool_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = sacred_pool_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_upgrade_vihara_halls_02_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = vihara_halls_02
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_vihara_halls_03_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 195 root.treasury >= 195 } }
        add_building = vihara_halls_03
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 195 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 195 }
                    root = { remove_long_term_gold = 195 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 195 }
                    root = { remove_treasury = 195 }
                }
                else = { root = { remove_long_term_gold = 195 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_vihara_halls_04_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 275 root.treasury >= 275 } }
        add_building = vihara_halls_04
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 275 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 275 }
                    root = { remove_long_term_gold = 275 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 275 }
                    root = { remove_treasury = 275 }
                }
                else = { root = { remove_long_term_gold = 275 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_vihara_halls_05_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 400 root.treasury >= 400 } }
        add_building = vihara_halls_05
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 400 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 400 }
                    root = { remove_long_term_gold = 400 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 400 }
                    root = { remove_treasury = 400 }
                }
                else = { root = { remove_long_term_gold = 400 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_vihara_halls_06_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 580 root.treasury >= 580 } }
        add_building = vihara_halls_06
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 580 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 580 }
                    root = { remove_long_term_gold = 580 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 580 }
                    root = { remove_treasury = 580 }
                }
                else = { root = { remove_long_term_gold = 580 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_vihara_halls_07_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 825 root.treasury >= 825 } }
        add_building = vihara_halls_07
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 825 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 825 }
                    root = { remove_long_term_gold = 825 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 825 }
                    root = { remove_treasury = 825 }
                }
                else = { root = { remove_long_term_gold = 825 } }
            }
        }
    }
    else_if = { limit = { qing_htool_building_build_upgrade_vihara_halls_08_trigger = yes OR = { NOT = { qing_htool_building_build_upgrade_cost_switch_trigger = yes } root.gold >= 1145 root.treasury >= 1145 } }
        add_building = vihara_halls_08
        if = { limit = { qing_htool_building_build_upgrade_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 1145 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 1145 }
                    root = { remove_long_term_gold = 1145 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 1145 }
                    root = { remove_treasury = 1145 }
                }
                else = { root = { remove_long_term_gold = 1145 } }
            }
        }
    }
}
