package com.rs.game.player.dialogues.impl;

import com.rs.cache.loaders.NPCDefinitions;
import com.rs.game.player.dialogues.Dialogue;
import com.rs.game.player.content.PlayerLook;

public class SkinColorChanger extends Dialogue {

	private int npcId;

	
	
	@Override
	public void start() {
		npcId = (Integer) parameters[0];
		sendEntityDialogue(SEND_2_TEXT_CHAT,
				new String[] { NPCDefinitions.getNPCDefinitions(npcId).name,
						"Hello, I can change your skin color if you'd like,",
						" would you like to?" }, IS_NPC, npcId, 9827);
	}

	@Override
	public void run(int interfaceId, int componentId) {
		if (stage == -1) {
			sendEntityDialogue(SEND_1_TEXT_CHAT, new String[] { player.getDisplayName(), "um, why not?" }, IS_PLAYER, player.getIndex(), 9827);
			stage = 1;
		} else if (stage == 1) {
			sendOptionsDialogue("Select A Skin Color Number", "Skin Color 1.", "Skin Color 2.", "Skin Color 3.", "Skin Color 4.", "More Skin Options...");
			stage = 2;
		} else if (stage == 2) {
			if (componentId == OPTION_1) {
				player.getAppearence().setSkinColor(1);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_2) {
				player.getAppearence().setSkinColor(2);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_3) {
				player.getAppearence().setSkinColor(3);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_4) {
				player.getAppearence().setSkinColor(4);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_5) {
				stage = 3;
				sendOptionsDialogue("Select A Skin Color Number", "Skin Color 5.", "Skin Color 6.", "Skin Color 7.", "Skin Color 8.", "More Skin Options...");
			}
		} else if (stage == 3) {
			if (componentId == OPTION_1) {
				player.getAppearence().setSkinColor(5);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_2) {
				player.getAppearence().setSkinColor(6);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_3) {
				player.getAppearence().setSkinColor(7);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_4) {
				player.getAppearence().setSkinColor(8);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_5) {
			    sendOptionsDialogue("Select A Skin Color Number", "Skin Color 9.", "Skin Color 10.", "Skin Color 11.", "Skin Color 12.", "More Skin Options...");
				stage = 4;
			}
		} else if (stage == 4) {
			if (componentId == OPTION_1) {
				player.getAppearence().setSkinColor(9);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_2) {
				player.getAppearence().setSkinColor(10);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_3) {
				player.getAppearence().setSkinColor(11);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_4) {
				player.getAppearence().setSkinColor(12);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_5) {
			    sendOptionsDialogue("Select A Skin Color Number", "Lime Skin.", "Pale Blue Skin.", "Purple Skin.", "Hot Pink Skin.", "More Skin Options...");
				stage = 5;
			}
		} else if (stage == 5) {
			if (componentId == OPTION_1) {
				player.getAppearence().setSkinColor(14);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_2) {
				player.getAppearence().setSkinColor(16);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_3) {
				player.getAppearence().setSkinColor(17);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_4) {
				player.getAppearence().setSkinColor(18);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_5) {
			    sendOptionsDialogue("Select A Skin Color Number", "Mint Skin.", "Blue Skin.", "Green Skin.", "Gender Change.", "More Skin Options...");
				stage = 6;
			}
		} else if (stage == 6) {
			if (componentId == OPTION_1) {
				player.getAppearence().setSkinColor(29);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_2) {
				player.getAppearence().setSkinColor(12);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_3) {
				player.getAppearence().setSkinColor(13);
				player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			} else if (componentId == OPTION_4) {
			    	sendOptionsDialogue("Select A Gender", "Male", "Female", "Back To Skin Options...");
			    	stage = 7;
			} else if (componentId == OPTION_5) {
			    sendOptionsDialogue("Select A Skin Color Number", "Skin Color 1.", "Skin Color 2.", "Skin Color 3.", "Skin Color 4.", "More Skin Options...");
				stage = 2;
			}
			
		} else if (stage == 7) {
		if(componentId == OPTION_1) {
			player.getAppearence().male();
			player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			}
		if(componentId == OPTION_2) {
			player.getAppearence().female();
			player.getAppearence().generateAppearenceData();
			player.closeInterfaces();
			}
		if(componentId == OPTION_3) {
		    sendOptionsDialogue("Select A Skin Color Number", "Skin Color 1.", "Skin Color 2.", "Skin Color 3.", "Skin Color 4.", "More Skin Options...");
			stage = 2;
			}
		}
	}
	
	@Override
	public void finish() {
		// TODO Auto-generated method stub

	}
}
