49 lines
1.9 KiB
JavaScript
49 lines
1.9 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 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 #3
|
|
|
|
function start() {
|
|
var prizes = Array(1050004, 1050015, 1050041, 1050044, 1050124, 1051021, 1051036, 1051075, 1051111, 1051138, 1052003, 1052006, 1052011, 1702024, 1702026);
|
|
var chances = Array(10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 8, 8);
|
|
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(2054))
|
|
cm.gainItem(4031028,30);
|
|
else cm.gainItem(prizes[choice],1);
|
|
cm.warp(105040300, 0);
|
|
cm.dispose();
|
|
} |