Jump to content
Sign in to follow this  
Fuzenseth

667/718 - Reward Boxes

Recommended Posts

-Used for items like mystery box which doesn't have any super rare items.

 

25b4282af1.jpg

 

InventoryHandler click option 1

Please login or register to see this code.

 

Create a new class called RewardBoxes. Don't forget to change the imports to your server.

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites

In my opinion, you should have added a rarity bonus to it as well. With an enumeration, it'd be easy.

Share this post


Link to post
Share on other sites

In my opinion, you should have added a rarity bonus to it as well. With an enumeration, it'd be easy.

You don't really need an enumeration do you? Couldn't you just create an array with the rares, then made an if statement that calculates weather they gained a rare or not; if they got the rare give them only that, if they didn't give them the ordinary item. 

Either way good job keeping up on of this content you release fuzen.

Share this post


Link to post
Share on other sites

Yes, you wouldn't technically need an enumeration for it, however an enumeration allows it to come with ease (and less code).

Edited by Game Master

Share this post


Link to post
Share on other sites

Yes, you wouldn't technically need an enumeration for it, however an enumeration allows it to come with ease (and less code).

Is it really less code? I would like to see that demonstrated. I was imaging that an enumeration might be cumbersome for the class that fuzen has writen. 

Share this post


Link to post
Share on other sites

Well, you see, you'd need (ideally speaking) at least three arrays portraying common, uncommon, and rare items. Then you'd have to loop it based on percentile given for each array, on chances of one attaining an item from said array. With an enumeration, you could just add a percentile for each individual item, making the rarity of these items a lot more accurate, and you wouldn't need to loop the enumeration. Just read the percentages, and output the chances of receiving a given item based on each item's percentage in the enumeration.

Please login or register to see this code.

And you would make a method correspondent to reading this enumeration and it's percentiles. However, using annotations would be a better choice over an enumeration for this, but that would be getting quite descriptive.

It would be cumbersome, you are correct, for the class that FUZEN has written. It would require a lot of rewriting code. However, that is why you construct your code for what I'm suggesting. FUZEN's could have been done better, however it's a lot better than most of the mystery box codes I've seen - so props to him!

Edited by Game Master

Share this post


Link to post
Share on other sites

In my opinion, you should have added a rarity bonus to it as well. With an enumeration, it'd be easy.

Probly, wrote this to handle common boxes. (casket,mystery box etc) which doesn't have any rare items.

Edited by FUZENSETH

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  

×