Skip to content

Commit

Permalink
passwords autofill for Zero Rando
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed Jun 25, 2023
1 parent 8bc17f2 commit 826febf
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 35 deletions.
6 changes: 3 additions & 3 deletions DXRModules/DeusEx/Classes/DXRPasswords.uc
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ function FixCodes()
}
}

function ChangeKeypadPasscode(#var(prefix)Keypad k)
function ChangeKeypadPasscode(#var(prefix)Keypad k, bool rando)
{
if( k.validCode == "718" ) {
if( k.validCode == "718" && rando ) {
FixMaggieChowBday(k);
return;
}
else
Super.ChangeKeypadPasscode(k);
Super.ChangeKeypadPasscode(k, rando);
}

function FixMaggieChowBday(#var(prefix)Keypad k)
Expand Down
65 changes: 38 additions & 27 deletions DXRModules/DeusEx/Classes/DXRPasswordsBase.uc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ simulated function bool UpdateString(out string str, string oldpassword, string
if( str == "") return false;
if( PassInStr( str, oldpassword ) == -1 ) return false;
if(oldpassword == newpassword)
return false;
info("found string with password " $ oldpassword $ ", replacing with newpassword " $ newpassword);
//l(str);
//l("---");
Expand Down Expand Up @@ -167,54 +170,45 @@ function RandoPasswords(int mode)
local #var(prefix)Keypad k;
local #var(prefix)ATM a;
local int i;
local bool rando;
if( mode == 0 ) return;
if( mode == 0 ) rando = false;
else rando = true;
foreach AllActors(class'#var(prefix)Computers', c)
{
for (i=0; i<ArrayCount(c.userList); i++)
{
if (c.userList[i].password == "")
continue;
ChangeComputerPassword(c, i);
ChangeComputerPassword(c, i, rando);
}
}
foreach AllActors(class'#var(prefix)Keypad', k)
{
ChangeKeypadPasscode(k);
ChangeKeypadPasscode(k, rando);
}
foreach AllActors(class'#var(prefix)ATM', a)
{
#ifdef hx
for (i=0; i<ArrayCount(a.ATMUserList); i++)
{
if(a.ATMUserList[i].PIN == "")
continue;
ChangeATMPIN(a, i);
}
#else
for (i=0; i<ArrayCount(a.userList); i++)
#endif
{
if(a.userList[i].PIN == "")
continue;
ChangeATMPIN(a, i);
ChangeATMPIN(a, i, rando);
}
#endif
}
}
function ChangeComputerPassword(#var(prefix)Computers c, int i)
function ChangeComputerPassword(#var(prefix)Computers c, int i, bool rando)
{
local string oldpassword;
local string newpassword;
local int j;
oldpassword = c.userList[i].password;
if(oldpassword == "") return;
for (j=0; j<ArrayCount(oldpasswords); j++)
{
Expand All @@ -225,18 +219,22 @@ function ChangeComputerPassword(#var(prefix)Computers c, int i)
}
if( Len(oldpassword) < 2 ) return;
newpassword = GeneratePassword(dxr, oldpassword);
if(rando)
newpassword = GeneratePassword(dxr, oldpassword);
else
newpassword = oldpassword;
c.userList[i].password = newpassword;
ReplacePassword(oldpassword, newpassword);
}
function ChangeKeypadPasscode(#var(prefix)Keypad k)
function ChangeKeypadPasscode(#var(prefix)Keypad k, bool rando)
{
local string oldpassword;
local string newpassword;
local int j;
oldpassword = k.validCode;
if(oldpassword == "") return;
for (j=0; j<ArrayCount(oldpasswords); j++)
{
Expand All @@ -247,12 +245,15 @@ function ChangeKeypadPasscode(#var(prefix)Keypad k)
}
if( Len(oldpassword) < 2 ) return;
newpassword = GeneratePasscode(oldpassword);
if(rando)
newpassword = GeneratePasscode(oldpassword);
else
newpassword = oldpassword;
k.validCode = newpassword;
ReplacePassword(oldpassword, newpassword);
}
function ChangeATMPIN(#var(prefix)ATM a, int i)
function ChangeATMPIN(#var(prefix)ATM a, int i, bool rando)
{
local string oldpassword;
local string newpassword;
Expand All @@ -264,6 +265,8 @@ function ChangeATMPIN(#var(prefix)ATM a, int i)
oldpassword = a.userList[i].PIN;
#endif
if(oldpassword == "") return;
for (j=0; j<ArrayCount(oldpasswords); j++)
{
if( oldpassword == oldpasswords[j] ) {
Expand All @@ -277,7 +280,11 @@ function ChangeATMPIN(#var(prefix)ATM a, int i)
}
if( Len(oldpassword) < 2 ) return;
newpassword = GeneratePasscode(oldpassword);
if(rando)
newpassword = GeneratePasscode(oldpassword);
else
newpassword = oldpassword;
#ifdef hx
a.ATMUserList[i].PIN = newpassword;
#else
Expand Down Expand Up @@ -400,6 +407,10 @@ simulated function bool UpdateGoal(DeusExGoal goal, string oldpassword, string n
if( goal.bCompleted ) return false;
if( PassInStr( goal.text, oldpassword ) == -1 ) return false;

MarkPasswordKnown(newpassword);
if(oldpassword == newpassword)
return false;

#ifndef hx
player().ClientMessage("Goal updated with randomized password",, true);
DeusExRootWindow(player().rootWindow).hud.msgLog.PlayLogSound(Sound'LogGoalAdded');
Expand All @@ -413,8 +424,6 @@ simulated function bool UpdateGoal(DeusExGoal goal, string oldpassword, string n
HXGameInfo(Level.Game).AddNote(goal.text, false, true, '');
#endif

MarkPasswordKnown(newpassword);

return true;
}

Expand Down Expand Up @@ -462,6 +471,10 @@ simulated function bool UpdateNote(DeusExNote note, string oldpassword, string n

if( PassInStr( note.text, oldpassword ) == -1 ) return false;

MarkPasswordKnown(newpassword);
if(oldpassword == newpassword)
return false;

updated++;
info("found note with password " $ oldpassword $ ", replacing with newpassword " $ newpassword);

Expand All @@ -472,8 +485,6 @@ simulated function bool UpdateNote(DeusExNote note, string oldpassword, string n
HXUpdateNote(note.textTag, note.text, "");
#endif

MarkPasswordKnown(newpassword);

return true;
}

Expand Down
5 changes: 0 additions & 5 deletions GUI/DeusEx/Classes/FrobDisplayWindow.uc
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ function CheckAutofillSettings()
known_codes = false;
}

if(player.FlagBase.GetInt('Rando_passwordsrandomized') <= 0) {
auto_codes = false;
known_codes = false;
}

show_keys = bool(player.ConsoleCommand("get #var(package).MenuChoice_ShowKeys enabled"));
}

Expand Down

0 comments on commit 826febf

Please sign in to comment.