var sa2_scorecard_sounds = { show_score1: ["show_score"], show_score2: ["show_score"], tally_score: ["tally_score"], tally_score_mini: ["tally_score_mini",0,0.15], rank: ["rank"], knux_rankA: ["knux_rankA"], knux_rankB: ["knux_rankB"], knux_rankC: ["knux_rankC"], knux_rankD: ["knux_rankD"], knux_rankE: ["knux_rankE"], knux_rankF: ["knux_rankF"], knux_rankS: ["knux_rankS"], knux_gameOver: ["knux_gameOver"], emblem: ["emblem"], roundClear: ["roundClear"], }; var sa2_scorecard_rankLengths = { A : 1881, B : 1515, C : 993, D : 1724, E : 1515, F : 14158, S : 990, }; var sa2_scorecard_soundsLoaded = {}; var sa2_scorecard_wait_for_load = { music : true, sound : false, }; if (typeof(soundLibrary) != "undefined") { for (var i in sa2_scorecard_sounds) { if (typeof(sa2_scorecard_sounds[i][1]) == "undefined") { soundLibrary.add(i, "http://forums.sonicretro.org/emerald_hunt/sound/" + sa2_scorecard_sounds[i][0] + ".ogg"); } else { soundLibrary.add(i, "http://forums.sonicretro.org/emerald_hunt/sound/" + sa2_scorecard_sounds[i][0] + ".ogg",{ loopStart: sa2_scorecard_sounds[i][1], loopEnd: sa2_scorecard_sounds[i][2] }); } sa2_scorecard_soundsLoaded[i] = false; } var sa2_scorecard_soundInterval = setInterval(function(){ var found_false = false; for (var i in sa2_scorecard_soundsLoaded) { if (soundLibrary.librarySound[soundLibrary.library.indexOf(i)].isLoaded.indexOf(false) == -1) sa2_scorecard_soundsLoaded[i] = true; else found_false = true; } if (found_false == false) { clearInterval(sa2_scorecard_soundInterval); sa2_scorecard_soundInterval = undefined; sa2_scorecard_wait_for_load.sound = true; } },10); } else { sa2_scorecard_wait_for_load.sound = true; soundLibrary = {}; soundLibrary.play = function() { }; soundLibrary.stop = function() { }; } jQuery.fn.center = function(){this.css("position","absolute");this.css("top",((jQuery(window).height()-this.outerHeight())/2)+jQuery(window).scrollTop()+"px");this.css("left",((jQuery(window).width()-this.outerWidth())/2)+jQuery(window).scrollLeft()+"px");return this;}; var sa2_hackdetected = function() { soundLibrary.play("knux_rankF",0.9,1); document.title = "* HACK DETECTED *"; jQuery('#main_stylesheet').remove(); jQuery('head').append(''); jQuery('body').addClass('hack').html('
HACK DETECTION

ONE OR MORE EMERALD HUNT RESOURCES WERE MANIPULATED BY AN OUTSIDE SOURCE. THIS IS NOT ALLOWED AS SPECIFIED IN THE EMERALD HUNT LICENSE.
YOU MUST RESTART THE EMERALD HUNT AND ACCEPT THE EMERALD HUNT LICENSE AGAIN, TO CONTINUE TO USE THE EMERALD HUNT.

EMERALD HUNT HALTED.
'); jQuery("table.hack").center(); setTimeout(function(){ jQuery('body').append('
'); jQuery('#overlay2').animate({ opacity: 1 },1000,function() { window.location.href = 'http://forums.sonicretro.org'; }); },15731); }; var sa2_gameover = function() { var html = '\
\
 
\
\
GAME
\
OVER
\
\
\ '; jQuery('body').append(html); jQuery('#sa2_scorecard_bg').fadeIn(500,function() { soundLibrary.play("knux_rankF",1,1); var gmTop = jQuery(window).height() - jQuery('#sa2_gameover_left').outerHeight(); jQuery('#sa2_gameover_left').css({top:gmTop/2}).animate({left:'0%'},1000); jQuery('#sa2_gameover_right').css({top:gmTop/2}).animate({right:'0%'},1000); setTimeout(function(){ jQuery('body').append('
'); jQuery('#overlay2').animate({ opacity: 1 },1000,function() { window.location.href = 'http://forums.sonicretro.org'; }); },14158); }); }; var sa2_scorecard_timebonus = 0, sa2_scorecard_totalscore = 0; var sa2_scorecard = function(scores,timeBonus,totalScore,rank) { if (sa2_scorecard_wait_for_load.sound == false || sa2_scorecard_wait_for_load.music == false) return; sa2_scorecard_timebonus = timeBonus; sa2_scorecard_totalscore = totalScore; var html = '\
\
 
\
\
MISSION CLEARED!
\
\ '; for (var i = 0; i < scores.length; i++) { html += '\
' + scores[i][0] + '' + scores[i][1] + '
\ '; } html += '\
\
\
TIME BONUSTIME BONUS0
\
TOTAL SCORETOTAL SCORE0
\
\
\ RANKX\
\
\
\ '; jQuery('body').append(html); jQuery('#sa2_scorecard_fg').css({top : (jQuery(window).height() - jQuery('#sa2_scorecard_fg').outerHeight()) / 2}); jQuery('.sa2_top_box').animate({opacity:1},500); jQuery('#sa2_scorecard_bg').fadeIn(500,function() { jQuery('#sa2_score_timebonus').html(sa2_scorecard_timebonus); jQuery('#sa2_score_totalscore').html(sa2_scorecard_totalscore); soundLibrary.play("roundClear"); jQuery('#sa2_score_box1').addClass('animate'); var time = 300; var sound_which = 0; for (var i = 0; i < scores.length; i++) { jQuery('#sa2_score_' + i).delay(time).queue(function(){ jQuery(this).addClass('animate'); setTimeout(function(){ soundLibrary.stop("show_score" + ((sound_which%2)+1)); soundLibrary.play("show_score" + ((sound_which%2)+1)); sound_which++; },150); }); time += 350; } setTimeout(function(){ jQuery('#sa2_score_box2').addClass('animate'); },time); setTimeout(function(){ jQuery('#sa2_score_timebonus').addClass('animate'); setTimeout(function(){ soundLibrary.stop("show_score2"); soundLibrary.play("show_score2"); },150); },time+350); setTimeout(function(){ jQuery('#sa2_score_totalscore').addClass('animate'); setTimeout(function(){ soundLibrary.stop("show_score1"); soundLibrary.play("show_score1"); },150); },time+700); setTimeout(function(){ sa2_scorecard_tally(rank); if (sa2_scorecard_timebonus >= 50) soundLibrary.play("tally_score_mini",1,0.5); }, time+1450); }); }; var sa2_scorecard_tally = function(rank) { if (sa2_scorecard_timebonus == 0) { jQuery('#sa2_rank_box').addClass('rank'+rank).html('
RANK'+rank+'
'); soundLibrary.stop("tally_score_mini"); soundLibrary.play("tally_score",1,0.5,true); setTimeout(function(){ jQuery('#sa2_rank_box > div').addClass('animate'); setTimeout(function(){ soundLibrary.play("rank"); },250); },1800); setTimeout(function(){ soundLibrary.play("knux_rank" + rank,1,(rank == "F" ? 1 : 0.75)); setTimeout(function(){ jQuery('#sa2_scorecard_fg').fadeOut(500,function(){ jQuery('#sa2_scorecard_fg').remove(); if (typeof(sa2_emblem) == "function") { if (rank != "F" && rank != "S" && chuckles != "zachary") { sa2_emblem(sa2_emblem_count); } else if (rank == "S" || chuckles == "zachary") { sa2_hackdetected(); } else { jQuery('body').append('
'); jQuery('#overlay2').animate({ opacity: 1 },1000,function() { window.location.href = 'http://forums.sonicretro.org'; }); } } else { jQuery('#sa2_scorecard').fadeOut(500,function(){ jQuery('#sa2_scorecard').remove(); }); } }); },sa2_scorecard_rankLengths[rank]+1000); },3150); } else { sa2_scorecard_timebonus -= 50; sa2_scorecard_totalscore += 50; jQuery('#sa2_score_timebonus').html(sa2_scorecard_timebonus); jQuery('#sa2_score_totalscore').html(sa2_scorecard_totalscore); setTimeout(function() { sa2_scorecard_tally(rank); },10); } };