Files
sweetgum-server/scripts/npc/1043003.js

189 lines
6.9 KiB
JavaScript

var status = 0;
var service = -1; // 0 = plastic surgery (face), 1 = eye color change
var facePrice = 1000000;
var eyePrice = 50000;
/* ── PLASTIC SURGERY ─────────────────────────────────────────── */
var selectedCategory = -1;
var facenew = Array();
/*
FACE CATEGORIES
classic (20xxx / 21xxx): original MapleStory male & female faces — 163 faces
royal (23xxx / 24xxx): newer cash-shop faces — 131 faces
modern (25xxx / 26xxx): most recent additions — 25 faces
Only base (black) IDs are stored here. Players keep their chosen
base face; color can be changed separately via the eye color option.
*/
var classicFaces = Array(
20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007,
20008, 20009, 20010, 20011, 20012, 20013, 20014, 20015,
20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023,
20024, 20025, 20026, 20027, 20028, 20029, 20030, 20031,
20032, 20035, 20036, 20037, 20038, 20040, 20043, 20044,
20045, 20046, 20047, 20048, 20049, 20050, 20052, 20053,
20054, 20055, 20056, 20057, 20058, 20059, 20060, 20061,
20062, 20063, 20064, 20065, 20066, 20067, 20068, 20069,
20070, 20073, 20074, 20075, 20076, 20077, 20078, 20080,
20081, 20082, 20083, 20084, 20085, 20086, 20087, 20088,
20091, 20092, 20093, 21000, 21001, 21002, 21003, 21004,
21005, 21006, 21007, 21008, 21009, 21010, 21011, 21012,
21013, 21014, 21015, 21016, 21017, 21018, 21019, 21020,
21021, 21022, 21023, 21024, 21025, 21026, 21027, 21028,
21029, 21030, 21031, 21033, 21034, 21035, 21036, 21037,
21038, 21041, 21042, 21043, 21044, 21045, 21046, 21047,
21048, 21049, 21052, 21053, 21054, 21055, 21056, 21057,
21058, 21059, 21060, 21061, 21062, 21063, 21064, 21065,
21068, 21069, 21070, 21071, 21072, 21073, 21074, 21075,
21076, 21077, 21078, 21080, 21081, 21082, 21083, 21084,
21085, 21087, 21088
);
var royalFaces = Array(
23006, 23008,
23009, 23010, 23011, 23012, 23013, 23014, 23016, 23017,
23019, 23020, 23023, 23024, 23025, 23028, 23029, 23030,
23031, 23032, 23033, 23034, 23035, 23038, 23039, 23040,
23041, 23042, 23043, 23053, 23055, 23056, 23057, 23059,
23060, 23061, 23065, 23066, 23068, 23069, 23070, 23072,
23073, 23074, 23075, 23076, 23079, 23081, 23084, 23085,
23086, 23087, 23088, 23089, 23090, 23092, 23094, 23095,
23096, 23097, 24001, 24002, 24003, 24004, 24005, 24006,
24007, 24008, 24009, 24010, 24011, 24012, 24015, 24016,
24018, 24019, 24020, 24022, 24024, 24025, 24026, 24027,
24028, 24029, 24031, 24032, 24035, 24036, 24037, 24038,
24039, 24040, 24041, 24050, 24052, 24053, 24054, 24055,
24057, 24058, 24060, 24063, 24064, 24067, 24068, 24069,
24071, 24072, 24073, 24074, 24075, 24077, 24078, 24079,
24082, 24083, 24084, 24085, 24087, 24090, 24091, 24092,
24093, 24094, 24095
);
var modernFaces = Array(
25001, 25003, 25006, 25007, 25009, 25010, 25011, 25012,
25013, 26000, 26001, 26002, 26003, 26004, 26005, 26006,
26007, 26009, 26010, 26011, 26012, 26013, 26014, 26015,
26016
);
var faceCategories = [
classicFaces,
royalFaces,
modernFaces
];
var categoryNames = [
"Old",
"New",
"Newest"
];
/* ── EYE COLOR ───────────────────────────────────────────────── */
var eyeColors = Array();
// Returns the base (black) face ID by zeroing the hundreds digit.
// e.g. 23486 → 23086, works for any face ID range.
function getBaseFace() {
var face = cm.getPlayer().getFace();
return Math.floor(face / 1000) * 1000 + (face % 100);
}
function buildEyeColors() {
var base = getBaseFace();
eyeColors = Array();
for (var i = 0; i < 9; i++) {
eyeColors.push(base + 100 * i);
}
}
/* ── ENTRY POINT ─────────────────────────────────────────────── */
function start() {
status = -1;
action(1, 0, 0);
}
/* ── MAIN FLOW ───────────────────────────────────────────────── */
function action(mode, type, selection) {
if (mode < 1) {
cm.dispose();
return;
}
status++;
/* ── STATUS 0: top-level menu ── */
if (status == 0) {
cm.sendSimple(
"Hello~ I'm Ivy, Sweetgum's face princess. " +
"What can I help you with today?\r\n\r\n" +
"#L0#Change Face (#b" + facePrice + " Mesos#k)#l\r\n" +
"#L1#Change Eye Color (#b" + eyePrice + " Mesos#k)#l"
);
/* ── STATUS 1: branch on chosen service ── */
} else if (status == 1) {
service = selection;
if (service == 0) {
// Plastic surgery — show face category menu
var text = "Select a face category:\r\n\r\n";
for (var i = 0; i < categoryNames.length; i++) {
text += "#L" + i + "#" + categoryNames[i] + "#l\r\n";
}
cm.sendSimple(text);
} else if (service == 1) {
// Eye color — show the 9 color variants for the player's current face
buildEyeColors();
cm.sendStyle(
"Please choose the eye color you'd like~ (#b" + eyePrice + " Mesos#k)",
eyeColors
);
}
/* ── STATUS 2 ── */
} else if (status == 2) {
if (service == 0) {
// Plastic surgery — player picked a category, now show face styles
selectedCategory = selection;
facenew = Array();
var selectedArray = faceCategories[selectedCategory];
for (var i = 0; i < selectedArray.length; i++) {
facenew.push(selectedArray[i]);
}
cm.sendStyle("Please choose the face you'd like~", facenew);
} else if (service == 1) {
// Eye color — player picked a color, apply it
if (cm.getMeso() < eyePrice) {
cm.sendOk("You need " + eyePrice + " mesos to change your eye color.");
cm.dispose();
return;
}
cm.gainMeso(-eyePrice);
cm.setFace(eyeColors[selection]);
cm.sendOk("Enjoy your new eye color~");
cm.dispose();
}
/* ── STATUS 3: plastic surgery only — player picked a face, apply it ── */
} else if (status == 3) {
if (cm.getMeso() < facePrice) {
cm.sendOk("You need " + facePrice + " mesos to change your face.");
cm.dispose();
return;
}
cm.gainMeso(-facePrice);
cm.setFace(facenew[selection]);
cm.sendOk("Enjoy your new and improved look! You will need to re-purchase your eye color after changing faces~");
cm.dispose();
}
}