Page 1 of 1

protect item... [DESISTANCE]

Posted: Mon Jan 24, 2011 2:35 am
by morfiuz
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision 4488:
L2JDP Revision 7760:

How can I protect a particular item only one player not to drop, change or destroy?

I know that changing table etcitem it is possible, but the change is for everyone and not just a player.

Thanks

Re: protect item...

Posted: Tue Jan 25, 2011 2:47 am
by momo61
morfiuz wrote:If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision 4488:
L2JDP Revision 7760:

How can I protect a particular item only one player not to drop, change or destroy?

I know that changing table etcitem it is possible, but the change is for everyone and not just a player.

Thanks
I'm dont think that is possible... (as far as I know)
There are some tables in the items table, called custom_type1 and custom_type2 ... not sure about those though

Re: protect item...

Posted: Tue Jan 25, 2011 1:01 pm
by Flashy
etcItems? this table was moved out from database to .xml files.

But anyway, u could make a custom Config and add restriction to the requesthandlers in
com.l2jserver.gameserver.network.clientpackets.
- RequestDropItem
- RequestDestroyItem
- RequestSellItem

for example, to don't allow specific player to drop items...
feel free to extend it with item id's

Code: Select all

 Index: java/com/l2jserver/gameserver/network/clientpackets/RequestDestroyItem.java===================================================================--- java/com/l2jserver/gameserver/network/clientpackets/RequestDestroyItem.java (revision 4488)+++ java/com/l2jserver/gameserver/network/clientpackets/RequestDestroyItem.java (working copy)@@ -118,7 +118,17 @@                activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));            return;        }-       +       if(Config.DISCARDITEM_RESTRICTION.length > 1)+       {+           for(String st : Config.DISCARDITEM_RESTRICTION)+           {+               if(activeChar.getName().toLowerCase().contains(st.toLowerCase()))+               {+                   activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));+                   return;+               }+           }+       }        if (!itemToRemove.isStackable() && count > 1)        {            Util.handleIllegalPlayerAction(activeChar, "[RequestDestroyItem] Character " + activeChar.getName() + " of account " + activeChar.getAccountName() + " tried to destroy a non-stackable item with oid " + _objectId + " but has count > 1!", Config.DEFAULT_PUNISH);Index: java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java===================================================================--- java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java    (revision 4488)+++ java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java    (working copy)@@ -80,6 +80,17 @@            activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));            return;        }+       if(Config.DISCARDITEM_RESTRICTION.length > 1)+       {+           for(String st : Config.DISCARDITEM_RESTRICTION)+           {+               if(activeChar.getName().toLowerCase().contains(st.toLowerCase()))+               {+                   activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));+                   return;+               }+           }+       }        if (item.isQuestItem() && !(activeChar.isGM() && Config.GM_TRADE_RESTRICTED_ITEMS))        {            return;Index: java/com/l2jserver/Config.java===================================================================--- java/com/l2jserver/Config.java  (revision 4488)+++ java/com/l2jserver/Config.java  (working copy)@@ -1014,6 +1014,8 @@        //chatfilter    public static ArrayList<String> FILTER_LIST;++   public static String[] DISCARDITEM_RESTRICTION;        /**     * This class initializes all global variables for configuration.<br>@@ -1817,6 +1819,7 @@                    DEADLOCK_CHECK_INTERVAL = Integer.parseInt(General.getProperty("DeadLockCheckInterval", "20"));                    RESTART_ON_DEADLOCK = Boolean.parseBoolean(General.getProperty("RestartOnDeadlock", "False"));                    ALLOW_DISCARDITEM = Boolean.parseBoolean(General.getProperty("AllowDiscardItem", "True"));+                   DISCARDITEM_RESTRICTION = General.getProperty("PlayerDropRestiction", "abc").split(",");                    AUTODESTROY_ITEM_AFTER = Integer.parseInt(General.getProperty("AutoDestroyDroppedItemAfter", "600"));                    HERB_AUTO_DESTROY_TIME = Integer.parseInt(General.getProperty("AutoDestroyHerbTime","60"))*1000;                    String[] split = General.getProperty("ListOfProtectedItems", "0").split(",");Index: java/config/General.properties===================================================================--- java/config/General.properties  (revision 4488)+++ java/config/General.properties  (working copy)@@ -246,6 +246,11 @@ # Default: True AllowDiscardItem = True +# Character Drop restriction+# Disallow characters to discard items which contains in this list.+# Split them with ",". Example: player1,player2,...+PlayerDropRestiction = abc, cdf+ # Delete dropped reward items from world after a specified amount of seconds. Disabled = 0. # Default: 600 AutoDestroyDroppedItemAfter = 600  

Re: protect item...

Posted: Tue Jan 25, 2011 2:58 pm
by morfiuz
momo61 wrote: I'm dont think that is possible... (as far as I know)
There are some tables in the items table, called custom_type1 and custom_type2 ... not sure about those though
as it is not possible?

I even know lineage 2 servers that use it!
I just do not know where to start to do that.


Flashy

I will look into this possibility. thanks

Re: protect item...

Posted: Tue Jan 25, 2011 3:08 pm
by UnAfraid
Flashy wrote:etcItems? this table was moved out from database to .xml files.

But anyway, u could make a custom Config and add restriction to the requesthandlers in
com.l2jserver.gameserver.network.clientpackets.
- RequestDropItem
- RequestDestroyItem
- RequestSellItem

for example, to don't allow specific player to drop items...
feel free to extend it with item id's

Code: Select all

 Index: java/com/l2jserver/gameserver/network/clientpackets/RequestDestroyItem.java===================================================================--- java/com/l2jserver/gameserver/network/clientpackets/RequestDestroyItem.java (revision 4488)+++ java/com/l2jserver/gameserver/network/clientpackets/RequestDestroyItem.java (working copy)@@ -118,7 +118,17 @@                activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));            return;        }-       +       if(Config.DISCARDITEM_RESTRICTION.length > 1)+       {+           for(String st : Config.DISCARDITEM_RESTRICTION)+           {+               if(activeChar.getName().toLowerCase().contains(st.toLowerCase()))+               {+                   activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));+                   return;+               }+           }+       }        if (!itemToRemove.isStackable() && count > 1)        {            Util.handleIllegalPlayerAction(activeChar, "[RequestDestroyItem] Character " + activeChar.getName() + " of account " + activeChar.getAccountName() + " tried to destroy a non-stackable item with oid " + _objectId + " but has count > 1!", Config.DEFAULT_PUNISH);Index: java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java===================================================================--- java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java    (revision 4488)+++ java/com/l2jserver/gameserver/network/clientpackets/RequestDropItem.java    (working copy)@@ -80,6 +80,17 @@            activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));            return;        }+       if(Config.DISCARDITEM_RESTRICTION.length > 1)+       {+           for(String st : Config.DISCARDITEM_RESTRICTION)+           {+               if(activeChar.getName().toLowerCase().contains(st.toLowerCase()))+               {+                   activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));+                   return;+               }+           }+       }        if (item.isQuestItem() && !(activeChar.isGM() && Config.GM_TRADE_RESTRICTED_ITEMS))        {            return;Index: java/com/l2jserver/Config.java===================================================================--- java/com/l2jserver/Config.java  (revision 4488)+++ java/com/l2jserver/Config.java  (working copy)@@ -1014,6 +1014,8 @@        //chatfilter    public static ArrayList<String> FILTER_LIST;++   public static String[] DISCARDITEM_RESTRICTION;        /**     * This class initializes all global variables for configuration.<br>@@ -1817,6 +1819,7 @@                    DEADLOCK_CHECK_INTERVAL = Integer.parseInt(General.getProperty("DeadLockCheckInterval", "20"));                    RESTART_ON_DEADLOCK = Boolean.parseBoolean(General.getProperty("RestartOnDeadlock", "False"));                    ALLOW_DISCARDITEM = Boolean.parseBoolean(General.getProperty("AllowDiscardItem", "True"));+                   DISCARDITEM_RESTRICTION = General.getProperty("PlayerDropRestiction", "abc").split(",");                    AUTODESTROY_ITEM_AFTER = Integer.parseInt(General.getProperty("AutoDestroyDroppedItemAfter", "600"));                    HERB_AUTO_DESTROY_TIME = Integer.parseInt(General.getProperty("AutoDestroyHerbTime","60"))*1000;                    String[] split = General.getProperty("ListOfProtectedItems", "0").split(",");Index: java/config/General.properties===================================================================--- java/config/General.properties  (revision 4488)+++ java/config/General.properties  (working copy)@@ -246,6 +246,11 @@ # Default: True AllowDiscardItem = True +# Character Drop restriction+# Disallow characters to discard items which contains in this list.+# Split them with ",". Example: player1,player2,...+PlayerDropRestiction = abc, cdf+ # Delete dropped reward items from world after a specified amount of seconds. Disabled = 0. # Default: 600 AutoDestroyDroppedItemAfter = 600  
cant u just use object id :S name can be changed ..
also he can put it on private store sell, trade or mail it ^^