Melvor Auto Leave Combat

Automatically leaves combat if no food is equipped.

// ==UserScript==
// @name         Melvor Auto Leave Combat
// @version      1.0
// @description  Automatically leaves combat if no food is equipped.
// @author       Zek (credit to Aldous Watts: https://addons.mozilla.org/en-US/firefox/addon/scripting-engine-melvor-idle/)
// @match        https://*.melvoridle.com/*
// @grant        none
// @namespace http://tampermonkey.net/
// ==/UserScript==

this.autoLeaveCombat = setInterval(() => {
    if (window.isInCombat && window.equippedFood[window.currentCombatFood].qty < 1) {
        window.stopCombat(false, true, true);
    }
}, 500);