Created
May 18, 2014 09:15
-
-
Save ssig33/ba2b2747498b8755b19b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 優等列車大量購入と全自動改造 | |
// @namespace http://ssig33.com/ | |
// @version 2.0 | |
// @description enter something useful | |
// @match http://meicolle.kdns.info/ | |
// @copyright 2014+, ssig33 | |
// ==/UserScript== | |
var buy_car = function(){ | |
if(money.ticket<=0){ | |
altAlert("優等車購入チケットがありません"); | |
money.ticket=0; | |
return; | |
}else{ | |
money.ticket -= 1; | |
} | |
$.getJSON("newexp.cgi?"+Math.random(),function(json){ | |
addNewCar(json.kind,json.storage); | |
refreshCarList(); | |
}); | |
} | |
var new_exp_car_10 = function(){ | |
if(confirm('本当に購入しますか?')){ | |
buy_car(); | |
buy_car(); | |
buy_car(); | |
buy_car(); | |
buy_car(); | |
buy_car(); | |
buy_car(); | |
buy_car(); | |
buy_car(); | |
buy_car(); | |
} | |
} | |
var auto_upgrade = function(){ | |
var target = $('#cardisp').find('img.button').first().attr('onclick').split('"')[1]; | |
var list = [] | |
var used = false; | |
$.map($('#carlist').find('div.item[data-level="1"]'), function(e,i){return $(e).attr('onclick').split('"')[1]}).forEach(function(e){ | |
if(used === false && e === target){ | |
used = true; | |
}else{ | |
list.push(e) | |
} | |
}) | |
list.forEach(function(esa){ | |
var data = readFromLocalStorage(target); | |
console.log(data); | |
if(money.money < data.level*100){ | |
altAlert("<p>資金が不足しています</p>"); | |
}else{ | |
money.money -= data.level*100; | |
data.level += 1; | |
saveToLocalStorage(target,data); | |
var data2 = readFromLocalStorage(esa); | |
if(data2.kind == "json/"+esa+".json"){ | |
data2.kind = null; | |
saveToLocalStorage(esa,data2); | |
}else{ | |
localStorage.removeItem(esa); | |
} | |
} | |
refreshCarList(); | |
refreshTrainList(); | |
if(data.level >= 400){ | |
carSelect = cardisp; | |
} | |
cardisp(target,null,true); | |
}) | |
setTimeout(function(){ | |
altAlert("<p>自動改造が完了しました。列車リストが更新されない場合はゲームをリロードしてください。</p>") | |
refreshCarList(); | |
},6000) | |
console.log(list); | |
} | |
window.onload = function(){ | |
var $h1 = $('<h1>'); | |
var $a = $('<a>').attr('href', 'javascript:void(0)').text('優等列車購入 10 編成'); | |
$a.click(function(){new_exp_car_10()}); | |
$h1.html($a) | |
$('a[href="museum.html"').before($h1) | |
$h1 = $('<h1>'); | |
$a = $('<a>').attr('href', 'javascript:void(0)').text('全自動改造'); | |
$a.click(function(){ | |
if(confirm('本当に全自動改造しますか?')){ | |
auto_upgrade() | |
}; | |
}); | |
$h1.html($a) | |
$('a[href="museum.html"').before($h1) | |
$('a[href="museum.html"').after($h1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment