53 lines
2.0 KiB
JavaScript
53 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(1040052, 1040054, 1040130, 1041143, 1042013, 1042022, 1042034, 1042084, 1042098, 1042117, 1702002, 1702015);
|
|
var chances = Array(10, 10, 10, 15, 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(2050)) {
|
|
cm.gainItem(4031020, 1);
|
|
}
|
|
cm.gainItem(prizes[choice], 1);
|
|
cm.warp(101000000, 0);
|
|
cm.dispose();
|
|
} |