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.




  • Posts

    • My official facebook profile!: https://www.facebook.com/spectrumL2 Specifications: Revamped L2JACIS revision FROM the core Private project!!! Revision that has been receiving corrections for over 3 years!!! Events already installed in the revision: TVT CTF KTB PARTY FARM SPOIL EVENT CRAZY RATES TOURNAMENT TIME ZONE (INSTANCE) All working correctly!!! SIEGE ESSENTIAL FEATURES: Walls fix Gates fix Flags fix 100% functional: OLYMPIADS: Implemented settings Hero receives enchanted Weapons with equal status PvP Weapons Optional /true/false Hero can acquire all Hero Weapons Optional true/false OTHER IMPLEMENTATIONS: Teleport fixed (directly to Giran) Teleport effect classic Vip skins vip collor name Pack NPCs with effect already configured BOSES already configured Mobs already configured CLASS BALANCE SPECIAL SYSTEM We have a SPECIAL system developed for Class Balance with only 1 digit in XML %tage of configurable debuffs Player limitation system in BOSES or PvP zones BS blocking system in FLEG zones or events Among others dozens of improvements made in the review... price: 390 USD !  OBS: WE CAN CHANGE THE BANNER AND NAME OF THE SERVICE TO THE ONE OF YOUR PREFERENCE BUT THE SETTINGS MUST BE KEPT ANY CHANGES REQUIRE ADDITION        
    • Server is Online – 1,000+ Active Players! We’re excited to announce the addition of a Europe Proxy to improve connectivity for our EU players! Clans can now benefit from VIP Access to help you catch up faster. 🎯 If you're a clan leader with at least 9 active members, join our Discord and open a ticket to claim your VIP rewards!  
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock