Thread: Basic lootshare help

Results 1 to 5 of 5
  1. #1 Basic lootshare help 
    Registered Member shoopdawhoop's Avatar
    Join Date
    Apr 2009
    Posts
    685
    Thanks given
    10
    Thanks received
    19
    Rep Power
    57
    I'm working on a lootshare system (i'm using a very noobish version at the moment because clan chat ain't added to my server yet and it ain't open for public)
    first the monster dropped all the items it was able to...
    i fixed that
    then the monster dropped almost normally... (dropped only when the counter was below or equal to the drop rate, and it gave the drop to a random clan member)
    but it dropped 2 of the items instead of 1
    i fixed that too
    now to the problem i'm asking for help to
    fixing the above caused the drop system to give the drop to nobody if you're on lootshare
    so it takes 30 secs for the drop to appear
    here's my MonsterDropItems() void
    Code:
    public void MonsterDropItems(int NPCID, NPC npc) {
    		try {
    			int totalDrops = dropCount[NPCID] / 3;
    								client p = (client) server.playerHandler.players[npc
    							.getKiller()];//
    			if (totalDrops > 0) {
    				// Random roller = new Random();
    				for (int i = 0; i < dropCount[NPCID]; i += 3) {
    					double roll = Math.random() * 10000;
    										if (p != null) {
    						if (p.debug)
    							p.sM("Roll:  " + roll + ", Itemid:  "
    									+ drops[NPCID][i] + ", amt:  "
    									+ drops[NPCID][i + 1] + ", percent:  "
    									+ drops[NPCID][i + 2]);
    					}
    					if(p.playerEquipment[p.playerRing] != 2572 && p.lootshare == false){
    					if (roll <= drops[NPCID][i + 2]) {
    						if (p != null) {
    							if (p.debug)
    								p.sM("Rewarding " + drops[NPCID][i]);
    					}
    						}
    						if ((drops[NPCID] != null) && (npc != null))
    							ItemHandler.addItem((int) drops[NPCID][i],
    									npc.absX, npc.absY,
    									(int) drops[NPCID][i + 1], npc.getKiller(),
    									false);
    }
    					if( p.lootshare == true){
    					if (roll <= drops[NPCID][i + 2]) {
    						if (p != null) {
    							if (p.debug)
    								p.sM("Rewarding " + drops[NPCID][i]);
    						}
    						if ((drops[NPCID] != null) && (npc != null)){
    							ItemHandler.addItem((int) drops[NPCID][i],
    									npc.absX, npc.absY,
    									(int) drops[NPCID][i + 1], p.randomclanmember(),
    									false);
    }}
    					if(p.playerEquipment[p.playerRing] == 2572 && p.lootshare == false){
    					if (roll/1.10 <= drops[NPCID][i + 2]) {
    						if (p != null) {
    							if (p.debug)
    								p.sM("Rewarding " + drops[NPCID][i]);
    						}
    						if ((drops[NPCID] != null) && (npc != null))
    							ItemHandler.addItem((int) drops[NPCID][i],
    									npc.absX, npc.absY,
    									(int) drops[NPCID][i + 1], npc.getKiller(),
    									false);
    						}
    				}
    			}
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    can anyone locate the problem?
    if(WomanLocation != Kitchen)
    {
    DivideByZero();
    }
    Reply With Quote  
     

  2. #2  
    Member

    Join Date
    May 2008
    Posts
    1,288
    Thanks given
    50
    Thanks received
    92
    Rep Power
    0
    I'll take a look at it and try to fix it for you, no guarentees though :coolface:



    Double post my bad
    |
    V
    Reply With Quote  
     

  3. #3  
    Member

    Join Date
    May 2008
    Posts
    1,288
    Thanks given
    50
    Thanks received
    92
    Rep Power
    0
    can anyone locate the problem?
    Very hard because of the messiness of the code

    EDIT: Try this
    Code:
        public void MonsterDropItems(int NPCID, NPC npc){
    	if(NPCID == -1 || npc == null){
    	    return;
    	}
    
    	int totalDrops = dropCount[NPCID];
    	int playerDropID = npc.getKiller();
    
     	if(playerDropID == -1){
    	    return;
    	}
    
    	client p = (client) server.playerHandler.players[playerDropID];
    
    	if(p == null){
    	    return;
    	}
    
    	if(totalDrops > 0){
    	    totalDrops = (totalDrops / 3);
    	}
    
    	for(int i = 0; i < dropCount[NPCID]; i += 3){
    	    double roll = (Math.random() * 10000);
    	    double dropChance = ((p.playerEquipment[p.playerRing] == 2572 && !p.lootshare) ? (roll / 1.10) : roll);
    
    	    if(p.debug){
    		p.sM("Roll:  " + roll + ", Itemid:  " + drops[NPCID][i] + ", amt:  " + drops[NPCID][i + 1] + ", percent:  " + drops[NPCID][i + 2]);
    		p.sM("Rewarding " + drops[NPCID][i]);
    	    }
    
    	    if(drops[NPCID] != null && npc != null){
    		if(dropChance <= drops[NPCID][i + 2]){
    		    if(p.lootshare){
    			mostPlayerDamage = p.randomclanmember();
    		    }
    		    ItemHandler.addItem((int) drops[NPCID][i], npc.absX, npc.absY, (int) drops[NPCID][i + 1], mostPlayerDamage, false);
    		}
    	    }
    
    	}
    
        }
    If it still does the same thing, post your randomclanemember() method.
    Reply With Quote  
     

  4. #4  
    Registered Member shoopdawhoop's Avatar
    Join Date
    Apr 2009
    Posts
    685
    Thanks given
    10
    Thanks received
    19
    Rep Power
    57
    Quote Originally Posted by badreligion View Post
    Very hard because of the messiness of the code

    EDIT: Try this
    Code:
        public void MonsterDropItems(int NPCID, NPC npc){
    	if(NPCID == -1 || npc == null){
    	    return;
    	}
    
    	int totalDrops = dropCount[NPCID];
    	int playerDropID = npc.getKiller();
    
     	if(playerDropID == -1){
    	    return;
    	}
    
    	client p = (client) server.playerHandler.players[playerDropID];
    
    	if(p == null){
    	    return;
    	}
    
    	if(totalDrops > 0){
    	    totalDrops = (totalDrops / 3);
    	}
    
    	for(int i = 0; i < dropCount[NPCID]; i += 3){
    	    double roll = (Math.random() * 10000);
    	    double dropChance = ((p.playerEquipment[p.playerRing] == 2572 && !p.lootshare) ? (roll / 1.10) : roll);
    
    	    if(p.debug){
    		p.sM("Roll:  " + roll + ", Itemid:  " + drops[NPCID][i] + ", amt:  " + drops[NPCID][i + 1] + ", percent:  " + drops[NPCID][i + 2]);
    		p.sM("Rewarding " + drops[NPCID][i]);
    	    }
    
    	    if(drops[NPCID] != null && npc != null){
    		if(dropChance <= drops[NPCID][i + 2]){
    		    if(p.lootshare){
    			mostPlayerDamage = p.randomclanmember();
    		    }
    		    ItemHandler.addItem((int) drops[NPCID][i], npc.absX, npc.absY, (int) drops[NPCID][i + 1], mostPlayerDamage, false);
    		}
    	    }
    
    	}
    
        }
    If it still does the same thing, post your randomclanemember() method.
    i doesn't have MostPlayerDamage
    if(WomanLocation != Kitchen)
    {
    DivideByZero();
    }
    Reply With Quote  
     

  5. #5  
    Member

    Join Date
    May 2008
    Posts
    1,288
    Thanks given
    50
    Thanks received
    92
    Rep Power
    0
    Quote Originally Posted by shoopdawhoop View Post
    i doesn't have MostPlayerDamage
    rename it to "playerDropID" forgot to change that.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

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