Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 2.02 KB

README.md

File metadata and controls

58 lines (42 loc) · 2.02 KB

Arakne Value javadoc Maven Central

Common data structure, constants and helpers for Dofus 1.29.

Installation

For installing using maven, add this dependency into the pom.xml :

<dependency>
    <groupId>fr.arakne</groupId>
    <artifactId>arakne-value</artifactId>
    <version>0.8-alpha</version>
</dependency>

Structures

  • Colors : Store the creatures / players colors
  • Dimensions : Store 2D dimensions (with and height)
  • Interval : Store an integer interval, with min and max

Constants

  • Gender : The character gender (male or female)
  • Race : The character races / classes enum (only dofus 1.29 races)

Helpers

Helper class for generate random values in replacement of the native Random class. Also useful for create predictable random values during unit tests.

// Create the random instance
RandomUtil random = new RandomUtil();

// Create a shared (static) instance of the RandomUtil
// This is necessary for enable testing mode on static fields
RandomUtil shared = RandomUtil.createShared(); 

random.bool(35); // 35% of chance to be true
random.rand(new Interval(4, 10)); // Random number between 4 and 10

Enable testing mode on unit test :

public class MyTestCase {
    @BeforeEach
    public void setUp() {
        // Enable testing mode and reset the random seed
        // Execute before each tests, so the generated value is always independent
        RandomUtil.enableTestingMode();
    }
}