Purpose: To add the new login screen
Difficulty: 3 / 10
Assumed Knowledge: JAVA!!
Classes Modified: Client.java
Refactored/Non-Refactored?: Refactored
Download the [Only registered and activated users can see links. ] and pack them into your title cache (Assuming you know how to do this)
Time to add the sprites,
background -> titlebox 0
login -> titlebutton 0
login_hover -> titlebutton 1
box -> box 0
box_hover -> box 1
Okay, time to add the code now
find "Background aBackground_967" and add these under it
Code:
private Background loginHover;
private Background box;
private Background boxHover;
Under "aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);" in "private void loadTitleScreen()" add these
Code:
loginHover = new Background(titleStreamLoader, "titlebutton", 1);
box = new Background(titleStreamLoader, "box", 0);
boxHover = new Background(titleStreamLoader, "box", 1);
Replace your "drawLoginScreen(boolean flag)" with
Code:
private void drawLoginScreen(boolean flag) {
resetImageProducers();
aRSImageProducer_1109.initDrawingArea();
aBackground_966.drawBackground(0, 0);
char c = '\u0168';
char c1 = '\310';
if (loginScreenState == 0) {
int i = c1 / 2 + 80;
aTextDrawingArea_1271.method382(0x75a9a9, c / 2,
onDemandFetcher.statusString, i, true);
int l = c / 2 - 80;
int k1 = c1 / 2 + 20;
((super.mouseX >= 293 && super.mouseX <= 472 && super.mouseY >= 296 && super.mouseY <= 321) ? loginHover
: aBackground_967).drawBackground(l - 57, k1 + 41);
((super.mouseX >= 273 && super.mouseX <= 490 && super.mouseY >= 194 && super.mouseY <= 219) ? boxHover
: box).drawBackground(l - 78, k1 - 62);
((super.mouseX >= 273 && super.mouseX <= 490 && super.mouseY >= 240 && super.mouseY <= 265) ? boxHover
: box).drawBackground(l - 78, k1 - 16);
int j = c1 / 2 - 23;
if (loginScreenCursorPos != 0 && loginScreenCursorPos != 1)
loginScreenCursorPos = 0;
aTextDrawingArea_1271
.method389(true, c / 2 - 154, 0xffffff, ""
+ myUsername
+ ((loginScreenCursorPos == 0)
& (loopCycle % 40 < 20) ? "@[email protected] |" : ""), j);
j += 47;
aTextDrawingArea_1271
.method389(true, c / 2 - 154, 0xffffff,
""
+ TextClass.passwordAsterisks(myPassword)
+ ((loginScreenCursorPos == 1)
& (loopCycle % 40 < 20) ? "@[email protected] |"
: ""), j);
}
aRSImageProducer_1109.drawGraphics(135, super.graphics, 251);
if (welcomeScreenRaised) {
welcomeScreenRaised = false;
aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
}
}
repalce
Code:
aRSImageProducer_1109 = new RSImageProducer(320, 200,
getGameComponent());
with
Code:
aRSImageProducer_1109 = new RSImageProducer(263, 233,
getGameComponent());
Replace your "processLoginScreenInput()" with this:
Code:
private void processLoginScreenInput() {
if (loginScreenState == 0) {
int l = super.myHeight / 2 + 20;
l += 20;
if (super.clickMode3 == 1 && super.saveClickX >= 273
&& super.saveClickX <= 490 && super.saveClickY >= 194
&& super.saveClickY <= 219)
loginScreenCursorPos = 0;
if (super.clickMode3 == 1 && super.mouseX >= 273
&& super.mouseX <= 490 && super.mouseY >= 240
&& super.mouseY <= 265)
loginScreenCursorPos = 1;
if (super.clickMode3 == 1 && super.saveClickX >= 293
&& super.saveClickX <= 472 && super.saveClickY >= 296
&& super.saveClickY <= 321) {
loginFailures = 0;
login(myUsername, myPassword, false);
if (loggedIn)
return;
}
do {
int l1 = readChar(-796);
if (l1 == -1)
break;
boolean flag1 = false;
for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
if (l1 != validUserPassChars.charAt(i2))
continue;
flag1 = true;
break;
}
if (loginScreenCursorPos == 0) {
if (l1 == 8 && myUsername.length() > 0)
myUsername = myUsername.substring(0,
myUsername.length() - 1);
if (l1 == 9 || l1 == 10 || l1 == 13)
loginScreenCursorPos = 1;
if (flag1)
myUsername += (char) l1;
if (myUsername.length() > 12)
myUsername = myUsername.substring(0, 12);
} else if (loginScreenCursorPos == 1) {
if (l1 == 8 && myPassword.length() > 0)
myPassword = myPassword.substring(0,
myPassword.length() - 1);
if (l1 == 9 || l1 == 10 || l1 == 13)
loginScreenCursorPos = 0;
if (flag1)
myPassword += (char) l1;
if (myPassword.length() > 20)
myPassword = myPassword.substring(0, 20);
}
} while (true);
return;
}
if (loginScreenState == 3) {
int k = super.myWidth / 2;
int j1 = super.myHeight / 2 + 50;
j1 += 20;
if (super.clickMode3 == 1 && super.saveClickX >= k - 75
&& super.saveClickX <= k + 75
&& super.saveClickY >= j1 - 20
&& super.saveClickY <= j1 + 20)
loginScreenState = 0;
}
}
And your done! If i forgot something, please let me know
Picture: