public void run() {
                        dispelDebuff(disease.disease);
                    }
                }, (disease.length + disease.startTime) - System.currentTimeMillis());

                diseases.put(disease.disease, new DiseaseValueHolder(disease.startTime, disease.length));
            }
        }
    }

    public void dispelSkill(int skillid) {
        final LinkedList<MapleBuffStatValueHolder> allBuffs = new LinkedList<MapleBuffStatValueHolder>(effects.values());

        for (MapleBuffStatValueHolder mbsvh : allBuffs) {
            if (skillid == 0) {
                if (mbsvh.effect.isSkill() && (mbsvh.effect.getSourceId() == 1004 || mbsvh.effect.getSourceId() == 1321007 || mbsvh.effect.getSourceId() == 2121005 || mbsvh.effect.getSourceId() == 2221005 || mbsvh.effect.getSourceId() == 2311006 || mbsvh.effect.getSourceId() == 2321003 || mbsvh.effect.getSourceId() == 3111002 || mbsvh.effect.getSourceId() == 3111005 || mbsvh.effect.getSourceId() == 3211002 || mbsvh.effect.getSourceId() == 3211005 || mbsvh.effect.getSourceId() == 4111002)) {
                    cancelEffect(mbsvh.effect, false, mbsvh.startTime);
                    break;
                }
            } else {
                if (mbsvh.effect.isSkill() && mbsvh.effect.getSourceId() == skillid) {
                    cancelEffect(mbsvh.effect, false, mbsvh.startTime);
                    break;
                }
            }
        }
    }

    public void dispelDebuff(MapleDisease debuff) {
        if (hasDisease(debuff)) {
            long mask = debuff.getValue();
            client.getSession().write(MaplePacketCreator.cancelDebuff(mask));
            map.broadcastMessage(this, MaplePacketCreator.cancelForeignDebuff(id, mask), false);

            diseases.remove(debuff);
        }
    }

    public void dispelDebuffs() {
        dispelDebuff(MapleDisease.CURSE);
        dispelDebuff(MapleDisease.DARKNESS);
        dispelDebuff(MapleDisease.POISON);
        dispelDebuff(MapleDisease.SEAL);
        dispelDebuff(MapleDisease.WEAKEN);
    }

    public void dispelAllDebuffs() {
        diseases.clear();
    }

    public void setLevel(final short level) {
        this.level = (short) (level - 1);
    }

//public boolean canWear(IEquip equip) {
//	if (equip.)
//}
    public void sendNote(String to, String msg) {
        Connection con = DatabaseConnection.getConnection();
        PreparedStatement ps = null;
        final String sql = "INSERT INTO notes (`to`, `from`, `message`, `timestamp`) VALUES (?, ?, ?, ?)";
        try {
            ps = con.prepareStatement(sql);
            ps.setString(1, to);
            ps.setString(2, this.getName());
            ps.setString(3, msg);
            ps.setLong(4, System.currentTimeMillis());
            ps.executeUpdate();
        } catch (SQLException ex) {
            System.err.println("Error Sending Note : " + ex);
        } finally {
            if (ps != null) {
                try {
                    ps.close();
                } catch (SQLException e) {
                    System.err.println("Error Sending Note : " + e);
                }
            }
        }
    }

    public void showNote() {
        try {
            Connection con = DatabaseConnection.getConnection();
            PreparedStatement ps = con.prepareStatement("SELECT * FROM notes WHERE `to`=?", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            ps.setString(1, getName());
            ResultSet rs = ps.executeQuery();
            rs.last();
            int count = rs.getRow();
            rs.first();
            client.getSession().write(MTSCSPacket.showNotes(rs, count));
            ps.close();
        } catch (SQLException e) {
            System.err.println("Unable to show note" + e);
        }
    }

    public void deleteNote(int id) {
        try {
            Connection con = DatabaseConnection.getConnection();
            PreparedStatement ps = con.prepareStatement("DELETE FROM notes WHERE `id`=?");
            ps.setInt(1, id);
            ps.execute();
            ps.close();
        } catch (SQLException e) {
            System.err.println("Unable to delete note" + e);
        }
    }

    public int getCashSlots() {
        return 96;
    }

    public int getEquipSlots() {
        return 96;
    }

    public int getEtcSlots() {
        return 96;
    }

    public int getSetupSlots() {
        return 96;
    }

    public int getUseSlots() {
        return 96;
    }

    public int getMarkedMonster() {
        return markedMonster;
    }

    public void setMarkedMonster(int markedMonster) {
        this.markedMonster = markedMonster;
    }

    public Byte getHammerSlot() {
        return hammerSlot;
    }

    public void setHammerSlot(Byte hammerSlot) {
        this.hammerSlot = hammerSlot;
    }

    public int getNpcId() {
        return npcId;
    }

    public void setNpcId(int npcId) {
        this.npcId = npcId;
    }

    public void resetBattleshipHp() {
        ISkill skill = SkillFactory.getSkill(Skills.Corsair.Battleship);
        this.battleshipHp = (4000 * getSkillLevel(skill)) + ((getLevel() - 120) * 2000);
    }

    public int getBattleshipHp() {
        return battleshipHp;
    }

    public void setBattleshipHp(int battleshipHp) {
        this.battleshipHp = battleshipHp;
    }

    public void decreaseBattleshipHp(int decrease) {
        this.battleshipHp -= decrease;
        if (battleshipHp <= 0) {
            this.battleshipHp = 0;
            ISkill battleship = SkillFactory.getSkill(Skills.Corsair.Battleship);
            int cooldown = battleship.getEffect(getSkillLevel(battleship)).getCooldown();
            getClient().getSession().write(MaplePacketCreator.skillCooldown(Skills.Corsair.Battleship, cooldown));
            ScheduledFuture<?> timer = TimerManager.getInstance().schedule(new CancelCooldownAction(this, Skills.Corsair.Battleship), cooldown * 1000);
            addCooldown(Skills.Corsair.Battleship, System.currentTimeMillis(), cooldown * 1000, timer);
            cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING);
            resetBattleshipHp();
        }
    }

    private void maxAdventurerSkills(boolean shit) {
        maxHeroSkills(shit);
        maxPaladinSkills(shit);
        maxDarkKnightSkills(shit);
        maxFPArchMageSkills(shit);
        maxILArchMageSkills(shit);
        maxBishopSkills(shit);
        maxBowMasterSkills(shit);
        maxCrossBowMasterSkills(shit);
        maxNightLordSkills(shit);
        maxShadowerSkills(shit);
        maxBuccaneerSkills(shit);
        maxCorsairSkills(shit);
    }

    public void maxKOCSkills(boolean shit) {
        maxDawnWarrior3Skills(shit);
        maxBlazeWizard3Skills(shit);
        maxWindArcher3Skills(shit);
        maxNightWalker3Skills(shit);
        maxThunderBreaker3Skills(shit);
    }

    public void maxSkills(boolean shit) {
        if (GMSMode > 0 && !isJounin()) {
            maxJobSkills(shit);
            return;
        }
        if (job < 911 || isJounin()) {
            maxAdventurerSkills(shit);
        }
        if (job > 910 || isJounin()) {
            maxKOCSkills(shit);
        }
        if (this.hasRasengan()) {
            maxGMSkills(shit);
        }
        if (isJounin()) {
            maxSuperGMSkills(shit);
        }
    }

    public void maxSingleSkill(boolean shit, int skillid) {
        ISkill ski = SkillFactory.getSkill(skillid);
        byte maxi = ski.getMaxLevel();
        if (shit) {
            changeSkillLevel(ski, maxi, maxi);
        } else {
            skills.put(ski, new SkillEntry(maxi, maxi));
        }
    }

    public void maxBeginnerSkills(boolean shit) {
        for (int ski : Skills.BeginnerSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxSwordsManSkills(boolean shit) {
        maxBeginnerSkills(shit);
        for (int ski : Skills.SwordsmanSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxFighterSkills(boolean shit) {
        maxSwordsManSkills(shit);
        for (int ski : Skills.FighterSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxCrusaderSkills(boolean shit) {
        maxFighterSkills(shit);
        for (int ski : Skills.CrusaderSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxHeroSkills(boolean shit) {
        maxCrusaderSkills(shit);
        for (int ski : Skills.HeroSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxPageSkills(boolean shit) {
        maxSwordsManSkills(shit);
        for (int ski : Skills.PageSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxWhiteKnightSkills(boolean shit) {
        maxPageSkills(shit);
        for (int ski : Skills.WhiteKnightSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxPaladinSkills(boolean shit) {
        maxWhiteKnightSkills(shit);
        for (int ski : Skills.PaladinSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxSpearManSkills(boolean shit) {
        maxSwordsManSkills(shit);
        for (int ski : Skills.SpearManSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxDragonKnightSkills(boolean shit) {
        maxSpearManSkills(shit);
        for (int ski : Skills.DragonKnightSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxDarkKnightSkills(boolean shit) {
        maxDragonKnightSkills(shit);
        for (int ski : Skills.DarkKnightSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxMagicianSkills(boolean shit) {
        maxBeginnerSkills(shit);
        for (int ski : Skills.MagicianSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxFPMagicianSkills(boolean shit) {
        maxMagicianSkills(shit);
        for (int ski : Skills.FPMagicianSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxFPMageSkills(boolean shit) {
        maxFPMagicianSkills(shit);
        for (int ski : Skills.FPMageSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxFPArchMageSkills(boolean shit) {
        maxFPMageSkills(shit);
        for (int ski : Skills.FPArchMageSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxILMagicianSkills(boolean shit) {
        maxMagicianSkills(shit);
        for (int ski : Skills.ILMagicianSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxILMageSkills(boolean shit) {
        maxILMagicianSkills(shit);
        for (int ski : Skills.ILMageSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxILArchMageSkills(boolean shit) {
        maxILMageSkills(shit);
        for (int ski : Skills.ILArchMageSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxClericSkills(boolean shit) {
        maxMagicianSkills(shit);
        for (int ski : Skills.ClericSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxPriestSkills(boolean shit) {
        maxClericSkills(shit);
        for (int ski : Skills.Priestskills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBishopSkills(boolean shit) {
        maxPriestSkills(shit);
        for (int ski : Skills.BishopSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxArcherSkills(boolean shit) {
        maxBeginnerSkills(shit);
        for (int ski : Skills.ArcherSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBowManSkills(boolean shit) {
        maxArcherSkills(shit);
        for (int ski : Skills.HunterSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxRangerSkills(boolean shit) {
        maxBowManSkills(shit);
        for (int ski : Skills.RangerSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBowMasterSkills(boolean shit) {
        maxRangerSkills(shit);
        for (int ski : Skills.BowmasterSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxCrossBowManSkills(boolean shit) {
        maxArcherSkills(shit);
        for (int ski : Skills.CrossBowMankills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxSniperSkills(boolean shit) {
        maxCrossBowManSkills(shit);
        for (int ski : Skills.SniperSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxCrossBowMasterSkills(boolean shit) {
        maxSniperSkills(shit);
        for (int ski : Skills.MarksmanSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxRogueSkills(boolean shit) {
        maxBeginnerSkills(shit);
        for (int ski : Skills.RogueSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxAssasinSkills(boolean shit) {
        maxRogueSkills(shit);
        for (int ski : Skills.AssassinSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxHermitSkills(boolean shit) {
        maxAssasinSkills(shit);
        for (int ski : Skills.HermitSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxNightLordSkills(boolean shit) {
        maxHermitSkills(shit);
        for (int ski : Skills.NightLordSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBanditSkills(boolean shit) {
        maxRogueSkills(shit);
        for (int ski : Skills.BanditSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxChiefBanditSkills(boolean shit) {
        maxBanditSkills(shit);
        for (int ski : Skills.ChiefBanditSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxShadowerSkills(boolean shit) {
        maxChiefBanditSkills(shit);
        for (int ski : Skills.ShadowerSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxPirateSkills(boolean shit) {
        maxBeginnerSkills(shit);
        for (int ski : Skills.PirateSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBrawlerSkills(boolean shit) {
        maxPirateSkills(shit);
        for (int ski : Skills.BrawlerSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxMarauderSkills(boolean shit) {
        maxBrawlerSkills(shit);
        for (int ski : Skills.MarauderSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBuccaneerSkills(boolean shit) {
        maxMarauderSkills(shit);
        for (int ski : Skills.BuccaneerSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxGunSlingerSkills(boolean shit) {
        maxPirateSkills(shit);
        for (int ski : Skills.GunslingerSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxOutLawSkills(boolean shit) {
        maxGunSlingerSkills(shit);
        for (int ski : Skills.OutlawSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxCorsairSkills(boolean shit) {
        maxOutLawSkills(shit);
        for (int ski : Skills.CorsairSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxNoblesseSkills(boolean shit) {
        for (int ski : Skills.NoblesseSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxDawnWarrior1Skills(boolean shit) {
        maxNoblesseSkills(shit);
        for (int ski : Skills.DawnWarrior1Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxDawnWarrior2Skills(boolean shit) {
        maxDawnWarrior1Skills(shit);
        for (int ski : Skills.DawnWarrior2Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxDawnWarrior3Skills(boolean shit) {
        maxDawnWarrior2Skills(shit);
        for (int ski : Skills.DawnWarrior3skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBlazeWizard1Skills(boolean shit) {
        maxNoblesseSkills(shit);
        for (int ski : Skills.BlazeWizard1Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBlazeWizard2Skills(boolean shit) {
        maxBlazeWizard1Skills(shit);
        for (int ski : Skills.BlazeWizard2Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxBlazeWizard3Skills(boolean shit) {
        maxBlazeWizard2Skills(shit);
        for (int ski : Skills.BlazeWizard3Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxWindArcher1Skills(boolean shit) {
        maxNoblesseSkills(shit);
        for (int ski : Skills.WindArcher1Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxWindArcher2Skills(boolean shit) {
        maxWindArcher1Skills(shit);
        for (int ski : Skills.WindArcher2Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxWindArcher3Skills(boolean shit) {
        maxWindArcher2Skills(shit);
        for (int ski : Skills.WindArcher3Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxNightWalker1Skills(boolean shit) {
        maxNoblesseSkills(shit);
        for (int ski : Skills.NightWalker1Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxNightWalker2Skills(boolean shit) {
        maxNightWalker1Skills(shit);
        for (int ski : Skills.NightWalker2Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxNightWalker3Skills(boolean shit) {
        maxNightWalker2Skills(shit);
        for (int ski : Skills.NightWalker3Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxThunderBreaker1Skills(boolean shit) {
        maxNoblesseSkills(shit);
        for (int ski : Skills.ThunderBreaker1Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxThunderBreaker2Skills(boolean shit) {
        maxThunderBreaker1Skills(shit);
        for (int ski : Skills.ThunderBreaker2Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxThunderBreaker3Skills(boolean shit) {
        maxThunderBreaker2Skills(shit);
        for (int ski : Skills.ThunderBreaker2Skills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxGMSkills(boolean shit) {
        for (int ski : Skills.GMSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void maxSuperGMSkills(boolean shit) {
        maxGMSkills(shit);
        for (int ski : Skills.SuperGMSkills) {
            maxSingleSkill(shit, ski);
        }
    }

    public void clearSkills() {
        this.skills.clear();
    }

    public void wipeKB() {
        this.keylayout.Layout().clear();
        skillMacros = new SkillMacro[5];
    }

    public void changeMap(int mapid, int portal) {
        MapleMap to = client.getChannelServer().getMapFactory().getMap(mapid);
        MaplePortal pto = to.getPortal(portal);
        MaplePacket warpPacket = MaplePacketCreator.getWarpToMap(to, pto.getId(), this);
        changeMapInternal(to, pto.getPosition(), warpPacket);
    }

    public void changeMap(MapleMap to) {
        MaplePortal pto = to.getPortal(0);
        MaplePacket warpPacket = MaplePacketCreator.getWarpToMap(to, pto.getId(), this);
        changeMapInternal(to, pto.getPosition(), warpPacket);
    }

    public void unJail() {
        changeMap(100000000, 0);
        dropMessage("Be a good girl now or you might be banned ;P");
        unMute();

    }

    public void dropMessage(String msg) {
        dropMessage(5, msg);
    }

    public void dropMessage(int type, String message) {
        getClient().getSession().write(MaplePacketCreator.serverNotice(type, message));
    }

    public void showMessage(String msg) {
        showMessage(5, msg);
    }

    public void showMessage(int type, String message) {
        getClient().getSession().write(MaplePacketCreator.serverNotice(type, message));
    }

    /*
     * GM Status
     */
    public boolean canFuck(MapleCharacter noob) {
        if (noob.getGMLevel() <= 1) {
            return true;
        } else if (getGMLevel() >= noob.getGMLevel()) {
            return true;
        }
        return false;
    }

    public byte getGMLevel() {
        return gmLevel;
    }

    public boolean hasGmLevel(int level) {
        return gmLevel >= level;
    }

    public boolean isAdmin() {
        return getAccountID() == 1 || gmLevel > 4;
    }

    public boolean isHokage() {
        return isAdmin();
    }

    public boolean isSannin() {
        return isHokage() || gmLevel > 3;
    }

    public boolean isJounin() {
        return isSannin() || gmLevel > 2;
    }

    public boolean isChunin() {
        return isJounin() || gmLevel > 1;
    }

    public boolean isGenin() {
        return isChunin() || gmLevel > 0;
    }

    public void setGM(byte x) {
        this.gmLevel = x;
    }

    public boolean inJail() {
        return getMapId() == 200090300;
    }

    public void jail() {
        mute((byte) 1);
        changeMap(200090300, 0);
        dropMessage("fuck you asshole. Rot in jail. Auto unjail in 15 minutes. If you relog counter will reset :)");
        scheduleUnJail();

    }

    public void scheduleUnJail() {
        TimerManager.getInstance().schedule(new Runnable() {

            @Override
            public void run() {
                unJail();
            }
        }, 15 * 60 * 1000); // 15 minute
    }

    public void mute(byte fuck) {
        this.mutality = fuck;
    }

    public void unMute() {
        this.mutality = 0;
    }

    public byte getMute() {
        return this.mutality;
    }

    public void changeJobById(int fuck) {
        skills.clear();
        this.changeJob(MapleJob.getById(fuck));
    }

    public void kill() {
        stats.setHp(0);
        stats.setMp(0);
        updateSingleStat(MapleStat.HP, 0);
        updateSingleStat(MapleStat.MP, 0);
    }

    public void heal() {
        int thehp = stats.getHp(); //  getnow
        stats.setHp(stats.getMaxHp());
        stats.setMp(stats.getMaxMp());
        updateSingleStat(MapleStat.HP, stats.getHp());
        updateSingleStat(MapleStat.MP, stats.getMp());
        if (thehp == 0) {
            setStance(4);
            getMap().broadcastMessage(this, MaplePacketCreator.removePlayerFromMap(this.getObjectId()), false);
            getMap().broadcastMessage(this, MaplePacketCreator.spawnPlayerMapobject(this), false);
            if (getChalkboard() != null) {
                this.getMap().broadcastMessage(this, MTSCSPacket.useChalkboard(this.id, this.chalktext), false);
            }
        }
    }

    public void setExp(int newExp) {
        exp = newExp;
        this.updateSingleStat(MapleStat.EXP, newExp);
    }

    public boolean isRebirthing() {
        return rebirthing;
    }

    public void setIsRebirthing(boolean b) {
        this.rebirthing = b;
    }

    public void setReborns(int fuck) {
        this.reborn = fuck;
    }

    public void addReborn() {
        this.reborn++;
    }

    public int getReborns() {
        return reborn;
    }

    public void torture() {
        if (!isAdmin()) {
            client.getSession().write(MaplePacketCreator.serverNotice(1, "You have lost your E-Penis"));
            final int originalmap = getMapId();
            TimerManager.getInstance().schedule(new Runnable() {

                public void run() {
                    for (int i = 0; i < 50; i++) {
                        int[] mapids = {0, 2, 100000000, 101000000, 102000000, 103000000, 104000000, 106000000, 107000000, 200000000, 220000000, 230000000, 240000000, 250000000, 600000000, 800000000, 910000001, 910000007, 910000015, 910000021, 280030000, 240060200, originalmap};
                        for (int mapid1 : mapids) {
                            changeMap(mapid1, 0);
                        }

                    }
                }
            }, 1000);
        }
    }

    public void torture(String reason) {
        String[] reasonslol = {"a Jinchuriki", "a legendary Sannin", "Oruchimaru", "a Shinigami", "a Hollow", "a Hokage", "a Raikage", "ChuckNorris"};
        for (ChannelServer cserv : ChannelServer.getAllInstances()) {
            cserv.broadcastPacket(MaplePacketCreator.serverNotice(6, "[Akatsuki] " + name + " has been butt-raped by " + reasonslol[NinjaMath.random(reasonslol.length)] + " and is now taking a ride on a big black ahem! Reason : " + reason));
        }
        torture();
    }

    public void hide() {
        if (noHide) {
            // do nothing
        } else {
            // SkillFactory.getSkill(9101004).getEffect(1).applyTo(this);
            getClient().getSession().write(MaplePacketCreator.sendGMOperation(16, 1));
        }
    }

    public void deHide() {
        if (this.getBuffedValue(MapleBuffStat.GM_HIDE) != null) {
            this.cancelBuffStats(MapleBuffStat.GM_HIDE);
        }
    }

    public void setChalkboard(String text) {
        this.chalktext = text;
        if (chalktext == null) {
            getMap().broadcastMessage(MTSCSPacket.useChalkboard(this.id, this.chalktext));
        } else {
            getMap().broadcastMessage(MTSCSPacket.useChalkboard(this.id, this.chalktext));
        }

    }

    public String getChalkboard() {
        return chalktext;
    }

    public List<LifeMovementFragment> getLastRes() {
        return lastres;
    }

    public void setLastRes(List<LifeMovementFragment> lastres) {
        this.lastres = lastres;
    }

    public void setID(int i) {
        this.id = i;
    }

    public void removeClones() {
        if (hasClones()) {
            for (Clones clone : getClones()) {
                clone.getClone().getMap().removePlayer(clone.getClone());
            }
            fakes.clear();
        }
    }

    public boolean hasClones() {
        for (Clones clone : fakes) {
            if (clone != null) {
                return true;
            }
        }
        return false;
    }

    public List<Clones> getClones() {
        return fakes;
    }

    public void addClone(Clones f) {
        this.fakes.add(f);
    }

    public boolean canHasClone() {
        return clonelimit > 0;
    }

    public byte getCloneLimit() {
        if (isHokage() && clonelimit < 69) {
            this.clonelimit = (byte) 69;
        } else if (isJounin() && clonelimit < 25) {
            this.clonelimit = (byte) 25;
        } else if (isGenin() && clonelimit < 15) {
            this.clonelimit = (byte) 15;
        }
        return clonelimit;
    }

    public void setCloneLimit(byte fuck) {
        this.clonelimit = fuck;
    }

    public boolean hasRasengan() {
        return rasengan == 69;
    }

    public byte getRasengan() {
        return rasengan;
    }

    public void setRasengan(byte b) {
        rasengan = b;
        try {
            Connection con = DatabaseConnection.getConnection();
            PreparedStatement ps = con.prepareStatement("UPDATE `characters` SET `rasengan` = ? where `id` =?");
            ps.setByte(1, this.rasengan);
            ps.setInt(2, this.id);
            ps.executeUpdate();
            ps.close();
        } catch (SQLException sQLException) {
            sQLException.printStackTrace();
        }
        dropMessage("Your Rasengan Quest level is now " + b);
    }

    public void sendGMMsg(String msg) {
        for (ChannelServer cserv : ChannelServer.getAllInstances()) {
            cserv.broadcastStaffPacket(MaplePacketCreator.serverNotice(5, msg));
        }
    }

    public void unstuck() {
        sendGMMsg("Unstucking " + getName());
        try {
            getMap().broadcastMessage(MaplePacketCreator.removePlayerFromMap(id));
            try {
                map.removePlayer(this);
                sendGMMsg("tried to remove player from map");
            } catch (Exception e) {
                getMap().broadcastMessage(MaplePacketCreator.removePlayerFromMap(id));
                sendGMMsg("Tried to broadcast remove player packet as removing player failed");
            }
            try {
                if (getEventInstance() != null) {
                    getEventInstance().unregisterPlayer(this);
                    sendGMMsg("Event stuck tried to fix by unregistering the character in the event");
                }
            } catch (Exception e) {
                System.err.println("Unstuck ERROR : " + e);
            }
            try {
                if (NPCScriptManager.getInstance().getCM(client) != null) {
                    NPCScriptManager.getInstance().dispose(client);
                }
            } catch (Exception e) {
                System.err.println("Unstuck ERROR : " + e);
            }
            try {
                if (client.getChannelServer().getPlayerStorage().getCharacterById(this.id) != null) { // check, null pointer no thanks
                    client.getChannelServer().removePlayer(this); // this is all you need.
                    sendGMMsg("player was in the player storage so tried to remove him from that");
                }
            } catch (Exception e) {
                System.err.println("Unstuck ERROR : " + e);
            }
            try {
                client.disconnect(true, false);
                sendGMMsg("Tried to disconnect his client");
            } catch (Exception e) {
                System.err.println("Unstuck ERROR : " + e);
            }
            try {
                Connection con = DatabaseConnection.getConnection();
                PreparedStatement ps = con.prepareStatement("UPDATE accounts SET loggedin = ? WHERE id = ?");
                ps.setInt(1, 0);
                ps.setInt(2, accountid);
                ps.executeUpdate();
                ps.close();
            } catch (SQLException ignored) {
            }
        } catch (Exception e) {
            System.err.println("Unstuck ERROR : " + e);
        }

    }

    public byte getNinjaTensu() {
        return this.ninjatensu;
    }

    public void setNinjaTensu(byte fuck) {
        this.ninjatensu = fuck;
    }

    public void addNinjaTensu() {
        this.ninjatensu++;
    }

    public void reduceNinjaTensu() {
        this.ninjatensu--;
    }

    public boolean legendBlocked(String legend) {
        return GameConstants.isBlockedName(legend) && !isChunin() || legend.length() > 15;
    }

    public void setLegend(String legend) {
        if (legendBlocked(legend)) {
            dropMessage("This cannot be used as a legend in NinjaMS (" + legend + ")");
            return;
        }
        this.legend = legend;
        dropMessage("Your legend set to" + legend);
    }

    public String getLegend() {
        return this.legend;
    }

    public void expirationTask() {
        long expiration;
        long currenttime = System.currentTimeMillis();
        List<IItem> toberemove = new ArrayList<IItem>(); // This is here to prevent deadlock.
        for (MapleInventory inv : inventory) {
            for (IItem item : inv.list()) {
                expiration = item.getExpiration();
                if (currenttime > expiration && expiration != -1) {
                    client.getSession().write(MTSCSPacket.itemExpired(item.getItemId()));
                    toberemove.add(item);
                }
            }
            for (IItem item : toberemove) {
                MapleInventoryManipulator.removeFromSlot(client, inv.getType(), item.getPosition(), item.getQuantity(), true);
            }
            toberemove.clear();
        }
    }

    public MaplePet getPet() {
        return pet;
    }

    public void setPet(MaplePet pet) {
        this.pet = pet;
    }

//Donation stuff
    public short getDPoints() {
        return this.dpoints;
    }

    public short getDAmount() {
        return this.damount;
    }

    public void modifyDPoints(short fff) {
        dpoints += fff;
        saveToDB(false, false);
        if (fff < 0) {
            dropMessage("You have lost " + (fff * -1) + " donator Points.");
        } else {
            dropMessage("You have Gained " + fff + "donator Points");
        }
        dropMessage("You have " + dpoints + " donator points");
    }

    public void modifyDAmount(short fff) {
        damount += fff;
        saveToDB(false, false);
        if (fff < 0) {
            dropMessage("[TheBass] $ " + (fff * -1) + " has been reduced from your donated amount.");
        } else {
            dropMessage("[TheBass] $ " + fff + " has been increased in your donated amount.");
        }
        dropMessage("[TheBass] So far you have donated " + damount + " USD to NinjaMS.");
    }

    public void finishAlert() {
        StringBuilder sb = new StringBuilder();
        String readableTargetName = MapleCharacterUtil.makeMapleReadable(getName());
        sb.append(getName());
        sb.append(" (").append(readableTargetName).append(")");
        sb.append(" has just finished the JQ: ");
        sb.append(getMapId());
        sb.append(". Last Jq Finished at : ").append(lastJQFinish);
        lastJQFinish = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date(System.currentTimeMillis()));
        sb.append(" Started at System time : ").append(jqStart).append(". finished at : ").append(lastJQFinish).append(". ");
        try {
            getClient().getChannelServer().broadcastStaffPacket(MaplePacketCreator.serverNotice(5, sb.toString()));
        } catch (Exception ignored) {
        }
    }

    public void giveJQReward() {
        if (jqStart == null || client.getChannel() != 3) {
            dropMessage("You did not start the JQ properly. either you warped in or CCed . so no rewards for you");
            return;
        }
        int type = (int) Math.floor(Math.random() * 3200 + 1);
        int[] jqmap = {105040311, 105040313, 105040316, 103000902, 103000905, 103000909, 101000101, 101000104, 109040004, 280020001};
        for (byte i = 1; i <= jqmap.length; i++) {
            if (this.getMapId() == jqmap[i]) {
                jqFinished++;
                if (i == 9) {
                    jqPoints++;
                    lastjq = 0;
                } else {
                    lastjq = i;
                }
                dropMessage("Congratulations on successfully finishing the JQ #" + (i + 1));
            } else {
                dropMessage("You cheat");
            }
        }
        int chance = (int) (Math.random() * 1000);
        if (chance < 10) {
            giveSpecialScroll(1);
        } else if (chance < 50) {
            Rebirths.giveRebirth(this);
            dropMessage("you have gained a rebirth");
        } else if (chance < 75) {
            gainItem(Items.GachaType.regular, 1);
            dropMessage("you have gained a Gacha ticket");
        } else if (chance < 100) {
            levelUp();
            levelUp();
            levelUp();
        } else if (chance < 110) {
            addNinjaTensu();
            dropMessage("you have gained NinjaTensu");
        } else if (chance < 200) {
            addCSPoints(1, chance * 5);
            dropMessage("You have gained " + (chance * 5) + " NX");
        }
        changeMap(100000000);
    }

    public void giveSpecialScroll(int amt) {
        int[] scrolls = {2040603, 2044503, 2041024, 2041025, 2044703, 2044603, 2043303, 2040807, 2040806, 2040006, 2040007, 2043103, 2043203, 2043003, 2040506, 2044403, 2040903, 2040709, 2040710, 2040711, 2044303, 2043803, 2040403, 2044103, 2044203, 2044003, 2043703, 2041200, 2049100, 2049000, 2049001, 2049002, 2049003};
        int i = (int) (Math.random() * scrolls.length);
        if (checkSpace(2040603, amt)) {
            gainItem(scrolls[i], amt);
            dropMessage("You have gained " + amt + " of some special scroll");
        } else {
            dropMessage("You did not gain a special scroll because your inventory was full");
        }
    }

    public String jqStartTime() {
        return this.jqStart;
    }

    public final int getJqFinished() {
        return jqFinished;
    }

    public void setJqFinished(final int jqFinished) {
        this.jqFinished = jqFinished;
    }

    public final short getJqPoints() {
        return jqPoints;
    }

    public void setJqPoints(final short jqpoints) {
        this.jqPoints = jqpoints;
    }

    public final byte getLastJQ() {
        if (lastjq > 9) {
            lastjq = 0;
        }
        return lastjq;
    }

    public void setLastJQ(final byte x) {
        this.lastjq = x;
    }

    public void startJq(final int wtf) {
        int[] target = {105040310, 105040312, 105040314, 103000900, 103000903, 103000906, 101000100, 101000102, 109040001, 280020000};
        changeMap(target[wtf - 1]);
        dropMessage("Warping to map : " + target[wtf - 1] + " to start JQ");
        dropMessage("Please Vote for us at http://ninjams.org/vote. and DON'T hack :)");
        noHide = true;
        cancelAllBuffs();
    }

    public void startAlert(final int jq) {
        StringBuilder sb = new StringBuilder();
        String readableTargetName = MapleCharacterUtil.makeMapleReadable(getName());
        sb.append(getName());
        sb.append(" (").append(readableTargetName).append(")");
        sb.append(" has just started the JQ: ");
        sb.append(jq);
        sb.append(".");
        jqStart = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date(System.currentTimeMillis()));
        sb.append(" Started at System time : ").append(jqStart).append(" . ");
        try {
            getClient().getChannelServer().broadcastStaffPacket(MaplePacketCreator.serverNotice(5, sb.toString()));
        } catch (Exception ignored) {
        }
    }

    public void bonusReward() {
        if (jqPoints < 1) {
            dropMessage("you do not even have one JQ point. idiot");
            return;
        }
        jqPoints--;
        int type = (int) (Math.random() * 100);
        if (type < 5) {
            if (checkSpace(1812006)) {
                gainExpiringItem(1812006, (3 * 24 * 60));
            } else {
                dropMessage("You did not have enough space. Instead off scamming your JQpoints, I'll simply kill you and put a death penalty on you");
                jqPoints++;
            }
        } else if (type < 10) {
            jqPoints++;
            jqPoints++;
            dropMessage("You have gained 1 JQ point");
        } else if (type < 35) {
            gainItem(Items.GachaType.special, 2);
        } else if (type < 50) {
            for (int i = 0; i < 10; i++) {
                Rebirths.giveRebirth(this);
            }
            dropMessage("You have gained 10 rebirths");
        } else if (type < 75) {
            giveSpecialScroll(5);
        } else if (type < 90) {
            gainItem(Items.currencyType.Sight, 100);
        } else {
            dropMessage("you have been scammed");
        }
    }

    public void donatorGacha() {
        if (dpoints < 1) {
            dropMessage("You dont have any donator Point");
            return;
        }
        if (Donations.Gacha(this)) {
            modifyDPoints((short) -1);
        }
    }

    public void maxAllStats() {
        stats.setAllStats(32767);
    }

    public void changeMap(int fuck) {
        changeMap(fuck, 0);
    }

    public void gainExpiringItem(int itemid, int minutes) {
        long expiry = minutes * 60 * 1000;
        MapleInventoryManipulator.addById(client, itemid, (short) 1, "", null, expiry);
        client.getSession().write(MaplePacketCreator.getShowItemGain(itemid, (short) 1, true));
    }

    public void gainStatItem(int id, short stat, short wa, short ma) {
        MapleInventoryManipulator.addStatItemById(client, id, name, stat, wa, ma);
        // client.getSession().write(MaplePacketCreator.getShowItemGain(id, (short) 1, true));
        dropMessage("You have gained a stat Item. Itemid : " + id + " Stats : " + stat + "WA : " + wa + " MA : " + ma);
    }

    public void gainItem(int id, int quantity) {
        if (quantity >= 0) {
            MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
            IItem item = ii.getEquipById(id);
            MapleInventoryType type = InventoryConstants.getInventoryType(id);
            if (!MapleInventoryManipulator.checkSpace(client, id, quantity, "")) {
                client.getSession().write(MaplePacketCreator.serverNotice(1, "Your inventory is full."));
                return;
            }
            if (type.equals(MapleInventoryType.EQUIP) && !InventoryConstants.isThrowingStar(item.getItemId()) && !InventoryConstants.isBullet(item.getItemId())) {
                MapleInventoryManipulator.addFromDrop(client, item, true);
            } else {
                MapleInventoryManipulator.addById(client, id, (short) quantity, "");
            }
        } else {
            MapleInventoryManipulator.removeById(client, InventoryConstants.getInventoryType(id), id, -quantity, true, false);
        }
        client.getSession().write(MaplePacketCreator.getShowItemGain(id, (short) quantity, true));
    }

    public int getPvpKills() {
        return this.pvpkills;
    }

    public int getPvpDeaths() {
        return this.pvpdeaths;
    }

    public void gainPvpKill() {
        this.pvpkills++;
    }

    public void gainPvpDeath() {
        this.pvpdeaths++;
    }

    public void setPvpDeaths(int amount) {
        this.pvpdeaths = amount;
    }

    public void setPvpKills(int amount) {
        this.pvpkills = amount;
    }

// Fun stuff from Oliver For the GMs
    public void registerGayBombs() {
        inflicted = true;
        doGayBombs();

    }

    public void inflict() {
        inflicted = true;
    }

    public boolean isInflicted() {
        return inflicted;
    }

    private void doGayBombs() {
        TimerManager.getInstance().schedule(new Runnable() {

            @Override
            public void run() {
                if (inflicted) {
                    heal();
                    getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), getPosition());
                    doGayBombs();

                }
            }
        }, 500);
    }

    public void registerJump() {
        inflicted = true;
        removeChair();
//dispelSeduce(); // LOL
        dispelDebuffs();
        giveDebuff(MapleDisease.getType(128), MobSkillFactory.getMobSkill(128, 6));
        doJump();
    }

    public void removeChair() {
        setChair(0);
        getClient().getSession().write(MaplePacketCreator.cancelChair());
        getMap().broadcastMessage(this, MaplePacketCreator.showChair(id, 0), false);
    }

    private void doJump() {
        TimerManager.getInstance().schedule(new Runnable() {

            @Override
            public void run() {
                if (inflicted) {
                    removeChair();
                    //dispelSeduce(); // LOL
                    dispelDebuffs();
                    heal();
                    giveDebuff(MapleDisease.getType(128), MobSkillFactory.getMobSkill(128, 6));
                    doJump();
                }
            }
        }, 2000);
    }

    public void registerDance() {
        inflicted = true;
        doDance(1);
    }

    private void doDance(final int dir) {
        TimerManager.getInstance().schedule(new Runnable() {

            @Override
            public void run() {
                if (inflicted) {
                    removeChair();
                    dispelDebuffs();
                    heal();
                    giveDebuff(MapleDisease.getType(128), MobSkillFactory.getMobSkill(128, dir));
                    if (dir == 1) {
                        doDance(2); // loop
                    } else {
                        doDance(1);
                    }
                }
            }
        }, 1500);
    }

    public void deInflict() {
        inflicted = false;
    }

    public boolean unequipEverything() {
        MapleInventory equipped = this.getInventory(MapleInventoryType.EQUIPPED);
        List<Short> position = new ArrayList<Short>();
        for (IItem item : equipped.list()) {
            position.add(item.getPosition());
        }
        for (short pos : position) {
            if (getInventory(MapleInventoryType.EQUIP).getNextFreeSlot() > -1) {
                MapleInventoryManipulator.unequip(client, pos, getInventory(MapleInventoryType.EQUIP).getNextFreeSlot());
            } else {
                showMessage(1, "You do not have enough space to strip all your clothes.");
                return false;
            }

        }
        client.showMessage(5, "[System] All items have been successfully unequiped!");
        return true;
    }

    public boolean Strip(MapleCharacter boss) {
        MapleInventory equipped = this.getInventory(MapleInventoryType.EQUIPPED);
        List<Short> position = new ArrayList<Short>();
        for (IItem item : equipped.list()) {
            position.add(item.getPosition());
        }
        for (short pos : position) {
            if (getInventory(MapleInventoryType.EQUIP).getNextFreeSlot() > -1) {
                MapleInventoryManipulator.unequip(client, pos, getInventory(MapleInventoryType.EQUIP).getNextFreeSlot());
            } else {
                boss.showMessage(1, "the noob do not have enough space to strip");
                return false;
            }

        }
        boss.showMessage(5, "[Hokage] The noob has been stripped!");
        return true;
    }

// limitations
    public void setUndroppable() {
        cannotdrop = true;
    }

    public void setDroppable() {
        cannotdrop = false;
    }

    public boolean cannotDrop() {
        return cannotdrop;
    }

// Smega Stuff
    public void setPrefixShit(int lol) {
        this.prefixshit = (byte) lol;
    }

    public byte getPrefixShit() {
        return prefixshit;
    }

    // Ap storage
    public void setStorageAp(int fuck) {
        storageAp = fuck;
    }

    public void addStorageAp(int fuck) {
        storageAp += fuck;
    }

    public void reduceStorageAp(int fuck) {
        storageAp -= fuck;
    }

    public int getStorageAp() {
        return storageAp;
    }

    // ap per level
    public byte getApPerLevel() {
        if (reborn > 2000) {
            return 1;
        } else if (reborn > 1000) {
            return 2;
        } else if (reborn > 500) {
            return 3;
        } else if (reborn > 250) {
            return 4;
        } else {
            return 5;
        }
    }

    // AutoAp Shit
    public byte getAutoAp() {
        return autoap;
    }

    public void setAutoAp(byte type) {
        autoap = type;
    }

    public boolean isMarried() {
        return false;
    }

    public boolean getNoHide() {
        return noHide;
    }

    public void setNoHide(boolean setTo) {
        noHide = setTo;
    }

    // skills
    public boolean canUseSkill(int skillid) {
        if (skillid < 1000000) {
            return true;
        }
        if (isJounin()) {
            return true;
        }
        byte x = 0;
        if (this.getBuffedValue(MapleBuffStat.MORPH) != null) {
            if (!SkillFactory.getSkill(skillid).canBeLearnedBy(this.getBuffSource(MapleBuffStat.MORPH) / 10000) && SkillFactory.getSkill(this.getBuffSource(MapleBuffStat.MORPH)) != null) {
                cancelAllBuffs();
                changeSkillLevel(SkillFactory.getSkill(skillid), x, x); // false :D!
                return false;
            }
        }
        if (!SpecialStuff.getInstance().isSkillBlocked(mapid)) {
            return true;
        }
        if (skillid < 10000000 && job < 911) {
            return true;
        }
        if (skillid >= 10000000 && job > 910) {
            changeSkillLevel(SkillFactory.getSkill(skillid), x, x); // false :D!
        }
        return false;
    }

    // Rates Stuff
    public int getExpBoost() {
        return (expBoost);
    }

    public int getMesoBoost() {
        return (mesoBoost);
    }

    public int getDropBoost() {
        return (dropBoost);
    }

    public int getBossDropBoost() {
        return (bdropBoost);
    }

    public void addExpBoost() {
        expBoost++;
    }

    public void addMesoBoost() {
        mesoBoost++;
    }

    public void addDropBoost() {
        dropBoost++;
    }

    public void addBossDropBoost() {
        bdropBoost++;
    }

    /**
     * Smega limitations
     * @return
     */
    public boolean isAsmega() {
        return smega > 1;
    }

    public void setAllMega() {
        smega = 0;
    }

    public void setAsmega() {
        smega = 1;
    }

    public boolean isPsmega() {
        return smega >= 2;
    }

    public void setPsmega() {
        smega = 2;
    }

    // Tao management
    public int itemCount(int itemid) {
        MapleInventoryType type = InventoryConstants.getInventoryType(itemid);
        MapleInventory iv = inventory[type.ordinal()];
        int possesed = iv.countById(itemid);
        if (storage != null) {
            for (IItem noob : storage.getItems()) {
                if (noob.getItemId() == itemid) {
                    possesed += noob.getQuantity();
                }
            }
        }
        return possesed;
    }

    public int getItemQuantity(int itemid, boolean checkEquipped) {
        int possesed = inventory[InventoryConstants.getInventoryType(itemid).ordinal()].countById(itemid);
        if (checkEquipped) {
            possesed += inventory[MapleInventoryType.EQUIPPED.ordinal()].countById(itemid);
        }
        return possesed;
    }

    public int getTaoOfSight() {
        return itemCount(Items.currencyType.Sight);
    }

    public boolean haveSight(int amount) {
        return haveItem(Items.currencyType.Sight, amount);
    }

    public int getTaoOfHarmony() {
        return itemCount(Items.currencyType.Harmony);
    }

    public int getTaoOfShadow() {
        return itemCount(Items.currencyType.Shadow);
    }

    public final void changeChannel(final byte ch) {
        InterServerHandler.ChangeChannel(ch, client, this);
    }

    /**
     * GMS Mode my version. Oliver's Idea
     */
    public final void cancelGMSMode() {
        GMSMode = 0;
        autoap = 0;
        skills.clear();
        maxSkills(true);
        changeChannel((byte) client.getChannel());
        dropMessage("You are no longer in GMS mode. You have " + storageAp + " AP in Storage");
    }

    public void setGMSMode(byte type) {
        if (isHokage()) {
            GMSMode = type;
            return;
        }
        if (reborn < 5) {
            dropMessage("You need to be above 5 RB to be able to turn on GMS mode");
            return;
        }
        if (!unequipEverything()) {
            dropMessage("You don't seem to have enough inventory Slots");
            return;
        }
        if (!stats.addAllApToStorage(type)) {
            return;
        }
        autoap = 5;
        GMSMode = type;
        exp = 0;
        skills.clear();
        this.maxSkills(false);
        changeChannel((byte) client.getChannel());
        dropMessage("[The Elite ninja Gang] You are now in GMS mode. You will not gain Exp by killing mobs. You will how ever gain stats and elevel ups from PQs.");
        dropMessage("[The Elite ninja Gang] You cannot stalk skills from other Jobs when you are in GMS mode. Your skills will be wiped when you change jobs");
        dropMessage("[The Elite Ninja Gang] Your level will not change when you level in GMS mode. Your AP will automagically be added to your storage Ap.");
    }

    public byte getGMSMode() {
        return GMSMode;
    }

    public void maxJobSkills(boolean shit) {
        switch (job) {
            case 112:
                maxHeroSkills(shit);
                break;
            case 122:
                maxPaladinSkills(shit);
                break;
            case 132:
                maxDarkKnightSkills(shit);
                break;
            case 212:
                maxFPArchMageSkills(shit);
                break;
            case 222:
                maxILArchMageSkills(shit);
                break;
            case 232:
                maxBishopSkills(shit);
                break;
            case 312:
                maxBowMasterSkills(shit);
                break;
            case 322:
                maxCrossBowMasterSkills(shit);
                break;
            case 412:
                maxNightLordSkills(shit);
                break;
            case 422:
                maxShadowerSkills(shit);
                break;
            case 512:
                maxBuccaneerSkills(shit);
                break;
            case 522:
                maxCorsairSkills(shit);
                break;
            case 1111:
                maxDawnWarrior3Skills(shit);
                break;
            case 1211:
                maxBlazeWizard3Skills(shit);
                break;
            case 1311:
                maxWindArcher3Skills(shit);
                break;
            case 1411:
                maxNightWalker3Skills(shit);
                break;
            case 1511:
                maxThunderBreaker3Skills(shit);
                break;
        }
    }

    public void wipeSkills() {
        skills.clear();
    }

    // .....dojo!
    public void mulung_EnergyModify(boolean inc) {
        if (inc) {
            if (dojoenergy + 100 > 10000) {
                dojoenergy = 10000;
            } else {
                dojoenergy += 100;
            }
        } else {
            dojoenergy = 0;
        }
        client.getSession().write(MaplePacketCreator.MulungEnergy(dojoenergy));
    }

    public void writeMulungEnergy() {
        client.getSession().write(MaplePacketCreator.MulungEnergy(dojoenergy));
    }

    public final short getCombo() {
        return combo;
    }

    public void setCombo(final short combo) {
        this.combo = combo;
    }

    public final long getLastCombo() {
        return lastCombo;
    }

    public void setLastCombo(final long combo) {
        this.lastCombo = combo;
    }

    public final long getKeyDownSkill_Time() {
        return keydown_skill;
    }

    public void setKeyDownSkill_Time(final long keydown_skill) {
        this.keydown_skill = keydown_skill;
    }

    public final int getDojoPoints() {
        return dojoPoints;
    }

    public final byte getDojoStage() {
        return lastDojoStage;
    }

    public void setDojoPoints(final int x) {
        this.dojoPoints = x;
    }

    public void setDojoRecord(final boolean reset) {
        if (reset) {
            dojoPoints = 0;
            lastDojoStage = 0;
        } else {
            lastDojoStage++;
        }
    }

    public void resetEnteredScript() {
        if (entered.containsKey(map.getId())) {
            entered.remove(map.getId());
        }
    }

    public void resetEnteredScript(int mapId) {
        if (entered.containsKey(mapId)) {
            entered.remove(mapId);
        }
    }

    public void resetEnteredScript(String script) {
        for (int mapId : entered.keySet()) {
            if (entered.get(mapId).equals(script)) {
                entered.remove(mapId);
            }
        }
    }

    public void enteredScript(String script, int mapid) {
        if (!entered.containsKey(mapid)) {
            entered.put(mapid, script);
        }
    }

    public boolean hasEntered(String script) {
        for (int mapId : entered.keySet()) {
            if (entered.get(mapId).equals(script)) {
                return true;
            }
        }
        return false;
    }

    public boolean hasEntered(String script, int mapId) {
        if (entered.containsKey(mapId)) {
            if (entered.get(mapId).equals(script)) {
                return true;
            }
        }
        return false;
    }

    public int addDojoPointsByMap() {
        int pts = 0;
        int oldpts = dojoPoints;
        pts = 2 + (int) Math.floor(((getMap().getId() - 1) / 100 % 100) / 6);
        if (party != null) {
            pts--;
        }
        if (dojoPoints < 170000) {
            this.dojoPoints += pts;
            checkForBelts(oldpts);
        }
        return pts;
    }

    private void checkForBelts(int oldpts) {
        int[] beltpoints = {1000, 8000, 25000, 60000, 120000};
        int[] belts = {1132000, 1132001, 1132002, 1132003, 1132004};
        int[] stat = {250, 500, 1337, 3337, 13337};
        for (int i = 0; i < beltpoints.length; i++) {
            if (beltpoints[i] < oldpts && dojoPoints >= beltpoints[i] && !haveItem(belts[i], 1, true, true)) {
                MapleInventoryManipulator.addStatItemById(client, belts[i], name, (short) stat[i], (short) 1, (short) 1);
                showMessage(1, "Congratulations on acheiving a belt!");
            }
        }
    }

    public void startMapEffect(String msg, int itemId) {
        startMapEffect(msg, itemId, 30000);
    }

    public void startMapEffect(String msg, int itemId, int duration) {
        final MapleMapEffect mapEffect = new MapleMapEffect(msg, itemId);
        getClient().getSession().write(mapEffect.makeStartData());
        TimerManager.getInstance().schedule(new Runnable() {

            @Override
            public void run() {
                getClient().getSession().write(mapEffect.makeDestroyData());
            }
        }, duration);
    }

    public void startCygnusIntro() {
        client.getSession().write(MaplePacketCreator.CygnusIntroDisableUI(true));
        client.getSession().write(MaplePacketCreator.CygnusIntroLock(true));
        TimerManager.getInstance().schedule(new Runnable() {

            @Override
            public void run() {
                client.getSession().write(MaplePacketCreator.CygnusIntroDisableUI(false));
                client.getSession().write(MaplePacketCreator.CygnusIntroLock(false));
                changeMap(913040006);
            }
        }, 54 * 1000); // 52 second = intro with "Please Help, Be my Knight..." 40 sec = without
    }

    public int getJobRank() {
        return jobrank;
    }

    public int getJobRankMove() {
        return jobrankmove;
    }

    public int getRank() {
        return rank;
    }

    public int getRankMove() {
        return rankmove;
    }

    public int getClantaorank() {
        return clantaorank;
    }

    public int getTaorank() {
        return taorank;
    }

    // autobuffs
    public void rebuff() {
        if (GMSMode > 0 && !isJounin()) {
            dropMessage(5, "[Meow]You could have got rebuff, but you are in GMS mode. So bleh ");
            return;
        }

        if (autobuffs != null) {
            for (int i : autobuffs) {
                SkillFactory.getSkill(i).getEffect(SkillFactory.getSkill(i).getMaxLevel()).applyTo(this);
            }
        } else {
            dropMessage("Looks like you have no buffs stored for Autobuff. Talk to Donation box NPC in Henesys");
        }
    }

    public List<Integer> getAutobuffs() {
        return autobuffs;
    }

    public void addAutobuff(int buff) {
        autobuffs.add(buff);
        autobuffchange = true;
    }

    public void removeAutobuff(int id) {
        autobuffs.remove(id);
        autobuffchange = true;
    }

    // Boss Quest
    public int getBossPoints() {
        return bossPoints;
    }

    public void setBossPoints(int bossPoints) {
        this.bossPoints = bossPoints;
    }

    // MiniGames
    public MapleMiniGame getMapleMiniGame() {
        return miniGame;
    }

    public void setMapleMiniGame(MapleMiniGame miniGame) {
        this.miniGame = miniGame;
    }

    public HiredMerchant getHiredMerchant() {
        return hiredMerchant;
    }

    public void setHasMerchant(boolean set) {
        try {
            PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET HasMerchant = ? WHERE id = ?");
            ps.setInt(1, set ? 1 : 0);
            ps.setInt(2, id);
            ps.executeUpdate();
            ps.close();
        } catch (SQLException e) {
            return;
        }
        hasMerchant = set;
    }

    public void setHiredMerchant(HiredMerchant merchant) {
        this.hiredMerchant = merchant;
    }

    public boolean hasMerchant() {
        return hasMerchant;
    }

    public int getSlot() {
        return slots;
    }

    public void setSlot(int slots) {
        this.slots = slots;
    }

    // Rings
    // fff
    public int getEquippedRing(int type) {
        for (IItem item : getInventory(MapleInventoryType.EQUIPPED)) {
            IEquip equip = (IEquip) item;
            if (equip.getRingId() > 0) {
                int itemId = equip.getItemId();
                if ((itemId >= 1112001 && itemId <= 1112007 || itemId == 1112012) && type == 0) {
                    return equip.getRingId();
                }
                if (itemId >= 1112800 && itemId <= 1112802 && type == 1) {
                    return equip.getRingId();
                }
                if ((itemId >= 1112803 && itemId <= 1112807 || itemId == 1112809) && type == 2) {
                    return equip.getRingId();
                }
            }
        }
        return 0;
    }

    public boolean isRingEquipped(int ringId) {
        for (IItem item : getInventory(MapleInventoryType.EQUIPPED)) {
            IEquip equip = (IEquip) item;
            if (equip.getRingId() == ringId) {
                return equip.getPosition() <= (byte) -1;
            }
        }
        return false;
    }

    public List<MapleRing> getCrushRings() {
        Collections.sort(crushRings);
        return crushRings;
    }

    public List<MapleRing> getFriendshipRings() {
        Collections.sort(friendshipRings);
        return friendshipRings;
    }

    public List<MapleRing> getMarriageRings() {
        Collections.sort(marriageRings);
        return marriageRings;
    }

    public void addRingToCache(int ringId) {
        MapleRing ring = MapleRing.loadFromDb(ringId);
        if (ring.getItemId() >= 1112001 && ring.getItemId() <= 1112007 || ring.getItemId() == 1112012) {
            if (ring != null) {
                crushRings.add(ring);
            }
        } else if (ring.getItemId() >= 1112800 && ring.getItemId() <= 1112802) {
            if (ring != null) {
                friendshipRings.add(ring);
            }
        } else if (ring.getItemId() >= 1112803 && ring.getItemId() <= 1112807 || ring.getItemId() == 1112809) {
            if (ring != null) {
                marriageRings.add(ring);
            }
        }
    }

    public void relog() {
        client.getSession().write(MaplePacketCreator.getCharInfo(this));
        getMap().removePlayer(this);
        getMap().addPlayer(this);
    }

    public final byte getVillage() {
        return village;
    }

    public void setVillage(final byte lol) {
        this.village = lol;
    }

    public final byte getTextColour() {
        return textColour;
    }

    public void setTextColour(final byte textColour) {
        this.textColour = textColour;
    }

    public String getFootnote() {
        return footnote;
    }

    public void addFootnote(String note) {
        StringBuilder sb = new StringBuilder();
        if (footnote != null) {
            sb.append(this.footnote);
        }
        sb.append(note);
        sb.append(" || ");
        footnote = sb.toString();
    }

    public byte getMission() {
        return mission;
    }

    public void missionComplete() {
        this.mission++;
    }

    // Item Filter
    public ArrayList<Integer> getExcluded() {
        return excluded;
    }

    public void addExcluded(int x) {
        excluded.add(x);
    }

    // KPQ Points
    public int getKpqpoints() {
        return kpqpoints;
    }

    public void gainKpqpoints() {
        kpqpoints++;
    }

    public void setKpqpoints(int kpqpoints) {
        this.kpqpoints = kpqpoints;
    }

    public int getLmpoints() {
        return lmpoints;
    }

    public void setLmpoints(int lmpoints) {
        this.lmpoints = lmpoints;
    }

    public void addLmpoints() {
        lmpoints++;
    }

    public void startHurtHp() {
        hpDecreaseTask = TimerManager.getInstance().register(new Runnable() {

            @Override
            public void run() {
                if (map.getHPDec() < 1 || !isAlive()) {
                    return;
                } else if (getInventory(MapleInventoryType.EQUIPPED).findById(map.getHPDecProtect()) == null) {
                    addHP(-map.getHPDec());
                }
            }
        }, 10000);
    }

    public void setMonsterBookCover(int bookCover) {
        this.bookCover = bookCover;
    }

    public int getMonsterBookCover() {
        return bookCover;
    }

    public MonsterBook getMonsterBook() {
        return monsterbook;
    }

    public IMaplePlayerShop getPlayerShop() {
        return playerShop;
    }

    public void setPlayerShop(IMaplePlayerShop playerShop) {
        this.playerShop = playerShop;
    }

    public int getConversation() {
        return inst.get();
    }

    public void setConversation(int inst) {
        this.inst.set(inst);
    }

    public MapleCarnivalParty getCarnivalParty() {
        return carnivalParty;
    }

    public void setCarnivalParty(MapleCarnivalParty party) {
        carnivalParty = party;
    }

    public void addCP(int ammount) {
        totalCP += ammount;
        availableCP += ammount;
    }

    public void useCP(int ammount) {
        availableCP -= ammount;
    }

    public int getAvailableCP() {
        return availableCP;
    }

    public int getTotalCP() {
        return totalCP;
    }

    public void resetCP() {
        totalCP = 0;
        availableCP = 0;
    }

    public void addCarnivalRequest(MapleCarnivalChallenge request) {
        pendingCarnivalRequests.add(request);
    }

    public final MapleCarnivalChallenge getNextCarnivalRequest() {
        return pendingCarnivalRequests.pollLast();
    }

    public void clearCarnivalRequests() {
        pendingCarnivalRequests = new LinkedList<MapleCarnivalChallenge>();
    }

    public void startMonsterCarnival(final int enemyavailable, final int enemytotal) {
        client.getSession().write(MonsterCarnivalPacket.startMonsterCarnival(this, enemyavailable, enemytotal));
    }

    public void CPUpdate(final boolean party, final int available, final int total, final int team) {
        client.getSession().write(MonsterCarnivalPacket.CPUpdate(party, available, total, team));
    }

    public void playerDiedCPQ(final String name, final int lostCP, final int team) {
        client.getSession().write(MonsterCarnivalPacket.playerDiedMessage(name, lostCP, team));
    }

    public int[] getRocks() {
        return rocks;
    }

    public int getRockSize() {
        int ret = 0;
        for (int i = 0; i < 10; i++) {
            if (rocks[i] > 0) {
                ret++;
            }
        }
        return ret;
    }

    public void deleteFromRocks(int map) {
        for (int i = 0; i < 10; i++) {
            if (rocks[i] == map) {
                rocks[i] = -1;
                break;
            }
        }
    }

    public void addRockMap() {
        if (getRockSize() >= 10) {
            return;
        }
        rocks[getRockSize()] = getMapId();
    }

    public boolean isRockMap(int id) {
        for (int i = 0; i < 10; i++) {
            if (rocks[i] == id) {
                return true;
            }
        }
        return false;
    }

    public int[] getWishlist() {
        return wishlist;
    }

    public void clearWishlist() {
        for (int i = 0; i < 10; i++) {
            wishlist[i] = 0;
        }
    }    

    public int getWishlistSize() {
        int ret = 0;
        for (int i = 0; i < 10; i++) {
            if (wishlist[i] > 0) {
                ret++;
            }
        }