prontera,160,180,0 script Midgard Security 413,{
set .@npcName$,"[^0000FF Security Personel ^000000]";
mes .@npcName$;
mes "Welcome! I am a member of Midgard's Security.";
mes "As such, it is my job to ensure account safety of our players.";
mes "That is of course if they wish to use our service.";
next;
mes "So, what would you like to do?";
goto LacctCheck;
LacctCheck:
menu "Enable / Disable Security",iAD,"Change Password",iCP,"Change RecoveryPhrase",iRP,"View Password Attempts",iVP,"Cancel",cancel;
iAD:
if (#SecurityPass$!="NoPopUp"){set #SecurityPass$,"NoPopUp"; mes "Security is now turned OFF."; close;}
if (#SecurityPass$=="NoPopUp")
{next;
mes "Input a new Password";
input .@CSpassword$;
if (.@CSpassword$==#RecoveryPhrase$){next; mes "Your Password cannot be the same as your Recovery-Phrase. Please try agian."; goto iAD;}
set @CSpassword$,.@CSpassword$;
next;
mes "Input it again for confirmation.";
input .@CSpassword$;
if (.@CSpassword$!=@CSpassword$){mes "That is incorrect. Try again."; close;}
set #SecurityPass$,@CSpassword$;
mes "Security is now turned ON.";
next;
goto iRecoveryPhrase;
iRecoveryPhrase:
mes "... ... ... ...";
mes "Now then, please input a recovery phrase";
mes "This phrase will be used to recover your password, in case you forget it.";
input .@RecoveryPhrase$;
if (.@RecoveryPhrase$==#SecurityPass$){next; mes "Your Recovery-Phrase cannot be the same as your Password. Please try again."; next; goto iRecoveryPhrase;}
set @RecoveryPhrase$,.@RecoveryPhrase$;
next;
mes "Input it again for confirmation.";
input .@RecoveryPhrase$;
if (@RecoveryPhrase$!=.@RecoveryPhrase$){mes "Those phrases don't match. Please try again."; close;}
set #RecoveryPhrase$,@RecoveryPhrase$;
mes "Please write this phrase down. It will be used to recover your password should you ever forget it.";
next;
mes "Once again, here it is:";
mes "^0000FF"+#RecoveryPhrase$+"^000000";
mes "WRITE IT DOWN ! ";
close;}
end;
iCP:
next;
mes .@npcName$;
if (#SecurityPass$=="NoPopUp"){mes "You don't have a password set."; mes "^0000FFPlease go set one by enabling the security.^000000"; close;}
mes "Very well then. Please Enter your Current Security Password.";
input .@CSpassword$;
if (.@CSpassword$!=#SecurityPass$){next; mes "That is incorrect. Try again."; close;}
next;
mes "Now then. Please Enter your new Security Password.";
input .@NSpassword$;
if (.@NSpassword$==#RecoveryPhrase$){next; mes "Your Password cannot be the same as your Recovery-Phrase. Please try agian."; goto iCP;}
set @NSpassword$,.@NSpassword$;
next;
mes "Please Enter it again for confirmation.";
input .@CNSpassword$;
if (@NSpassword$!=.@CNSpassword$){next; mes "That is incorrect. Try again."; close;}
set #SecurityPass$,.@CNSpassword$;
next;
mes "Your password was changed successfully. Come again.";
close;
iRP:
next;
mes .@npcName$;
if (#RecoveryPhrase$=="")
{mes "You don't have a Recovery Phrase set.";
mes "Please set one by enabling the Security.";
close;}
mes "Very well then. Please Enter your Current Recovery Phrase.";
input .@RecovPhrase$;
if (.@RecovPhrase$!=#RecoveryPhrase$){next; mes "That is incorrect. Try again."; close;}
next;
mes "Now then. Please Enter your new Recovery Phrase.";
input .@NRP$;
if (.@NRP$==#SecurityPass$){next; mes "Your Recovery-Phrase cannot be the same as your Password. Please try again."; goto iRP;}
set @NRP$,.@NRP$;
next;
mes "Please enter it again for confirmation.";
input .@NRP$;
if (@NRP$!=.@NRP$){next; mes "Those phrases don't match. Try again."; close;}
set #RecoveryPhrase$,@NRP$;
next;
mes "Your Recovery Phrase was changed successfully.";
mes "Please write it down. It will be used in case you forget your password.";
next;
mes "Here it is:";
mes "^0000FF"+#RecoveryPhrase$+"^000000";
mes "WRITE IT DOWN !";
close;
iVP:
next;
mes .@npcName$;
mes "Alright. Here you go.";
mes "There have been in total: ^0000FF"+#SecurityAttempt+"^000000 password attempts.";
close;
cancel:
close;
OnPCLoginEvent:
set .@npcName$,"[^0000FF Security Personel ^000000]";
set @BanTime,5;
if (#SecurityPass$=="")
{mes .@npcName$;
mes "This server has a unique system which allows you to have a SECOND password.";
mes "This is of course optional. Would you like to use it?";
menu "Yes, set it up.",iYes,"No, and please stop showing up.",iNo;
iYes:
next;
callfunc "Set_AcctSecure";
iNo:
set #SecurityPass$,"NoPopUp";
percentheal 100,100;
mes "Alright then. Just remember, if you're interested, talk to the Security Personel in prontera.";
close;
end;}
if (#SecurityPass$=="NoPopUp"){set @SecurityPass,1; end;}
if (#SecurityPass$!="NoPopUp" && #SecurityPass$==#SecurityPass$)
{sc_start 112,999999999,100;
sc_start 1,999999999,100;
sc_start 8,999999999,100;
goto InputSecurityPass;}
end;
OnPCLoadMapEvent:
getmapxy(@Map$,@X,@Y,0);
if (@Map$=="prontera" || @Map$!="prontera"){
if (@SecurityPass==0 && #SecurityPass$!="NoPopUp" && #SecurityPass$==#SecurityPass$)
{goto InputSecurityPass;}
if (@SecurityPass==0 && #SecurityPass$=="NoPopUp"){set @SecurityPass,1; end;}
if (@SecurityPass==1){end;}
end;
}
InputSecurityPass:
mes "This account is protected by Midgard Security Personel.";
mes "Input your password to continue playing.";
mes "OR";
mes "Input your Recovery-Phrase in case you lost your password.";
input .@spass$;
if (#RecoveryPhrase$==.@spass$)
{next;
mes "Here is your password, don't lose it again.";
mes "^0000FF"+#SecurityPass$+"^000000";
next; goto InputSecurityPass;}
if (#SecurityPass$==.@spass$)
{mes "That is correct"; set @SecurityPass,1; sc_end 1; sc_end 112; sc_end 8;
percentheal 100,100; close; end;}
if (#SecurityPass$!=.@spass$ && #RecoveryPhrase$!=.@spass$)
{set @Attempt,@Attempt+1; mes "INCORRECT!!";
if (@Attempt>=3){atcommand "@ban "+@BanTime+"mn "+strcharinfo(0)+""; end;}
next; goto InputSecurityPass;}
close;
end;
}
function script Set_AcctSecure {
set .@npcName$,"[^0000FF Security Personel ^000000]";
menu "Set up a Security Password",iSP,"Information on System",iSI,"Cancel",cancel;
iSP:
next;
mes .@npcName$;
mes "Very well then. Please enter a Password.";
mes "It may contain 4-32 alphanumeric characters";
mes "(A-Z) & (1-0) are all alphanumeric characters.";
input .@Npassword$;
set @Npassword$,.@Npassword$;
next;
mes "Please enter your password again for confirmation.";
input .@Npassword$;
if (.@Npassword$!=@Npassword$){mes "The Passwords did not match. Try again by talking to a security personel."; goto iSP;}
set #SecurityPass$,@Npassword$;
next;
mes "Your password was set successfully.";
next;
goto iRecoveryPhrase;
iRecoveryPhrase:
mes "Now then. Please enter a Recovery Phrase";
mes "This phrase will be used in case you forget your password.";
input .@RecovPhrase$;
if (.@RecovPhrase$==#SecurityPass$){mes "Your Recovery-Phrase cannot be the same as your Password. Please try agian."; next; goto iRecoveryPhrase;}
set @RecovPhrase$,.@RecovPhrase$;
next;
mes "Please input your Recovery Phrase again for confirmation.";
input .@RecovPhrase$;
if (@RecovPhrase$!=.@RecovPhrase$){mes "The Recovery Phrases did not match. Try again by talking to a security personel."; next; goto iRecoveryPhrase;}
set #RecoveryPhrase$,@RecovPhrase$;
next;
mes "Your Recovery Phrase was set successfully.";
mes "Please write this down. It will be used if you forgot your password.";
mes "Here it is:";
mes "^0000FF"+#RecoveryPhrase$+"^000000";
mes "WRITE IT DOWN !!";
close;
iSI:
next;
mes .@npcName$;
mes "This system is a unique system that will allow you to have a second password for your account.";
mes "In other words, after you login at the login screen, our security personel will ask you to enter your Security Password.";
mes "This will prevent others from hacking into your account while you're away.";
next;
mes .@npcName$;
mes "That is all there is to this system.";
mes "So, what would you like to do?";
callfunc "Set_AcctSecure";
end;
cancel:
close;
}