local e=Bejeweled or{};e.version="Version 1.03";e.splashDisplayTime=3;local t="Interface\\AddOns\\Bejeweled";local l="Interface\\AddOns\\Bejeweled\\images\\";local Re="Interface\\AddOns\\Bejeweled\\sounds\\";local me="BEJEWELED2";local Me={"|cFFFFFF00".."Yellow","White","|cFF2255FF".."Blue","|cFFFF0000".."Red","|cFFEE00EE".."Purple","|cFFFF9922".."Orange","|cFF00FF00".."Green"};e.const={};e.const.skillDataNames={"Match Gems","Gem Cascades","Gem Combos","Classic","Timed","Fun Achievements","Game Achievements"};e.const.skillDataRanks={"Apprentice","Journeyman","Expert","Artisan","Master","Grand Master"};e.const.skillData={[1]={[1]={"Match 3 Gems",0,10,20,50},[2]={"Match 4 Gems (Create a |cFF0070DD[Power Gem]|r)",50,105,150,215},[3]={"Match 5 Gems (Create a |cFFA335EE[Hyper Cube]|r)",150,275,380,445},},[2]={[1]={"Cause a x2 Cascade",0,25,55,75},[2]={"Cause a x3 Cascade",40,100,160,225},[3]={"Cause a x4 Cascade",80,125,195,280},[4]={"Cause a x5 Cascade",125,190,265,335},},[3]={[1]={"Clear 10 Gems in one move",115,225,300,375},[2]={"Clear 15 Gems in one move",150,260,345,500},[3]={"Clear 20 Gems in one move",225,325,420,501},[4]={"Clear 25 Gems in one move",300,380,500,501},},[4]={[1]={"Score 100,000 Points",75,150,225,300},[2]={"Survive to Level 10",75,150,230,325},[3]={"Survive 100 Moves",60,150,230,325},[4]={"Score 250,000 Points",150,280,375,500},[5]={"Survive to Level 15",150,280,385,500},[6]={"Score 500,000 Points",225,300,420,500},[7]={"Survive 250 Moves",265,375,500,501},[8]={"Score 750,000 Points",300,500,501,502},},[5]={[1]={"Achieve a PPS of 250+ at end of game",75,150,225,300},[2]={"Achieve a PPS of 300+ at end of game",150,225,375,500},[3]={"Achieve a PPS of 350+ at end of game",225,300,500,501},},[6]={[1]={"Die from falling damage",0,0,0,0},[2]={"Join a Battleground Queue",0,0,0,0},[3]={"Loot a rare item",75,75,75,75},[4]={"Kill a critter",75,75,75,75},[5]={"Get resurrected",75,75,75,75},[6]={"Loot an epic item",150,150,150,150},[7]={"Say yes to a raid ready check",150,150,150,150},[8]={"Die from combat damage",150,150,150,150},[9]={"Kill an elite monster",225,225,225,225},[10]={"Enter a raid instance",225,225,225,225},[11]={"Gain a new reputation level",225,225,225,225},[12]={"Gain Honor from a killing blow",300,300,300,300},[13]={"Kill a rare spawn monster",300,300,300,300},[14]={"Level-up",375,375,375,375},[15]={"Win an arena match",375,375,375,375},},[7]={[1]={"Beat another player's high score (Classic)",0,0,0,0},[2]={"Clear 1000 Gems",75,75,75,75},[3]={"Play 100 games",75,75,75,75},[4]={"Get a |cFF0070DD[Power Gem]|r total of 100+",150,150,150,150},[5]={"Beat another player's high score (Timed)",150,150,150,150},[6]={"1,000,000 points in a single game",225,225,225,225},[7]={"Play 1000 games",225,225,225,225},[8]={"Get a |cFFA335EE[Hyper Cube]|r total of 50+",300,300,300,300},[9]={"Compete with 10+ Friends",300,300,300,300},[10]={"Complete all Fun Achievements",375,375,375,375},[11]={"Compete with 10+ Guildies",375,375,375,375},},};e.const.skillDataColors={{1,.5,.25},{1,1,0},{.25,.75,.25},{.3,.3,.3}};e.const.SKILLTYPE_MATCH=1;e.const.SKILL_MATCH3=1;e.const.SKILL_MATCH4=2;e.const.SKILL_MATCH5=3;e.const.SKILLTYPE_COMBO=2;e.const.SKILL_COMBO2=1;e.const.SKILL_COMBO3=2;e.const.SKILL_COMBO4=3;e.const.SKILL_COMBO5=4;e.const.SKILLTYPE_GEMCOMBO=3;e.const.SKILL_CLEAR10=1;e.const.SKILL_CLEAR15=2;e.const.SKILL_CLEAR20=3;e.const.SKILL_CLEAR25=4;e.const.SKILLTYPE_CLASSIC=4;e.const.SKILL_SCORE100K=1;e.const.SKILL_SCORE250K=4;e.const.SKILL_LEVEL10=2;e.const.SKILL_MOVE100=3;e.const.SKILL_LEVEL15=5;e.const.SKILL_SCORE500K=6;e.const.SKILL_MOVE250=7;e.const.SKILL_SCORE750K=8;e.const.SKILLTYPE_TIMED=5;e.const.SKILL_PPS350=1;e.const.SKILL_PPS300=2;e.const.SKILL_PPS250=3;e.const.SKILLTYPE_FUN=6;e.const.SKILL_FUNRANK1A=1;e.const.SKILL_FUNRANK1B=2;e.const.SKILL_FUNRANK2A=3;e.const.SKILL_FUNRANK2B=4;e.const.SKILL_FUNRANK2C=5;e.const.SKILL_FUNRANK3A=6;e.const.SKILL_FUNRANK3B=7;e.const.SKILL_FUNRANK3C=8;e.const.SKILL_FUNRANK4A=9;e.const.SKILL_FUNRANK4B=10;e.const.SKILL_FUNRANK4C=11;e.const.SKILL_FUNRANK5A=12;e.const.SKILL_FUNRANK5B=13;e.const.SKILL_FUNRANK6A=14;e.const.SKILL_FUNRANK6B=15;e.const.SKILLTYPE_ACHIEVEMENT=7;e.const.SKILL_ACHIEVE1A=1;e.const.SKILL_ACHIEVE2A=2;e.const.SKILL_ACHIEVE2B=3;e.const.SKILL_ACHIEVE3A=4;e.const.SKILL_ACHIEVE3B=5;e.const.SKILL_ACHIEVE4A=6;e.const.SKILL_ACHIEVE4B=7;e.const.SKILL_ACHIEVE5A=8;e.const.SKILL_ACHIEVE5B=9;e.const.SKILL_ACHIEVE6A=10;e.const.SKILL_ACHIEVE6B=11;e.const.largeText={["Go"]={135,76,0,.263,0,.296,224/255,142/255,254/255},["3"]={36,55,.637,.706,.785,1,225/255,32/255,38/255},["2"]={40,55,.479,.556,.344,.557,192/255,189/255,24/255},["1"]={25,55,.43,.478,.344,.557,54/255,255/255,54/255},["Time's up"]={155,40,.264,.565,.16,.314,223/255,0,0},["No more moves"]={295,41,.264,.839,0,.158,223/255,0,0},["Level up"]={220,56,0,.429,.341,.557,102/255,197/255,254/255},["Bejeweled"]={285,59,0,.555,.559,.786,1,1,1},["Multiplier up"]={313,54,0,.611,.79,1,102/255,197/255,254/255},["Strip"]={448,82,0,.622,.32,.336,1,1,1},["Popcap"]={100,100,.715,.85,.161,.431,1,1,1},["Tutorial_1"]={150,83,.708,1,.677,1,1,1,1},["Tutorial_2"]={152,76,1,0,.852,0,1,.592,.852,.592,1,1,1},["Tutorial_3"]={151,62,.557,.851,.434,.674,1,1,1},};e.const.windowFadeOut={mode="OUT",timeToFade=.5,startAlpha=1,endAlpha=.3,};e.const.windowFadeIn={mode="IN",timeToFade=.15,startAlpha=.3,endAlpha=1,};e.const.windowGameOverFadeOut={mode="OUT",timeToFade=5,startAlpha=1,endAlpha=0,finishedFunc=function()if(e.const.windowGameOverFadeOut.timeToFade==-1)then e.const.windowGameOverFadeOut.timeToFade=5;e.window:Show();e.window:SetAlpha(BejeweledProfile.settings.gameAlpha);else e.window:Hide();end e.window.hiding=nil;end,};local K={[1]={1,1,0},[2]={1,1,1},[3]={.2,.4,1},[4]={1,0,0},[5]={.8,0,.8},[6]={1,.6,.2},[7]={0,1,0},[8]={1,1,1},[9]={1,1,1},}local y={[1]="yellow",[2]="white",[3]="blue",[4]="red",[5]="purple",[6]="orange",[7]="green",};local C={};local b={};local O={};local B={};local W={};local t,a;a=1;for e=0,4 do B[e*10+1]={0,.1,e*.19999,(e+1)*.19999}B[e*10+2]={.1,.2,e*.19999,(e+1)*.19999}B[e*10+3]={.2,.3,e*.19999,(e+1)*.19999}B[e*10+4]={.3,.4,e*.19999,(e+1)*.19999}B[e*10+5]={.4,.5,e*.19999,(e+1)*.19999}B[e*10+6]={.5,.6,e*.19999,(e+1)*.19999}B[e*10+7]={.6,.7,e*.19999,(e+1)*.19999}B[e*10+8]={.7,.8,e*.19999,(e+1)*.19999}B[e*10+9]={.8,.9,e*.19999,(e+1)*.19999}B[e*10+10]={.9,1,e*.19999,(e+1)*.19999}C[a]={0,49/255,(e*50)/255,((e+1)*50-1)/255}C[a+1]={49/255,99/255,(e*50)/255,((e+1)*50-1)/255}C[a+2]={99/255,149/255,(e*50)/255,((e+1)*50-1)/255}C[a+3]={149/255,199/255,(e*50)/255,((e+1)*50-1)/255}C[a+4]={199/255,249/255,(e*50)/255,((e+1)*50-1)/255}O[a]={unpack(C[a])}O[a+1]={unpack(C[a+1])}O[a+2]={unpack(C[a+2])}O[a+3]={unpack(C[a+3])}O[a+4]={unpack(C[a+4])}a=a+5;end a=1;for e=0,3 do W[a]={0,.25,e/4,(e+1)/4}W[a+1]={.25,.5,e/4,(e+1)/4}W[a+2]={.5,.75,e/4,(e+1)/4}W[a+3]={.75,1,e/4,(e+1)/4}a=a+4;end for e=0,2 do b[1+e*3]={0,42.66/128,e*.33,(e+1)*.33}b[2+e*3]={.33,85.33/128,e*.33,(e+1)*.33}b[3+e*3]={.66,1,e*.33,(e+1)*.33}end FX_SHINE_ALPHA={0,.43,.66,.8,.66,.43};FX_SHINE_KEYFRAME={1,5,3,7,2,6,4,8,9};FX_SHINE_GRIDX={0,0,-1,1,-1,1,-1,1,-8};FX_SHINE_GRIDY={-1,1,0,0,-1,1,1,-1,-8};local be=24 local Te=24 local w=50 local c=50 local we=70+20 local xe=70+20 local Be=100+50 local ke=100+50 local S=400;local u=400;local R=S+32+16;local Z=u+110;local h=160;local x=216;local Fe=10;local k=1;local je=20;local ie=3;local se=360;local Se=4;local ye=16;local ae=5;local Le=12;local P=6;local Y=4;local de=7;local Ge=#FX_SHINE_ALPHA;local q=8;local re=#FX_SHINE_ALPHA;local f=9;local Ue=40;local N=10;local Q=10;local t=11 local Pe=12;local Ke=25;local fe=13;local he=14;local He=15;local L=nil;local d=-1;local H=40;local V=7;local ce=50;local J=c;local t=51;local t=c;local E=51;local A=52;local ge=53;local t=16;local oe=20;local F=150;local ze=60;local Qe=10;local U=w/2 local I=c/2 local qe=be/2 local Xe=Te/2 local t=Be/2 local t=ke/2 local M=oe/2;local De=Fe/2;local s=8;local r=8;local v=0;local ee=1;local We=2;local t=3;local D=4;local ue=5;local X=6;local Ce=1;local le=2;local Ze;local pe;local Ye;local Ve;local t;local m=1;local j=2;local T=3;local z={10,20,30,40,60,80,110,160,210}local te={[m]=1,[j]=15,[T]=15,}local p=table.insert;local g=table.remove;local i={};for e=1,8 do i[e]={};end local ne local G={[1]={-1,-1,0,0},[2]={1,1,0,0},[3]={0,0,-1,-1},[4]={0,0,1,1},[5]={-1,.5,0,0},[6]={0,0,-1,.5},};local n={round=1;score=0;paused=false;moveAllowed=nil;activeTime=0;};BejeweledData={["flightTimes"]={},};BejeweledProfile={["stats"]={["classic"]={["score"]=0,["played"]=0,["highestLevel"]=0;},["timed"]={["score"]=0,["played"]=0,["mostMoves"]=0;},["largestCascade"]=0,["largestCombo"]=0,["played"]=0,["combatPause"]=0,["totalGemsMatched"]=0,["totalPowerGems"]=0,["totalHyperGems"]=0,["gemMatch"]={0,0,0,0,0,0,0,0},},["skill"]={["rank"]=1,["skillPoints"]=0,["timedGames"]=0,["games"]=0,},["settings"]={["keybinding"]=nil,["gameAlpha"]=1,["mouseoffAlpha"]=.3,["publishSkillGains"]=1,["publishRankGains"]=1,["newGameFlight"]=1,["publishScores"]=1,["enableSounds"]=1,["disableHints"]=nil,["lockWindow"]=nil,["openFlightStart"]=1,["closeFlightEnd"]=nil,["openOnDeath"]=1,["closeReadyCheck"]=1,["openLogin"]=nil,["closeCombat"]=1,["showFlightTooltips"]=1,},["scoreList"]={["friends"]={["classic"]={[1]={"PopCap Games",1,1e3},[2]={"PopCap Games",1,900},[3]={"PopCap Games",1,800},[4]={"PopCap Games",1,700},[5]={"PopCap Games",1,600},[6]={"PopCap Games",1,500},[7]={"PopCap Games",1,400},[8]={"PopCap Games",1,300},[9]={"PopCap Games",1,200},[10]={"PopCap Games",1,100},},["timed"]={[1]={"PopCap Games",1,2.8},[2]={"PopCap Games",1,2.6},[3]={"PopCap Games",1,2.4},[4]={"PopCap Games",1,2.2},[5]={"PopCap Games",1,2},[6]={"PopCap Games",1,1.8},[7]={"PopCap Games",1,1.6},[8]={"PopCap Games",1,1.4},[9]={"PopCap Games",1,1.2},[10]={"PopCap Games",1,1},},},["guild"]={["classic"]={[1]={"PopCap Games",1,1e3},[2]={"PopCap Games",1,900},[3]={"PopCap Games",1,800},[4]={"PopCap Games",1,700},[5]={"PopCap Games",1,600},[6]={"PopCap Games",1,500},[7]={"PopCap Games",1,400},[8]={"PopCap Games",1,300},[9]={"PopCap Games",1,200},[10]={"PopCap Games",1,100},},["timed"]={[1]={"PopCap Games",1,2.8},[2]={"PopCap Games",1,2.6},[3]={"PopCap Games",1,2.4},[4]={"PopCap Games",1,2.2},[5]={"PopCap Games",1,2},[6]={"PopCap Games",1,1.8},[7]={"PopCap Games",1,1.6},[8]={"PopCap Games",1,1.4},[9]={"PopCap Games",1,1.2},[10]={"PopCap Games",1,1},},},},};e.debugArray=i;e.debugCurrentGameData=n;local function ot(t,e)if not e.animated then p(t.animationStack,e);e.animated=true;end end local function nt(l,t)if(l.maxScore)then local i=n l.score=t;i.score=t;if(BejeweledProfile.skill.rank>=2)then if(t>=1e5)and not(n.scoreTrack1)then n.scoreTrack1=true;e.skillBar:CheckSkill(e.const.SKILLTYPE_CLASSIC,e.const.SKILL_SCORE100K);end end if(BejeweledProfile.skill.rank>=3)then if(t>=25e4)and not(n.scoreTrack2)then n.scoreTrack2=true;e.skillBar:CheckSkill(e.const.SKILLTYPE_CLASSIC,e.const.SKILL_SCORE250K);end end if(BejeweledProfile.skill.rank>=5)then if(t>=5e5)and not(n.scoreTrack3)then n.scoreTrack3=true;e.skillBar:CheckSkill(e.const.SKILLTYPE_CLASSIC,e.const.SKILL_SCORE500K);end end if(BejeweledProfile.skill.rank>=6)then if(t>=75e4)and not(n.scoreTrack4)then n.scoreTrack4=true;e.skillBar:CheckSkill(e.const.SKILLTYPE_CLASSIC,e.const.SKILL_SCORE750K);end end if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE4A]then if(t>=1e6)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE4A);end end if(t>=l.maxScore)and not i.leveledUp then local o=e.gameStatusText;if(i.gameMode==m)then o:SetText("Level up");else o:SetText("Multiplier up");local o;if(math.fmod(n.level,2)==0)then o=n.level.."x";else o=string.format("%.1fx",(1+n.level*.5));end local t,n;for n=25,325,100 do t=e.animator:CreateFloatingText(n,135,o,2);t.fxType=N;t:Show();e.animator:Add(t);t=e.animator:CreateFloatingText(n,250,o,3,true);t:SetTextColor(1,1,1);t.fxType=N;t:Show();e.animator:Add(t);end end e.sound:Play("LevelUp");o:Show();o.background:Show();e.animator.hintObj:Hide();e.animator.hintObj.fxType=d;i.leveledUp=true;end l:UpdateBar();end end local function tt(t)if(t.mode==m)then if(t.lastScore~=t.score)then t.lastScore=t.score;e.dataText:SetText(e:NumberWithCommas(t.score));end if(n.leveledUp)then t.bar:SetWidth(t:GetWidth()-4);else t.bar:SetWidth((t.score-t.minScore+.5)/(t.maxScore-t.minScore)*(t:GetWidth()-4));end else local n=(t.score/t.timer.timeElapsed);if(t.score>0)then e.levelText:SetFormattedText("%.2f",n);else e.levelText:SetFormattedText("%.2f",0);end if not((t.mode==T)and(e.flightOptionWindow.learning))then local n,e,o;if(t.timer.timeLeft==-1)then t.text:SetText("Timing");else if(t.timer.timeLeft==t.timer.timeStart)then n=math.floor((t.timer.timeLeft)/60)e=math.floor((t.timer.timeLeft)-(n*60));elseif(t.timer.timeLeft==0)then n=0;e=0;o=.01;else n=math.floor((t.timer.timeLeft+1)/60)e=math.floor((t.timer.timeLeft+1)-(n*60));end if(e<10)then e="0"..e end t.text:SetFormattedText("%d:%s",n,e);if(t.timer.timeLeft==t.timer.timeStart)then t.bar:SetWidth(t:GetWidth()-4);else t.bar:SetWidth(o or(((t.timer.timeLeft+.1)/(t.timer.timeStart)*t:GetWidth())-4));end end else local n,e,o;if(t.timer.timeElapsed==0)then n=0;e=0;else n=math.floor((t.timer.timeElapsed+1)/60)e=math.floor((t.timer.timeElapsed+1)-(n*60));end if(e<10)then e="0"..e end if(t.timer.timeLeft==-1)then t.text:SetText("Timing");else t.text:SetFormattedText("%d:%s",n,e);end t.bar:SetWidth(t:GetWidth()-4);end end end local function et(e,n,t)e.minScore=n;e.maxScore=t;end local function Je(e,t,n)return e:SetScore(e.score+t);end local function _e(t,o,i)local n=n t.mode=o;e.levelText:SetText("1");e.levelBar.text:SetText("");if(o==m)then t:SetTimer()t:SetMinMaxScore(0,500);t:SetScore(0);t.bar:SetVertexColor(0,.5,1);e.dataBorder:SetWidth(128);e.levelBorder:SetWidth(94);e.levelTextCaption:SetText("|cFF11AAFFlvl|r")e.dataText:SetText("0");e.dataText:SetFont(l.."Contb___.ttf",12,"Outline");e.levelText:ClearAllPoints()e.levelText:SetPoint("Topright",-16,0);e.levelText:SetPoint("Bottomleft",48,1);e.levelText:SetJustifyH("LEFT");e.levelTextCaption:ClearAllPoints()e.levelTextCaption:SetPoint("Topright",e.levelText,"Topleft",5,0);e.levelTextCaption:SetWidth(20);e.levelTextCaption:SetHeight(30);else t:SetTimer(i)t:SetMinMaxScore(0,500*te[o]);t:SetScore(0);t.bar:SetVertexColor(0,1,0);e.dataBorder:SetWidth(76);e.levelBorder:SetWidth(130);e.levelTextCaption:SetText(" |cFF00FF00pps|r");e.dataText:SetText("1|cFF00FF00x");e.dataText:SetFont(l.."Contb___.ttf",10,"Outline");e.levelText:ClearAllPoints()e.levelText:SetPoint("Topleft",16,0);e.levelText:SetPoint("Bottomright",-48,1);e.levelText:SetJustifyH("RIGHT");e.levelTextCaption:ClearAllPoints()e.levelTextCaption:SetPoint("Topleft",e.levelText,"Topright",-5,0);e.levelTextCaption:SetPoint("Bottomright",-20,1);if(o==T)and(e.flightOptionWindow.learning)then t.timer.timeElapsed=i;t.timer.legJourney=i;end end end local function Ie(e,t)e.timer.timeLeft=t or(0);e.timer.timeStart=t or(0);e.timer.timeElapsed=0;e:StartTimer();end local function Ae(e)e.timer.elapsed=0;e.timer:Show();end local function Oe(e)e.timer:Hide();end local function ve(t,o)if(e.animator.newGameStart)then return;end if(o>1)then o=.1 end t.elapsed=t.elapsed+o;if(t.elapsed<.1)then return;end n.statDB.played=n.statDB.played+t.elapsed;BejeweledProfile.stats.played=BejeweledProfile.stats.played+t.elapsed;t.timeLeft=t.timeLeft-t.elapsed;t.timeElapsed=t.timeElapsed+t.elapsed;t.elapsed=0;if(e.levelBar.mode~=m)then if(e.levelBar.mode==T)then if(t.timeLeft<=0)then t.timeLeft=-1;e.flightOptionWindow.learning=true;if not e.flightOptionWindow.timer:IsShown()then e.flightOptionWindow.timer:Show();end else local e=e.flightOptionWindow.timer;if e.learning~=true then if(math.abs(t.timeLeft-e.timeRemaining)>.6)then t.timeLeft=e.timeRemaining;t.timeElapsed=e.timeElapsed;end end end else if(t.timeLeft<=0)then t.timeLeft=0;t.timeElapsed=t.timeStart;t:Hide();e:GameOver();end end e.levelBar:UpdateBar();end end local function Ee(o)local i,a,r,t;local t=n;local l;i=e.levelBar.timer.timeElapsed;a=math.floor(i/60);r=math.floor(i-(a*60));if(t.gameMode==m)then o.scoreCaption:SetText("Final Score");o.scoreValue:SetText(e:NumberWithCommas(t.score));if(t.score>n.statDB.score)then n.statDB.score=t.score;end l=tostring(BejeweledProfile.skill.rank)..UnitName("player").."*"..t.score;e:ParseScoreListData(BejeweledProfile.scoreList.friends,tostring(BejeweledProfile.skill.rank)..UnitName("player"),t.score);e:ParseScoreListData(BejeweledProfile.scoreList.guild,tostring(BejeweledProfile.skill.rank)..UnitName("player"),t.score);else o.scoreCaption:SetText("Points per Second");o.scoreValue:SetFormattedText("%.2f",(t.score/i));local o=(t.score/i);if(o>n.statDB.score)then n.statDB.score=o;end if(o>=250)then e.skillBar:CheckSkill(e.const.SKILLTYPE_TIMED,e.const.SKILL_PPS250);end if(o>=300)then e.skillBar:CheckSkill(e.const.SKILLTYPE_TIMED,e.const.SKILL_PPS300);end if(o>=350)then e.skillBar:CheckSkill(e.const.SKILLTYPE_TIMED,e.const.SKILL_PPS350);end l=tostring(BejeweledProfile.skill.rank)..UnitName("player").."*"..string.format("%.2f",(t.score/i));e:ParseScoreListData(BejeweledProfile.scoreList.friends,tostring(BejeweledProfile.skill.rank)..UnitName("player"),string.format("%.2f",(t.score/i)));e:ParseScoreListData(BejeweledProfile.scoreList.guild,tostring(BejeweledProfile.skill.rank)..UnitName("player"),string.format("%.2f",(t.score/i)));end o.publishButton:Show();if(BejeweledProfile.settings.publishScores)then e.network:Send("HSPub",l,"GUILD","");local n,t;for n=1,GetNumFriends()do t,_,_,_,online=GetFriendInfo(n)if(online)then e.network:Send("HSPub",l,"WHISPER",t);end end o.publishButton:Hide();end o.publishButton.dataDump=l;o.publishButton:Enable();o.timeValue:SetText(e:TotalTime(math.floor(i)));o.levelValue:SetText(t.level);o.cascadeValue:SetText(t.largestCascade);o.comboValue:SetText(t.largestCombo);e.levelBar.bar:SetVertexColor(1,0,0);e.levelBar.bar:SetWidth(e.levelBar:GetWidth()-4);e.levelBar.text:SetText("");e.levelBarButton:SetID(2);e.levelBarButton:Show();e.levelBarButton.text:SetText("New game");t.gameMode=nil;e.gameStatusText:Hide();if not(BejeweledData.firstGame)then BejeweledData.firstGame=true;e.popup.text:SetText(e.popup.text.tip3);e.popup:Hide();e.popup:Show();end end local function Ne(o,z)o.elapsed=o.elapsed+z;if(o.elapsed=H)then o.glowFrameDir=-1;o.glowFrame=H;end if(o.glowFrame<=1)then o.glowFrameDir=1;o.glowFrame=1;end local z=(o.glowFrame/H)*(1/(V+4));if(n.gameMode)then o.lightwaveElapsed=(o.lightwaveElapsed or(0))+o.elapsed;if(o.lightwaveElapsed>25)then o.lightwaveElapsed=0;for e=1,r do o:Add(o:CreateLightwave(i[e][1],e));end end end for n=1,r do for e=1,s do t=i[n][e];t.glowLevel=0;t.glow:SetAlpha(0);end end x=1;if(#o.newJewel>0)then for e=1,#o.newJewel do g(o.newJewel,1);end end local H=(F~=v)if(F==D)then if not o.spawnedJewels then o.spawnedJewels=true;n.gemsCleared=n.gemsCleared or(0);local a;for l=1,s do o.columnOffset[l]=c;if(o.spawningLevel)then o.columnOffset[l]=c+math.random(1,400);end for r=r,1,-1 do if i[r][l].contents==0 then t=i[r][l]if not o.spawningLevel then n.gemsCleared=n.gemsCleared+1;end p(o.newJewel,t);if o.spawningLevel and(n.level~=1)then if t.wasHyper then t.wasHyper=nil;n.hyperSpawn=(n.hyperSpawn or(0))+1;end if(t.bigStar)then t.bigStar:Hide();n.bigStarSpawn=(n.bigStarSpawn or(0))+1;t.bigStar:Hide();t.bigStar.fxEnd=nil;t.bigStar.explode=nil;t.bigStar.fxType=d;p(o.bigStarQueue,t.bigStar);t.bigStar=nil;t.explode=nil;end end e:ClearJewel(t,l,r);e:NewJewel(l,r,o.spawningLevel);a=math.random(30,50);if(o.spawningLevel)then a=a*2;end t.y=-o.columnOffset[l]-I-a;t.maxYOffset=o.columnOffset[l]+(c*(t.gridY-1))+I+a o.columnOffset[l]=o.columnOffset[l]+c+a;t.yOffset=0;if(o.spawningLevel)then t.yVel=0;else t.yVel=t.yVel or 0 end t.moving=E;t.fxType=A;t.fxFrame=1;o:Add(t);t:SetWidth(w);t:SetHeight(c);e:UpdateJewel(t);t:SetAlpha(1);if(t.lightWaveObj)then t.lightWaveObj:Hide();end t:ClearAllPoints();t:SetPoint("Topleft",t.x,-t.y);end end end local l;if(n.gameMode~=m)or(n.level==1)then for n=1,200 do if not e:FindMove()then for e=1,#o.newJewel do o.newJewel[e].contents=0;end for t=1,#o.newJewel do e:NewJewel(o.newJewel[t].gridX,o.newJewel[t].gridY,true);end else break;end if(n==1)then t=o:CreateBigStar(0,0,o.newJewel[1]);o.newJewel[1].explode=1;o.newJewel[1].fxType=P;o.newJewel[1].bigStar=t;o:Add(t);o.forceBlow=true;end end end if(o.spawningLevel)then if n.bigStarSpawn>0 then for e=1,n.bigStarSpawn do for e=1,6 do u=math.random(1,s);h=math.random(1,r);t=i[h][u];if not t.bigStar then t.bigStar=o:CreateBigStar(0,0,t);t.bigStar:Hide();o:Add(t.bigStar);break;end if(e==6)then for e=1,s*r do u=u+1;if(u>s)then u=1;h=h+1;if(h>r)then h=1;end end t=i[h][u];if not t.bigStar then t.bigStar=o:CreateBigStar(0,0,t);t.bigStar:Hide();o:Add(t.bigStar);break;end end end end end n.bigStarSpawn=0;end if n.hyperSpawn>0 then for e=1,n.hyperSpawn do for e=1,6 do u=math.random(1,s);h=math.random(1,r);t=i[h][u];if not t.bigStar and not t.spawnHyper then t.spawnHyper=true;break;end if(e==6)then for e=1,s*r do u=u+1;if(u>s)then u=1;h=h+1;if(h>r)then h=1;end end t=i[h][u];if not t.bigStar and not t.spawnHyper then t.spawnHyper=true;break;end end end end end n.hyperSpawn=0;end o.spawningLevel=nil;if not o.newGameStart then e:UpdateLevelScoreThreshold();end end if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE2A]then if(BejeweledProfile.stats.totalGemsMatched>=1e3)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE2A);end end end end if(F==We)then F=F+1;for r=r,1,-1 do for l=1,s do if(i[r][l].contents==0)then for a=r-1,1,-1 do if(i[a][l].contents~=0)then t=i[r][l];t.contents=i[a][l].contents;if i[a][l].bigStar then t.bigStar=i[a][l].bigStar;i[a][l].bigStar=nil;t.bigStar:ClearAllPoints();t.bigStar:SetPoint("Topleft",t,"Topleft");t.bigStar.parent=t;end i[a][l].contents=0;t.maxYOffset=t.y-i[a][l].y;t.y=i[a][l].y;t.needsOffset=nil;t.yOffset=i[a][l].yOffset or(0);t.yVel=i[a][l].yVel or(0);t.moving=E;t.fxType=L;t.fxFrame=1;if(t.contents==9)then t.fxType=f;end if(i[a][l]==n.nextSelectedJewel)then e:DeselectJewel(true);n.nextSelectedJewel=t;t.selector:Show();if(t.fxType~=f)then t.fxType=k t.fxEnd=nil;t.fxFrame=1;end t.highlight:SetAlpha(0);end o:Add(t);e:UpdateJewel(t);e:UpdateJewel(i[a][l]);t:ClearAllPoints();t:SetPoint("Topleft",t.x,-t.y);break;end end end end end end for m=1,#_ do t=_[x];t.movedOnce=nil;if(t.fxType==fe)then l=t.fxFrame+1;t.fxFrame=l;local e=t:GetParent();if(l==1)then if(e.gridX<8)then o:Add(o:CreateLightwave(i[e.gridY][e.gridX+1],0));end t.texture:SetTexCoord(unpack(b[2]));elseif(l==10)then t.fxType=d;p(o.lightwaveQueue,t);t:Hide();t:GetParent().lightWaveObj=nil;end if(l>0)and(e.y>=0)then t:SetAlpha((10-l)/10);else t:SetAlpha(0);end end if(F==v)then if(t.fxType==k)then l=t.fxFrame+1;if(l>je)then l=1;if(t.fxEnd)then t.fxEnd=nil;t.fxType=L;if not t.moving then t.fxType=d;end end end t.fxFrame=l;t.texture:SetTexCoord(unpack(C[l]));elseif(t.fxType==de)then l=t.fxFrame+1;if(l>Ge)then l=1;t.nextGlow=t.nextGlow+1;if(t.nextGlow>9)then t.nextGlow=1;end S=t.adj;if S and(S.fxType==q)then S.fxEnd=true;end local n=t.gridX+FX_SHINE_GRIDX[t.nextGlow];local e=t.gridY+FX_SHINE_GRIDY[t.nextGlow];if(n>=1)and(n<=8)and(e>=1)and(e<=8)and not t.fxEnd then S=i[e][n];if(math.fmod(t.nextGlow,2)==1)then S.nextGlow=t.nextGlow+1;else S.nextGlow=t.nextGlow-1;end if(S.fxType~=de)and(S.fxType~=k)and(S.fxType~=f)and(S.fxType~=A)and(S.fxType~=d)and not(S.moving)then y:Add(S);S.fxType=q;S.fxFrame=1;S.fxEnd=nil;S.highlight:SetTexCoord(unpack(b[FX_SHINE_KEYFRAME[S.nextGlow]]));S.highlight:SetAlpha(0);end else S=nil;end t.adj=S;if(t.fxEnd)then t.fxEnd=nil;t.fxType=nil;g(_,x);x=x-1;t.animated=nil;t.highlight:SetTexCoord(0,0,0,0);else t.highlight:SetTexCoord(unpack(b[FX_SHINE_KEYFRAME[t.nextGlow]]));end end t.fxFrame=l;t.highlight:SetAlpha(FX_SHINE_ALPHA[l]);elseif(t.fxType==q)then l=t.fxFrame+1;if(l>re)then t.fxEnd=true;l=1;end if(t.fxEnd)then t.fxEnd=nil;g(_,x);x=x-1;t.animated=nil;t.highlight:SetTexCoord(0,0,0,0);end t.fxFrame=l;t.highlight:SetAlpha(FX_SHINE_ALPHA[l]);end elseif(F==ee)then if(t.fxType==P)then t.markX=nil;t.markY=nil;if(t.score)then t:Show();t.fxType=N;if not t.notScore then e.levelBar:AddScore(t.score);end if(t.comboSound)then e.sound:Play("Combo",t.comboSound);t.comboSound=nil;end elseif(t.bigStarSpawn)then t.fxType=L;t.bigStar=t.bigStarSpawn;t.bigStarSpawn=nil;t.bigStar:Show();e.sound:Play("PowerCreate");if not(BejeweledData.firstPowerGem)then BejeweledData.firstPowerGem=true;e.popup.text:SetText(e.popup.text.tip1);e.popup.parent=t;e.popup:Hide();e.popup:Show();end elseif(t.hyperGemSpawn)then t.hyperGemSpawn=nil;y:CreateHyperGem(t);e.sound:Play("HyperCreate");if not(BejeweledData.firstHyperCube)then BejeweledData.firstHyperCube=true;e.popup.text:SetText(e.popup.text.tip2);e.popup.parent=t;e.popup:Hide();e.popup:Show();end elseif(t.hyperGemTrigger)then if not ne then ne=true;if(t.hyperGemDelay==1)then t.hyperGemDelay=nil;e:TriggerHyperGemItem(t)if not(t.explode)then t.fxEnd=nil;t.fxType=d;t.contents=0;e:UpdateJewel(t);end else t.hyperGemDelay=(t.hyperGemDelay or(0))+1;end end H=nil;elseif(t.bigStar)then if(t.explode)then if not U then U=true;if t.explodeDelay then t.fxType=L;t.bigStar:Hide();t.bigStar.fxEnd=true;t.bigStar=nil;t.explode=nil;p(y.animationStack,y:CreateExplosion(0,0,t));for n=-1,1 do if((t.gridY+n)>0)and((t.gridY+n)<=r)then for e=-1,1 do if((t.gridX+e)>0)and((t.gridX+e)<=s)then y:CreateShardSpawn(0,0,i[t.gridY+n][t.gridX+e],i[t.gridY+n][t.gridX+e].contents,e,n);if(e==0)then i[t.gridY+n][t.gridX+e].yVel=-20;else i[t.gridY+n][t.gridX+e].yVel=i[t.gridY+n][t.gridX+e].yVel or-10;end i[t.gridY+n][t.gridX+e].moving=E;i[t.gridY+n][t.gridX+e].yOffset=i[t.gridY+n][t.gridX+e].yOffset or(0);o:Add(i[t.gridY+n][t.gridX+e]);if(n==-1)then local n for n=t.gridY-1,1,-1 do if(e==0)then i[n][t.gridX+e].yVel=-20;else i[n][t.gridX+e].yVel=i[n][t.gridX+e].yVel or-10;end i[n][t.gridX+e].moving=E;i[n][t.gridX+e].yOffset=i[n][t.gridX+e].yOffset or(0);o:Add(i[n][t.gridX+e]);end end end end end end else t.explodeDelay=1;end end H=nil;end else l=t.fxFrame+1;if(l>Y)then l=1;t.fxEnd=nil;t.fxType=d;t.contents=0;e:UpdateJewel(t);else H=nil;end t.texture:SetWidth((Y-l+1)/Y*w)t.texture:SetHeight((Y-l+1)/Y*c)t.fxFrame=l;end end elseif(F==D)then if(t.moving==E)then t.movedOnce=true;t.yVel=t.yVel+R;a=t.yOffset+t.yVel;if(a>=t.maxYOffset)then a=t.maxYOffset;t.yOffset=0;t.maxYOffset=nil;else t.yOffset=a;end H=nil;if(t.maxYOffset==nil)then t.moving=nil;t.y=t.y+a;a=0;t.fxFrame=1;t.yVel=nil;if(t.fxType~=A)and(t.fxType~=f)then if not t.explode then t.fxType=d;end end e.sound:Play("GemClick");end t:ClearAllPoints();t:SetPoint("Topleft",t.x,-(t.y+a));end if(t.fxType==A)then a=t.y+t.yOffset;if(a>=0)then t.texture:SetTexCoord(unpack(C[1]));t.texture:ClearAllPoints()t.texture:SetPoint("Center")t.fxType=L;if(t.explode==1)then t.fxType=P;end if(t.spawnHyper)then t.spawnHyper=nil;o:CreateHyperGem(t);end t.texture:SetHeight(c)if(t.bigStar)then t.bigStar:Show();end if(t.lightWaveObj)then t.lightWaveObj:Show();end elseif(a>=-c)then u,le,h,te=unpack(C[1]);a=math.floor(a+c);t.texture:ClearAllPoints()t.texture:SetPoint("Bottom")t.texture:SetHeight(a);h=(c-a)/255 t.texture:SetTexCoord(u,le,h,te);if(t.lightWaveObj)then t.lightWaveObj:Hide();end else t.texture:SetTexCoord(0,0,0,0);if(t.lightWaveObj)then t.lightWaveObj:Hide();end end end end if(t.moving==E)and(not t.movedOnce)then t.movedOnce=true;t.yVel=t.yVel+(math.abs(t.yVel)*.1)+R;a=t.yOffset+t.yVel;if(t.maxYOffset)then if(a>=t.maxYOffset)then a=t.maxYOffset;t.yOffset=0;t.maxYOffset=nil;else t.yOffset=a;end if(t.maxYOffset==nil)then t.moving=nil;t.y=t.y+a;a=0;t.fxFrame=1;t.yVel=nil;if(t.fxType~=A)and(t.fxType~=f)then if not t.explode then t.fxType=d;end end e.sound:Play("GemClick");end else t.yOffset=a;end t:ClearAllPoints();t:SetPoint("Topleft",t.x,-(t.y+a));end if(t.fxType==f)then l=t.fxFrame+1;if(l>Ue)then l=1;if(t.fxEnd)then t.fxEnd=nil;end end t.fxFrame=l;t.texture:SetTexCoord(unpack(B[l]));local e;for n=-2,2 do if((t.gridY+n)>0)and((t.gridY+n)<=r)then for o=-2,2 do if((t.gridX+o)>0)and((t.gridX+o)<=s)then e=i[t.gridY+n][t.gridX+o];if(math.abs(n)==2)or(math.abs(o)==2)then e.glowLevel=math.min(e.glowLevel+1,V);else e.glowLevel=math.min(e.glowLevel+2,V);end if(e.fxType==k)or(e.y<-5)then e.glow:SetAlpha(0);else e.glow:SetAlpha(e.glowLevel*z);end end end end end elseif(t.fxType==ie)then l=t.fxFrame+.5;frame2=t.fxFrame2-2.5;if(l>se)then l=se-l;end if(frame2<=0)then frame2=se+frame2;end if(t.fxEnd)then t.fxEnd=nil;t.fxType=d;t:Hide();p(o.bigStarQueue,t);end t.fxFrame=l;t.fxFrame2=frame2;o:RotateTexture(t.texture,math.floor(l),.5,.5);o:RotateTexture(t.highlight,math.floor(frame2),.5,.5);G=t.fxAlpha+t.fxAlphaStep;if(G>100)then t.fxAlphaStep=-t.fxAlphaStep;G=100;elseif(G<0)then t.fxAlphaStep=-t.fxAlphaStep G=0;end t.fxAlpha=G t.texture:SetAlpha(G/100);t.highlight:SetAlpha((100-G)/100);local e;for n=-2,2 do if((t.parent.gridY+n)>0)and((t.parent.gridY+n)<=r)then for o=-2,2 do if((t.parent.gridX+o)>0)and((t.parent.gridX+o)<=s)then e=i[t.parent.gridY+n][t.parent.gridX+o];if(math.abs(n)==2)or(math.abs(o)==2)then e.glowLevel=math.min(e.glowLevel+1,V);else e.glowLevel=math.min(e.glowLevel+2,V);end if(e.fxType==k)or(e.y<-5)then e.glow:SetAlpha(0);else e.glow:SetAlpha(e.glowLevel*z);end end end end end elseif(t.fxType==ae)then l=t.fxFrame+1;if(l>Le)then l=1;if(t.fxEnd)then t.fxEnd=nil;t.fxType=d;t:Hide();end end t.x=t.x+t.xVel;t.y=t.y+t.yVel;t:ClearAllPoints();t:SetPoint("Topleft",t.x,-t.y);t.yVel=t.yVel+j;if(t.xVel>0)and(t.xVel<8)then t.xVel=t.xVel+.1;elseif(t.xVel<0)and(t.xVel>-8)then t.xVel=t.xVel-.1;end if(t.yVel>=oe)then t.fxType=d;elseif(t.yVel>M)then t:SetAlpha(1-((t.yVel-M)/M))end if(t.fxType==d)then t.fxEnd=nil;t:Hide();p(o.shardQueue,t);end t.fxFrame=l;t.texture:SetTexCoord(unpack(W[l]));elseif(t.fxType==Se)then l=t.fxFrame+1;if(l>ye)then t.fxType=d;end if(t.fxEnd)then t.fxEnd=nil;t.fxType=d;end if(t.fxType==d)then p(o.explosionQueue,t);t:Hide();else t.fxFrame=l;t.texture:SetTexCoord(unpack(O[l]));end elseif(t.fxType==he)then l=t.fxFrame+1;if(l>He)then t.fxType=d;end if(math.fmod(l,2)==1)then t.highlight:SetAlpha(.2);else t.highlight:SetAlpha(.6);end if(t.fxEnd)then t.fxEnd=nil;t.fxType=d;end if(t.fxType==d)then p(o.lightningQueue,t);t:Hide();t.highlight:Hide();else t.fxFrame=l;end elseif(t.fxType==N)then l=t.fxFrame+K;if(l>Q)then if(l>Q*2)then l=0;p(o.floatingTextQueue,t);t.fxType=d;t:Hide();else t:SetAlpha(1-((l-Q)/Q));end end if(t.notScore)then t.y=t.y+K;else t.y=t.y-K;end t:ClearAllPoints();t:SetPoint("Topleft",pe,"Topleft",t.x,-t.y);t.fxFrame=l;elseif(t.fxType==Pe)then t.fxFrame=t.fxFrame+o.elapsed;if(t.fxFrame>Ke)then t:Show();t.bounceY=t.bounceY+t.bounceDir;if(t.bounceDir==1)then if(t.bounceY>=10)then t.bounceDir=-1;t.bounceY=10;end else if(t.bounceY<=0)then t.bounceDir=1;t.bounceY=0;end end t:ClearAllPoints();t:SetPoint("Topleft",t.x,-t.y+t.bounceY);end end if(t.moving==ce)then T=t.xOffset+t.xMove*me;a=t.yOffset+t.yMove*me;local i if(T>=J)then T=t.xDir*J;t.xOffset=0;i=true;else t.xOffset=T;T=t.xDir*T;end if(a>=J)then a=t.yDir*J;t.yOffset=0;i=true;else t.yOffset=a;a=t.yDir*a;end if(i)then if t.invalidMove==1 then t.xDir=-t.xDir t.x=t.x+T;T=0 t.yDir=-t.yDir t.y=t.y+a;a=0 t.invalidMove=2;else t.moving=nil;if(t.invalidMove==2)then t.invalidMove=nil;t.x=t.x+T;t.y=t.y+a;T=0;a=0;end t.xOffset=0;t.yOffset=0;t.xMove=0;t.yMove=0;t.xDir=0;t.yDir=0;t.selector:Hide();if(t.bigStar)then t.bigStar:ClearAllPoints();t.bigStar:SetPoint("Topleft",t,"Topleft");end if(t.fxType~=P)and(t.fxType~=f)and(t.fxType~=A)then t.fxType=d end if(t.hyperGemContents)then if(t.swapJewel and(t.swapJewel.contents==9))then t.swapJewel.fxType=d;t.swapJewel.contents=0 e:GenerateScore(1,t.swapJewel,t.hyperGemContents,nil,true,0,true);end t.fxType=P;t.hyperGemTrigger=true;F=ee H=nil;end o.movingJewels=o.movingJewels-1;t.fxFrame=1;e:UpdateJewel(t);if(o.movingJewels==0)then n.selectedJewel=nil;o.animationStatus=ee;end end T=0;a=0;end t:ClearAllPoints();t:SetPoint("Topleft",t.x+T,-(t.y+a));elseif(t.moving==ge)then t.x=t.x+t.xVel;t.y=t.y+t.yVel;t:ClearAllPoints();t:SetPoint("Topleft",t.x,-t.y);t.yVel=t.yVel+j;if(t.yVel>=oe)then t.fxType=d;elseif(t.yVel>M)then t:SetAlpha(1-((t.yVel-M)/M))end if(t.fxType==d)then t.fxEnd=nil;t.contents=0;t.x=(t.gridX-1)*w t.y=(t.gridY-1)*c t.yVel=0;t:SetAlpha(0);else H=nil;end end if(t.fxType==d)and not t.lightWave then g(_,x);t.animated=nil;t.fxType=L;else x=x+1;end end if(o.newGameStart==true)then o.countdown=(o.countdown or(0))-o.elapsed;if(o.countdown<0)then if(o.hintObj)then o.hintObj.fxFrame=0;end o.countdown=1;o.countdownState=(o.countdownState or(4))-1;if(o.countdownState>0)then if(o.countdownState==3)then e.sound:Play("GetReady");end e.gameStatusText:SetText(tostring(o.countdownState));e.gameStatusText:Show();e.gameStatusText.background:Show();else o.countdownState=nil;o.countdown=nil;o.newGameStart=nil;e.gameStatusText:SetText("Go");e.sound:Play("Go");if not BejeweledProfile.settings.disableHints then o:Add(o:CreateHint(e:FindMove()));end if(n.gameMode~=m)then e.levelBar:StartTimer();end local t={mode="OUT",timeToFade=3,startAlpha=1,endAlpha=0,finishedFunc=function()e.gameStatusText:SetAlpha(1);e.gameStatusText.background:SetAlpha(1);e.gameStatusText:Hide();e.gameStatusText.background:Hide();end};UIFrameFade(e.gameStatusText,t);UIFrameFade(e.gameStatusText.background,t);n.moveAllowed=true;end end end if(H==true)then o.animationStatus=F+1;if(o.animationStatus==D)then o.spawnedJewels=nil;end if(o.animationStatus==ue)and(o.newGameStart)then o.animationStatus=v;end if(o.animationStatus==ue)or(o.animationStatus>X)then Z=e:CheckForClusters()if Z or(o.forceBlow==true)then o.animationStatus=ee o.forceBlow=nil;else if(n.gemsCleared or(0))>=10 then e.skillBar:CheckSkill(e.const.SKILLTYPE_GEMCOMBO,e.const.SKILL_CLEAR10);end if(n.gemsCleared or(0))>=15 then e.skillBar:CheckSkill(e.const.SKILLTYPE_GEMCOMBO,e.const.SKILL_CLEAR15);end if(n.gemsCleared or(0))>=20 then e.skillBar:CheckSkill(e.const.SKILLTYPE_GEMCOMBO,e.const.SKILL_CLEAR20);end if(n.gemsCleared or(0))>=25 then e.skillBar:CheckSkill(e.const.SKILLTYPE_GEMCOMBO,e.const.SKILL_CLEAR25);end n.gemsCleared=0;if(n.leveledUp)then n.leveledUp=nil;n.levelingUp=true;o.animationStatus=X;o.spawningLevel=true;e:WipeBoard();else if(o.animationStatus>X)then if(n.gameOver)then e.summaryScreen:FillData();e.summaryScreen:Show();o.animationStatus=v;else o.animationStatus=D;o.spawnedJewels=nil;end o.spawnedJewels=nil;else if not n.gameOver then if(n.levelingUp)then UIFrameFadeOut(e.gameStatusText,2)UIFrameFadeOut(e.gameStatusText.background,2)else e.gameStatusText:Hide();e.gameStatusText.background:Hide();end end n.levelingUp=nil;o.animationStatus=v;if not n.gameOver then n.moveAllowed=true;end if(n.combo>n.largestCombo)then n.largestCombo=n.combo;end if(n.combo>BejeweledProfile.stats.largestCombo)then BejeweledProfile.stats.largestCombo=n.combo;end if(n.nextSelectedJewel)then n.selectedJewel=n.nextSelectedJewel;n.nextSelectedJewel=nil;if(n.selectedJewel.fxType~=f)then n.selectedJewel.fxType=k n.selectedJewel.fxEnd=nil;n.selectedJewel.fxFrame=1;end o:Add(n.selectedJewel);end n.combo=0;n.explosions=0;t=e:FindMove();if not t then e:GameOver();else if not BejeweledProfile.settings.disableHints then o:Add(o:CreateHint(t));end if(n.gameMode==m)then e:UpdateSavedState();end end if(n.currentMouseOver)then e:UpdateMouseOver(n.currentMouseOver);n.currentMouseOver=nil;end end end end end end o.elapsed=0;end local function F(e,t)if(UnitFactionGroup("player")=="Horde")then ne={[1]={["146,244"]={["176,165"]=270,["159,229"]=79,["202,270"]=194,["169,279"]=161,["198,195"]=248,["199,224"]=237,["129,220"]=137,},["179,126"]={["166,137"]=49,["176,165"]=165,["173,93"]=106,["191,69"]=221,["184,105"]=65,["198,195"]=230,["191,158"]=91,["142,154"]=231,},["139,107"]={["131,73"]=130,["176,165"]=269,["173,93"]=107,["191,69"]=193,["100,146"]=226,["142,154"]=261,},["166,137"]={["179,126"]=49,["176,165"]=84,["173,93"]=126,["142,154"]=116,},["131,73"]={["191,69"]=247,["139,107"]=130,["157,83"]=97,},["176,165"]={["146,244"]=244,["179,126"]=164,["139,107"]=255,["166,137"]=92,["173,93"]=189,["191,69"]=311,["198,195"]=135,["191,158"]=51,["175,204"]=161,["128,185"]=144,["142,154"]=174,["199,224"]=171,["129,220"]=231,},["159,229"]={["146,244"]=139,["175,204"]=82,["129,220"]=115,},["202,270"]={["146,244"]=197,["169,279"]=145,["198,195"]=297,["199,224"]=135,},["173,93"]={["179,126"]=106,["139,107"]=123,["166,137"]=136,["176,165"]=188,["191,69"]=93,["184,105"]=70,["142,154"]=220,},["191,69"]={["179,126"]=223,["139,107"]=195,["131,73"]=242,["176,165"]=307,["173,93"]=89,["157,83"]=107,["191,158"]=243,["198,195"]=352,["142,154"]=305,},["157,83"]={["131,73"]=100,["191,69"]=113,},["169,279"]={["146,244"]=161,["202,270"]=147,["142,154"]=409,},["184,105"]={["179,126"]=65,["173,93"]=71,},["198,195"]={["146,244"]=250,["179,126"]=231,["176,165"]=112,["202,270"]=322,["191,69"]=418,["191,158"]=108,["175,204"]=92,["142,154"]=227,["199,224"]=97,},["191,158"]={["179,126"]=99,["176,165"]=68,["191,69"]=241,["198,195"]=108,},["100,146"]={["139,107"]=205,["142,154"]=173,["128,185"]=201,},["175,204"]={["176,165"]=165,["159,229"]=86,["198,195"]=95,["199,224"]=94,["129,220"]=168,},["128,185"]={["176,165"]=152,["100,146"]=199,["142,154"]=317,["129,220"]=121,},["142,154"]={["179,126"]=239,["139,107"]=255,["166,137"]=112,["176,165"]=159,["173,93"]=205,["191,69"]=293,["198,195"]=209,["100,146"]=161,["128,185"]=197,["199,224"]=270,["129,220"]=266,},["199,224"]={["146,244"]=239,["176,165"]=251,["202,270"]=130,["198,195"]=101,["175,204"]=93,["142,154"]=258,},["129,220"]={["146,244"]=137,["176,165"]=230,["159,229"]=121,["175,204"]=170,["128,185"]=121,["142,154"]=247,},},[2]={["193,255"]={["182,265"]=45,["192,230"]=103,["184,331"]=251,},["131,221"]={["158,120"]=491,["192,230"]=264,["144,202"]=142,["186,194"]=286,["172,190"]=302,["117,207"]=107,},["172,190"]={["117,207"]=107,["158,120"]=260,["131,221"]=260,["144,202"]=118,["186,194"]=90,},["170,74"]={["158,120"]=287,["129,25"]=262,["133,50"]=190,["158,110"]=199,},["144,202"]={["131,221"]=139,["186,194"]=193,["172,190"]=118,["117,207"]=101,},["133,50"]={["158,120"]=318,["170,74"]=189,["129,25"]=80,["158,110"]=199,},["146,121"]={["158,120"]=69,["158,110"]=61,},["117,207"]={["131,221"]=114,["144,202"]=96,},["184,331"]={["193,255"]=234,["186,287"]=167,},["186,287"]={["182,265"]=61,["184,331"]=185,},["129,25"]={["133,50"]=76,["158,120"]=315,["170,74"]=252,},["182,265"]={["186,287"]=75,["192,230"]=62,["193,255"]=54,},["158,120"]={["131,221"]=500,["170,74"]=283,["133,50"]=316,["172,190"]=258,["129,25"]=299,["146,121"]=58,["158,110"]=89,},["192,230"]={["131,221"]=260,["186,194"]=142,["182,265"]=58,["193,255"]=97,},["186,194"]={["144,202"]=163,["131,221"]=286,["172,190"]=160,["192,230"]=140,},["172,190"]={["131,221"]=257,["144,202"]=118,["186,194"]=92,["158,120"]=261,},["158,110"]={["158,120"]=89,["170,74"]=200,["146,121"]=62,["133,50"]=207},},[3]={["73,174"]={["119,238"]=113,["91,132"]=82,["138,115"]=153,["140,170"]=113,["169,151"]=149,},["140,170"]={["119,238"]=108,["73,174"]=112,["153,226"]=70,["138,115"]=88,["169,151"]=63,},["119,238"]={["198,287"]=159,["73,174"]=149,["133,253"]=27,["182,256"]=98,["153,226"]=69,["140,170"]=117,},["248,163"]={["206,174"]=61,["169,151"]=120,},["255,80"]={["208,81"]=68,},["245,51"]={["208,81"]=62,},["206,174"]={["214,130"]=68,["248,163"]=71.25,["160,94"]=131,["169,151"]=68,},["208,81"]={["255,80"]=85,["160,94"]=70,["245,51"]=73,},["182,256"]={["198,287"]=49,["133,253"]=81,["153,226"]=66,["119,238"]=109,["227,253"]=67,},["160,94"]={["208,81"]=66,["206,174"]=127,["138,115"]=55,},["153,226"]={["119,238"]=68,["182,256"]=60,["140,170"]=74,},["198,287"]={["182,256"]=57,["119,238"]=157,["227,253"]=70,},["91,132"]={["73,174"]=68,["138,115"]=78,["169,151"]=126,},["138,115"]={["91,132"]=86,["73,174"]=137,["140,170"]=82,["160,94"]=69,["169,151"]=78,},["133,253"]={["182,256"]=78,["119,238"]=33,},["214,130"]={["206,174"]=64,},["169,151"]={["91,132"]=135,["73,174"]=151,["138,115"]=73,["206,174"]=75,["140,170"]=70,},["227,253"]={["198,287"]=61,["182,256"]=65,},},}else ne={[1]={["190,67"]={["191,158"]=244,["157,83"]=105,["201,116"]=155,["152,106"]=177,["132,73"]=199,},["123,210"]={["125,173"]=128,["135,263"]=179,["146,212"]=156,},["132,73"]={["190,67"]=190,["99,108"]=176,["157,83"]=94,},["201,116"]={["146,212"]=370,["191,158"]=116,["190,67"]=158,["135,263"]=530,["125,173"]=335,["152,106"]=164,["192,211"]=235,["184,105"]=65,},["67,259"]={["69,290"]=78,},["159,229"]={["167,261"]=128,["183,215"]=104,["146,212"]=81,},["203,269"]={["167,261"]=108,["192,211"]=168,["174,279"]=112,},["174,279"]={["167,261"]=62,["135,263"]=143,["203,269"]=120,},["69,290"]={["67,259"]=78,},["125,173"]={["201,116"]=308,["135,263"]=283,["123,210"]=121,["99,108"]=233,},["192,211"]={["135,263"]=303,["191,158"]=137,["167,261"]=285,["201,116"]=241,["203,269"]=179,["183,215"]=28,["146,212"]=151,},["183,215"]={["159,229"]=110,["192,211"]=29,["146,212"]=143,},["184,105"]={["201,116"]=53,["152,106"]=106,},["131,296"]={["135,263"]=86,},["135,263"]={["174,279"]=152,["125,173"]=294,["192,211"]=301,["131,296"]=86,["201,116"]=445,["167,261"]=191,["123,210"]=182,["99,108"]=475,["146,212"]=169,},["191,158"]={["201,116"]=107,["190,67"]=246,["192,211"]=131,["146,212"]=198,},["157,83"]={["190,67"]=105,["132,73"]=95,},["167,261"]={["159,229"]=129,["203,269"]=108,["174,279"]=68,["192,211"]=283,["135,263"]=189,},["152,106"]={["201,116"]=160,["190,67"]=172,["99,108"]=179,["184,105"]=87,},["99,108"]={["125,173"]=228,["135,263"]=554,["152,106"]=155,["132,73"]=154,},["146,212"]={["159,229"]=80,["135,263"]=150,["191,158"]=194,["201,116"]=389,["183,215"]=135,["123,210"]=156,["192,211"]=149,},["173,284"]={["131,296"]=152,},},[2]={["123,72"]={["137,63"]=63,["129,93"]=87,["129,25"]=186,["148,73"]=98,["159,86"]=132,},["140,193"]={["150,213"]=82,["143,155"]=111,["162,186"]=74,["156,205"]=73,["147,143"]=207,},["150,213"]={["193,229"]=147,["140,193"]=86,["156,205"]=66,["147,143"]=261,},["193,229"]={["193,255"]=56,["150,213"]=150,["147,143"]=369,["184,331"]=61,["156,205"]=163,},["159,86"]={["123,72"]=136,["164,99"]=62,["148,73"]=62,["129,93"]=114,},["156,205"]={["140,193"]=69,["150,213"]=54,["193,229"]=165,["162,186"]=77,["147,143"]=247,},["164,99"]={["129,93"]=153,["159,86"]=64,["172,66"]=198,["147,121"]=92,},["193,255"]={["193,229"]=51,["184,331"]=252,},["147,121"]={["164,99"]=91,["166,135"]=89,["129,93"]=127,["147,143"]=90,},["148,73"]={["123,72"]=94,["172,66"]=98,["137,63"]=48,["159,86"]=61,["129,93"]=83,["129,25"]=172,},["172,66"]={["164,99"]=210,["148,73"]=91,["129,93"]=190,},["137,63"]={["123,72"]=67,["129,25"]=116,["148,73"]=50,["129,93"]=98,},["129,25"]={["123,72"]=149,["129,93"]=200,["148,73"]=168,["137,63"]=118,},["166,135"]={["143,155"]=154,["162,186"]=164,["147,121"]=83,["147,143"]=110,},["129,93"]={["123,72"]=79,["172,66"]=177,["137,63"]=93,["159,86"]=114,["164,99"]=154,["129,25"]=200,["147,121"]=134,["148,73"]=117,["147,143"]=217,},["143,155"]={["140,193"]=108,["166,135"]=163,["162,186"]=115,["147,143"]=90,},["162,186"]={["140,193"]=88,["143,155"]=127,["156,205"]=73,["166,135"]=171,["147,143"]=272,},["184,331"]={["193,255"]=229,["193,229"]=266,},["147,143"]={["140,193"]=216,["150,213"]=258,["193,229"]=350,["129,93"]=201,["156,205"]=241,["184,331"]=428,["143,155"]=115,["162,186"]=204,["147,121"]=85,["166,135"]=102,},},[3]={["165,174"]={["204,149"]=88,["118,174"]=82,},["245,51"]={["219,54"]=43,},["132,221"]={["182,256"]=85,["99,231"]=61,["118,174"]=73,["133,253"]=54,},["204,149"]={["175,82"]=119,["138,115"]=121,["248,158"]=66,["236,176"]=57,["165,174"]=77,},["248,158"]={["165,174"]=117,["236,176"]=28,["204,149"]=74,},["236,176"]={["204,149"]=59,["248,158"]=33,},["99,231"]={["198,287"]=155,["118,174"]=83,["133,253"]=52,["182,256"]=120,["132,221"]=58,["84,196"]=76,},["118,174"]={["165,174"]=82,["138,115"]=98,["132,221"]=69,["84,196"]=64,["99,231"]=92,["86,90"]=126,},["182,256"]={["198,287"]=49,["99,231"]=127,["133,253"]=82,["132,221"]=90,["227,253"]=67,},["86,90"]={["175,82"]=123,["118,174"]=128,["138,115"]=89,},["198,287"]={["182,256"]=56.35,["99,231"]=155,["227,253"]=70,},["255,80"]={["219,54"]=82,},["138,115"]={["118,174"]=85,["175,82"]=77,["204,149"]=112,["86,90"]=89,},["133,253"]={["182,256"]=78,["99,231"]=56,["132,221"]=45,},["219,54"]={["255,80"]=85,["175,82"]=102,["245,51"]=44,},["84,196"]={["118,174"]=54,["99,231"]=66,},["175,82"]={["219,54"]=80,["204,149"]=98,["138,115"]=76,["86,90"]=150,},["227,253"]={["182,256"]=66,["198,287"]=58,},},};end e:SetScript("OnEvent",function()end);e:UnregisterEvent("PLAYER_ENTERING_WORLD");F=nil;collectgarbage();end local function H(i,l,e,o,n)if(e<=0)then e=360+e end local t=i.tableSin[e];local e=i.tableCos[e];l:SetTexCoord(o-t,n+e,o+e,n+t,o-e,n-t,o+t,n-e);end function e:GamePaused(a)local o,o,l,t;if(a==true)and((bCrowbar==nil)or((bCrowbar)and(not bCrowbar.jewelEdit)))then l="Hide";else l="Show";end e.paused=a;local o=n.gameMode;for e=1,r do for n=1,s do t=i[e][n];if(o==m)or(o==T)then if(l=="Hide")then if not(t.oldAlphaJewel)then t.oldAlphaJewel=t:GetAlpha();t:SetAlpha(t.oldAlphaJewel/2);end else t:SetAlpha((t.oldAlphaJewel or(.5))*2);t.oldAlphaJewel=nil;end else t[l](t);end end end if(o==T)then e.animator:Show();else e.animator[l](e.animator);if(o==j)then if(l=="Show")then e.pausedText:Hide();else e.pausedText:Show();end end end local i=e.animator.animationStack;for n=0,#i do if(n==0)then t=e.animator.hintObj;else t=i[n];end if(t)then if(a==true)then if(o==m)or(o==T)then if(t:IsShown())then t.wasShown=true;if not t.oldAlpha then t.oldAlpha=t:GetAlpha();if not(t.contents)then t:SetAlpha(t.oldAlpha/2);end end end else if(t:IsShown())then t.wasShown=true;t:Hide();end end else if(o==m)then if(t.wasShown)then t.wasShown=nil;if not(t.contents)then t:SetAlpha((t.oldAlpha or(.5))*2);end t.oldAlpha=nil;end else if(t.wasShown)then t.wasShown=nil;t:Show();end end end end end if(a)and(o~=T)then e.levelBar.timer:Hide();else if not n.gameOver and(n.gameMode)then e.levelBar.timer:Show();else e.levelBar.timer:Hide();end end end function e:UpdateFlightTimes()local t=e.flightOptionWindow;if(#t.pathArray>0)then local n=math.floor(t.timer.legJourney+.75);local e=g(t.pathArray,1);local o=g(t.pathArray,1);local i=g(t.pathArray,1);if(#t.pathArray>0)then n=n+1.35 end SetMapToCurrentZone();if(i==0)or(math.abs(n-i)>5)then BejeweledData.flightTimes[GetCurrentMapContinent()]=BejeweledData.flightTimes[GetCurrentMapContinent()]or{};BejeweledData.flightTimes[GetCurrentMapContinent()][e]=BejeweledData.flightTimes[GetCurrentMapContinent()][e]or{}BejeweledData.flightTimes[GetCurrentMapContinent()][e][o]=n;else BejeweledData.flightTimes[GetCurrentMapContinent()]=BejeweledData.flightTimes[GetCurrentMapContinent()]or{};BejeweledData.flightTimes[GetCurrentMapContinent()][e]=BejeweledData.flightTimes[GetCurrentMapContinent()][e]or{}BejeweledData.flightTimes[GetCurrentMapContinent()][e][o]=((BejeweledData.flightTimes[GetCurrentMapContinent()][e][o]or(n))+n)/2;end end t.timer.legJourney=0;end local function E(i,t)local o=e.flightOptionWindow;if(t=="PLAYER_LEAVING_WORLD")then i.switchingZones=true;end if(t=="PLAYER_CONTROL_GAINED")then if(i.switchingZones)then i.switchingZones=nil;return;end local t=(n.gameMode==T);if(o.timer.timeElapsed)then o.timer:Hide();if(e.timedWindow:IsVisible())then e.timedWindow:SetHeight(x-80);e.timedWindow.flightCheckbox:Hide();e.timedWindow.flightCheckboxCaption:Hide();e.timedWindow.flightCheckbox:SetChecked(nil);e.timedWindow.timerRemainingCaption:Hide();e.timedWindow.timeRemainingValue:Hide();end e:UpdateFlightTimes();e.window:UnregisterEvent("PLAYER_MONEY");e.window:UnregisterEvent("PLAYER_CONTROL_GAINED");e.window:UnregisterEvent("PLAYER_LEAVING_WORLD");if(n.gameMode==T)then if(e.levelBar.timer.timeElapsed)then if(o.timer.timeElapsed)then if(math.abs(o.timer.timeElapsed-e.levelBar.timer.timeElapsed)>1)then e.levelBar.timer.timeElapsed=o.timer.timeElapsed;end end e.levelBar.timer:Hide();e:GameOver();end end o.timer.learnEvent=nil;o.timer.elapsed=nil;o.timer.timeElapsed=nil;o.learning=nil;if(BejeweledProfile.settings.closeFlightEnd)and e.window:IsShown()then if not e.popup:IsVisible()then e.const.windowGameOverFadeOut.fadeTimer=0;UIFrameFade(e.window,e.const.windowGameOverFadeOut)e.window.mouseOverScreen:Show();e.window.hiding=true;end end end elseif(t=="PLAYER_MONEY")then e:UpdateFlightTimes();elseif(t=="VARIABLES_LOADED")then e:VariablesLoaded();elseif(t=="PLAYER_ENTERING_WORLD")and not e.loggedIn then e.loggedIn=true;local n=tostring(BejeweledProfile.skill.rank)..UnitName("player").."*"..BejeweledProfile.stats.classic.score.."*"..tostring(BejeweledProfile.skill.rank)..UnitName("player").."*"..string.format("%.2f",BejeweledProfile.stats.timed.score);if IsInGuild()then GuildRoster();end e.network:Send("LogSync","","GUILD","");e.network:Send("HSPub",n,"GUILD","");local o,t;for o=1,GetNumFriends()do t,_,_,_,online=GetFriendInfo(o)if(online)then e.network:Send("LogSync","","WHISPER",t);e.network:Send("HSPub",n,"WHISPER",t);end end if not(BejeweledData.legalDisplayed)then e.window:Show();e:ShowLegal();else e.window.splash.elapsed=0;end e.ShowLegal=nil;if(BejeweledProfile.settings.openLogin)then e.window:Show();end elseif(t=="FRIENDLIST_UPDATE")then e.network.friendUpdate=true;elseif(t=="GUILD_ROSTER_UPDATE")then e.network.guildUpdate=true;elseif(t=="PLAYER_DEAD")then if(BejeweledProfile.settings.openOnDeath)then e.window:Show();end elseif(t=="READY_CHECK")then if(BejeweledProfile.settings.closeReadyCheck)then if not e.popup:IsVisible()then e.window:Hide();end end elseif(t=="PLAYER_REGEN_DISABLED")then if(e.paused~=true)or(n.gameMode)then BejeweledProfile.stats.combatPause=BejeweledProfile.stats.combatPause+1;end if(BejeweledProfile.settings.closeCombat)then if not e.popup:IsVisible()then e.window:Hide();end end end end function e:LoadAchievementEvents()local o=BejeweledProfile.skill;local t=CreateFrame("Frame","BejeweledEventWatcher",UIParent);t:SetWidth(1);t:SetHeight(1);t:SetPoint("Top");t:Show();t.eventList={};t:SetScript("OnEvent",function(i,o,...)if n.gameMode and e.window:IsVisible()then local l,e,n;e=1;for l=1,#t.eventList[o]do n=t.eventList[o][e](i,o,...);if(n==true)then g(i.eventList[o],e);else e=e+1;end end if#t.eventList[o]==0 then t.eventList[o]=nil;i:UnregisterEvent(o);end end end);t.AddEvent=function(t,e,n)t.eventList[e]=t.eventList[e]or{}p(t.eventList[e],n);t:RegisterEvent(e);end if not o.gainFun1 then t:AddEvent("COMBAT_LOG_EVENT_UNFILTERED",function(t,t,...)local n=0;local t=select(2,...);if(t=="ENVIRONMENTAL_DAMAGE")then unitName,_,t,damageAmount=select(7,...);if(t=="FALLING")and(unitName==UnitName("player"))and(damageAmount)then local t=UnitHealth("player")-damageAmount;if UnitIsDeadOrGhost("player")or(UnitHealth("player")<2)or(t<=0)then n=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK1A);end end end return(n~=0)end);end if not o.gainFun2 then t:AddEvent("UPDATE_BATTLEFIELD_STATUS",function(t,t,...)local t=0;local n;for n=1,MAX_BATTLEFIELD_QUEUES do bgStatus=GetBattlefieldStatus(n);if(bgStatus=="queued")then t=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK1B);end end return(t~=0)end);end if not o.gainFun3 then e.lootText=string.gsub(LOOT_ITEM_SELF,"%%s","(.*)");t:AddEvent("CHAT_MSG_LOOT",function(t,t,...)local n=0;local t,o=select(1,...);if(string.find(t,e.lootText))then t=string.match(t,e.lootText)or("");local t=select(3,GetItemInfo(t));if(t==3)then n=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK2A);end end return(n~=0)end);end if not o.gainFun4 then t:AddEvent("COMBAT_LOG_EVENT_UNFILTERED",function(t,t,...)local t=0;local i,o,l,l,n=select(2,...);if(i=="PARTY_KILL")and(o==UnitGUID("player"))and(n==UnitGUID("target"))then if UnitCreatureType("target")=="Critter"then t=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK2B);end end return(t~=0)end);end if not o.gainFun5 then t:AddEvent("RESURRECT_REQUEST",function(t,t,...)local e=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK2C);return(e~=0)end);end if not o.gainFun6 then e.lootText=string.gsub(LOOT_ITEM_SELF,"%%s","(.*)");t:AddEvent("CHAT_MSG_LOOT",function(t,t,...)local n=0;local t,o=select(1,...);if(string.find(t,e.lootText))then t=string.match(t,e.lootText)or("");local t=select(3,GetItemInfo(t));if(t==4)then n=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK3A);end end return(n~=0)end);end if not o.gainFun7 then hooksecurefunc("ConfirmReadyCheck",function(t)if not o.gainFun7 then if(t)then skillTrigger=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK3B);end end end);end if not o.gainFun8 then t:AddEvent("COMBAT_LOG_EVENT_UNFILTERED",function(t,t,...)local o=0;local t,l,l,l,l,i,l,l,n=select(2,...);if(i==UnitName("player"))and(t~="FALLING")and(n)then if(t=="SWING_DAMAGE")or(t=="RANGE_DAMAGE")or(t=="SPELL_DAMAGE")or(t=="SPELL_PERIODIC_DAMAGE")then n=tonumber(n)or(0);local t=UnitHealth("player")-n;if(t<=0)or UnitIsDeadOrGhost("player")or(UnitHealth("player")<=2)then o=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK3C);end end end return(o~=0)end);end if not o.gainFun9 then t:AddEvent("COMBAT_LOG_EVENT_UNFILTERED",function(t,t,...)local t=0;local n,o,l,l,i=select(2,...);if(n=="PARTY_KILL")and(o==UnitGUID("player"))and(i==UnitGUID("target"))then if UnitClassification("target")=="elite"then t=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK4A);end end return(t~=0)end);end if not o.gainFun10 then t:AddEvent("RAID_INSTANCE_WELCOME",function(t,t,...)local e=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK4B);return(e~=0)end);end if not o.gainFun11 then e.repText=string.gsub(FACTION_STANDING_CHANGED,"%%s","(.*)")t:AddEvent("CHAT_MSG_SYSTEM",function(t,t,...)local t=0;local n=select(1,...);if string.find(n,e.repText)then t=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK4C);end return(t~=0)end);end if not o.gainFun12 then t:AddEvent("CHAT_MSG_COMBAT_HONOR_GAIN",function(t,t,...)local e=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK5A);return(e~=0)end);end if not o.gainFun13 then t:AddEvent("COMBAT_LOG_EVENT_UNFILTERED",function(t,t,...)local t=0;local i,o,l,l,n=select(2,...);if(i=="PARTY_KILL")and(o==UnitGUID("player"))and(n==UnitGUID("target"))then if UnitClassification("target")=="rare"then t=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK5B);end end return(t~=0)end);end if(not o.gainFun14)then t:AddEvent("PLAYER_LEVEL_UP",function(t,t,...)local e=e.skillBar:CheckSkill(e.const.SKILLTYPE_FUN,e.const.SKILL_FUNRANK6A);return(e~=0)end);end if(not o.gainFun15)then t:AddEvent("UPDATE_BATTLEFIELD_SCORE",function(t,t,...)local n=0;local t;teamName1,oldTeamRating1,newTeamRating1=GetBattlefieldTeamInfo(0);teamName2,oldTeamRating2,newTeamRating2=GetBattlefieldTeamInfo(1);if(oldTeamRating1~=0)and(oldTeamRating2~=0)then if(teamName1==GetArenaTeam(1))or(teamName1==GetArenaTeam(2))or(teamName1==GetArenaTeam(3))then if(oldTeamRating1=t[10][3])then if(BejeweledProfile.settings.hideDuplicates)then for e=1,10 do if(i==t[e][1])then r=nil;if(n>t[e][3])then r=true;for e=e,9 do t[e][1]=t[e+1][1];t[e][2]=t[e+1][2];t[e][3]=t[e+1][3];if(t[e][1]=="PopCap Games")then l=t[e][3]-d;end end t[10][1]="PopCap Games";t[10][2]=1;t[10][3]=l;end break;end end end o=nil;if(r)then for e=10,1,-1 do if(n==t[e][3])and(i==t[e][1])then o=nil;break;end if(n>t[e][3])then o=e;else break;end end if(o)then for e=10,o+1,-1 do if(t[e-1][1]~=h)and(t[e-1][1]~="PopCap Games")then S=true;end t[e][1]=t[e-1][1]t[e][2]=t[e-1][2]t[e][3]=t[e-1][3]end t[o][1]=i;t[o][2]=s;t[o][3]=n;end if(S)then if(t==a.classic)then if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE1A]then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE1A);end else if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE3B]then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE3B);end end end end end end end function e:CheckName(o,n)if(n~="PopCap Games")then local t=BejeweledProfile.skill[o];if(o=="friendList")and not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE5B]then if not t[n]then t[n]=true;t.c=t.c+1;if(t.c>10)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE5B);end end elseif(o=="guildList")and not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE6B]then if not t[n]then t[n]=true;t.c=t.c+1;if(t.c>10)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE6B);end end end end end function e:ProcessScoreList(a,l)local o,n,i,o,o,t local o=UnitName("player");if(l=="WHISPER")then n=BejeweledProfile.scoreList.friends;t="";for l=1,10 do i=n.classic[l][1];e:CheckName("friendList",i);if(i==o)then if(t~="")then t=t.."*";end t=t..n.classic[l][2]..o.."*"..n.classic[l][3];end if(string.len(t)>180)then e.network:Send("HSSync",t,"WHISPER",a);t="";end i=n.timed[l][1];e:CheckName("friendList",i);if(i==o)then if(t~="")then t=t.."*";end t=t..n.timed[l][2]..o.."*"..string.format("%.2f",n.timed[l][3]);end if(string.len(t)>180)then e.network:Send("HSSync",t,"WHISPER",a);t="";end end if(t~="")then e.network:Send("HSSync",t,"WHISPER",a);end else n=BejeweledProfile.scoreList.guild;t="";local r=0;local d;for l=1,GetNumGuildMembers(true)do o=GetGuildRosterInfo(l);d=nil;for l=1,10 do i=n.classic[l][1];if(i==o)then d=true;if(t~="")then t=t.."*";end t=t..n.classic[l][2]..o.."*"..n.classic[l][3];r=r+1;end if(string.len(t)>180)then e.network:Send("HSSync",t,"GUILD",a);t="";end i=n.timed[l][1];if(i==o)then d=true;if(t~="")then t=t.."*";end t=t..n.timed[l][2]..o.."*"..string.format("%.2f",n.timed[l][3]);r=r+1;end if(string.len(t)>180)then e.network:Send("HSSync",t,"GUILD",a);t="";end end if(d)then e:CheckName("guildList",o);end if(r>=20)then break end end if(t~="")then e.network:Send("HSSync",t,"GUILD",a);end end end function e:ScrubLists()local l,d,d,i,o,d,d,t,n,a,r;local S=UnitName("player");for d=1,2 do if(d==1)then t=BejeweledProfile.scoreList.friends;else t=BejeweledProfile.scoreList.guild;end for s=1,2 do if(s==1)then o=1e3;scoreOffset=100;n="classic";else o=2.8;scoreOffset=.2;n="timed";end if(BejeweledProfile.settings.hideDuplicates)then e.nameList=e.nameList or{}for t,n in pairs(e.nameList)do e.nameList[t]=nil;end l=1;for a=1,10 do i=t[n][l][1];if(i~="PopCap Games")then if not e.nameList[i]then e.nameList[i]=true;else if(l<10)then for e=l,9 do t[n][e][1]=t[n][e+1][1];t[n][e][2]=t[n][e+1][2];t[n][e][3]=t[n][e+1][3];if(t[n][e][1]=="PopCap Games")then o=t[n][e][3]-scoreOffset;end end l=l-1;end t[n][10][1]="PopCap Games";t[n][10][2]=1;t[n][10][3]=o;end end l=l+1;end end if(s==1)then o=1e3;scoreOffset=100;else o=2.8;scoreOffset=.2;end for e=1,10 do i=t[n][e][1];if(i~="PopCap Games")and(i~=S)then a=nil;if(d==1)then for e=1,GetNumFriends()do r=GetFriendInfo(e);if(i==r)then a=true;break;end end else for e=1,GetNumGuildMembers(true)do r=GetGuildRosterInfo(e);if(i==r)then a=true;break;end end end if not a then for e=e,9 do t[n][e][1]=t[n][e+1][1];t[n][e][2]=t[n][e+1][2];t[n][e][3]=t[n][e+1][3];if(t[n][e][1]=="PopCap Games")then o=t[n][e][3]-scoreOffset;end end t[n][10][1]="PopCap Games";t[n][10][2]=1;t[n][10][3]=o;o=o-scoreOffset;end end end end end end function e:UpdateSavedState()local t,t,o;local t=BejeweledProfile.settings.savedState;if not t then BejeweledProfile.settings.savedState={};t=BejeweledProfile.settings.savedState;for e=1,r+1 do t[e]={};end end for n=1,r do for e=1,s do o=i[n][e].contents;if(i[n][e].bigStar)then o=o+10;end t[n][e]=o;end end t=t[r+1];local n=n;t[1]=n.score;t[2]=n.pointsToLevelUp;t[3]=n.level;t[4]=n.moves;t[5]=n.largestCascade;t[6]=n.largestCombo;t[7]=e.levelBar.timer.timeElapsed;t[8]=n.pointMultiplier;end function e:UpdateSavedVariablesDatabase()if(bCrowbar)then bCrowbar:Hook(i,n);end if(BejeweledData.beta)then BejeweledData.beta=nil;BejeweledData.legalDisplayed=nil;BejeweledData.firstHyperCube=nil;BejeweledData.firstPowerGem=nil;BejeweledData.firstSkillShow=nil;BejeweledData.firstGame=nil;BejeweledProfile={["stats"]={["classic"]={["score"]=0,["played"]=0,["highestLevel"]=0;},["timed"]={["score"]=0,["played"]=0,["mostMoves"]=0;},["largestCascade"]=0,["largestCombo"]=0,["played"]=0,["combatPause"]=0,["totalGemsMatched"]=0,["totalPowerGems"]=0,["totalHyperGems"]=0,["gemMatch"]={0,0,0,0,0,0,0,0},},["skill"]={["rank"]=1,["skillPoints"]=0,["timedGames"]=0,["games"]=0,},["settings"]={["keybinding"]=nil,["gameAlpha"]=1,["mouseoffAlpha"]=.3,["publishSkillGains"]=1,["publishRankGains"]=1,["newGameFlight"]=1,["publishScores"]=1,["enableSounds"]=1,["disableHints"]=nil,["lockWindow"]=nil,["openFlightStart"]=1,["closeFlightEnd"]=nil,["openOnDeath"]=1,["closeReadyCheck"]=1,["openLogin"]=nil,["closeCombat"]=1,["showFlightTooltips"]=1,},["scoreList"]={["friends"]={["classic"]={[1]={"PopCap Games",1,1e3},[2]={"PopCap Games",1,900},[3]={"PopCap Games",1,800},[4]={"PopCap Games",1,700},[5]={"PopCap Games",1,600},[6]={"PopCap Games",1,500},[7]={"PopCap Games",1,400},[8]={"PopCap Games",1,300},[9]={"PopCap Games",1,200},[10]={"PopCap Games",1,100},},["timed"]={[1]={"PopCap Games",1,2.8},[2]={"PopCap Games",1,2.6},[3]={"PopCap Games",1,2.4},[4]={"PopCap Games",1,2.2},[5]={"PopCap Games",1,2},[6]={"PopCap Games",1,1.8},[7]={"PopCap Games",1,1.6},[8]={"PopCap Games",1,1.4},[9]={"PopCap Games",1,1.2},[10]={"PopCap Games",1,1},},},["guild"]={["classic"]={[1]={"PopCap Games",1,1e3},[2]={"PopCap Games",1,900},[3]={"PopCap Games",1,800},[4]={"PopCap Games",1,700},[5]={"PopCap Games",1,600},[6]={"PopCap Games",1,500},[7]={"PopCap Games",1,400},[8]={"PopCap Games",1,300},[9]={"PopCap Games",1,200},[10]={"PopCap Games",1,100},},["timed"]={[1]={"PopCap Games",1,2.8},[2]={"PopCap Games",1,2.6},[3]={"PopCap Games",1,2.4},[4]={"PopCap Games",1,2.2},[5]={"PopCap Games",1,2},[6]={"PopCap Games",1,1.8},[7]={"PopCap Games",1,1.6},[8]={"PopCap Games",1,1.4},[9]={"PopCap Games",1,1.2},[10]={"PopCap Games",1,1},},},},};end e.UpdateSavedVariablesDatabase=nil;end function e:NumberWithCommas(e)local e=string.gsub(e,"(%d)(%d%d%d)$","%1,%2")local t while true do e,t=string.gsub(e,"(%d)(%d%d%d),","%1,%2,")if t==0 then break end end return e end function e:SecondsConvert(e)local t=math.floor(e/60);e=math.ceil(e-(t*60));return t,e;end function e:WipeBoard()local n,n,t;local o=e.animator;for e=1,r do for n=1,s do t=i[e][n];if(t.fxType~=f)then t.fxType=k;else t.wasHyper=true;t.contents=0;t.hyperGemContents=nil;end t.moving=ge;t.yVel=(4-math.random(1,5)/2)t.xVel=((math.random(1,11)-6)/2);o:Add(t);end end end function e:NewGame(l,d,a)local S,S,t,o;o=n;o.gameOver=false;o.paused=false;o.score=0;o.combo=0;o.level=1;o.moveAllowed=true;o.selectedJewel=nil;o.pointsToLevelUp=500*te[l];o.gameMode=l;o.explosions=0;o.bigStarSpawn=0;o.hyperSpawn=0;o.moves=0;o.gemsCleared=0;for n=1,#e.animator.animationStack do t=e.animator.animationStack[1]if(t.fxType==ie)then p(e.animator.bigStarQueue,t);t:ClearAllPoints();t:SetAlpha(0);if(t.parent)then t.parent.bigStar=nil;end t.parent=nil;t:Hide();elseif(t.fxType==Se)then p(e.animator.explosionQueue,t);t:Hide();elseif(t.fxType==N)then p(e.animator.floatingTextQueue,t);t:Hide();elseif(t.fxType==ae)then p(e.animator.shardQueue,t);t:Hide();elseif(t.fxType==fe)then p(e.animator.lightwaveQueue,t);t:GetParent().lightWaveObj=nil;t:Hide();elseif(t.fxType==he)then p(e.animator.lightningQueue,t);t.highlight:Hide();t:Hide();end g(e.animator.animationStack,1)t.animated=nil;end for t=1,r do for n=1,s do e:ClearJewel(i[t][n],n,t);end end if(Bejeweled_Fu)then Bejeweled_Fu.currentMode=l;end if(Bejeweled_Titan)then Bejeweled_Titan.currentMode=l;end if(l==m)then o.statDB=BejeweledProfile.stats.classic;if(o.statDB.highestLevel==0)then o.statDB.highestLevel=1;end BejeweledProfile.settings.classicInProgress=true;else BejeweledProfile.settings.classicInProgress=nil;o.statDB=BejeweledProfile.stats.timed;end o.largestCascade=0;o.largestCombo=0;o.leveledUp=nil;o.levelingUp=nil;e.pausedText:Hide();e.flightOptionWindow.learning=nil;e.levelBar:SetMode(l,d);e.animator.newGameStart=true;e.animator.countdownState=4;o.moveAllowed=nil;if(l==j)then e.levelBar:StopTimer();elseif(l==T)then e.animator.countdownState=0;o.moveAllowed=nil;end e.gameStatusText:Hide();e.gameStatusText.background:Hide();e.summaryScreen:Hide();e.aboutScreen:Hide();e.featsOfSkillScreen:Hide();e.optionsScreen:Hide();e.levelBarButton:Hide();e.levelBarButton:SetID(0);e.levelBarButton.text:SetText("Return to Game");e.animator.spawningLevel=true;e.animator.animationStatus=D;e.animator.spawnedJewels=nil;e.animator.hintObj:Hide();e.animator.hintObj:ClearAllPoints();if(math)and(math.randomseed)then math.randomseed(math.random(0,214748364)+(GetTime()*1e3));end for t=1,r do e:NewJewel(t,t,true);i[t][t].contents=0;for n=t+1,s do e:NewJewel(n,t,true);i[t][n].contents=0;end for n=t+1,r do e:NewJewel(t,n,true);i[n][t].contents=0;end end if(a)then e.animator.spawningLevel=nil;e.animator.animationStatus=v;local n=BejeweledProfile.settings.savedState;local l local a=e.animator;for o=1,r do for r=1,s do t=i[o][r];l=n[o][r];if(l<9)then t.contents=l;elseif(l==9)then a:CreateHyperGem(t);a:Add(t);else t.contents=l-10;t.bigStar=a:CreateBigStar(0,0,t);a:Add(t.bigStar);end e:UpdateJewel(t);end end n=n[r+1];o.score=n[1];o.pointsToLevelUp=n[2];o.level=n[3];o.moves=n[4];o.largestCascade=n[5];o.largestCombo=n[6];e.levelBar.timer.timeElapsed=n[7];o.pointMultiplier=n[8];e.animator.countdownState=0;e.levelBar.score=o.score;e.levelBar.maxScore=o.pointsToLevelUp;e.levelText:SetText(o.level);e.levelBar:UpdateBar();end e:GamePaused(false);end function e:NewJewel(t,o,h)local e,e,e,e,n,e,S,a,d;newJewel=math.random(1,7);if(h)then for e=1,7 do S=true;for e=1,6 do n=0;d=G[e][4];if d==0 then d=1;end for l=G[e][3],G[e][4]*2,math.ceil(d)do a=G[e][2];if a==0 then a=1;end for e=G[e][1],G[e][2]*2,math.ceil(a)do if(o+l)>0 and(o+l)<=r then if(t+e)>0 and(t+e)<=s then if i[o+l][t+e].contents==newJewel then n=n+1;end end end end end if(n>1)then newJewel=newJewel+1;if newJewel>7 then newJewel=1;end S=false;break;end end if S==true then break;end end end local e=i[o][t]e.contents=newJewel;e.texture:SetTexture(l.."gem_"..y[newJewel]);e.texture:SetTexCoord(unpack(C[1]));e.highlight:SetTexture(l.."shine_"..y[newJewel]);e.highlight:SetTexCoord(0,0,0,0);if not h then BejeweledProfile.stats.totalGemsMatched=BejeweledProfile.stats.totalGemsMatched+1;end end function e:MarkPowerGem(t,i)local o;if(n.selectedJewel and((n.selectedJewel==t)or(n.selectedJewel.swapJewel==t)))or(i)then o=true;if not(t.explode)then t.bigStarSpawn=e.animator:CreateBigStar(0,0,t);t.bigStarSpawn:Hide();e.animator:Add(t.bigStarSpawn);BejeweledProfile.stats.totalPowerGems=BejeweledProfile.stats.totalPowerGems+1;if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE3A]then if(BejeweledProfile.stats.totalPowerGems>=100)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE3A);end end end end return o;end function e:MarkHyperGem(t,i)local o;if(n.selectedJewel and((n.selectedJewel==t)or(n.selectedJewel.swapJewel==t)))or(i)then if not(t.bigStar)then t.hyperGemSpawn=true;t.fxType=P;e.animator:Add(t);o=true;BejeweledProfile.stats.totalHyperGems=BejeweledProfile.stats.totalHyperGems+1;if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE5A]then if(BejeweledProfile.stats.totalHyperGems>=50)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE5A);end end end end return o;end function e:MarkJewel(t,o)if(o==le)then t.markX=true;else t.markY=true;end if(t.bigStar)then t.explode=1;n.explosions=n.explosions+1;end t.fxType=P;t.fxFrame=1;t.highlight:SetAlpha(0);e.animator:Add(t);return(t.explode or 0);end function e:FindMove()local e,e,o,n,e,h,e,c,S,a,d,l for e=1,r do for t=1,s do for f=1,4 do n=t+G[f][1];o=e+G[f][3];if(n>0)and(n<=s)and(o>0)and(o<=r)then h=i[e][t];c=nil;if(h.contents==9)then c=true;end if(i[o][n].contents~=0)then i[e][t]=i[o][n];i[o][n]=h;S=t;a=t;while((S>1)and(i[e][S-1].contents~=0)and(i[e][t].contents==i[e][S-1].contents))do S=S-1;end while((a1)and(i[d-1][t].contents~=0)and(i[e][t].contents==i[d-1][t].contents))do d=d-1;end while((l=2)or((l-d)>=2)then c=true;end end if c then return h;end end end end end end function e:CheckForClusters()local o,o,x,t,c,m,T,o,o,S,h,o,o,o,w,g,u,C,a,d,p;local f;for l=1,r do for o=1,s do c=i[l][o].contents if(c~=0)and(c~=9)then m=0;t=0;if l1)then d=e;a=o;end end end if t>2 then x=true;explodeCount=0;for t=l,l+t-1 do explodeCount=explodeCount+e:MarkJewel(i[t][o],Ce);end if(a)then for t=a-w,a+g do explodeCount=explodeCount+e:MarkJewel(i[d][t],le);end if(t>4)or(w+g>3)then p=true;end t=t+w+g;end S=nil;h=nil;if(t==4)or(a and not p)then if(a)then S=e:MarkPowerGem(i[d][a],true)or S;else for t=l,l+t-1 do S=e:MarkPowerGem(i[t][o])or S;end end if not S then S=e:MarkPowerGem(i[math.random(l,(l+t-1))][o],true)or S;end elseif(t>=5)then f=nil;if(p)then f=l end f=f or(l+t-1);if(a)then h=e:MarkHyperGem(i[d][a],true)or h;else for t=l,l+t-1 do h=e:MarkHyperGem(i[t][o])or h;end end if not h then h=e:MarkHyperGem(i[math.random(l,f)][o],true)or h;end end if(a)then e:GenerateScore(t,i[d][a],c,true,nil,explodeCount,nil,true);else e:GenerateScore(t,i[l][o],c,S,nil,explodeCount);end m=m+t;end end t=0;if o1)then a=e;d=l;end end end if t>2 then x=true;explodeCount=0;for t=o,o+t-1 do explodeCount=explodeCount+e:MarkJewel(i[l][t],le)end if(d)then for t=d-u,d+C do explodeCount=explodeCount+e:MarkJewel(i[t][a],Ce);end if(t>4)or(u+C>3)then p=true;end t=t+u+C;end S=nil;h=nil;if(t==4)or(d and not p)then if(d)then S=e:MarkPowerGem(i[d][a],true)or S;else for t=o,o+t-1 do S=e:MarkPowerGem(i[l][t])or S;end end if not S then S=e:MarkPowerGem(i[l][math.random(o,(o+t-1))],true)or S;end elseif(t>=5)then f=nil;if(p)then f=o end f=f or(o+t-1);if(d)then h=e:MarkHyperGem(i[d][a],true)or h;else for t=o,o+t-1 do h=e:MarkHyperGem(i[l][t])or h;end end if not h then h=e:MarkHyperGem(i[l][math.random(o,f)],true)or h;end end if(a)then e:GenerateScore(t,i[d][a],c,true,nil,explodeCount,nil,true);else e:GenerateScore(t,i[l][o],c,S,nil,explodeCount,true);end m=m+t;end end if(m>n.largestCascade)then n.largestCascade=m;end if(m>BejeweledProfile.stats.largestCascade)then BejeweledProfile.stats.largestCascade=m;end if(m>2)then BejeweledProfile.stats.gemMatch[c]=BejeweledProfile.stats.gemMatch[c]+1;end end end end return x;end function e:TotalTime(t)local e="";t=floor(t);if(t>=86400)then e=e..floor(t/86400).." d"t=mod(t,86400);end if(t>=3600)then if(e~="")then e=e.." ";end e=e..floor(t/3600).." hr"t=mod(t,3600);end if(t>=60)then if(e~="")then e=e.." ";end e=e..floor(t/60).." min"t=mod(t,60);end if(t==0)then if(e=="")then e="0 s";end else if(e~="")then e=e.." ";end e=e..floor(t).." s";end return e;end function e:GenerateScore(l,d,S,m,f,r,h,p)if(n.gameOver)then return;end local t=0;local a=e.animator;local o=0;local s=BejeweledProfile.skill.rank;if(l>=3)then o=o+e.skillBar:CheckSkill(e.const.SKILLTYPE_MATCH,e.const.SKILL_MATCH3);n.combo=n.combo+1;local i=n.combo;if(i>=2)then o=o+e.skillBar:CheckSkill(e.const.SKILLTYPE_COMBO,e.const.SKILL_COMBO2);end if(i>=3)then o=o+e.skillBar:CheckSkill(e.const.SKILLTYPE_COMBO,e.const.SKILL_COMBO3);end if(i>=4)then o=o+e.skillBar:CheckSkill(e.const.SKILLTYPE_COMBO,e.const.SKILL_COMBO4);end if(i>=5)then o=o+e.skillBar:CheckSkill(e.const.SKILLTYPE_COMBO,e.const.SKILL_COMBO5);end if(n.combo<#z)then t=z[i];else t=z[#z];end end if(l==4)then o=o+e.skillBar:CheckSkill(e.const.SKILLTYPE_MATCH,e.const.SKILL_MATCH4);t=t+10;elseif(l>=5)then o=o+e.skillBar:CheckSkill(e.const.SKILLTYPE_MATCH,e.const.SKILL_MATCH5);t=t+20;end if(m)then t=t+25;end if(f)then if(r==0)then t=t+75 e.sound:Play("HyperDestroy");else t=t+20;e.sound:Play("ElectroExplode");end end if(r==1)then t=t+25 end if(r>1)then t=t+10*(r+2)end t=t*te[n.gameMode]if(n.gameMode<=T)then t=t*((n.level+1)/2)end local i=d.x;local r=d.y;if(h==true)then i=i+w*(l/2)else r=r+c*(l/2)i=i+U;end if(p)then r=d.y;i=d.x+U;end local t=a:CreateFloatingText(i,r,math.floor(t),S);if(l>=3)then t.comboSound=n.combo;end a:Add(t);if(s~=BejeweledProfile.skill.rank)then a:Add(a:CreateFloatingText(i-20,r-20,"RANK UP: "..e.const.skillDataRanks[BejeweledProfile.skill.rank],7,true));end if(o>0)then for e=(i+1),(i+o)do a:Add(a:CreateFloatingText(e,r+20,"+1 Skill",3,true));end end end function e:Print(e,t,n,o)DEFAULT_CHAT_FRAME:AddMessage(e,t,n,o);end function e:GameOver()local o=e.animator;local t=e.gameStatusText;o.hintObj:Hide();o.hintObj.fxType=d;n.gameOver=true;n.moveAllowed=nil;n.lastGameMode=n.gameMode;if(Bejeweled_Fu)then Bejeweled_Fu.currentMode=nil;Bejeweled_Fu.lastScore=e:NumberWithCommas(n.score);end if(Bejeweled_Titan)then Bejeweled_Titan.currentMode=nil;Bejeweled_Titan.lastScore=e:NumberWithCommas(n.score);end e.levelBar:StopTimer();if(n.gameMode==m)then t:SetText("No more moves");e.sound:Play("NoMoreMoves");local e,e;for e=1,r do for t=1,s do BejeweledProfile.settings.savedState[e][t]=0;end end for e=1,#BejeweledProfile.settings.savedState[r+1]do BejeweledProfile.settings.savedState[r+1][e]=0;end BejeweledProfile.settings.classicInProgress=nil;else t:SetText("Time's up");e.sound:Play("TimesUp");end BejeweledProfile.skill.games=BejeweledProfile.skill.games+1;if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE2B]then if(BejeweledProfile.skill.games>=100)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE2B);end end if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE4B]then if(BejeweledProfile.skill.games>=1e3)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE4B);end end t:Show();t.background:Show();e:DeselectJewel();e:DeselectJewel(true);o.animationStatus=X;e:WipeBoard();e.sound:Play("WipeBoard");end function e:DeselectJewel(t)local e;if(t)then e=n.nextSelectedJewel;n.nextSelectedJewel=nil;else e=n.selectedJewel;n.selectedJewel=nil;end if(e)then if(e.fxType~=f)then e.fxEnd=true;end e.selector:Hide();e.mouseX=nil;e.mouseY=nil;end end local function X(a,o,i,n,t,e,l)local e=CreateFrame("Frame","",e);e:SetPoint("Topleft",o,-i);e:SetWidth(n);e:SetHeight(t);e:Show();if(l)then e.texture=e:CreateTexture(nil,"OVERLAY");else e.texture=e:CreateTexture(nil,"ART");end e.texture:SetWidth(n);e.texture:SetHeight(t);e.texture:SetPoint("Center");e.texture:Show();e.highlight=e:CreateTexture(nil,"OVERLAY");e.highlight:SetWidth(n);e.highlight:SetHeight(t);e.highlight:SetBlendMode("add");e.highlight:SetPoint("Center");e.highlight:Show();e.x=o;e.y=i;return e;end local function G(i,n,o,t)local e=e.animator:CreateImage(i,n,w,c,o);e.texture:SetTexture(l.."gem_"..y[t]);e.texture:SetTexCoord(0,0,0,0);e.highlight:SetTexture(l.."shine_"..y[t]);e.highlight:SetTexCoord(0,0,0,0);e.selector=e:CreateTexture(nil,"OVERLAY");e.selector:SetTexture(l.."selector");e.selector:SetHeight(c);e.selector:SetWidth(w);e.selector:SetPoint("Center");e.selector:Hide();e.glow=e:CreateTexture(nil,"OVERLAY");e.glow:SetHeight(c);e.glow:SetWidth(w);e.glow:SetPoint("Topleft",e.texture);e.glow:SetPoint("Bottomright",e.texture);e.glow:SetAlpha(0);e.glowLevel=0;e.fxType=L e.fxFrame=1;return e;end function e:UpdateJewel(t)if(t.contents)and(t.contents>0)and(t.contents<=7)then t.texture:SetTexture(l.."gem_"..y[t.contents]);t.texture:SetTexCoord(unpack(C[1]));t.highlight:SetTexture(l.."shine_"..y[t.contents]);t.highlight:SetTexCoord(0,0,0,0);t.glow:SetTexture(l.."highlight_"..y[t.contents]);t.glow:SetTexCoord(0,1,0,1);else if(t.contents==9)then e.animator:CreateHyperGem(t);else t.texture:SetTexCoord(0,0,0,0);t.glow:SetTexCoord(0,0,0,0);end end end local function M(t,e)e.texture:SetTexture(l.."hypergem");e.texture:SetTexCoord(unpack(B[1]));e.highlight:SetTexture(l.."shine_white");e.highlight:SetTexCoord(0,0,0,0);e.glow:SetTexCoord(0,0,0,0);e.fxType=f e.fxFrame=1;e.contents=9;end local function D(t,o,i,n)local e=t.bigStarQueue[1];if e then g(t.bigStarQueue,1);else e=t:CreateImage(o,i,w,c,n,true);e.texture:SetTexture(l.."bigstar");e.texture:SetHeight(we);e.texture:SetWidth(xe);e.highlight:SetTexture(l.."bigstar");e.highlight:SetHeight(we);e.highlight:SetWidth(xe);end e:ClearAllPoints();e:SetPoint("Topleft",n,"Topleft");e.fxType=ie e.fxFrame=1;e.fxFrame2=1;e.fxAlpha=100;e.fxAlphaStep=-3;e:SetAlpha(1);e:Show();e.parent=n;return e;end local function y(n,a,i,o)local t=n.explosionQueue[1];if t then g(n.explosionQueue,1);else t=n:CreateImage(a,i,w,c,e.gameBoard)t.texture:SetTexture(l.."explosion");t.texture:SetHeight(Be);t.texture:SetWidth(ke);end t.x=o.x t.y=o.y t:ClearAllPoints();t:SetPoint("Topleft",e.gameBoard,"Topleft",t.x,-t.y);t.texture:SetTexCoord(unpack(O[1]));t:Show();t.fxType=Se t.fxFrame=1;e.sound:Play("Explosion");return t;end local function B(t,n)if not t.hintObj then t.hintObj=t:CreateImage(0,0,64,64,e.gameBoard,true);t.hintObj.texture:SetTexture(l.."hintArrow");end if(n)then t.hintObj.x=n.x+2;t.hintObj.y=n.y-I;t.hintObj:ClearAllPoints();t.hintObj:SetPoint("Topleft",t.hintObj.x,-t.hintObj.y);t.hintObj.fxType=Pe t.hintObj.fxFrame=0;end t.hintObj:SetAlpha(1)t.hintObj:Hide();t.hintObj.bounceY=0;t.hintObj.bounceDir=1;return t.hintObj;end local function O(n,t,o)local e=n.lightwaveQueue[1];if e then g(n.lightwaveQueue,1);else e=n:CreateImage(0,0,w,c,t,true);end e:ClearAllPoints();e:SetParent(t);e.texture:SetTexture(t.highlight:GetTexture());e:SetAllPoints(t.texture);e:Show();e.texture:SetTexCoord(unpack(b[2]));e:SetAlpha(0)e.fxType=fe e.fxFrame=-(o*2)-1;t.lightWaveObv=e;return e;end local function Y(o,a,r,i,n,d)local t=o.lightningQueue[1];if t then g(o.lightningQueue,1);else t=e.gameBoard:CreateTexture(nil,"ARTWORK");t:SetTexture(l.."lightning");t.highlight=e.gameBoard:CreateTexture(nil,"OVERLAY");t.highlight:SetTexture(l.."lightning");end t:SetVertexColor(unpack(K[d]));t.fxType=he t.fxFrame=1;DrawRouteLine(t,e.gameBoard,a,-r,i,-n,128,"TOPLEFT")DrawRouteLine(t.highlight,e.gameBoard,a,-r,i,-n,128,"TOPLEFT")t:Show();t.highlight:Show();return t;end local function J(n,i,o,a,r)local t=n.shardQueue[1];if t then g(n.shardQueue,1);else t=n:CreateImage(i,o,be,Te,e.gameBoard,true);t.texture:SetTexture(l.."gemshards");end t.x=a.x+i;t.y=a.y+o;t:ClearAllPoints();t:SetPoint("Topleft",t.x,-t.y);t.texture:SetTexCoord(unpack(W[1]));t.texture:SetVertexColor(unpack(K[r]));t:SetAlpha(1)t.yVel=0;t.xVel=0;t:Show();t.fxType=ae t.fxFrame=math.random(1,Le);return t;end local function W(d,S,s,t,r,l,a)local h,i,o;if(t.bigStar)and not t.explode then t.explode=1;t.fxType=P;d:Add(t);n.explosions=n.explosions+1;e:GenerateScore(1,t,r,nil,nil,n.explosions);elseif(t.contents~=0)then if(t.contents==9)then r=9;e:GenerateScore(1,t,r,nil,true,0);end t.contents=0;e:UpdateJewel(t);if not((l==0)and(a==0))then for e=1,Fe do if(e>De)then o=1;else o=-1;end local n=a*math.random(4,7);if(a==0)then n=o*math.random(1,5);end if(l<0)then o=-1;end if(l>0)then o=1;end local e=math.random(4,7);if(l==0)then e=2;end i=d:CreateShard(S+U-qe+(12-(math.random(1,24))),s+I-Xe+(12-(math.random(1,24))),t,r);i.yVel=(n)+(a*math.random(1,5));if(l==0)then if(a==-1)then i.xVel=(o*3/math.random(1,5));else i.xVel=(o*math.random(0,5));end else i.xVel=(o*e)+(o*math.random(1,e));end p(d.animationStack,i);end end end end local function V(l,o,i,n,r,d)local t=l.floatingTextQueue[1];local a=e.gameBoard;if t then g(l.floatingTextQueue,1);t:SetText(n);else t=e:CreateCaption(o,i,n,a,50,1,1,1,true);end t.x=o t.y=i if(d)then t:SetTextColor(1,.4,1);else if(K[r])then t:SetTextColor(unpack(K[r]));else t:SetTextColor(unpack(K[9]));end end t:ClearAllPoints();t:SetPoint("Topleft",a,"Topleft",o,-i);t:SetAlpha(1)t:Hide();t.score=n;t.notScore=d;t.comboSound=nil;t.fxType=P t.fxFrame=0;return t;end function e:CreateCaption(o,n,i,e,t,r,a,d,s,S)local e=e:CreateFontString(nil,"Overlay");if(s)then e:SetFont(l.."Contb___.ttf",(t or 10),"Outline");else if(S)then e:SetFont(STANDARD_TEXT_FONT,(t or 10));else e:SetFont(STANDARD_TEXT_FONT,(t or 10),"Outline");end end e:SetTextColor((r or 1),(a or 1),(d or 1));e:SetPoint("Topleft",o,-n);e:SetText(i);e:Show();return e;end function e:ClearJewel(e,o,n)for t,n in pairs(e)do if(t~="texture")and(t~="highlight")and(t~="selector")and(t~="glow")then e.key=nil;end end e.x=(o-1)*w;e.y=(n-1)*c;e.gridX=o;e.gridY=n;e.texture:SetTexCoord(unpack(C[1]));e.texture:SetWidth(w);e.texture:SetHeight(c);e.fxType=L e.fxFrame=1;e:Show();e:SetAlpha(1);e:ClearAllPoints();e:SetWidth(w);e:SetHeight(c);e:SetPoint("Topleft",e.x,-e.y);e.selector:Hide();e.glowLevel=0;end function Jewel_OnEnter(t)if not n.moveAllowed then n.currentMouseOver=t;return end e:UpdateMouseOver(t);end function e:UpdateMouseOver(t)if(t.fxType~=k)and(t.fxType~=f)and(t.fxType~=A)and(t.fxType~=P)and(t.fxType~=d)then e.animator:Add(t);t.fxType=de;t.fxFrame=Ge;t.nextGlow=0;t.fxEnd=nil;t.adj=nil;t.highlight:SetTexCoord(unpack(b[1]));t.highlight:SetAlpha(0);end end function e:UpdateLevelScoreThreshold()local t=n;t.pointMultiplier=te[t.gameMode]+t.level*.5 t.pointsToLevelUp=t.score+(t.pointsToLevelUp+math.floor((500+150*t.level)*t.pointMultiplier))e.levelBar:SetMinMaxScore(t.score,t.pointsToLevelUp);if(t.gameMode==m)then e.levelText:SetText(t.level+1);else if(math.fmod(t.level,2)==0)then e.dataText:SetFormattedText("%d|cFF00FF00x",(t.level));else e.dataText:SetFormattedText("%.1f|cFF00FF00x",(1+t.level*.5));end end t.level=t.level+1;if(t.statDB.highestLevel)then if(t.level>t.statDB.highestLevel)then t.statDB.highestLevel=t.level;end end if(t.level==10)then e.skillBar:CheckSkill(e.const.SKILLTYPE_CLASSIC,e.const.SKILL_LEVEL10);end if(t.level==15)then e.skillBar:CheckSkill(e.const.SKILLTYPE_CLASSIC,e.const.SKILL_LEVEL15);end e.levelBar:UpdateBar();end function e:TriggerHyperGemItem(t)local n=e.animator;n:CreateShardSpawn(0,0,t,t.hyperGemContents,0,0);e:GenerateScore(1,t,t.hyperGemContents,nil,true,-1,true);t.hyperGemTrigger=nil;t.contents=0;t.fxType=d;if(t.bigStar)then t.bigStar.explode=1;t.fxType=P;n:Add(t);t.fxFrame=1;t.highlight:SetAlpha(0);end local h=t.x+U;local S=t.y+I;local o,d;local l,l,e;for l=1,r do for a=1,s do if(i[l][a].contents==t.hyperGemContents)then e=i[l][a];e.hyperGemTrigger=true;e.hyperGemContents=t.hyperGemContents;e.fxType=P;n:Add(e);l=r;o=e.x+U;d=e.y+I;break;end end if(o)then break;end end if(o)then n:Add(n:CreateLightning(h,S,o,d,t.hyperGemContents));end t.hyperGemContents=nil;end function Jewel_OnLeave(e)if not n.moveAllowed then n.currentMouseOver=nil;return end;if(e.fxType~=k)and(e.fxType~=f)and(e.fxType~=A)and(e.fxType~=P)and(e.fxType~=d)and not e.moving then e.fxEnd=true;if(e.adj)and(e.adj.fxType==q)then if(e.adj.fxFrame<=re)then e.adj.fxFrame=re-e.adj.fxFrame+1;end end e.adj=nil;end end function Jewel_OnDrag(t)if(t.mouseX)then if not BejeweledProfile.settings.disableHints then e.animator:Add(e.animator:CreateHint(e:FindMove()));end local a,l=GetCursorPosition();local o=a-t.mouseX;local e=l-t.mouseY;local d;if(math.abs(o)>math.abs(e))then o=o/math.abs(o);a=t.gridX+o;if(a>0)and(a<=s)then d=i[t.gridY][a];end else e=e/math.abs(e);l=t.gridY-e;if(l>0)and(l<=r)then d=i[l][t.gridX];end end if(d)then Jewel_OnClick(d);else if(t.fxType~=f)then t.fxEnd=true;end t.selector:Hide();t.mouseX=nil;t.mouseY=nil;n.selectedJewel=nil;end end end function Jewel_OnClick(t)if(not n.gameMode)or(e.paused==true)then return;end if(bCrowbar)and(bCrowbar.jewelEdit)then bCrowbar:Edit(t);return;end if not n.moveAllowed then if not e.animator.newGameStart then if(n.nextSelectedJewel)then e:DeselectJewel(true);else if(t.fxType~=P)then n.nextSelectedJewel=t;t.mouseX,t.mouseY=GetCursorPosition();t.selector:Show();t.highlight:SetAlpha(0);e.animator:Add(t);e.sound:Play("Select");end end end return;end local r=false;local a;local l=e.animator;if not BejeweledProfile.settings.disableHints then l:Add(l:CreateHint(e:FindMove()));end if n.selectedJewel then local o,i;o=n.selectedJewel.gridX i=n.selectedJewel.gridY if(t.gridX==o)then if(math.abs(t.gridY-i)==1)then r=true;end elseif(t.gridY==i)then if(math.abs(t.gridX-o)==1)then r=true;end end if r==true then local o=n.selectedJewel;l:Add(o);l:Add(t);o.highlight:SetAlpha(0);t.highlight:SetAlpha(0);o.mouseX=nil;o.mouseY=nil;t.mouseX=nil;t.mouseY=nil;if(o.fxType~=f)then o.fxEnd=true;else if not((t.fxType==f)and(o.fxType==f))then o.hyperGemContents=t.contents;a=true;end end o.moving=ce;o.xOffset=0;o.yOffset=0;o.xMove=math.abs(t.gridX-o.gridX);o.yMove=math.abs(t.gridY-o.gridY);o.xDir=t.gridX-o.gridX;o.yDir=t.gridY-o.gridY;o.swapJewel=t;if(t.fxType~=f)then t.fxType=L;t.fxFrame=1;else if not((t.fxType==f)and(o.fxType==f))then t.hyperGemContents=o.contents;a=true;end end t.moving=ce;t.xOffset=0;t.yOffset=0;t.xMove=math.abs(o.gridX-t.gridX);t.yMove=math.abs(o.gridY-t.gridY);t.xDir=o.gridX-t.gridX;t.yDir=o.gridY-t.gridY;t.swapJewel=o;t.selector:Show();n.moveAllowed=nil;l.movingJewels=2;local i;i=o.contents;o.contents=t.contents;t.contents=i;i=o.bigStar;o.bigStar=t.bigStar;t.bigStar=i local l;if((t.fxType==f)and(o.fxType==f))then l=true;a=true;o.hyperGemContents=9;t.hyperGemContents=9;end if not a then local a=e:CheckForClusters();if not a and(not l)then i=o.contents;o.contents=t.contents;t.contents=i;i=o.bigStar;o.bigStar=t.bigStar;t.bigStar=i t.invalidMove=1;o.invalidMove=1;e.sound:Play("Invalid");else n.moves=n.moves+1;if n.statDB.mostMoves then if(n.moves>n.statDB.mostMoves)then n.statDB.mostMoves=n.moves;end end if(n.moves==100)then e.skillBar:CheckSkill(e.const.SKILLTYPE_CLASSIC,e.const.SKILL_MOVE100);end if(n.moves==250)then e.skillBar:CheckSkill(e.const.SKILLTYPE_CLASSIC,e.const.SKILL_MOVE250);end local e,t e=o.fxType;t=o.fxFrame;end end end end if r==false then if(n.selectedJewel)then e:DeselectJewel();else n.selectedJewel=t;t.mouseX,t.mouseY=GetCursorPosition();t.selector:Show();if(t.fxType~=f)then t.fxType=k t.fxEnd=nil;t.fxFrame=1;end t.highlight:SetAlpha(0);l:Add(t);e.sound:Play("Select");end end end local function s(n)local e;local t=n:GetParent();for e=1,4 do if(t["tab"..e])then if(e<4)then t["tab"..e.."Content"]:Hide();end if(n:GetID()==e)then t["tab"..e]:SetFrameLevel(t:GetFrameLevel()+1);t["tab"..e].texture:SetVertexColor(1,1,1);if(e>2)then t["tab"..e.."Content"]:SetID(e);end t["tab"..e.."Content"]:Show();else t["tab"..e]:SetFrameLevel(t:GetFrameLevel()-1);t["tab"..e].texture:SetVertexColor(.5,.5,.5);end end end end local function k(o,r)if IsInGuild()then GuildRoster();end e:ScrubLists();local n,n,t,i,l;local s=BejeweledProfile.scoreList[r];local a="|cFF00FFFF";local d="|cFF00FF00";local h=UnitName("player");local S=GetNumFriends();for n=1,10 do t,i,l=unpack(s.classic[n])if(t=="PopCap Games")then t="|cFFFFFFFF"..t;i=0;end l=e:NumberWithCommas(l);i=tonumber(i);if(i>0)then o["classicRank"..n]:SetTexCoord(((i-1)*16/128),(i*16/128),0,1);else o["classicRank"..n]:SetTexCoord(0,0,0,0);end if(t~=h)then if(r=="friends")then o["classicName"..n]:SetText(a..t);else for e=1,GetNumFriends()do if(t==GetFriendInfo(e))then o["classicName"..n]:SetText(a..t);break;end if(e==S)then o["classicName"..n]:SetText(d..t);end end end else o["classicName"..n]:SetText(t);end if(n==1)then o["classicScore"..n]:SetText("|cFF00FF00"..l);else o["classicScore"..n]:SetText(l);end t,i,l=unpack(s.timed[n])if(t=="PopCap Games")then t="|cFFFFFFFF"..t;i=0;end l=e:NumberWithCommas(l);i=tonumber(i);if(i>0)then o["timedRank"..n]:SetTexCoord(((i-1)*16/128),(i*16/128),0,1);else o["timedRank"..n]:SetTexCoord(0,0,0,0);end if(t~=h)then if(r=="friends")then o["timedName"..n]:SetText(a..t);else for e=1,GetNumFriends()do if(t==GetFriendInfo(e))then o["timedName"..n]:SetText(a..t);break;end if(e==S)then o["timedName"..n]:SetText(d..t);end end end else o["timedName"..n]:SetText(t);end if(n==1)then o["timedScore"..n]:SetFormattedText("|cFF00FF00%.2f",l);else o["timedScore"..n]:SetFormattedText("%.2f",l);end end end local function f(t,n)t.elapsed=t.elapsed+n;if(t.elapsed<.1)then return;end t.timeElapsed=t.timeElapsed+t.elapsed;t.timeRemaining=t.timeRemaining-t.elapsed;t.legJourney=t.legJourney+t.elapsed;t.elapsed=0;local n=e.timedWindow;if(t.learning)and not t.learnEvent and(t.timeElapsed>4)then t.learnEvent=true;e.window:RegisterEvent("PLAYER_MONEY");end if not e.flightOptionWindow.learning and(t.timeRemaining<60)and not n.flightCheckbox.disabled then n.flightCheckbox.disabled=true;n.flightCheckbox:Hide();n.flightCheckboxCaption:Show();end if(t.timeRemaining<=0)and not e.flightOptionWindow.learning then t:Hide();if(n:IsVisible())then n:SetHeight(x-80);n.flightCheckbox:Hide();n.flightCheckboxCaption:Hide();n.flightCheckbox:SetChecked(nil);n.timerRemainingCaption:Hide();n.timeRemainingValue:Hide();end end if n:IsVisible()then if(e.flightOptionWindow.learning)then e.timedWindow.timeRemainingValue:SetText(e:TotalTime(math.floor(t.timeElapsed)));else e.timedWindow.timeRemainingValue:SetText(e:TotalTime(math.floor(t.timeRemaining)));end end end local function K(t)local n=t;local t=n;local o=string.find(t," ");if(o)then t=string.sub(t,1,o-1);n=string.sub(n,o+1);else n="";end t=string.lower(t);if(t=="reset")then BejeweledProfile={["stats"]={["classic"]={["score"]=0,["played"]=0,["highestLevel"]=0;},["timed"]={["score"]=0,["played"]=0,["mostMoves"]=0;},["largestCascade"]=0,["largestCombo"]=0,["played"]=0,["combatPause"]=0,["totalGemsMatched"]=0,["totalPowerGems"]=0,["totalHyperGems"]=0,["gemMatch"]={0,0,0,0,0,0,0,0},},["skill"]={["rank"]=1,["skillPoints"]=0,["timedGames"]=0,["games"]=0,},["settings"]={["keybinding"]=nil,["gameAlpha"]=1,["mouseoffAlpha"]=.3,["publishSkillGains"]=1,["publishRankGains"]=1,["newGameFlight"]=1,["publishScores"]=1,["enableSounds"]=1,["disableHints"]=nil,["lockWindow"]=nil,["openFlightStart"]=1,["closeFlightEnd"]=nil,["openOnDeath"]=1,["closeReadyCheck"]=1,["openLogin"]=nil,["closeCombat"]=1,["showFlightTooltips"]=1,},["scoreList"]={["friends"]={["classic"]={[1]={"PopCap Games",1,1e3},[2]={"PopCap Games",1,900},[3]={"PopCap Games",1,800},[4]={"PopCap Games",1,700},[5]={"PopCap Games",1,600},[6]={"PopCap Games",1,500},[7]={"PopCap Games",1,400},[8]={"PopCap Games",1,300},[9]={"PopCap Games",1,200},[10]={"PopCap Games",1,100},},["timed"]={[1]={"PopCap Games",1,2.8},[2]={"PopCap Games",1,2.6},[3]={"PopCap Games",1,2.4},[4]={"PopCap Games",1,2.2},[5]={"PopCap Games",1,2},[6]={"PopCap Games",1,1.8},[7]={"PopCap Games",1,1.6},[8]={"PopCap Games",1,1.4},[9]={"PopCap Games",1,1.2},[10]={"PopCap Games",1,1},},},["guild"]={["classic"]={[1]={"PopCap Games",1,1e3},[2]={"PopCap Games",1,900},[3]={"PopCap Games",1,800},[4]={"PopCap Games",1,700},[5]={"PopCap Games",1,600},[6]={"PopCap Games",1,500},[7]={"PopCap Games",1,400},[8]={"PopCap Games",1,300},[9]={"PopCap Games",1,200},[10]={"PopCap Games",1,100},},["timed"]={[1]={"PopCap Games",1,2.8},[2]={"PopCap Games",1,2.6},[3]={"PopCap Games",1,2.4},[4]={"PopCap Games",1,2.2},[5]={"PopCap Games",1,2},[6]={"PopCap Games",1,1.8},[7]={"PopCap Games",1,1.6},[8]={"PopCap Games",1,1.4},[9]={"PopCap Games",1,1.2},[10]={"PopCap Games",1,1},},},},};if(e.window:IsVisible())then e.window:Hide();e.window:Show();end else local e=getglobal("BejeweledWindow");if(e:IsVisible())then e:Hide()else e:Show()end end end function e.CreateCheckbox_OnClick(e)BejeweledProfile.settings[string.match(e:GetName(),"BejeweledCheckBox(.*)")]=e:GetChecked();end function e.CreateSlider_OnValueChanged(e)if(BejeweledProfile.settings[e.objectSetting])then BejeweledProfile.settings[e.objectSetting]=e:GetValue();end if(e.usePercent)then e.valueCaption:SetFormattedText(": %d%%",(e:GetValue()*100));else e.valueCaption:SetFormattedText(": %d",e:GetValue());end if(e.updateFunc)then e:updateFunc();end end function e:CreateSlider(d,S,s,h,n,t,o,r,a,i,l)local t=CreateFrame("Slider","BejeweledSlider"..n,t,"OptionsSliderTemplate");t:SetWidth(s);getglobal(t:GetName().."Thumb"):Show();getglobal(t:GetName().."Text"):SetFont("Fonts\\FRIZQT__.TTF",14);getglobal(t:GetName().."Text"):SetShadowOffset(1,-1);getglobal(t:GetName().."Text"):SetText(h);getglobal(t:GetName().."Text"):SetVertexColor(NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b);getglobal(t:GetName().."Low"):SetText("");getglobal(t:GetName().."Low"):SetVertexColor(HIGHLIGHT_FONT_COLOR.r,HIGHLIGHT_FONT_COLOR.g,HIGHLIGHT_FONT_COLOR.b);getglobal(t:GetName().."High"):SetText("");getglobal(t:GetName().."High"):SetVertexColor(HIGHLIGHT_FONT_COLOR.r,HIGHLIGHT_FONT_COLOR.g,HIGHLIGHT_FONT_COLOR.b);t.valueCaption=e:CreateCaption(0,0,"",t,10,HIGHLIGHT_FONT_COLOR.r,HIGHLIGHT_FONT_COLOR.g,HIGHLIGHT_FONT_COLOR.b)t.valueCaption:ClearAllPoints();t.valueCaption:SetPoint("Topleft",t,"Topright");t:SetHitRectInsets(0,0,0,0);t:SetMinMaxValues(o,r);t:SetValueStep(a);if(BejeweledProfile.settings[n])then if(i)then t.valueCaption:SetFormattedText(": %d%%",(BejeweledProfile.settings[n]*100));else t.valueCaption:SetFormattedText(": %d",BejeweledProfile.settings[n]);end t:SetValue(BejeweledProfile.settings[n]);else t:SetValue(o);if(i)then t.valueCaption:SetFormattedText(": %d%%",(o*100));else t.valueCaption:SetFormattedText(": %d",o);end end t:SetPoint("Topleft",d,S);t:SetScript("OnValueChanged",e.CreateSlider_OnValueChanged);t.updateFunc=l;t.objectSetting=n;t.usePercent=i;return t end function e:CreateCheckbox(l,i,a,o,r,t,n,d)local t=CreateFrame("CheckButton","BejeweledCheckBox"..o,t,"OptionsCheckButtonTemplate");t:SetWidth(21);t:SetHeight(21);getglobal(t:GetName().."Text"):SetFont("Fonts\\FRIZQT__.TTF",13);getglobal(t:GetName().."Text"):SetShadowOffset(1,-1);getglobal(t:GetName().."Text"):SetText("|cFFFF9922"..a);if(d)then t:SetWidth(16);t:SetHeight(16);t:SetNormalTexture("Interface\\Buttons\\UI-RadioButton");t:GetNormalTexture():SetTexCoord(0,.25,0,1);t:SetHighlightTexture("Interface\\Buttons\\UI-RadioButton");t:GetHighlightTexture():SetTexCoord(.5,.75,0,1);t:SetCheckedTexture("Interface\\Buttons\\UI-RadioButton");t:GetCheckedTexture():SetTexCoord(.25,.5,0,1);t:SetPushedTexture("Interface\\Buttons\\UI-RadioButton");t:GetPushedTexture():SetTexCoord(0,.25,0,1);end t:SetPoint("Topleft",l,i);if(BejeweledProfile.settings[o]==r)then t:SetChecked(1);end if(n)then t:SetScript("OnClick",n);else t:SetScript("OnClick",e.CreateCheckbox_OnClick);end return t;end local function C()local e=CreateFrame("Frame","",UIParent);e:SetWidth(1);e:SetHeight(1);e:EnableMouse(false);e:SetAlpha(0);e.animationStack={};e.elapsed=0;e.delay=.025;e.glowFrameDir=1;e.glowFrame=1;e:SetScript("OnUpdate",Ne);e:SetScript("OnEvent",F);e:RegisterEvent("PLAYER_ENTERING_WORLD");e.movingGems=0;e.animationStatus=v;e.tableCos={}e.tableSin={}for t=0,360 do a=-math.rad(t-135);e.tableSin[t]=math.sin(a)*.71 e.tableCos[t]=math.cos(a)*.71 end e:Show();e.shardQueue={};e.lightwaveQueue={};e.lightningQueue={};e.explosionQueue={};e.bigStarQueue={};e.floatingTextQueue={};e.columnOffset={};e.newJewel={};e.Add=ot;e.CreateBigStar=D;e.CreateExplosion=y;e.CreateHyperGem=M;e.CreateImage=X;e.CreateShard=J;e.CreateShardSpawn=W;e.CreateFloatingText=V;e.CreateHint=B;e.CreateLightwave=O;e.CreateLightning=Y;e.RotateTexture=H;return e;end local function I()local o=CreateFrame("Frame","BejeweledNetwork",UIParent);o:SetWidth(1);o:SetHeight(1);o:SetPoint("Top");o:Show();o:RegisterEvent("CHAT_MSG_ADDON");o.queue={};o.Send=function(l,t,n,o,i)p(e.network.queue,t.."@"..n.."~"..o.."~"..(i or("")));end;o.throttleCount=0;o.elapsed=0;o:SetScript("OnUpdate",function(t,o)if(e.resizeUpdate)then if not(n.gameOver)then e.levelBar:SetScore(e.levelBar.score or(0));else e.levelBar.bar:SetWidth(e.levelBar:GetWidth()-4);end e.resizeUpdate=nil;end t.elapsed=t.elapsed+o;if(t.elapsed<1)then return;end t.elapsed=0;t.throttleCount=0;if(#t.queue>0)then if(t.throttleCount<20)then local e,e,e,e;local i,o,e,n;while(t.throttleCount<20)do o,e,n=strsplit("~",g(t.queue,1));if((e=="GUILD")and IsInGuild())then SendAddonMessage(me,o,e,n);t.throttleCount=t.throttleCount+1;elseif(e=="WHISPER")and(n~="")then SendAddonMessage(me,o,e,n);t.throttleCount=t.throttleCount+1;end if(#t.queue==0)then break;end end end end end);o:SetScript("OnEvent",function(l,l,i,n,o,t)if(i==me)then local i,l;i,n=strsplit("@",n);if(i=="HSPub")then if(o=="WHISPER")then local l,i;for l=1,GetNumFriends()do i=GetFriendInfo(l)if(i==t)then e:UpdateScoreList(t,n,o);break;end end else e:UpdateScoreList(t,n,o);end elseif(i=="HSSync")then e:UpdateScoreList(t,n,o);elseif(i=="LogSync")and(UnitName("player")~=t)then e:ProcessScoreList(t,o);end end end);e.network=o;end local function b()local n=CreateFrame("Frame","BejeweledSound",e.window);n:SetWidth(1);n:SetHeight(1);n:SetPoint("Top");n:Show();n.playSound=nil;n.elapsed=0;n.mouseOverElapsed=0;n.mouseOver=true;n.lastClick=0;n.Play=function(t,n,o)if not BejeweledProfile.settings.disableSounds and e.window:IsVisible()then t.playSound=true;if(n=="Combo")then if(o>6)then o=6 end t[n..o]=true;end if(n=="GemClick")then if(t.lastClick>.2)then t[n]=true;t.lastClick=0;end else t[n]=true;end end end;n:SetScript("OnUpdate",function(t,n)if BejeweledProfile.settings.disableSounds then return;end t.mouseOverElapsed=t.mouseOverElapsed+n;t.lastClick=t.lastClick+n;if(t.mouseOverElapsed>.5)and(BejeweledData.legalDisplayed)then t.mouseOverElapsed=0;if t.mouseOver and not e.window.hiding then if not MouseIsOver(e.window.mouseBounds)then if not e.window.resizing then t.waitMouseOver=nil;e.const.windowFadeOut.fadeTimer=0;UIFrameFade(e.window,e.const.windowFadeOut)e.window.mouseOverScreen:Show();t.mouseOver=nil;t:Hide();if(e.paused~=true)then e.mousePaused=true;e:GamePaused(true);end end end end if(t.waitMouseOver)then if MouseIsOver(e.window.mouseBounds)then e.window.mouseOverScreen:Hide();t.waitMouseOver=nil;t.mouseOver=true;end end end if(t.playSound)then t.playSound=nil;local e=Re;if(BejeweledProfile.settings.quietSounds)then e=e.."q_";end if(t.Invalid)then t.Invalid=nil;PlaySoundFile(e.."bad2.mp3");end if(t.Explosion)then t.Explosion=nil;PlaySoundFile(e.."bombexplode.mp3");end if(t.GetReady)then t.GetReady=nil;PlaySoundFile(e.."Get_ready.mp3");end if(t.NoMoreMoves)then t.NoMoreMoves=nil;PlaySoundFile(e.."No_More_Moves.mp3");end if(t.TimesUp)then t.TimesUp=nil;PlaySoundFile(e.."Time_Up.mp3");end if(t.Go)then t.Go=nil;PlaySoundFile(e.."Go.mp3");end if(t.Select)then t.Select=nil;PlaySoundFile(e.."select.mp3");end if(t.PowerCreate)then t.PowerCreate=nil;PlaySoundFile(e.."multishot.mp3");end if(t.HyperCreate)then t.HyperCreate=nil;PlaySoundFile(e.."hypergem_creation.mp3");end if(t.HyperDestroy)then t.HyperDestroy=nil;PlaySoundFile(e.."hypergem_destroyed.mp3");end if(t.GemClick)then t.GemClick=nil;PlaySoundFile(e.."gemongem2.mp3");end if(t.WipeBoard)then t.WipeBoard=nil;PlaySoundFile(e.."explode2.mp3");end if(t.ElectroExplode)then t.ElectroExplode=nil;PlaySoundFile(e.."electro_explode.mp3");end if(t.LevelUp)then t.LevelUp=nil;PlaySoundFile("Sound\\Spells\\LevelUp.wav");end if(t.Combo)then local n;for n=1,6 do if(t["Combo"..n])then if(n==1)then PlaySoundFile(e.."gotset2.mp3");else PlaySoundFile(e.."combo"..(n+1).."2.mp3");end t["Combo"..n]=nil;break;end if(n==6)then t.Combo=nil;end end end end end);e.sound=n;end local function L()local t=CreateFrame("Frame","BejeweledMinimapIcon",Minimap);t:SetWidth(33);t:SetHeight(33);t:SetFrameStrata("LOW");t:EnableMouse(true);t:SetClampedToScreen(true);t.icon=t:CreateTexture(nil,"BACKGROUND");t.icon:SetWidth(26);t.icon:SetHeight(26);t.icon:SetPoint("Center",-1,1);t.icon:SetTexture(l.."windowIcon");t.border=t:CreateTexture(nil,"ARTWORK");t.border:SetWidth(52);t.border:SetHeight(52);t.border:SetPoint("Topleft");t.border:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder");t.highlight=t:CreateTexture(nil,"OVERLAY");t.highlight:SetWidth(32);t.highlight:SetHeight(32);t.highlight:SetPoint("Center");t.highlight:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight");t.highlight:SetBlendMode("ADD");t.highlight:Hide();t:SetPoint("Center",-(76*math.cos(math.rad(0))),(76*math.sin(math.rad(0))))t:Show();t:SetScript("OnMouseDown",function(e,t)e.icon:SetPoint("Center",0,0)if(t=="RightButton")then e.moving=true end end);t:SetScript("OnMouseUp",function(t,n)t.icon:SetPoint("Center",-1,1)t.moving=nil;if(n=="LeftButton")then local t=e.window;if(t:IsVisible())then if not e.popup:IsVisible()then t:Hide()end else t:SetAlpha(BejeweledProfile.settings.mouseoffAlpha);if not MouseIsOver(t)then t.mouseOverScreen:Show();e.sound.mouseOver=nil;e.sound:Hide();if(e.paused~=true)then e.mousePaused=true;e:GamePaused(true);end end t:Show()end end end);t:SetScript("OnEnter",function(e)e.highlight:Show();GameTooltip_SetDefaultAnchor(GameTooltip,UIParent);local e=BejeweledProfile.settings.keybinding or"";if(e~="")then e="("..e..")";end GameTooltip:SetText("|cFFFFFFFFBejeweled |r"..e)GameTooltip:AddLine("Left-click to show/hide game.\nRight-click to move icon.");GameTooltip:Show();end);t:SetScript("OnLeave",function(e)e.highlight:Hide();GameTooltip:Hide();end);t:SetScript("OnUpdate",function(i)if(i.moving)then local o,n=GetCursorPosition()local a=Minimap:GetLeft()+Minimap:GetWidth()/2 local l=Minimap:GetBottom()+Minimap:GetHeight()/2 local e=(o/UIParent:GetScale())-a;local t=(n/UIParent:GetScale())-l;if(sqrt(e^2+t^2)>Minimap:GetWidth())then BejeweledProfile.settings.minimapDetached=true;e=o/UIParent:GetScale();t=n/UIParent:GetScale();BejeweledProfile.settings.minimapX=e;BejeweledProfile.settings.minimapY=t;i:SetPoint("Center",UIParent,"bottomleft",e,t);else local e=math.deg(math.atan2((n/UIParent:GetScale())-l,a-(o/UIParent:GetScale())));BejeweledProfile.settings.minimapAngle=e;BejeweledProfile.settings.minimapDetached=nil;i:SetPoint("Center",Minimap,"Center",-(76*math.cos(math.rad(e))),(76*math.sin(math.rad(e))))end end end);e.minimap=t;end local function B()local t=CreateFrame("Frame","BejeweledWindow",UIParent);t:SetWidth(R);t:SetHeight(Z);t:SetPoint("Center");t:EnableMouse(true);t:SetToplevel(true);t:Hide();t.mouseBounds=CreateFrame("Frame","",t);t.mouseBounds:SetPoint("Topleft",-20,20);t.mouseBounds:SetPoint("Bottomright",20,-20);t.mouseBounds:Show();local a=t:GetFrameLevel();local o=GameTooltip:GetBackdrop();o.edgeFile=l.."windowBorder";o.bgFile=l.."windowBackground";o.edgeSize=32;o.tileSize=64;o.insets.right=3;t:SetBackdrop(o);t:SetBackdropColor(.7,.7,.7,1);t:SetMovable(true);t:RegisterForDrag("LeftButton");t:SetScript("OnDragStart",function(e)if not BejeweledProfile.settings.lockWindow then e:StartMoving();end end);t:SetScript("OnDragStop",function(e)e:StopMovingOrSizing();end);t:SetScript("OnHide",function(t)e.isShown=nil;n.isActive=nil;n.activeTime=0;end);t:SetScript("OnShow",function(t)e.isShown=true;e.window:SetAlpha(BejeweledProfile.settings.gameAlpha);if not MouseIsOver(e.window)then e.sound.waitMouseOver=true;e.sound.mouseOver=nil;else e.sound.waitMouseOver=nil;e.sound.mouseOver=true;end e.window.mouseOverScreen:Hide();e.sound:Show();if(e.summaryScreen:GetAlpha()==1)then e:GamePaused(false);end end);local o=CreateFrame("Button","",t,"UIPanelCloseButton")o:SetToplevel(true);o:SetPoint("Topright",t,"Topright",2,2)o:SetWidth(32);o:SetHeight(32);o:SetScript("OnClick",function(t)if not e.popup:IsVisible()then e.window:Hide();end end);if(bCrowbar)then local e=CreateFrame("Frame","",t)e:SetWidth(32);e:SetHeight(32);e:SetPoint("Right",o,"Left",-2,0);e.art=e:CreateTexture(nil,"Art")e.art:SetTexture("Interface\\AddOns\\Bejeweled\\images\\crowbar");e.art:SetPoint("Center");e.art:SetWidth(32);e.art:SetHeight(32);e:EnableMouse(true);e:SetScript("OnMouseDown",function(e)if bCrowbar.window:IsShown()then bCrowbar.window:Hide();else bCrowbar.window:Show();end end);end local o=CreateFrame("Button","",t,"OptionsButtonTemplate")o:SetToplevel(true);o:SetPoint("Topright",-12,-30);o:SetText("Menu");o:SetWidth(50);o:SetHeight(26);o:SetScript("OnClick",function()local t=e.menuWindow;if(e.aboutScreen:IsVisible()or e.featsOfSkillScreen:IsVisible()or e.optionsScreen:IsVisible())then e.menuWindow.keepScreen=true;end if(t:IsShown())then t:Hide();else t:Show();end end);t.menuButton=o;local o=t:CreateTexture(nil,"Art")o:SetTexture(l.."windowIcon");o:SetPoint("Topleft",-12,4);o:SetWidth(64);o:SetHeight(64);t.icon=o;local o=e.const.largeText["Bejeweled"];local i=CreateFrame("Frame","",t);i:SetPoint("Topleft",t);i:SetPoint("Topright",t,-8,0);i:SetHeight(o[2]);local i=i:CreateTexture(nil,"Art")i:SetTexture(l.."artPieces");i:SetPoint("Bottom",0,0);i:SetWidth(o[1]);i:SetHeight(o[2]);i:SetTexCoord(o[3],o[4],o[5],o[6]);t.logo=i;local o=CreateFrame("Frame","",t);o:SetPoint("Bottomright",0,0);o:SetWidth(32);o:SetHeight(32);o:Show();o:SetFrameLevel(a+3);o:EnableMouse(true);o:SetScript("OnMouseDown",function(n,t)if not BejeweledProfile.settings.lockWindow then if(t=="RightButton")then e.window:SetWidth(R);e.window:SetHeight(u+4+110);else e.window:StartSizing("Right");e.window.resizing=true;end end end);o:SetScript("OnMouseUp",function(t)e.window:StopMovingOrSizing();e.window.resizing=nil;end);t:SetMaxResize(R*1.5,Z*1.5);t:SetMinResize(R/2,Z/2);t:SetResizable(true);t:SetScript("OnSizeChanged",function(t)local o=t:GetWidth()/R;local l=1;local i=1;local a=e.const.largeText["Bejeweled"];if(o<.887)then l=o/.827/(.827/o);if not(t.menuButton.isSmall)then t.menuButton.isSmall=true;t.menuButton:SetWidth(26);t.menuButton:SetText("M");end else if(t.menuButton.isSmall)then t.menuButton.isSmall=nil;t.menuButton:SetWidth(50);t.menuButton:SetText("Menu");end end if(o<.855)then i=o/.855/(.855/o);if(i<.75)then i=.75;end end local r=t:GetWidth()-i*56-t.menuButton:GetWidth();r=math.min(a[1],r);l=r/a[1];e.gameBoard:SetScale(o);e.summaryScreen:SetScale(o);t:SetHeight((u+4)*o+110);if not(n.gameOver)then e.levelBar:SetScore(e.levelBar.score or(0));else e.levelBar.bar:SetWidth(e.levelBar:GetWidth()-4);end t.logo:SetWidth(a[1]*l);t.logo:SetHeight(a[2]*l);t.icon:SetWidth(64*i);t.icon:SetHeight(64*i);e.resizeUpdate=true;end);local n=CreateFrame("Frame","BejeweledShowHideButton",UIParent);n:SetWidth(1);n:SetHeight(1);n:SetPoint("Bottomright");n:SetScript("OnMouseDown",function()if(e.window:IsShown())then e.window:Hide();else e.window:Show();end end);t.showHideButton=n;n=CreateFrame("Frame","BejeweledMouseOverScreen",t);n:SetPoint("Topleft");n:SetPoint("Bottomright");n:EnableMouse(true);n:SetScript("OnMouseDown",function(t)if(e.window.hiding)then e.window.hiding=nil;e.const.windowGameOverFadeOut.timeToFade=-1;e.sound.mouseOver=true;e.sound:Show();t:Hide();end end);n:SetScript("OnEnter",function(t)if(e.window.hiding)then return;end t:Hide();e.const.windowFadeIn.fadeTimer=0;UIFrameFade(e.window,e.const.windowFadeIn)e.sound.mouseOver=true;e.sound:Show();if(e.mousePaused==true)then if(e.summaryScreen:GetAlpha()==1)then e:GamePaused(false);end e.mousePaused=nil;end end);n:SetFrameLevel(t:GetFrameLevel()+80);t.mouseOverScreen=n;n:Show();return t;end local function F()local t=CreateFrame("Frame","BejeweledMenu",e.window);t:SetWidth(h);t:SetHeight(x-20);t:SetPoint("Center");t:EnableMouse(true);t:Hide();t:SetFrameLevel(e.window:GetFrameLevel()+30);local o=GameTooltip:GetBackdrop();o.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"o.bgFile=l.."windowBackground";o.edgeSize=32;o.tileSize=128;o.insets.top=3;t:SetBackdrop(o);t:SetBackdropColor(.6,.6,.6,1);t:SetBackdropBorderColor(1,.8,.45);t:SetMovable(true);local o=CreateFrame("Button","",t,"UIPanelCloseButton")o:SetToplevel(true);o:SetPoint("Topright",t,"Topright",0,2)o:SetWidth(38);o:SetHeight(38);local o=t:CreateFontString(nil,"Overlay");o:SetFont(STANDARD_TEXT_FONT,16,"Outline");o:SetTextColor(1,1,1);o:SetPoint("Top",0,-8);o:SetText("Menu");o:Show();t:SetScript("OnShow",function()e:GamePaused(true);local t=e.menuWindow;if not n.gameOver and(n.gameMode)then t.buttonResume:Show();t.buttonNewGame:ClearAllPoints();t.buttonNewGame:SetPoint("Bottom",t.buttonResume,"Bottom",0,-32);t:SetHeight(x-20);else t.buttonResume:Hide();t.buttonNewGame:ClearAllPoints();t.buttonNewGame:SetPoint("Top",t,"Top",2,-30);t:SetHeight(x-32-18);end e.timedWindow:Hide();e.gameModeWindow:Hide();end);t:SetScript("OnHide",function(t)if(t.keepScreen==true)then t.keepScreen=nil;else e:GamePaused(false);e.aboutScreen:Hide();e.featsOfSkillScreen:Hide();e.optionsScreen:Hide();end end);local n=CreateFrame("Button","BejeweledButtonResume",t,"OptionsButtonTemplate")n:SetPoint("Top",2,-30);n:SetText("Resume");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.menuWindow.keepScreen=nil;e.menuWindow:Hide();e.levelBarButton:Hide();end);t.buttonResume=n;local n=CreateFrame("Button","BejeweledButtonNewGame",n,"OptionsButtonTemplate")n:SetPoint("Bottom",0,-32);n:SetParent(t);n:SetText("New Game");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.menuWindow.keepScreen=true;e.menuWindow:Hide();e.gameModeWindow:Show();end);t.buttonNewGame=n;local n=CreateFrame("Button","BejeweledButtonSkills",n,"OptionsButtonTemplate")n:SetPoint("Top",0,-32);n:SetParent(t);n:SetText("Feats of Skill");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.menuWindow:Hide();e.aboutScreen:Hide();e.optionsScreen:Hide();e.featsOfSkillScreen:Show();if(e.levelBarButton:GetID()==0)then e.levelBarButton:SetID(1);end e.levelBarButton:Show();end);t.buttonSkills=n;local n=CreateFrame("Button","BejeweledButtonOptions",n,"OptionsButtonTemplate")n:SetPoint("Top",0,-32);n:SetParent(t);n:SetText("Options");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.menuWindow:Hide();e.aboutScreen:Hide();e.featsOfSkillScreen:Hide();e.optionsScreen:Show();if(e.levelBarButton:GetID()==0)then e.levelBarButton:SetID(1);end e.levelBarButton:Show();end);t.buttonOptions=n;local n=CreateFrame("Button","BejeweledButtonAbout",n,"OptionsButtonTemplate")n:SetPoint("Top",0,-32);n:SetParent(t);n:SetText("About");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.menuWindow:Hide();t.tabClick(e.aboutScreen.tab2,true);e.featsOfSkillScreen:Hide();e.optionsScreen:Hide();e.aboutScreen:Show();if(e.levelBarButton:GetID()==0)then e.levelBarButton:SetID(1);end e.levelBarButton:Show();end);t.buttonAbout=n;n.tabClick=s;e.menuWindow=t;end local function v()local t=CreateFrame("Frame","BejeweledPopup",e.window);t:SetWidth(h+60);t:SetHeight(x/1.2);t:SetPoint("Center");t:EnableMouse(true);t:Hide();e.popup=t;t:SetFrameLevel(e.window:GetFrameLevel()+23);local n=GameTooltip:GetBackdrop();n.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"n.bgFile=l.."windowBackground";n.edgeSize=32;n.tileSize=128;n.insets.top=3;t:SetBackdrop(n);t:SetBackdropColor(.6,.6,.6,1);t:SetBackdropBorderColor(1,.8,.45);t:SetMovable(true);local n=CreateFrame("Button","",t,"UIPanelCloseButton")n:SetToplevel(true);n:SetPoint("Topright",t,"Topright",0,2)n:SetWidth(38);n:SetHeight(38);local n=t:CreateFontString(nil,"Overlay");n:SetFont(STANDARD_TEXT_FONT,13,"Outline");n:SetTextColor(1,1,1);n:SetPoint("Top",0,-28);n:SetWidth(h+40);n:SetText("");n:Show();t.text=n;t.text.tip1="Create a |cFF0070DD[Power Gem]|r by merging 4 gems of the same color. These new gems will explode when matched, scoring extra points!";t.text.tip2="Create a |cFFA335EE[Hyper Cube]|r by merging 5 gems of the same color. Swap it with a gem to clear all gems of that color onscreen!";t.text.tip3="Now that you've played a game, check out the Options menu to adjust the settings of Bejeweled, or check out the Feats of Skill area to check out your friend's and guild's high scores, your personal stats, and your Bejeweling Skill progress!";t.text.tip4="|cFFFFFFFF|rThis is the Skill Tab. Listed are the moves in the game that will up your Bejeweling skill. This follows other tradeskills in WoW: as you go up in skill old actions will stop giving you points and new actions will show up!\n\nAchievements are special actions that can only be completed once but will give you more points. New achievements unlock at every rank. Achievements must be completed with the addon shown and a game in progress."t:SetScript("OnShow",function(n)n.caption:SetText("");n:ClearAllPoints();if(n.parent)then n:SetPoint("Bottom",n.parent,"Top");n.parent=nil;else n:SetPoint("Center");end e.popup.parent=obj;e.window.menuButton:Disable();if(string.find(t.text:GetText(),"|cFF"))then n:SetHeight(t.text:GetHeight()+50+20);n.button1:Show();n.button2:Hide();n.button3:Hide();else n:SetHeight(t.text:GetHeight()+86+20);n.button1:Hide();n.button2:Show();n.button3:Show();end end);t:SetScript("OnHide",function(t)e.window.menuButton:Enable();end);local n=t:CreateFontString(nil,"Overlay");n:SetFont(STANDARD_TEXT_FONT,13,"Outline");n:SetTextColor(1,1,1);n:SetPoint("Top",0,-8);n:SetWidth(h+40);n:SetText("");n:Show();t.caption=n;local n=CreateFrame("Button","",t,"OptionsButtonTemplate")n:SetPoint("Bottom",0,10);n:SetText(OKAY);n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.popup:Hide();end);t.button1=n;local n=CreateFrame("Button","",t,"OptionsButtonTemplate")n:SetPoint("Bottom",0,15);n:SetText("Feats of Skill");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.popup:Hide();e.menuWindow.buttonSkills:GetScript("OnClick")(t);end);t.button2=n;local n=CreateFrame("Button","",t.button2,"OptionsButtonTemplate")n:SetPoint("Bottom",t.button2,"Top",0,5);n:SetText("Options");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.popup:Hide();e.menuWindow.buttonOptions:GetScript("OnClick")(t);end);t.button3=n;end local function y()local t=CreateFrame("Frame","BejeweledGameModeMenu",e.window);t:SetWidth(h);t:SetHeight(x-100);t:SetPoint("Center");t:EnableMouse(true);t:Hide();t:SetFrameLevel(e.window:GetFrameLevel()+33);local n=GameTooltip:GetBackdrop();n.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"n.bgFile=l.."windowBackground";n.edgeSize=32;n.tileSize=128;n.insets.top=3;t:SetBackdrop(n);t:SetBackdropColor(.6,.6,.6,1);t:SetBackdropBorderColor(1,.8,.45);t:SetMovable(true);local n=CreateFrame("Button","",t,"UIPanelCloseButton")n:SetToplevel(true);n:SetPoint("Topright",t,"Topright",0,2)n:SetWidth(38);n:SetHeight(38);local n=t:CreateFontString(nil,"Overlay");n:SetFont(STANDARD_TEXT_FONT,16,"Outline");n:SetTextColor(1,1,1);n:SetPoint("Top",-10,-8);n:SetText("Game Type");n:Show();t:SetScript("OnShow",function()e:GamePaused(true);end);t:SetScript("OnHide",function(t)if(t.gameMode)then t.gameMode=nil;e:GamePaused(false);else e.menuWindow:Show();end end);local n=CreateFrame("Button","BejeweledGameModeNormal",t,"OptionsButtonTemplate")n:SetPoint("Top",2,-30);n:SetText("Classic");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.gameModeWindow.gameMode=true;e.gameModeWindow:Hide();e.classicModeWindow:Show();end);t.buttonNormal=n;local n=CreateFrame("Button","BejeweledGameModeTimed",n,"OptionsButtonTemplate")n:SetPoint("Bottom",0,-36);n:SetParent(t);n:SetText("Timed");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e.gameModeWindow.gameMode=true;e.gameModeWindow:Hide();e.timedWindow:Show();end);t.buttonTimed=n;e.gameModeWindow=t;end local function P()local t=CreateFrame("Frame","BejeweledClassicMenu",e.window);t:SetWidth(h);t:SetHeight(x-100);t:SetPoint("Center");t:EnableMouse(true);t:Hide();t:SetFrameLevel(e.window:GetFrameLevel()+33);local n=GameTooltip:GetBackdrop();n.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"n.bgFile=l.."windowBackground";n.edgeSize=32;n.tileSize=128;n.insets.top=3;t:SetBackdrop(n);t:SetBackdropColor(.6,.6,.6,1);t:SetBackdropBorderColor(1,.8,.45);t:SetMovable(true);local n=CreateFrame("Button","",t,"UIPanelCloseButton")n:SetToplevel(true);n:SetPoint("Topright",t,"Topright",0,2)n:SetWidth(38);n:SetHeight(38);local n=t:CreateFontString(nil,"Overlay");n:SetFont(STANDARD_TEXT_FONT,16,"Outline");n:SetTextColor(1,1,1);n:SetPoint("Top",-10,-8);n:SetText("Classic Mode");n:Show();t:SetScript("OnShow",function(t)if(BejeweledProfile)and(BejeweledProfile.settings)and(BejeweledProfile.settings.savedState)and(BejeweledProfile.settings.savedState[1][1]~=0)then e:GamePaused(true);else t.gameMode=true;t:Hide();e:NewGame(m,0);end end);t:SetScript("OnHide",function(t)if(t.gameMode)then t.gameMode=nil;e:GamePaused(false);else e.gameModeWindow:Show();end end);local n=CreateFrame("Button","BejeweledClassicNewGame",t,"OptionsButtonTemplate")n:SetPoint("Top",2,-30);n:SetText("Continue");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e:NewGame(m,0,true);e.classicModeWindow.gameMode=true;e.classicModeWindow:Hide();end);t.buttonContinue=n;local n=CreateFrame("Button","BejeweledClassicContinue",n,"OptionsButtonTemplate")n:SetPoint("Bottom",0,-36);n:SetParent(t);n:SetText("New Game");n:SetWidth(h-20);n:SetHeight(28);n:SetScript("OnClick",function(t)e:NewGame(m,0);e.classicModeWindow.gameMode=true;e.classicModeWindow:Hide();end);t.buttonNew=n;e.classicModeWindow=t;end local function O()local n=CreateFrame("Frame","BejeweledFlightOptionMenu",UIParent);n:SetWidth(h);n:SetHeight(x);n:SetToplevel(true);n:SetFrameStrata("High")n:SetPoint("Center");n:EnableMouse(true);n:Hide();n.pathArray={};local t=GameTooltip:GetBackdrop();t.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"t.bgFile=l.."windowBackground";t.edgeSize=32;t.tileSize=128;t.insets.top=3;n:SetBackdrop(t);n:SetBackdropColor(.6,.6,.6,1);n:SetBackdropBorderColor(1,.8,.45);n:SetMovable(true);local t=CreateFrame("Button","",n,"UIPanelCloseButton")t:SetToplevel(true);t:SetPoint("Topright",n,"Topright",0,2)t:SetWidth(38);t:SetHeight(38);local t=n:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,16,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",-10,-8);t:SetText("Flight Path");t:Show();t=n:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,12,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",0,-38);t:SetText("Remaining path time");t:Show();n.timerRemainingCaption=t;t=n:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,18,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",0,-54);t:SetText("0 min 0 sec");t:Show();n.timeRemainingValue=t;t=n:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,12,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",0,-80);t:SetWidth(h-16);t:SetHeight(40);t:SetJustifyV("Top");t:SetJustifyH("Center");t:SetText("Games shorter than 60 seconds don't count.");t:Show();n:SetScript("OnShow",function(t)if not(t.timer.elapsed)then t.buttonGo.disabled=nil;t.buttonGo:Enable();t.timer.elapsed=0;t.timer.timeElapsed=0;t.timer.timeRemaining=t.flightTime;t.timer.legJourney=0;t.timer.learning=t.learning;t.timer:Show();e.timedWindow.timeRemainingValue:SetFormattedText("%d min %d sec",e:SecondsConvert(t.flightTime));if(e.timedWindow:IsVisible())then e.timedWindow:SetHeight(x-30);e.timedWindow.flightCheckbox:Show();e.timedWindow.flightCheckboxCaption:Hide();e.timedWindow.flightCheckbox:SetChecked(nil);e.timedWindow.flightCheckbox:Enable();e.timedWindow.flightCheckbox.disabled=nil;e.timedWindow.timerRemainingCaption:Show();e.timedWindow.timeRemainingValue:Show();end if(t.learning)then e.timedWindow.timerRemainingCaption:SetText("Recording flight time");else e.timedWindow.timerRemainingCaption:SetText("Remaining flight time");end if(BejeweledProfile.settings.newGameFlight)and(e.window:IsVisible()or BejeweledProfile.settings.openFlightStart)then e.flightOptionWindow.buttonGo:OnClickScript();else t:Hide();end e.window:RegisterEvent("PLAYER_CONTROL_GAINED");e.window:RegisterEvent("PLAYER_LEAVING_WORLD");e.window.switchingZones=nil;end t.timer.windowElapsed=0;end);local t=CreateFrame("Button","BejeweledFlightOptionGo",n,"OptionsButtonTemplate")t:SetPoint("Top",2,-120);t:SetText("Start");t:SetWidth(h-20);t:SetHeight(28);t.OnClickScript=function(t)if(e.flightOptionWindow.timer.learning)then e:NewGame(T,e.flightOptionWindow.timer.timeElapsed);e.flightOptionWindow.learning=true;else e:NewGame(T,e.flightOptionWindow.timer.timeRemaining);end e.flightOptionWindow:Hide();e.timedWindow:Hide();e.gameModeWindow:Hide();e.menuWindow:Hide();e.featsOfSkillScreen:Hide();e.window:Show();end;t:SetScript("OnClick",t.OnClickScript);n.buttonGo=t;local t=CreateFrame("Frame","BejeweledFlightTimer",UIParent);t:SetPoint("Top");t:SetWidth(1);t:SetHeight(1);t:Hide();t:SetScript("OnUpdate",f);n.timer=t;t.timeRemaining=0;e.flightOptionWindow=n;end local function H()local o=CreateFrame("Frame","BejeweledTimedMenu",e.window);o:SetWidth(h);o:SetHeight(x-30);o:SetPoint("Center");o:EnableMouse(true);o:Hide();o:SetFrameLevel(e.window:GetFrameLevel()+33);local t=GameTooltip:GetBackdrop();t.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"t.bgFile=l.."windowBackground";t.edgeSize=32;t.tileSize=128;t.insets.top=3;o:SetBackdrop(t);o:SetBackdropColor(.6,.6,.6,1);o:SetBackdropBorderColor(1,.8,.45);o:SetMovable(true);local t=CreateFrame("Button","",o,"UIPanelCloseButton")t:SetToplevel(true);t:SetPoint("Topright",o,"Topright",0,2)t:SetWidth(38);t:SetHeight(38);local t=o:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,16,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",-10,-8);t:SetText("Timed Mode");t:Show();o:SetScript("OnShow",function(t)e:GamePaused(true);t.flightCheckbox.disabled=nil;t.flightCheckbox:Enable();t.flightCheckboxCaption:Hide();t.flightCheckbox:SetChecked(nil);if(e.flightOptionWindow.timer:IsVisible())then t:SetHeight(x-30);t.flightCheckbox:Show();t.timerRemainingCaption:Show();t.timeRemainingValue:Show();else t:SetHeight(x-80);t.flightCheckbox:Hide();t.timerRemainingCaption:Hide();t.timeRemainingValue:Hide();end end);o:SetScript("OnHide",function(t)if(t.newGame)then t.newGame=nil;e:GamePaused(false);if(n.gameMode==j)then e.levelBar:StopTimer();elseif(n.gameMode==T)then e.animator.countdownState=0;n.moveAllowed=nil;end else if not o:IsShown()then e.gameModeWindow:Show();end end end);t=o:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,10,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",0,-28);t:SetText("Time");t:Show();t=o:CreateFontString("BejeweledTimeSliderValue","Overlay");t:SetFont(STANDARD_TEXT_FONT,10,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",0,-70);t:SetText("1 Minute");t:Show();local n=CreateFrame("Slider","BejeweledTimeSlider",o,"OptionsSliderTemplate");getglobal(n:GetName().."Thumb"):Show();getglobal(n:GetName().."Text"):SetText(objectText);getglobal(n:GetName().."Text"):SetVertexColor(NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b);getglobal(n:GetName().."Low"):SetText("");getglobal(n:GetName().."Low"):SetVertexColor(HIGHLIGHT_FONT_COLOR.r,HIGHLIGHT_FONT_COLOR.g,HIGHLIGHT_FONT_COLOR.b);getglobal(n:GetName().."High"):SetText("");getglobal(n:GetName().."High"):SetVertexColor(HIGHLIGHT_FONT_COLOR.r,HIGHLIGHT_FONT_COLOR.g,HIGHLIGHT_FONT_COLOR.b);n:Show();n:SetMinMaxValues(2,10);n:SetValueStep(1);n:SetPoint("Top",0,-50);n:SetScript("OnValueChanged",function(e)getglobal(e:GetName().."Value"):SetText(e:GetValue().." Minute(s)")end);n:SetValue(5);local n=e:CreateCheckbox(14,-88,"Use flightpath time","useFlightpathTime",1,o,function()end);getglobal(n:GetName().."Text"):SetFont("Fonts\\FRIZQT__.TTF",11);getglobal(n:GetName().."Text"):SetShadowOffset(1,-1);o.flightCheckbox=n;t=o:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,11,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",0,-87);t:SetText("|cFFFF9922Flight time is too\nshort for a timed game.");t:Show();o.flightCheckboxCaption=t;t=o:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,10,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",0,-118);t:SetText("Remaining flight time");t:Show();o.timerRemainingCaption=t;t=o:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,10,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Top",0,-134);t:SetText("0s");t:Show();o.timeRemainingValue=t;local t=CreateFrame("Button","BejeweledTimedButtonGo",o,"OptionsButtonTemplate")t:SetPoint("Bottom",1,10);t:SetText("Go!");t:SetWidth(h-20);t:SetHeight(28);t:SetScript("OnClick",function(t)if(e.timedWindow.flightCheckbox:IsVisible()and e.timedWindow.flightCheckbox:GetChecked())then e.flightOptionWindow.buttonGo:OnClickScript();else e:NewGame(j,getglobal("BejeweledTimeSlider"):GetValue()*60);end e.timedWindow.newGame=true;e.timedWindow:Hide();end);e.timedWindow=o;end local function x(t)e.flightOptionWindow:Show();if(BejeweledProfile.settings.openFlightStart)then e.window:Show();e:GamePaused(false);end end local function A(t)local i=t:GetID();local s=GetNumRoutes(i);local w,u,C,m;local c=TaxiRouteMap:GetWidth();local h=TaxiRouteMap:GetHeight();local n;local o;local a=0;local d=0;local S;local r=e.flightOptionWindow.pathArray;local t;for e=1,#r do g(r,1);end SetMapToCurrentZone();local t=ne[GetCurrentMapContinent()]or BejeweledData.flightTimes[GetCurrentMapContinent()];if not(t)then BejeweledData.flightTimes[GetCurrentMapContinent()]={};t=BejeweledData.flightTimes[GetCurrentMapContinent()];end local f=TaxiNodeGetType(i);if(f=="REACHABLE")then TaxiNodeSetCurrent(i);if(s>NUM_TAXI_ROUTES)then NUM_TAXI_ROUTES=s;end for l=1,NUM_TAXI_ROUTES do if(l<=s)then w=TaxiGetSrcX(i,l)*c;u=TaxiGetSrcY(i,l)*h;C=TaxiGetDestX(i,l)*c;m=TaxiGetDestY(i,l)*h;n=string.format("%d,%d",w,u);o=string.format("%d,%d",C,m);d=0;if not(t[n])then t=BejeweledData.flightTimes[GetCurrentMapContinent()];if not t[n]then t[n]={};end end if not(t[n][o])then t=BejeweledData.flightTimes[GetCurrentMapContinent()];if not t then BejeweledData.flightTimes[GetCurrentMapContinent()]={};t=BejeweledData.flightTimes[GetCurrentMapContinent()];end if not(t[n])then t=BejeweledData.flightTimes[GetCurrentMapContinent()];if not t[n]then t[n]={};end end end if(t==ne)then local e=BejeweledData.flightTimes[GetCurrentMapContinent()];if(e)then if(e[n])then if(e[n][o])then t=e;end end end end t[n][o]=t[n][o]or 0;d=t[n][o];a=a+d;if(l>2)then a=a-1.5;end if(d==0)then S=true;end p(r,n);p(r,o);p(r,d);end end e.flightOptionWindow.flightTime=math.floor(a);e.flightOptionWindow.learning=S;if(BejeweledProfile.settings.showFlightTooltips)then if(S)then GameTooltip:AddLine("Travel time: Unknown (one or more");GameTooltip:AddLine("legs of the journey need to be timed)");else GameTooltip:AddLine("Travel time: "..e:TotalTime(math.floor(a)),1,1,0);end end GameTooltip:Show();elseif(f=="CURRENT")then end end local function T()local r=e.window;local n=CreateFrame("Frame","BejeweledSummaryScreen",getglobal("BejeweledGameBoardAnchor"));n:SetPoint("Top",0,-3)n:SetWidth(S+6);n:SetHeight(u+6);local i=GameTooltip:GetBackdrop();i.bgFile=l.."windowBackground";i.tileSize=128;i.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"i.edgeSize=32;n:SetBackdrop(i);n:SetBackdropColor(.7,.7,.7,1);n:SetBackdropBorderColor(1,.8,.45);n:SetFrameLevel(r:GetFrameLevel()+20);n:Hide();e.summaryScreen=n;local t=e:CreateCaption(0,0,"Game Over!",n,20,1,.85,.1,true);t:ClearAllPoints();t:SetPoint("Top",0,-10);t:Show();local o=CreateFrame("Frame","",n);o:SetPoint("Top",0,-36)o:SetWidth(S+6-24);o:SetHeight(u+6-48);o:SetBackdrop(i);o:SetBackdropColor(.2,.2,.2,1);o:SetBackdropBorderColor(1,1,1);o:SetFrameLevel(r:GetFrameLevel()+21);o:Show();n.FillData=Ee;a=2;local l=48;local i=20 t=e:CreateCaption(0,0,"Final Score",o,14,1,1,0);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+i n.scoreCaption=t;t=e:CreateCaption(0,0,"0",o,20,1,1,1);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+l n.scoreValue=t;t=e:CreateCaption(0,0,"Time",o,14,1,1,0);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+i n.timeCaption=t;t=e:CreateCaption(0,0,"1 min 3 sec",o,20,1,1,1);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+l n.timeValue=t;t=e:CreateCaption(0,0,"Level",o,14,1,.7,0);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+i n.levelCaption=t;t=e:CreateCaption(0,0,"15",o,20,1,1,1);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+l n.levelValue=t;t=e:CreateCaption(0,0,"Largest Cascade",o,14,1,.7,0);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+i n.cascadeCaption=t;t=e:CreateCaption(0,0,"5",o,20,1,1,1);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+l n.cascadeValue=t;t=e:CreateCaption(0,0,"Largest Combo",o,14,1,.7,0);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+i n.comboCaption=t;t=e:CreateCaption(0,0,"12",o,20,1,1,1);t:ClearAllPoints();t:SetPoint("Top",0,-20-a);a=a+l n.comboValue=t;local t=CreateFrame("Button","BejeweledSummaryButtonPublish",o,"OptionsButtonTemplate")t:SetPoint("Bottomleft",8,10);t:SetText("Publish Scores");t:SetWidth(128);t:SetHeight(28);t:SetScript("OnClick",function(t)if(t.dataDump)then e.network:Send("HSPub",t.dataDump,"GUILD","");local o,n;for o=1,GetNumFriends()do n,_,_,_,online=GetFriendInfo(o)if(online)then e.network:Send("HSPub",t.dataDump,"WHISPER",n);end end t.dataDump=nil;t:Hide();e.menuWindow.buttonSkills:GetScript("OnClick")(e.menuWindow.buttonSkills);e.featsOfSkillScreen.tab3:GetScript("OnMouseDown")(e.featsOfSkillScreen.tab3);end e.popup:Hide();end);n.publishButton=t;local t=CreateFrame("Button","BejeweledSummaryButtonViewScores",o,"OptionsButtonTemplate")t:SetPoint("Bottomright",-8,10);t:SetText("See High Scores");t:SetWidth(128);t:SetHeight(28);t:SetScript("OnClick",function(t)e.menuWindow.buttonSkills:GetScript("OnClick")(e.menuWindow.buttonSkills);e.featsOfSkillScreen.tab3:GetScript("OnMouseDown")(e.featsOfSkillScreen.tab3);e.popup:Hide();end);n.seeScoresButton=t;end local function g()local n=e.window;local t;local t=getglobal("BejeweledGameBoard");local a=CreateFrame("Frame","BejeweledFeatsOfSkillScreen",t);a:SetPoint("Top",0,-3-22)a:SetWidth(S+6);a:SetHeight(u+6-22);a:EnableMouse(true);local d=GameTooltip:GetBackdrop();d.bgFile=l.."windowBackground";d.tileSize=128;d.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"d.edgeSize=32;a:SetBackdrop(d);a:SetBackdropColor(.43,.43,.43,1);a:SetBackdropBorderColor(1,.8,.45);a:SetFrameLevel(n:GetFrameLevel()+25);a:Hide();a:SetScript("OnShow",function(t)e:GamePaused(true);t.tab1:Show();t.tab2:Show();t.tab3:Show();t.tab4:Show();getglobal("BejeweledGame"):SetAlpha(0);e.summaryScreen:SetAlpha(0);e.animator.hintObj:SetAlpha(0);end);a:SetScript("OnHide",function(t)getglobal("BejeweledGame"):SetAlpha(1);e.summaryScreen:SetAlpha(1);e.animator.hintObj:SetAlpha(1);end);e.featsOfSkillScreen=a;local t=CreateFrame("Frame","",a);t:SetPoint("Bottomleft",a,"Topleft",5,-14);t:SetWidth(100);t:SetHeight(34);t:Show();t.texture=t:CreateTexture(nil,"ARTWORK")t.texture:SetPoint("Topleft");t.texture:SetWidth(100);t.texture:SetHeight(34);t.texture:SetTexture(l.."tabs");t.texture:SetTexCoord(0/255,80/255,0/255,31/255);t.texture:Show();t:EnableMouse(true);t:SetID(1);t:SetScript("OnMouseDown",s);a.tab1=t;t=CreateFrame("Frame","",a);t:SetPoint("Bottomleft",a,"Topleft",106,-14);t:SetWidth(100);t:SetHeight(34);t:Show();t.texture=t:CreateTexture(nil,"ARTWORK")t.texture:SetPoint("Topleft");t.texture:SetWidth(99);t.texture:SetHeight(34);t.texture:SetTexture(l.."tabs");t.texture:SetTexCoord(80/255,160/255,0/255,31/255);t.texture:Show();t.texture:SetVertexColor(.5,.5,.5);t:SetFrameLevel(n:GetFrameLevel()+24);t:EnableMouse(true);t:SetID(2);t:SetScript("OnMouseDown",s);a.tab2=t;t=CreateFrame("Frame","",a);t:SetPoint("Bottomleft",a,"Topleft",206,-14);t:SetWidth(100);t:SetHeight(34);t:Show();t.texture=t:CreateTexture(nil,"ARTWORK")t.texture:SetPoint("Topleft");t.texture:SetWidth(100);t.texture:SetHeight(34);t.texture:SetTexture(l.."tabs");t.texture:SetTexCoord(160/255,240/255,0/255,31/255);t.texture:Show();t.texture:SetVertexColor(.5,.5,.5);t:SetFrameLevel(n:GetFrameLevel()+24);t:EnableMouse(true);t:SetID(3);t:SetScript("OnMouseDown",s);a.tab3=t;t=CreateFrame("Frame","",a);t:SetPoint("Bottomright",a,"Topright",-1,-14);t:SetWidth(100);t:SetHeight(34);t:Show();t.texture=t:CreateTexture(nil,"ARTWORK")t.texture:SetPoint("Topright");t.texture:SetWidth(100);t.texture:SetHeight(34);t.texture:SetTexture(l.."tabs");t.texture:SetTexCoord(0/255,80/255,32/255,63/255);t.texture:Show();t.texture:SetVertexColor(.5,.5,.5);t:SetFrameLevel(n:GetFrameLevel()+24);t:EnableMouse(true);t:SetID(4);t:SetScript("OnMouseDown",s);a.tab4=t;local i=CreateFrame("Frame","",a);i:SetPoint("Top",0,-10)i:SetWidth(S+6-24);i:SetHeight(u+6-68);a.tab1Content=i;t=e:CreateCaption(0,0,"Bejeweling Skill Rank: ________",i,16,1,.85,.1,true);t:ClearAllPoints();t:SetPoint("Top",0,-2);t:Show();i.title=t;local n=CreateFrame("Frame","BejeweledSkillBar",i);n:SetPoint("Top",0,-20)n:SetWidth(S+6-24);n:SetHeight(32);d=GameTooltip:GetBackdrop();d.edgeFile="Interface\\Buttons\\UI-SliderBar-Border"d.edgeSize=8;d.bgFile=l.."windowBackground";d.tileSize=64;d.insets.left=2;d.insets.right=2;n:SetBackdrop(d);n:SetBackdropColor(.1,.1,.1,0);n:SetFrameLevel(i:GetFrameLevel()+2);e.skillBar=n;n.CheckSkill=function(o,t,n,S)local d=BejeweledProfile.skill.skillPoints;local i=e.const.skillData;local l;local r;local h;local s;local a=450;if(e.skillLimit)then a=375 end local c=(a==d);if(((d>=i[t][n][2])or(S))and(d=6)and(d>=i[t][n][2]))then local o=0;while((o<3)and(d>=i[t][n][3+o]))do o=o+1;end if(t>=6)then o=0;end if(o<3)or(S)then if(o==0)then l=1;else if(math.random(1,100)<=(100-o*33))then l=1;end end if(S)then l=1;end if(l)then if(t<6)then BejeweledProfile.skill.skillPoints=BejeweledProfile.skill.skillPoints+1;else if(i[t][n][2]<=d)and(i[t][n][2]<(a-1))then h='[Bejeweled Addon] You just completed "'..i[t][n][1]..'."'if(t==e.const.SKILLTYPE_FUN)then BejeweledProfile.skill.skillPoints=BejeweledProfile.skill.skillPoints+3;BejeweledProfile.skill["gainFun"..n]=true;r=e.animator:CreateFloatingText(50,0,"+3 Skill",3,true);s=3;if not BejeweledProfile.skill["gainAchieve"..e.const.SKILL_ACHIEVE6A]then local n,n;local n=true;for e=1,#i[t]do if not BejeweledProfile.skill["gainFun"..e]then n=nil;break;end end if(n)then e.skillBar:CheckSkill(e.const.SKILLTYPE_ACHIEVEMENT,e.const.SKILL_ACHIEVE6A);end end elseif(t==e.const.SKILLTYPE_ACHIEVEMENT)then BejeweledProfile.skill.skillPoints=BejeweledProfile.skill.skillPoints+5;BejeweledProfile.skill["gainAchieve"..n]=true;r=e.animator:CreateFloatingText(50,0,"+5 Skill",3,true);s=5;end else l=nil;end end if(r)then r.fxType=N;r:Show();e.animator:Add(r);end if(S)then BejeweledProfile.skill.skillPoints=BejeweledProfile.skill.skillPoints+4;end if(BejeweledProfile.skill.skillPoints>a)then BejeweledProfile.skill.skillPoints=a;end if(l)and(s or(c~=true))then if(BejeweledProfile.settings.publishSkillGains)then if(s)then if(c)then e:Print(h,ChatTypeInfo["SKILL"].r,ChatTypeInfo["SKILL"].g,ChatTypeInfo["SKILL"].b);else e:Print(h.." +"..s.." Skill!",ChatTypeInfo["SKILL"].r,ChatTypeInfo["SKILL"].g,ChatTypeInfo["SKILL"].b);end else e:Print("Your skill in Bejeweling has increased to "..BejeweledProfile.skill.skillPoints..".",ChatTypeInfo["SKILL"].r,ChatTypeInfo["SKILL"].g,ChatTypeInfo["SKILL"].b);end end e.skillBar.bar:SetWidth((e.skillBar:GetWidth()-4)*((BejeweledProfile.skill.skillPoints-((BejeweledProfile.skill.rank-1)*75))/75)+.5);if(BejeweledProfile.skill.skillPoints>=BejeweledProfile.skill.rank*75)then if(BejeweledProfile.skill.rank<6)then if(a==450)or(BejeweledProfile.skill.rank<5)then BejeweledProfile.skill.rank=BejeweledProfile.skill.rank+1;if(BejeweledProfile.settings.publishSkillGains)then e:Print("Your Bejeweling skill is now of the "..e.const.skillDataRanks[BejeweledProfile.skill.rank].." rank.",ChatTypeInfo["SKILL"].r,ChatTypeInfo["SKILL"].g,ChatTypeInfo["SKILL"].b);end if(BejeweledProfile.settings.publishRankGains)and(IsInGuild())then local t="[Bejeweled Addon]: I have become a";local n=BejeweledProfile.skill.rank;if(n==1)or(n==3)or(n==4)then t=t.."n ";else t=t.." ";end SendChatMessage(t..e.const.skillDataRanks[BejeweledProfile.skill.rank].." in Bejeweling Skill!","GUILD");end end else end e.skillBar.leftIcon:SetTexCoord(((BejeweledProfile.skill.rank-1)*16/128),(BejeweledProfile.skill.rank*16/128),0,1);e.skillBar.rightIcon:SetTexCoord((BejeweledProfile.skill.rank*16/128),((BejeweledProfile.skill.rank+1)*16/128),0,1);e.skillBar.bar:SetWidth(1);end end e.skillBar.text:SetFormattedText("%d / %d",BejeweledProfile.skill.skillPoints,(BejeweledProfile.skill.rank*75));e.featsOfSkillScreen.tab1Content:UpdateSkillScreen();end end end return l or(0);end local o=CreateFrame("Frame","",i);o:SetPoint("Top",0,-20)o:SetWidth(S+6-24);o:SetHeight(32);d=GameTooltip:GetBackdrop();d.bgFile=l.."windowBackground";d.tileSize=128;d.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"d.edgeSize=32;d.insets.left=2;d.insets.right=2;o:SetBackdrop(d);o:SetBackdropColor(.1,.1,.1);o:SetBackdropBorderColor(0,0,0,0);o:SetFrameLevel(i:GetFrameLevel()+1);local o=o:CreateTexture(nil,"OVERLAY");o:SetTexture(l.."barArt");o:SetVertexColor(0,.2,1)o:SetPoint("Topleft",2,-5);o:SetHeight(32);n.bar=o;n.text=e:CreateCaption(0,0,"0 / 75",n,12,1,1,1,true);n.text:ClearAllPoints();n.text:SetPoint("Center",0,1);local o=n:CreateTexture(nil,"OVERLAY");o:SetTexture(l.."rankIcons");o:SetPoint("Topleft",3,-6);o:SetWidth(20);o:SetHeight(20);o:SetTexCoord(0,0,0,0);n.leftIcon=o;o=n:CreateTexture(nil,"OVERLAY");o:SetTexture(l.."rankIcons");o:SetPoint("Topright",-3,-6);o:SetWidth(20);o:SetHeight(20);o:SetTexCoord(0,0,0,0);n.rightIcon=o;local o=CreateFrame("Frame","",i);o:SetPoint("Top",0,-52)o:SetWidth(S+6-24);o:SetHeight(21*15);o:SetBackdrop(d);o:SetBackdropColor(.2,.2,.2,1);o:SetBackdropBorderColor(1,1,1);o:Show();local r=CreateFrame("ScrollFrame","BejeweledSkillListScroller",o,"UIPanelScrollFrameTemplate")r:SetPoint("Topleft",0,-9)r:SetPoint("Bottomright",-32,9)local n=CreateFrame("Frame","BejeweledSkillList",o);n:SetPoint("Top",0,-9)n:SetWidth(S+6-24);n:SetHeight(21*15*3);n:Show();r:SetScrollChild(n);o=n;local n;local s;local h=function(e)e.text:SetVertexColor(1,1,1);end local c=function(e)e.text:SetVertexColor(1,.82,0);end local f=function(i)local t;local t=e.featsOfSkillScreen.tab1Content;local n=i:GetID();local o;local r=e.const.skillData;local l;local a=e.featsOfSkillScreen.tab1Content.skillTextSize;if(i.opened)then i.opened=nil;for e=1,#r[n]do o=t["section"..n.."Item"..e];o:SetHeight(.01);o.text:Hide();if(o.hasData)then t.scrollHeight=t.scrollHeight-a;end end if(n<#e.const.skillData)then t["section"..tostring(n+1).."Header"]:ClearAllPoints();t["section"..tostring(n+1).."Header"]:SetPoint("Topleft",i,"Bottomleft",0,-2);end i.expander:SetTexture("Interface\\Buttons\\UI-PlusButton-UP");else i.opened=true;local l;for e=1,#r[n]do o=t["section"..n.."Item"..e];if(o.hasData)then o:SetHeight(a+1);o.text:Show();l=o;t.scrollHeight=t.scrollHeight+a;else break;end end if(n<#e.const.skillData)and(l)then t["section"..(n+1).."Header"]:ClearAllPoints();t["section"..(n+1).."Header"]:SetPoint("Topleft",l,"Bottomleft",0,-2);end i.expander:SetTexture("Interface\\Buttons\\UI-MinusButton-UP");end getglobal("BejeweledSkillList"):SetHeight(t.scrollHeight);end local r=13;i.skillTextSize=r;for n=1,#e.const.skillData do t=CreateFrame("Frame","",o);t:SetWidth(o:GetWidth());t:SetHeight(r+1);t:SetScript("OnEnter",h);t:SetScript("OnLeave",c);t:SetScript("OnMouseDown",f);t:SetID(n);t:EnableMouse(true);t.expander=t:CreateTexture(nil,"ARTWORK");t.expander:SetWidth(14);t.expander:SetHeight(14);t.expander:SetPoint("Topleft",10,0);t.expander:SetTexture("Interface\\Buttons\\UI-MinusButton-UP");t.opened=true;if(n==1)then t:SetPoint("Topleft",0,-2);else t:SetPoint("Topleft",s,"Bottomleft",0,-2);end i["section"..n.."Header"]=t;t.text=e:CreateCaption(27,0,e.const.skillDataNames[n],t,r,1,.82,0);s=t;for l=1,#e.const.skillData[n]do t=CreateFrame("Frame","",o);t:SetWidth(o:GetWidth());t:SetHeight(r+1);t:SetPoint("Topleft",s,"Bottomleft",0,-2);i["section"..n.."Item"..l]=t;t.text=e:CreateCaption(32,0,"Item "..l,t,r,1,1,0);t.text:SetVertexColor(.5,.5,.5);t.hasData=true;s=t;end end i.UpdateSkillScreen=function(o)local t=BejeweledProfile.skill.rank;local h=BejeweledProfile.skill.skillPoints;o.title:SetFormattedText("Bejeweling Skill Rank: %s",e.const.skillDataRanks[t]);e.skillBar.text:SetFormattedText("%d / %d",BejeweledProfile.skill.skillPoints,(BejeweledProfile.skill.rank*75));e.skillBar.bar:SetWidth((e.skillBar:GetWidth()-4)*((BejeweledProfile.skill.skillPoints-((BejeweledProfile.skill.rank-1)*75))/75)+1);e.skillBar.leftIcon:SetTexCoord(((BejeweledProfile.skill.rank-1)*16/128),(BejeweledProfile.skill.rank*16/128),0,1);e.skillBar.rightIcon:SetTexCoord((BejeweledProfile.skill.rank*16/128),((BejeweledProfile.skill.rank+1)*16/128),0,1);local t;local a=1;local t,t,n,S,d;local l=e.const.skillData;local s=e.featsOfSkillScreen.tab1Content.skillTextSize;local r=1;for e=1,#l do o["section"..e.."Header"].current=1;o["section"..e.."Header"]:SetHeight(.01);o["section"..e.."Header"]:Hide();for t=1,#l[e]do n=o["section"..e.."Item"..t]n.hasData=nil;n.text:Hide();n:SetHeight(.01);end end for t=1,#l do if(t>1)and(S)then if(d)then o["section"..t.."Header"]:ClearAllPoints();o["section"..t.."Header"]:SetPoint("Topleft",d,"Bottomleft",0,-2);end end S=o["section"..t.."Header"].opened;foundFeat=nil;for i=#l[t],1,-1 do if(l[t][i])then if(h>=l[t][i][2])then a=1;if(t<6)then while((a<4)and(h>=l[t][i][2+a]))do a=a+1;end end if(a==4)then if(h>=l[t][i][5]+20)then a=nil;end end if(a)then if not foundFeat then foundFeat=true;d=nil;end itemID=o["section"..t.."Header"].current;o["section"..t.."Header"].current=itemID+1;n=o["section"..t.."Item"..itemID]n.hasData=true;d=n;r=r+s;if(t<6)then n.text:SetText(l[t][i][1]);n.text:SetVertexColor(unpack(e.const.skillDataColors[a]));else if((t==6)and(BejeweledProfile.skill["gainFun"..i]==true))or((t==7)and(BejeweledProfile.skill["gainAchieve"..i]==true))then if(string.find(l[t][i][1],"%("))then n.text:SetText(string.gsub(l[t][i][1],"%((.)(.*)%)","(%1)").." (Complete)");else n.text:SetText(l[t][i][1].." (Complete)");end n.text:SetVertexColor(.2,.4,1);else n.text:SetText(l[t][i][1]);n.text:SetVertexColor(unpack(e.const.skillDataColors[a]));end end if(S)then n:SetHeight(s+1);n.text:Show();end end end end end if(foundFeat)then o["section"..t.."Header"]:SetHeight(s+1);o["section"..t.."Header"]:Show();r=r+s;end end e.featsOfSkillScreen.tab1Content.scrollHeight=r;getglobal("BejeweledSkillList"):SetHeight(r);if not(BejeweledData.firstSkillShow)and(o:IsVisible())then BejeweledData.firstSkillShow=true;e.popup.text:SetText(e.popup.text.tip4);e.popup:Hide();e.popup:SetFrameLevel(e.featsOfSkillScreen.tab1Content:GetFrameLevel()+5);e.popup:Show();e.popup.caption:SetText("Bejeweling Skill");end end i:SetScript("OnShow",i.UpdateSkillScreen);i=CreateFrame("Frame","",a);i:SetPoint("Top",0,-10);i:SetWidth(S+6-24);i:SetHeight(u+6-68);i:Hide();i:SetScript("OnShow",function(t)t.scoreClassic:SetText(e:NumberWithCommas(BejeweledProfile.stats.classic.score));t.scoreTimed:SetFormattedText("%.2f",BejeweledProfile.stats.timed.score);t.highestLevel:SetText(BejeweledProfile.stats.classic.highestLevel);t.mostMoves:SetText(BejeweledProfile.stats.timed.mostMoves);t.largestCascade:SetText(BejeweledProfile.stats.largestCascade);t.largestCombo:SetText(BejeweledProfile.stats.largestCombo);t.totalPlayed:SetText(e:TotalTime(BejeweledProfile.stats.played));t.classicPlayed:SetText(e:TotalTime(BejeweledProfile.stats.classic.played));t.timedPlayed:SetText(e:TotalTime(BejeweledProfile.stats.timed.played));t.combatPaused:SetText(BejeweledProfile.stats.combatPause);t.totalGems:SetText(BejeweledProfile.stats.totalGemsMatched);t.totalHyper:SetText(BejeweledProfile.stats.totalHyperGems);t.totalPower:SetText(BejeweledProfile.stats.totalPowerGems);local e=1;local n;for t=2,#BejeweledProfile.stats.gemMatch do if(BejeweledProfile.stats.gemMatch[t]>BejeweledProfile.stats.gemMatch[e])then e=t;end end if(e==1)and(BejeweledProfile.stats.gemMatch[1]==BejeweledProfile.stats.gemMatch[2])then t.favoriteColor:SetText("|cFFFFFFFF"..NONE);else t.favoriteColor:SetText(Me[e]);end end);a.tab2Content=i;t=e:CreateCaption(0,0,"Personal Bests",i,16,1,.85,.1,true);t:ClearAllPoints();t:SetPoint("Top",0,-2);t:Show();o=CreateFrame("Frame","",i);o:SetPoint("Top",0,-26)o:SetWidth(S+6-24);o:SetHeight(6*20+6);o:SetBackdrop(d);o:SetBackdropColor(.2,.2,.2,1);o:SetBackdropBorderColor(1,1,1);o:Show();n=9;local r=16;t=e:CreateCaption(10,n,"Best Classic Mode Score |cFFFF9922(Points)",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Best Timed Mode Score |cFFFF9922(PPS)",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Highest Level |cFFFF9922(Classic)",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Most Moves |cFFFF9922(Timed)",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Largest Cascade",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Largest Combo",o,r,1,.85,.1);n=n+18;n=9;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.scoreClassic=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.scoreTimed=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.highestLevel=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.mostMoves=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.largestCascade=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.largestCombo=t;t=e:CreateCaption(0,0,"Fun Statistics",i,16,1,.85,.1,true);t:ClearAllPoints();t:SetPoint("Top",0,-24-132);t:Show();o=CreateFrame("Frame","",i);o:SetPoint("Top",0,-36-20-122)o:SetWidth(S+6-24);o:SetHeight(9*20+4);o:SetBackdrop(d);o:SetBackdropColor(.2,.2,.2,1);o:SetBackdropBorderColor(1,1,1);o:Show();n=11;t=e:CreateCaption(10,n,"Total Time /Played",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Classic Mode /Played",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Timed Mode /Played",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Times Entered Combat While Playing",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Favorite Color |cFFFF9922(Gem)",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"Total Gems Matched",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"|cFFA335EE[Hyper Cube]|r Total",o,r,1,.85,.1);n=n+18;t=e:CreateCaption(10,n,"|cFF0070DD[Power Gem]|r Total",o,r,1,.85,.1);n=n+18;n=11;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.totalPlayed=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.classicPlayed=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.timedPlayed=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.combatPaused=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.favoriteColor=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.totalGems=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.totalHyper=t;t=e:CreateCaption(10,n,"0",o,r,1,1,1);t:ClearAllPoints();t:SetPoint("TopRight",-10,-n)n=n+18;i.totalPower=t;i=CreateFrame("Frame","",a);i:SetPoint("Top",0,-10)i:SetWidth(S+6-24);i:SetHeight(u+6-68);i:Hide();i:GetID(3);i:SetScript("OnShow",function(e)local t=e:GetID();if(t==3)then e:PopulateScores("friends")elseif(t==4)then e:PopulateScores("guild")end end);i.PopulateScores=k;a.tab3Content=i;t=e:CreateCaption(0,0,"Best Classic Mode Score |cFFFF9922(Points)",i,16,1,.85,.1,true);t:ClearAllPoints();t:SetPoint("Top",0,-2);t:Show();o=CreateFrame("Frame","",i);o:SetPoint("Top",0,-26)o:SetWidth(S+6-24);o:SetHeight(150+6);o:SetBackdrop(d);o:SetBackdropColor(.2,.2,.2,1);o:SetBackdropBorderColor(1,1,1);o:Show();for n=1,10 do t=e:CreateCaption(10,n*14-7,(n.."."),o,12,1,.53,.13);t:ClearAllPoints();t:SetPoint("Topright",o,"Topleft",38,-(n*14-7));t=o:CreateTexture(nil,"ARTWORK");t:SetTexture(l.."rankIcons");t:SetTexCoord(0,0,0,0);t:SetWidth(10);t:SetHeight(10);t:SetPoint("Topleft",40,-(n*14-6));i["classicRank"..n]=t;t=e:CreateCaption(54,n*14-7,"Moongaze",o,12,1,.85,.1);i["classicName"..n]=t;t=e:CreateCaption(10,n*14-7,"9876543",o,12,1,1,1);t:ClearAllPoints();t:SetPoint("Topright",-10,-(n*14-7));i["classicScore"..n]=t;end t=e:CreateCaption(0,0,"Best Timed Mode Score |cFFFF8822(PPS)",i,16,1,.85,.1,true);t:ClearAllPoints();t:SetPoint("Top",0,-26-154-4);t:Show();o=CreateFrame("Frame","",i);o:SetPoint("Top",0,-26-154-26)o:SetWidth(S+6-24);o:SetHeight(150+6);o:SetBackdrop(d);o:SetBackdropColor(.2,.2,.2,1);o:SetBackdropBorderColor(1,1,1);o:Show();for n=1,10 do t=e:CreateCaption(10,n*14-7,(n.."."),o,12,1,.53,.13);t:ClearAllPoints();t:SetPoint("Topright",o,"Topleft",38,-(n*14-7));t=o:CreateTexture(nil,"ARTWORK");t:SetTexture(l.."rankIcons");t:SetTexCoord(0,0,0,0);t:SetWidth(10);t:SetHeight(10);t:SetPoint("Topleft",40,-(n*14-6));i["timedRank"..n]=t;t=e:CreateCaption(54,n*14-7,"Moongaze",o,12,1,.85,.1);i["timedName"..n]=t;t=e:CreateCaption(10,n*14-7,"9876543",o,12,1,1,1);t:ClearAllPoints();t:SetPoint("Topright",-10,-(n*14-7));i["timedScore"..n]=t;end a.tab4Content=i;end local function p()local n=e.window;local t;local t=getglobal("BejeweledGameBoard");local i=CreateFrame("Frame","BejeweledAboutScreen",t);i:SetPoint("Top",0,-3-22)i:SetWidth(S+6);i:SetHeight(u+6-22);i:EnableMouse(true);local r=GameTooltip:GetBackdrop();r.bgFile=l.."windowBackground";r.tileSize=128;r.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"r.edgeSize=32;i:SetBackdrop(r);i:SetBackdropColor(.43,.43,.43,1);i:SetBackdropBorderColor(1,.8,.45);i:SetFrameLevel(n:GetFrameLevel()+25);i:Hide();i:SetScript("OnShow",function(t)e:GamePaused(true);t.tab1:Show();t.tab2:Show();t.tab3:Show();getglobal("BejeweledGame"):SetAlpha(0);e.summaryScreen:SetAlpha(0);e.animator.hintObj:SetAlpha(0);end);i:SetScript("OnHide",function(t)getglobal("BejeweledGame"):SetAlpha(1);e.summaryScreen:SetAlpha(1);e.animator.hintObj:SetAlpha(1);end);e.aboutScreen=i;local t=CreateFrame("Frame","",i);t:SetPoint("Bottomleft",i,"Topleft",5,-14);t:SetWidth(133);t:SetHeight(34);t:Show();t.texture=t:CreateTexture(nil,"ARTWORK")t.texture:SetPoint("Topleft");t.texture:SetWidth(133);t.texture:SetHeight(34);t.texture:SetTexture(l.."tabs");t.texture:SetTexCoord(0/255,111/255,64/255,95/255);t.texture:Show();t:EnableMouse(true);t:SetID(1);t:SetScript("OnMouseDown",s);i.tab1=t;t=CreateFrame("Frame","",i);t:SetPoint("Bottomleft",i,"Topleft",139,-14);t:SetWidth(133);t:SetHeight(34);t:Show();t.texture=t:CreateTexture(nil,"ARTWORK")t.texture:SetPoint("Topleft");t.texture:SetWidth(133);t.texture:SetHeight(34);t.texture:SetTexture(l.."tabs");t.texture:SetTexCoord(112/255,223/255,64/255,95/255);t.texture:Show();t.texture:SetVertexColor(.5,.5,.5);t:SetFrameLevel(n:GetFrameLevel()+24);t:EnableMouse(true);t:SetID(2);t:SetScript("OnMouseDown",s);i.tab2=t;t=CreateFrame("Frame","",i);t:SetPoint("Bottomright",i,"Topright",-2,-14);t:SetWidth(133);t:SetHeight(34);t:Show();t.texture=t:CreateTexture(nil,"ARTWORK")t.texture:SetPoint("Topleft");t.texture:SetWidth(133);t.texture:SetHeight(34);t.texture:SetTexture(l.."tabs");t.texture:SetTexCoord(0/255,111/255,96/255,127/255);t.texture:Show();t.texture:SetVertexColor(.5,.5,.5);t:SetFrameLevel(n:GetFrameLevel()+24);t:EnableMouse(true);t:SetID(3);t:SetScript("OnMouseDown",s);i.tab3=t;local a=CreateFrame("Frame","",i);a:SetPoint("Top",0,-10)a:SetWidth(S+6-24);a:SetHeight(u+6-68);i.tab1Content=a;local n=CreateFrame("Frame","",a);n:SetPoint("Topleft",5,-5)n:SetWidth(376);n:SetHeight(118);n:SetBackdrop(r);n:SetBackdropColor(.2,.2,.2,1);n:SetBackdropBorderColor(1,1,1);n:Show();local o=e.const.largeText["Tutorial_1"];t=n:CreateTexture(nil,"ARTWORK");t:SetTexture(l.."artPieces");t:SetTexCoord(o[3],o[4],o[5],o[6]);t:SetWidth(o[1]);t:SetHeight(o[2]);t:ClearAllPoints();t:SetPoint("Center",-85,0);t=e:CreateCaption(0,0,"|cFFFF9922Swap adjacent gems to make sets of 3!",n,14,1,.85,.1);t:ClearAllPoints();t:SetPoint("Center",85,0);t:SetWidth(160);t:Show();n=CreateFrame("Frame","",a);n:SetPoint("Topleft",5,-5-118)n:SetWidth(376);n:SetHeight(118);n:SetBackdrop(r);n:SetBackdropColor(.2,.2,.2,1);n:SetBackdropBorderColor(1,1,1);n:Show();o=e.const.largeText["Tutorial_2"];t=n:CreateTexture(nil,"ARTWORK");t:SetTexture(l.."artPieces");t:SetTexCoord(o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10]);t:SetWidth(o[1]);t:SetHeight(o[2]);t:ClearAllPoints();t:SetPoint("Center",-85,0);t=e:CreateCaption(0,0,"|cFFFF99224 gems will create a |cFF0070DD[Power Gem]|r!",n,14,1,.85,.1);t:ClearAllPoints();t:SetPoint("Center",85,0);t:SetWidth(140);t:Show();n=CreateFrame("Frame","",a);n:SetPoint("Topleft",5,-5-236)n:SetWidth(376);n:SetHeight(118);n:SetBackdrop(r);n:SetBackdropColor(.2,.2,.2,1);n:SetBackdropBorderColor(1,1,1);n:Show();o=e.const.largeText["Tutorial_3"];t=n:CreateTexture(nil,"ARTWORK");t:SetTexture(l.."artPieces");t:SetTexCoord(o[3],o[4],o[5],o[6]);t:SetWidth(o[1]);t:SetHeight(o[2]);t:ClearAllPoints();t:SetPoint("Center",-85,0);t=e:CreateCaption(0,0,"|cFFFF99225 gems will create a |cFFA335EE[Hyper Cube]|r!",n,14,1,.85,.1);t:ClearAllPoints();t:SetPoint("Center",85,0);t:SetWidth(140);t:Show();a=CreateFrame("Frame","",i);a:SetPoint("Top",0,-10);a:SetWidth(S+6-24);a:SetHeight(u+6-86);a:Hide();i.tab2Content=a;n=CreateFrame("Frame","",a);n:SetPoint("Topleft",10,-10)n:SetPoint("Bottomright",-10,-20);n:SetBackdrop(r);n:SetBackdropColor(.2,.2,.2,1);n:SetBackdropBorderColor(1,1,1);n:Show();o=e.const.largeText["Popcap"];t=n:CreateTexture(nil,"ARTWORK");t:SetTexture(l.."artPieces");t:SetTexCoord(o[3],o[4],o[5],o[6]);t:SetWidth(o[1]-20);t:SetHeight(o[2]-20);t:ClearAllPoints();t:SetPoint("Top",0,-10);t=e:CreateCaption(0,0,"",n,14,1,.85,.1);t:ClearAllPoints();t:SetPoint("Topleft",12,-92);t:SetWidth(336);t:Show();t:SetJustifyH("LEFT");t:SetText("Why'd we do it? Many PopCap employees are also hardcore ".."WoW players, who alt-tab during long flights or queues ".."to kill time with Bejeweled.\n\n".."So when we learned we could actually implement Bejeweled ".."through an Add-On, we were intrigued. Soon the PopCap 'guild' ".."was figuring out ways to make the mod even cooler and more ".."comprehensive. And lots of work later...\n\n".."Now, we hope other WoW players will enjoy our 'game within a ".."game.' Happy Bejeweling!");t=n:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,11,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Bottom",0,12);t:SetText("For Customer Support, email bejeweledwow@popcap.com");t:Show();t=n:CreateFontString(nil,"Overlay");t:SetFont(STANDARD_TEXT_FONT,12,"Outline");t:SetTextColor(1,1,1);t:SetPoint("Topright",-12,-12);t:SetText(e.version);t:Show();t=e:CreateCaption(0,0,"",n,16,1,.4,.8);t:SetFont(STANDARD_TEXT_FONT,16);t:SetShadowColor(0,0,0);t:SetShadowOffset(1,-1);t:ClearAllPoints();t:SetPoint("Top",n,"Bottom",0,-2);t:SetWidth(386);t:Show();t:SetJustifyH("CENTER");t:SetText("For the latest build, go to popcap.com/wow");a=CreateFrame("Frame","",i);a:SetPoint("Top",0,-10)a:SetWidth(S+6-24);a:SetHeight(u+6-68);a:Hide();i.tab3Content=a;n=CreateFrame("Frame","",a);n:SetPoint("Topleft",10,-10)n:SetPoint("Bottomright",-10,-10);n:SetBackdrop(r);n:SetBackdropColor(.2,.2,.2,1);n:SetBackdropBorderColor(1,1,1);n:Show();t=e:CreateCaption(0,0,"",n,16,1,.85,.1);t:ClearAllPoints();t:SetPoint("Topleft",12,-12);t:SetWidth(336);t:Show();t:SetText("Bejeweled Addon for WoW")t:SetJustifyH("CENTER");t=e:CreateCaption(0,0,"",n,14,1,.85,.1);t:ClearAllPoints();t:SetPoint("Topleft",12,-42);t:SetWidth(336);t:Show();t:SetText("Programmer: |cFFFFFFFFMichael Fromwiller|r\n".."Artist: |cFFFFFFFFTysen Henderson|r\n".."Producer: |cFFFFFFFFT. Carl Kwoh|r\n".."PopCap QA: |cFFFFFFFFShawn Conard, Ryan Newitt,\nJonathan Green|r\n\n".."Original Bejeweled:\n|cFFFFFFFFJason Kapalka, Brian Fiete, John Vechey|r\n\n");t:SetJustifyH("CENTER");t=e:CreateCaption(0,0,"",n,13,1,.85,.1);t:ClearAllPoints();t:SetPoint("Topleft",17,-175);t:SetWidth(326);t:Show();t:SetText("Special Thanks:\n"..'|cFFFFFFFFMorphieus "Lothaer" (Spinebreaker-A), Eleya (Eredar-A), Anthony Coleman, Ben Lyon, and Jeff Weinstein.|r\n\n'.."Beta Testers:\n".."|cFFFFFFFFNaiad (Ysera-H), Nie (Ysera-H), BraveOne (Aerie Peak-A), Brutall (Ysera-H), AvaCam (Gurubashi-H), Kepec (Kael'thas-A), Eldurin (Dalaran-A), Fnear (Cenarius-A), Jonsnow (Kael'thas EU-A), Ed|r");t:SetJustifyH("LEFT");end function e:Initialize_OptionsScreen()local i=e.window;i:SetAlpha(BejeweledProfile.settings.gameAlpha);e.const.windowFadeIn.startAlpha=BejeweledProfile.settings.mouseoffAlpha;e.const.windowFadeIn.endAlpha=BejeweledProfile.settings.gameAlpha;e.const.windowFadeOut.startAlpha=BejeweledProfile.settings.gameAlpha;e.const.windowFadeOut.endAlpha=BejeweledProfile.settings.mouseoffAlpha;local t=CreateFrame("Frame","BejeweledOptionsScreen",getglobal("BejeweledGameBoard"));t:SetPoint("Top",0,-3)t:SetWidth(S+6);t:SetHeight(u+6);t:EnableMouse(true);local a=GameTooltip:GetBackdrop();a.bgFile=l.."windowBackground";a.tileSize=128;a.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"a.edgeSize=32;t:SetBackdrop(a);t:SetBackdropColor(.7,.7,.7,1);t:SetBackdropBorderColor(1,.8,.45);t:SetFrameLevel(i:GetFrameLevel()+25);t:SetScript("OnShow",function(t)e:GamePaused(true);getglobal("BejeweledGame"):SetAlpha(0);e.summaryScreen:SetAlpha(0);e.animator.hintObj:SetAlpha(0);end);t:SetScript("OnHide",function(t)getglobal("BejeweledGame"):SetAlpha(1);e.summaryScreen:SetAlpha(1);e.animator.hintObj:SetAlpha(1);end);t:Hide();e.optionsScreen=t;local o=e:CreateCaption(0,0,"Options",t,20,1,.85,.1,true);o:ClearAllPoints();o:SetPoint("Top",0,-10);o:Show();local n=CreateFrame("Frame","",t);n:SetPoint("Top",0,-36)n:SetWidth(S+6-24);n:SetHeight(u+6-48);n:SetBackdrop(a);n:SetBackdropColor(.2,.2,.2,1);n:SetBackdropBorderColor(1,1,1);n:SetFrameLevel(i:GetFrameLevel()+26);n:Show();local a=5;o=e:CreateCaption(10,a+20,"|cFFFF9922".."Set Keybind for AddOn:",n,10,1,.85,.1,nil,true);o:ClearAllPoints()o:SetPoint("Topleft",16,-a-12);o:SetFont("Fonts\\FRIZQT__.TTF",13);o:SetShadowOffset(1,-1);local l=CreateFrame("Button","BejeweledKeybindButton",n,"OptionsButtonTemplate")l:SetPoint("Topleft",190,-a-8);l:SetText(BejeweledProfile.settings.keybinding or("None"));l:SetWidth(180);l:SetHeight(20);l:SetScript("OnClick",function(t)if(t.savedText)then e.window:EnableKeyboard(false);e.window.newKeybindButton="";e.window.keybindModifier="";t:UnlockHighlight();t:SetText(t.savedText);t.savedText=nil;else e.window:EnableKeyboard(true);e.window.newKeybindButton="";e.window.keybindModifier="";t:LockHighlight();t.savedText=t:GetText();t:SetText("Press key or ESC to clear");end end);i.keybindButton=l;if(BejeweledProfile.settings.keybinding)then SetOverrideBindingClick(i,true,BejeweledProfile.settings.keybinding,"BejeweledShowHideButton");end e:CreateSlider(50,-a-46,250,"Game Transparency","gameAlpha",n,.2,1,.005,true,function(t)e.const.windowFadeIn.endAlpha=BejeweledProfile.settings.gameAlpha;e.const.windowFadeOut.startAlpha=BejeweledProfile.settings.gameAlpha;e.window:SetAlpha(t:GetValue());end);e:CreateSlider(50,-a-78,250,"Mouse-off Transparency","mouseoffAlpha",n,0,1,.005,true,function()e.const.windowFadeIn.startAlpha=BejeweledProfile.settings.mouseoffAlpha;e.const.windowFadeOut.endAlpha=BejeweledProfile.settings.mouseoffAlpha;end);local t=104;e:CreateCaption(10,t+2,"Sounds:",n,12,1,.85,.1);local l=function(e)local t=string.match(e:GetName(),"BejeweledCheckBox(.*)");getglobal("BejeweledCheckBoxenableSounds"):SetChecked(nil);getglobal("BejeweledCheckBoxquietSounds"):SetChecked(nil);getglobal("BejeweledCheckBoxdisableSounds"):SetChecked(nil);BejeweledProfile.settings.enableSounds=nil;BejeweledProfile.settings.quietSounds=nil;BejeweledProfile.settings.disableSounds=nil;BejeweledProfile.settings[t]=1;e:SetChecked(1);end;o=e:CreateCheckbox(70,-t,"Normal","enableSounds",1,n,l,true);o:SetHitRectInsets(0,-70,0,0);o=e:CreateCheckbox(160,-t,"Quiet","quietSounds",1,n,l,true);o:SetHitRectInsets(0,-70,0,0);o=e:CreateCheckbox(250,-t,"Off","disableSounds",1,n,l,true);o:SetHitRectInsets(0,-70,0,0);t=t+20;o=e:CreateCheckbox(10,-t,"Hide Minimap Icon","hideMinimap",1,n,function(t)BejeweledProfile.settings[string.match(t:GetName(),"BejeweledCheckBox(.*)")]=t:GetChecked();if not BejeweledProfile.settings.hideMinimap then e.minimap:Show();else e.minimap:Hide();end end);o:SetHitRectInsets(0,-340,0,0);t=t+16;o=e:CreateCheckbox(10,-t,"Lock Window","lockWindow",1,n);o:SetHitRectInsets(0,-340,0,0);t=t+16;o=e:CreateCheckbox(10,-t,"Display skill gains in Chat Interface","publishSkillGains",1,n);o:SetHitRectInsets(0,-340,0,0);t=t+16;o=e:CreateCheckbox(10,-t,"Publish Bejeweling rank-ups to Guild Channel","publishRankGains",1,n);o:SetHitRectInsets(0,-340,0,0);t=t+16;o=e:CreateCheckbox(10,-t,"New Game on Flight Start","newGameFlight",1,n);o:SetHitRectInsets(0,-340,0,0);t=t+16;o=e:CreateCheckbox(10,-t,"Publish Scores","publishScores",1,n);o:SetHitRectInsets(0,-340,0,0);t=t+16;o=e:CreateCheckbox(10,-t,"One score per person on High Score lists","hideDuplicates",1,n);o:SetHitRectInsets(0,-340,0,0);t=t+16;o=e:CreateCheckbox(10,-t,"Disable Auto-Hint Arrows","disableHints",1,n,function(t)BejeweledProfile.settings[string.match(t:GetName(),"BejeweledCheckBox(.*)")]=t:GetChecked();if not BejeweledProfile.settings.disableHints then e.animator:Add(e.animator:CreateHint(e:FindMove()));else local e=e.animator.hintObj;e.fxType=d;e:SetAlpha(0);e:Hide();e.wasShown=nil;e.oldAlpha=0;end end);o:SetHitRectInsets(0,-340,0,0);t=t+16;o=e:CreateCheckbox(10,-t,"Show Flight Times on Flight Window Tooltips","showFlightTooltips",1,n);o:SetHitRectInsets(0,-340,0,0);t=t+14;e:CreateCaption(40,t+10,"Auto-Open:",n,12,1,.85,.1);e:CreateCaption(170,t+10,"Auto-Close:",n,12,1,.85,.1);t=t+28;e:CreateCheckbox(60,-t,"On Flight Start","openFlightStart",1,n);e:CreateCheckbox(190,-t,"On Flight End","closeFlightEnd",1,n);t=t+16;e:CreateCheckbox(60,-t,"On Death","openOnDeath",1,n);e:CreateCheckbox(190,-t,"On Ready Check","closeReadyCheck",1,n);t=t+16;e:CreateCheckbox(60,-t,"On Log-In","openLogin",1,n);e:CreateCheckbox(190,-t,"On Enter Combat","closeCombat",1,n);t=t+16;i:SetScript("OnKeyUp",function(e,t)if(t=="LSHIFT"or t=="RSHIFT"or t=="LCTRL"or t=="RCTRL"or t=="LALT"or t=="RALT")then local t="";e.keybindModifier="";if(IsAltKeyDown())then e.keybindModifier="ALT";t="-";end if(IsControlKeyDown())then e.keybindModifier=e.keybindModifier..t.."CTRL";t="-";end if(IsShiftKeyDown())then e.keybindModifier=e.keybindModifier..t.."SHIFT";end end end);i:SetScript("OnKeyDown",function(e,t)if(t=="ESCAPE")then e:EnableKeyboard(false);e.keybindButton:SetText("None");e.keybindButton:UnlockHighlight();e.keybindButton.savedText=nil;BejeweledProfile.settings.keybinding=nil;ClearOverrideBindings(e);else if(GetBindingFromClick(t)=="SCREENSHOT")then RunBinding("SCREENSHOT");return;end if(t=="UNKNOWN")then return;end if(t=="LSHIFT"or t=="RSHIFT"or t=="LCTRL"or t=="RCTRL"or t=="LALT"or t=="RALT")then t=string.sub(t,2)if(e.keybindModifier=="")then e.keybindModifier=t;else if not string.find(e.keybindModifier,t)then e.keybindModifier=e.keybindModifier.."-"..t;end end return;elseif(e.newKeybindButton~="")then return;end local n="";e.keybindModifier="";if(IsAltKeyDown())then e.keybindModifier="ALT";n="-";end if(IsControlKeyDown())then e.keybindModifier=e.keybindModifier..n.."CTRL";n="-";end if(IsShiftKeyDown())then e.keybindModifier=e.keybindModifier..n.."SHIFT";end if(e.keybindModifier=="")then e.newKeybindButton=t;else e.newKeybindButton=e.keybindModifier.."-"..t;end e:EnableKeyboard(false);e.keybindButton:SetText(e.newKeybindButton);e.keybindButton:UnlockHighlight();e.keybindButton.savedText=nil;SetOverrideBindingClick(e,true,e.newKeybindButton,"BejeweledShowHideButton");BejeweledProfile.settings.keybinding=e.newKeybindButton;end end);end local function k()e.skillLimit=true if(select(4,GetMapContinents()))then e.skillLimit=nil;end hooksecurefunc("TakeTaxiNode",x);hooksecurefunc("TaxiNodeOnButtonEnter",A)local x=C();local a=B();e.animator=x e.window=a;F();H();y();P();O();I();b();v();L();a:SetClampedToScreen(true);a:RegisterEvent("VARIABLES_LOADED");a:RegisterEvent("PLAYER_ENTERING_WORLD");a:RegisterEvent("PLAYER_LEAVING_WORLD");a:RegisterEvent("PLAYER_DEAD");a:RegisterEvent("READY_CHECK");a:RegisterEvent("PLAYER_REGEN_DISABLED");a:RegisterEvent("FRIENDLIST_UPDATE");a:RegisterEvent("GUILD_ROSTER_UPDATE");a:SetScript("OnEvent",E);SLASH_BEJEWELED1="/bejeweled";SLASH_BEJEWELED2="/bej";SlashCmdList["BEJEWELED"]=K;local t,h;local t=0 local t=0 local t,t local t=CreateFrame("Frame","BejeweledGameBoardAnchor",a);t:SetPoint("Topleft",20,-60);t:SetPoint("Topright",-20,-60);t:SetHeight(u+12);gameBoard=CreateFrame("Frame","BejeweledGameBoard",t);gameBoard:SetPoint("Top")gameBoard:SetWidth(S+14);gameBoard:SetHeight(u+12);local t=GameTooltip:GetBackdrop();t.edgeFile="Interface\\Glues\\Common\\TextPanel-Border"t.edgeSize=32;gameBoard:SetBackdrop(t);gameBoard:SetBackdropColor(0,0,0,0);gameBoard:SetFrameLevel(a:GetFrameLevel()+2);gameBoard:Show();e.gameBoard=gameBoard;local o=CreateFrame("Frame","",gameBoard);local r=e.const.largeText["Strip"];o:ClearAllPoints();o:SetPoint("Center")o:SetWidth(1);o:SetHeight(1);o:Hide();o.text=o:CreateTexture(nil,"OVERLAY");o.text:SetTexture(l.."artPieces");o.text:ClearAllPoints();o.text:SetWidth(1);o.text:SetHeight(1);o.text:SetPoint("Center");o.text:SetTexCoord(0,0,0,0);o.text:Show();o.background=o:CreateTexture(nil,"ARTWORK");o.background:SetPoint("Center");o.background:SetPoint("Left",gameBoard,"Left",8,0);o.background:SetPoint("Right",gameBoard,"Right",-8,0);o.background:SetHeight(84);o.background:SetTexture(l.."artPieces");o.background:SetTexCoord(r[3],r[4],r[5],r[6]);o.background:Hide();e.gameStatusText=o;e.gameStatusText.SetText=function(n,t)local t=e.const.largeText[t];if(t)then n.text:SetWidth(t[1]);n.text:SetHeight(t[2]);if(#t>9)then n.text:SetTexCoord(t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10]);n.background:SetVertexColor(t[11],t[12],t[13]);else n.text:SetTexCoord(t[3],t[4],t[5],t[6]);n.background:SetVertexColor(t[7],t[8],t[9]);end end n:SetAlpha(1);e.gameStatusText.background:SetAlpha(1);end T();g();p();local f=CreateFrame("Frame","BejeweledGame",gameBoard);f:SetWidth(S);f:SetHeight(u);f:SetPoint("Topleft",8,-4);f:EnableMouse(true);f:SetFrameLevel(a:GetFrameLevel()+1);local r,r,o;for t=0,3 do for e=0,3 do o=CreateFrame("Frame","",f);o:SetPoint("Topleft",(e*100),-(t*100));o:SetWidth(S/4);o:SetHeight(u/4);o:Show();o.texture=o:CreateTexture(nil,"BACKGROUND");o.texture:SetWidth(S/4);o.texture:SetHeight(u/4);o.texture:SetPoint("Center");o.texture:Show();o.texture:SetTexture(l.."board");o.texture:SetTexCoord(.046875,.828125,.046875,.828125);o:SetAlpha(.8);o:SetFrameLevel(f:GetFrameLevel());end end local d=CreateFrame("Frame","BejeweledStatusBar",a);d:SetPoint("Bottomleft",-10,10);d:SetPoint("Bottomright",-32,10);d:SetHeight(32);d:SetFrameLevel(a:GetFrameLevel()+2);e.statusBar=d;local r=CreateFrame("Frame","BejeweledLevelBorder",d);r:SetPoint("Bottomleft",0,0);r:SetHeight(32);r:SetWidth(122);r:SetWidth(86);t=GameTooltip:GetBackdrop();t.edgeFile=l.."levelBorder"t.edgeSize=32;t.insets.left=2;t.insets.right=2;r:SetBackdrop(t);r:SetBackdropColor(0,0,0,0);e.levelBorder=r;e.levelText=e:CreateCaption(0,0,"",r,12,1,1,1,true);e.levelText:ClearAllPoints();e.levelText:SetPoint("Topleft",16,0);e.levelText:SetPoint("Bottomright",-46,1);e.levelText:SetJustifyH("RIGHT");e.levelTextCaption=e:CreateCaption(0,0,"",r,11,1,1,1,true);e.levelTextCaption:SetWidth(1);e.levelTextCaption:ClearAllPoints();e.levelTextCaption:SetJustifyH("LEFT");e.levelTextCaption:SetPoint("Topleft",e.levelText,"Topright",-5,0);e.levelTextCaption:SetPoint("Bottomright",-16,1);local s=CreateFrame("Frame","BejeweledDataBorder",d);s:SetPoint("Bottomleft",r,"Bottomright",-40,0);s:SetHeight(32);s:SetWidth(72);s:SetWidth(128);s:SetBackdrop(t);s:SetBackdropColor(0,0,0,0);e.dataBorder=s;e.dataText=e:CreateCaption(0,0,"",s,10,1,1,1,true);e.dataText:ClearAllPoints();e.dataText:SetPoint("Center",0,1);local r=CreateFrame("Frame","BejeweledLevelBar",d);r:SetPoint("Left",s,"Right",-18,0);r:SetPoint("Bottomright",d,"Bottomright",0,0);r:SetHeight(32);t=GameTooltip:GetBackdrop();t.edgeFile="Interface\\Buttons\\UI-SliderBar-Border"t.edgeSize=8;t.bgFile=l.."windowBackground";t.tileSize=64;t.insets.left=2;t.insets.right=2;r:SetBackdrop(t);r:SetBackdropColor(.1,.1,.1,0);r:SetFrameLevel(d:GetFrameLevel()+2);e.levelBar=r;local S=CreateFrame("Frame","",d);S:SetPoint("Left",s,"Right",-18,0);S:SetPoint("Bottomright",d,"Bottomright",0,0);S:SetHeight(32);t=GameTooltip:GetBackdrop();t.edgeFile="Interface\\Buttons\\UI-SliderBar-Border"t.edgeSize=8;t.bgFile=l.."windowBackground";t.tileSize=64;t.insets.left=2;t.insets.right=2;S:SetBackdrop(t);S:SetBackdropColor(.1,.1,.1);S:SetBackdropBorderColor(0,0,0,0);S:SetFrameLevel(d:GetFrameLevel()+1);local s=S:CreateTexture(nil,"OVERLAY");s:SetTexture(l.."barArt");s:SetVertexColor(0,.2,1)s:SetPoint("Topleft",2,-5);s:SetHeight(32);s:SetWidth(.01);r.bar=s;r.text=e:CreateCaption(0,0,"",r,12,1,1,1,true);r.text:ClearAllPoints();r.text:SetPoint("Center",0,1);r.SetScore=nt;r.SetMinMaxScore=et;r.AddScore=Je;r.SetMode=_e;r.UpdateBar=tt;r.SetTimer=Ie;r.StartTimer=Ae;r.StopTimer=Oe;r.timer=CreateFrame("Frame","",a);r.timer:SetWidth(1);r.timer:SetHeight(1);r.timer:SetPoint("Top");r.timer:Hide();r.timer:SetScript("OnUpdate",ve);local r=CreateFrame("Frame","BejeweledLevelBarButton",a);r:SetPoint("Topleft",d,"Topleft",50,0);r:SetPoint("Bottomright",d,"Bottomright");r:EnableMouse(true);r:Hide();r:SetFrameLevel(a:GetFrameLevel()+2);r:SetID(2);r:SetScript("OnShow",function(t)e.statusBar:SetAlpha(0);end);r:SetScript("OnHide",function(t)e.statusBar:SetAlpha(1);end);r:SetScript("OnEnter",function(e)e.bar:SetVertexColor(1,0,0);end);r:SetScript("OnLeave",function(e)e.bar:SetVertexColor(.6,0,0);end);r:SetScript("OnMouseDown",function(t)e.menuWindow.keepScreen=nil;e.menuWindow:Show();e.menuWindow:Hide();if(t:GetID()==1)then e.featsOfSkillScreen:Hide();e.optionsScreen:Hide();e.aboutScreen:Hide();t:SetID(0);t:Hide();elseif(t:GetID()==2)then local n=n.lastGameMode;if(n==j)then e.timedWindow:Show();elseif(n==m)then e:NewGame(n,0);t:SetID(0);t:Hide();else e.gameModeWindow:Show();end end end);t=GameTooltip:GetBackdrop();t.edgeFile="Interface\\Buttons\\UI-SliderBar-Border"t.edgeSize=8;t.bgFile=l.."windowBackground";t.tileSize=64;t.insets.left=2;t.insets.right=2;r:SetBackdrop(t);r:SetBackdropColor(.1,.1,.1,0);r:SetFrameLevel(d:GetFrameLevel()+4);e.levelBarButton=r;local S=CreateFrame("Frame","",r);S:SetPoint("Topleft");S:SetPoint("Bottomright");S:SetHeight(32);t=GameTooltip:GetBackdrop();t.edgeFile="Interface\\Buttons\\UI-SliderBar-Border"t.edgeSize=8;t.bgFile=l.."windowBackground";t.tileSize=64;t.insets.left=2;t.insets.right=2;S:SetBackdrop(t);S:SetBackdropColor(.1,.1,.1);S:SetBackdropBorderColor(0,0,0,0);S:SetFrameLevel(d:GetFrameLevel()+3);s=S:CreateTexture(nil,"OVERLAY");s:SetTexture(l.."barArt");s:SetVertexColor(.6,0,0)s:SetPoint("Topleft",2,-5);s:SetPoint("Bottomright",-2,-5);s:SetHeight(32);r.bar=s;r.text=e:CreateCaption(0,0,"New Game",r,12,1,.85,0);r.text:ClearAllPoints();r.text:SetPoint("Center",0,1);local d=CreateFrame("Frame","",r);d:SetPoint("Topright",r,"Topleft",20,0);d:SetHeight(32);d:SetWidth(70);d.art=d:CreateTexture(nil,"ARTWORK");d.art:SetTexture("Interface\\CharacterFrame\\UI-StateIcon");d.art:SetPoint("Center",-1,0);d.art:SetWidth(28);d.art:SetHeight(28);d.art:SetTexCoord(0,.49,0,.49);t=GameTooltip:GetBackdrop();t.edgeFile=l.."levelBorder"t.edgeSize=32;t.insets.left=2;t.insets.right=2;d:SetBackdrop(t);d:SetBackdropColor(0,0,0,0);o=CreateFrame("Frame","",gameBoard);o:SetPoint("Center");o:SetWidth(64);o:SetHeight(64);o.text=e:CreateCaption(0,0,"Paused",o,40,1,.85,0,true);o.text:ClearAllPoints();o.text:SetPoint("Center",0,1);o:SetScale(3);o:Hide();e.pausedText=o;o=CreateFrame("Frame","BejeweledSplash",gameBoard)o:SetPoint("Topleft");o:SetPoint("Bottomright");o.art=o:CreateTexture(nil,"ARTWORK");o.art:SetPoint("Topleft",gameBoard,"Topleft",12,-7);o.art:SetPoint("Bottomright",gameBoard,"Bottomright",-7,10);o.art:SetTexture(l.."bejeweled_splash");o.text=e:CreateCaption(0,0,"(c) 2000, 2008 PopCap Games Inc. All right reserved",o,12,1,1,1);o.text:ClearAllPoints();o.text:SetPoint("Bottomleft",o,"Bottomleft",14,14);o:SetScript("OnUpdate",function(t,o)if(t.elapsed)then if(o>.1)then o=.1;end t.elapsed=t.elapsed+o;if(t.elapsed>=e.splashDisplayTime)then t.elapsed=nil;local e={mode="OUT",timeToFade=1,startAlpha=1,endAlpha=0,finishedFunc=function()e.window.splash:Hide()local o=e.paused;e.window.menuButton:Enable();if(t.firstGame)then e:NewGame(m,120);else if not n.gameMode then if(BejeweledProfile.settings.classicInProgress and BejeweledProfile.settings.savedState)then e:NewGame(m,120,true);e:GamePaused(false);if o then e:GamePaused(true);end else BejeweledProfile.settings.classicInProgress=nil;e.menuWindow:Show();end end end end,};UIFrameFade(t,e);end end end);o:SetFrameLevel(a:GetFrameLevel()+5);a.splash=o;o:Show();e.window.menuButton:Disable();pe=(a:GetFrameLevel()+2);FRAME_LEVEL_JEWEL_SWAP=(a:GetFrameLevel()+3);Ze=(a:GetFrameLevel()+4);Ye=(a:GetFrameLevel()+5);Ve=(a:GetFrameLevel()+6)for e=0,7 do for t=0,7 do h=G(t*w,e*c,f,1)h:EnableMouse(true);h:RegisterForDrag("LeftButton");h:SetScript("OnEnter",Jewel_OnEnter);h:SetScript("OnLeave",Jewel_OnLeave);h:SetScript("OnMouseDown",Jewel_OnClick);h:SetScript("OnDragStart",Jewel_OnDrag);h:SetFrameLevel(pe);i[e+1][t+1]=h;h.gridX=t+1;h.gridY=e+1;end end x:CreateHint();G=nil;C=nil;B=nil;F=nil;T=nil;g=nil;p=nil;Initialize_OptionsScreen=nil;P=nil;k=nil;end k();