forked from 2009Scape/Server
Dialogue Changes, Hairdresser and Clothing Makeover changes (#73)
* Restored Feature to enable/disable the default clan when an account is registered. * "Cleaned Up" the dialogue options for the Hairdresser Added some facial animations other than HALF_GUILTY (Not sure if they are accurate) Changed the interfaces the Hairdresser opens to the 2009 ones. The Hairdresser will no longer cut the player's hair if the player is wearing a helmet, shield or sword * Changed the code to use the 2008/2009 interfaces made two methods two handle each gender interface Buttons should work on each interface Removed some redundant code Added a //TODO for later Added a facial expression to the dialogue the hairdresser says after confirming the hairstyles * Added //TODO's for later Added Facial Expressions other than HALF_GUILTY Prep work for showing how old the player's account is * Very minor id change * "Cleaned Up" Thessalia's dialogue Changed the menus the npc opens to the 2008/2009 interfaces Added Facial Expressions other than HALF_GUILTY Added ability to check if player is wearing any armour (if the player is wearing armour, Thessalia will tell the player to take it off) Moved an argument to the ThessaliaInterface java class Added comments tp separate sections of the code * "Cleaned Up" the interface button code Added a dialogue from Thessalia when the player accepts changes Added a couple of arrays to properly change clothes to the correct ID Added a variable to handle the clothing recolour stuff Changed the interface components to the 2008/2009 menus Redid all the case code executions added a method that would handle clothing recolouring Added comments to separate different sections of code Redid the confirmation code to be similar to the hairdresser interfaces
This commit is contained in:
parent
c13845031b
commit
a35b1ffe1c
7 changed files with 743 additions and 735 deletions
|
|
@ -9,7 +9,6 @@ import java.sql.Timestamp;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.crandor.ServerConstants;
|
||||
import org.crandor.cache.misc.buffer.ByteBufferUtils;
|
||||
import org.crandor.game.node.entity.player.info.portal.PlayerSQLManager;
|
||||
import org.crandor.game.system.SystemManager;
|
||||
|
|
@ -19,6 +18,7 @@ import org.crandor.game.system.task.TaskExecutor;
|
|||
import org.crandor.net.Constants;
|
||||
import org.crandor.net.IoSession;
|
||||
import org.crandor.net.event.LoginReadEvent;
|
||||
import org.keldagrim.ServerConstants;
|
||||
|
||||
/**
|
||||
* Handles the registry of new accounts.
|
||||
|
|
@ -59,93 +59,93 @@ public class AccountRegister extends SQLEntryHandler<RegistryDetails> {
|
|||
public static void read(final IoSession session, int opcode, ByteBuffer buffer) {
|
||||
int day,month,year,country;
|
||||
switch (opcode) {
|
||||
case 147://details
|
||||
day = buffer.get();
|
||||
month = buffer.get();
|
||||
year = buffer.getShort();
|
||||
country = buffer.getShort();
|
||||
response(session, RegistryResponse.SUCCESS);
|
||||
break;
|
||||
case 186://username
|
||||
final String username = ByteBufferUtils.getString(buffer).replace(" ", "_").toLowerCase().replace("|", "");
|
||||
if (username.length() <= 0 || username.length() > 12) {
|
||||
response(session, RegistryResponse.INVALID_USERNAME);
|
||||
case 147://details
|
||||
day = buffer.get();
|
||||
month = buffer.get();
|
||||
year = buffer.getShort();
|
||||
country = buffer.getShort();
|
||||
response(session, RegistryResponse.SUCCESS);
|
||||
break;
|
||||
}
|
||||
if (!validUsername(username)) {
|
||||
System.out.println("AHAHHA " + username);
|
||||
response(session,RegistryResponse.INVALID_USERNAME);
|
||||
break;
|
||||
}
|
||||
TaskExecutor.executeSQL(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (PlayerSQLManager.hasSqlAccount(username, "username")) {
|
||||
response(session, RegistryResponse.NOT_AVAILBLE_USER);
|
||||
return;
|
||||
}
|
||||
response(session, RegistryResponse.SUCCESS);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
case 186://username
|
||||
final String username = ByteBufferUtils.getString(buffer).replace(" ", "_").toLowerCase().replace("|", "");
|
||||
if (username.length() <= 0 || username.length() > 12) {
|
||||
response(session, RegistryResponse.INVALID_USERNAME);
|
||||
break;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 36://Register details
|
||||
buffer.get();
|
||||
buffer = LoginReadEvent.getRSABlock(buffer);
|
||||
buffer.getShort();
|
||||
int revision = buffer.getShort();//revision?
|
||||
if (revision != Constants.REVISION) {
|
||||
response(session, RegistryResponse.CANNOT_CREATE);
|
||||
if (!validUsername(username)) {
|
||||
System.out.println("AHAHHA " + username);
|
||||
response(session,RegistryResponse.INVALID_USERNAME);
|
||||
break;
|
||||
}
|
||||
TaskExecutor.executeSQL(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (PlayerSQLManager.hasSqlAccount(username, "username")) {
|
||||
response(session, RegistryResponse.NOT_AVAILBLE_USER);
|
||||
return;
|
||||
}
|
||||
response(session, RegistryResponse.SUCCESS);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
final String name = ByteBufferUtils.getString(buffer).replace(" ", "_").toLowerCase().replace("|", "");
|
||||
buffer.getInt();
|
||||
String password = ByteBufferUtils.getString(buffer);
|
||||
if (password.length() < 5 || password.length() > 20) {
|
||||
response(session, RegistryResponse.INVALID_PASS_LENGTH);
|
||||
break;
|
||||
}
|
||||
if (password.equals(name)) {
|
||||
response(session, RegistryResponse.PASS_SIMILAR_TO_USER);
|
||||
break;
|
||||
}
|
||||
if (!validUsername(name)) {
|
||||
response(session, RegistryResponse.INVALID_USERNAME);
|
||||
break;
|
||||
}
|
||||
buffer.getInt();
|
||||
buffer.getShort();
|
||||
day = buffer.get();
|
||||
month = buffer.get();
|
||||
buffer.getInt();
|
||||
year = buffer.getShort();
|
||||
country = buffer.getShort();
|
||||
buffer.getInt();
|
||||
@SuppressWarnings("deprecation")
|
||||
final RegistryDetails details = new RegistryDetails(name, SystemManager.getEncryption().hashPassword(password), new Date(year, month, day), country);
|
||||
TaskExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (PlayerSQLManager.hasSqlAccount(name, "username")) {
|
||||
case 36://Register details
|
||||
buffer.get();
|
||||
buffer = LoginReadEvent.getRSABlock(buffer);
|
||||
buffer.getShort();
|
||||
int revision = buffer.getShort();//revision?
|
||||
if (revision != Constants.REVISION) {
|
||||
response(session, RegistryResponse.CANNOT_CREATE);
|
||||
break;
|
||||
}
|
||||
final String name = ByteBufferUtils.getString(buffer).replace(" ", "_").toLowerCase().replace("|", "");
|
||||
buffer.getInt();
|
||||
String password = ByteBufferUtils.getString(buffer);
|
||||
if (password.length() < 5 || password.length() > 20) {
|
||||
response(session, RegistryResponse.INVALID_PASS_LENGTH);
|
||||
break;
|
||||
}
|
||||
if (password.equals(name)) {
|
||||
response(session, RegistryResponse.PASS_SIMILAR_TO_USER);
|
||||
break;
|
||||
}
|
||||
if (!validUsername(name)) {
|
||||
response(session, RegistryResponse.INVALID_USERNAME);
|
||||
break;
|
||||
}
|
||||
buffer.getInt();
|
||||
buffer.getShort();
|
||||
day = buffer.get();
|
||||
month = buffer.get();
|
||||
buffer.getInt();
|
||||
year = buffer.getShort();
|
||||
country = buffer.getShort();
|
||||
buffer.getInt();
|
||||
@SuppressWarnings("deprecation")
|
||||
final RegistryDetails details = new RegistryDetails(name, SystemManager.getEncryption().hashPassword(password), new Date(year, month, day), country);
|
||||
TaskExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (PlayerSQLManager.hasSqlAccount(name, "username")) {
|
||||
response(session, RegistryResponse.CANNOT_CREATE);
|
||||
return;
|
||||
}
|
||||
SQLEntryHandler.write(new AccountRegister(details));
|
||||
response(session, RegistryResponse.SUCCESS);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
response(session, RegistryResponse.CANNOT_CREATE);
|
||||
return;
|
||||
}
|
||||
SQLEntryHandler.write(new AccountRegister(details));
|
||||
response(session, RegistryResponse.SUCCESS);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
response(session, RegistryResponse.CANNOT_CREATE);
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
System.err.println("Unhandled account registry opcode = " + opcode);
|
||||
break;
|
||||
});
|
||||
break;
|
||||
default:
|
||||
System.err.println("Unhandled account registry opcode = " + opcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +167,12 @@ public class AccountRegister extends SQLEntryHandler<RegistryDetails> {
|
|||
|
||||
//If the management server's settings register new users with the server's clan chat
|
||||
//I believe if there was no entry there would be errors during the registration, hence a null entry if the setting is off
|
||||
statement.setString(7, "2009scape");
|
||||
if(ServerConstants.NEW_PLAYER_DEFAULT_CLAN)
|
||||
{
|
||||
statement.setString(7,ServerConstants.SERVER_NAME);
|
||||
}else{
|
||||
statement.setString(7,null);
|
||||
}
|
||||
statement.executeUpdate();
|
||||
SQLManager.close(statement.getConnection());
|
||||
}
|
||||
|
|
@ -191,7 +196,7 @@ public class AccountRegister extends SQLEntryHandler<RegistryDetails> {
|
|||
return matcher.matches();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
return SQLManager.getConnection();
|
||||
|
|
|
|||
|
|
@ -1,25 +1,19 @@
|
|||
package plugin.dialogue;
|
||||
|
||||
import org.crandor.game.component.Component;
|
||||
import org.crandor.game.container.impl.EquipmentContainer;
|
||||
import org.crandor.game.content.dialogue.DialoguePlugin;
|
||||
import org.crandor.game.content.dialogue.FacialExpression;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.game.node.entity.player.link.appearance.Gender;
|
||||
|
||||
/**
|
||||
* Represents the dialogue plugin used for the hairdresser.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@InitializablePlugin
|
||||
public final class HairdresserDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Represents if were a male.
|
||||
*/
|
||||
private boolean male = true;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HairdresserDialogue} {@code Object}.
|
||||
|
|
@ -45,18 +39,32 @@ public final class HairdresserDialogue extends DialoguePlugin {
|
|||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
npc = (NPC) args[0];
|
||||
final String sex = male ? "sir" : "mam";
|
||||
if (player.getAppearance().getGender() == Gender.FEMALE) {
|
||||
male = false;
|
||||
}
|
||||
final String gender = player.isMale() ? "sir" : "madam";
|
||||
|
||||
//If the player right clicks the hairdresser and presses Hair-cut
|
||||
if (args.length == 2) {
|
||||
String man = male ? "men's" : "womens";
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Certainly " + sex + ". I cut " + man + " hair at the bargain rate of", "only 1000 gold coins. I'll even throw in a free recolour!");
|
||||
stage = 11;
|
||||
if (player.getInventory().contains(995, 2000) && player.getEquipment().get(EquipmentContainer.SLOT_HAT) == null &&
|
||||
player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) == null && player.getEquipment().get(EquipmentContainer.SLOT_SHIELD) == null) {
|
||||
if (player.isMale()) {
|
||||
player.getInterfaceManager().open(new Component(596));
|
||||
} else {
|
||||
player.getInterfaceManager().open(new Component(592));
|
||||
}
|
||||
}
|
||||
else if(player.getEquipment().get(EquipmentContainer.SLOT_HAT) != null || player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) != null || player.getEquipment().get(EquipmentContainer.SLOT_SHIELD) != null ) {
|
||||
/** NOT ACCURATE DIALOGUE **/
|
||||
interpreter.sendDialogues(npc, FacialExpression.SCARED, player.isMale() ? "Sir, " : "Madam, " + "I can't cut your hair with those things pointing","at me. Please take them off and speak to me again.");
|
||||
stage = 13;
|
||||
}else{ //Not enough money
|
||||
interpreter.sendDialogues(player, FacialExpression.SAD, "I don't have 2000 gold coins on me...");
|
||||
stage = 12;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Good afternoon " + sex + ". In need of a haircut are we?", male ? "Perhaps a shave too?" : "");
|
||||
|
||||
//If the player talks with the hairdresser
|
||||
npc = (NPC) args[0];
|
||||
interpreter.sendDialogues(npc, FacialExpression.NEUTRAL, "Good afternoon " + gender + ". In need of a haircut are we?", player.isMale() ? "Perhaps a shave too?" : "");
|
||||
stage = 1;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -64,95 +72,97 @@ public final class HairdresserDialogue extends DialoguePlugin {
|
|||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 1:
|
||||
if (male) {
|
||||
interpreter.sendOptions("Select an Option", "I'd like a haircut please.", "I'd like a shave please.", "No thank you.");
|
||||
stage = 2;
|
||||
} else {
|
||||
interpreter.sendOptions("Select an Option", "I'd like a haircut please.", "No thank you.");
|
||||
stage = 100;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (buttonId) {
|
||||
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'd like a haircut please.");
|
||||
stage = 10;
|
||||
if (player.isMale()) {
|
||||
interpreter.sendOptions("Select an Option", "I'd like a haircut please.", "I'd like a shave please.", "No thank you.");
|
||||
stage = 2;
|
||||
} else {
|
||||
interpreter.sendOptions("Select an Option", "I'd like a haircut please.", "No thank you.");
|
||||
stage = 5;
|
||||
}
|
||||
break;
|
||||
|
||||
//Male Option responses
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'd like a shave please.");
|
||||
stage = 20;
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.HAPPY, "I'd like a haircut please.");
|
||||
stage = 10;
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.HAPPY, "I'd like a shave please.");
|
||||
stage = 10;
|
||||
break;
|
||||
case 3:
|
||||
interpreter.sendDialogues(player, FacialExpression.NEUTRAL, "No thank you.");
|
||||
stage = 20;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No thank you.");
|
||||
stage = 30;
|
||||
|
||||
//Female Option responses
|
||||
case 5:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.HAPPY, "I'd like a haircut please.");
|
||||
stage = 10;
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.NEUTRAL, "No thank you.");
|
||||
stage = 20;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
String sex = male ? "sir" : "mam";
|
||||
String man = male ? "men's" : "womens";
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Certainly " + sex + ". I cut " + man + " hair at the bargain rate of", "only 1000 gold coins. I'll even throw in a free recolour!");
|
||||
stage = 11;
|
||||
break;
|
||||
case 11:
|
||||
if (player.getInventory().contains(995, 1000)) {
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Please select the hairstyle and colour you would like", "from this brochure.");
|
||||
stage = 14;
|
||||
} else {
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I don't have 1000 gold coins on me...");
|
||||
stage = 12;
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Well, come back when you do. I'm not running a", "charity here!");
|
||||
stage = 13;
|
||||
break;
|
||||
case 13:
|
||||
end();
|
||||
break;
|
||||
case 14:
|
||||
end();
|
||||
if (male) {
|
||||
player.getInterfaceManager().open(new Component(204));
|
||||
} else {
|
||||
player.getInterfaceManager().open(new Component(203));
|
||||
}
|
||||
break;
|
||||
case 30:
|
||||
end();
|
||||
break;
|
||||
case 100:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'd like a haircut please.");
|
||||
stage = 10;
|
||||
|
||||
//HairDresser Dialogues
|
||||
case 10:
|
||||
String gender = player.isMale() ? "sir" : "madam";
|
||||
String gender2 = player.isMale() ? "men's" : "women's";
|
||||
interpreter.sendDialogues(npc, FacialExpression.HAPPY, "Certainly " + gender + ". I cut " + gender2 + " hair at the bargain rate of", "only 2000 gold coins. I'll even throw in a free recolour!");
|
||||
stage++;
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No thank you.");
|
||||
stage = 30;
|
||||
case 11:
|
||||
if (player.getInventory().contains(995, 2000) && player.getEquipment().get(EquipmentContainer.SLOT_HAT) == null &&
|
||||
player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) == null && player.getEquipment().get(EquipmentContainer.SLOT_SHIELD) == null) {
|
||||
interpreter.sendDialogues(npc, FacialExpression.NEUTRAL, "Please select the hairstyle and colour you would like", "from this brochure.");
|
||||
stage = 14;
|
||||
}
|
||||
//Has helmet or sword/shield
|
||||
else if(player.getEquipment().get(EquipmentContainer.SLOT_HAT) != null || player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) != null || player.getEquipment().get(EquipmentContainer.SLOT_SHIELD) != null ) {
|
||||
/** NOT ACCURATE DIALOGUE **/
|
||||
interpreter.sendDialogues(npc, FacialExpression.SCARED, player.isMale() ? "Sir, " : "Madam, " + "I can't cut your hair with those things pointing","at me. Please take them off and speak to me again.");
|
||||
stage = 13;
|
||||
break;
|
||||
} else {
|
||||
interpreter.sendDialogues(player, FacialExpression.SAD, "I don't have 2000 gold coins on me...");
|
||||
stage = 12;
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
interpreter.sendDialogues(npc, FacialExpression.ANNOYED, "Well, come back when you do. I'm not running a", "charity here!");
|
||||
stage++;
|
||||
break;
|
||||
case 13:
|
||||
end();
|
||||
break;
|
||||
|
||||
//Opens the Hairstyle menu and ends the conversation
|
||||
case 14:
|
||||
end();
|
||||
if (player.isMale()) {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(596));
|
||||
} else {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(592));
|
||||
}
|
||||
break;
|
||||
|
||||
case 20:
|
||||
interpreter.sendDialogues(npc, FacialExpression.NEUTRAL, "Very well. Come back if you change your mind.");
|
||||
stage = 13;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
String sex1 = male ? "sir" : "mam";
|
||||
String man1 = male ? "men's" : "womens";
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Certainly " + sex1 + ". I cut " + man1 + " hair at the bargain rate of", "only 1000 gold coins. I'll even throw in a free recolour!");
|
||||
stage = 21;
|
||||
break;
|
||||
case 21:
|
||||
if (player.getInventory().contains(995, 1000)) {
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Please select the hairstyle and colour you would like", "from this brochure.");
|
||||
stage = 150;
|
||||
} else {
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I don't have 1000 gold coins on me...");
|
||||
stage = 12;
|
||||
}
|
||||
break;
|
||||
case 150:
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(199));
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,14 +6,16 @@ import org.crandor.game.node.entity.npc.NPC;
|
|||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
|
||||
|
||||
/**
|
||||
* Represents the dialogue plugin used for the hans npc.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@InitializablePlugin
|
||||
public final class HansDialoguePlugin extends DialoguePlugin {
|
||||
|
||||
private int[] timePlayed = new int[3];
|
||||
private int joinDateDays;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HansDialoguePlugin} {@code Object}.
|
||||
*/
|
||||
|
|
@ -39,7 +41,7 @@ public final class HansDialoguePlugin extends DialoguePlugin {
|
|||
@Override
|
||||
public boolean open(Object... args) {
|
||||
npc = (NPC) args[0];
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hello. What are you doing here?");
|
||||
interpreter.sendDialogues(npc, FacialExpression.NEUTRAL, "Hello. What are you doing here?");
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -48,55 +50,84 @@ public final class HansDialoguePlugin extends DialoguePlugin {
|
|||
public boolean handle(int interfaceId, int buttonId) {
|
||||
|
||||
switch (stage) {
|
||||
case 0:
|
||||
interpreter.sendOptions("Select an Option", "I'm looking for whoever is in charge of this place.", "I have come to kill everyone in this castle!", "I don't know. I'm lost. Where am I?", "Have you been here as long as me?");
|
||||
stage = 1;
|
||||
break;
|
||||
case 1:
|
||||
|
||||
switch (buttonId) {
|
||||
case 0:
|
||||
interpreter.sendOptions("Select an Option", "I'm looking for whoever is in charge of this place.", "I have come to kill everyone in this castle!", "I don't know. I'm lost. Where am I?", "Have you been here as long as me?");
|
||||
stage++;
|
||||
break;
|
||||
case 1:
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Who, the Duke? He's in his study, on the first floor.");
|
||||
stage = 10;
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
npc.moveStep();
|
||||
npc.sendChat("Help Help!");
|
||||
break;
|
||||
case 3:
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You are in Lumbridge Castle.");
|
||||
stage = 30;
|
||||
break;
|
||||
case 4:
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I've been patrolling this castle for years!");
|
||||
stage = 40;
|
||||
break;
|
||||
}
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(npc, FacialExpression.NEUTRAL, "Who, the Duke? He's in his study, on the first floor.");
|
||||
stage = 50;
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
//TODO:
|
||||
// Face the player and walk away from them (like moon walking?).
|
||||
// After a moment, return to normal pathing associated with HansNPC.java
|
||||
npc.sendChat("Help! Help!");
|
||||
break;
|
||||
case 3:
|
||||
interpreter.sendDialogues(npc, FacialExpression.NEUTRAL, "You are in Lumbridge Castle.");
|
||||
stage = 50;
|
||||
break;
|
||||
case 4:
|
||||
interpreter.sendDialogues(npc, FacialExpression.NEUTRAL, "I've been patrolling this castle for years!");
|
||||
stage = 40;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 40:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "You must be old then?");
|
||||
stage = 41;
|
||||
break;
|
||||
case 41:
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Haha, you could say I'm quite the veteran of these lands.", "Yes, I've been here a fair while...");
|
||||
stage = 42;
|
||||
break;
|
||||
case 42:
|
||||
end();
|
||||
break;
|
||||
case 10:
|
||||
end();
|
||||
break;
|
||||
case 30:
|
||||
end();
|
||||
break;
|
||||
break;
|
||||
case 40:
|
||||
interpreter.sendDialogues(player, FacialExpression.THINKING, "You must be old then?");
|
||||
stage++;
|
||||
break;
|
||||
case 41:
|
||||
interpreter.sendDialogues(npc, FacialExpression.LAUGH, "Haha, you could say I'm quite the veteran of these lands.", "Yes, I've been here a fair while...");
|
||||
stage++;
|
||||
break;
|
||||
case 42: //mixing OSRS here
|
||||
interpreter.sendDialogues(player, FacialExpression.ASKING, "Can you tell me how long I've been here?");
|
||||
stage++;
|
||||
break;
|
||||
case 43:
|
||||
interpreter.sendDialogues(npc, FacialExpression.FRIENDLY, "Ahh, I see all the newcomers arriving in Lumbridge, fresh-faced ","and eager for adventure. I remember you...");
|
||||
stage = 50;
|
||||
break;
|
||||
/*case 44:
|
||||
getTimePlayed();
|
||||
|
||||
//The text:
|
||||
//NOTE: it splits the text in different spots if the hours/minutes/days are 0 (because 0 days sounds weird, so it doesn't show it).
|
||||
|
||||
//You've spent [amount] days, [amount] hours, [amount] minutes in the world (NEXT LINE) since you arrived [amount] days ago.
|
||||
//You've spent [amount] (days/hours), [amount] (hours/minutes) in the world since (NEXT LINE) you arrived [amount] days ago.
|
||||
//You've spent [amount] (days/hours/minutes) in the world since you arrived (NEXT LINE) [amount] days ago.
|
||||
*/
|
||||
|
||||
//Closing Chat
|
||||
case 50:
|
||||
end();
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the player's join date and time played.
|
||||
*/
|
||||
private void getPlayerTime() {
|
||||
|
||||
//TODO:
|
||||
// Find the Date Joined and Time Played variables for the player WITHOUT directly connecting to the SQL database here
|
||||
// Split the Time Played variable into Days, Hours and Minutes
|
||||
// Insert each calculation into the timePlayed array ( 0 for Days, 1 for Hours and 2 for Minutes)
|
||||
// Calculate the Days Since registering by subtracting the Date Joined from the Current Server Date (ServerDate - Join_Date)
|
||||
// Insert the date difference into joinDateDays variable
|
||||
// return;???
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 0 };
|
||||
|
|
|
|||
|
|
@ -5,16 +5,13 @@ import org.crandor.game.content.dialogue.DialoguePlugin;
|
|||
import org.crandor.game.content.dialogue.FacialExpression;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.link.appearance.Gender;
|
||||
import org.crandor.game.node.entity.player.link.diary.DiaryType;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.game.world.map.RegionManager;
|
||||
|
||||
/**
|
||||
* Represents the thessalia dialogue plugin.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@InitializablePlugin
|
||||
public final class ThessaliaDialogue extends DialoguePlugin {
|
||||
|
||||
|
|
@ -42,178 +39,166 @@ public final class ThessaliaDialogue extends DialoguePlugin {
|
|||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
if (args.length == 2) {
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "Woah! Fabulous! You look absolutely great!");
|
||||
stage = 600;
|
||||
return true;
|
||||
} else if (args.length == 3) {
|
||||
interpreter.sendOptions("Select an Option", "I'd like to change my top please.", "I'd like to change my legwear please.", "I'd like to buy some clothes.", "No, thank you.");
|
||||
stage = 55;
|
||||
|
||||
//The trade argument is handled elsewhere
|
||||
if (args.length == 3) { //Right-Click 'Change-Clothes' Option
|
||||
if (player.getInventory().contains(995, 1000) && player.getEquipment().isEmpty()) {
|
||||
if (!player.getAchievementDiaryManager().getDiary(DiaryType.VARROCK).isComplete(0, 0)) {
|
||||
player.getAchievementDiaryManager().getDiary(DiaryType.VARROCK).updateTask(player, 0, 0, true);
|
||||
}
|
||||
if (player.isMale()) {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(591));
|
||||
} else {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(594));
|
||||
}
|
||||
}
|
||||
else if (!player.getInventory().contains(995, 1000)){ //Not enough money
|
||||
interpreter.sendDialogues(player, FacialExpression.SAD, "I don't have 1000 gold coins on me...");
|
||||
stage = 49;
|
||||
}
|
||||
else{ //Has some armour equipped
|
||||
interpreter.sendDialogues(548, FacialExpression.WORRIED, "You can't try them on while wearing armour. Take","it off and speak to me again.");
|
||||
stage = 52;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Default Talk
|
||||
npc = (NPC) args[0];
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "Would you like to buy any fine clothes?");
|
||||
interpreter.sendDialogues(548, FacialExpression.ASKING, "Would you like to buy any fine clothes?");
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
if (npc == null) {
|
||||
npc = RegionManager.getNpc(player, getIds()[0]);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0:
|
||||
interpreter.sendOptions("Choose an option:", "What do you have?", "No, thank you.");
|
||||
stage = 1;
|
||||
break;
|
||||
case 1:
|
||||
|
||||
switch (buttonId) {
|
||||
case 0:
|
||||
interpreter.sendOptions("Choose an option:", "What do you have?", "No, thank you.");
|
||||
stage++;
|
||||
break;
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "What do you have?");
|
||||
stage = 10;
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.ASKING, "What do you have?");
|
||||
stage = 10;
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.NEUTRAL, "No, thank you.");
|
||||
stage = 51;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No, thank you.");
|
||||
stage = 202;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 202:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "Well, please return if you change your mind.");
|
||||
stage = 203;
|
||||
break;
|
||||
case 203:
|
||||
end();
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 10:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "I have a number of fine pieces of clothing on sale or,", "if you prefer, I can offer you an exclusive", "total clothing makeover?");
|
||||
stage = 11;
|
||||
break;
|
||||
case 11:
|
||||
interpreter.sendOptions("Select an Option", "Tell me more about this makeover.", "I'd just like to buy some clothes.");
|
||||
stage = 12;
|
||||
break;
|
||||
case 12:
|
||||
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Tell me more about this makeover.");
|
||||
stage = 50;
|
||||
case 10:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "I have a number of fine pieces of clothing on sale or,", "if you prefer, I can offer you an exclusive", "total clothing makeover?");
|
||||
stage++;
|
||||
break;
|
||||
case 2:
|
||||
case 11:
|
||||
interpreter.sendOptions("Select an Option", "Tell me more about this makeover.", "I'd just like to buy some clothes.");
|
||||
stage++;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.THINKING, "Tell me more about this makeover.");
|
||||
stage = 20;
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.NEUTRAL, "I'd just like to buy some clothes.");
|
||||
stage = 50;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
//More about the makeover
|
||||
case 20:
|
||||
interpreter.sendDialogues(548, FacialExpression.HAPPY, "Certainly!");
|
||||
stage++;
|
||||
break;
|
||||
case 21:
|
||||
interpreter.sendDialogues(548, FacialExpression.HAPPY, "Here at Thessalia's fine clothing boutique, we offer a", "unique service where we will totally revamp your outfit", "to your choosing, for... wait for it...");
|
||||
stage++;
|
||||
break;
|
||||
case 22:
|
||||
interpreter.sendDialogues(548, FacialExpression.FRIENDLY, "A fee of only 500 gold coins! Tired of always wearing", "the same old outfit, day in, day out? This is the service", "for you!");
|
||||
stage++;
|
||||
break;
|
||||
case 23:
|
||||
interpreter.sendDialogues(548, FacialExpression.ASKING, "So what do you say? Interested? We can change either", "your top, or your legwear for only 500 gold a item!");
|
||||
stage++;
|
||||
break;
|
||||
|
||||
//Buying Clothes or changing outfit
|
||||
case 24:
|
||||
interpreter.sendOptions("Select an Option", "I'd like to change my outfit, please.", "I'd just like to buy some clothes.");
|
||||
stage++;
|
||||
break;
|
||||
case 25:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.HAPPY, "I'd like to change my outfit, please.");
|
||||
stage = 30;
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.NEUTRAL, "I'd just like to buy some clothes.");
|
||||
stage = 50;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
//Changing outfit code
|
||||
case 30:
|
||||
if(player.getEquipment().isEmpty()){
|
||||
interpreter.sendDialogues(548, FacialExpression.HAPPY, "Just select what style and colour you would like from", "this catalogue, and then give me the 1000 gold when", "you've picked.");
|
||||
stage++;
|
||||
break;
|
||||
} else { //Has some armour equipped
|
||||
interpreter.sendDialogues(548, FacialExpression.WORRIED, "You can't try them on while wearing armour. Take", "it off and speak to me again.");
|
||||
stage = 52;
|
||||
break;
|
||||
}
|
||||
case 31://Player has money and is not wearing armour/weapons
|
||||
if (player.getInventory().contains(995, 1000) && player.getEquipment().isEmpty()) {
|
||||
if (!player.getAchievementDiaryManager().getDiary(DiaryType.VARROCK).isComplete(0, 0)) {
|
||||
player.getAchievementDiaryManager().getDiary(DiaryType.VARROCK).updateTask(player, 0, 0, true);
|
||||
}
|
||||
if (player.isMale()) {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(591));
|
||||
} else {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(594));
|
||||
}
|
||||
}
|
||||
else{ //Not enough money
|
||||
interpreter.sendDialogues(player, FacialExpression.SAD, "I don't have 1000 gold coins on me...");
|
||||
stage = 49;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
//Closing Remarks
|
||||
case 49: //Not enough money
|
||||
interpreter.sendDialogues(548, FacialExpression.FRIENDLY, "That's ok! Just come back when you do have it!");
|
||||
stage = 52;
|
||||
break;
|
||||
|
||||
case 50://Just buying some clothes
|
||||
end();
|
||||
npc.openShop(player);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 50:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "Certainly!");
|
||||
stage = 51;
|
||||
break;
|
||||
case 51:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "Here at Thessalia's fine clothing boutique, we offer a", "unique service where we will totally revamp your outfit", "to your choosing, for... wait for it...");
|
||||
stage = 52;
|
||||
break;
|
||||
case 52:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "A fee of only 500 gold coins! Tired of always wearing", "the same old outfit, day in, day out? This is the service", "for you!");
|
||||
stage = 53;
|
||||
break;
|
||||
case 53:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "So what do you say? Interested? We can change either", "your top, or your legwear for only 500 gold a item!");
|
||||
stage = 54;
|
||||
break;
|
||||
case 54:
|
||||
interpreter.sendOptions("Select an Option", "I'd like to change my top please.", "I'd like to change my legwear please.", "I'd like to buy some clothes.", "No, thank you.");
|
||||
stage = 55;
|
||||
break;
|
||||
case 55:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'd like to change my top please.");
|
||||
stage = 100;
|
||||
|
||||
case 51://No Thanks
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "Well, please return if you change your mind.");
|
||||
stage++;
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'd like to change my legwear please.");
|
||||
stage = 110;
|
||||
case 52:
|
||||
end();
|
||||
break;
|
||||
case 3:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'd just like to buy some clothes.");
|
||||
stage = 120;
|
||||
break;
|
||||
case 4:
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No, thank you.");
|
||||
stage = 130;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 120:
|
||||
end();
|
||||
npc.openShop(player);
|
||||
break;
|
||||
case 130:
|
||||
end();
|
||||
break;
|
||||
case 110:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "Just select what style and colour you would like from", "this catalogue, and then give me the 500 gold when", "you've picked.");
|
||||
stage = 111;
|
||||
break;
|
||||
case 111:
|
||||
if (!player.getInventory().contains(995, 500)) {
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I don't have 500 gold on me...");
|
||||
stage = 105;
|
||||
break;
|
||||
} else {
|
||||
if (!player.getAchievementDiaryManager().getDiary(DiaryType.VARROCK).isComplete(0, 0)) {
|
||||
player.getAchievementDiaryManager().getDiary(DiaryType.VARROCK).updateTask(player, 0, 0, true);
|
||||
}
|
||||
if (player.getAppearance().getGender() == Gender.FEMALE) {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(201));
|
||||
} else {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(206));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "Just select what style and colour you would like from", "this catalogue, and then give me the 500 gold when", "you've picked.");
|
||||
stage = 101;
|
||||
break;
|
||||
case 101:
|
||||
// I don't have 500 gold on me...
|
||||
// that's ok! Just come back when you do have it!
|
||||
if (!player.getInventory().contains(995, 500)) {
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I don't have 500 gold on me...");
|
||||
stage = 105;
|
||||
break;
|
||||
} else {
|
||||
if (!player.getAchievementDiaryManager().getDiary(DiaryType.VARROCK).isComplete(0, 0)) {
|
||||
player.getAchievementDiaryManager().getDiary(DiaryType.VARROCK).updateTask(player, 0, 0, true);
|
||||
}
|
||||
if (player.getAppearance().getGender() == Gender.FEMALE) {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(202));
|
||||
} else {
|
||||
end();
|
||||
player.getInterfaceManager().open(new Component(207));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 105:
|
||||
interpreter.sendDialogues(548, FacialExpression.HALF_GUILTY, "That's ok! Just come back when you do have it!");
|
||||
stage = 106;
|
||||
break;
|
||||
case 106:
|
||||
end();
|
||||
break;
|
||||
case 600:
|
||||
end();
|
||||
player.getInterfaceManager().close();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package plugin.interaction.inter;
|
|||
import org.crandor.game.component.Component;
|
||||
import org.crandor.game.component.ComponentDefinition;
|
||||
import org.crandor.game.component.ComponentPlugin;
|
||||
import org.crandor.game.content.dialogue.FacialExpression;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
import org.crandor.game.world.update.flag.player.AppearanceFlag;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.plugin.Plugin;
|
||||
|
||||
|
|
@ -21,170 +21,144 @@ public final class HairInterfacePlugin extends ComponentPlugin {
|
|||
/**
|
||||
* Represents the coins item.
|
||||
*/
|
||||
private static final Item COINS = new Item(995, 1000);
|
||||
private static final Item COINS = new Item(995, 2000);
|
||||
|
||||
private static final int[] HAIR_COLORS = new int[] {20, 19, 10, 18, 4, 5, 15, 7, 0, 6, 21, 9, 22, 17, 8, 16, 11, 24, 23, 3, 2, 1, 14, 13, 12};
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(204, this);
|
||||
ComponentDefinition.put(203, this);
|
||||
ComponentDefinition.put(199, this);
|
||||
ComponentDefinition.put(592, this);
|
||||
ComponentDefinition.put(596, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
handle(player, button, component.getId() == 204 ? true : false, component.getId() == 199 ? new int[] { 1, 2 } : new int[] { 1 });
|
||||
//TODO: Have Changing Booth Animation Fall down and stay on the character. Outside of the OpCode because we don't want the animation repeating
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
if(player.isMale()){
|
||||
handleMaleInterfaceButtons(player, button);
|
||||
break;
|
||||
}else{
|
||||
handleFemaleInterfaceButtons(player, button);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the method used to handle the buttons.
|
||||
* Represents the method used to handle the buttons for the male hairdresser interface.
|
||||
* @param player the player.
|
||||
* @param button the button,
|
||||
* @param male the male.
|
||||
*/
|
||||
public static void handle(final Player player, int button, boolean male, int... inter) {
|
||||
if (inter != null && inter.length == 2) {
|
||||
int style = -1;
|
||||
int col = -1;
|
||||
switch (button) {
|
||||
case 139:
|
||||
style = 11;
|
||||
public static boolean handleMaleInterfaceButtons(Player player, int button) {
|
||||
|
||||
switch (button) {
|
||||
|
||||
//Male Hair Styles
|
||||
case 65: case 66: case 67: case 68: case 69:
|
||||
case 70: case 71: case 72: case 73:
|
||||
player.setAttribute("newHair", button-65);
|
||||
break;
|
||||
case 140:
|
||||
style = 10;
|
||||
case 74: case 75: case 76: case 77: case 78: case 79: case 80:
|
||||
player.setAttribute("newHair", button+17);
|
||||
break;
|
||||
case 141:
|
||||
style = 13;
|
||||
case 81: case 82: case 83: case 84: case 85: case 86:
|
||||
player.setAttribute("newHair", button+180);
|
||||
break;
|
||||
case 142:
|
||||
style = 15;
|
||||
case 89: case 90:
|
||||
player.setAttribute("newHair", button+178);
|
||||
break;
|
||||
case 143:
|
||||
style = 17;
|
||||
|
||||
//Male Hair Colour Styles
|
||||
//As the array is not ordered (because of the customization menu),
|
||||
//I just copied the array over until a better solution could be thought of.
|
||||
case 229: case 230: case 231: case 232: case 233:
|
||||
case 234: case 235: case 236: case 237: case 238:
|
||||
case 239: case 240: case 241: case 242: case 243:
|
||||
case 244: case 245: case 246: case 247: case 248:
|
||||
case 249: case 250: case 251: case 252: case 253:
|
||||
player.setAttribute("newHairColour", HAIR_COLORS[button - 229]);
|
||||
break;
|
||||
case 144:
|
||||
style = 12;
|
||||
|
||||
//Male Beard Styles
|
||||
case 105: case 106: case 107: case 108: case 109:
|
||||
case 110: case 111: case 112:
|
||||
player.setAttribute("newBeard", button-95);
|
||||
break;
|
||||
case 145:
|
||||
style = 14;
|
||||
case 113: case 114: case 115: case 116: case 117:
|
||||
case 118: case 119:
|
||||
player.setAttribute("newBeard", button-15);
|
||||
break;
|
||||
case 146:
|
||||
style = 16;
|
||||
case 120:
|
||||
player.setAttribute("newBeard", button+185);
|
||||
break;
|
||||
case 127:
|
||||
col = 0;
|
||||
break;
|
||||
case 128:
|
||||
col = 1;
|
||||
break;
|
||||
case 129:
|
||||
col = 2;
|
||||
break;
|
||||
case 130:
|
||||
col = 3;
|
||||
break;
|
||||
case 131:
|
||||
col = 4;
|
||||
break;
|
||||
case 132:
|
||||
col = 5;
|
||||
break;
|
||||
case 133:
|
||||
col = 6;
|
||||
break;
|
||||
case 134:
|
||||
col = 7;
|
||||
break;
|
||||
case 135:
|
||||
col = 8;
|
||||
break;
|
||||
case 136:
|
||||
col = 9;
|
||||
break;
|
||||
case 137:
|
||||
col = 10;
|
||||
break;
|
||||
case 138:
|
||||
col = 11;
|
||||
break;
|
||||
case 104:
|
||||
confirm(player);
|
||||
/** confirms the players choice on design. */
|
||||
break;
|
||||
}
|
||||
if (style != -1) {
|
||||
player.setAttribute("newBeard", style);
|
||||
}
|
||||
if (col != -1) {
|
||||
player.setAttribute("newHairColour", col);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (male) {
|
||||
switch (button) {
|
||||
case 134:
|
||||
case 135:
|
||||
case 136:
|
||||
case 137:
|
||||
case 138:
|
||||
case 139:
|
||||
case 140:
|
||||
case 141:
|
||||
case 142:
|
||||
player.setAttribute("newHair", button - 134);
|
||||
break;
|
||||
case 122:
|
||||
case 123:
|
||||
case 124:
|
||||
case 125:
|
||||
player.setAttribute("newBeard", button+183);
|
||||
break;
|
||||
case 126:
|
||||
case 127:
|
||||
case 128:
|
||||
player.setAttribute("newBeard", button+181);
|
||||
break;
|
||||
case 129:
|
||||
case 130:
|
||||
case 131:
|
||||
case 132:
|
||||
case 133:
|
||||
player.setAttribute("newHairColour", button - 122);
|
||||
player.setAttribute("newBeard", button+179);
|
||||
break;
|
||||
case 98:
|
||||
|
||||
//Confirm Buttons
|
||||
case 196: //cash bag
|
||||
case 274: //The thumbs up
|
||||
confirm(player);
|
||||
/** confirms the players choice on design. **/
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (button) {
|
||||
case 136:
|
||||
case 137:
|
||||
case 138:
|
||||
case 139:
|
||||
case 140:
|
||||
case 141:
|
||||
case 142:
|
||||
case 143:
|
||||
case 144:
|
||||
case 145:
|
||||
player.setAttribute("newHair", button - 91);
|
||||
break;
|
||||
case 124:
|
||||
case 125:
|
||||
case 126:
|
||||
case 127:
|
||||
case 128:
|
||||
case 129:
|
||||
case 130:
|
||||
case 131:
|
||||
case 132:
|
||||
case 133:
|
||||
case 134:
|
||||
case 135:
|
||||
player.setAttribute("newHairColour", button - 124);
|
||||
break;
|
||||
case 99:
|
||||
confirm(player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the method used to handle the buttons for the female hairdresser interface.
|
||||
* @param player the player.
|
||||
* @param button the button,
|
||||
*/
|
||||
public static boolean handleFemaleInterfaceButtons(Player player, int button) {
|
||||
|
||||
switch (button) {
|
||||
|
||||
//Female Hair Styles
|
||||
case 148: case 149: case 150: case 151: case 152:
|
||||
case 153: case 154: case 155: case 156: case 157:
|
||||
player.setAttribute("newHair", button-103);
|
||||
break;
|
||||
case 158: case 159: case 160: case 161: case 162:
|
||||
case 163: case 164: case 165: case 166: case 167:
|
||||
case 168: case 169:
|
||||
player.setAttribute("newHair", button-23);
|
||||
break;
|
||||
case 170: case 171: case 172: case 173: case 174:
|
||||
case 175: case 176: case 177: case 178: case 179:
|
||||
case 180: case 181:
|
||||
player.setAttribute("newHair", button+99);
|
||||
break;
|
||||
|
||||
//Female Hair Colour Styles
|
||||
//Unfortunately no 'fancy' calculations I can think of due to the array in CharacterDesign.java
|
||||
//I just copied the array over until a better solution could be thought of.
|
||||
case 73: case 74: case 75: case 76: case 77:
|
||||
case 78: case 79: case 80: case 81: case 82:
|
||||
case 83: case 84: case 85: case 86: case 87:
|
||||
case 88: case 89: case 90: case 91: case 92:
|
||||
case 93: case 94: case 95: case 96: case 97:
|
||||
player.setAttribute("newHairColour", HAIR_COLORS[button-73]);
|
||||
break;
|
||||
|
||||
//Confirm buttons
|
||||
case 68: //cash bag
|
||||
case 100: //The thumbs up
|
||||
confirm(player);
|
||||
/** confirms the players choice on design. **/
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -195,6 +169,8 @@ public final class HairInterfacePlugin extends ComponentPlugin {
|
|||
if (!player.getInventory().containsItem(COINS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Sets the player look
|
||||
if (player.getInventory().remove(COINS)) {
|
||||
if (player.getAttribute("newHair") != null) {
|
||||
player.getAppearance().getHair().changeLook((Integer) player.getAttribute("newHair"));
|
||||
|
|
@ -205,9 +181,12 @@ public final class HairInterfacePlugin extends ComponentPlugin {
|
|||
if (player.getAttribute("newBeard") != null) {
|
||||
player.getAppearance().getBeard().changeLook((Integer) player.getAttribute("newBeard"));
|
||||
}
|
||||
player.getUpdateMasks().register(new AppearanceFlag(player));
|
||||
|
||||
//Updates the Player Look, Closes the interface, and farewell from the Hairdresser
|
||||
player.getAppearance().sync();
|
||||
player.getInterfaceManager().close();
|
||||
player.getDialogueInterpreter().sendDialogues(Repository.findNPC(598), null, "Hope you like the new do!");
|
||||
//TODO: Remove Changing Booth graphic and switch to Changing Booth disappearing animation. Needs to also work if player clicks away
|
||||
player.getDialogueInterpreter().sendDialogues(Repository.findNPC(598), FacialExpression.HAPPY, "Hope you like the new do!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@ package plugin.interaction.inter;
|
|||
import org.crandor.game.component.Component;
|
||||
import org.crandor.game.component.ComponentDefinition;
|
||||
import org.crandor.game.component.ComponentPlugin;
|
||||
import org.crandor.game.content.dialogue.FacialExpression;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the interface plugin to handle thessalia interfaces.
|
||||
* @author Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@InitializablePlugin
|
||||
public final class ThessaliaInterface extends ComponentPlugin {
|
||||
|
|
@ -19,227 +19,226 @@ public final class ThessaliaInterface extends ComponentPlugin {
|
|||
/**
|
||||
* Represents the coins item.
|
||||
*/
|
||||
private static final Item COINS = new Item(995, 500);
|
||||
private static final Item COINS = new Item(995, 1000);
|
||||
|
||||
//Since the order of the clothing is different in the initial character creation menu, we have to reorder the arrays
|
||||
// It's possible to reorder the actual legs, arms and chest IDs in characterdesign.java, but it's probably best to keep them independent.
|
||||
private static final int[] TORSO_COLORS = new int[] {24, 23, 2, 22, 12, 11, 6, 19, 4, 0, 9, 13, 25, 8, 15, 26, 21, 7, 20, 14, 10, 28, 27, 3, 5, 18, 17, 1, 16};
|
||||
private static final int[] LEG_COLORS = new int[] {26, 24, 23, 3, 22, 13, 12, 7, 19, 5, 1, 10, 14, 25, 9, 0, 21, 8, 20, 15, 11, 28, 27, 4, 6, 18, 17, 2, 16};
|
||||
|
||||
private static final int[] MALE_TORSO_IDS = {111, 113, 114, 115, 112, 116, 18, 19, 20, 21, 22, 23, 24, 25};
|
||||
private static final int[] MALE_ARMS_IDS = {105, 108, 106, 107, 109, 110, 28, 26, 27, 29, 30, 31};
|
||||
private static final int[] MALE_LEGS_IDS = {36, 85, 37, 89, 90, 40, 86, 88, 39, 38, 87};
|
||||
|
||||
private static final int[] FEMALE_TORSO_IDS = {153, 155, 156, 157, 154, 158, 56, 57, 58, 59, 60};
|
||||
private static final int[] FEMALE_ARMS_IDS = {147, 150, 148, 149, 151, 152, 64, 61, 63, 65, 62};
|
||||
private static final int[] FEMALE_LEGS_IDS = {129, 130, 128, 74, 133, 134, 77, 131, 132, 75, 73, 76, 72, 70, 71}; //ID 71 is called shorts in game but is actually a skirt (In older menu too, Jagex Logic?)
|
||||
|
||||
//Default ID for Clothing Category (Torso, Arms, Legs). Used for Recolouring later.
|
||||
private static int categorySelection;
|
||||
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(201, this);
|
||||
ComponentDefinition.put(202, this);
|
||||
ComponentDefinition.put(206, this);
|
||||
ComponentDefinition.put(207, this);
|
||||
ComponentDefinition.put(591, this);
|
||||
ComponentDefinition.put(594, this);
|
||||
categorySelection = 182; //Resets the Category Selection (in case of gender change/last category change) everytime the menu is accessed
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
switch (component.getId()) {
|
||||
case 207:
|
||||
switch (button) {
|
||||
case 157:
|
||||
case 158:
|
||||
player.setAttribute("newBody", button - 139);
|
||||
break;
|
||||
case 159:
|
||||
case 161:
|
||||
case 163:
|
||||
player.setAttribute("newBody", button - 138);
|
||||
break;
|
||||
case 160:
|
||||
case 162:
|
||||
player.setAttribute("newBody", button - 140);
|
||||
break;
|
||||
case 164:
|
||||
case 165:
|
||||
case 166:
|
||||
case 167:
|
||||
case 168:
|
||||
case 169:
|
||||
player.setAttribute("newArms", button - 138);
|
||||
break;
|
||||
case 90:
|
||||
case 91:
|
||||
case 92:
|
||||
case 93:
|
||||
case 94:
|
||||
case 95:
|
||||
case 96:
|
||||
case 97:
|
||||
case 98:
|
||||
case 99:
|
||||
case 100:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 104:
|
||||
case 105:
|
||||
player.setAttribute("newBodyColour", button - 90);
|
||||
break;
|
||||
case 106:
|
||||
if (!player.getInventory().containsItem(COINS)) {
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().remove(COINS)) {
|
||||
if (player.getAttribute("newBody") != null) {
|
||||
player.getAppearance().getTorso().changeLook((Integer) player.getAttribute("newBody"));
|
||||
}
|
||||
if (player.getAttribute("newArms") != null) {
|
||||
player.getAppearance().getArms().changeLook((Integer) player.getAttribute("newArms"));
|
||||
}
|
||||
if (player.getAttribute("newBodyColour") != null) {
|
||||
player.getAppearance().getTorso().changeColor((Integer) player.getAttribute("newBodyColour"));
|
||||
}
|
||||
player.getAppearance().sync();
|
||||
player.getInterfaceManager().close();
|
||||
player.getDialogueInterpreter().open(548, true, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 206:// male leg
|
||||
switch (button) {
|
||||
case 128:
|
||||
case 129:
|
||||
case 130:
|
||||
case 131:
|
||||
player.setAttribute("newLegs", button - 92);
|
||||
break;
|
||||
case 105:
|
||||
player.setAttribute("newLegsColour", button - 105);
|
||||
break;
|
||||
case 90:
|
||||
case 91:
|
||||
case 92:
|
||||
case 93:
|
||||
case 94:
|
||||
case 95:
|
||||
case 96:
|
||||
case 97:
|
||||
case 98:
|
||||
case 99:
|
||||
case 100:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 104:
|
||||
player.setAttribute("newLegsColour", button - 89);
|
||||
break;
|
||||
case 106:
|
||||
if (player.getInventory().remove(COINS)) {
|
||||
if (player.getAttribute("newLegs") != null) {
|
||||
player.getAppearance().getLegs().changeLook((Integer) player.getAttribute("newLegs"));
|
||||
}
|
||||
if (player.getAttribute("newLegsColour") != null) {
|
||||
player.getAppearance().getLegs().changeColor((Integer) player.getAttribute("newLegsColour"));
|
||||
}
|
||||
player.getAppearance().sync();
|
||||
player.getInterfaceManager().close();
|
||||
player.getDialogueInterpreter().open(548, true, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 202:
|
||||
switch (button) {
|
||||
case 146:
|
||||
case 147:
|
||||
case 148:
|
||||
case 149:
|
||||
case 150:
|
||||
player.setAttribute("newBody", button - 90);
|
||||
break;
|
||||
case 151:
|
||||
case 152:
|
||||
case 153:
|
||||
case 154:
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
player.setAttribute("newArms", button - 90);
|
||||
break;
|
||||
case 90:
|
||||
case 91:
|
||||
case 92:
|
||||
case 93:
|
||||
case 94:
|
||||
case 95:
|
||||
case 96:
|
||||
case 97:
|
||||
case 98:
|
||||
case 99:
|
||||
case 100:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 104:
|
||||
case 105:
|
||||
player.setAttribute("newBodyColour", button - 90);
|
||||
break;
|
||||
case 106:
|
||||
if (player.getInventory().remove(COINS)) {
|
||||
if (player.getAttribute("newBody") != null) {
|
||||
player.getAppearance().getTorso().changeLook((Integer) player.getAttribute("newBody"));
|
||||
}
|
||||
if (player.getAttribute("newArms") != null) {
|
||||
player.getAppearance().getArms().changeLook((Integer) player.getAttribute("newArms"));
|
||||
}
|
||||
if (player.getAttribute("newBodyColour") != null) {
|
||||
player.getAppearance().getTorso().changeColor((Integer) player.getAttribute("newBodyColour"));
|
||||
}
|
||||
player.getAppearance().sync();
|
||||
player.getInterfaceManager().close();
|
||||
player.getDialogueInterpreter().open(548, true, true);
|
||||
if(player.isMale()){
|
||||
handleMaleInterfaceButtons(player, button);
|
||||
break;
|
||||
}else{
|
||||
handleFemaleInterfaceButtons(player, button);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 201:
|
||||
switch (button) {
|
||||
case 201:
|
||||
case 131:
|
||||
case 132:
|
||||
case 133:
|
||||
case 134:
|
||||
case 135:
|
||||
player.setAttribute("newLegs", button - 61);
|
||||
break;
|
||||
case 136:
|
||||
case 137:
|
||||
player.setAttribute("newLegs", button - 60);
|
||||
break;
|
||||
case 105:
|
||||
player.setAttribute("newLegsColour", button - 105);
|
||||
break;
|
||||
case 90:
|
||||
case 91:
|
||||
case 92:
|
||||
case 93:
|
||||
case 94:
|
||||
case 95:
|
||||
case 96:
|
||||
case 97:
|
||||
case 98:
|
||||
case 99:
|
||||
case 100:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 104:
|
||||
player.setAttribute("newLegsColour", button - 89);
|
||||
break;
|
||||
case 106:
|
||||
if (player.getInventory().remove(COINS)) {
|
||||
if (player.getAttribute("newLegs") != null) {
|
||||
player.getAppearance().getLegs().changeLook((Integer) player.getAttribute("newLegs"));
|
||||
}
|
||||
if (player.getAttribute("newLegsColour") != null) {
|
||||
player.getAppearance().getLegs().changeColor((Integer) player.getAttribute("newLegsColour"));
|
||||
}
|
||||
player.getAppearance().sync();
|
||||
player.getInterfaceManager().close();
|
||||
player.getDialogueInterpreter().open(548, true, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the interface buttons for a male player
|
||||
* @param player the player.
|
||||
* @param button the button id in the interface
|
||||
**/
|
||||
private static boolean handleMaleInterfaceButtons(Player player, int button) {
|
||||
switch(button){
|
||||
|
||||
//Top Styles
|
||||
case 185: case 186: case 187: case 188:
|
||||
case 189: case 190: case 191: case 192:
|
||||
case 193: case 194: case 195: case 196:
|
||||
case 197: case 198:
|
||||
player.setAttribute("newTorso", MALE_TORSO_IDS[button-185]);
|
||||
break;
|
||||
|
||||
//Arms Styles
|
||||
case 199: case 200: case 201: case 202:
|
||||
case 203: case 204: case 205: case 206:
|
||||
case 207: case 208: case 209: case 210:
|
||||
player.setAttribute("newArms", MALE_ARMS_IDS[button-199]);
|
||||
break;
|
||||
|
||||
//Legs Styles
|
||||
case 211: case 212: case 213: case 214:
|
||||
case 215: case 216: case 217: case 218:
|
||||
case 219: case 220: case 221:
|
||||
player.setAttribute("newLegs", MALE_LEGS_IDS[button-211]);
|
||||
break;
|
||||
|
||||
//Clothing Colour Buttons
|
||||
case 252: case 253: case 254: case 255: case 256:
|
||||
case 257: case 258: case 269: case 260: case 261:
|
||||
case 262: case 263: case 264: case 265: case 266:
|
||||
case 267: case 268: case 279: case 270: case 271:
|
||||
case 272: case 273: case 274: case 275: case 276:
|
||||
case 277: case 278: case 289: case 280:
|
||||
changeClothingColour(player, categorySelection, button);
|
||||
break;
|
||||
|
||||
//Are they selecting Tops, Arms, or Pants? Needed for Recolouring
|
||||
case 182:
|
||||
categorySelection = 182;
|
||||
break;
|
||||
case 183:
|
||||
categorySelection = 183;
|
||||
break;
|
||||
case 184:
|
||||
categorySelection = 184;
|
||||
break;
|
||||
|
||||
//Confirm Buttons
|
||||
case 180:
|
||||
case 297:
|
||||
confirm(player);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the interface buttons for a Female player
|
||||
* @param player the player.
|
||||
* @param button the button id in the interface
|
||||
**/
|
||||
private static boolean handleFemaleInterfaceButtons(Player player, int button) {
|
||||
switch(button){
|
||||
|
||||
//Top Styles
|
||||
case 186: case 187: case 188: case 189:
|
||||
case 190: case 191: case 192: case 193:
|
||||
case 194: case 195: case 196:
|
||||
player.setAttribute("newTorso", FEMALE_TORSO_IDS[button-186]);
|
||||
break;
|
||||
|
||||
//Arms Styles
|
||||
case 197: case 198: case 199: case 200:
|
||||
case 201: case 202: case 203: case 204:
|
||||
case 205: case 206: case 207:
|
||||
player.setAttribute("newArms", FEMALE_ARMS_IDS[button-197]);
|
||||
break;
|
||||
|
||||
//Legs Styles
|
||||
case 208: case 209: case 210: case 211:
|
||||
case 212: case 213: case 214: case 215:
|
||||
case 216: case 217: case 218: case 219:
|
||||
case 220: case 221: case 222:
|
||||
player.setAttribute("newLegs", FEMALE_LEGS_IDS[button-208]);
|
||||
break;
|
||||
|
||||
//Clothing Colour Buttons
|
||||
case 253: case 254: case 255: case 256: case 257:
|
||||
case 258: case 259: case 260: case 261: case 262:
|
||||
case 263: case 264: case 265: case 266: case 267:
|
||||
case 268: case 269: case 270: case 271: case 272:
|
||||
case 273: case 274: case 275: case 276: case 277:
|
||||
case 278: case 279: case 280: case 281:
|
||||
changeClothingColour(player, categorySelection, button);
|
||||
break;
|
||||
|
||||
//Are they selecting Tops, Arms, or Pants? Needed for Recolouring
|
||||
case 183:
|
||||
categorySelection = 183;
|
||||
break;
|
||||
case 184:
|
||||
categorySelection = 184;
|
||||
break;
|
||||
case 185:
|
||||
categorySelection = 185;
|
||||
break;
|
||||
|
||||
//Confirm buttons
|
||||
case 181:
|
||||
case 298:
|
||||
confirm(player);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes Torso or Leg Colour depending on the value of the category selected
|
||||
* @param player the player.
|
||||
* @param categorySelection the category button (arms/legs/torso) chosen by the player for recolouring.\
|
||||
* @param button the button id of the colour chosen
|
||||
*/
|
||||
private static void changeClothingColour(Player player, int categorySelection, int button) {
|
||||
//Male Recolours, have to check if male because of button id overlap
|
||||
if((categorySelection == 182 || categorySelection == 183) && player.isMale()){
|
||||
player.setAttribute("newTorsoColour", TORSO_COLORS[button-252]);
|
||||
}
|
||||
else if(categorySelection == 184 && player.isMale()){
|
||||
player.setAttribute("newLegsColour", LEG_COLORS[button-252]);
|
||||
}
|
||||
|
||||
//Female Recolours, have to check if male because of button id overlap
|
||||
//because of overlap, we have to include 182 in case the player never clicks on one of the category buttons
|
||||
//the player.isMale() == false check should prevent any bugs arising from this...?
|
||||
if((categorySelection == 182 || categorySelection == 183 || categorySelection == 184) && player.isMale() == false){
|
||||
player.setAttribute("newTorsoColour", TORSO_COLORS[button-253]);
|
||||
}
|
||||
else if(categorySelection == 185 && player.isMale() == false){
|
||||
player.setAttribute("newLegsColour", LEG_COLORS[button-253]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The accepting of your new style.
|
||||
* @param player the player.
|
||||
*/
|
||||
public static void confirm(Player player) {
|
||||
if (!player.getInventory().containsItem(COINS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Sets the player look
|
||||
if (player.getInventory().remove(COINS)) {
|
||||
if (player.getAttribute("newTorso") != null) {
|
||||
player.getAppearance().getTorso().changeLook((Integer) player.getAttribute("newTorso"));
|
||||
}
|
||||
if (player.getAttribute("newArms") != null) {
|
||||
player.getAppearance().getArms().changeLook((Integer) player.getAttribute("newArms"));
|
||||
}
|
||||
if (player.getAttribute("newLegs") != null) {
|
||||
player.getAppearance().getLegs().changeLook((Integer) player.getAttribute("newLegs"));
|
||||
}
|
||||
if (player.getAttribute("newTorsoColour") != null) {
|
||||
player.getAppearance().getTorso().changeColor((Integer) player.getAttribute("newTorsoColour"));
|
||||
}
|
||||
if (player.getAttribute("newLegsColour") != null) {
|
||||
player.getAppearance().getLegs().changeColor((Integer) player.getAttribute("newLegsColour"));
|
||||
}
|
||||
|
||||
//Updates the Player Look, Closes the interface, and farewell from Thessalia
|
||||
player.getAppearance().sync();
|
||||
player.getInterfaceManager().close();
|
||||
//TODO: Remove Changing Booth graphic and switch to Changing Booth disappearing animation. Needs to also work if player clicks away
|
||||
player.getDialogueInterpreter().sendDialogues(Repository.findNPC(548), FacialExpression.AMAZED, "Woah! Fabulous! You look absolutely great!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public final class HansNPC extends AbstractNPC {
|
|||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[1];
|
||||
return new int[] { 0 };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -62,5 +62,4 @@ public final class HansNPC extends AbstractNPC {
|
|||
init();
|
||||
return super.newInstance(arg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue