54 lines
2.0 KiB
JavaScript
54 lines
2.0 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/>.
|
|
*/
|
|
|
|
/* Sabi JQ herb pile #1
|
|
*/
|
|
|
|
function start() {
|
|
var prizes = Array(1060041, 1060048, 1060116, 1061113, 1061130, 1061139, 1062009, 1062017, 1062024, 1062056, 1062061, 1702045, 1702114);
|
|
var chances = Array(10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5);
|
|
var totalodds = 0;
|
|
var choice = 0;
|
|
for (var i = 0; i < chances.length; i++) {
|
|
var itemGender = (Math.floor(prizes[i] / 1000) % 10);
|
|
if ((cm.getPlayer().getGender() != itemGender) && (itemGender != 2)) {
|
|
chances[i] = 0;
|
|
}
|
|
}
|
|
for (var i = 0; i < chances.length; i++) {
|
|
totalodds += chances[i];
|
|
}
|
|
var randomPick = Math.floor(Math.random() * totalodds) + 1;
|
|
for (var i = 0; i < chances.length; i++) {
|
|
randomPick -= chances[i];
|
|
if (randomPick <= 0) {
|
|
choice = i;
|
|
randomPick = totalodds + 100;
|
|
}
|
|
}
|
|
if (cm.isQuestStarted(2051)) {
|
|
cm.gainItem(4031032, 1);
|
|
}
|
|
cm.gainItem(prizes[choice], 1);
|
|
cm.warp(101000000, 0);
|
|
cm.dispose();
|
|
} |