Sign in to follow this  
Alexgopen

Where do I modify rarity chance?

Recommended Posts

I can't seem to find anywhere in the code pertaining to calculating whether or not a given action produces a rare. 


 


I find setters and getters for the rarity byte all over the place but can't find where I can modify the function determining rarity.  I was hoping to either increase the chance of rare rolls on mobs so people could more readily empty the kingdom coffers to pay for deeds, or give a 100% chance of giving a smaller rare coin like 5c on killing a tougher mob like a troll. 


 


Right now our server is just using free-to-plant deeds but there aren't many good ways to actually get silver to pay the upkeep.  We'd prefer to use paid-to-plant deeds so people don't abuse planting for free, allowing the deed to disband eventually, and replanting,  but in order to use pay-to-plant deeds we'd need to implement a somewhat dependable way of earning income.   We'd prefer drawing from the kingdom coffers, rather than creating new coins, as to prevent an overabundance of silver.  Our fear is that if too much silver exists, it would be too easy to buy lots of sleep powder from traders or buy tons of deed guards, which would kind of ruin the server.


 


So does anyone have any ideas about how to modify the chance on rare coin mob kills, or a good way of allowing players to get coins from the kingdom coffers?


Share this post


Link to post
Share on other sites
In Player.java search for this



} else if (Server.rand.nextInt(3600) == 0)
{
this.windowOfCreation = 20;
if (getCitizenVillage() != null)
this.windowOfCreation += (int)Math.min(10.0F, getCitizenVillage().getFaithCreateValue());
}

That is for determining the rare window (which also explains why sometimes you dont get a rare window for hours upon hours, and sometimes you get 2 in 5 minutes)


 


and then in the same java file, look for the method



public byte getRarity()

Have fun :-)


Share this post


Link to post
Share on other sites

I found it eventually but thanks :)


 


Now have different amounts of coin awarded at 100% chance for various mob types as long as theres money in kingdom coffers.  Should work out well as a means for paying for deeds.


Share this post


Link to post
Share on other sites

Alexgopen, can you release the code for doing that? I'm playing on a server that is interested in being able to have coin awarded for mob kills.


Share this post


Link to post
Share on other sites

Unless someone integrates AspectJ in their modding framework, this will not be possible.... Sadly the method calls use hardcoded arguments (ever heard of static final (constants), devs?.... Makes your code SO MUCH MORE READABLE AND MAINTAINABLE)


 


wtf's up with


 


if (action == 317) {


 


anyway... how is that readable in any way :/


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this