Przeglądaj źródła

Private store restriction update.
Change quest despawn task to NPC despawn.
Commented unused variable in MSU.

JIV 15 lat temu
rodzic
commit
56264ce9cb

+ 3 - 2
L2_GameServer/java/com/l2jserver/gameserver/RecipeController.java

@@ -56,6 +56,7 @@ import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
 import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.skills.Stats;
+import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
 import com.l2jserver.gameserver.templates.StatsSet;
 import com.l2jserver.gameserver.templates.item.L2Item;
 import com.l2jserver.gameserver.util.Util;
@@ -182,9 +183,9 @@ public class RecipeController
 	
 	public synchronized void requestMakeItem(L2PcInstance player, int recipeListId)
 	{
-		if (player.isInDuel())
+		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) || player.isInDuel())
 		{
-			player.sendPacket(new SystemMessage(SystemMessageId.CANT_CRAFT_DURING_COMBAT));
+			player.sendPacket(new SystemMessage(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT));
 			return;
 		}
 		

+ 61 - 59
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -4902,65 +4902,67 @@ public final class L2PcInstance extends L2Playable
 			else addItem("Pickup", target, null, true);
 		}
 	}
-    
-    public boolean canOpenPrivateStore()
-    {
-        return !this.isAlikeDead() && !this.isInOlympiadMode() && !this.isMounted();
-    }
-    
-    public void tryOpenPrivateBuyStore()
-    {
-        // Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
-        if (this.canOpenPrivateStore())
-        {
-            if (this.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY || this.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY +1)
-            {
-                this.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
-            }
-            if (this.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_NONE)
-            {
-                if (this.isSitting())
-                {
-                    this.standUp();
-                }
-                this.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_BUY +1);
-                this.sendPacket(new PrivateStoreManageListBuy(this));
-            }
-        }
-        else
-        {
-            this.sendPacket(ActionFailed.STATIC_PACKET);
-        }
-    }
-    
-    public void tryOpenPrivateSellStore(boolean isPackageSale)
-    {
-        // Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
-        if (this.canOpenPrivateStore())
-        {
-            if (this.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL
-                    || this.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL + 1
-                    || this.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_PACKAGE_SELL)
-            {
-                this.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
-            }
-            
-
-            if (this.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_NONE)
-            {
-                if (this.isSitting())
-                {
-                    this.standUp();
-                }
-                this.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_SELL + 1);
-                this.sendPacket(new PrivateStoreManageListSell(this, isPackageSale));
-            }
-        }
-        else
-        {
-            this.sendPacket(ActionFailed.STATIC_PACKET);
-        }
-    }
+	
+	public boolean canOpenPrivateStore()
+	{
+		return !isAlikeDead() && !isInOlympiadMode() && !isMounted() 
+				&& !isInsideZone(ZONE_NOSTORE) && !isCastingNow();
+	}
+	
+	public void tryOpenPrivateBuyStore()
+	{
+		// Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
+		if (canOpenPrivateStore())
+		{
+			if (getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY || getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY + 1)
+			{
+				setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
+			}
+			if (getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_NONE)
+			{
+				if (isSitting())
+				{
+					standUp();
+				}
+				setPrivateStoreType(L2PcInstance.STORE_PRIVATE_BUY + 1);
+				sendPacket(new PrivateStoreManageListBuy(this));
+			}
+		}
+		else
+		{
+			if (isInsideZone(ZONE_NOSTORE))
+				sendPacket(new SystemMessage(SystemMessageId.NO_PRIVATE_STORE_HERE));
+			sendPacket(ActionFailed.STATIC_PACKET);
+		}
+	}
+	
+	public void tryOpenPrivateSellStore(boolean isPackageSale)
+	{
+		// Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
+		if (canOpenPrivateStore())
+		{
+			if (getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL || getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL + 1 || getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_PACKAGE_SELL)
+			{
+				this.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
+			}
+			
+			if (getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_NONE)
+			{
+				if (isSitting())
+				{
+					standUp();
+				}
+				setPrivateStoreType(L2PcInstance.STORE_PRIVATE_SELL + 1);
+				sendPacket(new PrivateStoreManageListSell(this, isPackageSale));
+			}
+		}
+		else
+		{
+			if (isInsideZone(ZONE_NOSTORE))
+				sendPacket(new SystemMessage(SystemMessageId.NO_PRIVATE_STORE_HERE));
+			sendPacket(ActionFailed.STATIC_PACKET);
+		}
+	}
     
     public boolean isTransformed()
     {

+ 4 - 23
L2_GameServer/java/com/l2jserver/gameserver/model/quest/Quest.java

@@ -1589,25 +1589,6 @@ public class Quest extends ManagedScript
 		return content;
 	}
 	
-	// =========================================================
-	//  QUEST SPAWNS
-	// =========================================================
-	
-	public class DeSpawnScheduleTimerTask implements Runnable
-	{
-		L2Npc _npc = null;
-		
-		public DeSpawnScheduleTimerTask(L2Npc npc)
-		{
-			_npc = npc;
-		}
-		
-		public void run()
-		{
-			_npc.onDecay();
-		}
-	}
-	
 	// Method - Public
 	/**
 	 * Add a temporary (quest) spawn
@@ -1628,17 +1609,17 @@ public class Quest extends ManagedScript
 		return addSpawn(npcId, cha.getX(), cha.getY(), cha.getZ(), cha.getHeading(), false, 0, isSummonSpawn);
 	}
 	
-	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, int despawnDelay)
+	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
 	{
 		return addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay, false);
 	}
 	
-	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, int despawnDelay, boolean isSummonSpawn)
+	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
 	{
 		return addSpawn(npcId, x, y, z, heading, randomOffset, despawnDelay, isSummonSpawn, 0);
 	}
 	
-	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, int despawnDelay, boolean isSummonSpawn, int instanceId)
+	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
 	{
 		L2Npc result = null;
 		try
@@ -1686,7 +1667,7 @@ public class Quest extends ManagedScript
 				result = spawn.spawnOne(isSummonSpawn);
 				
 				if (despawnDelay > 0)
-					ThreadPoolManager.getInstance().scheduleGeneral(new DeSpawnScheduleTimerTask(result), despawnDelay);
+					result.scheduleDespawn(despawnDelay);
 				
 				return result;
 			}

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/network/SystemMessageId.java

@@ -6769,7 +6769,7 @@ public enum SystemMessageId
 	* ID: 1135<br>
 	* Message: While you are engaged in combat, you cannot operate a private store or private workshop.
 	*/
-	CANT_CRAFT_DURING_COMBAT(1135),
+	CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT(1135),
 
 	/**
 	* ID: 1136<br>

+ 4 - 2
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestRecipeShopListSet.java

@@ -28,6 +28,7 @@ import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.RecipeShopMsg;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
 import com.l2jserver.gameserver.util.Util;
 
 
@@ -86,9 +87,10 @@ public final class RequestRecipeShopListSet extends L2GameClientPacket
 			return;
 		}
 
-		if (player.isInDuel())
+		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) || player.isInDuel())
 		{
-			player.sendPacket(new SystemMessage(SystemMessageId.CANT_CRAFT_DURING_COMBAT));
+			player.sendPacket(new SystemMessage(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT));
+			player.sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
 

+ 0 - 7
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestRecipeShopMakeItem.java

@@ -17,8 +17,6 @@ package com.l2jserver.gameserver.network.clientpackets;
 import com.l2jserver.gameserver.RecipeController;
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.util.Util;
 
 /**
@@ -75,11 +73,6 @@ public final class RequestRecipeShopMakeItem extends L2GameClientPacket
             activeChar.sendMessage("Currently in Craft Mode");
             return;
         }
-        if (manufacturer.isInDuel() || activeChar.isInDuel())
-		{
-        	activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_CRAFT_DURING_COMBAT));
-			return;
-		}
         if (Util.checkIfInRange(150, activeChar, manufacturer, true))
         	RecipeController.getInstance().requestManufactureItem(manufacturer, _recipeId, activeChar);
 	}

+ 9 - 0
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/SetPrivateStoreListBuy.java

@@ -23,6 +23,7 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.PrivateStoreManageListBuy;
 import com.l2jserver.gameserver.network.serverpackets.PrivateStoreMsgBuy;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
 import com.l2jserver.gameserver.util.Util;
 
 import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
@@ -95,6 +96,14 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
 			player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT));
 			return;
 		}
+		
+		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) || player.isInDuel())
+		{
+			player.sendPacket(new SystemMessage(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT));
+			player.sendPacket(new PrivateStoreManageListBuy(player));
+			player.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
 
 		if (player.isInsideZone(L2Character.ZONE_NOSTORE))
 		{

+ 9 - 0
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/SetPrivateStoreListSell.java

@@ -24,6 +24,7 @@ import com.l2jserver.gameserver.network.serverpackets.ExPrivateStoreSetWholeMsg;
 import com.l2jserver.gameserver.network.serverpackets.PrivateStoreManageListSell;
 import com.l2jserver.gameserver.network.serverpackets.PrivateStoreMsgSell;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
 import com.l2jserver.gameserver.util.Util;
 
 import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
@@ -90,6 +91,14 @@ public class SetPrivateStoreListSell extends L2GameClientPacket
 			player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT));
 			return;
 		}
+		
+		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) || player.isInDuel())
+		{
+			player.sendPacket(new SystemMessage(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT));
+			player.sendPacket(new PrivateStoreManageListSell(player, _packageSale));
+			player.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
 
 		if (player.isInsideZone(L2Character.ZONE_NOSTORE))
 		{

+ 3 - 3
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/MagicSkillUse.java

@@ -36,7 +36,7 @@ public final class MagicSkillUse extends L2GameServerPacket
 	private int _hitTime;
 	private int _reuseDelay;
 	private int _charObjId, _x, _y, _z;
-	private int _flags;
+	//private int _flags;
 
 	public MagicSkillUse(L2Character cha, L2Character target, int skillId, int skillLevel, int hitTime, int reuseDelay)
 	{
@@ -52,7 +52,7 @@ public final class MagicSkillUse extends L2GameServerPacket
 		_tx = target.getX();
 		_ty = target.getY();
 		_tz = target.getZ();
-		_flags |= 0x20;
+		//_flags |= 0x20;
 	}
 
 	public MagicSkillUse(L2Character cha, int skillId, int skillLevel, int hitTime, int reuseDelay)
@@ -69,7 +69,7 @@ public final class MagicSkillUse extends L2GameServerPacket
 		_tx = cha.getX();
 		_ty = cha.getY();
 		_tz = cha.getZ();
-		_flags |= 0x20;
+		//_flags |= 0x20;
 	}
 
 	@Override