Browse Source

BETA: Cleaning up L2PcInstance:
* Moving all task like Runnable classes in own files.
* Handling door open request and summon player requests with addScript/getScript instead of having defined that variable all the time even when it wont be used.
* Reworked Teleport Bookmarks system:
* Using Map instead of List because we need an id and we can get it instead of looping all the time.
* Removed finalization of Location class to be able to extend it.
* Reviewed by: Zoey76

Rumen Nikiforov 12 years ago
parent
commit
b8c1ac2741
32 changed files with 1448 additions and 589 deletions
  1. 1 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/Location.java
  2. 73 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/TeleportBookmark.java
  3. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java
  4. 1 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantInstance.java
  5. 1 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantSummonInstance.java
  6. 77 548
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  7. 44 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/DismountTask.java
  8. 59 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/FameTask.java
  9. 58 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/GameGuardCheckTask.java
  10. 55 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/HerbTask.java
  11. 44 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/InventoryEnableTask.java
  12. 68 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/LookingForFishTask.java
  13. 108 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/PetFeedTask.java
  14. 45 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/PunishTask.java
  15. 57 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/PvPFlagTask.java
  16. 45 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/RecoBonusTaskEnd.java
  17. 61 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/RecoGiveTask.java
  18. 44 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/RentPetTask.java
  19. 44 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/ResetChargesTask.java
  20. 44 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/ResetSoulsTask.java
  21. 46 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/ShortBuffTask.java
  22. 44 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/SitDownTask.java
  23. 46 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/StandUpTask.java
  24. 45 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/TeleportWatchdogTask.java
  25. 56 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/VitalityTask.java
  26. 52 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/WarnUserTakeBreakTask.java
  27. 57 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/WaterTask.java
  28. 39 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/DoorRequestHolder.java
  29. 47 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/SkillUseHolder.java
  30. 47 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/SummonRequestHolder.java
  31. 28 15
      L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/DlgAnswer.java
  32. 10 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/ExGetBookMarkInfoPacket.java

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/Location.java

@@ -20,7 +20,7 @@ package com.l2jserver.gameserver.model;
 
 
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
 
 
-public final class Location
+public class Location
 {
 {
 	private final int _x;
 	private final int _x;
 	private final int _y;
 	private final int _y;

+ 73 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/TeleportBookmark.java

@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model;
+
+/**
+ * @author UnAfraid
+ */
+public class TeleportBookmark extends Location
+{
+	private final int _id;
+	private int _icon;
+	private String _name, _tag;
+	
+	public TeleportBookmark(int id, int x, int y, int z, int icon, String tag, String name)
+	{
+		super(x, y, z);
+		_id = id;
+		_icon = icon;
+		_name = name;
+		_tag = tag;
+	}
+	
+	public String getName()
+	{
+		return _name;
+	}
+	
+	public void setName(String name)
+	{
+		_name = name;
+	}
+	
+	public int getId()
+	{
+		return _id;
+	}
+	
+	public int getIcon()
+	{
+		return _icon;
+	}
+	
+	public void setIcon(int icon)
+	{
+		_icon = icon;
+	}
+	
+	public String getTag()
+	{
+		return _tag;
+	}
+	
+	public void setTag(String tag)
+	{
+		_tag = tag;
+	}
+}

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -69,7 +69,6 @@ import com.l2jserver.gameserver.model.PcCondOverride;
 import com.l2jserver.gameserver.model.ShotType;
 import com.l2jserver.gameserver.model.ShotType;
 import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.SkillDat;
 import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2RiftInvaderInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2RiftInvaderInstance;
 import com.l2jserver.gameserver.model.actor.knownlist.CharKnownList;
 import com.l2jserver.gameserver.model.actor.knownlist.CharKnownList;
@@ -84,6 +83,7 @@ import com.l2jserver.gameserver.model.effects.L2Effect;
 import com.l2jserver.gameserver.model.effects.L2EffectType;
 import com.l2jserver.gameserver.model.effects.L2EffectType;
 import com.l2jserver.gameserver.model.entity.Instance;
 import com.l2jserver.gameserver.model.entity.Instance;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
+import com.l2jserver.gameserver.model.holders.SkillUseHolder;
 import com.l2jserver.gameserver.model.interfaces.IChanceSkillTrigger;
 import com.l2jserver.gameserver.model.interfaces.IChanceSkillTrigger;
 import com.l2jserver.gameserver.model.interfaces.ISkillsHolder;
 import com.l2jserver.gameserver.model.interfaces.ISkillsHolder;
 import com.l2jserver.gameserver.model.itemcontainer.Inventory;
 import com.l2jserver.gameserver.model.itemcontainer.Inventory;
@@ -6382,7 +6382,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
 		if (isPlayer())
 		if (isPlayer())
 		{
 		{
 			L2PcInstance currPlayer = getActingPlayer();
 			L2PcInstance currPlayer = getActingPlayer();
-			SkillDat queuedSkill = currPlayer.getQueuedSkill();
+			SkillUseHolder queuedSkill = currPlayer.getQueuedSkill();
 			
 			
 			currPlayer.setCurrentSkill(null, false, false);
 			currPlayer.setCurrentSkill(null, false, false);
 			
 			

+ 1 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantInstance.java

@@ -18,7 +18,6 @@
  */
  */
 package com.l2jserver.gameserver.model.actor.instance;
 package com.l2jserver.gameserver.model.actor.instance;
 
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.TradeController;
 import com.l2jserver.gameserver.TradeController;
 import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable;
 import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable;
 import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable.MerchantPriceConfig;
 import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable.MerchantPriceConfig;
@@ -84,12 +83,7 @@ public class L2MerchantInstance extends L2NpcInstance
 		
 		
 		taxRate = getMpc().getTotalTaxRate();
 		taxRate = getMpc().getTotalTaxRate();
 		
 		
-		player.tempInventoryDisable();
-		
-		if (Config.DEBUG)
-		{
-			_log.fine("Showing buylist");
-		}
+		player.setInventoryBlockingStatus(true);
 		
 		
 		L2TradeList list = TradeController.getInstance().getBuyList(val);
 		L2TradeList list = TradeController.getInstance().getBuyList(val);
 		
 		

+ 1 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantSummonInstance.java

@@ -220,12 +220,7 @@ public class L2MerchantSummonInstance extends L2ServitorInstance
 	{
 	{
 		double taxRate = 50;
 		double taxRate = 50;
 		
 		
-		player.tempInventoryDisable();
-		
-		if (Config.DEBUG)
-		{
-			_log.fine("Showing buylist");
-		}
+		player.setInventoryBlockingStatus(true);
 		
 		
 		L2TradeList list = TradeController.getInstance().getBuyList(val);
 		L2TradeList list = TradeController.getInstance().getBuyList(val);
 		
 		

File diff suppressed because it is too large
+ 77 - 548
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java


+ 44 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/DismountTask.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to dismount player from pet.
+ * @author UnAfraid
+ */
+public class DismountTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public DismountTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.dismount();
+		}
+	}
+}

+ 59 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/FameTask.java

@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.Config;
+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.network.serverpackets.UserInfo;
+
+/**
+ * Task dedicated to reward player with fame while standing on siege zone.
+ * @author UnAfraid
+ */
+public class FameTask implements Runnable
+{
+	private final L2PcInstance _player;
+	private final int _value;
+	
+	public FameTask(L2PcInstance player, int value)
+	{
+		_player = player;
+		_value = value;
+	}
+	
+	@Override
+	public void run()
+	{
+		if ((_player == null) || (_player.isDead() && !Config.FAME_FOR_DEAD_PLAYERS))
+		{
+			return;
+		}
+		if (((_player.getClient() == null) || _player.getClient().isDetached()) && !Config.OFFLINE_FAME)
+		{
+			return;
+		}
+		_player.setFame(_player.getFame() + _value);
+		SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_REPUTATION_SCORE);
+		sm.addNumber(_value);
+		_player.sendPacket(sm);
+		_player.sendPacket(new UserInfo(_player));
+	}
+}

+ 58 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/GameGuardCheckTask.java

@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import java.util.logging.Logger;
+
+import com.l2jserver.gameserver.datatables.AdminTable;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.L2GameClient;
+import com.l2jserver.gameserver.network.serverpackets.LeaveWorld;
+
+/**
+ * Task dedicated to verify client's game guard.
+ * @author UnAfraid
+ */
+public class GameGuardCheckTask implements Runnable
+{
+	private static final Logger _log = Logger.getLogger(GameGuardCheckTask.class.getName());
+	
+	private final L2PcInstance _player;
+	
+	public GameGuardCheckTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if ((_player != null))
+		{
+			L2GameClient client = _player.getClient();
+			if ((client != null) && !client.isAuthedGG() && _player.isOnline())
+			{
+				AdminTable.getInstance().broadcastMessageToGMs("Client " + client + " failed to reply GameGuard query and is being kicked!");
+				_log.info("Client " + client + " failed to reply GameGuard query and is being kicked!");
+				
+				client.close(LeaveWorld.STATIC_PACKET);
+			}
+		}
+	}
+}

+ 55 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/HerbTask.java

@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to apply herbs on player.
+ * @author UnAfraid
+ */
+public class HerbTask implements Runnable
+{
+	private final L2PcInstance _player;
+	private final String _process;
+	private final int _itemId;
+	private final long _count;
+	private final L2Object _reference;
+	private final boolean _sendMessage;
+	
+	public HerbTask(L2PcInstance player, String process, int itemId, long count, L2Object reference, boolean sendMessage)
+	{
+		_player = player;
+		_process = process;
+		_itemId = itemId;
+		_count = count;
+		_reference = reference;
+		_sendMessage = sendMessage;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.addItem(_process, _itemId, _count, _reference, _sendMessage);
+		}
+	}
+}

+ 44 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/InventoryEnableTask.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to enable player's inventory.
+ * @author UnAfraid
+ */
+public class InventoryEnableTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public InventoryEnableTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.setInventoryBlockingStatus(false);
+		}
+	}
+}

+ 68 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/LookingForFishTask.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.Rnd;
+
+/**
+ * Task dedicated for looking for fishes.
+ * @author UnAfraid
+ */
+public class LookingForFishTask implements Runnable
+{
+	private final L2PcInstance _player;
+	private final boolean _isNoob, _isUpperGrade;
+	private final int _fishGroup;
+	private final double _fishGutsCheck;
+	private final long _endTaskTime;
+	
+	public LookingForFishTask(L2PcInstance player, int startCombatTime, double fishGutsCheck, int fishGroup, boolean isNoob, boolean isUpperGrade)
+	{
+		_player = player;
+		_fishGutsCheck = fishGutsCheck;
+		_endTaskTime = System.currentTimeMillis() + (startCombatTime * 1000) + 10000;
+		_fishGroup = fishGroup;
+		_isNoob = isNoob;
+		_isUpperGrade = isUpperGrade;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			if (System.currentTimeMillis() >= _endTaskTime)
+			{
+				_player.endFishing(false);
+				return;
+			}
+			if (_fishGroup == -1)
+			{
+				return;
+			}
+			int check = Rnd.get(100);
+			if (_fishGutsCheck > check)
+			{
+				_player.stopLookingForFishTask();
+				_player.startFishCombat(_isNoob, _isUpperGrade);
+			}
+		}
+	}
+}

+ 108 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/PetFeedTask.java

@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2jserver.gameserver.handler.IItemHandler;
+import com.l2jserver.gameserver.handler.ItemHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Task dedicated for feeding player's pet.
+ * @author UnAfraid
+ */
+public class PetFeedTask implements Runnable
+{
+	private static final Logger _log = Logger.getLogger(PetFeedTask.class.getName());
+	
+	private final L2PcInstance _player;
+	
+	public PetFeedTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			try
+			{
+				if (!_player.isMounted())
+				{
+					_player.stopFeed();
+					return;
+				}
+				
+				if (_player.getCurrentFeed() > _player.getFeedConsume())
+				{
+					// eat
+					_player.setCurrentFeed(_player.getCurrentFeed() - _player.getFeedConsume());
+				}
+				else
+				{
+					// go back to pet control item, or simply said, unsummon it
+					_player.setCurrentFeed(0);
+					_player.stopFeed();
+					_player.dismount();
+					_player.sendPacket(SystemMessageId.OUT_OF_FEED_MOUNT_CANCELED);
+				}
+				
+				List<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
+				if (foodIds.isEmpty())
+				{
+					return;
+				}
+				L2ItemInstance food = null;
+				for (int id : foodIds)
+				{
+					// TODO: possibly pet inv?
+					food = _player.getInventory().getItemByItemId(id);
+					if (food != null)
+					{
+						break;
+					}
+				}
+				
+				if ((food != null) && _player.isHungry())
+				{
+					IItemHandler handler = ItemHandler.getInstance().getHandler(food.getEtcItem());
+					if (handler != null)
+					{
+						handler.useItem(_player, food, false);
+						SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PET_TOOK_S1_BECAUSE_HE_WAS_HUNGRY);
+						sm.addItemName(food.getItemId());
+						_player.sendPacket(sm);
+					}
+				}
+			}
+			catch (Exception e)
+			{
+				_log.log(Level.SEVERE, "Mounted Pet [NpcId: " + _player.getMountNpcId() + "] a feed task error has occurred", e);
+			}
+		}
+	}
+}

+ 45 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/PunishTask.java

@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.PunishLevel;
+
+/**
+ * Task dedicated to end player's punishment.
+ * @author UnAfraid
+ */
+public class PunishTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public PunishTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.setPunishLevel(PunishLevel.NONE, 0);
+		}
+	}
+}

+ 57 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/PvPFlagTask.java

@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to update player's current pvp status.
+ * @author UnAfraid
+ */
+public class PvPFlagTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public PvPFlagTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player == null)
+		{
+			return;
+		}
+		
+		if (System.currentTimeMillis() > _player.getPvpFlagLasts())
+		{
+			_player.stopPvPFlag();
+		}
+		else if (System.currentTimeMillis() > (_player.getPvpFlagLasts() - 20000))
+		{
+			_player.updatePvPFlag(2);
+		}
+		else
+		{
+			_player.updatePvPFlag(1);
+		}
+	}
+}

+ 45 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/RecoBonusTaskEnd.java

@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.ExVoteSystemInfo;
+
+/**
+ * Task dedicated to end player's recommendation bonus.
+ * @author UnAfraid
+ */
+public class RecoBonusTaskEnd implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public RecoBonusTaskEnd(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.sendPacket(new ExVoteSystemInfo(_player));
+		}
+	}
+}

+ 61 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/RecoGiveTask.java

@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+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.network.serverpackets.UserInfo;
+
+/**
+ * Task dedicated to increase player's recommendation bonus.
+ * @author UnAfraid
+ */
+public class RecoGiveTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public RecoGiveTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			// 10 recommendations to give out after 2 hours of being logged in
+			// 1 more recommendation to give out every hour after that.
+			int recoToGive = 1;
+			if (!_player.isRecoTwoHoursGiven())
+			{
+				recoToGive = 10;
+				_player.setRecoTwoHoursGiven(true);
+			}
+			
+			_player.setRecomLeft(_player.getRecomLeft() + recoToGive);
+			
+			final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_OBTAINED_S1_RECOMMENDATIONS);
+			sm.addNumber(recoToGive);
+			_player.sendPacket(sm);
+			_player.sendPacket(new UserInfo(_player));
+		}
+	}
+}

+ 44 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/RentPetTask.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to dismount player from rented pet.
+ * @author UnAfraid
+ */
+public class RentPetTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public RentPetTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.stopRentPet();
+		}
+	}
+}

+ 44 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/ResetChargesTask.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to reset player's current charges.
+ * @author UnAfraid
+ */
+public class ResetChargesTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public ResetChargesTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.clearCharges();
+		}
+	}
+}

+ 44 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/ResetSoulsTask.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to reset player's current souls.
+ * @author UnAfraid
+ */
+public class ResetSoulsTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public ResetSoulsTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.clearSouls();
+		}
+	}
+}

+ 46 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/ShortBuffTask.java

@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.ShortBuffStatusUpdate;
+
+/**
+ * Task dedicated to update player's short buffs window.
+ * @author UnAfraid
+ */
+public class ShortBuffTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public ShortBuffTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.sendPacket(new ShortBuffStatusUpdate(0, 0, 0));
+			_player.setShortBuffTaskSkillId(0);
+		}
+	}
+}

+ 44 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/SitDownTask.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to put player to sit down.
+ * @author UnAfraid
+ */
+public class SitDownTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public SitDownTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.setIsParalyzed(false);
+		}
+	}
+}

+ 46 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/StandUpTask.java

@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.ai.CtrlIntention;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated to put player to stand up.
+ * @author UnAfraid
+ */
+public class StandUpTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public StandUpTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			_player.setIsSitting(false);
+			_player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+		}
+	}
+}

+ 45 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/TeleportWatchdogTask.java

@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * Task dedicated watch for player teleportation.
+ * @author UnAfraid
+ */
+public class TeleportWatchdogTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public TeleportWatchdogTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if ((_player == null) || !_player.isTeleporting())
+		{
+			return;
+		}
+		_player.onTeleported();
+	}
+}

+ 56 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/VitalityTask.java

@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.actor.stat.PcStat;
+import com.l2jserver.gameserver.model.zone.ZoneId;
+import com.l2jserver.gameserver.network.serverpackets.ExVitalityPointInfo;
+
+/**
+ * Task dedicated to reward player with vitality.
+ * @author UnAfraid
+ */
+public class VitalityTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public VitalityTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (!_player.isInsideZone(ZoneId.PEACE))
+		{
+			return;
+		}
+		
+		if (_player.getVitalityPoints() >= PcStat.MAX_VITALITY_POINTS)
+		{
+			return;
+		}
+		
+		_player.updateVitalityPoints(Config.RATE_RECOVERY_VITALITY_PEACE_ZONE, false, false);
+		_player.sendPacket(new ExVitalityPointInfo(_player.getVitalityPoints()));
+	}
+}

+ 52 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/WarnUserTakeBreakTask.java

@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
+
+/**
+ * Task dedicated to warn user to take a break.
+ * @author UnAfraid
+ */
+public class WarnUserTakeBreakTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public WarnUserTakeBreakTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			if (_player.isOnline())
+			{
+				_player.sendPacket(SystemMessageId.PLAYING_FOR_LONG_TIME);
+			}
+			else
+			{
+				_player.stopWarnUserTakeBreak();
+			}
+		}
+	}
+}

+ 57 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/tasks/player/WaterTask.java

@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.tasks.player;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Task dedicated to make damage to the player while drowning.
+ * @author UnAfraid
+ */
+public class WaterTask implements Runnable
+{
+	private final L2PcInstance _player;
+	
+	public WaterTask(L2PcInstance player)
+	{
+		_player = player;
+	}
+	
+	@Override
+	public void run()
+	{
+		if (_player != null)
+		{
+			double reduceHp = _player.getMaxHp() / 100.0;
+			
+			if (reduceHp < 1)
+			{
+				reduceHp = 1;
+			}
+			
+			_player.reduceCurrentHp(reduceHp, _player, false, false, null);
+			// reduced hp, becouse not rest
+			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DROWN_DAMAGE_S1);
+			sm.addNumber((int) reduceHp);
+			_player.sendPacket(sm);
+		}
+	}
+}

+ 39 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/DoorRequestHolder.java

@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.holders;
+
+import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
+
+/**
+ * @author UnAfraid
+ */
+public class DoorRequestHolder
+{
+	private final L2DoorInstance _target;
+	
+	public DoorRequestHolder(L2DoorInstance door)
+	{
+		_target = door;
+	}
+	
+	public L2DoorInstance getDoor()
+	{
+		return _target;
+	}
+}

+ 47 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/SkillUseHolder.java

@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.holders;
+
+import com.l2jserver.gameserver.model.skills.L2Skill;
+
+/**
+ * @author UnAfraid
+ */
+public class SkillUseHolder extends SkillHolder
+{
+	private final boolean _ctrlPressed;
+	private final boolean _shiftPressed;
+	
+	public SkillUseHolder(L2Skill skill, boolean ctrlPressed, boolean shiftPressed)
+	{
+		super(skill);
+		_ctrlPressed = ctrlPressed;
+		_shiftPressed = shiftPressed;
+	}
+	
+	public boolean isCtrlPressed()
+	{
+		return _ctrlPressed;
+	}
+	
+	public boolean isShiftPressed()
+	{
+		return _shiftPressed;
+	}
+}

+ 47 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/SummonRequestHolder.java

@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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 Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.holders;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.skills.L2Skill;
+
+/**
+ * @author UnAfraid
+ */
+public class SummonRequestHolder
+{
+	private final L2PcInstance _target;
+	private final L2Skill _skill;
+	
+	public SummonRequestHolder(L2PcInstance destination, L2Skill skill)
+	{
+		_target = destination;
+		_skill = skill;
+	}
+	
+	public L2PcInstance getTarget()
+	{
+		return _target;
+	}
+	
+	public L2Skill getSkill()
+	{
+		return _skill;
+	}
+}

+ 28 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/DlgAnswer.java

@@ -27,6 +27,8 @@ import com.l2jserver.gameserver.datatables.AdminTable;
 import com.l2jserver.gameserver.handler.AdminCommandHandler;
 import com.l2jserver.gameserver.handler.AdminCommandHandler;
 import com.l2jserver.gameserver.handler.IAdminCommandHandler;
 import com.l2jserver.gameserver.handler.IAdminCommandHandler;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.holders.DoorRequestHolder;
+import com.l2jserver.gameserver.model.holders.SummonRequestHolder;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.scripting.scriptengine.events.DlgAnswerEvent;
 import com.l2jserver.gameserver.scripting.scriptengine.events.DlgAnswerEvent;
 import com.l2jserver.gameserver.scripting.scriptengine.listeners.talk.DlgAnswerListener;
 import com.l2jserver.gameserver.scripting.scriptengine.listeners.talk.DlgAnswerListener;
@@ -60,19 +62,7 @@ public final class DlgAnswer extends L2GameClientPacket
 			return;
 			return;
 		}
 		}
 		
 		
-		if (Config.DEBUG)
-		{
-			_log.fine(getType() + ": Answer accepted. Message ID " + _messageId + ", answer " + _answer + ", Requester ID " + _requesterId);
-		}
-		if ((_messageId == SystemMessageId.RESSURECTION_REQUEST_BY_C1_FOR_S2_XP.getId()) || (_messageId == SystemMessageId.RESURRECT_USING_CHARM_OF_COURAGE.getId()))
-		{
-			activeChar.reviveAnswer(_answer);
-		}
-		else if (_messageId == SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
-		{
-			activeChar.teleportAnswer(_answer, _requesterId);
-		}
-		else if (_messageId == SystemMessageId.S1.getId())
+		if (_messageId == SystemMessageId.S1.getId())
 		{
 		{
 			String _command = activeChar.getAdminConfirmCmd();
 			String _command = activeChar.getAdminConfirmCmd();
 			if (_command == null)
 			if (_command == null)
@@ -101,13 +91,36 @@ public final class DlgAnswer extends L2GameClientPacket
 				}
 				}
 			}
 			}
 		}
 		}
+		else if ((_messageId == SystemMessageId.RESSURECTION_REQUEST_BY_C1_FOR_S2_XP.getId()) || (_messageId == SystemMessageId.RESURRECT_USING_CHARM_OF_COURAGE.getId()))
+		{
+			activeChar.reviveAnswer(_answer);
+		}
+		else if (_messageId == SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
+		{
+			final SummonRequestHolder holder = activeChar.getScript(SummonRequestHolder.class);
+			if ((_answer == 1) && (holder != null) && (holder.getTarget().getObjectId() == _requesterId))
+			{
+				L2PcInstance.teleToTarget(activeChar, holder.getTarget(), holder.getSkill());
+			}
+			activeChar.removeScript(SummonRequestHolder.class);
+		}
 		else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_OPEN_THE_GATE.getId())
 		else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_OPEN_THE_GATE.getId())
 		{
 		{
-			activeChar.gatesAnswer(_answer, 1);
+			final DoorRequestHolder holder = activeChar.getScript(DoorRequestHolder.class);
+			if ((holder != null) && (holder.getDoor() == activeChar.getTarget()) && (_answer == 1))
+			{
+				holder.getDoor().openMe();
+			}
+			activeChar.removeScript(DoorRequestHolder.class);
 		}
 		}
 		else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_CLOSE_THE_GATE.getId())
 		else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_CLOSE_THE_GATE.getId())
 		{
 		{
-			activeChar.gatesAnswer(_answer, 0);
+			final DoorRequestHolder holder = activeChar.getScript(DoorRequestHolder.class);
+			if ((holder != null) && (holder.getDoor() == activeChar.getTarget()) && (_answer == 1))
+			{
+				holder.getDoor().closeMe();
+			}
+			activeChar.removeScript(DoorRequestHolder.class);
 		}
 		}
 		
 		
 		fireDlgAnswerListener();
 		fireDlgAnswerListener();

+ 10 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/ExGetBookMarkInfoPacket.java

@@ -18,8 +18,8 @@
  */
  */
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
+import com.l2jserver.gameserver.model.TeleportBookmark;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.TeleportBookmark;
 
 
 /**
 /**
  * @author ShanSoft
  * @author ShanSoft
@@ -40,17 +40,17 @@ public class ExGetBookMarkInfoPacket extends L2GameServerPacket
 		writeH(0x84);
 		writeH(0x84);
 		writeD(0x00); // Dummy
 		writeD(0x00); // Dummy
 		writeD(player.getBookmarkslot());
 		writeD(player.getBookmarkslot());
-		writeD(player.getTpbookmark().size());
+		writeD(player.getTeleportBookmarks().size());
 		
 		
-		for (TeleportBookmark tpbm : player.getTpbookmark())
+		for (TeleportBookmark tpbm : player.getTeleportBookmarks())
 		{
 		{
-			writeD(tpbm._id);
-			writeD(tpbm._x);
-			writeD(tpbm._y);
-			writeD(tpbm._z);
-			writeS(tpbm._name);
-			writeD(tpbm._icon);
-			writeS(tpbm._tag);
+			writeD(tpbm.getId());
+			writeD(tpbm.getX());
+			writeD(tpbm.getY());
+			writeD(tpbm.getZ());
+			writeS(tpbm.getName());
+			writeD(tpbm.getIcon());
+			writeS(tpbm.getTag());
 		}
 		}
 	}
 	}
 }
 }

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