/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy Matthias Butz Jan Christian Meyer 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 . */ /* guild creation npc */ var status = 0; var sel; function start() { cm.sendSimple("What would you like to do?\r\n#b#L0#Create a Guild#l\r\n#L1#Disband your Guild#l\r\n#L2#Increase your Guild's capacity#l#k"); } function action(mode, type, selection) { if (mode == -1) { cm.dispose(); } else { if (mode == 0 && status == 0) { cm.dispose(); return; } if (mode == 1) { status++; } else { status--; } if (status == 1) { sel = selection; if (selection == 0) { if (cm.getPlayer().getGuildId() > 0) { cm.sendOk("You may not create a new Guild while you are in one."); cm.dispose(); } else { cm.sendYesNo("Creating a Guild costs #b 1500000 mesos#k, are you sure you want to continue?"); } } else if (selection == 1) { if (cm.getPlayer().getGuildId() < 1 || cm.getPlayer().getGuildRank() != 1) { cm.sendOk("You can only disband a Guild if you are the leader of that Guild."); cm.dispose(); } else { cm.sendYesNo("Are you sure you want to disband your Guild? You will not be able to recover it afterward and all your GP will be gone."); } } else if (selection == 2) { if (cm.getPlayer().getGuildId() < 1 || cm.getPlayer().getGuildRank() != 1) { cm.sendOk("You can only increase your Guild's capacity if you are the leader."); cm.dispose(); } else { var Guild = Java.type("net.server.guild.Guild"); // thanks Conrad for noticing an issue due to call on a static method here cm.sendYesNo("Increasing your Guild capacity by #b5#k costs #b " + Guild.getIncreaseGuildCost(cm.getPlayer().getGuild().getCapacity()) + " mesos#k, are you sure you want to continue?"); } } } else if (status == 2) { if (sel == 0 && cm.getPlayer().getGuildId() <= 0) { cm.getPlayer().genericGuildMessage(1); cm.dispose(); } else if (cm.getPlayer().getGuildId() > 0 && cm.getPlayer().getGuildRank() == 1) { if (sel == 1) { cm.getPlayer().disbandGuild(); cm.dispose(); } else if (sel == 2) { cm.getPlayer().increaseGuildCapacity(); cm.dispose(); } } } } }