// ==UserScript==
// @name FR - Hoard - Hoard Helper
// @namespace https://github.com/flamyfox/FrFun
// @version 0.1
// @description 1.Swipp item Highlight,2.Page Jump,3.valut at once,4.
// @author flamyfox
// @match http://flightrising.com/main.php?p=hoard*
// @match http://flightrising.com/main.php?p=vault*
// @grant none
// ==/UserScript==
//¸ßÁÁÁбí
//Apparel
var aApparel = new Array('191', '258', '189', '255', '256', '683', '252', '1137', '1148', '1117', '1087', '1084', '1017', '1138', '1136', '266', '1163', '265', '247', '830', '751', '598', '198', '1014', '199', '377', '79', '246', '53', '201', '94', '183', '74', '1046', '2256', '184', '2257', '1048', '2939', '1047', '3989', '3990', '5173', '5700', '339', '13', '376', '2391', '338', '968', '2990', '192', '2945', '192', '2942', '192', '2948', '192', '3021', '192', '3020', '243', '1119', '1086', '1132', '3457', '3482', '3448', '3551', '3450', '3677', '40', '46', '3032', '2593', '3479', '180', '406', '5414', '5410', '6536', '3506', '2946', '38', '14892', '15119', '10218', '15113', '15115', '13415', '15128', '15123', '14566', '15579', '4803', '53', '12738', '11817', '19262', '179', '18448', '18921', '1078', '7580', '20134', '17505', '20111', '16241', '16439', '10202', '14443', '3392', '8827', '198', '23840', '21553', '21375', '22403', '21386', '23853', '16289', '189', '199', '23877', '23860', '3503', '21391', '178');
//Vistas
var aVistas = new Array('259', '574', '62', '14540', '3454', '13409', '18433', '181', '1146', '416', '5708', '533');
//Familiars
var aFamiliars = new Array('106', '10', '164', '4440', '4439', '1574', '1576', '1577', '1575', '250', '261', '3083', '134', '828', '2044', '91', '2944', '4370', '3669', '13392', '1212', '13401', '1213', '13395', '6361', '13405', '6360', '10404', '7590', '10403', '7587', '3507', '8107', '3453', '5919', '173', '204', '16032', '5712', '3392', '15577', '3391', '15576', '8100', '20140', '5408', '20139', '798', '15578', '798', '15579');
//Skins
var aSkins = new Array('412', '677', '3406', '4326', '810', '5412', '1064', '1755', '731', '805', '729', '1175', '257', '2415', '196', '1168', '182', '3393', '6', '677', '733', '1055', '789', '1050', '8', '4322', '4357', '3992', '1169', '251', '3395', '2947', '2413', '242', '169', '762', '127', '499', '1175', '3394');
//Misc
var aMisc = new Array('574', '246', '246', '245', '184', '185', '788');
//Brew
var aBrew = new Array('188', '193', '194', '195', '196', '245', '250', '495', '496', '527', '688', '765', '788', '886', '1072', '1073', '1074', '1079', '1080', '1081', '1082', '1083', '1084', '1085', '1086', '1087', '1088', '1089', '1205', '1886', '1887', '1888', '1889', '1890', '1891', '1892', '1893', '1894', '1895', '1896', '1897', '1898', '1899', '1900', '1901', '1902', '1903', '1904', '1905', '1906', '1907', '1908', '1909', '2047', '2048', '2253', '3121', '3122', '3411', '3416', '4363', '4364', '4641', '4673', '4674', '4675', '4677', '6346', '6350', '6351', '6539', '7576', '7577', '8094', '8095', '8097', '8102', '9660', '9661', '9842', '10868', '10875', '10883', '11299', '11300', '11523', '11820', '11821', '11822', '12942', '13084', '13418', '14445', '14446', '15132', '16909', '19259', '19444', '19445', '19446', '21366', '21398', '21410', '22378', '22379', '22380', '22381', '22386', '22390', '22391', '22396', '22397');
//Junk
var aJunk = new Array('608','773', '799', '800', '803', '804', '819', '820', '1149', '1363', '1450', '1564', '1672', '1673', '1795', '1796', '2420', '2780', '4001', '4002', '4347', '4348', '4349', '5177', '5178', '7598', '10759', '13424', '13426', '13427', '13431', '13434', '13435', '14442', '15129');
$(document).ready(function() {
//creat style sheet
$("body").append("");
//add ctrl board
var cBoard = "
"
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ "Êοò³èƤÔÓìÀ "
+ " "
+ " "
+ " "
+ ""
+ ""
+ ""
+ "
";
$("body").append(cBoard);
//listener
$("#bToVault").bind("click",function(){
$("#tovault").click();
});
$("#bCheck").bind("click",function() {
checkSwippe();
});
$("#bCheckAll").bind("click",function() {
pCheckAll();
});
$("#bRest").bind("click",function() {
$("#invent a.clue>img").removeAttr('class');
});
$("#pageGo").bind("click",function() {
var iSort = $("#invent").find("a").attr("onclick").split("'");
var iPage = $("#goPageV").val();
browseAll(iPage, iSort[3], iSort[5]);
});
$("#bJunk").bind("click",function() {
checkJunk();
});
$("#bSafeBox").bind("click",function() {
printOnclick();
});
$("#pNext").bind("click", function(){
nextPage();
});
$("#pPrev").bind("click", function(){
prevPage();
});
$("#bOpen").bind("click", function(){
chestOpen();
});
});
function nextPage(){
var nUrl = $("#invent").find("img[src$='arrow_right.png']").parent().attr("onclick").split("'");
var hPage = nUrl[1];
var hTab = nUrl[3];
//console.log(nUrl[1]);
if (nUrl){
browseAll(hPage, hTab);
}
}
function prevPage(){
var nUrl = $("#invent").find("img[src$='arrow_left.png']").parent().attr("onclick").split("'");
var hPage = nUrl[1];
var hTab = nUrl[3];
//console.log(nUrl[1]);
if (nUrl){
browseAll(hPage, hTab);
}
}
function browseAll(page, tab, food){
var HorV = window.location.href;
HorV = HorV.replace("http://flightrising.com/main.php?p=","");
$("#inv_main").html('');
$.ajax({
type: "POST",
data: {page: page, tab: tab, food: food},
url: "includes/" + HorV + "_main.php",
cache:false
}).done(function(stuff){
$("#inv_main").html(stuff);
});
//console.log(page+","+tab+","+food);
}
function pCheckAll(){
$("#invent .clue").each(function() {
var sCheck = $(this).parent().find("input[type=checkbox]").is(':checked');
if ( sCheck === true ){
$(this).parent().find("input[type=checkbox]").prop({checked:false});
}
else{
$(this).parent().find("input[type=checkbox]").prop({checked:true});
}
});
}
function checkSwippe() {
$("#invent .clue").each(function() {
var i;
//get item ID
var sImgID = $(this).find("img").attr("src").replace(/\D/g,'');
//check flag test
var sCheck = $(this).parent().find("input[type=checkbox]").is(':checked');
//check Familiars
for ( i = 0; i < aFamiliars.length; i++) {
if (sImgID == aFamiliars[i]) {
$(this).find("img").addClass("familars");
if ( sCheck === true ){
$(this).parent().find("input[type=checkbox]").prop({checked:false});
}
else{
$(this).parent().find("input[type=checkbox]").prop({checked:true});
}
}
}
//check Apparel
for ( i = 0; i < aApparel.length; i++) {
if (sImgID == aApparel[i]) {
$(this).find("img").addClass("apparel");
if ( sCheck === true ){
$(this).parent().find("input[type=checkbox]").prop({checked:false});
}
else{
$(this).parent().find("input[type=checkbox]").prop({checked:true});
}
}
}
//check Vistas
for ( i = 0; i < aVistas.length; i++) {
if (sImgID == aVistas[i]) {
$(this).find("img").addClass("vistas");
if ( sCheck === true ){
$(this).parent().find("input[type=checkbox]").prop({checked:false});
}
else{
$(this).parent().find("input[type=checkbox]").prop({checked:true});
}
}
}
//check Skin
for ( i = 0; i < aSkins.length; i++) {
if (sImgID == aSkins[i]) {
$(this).find("img").addClass("skin");
if ( sCheck === true ){
$(this).parent().find("input[type=checkbox]").prop({checked:false});
}
else{
$(this).parent().find("input[type=checkbox]").prop({checked:true});
}
}
}
//check Mise
for ( i = 0; i < aMisc.length; i++) {
if (sImgID == aMisc[i]) {
$(this).find("img").addClass("misc");
if ( sCheck === true ){
$(this).parent().find("input[type=checkbox]").prop({checked:false});
}
else{
$(this).parent().find("input[type=checkbox]").prop({checked:true});
}
}
}
//check Brew
for ( i = 0; i < aBrew.length; i++) {
if (sImgID == aBrew[i]) {
$(this).find("img").addClass("brew");
if ( sCheck === true ){
$(this).parent().find("input[type=checkbox]").prop({checked:false});
}
else{
$(this).parent().find("input[type=checkbox]").prop({checked:true});
}
}
}
});
}
function checkJunk() {
$("#invent .clue").each(function() {
//get item ID
var sImgID = $(this).find("img").attr("src").replace(/\D/g,'');
//check flag test
var sCheck = $(this).parent().find("input[type=checkbox]").is(':checked');
//check Junk
for (var i = 0; i < aJunk.length; i++) {
if (sImgID == aJunk[i]) {
$(this).find("img").addClass("junk");
if ( sCheck === true ){
$(this).parent().find("input[type=checkbox]").prop({checked:false});
}
else{
$(this).parent().find("input[type=checkbox]").prop({checked:true});
}
}
}
});
}
function printOnclick(){
var item, temp="";
$("#invent span[style='width:85px; display:inline-block; height:115px; margin-right:5px; margin-left:5px; padding:0px; float:left;']").each(function(){
item = $(this).find("img[style='vertical-align:middle; cursor:pointer;']").attr("onclick");
if(item){
temp = temp + item + ";";
//singleVault(tab,page,itemid, st);
}
});
console.log(temp);
}
function singleVault(itemid, st)
{
var tab = $("#toplinks").find("a[style='color:#731d08; font-weight:bold; cursor:pointer;']").attr("onclick").split("'");
var page = $("div[style='width:670px; font-size:12px; margin-left:auto; margin-right:auto; text-align:center; margin-bottom:15px;']").find("span").text();
$.ajax({
type: "POST",
data: {tab: tab[1], page: page, st: st, itemid: itemid},
url: "includes/ol/vault_transsingle_in.php",
cache:false
}).done(function(stuff){
console.log("done");
});
}
function chestOpen(){
var page, url, type, count;
type = $('input[name=chest]:checked').val();
count = $("#invent").find("img[src$='" + type +".png']").parent().parent().find("input").val();
//count = 2;
url = "http://flightrising.com/includes/ol/openchest.php?id=" + type + "&ver=con";
console.log([page,count]);
for( var i = 0; i< count; i++){
$.ajax({
type:"GET",
url:url,
dataType:"html",
//async:false,
success:function(data) {
$("body").append(data);
}
});
}
}