Mod_Cubsmiles
June 23rd, 2010, 14:28
Let the flaming begin.
Description: Displaying the Interface to change options, clothes, and hair.
Difficulty: 9/10
Files Modified: Player.class, FileManager.class, ActionButtons.class
Step 1: Declaring the int
Open up Player.java
Search for:
public int starter = 0;
Under that add:
/**
* Player's first time logging in.
*/
public int firstLog = 0;
Step 2: Adding it to show upon the player's first log in
Open ActionButtons.java
Search for:
case 378:
You should see:
case 378:
if (buttonId == 140) {
p.getActionSender().setWindowPane(p, 548);
}
break;
Under:
p.getActionSender().setWindowPane(p, 548);
Add:
if (p.firstLog == 0) {
p.getActionSender().showInterface(p, 771);
}
Step 3:
Add this in ActionButtons.java in your other cases.
case 771:
/*
* Character Screen
*/
if (buttonId == 362) {
p.getActionSender().removeShownInterface(p);
p.firstLog = 1;
p.appearanceUpdateReq = true;
p.updateReq = true;
}
if (buttonId == 49) {
p.look[0] = 3;
p.look[1] = 10;
p.look[2] = 18;
p.look[3] = 26;
p.look[4] = 33;
p.look[5] = 36;
p.look[6] = 42;
p.gender = 0;
p.appearanceUpdateReq = true;
p.updateReq = true;
}
if (buttonId == 52) {
p.look[0] = 48; // Hair
p.look[1] = 1000; // Beard
p.look[2] = 57; // Torso
p.look[3] = 64; // Arms
p.look[4] = 68; // Bracelets
p.look[5] = 77; // Legs
p.look[6] = 80; // Shoes
p.gender = 1;
p.appearanceUpdateReq = true;
p.updateReq = true;
}
break;
Step 4: Making it save
Open FileManager.java
Search for:
public void saveCharacter(Player p) throws Exception {
You should see something like this:
public void saveCharacter(Player p) throws Exception {
if (p == null) {
return;
}
stream.outOffset = 0;
stream.writeString("username:" + p.username);
stream.writeString("password:" + Misc.stringToLong(p.password));
stream.writeString("rights:" + p.rights);
stream.writeString("donator:" + p.donator);
stream.writeString("starter:" + p.starter);
Under one of them add:
stream.writeString("firstlog:" + p.firstLog);
Search for:
public void saveBackup(Player p) throws Exception {
Add:
stream.writeString("firstlog:" + p.firstLog);
With the others
Search for:
else if (line.startsWith("rights:"))
Under:
p.rights = Integer.parseInt(line.substring(7));
Add:
else if (line.startsWith("firstlog:"))
p.firstLog = Integer.parseInt(line.substring(9));
There you go.
Description: Displaying the Interface to change options, clothes, and hair.
Difficulty: 9/10
Files Modified: Player.class, FileManager.class, ActionButtons.class
Step 1: Declaring the int
Open up Player.java
Search for:
public int starter = 0;
Under that add:
/**
* Player's first time logging in.
*/
public int firstLog = 0;
Step 2: Adding it to show upon the player's first log in
Open ActionButtons.java
Search for:
case 378:
You should see:
case 378:
if (buttonId == 140) {
p.getActionSender().setWindowPane(p, 548);
}
break;
Under:
p.getActionSender().setWindowPane(p, 548);
Add:
if (p.firstLog == 0) {
p.getActionSender().showInterface(p, 771);
}
Step 3:
Add this in ActionButtons.java in your other cases.
case 771:
/*
* Character Screen
*/
if (buttonId == 362) {
p.getActionSender().removeShownInterface(p);
p.firstLog = 1;
p.appearanceUpdateReq = true;
p.updateReq = true;
}
if (buttonId == 49) {
p.look[0] = 3;
p.look[1] = 10;
p.look[2] = 18;
p.look[3] = 26;
p.look[4] = 33;
p.look[5] = 36;
p.look[6] = 42;
p.gender = 0;
p.appearanceUpdateReq = true;
p.updateReq = true;
}
if (buttonId == 52) {
p.look[0] = 48; // Hair
p.look[1] = 1000; // Beard
p.look[2] = 57; // Torso
p.look[3] = 64; // Arms
p.look[4] = 68; // Bracelets
p.look[5] = 77; // Legs
p.look[6] = 80; // Shoes
p.gender = 1;
p.appearanceUpdateReq = true;
p.updateReq = true;
}
break;
Step 4: Making it save
Open FileManager.java
Search for:
public void saveCharacter(Player p) throws Exception {
You should see something like this:
public void saveCharacter(Player p) throws Exception {
if (p == null) {
return;
}
stream.outOffset = 0;
stream.writeString("username:" + p.username);
stream.writeString("password:" + Misc.stringToLong(p.password));
stream.writeString("rights:" + p.rights);
stream.writeString("donator:" + p.donator);
stream.writeString("starter:" + p.starter);
Under one of them add:
stream.writeString("firstlog:" + p.firstLog);
Search for:
public void saveBackup(Player p) throws Exception {
Add:
stream.writeString("firstlog:" + p.firstLog);
With the others
Search for:
else if (line.startsWith("rights:"))
Under:
p.rights = Integer.parseInt(line.substring(7));
Add:
else if (line.startsWith("firstlog:"))
p.firstLog = Integer.parseInt(line.substring(9));
There you go.