49 lines
2.0 KiB
JavaScript
49 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/>.
|
|
*/
|
|
/* John JQ Flower pile #1
|
|
*/
|
|
function start() {
|
|
var prizes = Array(1040051, 1040127, 1040128, 1040133, 1040138, 1041000, 1041001, 1041110, 1041130, 1041139, 1042015, 1042017, 1042023, 1702001, 1702025);
|
|
var chances = Array(10, 10, 10, 10, 5, 10, 10, 10, 10, 5, 8, 8, 8, 9, 7);
|
|
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(2052))
|
|
cm.gainItem(4031025,10);
|
|
else cm.gainItem(prizes[choice],1);
|
|
cm.warp(105040300, 0);
|
|
cm.dispose();
|
|
} |