From 61e2812d206a47b981b8d36d902e549a2af599ce Mon Sep 17 00:00:00 2001
From: Adry_85 <Adrya85@hotmail.it>
Date: Thu, 12 Sep 2013 11:41:32 +0000
Subject: [PATCH] BETA: Removed some itemhandlers not used anymore. 
 Reviewed by: jurchiks, Nos, UnAfraid

---
 .../data/scripts/handlers/MasterHandler.java  | 34 ++++---
 .../handlers/itemhandlers/BeastSpice.java     | 63 -------------
 .../handlers/itemhandlers/ChristmasTree.java  | 88 -------------------
 .../handlers/itemhandlers/QuestItems.java     | 69 ---------------
 .../game/data/stats/items/06600-06699.xml     |  4 +-
 5 files changed, 18 insertions(+), 240 deletions(-)
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/BeastSpice.java
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/ChristmasTree.java
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/QuestItems.java

diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java
index 14f53b38e4..326932b404 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java
@@ -171,7 +171,6 @@ import handlers.chathandlers.ChatShout;
 import handlers.chathandlers.ChatTell;
 import handlers.chathandlers.ChatTrade;
 import handlers.itemhandlers.BeastSoulShot;
-import handlers.itemhandlers.BeastSpice;
 import handlers.itemhandlers.BeastSpiritShot;
 import handlers.itemhandlers.BlessedSpiritShot;
 import handlers.itemhandlers.Book;
