Sfoglia il codice sorgente

BETA: Data Pack for [L6668]

Zealar 10 anni fa
parent
commit
5100a607e4
31 ha cambiato i file con 454 aggiunte e 525 eliminazioni
  1. 1 7
      L2J_DataPack_BETA/dist/game/config/adminCommands.xml
  2. 19 0
      L2J_DataPack_BETA/dist/game/data/html/admin/manor.htm
  3. 0 9
      L2J_DataPack_BETA/dist/game/data/html/manormanager/manor_client_help001.htm
  4. 0 11
      L2J_DataPack_BETA/dist/game/data/html/manormanager/manor_client_help002.htm
  5. 0 4
      L2J_DataPack_BETA/dist/game/data/html/manormanager/manormanager-show-procure.htm
  6. 1 0
      L2J_DataPack_BETA/dist/game/data/scripts.cfg
  7. 79 26
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleChamberlain/CastleChamberlain.java
  8. 3 3
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleChamberlain/manor.html
  9. 14 12
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleMercenaryManager/CastleMercenaryManager.java
  10. 162 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/ManorManager.java
  11. 9 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager-help-01.htm
  12. 12 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager-help-02.htm
  13. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager-help-03.htm
  14. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager-lord.htm
  15. 4 4
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager.htm
  16. 0 2
      L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java
  17. 18 123
      L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminManor.java
  18. 0 152
      L2J_DataPack_BETA/dist/game/data/scripts/handlers/bypasshandlers/ManorManager.java
  19. 44 78
      L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Harvesting.java
  20. 11 16
      L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Sow.java
  21. 11 18
      L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/Harvester.java
  22. 17 28
      L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/Seed.java
  23. 3 3
      L2J_DataPack_BETA/dist/game/data/stats/npcs/35100-35200.xml
  24. 4 4
      L2J_DataPack_BETA/dist/game/data/stats/npcs/35200-35300.xml
  25. 2 2
      L2J_DataPack_BETA/dist/game/data/stats/npcs/35300-35400.xml
  26. 2 2
      L2J_DataPack_BETA/dist/game/data/stats/npcs/35500-35600.xml
  27. 2 2
      L2J_DataPack_BETA/dist/game/data/stats/npcs/35600-35700.xml
  28. 1 1
      L2J_DataPack_BETA/dist/game/data/stats/npcs/36400-36500.xml
  29. 8 8
      L2J_DataPack_BETA/dist/sql/game/castle_manor_procure.sql
  30. 7 7
      L2J_DataPack_BETA/dist/sql/game/castle_manor_production.sql
  31. 16 0
      L2J_DataPack_BETA/dist/sql/game/updates/20140907update.sql

+ 1 - 7
L2J_DataPack_BETA/dist/game/config/adminCommands.xml

@@ -364,13 +364,7 @@
 
 	<!-- ADMIN MANOR -->
 	<admin command="admin_manor" accessLevel="7" />
-	<admin command="admin_manor_approve" accessLevel="7" />
-	<admin command="admin_manor_setnext" accessLevel="7" />
-	<admin command="admin_manor_reset" accessLevel="7" />
-	<admin command="admin_manor_setmaintenance" accessLevel="7" />
-	<admin command="admin_manor_save" accessLevel="7" />
-	<admin command="admin_manor_disable" accessLevel="7" />
-
+	
 	<!-- ADMIN MENU -->
 	<admin command="admin_char_manage" accessLevel="7" />
 	<admin command="admin_teleport_character_to_menu" accessLevel="7" />

+ 19 - 0
L2J_DataPack_BETA/dist/game/data/html/admin/manor.htm

@@ -0,0 +1,19 @@
+<html><title>Manor Info</title><body>
+<table width=270>
+<tr>
+<td width=45><button value="Main" action="bypass -h admin_admin" width=45 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
+<td width=190><center><font color=LEVEL>--- [ Manor Status ] ---</font></center></td>
+<td width=45><button value="Back" action="bypass -h admin_admin2" width=45 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
+</tr>
+</table><br>
+<center>
+<table bgcolor="404040" width=270>
+<tr><td width=130>Current mode:</td><td width=140><font color=FF9900>%status%</font></td></tr>
+<tr><td>Next mode change:</td><td><font color=FF9900>%change%</font</td></tr>
+</table><br><br>
+<font color=LEVEL>--- [ Castle Info ] ---</font><br1>
+<table bgcolor="404040" width=270>
+%castleInfo%
+</table>
+</center>
+</body></html>

+ 0 - 9
L2J_DataPack_BETA/dist/game/data/html/manormanager/manor_client_help001.htm

@@ -1,9 +0,0 @@
-<html><body>
-A manor refers to any property owned by the lord. Anything produced within its confines remains the exclusive property of the lord.<br>
-You are to be an agricultural producer. First you must buy a &nbsp;<a action= "bypass -h npc_%objectId%_Link manormanager/manor_client_help002.htm">seed</a>&nbsp; and place it onto a monster. This is easily accomplished while targeting.<br>
-When the monster dies you will harvest a crop from its body. To harvest a crop you will target the corpse onto which a seed was sown and use the harvester. If you need one, I'll be happy to sell you a harvester. These crops are the major product of the manor. After you have harvested, bring the &nbsp;<a action="bypass -h npc_%objectId%_Link manormanager/manor_client_help003.htm">crop</a>&nbsp; to me. The crop is the specialty of our territory. For harvesting, target the monster.<br>
-I will appraise it and give you an appropriate reward for it! If you want to know what the reward will be, I will tell you about it later...<br>
-<center>
-<a action="bypass -h npc_%objectId%_Link manormanager/manager.htm">Return</a><br>
-</center>
-</body></html>

+ 0 - 11
L2J_DataPack_BETA/dist/game/data/html/manormanager/manor_client_help002.htm

@@ -1,11 +0,0 @@
-<html><body>
-The seeds can be classified into regular type and alternative type. If you plant a regular type seed, a monster will hide an item and give you a crop of equivalent value instead.<br>
-When you plant alternative type seed, you will receive a crop approximately half of the time or you will receive an item approximately half of the time.<br>
-The lord established this system so that players can choose their preferred type of gameplay by selecting the type of seed to plant in a manor.<br>
-There are four kinds of seed--coda, cobol, codran and coba. Availability of each type is based upon a character's level. Coda is the seed most appropriate for farmers whose levels are between level 10 and level 30, relatively low levels. Cobol is the seed most appropriate for farmers whose levels fall between level 31 and level 48. Codran is the seed most appropriate for high level farmers of level 49 and level 64. Coba is the seed most appropriate for high level farmers of level 65 or above.<br>
-Obviously, different seeds grow different crops. Certain seeds work better with certain monsters. If a monster is weak, he will produce a disappointing crop. On the other hand, if he is too strong, the crop could be damaged as well.<br>
-One secret of a successful crop is to pick a monster with approximately the same power as the sower. Trying to sow a seed on a non-compliant monster can have disastrous consequences.<br>
-You may purchase any seed at any time, but the lord reserves the right not to purchase any crop at his discretion. You should always check to make sure that your crop is currently in demand.<br>
-And... you've got to keep it a secret from the Lord... I hear other castles buy crops... as long as they can be also purchased there... If the Lord changes his mind, I'll have no other choice but to sell my crops to other castles... Please keep it a secret.<br>
-<a action="bypass -h npc_%objectId%_Link manormanager/manor_client_help001.htm">Return</a>
-</body></html>

+ 0 - 4
L2J_DataPack_BETA/dist/game/data/html/manormanager/manormanager-show-procure.htm

@@ -1,4 +0,0 @@
-<html><body>%npcname%:<br>
-Crop procure info table<br>
-<table border=1><tr><td width=180 bgcolor=555555>Crop Name</td><td width=35>Buy</td><td width=50>Reward</td><td width=30>#</td></tr>%table%</table>
-</body></html>

+ 1 - 0
L2J_DataPack_BETA/dist/game/data/scripts.cfg

@@ -36,6 +36,7 @@ ai/npc/FortressSiegeManager/FortressSiegeManager.java
 ai/npc/FreyasSteward/FreyasSteward.java
 ai/npc/Jinia/Jinia.java
 ai/npc/KetraOrcSupport/KetraOrcSupport.java
+ai/npc/ManorManager/ManorManager.java
 ai/npc/MercenaryCaptain/MercenaryCaptain.java
 ai/npc/Minigame/Minigame.java
 ai/npc/MonumentOfHeroes/MonumentOfHeroes.java

+ 79 - 26
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleChamberlain/CastleChamberlain.java

@@ -31,11 +31,13 @@ import com.l2jserver.Config;
 import com.l2jserver.gameserver.SevenSigns;
 import com.l2jserver.gameserver.datatables.ClanTable;
 import com.l2jserver.gameserver.datatables.TeleportLocationTable;
+import com.l2jserver.gameserver.instancemanager.CastleManorManager;
 import com.l2jserver.gameserver.instancemanager.FortManager;
 import com.l2jserver.gameserver.model.ClanPrivilege;
 import com.l2jserver.gameserver.model.L2Clan;
 import com.l2jserver.gameserver.model.L2TeleportLocation;
 import com.l2jserver.gameserver.model.PcCondOverride;
+import com.l2jserver.gameserver.model.SeedProduction;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
@@ -43,11 +45,19 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.entity.Castle;
 import com.l2jserver.gameserver.model.entity.Castle.CastleFunction;
 import com.l2jserver.gameserver.model.entity.Fort;
+import com.l2jserver.gameserver.model.events.EventType;
+import com.l2jserver.gameserver.model.events.ListenerRegisterType;
+import com.l2jserver.gameserver.model.events.annotations.Id;
+import com.l2jserver.gameserver.model.events.annotations.RegisterEvent;
+import com.l2jserver.gameserver.model.events.annotations.RegisterType;
+import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcManorBypass;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.itemcontainer.Inventory;
 import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.ExShowCropInfo;
 import com.l2jserver.gameserver.network.serverpackets.ExShowCropSetting;
 import com.l2jserver.gameserver.network.serverpackets.ExShowDominionRegistry;
+import com.l2jserver.gameserver.network.serverpackets.ExShowManorDefaultInfo;
 import com.l2jserver.gameserver.network.serverpackets.ExShowSeedInfo;
 import com.l2jserver.gameserver.network.serverpackets.ExShowSeedSetting;
 import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -759,10 +769,23 @@ public final class CastleChamberlain extends AbstractNpcAI
 			{
 				if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES))
 				{
+					long seedIncome = 0;
+					if (Config.ALLOW_MANOR)
+					{
+						for (SeedProduction sp : CastleManorManager.getInstance().getSeedProduction(castle.getResidenceId(), false))
+						{
+							final long diff = sp.getStartAmount() - sp.getAmount();
+							if (diff != 0)
+							{
+								seedIncome += diff * sp.getPrice();
+							}
+						}
+					}
+					
 					final NpcHtmlMessage html = getHtmlPacket(player, npc, "castlemanagevault.html");
 					html.replace("%tax_income%", Util.formatAdena(castle.getTreasury()));
 					html.replace("%tax_income_reserved%", "0"); // TODO: Implement me!
-					html.replace("%seed_income%", "0"); // TODO: Implement me!
+					html.replace("%seed_income%", Util.formatAdena(seedIncome));
 					player.sendPacket(html);
 				}
 				else
@@ -1136,35 +1159,13 @@ public final class CastleChamberlain extends AbstractNpcAI
 			}
 			case "manor":
 			{
-				htmltext = (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_MANOR_ADMIN)) ? "manor.html" : "chamberlain-21.html";
-				break;
-			}
-			case "seed_status":
-			{
-				player.sendPacket(new ExShowSeedInfo(castle.getResidenceId(), castle.getSeedProduction(0)));
-				break;
-			}
-			case "seed_setup":
-			{
-				if (castle.isNextPeriodApproved())
+				if (Config.ALLOW_MANOR)
 				{
-					player.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM);
+					htmltext = (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_MANOR_ADMIN)) ? "manor.html" : "chamberlain-21.html";
 				}
 				else
 				{
-					player.sendPacket(new ExShowSeedSetting(castle.getResidenceId()));
-				}
-				break;
-			}
-			case "crop_setup":
-			{
-				if (castle.isNextPeriodApproved())
-				{
-					player.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM);
-				}
-				else
-				{
-					player.sendPacket(new ExShowCropSetting(castle.getResidenceId()));
+					player.sendMessage("Manor system is deactivated.");
 				}
 				break;
 			}
@@ -1313,6 +1314,58 @@ public final class CastleChamberlain extends AbstractNpcAI
 		return (isOwner(player, npc)) ? "chamberlain-01.html" : "chamberlain-04.html";
 	}
 	
+	// @formatter:off
+	@RegisterEvent(EventType.ON_NPC_MANOR_BYPASS)
+	@RegisterType(ListenerRegisterType.NPC)
+	@Id({35100, 35142, 35184, 35226, 35274,	35316, 35363, 35509, 35555})
+	// @formatter:on
+	public final void onNpcManorBypass(OnNpcManorBypass evt)
+	{
+		final L2PcInstance player = evt.getActiveChar();
+		final L2Npc npc = evt.getTarget();
+		if (isOwner(player, npc))
+		{
+			final CastleManorManager manor = CastleManorManager.getInstance();
+			if (manor.isUnderMaintenance())
+			{
+				player.sendPacket(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE);
+				return;
+			}
+			
+			final int castleId = (evt.getManorId() == -1) ? npc.getCastle().getResidenceId() : evt.getManorId();
+			switch (evt.getRequest())
+			{
+				case 3: // Seed info
+					player.sendPacket(new ExShowSeedInfo(castleId, evt.isNextPeriod(), true));
+					break;
+				case 4: // Crop info
+					player.sendPacket(new ExShowCropInfo(castleId, evt.isNextPeriod(), true));
+					break;
+				case 5: // Basic info
+					player.sendPacket(new ExShowManorDefaultInfo(true));
+					break;
+				case 7: // Seed settings
+					if (manor.isManorApproved())
+					{
+						player.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_4_30_AM_AND_8_PM);
+						return;
+					}
+					player.sendPacket(new ExShowSeedSetting(castleId));
+					break;
+				case 8: // Crop settings
+					if (manor.isManorApproved())
+					{
+						player.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_4_30_AM_AND_8_PM);
+						return;
+					}
+					player.sendPacket(new ExShowCropSetting(castleId));
+					break;
+				default:
+					_log.warning(getClass().getSimpleName() + ": Player " + player.getName() + " (" + player.getObjectId() + ") send unknown request id " + evt.getRequest() + "!");
+			}
+		}
+	}
+	
 	public static void main(String[] args)
 	{
 		new CastleChamberlain();

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleChamberlain/manor.html

@@ -1,9 +1,9 @@
 <html><body>
 Here are some things you'll need to know about to manage the Manor.<br>
 <center><br><br>
-<a action="bypass -h Quest CastleChamberlain seed_status">View the Status of Seeds/Crops</a><br>
-<a action="bypass -h Quest CastleChamberlain seed_setup">Edit Seed Setup</a><br>
-<a action="bypass -h Quest CastleChamberlain crop_setup">Edit Crop Setup</a><br>
+<a action="bypass manor_menu_select?ask=3&state=-1&time=0">View the Status of Seeds/Crops</a><br>
+<a action="bypass manor_menu_select?ask=7&state=-1&time=0">Edit Seed Setup</a><br>
+<a action="bypass manor_menu_select?ask=8&state=-1&time=0">Edit Crop Setup</a><br>
 <a action="bypass -h Quest CastleChamberlain manor-help-01.html">View Descriptions</a><br>
 <a action="bypass -h Quest CastleChamberlain chamberlain-01.html">Return</a>
 </center>

+ 14 - 12
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleMercenaryManager/CastleMercenaryManager.java

@@ -90,12 +90,12 @@ public final class CastleMercenaryManager extends AbstractNpcAI
 			{
 				if (SevenSigns.getInstance().isSealValidationPeriod())
 				{
-					htmltext = "mercmanager-ssq.html";
+					final int listId = Integer.parseInt(npc.getId() + st.nextToken());
+					((L2MerchantInstance) npc).showBuyWindow(player, listId, false); // NOTE: Not affected by Castle Taxes, baseTax is 20% (done in merchant buylists)
 				}
 				else
 				{
-					final int listId = Integer.parseInt(npc.getId() + st.nextToken());
-					((L2MerchantInstance) npc).showBuyWindow(player, listId, false); // NOTE: Not affected by Castle Taxes, baseTax is 20% (done in merchant buylists)
+					htmltext = "mercmanager-ssq.html";
 				}
 				break;
 			}
@@ -123,17 +123,19 @@ public final class CastleMercenaryManager extends AbstractNpcAI
 			{
 				htmltext = "mercmanager-siege.html";
 			}
-			else if (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DUSK)
-			{
-				htmltext = "mercmanager-dusk.html";
-			}
-			else if (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DAWN)
-			{
-				htmltext = "mercmanager-dawn.html";
-			}
 			else
 			{
-				htmltext = "mercmanager.html";
+				switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE))
+				{
+					case SevenSigns.CABAL_DUSK:
+						htmltext = "mercmanager-dusk.html";
+						break;
+					case SevenSigns.CABAL_DAWN:
+						htmltext = "mercmanager-dawn.html";
+						break;
+					default:
+						htmltext = "mercmanager.html";
+				}
 			}
 		}
 		else

+ 162 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/ManorManager.java

@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2004-2014 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 ai.npc.ManorManager;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.instancemanager.CastleManorManager;
+import com.l2jserver.gameserver.model.PcCondOverride;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.events.EventType;
+import com.l2jserver.gameserver.model.events.ListenerRegisterType;
+import com.l2jserver.gameserver.model.events.annotations.Id;
+import com.l2jserver.gameserver.model.events.annotations.RegisterEvent;
+import com.l2jserver.gameserver.model.events.annotations.RegisterType;
+import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcManorBypass;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.BuyListSeed;
+import com.l2jserver.gameserver.network.serverpackets.ExShowCropInfo;
+import com.l2jserver.gameserver.network.serverpackets.ExShowManorDefaultInfo;
+import com.l2jserver.gameserver.network.serverpackets.ExShowProcureCropDetail;
+import com.l2jserver.gameserver.network.serverpackets.ExShowSeedInfo;
+import com.l2jserver.gameserver.network.serverpackets.ExShowSellCropList;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Manor manager AI.
+ * @author malyelfik
+ */
+public final class ManorManager extends AbstractNpcAI
+{
+	private static final int[] NPC =
+	{
+		35644,
+		35645,
+		35319,
+		35366,
+		36456,
+		35512,
+		35558,
+		35229,
+		35230,
+		35231,
+		35277,
+		35103,
+		35145,
+		35187
+	};
+	
+	public ManorManager()
+	{
+		super(ManorManager.class.getSimpleName(), "ai/npc");
+		addStartNpc(NPC);
+		addFirstTalkId(NPC);
+		addTalkId(NPC);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = null;
+		switch (event)
+		{
+			case "manager-help-01.htm":
+			case "manager-help-02.htm":
+			case "manager-help-03.htm":
+				htmltext = event;
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onFirstTalk(L2Npc npc, L2PcInstance player)
+	{
+		if (Config.ALLOW_MANOR)
+		{
+			final int castleId = npc.getTemplate().getParameters().getInt("manor_id", -1);
+			if (!player.canOverrideCond(PcCondOverride.CASTLE_CONDITIONS) && player.isClanLeader() && (castleId == player.getClan().getCastleId()))
+			{
+				return "manager-lord.htm";
+			}
+			return "manager.htm";
+		}
+		return getHtm(player.getHtmlPrefix(), "data/html/npcdefault.htm");
+	}
+	
+	// @formatter:off
+	@RegisterEvent(EventType.ON_NPC_MANOR_BYPASS)
+	@RegisterType(ListenerRegisterType.NPC)
+	@Id({35644, 35645, 35319, 35366, 36456, 35512, 35558, 35229, 35230, 35231, 35277, 35103, 35145, 35187})
+	// @formatter:on
+	public final void onNpcManorBypass(OnNpcManorBypass evt)
+	{
+		final L2PcInstance player = evt.getActiveChar();
+		if (CastleManorManager.getInstance().isUnderMaintenance())
+		{
+			player.sendPacket(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE);
+			return;
+		}
+		
+		final L2Npc npc = evt.getTarget();
+		final int templateId = npc.getTemplate().getParameters().getInt("manor_id", -1);
+		final int castleId = (evt.getManorId() == -1) ? templateId : evt.getManorId();
+		switch (evt.getRequest())
+		{
+			case 1: // Seed purchase
+			{
+				if (templateId != castleId)
+				{
+					player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.HERE_YOU_CAN_BUY_ONLY_SEEDS_OF_S1_MANOR).addCastleId(templateId));
+					return;
+				}
+				player.sendPacket(new BuyListSeed(player.getAdena(), castleId));
+				break;
+			}
+			case 2: // Crop sales
+				player.sendPacket(new ExShowSellCropList(player.getInventory(), castleId));
+				break;
+			case 3: // Seed info
+				player.sendPacket(new ExShowSeedInfo(castleId, evt.isNextPeriod(), false));
+				break;
+			case 4: // Crop info
+				player.sendPacket(new ExShowCropInfo(castleId, evt.isNextPeriod(), false));
+				break;
+			case 5: // Basic info
+				player.sendPacket(new ExShowManorDefaultInfo(false));
+				break;
+			case 6: // Buy harvester
+				((L2MerchantInstance) npc).showBuyWindow(player, 300000 + npc.getId());
+				break;
+			case 9: // Edit sales (Crop sales)
+				player.sendPacket(new ExShowProcureCropDetail(evt.getManorId()));
+				break;
+			default:
+				_log.warning(getClass().getSimpleName() + ": Player " + player.getName() + " (" + player.getObjectId() + ") send unknown request id " + evt.getRequest() + "!");
+		}
+	}
+	
+	public static void main(String[] args)
+	{
+		new ManorManager();
+	}
+}

