Completely rearranged buff system (system can smartly check for the best statup to take effect for it's duration, or the server can be flagged to act as usual). Refactored scheduling system for buffs expiration and cooldowns to use one single thread per player rather than one per instance.
82 lines
3.2 KiB
JavaScript
82 lines
3.2 KiB
JavaScript
/*
|
|
This file is part of the OdinMS Maple Story Server
|
|
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
Matthias Butz <matze@odinms.de>
|
|
Jan Christian Meyer <vimes@odinms.de>
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as
|
|
published by the Free Software Foundation version 3 as published by
|
|
the Free Software Foundation. You may not use, modify or distribute
|
|
this program under any other version of the GNU Affero General Public
|
|
License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
/*
|
|
NPC Name: Big Headward
|
|
Map(s): Victoria Road : Henesys Hair Salon (100000104)
|
|
Description: Random haircut
|
|
*/
|
|
|
|
var status = 0;
|
|
var mhair = Array(30100, 30850, 30890);
|
|
var fhair = Array(31180, 31420, 31870, 31400, 31880, 31820, 31860, 31420, 31940, 34000, 31890);
|
|
var hairnew = Array();
|
|
|
|
function start() {
|
|
status = -1;
|
|
action(1, 0, 0);
|
|
}
|
|
|
|
function action(mode, type, selection) {
|
|
if (mode == -1) {
|
|
cm.dispose();
|
|
} else {
|
|
if (mode == 0 && type > 0) {
|
|
cm.dispose();
|
|
return;
|
|
}
|
|
|
|
if (mode == 1)
|
|
status++;
|
|
else
|
|
status--;
|
|
|
|
if (status == 0) {
|
|
cm.sendSimple("If you use this regular coupon, your hair may transform into a random new look...do you still want to do it using #b#t5150040##k, I will do it anyways for you. But don't forget, it will be random!\r\n\#L2#OK! (Uses #i5150040# #t5150040#)#l");
|
|
} else if (status == 1) {
|
|
cm.sendYesNo("If you use the EXP coupon your hair will change RANDOMLY with a chance to obtain a new experimental style that even you didn't think was possible. Are you going to use #b#t5150040##k and really change your hairstyle?");
|
|
}
|
|
else if (status == 2) {
|
|
if (cm.haveItem(5150040) == true){
|
|
hairnew = Array();
|
|
if (cm.getPlayer().getGender() == 0) {
|
|
for(var i = 0; i < mhair.length; i++) {
|
|
hairnew.push(mhair[i] + parseInt(cm.getPlayer().getHair() % 10));
|
|
}
|
|
}
|
|
else {
|
|
for(var i = 0; i < fhair.length; i++) {
|
|
hairnew.push(fhair[i] + parseInt(cm.getPlayer().getHair() % 10));
|
|
}
|
|
}
|
|
|
|
cm.gainItem(5150040, -1);
|
|
cm.setHair(hairnew[Math.floor(Math.random() * hairnew.length)]);
|
|
cm.sendOk("Enjoy your new and improved hairstyle!");
|
|
} else {
|
|
cm.sendOk("Hmmm...it looks like you don't have our designated coupon...I'm afraid I can't give you a haircut without it. I'm sorry...");
|
|
}
|
|
|
|
cm.dispose();
|
|
}
|
|
}
|
|
}
|