// ==UserScript== // @name Magic Way Idle // @namespace http://tampermonkey.net/ // @version 2.4.6 // @description 法师助手 // @icon https://www.milkywayidle.com/favicon.svg // @match https://www.milkywayidle.com/* // @match http://www.ratatatata.ip-ddns.com:43967/* // @match http://111.170.18.193:40622/* // @run-at document-start // @grant GM_getValue // @grant GM_setValue // @grant GM_notification // @grant GM_xmlhttpRequest // @connect www.ratatatata.ip-ddns.com // @connect 111.170.18.193 // @require https://cdnjs.cloudflare.com/ajax/libs/mathjs/12.4.2/math.js // @downloadURL https://update.greasyfork.icu/scripts/511240/Magic%20Way%20Idle.user.js // @updateURL https://update.greasyfork.icu/scripts/511240/Magic%20Way%20Idle.meta.js // ==/UserScript== (function () { // 全局URL链接配置 const global_url_config={ market:{ // 市场API本地备份 LOCAL_BACKUP : `{"time":1734029101,"market":{"Amber":{"ask":21000,"bid":20500},"Amethyst":{"ask":31000,"bid":29500},"Apple":{"ask":12,"bid":8},"Apple Gummy":{"ask":13,"bid":10},"Apple Yogurt":{"ask":350,"bid":150},"Aqua Arrow":{"ask":31000,"bid":28500},"Aqua Essence":{"ask":24,"bid":18},"Arabica Coffee Bean":{"ask":190,"bid":170},"Arcane Bow":{"ask":700000,"bid":110000},"Arcane Crossbow":{"ask":620000,"bid":480000},"Arcane Fire Staff":{"ask":480000,"bid":180000},"Arcane Log":{"ask":470,"bid":410},"Arcane Lumber":{"ask":1950,"bid":1750},"Arcane Nature Staff":{"ask":350000,"bid":170000},"Arcane Water Staff":{"ask":540000,"bid":84000},"Artisan Tea":{"ask":2425,"bid":2200},"Attack Coffee":{"ask":1500,"bid":400},"Azure Boots":{"ask":165000,"bid":8200},"Azure Brush":{"ask":36000,"bid":7000},"Azure Buckler":{"ask":37750,"bid":-1},"Azure Bulwark":{"ask":35000,"bid":-1},"Azure Cheese":{"ask":740,"bid":680},"Azure Chisel":{"ask":145000,"bid":-1},"Azure Enhancer":{"ask":62000,"bid":20000},"Azure Gauntlets":{"ask":-1,"bid":10500},"Azure Hammer":{"ask":82000,"bid":7000},"Azure Hatchet":{"ask":96000,"bid":2050},"Azure Helmet":{"ask":62000,"bid":12000},"Azure Mace":{"ask":84000,"bid":30000},"Azure Milk":{"ask":190,"bid":160},"Azure Needle":{"ask":155000,"bid":2050},"Azure Plate Body":{"ask":60000,"bid":24500},"Azure Plate Legs":{"ask":275000,"bid":2400},"Azure Pot":{"ask":140000,"bid":2100},"Azure Shears":{"ask":290000,"bid":2050},"Azure Spatula":{"ask":52000,"bid":2100},"Azure Spear":{"ask":82000,"bid":42000},"Azure Sword":{"ask":84000,"bid":3500},"Bamboo Boots":{"ask":26500,"bid":8000},"Bamboo Branch":{"ask":68,"bid":30},"Bamboo Fabric":{"ask":215,"bid":200},"Bamboo Gloves":{"ask":34000,"bid":10500},"Bamboo Hat":{"ask":42000,"bid":12000},"Bamboo Robe Bottoms":{"ask":45000,"bid":22000},"Bamboo Robe Top":{"ask":64000,"bid":5200},"Bear Essence":{"ask":115,"bid":100},"Beast Boots":{"ask":260000,"bid":8000},"Beast Bracers":{"ask":100000,"bid":10500},"Beast Chaps":{"ask":400000,"bid":15000},"Beast Hide":{"ask":24,"bid":20},"Beast Hood":{"ask":160000,"bid":12000},"Beast Leather":{"ask":620,"bid":580},"Beast Tunic":{"ask":300000,"bid":18000},"Berserk":{"ask":247500,"bid":215000},"Birch Bow":{"ask":28500,"bid":1050},"Birch Crossbow":{"ask":23500,"bid":1550},"Birch Fire Staff":{"ask":34000,"bid":800},"Birch Log":{"ask":49,"bid":38},"Birch Lumber":{"ask":560,"bid":270},"Birch Nature Staff":{"ask":34000,"bid":840},"Birch Water Staff":{"ask":34000,"bid":760},"Black Bear Fluff":{"ask":70000,"bid":56000},"Black Bear Shoes":{"ask":400000,"bid":100000},"Black Tea Leaf":{"ask":18,"bid":16},"Blackberry":{"ask":84,"bid":69},"Blackberry Cake":{"ask":520,"bid":285},"Blackberry Donut":{"ask":680,"bid":295},"Blessed Tea":{"ask":2550,"bid":1900},"Blueberry":{"ask":43,"bid":39.5},"Blueberry Cake":{"ask":680,"bid":295},"Blueberry Donut":{"ask":255,"bid":125},"Brewing Tea":{"ask":475,"bid":20},"Burble Brush":{"ask":100000,"bid":5200},"Burble Buckler":{"ask":420000,"bid":7600},"Burble Bulwark":{"ask":-1,"bid":18000},"Burble Chisel":{"ask":270000,"bid":25000},"Burble Enhancer":{"ask":450000,"bid":40000},"Burble Gauntlets":{"ask":-1,"bid":5800},"Burble Hatchet":{"ask":80000,"bid":40000},"Burble Helmet":{"ask":185000,"bid":7000},"Burble Mace":{"ask":-1,"bid":54000},"Burble Needle":{"ask":320000,"bid":26500},"Burble Plate Body":{"ask":170000,"bid":6400},"Burble Pot":{"ask":300000,"bid":27000},"Burble Shears":{"ask":-1,"bid":40000},"Burble Spatula":{"ask":115000,"bid":50000},"Burble Sword":{"ask":115000,"bid":6600},"Burble Tea Leaf":{"ask":34,"bid":25},"Cedar Bow":{"ask":-1,"bid":3500},"Cedar Fire Staff":{"ask":88000,"bid":-1},"Cedar Log":{"ask":150,"bid":122.5},"Cedar Lumber":{"ask":780,"bid":660},"Cedar Water Staff":{"ask":88000,"bid":2600},"Centaur Boots":{"ask":1000000,"bid":-1},"Centaur Hoof":{"ask":135000,"bid":125000},"Cheese Boots":{"ask":4200,"bid":120},"Cheese Brush":{"ask":4200,"bid":-1},"Cheese Buckler":{"ask":1200000,"bid":-1},"Cheese Chisel":{"ask":5600,"bid":120},"Cheese Enhancer":{"ask":5600,"bid":120},"Cheese Gauntlets":{"ask":28500,"bid":64},"Cheese Hammer":{"ask":5800,"bid":120},"Cheese Helmet":{"ask":160000,"bid":-1},"Cheese Mace":{"ask":10500,"bid":145},"Cheese Plate Body":{"ask":16500,"bid":145},"Cheese Plate Legs":{"ask":9000,"bid":115},"Cheese Pot":{"ask":6000,"bid":-1},"Cheese Spatula":{"ask":5800,"bid":120},"Cheese Spear":{"ask":15500,"bid":700},"Cheese Sword":{"ask":5000,"bid":155},"Cleave":{"ask":76000,"bid":43000},"Cocoon":{"ask":225,"bid":185},"Coin":{"ask":-1,"bid":-1},"Cotton":{"ask":81,"bid":42},"Cotton Boots":{"ask":1950,"bid":-1},"Cotton Fabric":{"ask":360,"bid":245},"Cotton Hat":{"ask":4900,"bid":-1},"Cotton Robe Bottoms":{"ask":5400,"bid":-1},"Cotton Robe Top":{"ask":-1,"bid":-1},"Crab Pincer":{"ask":8200,"bid":6800},"Crafting Tea":{"ask":1150,"bid":185},"Crimson Boots":{"ask":-1,"bid":6800},"Crimson Buckler":{"ask":-1,"bid":72000},"Crimson Bulwark":{"ask":120000,"bid":-1},"Crimson Cheese":{"ask":900,"bid":830},"Crimson Enhancer":{"ask":175000,"bid":52000},"Crimson Gauntlets":{"ask":190000,"bid":-1},"Crimson Hammer":{"ask":400000,"bid":54000},"Crimson Helmet":{"ask":150000,"bid":90000},"Crimson Mace":{"ask":160000,"bid":80000},"Crimson Milk":{"ask":290,"bid":275},"Crimson Plate Body":{"ask":250000,"bid":100000},"Crimson Plate Legs":{"ask":-1,"bid":80000},"Crimson Pot":{"ask":175000,"bid":-1},"Crimson Spatula":{"ask":140000,"bid":50000},"Crimson Spear":{"ask":-1,"bid":110000},"Crimson Sword":{"ask":680000,"bid":14000},"Crushed Amber":{"ask":1350,"bid":960},"Crushed Amethyst":{"ask":2400,"bid":1850},"Crushed Garnet":{"ask":1850,"bid":1550},"Crushed Moonstone":{"ask":3250,"bid":2650},"Crushed Pearl":{"ask":1650,"bid":760},"Cupcake":{"ask":400,"bid":225},"Donut":{"ask":470,"bid":105},"Dragon Fruit":{"ask":200,"bid":170},"Dragon Fruit Gummy":{"ask":430,"bid":360},"Earrings Of Armor":{"ask":8600000,"bid":4600000},"Earrings Of Gathering":{"ask":16000000,"bid":4600000},"Earrings Of Regeneration":{"ask":9200000,"bid":5900000},"Earrings Of Resistance":{"ask":-1,"bid":4550000},"Efficiency Tea":{"ask":1150,"bid":920},"Elemental Affinity":{"ask":185000,"bid":160000},"Emp Tea Leaf":{"ask":520,"bid":460},"Enhancing Tea":{"ask":1100,"bid":490},"Excelsa Coffee Bean":{"ask":520,"bid":475},"Eyessence":{"ask":94,"bid":82},"Fieriosa Coffee Bean":{"ask":580,"bid":480},"Fireball":{"ask":11000,"bid":10000},"Flame Arrow":{"ask":32000,"bid":25000},"Flame Blast":{"ask":90000,"bid":88000},"Flaming Cloth":{"ask":56000,"bid":42000},"Flaming Robe Top":{"ask":260000,"bid":180000},"Flax":{"ask":100,"bid":66},"Foraging Tea":{"ask":660,"bid":195},"Garnet":{"ask":30500,"bid":29500},"Gathering Tea":{"ask":700,"bid":470},"Giant Pouch":{"ask":6000000,"bid":5200000},"Ginkgo Bow":{"ask":540000,"bid":30000},"Ginkgo Crossbow":{"ask":200000,"bid":95000},"Ginkgo Log":{"ask":182.5,"bid":105},"Ginkgo Lumber":{"ask":920,"bid":760},"Ginkgo Nature Staff":{"ask":86000,"bid":15000},"Gobo Boomstick":{"ask":80000,"bid":71000},"Gobo Boots":{"ask":60000,"bid":8000},"Gobo Bracers":{"ask":86000,"bid":-1},"Gobo Essence":{"ask":98,"bid":88},"Gobo Hide":{"ask":13.5,"bid":12},"Gobo Hood":{"ask":93000,"bid":8200},"Gobo Shooter":{"ask":82000,"bid":70000},"Gobo Slasher":{"ask":84000,"bid":72000},"Gobo Smasher":{"ask":82000,"bid":72000},"Gobo Tunic":{"ask":90000,"bid":12000},"Goggles":{"ask":202500,"bid":125000},"Golem Essence":{"ask":260,"bid":240},"Granite Bludgeon":{"ask":18500000,"bid":-1},"Green Tea Leaf":{"ask":20,"bid":15},"Grizzly Bear Fluff":{"ask":68000,"bid":60000},"Gummy":{"ask":140,"bid":-1},"Heal":{"ask":76000,"bid":58000},"Holy Boots":{"ask":460000,"bid":-1},"Holy Buckler":{"ask":600000,"bid":370000},"Holy Bulwark":{"ask":680000,"bid":310000},"Holy Cheese":{"ask":1750,"bid":1650},"Holy Enhancer":{"ask":460000,"bid":-1},"Holy Gauntlets":{"ask":470000,"bid":205000},"Holy Hammer":{"ask":440000,"bid":400000},"Holy Helmet":{"ask":280000,"bid":-1},"Holy Mace":{"ask":580000,"bid":510000},"Holy Milk":{"ask":560,"bid":540},"Holy Plate Body":{"ask":1000000,"bid":310000},"Holy Plate Legs":{"ask":700000,"bid":400000},"Holy Pot":{"ask":520000,"bid":295000},"Holy Spatula":{"ask":400000,"bid":-1},"Holy Spear":{"ask":600000,"bid":400000},"Holy Sword":{"ask":460000,"bid":400000},"Icy Cloth":{"ask":52000,"bid":44000},"Icy Robe Bottoms":{"ask":200000,"bid":120000},"Icy Robe Top":{"ask":540000,"bid":185000},"Jade":{"ask":31000,"bid":29500},"Jungle Essence":{"ask":70,"bid":46},"Large Artisan's Crate":{"ask":-1,"bid":-1},"Large Pouch":{"ask":500000,"bid":360000},"Large Treasure Chest":{"ask":-1,"bid":-1},"Liberica Coffee Bean":{"ask":395,"bid":370},"Linen Boots":{"ask":33000,"bid":7000},"Linen Gloves":{"ask":36000,"bid":2800},"Linen Hat":{"ask":78000,"bid":5600},"Linen Robe Bottoms":{"ask":63000,"bid":10000},"Living Granite":{"ask":520000,"bid":480000},"Log":{"ask":72,"bid":42},"Lucky Coffee":{"ask":1750,"bid":1350},"Magic Coffee":{"ask":700,"bid":660},"Magnet":{"ask":320000,"bid":205000},"Magnifying Glass":{"ask":460000,"bid":425000},"Maim":{"ask":230000,"bid":125000},"Marsberry":{"ask":155,"bid":135},"Marsberry Donut":{"ask":790,"bid":700},"Medium Artisan's Crate":{"ask":-1,"bid":-1},"Medium Meteorite Cache":{"ask":-1,"bid":-1},"Medium Treasure Chest":{"ask":-1,"bid":-1},"Milk":{"ask":42,"bid":35},"Milking Tea":{"ask":500,"bid":205},"Minor Heal":{"ask":10500,"bid":1600},"Mooberry":{"ask":150,"bid":110},"Mooberry Cake":{"ask":930,"bid":800},"Mooberry Donut":{"ask":620,"bid":500},"Moonstone":{"ask":46000,"bid":45000},"Necklace Of Efficiency":{"ask":17000000,"bid":7800000},"Necklace Of Wisdom":{"ask":30000000,"bid":8000000},"Orange Gummy":{"ask":32,"bid":22},"Orange Yogurt":{"ask":600,"bid":300},"Panda Gloves":{"ask":430000,"bid":205000},"Peach":{"ask":62,"bid":44},"Peach Gummy":{"ask":282.5,"bid":220},"Pearl":{"ask":14000,"bid":13000},"Pierce":{"ask":-1,"bid":-1},"Pincer Gloves":{"ask":33000,"bid":13000},"Plum":{"ask":130,"bid":110},"Plum Yogurt":{"ask":720,"bid":410},"Poke":{"ask":4300,"bid":2050},"Power Coffee":{"ask":990,"bid":680},"Precision":{"ask":54000,"bid":52000},"Purpleheart Bow":{"ask":105000,"bid":31000},"Purpleheart Crossbow":{"ask":98000,"bid":45000},"Purpleheart Fire Staff":{"ask":880000,"bid":15000},"Purpleheart Lumber":{"ask":780,"bid":700},"Purpleheart Nature Staff":{"ask":100000,"bid":50000},"Purpleheart Water Staff":{"ask":-1,"bid":-1},"Quick Shot":{"ask":4100,"bid":2050},"Radiant Fabric":{"ask":2625,"bid":2475},"Radiant Fiber":{"ask":580,"bid":540},"Radiant Gloves":{"ask":185000,"bid":125000},"Radiant Robe Bottoms":{"ask":430000,"bid":360000},"Radiant Robe Top":{"ask":600000,"bid":330000},"Rain Of Arrows":{"ask":150000,"bid":145000},"Rainbow Brush":{"ask":500000,"bid":-1},"Rainbow Buckler":{"ask":-1,"bid":62000},"Rainbow Bulwark":{"ask":400000,"bid":105000},"Rainbow Chisel":{"ask":240000,"bid":60000},"Rainbow Enhancer":{"ask":222500,"bid":31000},"Rainbow Gauntlets":{"ask":370000,"bid":132500},"Rainbow Hatchet":{"ask":245000,"bid":-1},"Rainbow Helmet":{"ask":290000,"bid":78000},"Rainbow Mace":{"ask":380000,"bid":220000},"Rainbow Needle":{"ask":220000,"bid":58000},"Rainbow Plate Body":{"ask":290000,"bid":30000},"Rainbow Plate Legs":{"ask":275000,"bid":155000},"Rainbow Shears":{"ask":310000,"bid":200000},"Rainbow Spatula":{"ask":235000,"bid":86000},"Rainbow Spear":{"ask":500000,"bid":-1},"Ranged Coffee":{"ask":770,"bid":640},"Ranger Necklace":{"ask":-1,"bid":7600000},"Red Tea Leaf":{"ask":54,"bid":50},"Redwood Crossbow":{"ask":235000,"bid":120000},"Redwood Fire Staff":{"ask":200000,"bid":100000},"Redwood Log":{"ask":46,"bid":36},"Redwood Nature Staff":{"ask":300000,"bid":100000},"Redwood Water Staff":{"ask":200000,"bid":100000},"Reptile Boots":{"ask":33000,"bid":9600},"Reptile Chaps":{"ask":29000,"bid":2000},"Reptile Hide":{"ask":150,"bid":33},"Reptile Hood":{"ask":20500,"bid":760},"Reptile Tunic":{"ask":27000,"bid":1250},"Ring Of Armor":{"ask":8600000,"bid":4500000},"Ring Of Gathering":{"ask":20000000,"bid":4500000},"Ring Of Regeneration":{"ask":9600000,"bid":4500000},"Ring Of Resistance":{"ask":8400000,"bid":4500000},"Robusta Coffee Bean":{"ask":295,"bid":205},"Rough Bracers":{"ask":-1,"bid":-1},"Rough Chaps":{"ask":14500,"bid":115},"Rough Hide":{"ask":115,"bid":76},"Rough Leather":{"ask":390,"bid":370},"Rough Tunic":{"ask":10000,"bid":-1},"Scratch":{"ask":5000,"bid":2200},"Silk Boots":{"ask":80000,"bid":20000},"Silk Fabric":{"ask":1525,"bid":1300},"Silk Gloves":{"ask":90000,"bid":30000},"Silk Robe Bottoms":{"ask":260000,"bid":15000},"Silk Robe Top":{"ask":200000,"bid":18000},"Smack":{"ask":4050,"bid":2150},"Small Meteorite Cache":{"ask":-1,"bid":-1},"Small Pouch":{"ask":37500,"bid":-1},"Snail Shell":{"ask":6600,"bid":6000},"Snail Shell Helmet":{"ask":30000,"bid":13000},"Snake Fang":{"ask":3100,"bid":2150},"Sorcerer Boots":{"ask":460000,"bid":165000},"Sorcerer Essence":{"ask":122.5,"bid":110},"Sorcerer's Sole":{"ask":75000,"bid":72000},"Spaceberry Cake":{"ask":1650,"bid":1350},"Spaceberry Donut":{"ask":980,"bid":880},"Spacia Coffee Bean":{"ask":860,"bid":800},"Stalactite Shard":{"ask":495000,"bid":470000},"Stalactite Spear":{"ask":-1,"bid":8000000},"Stamina Coffee":{"ask":540,"bid":250},"Star Fruit":{"ask":410,"bid":380},"Star Fruit Gummy":{"ask":880,"bid":860},"Star Fruit Yogurt":{"ask":1400,"bid":1350},"Strawberry Cake":{"ask":740,"bid":46},"Strawberry Donut":{"ask":285,"bid":40},"Stunning Blow":{"ask":267500,"bid":185000},"Super Attack Coffee":{"ask":3700,"bid":2100},"Super Brewing Tea":{"ask":3400,"bid":-1},"Super Cheesesmithing Tea":{"ask":4350,"bid":2000},"Super Crafting Tea":{"ask":5000,"bid":3800},"Super Defense Coffee":{"ask":3800,"bid":2400},"Super Enhancing Tea":{"ask":4100,"bid":3400},"Super Foraging Tea":{"ask":3900,"bid":1450},"Super Magic Coffee":{"ask":4200,"bid":4100},"Super Milking Tea":{"ask":6400,"bid":-1},"Super Power Coffee":{"ask":4600,"bid":4200},"Super Stamina Coffee":{"ask":2800,"bid":2400},"Super Tailoring Tea":{"ask":7200,"bid":-1},"Super Woodcutting Tea":{"ask":3900,"bid":2250},"Sweep":{"ask":98000,"bid":78000},"Swiftness Coffee":{"ask":2400,"bid":1700},"Tailoring Tea":{"ask":640,"bid":400},"Tome Of The Elements":{"ask":1000000,"bid":760000},"Toughness":{"ask":56000,"bid":52000},"Toxic Pollen":{"ask":105000,"bid":80000},"Turtle Shell Body":{"ask":44000,"bid":-1},"Turtle Shell Legs":{"ask":170000,"bid":-1},"Twilight Essence":{"ask":275,"bid":240},"Umbral Bracers":{"ask":165000,"bid":54000},"Umbral Chaps":{"ask":350000,"bid":39000},"Umbral Hide":{"ask":260,"bid":210},"Umbral Leather":{"ask":2075,"bid":1900},"Umbral Tunic":{"ask":350000,"bid":45000},"Vampire Fang":{"ask":500000,"bid":470000},"Vampirism":{"ask":48000,"bid":22500},"Verdant Boots":{"ask":24500,"bid":-1},"Verdant Brush":{"ask":-1,"bid":1150},"Verdant Bulwark":{"ask":28750,"bid":-1},"Verdant Cheese":{"ask":520,"bid":440},"Verdant Chisel":{"ask":560000,"bid":12000},"Verdant Gauntlets":{"ask":98000,"bid":1600},"Verdant Hammer":{"ask":33000,"bid":-1},"Verdant Hatchet":{"ask":140000,"bid":600},"Verdant Mace":{"ask":38000,"bid":11500},"Verdant Milk":{"ask":120,"bid":98},"Verdant Needle":{"ask":47000,"bid":12000},"Verdant Plate Legs":{"ask":98000,"bid":2600},"Verdant Pot":{"ask":90000,"bid":600},"Verdant Shears":{"ask":-1,"bid":-1},"Verdant Spear":{"ask":38000,"bid":-1},"Verdant Sword":{"ask":38000,"bid":-1},"Vision Helmet":{"ask":182500,"bid":56000},"Water Strike":{"ask":8700,"bid":8200},"Werewolf Claw":{"ask":580000,"bid":470000},"Werewolf Slasher":{"ask":12000000,"bid":6600000},"Wisdom Coffee":{"ask":1350,"bid":1250},"Wisdom Tea":{"ask":890,"bid":820},"Wizard Necklace":{"ask":15500000,"bid":7600000},"Wooden Bow":{"ask":19500,"bid":195},"Wooden Crossbow":{"ask":9100,"bid":145},"Wooden Fire Staff":{"ask":11500,"bid":145},"Wooden Water Staff":{"ask":2450,"bid":155},"Yogurt":{"ask":1550,"bid":200},"Burble Boots":{"ask":96000,"bid":35000},"Burble Cheese":{"ask":1200,"bid":900},"Burble Hammer":{"ask":350000,"bid":-1},"Burble Milk":{"ask":270,"bid":207.5},"Cedar Nature Staff":{"ask":88000,"bid":-1},"Cheese":{"ask":240,"bid":195},"Cheese Bulwark":{"ask":-1,"bid":-1},"Cheese Hatchet":{"ask":5800,"bid":120},"Cheese Needle":{"ask":6000,"bid":2950},"Cheese Shears":{"ask":3600,"bid":-1},"Cheesesmithing Tea":{"ask":840,"bid":400},"Cooking Tea":{"ask":430,"bid":26},"Cotton Gloves":{"ask":2650,"bid":370},"Cowbell":{"ask":-1,"bid":-1},"Crimson Brush":{"ask":109999.5,"bid":15500},"Crimson Chisel":{"ask":440000,"bid":30000},"Crimson Hatchet":{"ask":190000,"bid":45000},"Crimson Shears":{"ask":165000,"bid":-1},"Critical Coffee":{"ask":3100,"bid":2350},"Crushed Jade":{"ask":2250,"bid":1750},"Defense Coffee":{"ask":680,"bid":370},"Dragon Fruit Yogurt":{"ask":980,"bid":920},"Flaming Robe Bottoms":{"ask":280000,"bid":120000},"Frenzy":{"ask":175000,"bid":170000},"Gobo Leather":{"ask":540,"bid":370},"Holy Chisel":{"ask":460000,"bid":400000},"Holy Hatchet":{"ask":480000,"bid":410000},"Holy Needle":{"ask":590000,"bid":400000},"Holy Shears":{"ask":560000,"bid":410000},"Ice Spear":{"ask":29500,"bid":27250},"Intelligence Coffee":{"ask":580,"bid":410},"Linen Fabric":{"ask":340,"bid":285},"Linen Robe Top":{"ask":72000,"bid":10000},"Lumber":{"ask":370,"bid":105},"Mirror Of Protection":{"ask":9200000,"bid":8500000},"Moolong Tea Leaf":{"ask":33,"bid":32},"Orange":{"ask":13,"bid":7},"Panda Fluff":{"ask":74000,"bid":54000},"Peach Yogurt":{"ask":720,"bid":680},"Plum Gummy":{"ask":105,"bid":70},"Processing Tea":{"ask":2150,"bid":1850},"Purpleheart Log":{"ask":160,"bid":120},"Radiant Boots":{"ask":220000,"bid":125000},"Radiant Hat":{"ask":380000,"bid":295000},"Rainbow Boots":{"ask":207500,"bid":14500},"Rainbow Cheese":{"ask":1250,"bid":1125},"Rainbow Hammer":{"ask":200000,"bid":50000},"Rainbow Milk":{"ask":310,"bid":290},"Rainbow Pot":{"ask":250000,"bid":70000},"Rainbow Sword":{"ask":430000,"bid":230000},"Redwood Bow":{"ask":-1,"bid":120000},"Redwood Lumber":{"ask":560,"bid":480},"Reptile Bracers":{"ask":42000,"bid":-1},"Reptile Leather":{"ask":480,"bid":370},"Ring Of Rare Find":{"ask":-1,"bid":4500000},"Rough Boots":{"ask":1500,"bid":-1},"Rough Hood":{"ask":10000,"bid":-1},"Shard Of Protection":{"ask":50000,"bid":49000},"Silk Hat":{"ask":130000,"bid":11000},"Small Artisan's Crate":{"ask":-1,"bid":-1},"Small Treasure Chest":{"ask":-1,"bid":-1},"Snake Fang Dirk":{"ask":13000,"bid":5200},"Spaceberry":{"ask":185,"bid":170},"Spike Shell":{"ask":68000,"bid":25000},"Star Fragment":{"ask":14000,"bid":13000},"Strawberry":{"ask":100,"bid":82},"Super Cooking Tea":{"ask":7400,"bid":1650},"Super Intelligence Coffee":{"ask":2850,"bid":2000},"Super Ranged Coffee":{"ask":4200,"bid":4100},"Swamp Essence":{"ask":42,"bid":36},"Tome Of Healing":{"ask":105000,"bid":86000},"Turtle Shell":{"ask":10000,"bid":8200},"Umbral Boots":{"ask":165000,"bid":54000},"Umbral Hood":{"ask":295000,"bid":220000},"Vampire Fang Dirk":{"ask":10000000,"bid":5600000},"Verdant Buckler":{"ask":-1,"bid":-1},"Verdant Enhancer":{"ask":88000,"bid":15000},"Verdant Helmet":{"ask":98000,"bid":1600},"Verdant Spatula":{"ask":145000,"bid":-1},"Vision Shield":{"ask":600000,"bid":150000},"Wheat":{"ask":33.5,"bid":30.5},"Woodcutting Tea":{"ask":780,"bid":360},"Wooden Nature Staff":{"ask":170000,"bid":180},"Cedar Crossbow":{"ask":48500,"bid":25500},"Earrings Of Rare Find":{"ask":-1,"bid":4600000},"Egg":{"ask":38,"bid":31.5},"Entangle":{"ask":12000,"bid":11500},"Fighter Necklace":{"ask":16000000,"bid":7600000},"Gator Vest":{"ask":28500,"bid":16000},"Ginkgo Fire Staff":{"ask":200000,"bid":20000},"Gobo Chaps":{"ask":78000,"bid":31000},"Gobo Stabber":{"ask":89000,"bid":72000},"Gourmet Tea":{"ask":620,"bid":520},"Grizzly Bear Shoes":{"ask":460000,"bid":280000},"Holy Brush":{"ask":520000,"bid":400000},"Large Meteorite Cache":{"ask":-1,"bid":-1},"Magnetic Gloves":{"ask":4000000,"bid":1000000},"Marsberry Cake":{"ask":1150,"bid":980},"Medium Pouch":{"ask":100000,"bid":-1},"Polar Bear Fluff":{"ask":98000,"bid":74000},"Verdant Plate Body":{"ask":58000,"bid":660},"Ginkgo Water Staff":{"ask":190000,"bid":15000},"Polar Bear Shoes":{"ask":760000,"bid":450000},"Sugar":{"ask":9,"bid":8},"Crimson Needle":{"ask":430000,"bid":37000},"Burble Plate Legs":{"ask":92000,"bid":6400},"Burble Spear":{"ask":190000,"bid":52000},"Arcane Shield":{"ask":217500,"bid":120000},"Birch Shield":{"ask":62000,"bid":500},"Cedar Shield":{"ask":100000,"bid":4000},"Ginkgo Shield":{"ask":580000,"bid":-1},"Purpleheart Shield":{"ask":200000,"bid":30000},"Redwood Shield":{"ask":200000,"bid":52000},"Sighted Bracers":{"ask":700000,"bid":-1},"Spiked Bulwark":{"ask":8600000,"bid":-1},"Wooden Shield":{"ask":2450,"bid":-1},"Advanced Task Ring":{"ask":-1,"bid":-1},"Basic Task Ring":{"ask":-1,"bid":-1},"Expert Task Ring":{"ask":-1,"bid":-1},"Purple's Gift":{"ask":-1,"bid":-1},"Task Crystal":{"ask":-1,"bid":-1},"Task Token":{"ask":-1,"bid":-1},"Abyssal Essence":{"ask":252.5,"bid":240},"Channeling Coffee":{"ask":2575,"bid":2200},"Chrono Gloves":{"ask":7200000,"bid":-1},"Chrono Sphere":{"ask":600000,"bid":520000},"Collector's Boots":{"ask":3200000,"bid":2450000},"Colossus Core":{"ask":890000,"bid":820000},"Colossus Plate Body":{"ask":8400000,"bid":1500000},"Colossus Plate Legs":{"ask":-1,"bid":1200000},"Demonic Core":{"ask":880000,"bid":860000},"Demonic Plate Body":{"ask":10000000,"bid":5200000},"Demonic Plate Legs":{"ask":12000000,"bid":3000000},"Elusiveness":{"ask":32000,"bid":23500},"Enchanted Gloves":{"ask":6600000,"bid":5000000},"Eye Of The Watcher":{"ask":560000,"bid":500000},"Eye Watch":{"ask":5800000,"bid":4900000},"Firestorm":{"ask":360000,"bid":350000},"Fluffy Red Hat":{"ask":6800000,"bid":4500000},"Frost Sphere":{"ask":480000,"bid":430000},"Frost Staff":{"ask":9800000,"bid":6000000},"Frost Surge":{"ask":320000,"bid":300000},"Gobo Defender":{"ask":560000,"bid":400000},"Gobo Rag":{"ask":340000,"bid":265000},"Infernal Battlestaff":{"ask":13000000,"bid":-1},"Infernal Ember":{"ask":580000,"bid":490000},"Luna Robe Bottoms":{"ask":1950000,"bid":96000},"Luna Robe Top":{"ask":2350000,"bid":-1},"Luna Wing":{"ask":200000,"bid":140000},"Marine Chaps":{"ask":370000,"bid":150000},"Marine Scale":{"ask":50000,"bid":26000},"Marine Tunic":{"ask":560000,"bid":175000},"Nature's Veil":{"ask":690000,"bid":500000},"Puncture":{"ask":130000,"bid":115000},"Red Chef's Hat":{"ask":4800000,"bid":4000000},"Red Panda Fluff":{"ask":470000,"bid":440000},"Revenant Anima":{"ask":880000,"bid":860000},"Revenant Chaps":{"ask":7600000,"bid":4300000},"Revenant Tunic":{"ask":9400000,"bid":6400000},"Shoebill Feather":{"ask":76000,"bid":41000},"Shoebill Shoes":{"ask":-1,"bid":350000},"Silencing Shot":{"ask":130000,"bid":125000},"Soul Fragment":{"ask":500000,"bid":480000},"Soul Hunter Crossbow":{"ask":4999999.5,"bid":2700000},"Steady Shot":{"ask":150000,"bid":145000},"Treant Bark":{"ask":48000,"bid":31000},"Treant Shield":{"ask":210000,"bid":105000},"Vampiric Bow":{"ask":-1,"bid":3600000},"Watchful Relic":{"ask":9800000,"bid":4500000},"Bag Of 10 Cowbells":{"ask":500000,"bid":460000},"Aqua Aura":{"ask":1300000,"bid":1225000},"Critical Aura":{"ask":6000000,"bid":2850000},"Fierce Aura":{"ask":6400000,"bid":3700000},"Flame Aura":{"ask":1650000,"bid":1450000},"Insanity":{"ask":3400000,"bid":2700000},"Invincible":{"ask":1600000,"bid":1250000},"Provoke":{"ask":76000,"bid":23500},"Quick Aid":{"ask":200000,"bid":190000},"Rejuvenate":{"ask":320000,"bid":270000},"Revive":{"ask":1350000,"bid":1175000},"Speed Aura":{"ask":2950000,"bid":2075000},"Sylvan Aura":{"ask":3100000,"bid":1600000},"Taunt":{"ask":64000,"bid":54000},"Acrobatic Hood":{"ask":50000000,"bid":40000000},"Acrobat's Ribbon":{"ask":3400000,"bid":3300000},"Bishop's Codex":{"ask":81000000,"bid":50000000},"Bishop's Scroll":{"ask":5800000,"bid":5200000},"Blue Key Fragment":{"ask":360000,"bid":330000},"Brown Key Fragment":{"ask":425000,"bid":410000},"Burning Key Fragment":{"ask":1350000,"bid":1300000},"Chaotic Chain":{"ask":5200000,"bid":4900000},"Chaotic Flail":{"ask":-1,"bid":100000000},"Chimerical Chest":{"ask":-1,"bid":-1},"Chimerical Essence":{"ask":400,"bid":380},"Chimerical Key":{"ask":-1,"bid":-1},"Chimerical Quiver":{"ask":-1,"bid":-1},"Crippling Slash":{"ask":54000,"bid":26000},"Cursed Ball":{"ask":3500000,"bid":3000000},"Cursed Bow":{"ask":-1,"bid":-1},"Dark Key Fragment":{"ask":920000,"bid":800000},"Dodocamel Gauntlets":{"ask":-1,"bid":16500000},"Dodocamel Plume":{"ask":3300000,"bid":3100000},"Earrings Of Threat":{"ask":-1,"bid":-1},"Enchanted Chest":{"ask":-1,"bid":-1},"Enchanted Cloak":{"ask":-1,"bid":-1},"Enchanted Essence":{"ask":1600,"bid":1500},"Enchanted Key":{"ask":-1,"bid":-1},"Green Key Fragment":{"ask":285000,"bid":255000},"Griffin Chaps":{"ask":-1,"bid":-1},"Griffin Leather":{"ask":940000,"bid":560000},"Griffin Tunic":{"ask":-1,"bid":-1},"Impale":{"ask":31000,"bid":26750},"Jackalope Antler":{"ask":1850000,"bid":1650000},"Jackalope Staff":{"ask":35000000,"bid":-1},"Knight's Aegis":{"ask":90000000,"bid":-1},"Knight's Ingot":{"ask":5400000,"bid":5100000},"Magician's Cloth":{"ask":3700000,"bid":3300000},"Magician's Hat":{"ask":-1,"bid":45000000},"Mana Spring":{"ask":205000,"bid":160000},"Manticore Shield":{"ask":-1,"bid":12750000},"Manticore Sting":{"ask":1850000,"bid":1700000},"Orange Key Fragment":{"ask":290000,"bid":280000},"Penetrating Shot":{"ask":210000,"bid":200000},"Penetrating Strike":{"ask":42000,"bid":36000},"Pestilent Shot":{"ask":31000,"bid":27000},"Purple Key Fragment":{"ask":285000,"bid":265000},"Regal Jewel":{"ask":5800000,"bid":5400000},"Regal Sword":{"ask":280000000,"bid":145000000},"Ring Of Threat":{"ask":-1,"bid":-1},"Royal Cloth":{"ask":5800000,"bid":5400000},"Royal Fire Robe Bottoms":{"ask":66000000,"bid":46000000},"Royal Fire Robe Top":{"ask":-1,"bid":60000000},"Royal Nature Robe Bottoms":{"ask":-1,"bid":47000000},"Royal Nature Robe Top":{"ask":-1,"bid":50000000},"Royal Water Robe Bottoms":{"ask":72000000,"bid":38000000},"Royal Water Robe Top":{"ask":-1,"bid":58000000},"Sinister Cape":{"ask":-1,"bid":-1},"Sinister Chest":{"ask":-1,"bid":-1},"Sinister Essence":{"ask":750,"bid":720},"Sinister Key":{"ask":-1,"bid":-1},"Smoke Burst":{"ask":52000,"bid":20500},"Stone Key Fragment":{"ask":1550000,"bid":1500000},"Sundering Crossbow":{"ask":-1,"bid":220000000},"Sundering Jewel":{"ask":8800000,"bid":7800000},"White Key Fragment":{"ask":800000,"bid":740000},"Arcane Reflection":{"ask":56000,"bid":53000},"Chimerical Chest Key":{"ask":1350000,"bid":1250000},"Chimerical Entry Key":{"ask":350000,"bid":260000},"Enchanted Chest Key":{"ask":3800000,"bid":3700000},"Enchanted Entry Key":{"ask":620000,"bid":600000},"Griffin Bulwark":{"ask":-1,"bid":94000000},"Griffin Talon":{"ask":3400000,"bid":3100000},"Sinister Chest Key":{"ask":2050000,"bid":1500000},"Sinister Entry Key":{"ask":410000,"bid":390000},"Advanced Task Badge":{"ask":-1,"bid":-1},"Alchemy Essence":{"ask":310,"bid":237.5},"Alchemy Tea":{"ask":1000,"bid":760},"Azure Alembic":{"ask":68000,"bid":15000},"Basic Task Badge":{"ask":-1,"bid":-1},"Brewing Essence":{"ask":280,"bid":220},"Burble Alembic":{"ask":860000,"bid":35999.5},"Catalyst Of Coinification":{"ask":4900,"bid":4100},"Catalyst Of Decomposition":{"ask":6900,"bid":4500},"Catalyst Of Transmutation":{"ask":8700,"bid":7000},"Catalytic Tea":{"ask":2300,"bid":2150},"Cheese Alembic":{"ask":5400,"bid":120},"Cheesesmithing Essence":{"ask":390,"bid":310},"Chimerical Token":{"ask":-1,"bid":-1},"Cooking Essence":{"ask":270,"bid":250},"Crafting Essence":{"ask":370,"bid":310},"Crimson Alembic":{"ask":460000,"bid":54000},"Crushed Philosopher's Stone":{"ask":2100000,"bid":1750000},"Crushed Sunstone":{"ask":7000,"bid":6600},"Earrings Of Critical Strike":{"ask":11000000,"bid":5800000},"Earrings Of Essence Find":{"ask":7800000,"bid":4500000},"Enchanted Token":{"ask":-1,"bid":-1},"Enhancing Essence":{"ask":820,"bid":740},"Expert Task Badge":{"ask":-1,"bid":-1},"Foraging Essence":{"ask":270,"bid":227.5},"Gluttonous Energy":{"ask":15500000,"bid":12500000},"Gluttonous Pouch":{"ask":-1,"bid":23500000},"Guzzling Energy":{"ask":35000000,"bid":33000000},"Guzzling Pouch":{"ask":-1,"bid":370000000},"Holy Alembic":{"ask":500000,"bid":440000},"Milking Essence":{"ask":285,"bid":250},"Necklace Of Speed":{"ask":25000000,"bid":9600000},"Philosopher's Earrings":{"ask":-1,"bid":250000000},"Philosopher's Necklace":{"ask":600000000,"bid":300000000},"Philosopher's Ring":{"ask":-1,"bid":-1},"Philosopher's Stone":{"ask":500000000,"bid":470000000},"Prime Catalyst":{"ask":350000,"bid":220000},"Rainbow Alembic":{"ask":330000,"bid":-1},"Ring Of Critical Strike":{"ask":9400000,"bid":5600000},"Ring Of Essence Find":{"ask":9800000,"bid":4500000},"Sinister Token":{"ask":-1,"bid":-1},"Sunstone":{"ask":460000,"bid":440000},"Super Alchemy Tea":{"ask":4500,"bid":-1},"Tailoring Essence":{"ask":300,"bid":240},"Ultra Alchemy Tea":{"ask":9200,"bid":8400},"Ultra Attack Coffee":{"ask":12500,"bid":5800},"Ultra Brewing Tea":{"ask":56000,"bid":-1},"Ultra Cheesesmithing Tea":{"ask":12250,"bid":-1},"Ultra Cooking Tea":{"ask":17000,"bid":-1},"Ultra Crafting Tea":{"ask":19000,"bid":-1},"Ultra Defense Coffee":{"ask":13500,"bid":8800},"Ultra Enhancing Tea":{"ask":10500,"bid":8600},"Ultra Foraging Tea":{"ask":7800,"bid":5600},"Ultra Intelligence Coffee":{"ask":14000,"bid":-1},"Ultra Magic Coffee":{"ask":11500,"bid":11000},"Ultra Milking Tea":{"ask":22750,"bid":1000},"Ultra Power Coffee":{"ask":11500,"bid":10750},"Ultra Ranged Coffee":{"ask":11500,"bid":10000},"Ultra Stamina Coffee":{"ask":13000,"bid":6000},"Ultra Tailoring Tea":{"ask":17000,"bid":-1},"Ultra Woodcutting Tea":{"ask":14500,"bid":-1},"Verdant Alembic":{"ask":34000,"bid":-1},"Woodcutting Essence":{"ask":330,"bid":255}}}`, // 市场API median算法 API_URL : "https://raw.githubusercontent.com/holychikenz/MWIApi/main/medianmarket.json", // 市场API 香港服务器备份 API_URL_BACKUP:"http://43.129.194.214:5500/apijson" }, recource:{ // 2024.12.21 SVG图标备份 用于保存原始圣系列装备图标 OLD_SVG_URL : "https://raw.githubusercontent.com/kobayashi7777/milky-way-idel-resource/main/items_sprite.3999af53.svg", HOLY_ITEM_BACKUP : ``, // 老皇家衣服 ROYAL_CLOTHING_BACKUP: ``, // Magic Way Idle Logo 右侧文字 MAGIC_WAY_IDLE_TITLE : 'https://tupian.li/images/2024/10/03/66fd73f009f84.png' }, magic_api:{ // 服务器存活状态,万一哪天服务器挂了所有依赖数据库的服务将都不可用 SERVER_ALIVE:true, // 服务器域名 SERVER_DOMAIN:"111.170.18.193", // QQ秀上传接口 QQ_SHOW:"http://111.170.18.193:40622/api/qqshow.php", // 个人信息上传接口 PROFILE_SHARED_UPLOAD:"http://111.170.18.193:40622/api/uploadProfileShared.php", // 组队信息上传接口 PARTY_INFO:"http://111.170.18.193:40622/api/partyInfo.php", // 注册使用角色 REGISTERCHARACTER : "http://111.170.18.193:40622/api/registerCharacter.php", // 排行榜URL CN_RANK_URL:"http://111.170.18.193:40622/cnxp.php", // 组队信息URL CN_PARTY_URL:"http://111.170.18.193:40622/cnparty.php", // 磁力爱好者查询 MAGNETICINFO:"http://111.170.18.193:40622/api/getmagneticglovesinfo.php", } }; // 功能开启设置 let settingsMap = { replaceMagicWayIdleLogo: { id: "replaceMagicWayIdleLogo", desc:"LOGO替换:左上角LOGO替换为Maigc May Idle", isTrue: true, }, deathNotify: { id: "deathNotify", desc:"死亡报警:队伍中有角色死亡时立即弹窗报警", isTrue: true, }, marketPriceUpdate: { id: "marketPriceUpdate", desc:"价格更新:通过手动查看市场中物品价格,强制更新marketAPI缓存", isTrue: true, }, qqShow: { id: "qqShow", desc:"启用QQ秀:原MWI玩家图标替换功能,现支持即时更换头像", isTrue: true, }, taskSorting: { id: "taskSorting", desc:"自动任务排序:自动点击任务排序。本功能依赖MWI TaskManager,下载链接附后", isTrue: true, }, taskValue: { id: "taskValue", desc:"任务价值:显示每个任务的期望收益。本功能依赖食用工具,下载链接附后", isTrue: true, }, MWIToolsUIStyle: { id: "MWIToolsUIStyle", desc:"UI风格:修改MWItool的UI风格与系统UI风格一致", isTrue: true, }, marketFreezeFunds: { id: "marketFreezeFunds", desc:"购买预付金:显示撤单后可获取金币", isTrue: true, }, oldHolyItem: { id: "oldHolyItem", desc:"圣物品图标:显示原版圣系列物品图标", isTrue: false, }, oldRoyalItem: { id: "oldRoyalItem", desc:"老皇家衣服图标:显示原版皇家系列衣服图标", isTrue: false, }, showMagneticLover:{ id:"showMagneticLover", desc:"磁力爱好者:显示使用过磁力手套的人", isTrue: true, } } // 全局变量 let globalVariable={ gameRawData:{ // 游戏基础数据 initClientData : null, // 老圣系列SVG图标DOM oldHolySvgDOM : null, // 老皇家系列SVG图标DOM oldRoyalSvgDOM: null, }, dependency:{ // 玩家是否安装插件"[银河奶牛]食用工具" isInstallEdibleTools : false, // 玩家是否安装插件"MWITools" isInstallMWITools : false }, replaceMagicWayIdleLogo:{ isReplaceable : false }, deathNotify : { // 队伍中玩家信息 battleMembers : {}, // 是否刚进入游戏,继续上次战斗 isBattleBegin : false }, qqShow:{ // 保存玩家QQ秀链接 replacementTargets : {}, // 图标替换观察者 observer : null, characterName : null }, market:{ // 是否启用市场API本地备份 isUsingLocalMarketBackup : false, // 当前购买预付金金额 freezeFundsValue : null, // 购买预付金更新标记 freezeFundsUpdateFlag : false, // 挂单id防止重复挂单 tradeID:0, }, task : { // 是否处于任务界面 isTaskSortable : false, // 战斗任务索引,使战斗任务始终处于其他任务后面 taskBattleIndex: 99, // 任务类型排序规则 taskOrderIndex : { Milking: 1, Foraging: 2, Woodcutting: 3, Cheesesmithing: 4, Crafting: 5, Tailoring: 6, Cooking: 7, Brewing: 8, Enhancing: 9, Defeat: 99, //战斗处于其他任务后面 } } }; // 主函数 scriptMain(); function scriptMain(){ if (document.URL.includes("milkywayidle.com")) { gameMain(); }else if(document.URL.includes(global_url_config.magic_api.SERVER_DOMAIN)){ magicMain(); } } // 游戏主函数 function gameMain(){ // IOS必定报错,不可与业务逻辑合并。移动设备无弹窗无需修复 try{ // 获取通知权限 Notification.requestPermission().then(function(result) { if (result === 'denied') { console.info('无法获取通知权限,强制关闭死亡报警'); return; } if (result === 'default') { return; } }); }catch(error){ console.error(error); } try{ // 加载功能设置 readSettings(); // 加载游戏基础数据 globalVariable.gameRawData.initClientData = JSON.parse(localStorage.getItem("initClientData")); // 判断依赖:食用工具是否安装 if('Edible_Tools' in localStorage)globalVariable.dependency.isInstallEdibleTools=true; // 判断依赖:MWITools是否安装 if('script_settingsMap' in localStorage)globalVariable.dependency.isInstallMWITools=true; // 加载老图标资源 loadOldSvg(); // 拦截WebSocket hookWebSocket(); // 若功能设置开启,且服务器存活 => 开启QQ秀功能 if(settingsMap.qqShow.isTrue && global_url_config.magic_api.SERVER_ALIVE){ // 优先从缓存加载QQ秀 if('magic_qqshow_cache' in localStorage){ globalVariable.qqShow.replacementTargets=JSON.parse(localStorage.getItem("magic_qqshow_cache")); } if('magic_qqshow_cache_timestamp' in localStorage){ // 若缓存过期(有效期 1 天) => 立即更新缓存 if(Math.abs(Date.now()- localStorage.getItem("magic_qqshow_cache_timestamp"))>86400000)getQQShowData(); }else{ // 未找到缓存 => 立即更新缓存 getQQShowData(); } // 初始化观察者,分配替换目标 initQQShowObserver(); // 启动观察者,替换QQ秀 globalVariable.qqShow.observer.observe(document, { attributes: false, childList: true, subtree: true }); } // 统一观察者 let globalObserver=new MutationObserver(function (mutationsList, observer) { if(settingsMap.replaceMagicWayIdleLogo.isTrue)replaceMagicWayIdleLogo(); // 显示任务价值,依赖MWItool if(globalVariable.dependency.isInstallMWITools)showTaskValue(); // 显示QQ秀提交UI if(settingsMap.qqShow.isTrue && global_url_config.magic_api.SERVER_ALIVE)addQQshowButton(); // 显示购买预付金 if(settingsMap.marketFreezeFunds.isTrue)showMarketFreezeFunds(); // 修改MWIToolsUI风格 if(settingsMap.MWIToolsUIStyle.isTrue)fixMWIToolsUIStyle(); // 修改神圣奶酪系列道具图标 if(settingsMap.oldHolyItem.isTrue)replaceHolyItemIcon(); // 修改老皇家系列衣服图标 if(settingsMap.oldRoyalItem.isTrue)replaceRoyalItemIcon(); // 自动点击任务排序 if(settingsMap.taskSorting.isTrue)autoClickTaskSortButton(); // 查询失信记录 if(settingsMap.showMagneticLover.isTrue)showMagneticLover(); // 显示功能设置面板 addSettingMenu(); }); globalObserver.observe(document,{ childList: true, subtree: true }); globalVariable.deathNotify.isBattleBegin=true; }catch(error){ console.error(error); } } // 拦截WS function hookWebSocket() { const dataProperty = Object.getOwnPropertyDescriptor(MessageEvent.prototype, "data"); const oriGet = dataProperty.get; dataProperty.get = hookedGet; Object.defineProperty(MessageEvent.prototype, "data", dataProperty); function hookedGet() { const socket = this.currentTarget; if (!(socket instanceof WebSocket)) { return oriGet.call(this); } if (socket.url.indexOf("api.milkywayidle.com/ws") <= -1 && socket.url.indexOf("api-test.milkywayidle.com/ws") <= -1) { return oriGet.call(this); } const message = oriGet.call(this); Object.defineProperty(this, "data", { value: message }); return handleMessage(message); } } // WS拦截后处理,主进程 function handleMessage(message,debug=false) { let obj = JSON.parse(message); if (obj && obj.type === "init_character_data") { // 切角色,再次刷新左上角LOGO globalVariable.replaceMagicWayIdleLogo.isReplaceable = true; // 读取角色名称用于上传QQ秀 globalVariable.qqShow.characterName=obj.character.name; // 刚进入游戏,可能继续上次战斗 => 标记为刚进入战斗 globalVariable.deathNotify.isBattleBegin=true; // 战斗排行 addRankButton(); // 组队情况 addPartyButton(); // 读取背包 uploadInitCharacterData(obj); globalVariable.market.freezeFundsValue=calculateMarketFreezeFunds(obj.myMarketListings); }else if (obj && obj.type === "new_battle") { // 死亡报警 if(settingsMap.deathNotify.isTrue)notifyDeath(obj); } else if (obj && obj.type === "battle_updated") { // 死亡报警 if(settingsMap.deathNotify.isTrue)notifyDeath(obj); }else if (obj && obj.type === "profile_shared"){ // 上传个人资料 uploadProfileShared(obj); }else if (obj && obj.type === "market_item_order_books_updated") { // 强制刷新市场价格 if(settingsMap.marketPriceUpdate.isTrue)marketPriceUpdate(obj); }else if (obj && obj.type === "actions_updated") { // 切换行动,可能开始战斗 => 标记为刚进入战斗 globalVariable.deathNotify.isBattleBegin=true; }else if(obj && obj.type ==="market_listings_updated"){ // 维护购买预付金挂单、撤单 updateMarketFreezeFunds(obj); } //other return message; } // 数据页主函数 function magicMain(){ let characterName=GM_getValue("magic_register_character"); if(!characterName)return; // 组队数据需要有人来上传,人人白嫖,脚本就没法获取真实数据 if(!checkCookieExists("character_cookie")){ document.cookie = `character_cookie=${characterName}; `; location.reload(); } } // 加载功能设置面板 function addSettingMenu(){ const targetNode = document.querySelector("div.SettingsPanel_profileTab__214Bj"); if (targetNode) { if (!targetNode.querySelector("#script_settings_magic_way_idle")) { targetNode.insertAdjacentHTML("beforeend", `
`); const insertElem = targetNode.querySelector("div#script_settings_magic_way_idle"); insertElem.insertAdjacentHTML( "beforeend", `