+ 9 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager-help-01.htm

@@ -0,0 +1,9 @@
+<html><body>
+A manor refers to any property owned by the lord.  Anything produced within its confines remains the exclusive property of the lord.<br> 
+You are to be an agricultural producer. First you must buy a &nbsp;<a action="bypass -h Quest ManorManager manager-help-02.htm">seed</a>&nbsp;and place it onto a monster.  This is easily accomplished while targeting.<br> 
+When the monster dies you will harvest a crop from its body. To harvest a crop you will target the corpse onto which a seed was sown and use the harvester. If you need one, I'll be happy to sell you a harvester.  These crops are the major product of the manor.  After you have harvested, bring the &nbsp;<a action="bypass -h Quest ManorManager manager-help-03.htm">crop</a>&nbsp;to me.  The crop is the specialty of our territory. For harvesting, target the monster.<br> 
+I will appraise it and give you an appropriate reward for it!  If you want to know what the reward will be, I will tell you about it later... <br> 
+<center>
+<a action="bypass -h npc_%objectId%_Chat 0">Return</a>
+</center>
+</body></html>

+ 12 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager-help-02.htm

@@ -0,0 +1,12 @@
+<html><body>
+The seeds can be classified into regular type and alternative type.  If you plant a regular type seed, a monster will hide an item and give you a crop of equivalent value instead.<br>  
+When you plant alternative type seed, you will receive a crop approximately half of the time  or you will receive an item  approximately half of the time.<br>  
+The lord established this system so that players can choose their preferred type of gameplay by selecting the type of seed to plant in a manor.<br>  
+There are four kinds of seed--coda, cobol, codran and coba. Availability of each type is based upon a character's level.  Coda is the seed most appropriate for farmers whose levels are between level 10 and level 30, relatively low levels. Cobol is the seed most appropriate for farmers whose levels fall between level 31 and level 48. Codran is the seed most appropriate for high level farmers of level 49 and level 64. Coba is the seed most appropriate for high level farmers of level 65 or above.<br> 
+Obviously, different seeds grow different crops.  Certain seeds work better with certain monsters.  If a monster is weak, he will produce a disappointing crop. On the other hand, if he is too strong, the crop could be damaged as well.<br> 
+One secret of a successful crop is to pick a monster with approximately the same power as the sower.  Trying to sow a seed on a non-compliant monster can have disastrous consequences.<br> 
+You may purchase any seed at any time, but the lord reserves the right not to purchase any crop at his discretion. You should always check to make sure that your crop is currently in demand.<br> 
+And... you've got to keep it a secret fro the Lord... I hear other castles buy crops... as long as they can be also purchased there... If the Lord changes his mind, I'll have no other choice but to sell my crops to other castles... Please keep it a secret.<br>
+<a action="bypass -h Quest ManorManager manager-help-01.htm">Return</a>
+</center>
+</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/html/manormanager/manor_client_help003.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager-help-03.htm

@@ -1,8 +1,9 @@
 <html><body>
-When a seed germinates inside a monster it becomes a crop. The best crops are harvested from monsters of a level similar to the sower.<br>
+When a seed germinates inside a monster it becomes a crop. The best crops 
+are harvested from monsters of a level similar to the sower.<br>
 Bring your harvested crops to me and you will be rewarded. The lord usually compensates farmers with items, some much more valuable than the crops.<br>
 Of course, you should be willing to gamble a little, right?<br><br>
 <center>
-<a action="bypass -h npc_%objectId%_Link manormanager/manor_client_help001.htm">Back</a><br>
+<a action="bypass -h Quest ManorManager manager-help-01.htm">Back</a>
 </center>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/html/manormanager/manager-lord.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager-lord.htm

@@ -1,5 +1,5 @@
 <html><body>
 My Lord! To what do I owe the honor of a personal visit?<br>
 I serve at your pleasure, my Lord!<br>
-I would never even think of stealing from you! Please believe me!
+I would never even think of stealing from you! Please believe me!<br>
 </body></html>

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/html/manormanager/manager.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/ManorManager/manager.htm

@@ -1,8 +1,8 @@
 <html><body>
 I'm a merchant dispatched by the Lord in order to sell Seeds from the Manor and purchase Special Products.<br>
-The seeds I'm selling can be sowed only in the Manor. But the Special Products can be sold in any castle. When selling to another castle, I will sell to another Manor on your behalf for a small fee.<br>
-The buying and selling of seeds for Special Products begin each day at 8 pm. Prepare in advance by referring to the Manor information begins to be displayed from 4:30 am, and come back at 8 pm. If you don't hurry, items can be sold out. Huh Huh<br>
-If you also have Special Products, sell them to me. The Lord will be glad.<br>
+The seeds I'm selling can be sowed only in the Manor. But the Special Products can be sold in any castle. When selling to another castle, I will sell to another Manor on your behalf for a small fee.<br> 
+The buying and selling of seeds for Special Products begin each day at 8 pm. Prepare in advance by referring to the Manor information begins to be displayed from 4:30 am, and come back at 8 pm. If you don't hurry, items can be sold out. Huh Huh<br> 
+If you also have Special Products, sell them to me. The Lord will be glad.<br> 
 If you perhaps don't know what the Manor or Special Product is, ask me anytime -- I will explain them to you in detail.<br>
 <center>
 <a action="bypass manor_menu_select?ask=1&state=-1&time=0">Purchase the Seed.</a><br>
