Advertisement
Nik

Drop protection system

Nik
Apr 20th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 22.89 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/model/DropProtection.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/model/DropProtection.java (revision 0)
  4. +++ java/com/l2jserver/gameserver/model/DropProtection.java (revision 0)
  5. @@ -0,0 +1,95 @@
  6. +/*
  7. + * This program is free software: you can redistribute it and/or modify it under
  8. + * the terms of the GNU General Public License as published by the Free Software
  9. + * Foundation, either version 3 of the License, or (at your option) any later
  10. + * version.
  11. + *
  12. + * This program is distributed in the hope that it will be useful, but WITHOUT
  13. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  15. + * details.
  16. + *
  17. + * You should have received a copy of the GNU General Public License along with
  18. + * this program. If not, see <http://www.gnu.org/licenses/>.
  19. + */
  20. +package com.l2jserver.gameserver.model;
  21. +
  22. +import java.util.concurrent.ScheduledFuture;
  23. +
  24. +import com.l2jserver.gameserver.ThreadPoolManager;
  25. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  26. +import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
  27. +
  28. +/**
  29. + *
  30. + * @author DrHouse
  31. + *
  32. + */
  33. +public class DropProtection implements Runnable
  34. +{
  35. +   private volatile boolean _isProtected = false;
  36. +   private L2PcInstance _owner = null;
  37. +   private ScheduledFuture<?> _task = null;
  38. +  
  39. +   private static final long PROTECTED_MILLIS_TIME = 15000;
  40. +  
  41. +   public synchronized void run()
  42. +   {
  43. +       _isProtected = false;
  44. +       _owner = null;
  45. +       _task = null;
  46. +   }
  47. +  
  48. +   public boolean isProtected()
  49. +   {
  50. +       return _isProtected;
  51. +   }
  52. +  
  53. +   public L2PcInstance getOwner()
  54. +   {
  55. +       return _owner;
  56. +   }
  57. +  
  58. +   public synchronized boolean tryPickUp(L2PcInstance actor)
  59. +   {
  60. +       if (!_isProtected)
  61. +           return true;
  62. +      
  63. +       if (_owner == actor)
  64. +           return true;
  65. +      
  66. +       if (_owner.getParty() != null && _owner.getParty() == actor.getParty())
  67. +           return true;
  68. +      
  69. +       if (_owner.getClan() != null && _owner.getClan() == actor.getClan())
  70. +           return true;
  71. +      
  72. +       return false;
  73. +   }
  74. +  
  75. +   public boolean tryPickUp(L2PetInstance pet)
  76. +   {
  77. +       return tryPickUp(pet.getOwner());
  78. +   }
  79. +  
  80. +   public synchronized void unprotect()
  81. +   {
  82. +       if (_task != null)
  83. +           _task.cancel(false);
  84. +       _isProtected = false;
  85. +       _owner = null;
  86. +       _task = null;
  87. +   }
  88. +  
  89. +   public synchronized void protect(L2PcInstance player)
  90. +   {
  91. +       unprotect();
  92. +      
  93. +       _isProtected = true;
  94. +      
  95. +       if ((_owner = player) == null)
  96. +           throw new NullPointerException("Trying to protect dropped item to null owner");
  97. +      
  98. +       _task = ThreadPoolManager.getInstance().scheduleGeneral(this, PROTECTED_MILLIS_TIME);
  99. +   }
  100. +}
  101. Index: java/com/l2jserver/gameserver/model/L2ItemInstance.java
  102. ===================================================================
  103. --- java/com/l2jserver/gameserver/model/L2ItemInstance.java (revision 4578)
  104. +++ java/com/l2jserver/gameserver/model/L2ItemInstance.java (working copy)
  105. @@ -158,6 +158,8 @@
  106.    
  107.     private ScheduledFuture<?> itemLootShedule = null;
  108.     public ScheduledFuture<?> _lifeTimeTask;
  109. +  
  110. +   private final DropProtection _dropProtection = new DropProtection();
  111.     /**
  112.      * Constructor of the L2ItemInstance from the objectId and the itemId.
  113.      * @param objectId : int designating the ID of the object in the world
  114. @@ -1891,6 +1893,11 @@
  115.             activeChar.sendPacket(new SpawnItem(this));
  116.     }
  117.    
  118. +   public final DropProtection getDropProtection()
  119. +   {
  120. +       return _dropProtection;
  121. +   }
  122. +  
  123.     public boolean isPublished()
  124.     {
  125.         return _published;
  126. Index: java/com/l2jserver/gameserver/model/actor/L2Attackable.java
  127. ===================================================================
  128. --- java/com/l2jserver/gameserver/model/actor/L2Attackable.java (revision 4578)
  129. +++ java/com/l2jserver/gameserver/model/actor/L2Attackable.java (working copy)
  130. @@ -595,19 +595,13 @@
  131.             if (getAggroList().isEmpty())
  132.                 return;
  133.            
  134. -           // Manage Base, Quests and Sweep drops of the L2Attackable
  135. -           doItemDrop(lastAttacker);
  136. -          
  137. -           // Manage drop of Special Events created by GM for a defined period
  138. -           doEventDrop(lastAttacker);
  139. -          
  140. -           if (!getMustRewardExpSP())
  141. -               return;
  142. -          
  143.             int damage;
  144.             L2Character attacker, ddealer;
  145.             RewardInfo reward;
  146.            
  147. +           L2PcInstance maxDealer = null;
  148. +           int maxDamage = 0;
  149. +          
  150.             // While Interating over This Map Removing Object is Not Allowed
  151.             //synchronized (getAggroList())
  152.             {
  153. @@ -644,9 +638,25 @@
  154.                             reward.addDamage(damage);
  155.                        
  156.                         rewards.put(ddealer, reward);
  157. +                      
  158. +                       if (ddealer.getActingPlayer() != null && reward._dmg > maxDamage)
  159. +                       {
  160. +                           maxDealer = ddealer.getActingPlayer();
  161. +                           maxDamage = reward._dmg;
  162. +                       }
  163.                     }
  164.                 }
  165.             }
  166. +          
  167. +           // Manage Base, Quests and Sweep drops of the L2Attackable
  168. +           doItemDrop(maxDealer != null && maxDealer.isOnline() == true ? maxDealer : lastAttacker);
  169. +
  170. +           // Manage drop of Special Events created by GM for a defined period
  171. +           doEventDrop(lastAttacker);
  172. +
  173. +           if (!getMustRewardExpSP())
  174. +               return;
  175. +          
  176.             if (!rewards.isEmpty())
  177.             {
  178.                 L2Party attackerParty;
  179. @@ -1575,9 +1585,9 @@
  180.         return null;
  181.     }
  182.    
  183. -   public void doItemDrop(L2Character lastAttacker)
  184. +   public void doItemDrop(L2Character mainDamageDealer)
  185.     {
  186. -       doItemDrop(getTemplate(),lastAttacker);
  187. +       doItemDrop(getTemplate(),mainDamageDealer);
  188.     }
  189.    
  190.     /**
  191. @@ -1599,12 +1609,12 @@
  192.      *
  193.      * @param lastAttacker The L2Character that has killed the L2Attackable
  194.      */
  195. -   public void doItemDrop(L2NpcTemplate npcTemplate, L2Character lastAttacker)
  196. +   public void doItemDrop(L2NpcTemplate npcTemplate, L2Character mainDamageDealer)
  197.     {
  198. -       if (lastAttacker == null)
  199. +       if (mainDamageDealer == null)
  200.             return;
  201.        
  202. -       L2PcInstance player = lastAttacker.getActingPlayer();
  203. +       L2PcInstance player = mainDamageDealer.getActingPlayer();
  204.        
  205.         // Don't drop anything if the last attacker or owner isn't L2PcInstance
  206.         if (player == null)
  207. @@ -1780,7 +1790,7 @@
  208.     /**
  209.      * Drop reward item.
  210.      */
  211. -   public L2ItemInstance dropItem(L2PcInstance lastAttacker, RewardItem item)
  212. +   public L2ItemInstance dropItem(L2PcInstance mainDamageDealer, RewardItem item)
  213.     {
  214.         int randDropLim = 70;
  215.        
  216. @@ -1790,12 +1800,13 @@
  217.             // Randomize drop position
  218.             int newX = getX() + Rnd.get(randDropLim * 2 + 1) - randDropLim;
  219.             int newY = getY() + Rnd.get(randDropLim * 2 + 1) - randDropLim;
  220. -           int newZ = Math.max(getZ(), lastAttacker.getZ()) + 20; // TODO: temp hack, do somethign nicer when we have geodatas
  221. +           int newZ = Math.max(getZ(), mainDamageDealer.getZ()) + 20; // TODO: temp hack, do somethign nicer when we have geodatas
  222.            
  223.             if (ItemTable.getInstance().getTemplate(item.getItemId()) != null)
  224.             {
  225.                 // Init the dropped L2ItemInstance and add it in the world as a visible object at the position where mob was last
  226. -               ditem = ItemTable.getInstance().createItem("Loot", item.getItemId(), item.getCount(), lastAttacker, this);
  227. +               ditem = ItemTable.getInstance().createItem("Loot", item.getItemId(), item.getCount(), mainDamageDealer, this);
  228. +               ditem.getDropProtection().protect(mainDamageDealer);
  229.                 ditem.dropMe(this, newX, newY, newZ);
  230.                
  231.                 // Add drop to auto destroy item task
  232. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  233. ===================================================================
  234. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 4578)
  235. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  236. @@ -523,11 +523,11 @@
  237.     private int _transformationId = 0;
  238.    
  239.     /** The table containing all L2RecipeList of the L2PcInstance */
  240. -   private Map<Integer, L2RecipeList> _dwarvenRecipeBook = new FastMap<Integer, L2RecipeList>();
  241. -   private Map<Integer, L2RecipeList> _commonRecipeBook = new FastMap<Integer, L2RecipeList>();
  242. +   private final Map<Integer, L2RecipeList> _dwarvenRecipeBook = new FastMap<Integer, L2RecipeList>();
  243. +   private final Map<Integer, L2RecipeList> _commonRecipeBook = new FastMap<Integer, L2RecipeList>();
  244.    
  245.     /** Premium Items */
  246. -   private Map<Integer, L2PremiumItem> _premiumItems = new FastMap<Integer, L2PremiumItem>();
  247. +   private final Map<Integer, L2PremiumItem> _premiumItems = new FastMap<Integer, L2PremiumItem>();
  248.    
  249.     /** True if the L2PcInstance is sitting */
  250.     private boolean _waitTypeSitting;
  251. @@ -539,7 +539,7 @@
  252.     private boolean _observerMode = false;
  253.    
  254.     /** Stored from last ValidatePosition **/
  255. -   private Point3D _lastServerPosition = new Point3D(0, 0, 0);
  256. +   private final Point3D _lastServerPosition = new Point3D(0, 0, 0);
  257.    
  258.     /** The number of recommendation obtained by the L2PcInstance */
  259.     private int _recomHave; // how much I was recommended by others
  260. @@ -552,7 +552,7 @@
  261.     /** Recommendation Two Hours bonus **/
  262.     private boolean _recoTwoHoursGiven = false;
  263.    
  264. -   private PcInventory _inventory = new PcInventory(this);
  265. +   private final PcInventory _inventory = new PcInventory(this);
  266.     private PcWarehouse _warehouse;
  267.     private PcRefund _refund;
  268.    
  269. @@ -581,16 +581,16 @@
  270.     private int _questNpcObject = 0;
  271.    
  272.     /** The table containing all Quests began by the L2PcInstance */
  273. -   private Map<String, QuestState> _quests = new FastMap<String, QuestState>();
  274. +   private final Map<String, QuestState> _quests = new FastMap<String, QuestState>();
  275.    
  276.     /** The list containing all shortCuts of this L2PcInstance */
  277. -   private ShortCuts _shortCuts = new ShortCuts(this);
  278. +   private final ShortCuts _shortCuts = new ShortCuts(this);
  279.    
  280.     /** The list containing all macroses of this L2PcInstance */
  281. -   private MacroList _macroses = new MacroList(this);
  282. +   private final MacroList _macroses = new MacroList(this);
  283.    
  284. -   private List<L2PcInstance> _snoopListener = new FastList<L2PcInstance>();
  285. -   private List<L2PcInstance> _snoopedPlayer = new FastList<L2PcInstance>();
  286. +   private final List<L2PcInstance> _snoopListener = new FastList<L2PcInstance>();
  287. +   private final List<L2PcInstance> _snoopedPlayer = new FastList<L2PcInstance>();
  288.    
  289.     private ClassId _skillLearningClassId;
  290.    
  291. @@ -656,7 +656,7 @@
  292.     private int _deathPenaltyBuffLevel = 0;
  293.    
  294.     // charges
  295. -   private AtomicInteger _charges = new AtomicInteger();
  296. +   private final AtomicInteger _charges = new AtomicInteger();
  297.     private ScheduledFuture<?> _chargeTask = null;
  298.    
  299.     // Absorbed Souls
  300. @@ -681,7 +681,7 @@
  301.     // there can only be one active party request at once
  302.     private L2PcInstance _activeRequester;
  303.     private long _requestExpireTime = 0;
  304. -   private L2Request _request = new L2Request(this);
  305. +   private final L2Request _request = new L2Request(this);
  306.     private L2ItemInstance _arrowItem;
  307.     private L2ItemInstance _boltItem;
  308.    
  309. @@ -737,10 +737,10 @@
  310.     private byte _handysBlockCheckerEventArena = -1;
  311.    
  312.     /** new loto ticket **/
  313. -   private int _loto[] = new int[5];
  314. +   private final int _loto[] = new int[5];
  315.     //public static int _loto_nums[] = {0,1,2,3,4,5,6,7,8,9,};
  316.     /** new race ticket **/
  317. -   private int _race[] = new int[2];
  318. +   private final int _race[] = new int[2];
  319.    
  320.     private final BlockList _blockList = new BlockList(this);
  321.    
  322. @@ -762,8 +762,8 @@
  323.     private ScheduledFuture<?> _taskWater;
  324.    
  325.     /** Bypass validations */
  326. -   private List<String> _validBypass = new FastList<String>();
  327. -   private List<String> _validBypass2 = new FastList<String>();
  328. +   private final List<String> _validBypass = new FastList<String>();
  329. +   private final List<String> _validBypass2 = new FastList<String>();
  330.    
  331.     private Forum _forumMail;
  332.     private Forum _forumMemo;
  333. @@ -861,6 +861,7 @@
  334.            
  335.         }
  336.        
  337. +       @Override
  338.         public void run()
  339.         {
  340.             try
  341. @@ -896,11 +897,11 @@
  342.    
  343.     private class HerbTask implements Runnable
  344.     {
  345. -       private String _process;
  346. -       private int _itemId;
  347. -       private long _count;
  348. -       private L2Object _reference;
  349. -       private boolean _sendMessage;
  350. +       private final String _process;
  351. +       private final int _itemId;
  352. +       private final long _count;
  353. +       private final L2Object _reference;
  354. +       private final boolean _sendMessage;
  355.        
  356.         HerbTask(String process, int itemId, long count, L2Object reference, boolean sendMessage)
  357.         {
  358. @@ -911,6 +912,7 @@
  359.             _sendMessage = sendMessage;
  360.         }
  361.        
  362. +       @Override
  363.         public void run()
  364.         {
  365.             try
  366. @@ -929,6 +931,7 @@
  367.    
  368.     private class ShortBuffTask implements Runnable
  369.     {
  370. +       @Override
  371.         public void run()
  372.         {
  373.             if (L2PcInstance.this == null)
  374. @@ -951,9 +954,9 @@
  375.     /** Skill casting information (used to queue when several skills are cast in a short time) **/
  376.     public static class SkillDat
  377.     {
  378. -       private L2Skill _skill;
  379. -       private boolean _ctrlPressed;
  380. -       private boolean _shiftPressed;
  381. +       private final L2Skill _skill;
  382. +       private final boolean _ctrlPressed;
  383. +       private final boolean _shiftPressed;
  384.        
  385.         protected SkillDat(L2Skill skill, boolean ctrlPressed, boolean shiftPressed)
  386.         {
  387. @@ -984,7 +987,7 @@
  388.     }
  389.    
  390.     //summon friend
  391. -   private SummonRequest _summonRequest = new SummonRequest();
  392. +   private final SummonRequest _summonRequest = new SummonRequest();
  393.    
  394.     private static class SummonRequest
  395.     {
  396. @@ -1009,7 +1012,7 @@
  397.     }
  398.    
  399.     // open/close gates
  400. -   private GatesRequest _gatesRequest = new GatesRequest();
  401. +   private final GatesRequest _gatesRequest = new GatesRequest();
  402.    
  403.     private static class GatesRequest
  404.     {
  405. @@ -3110,6 +3113,7 @@
  406.      */
  407.     private class SitDownTask implements Runnable
  408.     {
  409. +       @Override
  410.         public void run()
  411.         {
  412.             L2PcInstance.this.setIsParalyzed(false);
  413. @@ -3121,6 +3125,7 @@
  414.      */
  415.     private class StandUpTask implements Runnable
  416.     {
  417. +       @Override
  418.         public void run()
  419.         {
  420.             L2PcInstance.this.setIsSitting(false);
  421. @@ -3454,7 +3459,7 @@
  422.            
  423.             // If over capacity, drop the item
  424.             if (!isGM() && !_inventory.validateCapacity(0, item.isQuestItem()) && newitem.isDropable() && (!newitem.isStackable() || newitem.getLastChange() != L2ItemInstance.MODIFIED))
  425. -               dropItem("InvDrop", newitem, null, true);
  426. +               dropItem("InvDrop", newitem, null, true, true);
  427.            
  428.             // Cursed Weapon
  429.             else if(CursedWeaponsManager.getInstance().isCursed(newitem.getItemId()))
  430. @@ -3859,9 +3864,10 @@
  431.      * @param item : L2ItemInstance to be dropped
  432.      * @param reference : L2Object Object referencing current action like NPC selling item or previous item in transformation
  433.      * @param sendMessage : boolean Specifies whether to send message to Client about this action
  434. +    * @param protectItem: whether or not dropped item must be protected temporary against other players
  435.      * @return boolean informing if the action was successfull
  436.      */
  437. -   public boolean dropItem(String process, L2ItemInstance item, L2Object reference, boolean sendMessage)
  438. +   public boolean dropItem(String process, L2ItemInstance item, L2Object reference, boolean sendMessage, boolean protectItem)
  439.     {
  440.         item = _inventory.dropItem(process, item, this, reference);
  441.        
  442. @@ -3875,19 +3881,27 @@
  443.        
  444.         item.dropMe(this, getX() + Rnd.get(50) - 25, getY() + Rnd.get(50) - 25, getZ() + 20);
  445.        
  446. -       if (Config.AUTODESTROY_ITEM_AFTER >0 && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getItemId()))
  447. -       {
  448. -           if ( (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable())
  449. +       if (Config.AUTODESTROY_ITEM_AFTER > 0
  450. +               && Config.DESTROY_DROPPED_PLAYER_ITEM
  451. +               && !Config.LIST_PROTECTED_ITEMS.contains(item.getItemId())) {
  452. +           if ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM)
  453. +                   || !item.isEquipable())
  454.                 ItemsAutoDestroy.getInstance().addItem(item);
  455.         }
  456. -       if (Config.DESTROY_DROPPED_PLAYER_ITEM){
  457. -           if (!item.isEquipable() || (item.isEquipable()  && Config.DESTROY_EQUIPABLE_PLAYER_ITEM ))
  458. +      
  459. +       // protection against auto destroy dropped item
  460. +       if (Config.DESTROY_DROPPED_PLAYER_ITEM) {
  461. +           if (!item.isEquipable()
  462. +                   || (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM))
  463.                 item.setProtected(false);
  464.             else
  465.                 item.setProtected(true);
  466. -       }
  467. -       else
  468. +       } else
  469.             item.setProtected(true);
  470. +
  471. +       // retail drop protection
  472. +       if (protectItem)
  473. +           item.getDropProtection().protect(this);
  474.        
  475.         // Send inventory update packet
  476.         if (!Config.FORCE_INVENTORY_UPDATE)
  477. @@ -3914,6 +3928,11 @@
  478.         return true;
  479.     }
  480.    
  481. +   public boolean dropItem(String process, L2ItemInstance item, L2Object reference, boolean sendMessage)
  482. +   {
  483. +       return dropItem(process, item, reference, sendMessage, false);
  484. +   }
  485. +  
  486.     /**
  487.      * Drop item from inventory by using its <B>objectID</B> and send a Server->Client InventoryUpdate packet to the L2PcInstance.
  488.      * @param process : String Identifier of process triggering this action
  489. @@ -3926,7 +3945,7 @@
  490.      * @param sendMessage : boolean Specifies whether to send message to Client about this action
  491.      * @return L2ItemInstance corresponding to the new item or the updated item in inventory
  492.      */
  493. -   public L2ItemInstance dropItem(String process, int objectId, long count, int x, int y, int z, L2Object reference, boolean sendMessage)
  494. +   public L2ItemInstance dropItem(String process, int objectId, long count, int x, int y, int z, L2Object reference, boolean sendMessage, boolean protectItem)
  495.     {
  496.         L2ItemInstance invitem = _inventory.getItemByObjectId(objectId);
  497.         L2ItemInstance item = _inventory.dropItem(process, objectId, count, this, reference);
  498. @@ -3955,6 +3974,10 @@
  499.         else
  500.             item.setProtected(true);
  501.        
  502. +       // retail drop protection
  503. +       if (protectItem)
  504. +           item.getDropProtection().protect(this);
  505. +      
  506.         // Send inventory update packet
  507.         if (!Config.FORCE_INVENTORY_UPDATE)
  508.         {
  509. @@ -4511,6 +4534,7 @@
  510.         /**
  511.          * @see java.lang.Runnable#run()
  512.          */
  513. +       @Override
  514.         public void run()
  515.         {
  516.             L2GameClient client = L2PcInstance.this.getClient();
  517. @@ -4652,6 +4676,15 @@
  518.                 sendPacket(ActionFailed.STATIC_PACKET);
  519.                 return;
  520.             }
  521. +
  522. +           if (!target.getDropProtection().tryPickUp(this))
  523. +           {
  524. +               sendPacket(ActionFailed.STATIC_PACKET);
  525. +               SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.FAILED_TO_PICKUP_S1);
  526. +               smsg.addItemName(target);
  527. +               sendPacket(smsg);
  528. +               return;
  529. +           }
  530.            
  531.             if ( ((isInParty() && getParty().getLootDistribution() == L2Party.ITEM_LOOTER) || !isInParty()) && !_inventory.validateCapacity(target))
  532.             {
  533. @@ -9562,6 +9595,7 @@
  534.    
  535.     private class InventoryEnable implements Runnable
  536.     {
  537. +       @Override
  538.         public void run()
  539.         {
  540.             _inventoryDisable = false;
  541. @@ -9803,6 +9837,7 @@
  542.    
  543.     private class WarnUserTakeBreak implements Runnable
  544.     {
  545. +       @Override
  546.         public void run()
  547.         {
  548.             if (L2PcInstance.this.isOnline())
  549. @@ -9817,6 +9852,7 @@
  550.    
  551.     private class RentPetTask implements Runnable
  552.     {
  553. +       @Override
  554.         public void run()
  555.         {
  556.             stopRentPet();
  557. @@ -9825,6 +9861,7 @@
  558.    
  559.     private class WaterTask implements Runnable
  560.     {
  561. +       @Override
  562.         public void run()
  563.         {
  564.             double reduceHp = getMaxHp()/100.0;
  565. @@ -9856,6 +9893,7 @@
  566.             _isUpperGrade = isUpperGrade;
  567.         }
  568.        
  569. +       @Override
  570.         public void run()
  571.         {
  572.             if (System.currentTimeMillis() >= _endTaskTime) {
  573. @@ -11177,6 +11215,7 @@
  574.             _player = L2PcInstance.this;
  575.         }
  576.        
  577. +       @Override
  578.         public void run()
  579.         {
  580.             if (_player == null || !_player.isTeleporting())
  581. @@ -12626,6 +12665,7 @@
  582.    
  583.     private class PunishTask implements Runnable
  584.     {
  585. +       @Override
  586.         public void run()
  587.         {
  588.             L2PcInstance.this.setPunishLevel(PunishLevel.NONE, 0);
  589. @@ -12660,6 +12700,7 @@
  590.             _value = value;
  591.         }
  592.        
  593. +       @Override
  594.         public void run()
  595.         {
  596.             if (_player == null || (_player.isDead() && !Config.FAME_FOR_DEAD_PLAYERS))
  597. @@ -12701,6 +12742,7 @@
  598.             _player = player;
  599.         }
  600.        
  601. +       @Override
  602.         public void run()
  603.         {
  604.             if (!_player.isInsideZone(L2Character.ZONE_PEACE))
  605. @@ -12891,6 +12933,7 @@
  606.    
  607.     private class SoulTask implements Runnable
  608.     {
  609. +       @Override
  610.         public void run()
  611.         {
  612.             L2PcInstance.this.clearSouls();
  613. @@ -12997,7 +13040,7 @@
  614.             addSkill(SkillTable.getInstance().getInfo(5076, getDeathPenaltyBuffLevel()), false);
  615.     }
  616.    
  617. -   private FastMap<Integer, TimeStamp> _reuseTimeStamps = new FastMap<Integer, TimeStamp>().shared();
  618. +   private final FastMap<Integer, TimeStamp> _reuseTimeStamps = new FastMap<Integer, TimeStamp>().shared();
  619.     private boolean _canFeed;
  620.     private int _eventEffectId = 0;
  621.     private boolean _isInSiege;
  622. @@ -13474,6 +13517,7 @@
  623.     /** Section for mounted pets */
  624.     private class FeedTask implements Runnable
  625.     {
  626. +       @Override
  627.         public void run()
  628.         {
  629.             try
  630. @@ -13616,6 +13660,7 @@
  631.    
  632.     private class Dismount implements Runnable
  633.     {
  634. +       @Override
  635.         public void run()
  636.         {
  637.             try
  638. @@ -13815,6 +13860,7 @@
  639.     private class ChargeTask implements Runnable
  640.     {
  641.        
  642. +       @Override
  643.         public void run()
  644.         {
  645.             L2PcInstance.this.clearCharges();
  646. @@ -14330,7 +14376,7 @@
  647.      * list of character friends
  648.      *
  649.      */
  650. -   private List<Integer> _friendList = new FastList<Integer>();
  651. +   private final List<Integer> _friendList = new FastList<Integer>();
  652.    
  653.     public List<Integer> getFriendList()
  654.     {
  655. @@ -15023,6 +15069,7 @@
  656.    
  657.     private class RecoGiveTask implements Runnable
  658.     {
  659. +       @Override
  660.         public void run()
  661.         {
  662.             if (L2PcInstance.this == null)
  663. @@ -15051,6 +15098,7 @@
  664.    
  665.     private class RecoBonusTaskEnd implements Runnable
  666.     {
  667. +       @Override
  668.         public void run()
  669.         {
  670.             if (L2PcInstance.this == null)
  671. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java
  672. ===================================================================
  673. --- java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java   (revision 4578)
  674. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java   (working copy)
  675. @@ -766,16 +766,23 @@
  676.         }
  677.     }
  678.    
  679. -   public void dropItemHere(L2ItemInstance dropit)
  680. +   public void dropItemHere(L2ItemInstance dropit, boolean protect)
  681.     {
  682.         dropit = getInventory().dropItem("Drop", dropit.getObjectId(), dropit.getCount(), getOwner(), this);
  683.        
  684.         if (dropit != null)
  685.         {
  686. +           if (protect)
  687. +               dropit.getDropProtection().protect(getOwner());
  688.             _logPet.finer("Item id to drop: "+dropit.getItemId()+" amount: "+dropit.getCount());
  689.             dropit.dropMe(this, getX(), getY(), getZ()+100);
  690.         }
  691.     }
  692. +  
  693. +   public void dropItemHere(L2ItemInstance dropit)
  694. +   {
  695. +       dropItemHere(dropit, false);
  696. +   }
  697.  
  698.     /** @return Returns the mount able. */
  699.     @Override
  700. Index: java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java
  701. ===================================================================
  702. --- java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java    (revision 4578)
  703. +++ java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java    (working copy)
  704. @@ -200,7 +200,7 @@
  705.             activeChar.sendPacket(il);
  706.         }
  707.        
  708. -       L2ItemInstance dropedItem = activeChar.dropItem("Drop", _objectId, _count, _x, _y, _z, null, false);
  709. +       L2ItemInstance dropedItem = activeChar.dropItem("Drop", _objectId, _count, _x, _y, _z, null, false, true);
  710.        
  711.         if (Config.DEBUG)
  712.             _log.fine("dropping " + _objectId + " item(" + _count + ") at: " + _x + " " + _y + " " + _z);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement