Greasy Fork 还支持 简体中文。

MH: Floating Islands HUD Enhancer

See more thing on your floating islands HUD!

目前為 2021-03-12 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         MH: Floating Islands HUD Enhancer
// @author       Warden Slayer - Warden Slayer#2302
// @namespace    https://greasyfork.org/en/users/227259-wardenslayer
// @version      1.0.5
// @description  See more thing on your floating islands HUD!
// @include      https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
// @include      http://www.mousehuntgame.com/*
// @include      https://www.mousehuntgame.com/*
// ==/UserScript==
$(document).ready(function() {
    const debug = localStorage.getItem('ws.debug');
    if (user.environment_name == 'Floating Islands') {
        if (debug == true) {
            console.log('FI Script Started');
        }
        loadFunction()
    } else {
        if (debug == true) {
            console.log('Not in the FI');
        }
    }
});

function loadFunction() {
    updateAndRender()
    watchThePopup();
}

//HUD Code
function updateAndRender() {
    localStorage.setItem('ws.fi.ocLevel', user.quests.QuestFloatingIslands.airship.oculus_level);
    hg.utils.UserInventory.getItem('sky_pirate_seal_stat_item', function(data) {
        localStorage.setItem('ws.fi.numSeals', data.quantity);
        hg.utils.UserInventory.getItem('floating_trap_upgrade_stat_item', function(data) {
            localStorage.setItem('ws.fi.numJewels', data.quantity);
            hg.utils.UserInventory.getItem('floating_islands_cloud_gem_stat_item', function(data) {
                localStorage.setItem('ws.fi.numGlass', data.quantity);
                hg.utils.UserInventory.getItem('floating_islands_sky_ore_stat_item', function(data) {
                    localStorage.setItem('ws.fi.numOre', data.quantity);
                    buildHUD()
                }, true);
            }, true);
        }, true);
    }, true);
}

function buildHUD() {
    let body = $('.floatingIslandsHUD-statItemContainer');
    $(body).css({
        'width': '350px',
    });
    if ($('.floatingIslandsHUD-statItem-separator').get(0)) {
        $('.floatingIslandsHUD-statItem-separator').hide();
    }
    let bangles = $('.floatingIslandsHUD-statItem.mousehuntTooltipParent[data-item-type="cloudstone_bangle_stat_item"]');
    //Seals
    let pirateSeals = "";
    if ($("[data-item-type=pirate_seals]").get(0)) {
        pirateSeals = $("[data-item-type=pirate_seals]");
    } else {
        pirateSeals = $(bangles).clone().prependTo(body);
    }
    pirateSeals.attr('data-item-type', 'pirate_seals');
    $(pirateSeals).find('.floatingIslandsHUD-item-image.cloudstone_bangle_stat_item').removeClass('cloudstone_bangle_stat_item').addClass('pirate_seals');
    $('.floatingIslandsHUD-item-image.pirate_seals').css({
        'background-image': 'url(https://www.mousehuntgame.com/images/items/stats/db3bb7de0241624283b99481f7c7a6b8.gif?cv=247)',
    });
    $(pirateSeals).find('.floatingIslandsHUD-statItem-quantity.quantity').attr('data-item-type', 'pirate_seals').text(localStorage.getItem('ws.fi.numSeals'));
    $(pirateSeals).find('.mousehuntTooltip.tight.top.noEvents').text('Sky Pirate Seals').css({
        'font-weight': 'bold',
    });
    //Jewels
    let jewels = "";
    if ($("[data-item-type=jewels]").get(0)) {
        jewels = $("[data-item-type=jewels]");
    } else {
        jewels = $(bangles).clone().appendTo(body);
    }
    jewels.attr('data-item-type', 'jewels');
    $(jewels).find('.floatingIslandsHUD-item-image.cloudstone_bangle_stat_item').removeClass('cloudstone_bangle_stat_item').addClass('jewels');
    $('.floatingIslandsHUD-item-image.jewels').css({
        'background-image': 'url(https://www.mousehuntgame.com/images/items/stats/964b5aeaac26714cac2ffa7194e55176.gif?cv=247)',
    });
    $(jewels).find('.floatingIslandsHUD-statItem-quantity.quantity').attr('data-item-type', 'jewels').text(parseInt(localStorage.getItem('ws.fi.numJewels'), 10));
    $(jewels).find('.mousehuntTooltip.tight.top.noEvents').text('Adorned Empyrean Jewel').css({
        'font-weight': 'bold',
    });
    //Hide Wind on islands not launchpad
    if ($('.floatingIslandsHUD.launch_pad_island ').length == 0) {
        $('[data-item-type=bottled_wind_stat_item]:not(.floatingIslandsHUD-fuel-quantity)').hide();
    }
    //Ore/Glass
    const oculusLevel = localStorage.getItem('ws.fi.ocLevel');
    const skyGlass = $('.floatingIslandsHUD-craftingItem.floating_islands_cloud_gem_stat_item').find("[data-item-type=floating_islands_cloud_gem_stat_item]")
    const skyGlassQty = parseInt(localStorage.getItem('ws.fi.numGlass'), 10)
    const skyOre  = $('.floatingIslandsHUD-craftingItem.floating_islands_sky_ore_stat_item').find("[data-item-type=floating_islands_sky_ore_stat_item]")
    const skyOreQty = parseInt(localStorage.getItem('ws.fi.numOre'), 10)
    let upgradeCost = 0;
    if (oculusLevel == 1) {
        upgradeCost = 35;
    } else if (oculusLevel == 2) {
        upgradeCost = 150;
    } else if (oculusLevel == 3) {
        upgradeCost = 500;
    } else if (oculusLevel == 4) {
        upgradeCost = '1.2k';
    } else if (oculusLevel == 5) {
        upgradeCost = '2k';
    } else if (oculusLevel == 6) {
        upgradeCost = '3.5k';
    } else if (oculusLevel == 7) {
        upgradeCost = '8k';
    } else if (oculusLevel == 8) {
        upgradeCost = '10k';
    } else if (oculusLevel == 9) {
        upgradeCost = '2.5k';
    }
    $(skyGlass).text(skyGlassQty + '/' + upgradeCost);
    $(skyOre).text(skyOreQty + '/' + upgradeCost);
    //Warden/Paragon Progress
    const allRemainingHunts = user.quests.QuestFloatingIslands.hunting_site_atts.enemy_encounter_hunts_remaining;
    let warGons = 'Paragon: ';
    if (user.quests.QuestFloatingIslands.hunting_site_atts.has_enemy == null) {
        warGons = 'Enemy: ';
    } else if (user.quests.QuestFloatingIslands.hunting_site_atts.is_high_altitude == null) {
        warGons = 'Warden: ';
    }
    $('.floatingIslandsHUD-enemy-state.enemyApproaching:not(.enemyActive)').text(warGons + allRemainingHunts);
    //wind on maybe
    const useWind = localStorage.getItem('ws.fi.useWind');
    const numWind = parseInt($('.floatingIslandsHUD-statItem-quantity.quantity').filter('[data-item-type=bottled_wind_stat_item]').text(),10);
    if (useWind == 'yes') {
        if (user.quests.QuestFloatingIslands.hunting_site_atts.is_fuel_enabled == null) {
            if (numWind > 0 ) {
                hg.views.HeadsUpDisplayFloatingIslandsView.toggleFuel();
                localStorage.setItem('ws.fi.useWind', 'yes');
            }
        }
    }
}
$(document).on('click', '.floatingIslandsHUD-fuel-button', function() {
    if (user.quests.QuestFloatingIslands.hunting_site_atts.is_fuel_enabled == null) {
        localStorage.setItem('ws.fi.useWind', 'yes');
    } else {
        localStorage.setItem('ws.fi.useWind', 'no');
    }
})

//Paragon Overlay
function watchThePopup() {
    const popupWatcher = new MutationObserver(callbackPopup);
    const popupWatcherOptons = {
        childList: false,
        attributes: true,
        subtree: false,
    };
    popupWatcher.observe($('#overlayPopup').get(0), popupWatcherOptons);
}

function callbackPopup(mutationList, observer) {
    const mutation = $(mutationList).get(0);
    if (mutation.type == 'attributes') {
        if ($('.floatingIslandsAdventureBoard-container').get(0)) {
            observer.disconnect();
            setTimeout(renderSkyMap, 100);
        }
    }
}

function renderSkyMap() {
    drawParagons()
    //cycleTracker()
    const body = $('.floatingIslandsAdventureBoard-trapLibrary');
    $(body).removeAttr("href").removeAttr("onclick");
    const trapLibrary = $('.floatingIslandsAdventureBoard-trapLibrary-text:not(.wind)');
    let useWindDiv = $('.floatingIslandsAdventureBoard-trapLibrary-text.wind');
    if ($(useWindDiv).length == 0) {
        useWindDiv = $(trapLibrary).clone().appendTo(body);
        $(useWindDiv).addClass('wind');
    }
    let useWindCb = $(useWindDiv).find('.floatingIslandsAdventureBoard-trapLibrary-checkbox');
    $(useWindCb).addClass('wind');
    $(useWindDiv).children().empty().append(useWindCb).append("Use Wind");
    forceWind()
}

function forceWind() {
    const windBox = $('.floatingIslandsAdventureBoard-trapLibrary-checkbox.wind');
    const useWind = localStorage.getItem('ws.fi.useWind');
    if (useWind == 'yes') {
        $(windBox).prop('checked',true)
    } else {
        $(windBox).prop('checked',false)
    }
}

$(document).on('click', '.floatingIslandsAdventureBoard-trapLibrary-text:not(.wind)', function() {
    if ($('.floatingIslandsAdventureBoard-trapLibrary').hasClass('disabled')){
    } else {
        hg.views.FloatingIslandsAdventureBoardView.toggleUseSavedSetup()
        setTimeout(forceWind, 500)
    }
})
$(document).on('click', '.floatingIslandsAdventureBoard-trapLibrary-text.wind', function() {
    const windBox = $('.floatingIslandsAdventureBoard-trapLibrary-checkbox.wind');
    const useWind = localStorage.getItem('ws.fi.useWind');
    if ($('.floatingIslandsAdventureBoard-trapLibrary').hasClass('disabled')){
    } else {
        if (useWind == 'yes') {
            $(windBox).prop('checked',false)
            localStorage.setItem('ws.fi.useWind', 'no')
        } else {
            $(windBox).prop('checked',true)
            localStorage.setItem('ws.fi.useWind', 'yes')
        }
    }
})

//to do
function cycleTracker() {
    $('.floatingIslandsAdventureBoard-rerollImage').text('1234').css({
        'font-size': '14x',
        'font-weight': 'bold',
        'color': 'red',
    });

}

function drawParagons() {
    const overlayCont = $('.floatingIslandsAdventureBoard-container');
    const physicalParagon = $('.floatingIslandsHUD-powerType.physical:not(.fipcmask)');
    const physicalCatch = hg.utils.MouseUtil.getMouse('physical_paragon', function(resp) {
        return resp.num_catches;
    });
    const tacticalParagon = $('.floatingIslandsHUD-powerType.tactical:not(.fipcmask)');
    const tacticalCatch = hg.utils.MouseUtil.getMouse('tactical_paragon', function(resp) {
        return resp.num_catches;
    });
    const lawParagon = $('.floatingIslandsHUD-powerType.law:not(.fipcmask)');
    const lawCatch = hg.utils.MouseUtil.getMouse('law_paragon', function(resp) {
        return resp.num_catches;
    });
    const draconicParagon = $('.floatingIslandsHUD-powerType.draconic:not(.fipcmask)');
    const draconicCatch = hg.utils.MouseUtil.getMouse('draconic_paragon', function(resp) {
        return resp.num_catches;
    });
    const arcaneParagon = $('.floatingIslandsHUD-powerType.arcane:not(.fipcmask)');
    const arcaneCatch = hg.utils.MouseUtil.getMouse('arcane_paragon', function(resp) {
        return resp.num_catches;
    });
    const forgottenParagon = $('.floatingIslandsHUD-powerType.forgotten:not(.fipcmask)');
    const forgottenCatch = hg.utils.MouseUtil.getMouse('forgotten_paragon', function(resp) {
        return resp.num_catches;
    });
    const hydroParagon = $('.floatingIslandsHUD-powerType.hydro:not(.fipcmask)');
    const hydroCatch = hg.utils.MouseUtil.getMouse('hydro_paragon', function(resp) {
        return resp.num_catches;
    });
    const shadowParagon = $('.floatingIslandsHUD-powerType.shadow:not(.fipcmask)');
    const shadowCatch = hg.utils.MouseUtil.getMouse('shadow_paragon', function(resp) {
        return resp.num_catches;
    });
    $(physicalParagon).text(physicalCatch);
    $(tacticalParagon).text(tacticalCatch);
    $(lawParagon).text(lawCatch);
    $(draconicParagon).text(draconicCatch);
    $(arcaneParagon).text(arcaneCatch);
    $(forgottenParagon).text(forgottenCatch);
    $(hydroParagon).text(hydroCatch);
    $(shadowParagon).text(shadowCatch);
    $('.floatingIslandsHUD-powerType').css({
        'font-size': '14x',
        'font-weight': 'bold',
        'color': 'blue',
    });
    watchThePopup();
}

$(document).ajaxStop(function(){
    if (user.environment_name == 'Floating Islands') {
        loadFunction()
    }
});