@@ -11,6 +11,6 @@ If you perhaps don't know what the Manor or Special Product is, ask me anytime -
 <a action="bypass manor_menu_select?ask=5&state=-1&time=0">View the basic Seed information.</a><br>
 <a action="bypass manor_menu_select?ask=6&state=-1&time=0">Purchase a harvester.</a><br>
 <a action="bypass -h npc_%objectId%_TerritoryStatus">Ask about the current territory status.</a><br>
-<a action="bypass -h npc_%objectId%_Link manormanager/manor_client_help001.htm">Listen to the explanation.</a><br>
+<a action="bypass -h Quest ManorManager manager-help-01.htm">Listen to the explanation.</a>
 </center>
 </body></html>

+ 0 - 2
L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java

@@ -139,7 +139,6 @@ import handlers.bypasshandlers.Freight;
 import handlers.bypasshandlers.ItemAuctionLink;
 import handlers.bypasshandlers.Link;
 import handlers.bypasshandlers.Loto;
-import handlers.bypasshandlers.ManorManager;
 import handlers.bypasshandlers.Multisell;
 import handlers.bypasshandlers.NpcViewMod;
 import handlers.bypasshandlers.Observation;
@@ -407,7 +406,6 @@ public class MasterHandler
 			ItemAuctionLink.class,
 			Link.class,
 			Loto.class,
-			ManorManager.class,
 			Multisell.class,
 			NpcViewMod.class,
 			Observation.class,

File diff suppressed because it is too large
+ 18 - 123
L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminManor.java


+ 0 - 152
L2J_DataPack_BETA/dist/game/data/scripts/handlers/bypasshandlers/ManorManager.java

@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2004-2014 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.bypasshandlers;
-
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-
-import com.l2jserver.gameserver.handler.IBypassHandler;
-import com.l2jserver.gameserver.instancemanager.CastleManager;
-import com.l2jserver.gameserver.instancemanager.CastleManorManager;
-import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.instance.L2ManorManagerInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.entity.Castle;
-import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
-import com.l2jserver.gameserver.network.serverpackets.BuyListSeed;
-import com.l2jserver.gameserver.network.serverpackets.ExShowCropInfo;
-import com.l2jserver.gameserver.network.serverpackets.ExShowManorDefaultInfo;
-import com.l2jserver.gameserver.network.serverpackets.ExShowProcureCropDetail;
-import com.l2jserver.gameserver.network.serverpackets.ExShowSeedInfo;
-import com.l2jserver.gameserver.network.serverpackets.ExShowSellCropList;
-import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
-
-public class ManorManager implements IBypassHandler
-{
-	private static final String[] COMMANDS =
-	{
-		"manor_menu_select"
-	};
-	
-	@Override
-	public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
-	{
-		final L2Npc manager = activeChar.getLastFolkNPC();
-		if (!((manager instanceof L2ManorManagerInstance)))
-		{
-			return false;
-		}
-		
-		if (!activeChar.isInsideRadius(manager, L2Npc.INTERACTION_DISTANCE, true, false))
-		{
-			return false;
-		}
-		
-		try
-		{
-			final Castle castle = manager.getCastle();
-			if (CastleManorManager.getInstance().isUnderMaintenance())
-			{
-				activeChar.sendPacket(ActionFailed.STATIC_PACKET);
-				activeChar.sendPacket(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE);
-				return true;
-			}
-			
-			final StringTokenizer st = new StringTokenizer(command, "&");
-			final int ask = Integer.parseInt(st.nextToken().split("=")[1]);
-			final int state = Integer.parseInt(st.nextToken().split("=")[1]);
-			final int time = Integer.parseInt(st.nextToken().split("=")[1]);
-			
-			final int castleId;
-			if (state < 0)
-			{
-				castleId = castle.getResidenceId(); // info for current manor
-			}
-			else
-			{
-				castleId = state; // info for requested manor
-			}
-			
-			switch (ask)
-			{
-				case 1: // Seed purchase
-					if (castleId != castle.getResidenceId())
-					{
-						SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.HERE_YOU_CAN_BUY_ONLY_SEEDS_OF_S1_MANOR);
-						sm.addString(manager.getCastle().getName());
-						activeChar.sendPacket(sm);
-					}
-					else
-					{
-						activeChar.sendPacket(new BuyListSeed(activeChar.getAdena(), castleId, castle.getSeedProduction(CastleManorManager.PERIOD_CURRENT)));
-					}
-					break;
-				case 2: // Crop sales
-					activeChar.sendPacket(new ExShowSellCropList(activeChar, castleId, castle.getCropProcure(CastleManorManager.PERIOD_CURRENT)));
-					break;
-				case 3: // Current seeds (Manor info)
-					if ((time == 1) && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved())
-					{
-						activeChar.sendPacket(new ExShowSeedInfo(castleId, null));
-					}
-					else
-					{
-						activeChar.sendPacket(new ExShowSeedInfo(castleId, CastleManager.getInstance().getCastleById(castleId).getSeedProduction(time)));
-					}
-					break;
-				case 4: // Current crops (Manor info)
-					if ((time == 1) && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved())
-					{
-						activeChar.sendPacket(new ExShowCropInfo(castleId, null));
-					}
-					else
-					{
-						activeChar.sendPacket(new ExShowCropInfo(castleId, CastleManager.getInstance().getCastleById(castleId).getCropProcure(time)));
-					}
-					break;
-				case 5: // Basic info (Manor info)
-					activeChar.sendPacket(new ExShowManorDefaultInfo());
-					break;
-				case 6: // Buy harvester
-					((L2MerchantInstance) manager).showBuyWindow(activeChar, 300000 + manager.getId());
-					break;
-				case 9: // Edit sales (Crop sales)
-					activeChar.sendPacket(new ExShowProcureCropDetail(state));
-					break;
-				default:
-					return false;
-			}
-			return true;
-		}
-		catch (Exception e)
-		{
-			_log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e);
-		}
-		return false;
-	}
-	
-	@Override
-	public String[] getBypassList()
-	{
-		return COMMANDS;
-	}
-}

+ 44 - 78
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Harvesting.java

@@ -18,8 +18,6 @@
  */
 package handlers.effecthandlers;
 
-import com.l2jserver.Config;
-import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@@ -28,8 +26,6 @@ import com.l2jserver.gameserver.model.effects.AbstractEffect;
 import com.l2jserver.gameserver.model.holders.ItemHolder;
 import com.l2jserver.gameserver.model.skills.BuffInfo;
 import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
-import com.l2jserver.gameserver.network.serverpackets.ItemList;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.util.Rnd;
 
