--=============================================================================== --======= character secondary passes use same id as in accountlogin.lua ======== --=============================================================================== local CustomSecondaryPass = { Account1 = { ID = 1, SecondaryPassword = "secondarypass", }, Account2 = { ID = 2, SecondaryPassword = "secondarypass", }, Account3 = { ID = 3, SecondaryPassword = "secondarypass", }, Account4 = { ID = 4, SecondaryPassword = "secondarypass", }, Account5 = { ID = 5, SecondaryPassword = "secondarypass", }, Account6 = { ID = 6, SecondaryPassword = "secondarypass", }, Account7 = { ID = 7, SecondaryPassword = "secondarypass", }, Account8 = { ID = 8, SecondaryPassword = "secondarypass", }, Account9 = { ID = 9, SecondaryPassword = "secondarypass", }, Account10 = { ID = 10, SecondaryPassword = "secondarypass", }, Account11 = { ID = 11, SecondaryPassword = "secondarypass", }, Account12 = { ID = 12, SecondaryPassword = "secondarypass", }, Account13 = { ID = 13, SecondaryPassword = "secondarypass", }, Account14 = { ID = 14, SecondaryPassword = "secondarypass", }, Account15 = { ID = 15, SecondaryPassword = "secondarypass", }, Account16 = { ID = 16, SecondaryPassword = "secondarypass", }, Account17 = { ID = 17, SecondaryPassword = "secondarypass", }, Account18 = { ID = 18, SecondaryPassword = "secondarypass", } } LoginDialogTypes = {}; LoginDialogTypes["PASSWORD_FAILED"] = { text = TEXT("LOGIN_PASSWORD_FAILED"), button1 = TEXT("LOGIN_OKAY"), button2 = nil, OnAccept = function() LinkActivateWeb(); QuitGame(); end, OnCancel = function() end, } LoginDialogTypes["CREATE_CHARACTER"] = { text = TEXT("CHARACTER_CREATING"), button1 = nil, button2 = nil, } LoginDialogTypes["RESERVE_CHARACTER"] = { text = TEXT("RESERVE_CHARACTER"), button1 = TEXT("LOGIN_OKAY"), button2 = nil, } LoginDialogTypes["CREATE_CHARACTER_SUCCESS"] = { text = TEXT("CREATE_CHARACTER_SUCCESS"), button1 = TEXT("LOGIN_OKAY"), button2 = nil, OnAccept = function() SetLoginScreen("charselect"); end, } LoginDialogTypes["CANCEL"] = { text = "", button1 = TEXT("LOGIN_CANCEL"), button2 = nil, OnAccept = function() StatusDialogClick(); end, OnCancel = function() end, } LoginDialogTypes["OKAY"] = { text = "", button1 = TEXT("LOGIN_OKAY"), button2 = nil, OnAccept = function() StatusDialogClick(); end, OnCancel = function() end, } LoginDialogTypes["WAITING_QUEUE"] = { text = "", button1 = TEXT("LOGIN_CANCEL"), button2 = nil, OnAccept = function() SetSelectedRealmState(false); SetLoginScreen("login"); CancelWaitingQueue(); end, OnCancel = function() DisconnectFromServer(); SetLoginScreen("login"); end, } LoginDialogTypes["DELETE_CHARACTER"] = { text = TEXT("DELETE_CHARACTER"), button1 = TEXT("LOGIN_OKAY"), button2 = TEXT("LOGIN_CANCEL"), OnShow = function() LoginDialogEditBox:SetText(""); LSKB_SetAnchor("TOP", "BOTTOM", "LoginDialog", -100, 20); LSKB_Open(LoginDialogEditBox_SetText); end, OnAccept = function() DeleteCharacter( CHARACTER_SELECT.selectedIndex, LoginDialogEditBox:GetText() ); LoginDialogEditBox:SetText(""); LSKB_Close(); end, OnCancel = function() LSKB_Close(); end, passwordMode = 1, hasEditBox = 1, } LoginDialogTypes["DELETE_CHARACTER_FAILED"] = { text = TEXT("DELETE_CHARACTER_FAILED"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() end, OnCancel = function() end, } LoginDialogTypes["RECOVER_DELETE_CHARACTER"] = { text = TEXT("RECOVER_DELETE_CHARACTER"), button1 = TEXT("LOGIN_OKAY"), button2 = TEXT("LOGIN_CANCEL"), OnAccept = function() RecoverDeleteCharacter(CHARACTER_SELECT.selectedIndex); end, OnCancel = function() end, } LoginDialogTypes["SELECT_CHARACTER_ZONENOTEXIST"] = { text = TEXT("SELECT_CHARACTER_ZONENOTEXIST"), button1 = TEXT("LOGIN_OKAY"), button2 = TEXT("LOGIN_CANCEL"), OnAccept = function() EnterWorld(CHARACTER_SELECT.selectedIndex); end, OnCancel = function() CancelEnterWorld(); end, } LoginDialogTypes["OPEN_ACTIVATE_WEB"] = { text = TEXT("LINK_ACTIVATE_WEB"), button1 = TEXT("LOGIN_OKAY"), button2 = TEXT("LOGIN_CANCEL"), OnAccept = function() LinkActivateWeb(); end, } LoginDialogTypes["VALID_TIME_ERROR"] = { text = TEXT("VALID_TIME_ERROR"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() OpenActivateExecute(); QuitGame(); end, } LoginDialogTypes["RESET_PASSWORD"] = { text = TEXT("RESET_PASSWORD"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() OpenResetPasswordURL(); QuitGame(); end, } LoginDialogTypes["ADJUST_DISPLAY"] = { text = TEXT("PLZ_ADJUST_DISPLAY"), button1 = TEXT("LOGIN_OKAY"), button2 = TEXT("LOGIN_CANCEL"), OnAccept = function() LoginSettingsFrame.LSFTab = 1; PlaySoundByPath("sound\\interface\\ui_generic_open.mp3"); LoginSettingsFrame:Show(); end, OnCancel = function() end, } LoginDialogTypes["SERVER_FULL"] = { text = TEXT("LOGIN_SERVER_LIST_FULL"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() end, } LoginDialogTypes["SERVER_ILLEGAL_AGE"] = { text = TEXT("LOGIN_ILLEGAL_AGE"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() end, } LoginDialogTypes["CONFIRM_PASSWORD"] = { text = TEXT("LOGIN_CONFIRM_PASSWORD"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() end, OnShow = function() CustomSecondaryPassword = CheckSecondaryPass(); if(fastLoginAutoLogin) then ConfirmPassword(fastLoginSecPass); LoginDiglogParent:Hide(); LSBK_Close(); elseif((CustomSecondaryPassword~=nil) and (CustomSecondaryPassword~="") then ConfirmPassword(CustomSecondaryPassword); LoginDiglogParent:Hide(); LSBK_Close(); else LoginDialogEditBox:SetText(""); end; LSKB_SetAnchor("TOP", "BOTTOM", "LoginDialog", -100, 20); LSKB_Open(LoginDialogEditBox_SetText); end, OnAccept = function() ConfirmPassword( LoginDialogEditBox:GetText() ); LoginDialogEditBox:SetText(""); LSKB_Close(); end, passwordMode = 1, hasEditBox = 1, locked = 1, keyboard = 1, } LoginDialogTypes["CONFIRM_PASSWORD_FAILED"] = { text = TEXT("PASSWORD_INPUT_FAILED"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() LoginDialog_Show("CONFIRM_PASSWORD"); end, } LoginDialogTypes["LOGIN_PASSWORD_THIRD"] = { text = TEXT("LOGIN_LOCK_CHARACTER"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() QuitGame(); end, locked = 1, } LoginDialogTypes["LOGIN_LOCK_CHARACTER"] = { text = TEXT("LOGIN_LOCK_CHARACTER"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() QuitGame(); end, locked = 1, } LoginDialogTypes["CONFIRM_PASSWORD2"] = { text = TEXT("LOGIN_CONFIRM_PASSWORD"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() end, OnShow = function() LoginDialogEditBox:SetText(""); LSKB_SetAnchor("TOP", "BOTTOM", "LoginDialog", -100, 20); LSKB_Open(LoginDialogEditBox_SetText); end, OnAccept = function() ConfirmPassword2( LoginDialogEditBox:GetText() ); LoginDialogEditBox:SetText(""); LSKB_Close(); end, passwordMode = 1, hasEditBox = 1, locked = 1, keyboard = 1, } LoginDialogTypes["CONFIRM_PASSWORD_FAILED2"] = { text = TEXT("PASSWORD_INPUT_FAILED"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() LoginDialog_Show("CONFIRM_PASSWORD2"); end, } LoginDialogTypes["CONFIRM_CAPTCHA_FAILED"] = { text = TEXT("PASSWORD_INPUT_FAILED"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() end, } LoginDialogTypes["CONFIRM_CAPTCHA_TIME_EXPIRED"] = { text = TEXT("CAPTCHA_EXPIRED"), button1 = TEXT("LOGIN_OKAY"), OnAccept = function() end, } function LoginDialogEditBox_SetText(text) LoginDialogEditBox:InsertChar(text); end function LoginDialog_Show(which, text, data) if ( LoginDiglogParent:IsVisible() ) then if ( LoginDialogTypes[LoginDialog.which].locked ) then return; end if ( LoginDialogTypes[LoginDialog.which].OnHide ) then LoginDialogTypes[LoginDialog.which].OnHide(); end end if ( LoginDialogTypes[which].button2 ) then LoginDialogButton1:ClearAllAnchors(); LoginDialogButton1:SetAnchor("BOTTOMRIGHT", "BOTTOM", "LoginDialog", -6, -16); LoginDialogButton2:ClearAllAnchors(); LoginDialogButton2:SetAnchor("LEFT", "RIGHT", "LoginDialogButton1", 13, 0); LoginDialogButton2:SetText(LoginDialogTypes[which].button2); LoginDialogButton2:Show(); else LoginDialogButton1:ClearAllAnchors(); LoginDialogButton1:SetAnchor("BOTTOM", "BOTTOM", "LoginDialog", 0, -16); LoginDialogButton2:Hide(); end if ( text ) then LoginDialogText:SetText(text); else local newText = LoginDialogTypes[which].text; if ( which == "CONFIRM_PASSWORD_FAILED" ) then newText = string.format(newText, GetPasswordErrorCount()); elseif ( which == "CONFIRM_PASSWORD_FAILED2" ) then newText = string.format(newText, GetPasswordErrorCount()); elseif ( which == "CONFIRM_CAPTCHA_FAILED" ) then newText = string.format(newText, GetPasswordErrorCount()); elseif ( which == "LOGIN_LOCK_CHARACTER" ) then newText = string.format(newText, data); end LoginDialogText:SetText(newText); end local buttonHeight; if ( LoginDialogTypes[which].button1 ) then LoginDialogButton1:Show(); LoginDialogButton1:SetText(LoginDialogTypes[which].button1); buttonHeight = LoginDialogButton1:GetHeight(); else LoginDialogButton1:Hide(); buttonHeight = 0; end LoginDialog.which = which; LoginDialog.data = data; -- Show or hide the alert icon if ( LoginDialogTypes[which].showAlert ) then LoginDialog:SetWidth(418); LoginDialogAlertIcon:Show(); else LoginDialog:SetWidth(384); LoginDialogAlertIcon:Hide(); end -- Editbox setup if ( LoginDialogTypes[which].hasEditBox ) then LoginDialogEditBox:Show(); LoginDialogEditBox:SetFocus(); else LoginDialogEditBox:Hide(); end LoginDialogEditBox:SetPasswordMode(LoginDialogTypes[LoginDialog.which].passwordMode); LoginDialogButton1:GetHeight() if ( LoginDialogTypes[which].hasEditBox ) then LoginDialog:SetHeight(16 + LoginDialogText:GetHeight() + 8 + LoginDialogEditBox:GetHeight() + 8 + buttonHeight + 16); else LoginDialog:SetHeight(16 + LoginDialogText:GetHeight() + 8 + buttonHeight + 16); end LoginDiglogParent:Show(); end function LoginDialogButton_Click(index) LoginDiglogParent:Hide(); if ( index == 1 ) then local OnAccept = LoginDialogTypes[LoginDialog.which].OnAccept; if ( OnAccept ) then OnAccept(); end else local OnCancel = LoginDialogTypes[LoginDialog.which].OnCancel; if ( OnCancel ) then OnCancel(); end end end function LoginDialog_OnLoad(this) this:RegisterEvent("OPEN_LOGIN_DIALOG"); this:RegisterEvent("UPDATE_LOGIN_DIALOG"); this:RegisterEvent("CLOSE_LOGIN_DIALOG"); this:RegisterEvent("LINK_ACTIVATE_WEB"); this:RegisterEvent("VALID_TIME_ERROR"); this:RegisterEvent("LOGIN_PASSWORD_FAILED"); this:RegisterEvent("CONFIRM_PASSWORD"); this:RegisterEvent("CONFIRM_PASSWORD_FAILED"); this:RegisterEvent("PASSWORD_THIRD_FAILED"); this:RegisterEvent("LOGIN_LOCK_CHARACTER"); this:RegisterEvent("RESET_PASSWORD"); this:RegisterEvent("CONFIRM_PASSWORD2"); this:RegisterEvent("CONFIRM_PASSWORD_FAILED2"); end function LoginDialog_OnShow(this) if ( LoginDialogTypes[this.which].OnShow ) then LoginDialogTypes[this.which].OnShow(); end end function LoginDialog_OnEvent(this, event) if ( event == "OPEN_LOGIN_DIALOG" ) then LoginDialog_Show(arg1, arg2, arg3); elseif ( event == "UPDATE_LOGIN_DIALOG" ) then if ( arg1 and string.len(arg1) > 0 ) then LoginDialogText:SetText(arg1); local buttonText = nil; if ( arg2 ) then buttonText = arg2; elseif ( LoginDialogTypes[LoginDialog.which] ) then buttonText = LoginDialogTypes[LoginDialog.which].button1; end if ( buttonText ) then LoginDialogButton1:SetText(buttonText); end LoginDialog:SetHeight(32 + LoginDialogText:GetHeight() + 8 + LoginDialogButton1:GetHeight() + 16); end elseif ( event == "CLOSE_LOGIN_DIALOG" ) then if ( LoginDialogTypes[LoginDialog.which].locked ) then return; end LoginDiglogParent:Hide(); elseif ( event == "LINK_ACTIVATE_WEB" ) then LoginDialog_Show("OPEN_ACTIVATE_WEB"); elseif ( event == "VALID_TIME_ERROR" ) then LoginDialog_Show("VALID_TIME_ERROR"); elseif ( event == "LOGIN_PASSWORD_FAILED" ) then LoginDialog_Show("PASSWORD_FAILED"); elseif ( event == "CONFIRM_PASSWORD" ) then LoginDiglogParent:Hide(); LoginDialog_Show("CONFIRM_PASSWORD"); elseif ( event == "CONFIRM_PASSWORD_FAILED" ) then LoginDialog_Show("CONFIRM_PASSWORD_FAILED"); elseif ( event == "PASSWORD_THIRD_FAILED" ) then LoginDialog_Show("LOGIN_PASSWORD_THIRD"); elseif ( event == "LOGIN_LOCK_CHARACTER" ) then LoginDialog_Show("LOGIN_LOCK_CHARACTER", nil, math.floor((3600 - arg1)/60)+1); elseif ( event == "RESET_PASSWORD" ) then LoginDialog_Show("RESET_PASSWORD"); elseif ( event == "CONFIRM_PASSWORD2" ) then LoginDiglogParent:Hide(); LoginDialog_Show("CONFIRM_PASSWORD2"); elseif ( event == "CONFIRM_PASSWORD_FAILED2" ) then LoginDialog_Show("CONFIRM_PASSWORD_FAILED2"); end end function LoginDialog_EditBoxOnEnterPressed(this) this:ClearFocus(); end function LoginDialog_EditBoxOnEscapePressed() this:ClearFocus(); end function LoginDialog_OnKeyDown(this, key) local info = LoginDialogTypes[LoginDialog.which]; if ( not info or info.ignoreKeys ) then return; end if ( key == "ESCAPE" ) then if ( LoginDialogButton2:IsVisible() ) then LoginDialogButton_Click(2); else LoginDialogButton_Click(1); end elseif ( key == "ENTER" ) then LoginDialogButton_Click(1); end end function CheckSecondaryPass() for i = 1, 18 do if CustomSecondaryPass["Account"..i].ID == LogID then return CustomSecondaryPass["Account"..i].SecondaryPassword end end return end