Jump to content

No enchant near wh


Recommended Posts

  • 5 weeks later...
  • 4 months later...

You can have 2 NPEs with this code, because :

- "knows" try to be feed with activeChar's knownlist, even if activeChar isn't ingame.

- "knows" try to search for an object, but imagine you try to enchant in a place where there is no one around ?

 

Correct way is to initialize Collection after the null check, just before the "for". And to include a null check in if (wh instanceof L2WarehouseInstance)

 

So we got (I didn't verify where you putted your "for" loop, let's say it was good) :

 

final Collection<L2Character> knowns  = activeChar.getKnownList().getKnownCharactersInRadius(400);
for (L2Object wh : knowns)
{
    if (wh != null && wh instanceof L2WarehouseInstance)
    {
        activeChar.sendMessage("You cannot enchant near warehouse.");
        return;
    }
}

Link to comment
Share on other sites

  • 8 years later...
On 8/28/2011 at 8:34 PM, Prince* said:

Fix for that: http://maxcheaters.com/forum/index.php?topic=218257.0 and for enchant phx. and other enchant like near wh..

 

 


--- /trunk/gameserver/java/net/sf/l2j/gameserver/clientpackets/RequestEnchantItem.java
+++ /trunk/gameserver/java/net/sf/l2j/gameserver/clientpackets/RequestEnchantItem.java

@@ 20,1 @@

+import java.util.Collection;
import java.util.logging.Logger;

import net.sf.l2j.gameserver.model.Inventory;
+import net.sf.l2j.gameserver.model.L2Character;
import net.sf.l2j.gameserver.model.L2ItemInstance;


import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2WarehouseInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;


import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2World;


@@ -61,7 +61,15 @@
     {
         L2PcInstance activeChar = getClient().getActiveChar();
+               Collection<L2Character> knowns  = activeChar.getKnownList().getKnownCharactersInRadius(400);
         if (activeChar == null || _objectId == 0)
                        return;
+              
+               for (L2Object wh : knowns)
+               {
+                       if (wh instanceof L2WarehouseInstance)
+                       {
+                               activeChar.sendMessage("You cannot enchant near warehouse.");
+                               return;
+                       }
+               }
         L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
         L2ItemInstance scroll = activeChar.getActiveEnchantItem();
 

 

 

i have search on forum and i don't found any post with that code :)

is any of that for frozen ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don’t be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don’t waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME Don’t wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you. BREAK UP A RELATIONSHIP The perfect service to break up a relationship you don’t think legitimate. Your lover has gone with someone else Don’t hesitate to break them up as this ritual and prayer is very powerful and will Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don’t be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don’t waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME Don’t wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you.
    • When I was in a similar situation, I found that using a VPS was a great option for affordable hosting. It's not completely free, but it's usually much cheaper than dedicated servers and provides enough resources for testing purposes.
    • 24 Hours for NEW WORLD 5000x https://x5000.l2focus.com/    JOIN BEST PVP COMUNITY DISCORD FOR INFORMATIONS: https://discord.com/invite/L2Focus
    • New Webite and Update have been released: https://somikpatch.com/Updates   All upcoming updates and infromation will be posted on the website.
    • I''m looking for client and any server files.  
  • Topics

×
×
  • Create New...