@@ -53,106 +49,75 @@ public final class Harvesting extends AbstractEffect
 	@Override
 	public void onStart(BuffInfo info)
 	{
-		if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isNpc() || !info.getEffected().isDead())
+		if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isMonster() || !info.getEffected().isDead())
 		{
 			return;
 		}
 		
 		final L2PcInstance player = info.getEffector().getActingPlayer();
-		final L2Object[] targets = info.getSkill().getTargetList(player, false, info.getEffected());
-		if ((targets == null) || (targets.length == 0))
+		final L2MonsterInstance monster = (L2MonsterInstance) info.getEffected();
+		if (player.getObjectId() != monster.getSeederId())
 		{
-			return;
+			player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_HARVEST);
 		}
-		
-		L2MonsterInstance monster;
-		final InventoryUpdate iu = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
-		for (L2Object target : targets)
+		else if (monster.isSeeded())
 		{
-			if ((target == null) || !target.isMonster())
-			{
-				continue;
-			}
-			
-			monster = (L2MonsterInstance) target;
-			
-			if (player.getObjectId() != monster.getSeederId())
+			if (calcSuccess(player, monster))
 			{
-				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_HARVEST);
-				player.sendPacket(sm);
-				continue;
-			}
-			
-			boolean send = false;
-			int total = 0;
-			int cropId = 0;
-			
-			if (monster.isSeeded())
-			{
-				if (calcSuccess(player, monster))
+				final ItemHolder item = monster.takeHarvest();
+				if (item != null)
 				{
-					final ItemHolder[] items = monster.takeHarvest();
-					if ((items != null) && (items.length > 0))
+					// Add item
+					player.getInventory().addItem("Harvesting", item.getId(), item.getCount(), player, monster);
+					
+					// Send system msg
+					SystemMessage sm = null;
+					if (item.getCount() == 1)
+					{
+						sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1);
+						sm.addItemName(item.getId());
+					}
+					else
 					{
-						for (ItemHolder reward : items)
+						sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2);
+						sm.addItemName(item.getId());
+						sm.addLong(item.getCount());
+					}
+					player.sendPacket(sm);
+					
+					// Send msg to party
+					if (player.isInParty())
+					{
+						if (item.getCount() == 1)
 						{
-							cropId = reward.getId(); // always got 1 type of crop as reward
-							if (player.isInParty())
-							{
-								player.getParty().distributeItem(player, reward, true, monster);
-							}
-							else
-							{
-								if (iu != null)
-								{
-									iu.addItem(player.getInventory().addItem("Harvesting", reward.getId(), reward.getCount(), player, monster));
-								}
-								send = true;
-								total += reward.getCount();
-							}
+							sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HARVESTED_S2S);
+							sm.addString(player.getName());
+							sm.addItemName(item.getId());
 						}
-						
-						if (send)
+						else
 						{
-							SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2);
-							smsg.addInt(total);
-							smsg.addItemName(cropId);
-							player.sendPacket(smsg);
-							if (player.isInParty())
-							{
-								smsg = SystemMessage.getSystemMessage(SystemMessageId.C1_HARVESTED_S3_S2S);
-								smsg.addString(player.getName());
-								smsg.addInt(total);
-								smsg.addItemName(cropId);
-								player.getParty().broadcastToPartyMembers(player, smsg);
-							}
-							
-							if (iu != null)
-							{
-								player.sendPacket(iu);
-							}
-							else
-							{
-								player.sendPacket(new ItemList(player, false));
-							}
+							sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HARVESTED_S3_S2S);
+							sm.addString(player.getName());
+							sm.addLong(item.getCount());
+							sm.addItemName(item.getId());
 						}
+						player.getParty().broadcastToPartyMembers(player, sm);
 					}
 				}
-				else
-				{
-					player.sendPacket(SystemMessageId.THE_HARVEST_HAS_FAILED);
-				}
 			}
 			else
 			{
-				player.sendPacket(SystemMessageId.THE_HARVEST_FAILED_BECAUSE_THE_SEED_WAS_NOT_SOWN);
+				player.sendPacket(SystemMessageId.THE_HARVEST_HAS_FAILED);
 			}
 		}
+		else
+		{
+			player.sendPacket(SystemMessageId.THE_HARVEST_FAILED_BECAUSE_THE_SEED_WAS_NOT_SOWN);
+		}
 	}
 	
 	private static boolean calcSuccess(L2PcInstance activeChar, L2MonsterInstance target)
 	{
-		int basicSuccess = 100;
 		final int levelPlayer = activeChar.getLevel();
 		final int levelTarget = target.getLevel();
 		
@@ -164,6 +129,7 @@ public final class Harvesting extends AbstractEffect
 		
 		// apply penalty, target <=> player levels
 		// 5% penalty for each level
+		int basicSuccess = 100;
 		if (diff > 5)
 		{
 			basicSuccess -= (diff - 5) * 5;

+ 11 - 16
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Sow.java

@@ -19,8 +19,8 @@
 package handlers.effecthandlers;
 
 import com.l2jserver.gameserver.ai.CtrlIntention;
-import com.l2jserver.gameserver.datatables.ManorData;
 import com.l2jserver.gameserver.enums.QuestSound;
+import com.l2jserver.gameserver.model.L2Seed;
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
@@ -65,20 +65,15 @@ public final class Sow extends AbstractEffect
 			return;
 		}
 		
-		final int seedId = target.getSeedType();
-		if (seedId == 0)
-		{
-			return;
-		}
-		
 		// Consuming used seed
-		if (!player.destroyItemByItemId("Consume", seedId, 1, target, false))
+		final L2Seed seed = target.getSeed();
+		if (!player.destroyItemByItemId("Consume", seed.getSeedId(), 1, target, false))
 		{
 			return;
 		}
 		
 		final SystemMessage sm;
-		if (calcSuccess(player, target, seedId))
+		if (calcSuccess(player, target, seed))
 		{
 			player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket());
 			target.setSeeded(player.getActingPlayer());
@@ -89,27 +84,27 @@ public final class Sow extends AbstractEffect
 			sm = SystemMessage.getSystemMessage(SystemMessageId.THE_SEED_WAS_NOT_SOWN);
 		}
 		
-		if (player.getParty() == null)
+		if (player.isInParty())
 		{
-			player.sendPacket(sm);
+			player.getParty().broadcastPacket(sm);
 		}
 		else
 		{
-			player.getParty().broadcastPacket(sm);
+			player.sendPacket(sm);
 		}
 		
 		// TODO: Mob should not aggro on player, this way doesn't work really nice
 		target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 	}
 	
-	private static boolean calcSuccess(L2Character activeChar, L2Character target, int seedId)
+	private static boolean calcSuccess(L2Character activeChar, L2Character target, L2Seed seed)
 	{
 		// TODO: check all the chances
-		int basicSuccess = (ManorData.getInstance().isAlternative(seedId) ? 20 : 90);
-		final int minlevelSeed = ManorData.getInstance().getSeedMinLevel(seedId);
-		final int maxlevelSeed = ManorData.getInstance().getSeedMaxLevel(seedId);
+		final int minlevelSeed = seed.getLevel() - 5;
+		final int maxlevelSeed = seed.getLevel() + 5;
 		final int levelPlayer = activeChar.getLevel(); // Attacker Level
 		final int levelTarget = target.getLevel(); // target Level
+		int basicSuccess = seed.isAlternative() ? 20 : 90;
 		
 		// seed level
 		if (levelTarget < minlevelSeed)

+ 11 - 18
L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/Harvester.java

@@ -18,12 +18,11 @@
  */
 package handlers.itemhandlers;
 
-import java.util.logging.Level;
-
+import com.l2jserver.Config;
 import com.l2jserver.gameserver.handler.IItemHandler;
-import com.l2jserver.gameserver.instancemanager.CastleManorManager;
+import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Playable;
-import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -33,37 +32,31 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 /**
  * @author l3x
  */
-public class Harvester implements IItemHandler
+public final class Harvester implements IItemHandler
 {
 	@Override
 	public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
 	{
-		if (!playable.isPlayer())
+		if (!Config.ALLOW_MANOR)
 		{
-			playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS);
 			return false;
 		}
-		
-		if (CastleManorManager.getInstance().isDisabled())
+		else if (!playable.isPlayer())
 		{
+			playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS);
 			return false;
 		}
 		
-		final L2PcInstance activeChar = playable.getActingPlayer();
 		final SkillHolder[] skills = item.getItem().getSkills();
-		L2MonsterInstance target = null;
-		if ((activeChar.getTarget() != null) && activeChar.getTarget().isMonster())
-		{
-			target = (L2MonsterInstance) activeChar.getTarget();
-		}
-		
 		if (skills == null)
 		{
-			_log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!");
+			_log.warning(getClass().getSimpleName() + ": is missing skills!");
 			return false;
 		}
 		
-		if ((target == null) || !target.isDead())
+		final L2PcInstance activeChar = playable.getActingPlayer();
+		final L2Object target = activeChar.getTarget();
+		if ((target == null) || !target.isMonster() || !((L2Character) target).isDead())
 		{
 			activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
 			activeChar.sendPacket(ActionFailed.STATIC_PACKET);

+ 17 - 28
L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/Seed.java

@@ -18,13 +18,12 @@
  */
 package handlers.itemhandlers;
 
-import com.l2jserver.gameserver.datatables.ManorData;
+import com.l2jserver.Config;
 import com.l2jserver.gameserver.handler.IItemHandler;
 import com.l2jserver.gameserver.instancemanager.CastleManorManager;
 import com.l2jserver.gameserver.instancemanager.MapRegionManager;
 import com.l2jserver.gameserver.model.L2Object;
-import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.L2Seed;
 import com.l2jserver.gameserver.model.actor.L2Playable;
 import com.l2jserver.gameserver.model.actor.instance.L2ChestInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
@@ -42,28 +41,25 @@ public class Seed implements IItemHandler
 	@Override
 	public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
 	{
-		if (!playable.isPlayer())
+		if (!Config.ALLOW_MANOR)
 		{
-			playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS);
 			return false;
 		}
-		
-		if (CastleManorManager.getInstance().isDisabled())
+		else if (!playable.isPlayer())
 		{
+			playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS);
 			return false;
 		}
 		
 		final L2Object tgt = playable.getTarget();
-		if (!(tgt instanceof L2Npc))
+		if (!tgt.isNpc())
 		{
 			playable.sendPacket(SystemMessageId.INCORRECT_TARGET);
-			playable.sendPacket(ActionFailed.STATIC_PACKET);
 			return false;
 		}
-		if (!(tgt instanceof L2MonsterInstance) || (tgt instanceof L2ChestInstance) || ((L2Character) tgt).isRaid())
+		else if (!tgt.isMonster() || ((L2MonsterInstance) tgt).isRaid() || (tgt instanceof L2ChestInstance))
 		{
 			playable.sendPacket(SystemMessageId.THE_TARGET_IS_UNAVAILABLE_FOR_SEEDING);
-			playable.sendPacket(ActionFailed.STATIC_PACKET);
 			return false;
 		}
 		
@@ -71,26 +67,29 @@ public class Seed implements IItemHandler
 		if (target.isDead())
 		{
 			playable.sendPacket(SystemMessageId.INCORRECT_TARGET);
-			playable.sendPacket(ActionFailed.STATIC_PACKET);
 			return false;
 		}
-		
-		if (target.isSeeded())
+		else if (target.isSeeded())
 		{
 			playable.sendPacket(ActionFailed.STATIC_PACKET);
 			return false;
 		}
 		
-		final int seedId = item.getId();
-		if (!areaValid(seedId, MapRegionManager.getInstance().getAreaCastle(playable)))
+		final L2Seed seed = CastleManorManager.getInstance().getSeed(item.getId());
+		if (seed == null)
+		{
+			return false;
+		}
+		else if (seed.getCastleId() != MapRegionManager.getInstance().getAreaCastle(playable)) // TODO: replace me with tax zone
 		{
 			playable.sendPacket(SystemMessageId.THIS_SEED_MAY_NOT_BE_SOWN_HERE);
 			return false;
 		}
 		
-		target.setSeeded(seedId, (L2PcInstance) playable);
-		final SkillHolder[] skills = item.getItem().getSkills();
 		final L2PcInstance activeChar = playable.getActingPlayer();
+		target.setSeeded(seed, activeChar);
+		
+		final SkillHolder[] skills = item.getItem().getSkills();
 		if (skills != null)
 		{
 			for (SkillHolder sk : skills)
@@ -100,14 +99,4 @@ public class Seed implements IItemHandler
 		}
 		return true;
 	}
-	
-	/**
-	 * @param seedId
-	 * @param castleId
-	 * @return
-	 */
-	private boolean areaValid(int seedId, int castleId)
-	{
-		return (ManorData.getInstance().getCastleIdForSeed(seedId) == castleId);
-	}
 }

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/stats/npcs/35100-35200.xml

@@ -137,7 +137,7 @@
 			<height normal="21.5" />
 		</collision>
 	</npc>
-	<npc id="35103" level="75" type="L2ManorManager" name="Manor Manager" title="Gludio">
+	<npc id="35103" level="75" type="L2Merchant" name="Manor Manager" title="Gludio">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />
@@ -2060,7 +2060,7 @@
 			<height normal="21.5" />
 		</collision>
 	</npc>
-	<npc id="35145" level="75" type="L2ManorManager" name="Manor Manager" title="Dion">
+	<npc id="35145" level="75" type="L2Merchant" name="Manor Manager" title="Dion">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />
@@ -3984,7 +3984,7 @@
 			<height normal="21.5" />
 		</collision>
 	</npc>
-	<npc id="35187" level="75" type="L2ManorManager" name="Manor Manager" title="Giran">
+	<npc id="35187" level="75" type="L2Merchant" name="Manor Manager" title="Giran">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/stats/npcs/35200-35300.xml

@@ -1355,7 +1355,7 @@
 			<height normal="21.5" />
 		</collision>
 	</npc>
-	<npc id="35229" level="75" type="L2ManorManager" name="Manor Manager" title="Oren">
+	<npc id="35229" level="75" type="L2Merchant" name="Manor Manager" title="Oren">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />
@@ -1396,7 +1396,7 @@
 			<height normal="22.5" />
 		</collision>
 	</npc>
-	<npc id="35230" level="75" type="L2ManorManager" name="Manor Manager" title="Oren">
+	<npc id="35230" level="75" type="L2Merchant" name="Manor Manager" title="Oren">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />
@@ -1437,7 +1437,7 @@
 			<height normal="24.5" />
 		</collision>
 	</npc>
-	<npc id="35231" level="75" type="L2ManorManager" name="Manor Manager" title="Oren">
+	<npc id="35231" level="75" type="L2Merchant" name="Manor Manager" title="Oren">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />
@@ -3667,7 +3667,7 @@
 			<height normal="21.5" />
 		</collision>
 	</npc>
-	<npc id="35277" level="75" type="L2ManorManager" name="Manor Manager" title="Aden">
+	<npc id="35277" level="75" type="L2Merchant" name="Manor Manager" title="Aden">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/stats/npcs/35300-35400.xml

@@ -904,7 +904,7 @@
 			<height normal="21.5" />
 		</collision>
 	</npc>
-	<npc id="35319" level="75" type="L2ManorManager" name="Manor Manager" title="Innadril">
+	<npc id="35319" level="75" type="L2Merchant" name="Manor Manager" title="Innadril">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />
@@ -3000,7 +3000,7 @@
 			<height normal="24" />
 		</collision>
 	</npc>
-	<npc id="35366" level="75" type="L2ManorManager" name="Manor Manager" title="Goddard">
+	<npc id="35366" level="75" type="L2Merchant" name="Manor Manager" title="Goddard">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/stats/npcs/35500-35600.xml

@@ -603,7 +603,7 @@
 			<height normal="24" />
 		</collision>
 	</npc>
-	<npc id="35512" level="75" type="L2ManorManager" name="Manor Manager" title="Rune">
+	<npc id="35512" level="75" type="L2Merchant" name="Manor Manager" title="Rune">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />
@@ -2667,7 +2667,7 @@
 			<height normal="24" />
 		</collision>
 	</npc>
-	<npc id="35558" level="75" type="L2ManorManager" name="Manor Manager" title="Schuttgart ">
+	<npc id="35558" level="75" type="L2Merchant" name="Manor Manager" title="Schuttgart ">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/stats/npcs/35600-35700.xml

@@ -2003,7 +2003,7 @@
 			<height normal="24" />
 		</collision>
 	</npc>
-	<npc id="35644" level="70" type="L2ManorManager" name="Manor Manager" title="Schuttgart">
+	<npc id="35644" level="70" type="L2Merchant" name="Manor Manager" title="Schuttgart">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />
@@ -2044,7 +2044,7 @@
 			<height normal="17" />
 		</collision>
 	</npc>
-	<npc id="35645" level="70" type="L2ManorManager" name="Manor Manager" title="Schuttgart">
+	<npc id="35645" level="70" type="L2Merchant" name="Manor Manager" title="Schuttgart">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/stats/npcs/36400-36500.xml

@@ -2409,7 +2409,7 @@
 			<height normal="18.5" />
 		</collision>
 	</npc>
-	<npc id="36456" level="75" type="L2ManorManager" name="Manor Manager" title="Aden">
+	<npc id="36456" level="75" type="L2Merchant" name="Manor Manager" title="Aden">
 		<!-- Confirmed CT2.5 -->
 		<parameters>
 			<param name="MoveAroundSocial" value="0" />

+ 8 - 8
L2J_DataPack_BETA/dist/sql/game/castle_manor_procure.sql

@@ -1,10 +1,10 @@
 CREATE TABLE IF NOT EXISTS `castle_manor_procure` (
-  `castle_id` INT NOT NULL DEFAULT '0',
-  `crop_id` int(11) NOT NULL DEFAULT '0',
-  `can_buy` int(11) NOT NULL DEFAULT '0',
-  `start_buy` int(11) NOT NULL DEFAULT '0',
-  `price` int(11) NOT NULL DEFAULT '0',
-  `reward_type` int(11) NOT NULL DEFAULT '0',
-  `period` INT NOT NULL DEFAULT '1',
-  PRIMARY KEY (`castle_id`,`crop_id`,`period`)
+ `castle_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `crop_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `amount` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `start_amount` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `price` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `reward_type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
+ `next_period` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
+  PRIMARY KEY (`castle_id`,`crop_id`,`next_period`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

+ 7 - 7
L2J_DataPack_BETA/dist/sql/game/castle_manor_production.sql

@@ -1,9 +1,9 @@
 CREATE TABLE IF NOT EXISTS `castle_manor_production` (
-  `castle_id` INT NOT NULL DEFAULT '0',
-  `seed_id` int(11) NOT NULL DEFAULT '0',
-  `can_produce` int(11) NOT NULL DEFAULT '0',
-  `start_produce` int(11) NOT NULL DEFAULT '0',
-  `seed_price` int(11) NOT NULL DEFAULT '0',
-  `period` INT NOT NULL DEFAULT '1',
-  PRIMARY KEY (`castle_id`,`seed_id`,`period`)
+ `castle_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `seed_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `amount` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `start_amount` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `price` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `next_period` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
+ PRIMARY KEY (`castle_id`, `seed_id`, `next_period`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

+ 16 - 0
L2J_DataPack_BETA/dist/sql/game/updates/20140907update.sql

@@ -0,0 +1,16 @@
+ALTER TABLE `castle_manor_procure`
+	CHANGE COLUMN `castle_id` `castle_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' FIRST,
+	CHANGE COLUMN `crop_id` `crop_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `castle_id`,
+	CHANGE COLUMN `can_buy` `amount` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `crop_id`,
+	CHANGE COLUMN `start_buy` `start_amount` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `amount`,
+	CHANGE COLUMN `price` `price` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `start_amount`,
+	CHANGE COLUMN `reward_type` `reward_type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `price`,
+	CHANGE COLUMN `period` `next_period` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' AFTER `reward_type`;
+
+ALTER TABLE `castle_manor_production`
+	CHANGE COLUMN `castle_id` `castle_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' FIRST,
+	CHANGE COLUMN `seed_id` `seed_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `castle_id`,
+	CHANGE COLUMN `can_produce` `amount` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `seed_id`,
+	CHANGE COLUMN `start_produce` `start_amount` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `amount`,
+	CHANGE COLUMN `seed_price` `price` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `start_amount`,
+	CHANGE COLUMN `period` `next_period` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' AFTER `price`;

Some files were not shown because too many files changed in this diff