Page 2 of 2

Re: SEVERE: Failed executing HitTask.

Posted: Wed Jun 03, 2009 6:57 am
by janiii
fix (changed the way of dropping items in the way i understand it)

http://www.pastebin.cz/19471

Code: Select all

Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java===================================================================--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 3119)+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)@@ -5232,10 +5232,11 @@                dropLimit = Config.PLAYER_DROP_LIMIT;            } -            int dropCount = 0;-           while (dropPercent > 0 && Rnd.get(100) < dropPercent && dropCount < dropLimit)+           if (dropPercent > 0 && Rnd.get(100) < dropPercent)            {-                int itemDropPercent = 0;+               int dropCount = 0;++               int itemDropPercent = 0;                List<Integer> nonDroppableList = new FastList<Integer>();                List<Integer> nonDroppableListPet = new FastList<Integer>(); @@ -5259,7 +5260,7 @@                    if (itemDrop.isEquipped())                    {                        // Set proper chance according to Item type of equipped Item-                        itemDropPercent = itemDrop.getItem().getType2() == L2Item.TYPE2_WEAPON ? dropEquipWeapon : dropEquip;+                       itemDropPercent = itemDrop.getItem().getType2() == L2Item.TYPE2_WEAPON ? dropEquipWeapon : dropEquip;                        getInventory().unEquipItemInSlotAndRecord(itemDrop.getLocationSlot());                    }                    else itemDropPercent = dropItem; // Item in inventory@@ -5274,8 +5275,8 @@                        else                            _log.warning(getName() + " dropped id = " + itemDrop.getItemId() + ", count = " + itemDrop.getCount()); -                       dropCount++;-                       break;+                       if (++dropCount >= dropLimit)+                           break;                    }                }            }

Re: SEVERE: Failed executing HitTask.

Posted: Wed Jun 03, 2009 7:05 am
by Bruteforce
Thanks a lot!
I will have a look at it first thing I get home from work! :)

If it works, I hope it will be committed!

Re: SEVERE: Failed executing HitTask.

Posted: Wed Jun 03, 2009 4:41 pm
by Notorious
Works like a charm! Killed myself plenty of times with no items in inventory, or too few items in inventory, and CPU remained at 0% :)

Thanks a LOT Janiii! :D

Re: SEVERE: Failed executing HitTask.

Posted: Fri Jun 05, 2009 8:36 am
by janiii
may this be commited? the way i think PK drop should work..

- rate drop: the chance to drop asked only once on drop
- rate drop item/equip/weapon asked for each item in inventory

- on drop, the chance for drop is asked, if ok, the whole inventory is looped with chances to drop an item and if an item drops, the count of dropped items is checked if the limit is reached and the loop is exited. so if the PK doesnt have so many items in his inventory, it is dropped what can be dropped, checking each item only once for the chance to drop.

Re: SEVERE: Failed executing HitTask.

Posted: Wed Jun 10, 2009 9:21 am
by janiii
fixed in http://www.l2jserver.com/trac/changeset/3166

feel free to comment the logic of pk drop ;)