Jump to content

[Share]Get Class Items With Commands.


Recommended Posts

Hello!

Όταν ένας player πατάει .daggeritems, τότε παίρνει Dagger weapon,armor,jewls.

Commands: .daggeritems / .bowitems / .tankitems / .mageitems

 

config:
# Specified reward item rnd qty
ChampionRewardItemQty = 1
+
+#------------------------------------------------------------------
+# Class Items.
+# .daggeritems / .bowitems / .tankitems / .mageitems                
+#------------------------------------------------------------------
+ClassItemsCmd = false
+#
+FighterItemsPirce = 50000000
+#
+MageItemsPirce = 50000000
+
=====
Index: sf/l2j/config.java
       public static int L2JMOD_CHAMPION_REWARD_QTY;
+    public static boolean CLASS_ITEMS_ENABLE;
+    public static int FIGHTER_ITEMS_PRICE;
+    public static int MAGE_ITEMS_PRICE;


                  L2JMOD_CHAMPION_REWARD_QTY            = Integer.parseInt(L2JModSettings.getProperty("ChampionRewardItemQty", "1"));
+                CLASS_ITEMS_ENABLE             = Boolean.parseBoolean(L2JModSettings.getProperty("ClassItemsCmd", "false"));
+                FIGHTER_ITEMS_PRICE            = Integer.parseInt(L2JModSettings.getProperty("FighterItemsPirce", "50000000"));
+                MAGE_ITEMS_PRICE            = Integer.parseInt(L2JModSettings.getProperty("MageItemsPirce", "50000000"));


=====
Index: net.sf.l2j.gameserver.handler.VoicedCommandHandler.java

import java.util.logging.Logger;

+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.LevelZones;

import javolution.util.FastMap;


private VoicedCommandHandler()
{
	_datatable = new FastMap<String, IVoicedCommandHandler>();
+
+	if(Config.CLASS_ITEMS_ENABLE)
+		{
+			registerVoicedCommandHandler(new ClassItems());
+		}
}

public void registerVoicedCommandHandler(IVoicedCommandHandler handler)

 

Εδώ δημιουργούμε ένα νέο Class με όνομα ClassItems.java

=====
Index: net.sf.l2j.gameserver.handler.voicedcommandhandlers.ClassItems.java

/*
* 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 net.sf.l2j.gameserver.handler.voicedcommandhandlers;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.ItemList;

public class ClassItems implements IVoicedCommandHandler
{
private static String[] _voicedCommands =
{
		"daggeritems", "bowitems", "tankitems", "mageitems"
};

/**
 * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String,
 *      net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
 */
@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{

	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.getInventory().updateDatabase();
			activeChar.sendPacket(new ItemList(activeChar, true));
			activeChar.sendMessage("Now You Have Dagger Items On Your Invetory. Take a Look!.");
		}
		else
		{
			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("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.getInventory().updateDatabase();
			activeChar.sendPacket(new ItemList(activeChar, true));
			activeChar.sendMessage("Now You Have Bow Items On Your Invetory. Take a Look!.");
		}
		else
		{
			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("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.getInventory().updateDatabase();
			activeChar.sendPacket(new ItemList(activeChar, true));
			activeChar.sendMessage("Now You Have Tank Items On Your Invetory. Take a Look!.");
		}
		else
		{
			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;
		}
	}
	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.getInventory().updateDatabase();
			activeChar.sendPacket(new ItemList(activeChar, true));
			activeChar.sendMessage("Now You Have Mage Items On Your Invetory. Take a Look!");
		}
		else
		{
			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;
		}
	}
	return true;
}

/**
 * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
 */
@Override
public String[] getVoicedCommandList()
{
	return _voicedCommands;
}
}

Link to comment
Share on other sites

Anyway Thanks for sharing it BaGGos !

 

Keep Sharing :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...