Jump to content

Recommended Posts

Posted (edited)

You miss brackets in some places and 1st msg about adena umm..

 

Ofc it is working, cuz you do meet the requirements, so the check msg was not activated.

Give a try here.. But like that i have 1 error on last line of the code.

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * 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 General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jfrozen.gameserver.handler;
 
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
 
public class ClassItems implements IVoicedCommandHandler
{
        private static String[] _voicedCommands =
        {
                        "daggeritems", "bowitems", "tankitems", "mageitems"
        };
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler(java.lang.String,
         *      com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
         */
        @Override
        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
            {
                activeChar.sendMessage("You do not have enough Adena");
        }
        if(activeChar.isInOlympiadMode())
        {
                activeChar.sendMessage("Sorry,you are in the Olympiad now.");
                return false;
        }
        else if(activeChar.isInDuel())
        {
                activeChar.sendMessage("Sorry,you are in a duel!");
                return false;
        }
        else if(activeChar.atEvent)
        {
                activeChar.sendMessage("Sorry,you are on event now.");
                return false;
        }
        else if(!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)
        {
                activeChar.sendMessage("Sorry,PK player can't use this.");
                return false;
        }
        else if(activeChar.isDead())
        {
                activeChar.sendMessage("Sorry,Dead player can't take items.");                 
                return false;
        }
        else if(activeChar.isFakeDeath())
        {
                activeChar.sendMessage("Sorry,on fake death mode can't use this.");
                return false;
        }
                if(command.equalsIgnoreCase("daggeritems"))
                {
                        if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
                        {
                                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                                activeChar.getInventory().addItem("Angel Slayer", 6367, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("Dragonic Light", 6379, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("Dragonic Boots", 6380, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("Dragonic Gloves", 6381, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("Dragonic Helmet", 6382, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                                activeChar.sendMessage("Now You Have Dagger Items On Your Invetory. Take a Look!.");
                }
                if(command.equalsIgnoreCase("bowitems"))
                {
                        if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
                        {
                                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                                activeChar.getInventory().addItem("Draconic Bow", 7577, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("Draconic Light", 6379, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("Draconic Boots", 6380, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("Draconic Gloves", 6381, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("Draconic Helmet", 6382, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                                activeChar.sendMessage("Now You Have Bow Items On Your Invetory. Take a Look!.");

                }
                if(command.equalsIgnoreCase("tankitems"))
                {
                        if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
                        {
                                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                                activeChar.getInventory().addItem("Forgotten Blade", 6582, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("Imperial Armor", 6373, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("Imperial ArmorP2", 6374, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("Imperial Gloves", 6375, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("Imperial Boots", 6376, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("Imperial Helmet", 6378, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                                activeChar.sendMessage("Now You Have Tank Items On Your Invetory. Take a Look!.");
                }
                else if(command.equalsIgnoreCase("mageitems"))
                {
                        if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.MAGE_ITEMS_PRICE)
                        {
                                activeChar.getInventory().destroyItemByItemId("Adena", 57, Config.MAGE_ITEMS_PRICE, activeChar, null);
                                activeChar.getInventory().addItem("Arcana Mace Acumen", 6608, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("DC Robe", 2407, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("DC Gloves", 5767, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("DC Boots", 5779, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("DC Helmet", 512, 1, activeChar, activeChar);
                                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                                activeChar.sendMessage("Now You Have Mage Items On Your Invetory. Take a Look!");
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
         */
        @Override
        public String[] getVoicedCommandList()
        {
                return _voicedCommands;
        }
}
Edited by 'Baggos'
Posted

 

            {
                activeChar.sendMessage("You do not have enough Adena");

 

To be removed. Also, in all commands you miss the close bracket of if }

Posted (edited)

Also the useVoicedCommand is a boolean, so it should return true somewhere ^_^

Edited by Tessa
Posted

And 100000 time to be shared the credits is MINE from the past. (2012).

2st, this code worked on Original L2Network project perfect. Work to me before share. and 3st, what is reput? reput is for kids. i share for help no for "reput".

I come back here on maxcheaters and i want to remmember all that i know.

This code give items with commands.

If you start a new player, you need to go in main town/Gm Shop and will buy this items. why you consider useless this topic? in one second you have all items you want for start your farm. mage or fighter or tank or bow, and jewels.

If is not work to you give me your error here...

Sorry for my english...

no need apologize for your english lol :D i just i find this useless cause already shared many times i didnt say its not yours

Posted

Also the useVoicedCommand is a boolean, so it should return true somewhere ^_^

Too many error if i change something in code.

I'll not change something. It's work like that. I can't find a way to work without all this check.

 

If someone can to make this code work without all this check, then give here to help. I have 2 year to see a code.

in the past on L2Network Project, this code helped a lot.

Posted (edited)

Too many error if i change something in code.

I'll not change something. It's work like that. I can't find a way to work without all this check.

 

If someone can to make this code work without all this check, then give here to help. I have 2 year to see a code.

in the past on L2Network Project, this code helped a lot.

You should put these checks only once and you will have a clean code.

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * 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 General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
 
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
 
public class ClassItems implements IVoicedCommandHandler
{
        private static String[] _voicedCommands =
        {
                        "daggeritems", "bowitems", "tankitems", "mageitems"
        };
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler(java.lang.String,
         *      com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
         */
        @Override
        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
            if(activeChar.getInventory().getInventoryItemCount(57, 0) < Config.FIGHTER_ITEMS_PRICE)
            {
                        activeChar.sendMessage("You do not have enough Adena");
                        return false;
            }

            if (activeChar.isInOlympiadMode())
            {
                        activeChar.sendMessage("Sorry,you are in the Olympiad now.");
                        return false;
            }
            else if (activeChar.isInDuel())
            {
                        activeChar.sendMessage("Sorry,you are in a duel!");
                        return false;
            }
            else if (activeChar.atEvent)
            {
                        activeChar.sendMessage("Sorry,you are on event now.");
                        return false;
            }
            else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)
            {
                        activeChar.sendMessage("Sorry,PK player can't use this.");
                        return false;
            }
            else if (activeChar.isDead())
            {
                        activeChar.sendMessage("Sorry,Dead player can't take items.");                 
                        return false;
            }
            else if (activeChar.isFakeDeath())
            {
                        activeChar.sendMessage("Sorry,on fake death mode can't use this.");
                        return false;
            }
            if(command.equalsIgnoreCase("daggeritems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Angel Slayer", 6367, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Dagger Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("bowitems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Draconic Bow", 7577, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Draconic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Draconic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Draconic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Draconic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Bow Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("tankitems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Forgotten Blade", 6582, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Armor", 6373, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Imperial ArmorP2", 6374, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Gloves", 6375, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Imperial Boots", 6376, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Helmet", 6378, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Tank Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("mageitems"))
            {
                activeChar.getInventory().destroyItemByItemId("Adena", 57, Config.MAGE_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Arcana Mace Acumen", 6608, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("DC Robe", 2407, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("DC Gloves", 5767, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("DC Boots", 5779, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("DC Helmet", 512, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Mage Items On Your Invetory. Take a Look!");
            }
            return true;
        }
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
         */
        @Override
        public String[] getVoicedCommandList()
        {
                return _voicedCommands;
        }
}
Edited by Tessa
Posted (edited)

 

You should put these checks only once and you will have a clean code.

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * 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 General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
 
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
 
public class ClassItems implements IVoicedCommandHandler
{
        private static String[] _voicedCommands =
        {
                        "daggeritems", "bowitems", "tankitems", "mageitems"
        };
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler(java.lang.String,
         *      com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
         */
        @Override
        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
            if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
            {
                        activeChar.sendMessage("You do not have enough Adena");
                        return false;
            }
            if(activeChar.isInOlympiadMode())
            {
                        activeChar.sendMessage("Sorry,you are in the Olympiad now.");
                        return false;
            }
            if(activeChar.isInDuel())
            {
                        activeChar.sendMessage("Sorry,you are in a duel!");
                        return false;
            }
            if(activeChar.atEvent)
            {
                        activeChar.sendMessage("Sorry,you are on event now.");
                        return false;
            }
            if(!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)
            {
                        activeChar.sendMessage("Sorry,PK player can't use this.");
                        return false;
            }
            if(activeChar.isDead())
            {
                        activeChar.sendMessage("Sorry,Dead player can't take items.");                 
                        return false;
            }
            if(activeChar.isFakeDeath())
            {
                        activeChar.sendMessage("Sorry,on fake death mode can't use this.");
                        return false;
            }
            if(command.equalsIgnoreCase("daggeritems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Angel Slayer", 6367, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Dagger Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("bowitems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Draconic Bow", 7577, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Draconic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Draconic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Draconic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Draconic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Bow Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("tankitems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Forgotten Blade", 6582, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Armor", 6373, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Imperial ArmorP2", 6374, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Gloves", 6375, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Imperial Boots", 6376, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Helmet", 6378, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Tank Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("mageitems"))
            {
                activeChar.getInventory().destroyItemByItemId("Adena", 57, Config.MAGE_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Arcana Mace Acumen", 6608, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("DC Robe", 2407, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("DC Gloves", 5767, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("DC Boots", 5779, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("DC Helmet", 512, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Mage Items On Your Invetory. Take a Look!");
            }
            return true;
        }
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
         */
        @Override
        public String[] getVoicedCommandList()
        {
                return _voicedCommands;
        }
}

I have try with this and before, and i take error on the last line before "return true".

But i have problem with my eclipse... maybe here is the problem...

Edited by 'Baggos'
Posted

I have try with this and before, and i take error on the last line before "return true".

But i have problem with my eclipse... maybe here is the problem...

Yes Tessa... Is right. Thank you. I realized my mistake.

Posted (edited)
if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
{
activeChar.sendMessage("You do not have enough Adena");
return false;
}

Tessa... Seriously '>=' ? :happyforever:

 

Also, those checks should be if, else if. There is no need to check them all ++ you will get few messages.

Edited by SweeTs
Posted (edited)
if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
{
activeChar.sendMessage("You do not have enough Adena");
return false;
}

Tessa... Seriously '>=' ? :happyforever:

 

Also, those checks should be if, else if. There is no need to check them all ++ you will get few messages.

 

I've copied one of the checks in the pastebin version :lol:

I've no idea what happened to the else if because they was ok in the editor :|

 

EDIT: Fixed ^_^

Edited by Tessa
Posted
if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
{
activeChar.sendMessage("You do not have enough Adena");
return false;
}

Tessa... Seriously '>=' ? :happyforever:

 

Also, those checks should be if, else if. There is no need to check them all ++ you will get few messages.

 

I have change something here.. Is still wrong like that?

 

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * 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 General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
 
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
 
public class ClassItems implements IVoicedCommandHandler
{
        private static String[] _voicedCommands =
        {
                        "daggeritems", "bowitems", "tankitems", "mageitems"
        };
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler(java.lang.String,
         *      com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
         */
        @SuppressWarnings("javadoc")
        @Override
        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
            if(activeChar.isInOlympiadMode())
            {
                        activeChar.sendMessage("Sorry,you are in the Olympiad now.");
                        return false;
            }
            if(activeChar.isInDuel())
            {
                        activeChar.sendMessage("Sorry,you are in a duel!");
                        return false;
            }
            if(activeChar.atEvent)
            {
                        activeChar.sendMessage("Sorry,you are on event now.");
                        return false;
            }
            if(!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)
            {
                        activeChar.sendMessage("Sorry,PK player can't use this.");
                        return false;
            }
            if(activeChar.isDead())
            {
                        activeChar.sendMessage("Sorry,Dead player can't take items.");                 
                        return false;
            }
            if(activeChar.isFakeDeath())
            {
                        activeChar.sendMessage("Sorry,on fake death mode can't use this.");
                        return false;
            }
            if(command.equalsIgnoreCase("daggeritems"))
            {
            }
                if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
                {    
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Angel Slayer", 6367, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Dagger Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("bowitems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Draconic Bow", 7577, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Draconic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Draconic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Draconic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Draconic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Bow Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("tankitems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Forgotten Blade", 6582, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Armor", 6373, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Imperial ArmorP2", 6374, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Gloves", 6375, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Imperial Boots", 6376, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Helmet", 6378, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Tank Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("mageitems"))
            {
                if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.MAGE_ITEMS_PRICE)
            {
                activeChar.getInventory().destroyItemByItemId("Adena", 57, Config.MAGE_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Arcana Mace Acumen", 6608, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("DC Robe", 2407, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("DC Gloves", 5767, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("DC Boots", 5779, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("DC Helmet", 512, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Mage Items On Your Invetory. Take a Look!");
                activeChar.sendMessage("You do not have enough Adena");
                return false;
            }
            return true;
        }
                return false;
        }
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
         */
        @Override
        public String[] getVoicedCommandList()
        {
                return _voicedCommands;
        }
}
Posted (edited)

Yes, it's wrong .. :happyforever: Also, this check is kinda.. poor to don't be rude

 

 

if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)

 

Delete the config check

Edited by SweeTs
Posted

Yes, it's wrong .. :happyforever: Also, this check is kinda.. poor to don't be rude

if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)

Delete the config check

What is right for you?

i have pass check for adena Mage and fighter items.

I don't say about this line "if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)".

only for check in adena, why is wrong?

Posted

That's plain wrong and few more. Enable errors on Eclipse and you will see it :)

 

 

        @SuppressWarnings("javadoc")
 
------------------
 
            if(command.equalsIgnoreCase("daggeritems"))
            {
            }
                if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
                {    
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Angel Slayer", 6367, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Dagger Items On Your Invetory. Take a Look!.");
            }
 
-----
 
        }
                return false;

 

Basically, I should junk the topic, cuz of the code, but.. Out of respect for you, I won't.

 

Check Tessa version, it's good. Only checks should be if / else if.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...