@@ -458,37 +457,36 @@ public class MasterHandler
 		},
 		{
 			// Item Handlers
-			SoulShots.class,
-			SpiritShot.class,
-			BlessedSpiritShot.class,
 			BeastSoulShot.class,
 			BeastSpiritShot.class,
+			BlessedSpiritShot.class,
+			Book.class,
 			Bypass.class,
 			Calculator.class,
-			Maps.class,
-			NicknameColor.class,
-			Recipes.class,
-			RollingDice.class,
+			Disguise.class,
+			Elixir.class,
 			EnchantAttribute.class,
 			EnchantScrolls.class,
+			EventItem.class,
 			ExtractableItems.class,
-			Book.class,
-			SevenSignsRecord.class,
+			FishShots.class,
+			Harvester.class,
 			ItemSkills.class,
 			ItemSkillsTemplate.class,
-			Seed.class,
-			Harvester.class,
+			ManaPotion.class,
+			Maps.class,
 			MercTicket.class,
-			FishShots.class,
+			NicknameColor.class,
 			PetFood.class,
+			Recipes.class,
+			RollingDice.class,
+			Seed.class,
+			SevenSignsRecord.class,
+			SoulShots.class,
 			SpecialXMas.class,
+			SpiritShot.class,
 			SummonItems.class,
-			BeastSpice.class,
 			TeleportBookmark.class,
-			Elixir.class,
-			Disguise.class,
-			ManaPotion.class,
-			EventItem.class,
 		},
 		{
 			// Punishment Handlers
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/BeastSpice.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/BeastSpice.java
deleted file mode 100644
index 287baea4e8..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/BeastSpice.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2004-2013 L2J DataPack
- * 
- * This file is part of L2J DataPack.
- * 
- * L2J DataPack 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.
- * 
- * L2J DataPack 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 handlers.itemhandlers;
-
-import java.util.logging.Level;
-
-import com.l2jserver.gameserver.handler.IItemHandler;
-import com.l2jserver.gameserver.model.actor.L2Playable;
-import com.l2jserver.gameserver.model.actor.instance.L2FeedableBeastInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.holders.SkillHolder;
-import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
-import com.l2jserver.gameserver.network.SystemMessageId;
-
-public class BeastSpice implements IItemHandler
-{
-	@Override
-	public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
-	{
-		if (!playable.isPlayer())
-		{
-			playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS);
-			return false;
-		}
-		
-		final L2PcInstance activeChar = playable.getActingPlayer();
-		final SkillHolder[] skills = item.getItem().getSkills();
-		
-		if (skills == null)
-		{
-			_log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!");
-			return false;
-		}
-		
-		if (!(activeChar.getTarget() instanceof L2FeedableBeastInstance))
-		{
-			activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
-			return false;
-		}
-		
-		for (SkillHolder sk : skills)
-		{
-			activeChar.useMagic(sk.getSkill(), false, false);
-		}
-		return true;
-	}
-}
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/ChristmasTree.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/ChristmasTree.java
deleted file mode 100644
index 8e1f47072d..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/ChristmasTree.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2004-2013 L2J DataPack
- * 
- * This file is part of L2J DataPack.
- * 
- * L2J DataPack 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.
- * 
- * L2J DataPack 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 handlers.itemhandlers;
-
-import com.l2jserver.gameserver.datatables.NpcTable;
-import com.l2jserver.gameserver.handler.IItemHandler;
-import com.l2jserver.gameserver.model.L2Object;
-import com.l2jserver.gameserver.model.L2Spawn;
-import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.L2Playable;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
-import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
-import com.l2jserver.gameserver.network.SystemMessageId;
-
-public class ChristmasTree implements IItemHandler
-{
-	@Override
-	public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
-	{
-		if (!playable.isPlayer())
-		{
-			playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS);
-			return false;
-		}
-		
-		L2PcInstance activeChar = playable.getActingPlayer();
-		L2NpcTemplate template1 = null;
-		
-		switch (item.getId())
-		{
-			case 5560:
-				template1 = NpcTable.getInstance().getTemplate(13006);
-				break;
-			case 5561:
-				template1 = NpcTable.getInstance().getTemplate(13007);
-				break;
-		}
-		
-		if (template1 == null)
-		{
-			return false;
-		}
-		
-		L2Object target = activeChar.getTarget();
-		if (target == null)
-		{
-			target = activeChar;
-		}
-		
-		try
-		{
-			L2Spawn spawn = new L2Spawn(template1);
-			spawn.setX(target.getX());
-			spawn.setY(target.getY());
-			spawn.setZ(target.getZ());
-			spawn.setInstanceId(activeChar.getInstanceId());
-			L2Npc npc = spawn.spawnOne(false);
-			npc.setSummoner(activeChar);
-			
-			activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
-			
-			activeChar.sendMessage("Created " + template1.getName() + " at x: " + spawn.getX() + " y: " + spawn.getY() + " z: " + spawn.getZ());
-			return true;
-		}
-		catch (Exception e)
-		{
-			activeChar.sendPacket(SystemMessageId.TARGET_CANT_FOUND);
-			return false;
-		}
-	}
-}
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/QuestItems.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/QuestItems.java
deleted file mode 100644
index 901fbdb66c..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/QuestItems.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2004-2013 L2J DataPack
- * 
- * This file is part of L2J DataPack.
- * 
- * L2J DataPack 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.
- * 
- * L2J DataPack 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 handlers.itemhandlers;
-
-import com.l2jserver.gameserver.handler.IItemHandler;
-import com.l2jserver.gameserver.model.actor.L2Playable;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.items.L2Item;
-import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
-import com.l2jserver.gameserver.model.quest.Quest;
-import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.network.SystemMessageId;
-
-/**
- * @author BiggBoss
- */
-public class QuestItems implements IItemHandler
-{
-	@Override
-	public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceuse)
-	{
-		if (!playable.isPlayer())
-		{
-			playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS);
-			return false;
-		}
-		
-		L2PcInstance player = playable.getActingPlayer();
-		if (!player.destroyItem("Item Handler - QuestItems", item, player, true))
-		{
-			return false;
-		}
-		
-		final L2Item itm = item.getItem();
-		if (itm.getQuestEvents() == null)
-		{
-			_log.warning(QuestItems.class.getSimpleName() + ": Null list for item handler QuestItems!");
-			return false;
-		}
-		
-		for (Quest quest : itm.getQuestEvents())
-		{
-			QuestState state = player.getQuestState(quest.getName());
-			if ((state == null) || !state.isStarted())
-			{
-				continue;
-			}
-			
-			quest.notifyItemUse(itm, player);
-		}
-		return true;
-	}
-}
diff --git a/L2J_DataPack_BETA/dist/game/data/stats/items/06600-06699.xml b/L2J_DataPack_BETA/dist/game/data/stats/items/06600-06699.xml
index 15233ad464..ce0a35efc0 100644
--- a/L2J_DataPack_BETA/dist/game/data/stats/items/06600-06699.xml
+++ b/L2J_DataPack_BETA/dist/game/data/stats/items/06600-06699.xml
@@ -884,7 +884,7 @@
 		<set name="price" val="50" />
 		<set name="is_stackable" val="true" />
 		<set name="is_oly_restricted" val="true" />
-		<set name="handler" val="BeastSpice" />
+		<set name="handler" val="ItemSkills" />
 		<set name="item_skill" val="2188-1" />
 	</item>
 	<item id="6644" type="EtcItem" name="Old Crystal Spice">
@@ -895,7 +895,7 @@
 		<set name="price" val="50" />
 		<set name="is_stackable" val="true" />
 		<set name="is_oly_restricted" val="true" />
-		<set name="handler" val="BeastSpice" />
+		<set name="handler" val="ItemSkills" />
 		<set name="item_skill" val="2189-1" />
 	</item>
 	<item id="6645" type="EtcItem" name="Beast Soulshot">
-- 
GitLab