Thread: [562] Dropping Items on Death

Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1 [562] Dropping Items on Death 
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    Hey guys, I really need some help with this. Ive looked all over Google, Bing and everything and I cant find it anywhere =( What I need is for the players to drop all the items they are wielding and have in their inventory on the ground when they die in Pvp. I know how to disable Pvp drops etc but I cant find out anywhere how to make the players drop their items. I've put prints under each main part of my dropLoot and dropLoot2 to check where its getting stuck at. I've made it say: "Nope, this bit works - #" I've numbered them and instead of # there is the number. Ive gone from 1-13. When someone dies it prints out numbers 1 and 2 about 10 times each, then number 3 once. Most of the time it prints out number 13, but occasionally it just doesn't give you a pvp drop and doesn't say number 13. I wont mind about this particular problem if I can get normal drops working, as then the killer would at least get some loot. Ive got the code for dropLoot and dropLoot2 so you can see my code and prints, and so you can see which numbers relate to which bits of code.

    Spoiler for dropLoot and dropLoot2:

    Code:
    public void dropLoot() {
    if(this.inSWGame()) {
    return;
    }
        if(this.inClanWars()) {
            return;
        }
                if(this.inDuelArena()) {
                    return;
                }
        if(this.getLocation().getY() >= 4680 && this.getLocation().getY() <= 4730 && this.getLocation().getX() >= 2495 && this.getLocation().getX() <= 2520) {
        return;
        }
        if(this.giveDrop == 0) {
            System.out.println("Npc Killed him, so no drop");
            return;
        }
        final Player p2 = World.getInstance().getPlayerList().get(this.giveDrop);
        List<Item> itemsInHand = new ArrayList<Item>();
        for(int i = 0; i < Inventory.SIZE; i++) {
            Item item = this.getInventory().getContainer().get(i);
            System.out.println("Nope, this bit works - 1");
            if(item != null) {
                itemsInHand.add(item);
            }
        }
        for(int i = 0; i < Equipment.SIZE; i++) {
            Item item = this.getEquipment().getContainer().get(i);
            System.out.println("Nope, this bit works - 2");
            if(item != null) {
                itemsInHand.add(item);
            }
        }
        this.getInventory().reset();
        this.getEquipment().reset();
        System.out.println("Nope, this bit works - 3");
        int keep = 3;
        if(this.PROTECTITEM == true) {
        System.out.println("Nope, this bit works - 4");
            keep = 4;
        }
        if(this.getHeadIcons().isSkulled()) {
        System.out.println("Nope, this bit works - 5");
        keep = 0;
        if(this.PROTECTITEM == true) {
        System.out.println("Nope, this bit works - 6");
        keep = 1;
        }
        }
        if(keep > 0) {
            Collections.sort(itemsInHand, new Comparator<Item>() {
                @Override
                public int compare(Item arg0, Item arg1) {
                    int a0 = arg0.getDefinition().getPrice().getNormalPrice();
                    int a1 = arg1.getDefinition().getPrice().getNormalPrice();
                    System.out.println("Nope, this bit works - 7");
                    return a1 - a0;
                }
            });
            List<Item> toRemove = new ArrayList<Item>();
            for(int i = 0; i < itemsInHand.size(); i++) {
                Item item = itemsInHand.get(i);
                System.out.println("Nope, this bit works - 8");
                if(item.getDefinition().isStackable() || item.getDefinition().isNoted()) {
                System.out.println("Nope, this bit works - 9");
                    continue;
                }
                if(keep > 0) {
                    toRemove.add(item);
                    System.out.println("Nope, this bit works - 10");
                    keep--;
                } else {
                    break;
                }
            }
            for(Item i : toRemove) {
                itemsInHand.remove(i);
                this.getInventory().addItem(i.getId(), 1);
                System.out.println("Nope, this bit works - 11");
            }
        }
        for(Item i : itemsInHand) {
            World.getInstance().getItemManager().createDropGroundItem(p2, this.getLocation(), new Item(i.getId(), i.getAmount()));
            System.out.println("Nope, this bit works - 12");
        }
    }
    public void dropLoot2() {
        if(this.inSWGame()) {
    return;
    }
        if(getLocation().getY() >= 4680 && getLocation().getY() <= 4730 && getLocation().getX() >= 2495 && getLocation().getX() <= 2520) {
        return;
        }
        if(this.inClanWars()) {
            return;
        }
                if(this.inDuelArena()) {
                    return;
                }
        if(this.giveDrop == 0) {
            System.out.println("Npc Killed him, so no drop");
            return;
        }
        final Player p2 = World.getInstance().getPlayerList().get(this.giveDrop);
        Item Food = dropId(pvpDrops.Foods());
            Item Low = dropId(pvpDrops.OtherItems());
        Item Medium = dropId(pvpDrops.OtherItems2());
        Item High = dropId(pvpDrops.OtherItems3());
        Item PvpItems = dropId(pvpDrops.PvPItems());
        Item PvpItems2 = dropId(pvpDrops.PvPItems());
        Item TargetDrop = dropId(pvpDrops.TargetDrop());
     
        List<Item> itemsInHand = new ArrayList<Item>();
        List<Item> itemsInHand2 = new ArrayList<Item>();
        List<Item> itemsInHand3 = new ArrayList<Item>();
        List<Item> itemsInHand4 = new ArrayList<Item>();
        List<Item> itemsInHand5 = new ArrayList<Item>();
        List<Item> itemsInHand6 = new ArrayList<Item>();
        List<Item> itemsInHand7 = new ArrayList<Item>();
        if(Food != null || Low != null || Medium != null || High != null ||  PvpItems != null ||  TargetDrop != null) {
            itemsInHand.add(Food);
            itemsInHand2.add(Low);
            itemsInHand3.add(Medium);
            itemsInHand4.add(High);
            itemsInHand5.add(PvpItems);
            itemsInHand6.add(TargetDrop);
            itemsInHand7.add(PvpItems2);
        }
     
        for(Item food : itemsInHand) {
        for(Item low : itemsInHand2) {
        for(Item medium : itemsInHand3) {
        for(Item high : itemsInHand4) {
        for(Item pvpitems : itemsInHand5) {
        for(Item targetdrop : itemsInHand6) {
        for(Item pvpitems2 : itemsInHand7) {
     
        //if(p2.giveDrop == p2.bhTarget) {
        if(p2.bhTarget == p2.giveDrop) {
            p2.playerEp = p2.playerEp - Misc.random(5);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), targetdrop);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your target.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
        if(p2.playerEp <= 10) {
            p2.playerEp = p2.playerEp - Misc.random(5);
            World.getInstance().getItemManager().createDropGroundItem(p2
                , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                , this.getLocation(), low);
            actionSender.sendString("EP: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
     
        if(p2.playerEp >= 11 && p2.playerEp <= 21) {
            p2.playerEp = p2.playerEp - Misc.random(10);
            World.getInstance().getItemManager().createDropGroundItem(p2
                , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                , this.getLocation(), low);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
     
        if(p2.playerEp >= 22 && p2.playerEp <= 32) {
            p2.playerEp = p2.playerEp - Misc.random(15);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), low);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), medium);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
     
        if(p2.playerEp >= 33 && p2.playerEp <= 44) {
            p2.playerEp = p2.playerEp - Misc.random(20);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), low);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), medium);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), pvpitems);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
     
        if(p2.playerEp >= 45 && p2.playerEp <= 55) {
            p2.playerEp = p2.playerEp - Misc.random(30);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), low);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), medium);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), pvpitems);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
     
        if(p2.playerEp >= 56 && p2.playerEp <= 66) {
            p2.playerEp = p2.playerEp - Misc.random(40);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), medium);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), pvpitems);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
     
        if(p2.playerEp >= 67 && p2.playerEp <= 77) {
            p2.playerEp = p2.playerEp - Misc.random(50);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), medium);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), pvpitems);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), high);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
     
        if(p2.playerEp >= 78 && p2.playerEp <= 88) {
            p2.playerEp = p2.playerEp - Misc.random(60);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), medium);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), pvpitems2);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), high);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
     
        if(p2.playerEp >= 89 && p2.playerEp <= 100) {
            p2.playerEp = p2.playerEp - Misc.random(70);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), food);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), pvpitems2);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), high);
            World.getInstance().getItemManager().createDropGroundItem(p2
                    , this.getLocation(), medium);
            actionSender.sendString("Drop Potential: "+playerEp+"%", 591, 9);
            actionSender.sendMessage("You killed your opponent.");
            System.out.println("Nope, this bit works - 13");
            p2.giveDrop = 0;
        }
     
        }}}}}}}
    }


    Thanks so much in advance if you can get this working, its really annoying me.
    Reply With Quote  
     

  2. #2  
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    Sorry for bump but I really need help with this
    Reply With Quote  
     

  3. #3  
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    Sorry for bump and triple post but has anyone got any ideas?
    Reply With Quote  
     

  4. #4  
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    Sorry for bump but I cant figure out how to do this. Thanks
    Reply With Quote  
     

  5. #5  
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    Anyone got any idea's, sorry for bump
    Reply With Quote  
     

  6. #6  
    Donator
    Rudie's Avatar
    Join Date
    Nov 2011
    Posts
    90
    Thanks given
    56
    Thanks received
    13
    Rep Power
    11
    Have you checked DeahtEvent.java?
    Reply With Quote  
     

  7. #7  
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    Yeah, it does have
    Code:
    entity.dropLoot();
    entity.dropLoot2();
    In it, ive already tried editing that, I'm sure its just in dropLoot. Nice idea tho
    Reply With Quote  
     

  8. #8  
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    Sorry for bump but I really need help with this
    Reply With Quote  
     

  9. #9  
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    Sorry for bump but I really need help with this
    Reply With Quote  
     

  10. #10  
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    bump
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [562] Dropping Items on Death
    By Dds legend in forum Help
    Replies: 32
    Last Post: 12-31-2012, 10:35 AM
  2. [562] Dropping Items on Death
    By Dds legend in forum Help
    Replies: 3
    Last Post: 12-09-2012, 09:33 AM
  3. [562] Dropping Items on Death
    By Dds legend in forum Help
    Replies: 0
    Last Post: 12-03-2012, 09:20 PM
  4. items not dropping on death [PI]
    By mage pwns in forum Help
    Replies: 4
    Last Post: 01-21-2012, 10:41 PM
  5. [PI] Dropping items on death
    By Linus in forum Snippets
    Replies: 8
    Last Post: 12-22-2010, 10:28 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •