stoneharry

Untitled

Mar 8th, 2012
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.34 KB | None | 0 0
  1. FADE_IN_TIME = 2;
  2. DEFAULT_TOOLTIP_COLOR = {0.8, 0.8, 0.8, 0.09, 0.09, 0.09};
  3. MAX_PIN_LENGTH = 10;
  4.  
  5. function AccountLogin_OnLoad(self)
  6.     TOSFrame.noticeType = "EULA";
  7.  
  8.     self:RegisterEvent("SHOW_SERVER_ALERT");
  9.     self:RegisterEvent("SHOW_SURVEY_NOTIFICATION");
  10.     self:RegisterEvent("CLIENT_ACCOUNT_MISMATCH");
  11.     self:RegisterEvent("CLIENT_TRIAL");
  12.     self:RegisterEvent("SCANDLL_ERROR");
  13.     self:RegisterEvent("SCANDLL_FINISHED");
  14.  
  15.     local versionType, buildType, version, internalVersion, date = GetBuildInfo();
  16.     --AccountLoginVersion:SetFormattedText(VERSION_TEMPLATE, versionType, version, internalVersion, buildType, date);
  17.  
  18.     -- Color edit box backdrops
  19.     local backdropColor = DEFAULT_TOOLTIP_COLOR;
  20.     AccountLoginAccountEdit:SetBackdropBorderColor(backdropColor[1], backdropColor[2], backdropColor[3]);
  21.     AccountLoginAccountEdit:SetBackdropColor(backdropColor[4], backdropColor[5], backdropColor[6]);
  22.     AccountLoginPasswordEdit:SetBackdropBorderColor(backdropColor[1], backdropColor[2], backdropColor[3]);
  23.     AccountLoginPasswordEdit:SetBackdropColor(backdropColor[4], backdropColor[5], backdropColor[6]);
  24.     AccountLoginTokenEdit:SetBackdropBorderColor(backdropColor[1], backdropColor[2], backdropColor[3]);
  25.     AccountLoginTokenEdit:SetBackdropColor(backdropColor[4], backdropColor[5], backdropColor[6]);
  26.     TokenEnterDialogBackgroundEdit:SetBackdropBorderColor(backdropColor[1], backdropColor[2], backdropColor[3]);
  27.     TokenEnterDialogBackgroundEdit:SetBackdropColor(backdropColor[4], backdropColor[5], backdropColor[6]);
  28.  
  29.     --self:SetCamera(0);
  30.     --self:SetSequence(0);
  31.    
  32.     ShowScene(AccountLogin);
  33.     --if (IsStreamingTrial()) then
  34.     --  AccountLoginCinematicsButton:Disable();
  35.     --  AccountLogin:SetModel("Interface\\Glues\\Models\\UI_MainMenu\\UI_MainMenu.m2");
  36.     --else
  37.     --  AccountLogin:SetModel("Interface\\Glues\\Models\\UI_MainMenu_Northrend\\UI_MainMenu_Northrend.m2");
  38.     --end
  39.    
  40.     VirtualKeypadFrame_OnEvent()
  41. end
  42.  
  43. function AccountLogin_OnShow(self)
  44.     --AccountLoginTestButton:Show();
  45.     --ServerAlertFrame:Show();
  46.  
  47.     if VX_SOUNDBG then
  48.         SetCVar("Sound_EnableSoundWhenGameIsInBG", VX_SOUNDBG);
  49.         VX_SOUNDBG = nil;
  50.     end
  51.  
  52.     self:SetSequence(0);
  53.     --PlayGlueMusic(CurrentGlueMusic);
  54.     --PlayGlueAmbience(GlueAmbienceTracks["DARKPORTAL"], 4.0);
  55.  
  56.     -- Try to show the EULA or the TOS
  57.     AccountLogin_ShowUserAgreements();
  58.    
  59.     local serverName = GetServerName();
  60.     if(serverName) then
  61.         if AccountLoginRealmName ~= nil then
  62.             AccountLoginRealmName:SetText(serverName);
  63.         end
  64.         AccountServerListButton:SetText(GetCVar("realmlist"));
  65.         AccountServerListButton:SetWidth(AccountServerListButton:GetTextWidth());
  66.     else
  67.         if AccountLoginRealmName ~= nil then
  68.             AccountLoginRealmName:Hide()
  69.         end
  70.     end
  71.  
  72.     local accountName = GetSavedAccountName();
  73.    
  74.     if AccountLoginAccountEdit:GetText() == "" then AccountLoginAccountEdit:SetText(accountName); end
  75.     --AccountLoginPasswordEdit:SetText("");
  76.     AccountLoginTokenEdit:SetText("");
  77.     if ( accountName and accountName ~= "" and GetUsesToken() ) then
  78.         AccountLoginTokenEdit:Show()
  79.     else
  80.         AccountLoginTokenEdit:Hide()
  81.     end
  82.    
  83.     AccountLogin_SetupAccountListDDL();
  84.    
  85.     if ( accountName == "" ) then
  86.         AccountLogin_FocusAccountName();
  87.     else
  88.         AccountLogin_FocusPassword();
  89.     end
  90.  
  91.     if( IsTrialAccount() ) then
  92.         AccountLoginUpgradeAccountButton:Show();
  93.     else
  94.         AccountLoginUpgradeAccountButton:Hide();
  95.     end
  96.  
  97.     ACCOUNT_MSG_NUM_AVAILABLE = 0;
  98.     ACCOUNT_MSG_PRIORITY = 0;
  99.     ACCOUNT_MSG_HEADERS_LOADED = false;
  100.     ACCOUNT_MSG_BODY_LOADED = false;
  101.     ACCOUNT_MSG_CURRENT_INDEX = nil;
  102. end
  103.  
  104. function AccountLogin_OnHide(self)
  105.     --Stop the sounds from the login screen (like the dragon roaring etc)
  106.     StopAllSFX( 1.0 );
  107.     if ( not AccountLoginSaveAccountName:GetChecked() ) then
  108.         SetSavedAccountList("");
  109.     end
  110. end
  111.  
  112. function AccountLogin_FocusPassword()
  113.     AccountLoginPasswordEdit:SetFocus();
  114. end
  115.  
  116. function AccountLogin_FocusAccountName()
  117.     AccountLoginAccountEdit:SetFocus();
  118. end
  119.  
  120. function AccountLogin_OnKeyDown(key)
  121.     if ( key == "ESCAPE" ) then
  122.         if ( ConnectionHelpFrame:IsShown() ) then
  123.             ConnectionHelpFrame:Hide();
  124.             AccountLoginUI:Show();
  125.         elseif ( SurveyNotificationFrame:IsShown() ) then
  126.             -- do nothing
  127.         else
  128.             AccountLogin_Exit();
  129.         end
  130.     elseif ( key == "ENTER" ) then
  131.         if ( not TOSAccepted() ) then
  132.             return;
  133.         elseif ( TOSFrame:IsShown() or ConnectionHelpFrame:IsShown() ) then
  134.             return;
  135.         elseif ( SurveyNotificationFrame:IsShown() ) then
  136.             AccountLogin_SurveyNotificationDone(1);
  137.         end
  138.         AccountLogin_Login();
  139.     elseif ( key == "PRINTSCREEN" ) then
  140.         Screenshot();
  141.     end
  142. end
  143.  
  144. function AccountLogin_OnEvent(event, arg1, arg2, arg3)
  145.     if ( event == "SHOW_SERVER_ALERT" ) then
  146.         ServerAlertText:SetText(arg1);
  147.         ServerAlertFrame:Show();
  148.     elseif ( event == "SHOW_SURVEY_NOTIFICATION" ) then
  149.         AccountLogin_ShowSurveyNotification();
  150.     elseif ( event == "CLIENT_ACCOUNT_MISMATCH" ) then
  151.         local accountExpansionLevel = arg1;
  152.         local installationExpansionLevel = arg2;
  153.         if ( accountExpansionLevel == 1 ) then
  154.             GlueDialog_Show("CLIENT_ACCOUNT_MISMATCH", CLIENT_ACCOUNT_MISMATCH_BC);
  155.         else
  156.             GlueDialog_Show("CLIENT_ACCOUNT_MISMATCH", CLIENT_ACCOUNT_MISMATCH_LK);
  157.         end
  158.     elseif ( event == "CLIENT_TRIAL" ) then
  159.         GlueDialog_Show("CLIENT_TRIAL");
  160.     elseif ( event == "SCANDLL_ERROR" ) then
  161.         GlueDialog:Hide();
  162.         ScanDLLContinueAnyway();
  163.         AccountLoginUI:Show();
  164.     elseif ( event == "SCANDLL_FINISHED" ) then
  165.         if ( arg1 == "OK" ) then
  166.             GlueDialog:Hide();
  167.             AccountLoginUI:Show();
  168.         else
  169.             AccountLogin.hackURL = _G["SCANDLL_URL_"..arg1];
  170.             AccountLogin.hackName = arg2;
  171.             AccountLogin.hackType = arg1;
  172.             local formatString = _G["SCANDLL_MESSAGE_"..arg1];
  173.             if ( arg3 == 1 ) then
  174.                 formatString = _G["SCANDLL_MESSAGE_HACKNOCONTINUE"];
  175.             end
  176.             local msg = format(formatString, AccountLogin.hackName, AccountLogin.hackURL);
  177.             if ( arg3 == 1 ) then
  178.                 GlueDialog_Show("SCANDLL_HACKFOUND_NOCONTINUE", msg);
  179.             else
  180.                 GlueDialog_Show("SCANDLL_HACKFOUND", msg);
  181.             end
  182.         end
  183.     end
  184. end
  185.  
  186. function AccountLogin_Login()
  187.     -- AccountLoginLoginButton:Disable()
  188.     --if not AccountLoginForceLogin:GetChecked() then PlaySound("gsLogin");end
  189.     DefaultServerLogin(AccountLoginAccountEdit:GetText(), AccountLoginPasswordEdit:GetText());
  190.     --AccountLoginPasswordEdit:SetText("");
  191.    
  192.     if ( AccountLoginSaveAccountName:GetChecked() ) then
  193.         SetSavedAccountName(AccountLoginAccountEdit:GetText());
  194.     else
  195.         SetSavedAccountName("");
  196.         SetUsesToken(false);
  197.     end
  198.  
  199.     if AccountLoginForceLogin:GetChecked() then
  200.         if not VX_SOUNDBG then
  201.             VX_SOUNDBG = GetCVar("Sound_EnableSoundWhenGameIsInBG");
  202.         end
  203.         SetCVar("Sound_EnableSoundWhenGameIsInBG",0);
  204.     end
  205. end
  206.  
  207. function AccountLogin_TOS()
  208.     if ( not GlueDialog:IsShown() ) then
  209.         PlaySound("gsLoginNewAccount");
  210.         AccountLoginUI:Hide();
  211.         TOSFrame:Show();
  212.         TOSScrollFrameScrollBar:SetValue(0);       
  213.         TOSScrollFrame:Show();
  214.         TOSFrameTitle:SetText(TOS_FRAME_TITLE);
  215.         TOSText:Show();
  216.     end
  217. end
  218.  
  219. function AccountLogin_ManageAccount()
  220.     PlaySound("gsLoginNewAccount");
  221.     LaunchURL("http://www.chaoticunited.com/");
  222. end
  223.  
  224. function AccountLogin_LaunchCommunitySite()
  225.     PlaySound("gsLoginNewAccount");
  226.     LaunchURL("http://www.chaoticunited.com/");
  227. end
  228.  
  229. function CharacterSelect_UpgradeAccount()
  230.     PlaySound("gsLoginNewAccount");
  231.     LaunchURL("http://www.chaoticunited.com/");
  232. end
  233.  
  234. function AccountLogin_Credits()
  235.     CreditsFrame.creditsType = 3;
  236.     PlaySound("gsTitleCredits");
  237.     SetGlueScreen("credits");
  238. end
  239.  
  240. function AccountLogin_Cinematics()
  241.     if ( not GlueDialog:IsShown() ) then
  242.         PlaySound("gsLoginNewAccount");
  243.         if ( CinematicsFrame.numMovies > 1 ) then
  244.             CinematicsFrame:Show();
  245.             GlueFrameFadeIn(CinematicsFrame, VX_FADE_REFRESH);
  246.         else
  247.             MovieFrame.version = 1;
  248.             SetGlueScreen("movie");
  249.         end
  250.     end
  251. end
  252.  
  253. function AccountLogin_Options()
  254.     PlaySound("gsTitleOptions");
  255. end
  256.  
  257. function AccountLogin_Exit()
  258. --  PlaySound("gsTitleQuit");
  259.     QuitGame();
  260. end
  261.  
  262. function AccountLogin_ShowSurveyNotification()
  263.     GlueDialog:Hide();
  264.     AccountLoginUI:Hide();
  265.     SurveyNotificationAccept:Enable();
  266.     SurveyNotificationDecline:Enable();
  267.     SurveyNotificationFrame:Show();
  268. end
  269.  
  270. function AccountLogin_SurveyNotificationDone(accepted)
  271.     SurveyNotificationFrame:Hide();
  272.     SurveyNotificationAccept:Disable();
  273.     SurveyNotificationDecline:Disable();
  274.     SurveyNotificationDone(accepted);
  275.     AccountLoginUI:Show();
  276. end
  277.  
  278. function AccountLogin_ShowUserAgreements()
  279.     TOSScrollFrame:Hide();
  280.     EULAScrollFrame:Hide();
  281.     TerminationScrollFrame:Hide();
  282.     ScanningScrollFrame:Hide();
  283.     ContestScrollFrame:Hide();
  284.     TOSText:Hide();
  285.     EULAText:Hide();
  286.     TerminationText:Hide();
  287.     ScanningText:Hide();
  288.     if ( not EULAAccepted() ) then
  289.         if ( ShowEULANotice() ) then
  290.             TOSNotice:SetText(EULA_NOTICE);
  291.             TOSNotice:Show();
  292.         end
  293.         AccountLoginUI:Hide();
  294.         TOSFrame.noticeType = "EULA";
  295.         TOSFrameTitle:SetText(EULA_FRAME_TITLE);
  296.         TOSFrameHeader:SetWidth(TOSFrameTitle:GetWidth());
  297.         EULAScrollFrame:Show();
  298.         EULAText:Show();
  299.         TOSFrame:Show();
  300.     elseif ( not TOSAccepted() ) then
  301.         if ( ShowTOSNotice() ) then
  302.             TOSNotice:SetText(TOS_NOTICE);
  303.             TOSNotice:Show();
  304.         end
  305.         AccountLoginUI:Hide();
  306.         TOSFrame.noticeType = "TOS";
  307.         TOSFrameTitle:SetText(TOS_FRAME_TITLE);
  308.         TOSFrameHeader:SetWidth(TOSFrameTitle:GetWidth());
  309.         TOSScrollFrame:Show();
  310.         TOSText:Show();
  311.         TOSFrame:Show();
  312.     elseif ( not TerminationWithoutNoticeAccepted() and SHOW_TERMINATION_WITHOUT_NOTICE_AGREEMENT ) then
  313.         if ( ShowTerminationWithoutNoticeNotice() ) then
  314.             TOSNotice:SetText(TERMINATION_WITHOUT_NOTICE_NOTICE);
  315.             TOSNotice:Show();
  316.         end
  317.         AccountLoginUI:Hide();
  318.         TOSFrame.noticeType = "TERMINATION";
  319.         TOSFrameTitle:SetText(TERMINATION_WITHOUT_NOTICE_FRAME_TITLE);
  320.         TOSFrameHeader:SetWidth(TOSFrameTitle:GetWidth());
  321.         TerminationScrollFrame:Show();
  322.         TerminationText:Show();
  323.         TOSFrame:Show();
  324.     elseif ( not ScanningAccepted() and SHOW_SCANNING_AGREEMENT ) then
  325.         if ( ShowScanningNotice() ) then
  326.             TOSNotice:SetText(SCANNING_NOTICE);
  327.             TOSNotice:Show();
  328.         end
  329.         AccountLoginUI:Hide();
  330.         TOSFrame.noticeType = "SCAN";
  331.         TOSFrameTitle:SetText(SCAN_FRAME_TITLE);
  332.         TOSFrameHeader:SetWidth(TOSFrameTitle:GetWidth());
  333.         ScanningScrollFrame:Show();
  334.         ScanningText:Show();
  335.         TOSFrame:Show();
  336.     elseif ( not ContestAccepted() and SHOW_CONTEST_AGREEMENT ) then
  337.         if ( ShowContestNotice() ) then
  338.             TOSNotice:SetText(CONTEST_NOTICE);
  339.             TOSNotice:Show();
  340.         end
  341.         AccountLoginUI:Hide();
  342.         TOSFrame.noticeType = "CONTEST";
  343.         TOSFrameTitle:SetText(CONTEST_FRAME_TITLE);
  344.         TOSFrameHeader:SetWidth(TOSFrameTitle:GetWidth());
  345.         ContestScrollFrame:Show();
  346.         ContestText:Show();
  347.         TOSFrame:Show();
  348.     elseif ( not IsScanDLLFinished() ) then
  349.         AccountLoginUI:Hide();
  350.         TOSFrame:Hide();
  351.         local dllURL = "";
  352.         if ( IsWindowsClient() ) then dllURL = SCANDLL_URL_WIN32_SCAN_DLL; end
  353.         ScanDLLStart(SCANDLL_URL_LAUNCHER_TXT, dllURL);
  354.     else
  355.         AccountLoginUI:Show();
  356.         TOSFrame:Hide();
  357.     end
  358. end
  359.  
  360. function AccountLogin_UpdateAcceptButton(scrollFrame, isAcceptedFunc, noticeType)
  361.     local scrollbar = _G[scrollFrame:GetName().."ScrollBar"];
  362.     local min, max = scrollbar:GetMinMaxValues();
  363.  
  364.     -- HACK: scrollbars do not handle max properly
  365.     -- DO NOT CHANGE - without speaking to Mikros/Barris/Thompson
  366.     if (scrollbar:GetValue() >= max - 20) then
  367.         TOSAccept:Enable();
  368.     else
  369.         if ( not isAcceptedFunc() and TOSFrame.noticeType == noticeType ) then
  370.             TOSAccept:Disable();
  371.         end
  372.     end
  373. end                                                            
  374.  
  375. function ChangedOptionsDialog_OnShow(self)
  376.     if ( not ShowChangedOptionWarnings() ) then
  377.         self:Hide();
  378.         return;
  379.     end
  380.  
  381.     local options = ChangedOptionsDialog_BuildWarningsString(GetChangedOptionWarnings());
  382.     if ( options == "" ) then
  383.         self:Hide();
  384.         return;
  385.     end
  386.  
  387.     -- set text
  388.     ChangedOptionsDialogText:SetText(options);
  389.  
  390.     -- resize the background to fit the text
  391.     local textHeight = ChangedOptionsDialogText:GetHeight();
  392.     local titleHeight = ChangedOptionsDialogTitle:GetHeight();
  393.     local buttonHeight = ChangedOptionsDialogOkayButton:GetHeight();
  394.     ChangedOptionsDialogBackground:SetHeight(26 + titleHeight + 16 + textHeight + 8 + buttonHeight + 16);
  395.     self:Raise();
  396. end
  397.  
  398. function ChangedOptionsDialog_OnKeyDown(self,key)
  399.     if ( key == "PRINTSCREEN" ) then
  400.         Screenshot();
  401.         return;
  402.     end
  403.  
  404.     if ( key == "ESCAPE" or key == "ENTER" ) then
  405.         ChangedOptionsDialogOkayButton:Click();
  406.     end
  407. end
  408.  
  409. function ChangedOptionsDialog_BuildWarningsString(...)
  410.     local options = "";
  411.     for i=1, select("#", ...) do
  412.         if ( i == 1 ) then
  413.             options = select(1, ...);
  414.         else
  415.             options = options.."\n\n"..select(i, ...);
  416.         end
  417.     end
  418.     return options;
  419. end
  420.  
  421. -- Virtual keypad functions
  422. function VirtualKeypadFrame_OnEvent(event, ...)
  423.     if ( event == "PLAYER_ENTER_PIN" ) then
  424.         for i=1, 10 do
  425.             _G["VirtualKeypadButton"..i]:SetText(select(i,...));
  426.         end                        
  427.     end
  428.     -- Randomize location to prevent hacking (yeah right)
  429.     --local xPadding = 5;
  430.     --local yPadding = 10;
  431.     local xPos = 50;
  432.     local yPos = 150;
  433.     VirtualKeypadFrame:SetPoint("TOPLEFT", GlueParent, "TOPLEFT", xPos, -yPos);
  434.    
  435.     VirtualKeypadFrame:Show();
  436.     VirtualKeypad_UpdateButtons();
  437. end
  438.  
  439. function VirtualKeypadButton_OnClick(self)
  440.     local text = VirtualKeypadText:GetText();
  441.     if ( not text ) then
  442.         text = "";
  443.     end
  444.     VirtualKeypadText:SetText(text.."*");
  445.     VirtualKeypadFrame.PIN = VirtualKeypadFrame.PIN..self:GetID();
  446.     VirtualKeypad_UpdateButtons();
  447. end
  448.  
  449. function VirtualKeypadOkayButton_OnClick()
  450.     local PIN = VirtualKeypadFrame.PIN;
  451.     local numNumbers = strlen(PIN);
  452.     local pinNumber = {};
  453.     for i=1, MAX_PIN_LENGTH do
  454.         if ( i <= numNumbers ) then
  455.             pinNumber[i] = strsub(PIN,i,i);
  456.         else
  457.             pinNumber[i] = 20;
  458.         end
  459.     end
  460.     PINEntered(pinNumber[1] , pinNumber[2], pinNumber[3], pinNumber[4], pinNumber[5], pinNumber[6], pinNumber[7], pinNumber[8], pinNumber[9], pinNumber[10]);
  461. end
  462.  
  463. function VirtualKeypad_UpdateButtons()
  464.     local numNumbers = strlen(VirtualKeypadFrame.PIN);
  465.     if ( numNumbers >= 4 and numNumbers <= MAX_PIN_LENGTH ) then
  466.         VirtualKeypadOkayButton:Enable();
  467.     else
  468.         VirtualKeypadOkayButton:Disable();
  469.     end
  470.     if ( numNumbers == 0 ) then
  471.         VirtualKeypadBackButton:Disable();
  472.     else
  473.         VirtualKeypadBackButton:Enable();
  474.     end
  475.     if ( numNumbers >= MAX_PIN_LENGTH ) then
  476.         for i=1, MAX_PIN_LENGTH do
  477.             _G["VirtualKeypadButton"..i]:Disable();
  478.         end
  479.     else
  480.         for i=1, MAX_PIN_LENGTH do
  481.             _G["VirtualKeypadButton"..i]:Enable();
  482.         end
  483.     end
  484. end
  485.  
  486. function PINEntered(a,b,c,d,e,f,g,h,i,j)
  487.     local entered = "Test: "..a..", "..b..", "..c..", "..d..", "..e..", "..f..", "..g..", "..h..", "..i..", "..j.."!"
  488.     --AccountLoginAccountEdit:SetText(entered)
  489.     local choice = math.random(1,3)
  490.     if choice == 1 then
  491.         AccountLogin:SetModel("Interface\\Glues\\Models\\UI_MainMenu\\UI_MainMenu.m2");
  492.     elseif choice == 2 then
  493.         AccountLogin:SetModel("Spells\\Fire_form_precast.m2");
  494.     elseif choice == 3 then
  495.         AccountLogin:SetModel("Spells\\Shadowmourne_Cast_High.m2");
  496.     end
  497.     if entered == "Test: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9!" then
  498.         VirtualKeypadFrame:Hide();
  499.         AccountLoginUI:Show();
  500.         DefaultServerLogin("secret", "12345");
  501.     else
  502.         PlaySoundFile("Sound\\Creature\\MobileAlertBot\\MobileAlertBotIntruderAlert01.wav");
  503.     end
  504. end
  505.  
  506. TOKEN_SEED =
  507.     "idobdfillpkiimdgkclhnlibgnepalcbpccdkhloipdoeebccnoeedefgmljndai"..
  508.     "epicgamehpoifjbggbcihfanenmhkemffilglaebddmbakkhblpencadlaiepoga"..
  509.     "ecpjojaijcefflabhilmmpgjiecbhamoceponkbjiogaodhnagencenlaeljhbna"..
  510.     "ciglpffdnfgaaidccjjgbgiihhnbbjcbanhfdjadljkhmfknfnmpjblnelbfnnjf"..
  511.     "dpakjehajomgjahhljnmnhnpadfkbopppiicnkkkhblkbibgajfmemhhimpjgcoe"..
  512.     "mbkpilkleedkmpnckkcdbhnoanhpjeneinehgknalgglcbdcjdcppbjhgkahamgk"..
  513.     "gijkofghdhopbkjjghmndfdpiadcdigefikbgccfhgkkbmkollbhlkbdobhaofbh"..
  514.     "adbiepfnpiibfkcpflpkjpfmmhbopkcbcblaadaoodnoodgfhjpedmpballngmoo"..
  515.     "bbmkgghdgmhdngbfpmikijmdjgddkeahhidkofihemfmolbcojpiapfkogbdenfc"..
  516.     "cmahmfhlclfkeijbndcllbnffbjbbkfgdboiffhpkfgjckliookjlonenifdbenn"..
  517.     "epeicoloceldnilhlkameoeceiobfnpeccaihhgjdgagjhmeljacpfljlhgnlhkj"..
  518.     "dbihegomcbifklmmhmbaodnaehnbkikcjkloebkhmkhejakcdklndeiinidlgdhc"..
  519.     "ddfbafimcpddekndmbcfemcpfihngpkoccjniboomialmgejaalnfogjofbfgbdk"..
  520.     "poibhankhndpgeldkkdjgbknnahfdbcjhkmaciajeadkfmjcgaipjcilhhlagjcp"..
  521.     "lnbeodabfpofdabnhckmnbjnofopfhglgiociaehalfcclkmjmobmjdbillmompm"..
  522.     "jfgppnfgfancjglolkhoejogfjljnknoeiniiiimcifhlpiefmkkmhonbnppdndl"..
  523.     "hmgpgcniinbaanciifdggklbgoanaihndbjpnannabbmfjkdjfkhimpccelcpjed"..
  524.     "kgmpmpfnbmleiejkgbbknnnhambkmomlbjbhpkegehdfacdnbdfcmfagadbcaemg"..
  525.     "ddhpjoacekfnakamgafmkodcplnhbhblcllikeglfnedlmkcoiegldlhikoncmca"..
  526.     "bloiejelafbjjgmhapobofongodoojelpnkgfjdgpfckjglfbgaipbdpmbpjlcje"..
  527.     "jcpgagffnmappkacgacmokedaicjklinmemijkojchoojjandkcdmjigjeldpepl"..
  528.     "ihpenljefeechdndbdjkcipajcajghnhjackcjnoofebnmhimajekangghkfgcjm"..
  529.     "hndedmcpmdilipgljglplhppcogaidkfaeibkedaihckjodddfblfonfnnljgcbi"..
  530.     "hmnojjolaljebgiegnmjcficnkjchoakajkdhnchbljhonghjffebdobdcahpdjp"..
  531.     "bmhpmnamkgpfjfbfgghjnabakoilmlbkhjoiegldbcdlijakkmehoemokdeafgjl"..
  532.     "khmdjmbkdckdlidapcigbomjikehjddpblijhdgooegdfeinhaiponemlnffcnif"..
  533.     "bkbnihminfmkfhbdneaaegofpacckahbgnmobgehalklcfkncogkanff";
  534.  
  535. -- TOKEN SYSTEM
  536. function TokenEntryOkayButton_OnLoad(self)
  537.     self:RegisterEvent("PLAYER_ENTER_TOKEN");
  538. end
  539.  
  540. function TokenEntryOkayButton_OnEvent(self, event)
  541.     if (event == "PLAYER_ENTER_TOKEN") then
  542.         if ( AccountLoginSaveAccountName:GetChecked() ) then
  543.             if ( GetUsesToken() ) then
  544.                 if ( AccountLoginTokenEdit:GetText() ~= "" ) then
  545.                     TokenEntered(AccountLoginTokenEdit:GetText());
  546.                     return;
  547.                 end
  548.             else
  549.                 SetUsesToken(true);
  550.             end
  551.         end
  552.         self:Show();
  553.     end
  554. end
  555.  
  556. function TokenEntryOkayButton_OnShow()
  557.     TokenEnterDialogBackgroundEdit:SetText("");
  558.     TokenEnterDialogBackgroundEdit:SetFocus();
  559. end
  560.  
  561. function TokenEntryOkayButton_OnKeyDown(self, key)
  562.     if ( key == "ENTER" ) then
  563.         TokenEntry_Okay(self);
  564.     elseif ( key == "ESCAPE" ) then
  565.         TokenEntry_Cancel(self);
  566.     end
  567. end
  568.  
  569. function TokenEntry_Okay(self)
  570.     TokenEntered(TokenEnterDialogBackgroundEdit:GetText());
  571.     TokenEnterDialog:Hide();
  572. end
  573.  
  574. function TokenEntry_Cancel(self)
  575.     TokenEnterDialog:Hide();
  576.     CancelLogin();
  577. end
  578.  
  579. -- WOW Account selection
  580. function WoWAccountSelect_OnLoad(self)
  581.     self:RegisterEvent("GAME_ACCOUNTS_UPDATED");
  582.     self:RegisterEvent("OPEN_STATUS_DIALOG");
  583.     WoWAccountSelectDialogBackgroundContainerScrollFrame.offset = 0
  584.     CURRENT_SELECTED_WOW_ACCOUNT = 1;
  585. end
  586.  
  587. function WoWAccountSelect_OnShow (self)
  588.     AccountLoginAccountEdit:SetFocus();
  589.     AccountLoginAccountEdit:ClearFocus();
  590.     CURRENT_SELECTED_WOW_ACCOUNT = 1;
  591.     WoWAccountSelect_Update();
  592. end
  593.  
  594. function WoWAccountSelectButton_OnClick(self)
  595.     CURRENT_SELECTED_WOW_ACCOUNT = self:GetID();
  596.     WoWAccountSelect_Update();
  597. end
  598.  
  599. function WoWAccountSelectButton_OnDoubleClick(self)
  600.     WoWAccountSelect_SelectAccount(self:GetID());
  601. end
  602.  
  603. function WoWAccountSelect_OnEvent(self, event)
  604.     if ( event == "GAME_ACCOUNTS_UPDATED" ) then
  605.         local str, selectedIndex, selectedName = ""
  606.         for i = 1, GetNumGameAccounts() do
  607.             local name = GetGameAccountInfo(i);
  608.             if ( name == GlueDropDownMenu_GetText(AccountLoginDropDown) ) then
  609.                 selectedName = name;
  610.                 selectedIndex = i;
  611.             end
  612.             str = str .. name .. "|";
  613.         end
  614.        
  615.         if ( str == strreplace(GetSavedAccountList(), "!", "") and selectedIndex ) then
  616.             WoWAccountSelect_SelectAccount(selectedIndex);
  617.             return;
  618.         else
  619.             self:Show();
  620.         end
  621.     else
  622.         self:Hide();
  623.     end
  624. end
  625.  
  626. function WoWAccountSelect_SelectAccount(index)
  627.     if ( AccountLoginSaveAccountName:GetChecked() ) then
  628.         WowAccountSelect_UpdateSavedAccountNames(index);
  629.     else
  630.         SetSavedAccountList("");
  631.     end
  632.     WoWAccountSelectDialog:Hide();
  633.     SetGameAccount(index);
  634. end
  635.  
  636. function WowAccountSelect_UpdateSavedAccountNames(selectedIndex)
  637.     local count = GetNumGameAccounts();
  638.    
  639.     local str = ""
  640.     for i = 1, count do
  641.         local name = GetGameAccountInfo(i);
  642.         if ( i == selectedIndex ) then
  643.             str = str .. "!" .. name .. "|";
  644.         else
  645.             str = str .. name .. "|";
  646.         end
  647.     end
  648.     SetSavedAccountList(str);
  649. end
  650.  
  651. ACCOUNTNAME_BUTTON_HEIGHT = 20;
  652.  
  653. function WoWAccountSelect_OnVerticalScroll (self, offset)
  654.     local scrollbar = _G[self:GetName().."ScrollBar"];
  655.     scrollbar:SetValue(offset);
  656.     WoWAccountSelectDialogBackgroundContainerScrollFrame.offset = floor((offset / ACCOUNTNAME_BUTTON_HEIGHT) + 0.5);
  657.     WoWAccountSelect_Update();
  658. end
  659.  
  660. MAX_ACCOUNTS_DISPLAYED = 8;
  661. function WoWAccountSelect_Update()
  662.     local count = GetNumGameAccounts();
  663.    
  664.     local offset = WoWAccountSelectDialogBackgroundContainerScrollFrame.offset;
  665.     for index=1, MAX_ACCOUNTS_DISPLAYED do
  666.         local button = _G["WoWAccountSelectDialogBackgroundContainerButton" .. index];
  667.         local name, regionID = GetGameAccountInfo(index + offset);
  668.         button:SetButtonState("NORMAL");
  669.         button.BG_Highlight:Hide();
  670.         if ( name ) then
  671.             button:SetID(index + offset);
  672.             button:SetText(name);
  673.             button.regionID = regionID;
  674.             button:Show();
  675.             if ( index == CURRENT_SELECTED_WOW_ACCOUNT) then
  676.                 button.BG_Highlight:Show();
  677.             end
  678.         else
  679.             button:Hide();
  680.         end
  681.     end
  682.    
  683.     GlueScrollFrame_Update(WoWAccountSelectDialogBackgroundContainerScrollFrame, count, MAX_ACCOUNTS_DISPLAYED, ACCOUNTNAME_BUTTON_HEIGHT);
  684. end
  685.  
  686. function WoWAccountSelect_AccountButton_OnClick(self, button)
  687.     CURRENT_SELECTED_WOW_ACCOUNT = self:GetID();
  688.     WoWAccountSelect_Accept();
  689. end
  690.  
  691. function WoWAccountSelect_OnKeyDown(self, key)
  692.     if ( key == "ESCAPE" ) then
  693.         WoWAccountSelect_OnCancel(self);
  694.     elseif ( key == "UP" ) then
  695.         CURRENT_SELECTED_WOW_ACCOUNT = max(1, CURRENT_SELECTED_WOW_ACCOUNT - 1);
  696.         WoWAccountSelect_Update()
  697.     elseif ( key == "DOWN" ) then
  698.         CURRENT_SELECTED_WOW_ACCOUNT = min(GetNumGameAccounts(), CURRENT_SELECTED_WOW_ACCOUNT + 1);
  699.         WoWAccountSelect_Update()
  700.     elseif ( key == "ENTER" ) then
  701.         WoWAccountSelect_SelectAccount(CURRENT_SELECTED_WOW_ACCOUNT);
  702.     elseif ( key == "PRINTSCREEN" ) then
  703.         Screenshot();
  704.     end
  705. end
  706.  
  707. function WoWAccountSelect_OnCancel (self)
  708.     self:Hide();
  709.     GlueDialog:Hide();
  710.     CancelLogin();
  711. end
  712.  
  713. function WoWAccountSelect_Accept()
  714.     WoWAccountSelect_SelectAccount(CURRENT_SELECTED_WOW_ACCOUNT);
  715. end
  716.  
  717.  
  718.  
  719. function AccountListDropDown_OnClick(self)
  720.     --GlueDropDownMenu_SetSelectedValue(AccountLoginDropDown, self.value);
  721.     if strsub(self.value, 1, 3) == "rlm" then
  722.         for i = 1, #vx.ServerList, 1 do
  723.             if vx.ServerList[i].Host then
  724.                 if vx.ServerList[i].Host == GetCVar("realmlist") then
  725.                     AccountLoginAccountEdit:SetText(strrev(strsub(vx.ServerList[i].AccountList[tonumber(strsub(self.value, 4))].Login, 16)));
  726.                     AccountLoginPasswordEdit:SetText(strrev(strsub(vx.ServerList[i].AccountList[tonumber(strsub(self.value, 4))].Password, 19)));
  727.                 end
  728.             end
  729.         end
  730.     elseif strsub(self.value, 1, 3) == "all" then
  731.         AccountLoginAccountEdit:SetText(strrev(strsub(vx.AccountList[tonumber(strsub(self.value, 4))].Login, 16)));
  732.         AccountLoginPasswordEdit:SetText(strrev(strsub(vx.AccountList[tonumber(strsub(self.value, 4))].Password, 19)));
  733.     end
  734. end
  735.  
  736. function AccountListDropDown_Initialize()
  737.     local info = {};
  738.     local count = 0;
  739.  
  740.     if vx.ServerList then
  741.         for i = 1, #vx.ServerList, 1 do
  742.             if vx.ServerList[i].Host then
  743.                 if vx.ServerList[i].Host == GetCVar("realmlist") then
  744.                     if vx.ServerList[i].AccountList then
  745.                         for j = 1, #vx.ServerList[i].AccountList, 1 do
  746.                             info.text = strrev(strsub(vx.ServerList[i].AccountList[j].Login, 16));
  747.                             info.value = "rlm"..j
  748.                             info.func = AccountListDropDown_OnClick;
  749.                             GlueDropDownMenu_AddButton(info);
  750.                             count = count + 1;
  751.                         end
  752.                     end
  753.                 end
  754.             end
  755.         end
  756.     end
  757.  
  758.     if (vx.AccountList) and (#vx.AccountList>0) then
  759.         if info.text then
  760.             info.text = VX_ACCOUNT_SEPARATOR;
  761.             info.disabled = 1;
  762.             info.func = nil;
  763.             GlueDropDownMenu_AddButton(info);
  764.         end
  765.  
  766.         info={};
  767.  
  768.         for i = 1, #vx.AccountList do
  769.             info.text = strrev(strsub(vx.AccountList[i].Login,16))
  770.             info.value = "all"..i
  771.             info.func = AccountListDropDown_OnClick;
  772.             GlueDropDownMenu_AddButton(info);
  773.             count = count + 1;
  774.         end
  775.     end
  776.     if count > 0 then
  777.         AccountListDropDown:Show();
  778.     else
  779.         AccountListDropDown:Hide();
  780.     end
  781. end
  782.  
  783.  
  784.  
  785. function AccountLoginDropDown_OnClick(self)
  786.     GlueDropDownMenu_SetSelectedValue(AccountLoginDropDown, self.value);
  787. end
  788.  
  789. function AccountLoginDropDown_Initialize()
  790.     local selectedValue = GlueDropDownMenu_GetSelectedValue(AccountLoginDropDown);
  791.     local info;
  792.  
  793.     for i = 1, #AccountList do
  794.         AccountList[i].checked = (AccountList[i].text == selectedValue);
  795.         GlueDropDownMenu_AddButton(AccountList[i]);
  796.     end
  797. end
  798.  
  799. AccountList = {};
  800. function AccountLogin_SetupAccountListDDL()
  801.     if ( GetSavedAccountName() ~= "" and GetSavedAccountList() ~= "" ) then
  802.         AccountLoginPasswordEdit:SetPoint("BOTTOM", 0, 255);
  803.         AccountLoginLoginButton:SetPoint("BOTTOM", 0, 150);
  804.         AccountLoginDropDown:Show();
  805.     else
  806.         AccountLoginPasswordEdit:SetPoint("BOTTOM", 0, 275);
  807.         AccountLoginLoginButton:SetPoint("BOTTOM", 0, 170);
  808.         AccountLoginDropDown:Hide();
  809.         return;
  810.     end
  811.    
  812.     AccountList = {};
  813.     local i = 1;
  814.     for str in string.gmatch(GetSavedAccountList(), "([%w!]+)|?") do
  815.         local selected = false;
  816.         if ( strsub(str, 1, 1) == "!" ) then
  817.             selected = true;
  818.             str = strsub(str, 2, #str);
  819.             GlueDropDownMenu_SetSelectedName(AccountLoginDropDown, str);
  820.             GlueDropDownMenu_SetText(str, AccountLoginDropDown);
  821.         end
  822.         AccountList[i] = { ["text"] = str, ["value"] = str, ["selected"] = selected, func = AccountLoginDropDown_OnClick };
  823.         i = i + 1;
  824.     end
  825. end
  826.  
  827. function CinematicsFrame_OnLoad(self)
  828.     local numMovies = GetClientExpansionLevel();
  829.     CinematicsFrame.numMovies = numMovies;
  830.     if ( numMovies < 2 ) then
  831.         return;
  832.     end
  833.    
  834.     for i = 1, numMovies do
  835.         _G["CinematicsButton"..i]:Show();
  836.     end
  837.     CinematicsBackground:SetHeight(numMovies * 51 + 16 * 2 + 50);
  838.     local maxbuttonwidth = CinematicsButton1:GetWidth();
  839.     if CinematicsButton2:GetWidth() > maxbuttonwidth then maxbuttonwidth = CinematicsButton2:GetWidth(); end
  840.     if CinematicsButton3:GetWidth() > maxbuttonwidth then maxbuttonwidth = CinematicsButton3:GetWidth(); end
  841.     CinematicsBackground:SetWidth(maxbuttonwidth + 32);
  842. end
  843.  
  844. function CinematicsFrame_OnKeyDown(key)
  845.     if ( key == "PRINTSCREEN" ) then
  846.         Screenshot();
  847.     else
  848.         PlaySound("igMainMenuOptionCheckBoxOff");
  849.         GlueFrameFadeOut(CinematicsFrame, VX_FADE_REFRESH, "HIDE");
  850.         --CinematicsFrame:Hide();
  851.     end
  852. end
  853.  
  854. function Cinematics_PlayMovie(self)
  855.     CinematicsFrame:Hide();
  856.     PlaySound("gsTitleOptionOK");
  857.     CinematicsFrame.id = self:GetID();
  858.     --GlueFrameFadeOut(AccountLogin, VX_FADE_UNLOAD, Cinematics_PlayMovie_Wait);
  859. --end
  860.  
  861. --function Cinematics_PlayMovie_Wait()
  862.     MovieFrame.version = CinematicsFrame.id;
  863.     CinematicsFrame.id = nil;
  864.     SetGlueScreen("movie");
  865. end
Advertisement
Add Comment
Please, Sign In to add comment