Thread: Drop Rate Modifier

Results 1 to 8 of 8
  1. #1 Drop Rate Modifier 
    Registered Member
    Join Date
    Nov 2014
    Posts
    75
    Thanks given
    5
    Thanks received
    15
    Rep Power
    71
    Hey guys, having a small issue:

    DropManager.java
    Code:
    private double getModifier(Player player) {
    		double modifier = 1.0;
    		if (player.getItems().isWearingItem(2572)) {
    			modifier -= .03;
    		} else if (player.getItems().isWearingItem(12785)) {
    			modifier -= .05;
    		} else if (player.getItems().isWearingItem(11014)) {
    			 modifier -= .09;
    		} else if (player.getItems().isWearingItem(7142)) {
    			 modifier -= 2.5;
    		}
    		if (player.getRights().contains(Right.MAX_DONATOR)) {
    			modifier -= 0.200;
    		} else if (player.getRights().contains(Right.UBER_DONATOR)) {
    			modifier -= 0.175;
    		} else if (player.getRights().contains(Right.LEGENDARY)) {
    			modifier -= 0.150;
    		} else if (player.getRights().contains(Right.EXTREME_DONATOR)) {
    			modifier -= 0.120;
    		} else if (player.getRights().contains(Right.SUPER_DONATOR)) {
    			modifier -= 0.100;
    		} else if (player.getRights().contains(Right.DONATOR)) {
    			modifier -= 0.070;
    		} else if (player.getRights().contains(Right.SUPPORTER)) {
    			modifier -= 0.050;
    		} else if (player.getRights().contains(Right.SPONSOR)) {
    			modifier -= 0.035;
    		} else if (player.getRights().contains(Right.CONTRIBUTOR)) {
    			modifier -= 0.020;
    		}
    		return modifier;
    	}
    1. Should I be removing the '-' in
    Code:
    modifier -= #;
    to give higher drop rates? I believe -= should be subtracting percentages?
    2. Is there a means of making the base number be multiplied by the percentage # you want to represent items/playerrights?
    3. How much of a noob am I?
    4. This is Os-V.. I know PI.. kill myself, yada, yada. I'd appreciate the help, thanks guys!
    Reply With Quote  
     

  2. #2  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    1. Cannot say until I see the method that calls the method displayed.
    2. Confused as fuck right now. I think you just explained what that piece of code does..?
    3. 10/10.
    4. Kill yourself. You said it, I'm just a supporter.
    Attached image
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jul 2012
    Age
    25
    Posts
    122
    Thanks given
    16
    Thanks received
    21
    Rep Power
    15
    1. It seems as the higher the drop rate the lower the modifier. I cannot guarantee that is the case, but judging from the fact that an Uber_Donators modifier is lower than a supporter, that is the take away. So you will want to lower modifier to increase the drop rate.
    2. You should probably rewrite the DropRate-system. This chained if statement could be removed by creating an interface that has a "getModifierChange"-method that is implemented on every item that adjusts the droprate. Doing this in PI will probably be a huge project, which is why PI generally is avoided by serious developers.
    3. You don't seem to be very comfortable in writing code or RSPS. But you will get there.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Nov 2014
    Posts
    75
    Thanks given
    5
    Thanks received
    15
    Rep Power
    71
    Quote Originally Posted by Sarkastisk View Post
    1. It seems as the higher the drop rate the lower the modifier. I cannot guarantee that is the case, but judging from the fact that an Uber_Donators modifier is lower than a supporter, that is the take away. So you will want to lower modifier to increase the drop rate.
    2. You should probably rewrite the DropRate-system. This chained if statement could be removed by creating an interface that has a "getModifierChange"-method that is implemented on every item that adjusts the droprate. Doing this in PI will probably be a huge project, which is why PI generally is avoided by serious developers.
    3. You don't seem to be very comfortable in writing code or RSPS. But you will get there.
    What I'm getting from it is:

    Code:
    double modifier = 1.0
    = 100% * 2 (200%)
    Code:
    -=
    is used in buyFromShop to remove Points from players for items using Points (PK points, Mage Arena Points, PC Points, etc.)

    So, I assumed
    Code:
    -=
    would mean it'd be subtracting from 200% in the DropManager?

    i.e;

    Code:
    if (player.getRights().contains(Right.MAX_DONATOR)) {
    			modifier -= 0.200;
    = -.2%; so a Max Donator would have a Drop Rate of 199.8%, whereas

    Code:
    } else if (player.getRights().contains(Right.UBER_DONATOR)) {
    			modifier -= 0.175;
    = -.175%; so a Uber Donator would have a Drop Rate of 199.825%.

    This is the way I'm interpreting it as and it doesn't make sense to me, so I'd assume I'd have to rewrite this?

    I'm not entirely sure if
    Code:
    double modifier = 1.0;
    represents 200% or not?

    Thank you for the response, nonetheless, I appreciate it.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jul 2012
    Age
    25
    Posts
    122
    Thanks given
    16
    Thanks received
    21
    Rep Power
    15
    Quote Originally Posted by Sling View Post
    -snip-
    Can you paste in any method that uses this method?
    In an IDE this can usually be done by right clicking "find usages".

    What I was trying to point out was that:
    Why would a Max-donator have a lower drop-rate than a regular donator?
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Nov 2014
    Posts
    75
    Thanks given
    5
    Thanks received
    15
    Rep Power
    71
    Quote Originally Posted by Sarkastisk View Post
    Can you paste in any method that uses this method?
    In an IDE this can usually be done by right clicking "find usages".

    What I was trying to point out was that:
    Why would a Max-donator have a lower drop-rate than a regular donator?
    Here's another instance of the method being used in DropManager:

    Code:
    public void create(Player player, NPC npc, Location3D location, int repeats) {
    		Optional<TableGroup> group = groups.values().stream().filter(g -> g.getNpcIds().contains(npc.npcType))
    				.findFirst();
    
    		group.ifPresent(g -> {
    			double modifier = getModifier(player);
    			List<GameItem> drops = g.access(player, modifier, repeats);
    
    			for (GameItem item : drops) {
    				if (item.getId() == 536) {
    					if (player.getRechargeItems().hasItem(13111) && player.inWild()) {
    						item.changeDrop(537, item.getAmount());
    					}
    				}
    				if (item.getId() == 6529) {
    					if (player.getRechargeItems().hasItem(11136)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.20));
    					}
    					if (player.getRechargeItems().hasItem(11138)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.50));
    					}
    					if (player.getRechargeItems().hasItem(11140)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.70));
    					}
    					if (player.getRechargeItems().hasItem(13103)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.90));
    					}
    				}
    				if (item.getId() == 6729 && player.getRechargeItems().hasItem(13132)) {
    					item.changeDrop(6730, item.getAmount());
    				}
    				if (item.getId() == 13233 && !Boundary.isIn(player, Boundary.CERBERUS_BOSSROOMS)) {
    					player.sendMessage("@red@Something hot drops from the body of your vanquished foe");
    				}
    
    				if (IntStream.of(bosses).anyMatch(id -> id == npc.npcType)) {
    					PlayerHandler.nonNullStream().filter(p -> p.distanceToPoint(player.absX, player.absY) < 10
    							&& p.heightLevel == player.heightLevel).forEach(p -> {
    								if (item.getAmount() > 1)
    									p.sendMessage("@dre@" + Misc.formatPlayerName(player.playerName)
    											+ " received a drop: " + Misc.format(item.getAmount()) + " x "
    											+ Item.getItemName(item.getId()) + ".");
    								else
    									p.sendMessage("@dre@" + Misc.formatPlayerName(player.playerName)
    											+ " received a drop: " + Item.getItemName(item.getId()) + ".");
    							});
    				}
    
    				Server.itemHandler.createGroundItem(player, item.getId(), location.getX(), location.getY(),
    						location.getZ(), item.getAmount(), player.getIndex());
    			}


    & I'm not entirely sure if the source is written properly off the bat, it's Exotic.
    Reply With Quote  
     

  7. #7  
    Banned
    Join Date
    Feb 2011
    Posts
    143
    Thanks given
    14
    Thanks received
    12
    Rep Power
    0
    Quote Originally Posted by Sling View Post
    Here's another instance of the method being used in DropManager:

    Code:
    public void create(Player player, NPC npc, Location3D location, int repeats) {
    		Optional<TableGroup> group = groups.values().stream().filter(g -> g.getNpcIds().contains(npc.npcType))
    				.findFirst();
    
    		group.ifPresent(g -> {
    			double modifier = getModifier(player);
    			List<GameItem> drops = g.access(player, modifier, repeats);
    
    			for (GameItem item : drops) {
    				if (item.getId() == 536) {
    					if (player.getRechargeItems().hasItem(13111) && player.inWild()) {
    						item.changeDrop(537, item.getAmount());
    					}
    				}
    				if (item.getId() == 6529) {
    					if (player.getRechargeItems().hasItem(11136)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.20));
    					}
    					if (player.getRechargeItems().hasItem(11138)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.50));
    					}
    					if (player.getRechargeItems().hasItem(11140)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.70));
    					}
    					if (player.getRechargeItems().hasItem(13103)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.90));
    					}
    				}
    				if (item.getId() == 6729 && player.getRechargeItems().hasItem(13132)) {
    					item.changeDrop(6730, item.getAmount());
    				}
    				if (item.getId() == 13233 && !Boundary.isIn(player, Boundary.CERBERUS_BOSSROOMS)) {
    					player.sendMessage("@red@Something hot drops from the body of your vanquished foe");
    				}
    
    				if (IntStream.of(bosses).anyMatch(id -> id == npc.npcType)) {
    					PlayerHandler.nonNullStream().filter(p -> p.distanceToPoint(player.absX, player.absY) < 10
    							&& p.heightLevel == player.heightLevel).forEach(p -> {
    								if (item.getAmount() > 1)
    									p.sendMessage("@dre@" + Misc.formatPlayerName(player.playerName)
    											+ " received a drop: " + Misc.format(item.getAmount()) + " x "
    											+ Item.getItemName(item.getId()) + ".");
    								else
    									p.sendMessage("@dre@" + Misc.formatPlayerName(player.playerName)
    											+ " received a drop: " + Item.getItemName(item.getId()) + ".");
    							});
    				}
    
    				Server.itemHandler.createGroundItem(player, item.getId(), location.getX(), location.getY(),
    						location.getZ(), item.getAmount(), player.getIndex());
    			}


    & I'm not entirely sure if the source is written properly off the bat, it's Exotic.
    OSV practices some really old and poor programming habits, if you want to succeed use a different framework
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Jul 2012
    Age
    25
    Posts
    122
    Thanks given
    16
    Thanks received
    21
    Rep Power
    15
    Quote Originally Posted by Sling View Post
    Here's another instance of the method being used in DropManager:

    Code:
    public void create(Player player, NPC npc, Location3D location, int repeats) {
    		Optional<TableGroup> group = groups.values().stream().filter(g -> g.getNpcIds().contains(npc.npcType))
    				.findFirst();
    
    		group.ifPresent(g -> {
    			double modifier = getModifier(player);
    			List<GameItem> drops = g.access(player, modifier, repeats);
    
    			for (GameItem item : drops) {
    				if (item.getId() == 536) {
    					if (player.getRechargeItems().hasItem(13111) && player.inWild()) {
    						item.changeDrop(537, item.getAmount());
    					}
    				}
    				if (item.getId() == 6529) {
    					if (player.getRechargeItems().hasItem(11136)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.20));
    					}
    					if (player.getRechargeItems().hasItem(11138)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.50));
    					}
    					if (player.getRechargeItems().hasItem(11140)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.70));
    					}
    					if (player.getRechargeItems().hasItem(13103)) {
    						item.changeDrop(6529, (int) (item.getAmount() * 1.90));
    					}
    				}
    				if (item.getId() == 6729 && player.getRechargeItems().hasItem(13132)) {
    					item.changeDrop(6730, item.getAmount());
    				}
    				if (item.getId() == 13233 && !Boundary.isIn(player, Boundary.CERBERUS_BOSSROOMS)) {
    					player.sendMessage("@red@Something hot drops from the body of your vanquished foe");
    				}
    
    				if (IntStream.of(bosses).anyMatch(id -> id == npc.npcType)) {
    					PlayerHandler.nonNullStream().filter(p -> p.distanceToPoint(player.absX, player.absY) < 10
    							&& p.heightLevel == player.heightLevel).forEach(p -> {
    								if (item.getAmount() > 1)
    									p.sendMessage("@dre@" + Misc.formatPlayerName(player.playerName)
    											+ " received a drop: " + Misc.format(item.getAmount()) + " x "
    											+ Item.getItemName(item.getId()) + ".");
    								else
    									p.sendMessage("@dre@" + Misc.formatPlayerName(player.playerName)
    											+ " received a drop: " + Item.getItemName(item.getId()) + ".");
    							});
    				}
    
    				Server.itemHandler.createGroundItem(player, item.getId(), location.getX(), location.getY(),
    						location.getZ(), item.getAmount(), player.getIndex());
    			}


    & I'm not entirely sure if the source is written properly off the bat, it's Exotic.
    Exotic is horribly written. But I did have the source downloaded.

    The modifier value is used in the "access" method, which accesses a drop table X times with a modifier.
    The modifier is used to determine the chance.

    Code:
    double chance = (1.0 / (double) (table.getAccessibility() * modifier)) * 100D;
    There is then a randomized variable roll which determines whether or not a player is eligible for a roll

    Code:
    if (roll <= chance)
    An item is then rolled randomly in the droptable (if the player is eligible for a roll).

    If the chance is lower than 1.5 % (roll also needs to be lower than 1.5 % for this if case to be reached) and the table being accessed is a rare/very-rare item it broadcasts it (as I interpret it) - and the item isn't shit (there's a nested if case there that's really weird), then it broadcasts. I feel like that last part was being added to filter out the majority of broadcasts - but I am not sure.

    The chance, as I view it, increases your chance of rolling on a table. The chance is higher the lower the modifier is.

    As the user above me mentioned, do not use this source.

    This is the method that generates drop. It's utter trash.

    Code:
    	public List<GameItem> access(Player player, double modifier, int repeats) {
    		int rights = player.getRights().getPrimary().getValue() - 1;
    		List<GameItem> items = new ArrayList<>();
    		for (Table table : this) {
    			TablePolicy policy = table.getPolicy();
    			if (policy.equals(TablePolicy.CONSTANT)) {
    				for (Drop drop : table) {
    					int minimumAmount = drop.getMinimumAmount();
    
    					items.add(new GameItem(drop.getItemId(), minimumAmount + Misc.random(drop.getMaximumAmount() - minimumAmount)));
    				}
    			} else {
    				for (int i = 0; i < repeats; i++) {
    					double chance = (1.0 / (double) (table.getAccessibility() * modifier)) * 100D;
    
    					double roll = Misc.preciseRandom(Range.between(0.0, 100.0));
    
    					if (chance > 100.0) {
    						chance = 100.0;
    					}
    					if (roll <= chance) {
    						Drop drop = table.fetchRandom();
    						int minimumAmount = drop.getMinimumAmount();
    						GameItem item = new GameItem(drop.getItemId(),
    								minimumAmount + Misc.random(drop.getMaximumAmount() - minimumAmount));
    						items.add(item);
    						if (chance <= 1.5) {
    							if (policy.equals(TablePolicy.VERY_RARE) || policy.equals(TablePolicy.RARE)) {
    								if (Item.getItemName(item.getId()).toLowerCase().contains("cowhide")
    										|| Item.getItemName(item.getId()).toLowerCase().contains("feather")
    										|| Item.getItemName(item.getId()).toLowerCase().contains("arrow")
    										|| Item.getItemName(item.getId()).toLowerCase().contains("sq shield")
    										|| Item.getItemName(item.getId()).toLowerCase().contains("rune warhammer")
    										|| Item.getItemName(item.getId()).toLowerCase().contains("rune battleaxe")
    										|| Item.getItemName(item.getId()).toLowerCase().contains("casket")
    										|| Item.getItemName(item.getId()).toLowerCase().contains("silver ore")
    										|| Item.getItemName(item.getId()).toLowerCase().contains("rune spear")
    										|| item.getId() >= 554 && item.getId() <= 566) {
    									
    								} else {
    									PlayerHandler.executeGlobalMessage(
    											"<col=FF0000>[Lootations] @cr19@ </col><col=255><img=" + rights + ">"
    													+ Misc.capitalize(player.playerName) + "</col> received <col=255>"
    													+ item.getAmount() + "</col>x <col=255>"
    													+ ItemAssistant.getItemName(item.getId()) + "</col>.");
    								}
    							}
    						}
    					}
    				}
    			}
    		}
    		return items;
    	}
    Recoded this method could look something like this:

    Code:
    	
    public List<GameItem> method(Player player, double modifier, int repeats) {
    		int rights = player.getRights().getPrimary().getValue() - 1;
    		List<GameItem> items = new ArrayList<>();
    		for (Table table : this) {
    			items.add(table.roll(modifier, repeats, rights));
    		}	
           }
    The table should decide whether or not the tables action needs recognition in a broadcast.
    The table should decide the chance of a roll for a drop, not the method that uses the table.
    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

Similar Threads

  1. VERY accurate corp beast drops+rates delta
    By shoopdawhoop in forum Snippets
    Replies: 8
    Last Post: 12-05-2009, 12:30 PM
  2. [PVP] Fair drop rates?
    By xX Chris Xx in forum Help
    Replies: 0
    Last Post: 12-05-2009, 12:29 AM
  3. [Delta]Need help with changing npc drop rate
    By WebsterScape in forum Help
    Replies: 7
    Last Post: 06-14-2009, 09:56 AM
  4. Help Me On Drop Rates
    By 2richdeens in forum Help
    Replies: 0
    Last Post: 11-02-2008, 01:51 AM
  5. npc and drop rate
    By junkiedk in forum Help
    Replies: 11
    Last Post: 08-08-2008, 12:09 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •