Greasy Fork

Greasy Fork is available in English.

MH: M400 Hunting Helper

Adds the ability to one click travel to the next m400 assigment location

当前为 2021-07-08 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MH: M400 Hunting Helper
// @author       Warden Slayer - Warden Slayer#2010
// @namespace    http://greasyfork.icu/en/users/227259-wardenslayer
// @version      1.0.2
// @description  Adds the ability to one click travel to the next m400 assigment location
// @include      https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @include      http://www.mousehuntgame.com/*
// @include      https://www.mousehuntgame.com/*
// @connect      http://www.mousehuntgame.com/*
// @connect      https://www.mousehuntgame.com/*
// ==/UserScript==
$(document).ready(function() {
    const debug = localStorage.getItem('ws.debug');
    if (debug == true) {
        console.log('M400 Hunting Helper');
    };
});

$(document).on('click', '.campPage-tabs-tabHeader.quests', function() {
    setTimeout(renderQuestTab, 300);
});

function renderQuestTab() {
    $('.campPage-quests-footer-smash').removeAttr("href").removeAttr("onclick");
    if ($('#questTravelButton').length > 0) {
    } else {
        const allTasks = $('.campPage-quests-objective-container:not(".locked")');
        $(allTasks).find('.campPage-quests-objective-content').css({'width': '50%',});
        const questTravelButton = document.createElement('button');
        questTravelButton.id = 'questTravelButton';
        $(questTravelButton).addClass('mousehuntActionButton small');
        $(questTravelButton).attr('title', 'Travel to task location');
        const travelText = document.createElement('span');
        $(travelText).addClass('travelText').text('Travel').css({
            'font-size': '12px',
        });
        $(questTravelButton).append(travelText);
        $(allTasks).find('.campPage-quests-objective').append(questTravelButton);
        $('.mousehuntActionButton.small').css({
            'width': '75px',
            'height': '25px',
            'vertical-align': 'middle',
        });
        // smashing
        const smashBox = $('.campPage-quests-footer-smash');
        const smashBtn = $(smashBox).find('.campPage-quests-footer-smash-icon');
        $(smashBox).text('');
        $(smashBtn).removeClass('campPage-quests-footer-smash-icon').addClass('mousehuntActionButton small');
        $(smashBtn).attr('id','smashBtn');
        const smashBtnText = document.createElement('span');
        $(smashBtn).append(smashBtnText);
        $(smashBtnText).addClass('smashBtnText').text('Smash').css({
            'font-size': '12px',
        });
        const smashTxt = document.createElement('span');
        $(smashTxt).text("Don't like an assignment? Cancel it by smashing the assignment with your Hunter's Hammer.");
        $(smashTxt).css({
            'float': 'left',
            'margin-bottom': '10px',
        });
        $(smashBox).append(smashTxt);
        $(smashBox).append(smashBtn);
        $(smashBtn).css({
            'width': '50px',
            'height': '15px',
            'vertical-align': 'middle',
        });
    }
}

$(document).on('click', '#questTravelButton', function() {
    if ($('.campPage-tabs-tabHeader.quests').hasClass('active')) {
        if ($('.campPage-quests-title').text() == 'Track down the elusive M400') {
            let location = $(this).parent().parent().find('.campPage-quests-objective-task').text()
            const locationSplit = location.split('in ');
            if (locationSplit[1] == undefined) {
                const mouseSplit = location.split('from ');
                location = convertMouseToLocation(mouseSplit[1].replace(' Mice','xyz').replace(' Mouse','xyz').split('xyz')[0])
            } else {
                location = locationSplit[1].replace('the ','');
            }
            app.pages.TravelPage.travel(convertNameToClass(location))
        }
    }
});

function convertMouseToLocation(mouseName) {
    let locationName = "";
    const meadow = ['Meadow','Bionic'];
    const bazaar = ['Bazaar','Master Burglar'];
    const kGauntlet = ["King's Gauntlet",'Cavalier'];
    const training = ['Training Grounds','Ninja'];
    const meditation = ['Meditation Room','Master of the Cheese Belt','Master of the Cheese Claw','Master of the Cheese Fang'];
    const pinacle = ['Pinnacle Chamber','Master of the Dojo'];
    const catacombs = ['Catacombs','Lycan','Terror Knight'];
    const fGrove = ['Forbidden Grove','Realm Ripper'];
    const aRealm = ['Acolyte Realm','Gate Guardian','Sorceror'];
    const ssh4 = ['S.S. Huntington IV','Buccaneer','Captain'];
    const derrDunes = ['Derr Dunes','Grunt','Guardian','Renegade','Seer','Trailblazer'];
    const nergPlains = ['Nerg Plains','Conjurer','Conqueror','Defender','Finder','Pathfinder'];
    const elubShore = ['Elub Shore','Mystic','Pack','Protector','Scout','Vanquisher'];
    const jod = ['Jungle of Dread','Magma Carrier','Primal','Stonework Warrior'];
    const balacksCove = ["Balack's Cove",'Derr Lich','Elub Lich','Nerg Lich'];
    const dracano = ['Dracano','Draconic Warden','Whelping','Dragon'];
    const slushyShoreline = ['Slushy Shoreline','Chipper','Snow Slinger','Snow Sniper','Snow Soldier','Yeti'];
    const csc = ['Claw Shot City','Prospector','Ruffian'];
    const seasonalGarden = ['Seasonal Garden','Mystic Knight','Technic Knight'];
    const muridaeMarket = ['Muridae Market','Blacksmith','Mage Weaver','Market Guard','Spice Merchant'];
    const sandDunes = ['Sand Dunes','Sand Colossus','Scarab','Serpentine','Grubling Herder','Sand Pilgrim'];
    const livingGarden = ['Living Garden','Barkshell','Camofusion','Thorn','Twisted Hotcakes','Bark','Camoflower','Strawberry Hotcakes','Thistle'];
    const lostCity = ['Lost City','Cursed Librarian','Cursed Enchanter','Essence Guardian','Essence Collector','Ethereal Enchanter','Ethereal Librarian'];
    const allLocations = [meadow,bazaar,kGauntlet,training,meditation,pinacle,catacombs,fGrove,aRealm,ssh4,
                          derrDunes,nergPlains,elubShore,jod,dracano,balacksCove,slushyShoreline,csc,seasonalGarden,
                          muridaeMarket,livingGarden,lostCity,sandDunes];
    allLocations.forEach(function(array,e) {
        if (array.includes(mouseName)) {
            locationName = array[0];
        }
    })
    return locationName;
}

function convertNameToClass(locationName) {
    const debug = localStorage.getItem('ws.debug');
    let locationTag = "";
    if (locationName == 'Fiery Warpath') {
        locationTag = 'desert_warpath';
    } else if (locationName == 'Seasonal Garden') {
        locationTag = 'seasonal_garden';
    } else if (locationName == 'Meadow') {
        locationTag = 'meadow';
    } else if (locationName == 'Town of Gnawnia') {
        locationTag = 'town_of_gnawnia';
    } else if (locationName == 'Windmill') {
        locationTag = 'windmill';
    } else if (locationName == 'Harbour') {
        locationTag = 'harbour';
    } else if (locationName == 'Mountain') {
        locationTag = 'mountain';
    } else if (locationName == "King's Arms") {
        locationTag = 'kings_arms';
    } else if (locationName == 'Tournament Hall') {
        locationTag = 'tournament_hall';
    } else if (locationName == "King's Gauntlet") {
        locationTag = 'kings_gauntlet';
    } else if (locationName == 'Calm Clearing') {
        locationTag = 'calm_clearing';
    } else if (locationName == 'Great Gnarled Tree') {
        locationTag = 'great_gnarled_tree';
    } else if (locationName == 'Lagoon') {
        locationTag = 'lagoon';
    } else if (locationName == 'Laboratory') {
        locationTag = 'laboratory';
    } else if (locationName == 'Mousoleum') {
        locationTag = 'mousoleum';
    } else if (locationName == 'Town of Digby') {
        locationTag = 'town_of_digby';
    } else if (locationName == 'Bazaar') {
        locationTag = 'bazaar';
    } else if (locationName == 'Toxic Spill') {
        locationTag = 'pollution_outbreak';
    } else if (locationName == 'Training Grounds') {
        locationTag = 'training_grounds';
    } else if (locationName == 'Dojo') {
        locationTag = 'dojo';
    } else if (locationName == 'Meditation Room') {
        locationTag = 'meditation_room';
    } else if (locationName == 'Pinnacle Chamber') {
        locationTag = 'pinnacle_chamber';
    } else if (locationName == 'Catacombs') {
        locationTag = 'catacombs';
    } else if (locationName == 'Forbidden Grove') {
        locationTag = 'forbidden_grove';
    } else if (locationName == 'Acolyte Realm') {
        locationTag = 'acolyte_realm';
    } else if (locationName == 'Cape Clawed') {
        locationTag = 'cape_clawed';
    } else if (locationName == 'Elub Shore') {
        locationTag = 'elub_shore';
    } else if (locationName == 'Nerg Plains') {
        locationTag = 'nerg_plains';
    } else if (locationName == 'Derr Dunes') {
        locationTag = 'derr_dunes';
    } else if (locationName == 'Jungle of Dread') {
        locationTag = 'jungle_of_dread';
    } else if (locationName == 'Dracano') {
        locationTag = 'dracano';
    } else if (locationName == "Balack's Cove") {
        locationTag = 'balacks_cove';
    } else if (locationName == 'Claw Shot City') {
        locationTag = 'claw_shot_city';
    } else if (locationName == 'Gnawnian Express Station') {
        locationTag = 'train_station';
    } else if (locationName == 'Fort Rox') {
        locationTag = 'fort_rox';
    } else if (locationName == 'S.S. Huntington IV') {
        locationTag = 'ss_huntington_ii';
    } else if (locationName == "Zugzwang's Tower") {
        locationTag = 'zugzwang_tower';
    } else if (locationName == 'Crystal Library') {
        locationTag = 'zugzwang_library';
    } else if (locationName == 'Slushy Shoreline') {
        locationTag = 'slushy_shoreline';
    } else if (locationName == 'Iceberg') {
        locationTag = 'iceberg';
    } else if (locationName == 'Sunken City') {
        locationTag = 'sunken_city';
    } else if (locationName == 'Muridae Market') {
        locationTag = 'desert_city';
    } else if (locationName == 'Living Garden') {
        locationTag = 'desert_oasis';
    } else if (locationName == 'Twisted Garden') {
        locationTag = 'desert_oasis';
    } else if (locationName == 'Lost City') {
        locationTag = 'lost_city';
    } else if (locationName == 'Cursed City') {
        locationTag = 'lost_city';
    } else if (locationName == 'Sand Dunes') {
        locationTag = 'sand_dunes';
    } else if (locationName == 'Sand Crypts') {
        locationTag = 'sand_dunes';
    }
    if (debug == true) {
        console.log('Traveling to: ',locationName,locationTag);
    }
    return locationTag;
}

$(document).on('click', '#smashBtn', function() {
    if (confirm("Smash Your m400 Research Assignment?")) {
        // change this to something to test with
        let smashIt = 'essence_b_crafting_item';
        //Uncomment to make live
        //smashIt = 'library_m400_research_quest_item';
        hg.utils.UserInventory.smashItem(smashIt,1,function (resp) {;})
    }
})